Changeset 278
- Timestamp:
- 07/17/10 22:35:53 (2 years ago)
- Files:
-
- trunk/current/poseidon/CodeAnalyzer/syntax/attributes.d (modified) (1 diff)
- trunk/current/poseidon/CodeAnalyzer/syntax/nodeHsu.d (modified) (1 diff)
- trunk/current/poseidon/CodeAnalyzer/syntax/statements.d (modified) (1 diff)
- trunk/current/poseidon/images/linux.gif (added)
- trunk/current/poseidon/images/mac.gif (added)
- trunk/current/poseidon/images/windows.gif (added)
- trunk/current/poseidon/nls/english.ini (modified) (2 diffs)
- trunk/current/poseidon/poseidon.exe (modified) (previous)
- trunk/current/poseidon/poseidon/controller/actionmanager.d (modified) (2 diffs)
- trunk/current/poseidon/poseidon/controller/dialog/aboutbox.d (modified) (1 diff)
- trunk/current/poseidon/poseidon/controller/editor.d (modified) (2 diffs)
- trunk/current/poseidon/poseidon/controller/menumanager.d (modified) (4 diffs)
- trunk/current/poseidon/poseidon/controller/outline.d (modified) (5 diffs)
- trunk/current/poseidon/poseidon/controller/toolbarmanager.d (modified) (1 diff)
- trunk/current/poseidon/poseidon/globals.d (modified) (1 diff)
- trunk/current/poseidon/poseidon/style/dstyle.d (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/current/poseidon/CodeAnalyzer/syntax/attributes.d
r272 r278 181 181 case TOK.Tauto: 182 182 globalProt = globalProt & ( D_Attribute - D_Storage ) | D_Auto; 183 return true; 184 185 case TOK.Textern: 186 globalProt = globalProt & ( D_Attribute - D_Storage ) | D_Extern; 183 187 return true; 184 188 trunk/current/poseidon/CodeAnalyzer/syntax/nodeHsu.d
r275 r278 320 320 321 321 void passChildren( CAnalyzerTreeNode[] leafs ){ children = leafs; } 322 323 void increaseLineNumber( int startNum, int adds ) 324 { 325 void _processChildren( CAnalyzerTreeNode node ) 326 { 327 foreach( CAnalyzerTreeNode t; node.children ) 328 { 329 if( t.lineNumber >= startNum ) t.lineNumber += adds; 330 if( t.getLeafCount > 0 ) _processChildren( t ); 331 } 332 } 333 334 if( this.lineNumber >= startNum ) this.lineNumber += adds; 335 _processChildren( this ); 336 } 322 337 323 338 /* trunk/current/poseidon/CodeAnalyzer/syntax/statements.d
r272 r278 1264 1264 handle[TOK.Tinvariant] = &handleStorageClass; 1265 1265 handle[TOK.Timmutable] = &handleStorageClass; 1266 1267 assign!(AttributeDeclaration).toParse(TOK.Textern); 1268 //handle[TOK.Textern] = &handleStorageClass; // D 2.0 1266 1269 } 1267 1270 trunk/current/poseidon/nls/english.ini
r276 r278 76 76 view.class = &Class Browser 77 77 view.debug = &Debug 78 view.eol = &End Of Line Symbol 79 view.space = &Space And Tab Symbol 78 80 79 81 ; project menu … … 103 105 tools.language = Language 104 106 tools.encode = &Encode 107 tools.seteol = &Set EOL Character 108 tools.eol = &Convert EOL Character 105 109 tools.associate = File &Associate 106 110 tools.options = &Options... trunk/current/poseidon/poseidon/controller/actionmanager.d
r275 r278 1254 1254 } 1255 1255 1256 public void actionEOL(Event e)1257 {1258 MenuItem mi = cast(MenuItem)e.widget;1259 EditItem ei = sGUI.editor.getSelectedEditItemHSU();1260 1261 if( ei !is null )1262 {1263 char[] text = mi.getText();1264 int mode = ei.scintilla.getEOLMode();1265 1266 switch( text )1267 {1268 case "Windows":1269 if( mode == 0 )1270 return;1271 else1272 {1273 ei.scintilla.convertEOLs( 0 );1274 }1275 break;1276 1277 case "Unix":1278 if( mode == 2 )1279 return;1280 else1281 ei.scintilla.convertEOLs( 2 );1282 1283 case "Macintosh":1284 if( mode == 1 )1285 return;1286 else1287 {1288 ei.scintilla.convertEOLs( 1 );1289 }1290 1291 default:1292 }1293 }1294 }1295 1296 1256 public void actionPreference(Event e) 1297 1257 { … … 1299 1259 prf.open(); 1300 1260 } 1261 1301 1262 public void actionAboutBox(Event e) 1302 1263 { trunk/current/poseidon/poseidon/controller/dialog/aboutbox.d
r277 r278 38 38 with(label = new CLabel(top, DWT.CENTER)){ 39 39 //setText("Poseidon Editor for D v " ~ Globals.getVersionS()); 40 setText("Poseidon Editor for D rev.27 7" );40 setText("Poseidon Editor for D rev.278" ); 41 41 setForeground(color); 42 42 } trunk/current/poseidon/poseidon/controller/editor.d
r276 r278 725 725 e.doit = false; 726 726 727 if( sGUI.editor.items.length == 0 )sAutoComplete.setFileParser( null );727 if( !sGUI.editor.items.length ) sAutoComplete.setFileParser( null ); 728 728 729 729 /* … … 739 739 EditItem ei = cast(EditItem) e.item; 740 740 ei.reportErrors(); 741 742 if( sGUI.menuMan.showEOLItem.getSelection() && !ei.scintilla.getViewEOL() ) 743 ei.scintilla.setViewEOL( true ); 744 else if( !sGUI.menuMan.showEOLItem.getSelection() && ei.scintilla.getViewEOL() ) 745 ei.scintilla.setViewEOL( false ); 746 747 if( sGUI.menuMan.showSpaceItem.getSelection() && !ei.scintilla.getViewWS() ) 748 ei.scintilla.setViewWS( 1 ); 749 else if( !sGUI.menuMan.showSpaceItem.getSelection() && ei.scintilla.getViewWS() ) 750 ei.scintilla.setViewWS( 0 ); 751 752 if( sGUI.menuMan.setEOLMenuItem[0].getSelection ) 753 ei.scintilla.setEOLMode( 0 ); 754 else if( sGUI.menuMan.setEOLMenuItem[1].getSelection ) 755 ei.scintilla.setEOLMode( 1 ); 756 else if( sGUI.menuMan.setEOLMenuItem[2].getSelection ) 757 ei.scintilla.setEOLMode( 2 ); 758 741 759 /* 742 760 sAutoComplete.setFileParser( sAutoComplete.getParserFromProjectParser( ei.getFileName() ) ); trunk/current/poseidon/poseidon/controller/menumanager.d
r276 r278 26 26 undoItem, redoItem, cutItem, copyItem, pasteItem, selectallItem, 27 27 togglecommentItem, streamcommentItem, boxcommentItem, nestcommentItem, 28 findItem, findListItem, gotoItem, viewDebugItem, classBrowserItem, 28 findItem, findListItem, gotoItem, viewDebugItem, classBrowserItem, showEOLItem, showSpaceItem, 29 29 compileItem, runItem, buildItem, build_runItem, rebuildItem, BudItem, cleanItem, 30 30 debugItem, debugbuildItem, debuginItem, debugrunItem, debugoverItem, debugreturnItem, debugstopItem, debugcleanbpsItem, 31 encodeItem, registerItem, documentItem; 31 encodeItem, setEOLItem, EOLItem, registerItem, documentItem; 32 33 public MenuItem[3] setEOLMenuItem; 32 34 33 35 // static properties … … 337 339 }); 338 340 } 341 342 with( showEOLItem = new MenuItem( menu, DWT.CHECK ) ) 343 { 344 setImage( Globals.getImage( "topic" ) ); 345 setData( LANG_ID, "view.eol" ); 346 setSelection( false ); 347 handleEvent( this, DWT.Selection, delegate( Event e ){ 348 MenuItem mi = cast(MenuItem)e.widget; 349 EditItem ei = sGUI.editor.getSelectedEditItemHSU(); 350 if( ei !is null ) 351 { 352 if( !ei.scintilla.getViewEOL() && mi.getSelection() ) 353 ei.scintilla.setViewEOL( true ); 354 else if( ei.scintilla.getViewEOL() && !mi.getSelection() ) 355 ei.scintilla.setViewEOL( false ); 356 } 357 }); 358 } 359 360 with( showSpaceItem = new MenuItem( menu, DWT.CHECK ) ) 361 { 362 setImage( Globals.getImage( "topic" ) ); 363 setData( LANG_ID, "view.space" ); 364 setSelection( false ); 365 handleEvent( this, DWT.Selection, delegate( Event e ){ 366 MenuItem mi = cast(MenuItem)e.widget; 367 EditItem ei = sGUI.editor.getSelectedEditItemHSU(); 368 369 if( ei !is null ) 370 { 371 if( !ei.scintilla.getViewWS() && mi.getSelection() ) 372 ei.scintilla.setViewWS( 1 ); 373 else if( ei.scintilla.getViewWS() && !mi.getSelection() ) 374 ei.scintilla.setViewWS( 0 ); 375 } 376 }); 377 } 339 378 340 379 /+ … … 605 644 } 606 645 encodeItem.setMenu(EncodeMenu(encodeItem)); 646 647 new MenuItem(menu, DWT.SEPARATOR); 648 649 with( setEOLItem = new MenuItem(menu, DWT.CASCADE)){ 650 // always set the "language" string to in English 651 setData(LANG_ID,"tools.seteol"); 652 handleEvent(this, DWT.Selection, delegate(Event e){ 653 }); 654 } 655 setEOLItem.setMenu(setEOLMenu(setEOLItem)); 656 657 with( EOLItem = new MenuItem(menu, DWT.CASCADE)){ 658 // always set the "language" string to in English 659 setData(LANG_ID,"tools.eol"); 660 setEnabled( false ); 661 handleEvent(this, DWT.Selection, delegate(Event e){ 662 }); 663 } 664 EOLItem.setMenu(EOLMenu(EOLItem)); 607 665 608 666 new MenuItem(menu, DWT.SEPARATOR); … … 689 747 return menu; 690 748 } 749 750 protected Menu setEOLMenu(MenuItem item) 751 { 752 char[][] keys = ["CRLF", "CR", "LF"]; 753 char[][] icon = [ "windows", "mac", "linux" ]; 754 Menu menu = new Menu(item); 755 756 for(int i = 0; i < 3; ++ i ) 757 { 758 setEOLMenuItem[i] = new MenuItem(menu, DWT.RADIO); 759 setEOLMenuItem[i].setText(keys[i]); 760 setEOLMenuItem[i].setImage( Globals.getImage( icon[i] ) ); 761 setEOLMenuItem[i].handleEvent(null, DWT.Selection, delegate(Event e) 762 { 763 MenuItem mi = cast(MenuItem)e.widget; 764 EditItem[] eis = cast(EditItem[]) sGUI.editor.getItems; 765 foreach( EditItem ei; eis ) 766 { 767 switch( mi.getText() ) 768 { 769 case "CRLF": 770 ei.scintilla.setEOLMode( 0 ); 771 break; 772 case "LF": 773 ei.scintilla.setEOLMode( 2 ); 774 break; 775 case "CR": 776 ei.scintilla.setEOLMode( 1 ); 777 break; 778 } 779 } 780 }); 781 } 782 783 setEOLMenuItem[0].setSelection( true ); 784 785 return menu; 786 } 787 788 protected Menu EOLMenu(MenuItem item) 789 { 790 char[][] keys = ["CRLF / WINDOWS", "CR / MAC", "LF / UNIX"]; 791 char[][] icon = [ "windows", "mac", "linux" ]; 792 Menu menu = new Menu(item); 793 int i = 0; 794 foreach(char[] name; keys) 795 { 796 MenuItem mi = new MenuItem(menu, DWT.PUSH); 797 mi.setText(name); 798 mi.setImage( Globals.getImage( icon[i++] ) ); 799 mi.handleEvent(null, DWT.Selection, delegate(Event e) 800 { 801 MenuItem mi = cast(MenuItem)e.widget; 802 EditItem ei = sGUI.editor.getSelectedEditItemHSU(); 803 804 if( ei !is null ) 805 { 806 char[] text = mi.getText(); 807 808 switch( text ) 809 { 810 case "CRLF / WINDOWS": 811 ei.scintilla.convertEOLs( 0 ); 812 break; 813 814 case "LF / UNIX": 815 ei.scintilla.convertEOLs( 2 ); 816 break; 817 818 case "CR / MAC": 819 ei.scintilla.convertEOLs( 1 ); 820 821 default: 822 } 823 } 824 }); 825 } 826 return menu; 827 } 691 828 692 829 protected Menu RegisterMenu(MenuItem item) trunk/current/poseidon/poseidon/controller/outline.d
r276 r278 166 166 tItem.setData( t ); 167 167 treeItems ~= tItem; 168 /*169 scope font = new Font( tree.getDisplay(), Editor.settings._setting.outputStyle.font, Editor.settings._setting.outputStyle.size, DWT.NORMAL );170 tItem.setFont( font );171 */172 168 }else 173 169 { … … 175 171 tItem.setData( t ); 176 172 treeItems ~= tItem; 177 /*178 scope font = new Font( tree.getDisplay(), Editor.settings._setting.outputStyle.font, Editor.settings._setting.outputStyle.size, DWT.NORMAL );179 tItem.setFont( font );180 */181 173 } 182 174 … … 263 255 } 264 256 } 265 266 267 268 257 269 258 /*** … … 985 974 } 986 975 987 /*988 private void resetImageCombo()989 {990 if( sAutoComplete.fileParser is null )991 {992 removeAllImageComboItems();993 quickFind.select( -1 );994 quickFind.setEnabled( false );995 }996 else997 {998 removeAllImageComboItems();999 quickFind.setEnabled( true );1000 onCheckImageComboModify();1001 }1002 }1003 */1004 1005 976 private void resetImageCombo( EditItem ei ) 1006 977 { … … 1103 1074 return true; 1104 1075 1105 1106 1076 return bFound; 1107 /+1108 sGUI.outputPanel.appendLine( "Items = " ~ std.string.toString( treeItems.length ) ~ " " ~1109 "searchIndex = " ~ std.string.toString( searchIndex ) );+/1110 1111 1077 } 1112 1078 } trunk/current/poseidon/poseidon/controller/toolbarmanager.d
r221 r278 460 460 461 461 sGUI.menuMan.encodeItem.setEnabled( haveDoc ); 462 sGUI.menuMan.EOLItem.setEnabled( haveDoc ); 462 463 } 463 464 } trunk/current/poseidon/poseidon/globals.d
r276 r278 242 242 images["searchfunction"] = DWTResourceManager.getImage("searchfuncion.gif"); 243 243 images["compiletarget"] = DWTResourceManager.getImage("target.gif"); 244 245 images["windows"] = DWTResourceManager.getImage("windows.gif"); 246 images["mac"] = DWTResourceManager.getImage("mac.gif"); 247 images["linux"] = DWTResourceManager.getImage("linux.gif"); 248 images["topic"] = DWTResourceManager.getImage("topic.gif"); 244 249 245 250 // DEBUG trunk/current/poseidon/poseidon/style/dstyle.d
r277 r278 2120 2120 try 2121 2121 { 2122 //sGUI.outputPanel.appendLine( "Globals.updateParseLiveFull" ); 2122 int currentPos = sc.getCurrentPos(); 2123 char ch = sc.getCharAt( currentPos ); 2124 int textLength = sc.getTextLength(); 2125 bool bGo; 2126 char[] text; 2127 2128 if( currentPos > 0 ) // 如果前一字是; 馬上分析 2129 { 2130 if( sc.getCharAt( currentPos -1 ) == ';' ) bGo = true; 2131 } 2123 2132 2124 //CAnalyzerTreeNode headNode = searchFunctionHead( sc ); 2133 if( !bGo ) // 移動到非空白字元結尾 2134 { 2135 while( cast(int) ch > 32 ) 2136 { 2137 currentPos ++; 2138 if( currentPos >= textLength ) 2139 { 2140 bGo = true; 2141 break; 2142 } 2143 ch = sc.getCharAt( currentPos ); 2144 } 2145 } 2146 2147 if( !bGo ) // 如果前一字是; 馬上分析 2148 { 2149 if( sc.getCharAt( currentPos -1 ) == ';' ) bGo = true; 2150 } 2151 2152 if( !bGo ) // 如果分行後一字是{ 馬上分析 2153 { 2154 text ~= ch; 2155 2156 while( cast(int) ch < 33 ) 2157 { 2158 currentPos ++; 2159 if( currentPos >= textLength ) 2160 { 2161 bGo = true; 2162 break; 2163 } 2164 ch = sc.getCharAt( currentPos ); 2165 if( ch == '{' ) bGo = true; 2166 text ~= ch; 2167 } 2168 } 2169 2170 2171 if( !bGo ) 2172 { 2173 if( std.string.find( text, "\n" ) < 0 ) bGo = true; 2174 } 2175 2176 if( !bGo ) return; 2177 2125 2178 char[] codeSource; 2126 2179 CAnalyzerTreeNode headNode = searchFunctionHeadAndText( sc, codeSource ); … … 2155 2208 if( tempBlockParser is null ) return; 2156 2209 2157 //sGUI.outputPanel.appendLine( codeSource );2158 2159 2210 //remove D_MAINROOT 2160 2211 if( tempBlockParser.getLeafCount == 1 ) … … 2162 2213 else 2163 2214 return; 2164 } 2165 2166 //sGUI.outputPanel.appendLine( "function is:" ~ blockParser.identifier ); 2167 2168 /* 2169 if( blockParser !is null ) 2170 sGUI.outputPanel.appendLine( "GET!!!!" ); 2171 else 2172 { 2173 sGUI.outputPanel.appendLine( "NOT GET!!!!" ); 2174 return; 2175 } 2176 */ 2215 2216 //sGUI.outputPanel.appendLine( dTypeToChars( blockParser.DType ) ~ " " ~ blockParser.identifier ~ "(" ~ toString( blockParser.lineNumber ) ~ ")" ); 2217 2218 blockParser.increaseLineNumber( 1, headNode.lineNumber - 1 ); 2219 2220 //sGUI.outputPanel.appendLine( dTypeToChars( blockParser.DType ) ~ " " ~ blockParser.identifier ~ "(" ~ toString( blockParser.lineNumber ) ~ ")" ); 2221 } 2177 2222 2178 2223 CAnalyzerTreeNode fatherNode = headNode.getRoot; … … 2190 2235 } 2191 2236 2192 if( index > -1 ) fatherNode.replaceLeaf( blockParser, index ); //else sGUI.outputPanel.appendLine( "WRONG!" ); 2193 /+ 2194 CAnalyzerTreeNode[] nodes = sAutoComplete.lookAnalyzerTree( headNode.identifier, D_UDTS | D_FUNCTION, sAutoComplete.fileParser ); 2195 if( nodes.length ) 2196 { 2197 //sGUI.outputPanel.appendLine( "GET HEAD!" ); 2198 CAnalyzerTreeNode fatherNode = nodes[0].getRoot; 2199 /* 2200 foreach( CAnalyzerTreeNode t; fatherNode.getAllLeaf ) 2201 sGUI.outputPanel.appendLine( t.identifier ); 2202 */ 2203 2204 CAnalyzerTreeNode[] tempChildren; 2205 2206 int index = -1; 2207 2208 for( int i = 0; i < fatherNode.getLeafCount; ++ i ) 2209 { 2210 if( fatherNode.getLeaf( i ) == nodes[0] ) 2211 { 2212 index = i; 2213 break; 2214 } 2215 } 2216 2217 if( index > -1 ) fatherNode.replaceLeaf( blockParser, index );else sGUI.outputPanel.appendLine( "WRONG!" ); 2218 } 2219 +/ 2237 if( index > -1 ) 2238 { 2239 fatherNode.replaceLeaf( blockParser, index ); //else sGUI.outputPanel.appendLine( "WRONG!" ); 2240 //sGUI.outline.singleFileToProjectFile( sGUI.editor.getSelectedEditItemHSU() ); 2241 } 2220 2242 } 2221 2243 catch 2222 2244 { 2245 2223 2246 } 2224 2247 … … 2913 2936 case 1: 2914 2937 char[] finalWord = splitSemiWord[length - 1]; 2938 //sGUI.outputPanel.appendLine( "finalWord: " ~ finalWord ); 2915 2939 if( finalWord != "if" && finalWord != "while" && finalWord != "for" && finalWord != "foreach" 2916 2940 && finalWord != "else" && finalWord != "version" && finalWord != "debug" 2917 2941 && finalWord != "catch" && finalWord != "switch" && finalWord != "with" 2918 && finalWord != "synchronized" )2942 && finalWord != "synchronized" && finalWord != "delegate" ) 2919 2943 { 2920 2944 // 過載運算子及建構子 … … 3392 3416 case 1: 3393 3417 char[] finalWord = splitSemiWord[length - 1]; 3418 //sGUI.outputPanel.appendLine( "@finalWord: " ~ finalWord ); 3394 3419 if( finalWord != "if" && finalWord != "while" && finalWord != "for" && finalWord != "foreach" 3395 3420 && finalWord != "else" && finalWord != "version" && finalWord != "debug"
