Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

inctlpan.c File Reference

#include "precomp.h"

Go to the source code of this file.

Defines

#define DIVISOR   72
#define DU_BTNWIDTH   50

Functions

__inline int MetricGetID (PUNICODE_STRING pProfileUserName, UINT idStr, int defValue)
UINT xxxMB_FindLongestString (HDC hdc)
int GetFrameControlMetrics (UINT obi, int cxMax)
int PackFrameControls (int cxMax, BOOL fRecord)
void DrawCaptionButtons (int x, int y)
HBITMAP CreateCaptionStrip (VOID)
BOOL CreateBitmapStrip (VOID)
void SetNCMetrics (LPNONCLIENTMETRICS lpnc)
HFONT CreateFontFromWinIni (PUNICODE_STRING pProfileUserName, LPLOGFONTW lplf, UINT idFont)
BOOL UserSetFont (PUNICODE_STRING pProfileUserName, LPLOGFONTW lplf, UINT idFont, HFONT *phfont)
BOOL xxxSetNCFonts (PUNICODE_STRING pProfileUserName, LPNONCLIENTMETRICS lpnc)
BOOL SetIconFonts (PUNICODE_STRING pProfileUserName, LPICONMETRICS lpicon)
VOID GetWindowNCMetrics (LPNONCLIENTMETRICS lpnc)
BOOL xxxSetWindowNCMetrics (PUNICODE_STRING pProfileUserName, LPNONCLIENTMETRICS lpnc, BOOL fSizeChange, int clNewBorder)
VOID SetMinMetrics (PUNICODE_STRING pProfileUserName, LPMINIMIZEDMETRICS lpmin)
BOOL SetIconMetrics (PUNICODE_STRING pProfileUserName, LPICONMETRICS lpicon)

Variables

CONST WORD sysBmpStyles [OBI_COUNT][2]
int cy [5]


Define Documentation

#define DIVISOR   72
 

Definition at line 130 of file inctlpan.c.

#define DU_BTNWIDTH   50
 

Definition at line 131 of file inctlpan.c.

Referenced by xxxSetNCFonts().


Function Documentation

BOOL CreateBitmapStrip VOID   ) 
 

Definition at line 494 of file inctlpan.c.

References BOOL, CCACHEDCAPTIONS, CreateCaptionStrip(), tagOEMBITMAPINFO::cx, cy, tagOEMBITMAPINFO::cy, DrawCaptionButtons(), DrawFrameControl(), FALSE, FillRect(), gcachedCaptions, GetFrameControlMetrics(), ghbmBits, ghbmCaption, gpDispInfo, gpsi, HDCBITS, tagDISPLAYINFO::hdcScreen, min, NULL, OBI_COUNT, OBI_MENUCHECK, PackFrameControls(), tagCAPTIONCACHE::pOem, tagCAPTIONCACHE::spcursor, sysBmpStyles, SYSHBR, SYSMET, szOneChar, TestALPHA, TRUE, UINT, Unlock, tagOEMBITMAPINFO::x, and tagOEMBITMAPINFO::y.

Referenced by xxxResetDisplayDevice(), xxxSetWindowNCMetrics(), and xxxSystemParametersInfo().

