Changeset 218
- Timestamp:
- Aug 31, 2002, 4:19:50 PM (23 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/helpers/winh.h
r217 r218 320 320 typedef WINHMERGEMENUS *PWINHMERGEMENUS; 321 321 322 ULONG XWPENTRY winhClearMenu(HWND hwndMenu); 323 322 324 PSZ XWPENTRY winhQueryMenuItemText(HWND hwndMenu, 323 325 USHORT usItemID); … … 925 927 #define FID_STATUSBAR 0x8100 926 928 929 VOID winhCalcExtFrameRect(MPARAM mp1, 930 MPARAM mp2, 931 LONG lStatusBarHeight); 932 927 933 /* 928 934 *@@ EXTFRAMECDATA: … … 933 939 typedef struct _EXTFRAMECDATA 934 940 { 935 PSWP pswpFrame; 936 ULONG flFrameCreateFlags; 937 ULONG flExtFlags; 938 ULONG ulFrameStyle; 939 const char *pcszFrameTitle; // in: frame title (title bar)940 ULONG ulResourcesID; 941 const char *pcszClassClient; // in: client class name942 ULONG flStyleClient; 943 ULONG ulID; 944 PVOID pClientCtlData; 941 PSWP pswpFrame; // in: frame wnd pos 942 ULONG flFrameCreateFlags; // in: FCF_* flags 943 ULONG flExtFlags; // in: XFCF_* flags 944 ULONG ulFrameStyle; // in: WS_* flags (e.g. WS_VISIBLE, WS_ANIMATE) 945 const char *pcszFrameTitle; // in: frame title (title bar) 946 ULONG ulResourcesID; // in: according to FCF_* flags 947 const char *pcszClassClient; // in: client class name 948 ULONG flStyleClient; // in: client style 949 ULONG ulID; // in: frame window ID 950 PVOID pClientCtlData; // in: pCtlData structure pointer for client 945 951 } EXTFRAMECDATA, *PEXTFRAMECDATA; 946 952 -
trunk/src/helpers/procstat.c
r217 r218 558 558 * 559 559 *@@added V0.9.2 (2000-03-05) [umoeller] 560 *@@changed V0.9.21 (2002-08-16) [pr]: optimized 560 561 */ 561 562 … … 566 567 while (pProcThis && pProcThis->ulRecType == 1) 567 568 { 568 int i;569 569 PQTHREAD32 t = pProcThis->pThreads; 570 570 PQMODULE32 pModule; … … 589 589 // the next process block comes after the 590 590 // threads 591 for (i=0; 592 i < pProcThis->usThreadCount; 593 i++,t++) 594 ; 595 591 t += pProcThis->usThreadCount; 596 592 pProcThis = (PQPROCESS32)t; 597 593 } … … 607 603 * 608 604 *@@added V0.9.21 (2002-08-12) [umoeller] 605 *@@changed V0.9.21 (2002-08-16) [pr]: optimized 609 606 */ 610 607 … … 615 612 while (pProcThis && pProcThis->ulRecType == 1) 616 613 { 617 int i;618 614 PQTHREAD32 t = pProcThis->pThreads; 619 615 … … 624 620 // the next process block comes after the 625 621 // threads 626 for (i=0; 627 i < pProcThis->usThreadCount; 628 i++, t++) 629 ; 630 622 t += pProcThis->usThreadCount; 631 623 pProcThis = (PQPROCESS32)t; 632 624 } -
trunk/src/helpers/winh.c
r217 r218 283 283 ULONG winhQueryWindowStyle(HWND hwnd) 284 284 { 285 return (WinQueryWindowULong(hwnd, QWL_STYLE));285 return WinQueryWindowULong(hwnd, QWL_STYLE); 286 286 } 287 287 … … 296 296 BOOL fEnable) 297 297 { 298 return (WinEnableWindow(WinWindowFromID(hwndDlg, id), fEnable));298 return WinEnableWindow(WinWindowFromID(hwndDlg, id), fEnable); 299 299 } 300 300 … … 308 308 SHORT id) 309 309 { 310 return (WinIsWindowEnabled(WinWindowFromID(hwndDlg, id)));310 return WinIsWindowEnabled(WinWindowFromID(hwndDlg, id)); 311 311 } 312 312 … … 334 334 PMENUITEM pmi) // out: MENUITEM data 335 335 { 336 return ( (BOOL)WinSendMsg(hwndMenu,337 338 339 (MPARAM)pmi));336 return (BOOL)WinSendMsg(hwndMenu, 337 MM_QUERYITEM, 338 MPFROM2SHORT(usItemID, fSearchSubmenus), 339 (MPARAM)pmi); 340 340 } 341 341 … … 427 427 { 428 428 MENUITEM mi; 429 SHORT src = MIT_ERROR;430 429 431 430 mi.iPosition = iPosition; … … 435 434 mi.hwndSubMenu = 0; 436 435 mi.hItem = 0; 437 src = SHORT1FROMMR(WinSendMsg(hwndMenu, 438 MM_INSERTITEM,439 (MPARAM)&mi,440 (MPARAM)pcszItemTitle));441 return (src);436 437 return SHORT1FROMMR(WinSendMsg(hwndMenu, 438 MM_INSERTITEM, 439 (MPARAM)&mi, 440 (MPARAM)pcszItemTitle)); 442 441 } 443 442 … … 511 510 } 512 511 } 513 return (hwndNewMenu);512 return hwndNewMenu; 514 513 } 515 514 … … 621 620 mi.hItem = 0; 622 621 623 return (SHORT1FROMMR(WinSendMsg(hMenu,624 625 626 (MPARAM)"")));622 return SHORT1FROMMR(WinSendMsg(hMenu, 623 MM_INSERTITEM, 624 (MPARAM)&mi, 625 (MPARAM)"")); 627 626 } 628 627 … … 856 855 } 857 856 858 return (hwndNewSubmenu);857 return hwndNewSubmenu; 859 858 } 860 859 … … 892 891 SHORT id = SHORT1FROMMR(WinSendMsg(hmenuSource, 893 892 MM_ITEMIDFROMPOSITION, 894 MPFROM SHORT(i),893 MPFROM2SHORT(i, 0), 895 894 0)); 896 895 winhCopyMenuItem2(hmenuTarget, … … 905 904 906 905 /* 906 *@@ winhClearMenu: 907 * removes all menu items from the given (sub)menu. 908 * The menu itself is not destroyed, but is empty 909 * after calling this function. 910 * 911 *@@added V0.9.21 (2002-08-31) [umoeller] 912 */ 913 914 ULONG winhClearMenu(HWND hwndMenu) 915 { 916 ULONG cDeleted = 0; 917 SHORT sID; 918 919 // what we do is getting the menu item count 920 // and then delete the first item in the menu 921 // x times because there is no "delete menu item 922 // from position" message, and there might be 923 // duplicate IDs in the menu... this should 924 // work always 925 926 SHORT cMenuItems = SHORT1FROMMR(WinSendMsg(hwndMenu, 927 MM_QUERYITEMCOUNT, 928 0, 929 0)); 930 while (cMenuItems-- > 0) 931 { 932 sID = (SHORT)WinSendMsg(hwndMenu, 933 MM_ITEMIDFROMPOSITION, 934 MPFROMSHORT(0), 935 MPNULL); 936 937 WinSendMsg(hwndMenu, 938 MM_DELETEITEM, 939 MPFROM2SHORT(sID, FALSE), 940 0); 941 942 ++cDeleted; 943 } 944 945 return cDeleted; 946 } 947 948 /* 907 949 *@@ winhQueryMenuItemText: 908 950 * this returns a menu item text as a PSZ … … 940 982 } 941 983 942 return (prc);984 return prc; 943 985 } 944 986 … … 1036 1078 (MPARAM)prtlItem); 1037 1079 if (WinPtInRect(habDesktop, prtlItem, pptlMouse)) 1038 return (sItemId);1080 return sItemId; 1039 1081 } 1040 1082 /* sItemId = (SHORT)WinSendMsg(hwndMenu, MM_ITEMIDFROMPOSITION, (MPARAM)(sItemCount-1), MPNULL); 1041 1083 return (sItemId); */ 1042 return (-1); // error: no valid menu item 1084 1085 return -1; // error: no valid menu item 1043 1086 } 1044 1087 … … 1218 1261 } 1219 1262 1220 return (hwndSlider);1263 return hwndSlider; 1221 1264 } 1222 1265 … … 1482 1525 } 1483 1526 1484 return (hwndSlider);1527 return hwndSlider; 1485 1528 } 1486 1529 … … 1619 1662 MPNULL); 1620 1663 } 1621 return (lValue);1664 return lValue; 1622 1665 } 1623 1666 … … 1662 1705 } 1663 1706 1664 return (pszReturn);1707 return pszReturn; 1665 1708 } 1666 1709 … … 1750 1793 } 1751 1794 1752 return (lItemCount);1795 return lItemCount; 1753 1796 } 1754 1797 … … 1779 1822 if (ulHandle == winhQueryLboxItemHandle(hwndListBox, 1780 1823 ul)) 1781 return (ul);1824 return ul; 1782 1825 } 1783 1826 } 1784 1827 1785 return (-1);1828 return -1; 1786 1829 } 1787 1830 … … 2119 2162 // _Pmpf(("End of winhHandleScrollMsg")); 2120 2163 2121 return (TRUE);2164 return TRUE; 2122 2165 } 2123 2166 … … 2274 2317 // _Pmpf(("End of winhProcessScrollChars")); 2275 2318 2276 return (fProcessed);2319 return fProcessed; 2277 2320 } 2278 2321 … … 2712 2755 ulReply = WinProcessDlg(hwndDlg); 2713 2756 WinDestroyWindow(hwndDlg); 2714 return (ulReply);2757 return ulReply; 2715 2758 } 2716 2759 … … 2818 2861 } 2819 2862 2820 return (hwnd);2863 return hwnd; 2821 2864 } 2822 2865 … … 2853 2896 QPF_NOINHERIT); 2854 2897 if (szNewFont[0] != 0) 2855 return (strdup(szNewFont));2898 return strdup(szNewFont); 2856 2899 2857 2900 return NULL; … … 2888 2931 strhncpy0(szFont, pcszFont, sizeof(szFont)); 2889 2932 2890 return (WinSetPresParam(hwnd,2891 2892 2893 szFont));2933 return WinSetPresParam(hwnd, 2934 PP_FONTNAMESIZE, 2935 strlen(szFont)+1, 2936 szFont); 2894 2937 } 2895 2938 … … 2928 2971 else 2929 2972 strhncpy0(szFont, pcszFont, sizeof(szFont)); 2930 cbFont = strlen(szFont)+1; 2973 2974 cbFont = strlen(szFont) + 1; 2931 2975 2932 2976 // set font for all the dialog controls … … 2946 2990 } 2947 2991 WinEndEnumWindows(henum); 2948 return (ulrc); 2992 2993 return ulrc; 2949 2994 } 2950 2995 … … 3190 3235 LONG lColor) 3191 3236 { 3192 return (WinSetPresParam(hwnd,3193 3194 3195 &lColor));3237 return WinSetPresParam(hwnd, 3238 ulIndex, 3239 sizeof(LONG), 3240 &lColor); 3196 3241 } 3197 3242 … … 3277 3322 } 3278 3323 3279 return (hwndHelp);3324 return hwndHelp; 3280 3325 } 3281 3326 … … 3297 3342 ULONG ulHelpPanel) // in: help panel ID 3298 3343 { 3299 return (ULONG) (WinSendMsg(hwndHelpInstance,3300 3301 3302 3303 3304 : 0)));3344 return (ULONG)WinSendMsg(hwndHelpInstance, 3345 HM_DISPLAY_HELP, 3346 (MPARAM)ulHelpPanel, 3347 (MPARAM)( (ulHelpPanel != 0) 3348 ? HM_RESOURCEID 3349 : 0)); 3305 3350 } 3306 3351 … … 3371 3416 // semapore created: this doesn't happen if the semaphore 3372 3417 // exists already, so no other instance is running 3373 return (FALSE);3418 return FALSE; 3374 3419 3375 3420 // else: instance running … … 3399 3444 } 3400 3445 3401 return (TRUE); // another instance exists3446 return TRUE; // another instance exists 3402 3447 } 3403 3448 … … 3438 3483 NULL); 3439 3484 3440 return (hswitch);3485 return hswitch; 3441 3486 } 3442 3487 … … 3481 3526 } 3482 3527 3483 return (hab);3528 return hab; 3484 3529 } 3485 3530 … … 3676 3721 strcpy(pszFile, fd.szFullFile); 3677 3722 3678 return (TRUE);3679 } 3680 3681 return (FALSE);3723 return TRUE; 3724 } 3725 3726 return FALSE; 3682 3727 } 3683 3728 … … 3700 3745 SPTR_WAIT, 3701 3746 FALSE)); // no copy 3702 return (hptr);3747 return hptr; 3703 3748 } 3704 3749 … … 3724 3769 pszText); 3725 3770 } 3726 return (pszText);3771 return pszText; 3727 3772 } 3728 3773 … … 3749 3794 va_end(args); 3750 3795 3751 return (WinSetWindowText(hwnd,3752 szBuf));3796 return WinSetWindowText(hwnd, 3797 szBuf); 3753 3798 } 3754 3799 … … 3841 3886 } 3842 3887 WinEndEnumWindows(henum1); 3843 return (ulCount); 3888 3889 return ulCount; 3844 3890 } 3845 3891 … … 3972 4018 } 3973 4019 } 3974 return (hwndFrame); 4020 4021 return hwndFrame; 3975 4022 } 3976 4023 … … 3992 4039 PVOID pvCreateParam) // in: create param 3993 4040 { 3994 return (WinCreateWindow(HWND_OBJECT,3995 3996 3997 3998 3999 4000 4001 4002 4003 NULL));4041 return WinCreateWindow(HWND_OBJECT, 4042 (PSZ)pcszWindowClass, 4043 (PSZ)"", 4044 0, 4045 0,0,0,0, 4046 0, 4047 HWND_BOTTOM, 4048 0, 4049 pvCreateParam, 4050 NULL); 4004 4051 } 4005 4052 … … 4096 4143 WinEndEnumWindows(henum); 4097 4144 4098 return (rc);4145 return rc; 4099 4146 } 4100 4147 … … 4220 4267 background.rgb.bRed = (CHAR3FROMMP(lDesktopColor)); 4221 4268 4222 return (WinCreateWindow(HWND_DESKTOP, // parent window4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 &background)); // presentation parms4269 return WinCreateWindow(HWND_DESKTOP, // parent window 4270 WC_FRAME, // class name 4271 "", // window text 4272 WS_VISIBLE, // window style 4273 0, 0, // position and size 4274 WinQuerySysValue(HWND_DESKTOP, SV_CXSCREEN), 4275 WinQuerySysValue(HWND_DESKTOP, SV_CYSCREEN), 4276 NULLHANDLE, // owner window 4277 hwndSibling, // sibling window 4278 1, // window id 4279 NULL, // control data 4280 &background); // presentation parms 4234 4281 } 4235 4282 … … 4452 4499 prcl->yTop = lOrigYTop; 4453 4500 4454 return (lLineCount);4501 return lLineCount; 4455 4502 } 4456 4503 … … 4487 4534 } 4488 4535 4489 return (pSwBlock);4536 return pSwBlock; 4490 4537 } 4491 4538 … … 4527 4574 { 4528 4575 SWBLOCK swblock; 4529 // HWND hwndTasklist = winhQueryTasklistWindow(); 4576 4530 4577 // the tasklist has entry #0 in the SWBLOCK 4531 4578 WinQuerySwitchList(NULLHANDLE, &swblock, sizeof(SWBLOCK)); 4532 return (swblock.aswentry[0].swctl.hwnd); 4579 4580 return swblock.aswentry[0].swctl.hwnd; 4533 4581 } 4534 4582 … … 4638 4686 } // end if Q level given 4639 4687 4640 return (ulTotalJobCount);4688 return ulTotalJobCount; 4641 4689 } 4642 4690 … … 4760 4808 4761 4809 /* 4810 *@@ winhCalcExtFrameRect: 4811 * implementation for WM_CALCFRAMERECT in fnwpSubclExtFrame. 4812 * This is exported so it can be used independently 4813 * (XWorkplace status bars). 4814 * 4815 *@@added V0.9.21 (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 client 4825 // mp2 == FALSE: Client area rectangle provided, calculate frame 4826 if (mp2) 4827 { 4828 // TRUE: calculate the rectl of the client; 4829 // call default window procedure to subtract child frame 4830 // controls from the rectangle's height 4831 LONG lClientHeight; 4832 4833 // position the static text frame extension below the client 4834 lClientHeight = prclPassed->yTop - prclPassed->yBottom; 4835 if (lStatusBarHeight > lClientHeight) 4836 // extension is taller than client, so set client height to 0 4837 prclPassed->yTop = prclPassed->yBottom; 4838 else 4839 { 4840 // set the origin of the client and shrink it based upon the 4841 // static text control's height 4842 prclPassed->yBottom += lStatusBarHeight; 4843 prclPassed->yTop -= lStatusBarHeight; 4844 } 4845 } 4846 else 4847 { 4848 // FALSE: calculate the rectl of the frame; 4849 // call default window procedure to subtract child frame 4850 // controls from the rectangle's height; 4851 // set the origin of the frame and increase it based upon the 4852 // static text control's height 4853 prclPassed->yBottom -= lStatusBarHeight; 4854 prclPassed->yTop += lStatusBarHeight; 4855 } 4856 } 4857 4858 #define STATUS_BAR_HEIGHT 20 4859 4860 /* 4762 4861 *@@ fnwpSubclExtFrame: 4763 4862 * subclassed frame window proc. … … 4798 4897 for (ul = 0; ul < ulCount; ul++) 4799 4898 { 4800 if (WinQueryWindowUShort( swpArr[ul].hwnd, QWS_ID ) == 0x8008)4899 if (WinQueryWindowUShort(swpArr[ul].hwnd, QWS_ID) == 0x8008) 4801 4900 // FID_CLIENT 4802 4901 { 4803 4902 POINTL ptlBorderSizes; 4804 ULONG ulStatusBarHeight = 20;4805 4903 WinSendMsg(hwndFrame, 4806 4904 WM_QUERYBORDERSIZE, … … 4817 4915 swpArr[ulCount].y = ptlBorderSizes.y; 4818 4916 swpArr[ulCount].cx = swpArr[ul].cx; // same as cnr's width 4819 swpArr[ulCount].cy = ulStatusBarHeight;4917 swpArr[ulCount].cy = STATUS_BAR_HEIGHT; 4820 4918 swpArr[ulCount].hwndInsertBehind = HWND_BOTTOM; // HWND_TOP; 4821 4919 swpArr[ulCount].hwnd = WinWindowFromID(hwndFrame, FID_STATUSBAR); … … 4835 4933 4836 4934 case WM_CALCFRAMERECT: 4837 {4838 4935 mrc = pData->pfnwpOrig(hwndFrame, msg, mp1, mp2); 4839 4936 4840 4937 // we have a status bar: calculate its rectangle 4841 // CalcFrameRect(mp1, mp2); 4842 } 4938 winhCalcExtFrameRect(mp1, 4939 mp2, 4940 STATUS_BAR_HEIGHT); 4843 4941 break; 4844 4942 … … 4876 4974 HWND hwndReturn = NULLHANDLE; 4877 4975 PPRESPARAMS ppp = NULL; 4878 winhStorePresParam(&ppp, PP_FONTNAMESIZE, strlen(pcszFont)+1, (PVOID)pcszFont); 4879 lColor = WinQuerySysColor(HWND_DESKTOP, SYSCLR_DIALOGBACKGROUND, 0); 4880 winhStorePresParam(&ppp, PP_BACKGROUNDCOLOR, sizeof(lColor), &lColor); 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 4881 4990 lColor = CLR_BLACK; 4882 winhStorePresParam(&ppp, PP_FOREGROUNDCOLOR, sizeof(lColor), &lColor); 4991 winhStorePresParam(&ppp, 4992 PP_FOREGROUNDCOLOR, 4993 sizeof(lColor), 4994 &lColor); 4995 4883 4996 hwndReturn = WinCreateWindow(hwndFrame, 4884 4997 WC_STATIC, … … 4892 5005 ppp); 4893 5006 free(ppp); 4894 return (hwndReturn); 5007 5008 return hwndReturn; 4895 5009 } 4896 5010 … … 4958 5072 } 4959 5073 4960 return (hwndFrame);5074 return hwndFrame; 4961 5075 } 4962 5076 … … 5051 5165 } // end while (pocThis) 5052 5166 5053 return (pbReturn);5167 return pbReturn; 5054 5168 } 5055 5169 … … 5215 5329 ulrc = 4; 5216 5330 5217 return (ulrc);5218 } 5331 return ulrc; 5332 }
Note:
See TracChangeset
for help on using the changeset viewer.