ReactOS  0.4.15-dev-4916-gd519b11
console.c File Reference
#include "console.h"
#include <debug.h>
Include dependency graph for console.c:

Go to the source code of this file.

Macros

#define NDEBUG
 

Functions

INT_PTR CALLBACK OptionsProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK FontProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK LayoutProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK ColorsProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID InitPropSheetPage (PROPSHEETPAGEW *psp, WORD idDlg, DLGPROC DlgProc)
 
static VOID InitDefaultConsoleInfo (PCONSOLE_STATE_INFO pConInfo)
 
static INT_PTR CALLBACK ApplyProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID ApplyConsoleInfo (HWND hwndDlg)
 
static int CALLBACK PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 
static LONG APIENTRY InitApplet (HANDLE hSectionOrWnd)
 
LONG CALLBACK CPlApplet (HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
 
INT WINAPI DllMain (HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
 

Variables

HINSTANCE hApplet = NULL
 
PCONSOLE_STATE_INFO ConInfo = NULL
 
static BOOL SetConsoleInfo = FALSE
 
static BOOL SaveConsoleInfo = FALSE
 

Macro Definition Documentation

◆ NDEBUG

#define NDEBUG

Definition at line 12 of file console.c.

Function Documentation

◆ ApplyConsoleInfo()

VOID ApplyConsoleInfo ( HWND  hwndDlg)

Definition at line 88 of file console.c.

89 {
90  static BOOL ConsoleInfoAlreadySaved = FALSE;
91 
92  /*
93  * We already applied all the console properties (and saved if needed).
94  * Nothing more needs to be done.
95  */
96  if (ConsoleInfoAlreadySaved)
97  goto Done;
98 
99  /*
100  * If we are setting the default parameters, just save them,
101  * otherwise display the confirmation & apply dialog.
102  */
103  if (ConInfo->hWnd == NULL)
104  {
107  }
108  else
109  {
111 
112  SetConsoleInfo = (res != IDCANCEL);
114 
115  if (!SetConsoleInfo)
116  {
117  /* Don't destroy when the user presses cancel */
119  return;
120  }
121  }
122 
123  /*
124  * We applied all the console properties (and saved if needed).
125  * Set the flag so that if this function is called again, we won't
126  * need to redo everything again.
127  */
128  ConsoleInfoAlreadySaved = TRUE;
129 
130 Done:
131  /* Options have been applied */
133  return;
134 }
static INT_PTR CALLBACK ApplyProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: console.c:51
#define TRUE
Definition: types.h:120
static BOOL SetConsoleInfo
Definition: console.c:25
int32_t INT_PTR
Definition: typedefs.h:64
#define SetWindowLongPtr
Definition: treelist.c:70
#define DWLP_MSGRESULT
Definition: winuser.h:864
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PSNRET_INVALID_NOCHANGEPAGE
Definition: prsht.h:131
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4379
HINSTANCE hApplet
Definition: console.c:20
#define PSNRET_NOERROR
Definition: prsht.h:129
static BOOL SaveConsoleInfo
Definition: console.c:26
#define IDD_APPLYOPTIONS
Definition: resource.h:16
PCONSOLE_STATE_INFO ConInfo
Definition: console.c:23
#define NULL
Definition: types.h:112
GLuint res
Definition: glext.h:9613
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDCANCEL
Definition: winuser.h:825
#define IDC_RADIO_APPLY_ALL
Definition: resource.h:34

Referenced by ColorsProc(), FontProc(), and OptionsProc().

◆ ApplyProc()

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

Definition at line 51 of file console.c.

55 {
57 
58  switch (uMsg)
59  {
60  case WM_INITDIALOG:
61  {
63  return TRUE;
64  }
65  case WM_COMMAND:
66  {
67  if (LOWORD(wParam) == IDOK)
68  {
71  else
73  }
74  else if (LOWORD(wParam) == IDCANCEL)
75  {
76  EndDialog(hwndDlg, IDCANCEL);
77  }
78  break;
79  }
80  default:
81  break;
82  }
83 
84  return FALSE;
85 }
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define IDC_RADIO_APPLY_CURRENT
Definition: resource.h:35
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1727
#define BST_CHECKED
Definition: winuser.h:197
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDC_RADIO_APPLY_ALL
Definition: resource.h:34

Referenced by ApplyConsoleInfo().

◆ ColorsProc()

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

Definition at line 37 of file colors.c.

41 {
42  DWORD colorIndex;
44 
45  switch (uMsg)
46  {
47  case WM_INITDIALOG:
48  {
49  /* Set the valid range of the colour indicators */
53 
54  /* Select by default the screen background option */
57 
58  return TRUE;
59  }
60 
61  case WM_DRAWITEM:
62  {
64 
65  if (IDC_STATIC_COLOR1 <= drawItem->CtlID && drawItem->CtlID <= IDC_STATIC_COLOR16)
66  PaintStaticControls(drawItem, ConInfo);
67  else if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR)
68  PaintText(drawItem, ConInfo, Screen);
69  else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR)
70  PaintText(drawItem, ConInfo, Popup);
71 
72  return TRUE;
73  }
74 
75  case WM_NOTIFY:
76  {
77  switch (((LPNMHDR)lParam)->code)
78  {
79  case PSN_APPLY:
80  {
81  ApplyConsoleInfo(hDlg);
82  return TRUE;
83  }
84 
85  case UDN_DELTAPOS:
86  {
87  LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;
88 
89  /* Get the current color */
90  colorIndex = ActiveStaticControl;
91  color = ConInfo->ColorTable[colorIndex];
92 
93  if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_RED)
94  {
95  lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
96  color = RGB(lpnmud->iPos, GetGValue(color), GetBValue(color));
97  }
98  else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_GREEN)
99  {
100  lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
101  color = RGB(GetRValue(color), lpnmud->iPos, GetBValue(color));
102  }
103  else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_BLUE)
104  {
105  lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
106  color = RGB(GetRValue(color), GetGValue(color), lpnmud->iPos);
107  }
108  else
109  {
110  break;
111  }
112 
113  ConInfo->ColorTable[colorIndex] = color;
114  InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
117 
118  PropSheet_Changed(GetParent(hDlg), hDlg);
119  break;
120  }
121  }
122 
123  break;
124  }
125 
126  case WM_COMMAND:
127  {
128  /* NOTE: both BN_CLICKED and STN_CLICKED == 0 */
129  if (HIWORD(wParam) == BN_CLICKED /* || HIWORD(wParam) == STN_CLICKED */)
130  {
131  WORD ctrlIndex = LOWORD(wParam);
132 
133  if (ctrlIndex == IDC_RADIO_SCREEN_TEXT ||
134  ctrlIndex == IDC_RADIO_SCREEN_BACKGROUND ||
135  ctrlIndex == IDC_RADIO_POPUP_TEXT ||
136  ctrlIndex == IDC_RADIO_POPUP_BACKGROUND)
137  {
138  switch (ctrlIndex)
139  {
141  /* Get the colour of the screen foreground */
143  break;
144 
146  /* Get the colour of the screen background */
148  break;
149 
151  /* Get the colour of the popup foreground */
153  break;
154 
156  /* Get the colour of the popup background */
158  break;
159  }
160 
161  color = ConInfo->ColorTable[colorIndex];
162 
163  /* Set the values of the colour indicators */
167 
169  ActiveStaticControl = colorIndex;
171  break;
172  }
173  else
174  if (IDC_STATIC_COLOR1 <= ctrlIndex && ctrlIndex <= IDC_STATIC_COLOR16)
175  {
176  colorIndex = ctrlIndex - IDC_STATIC_COLOR1;
177 
178  /* If the same static control was re-clicked, don't take it into account */
179  if (colorIndex == ActiveStaticControl)
180  break;
181 
182  color = ConInfo->ColorTable[colorIndex];
183 
184  /* Set the values of the colour indicators */
188 
190  {
192  }
194  {
196  }
198  {
200  }
202  {
204  }
205 
207  ActiveStaticControl = colorIndex;
211 
212  PropSheet_Changed(GetParent(hDlg), hDlg);
213  break;
214  }
215  }
216  else if (HIWORD(wParam) == EN_KILLFOCUS)
217  {
218  WORD ctrlIndex = LOWORD(wParam);
219 
220  if (ctrlIndex == IDC_EDIT_COLOR_RED ||
221  ctrlIndex == IDC_EDIT_COLOR_GREEN ||
222  ctrlIndex == IDC_EDIT_COLOR_BLUE)
223  {
224  DWORD value;
225 
226  /* Get the current colour */
227  colorIndex = ActiveStaticControl;
228  color = ConInfo->ColorTable[colorIndex];
229 
230  /* Modify the colour component */
231  switch (ctrlIndex)
232  {
233  case IDC_EDIT_COLOR_RED:
235  value = min(max(value, 0), 255);
237  break;
238 
241  value = min(max(value, 0), 255);
243  break;
244 
245  case IDC_EDIT_COLOR_BLUE:
247  value = min(max(value, 0), 255);
249  break;
250  }
251 
252  ConInfo->ColorTable[colorIndex] = color;
253  InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
256 
257  PropSheet_Changed(GetParent(hDlg), hDlg);
258  break;
259  }
260  }
261 
262  break;
263  }
264 
265  default:
266  break;
267  }
268 
269  return FALSE;
270 }
#define IDC_RADIO_POPUP_BACKGROUND
Definition: resource.h:71
#define max(a, b)
Definition: svc.c:63
Definition: pdh_main.c:93
USHORT ScreenAttributes
Definition: settings.h:47
#define RGB(r, g, b)
Definition: precomp.h:62
NMHDR hdr
Definition: commctrl.h:2164
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define TRUE
Definition: types.h:120
#define IDC_UPDOWN_COLOR_RED
Definition: resource.h:73
struct _NM_UPDOWN * LPNMUPDOWN
#define GetRValue(quad)
Definition: precomp.h:64
#define PSN_APPLY
Definition: prsht.h:117
WPARAM wParam
Definition: combotst.c:138
#define IDC_STATIC_POPUP_COLOR
Definition: resource.h:79
#define EN_KILLFOCUS
Definition: winuser.h:2012
static VOID PaintStaticControls(IN LPDRAWITEMSTRUCT drawItem, IN PCONSOLE_STATE_INFO pConInfo)
Definition: colors.c:18
#define FALSE
Definition: types.h:117
GLuint color
Definition: glext.h:6243
#define IDC_STATIC_SCREEN_COLOR
Definition: resource.h:78
#define MakeAttrib(TextAttrib, BkgdAttrib)
Definition: settings.h:74
UINT_PTR idFrom
Definition: winuser.h:3138
COLORREF ColorTable[16]
Definition: settings.h:53
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define IDC_EDIT_COLOR_RED
Definition: resource.h:72
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
#define IDC_EDIT_COLOR_BLUE
Definition: resource.h:76
VOID ApplyConsoleInfo(HWND hwndDlg)
Definition: console.c:88
LONG_PTR LPARAM
Definition: windef.h:208
#define GetBValue(quad)
Definition: precomp.h:66
#define IDC_EDIT_COLOR_GREEN
Definition: resource.h:74
#define IDC_RADIO_SCREEN_TEXT
Definition: resource.h:68
#define UDM_SETRANGE
Definition: commctrl.h:2141
#define IDC_UPDOWN_COLOR_BLUE
Definition: resource.h:77
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define GetGValue(quad)
Definition: precomp.h:65
#define BkgdAttribFromAttrib(Attribute)
Definition: settings.h:73
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
DWORD COLORREF
Definition: windef.h:300
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
unsigned short WORD
Definition: ntddk_ex.h:93
#define BN_CLICKED
Definition: winuser.h:1912
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
#define UDN_DELTAPOS
Definition: commctrl.h:2169
GLsizei const GLfloat * value
Definition: glext.h:6069
#define WM_COMMAND
Definition: winuser.h:1727
Definition: inflate.c:139
#define TextAttribFromAttrib(Attribute)
Definition: settings.h:72
Definition: console.h:35
static DWORD ActiveStaticControl
Definition: colors.c:15
#define IDC_RADIO_SCREEN_BACKGROUND
Definition: resource.h:69
int iDelta
Definition: commctrl.h:2166
HWND WINAPI GetParent(_In_ HWND)
#define IDC_STATIC_COLOR1
Definition: resource.h:81
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_RADIO_POPUP_TEXT
Definition: resource.h:70
PCONSOLE_STATE_INFO ConInfo
Definition: console.c:23
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
#define WM_DRAWITEM
Definition: winuser.h:1632
#define HIWORD(l)
Definition: typedefs.h:247
Definition: console.h:34
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
USHORT PopupAttributes
Definition: settings.h:48
VOID PaintText(IN LPDRAWITEMSTRUCT drawItem, IN PCONSOLE_STATE_INFO pConInfo, IN TEXT_TYPE TextMode)
Definition: layout.c:471
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
#define IDC_STATIC_COLOR16
Definition: resource.h:96
#define IDC_UPDOWN_COLOR_GREEN
Definition: resource.h:75

Referenced by InitApplet().

◆ CPlApplet()

LONG CALLBACK CPlApplet ( HWND  hwndCPl,
UINT  uMsg,
LPARAM  lParam1,
LPARAM  lParam2 
)

Definition at line 342 of file console.c.

346 {
347  switch (uMsg)
348  {
349  case CPL_INIT:
350  return TRUE;
351 
352  case CPL_EXIT:
353  // TODO: Free allocated memory
354  break;
355 
356  case CPL_GETCOUNT:
357  return 1;
358 
359  case CPL_INQUIRE:
360  {
361  CPLINFO *CPlInfo = (CPLINFO*)lParam2;
362  CPlInfo->idIcon = IDC_CPLICON;
363  CPlInfo->idName = IDS_CPLNAME;
364  CPlInfo->idInfo = IDS_CPLDESCRIPTION;
365  break;
366  }
367 
368  case CPL_DBLCLK:
369  InitApplet((HANDLE)hwndCPl);
370  break;
371  }
372 
373  return FALSE;
374 }
Definition: cpl.h:24
#define TRUE
Definition: types.h:120
static LONG APIENTRY InitApplet(HANDLE hSectionOrWnd)
Definition: console.c:156
int idInfo
Definition: cpl.h:27
#define IDC_CPLICON
Definition: resource.h:7
int idIcon
Definition: cpl.h:25
#define CPL_DBLCLK
Definition: cpl.h:16
#define IDS_CPLNAME
Definition: resource.h:8
#define FALSE
Definition: types.h:117
#define IDS_CPLDESCRIPTION
Definition: resource.h:9
#define CPL_EXIT
Definition: cpl.h:18
#define CPL_INIT
Definition: cpl.h:12
#define CPL_INQUIRE
Definition: cpl.h:14
int idName
Definition: cpl.h:26
#define CPL_GETCOUNT
Definition: cpl.h:13

