--- /dev/null
+/*
+ * PROJECT: ReactOS On-Screen Keyboard
+ * LICENSE: GPL - See COPYING in the top level directory
+ * PURPOSE: Pre-compiled header
+ * COPYRIGHT: Denis ROBERT
+ * Copyright 2019 Bișoc George (fraizeraust99 at gmail dot com)
+ */
+
+#ifndef _OSK_PRECOMP_H
+#define _OSK_PRECOMP_H
+
+/* INCLUDES *******************************************************************/
+
+#include <stdio.h>
+
+#include <windows.h>
+#include <commctrl.h>
+#include <debug.h>
+#include <uxtheme.h>
+#include <vsstyle.h>
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "winnls.h"
+#include "commctrl.h"
+
+#include "osk_res.h"
+
+/* TYPES **********************************************************************/
+
+typedef struct
+{
+ HINSTANCE hInstance;
+ HWND hMainWnd;
+ HBRUSH hBrushGreenLed;
+ UINT_PTR iTimer;
+ /* FIXME: To be deleted when ReactOS will support WS_EX_NOACTIVATE */
+ HWND hActiveWnd;
+
+ /* On-Screen Keyboard registry settings */
+ BOOL bShowWarning;
+ BOOL bIsEnhancedKeyboard;
+ BOOL bSoundClick;
+ BOOL bAlwaysOnTop;
+ INT PosX;
+ INT PosY;
+} OSK_GLOBALS;
+
+/* PROTOTYPES *****************************************************************/
+
+/* main.c */
+int OSK_SetImage(int IdDlgItem, int IdResource);
+int OSK_DlgInitDialog(HWND hDlg);
+int OSK_DlgClose(void);
+int OSK_DlgTimer(void);
+BOOL OSK_DlgCommand(WPARAM wCommand, HWND hWndControl);
+BOOL OSK_ReleaseKey(WORD ScanCode);
+INT_PTR APIENTRY OSK_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+LRESULT APIENTRY OSK_ThemeHandler(HWND hDlg, NMCUSTOMDRAW *pNmDraw);
+int WINAPI wWinMain(HINSTANCE, HINSTANCE, LPWSTR, int);
+VOID OSK_RestoreDlgPlacement(HWND hDlg);
+
+/* settings.c */
+BOOL LoadDataFromRegistry(VOID);
+BOOL SaveDataToRegistry(VOID);
+INT_PTR CALLBACK OSK_WarningProc(HWND hDlg, UINT Msg, WPARAM wParam, LPARAM lParam);
+
+/* DEFINES ********************************************************************/
+
+extern OSK_GLOBALS Globals;
+
+#define countof(x) (sizeof(x) / sizeof((x)[0]))
+#define MAX_BUFF 256
+
+#endif /* _OSK_PRECOMP_H */
+
+/* EOF */
/* INCLUDES *******************************************************************/
-#include "osk.h"
-#include "settings.h"
+#include "precomp.h"
/* FUNCTIONS *******************************************************************/
-BOOL LoadDataFromRegistry()
+BOOL LoadDataFromRegistry(VOID)
{
HKEY hKey;
LONG lResult;
- DWORD dwShowWarningData, dwLayout, dwSoundOnClick, dwPositionLeft, dwPositionTop, dwAlwaysOnTop;
+ DWORD dwValue;
DWORD cbData = sizeof(DWORD);
/* Initialize the registry application settings */
L"ShowWarning",
0,
0,
- (BYTE *)&dwShowWarningData,
+ (BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
}
/* Load the data value (it can be either FALSE or TRUE depending on the data itself) */
- Globals.bShowWarning = (dwShowWarningData != 0);
+ Globals.bShowWarning = (dwValue != 0);
/* Query the key */
lResult = RegQueryValueExW(hKey,
L"IsEnhancedKeyboard",
0,
0,
- (BYTE *)&dwLayout,
+ (BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
}
/* Load the dialog layout value */
- Globals.bIsEnhancedKeyboard = (dwLayout != 0);
+ Globals.bIsEnhancedKeyboard = (dwValue != 0);
/* Query the key */
lResult = RegQueryValueExW(hKey,
L"ClickSound",
0,
0,
- (BYTE *)&dwSoundOnClick,
+ (BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
}
/* Load the sound on click value event */
- Globals.bSoundClick = (dwSoundOnClick != 0);
+ Globals.bSoundClick = (dwValue != 0);
/* Query the key */
lResult = RegQueryValueExW(hKey,
L"WindowLeft",
0,
0,
- (BYTE *)&dwPositionLeft,
+ (BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
}
/* Load the X value data of the dialog's coordinate */
- Globals.PosX = dwPositionLeft;
+ Globals.PosX = dwValue;
lResult = RegQueryValueExW(hKey,
L"WindowTop",
0,
0,
- (BYTE *)&dwPositionTop,
+ (BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
}
/* Load the Y value data of the dialog's coordinate */
- Globals.PosY = dwPositionTop;
+ Globals.PosY = dwValue;
lResult = RegQueryValueExW(hKey,
L"AlwaysOnTop",
0,
0,
- (BYTE *)&dwAlwaysOnTop,
+ (BYTE *)&dwValue,
&cbData);
if (lResult != ERROR_SUCCESS)
}
/* Load the window state value data */
- Globals.bAlwaysOnTop = (dwAlwaysOnTop != 0);
+ Globals.bAlwaysOnTop = (dwValue != 0);
/* If we're here then we succeed, close the key and return TRUE */
RegCloseKey(hKey);
return TRUE;
}
-BOOL SaveDataToRegistry()
+BOOL SaveDataToRegistry(VOID)
{
HKEY hKey;
LONG lResult;
- DWORD dwShowWarningData, dwLayout, dwSoundOnClick, dwPositionLeft, dwPositionTop, dwAlwaysOnTop;
+ DWORD dwValue;
WINDOWPLACEMENT wp;
/* Set the structure length and retrieve the dialog's placement */
}
/* The data value of the subkey will be appended to the warning dialog switch */
- dwShowWarningData = Globals.bShowWarning;
+ dwValue = Globals.bShowWarning;
/* Welcome warning box value key */
lResult = RegSetValueExW(hKey,
L"ShowWarning",
0,
REG_DWORD,
- (BYTE *)&dwShowWarningData,
- sizeof(dwShowWarningData));
+ (BYTE *)&dwValue,
+ sizeof(dwValue));
if (lResult != ERROR_SUCCESS)
{
}
/* The value will be appended to the layout dialog */
- dwLayout = Globals.bIsEnhancedKeyboard;
+ dwValue = Globals.bIsEnhancedKeyboard;
/* Keyboard dialog switcher */
lResult = RegSetValueExW(hKey,
L"IsEnhancedKeyboard",
0,
REG_DWORD,
- (BYTE *)&dwLayout,
- sizeof(dwLayout));
+ (BYTE *)&dwValue,
+ sizeof(dwValue));
if (lResult != ERROR_SUCCESS)
{
}
/* The value will be appended to the sound on click event */
- dwSoundOnClick = Globals.bSoundClick;
+ dwValue = Globals.bSoundClick;
/* "Sound on Click" switcher value key */
lResult = RegSetValueExW(hKey,
L"ClickSound",
0,
REG_DWORD,
- (BYTE *)&dwSoundOnClick,
- sizeof(dwSoundOnClick));
+ (BYTE *)&dwValue,
+ sizeof(dwValue));
if (lResult != ERROR_SUCCESS)
{
}
/* The value will be appended to the X coordination dialog's placement */
- dwPositionLeft = wp.rcNormalPosition.left;
+ dwValue = wp.rcNormalPosition.left;
/* Position X coordination of dialog's placement value key */
lResult = RegSetValueExW(hKey,
L"WindowLeft",
0,
REG_DWORD,
- (BYTE *)&dwPositionLeft,
- sizeof(dwPositionLeft));
+ (BYTE *)&dwValue,
+ sizeof(dwValue));
if (lResult != ERROR_SUCCESS)
{
}
/* The value will be appended to the Y coordination dialog's placement */
- dwPositionTop = wp.rcNormalPosition.top;
+ dwValue = wp.rcNormalPosition.top;
/* Position Y coordination of dialog's placement value key */
lResult = RegSetValueExW(hKey,
L"WindowTop",
0,
REG_DWORD,
- (BYTE *)&dwPositionTop,
- sizeof(dwPositionTop));
+ (BYTE *)&dwValue,
+ sizeof(dwValue));
if (lResult != ERROR_SUCCESS)
{
}
/* Window top state value */
- dwAlwaysOnTop = Globals.bAlwaysOnTop;
+ dwValue = Globals.bAlwaysOnTop;
/* "Always on Top" state value key */
lResult = RegSetValueExW(hKey,
L"AlwaysOnTop",
0,
REG_DWORD,
- (BYTE *)&dwAlwaysOnTop,
- sizeof(dwAlwaysOnTop));
+ (BYTE *)&dwValue,
+ sizeof(dwValue));
if (lResult != ERROR_SUCCESS)
{