ReactOS 0.4.16-dev-136-g52192f1
advappdlg.c File Reference
#include "desk.h"
Include dependency graph for advappdlg.c:

Go to the source code of this file.

Classes

struct  ASSIGNMENT
 

Functions

static VOID UpdateButtonColor (HWND hwndDlg, GLOBALS *g, INT ID, INT nButton, INT nColor)
 
static VOID InitColorButtons (HWND hwndDlg, GLOBALS *g)
 
static int CALLBACK EnumFontFamExProc (ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, DWORD dwFontType, LPARAM lParam)
 
static VOID UpdateControls (HWND hwndDlg, GLOBALS *g)
 
static VOID SaveCurrentValues (HWND hwndDlg, GLOBALS *g)
 
static BOOL GetColor (HWND hwndDlg, GLOBALS *g, INT nButton)
 
static VOID AdvAppearanceDlg_Init (HWND hwndDlg, GLOBALS *g)
 
static VOID AdvAppearanceDlg_CleanUp (HWND hwndDlg, GLOBALS *g)
 
static VOID SelectComboByElement (HWND hwnd, INT id, LPARAM lParam)
 
static VOID GetSelectedComboText (HWND hwnd, INT id, LPWSTR lpStr)
 
static INT GetSelectedComboInt (HWND hwnd, INT id)
 
INT_PTR CALLBACK AdvAppearanceDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Variables

const ASSIGNMENT g_Assignment [NUM_ELEMENTS]
 

Function Documentation

◆ AdvAppearanceDlg_CleanUp()

static VOID AdvAppearanceDlg_CleanUp ( HWND  hwndDlg,
GLOBALS g 
)
static

Definition at line 437 of file advappdlg.c.

438{
439 DeleteObject(g->hBoldFont);
440 DeleteObject(g->hItalicFont);
441}
pKey DeleteObject()
GLboolean GLboolean g
Definition: glext.h:6204

Referenced by AdvAppearanceDlgProc().

◆ AdvAppearanceDlg_Init()

static VOID AdvAppearanceDlg_Init ( HWND  hwndDlg,
GLOBALS g 
)
static

Definition at line 343 of file advappdlg.c.

