From: Jos v.d.V. <jo...@us...> - 2007-05-19 09:50:35
|
Update of /cvsroot/win32forth/win32forth-stc/src/console In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv30048 Modified Files: ConsoleMenu.f Log Message: Jos: Enabled copy-console to avoid typo's Index: ConsoleMenu.f =================================================================== RCS file: /cvsroot/win32forth/win32forth-stc/src/console/ConsoleMenu.f,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ConsoleMenu.f 11 May 2007 10:45:16 -0000 1.3 --- ConsoleMenu.f 19 May 2007 09:50:32 -0000 1.4 *************** *** 12,15 **** --- 12,81 ---- INTERNAL \ internal definitions start here + : copy-console { \ gblhndl gblptr b/l l/s len -- } + \ *G Copy text to Windows clipboard + marked? 0= + if beep EXIT + then + conhndl call OpenClipboard 0= + if beep + else getmaxcolrow to l/s \ lines per screen (really total) + to b/l \ bytes per line + b/l 2 + l/s * 2 cells + \ max buffer size needed + GMEM_MOVEABLE GMEM_DDESHARE or \ flags + call GlobalAlloc to gblhndl \ allocate a buffer + gblhndl call GlobalLock to gblptr \ lock memory + + getxy nip getrowoff + l/s min to l/s \ adjust to lines needed + 0 to len + + l/s 0 + ?do i mkstlin mkedlin between \ if its a line we want + if i mkstlin = + if i b/l * &the-screen + + i mkedlin = + if b/l -trailing mkedcol min + mkstcol /string >r + gblptr len + r@ move \ append text + r> +to len \ adjust length + else b/l mkstcol /string -trailing >r + gblptr len + r@ move \ append text + r> +to len \ adjust length + crlf$ count \ srlf string + gblptr len + swap move \ append crlf + 2 +to len \ adjust length + then + else i mkedlin = + if i b/l * &the-screen + + mkedcol b/l min -trailing >r + gblptr len + r@ move \ append text + r> +to len \ adjust length + else i b/l * &the-screen + \ the line + b/l -trailing >r \ remove extra spaces + gblptr len + r@ move \ append text + r> +to len \ adjust length + crlf$ count \ srlf string + gblptr len + swap move \ append crlf + 2 +to len \ adjust length + then + then + then + loop gblptr len + off \ null terminate buffer + + gblhndl call GlobalUnlock drop \ unlock the buffer + call EmptyClipboard ?win-error \ clear out the clipboard + \ pass to windows + gblhndl CF_TEXT call SetClipboardData ?win-error + call CloseClipboard ?win-error + then ; + + : cut-console ( -- ) + \ *G Cut the complete text from the console window to the clipboard. + marked? + if beep + else mark-all + copy-console + cls + then ; + \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ \ \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ *************** *** 209,220 **** MENUSEPARATOR MENUCONSOLE "E&xit Win32Forth \tBYE" bye ; ! POPUP "&Edit" MENUITEM "&Cut and Clear Console \tCtrl+X" cut-console ; MENUITEM "&Copy Highlighted Text \tCtrl+C" copy-console ; ! MENUITEM "&Paste to Keyboard \tCtrl+V" paste-load ; MENUSEPARATOR ! MENUITEM "&Mark all Text \tCtrl+A" mark-all ; ! )) POPUP "&Display" --- 275,285 ---- MENUSEPARATOR MENUCONSOLE "E&xit Win32Forth \tBYE" bye ; ! )) POPUP "&Edit" MENUITEM "&Cut and Clear Console \tCtrl+X" cut-console ; MENUITEM "&Copy Highlighted Text \tCtrl+C" copy-console ; ! \ MENUITEM "&Paste to Keyboard \tCtrl+V" paste-load ; MENUSEPARATOR ! MENUITEM "&Mark all Text \tCtrl+A" mark-all ; POPUP "&Display" |