00495 { 00496 int cxBmp = 0; 00497 int cyBmp = 0; 00498 int iCache = 0; 00499 HBITMAP hOldBitmap; 00500 HBITMAP hNewBmp; 00501 UINT iType; 00502 RECT rc; 00503 UINT wBmpType; 00504 UINT wBmpStyle; 00505 POEMBITMAPINFO pOem; 00506 00507 /* 00508 * Each OBI_ must have an entry in sysBmpStyles 00509 */ 00510 UserAssert(OBI_COUNT == sizeof(sysBmpStyles) / sizeof(*sysBmpStyles)); 00511 UserAssert(OBI_COUNT == sizeof(gpsi->oembmi) / sizeof(*(gpsi->oembmi))); 00512 00513 /* 00514 * load all the bitmap dimensions into the OEMBITMAPINFO array oemInfo.bm 00515 */ 00516 for (iType = 0; iType < OBI_COUNT; iType++) 00517 cxBmp = GetFrameControlMetrics(iType, cxBmp); 00518 00519 for (iType = 0; iType < 5; iType++) 00520 cy[iType] = PackFrameControls(cxBmp * (iType + 1), FALSE) * (iType + 1); 00521 00522 cyBmp = min(cy[0], min(cy[1], min(cy[2], min(cy[3], cy[4])))); 00523 for (iType = 0; cyBmp != cy[iType]; iType++); 00524 00525 cxBmp *= iType + 1; 00526 cyBmp = PackFrameControls(cxBmp, TRUE); 00527 00528 hNewBmp = GreCreateCompatibleBitmap(gpDispInfo->hdcScreen, cxBmp, cyBmp); 00529 00530 if (hNewBmp == NULL) { 00531 RIPMSG0(RIP_WARNING, "CreateBitmapStrip: failed to create bitmap"); 00532 return FALSE; 00533 } 00534 00535 GreSetBitmapOwner(hNewBmp, OBJECT_OWNER_PUBLIC); 00536 00537 /* 00538 * Select in Bitmap Strip -- then delete old one if it exists 00539 * Yanked for Chicago since these can now be paged 00540 * GDIMoveBitmap(hNewBmp); 00541 */ 00542 hOldBitmap = GreSelectBitmap(HDCBITS(), hNewBmp); 00543 00544 if (ghbmBits) { 00545 #if DBG 00546 /* 00547 * Don't assert if we're out of memory 00548 */ 00549 if (hOldBitmap != NULL) { 00550 UserAssert(ghbmBits == hOldBitmap); 00551 } 00552 #endif 00553 GreDeleteObject(ghbmCaption); 00554 GreDeleteObject(hOldBitmap); 00555 } else { 00556 /* 00557 * hack to clear out display driver's font cache 00558 */ 00559 GreExtTextOutW(HDCBITS(), 0, 0, 0, NULL, (PWSTR)szOneChar, 1, NULL); 00560 } 00561 00562 ghbmBits = hNewBmp; 00563 00564 ghbmCaption = CreateCaptionStrip(); 00565 00566 if (ghbmCaption == NULL) { 00567 RIPMSG0(RIP_WARNING, "CreateBitmapStrip: failed to create bitmap for caption"); 00568 return FALSE; 00569 } 00570 00571 /* 00572 * draw individual bitmaps into the strip bitmap and record the offsets 00573 */ 00574 for (pOem = gpsi->oembmi, iType = 0; iType < OBI_COUNT; iType++, pOem++) { 00575 if (!pOem->cx) { 00576 *pOem = gpsi->oembmi[pOem->cy]; 00577 } else { 00578 rc.left = pOem->x; 00579 rc.top = pOem->y; 00580 rc.right = rc.left + pOem->cx; 00581 rc.bottom = rc.top + pOem->cy; 00582 00583 wBmpType = sysBmpStyles[iType][0]; 00584 wBmpStyle = sysBmpStyles[iType][1]; 00585 00586 if (wBmpType == DFC_CACHE) { 00587 if (wBmpStyle & DFCS_CACHEBUTTONS) { 00588 HBRUSH hbr; 00589 if (TestALPHA(GRADIENTCAPTIONS)) { 00590 hbr = (wBmpStyle & DFCS_INACTIVE) ? SYSHBR(GRADIENTINACTIVECAPTION) : SYSHBR(GRADIENTACTIVECAPTION); 00591 } else { 00592 hbr = (wBmpStyle & DFCS_INACTIVE) ? SYSHBR(INACTIVECAPTION) : SYSHBR(ACTIVECAPTION); 00593 } 00594 FillRect(HDCBITS(), &rc, hbr); 00595 DrawCaptionButtons(rc.left, rc.top); 00596 } else if (!(wBmpStyle & DFCS_INACTIVE)) { 00597 /* 00598 * Setup Caption Cache Entry 00599 */ 00600 UserAssert(iCache < CCACHEDCAPTIONS); 00601 if (gcachedCaptions[iCache].spcursor) { 00602 Unlock(&(gcachedCaptions[iCache].spcursor)); 00603 } 00604 gcachedCaptions[iCache++].pOem = pOem; 00605 } 00606 } else { 00607 DrawFrameControl(HDCBITS(), &rc, wBmpType, wBmpStyle); 00608 } 00609 } 00610 } 00611 00612 /* 00613 * Setup other frame metric dependent values. 00614 */ 00615 SYSMET(CXMENUCHECK) = gpsi->oembmi[OBI_MENUCHECK].cx; 00616 SYSMET(CYMENUCHECK) = gpsi->oembmi[OBI_MENUCHECK].cy; 00617 00618 return TRUE; 00619 }

HBITMAP CreateCaptionStrip VOID   ) 
 

Definition at line 466 of file inctlpan.c.

References gpDispInfo, tagDISPLAYINFO::hdcScreen, and SYSMET.

00467 { 00468 HBITMAP hbm; 00469 00470 hbm = GreCreateCompatibleBitmap(gpDispInfo->hdcScreen, 00471 SYSMET(CXVIRTUALSCREEN), 00472 (SYSMET(CYCAPTION) - 1) * 2); 00473 00474 if (hbm) 00475 GreSetBitmapOwner(hbm, OBJECT_OWNER_PUBLIC); 00476 00477 return hbm; 00478 }

HFONT CreateFontFromWinIni PUNICODE_STRING  pProfileUserName,
LPLOGFONTW  lplf,
UINT  idFont
 

Definition at line 719 of file inctlpan.c.

References FastGetProfileValue(), ghFontSys, gpsi, gSystemCPCharSet, lf, MultDiv, NULL, and PMAP_METRICS.

00723 { 00724 LOGFONTW lf; 00725 HFONT hFont; 00726 00727 if (lplf == NULL) { 00728 static CONST WCHAR szDefFont[] = TEXT("MS Shell Dlg"); 00729 /* 00730 * Fill logfont w/ 0 so we can check if values were filled in. 00731 */ 00732 lplf = &lf; 00733 RtlZeroMemory(&lf, sizeof(lf)); 00734 lf.lfCharSet = gSystemCPCharSet; 00735 00736 FastGetProfileValue(pProfileUserName,PMAP_METRICS, (LPWSTR)UIntToPtr( idFont ), NULL, (LPBYTE)&lf, sizeof(lf)); 00737 00738 /* 00739 * Default font is MS Shell Dlg 00740 */ 00741 if (! lf.lfFaceName[0]) { 00742 RtlCopyMemory(lf.lfFaceName, szDefFont, sizeof(szDefFont)); 00743 } 00744 00745 /* 00746 * Warning! these values are different then Win 95. They did not have a True Type 00747 * font so they would round up when they asked for a 6 pt font. We have to ask 00748 * for an 8 point font ICONFONT to be the same. 00749 */ 00750 if (!lf.lfHeight) { 00751 switch (idFont) { 00752 case STR_SMCAPTIONFONT: 00753 case STR_MINFONT: 00754 case STR_ICONFONT: 00755 default: 00756 lf.lfHeight = 8; 00757 break; 00758 } 00759 } 00760 00761 /* 00762 * We need to convert the point size properly. GDI expects a 00763 * height in pixels, not points. 00764 */ 00765 if (lf.lfHeight > 0) { 00766 lf.lfHeight = -MultDiv(lf.lfHeight, gpsi->dmLogPixels, 72); 00767 } 00768 00769 if (! lf.lfWeight) { 00770 switch (idFont) { 00771 case STR_CAPTIONFONT: 00772 case STR_MINFONT: 00773 lf.lfWeight = FW_BOLD; 00774 break; 00775 00776 default: 00777 lf.lfWeight = FW_NORMAL; 00778 break; 00779 } 00780 } 00781 00782 lf.lfOutPrecision = OUT_DEFAULT_PRECIS; 00783 lf.lfClipPrecision = CLIP_DEFAULT_PRECIS; 00784 lf.lfQuality = DEFAULT_QUALITY; 00785 } 00786 00787 00788 hFont = GreCreateFontIndirectW(lplf); 00789 00790 if (hFont) { 00791 LOGFONTW lfT; 00792 00793 GreExtGetObjectW(hFont, sizeof(LOGFONTW), &lfT); 00794 if (lfT.lfHeight != lplf->lfHeight) { 00795 /* 00796 * Couldn't find a font with the height that we 00797 * wanted so use the system font instead. 00798 */ 00799 GreDeleteObject(hFont); 00800 hFont = NULL; 00801 } else { 00802 GreMarkUndeletableFont(hFont); 00803 GreSetLFONTOwner((HLFONT)hFont, OBJECT_OWNER_PUBLIC); 00804 } 00805 } 00806 00807 if (!hFont) { 00808 /* 00809 * We've tried to create the font from the app-supplied description. 00810 * If failure, return NULL so that we don't change the previous 00811 * font. 00812 */ 00813 if (lplf) 00814 hFont = NULL; 00815 else 00816 hFont = ghFontSys; 00817 } 00818 00819 return hFont; 00820 }

void DrawCaptionButtons int  x,
int  y
 

Definition at line 444 of file inctlpan.c.

References BitBltSysBmp(), HDCBITS, OBI_CLOSE, OBI_HELP, OBI_REDUCE, OBI_ZOOM, and SYSMET.

Referenced by CreateBitmapStrip().

00448 { 00449 x += SYSMET(CXEDGE); 00450 y += SYSMET(CYEDGE); 00451 00452 BitBltSysBmp(HDCBITS(), x, y, OBI_REDUCE); 00453 x += SYSMET(CXSIZE) - SYSMET(CXEDGE); 00454 BitBltSysBmp(HDCBITS(), x, y, OBI_ZOOM); 00455 x += SYSMET(CXSIZE); 00456 BitBltSysBmp(HDCBITS(), x, y, OBI_CLOSE); 00457 x += SYSMET(CXSIZE); 00458 BitBltSysBmp(HDCBITS(), x, y, OBI_HELP); 00459 }

int GetFrameControlMetrics UINT  obi,
int  cxMax
 

Definition at line 315 of file inctlpan.c.

References tagOEMBITMAPINFO::cx, tagOEMBITMAPINFO::cy, cy, DOBI_3STATE, DOBI_MBAR, gcyMenuFontChar, gcyMenuFontExternLeading, gcyMenuScrollArrow, gpsi, sysBmpStyles, SYSMET, and UINT.

Referenced by CreateBitmapStrip().

00318 { 00319 int cx, cy; 00320 UINT wType = sysBmpStyles[obi][0]; 00321 UINT wState = sysBmpStyles[obi][1]; 00322 POEMBITMAPINFO pOem = gpsi->oembmi + obi; 00323 00324 switch (wType) { 00325 case DFC_SCROLL: 00326 if (wState & DFCS_SCROLLSIZEGRIP) { 00327 cx = SYSMET(CXVSCROLL); 00328 cy = SYSMET(CYHSCROLL); 00329 break; 00330 } else if (wState & DFCS_SCROLLHORZ) { 00331 cx = SYSMET(CXHSCROLL); 00332 cy = SYSMET(CYHSCROLL); 00333 } else { 00334 cx = SYSMET(CXVSCROLL); 00335 cy = SYSMET(CYVSCROLL); 00336 } 00337 break; 00338 00339 case DFC_MENU: 00340 case DFC_POPUPMENU: 00341 if (wState & (DFCS_MENUARROWUP | DFCS_MENUARROWDOWN)) { 00342 cy = gcyMenuScrollArrow; 00343 } else { 00344 /* 00345 * Add on proper space for space above underscore. 00346 * the 0xFFFE and -1 are to insure an ODD height 00347 */ 00348 cy = ((gcyMenuFontChar + gcyMenuFontExternLeading + SYSMET(CYBORDER)) & 0xFFFE) - 1; 00349 } 00350 cx = cy; 00351 break; 00352 00353 case DFC_CAPTION: 00354 if (wState & DFCS_INSMALL) { 00355 cx = SYSMET(CXSMSIZE); 00356 cy = SYSMET(CYSMSIZE); 00357 } else if (wState & DFCS_INMENU) { 00358 if ((SYSMET(CXSIZE) == SYSMET(CXMENUSIZE)) && 00359 (SYSMET(CYSIZE) == SYSMET(CYMENUSIZE))) { 00360 cx = 0; 00361 cy = obi - DOBI_MBAR; 00362 break; 00363 } else { 00364 cx = SYSMET(CXMENUSIZE); 00365 cy = SYSMET(CYMENUSIZE); 00366 } 00367 } else { 00368 cx = SYSMET(CXSIZE); 00369 cy = SYSMET(CYSIZE); 00370 } 00371 00372 cx -= SYSMET(CXEDGE); 00373 cy -= 2 * SYSMET(CYEDGE); 00374 break; 00375 00376 case DFC_CACHE: 00377 if (wState & DFCS_CACHEBUTTONS) { 00378 cx = SYSMET(CXSIZE) * 4; 00379 cy = SYSMET(CYSIZE); 00380 } else 00381 cx = cy = SYSMET(CYSIZE); 00382 break; 00383 00384 case DFC_BUTTON: 00385 if (((wState & 0x00FF) & DFCS_BUTTON3STATE) && !(wState & DFCS_CHECKED)) { 00386 cx = 0; 00387 cy = obi - DOBI_3STATE; 00388 } else { 00389 cx = 13; 00390 cy = 13; 00391 } 00392 break; 00393 } 00394 00395 pOem->cx = cx; 00396 pOem->cy = cy; 00397 00398 return((cx > cxMax) ? cx : cxMax); 00399 }

VOID GetWindowNCMetrics LPNONCLIENTMETRICS  lpnc  ) 
 