◆ DllMain()

INT WINAPI DllMain ( HINSTANCE  hinstDLL,
DWORD  dwReason,
LPVOID  lpvReserved 
)

Definition at line 378 of file console.c.

381 {
383 
384  switch (dwReason)
385  {
386  case DLL_PROCESS_ATTACH:
387  hApplet = hinstDLL;
388  DisableThreadLibraryCalls(hinstDLL);
389  break;
390  }
391 
392  return TRUE;
393 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
static IN DWORD IN LPVOID lpvReserved
DWORD dwReason
Definition: misc.cpp:154
HINSTANCE hApplet
Definition: console.c:20

◆ FontProc()

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

Definition at line 725 of file font.c.

729 {
730  PFONTSIZE_LIST_CTL SizeList;
731 
733 
734  switch (uMsg)
735  {
736  case WM_INITDIALOG:
737  {
738  SizeList = (PFONTSIZE_LIST_CTL)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*SizeList));
739  if (!SizeList)
740  {
741  EndDialog(hDlg, 0);
742  return (INT_PTR)TRUE;
743  }
747  SizeList->hWndTTSizeList = GetDlgItem(hDlg, IDC_CBOX_FONTSIZE);
748  SizeList->bIsTTSizeDirty = FALSE;
749  SetWindowLongPtrW(hDlg, DWLP_USER, (LONG_PTR)SizeList);
750 
751  /* By default show the raster font size list */
752  SizeList->UseRasterOrTTList = TRUE;
753 
754  /* By default show the font sizes in pixel units */
756  SizeList->TTSizePixelUnit = TRUE;
757 
758  UpdateFontSizeList(hDlg, SizeList);
759 
760  DPRINT1("ConInfo->FaceName = '%S'\n", ConInfo->FaceName);
761 
762  /* Face names list and current font selection will be done during PSN_SETACTIVE notification */
763  // CurrentCodePage = INVALID_CP;
764 
765  return TRUE;
766  }
767 
768  case WM_DESTROY:
769  {
770  if (SizeList)
771  HeapFree(GetProcessHeap(), 0, SizeList);
772  return (INT_PTR)TRUE;
773  }
774 
775  case WM_DRAWITEM:
776  {
778 
779  if (drawItem->CtlID == IDC_STATIC_SELECT_FONT_PREVIEW)
780  PaintText(drawItem, ConInfo, Screen);
781 
782  return TRUE;
783  }
784 
785  case WM_DISPLAYCHANGE:
786  {
787  /* Retransmit to the preview window */
789  WM_DISPLAYCHANGE, wParam, lParam);
790  break;
791  }
792 
793  case WM_FONTCHANGE:
794  {
795  /* The pool of font resources has changed, re-enumerate the fonts */
796  HWND hFontList = GetDlgItem(hDlg, IDC_LBOX_FONTTYPE);
797 
798  /* Initialize the font list */
800 
801  /* Select the current font */
802  FaceNameList_SelectFont(hDlg, hFontList,
803  SizeList,
804  ConInfo->FaceName,
807  ConInfo->FontSize);
808 
809  /* Refresh everything */
810  FontTypeChange(hDlg, SizeList, ConInfo);
811  break;
812  }
813 
814  case WM_NOTIFY:
815  {
816  switch (((LPNMHDR)lParam)->code)
817  {
818  case PSN_APPLY:
819  {
820  ApplyConsoleInfo(hDlg);
821  return TRUE;
822  }
823 
824  case PSN_SETACTIVE:
825  {
826  /* Check whether the current code page has changed.
827  * If so, re-enumerate the fonts. */
829  {
830  HWND hFontList;
831 
832  /* Save the new code page */
834 
835  hFontList = GetDlgItem(hDlg, IDC_LBOX_FONTTYPE);
836 
837  /* Initialize the font list */
839 
840  /* Select the current font */
841  FaceNameList_SelectFont(hDlg, hFontList,
842  SizeList,
843  ConInfo->FaceName,
846  ConInfo->FontSize);
847 
848  /* Refresh everything */
849  FontTypeChange(hDlg, SizeList, ConInfo);
850  }
851 
852  /* Fall back to default behaviour */
853  break;
854  }
855  }
856 
857  break;
858  }
859 
860  case WM_COMMAND:
861  {
862  if (HIWORD(wParam) == LBN_SELCHANGE /* || CBN_SELCHANGE */)
863  {
864  switch (LOWORD(wParam))
865  {
866  case IDC_LBOX_FONTTYPE:
867  {
868  /* Change the property sheet state only if the font has really changed */
869  if (FontTypeChange(hDlg, SizeList, ConInfo))
870  PropSheet_Changed(GetParent(hDlg), hDlg);
871  break;
872  }
873 
874  case IDC_LBOX_FONTSIZE:
875  case IDC_CBOX_FONTSIZE:
876  {
877  /* Change the property sheet state only if the font has really changed */
878  if (FontSizeChange(hDlg, SizeList, ConInfo))
879  PropSheet_Changed(GetParent(hDlg), hDlg);
880  break;
881  }
882  }
883  }
884  /* NOTE: CBN_EDITUPDATE is sent first, and is followed by CBN_EDITCHANGE */
886  {
887  ULONG FontSize;
888  PWCHAR pszNext = NULL;
889  WCHAR szFontSize[100];
890  WCHAR szMessage[260];
891 
892  /* Read the ComboBox edit string, as the user has entered a custom size */
893  GetWindowTextW(SizeList->hWndTTSizeList, szFontSize, ARRAYSIZE(szFontSize));
894 
895  /* Validate the font size */
896  FontSize = wcstoul(szFontSize, &pszNext, 10);
897  if ((FontSize == 0) || (*pszNext))
898  {
899  // FIXME: Localize!
900  StringCchPrintfW(szMessage, ARRAYSIZE(szMessage), L"\"%s\" is not a valid font size.", szFontSize);
901  MessageBoxW(hDlg, szMessage, L"Error", MB_ICONINFORMATION | MB_OK);
902  }
903  SizeList->bIsTTSizeDirty = TRUE;
904  }
906  {
907  /* Change the property sheet state only if the font has really changed */
908  if (FontSizeChange(hDlg, SizeList, ConInfo))
909  PropSheet_Changed(GetParent(hDlg), hDlg);
910  }
911  else
912  if (HIWORD(wParam) == BN_CLICKED)
913  {
914  switch (LOWORD(wParam))
915  {
917  {
920  else
922 
923  FontTypeChange(hDlg, SizeList, ConInfo);
924  PropSheet_Changed(GetParent(hDlg), hDlg);
925  break;
926  }
927 
930  {
932 
933  /* The call is valid only for TrueType fonts */
935  break;
936 
937  /* Change the property sheet state only if the font has really changed */
938  if (FontSizeChange(hDlg, SizeList, ConInfo))
939  PropSheet_Changed(GetParent(hDlg), hDlg);
940  break;
941  }
942  }
943  }
944 
945  break;
946  }
947 
948  default:
949  break;
950  }
951 
952  return FALSE;
953 }
#define IDC_RADIO_POINT_UNIT
Definition: resource.h:45
#define IDC_RADIO_PIXEL_UNIT
Definition: resource.h:44
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define TRUE
Definition: types.h:120
HWND hWndTTSizeList
Definition: font.c:35
#define IDC_CHECK_BOLD_FONTS
Definition: resource.h:38
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define GetWindowLongPtrW
Definition: winuser.h:4809
uint16_t * PWCHAR
Definition: typedefs.h:56
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:64
BOOL TTSizePixelUnit
Definition: font.c:38
#define LBN_SELCHANGE
Definition: winuser.h:2062
#define PSN_SETACTIVE
Definition: prsht.h:115
static INT RasterSizeList_GetCount(IN PLIST_CTL ListCtl)
Definition: font.c:83
WPARAM wParam
Definition: combotst.c:138
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
HWND hWndList
Definition: console.h:93
#define IDC_CBOX_FONTSIZE
Definition: resource.h:43
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define CBN_KILLFOCUS
Definition: winuser.h:1965
static UINT CurrentCodePage
Definition: font.c:48
struct _FONTSIZE_LIST_CTL * PFONTSIZE_LIST_CTL
VOID ApplyConsoleInfo(HWND hwndDlg)
Definition: console.c:88
static ULONG_PTR RasterSizeList_GetData(IN PLIST_CTL ListCtl, IN INT Index)
Definition: font.c:91
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define WM_DESTROY
Definition: winuser.h:1596
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
static BOOL FontSizeChange(IN HWND hDlg, IN PFONTSIZE_LIST_CTL SizeList, IN OUT PCONSOLE_STATE_INFO pConInfo)
Definition: font.c:656
LIST_CTL RasterSizeList
Definition: font.c:34
#define IDC_STATIC_FONT_WINDOW_PREVIEW
Definition: resource.h:46
#define BN_CLICKED
Definition: winuser.h:1912
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
PLIST_GETDATA GetData
Definition: console.h:95
static VOID FaceNameList_Initialize(IN HWND hWndList, IN UINT CodePage)
Definition: font.c:398
#define WM_FONTCHANGE
Definition: winuser.h:1620
#define MB_ICONINFORMATION
Definition: winuser.h:796
PLIST_GETCOUNT GetCount
Definition: console.h:94
WCHAR FaceName[LF_FACESIZE]
Definition: settings.h:39
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1727
Definition: inflate.c:139
#define IDC_LBOX_FONTSIZE
Definition: resource.h:42
HWND WINAPI GetParent(_In_ HWND)
#define IDC_STATIC_SELECT_FONT_PREVIEW
Definition: resource.h:39
#define FW_BOLD
Definition: wingdi.h:378
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1412
#define IDC_LBOX_FONTTYPE
Definition: resource.h:47
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
PCONSOLE_STATE_INFO ConInfo
Definition: console.c:23
#define NULL
Definition: types.h:112
#define MB_OK
Definition: winuser.h:784
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define BST_CHECKED
Definition: winuser.h:197
#define FW_NORMAL
Definition: wingdi.h:373
BOOL bIsTTSizeDirty
Definition: font.c:36
#define DPRINT1
Definition: precomp.h:8
#define WM_DRAWITEM
Definition: winuser.h:1632
BOOL UseRasterOrTTList
Definition: font.c:37
#define CBN_EDITUPDATE
Definition: winuser.h:1963
#define HIWORD(l)
Definition: typedefs.h:247
unsigned int ULONG
Definition: retypes.h:1
Definition: console.h:34
static BOOL FontTypeChange(IN HWND hDlg, IN PFONTSIZE_LIST_CTL SizeList, IN OUT PCONSOLE_STATE_INFO pConInfo)
Definition: font.c:542
static VOID UpdateFontSizeList(IN HWND hDlg, IN PFONTSIZE_LIST_CTL SizeList)
Definition: font.c:477
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define SetWindowLongPtrW
Definition: winuser.h:5326
static VOID FaceNameList_SelectFont(IN HWND hDlg, IN HWND hWndList, IN PFONTSIZE_LIST_CTL SizeList, IN LPCWSTR FaceName, IN ULONG FontFamily, IN ULONG FontWeight, IN COORD FontSize)
Definition: font.c:440
static DWORD CurrentFontType
Definition: font.c:45
VOID PaintText(IN LPDRAWITEMSTRUCT drawItem, IN PCONSOLE_STATE_INFO pConInfo, IN TEXT_TYPE TextMode)
Definition: layout.c:471
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:594
#define WM_NOTIFY
Definition: richedit.h:61
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1109

