ReactOS  0.4.13-dev-651-g5dbc677
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 == FALSE)
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 }
#define TRUE
Definition: types.h:120
static INT_PTR CALLBACK ApplyProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: console.c:51
static BOOL SetConsoleInfo
Definition: console.c:25
int32_t INT_PTR
Definition: typedefs.h:62
#define SetWindowLongPtr
Definition: treelist.c:70
#define DWLP_MSGRESULT
Definition: winuser.h:864
unsigned int BOOL
Definition: ntddk_ex.h:94
#define PSNRET_INVALID_NOCHANGEPAGE
Definition: prsht.h:131
smooth NULL
Definition: ftsmooth.c:416
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4300
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
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 TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define IDC_RADIO_APPLY_CURRENT
Definition: resource.h:35
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1722
#define BST_CHECKED
Definition: winuser.h:197
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1721
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 39 of file colors.c.

43 {
44  DWORD colorIndex;
46 
47  switch (uMsg)
48  {
49  case WM_INITDIALOG:
50  {
51  /* Set the valid range of the colour indicators */
55 
56  /* Select by default the screen background option */
59 
60  return TRUE;
61  }
62 
63  case WM_DRAWITEM:
64  {
66 
67  if (IDC_STATIC_COLOR1 <= drawItem->CtlID && drawItem->CtlID <= IDC_STATIC_COLOR16)
68  PaintStaticControls(drawItem, ConInfo);
69  else if (drawItem->CtlID == IDC_STATIC_SCREEN_COLOR)
70  PaintText(drawItem, ConInfo, Screen);
71  else if (drawItem->CtlID == IDC_STATIC_POPUP_COLOR)
72  PaintText(drawItem, ConInfo, Popup);
73 
74  return TRUE;
75  }
76 
77  case WM_NOTIFY:
78  {
79  switch (((LPNMHDR)lParam)->code)
80  {
81  case PSN_APPLY:
82  {
83  ApplyConsoleInfo(hDlg);
84  return TRUE;
85  }
86 
87  case UDN_DELTAPOS:
88  {
89  LPNMUPDOWN lpnmud = (LPNMUPDOWN)lParam;
90 
91  /* Get the current color */
92  colorIndex = ActiveStaticControl;
93  color = ConInfo->ColorTable[colorIndex];
94 
95  if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_RED)
96  {
97  lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
98  color = RGB(lpnmud->iPos, GetGValue(color), GetBValue(color));
99  }
100  else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_GREEN)
101  {
102  lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
103  color = RGB(GetRValue(color), lpnmud->iPos, GetBValue(color));
104  }
105  else if (lpnmud->hdr.idFrom == IDC_UPDOWN_COLOR_BLUE)
106  {
107  lpnmud->iPos = min(max(lpnmud->iPos + lpnmud->iDelta, 0), 255);
108  color = RGB(GetRValue(color), GetGValue(color), lpnmud->iPos);
109  }
110  else
111  {
112  break;
113  }
114 
115  ConInfo->ColorTable[colorIndex] = color;
116  InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
119 
120  PropSheet_Changed(GetParent(hDlg), hDlg);
121  break;
122  }
123  }
124 
125  break;
126  }
127 
128  case WM_COMMAND:
129  {
130  /* NOTE: both BN_CLICKED and STN_CLICKED == 0 */
132  {
137  {
138  switch (LOWORD(wParam))
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
175  {
176  colorIndex = LOWORD(wParam) - 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  if (LOWORD(wParam) == IDC_EDIT_COLOR_RED ||
221  {
222  DWORD value;
223 
224  /* Get the current colour */
225  colorIndex = ActiveStaticControl;
226  color = ConInfo->ColorTable[colorIndex];
227 
228  /* Modify the colour component */
229  switch (LOWORD(wParam))
230  {
231  case IDC_EDIT_COLOR_RED:
233  value = min(max(value, 0), 255);
235  break;
236 
239  value = min(max(value, 0), 255);
241  break;
242 
243  case IDC_EDIT_COLOR_BLUE:
245  value = min(max(value, 0), 255);
247  break;
248  }
249 
250  ConInfo->ColorTable[colorIndex] = color;
251  InvalidateRect(GetDlgItem(hDlg, IDC_STATIC_COLOR1 + colorIndex), NULL, TRUE);
254 
255  PropSheet_Changed(GetParent(hDlg), hDlg);
256  break;
257  }
258  }
259 
260  break;
261  }
262 
263  default:
264  break;
265  }
266 
267  return FALSE;
268 }
#define IDC_RADIO_POPUP_BACKGROUND
Definition: resource.h:71
#define max(a, b)
Definition: svc.c:63
#define TRUE
Definition: types.h:120
USHORT ScreenAttributes
Definition: settings.h:47
NMHDR hdr
Definition: commctrl.h:2136
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define IDC_UPDOWN_COLOR_RED
Definition: resource.h:73
struct _NM_UPDOWN * LPNMUPDOWN
#define GetRValue(rgb)
Definition: wingdi.h:2913
#define PSN_APPLY
Definition: prsht.h:117
WPARAM wParam
Definition: combotst.c:138
#define IDC_STATIC_POPUP_COLOR
Definition: resource.h:79
#define GetGValue(rgb)
Definition: wingdi.h:2914
#define EN_KILLFOCUS
Definition: winuser.h:2007
static VOID PaintStaticControls(IN LPDRAWITEMSTRUCT drawItem, IN PCONSOLE_STATE_INFO pConInfo)
Definition: colors.c:18
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:3132
COLORREF ColorTable[16]
Definition: settings.h:53
#define MAKELONG(a, b)
Definition: typedefs.h:248
#define IDC_EDIT_COLOR_RED
Definition: resource.h:72
smooth NULL
Definition: ftsmooth.c:416
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 IDC_EDIT_COLOR_GREEN
Definition: resource.h:74
#define IDC_RADIO_SCREEN_TEXT
Definition: resource.h:68
#define UDM_SETRANGE
Definition: commctrl.h:2113
#define IDC_UPDOWN_COLOR_BLUE
Definition: resource.h:77
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define BkgdAttribFromAttrib(Attribute)
Definition: settings.h:73
#define STN_CLICKED
Definition: winuser.h:2076
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
DWORD COLORREF
Definition: windef.h:285
#define RGB(r, g, b)
Definition: wingdi.h:2918
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
#define BN_CLICKED
Definition: winuser.h:1907
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:2141
#define WM_COMMAND
Definition: winuser.h:1722
#define TextAttribFromAttrib(Attribute)
Definition: settings.h:72
GLsizei const GLfloat * value
Definition: glext.h:6069
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:2138
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 WM_DRAWITEM
Definition: winuser.h:1627
#define HIWORD(l)
Definition: typedefs.h:246
#define GetBValue(rgb)
Definition: wingdi.h:2915
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:1721
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 336 of file console.c.

340 {
341  switch (uMsg)
342  {
343  case CPL_INIT:
344  return TRUE;
345 
346  case CPL_EXIT:
347  // TODO: Free allocated memory
348  break;
349 
350  case CPL_GETCOUNT:
351  return 1;
352 
353  case CPL_INQUIRE:
354  {
355  CPLINFO *CPlInfo = (CPLINFO*)lParam2;
356  CPlInfo->idIcon = IDC_CPLICON;
357  CPlInfo->idName = IDS_CPLNAME;
358  CPlInfo->idInfo = IDS_CPLDESCRIPTION;
359  break;
360  }
361 
362  case CPL_DBLCLK:
363  InitApplet((HANDLE)hwndCPl);
364  break;
365  }
366 
367  return FALSE;
368 }
#define TRUE
Definition: types.h:120
Definition: cpl.h:24
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 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 372 of file console.c.

375 {
377 
378  switch (dwReason)
379  {
380  case DLL_PROCESS_ATTACH:
381  hApplet = hinstDLL;
382  DisableThreadLibraryCalls(hinstDLL);
383  break;
384  }
385 
386  return TRUE;
387 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
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 699 of file font.c.

703 {
704  PFONTSIZE_LIST_CTL SizeList;
705 
707 
708  switch (uMsg)
709  {
710  case WM_INITDIALOG:
711  {
712  HWND hFontList = GetDlgItem(hDlg, IDC_LBOX_FONTTYPE);
713 
714  SizeList = (PFONTSIZE_LIST_CTL)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*SizeList));
715  if (!SizeList)
716  {
717  EndDialog(hDlg, 0);
718  return (INT_PTR)TRUE;
719  }
723  SizeList->hWndTTSizeList = GetDlgItem(hDlg, IDC_CBOX_FONTSIZE);
724  SizeList->bIsTTSizeDirty = FALSE;
725  SetWindowLongPtrW(hDlg, DWLP_USER, (LONG_PTR)SizeList);
726 
727  /* By default show the raster font size list */
728  SizeList->UseRasterOrTTList = TRUE;
729 
730  /* By default show the font sizes in pixel units */
732  SizeList->TTSizePixelUnit = TRUE;
733 
734  UpdateFontSizeList(hDlg, SizeList);
735 
736  /* Initialize the font list */
738 
739  /* Select the current font */
740  DPRINT1("ConInfo->FaceName = '%S'\n", ConInfo->FaceName);
741  FaceNameList_SelectFont(hDlg, hFontList,
742  SizeList,
743  ConInfo->FaceName,
746  ConInfo->FontSize);
747 
748  /* Refresh everything */
749  FontTypeChange(hDlg, SizeList, ConInfo);
750 
751  return TRUE;
752  }
753 
754  case WM_DESTROY:
755  {
756  if (SizeList)
757  HeapFree(GetProcessHeap(), 0, SizeList);
758  return (INT_PTR)TRUE;
759  }
760 
761  case WM_DRAWITEM:
762  {
764 
765  if (drawItem->CtlID == IDC_STATIC_SELECT_FONT_PREVIEW)
766  PaintText(drawItem, ConInfo, Screen);
767 
768  return TRUE;
769  }
770 
771  case WM_DISPLAYCHANGE:
772  {
773  /* Retransmit to the preview window */
775  WM_DISPLAYCHANGE, wParam, lParam);
776  break;
777  }
778 
779 #if 0
780  case PSM_QUERYSIBLINGS:
781  {
782  /*
783  * If this is a notification from the "Options" dialog because we
784  * changed the code page, treat it using the WM_FONTCHANGE case,
785  * otherwise ignore it.
786  */
787  if (wParam != IDL_CODEPAGE)
788  return FALSE;
789 
790  /* Fall through */
791  }
792 #endif
793 
794  case WM_FONTCHANGE:
795  {
796  /* The pool of font resources has changed, re-enumerate the fonts */
797  HWND hFontList = GetDlgItem(hDlg, IDC_LBOX_FONTTYPE);
798 
799  /* Initialize the font list */
801 
802  /* Select the current font */
803  FaceNameList_SelectFont(hDlg, hFontList,
804  SizeList,
805  ConInfo->FaceName,
808  ConInfo->FontSize);
809 
810  /* Refresh everything */
811  FontTypeChange(hDlg, SizeList, ConInfo);
812  break;
813  }
814 
815  case WM_NOTIFY:
816  {
817  switch (((LPNMHDR)lParam)->code)
818  {
819  case PSN_APPLY:
820  {
821  ApplyConsoleInfo(hDlg);
822  return TRUE;
823  }
824  }
825 
826  break;
827  }
828 
829  case WM_COMMAND:
830  {
831  if (HIWORD(wParam) == LBN_SELCHANGE /* || CBN_SELCHANGE */)
832  {
833  switch (LOWORD(wParam))
834  {
835  case IDC_LBOX_FONTTYPE:
836  {
837  /* Change the property sheet state only if the font has really changed */
838  if (FontTypeChange(hDlg, SizeList, ConInfo))
839  PropSheet_Changed(GetParent(hDlg), hDlg);
840  break;
841  }
842 
843  case IDC_LBOX_FONTSIZE:
844  case IDC_CBOX_FONTSIZE:
845  {
846  /* Change the property sheet state only if the font has really changed */
847  if (FontSizeChange(hDlg, SizeList, ConInfo))
848  PropSheet_Changed(GetParent(hDlg), hDlg);
849  break;
850  }
851  }
852  }
853  /* NOTE: CBN_EDITUPDATE is sent first, and is followed by CBN_EDITCHANGE */
855  {
856  ULONG FontSize;
857  PWCHAR pszNext = NULL;
858  WCHAR szFontSize[100];
859  WCHAR szMessage[260];
860 
861  /* Read the ComboBox edit string, as the user has entered a custom size */
862  GetWindowTextW(SizeList->hWndTTSizeList, szFontSize, ARRAYSIZE(szFontSize));
863 
864  /* Validate the font size */
865  FontSize = wcstoul(szFontSize, &pszNext, 10);
866  if ((FontSize == 0) || (*pszNext))
867  {
868  // FIXME: Localize!
869  StringCchPrintfW(szMessage, ARRAYSIZE(szMessage), L"\"%s\" is not a valid font size.", szFontSize);
870  MessageBoxW(hDlg, szMessage, L"Error", MB_ICONINFORMATION | MB_OK);
871  }
872  SizeList->bIsTTSizeDirty = TRUE;
873  }
875  {
876  /* Change the property sheet state only if the font has really changed */
877  if (FontSizeChange(hDlg, SizeList, ConInfo))
878  PropSheet_Changed(GetParent(hDlg), hDlg);
879  }
880  else
881  if (HIWORD(wParam) == BN_CLICKED)
882  {
883  switch (LOWORD(wParam))
884  {
886  {
889  else
891 
892  FontTypeChange(hDlg, SizeList, ConInfo);
893  PropSheet_Changed(GetParent(hDlg), hDlg);
894  break;
895  }
896 
899  {
901 
902  /* The call is valid only for TrueType fonts */
904  break;
905 
906  /* Change the property sheet state only if the font has really changed */
907  if (FontSizeChange(hDlg, SizeList, ConInfo))
908  PropSheet_Changed(GetParent(hDlg), hDlg);
909  break;
910  }
911  }
912  }
913 
914  break;
915  }
916 
917  default:
918  break;
919  }
920 
921  return FALSE;
922 }
#define IDC_RADIO_POINT_UNIT
Definition: resource.h:45
#define TRUE
Definition: types.h:120
#define IDC_RADIO_PIXEL_UNIT
Definition: resource.h:44
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
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:4730
uint16_t * PWCHAR
Definition: typedefs.h:54
_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:62
BOOL TTSizePixelUnit
Definition: font.c:38
#define LBN_SELCHANGE
Definition: winuser.h:2057
static INT RasterSizeList_GetCount(IN PLIST_CTL ListCtl)
Definition: font.c:75
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 CBN_KILLFOCUS
Definition: winuser.h:1960
struct _FONTSIZE_LIST_CTL * PFONTSIZE_LIST_CTL
smooth NULL
Definition: ftsmooth.c:416
VOID ApplyConsoleInfo(HWND hwndDlg)
Definition: console.c:88
static ULONG_PTR RasterSizeList_GetData(IN PLIST_CTL ListCtl, IN INT Index)
Definition: font.c:83
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define WM_DESTROY
Definition: winuser.h:1591
#define GetProcessHeap()
Definition: compat.h:395
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:326
static BOOL FontSizeChange(IN HWND hDlg, IN PFONTSIZE_LIST_CTL SizeList, IN OUT PCONSOLE_STATE_INFO pConInfo)
Definition: font.c:633
LIST_CTL RasterSizeList
Definition: font.c:34
#define IDC_STATIC_FONT_WINDOW_PREVIEW
Definition: resource.h:46
#define BN_CLICKED
Definition: winuser.h:1907
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:381
#define WM_FONTCHANGE
Definition: winuser.h:1615
#define MB_ICONINFORMATION
Definition: winuser.h:796
PLIST_GETCOUNT GetCount
Definition: console.h:94
static const WCHAR L[]
Definition: oid.c:1250
WCHAR FaceName[LF_FACESIZE]
Definition: settings.h:39
#define DWLP_USER
Definition: winuser.h:866
#define WM_COMMAND
Definition: winuser.h:1722
#define IDL_CODEPAGE
Definition: resource.h:31
#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:377
int WINAPI GetWindowTextW(HWND hWnd, LPWSTR lpString, int nMaxCount)
Definition: window.c:1378
#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 MB_OK
Definition: winuser.h:784
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define BST_CHECKED
Definition: winuser.h:197
#define FW_NORMAL
Definition: wingdi.h:372
BOOL bIsTTSizeDirty
Definition: font.c:36
#define DPRINT1
Definition: precomp.h:8
#define PSM_QUERYSIBLINGS
Definition: prsht.h:160
#define WM_DRAWITEM
Definition: winuser.h:1627
BOOL UseRasterOrTTList
Definition: font.c:37
#define CBN_EDITUPDATE
Definition: winuser.h:1958
#define HIWORD(l)
Definition: typedefs.h:246
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:520
static VOID UpdateFontSizeList(IN HWND hDlg, IN PFONTSIZE_LIST_CTL SizeList)
Definition: font.c:455
BOOL WINAPI CheckRadioButton(_In_ HWND, _In_ int, _In_ int, _In_ int)
#define SetWindowLongPtrW
Definition: winuser.h:5247
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:418
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:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394
#define WM_NOTIFY
Definition: richedit.h:61
#define TRUETYPE_FONTTYPE
Definition: wingdi.h:1091

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 fonts 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  /* Save the console settings */
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 */
307  RtlCopyMemory(pSharedInfo, ConInfo, ConInfo->cbSize);
308 
309  /* Unmap it */
310  UnmapViewOfFile(pSharedInfo);
311 
312  /* Signal to CONSRV that it can apply the new configuration */
314 
315  /* Close the section and return */
317  }
318 
319  if (SaveConsoleInfo)
320  {
321  /* Default settings saved when ConInfo->hWnd == NULL */
323  }
324 
325 Quit:
326  /* Cleanup */
328  ConInfo = NULL;
329 
330  return (Result != -1);
331 }
HWND hwndParent
Definition: prsht.h:277
#define IDD_PROPPAGEOPTIONS
Definition: resource.h:12
NTSYSAPI VOID NTAPI RtlCopyMemory(VOID UNALIGNED *Destination, CONST VOID UNALIGNED *Source, ULONG Length)
#define CloseHandle
Definition: compat.h:398
LPCPROPSHEETPAGEW ppsp
Definition: prsht.h:290
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
#define MapViewOfFile
Definition: compat.h:402
static VOID InitDefaultConsoleInfo(PCONSOLE_STATE_INFO pConInfo)
Definition: console.c:43
HANDLE HWND
Definition: compat.h:13
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1635
UINT_PTR WPARAM
Definition: windef.h:207
static BOOL SetConsoleInfo
Definition: console.c:25
int32_t INT_PTR
Definition: typedefs.h:62
#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:39
int32_t INT
Definition: typedefs.h:56
VOID InitTTFontCache(VOID)
Definition: font.c:391
VOID ClearTTFontCache(VOID)
Definition: font.c:500
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_USEICONID
Definition: prsht.h:42
#define UNICODE_NULL
LPCWSTR pszCaption
Definition: prsht.h:283
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:149
PFNPROPSHEETCALLBACK pfnCallback
Definition: prsht.h:293
smooth NULL
Definition: ftsmooth.c:416
_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:427
BOOL UnRegisterWinPrevClass(IN HINSTANCE hInstance)
Definition: layout.c:52
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2896
#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:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__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:401
HINSTANCE hInstance
Definition: prsht.h:278
#define MAX_PATH
Definition: compat.h:26
LPCWSTR pszIcon
Definition: prsht.h:281
DWORD dwSize
Definition: prsht.h:275
DWORD dwFlags
Definition: prsht.h:276
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
ASSERT((InvokeOnSuccess||InvokeOnError||InvokeOnCancel) ?(CompletionRoutine !=NULL) :TRUE)
static const WCHAR L[]
Definition: oid.c:1250
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
#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:49
PCONSOLE_STATE_INFO ConInfo
Definition: console.c:23
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: console.c:137
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define ResetFontPreview(Preview)
Definition: console.h:65
WCHAR ConsoleTitle[ANYSIZE_ARRAY]
Definition: settings.h:58
#define DPRINT1
Definition: precomp.h:8
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define UnmapViewOfFile
Definition: compat.h:403
BOOL RegisterWinPrevClass(IN HINSTANCE hInstance)
Definition: layout.c:32
_In_ const BITMAPINFO _In_ UINT _In_opt_ HANDLE hSection
Definition: wingdi.h:3217
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:699
#define HeapFree(x, y, z)
Definition: compat.h:394
#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:286

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:109
LPCWSTR pszTemplate
Definition: prsht.h:209
#define ZeroMemory
Definition: winbase.h:1635
DWORD dwSize
Definition: prsht.h:205
DLGPROC pfnDlgProc
Definition: prsht.h:217
#define PSP_DEFAULT
Definition: prsht.h:22
HINSTANCE hApplet
Definition: console.c:20
LPARAM lParam
Definition: prsht.h:218
HINSTANCE hInstance
Definition: prsht.h:207
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
DLGPROC DlgProc
Definition: desk.c:110
DWORD dwFlags
Definition: prsht.h:206

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
#define TRUE
Definition: types.h:120
long y
Definition: polytest.cpp:48
#define SM_XVIRTUALSCREEN
Definition: winuser.h:1026
long x
Definition: polytest.cpp:48
#define SM_CXVIRTUALSCREEN
Definition: winuser.h:1028
struct _PSHNOTIFY * LPPSHNOTIFY
POINT WindowPosition
Definition: settings.h:34
struct _NM_UPDOWN * LPNMUPDOWN
#define SM_CYFRAME
Definition: winuser.h:986
#define SM_CXFRAME
Definition: winuser.h:984
WPARAM wParam
Definition: combotst.c:138
UINT code
Definition: winuser.h:3133
NMHDR hdr
Definition: prsht.h:312
#define EN_KILLFOCUS
Definition: winuser.h:2007
#define IDC_UPDOWN_WINDOW_SIZE_HEIGHT
Definition: resource.h:58
#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:3132
#define IDC_UPDOWN_WINDOW_POS_TOP
Definition: resource.h:62
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
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:2113
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define SM_CYVIRTUALSCREEN
Definition: winuser.h:1029
ULONG X
Definition: bl.h:1340
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:326
BOOL WINAPI InvalidateRect(_In_opt_ HWND, _In_opt_ LPCRECT, _In_ BOOL)
int WINAPI GetSystemMetrics(_In_ int)
#define BN_CLICKED
Definition: winuser.h:1907
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:2141
#define IDC_EDIT_WINDOW_SIZE_HEIGHT
Definition: resource.h:57
#define WM_COMMAND
Definition: winuser.h:1722
#define BST_UNCHECKED
Definition: winuser.h:199
#define SM_YVIRTUALSCREEN
Definition: winuser.h:1027
#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:2138
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 BST_CHECKED
Definition: winuser.h:197
COORD ScreenBufferSize
Definition: settings.h:32
#define HIWORD(l)
Definition: typedefs.h:246
unsigned int ULONG
Definition: retypes.h:1
GLdouble GLdouble GLdouble GLdouble top
Definition: glext.h:10859
ULONG Y
Definition: bl.h:1341
#define WM_INITDIALOG
Definition: winuser.h:1721
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 TRUE
Definition: types.h:120
#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 UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define SW_HIDE
Definition: winuser.h:762
#define WM_SHOWWINDOW
Definition: winuser.h:1610
#define ComboBox_GetCurSel(hwndCtl)
Definition: windowsx.h:24
#define SendDlgItemMessage
Definition: winuser.h:5740
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:62
WPARAM wParam
Definition: combotst.c:138
#define IDC_STARTMINIMIZEDCHECK
Definition: resource.h:20
BOOL bOptionsDialog
Definition: magnifier.c:48
#define CB_ADDSTRING
Definition: winuser.h:1918
#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:1903
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:5720
#define CB_SETCURSEL
Definition: winuser.h:1943
#define WM_COMMAND
Definition: winuser.h:1722
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:1961
void Refresh(void)
Definition: magnifier.c:317
#define IDC_FOLLOWMOUSECHECK
Definition: resource.h:23
#define HIWORD(l)
Definition: typedefs.h:246
#define IDCANCEL
Definition: winuser.h:825
BOOL bStartMinimized
Definition: settings.c:23
#define WM_INITDIALOG
Definition: winuser.h:1721
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().