mirror of
https://github.com/reactos/reactos.git
synced 2025-07-28 21:02:36 +00:00
more improvements
svn path=/trunk/; revision=7398
This commit is contained in:
parent
0e76daebf1
commit
a5c9f3e660
6 changed files with 121 additions and 72 deletions
|
@ -94,10 +94,8 @@ BEGIN
|
|||
END
|
||||
POPUP "&Help"
|
||||
BEGIN
|
||||
/*
|
||||
* MENUITEM "&Help Topics", ID_HELP_HELPTOPICS
|
||||
* MENUITEM SEPARATOR
|
||||
*/
|
||||
MENUITEM "&Help Topics\tF1", ID_HELP_HELPTOPICS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "&About Registry Editor", ID_HELP_ABOUT
|
||||
END
|
||||
END
|
||||
|
|
|
@ -129,6 +129,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
static short last_split;
|
||||
BOOL Result;
|
||||
ChildWnd* pChildWnd = g_pChildWnd;
|
||||
|
||||
switch (message) {
|
||||
|
@ -287,13 +288,49 @@ LRESULT CALLBACK ChildWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||
goto def;
|
||||
}
|
||||
} else
|
||||
if ((int)wParam == LIST_WINDOW) {
|
||||
if (!SendMessage(pChildWnd->hListWnd, message, wParam, lParam)) {
|
||||
goto def;
|
||||
{
|
||||
if ((int)wParam == LIST_WINDOW)
|
||||
{
|
||||
if(ListWndNotifyProc(pChildWnd->hListWnd, wParam, lParam, &Result))
|
||||
{
|
||||
return Result;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case WM_CONTEXTMENU:
|
||||
{
|
||||
POINTS pt;
|
||||
if((HWND)wParam == pChildWnd->hListWnd)
|
||||
{
|
||||
int i, cnt;
|
||||
BOOL IsDefault;
|
||||
pt = MAKEPOINTS(lParam);
|
||||
cnt = ListView_GetSelectedCount(pChildWnd->hListWnd);
|
||||
i = ListView_GetNextItem(pChildWnd->hListWnd, -1, LVNI_FOCUSED | LVNI_SELECTED);
|
||||
if(i == -1)
|
||||
{
|
||||
TrackPopupMenu(GetSubMenu(hPopupMenus, PM_NEW), TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
HMENU mnu = GetSubMenu(hPopupMenus, PM_MODIFYVALUE);
|
||||
SetMenuDefaultItem(mnu, ID_EDIT_MODIFY, MF_BYCOMMAND);
|
||||
IsDefault = IsDefaultValue(pChildWnd->hListWnd, i);
|
||||
if(cnt == 1)
|
||||
EnableMenuItem(mnu, ID_EDIT_RENAME, MF_BYCOMMAND | (IsDefault ? MF_DISABLED | MF_GRAYED : MF_ENABLED));
|
||||
else
|
||||
EnableMenuItem(mnu, ID_EDIT_RENAME, MF_BYCOMMAND | MF_DISABLED | MF_GRAYED);
|
||||
EnableMenuItem(mnu, ID_EDIT_MODIFY, MF_BYCOMMAND | (cnt == 1 ? MF_ENABLED : MF_DISABLED | MF_GRAYED));
|
||||
EnableMenuItem(mnu, ID_EDIT_MODIFY_BIN, MF_BYCOMMAND | (cnt == 1 ? MF_ENABLED : MF_DISABLED | MF_GRAYED));
|
||||
|
||||
TrackPopupMenu(mnu, TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_SIZE:
|
||||
if (wParam != SIZE_MINIMIZED && pChildWnd != NULL) {
|
||||
ResizeWnd(pChildWnd, LOWORD(lParam), HIWORD(lParam));
|
||||
|
|
|
@ -76,7 +76,8 @@ INT_PTR CALLBACK modify_string_dlgproc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
|||
SetDlgItemText(hwndDlg, IDC_VALUE_NAME, _T("(Default)"));
|
||||
}
|
||||
SetDlgItemText(hwndDlg, IDC_VALUE_DATA, stringValueData);
|
||||
return TRUE;
|
||||
SetFocus(GetDlgItem(hwndDlg, IDC_VALUE_DATA));
|
||||
return FALSE;
|
||||
case WM_COMMAND:
|
||||
switch (LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
|
|
|
@ -441,6 +441,7 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
BOOL result = TRUE;
|
||||
REGSAM regsam = KEY_READ;
|
||||
LONG lRet;
|
||||
int item;
|
||||
|
||||
switch (LOWORD(wParam)) {
|
||||
case ID_REGISTRY_IMPORTREGISTRYFILE:
|
||||
|
@ -468,6 +469,23 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
case ID_HELP_ABOUT:
|
||||
ShowAboutBox(hWnd);
|
||||
return TRUE;
|
||||
case ID_VIEW_SPLIT:
|
||||
{
|
||||
RECT rt;
|
||||
POINT pt, pts;
|
||||
GetClientRect(g_pChildWnd->hWnd, &rt);
|
||||
pt.x = rt.left + g_pChildWnd->nSplitPos;
|
||||
pt.y = (rt.bottom / 2);
|
||||
pts = pt;
|
||||
if(ClientToScreen(g_pChildWnd->hWnd, &pts))
|
||||
{
|
||||
SetCursorPos(pts.x, pts.y);
|
||||
SetCursor(LoadCursor(0, IDC_SIZEWE));
|
||||
SendMessage(g_pChildWnd->hWnd, WM_LBUTTONDOWN, 0, MAKELPARAM(pt.x, pt.y));
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
case ID_EDIT_RENAME:
|
||||
case ID_EDIT_MODIFY:
|
||||
regsam |= KEY_WRITE;
|
||||
break;
|
||||
|
@ -485,6 +503,16 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
if (valueName && ModifyValue(hWnd, hKey, valueName))
|
||||
RefreshListView(g_pChildWnd->hListWnd, hKeyRoot, keyPath);
|
||||
break;
|
||||
case ID_EDIT_RENAME:
|
||||
if(ListView_GetSelectedCount(g_pChildWnd->hListWnd) == 1)
|
||||
{
|
||||
item = ListView_GetNextItem(g_pChildWnd->hListWnd, -1, LVNI_FOCUSED | LVNI_SELECTED);
|
||||
if(item > -1)
|
||||
{
|
||||
ListView_EditLabel(g_pChildWnd->hListWnd, item);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ID_EDIT_COPYKEYNAME:
|
||||
CopyKeyName(hWnd, _T(""));
|
||||
break;
|
||||
|
|
|
@ -47,7 +47,6 @@ typedef struct tagLINE_INFO
|
|||
* Global and Local Variables:
|
||||
*/
|
||||
|
||||
static WNDPROC g_orgListWndProc;
|
||||
static DWORD g_columnToSort = ~0UL;
|
||||
static BOOL g_invertSort = FALSE;
|
||||
static LPTSTR g_valueName;
|
||||
|
@ -97,6 +96,21 @@ LPCTSTR GetValueName(HWND hwndLV)
|
|||
return g_valueName;
|
||||
}
|
||||
|
||||
BOOL IsDefaultValue(HWND hwndLV, int i)
|
||||
{
|
||||
PLINE_INFO lineinfo;
|
||||
LVITEM Item;
|
||||
|
||||
Item.mask = LVIF_PARAM;
|
||||
Item.iItem = i;
|
||||
if(ListView_GetItem(hwndLV, &Item))
|
||||
{
|
||||
lineinfo = (PLINE_INFO)Item.lParam;
|
||||
return lineinfo && (!lineinfo->name || !strcmp(lineinfo->name, _T("")));
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
* Local module support methods
|
||||
*/
|
||||
|
@ -305,9 +319,6 @@ static int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSor
|
|||
return g_invertSort ? _tcscmp(r->name, l->name) : _tcscmp(l->name, r->name);
|
||||
}
|
||||
|
||||
static void ListViewPopUpMenu(HWND hWnd, POINT pt)
|
||||
{}
|
||||
|
||||
static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (LOWORD(wParam)) {
|
||||
|
@ -319,19 +330,14 @@ static BOOL _CmdWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result)
|
||||
{
|
||||
switch (message) {
|
||||
case WM_COMMAND:
|
||||
if (!_CmdWndProc(hWnd, message, wParam, lParam)) {
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
case WM_NOTIFY:
|
||||
switch (((LPNMHDR)lParam)->code) {
|
||||
NMLVDISPINFO* Info;
|
||||
*Result = TRUE;
|
||||
switch (((LPNMHDR)lParam)->code) {
|
||||
case LVN_GETDISPINFO:
|
||||
OnGetDispInfo((NMLVDISPINFO*)lParam);
|
||||
break;
|
||||
return TRUE;
|
||||
case LVN_COLUMNCLICK:
|
||||
if (g_columnToSort == ((LPNMLISTVIEW)lParam)->iSubItem)
|
||||
g_invertSort = !g_invertSort;
|
||||
|
@ -341,60 +347,35 @@ static LRESULT CALLBACK ListWndProc(HWND hWnd, UINT message, WPARAM wParam, LPAR
|
|||
}
|
||||
|
||||
ListView_SortItems(hWnd, CompareFunc, (WPARAM)hWnd);
|
||||
break;
|
||||
return TRUE;
|
||||
case NM_DBLCLK:
|
||||
{
|
||||
SendMessage(hFrameWnd, WM_COMMAND, MAKEWPARAM(ID_EDIT_MODIFY, 0), 0);
|
||||
}
|
||||
break;
|
||||
return TRUE;
|
||||
|
||||
case NM_RCLICK: {
|
||||
int idx;
|
||||
LV_HITTESTINFO lvH;
|
||||
NM_LISTVIEW* pNm = (NM_LISTVIEW*)lParam;
|
||||
lvH.pt.x = pNm->ptAction.x;
|
||||
lvH.pt.y = pNm->ptAction.y;
|
||||
idx = ListView_HitTest(hWnd, &lvH);
|
||||
if (idx != -1) {
|
||||
POINT pt;
|
||||
GetCursorPos(&pt);
|
||||
ListViewPopUpMenu(hWnd, pt);
|
||||
return idx;
|
||||
case LVN_BEGINLABELEDIT:
|
||||
{
|
||||
PLINE_INFO lineinfo;
|
||||
Info = (NMLVDISPINFO*)lParam;
|
||||
if(Info)
|
||||
{
|
||||
lineinfo = (PLINE_INFO)Info->item.lParam;
|
||||
if(!lineinfo->name || !strcmp(lineinfo->name, _T("")))
|
||||
{
|
||||
*Result = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
*Result = FALSE;
|
||||
}
|
||||
}
|
||||
else
|
||||
*Result = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
}
|
||||
break;
|
||||
case WM_CONTEXTMENU:
|
||||
{
|
||||
POINTS pt;
|
||||
int cnt;
|
||||
pt = MAKEPOINTS(lParam);
|
||||
cnt = ListView_GetNextItem(hWnd, -1, LVNI_FOCUSED | LVNI_SELECTED);
|
||||
if(cnt == -1)
|
||||
{
|
||||
TrackPopupMenu(GetSubMenu(hPopupMenus, PM_NEW), TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
TrackPopupMenu(GetSubMenu(hPopupMenus, PM_MODIFYVALUE), TPM_RIGHTBUTTON, pt.x, pt.y, 0, hFrameWnd, NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case WM_KEYDOWN:
|
||||
if (wParam == VK_TAB) {
|
||||
/*TODO: SetFocus(Globals.hDriveBar) */
|
||||
/*SetFocus(child->nFocusPanel? child->left.hWnd: child->right.hWnd); */
|
||||
}
|
||||
/* fall thru... */
|
||||
default:
|
||||
return CallWindowProc(g_orgListWndProc, hWnd, message, wParam, lParam);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -406,7 +387,7 @@ HWND CreateListView(HWND hwndParent, int id)
|
|||
/* Get the dimensions of the parent window's client area, and create the list view control. */
|
||||
GetClientRect(hwndParent, &rcClient);
|
||||
hwndLV = CreateWindowEx(WS_EX_CLIENTEDGE, WC_LISTVIEW, _T("List View"),
|
||||
WS_VISIBLE | WS_CHILD | LVS_REPORT,
|
||||
WS_VISIBLE | WS_CHILD | LVS_REPORT | LVS_EDITLABELS,
|
||||
0, 0, rcClient.right, rcClient.bottom,
|
||||
hwndParent, (HMENU)id, hInst, NULL);
|
||||
if (!hwndLV) return NULL;
|
||||
|
@ -414,7 +395,7 @@ HWND CreateListView(HWND hwndParent, int id)
|
|||
/* Initialize the image list, and add items to the control. */
|
||||
if (!CreateListColumns(hwndLV)) goto fail;
|
||||
if (!InitListViewImageLists(hwndLV)) goto fail;
|
||||
g_orgListWndProc = SubclassWindow(hwndLV, ListWndProc);
|
||||
|
||||
return hwndLV;
|
||||
fail:
|
||||
DestroyWindow(hwndLV);
|
||||
|
@ -434,7 +415,9 @@ BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCTSTR keyPath)
|
|||
BOOL AddedDefault = FALSE;
|
||||
|
||||
if (!hwndLV) return FALSE;
|
||||
|
||||
|
||||
ListView_EditLabel(hwndLV, -1);
|
||||
|
||||
SendMessage(hwndLV, WM_SETREDRAW, FALSE, 0);
|
||||
count = ListView_GetItemCount(hwndLV);
|
||||
for (i = 0; i < count; i++) {
|
||||
|
|
|
@ -91,6 +91,8 @@ extern void UpdateStatusBar(void);
|
|||
extern HWND CreateListView(HWND hwndParent, int id);
|
||||
extern BOOL RefreshListView(HWND hwndLV, HKEY hKey, LPCTSTR keyPath);
|
||||
extern LPCTSTR GetValueName(HWND hwndLV);
|
||||
extern BOOL ListWndNotifyProc(HWND hWnd, WPARAM wParam, LPARAM lParam, BOOL *Result);
|
||||
extern BOOL IsDefaultValue(HWND hwndLV, int i);
|
||||
|
||||
/* treeview.c */
|
||||
extern HWND CreateTreeView(HWND hwndParent, LPTSTR pHostName, int id);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue