From: Ezra B. <ezr...@us...> - 2007-04-15 02:55:49
|
Update of /cvsroot/win32forth/win32forth/apps/Win32ForthIDE In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv5638 Modified Files: CommandID.f EdMenu.f EdVersion.f Main.f Added Files: EdPrompt.ff EdPrompt.frm EdReplace.f EdReplace.ff EdReplace.frm Log Message: Search and Replace for the IDE editor. EAB Index: EdVersion.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Win32ForthIDE/EdVersion.f,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** EdVersion.f 13 Jan 2007 02:20:10 -0000 1.4 --- EdVersion.f 15 Apr 2007 02:55:45 -0000 1.5 *************** *** 262,266 **** - Added a combobox for quick viewing of source for a word. - Ability to open HTML source for editing. Control and double-click in directory window. ! - Quick editing and previewing of HTML source docs. Press F10 in HML source to preview in in browser. --- 262,266 ---- - Added a combobox for quick viewing of source for a word. - Ability to open HTML source for editing. Control and double-click in directory window. ! - Quick editing and previewing of HTML source docs. Press F10 in HTML source to preview in in browser. *************** *** 269,270 **** --- 269,274 ---- Preferences dialog. - Added display of the current column to the status bar. + + EAB Saturday, April 14 2007 + - Added "Search and Replace" ability to the IDE editor. In the process corrected a few bugs in + ScintillaControl.f . Index: EdMenu.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Win32ForthIDE/EdMenu.f,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** EdMenu.f 24 Feb 2007 18:15:44 -0000 1.17 --- EdMenu.f 15 Apr 2007 02:55:45 -0000 1.18 *************** *** 75,78 **** --- 75,79 ---- :MenuItem me_findnext "Search &next\tF3" IDM_FIND_NEXT DoCommand ; :MenuItem me_findprev "Search &prev\tShift+F3" IDM_FIND_PREVIOUS DoCommand ; + :MenuItem me_replace "Search and Replace" IDM_REPLACE_TEXT DoCommand ; MenuSeparator :MenuItem me_findinfiles "Find Text in Files...\tCtrl+Shift+F" IDM_FIND_IN_FILES DoCommand ; *************** *** 258,261 **** --- 259,263 ---- dup Enable: me_findnext dup Enable: me_findprev + dup Enable: me_replace dup Enable: me_date dup Enable: me_date&time *************** *** 325,328 **** --- 327,331 ---- ?Find: ActiveChild Enable: me_findnext ?Find: ActiveChild Enable: me_findprev + GetTextLength: ActiveChild Enable: me_replace ?BrowseMode: ActiveChild not Enable: me_date ?BrowseMode: ActiveChild not Enable: me_date&time --- NEW FILE: EdReplace.ff --- (This appears to be a binary file; contents omitted.) --- NEW FILE: EdPrompt.frm --- \ EDPROMPT.FRM \- textbox needs excontrols.f :Object frmPrompt <Super DialogWindow Font WinFont \ default font ' 2drop value WmCommand-Func \ function pointer for WM_COMMAND ColorObject FrmColor \ the background color 150 175 2value XYPos \ save screen location of form Label lblPrompt Label lblReplaceString PushButton btnYes PushButton btnNo PushButton btncancel PushButton btnYesToAll :M ClassInit: ( -- ) ClassInit: super \ Insert your code here ;M :M WindowStyle: ( -- style ) WS_POPUPWINDOW WS_DLGFRAME or ;M \ if this form is a modal form a non-zero parent must be set :M ParentWindow: ( -- hwndparent | 0 if no parent ) hWndParent ;M :M SetParentWindow: ( hwndparent -- ) \ set owner window to hWndParent ;M :M WindowTitle: ( -- ztitle ) z" Please confirm" ;M :M StartSize: ( -- width height ) 325 120 ;M :M StartPos: ( -- x y ) XYPos ;M :M Close: ( -- ) \ Insert your code here Close: super ;M :M On_Init: ( -- ) s" MS Sans Serif" SetFaceName: WinFont 8 Width: WinFont Create: WinFont \ set form color to system color COLOR_BTNFACE Call GetSysColor NewColor: FrmColor self Start: lblPrompt 30 10 282 17 Move: lblPrompt Handle: Winfont SetFont: lblPrompt s" Replace this highlighted occurrence?" SetText: lblPrompt self Start: lblReplaceString 30 29 282 17 Move: lblReplaceString Handle: Winfont SetFont: lblReplaceString s" " SetText: lblReplaceString self Start: btnYes 21 85 68 25 Move: btnYes Handle: Winfont SetFont: btnYes s" Yes" SetText: btnYes self Start: btnNo 91 85 68 25 Move: btnNo Handle: Winfont SetFont: btnNo s" No" SetText: btnNo self Start: btncancel 161 85 68 25 Move: btncancel Handle: Winfont SetFont: btncancel s" Cancel" SetText: btncancel self Start: btnYesToAll 231 85 68 25 Move: btnYesToAll Handle: Winfont SetFont: btnYesToAll s" Yes To All" SetText: btnYesToAll ParentWindow: self \ if this is a modal form disable parent if 0 ParentWindow: self Call EnableWindow drop then ;M :M WM_COMMAND ( h m w l -- res ) over LOWORD ( ID ) self \ object address on stack WMCommand-Func ?dup \ must not be zero if execute else 2drop \ drop ID and object address then 0 ;M :M SetCommand: ( cfa -- ) \ set WMCommand function to WMCommand-Func ;M :M On_Paint: ( -- ) 0 0 GetSize: self Addr: FrmColor FillArea: dc ;M :M On_Done: ( -- ) Delete: WinFont originx originy 2to XYPos ParentWindow: self \ if modal form re-enable parent if 1 ParentWindow: self Call EnableWindow drop \ reset focus to parent if we have one ParentWindow: self Call SetFocus drop then \ Insert your code here On_Done: super ;M ;Object --- NEW FILE: EdReplace.f --- \ EdReplace.f needs EdReplace.frm needs EdPrompt.frm create findbuf 0 , maxstring allot create replacebuf 0 , maxstring allot 0 value case? 0 value wholeword? 0 value prompt? 0 value direction 0 value scope 0 value replacecount : SearchForText ( -- f ) findbuf count SearchInTarget: CurrentWindow -1 <> ; : setflags ( -- ) 0 \ default case? if SCFIND_MATCHCASE + then wholeword? if SCFIND_WHOLEWORD + then SetSearchFlags: CurrentWindow ; : SetScope ( -- ) \ global or from cuurent position scope if GetCurrentPos: CurrentWindow else 0 then GetTextLength: CurrentWindow ( -- start end ) \ forward or backward search? direction if scope 0= \ if global just swap parameters if swap else 2drop GetCurrentPos: CurrentWindow 0 then then SetTargetEnd: CurrentWindow SetTargetStart: CurrentWindow ; : SetTargetRange ( -- ) \ what to search direction if GetTargetStart: CurrentWindow 0 else GetTargetEnd: CurrentWindow GetTextLength: CurrentWindow then SetTargetEnd: CurrentWindow SetTargetStart: CurrentWindow ; : ReplaceFoundText ( -- ) replacebuf count ReplaceTarget: CurrentWindow SetTargetRange 1 +to replacecount ; : ReplaceAllText ( -- ) 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 0 GotoPos: CurrentWindow ; :Object frmConfirmPrompt <Super frmPrompt : ?MoreText ( -- ) SearchForText 0= if Close: self else GetTargetStart: CurrentWindow GetTargetEnd: CurrentWindow SetSel: CurrentWindow \ highlight found text then ; : command-func ( id obj -- ) drop case GetID: btnYes of ReplaceFoundText update ?MoreText endof GetID: btnNo of SetTargetRange ?MoreText endof GetID: btnYesToAll of ReplaceAllText Close: self ShowCount endof GetID: btnCancel of Close: self endof endcase ; :M On_Init: ( -- ) On_Init: Super ['] command-func SetCommand: self \ give a little reminder findbuf count pad place s" --> " pad +place replacebuf count pad +place pad count SetText: lblReplaceString ;M ;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 SearchForText if prompt? if GetTargetStart: CurrentWindow GetTargetEnd: CurrentWindow SetSel: CurrentWindow \ highlight found text GetHandle: MainWindow SetParentWindow: frmConfirmPrompt Start: frmConfirmPrompt else ReplaceAllText ShowCount then else StringNotFound then ; :Object frmSearch&Replace <Super frmReplace : SaveParameters ( -- ) IsButtonChecked?: chkCase to case? IsButtonChecked?: chkWholeWord to wholeword? IsButtonChecked?: chkPrompt to prompt? 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 ; :M ON_INIT: ( -- ) IDOK SetID: btnOK IDCANCEL SetID: btnCancel 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 findbuf count SetText: txtSearch Replacebuf count SetText: txtReplace ['] command-func SetCommand: self 0 to replacecount ;m ;Object : Search&Replace ( -- ) GetHandle: MainWindow SetParentWindow: frmSearch&Replace Start: frmSearch&Replace ; IDM_REPLACE_TEXT SetCommand \s --- NEW FILE: EdPrompt.ff --- (This appears to be a binary file; contents omitted.) --- NEW FILE: EdReplace.frm --- \ EDREPLACE.FRM \- textbox needs excontrols.f :Object frmReplace <Super DialogWindow Font WinFont \ default font ' 2drop value WmCommand-Func \ function pointer for WM_COMMAND ColorObject FrmColor \ the background color 150 175 2value XYPos \ save screen location of form GroupBox grpOptions GroupBox grpDirection GroupBox grpScope Label lblSearch TextBox txtSearch Label lblReplace TextBox txtReplace CheckBox chkCase CheckBox chkWholeWord CheckBox chkPrompt GroupRadioButton radForward RadioButton radBackward GroupRadioButton radGlobal RadioButton radCurrent PushButton btnOk PushButton btnCancel :M ClassInit: ( -- ) ClassInit: super \ Insert your code here ;M :M WindowStyle: ( -- style ) WS_POPUPWINDOW WS_DLGFRAME or ;M \ if this form is a modal form a non-zero parent must be set :M ParentWindow: ( -- hwndparent | 0 if no parent ) hWndParent ;M :M SetParentWindow: ( hwndparent -- ) \ set owner window to hWndParent ;M :M WindowTitle: ( -- ztitle ) z" Search & Replace" ;M :M StartSize: ( -- width height ) 441 243 ;M :M StartPos: ( -- x y ) XYPos ;M :M Close: ( -- ) \ Insert your code here Close: super ;M :M On_Init: ( -- ) s" MS Sans Serif" SetFaceName: WinFont 8 Width: WinFont Create: WinFont \ set form color to system color COLOR_BTNFACE Call GetSysColor NewColor: FrmColor self Start: grpOptions 6 68 128 104 Move: grpOptions Handle: Winfont SetFont: grpOptions s" Options" SetText: grpOptions self Start: grpDirection 144 68 120 78 Move: grpDirection Handle: Winfont SetFont: grpDirection s" Direction" SetText: grpDirection self Start: grpScope 273 68 144 77 Move: grpScope Handle: Winfont SetFont: grpScope s" Search Scope" SetText: grpScope self Start: lblSearch 7 8 71 19 Move: lblSearch Handle: Winfont SetFont: lblSearch SS_RIGHT +Style: lblSearch s" Search for:" SetText: lblSearch self Start: txtSearch 82 8 328 19 Move: txtSearch Handle: Winfont SetFont: txtSearch self Start: lblReplace 7 29 74 19 Move: lblReplace Handle: Winfont SetFont: lblReplace SS_RIGHT +Style: lblReplace s" Replace with:" SetText: lblReplace self Start: txtReplace 82 29 328 19 Move: txtReplace Handle: Winfont SetFont: txtReplace self Start: chkCase 12 88 100 25 Move: chkCase WS_GROUP +Style: chkCase Handle: Winfont SetFont: chkCase s" Case Sensitive" SetText: chkCase self Start: chkWholeWord 12 115 100 25 Move: chkWholeWord Handle: Winfont SetFont: chkWholeWord s" Whole words only" SetText: chkWholeWord self Start: chkPrompt 12 142 118 25 Move: chkPrompt Handle: Winfont SetFont: chkPrompt s" Prompt each replace" SetText: chkPrompt self Start: radForward 148 88 100 25 Move: radForward Handle: Winfont SetFont: radForward s" Forward" SetText: radForward self Start: radBackward 149 116 100 25 Move: radBackward Handle: Winfont SetFont: radBackward s" Backward" SetText: radBackward self Start: radGlobal 279 88 100 25 Move: radGlobal Handle: Winfont SetFont: radGlobal s" Global" SetText: radGlobal self Start: radCurrent 279 115 119 25 Move: radCurrent Handle: Winfont SetFont: radCurrent s" From current position" SetText: radCurrent self Start: btnOk 330 181 100 25 Move: btnOk WS_GROUP +Style: btnOk Handle: Winfont SetFont: btnOk s" OK" SetText: btnOk self Start: btnCancel 330 211 100 25 Move: btnCancel Handle: Winfont SetFont: btnCancel s" Cancel" SetText: btnCancel ParentWindow: self \ if this is a modal form disable parent if 0 ParentWindow: self Call EnableWindow drop then ;M :M WM_COMMAND ( h m w l -- res ) over LOWORD ( ID ) self \ object address on stack WMCommand-Func ?dup \ must not be zero if execute else 2drop \ drop ID and object address then 0 ;M :M SetCommand: ( cfa -- ) \ set WMCommand function to WMCommand-Func ;M :M On_Paint: ( -- ) 0 0 GetSize: self Addr: FrmColor FillArea: dc ;M :M On_Done: ( -- ) Delete: WinFont originx originy 2to XYPos ParentWindow: self \ if modal form re-enable parent if 1 ParentWindow: self Call EnableWindow drop \ reset focus to parent if we have one ParentWindow: self Call SetFocus drop then \ Insert your code here On_Done: super ;M ;Object Index: Main.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Win32ForthIDE/Main.f,v retrieving revision 1.36 retrieving revision 1.37 diff -C2 -d -r1.36 -r1.37 *** Main.f 25 Feb 2007 13:58:12 -0000 1.36 --- Main.f 15 Apr 2007 02:55:45 -0000 1.37 *************** *** 82,85 **** --- 82,86 ---- needs EdMenu.f needs EdPreferences.f + needs EdReplace.f AcceleratorTable AccelTable \ create the Accelerator-Key-Table Index: CommandID.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Win32ForthIDE/CommandID.f,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** CommandID.f 13 Oct 2006 03:55:11 -0000 1.9 --- CommandID.f 15 Apr 2007 02:55:45 -0000 1.10 *************** *** 60,63 **** --- 60,64 ---- NewID IDM_LINETRANSPOSE NewID IDM_LINEDUPLICATE + NewID IDM_REPLACE_TEXT \ DexH menu |