344{
345 INT i, iElement, iListIndex, iDeskIndex = 0;
346 TCHAR tstrText[80];
347 LOGFONT lfFont;
348 LOGFONT lfButtonFont;
349 HFONT hMyFont;
350 HDC hScreenDC;
351 TCHAR Size[4];
352
353 /* Copy the current theme values */
354 g->SchemeAdv = g->Scheme;
355
357
358 /* Add the elements to the combo */
359 for (iElement = 0; iElement < NUM_ELEMENTS; iElement++)
360 {
361 LoadString(hApplet, IDS_ELEMENT_0 + iElement, (LPTSTR)&tstrText, 79);
362 iListIndex = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_ADDSTRING, 0, (LPARAM)&tstrText);
364 }
365
366 /* Get the list index of the desktop element */
367 for (iListIndex = 0; iListIndex < NUM_ELEMENTS; iListIndex++)
368 {
369 iElement = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_GETITEMDATA, (WPARAM)iListIndex, 0);
370 if (iElement == 0)
371 {
372 iDeskIndex = iListIndex;
373 break;
374 }
375 }
376
378
379 /* Create font for bold button */
380 lfButtonFont = g->Scheme.ncMetrics.lfMessageFont;
381 lfButtonFont.lfWeight = FW_BOLD;
382 lfButtonFont.lfItalic = FALSE;
383 hMyFont = CreateFontIndirect(&lfButtonFont);
384 if (hMyFont)
385 {
386 if (g->hBoldFont)
387 DeleteObject(g->hBoldFont);
388
389 g->hBoldFont = hMyFont;
390 }
391
392 /* Create font for italic button */
393 lfButtonFont.lfWeight = FW_REGULAR;
394 lfButtonFont.lfItalic = TRUE;
395 hMyFont = CreateFontIndirect(&lfButtonFont);
396 if (hMyFont)
397 {
398 if (g->hItalicFont)
399 DeleteObject(g->hItalicFont);
400
401 g->hItalicFont = hMyFont;
402 }
403
404 /* Set the fonts for the font style buttons */
407
408 /* Draw Bitmaps for the colorbuttons */
409 InitColorButtons(hwndDlg, g);
410
411 /* Make the UpDown control count correctly */
413
414 /* Fill font selection combo */
415 lfFont.lfCharSet = DEFAULT_CHARSET;
416 lfFont.lfFaceName[0] = (TCHAR)0;
417 lfFont.lfPitchAndFamily = 0;
418 hScreenDC = GetDC(0);
420 ReleaseDC(0, hScreenDC);
421
422 /* Fill font size combo */
423 for (i = 6; i <= 24; i++)
424 {
425 StringCbPrintf(Size, sizeof(Size), TEXT("%d"), i);
427 }
428
429 /* Update the controls */
430 iListIndex = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_GETCURSEL, 0, 0);
431 g->CurrentElement = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_GETITEMDATA, (WPARAM)iListIndex, 0);
432 UpdateControls(hwndDlg, g);
433}
static VOID UpdateControls(HWND hwndDlg, GLOBALS *g)
Definition: advappdlg.c:206
static VOID InitColorButtons(HWND hwndDlg, GLOBALS *g)
Definition: advappdlg.c:100
static int CALLBACK EnumFontFamExProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX *lpntme, DWORD dwFontType, LPARAM lParam)
Definition: advappdlg.c:188
#define NUM_ELEMENTS(array)
Definition: cache.c:27
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
#define IDC_ADVAPPEARANCE_SIZE_UD
Definition: resource.h:122
#define IDC_ADVAPPEARANCE_FONTBOLD
Definition: resource.h:133
#define IDC_ADVAPPEARANCE_FONTSIZE_E
Definition: resource.h:130
#define IDC_ADVAPPEARANCE_FONTITALIC
Definition: resource.h:134
#define IDC_APPEARANCE_PREVIEW
Definition: resource.h:97
#define IDC_ADVAPPEARANCE_ELEMENT
Definition: resource.h:119
#define IDS_ELEMENT_0
Definition: resource.h:137
#define IDC_ADVAPPEARANCE_FONT_C
Definition: resource.h:128
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define TEXT(s)
Definition: k32.h:26
static HDC
Definition: imagelist.c:88
static DWORD *static HFONT(WINAPI *pCreateFontIndirectExA)(const ENUMLOGFONTEXDVA *)
#define L(x)
Definition: ntvdm.h:50
#define PVM_UPDATETHEME
Definition: preview.h:33
#define UDM_SETRANGE
Definition: commctrl.h:2146
#define StringCbPrintf
Definition: strsafe.h:544
BYTE lfItalic
Definition: dimm.idl:47
BYTE lfPitchAndFamily
Definition: dimm.idl:54
BYTE lfCharSet
Definition: dimm.idl:50
LONG lfWeight
Definition: dimm.idl:46
CHAR lfFaceName[LF_FACESIZE]
Definition: dimm.idl:55
int32_t INT
Definition: typedefs.h:58
#define MAKELONG(a, b)
Definition: typedefs.h:249
_Must_inspect_result_ _In_ WDFDEVICE _In_ PWDF_DEVICE_PROPERTY_DATA _In_ DEVPROPTYPE _In_ ULONG Size
Definition: wdfdevice.h:4533
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define FW_REGULAR
Definition: wingdi.h:374
FONTENUMPROCA FONTENUMPROC
Definition: wingdi.h:2902
#define FW_BOLD
Definition: wingdi.h:378
#define DEFAULT_CHARSET
Definition: wingdi.h:384
#define EnumFontFamiliesEx
Definition: wingdi.h:4451
#define CreateFontIndirect
Definition: wingdi.h:4444
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
#define CB_SETITEMDATA
Definition: winuser.h:1969
#define CB_SETCURSEL
Definition: winuser.h:1964
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define WM_SETFONT
Definition: winuser.h:1653
#define CB_ADDSTRING
Definition: winuser.h:1939
#define CB_GETITEMDATA
Definition: winuser.h:1953
#define SendMessage
Definition: winuser.h:5855
HDC WINAPI GetDC(_In_opt_ HWND)
#define LoadString
Definition: winuser.h:5831
#define CB_GETCURSEL
Definition: winuser.h:1946
#define SendDlgItemMessage
Definition: winuser.h:5854
char TCHAR
Definition: xmlstorage.h:189
CHAR * LPTSTR
Definition: xmlstorage.h:192

Referenced by AdvAppearanceDlgProc().

◆ AdvAppearanceDlgProc()

INT_PTR CALLBACK AdvAppearanceDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 503 of file advappdlg.c.

504{
505 INT iSelection, iProperty;
506 GLOBALS* g;
507 PLOGFONTW plfFont;
508
509 g = (GLOBALS*)GetWindowLongPtr(hwndDlg, DWLP_USER);
510
511 switch (uMsg)
512 {
513 case WM_INITDIALOG:
514 g = (GLOBALS*)lParam;
516 AdvAppearanceDlg_Init(hwndDlg, g);
517 break;
518
519 case WM_DESTROY:
520 AdvAppearanceDlg_CleanUp(hwndDlg, g);
521 break;
522
523 case WM_COMMAND:
524 if (g == NULL)
525 return TRUE;
526
527 switch(LOWORD(wParam))
528 {
529 case IDOK:
530 SaveCurrentValues(hwndDlg, g);
531 EndDialog(hwndDlg, IDOK);
532 break;
533
534 case IDCANCEL:
535 g->SchemeAdv = g->Scheme;
536 EndDialog(hwndDlg, IDCANCEL);
537 break;
538
540 SaveCurrentValues(hwndDlg, g);
542 g->CurrentElement = (INT)lParam;
543 UpdateControls(hwndDlg, g);
544 break;
545
548 {
549 SaveCurrentValues(hwndDlg, g);
550 iSelection = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_GETCURSEL, 0, 0);
551 g->CurrentElement = SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_ELEMENT, CB_GETITEMDATA, iSelection, 0);
552 UpdateControls(hwndDlg, g);
553 }
554 break;
555
557 if (HIWORD(wParam) == EN_CHANGE)
558 {
559 iProperty = g_Assignment[g->CurrentElement].Size;
560 if (iProperty == -1)
561 return TRUE;
562
564 SchemeSetMetric(&g->SchemeAdv, iProperty, iSelection);
565 SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_SETSIZE, iProperty, iSelection);
566
567 iProperty = g_Assignment[g->CurrentElement].Size2;
568 if (iProperty != -1)
569 SchemeSetMetric(&g->SchemeAdv, iProperty, iSelection);
570 }
571 break;
572
575 {
576 iProperty = g_Assignment[g->CurrentElement].Font;
577 if (iProperty == -1)
578 return TRUE;
579
580 plfFont = SchemeGetFont(&g->SchemeAdv, iProperty);
582 SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_SETFONT, iProperty, (LPARAM)plfFont);
583 }
584 break;
585
588 {
589 HDC hdcDlg;
590
591 iProperty = g_Assignment[g->CurrentElement].Font;
592 if (iProperty == -1)
593 return TRUE;
594
595 hdcDlg = GetDC(hwndDlg);
596
597 plfFont = SchemeGetFont(&g->SchemeAdv, iProperty);
599 plfFont->lfHeight = -MulDiv(iSelection , GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
601
602 ReleaseDC(hwndDlg, hdcDlg);
603 }
604 break;
605
607 if (HIWORD(wParam) == BN_CLICKED)
608 {
609 iProperty = g_Assignment[g->CurrentElement].Font;
610 if (iProperty == -1)
611 return TRUE;
612
613 plfFont = SchemeGetFont(&g->SchemeAdv, iProperty);
614 iSelection = (INT)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTBOLD, BM_GETCHECK, 0, 0);
615 plfFont->lfWeight = (iSelection == BST_CHECKED) ? FW_BOLD : FW_NORMAL;
616 SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_SETFONT, iProperty, (LPARAM)plfFont);
617 }
618 break;
619
621 if (HIWORD(wParam) == BN_CLICKED)
622 {
623 iProperty = g_Assignment[g->CurrentElement].Font;
624 if (iProperty == -1)
625 return TRUE;
626
627 plfFont = SchemeGetFont(&g->SchemeAdv, iProperty);
628 iSelection = (INT)SendDlgItemMessage(hwndDlg, IDC_ADVAPPEARANCE_FONTITALIC, BM_GETCHECK, 0, 0);
629 plfFont->lfItalic = (iSelection == BST_CHECKED) ? TRUE : FALSE;
630 SendDlgItemMessage(hwndDlg, IDC_APPEARANCE_PREVIEW, PVM_SETFONT, iProperty, (LPARAM)plfFont);
631 }
632 break;
633
635 GetColor(hwndDlg, g, 0);
636 break;
637
639 GetColor(hwndDlg, g, 1);
640 break;
641
643 GetColor(hwndDlg, g, 2);
644 break;
645
646 default:
647 return FALSE;
648 }
649 break;
650
651 default:
652 return FALSE;
653 }
654
655 return TRUE;
656}
static VOID SelectComboByElement(HWND hwnd, INT id, LPARAM lParam)
Definition: advappdlg.c:445
static VOID AdvAppearanceDlg_CleanUp(HWND hwndDlg, GLOBALS *g)
Definition: advappdlg.c:437
const ASSIGNMENT g_Assignment[NUM_ELEMENTS]
Definition: advappdlg.c:28
static VOID GetSelectedComboText(HWND hwnd, INT id, LPWSTR lpStr)
Definition: advappdlg.c:466
static BOOL GetColor(HWND hwndDlg, GLOBALS *g, INT nButton)
Definition: advappdlg.c:286
static INT GetSelectedComboInt(HWND hwnd, INT id)
Definition: advappdlg.c:486
static VOID SaveCurrentValues(HWND hwndDlg, GLOBALS *g)
Definition: advappdlg.c:261
static VOID AdvAppearanceDlg_Init(HWND hwndDlg, GLOBALS *g)
Definition: advappdlg.c:343
PLOGFONTW SchemeGetFont(COLOR_SCHEME *scheme, int id)
VOID SchemeSetMetric(COLOR_SCHEME *scheme, int id, int value)
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define IDC_ADVAPPEARANCE_COLOR2_B
Definition: resource.h:126
#define IDC_ADVAPPEARANCE_SIZE_E
Definition: resource.h:121
#define IDC_ADVAPPEARANCE_COLOR1_B
Definition: resource.h:124
#define IDC_ADVAPPEARANCE_FONTCOLOR_B
Definition: resource.h:132
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
INT WINAPI MulDiv(INT nNumber, INT nNumerator, INT nDenominator)
Definition: muldiv.c:25
#define LOWORD(l)
Definition: pedump.c:82
#define INT
Definition: polytest.cpp:20
#define PVM_SETFONT
Definition: preview.h:28
#define PVM_SETSIZE
Definition: preview.h:26
#define UDM_GETPOS
Definition: commctrl.h:2149
int Font
Definition: advappdlg.c:21
int Size2
Definition: advappdlg.c:18
int Size
Definition: advappdlg.c:17
WCHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:1910
LONG lfHeight
Definition: wingdi.h:1897
BYTE lfItalic
Definition: wingdi.h:1902
LONG lfWeight
Definition: wingdi.h:1901
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
#define HIWORD(l)
Definition: typedefs.h:247
int WINAPI GetDeviceCaps(_In_opt_ HDC, _In_ int)
#define LOGPIXELSY
Definition: wingdi.h:719
#define FW_NORMAL
Definition: wingdi.h:373
#define DWLP_USER
Definition: winuser.h:875
#define IDCANCEL
Definition: winuser.h:834
#define WM_COMMAND
Definition: winuser.h:1743
#define WM_INITDIALOG
Definition: winuser.h:1742
#define IDOK
Definition: winuser.h:833
#define CBN_SELCHANGE
Definition: winuser.h:1982
#define BN_CLICKED
Definition: winuser.h:1928
#define WM_DESTROY
Definition: winuser.h:1612
#define BST_CHECKED
Definition: winuser.h:197
#define CBN_EDITCHANGE
Definition: winuser.h:1978
#define BM_GETCHECK
Definition: winuser.h:1921
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
#define EN_CHANGE
Definition: winuser.h:2025

