From: <mie...@us...> - 2009-02-06 02:22:09
|
Revision: 4086 http://oorexx.svn.sourceforge.net/oorexx/?rev=4086&view=rev Author: miesfeld Date: 2009-02-06 01:31:45 +0000 (Fri, 06 Feb 2009) Log Message: ----------- Remove the DateTimePicker and MonthCalendar classes, remove the deprecated menu methods warning, add a warning in the Menu.cls file. The addition of these classes with be postponed until the next release. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/Menu.cls main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/dlgext.cls main/trunk/extensions/platform/windows/oodialog/resdlg.cls main/trunk/extensions/platform/windows/oodialog/userdlg.cls Modified: main/trunk/extensions/platform/windows/oodialog/Menu.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/Menu.cls 2009-02-06 01:21:46 UTC (rev 4085) +++ main/trunk/extensions/platform/windows/oodialog/Menu.cls 2009-02-06 01:31:45 UTC (rev 4086) @@ -43,10 +43,13 @@ */ -/** NOTES: - * If problems with resource ID return -1 - * If problems with dialog or hMenu return -2 +/** PLEASE NOTE: * + * The classes and methods in this file are purposively NOT DOCUMENTED. Do NOT + * use these classes or methods because the classes, methods, and / or arugments + * WILL CHANGE in the next release of ooRexx. If you do use these classes in + * your own code, you do so at you own risk. + * */ /* class: Menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-02-06 01:21:46 UTC (rev 4085) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-02-06 01:31:45 UTC (rev 4086) @@ -780,7 +780,7 @@ return HandleTreeCtrl("SORT", self~Hwnd, hitem, 0) /* recursive not yet supported */ --- This method is deprecated, use setImageList() +-- DEPRECATED ::method SetImages use arg bmp, cx, cy if arg(1, 'O') then return -1 @@ -788,7 +788,7 @@ if arg(3, 'O') then cy = 0 return HandleTreeCtrl("SETIMG",self~Hwnd, bmp, cx, cy) --- This method is deprecated, use setImageList() +-- DEPRECATED ::method RemoveImages return HandleTreeCtrl("UNSETIMG", self~Hwnd) @@ -1470,7 +1470,7 @@ ::method Focused return HandleOtherNewCtrls("TAB","FOCUS",self~Hwnd, "G") --- This method is deprecated, use setImageList() +-- DEPRECATED ::method SetImages use arg bmp, cx, cy if Arg(1,'o') = 1 then return -1 @@ -1478,7 +1478,7 @@ if Arg(3,'o') = 1 then cy = 0 return HandleOtherNewCtrls("TAB","SETIMG",self~Hwnd, bmp, cx, cy) --- This method is deprecated, use setImageList() +-- DEPRECATED ::method RemoveImages return HandleOtherNewCtrls("TAB","UNSETIMG",self~Hwnd) @@ -2076,67 +2076,3 @@ self~SetPos(pos) return pos - -::class 'DateTimePicker' subclass DialogControl public - - -::method getDateTime -- Get the currently selected date and time - return HandleDateTimePicker(self~hwnd, 'G', 'SYS') - -::method setDateTime - use strict arg hr = (time('N')~left(2)), min = (time('N')~substr(4, 5)), - - sec = (time('N')~substr(7,8)), ms = 0, dy = (date('S')~right(2)), - - mn = (date('S')~substr(5, 6)), yr = (date('S')~left(4)) - - return HandleDateTimePicker(self~hwnd, 'S', 'SYS', hr':'min':'sec'.'ms dy mn yr) - -::method clear - return HandleDateTimePicker(self~hwnd, 'S', 'SYS') - -::class 'MonthCalendar' subclass DialogControl public - -::method init - expose n2Day n2Month - - forward class (super) continue - - n2Day = .array~of('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', - - 'Friday', 'Saturday') - - n2Month = .array~of('January', 'February', 'March', 'April', 'May', 'June', - - 'July', 'August', 'September', 'October', 'November', - - 'December') - -::method getDate -- Get the currently selected date - expose n2Day n2Month - use arg format = 'COMPLETE' - - ans = HandleMonthCalendar(self~hwnd, 'G', 'CUR') - - select - when ans == 1 then ans = -1 - when format~caselessCompare('RAW') == 0 then nop - - when format~caselessCompare('NORMAL') == 0 then do - ans = ans~word(1) n2Month[ans~word(2)]~left(3) ans~word(3) - end - - when format~caselessCompare('COMPLETE') == 0 then do - ans = n2Day[ans~word(4) + 1] || ',' n2Month[ans~word(2)] ans~word(1) || ',' ans~word(3) - end - - otherwise ans = -1 - end - -- End select - - return ans - -::method usesUnicode - return HandleMonthCalendar(self~hwnd, 'G', "UNI") - - -::method setDate - use strict arg day, month, year = (date('S')~left(4)) - return HandleMonthCalendar(self~hwnd, 'S', 'CUR', day month year) - - Modified: main/trunk/extensions/platform/windows/oodialog/dlgext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-02-06 01:21:46 UTC (rev 4085) +++ main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-02-06 01:31:45 UTC (rev 4086) @@ -896,12 +896,9 @@ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ - These menu bar methods are needed to provide backward compatibility for the - deprecated menu methods. The ooDialog programmer is *strongly* discouraged - from using them. If the deprecated methods are removed, these will be removed - with them. + The menu methods in this block are purposively not documented. Do NOT use + them in your code. The WILL be removed from ooDialog in the future. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ - ::attribute menuBar get ::attribute menuBar set private @@ -918,11 +915,8 @@ menu = self~menuBar self~menuBar = .nil return menu +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ - The following menu bar methods are deprecated, instead, use the Menu classes - directly. -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ ::method enableMenuItem unguarded use strict arg id @@ -959,9 +953,6 @@ if self~menuBar == .nil then return -2 return self~menuBar~getState(id) -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ - End deprecated menu bar methods. -\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ /******************************************************************************/ /* New extensions */ Modified: main/trunk/extensions/platform/windows/oodialog/resdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/resdlg.cls 2009-02-06 01:21:46 UTC (rev 4085) +++ main/trunk/extensions/platform/windows/oodialog/resdlg.cls 2009-02-06 01:31:45 UTC (rev 4086) @@ -102,7 +102,6 @@ if self~bkgBitmap \= 0 then self~removeBitmap(self~bkgBitmap) return ret --- This method is deprecated, instead use the Menu classes directly. ::method setMenu use strict arg id menuBar = .BinaryMenuBar~new(self, id, self, 0, .true) Modified: main/trunk/extensions/platform/windows/oodialog/userdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/userdlg.cls 2009-02-06 01:21:46 UTC (rev 4085) +++ main/trunk/extensions/platform/windows/oodialog/userdlg.cls 2009-02-06 01:31:45 UTC (rev 4086) @@ -71,8 +71,7 @@ return ret /******************************************************************************/ -/* Menu/Action bar. These methods are deprecated, instead, use the Menu */ -/* classes directly. */ +/* Menu/Action bar methods. */ ::method SetMenu menuBar = self~menuBar This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-02-16 22:26:28
|
Revision: 4182 http://oorexx.svn.sourceforge.net/oorexx/?rev=4182&view=rev Author: miesfeld Date: 2009-02-16 22:26:24 +0000 (Mon, 16 Feb 2009) Log Message: ----------- [ 2607013 ] ooDialog - the createFont() method is broken This commit adds a createFontEx() method that returns the correct logical font for the specified font characteristics. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/basedlg.cls main/trunk/extensions/platform/windows/oodialog/oodialog.mak main/trunk/extensions/platform/windows/oodialog/oovother.cpp main/trunk/extensions/platform/windows/oodialog/oovtext.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.cpp Modified: main/trunk/extensions/platform/windows/oodialog/basedlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/basedlg.cls 2009-02-16 22:12:59 UTC (rev 4181) +++ main/trunk/extensions/platform/windows/oodialog/basedlg.cls 2009-02-16 22:26:24 UTC (rev 4182) @@ -170,13 +170,10 @@ ::method Cursor_Wait unguarded return Wnd_Desktop("CURSOR", self~hwnd, "S", 32514) -::method CreateFont unguarded - use arg fontName, fontSize, fontStyle, fontWidth - if Arg(1, "o") = 1 then fontName = "System" - if Arg(2, "o") = 1 then fontSize = 10 - if Arg(3, "o") = 1 then fontStyle = "" - if Arg(4, "o") = 1 then fontWidth = fontSize - return HandleFont("CREATE", fontName, fontSize, fontStyle, fontWidth) +-- CreateFont() has always been broken, maintained for program compatibility. +-- CreateFontEx() is a correct implementation. +::method CreateFont unguarded external "LIBRARY oodialog winex_createFont" +::method createFontEx unguarded external "LIBRARY oodialog winex_createFontEx" /* Deletes a font */ ::method DeleteFont unguarded Modified: main/trunk/extensions/platform/windows/oodialog/oodialog.mak =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodialog.mak 2009-02-16 22:12:59 UTC (rev 4181) +++ main/trunk/extensions/platform/windows/oodialog/oodialog.mak 2009-02-16 22:26:24 UTC (rev 4182) @@ -75,6 +75,7 @@ WINMM.LIB \ COMDLG32.LIB \ COMCTL32.LIB \ + shlwapi.lib \ -def:$(OR_OODIALOGSRC)\oovutil.def \ -out:$(OR_OUTDIR)\$(@B).dll Modified: main/trunk/extensions/platform/windows/oodialog/oovother.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-02-16 22:12:59 UTC (rev 4181) +++ main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-02-16 22:26:24 UTC (rev 4182) @@ -4248,7 +4248,231 @@ return 0; } +bool rxLogicalFromDirectory(RexxMethodContext *context, RexxDirectoryObject d, CSTRING index, + BOOL *logical, int argPos) +{ + logical_t value; + RexxObjectPtr obj = context->DirectoryAt(d, index); + if ( obj != NULLOBJECT ) + { + if ( ! context->Logical(obj, &value) ) + { + wrongObjInDirectoryException(context, argPos, index, "logical"); + return false; + } + *logical = (BOOL)value; + } + return true; +} +bool rxNumberFromDirectory(RexxMethodContext *context, RexxDirectoryObject d, CSTRING index, + DWORD *number, int argPos) +{ + DWORD value; + RexxObjectPtr obj = context->DirectoryAt(d, index); + if ( obj != NULLOBJECT ) + { + if ( ! context->UnsignedInt32(obj, (uint32_t*)&value) ) + { + wrongObjInDirectoryException(context, argPos, index, "number"); + return false; + } + *number = value; + } + return true; +} + +extern int getWeight(CSTRING opts); + +/** WindowExtensions::createFont() + * + * Creates a logical font with the specified characteristics. + * + * This implementation is broken. It is the original ooDialog implementation. + * It incorrectly maps the point size to the font height and it defaults the + * average character width to the point size. + * + * It is maintained "as is" for program compatibility. + * + * @param fontName Optional. The typeface name. The default is System. + * + * @param fSize Optional. The point size of the font. The default is 10. + * + * @param fontStyle Optional. A string containing 0 or more of the style + * keywords separated by blanks. The default is a + * normal font style. + * + * @param fWidth Optional. The average character width. The default is the + * point size. + * + * @note The most broken thing with this implementation is defaulting the + * average character width to the point size. Using a 0 for fWidth + * rather than omitting the argument will fix this. 0 causes the font + * mapper to pick the best font that matches the height. + * + */ +RexxMethod4(POINTERSTRING, winex_createFont, OPTIONAL_CSTRING, fontName, OPTIONAL_CSTRING, fSize, + OPTIONAL_CSTRING, fontStyle, OPTIONAL_CSTRING, fWidth) +{ + if ( argumentOmitted(1) ) + { + fontName = "System"; + } + + int fontSize = 10; + if ( argumentExists(2) ) + { + fontSize = atoi(fSize); + } + + int fontWidth = fontSize; + if ( argumentExists(4) ) + { + fontWidth = atoi(fWidth); + } + + int weight = FW_NORMAL; + BOOL italic = FALSE; + BOOL underline = FALSE; + BOOL strikeout = FALSE; + + if ( argumentExists(3) ) + { + italic = StrStrI(fontStyle, "ITALIC") != NULL; + underline = StrStrI(fontStyle, "UNDERLINE") != NULL; + strikeout = StrStrI(fontStyle, "STRIKEOUT") != NULL; + weight = getWeight(fontStyle); + } + + HFONT hFont = CreateFont(fontSize, fontWidth, 0, 0, weight, italic, underline, strikeout, + DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, + DEFAULT_QUALITY, FF_DONTCARE, fontName); + return hFont; +} + +/** WindowExtensions::createFontEx() + * + * Creates a logical font with the specified characteristics. + * + * This is a correct implementation of createFont() and should be used as a + * replacement for that method. In addition it extends createFont() by giving + * the ooRexx progammer access to all of the options of the CreateFont API. + * + * @param fontName Required. The typeface name. + * + * @param fontSize Optional. The point size of the font, the default is 8. + * + * @param args Optional. A .Directory object whose indexes can contain + * over-rides for the default values of all other + * arguments to CreateFont. + * + * @return Handle to the logical font. On error, a null handle is returned + * and the ooDialog System error code (.SystemErrorCode) is set. + * + * @note All the 'other' arguments to CreateFont() have a default value. If + * the args Directory object has no index for a value, the default is + * used. If the Directory object does have the index, then the value + * of the index is used for that arg. + */ +RexxMethod4(POINTERSTRING, winex_createFontEx, CSTRING, fontName, OPTIONAL_int, fontSize, + OPTIONAL_RexxObjectPtr, args, OSELF, self) +{ + int width = 0; // average character width + int escapement = 0; // angle of escapement + int orientation = 0; // base-line orientation angle + int weight = FW_NORMAL; // font weight + BOOL italic = FALSE; // italic attribute option + BOOL underline = FALSE; // underline attribute option + BOOL strikeOut = FALSE; // strikeout attribute option + DWORD charSet = DEFAULT_CHARSET; // character set identifier + DWORD outputPrecision = OUT_TT_PRECIS; // output precision + DWORD clipPrecision = CLIP_DEFAULT_PRECIS; // clipping precision + DWORD quality = DEFAULT_QUALITY; // output quality + DWORD pitchAndFamily = FF_DONTCARE; // pitch and family + + oodSetSysErrCode(context, 0); + + if ( argumentOmitted(2) ) + { + fontSize = 8; + } + + HDC hdc = CreateDC("DISPLAY", NULL, NULL, NULL); + int height = -MulDiv(fontSize, GetDeviceCaps(hdc, LOGPIXELSY), 72); + DeleteDC(hdc); + + if ( argumentExists(3) ) + { + if ( ! context->IsDirectory(args) ) + { + wrongClassException(context, 3, "Directory"); + goto error_out; + } + RexxDirectoryObject d = (RexxDirectoryObject)args; + + if ( ! rxNumberFromDirectory(context, d, "WIDTH", (DWORD *)&width, 3) ) + { + goto error_out; + } + if ( ! rxNumberFromDirectory(context, d, "ESCAPEMENT", (DWORD *)&escapement, 3) ) + { + goto error_out; + } + if ( ! rxNumberFromDirectory(context, d, "ORIENTATION", (DWORD *)&orientation, 3) ) + { + goto error_out; + } + if ( ! rxNumberFromDirectory(context, d, "WEIGHT", (DWORD *)&weight, 3) ) + { + goto error_out; + } + if ( ! rxLogicalFromDirectory(context, d, "ITALIC", &italic, 3) ) + { + goto error_out; + } + if ( ! rxLogicalFromDirectory(context, d, "UNDERLINE", &underline, 3) ) + { + goto error_out; + } + if ( ! rxLogicalFromDirectory(context, d, "STRIKEOUT", &strikeOut, 3) ) + { + goto error_out; + } + if ( ! rxNumberFromDirectory(context, d, "CHARSET", &charSet, 3) ) + { + goto error_out; + } + if ( ! rxNumberFromDirectory(context, d, "OUTPUTPRECISION", &outputPrecision, 3) ) + { + goto error_out; + } + if ( ! rxNumberFromDirectory(context, d, "CLIPPRECISION", &clipPrecision, 3) ) + { + goto error_out; + } + if ( ! rxNumberFromDirectory(context, d, "QUALITY", &quality, 3) ) + { + goto error_out; + } + if ( ! rxNumberFromDirectory(context, d, "PITCHANDFAMILY", &pitchAndFamily, 3) ) + { + goto error_out; + } + } + + HFONT font = CreateFont(height, width, escapement, orientation, weight, italic, underline, strikeOut, + charSet, outputPrecision, clipPrecision, quality, pitchAndFamily, fontName); + + if ( font == NULL ) + { + oodSetSysErrCode(context); + } + return font; + +error_out: + return NULLOBJECT; +} + /** * Methods for the .DialogControl class. */ Modified: main/trunk/extensions/platform/windows/oodialog/oovtext.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovtext.cpp 2009-02-16 22:12:59 UTC (rev 4181) +++ main/trunk/extensions/platform/windows/oodialog/oovtext.cpp 2009-02-16 22:26:24 UTC (rev 4182) @@ -36,6 +36,7 @@ /* */ /*----------------------------------------------------------------------------*/ #include <windows.h> +#include <shlwapi.h> #include <rexx.h> #include <stdio.h> #include <dlgs.h> @@ -52,17 +53,20 @@ ULONG TimerCount = 0; ULONG_PTR Timer = 0; -#define GETWEIGHT(opts, weight) \ - if (strstr(opts, "THIN")) weight = FW_THIN; else \ - if (strstr(opts, "EXTRALIGHT")) weight = FW_EXTRALIGHT; else \ - if (strstr(opts, "LIGHT")) weight = FW_LIGHT; else \ - if (strstr(opts, "MEDIUM")) weight = FW_MEDIUM; else \ - if (strstr(opts, "SEMIBOLD")) weight = FW_SEMIBOLD; else \ - if (strstr(opts, "EXTRABOLD")) weight = FW_EXTRABOLD; else \ - if (strstr(opts, "BOLD")) weight = FW_BOLD; else \ - if (strstr(opts, "HEAVY")) weight = FW_HEAVY; else \ - weight = FW_NORMAL; +int getWeight(CSTRING opts) +{ + int weight = FW_NORMAL; + if (StrStrI(opts, "THIN")) weight = FW_THIN; else + if (StrStrI(opts, "EXTRALIGHT")) weight = FW_EXTRALIGHT; else + if (StrStrI(opts, "LIGHT")) weight = FW_LIGHT; else + if (StrStrI(opts, "MEDIUM")) weight = FW_MEDIUM; else + if (StrStrI(opts, "SEMIBOLD")) weight = FW_SEMIBOLD; else + if (StrStrI(opts, "EXTRABOLD")) weight = FW_EXTRABOLD; else + if (StrStrI(opts, "BOLD")) weight = FW_BOLD; else + if (StrStrI(opts, "HEAVY")) weight = FW_HEAVY; + return weight; +} void DrawFontToDC(HDC hDC, INT x, INT y, const char * text, INT size, const char * opts, const char * fontn, INT fgColor, INT bkColor) @@ -71,7 +75,7 @@ INT weight, oldMode=0; COLORREF oldFg, oldBk; - GETWEIGHT(opts, weight) + weight = getWeight(opts); hFont = CreateFont(size, size, 0, 0, weight, strstr(opts, "ITALIC") != 0, strstr(opts, "UNDERLINE") != 0, strstr(opts, "STRIKEOUT") != 0, DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, fontn); @@ -186,7 +190,7 @@ { GetWindowRect(w, &r); - GETWEIGHT(opts, weight) + weight = getWeight(opts); hFont = CreateFont(size, size, 0, 0, weight, strstr(opts, "ITALIC") != NULL, strstr(opts, "UNDERLINE") != NULL, strstr(opts, "STRIKEOUT") != NULL, DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, DRAFT_QUALITY, FF_DONTCARE, argv[3].strptr); @@ -314,31 +318,3 @@ RETC(1); } - - -size_t RexxEntry HandleFont(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) -{ - CHECKARG(5); - - if ( !strcmp(argv[0].strptr, "CREATE") ) - { - HFONT hFont; - INT weight; - - GETWEIGHT(argv[3].strptr, weight) - - hFont = CreateFont(atoi(argv[2].strptr), atoi(argv[4].strptr), 0, 0, weight, - strstr(argv[3].strptr, "ITALIC") != NULL, - strstr(argv[3].strptr, "UNDERLINE") != NULL, - strstr(argv[3].strptr, "STRIKEOUT") != NULL, - DEFAULT_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, - DEFAULT_QUALITY, FF_DONTCARE, argv[1].strptr); - - if ( hFont ) - { - RETHANDLE(hFont); - } - RETC(0); - } - RETC(1); -} Modified: main/trunk/extensions/platform/windows/oodialog/oovutil.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-02-16 22:12:59 UTC (rev 4181) +++ main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-02-16 22:26:24 UTC (rev 4182) @@ -1988,7 +1988,6 @@ REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleMonthCalendar); REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDateTimePicker); REXX_CLASSIC_ROUTINE_PROTOTYPE(WinTimer); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleFont); REXX_CLASSIC_ROUTINE_PROTOTYPE(DumpAdmin); REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrAddControl); REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrCreateDialog); @@ -2054,7 +2053,6 @@ REXX_CLASSIC_ROUTINE(HandleMonthCalendar, HandleMonthCalendar), REXX_CLASSIC_ROUTINE(HandleDateTimePicker, HandleDateTimePicker), REXX_CLASSIC_ROUTINE(WinTimer, WinTimer), - REXX_CLASSIC_ROUTINE(HandleFont, HandleFont), REXX_CLASSIC_ROUTINE(DumpAdmin, DumpAdmin), REXX_CLASSIC_ROUTINE(UsrAddControl, UsrAddControl), REXX_CLASSIC_ROUTINE(UsrCreateDialog, UsrCreateDialog), @@ -2098,6 +2096,8 @@ REXX_METHOD_PROTOTYPE(winex_getTextSizeScreen); REXX_METHOD_PROTOTYPE(winex_getFont); REXX_METHOD_PROTOTYPE(winex_setFont); +REXX_METHOD_PROTOTYPE(winex_createFontEx); +REXX_METHOD_PROTOTYPE(winex_createFont); REXX_METHOD_PROTOTYPE(ri_init); REXX_METHOD_PROTOTYPE(ri_release); @@ -2249,6 +2249,8 @@ REXX_METHOD(winex_getTextSizeScreen, winex_getTextSizeScreen), REXX_METHOD(winex_getFont, winex_getFont), REXX_METHOD(winex_setFont, winex_setFont), + REXX_METHOD(winex_createFontEx, winex_createFontEx), + REXX_METHOD(winex_createFont, winex_createFont), REXX_METHOD(ri_init, ri_init), REXX_METHOD(ri_release, ri_release), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-03-01 04:58:08
|
Revision: 4232 http://oorexx.svn.sourceforge.net/oorexx/?rev=4232&view=rev Author: miesfeld Date: 2009-03-01 04:58:03 +0000 (Sun, 01 Mar 2009) Log Message: ----------- This commit allows the setImageList() methods to accept a single bitmap, which is then used internally to create the image list. This is less flexible on the ooRexx side, but maybe easier to code for the ooDialog programmer. It also allows the pre-4.0 code for some deprecated methods to be removed completely. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/oovother.cpp Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-03-01 00:48:00 UTC (rev 4231) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-03-01 04:58:03 UTC (rev 4232) @@ -781,16 +781,11 @@ -- DEPRECATED -::method SetImages - use arg bmp, cx, cy - if arg(1, 'O') then return -1 - if arg(2, 'O') then cx = 0 - if arg(3, 'O') then cy = 0 - return HandleTreeCtrl("SETIMG",self~Hwnd, bmp, cx, cy) +::method setImages external "LIBRARY oodialog tv_setImageList" -- DEPRECATED -::method RemoveImages - return HandleTreeCtrl("UNSETIMG", self~Hwnd) +::method removeImages + return self~setImageList(.nil, 0) ::method setImageList external "LIBRARY oodialog tv_setImageList" ::method getImageList external "LIBRARY oodialog tv_getImageList" @@ -1145,28 +1140,18 @@ return HandleListCtrl("M", "ENVIS", self~Hwnd, item, partial) -- DEPRECATED -::method SetSmallImages - use arg bmp, cx, cy - if Arg(1,'o') = 1 then return -1 - if Arg(2,'o') = 1 then cx = 0 - if Arg(3,'o') = 1 then cy = 0 - return HandleListCtrl("I", "SETIMG",self~Hwnd, bmp, cx, cy, "SMALL") +::method setSmallImages external "LIBRARY oodialog lv_setImageList" -- DEPRECATED -::method SetImages - use arg bmp, cx, cy - if Arg(1,'o') = 1 then return -1 - if Arg(2,'o') = 1 then cx = 0 - if Arg(3,'o') = 1 then cy = 0 - return HandleListCtrl("I", "SETIMG",self~Hwnd, bmp, cx, cy, "") +::method setImages external "LIBRARY oodialog lv_setImageList" -- DEPRECATED ::method RemoveSmallImages - return HandleListCtrl("I", "UNSETIMG", self~Hwnd, "SMALL") + return self~removeImageList(.nil, 1) -- DEPRECATED ::method RemoveImages - return HandleListCtrl("I", "UNSETIMG", self~Hwnd, "") + return self~removeImageList(.nil, 0) ::method setImageList external "LIBRARY oodialog lv_setImageList" ::method getImageList external "LIBRARY oodialog lv_getImageList" @@ -1471,16 +1456,11 @@ return HandleOtherNewCtrls("TAB","FOCUS",self~Hwnd, "G") -- DEPRECATED -::method SetImages - use arg bmp, cx, cy - if Arg(1,'o') = 1 then return -1 - if Arg(2,'o') = 1 then cx = 0 - if Arg(3,'o') = 1 then cy = 0 - return HandleOtherNewCtrls("TAB","SETIMG",self~Hwnd, bmp, cx, cy) +::method setImages external "LIBRARY oodialog tab_setImageList" -- DEPRECATED ::method RemoveImages - return HandleOtherNewCtrls("TAB","UNSETIMG",self~Hwnd) + return self~setImageList(.nil) ::method setImageList external "LIBRARY oodialog tab_setImageList" ::method getImageList external "LIBRARY oodialog tab_getImageList" Modified: main/trunk/extensions/platform/windows/oodialog/oovother.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-03-01 00:48:00 UTC (rev 4231) +++ main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-03-01 04:58:03 UTC (rev 4232) @@ -459,82 +459,6 @@ } -HIMAGELIST CreateImageList(INT start, HWND h, CONSTRXSTRING *argv, size_t argc) -{ - HBITMAP hBmp = NULL; - HIMAGELIST iL; - INT cx,cy, nr; - BITMAP bmpInfo; - HDC dc; - bool callerOwnsHandle = false; - - // See if the user passed in the handle to an already loaded bitmap. - hBmp = (HBITMAP)GET_HANDLE(argv[start]); - - if ( hBmp != NULL ) - { - // This tests if the bitmap has is already converted to a compatible - // bitmap (DDB.) If GetObject() returns 0, it is still device - // independent (DIB) and needs to be converted. - if ( GetObject(hBmp, sizeof(BITMAP), &bmpInfo) == 0 ) - { - dc = GetDC(h); - hBmp = CreateDIBitmap(dc, (BITMAPINFOHEADER*)hBmp, CBM_INIT, DIB_PBITS(hBmp), - DIB_PBI(hBmp), DIB_RGB_COLORS); - ReleaseDC(h, dc); - } - else - { - // The caller owns this handle and we should not release it. - callerOwnsHandle = true; - } - } - else - { - // Not a handle, assume it is a file name and try to load the bitmap - LPBITMAPINFO lpBit = LoadDIB(argv[start].strptr); - if ( lpBit ) - { - // Okay, convert the DIB to a DDB. - dc = GetDC(h); - hBmp = CreateDIBitmap(dc, (BITMAPINFOHEADER*)lpBit, CBM_INIT, DIB_PBITS(lpBit), - DIB_PBI(lpBit), DIB_RGB_COLORS); - ReleaseDC(h, dc); - LocalFree((void *)lpBit); - } - } - - if ( ! hBmp ) - { - return NULL; - } - - cx = atoi(argv[start+1].strptr); - cy = atoi(argv[start+2].strptr); - - GetObject(hBmp, sizeof(BITMAP), &bmpInfo); - - // The height is correct in the structure, the width is the sum of the - // widths of all the bitmaps, so it is not necessarily correct. - if ( !cx ) cx = bmpInfo.bmHeight; - if ( !cy ) cy = bmpInfo.bmHeight; - nr = bmpInfo.bmWidth / cx; - - iL = ImageList_Create(cx, cy, ILC_COLOR8, nr, 0); - - if ( ImageList_Add(iL, hBmp, NULL) == -1 ) - { - ImageList_Destroy(iL); - return NULL; - } - - if ( ! callerOwnsHandle ) - { - DeleteObject(hBmp); - } - return iL; -} - /** * This is the window procedure used to subclass the edit control for both the * ListControl and TreeControl objects. It would be nice to convert this to use @@ -901,28 +825,6 @@ RETC(!TreeView_SortChildren(h, (HTREEITEM)hItem, IsYes(argv[3].strptr))) } else - if (!strcmp(argv[0].strptr, "SETIMG")) - { - HIMAGELIST iL; - - CHECKARG(5); - iL = CreateImageList(2, h, argv, argc); - - if (iL) RETHANDLE(TreeView_SetImageList(h, iL, TVSIL_NORMAL)) - else RETC(0) - } - else - if (!strcmp(argv[0].strptr, "UNSETIMG")) - { - HIMAGELIST iL; - - iL = TreeView_GetImageList(h, TVSIL_NORMAL); - if (!iL) RETC(1) - TreeView_SetImageList(h, 0, TVSIL_NORMAL); - - RETC(!ImageList_Destroy( iL)) - } - else if (!strcmp(argv[0].strptr, "SUBCL_EDIT")) { HWND ew = TreeView_GetEditControl(h); @@ -1863,37 +1765,6 @@ RETVAL(ListView_GetNextItem(h, startItem, flag)) } else - if (!strcmp(argv[1].strptr, "SETIMG")) - { - HIMAGELIST iL; - WORD ilt; - - CHECKARG(7); - iL = CreateImageList(3, h, argv, argc); - - if (!strcmp(argv[6].strptr,"SMALL")) ilt = LVSIL_SMALL; - else ilt = LVSIL_NORMAL; - - if (iL) RETHANDLE(ListView_SetImageList(h, iL, ilt)) - else RETC(0) - } - else - if (!strcmp(argv[1].strptr, "UNSETIMG")) - { - HIMAGELIST iL; - WORD ilt; - - CHECKARG(4); - if (!strcmp(argv[3].strptr,"SMALL")) ilt = LVSIL_SMALL; - else ilt = LVSIL_NORMAL; - - iL = ListView_GetImageList(h, ilt); - if (!iL) RETC(1) - ListView_SetImageList(h, 0, ilt); - - RETC(!ImageList_Destroy( iL)) - } - else if (!strcmp(argv[1].strptr, "FIND")) { LONG startItem; @@ -2481,25 +2352,6 @@ { RETVAL(TabCtrl_GetRowCount(h)) } - else if (!strcmp(argv[1].strptr, "SETIMG")) - { - HIMAGELIST iL; - - CHECKARG(6); - iL = CreateImageList(3, h, argv, argc); - if (iL) RETHANDLE(TabCtrl_SetImageList(h, iL)) - else RETC(0) - } - else if (!strcmp(argv[1].strptr, "UNSETIMG")) - { - HIMAGELIST iL; - - iL = TabCtrl_GetImageList(h); - if (!iL) RETC(1) - TabCtrl_SetImageList(h, NULL); - - RETC(!ImageList_Destroy( iL)) - } else if (!strcmp(argv[1].strptr, "PADDING")) { CHECKARG(5); @@ -4923,42 +4775,227 @@ } } +/** + * Creates a Windows ImageList and the corresponding ooDialog .ImageList object + * from a single bitmap. + * + * The Windows ImageList supports adding any number of images from a single + * bitmap. The individual images are assumed to be side-by-side in the bitmap. + * The number of images is determined by the width of a single image. + * + * At this time, this function is used to allow the ooDialog programmer to + * assign an image list to a dialog control by just passing in a bitmap, rather + * than first creating an .ImageList object. This is much less flexible, but + * allows the programmer to write fewer lines of code. In addition, it mimics + * the behavior of pre-4.0 code allowing that code to be removed. + * + * @param c The method context we are operating in. + * @param himl [in / out] The created handle of the ImageList is returned. + * @param ilSrc The bitmap. + * @param width [optional] The width of a single image. When omitted, the + * height of the actual bitmap is used for the width. + * @param height [optional] The height of a single image. If omitted the + * height of the actual bitmap is used. + * @param hwnd The window handle of the control. Used to create a device + * context if needed. + * + * @return An instantiated .ImageList object on success, or NULLOBJECT on + * failure. + * + * @note These objects are accepted for the image list source (ilSrc): .Image + * object, a bitmap file name, a bitmap handle. A bitmap handle can be + * either a pointer string, or a .Pointer object. The bitmap handle is + * needed to provide backward compatibility, but its use is discouraged. + * + * @note This function needs to support the original ooDialog design where + * bitmaps were loaded as DIBs. If the image list source is a handle, + * GetObject() is used to test if the bitmap is a compatible bitmap (DDB.) + * If GetObject() returns 0, it is still a device independent (DIB) and + * needs to be converted to a device dependent bitmap. + */ +RexxObjectPtr rxILFromBMP(RexxMethodContext *c, HIMAGELIST *himl, RexxObjectPtr ilSrc, + int width, int height, HWND hwnd) +{ + HBITMAP hDDB = NULL; + RexxObjectPtr imageList = NULLOBJECT; + bool canRelease = false; + BITMAP bmpInfo; + + if ( c->IsOfType(ilSrc, "Image") ) + { + POODIMAGE oi = rxGetImageBitmap(c, ilSrc, 1); + if ( oi == NULLOBJECT ) + { + goto done_out; + } + hDDB = (HBITMAP)oi->hImage; + } + else if ( c->IsString(ilSrc) || c->IsPointer(ilSrc) ) + { + CSTRING bitmap = c->ObjectToStringValue(ilSrc); + + // See if the user passed in the handle to an already loaded bitmap. + hDDB = (HBITMAP)GET_HANDLE(bitmap); + if ( hDDB != NULL ) + { + // + if ( GetObject(hDDB, sizeof(BITMAP), &bmpInfo) == 0 ) + { + HDC dc = GetDC(hwnd); + hDDB = CreateDIBitmap(dc, (BITMAPINFOHEADER*)hDDB, CBM_INIT, DIB_PBITS(hDDB), + DIB_PBI(hDDB), DIB_RGB_COLORS); + if ( hDDB == NULL ) + { + oodSetSysErrCode(c); + ReleaseDC(hwnd, dc); + goto done_out; + } + ReleaseDC(hwnd, dc); + canRelease = true; + } + } + else + { + hDDB = (HBITMAP)LoadImage(NULL, bitmap, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE); + if ( hDDB == NULL ) + { + oodSetSysErrCode(c); + goto done_out; + } + canRelease = true; + } + } + else + { + wrongArgValueException(c, 1, "ImageList, Image, bitmap file name, bitmap handle", ilSrc); + goto done_out; + } + + if ( GetObject(hDDB, sizeof(BITMAP), &bmpInfo) == sizeof(BITMAP) ) + { + if ( width == 0 ) + { + width = bmpInfo.bmHeight; + } + if ( height == 0 ) + { + height = bmpInfo.bmHeight; + } + int count = bmpInfo.bmWidth / width; + + HIMAGELIST il = ImageList_Create(width, height, ILC_COLOR8, count, 0); + if ( il != NULL ) + { + if ( ImageList_Add(il, hDDB, NULL) == -1 ) + { + ImageList_Destroy(il); + goto done_out; + } + + imageList = rxNewImageList(c, il); + *himl = il; + } + } + +done_out: + if ( hDDB && canRelease ) + { + DeleteObject(hDDB); + } + return imageList; +} + + /** ListControl::setImageList() * * Sets or removes one of a list-view's image lists. * - * @param imageList An .ImageList object that references the image list to be - * set, or .nil. If .nil, an existing image list, if any is - * removed. + * @param ilSrc The image list source. Either an .ImageList object that + * references the image list to be set, or a single bitmap from + * which the image list is constructed, or .nil. If ilSRC is + * .nil, an existing image list, if any is removed. * - * @param type One of the list-view image list types and specifies which - * image list we are concerned with, normal, small or state. + * @param width [optional] This arg serves two purposes. If ilSrc is .nil or + * an .ImageList object, this arg indentifies which of the + * list-views image lists is being set, normal, small, or state. + * The default is LVSI_NORMAL. * - * @return Returns the exsiting .ImageList object if there is one, or - * .nil if there is not an existing object. + * If ilSrc is a bitmap, then this arg is the width of a single + * image. The default is the height of the actual bitmap. * + * @param height [optional] This arg is only used if ilSrc is a bitmap, in which case it + * is the height of the bitmap. The default is the height of the + * actual bitmap + * + * @return Returns the exsiting .ImageList object if there is one, or + * .nil if there is not an existing object. + * + * @note When the ilSrc is a single bitmap, an image list is created from the + * bitmap. This method is not as flexible as if the programmer created + * the image list herself. The bitmap must be a number of images, all + * the same size, side-by-side in the bitmap. The width of a single + * image determines the number of images. The image list is created + * using the ILC_COLOR8 flag, only. No mask can be used. No room is + * reserved for adding more images to the image list, etc.. + * + * The image list can only be assigned to the small or normal image + * list. There is no way to use the image list for the state image + * list. Whether the image list is assigned as the small or normal + * image list is determined by a guess, based on the size of the images. + * */ -RexxMethod3(RexxObjectPtr, lv_setImageList, RexxObjectPtr, imageList, OPTIONAL_uint8_t, type, OSELF, self) +RexxMethod4(RexxObjectPtr, lv_setImageList, RexxObjectPtr, ilSrc, + OPTIONAL_int32_t, width, OPTIONAL_int32_t, height, OSELF, self) { HWND hwnd = rxGetWindowHandle(context, self); + oodSetSysErrCode(context, 0); HIMAGELIST himl = NULL; + RexxObjectPtr imageList = NULL; + int type = LVSIL_NORMAL; - if ( imageList != context->Nil() ) + if ( ilSrc == context->Nil() ) { - // imageList is not .nil, so it has to be a .ImageList, or error. + imageList = ilSrc; + if ( argumentExists(2) ) + { + type = width; + } + } + else if ( context->IsOfType(ilSrc, "ImageList") ) + { + imageList = ilSrc; himl = rxGetImageList(context, imageList, 1); if ( himl == NULL ) { goto err_out; } + + if ( argumentExists(2) ) + { + type = width; + } } + else + { + imageList = rxILFromBMP(context, &himl, ilSrc, width, height, hwnd); + if ( imageList == NULLOBJECT ) + { + goto err_out; + } - if ( argumentOmitted(2) ) - { - type = LVSIL_NORMAL; + // Get the actual width and height from the image list. + ImageList_GetIconSize(himl, &width, &height); + + // Guess if this is for the small icons. If the actuall icon size is + // too much bigger than the system size for small icons, the icon will + // be clipped in the view, or will not be used at all. Assume the + // programmer does not intend to do this. Arbitrarily say that 'too + // much' is 5 pixels. Note we don't do state images here. + type = (width <= (GetSystemMetrics(SM_CXSMICON) + 5)) ? LVSIL_SMALL : LVSIL_NORMAL; } - else if ( type > LVSIL_STATE ) + + if ( type > LVSIL_STATE ) { wrongRangeException(context, 2, LVSIL_NORMAL, LVSIL_STATE, type); goto err_out; @@ -5128,39 +5165,78 @@ * * Sets or removes one of a tree-view's image lists. * - * @param imageList An .ImageList object that references the image list to be - * set, or .nil. If .nil, an existing image list, if any, is - * removed. + * @param ilSrc The image list source. Either an .ImageList object that + * references the image list to be set, or a single bitmap from + * which the image list is constructed, or .nil. If ilSRC is + * .nil, an existing image list, if any is removed. * - * @param type [optional] One of the tree-view image list types and - * specifies which image list we are concerned with, normal, - * or state. The default is normal. + * @param width [optional] This arg serves two purposes. If ilSrc is .nil or + * an .ImageList object, this arg indentifies which of the + * tree-views image lists is being set, normal, or state. The + * default is TVSI_NORMAL. * - * @return Returns the exsiting .ImageList object if there is one, or - * .nil if there is not an existing object. + * If ilSrc is a bitmap, then this arg is the width of a single + * image. The default is the height of the actual bitmap. * + * @param height [optional] This arg is only used if ilSrc is a bitmap, in which case it + * is the height of the bitmap. The default is the height of the + * actual bitmap + * + * @return Returns the exsiting .ImageList object if there is one, or + * .nil if there is not an existing object. + * + * @note When the ilSrc is a single bitmap, an image list is created from the + * bitmap. This method is not as flexible as if the programmer created + * the image list herself. The bitmap must be a number of images, all + * the same size, side-by-side in the bitmap. The width of a single + * image determines the number of images. The image list is created + * using the ILC_COLOR8 flag, only. No mask can be used. No room is + * reserved for adding more images to the image list, etc.. + * + * The image list can only be assigned to the normal image list. There + * is no way to use the image list for the state image list. */ -RexxMethod3(RexxObjectPtr, tv_setImageList, RexxObjectPtr, imageList, OPTIONAL_uint8_t, type, OSELF, self) +RexxMethod4(RexxObjectPtr, tv_setImageList, RexxObjectPtr, ilSrc, + OPTIONAL_int32_t, width, OPTIONAL_int32_t, height, OSELF, self) { HWND hwnd = rxGetWindowHandle(context, self); + oodSetSysErrCode(context, 0); HIMAGELIST himl = NULL; + int type = TVSIL_NORMAL; + RexxObjectPtr imageList = NULLOBJECT; - if ( imageList != context->Nil() ) + if ( ilSrc == context->Nil() ) { - // imageList is not .nil, so it has to be a .ImageList, or error. + imageList = ilSrc; + if ( argumentExists(2) ) + { + type = width; + } + } + else if ( context->IsOfType(ilSrc, "ImageList") ) + { + imageList = ilSrc; himl = rxGetImageList(context, imageList, 1); if ( himl == NULL ) { goto err_out; } + if ( argumentExists(2) ) + { + type = width; + } } - - if ( argumentOmitted(2) ) + else { - type = TVSIL_NORMAL; + imageList = rxILFromBMP(context, &himl, ilSrc, width, height, hwnd); + if ( imageList == NULLOBJECT ) + { + goto err_out; + } } - else if ( type != TVSIL_STATE && type != TVSIL_NORMAL ) + + if ( type != TVSIL_STATE && type != TVSIL_NORMAL ) { invalidTypeException(context, 2, "TVSIL_XXX flag"); goto err_out; @@ -5214,27 +5290,61 @@ * * Sets or removes the image list for a Tab control. * - * @param imageList An .ImageList object that references the image list to be - * set, or .nil. If .nil, an existing image list, if any, is - * removed. + * @param ilSrc The image list source. Either an .ImageList object that + * references the image list to be set, or a single bitmap from + * which the image list is constructed, or .nil. If ilSRC is + * .nil, an existing image list, if any is removed. * - * @return Returns the exsiting .ImageList object, or .nil if there - * is not an existing object. + * @param width [optional] This arg is only used if ilSrc is a single bitmap. + * Then this arg is the width of a single image. The default is + * the height of the actual bitmap. + * + * @param height [optional] This arg is only used if ilSrc is a bitmap, in + * which case it is the height of the bitmap. The default is the + * height of the actual bitmap + * + * @return Returns the exsiting .ImageList object if there is one, or + * .nil if there is not an existing object. + * + * @note When the ilSrc is a single bitmap, an image list is created from the + * bitmap. This method is not as flexible as if the programmer created + * the image list herself. The bitmap must be a number of images, all + * the same size, side-by-side in the bitmap. The width of a single + * image determines the number of images. The image list is created + * using the ILC_COLOR8 flag, only. No mask can be used. No room is + * reserved for adding more images to the image list, etc.. */ -RexxMethod2(RexxObjectPtr, tab_setImageList, RexxObjectPtr, imageList, OSELF, self) +RexxMethod4(RexxObjectPtr, tab_setImageList, RexxObjectPtr, ilSrc, + OPTIONAL_int32_t, width, OPTIONAL_int32_t, height, OSELF, self) { + HWND hwnd = rxGetWindowHandle(context, self); + oodSetSysErrCode(context, 0); + HIMAGELIST himl = NULL; + RexxObjectPtr imageList = NULLOBJECT; - if ( imageList != context->Nil() ) + if ( ilSrc == context->Nil() ) { + imageList = ilSrc; + } + else if ( context->IsOfType(ilSrc, "ImageList") ) + { + imageList = ilSrc; himl = rxGetImageList(context, imageList, 1); if ( himl == NULL ) { goto err_out; } } + else + { + imageList = rxILFromBMP(context, &himl, ilSrc, width, height, hwnd); + if ( imageList == NULLOBJECT ) + { + goto err_out; + } + } - HWND hwnd = rxGetWindowHandle(context, self); TabCtrl_SetImageList(hwnd, himl); return rxSetObjVar(context, TABIMAGELIST_ATTRIBUTE, imageList); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-03-14 23:33:08
|
Revision: 4285 http://oorexx.svn.sourceforge.net/oorexx/?rev=4285&view=rev Author: miesfeld Date: 2009-03-14 23:33:02 +0000 (Sat, 14 Mar 2009) Log Message: ----------- Add an argument to ListControl::setImageList(), so there is no need to guess which of the image list types the image list is for. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/oovother.cpp Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-03-14 23:01:49 UTC (rev 4284) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-03-14 23:33:02 UTC (rev 4285) @@ -1140,7 +1140,10 @@ return HandleListCtrl("M", "ENVIS", self~Hwnd, item, partial) -- DEPRECATED -::method setSmallImages external "LIBRARY oodialog lv_setImageList" +::method setSmallImages + newArgs = arg(1, 'A') + newArgs[4] = 1 + forward message 'setImageList' arguments (newArgs) -- DEPRECATED ::method setImages external "LIBRARY oodialog lv_setImageList" Modified: main/trunk/extensions/platform/windows/oodialog/oovother.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-03-14 23:01:49 UTC (rev 4284) +++ main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-03-14 23:33:02 UTC (rev 4285) @@ -4904,7 +4904,6 @@ return imageList; } - /** ListControl::setImageList() * * Sets or removes one of a list-view's image lists. @@ -4922,10 +4921,14 @@ * If ilSrc is a bitmap, then this arg is the width of a single * image. The default is the height of the actual bitmap. * - * @param height [optional] This arg is only used if ilSrc is a bitmap, in which case it - * is the height of the bitmap. The default is the height of the - * actual bitmap + * @param height [optional] This arg is only used if ilSrc is a bitmap, in + * which case it is the height of the bitmap. The default is the + * height of the actual bitmap * + * @param ilType [optional] Only used if ilSrc is a bitmap. In that case it + * indentifies which of the list-views image lists is being set, + * normal, small, or state. The default is LVSI_NORMAL. + * * @return Returns the exsiting .ImageList object if there is one, or * .nil if there is not an existing object. * @@ -4936,15 +4939,9 @@ * image determines the number of images. The image list is created * using the ILC_COLOR8 flag, only. No mask can be used. No room is * reserved for adding more images to the image list, etc.. - * - * The image list can only be assigned to the small or normal image - * list. There is no way to use the image list for the state image - * list. Whether the image list is assigned as the small or normal - * image list is determined by a guess, based on the size of the images. - * */ -RexxMethod4(RexxObjectPtr, lv_setImageList, RexxObjectPtr, ilSrc, - OPTIONAL_int32_t, width, OPTIONAL_int32_t, height, OSELF, self) +RexxMethod5(RexxObjectPtr, lv_setImageList, RexxObjectPtr, ilSrc, + OPTIONAL_int32_t, width, OPTIONAL_int32_t, height, OPTIONAL_int32_t, ilType, OSELF, self) { HWND hwnd = rxGetWindowHandle(context, self); oodSetSysErrCode(context, 0); @@ -4983,20 +4980,15 @@ goto err_out; } - // Get the actual width and height from the image list. - ImageList_GetIconSize(himl, &width, &height); - - // Guess if this is for the small icons. If the actuall icon size is - // too much bigger than the system size for small icons, the icon will - // be clipped in the view, or will not be used at all. Assume the - // programmer does not intend to do this. Arbitrarily say that 'too - // much' is 5 pixels. Note we don't do state images here. - type = (width <= (GetSystemMetrics(SM_CXSMICON) + 5)) ? LVSIL_SMALL : LVSIL_NORMAL; + if ( argumentExists(4) ) + { + type = ilType; + } } if ( type > LVSIL_STATE ) { - wrongRangeException(context, 2, LVSIL_NORMAL, LVSIL_STATE, type); + wrongRangeException(context, argumentExists(4) ? 4 : 2, LVSIL_NORMAL, LVSIL_STATE, type); goto err_out; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-04-11 20:50:07
|
Revision: 4357 http://oorexx.svn.sourceforge.net/oorexx/?rev=4357&view=rev Author: miesfeld Date: 2009-04-11 20:50:04 +0000 (Sat, 11 Apr 2009) Log Message: ----------- This commit brings back the previous work in ooDialog for the Menu, DateTimePicker, and MonthCalendar classes that was removed for the 4.0.0 release. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/Menu.cls main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/dlgext.cls main/trunk/extensions/platform/windows/oodialog/resdlg.cls main/trunk/extensions/platform/windows/oodialog/userdlg.cls Modified: main/trunk/extensions/platform/windows/oodialog/Menu.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/Menu.cls 2009-04-11 18:59:33 UTC (rev 4356) +++ main/trunk/extensions/platform/windows/oodialog/Menu.cls 2009-04-11 20:50:04 UTC (rev 4357) @@ -43,13 +43,10 @@ */ -/** PLEASE NOTE: +/** NOTES: + * If problems with resource ID return -1 + * If problems with dialog or hMenu return -2 * - * The classes and methods in this file are purposively NOT DOCUMENTED. Do NOT - * use these classes or methods because the classes, methods, and / or arugments - * WILL CHANGE in the next release of ooRexx. If you do use these classes in - * your own code, you do so at you own risk. - * */ /* class: Menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-04-11 18:59:33 UTC (rev 4356) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-04-11 20:50:04 UTC (rev 4357) @@ -2059,3 +2059,67 @@ self~SetPos(pos) return pos + +::class 'DateTimePicker' subclass DialogControl public + + +::method getDateTime -- Get the currently selected date and time + return HandleDateTimePicker(self~hwnd, 'G', 'SYS') + +::method setDateTime + use strict arg hr = (time('N')~left(2)), min = (time('N')~substr(4, 5)), - + sec = (time('N')~substr(7,8)), ms = 0, dy = (date('S')~right(2)), - + mn = (date('S')~substr(5, 6)), yr = (date('S')~left(4)) + + return HandleDateTimePicker(self~hwnd, 'S', 'SYS', hr':'min':'sec'.'ms dy mn yr) + +::method clear + return HandleDateTimePicker(self~hwnd, 'S', 'SYS') + +::class 'MonthCalendar' subclass DialogControl public + +::method init + expose n2Day n2Month + + forward class (super) continue + + n2Day = .array~of('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', - + 'Friday', 'Saturday') + + n2Month = .array~of('January', 'February', 'March', 'April', 'May', 'June', - + 'July', 'August', 'September', 'October', 'November', - + 'December') + +::method getDate -- Get the currently selected date + expose n2Day n2Month + use arg format = 'COMPLETE' + + ans = HandleMonthCalendar(self~hwnd, 'G', 'CUR') + + select + when ans == 1 then ans = -1 + when format~caselessCompare('RAW') == 0 then nop + + when format~caselessCompare('NORMAL') == 0 then do + ans = ans~word(1) n2Month[ans~word(2)]~left(3) ans~word(3) + end + + when format~caselessCompare('COMPLETE') == 0 then do + ans = n2Day[ans~word(4) + 1] || ',' n2Month[ans~word(2)] ans~word(1) || ',' ans~word(3) + end + + otherwise ans = -1 + end + -- End select + + return ans + +::method usesUnicode + return HandleMonthCalendar(self~hwnd, 'G', "UNI") + + +::method setDate + use strict arg day, month, year = (date('S')~left(4)) + return HandleMonthCalendar(self~hwnd, 'S', 'CUR', day month year) + + Modified: main/trunk/extensions/platform/windows/oodialog/dlgext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-04-11 18:59:33 UTC (rev 4356) +++ main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-04-11 20:50:04 UTC (rev 4357) @@ -896,9 +896,12 @@ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ - The menu methods in this block are purposively not documented. Do NOT use - them in your code. The WILL be removed from ooDialog in the future. + These menu bar methods are needed to provide backward compatibility for the + deprecated menu methods. The ooDialog programmer is *strongly* discouraged + from using them. If the deprecated methods are removed, these will be removed + with them. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ + ::attribute menuBar get ::attribute menuBar set private @@ -915,8 +918,11 @@ menu = self~menuBar self~menuBar = .nil return menu -/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + The following menu bar methods are deprecated, instead, use the Menu classes + directly. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ ::method enableMenuItem unguarded use strict arg id @@ -953,6 +959,9 @@ if self~menuBar == .nil then return -2 return self~menuBar~getState(id) +/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + End deprecated menu bar methods. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ /******************************************************************************/ /* New extensions */ Modified: main/trunk/extensions/platform/windows/oodialog/resdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/resdlg.cls 2009-04-11 18:59:33 UTC (rev 4356) +++ main/trunk/extensions/platform/windows/oodialog/resdlg.cls 2009-04-11 20:50:04 UTC (rev 4357) @@ -102,6 +102,7 @@ if self~bkgBitmap \= 0 then self~removeBitmap(self~bkgBitmap) return ret +-- This method is deprecated, instead use the Menu classes directly. ::method setMenu use strict arg id menuBar = .BinaryMenuBar~new(self, id, self, 0, .true) Modified: main/trunk/extensions/platform/windows/oodialog/userdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/userdlg.cls 2009-04-11 18:59:33 UTC (rev 4356) +++ main/trunk/extensions/platform/windows/oodialog/userdlg.cls 2009-04-11 20:50:04 UTC (rev 4357) @@ -71,7 +71,8 @@ return ret /******************************************************************************/ -/* Menu/Action bar methods. */ +/* Menu/Action bar. These methods are deprecated, instead, use the Menu */ +/* classes directly. */ ::method SetMenu menuBar = self~menuBar This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-04-13 05:22:09
|
Revision: 4359 http://oorexx.svn.sourceforge.net/oorexx/?rev=4359&view=rev Author: miesfeld Date: 2009-04-13 05:21:58 +0000 (Mon, 13 Apr 2009) Log Message: ----------- 2010145 Add the Month Calendar control 2010144 Add the Date and Time Picker control Convert the existing code for these two classes to the native API. Both control classes now use the DateTime class for setting and retrieving dates and times. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/oovother.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.cpp Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-04-12 22:56:40 UTC (rev 4358) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-04-13 05:21:58 UTC (rev 4359) @@ -340,29 +340,29 @@ end return 0 -::method AddDateTimePicker - use arg id, attname, x, y, cx, cy, opts +::method addDateTimePicker + use strict arg id, attributeName = "", x, y, cx, cy, opts = "" symbid = id - id = self~ItemAdd(id) + id = self~itemAdd(id) if id < 0 then return id - if Arg(2, 'O') then attname = "DATA"id - opts = self~GetDefaultOpts(opts) + if arg(2, 'O') then attributeName = "DATA"id + opts = self~getDefaultOpts(opts) self~activePtr = UsrAddNewCtrl("DTP", self~activePtr, id, x, y, cx, cy, opts) - if self~AutoDetect = 1 then do - return self~ConnectDateTimePicker(symbid, attname) + if self~autoDetect then do + return self~connectDateTimePicker(symbid, attributeName) end return 0 -::method AddMonthCalendar - use arg id, attname, x, y, cx, cy, opts +::method addMonthCalendar + use strict arg id, attributeName = "", x, y, cx, cy, opts symbid = id - id = self~ItemAdd(id) + id = self~itemAdd(id) if id < 0 then return id - if Arg(2, 'O') then attname = "DATA"id - opts = self~GetDefaultOpts(opts) + if arg(2, 'O') then attributeName = "DATA"id + opts = self~getDefaultOpts(opts) self~activePtr = UsrAddNewCtrl("MONTH", self~activePtr, id, x, y, cx, cy, opts) - if self~AutoDetect = 1 then do - return self~ConnectMonthCalendar(symbid, attname) + if self~autoDetect + return self~connectMonthCalendar(symbid, attributeName) end return 0 @@ -2062,64 +2062,10 @@ ::class 'DateTimePicker' subclass DialogControl public +::attribute dateTime external "LIBRARY oodialog _dtp_dateTime" -::method getDateTime -- Get the currently selected date and time - return HandleDateTimePicker(self~hwnd, 'G', 'SYS') -::method setDateTime - use strict arg hr = (time('N')~left(2)), min = (time('N')~substr(4, 5)), - - sec = (time('N')~substr(7,8)), ms = 0, dy = (date('S')~right(2)), - - mn = (date('S')~substr(5, 6)), yr = (date('S')~left(4)) - - return HandleDateTimePicker(self~hwnd, 'S', 'SYS', hr':'min':'sec'.'ms dy mn yr) - -::method clear - return HandleDateTimePicker(self~hwnd, 'S', 'SYS') - ::class 'MonthCalendar' subclass DialogControl public -::method init - expose n2Day n2Month - - forward class (super) continue - - n2Day = .array~of('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', - - 'Friday', 'Saturday') - - n2Month = .array~of('January', 'February', 'March', 'April', 'May', 'June', - - 'July', 'August', 'September', 'October', 'November', - - 'December') - -::method getDate -- Get the currently selected date - expose n2Day n2Month - use arg format = 'COMPLETE' - - ans = HandleMonthCalendar(self~hwnd, 'G', 'CUR') - - select - when ans == 1 then ans = -1 - when format~caselessCompare('RAW') == 0 then nop - - when format~caselessCompare('NORMAL') == 0 then do - ans = ans~word(1) n2Month[ans~word(2)]~left(3) ans~word(3) - end - - when format~caselessCompare('COMPLETE') == 0 then do - ans = n2Day[ans~word(4) + 1] || ',' n2Month[ans~word(2)] ans~word(1) || ',' ans~word(3) - end - - otherwise ans = -1 - end - -- End select - - return ans - -::method usesUnicode - return HandleMonthCalendar(self~hwnd, 'G', "UNI") - - -::method setDate - use strict arg day, month, year = (date('S')~left(4)) - return HandleMonthCalendar(self~hwnd, 'S', 'CUR', day month year) - - +::attribute usesUnicode external "LIBRARY oodialog _mc_usesUnicode" +::attribute date external "LIBRARY oodialog _mc_date" Modified: main/trunk/extensions/platform/windows/oodialog/oovother.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-04-12 22:56:40 UTC (rev 4358) +++ main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-04-13 05:21:58 UTC (rev 4359) @@ -2407,395 +2407,6 @@ RETC(0) } -static int dateTimeOperation(HWND hCtrl, char *buffer, size_t length, size_t type) -{ - SYSTEMTIME sysTime = {0}; - int ret = 1; - - switch ( type ) - { - case DTO_GETDTP : - switch ( DateTime_GetSystemtime(hCtrl, &sysTime) ) - { - case GDT_VALID: - _snprintf(buffer, length, - "%hu:%02hu:%02hu.%hu %hu %hu %hu %hu", - sysTime.wHour, sysTime.wMinute, sysTime.wSecond, sysTime.wMilliseconds, - sysTime.wDay, sysTime.wMonth, sysTime.wYear, sysTime.wDayOfWeek); - - ret = (int)strlen(buffer); - break; - - case GDT_NONE: - buffer[0] = '0'; - buffer[1] = '\0'; - break; - - case GDT_ERROR: - default : - /* Failed */ - buffer[0] = '1'; - buffer[1] = '\0'; - break; - } - break; - - case DTO_SETDTP : - { - int hr, min, sec, ms, dy, mn, yr; - ret = sscanf(buffer, "%hu:%02hu:%02hu.%hu %hu %hu %hu", &hr, &min, &sec, &ms, &dy, &mn, &yr); - - if ( ret == 8 ) - { - sysTime.wHour = hr; - sysTime.wMinute = min; - sysTime.wSecond = sec; - sysTime.wMilliseconds = ms; - sysTime.wDay = dy; - sysTime.wMonth = mn; - sysTime.wYear = yr; - - if ( DateTime_SetSystemtime(hCtrl, GDT_VALID, &sysTime) == 0 ) - { - /* Failed */ - ret = 1; - } - else - { - /* Good */ - ret = 0; - } - } - else - { - ret = -3; - } - } break; - - case DTO_GETMONTH : - if ( MonthCal_GetCurSel(hCtrl, &sysTime) == 0 ) - { - /* Failed */ - buffer[0] = '1'; - buffer[1] = '\0'; - } - else - { - _snprintf(buffer, length, "%hu %hu %hu %hu", sysTime.wDay, - sysTime.wMonth, sysTime.wYear, sysTime.wDayOfWeek); - ret = (int)strlen(buffer); - } - break; - - case DTO_SETMONTH : - { - int dy, mn, yr; - ret = sscanf(buffer, "%hu %hu %hu", &dy, &mn, &yr); - if ( ret == 3 ) - { - sysTime.wDay = dy; - sysTime.wMonth = mn; - sysTime.wYear = yr; - if ( MonthCal_SetCurSel(hCtrl, &sysTime) == 0 ) - { - /* Failed */ - ret = 1; - } - else - { - /* Good */ - ret = 0; - } - } - else - { - ret = -3; - } - } break; - - default : - /* Shouldn't happen, just set an error code. */ - buffer[0] = '1'; - buffer[1] = '\0'; - break; - } - return ret; -} - -/** - * Implements the interface to the Month Calendar control. - * - * The parameters sent from ooRexx as an array of RXString: - * - * argv[0] Window handle of the month calendar control. - * - * argv[1] Major designator: G for get, etc.. Only the first letter of - * the string is tested and it must be capitalized. - * - * argv[2] Minor designator: COL for get color, etc.. The whole capitalized - * substring is used. - * - * argv[3] Dependent on function. - * - * Return to ooRexx, in general: - * < -5 a negated system error code - * -5 not implemented yet - * -4 unsupported ComCtl32 Version - * -3 problem with an argument - * -2 operation not supported by this month calendar control - * -1 problem with the month calendar control id or handle - * 0 the Windows API call succeeds - * 1 the Windows API call failed - * > 1 dependent on the function, usually a returned value not a return code - */ -size_t RexxEntry HandleMonthCalendar(const char *funcname, size_t argc, CONSTRXSTRING *argv, - const char *qname, RXSTRING *retstr) -{ - HWND hwnd; - SYSTEMTIME sysTime = {0}; - - /* Minimum of 2 args. */ - CHECKARGL(2); - - hwnd = GET_HWND(argv[0]); - if ( hwnd == 0 || ! IsWindow(hwnd) ) - { - RETVAL(-1); - } - - /* G - 'get' something function */ - if ( argv[1].strptr[0] == 'G' ) - { - if ( strcmp(argv[2].strptr, "COL") == 0 ) /* GetColor() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "CUR") == 0 ) /* GetCurSel() */ - { - retstr->strlength = dateTimeOperation(hwnd, retstr->strptr, RXAUTOBUFLEN, DTO_GETMONTH); - return 0; - } - else if ( strcmp(argv[2].strptr, "FIR") == 0 ) /* GetFirstDayOfWeek() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "MSEL") == 0 ) /* GetMaxSelCount() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "MTOD") == 0 ) /* GetMaxTodayWidth() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "MIN") == 0 ) /* GetMinReqRect () */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "MDEL") == 0 ) /* GetMonthDelta() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "MRAN") == 0 ) /* GetMonthRange() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "RAN") == 0 ) /* GetRange() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "SEL") == 0 ) /* GetSelRange() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "TOD") == 0 ) /* GetToday() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "UNI") == 0 ) /* GetUnicodeFormat() */ - { - RETC(MonthCal_GetUnicodeFormat(hwnd) ? 1 : 0) - } - else RETERR; - } - else if ( argv[1].strptr[0] == 'S' ) - { - if ( strcmp(argv[2].strptr, "COL") == 0 ) /* SetColor() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "CUR") == 0 ) /* SetCurSel() */ - { - CHECKARG(4) - - /* buffer length is not used for the 'SET' operations. */ - RETVAL(dateTimeOperation(hwnd, (char *)argv[3].strptr, 0, DTO_SETMONTH)); - } - else if ( strcmp(argv[2].strptr, "FIR") == 0 ) /* SetFirstDayOfWeek() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "MSEL") == 0 ) /* SetMaxSelCount() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "MTOD") == 0 ) /* SetMaxTodayWidth() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "MIN") == 0 ) /* SetMinReqRect () */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "MDEL") == 0 ) /* SetMonthDelta() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "MRAN") == 0 ) /* SetMonthRange() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "RAN") == 0 ) /* SetRange() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "SEL") == 0 ) /* SetSelRange() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "TOD") == 0 ) /* SetToday() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "UNI") == 0 ) /* SetUnicodeFormat() */ - { - RETC(0) - } - else RETERR; - } - else if ( argv[1].strptr[0] == 'H' ) /* HitTest() */ - { - RETC(0) - } - - RETERR; -} - - -/** - * Implements the interface to the Date and Time Picker control. - * - * The parameters sent from ooRexx as an array of RXString: - * - * argv[0] Window handle of the date and time picker control. - * - * argv[1] Major designator: G for get, etc.. Only the first letter of - * the string is tested and it must be capitalized. - * - * argv[2] Minor designator: STYLE for (extended) list style, etc.. The whole - * capitalized word is used. - * - * argv[3] Dependent on function. - * - * Return to ooRexx, in general: - * < -5 a negated system error code - * -5 not implemented yet - * -4 unsupported ComCtl32 Version - * -3 problem with an argument - * -2 operation not supported by this month calendar control - * -1 problem with the month calendar control id or handle - * 0 the Windows API call succeeds - * 1 the Windows API call failed - * > 1 dependent on the function, usually a returned value not a return code - */ -size_t RexxEntry HandleDateTimePicker(const char *funcname, size_t argc, CONSTRXSTRING *argv, - const char *qname, RXSTRING *retstr) -{ - HWND hwnd; - SYSTEMTIME sysTime = {0}; - - /* Minimum of 3 args. */ - CHECKARGL(3); - - hwnd = GET_HWND(argv[0]); - if ( hwnd == 0 || ! IsWindow(hwnd) ) - { - RETVAL(-1); - } - - /* G - 'get' something function */ - if ( argv[1].strptr[0] == 'G' ) - { - if ( strcmp(argv[2].strptr, "CAL")== 0 ) /* GetMonthCal() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "COL")== 0 ) /* GetMonthCalColor() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "FON")== 0 ) /* GetMonthCalFont() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "RAN")== 0 ) /* GetRange() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "SYS")== 0 ) /* GetSystemtime() */ - { - retstr->strlength = dateTimeOperation(hwnd, retstr->strptr, RXAUTOBUFLEN, DTO_GETDTP); - return 0; - } - else - { - RETERR; - } - } - else if ( argv[1].strptr[0] == 'S' ) - { - if ( strcmp(argv[2].strptr, "FOR") == 0 ) /* SetFormat() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "COL") == 0 ) /* SetMonthCalColor() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "FON") == 0 ) /* SetMonthCalFont() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "RAN") == 0 ) /* SetRange() */ - { - RETC(0) - } - else if ( strcmp(argv[2].strptr, "SYS") == 0 ) /* SetSystemtime() */ - { - if ( argc < 4 ) - { - /* Set the DTP control to "no date" and clear its check box. */ - if ( DateTime_SetSystemtime(hwnd, GDT_NONE, &sysTime) == 0 ) - { - /* Failed */ - RETC(1) - } - RETC(0) - } - else - { - CHECKARGL(4); - - /* Buffer length is not used for the 'SET' operations. */ - RETVAL(dateTimeOperation(hwnd, (char *)argv[3].strptr, 0, DTO_SETDTP)); - } - } - else RETERR; - } - - RETERR; -} - - /* These inline (and non-inline) convenience functions will be moved so that * they are accessible by all of ooDialog at some point. Right now they are * just used by native method functions in this source file. @@ -2810,6 +2421,9 @@ #define API_FAILED_MSG "system API %s() failed; OS error code %d" #define COM_API_FAILED_MSG "system API %s() failed; COM code 0x%08x" #define NO_COMMCTRL_MSG "failed to initialize %s; OS error code %d" +#define NO_MEMORY_MSG "failed to allocate memory" +#define FUNC_WINCTRL_FAILED_MSG "the '%s'() function of the Windows '%s' control failed" +#define MSG_WINCTRL_FAILED_MSG "the '%s' message of the Windows '%s' control failed" #define COMCTL32_FULL_PART 0 #define COMCTL32_NUMBER_PART 1 @@ -3016,9 +2630,16 @@ systemServiceException(context, buffer); } +void controlFailedException(RexxMethodContext *c, const char *msg, const char *func, const char *control) +{ + TCHAR buffer[256]; + _snprintf(buffer, sizeof(buffer), msg, func, control); + systemServiceException(c, buffer); +} + void outOfMemoryException(RexxMethodContext *c) { - systemServiceException(c, "Failed to allocate memory"); + systemServiceException(c, NO_MEMORY_MSG); } void userDefinedMsgException(RexxMethodContext *c, CSTRING msg) @@ -4552,6 +4173,285 @@ /** + * Methods for the DateTimePicker class. + */ +#define DATETIMEPICKER_CLASS "DateTimePicker" +#define DATETIMEPICKER_WINNAME "Date and Time Picker" + +// This is used for MonthCalendar also +#define SYSTEMTIME_MIN_YEAR 1601 + +enum DateTimePart {dtFull, dtTime, dtDate, dtNow}; + +static wholenumber_t getDateTimePart(RexxMethodContext *c, RexxObjectPtr dateTime, const char *part) +{ + wholenumber_t num; + + RexxObjectPtr rxNum = c->SendMessage0(dateTime, part); + if ( rxNum == NULLOBJECT || ! c->WholeNumber(rxNum, &num) ) + { + TCHAR buffer[128]; + _snprintf(buffer, sizeof(buffer), "The DateTime object failed to produce a valid %s", part); + userDefinedMsgException(c, buffer); + num = -1; + } + return num; +} + +/** + * Converts a DateTime object to a SYSTEMTIME structure. The fields of the + * struct are filled in with the corresponding values of the DateTime object. + * + * @param c The method context we are operating in. + * @param dateTime An ooRexx DateTime object. + * @param sysTime [in/out] The SYSTEMTIME struct to fill in. + * @param part Specifies which fields of the SYSTEMTIME struct fill in. + * Unspecified fields are left alone. + * + * @return True if no errors, false if a condition is raised. + * + * @note Assumes the dateTime object is not null and is actually a DateTime + * object. + * + * @note The year part of the DateTime object must be in range for a SYSTEMTIME. + * The lower range for SYSTEMTIME is 1601. The upper range of a DateTime + * object is 9999 and of a SYSTEMTIME 30827, so we only check the lower + * range. An exception is raised if out of range. + */ +static bool dt2sysTime(RexxMethodContext *c, RexxObjectPtr dateTime, SYSTEMTIME *sysTime, DateTimePart part) +{ + if ( part == dtNow ) + { + GetLocalTime(sysTime); + } + else + { + // format: yyyy-dd-mmThh:mm:ss.uuuuuu. + RexxObjectPtr dt = c->SendMessage0(dateTime, "ISODATE"); + const char *isoDate = c->CString(dt); + + SYSTEMTIME st = {0}; + sscanf(isoDate, "%4hu-%2hu-%2huT%2hu:%2hu:%2hu.%3hu", &st.wYear, &st.wMonth, &st.wDay, + &st.wHour, &st.wMinute, &st.wSecond, &st.wMilliseconds); + + if ( st.wYear < SYSTEMTIME_MIN_YEAR ) + { + userDefinedMsgException(c, "The DateTime object can not represent a year prior to 1601"); + goto failed_out; + } + + switch ( part ) + { + case dtTime : + sysTime->wHour = st.wHour; + sysTime->wMinute = st.wMinute; + sysTime->wSecond = st.wSecond; + sysTime->wMilliseconds = st.wMilliseconds; + break; + + case dtDate : + sysTime->wYear = st.wYear; + sysTime->wMonth = st.wMonth; + sysTime->wDay = st.wDay; + break; + + case dtFull : + sysTime->wYear = st.wYear; + sysTime->wMonth = st.wMonth; + sysTime->wDay = st.wDay; + sysTime->wHour = st.wHour; + sysTime->wMinute = st.wMinute; + sysTime->wSecond = st.wSecond; + sysTime->wMilliseconds = st.wMilliseconds; + break; + } + } + return true; + +failed_out: + return false; +} + +/** + * Creates a DateTime object that represents the time set in a SYSTEMTIME + * struct. + * + * @param c + * @param sysTime + * @param dateTime [in/out] + */ +static void sysTime2dt(RexxMethodContext *c, SYSTEMTIME *sysTime, RexxObjectPtr *dateTime, DateTimePart part) +{ + RexxClassObject dtClass = c->FindClass("DATETIME"); + + if ( part == dtNow ) + { + *dateTime = c->SendMessage0(dtClass, "NEW"); + } + else + { + char buf[64]; + switch ( part ) + { + case dtDate : + _snprintf(buf, sizeof(buf), "%hu%02hu%02hu", sysTime->wYear, sysTime->wMonth, sysTime->wDay); + *dateTime = c->SendMessage1(dtClass, "FROMSTANDARDDATE", c->String(buf)); + break; + + case dtTime : + _snprintf(buf, sizeof(buf), "%02hu:%02hu:%02hu.%03hu000", + sysTime->wHour, sysTime->wMinute, sysTime->wSecond, sysTime->wMilliseconds); + *dateTime = c->SendMessage1(dtClass, "FROMLONGTIME", c->String(buf)); + break; + + case dtFull : + _snprintf(buf, sizeof(buf), "%hu-%02hu-%02huT%02hu:%02hu:%02hu.%03hu000", + sysTime->wYear, sysTime->wMonth, sysTime->wDay, + sysTime->wHour, sysTime->wMinute, sysTime->wSecond, sysTime->wMilliseconds); + *dateTime = c->SendMessage1(dtClass, "FROMISODATE", c->String(buf)); + break; + } + } +} + +/** DateTimePicker::dateTime (attribute) + * + * Retrieves the current selected system time of the date time picker and + * returns it as a DateTime object. + * + * If the date time picker has the DTS_SHOWNONE style, it can also be set to + * "no date" when the user has unchecked the check box. If the control is in + * this state, the .NullHandle object is returned to the user. + * + * @returns A DateTime object representing the current selected system time of + * the control, or the .NullHandle object if the control is in the + * 'no date' state. + */ +RexxMethod1(RexxObjectPtr, get_dtp_dateTime, OSELF, self) +{ + RexxMethodContext *c = context; + SYSTEMTIME sysTime = {0}; + RexxObjectPtr dateTime = NULLOBJECT; + + switch ( DateTime_GetSystemtime(rxGetWindowHandle(context, self), &sysTime) ) + { + case GDT_VALID: + sysTime2dt(context, &sysTime, &dateTime, dtFull); + break; + + case GDT_NONE: + // This is valid. It means the DTP is using the DTS_SHOWNONE style + // and that the user has the check box is not checked. We return a + // null pointer object. + dateTime = c->NewPointer(NULL); + break; + + case GDT_ERROR: + default : + // Some error with the DTP, raise an exception. + controlFailedException(context, FUNC_WINCTRL_FAILED_MSG, "DateTime_GetSystemtime", DATETIMEPICKER_WINNAME); + break; + } + return dateTime; +} + +/** DateTimePicker::dateTime= (attribute) + * + * Sets the system time for the date time picker to the time represented by the + * DateTime object. If, and only if, the date time picker has the DTS_SHOWNONE + * style, it can also be set to "no date." The Rexx user can set this state by + * passing in the .NullHandle object. + * + * @param dateTime The date and time to set the control to. + * + * @return This is an attribute, there is no return. + * + * @note The minimum year a date time picker can be set to is 1601. If the + * DateTime object represents a year prior to 1601, an exception is + * raised. + * + */ +RexxMethod2(RexxObjectPtr, set_dtp_dateTime, RexxObjectPtr, dateTime, OSELF, self) +{ + RexxMethodContext *c = context; + SYSTEMTIME sysTime = {0}; + HWND hwnd = rxGetWindowHandle(context, self); + + if ( c->IsOfType(dateTime, "POINTER") ) + { + DateTime_SetSystemtime(hwnd, GDT_NONE, &sysTime); + } + else + { + if ( requiredClass(context, dateTime, "DATETIME", 1) ) + { + if ( dt2sysTime(c, dateTime, &sysTime, dtFull) ) + { + if ( DateTime_SetSystemtime(hwnd, GDT_VALID, &sysTime) == 0 ) + { + controlFailedException(context, FUNC_WINCTRL_FAILED_MSG, "DateTime_SetSystemtime", DATETIMEPICKER_WINNAME); + } + } + } + } + return NULLOBJECT; +} + + +/** + * Methods for the MonthCalendar class. + */ +#define MONTHCALENDAR_CLASS "MonthCalendar" +#define MONTHCALENDAR_WINNAME "Month Calendar" + +RexxMethod1(RexxObjectPtr, get_mc_date, OSELF, self) +{ + RexxMethodContext *c = context; + SYSTEMTIME sysTime = {0}; + RexxObjectPtr dateTime = NULLOBJECT; + + if ( MonthCal_GetCurSel(rxGetWindowHandle(context, self), &sysTime) == 0 ) + { + controlFailedException(context, FUNC_WINCTRL_FAILED_MSG, "MonthCal_GetCurSel", MONTHCALENDAR_WINNAME); + } + else + { + sysTime2dt(context, &sysTime, &dateTime, dtDate); + } + return dateTime; +} + +RexxMethod2(RexxObjectPtr, set_mc_date, RexxObjectPtr, dateTime, OSELF, self) +{ + RexxMethodContext *c = context; + SYSTEMTIME sysTime = {0}; + + if ( requiredClass(context, dateTime, "DATETIME", 1) ) + { + if ( dt2sysTime(context, dateTime, &sysTime, dtDate) ) + { + if ( MonthCal_SetCurSel(rxGetWindowHandle(context, self), &sysTime) == 0 ) + { + controlFailedException(context, FUNC_WINCTRL_FAILED_MSG, "MonthCal_SetCurSel", MONTHCALENDAR_WINNAME); + } + } + } + return NULLOBJECT; +} + +RexxMethod1(logical_t, get_mc_usesUnicode, OSELF, self) +{ + return MonthCal_GetUnicodeFormat(rxGetWindowHandle(context, self)) ? 1 : 0; +} + +RexxMethod2(RexxObjectPtr, set_mc_usesUnicode, logical_t, useUnicode, OSELF, self) +{ + MonthCal_SetUnicodeFormat(rxGetWindowHandle(context, self), useUnicode); + return NULLOBJECT; +} + + +/** * Methods for the ProgressBar class. */ #define PROGRESSBAR_CLASS "ProgressBar" @@ -8054,7 +7954,8 @@ return false; } - if ( ! initCommonControls(context, ICC_WIN95_CLASSES | ICC_STANDARD_CLASSES, "ooDialog", COMCTL_ERR_TITLE) ) + if ( ! initCommonControls(context, ICC_WIN95_CLASSES | ICC_STANDARD_CLASSES | ICC_DATE_CLASSES, + "ooDialog", COMCTL_ERR_TITLE) ) { ComCtl32Version = 0; return false; Modified: main/trunk/extensions/platform/windows/oodialog/oovutil.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-12 22:56:40 UTC (rev 4358) +++ main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-13 05:21:58 UTC (rev 4359) @@ -127,7 +127,6 @@ } } - LONG HandleError(PRXSTRING r, CHAR * text) { HWND hW = NULL; @@ -1985,8 +1984,6 @@ REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleListCtrlEx); REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleControlEx); REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleOtherNewCtrls); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleMonthCalendar); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDateTimePicker); REXX_CLASSIC_ROUTINE_PROTOTYPE(WinTimer); REXX_CLASSIC_ROUTINE_PROTOTYPE(DumpAdmin); REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrAddControl); @@ -2050,8 +2047,6 @@ REXX_CLASSIC_ROUTINE(HandleListCtrlEx, HandleListCtrlEx), REXX_CLASSIC_ROUTINE(HandleControlEx, HandleControlEx), REXX_CLASSIC_ROUTINE(HandleOtherNewCtrls, HandleOtherNewCtrls), - REXX_CLASSIC_ROUTINE(HandleMonthCalendar, HandleMonthCalendar), - REXX_CLASSIC_ROUTINE(HandleDateTimePicker, HandleDateTimePicker), REXX_CLASSIC_ROUTINE(WinTimer, WinTimer), REXX_CLASSIC_ROUTINE(DumpAdmin, DumpAdmin), REXX_CLASSIC_ROUTINE(UsrAddControl, UsrAddControl), @@ -2158,6 +2153,14 @@ REXX_METHOD_PROTOTYPE(tab_setImageList); REXX_METHOD_PROTOTYPE(tab_getImageList); +REXX_METHOD_PROTOTYPE(get_dtp_dateTime); +REXX_METHOD_PROTOTYPE(set_dtp_dateTime); + +REXX_METHOD_PROTOTYPE(get_mc_date); +REXX_METHOD_PROTOTYPE(set_mc_date); +REXX_METHOD_PROTOTYPE(get_mc_usesUnicode); +REXX_METHOD_PROTOTYPE(set_mc_usesUnicode); + REXX_METHOD_PROTOTYPE(pbc_stepIt); REXX_METHOD_PROTOTYPE(pbc_getPos); REXX_METHOD_PROTOTYPE(pbc_setPos); @@ -2310,6 +2313,14 @@ REXX_METHOD(tab_setImageList, tab_setImageList), REXX_METHOD(tab_getImageList, tab_getImageList), + REXX_METHOD(get_dtp_dateTime, get_dtp_dateTime), + REXX_METHOD(set_dtp_dateTime, set_dtp_dateTime), + + REXX_METHOD(get_mc_date, get_mc_date), + REXX_METHOD(set_mc_date, set_mc_date), + REXX_METHOD(get_mc_usesUnicode, get_mc_usesUnicode), + REXX_METHOD(set_mc_usesUnicode, set_mc_usesUnicode), + REXX_METHOD(pbc_stepIt, pbc_stepIt), REXX_METHOD(pbc_getPos, pbc_getPos), REXX_METHOD(pbc_setPos, pbc_setPos), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-04-18 20:17:54
|
Revision: 4424 http://oorexx.svn.sourceforge.net/oorexx/?rev=4424&view=rev Author: miesfeld Date: 2009-04-18 20:17:50 +0000 (Sat, 18 Apr 2009) Log Message: ----------- [2772990] UserDialog SetWindowRect fails and miscellaneous clean up to dlgext.cls. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/dlgext.cls main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp Modified: main/trunk/extensions/platform/windows/oodialog/dlgext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-04-18 19:42:36 UTC (rev 4423) +++ main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-04-18 20:17:50 UTC (rev 4424) @@ -168,41 +168,41 @@ if ((Arg(5, 'o') = 0) & (min~Datatype('N') \= 0)) & ((Arg(6,'o') = 0) & (max~Datatype('N') \= 0)) then self~SetSBRange(id, min, max, 0) if (Arg(7,'o') = 0) & (pos~Datatype('N') \= 0) then self~SetSBPos(id, pos, 0) - hnd = self~GetItem(id) + hwnd = self~GetItem(id) wf = "0x0000FFFF" nf = "0xFFFFFFFF" /* Install hooks for WM_VSCROLL and WM_HSCROLL */ - self~AddUserMsg(progdn, 0x00000114, wf, 0x00000001, wf, hnd, nf) - self~AddUserMsg(progup, 0x00000114, wf, 0x00000000, wf, hnd, nf) - self~AddUserMsg(progdn, 0x00000115, wf, 0x00000001, wf, hnd, nf) - self~AddUserMsg(progup, 0x00000115, wf, 0x00000000, wf, hnd, nf) + self~AddUserMsg(progdn, 0x00000114, wf, 0x00000001, wf, hwnd, nf) + self~AddUserMsg(progup, 0x00000114, wf, 0x00000000, wf, hwnd, nf) + self~AddUserMsg(progdn, 0x00000115, wf, 0x00000001, wf, hwnd, nf) + self~AddUserMsg(progup, 0x00000115, wf, 0x00000000, wf, hwnd, nf) if Arg(4,'o') = 0 then do - self~AddUserMsg(progpos, 0x00000114, wf, 0x00000004, wf, hnd, nf) - self~AddUserMsg(progpos, 0x00000115, wf, 0x00000004, wf, hnd, nf) + self~AddUserMsg(progpos, 0x00000114, wf, 0x00000004, wf, hwnd, nf) + self~AddUserMsg(progpos, 0x00000115, wf, 0x00000004, wf, hwnd, nf) end if Arg(8,'o') = 0 then do - self~AddUserMsg(progpgup, 0x00000114, wf, 0x00000002, wf, hnd, nf) - self~AddUserMsg(progpgup, 0x00000115, wf, 0x00000002, wf, hnd, nf) + self~AddUserMsg(progpgup, 0x00000114, wf, 0x00000002, wf, hwnd, nf) + self~AddUserMsg(progpgup, 0x00000115, wf, 0x00000002, wf, hwnd, nf) end if Arg(9,'o') = 0 then do - self~AddUserMsg(progpgdn, 0x00000114, wf, 0x00000003, wf, hnd, nf) - self~AddUserMsg(progpgdn, 0x00000115, wf, 0x00000003, wf, hnd, nf) + self~AddUserMsg(progpgdn, 0x00000114, wf, 0x00000003, wf, hwnd, nf) + self~AddUserMsg(progpgdn, 0x00000115, wf, 0x00000003, wf, hwnd, nf) end if Arg(10,'o') = 0 then do - self~AddUserMsg(progtop, 0x00000114, wf, 0x00000006, wf, hnd, nf) - self~AddUserMsg(progtop, 0x00000115, wf, 0x00000006, wf, hnd, nf) + self~AddUserMsg(progtop, 0x00000114, wf, 0x00000006, wf, hwnd, nf) + self~AddUserMsg(progtop, 0x00000115, wf, 0x00000006, wf, hwnd, nf) end if Arg(11,'o') = 0 then do - self~AddUserMsg(progbottom, 0x00000114, wf, 0x00000007, wf, hnd, nf) - self~AddUserMsg(progbottom, 0x00000115, wf, 0x00000007, wf, hnd, nf) + self~AddUserMsg(progbottom, 0x00000114, wf, 0x00000007, wf, hwnd, nf) + self~AddUserMsg(progbottom, 0x00000115, wf, 0x00000007, wf, hwnd, nf) end if Arg(12,'o') = 0 then do - self~AddUserMsg(progtrack, 0x00000114, wf, 0x00000005, wf, hnd, nf) - self~AddUserMsg(progtrack, 0x00000115, wf, 0x00000005, wf, hnd, nf) + self~AddUserMsg(progtrack, 0x00000114, wf, 0x00000005, wf, hwnd, nf) + self~AddUserMsg(progtrack, 0x00000115, wf, 0x00000005, wf, hwnd, nf) end if Arg(13,'o') = 0 then do - self~AddUserMsg(progendsc, 0x00000114, wf, 0x00000008, wf, hnd, nf) - self~AddUserMsg(progendsc, 0x00000115, wf, 0x00000008, wf, hnd, nf) + self~AddUserMsg(progendsc, 0x00000114, wf, 0x00000008, wf, hwnd, nf) + self~AddUserMsg(progendsc, 0x00000115, wf, 0x00000008, wf, hwnd, nf) end return 0 @@ -334,21 +334,21 @@ /* This method will resize a dialog item */ ::method ResizeItem unguarded - use arg id, width, high, showOptions - if Arg(4,"o") = 1 then showOptions = ""; else showOptions = showOptions~translate - hnd = self~GetItem(id) - if hnd = 0 then return -1 - return WndShow_Pos("P",hnd, 0, 0, width * self~FactorX, high* self~FactorY,, + use arg id, width, high, showOptions = "" + showOptions = showOptions~translate + hwnd = self~GetItem(id) + if hwnd = 0 then return -1 + return WndShow_Pos("P",hwnd, 0, 0, width * self~FactorX, high* self~FactorY,, "NOMOVE "||showOptions) /* This method will move a dialog item to an other position */ ::method MoveItem unguarded - use arg id, xPos, yPos, showOptions - if Arg(4,"o") = 1 then showOptions = ""; else showOptions = showOptions~translate - h = self~GetItem(id) + use arg id, xPos, yPos, showOptions = "" + showOptions = showOptions~translate + hwnd = self~GetItem(id) if h = 0 then return -1 - return WndShow_Pos("P",h, xPos * self~FactorX, yPos * self~FactorY, 0, 0,, + return WndShow_Pos("P", hwnd, xPos * self~FactorX, yPos * self~FactorY, 0, 0,, "NOSIZE "||showOptions) /* This method will add a method that will be started automatically */ @@ -376,8 +376,8 @@ /* It returns a handle to the bitmap */ ::method LoadBitmap - use arg bmpFilename, option - if Arg(2, 'o') = 1 then option = ""; else option = option~translate + use arg bmpFilename, option = "" + option = option~translate return LoadRemoveBitmap(self~Adm, bmpFilename, "LOAD" || option) /* This method will free a memory bitmap */ @@ -390,17 +390,10 @@ /* The given bitmap will be shown instead of a push button */ ::method AddBitmapButton - use arg id, x, y, cx, cy, text, fnk, bmp, focus, sel, disabl, opts + use arg id, x, y, cx = 0, cy = 0, text = "", fnk = "", bmp, focus = "", sel = "", disabl, opts if self~activePtr = 0 then return -2 id = self~CheckId(id) if id = -1 then return - if Arg(4, 'o') = 1 then cx = 0 - if Arg(5, 'o') = 1 then cy = 0 - if Arg(6, 'o') = 1 then text = "" - if Arg(7, 'o') = 1 then fnk = "" - if Arg(9, 'o') = 1 then focus = "" - if Arg(10, 'o') = 1 then sel = "" - if Arg(11, 'o') = 1 then disabl = "" opts = self~GetDefaultOpts(opts) || " OWNER" if focus = "" & sel = "" & opts~wordpos("FRAME") = 0 & opts~wordpos("TAB") = 0 then opts = opts || " NOTAB" @@ -410,12 +403,8 @@ ::method ConnectBitmapButton - use arg id, msgToRise, bmpNormal, bmpFocused, bmpSelected, bmpDisabled, styleOptions - if Arg(2,'o') = 1 then msgToRise = "" - if Arg(4,'o') = 1 then bmpFocused = "" - if Arg(5,'o') = 1 then bmpSelected = "" - if Arg(6,'o') = 1 then bmpDisabled = "" - if Arg(7,'o') = 1 then styleOptions = ""; else styleOptions = styleOptions~translate + use arg id, msgToRise = "", bmpNormal, bmpFocused = "", bmpSelected = "", bmpDisabled = "", styleOptions = "" + styleOptions = styleOptions~translate if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) if id = -1 then return -1 return BmpButton(self~Adm, "A", msgToRise, id, bmpNormal, bmpFocused, bmpSelected, bmpDisabled, styleOptions); @@ -425,13 +414,10 @@ /* possible options are: (see ConnectBitmapButton) */ ::method ChangeBitmapButton unguarded - use arg id, bmpNormal, bmpFocused, bmpSelected, bmpDisabled, styleOptions - if Arg(3,'o') = 1 then bmpFocused = "" - if Arg(4,'o') = 1 then bmpSelected = "" - if Arg(5,'o') = 1 then bmpDisabled = "" - if Arg(6,'o') = 1 then styleOptions = ""; else styleOptions = styleOptions~translate + use arg id, bmpNormal, bmpFocused = "", bmpSelected = "", bmpDisabled + "", styleOptions = "" if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) if id = -1 then return -1 + styleOptions = styleOptions~translate return BmpButton(self~Adm, "C", id, bmpNormal, bmpFocused, bmpSelected, bmpDisabled, styleOptions); /* Sets the position of a bitmap within a button */ @@ -471,17 +457,16 @@ /* "USEPAL" : This will use the color palette of the bitmap */ ::method BackgroundBitmap - use arg bmpFilename, option - if Arg(2, 'o') = 1 then option = ""; else option = option~translate + use arg bmpFilename, option = "" + option = option~translate self~BkgBitmap = self~LoadBitmap(bmpFilename, option) ret = SetBackground(self~Adm, "BMP", self~BkgBitmap) ::method CreateBrush unguarded - use arg color, brushSpecifier + use arg color = 1, brushSpecifier = "" if Arg() = 0 then return HandleDC_Obj("B") - if Arg(1, "o") = 1 then color = 1 - if Arg(2, "o") = 1 then return HandleDC_Obj("B", color) + if brushSpecifier == "" then return HandleDC_Obj("B", color) brushSpecifier = brushSpecifier~translate if brushSpecifier = "UPDIAGONAL" | brushSpecifier = "DOWNDIAGONAL" | brushSpecifier = "CROSS" | brushSpecifier = "DIAGCROSS", | brushSpecifier = "HORIZONTAL" | brushSpecifier = "VERTICAL" then return HandleDC_Obj("B", color, brushSpecifier) @@ -511,11 +496,11 @@ ::method ScrollInButton unguarded use arg id, text, fontName, fontSize, fontStyle, displaceY, step, sleep, color - hnd = self~GetItem(id) + hwnd = self~GetItem(id) if Arg() = 1 then - return self~ScrollText(hnd) + return self~ScrollText(hwnd) else - return self~ScrollText(hnd, text, fontName, fontSize, fontStyle, displaceY, step, sleep, color) + return self~ScrollText(hwnd, text, fontName, fontSize, fontStyle, displaceY, step, sleep, color) /* This method will scroll text in a window with the given size, font, */ @@ -603,9 +588,9 @@ ::method RedrawButton unguarded use arg id, erasebkg - hnd = self~GetItem(id) + hwnd = self~GetItem(id) if Arg(2, 'o') = 1 then erasebkg = 0 - return WindowRect("RDW", hnd, erasebkg) + return WindowRect("RDW", hwnd, erasebkg) /* This method redraws the rectangle of the given window */ @@ -629,12 +614,8 @@ /* "HEAVY" */ ::method WriteToWindow unguarded - use arg hwnd, xPos, yPos, text, fontName, fontSize, fontStyle, fgColor, bkColor - if Arg(5, "o") = 1 then fontName = "System" - if Arg(6, "o") = 1 then fontSize = 10 - if Arg(7, "o") = 1 then fontStyle = ""; else fontStyle = fontStyle~translate - if Arg(8, "o") = 1 then fgColor = -1 - if Arg(9, "o") = 1 then bkColor = -1 + use arg hwnd, xPos, yPos, text, fontName = "System", fontSize = 10, fontStyle = "", fgColor = -1, bkColor = -1 + fontStyle = fontStyle~translate return WriteText(hwnd, xPos, yPos, text, fontName, fontSize, fontStyle, fgColor, bkColor) /* more than 6 arguments means use font */ @@ -677,8 +658,8 @@ ::method FreeButtonDC unguarded use arg id, dc - hnd = self~GetItem(id) - return self~FreeWindowDC(hnd, dc) + hwnd = self~GetItem(id) + return self~FreeWindowDC(hwnd, dc) /* This method will return the horizontal bitmap extension */ @@ -992,7 +973,7 @@ return self~addUserMsg(msgToRaise, 0x00000111, 0xFFFFFFFF, id, 0x0000FFFF, 0, 0) --- Connect WM_CONTEXTMENU messages to a method. +-- Connect WM_CONTEXTMENU messages to a method. TODO - this doesn't seem like the right place for this, what was I thinking? ::method connectContextMenu use strict arg msgToRaise, hwnd = .nil if hwnd \== .nil then return self~addUserMsg(msgToRaise, 0x0000007B, 0xFFFFFFFF, hwnd, 0xFFFFFFFF, 0, 0, 0x00000201) @@ -1002,10 +983,9 @@ return GetDlgMsg(self~Adm, "Peek") ::method SetWindowRect unguarded - use arg hnd, x, y, width, high, showOptions - if Arg(6,"o") = 1 then showOptions = ""; else showOptions = showOptions~translate - if hnd = 0 | hnd~datatype("N") = 0 then return -1 - return WndShow_Pos("P",hnd, x, y, width, high, showOptions) + use arg hwnd, x, y, width, high, showOptions = "" + showOptions = showOptions~translate + return WndShow_Pos("P",hwnd, x, y, width, high, showOptions) /* Redraws the given rectangle */ ::method RedrawRect unguarded @@ -1015,8 +995,8 @@ return WindowRect("RDW", hwnd,left,top,right,bottom, erasebkg) ::method RedrawWindow unguarded - use arg hnd - return WndShow_Pos("S", hnd, "REDRAW") + use arg hwnd + return WndShow_Pos("S", hwnd, "REDRAW") ::method GetFocus unguarded return Wnd_Desktop("GETFOC", self~DlgHandle) @@ -1039,9 +1019,8 @@ return Wnd_Desktop("CAP", self~DlgHandle, "R") ::method IsMouseButtonDown - use arg mb - if Arg(1,'o') = 1 then mb = "LEFT" - else mb = mb~translate~space(0) + use arg mb = "LEFT" + mb = mb~translate~space(0) if mb = "LEFT" then return Wnd_Desktop("KSTAT", self~DlgHandle,1) /* VK_LBUTTON */ if mb = "MIDDLE" then return Wnd_Desktop("KSTAT", self~DlgHandle,4) /* VK_MBUTTON */ if mb = "RIGHT" then return Wnd_Desktop("KSTAT", self~DlgHandle,2) /* VK_RBUTTON */ Modified: main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp 2009-04-18 19:42:36 UTC (rev 4423) +++ main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp 2009-04-18 20:17:50 UTC (rev 4424) @@ -409,6 +409,13 @@ LONG ibuffer[5], opts; register int i; + // Docs for setWindowRect() have said: returns 0 if repositioning was + // successful, returns 1 if failed. + if ( w == NULL || ! IsWindow(w) ) + { + RETC(1) + } + CHECKARGL(6); for (i=0;i<5;i++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-04-18 23:11:56
|
Revision: 4425 http://oorexx.svn.sourceforge.net/oorexx/?rev=4425&view=rev Author: miesfeld Date: 2009-04-18 23:11:40 +0000 (Sat, 18 Apr 2009) Log Message: ----------- Continue with plan to convert all oodialog to new native API Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/oovother.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.cpp Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-04-18 20:17:50 UTC (rev 4424) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-04-18 23:11:40 UTC (rev 4425) @@ -875,6 +875,7 @@ if \ item~datatype('W') then raise syntax 93.905 array(1, item) return (HandleListCtrlEx(self~Hwnd, "M", "CHK", item) == 1) +::method insertColumnEx external "LIBRARY oodialog lv_insertColumnEx" -- TODO review method name ::method InsertColumn use arg nr, text, width, fmt if arg(1,'O') then nr = 0 @@ -906,6 +907,8 @@ return InternalLVColInfo. +::method stringWidthEx external "LIBRARY oodialog lv_stringWidthEx" -- TODO review method name +::method columnWidthEx external "LIBRARY oodialog lv_columnWidthEx" -- TODO review method name ::method ColumnWidth use arg nr if Arg(1,'o') = 1 then return -1 @@ -994,6 +997,7 @@ end return item +::method addRowEx external "LIBRARY oodialog lv_addRowEx" -- TODO review method name ::method Delete use arg item Modified: main/trunk/extensions/platform/windows/oodialog/oovother.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-04-18 20:17:50 UTC (rev 4424) +++ main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-04-18 23:11:40 UTC (rev 4425) @@ -2690,6 +2690,15 @@ userDefinedMsgException(c, buffer); } +void missingIndexInDirectoryException(RexxMethodContext *c, int argPos, CSTRING index) +{ + TCHAR buffer[256]; + _snprintf(buffer, sizeof(buffer), + "Index, %s, of method argument %d is required", + index, argPos); + userDefinedMsgException(c, buffer); +} + void emptyArrayException(RexxMethodContext *c, int argPos) { TCHAR buffer[256]; @@ -3786,6 +3795,23 @@ return true; } +bool rxIntFromDirectory(RexxMethodContext *context, RexxDirectoryObject d, CSTRING index, + int *number, int argPos) +{ + int value; + RexxObjectPtr obj = context->DirectoryAt(d, index); + if ( obj != NULLOBJECT ) + { + if ( ! context->Int32(obj, &value) ) + { + wrongObjInDirectoryException(context, argPos, index, "an integer", obj); + return false; + } + *number = value; + } + return true; +} + extern int getWeight(CSTRING opts); /** WindowExtensions::createFont() @@ -4183,21 +4209,6 @@ enum DateTimePart {dtFull, dtTime, dtDate, dtNow}; -static wholenumber_t getDateTimePart(RexxMethodContext *c, RexxObjectPtr dateTime, const char *part) -{ - wholenumber_t num; - - RexxObjectPtr rxNum = c->SendMessage0(dateTime, part); - if ( rxNum == NULLOBJECT || ! c->WholeNumber(rxNum, &num) ) - { - TCHAR buffer[128]; - _snprintf(buffer, sizeof(buffer), "The DateTime object failed to produce a valid %s", part); - userDefinedMsgException(c, buffer); - num = -1; - } - return num; -} - /** * Converts a DateTime object to a SYSTEMTIME structure. The fields of the * struct are filled in with the corresponding values of the DateTime object. @@ -4230,6 +4241,10 @@ RexxObjectPtr dt = c->SendMessage0(dateTime, "ISODATE"); const char *isoDate = c->CString(dt); + sscanf(isoDate, "%4hu-%2hu-%2huT%2hu:%2hu:%2hu.%3hu", &(*sysTime).wYear, &(*sysTime).wMonth, &(*sysTime).wDay, + &(*sysTime).wHour, &(*sysTime).wMinute, &(*sysTime).wSecond, &(*sysTime).wMilliseconds); + printf("year=%hu milliseconds=%hu\n", sysTime->wYear, sysTime->wMilliseconds); + SYSTEMTIME st = {0}; sscanf(isoDate, "%4hu-%2hu-%2huT%2hu:%2hu:%2hu.%3hu", &st.wYear, &st.wMonth, &st.wDay, &st.wHour, &st.wMinute, &st.wSecond, &st.wMilliseconds); @@ -5032,6 +5047,171 @@ return success; } +// TODO review method name +RexxMethod5(int, lv_insertColumnEx, OPTIONAL_uint16_t, column, CSTRING, text, uint16_t, width, + OPTIONAL_CSTRING, fmt, OSELF, self) +{ + HWND hwnd = rxGetWindowHandle(context, self); + + LVCOLUMN lvi = {0}; + int retVal = 0; + char szText[256]; + + lvi.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_FMT | LVCF_WIDTH; + + // If omitted, column is 0, which is also the default. + lvi.iSubItem = column; + + lvi.cchTextMax = (int)strlen(text); + if ( lvi.cchTextMax > (sizeof(szText) - 1) ) + { + userDefinedMsgException(context, 2, "the column title must be less than 256 characters"); + return 0; + } + strcpy(szText, text); + lvi.pszText = szText; + lvi.cx = width; + + lvi.fmt = LVCFMT_LEFT; + if ( argumentExists(4) ) + { + char f = toupper(*fmt); + if ( f == 'C' ) + { + lvi.fmt = LVCFMT_CENTER; + } + else if ( f == 'R' ) + { + lvi.fmt = LVCFMT_RIGHT; + } + } + + retVal = ListView_InsertColumn(hwnd, lvi.iSubItem, &lvi); + if ( retVal != -1 && lvi.fmt != LVCFMT_LEFT && lvi.iSubItem == 0 ) + { + /* According to the MSDN docs: "If a column is added to a + * list-view control with index 0 (the leftmost column) and with + * LVCFMT_RIGHT or LVCFMT_CENTER specified, the text is not + * right-aligned or centered." This is the suggested work around. + */ + lvi.iSubItem = 1; + ListView_InsertColumn(hwnd, lvi.iSubItem, &lvi); + ListView_DeleteColumn(hwnd, 0); + } + return retVal; +} + +// TODO review method name +RexxMethod2(int, lv_columnWidthEx, uint16_t, column, OSELF, self) +{ + HWND hwnd = rxGetWindowHandle(context, self); + return ListView_GetColumnWidth(hwnd, column); +} + +// TODO review method name +RexxMethod2(int, lv_stringWidthEx, CSTRING, text, OSELF, self) +{ + HWND hwnd = rxGetWindowHandle(context, self); + return ListView_GetStringWidth(hwnd, text); +} + +// TODO review method name +RexxMethod5(int, lv_addRowEx, CSTRING, text, OPTIONAL_int, itemIndex, OPTIONAL_int, imageIndex, + OPTIONAL_RexxObjectPtr, subItems, OSELF, self) +{ + //RexxMethodContext *context; + HWND hwnd = rxGetWindowHandle(context, self); + + if ( argumentOmitted(2) ) + { + RexxObjectPtr last = context->SendMessage0(self, "LASTITEM"); + if ( last != NULLOBJECT ) + { + context->Int32(last, &itemIndex); + itemIndex++; + } + else + { + itemIndex = 0; + } + } + + if ( argumentOmitted(3) ) + { + imageIndex = -1; + } + + LV_ITEM lvi; + lvi.mask = LVIF_TEXT; + + lvi.iItem = itemIndex; + lvi.iSubItem = 0; + lvi.pszText = (LPSTR)text; + + if ( imageIndex > -1 ) + { + lvi.iImage = imageIndex; + lvi.mask |= LVIF_IMAGE; + } + + itemIndex = ListView_InsertItem(hwnd, &lvi); + + if ( itemIndex == -1 ) + { + goto done_out; + } + context->SendMessage1(self, "LASTITEM=", context->Int32(itemIndex)); + + if ( argumentOmitted(4) ) + { + goto done_out; + } + if ( ! context->IsArray(subItems) ) + { + wrongClassException(context, 4, "Array"); + goto done_out; + } + + size_t count = context->ArrayItems((RexxArrayObject)subItems); + for ( size_t i = 1; i <= count; i++) + { + RexxDirectoryObject subItem = (RexxDirectoryObject)context->ArrayAt((RexxArrayObject)subItems, i); + if ( subItem == NULLOBJECT || ! context->IsDirectory(subItem) ) + { + wrongObjInArrayException(context, 4, i, "Directory"); + goto done_out; + } + + RexxObjectPtr subItemText = context->DirectoryAt(subItem, "TEXT"); + if ( subItemText == NULLOBJECT ) + { + missingIndexInDirectoryException(context, 4, "TEXT"); + goto done_out; + } + imageIndex = -1; + if ( ! rxIntFromDirectory(context, subItem, "ICON", &imageIndex, 4) ) + { + goto done_out; + } + + lvi.mask = LVIF_TEXT; + lvi.iSubItem = (int)i; + lvi.pszText = (LPSTR)context->ObjectToStringValue(subItemText); + + if ( imageIndex > -1 ) + { + lvi.iImage = imageIndex; + lvi.mask |= LVIF_IMAGE; + } + + ListView_SetItem(hwnd, &lvi); + } + +done_out: + return itemIndex; +} + + /** * Methods for the .TreeControl class. */ Modified: main/trunk/extensions/platform/windows/oodialog/oovutil.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-18 20:17:50 UTC (rev 4424) +++ main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-18 23:11:40 UTC (rev 4425) @@ -2146,6 +2146,10 @@ REXX_METHOD_PROTOTYPE(lv_getColumnCount); REXX_METHOD_PROTOTYPE(lv_getColumnOrder); REXX_METHOD_PROTOTYPE(lv_setColumnOrder); +REXX_METHOD_PROTOTYPE(lv_insertColumnEx); // TODO review method name +REXX_METHOD_PROTOTYPE(lv_columnWidthEx); // TODO review method name +REXX_METHOD_PROTOTYPE(lv_stringWidthEx); // TODO review method name +REXX_METHOD_PROTOTYPE(lv_addRowEx); // TODO review method name REXX_METHOD_PROTOTYPE(tv_setImageList); REXX_METHOD_PROTOTYPE(tv_getImageList); @@ -2306,6 +2310,10 @@ REXX_METHOD(lv_getColumnCount, lv_getColumnCount), REXX_METHOD(lv_getColumnOrder, lv_getColumnOrder), REXX_METHOD(lv_setColumnOrder, lv_setColumnOrder), + REXX_METHOD(lv_insertColumnEx, lv_insertColumnEx), // TODO review method name + REXX_METHOD(lv_columnWidthEx, lv_columnWidthEx), // TODO review method name + REXX_METHOD(lv_stringWidthEx, lv_stringWidthEx), // TODO review method name + REXX_METHOD(lv_addRowEx, lv_addRowEx), // TODO review method name REXX_METHOD(tv_setImageList, tv_setImageList), REXX_METHOD(tv_getImageList, tv_getImageList), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-04-19 04:26:48
|
Revision: 4427 http://oorexx.svn.sourceforge.net/oorexx/?rev=4427&view=rev Author: miesfeld Date: 2009-04-19 04:26:37 +0000 (Sun, 19 Apr 2009) Log Message: ----------- Removed declared but undefined symbols Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/dlgext.cls main/trunk/extensions/platform/windows/oodialog/oodialog.mak main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp main/trunk/extensions/platform/windows/oodialog/oovdata.cpp main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp main/trunk/extensions/platform/windows/oodialog/oovtext.cpp main/trunk/extensions/platform/windows/oodialog/oovtools.cpp main/trunk/extensions/platform/windows/oodialog/oovuser.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.h Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-04-19 03:32:47 UTC (rev 4426) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-04-19 04:26:37 UTC (rev 4427) @@ -345,11 +345,11 @@ symbid = id id = self~itemAdd(id) if id < 0 then return id - if arg(2, 'O') then attributeName = "DATA"id + if attributeName = "" then attributeName = "DATA"id opts = self~getDefaultOpts(opts) self~activePtr = UsrAddNewCtrl("DTP", self~activePtr, id, x, y, cx, cy, opts) if self~autoDetect then do - return self~connectDateTimePicker(symbid, attributeName) + return self~connectDateTimePicker(symbid, attributeName) end return 0 @@ -358,11 +358,11 @@ symbid = id id = self~itemAdd(id) if id < 0 then return id - if arg(2, 'O') then attributeName = "DATA"id + if attributeName = "" then attributeName = "DATA"id opts = self~getDefaultOpts(opts) self~activePtr = UsrAddNewCtrl("MONTH", self~activePtr, id, x, y, cx, cy, opts) - if self~autoDetect - return self~connectMonthCalendar(symbid, attributeName) + if self~autoDetect then do + return self~connectMonthCalendar(symbid, attributeName) end return 0 Modified: main/trunk/extensions/platform/windows/oodialog/dlgext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-04-19 03:32:47 UTC (rev 4426) +++ main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-04-19 04:26:37 UTC (rev 4427) @@ -390,7 +390,7 @@ /* The given bitmap will be shown instead of a push button */ ::method AddBitmapButton - use arg id, x, y, cx = 0, cy = 0, text = "", fnk = "", bmp, focus = "", sel = "", disabl, opts + use arg id, x, y, cx = 0, cy = 0, text = "", fnk = "", bmp, focus = "", sel = "", disabl = "", opts if self~activePtr = 0 then return -2 id = self~CheckId(id) if id = -1 then return @@ -414,7 +414,7 @@ /* possible options are: (see ConnectBitmapButton) */ ::method ChangeBitmapButton unguarded - use arg id, bmpNormal, bmpFocused = "", bmpSelected = "", bmpDisabled + "", styleOptions = "" + use arg id, bmpNormal, bmpFocused = "", bmpSelected = "", bmpDisabled = "", styleOptions = "" if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) if id = -1 then return -1 styleOptions = styleOptions~translate @@ -614,7 +614,7 @@ /* "HEAVY" */ ::method WriteToWindow unguarded - use arg hwnd, xPos, yPos, text, fontName = "System", fontSize = 10, fontStyle = "", fgColor = -1, bkColor = -1 + use arg hwnd, xPos, yPos, text, fontName = "System", fontSize = 10, fontStyle = "", fgColor = (-1), bkColor = (-1) fontStyle = fontStyle~translate return WriteText(hwnd, xPos, yPos, text, fontName, fontSize, fontStyle, fgColor, bkColor) /* more than 6 arguments means use font */ Modified: main/trunk/extensions/platform/windows/oodialog/oodialog.mak =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodialog.mak 2009-04-19 03:32:47 UTC (rev 4426) +++ main/trunk/extensions/platform/windows/oodialog/oodialog.mak 2009-04-19 04:26:37 UTC (rev 4427) @@ -49,7 +49,7 @@ $(OR_OUTDIR)\oodialog.res .c{$(OR_OUTDIR)}.obj: - $(C) $(OPTIONS) /DINCL_32 -c $(@B).c /DCREATEDLL /Fo$(OR_OUTDIR)\$(@B).obj + $(C) $(OPTIONS) /DINCL_32 -c $(@B).c /Fo$(OR_OUTDIR)\$(@B).obj # # *** .cpp -> .obj rules @@ -57,13 +57,13 @@ {$(OR_OODIALOGSRC)}.cpp{$(OR_OUTDIR)}.obj: @ECHO . @ECHO Compiling $(@B).cpp - $(OR_CC) $(cflags_common) $(cflags_dll) /DCREATEDLL /Fo$(OR_OUTDIR)\$(@B).obj $(OR_ORYXINCL) $(OR_OODIALOGSRC)\$(@B).cpp + $(OR_CC) $(cflags_common) $(cflags_dll) /Fo$(OR_OUTDIR)\$(@B).obj $(OR_ORYXINCL) $(OR_OODIALOGSRC)\$(@B).cpp {$(OR_OODIALOGSRC)}.c{$(OR_OUTDIR)}.obj: @ECHO . @ECHO Compiling $(@B).c - $(OR_CC) $(cflags_common) $(cflags_dll) /DCREATEDLL /Fo$(OR_OUTDIR)\$(@B).obj $(OR_ORYXINCL) $(OR_OODIALOGSRC)\$(@B).c + $(OR_CC) $(cflags_common) $(cflags_dll) /Fo$(OR_OUTDIR)\$(@B).obj $(OR_ORYXINCL) $(OR_OODIALOGSRC)\$(@B).c $(OR_OUTDIR)\oodialog.dll: $(SOURCEF) Modified: main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp 2009-04-19 03:32:47 UTC (rev 4426) +++ main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp 2009-04-19 04:26:37 UTC (rev 4427) @@ -54,7 +54,6 @@ extern BOOL DrawButton(DIALOGADMIN *,INT id); extern LRESULT PaletteMessage(DIALOGADMIN * addr, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); extern HWND ScrollingButton; -extern BOOL IsNT; extern HWND RedrawScrollingButton; @@ -269,38 +268,32 @@ MoveToEx(dis->hDC, dis->rcItem.left+2, dis->rcItem.top+2, &lp); LineTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.top+2); MoveToEx(dis->hDC, dis->rcItem.left+2, dis->rcItem.bottom-2, &lp); - if (IsNT) - LineTo(dis->hDC, dis->rcItem.left+2, dis->rcItem.top+1); - else - LineTo(dis->hDC, dis->rcItem.left+2, dis->rcItem.top+2); + LineTo(dis->hDC, dis->rcItem.left+2, dis->rcItem.top+1); + SelectObject(dis->hDC, oP); DeleteObject(nP); } else { /* white line */ - nP = CreatePen(PS_SOLID, 2, RGB(240,240,240)); + nP = CreatePen(PS_SOLID, 2, RGB(240,240,240)); oP = (HPEN)SelectObject(dis->hDC, nP); MoveToEx(dis->hDC, dis->rcItem.left+2, dis->rcItem.top+2, &lp); LineTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.top+2); MoveToEx(dis->hDC, dis->rcItem.left+2, dis->rcItem.bottom-2, &lp); - if (IsNT) - LineTo(dis->hDC, dis->rcItem.left+2, dis->rcItem.top+1); - else - LineTo(dis->hDC, dis->rcItem.left+2, dis->rcItem.top+2); + LineTo(dis->hDC, dis->rcItem.left+2, dis->rcItem.top+1); + SelectObject(dis->hDC, oP); DeleteObject(nP); /* grey line */ nP = CreatePen(PS_SOLID, 2, RGB(120,120,120)); oP = (HPEN)SelectObject(dis->hDC, nP); - if (IsNT) - MoveToEx(dis->hDC, dis->rcItem.right-2, dis->rcItem.top+2, &lp); - else - MoveToEx(dis->hDC, dis->rcItem.right-2, dis->rcItem.top+4, &lp); + MoveToEx(dis->hDC, dis->rcItem.right-2, dis->rcItem.top+2, &lp); LineTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.bottom-2); MoveToEx(dis->hDC, dis->rcItem.left+2, dis->rcItem.bottom-2, &lp); LineTo(dis->hDC, dis->rcItem.right-2, dis->rcItem.bottom-2); + SelectObject(dis->hDC, oP); DeleteObject(nP); } Modified: main/trunk/extensions/platform/windows/oodialog/oovdata.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovdata.cpp 2009-04-19 03:32:47 UTC (rev 4426) +++ main/trunk/extensions/platform/windows/oodialog/oovdata.cpp 2009-04-19 04:26:37 UTC (rev 4427) @@ -45,7 +45,6 @@ #ifdef __CTL3D #include <ctl3d.h> #endif -#define EXTERNALFUNCS #include "oovutil.h" @@ -474,8 +473,8 @@ if (!GetMonthCalendarData(hW, data, id)) data[0] = '\0'; break; - default: if (GetItemDataExternal) (*GetItemDataExternal)(hW, id, k, data, DATA_BUFFER-1); - else data[0] = '\0'; + default: + data[0] = '\0'; } size_t len = strlen(data); @@ -601,14 +600,7 @@ RETC(!SetMonthCalendarData(hW, data, id)) default: - if (SetItemDataExternal) - { - return(*SetItemDataExternal)(dlgAdm, hW, id, k, data); - } - else - { - RETC(1); - } + RETC(1); } } @@ -701,10 +693,6 @@ { SetTabCtrlData(hW, data, dlgAdm->DataTab[j].id); } - else if (SetStemDataExternal) - { - (*SetStemDataExternal)(dlgAdm, hW, dlgAdm->DataTab[j].id, dlgAdm->DataTab[j].typ, data); - } } } RETC(0); @@ -778,8 +766,9 @@ { if (!GetTabCtrlData(hW, data, dlgAdm->DataTab[j].id)) data[0] = '\0'; } else - if (GetStemDataExternal) - if (!(*GetStemDataExternal)(hW, dlgAdm->DataTab[j].id, dlgAdm->DataTab[j].typ, data, (DATA_BUFFER-1))) data[0] = '\0'; + { + data[0] = '\0'; + } sprintf(sname,"%s.%d",name,dlgAdm->DataTab[j].id); Modified: main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp 2009-04-19 03:32:47 UTC (rev 4426) +++ main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp 2009-04-19 04:26:37 UTC (rev 4427) @@ -50,11 +50,6 @@ #include "oovutil.h" #include <commctrl.h> - -extern CRITICAL_SECTION crit_sec; /* defined in OOVUTIL.C */ -extern BOOL DialogInAdminTable(DIALOGADMIN * Dlg); - - BOOL AddDialogMessage(CHAR * msg, CHAR * Qptr) { if (strlen(Qptr) + strlen(msg) + 1 < MAXLENQUEUE) Modified: main/trunk/extensions/platform/windows/oodialog/oovtext.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovtext.cpp 2009-04-19 03:32:47 UTC (rev 4426) +++ main/trunk/extensions/platform/windows/oodialog/oovtext.cpp 2009-04-19 04:26:37 UTC (rev 4427) @@ -46,7 +46,6 @@ #endif #include "oovutil.h" -extern WPARAM InterruptScroll = 0; extern HWND ScrollingButton = NULL; extern HWND RedrawScrollingButton = NULL; HANDLE TimerEvent = NULL; @@ -176,7 +175,7 @@ if (!dlgAdm) RETERR - text = argv[2].strptr; + text = argv[2].strptr; size = atoi(argv[4].strptr); opts = argv[5].strptr; disply = atoi(argv[6].strptr); Modified: main/trunk/extensions/platform/windows/oodialog/oovtools.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovtools.cpp 2009-04-19 03:32:47 UTC (rev 4426) +++ main/trunk/extensions/platform/windows/oodialog/oovtools.cpp 2009-04-19 04:26:37 UTC (rev 4427) @@ -43,6 +43,19 @@ #include "oovutil.h" +BOOL DialogInAdminTable(DIALOGADMIN * Dlg) +{ + register INT i; + for ( i = 0; i < StoredDialogs; i++ ) + { + if ( DialogTab[i] == Dlg ) + { + break; + } + } + return(i < StoredDialogs); +} + void rxstrlcpy(CHAR * tar, CONSTRXSTRING &src) { register UINT i; Modified: main/trunk/extensions/platform/windows/oodialog/oovuser.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovuser.cpp 2009-04-19 03:32:47 UTC (rev 4426) +++ main/trunk/extensions/platform/windows/oodialog/oovuser.cpp 2009-04-19 04:26:37 UTC (rev 4427) @@ -55,8 +55,6 @@ extern BOOL InstallNecessaryStuff(DIALOGADMIN * dlgAdm, CONSTRXSTRING ar[], size_t argc); extern BOOL DataAutodetection(DIALOGADMIN * aDlg); extern INT DelDialog(DIALOGADMIN * aDlg); -extern CRITICAL_SECTION crit_sec; -extern BOOL DialogInAdminTable(DIALOGADMIN * Dlg); extern BOOL GetDialogIcons(DIALOGADMIN *, INT, UINT, PHANDLE, PHANDLE); //#define USE_DS_CONTROL Modified: main/trunk/extensions/platform/windows/oodialog/oovutil.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-19 03:32:47 UTC (rev 4426) +++ main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-19 04:26:37 UTC (rev 4427) @@ -44,27 +44,23 @@ #include "oorexxapi.h" #include <stdio.h> #include <dlgs.h> -/* set the noglob... so global variables wont be defined twice */ -#define NOGLOBALVARIABLES 1 #include "oovutil.h" -#undef NOGLOBALVARIABLES #include "oodResources.h" -extern HINSTANCE MyInstance = NULL; +HINSTANCE MyInstance = NULL; +DIALOGADMIN * DialogTab[MAXDIALOGS] = {NULL}; +DIALOGADMIN * topDlg = {NULL}; +INT StoredDialogs = 0; +CRITICAL_SECTION crit_sec = {0}; -extern DIALOGADMIN * DialogTab[MAXDIALOGS] = {NULL}; -extern DIALOGADMIN * topDlg = {NULL}; -extern INT StoredDialogs = 0; -extern CRITICAL_SECTION crit_sec = {0}; -extern WPARAM InterruptScroll; +extern INT DelDialog(DIALOGADMIN * aDlg); extern BOOL SearchMessageTable(ULONG message, WPARAM param, LPARAM lparam, DIALOGADMIN * addressedTo); extern BOOL DrawBitmapButton(DIALOGADMIN * addr, HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL MsgEnabled); extern BOOL DrawBackgroundBmp(DIALOGADMIN * addr, HWND hDlg, WPARAM wParam, LPARAM lParam); extern BOOL DataAutodetection(DIALOGADMIN * aDlg); extern LRESULT PaletteMessage(DIALOGADMIN * addr, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); extern BOOL AddDialogMessage(CHAR * msg, CHAR * Qptr); -extern BOOL IsNT = TRUE; extern LONG HandleError(PRXSTRING r, CHAR * text); extern LONG SetRexxStem(const char * name, INT id, const char * secname, const char * data); extern BOOL GetDialogIcons(DIALOGADMIN *, INT, UINT, PHANDLE, PHANDLE); @@ -77,7 +73,6 @@ extern void removeKeyPressMethod(KEYPRESSDATA *, UINT); /* Local functions */ -INT DelDialog(DIALOGADMIN * aDlg); static LONG installKBHook(DIALOGADMIN *, HWND, CONSTRXSTRING, CONSTRXSTRING, const char *); static LONG setKBHook(DIALOGADMIN *, HWND); static void removeKBHook(DIALOGADMIN *); @@ -140,14 +135,6 @@ } -BOOL DialogInAdminTable(DIALOGADMIN * Dlg) -{ - register INT i; - for (i = 0; i < StoredDialogs; i++) - if (DialogTab[i] == Dlg) break; - return (i < StoredDialogs); -} - /* dialog procedure handles the search for user defined messages and bitmap buttons handles messages necessary for 3d controls @@ -1904,26 +1891,19 @@ extern "C" { #endif -BOOL REXXENTRY DllMain( - HINSTANCE hinstDLL, // handle of DLL module - DWORD fdwReason, // reason for calling function - LPVOID lpvReserved // reserved - ) +BOOL REXXENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { - OSVERSIONINFO version_info={0}; /* for optimization so that GetVersionEx */ - - if (fdwReason == DLL_PROCESS_ATTACH) { - MyInstance = hinstDLL; - version_info.dwOSVersionInfoSize = sizeof(version_info); // if not set --> violation error - GetVersionEx(&version_info); - if (version_info.dwPlatformId == VER_PLATFORM_WIN32_NT) IsNT = TRUE; else IsNT = FALSE; - InitializeCriticalSection(&crit_sec); - } else if (fdwReason == DLL_PROCESS_DETACH) - { - MyInstance = NULL; - DeleteCriticalSection(&crit_sec); - } - return(TRUE); + if ( fdwReason == DLL_PROCESS_ATTACH ) + { + MyInstance = hinstDLL; + InitializeCriticalSection(&crit_sec); + } + else if ( fdwReason == DLL_PROCESS_DETACH ) + { + MyInstance = NULL; + DeleteCriticalSection(&crit_sec); + } + return(TRUE); } #ifdef __cplusplus Modified: main/trunk/extensions/platform/windows/oodialog/oovutil.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovutil.h 2009-04-19 03:32:47 UTC (rev 4426) +++ main/trunk/extensions/platform/windows/oodialog/oovutil.h 2009-04-19 04:26:37 UTC (rev 4427) @@ -512,47 +512,16 @@ } DIALOGADMIN; +// These global variables are defined in oovutil.cpp +extern HINSTANCE MyInstance; +extern DIALOGADMIN * DialogTab[]; +extern DIALOGADMIN * topDlg; +extern INT StoredDialogs; +extern CRITICAL_SECTION crit_sec; -#ifdef EXTERNALFUNCS -typedef LONG REXXENTRY GETITEMDATAEXTERNALFN (HANDLE, ULONG, UINT, PCHAR, ULONG); -typedef LONG REXXENTRY SETITEMDATAEXTERNALFN (DIALOGADMIN *, HANDLE, ULONG, UINT, const char *); -typedef LONG REXXENTRY GETSTEMDATAEXTERNALFN (HANDLE, ULONG, ULONG, PCHAR, ULONG); -typedef LONG REXXENTRY SETSTEMDATAEXTERNALFN (DIALOGADMIN *, HANDLE, ULONG, ULONG, const char *); -#endif - -#ifdef CREATEDLL -/* tools */ +// These utility functions are defined in oovtools.cpp +extern BOOL DialogInAdminTable(DIALOGADMIN * Dlg); extern void rxstrlcpy(CHAR * tar, CONSTRXSTRING &src); extern void rxdatacpy(CHAR * tar, RXSTRING &src); extern bool IsYes(const char *s); -/* global variables */ -#ifndef NOGLOBALVARIABLES -extern _declspec(dllexport) HINSTANCE MyInstance; -extern _declspec(dllexport) DIALOGADMIN * DialogTab[MAXDIALOGS]; -extern _declspec(dllexport) DIALOGADMIN * topDlg; -extern _declspec(dllexport) INT StoredDialogs; -extern _declspec(dllexport) BOOL ReleaseMain; -#ifdef EXTERNALFUNCS -extern _declspec(dllexport) GETITEMDATAEXTERNALFN * GetItemDataExternal = NULL; -extern _declspec(dllexport) SETITEMDATAEXTERNALFN * SetItemDataExternal = NULL; -extern _declspec(dllexport) GETSTEMDATAEXTERNALFN * GetStemDataExternal = NULL; -extern _declspec(dllexport) SETSTEMDATAEXTERNALFN * SetStemDataExternal = NULL; -#endif - -#endif - -#else -extern _declspec(dllimport) HINSTANCE MyInstance; -extern _declspec(dllimport) DIALOGADMIN * DialogTab[MAXDIALOGS]; -extern _declspec(dllimport) DIALOGADMIN * topDlg; -extern _declspec(dllimport) INT StoredDialogs; -extern _declspec(dllimport) BOOL ReleaseMain; -#ifdef EXTERNALFUNCS -extern _declspec(dllimport) GETITEMDATAEXTERNALFN * GetItemDataExternal; -extern _declspec(dllimport) SETITEMDATAEXTERNALFN * SetItemDataExternal; -extern _declspec(dllimport) GETSTEMDATAEXTERNALFN * GetStemDataExternal; -extern _declspec(dllimport) SETSTEMDATAEXTERNALFN * SetStemDataExternal; -#endif - -#endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-04-19 05:38:56
|
Revision: 4428 http://oorexx.svn.sourceforge.net/oorexx/?rev=4428&view=rev Author: miesfeld Date: 2009-04-19 05:38:44 +0000 (Sun, 19 Apr 2009) Log Message: ----------- Continue ooDialog clean up Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/Menu.cpp main/trunk/extensions/platform/windows/oodialog/oodutils.cls main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp main/trunk/extensions/platform/windows/oodialog/oovdata.cpp main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp main/trunk/extensions/platform/windows/oodialog/oovdraw.cpp main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp main/trunk/extensions/platform/windows/oodialog/oovother.cpp main/trunk/extensions/platform/windows/oodialog/oovscrll.cpp main/trunk/extensions/platform/windows/oodialog/oovtext.cpp main/trunk/extensions/platform/windows/oodialog/oovtools.cpp main/trunk/extensions/platform/windows/oodialog/oovuser.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.h main/trunk/extensions/platform/windows/oodialog/plbdlg.cls Modified: main/trunk/extensions/platform/windows/oodialog/Menu.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/Menu.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/Menu.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -35,12 +35,10 @@ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ -#include <windows.h> -#include "oorexxapi.h" +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h #include <stdio.h> #include <dlgs.h> #include <malloc.h> -#include "oovutil.h" #include <limits.h> LPWORD lpwAlign(LPWORD lpIn); Modified: main/trunk/extensions/platform/windows/oodialog/oodutils.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodutils.cls 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oodutils.cls 2009-04-19 05:38:44 UTC (rev 4428) @@ -105,10 +105,25 @@ use strict arg index return .DlgUtil~getSystemMetrics(index) +/** The following routines are needed to maintain backward compatibilty with + * pre-4.0.0, because a classic Rexx external function with the same name was + * documented. + */ +::routine GetSysMetrics public + use strict arg index + return .DlgUtil~getSystemMetrics(index) -/*-------------------------------- shortcut routines ---------------------------------*/ +::routine InstMMFuncs public + return 1 +::routine BinaryAnd public + use strict arg n1, n2 + return .DlgUtil~and(n1, n2) +/* ----- End compatibility routines. -----------------------------------------*/ + +/*-------------------------- shortcut routines -------------------------------*/ + ::routine TimedMessage public use arg msg, title, duration, earlyReply = .false if \ duration~datatype('W') then return -1 Modified: main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -35,14 +35,12 @@ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ -#include <windows.h> -#include <rexx.h> +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h #include <stdio.h> #include <dlgs.h> #ifdef __CTL3D #include <ctl3d.h> #endif -#include "oovutil.h" extern LPBITMAPINFO LoadDIB(const char *szFile); Modified: main/trunk/extensions/platform/windows/oodialog/oovdata.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovdata.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovdata.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -35,17 +35,14 @@ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h - -#include <windows.h> -#include <rexx.h> #include <stdio.h> #include <dlgs.h> #include <commctrl.h> #ifdef __CTL3D #include <ctl3d.h> #endif -#include "oovutil.h" /* I do most of the radio button handling myself now so I know it works */ Modified: main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -35,12 +35,11 @@ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ -#include <windows.h> -#include <rexx.h> +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h + #include <stdio.h> #include <dlgs.h> #include <malloc.h> -#include "oovutil.h" size_t RexxEntry FindTheWindow(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) Modified: main/trunk/extensions/platform/windows/oodialog/oovdraw.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovdraw.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovdraw.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -35,14 +35,13 @@ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ -#include <windows.h> -#include <rexx.h> +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h + #include <stdio.h> #include <dlgs.h> #ifdef __CTL3D #include <ctl3d.h> #endif -#include "oovutil.h" extern LPBITMAPINFO LoadDIB(const char *szFile); Modified: main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -39,15 +39,10 @@ /** * Open Object REXX OODialog - ooDialog Messaging function */ -#define NTDDI_VERSION NTDDI_WINXPSP2 -#define _WIN32_WINNT 0x0501 -#define WINVER 0x0501 +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h -#include <windows.h> -#include <rexx.h> #include <stdio.h> #include <dlgs.h> -#include "oovutil.h" #include <commctrl.h> BOOL AddDialogMessage(CHAR * msg, CHAR * Qptr) @@ -446,7 +441,7 @@ for (i=1;i<NARG;i++) { - if (ISHEX(argv[i].strptr)) + if (isHex(argv[i].strptr)) n[i-1] = strtoul(argv[i].strptr,'\0',16); else n[i-1] = (ULONG)atol(argv[i].strptr); @@ -454,7 +449,7 @@ if ( argc == 9 ) { - if ( ISHEX(argv[8].strptr) ) + if ( isHex(argv[8].strptr) ) n[NARG-1] = strtoul(argv[8].strptr,'\0',16); else n[NARG-1] = (ULONG)atol(argv[8].strptr); @@ -482,7 +477,7 @@ for (i=1; i<5; i++) { - if (ISHEX(argv[i+1].strptr)) + if (isHex(argv[i+1].strptr)) n[i] = strtol(argv[i+1].strptr,'\0',16); else n[i] = atol(argv[i+1].strptr); @@ -503,12 +498,12 @@ for (i=0; i<4; i++) { - if (ISHEX(argv[i+1].strptr)) + if (isHex(argv[i+1].strptr)) n[i] = strtol(argv[i+1].strptr,'\0',16); else n[i] = atol(argv[i+1].strptr); } - if (ISHEX(argv[5].strptr)) lP = (LPARAM) strtol(argv[5].strptr,'\0',16); + if (isHex(argv[5].strptr)) lP = (LPARAM) strtol(argv[5].strptr,'\0',16); else if (argv[5].strptr[0] == 'T') lP = (LPARAM) &argv[5].strptr[1]; else if (argv[5].strptr[0] == 'L') /* e.g. used to set tab stops for edit control */ { Modified: main/trunk/extensions/platform/windows/oodialog/oovother.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -35,23 +35,15 @@ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ -#define NTDDI_VERSION NTDDI_WINXPSP2 -#define _WIN32_WINNT 0x0501 -#define WINVER 0x0501 +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h -#define STRICT -#define OEMRESOURCE - -#include <windows.h> #include <mmsystem.h> -#include "oorexxapi.h" #include <stdio.h> #include <dlgs.h> #include <malloc.h> #include <errno.h> #include <shlwapi.h> #include <commctrl.h> -#include "oovutil.h" // Map strings representing constant defines to their int values. For // translating things like "IDI_APPLICATION" from the user to the proper API Modified: main/trunk/extensions/platform/windows/oodialog/oovscrll.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovscrll.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovscrll.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -35,12 +35,11 @@ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ -#include <windows.h> -#include <rexx.h> +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h + #include <stdio.h> #include <dlgs.h> #include <malloc.h> -#include "oovutil.h" #include <limits.h> Modified: main/trunk/extensions/platform/windows/oodialog/oovtext.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovtext.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovtext.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -35,16 +35,15 @@ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ -#include <windows.h> +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h + #include <shlwapi.h> -#include <rexx.h> #include <stdio.h> #include <dlgs.h> #include <malloc.h> #ifdef __CTL3D #include <ctl3d.h> #endif -#include "oovutil.h" extern HWND ScrollingButton = NULL; extern HWND RedrawScrollingButton = NULL; Modified: main/trunk/extensions/platform/windows/oodialog/oovtools.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovtools.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovtools.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -35,12 +35,11 @@ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ -#include <windows.h> -#include <rexx.h> +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h + #include <stdio.h> #include <dlgs.h> #include <malloc.h> -#include "oovutil.h" BOOL DialogInAdminTable(DIALOGADMIN * Dlg) @@ -152,28 +151,3 @@ return 0; } -/** - * This classic Rexx external function was NOT documented prior to 4.0.0. But, - * it was used in some of the sample code in the doc. - */ -size_t RexxEntry BinaryAnd(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) -{ - ULONG n, m; - - CHECKARG(2); - - if (ISHEX(argv[0].strptr)) - n = strtoul(argv[0].strptr,'\0',16); - else - n = strtoul(argv[0].strptr,'\0',10); - - if (ISHEX(argv[1].strptr)) - m = strtoul(argv[1].strptr,'\0',16); - else - m = strtoul(argv[1].strptr,'\0',10); - - sprintf(retstr->strptr, "%u", n & m); - retstr->strlength = strlen(retstr->strptr); - return 0; -} - Modified: main/trunk/extensions/platform/windows/oodialog/oovuser.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovuser.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovuser.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -35,19 +35,13 @@ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h -#define NTDDI_VERSION NTDDI_WINXPSP2 -#define _WIN32_WINNT 0x0501 -#define WINVER 0x0501 - -#include <windows.h> -#include <rexx.h> #include <stdio.h> #include <dlgs.h> #ifdef __CTL3D #include <ctl3d.h> #endif -#include "oovutil.h" #include "oodResources.h" #include <commctrl.h> Modified: main/trunk/extensions/platform/windows/oodialog/oovutil.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-19 05:38:44 UTC (rev 4428) @@ -6,7 +6,7 @@ /* This program and the accompanying materials are made available under */ /* the terms of the Common Public License v1.0 which accompanies this */ /* distribution. A copy is also available at the following address: */ -/* http://www.oorexx.org/license.html */ +/* http://www.oorexx.org/license.html */ /* */ /* Redistribution and use in source and binary forms, with or */ /* without modification, are permitted provided that the following */ @@ -35,16 +35,12 @@ /* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /* */ /*----------------------------------------------------------------------------*/ -#define _WIN32_WINNT 0x0501 -#define WINVER 0x0501 +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h -#include <windows.h> #include <mmsystem.h> #include <commctrl.h> -#include "oorexxapi.h" #include <stdio.h> #include <dlgs.h> -#include "oovutil.h" #include "oodResources.h" HINSTANCE MyInstance = NULL; @@ -1910,15 +1906,6 @@ } #endif -/** - * This function was documented in the ooDialog doc prior to 4.0.0, so for now - * it needs to stay. Does nothing. - */ -size_t RexxEntry InstMMFuncs(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) -{ - // the old function returned 1 - RETC(1) -} REXX_CLASSIC_ROUTINE_PROTOTYPE(GetDlgMsg); REXX_CLASSIC_ROUTINE_PROTOTYPE(SendWinMsg); @@ -1941,7 +1928,6 @@ REXX_CLASSIC_ROUTINE_PROTOTYPE(StartDialog); REXX_CLASSIC_ROUTINE_PROTOTYPE(WindowRect); REXX_CLASSIC_ROUTINE_PROTOTYPE(SetLBTabStops); -REXX_CLASSIC_ROUTINE_PROTOTYPE(BinaryAnd); REXX_CLASSIC_ROUTINE_PROTOTYPE(GetScreenSize); REXX_CLASSIC_ROUTINE_PROTOTYPE(GetSysMetrics); REXX_CLASSIC_ROUTINE_PROTOTYPE(GetDialogFactor); @@ -1983,7 +1969,6 @@ // now build the actual entry list RexxRoutineEntry oodialog_functions[] = { - REXX_CLASSIC_ROUTINE(InstMMFuncs, InstMMFuncs), REXX_CLASSIC_ROUTINE(GetDlgMsg, GetDlgMsg), REXX_CLASSIC_ROUTINE(SendWinMsg, SendWinMsg), REXX_CLASSIC_ROUTINE(HandleDlg, HandleDlg), @@ -2005,7 +1990,6 @@ REXX_CLASSIC_ROUTINE(StartDialog, StartDialog), REXX_CLASSIC_ROUTINE(WindowRect, WindowRect), REXX_CLASSIC_ROUTINE(SetLBTabStops, SetLBTabStops), - REXX_CLASSIC_ROUTINE(BinaryAnd, BinaryAnd), REXX_CLASSIC_ROUTINE(GetScreenSize, GetScreenSize), REXX_CLASSIC_ROUTINE(GetDialogFactor, GetDialogFactor), REXX_CLASSIC_ROUTINE(SleepMS, SleepMS), Modified: main/trunk/extensions/platform/windows/oodialog/oovutil.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovutil.h 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/oovutil.h 2009-04-19 05:38:44 UTC (rev 4428) @@ -39,7 +39,16 @@ /* Object REXX OODialog oovutil.h */ /* */ /******************************************************************************/ +#define NTDDI_VERSION NTDDI_WINXPSP2 +#define _WIN32_WINNT 0x0501 +#define WINVER 0x0501 +#define STRICT +#define OEMRESOURCE + +#include <windows.h> +#include "oorexxapi.h" + #define MAXREXXNAME 128 #define MAXLENQUEUE 2056 #define NR_BUFFER 15 @@ -217,10 +226,6 @@ } -#define ISHEX(value) \ - ((value[0] == '0') && (toupper(value[1]) == 'X')) - - // // macros to access the fields in a BITMAPINFO struct // field_value = macro(pBitmapInfo) Modified: main/trunk/extensions/platform/windows/oodialog/plbdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-04-19 04:26:37 UTC (rev 4427) +++ main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-04-19 05:38:44 UTC (rev 4428) @@ -58,12 +58,6 @@ ::method handleToPointer class external "LIBRARY oodialog dlgutil_handleToPointer_cls" ::method test class external "LIBRARY oodialog dlgutil_test_cls" --- Needed to maintain backward compatibilty with 3.2.0. The external function GetSysMetrics() --- was foolishly documented. -::routine GetSysMetrics public - use strict arg index - return .DlgUtil~getSystemMetrics(index) - ::class 'Rect' public ::method init external "LIBRARY oodialog rect_init" ::method left external "LIBRARY oodialog rect_left" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-04-19 06:40:15
|
Revision: 4430 http://oorexx.svn.sourceforge.net/oorexx/?rev=4430&view=rev Author: miesfeld Date: 2009-04-19 06:40:07 +0000 (Sun, 19 Apr 2009) Log Message: ----------- Continue port of ooDialog to the native API Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/oovtools.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.h Added Paths: ----------- main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp Copied: main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp (from rev 4428, main/trunk/extensions/platform/windows/oodialog/oovutil.cpp) =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp (rev 0) +++ main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp 2009-04-19 06:40:07 UTC (rev 4430) @@ -0,0 +1,544 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * oodPackageEntry.cpp + * + * Contains the package entry point, routine and method declarations, and + * routine and method tables for the native API. Also contains the global + * variables and DLLMain(). + */ + +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h + +HINSTANCE MyInstance = NULL; +DIALOGADMIN * DialogTab[MAXDIALOGS] = {NULL}; +DIALOGADMIN * topDlg = {NULL}; +INT StoredDialogs = 0; +CRITICAL_SECTION crit_sec = {0}; + + +#ifdef __cplusplus +extern "C" { +#endif + +BOOL REXXENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + if ( fdwReason == DLL_PROCESS_ATTACH ) + { + MyInstance = hinstDLL; + InitializeCriticalSection(&crit_sec); + } + else if ( fdwReason == DLL_PROCESS_DETACH ) + { + MyInstance = NULL; + DeleteCriticalSection(&crit_sec); + } + return(TRUE); +} + +#ifdef __cplusplus +} +#endif + + +REXX_CLASSIC_ROUTINE_PROTOTYPE(GetDlgMsg); +REXX_CLASSIC_ROUTINE_PROTOTYPE(SendWinMsg); +REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDlg); +REXX_CLASSIC_ROUTINE_PROTOTYPE(AddUserMessage); +REXX_CLASSIC_ROUTINE_PROTOTYPE(GetFileNameWindow); +REXX_CLASSIC_ROUTINE_PROTOTYPE(DataTable); +REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDialogAdmin); +REXX_CLASSIC_ROUTINE_PROTOTYPE(SetItemData); +REXX_CLASSIC_ROUTINE_PROTOTYPE(SetStemData); +REXX_CLASSIC_ROUTINE_PROTOTYPE(GetItemData); +REXX_CLASSIC_ROUTINE_PROTOTYPE(GetStemData); +REXX_CLASSIC_ROUTINE_PROTOTYPE(Wnd_Desktop); +REXX_CLASSIC_ROUTINE_PROTOTYPE(WndShow_Pos); +REXX_CLASSIC_ROUTINE_PROTOTYPE(WinAPI32Func); +REXX_CLASSIC_ROUTINE_PROTOTYPE(InfoMessage); +REXX_CLASSIC_ROUTINE_PROTOTYPE(ErrorMessage); +REXX_CLASSIC_ROUTINE_PROTOTYPE(YesNoMessage); +REXX_CLASSIC_ROUTINE_PROTOTYPE(FindTheWindow); +REXX_CLASSIC_ROUTINE_PROTOTYPE(StartDialog); +REXX_CLASSIC_ROUTINE_PROTOTYPE(WindowRect); +REXX_CLASSIC_ROUTINE_PROTOTYPE(SetLBTabStops); +REXX_CLASSIC_ROUTINE_PROTOTYPE(GetScreenSize); +REXX_CLASSIC_ROUTINE_PROTOTYPE(GetSysMetrics); +REXX_CLASSIC_ROUTINE_PROTOTYPE(GetDialogFactor); +REXX_CLASSIC_ROUTINE_PROTOTYPE(SleepMS); +REXX_CLASSIC_ROUTINE_PROTOTYPE(PlaySoundFile); +REXX_CLASSIC_ROUTINE_PROTOTYPE(PlaySoundFileInLoop); +REXX_CLASSIC_ROUTINE_PROTOTYPE(StopSoundFile); +REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleScrollBar); +REXX_CLASSIC_ROUTINE_PROTOTYPE(BmpButton); +REXX_CLASSIC_ROUTINE_PROTOTYPE(DCDraw); +REXX_CLASSIC_ROUTINE_PROTOTYPE(DrawGetSet); +REXX_CLASSIC_ROUTINE_PROTOTYPE(ScrollText); +REXX_CLASSIC_ROUTINE_PROTOTYPE(ScrollTheWindow); +REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDC_Obj); +REXX_CLASSIC_ROUTINE_PROTOTYPE(SetBackground); +REXX_CLASSIC_ROUTINE_PROTOTYPE(LoadRemoveBitmap); +REXX_CLASSIC_ROUTINE_PROTOTYPE(WriteText); +REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleTreeCtrl); +REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleListCtrl); +REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleListCtrlEx); +REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleControlEx); +REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleOtherNewCtrls); +REXX_CLASSIC_ROUTINE_PROTOTYPE(WinTimer); +REXX_CLASSIC_ROUTINE_PROTOTYPE(DumpAdmin); +REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrAddControl); +REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrCreateDialog); +REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrDefineDialog); +REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrAddNewCtrl); +REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrAddResource); +REXX_CLASSIC_ROUTINE_PROTOTYPE(WinMenu); +REXX_CLASSIC_ROUTINE_PROTOTYPE(InsertMII); +REXX_CLASSIC_ROUTINE_PROTOTYPE(SetMII); +REXX_CLASSIC_ROUTINE_PROTOTYPE(GetMII); +REXX_CLASSIC_ROUTINE_PROTOTYPE(SetMI); +REXX_CLASSIC_ROUTINE_PROTOTYPE(GetMI); +REXX_CLASSIC_ROUTINE_PROTOTYPE(TrackPopup); +REXX_CLASSIC_ROUTINE_PROTOTYPE(MemMenu); + +// now build the actual entry list +RexxRoutineEntry oodialog_functions[] = +{ + REXX_CLASSIC_ROUTINE(GetDlgMsg, GetDlgMsg), + REXX_CLASSIC_ROUTINE(SendWinMsg, SendWinMsg), + REXX_CLASSIC_ROUTINE(HandleDlg, HandleDlg), + REXX_CLASSIC_ROUTINE(AddUserMessage, AddUserMessage), + REXX_CLASSIC_ROUTINE(GetFileNameWindow, GetFileNameWindow), + REXX_CLASSIC_ROUTINE(DataTable, DataTable), + REXX_CLASSIC_ROUTINE(HandleDialogAdmin, HandleDialogAdmin), + REXX_CLASSIC_ROUTINE(SetItemData, SetItemData), + REXX_CLASSIC_ROUTINE(SetStemData, SetStemData), + REXX_CLASSIC_ROUTINE(GetItemData, GetItemData), + REXX_CLASSIC_ROUTINE(GetStemData, GetStemData), + REXX_CLASSIC_ROUTINE(Wnd_Desktop, Wnd_Desktop), + REXX_CLASSIC_ROUTINE(WndShow_Pos, WndShow_Pos), + REXX_CLASSIC_ROUTINE(WinAPI32Func, WinAPI32Func), + REXX_CLASSIC_ROUTINE(InfoMessage, InfoMessage), + REXX_CLASSIC_ROUTINE(ErrorMessage, ErrorMessage), + REXX_CLASSIC_ROUTINE(YesNoMessage, YesNoMessage), + REXX_CLASSIC_ROUTINE(FindTheWindow, FindTheWindow), + REXX_CLASSIC_ROUTINE(StartDialog, StartDialog), + REXX_CLASSIC_ROUTINE(WindowRect, WindowRect), + REXX_CLASSIC_ROUTINE(SetLBTabStops, SetLBTabStops), + REXX_CLASSIC_ROUTINE(GetScreenSize, GetScreenSize), + REXX_CLASSIC_ROUTINE(GetDialogFactor, GetDialogFactor), + REXX_CLASSIC_ROUTINE(SleepMS, SleepMS), + REXX_CLASSIC_ROUTINE(PlaySoundFile, PlaySoundFile), + REXX_CLASSIC_ROUTINE(PlaySoundFileInLoop, PlaySoundFileInLoop), + REXX_CLASSIC_ROUTINE(StopSoundFile, StopSoundFile), + REXX_CLASSIC_ROUTINE(HandleScrollBar, HandleScrollBar), + REXX_CLASSIC_ROUTINE(BmpButton, BmpButton), + REXX_CLASSIC_ROUTINE(DCDraw, DCDraw), + REXX_CLASSIC_ROUTINE(DrawGetSet, DrawGetSet), + REXX_CLASSIC_ROUTINE(ScrollText, ScrollText), + REXX_CLASSIC_ROUTINE(ScrollTheWindow, ScrollTheWindow), + REXX_CLASSIC_ROUTINE(HandleDC_Obj, HandleDC_Obj), + REXX_CLASSIC_ROUTINE(SetBackground, SetBackground), + REXX_CLASSIC_ROUTINE(LoadRemoveBitmap, LoadRemoveBitmap), + REXX_CLASSIC_ROUTINE(WriteText, WriteText), + REXX_CLASSIC_ROUTINE(HandleTreeCtrl, HandleTreeCtrl), + REXX_CLASSIC_ROUTINE(HandleListCtrl, HandleListCtrl), + REXX_CLASSIC_ROUTINE(HandleListCtrlEx, HandleListCtrlEx), + REXX_CLASSIC_ROUTINE(HandleControlEx, HandleControlEx), + REXX_CLASSIC_ROUTINE(HandleOtherNewCtrls, HandleOtherNewCtrls), + REXX_CLASSIC_ROUTINE(WinTimer, WinTimer), + REXX_CLASSIC_ROUTINE(DumpAdmin, DumpAdmin), + REXX_CLASSIC_ROUTINE(UsrAddControl, UsrAddControl), + REXX_CLASSIC_ROUTINE(UsrCreateDialog, UsrCreateDialog), + REXX_CLASSIC_ROUTINE(UsrDefineDialog, UsrDefineDialog), + REXX_CLASSIC_ROUTINE(UsrAddNewCtrl, UsrAddNewCtrl), + REXX_CLASSIC_ROUTINE(UsrAddResource, UsrAddResource), + + REXX_CLASSIC_ROUTINE(WinMenu, WinMenu), + REXX_CLASSIC_ROUTINE(InsertMII, InsertMII), + REXX_CLASSIC_ROUTINE(SetMII, SetMII), + REXX_CLASSIC_ROUTINE(GetMII, GetMII), + REXX_CLASSIC_ROUTINE(SetMI, SetMI), + REXX_CLASSIC_ROUTINE(GetMI, GetMI), + REXX_CLASSIC_ROUTINE(TrackPopup, TrackPopup), + REXX_CLASSIC_ROUTINE(MemMenu, MemMenu), + REXX_LAST_ROUTINE() +}; + +REXX_METHOD_PROTOTYPE(dlgutil_init_cls); +REXX_METHOD_PROTOTYPE(dlgutil_comctl32Version_cls); +REXX_METHOD_PROTOTYPE(dlgutil_version_cls); +REXX_METHOD_PROTOTYPE(dlgutil_hiWord_cls); +REXX_METHOD_PROTOTYPE(dlgutil_loWord_cls); +REXX_METHOD_PROTOTYPE(dlgutil_and_cls); +REXX_METHOD_PROTOTYPE(dlgutil_or_cls); +REXX_METHOD_PROTOTYPE(dlgutil_getSystemMetrics_cls); +REXX_METHOD_PROTOTYPE(dlgutil_handleToPointer_cls); +REXX_METHOD_PROTOTYPE(dlgutil_test_cls); + +REXX_METHOD_PROTOTYPE(wb_getStyleRaw); +REXX_METHOD_PROTOTYPE(wb_getExStyleRaw); + +REXX_METHOD_PROTOTYPE(pbdlg_init_cls); +REXX_METHOD_PROTOTYPE(pbdlg_setDefaultFont_cls); +REXX_METHOD_PROTOTYPE(pbdlg_getFontName_cls); +REXX_METHOD_PROTOTYPE(pbdlg_getFontSize_cls); +REXX_METHOD_PROTOTYPE(pbdlg_getTextSizeDlg); + +REXX_METHOD_PROTOTYPE(resdlg_setFontAttrib_pvt); + +REXX_METHOD_PROTOTYPE(winex_getTextSizeScreen); +REXX_METHOD_PROTOTYPE(winex_getFont); +REXX_METHOD_PROTOTYPE(winex_setFont); +REXX_METHOD_PROTOTYPE(winex_createFontEx); +REXX_METHOD_PROTOTYPE(winex_createFont); + +REXX_METHOD_PROTOTYPE(ri_init); +REXX_METHOD_PROTOTYPE(ri_release); +REXX_METHOD_PROTOTYPE(ri_handle); +REXX_METHOD_PROTOTYPE(ri_isNull); +REXX_METHOD_PROTOTYPE(ri_systemErrorCode); +REXX_METHOD_PROTOTYPE(ri_getImage); +REXX_METHOD_PROTOTYPE(ri_getImages); + +REXX_METHOD_PROTOTYPE(image_id_cls); +REXX_METHOD_PROTOTYPE(image_getImage_cls); +REXX_METHOD_PROTOTYPE(image_fromFiles_cls); +REXX_METHOD_PROTOTYPE(image_fromIDs_cls); +REXX_METHOD_PROTOTYPE(image_colorRef_cls); +REXX_METHOD_PROTOTYPE(image_getRValue_cls); +REXX_METHOD_PROTOTYPE(image_getGValue_cls); +REXX_METHOD_PROTOTYPE(image_getBValue_cls); +REXX_METHOD_PROTOTYPE(image_init); +REXX_METHOD_PROTOTYPE(image_release); +REXX_METHOD_PROTOTYPE(image_isNull); +REXX_METHOD_PROTOTYPE(image_handle); +REXX_METHOD_PROTOTYPE(image_systemErrorCode); + +REXX_METHOD_PROTOTYPE(il_create_cls); +REXX_METHOD_PROTOTYPE(il_init); +REXX_METHOD_PROTOTYPE(il_release); +REXX_METHOD_PROTOTYPE(il_add); +REXX_METHOD_PROTOTYPE(il_addMasked); +REXX_METHOD_PROTOTYPE(il_addIcon); +REXX_METHOD_PROTOTYPE(il_addImages); +REXX_METHOD_PROTOTYPE(il_addImages); +REXX_METHOD_PROTOTYPE(il_getCount); +REXX_METHOD_PROTOTYPE(il_getImageSize); +REXX_METHOD_PROTOTYPE(il_duplicate); +REXX_METHOD_PROTOTYPE(il_remove); +REXX_METHOD_PROTOTYPE(il_removeAll); +REXX_METHOD_PROTOTYPE(il_isNull); +REXX_METHOD_PROTOTYPE(il_handle); + +REXX_METHOD_PROTOTYPE(dlgctrl_getTextSizeDlg); + +REXX_METHOD_PROTOTYPE(advCtrl_getStaticControl); +REXX_METHOD_PROTOTYPE(advCtrl_getButtonControl); +REXX_METHOD_PROTOTYPE(advCtrl_getListControl); +REXX_METHOD_PROTOTYPE(advCtrl_getTreeControl); +REXX_METHOD_PROTOTYPE(advCtrl_getTabControl); +REXX_METHOD_PROTOTYPE(advCtrl_putControl_pvt); + +REXX_METHOD_PROTOTYPE(lv_setImageList); +REXX_METHOD_PROTOTYPE(lv_getImageList); +REXX_METHOD_PROTOTYPE(lv_getColumnCount); +REXX_METHOD_PROTOTYPE(lv_getColumnOrder); +REXX_METHOD_PROTOTYPE(lv_setColumnOrder); +REXX_METHOD_PROTOTYPE(lv_insertColumnEx); // TODO review method name +REXX_METHOD_PROTOTYPE(lv_columnWidthEx); // TODO review method name +REXX_METHOD_PROTOTYPE(lv_stringWidthEx); // TODO review method name +REXX_METHOD_PROTOTYPE(lv_addRowEx); // TODO review method name + +REXX_METHOD_PROTOTYPE(tv_setImageList); +REXX_METHOD_PROTOTYPE(tv_getImageList); + +REXX_METHOD_PROTOTYPE(tab_setImageList); +REXX_METHOD_PROTOTYPE(tab_getImageList); + +REXX_METHOD_PROTOTYPE(get_dtp_dateTime); +REXX_METHOD_PROTOTYPE(set_dtp_dateTime); + +REXX_METHOD_PROTOTYPE(get_mc_date); +REXX_METHOD_PROTOTYPE(set_mc_date); +REXX_METHOD_PROTOTYPE(get_mc_usesUnicode); +REXX_METHOD_PROTOTYPE(set_mc_usesUnicode); + +REXX_METHOD_PROTOTYPE(pbc_stepIt); +REXX_METHOD_PROTOTYPE(pbc_getPos); +REXX_METHOD_PROTOTYPE(pbc_setPos); +REXX_METHOD_PROTOTYPE(pbc_getRange); +REXX_METHOD_PROTOTYPE(pbc_setRange); +REXX_METHOD_PROTOTYPE(pbc_setStep); +REXX_METHOD_PROTOTYPE(pbc_setMarquee); +REXX_METHOD_PROTOTYPE(pbc_setBkColor); +REXX_METHOD_PROTOTYPE(pbc_setBarColor); + +REXX_METHOD_PROTOTYPE(stc_getText); +REXX_METHOD_PROTOTYPE(stc_setText); +REXX_METHOD_PROTOTYPE(stc_getIcon); +REXX_METHOD_PROTOTYPE(stc_setIcon); +REXX_METHOD_PROTOTYPE(stc_getImage); +REXX_METHOD_PROTOTYPE(stc_setImage); + +REXX_METHOD_PROTOTYPE(gb_setStyle); +REXX_METHOD_PROTOTYPE(bc_getState); +REXX_METHOD_PROTOTYPE(bc_setState); +REXX_METHOD_PROTOTYPE(bc_setStyle); +REXX_METHOD_PROTOTYPE(bc_click); +REXX_METHOD_PROTOTYPE(bc_getIdealSize); +REXX_METHOD_PROTOTYPE(bc_getTextMargin); +REXX_METHOD_PROTOTYPE(bc_setTextMargin); +REXX_METHOD_PROTOTYPE(bc_getImage); +REXX_METHOD_PROTOTYPE(bc_setImage); +REXX_METHOD_PROTOTYPE(bc_setImageList); +REXX_METHOD_PROTOTYPE(bc_getImageList); +REXX_METHOD_PROTOTYPE(rb_checkInGroup_cls); +REXX_METHOD_PROTOTYPE(rb_getCheckState); +REXX_METHOD_PROTOTYPE(rb_checked); +REXX_METHOD_PROTOTYPE(rb_check); +REXX_METHOD_PROTOTYPE(rb_uncheck); +REXX_METHOD_PROTOTYPE(rb_isChecked); +REXX_METHOD_PROTOTYPE(rb_indeterminate); +REXX_METHOD_PROTOTYPE(ckbx_isIndeterminate); +REXX_METHOD_PROTOTYPE(ckbx_setIndeterminate); +REXX_METHOD_PROTOTYPE(bc_test); + +REXX_METHOD_PROTOTYPE(menu_test); +REXX_METHOD_PROTOTYPE(menu_connectAllItems); + +REXX_METHOD_PROTOTYPE(rect_init); +REXX_METHOD_PROTOTYPE(rect_left); +REXX_METHOD_PROTOTYPE(rect_top); +REXX_METHOD_PROTOTYPE(rect_right); +REXX_METHOD_PROTOTYPE(rect_bottom); +REXX_METHOD_PROTOTYPE(rect_setLeft); +REXX_METHOD_PROTOTYPE(rect_setTop); +REXX_METHOD_PROTOTYPE(rect_setRight); +REXX_METHOD_PROTOTYPE(rect_setBottom); + +REXX_METHOD_PROTOTYPE(point_init); +REXX_METHOD_PROTOTYPE(point_x); +REXX_METHOD_PROTOTYPE(point_setX); +REXX_METHOD_PROTOTYPE(point_y); +REXX_METHOD_PROTOTYPE(point_setY); + +REXX_METHOD_PROTOTYPE(size_init); +REXX_METHOD_PROTOTYPE(size_cx); +REXX_METHOD_PROTOTYPE(size_setCX); +REXX_METHOD_PROTOTYPE(size_cy); +REXX_METHOD_PROTOTYPE(size_setCY); + +RexxMethodEntry oodialog_methods[] = { + REXX_METHOD(dlgutil_init_cls, dlgutil_init_cls), + REXX_METHOD(dlgutil_comctl32Version_cls, dlgutil_comctl32Version_cls), + REXX_METHOD(dlgutil_version_cls, dlgutil_version_cls), + REXX_METHOD(dlgutil_hiWord_cls, dlgutil_hiWord_cls), + REXX_METHOD(dlgutil_and_cls, dlgutil_and_cls), + REXX_METHOD(dlgutil_or_cls, dlgutil_or_cls), + REXX_METHOD(dlgutil_loWord_cls, dlgutil_loWord_cls), + REXX_METHOD(dlgutil_handleToPointer_cls, dlgutil_handleToPointer_cls), + REXX_METHOD(dlgutil_getSystemMetrics_cls, dlgutil_getSystemMetrics_cls), + REXX_METHOD(dlgutil_test_cls, dlgutil_test_cls), + + REXX_METHOD(wb_getStyleRaw, wb_getStyleRaw), + REXX_METHOD(wb_getExStyleRaw, wb_getExStyleRaw), + + REXX_METHOD(pbdlg_init_cls, pbdlg_init_cls), + REXX_METHOD(pbdlg_setDefaultFont_cls, pbdlg_setDefaultFont_cls), + REXX_METHOD(pbdlg_getFontName_cls, pbdlg_getFontName_cls), + REXX_METHOD(pbdlg_getFontSize_cls, pbdlg_getFontSize_cls), + REXX_METHOD(pbdlg_getTextSizeDlg, pbdlg_getTextSizeDlg), + + REXX_METHOD(resdlg_setFontAttrib_pvt, resdlg_setFontAttrib_pvt), + + REXX_METHOD(winex_getTextSizeScreen, winex_getTextSizeScreen), + REXX_METHOD(winex_getFont, winex_getFont), + REXX_METHOD(winex_setFont, winex_setFont), + REXX_METHOD(winex_createFontEx, winex_createFontEx), + REXX_METHOD(winex_createFont, winex_createFont), + + REXX_METHOD(ri_init, ri_init), + REXX_METHOD(ri_release, ri_release), + REXX_METHOD(ri_handle, ri_handle), + REXX_METHOD(ri_isNull, ri_isNull), + REXX_METHOD(ri_systemErrorCode, ri_systemErrorCode), + REXX_METHOD(ri_getImage, ri_getImage), + REXX_METHOD(ri_getImages, ri_getImages), + + REXX_METHOD(image_id_cls, image_id_cls), + REXX_METHOD(image_getImage_cls, image_getImage_cls), + REXX_METHOD(image_fromFiles_cls, image_fromFiles_cls), + REXX_METHOD(image_fromIDs_cls, image_fromIDs_cls), + REXX_METHOD(image_colorRef_cls, image_colorRef_cls), + REXX_METHOD(image_getRValue_cls, image_getRValue_cls), + REXX_METHOD(image_getGValue_cls, image_getGValue_cls), + REXX_METHOD(image_getBValue_cls, image_getBValue_cls), + REXX_METHOD(image_init, image_init), + REXX_METHOD(image_release, image_release), + REXX_METHOD(image_isNull, image_isNull), + REXX_METHOD(image_systemErrorCode, image_systemErrorCode), + REXX_METHOD(image_handle, image_handle), + + REXX_METHOD(il_create_cls, il_create_cls), + REXX_METHOD(il_init, il_init), + REXX_METHOD(il_release, il_release), + REXX_METHOD(il_add, il_add), + REXX_METHOD(il_addMasked, il_addMasked), + REXX_METHOD(il_addIcon, il_addIcon), + REXX_METHOD(il_addImages, il_addImages), + REXX_METHOD(il_getCount, il_getCount), + REXX_METHOD(il_getImageSize, il_getImageSize), + REXX_METHOD(il_duplicate, il_duplicate), + REXX_METHOD(il_removeAll, il_removeAll), + REXX_METHOD(il_remove, il_remove), + REXX_METHOD(il_isNull, il_isNull), + REXX_METHOD(il_handle, il_handle), + + REXX_METHOD(dlgctrl_getTextSizeDlg, dlgctrl_getTextSizeDlg), + + REXX_METHOD(advCtrl_getStaticControl, advCtrl_getStaticControl), + REXX_METHOD(advCtrl_getButtonControl, advCtrl_getButtonControl), + REXX_METHOD(advCtrl_getListControl, advCtrl_getListControl), + REXX_METHOD(advCtrl_getTreeControl, advCtrl_getTreeControl), + REXX_METHOD(advCtrl_getTabControl, advCtrl_getTabControl), + REXX_METHOD(advCtrl_putControl_pvt, advCtrl_putControl_pvt), + + REXX_METHOD(lv_setImageList, lv_setImageList), + REXX_METHOD(lv_getImageList, lv_getImageList), + REXX_METHOD(lv_getColumnCount, lv_getColumnCount), + REXX_METHOD(lv_getColumnOrder, lv_getColumnOrder), + REXX_METHOD(lv_setColumnOrder, lv_setColumnOrder), + REXX_METHOD(lv_insertColumnEx, lv_insertColumnEx), // TODO review method name + REXX_METHOD(lv_columnWidthEx, lv_columnWidthEx), // TODO review method name + REXX_METHOD(lv_stringWidthEx, lv_stringWidthEx), // TODO review method name + REXX_METHOD(lv_addRowEx, lv_addRowEx), // TODO review method name + + REXX_METHOD(tv_setImageList, tv_setImageList), + REXX_METHOD(tv_getImageList, tv_getImageList), + + REXX_METHOD(tab_setImageList, tab_setImageList), + REXX_METHOD(tab_getImageList, tab_getImageList), + + REXX_METHOD(get_dtp_dateTime, get_dtp_dateTime), + REXX_METHOD(set_dtp_dateTime, set_dtp_dateTime), + + REXX_METHOD(get_mc_date, get_mc_date), + REXX_METHOD(set_mc_date, set_mc_date), + REXX_METHOD(get_mc_usesUnicode, get_mc_usesUnicode), + REXX_METHOD(set_mc_usesUnicode, set_mc_usesUnicode), + + REXX_METHOD(pbc_stepIt, pbc_stepIt), + REXX_METHOD(pbc_getPos, pbc_getPos), + REXX_METHOD(pbc_setPos, pbc_setPos), + REXX_METHOD(pbc_getRange, pbc_getRange), + REXX_METHOD(pbc_setRange, pbc_setRange), + REXX_METHOD(pbc_setStep, pbc_setStep), + REXX_METHOD(pbc_setMarquee, pbc_setMarquee), + REXX_METHOD(pbc_setBkColor, pbc_setBkColor), + REXX_METHOD(pbc_setBarColor, pbc_setBarColor), + + REXX_METHOD(stc_getText, stc_getText), + REXX_METHOD(stc_setText, stc_setText), + REXX_METHOD(stc_getIcon, stc_getIcon), + REXX_METHOD(stc_setIcon, stc_setIcon), + REXX_METHOD(stc_getImage, stc_getImage), + REXX_METHOD(stc_setImage, stc_setImage), + + REXX_METHOD(bc_getState, bc_getState), + REXX_METHOD(bc_setState, bc_setState), + REXX_METHOD(bc_setStyle, bc_setStyle), + REXX_METHOD(bc_click, bc_click), + REXX_METHOD(bc_getIdealSize, bc_getIdealSize), + REXX_METHOD(bc_getTextMargin, bc_getTextMargin), + REXX_METHOD(bc_setTextMargin, bc_setTextMargin), + REXX_METHOD(bc_getImage, bc_getImage), + REXX_METHOD(bc_setImage, bc_setImage), + REXX_METHOD(bc_setImageList, bc_setImageList), + REXX_METHOD(bc_getImageList, bc_getImageList), + REXX_METHOD(rb_checkInGroup_cls, rb_checkInGroup_cls), + REXX_METHOD(rb_checked, rb_checked), + REXX_METHOD(rb_check, rb_check), + REXX_METHOD(rb_uncheck, rb_uncheck), + REXX_METHOD(rb_getCheckState, rb_getCheckState), + REXX_METHOD(rb_isChecked, rb_isChecked), + REXX_METHOD(rb_indeterminate, rb_indeterminate), + REXX_METHOD(ckbx_isIndeterminate, ckbx_isIndeterminate), + REXX_METHOD(ckbx_setIndeterminate, ckbx_setIndeterminate), + REXX_METHOD(gb_setStyle, gb_setStyle), + REXX_METHOD(bc_test, bc_test), + + REXX_METHOD(menu_test, menu_test), + REXX_METHOD(menu_connectAllItems, menu_connectAllItems), + + REXX_METHOD(rect_init, rect_init), + REXX_METHOD(rect_left, rect_left), + REXX_METHOD(rect_top, rect_top), + REXX_METHOD(rect_right, rect_right), + REXX_METHOD(rect_bottom, rect_bottom), + REXX_METHOD(rect_setLeft, rect_setLeft), + REXX_METHOD(rect_setTop, rect_setTop), + REXX_METHOD(rect_setRight, rect_setRight), + REXX_METHOD(rect_setBottom, rect_setBottom), + REXX_METHOD(point_init, point_init), + REXX_METHOD(point_x, point_x), + REXX_METHOD(point_setX, point_setX), + REXX_METHOD(point_y, point_y), + REXX_METHOD(point_setY, point_setY), + REXX_METHOD(size_init, size_init), + REXX_METHOD(size_cx, size_cx), + REXX_METHOD(size_setCX, size_setCX), + REXX_METHOD(size_cy, size_cy), + REXX_METHOD(size_setCY, size_setCY), + REXX_LAST_METHOD() +}; + +RexxPackageEntry oodialog_package_entry = +{ + STANDARD_PACKAGE_HEADER + REXX_INTERPRETER_4_0_0, // anything after 4.0.0 will work + "OODIALOG", // name of the package + "4.0", // package information + NULL, // no load/unload functions + NULL, + oodialog_functions, // the exported functions + oodialog_methods // the exported methods +}; + +// package loading stub. +OOREXX_GET_PACKAGE(oodialog); Modified: main/trunk/extensions/platform/windows/oodialog/oovtools.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovtools.cpp 2009-04-19 06:32:57 UTC (rev 4429) +++ main/trunk/extensions/platform/windows/oodialog/oovtools.cpp 2009-04-19 06:40:07 UTC (rev 4430) @@ -55,6 +55,43 @@ return(i < StoredDialogs); } +/** + * Validates and converts an ASCII-Z string from string form to a pointer value. + * + * @param string String to convert. + */ +void *string2pointer(const char *string) +{ + void *pointer = 0; + sscanf(string, "0x%p", &pointer); + return pointer; +} + +void pointer2string(char *result, void *pointer) +{ + if ( pointer == NULL ) + { + sprintf(result, "0"); + } + else + { + sprintf(result, "0x%p", pointer); + } +} + + +LONG HandleError(PRXSTRING r, CHAR * text) +{ + HWND hW = NULL; + if ((topDlg) && (topDlg->TheDlg)) hW = topDlg->TheDlg; + MessageBox(hW,text,"Error",MB_OK | MB_ICONHAND); + r->strlength = 2; + r->strptr[0] = '4'; + r->strptr[1] = '0'; + r->strptr[2] = '\0'; + return 40; +} + void rxstrlcpy(CHAR * tar, CONSTRXSTRING &src) { register UINT i; Modified: main/trunk/extensions/platform/windows/oodialog/oovutil.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-19 06:32:57 UTC (rev 4429) +++ main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-19 06:40:07 UTC (rev 4430) @@ -6,7 +6,7 @@ /* This program and the accompanying materials are made available under */ /* the terms of the Common Public License v1.0 which accompanies this */ /* distribution. A copy is also available at the following address: */ -/* http://www.oorexx.org/license.html */ +/* http://www.oorexx.org/license.html */ /* */ /* Redistribution and use in source and binary forms, with or */ /* without modification, are permitted provided that the following */ @@ -43,13 +43,6 @@ #include <dlgs.h> #include "oodResources.h" -HINSTANCE MyInstance = NULL; -DIALOGADMIN * DialogTab[MAXDIALOGS] = {NULL}; -DIALOGADMIN * topDlg = {NULL}; -INT StoredDialogs = 0; -CRITICAL_SECTION crit_sec = {0}; - - extern INT DelDialog(DIALOGADMIN * aDlg); extern BOOL SearchMessageTable(ULONG message, WPARAM param, LPARAM lparam, DIALOGADMIN * addressedTo); extern BOOL DrawBitmapButton(DIALOGADMIN * addr, HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL MsgEnabled); @@ -86,51 +79,6 @@ }; -/******************************************************************** -* Function: string2pointer(string) * -* * -* Purpose: Validates and converts an ASCII-Z string from string * -* form to a pointer value. Returns false if the number * -* is not valid, true if the number was successfully * -* converted. * -* * -* RC: true - Good number converted * -* false - Invalid number supplied. * -*********************************************************************/ - -void *string2pointer(const char *string) -{ - void *pointer = 0; - sscanf(string, "0x%p", &pointer); - return pointer; -} - - -void pointer2string(char *result, void *pointer) -{ - if ( pointer == NULL ) - { - sprintf(result, "0"); - } - else - { - sprintf(result, "0x%p", pointer); - } -} - -LONG HandleError(PRXSTRING r, CHAR * text) -{ - HWND hW = NULL; - if ((topDlg) && (topDlg->TheDlg)) hW = topDlg->TheDlg; - MessageBox(hW,text,"Error",MB_OK | MB_ICONHAND); - r->strlength = 2; - r->strptr[0] = '4'; - r->strptr[1] = '0'; - r->strptr[2] = '\0'; - return 40; -} - - /* dialog procedure handles the search for user defined messages and bitmap buttons handles messages necessary for 3d controls @@ -1883,492 +1831,3 @@ RETC(0); } -#ifdef __cplusplus -extern "C" { -#endif - -BOOL REXXENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) -{ - if ( fdwReason == DLL_PROCESS_ATTACH ) - { - MyInstance = hinstDLL; - InitializeCriticalSection(&crit_sec); - } - else if ( fdwReason == DLL_PROCESS_DETACH ) - { - MyInstance = NULL; - DeleteCriticalSection(&crit_sec); - } - return(TRUE); -} - -#ifdef __cplusplus -} -#endif - - -REXX_CLASSIC_ROUTINE_PROTOTYPE(GetDlgMsg); -REXX_CLASSIC_ROUTINE_PROTOTYPE(SendWinMsg); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDlg); -REXX_CLASSIC_ROUTINE_PROTOTYPE(AddUserMessage); -REXX_CLASSIC_ROUTINE_PROTOTYPE(GetFileNameWindow); -REXX_CLASSIC_ROUTINE_PROTOTYPE(DataTable); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDialogAdmin); -REXX_CLASSIC_ROUTINE_PROTOTYPE(SetItemData); -REXX_CLASSIC_ROUTINE_PROTOTYPE(SetStemData); -REXX_CLASSIC_ROUTINE_PROTOTYPE(GetItemData); -REXX_CLASSIC_ROUTINE_PROTOTYPE(GetStemData); -REXX_CLASSIC_ROUTINE_PROTOTYPE(Wnd_Desktop); -REXX_CLASSIC_ROUTINE_PROTOTYPE(WndShow_Pos); -REXX_CLASSIC_ROUTINE_PROTOTYPE(WinAPI32Func); -REXX_CLASSIC_ROUTINE_PROTOTYPE(InfoMessage); -REXX_CLASSIC_ROUTINE_PROTOTYPE(ErrorMessage); -REXX_CLASSIC_ROUTINE_PROTOTYPE(YesNoMessage); -REXX_CLASSIC_ROUTINE_PROTOTYPE(FindTheWindow); -REXX_CLASSIC_ROUTINE_PROTOTYPE(StartDialog); -REXX_CLASSIC_ROUTINE_PROTOTYPE(WindowRect); -REXX_CLASSIC_ROUTINE_PROTOTYPE(SetLBTabStops); -REXX_CLASSIC_ROUTINE_PROTOTYPE(GetScreenSize); -REXX_CLASSIC_ROUTINE_PROTOTYPE(GetSysMetrics); -REXX_CLASSIC_ROUTINE_PROTOTYPE(GetDialogFactor); -REXX_CLASSIC_ROUTINE_PROTOTYPE(SleepMS); -REXX_CLASSIC_ROUTINE_PROTOTYPE(PlaySoundFile); -REXX_CLASSIC_ROUTINE_PROTOTYPE(PlaySoundFileInLoop); -REXX_CLASSIC_ROUTINE_PROTOTYPE(StopSoundFile); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleScrollBar); -REXX_CLASSIC_ROUTINE_PROTOTYPE(BmpButton); -REXX_CLASSIC_ROUTINE_PROTOTYPE(DCDraw); -REXX_CLASSIC_ROUTINE_PROTOTYPE(DrawGetSet); -REXX_CLASSIC_ROUTINE_PROTOTYPE(ScrollText); -REXX_CLASSIC_ROUTINE_PROTOTYPE(ScrollTheWindow); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDC_Obj); -REXX_CLASSIC_ROUTINE_PROTOTYPE(SetBackground); -REXX_CLASSIC_ROUTINE_PROTOTYPE(LoadRemoveBitmap); -REXX_CLASSIC_ROUTINE_PROTOTYPE(WriteText); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleTreeCtrl); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleListCtrl); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleListCtrlEx); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleControlEx); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleOtherNewCtrls); -REXX_CLASSIC_ROUTINE_PROTOTYPE(WinTimer); -REXX_CLASSIC_ROUTINE_PROTOTYPE(DumpAdmin); -REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrAddControl); -REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrCreateDialog); -REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrDefineDialog); -REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrAddNewCtrl); -REXX_CLASSIC_ROUTINE_PROTOTYPE(UsrAddResource); -REXX_CLASSIC_ROUTINE_PROTOTYPE(WinMenu); -REXX_CLASSIC_ROUTINE_PROTOTYPE(InsertMII); -REXX_CLASSIC_ROUTINE_PROTOTYPE(SetMII); -REXX_CLASSIC_ROUTINE_PROTOTYPE(GetMII); -REXX_CLASSIC_ROUTINE_PROTOTYPE(SetMI); -REXX_CLASSIC_ROUTINE_PROTOTYPE(GetMI); -REXX_CLASSIC_ROUTINE_PROTOTYPE(TrackPopup); -REXX_CLASSIC_ROUTINE_PROTOTYPE(MemMenu); - -// now build the actual entry list -RexxRoutineEntry oodialog_functions[] = -{ - REXX_CLASSIC_ROUTINE(GetDlgMsg, GetDlgMsg), - REXX_CLASSIC_ROUTINE(SendWinMsg, SendWinMsg), - REXX_CLASSIC_ROUTINE(HandleDlg, HandleDlg), - REXX_CLASSIC_ROUTINE(AddUserMessage, AddUserMessage), - REXX_CLASSIC_ROUTINE(GetFileNameWindow, GetFileNameWindow), - REXX_CLASSIC_ROUTINE(DataTable, DataTable), - REXX_CLASSIC_ROUTINE(HandleDialogAdmin, HandleDialogAdmin), - REXX_CLASSIC_ROUTINE(SetItemData, SetItemData), - REXX_CLASSIC_ROUTINE(SetStemData, SetStemData), - REXX_CLASSIC_ROUTINE(GetItemData, GetItemData), - REXX_CLASSIC_ROUTINE(GetStemData, GetStemData), - REXX_CLASSIC_ROUTINE(Wnd_Desktop, Wnd_Desktop), - REXX_CLASSIC_ROUTINE(WndShow_Pos, WndShow_Pos), - REXX_CLASSIC_ROUTINE(WinAPI32Func, WinAPI32Func), - REXX_CLASSIC_ROUTINE(InfoMessage, InfoMessage), - REXX_CLASSIC_ROUTINE(ErrorMessage, ErrorMessage), - REXX_CLASSIC_ROUTINE(YesNoMessage, YesNoMessage), - REXX_CLASSIC_ROUTINE(FindTheWindow, FindTheWindow), - REXX_CLASSIC_ROUTINE(StartDialog, StartDialog), - REXX_CLASSIC_ROUTINE(WindowRect, WindowRect), - REXX_CLASSIC_ROUTINE(SetLBTabStops, SetLBTabStops), - REXX_CLASSIC_ROUTINE(GetScreenSize, GetScreenSize), - REXX_CLASSIC_ROUTINE(GetDialogFactor, GetDialogFactor), - REXX_CLASSIC_ROUTINE(SleepMS, SleepMS), - REXX_CLASSIC_ROUTINE(PlaySoundFile, PlaySoundFile), - REXX_CLASSIC_ROUTINE(PlaySoundFileInLoop, PlaySoundFileInLoop), - REXX_CLASSIC_ROUTINE(StopSoundFile, StopSoundFile), - REXX_CLASSIC_ROUTINE(HandleScrollBar, HandleScrollBar), - REXX_CLASSIC_ROUTINE(BmpButton, BmpButton), - REXX_CLASSIC_ROUTINE(DCDraw, DCDraw), - REXX_CLASSIC_ROUTINE(DrawGetSet, DrawGetSet), - REXX_CLASSIC_ROUTINE(ScrollText, ScrollText), - REXX_CLASSIC_ROUTINE(ScrollTheWindow, ScrollTheWindow), - REXX_CLASSIC_ROUTINE(HandleDC_Obj, HandleDC_Obj), - REXX_CLASSIC_ROUTINE(SetBackground, SetBackground), - REXX_CLASSIC_ROUTINE(LoadRemoveBitmap, LoadRemoveBitmap), - REXX_CLASSIC_ROUTINE(WriteText, WriteText), - REXX_CLASSIC_ROUTINE(HandleTreeCtrl, HandleTreeCtrl), - REXX_CLASSIC_ROUTINE(HandleListCtrl, HandleListCtrl), - REXX_CLASSIC_ROUTINE(HandleListCtrlEx, HandleListCtrlEx), - REXX_CLASSIC_ROUTINE(HandleControlEx, HandleControlEx), - REXX_CLASSIC_ROUTINE(HandleOtherNewCtrls, HandleOtherNewCtrls), - REXX_CLASSIC_ROUTINE(WinTimer, WinTimer), - REXX_CLASSIC_ROUTINE(DumpAdmin, DumpAdmin), - REXX_CLASSIC_ROUTINE(UsrAddControl, UsrAddControl), - REXX_CLASSIC_ROUTINE(UsrCreateDialog, UsrCreateDialog), - REXX_CLASSIC_ROUTINE(UsrDefineDialog, UsrDefineDialog), - REXX_CLASSIC_ROUTINE(UsrAddNewCtrl, UsrAddNewCtrl), - REXX_CLASSIC_ROUTINE(UsrAddResource, UsrAddResource), - - REXX_CLASSIC_ROUTINE(WinMenu, WinMenu), - REXX_CLASSIC_ROUTINE(InsertMII, InsertMII), - REXX_CLASSIC_ROUTINE(SetMII, SetMII), - REXX_CLASSIC_ROUTINE(GetMII, GetMII), - REXX_CLASSIC_ROUTINE(SetMI, SetMI), - REXX_CLASSIC_ROUTINE(GetMI, GetMI), - REXX_CLASSIC_ROUTINE(TrackPopup, TrackPopup), - REXX_CLASSIC_ROUTINE(MemMenu, MemMenu), - REXX_LAST_ROUTINE() -}; - -REXX_METHOD_PROTOTYPE(dlgutil_init_cls); -REXX_METHOD_PROTOTYPE(dlgutil_comctl32Version_cls); -REXX_METHOD_PROTOTYPE(dlgutil_version_cls); -REXX_METHOD_PROTOTYPE(dlgutil_hiWord_cls); -REXX_METHOD_PROTOTYPE(dlgutil_loWord_cls); -REXX_METHOD_PROTOTYPE(dlgutil_and_cls); -REXX_METHOD_PROTOTYPE(dlgutil_or_cls); -REXX_METHOD_PROTOTYPE(dlgutil_getSystemMetrics_cls); -REXX_METHOD_PROTOTYPE(dlgutil_handleToPointer_cls); -REXX_METHOD_PROTOTYPE(dlgutil_test_cls); - -REXX_METHOD_PROTOTYPE(wb_getStyleRaw); -REXX_METHOD_PROTOTYPE(wb_getExStyleRaw); - -REXX_METHOD_PROTOTYPE(pbdlg_init_cls); -REXX_METHOD_PROTOTYPE(pbdlg_setDefaultFont_cls); -REXX_METHOD_PROTOTYPE(pbdlg_getFontName_cls); -REXX_METHOD_PROTOTYPE(pbdlg_getFontSize_cls); -REXX_METHOD_PROTOTYPE(pbdlg_getTextSizeDlg); - -REXX_METHOD_PROTOTYPE(resdlg_setFontAttrib_pvt); - -REXX_METHOD_PROTOTYPE(winex_getTextSizeScreen); -REXX_METHOD_PROTOTYPE(winex_getFont); -REXX_METHOD_PROTOTYPE(winex_setFont); -REXX_METHOD_PROTOTYPE(winex_createFontEx); -REXX_METHOD_PROTOTYPE(winex_createFont); - -REXX_METHOD_PROTOTYPE(ri_init); -REXX_METHOD_PROTOTYPE(ri_release); -REXX_METHOD_PROTOTYPE(ri_handle); -REXX_METHOD_PROTOTYPE(ri_isNull); -REXX_METHOD_PROTOTYPE(ri_systemErrorCode); -REXX_METHOD_PROTOTYPE(ri_getImage); -REXX_METHOD_PROTOTYPE(ri_getImages); - -REXX_METHOD_PROTOTYPE(image_id_cls); -REXX_METHOD_PROTOTYPE(image_getImage_cls); -REXX_METHOD_PROTOTYPE(image_fromFiles_cls); -REXX_METHOD_PROTOTYPE(image_fromIDs_cls); -REXX_METHOD_PROTOTYPE(image_colorRef_cls); -REXX_METHOD_PROTOTYPE(image_getRValue_cls); -REXX_METHOD_PROTOTYPE(image_getGValue_cls); -REXX_METHOD_PROTOTYPE(image_getBValue_cls); -REXX_METHOD_PROTOTYPE(image_init); -REXX_METHOD_PROTOTYPE(image_release); -REXX_METHOD_PROTOTYPE(image_isNull); -REXX_METHOD_PROTOTYPE(image_handle); -REXX_METHOD_PROTOTYPE(image_systemErrorCode); - -REXX_METHOD_PROTOTYPE(il_create_cls); -REXX_METHOD_PROTOTYPE(il_init); -REXX_METHOD_PROTOTYPE(il_release); -REXX_METHOD_PROTOTYPE(il_add); -REXX_METHOD_PROTOTYPE(il_addMasked); -REXX_METHOD_PROTOTYPE(il_addIcon); -REXX_METHOD_PROTOTYPE(il_addImages); -REXX_METHOD_PROTOTYPE(il_addImages); -REXX_METHOD_PROTOTYPE(il_getCount); -REXX_METHOD_PROTOTYPE(il_getImageSize); -REXX_METHOD_PROTOTYPE(il_duplicate); -REXX_METHOD_PROTOTYPE(il_remove); -REXX_METHOD_PROTOTYPE(il_removeAll); -REXX_METHOD_PROTOTYPE(il_isNull); -REXX_METHOD_PROTOTYPE(il_handle); - -REXX_METHOD_PROTOTYPE(dlgctrl_getTextSizeDlg); - -REXX_METHOD_PROTOTYPE(advCtrl_getStaticControl); -REXX_METHOD_PROTOTYPE(advCtrl_getButtonControl); -REXX_METHOD_PROTOTYPE(advCtrl_getListControl); -REXX_METHOD_PROTOTYPE(advCtrl_getTreeControl); -REXX_METHOD_PROTOTYPE(advCtrl_getTabControl); -REXX_METHOD_PROTOTYPE(advCtrl_putControl_pvt); - -REXX_METHOD_PROTOTYPE(lv_setImageList); -REXX_METHOD_PROTOTYPE(lv_getImageList); -REXX_METHOD_PROTOTYPE(lv_getColumnCount); -REXX_METHOD_PROTOTYPE(lv_getColumnOrder); -REXX_METHOD_PROTOTYPE(lv_setColumnOrder); -REXX_METHOD_PROTOTYPE(lv_insertColumnEx); // TODO review method name -REXX_METHOD_PROTOTYPE(lv_columnWidthEx); // TODO review method name -REXX_METHOD_PROTOTYPE(lv_stringWidthEx); // TODO review method name -REXX_METHOD_PROTOTYPE(lv_addRowEx); // TODO review method name - -REXX_METHOD_PROTOTYPE(tv_setImageList); -REXX_METHOD_PROTOTYPE(tv_getImageList); - -REXX_METHOD_PROTOTYPE(tab_setImageList); -REXX_METHOD_PROTOTYPE(tab_getImageList); - -REXX_METHOD_PROTOTYPE(get_dtp_dateTime); -REXX_METHOD_PROTOTYPE(set_dtp_dateTime); - -REXX_METHOD_PROTOTYPE(get_mc_date); -REXX_METHOD_PROTOTYPE(set_mc_date); -REXX_METHOD_PROTOTYPE(get_mc_usesUnicode); -REXX_METHOD_PROTOTYPE(set_mc_usesUnicode); - -REXX_METHOD_PROTOTYPE(pbc_stepIt); -REXX_METHOD_PROTOTYPE(pbc_getPos); -REXX_METHOD_PROTOTYPE(pbc_setPos); -REXX_METHOD_PROTOTYPE(pbc_getRange); -REXX_METHOD_PROTOTYPE(pbc_setRange); -REXX_METHOD_PROTOTYPE(pbc_setStep); -REXX_METHOD_PROTOTYPE(pbc_setMarquee); -REXX_METHOD_PROTOTYPE(pbc_setBkColor); -REXX_METHOD_PROTOTYPE(pbc_setBarColor); - -REXX_METHOD_PROTOTYPE(stc_getText); -REXX_METHOD_PROTOTYPE(stc_setText); -REXX_METHOD_PROTOTYPE(stc_getIcon); -REXX_METHOD_PROTOTYPE(stc_setIcon); -REXX_METHOD_PROTOTYPE(stc_getImage); -REXX_METHOD_PROTOTYPE(stc_setImage); - -REXX_METHOD_PROTOTYPE(gb_setStyle); -REXX_METHOD_PROTOTYPE(bc_getState); -REXX_METHOD_PROTOTYPE(bc_setState); -REXX_METHOD_PROTOTYPE(bc_setStyle); -REXX_METHOD_PROTOTYPE(bc_click); -REXX_METHOD_PROTOTYPE(bc_getIdealSize); -REXX_METHOD_PROTOTYPE(bc_getTextMargin); -REXX_METHOD_PROTOTYPE(bc_setTextMargin); -REXX_METHOD_PROTOTYPE(bc_getImage); -REXX_METHOD_PROTOTYPE(bc_setImage); -REXX_METHOD_PROTOTYPE(bc_setImageList); -REXX_METHOD_PROTOTYPE(bc_getImageList); -REXX_METHOD_PROTOTYPE(rb_checkInGroup_cls); -REXX_METHOD_PROTOTYPE(rb_getCheckState); -REXX_METHOD_PROTOTYPE(rb_checked); -REXX_METHOD_PROTOTYPE(rb_check); -REXX_METHOD_PROTOTYPE(rb_uncheck); -REXX_METHOD_PROTOTYPE(rb_isChecked); -REXX_METHOD_PROTOTYPE(rb_indeterminate); -REXX_METHOD_PROTOTYPE(ckbx_isIndeterminate); -REXX_METHOD_PROTOTYPE(ckbx_setIndeterminate); -REXX_METHOD_PROTOTYPE(bc_test); - -REXX_METHOD_PROTOTYPE(menu_test); -REXX_METHOD_PROTOTYPE(menu_connectAllItems); - -REXX_METHOD_PROTOTYPE(rect_init); -REXX_METHOD_PROTOTYPE(rect_left); -REXX_METHOD_PROTOTYPE(rect_top); -REXX_METHOD_PROTOTYPE(rect_right); -REXX_METHOD_PROTOTYPE(rect_bottom); -REXX_METHOD_PROTOTYPE(rect_setLeft); -REXX_METHOD_PROTOTYPE(rect_setTop); -REXX_METHOD_PROTOTYPE(rect_setRight); -REXX_METHOD_PROTOTYPE(rect_setBottom); - -REXX_METHOD_PROTOTYPE(point_init); -REXX_METHOD_PROTOTYPE(point_x); -REXX_METHOD_PROTOTYPE(point_setX); -REXX_METHOD_PROTOTYPE(point_y); -REXX_METHOD_PROTOTYPE(point_setY); - -REXX_METHOD_PROTOTYPE(size_init); -REXX_METHOD_PROTOTYPE(size_cx); -REXX_METHOD_PROTOTYPE(size_setCX); -REXX_METHOD_PROTOTYPE(size_cy); -REXX_METHOD_PROTOTYPE(size_setCY); - -RexxMethodEntry oodialog_methods[] = { - REXX_METHOD(dlgutil_init_cls, dlgutil_init_cls), - REXX_METHOD(dlgutil_comctl32Version_cls, dlgutil_comctl32Version_cls), - REXX_METHOD(dlgutil_version_cls, dlgutil_version_cls), - REXX_METHOD(dlgutil_hiWord_cls, dlgutil_hiWord_cls), - REXX_METHOD(dlgutil_and_cls, dlgutil_and_cls), - REXX_METHOD(dlgutil_or_cls, dlgutil_or_cls), - REXX_METHOD(dlgutil_loWord_cls, dlgutil_loWord_cls), - REXX_METHOD(dlgutil_handleToPointer_cls, dlgutil_handleToPointer_cls), - REXX_METHOD(dlgutil_getSystemMetrics_cls, dlgutil_getSystemMetrics_cls), - REXX_METHOD(dlgutil_test_cls, dlgutil_test_cls), - - REXX_METHOD(wb_getStyleRaw, wb_getStyleRaw), - REXX_METHOD(wb_getExStyleRaw, wb_getExStyleRaw), - - REXX_METHOD(pbdlg_init_cls, pbdlg_init_cls), - REXX_METHOD(pbdlg_setDefaultFont_cls, pbdlg_setDefaultFont_cls), - REXX_METHOD(pbdlg_getFontName_cls, pbdlg_getFontName_cls), - REXX_METHOD(pbdlg_getFontSize_cls, pbdlg_getFontSize_cls), - REXX_METHOD(pbdlg_getTextSizeDlg, pbdlg_getTextSizeDlg), - - REXX_METHOD(resdlg_setFontAttrib_pvt, resdlg_setFontAttrib_pvt), - - REXX_METHOD(winex_getTextSizeScreen, winex_getTextSizeScreen), - REXX_METHOD(winex_getFont, winex_getFont), - REXX_METHOD(winex_setFont, winex_setFont), - REXX_METHOD(winex_createFontEx, winex_createFontEx), - REXX_METHOD(winex_createFont, winex_createFont), - - REXX_METHOD(ri_init, ri_init), - REXX_METHOD(ri_release, ri_release), - REXX_METHOD(ri_handle, ri_handle), - REXX_METHOD(ri_isNull, ri_isNull), - REXX_METHOD(ri_systemErrorCode, ri_systemErrorCode), - REXX_METHOD(ri_getImage, ri_getImage), - REXX_METHOD(ri_getImages, ri_getImages), - - REXX_METHOD(image_id_cls, image_id_cls), - REXX_METHOD(image_getImage_cls, image_getImage_cls), - REXX_METHOD(image_fromFiles_cls, image_fromFiles_cls), - REXX_METHOD(image_fromIDs_cls, image_fromIDs_cls), - REXX_METHOD(image_colorRef_cls, image_colorRef_cls), - REXX_METHOD(image_getRValue_cls, image_getRValue_cls), - REXX_METHOD(image_getGValue_cls, image_getGValue_cls), - REXX_METHOD(image_getBValue_cls, image_getBValue_cls), - REXX_METHOD(image_init, image_init), - REXX_METHOD(image_release, image_release), - REXX_METHOD(image_isNull, image_isNull), - REXX_METHOD(image_systemErrorCode, image_systemErrorCode), - REXX_METHOD(image_handle, image_handle), - - REXX_METHOD(il_create_cls, il_create_cls), - REXX_METHOD(il_init, il_init), - REXX_METHOD(il_release, il_release), - REXX_METHOD(il_add, il_add), - REXX_METHOD(il_addMasked, il_addMasked), - REXX_METHOD(il_addIcon, il_addIcon), - REXX_METHOD(il_addImages, il_addImages), - REXX_METHOD(il_getCount, il_getCount), - REXX_METHOD(il_getImageSize, il_getImageSize), - REXX_METHOD(il_duplicate, il_duplicate), - REXX_METHOD(il_removeAll, il_removeAll), - REXX_METHOD(il_remove, il_remove), - REXX_METHOD(il_isNull, il_isNull), - REXX_METHOD(il_handle, il_handle), - - REXX_METHOD(dlgctrl_getTextSizeDlg, dlgctrl_getTextSizeDlg), - - REXX_METHOD(advCtrl_getStaticControl, advCtrl_getStaticControl), - REXX_METHOD(advCtrl_getButtonControl, advCtrl_getButtonControl), - REXX_METHOD(advCtrl_getListControl, advCtrl_getListControl), - REXX_METHOD(advCtrl_getTreeControl, advCtrl_getTreeControl), - REXX_METHOD(advCtrl_getTabControl, advCtrl_getTabControl), - REXX_METHOD(advCtrl_putControl_pvt, advCtrl_putControl_pvt), - - REXX_METHOD(lv_setImageList, lv_setImageList), - REXX_METHOD(lv_getImageList, lv_getImageList), - REXX_METHOD(lv_getColumnCount, lv_getColumnCount), - REXX_METHOD(lv_getColumnOrder, lv_getColumnOrder), - REXX_METHOD(lv_setColumnOrder, lv_setColumnOrder), - REXX_METHOD(lv_insertColumnEx, lv_insertColumnEx), // TODO review method name - REXX_METHOD(lv_columnWidthEx, lv_columnWidthEx), // TODO review method name - REXX_METHOD(lv_stringWidthEx, lv_stringWidthEx), // TODO review method name - REXX_METHOD(lv_addRowEx, lv_addRowEx), // TODO review method name - - REXX_METHOD(tv_setImageList, tv_setImageList), - REXX_METHOD(tv_getImageList, tv_getImageList), - - REXX_METHOD(tab_setImageList, tab_setImageList), - REXX_METHOD(tab_getImageList, tab_getImageList), - - REXX_METHOD(get_dtp_dateTime, get_dtp_dateTime), - REXX_METHOD(set_dtp_dateTime, set_dtp_dateTime), - - REXX_METHOD(get_mc_date, get_mc_date), - REXX_METHOD(set_mc_date, set_mc_date), - REXX_METHOD(get_mc_usesUnicode, get_mc_usesUnicode), - REXX_METHOD(set_mc_usesUnicode, set_mc_usesUnicode), - - REXX_METHOD(pbc_stepIt, pbc_stepIt), - REXX_METHOD(pbc_getPos, pbc_getPos), - REXX_METHOD(pbc_setPos, pbc_setPos), - REXX_METHOD(pbc_getRange, pbc_getRange), - REXX_METHOD(pbc_setRange, pbc_setRange), - REXX_METHOD(pbc_setStep, pbc_setStep), - REXX_METHOD(pbc_setMarquee, pbc_setMarquee), - REXX_METHOD(pbc_setBkColor, pbc_setBkColor), - REXX_METHOD(pbc_setBarColor, pbc_setBarColor), - - REXX_METHOD(stc_getText, stc_getText), - REXX_METHOD(stc_setText, stc_setText), - REXX_METHOD(stc_getIcon, stc_getIcon), - REXX_METHOD(stc_setIcon, stc_setIcon), - REXX_METHOD(stc_getImage, stc_getImage), - REXX_METHOD(stc_setImage, stc_setImage), - - REXX_METHOD(bc_getState, bc_getState), - REXX_METHOD(bc_setState, bc_setState), - REXX_METHOD(bc_setStyle, bc_setStyle), - REXX_METHOD(bc_click, bc_click), - REXX_METHOD(bc_getIdealSize, bc_getIdealSize), - REXX_METHOD(bc_getTextMargin, bc_getTextMargin), - REXX_METHOD(bc_setTextMargin, bc_setTextMargin), - REXX_METHOD(bc_getImage, bc_getImage), - REXX_METHOD(bc_setImage, bc_setImage), - REXX_METHOD(bc_setImageList, bc_setImageList), - REXX_METHOD(bc_getImageList, bc_getImageList), - REXX_METHOD(rb_checkInGroup_cls, rb_checkInGroup_cls), - REXX_METHOD(rb_checked, rb_checked), - REXX_METHOD(rb_check, rb_check), - REXX_METHOD(rb_uncheck, rb_uncheck), - REXX_METHOD(rb_getCheckState, rb_getCheckState), - REXX_METHOD(rb_isChecked, rb_isChecked), - REXX_METHOD(rb_indeterminate, rb_indeterminate), - REXX_METHOD(ckbx_isIndeterminate, ckbx_isIndeterminate), - REXX_METHOD(ckbx_setIndeterminate, ckbx_setIndeterminate), - REXX_METHOD(gb_setStyle, gb_setStyle), - REXX_METHOD(bc_test, bc_test), - - REXX_METHOD(menu_test, menu_test), - REXX_METHOD(menu_connectAllItems, menu_connectAllItems), - - REXX_METHOD(rect_init, rect_init), - REXX_METHOD(rect_left, rect_left), - REXX_METHOD(rect_top, rect_top), - REXX_METHOD(rect_right, rect_right), - REXX_METHOD(rect_bottom, rect_bottom), - REXX_METHOD(rect_setLeft, rect_setLeft), - REXX_METHOD(rect_setTop, rect_setTop), - REXX_METHOD(rect_setRight, rect_setRight), - REXX_METHOD(rect_setBottom, rect_setBottom), - REXX_METHOD(point_init, point_init), - REXX_METHOD(point_x, point_x), - REXX_METHOD(point_setX, point_setX), - REXX_METHOD(point_y, point_y), - REXX_METHOD(point_setY, point_setY), - REXX_METHOD(size_init, size_init), - REXX_METHOD(size_cx, size_cx), - REXX_METHOD(size_setCX, size_setCX), - REXX_METHOD(size_cy, size_cy), - REXX_METHOD(size_setCY, size_setCY), - REXX_LAST_METHOD() -}; - -RexxPackageEntry oodialog_package_entry = -{ - STANDARD_PACKAGE_HEADER - REXX_INTERPRETER_4_0_0, // anything after 4.0.0 will work - "OODIALOG", // name of the package - "4.0", // package information - NULL, // no load/unload functions - NULL, - oodialog_functions, // the exported functions - oodialog_methods // the exported methods -}; - -// package loading stub. -OOREXX_GET_PACKAGE(oodialog); Modified: main/trunk/extensions/platform/windows/oodialog/oovutil.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovutil.h 2009-04-19 06:32:57 UTC (rev 4429) +++ main/trunk/extensions/platform/windows/oodialog/oovutil.h 2009-04-19 06:40:07 UTC (rev 4430) @@ -80,7 +80,6 @@ #define MSG_TERMINATE "1DLGDELETED1" -extern LONG HandleError(PRXSTRING r, CHAR * text); /* Flags for the get icon functions. Indicates the source of the icon. */ #define ICON_FILE 0x00000001 @@ -261,11 +260,6 @@ while ((i<StoredDialogs) && (DialogTab[i]->TheDlg != hDlg) && (DialogTab[i]->AktChild != hDlg)) i++; \ if (i<StoredDialogs) addressedTo = DialogTab[i]; else addressedTo = NULL; } \ -void *string2pointer(const char *string); -inline void *string2pointer(CONSTRXSTRING *string) { return string2pointer(string->strptr); } -inline void *string2pointer(CONSTRXSTRING &string) { return string2pointer(string.strptr); } -void pointer2string(char *, void *pointer); -inline void pointer2string(PRXSTRING result, void *pointer) { pointer2string(result->strptr, pointer); result->strlength = strlen(result->strptr); } #define DEF_ADM DIALOGADMIN * dlgAdm = NULL #define GET_ADM dlgAdm = (DIALOGADMIN *)string2pointer(&argv[0]) @@ -524,9 +518,18 @@ extern INT StoredDialogs; extern CRITICAL_SECTION crit_sec; + // These utility functions are defined in oovtools.cpp extern BOOL DialogInAdminTable(DIALOGADMIN * Dlg); extern void rxstrlcpy(CHAR * tar, CONSTRXSTRING &src); extern void rxdatacpy(CHAR * tar, RXSTRING &src); extern bool IsYes(const char *s); +extern void *string2pointer(const char *string); +extern void pointer2string(char *, void *pointer); +extern LONG HandleError(PRXSTRING r, CHAR * text); + +inline void *string2pointer(CONSTRXSTRING *string) { return string2pointer(string->strptr); } +inline void *string2pointer(CONSTRXSTRING &string) { return string2pointer(string.strptr); } +inline void pointer2string(PRXSTRING result, void *pointer) { pointer2string(result->strptr, pointer); result->strlength = strlen(result->strptr); } + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-04-21 16:42:23
|
Revision: 4466 http://oorexx.svn.sourceforge.net/oorexx/?rev=4466&view=rev Author: miesfeld Date: 2009-04-21 16:42:13 +0000 (Tue, 21 Apr 2009) Log Message: ----------- [2724780] ooDialog classes use call function(parm) syntax Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/dlgext.cls main/trunk/extensions/platform/windows/oodialog/dyndlg.cls main/trunk/extensions/platform/windows/oodialog/plbdlg.cls main/trunk/extensions/platform/windows/oodialog/stddlg.cls Modified: main/trunk/extensions/platform/windows/oodialog/dlgext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-04-21 15:54:47 UTC (rev 4465) +++ main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-04-21 16:42:13 UTC (rev 4466) @@ -74,7 +74,7 @@ ::method EndAsyncExecution unguarded do while self~finished = 0 - call sleepms(20) + call sleepms 20 end if self~InitCode = 1 then do if (self~UseStem = 1) then self~GetDataStem(self~DlgData) @@ -95,7 +95,7 @@ end else do if msg \= "" then interpret("self~"msg) - else call sleepms(sleeptime) /* to yield cpu */ + else call sleepms sleeptime /* to yield cpu */ end end @@ -1062,7 +1062,7 @@ else do say "Dump of administration state" say "============================" - call DumpAdmin("ADMDUMP") + call DumpAdmin "ADMDUMP" d = Digits() NUMERIC DIGITS 15 do i = 1 to admdump.0 Modified: main/trunk/extensions/platform/windows/oodialog/dyndlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dyndlg.cls 2009-04-21 15:54:47 UTC (rev 4465) +++ main/trunk/extensions/platform/windows/oodialog/dyndlg.cls 2009-04-21 16:42:13 UTC (rev 4466) @@ -90,7 +90,7 @@ parse var ret base ptr self~BasePtr = base self~activePtr = ptr - if ptr = 0 then call HandleDlg("STOP") + if ptr = 0 then call HandleDlg "STOP" self~SizeX = cx self~SizeY = cy self~DefineDialog @@ -129,7 +129,7 @@ ::method Load forward message "LoadFrame" continue hnd = result - if hnd \= 0 then forward message "LoadItems" continue; else call HandleDlg("STOP") + if hnd \= 0 then forward message "LoadItems" continue; else call HandleDlg "STOP" return (hnd=0) Modified: main/trunk/extensions/platform/windows/oodialog/plbdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-04-21 15:54:47 UTC (rev 4465) +++ main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-04-21 16:42:13 UTC (rev 4466) @@ -101,7 +101,7 @@ ::method Unknown unguarded use arg msgname - call ErrorMessage(msgname || " is not a method of " || self) + call ErrorMessage msgname || " is not a method of " || self ::method init_WindowBase use arg hwnd Modified: main/trunk/extensions/platform/windows/oodialog/stddlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/stddlg.cls 2009-04-21 15:54:47 UTC (rev 4465) +++ main/trunk/extensions/platform/windows/oodialog/stddlg.cls 2009-04-21 16:42:13 UTC (rev 4466) @@ -142,7 +142,7 @@ self~GetDataStem(datas.) if datas.101~DataType('W') = 0 then do - call InfoMessage("You did not enter numerical data") + call infoDialog "You did not enter numerical data" return 0 end else return 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-04-26 17:36:16
|
Revision: 4505 http://oorexx.svn.sourceforge.net/oorexx/?rev=4505&view=rev Author: miesfeld Date: 2009-04-26 17:36:04 +0000 (Sun, 26 Apr 2009) Log Message: ----------- Continue work moving all of ooDialog to new native API Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp main/trunk/extensions/platform/windows/oodialog/APICommon.h main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp main/trunk/extensions/platform/windows/oodialog/oodialog.mak main/trunk/extensions/platform/windows/oodialog/oodialog.rc main/trunk/extensions/platform/windows/oodialog/oodutils.cls main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp main/trunk/extensions/platform/windows/oodialog/oovdata.cpp main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp main/trunk/extensions/platform/windows/oodialog/oovdraw.cpp main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp main/trunk/extensions/platform/windows/oodialog/oovother.cpp main/trunk/extensions/platform/windows/oodialog/oovscrll.cpp main/trunk/extensions/platform/windows/oodialog/oovtext.cpp main/trunk/extensions/platform/windows/oodialog/oovuser.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.h main/trunk/extensions/platform/windows/oodialog/plbdlg.cls Added Paths: ----------- main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp main/trunk/extensions/platform/windows/oodialog/oodCommon.h main/trunk/extensions/platform/windows/oodialog/oodRoutines.cpp main/trunk/extensions/platform/windows/oodialog/oodSymbols.h Removed Paths: ------------- main/trunk/extensions/platform/windows/oodialog/oodResources.h main/trunk/extensions/platform/windows/oodialog/oovtools.cpp Modified: main/trunk/extensions/platform/windows/oodialog/APICommon.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -197,18 +197,6 @@ wrongArgValueException(c, pos, list, c->String(actual)); } - -POINTER rxGetPointerAttribute(RexxMethodContext *context, RexxObjectPtr obj, CSTRING name) -{ - CSTRING value = ""; - RexxObjectPtr rxString = context->SendMessage0(obj, name); - if ( rxString != NULLOBJECT ) - { - value = context->ObjectToStringValue(rxString); - } - return string2pointer(value); -} - CSTRING rxGetStringAttribute(RexxMethodContext *context, RexxObjectPtr obj, CSTRING name) { CSTRING value = NULL; Modified: main/trunk/extensions/platform/windows/oodialog/APICommon.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/APICommon.h 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/APICommon.h 2009-04-26 17:36:04 UTC (rev 4505) @@ -36,11 +36,10 @@ /* */; /*----------------------------------------------------------------------------*/; -/* This file xxxx; - * ; - * ; - */ +#ifndef APICommon_Included +#define APICommon_Included + #define NO_HMODULE_MSG "failed to obtain %s module handle; OS error code %d" #define NO_PROC_MSG "failed to get procedeure adddress for %s(); OS error code %d" #define API_FAILED_MSG "system API %s() failed; OS error code %d" @@ -71,7 +70,6 @@ extern void wrongArgValueException(RexxMethodContext *c, int pos, const char *list, RexxObjectPtr actual); extern void wrongArgValueException(RexxMethodContext *c, int pos, const char *list, const char *actual); -extern POINTER rxGetPointerAttribute(RexxMethodContext *context, RexxObjectPtr obj, CSTRING name);; extern CSTRING rxGetStringAttribute(RexxMethodContext *context, RexxObjectPtr obj, CSTRING name);; extern bool requiredClass(RexxMethodContext *c, RexxObjectPtr obj, const char *name, int pos); extern size_t rxArgCount(RexxMethodContext * context); @@ -79,3 +77,4 @@ extern RexxClassObject rxGetContextClass(RexxMethodContext *c, CSTRING name); extern RexxObjectPtr rxSetObjVar(RexxMethodContext *c, CSTRING varName, RexxObjectPtr val); +#endif Copied: main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp (from rev 4481, main/trunk/extensions/platform/windows/oodialog/oovtools.cpp) =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp (rev 0) +++ main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -0,0 +1,163 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * oodCommon.cpp + * + * Contains convenience / helper functions used throughout the ooDialog modules. + */ + +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h + +#include <stdio.h> +#include <dlgs.h> +#include <malloc.h> +#include "APICommon.h" +#include "oodCommon.h" + + +BOOL DialogInAdminTable(DIALOGADMIN * Dlg) +{ + register INT i; + for ( i = 0; i < StoredDialogs; i++ ) + { + if ( DialogTab[i] == Dlg ) + { + break; + } + } + return(i < StoredDialogs); +} + +/** + * Validates and converts an ASCII-Z string from string form to a pointer value. + * + * @param string String to convert. + */ +void *string2pointer(const char *string) +{ + void *pointer = 0; + sscanf(string, "0x%p", &pointer); + return pointer; +} + +void pointer2string(char *result, void *pointer) +{ + if ( pointer == NULL ) + { + sprintf(result, "0"); + } + else + { + sprintf(result, "0x%p", pointer); + } +} + + +LONG HandleError(PRXSTRING r, CHAR * text) +{ + HWND hW = NULL; + if ((topDlg) && (topDlg->TheDlg)) hW = topDlg->TheDlg; + MessageBox(hW,text,"Error",MB_OK | MB_ICONHAND); + r->strlength = 2; + r->strptr[0] = '4'; + r->strptr[1] = '0'; + r->strptr[2] = '\0'; + return 40; +} + +void rxstrlcpy(CHAR * tar, CONSTRXSTRING &src) +{ + register UINT i; + for (i=0; (i<src.strlength) && (i<STR_BUFFER-1);i++) tar[i] = src.strptr[i]; + tar[i] = '\0'; +} + +void rxdatacpy(CHAR * tar, RXSTRING &src) +{ + register UINT i; + for (i=0; (i<src.strlength) && (i<DATA_BUFFER-1);i++) tar[i] = src.strptr[i]; + tar[i] = '\0'; +} + +bool IsYes(const char * s) +{ + if (!strlen(s)) return FALSE; + + return ((s[0]=='j') || (s[0]=='J') || (s[0]=='y') || (s[0]=='Y') || atoi(s)); +} + +/* Slightly stricter than IsYes. TODO remove this when YesNoMessage() is + fixed. */ +bool IsNo(const char * s) +{ + return ( s && (*s == 'N' || *s == 'n') ); +} + +DIALOGADMIN *rxGetDlgAdm(RexxMethodContext *context, RexxObjectPtr dlg) +{ + DIALOGADMIN *adm = (DIALOGADMIN *)rxGetPointerAttribute(context, dlg, "ADM"); + if ( adm == NULL ) + { + // Want this message: Could not retrieve the "value" information for "object" + // similar to old 98.921 + + TCHAR buf[128]; + RexxObjectPtr name = context->SendMessage0(dlg, "OBJECTNAME"); + _snprintf(buf, sizeof(buf), "Could not retrieve the dialog administration block information for %s", + context->ObjectToStringValue(name)); + + context->RaiseException1(Rexx_Error_Execution_user_defined, context->String(buf)); + } + return adm; +} + + +// TODO move to APICommon when ooDialog is converted to use .Pointer instead of +// pointer strings. +POINTER rxGetPointerAttribute(RexxMethodContext *context, RexxObjectPtr obj, CSTRING name) +{ + CSTRING value = ""; + RexxObjectPtr rxString = context->SendMessage0(obj, name); + if ( rxString != NULLOBJECT ) + { + value = context->ObjectToStringValue(rxString); + } + return string2pointer(value); +} + Added: main/trunk/extensions/platform/windows/oodialog/oodCommon.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodCommon.h (rev 0) +++ main/trunk/extensions/platform/windows/oodialog/oodCommon.h 2009-04-26 17:36:04 UTC (rev 4505) @@ -0,0 +1,94 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/*----------------------------------------------------------------------------*/ + +#ifndef oodCommon_Included +#define oodCommon_Included + +extern BOOL DialogInAdminTable(DIALOGADMIN * Dlg); +extern void rxstrlcpy(CHAR * tar, CONSTRXSTRING &src); +extern void rxdatacpy(CHAR * tar, RXSTRING &src); +extern bool IsYes(const char *s); +extern bool IsNo(const char * s); +extern void *string2pointer(const char *string); +extern void pointer2string(char *, void *pointer); +extern LONG HandleError(PRXSTRING r, CHAR * text); +extern char *strdupupr_nospace(const char *str); +extern DIALOGADMIN *rxGetDlgAdm(RexxMethodContext *, RexxObjectPtr); + +// TODO move to APICommon when ooDialog is converted to use .Pointer instead of +// pointer strings. +extern POINTER rxGetPointerAttribute(RexxMethodContext *context, RexxObjectPtr obj, CSTRING name);; + +#define GET_HANDLE(p) string2pointer(p) +#define GET_HWND(p) ((HWND)string2pointer(p)) +#define GET_POINTER(p) string2pointer(p) + +inline void *string2pointer(CONSTRXSTRING *string) { return string2pointer(string->strptr); } +inline void *string2pointer(CONSTRXSTRING &string) { return string2pointer(string.strptr); } + +inline void pointer2string(PRXSTRING result, void *pointer) +{ + pointer2string(result->strptr, pointer); + result->strlength = strlen(result->strptr); +} + +inline void safeLocalFree(void *p) +{ + if (p != NULL) + { + LocalFree(p); + } +} + +inline void safeFree(void *p) +{ + if (p != NULL) + { + free(p); + } +} + +inline void safeDeleteObject(HANDLE h) +{ + if (h != NULL) + { + DeleteObject(h); + } +} + +#endif Modified: main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -41,14 +41,11 @@ #include <malloc.h> #include <limits.h> #include "APICommon.h" +#include "oodCommon.h" LPWORD lpwAlign(LPWORD lpIn); BOOL AddTheMessage(DIALOGADMIN *, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, CSTRING, ULONG); -/* TODO FIXME need these to go into oodCommon.cpp. */ -char *strdupupr_nospace(const char *str); -DIALOGADMIN *rxGetDlgAdm(RexxMethodContext *, RexxObjectPtr); - /** * Convenience function to return a menu handle to ooRexx. * Deleted: main/trunk/extensions/platform/windows/oodialog/oodResources.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodResources.h 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oodResources.h 2009-04-26 17:36:04 UTC (rev 4505) @@ -1,50 +0,0 @@ -/*----------------------------------------------------------------------------*/ -/* */ -/* Copyright (c) 2007 Rexx Language Association. All rights reserved. */ -/* */ -/* This program and the accompanying materials are made available under */ -/* the terms of the Common Public License v1.0 which accompanies this */ -/* distribution. A copy is also available at the following address: */ -/* http://www.oorexx.org/license.html */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in */ -/* the documentation and/or other materials provided with the distribution. */ -/* */ -/* Neither the name of Rexx Language Association nor the names */ -/* of its contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ -/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ -/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ -/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ -/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ -/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ -/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ -/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ -/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ -/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* */ -/*----------------------------------------------------------------------------*/ - -/* Symbolic ID definitions for ooDialog resources. The init method in - * PlainBaseDialog puts these into the ConstDir directory. IF changing these - * IDs here, it would be nice to sync up the PlainBaseDialog. - */ - -#define IDI_DLG_OODIALOG 11 -#define IDI_DLG_APPICON 12 -#define IDI_DLG_APPICON2 13 -#define IDI_DLG_OOREXX 14 - -#define IDI_DLG_DEFAULT IDI_DLG_APPICON2 -#define IDI_DLG_MIN_ID IDI_DLG_OODIALOG -#define IDI_DLG_MAX_ID IDI_DLG_OOREXX Added: main/trunk/extensions/platform/windows/oodialog/oodRoutines.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodRoutines.cpp (rev 0) +++ main/trunk/extensions/platform/windows/oodialog/oodRoutines.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -0,0 +1,139 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * oodRoutines.cpp + * + * Contains the implementation for the ooDialog public routines. + */ + +#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h + +#include <stdio.h> +#include <dlgs.h> +#include <malloc.h> +#include "oodCommon.h" + + +/** + * This classic Rexx external function was documented prior to 4.0.0. + */ +size_t RexxEntry InfoMessage(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) +{ + HWND hW; + + CHECKARG(1); + + if ((topDlg) && (topDlg->OnTheTop)) hW = topDlg->TheDlg; else hW = NULL; + MessageBox(hW,argv[0].strptr,"Information", MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TASKMODAL); + RETC(0) +} + + +/** + * This classic Rexx external function was documented prior to 4.0.0. + */ +size_t RexxEntry ErrorMessage(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) +{ + HWND hW; + + CHECKARG(1); + + if ((topDlg) && (topDlg->OnTheTop)) hW = topDlg->TheDlg; else hW = NULL; + MessageBox(hW,argv[0].strptr,"Error", MB_OK | MB_ICONHAND | MB_SETFOREGROUND | MB_TASKMODAL); + RETC(0) +} + +/** + * This classic Rexx external function was documented prior to 4.0.0. + */ +size_t RexxEntry YesNoMessage(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) +{ + HWND hW; + UINT uType = MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_TASKMODAL; + + CHECKARGLH(1, 2); + + if ( argc == 2 ) + { + if ( IsNo(argv[1].strptr) ) + uType |= MB_DEFBUTTON2; + else if ( ! IsYes(argv[1].strptr) ) + { + PSZ pszMsg; + CHAR szText[] = "YesNoMessage argument 2 must be one of [Yes, No]; " + "found \"%s\""; + + pszMsg = (PSZ)LocalAlloc(LPTR, sizeof(szText) + 1 + argv[1].strlength); + if ( ! pszMsg ) + RETERR; + sprintf(pszMsg, szText, argv[1].strptr); + HandleError(retstr, pszMsg); + LocalFree(pszMsg); + return 40; + } + } + + retstr->strlength = 1; + if ((topDlg) && (topDlg->OnTheTop)) hW = topDlg->TheDlg; else hW = NULL; + + if (MessageBox(hW,argv[0].strptr,"Question", uType) == IDYES) + retstr->strptr[0] = '1'; + else + retstr->strptr[0] = '0'; + return 0; +} + +/** + * The implementation for the findWindow() public routine. The external + * function itself was never documented. + */ +size_t RexxEntry FindTheWindow(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) +{ + HWND hW; + + CHECKARG(1); + + hW = FindWindow(NULL, argv[0].strptr); + if (hW) + { + RETHANDLE(hW); + } + RETC(0) /* in this case 0 is an error */ +} + Copied: main/trunk/extensions/platform/windows/oodialog/oodSymbols.h (from rev 4481, main/trunk/extensions/platform/windows/oodialog/oodResources.h) =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodSymbols.h (rev 0) +++ main/trunk/extensions/platform/windows/oodialog/oodSymbols.h 2009-04-26 17:36:04 UTC (rev 4505) @@ -0,0 +1,50 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 2007 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/* Symbolic ID definitions for ooDialog resources. The init method in + * PlainBaseDialog puts these into the ConstDir directory. IF changing these + * IDs here, it would be nice to sync up the PlainBaseDialog. + */ + +#define IDI_DLG_OODIALOG 11 +#define IDI_DLG_APPICON 12 +#define IDI_DLG_APPICON2 13 +#define IDI_DLG_OOREXX 14 + +#define IDI_DLG_DEFAULT IDI_DLG_APPICON2 +#define IDI_DLG_MIN_ID IDI_DLG_OODIALOG +#define IDI_DLG_MAX_ID IDI_DLG_OOREXX Modified: main/trunk/extensions/platform/windows/oodialog/oodialog.mak =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodialog.mak 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oodialog.mak 2009-04-26 17:36:04 UTC (rev 4505) @@ -47,10 +47,10 @@ OPTIONS= $(cflags_common) $(cflags_dll) $(OR_ORYXINCL) OR_LIB=$(OR_OUTDIR) -SOURCEF= $(OR_OUTDIR)\oovutil.obj $(OR_OUTDIR)\oovdata.obj $(OR_OUTDIR)\oovtext.obj $(OR_OUTDIR)\oovtools.obj \ +SOURCEF= $(OR_OUTDIR)\oovutil.obj $(OR_OUTDIR)\oovdata.obj $(OR_OUTDIR)\oovtext.obj $(OR_OUTDIR)\oodCommon.obj \ $(OR_OUTDIR)\oovmsg.obj $(OR_OUTDIR)\oovscrll.obj $(OR_OUTDIR)\oovdeskt.obj $(OR_OUTDIR)\oovdraw.obj \ $(OR_OUTDIR)\oovuser.obj $(OR_OUTDIR)\oovbmp.obj $(OR_OUTDIR)\oovother.obj $(OR_OUTDIR)\oodMenu.obj \ - $(OR_OUTDIR)\oodPackageEntry.obj $(OR_OUTDIR)\APICommon.obj $(OR_OUTDIR)\oodialog.res + $(OR_OUTDIR)\oodPackageEntry.obj $(OR_OUTDIR)\APICommon.obj $(OR_OUTDIR)\oodRoutines.obj $(OR_OUTDIR)\oodialog.res .c{$(OR_OUTDIR)}.obj: $(C) $(OPTIONS) /DINCL_32 -c $(@B).c /Fo$(OR_OUTDIR)\$(@B).obj Modified: main/trunk/extensions/platform/windows/oodialog/oodialog.rc =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodialog.rc 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oodialog.rc 2009-04-26 17:36:04 UTC (rev 4505) @@ -36,7 +36,7 @@ // */ //----------------------------------------------------------------------------*/ -#include <oodResources.h> +#include <oodSymbols.h> IDI_DLG_OODIALOG ICON "oodialog.ico" IDI_DLG_APPICON ICON "AppIcon.ico" Modified: main/trunk/extensions/platform/windows/oodialog/oodutils.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodutils.cls 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oodutils.cls 2009-04-26 17:36:04 UTC (rev 4505) @@ -74,8 +74,8 @@ raise syntax 40.904 array('AskDialog', '2', '[Yes, No]', arg(2)) end end - if arg(2,'o') then return askDialog(info) - else return askDialog(info, defaultButton) + if arg(2,'o') then return YesNoDialog(info) + else return YesNoDialog(info, defaultButton) ::routine fileNameDialog public Modified: main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -41,8 +41,8 @@ #ifdef __CTL3D #include <ctl3d.h> #endif +#include "oodCommon.h" - extern LPBITMAPINFO LoadDIB(const char *szFile); WORD NumDIBColorEntries(LPBITMAPINFO lpBmpInfo); HPALETTE CreateDIBPalette(LPBITMAPINFO lpBmpInfo); Modified: main/trunk/extensions/platform/windows/oodialog/oovdata.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovdata.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovdata.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -43,6 +43,7 @@ #ifdef __CTL3D #include <ctl3d.h> #endif +#include "oodCommon.h" /* I do most of the radio button handling myself now so I know it works */ Modified: main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -40,22 +40,9 @@ #include <stdio.h> #include <dlgs.h> #include <malloc.h> +#include "oodCommon.h" -size_t RexxEntry FindTheWindow(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) -{ - HWND hW; - - CHECKARG(1); - - hW = FindWindow(NULL, argv[0].strptr); - if (hW) - { - RETHANDLE(hW); - } - RETC(0) /* in this case 0 is an error */ -} - /** * Gets the window handle of the dialog control that has the focus. The call to * GetFocus() needs to run in the window thread of the dialog to ensure that the Modified: main/trunk/extensions/platform/windows/oodialog/oovdraw.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovdraw.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovdraw.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -42,6 +42,7 @@ #ifdef __CTL3D #include <ctl3d.h> #endif +#include "oodCommon.h" extern LPBITMAPINFO LoadDIB(const char *szFile); Modified: main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -44,7 +44,14 @@ #include <stdio.h> #include <dlgs.h> #include <commctrl.h> +#include "oodCommon.h" + +inline bool isHex(CSTRING c) +{ + return strlen(c) > 1 && *c == '0' && toupper(c[1]) == 'X'; +} + BOOL AddDialogMessage(CHAR * msg, CHAR * Qptr) { if (strlen(Qptr) + strlen(msg) + 1 < MAXLENQUEUE) Modified: main/trunk/extensions/platform/windows/oodialog/oovother.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -45,6 +45,7 @@ #include <shlwapi.h> #include <commctrl.h> #include "APICommon.h" +#include "oodCommon.h" // Map strings representing constant defines to their int values. For // translating things like "IDI_APPLICATION" from the user to the proper API @@ -2529,24 +2530,6 @@ } -DIALOGADMIN *rxGetDlgAdm(RexxMethodContext *context, RexxObjectPtr dlg) -{ - DIALOGADMIN *adm = (DIALOGADMIN *)rxGetPointerAttribute(context, dlg, "ADM"); - if ( adm == NULL ) - { - // Want this message: Could not retrieve the "value" information for "object" - // similar to old 98.921 - - TCHAR buf[128]; - RexxObjectPtr name = context->SendMessage0(dlg, "OBJECTNAME"); - _snprintf(buf, sizeof(buf), "Could not retrieve the dialog administration block information for %s", - context->ObjectToStringValue(name)); - - context->RaiseException1(Rexx_Error_Execution_user_defined, context->String(buf)); - } - return adm; -} - inline HWND rxGetWindowHandle(RexxMethodContext * context, RexxObjectPtr self) { return (HWND)rxGetPointerAttribute(context, self, "HWND"); Modified: main/trunk/extensions/platform/windows/oodialog/oovscrll.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovscrll.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovscrll.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -41,6 +41,7 @@ #include <dlgs.h> #include <malloc.h> #include <limits.h> +#include "oodCommon.h" size_t RexxEntry HandleScrollBar(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) Modified: main/trunk/extensions/platform/windows/oodialog/oovtext.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovtext.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovtext.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -44,6 +44,7 @@ #ifdef __CTL3D #include <ctl3d.h> #endif +#include "oodCommon.h" extern HWND ScrollingButton = NULL; extern HWND RedrawScrollingButton = NULL; Deleted: main/trunk/extensions/platform/windows/oodialog/oovtools.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovtools.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovtools.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -1,190 +0,0 @@ -/*----------------------------------------------------------------------------*/ -/* */ -/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ -/* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */ -/* */ -/* This program and the accompanying materials are made available under */ -/* the terms of the Common Public License v1.0 which accompanies this */ -/* distribution. A copy is also available at the following address: */ -/* http://www.oorexx.org/license.html */ -/* */ -/* Redistribution and use in source and binary forms, with or */ -/* without modification, are permitted provided that the following */ -/* conditions are met: */ -/* */ -/* Redistributions of source code must retain the above copyright */ -/* notice, this list of conditions and the following disclaimer. */ -/* Redistributions in binary form must reproduce the above copyright */ -/* notice, this list of conditions and the following disclaimer in */ -/* the documentation and/or other materials provided with the distribution. */ -/* */ -/* Neither the name of Rexx Language Association nor the names */ -/* of its contributors may be used to endorse or promote products */ -/* derived from this software without specific prior written permission. */ -/* */ -/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ -/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ -/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ -/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ -/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ -/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ -/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ -/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ -/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ -/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ -/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* */ -/*----------------------------------------------------------------------------*/ -#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h - -#include <stdio.h> -#include <dlgs.h> -#include <malloc.h> - - -BOOL DialogInAdminTable(DIALOGADMIN * Dlg) -{ - register INT i; - for ( i = 0; i < StoredDialogs; i++ ) - { - if ( DialogTab[i] == Dlg ) - { - break; - } - } - return(i < StoredDialogs); -} - -/** - * Validates and converts an ASCII-Z string from string form to a pointer value. - * - * @param string String to convert. - */ -void *string2pointer(const char *string) -{ - void *pointer = 0; - sscanf(string, "0x%p", &pointer); - return pointer; -} - -void pointer2string(char *result, void *pointer) -{ - if ( pointer == NULL ) - { - sprintf(result, "0"); - } - else - { - sprintf(result, "0x%p", pointer); - } -} - - -LONG HandleError(PRXSTRING r, CHAR * text) -{ - HWND hW = NULL; - if ((topDlg) && (topDlg->TheDlg)) hW = topDlg->TheDlg; - MessageBox(hW,text,"Error",MB_OK | MB_ICONHAND); - r->strlength = 2; - r->strptr[0] = '4'; - r->strptr[1] = '0'; - r->strptr[2] = '\0'; - return 40; -} - -void rxstrlcpy(CHAR * tar, CONSTRXSTRING &src) -{ - register UINT i; - for (i=0; (i<src.strlength) && (i<STR_BUFFER-1);i++) tar[i] = src.strptr[i]; - tar[i] = '\0'; -} - -void rxdatacpy(CHAR * tar, RXSTRING &src) -{ - register UINT i; - for (i=0; (i<src.strlength) && (i<DATA_BUFFER-1);i++) tar[i] = src.strptr[i]; - tar[i] = '\0'; -} - -bool IsYes(const char * s) -{ - if (!strlen(s)) return FALSE; - - return ((s[0]=='j') || (s[0]=='J') || (s[0]=='y') || (s[0]=='Y') || atoi(s)); -} - -/* Slightly stricter than IsYes and not currently exported. */ -bool IsNo(const char * s) -{ - return ( s && (*s == 'N' || *s == 'n') ); -} - -/** - * This classic Rexx external function was documented prior to 4.0.0. - */ -size_t RexxEntry InfoMessage(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) -{ - HWND hW; - - CHECKARG(1); - - if ((topDlg) && (topDlg->OnTheTop)) hW = topDlg->TheDlg; else hW = NULL; - MessageBox(hW,argv[0].strptr,"Information", MB_OK | MB_ICONINFORMATION | MB_SETFOREGROUND | MB_TASKMODAL); - RETC(0) -} - - -/** - * This classic Rexx external function was documented prior to 4.0.0. - */ -size_t RexxEntry ErrorMessage(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) -{ - HWND hW; - - CHECKARG(1); - - if ((topDlg) && (topDlg->OnTheTop)) hW = topDlg->TheDlg; else hW = NULL; - MessageBox(hW,argv[0].strptr,"Error", MB_OK | MB_ICONHAND | MB_SETFOREGROUND | MB_TASKMODAL); - RETC(0) -} - -/** - * This classic Rexx external function was documented prior to 4.0.0. - */ -size_t RexxEntry YesNoMessage(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) -{ - HWND hW; - UINT uType = MB_YESNO | MB_ICONQUESTION | MB_SETFOREGROUND | MB_TASKMODAL; - - CHECKARGLH(1, 2); - - if ( argc == 2 ) - { - if ( IsNo(argv[1].strptr) ) - uType |= MB_DEFBUTTON2; - else if ( ! IsYes(argv[1].strptr) ) - { - PSZ pszMsg; - CHAR szText[] = "YesNoMessage argument 2 must be one of [Yes, No]; " - "found \"%s\""; - - pszMsg = (PSZ)LocalAlloc(LPTR, sizeof(szText) + 1 + argv[1].strlength); - if ( ! pszMsg ) - RETERR; - sprintf(pszMsg, szText, argv[1].strptr); - HandleError(retstr, pszMsg); - LocalFree(pszMsg); - return 40; - } - } - - retstr->strlength = 1; - if ((topDlg) && (topDlg->OnTheTop)) hW = topDlg->TheDlg; else hW = NULL; - - if (MessageBox(hW,argv[0].strptr,"Question", uType) == IDYES) - retstr->strptr[0] = '1'; - else - retstr->strptr[0] = '0'; - return 0; -} - Modified: main/trunk/extensions/platform/windows/oodialog/oovuser.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovuser.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovuser.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -39,11 +39,12 @@ #include <stdio.h> #include <dlgs.h> +#include <commctrl.h> #ifdef __CTL3D #include <ctl3d.h> #endif -#include "oodResources.h" -#include <commctrl.h> +#include "oodCommon.h" +#include "oodSymbols.h" extern LRESULT CALLBACK RexxDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ); extern BOOL InstallNecessaryStuff(DIALOGADMIN * dlgAdm, CONSTRXSTRING ar[], size_t argc); Modified: main/trunk/extensions/platform/windows/oodialog/oovutil.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovutil.cpp 2009-04-26 17:36:04 UTC (rev 4505) @@ -41,7 +41,8 @@ #include <commctrl.h> #include <stdio.h> #include <dlgs.h> -#include "oodResources.h" +#include "oodCommon.h" +#include "oodSymbols.h" extern INT DelDialog(DIALOGADMIN * aDlg); extern BOOL SearchMessageTable(ULONG message, WPARAM param, LPARAM lparam, DIALOGADMIN * addressedTo); Modified: main/trunk/extensions/platform/windows/oodialog/oovutil.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovutil.h 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/oovutil.h 2009-04-26 17:36:04 UTC (rev 4505) @@ -130,15 +130,6 @@ #define TAG_SELECTCHANGED 0x00000400 #define TAG_FOCUSCHANGED 0x00000800 -/** - * Date Time Operation type IDs for get / set system time. These are operations - * used for the DateTimePicker and MonthCalendar controls. - */ -#define DTO_SETDTP 0x01 -#define DTO_GETDTP 0x02 -#define DTO_SETMONTH 0x03 -#define DTO_GETMONTH 0x04 - /* macros to check the number of arguments */ #define CHECKARG(argexpct) { \ if (argc != argexpct) \ @@ -264,38 +255,7 @@ #define DEF_ADM DIALOGADMIN * dlgAdm = NULL #define GET_ADM dlgAdm = (DIALOGADMIN *)string2pointer(&argv[0]) -#define GET_HANDLE(p) string2pointer(p) -#define GET_HWND(p) ((HWND)string2pointer(p)) -#define GET_POINTER(p) string2pointer(p) - -inline void safeLocalFree(void *p) -{ - if (p != NULL) - { - LocalFree(p); - } -} - - -inline void safeFree(void *p) -{ - if (p != NULL) - { - free(p); - } -} - - -inline void safeDeleteObject(HANDLE h) -{ - if (h != NULL) - { - DeleteObject(h); - } -} - - inline LONG_PTR setWindowPtr(HWND hwnd, int index, LONG_PTR newPtr) { #ifndef __REXX64__ @@ -328,22 +288,6 @@ return GetClassLongPtr(hwnd, index); } -typedef enum {oodHex, oodHeX, oodNotHex} oodNumberStr_t; - -inline bool isHex(CSTRING c) -{ - return strlen(c) > 1 && *c == '0' && toupper(c[1]) == 'X'; -} - -inline oodNumberStr_t hexType(CSTRING c) -{ - if ( isHex(c) ) - { - return (c[1] == 'x' ? oodHex : oodHeX); - } - return oodNotHex; -} - /* structures to manage the dialogs */ typedef struct { WPARAM wParam; @@ -473,7 +417,6 @@ KEYPRESSDATA *pKeyPressData; } SUBCLASSDATA; - typedef struct { void * previous; @@ -518,18 +461,3 @@ extern INT StoredDialogs; extern CRITICAL_SECTION crit_sec; - -// These utility functions are defined in oovtools.cpp -extern BOOL DialogInAdminTable(DIALOGADMIN * Dlg); -extern void rxstrlcpy(CHAR * tar, CONSTRXSTRING &src); -extern void rxdatacpy(CHAR * tar, RXSTRING &src); -extern bool IsYes(const char *s); -extern void *string2pointer(const char *string); -extern void pointer2string(char *, void *pointer); -extern LONG HandleError(PRXSTRING r, CHAR * text); - - -inline void *string2pointer(CONSTRXSTRING *string) { return string2pointer(string->strptr); } -inline void *string2pointer(CONSTRXSTRING &string) { return string2pointer(string.strptr); } -inline void pointer2string(PRXSTRING result, void *pointer) { pointer2string(result->strptr, pointer); result->strlength = strlen(result->strptr); } - Modified: main/trunk/extensions/platform/windows/oodialog/plbdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-04-26 13:26:30 UTC (rev 4504) +++ main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-04-26 17:36:04 UTC (rev 4505) @@ -408,7 +408,7 @@ -- Common in Microsoft compatible resource script files self~ConstDir["IDC_STATIC"] = -1 - -- ooDialog supplied resources, defined in oodResources.h + -- ooDialog supplied resources, defined in oodSymbols.h self~ConstDir["IDI_DLG_OODIALOG"] = 11 self~ConstDir["IDI_DLG_APPICON"] = 12 self~ConstDir["IDI_DLG_APPICON2"] = 13 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-04-30 17:35:29
|
Revision: 4562 http://oorexx.svn.sourceforge.net/oorexx/?rev=4562&view=rev Author: miesfeld Date: 2009-04-30 17:35:28 +0000 (Thu, 30 Apr 2009) Log Message: ----------- [2784475] UserDialog Center fails with syntax error Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/plbdlg.cls main/trunk/extensions/platform/windows/oodialog/stdext.cls Modified: main/trunk/extensions/platform/windows/oodialog/plbdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-04-30 00:26:29 UTC (rev 4561) +++ main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-04-30 17:35:28 UTC (rev 4562) @@ -1311,8 +1311,7 @@ if Arg(1,"o") = 1 then showOptions = ""; else showOptions = showOptions~translate parse value self~GetSize with dcx dcy s = screenSize() - parse var s dummy dummy sx sy - return WndShow_Pos("P",self~DlgHandle, (sx - dcx * self~FactorX) %2, (sy - dcy * self~FactorY) %2, 0, 0,, + return WndShow_Pos("P",self~DlgHandle, (s[3] - dcx * self~FactorX) %2, (s[4] - dcy * self~FactorY) %2, 0, 0,, "NOSIZE "||showOptions) Modified: main/trunk/extensions/platform/windows/oodialog/stdext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/stdext.cls 2009-04-30 00:26:29 UTC (rev 4561) +++ main/trunk/extensions/platform/windows/oodialog/stdext.cls 2009-04-30 17:35:28 UTC (rev 4562) @@ -69,7 +69,7 @@ ::method CalcSize size = self~getTextSizeDlg(self~msg) - parse value screenSize() with scrx scry . + scrSize = screenSize() self~dims["sx"] = size~width self~dims["sy"] = size~height if self~XExt = 0 then do @@ -87,8 +87,8 @@ if lines >1 then self~dims["cy"] = self~dims["sy"]+20 else self~dims["cy"] = self~dims["sy"]*2.2+20 end - self~dims["x"] = trunc((scrx-self~dims["cx"]) /2) - self~dims["y"] = trunc((scry - self~dims["cy"] - 20) /2) + self~dims["x"] = trunc((scrSize[1]-self~dims["cx"]) /2) + self~dims["y"] = trunc((scrSize[2] - self~dims["cy"] - 20) /2) ::method Popup self~CalcSize @@ -149,9 +149,9 @@ ::method CalcSize self~CalcSize:super self~dims["cy"] = self~dims["cy"]+10 /* 15 more for the progress bar */ - parse value screenSize() with scrx scry . - self~dims["x"] = trunc((scrx-self~dims["cx"]) /2) - self~dims["y"] = trunc((scry - self~dims["cy"] - 20) /2) + scrSize = screenSize() + self~dims["x"] = trunc((scrSize[1]-self~dims["cx"]) /2) + self~dims["y"] = trunc((scrSize[2] - self~dims["cy"] - 20) /2) ::method "Progress=" use arg newpos This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-06-15 04:37:07
|
Revision: 4794 http://oorexx.svn.sourceforge.net/oorexx/?rev=4794&view=rev Author: miesfeld Date: 2009-06-15 04:37:04 +0000 (Mon, 15 Jun 2009) Log Message: ----------- Convert the ooDialog menu classes to the new API. Implement more of the core Menu function. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp main/trunk/extensions/platform/windows/oodialog/APICommon.h main/trunk/extensions/platform/windows/oodialog/Menu.cls main/trunk/extensions/platform/windows/oodialog/basedlg.cls main/trunk/extensions/platform/windows/oodialog/dlgext.cls main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp main/trunk/extensions/platform/windows/oodialog/oodCommon.h main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp main/trunk/extensions/platform/windows/oodialog/oodialog.mak main/trunk/extensions/platform/windows/oodialog/oodutils.cls main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp main/trunk/extensions/platform/windows/oodialog/oovother.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.h main/trunk/extensions/platform/windows/oodialog/plbdlg.cls main/trunk/extensions/platform/windows/oodialog/resdlg.cls main/trunk/extensions/platform/windows/oodialog/userdlg.cls Added Paths: ----------- main/trunk/extensions/platform/windows/oodialog/oodMenu.hpp Modified: main/trunk/extensions/platform/windows/oodialog/APICommon.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-06-14 23:06:33 UTC (rev 4793) +++ main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-06-15 04:37:04 UTC (rev 4794) @@ -49,6 +49,22 @@ #include <errno.h> #include "APICommon.h" + +/** + * 49.900 + * 49 -> A severe error was detected in the language processor or execution + * process during internal self-consistency checks. + * + * 900 -> User message + * + * @param c + * @param msg + */ +void severeErrorException(RexxMethodContext *c, char *msg) +{ + c->RaiseException1(Rexx_Error_Interpretation_user_defined, c->String(msg)); +} + void systemServiceException(RexxMethodContext *context, char *msg) { context->RaiseException1(Rexx_Error_System_service_user_defined, context->String(msg)); @@ -68,13 +84,18 @@ } } -void systemServiceExceptionCode(RexxMethodContext *context, const char *msg, const char *arg1) +void systemServiceExceptionCode(RexxMethodContext *context, const char *msg, const char *arg1, DWORD rc) { TCHAR buffer[256]; - _snprintf(buffer, sizeof(buffer), msg, arg1, GetLastError()); + _snprintf(buffer, sizeof(buffer), msg, arg1, rc); systemServiceException(context, buffer); } +void systemServiceExceptionCode(RexxMethodContext *context, const char *msg, const char *arg1) +{ + systemServiceExceptionCode(context, msg, arg1, GetLastError()); +} + void systemServiceExceptionComCode(RexxMethodContext *context, const char *msg, const char *arg1, HRESULT hr) { TCHAR buffer[256]; @@ -87,6 +108,14 @@ systemServiceException(c, NO_MEMORY_MSG); } +/** + * Message + * + * Raises 93.900 + * + * @param c Method context we are executing in. + * @param msg "Some message" + */ void userDefinedMsgException(RexxMethodContext *c, CSTRING msg) { c->RaiseException1(Rexx_Error_Incorrect_method_user_defined, c->String(msg)); @@ -99,16 +128,42 @@ userDefinedMsgException(c, buffer); } +/** + * Method argument 'argument' must be of the 'class' class + * Method argument 4 must be of the ImageList class + * + * Raises 93.948 + * + * @param c The method context we are operating under. + * @param pos The 'argument' position. + * @param n The name of the class expected. + * + * @return Pointer to void, could be used in the return statement of a method + * to return NULLOBJECT after the exeception is raised. + */ void *wrongClassException(RexxMethodContext *c, int pos, const char *n) { c->RaiseException2(Rexx_Error_Incorrect_method_noclass, c->WholeNumber(pos), c->String(n)); return NULL; } +/** + * Method argument 'argument' is not a valid'msg' + * Mehtod argument 3 is not a valid menu handle + * + * Raises 93.900 + * + * @param c Method context we are executing in. + * @param pos Argumet position + * @param msg "Some message" + * + * @note There is no space after 'valid' the caller must provide it in msg if + * it is needed + */ void invalidTypeException(RexxMethodContext *c, int pos, const char *type) { TCHAR buffer[256]; - _snprintf(buffer, sizeof(buffer), "Method argument %d is not a valid %s", pos, type); + _snprintf(buffer, sizeof(buffer), "Method argument %d is not a valid%s", pos, type); userDefinedMsgException(c, buffer); } @@ -151,6 +206,66 @@ userDefinedMsgException(c, buffer); } +/** + * Error 98.900 + * + * 98 The language processor detected a specific error during execution. The + * associated error gives the reason for the error. + * + * 900 User message. + * + * @param c + * @param msg + */ +void executionErrorException(RexxMethodContext *c, CSTRING msg) +{ + c->RaiseException1(Rexx_Error_Execution_user_defined, c->CString(msg)); +} + +/** + * Error 98.913 + * + * 98 The language processor detected a specific error during execution. The + * associated error gives the reason for the error. + * + * 913: Unable to convert object "a MyThings" to a single-dimensional array + * value + * + * @param c Method context we are executing in. + * @param obj The "MyThings" object. + * + * @Note This would be the exception most often seen in a do n over c statement + * when c does not have a makeArray() method. + */ +void doOverException(RexxMethodContext *c, RexxObjectPtr obj) +{ + c->RaiseException1(Rexx_Error_Execution_noarray, obj); +} + +/** + * Produces a message: + * + * Could not retrieve the "value" information for "object" + * + * Could not retrive the window handle information for a BaseDialog object. + * + * similar to old 98.921 + * + * @param c Method context we are operating in. + * @param item What was to be retrieved + * @param source The object it was being retrieved from. + */ +void failedToRetrieveException(RexxMethodContext *c, CSTRING item, RexxObjectPtr source) +{ + TCHAR buf[128]; + + RexxObjectPtr name = c->SendMessage0(source, "OBJECTNAME"); + _snprintf(buf, sizeof(buf), "Could not retrieve the %s information for %s", + item, c->ObjectToStringValue(name)); + + c->RaiseException1(Rexx_Error_Execution_user_defined, c->String(buf)); +} + void nullObjectException(RexxMethodContext *c, CSTRING name, int pos) { TCHAR buffer[256]; @@ -175,6 +290,11 @@ c->RaiseException1(Rexx_Error_Incorrect_method_null, c->WholeNumber(pos)); } +void notNonNegativeException(RexxMethodContext *c, int pos, RexxObjectPtr actual) +{ + c->RaiseException2(Rexx_Error_Incorrect_method_nonnegative, c->Int32(pos), actual); +} + void wrongRangeException(RexxMethodContext *c, int pos, int min, int max, RexxObjectPtr actual) { c->RaiseException(Rexx_Error_Invalid_argument_range, @@ -243,13 +363,32 @@ *number = _strtoui64(str, &end, 0); if ( (end - str != strlen(str)) || errno == EINVAL || *number == _UI64_MAX ) { - invalidTypeException(c, pos, "number"); + invalidTypeException(c, pos, " number"); return false; } return true; } +/** + * Gets a Class object. + * + * This is for use for classes visible within the scope of the context, like say + * .BaseDialog, or .Rect. Use c->GetClass() to directly get classes from the + * environment like .Bag or .Directory. + * + * @param c The method context we are operating in. + * @param name The name of the class to try and find. + * + * @return The class object or null on failure. + * + * @remarks When null is returned an error has been raised: 98.909 + * + * 98: The language processor detected a specific error during execution. The + * associated error gives the reason for the error. + * + * 909: Class "class" not found + */ RexxClassObject rxGetContextClass(RexxMethodContext *c, CSTRING name) { RexxClassObject theClass = c->FindContextClass(name); @@ -277,10 +416,32 @@ RexxObjectPtr result = c->GetObjectVariable(varName); if ( result == NULLOBJECT ) { - result = c->Nil(); + result = TheNilObj; } c->SetObjectVariable(varName, val); return result; } + +/** + * Test if a generic Rexx object is exactly some int. + * + * @param testFor The int value being tested for. + * @param val The generic Rexx object, which could be null. + * @param c The method context we are executing under. + * + * @return True if val is the int number we are testing for, otherwise false. + */ +bool isInt(int testFor, RexxObjectPtr val, RexxMethodContext *c) +{ + if ( val != NULLOBJECT ) + { + int n; + if ( c->ObjectToInt32(val, &n) ) + { + return n == testFor; + } + } + return false; +} Modified: main/trunk/extensions/platform/windows/oodialog/APICommon.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/APICommon.h 2009-06-14 23:06:33 UTC (rev 4793) +++ main/trunk/extensions/platform/windows/oodialog/APICommon.h 2009-06-15 04:37:04 UTC (rev 4794) @@ -47,9 +47,12 @@ #define NO_MEMORY_MSG "failed to allocate memory" #define FUNC_WINCTRL_FAILED_MSG "the '%s'() function of the Windows '%s' control failed" #define MSG_WINCTRL_FAILED_MSG "the '%s' message of the Windows '%s' control failed" +#define NO_LOCAL_ENVIRONMENT_MSG "the .local environment was not found" +extern void severeErrorException(RexxMethodContext *c, char *msg); extern void systemServiceException(RexxMethodContext *context, char *msg); extern void systemServiceException(RexxMethodContext *context, char *msg, const char *sub); +extern void systemServiceExceptionCode(RexxMethodContext *context, const char *msg, const char *arg1, DWORD rc); extern void systemServiceExceptionCode(RexxMethodContext *context, const char *msg, const char *arg1); extern void systemServiceExceptionComCode(RexxMethodContext *context, const char *msg, const char *arg1, HRESULT hr); extern void outOfMemoryException(RexxMethodContext *c); @@ -58,8 +61,12 @@ extern void *wrongClassException(RexxMethodContext *c, int pos, const char *n); extern void invalidTypeException(RexxMethodContext *c, int pos, const char *type); extern void invalidImageException(RexxMethodContext *c, int pos, CSTRING type, CSTRING actual); +extern void notNonNegativeException(RexxMethodContext *c, int pos, RexxObjectPtr actual); extern void wrongObjInArrayException(RexxMethodContext *c, int argPos, size_t index, CSTRING obj); extern void wrongObjInDirectoryException(RexxMethodContext *c, int argPos, CSTRING index, CSTRING needed, RexxObjectPtr actual); +extern void executionErrorException(RexxMethodContext *c, CSTRING msg); +extern void doOverException(RexxMethodContext *c, RexxObjectPtr obj); +extern void failedToRetrieveException(RexxMethodContext *c, CSTRING item, RexxObjectPtr source); extern void missingIndexInDirectoryException(RexxMethodContext *c, int argPos, CSTRING index); extern void emptyArrayException(RexxMethodContext *c, int argPos); extern void nullObjectException(RexxMethodContext *c, CSTRING name, int pos); @@ -76,5 +83,6 @@ extern bool rxStr2Number(RexxMethodContext *c, CSTRING str, uint64_t *number, int pos); extern RexxClassObject rxGetContextClass(RexxMethodContext *c, CSTRING name); extern RexxObjectPtr rxSetObjVar(RexxMethodContext *c, CSTRING varName, RexxObjectPtr val); +extern bool isInt(int, RexxObjectPtr, RexxMethodContext *); #endif Modified: main/trunk/extensions/platform/windows/oodialog/Menu.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/Menu.cls 2009-06-14 23:06:33 UTC (rev 4793) +++ main/trunk/extensions/platform/windows/oodialog/Menu.cls 2009-06-15 04:37:04 UTC (rev 4794) @@ -43,522 +43,91 @@ */ -/** NOTES: - * If problems with resource ID return -1 - * If problems with dialog or hMenu return -2 - * - */ - /* class: Menu - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ A mix in class implementing functionality that is common to all menus. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ ::class 'Menu' public mixinclass Object -::attribute hMenu set private -::attribute hMenu get +::attribute wID get external "LIBRARY oodialog menu_wID" +::attribute hMenu get external "LIBRARY oodialog menu_getHMenu" -::attribute dlg private +::method getCount external "LIBRARY oodialog menu_getCount" +::method isValidMenu external "LIBRARY oodialog menu_isValidMenu" +::method isValidMenuHandle external "LIBRARY oodialog menu_isValidMenuHandle" +::method isValidItemID external "LIBRARY oodialog menu_isValidItemID" -::attribute initCode set private -::attribute initCode get +::method isPopup external "LIBRARY oodialog menu_isPopup" +::method isCommandItem external "LIBRARY oodialog menu_isCommandItem" +::method isSeparator external "LIBRARY oodialog menu_isSeparator" --- The resource ID of a menu. -::attribute wID set private -::attribute wID get - -::attribute connectionRequested private -::attribute connectionQ private - -::method menuInit private - use strict arg symbolSrc - - self~hMenu = 0 - self~dlg = .nil - self~initCode = 0 - self~wID = .nil - - self~connectionRequested = .false - self~connectionQ = .queue~new - - select - when symbolSrc~isA(.directory) then self~constDir = symbolSrc - - when symbolSrc~isA(.ResourceUtils) then self~constDir = symbolSrc~constDir - - when symbolSrc~isA(.string) then do - self~ConstDir = .directory~new - self~ParseIncludeFile(symbolSrc) - end - - otherwise self~constDir = .directory~new - end - - return 0 - -::method maybeResolveID private - use strict arg id - - if id <> .nil then do - id = self~resolveResourceID(id) - if id = -1 then do - self~initCode = id - return .false - end - self~wID = id - end - - return .true - -/* getCount() returns the number of items in a menu. The default is to get the - * count of items in this menu, but passing in a raw menu handle will also work. +/** getHandle() + * Need to also doc this method which is really just an alias for self~hMenu. */ -::method getCount - use arg obj +::method getHandle external "LIBRARY oodialog menu_getHMenu" +::method getMenuHandle external "LIBRARY oodialog menu_getMenuHandle" +::method releaseMenuHandle external "LIBRARY oodialog menu_releaseMenuHandle" +::method destroy external "LIBRARY oodialog menu_destroy" - select - when arg(1, 'O') then return WinMenu("COUNT", self~hMenu) - when self~isValidMenuHandle(obj) then return WinMenu("COUNT", obj) - otherwise return -1 - end - -- End select +::method getPopup unguarded external "LIBRARY oodialog menu_getPopup" -/** isValidMenu() Returns true if *this* Menu object represents a menu that the - * operating system says is valid, otherwise false. - */ -::method isValidMenu - return WinMenu("ISMENU", self~hMenu) +-- TODO NEED appendPopup() and appendItem() (note you can not append a separator, or can you?) -/** isValidMenuHandle() Returns true if the specified handle represents a menu - * that the operating system says is valid, otherwise false. - */ -::method isValidMenuHandle - use strict arg handle - return WinMenu("ISMENU", handle) +::method insertPopup unguarded external "LIBRARY oodialog menu_insertPopup" +::method insertItem unguarded external "LIBRARY oodialog menu_insertItem" +::method insertSeparator unguarded external "LIBRARY oodialog menu_insertSeparator" +::method removePopup external "LIBRARY oodialog menu_removePopup" +::method removeItem external "LIBRARY oodialog menu_removeItem" +::method removeSeparator external "LIBRARY oodialog menu_removeSeparator" +::method deletePopup external "LIBRARY oodialog menu_deletePopup" -/** isSubMenu() Returns true if the menu item specified is a menu item that - * opens a submenu, othewise false. - */ -::method isSubMenu - use strict arg itemID, byPosition = .false +::method isEnabled external "LIBRARY oodialog menu_isEnabled" +::method isDisabled external "LIBRARY oodialog menu_isDisabled" +::method isGrayed external "LIBRARY oodialog menu_isDisabled" +::method isChecked external "LIBRARY oodialog menu_isDisabled" - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return .false +::method enable external "LIBRARY oodialog menu_enable" +::method disable external "LIBRARY oodialog menu_disable" +::method gray external "LIBRARY oodialog menu_disable" +::method check external "LIBRARY oodialog menu_check" +::method unCheck external "LIBRARY oodialog menu_unCheck" +::method checkRadioItem external "LIBRARY oodialog menu_checkRadio" +::method hilite external "LIBRARY oodialog menu_hilite" +::method unHilite external "LIBRARY oodialog menu_unHilite" +::method getItemState external "LIBRARY oodialog menu_getItemState" +::method getType external "LIBRARY oodialog menu_getItemType" - return GetMII("ISSUB", self~hMenu, itemID, byPosition) +-- TODO there are some methods where the C code was there but there are no +-- Rexx methods to match. SetItemType, SetPopupType, SetItemState, SetPopupType +-- These methods would take a combination of keywords. The parsing of the +-- keywords is already implmented. -/** isCommandItem() Returns true if the menu item specified is a command menu - * item, i.e., not a menu item that opens a submenu or a separator, othewise - * false. - */ -::method isCommandItem - use strict arg itemID, byPosition = .false - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return .false +::method getText external "LIBRARY oodialog menu_getText" +::method setText external "LIBRARY oodialog menu_setText" +::method getID external "LIBRARY oodialog menu_getID" +::method setID external "LIBRARY oodialog menu_setID" - return GetMII("ISITEM", self~hMenu, itemID, byPosition) -/** isSeparator() Returns true if the menu item is a separator, otherwise false. - * Note that with extended menus, it is possible to assign resource IDs even to - * separators. Therefore it is possible to query both by ID and position. - */ -::method isSeparator - use strict arg itemID, byPosition = .false - - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return .false - - return GetMII("ISSEP", self~hMenu, itemID, byPosition) - -/** getHandle() Returns the raw menu handle of this menu. - */ -::method getHandle - return self~hMenu - -/** getMenuHandle() Get the raw menu handle of a submenu of this menu. - */ -::method getMenuHandle - use strict arg itemID, byPosition = .false - - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return -1 - - return GetMII("SUB", self~hMenu, itemID, byPosition) - -/** releaseMenuHandle() Releases (frees) the operating system resources used by - * a menu. The menu is specified by its raw handle. To release the operating - * system resources for an ooDialog Menu object, use the destroy() method. - */ -::method releaseMenuHandle - use strict arg handle - return WinMenu("DEL", handle) - -/** getPopup() Returns a .PopupMenu that represents the specified submenu. - * Check the PopupMenu initCode to determine success. - */ -::method getPopup unguarded - use strict arg itemID, byPosition = .false, symbolSrc = .nil - - -- We want to *always* return a PopupMenu object, so even if there is an error - -- with the itemID or with getMenuHandle(), we still pass the value on to - -- PopupMenu~new. .PopupMenu~init() can handle the incorrect values (if any) - -- and will create the object with a non-zero initCode. - - itemID = self~resolveItemID(itemID, byPosition) - - -- This is the id to be passed on to PopupMenu~new. - if byPosition then id = .nil - else id = itemID - - hSubMenu = GetMII("SUB", self~hMenu, itemID, byPosition) - - return .PopupMenu~new(id, hSubMenu, symbolSrc) - -::method insertPopup unguarded - use strict arg before, popup, text, id, stateOpts = "", typeOpts = "", byPosition = .false - - id = self~resolveResourceID(id) - if id == -1 then return -1 - - before = self~resolveItemID(before, byPosition) - if before == -1 then return -1 - - if \ popup~isA(.PopupMenu) then return -2 - - ret = InsertMII("POP", self~hMenu, before, byPosition, popup~getHandle, text, id, stateOpts~upper, typeOpts~upper) - return self~maybeRedraw(ret) - -::method insertItem unguarded - use strict arg before, text, id, stateOpts = "", typeOpts = "", byPosition = .false, connect = .false - - id = self~resolveResourceID(id) - if id == -1 then return -1 - - before = self~resolveItemID(before, byPosition) - if before == -1 then return -1 - - ret = InsertMII("ITEM", self~hMenu, before, byPosition, text, id, stateOpts~upper, typeOpts~upper) - - if connect then do - msgToRaise = text~changeStr('&', "")~space(0) - if self~dlg <> .nil then do - self~connectItem(id, msgToRaise, self~dlg) - end - else do - self~connectionRequested = .true - self~connectionQ~queue(.MapItem~new(id, msgToRaise)) - end - end - - return self~maybeRedraw(ret) - -::method insertSeparator unguarded - use strict arg before, byPosition = .false - - before = self~resolveItemID(before, byPosition) - if before == -1 then return -1 - - ret = InsertMII("SEP", self~hMenu, before, byPosition) - return self~maybeRedraw(ret) - -::method maybeRedraw private - use strict arg ret - if ret <> 0 | self~dlg == .nil then return ret - return WinMenu("DRAW", self~dlg~dlgHandle) - -/** deleteSubMenu() - * Removes the submenu from this menu and frees the hMenu. To be able to reuse - * the the submenu use the removeSubMenu() method. - */ -::method deleteSubMenu - use strict arg id, byPosition = .false - forward to (self~delete) - -/** removeSubMenu() - * Remove the submenu from this menu and return it, as a .PopupMenu to the - * caller. - */ -::method removeSubMenu - use strict arg id, byPosition = .false, symbolSrc = .nil - - subMenu = self~getPopup(id, byPosition, symbolSrc) - if subMenu~initCode <> 0 then return subMenu - - self~delete(id, byPosition) - return subMenu - -/** removeItem() remove a menu item from this menu. - */ -::method removeItem - use strict arg id, byPosition = .false - forward to (self~delete) - -::method removeSeparator - use strict arg id, byPosition = .false - forward to (self~delete) - -::method delete private - use strict arg id, byPosition = .false - - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return .false - - ret = WinMenu("DELMENU", self~hMenu, itemID, byPosition) - return self~maybeRedraw(ret) - -::method isEnabled - use strict arg itemID, byPosition = .false - - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return .false - - return GetMII("ISTATE", self~hMenu, itemID, byPosition)~wordPos("ENABLED") <> 0 - -::method isGrayed - use strict arg itemID, byPosition = .false - forward to (self~isEnabled) - -::method enable - use strict arg itemIDs, byPosition = .false, enable = .true - - if itemIDs~isA(.Collection) then do - status = 0 - do id over itemIDs - ret = self~doEnable(id, byPosition, enable) - if ret < 0, ret <> -1 then return ret - if ret == -1 then status = -1 - end - end - else do - status = self~doEnable(itemIDs, byPosition, enable) - end - - return status - -::method disable - use strict arg itemID, byPosition = .false - return self~enable(itemIDs, byPosition, .false) - -::method gray - use strict arg itemIDs, byPosition = .false - return self~enable(itemIDs, byPosition, .false) - -::method doEnable private - use strict arg id, byPosition, enable - - id = self~resolveItemID(id, byPosition) - if id == -1 then return -1 - - keyword = "ENABLED" - if \ enable then keyword = "DISABLED" - - return SetMII("ISTATE", self~hMenu, id, byPosition, keyword) - -::method isChecked - use strict arg itemID, byPosition = .false - - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return .false - - return GetMII("ISTATE", self~hMenu, itemID, byPosition)~wordPos("CHECKED") <> 0 - -::method check - use strict arg itemIDs, byPosition = .false, check = .true - - if itemIDs~isA(.Collection) then do - status = 0 - do id over itemIDs - ret = self~doCheck(id, byPosition, check) - if ret < 0, ret <> -1 then return ret - if ret == -1 then status = -1 - end - end - else do - status = self~doCheck(itemIDs, byPosition, check) - end - - return status - -::method uncheck - use strict arg itemIDs, byPosition = .false - return self~check(itemIDs, byPosition, .false) - -::method doCheck private - use strict arg id, byPosition, check - - id = self~resolveItemID(id, byPosition) - if id == -1 then return -1 - - keyword = "CHECKED" - if \ check then keyword = "UNCHECKED" - - return SetMII("ISTATE", self~hMenu, id, byPosition, keyword) - -::method checkRadio - use strict arg idStart, idEnd, idCheck, byPosition = .false - idStart = self~resolveItemID(idStart, byPosition) - idEnd = self~resolveItemID(idEnd, byPosition) - idCheck = self~resolveItemID(idCheck, byPosition) - if (idStart == -1) | (idEnd == -1) | (idCheck == -1) then return -1 - - return WinMenu("CHECKRADIO", self~hMenu, idStart, idEnd, idCheck, byPosition) - -::method getState - use strict arg itemID, byPosition = .false - - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return -1 - - return GetMII("ISTATE", self~hMenu, itemID, byPosition) - -::method getType - use strict arg itemID, byPosition = .false - - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return -1 - - return GetMII("TYPE", self~hMenu, itemID, byPosition) - -/* Set or get a menu item's text */ -::method getText - use strict arg itemID, byPosition = .false - - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return -1 - - return GetMII("TEXT", self~hMenu, itemID, byPosition) - -::method setText - use strict arg itemID, text, byPosition = .false - - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return -1 - - return SetMII("TEXT", self~hMenu, itemID, byPosition, text) - -/* getID() Get an item ID, by definition this is by position. If the - * ID is already known, there is no point in querying for it. - */ -::method getID - use strict arg posID - return GetMII("ID", self~hMenu, posID, .true) - -/* setID() Set an item ID, by position is the defualt. This function can - * also be used to change an existing ID, so the by ID form is supported. Note - * that with extended menus all items can have IDs, even separators. - */ -::method setID - use strict arg itemID, id, byPosition = .true - - itemID = self~resolveItemID(itemID, byPosition) - if itemID == -1 then return -1 - - id = self~resolveResourceID(id) - if id == -1 then return -1 - - return setMII("ID", self~hMenu, itemID, byPosition, id) - -/* resolveItemID() Convenience function to resolve an argument that can be - * either a resource ID or a position ID. - */ -::method resolveItemID private - use strict arg itemID, byPosition - - if byPosition then do - if itemID~isA(.string), itemID~datatype('W'), itemID > -1 then return itemID - else return -1 - end - - return self~resolveResourceID(itemID) - - /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ Methods that affect an entire menu, rather than a menu item. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ -/* Set or get the menu help context ID */ -::method setHelpID - use strict arg id, recurse = .false -- recurse means apply to submenus also. +::method setHelpID external "LIBRARY oodialog menu_setHelpID" +::method getHelpID external "LIBRARY oodialog menu_getHelpID" +::method setMaxHeight external "LIBRARY oodialog menu_setMaxHeight" +::method getMaxHeight external "LIBRARY oodialog menu_getMaxHeight" - id = self~resolveResourceID(id) - if id == -1 then return -1 - - -- Be sure recurse is a boolean. - if recurse \== .true, recurse \== .false then recurse = .true - - return SetMI("HELP", self~hMenu, id, recurse) - -::method getHelpID - return GetMI("HELP", self~hMenu) - -::method destroy - if self~isA(.MenuBar), self~dlg <> .nil, then self~detach - ret = WinMenu("DEL", self~hMenu) - self~hMenu = 0 - return ret - /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ Message connection methods. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ -::method checkConnectionRequest private - use strict arg dlg - - if self~connectionRequested then do - self~connectionRequested = .false - do map over self~connectionQ - self~connectItem(map~key, map~item, dlg) - end - self~connectionQ~empty - end - -/** connectItem() Connects the menu command item with the specified ID to the - * specified method. - */ -::method connectItem - use strict arg id, msgToRaise, dlg = (self~dlg) - - id = self~resolveResourceID(id) - if id == -1 then return -1 - - if \ dlg~isA(.BaseDialog) then return -3 - - if id < 3 | id = 9 then return 0 - - ret = dlg~addUserMsg(msgToRaise, 0x00000111, 0xFFFFFFFF, id, 0x0000FFFF, 0, 0) - if ret == 1 then return -4 - - return 0 - -/** connectItemsToMsg() Connects a collection of menu command items to the - * single specified method. - */ -::method connectItemsToMsg - use strict arg itemIDs, msgToRaise, dlg = (self~dlg) - - if \ itemIDs~isA(.Collection) then return -2 - - status = 0 - do id over itemIDs - ret = self~connectItem(id, msgToRaise, dlg) - if ret < 0, ret <> -1 then return ret - if ret == -1 then status = -1 - end - - return status - +::method itemTextToMethodName external "LIBRARY oodialog menu_itemTextToMethodName" +::method setAutoConnection external "LIBRARY oodialog menu_setAutoConnection" +::method getAutoConnectStatus external "LIBRARY oodialog menu_getAutoConnectStatus" +::method connectItem external "LIBRARY oodialog menu_connectItem" ::method connectAllItems external "LIBRARY oodialog menu_connectAllItems" +::method connectSomeItems external "LIBRARY oodialog menu_connectSomeItems" +::method connectWM external "LIBRARY oodialog menu_connectWM" --- Connect WM_CONTEXTMENU messages to a method. -::method connectContextMenu - use strict arg msgToRaise, hwnd = .nil, dlg = (self~dlg) - - if \ dlg~isA(.BaseDialog) then return -3 - - if hwnd \== .nil then - return dlg~addUserMsg(msgToRaise, 0x0000007B, 0xFFFFFFFF, hwnd, 0xFFFFFFFF, 0, 0, 0x00000201) - else - return dlg~addUserMsg(msgToRaise, 0x0000007B, 0xFFFFFFFF, 0, 0, 0, 0, 0x00000201) - ::method test external "LIBRARY oodialog menu_test" /* class: MenuBar- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ @@ -566,534 +135,255 @@ \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ ::class 'MenuBar' public mixinclass Menu -/** attachTo() - * Attaches this menu bar to the specified dialog window. This method is not - * intended to be used when this menu is already attached to a window. Use the - * replace method for that situation. - * - * However, a menu can only have one owner window. So, if this menu is already - * attached to a dialog, it is first detached. - */ -::method attachTo - use strict arg dlg - if \ dlg~isA(.BaseDialog) then return -3 - - if self~dlg <> .nil then self~detach - - oldMenu = WinMenu("ASSOC", self~hMenu, dlg~hwnd) - if oldMenu < 0 then return oldMenu - - dlg~linkMenu(self) - self~dlg = dlg - - self~checkConnectionRequest(dlg) - - return oldMenu - ::method replace use strict arg dlg if \ dlg~isA(.BaseDialog) then return -3 -::method detach - dlg = self~dlg - if dlg == .nil then return -1 +::method isAttached external "LIBRARY oodialog menuBar_isAttached" +::method redraw external "LIBRARY oodialog menuBar_redraw" +::method attachTo external "LIBRARY oodialog menuBar_attachTo" +::method detach external "LIBRARY oodialog menuBar_detach" - ret = WinMenu("DET", dlg~hwnd) - dlg~unlinkMenu - self~dlg = .nil - return ret - /** unInit() * A menu that is not assigned to a window must be destroyed by the application * when it closes. On the other hand, menus assigned to a window are destroyed * by the system when the window is destroyed. */ +--/* ::method unInit + say 'In unInit() of MenuBar class' if self~dlg <> .nil then return self~destroy +--*/ -::method failedInit private - use strict arg ret - self~destroy - self~initCode = ret - return ret +/* class: SystemMenu - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ + A system menu class. System menus are also known as window or control + menus. They are the menu that appears when clicking on the icon in the + upper left corner of a window. +\* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ +::class 'SystemMenu' public subclass Object inherit Menu ResourceUtils +::method init external "LIBRARY oodialog sysMenu_init" +::method revert external "LIBRARY oodialog sysMenu_revert" +::method connectItem external "LIBRARY oodialog sysMenu_connectItem" +::method connectAllItems external "LIBRARY oodialog sysMenu_connectAllItems" +::method connectSomeItems external "LIBRARY oodialog sysMenu_connectSomeItems" + /* class: BinaryMenuBar- - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ A menu bar menu created from a binary resource, or created as an empty menu. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ ::class 'BinaryMenuBar' public subclass Object inherit MenuBar ResourceUtils -::method init - use strict arg src = .nil, id = .nil, symbolSrc = .nil, helpID = 0, attach = .false, autoConnect = .false +::method init external "LIBRARY oodialog binMenu_init" - if self~menuInit(symbolSrc) <> 0 then return self~initCode - if \ self~maybeResolveID(id) then return self~initCode - select - when src~isA(.ResDialog) then do - if self~wID == .nil then do - self~initCode = -1 - return -1 - end - - hMenu = WinMenu("LOAD", 0, src~adm, self~wID) - end - - when src~isA(.string) then do - if src~datatype('W') then do - -- This is to create a BinaryMenuBar from a hMenu. But, is this really - -- of any use? It could be used of creating a System menu, but a system - -- menu might be better off as its own class. - if WinMenu("ISMENU", src) then hMenu = src - else hMenu = -1 - end - else do - if self~wID == .nil then do - self~initCode = -1 - return -1 - end - - hMenu = WinMenu("LOAD", 1, src, self~wID) - end - end - - when src == .nil then hMenu = WinMenu("CREATE", 0) - - otherwise hMenu = -1 - end - -- End select - - if hMenu < 0 then do - self~initCode = hMenu - return hMenu - end - - self~hMenu = hMenu - if helpID <> 0 then self~setHelpID(helpID) - - select - when attach & src~isA(.ResDialog) then do - ret = self~attachTo(src) - if ret < 0 then return self~failedInit(ret) - end - - when attach & symbolSrc~isA(.BaseDialog) then do - ret = self~attachTo(symbolSrc) - if ret < 0 then return self~failedInit(ret) - end - - otherwise nop - end - -- End select - - return 0 - - /* class: PopupMenu- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ A popup menu. (Popup menus are also called, at various times, submenus, drop down menus, or context menus.) \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ ::class 'PopupMenu' public subclass Object inherit Menu ResourceUtils -::method init - use strict arg id = .nil, handle = .nil, symbolSrc = .nil, helpID = 0 +::method init external "LIBRARY oodialog popMenu_init" +::method isAssigned external "LIBRARY oodialog popMenu_isAssigned" +::method show external "LIBRARY oodialog popMenu_show" +::method track external "LIBRARY oodialog popMenu_track" +::method assignTo external "LIBRARY oodialog popMenu_assignTo" +::method connectContextMenu external "LIBRARY oodialog popMenu_connectContextMenu" - if self~menuInit(symbolSrc) <> 0 then return self~initCode - if \ self~maybeResolveID(id) then return self~initCode +::method unInit + say 'In unInit() of PopupMenu class' + --if self~dlg <> .nil then return + --self~destroy - select - when handle == .nil then do - handle = WinMenu("CREATE", 1) - end - - when handle < 0 then nop - - otherwise do - if \ WinMenu("ISMENU", handle) then handle = -2 - end - end - -- End select - - if handle < 0 then do - self~initCode = handle - return handle - end - - self~hMenu = handle - if helpID <> 0 then self~setHelpID(helpID) - - return 0 - -/** show() displays a context menu and returns after the user has selected an - * item or canceled. When the user selects an item, a WM_COMMAND message with - * the id of the selection is generated. If the user cancels, nothing happens. - * 0 indicates success, less than 0 is the negated system error code. - */ -::method show unguarded - use strict arg x, y, owner = (self~dlg), hAlign = "RIGHT", vAlign = "BOTTOM", bothButtons = .false, miscOpts = "" - - if \ owner~isA(.BaseDialog) then return -3 - if self~dlg \== owner then do - -- TODO Revisit Question: Do we want to set the assigned dialog to the owner ?? - self~dlg = owner - end - - if bothButtons then mode = "RIGHT" - else mode = "" - - return TrackPopup(mode, self~hMenu, owner~dlgHandle, x, y, hAlign~upper, vAlign~upper, miscOpts~upper) - -/** track() displays a contex menu and returns after the user has selected an - * item or canceled the menu. No notification (no WM_COMMAND message) is sent - * to the owner window. The selected id is returned, or 0 if the menu is - * canceled or an error happens. - */ -::method track unguarded - use strict arg x, y, owner = (self~dlg), hAlign = "RIGHT", vAlign = "BOTTOM", bothButtons = .false, miscOpts = "" - - if \ owner~isA(.BaseDialog) then return -3 - if self~dlg \== owner then do - -- TODO Revisit Question: Do we want to set the assigned dialog to the owner ?? - self~dlg = owner - end - - if bothButtons then mode = "NONOTIFY RIGHT" - else mode = "NONOTIFY" - - return TrackPopup(mode, self~hMenu, owner~dlgHandle, x, y, hAlign~upper, vAlign~upper, miscOpts~upper) - -::method assignTo unguarded - use strict arg dlg - if \ dlg~isA(.BaseDialog) then return -3 - - oldDlg = self~dlg - self~dlg = dlg - - self~checkConnectionRequest(dlg) - return oldDlg - /* class: MenuTemplate - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ A mix in class supplying the funtionality to create a menu template in memory. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ ::class 'MenuTemplate' public mixinclass ResourceUtils -::method memInit private - expose basePtr currentPtr memHandle isFinal - use strict arg count, helpID +::method addPopup external "LIBRARY oodialog menuTemplate_addPopup" +::method addItem external "LIBRARY oodialog menuTemplate_addItem" +::method addSeparator external "LIBRARY oodialog menuTemplate_addSeparator" +::method isComplete external "LIBRARY oodialog menuTemplate_isComplete" - isFinal = .false - parse value MemMenu("INIT", count, helpID) with memHandle basePtr currentPtr - - if memHandle < 0 then do - self~finalize - return memHandle - end - - return 0 - -::method isFinished - expose isFinal - return isFinal - -::method finish - expose basePtr currentPtr memHandle isFinal - - if isFinal | memHandle == 0 then return -2 - - hMenu = WinMenu("LOAD", 2, memHandle, basePtr) - self~finalize - return hMenu - -::method addPopup - expose currentPtr isFinal - use strict arg name, id = 0, opt = "", helpID = 0 - - if isFinal then return -2 - - id = self~checkId(id) - if id == -1 then return id - - -- Rather than fail on a bad help ID, just use 0. - helpID = self~checkId(helpID) - if helpID == -1 then helpID = 0 - - currentPtr = MemMenu("ADD", currentPtr, id, name, "POPUP " || opt~upper, helpID) - - return 0 - -::method addItem - expose currentPtr isFinal - use strict arg name, id, opt = "", msgToRaise = .nil - - if isFinal then return -2 - - id = self~CheckId(id) - if id == -1 then return id - - currentPtr = MemMenu("ADD", currentPtr, id, name, opt~upper) - - if msgToRaise <> .nil then do - self~connectionRequested = .true - self~connectionQ~queue(.MapItem~new(id, msgToRaise)) - end - - return 0 - -/* With extended menus, separators can have IDs. This is useful ... */ -::method addSeparator - expose currentPtr isFinal - use strict arg id = 0, opt = "" - - if isFinal then return -2 - - -- Rather than fail on a bad ID, just use 0. - id = self~checkId(id) - if id == -1 then id = 0 - - currentPtr = MemMenu("ADD", currentPtr, id, "", "SEPARATOR") - return 0 - -::method finalize private - expose basePtr currentPtr memHandle isFinal - - basePtr = 0 - currentPtr = 0 - memHandle = 0 - isFinal = .true - - /* class: UserMenuBar- - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ A menu bar menu whose initial menu template is created in memory though user (programmer) defined statements. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ ::class 'UserMenuBar' public subclass Object inherit MenuBar MenuTemplate --- The context help ID for a menu. Assigning the help ID in the --- MENUEX_TEMPLATE_HEADER does not work as Microsoft documents it. This is used --- as a work around. It is not maintained to always reflect with the real id --- is; use self~getHelpID() to determine the actual help ID. -::attribute helpID private +::method init external "LIBRARY oodialog userMenu_init" +::method complete external "LIBRARY oodialog userMenu_complete" -::method init - use strict arg symbolSrc = .nil, count = 100, helpID = 0 - if self~menuInit(symbolSrc) <> 0 then return self~initCode - - -- Rather than fail on a bad help ID, just use 0. - helpID = self~checkId(helpID) - if helpID == -1 then helpID = 0 - - ret = self~memInit(count, helpID) - if ret < 0 then do - self~initCode = ret - return ret - end - - -- Work around. Setting the help ID in the in-memory template does not work - -- as documented. - self~helpID = helpID - - return 0 - -::method complete - hMenu = self~finish - if hMenu < 0 then return hMenu - - self~hMenu = hMenu - if self~helpID <> 0 then self~setHelpID(self~HelpID) - - return 0 - - /* class: ScriptMenuBar- - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ A menu bar menu whose initial menu template is created in memory by parsing a resouce script file. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ ::class 'ScriptMenuBar' public subclass Object inherit MenuBar MenuTemplate -::method init - use strict arg rcFile, id = .nil, symbolSrc = .nil, helpID = 0, count = 50, connect = .false, attach = .false +::method init external "LIBRARY oodialog scriptMenu_init" - if self~menuInit(symbolSrc) <> 0 then return self~initCode - if \ self~maybeResolveID(id) then return self~initCode +/** load() Parses a menu definition in a resource script file and loads it into + * memory (through a MenuTemplate.) The MENU resource definition + * statement looks like: + * + * menuID MENU [[optional-statements]] + * + * We ignore the optional statements. menuID can be a number, a symbolic ID + * that resolves to a number, or a string name. + * + * If noMenuID is set to .true we simply take the first menu found. If + * menuid is set to -1 then we are looking for a string name that matches + * menuName. Otherwise we match menuid. Syntax errors are raised for all + * problems, including not finding the menu. If no error is raised, the + * menu is guaranteed to be loaded into memory. + * + * Assumes that the caller has already parsed the file for symbolic ID + * defintions. + */ +::method load private + use strict arg resfile, menuid, connect, count, noMenuID = .false, menuName = "" - helpID = self~checkId(helpID) - if helpID == -1 then helpID = 0 + signal on syntax - ret = self~memInit(count, helpID) - if ret < 0 then do - self~initCode = ret - return ret + file = SysSearchPath("PATH", resfile) + if file == "" then do + msg = 'Unable to find resource script file "'resFile'"' + raise syntax 98.900 array (msg) end - ret = self~load(rcFile, self~wID, connect, count) - if ret <> 0 then do - self~initCode = ret - return ret + f = .stream~new(file) + op = f~open(read) + if op \= "READY:" then do + msg = 'Resource script file "'resFile'" is not readable:' op + raise syntax 98.900 array (msg) end - hMenu = self~finish - if hMenu < 0 then do - self~initCode = hMenu - return hMenu - end + found = 0; n = 0 + fl = f~lines + do while found = 0, fl > 0 + do while n = 0, fl > 0 + s = f~linein; fl -= 1 + n = s~wordpos("MENU") -- TODO we could parse extended menus by looking for MENU *and* MENUEX + end - self~hMenu = hMenu + if f~lines == 0 then do + -- We read the whole file and never found a MENU statement. + f~close - if helpID <> 0 then self~setHelpID(helpID) + if noMenuID then subMsg = 'no MENU statement found' + else if menuName \== "" then subMsg = 'no MENU statement for menuid "'menuName'"' + else subMsg = 'no MENU statement for menuid "'menuid'"' - if attach & symbolSrc~isA(.BaseDialog) then do - ret = self~attachTo(symbolSrc) - if ret < 0 then return self~failedInit(ret) + msg = 'Error: script file "'resFile'"' subMsg + raise syntax 98.900 array (msg) + end + + if noMenuID then found = 1 + else if menuid == -1, s~word(n-1)~translate == menuName then found = 1 + else if menuid \== -1, self~resolveResourceID(s~word(n-1)) == menuid then found = 1 + else n = 0 end - return 0 + s = f~linein; fl -= 1 + do while s~wordpos("BEGIN") = 0, s~pos("{") = 0, fl > 0 + s = f~linein; fl -= 1 + end -::method load private - use strict arg resfile, menuid, connect, count + if f~lines == 0 then do + -- We read the whole file and never found the begin or bracket. + f~close + msg = 'Error: script file "'resFile'" no BEGIN or "{" for MENU statement' + raise syntax 98.900 array (msg) + end - file = SysSearchPath("PATH",resfile) - if file == "" then do - say "Resource file not found -->" resfile - return 1 - end + rcarray = .array~new(50) + bracket = 1 + cur = 0 + endcount = 0 - f = .stream~new(file) - op = f~open(read) - if op \= "READY:" then do - say "Resource file not readable -->" op - return 1 - end + prevs = "" + s = f~linein; fl -= 1 + do while bracket > 0, fl >= 0 + if s~wordpos("END") > 0 | s~pos("}") > 0 then do + bracket -= 1; + endcount += 1 + cur += 1 + rcarray[cur] = s + end + else if s~wordpos("BEGIN") > 0 | s~pos("{") > 0 then do + bracket += 1; + cur += 1 + rcarray[cur] = s + end + else if s~strip \= "" then do + cur += 1 + rcarray[cur] = s + end + s = f~linein; fl -= 1 + end - found = 0; n = 0 - fl = f~lines - do while found = 0 & fl > 0 - do while n = 0 & fl > 0 - s = f~linein; fl = fl - 1 - /* Add any sybmolic IDs defined in the file to the ConstDir. Only - * check for #define at the top of the file. We check for symbolic IDS - * here because menu resources could be defined in a separate file. - */ - if s~wordpos("#define") > 0 then do - s = s~translate(" ", "9"x) - parse var s "#define " symb iid - self~ConstDir[symb~space(0)~translate] = iid - end - n = s~wordpos("MENU") - end + f~close + arrcount = cur - if (self~checkfile(f) = 1) then return 1 + if (count < cur - endcount) then do + msg = 'Menu in script file "'resFile'"contains more items ('cur - endcount') than allocated ('count')' + raise syntax 98.900 array (msg) + end - if menuid == .nil then found = 1 - else do - if s~word(n-1)~translate = menuid~translate then found = 1 - else if self~CheckId(s~word(n-1)) = menuid then found = 1 - else n = 0 - end - end + do i = 1 to arrcount + s = rcarray[i] - s = f~linein; fl = fl - 1 - do while s~wordpos("BEGIN") = 0 & s~pos("{") = 0 & fl > 0 - s = f~linein; fl = fl - 1 - end + select + when s~wordpos("POPUP") > 0 then do + parse var s type '"'name'"' "," opt - if (self~checkFile(f) = 1) then return 1 + j = i + 1; + bracket = 0 + do until bracket = 0 + if rcarray[j]~wordpos("BEGIN") > 0 | rcarray[j]~pos("{") > 0 then + bracket += 1 + else if rcarray[j]~wordpos("END") > 0 | rcarray[j]~pos("}") > 0 then + bracket -= 1 + j += 1 + end - rcarray = .array~new(50) - bracket = 1 - cur = 0 - endcount = 0 + if rcarray[j]~wordpos("END") > 0 | rcarray[j]~pos("}") > 0 then opt = opt || " END" + self~addPopup(0, name, opt, 0) + end - prevs = "" - s = f~linein; fl = fl - 1 - do while bracket > 0 & fl >= 0 - if s~wordpos("END") > 0 | s~pos("}") > 0 then - do - bracket = bracket - 1; - endcount = endcount + 1 - cur = cur + 1 - rcarray[cur] = s - end - else if s~wordpos("BEGIN") > 0 | s~pos("{") > 0 then do - bracket = bracket + 1; - cur = cur + 1 - rcarray[cur] = s - end - else if s~strip \= "" then do - cur = cur + 1 - rcarray[cur] = s - end - s = f~linein; fl = fl - 1 - end + when s~wordpos("SEPARATOR") > 0 then do + parse var s type sep opt + if rcarray[i+1]~wordpos("END") > 0 | rcarray[i+1]~pos("}") > 0 then opt = opt || " END" + self~addSeparator(0, opt) + end - f~close - arrcount = cur; + when s~wordpos("MENUITEM") > 0 then do + parse var s type '"'name'"' "," id "," opt + if rcarray[i+1]~wordpos("END") > 0 | rcarray[i+1]~pos("}") > 0 then opt = opt || " END" + if connect then + self~addItem(id, name, opt, self~itemTextToMethodName(name)) + else + self~addItem(id, name, opt) + end - if (count < cur - endcount) then count = cur - endcount +5; + when s~wordpos("END") > 0 | s~pos("}") > 0 | s~wordpos("BEGIN") > 0 | s~pos("{") > 0 then nop; - self~processingLoad = 1 - - do i = 1 to arrcount - s = rcarray[i] - - select - when s~wordpos("POPUP") > 0 then do - parse var s type '"'name'"' "," opt - - j = i + 1; - bracket = 0 - do until bracket = 0 - if rcarray[j]~wordpos("BEGIN") > 0 | rcarray[j]~pos("{") > 0 then - bracket = bracket + 1 - else if rcarray[j]~wordpos("END") > 0 | rcarray[j]~pos("}") > 0 then - bracket = bracket - 1 - j = j +1 - end - - if rcarray[j]~wordpos("END") > 0 | rcarray[j]~pos("}") > 0 then opt = opt || " END" - self~addPopup(name, , opt) - end - - when s~wordpos("SEPARATOR") > 0 then do - parse var s type sep opt - if rcarray[i+1]~wordpos("END") > 0 | rcarray[i+1]~pos("}") > 0 then opt = opt || " END" - self~addSeparator( , opt) - end - - when s~wordpos("MENUITEM") > 0 then do - parse var s type '"'name'"' "," id "," opt - if rcarray[i+1]~wordpos("END") > 0 | rcarray[i+1]~pos("}") > 0 then opt = opt || " END" - if connect then - self~addItem(name, id, opt, name~changeStr('&', "")~space(0)) - else - self~addItem(name, id, opt) - end - - when s~wordpos("END") > 0 | s~pos("}") > 0 | s~wordpos("BEGIN") > 0 | s~pos("{") > 0 then nop; - - otherwise do - self~errorFile(f, s) - return 1 - end - end /*select 1*/ + otherwise do + msg = "Error parsing MENU definition." || ' ' || "Resource file:" f || ' ' || "Line:" s + raise syntax 98.900 array (msg) + end + end /*select 1*/ end /* do while */ - self~processingLoad = 0 return 0 -::class 'MapItem' public +syntax: + c = condition('O') + if c~traceBack \== .nil then c~traceBack~empty + raise propagate -::attribute key set private -::attribute key get - -::attribute item set private -::attribute item get - -::method init - expose key item - use strict arg key, item - Modified: main/trunk/extensions/platform/windows/oodialog/basedlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/basedlg.cls 2009-06-14 23:06:33 UTC (rev 4793) +++ main/trunk/extensions/platform/windows/oodialog/basedlg.cls 2009-06-15 04:37:04 UTC (rev 4794) @@ -377,9 +377,17 @@ self~bkgBitmap = 0 -- no background bitmap self~bkgBrushBmp = 0 -- no background bitmap self~menuBar = .nil + self~isLinked = .false return 0 +-- TODO needs doc +::method getMenuBar + return self~menuBar +-- TODO needs doc +::method hasMenuBar + return self~menuBar \== .nil & self~isLinked + ::class 'ResourceImage' public ::method init external "LIBRARY oodialog ri_init" Modified: main/trunk/extensions/platform/windows/oodialog/dlgext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-06-14 23:06:33 UTC (rev 4793) +++ main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-06-15 04:37:04 UTC (rev 4794) @@ -878,26 +878,39 @@ /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ These menu bar methods are needed to provide backward compatibility for the - deprecated menu methods. The ooDialog programmer is *strongly* discouraged - from using them. If the deprecated methods are removed, these will be removed - with them. + deprecated menu methods. The Rexx programmer is *strongly* discouraged from + using them. If the deprecated methods are removed, these will be removed with + them. + + In addition, it is highly likely that the results will be unpredictable. + + To obtain the menuBar attached to the dialog, use the getMenuBar() method. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ -::attribute menuBar get -::attribute menuBar set private +::attribute menuBar private +::attribute isLinked private ::method linkMenu use strict arg menu - if \ menu~isA(.MenuBar) then return -1 + signal on syntax + if \ menu~isA(.MenuBar) then raise syntax 93.948 array(1, "MenuBar") + oldMenu = self~menuBar self~menuBar = menu + self~isLinked = .true return oldMenu +syntax: + c = condition('O') + if c~traceBack~isA(.List) then c~traceBack~empty + raise propagate + ::method unlinkMenu menu = self~menuBar self~menuBar = .nil + self~isLinked = .false return menu /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ @@ -907,39 +920,102 @@ ::method enableMenuItem unguarded use strict arg id - if self~menuBar == .nil then return -2 + + signal on syntax + + if self~menuBar == .nil then raise syntax 93.900 array("there is no MenuBar attached to this dialog") + if self~menuBar~isA(.UserMenuBar), \self~menuBar~isComplete then raise syntax 93.900 array("the UserMenuBar is not complete") return self~menuBar~enable(id) +syntax: + c = condition('O') + if c~traceBack~isA(.List) then c~traceBack~empty + raise propagate + ::method disableMenuItem unguarded use strict arg id - if self~menuBar == .nil then return -2 + + signal on syntax + + if self~menuBar == .nil then raise syntax 93.900 array("There is no MenuBar attached to this dialog") + if self~menuBar~isA(.UserMenuBar), \self~menuBar~isComplete then raise syntax 93.900 array("the UserMenuBar is not complete") return self~menuBar~disable(id) +syntax: + c = condition('O') + if c~traceBack~isA(.List) then c~traceBack~empty + raise propagate + ::method checkMenuItem unguarded use strict arg id - if self~menuBar == .nil then return -2 + + signal on syntax + + if self~menuBar == .nil then raise syntax 93.900 array("There is no MenuBar attached to this dialog") + if self~menuBar~isA(.UserMenuBar), \self~menuBar~isComplete then raise syntax 93.900 array("the UserMenuBar is not complete") return self~menuBar~check(id) +syntax: + c = condition('O') + if c~traceBack~isA(.List) then c~traceBack~empty + raise propagate + ::method uncheckMenuItem unguarded use strict arg id - if self~menuBar == .nil then return -2 + + signal on syntax + + if self~menuBar == .nil then raise syntax 93.900 array("There is no MenuBar attached to this dialog") + if self~menuBar~isA(.UserMenuBar), \self~menuBar~isComplete then raise syntax 93.900 array("the UserMenuBar is not complete") return self~menuBar~uncheck(id) +syntax: + c = condition('O') + if c~traceBack~isA(.List) then c~traceBack~empty + raise propagate + ::method grayMenuItem unguarded use strict arg id - if self~menuBar == .nil then return -2 + + signal on syntax + + if self~menuBar == .nil then raise syntax 93.900 array("There is no MenuBar attached to this dialog") + if self~menuBar~isA(.UserMenuBar), \self~menuBar~isComplete then raise syntax 93.900 array("the UserMenuBar is not complete") return self~menuBar~gray(id) +syntax: + c = condition('O') + if c~traceBack~isA(.List) then c~traceBack~empty + raise propagate + ::method setMenuItemRadio unguarded use strict arg idstart, idend, idset - if self~menuBar == .nil then return -2 - return self~menuBar~checkRadio(idstart, idend, idset) + signal on syntax + + if self~menuBar == .nil then raise syntax 93.900 array("There is no MenuBar attached to this dialog") + if self~menuBar~isA(.UserMenuBar), \self~menuBar~isComplete then raise syntax 93.900 array("the UserMenuBar is not complete") + return self~menuBar~checkRadioItem(idstart, idend, idset) + +syntax: + c = condition('O') + if c~traceBack~isA(.List) then c~traceBack~empty + raise propagate + ::method getMenuItemState unguarded use strict arg id - if self~menuBar == .nil then return -2 - return self~menuBar~getState(id) + signal on syntax + + if self~menuBar == .nil then raise syntax 93.900 array("There is no MenuBar attached to this dialog") + if self~menuBar~isA(.UserMenuBar), \self~menuBar~isComplete then raise syntax 93.900 array("the UserMenuBar is not complete") + return self~menuBar~getItemState(id) + +syntax: + c = condition('O') + if c~traceBack~isA(.List) then c~traceBack~empty + raise propagate + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ End deprecated menu bar methods. \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ Modified: main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp 2009-06-14 23:06:33 UTC (rev 4793) +++ main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp 2009-06-15 04:37:04 UTC (rev 4794) @@ -50,11 +50,30 @@ #include "APICommon.h" #include "oodCommon.h" +/** + * 49.900 + * 49 -> A severe error was detected in the ... [truncated message content] |
From: <mie...@us...> - 2009-06-16 23:57:29
|
Revision: 4804 http://oorexx.svn.sourceforge.net/oorexx/?rev=4804&view=rev Author: miesfeld Date: 2009-06-16 23:57:24 +0000 (Tue, 16 Jun 2009) Log Message: ----------- Some file renames in ooDialog Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp main/trunk/extensions/platform/windows/oodialog/msgext.cls main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp main/trunk/extensions/platform/windows/oodialog/oodCommon.h main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp main/trunk/extensions/platform/windows/oodialog/oodMenu.hpp main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp main/trunk/extensions/platform/windows/oodialog/oodRoutines.cpp main/trunk/extensions/platform/windows/oodialog/oodialog.mak main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp main/trunk/extensions/platform/windows/oodialog/oovdata.cpp main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp main/trunk/extensions/platform/windows/oodialog/oovdraw.cpp main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp main/trunk/extensions/platform/windows/oodialog/oovother.cpp main/trunk/extensions/platform/windows/oodialog/oovscrll.cpp main/trunk/extensions/platform/windows/oodialog/oovtext.cpp main/trunk/extensions/platform/windows/oodialog/oovuser.cpp Added Paths: ----------- main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp main/trunk/extensions/platform/windows/oodialog/ooDialog.def main/trunk/extensions/platform/windows/oodialog/ooDialog.h Removed Paths: ------------- main/trunk/extensions/platform/windows/oodialog/oovutil.cpp main/trunk/extensions/platform/windows/oodialog/oovutil.def main/trunk/extensions/platform/windows/oodialog/oovutil.h Modified: main/trunk/extensions/platform/windows/oodialog/APICommon.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-06-16 17:25:34 UTC (rev 4803) +++ main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-06-16 23:57:24 UTC (rev 4804) @@ -43,7 +43,7 @@ * any code that uses the native API. Include APICommon.h to use them. */ -#include "oovutil.h" // Must be first, includes windows.h and oorexxapi.h +#include "ooDialog.h" // Must be first, includes windows.h and oorexxapi.h #include <stdio.h> #include <errno.h> Modified: main/trunk/extensions/platform/windows/oodialog/msgext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/msgext.cls 2009-06-16 17:25:34 UTC (rev 4803) +++ main/trunk/extensions/platform/windows/oodialog/msgext.cls 2009-06-16 23:57:24 UTC (rev 4804) @@ -127,7 +127,7 @@ -- designed. Use the connectListViewNotify method for method connections that -- can take advantage of this information. A tag is added to the message to -- signal that the extra information should be processed. The tag is an - -- unsigned long made up of flags which are defined in oovutil.h + -- unsigned long made up of flags which are defined in ooDialog.h ::method connectListViewNotify use arg id, type, msgToRise if id~DataType("W") = 0 then id = self~ResolveSymbolicId(id) Copied: main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp (from rev 4803, main/trunk/extensions/platform/windows/oodialog/oovutil.cpp) =================================================================== --- main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp (rev 0) +++ main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp 2009-06-16 23:57:24 UTC (rev 4804) @@ -0,0 +1,1853 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/*----------------------------------------------------------------------------*/ +#include "ooDialog.h" // Must be first, includes windows.h and oorexxapi.h + +#include <mmsystem.h> +#include <commctrl.h> +#include <stdio.h> +#include <dlgs.h> +#include "oodCommon.h" +#include "oodSymbols.h" + +extern INT DelDialog(DIALOGADMIN * aDlg); +extern MsgReplyType SearchMessageTable(ULONG message, WPARAM param, LPARAM lparam, DIALOGADMIN * addressedTo); +extern BOOL DrawBitmapButton(DIALOGADMIN * addr, HWND hDlg, WPARAM wParam, LPARAM lParam, BOOL MsgEnabled); +extern BOOL DrawBackgroundBmp(DIALOGADMIN * addr, HWND hDlg, WPARAM wParam, LPARAM lParam); +extern BOOL DataAutodetection(DIALOGADMIN * aDlg); +extern LRESULT PaletteMessage(DIALOGADMIN * addr, HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); +extern BOOL AddDialogMessage(CHAR * msg, CHAR * Qptr); +extern LONG SetRexxStem(const char * name, INT id, const char * secname, const char * data); +extern BOOL GetDialogIcons(DIALOGADMIN *, INT, UINT, PHANDLE, PHANDLE); + +/* Shared functions for keyboard hooks and key press subclassing */ +extern LONG setKeyPressData(KEYPRESSDATA *, CONSTRXSTRING, CONSTRXSTRING, const char *); +extern void processKeyPress(KEYPRESSDATA *, WPARAM, LPARAM, PCHAR); +extern void freeKeyPressData(KEYPRESSDATA *); +extern UINT seekKeyPressMethod(KEYPRESSDATA *, const char *); +extern void removeKeyPressMethod(KEYPRESSDATA *, UINT); + +/* Local functions */ +static LONG installKBHook(DIALOGADMIN *, HWND, CONSTRXSTRING, CONSTRXSTRING, const char *); +static LONG setKBHook(DIALOGADMIN *, HWND); +static void removeKBHook(DIALOGADMIN *); +static BOOL parseKeyToken(PCHAR, PUINT, PUINT); +static HICON GetIconForID(DIALOGADMIN *, UINT, UINT, int, int); + + +class LoopThreadArgs +{ +public: + const char *resourceId; + DIALOGADMIN *dlgAdmin; + const char *autoDetect; + BOOL *release; // used for a return value +}; + + +/* dialog procedure + handles the search for user defined messages and bitmap buttons + handles messages necessary for 3d controls + seeks for the addressed dialog to handle the messages */ + + +LRESULT CALLBACK RexxDlgProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) +{ + HBRUSH hbrush = NULL; + HWND hW; + DIALOGADMIN * addressedTo = NULL; + BOOL MsgEnabled = FALSE; + register INT i=0; + + if (uMsg != WM_INITDIALOG) + { + SEEK_DLGADM_TABLE(hDlg, addressedTo); + if (!addressedTo && topDlg && DialogInAdminTable(topDlg) && topDlg->TheDlg) addressedTo = topDlg; + + if (addressedTo) + { + MsgEnabled = IsWindowEnabled(hDlg) && DialogInAdminTable(addressedTo); + + // Do not search message table for WM_PAINT to improve redraw. + if ( MsgEnabled && (uMsg != WM_PAINT) && (uMsg != WM_NCPAINT) ) + { + MsgReplyType searchReply; + if ( (searchReply = SearchMessageTable(uMsg, wParam, lParam, addressedTo)) != NotMatched ) + { + // Note pre 4.0.1, reply was always FALSE, pass on to the system to process. + return (searchReply == ReplyTrue ? TRUE : FALSE); + } + } + + switch (uMsg) { + case WM_PAINT: + if (addressedTo->BkgBitmap) DrawBackgroundBmp(addressedTo, hDlg, wParam, lParam); + break; + + case WM_DRAWITEM: + if ((lParam != 0) && (addressedTo)) return DrawBitmapButton(addressedTo, hDlg, wParam, lParam, MsgEnabled); + break; + + case WM_CTLCOLORDLG: + if (addressedTo->BkgBrush) + { + return (LRESULT) addressedTo->BkgBrush; + } + + case WM_CTLCOLORSTATIC: + case WM_CTLCOLORBTN: + case WM_CTLCOLOREDIT: + case WM_CTLCOLORLISTBOX: + case WM_CTLCOLORMSGBOX: + case WM_CTLCOLORSCROLLBAR: + if (addressedTo->CT_size) + { + // See of the user has set the dialog item with a different + // color. + LONG id = GetWindowLong((HWND)lParam, GWL_ID); + SEARCHBRUSH(addressedTo, i, id, hbrush); + if (hbrush) + { + if ( addressedTo->ColorTab[i].isSysBrush ) + { + SetBkColor((HDC)wParam, GetSysColor(addressedTo->ColorTab[i].ColorBk)); + if ( addressedTo->ColorTab[i].ColorFG != -1 ) + { + SetTextColor((HDC)wParam, GetSysColor(addressedTo->ColorTab[i].ColorFG)); + } + } + else + { + SetBkColor((HDC)wParam, PALETTEINDEX(addressedTo->ColorTab[i].ColorBk)); + if ( addressedTo->ColorTab[i].ColorFG != -1 ) + { + SetTextColor((HDC)wParam, PALETTEINDEX(addressedTo->ColorTab[i].ColorFG)); + } + } + } + } + if (hbrush) + return (LRESULT)hbrush; + else + return DefWindowProc(hDlg, uMsg, wParam, lParam); + + + case WM_COMMAND: + switch( LOWORD(wParam) ) { + case IDOK: + if (!HIWORD(wParam)) addressedTo->LeaveDialog = 1; /* Notify code must be 0 */ + return TRUE; + break; + case IDCANCEL: + if (!HIWORD(wParam)) addressedTo->LeaveDialog = 2; /* Notify code must be 0 */ + return TRUE; + break; + } + break; + +#ifdef __CTL3D + case WM_SYSCOLORCHANGE: + if (addressedTo->Use3DControls) + Ctl3dColorChange(); + break; +#endif + + case WM_QUERYNEWPALETTE: + case WM_PALETTECHANGED: + if (addressedTo) return PaletteMessage(addressedTo, hDlg, uMsg, wParam, lParam); + break; + + case WM_SETTEXT: + case WM_NCPAINT: + case WM_NCACTIVATE: +#ifdef __CTL3D + if (addressedTo->Use3DControls) + { + SetWindowLong(hDlg, DWL_MSGRESULT,Ctl3dDlgFramePaint(hDlg, uMsg, wParam, lParam)); + return TRUE; + } +#endif + return FALSE; + + case WM_USER_CREATECHILD: + /* Create a child dialog of this dialog and return its window + * handle. The dialog template pointer is passed here as the + * LPARAM arg from UsrCreateDialog(). + */ + hW = CreateDialogIndirectParam(MyInstance, (DLGTEMPLATE *)lParam, hDlg, (DLGPROC)RexxDlgProc, addressedTo->Use3DControls); + ReplyMessage((LRESULT)hW); + return (LRESULT)hW; + case WM_USER_INTERRUPTSCROLL: + addressedTo->StopScroll = wParam; + return (TRUE); + case WM_USER_GETFOCUS: + ReplyMessage((LRESULT)GetFocus()); + return (TRUE); + case WM_USER_GETSETCAPTURE: + if (!wParam) ReplyMessage((LRESULT)GetCapture()); + else if (wParam == 2) ReplyMessage((LRESULT)ReleaseCapture()); + else ReplyMessage((LRESULT)SetCapture((HWND)lParam)); + return (TRUE); + case WM_USER_GETKEYSTATE: + ReplyMessage((LRESULT)GetAsyncKeyState((int)wParam)); + return (TRUE); + + case WM_USER_SUBCLASS: + { + SUBCLASSDATA * pData = (SUBCLASSDATA *)lParam; + BOOL success = FALSE; + + if ( pData ) + { + success = SetWindowSubclass(pData->hCtrl, (SUBCLASSPROC)wParam, pData->uID, (DWORD_PTR)pData); + } + ReplyMessage((LRESULT)success); + } return (TRUE); + + case WM_USER_SUBCLASS_REMOVE: + ReplyMessage((LRESULT)RemoveWindowSubclass(GetDlgItem(hDlg, (int)lParam), (SUBCLASSPROC)wParam, (int)lParam)); + return (TRUE); + + case WM_USER_HOOK: + ReplyMessage((LRESULT)SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)wParam, NULL, GetCurrentThreadId())); + return (TRUE); + + case WM_USER_CONTEXT_MENU: + { + PTRACKPOP ptp = (PTRACKPOP)wParam; + uint32_t cmd; + + SetLastError(0); + cmd = (uint32_t)TrackPopupMenuEx(ptp->hMenu, ptp->flags, ptp->point.x, ptp->point.y, + ptp->hWnd, ptp->lptpm); + + // If TPM_RETURNCMD is specified, the return is the menu item + // selected. Otherwise, the return is 0 for failure and + // non-zero for success. + if ( ! (ptp->flags & TPM_RETURNCMD) ) + { + cmd = (cmd == 0 ? FALSE : TRUE); + if ( cmd == FALSE ) + { + ptp->dwErr = GetLastError(); + } + } + ReplyMessage((LRESULT)cmd); + return (TRUE); + } + } + } + } + else + /* the WM_INITDIALOG message is sent by CreateDialog(Indirect)Param before TheDlg is set */ + { +#ifdef __CTL3D + if (lParam) /* Use3DControls is the lparam that is specified for the Create API */ + Ctl3dSubclassDlgEx(hDlg, CTL3D_ALL); +#endif + return TRUE; + } + return FALSE; +} + + + +/* prepare dialog management table for a new dialog entry */ +size_t RexxEntry HandleDialogAdmin(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) +{ + DIALOGADMIN * current; + DEF_ADM; + + EnterCriticalSection(&crit_sec); + + if (argc == 1) /* we have to do a dialog admin cleanup */ + { + GET_ADM; + if (!dlgAdm) + { + LeaveCriticalSection(&crit_sec); + RETVAL(-1); + } + + if (DialogInAdminTable(dlgAdm)) + { + DelDialog(dlgAdm); + } + safeLocalFree(dlgAdm->pMessageQueue); + LocalFree(dlgAdm); + } + else /* we have to do a new dialog admin allocation */ + { + if (StoredDialogs<MAXDIALOGS) + { + current = (DIALOGADMIN *) LocalAlloc(LPTR, sizeof(DIALOGADMIN)); + if (current) + { + current->pMessageQueue = (char *)LocalAlloc(LPTR, MAXLENQUEUE); + } + if (!current || !current->pMessageQueue) + { + MessageBox(0,"Out of system resources","Error",MB_OK | MB_ICONHAND | MB_SYSTEMMODAL); + LeaveCriticalSection(&crit_sec); + RETC(0); + } + current->previous = topDlg; + current->TableEntry = StoredDialogs; + StoredDialogs++; + DialogTab[current->TableEntry] = current; + LeaveCriticalSection(&crit_sec); + RETPTR(current) + } + else + { + MessageBox(0,"Too many active Dialogs","Error",MB_OK | MB_ICONHAND | MB_SYSTEMMODAL); + } + } + LeaveCriticalSection(&crit_sec); + RETC(0); +} + + + +/* install DLL, control program and 3D controls */ +BOOL InstallNecessaryStuff(DIALOGADMIN* dlgAdm, CONSTRXSTRING ar[], size_t argc) +{ + const char *Library; + + if (dlgAdm->previous) ((DIALOGADMIN*)dlgAdm->previous)->OnTheTop = FALSE; + topDlg = dlgAdm; + Library = ar[0].strptr; + + if (Library[0] != '0') + { + dlgAdm->TheInstance = LoadLibrary(Library); + if (!dlgAdm->TheInstance) + { + CHAR msg[256]; + sprintf(msg, "Failed to load Dynamic Link Library (resource DLL.)\n" + " File name:\t\t\t%s\n" + " Windows System Error Code:\t%d\n", Library, GetLastError()); + MessageBox(0, msg, "ooDialog DLL Load Error", MB_OK | MB_ICONHAND | MB_SYSTEMMODAL); + return FALSE; + } + } + else + { + dlgAdm->TheInstance = MyInstance; + } + + if (argc >= 4) + { + dlgAdm->Use3DControls = FALSE; + } + return TRUE; +} + + + +/* end a dialog and remove installed components */ +INT DelDialog(DIALOGADMIN * aDlg) +{ + DIALOGADMIN * current; + INT ret, i; + BOOL wasFGW; + HICON hIconBig = NULL; + HICON hIconSmall = NULL; + + EnterCriticalSection(&crit_sec); + wasFGW = (aDlg->TheDlg == GetForegroundWindow()); + + ret = aDlg->LeaveDialog; + + /* add this message, so HandleMessages in DIALOG.CMD knows that finsihed shall be set */ + AddDialogMessage((char *) MSG_TERMINATE, aDlg->pMessageQueue); + + if (!aDlg->LeaveDialog) aDlg->LeaveDialog = 3; /* signal to exit */ + + /* the entry must be removed before the last message is sent so the GetMessage loop can quit */ + if (aDlg->TableEntry == StoredDialogs-1) + DialogTab[aDlg->TableEntry] = NULL; + else + { + DialogTab[aDlg->TableEntry] = DialogTab[StoredDialogs-1]; /* move last entry to deleted one */ + DialogTab[aDlg->TableEntry]->TableEntry = aDlg->TableEntry; + DialogTab[StoredDialogs-1] = NULL; /* and delete last entry */ + } + StoredDialogs--; + + PostMessage(aDlg->TheDlg, WM_QUIT, 0, 0); /* to exit GetMessage */ + + if (aDlg->TheDlg) DestroyWindow(aDlg->TheDlg); /* docu states "must not use EndDialog for non-modal dialogs" */ + +#ifdef __CTL3D + if ((!StoredDialogs) && (aDlg->Use3DControls)) Ctl3dUnregister(aDlg->TheInstance); +#endif + + /* Swap back the saved icons. If not shared, the icon was loaded from a file + * and needs to be freed, otherwise the OS handles the free. The title bar + * icon is tricky. At this point the dialog is still visible. If the small + * icon in the class is set to 0, the application will hang. Same thing + * happens if the icon is freed. So, don't set a zero into the class bytes, + * and, if the icon is to be freed, do so after leaving the critical + * section. + */ + if ( aDlg->DidChangeIcon ) + { + hIconBig = (HICON)setClassPtr(aDlg->TheDlg, GCLP_HICON, (LONG_PTR)aDlg->SysMenuIcon); + if ( aDlg->TitleBarIcon ) + { + hIconSmall = (HICON)setClassPtr(aDlg->TheDlg, GCLP_HICONSM, (LONG_PTR)aDlg->TitleBarIcon); + } + + if ( ! aDlg->SharedIcon ) + { + DestroyIcon(hIconBig); + if ( ! hIconSmall ) + { + hIconSmall = (HICON)getClassPtr(aDlg->TheDlg, GCLP_HICONSM); + } + } + else + { + hIconSmall = NULL; + } + } + + if ((aDlg->TheInstance) && (aDlg->TheInstance != MyInstance)) + { + FreeLibrary(aDlg->TheInstance); + } + current = (DIALOGADMIN *)aDlg->previous; + + /* delete data, message and bitmap table of the dialog */ + if (aDlg->MsgTab) + { + for (i=0;i<aDlg->MT_size;i++) + { + safeLocalFree(aDlg->MsgTab[i].rexxProgram); + } + LocalFree(aDlg->MsgTab); + aDlg->MT_size = 0; + } + safeLocalFree(aDlg->DataTab); + aDlg->DT_size = 0; + + /* delete color brushs */ + if (aDlg->ColorTab) + { + for (i=0;i<aDlg->CT_size;i++) + { + safeDeleteObject(aDlg->ColorTab[i].ColorBrush); + } + LocalFree(aDlg->ColorTab); + aDlg->CT_size = 0; + } + + /* delete bitmaps */ + if (aDlg->BmpTab) + { + for (i=0;i<aDlg->BT_size;i++) + { + if ((aDlg->BmpTab[i].Loaded & 0x1011) == 1) /* otherwise stretched bitmap files are not freed */ + { + safeLocalFree((void *)aDlg->BmpTab[i].bitmapID); + safeLocalFree((void *)aDlg->BmpTab[i].bmpFocusID); + safeLocalFree((void *)aDlg->BmpTab[i].bmpSelectID); + safeLocalFree((void *)aDlg->BmpTab[i].bmpDisableID); + } + else if (aDlg->BmpTab[i].Loaded == 0) + { + safeDeleteObject((HBITMAP)aDlg->BmpTab[i].bitmapID); + safeDeleteObject((HBITMAP)aDlg->BmpTab[i].bmpFocusID); + safeDeleteObject((HBITMAP)aDlg->BmpTab[i].bmpSelectID); + safeDeleteObject((HBITMAP)aDlg->BmpTab[i].bmpDisableID); + } + } + + LocalFree(aDlg->BmpTab); + safeDeleteObject(aDlg->ColorPalette); + aDlg->BT_size = 0; + } + + /* delete the icon resource table */ + if (aDlg->IconTab) + { + for ( i = 0; i < aDlg->IT_size; i++ ) + { + safeLocalFree(aDlg->IconTab[i].fileName); + } + LocalFree(aDlg->IconTab); + aDlg->IT_size = 0; + } + + /* Unhook a hook if it is installed */ + if ( aDlg->hHook ) + { + removeKBHook(aDlg); + } + + /* The message queue and the admin block are freed in HandleDialogAdmin called from HandleMessages */ + + if (!StoredDialogs) + { + topDlg = NULL; + } + else + { + topDlg = current; + } + if (topDlg) + { + if (DialogInAdminTable(topDlg)) + { + if (!IsWindowEnabled(topDlg->TheDlg)) + { + EnableWindow(topDlg->TheDlg, TRUE); + } + if (wasFGW) + { + SetForegroundWindow(topDlg->TheDlg); + topDlg->OnTheTop = TRUE; + } + } + else + { + topDlg = NULL; + } + } + LeaveCriticalSection(&crit_sec); + if ( hIconSmall ) + { + DestroyIcon(hIconSmall); + } + return ret; +} + + +/* create an asynchronous dialog and run asynchronous message loop */ +DWORD WINAPI WindowLoopThread(void *arg) +{ + MSG msg; + CHAR buffer[NR_BUFFER]; + DIALOGADMIN * Dlg; + BOOL * release; + ULONG ret; + + LoopThreadArgs *args = (LoopThreadArgs *)arg; + + + Dlg = args->dlgAdmin; /* thread local admin pointer from StartDialog */ + Dlg->TheDlg = CreateDialogParam( Dlg->TheInstance, MAKEINTRESOURCE(atoi(args->resourceId)), 0, (DLGPROC) RexxDlgProc, Dlg->Use3DControls); /* pass 3D flag to WM_INITDIALOG */ + Dlg->ChildDlg[0] = Dlg->TheDlg; + + release = args->release; /* the Release flag is stored as the 4th argument */ + if (Dlg->TheDlg) + { + if (args->autoDetect) + { + strcpy(buffer, args->autoDetect); + } + else + { + strcpy(buffer, "0"); + } + + if (IsYes(buffer)) + { + if (!DataAutodetection(Dlg)) + { + Dlg->TheThread = NULL; + return 0; + }; + } + + *release = TRUE; /* Release wait in StartDialog */ + do + { + if (GetMessage(&msg,NULL, 0,0)) + { + if (!IsDialogMessage (Dlg->TheDlg, &msg)) + { + DispatchMessage(&msg); + } + } + } while (Dlg && DialogInAdminTable(Dlg) && !Dlg->LeaveDialog); + } + else + { + *release = TRUE; + } + EnterCriticalSection(&crit_sec); + if (DialogInAdminTable(Dlg)) + { + ret = DelDialog(Dlg); + Dlg->TheThread = NULL; + } + LeaveCriticalSection(&crit_sec); + return ret; +} + + +size_t RexxEntry GetDialogFactor(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) +{ + ULONG u; + double x,y; + u = GetDialogBaseUnits(); + + + x = LOWORD(u); + y = HIWORD(u); + + x = x / 4; + y = y / 8; + + sprintf(retstr->strptr, "%4.1f %4.1f", x, y); + retstr->strlength = strlen(retstr->strptr); + return 0; +} + + + + +/* create an asynchronous dialog */ +size_t RexxEntry StartDialog(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) +{ + ULONG thID; + BOOL Release = FALSE; + DEF_ADM; + + CHECKARG(7); + GET_ADM; + if (!dlgAdm) + { + RETERR; + } + + EnterCriticalSection(&crit_sec); + if (!InstallNecessaryStuff(dlgAdm, &argv[1], argc-1)) + { + if (dlgAdm) + { + DelDialog(dlgAdm); + if (dlgAdm->pMessageQueue) LocalFree((void *)dlgAdm->pMessageQueue); + LocalFree(dlgAdm); + } + LeaveCriticalSection(&crit_sec); + RETC(0) + } + + LoopThreadArgs threadArgs; + threadArgs.resourceId = argv[2].strptr; + threadArgs.dlgAdmin = dlgAdm; + threadArgs.autoDetect = argv[3].strptr; + threadArgs.release = &Release; + + dlgAdm->TheThread = CreateThread(NULL, 2000, WindowLoopThread, &threadArgs, 0, &thID); + + while ((!Release) && (dlgAdm->TheThread)) + { + Sleep(1); + }; /* wait for dialog start */ + LeaveCriticalSection(&crit_sec); + + if (dlgAdm) + { + if (dlgAdm->TheDlg) + { + HICON hBig = NULL; + HICON hSmall = NULL; + + SetThreadPriority(dlgAdm->TheThread, THREAD_PRIORITY_ABOVE_NORMAL); /* for a faster drawing */ + dlgAdm->OnTheTop = TRUE; + dlgAdm->threadID = thID; + /* modal flag = yes ? */ + if (dlgAdm->previous && !IsYes(argv[6].strptr) && IsWindowEnabled(((DIALOGADMIN *)dlgAdm->previous)->TheDlg)) EnableWindow(((DIALOGADMIN *)dlgAdm->previous)->TheDlg, FALSE); + + if ( GetDialogIcons(dlgAdm, atoi(argv[5].strptr), ICON_DLL, (PHANDLE)&hBig, (PHANDLE)&hSmall) ) + { + dlgAdm->SysMenuIcon = (HICON)setClassPtr(dlgAdm->TheDlg, GCLP_HICON, (LONG_PTR)hBig); + dlgAdm->TitleBarIcon = (HICON)setClassPtr(dlgAdm->TheDlg, GCLP_HICONSM, (LONG_PTR)hSmall); + dlgAdm->DidChangeIcon = TRUE; + + SendMessage(dlgAdm->TheDlg, WM_SETICON, ICON_SMALL, (LPARAM)hSmall); + } + + RETPTR(dlgAdm->TheDlg); + } + dlgAdm->OnTheTop = FALSE; + if (dlgAdm->previous) + { + ((DIALOGADMIN *)(dlgAdm->previous))->OnTheTop = TRUE; + } + if ((dlgAdm->previous) && !IsWindowEnabled(((DIALOGADMIN *)dlgAdm->previous)->TheDlg)) + { + EnableWindow(((DIALOGADMIN *)dlgAdm->previous)->TheDlg, TRUE); + } + } + RETC(0); +} + + +/** + * Loads and returns the handles to the regular size and small size icons for + * the dialog. These icons are used in the title bar of the dialog, on the task + * bar, and for the alt-tab display. + * + * The icons can come from the user resource DLL, a user defined dialog, or the + * OODialog DLL. IDs for the icons bound to the OODialog.dll are reserved. + * + * This function attempts to always succeed. If an icon is not attained, the + * default icon from the resources in the OODialog DLL is used. This icon + * should always be present, it is bound to the DLL when ooRexx is built. + * + * @param dlgAdm Pointer to the dialog administration block. + * @param id Numerical resource ID. + * @param iconSrc Flag indicating whether the icon is located in a DLL or to + * be loaded from a file. + * @param phBig In/Out Pointer to an icon handle. If the function succeeds, + * on return will contian the handle to a regular size icon. + * @param phSmall In/Out Pointer to an icon handle. On success will contain + * a handle to a small size icon. + * + * @return True if the icons were loaded and the returned handles are valid, + * otherwise false. + */ +BOOL GetDialogIcons(DIALOGADMIN *dlgAdm, INT id, UINT iconSrc, PHANDLE phBig, PHANDLE phSmall) +{ + int cx, cy; + + if ( phBig == NULL || phSmall == NULL ) + { + return FALSE; + } + + if ( id < 1 ) + { + id = IDI_DLG_DEFAULT; + } + + /* If one of the reserved IDs, iconSrc has to be ooDialog. */ + if ( id >= IDI_DLG_MIN_ID && id <= IDI_DLG_MAX_ID ) + { + iconSrc = ICON_OODIALOG; + } + + cx = GetSystemMetrics(SM_CXICON); + cy = GetSystemMetrics(SM_CYICON); + + *phBig = GetIconForID(dlgAdm, id, iconSrc, cx, cy); + + /* If that didn't get the big icon, try to get the default icon. */ + if ( ! *phBig && id != IDI_DLG_DEFAULT ) + { + id = IDI_DLG_DEFAULT; + iconSrc = ICON_OODIALOG; + *phBig = GetIconForID(dlgAdm, id, iconSrc, cx, cy); + } + + /* If still no big icon, don't bother trying for the small icon. */ + if ( *phBig ) + { + cx = GetSystemMetrics(SM_CXSMICON); + cy = GetSystemMetrics(SM_CYSMICON); + *phSmall = GetIconForID(dlgAdm, id, iconSrc, cx, cy); + + /* Very unlikely that the big icon was obtained and failed to get the + * small icon. But, if so, fail completely. If the big icon came from + * a DLL it was loaded as shared and the system handles freeing it. If + * it was loaded from a file, free it here. + */ + if ( ! *phSmall ) + { + if ( iconSrc & ICON_FILE ) + { + DestroyIcon((HICON)*phBig); + } + *phBig = NULL; + } + } + + if ( ! *phBig ) + { + return FALSE; + } + + dlgAdm->SharedIcon = iconSrc != ICON_FILE; + return TRUE; +} + + +/** + * Loads and returns the handle to an icon for the specified ID, of the + * specified size. + * + * The icons can come from the user resource DLL, a user defined dialog, the + * OODialog DLL, the System. IDs for the icons bound to the OODialog.dll are + * reserved. + * + * @param dlgAdm Pointer to the dialog administration block. + * @param id Numerical resource ID. + * @param iconSrc Flag indicating the source of the icon. + * @param cx The desired width of the icon. + * @param cy The desired height of the icon. + * + * @return The handle to the loaded icon on success, or null on failure. + */ +static HICON GetIconForID(DIALOGADMIN *dlgAdm, UINT id, UINT iconSrc, int cx, int cy) +{ + HINSTANCE hInst = NULL; + LPCTSTR pName = NULL; + UINT loadFlags = 0; + + if ( iconSrc & ICON_FILE ) + { + /* Load the icon from a file, file name should be in the icon table. */ + INT i; + + for ( i = 0; i < dlgAdm->IT_size; i++ ) + { + if ( dlgAdm->IconTab[i].iconID == id ) + { + pName = dlgAdm->IconTab[i].fileName; + break; + } + } + + if ( ! pName ) + return NULL; + + loadFlags = LR_LOADFROMFILE; + } + else if ( iconSrc & ICON_OODIALOG ) + { + /* Load the icon from the resources in oodialog.dll. */ + hInst = MyInstance; + pName = MAKEINTRESOURCE(id); + loadFlags = LR_SHARED; + } + else + { + /* Load the icon from the user's resource DLL. */ + hInst = dlgAdm->TheInstance; + pName = MAKEINTRESOURCE(id); + loadFlags = LR_SHARED; + } + + return (HICON)LoadImage(hInst, pName, IMAGE_ICON, cx, cy, loadFlags); +} + + +/** + * Used to access Win32 API functions not involved with sending window messages + * to dialogs or dialog controls. General purpose functions. + * + * The parameters sent from ooRexx as an array of RXString: + * + * argv[0] Selects general category. + * + * argv[1] Picks specific function. + * + * argv[2] ... argv[n] Varies depending on the function. + * + * Return to ooRexx, in general: + * Nothing to generalize as of yet ... + * + */ +size_t RexxEntry WinAPI32Func(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) +{ + /* There has to be at least 2 args. */ + CHECKARGL(2); + + if ( argv[0].strptr[0] == 'G' ) /* Get something */ + { + if ( !strcmp(argv[1].strptr, "WNDSTATE") ) /* get Window state */ + { + HWND hWnd; + + CHECKARGL(4); + + hWnd = GET_HWND(argv[3]); + if ( hWnd == 0 || ! IsWindow(hWnd) ) RETERR + + if ( argv[2].strptr[0] == 'E' ) /* Enabled */ + { + RETVAL((BOOL)IsWindowEnabled(hWnd)); + } + else if ( argv[2].strptr[0] == 'V' ) /* Visible */ + { + RETVAL((BOOL)IsWindowVisible(hWnd)); + } + else if ( argv[2].strptr[0] == 'Z' ) /* Zoomed is Maximized */ + { + RETVAL((BOOL)IsZoomed(hWnd)); + } + else if ( argv[2].strptr[0] == 'I' ) /* Iconic is Minimized */ + { + RETVAL((BOOL)IsIconic(hWnd)); + } + } + else if ( !strcmp(argv[1].strptr, "ID") ) /* get dialog control ID */ + { + HWND hWnd; + INT id; + + CHECKARGL(3); + + hWnd = GET_HWND(argv[2]); + if ( hWnd == 0 || ! IsWindow(hWnd) ) RETVAL(-1) + + SetLastError(0); + id = GetDlgCtrlID(hWnd); + if ( ! id ) + id = -(INT)GetLastError(); + + RETVAL(id); + } + } + else if ( argv[0].strptr[0] == 'K' ) /* work with Keyboard hook */ + { + DIALOGADMIN *dlgAdm = NULL; + HWND hDlg; + + CHECKARGL(3) + + dlgAdm = (DIALOGADMIN *)GET_POINTER(argv[2]); + if ( !dlgAdm ) RETVAL(-4) + + if ( argv[1].strptr[0] == 'Q' ) /* Query if keyboard hook is installed */ + { + if ( ! dlgAdm->hHook ) RETVAL(0) + if ( argc == 3 ) RETVAL(1) + + CHECKARGL(4) + + RETVAL(seekKeyPressMethod(dlgAdm->pKeyPressData, argv[3].strptr) ? 1 : 0) + } + else if ( argv[1].strptr[0] == 'C' ) /* Connect method to keyboard hook for this dialog */ + { + LONG ret; + + CHECKARGL(6) + + hDlg = GET_HWND(argv[3]); + if ( hDlg == 0 || ! IsWindow(hDlg) ) RETVAL(-4) + + if ( argv[4].strlength == 0 || argv[5].strlength == 0 ) RETVAL(-1) + + /* If there is no existing hook, install one and connect the method + * to it, otherwise connect the method to the existing hook. + */ + if ( ! dlgAdm->hHook ) + { + if ( argc > 6 ) + ret = installKBHook(dlgAdm, hDlg, argv[4], argv[5], argv[6].strptr); + else + ret = installKBHook(dlgAdm, hDlg, argv[4], argv[5], NULL); + } + else + { + if ( argc > 6 ) + ret = setKeyPressData(dlgAdm->pKeyPressData, argv[4], argv[5], argv[6].strptr); + else + ret = setKeyPressData(dlgAdm->pKeyPressData, argv[4], argv[5], NULL); + } + + RETVAL(ret) + } + else if ( argv[1].strptr[0] == 'R' ) /* Remove method from keyboard hook for this dialog */ + { + LONG ret = -1; + + if ( dlgAdm->hHook ) + { + /* If there is no method arg, remove the entire hook, otherwise + * disconnect the method from the hook. + */ + if ( argc == 3 ) + { + removeKBHook(dlgAdm); + ret = 0; + } + else + { + UINT index; + + CHECKARGL(5) + + hDlg = GET_HWND(argv[3]); + if ( hDlg == 0 || ! IsWindow(hDlg) ) RETVAL(-4) + + index = seekKeyPressMethod(dlgAdm->pKeyPressData, argv[4].strptr); + if ( index == 0 ) RETVAL(-1) + + /* If there is only 1 method connected to the hook, remove + * the hook completely. Otherwise, unhook the hook, fix up + * the key press data, and reset the hook. + */ + if ( dlgAdm->pKeyPressData->usedMethods == 1 ) + { + removeKBHook(dlgAdm); + ret = 0; + } + else + { + UnhookWindowsHookEx(dlgAdm->hHook); + removeKeyPressMethod(dlgAdm->pKeyPressData, index); + ret = setKBHook(dlgAdm, hDlg); + } + } + } + RETVAL(ret) + } + } + + RETERR +} + + +/** + * The keyboard hook procedure. + * + * This is a thread specific hook, not a global hook. This function executes in + * the same thread as the dialog's window procedure. The dialog admin structure + * stores the key press data, the thread ID is used to locate the correct dialog + * admin. + * + * The key is examined to see if the user has set an ooDialog method for it and + * if it is a key down event. If so, the key data is sent on to + * processKeyData() where the actual ooDialog method invocation is set up. If + * the user has also set a filter, there may be no method invocation after all. + * + */ +LRESULT CALLBACK KeyboardHookProc(int code, WPARAM wParam, LPARAM lParam) +{ + register int i; + DWORD id = GetCurrentThreadId(); + DIALOGADMIN * dlgAdm; + + /* No matter what, we need to find the dialog admin struct, it is the only + * way to get the hook handle. + */ + for ( i = 0; i < StoredDialogs; i++ ) + if ( DialogTab[i]->threadID == id ) break; + + /* If we can't find it, there is nothing to do about it. We can't call the + * next hook, so just return 0. + */ + if ( i >= StoredDialogs ) return 0; + + dlgAdm = DialogTab[i]; + + if ( (code == HC_ACTION) && dlgAdm->pKeyPressData->key[wParam] ) + { + if ( !(lParam & KEY_REALEASE) && !(lParam & KEY_WASDOWN) ) + { + processKeyPress(dlgAdm->pKeyPressData, wParam, lParam, dlgAdm->pMessageQueue); + } + } + return CallNextHookEx(dlgAdm->hHook, code, wParam, lParam); +} + + +/** + * Takes a key event that has an ooDialog method connected to it, sets up the + * method invocation message, and places it in the ooDialog message queue. + * + * It is possible for the key event to be filtered out and no ooDialog is then + * invoked. + * + * The ooDialog event method gets 5 arguments: + * key: decimal value of the key code. + * shift: true / false, true if the shift key was depressed for this event. + * control: true / false, true if control key was depressed. + * alt: true / false, ditto. + * info: Keyword string that specifies if right or left shift / control / + * alt were down and the state of the num lock, caps lock, and + * scroll lock keys. The string contains some combination of: + * + * rShift, lShift, rControl lControl, rAlt, lAlt, numOn, numOff, + * capsOn, capsOff, scrollOn, scrollOf + */ +void processKeyPress(KEYPRESSDATA *pKeyData, WPARAM wParam, LPARAM lParam, PCHAR pMessageQueue) +{ + /* Method name can not be longer than 197 chars. This is checked for in + * setKeyPressData() + */ + CHAR oodMsg[256]; + BOOL passed = TRUE; + INT i = pKeyData->key[wParam]; + PCHAR pMethod = pKeyData->pMethods[i]; + KEYFILTER *pFilter = pKeyData->pFilters[i]; + + BOOL bShift = (GetAsyncKeyState(VK_SHIFT) & ISDOWN) ? 1 : 0; + BOOL bControl = (GetAsyncKeyState(VK_CONTROL) & ISDOWN) ? 1 : 0; + BOOL bAlt = (GetAsyncKeyState(VK_MENU) & ISDOWN) ? 1 : 0; + + if ( pFilter ) + { + if ( pFilter->none ) + { + passed = !bShift && !bControl && !bAlt; + } + else if ( pFilter->and ) + { + passed = (pFilter->shift ? bShift : !bShift) && + (pFilter->control ? bControl : !bControl) && + (pFilter->alt ? bAlt : !bAlt); + } + else + { + passed = (pFilter->shift && bShift) || + (pFilter->control && bControl) || + (pFilter->alt && bAlt); + } + } + + if ( passed ) + { + CHAR info[64] = {'\0'}; + + if ( GetKeyState(VK_NUMLOCK) & KEY_TOGGLED ) + strcpy(info, "numOn"); + else + strcpy(info, "numOff"); + + if ( GetKeyState(VK_CAPITAL) & KEY_TOGGLED ) + strcat(info, " capsOn"); + else + strcat(info, " capsOff"); + + if ( bShift ) + { + if ( GetAsyncKeyState(VK_RSHIFT) & ISDOWN ) + strcat(info, " rShift"); + else + strcat(info, " lShift"); + } + if ( bControl ) + { + if ( GetAsyncKeyState(VK_RCONTROL) & ISDOWN ) + strcat(info, " rControl"); + else + strcat(info, " lControl"); + } + if ( bAlt ) + { + if ( GetAsyncKeyState(VK_RMENU) & ISDOWN ) + strcat(info, " rAlt"); + else + strcat(info, " lAlt"); + } + + if ( GetKeyState(VK_SCROLL) & KEY_TOGGLED ) + strcat(info, " scrollOn"); + else + strcat(info, " scrollOff"); + + sprintf(oodMsg, "%s(%u,%u,%u,%u,\"%s\")", pMethod, wParam, bShift, bControl, bAlt, info); + AddDialogMessage((char *)oodMsg, pMessageQueue); + } +} + + +/** + * Allocates memory for the key press structure and sets up all the data used by + * the keyboard hook procedure. Once everything is good the hook is set. + * + */ +static LONG installKBHook( + DIALOGADMIN *dlgAdm, + HWND hDlg, + CONSTRXSTRING method, + CONSTRXSTRING keys, + const char *filter ) +{ + KEYPRESSDATA *pData; + LONG ret = 0; + + if ( method.strlength == 0 || keys.strlength == 0 ) return -1; + + pData = (KEYPRESSDATA *)LocalAlloc(LPTR, sizeof(KEYPRESSDATA)); + if ( ! pData ) return -5; + + ret = setKeyPressData(pData, method, keys, filter); + if ( ret == -5 ) + { + LocalFree(pData); + return -5; + } + else + { + dlgAdm->pKeyPressData = pData; + } + + return setKBHook(dlgAdm, hDlg); +} + + +/** + * Sets the Windows keyboard hook (WH_KEYBOARD.) SetWindowsHookEx() has to run + * in the same thread as the dialog, so a user message is sent to the dialog + * window procedure to do the actual work. + * + * If the hook is not set, all the memory allocation is cleaned up. + */ +static LONG setKBHook(DIALOGADMIN *dlgAdm, HWND hDlg) +{ + LONG ret = 0; + + dlgAdm->hHook = (HHOOK)SendMessage(hDlg, WM_USER_HOOK, (WPARAM)&KeyboardHookProc, (LPARAM)0); + if ( ! dlgAdm->hHook ) + { + freeKeyPressData(dlgAdm->pKeyPressData); + dlgAdm->pKeyPressData = NULL; + ret = -2; + } + return ret; +} + + +/** + * If the hook exists, unhook. If the key press data exists, free it. + */ +static void removeKBHook(DIALOGADMIN *dlgAdm) +{ + if ( dlgAdm->hHook ) + UnhookWindowsHookEx(dlgAdm->hHook); + + freeKeyPressData(dlgAdm->pKeyPressData); + dlgAdm->hHook = 0; + dlgAdm->pKeyPressData = NULL; +} + + +/** + * Removes the method at index from the key press data structure. Assumes that + * the keyboad hook is unhooked, or that the window subclass is removed. + * + */ +void removeKeyPressMethod(KEYPRESSDATA *pData, UINT index) +{ + int i; + + if ( index >= 1 && index <= MAX_KEYPRESS_METHODS ) + { + for ( i = 0; i < COUNT_KEYPRESS_KEYS; i++) + { + if ( pData->key[i] == index ) pData->key[i] = 0; + } + + if ( pData->pMethods[index] ) LocalFree(pData->pMethods[index]); + if ( pData->pFilters[index] ) LocalFree(pData->pFilters[index]); + pData->pMethods[index] = NULL; + pData->pFilters[index] = NULL; + pData->nextFreeQ[pData->topOfQ] = index; + + /* Theoretically we can't walk off the end of the array, but make sure + * we don't. + */ + if ( pData->topOfQ <= MAX_KEYPRESS_METHODS ) pData->topOfQ++; + pData->usedMethods--; + } +} + +/** + * Frees the key press data structure. Note that methods can be removed leaving + * holes in the array. + */ +void freeKeyPressData(KEYPRESSDATA *pData) +{ + UINT i; + if ( pData ) + { + for ( i = 1; i <= MAX_KEYPRESS_METHODS; i++ ) + { + safeLocalFree((void *)pData->pMethods[i]); + safeLocalFree((void *)pData->pFilters[i]); + } + LocalFree((void *)pData); + } +} + +/** + * Searches the event method table for a matching method. Returns 0 if no match + * is found, otherwise the index into the table for the method. + * + */ +UINT seekKeyPressMethod(KEYPRESSDATA *pData, const char *method) +{ + UINT i; + UINT index = 0; + + if ( pData ) + { + for ( i = 1; i <= MAX_KEYPRESS_METHODS; i++) + { + if ( pData->pMethods[i] && !strcmp(pData->pMethods[i], method) ) + { + index = i; + break; + } + } + } + return index; +} + +/** + * Set up the key press data for the specified method. + * + * It is possible that a key press comes in to the UI thread while this function + * is executing: + * + * The key will have an already existing index or 0 while the method and filter + * are being set up. When a key slot is to be updated with the index of the new + * method, it is protected by a critical section. + * + */ +LONG setKeyPressData(KEYPRESSDATA *pData, CONSTRXSTRING method, CONSTRXSTRING keys, const char *filter) +{ + + PSZ token, str; + PCHAR pMethod; + KEYFILTER *pFilter = NULL; + UINT firstKey, lastKey, index; + LONG ret = 0; + + /* If we are out room, or a duplicate method name, return */ + if ( pData->usedMethods >= (MAX_KEYPRESS_METHODS) ) return -6; + if ( seekKeyPressMethod(pData, method.strptr) ) return -7; + + /* There has to be a limit on the length of a method name. The size of the + * message being sent to AddDialogMessage() is set at 256 (for the key press + * event.) Because of the arg string being sent to the method, this leaves + * less than that for the method name. + */ + if ( method.strlength > CCH_METHOD_NAME ) return -1; + + pMethod = (PCHAR)LocalAlloc(LPTR, method.strlength + 1); + if ( ! pMethod ) return -5; + + if ( filter ) + { + pFilter = (KEYFILTER *)LocalAlloc(LPTR, sizeof(KEYFILTER)); + if ( ! pFilter ) + { + LocalFree(pMethod); + return -5; + } + } + rxstrlcpy(pMethod, method); + + if ( pFilter ) + { + if ( strstr(filter, "NONE" ) ) + { + pFilter->none = TRUE; + } + else + { + if ( strstr(filter, "AND") ) pFilter->and = TRUE; + if ( strstr(filter, "SHIFT") ) pFilter->shift = TRUE; + if ( strstr(filter, "CONTROL") ) pFilter->control = TRUE; + if ( strstr(filter, "ALT") ) pFilter->alt = TRUE; + } + + /* Some combinations are not filters. Do not add more to the hook or + * subclass procedure than needed. + */ + if ( ((! pFilter->and) && pFilter->shift && pFilter->control && pFilter->alt) || + (pFilter->and && ! pFilter->shift && ! pFilter->control && ! pFilter->alt) ) + { + LocalFree(pFilter); + pFilter = NULL; + ret = -1; + } + } + + /* Get the index of where to put the method. If the next free queue is not + * empty, pull the index from the queue, otherwise we are still adding + * methods sequentially. + */ + if ( pData->topOfQ ) + { + index = pData->nextFreeQ[0]; + memmove(pData->nextFreeQ, pData->nextFreeQ + 1, (pData->topOfQ - 1) * sizeof(UINT)); + pData->topOfQ--; + } + else + { + index = pData->usedMethods + 1; + } + pData->pMethods[index] = pMethod; + pData->usedMethods++; + + if ( pFilter ) + { + pData->pFilters[index] = pFilter; + } + + str = _strdup(keys.strptr); + + /* If there is an error parsing a token, the return is set to -1 to + * indicate there was some error. However, the good tokens are still used. + * Thus, there may be some methods that are connected and some that are not. + */ + token = strtok(str, ","); + while( token != NULL ) + { + if ( parseKeyToken(token, &firstKey, &lastKey) ) + { + EnterCriticalSection(&crit_sec); + if ( lastKey ) + { + UINT i; + for ( i = firstKey; i <= lastKey; i++) + pData->key[i] = index; + } + else + { + pData->key[firstKey] = index; + } + LeaveCriticalSection(&crit_sec); + } + else + { + ret = -1; + } + token = strtok(NULL, ","); + } + free(str); + + return ret; +} + + +/** + * Parses a key token which could be: a keyword, a single number, or a number + * range (n-m) The results are checked to guarentee they are within bounds. + * + * Returns true on success, false on error. + * + * On true: *pFirst is guarenteed to be non-zero. If the token represents a + * single digit, *pLast is guarenteed to be zero. + * + * On false: *pFirst and *pLast are undefined. + */ +static BOOL parseKeyToken(PCHAR token, PUINT pFirst, PUINT pLast) +{ + PCHAR p; + BOOL ret = TRUE; + + *pFirst = 0; + *pLast = 0; + + if ( !strcmp(token, "ALL") ) + { + *pFirst = VK_LBUTTON; + *pLast = VK_OEM_CLEAR; + } + else if ( !strcmp(token, "FKEYS") ) + { + *pFirst = VK_F2; /* F1 is handled by connectHelp in ooDialog */ + *pLast = VK_F24; + } + else if ( !strcmp(token, "ALPHA") ) + { + *pFirst = VK_A; + *pLast = VK_Z; + } + else if ( !strcmp(token, "NUMERIC") ) + { + *pFirst = VK_0; + *pLast = VK_9; + } + else if ( !strcmp(token, "ALPHANUMERIC") ) + { + *pFirst = VK_0; + *pLast = VK_Z; + } + else if ( (p = strchr(token, '-')) != NULL ) + { + *p++ = '\0'; + *pFirst = atol(token); + *pLast = atol(p); + if ( (! *pFirst || ! *pLast) || (*pFirst > *pLast) || + (*pFirst < VK_LBUTTON) || (*pFirst > VK_OEM_CLEAR) || + (*pLast < VK_LBUTTON) || (*pLast > VK_OEM_CLEAR)) ret = FALSE; + } + else + { + *pFirst = atol(token); + *pLast = 0; + if ( ! *pFirst || (*pFirst < VK_LBUTTON) || (*pFirst > VK_OEM_CLEAR) ) ret = FALSE; + } + return ret; +} + +/* TODO this code is dead and looks like it has been since the initial code drop + * from IBM + */ +#if 0 +LONG InternalStopDialog(HWND h) +{ + ULONG i, ret; + DIALOGADMIN * dadm = NULL; + MSG msg; + HANDLE hTh; + + if (!h) dadm = topDlg; + else SEEK_DLGADM_TABLE(h, dadm); + + if (dadm) + { + DWORD ec; + hTh = dadm->TheThread; + if (!dadm->LeaveDialog) dadm->LeaveDialog = 3; /* signal to exit */ + PostMessage(dadm->TheDlg, WM_QUIT, 0, 0); /* to exit GetMessage */ + DestroyWindow(dadm->TheDlg); /* to remove system resources */ + if (dadm->TheThread) GetExitCodeThread(dadm->TheThread, &ec); + i = 0; while (dadm && (ec == STILL_ACTIVE) && dadm->TheThread && (i < 1000)) /* wait for window thread of old dialog to terminate */ + { + if (PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { + DispatchMessage(&msg); + } + Sleep(1); i++; + GetExitCodeThread(dadm->TheThread, &ec); + } + + if (dadm->TheThread && (ec == STILL_ACTIVE)) + { + TerminateThread(dadm->TheThread, -1); + ret = 1; + } else ret = 0; + if (hTh) CloseHandle(hTh); + if (dadm == topDlg) topDlg = NULL; + + /* The message queue and the admin block are freed in HandleDialogAdmin called from HandleMessages */ + + return ret; + } + return -1; +} + +_declspec(dllexport) LONG __cdecl OODialogCleanup(BOOL Process) +{ + if (Process) + { + INT i; + for (i = MAXDIALOGS; i>0; i--) + { + if (DialogTab[i-1]) InternalStopDialog(DialogTab[i-1]->TheDlg); + DialogTab[i-1] = NULL; + } + StoredDialogs = 0; + } + return (StoredDialogs); +} +#endif + +size_t RexxEntry HandleDlg(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) +{ + DEF_ADM; + + CHECKARGL(1); + + if (!strcmp(argv[0].strptr, "ACTIVE")) /* see if the dialog is still in the dialog management table */ + { + CHECKARG(2); + SEEK_DLGADM_TABLE(GET_HWND(argv[1]), dlgAdm); + + if (dlgAdm) /* it's alive */ + { + RETC(1); + } + else + { + RETC(0); + } + } + else if (!strcmp(argv[0].strptr, "HNDL")) /* Get the dialog handle */ + { + if (argc==2) + { + dlgAdm = (DIALOGADMIN*)GET_POINTER(argv[1]); + if (!dlgAdm) + { + RETERR; + } + RETHANDLE(dlgAdm->TheDlg); + } + else + { + if (topDlg && topDlg->TheDlg) + { + RETHANDLE(topDlg->TheDlg); + } + else + { + RETC(0); + } + } + } + else if (!strcmp(argv[0].strptr, "ITEM")) /* Get the handle to a dialog item */ + { + HWND hW, hD; + + CHECKARGL(2); + + if (argc > 2) + { + hD = GET_HWND(argv[2]); + } + else + { + hD = topDlg->TheDlg; + } + + hW = GetDlgItem(hD, atoi(argv[1].strptr)); + + if (hW == NULL) + { + RETC(0); + } + else + { + RETHANDLE(hW); + } + } + else if (!strcmp(argv[0].strptr, "STOP")) /* Stop a dialog */ + { + HWND h = NULL; + + if (argc>1) + { + h= GET_HWND(argv[1]); + } + + if (h) + { + SEEK_DLGADM_TABLE(h, dlgAdm); + if (dlgAdm) + { + RETVAL(DelDialog(dlgAdm)); + } + else + { + RETVAL(-1); + } + } + else if (!h && topDlg) + { + RETVAL(DelDialog(topDlg)); /* remove the top most */ + } + else + { + RETVAL(-1); + } + } + RETC(0); +} + + +/* dump out the dialog admin table(s) */ + +LONG SetRexxStem(const char * name, INT id, const char * secname, const char * data) +{ + SHVBLOCK shvb; + CHAR buffer[72]; + + if (id == -1) + { + sprintf(buffer,"%s.%s",name,secname); + } + else + { + if (secname) sprintf(buffer,"%s.%d.%s",name,id, secname); + else sprintf(buffer,"%s.%d",name,id); + } + shvb.shvnext = NULL; + shvb.shvname.strptr = buffer; + shvb.shvname.strlength = strlen(buffer); + shvb.shvnamelen = shvb.shvname.strlength; + shvb.shvvalue.strptr = const_cast<char *>(data); + shvb.shvvalue.strlength = strlen(data); + shvb.shvvaluelen = strlen(data); + shvb.shvcode = RXSHV_SYSET; + shvb.shvret = 0; + if (RexxVariablePool(&shvb) == RXSHV_BADN) { + char messageBuffer[265]; + sprintf(messageBuffer, "Variable %s could not be declared", buffer); + MessageBox(0,messageBuffer,"Error",MB_OK | MB_ICONHAND); + return FALSE; + } + return TRUE; +} + + +size_t RexxEntry DumpAdmin(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) +{ + CHAR data[256]; + /* SHVBLOCK shvb; */ + CHAR name[64]; + CHAR buffer[128]; + DEF_ADM; + INT i, cnt = 0; + + CHECKARGL(1); + + strcpy(name, argv[0].strptr); /* stem name */ + if (argc == 2) + { + dlgAdm = (DIALOGADMIN *)GET_POINTER(argv[1]); + if (!dlgAdm) RETVAL(-1) + + strcpy(name, argv[0].strptr); /* stem name */ + itoa(dlgAdm->TableEntry, data, 10); + if (!SetRexxStem(name, -1, "Slot", data)) { RETERR; } + pointer2string(data, dlgAdm->TheThread); + if (!SetRexxStem(name, -1, "hThread", data)) { RETERR; } + pointer2string(data, dlgAdm->TheDlg); + if (!SetRexxStem(name, -1, "hDialog", data)) { RETERR; } + pointer2string(data, dlgAdm->BkgBrush); + if (!SetRexxStem(name, -1, "BkgBrush", data)) { RETERR; } + pointer2string(data, dlgAdm->BkgBitmap); + if (!SetRexxStem(name, -1, "BkgBitmap", data)) { RETERR; } + itoa(dlgAdm->OnTheTop, data, 10); + if (!SetRexxStem(name, -1, "TopMost", data)) { RETERR; } + pointer2string(data, dlgAdm->AktChild); + if (!SetRexxStem(name, -1, "CurrentChild", data)) { RETERR; } + pointer2string(data, dlgAdm->TheInstance); + if (!SetRexxStem(name, -1, "DLL", data)) { RETERR; } + if (!SetRexxStem(name, -1, "Queue", dlgAdm->pMessageQueue)) { RETERR; } + itoa(dlgAdm->BT_size, data, 10); + if (!SetRexxStem(name, -1, "BmpButtons", data)) { RETERR; } + sprintf(buffer, "%s.%s", argv[0].strptr, "BmpTab"); + for (i=0... [truncated message content] |
From: <mie...@us...> - 2009-06-22 03:13:03
|
Revision: 4827 http://oorexx.svn.sourceforge.net/oorexx/?rev=4827&view=rev Author: miesfeld Date: 2009-06-22 03:13:00 +0000 (Mon, 22 Jun 2009) Log Message: ----------- Fixes places where 'connect message' was forcing WPARAM and LPARAM arguments to ULONG, which is incorrect on 64-bit. Continue refactoring code for move to the new native API. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp main/trunk/extensions/platform/windows/oodialog/ooDialog.h main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp main/trunk/extensions/platform/windows/oodialog/oodCommon.h main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp main/trunk/extensions/platform/windows/oodialog/oodialog.mak main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp main/trunk/extensions/platform/windows/oodialog/oovother.cpp main/trunk/extensions/platform/windows/oodialog/plbdlg.cls Modified: main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp 2009-06-22 03:01:38 UTC (rev 4826) +++ main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp 2009-06-22 03:13:00 UTC (rev 4827) @@ -41,6 +41,7 @@ #include <commctrl.h> #include <stdio.h> #include <dlgs.h> +#include "APICommon.h" #include "oodCommon.h" #include "oodSymbols.h" @@ -872,6 +873,199 @@ /** + * Methods for the .PlainBaseDialog class. + */ +#define PLAINBASEDIALOG_CLASS "PlainBaseDialog" + +RexxMethod0(RexxObjectPtr, pbdlg_init_cls) +{ + context->SetObjectVariable("FONTNAME", context->String(DEFAULT_FONTNAME)); + context->SetObjectVariable("FONTSIZE", context->WholeNumber(DEFAULT_FONTSIZE)); + return NULLOBJECT; +} + +RexxMethod2(RexxObjectPtr, pbdlg_setDefaultFont_cls, CSTRING, fontName, uint32_t, fontSize) +{ + context->SetObjectVariable("FONTNAME", context->String(fontName)); + context->SetObjectVariable("FONTSIZE", context->WholeNumber(fontSize)); + return NULLOBJECT; +} + +RexxMethod0(RexxObjectPtr, pbdlg_getFontName_cls) +{ + return context->GetObjectVariable("FONTNAME"); +} +RexxMethod0(RexxObjectPtr, pbdlg_getFontSize_cls) +{ + return context->GetObjectVariable("FONTSIZE"); +} + + +bool convert2PointerSize(RexxMethodContext *c, RexxObjectPtr obj, uint64_t *number, int argPos) +{ + if ( obj == NULLOBJECT ) + { + *number = 0; + return true; + } + + if ( c->IsPointer(obj) ) + { + *number = (uint64_t)c->PointerValue((RexxPointerObject)obj); + return true; + } + + return rxStr2Number(c, c->ObjectToStringValue(obj), number, argPos); +} + +/** PlainBaseDialog::addUserMessage() + * + * Adds a message to the message table. This method is what implements the + * connection of a Windows event to a dialog method. + * + * + * @note In the past this method returned 0 for okay and 1 for error, even + * though the underlying implementation, AddTheMessage() returned true / + * false for success / failure. Although the return was never + * documented. So, I guess maintain the original return code, although + * true / false make more sense. + */ +RexxMethod9(logical_t, pbdlg_addUserMessage, CSTRING, methodName, CSTRING, _winMessage, OPTIONAL_CSTRING, _wmFilter, + OPTIONAL_RexxObjectPtr, wp, OPTIONAL_CSTRING, _wpFilter, OPTIONAL_RexxObjectPtr, lp, OPTIONAL_CSTRING, _lpFilter, + OPTIONAL_uint32_t, tag, OSELF, self) +{ + RexxMethodContext *c = context; + logical_t result = 1; + + DIALOGADMIN *dlgAdm = rxGetDlgAdm(context, self); + if ( dlgAdm == NULL ) + { + goto done_out; + } + if ( *methodName == '\0' ) + { + goto done_out; + } + + uint64_t number; + + UINT winMessage; + UINT wmFilter; + if ( ! rxStr2Number(context, _winMessage, &number, 2) ) + { + goto done_out; + } + winMessage = (UINT)number; + + if ( argumentOmitted(3) ) + { + wmFilter = 0xFFFFFFFF; + } + else + { + if ( ! rxStr2Number(context, _wmFilter, &number, 3) ) + { + goto done_out; + } + wmFilter = (UINT)number; + } + + WPARAM wParam; + ULONG_PTR wpFilter; + + if ( ! convert2PointerSize(context, wp, &number, 4) ) + { + goto done_out; + } + wParam = (WPARAM)number; + + if ( argumentOmitted(5) ) + { + wpFilter = 0; + } + else + { + if ( ! rxStr2Number(context, _wpFilter, &number, 5) ) + { + goto done_out; + } + wpFilter = (number == 0xFFFFFFFF ? (ULONG_PTR)SIZE_MAX : (ULONG_PTR)number); + } + + LPARAM lParam; + ULONG_PTR lpFilter; + + if ( ! convert2PointerSize(context, lp, &number, 6) ) + { + goto done_out; + } + lParam = (WPARAM)number; + + if ( argumentOmitted(7) ) + { + lpFilter = 0; + } + else + { + if ( ! rxStr2Number(context, _lpFilter, &number, 8) ) + { + goto done_out; + } + lpFilter = (number == 0xFFFFFFFF ? (ULONG_PTR)SIZE_MAX : (ULONG_PTR)number); + } + + result = ! AddTheMessage(dlgAdm, winMessage, wmFilter, wParam, wpFilter, lParam, lpFilter, methodName, tag); + +done_out: + return result; +} + +/** PlainBaseDialog::getTextSizeDlg() + * + * Gets the size (width and height) in dialog units for any given string, for + * the font specified. + * + * @param text The string whose size is needed. + * + * @param fontName Optional. If specified, use this font to calculate the + * size. + * + * @param fontSize Optional. If specified, use this font size with + * fontName to calculate the size. The default if omitted + * is 8. This arg is ignored if fontName is omitted. + * + * @param hwndFontSrc Optional. Use this window's font to calculate the size. + * This arg is always ignored if fontName is specified. + * + */ +RexxMethod5(RexxObjectPtr, pbdlg_getTextSizeDlg, CSTRING, text, OPTIONAL_CSTRING, fontName, + OPTIONAL_uint32_t, fontSize, OPTIONAL_POINTERSTRING, hwndFontSrc, OSELF, self) +{ + HWND hwndSrc = NULL; + if ( argumentExists(2) ) + { + if ( argumentOmitted(3) ) + { + fontSize = DEFAULT_FONTSIZE; + } + } + else if ( argumentExists(4) ) + { + if ( hwndFontSrc == NULL ) + { + nullObjectException(context, "window handle", 4); + goto error_out; + } + hwndSrc = (HWND)hwndFontSrc; + } + return getTextSize(context, text, fontName, fontSize, hwndSrc, self); + +error_out: + return NULLOBJECT; +} + + +/** * Used to access Win32 API functions not involved with sending window messages * to dialogs or dialog controls. General purpose functions. * Modified: main/trunk/extensions/platform/windows/oodialog/ooDialog.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/ooDialog.h 2009-06-22 03:01:38 UTC (rev 4826) +++ main/trunk/extensions/platform/windows/oodialog/ooDialog.h 2009-06-22 03:13:00 UTC (rev 4827) @@ -306,14 +306,14 @@ /* structures to manage the dialogs */ typedef struct { - WPARAM wParam; - LPARAM lParam; - ULONG msg; - ULONG filterM; - ULONG filterP; - ULONG filterL; - ULONG tag; - PCHAR rexxProgram; + WPARAM wParam; + LPARAM lParam; + UINT msg; + UINT filterM; + ULONG_PTR filterP; + ULONG_PTR filterL; + ULONG tag; + PCHAR rexxProgram; } MESSAGETABLEENTRY; typedef struct { Modified: main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp 2009-06-22 03:01:38 UTC (rev 4826) +++ main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp 2009-06-22 03:13:00 UTC (rev 4827) @@ -570,6 +570,18 @@ } +RexxObjectPtr rxNewPoint(RexxMethodContext *c, long x, long y) +{ + RexxObjectPtr point = NULL; + RexxClassObject PointClass = rxGetContextClass(c, "POINT"); + if ( PointClass != NULL ) + { + point = c->SendMessage2(PointClass, "NEW", c->WholeNumber(x), c->WholeNumber(y)); + } + return point; +} + + PRECT rxGetRect(RexxMethodContext *context, RexxObjectPtr r, int argPos) { if ( requiredClass(context, r, "Rect", argPos) ) @@ -580,6 +592,47 @@ } +RexxObjectPtr rxNewRect(RexxMethodContext *context, long l, long t, long r, long b) +{ + RexxObjectPtr rect = NULL; + + RexxClassObject RectClass = rxGetContextClass(context, "RECT"); + if ( RectClass != NULL ) + { + RexxArrayObject args = context->NewArray(4); + context->ArrayAppend(args, context->WholeNumber(l)); + context->ArrayAppend(args, context->WholeNumber(t)); + context->ArrayAppend(args, context->WholeNumber(r)); + context->ArrayAppend(args, context->WholeNumber(b)); + + rect = context->SendMessage(RectClass, "NEW", args); + } + return rect; +} + + +PSIZE rxGetSize(RexxMethodContext *context, RexxObjectPtr s, int argPos) +{ + if ( requiredClass(context, s, "Size", argPos) ) + { + return (PSIZE)context->ObjectToCSelf(s); + } + return NULL; +} + + +RexxObjectPtr rxNewSize(RexxMethodContext *c, long cx, long cy) +{ + RexxObjectPtr size = NULL; + RexxClassObject SizeClass = rxGetContextClass(c, "SIZE"); + if ( SizeClass != NULL ) + { + size = c->SendMessage2(SizeClass, "NEW", c->WholeNumber(cx), c->WholeNumber(cy)); + } + return size; +} + + // TODO move to APICommon when ooDialog is converted to use .Pointer instead of // pointer strings. // @@ -601,3 +654,291 @@ return string2pointer(value); } + +static HFONT createFontFromName(HDC hdc, CSTRING name, uint32_t size) +{ + LOGFONT lf={0}; + + strcpy(lf.lfFaceName, name); + lf.lfHeight = -MulDiv(size, GetDeviceCaps(hdc, LOGPIXELSY), 72); + return CreateFontIndirect(&lf); +} + +/** + * Correctly converts from a device coordinate (pixel) to a dialog unit + * coordinate, for any dialog. + * + * MapDialogRect() correctly converts from dialog units to pixels for any + * dialog. But, there is no conversion the other way, from pixels to dialog + * units. + * + * MSDN gives these formulas to convert from pixel to dialog unit: + * + * templateunitX = MulDiv(pixelX, 4, baseUnitX); + * templateunitY = MulDiv(pixelY, 8, baseUnitY); + * + * Now, you just need to get the correct dialog base unit. + * + * GetDialogBaseUnits() always assumes the font is the system font. If the + * dialog uses any other font, the base units returned will be incorrect. + * + * MSDN, again, has two methods for calculating the correct base units for any + * font. This way is the simplest, but it requires the window handle to the + * dialog. + * + * Rect rect( 0, 0, 4, 8 ); + * MapDialogRect( &rc ); + * int baseUnitY = rc.bottom; + * int baseUnitX = rc.right; + * + * @param hwnd Window handle of the dialog. If this is not a dialog window + * handle, this method will fail. + * + * @param point Pointer to a POINT struct. Not that a SIZE struct and a POINT + * struct are binary equivalents. They both have two fields, each + * of which is a long. Only the field names differ, cx and cy for + * a SIZE and x and y for a POINT. Therefore you can cast a + * SIZE pointer to a POINT pointer. + * + * @return true on success, false otherwise. + * + * Dialog class: #32770 + */ +static bool screenToDlgUnit(HWND hwnd, POINT *point) +{ + RECT r = {0, 0, 4, 8}; + + if ( MapDialogRect(hwnd, &r) ) + { + point->x = MulDiv(point->x, 4, r.right); + point->y = MulDiv(point->y, 8, r.bottom); + return true; + } + return false; +} + +/** + * Given a device context with the correct font already selected into it, + * correctly converts from a device coordinate (pixel) to a dialog unit + * coordinate. The correct font means, the font actually used by the dialog. + * + * See screenToDlgUnit(HWND, POINT *) for a discussion of this + * conversion. + * + * @param hdc Handle to a device context with the dialog's font selected into + * it. + * + * @param point Pointer to a POINT struct. Not that a SIZE struct and a POINT + * struct are binary equivalents. They both have two fields, each + * of which is a long. Only the field names differ, cx and cy for + * a SIZE and x and y for a POINT. Therefore you can cast a + * SIZE pointer to a POINT pointer. + * + * @return true on success, false otherwise. + * + */ +static void screenToDlgUnit(HDC hdc, POINT *point) +{ + TEXTMETRIC tm; + SIZE size; + GetTextMetrics(hdc, &tm); + int baseUnitY = tm.tmHeight; + + GetTextExtentPoint32(hdc, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 52, &size); + int baseUnitX = (size.cx / 26 + 1) / 2; + + point->x = MulDiv(point->x, 4, baseUnitX); + point->y = MulDiv(point->y, 8, baseUnitY); +} + +/** + * Uses GetTextExtentPoint32() to get the size needed for a string using the + * specified font and device context. + * + * @param font The font being used for the string. + * @param hdc The device context to use. + * @param text The string. + * @param size Pointer to a SIZE struct used to return the size. + * + * @return True if GetTextExtentPoint32() succeeds, otherwise false. + * + * @note GetTextExtentPoint32() sets last error and SelectObject() does not. + * Therefore if this function fails, GetLastError() will return the + * correct error code for the failed GetTextExtentPoint32(). + */ +bool getTextExtent(HFONT font, HDC hdc, CSTRING text, SIZE *size) +{ + bool success = true; + HFONT hOldFont = (HFONT)SelectObject(hdc, font); + + if ( GetTextExtentPoint32(hdc, text, (int)strlen(text), size) == 0 ) + { + success = false; + } + SelectObject(hdc, hOldFont); + return success; +} + +bool textSizeIndirect(RexxMethodContext *context, CSTRING text, CSTRING fontName, uint32_t fontSize, + SIZE *size, HWND hwnd) +{ + bool success = true; + + // If hwnd is null, GetDC() returns a device context for the whole screen, + // and that suites our purpose here. + HDC hdc = GetDC(hwnd); + if ( hdc == NULL ) + { + systemServiceExceptionCode(context, API_FAILED_MSG, "GetDC"); + return false; + } + + HFONT font = createFontFromName(hdc, fontName, fontSize); + if ( font == NULL ) + { + systemServiceExceptionCode(context, API_FAILED_MSG, "CreateFontIndirect"); + ReleaseDC(hwnd, hdc); + return false; + } + + if ( ! getTextExtent(font, hdc, text, size) ) + { + systemServiceExceptionCode(context, API_FAILED_MSG, "GetTextExtentPoint32"); + success = false; + } + + DeleteObject(font); + if ( ReleaseDC(hwnd, hdc) == 0 ) + { + printf("RelaseDC() failed\n"); + } + + return success; +} + +bool textSizeFromWindow(RexxMethodContext *context, CSTRING text, SIZE *size, HWND hwnd) +{ + HDC hdc = GetDC(hwnd); + if ( hdc == NULL ) + { + systemServiceExceptionCode(context, API_FAILED_MSG, "GetDC"); + return false; + } + + // Dialogs and controls need to have been issued a WM_SETFONT or else they + // return null here. If null, they are using the stock system font. + HFONT font = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); + if ( font == NULL ) + { + font = (HFONT)GetStockObject(SYSTEM_FONT); + } + + bool success = true; + if ( ! getTextExtent(font, hdc, text, size) ) + { + systemServiceExceptionCode(context, API_FAILED_MSG, "GetTextExtentPoint32"); + success = false; + } + + ReleaseDC(hwnd, hdc); + return success; +} + + +RexxObjectPtr getTextSize(RexxMethodContext *context, CSTRING text, CSTRING fontName, uint32_t fontSize, + HWND hwndFontSrc, RexxObjectPtr dlgObj) +{ + // hwndDlg can be null if this is happening before the real dialog is created. + HWND hwndDlg = rxGetWindowHandle(context, dlgObj); + + // We may not have a window handle, but using null is okay. + HWND hwndForDC = (hwndFontSrc != NULL ? hwndFontSrc : hwndDlg); + + SIZE textSize = {0}; + + if ( fontName != NULL ) + { + if ( ! textSizeIndirect(context, text, fontName, fontSize, &textSize, hwndForDC) ) + { + goto error_out; + } + } + else if ( hwndFontSrc != NULL ) + { + if ( ! textSizeFromWindow(context, text, &textSize, hwndFontSrc) ) + { + goto error_out; + } + } + + // Even if we use a font other than the dialog font to calculate the text + // size, we always have to get the dialog font and select it into a HDC to + // correctly calculate the dialog units. + HDC hdc = GetDC(hwndForDC); + if ( hdc == NULL ) + { + systemServiceExceptionCode(context, API_FAILED_MSG, "GetDC"); + goto error_out; + } + + HFONT dlgFont = NULL; + bool createdFont = false; + + if ( hwndDlg == NULL ) + { + fontSize = 0; + fontName = rxGetStringAttribute(context, dlgObj, "FONTNAME"); + + RexxObjectPtr rxSize = context->SendMessage0(dlgObj, "FONTSIZE"); + if ( rxSize != NULLOBJECT ) + { + context->ObjectToUnsignedInt32(rxSize, &fontSize); + } + + if ( fontName != NULL && fontSize != 0 ) + { + dlgFont = createFontFromName(hdc, fontName, fontSize); + if ( dlgFont != NULL ) + { + createdFont = true; + } + } + } + else + { + dlgFont = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0); + } + + // If dlgFont is null, then, (almost for sure,) the dialog will be using the + // default system font. The exception to this is if the user calls the + // getTextSizeDlg() method before the create() method, and then defines a + // custom font in create(). The docs tell the user not to do that, but + // there is nothing to do about it if they do. + if ( dlgFont == NULL ) + { + dlgFont = (HFONT)GetStockObject(SYSTEM_FONT); + } + + HFONT hOldFont = (HFONT)SelectObject(hdc, dlgFont); + if ( textSize.cx == 0 ) + { + GetTextExtentPoint32(hdc, text, (int)strlen(text), &textSize); + } + + screenToDlgUnit(hdc, (POINT *)&textSize); + + SelectObject(hdc, hOldFont); + ReleaseDC(hwndForDC, hdc); + + if ( createdFont ) + { + DeleteObject(dlgFont); + } + + return rxNewSize(context, textSize.cx, textSize.cy); + +error_out: + return NULLOBJECT; +} + + Modified: main/trunk/extensions/platform/windows/oodialog/oodCommon.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodCommon.h 2009-06-22 03:01:38 UTC (rev 4826) +++ main/trunk/extensions/platform/windows/oodialog/oodCommon.h 2009-06-22 03:13:00 UTC (rev 4827) @@ -40,7 +40,10 @@ #define oodCommon_Included +#define DEFAULT_FONTNAME "MS Shell Dlg" +#define DEFAULT_FONTSIZE 8 + #define OOD_ID_EXCEPTION 0xFFFFFFF7 // -9 // Enum for the type of an ooDialog class. Types to be added as needed. @@ -71,22 +74,34 @@ extern DIALOGADMIN *rxGetDlgAdm(RexxMethodContext *, RexxObjectPtr); extern LPWORD lpwAlign(LPWORD lpIn); -extern BOOL AddTheMessage(DIALOGADMIN *, ULONG, ULONG, ULONG, ULONG, ULONG, ULONG, CSTRING, ULONG); +extern BOOL AddTheMessage(DIALOGADMIN *, UINT, UINT, WPARAM, ULONG_PTR, LPARAM, ULONG_PTR, CSTRING, ULONG); extern void ooDialogInternalException(RexxMethodContext *, char *, int, char *, char *); extern oodClass_t oodClass(RexxMethodContext *, RexxObjectPtr, oodClass_t *, size_t); extern uint32_t oodResolveSymbolicID(RexxMethodContext *, RexxObjectPtr, RexxObjectPtr, int, int); extern bool oodSafeResolveID(uint32_t *, RexxMethodContext *, RexxObjectPtr, RexxObjectPtr, int, int); + extern DWORD oodGetSysErrCode(RexxMethodContext *); -extern void oodSetSysErrCode(RexxMethodContext *, DWORD); -extern void oodResetSysErrCode(RexxMethodContext *context); -extern PPOINT rxGetPoint(RexxMethodContext *context, RexxObjectPtr p, int argPos); -extern PRECT rxGetRect(RexxMethodContext *context, RexxObjectPtr r, int argPos); +extern void oodSetSysErrCode(RexxMethodContext *, DWORD); +extern void oodResetSysErrCode(RexxMethodContext *context); +extern PPOINT rxGetPoint(RexxMethodContext *context, RexxObjectPtr p, int argPos); +extern RexxObjectPtr rxNewPoint(RexxMethodContext *c, long x, long y); +extern PRECT rxGetRect(RexxMethodContext *context, RexxObjectPtr r, int argPos); +extern RexxObjectPtr rxNewRect(RexxMethodContext *context, long l, long t, long r, long b); +extern PSIZE rxGetSize(RexxMethodContext *context, RexxObjectPtr s, int argPos); +extern RexxObjectPtr rxNewSize(RexxMethodContext *c, long cx, long cy); + // TODO move to APICommon when ooDialog is converted to use .Pointer instead of // pointer strings. extern POINTER rxGetPointerAttribute(RexxMethodContext *context, RexxObjectPtr obj, CSTRING name); +extern RexxObjectPtr getTextSize(RexxMethodContext *, CSTRING, CSTRING, uint32_t, HWND, RexxObjectPtr); +extern bool textSizeIndirect(RexxMethodContext *, CSTRING, CSTRING, uint32_t, SIZE *, HWND); +extern bool textSizeFromWindow(RexxMethodContext *, CSTRING, SIZE *, HWND); +extern bool getTextExtent(HFONT, HDC, CSTRING, SIZE *); + + #define GET_HANDLE(p) string2pointer(p) #define GET_HWND(p) ((HWND)string2pointer(p)) #define GET_POINTER(p) string2pointer(p) Modified: main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp 2009-06-22 03:01:38 UTC (rev 4826) +++ main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp 2009-06-22 03:13:00 UTC (rev 4827) @@ -154,9 +154,9 @@ return 0; } - // msg wParam lParam method - // WM_COMMAND filter wParam filter lParam filter name tag - return AddTheMessage(dlgAdm, 0x00000111, 0xFFFFFFFF, id, 0x0000FFFF, 0, 0, msg, 0) ? 0 : ERROR_NOT_ENOUGH_MEMORY; + // Window msg wParam lParam method + // Message filter wParam filter lParam filter name tag + return AddTheMessage(dlgAdm, WM_COMMAND, UINT32_MAX, id, 0x0000FFFF, 0, 0, msg, 0) ? 0 : ERROR_NOT_ENOUGH_MEMORY; } /* Same as above but connects a System Menu item */ @@ -175,7 +175,7 @@ // Window msg wParam lParam method // Message filter wParam filter lParam filter name tag - return AddTheMessage(dlgAdm, WM_SYSCOMMAND, 0xFFFFFFFF, id, 0x0000FFF0, 0, 0, msg, tag) ? 0 : ERROR_NOT_ENOUGH_MEMORY; + return AddTheMessage(dlgAdm, WM_SYSCOMMAND, UINT32_MAX, id, 0x0000FFF0, 0, 0, msg, tag) ? 0 : ERROR_NOT_ENOUGH_MEMORY; } CSTRING CppMenu::name() @@ -1425,24 +1425,28 @@ { tag |= TAG_CONTEXTMENU; if ( hwndFilter != NULL ) - { // TODO TODO this has to be fixed. - success = AddTheMessage(dialogAdm, WM_CONTEXTMENU, 0xFFFFFFFF, (ULONG)hwndFilter, 0xFFFFFFFF, 0, 0, methodName, tag); + { + success = AddTheMessage(dialogAdm, WM_CONTEXTMENU, UINT32_MAX, (WPARAM)hwndFilter, UINTPTR_MAX, + 0, 0, methodName, tag); } else { - success = AddTheMessage(dialogAdm, WM_CONTEXTMENU, 0xFFFFFFFF, 0, 0, 0, 0, methodName, tag); + success = AddTheMessage(dialogAdm, WM_CONTEXTMENU, UINT32_MAX, 0, 0, + 0, 0, methodName, tag); } } break; case WM_INITMENU : tag |= TAG_MENUMESSAGE; - success = AddTheMessage(dialogAdm, WM_INITMENU, 0xFFFFFFFF, (ULONG)hMenu, 0xFFFFFFFF, 0, 0, methodName, tag); + success = AddTheMessage(dialogAdm, WM_INITMENU, UINT32_MAX, (WPARAM)hMenu, UINTPTR_MAX, + 0, 0, methodName, tag); break; case WM_INITMENUPOPUP : tag |= TAG_MENUMESSAGE; - success = AddTheMessage(dialogAdm, WM_INITMENUPOPUP, 0xFFFFFFFF, (ULONG)hMenu, 0xFFFFFFFF, 0, 0, methodName, tag); + success = AddTheMessage(dialogAdm, WM_INITMENUPOPUP, UINT32_MAX, (WPARAM)hMenu, UINTPTR_MAX, + 0, 0, methodName, tag); break; default : Modified: main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp 2009-06-22 03:01:38 UTC (rev 4826) +++ main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp 2009-06-22 03:13:00 UTC (rev 4827) @@ -89,7 +89,6 @@ REXX_CLASSIC_ROUTINE_PROTOTYPE(GetDlgMsg); REXX_CLASSIC_ROUTINE_PROTOTYPE(SendWinMsg); REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDlg); -REXX_CLASSIC_ROUTINE_PROTOTYPE(AddUserMessage); REXX_CLASSIC_ROUTINE_PROTOTYPE(GetFileNameWindow); REXX_CLASSIC_ROUTINE_PROTOTYPE(DataTable); REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDialogAdmin); @@ -142,7 +141,6 @@ REXX_CLASSIC_ROUTINE(GetDlgMsg, GetDlgMsg), REXX_CLASSIC_ROUTINE(SendWinMsg, SendWinMsg), REXX_CLASSIC_ROUTINE(HandleDlg, HandleDlg), - REXX_CLASSIC_ROUTINE(AddUserMessage, AddUserMessage), REXX_CLASSIC_ROUTINE(GetFileNameWindow, GetFileNameWindow), REXX_CLASSIC_ROUTINE(DataTable, DataTable), REXX_CLASSIC_ROUTINE(HandleDialogAdmin, HandleDialogAdmin), @@ -212,6 +210,7 @@ REXX_METHOD_PROTOTYPE(pbdlg_getFontName_cls); REXX_METHOD_PROTOTYPE(pbdlg_getFontSize_cls); REXX_METHOD_PROTOTYPE(pbdlg_getTextSizeDlg); +REXX_METHOD_PROTOTYPE(pbdlg_addUserMessage); REXX_METHOD_PROTOTYPE(resdlg_setFontAttrib_pvt); @@ -456,6 +455,7 @@ REXX_METHOD(pbdlg_setDefaultFont_cls, pbdlg_setDefaultFont_cls), REXX_METHOD(pbdlg_getFontName_cls, pbdlg_getFontName_cls), REXX_METHOD(pbdlg_getFontSize_cls, pbdlg_getFontSize_cls), + REXX_METHOD(pbdlg_addUserMessage, pbdlg_addUserMessage), REXX_METHOD(pbdlg_getTextSizeDlg, pbdlg_getTextSizeDlg), REXX_METHOD(resdlg_setFontAttrib_pvt, resdlg_setFontAttrib_pvt), Modified: main/trunk/extensions/platform/windows/oodialog/oodialog.mak =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodialog.mak 2009-06-22 03:01:38 UTC (rev 4826) +++ main/trunk/extensions/platform/windows/oodialog/oodialog.mak 2009-06-22 03:13:00 UTC (rev 4827) @@ -59,6 +59,10 @@ $(OR_OUTDIR)\oovmsg.obj $(OR_OUTDIR)\oovother.obj $(OR_OUTDIR)\oovscrll.obj $(OR_OUTDIR)\oovtext.obj \ $(OR_OUTDIR)\oovuser.obj $(OR_OUTDIR)\ooDialog.obj +# All Source files that include APICommon.h +COMMON_SOURCEF = $(OR_OUTDIR)\APICommon.obj $(OR_OUTDIR)\oodCommon.obj $(OR_OUTDIR)\oodMenu.obj $(OR_OUTDIR)\oovother.obj \ + $(OR_OUTDIR)\ooDialog.obj + .c{$(OR_OUTDIR)}.obj: $(C) $(OPTIONS) /DINCL_32 -c $(@B).c /Fo$(OR_OUTDIR)\$(@B).obj Modified: main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp 2009-06-22 03:01:38 UTC (rev 4826) +++ main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp 2009-06-22 03:13:00 UTC (rev 4827) @@ -653,7 +653,7 @@ dlgAdm->BT_size ++; RETC(0) } else - if (AddTheMessage(dlgAdm, WM_COMMAND, 0xFFFFFFFF, atoi(buffer[0]), 0x0000FFFF, 0, 0, argv[2].strptr, 0)) + if (AddTheMessage(dlgAdm, WM_COMMAND, UINT32_MAX, atoi(buffer[0]), 0x0000FFFF, 0, 0, argv[2].strptr, 0)) { dlgAdm->BT_size ++; RETC(0) Modified: main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp 2009-06-22 03:01:38 UTC (rev 4826) +++ main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp 2009-06-22 03:13:00 UTC (rev 4827) @@ -450,25 +450,24 @@ } -// TODO FIXME wParam and lParam are 64-bit in 64-bit Windows. -BOOL AddTheMessage(DIALOGADMIN * aDlg, ULONG message, ULONG filt1, ULONG param, ULONG filt2, - ULONG lparam, ULONG filt3, CSTRING prog, ULONG ulTag) +BOOL AddTheMessage(DIALOGADMIN * aDlg, UINT winMsg, UINT wmFilter, WPARAM wParam, ULONG_PTR wpFilter, + LPARAM lParam, ULONG_PTR lpFilter, CSTRING prog, ULONG ulTag) { size_t len = strlen(prog); if ( strlen(prog) == 0 ) { - return 0; + return FALSE; } - if ( !(message | param | lparam) ) + if ( ! (winMsg | wParam | lParam) ) { - MessageBox(0,"Message passed is invalid","Error",MB_OK | MB_ICONHAND); - return 0; + MessageBox(0, "Message passed is invalid", "Error", MB_OK | MB_ICONHAND); + return FALSE; } - if ( !aDlg->MsgTab ) + if ( ! aDlg->MsgTab ) { aDlg->MsgTab = (MESSAGETABLEENTRY *)LocalAlloc(LPTR, sizeof(MESSAGETABLEENTRY) * MAX_MT_ENTRIES); - if ( !aDlg->MsgTab ) + if ( ! aDlg->MsgTab ) { MessageBox(0,"No memory available","Error",MB_OK | MB_ICONHAND); return 0; @@ -478,24 +477,23 @@ if ( aDlg->MT_size < MAX_MT_ENTRIES ) { - aDlg->MsgTab[aDlg->MT_size].msg = message; - aDlg->MsgTab[aDlg->MT_size].filterM = filt1; - aDlg->MsgTab[aDlg->MT_size].wParam = param; - aDlg->MsgTab[aDlg->MT_size].filterP = filt2; - aDlg->MsgTab[aDlg->MT_size].lParam = lparam; - aDlg->MsgTab[aDlg->MT_size].filterL = filt3; - aDlg->MsgTab[aDlg->MT_size].tag = ulTag; aDlg->MsgTab[aDlg->MT_size].rexxProgram = (PCHAR)LocalAlloc(LMEM_FIXED, len + 1); - - /* This is what the original code did, but if we could not alloc memory, - * we should bail. - */ - if ( aDlg->MsgTab[aDlg->MT_size].rexxProgram ) + if ( aDlg->MsgTab[aDlg->MT_size].rexxProgram == NULL ) { - strcpy(aDlg->MsgTab[aDlg->MT_size].rexxProgram, prog); + return FALSE; } + strcpy(aDlg->MsgTab[aDlg->MT_size].rexxProgram, prog); + + aDlg->MsgTab[aDlg->MT_size].msg = winMsg; + aDlg->MsgTab[aDlg->MT_size].filterM = wmFilter; + aDlg->MsgTab[aDlg->MT_size].wParam = wParam; + aDlg->MsgTab[aDlg->MT_size].filterP = wpFilter; + aDlg->MsgTab[aDlg->MT_size].lParam = lParam; + aDlg->MsgTab[aDlg->MT_size].filterL = lpFilter; + aDlg->MsgTab[aDlg->MT_size].tag = ulTag; + aDlg->MT_size ++; - return 1; + return TRUE; } else { @@ -503,47 +501,10 @@ "table entries. No message can be added.\n", "Error",MB_OK | MB_ICONHAND); } - return 0; + return FALSE; } -#define NARG 7 - -size_t RexxEntry AddUserMessage(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) -{ - ULONG n[NARG]; - INT i; - DEF_ADM; - - CHECKARGL(NARG+1); - - GET_ADM; - - if (!dlgAdm) return 1; - - for (i=1;i<NARG;i++) - { - if (isHex(argv[i].strptr)) - n[i-1] = strtoul(argv[i].strptr,'\0',16); - else - n[i-1] = (ULONG)atol(argv[i].strptr); - } - - if ( argc == 9 ) - { - if ( isHex(argv[8].strptr) ) - n[NARG-1] = strtoul(argv[8].strptr,'\0',16); - else - n[NARG-1] = (ULONG)atol(argv[8].strptr); - } - else - n[NARG-1] = 0; - - RETC(!AddTheMessage(dlgAdm, n[0], n[1], n[2], n[3], n[4], n[5], argv[7].strptr, n[NARG-1])) -} - - - size_t RexxEntry SendWinMsg(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) { LONG i; Modified: main/trunk/extensions/platform/windows/oodialog/oovother.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-06-22 03:01:38 UTC (rev 4826) +++ main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-06-22 03:13:00 UTC (rev 4827) @@ -73,10 +73,7 @@ static void freeSubclassData(SUBCLASSDATA *); static BOOL removeKeyPressSubclass(SUBCLASSDATA *, HWND, INT); -bool screenToDlgUnit(HWND hwnd, POINT *point); -void screenToDlgUnit(HDC hdc, POINT *point); - /** * Defines and structs for the DlgUtil class. */ @@ -2552,55 +2549,6 @@ return true; } -RexxObjectPtr rxNewRect(RexxMethodContext *context, long l, long t, long r, long b) -{ - RexxObjectPtr rect = NULL; - - RexxClassObject RectClass = rxGetContextClass(context, "RECT"); - if ( RectClass != NULL ) - { - RexxArrayObject args = context->NewArray(4); - context->ArrayAppend(args, context->WholeNumber(l)); - context->ArrayAppend(args, context->WholeNumber(t)); - context->ArrayAppend(args, context->WholeNumber(r)); - context->ArrayAppend(args, context->WholeNumber(b)); - - rect = context->SendMessage(RectClass, "NEW", args); - } - return rect; -} - -RexxObjectPtr rxNewPoint(RexxMethodContext *c, long x, long y) -{ - RexxObjectPtr point = NULL; - RexxClassObject PointClass = rxGetContextClass(c, "POINT"); - if ( PointClass != NULL ) - { - point = c->SendMessage2(PointClass, "NEW", c->WholeNumber(x), c->WholeNumber(y)); - } - return point; -} - -PSIZE rxGetSize(RexxMethodContext *context, RexxObjectPtr s, int argPos) -{ - if ( requiredClass(context, s, "Size", argPos) ) - { - return (PSIZE)context->ObjectToCSelf(s); - } - return NULL; -} - -RexxObjectPtr rxNewSize(RexxMethodContext *c, long cx, long cy) -{ - RexxObjectPtr size = NULL; - RexxClassObject SizeClass = rxGetContextClass(c, "SIZE"); - if ( SizeClass != NULL ) - { - size = c->SendMessage2(SizeClass, "NEW", c->WholeNumber(cx), c->WholeNumber(cy)); - } - return size; -} - inline bool hasStyle(HWND hwnd, LONG style) { if ( (GetWindowLong(hwnd, GWL_STYLE) & style) || (GetWindowLong(hwnd, GWL_EXSTYLE) & style) ) @@ -2610,93 +2558,6 @@ return false; } -/** - * Correctly converts from a device coordinate (pixel) to a dialog unit - * coordinate, for any dialog. - * - * MapDialogRect() correctly converts from dialog units to pixels for any - * dialog. But, there is no conversion the other way, from pixels to dialog - * units. - * - * MSDN gives these formulas to convert from pixel to dialog unit: - * - * templateunitX = MulDiv(pixelX, 4, baseUnitX); - * templateunitY = MulDiv(pixelY, 8, baseUnitY); - * - * Now, you just need to get the correct dialog base unit. - * - * GetDialogBaseUnits() always assumes the font is the system font. If the - * dialog uses any other font, the base units returned will be incorrect. - * - * MSDN, again, has two methods for calculating the correct base units for any - * font. This way is the simplest, but it requires the window handle to the - * dialog. - * - * Rect rect( 0, 0, 4, 8 ); - * MapDialogRect( &rc ); - * int baseUnitY = rc.bottom; - * int baseUnitX = rc.right; - * - * @param hwnd Window handle of the dialog. If this is not a dialog window - * handle, this method will fail. - * - * @param point Pointer to a POINT struct. Not that a SIZE struct and a POINT - * struct are binary equivalents. They both have two fields, each - * of which is a long. Only the field names differ, cx and cy for - * a SIZE and x and y for a POINT. Therefore you can cast a - * SIZE pointer to a POINT pointer. - * - * @return true on success, false otherwise. - * - * Dialog class: #32770 - */ -bool screenToDlgUnit(HWND hwnd, POINT *point) -{ - RECT r = {0, 0, 4, 8}; - - if ( MapDialogRect(hwnd, &r) ) - { - point->x = MulDiv(point->x, 4, r.right); - point->y = MulDiv(point->y, 8, r.bottom); - return true; - } - return false; -} - -/** - * Given a device context with the correct font already selected into it, - * correctly converts from a device coordinate (pixel) to a dialog unit - * coordinate. The correct font means, the font actually used by the dialog. - * - * See screenToDlgUnit(HWND, POINT *) for a discussion of this - * conversion. - * - * @param hdc Handle to a device context with the dialog's font selected into - * it. - * - * @param point Pointer to a POINT struct. Not that a SIZE struct and a POINT - * struct are binary equivalents. They both have two fields, each - * of which is a long. Only the field names differ, cx and cy for - * a SIZE and x and y for a POINT. Therefore you can cast a - * SIZE pointer to a POINT pointer. - * - * @return true on success, false otherwise. - * - */ -void screenToDlgUnit(HDC hdc, POINT *point) -{ - TEXTMETRIC tm; - SIZE size; - GetTextMetrics(hdc, &tm); - int baseUnitY = tm.tmHeight; - - GetTextExtentPoint32(hdc, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz", 52, &size); - int baseUnitX = (size.cx / 26 + 1) / 2; - - point->x = MulDiv(point->x, 4, baseUnitX); - point->y = MulDiv(point->y, 8, baseUnitY); -} - RexxObjectPtr oodSetImageAttribute(RexxMethodContext *c, CSTRING varName, RexxObjectPtr image, HWND hwnd, HANDLE hOldImage, uint8_t type, oodControl_t ctrl) { @@ -2744,205 +2605,6 @@ } /** - * Uses GetTextExtentPoint32() to get the size needed for a string using the - * specified font and device context. - * - * @param font The font being used for the string. - * @param hdc The device context to use. - * @param text The string. - * @param size Pointer to a SIZE struct used to return the size. - * - * @return True if GetTextExtentPoint32() succeeds, otherwise false. - * - * @note GetTextExtentPoint32() sets last error and SelectObject() does not. - * Therefore if this function fails, GetLastError() will return the - * correct error code for the failed GetTextExtentPoint32(). - */ -bool getTextExtent(HFONT font, HDC hdc, CSTRING text, SIZE *size) -{ - bool success = true; - HFONT hOldFont = (HFONT)SelectObject(hdc, font); - - if ( GetTextExtentPoint32(hdc, text, (int)strlen(text), size) == 0 ) - { - success = false; - } - SelectObject(hdc, hOldFont); - return success; -} - -HFONT createFontFromName(HDC hdc, CSTRING name, uint32_t size) -{ - LOGFONT lf={0}; - - strcpy(lf.lfFaceName, name); - lf.lfHeight = -MulDiv(size, GetDeviceCaps(hdc, LOGPIXELSY), 72); - return CreateFontIndirect(&lf); -} - -bool textSizeIndirect(RexxMethodContext *context, CSTRING text, CSTRING fontName, uint32_t fontSize, - SIZE *size, HWND hwnd) -{ - bool success = true; - - // If hwnd is null, GetDC() returns a device context for the whole screen, - // and that suites our purpose here. - HDC hdc = GetDC(hwnd); - if ( hdc == NULL ) - { - systemServiceExceptionCode(context, API_FAILED_MSG, "GetDC"); - return false; - } - - HFONT font = createFontFromName(hdc, fontName, fontSize); - if ( font == NULL ) - { - systemServiceExceptionCode(context, API_FAILED_MSG, "CreateFontIndirect"); - ReleaseDC(hwnd, hdc); - return false; - } - - if ( ! getTextExtent(font, hdc, text, size) ) - { - systemServiceExceptionCode(context, API_FAILED_MSG, "GetTextExtentPoint32"); - success = false; - } - - DeleteObject(font); - if ( ReleaseDC(hwnd, hdc) == 0 ) - { - printf("RelaseDC() failed\n"); - } - - return success; -} - -bool textSizeFromWindow(RexxMethodContext *context, CSTRING text, SIZE *size, HWND hwnd) -{ - HDC hdc = GetDC(hwnd); - if ( hdc == NULL ) - { - systemServiceExceptionCode(context, API_FAILED_MSG, "GetDC"); - return false; - } - - // Dialogs and controls need to have been issued a WM_SETFONT or else they - // return null here. If null, they are using the stock system font. - HFONT font = (HFONT)SendMessage(hwnd, WM_GETFONT, 0, 0); - if ( font == NULL ) - { - font = (HFONT)GetStockObject(SYSTEM_FONT); - } - - bool success = true; - if ( ! getTextExtent(font, hdc, text, size) ) - { - systemServiceExceptionCode(context, API_FAILED_MSG, "GetTextExtentPoint32"); - success = false; - } - - ReleaseDC(hwnd, hdc); - return success; -} - -RexxObjectPtr getTextSize(RexxMethodContext *context, CSTRING text, CSTRING fontName, uint32_t fontSize, - HWND hwndFontSrc, RexxObjectPtr dlgObj) -{ - // hwndDlg can be null if this is happening before the real dialog is created. - HWND hwndDlg = rxGetWindowHandle(context, dlgObj); - - // We may not have a window handle, but using null is okay. - HWND hwndForDC = (hwndFontSrc != NULL ? hwndFontSrc : hwndDlg); - - SIZE textSize = {0}; - - if ( fontName != NULL ) - { - if ( ! textSizeIndirect(context, text, fontName, fontSize, &textSize, hwndForDC) ) - { - goto error_out; - } - } - else if ( hwndFontSrc != NULL ) - { - if ( ! textSizeFromWindow(context, text, &textSize, hwndFontSrc) ) - { - goto error_out; - } - } - - // Even if we use a font other than the dialog font to calculate the text - // size, we always have to get the dialog font and select it into a HDC to - // correctly calculate the dialog units. - HDC hdc = GetDC(hwndForDC); - if ( hdc == NULL ) - { - systemServiceExceptionCode(context, API_FAILED_MSG, "GetDC"); - goto error_out; - } - - HFONT dlgFont = NULL; - bool createdFont = false; - - if ( hwndDlg == NULL ) - { - fontSize = 0; - fontName = rxGetStringAttribute(context, dlgObj, "FONTNAME"); - - RexxObjectPtr rxSize = context->SendMessage0(dlgObj, "FONTSIZE"); - if ( rxSize != NULLOBJECT ) - { - context->ObjectToUnsignedInt32(rxSize, &fontSize); - } - - if ( fontName != NULL && fontSize != 0 ) - { - dlgFont = createFontFromName(hdc, fontName, fontSize); - if ( dlgFont != NULL ) - { - createdFont = true; - } - } - } - else - { - dlgFont = (HFONT)SendMessage(hwndDlg, WM_GETFONT, 0, 0); - } - - // If dlgFont is null, then, (almost for sure,) the dialog will be using the - // default system font. The exception to this is if the user calls the - // getTextSizeDlg() method before the create() method, and then defines a - // custom font in create(). The docs tell the user not to do that, but - // there is nothing to do about it if they do. - if ( dlgFont == NULL ) - { - dlgFont = (HFONT)GetStockObject(SYSTEM_FONT); - } - - HFONT hOldFont = (HFONT)SelectObject(hdc, dlgFont); - if ( textSize.cx == 0 ) - { - GetTextExtentPoint32(hdc, text, (int)strlen(text), &textSize); - } - - screenToDlgUnit(hdc, (POINT *)&textSize); - - SelectObject(hdc, hOldFont); - ReleaseDC(hwndForDC, hdc); - - if ( createdFont ) - { - DeleteObject(dlgFont); - } - - return rxNewSize(context, textSize.cx, textSize.cy); - -error_out: - return NULLOBJECT; -} - - -/** * Methods for the .WindowBase mixin class. */ #define WINDOWBASE_CLASS "WindowBase" @@ -2959,82 +2621,6 @@ /** - * Methods for the .PlainBaseDialog class. - */ -#define PLAINBASEDIALOG_CLASS "PlainBaseDialog" - -#define DEFAULT_FONTNAME "MS Shell Dlg" -#define DEFAULT_FONTSIZE 8 - -RexxMethod0(RexxObjectPtr, pbdlg_init_cls) -{ - context->SetObjectVariable("FONTNAME", context->String(DEFAULT_FONTNAME)); - context->SetObjectVariable("FONTSIZE", context->WholeNumber(DEFAULT_FONTSIZE)); - return NULLOBJECT; -} - -RexxMethod2(RexxObjectPtr, pbdlg_setDefaultFont_cls, CSTRING, fontName, uint32_t, fontSize) -{ - context->SetObjectVariable("FONTNAME", context->String(fontName)); - context->SetObjectVariable("FONTSIZE", context->WholeNumber(fontSize)); - return NULLOBJECT; -} - -RexxMethod0(RexxObjectPtr, pbdlg_getFontName_cls) -{ - return context->GetObjectVariable("FONTNAME"); -} -RexxMethod0(RexxObjectPtr, pbdlg_getFontSize_cls) -{ - return context->GetObjectVariable("FONTSIZE"); -} - -/** PlainBaseDialog::getTextSizeDlg() - * - * Gets the size (width and height) in dialog units for any given string, for - * the font specified. - * - * @param text The string whose size is needed. - * - * @param fontName Optional. If specified, use this font to calculate the - * size. - * - * @param fontSize Optional. If specified, use this font size with - * fontName to calculate the size. The default if omitted - * is 8. This arg is ignored if fontName is omitted. - * - * @param hwndFontSrc Optional. Use this window's font to calculate the size. - * This arg is always ignored if fontName is specified. - * - */ -RexxMethod5(RexxObjectPtr, pbdlg_getTextSizeDlg, CSTRING, text, OPTIONAL_CSTRING, fontName, - OPTIONAL_uint32_t, fontSize, OPTIONAL_POINTERSTRING, hwndFontSrc, OSELF, self) -{ - HWND hwndSrc = NULL; - if ( argumentExists(2) ) - { - if ( argumentOmitted(3) ) - { - fontSize = DEFAULT_FONTSIZE; - } - } - else if ( argumentExists(4) ) - { - if ( hwndFontSrc == NULL ) - { - nullObjectException(context, "window handle", 4); - goto error_out; - } - hwndSrc = (HWND)hwndFontSrc; - } - return getTextSize(context, text, fontName, fontSize, hwndSrc, self); - -error_out: - return NULLOBJECT; -} - - -/** * Methods for the .ResDialog class. */ #define RESDIALOG_CLASS "ResDialog" @@ -3607,7 +3193,7 @@ RexxObjectPtr rxID = c->ArrayAt(args, 1); if ( rxID == NULLOBJECT ) { - c->RaiseException1(Rexx_Error_Incorrect_method_noarg, c->WholeNumber(1)); + c->RaiseException1(Rexx_Error_Incorrect_method_noarg, TheOneObj); goto out; } @@ -7883,7 +7469,7 @@ { if ( count < 1 ) { - c->RaiseException1(Rexx_Error_Incorrect_method_noarg, context->WholeNumber(1)); + c->RaiseException1(Rexx_Error_Incorrect_method_noarg, TheOneObj); goto done_out; } Modified: main/trunk/extensions/platform/windows/oodialog/plbdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-06-22 03:01:38 UTC (rev 4826) +++ main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-06-22 03:13:00 UTC (rev 4827) @@ -588,16 +588,7 @@ /* Connect any Windows message with a class method */ -::method AddUserMsg protected unguarded - use arg msgToRise, msgWindows, filt1, wP, filt2, lP, filt3, tag - if Arg(3, 'o') = 1 | filt1 = "FILT1" then filt1 = 0xFFFFFFFF - if Arg(5, 'o') = 1 | filt2 = "FILT2" then filt2 = 0 - if Arg(7, 'o') = 1 | filt3 = "FILT3" then filt3 = 0 - if Arg(4, 'o') = 1 | wP = "WP" then wP = 0 - if Arg(6, 'o') = 1 | lP = "LP" then lP = 0 - if msgToRise~space(0) = "" then return 1 - if Arg(8, 'o') = 1 then return AddUserMessage(self~Adm, msgWindows, filt1, wP, filt2, lP, filt3, msgToRise) - else return AddUserMessage(self~Adm, msgWindows, filt1, wP, filt2, lP, filt3, msgToRise, tag) +::method AddUserMsg protected unguarded external "LIBRARY oodialog pbdlg_addUserMessage" ::method ConnectFKeyPress unguarded use strict arg msgToRaise This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-07-04 01:32:18
|
Revision: 4872 http://oorexx.svn.sourceforge.net/oorexx/?rev=4872&view=rev Author: miesfeld Date: 2009-07-04 01:32:08 +0000 (Sat, 04 Jul 2009) Log Message: ----------- [2807760] ooDialog - some event connection methods incorrect Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/dlgext.cls main/trunk/extensions/platform/windows/oodialog/dyndlg.cls main/trunk/extensions/platform/windows/oodialog/msgext.cls main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp main/trunk/extensions/platform/windows/oodialog/plbdlg.cls main/trunk/extensions/platform/windows/oodialog/propsht.cls Modified: main/trunk/extensions/platform/windows/oodialog/dlgext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-07-04 00:49:31 UTC (rev 4871) +++ main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-07-04 01:32:08 UTC (rev 4872) @@ -160,49 +160,50 @@ if id = -1 then return -1 return HandleScrollBar("GP",self~GetItem(id)) -::method ConnectScrollBar - use arg id, progup, progdn, progpos, min, max, pos, progpgup, progpgdn,, - progtop, progbottom, progtrack, progendsc - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectScrollBar + use arg id, progUp, progDn, progPos, min, max, pos, progPgUp, progPgDn, progTop, progBottom, progTrack, progEndSc + + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if ((Arg(5, 'o') = 0) & (min~Datatype('N') \= 0)) & ((Arg(6,'o') = 0) & (max~Datatype('N') \= 0)) then self~SetSBRange(id, min, max, 0) - if (Arg(7,'o') = 0) & (pos~Datatype('N') \= 0) then self~SetSBPos(id, pos, 0) - hwnd = self~GetItem(id) + if arg(5, 'E'), min~datatype('N'), arg(6,'E'), max~datatype('N') then self~setSBRange(id, min, max, 0) + if arg(7, 'E'), pos~datatype('N') then self~setSBPos(id, pos, 0) + + hwnd = self~getItem(id) wf = "0x0000FFFF" nf = "0xFFFFFFFF" /* Install hooks for WM_VSCROLL and WM_HSCROLL */ - self~AddUserMsg(progdn, 0x00000114, wf, 0x00000001, wf, hwnd, nf) - self~AddUserMsg(progup, 0x00000114, wf, 0x00000000, wf, hwnd, nf) - self~AddUserMsg(progdn, 0x00000115, wf, 0x00000001, wf, hwnd, nf) - self~AddUserMsg(progup, 0x00000115, wf, 0x00000000, wf, hwnd, nf) - if Arg(4,'o') = 0 then do - self~AddUserMsg(progpos, 0x00000114, wf, 0x00000004, wf, hwnd, nf) - self~AddUserMsg(progpos, 0x00000115, wf, 0x00000004, wf, hwnd, nf) + self~addUserMsg(progDn, 0x00000114, wf, 0x00000001, wf, hwnd, nf) + self~addUserMsg(progUp, 0x00000114, wf, 0x00000000, wf, hwnd, nf) + self~addUserMsg(progDn, 0x00000115, wf, 0x00000001, wf, hwnd, nf) + self~addUserMsg(progUp, 0x00000115, wf, 0x00000000, wf, hwnd, nf) + if arg(4, 'E'), progPos \== "" then do + self~addUserMsg(progPos, 0x00000114, wf, 0x00000004, wf, hwnd, nf) + self~addUserMsg(progPos, 0x00000115, wf, 0x00000004, wf, hwnd, nf) end - if Arg(8,'o') = 0 then do - self~AddUserMsg(progpgup, 0x00000114, wf, 0x00000002, wf, hwnd, nf) - self~AddUserMsg(progpgup, 0x00000115, wf, 0x00000002, wf, hwnd, nf) + if arg(8, 'E'), progPgUp \== "" then do + self~addUserMsg(progPgUp, 0x00000114, wf, 0x00000002, wf, hwnd, nf) + self~addUserMsg(progPgUp, 0x00000115, wf, 0x00000002, wf, hwnd, nf) end - if Arg(9,'o') = 0 then do - self~AddUserMsg(progpgdn, 0x00000114, wf, 0x00000003, wf, hwnd, nf) - self~AddUserMsg(progpgdn, 0x00000115, wf, 0x00000003, wf, hwnd, nf) + if arg(9, 'E'), progPgDn \== "" then do + self~addUserMsg(progPgDn, 0x00000114, wf, 0x00000003, wf, hwnd, nf) + self~addUserMsg(progPgDn, 0x00000115, wf, 0x00000003, wf, hwnd, nf) end - if Arg(10,'o') = 0 then do - self~AddUserMsg(progtop, 0x00000114, wf, 0x00000006, wf, hwnd, nf) - self~AddUserMsg(progtop, 0x00000115, wf, 0x00000006, wf, hwnd, nf) + if arg(10, 'E'), progTop \== "" then do + self~addUserMsg(progTop, 0x00000114, wf, 0x00000006, wf, hwnd, nf) + self~addUserMsg(progTop, 0x00000115, wf, 0x00000006, wf, hwnd, nf) end - if Arg(11,'o') = 0 then do - self~AddUserMsg(progbottom, 0x00000114, wf, 0x00000007, wf, hwnd, nf) - self~AddUserMsg(progbottom, 0x00000115, wf, 0x00000007, wf, hwnd, nf) + if arg(11, 'E'), progBottom \== "" then do + self~addUserMsg(progBottom, 0x00000114, wf, 0x00000007, wf, hwnd, nf) + self~addUserMsg(progBottom, 0x00000115, wf, 0x00000007, wf, hwnd, nf) end - if Arg(12,'o') = 0 then do - self~AddUserMsg(progtrack, 0x00000114, wf, 0x00000005, wf, hwnd, nf) - self~AddUserMsg(progtrack, 0x00000115, wf, 0x00000005, wf, hwnd, nf) + if arg(12, 'E'), progTrack \== "" then do + self~addUserMsg(progTrack, 0x00000114, wf, 0x00000005, wf, hwnd, nf) + self~addUserMsg(progTrack, 0x00000115, wf, 0x00000005, wf, hwnd, nf) end - if Arg(13,'o') = 0 then do - self~AddUserMsg(progendsc, 0x00000114, wf, 0x00000008, wf, hwnd, nf) - self~AddUserMsg(progendsc, 0x00000115, wf, 0x00000008, wf, hwnd, nf) + if arg(13, 'E'), progEndSc \== "" then do + self~addUserMsg(progEndSc, 0x00000114, wf, 0x00000008, wf, hwnd, nf) + self~addUserMsg(progEndSc, 0x00000115, wf, 0x00000008, wf, hwnd, nf) end return 0 @@ -386,28 +387,33 @@ use arg hBitmap return LoadRemoveBitmap(self~Adm, hBitmap, "REMOVE") - /* This method connects a bitmap and a class method with a push button */ - /* The given bitmap will be shown instead of a push button */ - -::method AddBitmapButton +-- This method adds a bitmap button and optionally connects a method with a push +-- button. The given bitmap(s) will be shown instead of a push button. The +-- optional msgToRise arg can be the name of a method to invoke when the button +-- is pushed. The empty string signals the implementing code to skip adding a +-- method to the message table. +::method addBitmapButton use arg id, x, y, cx = 0, cy = 0, text = "", fnk = "", bmp, focus = "", sel = "", disabl = "", opts if self~activePtr = 0 then return -2 - id = self~CheckId(id) + id = self~checkId(id) if id = -1 then return - opts = self~GetDefaultOpts(opts) || " OWNER" + opts = self~getDefaultOpts(opts) || " OWNER" if focus = "" & sel = "" & opts~wordpos("FRAME") = 0 & opts~wordpos("TAB") = 0 then opts = opts || " NOTAB" - self~DialogItemCount = self~DialogItemCount + 1 + self~dialogItemCount = self~dialogItemCount + 1 self~activePtr = UsrAddControl("BUT", self~activePtr, id, x, y, cx, cy, text, opts) - self~ConnectBitmapButton(id, fnk~space(0), bmp, focus, sel, disabl, opts) + return self~connectBitmapButton(id, fnk~space(0), bmp, focus, sel, disabl, opts) -::method ConnectBitmapButton - use arg id, msgToRise = "", bmpNormal, bmpFocused = "", bmpSelected = "", bmpDisabled = "", styleOptions = "" +-- The only way to get the bitmaps into the bitmap table is through this method. +-- Therefore, we have to allow an omitted msgToRise. If msgToRise == "", then +-- in BmpButton() the function skips adding a method to the message table. +::method connectBitmapButton + use strict arg id, msgToRise = "", bmpNormal, bmpFocused = "", bmpSelected = "", bmpDisabled = "", styleOptions = "" styleOptions = styleOptions~translate - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) + if \ id~datatype("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - return BmpButton(self~Adm, "A", msgToRise, id, bmpNormal, bmpFocused, bmpSelected, bmpDisabled, styleOptions); + return BmpButton(self~adm, "A", msgToRise, id, bmpNormal, bmpFocused, bmpSelected, bmpDisabled, styleOptions); /* This method changes the bitmap of a bitmap button */ @@ -540,16 +546,16 @@ /* Connect WM_DRAWITEM with a method */ -::method ConnectDraw +::method connectDraw use arg id, msgToRise - if Arg(1,'o') = 1 then do - if arg(2,'o') = 1 then msgToRise = "OnDraw" - return self~AddUserMsg(msgToRise, 0x0000002B, 0xFFFFFFFF, 0, 0, 0, 0) + if arg(2,'O') then msgToRise = "OnDraw" + if arg(1,'O') then do + return self~addUserMsg(msgToRise, 0x0000002B, 0xFFFFFFFF, 0, 0, 0, 0) end else do - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - return self~AddUserMsg(msgToRise, 0x0000002B, 0xFFFFFFFF, '0x0000'||id~d2x(4), 0xFFFFFFFF, 0, 0) + return self~addUserMsg(msgToRise, 0x0000002B, 0xFFFFFFFF, '0x0000'||id~d2x(4), 0xFFFFFFFF, 0, 0) end /* This method draws the given button */ @@ -856,26 +862,30 @@ /* This method will install an animated button and run it concurrently to main */ /* activity */ -::method ConnectAnimatedButton - use arg buttonid, msgToRise, AutoClass, bmpfrom, bmpto, movex, movey, sizex, sizey, delay, xnow, ynow +-- The only way to get the bitmap(s) into the bitmap table is through this +-- method. Therefore msgToRise has to be optional. The empty string will +-- eventually cause the bitmaps to be added to the bitmap table and the addition +-- of a method being added to the message table will be skipped. +::method connectAnimatedButton + use arg buttonEd, msgToRise = "", autoClass = (.AnimatedButton), bmpFrom, bmpTo = 0, moveX, moveY, sizeX, sizeY, - + delay, xNow = 0, yNow = 0 - if Arg(2, "o") = 1 then msgToRise = "" - if Arg(3, "o") = 1 then autoclass = .AnimatedButton - if Arg(5, "o") = 1 | bmpfrom~datatype("N") \= 1 then - self~ConnectBitmapButton(buttonid, msgToRise, .local[bmpfrom][1]) - else self~ConnectBitmapButton(buttonid, msgToRise, bmpfrom) + -- Note documentation for bmpfrom, it is *not* a bitmap handle. + if arg(5, "o") | \ bmpFrom~datatype("N") then + ret = self~connectBitmapButton(buttonId, msgToRise, .local[bmpFrom][1]) + else + ret = self~connectBitmapButton(buttonId, msgToRise, bmpFrom) - if Arg(5, "o") = 1 then bmpto = 0 - if Arg(8, "o") = 1 then sizex = self~GetBitmapSizeX(buttonid) - if Arg(9, "o") = 1 then sizey = self~GetBitmapSizeY(buttonid) - if Arg(11, "o") = 1 then xnow = 0 - if Arg(12, "o") = 1 then ynow = 0 + if ret <> 0 then return ret - self~AddAutoStartMethod(AutoClass, "RUN", buttonid || "," || bmpfrom ||"," || bmpto ||"," || movex || ",", - || movey || "," || sizex || "," || sizey || "," || delay || "," || xnow || "," || ynow) + if arg(8, "O") then sizeX = self~getBitmapSizeX(buttonId) + if arg(9, "O") then sizeY = self~getBitmapSizeY(buttonId) + self~addAutoStartMethod(autoClass, "RUN", buttonId || "," || bmpFrom ||"," || bmpTo ||"," || moveX || ",", + || moveY || "," || sizeX || "," || sizeY || "," || delay || "," || xNow || "," || yNow) + /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*\ These menu bar methods are needed to provide backward compatibility for the deprecated menu methods. The Rexx programmer is *strongly* discouraged from @@ -1023,21 +1033,21 @@ /******************************************************************************/ /* New extensions */ -::method ConnectResize - use arg msgToRise - self~AddUserMsg(msgToRise, 0x00000005, 0xFFFFFFFF, 0, 0, 0, 0) +::method connectResize + use strict arg msgToRise + self~addUserMsg(msgToRise, 0x00000005, 0xFFFFFFFF, 0, 0, 0, 0) -::method ConnectMove - use arg msgToRise - self~AddUserMsg(msgToRise, 0x00000003, 0xFFFFFFFF, 0, 0, 0, 0) +::method connectMove + use strict arg msgToRise + self~addUserMsg(msgToRise, 0x00000003, 0xFFFFFFFF, 0, 0, 0, 0) -::method ConnectPosChanged - use arg msgToRise - self~AddUserMsg(msgToRise, 0x00000047, 0xFFFFFFFF, 0, 0, 0, 0) +::method connectPosChanged + use strict arg msgToRise + self~addUserMsg(msgToRise, 0x00000047, 0xFFFFFFFF, 0, 0, 0, 0) -::method ConnectMouseCapture - use arg msgToRise - self~AddUserMsg(msgToRise, 0x00000215, 0xFFFFFFFF, 0, 0, 0, 0) +::method connectMouseCapture + use strict arg msgToRise + self~addUserMsg(msgToRise, 0x00000215, 0xFFFFFFFF, 0, 0, 0, 0) ::method connectMenuItem use strict arg id, msgToRaise Modified: main/trunk/extensions/platform/windows/oodialog/dyndlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dyndlg.cls 2009-07-04 00:49:31 UTC (rev 4871) +++ main/trunk/extensions/platform/windows/oodialog/dyndlg.cls 2009-07-04 01:32:08 UTC (rev 4872) @@ -257,8 +257,10 @@ opts = self~InternGetRCStyle(style, "BTN") self~DialogItemCount = self~DialogItemCount + 1 self~activePtr = UsrAddControl("BUT", self~activePtr, id, x, y, w, h, name, opts) - if lOpts~wordpos("CONNECTBUTTONS") > 0 then - self~ConnectButton(id, name~space(0)~changestr('&','')~changestr(':','')) + if lOpts~wordpos("CONNECTBUTTONS") > 0 then do + methName = name~space(0)~changestr('&','')~changestr(':','')~strip + if methName \== "" then self~ConnectButton(id, methName) + end ::method InternAddRC_RBCB @@ -612,14 +614,16 @@ /* argument 'options' can be one of: */ ::method addButton - use arg id, x, y, cx, cy, text = "", msgToRise, options + use strict arg id, x, y, cx, cy, text = "", msgToRise = "", options = "" id = self~itemAdd(id) if id < 0 then return id options = self~getDefaultOpts(options) self~activePtr = UsrAddControl("BUT", self~activePtr, id, x, y, cx, cy, text, options) - if Arg(7,"o") = 0 then return self~connectButton(id, msgToRise~space(0)) - else return 0 + if arg(7, 'O') then return 0 + methName = msgToRise~space(0) + if methName \== '' then return self~connectButton(id, methName) + else return 1 ::method addGroupBox use arg x, y, cx, cy, text = "", opts, id @@ -1088,9 +1092,9 @@ fileName = fileName~strip~strip('B', '"') return UsrAddResource(self~Adm, "ICO", id, fileName) -::method GetDefaultOpts protected - use arg opts - if opts = .NIL | opts = "OPTS" | opts = "OPTIONS" then return "" +::method getDefaultOpts protected + use strict arg opts + if opts == "" | opts == .NIL | opts == "OPTS" | opts == "OPTIONS" then return "" else return opts~translate Modified: main/trunk/extensions/platform/windows/oodialog/msgext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/msgext.cls 2009-07-04 00:49:31 UTC (rev 4871) +++ main/trunk/extensions/platform/windows/oodialog/msgext.cls 2009-07-04 01:32:08 UTC (rev 4872) @@ -46,93 +46,87 @@ ::class 'MessageExtensions' Mixinclass Object public -::method ConnectCommonNotify - use arg id, type, msgToRise - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectCommonNotify + use strict arg id, type, msgToRise = "" + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if Arg(3,'o') = 1 then msgToRise = "On" || type + if msgToRise == "" then msgToRise = "on" || type type = type~translate select - when type = "OUTOFMEMORY" then lp =-1 - when type = "CLICK" then lp =-2 - when type = "DBLCLK" then lp =-3 - when type = "ENTER" then lp =-4 - when type = "RCLICK" then lp =-5 - when type = "RDBLCLK" then lp =-6 - when type = "GOTFOCUS" then lp =-7 - when type = "LOSTFOCUS" then lp =-8 + when type = "OUTOFMEMORY" then lp = -1 + when type = "CLICK" then lp = -2 + when type = "DBLCLK" then lp = -3 + when type = "ENTER" then lp = -4 + when type = "RCLICK" then lp = -5 + when type = "RDBLCLK" then lp = -6 + when type = "GOTFOCUS" then lp = -7 + when type = "LOSTFOCUS" then lp = -8 otherwise return -1 end - return self~AddUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", lp, "0xFFFFFFFF") + return self~addUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", lp, "0xFFFFFFFF") -::method ConnectTreeNotify - use arg id, type, msgToRise - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectTreeNotify + use strict arg id, type, msgToRise = "" + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if Arg(3,'o') = 1 then msgToRise = "On" || type + if msgToRise == "" then msgToRise = "on" || type notifySize = 0 type = type~translate select when type = "SELCHANGING" then lp = -401 - when type = "SELCHANGED" then lp = -402 - when type = "EXPANDING" then lp = -405 - when type = "EXPANDED" then lp = -406 - when type = "BEGINDRAG" then lp = -407 - when type = "BEGINRDRAG" then lp = -408 - when type = "DELETE" then lp = -409 - when type = "BEGINEDIT" then lp = -410 - when type = "ENDEDIT" then lp = -411 + when type = "SELCHANGED" then lp = -402 + when type = "EXPANDING" then lp = -405 + when type = "EXPANDED" then lp = -406 + when type = "BEGINDRAG" then lp = -407 + when type = "BEGINRDRAG" then lp = -408 + when type = "DELETE" then lp = -409 + when type = "BEGINEDIT" then lp = -410 + when type = "ENDEDIT" then lp = -411 when type = "DEFAULTEDIT" then do - self~AddUserMsg("DefTreeEditStarter", 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", -410, "0xFFFFFFFF", notifySize) + self~addUserMsg("DefTreeEditStarter", 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", -410, "0xFFFFFFFF", notifySize) lp = -411 msgToRise = "DefTreeEditHandler" end when type = "KEYDOWN" then lp = -412 otherwise return -1 end - return self~AddUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", lp, "0xFFFFFFFF", notifySize) + return self~addUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", lp, "0xFFFFFFFF", notifySize) -::method ConnectListNotify - use arg id, type, msgToRise - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectListNotify + use strict arg id, type, msgToRise = "" + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if Arg(3,'o') = 1 then msgToRise = "On" || type + if msgToRise == "" then msgToRise = "on" || type type = type~translate select - when type = "CHANGING" then lp = -100 - when type = "CHANGED" then lp = -101 - when type = "INSERTED" then lp = -102 - when type = "DELETE" then lp = -103 - when type = "DELETEALL" then lp = -104 - when type = "BEGINEDIT" then lp = -105 - when type = "ENDEDIT" then lp = -106 + when type = "CHANGING" then lp = -100 + when type = "CHANGED" then lp = -101 + when type = "INSERTED" then lp = -102 + when type = "DELETE" then lp = -103 + when type = "DELETEALL" then lp = -104 + when type = "BEGINEDIT" then lp = -105 + when type = "ENDEDIT" then lp = -106 when type = "DEFAULTEDIT" then do - self~AddUserMsg("DefListEditStarter", 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", -105, "0xFFFFFFFF", notifySize) + self~addUserMsg("DefListEditStarter", 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", -105, "0xFFFFFFFF", notifySize) lp = -106 msgToRise = "DefListEditHandler" end when type = "COLUMNCLICK" then lp = -108 - when type = "BEGINDRAG" then lp = -109 - when type = "BEGINRDRAG" then lp = -111 - when type = "ACTIVATE" then lp = -114 - when type = "KEYDOWN" then lp = -155 + when type = "BEGINDRAG" then lp = -109 + when type = "BEGINRDRAG" then lp = -111 + when type = "ACTIVATE" then lp = -114 + when type = "KEYDOWN" then lp = -155 otherwise return -1 end - return self~AddUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", lp, "0xFFFFFFFF") + return self~addUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", lp, "0xFFFFFFFF") - -- In the Windows API, when a list-view control sends a notification messsage, - -- there is more information delievered than there was when ooDialog was first - -- designed. Use the connectListViewNotify method for method connections that - -- can take advantage of this information. A tag is added to the message to - -- signal that the extra information should be processed. The tag is an - -- unsigned long made up of flags which are defined in ooDialog.h ::method connectListViewNotify - use arg id, type, msgToRise - if id~DataType("W") = 0 then id = self~ResolveSymbolicId(id) + use strict arg id, type, msgToRise = "" + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if Arg(3,'o') = 1 then msgToRise = "On" || type + if msgToRise == "" then msgToRise = "on" || type type = type~translate select when type = "CLICK" then do @@ -157,82 +151,82 @@ end otherwise return -1 end - return self~AddUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", lp, "0xFFFFFFFF", tag) + return self~addUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", lp, "0xFFFFFFFF", tag) -::method ConnectButtonNotify - use arg id, type, msgToRise - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectButtonNotify + use strict arg id, type, msgToRise = "" + if id~dataType("W") = 0 then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if Arg(3,'o') = 1 then msgToRise = "On" || type + if msgToRise == "" then msgToRise = "on" || type type = type~translate select - when type = "CLICKED" then lp = 0 - when type = "PAINT" then lp = 1 - when type = "HILITE" then lp = 2 - when type = "UNHILITE" then lp = 3 - when type = "DISABLE" then lp = 4 - when type = "DBLCLK" then lp = 5 - when type = "GOTFOCUS" then lp = 6 - when type = "LOSTFOCUS" then lp = 7 + when type = "CLICKED" then lp = 0 + when type = "PAINT" then lp = 1 + when type = "HILITE" then lp = 2 + when type = "UNHILITE" then lp = 3 + when type = "DISABLE" then lp = 4 + when type = "DBLCLK" then lp = 5 + when type = "GOTFOCUS" then lp = 6 + when type = "LOSTFOCUS" then lp = 7 - when type = "HOTITEM" then do + when type = "HOTITEM" then do -- Sends WM_NOTIFY and notify code is: BCN_HOTITEMCHANGE=0xfffffb1f (decimal=-1249) TAG_BUTTON = 0x00000004 - return self~AddUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", 0xFFFFFB1F, "0xFFFFFFFF", 4) + return self~addUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", 0xFFFFFB1F, "0xFFFFFFFF", 4) end otherwise return -1 end - return self~AddUserMsg(msgToRise, 0x00000111, "0xFFFFFFFF", lp * X2D("10000") + id, "0xFFFFFFFF", 0, 0) /* buttons sends WM_COMMAND when BS_NOTIFY */ + return self~addUserMsg(msgToRise, 0x00000111, "0xFFFFFFFF", lp * x2d("10000") + id, "0xFFFFFFFF", 0, 0) /* buttons sends WM_COMMAND when BS_NOTIFY */ -::method ConnectEditNotify - use arg id, type, msgToRise - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectEditNotify + use arg id, type, msgToRise = "" + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if Arg(3,'o') = 1 then msgToRise = "On" || type + if msgToRise == "" then msgToRise = "on" || type type = type~translate select - when type = "GOTFOCUS" then lp = "100" - when type = "LOSTFOCUS" then lp = "200" - when type = "CHANGE" then lp = "300" - when type = "UPDATE" then lp = "400" - when type = "ERRSPACE" then lp = "500" - when type = "MAXTEXT " then lp = "501" - when type = "HSCROLL" then lp = "601" - when type = "VSCROLL" then lp = "602" + when type = "GOTFOCUS" then lp = "100" + when type = "LOSTFOCUS" then lp = "200" + when type = "CHANGE" then lp = "300" + when type = "UPDATE" then lp = "400" + when type = "ERRSPACE" then lp = "500" + when type = "MAXTEXT " then lp = "501" + when type = "HSCROLL" then lp = "601" + when type = "VSCROLL" then lp = "602" otherwise return -1 end - return self~AddUserMsg(msgToRise, 0x00000111, "0xFFFFFFFF", lp~x2d * X2D("10000") + id, "0xFFFFFFFF", 0, 0) /* also send WM_COMMAND */ + return self~addUserMsg(msgToRise, 0x00000111, "0xFFFFFFFF", lp~x2d * x2d("10000") + id, "0xFFFFFFFF", 0, 0) /* also send WM_COMMAND */ -::method ConnectListBoxNotify - use arg id, type, msgToRise - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectListBoxNotify + use strict arg id, type, msgToRise = "" + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if Arg(3,'o') = 1 then msgToRise = "On" || type + if msgToRise == "" then msgToRise = "on" || type type = type~translate select - when type = "SELCHANGE" then lp = 1 - when type = "DBLCLK" then lp = 2 - when type = "SELCANCEL" then lp = 3 - when type = "GOTFOCUS" then lp = 4 - when type = "LOSTFOCUS" then lp = 5 - when type = "ERRSPACE" then lp = -2 - when type = "KEYDOWN" then do /* can first be called from InitDialog */ - return self~AddUserMsg(msgToRise, 0x0000002E, "0xFFFFFFFF", 0, 0, self~GetItem(id), "0xFFFFFFFF") /* WM_VKEYTOITEM */ + when type = "SELCHANGE" then lp = 1 + when type = "DBLCLK" then lp = 2 + when type = "SELCANCEL" then lp = 3 + when type = "GOTFOCUS" then lp = 4 + when type = "LOSTFOCUS" then lp = 5 + when type = "ERRSPACE" then lp = -2 + when type = "KEYDOWN" then do /* can first be called from InitDialog */ + return self~addUserMsg(msgToRise, 0x0000002E, "0xFFFFFFFF", 0, 0, self~getItem(id), "0xFFFFFFFF") /* WM_VKEYTOITEM */ end otherwise return -1 end - return self~AddUserMsg(msgToRise, 0x00000111, "0xFFFFFFFF", lp * X2D("10000") + id, "0xFFFFFFFF", 0, 0) /* also send WM_COMMAND */ + return self~addUserMsg(msgToRise, 0x00000111, "0xFFFFFFFF", lp * x2d("10000") + id, "0xFFFFFFFF", 0, 0) /* also send WM_COMMAND */ -::method ConnectComboBoxNotify - use arg id, type, msgToRise - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectComboBoxNotify + use strict arg id, type, msgToRise = "" + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if Arg(3,'o') = 1 then msgToRise = "On" || type + if msgToRise == "" then msgToRise = "on" || type type = type~translate select when type = "SELCHANGE" then lp = 1 @@ -248,40 +242,40 @@ when type = "ERRSPACE" then lp = -1 otherwise return -1 end - return self~AddUserMsg(msgToRise, 0x00000111, "0xFFFFFFFF", lp * X2D("10000") + id, "0xFFFFFFFF", 0, 0) /* also send WM_COMMAND */ + return self~addUserMsg(msgToRise, 0x00000111, "0xFFFFFFFF", lp * x2d("10000") + id, "0xFFFFFFFF", 0, 0) /* also send WM_COMMAND */ -::method ConnectScrollBarNotify /* can only be called in InitDialog */ - use arg id, type, msgToRise, category - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectScrollBarNotify /* can only be called in InitDialog */ + use strict arg id, type, msgToRise = "", category = 1 + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if Arg(4,'o') = 1 then hnd = self~GetItem(id) - else hnd = self~GetItem(id, category) + if arg(4,'O') then hnd = self~getItem(id) + else hnd = self~getItem(id, category) if hnd = 0 then return -1 - if Arg(3,'o') = 1 then msgToRise = "On" || type + if msgToRise == "" then msgToRise = "on" || type type = type~translate select - when type = "UP" then wp = 0 - when type = "DOWN" then wp = 1 + when type = "UP" then wp = 0 + when type = "DOWN" then wp = 1 when type = "PAGEUP" then wp = 2 - when type = "PAGEDOWN" then wp = 3 - when type = "POSITION" then wp = 4 - when type = "DRAG" then wp = 5 - when type = "TOP" then wp = 6 + when type = "PAGEDOWN" then wp = 3 + when type = "POSITION" then wp = 4 + when type = "DRAG" then wp = 5 + when type = "TOP" then wp = 6 when type = "BOTTOM" then wp = 7 - when type = "ENDSCROLL" then wp = 8 + when type = "ENDSCROLL" then wp = 8 otherwise return -1 end - ret = self~AddUserMsg(msgToRise, 0x00000114, "0xFFFFFFFF", wp, "0x0000FFFF", hnd, "0xFFFFFFFF") /* WM_HSCROLL */ + ret = self~addUserMsg(msgToRise, 0x00000114, "0xFFFFFFFF", wp, "0x0000FFFF", hnd, "0xFFFFFFFF") /* WM_HSCROLL */ if ret <> 0 then return ret - return self~AddUserMsg(msgToRise, 0x00000115, "0xFFFFFFFF", wp, "0x0000FFFF", hnd, "0xFFFFFFFF") /* WM_VSCROLL */ + return self~addUserMsg(msgToRise, 0x00000115, "0xFFFFFFFF", wp, "0x0000FFFF", hnd, "0xFFFFFFFF") /* WM_VSCROLL */ -::method ConnectTabNotify - use arg id, type, msgToRise - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectTabNotify + use strict arg id, type, msgToRise = "" + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if Arg(3,'o') = 1 then msgToRise = "On" || type + if msgToRise == "" then msgToRise = "on" || type type = type~translate select when type = "KEYDOWN" then lp = -550 @@ -289,17 +283,17 @@ when type = "SELCHANGING" then lp = -552 otherwise return -1 end - return self~AddUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", lp, "0xFFFFFFFF") + return self~addUserMsg(msgToRise, 0x0000004E, "0xFFFFFFFF", id, "0xFFFFFFFF", lp, "0xFFFFFFFF") -::method ConnectSliderNotify /* can only be called in InitDialog */ - use arg id, type, msgToRise, category - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectSliderNotify /* can only be called in InitDialog */ + use strict arg id, type, msgToRise = "", category = 1 + if \ id~dataType("W") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - if Arg(4,'o') = 1 then hwnd = self~GetItem(id) - else hwnd = self~GetItem(id, category) + if arg(4,'O') then hwnd = self~getItem(id) + else hwnd = self~getItem(id, category) if hwnd = 0 then return -1 - if Arg(3,'o') = 1 then msgToRise = "On" || type + if msgToRise == "" then msgToRise = "on" || type type = type~translate select when type = "UP" then wp =0 @@ -313,16 +307,16 @@ when type = "ENDTRACK" then wp =8 otherwise return -1 end - ret = self~AddUserMsg(msgToRise, 0x00000114, "0xFFFFFFFF", wp, "0x0000FFFF", hwnd, "0xFFFFFFFF") /* WM_HSCROLL */ + ret = self~addUserMsg(msgToRise, 0x00000114, "0xFFFFFFFF", wp, "0x0000FFFF", hwnd, "0xFFFFFFFF") /* WM_HSCROLL */ if ret <> 0 then return ret - return self~AddUserMsg(msgToRise, 0x00000115, "0xFFFFFFFF", wp, "0x0000FFFF", hwnd, "0xFFFFFFFF") /* WM_VSCROLL */ + return self~addUserMsg(msgToRise, 0x00000115, "0xFFFFFFFF", wp, "0x0000FFFF", hwnd, "0xFFFFFFFF") /* WM_VSCROLL */ ::method connectStaticNotify use strict arg id, type, msgToRaise = "" if \ id~DataType("W") then id = self~ResolveSymbolicId(id) if id = -1 then return -1 - if msgToRaise == "" then msgToRaise = "On" || type + if msgToRaise == "" then msgToRaise = "on" || type type = type~translate select when type = "CLICK" then lp = 0 @@ -331,7 +325,7 @@ when type = "DISABLE" then lp = 3 otherwise return -1 end - return self~AddUserMsg(msgToRaise, 0x00000111, "0xFFFFFFFF", lp~x2d * X2D("10000") + id, "0xFFFFFFFF", 0, 0) + return self~addUserMsg(msgToRaise, 0x00000111, "0xFFFFFFFF", lp~x2d * x2d("10000") + id, "0xFFFFFFFF", 0, 0) ::method DefTreeEditStarter Modified: main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp 2009-07-04 00:49:31 UTC (rev 4871) +++ main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp 2009-07-04 01:32:08 UTC (rev 4872) @@ -920,17 +920,37 @@ /** PlainBaseDialog::addUserMessage() * - * Adds a message to the message table. This method is what implements the - * connection of a Windows event to a dialog method. + * Adds a message to the message table. * + * Each entry in the message table connects a Windows event message to a method + * in a Rexx dialog. The fields for the entry consist of the Windows message, + * the WPARAM and LPARAM for the message, a filter for the message and its + * parameters, and the method name. Using the proper filters for the Windows + * message and its parameters allows the mapping of a very specific Windows + * event to the named method. * - * @note In the past this method returned 0 for okay and 1 for error, even - * though the underlying implementation, AddTheMessage() returned true / - * false for success / failure. Although the return was never - * documented. So, I guess maintain the original return code, although - * true / false make more sense. + * @param methodName [required] The method name to be connected. + * @param wm [required] The Windows event message + * @param _wmFilter [optional] Filter applied to the Windows message. If + * omitted the filter is 0xFFFFFFFF. + * @param wp [optional] WPARAM for the message + * @param _wpFilter [optional] Filter applied to the WPARAM. If omitted a + * filter of all hex Fs is applied + * @param lp [optional] LPARAM for the message. + * @param _lpFilter [optional] Filter applied to LPARAM. If omitted the + * filter is all hex Fs. + * @param tag [optional] A tag that allows a further differentiation + * between messages. This is an internal mechanism not to + * be documented publicly. + * + * @return 0 on success, 1 on failure. One possible source of error is the + * message table being full. + * + * @remarks Although it would make more sense to return true on succes and + * false on failure, there is too much old code that relies on 0 for + * success and 1 for error. */ -RexxMethod9(logical_t, pbdlg_addUserMessage, CSTRING, methodName, CSTRING, _winMessage, OPTIONAL_CSTRING, _wmFilter, +RexxMethod9(logical_t, pbdlg_addUserMessage, CSTRING, methodName, CSTRING, wm, OPTIONAL_CSTRING, _wmFilter, OPTIONAL_RexxObjectPtr, wp, OPTIONAL_CSTRING, _wpFilter, OPTIONAL_RexxObjectPtr, lp, OPTIONAL_CSTRING, _lpFilter, OPTIONAL_uint32_t, tag, OSELF, self) { @@ -944,6 +964,7 @@ } if ( *methodName == '\0' ) { + c->RaiseException1(Rexx_Error_Invalid_argument_null, TheOneObj); goto done_out; } @@ -951,7 +972,7 @@ UINT winMessage; UINT wmFilter; - if ( ! rxStr2Number(context, _winMessage, &number, 2) ) + if ( ! rxStr2Number(context, wm, &number, 2) ) { goto done_out; } @@ -1014,7 +1035,17 @@ lpFilter = (number == 0xFFFFFFFF ? (ULONG_PTR)SIZE_MAX : (ULONG_PTR)number); } - result = ! AddTheMessage(dlgAdm, winMessage, wmFilter, wParam, wpFilter, lParam, lpFilter, methodName, tag); + if ( (winMessage | wParam | lParam) == 0 ) + { + userDefinedMsgException(context, "The wm, wp, and lp arguements can not all be 0" ); + } + else + { + if ( AddTheMessage(dlgAdm, winMessage, wmFilter, wParam, wpFilter, lParam, lpFilter, methodName, tag) ) + { + result = 0; + } + } done_out: return result; Modified: main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp 2009-07-04 00:49:31 UTC (rev 4871) +++ main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp 2009-07-04 01:32:08 UTC (rev 4872) @@ -648,12 +648,12 @@ SetSysPalColors(dlgAdm->ColorPalette); } - if (!strlen(argv[2].strptr)) + if ( strlen(argv[2].strptr) == 0 ) { dlgAdm->BT_size ++; RETC(0) - } else - if (AddTheMessage(dlgAdm, WM_COMMAND, UINT32_MAX, atoi(buffer[0]), 0x0000FFFF, 0, 0, argv[2].strptr, 0)) + } + else if ( AddTheMessage(dlgAdm, WM_COMMAND, UINT32_MAX, atoi(buffer[0]), 0x0000FFFF, 0, 0, argv[2].strptr, 0) ) { dlgAdm->BT_size ++; RETC(0) Modified: main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp 2009-07-04 00:49:31 UTC (rev 4871) +++ main/trunk/extensions/platform/windows/oodialog/oovmsg.cpp 2009-07-04 01:32:08 UTC (rev 4872) @@ -450,20 +450,28 @@ } +/** + * + * + * + * @param aDlg + * @param winMsg + * @param wmFilter + * @param wParam + * @param wpFilter + * @param lParam + * @param lpFilter + * @param prog + * @param ulTag + * + * @return BOOL + * + * @remarks Caller must ensure that 'prog' is not an empty string and that + * winMsg, wParam, lParam are not all 0. + */ BOOL AddTheMessage(DIALOGADMIN * aDlg, UINT winMsg, UINT wmFilter, WPARAM wParam, ULONG_PTR wpFilter, LPARAM lParam, ULONG_PTR lpFilter, CSTRING prog, ULONG ulTag) { - size_t len = strlen(prog); - - if ( strlen(prog) == 0 ) - { - return FALSE; - } - if ( ! (winMsg | wParam | lParam) ) - { - MessageBox(0, "Message passed is invalid", "Error", MB_OK | MB_ICONHAND); - return FALSE; - } if ( ! aDlg->MsgTab ) { aDlg->MsgTab = (MESSAGETABLEENTRY *)LocalAlloc(LPTR, sizeof(MESSAGETABLEENTRY) * MAX_MT_ENTRIES); @@ -477,7 +485,7 @@ if ( aDlg->MT_size < MAX_MT_ENTRIES ) { - aDlg->MsgTab[aDlg->MT_size].rexxProgram = (PCHAR)LocalAlloc(LMEM_FIXED, len + 1); + aDlg->MsgTab[aDlg->MT_size].rexxProgram = (PCHAR)LocalAlloc(LMEM_FIXED, strlen(prog) + 1); if ( aDlg->MsgTab[aDlg->MT_size].rexxProgram == NULL ) { return FALSE; @@ -499,7 +507,7 @@ { MessageBox(0, "Messages have exceeded the maximum number of allocated\n" "table entries. No message can be added.\n", - "Error",MB_OK | MB_ICONHAND); + "Error", MB_OK | MB_ICONHAND); } return FALSE; } Modified: main/trunk/extensions/platform/windows/oodialog/plbdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-07-04 00:49:31 UTC (rev 4871) +++ main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-07-04 01:32:08 UTC (rev 4872) @@ -329,59 +329,58 @@ /** PlainBaseDialog::init() Performs the necessary intialization, including the * set up of the dialog management block, for all dialogs. */ -::method Init protected - expose Library Resource DlgData. - use arg Library, Resource, DlgData., includeFile +::method init protected + expose library resource dlgData. + use arg library, resource, dlgData., includeFile - self~Adm = 0 - self~ParentDlg = .Nil + self~adm = 0 + self~parentDlg = .nil - /* Initialize the WindowBase */ + -- Initialize the WindowBase self~initCode = self~init_WindowBase - /* prepare the dialog management for a new dialog */ - self~Adm = HandleDialogAdmin() /* allocate a new dialog table */ - if self~Adm = 0 then do - self~Deinstall - self~InitCode = 1 + -- Allocate the dialog management block for a new dialog + self~adm = HandleDialogAdmin() + if self~adm = 0 then do + self~deinstall + self~initCode = 1 return 1 end - /* call methods to get dialog settings */ - self~InitAutoDetection - /* create array storing connection between ids and attributes */ - self~DataConnection = .array~new(50) - /* there was no stem argument so don't use stems */ - if Arg(3, 'o') = 1 then self~UseStem = 0; else self~UseStem = 1 + -- call methods to get dialog settings + self~initAutoDetection + -- create array storing connection between ids and attributese */ + self~dataConnection = .array~new(50) + -- if there is no stem argument the don't use stems + if arg(3, 'O') then self~useStem = 0; else self~useStem = 1 self~finished = 0 - self~AutomaticMethods = .queue~new /* create a new queue */ - self~AddUserMsg("OK", 0x00000111, 0xFFFFFFFF, 1, 0xFFFFFFFF, 0, 0) - self~AddUserMsg("Cancel", 0x00000111, 0xFFFFFFFF, 2, 0xFFFFFFFF, 0, 0) - self~AddUserMsg("Help", 0x00000111, 0xFFFFFFFF, 9, 0xFFFFFFFF, 0, 0) - self~ProcessingLoad = 0 - self~DlgHandle = 0 - self~ChildDialogs = .list~new + self~automaticMethods = .queue~new + self~addUserMsg("OK", 0x00000111, 0xFFFFFFFF, 1, 0xFFFFFFFF, 0, 0) + self~addUserMsg("Cancel", 0x00000111, 0xFFFFFFFF, 2, 0xFFFFFFFF, 0, 0) + self~addUserMsg("Help", 0x00000111, 0xFFFFFFFF, 9, 0xFFFFFFFF, 0, 0) + self~processingLoad = 0 + self~dlgHandle = 0 + self~childDialogs = .list~new - self~ConstDir = .directory~new - self~ConstDir["IDOK"] = 1 - self~ConstDir["IDCANCEL"] = 2 - self~ConstDir["IDHELP"] = 9 + self~constDir = .directory~new + self~constDir["IDOK"] = 1 + self~constDir["IDCANCEL"] = 2 + self~constDir["IDHELP"] = 9 -- Common in Microsoft compatible resource script files - self~ConstDir["IDC_STATIC"] = -1 + self~constDir["IDC_STATIC"] = -1 -- ooDialog supplied resources, defined in oodSymbols.h - self~ConstDir["IDI_DLG_OODIALOG"] = 11 - self~ConstDir["IDI_DLG_APPICON"] = 12 - self~ConstDir["IDI_DLG_APPICON2"] = 13 - self~ConstDir["IDI_DLG_OOREXX"] = 14 - self~ConstDir["IDI_DLG_DEFAULT"] = 12 + self~constDir["IDI_DLG_OODIALOG"] = 11 + self~constDir["IDI_DLG_APPICON"] = 12 + self~constDir["IDI_DLG_APPICON2"] = 13 + self~constDir["IDI_DLG_OOREXX"] = 14 + self~constDir["IDI_DLG_DEFAULT"] = 12 self~fontName = .PlainBaseDialog~getFontName self~fontSize = .PlainBaseDialog~getFontSize - if arg(4, 'E') then - self~ParseIncludeFile(includeFile) + if arg(4, 'E') then self~parseIncludeFile(includeFile) return 0 @@ -537,77 +536,55 @@ -- Connect WM_HELP messages (F1) to a method. -::method ConnectHelp +::method connectHelp use strict arg msgToRise return self~addUserMsg(msgToRise, "0x00000053", "0xFFFFFFFF", 0, 0, 0, 0, 0x00000101) -/* The following methods create a connection between a class method */ -/* and a dialog item (dialog control). The connected method will be */ -/* called whenever the dialog item will be activated (i.g. a push */ -/* button will be pushed) */ +::method connectButton + use strict arg id, msgToRise + if \ id~dataType("N") then id = self~resolveSymbolicId(id) + if id = -1 then return -1 + if id < 3 | id = 9 then return .true + return self~addUserMsg(msgToRise, 0x00000111, 0xFFFFFFFF, id, 0xFFFFFFFF, 0, 0) - /* Connect a push button with a method */ - -::method ConnectButton - use arg id, msgToRise - if Arg(2, 'o') = 1 then msgToRise = "" - if id~DataType("N") = 0 then do - if self~ProcessingLoad = 1 then msgToRise = id - id = self~ResolveSymbolicId(id) - if id = -1 then return -1 - end - if id < 3 | id = 9 then return 0 - return self~AddUserMsg(msgToRise, 0x00000111, 0xFFFFFFFF, id, 0xFFFFFFFF, 0, 0) - - - /* Connect any dialog control with a method */ - -::method ConnectControl - use arg id, msgToRise - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectControl + use strict arg id, msgToRise + if \ id~dataType("N") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - return self~AddUserMsg(msgToRise, 0x00000111, 0xFFFFFFFF, id, 0x0000FFFF, 0,0) + return self~addUserMsg(msgToRise, 0x00000111, 0xFFFFFFFF, id, 0x0000FFFF, 0,0) - - /* Connect a list with a method */ - -::method ConnectList - use arg id, msgToRise - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectList + use strict arg id, msgToRise + if \ id~dataType("N") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - return self~AddUserMsg(msgToRise, 0x00000111, 0xFFFFFFFF, '0x0001'||id~d2x(4), 0xFFFFFFFF, 0, 0) + return self~addUserMsg(msgToRise, 0x00000111, 0xFFFFFFFF, '0x0001'||id~d2x(4), 0xFFFFFFFF, 0, 0) - /* Connect a list left double-click with a method */ - -::method ConnectListLeftDoubleClick - use arg id, msgToRise - if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) +::method connectListLeftDoubleClick + use strict arg id, msgToRise + if \ id~dataType("N") then id = self~resolveSymbolicId(id) if id = -1 then return -1 - return self~AddUserMsg(msgToRise, 0x00000111, 0xFFFFFFFF, '0x0002'||id~d2x(4), 0xFFFFFFFF, 0, 0) + return self~addUserMsg(msgToRise, 0x00000111, 0xFFFFFFFF, '0x0002'||id~d2x(4), 0xFFFFFFFF, 0, 0) +::method addUserMsg unguarded external "LIBRARY oodialog pbdlg_addUserMessage" - /* Connect any Windows message with a class method */ - -::method AddUserMsg protected unguarded external "LIBRARY oodialog pbdlg_addUserMessage" - -::method ConnectFKeyPress unguarded +::method connectFKeyPress unguarded use strict arg msgToRaise if \ msgToRaise~isA(.String) then return -1 return WinAPI32Func("K", 'C', self~adm, self~dlgHandle, msgToRaise~translate, "FKEYS", "NONE") -::method ConnectKeyPress unguarded +::method connectKeyPress unguarded use strict arg msgToRaise, keys, filter = "" if \ msgToRaise~isA(.String) | \ keys~isA(.String) | \ filter~isA(.String) then return -1 if filter == "" then return WinAPI32Func("K", 'C', self~adm, self~dlgHandle, msgToRaise~translate, keys~space(0)) return WinAPI32Func("K", 'C', self~adm, self~dlgHandle, msgToRaise~translate, keys~space(0), filter~translate) -::method DisconnectKeyPress unguarded +::method cisconnectKeyPress unguarded use arg msgToRaise if arg(1, 'O') then return WinAPI32Func("K", 'R', self~adm) if \ msgToRaise~isA(.String) then return -1 return WinAPI32Func("K", 'R', self~adm, self~dlgHandle, msgToRaise~translate) -::method HasKeyPressConnection unguarded +::method hasKeyPressConnection unguarded use arg msgToRaise if arg(1, 'O') then ret = WinAPI32Func("K", 'Q', self~adm) else do Modified: main/trunk/extensions/platform/windows/oodialog/propsht.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/propsht.cls 2009-07-04 00:49:31 UTC (rev 4871) +++ main/trunk/extensions/platform/windows/oodialog/propsht.cls 2009-07-04 01:32:08 UTC (rev 4872) @@ -116,9 +116,9 @@ ,lbtext" 11 PreviousPage" rbtext" 12 NextPage", 1, "FIX") -::method InitDialog protected +::method initDialog protected /* this is to correct a redraw problem of a focused list view control that gets reactivated */ - self~AddUserMsg(PropSheetActivated, "0x00000006", "0xFFFFFFFF") /* WM_ACTIVATE */ + self~addUserMsg(PropSheetActivated, "0x00000006", "0xFFFFFFFF") /* WM_ACTIVATE */ tc = self~GetTabControl(9001, 0) if tc \= .Nil then do This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-07-14 00:26:24
|
Revision: 4913 http://oorexx.svn.sourceforge.net/oorexx/?rev=4913&view=rev Author: miesfeld Date: 2009-07-14 00:26:19 +0000 (Tue, 14 Jul 2009) Log Message: ----------- [2533788] ooDialog can create wrong object type for controls Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp main/trunk/extensions/platform/windows/oodialog/oodCommon.h main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp main/trunk/extensions/platform/windows/oodialog/oodialog.mak main/trunk/extensions/platform/windows/oodialog/oovother.cpp Added Paths: ----------- main/trunk/extensions/platform/windows/oodialog/oodControls.cpp Modified: main/trunk/extensions/platform/windows/oodialog/APICommon.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-07-13 01:47:23 UTC (rev 4912) +++ main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-07-14 00:26:19 UTC (rev 4913) @@ -367,7 +367,6 @@ return false; } return true; - } /** Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-07-13 01:47:23 UTC (rev 4912) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-07-14 00:26:19 UTC (rev 4913) @@ -46,109 +46,29 @@ ::class 'AdvancedControls' Mixinclass Object public ::method putControl private unguarded external "LIBRARY oodialog advCtrl_putControl_pvt" +::method getStaticControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getButtonControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getTreeControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getListControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getTabControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetEditControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetRadioButton unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetCheckBox unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetGroupBox unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetListBox unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetComboBox unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetScrollBar unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetProgressBar unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetSliderControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetMonthCalendar unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetDateTimePicker unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetControl unguarded private - use arg id, category, type - if arg(1, 'O') then return .nil - select - when type = "ST" then class = .StaticControl - when type = "EL" then class = .EditControl - when type = "BUT" then class = .ButtonControl - when type = "RB" then class = .RadioButton - when type = "CH" then class = .CheckBox - when type = "GB" then class = .GroupBox - when type = "LB" then class = .ListBox - when type = "CB" then class = .ComboBox - when type = "SB" then class = .ScrollBar - when type = "TC" then class = .TreeControl - when type = "LC" then class = .ListControl - when type = "PB" then class = .ProgressBar - when type = "SC" then class = .SliderControl - when type = "TAB" then class = .TabControl - when type = "DT" then class = .DateTimePicker - when type = "MC" then class = .MonthCalendar - otherwise return .Nil - end - ctrlobj = .nil - if arg(2, 'O') then do - /* check if dialog is subclass of CategoryDialog */ - if self~HasMethod("!MarkAsCatDlg!") = 1 then - ctrlobj = class~new(self, id, self~catalog['category']) /* suppose active page is meant */ - else - ctrlobj = class~new(self, id) - end - else do - ctrlobj = class~new(self, id, category) - end - - if ctrlobj \== .nil, ctrlobj~hwnd = 0 then - return .nil - else - return ctrlobj - - -::method getStaticControl unguarded external "LIBRARY oodialog advCtrl_getStaticControl" -::method getButtonControl unguarded external "LIBRARY oodialog advCtrl_getButtonControl" -::method getTreeControl unguarded external "LIBRARY oodialog advCtrl_getTreeControl" -::method getListControl unguarded external "LIBRARY oodialog advCtrl_getListControl" -::method getTabControl unguarded external "LIBRARY oodialog advCtrl_getTabControl" - -::method GetEditControl unguarded - arr = Arg(1,"A") - arr[3] = "EL" - forward message "GetControl" Arguments (arr) - ::method GetRadioControl unguarded - arr = Arg(1,"A") - arr[3] = "RB" - forward message "GetControl" Arguments (arr) + forward message "GetRadioButton" ::method GetCheckControl unguarded - arr = Arg(1,"A") - arr[3] = "CH" - forward message "GetControl" Arguments (arr) + forward message "GetCheckBox" -::method GetGroupBox unguarded - arr = Arg(1,"A") - arr[3] = "GB" - forward message "GetControl" Arguments (arr) - -::method GetListBox unguarded - arr = Arg(1,"A") - arr[3] = "LB" - forward message "GetControl" Arguments (arr) - -::method GetComboBox unguarded - arr = Arg(1,"A") - arr[3] = "CB" - forward message "GetControl" Arguments (arr) - -::method GetScrollBar unguarded - arr = Arg(1,"A") - arr[3] = "SB" - forward message "GetControl" Arguments (arr) - -::method GetProgressBar unguarded - arr = Arg(1,"A") - arr[3] = "PB" - forward message "GetControl" Arguments (arr) - -::method GetSliderControl unguarded - arr = Arg(1,"A") - arr[3] = "SC" - forward message "GetControl" Arguments (arr) - -::method GetMonthCalendar unguarded - arr = Arg(1,"A") - arr[3] = "MC" - forward message "GetControl" Arguments (arr) - -::method GetDateTimePicker unguarded - arr = Arg(1,"A") - arr[3] = "DT" - forward message "GetControl" Arguments (arr) - - ::method ConnectTreeControl unguarded use arg id, attributeName forward message "AddAttribute" continue Modified: main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp 2009-07-13 01:47:23 UTC (rev 4912) +++ main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp 2009-07-14 00:26:19 UTC (rev 4913) @@ -47,6 +47,7 @@ #include <stdio.h> #include <dlgs.h> #include <malloc.h> +#include <CommCtrl.h> #include "APICommon.h" #include "oodCommon.h" @@ -942,3 +943,104 @@ } +/** + * Determine if a dialog control belongs to the specified dialog control class. + * + * @param hControl Handle to the control. + * @param control One of the oodControl types specifying the class to check + * for. + * + * @return True if the dialog control is the type specified, otherwise false. + */ +bool checkControlClass(HWND hControl, oodControl_t control) +{ + TCHAR buf[64]; + TCHAR *pClass = NULL; + + switch ( control ) + { + case winStatic : + pClass = WC_STATIC; + break; + case winButton : + pClass = WC_BUTTON; + break; + case winTreeView : + pClass = WC_TREEVIEW; + break; + case winListView : + pClass = WC_LISTVIEW; + break; + case winTab : + pClass = WC_TABCONTROL; + break; + case winEdit : + pClass = WC_EDIT; + break; + case winRadioButton : + pClass = WC_BUTTON; + break; + case winCheckBox : + pClass = WC_BUTTON; + break; + case winGroupBox : + pClass = WC_BUTTON; + break; + case winListBox : + pClass = WC_LISTBOX; + break; + case winComboBox : + pClass = WC_COMBOBOX; + break; + case winScrollBar : + pClass = WC_SCROLLBAR; + break; + case winProgressBar : + pClass = PROGRESS_CLASS; + break; + case winTrackBar : + pClass = TRACKBAR_CLASS; + break; + case winMonthCalendar : + pClass = MONTHCAL_CLASS; + break; + case winDateTimePicker : + pClass = DATETIMEPICK_CLASS; + break; + default : + return false; + } + + if ( ! RealGetWindowClass(hControl, buf, sizeof(buf)) || strcmp(buf, pClass) ) + { + return false; + } + + if ( control == winCheckBox || control == winRadioButton || control == winGroupBox ) + { + BUTTONTYPE type = getButtonInfo(hControl, NULL, NULL); + switch ( control ) + { + case winCheckBox : + if ( type != check ) + { + return false; + } + break; + case winRadioButton : + if ( type != radio ) + { + return false; + } + break; + case winGroupBox : + if ( type != group ) + { + return false; + } + break; + } + } + return true; +} + Modified: main/trunk/extensions/platform/windows/oodialog/oodCommon.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodCommon.h 2009-07-13 01:47:23 UTC (rev 4912) +++ main/trunk/extensions/platform/windows/oodialog/oodCommon.h 2009-07-14 00:26:19 UTC (rev 4913) @@ -53,10 +53,13 @@ oodListBox, oodProgressBar, oodUnknown } oodClass_t; -// Enum for the type of Windows dialog control. +// Enum for the type of Windows dialog control. Note that a track bar is a +// SliderControl in ooDiaolg. ;-( typedef enum { - winStatic, winButton, winEdit, winProgressBar + winStatic, winButton, winTreeView, winListView, winTab, winEdit, winRadioButton, winCheckBox, + winGroupBox, winListBox, winComboBox, winScrollBar, winProgressBar, winTrackBar, winMonthCalendar, + winDateTimePicker, winUnknown } oodControl_t; extern BOOL DialogInAdminTable(DIALOGADMIN * Dlg); @@ -100,8 +103,14 @@ extern bool textSizeIndirect(RexxMethodContext *, CSTRING, CSTRING, uint32_t, SIZE *, HWND); extern bool textSizeFromWindow(RexxMethodContext *, CSTRING, SIZE *, HWND); extern bool getTextExtent(HFONT, HDC, CSTRING, SIZE *); +extern bool checkControlClass(HWND, oodControl_t); +// Shared button stuff. +typedef enum {push, check, radio, group, owner, notButton} BUTTONTYPE, *PBUTTONTYPE; +typedef enum {def, autoCheck, threeState, autoThreeState, noSubtype } BUTTONSUBTYPE, *PBUTTONSUBTYPE; +extern BUTTONTYPE getButtonInfo(HWND, PBUTTONSUBTYPE, DWORD *); + #define GET_HANDLE(p) string2pointer(p) #define GET_HWND(p) ((HWND)string2pointer(p)) #define GET_POINTER(p) string2pointer(p) Added: main/trunk/extensions/platform/windows/oodialog/oodControls.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodControls.cpp (rev 0) +++ main/trunk/extensions/platform/windows/oodialog/oodControls.cpp 2009-07-14 00:26:19 UTC (rev 4913) @@ -0,0 +1,376 @@ +/*----------------------------------------------------------------------------*/ +/* */ +/* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ +/* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */ +/* */ +/* This program and the accompanying materials are made available under */ +/* the terms of the Common Public License v1.0 which accompanies this */ +/* distribution. A copy is also available at the following address: */ +/* http://www.oorexx.org/license.html */ +/* */ +/* Redistribution and use in source and binary forms, with or */ +/* without modification, are permitted provided that the following */ +/* conditions are met: */ +/* */ +/* Redistributions of source code must retain the above copyright */ +/* notice, this list of conditions and the following disclaimer. */ +/* Redistributions in binary form must reproduce the above copyright */ +/* notice, this list of conditions and the following disclaimer in */ +/* the documentation and/or other materials provided with the distribution. */ +/* */ +/* Neither the name of Rexx Language Association nor the names */ +/* of its contributors may be used to endorse or promote products */ +/* derived from this software without specific prior written permission. */ +/* */ +/* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS */ +/* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT */ +/* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS */ +/* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT */ +/* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, */ +/* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED */ +/* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, */ +/* OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY */ +/* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING */ +/* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS */ +/* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +/* */ +/*----------------------------------------------------------------------------*/ + +/** + * oodControls.cpp + * + * Contains the base classes used for objects representing Windows Controls. + */ +#include "ooDialog.h" // Must be first, includes windows.h and oorexxapi.h + +//#include <stdio.h> +#include "APICommon.h" +#include "oodCommon.h" + + +/** + * Methods for the .DialogControl class. + */ +#define DIALOGCONTROL_CLASS "DialogControl" + + +/** DialogControl::getTextSizeDlg() + * + * Gets the size (width and height) in dialog units for any given string for + * the font specified. + * + * @param text The string whose size is needed. + * + * @param fontName Optional. If specified, use this font to calculate the + * size. + * + * @param fontSize Optional. If specified, use this font size with + * fontName to calculate the size. The default if omitted + * is 8. This arg is ignored if fontName is omitted. + * + * @param hwndFontSrc Optional. Use this window's font to calculate the size. + * This arg is always ignored if fontName is specified. + * + */ +RexxMethod5(RexxObjectPtr, dlgctrl_getTextSizeDlg, CSTRING, text, OPTIONAL_CSTRING, fontName, + OPTIONAL_uint32_t, fontSize, OPTIONAL_POINTERSTRING, hwndFontSrc, OSELF, self) +{ + HWND hwndSrc = NULL; + if ( argumentExists(2) ) + { + if ( argumentOmitted(3) ) + { + fontSize = DEFAULT_FONTSIZE; + } + } + else if ( argumentExists(4) ) + { + if ( hwndFontSrc == NULL ) + { + nullObjectException(context, "window handle", 4); + goto error_out; + } + hwndSrc = (HWND)hwndFontSrc; + } + + RexxObjectPtr dlgObj = context->SendMessage0(self, "ODLG"); + if ( dlgObj == NULLOBJECT ) + { + // The interpreter kernel will have raised a syntax exception in this + // case. But, the ooDialog framework traps the exception and puts up a + // message box saying ODLG is not a method of xx control. I think that + // will be confusing to the users, since they have no idea about this + // call to oDlg. So, raise a more specific exception. + context->RaiseException1(Rexx_Error_Interpretation_user_defined, + context->String("Inconsistency: this .DialogControl object does not have " + "the oDlg (owner dialog) attribute")); + goto error_out; + } + + return getTextSize(context, text, fontName, fontSize, hwndSrc, dlgObj); + +error_out: + return NULLOBJECT; +} + + +/** + * Methods for the .AdvancedControls class. + */ +#define ADVANCEDCONTROLS_CLASS "AdvancedControls" +#define ADVCTRLCONTROLBAG_ATTRIBUTE "!advCtrlDlgControlBag" + + +/** + * Given a CategoryDialog, retrieves the dialog handle corresponding to the + * given page ID. + * + * Note that it is expected that this function will be called from native + * methods where the pageID argument is possibly omitted in the Rexx method. + * The original implementation of ooDialog had a convention, if the category + * number is 0 it is meant to be a control in the main dialog. If it is omitted + * and the dialog is a category dialog, it is meant to be a control in the + * current category page. Because of this, we need to know if the pageID + * argument was omitted in order to evalute things correctly. + * + * @param c Method context we are operating under. + * + * @param categoryDlg The CategoryDialog object. + * + * @param pageID [in / out] The page ID of the category dialog. This + * argument is unchanged on return if a lookup of the active + * page is not done. When the active page is looked, the + * looked up page ID is returned here. + * + * @param hDlg [in / out] The handle of the page dialog is returned + * here, on success. Its value on entry is ignored. + * + * @return True if no error, otherwise false. + * + * @assumes the caller has already checked that categoryDlg is in fact a + * category dialog object. + * + * @remarks The 'CATALOG' attribute is set to a directory, the 'handles', and + * 'category' entries are added in the init() method of a + * CategoryDialog. They must be there or ooRexx is broken. So, no + * check for NULLOBJECT is done for them. Note that the indexes of + * the CATALOG directory are all lower case. + */ +bool getCategoryHDlg(RexxMethodContext *c, RexxObjectPtr categoryDlg, uint32_t *pageID, HWND *hDlg, bool idArgExists) +{ + bool result = false; + + if ( idArgExists && *pageID == 0 ) + { + *hDlg = rxGetWindowHandle(c, categoryDlg); + if ( *hDlg != NULL ) + { + result = true; + } + goto done_out; + } + + RexxDirectoryObject catalog = (RexxDirectoryObject)c->SendMessage0(categoryDlg, "CATALOG"); + RexxArrayObject handles = (RexxArrayObject)c->DirectoryAt(catalog, "handles"); + + if ( *pageID == 0 ) + { + // Look up the active page number. + RexxObjectPtr rxPageID = c->DirectoryAt(catalog, "category"); + + if ( ! c->UnsignedInt32(rxPageID, pageID) ) + { + // TODO an exception is probably needed. + goto done_out; + } + } + RexxObjectPtr rxHwnd = c->ArrayAt(handles, *pageID); + if ( rxHwnd != NULLOBJECT ) + { + *hDlg = (HWND)string2pointer(c->ObjectToStringValue(rxHwnd)); + result = true; + } + +done_out: + return result; +} + +RexxClassObject getControlClass(RexxMethodContext *c, CSTRING className, oodControl_t *controlType) +{ + oodControl_t ctrl = winUnknown; + RexxClassObject controlClass = NULLOBJECT; + + if ( strcmp(className, "STATICCONTROL" ) == 0 ) { ctrl = winStatic; } + else if ( strcmp(className, "BUTTONCONTROL" ) == 0 ) { ctrl = winButton; } + else if ( strcmp(className, "TREECONTROL" ) == 0 ) { ctrl = winTreeView; } + else if ( strcmp(className, "LISTCONTROL" ) == 0 ) { ctrl = winListView; } + else if ( strcmp(className, "TABCONTROL" ) == 0 ) { ctrl = winTab; } + else if ( strcmp(className, "EDITCONTROL" ) == 0 ) { ctrl = winEdit; } + else if ( strcmp(className, "RADIOBUTTON" ) == 0 ) { ctrl = winRadioButton; } + else if ( strcmp(className, "CHECKBOX" ) == 0 ) { ctrl = winCheckBox; } + else if ( strcmp(className, "GROUPBOX" ) == 0 ) { ctrl = winGroupBox; } + else if ( strcmp(className, "LISTBOX" ) == 0 ) { ctrl = winListBox; } + else if ( strcmp(className, "COMBOBOX" ) == 0 ) { ctrl = winComboBox; } + else if ( strcmp(className, "SCROLLBAR" ) == 0 ) { ctrl = winScrollBar; } + else if ( strcmp(className, "PROGRESSBAR" ) == 0 ) { ctrl = winProgressBar; } + else if ( strcmp(className, "SLIDERCONTROL" ) == 0 ) { ctrl = winTrackBar; } + else if ( strcmp(className, "MONTHCALENDAR" ) == 0 ) { ctrl = winMonthCalendar; } + else if ( strcmp(className, "DATETIMEPICKER") == 0 ) { ctrl = winDateTimePicker; } + + if ( ctrl == winUnknown ) + { + goto done_out; + } + + controlClass = rxGetContextClass(c, className); + if ( controlClass == NULLOBJECT ) + { + // An exception has been raised, which we don't want. So, clear it. + c->ClearCondition(); + } + +done_out: + *controlType = ctrl; + return controlClass; +} + +/** AdvancedControls::getXXXControl() + * + * Instantiates a DialogControl object for the specified Windows control. All + * of the AdvanceControls get methods filter through this function. + * getEditControl(), getButtonControl(), getListControl(), etc.. + * + * @param rxID The resource ID of the control to get. + * + * @param categoryPageID [optional] If the dialog is a category dialog, this + * indicates which page of the dialog the control is on. + * + * @returns The properly instantiated dialog control object on success, or the + * nil object on failure. + * + * @remarks Replaces / combines the individualy getXXXControl() and the + * getControl() methods of the AdvancedControl class. Either returns + * the control object asked for, or .nil. + * + * The first time a Rexx object is instantiated for a specific Windows + * control, the Rexx object is stored in the window words of the + * control. Before a Rexx object is instantiated, the window words are + * checked to see if there is already an instantiated object and if so + * returns that object. + */ +RexxMethod3(RexxObjectPtr, advCtrl_getControl, RexxObjectPtr, rxID, OPTIONAL_uint32_t, categoryPageID, OSELF, self) +{ + RexxMethodContext *c = context; + RexxObjectPtr result = TheNilObj; + + bool isCategoryDlg = false; + HWND hDlg = NULL; + + if ( c->IsOfType(self, "CATEGORYDIALOG") ) + { + if ( ! getCategoryHDlg(context, self, &categoryPageID, &hDlg, argumentExists(2)) ) + { + goto out; + } + isCategoryDlg = true; + } + else + { + hDlg = rxGetWindowHandle(c, self); + if ( hDlg == NULL ) + { + goto out; + } + } + + uint32_t id; + if ( ! oodSafeResolveID(&id, c, self, rxID, -1, 1) ) + { + goto out; + } + + HWND hControl = NULL; + RexxObjectPtr rxControl = NULLOBJECT; + + hControl = GetDlgItem(hDlg, (int)id); + if ( hControl != NULL ) + { + rxControl = (RexxObjectPtr)getWindowPtr(hControl, GWLP_USERDATA); + if ( rxControl != NULLOBJECT ) + { + // Okay, this specific control has already had a control object + // instantiated to represent it. We return this object. + result = rxControl; + goto out; + } + } + + // No pointer is stored in the user data area, so no control object has been + // instantiated for this specific control, yet. We instantiate one now and + // then store the object in the user data area of the control window. + oodControl_t controlType; + RexxClassObject controlCls = getControlClass(context, c->GetMessageName() + 3, &controlType); + if ( controlCls == NULLOBJECT ) + { + goto out; + } + + // Check that the underlying Windows control is the control type requested + // by the programmer. Return .nil if this is not true. + if ( ! checkControlClass(hControl, controlType) ) + { + goto out; + } + + // TODO Much of the information we just determined, is re-determined in the + // new method of the dialog control. It would be nice to change the new + // method to take a .Pointer object and rewrite the new method as a native + // API method and pass this information directly. + RexxArrayObject args; + if ( isCategoryDlg ) + { + args = c->ArrayOfThree(self, c->UnsignedInt32(id), c->UnsignedInt32(categoryPageID)); + } + else + { + args = c->ArrayOfTwo(self, c->UnsignedInt32(id)); + } + + rxControl = c->SendMessage(controlCls, "NEW", args); + if ( rxControl != NULLOBJECT && rxControl != TheNilObj ) + { + // In the old Rexx implementing code, there was the possibility here + // that we would have a control object that would not be valid and have + // its hwnd set to 0. That is no longer possible. + result = rxControl; + + setWindowPtr(hControl, GWLP_USERDATA, (LONG_PTR)result); + c->SendMessage1(self, "putControl", result); + } + +out: + return result; +} + +RexxMethod2(RexxObjectPtr, advCtrl_putControl_pvt, RexxObjectPtr, control, OSELF, self) +{ + // This should never fail, do we need an exception if it does? + + RexxObjectPtr bag = context->GetObjectVariable(ADVCTRLCONTROLBAG_ATTRIBUTE); + if ( bag == NULLOBJECT ) + { + RexxObjectPtr theBagClass = context->FindClass("BAG"); + if ( theBagClass != NULLOBJECT ) + { + bag = context->SendMessage0(theBagClass, "NEW"); + context->SetObjectVariable(ADVCTRLCONTROLBAG_ATTRIBUTE, bag); + } + } + + if ( bag != NULLOBJECT ) + { + context->SendMessage2(bag, "PUT", control, control); + } + + return TheNilObj; +} Modified: main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp 2009-07-13 01:47:23 UTC (rev 4912) +++ main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp 2009-07-14 00:26:19 UTC (rev 4913) @@ -260,11 +260,7 @@ REXX_METHOD_PROTOTYPE(dlgctrl_getTextSizeDlg); -REXX_METHOD_PROTOTYPE(advCtrl_getStaticControl); -REXX_METHOD_PROTOTYPE(advCtrl_getButtonControl); -REXX_METHOD_PROTOTYPE(advCtrl_getListControl); -REXX_METHOD_PROTOTYPE(advCtrl_getTreeControl); -REXX_METHOD_PROTOTYPE(advCtrl_getTabControl); +REXX_METHOD_PROTOTYPE(advCtrl_getControl); REXX_METHOD_PROTOTYPE(advCtrl_putControl_pvt); REXX_METHOD_PROTOTYPE(lv_setImageList); @@ -505,11 +501,7 @@ REXX_METHOD(dlgctrl_getTextSizeDlg, dlgctrl_getTextSizeDlg), - REXX_METHOD(advCtrl_getStaticControl, advCtrl_getStaticControl), - REXX_METHOD(advCtrl_getButtonControl, advCtrl_getButtonControl), - REXX_METHOD(advCtrl_getListControl, advCtrl_getListControl), - REXX_METHOD(advCtrl_getTreeControl, advCtrl_getTreeControl), - REXX_METHOD(advCtrl_getTabControl, advCtrl_getTabControl), + REXX_METHOD(advCtrl_getControl, advCtrl_getControl), REXX_METHOD(advCtrl_putControl_pvt, advCtrl_putControl_pvt), REXX_METHOD(lv_setImageList, lv_setImageList), Modified: main/trunk/extensions/platform/windows/oodialog/oodialog.mak =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodialog.mak 2009-07-13 01:47:23 UTC (rev 4912) +++ main/trunk/extensions/platform/windows/oodialog/oodialog.mak 2009-07-14 00:26:19 UTC (rev 4913) @@ -51,13 +51,14 @@ SOURCEF= $(OR_OUTDIR)\ooDialog.obj $(OR_OUTDIR)\oovdata.obj $(OR_OUTDIR)\oovtext.obj $(OR_OUTDIR)\oodCommon.obj \ $(OR_OUTDIR)\oovmsg.obj $(OR_OUTDIR)\oovscrll.obj $(OR_OUTDIR)\oovdeskt.obj $(OR_OUTDIR)\oovdraw.obj \ $(OR_OUTDIR)\oovuser.obj $(OR_OUTDIR)\oovbmp.obj $(OR_OUTDIR)\oovother.obj $(OR_OUTDIR)\oodMenu.obj \ - $(OR_OUTDIR)\oodPackageEntry.obj $(OR_OUTDIR)\APICommon.obj $(OR_OUTDIR)\oodRoutines.obj $(OR_OUTDIR)\oodialog.res + $(OR_OUTDIR)\oodPackageEntry.obj $(OR_OUTDIR)\APICommon.obj $(OR_OUTDIR)\oodRoutines.obj \ + $(OR_OUTDIR)\oodControls.obj $(OR_OUTDIR)\oodialog.res # All Source files that include oodCommon.h COMMON_SOURCEF = $(OR_OUTDIR)\oodCommon.obj $(OR_OUTDIR)\oodMenu.obj $(OR_OUTDIR)\oodRoutines.obj \ $(OR_OUTDIR)\oovbmp.obj $(OR_OUTDIR)\oovdata.obj $(OR_OUTDIR)\oovdeskt.obj $(OR_OUTDIR)\oovdraw.obj \ $(OR_OUTDIR)\oovmsg.obj $(OR_OUTDIR)\oovother.obj $(OR_OUTDIR)\oovscrll.obj $(OR_OUTDIR)\oovtext.obj \ - $(OR_OUTDIR)\oovuser.obj $(OR_OUTDIR)\ooDialog.obj + $(OR_OUTDIR)\oovuser.obj $(OR_OUTDIR)\ooDialog.obj $(OR_OUTDIR)\oodControls.obj # All Source files that include APICommon.h COMMON_SOURCEF = $(OR_OUTDIR)\APICommon.obj $(OR_OUTDIR)\oodCommon.obj $(OR_OUTDIR)\oodMenu.obj $(OR_OUTDIR)\oovother.obj \ Modified: main/trunk/extensions/platform/windows/oodialog/oovother.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-07-13 01:47:23 UTC (rev 4912) +++ main/trunk/extensions/platform/windows/oodialog/oovother.cpp 2009-07-14 00:26:19 UTC (rev 4913) @@ -104,9 +104,6 @@ #define BS_IMAGEMASK 0x000000c0 #define MIN_HALFHEIGHT_GB 12 -typedef enum {push, check, radio, group, owner, notButton} BUTTONTYPE, *PBUTTONTYPE; -typedef enum {def, autoCheck, threeState, autoThreeState, noSubtype } BUTTONSUBTYPE, *PBUTTONSUBTYPE; - /** * Defines, structs, etc., for the .ImageList class. */ @@ -1050,18 +1047,6 @@ } /** - * Determine if a window belongs to the specified window class. - */ -static bool checkWindowClass(HWND hwnd, TCHAR *pClass) -{ - TCHAR buf[64]; - - if ( ! RealGetWindowClass(hwnd, buf, sizeof(buf)) || strcmp(buf, pClass) ) - return false; - return true; -} - -/** * Extended Common Control functionality. This function implements capabilities * for the common controls that were not available at the time of the original * IBM ooDialog, or were available but not put into ooDialog. @@ -1122,7 +1107,7 @@ */ if ( argv[2].strptr[0] == 'E' ) /* Edit control function */ { - if ( ! checkWindowClass(hCtrl, WC_EDIT) ) + if ( ! checkControlClass(hCtrl, winEdit) ) RETVAL(-1) if ( strcmp(argv[3].strptr, "TXT") == 0 ) /* Set or get the control's text. */ @@ -3101,196 +3086,6 @@ } /** - * Methods for the .DialogControl class. - */ -#define DIALOGCONTROL_CLASS "DialogControl" - - -/** DialogControl::getTextSizeDlg() - * - * Gets the size (width and height) in dialog units for any given string for - * the font specified. - * - * @param text The string whose size is needed. - * - * @param fontName Optional. If specified, use this font to calculate the - * size. - * - * @param fontSize Optional. If specified, use this font size with - * fontName to calculate the size. The default if omitted - * is 8. This arg is ignored if fontName is omitted. - * - * @param hwndFontSrc Optional. Use this window's font to calculate the size. - * This arg is always ignored if fontName is specified. - * - */ -RexxMethod5(RexxObjectPtr, dlgctrl_getTextSizeDlg, CSTRING, text, OPTIONAL_CSTRING, fontName, - OPTIONAL_uint32_t, fontSize, OPTIONAL_POINTERSTRING, hwndFontSrc, OSELF, self) -{ - HWND hwndSrc = NULL; - if ( argumentExists(2) ) - { - if ( argumentOmitted(3) ) - { - fontSize = DEFAULT_FONTSIZE; - } - } - else if ( argumentExists(4) ) - { - if ( hwndFontSrc == NULL ) - { - nullObjectException(context, "window handle", 4); - goto error_out; - } - hwndSrc = (HWND)hwndFontSrc; - } - - RexxObjectPtr dlgObj = context->SendMessage0(self, "ODLG"); - if ( dlgObj == NULLOBJECT ) - { - // The interpreter kernel will have raised a syntax exception in this - // case. But, the ooDialog framework traps the exception and puts up a - // message box saying ODLG is not a method of xx control. I think that - // will be confusing to the users, since they have no idea about this - // call to oDlg. So, raise a more specific exception. - context->RaiseException1(Rexx_Error_Interpretation_user_defined, - context->String("Inconsistency: this .DialogControl object does not have " - "the oDlg (owner dialog) attribute")); - goto error_out; - } - - return getTextSize(context, text, fontName, fontSize, hwndSrc, dlgObj); - -error_out: - return NULLOBJECT; -} - - -/** - * Methods for the .AdvancedControls class. - */ -#define ADVANCEDCONTROLS_CLASS "AdvancedControls" -#define ADVCTRLCONTROLBAG_ATTRIBUTE "!advCtrlDlgControlBag" - - -RexxObjectPtr advGetControl(RexxMethodContext *c, ARGLIST args, OSELF self, CSTRING ctrl) -{ - RexxObjectPtr result = TheNilObj; - - HWND hwnd = rxGetWindowHandle(c, self); - if ( hwnd == NULL ) - { - // This happens if the user were to invoke a getXXXControl() method - // before the underlying dialog has been created. - goto out; - } - - HWND hControl = NULL; - RexxObjectPtr rxControl = NULLOBJECT; - - // We have the dialog window handle. We also need the resource ID to get - // the control. - RexxObjectPtr rxID = c->ArrayAt(args, 1); - if ( rxID == NULLOBJECT ) - { - c->RaiseException1(Rexx_Error_Incorrect_method_noarg, TheOneObj); - goto out; - } - - uint32_t id; - if ( ! oodSafeResolveID(&id, c, self, rxID, 0, 1) ) - { - goto out; - } - else - { - hControl = GetDlgItem(hwnd, (int)id); - } - - if ( hControl != NULL ) - { - rxControl = (RexxObjectPtr)getWindowPtr(hControl, GWLP_USERDATA); - if ( rxControl != NULLOBJECT ) - { - // Okay, this specific control has already had a control object - // instantiated to represent it. We return this object. - result = rxControl; - goto out; - } - } - - // No pointer is stored in the user data area, so no control object has been - // instantiated for this specific control, yet. We instantiate one now and - // then store the object in the user data area of the control window. - c->ArrayPut(args, c->String(ctrl), 3); - rxControl = c->ForwardMessage(NULLOBJECT, "GetControl", NULLOBJECT, args); - if ( rxControl == NULLOBJECT ) - { - goto out; - } - result = rxControl; - - if ( result != TheNilObj ) - { - // Good object. - setWindowPtr(hControl, GWLP_USERDATA, (LONG_PTR)result); - c->SendMessage1(self, "putControl", result); - } - -out: - return result; -} - -RexxMethod2(RexxObjectPtr, advCtrl_getStaticControl, ARGLIST, args, OSELF, self) -{ - return advGetControl(context, args, self, "ST"); -} - -RexxMethod2(RexxObjectPtr, advCtrl_getButtonControl, ARGLIST, args, OSELF, self) -{ - return advGetControl(context, args, self, "BUT"); -} - -RexxMethod2(RexxObjectPtr, advCtrl_getListControl, ARGLIST, args, OSELF, self) -{ - return advGetControl(context, args, self, "LC"); -} - -RexxMethod2(RexxObjectPtr, advCtrl_getTreeControl, ARGLIST, args, OSELF, self) -{ - return advGetControl(context, args, self, "TC"); -} - -RexxMethod2(RexxObjectPtr, advCtrl_getTabControl, ARGLIST, args, OSELF, self) -{ - return advGetControl(context, args, self, "TAB"); -} - -RexxMethod2(RexxObjectPtr, advCtrl_putControl_pvt, RexxObjectPtr, control, OSELF, self) -{ - // This should never fail, do we need an exception if it does? - - RexxObjectPtr bag = context->GetObjectVariable(ADVCTRLCONTROLBAG_ATTRIBUTE); - if ( bag == NULLOBJECT ) - { - RexxObjectPtr theBagClass = context->FindClass("BAG"); - if ( theBagClass != NULLOBJECT ) - { - bag = context->SendMessage0(theBagClass, "NEW"); - context->SetObjectVariable(ADVCTRLCONTROLBAG_ATTRIBUTE, bag); - } - } - - if ( bag != NULLOBJECT ) - { - context->SendMessage2(bag, "PUT", control, control); - } - - return TheNilObj; -} - - -/** * Methods for the DateTimePicker class. */ #define DATETIMEPICKER_CLASS "DateTimePicker" @@ -4698,9 +4493,10 @@ BUTTONTYPE getButtonInfo(HWND hwnd, PBUTTONSUBTYPE sub, DWORD *style) { + TCHAR buf[64]; BUTTONTYPE type = notButton; - if ( ! checkWindowClass(hwnd, WC_BUTTON) ) + if ( ! RealGetWindowClass(hwnd, buf, sizeof(buf)) || strcmp(buf, WC_BUTTON) ) { if ( sub != NULL ) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-07-16 20:25:26
|
Revision: 4933 http://oorexx.svn.sourceforge.net/oorexx/?rev=4933&view=rev Author: miesfeld Date: 2009-07-16 20:25:23 +0000 (Thu, 16 Jul 2009) Log Message: ----------- getRadioButton and getCheckBox were already methods, so they can not be used as an alias for getRadioControl and getCheckControl Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/oodControls.cpp Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-07-16 17:13:31 UTC (rev 4932) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-07-16 20:25:23 UTC (rev 4933) @@ -52,8 +52,8 @@ ::method getListControl unguarded external "LIBRARY oodialog advCtrl_getControl" ::method getTabControl unguarded external "LIBRARY oodialog advCtrl_getControl" ::method GetEditControl unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetRadioButton unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetCheckBox unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetRadioControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method GetCheckControl unguarded external "LIBRARY oodialog advCtrl_getControl" ::method GetGroupBox unguarded external "LIBRARY oodialog advCtrl_getControl" ::method GetListBox unguarded external "LIBRARY oodialog advCtrl_getControl" ::method GetComboBox unguarded external "LIBRARY oodialog advCtrl_getControl" @@ -63,12 +63,6 @@ ::method GetMonthCalendar unguarded external "LIBRARY oodialog advCtrl_getControl" ::method GetDateTimePicker unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetRadioControl unguarded - forward message "GetRadioButton" - -::method GetCheckControl unguarded - forward message "GetCheckBox" - ::method ConnectTreeControl unguarded use arg id, attributeName forward message "AddAttribute" continue Modified: main/trunk/extensions/platform/windows/oodialog/oodControls.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodControls.cpp 2009-07-16 17:13:31 UTC (rev 4932) +++ main/trunk/extensions/platform/windows/oodialog/oodControls.cpp 2009-07-16 20:25:23 UTC (rev 4933) @@ -206,8 +206,8 @@ else if ( strcmp(className, "LISTCONTROL" ) == 0 ) { ctrl = winListView; } else if ( strcmp(className, "TABCONTROL" ) == 0 ) { ctrl = winTab; } else if ( strcmp(className, "EDITCONTROL" ) == 0 ) { ctrl = winEdit; } - else if ( strcmp(className, "RADIOBUTTON" ) == 0 ) { ctrl = winRadioButton; } - else if ( strcmp(className, "CHECKBOX" ) == 0 ) { ctrl = winCheckBox; } + else if ( strcmp(className, "RADIOCONTROL" ) == 0 ) { ctrl = winRadioButton; className = "RADIOBUTTON"; } + else if ( strcmp(className, "CHECKCONTROL" ) == 0 ) { ctrl = winCheckBox; className = "CHECKBOX"; } else if ( strcmp(className, "GROUPBOX" ) == 0 ) { ctrl = winGroupBox; } else if ( strcmp(className, "LISTBOX" ) == 0 ) { ctrl = winListBox; } else if ( strcmp(className, "COMBOBOX" ) == 0 ) { ctrl = winComboBox; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-07-24 23:51:20
|
Revision: 5007 http://oorexx.svn.sourceforge.net/oorexx/?rev=5007&view=rev Author: miesfeld Date: 2009-07-24 23:50:58 +0000 (Fri, 24 Jul 2009) Log Message: ----------- ooDialog - Provide menu class methods to connect the context menu event and the menu item click event. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp main/trunk/extensions/platform/windows/oodialog/APICommon.h main/trunk/extensions/platform/windows/oodialog/Menu.cls main/trunk/extensions/platform/windows/oodialog/dlgext.cls main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp Modified: main/trunk/extensions/platform/windows/oodialog/APICommon.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-07-24 21:54:48 UTC (rev 5006) +++ main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-07-24 23:50:58 UTC (rev 5007) @@ -426,13 +426,13 @@ /** * Test if a generic Rexx object is exactly some int. * + * @param c The method context we are executing under. * @param testFor The int value being tested for. * @param val The generic Rexx object, which could be null. - * @param c The method context we are executing under. * * @return True if val is the int number we are testing for, otherwise false. */ -bool isInt(int testFor, RexxObjectPtr val, RexxMethodContext *c) +bool isInt(RexxMethodContext *c, int testFor, RexxObjectPtr val) { if ( val != NULLOBJECT ) { @@ -444,3 +444,27 @@ } return false; } + + +/** + * Test if a genric Rexx object is the type of specified class object. + * + * @param c The method context we are executing under. + * @param obj The object to test. + * @param classID The ID string of the class we are looking for. + * + * @return True if obj is a class object of the type specified, otherwise false. + */ +bool isOfClassType(RexxMethodContext *c, RexxObjectPtr obj, CSTRING classID) +{ + if ( obj != NULLOBJECT && c->IsOfType(obj, "CLASS") ) + { + RexxStringObject clsID = (RexxStringObject)c->SendMessage0(obj, "ID"); + if ( clsID != NULLOBJECT && stricmp(c->StringData(clsID), classID) == 0 ) + { + return true; + } + } + return false; +} + Modified: main/trunk/extensions/platform/windows/oodialog/APICommon.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/APICommon.h 2009-07-24 21:54:48 UTC (rev 5006) +++ main/trunk/extensions/platform/windows/oodialog/APICommon.h 2009-07-24 23:50:58 UTC (rev 5007) @@ -83,6 +83,7 @@ extern bool rxStr2Number(RexxMethodContext *c, CSTRING str, uint64_t *number, int pos); extern RexxClassObject rxGetContextClass(RexxMethodContext *c, CSTRING name); extern RexxObjectPtr rxSetObjVar(RexxMethodContext *c, CSTRING varName, RexxObjectPtr val); -extern bool isInt(int, RexxObjectPtr, RexxMethodContext *); +extern bool isInt(RexxMethodContext *, int, RexxObjectPtr); +extern bool isOfClassType(RexxMethodContext *, RexxObjectPtr, CSTRING); #endif Modified: main/trunk/extensions/platform/windows/oodialog/Menu.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/Menu.cls 2009-07-24 21:54:48 UTC (rev 5006) +++ main/trunk/extensions/platform/windows/oodialog/Menu.cls 2009-07-24 23:50:58 UTC (rev 5007) @@ -48,6 +48,8 @@ \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ ::class 'Menu' public mixinclass Object +::method connectItem class external "LIBRARY oodialog menu_connectItem_cls" + ::attribute wID get external "LIBRARY oodialog menu_wID" ::attribute hMenu get external "LIBRARY oodialog menu_getHMenu" @@ -185,6 +187,7 @@ \* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -*/ ::class 'PopupMenu' public subclass Object inherit Menu ResourceUtils +::method connectContextMenu class external "LIBRARY oodialog popMenu_connectContextMenu_cls" ::method init external "LIBRARY oodialog popMenu_init" ::method isAssigned external "LIBRARY oodialog popMenu_isAssigned" ::method show external "LIBRARY oodialog popMenu_show" Modified: main/trunk/extensions/platform/windows/oodialog/dlgext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-07-24 21:54:48 UTC (rev 5006) +++ main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-07-24 23:50:58 UTC (rev 5007) @@ -1049,22 +1049,10 @@ use strict arg msgToRise self~addUserMsg(msgToRise, 0x00000215, 0xFFFFFFFF, 0, 0, 0, 0) -::method connectMenuItem +::method connectMenuItem -- Deprecated use strict arg id, msgToRaise + return .Menu~connectItem(id, msgToRaise, self) - id = self~resolveResourceId(id) - if id = -1 then return -1 - - if id < 3 | id = 9 then return 0 - - return self~addUserMsg(msgToRaise, 0x00000111, 0xFFFFFFFF, id, 0x0000FFFF, 0, 0) - --- Connect WM_CONTEXTMENU messages to a method. TODO - this doesn't seem like the right place for this, what was I thinking? -::method connectContextMenu - use strict arg msgToRaise, hwnd = .nil - if hwnd \== .nil then return self~addUserMsg(msgToRaise, 0x0000007B, 0xFFFFFFFF, hwnd, 0xFFFFFFFF, 0, 0, 0x00000201) - return self~addUserMsg(msgToRaise, 0x0000007B, 0xFFFFFFFF, 0, 0, 0, 0, 0x00000201) - ::method PeekDialogMessage unguarded return GetDlgMsg(self~Adm, "Peek") Modified: main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp 2009-07-24 21:54:48 UTC (rev 5006) +++ main/trunk/extensions/platform/windows/oodialog/oodMenu.cpp 2009-07-24 23:50:58 UTC (rev 5007) @@ -178,6 +178,35 @@ return AddTheMessage(dlgAdm, WM_SYSCOMMAND, UINT32_MAX, id, 0x0000FFF0, 0, 0, msg, tag) ? 0 : ERROR_NOT_ENOUGH_MEMORY; } +/** + * Tries to get a pointer to a dialog admin block through the specified dialog. + * + * @param c Method context we are operating in. + * @param dialog A presumed ooDialog dialog object. + * + * @return A pointer to the dialog admin block for the specified dialog on + * success, null on failure. + * + * @note On failure, if dialog is not a BaseDialog then the .SystemErrorCode + * is set, but no condition is raised. On the other hand, if dialog is + * a BaseDialog, and we can't get the admin block, something is + * seriously wrong and a condition has been raised. + */ +DIALOGADMIN *_getAdminBlock(RexxMethodContext *c, RexxObjectPtr dialog) +{ + oodResetSysErrCode(c); + + if ( ! c->IsOfType(dialog, "BASEDIALOG") ) + { + oodSetSysErrCode(c, ERROR_WINDOW_NOT_DIALOG); + return NULL; + } + + // This will raise an exception and return NULL on error. + return rxGetDlgAdm(c, dialog); +} + + CSTRING CppMenu::name() { switch ( type ) @@ -1508,14 +1537,7 @@ } else { - if ( ! c->IsOfType(dialog, "BASEDIALOG") ) - { - oodSetSysErrCode(c, ERROR_WINDOW_NOT_DIALOG); - goto done_out; - } - - // This will raise an exception and return NULL on error. - dialogAdm = rxGetDlgAdm(c, dialog); + dialogAdm = _getAdminBlock(c, dialog); } done_out: @@ -2726,7 +2748,69 @@ return 0; } +/** Menu::connectItem() [class] + * + * This class method connects a menu command item with a method in the specified + * dialog. + * + * @param id The resource ID of the menu item to be connected. + * + * @param methodName The method to connect the menu item to. + * + * @param dlg The dlg to connect the menu item too. + * + * @param isHandled Whether the method handles completely the Windows message, + * or not. If true the message is NOT passed on to the + * system for further processing, if false it is passed on. + * This argument is only used for a SystemMenu. + * + * @return True on success, false on error. + * + * @note Sets .SystemErrorCode on error. + * + * The system error code is set this way in addition to what the OS might + * set: + * + * ERROR_WINDOW_NOT_DIALOG (1420) -> The dialog argument is not a + * .BaseDialog, (or subclass of course.) + * + * ERROR_NOT_ENOUGH_MEMORY (8) -> The dialog message table is full. + */ +RexxMethod5(logical_t, menu_connectItem_cls, RexxObjectPtr, rxID, CSTRING, methodName, + RexxObjectPtr, dlg, OPTIONAL_logical_t, isHandled, OSELF, self) +{ + logical_t success = FALSE; + bool isSystemMenu = isOfClassType(context, self, "SystemMenu"); + DIALOGADMIN *dialogAdm = _getAdminBlock(context, dlg); + if ( dialogAdm == NULL ) + { + goto done_out; + } + + uint32_t id = oodResolveSymbolicID(context, dlg, rxID, -1, 1); + if ( id == OOD_ID_EXCEPTION ) + { + goto done_out; + } + + uint32_t rc; + if ( isSystemMenu ) + { + rc = _connectSysItem(dialogAdm, id, methodName, isHandled); + } + else + { + rc = _connectItem(dialogAdm, id, methodName); + } + + (rc == 0) ? success = TRUE : oodSetSysErrCode(context, rc); + +done_out: + return success; +} + + /** Menu::hMenu() [attribute get] * * Gets the hMenu attribute. @@ -3039,7 +3123,7 @@ } -/**Menu::destroy() +/** Menu::destroy() * * Releases the operating system resources for the menu this .Menu represents. * @@ -5325,6 +5409,79 @@ } +/** PopupMenu::connectContextMenu() [class] + * + * This class method connects WM_CONTEXTMETHOD Windows messages to a method in a + * dialog. The WM_CONTEXTMENU is sent when the user right-mouse clicks on a + * window. + * + * @param dlg The dialog being connected. + * + * @param methodName The method name of the method being connected. + * + * @param hwnd [optional] A window handle to filter the right-clicks on. + * This can be the window handle of any control in the dialog + * being connnected, or even the dialog window handle itself. + * If used, only right-clicks on the specified window will be + * received. If omitted, all right-clicks on the dialog are + * received. + * + * @param handles Whether the method handles completely the Windows message, + * or not. If true the message is NOT passed on to the + * system for further processing, if false it is passed on. + * TODO - figure out if there is one value that should always + * be used and remove this extra parameter. + * + * @return True on success, false on error. + * + * @note Sets .SystemErrorCode on error. + * + * The system error code is set this way in addition to what the OS might + * set: + * + * ERROR_WINDOW_NOT_DIALOG (1420) -> The dlg argument not a .BaseDialog, + * (or subclass of course.) + * + * ERROR_NOT_ENOUGH_MEMORY (8) -> The dialog message table is full. + */ +RexxMethod4(logical_t, popMenu_connectContextMenu_cls, RexxObjectPtr, dlg, CSTRING, methodName, OPTIONAL_POINTERSTRING, hwnd, + OPTIONAL_logical_t, handles) +{ + BOOL success = FALSE; + + DIALOGADMIN *dialogAdm = _getAdminBlock(context, dlg); + if ( dialogAdm == NULL ) + { + goto done_out; + } + + uint32_t tag = TAG_DIALOG | TAG_CONTEXTMENU; + if ( handles ) + { + tag |= TAG_MSGHANDLED; + } + + if ( hwnd != NULL ) + { + success = AddTheMessage(dialogAdm, WM_CONTEXTMENU, UINT32_MAX, (WPARAM)hwnd, UINTPTR_MAX, + 0, 0, methodName, tag); + } + else + { + success = AddTheMessage(dialogAdm, WM_CONTEXTMENU, UINT32_MAX, 0, 0, + 0, 0, methodName, tag); + } + + if ( ! success ) + { + oodSetSysErrCode(context, ERROR_NOT_ENOUGH_MEMORY); + } + +done_out: + return success; +} + + /** PopupMenu::init() * * Initializes a .PopupMenu object. The underlying menu object is either @@ -5698,7 +5855,7 @@ RexxPointerObject cMenuPtr = context->NewPointer(cMenu); context->SetObjectVariable("CSELF", cMenuPtr); - bool idOmitted = isInt(-1, id, context); + bool idOmitted = isInt(context, -1, id); if ( ! cMenu->menuInit(id, symbolSrc, rcFile) ) { Modified: main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp 2009-07-24 21:54:48 UTC (rev 5006) +++ main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp 2009-07-24 23:50:58 UTC (rev 5007) @@ -350,6 +350,7 @@ REXX_METHOD_PROTOTYPE(size_setCY); // Menu classes methods +REXX_METHOD_PROTOTYPE(menu_connectItem_cls); REXX_METHOD_PROTOTYPE(menu_getHMenu); REXX_METHOD_PROTOTYPE(menu_wID); REXX_METHOD_PROTOTYPE(menu_isValidItemID); @@ -412,6 +413,7 @@ REXX_METHOD_PROTOTYPE(sysMenu_connectAllItems); REXX_METHOD_PROTOTYPE(sysMenu_connectSomeItems); +REXX_METHOD_PROTOTYPE(popMenu_connectContextMenu_cls); REXX_METHOD_PROTOTYPE(popMenu_init); REXX_METHOD_PROTOTYPE(popMenu_connectContextMenu); REXX_METHOD_PROTOTYPE(popMenu_isAssigned); @@ -589,6 +591,7 @@ REXX_METHOD(size_setCY, size_setCY), // Menu classes methods + REXX_METHOD(menu_connectItem_cls, menu_connectItem_cls), REXX_METHOD(menu_getHMenu, menu_getHMenu), REXX_METHOD(menu_wID, menu_wID), REXX_METHOD(menu_isValidItemID, menu_isValidItemID), @@ -651,12 +654,13 @@ REXX_METHOD(sysMenu_connectSomeItems, sysMenu_connectSomeItems), REXX_METHOD(sysMenu_connectAllItems, sysMenu_connectAllItems), - REXX_METHOD(popMenu_init, popMenu_init), - REXX_METHOD(popMenu_isAssigned, popMenu_isAssigned), - REXX_METHOD(popMenu_connectContextMenu, popMenu_connectContextMenu), - REXX_METHOD(popMenu_assignTo, popMenu_assignTo), - REXX_METHOD(popMenu_track, popMenu_track), - REXX_METHOD(popMenu_show, popMenu_show), + REXX_METHOD(popMenu_connectContextMenu_cls, popMenu_connectContextMenu_cls), + REXX_METHOD(popMenu_init, popMenu_init), + REXX_METHOD(popMenu_isAssigned, popMenu_isAssigned), + REXX_METHOD(popMenu_connectContextMenu, popMenu_connectContextMenu), + REXX_METHOD(popMenu_assignTo, popMenu_assignTo), + REXX_METHOD(popMenu_track, popMenu_track), + REXX_METHOD(popMenu_show, popMenu_show), REXX_METHOD(scriptMenu_init, scriptMenu_init), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-08-23 04:26:33
|
Revision: 5100 http://oorexx.svn.sourceforge.net/oorexx/?rev=5100&view=rev Author: miesfeld Date: 2009-08-23 04:26:21 +0000 (Sun, 23 Aug 2009) Log Message: ----------- ooDialog - first steps toward moving the use of .Pointer for window handles. Implement the initialization of WindowBase to the new API, and most of its methods. Cosmetic changes, use a style of method names starting with a small letter rather than a capital. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/basedlg.cls main/trunk/extensions/platform/windows/oodialog/catdlg.cls main/trunk/extensions/platform/windows/oodialog/dlgarea.cls main/trunk/extensions/platform/windows/oodialog/dlgext.cls main/trunk/extensions/platform/windows/oodialog/dyndlg.cls main/trunk/extensions/platform/windows/oodialog/m_oodcls.rex main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp main/trunk/extensions/platform/windows/oodialog/oodCommon.h main/trunk/extensions/platform/windows/oodialog/oodControls.cpp main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp main/trunk/extensions/platform/windows/oodialog/oodRoutines.cpp main/trunk/extensions/platform/windows/oodialog/oovbmp.cpp main/trunk/extensions/platform/windows/oodialog/oovdeskt.cpp main/trunk/extensions/platform/windows/oodialog/oovdraw.cpp main/trunk/extensions/platform/windows/oodialog/oovother.cpp main/trunk/extensions/platform/windows/oodialog/oovscrll.cpp main/trunk/extensions/platform/windows/oodialog/oovuser.cpp main/trunk/extensions/platform/windows/oodialog/plbdlg.cls main/trunk/extensions/platform/windows/oodialog/propsht.cls main/trunk/extensions/platform/windows/oodialog/stdext.cls Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-08-23 04:26:21 UTC (rev 5100) @@ -290,84 +290,20 @@ ::method oDlg attribute -- The ooRexx dialog object this control belongs to ::method hDlg attribute -- The window handle of that dialog -::method Id attribute -- The numerical resource ID for this control +::method id attribute -- The numerical resource ID for this control -::method new class - use arg pdialog, id, category +::method new class external "LIBRARY oodialog dlgctrl_new_cls" - -- Before this returns, the object init() method will have been invoked. If - -- there are args, then init() will have resolved id to a numeric resource - -- id. - Forward Class(Super) continue - obj = result +::method getTextSizeDlg unguarded external "LIBRARY oodialog dlgctrl_getTextSizeDlg" - if obj \= .Nil then do - obj~Hwnd = 0 -- Signal hwnd is not assigned yet. - - if Arg() = 0 then do - obj~init_WindowBase - obj~oDlg = .nil - obj~Id = 0 - return obj - end - - if obj~id = -1 then return .nil - - parse value GetDialogFactor() with x y - obj~FactorX=x - obj~FactorY=Y - - if Arg(3,'o') = 1 | category = 0 then do - obj~hDlg = pDialog~DlgHandle - obj~AssignWindow(pDialog~GetItem(obj~id)) - end - else do - obj~hDlg = pDialog~catalog['handles'][category] - obj~AssignWindow(pDialog~GetItem(obj~id, obj~hDlg)) - end - end - return obj - - -::method Init - use arg pdialog, id, category - self~init:super - if Arg() = 0 then return - self~oDlg = pDialog - if id~DataType("N") = 0 then id = pDialog~ResolveSymbolicId(id) - self~Id = id - -::method AssignWindow - use arg hwnd, parent, category - self~Hwnd = hwnd - if hwnd = 0 then return 0 - parse value Wnd_Desktop("RECT", hwnd) with x y cx cy - self~SizeX = (cx - x) % self~FactorX - self~SizeY = (cy - y) % self~FactorY - - if Arg(2,'e') = 1 then do - self~oDlg = parent - if Arg(3,'o') = 1 then self~hDlg = self~oDlg~DlgHandle - else self~hDlg = self~oDlg~catalog['handles'][category] - end - return hwnd - - ::method ProcessMessage parse arg msg,wp,lp return SendWinMsg("DLG",self~hDlg,self~Id,msg,wp,lp) ::method Message2Parent unguarded private /* This is the replacement for BoxMessage */ use arg msg, wP, lP - return SendWinMsg("PTR", Self~hDlg, Self~Id, msg, wP, lP) + return SendWinMsg("PTR", self~hDlg, self~Id, msg, wP, lP) --- DEPRECATED -::method getTextSize unguarded - forward message "getTextSizeDlg" continue - return result~width result~height - -::method getTextSizeDlg unguarded external "LIBRARY oodialog dlgctrl_getTextSizeDlg" - ::method SetColor use arg colorbk, colorfg if Arg(2,'o') = 1 then @@ -468,6 +404,16 @@ if Arg(5, 'o') = 1 then erasebkg = 0 return WindowRect("RDW", self~hwnd,left,top,right,bottom, erasebkg) +-- DEPRECATED +::method assignWindow + return 0 + +-- DEPRECATED +::method getTextSize unguarded + forward message "getTextSizeDlg" continue + return result~width result~height + + /****************************************************** Tree Control Class *********************************************************/ @@ -793,7 +739,7 @@ ::method InsertColumn use arg nr, text, width, fmt if arg(1,'O') then nr = 0 - if Arg(3,'o') = 1 then width = -1; else width = width*self~FactorX + if Arg(3,'o') = 1 then width = -1; else width = width*self~factorX if Arg(4,'o') = 1 then fmt = "LEFT" return HandleListCtrl("C","INS", self~Hwnd, nr, text, width, fmt~translate) @@ -808,7 +754,7 @@ use arg nr, text, width, fmt if Arg(1,'o') = 1 then return -1 if Arg(2,'o') = 1 then text = "" - if Arg(3,'o') = 1 then width = -1; else width = width*self~FactorX + if Arg(3,'o') = 1 then width = -1; else width = width*self~factorX if Arg(4,'o') = 1 then fmt = "" return HandleListCtrl("C","SET", self~Hwnd, nr, text, width, fmt~translate) @@ -817,7 +763,7 @@ use arg nr if Arg(1,'o') = 1 then return -1 ret = HandleListCtrl("C","GET", self~Hwnd, nr, "InternalLVColInfo") - if InternalLVColInfo.!Width~Datatype('N') = 1 then InternalLVColInfo.!Width = InternalLVColInfo.!Width / self~FactorX + if InternalLVColInfo.!Width~Datatype('N') = 1 then InternalLVColInfo.!Width = InternalLVColInfo.!Width / self~factorX return InternalLVColInfo. @@ -826,13 +772,13 @@ ::method ColumnWidth use arg nr if Arg(1,'o') = 1 then return -1 - return HandleListCtrl("C","GETWIDTH", self~Hwnd, nr) / self~FactorX + return HandleListCtrl("C","GETWIDTH", self~Hwnd, nr) / self~factorX ::method SetColumnWidth use arg nr, width if Arg(1,'o') = 1 then return -1 if Arg(2,'o') = 1 then width = "AUTO" - if width~datatype("N") = 1 then width = width * self~FactorX + if width~datatype("N") = 1 then width = width * self~factorX return HandleListCtrl("C","SETWIDTH", self~Hwnd, nr, width~translate) ::method getColumnCount external "LIBRARY oodialog lv_getColumnCount" @@ -842,7 +788,7 @@ ::method StringWidth use arg text if Arg(1,'o') = 1 then return -1 - return HandleListCtrl("M","STRWIDTH", self~Hwnd, text) / self~FactorX + return HandleListCtrl("M","STRWIDTH", self~Hwnd, text) / self~factorX ::method Insert @@ -1416,8 +1362,6 @@ ::method setIcon external "LIBRARY oodialog stc_setIcon" ::method getImage external "LIBRARY oodialog stc_getImage" ::method setImage external "LIBRARY oodialog stc_setImage" -::method getText external "LIBRARY oodialog stc_getText" -::method setText external "LIBRARY oodialog stc_setText" /****************************************************** Edit Control Class *********************************************************/ @@ -1533,13 +1477,6 @@ use arg dlgunits self~Message2Parent(0x00CB, 1, "L" || dlgunits) -::method GetText - return HandleControlEx(self~hDlg, self~id, "E", "TXT") - -::method SetText - use strict arg text - return HandleControlEx(self~hDlg, self~id, "E", "TXT", text) - ::method HideBalloon return HandleControlEx(self~hDlg, self~id, "E", "MSG", "TIP") @@ -1768,9 +1705,9 @@ ::method GetText use arg ndx - len = SendWinMsg("DLG", Self~hDlg, self~id, 0x0000018A, ndx-1,0) + len = SendWinMsg("DLG", self~hDlg, self~id, 0x0000018A, ndx-1,0) if len <= 0 then return "" - else return SendWinMsg("PTR", Self~hDlg, self~id, 0x00000189, ndx-1,"G" || len+1) + else return SendWinMsg("PTR", self~hDlg, self~id, 0x00000189, ndx-1,"G" || len+1) ::method Modify use arg index, dataString @@ -1798,23 +1735,23 @@ ::method SetWidth use arg dlgunits if Arg(1,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 - self~Message2Parent(0x00000194, dlgunits*self~FactorX, 0) + self~Message2Parent(0x00000194, dlgunits*self~factorX, 0) ::method Width - return self~Message2Parent(0x00000193, 0, 0)/self~FactorX + return self~Message2Parent(0x00000193, 0, 0)/self~factorX ::method "ItemHeight=" use arg dlgunits if Arg(1,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 - self~Message2Parent(0x000001A0, 0, dlgunits*self~FactorY) + self~Message2Parent(0x000001A0, 0, dlgunits*self~factorY) ::method ItemHeight - return self~Message2Parent(0x000001A1, 0, 0)/self~FactorY + return self~Message2Parent(0x000001A1, 0, 0)/self~factorY ::method "ColumnWidth=" use arg dlgunits if Arg(1,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 - self~Message2Parent(0x00000195, dlgunits*self~FactorX, 0) + self~Message2Parent(0x00000195, dlgunits*self~factorX, 0) @@ -1876,9 +1813,9 @@ ::method GetText use arg ndx - len = SendWinMsg("DLG", Self~hDlg, self~id, 0x00000149, ndx-1,0) + len = SendWinMsg("DLG", self~hDlg, self~id, 0x00000149, ndx-1,0) if len <= 0 then return "" - else return SendWinMsg("PTR", Self~hDlg, self~id, 0x00000148, ndx-1,"G" || len+1) + else return SendWinMsg("PTR", self~hDlg, self~id, 0x00000148, ndx-1,"G" || len+1) ::method Modify use arg index, dataString Modified: main/trunk/extensions/platform/windows/oodialog/basedlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/basedlg.cls 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/basedlg.cls 2009-08-23 04:26:21 UTC (rev 5100) @@ -54,61 +54,9 @@ ::class 'WindowExtensions' public MIXINCLASS object -::method HideFast unguarded - return WndShow_Pos("S",self~hwnd, "HIDE FAST") - -::method ShowFast unguarded - return WndShow_Pos("S",self~hwnd, "NORMAL FAST") - -::method Display unguarded - use arg disptype = "NORMAL" - if disptype = "" then disptype = "NORMAL"; else disptype = disptype~translate - if self~isA(.DialogControl) & (disptype~wordpos("MIN") <> 0 | disptype~wordpos("MAX") <> 0) then do - if self~oDlg~isA(.PlainBaseDialog) then - forward to (self~oDlg) - else - return 1 - end - return WndShow_Pos("S",self~hwnd, disptype) - ::method setFont unguarded external "LIBRARY oodialog winex_setFont" ::method getFont unguarded external "LIBRARY oodialog winex_getFont" -::method GetRect unguarded - return WindowRect("GET", self~Hwnd) - -::method GetClientRect unguarded - use arg hwnd - if Arg(1,'o') = 1 then hwnd = self~hwnd - return WindowRect("GET", hwnd, "CLIENT") - -::method SetRect unguarded - use arg x, y, width, high, showOptions - if Arg(5,"o") = 1 then showOptions = ""; else showOptions = showOptions~translate - return WndShow_Pos("P",self~hwnd, x, y, width, high, showOptions) - -::method Update unguarded - return WndShow_Pos("S",self~Hwnd, "UPDATE") - - /* This method draws the window */ -::method Draw unguarded - return WindowRect("RDW", self~hwnd, "") - -::method Redraw unguarded - return WndShow_Pos("S",self~hwnd, "REDRAW") - -::method RedrawClient unguarded - use arg erasebkg - if Arg(1, 'o') = 1 then erasebkg = 0 - return WindowRect("RDW", self~Hwnd, erasebkg) - -::method GetDC unguarded - return HandleDC_Obj("G", self~hwnd) - -::method FreeDC unguarded - use arg dc - return HandleDC_obj("F", self~hwnd, dc) - ::method HScrollPos unguarded return WndShow_Pos("B", self~hwnd, 0) @@ -129,21 +77,13 @@ use arg x, y return WndShow_Pos("M", self~hwnd, x, y) -::method ScreenToClient unguarded - use arg x,y - return Wnd_Desktop("COORD", self~hwnd, x, y, "S2C") +::method GetDC unguarded + return HandleDC_Obj("G", self~hwnd) -::method ClientToScreen unguarded - use arg x,y - return Wnd_Desktop("COORD", self~hwnd, x, y, "C2S") +::method FreeDC unguarded + use arg dc + return HandleDC_obj("F", self~hwnd, dc) -::method SetForegroundWindow unguarded - use arg hwnd - return Wnd_Desktop("TOP", hwnd) - -::method ForegroundWindow unguarded - return Wnd_Desktop("FG") - ::method SetCursorPos unguarded use arg x, y return Wnd_Desktop("CURSOR", x, y) @@ -345,18 +285,18 @@ ::method LogRect2AbsRect unguarded parse arg l, t, r, b - ret.left = l*self~FactorX - ret.right = r*self~FactorX - ret.top = t*self~FactorY - ret.bottom = b*self~FactorY + ret.left = l*self~factorX + ret.right = r*self~factorX + ret.top = t*self~factorY + ret.bottom = b*self~factorY return ret. ::method AbsRect2LogRect unguarded parse arg l, t, r, b - ret.left = l/self~FactorX - ret.right = r/self~FactorX - ret.top = t/self~FactorY - ret.bottom = b/self~FactorY + ret.left = l/self~factorX + ret.right = r/self~factorX + ret.top = t/self~factorY + ret.bottom = b/self~factorY return ret. /** class: BaseDialog Modified: main/trunk/extensions/platform/windows/oodialog/catdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/catdlg.cls 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/catdlg.cls 2009-08-23 04:26:21 UTC (rev 5100) @@ -144,9 +144,9 @@ ::method StartIt /* don't call parent startit */ - if self~DlgHandle = 0 then return 0 + if self~dlgHandle = 0 then return 0 self~InitDialog - return self~DlgHandle + return self~dlgHandle ::method DefineDialog protected if self~baseptr = 0 then return 0 @@ -167,7 +167,7 @@ if (n > 0 | m > 0) & self~catstyle~wordpos('NOBORDER') = 0 then self~catstyle = self~catstyle||" NOBORDER" - if self~catalog['page']['h'] = .Nil then self~catalog['page']['h'] = self~SizeY - 40 + if self~catalog['page']['h'] = .Nil then self~catalog['page']['h'] = self~sizeY - 40 size = self~getTextSizeDlg("Hg") textHeight = size~height @@ -191,7 +191,7 @@ end else if self~catalog['page']['y'] = .Nil then self~catalog['page']['y'] = self~caty+textHeight+5 - if self~catalog['page']['w'] = .Nil then self~catalog['page']['w'] = self~SizeX - 2 + if self~catalog['page']['w'] = .Nil then self~catalog['page']['w'] = self~sizeX - 2 end else do if self~catmax = 0 then do @@ -202,7 +202,7 @@ if self~catalog['page']['y'] = .Nil then self~catalog['page']['y'] = 5 - if self~catalog['page']['w'] = .Nil then self~catalog['page']['w'] = self~SizeX - (self~catX+self~catcx+20) + if self~catalog['page']['w'] = .Nil then self~catalog['page']['w'] = self~sizeX - (self~catX+self~catcx+20) end self~CategoryPage @@ -233,9 +233,9 @@ self~AddRadioStem(9001, self~catX, self~caty, self~catcx, catnames., self~catmax, newstyle || " CAT") end - self~DlgHandle = UsrCreateDialog(self~Adm, "PARENT", self~DialogItemCount, 0, self~BasePtr, self~AutoDetect, 1, 0, 0) + self~dlgHandle = UsrCreateDialog(self~Adm, "PARENT", self~DialogItemCount, 0, self~BasePtr, self~AutoDetect, 1, 0, 0) self~activePtr = 0 - if self~DlgHandle = 0 then return 0 + if self~dlgHandle = 0 then return 0 do i = 1 to self~catalog['count'] self~DialogItemCount = 0 @@ -244,7 +244,7 @@ self~CreateCategoryDialog(p['x'], p['y'], p['w'], p['h'],p['font'], p['fsize'], p['style'] || " CHILD HIDDEN", p['expected']) msg = "self~" || self~catalog['names'][i]~space(0) interpret(msg) - ret = UsrCreateDialog(self~Adm, "CHILD", self~DialogItemCount, self~catalog['base'][i], self~DlgHandle, i) + ret = UsrCreateDialog(self~Adm, "CHILD", self~DialogItemCount, self~catalog['base'][i], self~dlgHandle, i) self~activePtr = 0 self~catalog['handles'][i] = ret end @@ -262,9 +262,9 @@ textHeight = size~height if self~catstyle~wordpos("TOPLINE") > 0 then - self~addBlackFrame(0, 2, self~SizeX, textHeight + (self~caty+2)) + self~addBlackFrame(0, 2, self~sizeX, textHeight + (self~caty+2)) else if self~catstyle~wordpos("DROPDOWN") > 0 then - self~addBlackFrame(0, 2, self~SizeX, textHeight + (self~caty*2)+1) + self~addBlackFrame(0, 2, self~sizeX, textHeight + (self~caty*2)+1) lbtext = self~catalog['page']['leftbtntext'] rbtext = self~catalog['page']['rightbtntext'] @@ -272,18 +272,18 @@ if rbtext~pos(" ") > 0 then rbtext = '"' || rbtext || '"' if (self~catalog['page']['btnwidth'] > 0) then do - self~AddButtonGroup(self~SizeX-self~catalog['page']['btnwidth']*2-15,, - self~SizeY - 15,self~catalog['page']['btnwidth'],, "&Ok 1 OK &Cancel 2 CANCEL", 1, "FIX DEFAULT") + self~AddButtonGroup(self~sizeX-self~catalog['page']['btnwidth']*2-15,, + self~sizeY - 15,self~catalog['page']['btnwidth'],, "&Ok 1 OK &Cancel 2 CANCEL", 1, "FIX DEFAULT") if self~Wizard = 1 then - self~AddButtonGroup(5,self~SizeY - 15,self~catalog['page']['btnwidth'],, + self~AddButtonGroup(5,self~sizeY - 15,self~catalog['page']['btnwidth'],, ,lbtext" 11 PreviousPage" rbtext" 12 NextPage", 1, "FIX") end else do self~AddOkCancelRightBottom if self~Wizard = 1 then - self~AddButtonGroup(5, self~SizeY - 15,,, lbtext" 11 PreviousPage" rbtext" 12 NextPage", 1, "FIX") + self~AddButtonGroup(5, self~sizeY - 15,,, lbtext" 11 PreviousPage" rbtext" 12 NextPage", 1, "FIX") end - self~addBlackFrame(0, self~SizeY - 20, self~SizeX, 1) + self~addBlackFrame(0, self~sizeY - 20, self~sizeX, 1) /* */ @@ -755,7 +755,7 @@ ::method GetItem unguarded use arg id, hDlg - if Arg(2,'o') = 1 then hDlg = self~DlgHandle + if Arg(2,'o') = 1 then hDlg = self~dlgHandle if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) if id = -1 then return 0 hnd = HandleDlg("ITEM", id, hDlg) @@ -790,7 +790,7 @@ if Arg(4,"o") = 1 then showOptions = ""; else showOptions = showOptions~translate hnd = self~GetItem(id, self~catalog['handles'][category]) if hnd = 0 then return -1 - return WndShow_Pos("P",hnd, 0, 0, width * self~FactorX, high* self~FactorY,, + return WndShow_Pos("P",hnd, 0, 0, width * self~factorX, high* self~factorY,, "NOMOVE "||showOptions) /* This method will move a dialog item to an other position */ @@ -801,7 +801,7 @@ if Arg(4,"o") = 1 then showOptions = ""; else showOptions = showOptions~translate h = self~GetItem(id, self~catalog['handles'][category]) if h = 0 then return -1 - return WndShow_Pos("P",h, xPos * self~FactorX, yPos * self~FactorY, 0, 0,, + return WndShow_Pos("P",h, xPos * self~factorX, yPos * self~factorY, 0, 0,, "NOSIZE "||showOptions) @@ -810,25 +810,25 @@ ::method SetCategoryListWidth unguarded use arg id, dlgunits, category if Arg(2,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 - return self~BoxMessage(category, id, 0x00000194, dlgunits*self~FactorX, 0) + return self~BoxMessage(category, id, 0x00000194, dlgunits*self~factorX, 0) ::method GetCategoryListWidth unguarded use arg id, category - return self~BoxMessage(category, id, 0x00000193, 0, 0)/self~FactorX + return self~BoxMessage(category, id, 0x00000193, 0, 0)/self~factorX ::method SetCategoryListColumnWidth unguarded use arg id, dlgunits, category if Arg(2,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 - return self~BoxMessage(category, id, 0x00000195, dlgunits*self~FactorX, 0) + return self~BoxMessage(category, id, 0x00000195, dlgunits*self~factorX, 0) ::method SetCategoryListItemHeight unguarded use arg id, dlgunits, category if Arg(2,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 - return self~BoxMessage(category, id, 0x000001A0, 0, dlgunits*self~FactorY) + return self~BoxMessage(category, id, 0x000001A0, 0, dlgunits*self~factorY) ::method GetCategoryListItemHeight unguarded use arg id, category - return self~BoxMessage(category, id, 0x000001A1, 0, 0)/self~FactorY + return self~BoxMessage(category, id, 0x000001A1, 0, 0)/self~factorY /* These methods are necessary for Win32 controls when used in a cetegory dialog */ Modified: main/trunk/extensions/platform/windows/oodialog/dlgarea.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dlgarea.cls 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/dlgarea.cls 2009-08-23 04:26:21 UTC (rev 5100) @@ -112,26 +112,26 @@ else self~margin = max(min(height % 7,5),1) if top~datatype('n') -then Self~top = top~trunc -else Self~top = 10 +then self~top = top~trunc +else self~top = 10 if left~datatype('n') -then Self~left = left~trunc -else Self~left = 10 +then self~left = left~trunc +else self~left = 10 if width~datatype('n') -then Self~width = width~trunc -else Self~width = 100 +then self~width = width~trunc +else self~width = 100 if height~datatype('n') -then Self~height = height~trunc -else Self~height = 100 +then self~height = height~trunc +else self~height = 100 self~T = self~Top + self~Margin -self~L = self~left + Self~Margin +self~L = self~left + self~Margin self~B = self~top + self~height - self~margin -self~R = self~Left + Self~Width - self~Margin +self~R = self~Left + self~Width - self~Margin self~LastX = 0 self~LastY = 0 @@ -198,7 +198,7 @@ /* ------------------------------------------------------------------------- */ if self~LastY~pos('%') = 0 /* Y was absolute */ -then return self~Top + Self~Height - Self~Margin - Self~LastY +then return self~Top + self~Height - self~Margin - self~LastY else return self~h(100 - self~LastY~changestr('%','')||'%') /* Y was % */ /* ------------------------------------------------------------------------- */ @@ -219,7 +219,7 @@ /* ------------------------------------------------------------------------- */ if self~LastX~pos('%') = 0 /* X was absolute */ -then return self~Left + Self~Width - Self~Margin - Self~LastX +then return self~Left + self~Width - self~Margin - self~LastX else return self~w(100 - self~LastX~changestr('%','')||'%') /* X was % */ /* ----------------------- compatibility methods --------------------------- */ @@ -264,12 +264,12 @@ if \margin~datatype('n') then margin = 5 -Self~CorrectionFactor = 1.05 +self~CorrectionFactor = 1.05 -self~init:super(0,0,DlgObj~SizeX,DlgObj~SizeY,margin) +self~init:super(0,0,DlgObj~sizeX,DlgObj~sizeY,margin) -self~OriginalWidth = DlgObj~SizeX -self~OriginalHeight = DlgObj~SizeY +self~OriginalWidth = DlgObj~sizeX +self~OriginalHeight = DlgObj~sizeY self~LastError = .nil /* Analyze the callers DefineDialog Method */ @@ -386,18 +386,18 @@ /* ------------------------------------------------------------------------- */ expose DlgObjList use arg dlg,data - dlg~SizeX = .DlgUtil~loWord(data) % dlg~FactorX - dlg~SizeY = .DlgUtil~hiWord(data) % dlg~FactorY + dlg~sizeX = .DlgUtil~loWord(data) % dlg~factorX + dlg~sizeY = .DlgUtil~hiWord(data) % dlg~factorY - wFactor = (dlg~SizeX / self~OriginalWidth ) * Self~CorrectionFactor - hFactor = (dlg~SizeY / self~OriginalHeight) * Self~CorrectionFactor + wFactor = (dlg~sizeX / self~OriginalWidth ) * self~CorrectionFactor + hFactor = (dlg~sizeY / self~OriginalHeight) * self~CorrectionFactor do dlgObjDef over DlgObjList parse var dlgObjdef DOid'@'DOx'@'DOy'@'DOw'@'DOh - if \Self~NoResize~HasIndex(DOid~strip) + if \self~NoResize~HasIndex(DOid~strip) then dlg~ResizeItem(Doid,DOw * wFactor,DOh * hFactor,"NOREDRAW") - if \Self~NoMove~HasIndex(DOid) + if \self~NoMove~HasIndex(DOid) then dlg~MoveItem(DOid,DOx * wFactor,DOy * hFactor,"NOREDRAW") end /* DO */ dlg~update Modified: main/trunk/extensions/platform/windows/oodialog/dlgext.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/dlgext.cls 2009-08-23 04:26:21 UTC (rev 5100) @@ -128,7 +128,7 @@ parse arg id,a2,a3,a4 if id~DataType("N") = 0 then id = self~ResolveSymbolicId(id) if id = -1 then return -1 - return SendWinMsg("DLG",self~DlgHandle,id,a2,a3,a4) + return SendWinMsg("DLG",self~dlgHandle,id,a2,a3,a4) /* The following Methods are to set/get the behaviour of/from a scrollbar */ @@ -275,25 +275,25 @@ ::method SetListWidth unguarded use arg id, dlgunits if Arg(2,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 - return self~BoxMessage(id, 0x00000194, dlgunits*self~FactorX, 0) + return self~BoxMessage(id, 0x00000194, dlgunits*self~factorX, 0) ::method GetListWidth unguarded use arg id - return self~BoxMessage(id, 0x00000193, 0, 0)/self~FactorX + return self~BoxMessage(id, 0x00000193, 0, 0)/self~factorX ::method SetListColumnWidth unguarded use arg id, dlgunits if Arg(2,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 - return self~BoxMessage(id, 0x00000195, dlgunits*self~FactorX, 0) + return self~BoxMessage(id, 0x00000195, dlgunits*self~factorX, 0) ::method SetListItemHeight unguarded use arg id, dlgunits if Arg(2,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 - return self~BoxMessage(id, 0x000001A0, 0, dlgunits*self~FactorY) + return self~BoxMessage(id, 0x000001A0, 0, dlgunits*self~factorY) ::method GetListItemHeight unguarded use arg id - return self~BoxMessage(id, 0x000001A1, 0, 0)/self~FactorY + return self~BoxMessage(id, 0x000001A1, 0, 0)/self~factorY ::method SetItemFont unguarded use arg id, hFont, bRedraw /* WM_SETFONT */ @@ -339,7 +339,7 @@ showOptions = showOptions~translate hwnd = self~GetItem(id) if hwnd = 0 then return -1 - return WndShow_Pos("P",hwnd, 0, 0, width * self~FactorX, high* self~FactorY,, + return WndShow_Pos("P",hwnd, 0, 0, width * self~factorX, high* self~factorY,, "NOMOVE "||showOptions) /* This method will move a dialog item to an other position */ @@ -349,7 +349,7 @@ showOptions = showOptions~translate hwnd = self~GetItem(id) if h = 0 then return -1 - return WndShow_Pos("P", hwnd, xPos * self~FactorX, yPos * self~FactorY, 0, 0,, + return WndShow_Pos("P", hwnd, xPos * self~factorX, yPos * self~factorY, 0, 0,, "NOSIZE "||showOptions) /* This method will add a method that will be started automatically */ @@ -533,7 +533,7 @@ displaceY, step, sleep, color) end; else do -- Send the interrupt scroll message, 0x0a02 == WM_USER_INTERRUPTSCROLL - ret = SendWinMsg("ANY",self~DlgHandle, "0x0a02", hwnd, 0) + ret = SendWinMsg("ANY",self~dlgHandle, "0x0a02", hwnd, 0) end self~ScrollNow = 0 return ret @@ -1073,31 +1073,31 @@ return WndShow_Pos("S", hwnd, "REDRAW") ::method GetFocus unguarded - return Wnd_Desktop("GETFOC", self~DlgHandle) + return Wnd_Desktop("GETFOC", self~dlgHandle) ::method SetFocus unguarded use arg hwnd - return Wnd_Desktop("SETFOC", self~DlgHandle, hwnd) + return Wnd_Desktop("SETFOC", self~dlgHandle, hwnd) ::method SetFocusToWindow unguarded use arg hwnd - return Wnd_Desktop("SETFOC", self~DlgHandle, hwnd, 'F') + return Wnd_Desktop("SETFOC", self~dlgHandle, hwnd, 'F') ::method GetMouseCapture - return Wnd_Desktop("CAP", self~DlgHandle, "G") + return Wnd_Desktop("CAP", self~dlgHandle, "G") ::method CaptureMouse - return Wnd_Desktop("CAP", self~DlgHandle, self~DlgHandle) + return Wnd_Desktop("CAP", self~dlgHandle, self~dlgHandle) ::method ReleaseMouseCapture - return Wnd_Desktop("CAP", self~DlgHandle, "R") + return Wnd_Desktop("CAP", self~dlgHandle, "R") ::method IsMouseButtonDown use arg mb = "LEFT" mb = mb~translate~space(0) - if mb = "LEFT" then return Wnd_Desktop("KSTAT", self~DlgHandle,1) /* VK_LBUTTON */ - if mb = "MIDDLE" then return Wnd_Desktop("KSTAT", self~DlgHandle,4) /* VK_MBUTTON */ - if mb = "RIGHT" then return Wnd_Desktop("KSTAT", self~DlgHandle,2) /* VK_RBUTTON */ + if mb = "LEFT" then return Wnd_Desktop("KSTAT", self~dlgHandle,1) /* VK_LBUTTON */ + if mb = "MIDDLE" then return Wnd_Desktop("KSTAT", self~dlgHandle,4) /* VK_MBUTTON */ + if mb = "RIGHT" then return Wnd_Desktop("KSTAT", self~dlgHandle,2) /* VK_RBUTTON */ ::method Dump Modified: main/trunk/extensions/platform/windows/oodialog/dyndlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/dyndlg.cls 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/dyndlg.cls 2009-08-23 04:26:21 UTC (rev 5100) @@ -91,8 +91,8 @@ self~BasePtr = base self~activePtr = ptr if ptr = 0 then call HandleDlg "STOP" - self~SizeX = cx - self~SizeY = cy + self~sizeX = cx + self~sizeY = cy self~DefineDialog return ptr <> 0 @@ -1072,13 +1072,13 @@ ::method AddOkCancelRightBottom - return self~AddButtonGroup(self~SizeX-95, self~SizeY - 15,,, "&Ok 1 OK &Cancel 2 CANCEL", 1, "FIX DEFAULT") + return self~AddButtonGroup(self~sizeX-95, self~sizeY - 15,,, "&Ok 1 OK &Cancel 2 CANCEL", 1, "FIX DEFAULT") ::method AddOkCancelLeftBottom - return self~AddButtonGroup(5, self~SizeY - 15,,, "&Ok 1 OK &Cancel 2 CANCEL", 1, "FIX DEFAULT") + return self~AddButtonGroup(5, self~sizeY - 15,,, "&Ok 1 OK &Cancel 2 CANCEL", 1, "FIX DEFAULT") ::method AddOkCancelRightTop - return self~AddButtonGroup(self~SizeX-45, 5,,, "&Ok 1 OK &Cancel 2 CANCEL", 0, "FIX DEFAULT") + return self~AddButtonGroup(self~sizeX-45, 5,,, "&Ok 1 OK &Cancel 2 CANCEL", 0, "FIX DEFAULT") ::method AddOkCancelLeftTop return self~AddButtonGroup(5, 5,,, "&Ok 1 OK &Cancel 2 CANCEL", 0, "FIX DEFAULT") @@ -1111,11 +1111,11 @@ if modal~translate = "NOTMODAL" then modal = 1 else modal = 0 end - self~DlgHandle = UsrCreateDialog(self~Adm, "PARENT", self~DialogItemCount, 0, self~BasePtr, 0 /* no autodetection */, 1, icon, modal) + self~dlgHandle = UsrCreateDialog(self~Adm, "PARENT", self~DialogItemCount, 0, self~BasePtr, 0 /* no autodetection */, 1, icon, modal) self~activePtr = 0 - if self~DlgHandle = 0 then return 0 + if self~dlgHandle = 0 then return 0 else self~InitDialog - return self~DlgHandle + return self~dlgHandle ::method StopDynamic protected self~DialogItemCount = 0 Modified: main/trunk/extensions/platform/windows/oodialog/m_oodcls.rex =================================================================== --- main/trunk/extensions/platform/windows/oodialog/m_oodcls.rex 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/m_oodcls.rex 2009-08-23 04:26:21 UTC (rev 5100) @@ -1,7 +1,7 @@ /*----------------------------------------------------------------------------*/ /* */ /* Copyright (c) 1995, 2004 IBM Corporation. All rights reserved. */ -/* Copyright (c) 2005-2008 Rexx Language Association. All rights reserved. */ +/* Copyright (c) 2005-2009 Rexx Language Association. All rights reserved. */ /* */ /* This program and the accompanying materials are made available under */ /* the terms of the Common Public License v1.0 which accompanies this */ Modified: main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp 2009-08-23 04:26:21 UTC (rev 5100) @@ -587,7 +587,7 @@ strcpy(buffer, "0"); } - if (IsYes(buffer)) + if (isYes(buffer)) { if (!DataAutodetection(Dlg)) { @@ -696,7 +696,7 @@ dlgAdm->OnTheTop = TRUE; dlgAdm->threadID = thID; /* modal flag = yes ? */ - if (dlgAdm->previous && !IsYes(argv[6].strptr) && IsWindowEnabled(((DIALOGADMIN *)dlgAdm->previous)->TheDlg)) EnableWindow(((DIALOGADMIN *)dlgAdm->previous)->TheDlg, FALSE); + if (dlgAdm->previous && !isYes(argv[6].strptr) && IsWindowEnabled(((DIALOGADMIN *)dlgAdm->previous)->TheDlg)) EnableWindow(((DIALOGADMIN *)dlgAdm->previous)->TheDlg, FALSE); if ( GetDialogIcons(dlgAdm, atoi(argv[5].strptr), ICON_DLL, (PHANDLE)&hBig, (PHANDLE)&hSmall) ) { @@ -873,10 +873,481 @@ /** + * Methods for the .WindowBase mixin class. + */ +#define WINDOWBASE_CLASS "WindowBase" + +static inline HWND getWBWindow(void *pCSelf) +{ + return ((pWbCSelf)pCSelf)->hwnd; +} + +/** + * Invalidates a rectangle in a window and has the window update. This should + * cause the window to immediately repaint the rectangle. + * + * @param hwnd Handle to the window to be redrawn. + * @param pr Pointer to a rect structure specifying the area to + * be redrawn. If this arg is null, the entire client + * area is redrawn. + * @param eraseBackground Should the background of the window be redrawn + * during the repaint. + * + * @return True on success, otherwise false. + * + * @remarks This is common code for several API methods. + */ +bool redrawRect(HWND hwnd, PRECT pr, bool eraseBackground) +{ + if ( InvalidateRect(hwnd, pr, eraseBackground) ) + { + UpdateWindow(hwnd); + return true; + } + return false; +} + +/** + * Performs the initialization of the WindowBase mixin class. + * + * This is done by creating the cself struct for that class and then sending + * that struct to the init_windowBase() method. That method will raise an + * exception if its arg is not a RexxBufferObject. This implies that the + * WindowBase mixin class can only be initialized through the native API. + * + * The base dialog, dialog control, and window classes in ooDialog inherit + * WindowBase. + * + * @param c Method context we are operating in. + * @param hwndObj Window handle of the underlying object. This can be null and + * for a dialog object, it is always null. + * @param self The Rexx object that inherited WindowBase. + * + * @return True on success, otherwise false. If false an exception has been + * raised. + * + * @remarks This method calculates the factor X and Y values using the old, + * incorrect, ooDialog method. When the hwnd is unknown, that is the + * best that can be done. But, when the hwnd is known, it would be + * better to calculate it correctly. Even when the hwnd is unknown, + * we could calculate it correctly using the font of the dialog. + * + * Note that in the original ooDialog code, factorX and factorY were + * formatted to only 1 decimal place. + * + * Note that in the original ooDialog, if the object was a dialog, + * (i.e. the hwnd is unknown,) then sizeX and sizeY simply remain at + * 0. + */ +bool initWindowBase(RexxMethodContext *c, HWND hwndObj, RexxObjectPtr self) +{ + RexxBufferObject obj = c->NewBuffer(sizeof(wbCSelf)); + + pWbCSelf pcs = (pWbCSelf)c->BufferData(obj); + if ( pcs == NULL ) + { + outOfMemoryException(c); + return false; + } + memset(pcs, 0, sizeof(wbCSelf)); + + ULONG bu = GetDialogBaseUnits(); + pcs->factorX = LOWORD(bu) / 4; + pcs->factorY = HIWORD(bu) / 8; + + if ( hwndObj != NULL ) + { + pcs->hwnd = hwndObj; + + RECT r = {0}; + if ( GetWindowRect(hwndObj, &r) == 0 ) + { + systemServiceExceptionCode(c, API_FAILED_MSG, "GetWindowRect"); + return false; + } + + pcs->sizeX = (uint32_t)((r.right - r.left) / pcs->factorX); + pcs->sizeY = (uint32_t)((r.bottom - r.top) / pcs->factorY); + } + + c->SendMessage1(self, "INIT_WINDOWBASE", obj); + return true; +} + +/** WindowBase::init_windowBase() + * + * + */ +RexxMethod1(logical_t, wb_init_windowBase, RexxObjectPtr, cSelf) +{ + if ( ! context->IsBuffer(cSelf) ) + { + wrongClassException(context, 1, "Buffer"); + } + else + { + context->SetObjectVariable("CSELF", cSelf); + } + return 0; +} + +/* Attributes for the WindowBase class */ +RexxMethod1(RexxStringObject, wb_getHwnd, CSELF, pCSelf) +{ + return pointer2string(context, ((pWbCSelf)pCSelf)->hwnd); +} +RexxMethod2(RexxObjectPtr, wb_setHwnd, CSTRING, hwnd, CSELF, pCSelf) +{ + ((pWbCSelf)pCSelf)->hwnd = (HWND)string2pointer(hwnd); + return NULLOBJECT; +} + +RexxMethod1(wholenumber_t, wb_getInitCode, CSELF, pCSelf) { return ((pWbCSelf)pCSelf)->initCode; } +RexxMethod2(RexxObjectPtr, wb_setInitCode, CSELF, pCSelf, wholenumber_t, code) { ((pWbCSelf)pCSelf)->initCode = code; return NULLOBJECT; } + +RexxMethod1(double, wb_getFactorX, CSELF, pCSelf) { return ((pWbCSelf)pCSelf)->factorX; } +RexxMethod2(RexxObjectPtr, wb_setFactorX, CSELF, pCSelf, float, xFactor) { ((pWbCSelf)pCSelf)->factorX = xFactor; return NULLOBJECT; } + +RexxMethod1(double, wb_getFactorY, CSELF, pCSelf) { return ((pWbCSelf)pCSelf)->factorY; } +RexxMethod2(RexxObjectPtr, wb_setFactorY, CSELF, pCSelf, float, yFactor) { ((pWbCSelf)pCSelf)->factorY = yFactor; return NULLOBJECT; } + +RexxMethod1(uint32_t, wb_getSizeX, CSELF, pCSelf) { return ((pWbCSelf)pCSelf)->sizeX; } +RexxMethod2(RexxObjectPtr, wb_setSizeX, CSELF, pCSelf, uint32_t, xSize) { ((pWbCSelf)pCSelf)->sizeX = xSize; return NULLOBJECT; } + +RexxMethod1(uint32_t, wb_getSizeY, CSELF, pCSelf) { return ((pWbCSelf)pCSelf)->sizeY; } +RexxMethod2(RexxObjectPtr, wb_setSizeY, CSELF, pCSelf, uint32_t, ySize) { ((pWbCSelf)pCSelf)->sizeY = ySize; return NULLOBJECT; } + +/** WindowBase::pixelX [attribute] + * + * Returns the width of the window in pixels. This is a 'get' only attribute. + * + */ +RexxMethod1(uint32_t, wb_getPixelX, CSELF, pCSelf) +{ + pWbCSelf pcs = (pWbCSelf)pCSelf; + if ( pcs->hwnd == NULL ) + { + return 0; + } + + RECT r = {0}; + GetWindowRect(pcs->hwnd, &r); + return r.right - r.left; +} + +/** WindowBase::pixelY [attribute] + * + * Returns the height of the window in pixels. This is a 'get' only attribute. + * + */ +RexxMethod1(uint32_t, wb_getPixelY, CSELF, pCSelf) +{ + pWbCSelf pcs = (pWbCSelf)pCSelf; + if ( pcs->hwnd == NULL ) + { + return 0; + } + + RECT r = {0}; + GetWindowRect(pcs->hwnd, &r); + return r.bottom - r.top; +} + +/** WindowBase::enable() / WindowBase::disable() + * + * Enables or disables the window. This function is mapped to both methods of + * WindowBase. + * + * @return True if the window was previously disabled, returns false if the + * window was not previously disabled. Note that this is not succes + * or failure. It always succeeds. + * + * @remarks The return was not previously documented. + */ +RexxMethod1(logical_t, wb_enable, CSELF, pCSelf) +{ + BOOL enable = TRUE; + if ( msgAbbrev(context) == 'D' ) + { + enable = FALSE; + } + return EnableWindow(getWBWindow(pCSelf), enable); +} + +RexxMethod1(logical_t, wb_isEnabled, CSELF, pCSelf) +{ + return IsWindowEnabled(getWBWindow(pCSelf)); +} + +RexxMethod1(logical_t, wb_isVisible, CSELF, pCSelf) +{ + return IsWindowVisible(getWBWindow(pCSelf)); +} + +/** + * Common code to call ShowWindow() for a native API method. + * + * @param pCSelf Pointer to a struct with the window handle. Must be a + * wbCSelf struct. + * @param type Single character indicating which SW_ flag to use. + * + * @return True if the window was previously visible. Return false if the + * window was previously hidden. + */ +logical_t _showWindow(void *pCSelf, char type) +{ + int flag; + switch ( type ) + { + case 'D' : + case 'N' : + case 'S' : + flag = SW_NORMAL; + break; + + case 'H' : + flag = SW_HIDE; + break; + + case 'I' : + flag = SW_SHOWNA; + break; + + case 'M' : + flag = SW_SHOWMINIMIZED; + break; + + case 'R' : + flag = SW_RESTORE; + break; + + case 'X' : + flag = SW_SHOWMAXIMIZED; + break; + + default : + flag = SW_SHOW; + break; + + } + return ShowWindow(getWBWindow(pCSelf), flag); +} + +uint32_t showFast(void *pCSelf, char type) +{ + HWND hwnd = getWBWindow(pCSelf); + uint32_t style = GetWindowLong(hwnd, GWL_STYLE); + if ( style ) + { + if ( type == 'H' ) + { + style ^= WS_VISIBLE; + } + else + { + style |= WS_VISIBLE; + } + SetWindowLong(hwnd, GWL_STYLE, style); + return 0; + } + return 1; +} + +/** WindowBase::show() / WindowBase::hide() + * + * Hides or shows the window. This function is mapped to both methods of + * WindowBase. The return for these methods was not previously documented. + * + * @return True if the window was previously visible. Return false if the + * window was previously hidden. + */ +RexxMethod1(logical_t, wb_show, CSELF, pCSelf) +{ + return _showWindow(pCSelf, msgAbbrev(context)); +} + +/** WindowBase::showFast() / WindowBase::hideFast() + * + * Hides or shows the window 'fast'. What this means is the visible flag is + * set, but the window is not forced to update. + * + * This function is mapped to both methods of WindowBase. The return for these + * methods was not previously documented. + * + * @return 0 for no error, 1 for error. An error is highly unlikely. + */ +RexxMethod1(uint32_t, wb_showFast, CSELF, pCSelf) +{ + return showFast(pCSelf, msgAbbrev(context)); +} + +/** WindowsBase::draw() / WindowsBase::redraw + * + * Causes the entire client area of the the window to be redrawn. + * + * This method maps to both the draw() and the redrawClient() methods. The + * implementation preserves existing behavior prior to ooRexx 4.0.0. That is: + * the draw() method takes no argument and always uses false for the erase + * background arg. The redrawClient() method takes an argument to set the + * erase background arg. The argument can be either .true / .false (1 or 0), + * or yes / no, or ja / nein. + * + * @param erase [optional] Whether the redraw operation should erase the + * window background. Can be true / false or yes / no. The + * default is false. + * + * @return 0 for success, 1 for error. + */ +RexxMethod2(uint32_t, wb_redrawClient, OPTIONAL_CSTRING, erase, CSELF, pCSelf) +{ + RECT r; + HWND hwnd = getWBWindow(pCSelf); + + bool doErase = (msgAbbrev(context) == 'R') ? isYes(erase) : false; + + GetClientRect(hwnd, &r); + return redrawRect(hwnd, &r, doErase) ? 0 : 1; +} + +/** WindowsBase::redraw() + * + * Causes the entire window, including frame, to be redrawn. + * + * @return 0 for success, 1 for error. + */ +RexxMethod1(logical_t, wb_redraw, CSELF, pCSelf) +{ + return RedrawWindow(getWBWindow(pCSelf), NULL, NULL, RDW_ERASE | RDW_FRAME | RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN) != 0; +} + +/** WindowBase::title / WindowBase::getText() + * + * Gets the window text. + * + * For a window with a frame, this is the window title. But for a dialog + * control, this is the text for the control. This of course varies depending + * on the type of control. For a button, it is the button label, for an edit + * control it is the edit text, etc.. + * + * @return On success, the window text, which could be the empty string. On + * failure, the empty string. + * + * @note Sets the .SystemErrorCode. + * + */ +RexxMethod1(RexxStringObject, wb_getText, CSELF, pCSelf) +{ + oodResetSysErrCode(context); + RexxStringObject result = context->NullString(); + + HWND hwnd = getWBWindow(pCSelf); + uint32_t count = (uint32_t)GetWindowTextLength(hwnd); + + if ( count == 0 ) + { + oodSetSysErrCode(context); + return result; + } + + // TODO For all windows except an edit control this is fine. For an edit + // control with a very large amount of text, see if it could be optimized by + // using a string buffer. + + LPTSTR pBuf = (LPTSTR)malloc(++count); + if ( pBuf == NULL ) + { + outOfMemoryException(context); + return result; + } + + count = GetWindowText(hwnd, pBuf, count); + if ( count != 0 ) + { + result = context->String(pBuf); + } + else + { + oodSetSysErrCode(context); + } + free(pBuf); + + return result; +} + +/** WindowBase::setText() / WindowBase::setTitle() / WindowBase::title= + * + * Sets the window text to the value specified. + * + * @param text The text to be set as the window text + * + * @return 0 for success, 1 for error. + * + * @note Sets the .SystemErrorCode. + * + * @remarks Unfortunately, in 3.2.0, setText for an edit control was + * documented as returning the negated system error code and in 4.0.0 + * setText for a static control was documented as returning the + * system error code (which is positive of course.) The mapping here + * to the various versions of 'getText' is cleaner, but we may need + * to special case the return to match the previous documentation. + */ +RexxMethod2(wholenumber_t, wb_setText, CSTRING, text, CSELF, pCSelf) +{ + oodResetSysErrCode(context); + if ( SetWindowText(getWBWindow(pCSelf), text) == 0 ) + { + oodSetSysErrCode(context); + return 1; + } + return 0; +} + +RexxMethod2(uint32_t, wb_getWindowLong_pvt, int32_t, flag, CSELF, pCSelf) +{ + return GetWindowLong(getWBWindow(pCSelf), flag); +} + +/** + * Methods for the .Window class. + */ +#define WINDOW_CLASS "Window" + +RexxMethod2(RexxObjectPtr, window_init, POINTERSTRING, hwnd, OSELF, self) +{ + if ( !IsWindow((HWND)hwnd) ) + { + invalidTypeException(context, 1, " window handle"); + } + else + { + initWindowBase(context, (HWND)hwnd, self); + } + return NULLOBJECT; +} + + +/** * Methods for the .PlainBaseDialog class. */ #define PLAINBASEDIALOG_CLASS "PlainBaseDialog" +bool convert2PointerSize(RexxMethodContext *c, RexxObjectPtr obj, uint64_t *number, int argPos) +{ + if ( obj == NULLOBJECT ) + { + *number = 0; + return true; + } + + if ( c->IsPointer(obj) ) + { + *number = (uint64_t)c->PointerValue((RexxPointerObject)obj); + return true; + } + + return rxStr2Number(c, c->ObjectToStringValue(obj), number, argPos); +} + RexxMethod0(RexxObjectPtr, pbdlg_init_cls) { context->SetObjectVariable("FONTNAME", context->String(DEFAULT_FONTNAME)); @@ -900,24 +1371,41 @@ return context->GetObjectVariable("FONTSIZE"); } +RexxMethod5(RexxObjectPtr, pbdlg_init, RexxObjectPtr, library, RexxObjectPtr, resource, + OPTIONAL_RexxObjectPtr, dlgDataStem, OPTIONAL_RexxObjectPtr, hFile, OSELF, self) +{ + RexxMethodContext *c = context; -bool convert2PointerSize(RexxMethodContext *c, RexxObjectPtr obj, uint64_t *number, int argPos) -{ - if ( obj == NULLOBJECT ) + context->SetObjectVariable("LIBRARY", library); + context->SetObjectVariable("RESOURCE", resource); + + if ( argumentExists(3) ) { - *number = 0; - return true; + context->SetObjectVariable("DLGDATA.", dlgDataStem); + c->SendMessage1(self, "USESTEM=", TheTrueObj); } + else + { + context->SetObjectVariable("DLGDATA.", TheNilObj); + c->SendMessage1(self, "USESTEM=", TheFalseObj); + } - if ( c->IsPointer(obj) ) + if ( ! initWindowBase(context, NULL, self) ) { - *number = (uint64_t)c->PointerValue((RexxPointerObject)obj); - return true; + return NULLOBJECT; } - return rxStr2Number(c, c->ObjectToStringValue(obj), number, argPos); + if ( argumentOmitted(4) ) + { + return c->SendMessage(self, "FINALINIT", c->NewArray(0)); + } + else + { + return c->SendMessage1(self, "FINALINIT", hFile); + } } + /** PlainBaseDialog::addUserMessage() * * Adds a message to the message table. @@ -1128,14 +1616,6 @@ hWnd = GET_HWND(argv[3]); if ( hWnd == 0 || ! IsWindow(hWnd) ) RETERR - if ( argv[2].strptr[0] == 'E' ) /* Enabled */ - { - RETVAL((BOOL)IsWindowEnabled(hWnd)); - } - else if ( argv[2].strptr[0] == 'V' ) /* Visible */ - { - RETVAL((BOOL)IsWindowVisible(hWnd)); - } else if ( argv[2].strptr[0] == 'Z' ) /* Zoomed is Maximized */ { RETVAL((BOOL)IsZoomed(hWnd)); Modified: main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp 2009-08-23 04:26:21 UTC (rev 5100) @@ -418,14 +418,7 @@ tar[i] = '\0'; } -bool IsYes(const char * s) -{ - if (!strlen(s)) return FALSE; - - return ((s[0]=='j') || (s[0]=='J') || (s[0]=='y') || (s[0]=='Y') || atoi(s)); -} - -/* Slightly stricter than IsYes. TODO remove this when YesNoMessage() is +/* Slightly stricter than isYes. TODO remove this when YesNoMessage() is fixed. */ bool IsNo(const char * s) { Modified: main/trunk/extensions/platform/windows/oodialog/oodCommon.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodCommon.h 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/oodCommon.h 2009-08-23 04:26:21 UTC (rev 5100) @@ -62,10 +62,21 @@ winDateTimePicker, winUnknown } oodControl_t; +/* Struct for the WindowBase class CSelf. */ +typedef struct _wbCSelf { + HWND hwnd; + wholenumber_t initCode; + uint32_t sizeX; + uint32_t sizeY; + double factorX; + double factorY; +} wbCSelf; +typedef wbCSelf *pWbCSelf; + extern BOOL DialogInAdminTable(DIALOGADMIN * Dlg); extern void rxstrlcpy(CHAR * tar, CONSTRXSTRING &src); extern void rxdatacpy(CHAR * tar, RXSTRING &src); -extern bool IsYes(const char *s); +extern bool isYes(const char *s); extern bool IsNo(const char * s); extern void *string2pointer(const char *string); extern void pointer2string(char *, void *pointer); @@ -105,6 +116,8 @@ extern bool getTextExtent(HFONT, HDC, CSTRING, SIZE *); extern bool checkControlClass(HWND, oodControl_t); +bool initWindowBase(RexxMethodContext *c, HWND hwndObj, RexxObjectPtr self); + // Shared button stuff. typedef enum {push, check, radio, group, owner, notButton} BUTTONTYPE, *PBUTTONTYPE; typedef enum {def, autoCheck, threeState, autoThreeState, noSubtype } BUTTONSUBTYPE, *PBUTTONSUBTYPE; @@ -160,4 +173,39 @@ return (HWND)rxGetPointerAttribute(context, windowObject, "HWND"); } +/** + * Returns the first character of the message name that invoked the current + * method. + * + * @param context The method context. + * + * @return The first charactere of the message name. + */ +inline char msgAbbrev(RexxMethodContext *context) +{ + return *(context->GetMessageName()); +} + +/** + * Checks that the argument could be construed as 'true'. This would be 1 or + * yes, but for historical reasons the German ja must also be included. + * + * This will also work for an optional arg to an API method. I.e., if s is + * null, false is returned. + * + * @param s The string to check. + * + * @return bool + */ +inline bool isYes(const char * s) +{ + if ( s == NULL || strlen(s) == 0 ) + { + return FALSE; + } + + char c = toupper(s[0]); + return ( c == 'J' || c =='Y' || c == '1' ); +} + #endif Modified: main/trunk/extensions/platform/windows/oodialog/oodControls.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodControls.cpp 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/oodControls.cpp 2009-08-23 04:26:21 UTC (rev 5100) @@ -43,17 +43,62 @@ */ #include "ooDialog.h" // Must be first, includes windows.h and oorexxapi.h -//#include <stdio.h> +#include <stdio.h> #include "APICommon.h" #include "oodCommon.h" +typedef struct newControlParams { + HWND hwnd; + uint32_t id; + HWND hwndDlg; + RexxObjectPtr parentDlg; +} NEWCONTROLPARAMS; +typedef NEWCONTROLPARAMS *PNEWCONTROLPARAMS; + + /** * Methods for the .DialogControl class. */ #define DIALOGCONTROL_CLASS "DialogControl" +/** DialogControl::new() + * + * + */ +RexxMethod3(RexxObjectPtr, dlgctrl_new_cls, OPTIONAL_POINTER, args, OSELF, self, SUPER, superClass) +{ + RexxMethodContext *c = context; + RexxObjectPtr control = TheNilObj; + if ( argumentOmitted(1) || args == NULL ) + { + goto done_out; + } + + control = c->ForwardMessage(NULLOBJECT, NULL, superClass, c->NewArray(0)); + if ( control == NULLOBJECT ) + { + control = TheNilObj; + goto done_out; + } + + PNEWCONTROLPARAMS params = (PNEWCONTROLPARAMS)args; + + if ( ! initWindowBase(context, params->hwnd, control) ) + { + control = TheNilObj; + goto done_out; + } + + c->SendMessage1(control, "ID=", c->UnsignedInt32(params->id)); + c->SendMessage1(control, "ODLG=", params->parentDlg); + c->SendMessage1(control, "HDLG=", pointer2string(context, params->hwndDlg)); + +done_out: + return control; +} + /** DialogControl::getTextSizeDlg() * * Gets the size (width and height) in dialog units for any given string for @@ -248,7 +293,7 @@ * @returns The properly instantiated dialog control object on success, or the * nil object on failure. * - * @remarks Replaces / combines the individualy getXXXControl() and the + * @remarks Replaces / combines the individual getXXXControl() and the * getControl() methods of the AdvancedControl class. Either returns * the control object asked for, or .nil. * @@ -321,28 +366,24 @@ // instantiated for this specific control, yet. We instantiate one now and // then store the object in the user data area of the control window. - // TODO Much of the information we just determined, is re-determined in the - // new method of the dialog control. It would be nice to change the new - // method to take a .Pointer object and rewrite the new method as a native - // API method and pass this information directly. - RexxArrayObject args; - if ( isCategoryDlg ) + PNEWCONTROLPARAMS pArgs = (PNEWCONTROLPARAMS)malloc(sizeof(NEWCONTROLPARAMS)); + if ( pArgs == NULL ) { - args = c->ArrayOfThree(self, c->UnsignedInt32(id), c->UnsignedInt32(categoryPageID)); + outOfMemoryException(context); + goto out; } - else - { - args = c->ArrayOfTwo(self, c->UnsignedInt32(id)); - } - rxControl = c->SendMessage(controlCls, "NEW", args); + pArgs->hwnd = hControl; + pArgs->hwndDlg = hDlg; + pArgs->id = id; + pArgs->parentDlg = self; + + rxControl = c->SendMessage1(controlCls, "NEW", c->NewPointer(pArgs)); + free(pArgs); + if ( rxControl != NULLOBJECT && rxControl != TheNilObj ) { - // In the old Rexx implementing code, there was the possibility here - // that we would have a control object that would not be valid and have - // its hwnd set to 0. That is no longer possible. result = rxControl; - setWindowPtr(hControl, GWLP_USERDATA, (LONG_PTR)result); c->SendMessage1(self, "putControl", result); } Modified: main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp 2009-08-23 01:57:08 UTC (rev 5099) +++ main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp 2009-08-23 04:26:21 UTC (rev 5100) @@ -202,13 +202,39 @@ REXX_METHOD_PROTOTYPE(generic_setListTabulators); -REXX_METHOD_PROTOTYPE(wb_getStyleRaw); -REXX_METHOD_PROTOTYPE(wb_getExStyleRaw); +REXX_METHOD_PROTOTYPE(wb_getHwnd); +REXX_METHOD_PROTOTYPE(wb_setHwnd); +REXX_METHOD_PROTOTYPE(wb_getInitCode); +REXX_METHOD_PROTOTYPE(wb_setInitCode); +REXX_METHOD_PROTOTYPE(wb_getFactorX); +REXX_METHOD_PROTOTYPE(wb_setFactorX); +REXX_METHOD_PROTOTYPE(wb_getFactorY); +REXX_METHOD_PROTOTYPE(wb_setFactorY); +REXX_METHOD_PROTOTYPE(wb_getSizeX); +REXX_METHOD_PROTOTYPE(wb_setSizeX); +REXX_METHOD_PROTOTYPE(wb_getSizeY); +REXX_METHOD_PROTOTYPE(wb_setSizeY); +REXX_METHOD_PROTOTYPE(wb_getPixelX); +REXX_METHOD_PROTOTYPE(wb_getPixelY); +REXX_METHOD_PROTOTYPE(wb_init_windowBase); +REXX_METHOD_PROTOTYPE(wb_enable); +REXX_METHOD_PROTOTYPE(wb_isEnabled); +REXX_METHOD_PROTOTYPE(wb_isVisible); +REXX_METHOD_PROTOTYPE(wb_show); +REXX_METHOD_PROTOTYPE(wb_showFast); +REXX_METHOD_PROTOTYPE(wb_redrawClient); +REXX_METHOD_PROTOTYPE(wb_redraw); +REXX_METHOD_PROTOTYPE(wb_getText); +REXX_METHOD_PROTOTYPE(wb_setText); +REXX_METHOD_PROTOTYPE(wb_getWindowLong_pvt); +REXX_METHOD_PROTOTYPE(window_init); + REXX_METHOD_PROTOTYPE(pbdlg_init_cls); REXX_METHOD_PROTOTYPE(pbdlg_setDefaultFont_cls); REXX_METHOD_PROTOTYPE(pbdlg_getFontName_cls); REXX_METHOD_PROTOTYPE(pbdlg_getFontSize_cls); +REXX_METHOD_PROTOTYPE(pbdlg_init); REXX_METHOD_PROTOTYPE(pbdlg_getTextSizeDlg); REXX_METHOD_PROTOTYPE(pbdlg_addUserMessage); @@ -258,6 +284,7 @@ REXX_METHOD_PROTOTYPE(il_isNull); REXX_METHOD_PROTOTYPE(il_handle); +REXX_METHOD_PROTOTYPE(dlgctrl_new_cls); REXX_METHOD_PROTOTYPE(dlgctrl_getTextSizeDlg); REXX_METHOD_PROTOTYPE(advCtrl_getControl); @@ -297,8 +324,6 @@ REXX_METHOD_PROTOTYPE(pbc_setBkColor); REXX_METHOD_PROTOTYPE(pbc_setBarColor); -REXX_METHOD_PROTOTYPE(stc_getText); -REXX_METHOD_PROTOTYPE(stc_setText); REXX_METHOD_PROTOTYPE(stc_getIcon); REXX_METHOD_PROTOTYPE(stc_setIcon); REXX_METHOD_PROTOTYPE(stc_getImage); @@ -446,16 +471,42 @@ REXX_METHOD(generic_setListTabulators, generic_setListTabulators), - REXX_METHOD(wb_getStyleRaw, wb_getStyleRaw), - REXX_METHOD(wb_getExStyleRaw, wb_getExStyleRaw), + REXX_METHOD(wb_init_windowBase, wb_init_windowBase), + REXX_METHOD(wb_getHwnd, wb_getHwnd), + REXX_METHOD(wb_setHwnd, wb_setHwnd), + REXX_METHOD(wb_getInitCode, wb_getInitCode), + REXX_METHOD(wb_setInitCode, wb_setInitCode), + REXX_METHOD(wb_getFactorX, wb_getFactorX), + REXX_METHOD(wb_setFactorX, wb_setFactorX), + REXX_METHOD(wb_getFactorY, wb_getFactorY), + REXX_METHOD(wb_setFactorY, wb_setFactorY), + REXX_METHOD(wb_getSizeX, wb_getSizeX), + REX... [truncated message content] |
From: <mie...@us...> - 2009-08-29 16:06:19
|
Revision: 5109 http://oorexx.svn.sourceforge.net/oorexx/?rev=5109&view=rev Author: miesfeld Date: 2009-08-29 16:06:05 +0000 (Sat, 29 Aug 2009) Log Message: ----------- ooDialog - additional work toward moving to the use of .Pointer for window handles. Cosmetic changes, use a style of method names starting with a small letter rather than a capital, use the same capitalization style for key words. Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp main/trunk/extensions/platform/windows/oodialog/APICommon.h main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/anibuttn.cls main/trunk/extensions/platform/windows/oodialog/basedlg.cls main/trunk/extensions/platform/windows/oodialog/catdlg.cls main/trunk/extensions/platform/windows/oodialog/dlgext.cls main/trunk/extensions/platform/windows/oodialog/dyndlg.cls main/trunk/extensions/platform/windows/oodialog/msgext.cls main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp main/trunk/extensions/platform/windows/oodialog/oodCommon.cpp main/trunk/extensions/platform/windows/oodialog/oodCommon.h main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp main/trunk/extensions/platform/windows/oodialog/oodialog.mak main/trunk/extensions/platform/windows/oodialog/oodutils.cls main/trunk/extensions/platform/windows/oodialog/oovother.cpp main/trunk/extensions/platform/windows/oodialog/oovuser.cpp main/trunk/extensions/platform/windows/oodialog/plbdlg.cls main/trunk/extensions/platform/windows/oodialog/pludlg.cls main/trunk/extensions/platform/windows/oodialog/propsht.cls main/trunk/extensions/platform/windows/oodialog/resdlg.cls main/trunk/extensions/platform/windows/oodialog/stddlg.cls main/trunk/extensions/platform/windows/oodialog/stdext.cls main/trunk/extensions/platform/windows/oodialog/userdlg.cls Added Paths: ----------- main/trunk/extensions/platform/windows/oodialog/oodControl.cpp Removed Paths: ------------- main/trunk/extensions/platform/windows/oodialog/oodControls.cpp Modified: main/trunk/extensions/platform/windows/oodialog/APICommon.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-08-28 15:34:35 UTC (rev 5108) +++ main/trunk/extensions/platform/windows/oodialog/APICommon.cpp 2009-08-29 16:06:05 UTC (rev 5109) @@ -468,3 +468,30 @@ return false; } +/** + * Print out the class ID of a Rexx object. Useful in debugging to identify + * exactly what a Rexx object is. Will work with class objects or instance + * objects. + * + * @param c The method context we are operating in. + * @param obj The object to identify. + */ +void dbgPrintClassID(RexxMethodContext *c, RexxObjectPtr obj) +{ + if ( ! c->IsOfType(obj, "CLASS") ) + { + obj = c->SendMessage0(obj, "CLASS"); + } + + CSTRING name = "<null>"; + if ( obj != NULLOBJECT ) + { + RexxStringObject id = (RexxStringObject)c->SendMessage0(obj, "ID"); + if ( id != NULLOBJECT ) + { + name = c->CString(id); + } + } + printf("Class: %s\n", name); +} + Modified: main/trunk/extensions/platform/windows/oodialog/APICommon.h =================================================================== --- main/trunk/extensions/platform/windows/oodialog/APICommon.h 2009-08-28 15:34:35 UTC (rev 5108) +++ main/trunk/extensions/platform/windows/oodialog/APICommon.h 2009-08-29 16:06:05 UTC (rev 5109) @@ -85,5 +85,6 @@ extern RexxObjectPtr rxSetObjVar(RexxMethodContext *c, CSTRING varName, RexxObjectPtr val); extern bool isInt(RexxMethodContext *, int, RexxObjectPtr); extern bool isOfClassType(RexxMethodContext *, RexxObjectPtr, CSTRING); +extern void dbgPrintClassID(RexxMethodContext *c, RexxObjectPtr obj); #endif Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-08-28 15:34:35 UTC (rev 5108) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-08-29 16:06:05 UTC (rev 5109) @@ -51,56 +51,56 @@ ::method getTreeControl unguarded external "LIBRARY oodialog advCtrl_getControl" ::method getListControl unguarded external "LIBRARY oodialog advCtrl_getControl" ::method getTabControl unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetEditControl unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetRadioControl unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetCheckControl unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetGroupBox unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetListBox unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetComboBox unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetScrollBar unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetProgressBar unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetSliderControl unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetMonthCalendar unguarded external "LIBRARY oodialog advCtrl_getControl" -::method GetDateTimePicker unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getEditControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getRadioControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getCheckControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getGroupBox unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getListBox unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getComboBox unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getScrollBar unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getProgressBar unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getSliderControl unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getMonthCalendar unguarded external "LIBRARY oodialog advCtrl_getControl" +::method getDateTimePicker unguarded external "LIBRARY oodialog advCtrl_getControl" -::method ConnectTreeControl unguarded +::method connectTreeControl unguarded use arg id, attributeName forward message "AddAttribute" continue if result = -1 then return -1 - return DataTable(self~Adm,"ADD",result,6); /* new id in result 6 == Tree Type */ + return DataTable(self~adm,"ADD",result,6); /* new id in result 6 == Tree Type */ -::method ConnectListControl unguarded +::method connectListControl unguarded use arg id, attributeName forward message "AddAttribute" continue if result = -1 then return -1 - return DataTable(self~Adm,"ADD",result,7); /* new id in result 7 == List Type */ + return DataTable(self~adm,"ADD",result,7); /* new id in result 7 == List Type */ -::method ConnectSliderControl unguarded +::method connectSliderControl unguarded use arg id, attributeName forward message "AddAttribute" continue if result = -1 then return -1 - return DataTable(self~Adm,"ADD",result,8); /* new id in result 8 == Track Bar Type */ + return DataTable(self~adm,"ADD",result,8); /* new id in result 8 == Track Bar Type */ -::method ConnectTabControl unguarded +::method connectTabControl unguarded use arg id, attributeName forward message "AddAttribute" continue if result = -1 then return -1 - return DataTable(self~Adm,"ADD",result,9); /* new id in result 9 == Tab Type */ + return DataTable(self~adm,"ADD",result,9); /* new id in result 9 == Tab Type */ -::method ConnectDateTimePicker unguarded +::method connectDateTimePicker unguarded use arg id, attributeName forward message "AddAttribute" continue if result = -1 then return -1 - return DataTable(self~Adm,"ADD",result,10); /* new id in result 10 == Date and Time Picker */ + return DataTable(self~adm,"ADD",result,10); /* new id in result 10 == Date and Time Picker */ -::method ConnectMonthCalendar unguarded +::method connectMonthCalendar unguarded use arg id, attributeName forward message "AddAttribute" continue if result = -1 then return -1 - return DataTable(self~Adm,"ADD",result,11); /* new id in result 11 == Month Calendar */ + return DataTable(self~adm,"ADD",result,11); /* new id in result 11 == Month Calendar */ -::method InternGetNewCtrlStyle +::method internGetNewCtrlStyle use arg style, kind ret = "" if style~wordpos("NOT WS_VISIBLE") > 0 then ret = "HIDDEN" @@ -192,34 +192,34 @@ return ret -::method AddTreeControl +::method addTreeControl use arg id, attname, x, y, cx, cy, opts symbid = id id = self~ItemAdd(id) if id < 0 then return id - if Arg(2,'o') = 1 then attname = "DATA"id + if arg(2,'o') = 1 then attname = "DATA"id opts = self~GetDefaultOpts(opts) if opts = "ALL" then opts = "LINES VSCROLL HSCROLL EDIT BUTTONS ATROOT SHOWSELALWAYS" self~activePtr = UsrAddNewCtrl("TREE", self~activePtr, id, x, y, cx, cy, opts) - if self~AutoDetect = 1 then do + if self~autoDetect then do return self~ConnectTreeControl(symbid, attname) end return 0 -::method AddListControl +::method addListControl use arg id, attname, x, y, cx, cy, opts symbid = id id = self~ItemAdd(id) if id < 0 then return id - if Arg(2,'o') = 1 then attname = "DATA"id + if arg(2,'o') = 1 then attname = "DATA"id opts = self~GetDefaultOpts(opts) self~activePtr = UsrAddNewCtrl("LIST", self~activePtr, id, x, y, cx, cy, opts) - if self~AutoDetect = 1 then do + if self~autoDetect then do return self~ConnectListControl(symbid, attname) end return 0 -::method AddProgressBar +::method addProgressBar use arg id, x, y, cx, cy, opts symbid = id id = self~ItemAdd(id) @@ -228,28 +228,28 @@ self~activePtr = UsrAddNewCtrl("PROGRESS", self~activePtr, id, x, y, cx, cy, opts) return 0 -::method AddSliderControl +::method addSliderControl use arg id, attname, x, y, cx, cy, opts symbid = id id = self~ItemAdd(id) if id < 0 then return id - if Arg(2,'o') = 1 then attname = "DATA"id + if arg(2,'o') = 1 then attname = "DATA"id opts = self~GetDefaultOpts(opts) self~activePtr = UsrAddNewCtrl("SLIDER", self~activePtr, id, x, y, cx, cy, opts) - if self~AutoDetect = 1 then do + if self~autoDetect then do return self~ConnectSliderControl(symbid, attname) end return 0 -::method AddTabControl +::method addTabControl use arg id, attname, x, y, cx, cy, opts symbid = id id = self~ItemAdd(id) if id < 0 then return id - if Arg(2,'o') = 1 then attname = "DATA"id + if arg(2,'o') = 1 then attname = "DATA"id opts = self~GetDefaultOpts(opts) self~activePtr = UsrAddNewCtrl("TAB", self~activePtr, id, x, y, cx, cy, opts) - if opts~wordpos("CAT") = 0 & self~AutoDetect = 1 then do + if opts~wordpos("CAT") = 0 & self~autoDetect then do return self~ConnectTabControl(symbid, attname) end return 0 @@ -288,84 +288,87 @@ /* Base class for all other controls */ ::class 'DialogControl' public inherit WindowBase WindowExtensions -::method oDlg attribute -- The ooRexx dialog object this control belongs to -::method hDlg attribute -- The window handle of that dialog -::method id attribute -- The numerical resource ID for this control - ::method new class external "LIBRARY oodialog dlgctrl_new_cls" +::method init external "LIBRARY oodialog dlgctrl_init" + +::attribute id get -- The numerical resource ID for this control +::attribute oDlg get -- The ooRexx dialog object this control belongs to +::attribute hDlg get -- The window handle of that dialog + ::method getTextSizeDlg unguarded external "LIBRARY oodialog dlgctrl_getTextSizeDlg" +::method unInit external "LIBRARY oodialog dlgctrl_unInit" -::method ProcessMessage +::method processMessage parse arg msg,wp,lp return SendWinMsg("DLG",self~hDlg,self~Id,msg,wp,lp) -::method Message2Parent unguarded private /* This is the replacement for BoxMessage */ +::method message2Parent unguarded private /* This is the replacement for BoxMessage */ use arg msg, wP, lP return SendWinMsg("PTR", self~hDlg, self~Id, msg, wP, lP) -::method SetColor +::method setColor use arg colorbk, colorfg - if Arg(2,'o') = 1 then - return SetBackground(self~oDlg~Adm, "COL", self~id, colorbk) /* creates an entry in the dialogs color table */ + if arg(2,'o') = 1 then + return SetBackground(self~oDlg~adm, "COL", self~id, colorbk) /* creates an entry in the dialogs color table */ else - return SetBackground(self~oDlg~Adm, "COL", self~id, colorbk, colorfg) /* set both, background and foreground color */ + return SetBackground(self~oDlg~adm, "COL", self~id, colorbk, colorfg) /* set both, background and foreground color */ -::method SetSysColor +::method setSysColor use arg colorbk, colorfg - if Arg(2,'o') = 1 then - return SetBackground(self~oDlg~Adm, "COL", self~id, colorbk, "", "SYS") /* creates an entry in the dialogs color table */ + if arg(2,'o') = 1 then + return SetBackground(self~oDlg~adm, "COL", self~id, colorbk, "", "SYS") /* creates an entry in the dialogs color table */ else - return SetBackground(self~oDlg~Adm, "COL", self~id, colorbk, colorfg, "SYS") /* set both, background and foreground color */ + return SetBackground(self~oDlg~adm, "COL", self~id, colorbk, colorfg, "SYS") /* set both, background and foreground color */ -::method AssignFocus +::method assignFocus return SendWinMsg("ANY",self~hDlg, "0x0028", self~hwnd, 1) -::method GetFocus unguarded +::method getFocus unguarded return Wnd_Desktop("GETFOC", self~hDlg) -::method SetFocus unguarded +::method setFocus unguarded use arg hwnd return Wnd_Desktop("SETFOC", self~hDlg, hwnd) -::method TabToNext unguarded +::method tabToNext unguarded return Wnd_Desktop("SETFOC", self~hDlg, 0, "N") -::method TabToPrevious unguarded +::method tabToPrevious unguarded return Wnd_Desktop("SETFOC", self~hDlg, 1, "P") -::method TabStop unguarded +::method tabStop unguarded use arg wantStop = .true if \ wantStop~datatype('O')then return -3 return HandleControlEx(self~hDlg, self~id, "X", "TAB", wantStop) -::method Group unguarded +::method group unguarded use arg wantGroup = .true if \ wantGroup~datatype('O')then return -3 return HandleControlEx(self~hDlg, self~id, "X", "GROUP", wantGroup) -::method Clear +::method clear parse value WindowRect("GET", self~Hwnd) with r.1 r.2 r.3 r.4 - return WindowRect("CLR", self~oDlg~Adm, self~Hwnd,r.1,r.2,r.3,r.4) + return WindowRect("CLR", self~oDlg~adm, self~Hwnd,r.1,r.2,r.3,r.4) -::method ClearRect +::method clearRect use arg left, top, right, bottom - return WindowRect("CLR", self~oDlg~Adm, self~hwnd,left,top,right,bottom) + return WindowRect("CLR", self~oDlg~adm, self~hwnd,left,top,right,bottom) -::method Value unguarded +::method value unguarded return self~oDlg~InternalGetItemData(self~Id, self~hDlg) -::method "Value=" unguarded +::method "value=" unguarded use arg data self~oDlg~InternalSetItemData(self~Id, data, self~hDlg) -::method CaptureMouse +::method captureMouse return Wnd_Desktop("CAP", self~hDlg, self~hwnd) -::method GetMouseCapture +::method getMouseCapture return Wnd_Desktop("CAP", self~hDlg, "G") -::method ReleaseMouseCapture +::method releaseMouseCapture return Wnd_Desktop("CAP", self~hDlg, "R") ::method IsMouseButtonDown @@ -401,7 +404,7 @@ /* Redraws the given rectangle */ ::method RedrawRect unguarded use arg left, top, right, bottom, erasebkg - if Arg(5, 'o') = 1 then erasebkg = 0 + if arg(5, 'o') = 1 then erasebkg = 0 return WindowRect("RDW", self~hwnd,left,top,right,bottom, erasebkg) -- DEPRECATED @@ -421,34 +424,34 @@ ::method RootArray attribute private -::method Init +::method init forward class (super) continue self~RootArray = .array~new(4) ::method Insert use arg parent, after, text, image, selImage, opts, children - if Arg(1,'o') = 1 then parent = "ROOT" - if Arg(2,'o') = 1 then after = "LAST" - if Arg(4,'o') = 1 then image = -1 - if Arg(5,'o') = 1 then selImage = image - if Arg(6,'o') = 1 then opts = "" - if Arg(7,'o') = 1 then children = 0 + if arg(1,'o') = 1 then parent = "ROOT" + if arg(2,'o') = 1 then after = "LAST" + if arg(4,'o') = 1 then image = -1 + if arg(5,'o') = 1 then selImage = image + if arg(6,'o') = 1 then opts = "" + if arg(7,'o') = 1 then children = 0 return HandleTreeCtrl("INS", self~Hwnd, parent, after, text, image, opts~translate, children, selImage) ::method Add - do i = 1 to Arg() - if Arg(i,'E') = 1 then do - if Arg(i+1,'e') = 1 then image = Arg(i+1); else image = -1 - if Arg(i+2,'e') = 1 then selImage = Arg(i+2); else selImage = image - if Arg(i+3,'e') = 1 then opts = Arg(i+3); else opts = "" - if Arg(i+4,'e') = 1 then children = Arg(i+4); else children = 0 /* for dynamic children */ + do i = 1 to arg() + if arg(i,'E') = 1 then do + if arg(i+1,'e') = 1 then image = arg(i+1); else image = -1 + if arg(i+2,'e') = 1 then selImage = arg(i+2); else selImage = image + if arg(i+3,'e') = 1 then opts = arg(i+3); else opts = "" + if arg(i+4,'e') = 1 then children = arg(i+4); else children = 0 /* for dynamic children */ if i=1 then do - self~RootArray[i] = self~Insert("ROOT",,Arg(i),image,selimage,opts~translate, children) + self~RootArray[i] = self~Insert("ROOT",,arg(i),image,selimage,opts~translate, children) return self~RootArray[i] end else if self~RootArray~HasIndex(i-1)=1 then do if i=1 then parent = "ROOT"; else parent = self~RootArray[i-1] - self~RootArray[i] = self~Insert(parent,,Arg(i),image,selimage,opts~translate, children) + self~RootArray[i] = self~Insert(parent,,arg(i),image,selimage,opts~translate, children) return self~RootArray[i] end else return 0 @@ -701,7 +704,7 @@ ::method SetHoverTime use arg time - if Arg(1, 'O') then time = -1 + if arg(1, 'O') then time = -1 if \ time~datatype('W') then raise syntax 93.905 array(1, time) if time < -1 then time = -1 return HandleListCtrlEx(self~Hwnd, "M", "HOVER", time) @@ -739,29 +742,29 @@ ::method InsertColumn use arg nr, text, width, fmt if arg(1,'O') then nr = 0 - if Arg(3,'o') = 1 then width = -1; else width = width*self~factorX - if Arg(4,'o') = 1 then fmt = "LEFT" + if arg(3,'o') = 1 then width = -1; else width = width*self~factorX + if arg(4,'o') = 1 then fmt = "LEFT" return HandleListCtrl("C","INS", self~Hwnd, nr, text, width, fmt~translate) ::method DeleteColumn use arg nr - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("C","DEL", self~Hwnd, nr) ::method ModifyColumn use arg nr, text, width, fmt - if Arg(1,'o') = 1 then return -1 - if Arg(2,'o') = 1 then text = "" - if Arg(3,'o') = 1 then width = -1; else width = width*self~factorX - if Arg(4,'o') = 1 then fmt = "" + if arg(1,'o') = 1 then return -1 + if arg(2,'o') = 1 then text = "" + if arg(3,'o') = 1 then width = -1; else width = width*self~factorX + if arg(4,'o') = 1 then fmt = "" return HandleListCtrl("C","SET", self~Hwnd, nr, text, width, fmt~translate) ::method ColumnInfo use arg nr - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 ret = HandleListCtrl("C","GET", self~Hwnd, nr, "InternalLVColInfo") if InternalLVColInfo.!Width~Datatype('N') = 1 then InternalLVColInfo.!Width = InternalLVColInfo.!Width / self~factorX return InternalLVColInfo. @@ -771,13 +774,13 @@ ::method columnWidthEx external "LIBRARY oodialog lv_columnWidthEx" -- TODO review method name ::method ColumnWidth use arg nr - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("C","GETWIDTH", self~Hwnd, nr) / self~factorX ::method SetColumnWidth use arg nr, width - if Arg(1,'o') = 1 then return -1 - if Arg(2,'o') = 1 then width = "AUTO" + if arg(1,'o') = 1 then return -1 + if arg(2,'o') = 1 then width = "AUTO" if width~datatype("N") = 1 then width = width * self~factorX return HandleListCtrl("C","SETWIDTH", self~Hwnd, nr, width~translate) @@ -787,18 +790,18 @@ ::method StringWidth use arg text - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("M","STRWIDTH", self~Hwnd, text) / self~factorX ::method Insert use arg nr, subnr, text, image if arg(2,'O') then subnr = 0 - if Arg(1,'o') = 1 then do + if arg(1,'o') = 1 then do if subnr = 0 then nr = self~LastItem + 1 else nr = self~LastItem end - if Arg(4,'o') = 1 then image = -1 + if arg(4,'o') = 1 then image = -1 if subnr = 0 then do item = HandleListCtrl("I","INS", self~Hwnd, nr, text, image) if item \= -1 then self~LastItem = item @@ -809,33 +812,33 @@ ::method Modify use arg nr, subnr, text, image - if Arg(1,'o') = 1 then nr = self~Selected + if arg(1,'o') = 1 then nr = self~Selected if arg(2,'O') then subnr = 0 - if Arg(4,'o') = 1 then image = -1 + if arg(4,'o') = 1 then image = -1 return HandleListCtrl("I","SET", self~Hwnd, nr, subnr, text, image) ::method SetItemText use arg item, subitem, text - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 if arg(2,'O') then subitem = 0 return HandleListCtrl("I","SET", self~Hwnd, item, subitem, text,"TXT") ::method SetItemState use arg item, state - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("I","SET", self~Hwnd, item, 0, state, "STATE") ::method Add - do i = 1 to Arg() - if Arg(i,'E') = 1 then do - if Arg(i+1,'e') = 1 then image = Arg(i+1); else image = -1 + do i = 1 to arg() + if arg(i,'E') = 1 then do + if arg(i+1,'e') = 1 then image = arg(i+1); else image = -1 if i = 1 then do - item = self~Insert(self~LastItem+1,i-1,Arg(i),image) + item = self~Insert(self~LastItem+1,i-1,arg(i),image) if item \= -1 then self~LastItem = item end else do - item = self~Insert(self~LastItem,i-1,Arg(i),image) + item = self~Insert(self~LastItem,i-1,arg(i),image) end return item end @@ -845,14 +848,14 @@ ::method AddRow use arg nr, image, text - if Arg(1,'o') = 1 then nr = self~LastItem+1 - if Arg(2,'o') = 1 then image = -1 - if Arg(3,'o') = 1 then text = "" + if arg(1,'o') = 1 then nr = self~LastItem+1 + if arg(2,'o') = 1 then image = -1 + if arg(3,'o') = 1 then text = "" item = self~Insert(nr,0,text,image) if item \= -1 then do self~LastItem = item - do i = 4 to Arg() - if Arg(i,'E') = 1 then self~Insert(item,i-3,Arg(i),-1) + do i = 4 to arg() + if arg(i,'E') = 1 then self~Insert(item,i-3,arg(i),-1) end end return item @@ -861,7 +864,7 @@ ::method Delete use arg item - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("I","DEL",self~hwnd, item) ::method DeleteAll @@ -875,7 +878,7 @@ ::method Prepare4nItems use arg citems - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("M","SETCNT", self~Hwnd, citems) @@ -884,30 +887,30 @@ ::method ItemInfo use arg item, subitem - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 if arg(2,'O') then subitem = 0 ret = HandleListCtrl("I","GET", self~Hwnd, item, subitem, "InternalLVItemInfo", "") return InternalLVItemInfo. ::method ItemText use arg item, subitem - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 if arg(2,'O') then subitem = 0 return HandleListCtrl("I","GET", self~Hwnd, item, subitem, "", "TXT") ::method ItemState use arg item - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("I","GET", self~Hwnd, item, subitem, "", "STATE") ::method Select use arg item - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("I","SET", self~Hwnd, item, 0, "SELECTED", "STATE") ::method Deselect use arg item - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("I","SET", self~Hwnd, item, 0, "NOTSELECTED", "STATE") ::method Selected @@ -956,7 +959,7 @@ -- 0. This, rather unfortunately, can cause some infinite loops because iterating code is looking for -- a -1 value to mark the iteration end. if self~Items < 2 then return -1 - if Arg(1,'o') = 1 then startItem = -1 + if arg(1,'o') = 1 then startItem = -1 return HandleListCtrl("I","GETNEXT", self~Hwnd, startItem, "ABOVE TOLEFT") ::method NextLeft @@ -965,7 +968,7 @@ -- 0. This, rather unfortunately, can cause some infinite loops because iterating code is looking for -- a -1 value to mark the iteration end. if self~Items < 2 then return -1 - if Arg(1,'o') = 1 then startItem = -1 + if arg(1,'o') = 1 then startItem = -1 return HandleListCtrl("I","GETNEXT", self~Hwnd, startItem, "TOLEFT") ::method NextRight @@ -974,7 +977,7 @@ -- 0. This, rather unfortunately, can cause some infinite loops because iterating code is looking for -- a -1 value to mark the iteration end. if self~Items < 2 then return -1 - if Arg(1,'o') = 1 then startItem = -1 + if arg(1,'o') = 1 then startItem = -1 return HandleListCtrl("I","GETNEXT", self~Hwnd, startItem, "TORIGHT") ::method SmallSpacing @@ -985,13 +988,13 @@ ::method RedrawItems use arg first, last - if Arg(1,'o') = 1 then first = 0 - if Arg(2,'o') = 1 then last = self~items + if arg(1,'o') = 1 then first = 0 + if arg(2,'o') = 1 then last = self~items return HandleListCtrl("M","REDRAW", self~Hwnd, first, last) ::method UpdateItem use arg item - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("M","UPDATE", self~Hwnd, item) ::method Update @@ -999,8 +1002,8 @@ ::method EnsureVisible use arg item, partial - if Arg(1,'o') = 1 then return -1 - if Arg(2,'o') = 1 then partial = 0 + if arg(1,'o') = 1 then return -1 + if arg(2,'o') = 1 then partial = 0 return HandleListCtrl("M", "ENVIS", self~Hwnd, item, partial) -- DEPRECATED @@ -1017,7 +1020,7 @@ return self~removeImageList(.nil, 1) -- DEPRECATED -::method RemoveImages +::method removeImages return self~removeImageList(.nil, 0) ::method setImageList external "LIBRARY oodialog lv_setImageList" @@ -1025,22 +1028,22 @@ ::method Find use arg txt, startItem, wrap - if Arg(2,'o') = 1 then startItem = -1 - if Arg(3,'o') = 1 then wrap = 0 + if arg(2,'o') = 1 then startItem = -1 + if arg(3,'o') = 1 then wrap = 0 if wrap = 1 | wrap~translate = "J" then opt = "WRAP"; else opt = "" return HandleListCtrl("I", "FIND", self~Hwnd, startItem, opt, txt) ::method FindPartial use arg txt, startItem, wrap - if Arg(2,'o') = 1 then startItem = -1 - if Arg(3,'o') = 1 then wrap = 0 + if arg(2,'o') = 1 then startItem = -1 + if arg(3,'o') = 1 then wrap = 0 if wrap = 1 | wrap~translate = "J" then opt = "PARTIAL WRAP"; else opt = "PARTIAL" return HandleListCtrl("I", "FIND", self~Hwnd, startItem, opt, txt) ::method FindNearestXY use arg x,y, direction - if Arg(1,'o') = 1 | Arg(2,'o') = 1 then return -1 - if Arg(3,'o') = 1 then direction = "DOWN" + if arg(1,'o') = 1 | arg(2,'o') = 1 then return -1 + if arg(3,'o') = 1 then direction = "DOWN" return HandleListCtrl("I", "FIND", self~Hwnd, -1, "NEAREST", x, y, direction~translate) ::method Arrange @@ -1057,19 +1060,19 @@ ::Method ItemPos use arg item - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("M", "GETPOS", self~Hwnd, item) ::Method SetItemPos use arg item, x, y - if Arg(1,'o') = 1 then return -1 - if Arg(2,'o') = 1 then x = 0 - if Arg(3,'o') = 1 then y = 0 + if arg(1,'o') = 1 then return -1 + if arg(2,'o') = 1 then x = 0 + if arg(3,'o') = 1 then y = 0 return HandleListCtrl("M", "SETPOS", self~Hwnd, item, x, y) ::method Edit use arg hitem - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleListCtrl("I", "EDIT", self~Hwnd, hitem) ::method EndEdit @@ -1086,8 +1089,8 @@ ::method Scroll use arg x, y - if Arg(1,'o') = 1 then x = 0 - if Arg(2,'o') = 1 then y = 0 + if arg(1,'o') = 1 then x = 0 + if arg(2,'o') = 1 then y = 0 return HandleListCtrl("M", "SCROLL", self~Hwnd, x, y) ::Method BkColor @@ -1230,10 +1233,10 @@ ::method Insert use arg nr, text, image, lparam - if Arg(1,'o') = 1 then nr = self~LastItem + 1 - if Arg(2,'o') = 1 then text = "" - if Arg(3,'o') = 1 then image = -1 - if Arg(4,'o') = 1 then item = HandleOtherNewCtrls("TAB","INS", self~Hwnd, nr, text, image) + if arg(1,'o') = 1 then nr = self~LastItem + 1 + if arg(2,'o') = 1 then text = "" + if arg(3,'o') = 1 then image = -1 + if arg(4,'o') = 1 then item = HandleOtherNewCtrls("TAB","INS", self~Hwnd, nr, text, image) else item = HandleOtherNewCtrls("TAB","INS", self~Hwnd, nr, text, image, lparam) if item \= -1 then self~LastItem = item return item @@ -1241,19 +1244,19 @@ ::method Modify use arg nr, text, image, lparam - if Arg(1,'o') = 1 then return -1 - if Arg(2,'o') = 1 then text = "" - if Arg(3,'o') = 1 then image = -1 - if Arg(4,'o') = 1 then return HandleOtherNewCtrls("TAB","SET", self~Hwnd, nr, text, image) + if arg(1,'o') = 1 then return -1 + if arg(2,'o') = 1 then text = "" + if arg(3,'o') = 1 then image = -1 + if arg(4,'o') = 1 then return HandleOtherNewCtrls("TAB","SET", self~Hwnd, nr, text, image) else return HandleOtherNewCtrls("TAB","SET", self~Hwnd, nr, text, image, lparam) /* adds text1, text2, text3.... */ ::method AddSequence nr = self~LastItem - do i= 1 to Arg() + do i= 1 to arg() nr = nr + 1 - nr = self~Insert(nr,Arg(i)) + nr = self~Insert(nr,arg(i)) if nr = -1 then return -1 /* error occurred */ self~LastItem = nr end @@ -1261,17 +1264,17 @@ /* adds text1, image1, lparam1, text2, image2, lparam2, text3.... */ ::method AddFullSeq - args = Arg() + args = arg() nr = self~LastItem i = 1 do while i <= args nr = nr + 1 - if i+2 <= args & Arg(i+2,'e') = 1 then do - if Arg(i+1,'e') = 1 then nr = self~Insert(nr,Arg(i), Arg(i+1), Arg(i+2)) - else nr = self~Insert(nr,Arg(i),, Arg(i+2)) + if i+2 <= args & arg(i+2,'e') = 1 then do + if arg(i+1,'e') = 1 then nr = self~Insert(nr,arg(i), arg(i+1), arg(i+2)) + else nr = self~Insert(nr,arg(i),, arg(i+2)) end - else if i+1 <= args & Arg(i+1,'e') = 1 then nr = self~Insert(nr,Arg(i), Arg(i+1)) - else nr = self~Insert(nr,Arg(i)) + else if i+1 <= args & arg(i+1,'e') = 1 then nr = self~Insert(nr,arg(i), arg(i+1)) + else nr = self~Insert(nr,arg(i)) if nr = -1 then return -1 /* error occurred */ self~LastItem = nr i = i+3 @@ -1286,13 +1289,13 @@ ::method ItemInfo use arg hItem - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 ret = HandleOtherNewCtrls("TAB","GET",self~Hwnd, hItem, "InternalTCItemInfo") return InternalTCItemInfo. ::method Delete use arg item - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return HandleOtherNewCtrls("TAB","DEL",self~Hwnd, item) ::method DeleteAll @@ -1342,7 +1345,7 @@ ::method PosRectangle use arg item - if Arg(1,'o') = 1 then return "" + if arg(1,'o') = 1 then return "" return HandleOtherNewCtrls("TAB","RECT",self~Hwnd, item) ::method AdjustToRectangle @@ -1373,14 +1376,14 @@ ::Method Select use arg start, end - if Arg(1,'o') = 1 then start = 1 - if Arg(2,'o') = 1 then end = 0 + if arg(1,'o') = 1 then start = 1 + if arg(2,'o') = 1 then end = 0 self~Message2Parent(0x00B1, start-1, end-1) ::Method ScrollCommand use arg kind, reps - if Arg(1,'o') = 1 then kind = "UP"; else kind = kind~translate - if Arg(2,'o') = 1 then reps = 1 + if arg(1,'o') = 1 then kind = "UP"; else kind = kind~translate + if arg(2,'o') = 1 then reps = 1 select when kind = "UP" | kind = "LEFT" then sb = 0 when kind = "DOWN" | kind = "RIGHT" then sb = 1 @@ -1403,7 +1406,7 @@ ::Method SetModified use arg bool - if Arg(1,'o') = 1 then bool = 1 + if arg(1,'o') = 1 then bool = 1 self~Message2Parent(0x00B9, bool, 0) ::Method Lines @@ -1411,18 +1414,18 @@ ::Method LineIndex use arg line - if Arg(1,'o') = 1 then line = 0 + if arg(1,'o') = 1 then line = 0 return self~Message2Parent(0x00BB, line-1, 0) +1 ::Method LineLength use arg line - if Arg(1,'o') = 1 then line = -1; else line = line-1 + if arg(1,'o') = 1 then line = -1; else line = line-1 ndx = self~Message2Parent(0x00BB, line, 0) return self~Message2Parent(0x00C1, ndx, 0) ::Method ReplaceSelText use arg text - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 self~Message2Parent(0x00C2, 1, "T" || text) ::Method SetLimit @@ -1431,7 +1434,7 @@ ::Method LineFromIndex use arg ndx - if Arg(1,'o') = 1 then ndx = -1; else ndx = ndx -1 + if arg(1,'o') = 1 then ndx = -1; else ndx = ndx -1 return self~Message2Parent(0x00C9, ndx, 0) +1 ::Method "PasswordChar=" @@ -1448,16 +1451,16 @@ ::Method SetReadOnly use arg bool - if Arg(1,'o') = 1 then bool = 1 + if arg(1,'o') = 1 then bool = 1 return \self~Message2Parent(0x00CF, bool, 0) ::Method SetMargins use arg left, right flag = 0 - if Arg(1,'o') = 1 & Arg(2,'o') = 1 then flag = "0xFFFF" /* no arguments = auto margins */ + if arg(1,'o') = 1 & arg(2,'o') = 1 then flag = "0xFFFF" /* no arguments = auto margins */ else do - if Arg(1,'e') = 1 then flag = flag + 1 - if Arg(2,'e') = 1 then flag = flag + 2 + if arg(1,'e') = 1 then flag = flag + 1 + if arg(2,'e') = 1 then flag = flag + 2 end self~Message2Parent(0x00D3, flag, right*X2D("10000") + left) @@ -1469,8 +1472,8 @@ ::method GetLine use arg line, maxlen - if Arg(1,'o') = 1 then line = 0 - if Arg(2,'o') = 1 then maxlen = 255 + if arg(1,'o') = 1 then line = 0 + if arg(2,'o') = 1 then maxlen = 255 return self~Message2Parent(0x00C4, line-1, "G" || maxlen) ::method "Tab=" @@ -1532,7 +1535,7 @@ ::method test external "LIBRARY oodialog bc_test" ::method changeBitmap unguarded - arga = Arg(1,"A") + arga = arg(1,"A") newarg = .array~new(arga~Items+1) newarg[1] = self~ID do i = 1 to arga~Items; if arga~hasindex(i) = 1 then newarg[i+1] = arga[i]; end @@ -1546,7 +1549,7 @@ return self~oDlg~GetBmpDisplacement(self~ID) ::method scrollText unguarded - arga = Arg(1,"A") + arga = arg(1,"A") newarg = .array~new(arga~Items+1) newarg[1] = self~hwnd do i = 1 to arga~Items; if arga~hasindex(i) = 1 then newarg[i+1] = arga[i]; end @@ -1555,7 +1558,7 @@ /* This method moves the rectangle within a button and redraws the uncovered area */ ::method scroll unguarded use arg xPos, yPos, left, top, right, bottom - return ScrollTheWindow(self~oDlg~Adm, self~hwnd, xPos, yPos, left, top, right, bottom, "yes") + return ScrollTheWindow(self~oDlg~adm, self~hwnd, xPos, yPos, left, top, right, bottom, "yes") ::method getBitmapSizeX unguarded return self~oDlg~GetBitmapSizeX(self~ID) @@ -1567,7 +1570,7 @@ /* Use this method to move a bitmap or a part of it... */ ::method drawBitmap unguarded - arga = Arg(1,"A") + arga = arg(1,"A") newarg = .array~new(arga~Items+2) newarg[1] = self~hwnd newarg[2] = self~id @@ -1578,7 +1581,7 @@ /* This method will draw the bitmap step by step */ ::method dimBitmap unguarded - arga = Arg(1,"A") + arga = arg(1,"A") newarg = .array~new(arga~Items+1) newarg[1] = self~id do i = 1 to arga~Items; if arga~hasindex(i) = 1 then newarg[i+1] = arga[i]; end @@ -1586,7 +1589,7 @@ ::method scrollBitmapFromTo unguarded - arga = Arg(1,"A") + arga = arg(1,"A") newarg = .array~new(arga~Items+1) newarg[1] = self~id do i = 1 to arga~Items; if arga~hasindex(i) = 1 then newarg[i+1] = arga[i]; end @@ -1618,18 +1621,18 @@ ::method Add use arg data - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return self~Message2Parent(0x00000180, 0, "T" || data) +1 ::method Insert use arg index, data - if Arg(2,'o') = 1 then return -1 - if Arg(1,"o") = 1 then index = self~SelectedIndex + if arg(2,'o') = 1 then return -1 + if arg(1,"o") = 1 then index = self~SelectedIndex return self~Message2Parent(0x00000181, index-1, "T" || data) + 1 ::method Delete use arg index - if Arg(1,"o") = 1 then index = self~SelectedIndex + if arg(1,"o") = 1 then index = self~SelectedIndex return self~Message2Parent(0x00000182, index-1, 0) ::method DeleteAll @@ -1637,9 +1640,9 @@ ::method Find use arg dataString, ndx, how - if Arg(1,'o') = 1 then return -1 - if Arg(2,'o') = 1 then ndx = 0 - if Arg(3,'e') = 1 & (how = 1 | how~left(1)~translate = "E") then + if arg(1,'o') = 1 then return -1 + if arg(2,'o') = 1 then ndx = 0 + if arg(3,'e') = 1 & (how = 1 | how~left(1)~translate = "E") then index = self~Message2Parent(0x000001A2, ndx-1, "T" || dataString) /* find exactly */ else index = self~Message2Parent(0x0000018F, ndx-1, "T" || dataString) /* find prefix */ @@ -1663,15 +1666,15 @@ ::method Select use arg text - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 index = self~Message2Parent(0x0000018F, 0, "T" || text) if index < 0 then return 0 return self~Message2Parent(0x00000186, index, 0) ::method SelectRange use arg fromNdx, toNdx - if Arg(1,'o') = 1 then fromNdx = 1 - if Arg(2,'o') = 1 then toNdx = self~Items + if arg(1,'o') = 1 then fromNdx = 1 + if arg(2,'o') = 1 then toNdx = self~Items lparam = (toNdx-1) * "10000"~x2d + (fromNdx-1) return self~Message2Parent(0x0000019B, 1, lparam) @@ -1679,8 +1682,8 @@ ::method DeselectRange use arg fromNdx, toNdx - if Arg(1,'o') = 1 then fromNdx = 1 - if Arg(2,'o') = 1 then toNdx = self~Items + if arg(1,'o') = 1 then fromNdx = 1 + if arg(2,'o') = 1 then toNdx = self~Items lparam = (toNdx-1) * "10000"~x2d + (fromNdx-1) return self~Message2Parent(0x0000019B, 0, lparam) @@ -1711,7 +1714,7 @@ ::method Modify use arg index, dataString - if Arg(1,"o") = 1 then index = self~SelectedIndex + if arg(1,"o") = 1 then index = self~SelectedIndex if index <= 0 then return -1 self~Delete(index) return self~Insert(index, dataString) @@ -1720,7 +1723,7 @@ ::method AddDirectory use arg drvPath, fileAttributes - if Arg(2,"o") = 1 then fileAttributes = "READWRITE" + if arg(2,"o") = 1 then fileAttributes = "READWRITE" READWRITE = 0 READONLY = 1 HIDDEN = 2 @@ -1734,7 +1737,7 @@ ::method SetWidth use arg dlgunits - if Arg(1,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 + if arg(1,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 self~Message2Parent(0x00000194, dlgunits*self~factorX, 0) ::method Width @@ -1742,7 +1745,7 @@ ::method "ItemHeight=" use arg dlgunits - if Arg(1,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 + if arg(1,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 self~Message2Parent(0x000001A0, 0, dlgunits*self~factorY) ::method ItemHeight @@ -1750,7 +1753,7 @@ ::method "ColumnWidth=" use arg dlgunits - if Arg(1,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 + if arg(1,'o') = 1 | dlgunits~datatype("N") = 0 then return -1 self~Message2Parent(0x00000195, dlgunits*self~factorX, 0) @@ -1762,18 +1765,18 @@ ::method Add use arg data - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 return self~Message2Parent(0x00000143, 0, "T" || data) + 1 ::method Insert use arg index, data - if Arg(2,'o') = 1 then return -1 - if Arg(1,"o") = 1 then index = self~SelectedIndex + if arg(2,'o') = 1 then return -1 + if arg(1,"o") = 1 then index = self~SelectedIndex return self~Message2Parent(0x0000014A, index-1, "T" || data) + 1 ::method Delete use arg index - if Arg(1,"o") = 1 then index = self~SelectedIndex + if arg(1,"o") = 1 then index = self~SelectedIndex return self~Message2Parent(0x00000144, index-1, 0) ::method DeleteAll @@ -1781,9 +1784,9 @@ ::method Find use arg dataString, ndx, how - if Arg(1,'o') = 1 then return -1 - if Arg(2,'o') = 1 then ndx = 0 - if Arg(3,'e') = 1 & (how = 1 | how~left(1)~translate = "E") then + if arg(1,'o') = 1 then return -1 + if arg(2,'o') = 1 then ndx = 0 + if arg(3,'e') = 1 & (how = 1 | how~left(1)~translate = "E") then index = self~Message2Parent(0x00000158, ndx-1, "T" || dataString) /* find exactly */ else index = self~Message2Parent(0x0000014C, ndx-1, "T" || dataString) /* find prefix */ @@ -1803,7 +1806,7 @@ ::method Select use arg text - if Arg(1,'o') = 1 then return -1 + if arg(1,'o') = 1 then return -1 index = self~Message2Parent(0x0000014C, 0, "T" || text) if index < 0 then return 0 return self~Message2Parent(0x0000014E, index, 0) @@ -1819,7 +1822,7 @@ ::method Modify use arg index, dataString - if Arg(1,"o") = 1 then index = self~SelectedIndex + if arg(1,"o") = 1 then index = self~SelectedIndex if index <= 0 then return -1 self~Delete(index) return self~Insert(index, dataString) @@ -1835,8 +1838,8 @@ ::method EditSelection use arg startndx, endndx - if Arg(1,'o') = 1 then startNdx = 0 - if Arg(2,'o') = 1 then endNdx = 0 + if arg(1,'o') = 1 then startNdx = 0 + if arg(2,'o') = 1 then endNdx = 0 lparam = (endndx-1) * "10000"~x2d + (startndx -1) return (self~Message2Parent(0x00000142, 0, lparam)\=1) @@ -1844,7 +1847,7 @@ ::method AddDirectory use arg drvPath, fileAttributes - if Arg(2,"o") = 1 then fileAttributes = "READWRITE" + if arg(2,"o") = 1 then fileAttributes = "READWRITE" READWRITE = 0 READONLY = 1 HIDDEN = 2 @@ -1865,7 +1868,7 @@ ::method SetRange use arg min, max, redraw - if Arg(3, "o") = 1 then redraw = 1 + if arg(3, "o") = 1 then redraw = 1 return HandleScrollBar("SR",self~hwnd,min,max, redraw) ::method Range @@ -1873,7 +1876,7 @@ ::method SetPos use arg pos, redraw - if Arg(2, "o") = 1 then redraw = 1 + if arg(2, "o") = 1 then redraw = 1 return HandleScrollBar("SP",self~hwnd,pos, redraw) ::method Position @@ -1881,8 +1884,8 @@ ::method DeterminePosition use arg posdata, single, page - if Arg(2,"o") = 1 then single = 1 - if Arg(3,"o") = 1 then page = 10 + if arg(2,"o") = 1 then single = 1 + if arg(3,"o") = 1 then page = 10 code = .DlgUtil~loWord(posdata) parse value self~Range with rmin rmax pos = self~Position Modified: main/trunk/extensions/platform/windows/oodialog/anibuttn.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/anibuttn.cls 2009-08-28 15:34:35 UTC (rev 5108) +++ main/trunk/extensions/platform/windows/oodialog/anibuttn.cls 2009-08-29 16:06:05 UTC (rev 5109) @@ -45,7 +45,7 @@ ::class 'AnimatedButton' public -::method ParentDlg attribute +::method parentDlg attribute ::method stopped attribute ::method init @@ -75,9 +75,9 @@ sprite.smooth = 1 sprite.step = 1 - self~ParentDlg = dlg - spritewin = self~ParentDlg~GetItem(sprite.buttonid) - parse value self~ParentDlg~GetWindowRect(spritewin) with spos.left spos.top spos.right spos.bottom + self~parentDlg = dlg + spritewin = self~parentDlg~GetItem(sprite.buttonid) + parse value self~parentDlg~GetWindowRect(spritewin) with spos.left spos.top spos.right spos.bottom spos.bottom = spos.bottom - spos.top spos.right = spos.right - spos.left @@ -127,7 +127,7 @@ else spos.y = spos.y + move.y end - if self~ParentDlg~finished = 1 then return 1 + if self~parentDlg~finished = 1 then return 1 if (reset.x + reset.y) > 0 then do if reset.x = 1 then do @@ -148,24 +148,24 @@ if self~hittop = 1 then spos.y = spos.bottom - ss.y end end - if self~ParentDlg~finished = 1 then return 1 - self~ParentDlg~ChangeBitmapButton(sprite.buttonid, 0) - /* self~ParentDlg~ClearRect(spritewin, oldpos.x, oldpos.y, (oldpos.x + sprite.sizex), (oldpos.y + sprite.sizey)) */ + if self~parentDlg~finished = 1 then return 1 + self~parentDlg~ChangeBitmapButton(sprite.buttonid, 0) + /* self~parentDlg~ClearRect(spritewin, oldpos.x, oldpos.y, (oldpos.x + sprite.sizex), (oldpos.y + sprite.sizey)) */ end - if self~ParentDlg~finished = 1 then return 1 - self~ParentDlg~DisplaceBitmap(sprite.buttonid, spos.x, spos.y); + if self~parentDlg~finished = 1 then return 1 + self~parentDlg~DisplaceBitmap(sprite.buttonid, spos.x, spos.y); ::method setpos unguarded expose spritewin spos. sprite. use arg new.x, new.y - if self~ParentDlg~finished = 1 then return 1 - self~ParentDlg~ChangeBitmapButton(sprite.buttonid, 0) - self~ParentDlg~ClearRect(spritewin, spos.x, spos.y, (spos.x + sprite.sizex), (spos.y + sprite.sizey)) + if self~parentDlg~finished = 1 then return 1 + self~parentDlg~ChangeBitmapButton(sprite.buttonid, 0) + self~parentDlg~ClearRect(spritewin, spos.x, spos.y, (spos.x + sprite.sizex), (spos.y + sprite.sizey)) spos.x = new.x spos.y = new.y - self~ParentDlg~DisplaceBitmap(sprite.buttonid, spos.x, spos.y); + self~parentDlg~DisplaceBitmap(sprite.buttonid, spos.x, spos.y); ::method getpos expose spos. @@ -183,8 +183,8 @@ do actsprite = sprite.from by sprite.step to sprite.to if (sprite.movex \= 0) | (sprite.movey \=0) then self~movepos(sprite.movex, sprite.movey) - if self~ParentDlg~finished = 1 then return 1 - self~ParentDlg~ChangeBitmapButton(sprite.buttonid, actsprite,,,,opts) + if self~parentDlg~finished = 1 then return 1 + self~parentDlg~ChangeBitmapButton(sprite.buttonid, actsprite,,,,opts) if (sprite.delay \= 0) then ret = msSleep(sprite.delay) end end @@ -194,8 +194,8 @@ if (sprite.movex \= 0) | (sprite.movey \=0) then self~movepos(sprite.movex, sprite.movey) - if self~ParentDlg~finished = 1 then return 1 - self~ParentDlg~ChangeBitmapButton(sprite.buttonid, actsprite,,,,opts) + if self~parentDlg~finished = 1 then return 1 + self~parentDlg~ChangeBitmapButton(sprite.buttonid, actsprite,,,,opts) if (sprite.delay \= 0) then ret = msSleep(sprite.delay) end end @@ -226,13 +226,13 @@ ::method run unguarded - do until(self~stopped = 1) | (self~ParentStopped) | self~ParentDlg~finished = 1 + do until(self~stopped = 1) | (self~ParentStopped) | self~parentDlg~finished = 1 self~moveseq end return 0 ::method Parentstopped - return self~ParentDlg~finished + return self~parentDlg~finished ::method stop self~stopped = 1 Modified: main/trunk/extensions/platform/windows/oodialog/basedlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/basedlg.cls 2009-08-28 15:34:35 UTC (rev 5108) +++ main/trunk/extensions/platform/windows/oodialog/basedlg.cls 2009-08-29 16:06:05 UTC (rev 5109) @@ -62,7 +62,7 @@ ::method SetHScrollPos unguarded use arg pos, redraw - if Arg(2, 'o') = 1 then redraw = 1 + if arg(2, 'o') = 1 then redraw = 1 return WndShow_Pos("B", self~hwnd, 0, pos, redraw) ::method VScrollPos unguarded @@ -70,7 +70,7 @@ ::method SetVScrollPos unguarded use arg pos, redraw - if Arg(2, 'o') = 1 then redraw = 1 + if arg(2, 'o') = 1 then redraw = 1 return WndShow_Pos("B", self~hwnd, 1, pos, redraw) ::method Scroll unguarded @@ -130,24 +130,24 @@ ::method LoadBitmap unguarded use arg bmpFilename, option - if Arg(2, 'o') = 1 then option = ""; else option = option~translate - return LoadRemoveBitmap(0 /* NULL Adm */, bmpFilename, "LOAD" || option) + if arg(2, 'o') = 1 then option = ""; else option = option~translate + return LoadRemoveBitmap(0 /* NULL adm */, bmpFilename, "LOAD" || option) /* This method will free a memory bitmap */ ::method RemoveBitmap unguarded use arg hBitmap - return LoadRemoveBitmap(0 /* NULL Adm */, hBitmap, "REMOVE") + return LoadRemoveBitmap(0 /* NULL adm */, hBitmap, "REMOVE") ::method CreateBrush unguarded use arg color, brushSpecifier - if Arg() = 0 then return HandleDC_Obj("B") - if Arg(1, "o") = 1 then color = 1 - if Arg(2, "o") = 1 then return HandleDC_Obj("B", color) + if arg() = 0 then return HandleDC_Obj("B") + if arg(1, "o") = 1 then color = 1 + if arg(2, "o") = 1 then return HandleDC_Obj("B", color) brushSpecifier = brushSpecifier~translate if brushSpecifier = "UPDIAGONAL" | brushSpecifier = "DOWNDIAGONAL" | brushSpecifier = "CROSS" | brushSpecifier = "DIAGCROSS", | brushSpecifier = "HORIZONTAL" | brushSpecifier = "VERTICAL" then return HandleDC_Obj("B", color, brushSpecifier) - else return HandleDC_Obj("B", 0 /* NULL ADM */, color, brushSpecifier) /* brushSpecifier must be filename */ + else return HandleDC_Obj("B", 0 /* NULL adm */, color, brushSpecifier) /* brushSpecifier must be filename */ /* This method allows you to write text to a window in the given font, in */ /* the given size, and to the given position */ @@ -162,9 +162,9 @@ /* "HEAVY" */ ::method Write unguarded - argarr = Arg(1, "A") + argarr = arg(1, "A") newarg = .array~new(argarr~Items+1) - do i = 1 to Arg(); newarg[i+1] = argarr[i]; end + do i = 1 to arg(); newarg[i+1] = argarr[i]; end newarg[1] = self~hwnd forward message (WriteToWindow) arguments (newarg) @@ -193,7 +193,7 @@ ::method FontColor unguarded use arg color, dc - if Arg(1,'o') = 1 then color = 1 + if arg(1,'o') = 1 then color = 1 return DrawGetSet("COL", dc, color) ::method getTextSizeScreen external "LIBRARY oodialog winex_getTextSizeScreen" @@ -202,9 +202,9 @@ /* It returns a handle to a pen object */ ::method CreatePen unguarded use arg width, style, color - if Arg(1, "o") = 1 then width = 1 - if Arg(2, "o") = 1 then style = "SOLID"; else style = style~translate - if Arg(3, "o") = 1 then color = 0 + if arg(1, "o") = 1 then width = 1 + if arg(2, "o") = 1 then style = "SOLID"; else style = style~translate + if arg(3, "o") = 1 then color = 0 return HandleDC_Obj("P", width, style, color) /* This method will draw a rectangle to the given device context */ @@ -213,7 +213,7 @@ ::method Rectangle unguarded use arg dc, x, y, cx, cy, fill - if Arg(6, "o") = 1 then fill = '' + if arg(6, "o") = 1 then fill = '' if fill~left(1)~translate = 'F' then return DCDraw("REC", dc, x, y, cx, cy) ret = DrawGetSet("SDP", dc, x, y) @@ -226,7 +226,7 @@ ::method DrawLine unguarded use arg dc, fromX, fromY, toX, toY - if Arg(2, 'o') = 0 | Arg(3, 'o') = 0 then ret = DrawGetSet("SDP",dc, fromX, fromY) + if arg(2, 'o') = 0 | arg(3, 'o') = 0 then ret = DrawGetSet("SDP",dc, fromX, fromY) return DCDraw("LN",dc, toX, toY) /* This method draws a pixel within the device context */ @@ -270,7 +270,7 @@ ::method DrawAngleArc unguarded use arg dc, movex, movey, x, y, radius, startangle, sweepangle - if Arg(2, 'o') = 0 | Arg(3, 'o') = 0 then ret = DrawGetSet("SDP", dc, movex, movey) + if arg(2, 'o') = 0 | arg(3, 'o') = 0 then ret = DrawGetSet("SDP", dc, movex, movey) return DCDraw("ANG",dc, x, y, radius, startangle, sweepangle) ::method SetArcDirection unguarded @@ -312,8 +312,6 @@ if result <> 0 then return result self~scrollNow = 0 -- a kind of semaphore to handle multiple text scrolling - self~initCode = 0 - self~bkgBitmap = 0 -- no background bitmap self~bkgBrushBmp = 0 -- no background bitmap self~menuBar = .nil Modified: main/trunk/extensions/platform/windows/oodialog/catdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/catdlg.cls 2009-08-28 15:34:35 UTC (rev 5108) +++ main/trunk/extensions/platform/windows/oodialog/catdlg.cls 2009-08-29 16:06:05 UTC (rev 5109) @@ -68,11 +68,11 @@ /* arg style=[ "DROPDOWN" | "TOPLINE" | "NOBORDER" | "WIZARD"] */ ::method Init - use arg DlgData., cdx, cdy, cdcx, cdstyle, cdtable, cdlabel, cdmax, includeFile + use arg dlgData., cdx, cdy, cdcx, cdstyle, cdtable, cdlabel, cdmax, includeFile newArgs = .array~new(2) - if Arg(1, 'E') then newArgs[1] = Arg(1) - if Arg(9, 'E') then newArgs[2] = Arg(9) + if arg(1, 'E') then newArgs[1] = arg(1) + if arg(9, 'E') then newArgs[2] = arg(9) forward class (super) arguments (newArgs) continue if result <> 0 then return result @@ -87,14 +87,14 @@ self~catalog['page']['rightbtntext'] = "&Forward" self~catalog['page']['expected'] = 200 - if Arg(1,'o') = 1 then self~UseStem = 0; else self~UseStem = 1 - if Arg(2,'o') = 1 then self~catx = 10; else self~catX = cdx - if Arg(3,'o') = 1 then self~caty = 4; else self~caty = cdy - if Arg(4,'o') = 1 then self~catcx = 0; else self~catcx = cdcx - if Arg(5,'o') = 1 then self~catstyle = ""; else self~catstyle = cdstyle~translate - if Arg(6,'o') = 1 then cdtable = "" - if Arg(7,"o") = 1 then self~catlabel = "Page:"; else self~catlabel = cdlabel - if Arg(8,"o") = 1 then self~catmax = 0; else self~catmax = cdmax + if arg(1,'o') = 1 then self~useStem = .false; else self~useStem = .true + if arg(2,'o') = 1 then self~catx = 10; else self~catX = cdx + if arg(3,'o') = 1 then self~caty = 4; else self~caty = cdy + if arg(4,'o') = 1 then self~catcx = 0; else self~catcx = cdcx + if arg(5,'o') = 1 then self~catstyle = ""; else self~catstyle = cdstyle~translate + if arg(6,'o') = 1 then cdtable = "" + if arg(7,"o") = 1 then self~catlabel = "Page:"; else self~catlabel = cdlabel + if arg(8,"o") = 1 then self~catmax = 0; else self~catmax = cdmax if cdtable \= '' then do @@ -167,7 +167,7 @@ if (n > 0 | m > 0) & self~catstyle~wordpos('NOBORDER') = 0 then self~catstyle = self~catstyle||" NOBORDER" - if self~catalog['page']['h'] = .Nil then self~catalog['page']['h'] = self~sizeY - 40 + if self~catalog['page']['h'] = .nil then self~catalog['page']['h'] = self~sizeY - 40 size = self~getTextSizeDlg("Hg") textHeight = size~height @@ -185,24 +185,24 @@ end if n > 0 | m > 0 then do /* topline or dropdown */ - if self~catalog['page']['x'] = .Nil then self~catalog['page']['x'] = 1 + if self~catalog['page']['x'] = .nil then self~catalog['page']['x'] = 1 if m > 0 then do - if self~catalog['page']['y'] = .Nil then self~catalog['page']['y'] = self~caty*2+textHeight+4 + if self~catalog['page']['y'] = .nil then self~catalog['page']['y'] = self~caty*2+textHeight+4 end - else if self~catalog['page']['y'] = .Nil then self~catalog['page']['y'] = self~caty+textHeight+5 + else if self~catalog['page']['y'] = .nil then self~catalog['page']['y'] = self~caty+textHeight+5 - if self~catalog['page']['w'] = .Nil then self~catalog['page']['w'] = self~sizeX - 2 + if self~catalog['page']['w'] = .nil then self~catalog['page']['w'] = self~sizeX - 2 end else do if self~catmax = 0 then do - if self~catalog['page']['x'] = .Nil then self~catalog['page']['x'] = self~catX+10+self~catcx + if self~catalog['page']['x'] = .nil then self~catalog['page']['x'] = self~catX+10+self~catcx end else - if self~catalog['page']['x'] = .Nil then self~catalog['page']['x'] = self~catX+10+self~catcx * ((self~catalog['count']-1)%self~catmax+1) + if self~catalog['page']['x'] = .nil then self~catalog['page']['x'] = self~catX+10+self~catcx * ((self~catalog['count']-1)%self~catmax+1) - if self~catalog['page']['y'] = .Nil then self~catalog['page']['y'] = 5 + if self~catalog['page']['y'] = .nil then self~catalog['page']['y'] = 5 - if self~catalog['page']['w'] = .Nil then self~catalog['page']['w'] = self~sizeX - (self~catX+self~catcx+20) + if self~catalog['page']['w'] = .nil then self~catalog['page']['w'] = self~sizeX - (self~catX+self~catcx+20) end self~CategoryPage @@ -233,7 +233,7 @@ self~AddRadioStem(9001, self~catX, self~caty, self~catcx, catnames., self~catmax, newstyle || " CAT") end - self~dlgHandle = UsrCreateDialog(self~Adm, "PARENT", self~DialogItemCount, 0, self~BasePtr, self~AutoDetect, 1, 0, 0) + self~dlgHandle = UsrCreateDialog(self~adm, "PARENT", self~DialogItemCount, 0, self~BasePtr, self~autoDetect, 1, 0, 0) self~activePtr = 0 if self~dlgHandle = 0 then return 0 @@ -244,7 +244,7 @@ self~CreateCategoryDialog(p['x'], p['y'], p['w'], p['h'],p['font'], p['fsize'], p['style'] || " CHILD HIDDEN", p['expected']) msg = "self~" || self~catalog['names'][i]~space(0) interpret(msg) - ret = UsrCreateDialog(self~Adm, "CHILD", self~DialogItemCount, self~catalog['base'][i], self~dlgHandle, i) + ret = UsrCreateDialog(self~adm, "CHILD", self~DialogItemCount, self~catalog['base'][i], self~dlgHandle, i) self~activePtr = 0 self~catalog['handles'][i] = ret end @@ -340,12 +340,12 @@ use arg options if self~catalog['category'] = 0 then do - if Arg(1,"o") = 1 | options = "OPTIONS" | options = .Nil then options = "FIX"; + if arg(1,"o") = 1 | options = "OPTIONS" | options = .nil then options = "FIX"; else do if options~wordpos("FIX") = 0 then options = options || " FIX" end end - else if Arg(1,"o") = 1 | options = "OPTIONS" | options = .Nil then options = "" + else if arg(1,"o") = 1 | options = "OPTIONS" | options = .nil then options = "" return options~translate /* This method returs the currently selected page. Return value 1 means */ @@ -380,7 +380,7 @@ oldPage = self~catalog['category'] /* if ChangePage is called automatically, 2 arg are passed (WParam and LParam) */ - if Arg(2,'o') = 0 | NewPage > 9000 then NewPage = self~GetSelectedPage + if arg(2,'o') = 0 | NewPage > 9000 then NewPage = self~GetSelectedPage else do if self~catstyle~wordpos("DROPDOWN") = 0 then do /* SetRadioButton only works for registered radio buttons */ @@ -435,73 +435,73 @@ use arg id, fname forward message "AddAttribute" continue if result = -1 then return -1 /* new id in result */ - return DataTable(self~Adm,"ADD",result,0, self~catalog['category']); + return DataTable(self~adm,"ADD",result,0, self~catalog['category']); ::method ConnectComboBox use arg id, fname, opts forward message "AddAttribute" continue id = result; if result = -1 then return -1 /* new id in result */ if opts~translate~wordpos("LIST") = 0 then type = 0; else type = 5 - return DataTable(self~Adm,"ADD",id,type, self~catalog['category']); + return DataTable(self~adm,"ADD",id,type, self~catalog['category']); ::method ConnectCheckBox use arg id, fname forward message "AddAttribute" continue ... [truncated message content] |
From: <mie...@us...> - 2009-08-29 23:14:06
|
Revision: 5113 http://oorexx.svn.sourceforge.net/oorexx/?rev=5113&view=rev Author: miesfeld Date: 2009-08-29 23:13:52 +0000 (Sat, 29 Aug 2009) Log Message: ----------- Remove the old API HandleDialogAdmin() function which has been converted to the new API Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp Modified: main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp 2009-08-29 23:10:39 UTC (rev 5112) +++ main/trunk/extensions/platform/windows/oodialog/ooDialog.cpp 2009-08-29 23:13:52 UTC (rev 5113) @@ -327,62 +327,6 @@ return adm; } -/* prepare dialog management table for a new dialog entry */ -size_t RexxEntry HandleDialogAdmin(const char *funcname, size_t argc, CONSTRXSTRING *argv, const char *qname, RXSTRING *retstr) -{ - DIALOGADMIN * current; - DEF_ADM; - - EnterCriticalSection(&crit_sec); - - if (argc == 1) /* we have to do a dialog admin cleanup */ - { - GET_ADM; - if (!dlgAdm) - { - LeaveCriticalSection(&crit_sec); - RETVAL(-1); - } - - if (DialogInAdminTable(dlgAdm)) - { - DelDialog(dlgAdm); - } - safeLocalFree(dlgAdm->pMessageQueue); - LocalFree(dlgAdm); - } - else /* we have to do a new dialog admin allocation */ - { - if (StoredDialogs<MAXDIALOGS) - { - current = (DIALOGADMIN *) LocalAlloc(LPTR, sizeof(DIALOGADMIN)); - if (current) - { - current->pMessageQueue = (char *)LocalAlloc(LPTR, MAXLENQUEUE); - } - if (!current || !current->pMessageQueue) - { - MessageBox(0,"Out of system resources","Error",MB_OK | MB_ICONHAND | MB_SYSTEMMODAL); - LeaveCriticalSection(&crit_sec); - RETC(0); - } - current->previous = topDlg; - current->TableEntry = StoredDialogs; - StoredDialogs++; - DialogTab[current->TableEntry] = current; - LeaveCriticalSection(&crit_sec); - RETPTR(current) - } - else - { - MessageBox(0,"Too many active Dialogs","Error",MB_OK | MB_ICONHAND | MB_SYSTEMMODAL); - } - } - LeaveCriticalSection(&crit_sec); - RETC(0); -} - - /** * Do some common set up when creating the underlying Windows dialog for any * ooDialog dialog. This involves setting the 'topDlg' and the TheInstance Modified: main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp =================================================================== --- main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp 2009-08-29 23:10:39 UTC (rev 5112) +++ main/trunk/extensions/platform/windows/oodialog/oodPackageEntry.cpp 2009-08-29 23:13:52 UTC (rev 5113) @@ -91,7 +91,6 @@ REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDlg); REXX_CLASSIC_ROUTINE_PROTOTYPE(GetFileNameWindow); REXX_CLASSIC_ROUTINE_PROTOTYPE(DataTable); -REXX_CLASSIC_ROUTINE_PROTOTYPE(HandleDialogAdmin); REXX_CLASSIC_ROUTINE_PROTOTYPE(SetItemData); REXX_CLASSIC_ROUTINE_PROTOTYPE(SetStemData); REXX_CLASSIC_ROUTINE_PROTOTYPE(GetItemData); @@ -143,7 +142,6 @@ REXX_CLASSIC_ROUTINE(HandleDlg, HandleDlg), REXX_CLASSIC_ROUTINE(GetFileNameWindow, GetFileNameWindow), REXX_CLASSIC_ROUTINE(DataTable, DataTable), - REXX_CLASSIC_ROUTINE(HandleDialogAdmin, HandleDialogAdmin), REXX_CLASSIC_ROUTINE(SetItemData, SetItemData), REXX_CLASSIC_ROUTINE(SetStemData, SetStemData), REXX_CLASSIC_ROUTINE(GetItemData, GetItemData), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <mie...@us...> - 2009-08-29 23:22:20
|
Revision: 5111 http://oorexx.svn.sourceforge.net/oorexx/?rev=5111&view=rev Author: miesfeld Date: 2009-08-29 23:08:35 +0000 (Sat, 29 Aug 2009) Log Message: ----------- Dropped a method when converting to new API Modified Paths: -------------- main/trunk/extensions/platform/windows/oodialog/advctrl.cls main/trunk/extensions/platform/windows/oodialog/plbdlg.cls Modified: main/trunk/extensions/platform/windows/oodialog/advctrl.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-08-29 21:44:31 UTC (rev 5110) +++ main/trunk/extensions/platform/windows/oodialog/advctrl.cls 2009-08-29 23:08:35 UTC (rev 5111) @@ -285,7 +285,7 @@ /* Control Classes */ /***************************************************************************************************************/ -/* Base class for all other controls */ +-- Base class for all dialog controls ::class 'DialogControl' public inherit WindowBase WindowExtensions ::method new class external "LIBRARY oodialog dlgctrl_new_cls" Modified: main/trunk/extensions/platform/windows/oodialog/plbdlg.cls =================================================================== --- main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-08-29 21:44:31 UTC (rev 5110) +++ main/trunk/extensions/platform/windows/oodialog/plbdlg.cls 2009-08-29 23:08:35 UTC (rev 5111) @@ -100,6 +100,7 @@ ::method redraw unguarded external "LIBRARY oodialog wb_redraw" ::method "title=" unguarded external "LIBRARY oodialog wb_setText" +::method setTitle unguarded external "LIBRARY oodialog wb_setText" ::method title unguarded external "LIBRARY oodialog wb_getText" ::method setText unguarded external "LIBRARY oodialog wb_setText" ::method getText unguarded external "LIBRARY oodialog wb_getText" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |