From: Ezra B. <ezr...@us...> - 2008-09-02 03:15:18
|
Update of /cvsroot/win32forth/win32forth/apps/Win32ForthIDE In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv13420/apps/Win32ForthIDE Modified Files: CommandID.f EdVersion.f Added Files: EDSplitterWindow.f Log Message: Splitter windows for the IDE. Index: EdVersion.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Win32ForthIDE/EdVersion.f,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** EdVersion.f 24 Aug 2008 05:07:27 -0000 1.10 --- EdVersion.f 2 Sep 2008 03:15:10 -0000 1.11 *************** *** 314,315 **** --- 314,317 ---- on a form or control to bring up the Form Code Editor. - Beginnings of documentation for the IDE written. + Saturday, August 30 2008 + - Added splitter windows to the editor. Available from the Windows menu. Index: CommandID.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Win32ForthIDE/CommandID.f,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** CommandID.f 24 Aug 2008 05:07:27 -0000 1.18 --- CommandID.f 2 Sep 2008 03:15:09 -0000 1.19 *************** *** 112,115 **** --- 112,119 ---- NewID IDM_CLOSE_ALL + NewID IDM_SPLIT_HORIZONTAL + NewID IDM_SPLIT_VERTICAL + NewId IDM_NO_SPLIT_WINDOW + \ Help menu \ [cdo]NewID IDM_W32F_ANS_HELP --- NEW FILE: EDSplitterWindow.f --- \ EdSplitterWindow.f \ Allow dual viewing and editing of a file. :Class WindowPane <Super Child-Window int TheEditor :M ExWindowStyle: ( -- style ) ExWindowStyle: Super WS_EX_CLIENTEDGE or ;M :M Classinit: ( -- ) ClassInit: super \ init super class 0 to TheEditor ;M :M On_Init: ( -- ) CS_DBLCLKS GCL_STYLE hWnd Call SetClassLong drop hwnd GetHandle: TheEditor Call SetParent drop ;M :M On_Size: ( -- ) 0 0 Width Height Move: TheEditor ;M :M HandleofEditor: ( -- ) GetHandle: TheEditor ;M :M SetEditor: ( addr -- ) \ addr = editor object to TheEditor ;M :M WM_NOTIFY { h m w l \ GrandParent -- } \ let gran take care of it GetParent: Self GetParent: [ ] to GrandParent l w WM_NOTIFY GetHandle: GrandParent Call SendMessage drop ;M ;Class :Class VertSplitterWindow <Super Child-Window int dragging int mousedown 0 value ToolBarHeight \ set to height of toolbar if any 0 value StatusBarHeight \ set to height of status bar if any 250 value LeftWidth 5 value ThicknessV WinSplitter SplitV WindowPane PrimaryPane \ main editing window WindowPane SecondaryPane \ clone editing window : RightXpos ( -- n ) LeftWidth ThicknessV + ; : RightWidth ( -- n ) Width RightXpos - ; : LeftWidthMin ( -- n ) LeftWidth width min ; : StatusBarYpos ( -- n ) height StatusbarHeight - ; : TotalHeight ( -- n ) Height ToolBarHeight - StatusBarHeight - ; : position-windows ( -- ) 0 ToolBarHeight LeftWidthMin TotalHeight Move: PrimaryPane RightXpos ToolBarHeight RightWidth TotalHeight Move: SecondaryPane LeftWidth ToolBarHeight ThicknessV TotalHeight Move: SplitV ; : Splitter ( -- n ) \ the splitter window the cursor is on hWnd get-mouse-xy ToolBarHeight StatusBarYpos within swap LeftWidth RightXpos within and IF 1 ELSE 0 THEN ; : On_Tracking ( -- ) \ set min and max values of LeftWidth here mousedown dragging or 0= ?EXIT dragging IF mousex 0max width min thicknessV 2/ - to LeftWidth THEN position-windows WINPAUSE ; : On_Clicked ( -- ) mousedown not IF hWnd Call SetCapture drop THEN true to mousedown Splitter to dragging On_Tracking ; : On_Unclicked ( -- ) mousedown IF Call ReleaseCapture drop THEN false to mousedown false to dragging ; : On_DblClick ( -- ) false to mousedown Splitter 1 = IF LeftWidth 8 > IF 0 thicknessV 2/ - to LeftWidth ELSE Width thicknessV - 2/ to LeftWidth THEN position-windows THEN ; :M WM_SETCURSOR ( h m w l -- ) Splitter Case 0 of DefWindowProc: self endof 1 of SIZEWE-CURSOR 1 endof EndCase ;M :M Classinit: ( -- ) ClassInit: super \ init super class ['] On_Clicked SetClickFunc: self ['] On_Unclicked SetUnClickFunc: self ['] On_Tracking SetTrackFunc: self ['] On_DblClick SetDblClickFunc: self false to mousedown ;M :M On_Size: ( -- ) position-windows ;M :M On_Init: ( -- ) \ prevent flicker in window on sizing CS_DBLCLKS GCL_STYLE hWnd Call SetClassLong drop self Start: PrimaryPane self Start: SecondaryPane self Start: SplitV \ sync the two editors 0 0 SCI_GETDOCPOINTER HandleOfEditor: PrimaryPane Call SendMessage 0 SCI_SETDOCPOINTER HandleOfEditor: SecondaryPane Call SendMessage drop ;M :M SetEditors: ( addr1 addr2 -- addr ) SetEditor: SecondaryPane SetEditor: PrimaryPane ;M ;Class :Class VSplitterChild <Super HyperEditorChild VertSplitterWindow SplitW ScintillaControl MirrorEditor :M Start: ( parent -- ) Start: super self Start: MirrorEditor ChildWindow MirrorEditor SetEditors: SplitW self Start: Splitw 0 0 Width Height Move: SplitW ChildWindow >r MirrorEditor to ChildWindow InitLexer: self STYLE_DEFAULT z" Fixedsys" StyleSetFont: ChildWindow WordChars 1+ SetWordChars: ChildWindow RefreshColors ShowLineNumbers: ChildWindow r> to ChildWindow ;M :M On_Size: ( h m w l -- h m w l ) 0 0 Width Height Move: SplitW ;M :M WM_UPDATE ( -- ) \ save the current child from global variables Update: self RefreshColors \ main window ChildWindow >r \ save on stack MirrorEditor to ChildWindow RefreshColors \ clone window Update: self r> to ChildWindow \ restore ;M :M GetSplitType: ( -- n ) VERT_SPLIT ;M :M WM_NOTIFY ( h m w l -- res ) dup 2 cells + @ SCN_UPDATEUI = if UpdateStatusBar: self EnableToolbar else 4 cells+ @ dup ?indent ChildWindow >r MirrorEditor to ChildWindow ?indent r> to ChildWindow then false ;M ;Class : NewVSplitWnd ( -- ) New> VSplitterChild to ActiveChild MDIClientWindow: Frame Start: ActiveChild ; :Class HorizSplitterWindow <Super Child-Window WinSplitter SplitterH WindowPane PrimaryPane \ main editor window WindowPane SecondaryPane \ clone editor window 0 value ToolBarHeight \ set to height of toolbar if any 0 value StatusBarHeight \ set to height of status bar if any 200 value TopHeight 5 value ThicknessH int dragging int mousedown : SplitterYpos ( -- n ) ToolBarHeight TopHeight + ; : BottomYpos ( -- n ) SplitterYpos ThicknessH + ; : StatusBarYpos ( -- n ) height StatusbarHeight - ; : BottomHeight ( -- n ) StatusBarYpos BottomYpos - ; : TotalHeight ( -- n ) StatusBarYpos ToolBarHeight - ; : TopHeightMin ( -- n ) TopHeight TotalHeight min ; : position-windows ( -- ) 0 ToolBarHeight Width TopHeightMin Move: PrimaryPane 0 BottomYpos Width BottomHeight Move: SecondaryPane 0 SplitterYpos Width ThicknessH Move: SplitterH ; : Splitter ( -- n ) \ the splitter window the cursor is on hWnd get-mouse-xy dup ToolBarHeight StatusBarYpos within IF SplitterYpos BottomYpos within swap 0 width within and IF 1 ELSE 0 THEN ELSE 2drop 0 THEN ; : On_Tracking ( -- ) \ set min and max values of TopHeight here mousedown dragging or 0= ?EXIT dragging IF mousey ToolBarHeight - 0max TotalHeight min thicknessH 2/ - to TopHeight THEN position-windows WINPAUSE ; : On_Clicked ( -- ) mousedown not IF hWnd Call SetCapture drop THEN true to mousedown Splitter to dragging On_Tracking ; : On_Unclicked ( -- ) mousedown IF Call ReleaseCapture drop THEN false to mousedown false to dragging ; : On_DblClick ( -- ) false to mousedown Splitter 1 = IF TopHeight 8 > IF 0 thicknessH 2/ - to TopHeight ELSE TopHeight BottomHeight + thicknessH - 2/ to TopHeight THEN position-windows THEN ; :M WM_SETCURSOR ( h m w l -- ) Splitter Case 0 of DefWindowProc: self endof 1 of SIZENS-CURSOR 1 endof EndCase ;M :M Classinit: ( -- ) ClassInit: super \ init super class ['] On_Clicked SetClickFunc: self ['] On_Unclicked SetUnClickFunc: self ['] On_Tracking SetTrackFunc: self ['] On_DblClick SetDblClickFunc: self false to mousedown ;M :M On_Size: ( -- ) position-windows ;M :M On_Init: ( -- ) \ prevent flicker in window on sizing CS_DBLCLKS GCL_STYLE hWnd Call SetClassLong drop self Start: PrimaryPane self Start: SecondaryPane self Start: SplitterH \ sync the two editors 0 0 SCI_GETDOCPOINTER HandleOfEditor: PrimaryPane Call SendMessage 0 SCI_SETDOCPOINTER HandleOfEditor: SecondaryPane Call SendMessage drop ;M :M SetEditors: ( addr1 addr2 -- addr ) SetEditor: SecondaryPane SetEditor: PrimaryPane ;M ;Class :Class HSplitterChild <Super HyperEditorChild HorizSplitterWindow SplitW ScintillaControl MirrorEditor :M Start: ( parent -- ) Start: super self Start: MirrorEditor ChildWindow MirrorEditor SetEditors: SplitW self Start: Splitw 0 0 Width Height Move: SplitW ChildWindow >r MirrorEditor to ChildWindow InitLexer: self STYLE_DEFAULT z" Fixedsys" StyleSetFont: ChildWindow WordChars 1+ SetWordChars: ChildWindow RefreshColors ShowLineNumbers: ChildWindow r> to ChildWindow ;M :M On_Size: ( h m w l -- h m w l ) 0 0 Width Height Move: SplitW ;M :M WM_UPDATE ( -- ) \ save the current child from global variables Update: self RefreshColors \ main window ChildWindow >r \ save on stack MirrorEditor to ChildWindow RefreshColors \ clone window Update: self r> to ChildWindow \ restore ;M :M GetSplitType: ( -- n ) HORIZ_SPLIT ;M :M WM_NOTIFY ( h m w l -- res ) dup 2 cells + @ SCN_UPDATEUI = if UpdateStatusBar: self EnableToolbar else 4 cells+ @ dup ?indent ChildWindow >r MirrorEditor to ChildWindow ?indent r> to ChildWindow then false ;M ;Class : NewHSplitWnd ( -- ) New> HSplitterChild to ActiveChild MDIClientWindow: Frame Start: ActiveChild ; : TabPosition { ThisChild -- n } \ position of file in tab window TCIF_PARAM IsMask: OpenFilesTab GetTabCount: OpenFilesTab dup 0> if 1+ 0 do i GetTabInfo: OpenFilesTab Lparam: OpenFilesTab ThisChild = if i leave then loop else -1 then ; : SwapTabs { child1 child2 \ l1 l2 -- } GetTabCount: OpenFilesTab 0> not ?exit child1 child2 1- 0max = ?exit TCIF_PARAM IsMask: OpenFilesTab child1 GetTabInfo: OpenFilesTab LParam: OpenFilesTab to l1 child2 GetTabInfo: OpenFilesTab LParam: OpenFilesTab to l2 child1 SetTabInfo: OpenFilesTab l1 IsLparam: OpenFilesTab child2 SetTabInfo: OpenFilesTab ; : SplitWindow { win-func split-type \ modified? curpos textbuf textlen name$ -- } ActiveChild 0= ?exit GetFileType: ActiveChild FT_SOURCE <> ?exit GetSplitType: ActiveChild split-type = ?exit new$ to name$ name$ off GetTextLength: CurrentWindow 1+ to textlen \ get text buffer size textlen malloc to textbuf \ allocate buffer textbuf textlen GetText: CurrentWindow \ retrieve text ?Modified: ActiveChild to modified? \ get modified status GetCurrentPos: CurrentWindow to curpos \ position in document GetFileName: ActiveChild count name$ place \ file name SetSavepoint: CurrentWindow \ mark as not modified ActiveChild >r win-func execute \ NewHSplitWnd textbuf SetText: CurrentWindow name$ count SetFileName: ActiveChild curpos GotoPos: CurrentWindow modified? 0= IF SetSavePoint: CurrentWindow THEN textbuf release r@ TabPosition ActiveChild TabPosition SwapTabs r> GetHandle: [ ] CloseChild: Frame Update SetFocus: ActiveChild ; IDM_SPLIT_HORIZONTAL SetCommand : SplitWindowVertical ( -- ) ['] NewVSplitWnd VERT_SPLIT SplitWindow ; IDM_SPLIT_VERTICAL SetCommand : SplitWindowHorizontal ( -- ) ['] NewHSplitWnd HORIZ_SPLIT SplitWindow ; IDM_SPLIT_HORIZONTAL SetCommand : UnSplitWindow ( -- ) ['] NewEditWindow NO_SPLIT SplitWindow ; IDM_NO_SPLIT_WINDOW SetCommand \s \ : SplitWindowHorizontal { \ modified? curpos textbuf textlen name$ -- } \ ActiveChild 0= ?exit \ GetFileType: ActiveChild FT_SOURCE <> ?exit \ GetSplitType: ActiveChild HORIZ_SPLIT = ?exit \ new$ to name$ name$ off \ GetTextLength: CurrentWindow 1+ to textlen \ get text buffer size \ textlen malloc to textbuf \ allocate buffer \ textbuf textlen GetText: CurrentWindow \ retrieve text \ ?Modified: ActiveChild to modified? \ get modified status \ GetCurrentPos: CurrentWindow to curpos \ position in document \ GetFileName: ActiveChild count name$ place \ file name \ SetSavepoint: CurrentWindow \ mark as not modified \ ActiveChild >r \ NewHSplitWnd \ textbuf SetText: CurrentWindow \ name$ count SetFileName: ActiveChild \ curpos GotoPos: CurrentWindow \ modified? 0= IF SetSavePoint: CurrentWindow THEN \ textbuf release \ r@ TabPosition ActiveChild TabPosition SwapTabs \ r> GetHandle: [ ] CloseChild: Frame \ Update \ SetFocus: ActiveChild ; IDM_SPLIT_HORIZONTAL SetCommand \ \ : SplitWindowVertical { \ modified? curpos textbuf textlen name$ -- } \ ActiveChild 0= ?exit \ GetFileType: ActiveChild FT_SOURCE <> ?exit \ GetSplitType: ActiveChild VERT_SPLIT = ?exit \ new$ to name$ name$ off \ GetTextLength: CurrentWindow 1+ to textlen \ get text buffer size \ textlen malloc to textbuf \ allocate buffer \ textbuf textlen GetText: CurrentWindow \ retrieve text \ ?Modified: ActiveChild to modified? \ get modified status \ GetCurrentPos: CurrentWindow to curpos \ position in document \ GetFileName: ActiveChild count name$ place \ file name \ SetSavepoint: CurrentWindow \ mark as not modified \ ActiveChild >r \ NewVSplitWnd \ textbuf SetText: CurrentWindow \ name$ count SetFileName: ActiveChild \ curpos GotoPos: CurrentWindow \ modified? 0= IF SetSavePoint: CurrentWindow THEN \ textbuf release \ r@ TabPosition ActiveChild TabPosition SwapTabs \ r> GetHandle: [ ] CloseChild: Frame \ Update \ SetFocus: ActiveChild ; IDM_SPLIT_VERTICAL SetCommand \ \ : UnSplitWindow { \ modified? curpos textbuf textlen name$ -- } \ ActiveChild 0= ?exit \ GetFileType: ActiveChild FT_SOURCE <> ?exit \ GetSplitType: ActiveChild NO_SPLIT = ?exit \ new$ to name$ name$ off \ GetTextLength: CurrentWindow 1+ to textlen \ get text buffer size \ textlen malloc to textbuf \ allocate buffer \ textbuf textlen GetText: CurrentWindow \ retrieve text \ ?Modified: ActiveChild to modified? \ get modified status \ GetCurrentPos: CurrentWindow to curpos \ position in document \ GetFileName: ActiveChild count name$ place \ file name \ SetSavepoint: CurrentWindow \ mark as not modified \ ActiveChild >r \ NewEditWindow \ textbuf SetText: CurrentWindow \ name$ count SetFileName: ActiveChild \ curpos GotoPos: CurrentWindow \ modified? 0= IF SetSavePoint: CurrentWindow THEN \ textbuf release \ r@ TabPosition ActiveChild TabPosition SwapTabs \ r> GetHandle: [ ] CloseChild: Frame \ Update \ SetFocus: ActiveChild ; IDM_NO_SPLIT_WINDOW SetCommand \ \s |