From: Rod O. <rod...@us...> - 2008-10-25 22:08:49
|
Update of /cvsroot/win32forth/win32forth/src/console In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv7617 Modified Files: CommandWindow.f Log Message: Rod: used a memory DC for font calculations so get-dc and release-dc not needed Index: CommandWindow.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/console/CommandWindow.f,v retrieving revision 1.20 retrieving revision 1.21 diff -C2 -d -r1.20 -r1.21 *** CommandWindow.f 25 Oct 2008 15:18:04 -0000 1.20 --- CommandWindow.f 25 Oct 2008 21:41:26 -0000 1.21 *************** *** 22,25 **** --- 22,27 ---- defer LogKeyStrokes ' noop is LogKeyStrokes \ used in KeySave.f defined as menukey-more + WinDC mDC \ used for font calculations + \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ *************** *** 36,40 **** :M SetFont: ( font -- ) delete: font to font create: font ! Handle: font to hFont paint: self PauseForMessages BigCursor: [ self ] ;M --- 38,44 ---- :M SetFont: ( font -- ) delete: font to font create: font ! Handle: font to hFont ! hFont SetFont: mdc ! paint: self PauseForMessages BigCursor: [ self ] ;M *************** *** 419,423 **** dup>r RowAddress TabWidth 1 2swap ! GetHandle: dc call GetTabbedTextExtent loword r> VertLine * ; --- 423,427 ---- dup>r RowAddress TabWidth 1 2swap ! GetHandle: mdc call GetTabbedTextExtent loword r> VertLine * ; *************** *** 437,444 **** : SCP ( -- ) \ SetCommandPosition ! get-dc hFont SetFont: dc X Y SetSelectionStart SetCaretPosition ! release-dc ; --- 441,449 ---- : SCP ( -- ) \ SetCommandPosition ! \ get-dc ! \ hFont SetFont: mdc X Y SetSelectionStart SetCaretPosition ! \ release-dc ; *************** *** 449,455 **** : UpdateRange ( SelStartCol SelStartRow SelEndCol SelEndRow f -- ) >r 2>r ! get-dc hFont SetFont: dc ColRow>XY ScrollAdjust 2r> ColRow>XY VertLine + ScrollAdjust r> UpdateRectangle ! release-dc ; --- 454,461 ---- : UpdateRange ( SelStartCol SelStartRow SelEndCol SelEndRow f -- ) >r 2>r ! \ get-dc ! \ hFont SetFont: mdc ColRow>XY ScrollAdjust 2r> ColRow>XY VertLine + ScrollAdjust r> UpdateRectangle ! \ release-dc ; *************** *** 518,526 **** BackgroundColour SetBkColor: dc ! NewLine if \ Calculate the size of the text then draw it DRAWTEXTPARAMS DT_CALCRECT DT_EXPANDTABS or DT_TABSTOP or DT_NOPREFIX or ! ScrollRange -1 Text GetHandle: dc call DrawTextEx VertLine / to lines false to NewLine ! then DRAWTEXTPARAMS DT_NOCLIP DT_EXPANDTABS or DT_TABSTOP or DT_NOPREFIX or ScrollPos -1 Text GetHandle: dc call DrawTextEx drop --- 524,532 ---- BackgroundColour SetBkColor: dc ! \ NewLine if \ Calculate the size of the text then draw it DRAWTEXTPARAMS DT_CALCRECT DT_EXPANDTABS or DT_TABSTOP or DT_NOPREFIX or ! ScrollRange -1 Text GetHandle: dc call DrawTextEx VertLine / to lines false to NewLine ! \ then DRAWTEXTPARAMS DT_NOCLIP DT_EXPANDTABS or DT_TABSTOP or DT_NOPREFIX or ScrollPos -1 Text GetHandle: dc call DrawTextEx drop *************** *** 559,563 **** swap >r 1 ! BEGIN 2dup swap TabWidth 1 2swap GetHandle: dc call GetTabbedTextExtent loword dup to CC r@ <= over nm < and WHILE 1+ CC to PC --- 565,569 ---- swap >r 1 ! BEGIN 2dup swap TabWidth 1 2swap GetHandle: mdc call GetTabbedTextExtent loword dup to CC r@ <= over nm < and WHILE 1+ CC to PC *************** *** 600,604 **** :M Select: ( col row -- ) \ select text from SelStart to SelEnd - col row ! get-dc hFont SetFont: dc SelEndCol SelEndRow \ previous SelEnd col row 2swap to SelEndRow to SelEndCol --- 606,610 ---- :M Select: ( col row -- ) \ select text from SelStart to SelEnd - col row ! \ get-dc hFont SetFont: dc SelEndCol SelEndRow \ previous SelEnd col row 2swap to SelEndRow to SelEndCol *************** *** 614,618 **** UpdateLines THEN ! release-dc ;M --- 620,624 ---- UpdateLines THEN ! \ release-dc ;M *************** *** 628,634 **** : On_Track ( h m -- h m ) ! get-dc hFont SetFont: dc MouseX MouseY GetColRow ! release-dc 2dup BeforeCommandLine StartBeforeCommandLine and >r 2dup AfterCommandLine StartAfterCommandLine and >r --- 634,640 ---- : On_Track ( h m -- h m ) ! \ get-dc hFont SetFont: dc MouseX MouseY GetColRow ! \ release-dc 2dup BeforeCommandLine StartBeforeCommandLine and >r 2dup AfterCommandLine StartAfterCommandLine and >r *************** *** 641,654 **** IF 0 to SelectedLength ! get-dc hFont SetFont: dc SelStartCol SelStartRow ColRow>XY ScrollAdjust SelEndCol SelEndRow ColRow>XY ScrollAdjust UpdateLines SelStartCol to SelEndCol SelStartRow to SelEndRow ! release-dc THEN ;M : SetStart ( x y -- ) \ used in On_Click and SelectAll: ! get-dc hFont SetFont: dc GetColRow 2dup SetSelectionStart over swap OnCommandLine --- 647,660 ---- IF 0 to SelectedLength ! \ get-dc hFont SetFont: dc SelStartCol SelStartRow ColRow>XY ScrollAdjust SelEndCol SelEndRow ColRow>XY ScrollAdjust UpdateLines SelStartCol to SelEndCol SelStartRow to SelEndRow ! \ release-dc THEN ;M : SetStart ( x y -- ) \ used in On_Click and SelectAll: ! \ get-dc hFont SetFont: dc GetColRow 2dup SetSelectionStart over swap OnCommandLine *************** *** 656,660 **** ELSE drop false THEN to Editing ! release-dc ; --- 662,666 ---- ELSE drop false THEN to Editing ! \ release-dc ; *************** *** 1243,1246 **** --- 1249,1253 ---- :M On_Init: ( -- ) + 0 Call CreateCompatibleDC PutHandle: mDC MaxText malloc to text text MaxText 45 fill 0 text c! \ text MaxText erase CommandFont SetFont: self \ this creates a caret in BigCursor: self *************** *** 1250,1252 **** --- 1257,1263 ---- ;M + :M On_Done: ( -- ) + GetHandle: mdc call DeleteDC drop + ;M + ;Class |