Definition at line 1030 of file inctlpan.c.

References ghMenuFont, ghSmCaptionFont, ghStatusFont, gpsi, SYSMET, and VOID().

Referenced by xxxSystemParametersInfo().

01032 { 01033 lpnc->cbSize = sizeof(NONCLIENTMETRICS); 01034 lpnc->iBorderWidth = gpsi->gclBorder; 01035 lpnc->iScrollWidth = SYSMET(CXVSCROLL); 01036 lpnc->iScrollHeight = SYSMET(CYVSCROLL); 01037 lpnc->iCaptionWidth = SYSMET(CXSIZE); 01038 lpnc->iCaptionHeight = SYSMET(CYSIZE); 01039 lpnc->iSmCaptionWidth = SYSMET(CXSMSIZE); 01040 lpnc->iSmCaptionHeight = SYSMET(CYSMSIZE); 01041 lpnc->iMenuWidth = SYSMET(CXMENUSIZE); 01042 lpnc->iMenuHeight = SYSMET(CYMENUSIZE); 01043 01044 /* 01045 * Get the font info. 01046 */ 01047 GreExtGetObjectW(gpsi->hCaptionFont, 01048 sizeof(LOGFONTW), 01049 &(lpnc->lfCaptionFont)); 01050 01051 GreExtGetObjectW(ghSmCaptionFont, 01052 sizeof(LOGFONTW), 01053 &(lpnc->lfSmCaptionFont)); 01054 01055 GreExtGetObjectW(ghMenuFont, 01056 sizeof(LOGFONTW), 01057 &(lpnc->lfMenuFont)); 01058 01059 GreExtGetObjectW(ghStatusFont, 01060 sizeof(LOGFONTW), 01061 &(lpnc->lfStatusFont)); 01062 01063 GreExtGetObjectW(gpsi->hMsgFont, 01064 sizeof(LOGFONTW), 01065 &(lpnc->lfMessageFont)); 01066 }

