From: George H. <geo...@us...> - 2008-10-29 23:21:02
|
Update of /cvsroot/win32forth/win32forth/src/console In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv25509/src/console Modified Files: CommandWindow.f Log Message: Improved multi-tasking plus updated taskdemo (which hopefully now works for everybody). Index: CommandWindow.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/console/CommandWindow.f,v retrieving revision 1.21 retrieving revision 1.22 diff -C2 -d -r1.21 -r1.22 *** CommandWindow.f 25 Oct 2008 21:41:26 -0000 1.21 --- CommandWindow.f 29 Oct 2008 23:20:55 -0000 1.22 *************** *** 464,474 **** ;M - :M Redraw: ( -- ) - Paint: self - Update: self - UpdateVScroll: self - UpdateHScroll: self - ;M - :M AutoHScroll: ( -- ) \ scroll caret into view horizontally PauseForMessages --- 464,467 ---- *************** *** 512,516 **** ;M ! :M On_Paint: ( -- ) \ all window refreshing is done by On_Paint: \ Set up metrics --- 505,509 ---- ;M ! :M On_Paint: ( -- ) \ all window refreshing is done by On_Paint: or update: \ Set up metrics *************** *** 555,558 **** --- 548,601 ---- ;M + :M update: ( -- ) \ Added to prevent deadlocks when called by other tasks + + \ Set up metrics + hFont SetFont: mdc + tm GetTextMetrics: mdc + tmAveCharWidth dup to HorzLine 20 * to HorzPage + tmHeight tmExternalLeading + dup to VertLine 7 * to VertPage + iTabLength HorzLine * TabWidth ! + + ForegroundColour SetTextColor: mdc + BackgroundColour SetBkColor: mdc + + \ 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: mdc 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: mdc call DrawTextEx drop + + \ Draw highlighted text if any + SelectedLength + IF + BackgroundColour SetTextColor: mdc + ForegroundColour SetBkColor: mdc + iLeftMargin scrollpos.left + TabWidth 1 + FirstSelectedLine swap + SelStartX SelStartY ScrollAdjust swap + GetHandle: mdc call TabbedTextOut drop + + 0 SelStartX SelStartY nip ScrollAdjust \ adjusted point at start of row + BEGIN SelectionRemainingLength \ while some chars left + WHILE + VertLine + 2dup 2>r + iLeftMargin scrollpos.left + TabWidth 1 + NextSelectedLine swap + 2r> swap + GetHandle: mdc call TabbedTextOut drop + REPEAT + 2drop + THEN + ;M + + :M Redraw: ( -- ) + Paint: self + Update: self + UpdateVScroll: self + UpdateHScroll: self + ;M + \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ \\\\\ Text Operations \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ |