Changeset 232 for trunk/src/helpers
- Timestamp:
- Dec 5, 2002, 9:36:28 PM (23 years ago)
- Location:
- trunk/src/helpers
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/_call_filedlg.c
r227 r232 11 11 #define INCL_WINFRAMEMGR 12 12 #define INCL_WINMENUS 13 #define INCL_WINBUTTONS 14 #define INCL_WINPOINTERS 13 15 #define INCL_WINSTDFILE 14 16 … … 24 26 25 27 #include "helpers\call_file_dlg.c" 28 #include "helpers\comctl.h" 29 #include "helpers\standards.h" 26 30 #include "helpers\winh.h" 31 #include "helpers\gpih.h" 32 33 PCSZ WC_CLIENT = "MyClient"; 27 34 28 35 /* … … 83 90 84 91 /* 92 *@@ fnwpClient: 93 * 94 */ 95 96 MRESULT EXPENTRY fnwpClient(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2) 97 { 98 MRESULT mrc = 0; 99 100 switch (msg) 101 { 102 case WM_PAINT: 103 { 104 HPS hps; 105 RECTL rcl; 106 if (hps = WinBeginPaint(hwnd, NULLHANDLE, &rcl)) 107 { 108 gpihSwitchToRGB(hps); 109 WinFillRect(hps, &rcl, RGBCOL_GRAY); 110 WinEndPaint(hps); 111 } 112 } 113 break; 114 115 default: 116 mrc = WinDefWindowProc(hwnd, msg, mp1, mp2); 117 } 118 119 return mrc; 120 } 121 122 /* 85 123 *@@ main: 86 124 * … … 92 130 HMQ hmq; 93 131 94 ULONG flFrame = FCF_TITLEBAR 95 | FCF_SYSMENU 96 | FCF_MINMAX 97 | FCF_SIZEBORDER 98 | FCF_NOBYTEALIGN 99 | FCF_SHELLPOSITION 100 | FCF_TASKLIST; 132 #define TBBS_COMMON TBBS_AUTORESIZE | TBBS_FLAT | TBBS_HILITE | WS_VISIBLE 133 134 CHAR szOpen[200], 135 szExit[200]; 136 137 TOOLBARCONTROL aControls[] = 138 { 139 WC_CCTL_TBBUTTON, 140 szExit, 141 TBBS_COMMON | TBBS_BIGICON | TBBS_TEXT | TBBS_SYSCOMMAND, 142 SC_CLOSE, 143 10, 144 10, 145 146 WC_CCTL_TBBUTTON, 147 szExit, 148 TBBS_COMMON | TBBS_BIGICON /* TBBS_TEXT | */ , 149 0, 150 10, 151 10, 152 153 WC_CCTL_TBBUTTON, 154 szExit, 155 TBBS_COMMON | TBBS_MINIICON /* TBBS_TEXT | */ , 156 0, 157 10, 158 10, 159 160 WC_CCTL_TBBUTTON, 161 szOpen, 162 TBBS_COMMON | TBBS_MINIICON | TBBS_TEXT, 163 1000, 164 10, 165 10, 166 167 WC_CCTL_TBBUTTON, 168 "Toggle\ntest", 169 TBBS_COMMON | TBBS_TEXT | TBBS_CHECK, 170 1001, 171 10, 172 10, 173 174 WC_CCTL_SEPARATOR, 175 NULL, 176 WS_VISIBLE | SEPS_VERTICAL, 177 1002, 178 10, 179 10, 180 181 WC_CCTL_TBBUTTON, 182 "Group 1", 183 TBBS_COMMON | TBBS_TEXT | TBBS_CHECKGROUP | TBBS_CHECKINITIAL, 184 1101, 185 10, 186 10, 187 188 WC_CCTL_TBBUTTON, 189 "Group 2", 190 TBBS_COMMON | TBBS_TEXT | TBBS_CHECKGROUP, 191 1102, 192 10, 193 10, 194 195 WC_CCTL_TBBUTTON, 196 "Group 3", 197 TBBS_COMMON | TBBS_TEXT | TBBS_CHECKGROUP, 198 1103, 199 10, 200 10, 201 202 }; 203 204 EXTFRAMECDATA xfd = 205 { 206 NULL, // pswpFrame 207 FCF_TITLEBAR 208 | FCF_SYSMENU 209 | FCF_MINMAX 210 | FCF_SIZEBORDER 211 | FCF_NOBYTEALIGN 212 | FCF_SHELLPOSITION 213 | FCF_TASKLIST, 214 XFCF_TOOLBAR | XFCF_FORCETBOWNER | XFCF_STATUSBAR, 215 WS_VISIBLE, // ulFrameStyle 216 "Test File Dialog", // pcszFrameTitle 217 0, // ulResourcesID 218 WC_CLIENT, // pcszClassClient 219 WS_VISIBLE, // flStyleClient 220 0, // ulID 221 NULL, 222 HINI_USER, 223 "XWorkplace Test Apps", 224 "CallFileDlgPos", 225 226 ARRAYITEMCOUNT(aControls), 227 aControls 228 }; 101 229 102 230 HWND hwndFrame, 103 231 hwndClient, 232 hwndStatusBar, 233 hwndToolBar, 104 234 hwndMenu, 105 235 hwndSubmenu; … … 109 239 hmq = WinCreateMsgQueue(hab, 0); 110 240 111 hwndFrame = WinCreateStdWindow(HWND_DESKTOP, 112 WS_VISIBLE, 113 &flFrame, 114 NULL, 115 "Test File Dialog", 116 WS_VISIBLE, 117 0, 118 0, 119 &hwndClient); 241 winhInitGlobals(); 242 243 ctlRegisterToolbar(hab); 244 ctlRegisterSeparatorLine(hab); 245 246 WinRegisterClass(hab, 247 (PSZ)WC_CLIENT, 248 fnwpClient, 249 0, 250 4); 251 252 sprintf(szOpen, 253 "#%d#Open", 254 WinQuerySysPointer(HWND_DESKTOP, 255 SPTR_ICONINFORMATION, 256 FALSE)); 257 258 sprintf(szExit, 259 "#%d#Exit", 260 WinQuerySysPointer(HWND_DESKTOP, 261 SPTR_ICONWARNING, 262 FALSE)); 263 264 hwndFrame = ctlCreateStdWindow(&xfd, &hwndClient); 265 266 hwndToolBar = WinWindowFromID(hwndFrame, FID_TOOLBAR); 267 hwndStatusBar = WinWindowFromID(hwndFrame, FID_STATUSBAR); 268 269 WinSetWindowText(hwndToolBar, "Tool bar"); 270 WinSetWindowText(hwndStatusBar, "Status bar"); 120 271 121 272 hwndMenu = WinCreateMenu(hwndFrame, … … 128 279 MIS_TEXT | MIS_SUBMENU, 129 280 1000, 130 " ~Show dialog",281 "Open...", 131 282 MIS_TEXT, 132 283 0); … … 135 286 MIT_END, 136 287 SC_CLOSE, 137 "~ Close",288 "~Quit", 138 289 MIS_SYSCOMMAND | MIS_TEXT, 139 290 0); -
trunk/src/helpers/_test_dialog.c
r222 r232 30 30 #include "setup.h" // code generation and debugging options 31 31 32 #include " R:\projects\R_cvs\xworkplace\include\dlgids.h"32 #include "K:\projects\cvs\xworkplace\include\dlgids.h" 33 33 34 34 #include "helpers\comctl.h" -
trunk/src/helpers/animate.c
r184 r232 58 58 #include "setup.h" // code generation and debugging options 59 59 60 // #include "helpers\animate.h" 61 62 // #include "helpers\winh.h" 63 // #include "helpers\gpih.h" 60 #include "helpers\winh.h" 64 61 65 62 /* … … 108 105 BITMAPINFOHEADER bih; 109 106 GpiQueryBitmapParameters(hbm, &bih); 110 /* ptl.y = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) 111 - BMPSPACING 112 - bih.cy; */ 113 ptl.x = (WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN) 114 - bih.cx) / 2; 115 ptl.y = (WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN) 116 - bih.cy) / 2; 107 ptl.x = (G_cxScreen - bih.cx) / 2; 108 ptl.y = (G_cyScreen - bih.cy) / 2; 117 109 118 110 // we now use ul for the current animation step, -
trunk/src/helpers/cctl_chart.c
r222 r232 1496 1496 LONG lIndex) 1497 1497 { 1498 HWND hwndOwner; 1499 1500 if (hwndOwner = WinQueryWindow(hwndChart, QW_OWNER)) 1501 { 1502 EMPHASISNOTIFY en; 1503 en.hwndSource = hwndChart; 1504 en.lIndex = lIndex; // can be -1 1505 en.ulEmphasis = ulEmphasis; 1506 en.ptl.x = SHORT1FROMMP(mp1Mouse); 1507 en.ptl.y = SHORT2FROMMP(mp1Mouse); 1508 1509 WinSendMsg(hwndOwner, 1510 WM_CONTROL, 1511 MPFROM2SHORT(WinQueryWindowUShort(hwndChart, 1512 QWS_ID), 1513 usNotify), 1514 &en); 1515 } 1498 EMPHASISNOTIFY en; 1499 en.hwndSource = hwndChart; 1500 en.lIndex = lIndex; // can be -1 1501 en.ulEmphasis = ulEmphasis; 1502 en.ptl.x = SHORT1FROMMP(mp1Mouse); 1503 en.ptl.y = SHORT2FROMMP(mp1Mouse); 1504 1505 ctlSendWmControl(hwndChart, 1506 usNotify, 1507 &en); 1516 1508 } 1517 1509 -
trunk/src/helpers/cctl_combo.c
r222 r232 408 408 // our own owner, but replace the id 409 409 // with the combo box id 410 WinPostMsg(WinQueryWindow(hwnd, QW_OWNER), 411 WM_CONTROL, 412 MPFROM2SHORT(WinQueryWindowUShort(hwnd, QWS_ID), 413 uscode), 414 mp2); 410 ctlPostWmControl(hwnd, 411 uscode, 412 mp2); 415 413 416 414 // do not call parent -
trunk/src/helpers/cctl_tooltip.c
r229 r232 112 112 { 113 113 return WinRegisterClass(hab, 114 COMCTL_TOOLTIP_CLASS,114 WC_CCTL_TOOLTIP, 115 115 ctl_fnwpTooltip, 116 116 CS_HITTEST, // class styles; … … 295 295 if (!FindSubclassedTool(hwndTool)) 296 296 { 297 PFNWP pfnwpOrig = WinSubclassWindow(hwndTool,298 ctl_fnwpSubclassedTool);299 if (pfnwpOrig)297 PFNWP pfnwpOrig; 298 if (pfnwpOrig = WinSubclassWindow(hwndTool, 299 ctl_fnwpSubclassedTool)) 300 300 { 301 PSUBCLASSEDTOOL pst = (PSUBCLASSEDTOOL)malloc(sizeof(SUBCLASSEDTOOL));302 if (pst )301 PSUBCLASSEDTOOL pst; 302 if (pst = (PSUBCLASSEDTOOL)malloc(sizeof(SUBCLASSEDTOOL))) 303 303 { 304 304 pst->pfnwpOrig = pfnwpOrig; … … 361 361 HAB hab; // from WM_CREATE 362 362 USHORT usTooltipID; // from WM_CREATE 363 364 LONG cxScreen,365 cyScreen;366 363 367 364 BOOL fIsActive; // TRUE per default; changed by TTM_ACTIVATE … … 457 454 pttd->usTooltipID = pcs->id; 458 455 459 pttd->cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN);460 pttd->cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN);461 462 456 pttd->fIsActive = TRUE; 463 457 … … 1133 1127 if (ptlTooltip.y < 0) 1134 1128 ptlTooltip.y = 0; 1135 if (ptlTooltip.x + cx > pttd->cxScreen)1136 ptlTooltip.x = pttd->cxScreen-cx;1137 if (ptlTooltip.y + cy > pttd->cyScreen)1138 ptlTooltip.y = pttd->cyScreen-cy;1129 if (ptlTooltip.x + cx > G_cxScreen) 1130 ptlTooltip.x = G_cxScreen - cx; 1131 if (ptlTooltip.y + cy > G_cyScreen) 1132 ptlTooltip.y = G_cyScreen - cy; 1139 1133 1140 1134 // if shadow is enabled, … … 1350 1344 + ctlRegisterTooltip(hab); 1351 1345 + hwndTooltip = WinCreateWindow(HWND_DESKTOP, // parent 1352 + COMCTL_TOOLTIP_CLASS, // wnd class (comctl.h)1346 + WC_CCTL_TOOLTIP, // wnd class (comctl.h) 1353 1347 + NULL, // window text 1354 1348 + TTS_ALWAYSTIP, // window style, ignored except for TTS_* flags -
trunk/src/helpers/cnrh.c
r229 r232 2142 2142 ( poi->rclItem.xLeft 2143 2143 + (poi->rclItem.xRight - poi->rclItem.xLeft 2144 - WinQuerySysValue(HWND_DESKTOP, SV_CXICON)/ 22144 - G_cxIcon / 2 2145 2145 ) / 2 2146 2146 ), 2147 2147 ( poi->rclItem.yBottom 2148 2148 + (poi->rclItem.yTop - poi->rclItem.yBottom 2149 - WinQuerySysValue(HWND_DESKTOP, SV_CYICON)/ 22149 - G_cyIcon / 2 2150 2150 ) / 2 2151 2151 ), -
trunk/src/helpers/comctl.c
r229 r232 90 90 #define INCL_WINSTDCNR 91 91 #define INCL_WINENTRYFIELDS 92 #define INCL_WINSHELLDATA 92 93 93 94 #define INCL_GPIPRIMITIVES … … 112 113 #include "helpers\linklist.h" 113 114 #include "helpers\winh.h" 115 #include "helpers\standards.h" 114 116 115 117 #include "helpers\comctl.h" 116 118 117 119 #pragma hdrstop 120 121 /* ****************************************************************** 122 * 123 * Shared stuff 124 * 125 ********************************************************************/ 126 127 /* 128 *@@ ctlSendWmControl: 129 * little helper that post a WM_CONTROL message to 130 * a control's owner. 131 * 132 *@@added V1.0.1 (2002-11-30) [umoeller] 133 */ 134 135 MRESULT ctlSendWmControl(HWND hwndControl, // in: control who's posting 136 USHORT usCode, // in: code for SHORT2FROMMP(mp1) 137 MPARAM mp2) // in: mp2 from WM_CONTROL 138 { 139 HWND hwndOwner; 140 141 if (hwndOwner = WinQueryWindow(hwndControl, QW_OWNER)) 142 return WinSendMsg(hwndOwner, 143 WM_CONTROL, 144 MPFROM2SHORT(WinQueryWindowUShort(hwndControl, QWS_ID), 145 usCode), 146 mp2); 147 148 return NULL; 149 } 150 151 /* 152 *@@ ctlPostWmControl: 153 * little helper that post a WM_CONTROL message to 154 * a control's owner. 155 * 156 *@@added V1.0.1 (2002-11-30) [umoeller] 157 */ 158 159 BOOL ctlPostWmControl(HWND hwndControl, // in: control who's posting 160 USHORT usCode, // in: code for SHORT2FROMMP(mp1) 161 MPARAM mp2) // in: mp2 from WM_CONTROL 162 { 163 HWND hwndOwner; 164 165 if (hwndOwner = WinQueryWindow(hwndControl, QW_OWNER)) 166 return WinPostMsg(hwndOwner, 167 WM_CONTROL, 168 MPFROM2SHORT(WinQueryWindowUShort(hwndControl, QWS_ID), 169 usCode), 170 mp2); 171 172 return FALSE; 173 } 174 175 /* 176 *@@ ctlInitDWD: 177 * ininitializes the DEFWINDATA struct for the 178 * given window. This must be called in WM_CREATE 179 * of a window proc if it intends to use 180 * ctlDefWindowProc as its default window procedure. 181 * 182 *@@added V1.0.1 (2002-11-30) [umoeller] 183 */ 184 185 VOID ctlInitDWD(HWND hwnd, 186 MPARAM mp2, 187 PDEFWINDATA pdwd, 188 PFNWP pDefWindowProc, 189 const SYSCOLORSET *pSysColorSet) 190 { 191 pdwd->hwnd = hwnd; 192 pdwd->szlWin.cx = ((PCREATESTRUCT)mp2)->cx; 193 pdwd->szlWin.cy = ((PCREATESTRUCT)mp2)->cy; 194 pdwd->hab = WinQueryAnchorBlock(hwnd); 195 pdwd->pDefWindowProc = pDefWindowProc; 196 pdwd->pSysColorSet = pSysColorSet; 197 198 ctlRefreshColors(pdwd); 199 } 200 201 /* 202 *@@ ctlRefreshColors: 203 * 204 *@@added V1.0.1 (2002-11-30) [umoeller] 205 */ 206 207 VOID ctlRefreshColors(PDEFWINDATA pdwd) 208 { 209 pdwd->lcolBackground = winhQueryPresColor2(pdwd->hwnd, 210 PP_BACKGROUNDCOLOR, 211 PP_BACKGROUNDCOLORINDEX, 212 pdwd->pSysColorSet->fInheritPP, 213 pdwd->pSysColorSet->lBackIndex); 214 pdwd->lcolForeground = winhQueryPresColor2(pdwd->hwnd, 215 PP_FOREGROUNDCOLOR, 216 PP_FOREGROUNDCOLORINDEX, 217 pdwd->pSysColorSet->fInheritPP, 218 pdwd->pSysColorSet->lForeIndex); 219 } 220 221 /* 222 *@@ ctlDefWindowProc: 223 * replacement default window procedure for controls that 224 * have a custom window class and do not inherit from 225 * standard OS/2 controls. 226 * 227 * If a window proc wishes to use this, it must allocate 228 * its own private window data in WM_CREATE (preferrably in 229 * QWL_USER + 1) and have room for a DEFWINDATA struct in 230 * there. It must call ctlInitDWD in WM_CREATE also which 231 * initializes that structure. It can then safely pass 232 * messages to this function. 233 * 234 *@@added V1.0.1 (2002-11-30) [umoeller] 235 */ 236 237 MRESULT ctlDefWindowProc(PDEFWINDATA pdwd, ULONG msg, MPARAM mp1, MPARAM mp2) 238 { 239 MRESULT mrc = 0; 240 241 switch (msg) 242 { 243 case WM_SYSCOLORCHANGE: 244 case WM_PRESPARAMCHANGED: 245 ctlRefreshColors(pdwd); 246 break; 247 248 default: 249 mrc = pdwd->pDefWindowProc(pdwd->hwnd, msg, mp1, mp2); 250 } 251 252 return mrc; 253 } 118 254 119 255 /* ****************************************************************** … … 131 267 * 132 268 *@@added V0.9.20 (2002-08-10) [umoeller] 269 *@@changed V1.0.1 (2002-11-30) [umoeller]: added SEPS_VERTICAL 133 270 */ 134 271 … … 150 287 gpihSwitchToRGB(hps); 151 288 152 GpiSetColor(hps, WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0)); 153 154 ptl.x = rcl.xLeft; 155 ptl.y = (rcl.yTop - rcl.yBottom) / 2 - 1; 156 GpiMove(hps, &ptl); 157 ptl.x = rcl.xRight; 158 GpiLine(hps, &ptl); 159 160 GpiSetColor(hps, WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONDARK, 0)); 161 162 ptl.x = rcl.xLeft; 163 ++ptl.y; 164 GpiMove(hps, &ptl); 165 ptl.x = rcl.xRight; 166 GpiLine(hps, &ptl); 289 WinFillRect(hps, 290 &rcl, 291 winhQueryPresColor2(hwnd, 292 PP_BACKGROUNDCOLOR, 293 PP_BACKGROUNDCOLORINDEX, 294 TRUE, 295 SYSCLR_WINDOW)); 296 297 if (WinQueryWindowULong(hwnd, QWL_STYLE) & SEPS_VERTICAL) 298 { 299 GpiSetColor(hps, G_lcol3DDark); 300 301 ptl.x = (rcl.xRight - rcl.xLeft) / 2 - 1; 302 ptl.y = rcl.yBottom; 303 GpiMove(hps, &ptl); 304 ptl.y = rcl.yTop; 305 GpiLine(hps, &ptl); 306 307 GpiSetColor(hps, G_lcol3DLight); 308 309 ptl.y = rcl.yBottom; 310 ++ptl.x; 311 GpiMove(hps, &ptl); 312 ptl.y = rcl.yTop; 313 GpiLine(hps, &ptl); 314 } 315 else 316 { 317 GpiSetColor(hps, G_lcol3DLight); 318 319 ptl.x = rcl.xLeft; 320 ptl.y = (rcl.yTop - rcl.yBottom) / 2 - 1; 321 GpiMove(hps, &ptl); 322 ptl.x = rcl.xRight; 323 GpiLine(hps, &ptl); 324 325 GpiSetColor(hps, G_lcol3DDark); 326 327 ptl.x = rcl.xLeft; 328 ++ptl.y; 329 GpiMove(hps, &ptl); 330 ptl.x = rcl.xRight; 331 GpiLine(hps, &ptl); 332 } 167 333 168 334 WinEndPaint(hps); … … 179 345 180 346 /* 181 *@@ ctlMakeSeparatorLine: 182 * turns the given static control into a 3D separator line. 347 *@@ ctlRegisterSeparatorLine: 348 * registers the separator line control, which is a dull 349 * static displaying a 3D line for use as a separator 350 * in dialogs. 351 * 352 * In addition to the standard WS_* styles, the control 353 * supports the SEPS_VERTICAL style bit. If set, the 354 * separator is vertical; if not, it is horizontal. 183 355 * 184 356 *@@added V1.0.0 (2002-08-12) [umoeller] … … 195 367 196 368 return WinRegisterClass(hab, 197 WC_ SEPARATORLINE,369 WC_CCTL_SEPARATOR, 198 370 fnwpSeparatorLine, 199 371 (ciStatic.flClassStyle & ~CS_PUBLIC), … … 203 375 204 376 return FALSE; 205 }206 207 /* ******************************************************************208 *209 * "XButton" control210 *211 ********************************************************************/212 213 /*214 *@@ ctlPaintXButton:215 * paints an X-button control. Can be called externally216 * for just painting a button even if this is not really217 * a window.218 *219 * WARNING: this is work in progress and will change into220 * the future. Eventually this will turn into a full221 * button control replacement.222 *223 *@@added V0.9.13 (2001-06-21) [umoeller]224 *@@changed V0.9.16 (2001-10-24) [umoeller]: fixed wrong hatch color and paint offset225 *@@changed V0.9.16 (2001-10-28) [umoeller]: added bitmap support, fixed bad clip rectangle226 *@@changed V0.9.20 (2002-08-04) [umoeller]: fixed button offset, depressed color227 */228 229 VOID ctlPaintXButton(HPS hps, // in: presentation space (RGB mode)230 ULONG fl, // in: XBF_* flags231 PXBUTTONDATA pxbd) // in: button data232 {233 ULONG ulBorder = 0,234 cx,235 cy,236 ulOfs = 0;237 LONG lLeft,238 lRight,239 lColorMiddle = pxbd->lMiddle;240 RECTL rclWin;241 242 memcpy(&rclWin, &pxbd->rcl, sizeof(RECTL));243 244 if (0 == (fl & XBF_FLAT))245 ulBorder = 2;246 247 gpihSwitchToRGB(hps);248 249 if (fl & XBF_PRESSED)250 {251 // paint button "down":252 lLeft = pxbd->lcol3DDark;253 lRight = pxbd->lcol3DLight;254 // add offset for icon painting at the bottom255 ulOfs += 1;256 if (ulBorder == 0)257 ulBorder = 1;258 259 // make the depressed color darker260 // V0.9.20 (2002-07-31) [umoeller]261 gpihManipulateRGB(&lColorMiddle,262 .95);263 }264 else265 {266 lLeft = pxbd->lcol3DLight;267 lRight = pxbd->lcol3DDark;268 }269 270 if (ulBorder)271 {272 // button border:273 // now paint button frame274 275 // make rcl inclusive276 rclWin.xRight--;277 rclWin.yTop--;278 gpihDraw3DFrame(hps,279 &rclWin, // inclusive280 ulBorder,281 lLeft,282 lRight);283 284 // now paint button middle285 rclWin.xLeft += ulBorder;286 rclWin.yBottom += ulBorder;287 rclWin.xRight -= ulBorder - 1; // make exclusive again288 rclWin.yTop -= ulBorder - 1; // make exclusive again289 }290 291 if (fl & XBF_BACKGROUND)292 WinFillRect(hps,293 &rclWin, // exclusive294 lColorMiddle);295 296 // get icon297 if (pxbd->hptr)298 {299 // calculate x and y to be centered in rectangle300 POINTL ptl;301 302 cx = rclWin.xRight - rclWin.xLeft;303 cy = rclWin.yTop - rclWin.yBottom;304 305 ptl.x = rclWin.xLeft + ((cx - pxbd->cxIconOrBitmap) / 2);306 ptl.y = rclWin.yBottom + ((cy - pxbd->cyIconOrBitmap) / 2);307 308 if (fl & XBF_INUSE)309 {310 // caller wants in-use (hatched) emphasis:311 // draw a box then312 POINTL ptl2;313 ptl2.x = ptl.x - 2;314 ptl2.y = ptl.y - 2;315 GpiMove(hps,316 &ptl2); // &ptl317 // duh, typo V0.9.16 (2001-10-24) [umoeller]318 GpiSetPattern(hps, PATSYM_DIAG1);319 GpiSetColor(hps, RGBCOL_BLACK); // V0.9.16 (2001-10-24) [umoeller]320 ptl2.x = ptl.x + pxbd->cxIconOrBitmap + 1; // inclusive!321 ptl2.y = ptl.y + pxbd->cyIconOrBitmap + 1; // inclusive!322 GpiBox(hps,323 DRO_FILL,324 &ptl2,325 0,326 0);327 }328 329 // now paint icon330 331 // make rcl inclusive // V0.9.16 (2001-10-28) [umoeller]332 rclWin.xRight--;333 rclWin.yTop--;334 GpiIntersectClipRectangle(hps,335 &rclWin); // inclusive!336 337 // center this in remaining rectl338 ptl.x += ulOfs;339 ptl.y -= ulOfs;340 if (fl & XBF_BITMAP)341 // V0.9.16 (2001-10-28) [umoeller]342 WinDrawBitmap(hps,343 pxbd->hptr, // a bitmap really344 NULL, // entire bitmap345 &ptl,346 0,347 0,348 DBM_NORMAL);349 else350 WinDrawPointer(hps,351 // center this in remaining rectl352 ptl.x, // + ulOfs,353 ptl.y, // - ulOfs,354 pxbd->hptr,355 DP_MINI);356 }357 377 } 358 378 … … 1097 1117 WinQueryWindowRect(hwndStatic, &pa->rclIcon); 1098 1118 pa->OldStaticProc = WinSubclassWindow(hwndStatic, ctl_fnwpBitmapStatic); 1099 pa->szlIcon.cx = WinQuerySysValue(HWND_DESKTOP, SV_CXICON);1100 pa->szlIcon.cy = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);1119 pa->szlIcon.cx = G_cxIcon; 1120 pa->szlIcon.cy = G_cyIcon; 1101 1121 } 1102 1122 } … … 1628 1648 // doesn't send any notifications, we 1629 1649 // use EN_CHANGED 1630 WinSendMsg(WinQueryWindow(hwndStatic, QW_OWNER), 1631 WM_CONTROL, 1632 MPFROM2SHORT(WinQueryWindowUShort(hwndStatic, QWS_ID), 1633 EN_CHANGE), 1634 (MPARAM)hwndStatic); 1650 ctlSendWmControl(hwndStatic, 1651 EN_CHANGE, 1652 (MPARAM)hwndStatic); 1635 1653 break; 1636 1654 } -
trunk/src/helpers/dialog.c
r229 r232 1001 1001 rcl.yTop = pColumn->szlProposed.cy; 1002 1002 else 1003 rcl.yTop = winhQueryScreenCY()* 2 / 3;1003 rcl.yTop = G_cyScreen * 2 / 3; 1004 1004 1005 1005 winhDrawFormattedText(pDlgData->hps, … … 1185 1185 1186 1186 case SS_ICON: 1187 pColumn->szlAuto.cx = WinQuerySysValue(HWND_DESKTOP, SV_CXICON);1188 pColumn->szlAuto.cy = WinQuerySysValue(HWND_DESKTOP, SV_CYICON);1187 pColumn->szlAuto.cx = G_cxIcon; 1188 pColumn->szlAuto.cy = G_cyIcon; 1189 1189 break; 1190 1190 } -
trunk/src/helpers/except.c
r229 r232 788 788 * writes no trap logs). 789 789 * 790 * Registering hooks affects all threads that use 791 * the exception handlers. 792 * 790 793 * The hooks are as follows: 791 794 * -
trunk/src/helpers/gpih.c
r229 r232 134 134 { 135 135 if (prcl) 136 {137 136 return ( (x >= prcl->xLeft) 138 137 && (x <= prcl->xRight) … … 140 139 && (y <= prcl->yTop) 141 140 ); 142 }143 141 144 142 return FALSE; … … 163 161 prcl->yTop += l; 164 162 } 163 } 164 165 /* 166 *@@ gpihCopyRectIncl: 167 * copies prclWin to prclGpi, making it 168 * inclusive-inclusive for use with GPI 169 * functions. 170 * 171 *@@added V1.0.1 (2002-11-30) [umoeller] 172 */ 173 174 VOID gpihCopyRectIncl(PRECTL prclGpi, // out: GPI rectangle 175 PRECTL prclWin) // in: WIN rectangle 176 { 177 prclGpi->xLeft = prclWin->xLeft; 178 prclGpi->yBottom = prclWin->yBottom; 179 prclGpi->xRight = prclWin->xRight - 1; 180 prclGpi->yTop = prclWin->yTop - 1; 165 181 } 166 182 … … 1687 1703 } 1688 1704 1705 static const BITMAPINFOHEADER2 G_bih2Template[] = 1706 { 1707 sizeof(BITMAPINFOHEADER2), // ULONG cbFix; 1708 0, // ULONG cx; // tbr 1709 0, // ULONG cy; // tbr 1710 0, // USHORT cPlanes; // tbr 1711 0, // USHORT cBitCount; // tbr 1712 BCA_UNCOMP, // ULONG ulCompression; 1713 0, // ULONG cbImage; 1714 70, // ULONG cxResolution; 1715 70, // ULONG cyResolution; 1716 2, // ULONG cclrUsed; 1717 0, // ULONG cclrImportant; 1718 BRU_METRIC, // USHORT usUnits; 1719 // measure units for cxResolution/cyResolution: pels per meter 1720 0, // USHORT usReserved; 1721 BRA_BOTTOMUP, // USHORT usRecording; 1722 // scan lines are bottom to top (default) 1723 1724 BRH_NOTHALFTONED, // USHORT usRendering; 1725 // other algorithms aren't documented anyway 1726 0, // ULONG cSize1; 1727 // parameter for halftoning (undocumented anyway) 1728 0, // ULONG cSize2; 1729 // parameter for halftoning (undocumented anyway) 1730 BCE_RGB, // ULONG ulColorEncoding; 1731 // only possible value 1732 0 // ULONG ulIdentifier; 1733 // application-specific data 1734 }; 1735 1689 1736 /* 1690 1737 *@@ gpihCreateBitmap2: … … 1703 1750 * 1704 1751 *@@added V0.9.16 (2001-12-18) [umoeller] 1752 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized 1705 1753 */ 1706 1754 … … 1711 1759 ULONG cBitCount) // in: either 1, 4, or 24; if 0, current screen value 1712 1760 { 1713 HBITMAP hbm = NULLHANDLE;1714 1761 LONG alData[2]; 1715 1762 BITMAPINFOHEADER2 bih2; 1716 // PBITMAPINFO2 pbmi = NULL;1717 1763 1718 1764 // determine the device's plane/bit-count format; … … 1721 1767 if (GpiQueryDeviceBitmapFormats(hpsMem, 2, alData)) 1722 1768 { 1723 // set up the BITMAPINFOHEADER2 and BITMAPINFO2 structures 1724 bih2.cbFix = (ULONG)sizeof(BITMAPINFOHEADER2); 1769 // copy values from global template V1.0.1 (2002-11-30) [umoeller] 1770 memcpy(&bih2, &G_bih2Template, sizeof(bih2)); 1771 1772 // fix variable fields V1.0.1 (2002-11-30) [umoeller] 1725 1773 bih2.cx = cx; 1726 1774 bih2.cy = cy; 1727 1775 bih2.cPlanes = (cPlanes) ? cPlanes : alData[0]; 1728 1776 bih2.cBitCount = (cBitCount) ? cBitCount : alData[1]; 1729 bih2.ulCompression = BCA_UNCOMP;1730 1777 bih2.cbImage = ( ( (bih2.cx 1731 1778 * (1 << bih2.cPlanes) … … 1734 1781 ) / 32 1735 1782 ) * bih2.cy; 1736 bih2.cxResolution = 70;1737 bih2.cyResolution = 70;1738 bih2.cclrUsed = 2;1739 bih2.cclrImportant = 0;1740 bih2.usUnits = BRU_METRIC; // measure units for cxResolution/cyResolution: pels per meter1741 bih2.usReserved = 0;1742 bih2.usRecording = BRA_BOTTOMUP; // scan lines are bottom to top (default)1743 bih2.usRendering = BRH_NOTHALFTONED; // other algorithms aren't documented anyway1744 bih2.cSize1 = 0; // parameter for halftoning (undocumented anyway)1745 bih2.cSize2 = 0; // parameter for halftoning (undocumented anyway)1746 bih2.ulColorEncoding = BCE_RGB; // only possible value1747 bih2.ulIdentifier = 0; // application-specific data1748 1783 1749 1784 // create a bit map that is compatible with the display 1750 hbm =GpiCreateBitmap(hpsMem,1751 &bih2,1752 0, // do not initialize1753 NULL, // init data1754 NULL);1785 return GpiCreateBitmap(hpsMem, 1786 &bih2, 1787 0, // do not initialize 1788 NULL, // init data 1789 NULL); 1755 1790 } 1756 1791 1757 return hbm; 1792 return NULLHANDLE; 1793 } 1794 1795 /* 1796 *@@ gpihQueryBitmapSize: 1797 * returns the width and height of the given bitmap. 1798 * 1799 *@@added V1.0.1 (2002-11-30) [umoeller] 1800 */ 1801 1802 BOOL gpihQueryBitmapSize(HBITMAP hbm, // in: bitmap handle for query 1803 PSIZEL pszl) // out: size (cx, cy) of bitmap 1804 { 1805 BITMAPINFOHEADER2 bmi2; 1806 // query bitmap info 1807 bmi2.cbFix = sizeof(bmi2); 1808 if ( (hbm) 1809 && (GpiQueryBitmapInfoHeader(hbm, &bmi2)) 1810 ) 1811 { 1812 pszl->cx = bmi2.cx; 1813 pszl->cy = bmi2.cy; 1814 return TRUE; 1815 } 1816 1817 return FALSE; 1758 1818 } 1759 1819 … … 1776 1836 * 1777 1837 *@added V0.9.0 1838 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized 1778 1839 */ 1779 1840 … … 1786 1847 HDC hdcMem; 1787 1848 HPS hpsMem; 1788 BITMAPINFOHEADER2 bmi;1789 1790 if ( hbmSource)1849 SIZEL szlPage; 1850 1851 if (gpihQueryBitmapSize(hbmSource, &szlPage)) // V1.0.1 (2002-11-30) [umoeller] 1791 1852 { 1792 SIZEL szlPage;1793 // query bitmap info1794 bmi.cbFix = sizeof(bmi);1795 GpiQueryBitmapInfoHeader(hbmSource, &bmi);1796 1797 szlPage.cx = bmi.cx;1798 szlPage.cy = bmi.cy;1799 1853 if (gpihCreateMemPS(hab, &szlPage, &hdcMem, &hpsMem)) 1800 1854 { 1801 1855 if ((hbmReturn = gpihCreateBitmap(hpsMem, 1802 bmi.cx,1803 bmi.cy)))1856 szlPage.cx, 1857 szlPage.cy))) 1804 1858 { 1805 1859 if (GpiSetBitmap(hpsMem, hbmReturn) != HBM_ERROR) … … 1811 1865 // aptl[0]: target bottom-left, is all 0 1812 1866 // aptl[1]: target top-right (inclusive!) 1813 aptl[1].x = bmi.cx - 1;1814 aptl[1].y = bmi.cy - 1;1867 aptl[1].x = szlPage.cx - 1; 1868 aptl[1].y = szlPage.cy - 1; 1815 1869 // aptl[2]: source bottom-left, is all 0 1816 1870 1817 1871 // aptl[3]: source top-right (exclusive!) 1818 aptl[3].x = bmi.cx;1819 aptl[3].y = bmi.cy;1872 aptl[3].x = szlPage.cx; 1873 aptl[3].y = szlPage.cy; 1820 1874 GpiWCBitBlt(hpsMem, // target HPS (bmp selected) 1821 1875 hbmSource, … … 1832 1886 1833 1887 GpiMove(hpsMem, &aptl[0]); // still 0, 0 1834 aptl[0].x = bmi.cx - 1;1835 aptl[0].y = bmi.cy - 1;1888 aptl[0].x = szlPage.cx - 1; 1889 aptl[0].y = szlPage.cy - 1; 1836 1890 GpiSetColor(hpsMem, lColorGray); 1837 1891 GpiSetPattern(hpsMem, PATSYM_HALFTONE); … … 2326 2380 * 2327 2381 *@added V0.9.0 2382 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized 2328 2383 */ 2329 2384 … … 2334 2389 BOOL fProportional) // in: preserve proportions when stretching? 2335 2390 { 2336 BITMAPINFOHEADER2 bih2;2391 SIZEL szlBmp; 2337 2392 POINTL aptl[4]; 2338 2393 BOOL fCalculated = FALSE; 2339 2394 2395 if (!gpihQueryBitmapSize(hbmSource, &szlBmp)) // V1.0.1 (2002-11-30) [umoeller] 2396 return GPI_ERROR; 2397 2340 2398 memset(aptl, 0, sizeof(POINTL) * 4); 2341 2342 bih2.cbFix = sizeof(bih2);2343 GpiQueryBitmapInfoHeader(hbmSource,2344 &bih2);2345 2399 2346 2400 // aptl[2]: source bottom-left, is all 0 2347 2401 // aptl[3]: source top-right (exclusive!) 2348 aptl[3].x = bih2.cx;2349 aptl[3].y = bih2.cy;2402 aptl[3].x = szlBmp.cx; 2403 aptl[3].y = szlBmp.cy; 2350 2404 2351 2405 if (fProportional) … … 2356 2410 // large 2357 2411 2358 ULONG ulPropSource = ( bih2.cx * 1000)2359 / bih2.cy;2412 ULONG ulPropSource = (szlBmp.cx * 1000) 2413 / szlBmp.cy; 2360 2414 // e.g. if the bmp is 200 x 100, we now have 2000 2361 2415 ULONG ulPropTarget = ((prclTarget->xRight - prclTarget->xLeft) * 1000) … … 2430 2484 2431 2485 /* 2432 * gpihIcon2Bitmap:2433 * this paints the given icon/pointer into2434 * a bitmap. Note that if the bitmap is2435 * larget than the system icon size, only2436 * the rectangle of the icon will be filled2437 * with lBkgndColor.2438 *2439 * Returns FALSE upon errors.2440 *2441 *added V0.9.0 [umoeller]2442 *changed V0.9.16 (2001-10-15) [umoeller]: added pptlLowerLeft2443 *changed V0.9.16 (2001-10-15) [umoeller]: fixed inclusive/exclusive confusion (sigh...)2444 *changed V0.9.19 (2002-06-13) [umoeller]: fixed funny colors when scaling2445 *removed V0.9.19 (2002-06-18) [umoeller]2446 */2447 2448 #if 02449 2450 BOOL gpihIcon2Bitmap(HPS hpsMem, // in: target memory PS with bitmap selected into it2451 HPOINTER hptr, // in: source icon2452 LONG lBkgndColor, // in: background color for transparent areas2453 PPOINTL pptlLowerLeft, // in: lower left corner of where to paint (ptr can be NULL)2454 ULONG ulIconSize) // in: icon size (should be the value of WinQuerySysValue(HWND_DESKTOP, SV_CXICON))2455 {2456 BOOL brc = FALSE;2457 POINTERINFO pi;2458 2459 // Each icon consists of two (really three)2460 // bitmaps, which are stored in the POINTERINFO2461 // structure:2462 // pi.hbmColor is the actual bitmap to be2463 // drawn. The parts that are2464 // to be transparent or inverted2465 // are black in this image.2466 // pi.hbmPointer has twice the height of2467 // hbmColor. The upper bitmap2468 // contains an XOR mask (for2469 // inverting parts), the lower2470 // bitmap an AND mask (for2471 // transparent parts).2472 if (WinQueryPointerInfo(hptr, &pi))2473 {2474 POINTL ptlLowerLeft = {0, 0};2475 POINTL aptl[4];2476 memset(aptl, 0, sizeof(POINTL) * 4);2477 2478 if (pptlLowerLeft)2479 // lower left specified: V0.9.16 (2001-10-15) [umoeller]2480 memcpy(&ptlLowerLeft, pptlLowerLeft, sizeof(POINTL));2481 2482 // aptl[0]: target bottom-left, is all 02483 aptl[0].x = ptlLowerLeft.x;2484 aptl[0].y = ptlLowerLeft.y;2485 2486 // aptl[1]: target top-right (inclusive!)2487 // V0.9.16 (2001-10-15) [umoeller]: fixed rectangle confusion2488 aptl[1].x = ptlLowerLeft.x + ulIconSize - 1;2489 aptl[1].y = ptlLowerLeft.y + ulIconSize - 1;2490 2491 // aptl[2]: source bottom-left, is all 02492 2493 // aptl[3]: source top-right (exclusive!)2494 // V0.9.16 (2001-10-15) [umoeller]: fixed rectangle confusion2495 aptl[3].x = ulIconSize; // + 1;2496 aptl[3].y = ulIconSize; // + 1;2497 2498 GpiSetColor(hpsMem, CLR_WHITE);2499 GpiSetBackColor(hpsMem, CLR_BLACK);2500 2501 // GpiErase(hpsMem);2502 2503 // V0.9.19 (2002-06-13) [umoeller]:2504 // use BBO_IGNORE instead of BBO_OR or we get funny colors2505 // when scaling down2506 2507 // work on the AND image2508 GpiWCBitBlt(hpsMem, // target2509 pi.hbmPointer, // src bmp2510 4L, // must always be 42511 &aptl[0], // point array2512 ROP_SRCAND, // source AND target2513 BBO_IGNORE); // V0.9.19 (2002-06-13) [umoeller]2514 2515 // paint the real image2516 if (pi.hbmColor)2517 GpiWCBitBlt(hpsMem,2518 pi.hbmColor,2519 4L, // must always be 42520 &aptl[0], // point array2521 ROP_SRCPAINT, // source OR target2522 BBO_IGNORE); // V0.9.19 (2002-06-13) [umoeller]2523 2524 GpiSetColor(hpsMem, lBkgndColor);2525 // work on the XOR image2526 aptl[2].y = ulIconSize; // exclusive2527 aptl[3].y = (ulIconSize * 2); // /* + 1; */ // exclusive2528 // V0.9.16 (2001-10-15) [umoeller]: fixed rectangle confusion2529 GpiWCBitBlt(hpsMem,2530 pi.hbmPointer,2531 4L, // must always be 42532 &aptl[0], // point array2533 ROP_SRCINVERT,2534 BBO_IGNORE); // V0.9.19 (2002-06-13) [umoeller]2535 2536 brc = TRUE;2537 }2538 2539 return brc;2540 }2541 2542 #endif2543 2544 /*2545 2486 *@@ gpihDrawPointer: 2546 2487 * replacement for WinDrawPointer that can do clipping. … … 2585 2526 *@@changed V0.9.20 (2002-07-31) [umoeller]: optimized, saved one GpiQueryBitmapInfoHeader 2586 2527 *@@changed V0.9.20 (2002-08-04) [umoeller]: added DP_HALFTONED 2528 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized 2587 2529 */ 2588 2530 … … 2604 2546 POINTL aptl[4]; 2605 2547 HBITMAP hbmThis; 2606 BITMAPINFOHEADER2 bmiAndXor,2607 bmiColor;2548 SIZEL szlAndXor, // V1.0.1 (2002-11-30) [umoeller] 2549 szlColor; 2608 2550 2609 2551 // A HPOINTER really consists of two bitmaps, … … 2716 2658 ) 2717 2659 { 2718 bmiAndXor.cbFix = sizeof(bmiAndXor); 2719 GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor); 2660 gpihQueryBitmapSize(hbmThis, &szlAndXor); // V1.0.1 (2002-11-30) [umoeller] 2720 2661 2721 2662 // use only half the bitmap height 2722 cySrc = bmiAndXor.cy / 2;2663 cySrc = szlAndXor.cy / 2; 2723 2664 2724 2665 // aptl[2]: source bottom-left 2725 2666 aptl[2].x = 0 2726 + lClipLeft * bmiAndXor.cx / cxIcon;2667 + lClipLeft * szlAndXor.cx / cxIcon; 2727 2668 aptl[2].y = cySrc 2728 2669 + lClipBottom * cySrc / cyIcon; 2729 2670 2730 2671 // aptl[3]: source top-right (exclusive!) 2731 aptl[3].x = bmiAndXor.cx2732 - lClipRight * bmiAndXor.cx / cxIcon;2733 aptl[3].y = bmiAndXor.cy2672 aptl[3].x = szlAndXor.cx 2673 - lClipRight * szlAndXor.cx / cxIcon; 2674 aptl[3].y = szlAndXor.cy 2734 2675 - lClipTop * cySrc / cyIcon; 2735 2676 … … 2753 2694 ) 2754 2695 { 2755 bmiColor.cbFix = sizeof(bmiColor); 2756 GpiQueryBitmapInfoHeader(hbmThis, &bmiColor); 2696 gpihQueryBitmapSize(hbmThis, &szlColor); // V1.0.1 (2002-11-30) [umoeller] 2757 2697 2758 2698 // aptl[2]: source bottom-left 2759 2699 aptl[2].x = 0 2760 + lClipLeft * bmiColor.cx / cxIcon;2700 + lClipLeft * szlColor.cx / cxIcon; 2761 2701 aptl[2].y = 0 2762 + lClipBottom * bmiColor.cy / cyIcon;2702 + lClipBottom * szlColor.cy / cyIcon; 2763 2703 2764 2704 // aptl[3]: source top-right (exclusive!) 2765 aptl[3].x = bmiColor.cx2766 - lClipRight * bmiColor.cx / cxIcon;2767 aptl[3].y = bmiColor.cy2768 - lClipTop * bmiColor.cy / cyIcon;2705 aptl[3].x = szlColor.cx 2706 - lClipRight * szlColor.cx / cxIcon; 2707 aptl[3].y = szlColor.cy 2708 - lClipTop * szlColor.cy / cyIcon; 2769 2709 2770 2710 GpiWCBitBlt(hps, // target … … 2787 2727 ) 2788 2728 { 2789 /* we queried this one above V0.9.20 (2002-07-31) [umoeller] 2790 bmiAndXor.cbFix = sizeof(bmiAndXor); 2791 GpiQueryBitmapInfoHeader(hbmThis, &bmiAndXor); 2792 */ 2729 // we queried the size of this one above V0.9.20 (2002-07-31) [umoeller] 2793 2730 2794 2731 // use only half the bitmap height 2795 cySrc = bmiAndXor.cy / 2;2732 cySrc = szlAndXor.cy / 2; 2796 2733 2797 2734 // aptl[2]: source bottom-left 2798 2735 aptl[2].x = 0 2799 + lClipLeft * bmiAndXor.cx / cxIcon;2736 + lClipLeft * szlAndXor.cx / cxIcon; 2800 2737 aptl[2].y = 0 2801 2738 + lClipBottom * cySrc / cyIcon; 2802 2739 2803 2740 // aptl[3]: source top-right (exclusive!) 2804 aptl[3].x = bmiAndXor.cx2805 - lClipRight * bmiAndXor.cx / cxIcon;2741 aptl[3].x = szlAndXor.cx 2742 - lClipRight * szlAndXor.cx / cxIcon; 2806 2743 aptl[3].y = cySrc 2807 2744 - lClipTop * cySrc / cyIcon; -
trunk/src/helpers/helpers_pre.in
r220 r232 89 89 $(OUTPUTDIR)\cctl_progbar.obj\ 90 90 $(OUTPUTDIR)\cctl_splitwin.obj\ 91 $(OUTPUTDIR)\cctl_toolbar.obj\ 91 92 $(OUTPUTDIR)\cctl_tooltip.obj\ 93 $(OUTPUTDIR)\cctl_xframe.obj\ 92 94 $(OUTPUTDIR)\comctl.obj\ 93 95 $(OUTPUTDIR)\configsys.obj\ -
trunk/src/helpers/linklist.c
r229 r232 732 732 { 733 733 // insert at a later position: 734 PLISTNODE pNodeInsertAfter = lstNodeFromIndex( 735 pList, 736 (ulIndex-1)); 737 738 if (pNodeInsertAfter) 734 PLISTNODE pNodeInsertAfter; 735 736 if (pNodeInsertAfter = lstNodeFromIndex(pList, 737 (ulIndex - 1))) 739 738 { 740 739 // 1) set pointers for new node -
trunk/src/helpers/makefile
r227 r232 263 263 # fdlg.exe 264 264 FDLG_TEST_OBJS = \ 265 $(TESTCASE_DIR)\comctl.obj \ 266 $(TESTCASE_DIR)\cctl_toolbar.obj \ 267 $(TESTCASE_DIR)\cctl_tooltip.obj \ 268 $(TESTCASE_DIR)\cctl_xframe.obj \ 265 269 $(TESTCASE_DIR)\dosh.obj \ 266 270 $(TESTCASE_DIR)\gpih.obj \ 271 $(TESTCASE_DIR)\linklist.obj \ 267 272 $(TESTCASE_DIR)\winh.obj \ 268 273 $(TESTCASE_DIR)\stringh.obj \ … … 271 276 272 277 fdlg.exe: $(FDLG_TEST_OBJS) 273 ilink /debug /pmtype:pm $(FDLG_TEST_OBJS) /o:$@278 ilink /debug /pmtype:pm $(FDLG_TEST_OBJS) pmprintf.lib /o:$@ 274 279 275 280 # xmap.exe -
trunk/src/helpers/winh.c
r229 r232 271 271 /* ****************************************************************** 272 272 * 273 * Global variables 274 * 275 ********************************************************************/ 276 277 extern LONG G_cxScreen = 0, 278 G_cyScreen = 0, 279 G_cxIcon = 0, 280 G_cyIcon = 0, 281 G_lcol3DDark = 0, // lo-3D color 282 G_lcol3DLight = 0; // hi-3D color 283 284 /* ****************************************************************** 285 * 273 286 * Generics 274 287 * 275 288 ********************************************************************/ 289 290 /* 291 *@@ winhInitGlobals: 292 * initializes a few global variables that are usually 293 * used all the time in many applications and also 294 * internally by many helper routines. You must call 295 * this at the start of your application if you want 296 * to use these. 297 * 298 *@@added V1.0.1 (2002-11-30) [umoeller] 299 */ 300 301 VOID winhInitGlobals(VOID) 302 { 303 G_cxScreen = WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN); 304 G_cyScreen = WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN); 305 G_cxIcon = WinQuerySysValue(HWND_DESKTOP, SV_CXICON); 306 G_cyIcon = WinQuerySysValue(HWND_DESKTOP, SV_CYICON); 307 G_lcol3DDark = WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONDARK, 0); 308 G_lcol3DLight = WinQuerySysColor(HWND_DESKTOP, SYSCLR_BUTTONLIGHT, 0); 309 } 276 310 277 311 /* … … 2805 2839 // if (xNew + swpThis.cy > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN)) 2806 2840 // not cy, but cx V1.0.0 (2002-08-26) [umoeller] 2807 if (xNew + swpThis.cx > WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN))2841 if (xNew + swpThis.cx > G_cxScreen) 2808 2842 { 2809 2843 // place left then … … 2902 2936 2903 2937 /* 2938 *@@ winhQueryDefaultFont: 2939 * 2940 *@@added V1.0.1 (2002-11-30) [umoeller] 2941 */ 2942 2943 PCSZ winhQueryDefaultFont(VOID) 2944 { 2945 if (doshIsWarp4()) 2946 return "9.WarpSans"; 2947 2948 return "8.Helv"; 2949 } 2950 2951 /* 2904 2952 *@@ winhSetWindowFont: 2905 2953 * this sets a window's font by invoking … … 2914 2962 * 2915 2963 *@@added V0.9.0 [umoeller] 2964 *@@changed V1.0.1 (2002-11-30) [umoeller]: optimized 2916 2965 */ 2917 2966 … … 2919 2968 const char *pcszFont) 2920 2969 { 2921 CHAR szFont[256]; 2922 2923 if (pcszFont == NULL) 2924 { 2925 if (doshIsWarp4()) 2926 strhncpy0(szFont, "9.WarpSans", sizeof(szFont)); 2927 else 2928 strhncpy0(szFont, "8.Helv", sizeof(szFont)); 2929 } 2930 else 2931 strhncpy0(szFont, pcszFont, sizeof(szFont)); 2970 if (!pcszFont) 2971 pcszFont = winhQueryDefaultFont(); 2932 2972 2933 2973 return WinSetPresParam(hwnd, 2934 2974 PP_FONTNAMESIZE, 2935 strlen( szFont)+1,2936 szFont);2975 strlen(pcszFont) + 1, 2976 (PSZ)pcszFont); 2937 2977 } 2938 2978 … … 3082 3122 } 3083 3123 } 3124 3084 3125 return brc; 3126 } 3127 3128 /* 3129 *@@ winhCreateDefaultPresparams: 3130 * 3131 * Caller must free() the return value. 3132 * 3133 *@@added V1.0.1 (2002-11-30) [umoeller] 3134 */ 3135 3136 PPRESPARAMS winhCreateDefaultPresparams(VOID) 3137 { 3138 PPRESPARAMS ppp = NULL; 3139 3140 PCSZ pcszFont = winhQueryDefaultFont(); 3141 LONG lColor; 3142 3143 winhStorePresParam(&ppp, 3144 PP_FONTNAMESIZE, 3145 strlen(pcszFont) + 1, 3146 (PVOID)pcszFont); 3147 3148 lColor = WinQuerySysColor(HWND_DESKTOP, 3149 SYSCLR_DIALOGBACKGROUND, 3150 0); 3151 winhStorePresParam(&ppp, 3152 PP_BACKGROUNDCOLOR, 3153 sizeof(lColor), 3154 &lColor); 3155 3156 lColor = RGBCOL_BLACK; 3157 winhStorePresParam(&ppp, 3158 PP_FOREGROUNDCOLOR, 3159 sizeof(lColor), 3160 &lColor); 3161 3162 return ppp; 3085 3163 } 3086 3164 … … 3497 3575 3498 3576 /* 3499 *@@ winhMyAnchorBlock:3500 * returns the proper anchor block (HAB)3501 * for the calling thread.3502 *3503 * Many Win* functions require an HAB to be3504 * passed in. While many of them will work3505 * when passing in NULLHANDLE, some (such as3506 * WinGetMsg) won't. If you don't know the3507 * anchor block of the calling thread, use3508 * this function.3509 *3510 * This creates a temporary object window to3511 * find out the anchor block. This is quite3512 * expensive so only use this if there's no3513 * other way to find out.3514 *3515 *@@added V0.9.11 (2001-04-20) [umoeller]3516 */3517 3518 HAB winhMyAnchorBlock(VOID)3519 {3520 HAB hab = NULLHANDLE;3521 HWND hwnd;3522 if (hwnd = winhCreateObjectWindow(WC_BUTTON, NULL))3523 {3524 hab = WinQueryAnchorBlock(hwnd);3525 WinDestroyWindow(hwnd);3526 }3527 3528 return hab;3529 }3530 3531 /*3532 3577 *@@ winhFree: 3533 3578 * frees a block of memory allocated by the … … 3728 3773 3729 3774 /* 3775 *@@ winhQueryWaitPointer: 3776 * shortcut for getting the system "wait" pointer. 3777 * 3778 *@@added V1.0.1 (2002-11-30) [umoeller] 3779 */ 3780 3781 HPOINTER winhQueryWaitPointer(VOID) 3782 { 3783 return WinQuerySysPointer(HWND_DESKTOP, 3784 SPTR_WAIT, 3785 FALSE); // no copy 3786 } 3787 3788 /* 3730 3789 *@@ winhSetWaitPointer: 3731 3790 * this sets the mouse pointer to "Wait". … … 3742 3801 HPOINTER hptr = WinQueryPointer(HWND_DESKTOP); 3743 3802 WinSetPointer(HWND_DESKTOP, 3744 WinQuerySysPointer(HWND_DESKTOP, 3745 SPTR_WAIT, 3746 FALSE)); // no copy 3803 winhQueryWaitPointer()); 3747 3804 return hptr; 3748 3805 } … … 3760 3817 { 3761 3818 PSZ pszText = NULL; 3762 ULONG cbText = WinQueryWindowTextLength(hwnd); 3763 // additional null character 3764 if (cbText) 3765 { 3766 if (pszText = (PSZ)malloc(cbText + 1)) 3819 ULONG cbText; 3820 if (cbText = WinQueryWindowTextLength(hwnd)) 3821 { 3822 if (pszText = (PSZ)malloc(cbText + 1)) // additional null character 3767 3823 WinQueryWindowText(hwnd, 3768 3824 cbText + 1, 3769 3825 pszText); 3770 3826 } 3827 3771 3828 return pszText; 3772 3829 } … … 3821 3878 { 3822 3879 BOOL brc = FALSE; 3823 PSZ pszText = winhQueryWindowText(hwnd); 3824 if (pszText) 3880 PSZ pszText; 3881 3882 if (pszText = winhQueryWindowText(hwnd)) 3825 3883 { 3826 3884 ULONG ulOfs = 0; … … 3830 3888 brc = TRUE; 3831 3889 } 3890 3832 3891 free(pszText); 3833 3892 } 3893 3834 3894 return brc; 3835 3895 } … … 3939 3999 *@@changed V0.9.5 (2000-08-13) [umoeller]: flStyleClient never worked, fixed 3940 4000 *@@changed V0.9.7 (2000-12-08) [umoeller]: fixed client calc for invisible window 4001 *@@changed V1.0.1 (2002-11-30) [umoeller]: added support for NULL pcszClassClient 3941 4002 */ 3942 4003 … … 3947 4008 const char *pcszFrameTitle, // in: frame title (title bar) 3948 4009 ULONG ulResourcesID, // in: according to FCF_* flags 3949 const char *pcszClassClient, // in: client class name 4010 const char *pcszClassClient, // in: client class name (can be NULL for no client) 3950 4011 ULONG flStyleClient, // in: client style 3951 4012 ULONG ulID, // in: frame window ID 3952 4013 PVOID pClientCtlData, // in: pCtlData structure pointer for client 3953 PHWND phwndClient) // out: created client wnd 4014 PHWND phwndClient) // out: created client wnd (required) 3954 4015 { 3955 4016 FRAMECDATA fcdata; … … 3962 4023 fcdata.idResources = ulResourcesID; 3963 4024 3964 / * Create the frame and client windows. */3965 hwndFrame = WinCreateWindow(hwndFrameParent,3966 WC_FRAME,3967 (PSZ)pcszFrameTitle,3968 ulFrameStyle,3969 0,0,0,0, // size and position = 03970 NULLHANDLE, // no owner3971 HWND_TOP, // z-order3972 ulID, // frame window ID3973 &fcdata, // frame class data3974 NULL); // no presparams3975 3976 if (hwndFrame)3977 {3978 if (*phwndClient = WinCreateWindow(hwndFrame, // parent3979 (PSZ)pcszClassClient, // class3980 NULL, // no title3981 flStyleClient, // style3982 0,0,0,0, // size and position = 03983 hwndFrame, // owner3984 HWND_BOTTOM, // bottom z-order3985 FID_CLIENT, // frame window ID3986 pClientCtlData, // class data3987 NULL)) // no presparams4025 // create the frame and client windows 4026 if (hwndFrame = WinCreateWindow(hwndFrameParent, 4027 WC_FRAME, 4028 (PSZ)pcszFrameTitle, 4029 ulFrameStyle, 4030 0,0,0,0, 4031 NULLHANDLE, 4032 HWND_TOP, 4033 ulID, 4034 &fcdata, 4035 NULL)) 4036 { 4037 if ( (!pcszClassClient) // V1.0.1 (2002-11-30) [umoeller] 4038 || (*phwndClient = WinCreateWindow(hwndFrame, // parent 4039 (PSZ)pcszClassClient, // class 4040 NULL, // no title 4041 flStyleClient, // style 4042 0,0,0,0, // size and position = 0 4043 hwndFrame, // owner 4044 HWND_BOTTOM, // bottom z-order 4045 FID_CLIENT, // frame window ID 4046 pClientCtlData, // class data 4047 NULL)) // no presparams 4048 ) 3988 4049 { 3989 4050 if (pswpFrame) … … 3998 4059 pswpFrame->fl); 3999 4060 4000 // position client 4001 // WinQueryWindowRect(hwndFrame, &rclClient); 4002 // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller] 4003 rclClient.xLeft = 0; 4004 rclClient.yBottom = 0; 4005 rclClient.xRight = pswpFrame->cx; 4006 rclClient.yTop = pswpFrame->cy; 4007 WinCalcFrameRect(hwndFrame, 4008 &rclClient, 4009 TRUE); // calc client from frame 4010 WinSetWindowPos(*phwndClient, 4011 HWND_TOP, 4012 rclClient.xLeft, 4013 rclClient.yBottom, 4014 rclClient.xRight - rclClient.xLeft, 4015 rclClient.yTop - rclClient.yBottom, 4016 SWP_MOVE | SWP_SIZE | SWP_SHOW); 4061 if (!pcszClassClient) 4062 *phwndClient = NULLHANDLE; 4063 else 4064 { 4065 // position client 4066 // WinQueryWindowRect(hwndFrame, &rclClient); 4067 // doesn't work because it might be invisible V0.9.7 (2000-12-08) [umoeller] 4068 rclClient.xLeft = 0; 4069 rclClient.yBottom = 0; 4070 rclClient.xRight = pswpFrame->cx; 4071 rclClient.yTop = pswpFrame->cy; 4072 WinCalcFrameRect(hwndFrame, 4073 &rclClient, 4074 TRUE); // calc client from frame 4075 WinSetWindowPos(*phwndClient, 4076 HWND_TOP, 4077 rclClient.xLeft, 4078 rclClient.yBottom, 4079 rclClient.xRight - rclClient.xLeft, 4080 rclClient.yTop - rclClient.yBottom, 4081 SWP_MOVE | SWP_SIZE | SWP_SHOW); 4082 } 4017 4083 } 4018 4084 } … … 4119 4185 if (WinQueryClassName(hwndThis, sizeof(szClass), szClass)) 4120 4186 { 4121 if ( strcmp(szClass, "#32767") == 0)4187 if (!strcmp(szClass, "#32767")) 4122 4188 { 4123 4189 // message queue window: … … 4132 4198 { 4133 4199 // get HMQ from window words 4134 rc = WinQueryWindowULong(hwndThis, QWL_HMQ); 4135 if (rc) 4200 if (rc = WinQueryWindowULong(hwndThis, QWL_HMQ)) 4136 4201 if (phab) 4137 4202 *phab = WinQueryAnchorBlock(hwndThis); 4203 4138 4204 break; 4139 4205 } … … 4178 4244 // enumerate all child windows of HWND_OBJECT 4179 4245 henumObject = WinBeginEnumWindows(HWND_OBJECT); 4180 while ((hwndObjectChild = WinGetNextWindow(henumObject)) != NULLHANDLE)4246 while ((hwndObjectChild = WinGetNextWindow(henumObject))) 4181 4247 { 4182 4248 // see if the current HWND_OBJECT child window runs in the … … 4272 4338 WS_VISIBLE, // window style 4273 4339 0, 0, // position and size 4274 WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN),4275 WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN),4340 G_cxScreen, 4341 G_cyScreen, 4276 4342 NULLHANDLE, // owner window 4277 4343 hwndSibling, // sibling window … … 4426 4492 * was encountered. 4427 4493 * 4428 * You can specify DT_QUERYEXTENT with flDraw to only have 4429 * these text boundaries calculated without actually drawing. 4494 * The following DT_* flags are supported: 4495 * 4496 * -- DT_LEFT, DT_CENTER, DT_RIGHT all work. 4497 * 4498 * -- Vertically however only DT_TOP is supported. 4499 * 4500 * -- You can specify DT_QUERYEXTENT to only have 4501 * these text boundaries calculated without actually 4502 * drawing. 4503 * 4504 * Note that DT_TEXTATTRS will always be added, so you 4505 * will want to call GpiSetColor before this. 4430 4506 * 4431 4507 * This returns the number of lines drawn. 4432 *4433 * Note that this calls WinDrawText with DT_TEXTATTRS set,4434 * that is, the current text primitive attributes will be4435 * used (fonts and colors).4436 4508 * 4437 4509 *@@changed V0.9.0 [umoeller]: prcl.xLeft and xRight are now updated too upon return … … 4443 4515 // (modified) 4444 4516 const char *pcszText, // in: text to draw (zero-terminated) 4445 ULONG flCmd) // in: flags like in WinDrawText; I have 4446 // only tested DT_TOP and DT_LEFT though. 4447 // DT_WORDBREAK | DT_TEXTATTRS are always 4448 // set. 4449 // You can specify DT_QUERYEXTENT to only 4450 // have prcl calculated without drawing. 4517 ULONG flCmd) // in: DT_* flags like in WinDrawText; see remarks 4451 4518 { 4452 4519 PSZ p = (PSZ)pcszText; … … 4472 4539 memcpy(&rcl2, prcl, sizeof(rcl2)); 4473 4540 lDrawn = WinDrawText(hps, 4474 ulTextLen -lTotalDrawn,4541 ulTextLen - lTotalDrawn, 4475 4542 p, 4476 4543 &rcl2, 4477 0, 0, // colors 4544 0, 4545 0, // colors 4478 4546 flCmd2); 4479 4547 … … 4494 4562 lLineCount++; 4495 4563 } 4564 4496 4565 prcl->xLeft = xLeftmost; 4497 4566 prcl->xRight = xRightmost; … … 4521 4590 PSWBLOCK winhQuerySwitchList(HAB hab) 4522 4591 { 4523 ULONG cItems = WinQuerySwitchList(hab, NULL, 0); 4524 ULONG ulBufSize = (cItems * sizeof(SWENTRY)) + sizeof(HSWITCH); 4525 PSWBLOCK pSwBlock = (PSWBLOCK)malloc(ulBufSize); 4526 if (pSwBlock) 4527 { 4528 cItems = WinQuerySwitchList(hab, pSwBlock, ulBufSize); 4529 if (!cItems) 4592 ULONG cItems = WinQuerySwitchList(hab, NULL, 0); 4593 ULONG ulBufSize = (cItems * sizeof(SWENTRY)) + sizeof(HSWITCH); 4594 PSWBLOCK pSwBlock; 4595 if (pSwBlock = (PSWBLOCK)malloc(ulBufSize)) 4596 { 4597 if (!(cItems = WinQuerySwitchList(hab, pSwBlock, ulBufSize))) 4530 4598 { 4531 4599 free(pSwBlock); … … 4747 4815 &ShiftState, DataLen, &DataLen, 4748 4816 NULL, 0L, NULL); 4817 4749 4818 // now close OS/2 keyboard driver 4750 4819 DosClose(hKbd); 4751 4820 } 4752 return;4753 4821 } 4754 4822 … … 4798 4866 4799 4867 /* 4800 *@@category: Helpers\PM helpers\Extended frame windows4801 */4802 4803 /* ******************************************************************4804 *4805 * Extended frame4806 *4807 ********************************************************************/4808 4809 /*4810 *@@ winhCalcExtFrameRect:4811 * implementation for WM_CALCFRAMERECT in fnwpSubclExtFrame.4812 * This is exported so it can be used independently4813 * (XWorkplace status bars).4814 *4815 *@@added V1.0.0 (2002-08-28) [umoeller]4816 */4817 4818 VOID winhCalcExtFrameRect(MPARAM mp1,4819 MPARAM mp2,4820 LONG lStatusBarHeight)4821 {4822 PRECTL prclPassed = (PRECTL)mp1;4823 4824 // mp2 == TRUE: Frame rectangle provided, calculate client4825 // mp2 == FALSE: Client area rectangle provided, calculate frame4826 if (mp2)4827 {4828 // TRUE: calculate the rectl of the client;4829 // call default window procedure to subtract child frame4830 // controls from the rectangle's height4831 LONG lClientHeight;4832 4833 // position the static text frame extension below the client4834 lClientHeight = prclPassed->yTop - prclPassed->yBottom;4835 if (lStatusBarHeight > lClientHeight)4836 // extension is taller than client, so set client height to 04837 prclPassed->yTop = prclPassed->yBottom;4838 else4839 {4840 // set the origin of the client and shrink it based upon the4841 // static text control's height4842 prclPassed->yBottom += lStatusBarHeight;4843 prclPassed->yTop -= lStatusBarHeight;4844 }4845 }4846 else4847 {4848 // FALSE: calculate the rectl of the frame;4849 // call default window procedure to subtract child frame4850 // controls from the rectangle's height;4851 // set the origin of the frame and increase it based upon the4852 // static text control's height4853 prclPassed->yBottom -= lStatusBarHeight;4854 prclPassed->yTop += lStatusBarHeight;4855 }4856 }4857 4858 #define STATUS_BAR_HEIGHT 204859 4860 /*4861 *@@ fnwpSubclExtFrame:4862 * subclassed frame window proc.4863 *4864 *@@added V0.9.16 (2001-09-29) [umoeller]4865 */4866 4867 MRESULT EXPENTRY fnwpSubclExtFrame(HWND hwndFrame, ULONG msg, MPARAM mp1, MPARAM mp2)4868 {4869 MRESULT mrc = 0;4870 4871 PEXTFRAMEDATA pData = (PEXTFRAMEDATA)WinQueryWindowPtr(hwndFrame, QWL_USER);4872 4873 switch (msg)4874 {4875 case WM_QUERYFRAMECTLCOUNT:4876 {4877 // query the standard frame controls count4878 ULONG ulrc = (ULONG)pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);4879 4880 // if we have a status bar, increment the count4881 ulrc++;4882 4883 mrc = (MPARAM)ulrc;4884 }4885 break;4886 4887 case WM_FORMATFRAME:4888 {4889 // query the number of standard frame controls4890 ULONG ulCount = (ULONG)pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);4891 4892 // we have a status bar:4893 // format the frame4894 ULONG ul;4895 PSWP swpArr = (PSWP)mp1;4896 4897 for (ul = 0; ul < ulCount; ul++)4898 {4899 if (WinQueryWindowUShort(swpArr[ul].hwnd, QWS_ID) == 0x8008)4900 // FID_CLIENT4901 {4902 POINTL ptlBorderSizes;4903 WinSendMsg(hwndFrame,4904 WM_QUERYBORDERSIZE,4905 (MPARAM)&ptlBorderSizes,4906 0);4907 4908 // first initialize the _new_ SWP for the status bar.4909 // Since the SWP array for the std frame controls is4910 // zero-based, and the standard frame controls occupy4911 // indices 0 thru ulCount-1 (where ulCount is the total4912 // count), we use ulCount for our static text control.4913 swpArr[ulCount].fl = SWP_MOVE | SWP_SIZE | SWP_NOADJUST | SWP_ZORDER;4914 swpArr[ulCount].x = ptlBorderSizes.x;4915 swpArr[ulCount].y = ptlBorderSizes.y;4916 swpArr[ulCount].cx = swpArr[ul].cx; // same as cnr's width4917 swpArr[ulCount].cy = STATUS_BAR_HEIGHT;4918 swpArr[ulCount].hwndInsertBehind = HWND_BOTTOM; // HWND_TOP;4919 swpArr[ulCount].hwnd = WinWindowFromID(hwndFrame, FID_STATUSBAR);4920 4921 // adjust the origin and height of the container to4922 // accomodate our static text control4923 swpArr[ul].y += swpArr[ulCount].cy;4924 swpArr[ul].cy -= swpArr[ulCount].cy;4925 }4926 }4927 4928 // increment the number of frame controls4929 // to include our status bar4930 mrc = (MRESULT)(ulCount + 1);4931 }4932 break;4933 4934 case WM_CALCFRAMERECT:4935 mrc = pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);4936 4937 // we have a status bar: calculate its rectangle4938 winhCalcExtFrameRect(mp1,4939 mp2,4940 STATUS_BAR_HEIGHT);4941 break;4942 4943 case WM_DESTROY:4944 WinSubclassWindow(hwndFrame, pData->pfnwpOrig);4945 free(pData);4946 WinSetWindowPtr(hwndFrame, QWL_USER, NULL);4947 break;4948 4949 default:4950 mrc = pData->pfnwpOrig(hwndFrame, msg, mp1, mp2);4951 }4952 4953 return mrc;4954 }4955 4956 /*4957 *@@ winhCreateStatusBar:4958 * creates a status bar for a frame window.4959 *4960 * Normally there's no need to call this manually,4961 * this gets called by winhCreateExtStdWindow4962 * automatically.4963 *4964 *@@added V0.9.16 (2001-09-29) [umoeller]4965 */4966 4967 HWND winhCreateStatusBar(HWND hwndFrame,4968 HWND hwndOwner,4969 const char *pcszText, // in: initial status bar text4970 const char *pcszFont, // in: font to use for status bar4971 LONG lColor) // in: foreground color for status bar4972 {4973 // create status bar4974 HWND hwndReturn = NULLHANDLE;4975 PPRESPARAMS ppp = NULL;4976 4977 winhStorePresParam(&ppp,4978 PP_FONTNAMESIZE,4979 strlen(pcszFont) + 1,4980 (PVOID)pcszFont);4981 4982 lColor = WinQuerySysColor(HWND_DESKTOP,4983 SYSCLR_DIALOGBACKGROUND,4984 0);4985 winhStorePresParam(&ppp,4986 PP_BACKGROUNDCOLOR,4987 sizeof(lColor),4988 &lColor);4989 4990 lColor = CLR_BLACK;4991 winhStorePresParam(&ppp,4992 PP_FOREGROUNDCOLOR,4993 sizeof(lColor),4994 &lColor);4995 4996 hwndReturn = WinCreateWindow(hwndFrame,4997 WC_STATIC,4998 (PSZ)pcszText,4999 SS_TEXT | DT_VCENTER | WS_VISIBLE,5000 0, 0, 0, 0,5001 hwndOwner,5002 HWND_TOP,5003 FID_STATUSBAR,5004 NULL,5005 ppp);5006 free(ppp);5007 5008 return hwndReturn;5009 }5010 5011 /*5012 *@@ winhCreateExtStdWindow:5013 * creates an extended frame window.5014 *5015 * pData must point to an EXTFRAMECDATA structure5016 * which contains a copy of the parameters to be5017 * passed to winhCreateStdWindow. In addition,5018 * this contains the flExtFlags field, which allows5019 * you to automatically create a status bar for5020 * the window.5021 *5022 * Note that we subclass the frame here and require5023 * QWL_USER for that. The frame's QWL_USER points5024 * to an EXTFRAMEDATA structure whose pUser parameter5025 * you may use for additional data, if you want to5026 * do further subclassing.5027 *5028 *@@added V0.9.16 (2001-09-29) [umoeller]5029 */5030 5031 HWND winhCreateExtStdWindow(PEXTFRAMECDATA pData, // in: extended frame data5032 PHWND phwndClient) // out: created client wnd5033 {5034 HWND hwndFrame;5035 5036 if (hwndFrame = winhCreateStdWindow(HWND_DESKTOP,5037 pData->pswpFrame,5038 pData->flFrameCreateFlags,5039 pData->ulFrameStyle,5040 pData->pcszFrameTitle,5041 pData->ulResourcesID,5042 pData->pcszClassClient,5043 pData->flStyleClient,5044 pData->ulID,5045 pData->pClientCtlData,5046 phwndClient))5047 {5048 if (pData->flExtFlags & XFCF_STATUSBAR)5049 {5050 // create status bar as child of the frame5051 HWND hwndStatusBar = winhCreateStatusBar(hwndFrame,5052 hwndFrame,5053 "",5054 "9.WarpSans",5055 CLR_BLACK);5056 5057 // subclass frame for supporting status bar and msgs5058 PEXTFRAMEDATA pFrameData;5059 if (pFrameData = NEW(EXTFRAMEDATA))5060 {5061 ZERO(pFrameData),5062 memcpy(&pFrameData->CData, pData, sizeof(pFrameData->CData));5063 if (pFrameData->pfnwpOrig = WinSubclassWindow(hwndFrame,5064 fnwpSubclExtFrame))5065 {5066 WinSetWindowPtr(hwndFrame, QWL_USER, pFrameData);5067 }5068 else5069 free(pFrameData);5070 }5071 }5072 }5073 5074 return hwndFrame;5075 }5076 5077 /*5078 4868 *@@category: Helpers\PM helpers\Workplace Shell\WPS class list 5079 4869 */ … … 5156 4946 while (pocThis) 5157 4947 { 5158 if ( strcmp(pocThis->pszClassName, pszClass) == 0)4948 if (!strcmp(pocThis->pszClassName, pszClass)) 5159 4949 { 5160 4950 pbReturn = (PBYTE)pocThis; 5161 4951 break; 5162 4952 } 4953 5163 4954 // next class 5164 4955 pocThis = pocThis->pNext; … … 5237 5028 // failed: do more error checking then, try DosLoadModule 5238 5029 HMODULE hmod = NULLHANDLE; 5239 arc = DosLoadModule(pszBuf, cbBuf, 5240 (PSZ)pcszModule, 5241 &hmod); 5242 if (arc == NO_ERROR) 5030 if (!(arc = DosLoadModule(pszBuf, cbBuf, 5031 (PSZ)pcszModule, 5032 &hmod))) 5243 5033 { 5244 5034 // DosLoadModule succeeded: … … 5266 5056 { 5267 5057 BOOL brc = FALSE; 5268 PBYTE pClassList = winhQueryWPSClassList(); 5269 if (pClassList) 5058 PBYTE pClassList; 5059 5060 if (pClassList = winhQueryWPSClassList()) 5270 5061 { 5271 5062 if (winhQueryWPSClass(pClassList, pcszClass)) 5272 5063 brc = TRUE; 5064 5273 5065 free(pClassList); 5274 5066 } … … 5331 5123 return ulrc; 5332 5124 } 5125
Note:
See TracChangeset
for help on using the changeset viewer.