Referenced by AppearancePageProc().

◆ EnumFontFamExProc()

static int CALLBACK EnumFontFamExProc ( ENUMLOGFONTEX lpelfe,
NEWTEXTMETRICEX lpntme,
DWORD  dwFontType,
LPARAM  lParam 
)
static

Definition at line 188 of file advappdlg.c.

189{
190 /* Don't enumerate more than 100 fonts */
191 if (SendMessage((HWND)lParam, CB_GETCOUNT, 0, 0) >= 100)
192 return 0;
193
194 /* Only add the string once */
196 return 2;
197
199
200 return 1;
201}
LOGFONTA elfLogFont
Definition: wingdi.h:2696
CHAR lfFaceName[LF_FACESIZE]
Definition: wingdi.h:1894
#define CB_ERR
Definition: winuser.h:2438
#define CB_FINDSTRINGEXACT
Definition: winuser.h:1943
#define CB_GETCOUNT
Definition: winuser.h:1945

Referenced by AdvAppearanceDlg_Init().

◆ GetColor()

static BOOL GetColor ( HWND  hwndDlg,
GLOBALS g,
INT  nButton 
)
static

Definition at line 286 of file advappdlg.c.

287{
289 COLORREF crColor;
290 INT ID = 0;
291 INT ColorIndex = 0;
292
293 /* Get the color index from the element index and button number */
294 switch (nButton)
295 {
296 case 0:
297 ColorIndex = g_Assignment[g->CurrentElement].Color1;
299 break;
300
301 case 1:
302 ColorIndex = g_Assignment[g->CurrentElement].Color2;
304 break;
305
306 case 2:
307 ColorIndex = g_Assignment[g->CurrentElement].FontColor;
309 break;
310 }
311
312 crColor = g->SchemeAdv.crColor[ColorIndex];
313
314 /* Prepare cc structure */
315 cc.lStructSize = sizeof(CHOOSECOLOR);
316 cc.hwndOwner = hwndDlg;
317 cc.hInstance = NULL;
318 cc.rgbResult = crColor;
319 cc.lpCustColors = g->crCustom;
321 cc.lCustData = 0;
322 cc.lpfnHook = NULL;
323 cc.lpTemplateName = NULL;
324
325 /* Create the colorpicker */
326 if (ChooseColor(&cc))
327 {
328 g->SchemeAdv.crColor[ColorIndex] = cc.rgbResult;
329 if (crColor != cc.rgbResult)
330 {
331 UpdateButtonColor(hwndDlg, g, ID, nButton, ColorIndex);
333 return TRUE;
334 }
335 }
336
337 return FALSE;
338}
static VOID UpdateButtonColor(HWND hwndDlg, GLOBALS *g, INT ID, INT nButton, INT nColor)
Definition: advappdlg.c:55
CHOOSECOLORA CHOOSECOLOR
Definition: commdlg.h:654
#define CC_RGBINIT
Definition: commdlg.h:50
#define ChooseColor
Definition: commdlg.h:661
#define CC_FULLOPEN
Definition: commdlg.h:51
#define CC_ANYCOLOR
Definition: commdlg.h:58
uint32_t cc
Definition: isohybrid.c:75
#define ID
Definition: ruserpass.c:36
int Color1
Definition: advappdlg.c:19
int FontColor
Definition: advappdlg.c:22
int Color2
Definition: advappdlg.c:20
DWORD COLORREF
Definition: windef.h:300