__inline int MetricGetID PUNICODE_STRING  pProfileUserName,
UINT  idStr,
int  defValue
 

Definition at line 23 of file inctlpan.c.

References FastGetProfileIntFromID(), and PMAP_METRICS.

Referenced by SetIconMetrics(), SetMinMetrics(), and xxxSetWindowNCMetrics().

00028 { 00029 return FastGetProfileIntFromID( 00030 pProfileUserName, PMAP_METRICS, idStr, defValue); 00031 }

int PackFrameControls int  cxMax,
BOOL  fRecord
 

Definition at line 411 of file inctlpan.c.

References tagOEMBITMAPINFO::cx, tagOEMBITMAPINFO::cy, cy, gpsi, OBI_COUNT, UINT, tagOEMBITMAPINFO::x, and tagOEMBITMAPINFO::y.

Referenced by CreateBitmapStrip().

00411 { 00412 UINT obi; 00413 int cy = 0; 00414 int x = 0; 00415 int y = 0; 00416 00417 00418 POEMBITMAPINFO pOem = gpsi->oembmi; 00419 00420 for (obi = 0; obi < OBI_COUNT; obi++, pOem++) { 00421 if (pOem->cx) { 00422 if ((x + pOem->cx) > cxMax) { 00423 y += cy; 00424 cy = 0; 00425 x = 0; 00426 } 00427 00428 if (fRecord) { 00429 pOem->x = x; 00430 pOem->y = y; 00431 } 00432 00433 if (cy < pOem->cy) 00434 cy = pOem->cy; 00435 00436 x += pOem->cx; 00437 } 00438 } 00439 00440 return(y + cy); 00441 }

BOOL SetIconFonts PUNICODE_STRING  pProfileUserName,
LPICONMETRICS  lpicon
 

Definition at line 1007 of file inctlpan.c.

References ghIconFont, lf, and UserSetFont().

Referenced by SetIconMetrics().

01010 { 01011 LOGFONTW lf; 01012 LPLOGFONTW lplf = 0; 01013 01014 if (lpicon) { 01015 lplf = &lf; 01016 lf = lpicon->lfFont; 01017 } 01018 01019 return UserSetFont(pProfileUserName, lplf, STR_ICONFONT, &ghIconFont); 01020 }

BOOL SetIconMetrics PUNICODE_STRING  pProfileUserName,
LPICONMETRICS  lpicon
 

Definition at line 1213 of file inctlpan.c.

References BOOL, FALSE, HDCBITS, max, MetricGetID(), PUDF_ICONTITLEWRAP, SET_OR_CLEAR_PUDF, SetIconFonts(), SYSMET, and TRUE.

Referenced by SPISetIconMetrics(), xxxInitWindowStation(), and xxxUpdatePerUserSystemParameters().

01216 { 01217 ICONMETRICS icon; 01218 01219 if (!SetIconFonts(pProfileUserName,lpicon)) { 01220 RIPMSG0(RIP_WARNING, "SetIconMetrics failed in SetIconFonts"); 01221 return FALSE; 01222 } 01223 01224 if (!lpicon) { 01225 01226 icon.iTitleWrap = MetricGetID(pProfileUserName, 01227 STR_ICONTITLEWRAP, TRUE); 01228 01229 icon.iHorzSpacing = MetricGetID(pProfileUserName, 01230 STR_ICONHORZSPACING, 01231 (GreGetDeviceCaps(HDCBITS(), LOGPIXELSX) * 75) / 96); 01232 01233 icon.iVertSpacing = MetricGetID(pProfileUserName, 01234 STR_ICONVERTSPACING, 01235 (GreGetDeviceCaps(HDCBITS(), LOGPIXELSY) * 75) / 96); 01236 01237 lpicon = &icon; 01238 } 01239 01240 /* 01241 * SANITY CHECK for metric values 01242 */ 01243 lpicon->iHorzSpacing = max(lpicon->iHorzSpacing, (int)SYSMET(CXICON)); 01244 lpicon->iVertSpacing = max(lpicon->iVertSpacing, (int)SYSMET(CYICON)); 01245 01246 SYSMET(CXICONSPACING) = (int) lpicon->iHorzSpacing; 01247 SYSMET(CYICONSPACING) = (int) lpicon->iVertSpacing; 01248 SET_OR_CLEAR_PUDF(PUDF_ICONTITLEWRAP, lpicon->iTitleWrap); 01249 01250 return TRUE; 01251 }