Referenced by InitApplet().

◆ InitApplet()

static LONG APIENTRY InitApplet ( HANDLE  hSectionOrWnd)
static

Definition at line 156 of file console.c.

157 {
158  INT_PTR Result;
159  PCONSOLE_STATE_INFO pSharedInfo = NULL;
160  WCHAR szTitle[MAX_PATH + 1];
161  PROPSHEETPAGEW psp[4];
162  PROPSHEETHEADERW psh;
163  INT i = 0;
164 
165  /*
166  * Because of Windows compatibility, we need to behave the same concerning
167  * information sharing with CONSRV. For some obscure reason the designers
168  * decided to use the CPlApplet hWnd parameter as being either a handle to
169  * the applet's parent caller's window (in case we ask for displaying
170  * the global console settings), or a handle to a shared section holding
171  * a CONSOLE_STATE_INFO structure (they don't use the extra l/wParams).
172  */
173 
174  /*
175  * Try to open the shared section via the handle parameter. If we succeed,
176  * it means we were called by CONSRV for retrieving/setting parameters for
177  * a given console. If we fail, it means we are retrieving/setting default
178  * global parameters (and we were either called by CONSRV or directly by
179  * the user via the Control Panel, etc...)
180  */
181  pSharedInfo = MapViewOfFile(hSectionOrWnd, FILE_MAP_READ, 0, 0, 0);
182  if (pSharedInfo != NULL)
183  {
184  /*
185  * We succeeded. We were called by CONSRV and are retrieving
186  * parameters for a given console.
187  */
188 
189  /* Copy the shared data into our allocated buffer */
190  DPRINT1("pSharedInfo->cbSize == %lu ; sizeof(CONSOLE_STATE_INFO) == %u\n",
191  pSharedInfo->cbSize, sizeof(CONSOLE_STATE_INFO));
192  ASSERT(pSharedInfo->cbSize >= sizeof(CONSOLE_STATE_INFO));
193 
194  /* Allocate a local buffer to hold console information */
197  pSharedInfo->cbSize);
198  if (ConInfo)
199  RtlCopyMemory(ConInfo, pSharedInfo, pSharedInfo->cbSize);
200 
201  /* Close the section */
202  UnmapViewOfFile(pSharedInfo);
203  CloseHandle(hSectionOrWnd);
204 
205  if (!ConInfo) return 0;
206  }
207  else
208  {
209  /*
210  * We failed. We are retrieving the default global parameters.
211  */
212 
213  /* Allocate a local buffer to hold console information */
216  sizeof(CONSOLE_STATE_INFO));
217  if (!ConInfo) return 0;
218 
219  /*
220  * Setting the console window handle to NULL indicates we are
221  * retrieving/setting the default console parameters.
222  */
223  ConInfo->hWnd = NULL;
225 
226  /* Use defaults */
228  }
229 
230  /* Initialize the font support -- additional TrueType font cache and current preview font */
231  InitTTFontCache();
233 
234  /* Initialize the property sheet structure */
235  ZeroMemory(&psh, sizeof(psh));
236  psh.dwSize = sizeof(psh);
238 
239  if (ConInfo->ConsoleTitle[0] != UNICODE_NULL)
241  else
242  StringCchCopyW(szTitle, ARRAYSIZE(szTitle), L"ReactOS Console");
243  psh.pszCaption = szTitle;
244 
245  if (pSharedInfo != NULL)
246  {
247  /* We were started from a console window: this is our parent (or ConInfo->hWnd is NULL) */
248  psh.hwndParent = ConInfo->hWnd;
249  }
250  else
251  {
252  /* We were started in another way (--> default parameters). Caller's window is our parent. */
253  psh.hwndParent = (HWND)hSectionOrWnd;
254  }
255 
256  psh.hInstance = hApplet;
257  // psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCEW(IDC_CPLICON));
259  psh.nPages = ARRAYSIZE(psp);
260  psh.nStartPage = 0;
261  psh.ppsp = psp;
263 
268 
269  /* Display the property sheet */
271  Result = PropertySheetW(&psh);
273 
274  /* Clear the font support */
277 
278  /* Apply the console settings if necessary */
279  if (SetConsoleInfo)
280  {
282 
283  /*
284  * Create a memory section to share with CONSRV, and map it.
285  */
287  NULL,
289  0,
290  ConInfo->cbSize,
291  NULL);
292  if (!hSection)
293  {
294  DPRINT1("Error when creating file mapping, error = %d\n", GetLastError());
295  goto Quit;
296  }
297 
298  pSharedInfo = MapViewOfFile(hSection, FILE_MAP_ALL_ACCESS, 0, 0, 0);
299  if (!pSharedInfo)
300  {
301  DPRINT1("Error when mapping view of file, error = %d\n", GetLastError());
303  goto Quit;
304  }
305 
306  /* Copy the console information into the section and unmap it */
307  RtlCopyMemory(pSharedInfo, ConInfo, ConInfo->cbSize);
308  UnmapViewOfFile(pSharedInfo);
309 
310  /*
311  * Signal to CONSRV that it can apply the new settings.
312  *
313  * NOTE: SetConsoleInfo set to TRUE by ApplyConsoleInfo()
314  * *only* when ConInfo->hWnd != NULL and the user did not
315  * press IDCANCEL in the confirmation dialog.
316  */
317  ASSERT(ConInfo->hWnd);
319 
320  /* Close the section and return */
322  }
323 
324  /* Save the console settings */
325  if (SaveConsoleInfo)
326  {
327  /* Default settings saved when ConInfo->hWnd == NULL */
329  }
330 
331 Quit:
332  /* Cleanup */
334  ConInfo = NULL;
335 
336  return (Result != -1);
337 }
HWND hwndParent
Definition: prsht.h:295
#define IDD_PROPPAGEOPTIONS
Definition: resource.h:12
#define CloseHandle
Definition: compat.h:598
LPCPROPSHEETPAGEW ppsp
Definition: prsht.h:308
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
#define MapViewOfFile
Definition: compat.h:604
static VOID InitDefaultConsoleInfo(PCONSOLE_STATE_INFO pConInfo)
Definition: console.c:43
HANDLE HWND
Definition: compat.h:19
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:590
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define ZeroMemory
Definition: winbase.h:1667
UINT_PTR WPARAM
Definition: windef.h:207
static BOOL SetConsoleInfo
Definition: console.c:25
int32_t INT_PTR
Definition: typedefs.h:64
#define PSH_USECALLBACK
Definition: prsht.h:48
#define IDC_CPLICON
Definition: resource.h:7
INT_PTR CALLBACK ColorsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: colors.c:37
int32_t INT
Definition: typedefs.h:58
VOID InitTTFontCache(VOID)
Initializes the console TrueType font cache.
Definition: font.c:1013
VOID ClearTTFontCache(VOID)
Clears the console TrueType font cache.
Definition: font.c:1131
#define L(x)
Definition: ntvdm.h:50
#define PSH_USEICONID
Definition: prsht.h:42
#define UNICODE_NULL
LPCWSTR pszCaption
Definition: prsht.h:301
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:311
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:426
#define FILE_MAP_ALL_ACCESS
Definition: winbase.h:156
#define FILE_MAP_READ
Definition: compat.h:635
BOOL UnRegisterWinPrevClass(IN HINSTANCE hInstance)
Definition: layout.c:52
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2905
#define IDD_PROPPAGELAYOUT
Definition: resource.h:14
INT_PTR CALLBACK LayoutProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: layout.c:525
#define GetProcessHeap()
Definition: compat.h:595
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define ASSERT(a)
Definition: mode.c:44
__wchar_t WCHAR
Definition: xmlstorage.h:180
HINSTANCE hApplet
Definition: console.c:20
BOOLEAN ConCfgWriteUserSettings(IN PCONSOLE_STATE_INFO ConsoleInfo, IN BOOLEAN DefaultSettings)
Definition: settings.c:344
#define PSH_PROPTITLE
Definition: prsht.h:40
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:603
HINSTANCE hInstance
Definition: prsht.h:296
#define MAX_PATH
Definition: compat.h:34
LPCWSTR pszIcon
Definition: prsht.h:299
DWORD dwSize
Definition: prsht.h:293
DWORD dwFlags
Definition: prsht.h:294
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
static BOOL SaveConsoleInfo
Definition: console.c:26
INT_PTR CALLBACK OptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: magnifier.c:860
#define IDD_PROPPAGEFONT
Definition: resource.h:13
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 PSH_PROPSHEETPAGE
Definition: prsht.h:43
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
STRSAFEAPI StringCchPrintfW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszFormat,...)
Definition: strsafe.h:530
FONT_PREVIEW FontPreview
Definition: font.c:21
VOID RefreshFontPreview(IN FONT_PREVIEW *Preview, IN PCONSOLE_STATE_INFO pConInfo)
Definition: font.c:52
PCONSOLE_STATE_INFO ConInfo
Definition: console.c:23
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: console.c:137
#define NULL
Definition: types.h:112
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define ResetFontPreview(Preview)
Definition: console.h:65
WCHAR ConsoleTitle[ANYSIZE_ARRAY]
Definition: settings.h:58
#define DPRINT1
Definition: precomp.h:8
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define UnmapViewOfFile
Definition: compat.h:605
BOOL RegisterWinPrevClass(IN HINSTANCE hInstance)
Definition: layout.c:32
_In_ const BITMAPINFO _In_ UINT _In_opt_ HANDLE hSection
Definition: wingdi.h:3239
static VOID InitPropSheetPage(PROPSHEETPAGEW *psp, WORD idDlg, DLGPROC DlgProc)
Definition: console.c:29
INT_PTR CALLBACK FontProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: font.c:725
#define HeapFree(x, y, z)
Definition: compat.h:594
#define WM_SETCONSOLEINFO
Definition: settings.h:21
#define PAGE_READWRITE
Definition: nt_native.h:1304
#define IDD_PROPPAGECOLORS
Definition: resource.h:15
UINT nStartPage
Definition: prsht.h:304