Referenced by AdvAppearanceDlgProc(), and DECLARE_INTERFACE_().

◆ GetSelectedComboInt()

static INT GetSelectedComboInt ( HWND  hwnd,
INT  id 
)
static

Definition at line 486 of file advappdlg.c.

487{
488 TCHAR szBuffer[80];
489 INT nCount;
490
491 nCount = SendDlgItemMessage(hwnd, id, CB_GETCURSEL, 0, 0);
492 if (nCount == CB_ERR)
493 return 0;
494
495 nCount = SendDlgItemMessage(hwnd, id, CB_GETLBTEXT, (WPARAM)nCount, (LPARAM)szBuffer);
496 if (nCount == CB_ERR)
497 return 0;
498
499 return _ttoi(szBuffer);
500}
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
#define CB_GETLBTEXT
Definition: winuser.h:1955
#define _ttoi
Definition: xmlstorage.h:195

Referenced by AdvAppearanceDlgProc().

◆ GetSelectedComboText()

static VOID GetSelectedComboText ( HWND  hwnd,
INT  id,
LPWSTR  lpStr 
)
static

Definition at line 466 of file advappdlg.c.

467{
468 INT nCount;
469
470 nCount = SendDlgItemMessage(hwnd, id, CB_GETCURSEL, 0, 0);
471 if (nCount == CB_ERR)
472 {
473 *lpStr = 0;
474 return;
475 }
476
477 nCount = SendDlgItemMessage(hwnd, id, CB_GETLBTEXT, (WPARAM)nCount, (LPARAM)lpStr);
478 if (nCount == CB_ERR)
479 {
480 *lpStr = 0;
481 }
482}

Referenced by AdvAppearanceDlgProc().

◆ InitColorButtons()

static VOID InitColorButtons ( HWND  hwndDlg,
GLOBALS g 
)
static

Definition at line 100 of file advappdlg.c.