VOID SetMinMetrics PUNICODE_STRING  pProfileUserName,
LPMINIMIZEDMETRICS  lpmin
 

Definition at line 1170 of file inctlpan.c.

References max, MetricGetID(), min, SYSMET, and VOID().

Referenced by xxxInitWindowStation(), xxxSetAndDrawMinMetrics(), and xxxUpdatePerUserSystemParameters().

01173 { 01174 MINIMIZEDMETRICS min; 01175 01176 if (!lpmin) { 01177 01178 /* 01179 * Minimized 01180 */ 01181 min.iWidth = MetricGetID(pProfileUserName,STR_MINWIDTH, 154); 01182 min.iHorzGap = MetricGetID(pProfileUserName,STR_MINHORZGAP, 0); 01183 min.iVertGap = MetricGetID(pProfileUserName,STR_MINVERTGAP, 0); 01184 min.iArrange = MetricGetID(pProfileUserName,STR_MINARRANGE, ARW_BOTTOMLEFT | ARW_RIGHT); 01185 lpmin = &min; 01186 } 01187 01188 /* 01189 * SANITY CHECK for metric values 01190 */ 01191 01192 /* 01193 * Minimized window -- Text area must be >= 0, as must gap between 01194 * windows horizontally and vertically. 01195 */ 01196 lpmin->iWidth = max(lpmin->iWidth, 0); 01197 lpmin->iHorzGap = max(lpmin->iHorzGap, 0); 01198 lpmin->iVertGap = max(lpmin->iVertGap, 0); 01199 lpmin->iArrange &= ARW_VALID; 01200 01201 /* 01202 * Minimized size 01203 */ 01204 SYSMET(CXMINIMIZED) = 2*SYSMET(CXFIXEDFRAME) + (int) lpmin->iWidth; 01205 SYSMET(CYMINIMIZED) = 2*SYSMET(CYFIXEDFRAME) + SYSMET(CYSIZE); 01206 01207 SYSMET(CXMINSPACING) = SYSMET(CXMINIMIZED) + (int) lpmin->iHorzGap; 01208 SYSMET(CYMINSPACING) = SYSMET(CYMINIMIZED) + (int) lpmin->iVertGap; 01209 01210 SYSMET(ARRANGE) = (int) lpmin->iArrange; 01211 }

void SetNCMetrics LPNONCLIENTMETRICS  lpnc  ) 
 

Definition at line 622 of file inctlpan.c.

References BORDER_EXTRA, gcxCaptionFontChar, gpDispInfo, gpsi, tagDISPLAYINFO::hDev, min, SetDesktopMetrics(), and SYSMET.

Referenced by xxxSetWindowNCMetrics().

00625 { 00626 int nMin; 00627 00628 /* 00629 * Scroll metrics 00630 */ 00631 SYSMET(CXVSCROLL) = SYSMET(CYHSCROLL) = (int) lpnc->iScrollWidth; 00632 SYSMET(CYVSCROLL) = SYSMET(CXHSCROLL) = (int) lpnc->iScrollHeight; 00633 SYSMET(CYVTHUMB) = SYSMET(CXHTHUMB) = (int) lpnc->iScrollHeight; 00634 00635 /* 00636 * Caption metrics 00637 */ 00638 SYSMET(CXSIZE) = (int) lpnc->iCaptionWidth; 00639 SYSMET(CYSIZE) = (int) lpnc->iCaptionHeight; 00640 SYSMET(CYCAPTION) = SYSMET(CYSIZE) + SYSMET(CYBORDER); 00641 00642 /* 00643 * Keep small icon square? 00644 * ?? Should we allow rectangles? 00645 */ 00646 SYSMET(CXSMICON) = (SYSMET(CXSIZE) - SYSMET(CXEDGE)) & ~1; 00647 SYSMET(CYSMICON) = (SYSMET(CYSIZE) - SYSMET(CYEDGE)) & ~1; 00648 nMin = min(SYSMET(CXSMICON), SYSMET(CYSMICON)); 00649 SYSMET(CXSMICON) = nMin; 00650 SYSMET(CYSMICON) = nMin; 00651 00652 /* 00653 * Small Caption metrics 00654 */ 00655 SYSMET(CXSMSIZE) = (int) lpnc->iSmCaptionWidth; 00656 SYSMET(CYSMSIZE) = (int) lpnc->iSmCaptionHeight; 00657 SYSMET(CYSMCAPTION) = SYSMET(CYSMSIZE) + SYSMET(CYBORDER); 00658 00659 /* 00660 * Menu metrics 00661 */ 00662 SYSMET(CXMENUSIZE) = (int) lpnc->iMenuWidth; 00663 SYSMET(CYMENUSIZE) = (int) lpnc->iMenuHeight; 00664 SYSMET(CYMENU) = SYSMET(CYMENUSIZE) + SYSMET(CYBORDER); 00665 00666 /* 00667 * Border metrics 00668 */ 00669 gpsi->gclBorder = (int) lpnc->iBorderWidth; 00670 00671 SYSMET(CXFRAME) = SYSMET(CXEDGE) + (gpsi->gclBorder+1)*SYSMET(CXBORDER); 00672 SYSMET(CYFRAME) = SYSMET(CYEDGE) + (gpsi->gclBorder+1)*SYSMET(CYBORDER); 00673 00674 /* 00675 * Minimium tracking size is 00676 * Across: Space for small icon, 4 chars & space + 3 buttons + borders 00677 * Down: Space for caption + borders 00678 * Yes, we use CYSIZE. This is because the width of any small icon 00679 * is the same as the height, and the height is CYSIZE. 00680 */ 00681 SYSMET(CXMINTRACK) = SYSMET(CYSIZE) + (gcxCaptionFontChar * 4) + 2 * SYSMET(CXEDGE) + 00682 (SYSMET(CXSIZE) * 3) + (SYSMET(CXSIZEFRAME) * 2); 00683 SYSMET(CYMINTRACK) = SYSMET(CYCAPTION) + (SYSMET(CYSIZEFRAME) * 2); 00684 00685 /* 00686 * Max track size 00687 * Yeah, max track is bigger than maximized. The reason why is the DOS 00688 * box. It has a normal sizing border plus the sunken edge around the 00689 * client. We need to make this big enough to allow the dos box to grow. 00690 * When it hits its max size, it maximizes automatically. 00691 */ 00692 SYSMET(CXMAXTRACK) = SYSMET(CXVIRTUALSCREEN) + (2 * (SYSMET(CXSIZEFRAME) + SYSMET(CXEDGE))); 00693 SYSMET(CYMAXTRACK) = SYSMET(CYVIRTUALSCREEN) + (2 * (SYSMET(CYSIZEFRAME) + SYSMET(CYEDGE))); 00694 00695 SYSMET(CXMIN) = SYSMET(CXMINTRACK); 00696 SYSMET(CYMIN) = SYSMET(CYMINTRACK); 00697 00698 SYSMET(CYMINIMIZED) = 2*SYSMET(CYFIXEDFRAME) + SYSMET(CYSIZE); 00699 00700 /* 00701 * Desktop stuff--working area 00702 */ 00703 bSetDevDragWidth(gpDispInfo->hDev, 00704 gpsi->gclBorder + BORDER_EXTRA); 00705 00706 SetDesktopMetrics(); 00707 }

