From: Dirk B. <db...@us...> - 2005-11-06 07:36:52
|
Update of /cvsroot/win32forth/win32forth/apps/SciEdit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5435/apps/SciEdit Modified Files: Main.f Log Message: Fixed a smal bug in SciEdit Index: Main.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/SciEdit/Main.f,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** Main.f 15 Sep 2005 16:36:08 -0000 1.11 --- Main.f 6 Nov 2005 07:36:40 -0000 1.12 *************** *** 79,122 **** \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ! :Object Frame <Super MDIFrameWindow create RegPath$ ," SciEdit\" ! :M Classinit: ( -- ) ! ClassInit: super ! MainMenu to CurrentMenu ;M :M InitRegistry: ( -- ) ! \ set the base registry string PROGREG-SET-BASE-PATH RegPath$ count progreg +place progreg +null ;M :M WindowMenuNo: ( -- n ) ! WINDOW-MENU ;M \ the Window menu where the child window titles will be placed :M WindowHasMenu: ( -- f ) ! True ;M :M WindowStyle: ( -- style ) ! WindowStyle: SUPER ! WS_CLIPCHILDREN or ;M :M ExWindowStyle: ( -- exstyle ) ! WS_EX_ACCEPTFILES ;M ! :M DropFiles: { hndl message wParam lParam \ drop$ -- res } ! SetForegroundWindow: self ! MAXSTRING LocalAlloc: drop$ ! 0 0 -1 wParam Call DragQueryFile ! 0 DO MAXCOUNTED drop$ 1+ i wParam Call DragQueryFile drop$ c! ! drop$ IDM_OPEN_RECENT_FILE DoCommand ! LOOP ! wParam Call DragFinish ;M :M WM_DROPFILES ( hndl message wParam lParam -- res ) ! DropFiles: self ;M :M WindowTitle: ( -- z" ) ! z" SciEdit" ;M : AdjustWindowSize { width height win -- } --- 79,122 ---- \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ! :Object Frame <Super MDIFrameWindow create RegPath$ ," SciEdit\" ! :M Classinit: ( -- ) ! ClassInit: super ! MainMenu to CurrentMenu ;M :M InitRegistry: ( -- ) ! \ set the base registry string PROGREG-SET-BASE-PATH RegPath$ count progreg +place progreg +null ;M :M WindowMenuNo: ( -- n ) ! WINDOW-MENU ;M \ the Window menu where the child window titles will be placed :M WindowHasMenu: ( -- f ) ! True ;M :M WindowStyle: ( -- style ) ! WindowStyle: SUPER ! WS_CLIPCHILDREN or ;M :M ExWindowStyle: ( -- exstyle ) ! WS_EX_ACCEPTFILES ;M ! :M DropFiles: { hndl message wParam lParam \ drop$ -- res } ! SetForegroundWindow: self ! MAXSTRING LocalAlloc: drop$ ! 0 0 -1 wParam Call DragQueryFile ! 0 DO MAXCOUNTED drop$ 1+ i wParam Call DragQueryFile drop$ c! ! drop$ IDM_OPEN_RECENT_FILE DoCommand ! LOOP ! wParam Call DragFinish ;M :M WM_DROPFILES ( hndl message wParam lParam -- res ) ! DropFiles: self ;M :M WindowTitle: ( -- z" ) ! z" SciEdit" ;M : AdjustWindowSize { width height win -- } *************** *** 127,155 **** win Call SetWindowPos drop ; ! :M ReSize: ( -- ) tempRect.AddrOf GetClientRect: self Left: tempRect ! ShowToolbar? if Height: TheRebar 2 - else Top: tempRect then ! Right: tempRect Bottom: tempRect ! ShowStatusbar? if Height: ScintillaStatusbar - 1+ then ! ShowToolbar? if Height: TheRebar - 1+ then Move: MDIClient ! ShowToolbar? if Width Height: TheRebar GetHandle: TheRebar AdjustWindowSize then ! ShowStatusbar? if Redraw: ScintillaStatusbar then ! ;M int WindowState ! :M On_Size: ( h m w -- ) ! to WindowState \ get WindowState, don't save size of maximised or minimised window ! ReSize: self ;M :M WM_ACTIVATEAPP ( hndl message wParam lParam -- res ) ! drop true = ActiveChild 0<> and ! if SetFocus: ActiveChild ! then 0 ;M : "GetDefault ( a1 n1 -- a2 n2 ) --- 127,155 ---- win Call SetWindowPos drop ; ! :M ReSize: ( -- ) tempRect.AddrOf GetClientRect: self Left: tempRect ! ShowToolbar? if Height: TheRebar 2 - else Top: tempRect then ! Right: tempRect Bottom: tempRect ! ShowStatusbar? if Height: ScintillaStatusbar - 1+ then ! ShowToolbar? if Height: TheRebar - 1+ then Move: MDIClient ! ShowToolbar? if Width Height: TheRebar GetHandle: TheRebar AdjustWindowSize then ! ShowStatusbar? if Redraw: ScintillaStatusbar then ! ;M int WindowState ! :M On_Size: ( h m w -- ) ! to WindowState \ get WindowState, don't save size of maximised or minimised window ! ReSize: self ;M :M WM_ACTIVATEAPP ( hndl message wParam lParam -- res ) ! drop true = ActiveChild 0<> and ! if SetFocus: ActiveChild ! then 0 ;M : "GetDefault ( a1 n1 -- a2 n2 ) *************** *** 166,225 **** : SaveRecentFiles ( -- ) ! s" Recent Files" s" File1" 9 1 ! DO 2dup + 1- i 48 + swap c! ! 4dup i GetRecentFile: RecentFiles count ! 2rot 2rot 2swap RegSetString ! LOOP 2drop ; : RestoreRecentFiles ( -- ) ! 8 SetNumber: RecentFiles ! s" Recent Files" s" File1" 9 0 ! DO 2dup + 1- 57 i - swap c! ! 4dup 2swap RegGetString ! 2dup FILE-STATUS nip 0= \ we only add the file's witch still exist ! IF pad place pad Insert: RecentFiles ! ELSE 2drop ! THEN ! LOOP 4drop ; : save-defaults ( -- ) base @ >r decimal \ MUST be in decimal when saving defaults ! InitRegistry: self ! CreateBackup? s>d (d.) s" Backup" "SetDefault ! EOL s>d (d.) s" EOL" "SetDefault ! ViewEOL? s>d (d.) s" ViewEOL" "SetDefault ! ViewWhiteSpace? s>d (d.) s" WhiteSpace" "SetDefault ! CaseSensitive? s>d (d.) s" CaseSensitive" "SetDefault ! sub-dirs? s>d (d.) s" SubDirectories" "SetDefault ! all-occur? s>d (d.) s" AllOccurances" "SetDefault ! Colorize? s>d (d.) s" Colorize" "SetDefault ! ViewLineNumbers? s>d (d.) s" ViewLineNumbers" "SetDefault ! TabSize s>d (d.) s" TabSize" "SetDefault ! UseTabs? s>d (d.) s" UseTabs" "SetDefault ! ShowToolbar? s>d (d.) s" ShowToolbar" "SetDefault ! ShowStatusbar? s>d (d.) s" ShowStatusbar" "SetDefault ! HandleW32FMsg? s>d (d.) s" HandleW32FMsg" "SetDefault ! FinalNewLine? s>d (d.) s" FinalNewLine" "SetDefault ! SaveAllBeforeCompile? s>d (d.) s" SaveAllBeforeCompile" "SetDefault ! StripTrailingWhitespace? s>d (d.) s" StripTrailingSpaces" "SetDefault ! WindowState SIZE_RESTORED = ! if StartPos: self s>d (d.) s" WindowTop" "SetDefault ! s>d (d.) s" WindowLeft" "SetDefault ! Width: self s>d (d.) s" WindowWidth" "SetDefault ! Height: self s>d (d.) s" WindowHeight" "SetDefault ! then ! mask-ptr count s" SearchMask" "SetDefault ! find-buf count s" SearchText" "SetDefault ! path-ptr count s" SearchPath" "SetDefault ! SaveRecentFiles ! SetRegistryKey: ControlToolBar true SaveRestore: ControlToolBar ! r> base ! ; : load-defaults ( -- ) --- 166,226 ---- : SaveRecentFiles ( -- ) ! s" Recent Files" s" File1" 9 1 ! DO 2dup + 1- i 48 + swap c! ! 4dup i GetRecentFile: RecentFiles count ! 2rot 2rot 2swap RegSetString ! LOOP 4drop ; : RestoreRecentFiles ( -- ) ! 8 SetNumber: RecentFiles ! s" Recent Files" s" File1" 9 1 ! DO 2dup + 1- 57 i - swap c! ! 4dup 2swap RegGetString ! 2dup FILE-STATUS nip 0= \ we only add the file's witch still exist ! IF pad place pad Insert: RecentFiles ! ELSE 2drop ! THEN ! LOOP 4drop ; : save-defaults ( -- ) base @ >r decimal \ MUST be in decimal when saving defaults ! InitRegistry: self ! CreateBackup? s>d (d.) s" Backup" "SetDefault ! EOL s>d (d.) s" EOL" "SetDefault ! ViewEOL? s>d (d.) s" ViewEOL" "SetDefault ! ViewWhiteSpace? s>d (d.) s" WhiteSpace" "SetDefault ! CaseSensitive? s>d (d.) s" CaseSensitive" "SetDefault ! sub-dirs? s>d (d.) s" SubDirectories" "SetDefault ! all-occur? s>d (d.) s" AllOccurances" "SetDefault ! Colorize? s>d (d.) s" Colorize" "SetDefault ! ViewLineNumbers? s>d (d.) s" ViewLineNumbers" "SetDefault ! TabSize s>d (d.) s" TabSize" "SetDefault ! UseTabs? s>d (d.) s" UseTabs" "SetDefault ! ShowToolbar? s>d (d.) s" ShowToolbar" "SetDefault ! ShowStatusbar? s>d (d.) s" ShowStatusbar" "SetDefault ! HandleW32FMsg? s>d (d.) s" HandleW32FMsg" "SetDefault ! FinalNewLine? s>d (d.) s" FinalNewLine" "SetDefault ! SaveAllBeforeCompile? s>d (d.) s" SaveAllBeforeCompile" "SetDefault ! StripTrailingWhitespace? s>d (d.) s" StripTrailingSpaces" "SetDefault ! WindowState SIZE_RESTORED = ! if StartPos: self s>d (d.) s" WindowTop" "SetDefault ! s>d (d.) s" WindowLeft" "SetDefault ! Width: self s>d (d.) s" WindowWidth" "SetDefault ! Height: self s>d (d.) s" WindowHeight" "SetDefault ! then ! mask-ptr count s" SearchMask" "SetDefault ! find-buf count s" SearchText" "SetDefault ! path-ptr count s" SearchPath" "SetDefault ! SaveRecentFiles ! SetRegistryKey: ControlToolBar true SaveRestore: ControlToolBar ! r> base ! ! ; : load-defaults ( -- ) *************** *** 259,272 **** :M StartSize: ( -- w h ) base @ >r decimal \ MUST be in decimal when loading defaults ! InitRegistry: self ! s" WindowWidth" "GetDefaultValue 0= IF drop 400 THEN ! s" WindowHeight" "GetDefaultValue 0= IF drop 400 THEN r> base ! ;M :M StartPos: ( -- x y ) base @ >r decimal \ MUST be in decimal when loading defaults ! InitRegistry: self ! s" WindowLeft" "GetDefaultValue 0= IF drop 0 THEN ! s" WindowTop" "GetDefaultValue 0= IF drop 0 THEN r> base ! ;M --- 260,273 ---- :M StartSize: ( -- w h ) base @ >r decimal \ MUST be in decimal when loading defaults ! InitRegistry: self ! s" WindowWidth" "GetDefaultValue 0= IF drop 400 THEN ! s" WindowHeight" "GetDefaultValue 0= IF drop 400 THEN r> base ! ;M :M StartPos: ( -- x y ) base @ >r decimal \ MUST be in decimal when loading defaults ! InitRegistry: self ! s" WindowLeft" "GetDefaultValue 0= IF drop 0 THEN ! s" WindowTop" "GetDefaultValue 0= IF drop 0 THEN r> base ! ;M *************** *** 274,318 **** LoadAppIcon ;M ! :M On_Init: ( -- ) ! On_Init: super ! InitScintillaControl \ Dienstag, August 03 2004 dbu ! AccelTable EnableAccelerators \ init the accelerator table GetHandle: self Create: ScintillaStatusbar self Start: TheRebar ! EnableToolbar ! load-defaults ReSize: self ! ;M :M OnWmCommand: ( hwnd msg wparam lparam -- hwnd msg wparam lparam ) ! over LOWORD ( command ID ) dup ! IsCommand? IF DoCommand \ intercept Toolbar and shortkey commands ELSE drop OnWmCommand: Super \ intercept Menu commands THEN ;M ! :M WM_CLOSE ( h m w l -- res ) ! CloseAll: self ! NotCancelled \ if we don't cancel the close ! IF CloseBrowser \ close the browser window ! save-defaults \ save properties in registry ! ExitScintillaControl \ terminate the Scintilla control ! AccelTable DisableAccelerators \ free the accelerator table ! bye \ then terminate the program ! ELSE 1 \ else abort program termination ! THEN ;M ! :M On_Done: ( -- ) ! Turnkeyed? IF 0 call PostQuitMessage drop THEN ! On_Done: Super ;M :M WM_INITMENU ( h m w l -- res ) \ enable/disable the menu items ! EnableMenuBar ;M :M MessageBox: ( szText szTitle style -- result ) ! 3reverse hWnd Call MessageBox ;M :M WM_NOTIFY ( h m w l -- res ) ! Handle_Notify: ControlToolbar ;M :M Win32Forth: ( hndl msg wParam lParam -- ) \ respond to Win32Forth messages --- 275,319 ---- LoadAppIcon ;M ! :M On_Init: ( -- ) ! On_Init: super ! InitScintillaControl \ Dienstag, August 03 2004 dbu ! AccelTable EnableAccelerators \ init the accelerator table GetHandle: self Create: ScintillaStatusbar self Start: TheRebar ! EnableToolbar ! load-defaults ReSize: self ! ;M :M OnWmCommand: ( hwnd msg wparam lparam -- hwnd msg wparam lparam ) ! over LOWORD ( command ID ) dup ! IsCommand? IF DoCommand \ intercept Toolbar and shortkey commands ELSE drop OnWmCommand: Super \ intercept Menu commands THEN ;M ! :M WM_CLOSE ( h m w l -- res ) ! CloseAll: self ! NotCancelled \ if we don't cancel the close ! IF CloseBrowser \ close the browser window ! save-defaults \ save properties in registry ! ExitScintillaControl \ terminate the Scintilla control ! AccelTable DisableAccelerators \ free the accelerator table ! bye \ then terminate the program ! ELSE 1 \ else abort program termination ! THEN ;M ! :M On_Done: ( -- ) ! Turnkeyed? IF 0 call PostQuitMessage drop THEN ! On_Done: Super ;M :M WM_INITMENU ( h m w l -- res ) \ enable/disable the menu items ! EnableMenuBar ;M :M MessageBox: ( szText szTitle style -- result ) ! 3reverse hWnd Call MessageBox ;M :M WM_NOTIFY ( h m w l -- res ) ! Handle_Notify: ControlToolbar ;M :M Win32Forth: ( hndl msg wParam lParam -- ) \ respond to Win32Forth messages |