101{
102 INT i;
103 HDC hdcColorButton, hdcCompat;
104 RECT rect;
105 HBRUSH hbrush;
106 HPEN hPen;
107 HWND hwndColorButton;
108 HGDIOBJ hgdiTemp;
109 COLOR_SCHEME *scheme = &g->SchemeAdv;
110
111 const POINT Points[3] = {{29,6},{33,6},{31,8}};
112
113 hwndColorButton = GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_COLOR1_B);
114 hdcColorButton = GetDC(hwndColorButton);
115 for (i = 0; i <= 2; i++)
116 {
117 /* Create a DC to draw on */
118 hdcCompat = CreateCompatibleDC(hdcColorButton);
119
120 /* Create the button image */
121 g->hbmpColor[i] = CreateCompatibleBitmap(hdcColorButton, 36, 15);
122
123 /* Select the button image to the DC */
124 hgdiTemp = SelectObject(hdcCompat, g->hbmpColor[i]);
125
126 /* Draw the buttons background color */
127 rect.left = 0;
128 rect.top = 0;
129 rect.right = 36;
130 rect.bottom = 15;
132 FillRect(hdcCompat, &rect, hbrush);
134
135 /* Draw the rectangle */
136 rect.left = 1;
137 rect.top = 1;
138 rect.right = 23;
139 rect.bottom = 14;
141 FillRect(hdcCompat, &rect, hbrush);
143
144 /* Draw left side of line */
145 hPen = CreatePen(PS_SOLID, 1, scheme->crColor[COLOR_BTNSHADOW]);
146 SelectObject(hdcCompat, hPen);
147 MoveToEx(hdcCompat, 26, 1, NULL);
148 LineTo(hdcCompat, 26, 14);
150 DeleteObject(hPen);
151
152 /* Draw right side of line */
153 hPen = CreatePen(PS_SOLID, 1, scheme->crColor[COLOR_BTNHIGHLIGHT]);
154 SelectObject(hdcCompat,hPen);
155 MoveToEx(hdcCompat, 27, 1, NULL);
156 LineTo(hdcCompat, 27, 14);
158 DeleteObject(hPen);
159
160 /* Draw triangle */
161 hPen = CreatePen(PS_SOLID, 1, scheme->crColor[COLOR_BTNTEXT]);
163 SelectObject(hdcCompat, hPen);
164 SelectObject(hdcCompat, hbrush);
165 SetPolyFillMode(hdcCompat, WINDING);
166
167 /* FIXME: HACK, see Points definition */
168 Polygon(hdcCompat, Points, 3);
169
170 /* Cleanup */
171 SelectObject(hdcCompat,hgdiTemp);
172 DeleteDC(hdcCompat);
173 DeleteObject(hPen);
175 }
176
177 ReleaseDC(hwndColorButton, hdcColorButton);
178
179 /* Set the images of the buttons */
183}
static HBRUSH hbrush
#define WINDING
Definition: constants.h:279
BOOL Polygon(CONST PPOINT UnsafePoints, int Count, int polyFillMode)
Definition: polytest.cpp:730
DWORD scheme
& rect
Definition: startmenu.cpp:1413
HGDIOBJ WINAPI GetStockObject(_In_ int)
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1546
BOOL WINAPI MoveToEx(_In_ HDC, _In_ int, _In_ int, _Out_opt_ LPPOINT)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define BLACK_PEN
Definition: wingdi.h:903
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
HBRUSH WINAPI CreateSolidBrush(_In_ COLORREF)
BOOL WINAPI DeleteDC(_In_ HDC)
HPEN WINAPI CreatePen(_In_ int, _In_ int, _In_ COLORREF)
BOOL WINAPI LineTo(_In_ HDC, _In_ int, _In_ int)
#define PS_SOLID
Definition: wingdi.h:586
int WINAPI SetPolyFillMode(_In_ HDC, _In_ int)
Definition: dc.c:1174
#define COLOR_BTNTEXT
Definition: winuser.h:936
#define IMAGE_BITMAP
Definition: winuser.h:211
#define BM_SETIMAGE
Definition: winuser.h:1925
#define COLOR_BTNSHADOW
Definition: winuser.h:933
#define COLOR_BTNHIGHLIGHT
Definition: winuser.h:938
#define COLOR_BTNFACE
Definition: winuser.h:931

Referenced by AdvAppearanceDlg_Init().

◆ SaveCurrentValues()

static VOID SaveCurrentValues ( HWND  hwndDlg,
GLOBALS g 
)
static

Definition at line 261 of file advappdlg.c.

262{
263 BOOL bTranslated;
264 HDC hdcDlg = GetDC(hwndDlg);
265
266 if (g_Assignment[g->CurrentElement].Size != -1)
267 {
268 SchemeSetMetric(&g->SchemeAdv, g_Assignment[g->CurrentElement].Size, GetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_SIZE_E, &bTranslated, FALSE));
269 }
270
271 if (g_Assignment[g->CurrentElement].Font != -1)
272 {
273 PLOGFONTW plfFont = SchemeGetFont(&g->SchemeAdv, g_Assignment[g->CurrentElement].Font);
274 plfFont->lfHeight = -MulDiv(GetDlgItemInt(hwndDlg, IDC_ADVAPPEARANCE_FONTSIZE_E, &bTranslated, FALSE), GetDeviceCaps(hdcDlg, LOGPIXELSY), 72);
278 }
279
280 ReleaseDC(hwndDlg, hdcDlg);
281}
#define LF_FACESIZE
Definition: dimm.idl:39
unsigned int BOOL
Definition: ntddk_ex.h:94
#define GetDlgItemText
Definition: winuser.h:5797
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
unsigned char BYTE
Definition: xxhash.c:193

