From: Ezra B. <ezr...@us...> - 2009-04-10 16:51:18
|
Update of /cvsroot/win32forth/win32forth/apps/Win32ForthIDE In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv17256/apps/Win32ForthIDE Modified Files: Main.f Log Message: IDE Enhancements. Bug Fixes. Doc Updates. Index: Main.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Win32ForthIDE/Main.f,v retrieving revision 1.61 retrieving revision 1.62 diff -C2 -d -r1.61 -r1.62 *** Main.f 21 Dec 2008 12:05:52 -0000 1.61 --- Main.f 10 Apr 2009 16:51:09 -0000 1.62 *************** *** 18,22 **** only forth also editor definitions \ put all words into the EDITOR vocabulary ! true value sysgen s" apps\win32forthIDE" "fpath+ --- 18,22 ---- only forth also editor definitions \ put all words into the EDITOR vocabulary ! true value sysgen s" apps\win32forthIDE" "fpath+ *************** *** 45,49 **** 0 value TheFormBar \ address of toolbar for form designer 0 value ActiveForm \ current form ! 0 value FormList \ pointer to list of open forms ReadFile ViewerFile --- 45,50 ---- 0 value TheFormBar \ address of toolbar for form designer 0 value ActiveForm \ current form ! 0 value FormList \ pointer to list of open forms ! 0 value ActiveCoder \ the MDI child window used for editing form code ReadFile ViewerFile *************** *** 145,149 **** : UpdateFileTab ( -- ) ActiveChild 0= ?exit ! gethandle: openfilestab call IsWindow 0= ?exit \ GetFileName: ActiveChild count "TO-PATHEND" asciiz IsPsztext: OpenFilesTab \ TCIF_TEXT IsMask: OpenFilesTab --- 146,150 ---- : UpdateFileTab ( -- ) ActiveChild 0= ?exit ! GetHandle: OpenFilesTab Call IsWindow 0= ?exit \ GetFileName: ActiveChild count "TO-PATHEND" asciiz IsPsztext: OpenFilesTab \ TCIF_TEXT IsMask: OpenFilesTab *************** *** 155,160 **** i GetTabInfo: OpenFilesTab Lparam: OpenFilesTab ?dup ! if GetFileName: [ ] ! count "TO-PATHEND" dup 0= if 2drop s" <Untitled>" then asciiz --- 156,163 ---- i GetTabInfo: OpenFilesTab Lparam: OpenFilesTab ?dup ! if dup GetFileName: [ ] count ! rot ActiveCoder <> \ we prefer the full name for this one ! if "TO-PATHEND" ! then dup 0= if 2drop s" <Untitled>" then asciiz *************** *** 985,988 **** --- 988,1136 ---- ;Class + \ Window class for optional means of adding code to forms + \ Allows the full power of the IDE editor to be used when adding code to forms + :Class CodeChild <Super HyPerEditorChild + + max-path 2 + bytes FileName + 0 value CodeFlag + 0 value CurrentForm + 0 value CurrentControl + + + :M GetFileName: ( -- addr ) + FileName ;M + + :M SetFileName: ( addr len -- ) + FileName place FileName +null + UpdateFileName: super + ;M + + :M SetWindowTitle: ( -- ) + GetFileName: self count SetText: super + ;M + + : UpdateName ( -- ) + join$( + s" Code:" + FormName: CurrentForm count + s" ." + CodeFlag + case + 1 of s" Global" endof + 2 of s" Local" endof + 3 of s" OnInit" endof + 4 of GetName: CurrentControl endof + s" " rot + endcase + )join$ count SetFileName: self SetWindowTitle: self ; + + :M Refresh: ( flag -- ) + { \ pos -- } + to CodeFlag + ActiveForm to CurrentForm + ActiveControl: ActiveForm to CurrentControl + CodeFlag FLAG_CODE = CurrentControl 0= and ?exitm + CodeFlag + case + 1 of GlobalCode: CurrentForm + GetGlobalCursorPos: CurrentForm to pos + endof + 2 of LocalCode: CurrentForm + GetLocalCursorPos: CurrentForm to pos + endof + 3 of OnInitCode: CurrentForm + GetOnInitCursorPos: CurrentForm to pos + endof + 4 of ControlCode: CurrentControl + GetCursorPos: CurrentControl to pos + endof + 0 to pos false swap + endcase ( addr ) dup 0= + if drop pad dup off + then dup SetText: ChildWindow Highlight-Code + pos GotoPos: ChildWindow \ return to last editing position + SetSavePoint: ChildWindow \ mark as not modified yet + UpdateName Update \ and update + self to ActiveChild + ShowFileTab + ;M + + :M SaveCode: { \ pos -- } + \ some error checking, just in case the unexpected or unusual happens + GetModify: ChildWindow 0= ?exitm + CurrentForm 0= ?exitm + GetHandle: CurrentForm Call IsWindow 0= ?exitm + CodeFlag FLAG_CODE = CurrentControl 0= and ?exitm + GetCurrentPos: ChildWindow to pos \ we will save the last editing position so we can return to it + CodeFlag + case + 1 of pos SetGlobalCursorPos: CurrentForm + GlobalCode: CurrentForm + endof + 2 of pos SetLocalCursorPos: CurrentForm + LocalCode: CurrentForm + endof + 3 of pos SetOnInitCursorPos: CurrentForm + OnInitCode: CurrentForm + endof + 4 of pos SetCursorPos: CurrentControl + ControlCode: CurrentControl + endof + false swap + endcase ( addr ) ?dup + if GetTextLength: ChildWindow 1+ GetText: ChildWindow + SetSavePoint: ChildWindow + Update + IsModified: CurrentForm + RefreshCodeWindow + then ;M + + \ Override the following + :M SaveFile: ( -- ) + SaveCode: self ;M + + :M SaveFileAs: ( -- ) + SaveCode: self ;M + + :M SaveBeforeCloseing: ( -- ) + SaveCode: self ;M + + :M Start: ( parent -- ) + 0 FileName ! + Start: super + self to ActiveCoder + RefreshColors + false to CodeFlag + ;M + + :M On_Close: ( -- ) + On_Close: super dup + if 0 to ActiveCoder + false to show-code? \ reset by closing window + UpdateStatusBar + EnableToolbar + then ;M + + :M On_Command: { ncode id -- res } + id GetId: ChildWindow = + if ncode + case SCEN_KILLFOCUS of SaveCode: Self endof \ autosave + endcase + then ;M + \ + :M WM_COMMAND ( hwnd msg wparam lparam -- res ) + over HIWORD ( notification code ) rot LOWORD ( ID ) 2>r + WM_COMMAND WM: Super + 2r> On_Command: Self + ;M + + ;Class + + : NewCodeWnd ( -- ) \ open a new child window for adding code to forms + ActiveCoder 0= + if New> CodeChild to ActiveChild + MDIClientWindow: Frame Start: ActiveChild + then GetHandle: ActiveCoder Activate: Frame ; ' NewCodeWnd is NewCodeWindow + \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ some helper words *************** *** 1015,1019 **** : NewRemoteChild ( -- ) \ open a new child window used to open a file \ remotely by the Win32Forth console ! ActiveRemote 0= if NewEditWnd ActiveChild to ActiveRemote then GetHandle: ActiveRemote Activate: Frame ; --- 1163,1169 ---- : NewRemoteChild ( -- ) \ open a new child window used to open a file \ remotely by the Win32Forth console ! \ Tuesday, November 11 2008 - always open a new child for active remote, prevents ! \ a compile error from replacing an active file - EAB ! true \ ActiveRemote 0= if NewEditWnd ActiveChild to ActiveRemote then GetHandle: ActiveRemote Activate: Frame ; *************** *** 1199,1203 **** strip-cmdline ! 2dup IsProjectFile? if (open-project) else --- 1349,1355 ---- strip-cmdline ! 2dup OpenedByExtension? ! if 2drop exit ! then 2dup IsProjectFile? if (open-project) else |