mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:52:56 +00:00
add chars to the edit box when either double clicked or the select button is hit
svn path=/trunk/; revision=25848
This commit is contained in:
parent
d8e1e7bba4
commit
b4f7cf3523
5 changed files with 194 additions and 47 deletions
|
@ -7,53 +7,58 @@ AboutDialogProc(HWND hDlg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
HWND hLicenseEditWnd;
|
static HICON hIcon = NULL;
|
||||||
HICON hIcon = NULL;
|
|
||||||
TCHAR strLicense[700];
|
|
||||||
|
|
||||||
switch (message)
|
switch (message)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
|
|
||||||
hIcon = LoadImage(hInstance,
|
|
||||||
MAKEINTRESOURCE(IDI_ICON),
|
|
||||||
IMAGE_ICON,
|
|
||||||
16,
|
|
||||||
16,
|
|
||||||
0);
|
|
||||||
|
|
||||||
SendMessage(hDlg,
|
|
||||||
WM_SETICON,
|
|
||||||
ICON_SMALL,
|
|
||||||
(LPARAM)hIcon);
|
|
||||||
|
|
||||||
hLicenseEditWnd = GetDlgItem(hDlg,
|
|
||||||
IDC_LICENSE_EDIT);
|
|
||||||
|
|
||||||
LoadString(hInstance,
|
|
||||||
IDS_LICENSE,
|
|
||||||
strLicense,
|
|
||||||
sizeof(strLicense) / sizeof(TCHAR));
|
|
||||||
|
|
||||||
SetWindowText(hLicenseEditWnd,
|
|
||||||
strLicense);
|
|
||||||
return TRUE;
|
|
||||||
|
|
||||||
case WM_COMMAND:
|
|
||||||
if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
|
|
||||||
{
|
{
|
||||||
DestroyIcon(hIcon);
|
HWND hLicenseEditWnd;
|
||||||
EndDialog(hDlg,
|
TCHAR strLicense[700];
|
||||||
LOWORD(wParam));
|
|
||||||
|
hIcon = LoadImage(hInstance,
|
||||||
|
MAKEINTRESOURCE(IDI_ICON),
|
||||||
|
IMAGE_ICON,
|
||||||
|
16,
|
||||||
|
16,
|
||||||
|
0);
|
||||||
|
|
||||||
|
SendMessage(hDlg,
|
||||||
|
WM_SETICON,
|
||||||
|
ICON_SMALL,
|
||||||
|
(LPARAM)hIcon);
|
||||||
|
|
||||||
|
hLicenseEditWnd = GetDlgItem(hDlg,
|
||||||
|
IDC_LICENSE_EDIT);
|
||||||
|
|
||||||
|
LoadString(hInstance,
|
||||||
|
IDS_LICENSE,
|
||||||
|
strLicense,
|
||||||
|
sizeof(strLicense) / sizeof(TCHAR));
|
||||||
|
|
||||||
|
SetWindowText(hLicenseEditWnd,
|
||||||
|
strLicense);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
case WM_COMMAND:
|
||||||
|
{
|
||||||
|
if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
|
||||||
|
{
|
||||||
|
DestroyIcon(hIcon);
|
||||||
|
EndDialog(hDlg,
|
||||||
|
LOWORD(wParam));
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
ShowAboutDlg(HWND hWndParent)
|
ShowAboutDlg(HWND hWndParent)
|
||||||
{
|
{
|
||||||
|
|
|
@ -75,11 +75,10 @@ FillFontStyleComboList(HWND hwndCombo)
|
||||||
ReleaseDC(hwndCombo,
|
ReleaseDC(hwndCombo,
|
||||||
hdc);
|
hdc);
|
||||||
|
|
||||||
/* set default to Arial */
|
|
||||||
SendMessage(hwndCombo,
|
SendMessage(hwndCombo,
|
||||||
CB_SELECTSTRING,
|
CB_SETCURSEL,
|
||||||
-1,
|
0,
|
||||||
(LPARAM)_T("Arial"));
|
0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -105,7 +104,7 @@ ChangeMapFont(HWND hDlg)
|
||||||
{
|
{
|
||||||
SendMessage(hCombo,
|
SendMessage(hCombo,
|
||||||
WM_GETTEXT,
|
WM_GETTEXT,
|
||||||
31,
|
Len + 1,
|
||||||
(LPARAM)lpFontName);
|
(LPARAM)lpFontName);
|
||||||
|
|
||||||
hMap = GetDlgItem(hDlg, IDC_FONTMAP);
|
hMap = GetDlgItem(hDlg, IDC_FONTMAP);
|
||||||
|
@ -119,6 +118,58 @@ ChangeMapFont(HWND hDlg)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static VOID
|
||||||
|
AddCharToSelection(HWND hText,
|
||||||
|
TCHAR ch)
|
||||||
|
{
|
||||||
|
LPTSTR lpText;
|
||||||
|
INT Len = GetWindowTextLength(hText);
|
||||||
|
|
||||||
|
if (Len != 0)
|
||||||
|
{
|
||||||
|
lpText = HeapAlloc(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
(Len + 2) * sizeof(TCHAR));
|
||||||
|
|
||||||
|
if (lpText)
|
||||||
|
{
|
||||||
|
LPTSTR lpStr = lpText;
|
||||||
|
|
||||||
|
SendMessage(hText,
|
||||||
|
WM_GETTEXT,
|
||||||
|
Len + 1,
|
||||||
|
(LPARAM)lpStr);
|
||||||
|
|
||||||
|
lpStr += Len;
|
||||||
|
*lpStr = ch;
|
||||||
|
lpStr++;
|
||||||
|
*lpStr = _T('\0');
|
||||||
|
|
||||||
|
SendMessage(hText,
|
||||||
|
WM_SETTEXT,
|
||||||
|
0,
|
||||||
|
(LPARAM)lpText);
|
||||||
|
|
||||||
|
HeapFree(GetProcessHeap(),
|
||||||
|
0,
|
||||||
|
lpText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
TCHAR szText[2];
|
||||||
|
|
||||||
|
szText[0] = ch;
|
||||||
|
szText[1] = _T('\0');
|
||||||
|
|
||||||
|
SendMessage(hText,
|
||||||
|
WM_SETTEXT,
|
||||||
|
0,
|
||||||
|
(LPARAM)szText);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static BOOL CALLBACK
|
static BOOL CALLBACK
|
||||||
DlgProc(HWND hDlg,
|
DlgProc(HWND hDlg,
|
||||||
UINT Message,
|
UINT Message,
|
||||||
|
@ -204,6 +255,19 @@ DlgProc(HWND hDlg,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDC_SELECT:
|
||||||
|
{
|
||||||
|
TCHAR ch;
|
||||||
|
HWND hMap = GetDlgItem(hDlg, IDC_FONTMAP);
|
||||||
|
|
||||||
|
ch = SendMessage(hMap, FM_GETCHAR, 0, 0);
|
||||||
|
|
||||||
|
AddCharToSelection(GetDlgItem(hDlg, IDC_TEXTBOX),
|
||||||
|
ch);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case IDOK:
|
case IDOK:
|
||||||
EndDialog(hDlg, 0);
|
EndDialog(hDlg, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -222,6 +286,29 @@ DlgProc(HWND hDlg,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case WM_NOTIFY:
|
||||||
|
{
|
||||||
|
LPMAPNOTIFY lpnm = (LPMAPNOTIFY)lParam;
|
||||||
|
|
||||||
|
switch (lpnm->hdr.idFrom)
|
||||||
|
{
|
||||||
|
case IDC_FONTMAP:
|
||||||
|
{
|
||||||
|
switch (lpnm->hdr.code)
|
||||||
|
{
|
||||||
|
case FM_SETCHAR:
|
||||||
|
{
|
||||||
|
AddCharToSelection(GetDlgItem(hDlg, IDC_TEXTBOX),
|
||||||
|
lpnm->ch);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,8 @@ SetLrgFont(PMAP infoPtr)
|
||||||
LPTSTR lpFontName;
|
LPTSTR lpFontName;
|
||||||
INT Len;
|
INT Len;
|
||||||
|
|
||||||
hCombo = GetDlgItem(infoPtr->hParent, IDC_FONTCOMBO);
|
hCombo = GetDlgItem(infoPtr->hParent,
|
||||||
|
IDC_FONTCOMBO);
|
||||||
|
|
||||||
Len = GetWindowTextLength(hCombo);
|
Len = GetWindowTextLength(hCombo);
|
||||||
|
|
||||||
|
@ -28,12 +29,14 @@ SetLrgFont(PMAP infoPtr)
|
||||||
31,
|
31,
|
||||||
(LPARAM)lpFontName);
|
(LPARAM)lpFontName);
|
||||||
|
|
||||||
ZeroMemory(&lf, sizeof(lf));
|
ZeroMemory(&lf,
|
||||||
|
sizeof(lf));
|
||||||
|
|
||||||
hdc = GetDC(infoPtr->hLrgWnd);
|
hdc = GetDC(infoPtr->hLrgWnd);
|
||||||
lf.lfHeight = GetDeviceCaps(hdc,
|
lf.lfHeight = GetDeviceCaps(hdc,
|
||||||
LOGPIXELSY) / 2;
|
LOGPIXELSY) / 2;
|
||||||
ReleaseDC(infoPtr->hLrgWnd, hdc);
|
ReleaseDC(infoPtr->hLrgWnd,
|
||||||
|
hdc);
|
||||||
|
|
||||||
lf.lfCharSet = DEFAULT_CHARSET;
|
lf.lfCharSet = DEFAULT_CHARSET;
|
||||||
lstrcpy(lf.lfFaceName,
|
lstrcpy(lf.lfFaceName,
|
||||||
|
|
|
@ -72,7 +72,6 @@ static VOID
|
||||||
FillGrid(PMAP infoPtr,
|
FillGrid(PMAP infoPtr,
|
||||||
HDC hdc)
|
HDC hdc)
|
||||||
{
|
{
|
||||||
//GLYPHSET gs;
|
|
||||||
HFONT hOldFont;
|
HFONT hOldFont;
|
||||||
TCHAR ch;
|
TCHAR ch;
|
||||||
INT x, y;
|
INT x, y;
|
||||||
|
@ -194,6 +193,34 @@ SetFont(PMAP infoPtr,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static LRESULT
|
||||||
|
NotifyParentOfSelection(PMAP infoPtr,
|
||||||
|
UINT code,
|
||||||
|
TCHAR ch)
|
||||||
|
{
|
||||||
|
LRESULT Ret = 0;
|
||||||
|
|
||||||
|
if (infoPtr->hParent != NULL)
|
||||||
|
{
|
||||||
|
MAPNOTIFY mnmh;
|
||||||
|
|
||||||
|
mnmh.hdr.hwndFrom = infoPtr->hMapWnd;
|
||||||
|
mnmh.hdr.idFrom = GetWindowLongPtr(infoPtr->hMapWnd,
|
||||||
|
GWLP_ID);
|
||||||
|
mnmh.hdr.code = code;
|
||||||
|
|
||||||
|
mnmh.ch = ch;
|
||||||
|
|
||||||
|
Ret = SendMessage(infoPtr->hParent,
|
||||||
|
WM_NOTIFY,
|
||||||
|
(WPARAM)mnmh.hdr.idFrom,
|
||||||
|
(LPARAM)&mnmh);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
OnClick(PMAP infoPtr,
|
OnClick(PMAP infoPtr,
|
||||||
WORD ptx,
|
WORD ptx,
|
||||||
|
@ -430,6 +457,16 @@ MapWndProc(HWND hwnd,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case WM_LBUTTONDBLCLK:
|
||||||
|
{
|
||||||
|
NotifyParentOfSelection(infoPtr,
|
||||||
|
FM_SETCHAR,
|
||||||
|
infoPtr->pActiveCell->ch);
|
||||||
|
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_VSCROLL:
|
case WM_VSCROLL:
|
||||||
{
|
{
|
||||||
OnVScroll(infoPtr,
|
OnVScroll(infoPtr,
|
||||||
|
@ -453,6 +490,11 @@ MapWndProc(HWND hwnd,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case FM_GETCHAR:
|
||||||
|
{
|
||||||
|
return infoPtr->pActiveCell->ch;
|
||||||
|
}
|
||||||
|
|
||||||
case WM_PAINT:
|
case WM_PAINT:
|
||||||
{
|
{
|
||||||
OnPaint(infoPtr,
|
OnPaint(infoPtr,
|
||||||
|
@ -485,12 +527,13 @@ MapWndProc(HWND hwnd,
|
||||||
return Ret;
|
return Ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
BOOL
|
||||||
RegisterMapClasses(HINSTANCE hInstance)
|
RegisterMapClasses(HINSTANCE hInstance)
|
||||||
{
|
{
|
||||||
WNDCLASS wc = {0};
|
WNDCLASS wc = {0};
|
||||||
|
|
||||||
//wc.style = CS_DBLCLKS;
|
wc.style = CS_DBLCLKS;
|
||||||
wc.lpfnWndProc = MapWndProc;
|
wc.lpfnWndProc = MapWndProc;
|
||||||
wc.cbWndExtra = sizeof(PMAP);
|
wc.cbWndExtra = sizeof(PMAP);
|
||||||
wc.hInstance = hInstance;
|
wc.hInstance = hInstance;
|
||||||
|
|
|
@ -12,10 +12,11 @@
|
||||||
#define YLARGE 25
|
#define YLARGE 25
|
||||||
|
|
||||||
#define FM_SETFONT (WM_USER + 1)
|
#define FM_SETFONT (WM_USER + 1)
|
||||||
|
#define FM_GETCHAR (WM_USER + 2)
|
||||||
|
#define FM_SETCHAR (WM_USER + 3)
|
||||||
|
|
||||||
extern HINSTANCE hInstance;
|
extern HINSTANCE hInstance;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _CELL
|
typedef struct _CELL
|
||||||
{
|
{
|
||||||
RECT CellExt;
|
RECT CellExt;
|
||||||
|
@ -39,9 +40,17 @@ typedef struct _MAP
|
||||||
INT iPage;
|
INT iPage;
|
||||||
} MAP, *PMAP;
|
} MAP, *PMAP;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
NMHDR hdr;
|
||||||
|
TCHAR ch;
|
||||||
|
} MAPNOTIFY, *LPMAPNOTIFY;
|
||||||
|
|
||||||
|
|
||||||
|
LRESULT CALLBACK LrgCellWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
VOID ShowAboutDlg(HWND hWndParent);
|
VOID ShowAboutDlg(HWND hWndParent);
|
||||||
|
|
||||||
BOOL RegisterMapClasses(HINSTANCE hInstance);
|
BOOL RegisterMapClasses(HINSTANCE hInstance);
|
||||||
VOID UnregisterMapClasses(HINSTANCE hInstance);
|
VOID UnregisterMapClasses(HINSTANCE hInstance);
|
||||||
|
|
||||||
#endif /* __DEVMGMT_PRECOMP_H */
|
#endif /* __CHARMAP_PRECOMP_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue