Changeset 254
- Timestamp:
- 06/07/07 02:16:42 (1 year ago)
- Files:
-
- trunk/src/leds/CodeView.d (modified) (46 diffs)
- trunk/src/leds/SourceViewEdit.d (modified) (16 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/src/leds/CodeView.d
r253 r254 161 161 String[int] errors; 162 162 163 b itautoIndent = true;164 b itautoDocComments = true;165 166 b itunitCompile = true;163 bool autoIndent = true; 164 bool autoDocComments = true; 165 166 bool unitCompile = true; 167 167 168 168 Menu popupMenu; 169 169 170 170 long modifiedTime; 171 b itneedsSave = false;171 bool needsSave = false; 172 172 173 173 int[] errorLines; … … 178 178 179 179 180 b ituserAllowClose = false;180 bool userAllowClose = false; 181 181 182 182 String braceCharacters; … … 349 349 } 350 350 351 b itasking = false;351 bool asking = false; 352 352 353 353 /** … … 357 357 * @return 358 358 */ 359 b itexposeCallback(GdkEventExpose* event, Widget widget)359 bool exposeCallback(GdkEventExpose* event, Widget widget) 360 360 { 361 361 //setBrowserView(); … … 390 390 bugLines.length = 0; 391 391 int lineCount = 0; 392 b itnewLine = true;392 bool newLine = true; 393 393 int todoMatch = 0; 394 394 int bugMatch = 0; 395 395 /** if the previous char is a separator */ 396 b itprevSep = true;396 bool prevSep = true; 397 397 // in one pass count lines and find 'todo' and 'bug' 398 398 foreach(char c ; text.toString()) … … 518 518 * determins if a close button shoud be visible 519 519 */ 520 b itallowCloseButton()520 bool allowCloseButton() 521 521 { 522 522 return true; 523 523 } 524 524 525 public void reloadFile(b itaskPermission)526 { 527 b itreload = true;525 public void reloadFile(bool askPermission) 526 { 527 bool reload = true; 528 528 if ( askPermission ) 529 529 { … … 553 553 * @return true if sucesseful 554 554 */ 555 b itloadFile(String fileName)555 bool loadFile(String fileName) 556 556 in 557 557 { … … 563 563 this.fileName = fileName.dup; 564 564 String input; 565 b itfileOK = true;565 bool fileOK = true; 566 566 try 567 567 { … … 597 597 } 598 598 599 b itneedReloadFile(String fileName)600 { 601 b itneedReload = false;599 bool needReloadFile(String fileName) 600 { 601 bool needReload = false; 602 602 if ( modifiedTime != getFileMTime(fileName) ) 603 603 { … … 615 615 * and if not ask the user to confirm overwrite. 616 616 * @param fileName 617 * @return b itif the time is the same or the user authorized modification618 */ 619 b itconfirmModifyFile(String fileName)620 { 621 b itokToModify = true;617 * @return bool if the time is the same or the user authorized modification 618 */ 619 bool confirmModifyFile(String fileName) 620 { 621 bool okToModify = true; 622 622 if ( modifiedTime != getFileMTime(fileName) ) 623 623 { … … 635 635 * @return true if the user confirmed that a new file is to be created 636 636 */ 637 b itnewFile(String fileName)637 bool newFile(String fileName) 638 638 { 639 639 return true; … … 709 709 * @return unitCompile value 710 710 */ 711 b itgetUnitCompile()711 bool getUnitCompile() 712 712 { 713 713 return unitCompile; … … 753 753 * @return true if the text was modified 754 754 */ 755 b itgetModified()755 bool getModified() 756 756 { 757 757 return codeEdit.getModified(); … … 762 762 * @return true if this instance should be loaded with a new file 763 763 */ 764 b itgetEmpty()764 bool getEmpty() 765 765 { 766 766 return !getModified() && (fileName is null); … … 771 771 * @return true if the buffer can be closed 772 772 */ 773 b it allowClose(bitaskUser)773 bool allowClose(bool askUser) 774 774 { 775 775 writefln("CodeView.allowClose 1"); 776 b itallow = true;776 bool allow = true; 777 777 if ( !userAllowClose && getModified() ) 778 778 { … … 802 802 * @return true if sucesseful 803 803 */ 804 b itsaveFile()804 bool saveFile() 805 805 { 806 806 if ( !confirmModifyFile(fileName) ) … … 1171 1171 * @return true if sucesseful 1172 1172 */ 1173 b itsaveFile(String fileName)1173 bool saveFile(String fileName) 1174 1174 in 1175 1175 { … … 1200 1200 * @return true if the action was processed (even if the execution failled) 1201 1201 */ 1202 public b itexecAction(String action)1203 { 1204 b itprocessed = true;1202 public bool execAction(String action) 1203 { 1204 bool processed = true; 1205 1205 switch(action.toString()) 1206 1206 { … … 1261 1261 } 1262 1262 1263 void fastFindText(b itbackwards)1263 void fastFindText(bool backwards) 1264 1264 { 1265 1265 String selected = getSelected(); … … 1276 1276 } 1277 1277 1278 void findText(b itbackwards)1278 void findText(bool backwards) 1279 1279 { 1280 1280 findText(workspace.getFindText(),backwards); … … 1301 1301 * find for a temporary text string 1302 1302 */ 1303 void findText(char[] findStr, b itbackwards)1303 void findText(char[] findStr, bool backwards) 1304 1304 { 1305 1305 findText(new String(findStr), backwards); 1306 1306 } 1307 void findText(String findStr, b itbackwards)1307 void findText(String findStr, bool backwards) 1308 1308 { 1309 1309 if ( findStr is null || findStr.length == 0 ) … … 1387 1387 * // FIXME - should be in LanguageD.. 1388 1388 */ 1389 b itgotoElement(String elementName, int lineNumber)1389 bool gotoElement(String elementName, int lineNumber) 1390 1390 in 1391 1391 { … … 1437 1437 } 1438 1438 1439 public int getPosition(char[] str, b it all, bitbackwards)1439 public int getPosition(char[] str, bool all, bool backwards) 1440 1440 { 1441 1441 return getPosition(new String(str), all, backwards); 1442 1442 } 1443 public int getPosition(String str, b it all, bitbackwards)1443 public int getPosition(String str, bool all, bool backwards) 1444 1444 { 1445 1445 int pos = codeEdit.getCurrentPos(); … … 1492 1492 * @return 1493 1493 */ 1494 public b itgetPair(char[] brace, int position, inout int start, inout int end)1494 public bool getPair(char[] brace, int position, inout int start, inout int end) 1495 1495 { 1496 1496 return getPair(new String(brace), position, start, end); 1497 1497 } 1498 public b itgetPair(String brace, int position, inout int start, inout int end)1498 public bool getPair(String brace, int position, inout int start, inout int end) 1499 1499 { 1500 1500 int pos = codeEdit.getCurrentPos(); … … 1555 1555 int cl= codeEdit.getCurrLine(); 1556 1556 int pos = codeEdit.getCurrentPos(); 1557 this.exposeLine(cl, true);1558 codeEdit.gotoPos(pos);1557 //this.exposeLine(cl, false); 1558 //codeEdit.gotoPos(pos); 1559 1559 } 1560 1560 } … … 1946 1946 String replace; 1947 1947 String[] tokens = sel.split(); 1948 b itnewLine = true;1948 bool newLine = true; 1949 1949 foreach ( String token ; tokens ) 1950 1950 { … … 2171 2171 2172 2172 /** 2173 * If found pastes the user short cut into the buffer2174 * @return true if the shortcu ris defined and the buffer was changed2175 */ 2176 b ituserShortCuts()2177 { 2178 b itprocessed = false;2173 * If found pastes the user shortcut into the buffer 2174 * @return true if the shortcut is defined and the buffer was changed 2175 */ 2176 bool userShortCuts() 2177 { 2178 bool processed = false; 2179 2179 int pos = codeEdit.getCurrentPos(); 2180 2180 String stringPrint = new String(); … … 2250 2250 } 2251 2251 2252 b itoperatorOverload()2252 bool operatorOverload() 2253 2253 { 2254 2254 String[] list; … … 2365 2365 if ( pre[i+1..i+7] == "cursor" ) 2366 2366 { 2367 cursorPos = pos.length ;2367 cursorPos = pos.length-1; 2368 2368 i += 6; 2369 2369 } … … 2527 2527 * @return true if the position is inside a doc comment 2528 2528 */ 2529 b itisDocComment(int position, out int startComment, out int endComment)2530 { 2531 // b itdocComment = false;2529 bool isDocComment(int position, out int startComment, out int endComment) 2530 { 2531 // bool docComment = false; 2532 2532 // startComment = codeEdit.find("/**", 0, true); 2533 2533 // if ( startComment >= 0 ) … … 2559 2559 startComment = position; 2560 2560 2561 b itfound = false;2562 b itstart = false;2563 b itend = false;2561 bool found = false; 2562 bool start = false; 2563 bool end = false; 2564 2564 2565 2565 char c = '*'; … … 2644 2644 2645 2645 2646 b itisDocComment(int position)2646 bool isDocComment(int position) 2647 2647 { 2648 2648 int start; … … 2651 2651 } 2652 2652 2653 b itformatComment(int start, int end, int maxLine)2654 { 2655 b itformatted = false;2653 bool formatComment(int start, int end, int maxLine) 2654 { 2655 bool formatted = false; 2656 2656 int lineStart = codeEdit.positionFromLine(codeEdit.lineFromPosition(start)); 2657 2657 codeEdit.setCurrentPos(lineStart); … … 2679 2679 * \todo the text is processed correctly but never reaches codeEdit. 2680 2680 */ 2681 public b ittextInserted(int position, int length, int linesAdded)2682 { 2683 b itprocessed = false;2681 public bool textInserted(int position, int length, int linesAdded) 2682 { 2683 bool processed = false; 2684 2684 // if ( position > 0 ) 2685 2685 // { … … 2709 2709 } 2710 2710 2711 b itinChange = false;2711 bool inChange = false; 2712 2712 2713 2713 void setupNotifications() … … 2722 2722 } 2723 2723 2724 b iteditAutoCSelection(int pos , String s)2724 bool editAutoCSelection(int pos , String s) 2725 2725 { 2726 2726 … … 2735 2735 } 2736 2736 2737 b itneedSemiColon;2738 2739 b iteditModified(int type, String text)2737 bool needSemiColon; 2738 2739 bool editModified(int type, String text) 2740 2740 { 2741 2741 switch ( type ) … … 2806 2806 * @return 2807 2807 */ 2808 b iteditCharAdded(int ch)2808 bool editCharAdded(int ch) 2809 2809 { 2810 2810 //printf("CodeView.codeEditCallback SCN_CHARADDED\n" ); … … 2843 2843 2844 2844 case ';': 2845 writefln("editCharAdded 1"); 2845 2846 if ( Leds.leds.getPropValue("smartSemiColon",true) ) 2846 2847 { 2848 writefln("editCharAdded 2"); 2847 2849 if ( smartSemiColonLine != codeEdit.getCurrLine() ) 2848 2850 { 2851 writefln("editCharAdded 3"); 2849 2852 smartSemiColonLine = codeEdit.getCurrLine(); 2850 2853 … … 2852 2855 if ( ! line.endsWith(";") ) 2853 2856 { 2857 writefln("editCharAdded 4"); 2854 2858 codeEdit.deleteBack(); 2855 2859 codeEdit.lineEnd(); … … 2884 2888 * @return 2885 2889 */ 2886 b iteditKey(int ch, int modifiers)2890 bool editKey(int ch, int modifiers) 2887 2891 { 2888 2892 //printf("CodeView.editKey SCN_KEY %d -- %X\n", ch,ch ); … … 2907 2911 * @return 2908 2912 */ 2909 b iteditMarginClick(int margin, int position)2913 bool editMarginClick(int margin, int position) 2910 2914 { 2911 2915 switch ( margin ) … … 2938 2942 int lineNumber = codeEdit.lineFromPosition(position); 2939 2943 2940 b itfound = false;2944 bool found = false; 2941 2945 int i = 0; 2942 2946 int[] keys = errors.keys; … … 2982 2986 * @return 2983 2987 */ 2984 b iteditModified()2988 bool editModified() 2985 2989 { 2986 2990 //printf("CodeView.codeEditCallback SCN_MODIFIED\n" ); … … 2999 3003 * @return 3000 3004 */ 3001 b iteditUserListSelection(int ch, int code)3005 bool editUserListSelection(int ch, int code) 3002 3006 { 3003 3007 printf("seems this never gets called============================================\n"); … … 3023 3027 * @return 3024 3028 */ 3025 b itprocessControlKey(char key)3029 bool processControlKey(char key) 3026 3030 { 3027 3031 debug(notify)printf("CodeView.processControlKey key = >>>%c<<<\n", key); 3028 b itprocessed = true;3032 bool processed = true; 3029 3033 switch ( Leds.leds.getCommandFromKey(key) ) 3030 3034 { 3031 3035 case CodeCommand.SAVE: workspace.saveCurrent(); break; 3032 3036 case CodeCommand.SAVE_AND_MAKE: 3033 b itoldUnitCompile = unitCompile;3037 bool oldUnitCompile = unitCompile; 3034 3038 unitCompile = false; 3035 3039 workspace.saveCurrent(); trunk/src/leds/SourceViewEdit.d
r253 r254 19 19 module leds.SourceViewEdit; 20 20 21 debug = flow; 22 21 23 //version(linux) 22 //{ 24 //{; 23 25 24 26 private import leds.CodeEdit; … … 174 176 * @return 175 177 */ 176 void addOnUpdateUI(b itdelegate() dlg)178 void addOnUpdateUI(bool delegate() dlg) 177 179 { 178 180 debug(flow)writefln("SourceViewEdit.addOnUpdateUI 1"); … … 201 203 { 202 204 debug(flow)writefln("SourceViewEdit.callUIListener"); 203 foreach(b itdelegate() dlg; updateUIListeners)205 foreach(bool delegate() dlg; updateUIListeners) 204 206 { 205 207 dlg(); 206 208 } 209 207 210 } 208 211 … … 212 215 * @return 213 216 */ 214 void addOnCharAdded(b itdelegate(int ch) dlg)215 { 216 //writefln("SourceViewEdit.addOnCharAdded 1");217 void addOnCharAdded(bool delegate(int ch) dlg) 218 { 219 debug(flow)writefln("SourceViewEdit.addOnCharAdded 1"); 217 220 if ( ! charAddedSignals ) 218 221 { … … 227 230 { 228 231 debug(flow)writefln("SourceViewEdit.keyPressed "); 229 b itprocessed = false;232 bool processed = false; 230 233 debug(flow)writefln("SourceViewEdit.keyPressed state = %s", event.state); 231 234 switch ( event.state ) 232 235 { 233 236 case 0: 234 foreach(b itdelegate(int ch) dlg ; charAddedListeners)237 foreach(bool delegate(int ch) dlg ; charAddedListeners) 235 238 { 236 239 dlg(event.keyval); … … 239 242 240 243 case 20,21,4, 5: 241 foreach(b itdelegate(int ch, int modifiers) dlg ; keyListeners)244 foreach(bool delegate(int ch, int modifiers) dlg ; keyListeners) 242 245 { 243 246 dlg(event.keyval, event.state); … … 259 262 * @return 260 263 */ 261 void addOnKey(b itdelegate(int ch, int modifiers) dlg)264 void addOnKey(bool delegate(int ch, int modifiers) dlg) 262 265 { 263 266 if ( ! keySignals ) … … 275 278 * @return 276 279 */ 277 void addOnMarginClick(b itdelegate(int margin, int position) dlg)280 void addOnMarginClick(bool delegate(int margin, int position) dlg) 278 281 { 279 282 if ( ! marginClickSignals ) … … 289 292 * @return 290 293 */ 291 void addOnModified(b itdelegate(int, String) dlg)294 void addOnModified(bool delegate(int, String) dlg) 292 295 { 293 296 if ( ! modifiedSignals ) … … 304 307 * @return 305 308 */ 306 void addOnUserListSelection(b itdelegate (int ch, int code) dlg)309 void addOnUserListSelection(bool delegate (int ch, int code) dlg) 307 310 { 308 311 if ( ! userListSelectionSignals ) … … 315 318 * see scintilla 316 319 */ 317 void addOnAutoCSelection(b itdelegate (int, String) dlg)320 void addOnAutoCSelection(bool delegate (int, String) dlg) 318 321 { 319 322 … … 423 426 * @return the position offset or -1 if not found 424 427 */ 425 int find(String findStr, int flags, b itbackwards=false)426 { 427 b itfound = false;428 int find(String findStr, int flags, bool backwards=false) 429 { 430 bool found = false; 428 431 insertIter(); 429 432 TextIter iterStart = new TextIter(); … … 452 455 if ( found ) 453 456 { 457 view.scrollToIter(iterStart, 0.0, false, 0.0, 0.25); 458 //buffer.placeCursor(iterStart); 459 454 460 TextMark mark = buffer.getInsert(); 455 461 TextMark markSel = buffer.getMark("selection_bound"); 462 463 writefln("find positions %s %s", iterStart.getOffset(), iterEnd.getOffset()); 464 456 465 buffer.moveMark(mark, iterStart); 457 466 buffer.moveMark(markSel, iterEnd); … … 462 471 } 463 472 464 view.scrollToIter(iterStart, 0.0, false, 0.0, 0.0);465 466 473 return iterStart.getOffset(); 467 474 } … … 470 477 * gets the previous occurrence of a String 471 478 */ 472 int lookup(String findStr, b itbackwards, int position=-1)473 { 474 b itfound = false;479 int lookup(String findStr, bool backwards, int position=-1) 480 { 481 bool found = false; 475 482 TextIter iterFrom = new TextIter(); 476 483 if ( position == -1 ) … … 1006 1013 * finds text from the current position 1007 1014 */ 1008 int find(char[] findStr, int flags, b itbackwards)1015 int find(char[] findStr, int flags, bool backwards) 1009 1016 { 1010 1017 return find(new String(findStr), flags, backwards);