Referenced by AdvAppearanceDlgProc().

◆ SelectComboByElement()

static VOID SelectComboByElement ( HWND  hwnd,
INT  id,
LPARAM  lParam 
)
static

Definition at line 445 of file advappdlg.c.

446{
447 INT nCount;
448 INT i;
449
450 nCount = SendDlgItemMessage(hwnd, id, CB_GETCOUNT, 0, 0);
451 if (nCount == CB_ERR)
452 return;
453
454 for (i = 0; i < nCount; i++)
455 {
457 {
459 break;
460 }
461 }
462}

Referenced by AdvAppearanceDlgProc().

◆ UpdateButtonColor()

static VOID UpdateButtonColor ( HWND  hwndDlg,
GLOBALS g,
INT  ID,
INT  nButton,
INT  nColor 
)
static

Definition at line 55 of file advappdlg.c.

56{
57 HDC hdcColorButton, hdcCompat;
58 RECT rect;
59 HBRUSH hbrush;
60 HWND hwndColorButton;
61 HGDIOBJ hgdiTmp;
62
63 if (nColor != -1)
64 {
65 /* Create a DC to draw on */
66 hwndColorButton = GetDlgItem(hwndDlg, ID);
67 hdcColorButton = GetDC(hwndColorButton);
68 hdcCompat = CreateCompatibleDC(hdcColorButton);
69 ReleaseDC(hwndColorButton, hdcColorButton);
70
71 /* Select the button image to it */
72 hgdiTmp = SelectObject(hdcCompat, g->hbmpColor[nButton]);
73
74 /* Create a brush and draw the rectangle */
75 rect.left = 2;
76 rect.top = 2;
77 rect.right = 22;
78 rect.bottom = 13;
79 hbrush = CreateSolidBrush(g->SchemeAdv.crColor[nColor]);
80 FillRect(hdcCompat, &rect, hbrush);
82
83 /* hdcCompat is not needed anymore */
84 SelectObject(hdcCompat,hgdiTmp);
85 DeleteDC(hdcCompat);
86
87 SendDlgItemMessage(hwndDlg, ID, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)g->hbmpColor[nButton]);
88 EnableWindow(GetDlgItem(hwndDlg, ID), TRUE);
89 }
90 else
91 {
93 EnableWindow(GetDlgItem(hwndDlg, ID), FALSE);
94 }
95}
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)

Referenced by GetColor(), and UpdateControls().

◆ UpdateControls()

static VOID UpdateControls ( HWND  hwndDlg,
GLOBALS g 
)
static

Definition at line 206 of file advappdlg.c.

207{
208 INT iElement;
209 HDC hdcDlg;
210
211 iElement = g->CurrentElement;
212
213 /* First enable / disable the controls */
217 EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_COLOR1_T), (g_Assignment[iElement].Color1 != -1));
218 EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_COLOR2_T), (g_Assignment[iElement].Color2 != -1));
223 EnableWindow(GetDlgItem(hwndDlg, IDC_ADVAPPEARANCE_FONTCOLOR_T), (g_Assignment[iElement].FontColor != -1));
226
227 /* Update the colors of the color buttons */
228 UpdateButtonColor(hwndDlg, g, IDC_ADVAPPEARANCE_COLOR1_B, 0, g_Assignment[iElement].Color1);
229 UpdateButtonColor(hwndDlg, g, IDC_ADVAPPEARANCE_COLOR2_B, 1, g_Assignment[iElement].Color2);
230 UpdateButtonColor(hwndDlg, g, IDC_ADVAPPEARANCE_FONTCOLOR_B, 2, g_Assignment[iElement].FontColor);
231
232 if (g_Assignment[iElement].Size != -1)
234 else
236
237 hdcDlg = GetDC(hwndDlg);
238 if (g_Assignment[iElement].Font != -1)
239 {
240 PLOGFONTW plfFont = SchemeGetFont(&g->SchemeAdv, g_Assignment[iElement].Font);
241
247 }
248 else
249 {
254 }
255
256 ReleaseDC(hwndDlg, hdcDlg);
257}
int SchemeGetMetric(COLOR_SCHEME *scheme, int id)
#define IDC_ADVAPPEARANCE_FONT_T
Definition: resource.h:127
#define IDC_ADVAPPEARANCE_COLOR1_T
Definition: resource.h:123
#define IDC_ADVAPPEARANCE_FONTCOLOR_T
Definition: resource.h:131
#define IDC_ADVAPPEARANCE_COLOR2_T
Definition: resource.h:125
#define IDC_ADVAPPEARANCE_SIZE_T
Definition: resource.h:120
#define IDC_ADVAPPEARANCE_FONTSIZE_T
Definition: resource.h:129
#define BM_SETCHECK
Definition: winuser.h:1924
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
#define SetDlgItemText
Definition: winuser.h:5861

Referenced by AdvAppearanceDlg_Init(), and AdvAppearanceDlgProc().

Variable Documentation

◆ g_Assignment

const ASSIGNMENT g_Assignment[NUM_ELEMENTS]
Initial value:
=
{
{-1, -1, COLOR_DESKTOP, -1, -1, -1},
{-1, -1, COLOR_WINDOW, -1 , -1, COLOR_WINDOWTEXT},
{-1, -1, COLOR_3DFACE, -1, -1, COLOR_BTNTEXT},
{SIZE_CAPTION_HEIGHT, -1, -1, -1, -1, -1},
{-1, -1, -1, -1, FONT_MESSAGE, COLOR_WINDOWTEXT},
{-1, -1, COLOR_APPWORKSPACE, -1, -1, -1},
{SIZE_ICON_SPACE_X, -1, -1, -1, -1, -1},
{SIZE_ICON_SPACE_Y, -1, -1, -1, -1, -1},
{SIZE_ICON, -1, -1, -1, FONT_ICON, -1},
}
#define SIZE_MENU_WIDTH
Definition: appearance.h:11
#define FONT_MESSAGE
Definition: appearance.h:22
#define FONT_CAPTION
Definition: appearance.h:18
#define SIZE_ICON_SPACE_X
Definition: appearance.h:14
#define FONT_SMCAPTION
Definition: appearance.h:19
#define FONT_STATUS
Definition: appearance.h:21
#define SIZE_SCROLL_HEIGHT
Definition: appearance.h:6
#define SIZE_ICON_SPACE_Y
Definition: appearance.h:15
#define SIZE_SCROLL_WIDTH
Definition: appearance.h:5
#define FONT_ICON
Definition: appearance.h:23
#define SIZE_MENU_HEIGHT
Definition: appearance.h:12
#define SIZE_BORDER_WIDTH
Definition: appearance.h:4
#define SIZE_ICON
Definition: appearance.h:16
#define FONT_MENU
Definition: appearance.h:20
#define SIZE_CAPTION_HEIGHT
Definition: appearance.h:8
#define SIZE_SM_CAPTION_HEIGHT
Definition: appearance.h:10
#define COLOR_INACTIVECAPTIONTEXT
Definition: winuser.h:937
#define COLOR_INFOBK
Definition: winuser.h:945
#define COLOR_MENU
Definition: winuser.h:920
#define COLOR_WINDOW
Definition: winuser.h:921
#define COLOR_SCROLLBAR
Definition: winuser.h:915
#define COLOR_GRADIENTINACTIVECAPTION
Definition: winuser.h:948
#define COLOR_WINDOWTEXT
Definition: winuser.h:924
#define COLOR_HIGHLIGHT
Definition: winuser.h:929
#define COLOR_ACTIVECAPTION
Definition: winuser.h:918
#define COLOR_INACTIVECAPTION
Definition: winuser.h:919
#define COLOR_GRADIENTACTIVECAPTION
Definition: winuser.h:947
#define COLOR_INFOTEXT
Definition: winuser.h:944
#define COLOR_DESKTOP
Definition: winuser.h:917
#define COLOR_APPWORKSPACE
Definition: winuser.h:928
#define COLOR_ACTIVEBORDER
Definition: winuser.h:926
#define COLOR_HIGHLIGHTTEXT
Definition: winuser.h:930
#define COLOR_MENUTEXT
Definition: winuser.h:923
#define COLOR_INACTIVEBORDER
Definition: winuser.h:927
#define COLOR_CAPTIONTEXT
Definition: winuser.h:925
#define COLOR_3DFACE
Definition: winuser.h:932

Definition at line 28 of file advappdlg.c.

Referenced by AdvAppearanceDlgProc(), GetColor(), SaveCurrentValues(), and UpdateControls().