mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 17:56:00 +00:00
- Move around definitions to make the code a bit more modular
- Use an about menu instead of an button svn path=/trunk/; revision=25828
This commit is contained in:
parent
15b0d2660f
commit
316942e612
6 changed files with 113 additions and 74 deletions
|
@ -1,7 +1,7 @@
|
|||
#include <precomp.h>
|
||||
|
||||
|
||||
INT_PTR CALLBACK
|
||||
static INT_PTR CALLBACK
|
||||
AboutDialogProc(HWND hDlg,
|
||||
UINT message,
|
||||
WPARAM wParam,
|
||||
|
@ -53,3 +53,12 @@ AboutDialogProc(HWND hDlg,
|
|||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VOID
|
||||
ShowAboutDlg(HWND hWndParent)
|
||||
{
|
||||
DialogBox(hInstance,
|
||||
MAKEINTRESOURCE(IDD_ABOUTBOX),
|
||||
hWndParent,
|
||||
AboutDialogProc);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
#include <precomp.h>
|
||||
|
||||
const TCHAR szMapWndClass[] = TEXT("FontMapWnd");
|
||||
const TCHAR szLrgCellWndClass[] = TEXT("LrgCellWnd");
|
||||
#define ID_ABOUT 0x1
|
||||
|
||||
HINSTANCE hInstance;
|
||||
|
||||
/* Font-enumeration callback */
|
||||
int CALLBACK
|
||||
static int CALLBACK
|
||||
EnumFontNames(ENUMLOGFONTEX *lpelfe,
|
||||
NEWTEXTMETRICEX *lpntme,
|
||||
DWORD FontType,
|
||||
|
@ -120,19 +119,20 @@ ChangeMapFont(HWND hDlg)
|
|||
}
|
||||
|
||||
|
||||
BOOL CALLBACK
|
||||
static BOOL CALLBACK
|
||||
DlgProc(HWND hDlg,
|
||||
UINT Message,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam)
|
||||
{
|
||||
static HICON hSmIcon = NULL;
|
||||
static HICON hBgIcon = NULL;
|
||||
|
||||
switch(Message)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
HICON hSmIcon;
|
||||
HICON hBgIcon;
|
||||
HMENU hSysMenu;
|
||||
|
||||
hSmIcon = LoadImage(hInstance,
|
||||
MAKEINTRESOURCE(IDI_ICON),
|
||||
IMAGE_ICON,
|
||||
|
@ -159,6 +159,29 @@ DlgProc(HWND hDlg,
|
|||
IDC_FONTCOMBO));
|
||||
|
||||
ChangeMapFont(hDlg);
|
||||
|
||||
hSysMenu = GetSystemMenu(hDlg,
|
||||
FALSE);
|
||||
if (hSysMenu != NULL)
|
||||
{
|
||||
LPCTSTR lpAboutText = NULL;
|
||||
|
||||
if (LoadString(hInstance,
|
||||
IDS_ABOUT,
|
||||
(LPTSTR)&lpAboutText,
|
||||
0))
|
||||
{
|
||||
AppendMenu(hSysMenu,
|
||||
MF_SEPARATOR,
|
||||
0,
|
||||
NULL);
|
||||
AppendMenu(hSysMenu,
|
||||
MF_STRING,
|
||||
ID_ABOUT,
|
||||
lpAboutText);
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -184,8 +207,15 @@ DlgProc(HWND hDlg,
|
|||
case IDOK:
|
||||
EndDialog(hDlg, 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_ABOUT:
|
||||
case WM_SYSCOMMAND:
|
||||
{
|
||||
switch(wParam)
|
||||
{
|
||||
case ID_ABOUT:
|
||||
DialogBox(hInstance,
|
||||
MAKEINTRESOURCE(IDD_ABOUTBOX),
|
||||
hDlg,
|
||||
|
@ -199,45 +229,9 @@ DlgProc(HWND hDlg,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL
|
||||
RegisterControls(HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASS wc = {0};
|
||||
|
||||
//wc.style = CS_DBLCLKS;
|
||||
wc.lpfnWndProc = MapWndProc;
|
||||
wc.cbWndExtra = sizeof(PMAP);
|
||||
wc.hInstance = hInstance;
|
||||
wc.hCursor = LoadCursor(NULL,
|
||||
(LPTSTR)IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wc.lpszClassName = szMapWndClass;
|
||||
|
||||
if (RegisterClass(&wc))
|
||||
{
|
||||
wc.lpfnWndProc = LrgCellWndProc;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.lpszClassName = szLrgCellWndClass;
|
||||
|
||||
return RegisterClass(&wc) != 0;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VOID
|
||||
UnregisterControls(HINSTANCE hInstance)
|
||||
{
|
||||
UnregisterClass(szMapWndClass,
|
||||
hInstance);
|
||||
|
||||
UnregisterClass(szLrgCellWndClass,
|
||||
hInstance);
|
||||
}
|
||||
|
||||
|
||||
INT WINAPI
|
||||
WinMain(HINSTANCE hInst,
|
||||
|
@ -246,7 +240,7 @@ WinMain(HINSTANCE hInst,
|
|||
int iCmd)
|
||||
{
|
||||
INITCOMMONCONTROLSEX iccx;
|
||||
INT Ret;
|
||||
INT Ret = 1;
|
||||
|
||||
hInstance = hInst;
|
||||
|
||||
|
@ -254,14 +248,15 @@ WinMain(HINSTANCE hInst,
|
|||
iccx.dwICC = ICC_TAB_CLASSES;
|
||||
InitCommonControlsEx(&iccx);
|
||||
|
||||
RegisterControls(hInstance);
|
||||
if (RegisterMapClasses(hInstance))
|
||||
{
|
||||
Ret = DialogBox(hInstance,
|
||||
MAKEINTRESOURCE(IDD_CHARMAP),
|
||||
NULL,
|
||||
(DLGPROC)DlgProc) >= 0;
|
||||
|
||||
Ret = DialogBox(hInstance,
|
||||
MAKEINTRESOURCE(IDD_CHARMAP),
|
||||
NULL,
|
||||
(DLGPROC)DlgProc);
|
||||
|
||||
UnregisterControls(hInstance);
|
||||
UnregisterMapClasses(hInstance);
|
||||
}
|
||||
|
||||
return Ret;
|
||||
}
|
||||
|
|
|
@ -3,12 +3,11 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
|||
IDD_CHARMAP DIALOGEX 6, 6, 293, 205 //233
|
||||
CAPTION "Character Map"
|
||||
FONT 8,"MS Sans Serif",0,0
|
||||
STYLE WS_BORDER | WS_VISIBLE | WS_SYSMENU
|
||||
STYLE WS_BORDER | WS_VISIBLE | WS_SYSMENU | WS_MINIMIZEBOX
|
||||
BEGIN
|
||||
LTEXT "Font :", IDC_STATIC, 6, 7, 24, 9
|
||||
COMBOBOX IDC_FONTCOMBO, 36, 5, 196, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
|
||||
PUSHBUTTON "Help", IDC_CMHELP, 235, 5, 35, 13
|
||||
PUSHBUTTON "?", IDC_ABOUT, 272, 5, 14, 13
|
||||
COMBOBOX IDC_FONTCOMBO, 36, 5, 210, 210, WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST | CBS_SORT | CBS_HASSTRINGS
|
||||
PUSHBUTTON "Help", IDC_CMHELP, 249, 5, 35, 13
|
||||
CONTROL "", IDC_FONTMAP, "FontMapWnd", WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_VSCROLL, 20, 22, 266, 156
|
||||
LTEXT "Characters to copy :", IDC_STATIC, 6, 188, 66, 9
|
||||
EDITTEXT IDC_TEXTBOX, 74, 186, 114, 13, WS_CHILD | WS_VISIBLE | WS_TABSTOP
|
||||
|
@ -32,4 +31,5 @@ END
|
|||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
IDS_LICENSE "This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.\r\n\r\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.\r\n\r\nYou should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA."
|
||||
IDS_ABOUT "A&bout..."
|
||||
END
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include <precomp.h>
|
||||
|
||||
static const TCHAR szMapWndClass[] = TEXT("FontMapWnd");
|
||||
static const TCHAR szLrgCellWndClass[] = TEXT("LrgCellWnd");
|
||||
|
||||
static VOID
|
||||
TagFontToCell(PCELL pCell,
|
||||
|
@ -482,3 +484,39 @@ MapWndProc(HWND hwnd,
|
|||
|
||||
return Ret;
|
||||
}
|
||||
|
||||
BOOL
|
||||
RegisterMapClasses(HINSTANCE hInstance)
|
||||
{
|
||||
WNDCLASS wc = {0};
|
||||
|
||||
//wc.style = CS_DBLCLKS;
|
||||
wc.lpfnWndProc = MapWndProc;
|
||||
wc.cbWndExtra = sizeof(PMAP);
|
||||
wc.hInstance = hInstance;
|
||||
wc.hCursor = LoadCursor(NULL,
|
||||
(LPTSTR)IDC_ARROW);
|
||||
wc.hbrBackground = (HBRUSH)(COLOR_WINDOW + 1);
|
||||
wc.lpszClassName = szMapWndClass;
|
||||
|
||||
if (RegisterClass(&wc))
|
||||
{
|
||||
wc.lpfnWndProc = LrgCellWndProc;
|
||||
wc.cbWndExtra = 0;
|
||||
wc.lpszClassName = szLrgCellWndClass;
|
||||
|
||||
return RegisterClass(&wc) != 0;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VOID
|
||||
UnregisterMapClasses(HINSTANCE hInstance)
|
||||
{
|
||||
UnregisterClass(szMapWndClass,
|
||||
hInstance);
|
||||
|
||||
UnregisterClass(szLrgCellWndClass,
|
||||
hInstance);
|
||||
}
|
||||
|
|
|
@ -14,8 +14,6 @@
|
|||
#define FM_SETFONT (WM_USER + 1)
|
||||
|
||||
extern HINSTANCE hInstance;
|
||||
extern const TCHAR szMapWndClass[];
|
||||
extern const TCHAR szLrgCellWndClass[];
|
||||
|
||||
|
||||
typedef struct _CELL
|
||||
|
@ -41,11 +39,9 @@ typedef struct _MAP
|
|||
INT iPage;
|
||||
} MAP, *PMAP;
|
||||
|
||||
BOOL RegisterControls(HINSTANCE hInstance);
|
||||
VOID UnregisterControls(HINSTANCE hInstance);
|
||||
VOID ShowAboutDlg(HWND hWndParent);
|
||||
|
||||
INT_PTR CALLBACK AboutDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT CALLBACK LrgCellWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
LRESULT CALLBACK MapWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
BOOL RegisterMapClasses(HINSTANCE hInstance);
|
||||
VOID UnregisterMapClasses(HINSTANCE hInstance);
|
||||
|
||||
#endif /* __DEVMGMT_PRECOMP_H */
|
||||
|
|
|
@ -4,15 +4,16 @@
|
|||
|
||||
#define IDD_CHARMAP 200
|
||||
#define IDD_ABOUTBOX 201
|
||||
|
||||
#define IDC_FONTCOMBO 1001
|
||||
#define IDC_CMHELP 1002
|
||||
#define IDC_ABOUT 1003
|
||||
#define IDC_FONTMAP 1004
|
||||
#define IDC_TEXTBOX 1005
|
||||
#define IDC_SELECT 1006
|
||||
#define IDC_COPY 1007
|
||||
#define IDC_ADVVIEW 1008
|
||||
#define IDC_DISPLAY 1009
|
||||
#define IDC_SCROLL 1010
|
||||
#define IDS_LICENSE 1011
|
||||
#define IDC_LICENSE_EDIT 1012
|
||||
#define IDC_FONTMAP 1003
|
||||
#define IDC_TEXTBOX 1004
|
||||
#define IDC_SELECT 1005
|
||||
#define IDC_COPY 1006
|
||||
#define IDC_ADVVIEW 1007
|
||||
#define IDC_DISPLAY 1008
|
||||
#define IDC_LICENSE_EDIT 1009
|
||||
|
||||
#define IDS_LICENSE 1010
|
||||
#define IDS_ABOUT 1011
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue