From: Dirk B. <db...@us...> - 2005-12-17 15:12:07
|
Update of /cvsroot/win32forth/win32forth/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7022/src Modified Files: CALLBACK.f GENERIC.F Window.f Log Message: Some cleanup and start of adding DexH style comments. Index: Window.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/Window.f,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Window.f 25 Sep 2005 14:14:34 -0000 1.6 --- Window.f 17 Dec 2005 15:11:59 -0000 1.7 *************** *** 1,4 **** --- 1,8 ---- \ $Id$ + \ *! Window + \ *T Window -- Class for window objects. + \ *S Glossary + cr .( Loading Window Class...) *************** [...1173 lines suppressed...] + : small-font ( -- ) + ANSI_FIXED_FONT SelectStockObject: dc drop ; + ;CLASS + \ *G End of window class ! : find-window ( z"a1 -- hWnd ) \ w32f ! \ *G Find a window 0 swap Call FindWindow ; ! : send-window ( lParam wParam Message_ID hWnd -- ) \ w32f ! \ *G Send a message to a window Call SendMessage drop ; ! : LoadIconFile ( adr len -- hIcon ) \ w32f ! \ *G load an icon from a icon file ! asciiz >r LR_LOADFROMFILE 0 0 IMAGE_ICON r> ! NULL call LoadImage ; ! ! \ *Z Index: CALLBACK.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/CALLBACK.f,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CALLBACK.f 29 Aug 2005 15:56:27 -0000 1.4 --- CALLBACK.f 17 Dec 2005 15:11:59 -0000 1.5 *************** *** 64,68 **** and esp, # -16 \ align to 16 byte boundary mov SP0 [UP] , esp \ reset SP0 ! lea ebx, 7 19 - cells [ebp] [ecx*4] \ adjust ebx neg ecx \ negate ecx --- 64,68 ---- and esp, # -16 \ align to 16 byte boundary mov SP0 [UP] , esp \ reset SP0 ! lea ebx, 7 19 - cells [ebp] [ecx*4] \ adjust ebx neg ecx \ negate ecx *************** *** 84,88 **** push 11 cells [ebx] push 12 cells [ebx] ! push 13 cells [ebx] push 14 cells [ebx] push 15 cells [ebx] --- 84,88 ---- push 11 cells [ebx] push 12 cells [ebx] ! push 13 cells [ebx] push 14 cells [ebx] push 15 cells [ebx] *************** *** 141,145 **** \ **************** allow Forth to handle windows messages ***************** \ ************************************************************************* ! -1 value WM_WIN32FORTH 1 PROC TranslateMessage --- 141,203 ---- \ **************** allow Forth to handle windows messages ***************** \ ************************************************************************* ! ! (( ! The following windows message definition for WM_WIN32FORTH, provides a ! way for multiple Win32Forth applications to interact between themselves ! wile running. ! )) ! ! -1 value WM_WIN32FORTH ! ! (( ! Each instance of forth running under windows is able through the method ! WM32Forth: and a unique set of application specific constants ! (WM_BEEPME in this example) to detect a message being set to itself, ! and subsequently perform some specific operation as ordered. ! ! :M Win32Forth: ( h m w l -- ) \ The REAL version of this is at the ! \ end of this file ! over WM_BEEPME = ! if beep ! then ! ;M ! ! WM_WIN32FOR-INIT following obtains a unique windows message value from ! Windows then Win32Forth starts up, so this instance of forth will be ! able to talk to other instances of forth. ! )) ! ! \ changed Sonntag, August 22 2004 dbu ! 1 proc RegisterWindowMessage ! : wm_win32for-init ( -- ) ! \ create a unique message name; we do this to make shure ! \ that the console only talk to WinEd/SciEdit with the ! \ build with the Win32Forth Version. ! ! \ using PAD is ok here; because this is called before any ! \ application code is executed ! s" WM_WIN32FORTH_" pad place version# 0 (d.) pad +place pad +null ! pad 1+ Call RegisterWindowMessage ?dup ! if to WM_WIN32FORTH ! then ; ! ! initialization-chain chain-add wm_win32for-init \ initialize the message ! ! (( ! WIN32FORTH-MESSAGE allows a unique message to be broadcast to all ! currently running instances of Win32Forth. The 'w' parameter is the ! application specific sub-message that each instance can use to ! determine if it should handle the message. The 'l' parameter is ! available to pass specific information between instances of Win32Forth. ! )) ! ! \ changed September 6th, 2003 - 17:30 dbu ! 7 proc SendMessageTimeout ! : _win32forth-message ( lParam wParam -- ) ! 2>R 0 SP@ 2 ( ms ) SMTO_ABORTIFHUNG 2R> ! WM_WIN32FORTH HWND_BROADCAST Call SendMessageTimeout 2drop ! ; ! ! ' _win32forth-message is win32forth-message \ link to deferred word 1 PROC TranslateMessage *************** *** 174,177 **** --- 232,257 ---- HandleMessages-init + + \ A Win32Forth-message example: + + 31415 constant WM_BEEPME \ a command code to beep + + \ Send the message "WM_BEEPME" to all running instances of Win32Forth + + : beepme ( -- ) + 0 WM_BEEPME win32forth-message ; + + \ The chain "FORTH-MSG-CHAIN" receives all messages that are broadcast by any + \ program with the WM_WIN32FORTH message. "FORTH-MSG-BEEP" tests the sub-message + \ WM_BEEPME, and if it matches, then it beeps the console. Any sub-message that + \ is not recognized by any instance of a Win32Forth program must be ignored. + + : forth-msg-beep ( wParam lParam -- wParam lParam ) + over WM_BEEPME = + if beep + then ; + + forth-msg-chain chain-add forth-msg-beep \ default first entry to forth messages + in-system *************** *** 241,245 **** conDC \ the Device Context of the DC Call EnumFonts drop ; ! in-application --- 321,325 ---- conDC \ the Device Context of the DC Call EnumFonts drop ; ! in-application Index: GENERIC.F =================================================================== RCS file: /cvsroot/win32forth/win32forth/src/GENERIC.F,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** GENERIC.F 29 Aug 2005 15:56:27 -0000 1.3 --- GENERIC.F 17 Dec 2005 15:11:59 -0000 1.4 *************** *** 1,36 **** \ $Id$ - \ SetForegroundWindow: -- Fix by Jos Ven (added by rbs) - - cr .( Loading Generic Window...) ! Doc ! Generic-Window is the base class for all window objects. This class ! contains a single ivar, hWnd, that is the (MS Windows) handle for the ! window. This class encapsulates all the Win32 API calls that specify a ! window handle. There will be 3 subclasses of Generic-Window: ! Window Adds a device context and the ablility ! to display text and graphics output. ! Control Adds support for the standard Win32 controls ! with subclassing. ! Dialog Support for dialog boxes ! Since Generic-Window is a generic class it should not be used to create ! any instances. The Global Rectangle objects wRect and WndRect ( originally ! defined in Window.f ) have been replaced by a Rectangle IVAR WinRect so that ! Windows in different threads don't interfere with each other's drawing ! operations. For backwards compatibility wRect is defined as an int which is set ! to the address of WinRect by the ClassInit: method ( and WndRect is defined as ! an alias of wRect in Window.f. Also ) however WinRect should be used in new ! code since it uses early binding. ClientRect in class EditControl ( in Controls.f ) ! is also defined as an alias of wRect for compatibility. ! We also provide wRect as an alias of TempRect for compatibility. ! Temporarily added new generic class Dialog&Control and moved some code into it and ! duplicated the same code in Class Window so that Ivar offsets in Class Window are ! the same for temporary compatibility ! EndDoc only forth also definitions decimal --- 1,39 ---- \ $Id$ ! \ *! Generic ! \ *T Generic-Window -- Base class for all window objects. ! \ *P Generic-Window is the base class for all window objects. This class ! \ ** contains a single ivar, hWnd, that is the (MS Windows) handle for the ! \ ** window. This class encapsulates all the Win32 API calls that specify a ! \ ** window handle. There will be 3 subclasses of Generic-Window: ! \ *E Window Adds a device context and the ablility ! \ ** to display text and graphics output. ! \ ** ! \ ** Control Adds support for the standard Win32 controls ! \ ** with subclassing. ! \ ** ! \ ** Dialog Support for dialog boxes ! \ *P Since Generic-Window is a generic class it should not be used to create ! \ ** any instances. \n ! \ ** The Global Rectangle objects wRect and WndRect ( originally ! \ ** defined in Window.f ) have been replaced by a Rectangle IVAR WinRect so that ! \ ** Windows in different threads don't interfere with each other's drawing ! \ ** operations. \n ! \ ** For backwards compatibility wRect is defined as an int which is set ! \ ** to the address of WinRect by the ClassInit: method ( and WndRect is defined as ! \ ** an alias of wRect in Window.f. Also ) however WinRect should be used in new ! \ ** code since it uses early binding. ClientRect in class EditControl ( in Controls.f ) ! \ ** is also defined as an alias of wRect for compatibility. \n ! \ ** We also provide wRect as an alias of TempRect for compatibility. \n ! \ ** Temporarily added new generic class Dialog&Control and moved some code into it and ! \ ** duplicated the same code in Class Window so that Ivar offsets in Class Window are ! \ ** the same for temporary compatibility. ! \ *S Glossary ! cr .( Loading Generic Window...) only forth also definitions decimal *************** *** 52,55 **** --- 55,59 ---- :CLASS Generic-Window <Super Object + \ *G Base class for all window objects. \ Macros for backward compatibility *************** *** 67,73 **** in-application ! \ -------------------- Instance Variables -------------------- ! \ *** WARNING: DO NOT ADD ANY INSTANCE VARIABLES TO THIS CLASS BEFORE HWND ! *** \ HWND MUST BE THE FIRST IVAR. THIS IS ESSENTIAL TO THE --- 71,79 ---- in-application ! \ ----------------------------------------------------------------- ! \ *N Instance Variables ! \ ----------------------------------------------------------------- ! \ WARNING: DO NOT ADD ANY INSTANCE VARIABLES TO THIS CLASS BEFORE HWND \ HWND MUST BE THE FIRST IVAR. THIS IS ESSENTIAL TO THE *************** *** 75,86 **** \ USED BY CLASS CONTROL. ! int hWnd \ handle to Win32 window object ! (( ! int mydialoglink ! \ The following is for backward compatibility. Use WinRect for new code since it will ! \ be early bound whereas wRect will be latebound. ! int wRect ! Rectangle WinRect ! )) in-system --- 81,90 ---- \ USED BY CLASS CONTROL. ! int hWnd ! \ *G handle to Win32 window object ! ! \ ----------------------------------------------------------------- ! \ ----------------------------------------------------------------- ! in-system *************** *** 106,151 **** in-application ! \ -------------------- Window Methods -------------------- :M Classinit: ( -- ) ClassInit: super - \ addr: WinRect to wRect 0 to hWnd turnkeyed? 0= \ only dynamic windows can be used in a \in-system-ok if link-window then \ turnkeyed application so skip linking ;M ! :M GetHandle: ( -- hWnd ) \ return window handle ! hWnd ! ;M ! :M PutHandle: ( hWnd -- ) \ store window handle ! to hWnd ! ;M :M ZeroWindow: ( -- ) ! 0 to hWnd ! ;M :M DestroyWindow: ( -- ) hWnd ! if hWnd Call DestroyWindow ?win-error ! 0 to hWnd ! then ! ;M :M Close: ( -- ) ! DestroyWindow: self ! ;M ! :M Paint: ( -- ) \ force window repaint hWnd ! if 1 0 hWnd Call InvalidateRect ?win-error ! then ! ;M :M Show: ( state -- ) \ use words like SW_SHOWNORMAL hWnd ! if hWnd Call ShowWindow ! then drop ;M --- 110,157 ---- in-application ! \ ----------------------------------------------------------------- ! \ *N Methods ! \ ----------------------------------------------------------------- :M Classinit: ( -- ) + \ *G Init the class ClassInit: super 0 to hWnd turnkeyed? 0= \ only dynamic windows can be used in a \in-system-ok if link-window then \ turnkeyed application so skip linking ;M ! :M GetHandle: ( -- hWnd ) ! \ *G Get the window handle ! hWnd ;M ! :M PutHandle: ( hWnd -- ) ! \ *G Set the window handle ! to hWnd ;M :M ZeroWindow: ( -- ) ! \ *G Clear the window handle ! 0 to hWnd ;M :M DestroyWindow: ( -- ) + \ *G Destroy the window hWnd ! if hWnd Call DestroyWindow ?win-error ! 0 to hWnd ! then ;M :M Close: ( -- ) ! \ *G Close the window ! DestroyWindow: self ;M ! :M Paint: ( -- ) ! \ *G force window repaint hWnd ! if 1 0 hWnd Call InvalidateRect ?win-error ! then ;M :M Show: ( state -- ) \ use words like SW_SHOWNORMAL hWnd ! if hWnd Call ShowWindow ! then drop ;M *************** *** 195,198 **** --- 201,205 ---- ;M )) + :M SetMenu: ( menuhandle -- ) hWnd -if Call SetMenu ?win-error else 2drop then ;M *************** *** 287,291 **** ;M - :M IsDlgButtonChecked: ( id -- f1 ) hWnd Call IsDlgButtonChecked --- 294,297 ---- *************** *** 301,308 **** ;M - \ ** Obsolescent Method use SetDlgItemAlign: instead ** :M SetAlign: ( flag id -- ) \ hold over from the past ! SetDlgItemAlign: self ! ;M :M EnableDlgItem: ( flag id -- ) \ 0=disable, 1=enable --- 307,313 ---- ;M :M SetAlign: ( flag id -- ) \ hold over from the past ! \ *G Obsolescent Method use SetDlgItemAlign: instead ! SetDlgItemAlign: self ;M :M EnableDlgItem: ( flag id -- ) \ 0=disable, 1=enable *************** *** 335,338 **** --- 340,344 ---- 1 -rot WM_SETFONT swap SendDlgItemMessage: self ;M + (( \ The following definitions are for handling Dialog messages and have been moved *************** *** 360,366 **** msg-chain chain-add DoDialogMsg - ;CLASS ! : zero-windows { \ wlink -- } \ startup the console's menubar --- 366,371 ---- msg-chain chain-add DoDialogMsg ;CLASS ! \ *G End of generic-window class : zero-windows { \ wlink -- } \ startup the console's menubar *************** *** 412,413 **** --- 417,419 ---- ;CLASS + \ *Z |