BOOL UserSetFont PUNICODE_STRING  pProfileUserName,
LPLOGFONTW  lplf,
UINT  idFont,
HFONT *  phfont
 

Definition at line 827 of file inctlpan.c.

References BOOL, CreateFontFromWinIni(), FALSE, ghFontSys, NULL, and TRUE.

Referenced by SetIconFonts(), and xxxSetNCFonts().

00832 { 00833 HFONT hNewFont; 00834 00835 if (hNewFont = CreateFontFromWinIni(pProfileUserName, lplf, idFont)) { 00836 if (*phfont != NULL && *phfont != ghFontSys) { 00837 GreMarkDeletableFont(*phfont); 00838 GreDeleteObject(*phfont); 00839 } 00840 00841 *phfont = hNewFont; 00842 return TRUE; 00843 } 00844 return FALSE; 00845 }

UINT xxxMB_FindLongestString HDC  hdc  ) 
 

Definition at line 1262 of file inctlpan.c.

References CALL_LPK, GETGPSIMBPSTR, MAX_SEB_STYLES, PtiCurrentShared, szOneChar, UINT, xxxClientGetTextExtentPointW(), and xxxPSMGetTextExtent().

Referenced by xxxSetNCFonts().

01263 { 01264 UINT wRetVal; 01265 int i, iMaxLen = 0, iNewMaxLen; 01266 LPWSTR pszCurStr, szMaxStr; 01267 SIZE sizeOneChar; 01268 SIZE sizeMaxStr; 01269 PTHREADINFO ptiCurrent = PtiCurrentShared(); 01270 01271 for (i = 0; i < MAX_SEB_STYLES; i++) { 01272 pszCurStr = GETGPSIMBPSTR(i); 01273 if ((iNewMaxLen = wcslen(pszCurStr)) > iMaxLen) { 01274 iMaxLen = iNewMaxLen; 01275 szMaxStr = pszCurStr; 01276 } 01277 } 01278 01279 /* 01280 * Find the longest string 01281 */ 01282 if (CALL_LPK(ptiCurrent)) { 01283 xxxClientGetTextExtentPointW(hdc, (PWSTR)szOneChar, 1, &sizeOneChar); 01284 } else { 01285 GreGetTextExtentW(hdc, (PWSTR)szOneChar, 1, &sizeOneChar, GGTE_WIN3_EXTENT); 01286 } 01287 xxxPSMGetTextExtent(hdc, szMaxStr, iMaxLen, &sizeMaxStr); 01288 wRetVal = (UINT)(sizeMaxStr.cx + (sizeOneChar.cx * 2)); 01289 01290 return wRetVal; 01291 }

BOOL xxxSetNCFonts PUNICODE_STRING  pProfileUserName,
LPNONCLIENTMETRICS  lpnc
 

Definition at line 861 of file inctlpan.c.

References BOOL, DU_BTNWIDTH, FALSE, gcxCaptionFontChar, gcxMenuFontChar, gcxMenuFontOverhang, gcxSmCaptionFontChar, gcyCaptionFontChar, gcyMenuFontAscent, gcyMenuFontChar, gcyMenuFontExternLeading, gcyMenuScrollArrow, gcySmCaptionFontChar, GetCharDimensions(), ghFontSys, ghMenuFont, ghMenuFontDef, ghSmCaptionFont, ghStatusFont, gMenuState, gpsi, HDCBITS, lf, max, NULL, SYSMET, TRUE, UINT, UserSetFont(), tagSERVERINFO::wMaxBtnSize, XPixFromXDU, and xxxMB_FindLongestString().

Referenced by xxxSetWindowNCMetrics().

