Skip to content

Commit

Permalink
metapath support clear recent Copy/Move destination history.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Aug 12, 2018
1 parent 91e571d commit 7ca3568
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 0 deletions.
13 changes: 13 additions & 0 deletions metapath/src/Dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1538,6 +1538,11 @@ INT_PTR CALLBACK CopyMoveDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lPa
SetWindowPos(GetDlgItem(hwnd, IDC_RESIZEGRIP2), NULL, rc.left + dxClient, rc.top + dyClient, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
InvalidateRect(GetDlgItem(hwnd, IDC_RESIZEGRIP2), NULL, TRUE);

GetWindowRect(GetDlgItem(hwnd, IDC_EMPTY_MRU), &rc);
MapWindowPoints(NULL, hwnd, (LPPOINT)&rc, 2);
SetWindowPos(GetDlgItem(hwnd, IDC_EMPTY_MRU), NULL, rc.left + dxClient, rc.top + dyClient, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
InvalidateRect(GetDlgItem(hwnd, IDC_EMPTY_MRU), NULL, TRUE);

GetWindowRect(GetDlgItem(hwnd, IDOK), &rc);
MapWindowPoints(NULL, hwnd, (LPPOINT)&rc, 2);
SetWindowPos(GetDlgItem(hwnd, IDOK), NULL, rc.left + dxClient, rc.top + dyClient, 0, 0, SWP_NOZORDER | SWP_NOSIZE);
Expand Down Expand Up @@ -1573,6 +1578,14 @@ INT_PTR CALLBACK CopyMoveDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lPa
}
return TRUE;

case WM_NOTIFY: {
LPNMHDR pnmhdr = (LPNMHDR)lParam;
if (pnmhdr->idFrom == IDC_EMPTY_MRU && (pnmhdr->code == NM_CLICK || pnmhdr->code == NM_RETURN)) {
MRU_ClearCombobox(GetDlgItem(hwnd, IDC_DESTINATION), L"Copy/Move MRU");
}
}
return TRUE;

case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_DESTINATION:
Expand Down
9 changes: 9 additions & 0 deletions metapath/src/Helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1449,6 +1449,15 @@ void MRU_AddOneItem(LPCWSTR pszKey, LPCWSTR pszNewItem) {
}
}

void MRU_ClearCombobox(HWND hwnd, LPCWSTR pszKey) {
LPMRULIST pmru = MRU_Create(pszKey, MRU_NOCASE, 8);
MRU_Load(pmru);
MRU_Empty(pmru);
MRU_Save(pmru);
MRU_Destroy(pmru);
SendMessage(hwnd, CB_RESETCONTENT, 0, 0);
}

/*
Themed Dialogs
Expand Down
1 change: 1 addition & 0 deletions metapath/src/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ BOOL MRU_Load(LPMRULIST pmru);
BOOL MRU_Save(LPMRULIST pmru);
void MRU_LoadToCombobox(HWND hwnd, LPCWSTR pszKey);
void MRU_AddOneItem(LPCWSTR pszKey, LPCWSTR pszNewItem);
void MRU_ClearCombobox(HWND hwnd, LPCWSTR pszKey);

//==== Themed Dialogs =========================================================
#ifndef DLGTEMPLATEEX
Expand Down
1 change: 1 addition & 0 deletions metapath/src/metapath.rc
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ BEGIN
COMBOBOX IDC_DESTINATION,7,48,199,105,CBS_DROPDOWN |
CBS_AUTOHSCROLL | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "",IDC_BROWSEDESTINATION,210,48,13,13
CONTROL "<a>Clear Recent History</a>",IDC_EMPTY_MRU,"SysLink",WS_TABSTOP,154,37,70,10
LTEXT "Action:",IDC_STATIC,7,72,24,8
CONTROL "&Copy",IDC_FUNCCOPY,"Button",BS_AUTORADIOBUTTON |
WS_TABSTOP,35,71,33,10
Expand Down
1 change: 1 addition & 0 deletions metapath/src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@
#define IDC_REUSEWINDOW 106
#define IDI_PROGS 106
#define IDC_EMAIL_TEXT 106
#define IDC_EMPTY_MRU 106
#define IDD_NEWDIR 107
#define IDC_ESCFUNCTION 107
#define IDC_COLOR_PICK2 107
Expand Down

0 comments on commit 7ca3568

Please sign in to comment.