Changeset 10

Show
Ignore:
Timestamp:
04/20/07 09:30:57 (2 years ago)
Author:
satelliittipupu
Message:

A commit for backup before I do some big changes with SceneChain? and Scene.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/pihlaja/src/build/pihlaja.brf

    r8 r10  
    66#-v 
    77#-debug=15 
    8 -debug=gstreamer 
    9 -debug=gstreamerbus 
     8#-debug=gstreamer 
     9#-debug=gstreamerbus 
     10-debug=loading 
    1011-debug=Pihlaja 
    1112-debug=Project 
    1213-debug=Movie 
    1314-debug=Scene 
    14 -debug=LinkableScene 
     15#-debug=LinkableScene 
    1516-debug=SceneChain 
    16 -debug=Track 
    17 -debug=MaterialsTreeview 
     17#-debug=Track 
     18#-debug=MaterialsTreeview 
    1819#-debug=Render 
    1920#-debug=Invalidation 
  • trunk/pihlaja/src/pihlaja/core/discoverer.d

    r5 r10  
    632632                        found_video = true; 
    633633                        currentVideoMaterial = new Material( current, MaterialType.VIDEO, pad_duration ); 
    634                         project.newMaterial( currentVideoMaterial ); 
     634                        project.addMaterial( currentVideoMaterial ); 
    635635                        //TODO currentVideoMaterial.setAudioInfo(caps) 
    636636                    } 
     
    640640                        found_audio = true; 
    641641                        currentAudioMaterial = new Material( current, MaterialType.AUDIO, pad_duration ); 
    642                         project.newMaterial( currentAudioMaterial ); 
     642                        project.addMaterial( currentAudioMaterial ); 
    643643                        //TODO currentVideoMaterial.setVideoInfo(caps) 
    644644                    } 
     
    867867                found_video = true; 
    868868                currentVideoMaterial = new Material( current, MaterialType.VIDEO, pad_duration ); 
    869                 project.newMaterial( currentVideoMaterial ); 
     869                project.addMaterial( currentVideoMaterial ); 
    870870                debug(Discoverer) writefln("Discoverer.newDecodedPadCb() Creating new video material. DONE."); 
    871871                //TODO currentVideoMaterial.setAudioInfo(caps) 
     
    887887                found_audio = true; 
    888888                currentAudioMaterial = new Material( current, MaterialType.AUDIO, pad_duration ); 
    889                 project.newMaterial( currentAudioMaterial ); 
     889                project.addMaterial( currentAudioMaterial ); 
    890890                //TODO currentAudioMaterial.setVideoInfo(caps) 
    891891                debug(Discoverer) writefln("Discoverer.newDecodedPadCb() Creating new audio material. DONE."); 
  • trunk/pihlaja/src/pihlaja/core/edit.d

    r9 r10  
    188188        parent_node.addChild( edit_node ); 
    189189        edit_node.setAttribute( "name", name ); 
    190         edit_node.setAttribute( "x", x ); 
    191         edit_node.setAttribute( "y", y ); 
    192         edit_node.setAttribute( "w", w ); 
    193         edit_node.setAttribute( "h", h ); 
     190        edit_node.setAttribute( "start", start ); 
     191        edit_node.setAttribute( "duration", duration ); 
     192        edit_node.setAttribute( "y", y );//This might not be needed and maybe it should be removed. 
     193        edit_node.setAttribute( "h", h );//This might not be needed and maybe it should be removed. 
    194194        //This isn't needed as the Track is known: edit_node.setAttribute( "trackNumber", trackNumber() ); 
    195195        //This isn't needed as the Track is known: edit_node.setAttribute( "mediaType", track.mediaTypeString() ); 
    196196        edit_node.setAttribute( "mediaStart", mediaStart ); 
    197197        edit_node.setAttribute( "mediaDuration", mediaDuration ); 
    198          
     198        edit_node.setAttribute( "materialID", material.id ); 
    199199         
    200200    } 
  • trunk/pihlaja/src/pihlaja/core/material.d

    r9 r10  
    1616private import gstreamerc.gstreamertypes; 
    1717 
     18//PTL imports: 
     19private import ptl.xml; 
     20 
    1821//Pihlaja imports: 
    1922 
     
    2932    VIDEO, 
    3033    AUDIO, 
    31     MUSIC, 
    32     IMAGE, 
    33     IMAGE_SEQUENCE, 
    34     LINK 
     34    MUSIC,//TODO 
     35    IMAGE,//TODO 
     36    IMAGE_SEQUENCE,//TODO 
     37    LINK//TODO 
    3538} 
    3639 
     
    4952public: 
    5053 
     54    public char[] id() { return m_id; } 
     55    protected char[] id( char[] set ) { return m_id = set; } 
     56    protected char[] m_id; 
     57     
    5158    this( char[] fnam, MaterialType set_mater_type, double set_duration )// = "untitled" ) 
    5259    { 
     
    5562 
    5663        debug(Discoverer) writefln("Creating new Material: ", fnam ); 
     64         
     65        id = std.string.toString( cast(size_t)cast(void*)this ); 
    5766         
    5867        /* 
     
    7685        mediaDuration = set_duration; //* 25.0; 
    7786 
     87    } 
     88 
     89    static Material load003( XmlNode xml_node ) 
     90    { 
     91        Material empty = new Material( xml_node.getAttribute( "filename" ), materialTypeFromString( xml_node.getAttribute( "materialType" ) ), std.string.atof( xml_node.getAttribute( "mediaDuration" )) ); 
     92         
     93        /*XmlNode[] child_nodes = xml_node.getChildren(); 
     94             
     95        foreach( XmlNode ch_node; child_nodes ) 
     96        { 
     97            if( ch_node.getName() == "SceneChain") 
     98            { 
     99                debug(loading) writefln("-  Found SceneChain."); 
     100                sceneChain.pushBack( SceneChain.load003( this, ch_node ) ); 
     101            } 
     102        }*/ 
     103         
     104        return empty; 
     105     
     106    } 
     107 
     108    void save003( XmlNode parent_node ) 
     109    { 
     110        XmlNode material_node = new XmlNode("Material"); 
     111        parent_node.addChild( material_node ); 
     112        material_node.setAttribute( "id:", id ); 
     113        material_node.setAttribute( "filename", filename ); 
     114        material_node.setAttribute( "mediaStart", mediaStart ); 
     115        material_node.setAttribute( "mediaDuration", mediaDuration ); 
     116        material_node.setAttribute( "materialType", materialTypeString() ); 
     117         
     118    } 
     119 
     120    static MaterialType materialTypeFromString( char[] from ) 
     121    { 
     122        if( from == "video" ) 
     123            return MaterialType.VIDEO; 
     124        else if( from == "audio" ) 
     125            return MaterialType.AUDIO; 
     126        else if( from == "music" ) 
     127            return MaterialType.MUSIC; 
     128        else if( from == "image" ) 
     129            return MaterialType.IMAGE; 
     130        else if( from == "image_sequence" ) 
     131            return MaterialType.IMAGE_SEQUENCE; 
     132        else if( from == "link" ) 
     133            return MaterialType.LINK; 
     134        return MaterialType.NONE; 
     135    } 
     136 
     137    char[] materialTypeString() 
     138    { 
     139        if( materialType == MaterialType.VIDEO ) 
     140            return "video"; 
     141        else if( materialType == MaterialType.AUDIO ) 
     142            return "audio"; 
     143        else if( materialType == MaterialType.MUSIC ) 
     144            return "music"; 
     145        else if( materialType == MaterialType.IMAGE ) 
     146            return "image"; 
     147        else if( materialType == MaterialType.IMAGE_SEQUENCE ) 
     148            return "image_sequence"; 
     149        else if( materialType == MaterialType.LINK ) 
     150            return "link"; 
     151        return "none"; 
    78152    } 
    79153 
  • trunk/pihlaja/src/pihlaja/core/movie.d

    r9 r10  
    6161{ 
    6262public: 
    63     this( Project set_project, char[] set_name = "Untitled movie" ) 
     63    this( Project set_project, char[] set_name = "Untitled_movie" ) 
    6464    { 
    6565        debug(Movie) writefln("Movie.this() START."); 
     
    7777         
    7878        m_name = set_name; 
    79         if( m_name == "Untitled movie" ) 
     79        if( m_name == "Untitled_movie" ) 
    8080            m_name = m_name ~ std.string.toString( count_times ); 
    8181         
     
    8383         
    8484        pipeline = new Pipeline( "movie-pipeline" ~ std.string.toString( count_times ) ); 
     85         
     86        SceneChain empty_chain = new SceneChain( this ); 
     87        startScene = new StartScene( this, empty_chain ); 
     88        sceneChain.pushBack( empty_chain ); 
     89        addItem( startScene ); 
     90        startScene.addOnEvent( &onSceneEvent ); 
    8591         
    8692/* 
     
    135141        selectedSceneChains = new List!(LinkableScene); 
    136142         
     143    }  
     144     
     145    static Movie load003( Project set_project, XmlNode xml_node ) 
     146    { 
     147        Movie empty = new Movie( set_project, xml_node.getAttribute( "name" ) ); 
     148         
     149        XmlNode[] child_nodes = xml_node.getChildren(); 
     150             
     151        foreach( XmlNode ch_node; child_nodes ) 
     152        { 
     153            if( ch_node.getName() == "SceneChain") 
     154            { 
     155                debug(loading) writefln("-  Found SceneChain."); 
     156                empty.sceneChain.pushBack( SceneChain.load003( empty, ch_node ) ); 
     157            } 
     158        } 
     159     
     160        return empty; 
    137161    } 
    138162     
     
    154178        //createTestScene(); 
    155179         
    156         SceneChain empty_chain = new SceneChain( this ); 
    157         startScene = new StartScene( this, empty_chain ); 
    158         sceneChain.pushBack( empty_chain ); 
    159         addItem( startScene ); 
    160         startScene.addOnEvent( &onSceneEvent ); 
    161180        selectedScene = startScene; 
    162181 
     
    194213        count_create_test_scene_number++; 
    195214         
    196         //newScene( -350.0, -70.0, 250.0, 200.0, "10sec Scene " ~ std.string.toString(count_create_test_scene_number) ); 
    197         Scene test_scene = newScene( centerX, centerY, 250.0, 200.0, "10sec Scene " ~ std.string.toString(count_create_test_scene_number) ); 
     215        //newScene( -350.0, -70.0, 250.0, 200.0, "10sec_Scene " ~ std.string.toString(count_create_test_scene_number) ); 
     216        Scene test_scene = newScene( centerX, centerY, 250.0, 200.0, "10sec_Scene_" ~ std.string.toString(count_create_test_scene_number) ); 
    198217        //newTrack( MediaType.VIDEO, false, "Video 2" ); 
    199218         
     
    777796    } 
    778797 
     798    Scene addScene( Scene empty ) 
     799    { 
     800        addItem( empty ); 
     801        scene.pushBack( empty ); 
     802        empty.addOnEvent( &onSceneEvent ); 
     803        return empty; 
     804    } 
     805 
    779806    Scene newScene( double sx1 = 0.0, double sy1 = 0.0, double sx2 = 30.0, double sy2 = 30.0, String set_name = "Empty Scene" ) 
    780807    { 
     
    20442071    Element audio1;*/ 
    20452072 
    2046     StartScene startScene; 
     2073    public StartScene startScene() { return m_startScene; }//SceneChain needs this while loading. 
     2074    protected StartScene startScene( StartScene set ) { return m_startScene = set; } 
     2075    protected StartScene m_startScene; 
    20472076 
    20482077    LinkableScene m_selectedScene; 
  • trunk/pihlaja/src/pihlaja/core/project.d

    r9 r10  
    497497        discoverer = new Discoverer(this); 
    498498 
    499         newMovie(); 
     499        //newMovie(); 
    500500 
    501501    } 
     
    511511    { 
    512512        currentVersion++; 
    513         currentVersionFilename = projectDir ~ std.path.sep ~ "version" ~ std.string.toString( currentVersion ); 
     513        currentVersionFilename = projectDir ~ std.path.sep ~ "version" ~ std.string.toString( currentVersion ) ~ ".pihlajaproject"; 
     514    } 
     515 
     516    void load003( std.stream.File file ) 
     517    { 
     518        XmlNode xml_node = readDocument(file); 
     519        if( xml_node.getName() != "Pihlaja" ) 
     520        { 
     521            writefln("The first node isn't named Pihlaja. This is an invalid pihlajaproject file. Can't open it."); 
     522            return; 
     523        } 
     524        char[] file_format_version = xml_node.getAttribute( "fileFormatVersion" ); 
     525        if( file_format_version != "003" ) 
     526        { 
     527            writefln("This project file might not open correctly as it's fileFormatVersion is ", file_format_version, "This version of Pihlaja fully supports only version 003." ); 
     528        } 
     529         
     530        XmlNode[] project_nodes = xml_node.getChildren(); 
     531         
     532        foreach( XmlNode node; project_nodes ) 
     533        { 
     534            name = node.getAttribute( "name" ); 
     535            currentVersion = std.string.atoi( node.getAttribute( "currentVersion" ) ); 
     536            projectDir = node.getAttribute( "projectDir" ); 
     537            currentVersionFilename = node.getAttribute( "currentVersionFilename" ); 
     538             
     539            debug(loading) 
     540            { 
     541                writefln("read name: ", name ); 
     542                writefln("read currentVersion: ", currentVersion ); 
     543                writefln("read projectDir: ", projectDir ); 
     544                writefln("read currentVersionFilename: ", currentVersionFilename ); 
     545            } 
     546             
     547            XmlNode[] project_child_nodes = node.getChildren(); 
     548             
     549            foreach( XmlNode mov_node; project_child_nodes ) 
     550            { 
     551                if( mov_node.getName() == "Material" ) 
     552                { 
     553                    debug(loading) writefln("-  Found Material."); 
     554                    addMaterial( Material.load003( mov_node ) ); 
     555                } 
     556                else if( mov_node.getName() == "Movie" ) 
     557                { 
     558                    debug(loading) writefln("-  Found Movie."); 
     559                    addMovie( Movie.load003( this, mov_node ) ); 
     560                } 
     561            } 
     562        } 
     563         
    514564    } 
    515565 
     
    529579        project_node.setAttribute( "currentVersionFilename", currentVersionFilename ); 
    530580         
     581        foreach( Material mat; material ) 
     582        { 
     583            mat.save003( project_node ); 
     584        } 
     585         
    531586        foreach( Movie mov; movie ) 
    532587        { 
     
    576631    } 
    577632     
     633    abstract protected void addMovieToBin( Movie set_movie ); 
     634     
     635    Movie addMovie( Movie set_movie ) 
     636    { 
     637        debug(Project) writefln("Project.addMovie(Movie) START."); 
     638        debug(Project) scope(exit) writefln("Project.addMovie(Movie) END."); 
     639         
     640        movie.pushBack( set_movie ); 
     641        selectedMovie = set_movie; 
     642        addMovieToBin( set_movie ); 
     643        return set_movie; 
     644    } 
     645     
    578646    Movie newMovie() 
    579647    { 
     
    582650         
    583651        Movie empty = new Movie( this ); 
    584         movie.pushBack( empty ); 
    585         selectedMovie = empty; 
     652        //movie.pushBack( empty ); 
     653        //selectedMovie = empty; 
     654        addMovie( empty ); 
    586655        return empty; 
    587656    } 
     
    612681        Material mat3 = new Material( "/home/joonaz/sax.ogg", MaterialType.AUDIO, 10.0 * 25.0 ); 
    613682         
    614         newMaterial( mat1 ); 
    615         newMaterial( mat2 ); 
    616         newMaterial( mat3 ); 
    617         newMaterial( mat4 ); 
     683        addMaterial( mat1 ); 
     684        addMaterial( mat2 ); 
     685        addMaterial( mat3 ); 
     686        addMaterial( mat4 ); 
    618687     
    619688    } 
     
    631700    } 
    632701     
    633     Material newMaterial( Material set_material ) 
    634     { 
    635         debug(Discoverer) writefln("Project.newMaterial() START."); 
    636         debug(Discoverer) scope(exit) writefln("Project.newMaterial() END."); 
     702    Material addMaterial( Material set_material ) 
     703    { 
     704        debug(Discoverer) writefln("Project.addMaterial() START."); 
     705        debug(Discoverer) scope(exit) writefln("Project.addMaterial() END."); 
    637706         
    638707        //Material empty = new Material( filenam, typ ); 
     
    732801     
    733802    char[] projectDir; 
    734     char[] currentVersionFilename; 
     803    char[] currentVersionFilename;//This is only used when saving... 
     804    char[] currentFilename() { return projectDir ~ std.path.sep ~ "current.pihlajaproject"; }//This is used when opening the filename. 
    735805    uint currentVersion = 0;//This is the current version of the project. 
    736806    //It is incremented everytime saving occurs. 
  • trunk/pihlaja/src/pihlaja/core/scene.d

    r9 r10  
    111111    }*/ 
    112112     
    113     this( Movie set_parent_movie, SceneChain set_scene_chain, double sx = 0.0, double sy = 0.0, double sw = 100.0, double sh = 100.0, String set_name = "Empty LinkableScene" ) 
     113    this( Movie set_parent_movie, SceneChain set_scene_chain, double sx = 0.0, double sy = 0.0, double sw = 200.0, double sh = 120.0, String set_name = "Empty LinkableScene" ) 
    114114    { 
    115115        super( sx, sy, sw, sh, set_name ); 
     
    673673            return m_nextScene = set; 
    674674    } 
    675     LinkableScene nextScene() { return m_nextScene; } 
    676  
    677     protected LinkableScene beforeScene(LinkableScene set) 
     675    public LinkableScene nextScene() { return m_nextScene; } 
     676 
     677    public LinkableScene beforeScene(LinkableScene set) 
    678678    { 
    679679        //set.moveTo( x2, y ); 
     
    681681        return m_beforeScene = set; 
    682682    } 
    683     protected LinkableScene beforeScene() { return m_beforeScene; } 
     683    public LinkableScene beforeScene() { return m_beforeScene; } 
    684684 
    685685    /*class SceneChain 
     
    10901090    */ 
    10911091    public double sourceStart() { return m_sourceStart; } 
    1092     protected double sourceStart( double set ) 
     1092    public double sourceStart( double set ) 
    10931093    { 
    10941094        m_sourceStart = set; 
     
    14641464    //The nextScene is positioned to the right of this scene, and it follows this 
    14651465    //scene unless SHIFT is pressed (then it will be removed from the chain). 
     1466    public bool isLinkNextScene( bool set ) { return m_isLinkNextScene = set; } 
    14661467    public bool isLinkNextScene() { return m_isLinkNextScene; } 
    14671468    protected bool m_isLinkNextScene = false; 
    14681469    protected LinkableScene m_nextScene; 
     1470    public bool isLinkBeforeScene( bool set ) { return m_isLinkBeforeScene = set; } 
    14691471    public bool isLinkBeforeScene() { return m_isLinkBeforeScene; } 
    14701472    protected bool m_isLinkBeforeScene = false; 
     
    16241626        scene_node.setAttribute( "w", w ); 
    16251627        scene_node.setAttribute( "h", h ); 
     1628        scene_node.setAttribute( "isLinkNextScene", isLinkNextScene() ); 
     1629         
    16261630         
    16271631    } 
     
    20172021    } 
    20182022 
    2019     this( Movie set_parent_movie, SceneChain set_scene_chain, double sx = 0.0, double sy = 0.0, double sw = 100.0, double sh = 100.0, String set_name = "Empty Scene" ) 
     2023    this( Movie set_parent_movie, SceneChain set_scene_chain, double sx = 0.0, double sy = 0.0, double sw = 200.0, double sh = 120.0, String set_name = "Empty Scene" ) 
    20202024    { 
    20212025        debug(3) writefln("Scene.this(...) START."); 
     
    20342038    } 
    20352039*/ 
     2040 
     2041    static Scene load003( Movie set_movie, SceneChain set_scene_chain, XmlNode xml_node ) 
     2042    { 
     2043        Scene empty = new Scene( set_movie, set_scene_chain, 
     2044            std.string.atof( xml_node.getAttribute( "x" ) ), 
     2045            std.string.atof( xml_node.getAttribute( "y" ) ), 
     2046            std.string.atof( xml_node.getAttribute( "w" ) ), 
     2047            std.string.atof( xml_node.getAttribute( "h" ) ), 
     2048            xml_node.getAttribute( "name" ) ); 
     2049        //xml_node.getAttribute( "filename" ), materialTypeFromString( xml_node.getAttribute( "materialType" ) ), std.string.atof( xml_node.getAttribute( "mediaDuration" )) ); 
     2050        //empty.name = ; 
     2051        //empty.x = ; 
     2052        char[] is_link_next_string = xml_node.getAttribute( "isLinkNextScene" ); 
     2053        if( is_link_next_string == "true" ) 
     2054            empty.isLinkNextScene = true; 
     2055        else if( is_link_next_string == "false" ) 
     2056            empty.isLinkNextScene = false; 
     2057        else writefln("Error while loading Scene. isLinkNextScene is neither true or false."); 
     2058         
     2059        /* 
     2060        XmlNode[] child_nodes = xml_node.getChildren(); 
     2061             
     2062        foreach( XmlNode ch_node; child_nodes ) 
     2063        { 
     2064            if( ch_node.getName() == "StartScene") 
     2065            { 
     2066                debug(loading) writefln("-  Found StartScene."); 
     2067                //empty.pushBack( Scene.load003( set_movie, empty, ch_node ) ); 
     2068            } 
     2069             
     2070            if( ch_node.getName() == "Scene") 
     2071            { 
     2072                debug(loading) writefln("-  Found Scene."); 
     2073                empty.pushBack( Scene.load003( set_movie, empty, ch_node ) ); 
     2074            } 
     2075        }*/ 
     2076         
     2077        return empty; 
     2078     
     2079    } 
     2080 
    20362081    void save003( XmlNode parent_node ) 
    20372082    { 
     
    20432088        scene_node.setAttribute( "w", w ); 
    20442089        scene_node.setAttribute( "h", h ); 
     2090        scene_node.setAttribute( "isLinkNextScene", isLinkNextScene() ); 
    20452091         
    20462092        foreach( Track tr; track ) 
  • trunk/pihlaja/src/pihlaja/core/scenechain.d

    r9 r10  
    8787    } 
    8888     
     89    static SceneChain load003( Movie set_movie, XmlNode xml_node ) 
     90    { 
     91        SceneChain empty = new SceneChain( set_movie ); 
     92        //xml_node.getAttribute( "filename" ), materialTypeFromString( xml_node.getAttribute( "materialType" ) ), std.string.atof( xml_node.getAttribute( "mediaDuration" )) ); 
     93         
     94        XmlNode[] child_nodes = xml_node.getChildren(); 
     95             
     96        foreach( XmlNode ch_node; child_nodes ) 
     97        { 
     98            if( ch_node.getName() == "StartScene") 
     99            { 
     100                debug(loading) writefln("-  Found StartScene."); 
     101            /*  //empty.pushBack( Scene.load003( set_movie, empty, ch_node ) ); 
     102                 
     103                StartScene str = set_movie.startScene(); 
     104                 
     105                set_movie.startScene.x = std.string.atof( ch_node.getAttribute( "x" ) ); 
     106                set_movie.startScene.y = std.string.atof( ch_node.getAttribute( "y" ) ); 
     107                set_movie.startScene.w = std.string.atof( ch_node.getAttribute( "w" ) ); 
     108                set_movie.startScene.h = std.string.atof( ch_node.getAttribute( "h" ) ); 
     109                 
     110                char[] is_link_next_string = ch_node.getAttribute( "isLinkNextScene" ); 
     111                if( is_link_next_string == "true" ) 
     112                    set_movie.startScene.isLinkNextScene = true; 
     113                else if( is_link_next_string == "false" ) 
     114                    set_movie.startScene.isLinkNextScene = false; 
     115                else writefln("Error while loading StartScene. isLinkNextScene is neither true or false."); 
     116                 
     117                str.sceneChain.remove( str ); 
     118                empty.pushBack( str ); 
     119            */   
     120            } 
     121             
     122            /*if( ch_node.getName() == "Scene") 
     123            { 
     124                debug(loading) writefln("-  Found Scene."); 
     125                Scene scn = Scene.load003( set_movie, empty, ch_node ); 
     126                //empty.pushBack( scn ); 
     127                //set_movie.addScene( scn ); 
     128            }*/ 
     129        } 
     130         
     131        //empty.updateSceneChain(); 
     132         
     133        return empty; 
     134     
     135    } 
     136     
    89137    void save003( XmlNode parent_node ) 
    90138    { 
     
    97145            scn.save003( scene_chain_node ); 
    98146        } 
     147         
     148    } 
     149     
     150    /**  
     151    * updateSceneChain updates the linkedlist kind of 
     152    * structure (the nextScene and beforeScene members of each scene in the sceneChain list). 
     153    * This is called atleast after addToSceneChain. 
     154    */ 
     155    protected void updateSceneChain( bool select_this_scene = false ) 
     156    { 
     157        debug(SceneChain) writefln("SceneChain.updateSceneChain() START." ); 
     158        debug(SceneChain) scope(exit) writefln("SceneChain.updateSceneChain() END."); 
     159         
     160            LinkableScene bef = null; 
     161            LinkableScene first = first(); 
     162            debug(SceneChain) writefln("sceneChain.first.name: ", first.name() ); 
     163            double current_frame = 0.0; 
     164             
     165            //This will remove the current scene.gnlCompositions from the pipelinePlayer. 
     166            //and put our first scene there. Also "reallyselects" the first scene. 
     167            //CHECK: should this behaviour be optional... because of splitSceneChain calling updateSceneChain too. 
     168            //Now it's optional. 
     169            if( select_this_scene == true && movie !is null) 
     170            { 
     171                //CHANGED FROM movie.selectedScene = cast(LinkableScene) first; 
     172                //TO 
     173                movie.deselectAll(); 
     174                movie.setIsSelectedOne( cast(CanvasItem) first, true ); 
     175            } 
     176             
     177            foreach( LinkableScene item; this ) 
     178            { 
     179                if( bef !is null ) 
     180                { 
     181                    debug(SceneChain) writefln("SceneChain.updateSceneChain() in the loop."); 
     182                 
     183                    item.sceneChain = this;//bef.sceneChain; 
     184                    bef.nextScene = item; 
     185                    item.beforeScene = bef; 
     186                     
     187                    if( bef.isLinkNextScene == false && item.isLinkBeforeScene == false ) 
     188                    { 
     189                        double item_delta_x = bef.x2 - item.x; 
     190                        double item_delta_y = bef.cy - item.cy; 
     191                        item.moveR( item_delta_x, item_delta_y ); 
     192                    } 
     193                    else if( bef.isLinkNextScene == true && item.isLinkBeforeScene == true ) 
     194                    { 
     195                         
     196                    } 
     197                    else if( bef.isLinkNextScene == true ) 
     198                    { 
     199                        item.isLinkBeforeScene = true; 
     200                    } 
     201                    else 
     202                    { 
     203                        writefln("Scene.updateSceneChain() Error: m_isLinkNextScene and m_isLinkBeforeScene don't match."); 
     204                    } 
     205                     
     206                } 
     207                bef = item; 
     208                 
     209                debug(SceneChain) writefln("updateSceneChain() updating masterScene."); 
     210                 
     211                //gstreamer/gnonlin part: 
     212                //This will put the gnlSources of all the scenes inside the ownGnlCompositions 
     213                //of the first scene in the sceneChain. 
     214                //(cast(LinkableScene) 
     215                item.masterScene( first ); 
     216                 
     217                 
     218                debug(SceneChain) writefln("updateSceneChain() updating sourceStart."); 
     219                //and this will change the sources starting positions so that they 
     220                //follow each other. 
     221                //(cast(LinkableScene) 
     222                item.sourceStart = current_frame; 
     223                 
     224                debug(SceneChain) writefln("updateSceneChain() setting current_frame += item.duration."); 
     225                current_frame += item.duration(); 
     226            } 
    99227         
    100228    } 
  • trunk/pihlaja/src/pihlaja/core/track.d

    r9 r10  
    232232        (cast(Edit)it).fileSourceCopy().ref();//CHECK if this makes any sense gstreamer remove/ref. 
    233233        (cast(Bin) m_gnlComposition).remove( (cast(Edit)it).fileSourceCopy() ); 
    234  
     234     
    235235    } 
    236236 
  • trunk/pihlaja/src/pihlaja/pihlajamain.d

    r9 r10  
    105105    { 
    106106        splashScreen.okToHide = true; 
     107         
    107108    } 
    108109     
     
    118119    } 
    119120     
    120     ProjectWindow newProject( char[] name, char[] projectDir ) 
     121    ProjectWindow openProject( char[] name, char[] projectDir ) 
    121122    { 
    122123        debug(Project) writefln("Pihlaja.newProject() START."); 
     
    131132         
    132133        ProjectWindow empty = new ProjectWindow( this ); 
     134        //empty.load003( name, projectDir ); 
    133135        empty.setNameAndProjectDir( name, projectDir ); 
     136        empty.load003(); 
    134137        project.pushBack( empty ); 
    135138        //selectedProject = empty; 
  • trunk/pihlaja/src/pihlaja/ui/materialstreeview.d

    r8 r10  
    2727private import pihlaja.core.globals; 
    2828 
     29private import pihlaja.core.movie; 
    2930private import pihlaja.core.material; 
    3031 
     
    4344 
    4445    Image binImage; 
     46    Image movieImage; 
    4547    Image materialImage; 
    4648    //Pixbuf pixbuf; 
     
    7779        newImageScaled( binImage, g_themeDir ~ "/icons/bin.png", -1, 18 ); 
    7880        newImageScaled( materialImage, g_themeDir ~ "/icons/material.png", -1, 18 ); 
     81        newImageScaled( movieImage, g_themeDir ~ "/icons/movie.png", -1, 18 ); 
    7982         
    8083        //pixbuf = new Pixbuf(greenClass_xpm); 
     
    150153         
    151154        selectedBin = materialTreeStore.append( iterTop );   
     155    } 
     156     
     157    void addMovie( Movie set_movie ) 
     158    { 
     159        debug(Discoverer) writefln("MaterialsTreeview.addMovie() Putting the movie to the bin.\n"); 
     160        //TreeIter iterTop = materialTreeStore.createIter(); 
     161        TreeIter iterChild; 
     162         
     163        iterChild = materialTreeStore.append( selectedBin ); 
     164        materialTreeStore.setValue( iterChild, 0, movieImage.getPixbuf() );//new Pixbuf( material_xpm) ); 
     165        materialTreeStore.setValue( iterChild, 1, set_movie.name() ); 
    152166    } 
    153167     
  • trunk/pihlaja/src/pihlaja/ui/projectchooser.d

    r8 r10  
    212212    void onSkip( Button unused_button ) 
    213213    { 
    214         hide(); 
     214        writefln("Currently skipping doesn't work."); 
     215        /*hide(); 
    215216         
    216217        char[] name = "Empty"; 
     
    220221        writefln("name: ", name, " projectDir: ", projectDir ); 
    221222         
    222         pihlaja.newProject( name, projectDir ); 
     223        pihlaja.newProject( name, projectDir );*/ 
    223224    } 
    224225     
     
    227228        hide(); 
    228229         
    229         char[] name = projectChooserTreeView.getSelected(); 
     230        //NOTICE we don't allow spaces in the names for now. Because the xml 
     231        //implementation doesn't support it when loading. 
     232        char[] name = std.string.replace( projectChooserTreeView.getSelected(), " ", "_" ); 
     233        //Anyway it goes in the future, I don't want to allow spaces in filenames, 
     234        //so the spaces also get replaced to "_" in the directory name. 
    230235        char[] projectDir = std.path.addExt( getAbsoluteDir( g_projectDir ~ std.path.sep ~ std.string.tolower( std.string.replace( name, " ", "_" ) ) ), "pihlaja" ); 
    231236         
    232237        writefln("name: ", name, " projectDir: ", projectDir ); 
    233238         
    234         pihlaja.newProject( name, projectDir ); 
     239        pihlaja.openProject( name, projectDir ); 
    235240    } 
    236241     
  • trunk/pihlaja/src/pihlaja/ui/projectwindow.d

    r9 r10  
    114114         
    115115        window.addOnKeyPress( &onKeyPress ); 
    116         window.addOnRealize( &pihlaja.onWindowRealize ); 
     116        //window.addOnRealize( &pihlaja.onWindowRealize ); 
     117        window.addOnRealize( &onWindowRealize ); 
    117118 
    118119    debug(Pihlaja) writefln("Pihlaja.this() creating maingvbox."); 
     
    311312 
    312313 
    313     debug(Pihlaja) writefln("Pihlaja.this() adding monitorButtonsHBox to timelineVBox."); 
     314    debug(Pihlaja) writefln("Pihlaja.this() adding timelineButtonsHBox to timelineVBox."); 
    314315        timelineVBox.packStart( timelineButtonsHBox, false, false, 0 ); 
    315316         
    316         timelineVBox.packStart( selectedMovie, true, true, 0);//false, 0); 
     317        //timelineVBox.packStart( selectedMovie, true, true, 0);//false, 0); 
    317318 
    318319    debug(Pihlaja) writefln("Pihlaja.this() creating timeline_sliders_hbox."); 
     
    439440    }*/ 
    440441     
     442    void onWindowRealize( Widget unused_window ) 
     443    { 
     444        //load003(); //name, projectDir ); 
     445    } 
     446     
     447    void load003()// char[] set_name, char[] set_project_dir ) 
     448    { 
     449        //writefln("Trying to open project ", set_name, " from project directory: ", set_project_dir ); 
     450         
     451        //setNameAndProjectDir( set_name, set_project_dir ); 
     452         
     453        writefln("Trying to open project ", name, " from project directory: ", projectDir ); 
     454         
     455        if( std.file.exists( currentFilename ) == true ) 
     456        { 
     457            writefln("Current version exists. Trying to open it."); 
     458            std.stream.File file = new File( currentFilename, FileMode.In ); 
     459            super.load003( file ); 
     460            file.close(); 
     461        } 
     462        else 
     463        { 
     464            writefln("Project file doesn't exist. This is a new project."); 
     465        } 
     466    } 
     467     
    441468    void save003() 
    442469    { 
     
    474501        if( std.file.exists( projectDir ) == true ) 
    475502        { 
     503            if( std.file.exists( "current.pihlajaproject" ) == true ) 
     504            { 
     505                writefln("Current version exists."); 
     506                //currentVersionAdd(); 
     507            } 
     508         
    476509            while( std.file.exists( currentVersionFilename ) == true ) 
    477510            { 
     
    807840 
    808841        return true; 
     842    } 
     843 
     844    //overloaded from Project 
     845    void addMovieToBin( Movie set_movie ) 
     846    { 
     847        if( materialsTreeview !is null ) 
     848            materialsTreeview.addMovie( set_movie ); 
     849    } 
     850 
     851    public Movie selectedMovie() { return super.selectedMovie(); } 
     852    public Movie selectedMovie( Movie set ) 
     853    { 
     854        if( timelineVBox !is null && selectedMovie !is null ) 
     855        { 
     856            timelineVBox.remove( selectedMovie ); 
     857        } 
     858        super.selectedMovie( set ); 
     859        if( timelineVBox !is null ) 
     860        { 
     861            timelineVBox.packStart( selectedMovie, true, true, 0); 
     862            selectedMovie.show(); 
     863        } 
     864        return set; 
    809865    } 
    810866