mirror of
https://github.com/reactos/reactos.git
synced 2025-04-19 20:19:26 +00:00
merged focus handling code from wine
svn path=/trunk/; revision=9794
This commit is contained in:
parent
208898d3cd
commit
a10440fe8a
6 changed files with 67 additions and 12 deletions
|
@ -263,6 +263,8 @@ BEGIN
|
|||
IDS_QUERY_DELETE_CONFIRM "Confirm Value Delete"
|
||||
IDS_ERR_DELVAL_CAPTION "Error Deleting Values"
|
||||
IDS_ERR_DELETEVALUE "Unable to delete all specified values!"
|
||||
IDS_ERR_RENVAL_CAPTION "Error Renaming Value"
|
||||
IDS_ERR_RENVAL_TOEMPTY "Cannot rename %s. The specified value name is empty. Try another name and try again."
|
||||
END
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
|
|
|
@ -101,6 +101,7 @@ static void OnPaint(HWND hWnd)
|
|||
|
||||
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
ChildWnd* pChildWnd = g_pChildWnd;
|
||||
switch (LOWORD(wParam)) {
|
||||
/* Parse the menu selections: */
|
||||
case ID_REGISTRY_EXIT:
|
||||
|
@ -109,6 +110,10 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
case ID_VIEW_REFRESH:
|
||||
/* TODO */
|
||||
break;
|
||||
case ID_SWITCH_PANELS:
|
||||
pChildWnd->nFocusPanel = !pChildWnd->nFocusPanel;
|
||||
SetFocus(pChildWnd->nFocusPanel? pChildWnd->hListWnd: pChildWnd->hTreeWnd);
|
||||
break;
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -275,10 +280,6 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
HKEY hRootKey;
|
||||
|
||||
keyPath = GetItemPath(pChildWnd->hTreeWnd, ((NMTREEVIEW*)lParam)->itemNew.hItem, &hRootKey);
|
||||
if(!hRootKey)
|
||||
{
|
||||
RefreshListView(pChildWnd->hListWnd, 0, NULL);
|
||||
}
|
||||
if (keyPath) {
|
||||
RefreshListView(pChildWnd->hListWnd, hRootKey, keyPath);
|
||||
rootName = get_root_key_name(hRootKey);
|
||||
|
@ -292,10 +293,10 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
}
|
||||
break;
|
||||
case NM_SETFOCUS:
|
||||
pChildWnd->nFocusPanel = 1;
|
||||
pChildWnd->nFocusPanel = 0;
|
||||
break;
|
||||
default:
|
||||
goto def;
|
||||
return 0;
|
||||
}
|
||||
} else
|
||||
{
|
||||
|
@ -303,12 +304,12 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
{
|
||||
switch (((LPNMHDR)lParam)->code) {
|
||||
case NM_SETFOCUS:
|
||||
pChildWnd->nFocusPanel = 0;
|
||||
pChildWnd->nFocusPanel = 1;
|
||||
break;
|
||||
default:
|
||||
if(ListWndNotifyProc(pChildWnd->hListWnd, wParam, lParam, &Result))
|
||||
if(!ListWndNotifyProc(pChildWnd->hListWnd, wParam, lParam, &Result))
|
||||
{
|
||||
return Result;
|
||||
goto def;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -658,6 +658,10 @@ LRESULT CALLBACK FrameWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
case WM_MENUSELECT:
|
||||
OnMenuSelect(hWnd, LOWORD(wParam), HIWORD(wParam), (HMENU)lParam);
|
||||
break;
|
||||
case WM_ACTIVATE:
|
||||
if (LOWORD(hWnd))
|
||||
SetFocus(g_pChildWnd->hWnd);
|
||||
break;
|
||||
case WM_DESTROY:
|
||||
WinHelp(hWnd, _T("regedit"), HELP_QUIT, 0);
|
||||
PostQuitMessage(0);
|
||||
|
|
|
@ -408,7 +408,9 @@ BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
|
|||
SendMessage(hFrameWnd, WM_COMMAND, MAKEWPARAM(ID_EDIT_MODIFY, 0), 0);
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
case NM_SETFOCUS:
|
||||
g_pChildWnd->nFocusPanel = 0;
|
||||
break;
|
||||
case LVN_BEGINLABELEDIT:
|
||||
{
|
||||
PLINE_INFO lineinfo;
|
||||
|
@ -429,6 +431,40 @@ BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
|
|||
*Result = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
case LVN_ENDLABELEDIT:
|
||||
{
|
||||
PLINE_INFO lineinfo;
|
||||
Info = (NMLVDISPINFO*)lParam;
|
||||
if(Info && Info->item.pszText)
|
||||
{
|
||||
lineinfo = (PLINE_INFO)Info->item.lParam;
|
||||
if(!lineinfo->name || !_tcscmp(lineinfo->name, _T("")))
|
||||
{
|
||||
*Result = FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
LONG ret;
|
||||
//if((ret = RenameValue(lineinfo->name, Info->item.pszText)) != ERROR_SUCCESS)
|
||||
{
|
||||
TCHAR msg[128], caption[128];
|
||||
|
||||
LoadString(hInst, IDS_ERR_RENVAL_CAPTION, caption, sizeof(caption)/sizeof(TCHAR));
|
||||
if(_tcslen(Info->item.pszText) == 0)
|
||||
{
|
||||
LoadString(hInst, IDS_ERR_RENVAL_TOEMPTY, msg, sizeof(msg)/sizeof(TCHAR));
|
||||
}
|
||||
else
|
||||
_stprintf(msg, _T("rename from %s to %s"), lineinfo->name, Info->item.pszText);
|
||||
MessageBox(0, msg, NULL, 0);
|
||||
*Result = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
*Result = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
@ -147,6 +147,15 @@ void ExitInstance(HINSTANCE hInstance)
|
|||
DestroyMenu(hMenuFrame);
|
||||
}
|
||||
|
||||
BOOL TranslateChildTabMessage(MSG *msg)
|
||||
{
|
||||
if (msg->message != WM_KEYDOWN) return FALSE;
|
||||
if (msg->wParam != VK_TAB) return FALSE;
|
||||
if (GetParent(msg->hwnd) != g_pChildWnd->hWnd) return FALSE;
|
||||
PostMessage(g_pChildWnd->hWnd, WM_COMMAND, ID_SWITCH_PANELS, 0);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int APIENTRY WinMain(HINSTANCE hInstance,
|
||||
HINSTANCE hPrevInstance,
|
||||
LPSTR lpCmdLine,
|
||||
|
@ -189,8 +198,8 @@ int APIENTRY WinMain(HINSTANCE hInstance,
|
|||
|
||||
/* Main message loop */
|
||||
while (GetMessage(&msg, (HWND)NULL, 0, 0)) {
|
||||
if (!TranslateAccelerator(msg.hwnd, hAccel, &msg) &&
|
||||
!IsDialogMessage(hFrameWnd, &msg)) {
|
||||
if (!TranslateAccelerator(msg.hwnd, hAccel, &msg)
|
||||
&& !TranslateChildTabMessage(&msg)) {
|
||||
TranslateMessage(&msg);
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
|
|
|
@ -124,6 +124,9 @@
|
|||
#define IDS_QUERY_DELETE_CONFIRM 32853
|
||||
#define IDS_ERR_DELVAL_CAPTION 32854
|
||||
#define IDS_ERR_DELETEVALUE 32855
|
||||
#define IDS_ERR_RENVAL_CAPTION 32856
|
||||
#define IDS_ERR_RENVAL_TOEMPTY 32857
|
||||
#define ID_SWITCH_PANELS 32871
|
||||
|
||||
#define IDS_FLT_REGFILES 31001
|
||||
#define IDS_FLT_REGFILES_FLT 31002
|
||||
|
|
Loading…
Reference in a new issue