00864 { 00865 HFONT hOldFont; 00866 TEXTMETRIC tm; 00867 LOGFONTW lf; 00868 LPLOGFONTW lplf = (lpnc) ? &lf : 0; 00869 00870 /* 00871 * Caption font 00872 */ 00873 if (lplf) { 00874 *lplf = lpnc->lfCaptionFont; 00875 } 00876 00877 if (!UserSetFont(pProfileUserName,lplf, STR_CAPTIONFONT, &gpsi->hCaptionFont)) { 00878 RIPMSG0(RIP_WARNING, "xxxSetNCFonts failed for gpsi->hCaptionFont"); 00879 return FALSE; 00880 } 00881 00882 hOldFont = GreSelectFont(HDCBITS(), gpsi->hCaptionFont); 00883 gcxCaptionFontChar = GetCharDimensions( 00884 HDCBITS(), NULL, &gcyCaptionFontChar); 00885 00886 /* 00887 * Small caption font 00888 */ 00889 if (lplf) { 00890 *lplf = lpnc->lfSmCaptionFont; 00891 } 00892 00893 if (!UserSetFont(pProfileUserName,lplf, STR_SMCAPTIONFONT, &ghSmCaptionFont)) { 00894 RIPMSG0(RIP_WARNING, "xxxSetNCFonts failed for ghSmCaptionFont"); 00895 return FALSE; 00896 } 00897 00898 GreSelectFont(HDCBITS(), ghSmCaptionFont); 00899 gcxSmCaptionFontChar = GetCharDimensions( 00900 HDCBITS(), NULL, &gcySmCaptionFontChar); 00901 00902 /* 00903 * Menu font 00904 */ 00905 if (lplf) { 00906 *lplf = lpnc->lfMenuFont; 00907 } 00908 00909 if (!UserSetFont(pProfileUserName,lplf, STR_MENUFONT, &ghMenuFont)) { 00910 RIPMSG0(RIP_WARNING, "xxxSetNCFonts failed for ghMenuFont"); 00911 return FALSE; 00912 } 00913 00914 /* 00915 * if ghMenuFont is selected in cached animation DC, select the new one. 00916 */ 00917 if (gMenuState.hdcAni != NULL) { 00918 GreSelectFont(gMenuState.hdcAni, ghMenuFont); 00919 } 00920 00921 GreSelectFont(HDCBITS(), ghMenuFont); 00922 gcxMenuFontChar = GetCharDimensions( 00923 HDCBITS(), &tm, &gcyMenuFontChar); 00924 gcxMenuFontOverhang = tm.tmOverhang; 00925 00926 gcyMenuFontExternLeading = tm.tmExternalLeading; 00927 gcyMenuScrollArrow = gcyMenuFontChar + gcyMenuFontExternLeading + SYSMET(CYEDGE); 00928 gcyMenuFontAscent = tm.tmAscent; 00929 00930 /* 00931 * We only use gcyMenuFontAscent in mndraw.c once, and in U.S. we 00932 * always add on CYBORDER! So calculate gcyMenuFontAscent+CYBORDER 00933 * once only. 00934 * Legacy NT4: For Korean version, don't add it on; the underline would 00935 * be too low. 00936 * NT5: according to #254327, Korean version now sees underline is 00937 * too close to menu strings. Korean hack is pulled out so. 00938 */ 00939 gcyMenuFontAscent += SYSMET(CYBORDER); 00940 00941 /* 00942 * Default menu item font: bolder version of menu font 00943 */ 00944 00945 /* 00946 * Create default menu font by bolding hMenuFont. If this doesn't 00947 * work, then fall back to using simulation. 00948 */ 00949 if (ghMenuFontDef != NULL && ghMenuFontDef != ghFontSys) { 00950 GreMarkDeletableFont(ghMenuFontDef); 00951 GreDeleteObject(ghMenuFontDef); 00952 ghMenuFontDef = NULL; 00953 } 00954 00955 GreExtGetObjectW(ghMenuFont, sizeof(LOGFONTW), &lf); 00956 if (lf.lfWeight < FW_BOLD) { 00957 lf.lfWeight += 200; 00958 00959 ghMenuFontDef = GreCreateFontIndirectW(&lf); 00960 if (ghMenuFontDef) { 00961 GreMarkUndeletableFont(ghMenuFontDef); 00962 GreSetLFONTOwner((HLFONT)ghMenuFontDef, OBJECT_OWNER_PUBLIC); 00963 } 00964 } 00965 00966 /* 00967 * Status Bar font 00968 */ 00969 if (lplf) { 00970 *lplf = lpnc->lfStatusFont; 00971 } 00972 00973 if (!UserSetFont(pProfileUserName,lplf, STR_STATUSFONT, &ghStatusFont)) { 00974 RIPMSG0(RIP_WARNING, "xxxSetNCFonts failed for ghStatusFont"); 00975 return FALSE; 00976 } 00977 00978 /* 00979 * Message Box font 00980 */ 00981 if (lplf) { 00982 *lplf = lpnc->lfMessageFont; 00983 } 00984 00985 if (!UserSetFont(pProfileUserName,lplf, STR_MESSAGEFONT, &gpsi->hMsgFont)) { 00986 RIPMSG0(RIP_WARNING, "xxxSetNCFonts failed for gpsi->hMsgFont"); 00987 return FALSE; 00988 } 00989 00990 GreSelectFont(HDCBITS(), gpsi->hMsgFont); 00991 gpsi->cxMsgFontChar = GetCharDimensions( 00992 HDCBITS(), NULL, &gpsi->cyMsgFontChar); 00993 00994 /* 00995 * Recalculate length of the widest MessageBox button 00996 * Make sure the width is no less than DU_BTNWIDTH dialog units MCostea #170582 00997 */ 00998 gpsi->wMaxBtnSize = max((UINT)XPixFromXDU(DU_BTNWIDTH, gpsi->cxMsgFontChar), 00999 xxxMB_FindLongestString(HDCBITS())); 01000 GreSelectFont(HDCBITS(), hOldFont); 01001 01002 return TRUE; 01003 }

BOOL xxxSetWindowNCMetrics PUNICODE_STRING  pProfileUserName,
LPNONCLIENTMETRICS  lpnc,
BOOL  fSizeChange,
int  clNewBorder
 

Definition at line 1080 of file inctlpan.c.

References BOOL, CreateBitmapStrip(), FALSE, gcyCaptionFontChar, gcyMenuFontChar, gcyMenuFontExternLeading, gcySmCaptionFontChar, max, MetricGetID(), min, NULL, SetNCMetrics(), SYSMET, TRUE, and xxxSetNCFonts().

Referenced by xxxInitWindowStation(), xxxSetAndDrawNCMetrics(), xxxSetSysColors(), and xxxUpdatePerUserSystemParameters().

