Changeset 21
- Timestamp:
- 07/26/07 08:18:16 (1 year ago)
- Files:
-
- trunk/pihlaja/src/pihlaja/core/edit.d (modified) (12 diffs)
- trunk/pihlaja/src/pihlaja/core/material.d (modified) (3 diffs)
- trunk/pihlaja/src/pihlaja/core/project.d (modified) (6 diffs)
- trunk/pihlaja/src/pihlaja/core/scene.d (modified) (2 diffs)
- trunk/pihlaja/src/pihlaja/ui/materialstreeview.d (modified) (4 diffs)
- trunk/pihlaja/src/pihlaja/ui/projectwindow.d (modified) (14 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/pihlaja/src/pihlaja/core/edit.d
r20 r21 64 64 65 65 //mixin PlaybackBin; //No. Not this. 66 67 public char[] id() { return m_id; } 68 public char[] id( char[] set ) { return m_id = set; } 69 protected char[] m_id; 66 70 67 71 //Notice that the order is x, W, y, h and not the usual x, y, W, h. Width is the second argument. … … 71 75 debug(Edit) Stdout("Edit.this() START.").newline; 72 76 debug(Edit) scope(exit) Stdout("Edit.this() END.").newline; 77 78 id = Integer.toUtf8( cast(size_t)cast(void*)this ); 73 79 74 80 m_scene = set_scene; … … 219 225 { 220 226 xw.startElement("Edit"); 227 xw.addAttribute( "id", id ); 221 228 xw.addAttribute( "name", name ); 222 229 xw.addAttribute( "start", Float.toUtf8(start) ); … … 228 235 xw.addAttribute( "mediaStart", Float.toUtf8(mediaStart) ); 229 236 xw.addAttribute( "mediaDuration", Float.toUtf8(mediaDuration) ); 230 xw.addAttribute( "materialID", material.id ); 237 xw.addAttribute( "materialId", material.id ); 238 if( editGroup !is null ) 239 xw.addAttribute( "editGroupId", editGroup.id() ); 240 else xw.addAttribute( "editGroupId", "@none" ); 231 241 xw.endElement("Edit"); 232 242 } … … 254 264 debug(loading) Stdout("updateAll() Wen't fine.").newline; 255 265 } 266 267 updatePipelineStart(); 268 updatePipelineDuration(); 256 269 } 257 270 … … 608 621 }*/ 609 622 610 //public char[] loadedMaterialI D;623 //public char[] loadedMaterialId; 611 624 Material material(){ return m_material; } 612 625 Material material( Material set ) … … 707 720 }*/ 708 721 709 LinkSeq!(Edit) editGroup() { return m_editGroup; } 710 LinkSeq!(Edit) editGroup( LinkSeq!(Edit) set ) { return m_editGroup = set; } 711 722 class EditGroup : protected LinkSeq!(Edit) 723 { 724 725 this() 726 { 727 id = Integer.toUtf8( cast(size_t)cast(void*)this ); 728 super(); 729 //m_editSeq = new LinkSeq!(Edit); 730 } 731 732 /* 733 //Just an idea, but it's not really a good one. 734 735 void save003( XMLWriter!() xw ) 736 { 737 xw.startElement("EditGroup"); 738 xw.addAttribute( "id", id ); 739 foreach( Edit ed; editSeq ) 740 { 741 xw.startElement("EditId"); 742 xw.addAttribute( "id", ed.id ); 743 xw.addAttribute( "name", ed.name ); 744 xw.endElement("EditId"); 745 } 746 xw.endElement("EditGroup"); 747 748 } 749 */ 750 751 /* 752 public LinkSeq!(Edit) editGroup() { return m_editGroup; } 753 public LinkSeq!(Edit) editGroup( LinkSeq!(Edit) set ) { return m_editGroup = set; } 754 protected LinkSeq!(Edit) m_editGroup; 755 */ 756 757 int opApply(int delegate(inout Edit) dg) 758 { 759 return super.opApply(dg); 760 } 761 762 public void append(Edit set) 763 { 764 //editSeq.append(set); 765 super.append(set); 766 } 767 768 public void merge( EditGroup set ) 769 { 770 //LinkSeq!(Edit) set_edit_group_mem = set.editSeq(); 771 //EditGroup set_edit_group_mem = set; 772 773 foreach( Edit item; set )//_edit_group_mem ) 774 { 775 //editSeq.append( item ); 776 super.append( item ); 777 item.editGroup = this; 778 } 779 //delete set_edit_group_mem; 780 delete set; 781 } 782 783 //public LinkSeq!(Edit) editSeq() { return m_editSeq; } 784 //public LinkSeq!(Edit) editSeq( LinkSeq!(Edit) set ) { return m_editSeq = set; } 785 //protected LinkSeq!(Edit) m_editSeq; 786 787 public char[] id() { return m_id; } 788 public char[] id( char[] set ) { return m_id = set; } 789 protected char[] m_id; 790 } 791 792 public EditGroup editGroup() { return m_editGroup; } 793 public EditGroup editGroup( EditGroup set ) { return m_editGroup = set; } 794 protected EditGroup m_editGroup; 795 796 /** 797 This is used when loading. It checks for existing editGroups 798 with the id, and if none is found it will create a new one with 799 the id. 800 */ 801 void addToEditGroupById( char[] gid ) 802 { 803 debug(EditGroup) Stdout("Edit.addToEditGroupById(char[]) START.").newline; 804 debug(EditGroup) scope(exit) Stdout("Edit.addToEditGroupById(char[]) END.").newline; 805 806 if( gid == "@none" ) 807 return; 808 809 if( editGroup !is null ) 810 { 811 debug(EditGroup) Stdout("Edit.addToEditGroupById() There already is an editGroup. This shouldn't happen.").newline; 812 //TODO throw an exception, and catch it graphically in main? 813 } 814 815 foreach( Edit ed; scene.edit ) 816 { 817 EditGroup grup = ed.editGroup; 818 if( grup !is null ) 819 { 820 if( grup.id == gid ) 821 { 822 ed.addToEditGroup( this ); 823 return;//I bet it's enough to find the first 824 //group with this id. There should be only one... I hope. 825 } 826 } 827 } 828 829 //No editGroup found with that id. Create a new one. 830 editGroup = new EditGroup(); 831 editGroup.id = gid;//This might theoretically screw up stuff, 832 //if the loaded id's would overlap with some newly created ones. 833 //So we should really use some UID system... TODO I bet Tango has them 834 //in it's newest version. 835 editGroup.append( this ); 836 837 } 838 839 /** 840 Make this and set to be in the same editGroup and create the 841 group if needed. 842 */ 712 843 void addToEditGroup( Edit set ) 713 844 { … … 721 852 { 722 853 debug(EditGroup) Stdout("Edit.addToEditGroup(Edit ed) neither of them has an editGroup. We'll create a new one."); 723 editGroup = new LinkSeq!(Edit);854 editGroup = new EditGroup();//LinkSeq!(Edit); 724 855 set.editGroup = editGroup; 725 856 … … 735 866 } 736 867 } 737 else //set already has a chain:868 else //set already has an editGroup: 738 869 { 739 870 if( editGroup is null )//but this doesn't, so we'll just add this to set.chain. … … 746 877 else if( set.editGroup is editGroup ) 747 878 { 748 //We don't do anything, because they are in the same sceneChain.879 //We don't do anything, because they are in the same editGroup. 749 880 debug(EditGroup) Stdout( "Edit.addToEditGroup() set.editGroup is editGroup. They already are synced into the same group.'" ); 750 881 } … … 756 887 //because it will get changed away in the 757 888 //foreach loops. Atleast it should: 758 LinkSeq!(Edit) set_edit_group_mem = set.editGroup(); 759 760 foreach( Edit item; set_edit_group_mem ) 761 { 762 editGroup.append( item ); 763 item.editGroup = editGroup; 764 } 765 delete set_edit_group_mem; 889 editGroup.merge( set.editGroup() ); 766 890 } 767 891 } … … 799 923 //the properties correctly. 800 924 801 LinkSeq!(Edit) m_editGroup;802 803 925 public uint numberOfVisibleHandles() { return m_numberOfVisibleHandles; } 804 926 public uint numberOfVisibleHandles( uint set ) trunk/pihlaja/src/pihlaja/core/material.d
r20 r21 289 289 xw.addAttribute( "name", name ); 290 290 if( linkMovie !is null ) 291 xw.addAttribute( "linkMovieI D", linkMovie.id() );292 else xw.addAttribute( "linkMovieI D", "@none" );291 xw.addAttribute( "linkMovieId", linkMovie.id() ); 292 else xw.addAttribute( "linkMovieId", "@none" ); 293 293 xw.addAttribute( "mediaStart", Float.toUtf8(mediaStart) ); 294 294 xw.addAttribute( "mediaDuration", Float.toUtf8(mediaDuration) ); … … 307 307 if( linkMovie is null ) 308 308 { 309 linkMovie = pr.getMovieByI D( linkMovieID);309 linkMovie = pr.getMovieById( linkMovieId ); 310 310 if( linkMovie is null ) 311 311 { 312 Stdout("Material.updateAll() ERROR: Still can't find linkMovie with the linkMovieI D. Project loading has failed. linkMovieID:")(linkMovieID).newline;312 Stdout("Material.updateAll() ERROR: Still can't find linkMovie with the linkMovieId. Project loading has failed. linkMovieId:")(linkMovieId).newline; 313 313 } 314 314 else … … 578 578 { 579 579 if( set !is null ) 580 linkMovieI D= set.id();580 linkMovieId = set.id(); 581 581 return m_linkMovie = set; 582 582 } 583 583 public Movie linkMovie() { return m_linkMovie; } 584 584 protected Movie m_linkMovie; 585 public char[] linkMovieI D;585 public char[] linkMovieId; 586 586 587 587 //This might be a good idea to keep a list of Edits that use this Material: trunk/pihlaja/src/pihlaja/core/project.d
r20 r21 647 647 } 648 648 649 Movie getMovieByI D( char[] find_id )650 { 651 debug(Project) Stdout("Project.getMovieByI D(char[] find_id) START.").newline;652 debug(Project) scope(exit) Stdout("Project.getMovieByI D(char[] find_id) END.").newline;649 Movie getMovieById( char[] find_id ) 650 { 651 debug(Project) Stdout("Project.getMovieById(char[] find_id) START.").newline; 652 debug(Project) scope(exit) Stdout("Project.getMovieById(char[] find_id) END.").newline; 653 653 654 654 Movie res; … … 660 660 if( res !is null ) 661 661 { 662 debug(Project) Stdout("Project.getMovieByI D(char[] find_id) Movie ")( res.name )(" found with id: ")( find_id ).newline;662 debug(Project) Stdout("Project.getMovieById(char[] find_id) Movie ")( res.name )(" found with id: ")( find_id ).newline; 663 663 return res; 664 664 } 665 665 else 666 666 { 667 debug(Project) Stdout("Project.getMovieByI D(char[] find_id) No Movie found with id: ")(find_id).newline;667 debug(Project) Stdout("Project.getMovieById(char[] find_id) No Movie found with id: ")(find_id).newline; 668 668 } 669 669 return null; 670 670 } 671 671 672 Movie selectedMovieI D( char[] find_id )673 { 674 debug(Project) Stdout("Project.selectedMovieI D(char[] find_id) START.").newline;675 debug(Project) scope(exit) Stdout("Project.selectedMovieI D(char[] find_id) END.").newline;676 677 Movie res = getMovieByI D( find_id );672 Movie selectedMovieId( char[] find_id ) 673 { 674 debug(Project) Stdout("Project.selectedMovieId(char[] find_id) START.").newline; 675 debug(Project) scope(exit) Stdout("Project.selectedMovieId(char[] find_id) END.").newline; 676 677 Movie res = getMovieById( find_id ); 678 678 679 679 if( res !is null ) 680 680 { 681 debug(Project) Stdout("Project.selectedMovieI D(char[] find_id) Movie ")( res.name )(" found with id: ")( find_id ).newline;681 debug(Project) Stdout("Project.selectedMovieId(char[] find_id) Movie ")( res.name )(" found with id: ")( find_id ).newline; 682 682 selectedMovie( res ); 683 683 } 684 684 else 685 685 { 686 debug(Project) Stdout("Project.selectedMovieI D(char[] find_id) No Movie found with id: ")(find_id).newline;686 debug(Project) Stdout("Project.selectedMovieId(char[] find_id) No Movie found with id: ")(find_id).newline; 687 687 } 688 688 return res; … … 1344 1344 xw.addAttribute( "projectDir", projectDir ); 1345 1345 xw.addAttribute( "lastVersionFilename", lastVersionFilename ); 1346 xw.addAttribute( "selectedMovieI D", sel_mov_id );1346 xw.addAttribute( "selectedMovieId", sel_mov_id ); 1347 1347 1348 1348 foreach( Material mat; material ) … … 1604 1604 } 1605 1605 1606 Material getMaterialByI D( char[] find_id )1606 Material getMaterialById( char[] find_id ) 1607 1607 { 1608 1608 debug(Project) Stdout("Project.getMaterialById(char[] find_id) START.").newline; … … 1707 1707 //It is incremented everytime saving occurs. 1708 1708 1709 public Movie currentlyDraggedMovieI D( char[] find_id )1710 { 1711 return m_currentlyDraggedMovie = getMovieByI D( find_id );1709 public Movie currentlyDraggedMovieId( char[] find_id ) 1710 { 1711 return m_currentlyDraggedMovie = getMovieById( find_id ); 1712 1712 1713 1713 /* … … 1716 1716 if( res !is null ) 1717 1717 { 1718 //debug(Project) Stdout("Project.selectedMovieI D(char[] find_id) Movie ")( res.name )(" found with id: ")( find_id ).newline;1718 //debug(Project) Stdout("Project.selectedMovieId(char[] find_id) Movie ")( res.name )(" found with id: ")( find_id ).newline; 1719 1719 m_currentlyDraggedMovie = res; 1720 1720 } 1721 1721 else 1722 1722 { 1723 //debug(Project) Stdout("Project.selectedMovieI D(char[] find_id) No Movie found with id: ")(find_id).newline;1723 //debug(Project) Stdout("Project.selectedMovieId(char[] find_id) No Movie found with id: ")(find_id).newline; 1724 1724 }*/ 1725 1725 } trunk/pihlaja/src/pihlaja/core/scene.d
r18 r21 1538 1538 sceneChain.append( this ); 1539 1539 1540 mainColour.set( 0.2, 0.5, 0.2, 1.0 ); 1540 mainColour.set( 0.2, 0.5, 0.2, 0.8 ); 1541 //This transparency of the StartScene is a quick hack to show 1542 //the underlying half circle of the node link. 1541 1543 applyMainColour(); 1542 1544 … … 5058 5060 SceneRuler ruler; 5059 5061 5060 EditContainer!(Edit) edit;5062 public EditContainer!(Edit) edit; 5061 5063 LinkSeq!(Edit) selectedEdits;//TODO: this should be changed into some kind of a Hash thing. 5062 5064 public TrackContainer!(Track) track;//This is duplicating the data found from "this".RTree trunk/pihlaja/src/pihlaja/ui/materialstreeview.d
r18 r21 151 151 debug(Discoverer) Stdout("drag name: ")( col_name.getString() )(" id: ")( col_id.getString() ).newline; 152 152 153 Movie drmov = project.currentlyDraggedMovieI D( col_id.getString() );153 Movie drmov = project.currentlyDraggedMovieId( col_id.getString() ); 154 154 155 155 if( drmov.movieType == MovieType.NORMAL ) … … 187 187 debug(Discoverer) Stdout("tree name: ")( col_name.getString() )(" id: ")( col_id.getString() ).newline; 188 188 189 Movie mov = project.getMovieByI D( col_id.getString() );189 Movie mov = project.getMovieById( col_id.getString() ); 190 190 191 191 m_treeStore.setValue( iter, MaterialColumnType.DURATION, g_toTimecode( mov.duration() ) ); … … 221 221 debug(Discoverer) Stdout("activated name: ")( col_name.getString() )(" id: ")( col_id.getString() ).newline; 222 222 223 project.selectedMovieI D( col_id.getString() );223 project.selectedMovieId( col_id.getString() ); 224 224 } 225 225 … … 368 368 ++col; 369 369 370 column = new TreeViewColumn("I D", new CellRendererText(), "text", col);370 column = new TreeViewColumn("Id", new CellRendererText(), "text", col); 371 371 treeView.appendColumn(column); 372 372 column.setResizable(true); trunk/pihlaja/src/pihlaja/ui/projectwindow.d
r20 r21 828 828 829 829 //Project 830 char[] l_selectedMovieI D= "";830 char[] l_selectedMovieId = ""; 831 831 832 832 //Material: … … 836 836 char[] l_materialType = ""; 837 837 char[] l_filename = ""; 838 char[] l_linkMovieI D= "";838 char[] l_linkMovieId = ""; 839 839 char[] l_mediaStart = ""; 840 840 char[] l_mediaDuration = ""; … … 876 876 //char[] l_mediaStart = ""; 877 877 //char[] l_mediaDuration = ""; 878 char[] l_materialID = ""; 879 878 char[] l_materialId = "@none"; 879 char[] l_editGroupId = "@none"; 880 880 881 this( Project set_project ) 881 882 { … … 918 919 l_currentMaterial.id = l_id; 919 920 l_currentMaterial.loadedName = l_name; 920 l_currentMaterial.linkMovieI D = l_linkMovieID;921 l_currentMaterial.linkMovieId = l_linkMovieId; 921 922 l_currentMaterial.mediaDuration = Float.toFloat!(T)(l_mediaDuration); 922 923 l_project.addMaterial(l_currentMaterial); … … 944 945 foreach( mat; material ) 945 946 { 946 if( mat.linkMovieI D== l_id )947 if( mat.linkMovieId == l_id ) 947 948 { 948 949 if( mat.trackType == TrackType.VIDEO ) … … 1092 1093 if( l_currentScene !is null ) 1093 1094 { 1094 Material ed_mat = l_project.getMaterialByI D( l_materialID);1095 Material ed_mat = l_project.getMaterialById( l_materialId ); 1095 1096 l_currentEdit = new Edit( l_currentScene, ed_mat, Float.toFloat!(T)(l_start), Float.toFloat!(T)(l_duration) ); 1096 //currentEdit.loadedMaterialI D = materialID;1097 //currentEdit.loadedMaterialId = materialId; 1097 1098 l_currentScene.addEdit( l_currentEdit, l_currentTrack ); 1099 l_currentEdit.addToEditGroupById( l_editGroupId ); 1098 1100 l_element = ""; 1099 1101 } … … 1103 1105 } 1104 1106 break; 1105 1107 /*case "EditGroup": 1108 debug(loading) Stdout("Creating a new EditGroup.").newline; 1109 if( l_currentScene !is null ) 1110 { 1111 1112 } 1113 break;*/ 1106 1114 1107 1115 }//end switch set_name … … 1124 1132 default: break; 1125 1133 //Project 1126 case "selectedMovieID": 1127 l_selectedMovieID = value; 1134 case "selectedMovieId": 1135 case "selectedMovieID"://deprecated 1136 l_selectedMovieId = value; 1128 1137 break; 1129 1138 //Material … … 1137 1146 l_filename = value; 1138 1147 break; 1139 case "linkMovieID": 1140 l_linkMovieID = value; 1148 case "linkMovieId": 1149 case "linkMovieID"://deprecated 1150 l_linkMovieId = value; 1141 1151 break; 1142 1152 case "mediaStart": … … 1205 1215 break; 1206 1216 //Edit 1217 1207 1218 case "start": 1208 1219 l_start = value; … … 1211 1222 l_duration = value; 1212 1223 break; 1213 case "materialID": 1214 l_materialID = value; 1215 break; 1224 case "materialId": 1225 case "materialID"://deprecated 1226 l_materialId = value; 1227 break; 1228 case "editGroupId": 1229 l_editGroupId = value; 1230 break; 1231 1216 1232 } 1217 1233 } … … 1228 1244 break; 1229 1245 //case "Movie": 1230 // l_project.selectedMovieI D( l_id );1246 // l_project.selectedMovieId( l_id ); 1231 1247 //l_selectedMovie 1232 1248 //break; 1233 1249 case "Project": 1234 Movie sel_mov = l_project.selectedMovieI D( l_selectedMovieID);1250 Movie sel_mov = l_project.selectedMovieId( l_selectedMovieId ); 1235 1251 version(Removed) sel_mov.selectStartScene(); 1236 1252 … … 1469 1485 { 1470 1486 //showFileChooser(); 1471 save();1487 //save(); 1472 1488 //onMenuActivate(menuItem); 1489 1490 if( save() == true ) 1491 statusbar( "Saving complete. Saved version " ~ Integer.toUtf8( currentVersion ) ); 1492 else statusbar( "Saving FAILED for some reason. Current version " ~ Integer.toUtf8( currentVersion ) ); 1473 1493 } 1474 1494 … … 1476 1496 { 1477 1497 //showFileChooser(); 1478 save();1498 //save(); 1479 1499 //onMenuActivate(menuItem); 1500 1501 if( save() == true ) 1502 statusbar( "Saving complete. Saved version " ~ Integer.toUtf8( currentVersion ) ); 1503 else statusbar( "Saving FAILED for some reason. Current version " ~ Integer.toUtf8( currentVersion ) ); 1480 1504 } 1481 1505