Referenced by CPlApplet().

◆ InitDefaultConsoleInfo()

static VOID InitDefaultConsoleInfo ( PCONSOLE_STATE_INFO  pConInfo)
static

Definition at line 43 of file console.c.

44 {
45  // FIXME: Also retrieve the value of REG_DWORD CurrentPage.
46  ConCfgGetDefaultSettings(pConInfo);
47 }
VOID ConCfgGetDefaultSettings(IN OUT PCONSOLE_STATE_INFO ConsoleInfo)
Definition: settings.c:491

Referenced by InitApplet().

◆ InitPropSheetPage()

static VOID InitPropSheetPage ( PROPSHEETPAGEW psp,
WORD  idDlg,
DLGPROC  DlgProc 
)
static

Definition at line 29 of file console.c.

32 {
33  ZeroMemory(psp, sizeof(*psp));
34  psp->dwSize = sizeof(*psp);
35  psp->dwFlags = PSP_DEFAULT;
36  psp->hInstance = hApplet;
38  psp->pfnDlgProc = DlgProc;
39  psp->lParam = 0;
40 }
WORD idDlg
Definition: desk.c:110
LPCWSTR pszTemplate
Definition: prsht.h:218
#define ZeroMemory
Definition: winbase.h:1667
DWORD dwSize
Definition: prsht.h:214
DLGPROC pfnDlgProc
Definition: prsht.h:226
#define PSP_DEFAULT
Definition: prsht.h:22
HINSTANCE hApplet
Definition: console.c:20
LPARAM lParam
Definition: prsht.h:227
HINSTANCE hInstance
Definition: prsht.h:216
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
DLGPROC DlgProc
Definition: desk.c:111
DWORD dwFlags
Definition: prsht.h:215