01085 { 01086 NONCLIENTMETRICS nc; 01087 int cxEdge4; 01088 01089 if (fSizeChange) { 01090 if (!xxxSetNCFonts(pProfileUserName, lpnc)) { 01091 RIPMSG0(RIP_WARNING, "xxxSetWindowNCMetrics failed in xxxSetNCFonts"); 01092 return FALSE; 01093 } 01094 01095 if (lpnc == NULL) { 01096 if (clNewBorder < 0) 01097 nc.iBorderWidth = MetricGetID(pProfileUserName,STR_BORDERWIDTH, 1); 01098 else 01099 nc.iBorderWidth = clNewBorder; 01100 01101 nc.iScrollWidth = MetricGetID(pProfileUserName,STR_SCROLLWIDTH, 16 ); 01102 nc.iScrollHeight = MetricGetID(pProfileUserName,STR_SCROLLHEIGHT, 16 ); 01103 nc.iCaptionWidth = MetricGetID(pProfileUserName,STR_CAPTIONWIDTH, 18 ); 01104 nc.iCaptionHeight = MetricGetID(pProfileUserName,STR_CAPTIONHEIGHT, 18 ); 01105 nc.iSmCaptionWidth = MetricGetID(pProfileUserName,STR_SMCAPTIONWIDTH, 13 ); 01106 nc.iSmCaptionHeight = MetricGetID(pProfileUserName,STR_SMCAPTIONHEIGHT, 13 ); 01107 nc.iMenuWidth = MetricGetID(pProfileUserName,STR_MENUWIDTH, 18 ); 01108 nc.iMenuHeight = MetricGetID(pProfileUserName,STR_MENUHEIGHT, 18 ); 01109 01110 lpnc = &nc; 01111 } 01112 01113 /* 01114 * SANITY CHECK for metric values 01115 */ 01116 cxEdge4 = 4 * SYSMET(CXEDGE); 01117 01118 /* 01119 * Border 01120 */ 01121 lpnc->iBorderWidth = max(lpnc->iBorderWidth, 1); 01122 lpnc->iBorderWidth = min(lpnc->iBorderWidth, 50); 01123 01124 /* 01125 * Scrollbar 01126 */ 01127 lpnc->iScrollWidth = max(lpnc->iScrollWidth, cxEdge4); 01128 lpnc->iScrollHeight = max(lpnc->iScrollHeight, 4 * SYSMET(CYEDGE)); 01129 01130 /* 01131 * Caption -- Buttons must be wide enough to draw edges, and text 01132 * area must be tall enough to fit caption font with a border above 01133 * and below. If we have to reset the caption height, should we 01134 * reset the button width as well? 01135 */ 01136 lpnc->iCaptionWidth = max(lpnc->iCaptionWidth, cxEdge4); 01137 lpnc->iCaptionHeight = max(lpnc->iCaptionHeight, gcyCaptionFontChar + SYSMET(CYEDGE)); 01138 01139 /* 01140 * Small caption -- Buttons must be wide enough to draw edges, and 01141 * text area must be tall enough to fit small caption font with a 01142 * border above and below. Again, if we have to reset the height, 01143 * reset the width as well? 01144 */ 01145 lpnc->iSmCaptionWidth = max(lpnc->iSmCaptionWidth, cxEdge4); 01146 lpnc->iSmCaptionHeight = max(lpnc->iSmCaptionHeight, gcySmCaptionFontChar + SYSMET(CYEDGE)); 01147 01148 /* 01149 * Menu -- Buttons must be wide enough to draw edges, and text 01150 * area must be tall enough to fit menu font with underscore. 01151 */ 01152 lpnc->iMenuWidth = max(lpnc->iMenuWidth, cxEdge4); 01153 lpnc->iMenuHeight = max(lpnc->iMenuHeight, gcyMenuFontChar + gcyMenuFontExternLeading + SYSMET(CYEDGE)); 01154 01155 /* 01156 * SET UP SYSTEM METRIC VALUES 01157 */ 01158 SetNCMetrics(lpnc); 01159 } 01160 01161 if (!CreateBitmapStrip()) { 01162 RIPMSG0(RIP_WARNING, "CreateBitmapStrip failed"); 01163 return FALSE; 01164 } 01165 01166 return TRUE; 01167 }


Variable Documentation

int cy[5]
 

Definition at line 480 of file inctlpan.c.

Referenced by _DeferWindowPos(), _DrawIconEx(), AnimateWindow(), BltColor(), BltIcon(), BNMultiDraw(), CalcTrackDragRect(), CopyIcoCur(), CopyInflateRect(), CopyOffsetRect(), CreateBitmapStrip(), CreateCompatiblePublicDC(), CreateIcoCurIndirect(), CreateScreenBitmap(), CreateSpb(), CreateTooltipBitmap(), DIBtoBMP(), DrawBox(), DrawDiagonalLine(), DrawFrame(), DrawIconEx(), DrawIt(), DrawMenuMark(), DrawStateA(), DrawStateW(), FindBestPos(), FixBogusSWP(), GetFrameControlMetrics(), GrayStringA(), GrayStringW(), InflateRect(), InnerGrayStringAorW(), IsRectBogus(), LBPrintCallback(), MDIActivateDlgInit(), MNCreateAnimationBitmap(), MNDrawMenu3DHotTracking(), MNEraseBackground(), NtUserDeferWindowPos(), NtUserDrawIconEx(), NtUserMoveWindow(), NtUserSetWindowPos(), OffsetRect(), PackFrameControls(), ReaderWndProc(), RecreateRedirectionBitmap(), RtlLoadObjectFromDIBFile(), SaveScreen(), StaticCallback(), TestRectBogus(), TooltipAnimate(), TryRect(), xxxAnimateCaption(), xxxBNDrawText(), xxxCreateCaret(), xxxCreateWindowEx(), xxxDrawState(), xxxLBSize(), xxxMenuDraw(), xxxMenuWindowProc(), xxxMNPositionHierarchy(), xxxMoveWindow(), xxxPaintIconsInSwitchWindow(), xxxRealDrawMenuItem(), xxxSBWndProc(), xxxSetWindowPos(), xxxStaticPaint(), xxxTooltipWndProc(), zzzChangeStates(), and zzzDrawInvertScrollArea().

CONST WORD sysBmpStyles[OBI_COUNT][2] [static]
 

Definition at line 33 of file inctlpan.c.

Referenced by CreateBitmapStrip(), and GetFrameControlMetrics().


Generated on Sat May 15 19:44:10 2004 for test by doxygen 1.3.7