From: Rod O. <rod...@us...> - 2006-08-03 20:32:43
|
Update of /cvsroot/win32forth/win32forth/apps/Sudoku In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv990/apps/Sudoku Modified Files: SudokuToolbar.f Log Message: Rod: Made toolbar bitmap transparent Index: SudokuToolbar.f =================================================================== RCS file: /cvsroot/win32forth/win32forth/apps/Sudoku/SudokuToolbar.f,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** SudokuToolbar.f 3 Oct 2005 22:04:27 -0000 1.1 --- SudokuToolbar.f 3 Aug 2006 20:32:31 -0000 1.2 *************** *** 1,2 **** --- 1,3 ---- + \ $Id$ \ SudokuToolbar.f Toolbar for Sudoku game \ September 2005 Rod Oakford *************** *** 7,10 **** --- 8,12 ---- Needs SudokuMenu.f cr .( Loading Sudoku Toolbar...) + \- ToolBarLayoutKey Create ToolBarLayoutKey ," Software\Win32Forth\Sudoku\Options" *************** *** 95,98 **** --- 97,108 ---- ; + : MakeTransparent ( -- ) \ changes background color of bitmap to BTNFACE + COLOR_BTNFACE Call GetSysColor \ convert 0bgr to 0rgb + dup 0xFF and 16 LShift over 0xFF00 and + swap 0xFF0000 and 16 RShift + + BitmapInfo dup @ + \ address of ColorTable + BitmapData c@ 15 and \ color index for first pixel + 4 * + ! + ; + s" Toolbar.bmp" LoadBitmapFile *************** *** 109,130 **** to pszValueName ;M ! (( ! :M AddBitmaps: ( n -- ) \ loads n images from bitmap loaded in memory ! DIB_RGB_COLORS ! BitmapInfo ! BitmapData ! CBM_INIT ! BitmapInfo \ info pointer ! GetDC: self ! call CreateDIBitmap ! to nID NULL to hInst ! tbab swap TB_ADDBITMAP hwnd call SendMessage Drop ! ;M ! )) :M Start: ( parent -- ) SudokuTable IsButtonTable: self SudokuTooltips IsTooltips: self Start: super ! \ Create bitmap handle DIB_RGB_COLORS BitmapInfo --- 119,129 ---- to pszValueName ;M ! :M Start: ( parent -- ) SudokuTable IsButtonTable: self SudokuTooltips IsTooltips: self Start: super ! \ Create bitmap handle ! MakeTransparent DIB_RGB_COLORS BitmapInfo *************** *** 137,142 **** 0 hBitmap 24 AddBitmaps: self drop \ Set-up registry key for customization data... ! z" Software\Win32Forth\Sudoku\Options" \ Registry sub-key ! z" ToolBarLayout" \ value key name SetRegistryKey: self z" ToolBarLayoutDefault" to pszValueNameDefault --- 136,141 ---- 0 hBitmap 24 AddBitmaps: self drop \ Set-up registry key for customization data... ! ToolBarLayoutKey 1+ \ Registry sub-key ! z" ToolBarLayout" \ value key name SetRegistryKey: self z" ToolBarLayoutDefault" to pszValueNameDefault *************** *** 184,312 **** : CheckNumber ( n -- ) \ check nth number on toolbar, uncheck the rest IDM_SELECT_BLANK + true swap CheckButton: SudokuToolBar ; - - - \s - Needs ToolbarClass - Needs SudokuMenu - cr .( Loading Sudoku Toolbar...) - - false value FlatToolbar? - - :Object SudokuToolBar <Super CustomizableToolbar - - s" Toolbar.bmp" LoadBitmapFile - - DefaultButtons \ Buttons that will be initially displayed - \ iBmp idCommand Style State (optional) - Separator - 0 IDM_NEW Button - 1 IDM_OPEN Button - 2 IDM_SAVE Button - Separator - 3 IDM_PRINT Button - Separator - 4 IDM_SELECT_1 CheckGroup - 5 IDM_SELECT_2 CheckGroup - 6 IDM_SELECT_3 CheckGroup - 7 IDM_SELECT_4 CheckGroup - 8 IDM_SELECT_5 CheckGroup - 9 IDM_SELECT_6 CheckGroup - 10 IDM_SELECT_7 CheckGroup - 11 IDM_SELECT_8 CheckGroup - 12 IDM_SELECT_9 CheckGroup - 13 IDM_SELECT_BLANK CheckGroup Checked - Separator - 14 IDM_BACKWARD Button - 15 IDM_FORWARD Button - Separator - 18 IDM_PAUSE Check - Separator - 19 IDM_COLOUR_1 CheckGroup Checked - 20 IDM_COLOUR_2 CheckGroup - 21 IDM_COLOUR_3 CheckGroup - 22 IDM_COLOUR_4 CheckGroup - - ExtraButtons \ Buttons that will be available to customize the toolbar - 16 IDM_PLUS Button - 17 IDM_MINUS Button - Separator - 23 IDM_OPTIONS Button - - :M TooltipText: ( id -- Z$ ) - Case - IDM_NEW OF Z" Make a new game" ENDOF - IDM_OPEN OF Z" Open game file" ENDOF - IDM_SAVE OF Z" Save game file" ENDOF - IDM_PRINT OF Z" Print game" ENDOF - IDM_SELECT_1 OF Z" Select 1" ENDOF - IDM_SELECT_2 OF Z" Select 2" ENDOF - IDM_SELECT_3 OF Z" Select 3" ENDOF - IDM_SELECT_4 OF Z" Select 4" ENDOF - IDM_SELECT_5 OF Z" Select 5" ENDOF - IDM_SELECT_6 OF Z" Select 6" ENDOF - IDM_SELECT_7 OF Z" Select 7" ENDOF - IDM_SELECT_8 OF Z" Select 8" ENDOF - IDM_SELECT_9 OF Z" Select 9" ENDOF - IDM_SELECT_BLANK OF Z" Select blank" ENDOF - IDM_BACKWARD OF Z" Undo last move" ENDOF - IDM_FORWARD OF Z" Redo last move" ENDOF - IDM_PLUS OF Z" Make larger" ENDOF - IDM_MINUS OF Z" Make smaller" ENDOF - IDM_PAUSE OF Z" Start/stop timer" ENDOF - IDM_COLOUR_1 OF z" Text colour 1" ENDOF - IDM_COLOUR_2 OF z" Text colour 2" ENDOF - IDM_COLOUR_3 OF z" Text colour 3" ENDOF - IDM_COLOUR_4 OF z" Text colour 4" ENDOF - IDM_OPTIONS OF Z" Options dialog" ENDOF - ( default case ) Z" Undef" swap - EndCase - ;M - - :M Start: ( hParent) - Start: Super - \ Set-up registry key for customization data... - z" Software\Win32Forth\Sudoku\Options" \ Registry sub-key - z" ToolBarLayout" \ value key name - z" ToolBarLayoutDefault" \ value key name - SetRegistryKeys: self - 24 AddBitmaps: self - AddButtons: self - \ AddStrings: self - True to UseToolStringsInCustomize - True SaveRestoreDefault: self - False SaveRestore: self - ;M - - :M WM_RBUTTONDOWN ( h m w l -- res ) \ right click for context menu sent to frame window - swap rot HandleOfParent - Call SendMessage drop 0 - ;M - - :M WindowStyle: ( -- style ) - WS_CHILD \ not WS_VISIBLE - start hidden, not flat - TBSTYLE_TOOLTIPS or - CCS_ADJUSTABLE or - ;M - - :M On_ToolBarChange: ( -- f ) \ User has changed toolbar - false - ;M - - :M On_Reset: ( -- f ) \ User resets toolbar - false SaveRestore: self - true - ;M - - ;Object - - - 0 value ToolbarHeight - - : ShowToolbar ( -- ) GetWindowRect: SudokuToolbar nip swap - nip to ToolbarHeight - SW_SHOW show: SudokuToolbar true check: hToolbar ; - - : HideToolbar ( -- ) 0 to ToolbarHeight - SW_HIDE show: SudokuToolbar false check: hToolbar ; - - : CheckNumber ( n -- ) \ check nth number on toolbar, uncheck the rest - IDM_SELECT_BLANK + true CheckButton: SudokuToolBar ; --- 183,184 ---- |