Referenced by InitApplet().

◆ LayoutProc()

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

Definition at line 525 of file layout.c.

529 {
530  switch (uMsg)
531  {
532  case WM_INITDIALOG:
533  {
534  /* Multi-monitor support */
535  LONG xVirtScr, yVirtScr; // Coordinates of the top-left virtual screen
536  LONG cxVirtScr, cyVirtScr; // Width and Height of the virtual screen
537  LONG cxFrame , cyFrame ; // Thickness of the window frame
538 
543  cxFrame = GetSystemMetrics(SM_CXFRAME);
544  cyFrame = GetSystemMetrics(SM_CYFRAME);
545 
550 
555 
557  (LPARAM)MAKELONG(xVirtScr + cxVirtScr - cxFrame, xVirtScr - cxFrame));
559  (LPARAM)MAKELONG(yVirtScr + cyVirtScr - cyFrame, yVirtScr - cyFrame));
560 
563 
564  if (ConInfo->AutoPosition)
565  {
570  }
573 
574  return TRUE;
575  }
576 
577  case WM_DISPLAYCHANGE:
578  {
579  /* Retransmit to the preview window */
581  WM_DISPLAYCHANGE, wParam, lParam);
582  break;
583  }
584 
585  case WM_NOTIFY:
586  {
587  LPPSHNOTIFY lppsn = (LPPSHNOTIFY)lParam;
588 
589  if (lppsn->hdr.code == UDN_DELTAPOS)
590  {
591  LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;
592  DWORD wheight, wwidth;
593  DWORD sheight, swidth;
594  DWORD left, top;
595 
597  {
598  wwidth = lpnmud->iPos + lpnmud->iDelta;
599  }
600  else
601  {
603  }
604 
606  {
607  wheight = lpnmud->iPos + lpnmud->iDelta;
608  }
609  else
610  {
612  }
613 
615  {
616  swidth = lpnmud->iPos + lpnmud->iDelta;
617  }
618  else
619  {
621  }
622 
624  {
625  sheight = lpnmud->iPos + lpnmud->iDelta;
626  }
627  else
628  {
630  }
631 
632  if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_POS_LEFT)
633  {
634  left = lpnmud->iPos + lpnmud->iDelta;
635  }
636  else
637  {
639  }
640 
641  if (lppsn->hdr.idFrom == IDC_UPDOWN_WINDOW_POS_TOP)
642  {
643  top = lpnmud->iPos + lpnmud->iDelta;
644  }
645  else
646  {
648  }
649 
651  {
652  /* Automatically adjust screen buffer size when window size enlarges */
653  if (wwidth >= swidth)
654  {
656  swidth = wwidth;
657  }
658  if (wheight >= sheight)
659  {
661  sheight = wheight;
662  }
663  }
664 
665  /* Be sure that the (new) screen buffer sizes are in the correct range */
666  swidth = min(max(swidth , 1), 0xFFFF);
667  sheight = min(max(sheight, 1), 0xFFFF);
668 
670  {
671  /* Automatically adjust window size when screen buffer decreases */
672  if (wwidth > swidth)
673  {
675  wwidth = swidth;
676  }
677  if (wheight > sheight)
678  {
680  wheight = sheight;
681  }
682  }
683 
684  ConInfo->ScreenBufferSize.X = (SHORT)swidth;
685  ConInfo->ScreenBufferSize.Y = (SHORT)sheight;
686  ConInfo->WindowSize.X = (SHORT)wwidth;
687  ConInfo->WindowSize.Y = (SHORT)wheight;
690 
692  PropSheet_Changed(GetParent(hDlg), hDlg);
693  }
694  break;
695  }
696 
697  case WM_COMMAND:
698  {
699  if (HIWORD(wParam) == EN_KILLFOCUS)
700  {
701  switch (LOWORD(wParam))
702  {
704  {
705  DWORD swidth, wwidth;
706 
709 
710  /* Be sure that the (new) screen buffer width is in the correct range */
711  swidth = min(max(swidth, 1), 0xFFFF);
712 
713  /* Automatically adjust window size when screen buffer decreases */
714  if (wwidth > swidth)
715  {
716  wwidth = swidth;
718  }
719 
720  ConInfo->ScreenBufferSize.X = (SHORT)swidth;
721  ConInfo->WindowSize.X = (SHORT)wwidth;
722 
724  PropSheet_Changed(GetParent(hDlg), hDlg);
725  break;
726  }
727 
729  {
730  DWORD swidth, wwidth;
731 
734 
735  /* Automatically adjust screen buffer size when window size enlarges */
736  if (wwidth >= swidth)
737  {
738  swidth = wwidth;
739 
740  /* Be sure that the (new) screen buffer width is in the correct range */
741  swidth = min(max(swidth, 1), 0xFFFF);
742 
744  }
745 
746  ConInfo->ScreenBufferSize.X = (SHORT)swidth;
747  ConInfo->WindowSize.X = (SHORT)wwidth;
748 
750  PropSheet_Changed(GetParent(hDlg), hDlg);
751  break;
752  }
753 
755  {
756  DWORD sheight, wheight;
757 
760 
761  /* Be sure that the (new) screen buffer width is in the correct range */
762  sheight = min(max(sheight, 1), 0xFFFF);
763 
764  /* Automatically adjust window size when screen buffer decreases */
765  if (wheight > sheight)
766  {
767  wheight = sheight;
769  }
770 
771  ConInfo->ScreenBufferSize.Y = (SHORT)sheight;
772  ConInfo->WindowSize.Y = (SHORT)wheight;
773 
775  PropSheet_Changed(GetParent(hDlg), hDlg);
776  break;
777  }
778 
780  {
781  DWORD sheight, wheight;
782 
785 
786  /* Automatically adjust screen buffer size when window size enlarges */
787  if (wheight >= sheight)
788  {
789  sheight = wheight;
790 
791  /* Be sure that the (new) screen buffer width is in the correct range */
792  sheight = min(max(sheight, 1), 0xFFFF);
793 
795  }
796 
797  ConInfo->ScreenBufferSize.Y = (SHORT)sheight;
798  ConInfo->WindowSize.Y = (SHORT)wheight;
799 
801  PropSheet_Changed(GetParent(hDlg), hDlg);
802  break;
803  }
804 
807  {
810 
812  PropSheet_Changed(GetParent(hDlg), hDlg);
813  break;
814  }
815  }
816  }
817  else
818  if (HIWORD(wParam) == BN_CLICKED &&
820  {
822  {
827 
829  // Do not touch ConInfo->WindowPosition !!
830 
832  PropSheet_Changed(GetParent(hDlg), hDlg);
833  }
834  else
835  {
836  ULONG left, top;
837 
840 
845 
849 
851  PropSheet_Changed(GetParent(hDlg), hDlg);
852  }
853  }
854 
855  break;
856  }
857 
858  default:
859  break;
860  }
861 
862  return FALSE;
863 }
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define max(a, b)
Definition: svc.c:63
#define IDC_EDIT_WINDOW_SIZE_WIDTH
Definition: resource.h:55
long y
Definition: polytest.cpp:48
#define SM_XVIRTUALSCREEN
Definition: winuser.h:1030
long x
Definition: polytest.cpp:48
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1032
struct _PSHNOTIFY * LPPSHNOTIFY
POINT WindowPosition
Definition: settings.h:34
#define TRUE
Definition: types.h:120
struct _NM_UPDOWN * LPNMUPDOWN
#define SM_CYFRAME
Definition: winuser.h:990
#define SM_CXFRAME
Definition: winuser.h:988
WPARAM wParam
Definition: combotst.c:138
UINT code
Definition: winuser.h:3139
NMHDR hdr
Definition: prsht.h:330
#define EN_KILLFOCUS
Definition: winuser.h:2012
#define IDC_UPDOWN_WINDOW_SIZE_HEIGHT
Definition: resource.h:58
#define FALSE
Definition: types.h:117
#define IDC_EDIT_WINDOW_POS_TOP
Definition: resource.h:61
long LONG
Definition: pedump.c:60
short SHORT
Definition: pedump.c:59
UINT_PTR idFrom
Definition: winuser.h:3138
#define IDC_UPDOWN_WINDOW_POS_TOP
Definition: resource.h:62
#define MAKELONG(a, b)
Definition: typedefs.h:249
UINT WINAPI GetDlgItemInt(_In_ HWND, _In_ int, _Out_opt_ PBOOL, _In_ BOOL)
#define IDC_STATIC_LAYOUT_WINDOW_PREVIEW
Definition: resource.h:64
LONG_PTR LPARAM
Definition: windef.h:208
#define IDC_UPDOWN_SCREEN_BUFFER_WIDTH
Definition: resource.h:51
#define UDM_SETRANGE
Definition: commctrl.h:2141
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1033
ULONG X
Definition: bl.h:1339
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDC_UPDOWN_WINDOW_POS_LEFT
Definition: resource.h:60
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
int WINAPI GetSystemMetrics(_In_ int)
#define BN_CLICKED
Definition: winuser.h:1912
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint left
Definition: glext.h:7726
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_EDIT_WINDOW_POS_LEFT
Definition: resource.h:59
BOOL WINAPI SetDlgItemInt(_In_ HWND, _In_ int, _In_ UINT, _In_ BOOL)
#define UDN_DELTAPOS
Definition: commctrl.h:2169
#define IDC_EDIT_WINDOW_SIZE_HEIGHT
Definition: resource.h:57
#define WM_COMMAND
Definition: winuser.h:1727
#define BST_UNCHECKED
Definition: winuser.h:199
#define SM_YVIRTUALSCREEN
Definition: winuser.h:1031
#define IDC_UPDOWN_WINDOW_SIZE_WIDTH
Definition: resource.h:56
#define IDC_EDIT_SCREEN_BUFFER_HEIGHT
Definition: resource.h:53
int iDelta
Definition: commctrl.h:2166
HWND WINAPI GetParent(_In_ HWND)
#define IDC_CHECK_SYSTEM_POS_WINDOW
Definition: resource.h:63
#define EnableDlgItem(hDlg, nID, bEnable)
Definition: eventvwr.h:52
PCONSOLE_STATE_INFO ConInfo
Definition: console.c:23
#define min(a, b)
Definition: monoChain.cc:55
#define NULL
Definition: types.h:112
#define BST_CHECKED
Definition: winuser.h:197
COORD ScreenBufferSize
Definition: settings.h:32
#define HIWORD(l)
Definition: typedefs.h:247
unsigned int ULONG
Definition: retypes.h:1
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
ULONG Y
Definition: bl.h:1340
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
#define IDC_UPDOWN_SCREEN_BUFFER_HEIGHT
Definition: resource.h:54
#define IDC_EDIT_SCREEN_BUFFER_WIDTH
Definition: resource.h:52

