Skip to content

Commit

Permalink
Make metapath's "Rename" dialog resizable.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Nov 4, 2018
1 parent 2bc0126 commit 87b5230
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 0 deletions.
24 changes: 24 additions & 0 deletions metapath/src/Dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1274,6 +1274,7 @@ typedef struct tagFILEOPDLGDATA {
UINT wFunc;
} FILEOPDLGDATA, *LPFILEOPDLGDATA;

extern int cxRenameFileDlg;
//=============================================================================
//
// RenameFileDlgProc()
Expand All @@ -1283,6 +1284,7 @@ INT_PTR CALLBACK RenameFileDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM l
switch (umsg) {
case WM_INITDIALOG: {
SetWindowLongPtr(hwnd, DWLP_USER, lParam);
ResizeDlg_InitX(hwnd, cxRenameFileDlg, IDC_RESIZEGRIP4);
LPFILEOPDLGDATA lpfod = (LPFILEOPDLGDATA)lParam;

SetDlgItemText(hwnd, IDC_OLDNAME, lpfod->szSource);
Expand All @@ -1294,6 +1296,28 @@ INT_PTR CALLBACK RenameFileDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM l
}
return TRUE;

case WM_DESTROY:
ResizeDlg_Destroy(hwnd, &cxRenameFileDlg, NULL);
return FALSE;

case WM_SIZE: {
int dx;

ResizeDlg_Size(hwnd, lParam, &dx, NULL);
HDWP hdwp = BeginDeferWindowPos(5);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_RESIZEGRIP4, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDOK, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDCANCEL, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_OLDNAME, dx, 0, SWP_NOMOVE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_NEWNAME, dx, 0, SWP_NOMOVE);
EndDeferWindowPos(hdwp);
}
return TRUE;

case WM_GETMINMAXINFO:
ResizeDlg_GetMinMaxInfo(hwnd, lParam);
return TRUE;

case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_NEWNAME:
Expand Down
3 changes: 3 additions & 0 deletions metapath/src/metapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ static BOOL bShowDriveBox;
int cxRunDlg;
int cxGotoDlg;
int cxFileFilterDlg;
int cxRenameFileDlg;
int cxOpenWithDlg;
int cyOpenWithDlg;
int cxCopyMoveDlg;
Expand Down Expand Up @@ -2470,6 +2471,7 @@ void LoadSettings(void) {
cxRunDlg = IniSectionGetInt(pIniSection, L"RunDlgSizeX", 0);
cxGotoDlg = IniSectionGetInt(pIniSection, L"GotoDlgSizeX", 0);
cxFileFilterDlg = IniSectionGetInt(pIniSection, L"FileFilterDlgX", 0);
cxRenameFileDlg = IniSectionGetInt(pIniSection, L"RenameFileDlgX", 0);
cxOpenWithDlg = IniSectionGetInt(pIniSection, L"OpenWithDlgSizeX", 0);
cyOpenWithDlg = IniSectionGetInt(pIniSection, L"OpenWithDlgSizeY", 0);
cxCopyMoveDlg = IniSectionGetInt(pIniSection, L"CopyMoveDlgSizeX", 0);
Expand Down Expand Up @@ -2599,6 +2601,7 @@ void SaveSettings(BOOL bSaveSettingsNow) {
IniSectionSetInt(pIniSection, L"RunDlgSizeX", cxRunDlg);
IniSectionSetInt(pIniSection, L"GotoDlgSizeX", cxGotoDlg);
IniSectionSetInt(pIniSection, L"FileFilterDlgX", cxFileFilterDlg);
IniSectionSetInt(pIniSection, L"RenameFileDlgX", cxRenameFileDlg);
IniSectionSetInt(pIniSection, L"OpenWithDlgSizeX", cxOpenWithDlg);
IniSectionSetInt(pIniSection, L"OpenWithDlgSizeY", cyOpenWithDlg);
IniSectionSetInt(pIniSection, L"CopyMoveDlgSizeX", cxCopyMoveDlg);
Expand Down
1 change: 1 addition & 0 deletions metapath/src/metapath.rc
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,7 @@ BEGIN
EDITTEXT IDC_NEWNAME,39,26,126,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,59,53,50,14,WS_DISABLED
PUSHBUTTON "Cancel",IDCANCEL,115,53,50,14
SCROLLBAR IDC_RESIZEGRIP4,7,53,10,10
END

IDD_NEWDIR DIALOGEX 0, 0, 172, 66
Expand Down
1 change: 1 addition & 0 deletions metapath/src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#define IDC_TRACKSELECT 101
#define IDC_BROWSE_Q 101
#define IDC_COPYRIGHT 101
#define IDC_RESIZEGRIP4 102
#define IDD_GOTO 102
#define IDI_GOTO 102
#define IDC_BROWSEDESTINATION 102
Expand Down

0 comments on commit 87b5230

Please sign in to comment.