From: Ezra B. <ezr...@us...> - 2010-07-11 02:46:18
|
Update of /cvsroot/win32forth/win32forth/apps/Win32ForthIDE In directory sfp-cvsdas-4.v30.ch3.sourceforge.com:/tmp/cvs-serv7248 Modified Files: EdFORTHFORM.F EdReplace.f SplitterWindow.f Log Message: Index: SplitterWindow.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Win32ForthIDE/SplitterWindow.f,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SplitterWindow.f 28 Apr 2008 05:17:17 -0000 1.1 --- SplitterWindow.f 11 Jul 2010 02:46:10 -0000 1.2 *************** *** 23,29 **** : test ( -- ) ! s" anew -testsplit" evaluate ! GetBuffer: SplitterFile (fload-buffer) s" Start: SplitterWindow" evaluate ! ; : toclipboard ( -- ) --- 23,34 ---- : test ( -- ) ! initbuffer s" anew -testsplit" append&crlf \ evaluate ! GetBuffer: SplitterFile append&crlf \ (fload-buffer) ! s" Start: SplitterWindow" append \ evaluate ! TheBuffer (fload-buffer) ! if postpone [ \ reset if error occurrs while compiling ! \in-system-ok testvocab \ set to test vocabulary ! s" -testsplit" evaluate \ forget everything ! then ; : toclipboard ( -- ) *************** *** 44,48 **** : do-splitfunc { filename cnt -- } ! s" apps\forthform\" PREPEND<HOME>\ pad place filename cnt pad +place filename cnt type-name$ place --- 49,53 ---- : do-splitfunc { filename cnt -- } ! s" apps\win32forthide\" PREPEND<HOME>\ pad place filename cnt pad +place filename cnt type-name$ place Index: EdFORTHFORM.F =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Win32ForthIDE/EdFORTHFORM.F,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** EdFORTHFORM.F 1 Feb 2010 01:41:48 -0000 1.9 --- EdFORTHFORM.F 11 Jul 2010 02:46:10 -0000 1.10 *************** *** 366,369 **** --- 366,370 ---- fname fcnt SetFileName: ThisForm Load: ThisForm + UpdateStatus: ThisForm Display: ThisForm doupdate *************** *** 553,562 **** then ; ! create buf 200 allot ! : File= { \ tmp# browsing? -- } ( <name> -- ) \ get file name from input stream false to browsing? -1 to tmp# ',' word dup c@ ! if count buf dup>r place more? if ',' word count number? --- 554,563 ---- then ; ! : File= { \ tmp# browsing? buf -- } ( <name> -- ) \ get file name from input stream ! max-path LocalAlloc: buf false to browsing? -1 to tmp# ',' word dup c@ ! if count buf place more? if ',' word count number? *************** *** 568,577 **** then then ! then r@ count file-status nip 0= \ if still exist ! if r@ IDM_OPEN_RECENT_FILE DoCommand \ open it tmp# -1 <> if tmp# GotoPos: CurrentWindow then browsing? SetBrowseMode: ActiveChild ! then r>drop else drop then ; --- 569,578 ---- then then ! then buf count file-status nip 0= \ if still exist ! if buf IDM_OPEN_RECENT_FILE DoCommand \ open it tmp# -1 <> if tmp# GotoPos: CurrentWindow then browsing? SetBrowseMode: ActiveChild ! then else drop then ; *************** *** 616,636 **** TabFile? 0 ?do i GetFileTabChild dup to ThisChild ! if GetFileName: ThisChild dup ! count "TO-PATHEND" s" <Untitled>" istr= not ! if s" File= " append ! count append ! GetFileType: ThisChild FT_SOURCE = ! if ',' cappend ! ChildWindow: ThisChild ! GetCurrentPos: [ ] (.) append ! ',' cappend ! ?BrowseMode: ThisChild ! if s" BROWSING" ! else s" EDITING" ! THEN append&crlf ! else +crlf ! then ! else drop ! then then loop ; --- 617,639 ---- TabFile? 0 ?do i GetFileTabChild dup to ThisChild ! if ThisChild ActiveCoder <> ! if GetFileName: ThisChild dup ! count "TO-PATHEND" s" <Untitled>" istr= not ! if s" File= " append ! count append ! GetFileType: ThisChild FT_SOURCE = ! if ',' cappend ! ChildWindow: ThisChild ! GetCurrentPos: [ ] (.) append ! ',' cappend ! ?BrowseMode: ThisChild ! if s" BROWSING" ! else s" EDITING" ! then append&crlf ! else +crlf ! then ! else drop ! then ! then then loop ; Index: EdReplace.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Win32ForthIDE/EdReplace.f,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** EdReplace.f 14 May 2007 05:37:39 -0000 1.2 --- EdReplace.f 11 Jul 2010 02:46:10 -0000 1.3 *************** *** 3,9 **** needs EdReplace.frm needs EdPrompt.frm ! create findbuf 0 , maxstring allot ! create replacebuf 0 , maxstring allot 0 value case? 0 value wholeword? --- 3,13 ---- needs EdReplace.frm needs EdPrompt.frm + needs SearchPrompt.frm + needs sub_dirs.f ! string: findbuf findbuf off ! string: replacebuf replacebuf off ! string: specsbuf s" *.f" specsbuf place ! string: pathbuf pathbuf off 0 value case? 0 value wholeword? *************** *** 13,16 **** --- 17,26 ---- 0 value replacecount 0 value savedpos + true value active? + false value opened? + false value folder? + false value subdirs? + false value cancelled? + ReadFile TempFile : SearchForText ( -- f ) *************** *** 18,21 **** --- 28,32 ---- : SavePosition ( -- ) + IsEditWnd? 0= ?exit GetCurrentPos: CurrentWindow to savedpos ; *************** *** 56,66 **** begin ReplaceFoundText SearchForText 0= ! until update ; : ShowCount ( -- ) ! s" Text was found and replaced " pad place ! replacecount (.) pad +place ! s" time(s)." pad +place ! true pad count ?MessageBox RestorePosition ; --- 67,79 ---- begin ReplaceFoundText SearchForText 0= ! until folder? ?exit ! update ; : ShowCount ( -- ) ! opened? folder? or ?exit \ no stopping if multiple files ! join$( s" Text was found and replaced " ! replacecount (.) ! s" time(s)." ! )join$ true swap count ?MessageBox RestorePosition ; *************** *** 79,86 **** ?MoreText endof GetID: btnNo of SetTargetRange ?MoreText endof ! GetID: btnYesToAll of ReplaceAllText ! Close: self ShowCount endof ! GetID: btnCancel of Close: self endof endcase ; --- 92,100 ---- ?MoreText endof GetID: btnNo of SetTargetRange ?MoreText endof ! GetID: btnYesToAll of ReplaceAllText opened? \ disable further ! if false to prompt? \ prompting ! then Close: self ShowCount endof ! GetID: btnCancel of Close: self true to cancelled? endof endcase ; *************** *** 91,98 **** \ give a little reminder ! findbuf count pad place ! s" --> " pad +place ! replacebuf count pad +place ! pad count SetText: lblReplaceString ;M --- 105,112 ---- \ give a little reminder ! join$( findbuf count ! s" --> " ! replacebuf count ! )join$ count SetText: lblReplaceString ;M *************** *** 100,111 **** ;Object : StringNotFound ( -- ) ! s" Text '" pad place ! findbuf count pad +place ! s" ' not found!" pad +place ! true pad count ?MessageBox ; : ReplaceText ( -- ) - findbuf c@ 0= ?exit \ nothing to find SetFlags SetScope --- 114,143 ---- ;Object + :Object frmFoundFiles <Super frmSearching + + :M On_Command: { ncode id -- f } + id + case IDCANCEL of true to search-aborted? endof + GetId: lstFoundFiles of ncode LBN_DBLCLK = + if GetSelectedString: lstFoundFiles + OpenSource + then endof + endcase ;M + + :M WM_COMMAND ( hwnd msg wparam lparam -- res ) + over HIWORD ( notification code ) rot LOWORD ( ID ) + On_Command: self + 0 ;M + + ;Object + : StringNotFound ( -- ) ! opened? folder? or ?exit \ if searching multiple files don't want to know ! join$( s" Text '" ! findbuf count ! s" ' not found!" ! )join$ true swap count ?MessageBox ; : ReplaceText ( -- ) SetFlags SetScope *************** *** 122,125 **** --- 154,246 ---- then ; + : ReplaceInOpenFiles ( -- ) + false to cancelled? + ActiveChild >r + CurrentWindow >r + scope >r 0 to scope \ always global + direction >r 0 to direction \ and in forward direction + TabFile? 0 + do i GetFileTabChild dup to ActiveChild + if GetFileType: ActiveChild FT_SOURCE = + if ChildWindow: ActiveChild to CurrentWindow + ActiveChild OnSelect + ReplaceText + cancelled? ?leave + then + then + loop r> to direction r> to scope r> to CurrentWindow r> to ActiveChild + ActiveChild OnSelect \ as we were + ; + + : SaveModifiedFile ( -- ) + name-buf count pad place + s" .bak" pad +place + pad count delete-file drop \ delete any previous backup + GetName: TempFile count pad count rename-file drop \ create backup + ReleaseBuffer: TempFile + GetTextLength: CurrentWindow 1+ AllocBuffer: TempFile + GetBuffer: TempFile GetText: CurrentWindow + GetLength: TempFile 1- SetLength: TempFile + + \ save the text to the file + SaveFile: TempFile + ReleaseBuffer: TempFile ; + + : SearchFoundFile ( -- ) \ full path name to file in name-buf (from sub_dirs.f) + WINPAUSE + name-buf count LoadFile: TempFile 0= ?exit + CurrentWindow >r + New> ScintillaControl to CurrentWindow + frmFoundFiles Start: CurrentWindow + GetBuffer: TempFile over + off SetText: CurrentWindow + ReleaseBuffer: TempFile + SetSavePoint: CurrentWindow \ mark as unmodified + ReplaceText \ search and replace if found + GetModify: CurrentWindow + if name-buf count asciiz AddStringto: lstFoundFiles \ show files that had text replaced + SaveModifiedFile + then Close: CurrentWindow + CurrentWindow Dispose + r> to CurrentWindow ; + + + : SetStrings ( -- ) + findbuf count SetText: lblSearchString + join$( s" Replaced with '" + replacebuf count + s" ' in" + )join$ count SetText: lblReplaced ; + + : ReplaceInFolder ( -- ) + specsbuf c@ 0= ?exit + pathbuf c@ 0= ?exit + scope >r 0 to scope + direction >r 0 to direction + prompt? >r 0 to prompt? + ['] SearchFoundFile is process-1file + false to open-file? + + GetHandle: MainWindow SetParentWindow: frmFoundFiles + Start: frmFoundFiles + SetStrings + + pathbuf count specsbuf count subdirs? sdir \ do the search & replace + r> to prompt? + r> to direction + r> to scope + search-aborted? 0= + if s" Done" SetText: btnCancel + begin WINPAUSE search-aborted? + until + then Close: frmFoundFiles ; + + : DoSearch&Replace ( -- ) + findbuf c@ 0= ?exit \ nothing to find + active? + if ReplaceText exit + then opened? + if ReplaceInOpenFiles exit + then ReplaceInFolder ; + :Object frmSearch&Replace <Super frmReplace *************** *** 130,145 **** IsButtonChecked?: radForward 0= to direction IsButtonChecked?: radGlobal 0= to scope GetText: txtSearch findbuf place ! GetText: txtReplace replacebuf place ; : command-func ( id obj -- ) drop ! case IDOK of SaveParameters ! Close: self ! ReplaceText endof ! IDCANCEL of Close: Self endof endcase ; : ?TextSelected { \ SelBuf$ -- } \ replace findbuf contents if text is selected 0 GetSelText: CurrentWindow LocalAlloc: SelBuf$ --- 251,287 ---- IsButtonChecked?: radForward 0= to direction IsButtonChecked?: radGlobal 0= to scope + IsButtonChecked?: radActiveFile to active? + IsButtonChecked?: radOpenFiles to opened? + IsButtonChecked?: radFolder to folder? + IsButtonChecked?: chkSubdirs to subdirs? GetText: txtSearch findbuf place ! GetText: txtReplace replacebuf place ! GetText: txtFilespecs specsbuf place ! GetText: txtSearchPath pathbuf place ; ! ! : GetFolder ( -- ) ! z" Select a drive or folder" ! \ use a copy of path because if cancelled path info is changed to null ! pathbuf count pad place ! pad hwnd BrowseForFolder ! if pad count 2dup pathbuf place SetText: txtSearchPath ! then ; : command-func ( id obj -- ) drop ! case IDOK of SaveParameters ! Close: self ! DoSearch&Replace endof ! IDCANCEL of Close: Self endof ! GetID: btnBrowse of GetFolder endof ! IsButtonChecked?: radActiveFile IsButtonChecked?: radOpenFiles or 0= ! dup Enable: chkSubdirs ! dup Enable: txtFilespecs ! dup Enable: txtSearchPath ! Enable: btnBrowse endcase ; : ?TextSelected { \ SelBuf$ -- } + IsEditWnd? 0= ?exit \ replace findbuf contents if text is selected 0 GetSelText: CurrentWindow LocalAlloc: SelBuf$ *************** *** 152,155 **** --- 294,311 ---- then ; + : ValidateOptions ( -- ) + TabFile? dup Enable: radActiveFile + dup Enable: radOpenFiles + 0= + if false to active? + false to opened? + true to folder? + else IsEditWnd? 0= + if false to active? + false Enable: radActiveFile + true to folder? + then + then ; + :M ON_INIT: ( -- ) IDOK SetID: btnOK *************** *** 158,170 **** On_Init: Super ! case? Check: chkCase ! prompt? Check: chkPrompt ! wholeword? Check: chkWholeWord ! direction 0= Check: radForward ! direction Check: radBackward ! scope 0= Check: radGlobal ! scope Check: radCurrent ?TextSelected --- 314,337 ---- On_Init: Super ! case? Check: chkCase ! prompt? Check: chkPrompt ! wholeword? Check: chkWholeWord ! direction 0= Check: radForward ! direction Check: radBackward ! scope 0= Check: radGlobal ! scope Check: radCurrent ! ! ValidateOptions ! ! active? Check: radActiveFile ! opened? Check: radOpenFiles ! folder? Check: radFolder ! subdirs? Check: chkSubdirs ! folder? dup Enable: chkSubdirs ! dup Enable: txtFilespecs ! dup Enable: txtSearchPath ! Enable: btnBrowse ?TextSelected *************** *** 173,176 **** --- 340,346 ---- Replacebuf count SetText: txtReplace + specsbuf count SetText: txtFilespecs + pathbuf count SetText: txtSearchpath + ['] command-func SetCommand: self |