Referenced by InitApplet().

◆ OptionsProc()

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

Definition at line 860 of file magnifier.c.

861 {
863 
864  switch (message)
865  {
866  case WM_INITDIALOG:
867  {
868  /* Add the zoom items */
869  SendDlgItemMessage(hDlg, IDC_ZOOM, CB_ADDSTRING, 0, (LPARAM)("1"));
870  SendDlgItemMessage(hDlg, IDC_ZOOM, CB_ADDSTRING, 0, (LPARAM)("2"));
871  SendDlgItemMessage(hDlg, IDC_ZOOM, CB_ADDSTRING, 0, (LPARAM)("3"));
872  SendDlgItemMessage(hDlg, IDC_ZOOM, CB_ADDSTRING, 0, (LPARAM)("4"));
873  SendDlgItemMessage(hDlg, IDC_ZOOM, CB_ADDSTRING, 0, (LPARAM)("5"));
874  SendDlgItemMessage(hDlg, IDC_ZOOM, CB_ADDSTRING, 0, (LPARAM)("6"));
875  SendDlgItemMessage(hDlg, IDC_ZOOM, CB_ADDSTRING, 0, (LPARAM)("7"));
876  SendDlgItemMessage(hDlg, IDC_ZOOM, CB_ADDSTRING, 0, (LPARAM)("8"));
877  SendDlgItemMessage(hDlg, IDC_ZOOM, CB_ADDSTRING, 0, (LPARAM)("9"));
878 
879  if (uiZoom >= 1 && uiZoom <= 9)
881 
882  if (bFollowMouse)
884 
885  if (bFollowFocus)
887 
888  if (bFollowCaret)
890 
891  if (bInvertColors)
893 
894  if (bStartMinimized)
896 
897  if (bShowMagnifier)
899 
900  return (INT_PTR)TRUE;
901  }
902 
903  case WM_SHOWWINDOW:
905  break;
906 
907  case WM_COMMAND:
908  switch (LOWORD(wParam))
909  {
910  case IDOK:
911  case IDCANCEL:
912  ShowWindow(hDlg, SW_HIDE);
913  return (INT_PTR)TRUE;
914 
915  case IDC_BUTTON_HELP:
916  /* Unimplemented */
917  MessageBox(hDlg, TEXT("Magnifier help not available yet!"), TEXT("Help"), MB_OK);
918  break;
919 
920  case IDC_ZOOM:
921  if (HIWORD(wParam) == CBN_SELCHANGE)
922  {
923  HWND hCombo = GetDlgItem(hDlg,IDC_ZOOM);
924  TCHAR currentZoomValue[2] = TEXT("");
925 
926  /* Get index of current selection and the text of that selection */
927  int currentSelectionIndex = ComboBox_GetCurSel(hCombo);
928  ComboBox_GetLBText(hCombo, currentSelectionIndex, currentZoomValue);
929  uiZoom = (UINT)_ttoi(currentZoomValue);
930  /* The zoom factor cannot be smaller than 1 (and not zero) or greater than 9 */
931  if (uiZoom < 1 || uiZoom > 9)
932  uiZoom = 1;
933 
934  /* Trigger the Draw function to rezoom (which will be set false automatically after rezooming) */
936 
937  /* Update the magnifier UI */
938  Refresh();
939  }
940  break;
941 
944  Refresh();
945  break;
948  break;
951  break;
954  break;
957  break;
958  case IDC_SHOWMAGNIFIER:
961  break;
962  }
963  }
964 
965  return (INT_PTR)FALSE;
966 }
#define IDC_FOLLOWKEYBOARDCHECK
Definition: resource.h:17
BOOL bShowMagnifier
Definition: settings.c:24
#define IDC_ZOOM
Definition: resource.h:16
Definition: tftpd.h:59
#define IDOK
Definition: winuser.h:824
#define IDC_FOLLOWTEXTEDITINGCHECK
Definition: resource.h:18
#define ComboBox_GetLBText(hwndCtl, index, lpszBuffer)
Definition: windowsx.h:31
#define IDC_SHOWMAGNIFIERCHECK
Definition: resource.h:22
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define SW_HIDE
Definition: winuser.h:762
#define WM_SHOWWINDOW
Definition: winuser.h:1615
#define ComboBox_GetCurSel(hwndCtl)
Definition: windowsx.h:24
#define SendDlgItemMessage
Definition: winuser.h:5822
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:64
WPARAM wParam
Definition: combotst.c:138
#define IDC_STARTMINIMIZEDCHECK
Definition: resource.h:20
#define FALSE
Definition: types.h:117
BOOL bOptionsDialog
Definition: magnifier.c:48
#define CB_ADDSTRING
Definition: winuser.h:1923
#define IDC_SHOWMAGNIFIER
Definition: resource.h:21
LONG_PTR LPARAM
Definition: windef.h:208
#define SW_SHOW
Definition: winuser.h:769
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
char TCHAR
Definition: xmlstorage.h:189
#define BM_SETCHECK
Definition: winuser.h:1908
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
HWND hMainWnd
Definition: magnifier.c:32
BOOL bRecreateOffscreenDC
Definition: magnifier.c:49
BOOL bFollowMouse
Definition: settings.c:18
#define MessageBox
Definition: winuser.h:5802
#define CB_SETCURSEL
Definition: winuser.h:1948
#define WM_COMMAND
Definition: winuser.h:1727
UINT uiZoom
Definition: settings.c:14
#define TEXT(s)
Definition: k32.h:26
#define IDC_BUTTON_HELP
Definition: resource.h:17
int CDECL _ttoi(const _TCHAR *str)
Definition: atoi.c:10
BOOL bFollowCaret
Definition: settings.c:20
unsigned int UINT
Definition: ndis.h:50
#define MB_OK
Definition: winuser.h:784
#define CBN_SELCHANGE
Definition: winuser.h:1966
void Refresh(void)
Definition: magnifier.c:317
#define IDC_FOLLOWMOUSECHECK
Definition: resource.h:23
#define HIWORD(l)
Definition: typedefs.h:247
#define IDCANCEL
Definition: winuser.h:825
BOOL bStartMinimized
Definition: settings.c:23
#define WM_INITDIALOG
Definition: winuser.h:1726
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDC_INVERTCOLORSCHECK
Definition: resource.h:19
BOOL bInvertColors
Definition: settings.c:22
BOOL bFollowFocus
Definition: settings.c:19

Referenced by InitApplet(), and InitInstance().

◆ PropSheetProc()

static int CALLBACK PropSheetProc ( HWND  hwndDlg,
UINT  uMsg,
LPARAM  lParam 
)
static

Definition at line 137 of file console.c.

138 {
139  // NOTE: This callback is needed to set large icon correctly.
140  HICON hIcon;
141  switch (uMsg)
142  {
143  case PSCB_INITIALIZED:
144  {
146  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
147  break;
148  }
149  }
150  return 0;
151 }
static HICON
Definition: imagelist.c:84
#define IDC_CPLICON
Definition: resource.h:7
LONG_PTR LPARAM
Definition: windef.h:208
HINSTANCE hApplet
Definition: console.c:20
#define PSCB_INITIALIZED
Definition: prsht.h:75
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ICON_BIG
Definition: tnclass.cpp:51

Referenced by InitApplet().

Variable Documentation

◆ ConInfo

◆ hApplet

HINSTANCE hApplet = NULL

Definition at line 20 of file console.c.

Referenced by ApplyConsoleInfo(), DllMain(), InitApplet(), InitPropSheetPage(), and PropSheetProc().

◆ SaveConsoleInfo

BOOL SaveConsoleInfo = FALSE
static

Definition at line 26 of file console.c.

Referenced by ApplyConsoleInfo(), and InitApplet().

◆ SetConsoleInfo

BOOL SetConsoleInfo = FALSE
static

Definition at line 25 of file console.c.

Referenced by ApplyConsoleInfo(), and InitApplet().