Skip to content

Commit

Permalink
Make metapath's "New Directory" dialog resizable.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Nov 4, 2018
1 parent 87b5230 commit ea83c2b
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
23 changes: 23 additions & 0 deletions metapath/src/Dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1595,6 +1595,7 @@ extern int flagNoFadeHidden;

extern int cxOpenWithDlg;
extern int cyOpenWithDlg;
extern int cxNewDirectoryDlg;

INT_PTR CALLBACK OpenWithDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam) {
switch (umsg) {
Expand Down Expand Up @@ -1793,12 +1794,34 @@ INT_PTR CALLBACK NewDirDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lPara
switch (umsg) {
case WM_INITDIALOG: {
SetWindowLongPtr(hwnd, DWLP_USER, lParam);
ResizeDlg_InitX(hwnd, cxNewDirectoryDlg, IDC_RESIZEGRIP);

SendDlgItemMessage(hwnd, IDC_NEWDIR, EM_LIMITTEXT, MAX_PATH - 1, 0);
CenterDlgInParent(hwnd);
}
return TRUE;

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

case WM_SIZE: {
int dx;

ResizeDlg_Size(hwnd, lParam, &dx, NULL);
HDWP hdwp = BeginDeferWindowPos(4);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_RESIZEGRIP, 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_NEWDIR, 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_NEWDIR:
Expand Down
3 changes: 3 additions & 0 deletions metapath/src/metapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ int cxRunDlg;
int cxGotoDlg;
int cxFileFilterDlg;
int cxRenameFileDlg;
int cxNewDirectoryDlg;
int cxOpenWithDlg;
int cyOpenWithDlg;
int cxCopyMoveDlg;
Expand Down Expand Up @@ -2472,6 +2473,7 @@ void LoadSettings(void) {
cxGotoDlg = IniSectionGetInt(pIniSection, L"GotoDlgSizeX", 0);
cxFileFilterDlg = IniSectionGetInt(pIniSection, L"FileFilterDlgX", 0);
cxRenameFileDlg = IniSectionGetInt(pIniSection, L"RenameFileDlgX", 0);
cxNewDirectoryDlg = IniSectionGetInt(pIniSection, L"NewDirectoryDlgX", 0);
cxOpenWithDlg = IniSectionGetInt(pIniSection, L"OpenWithDlgSizeX", 0);
cyOpenWithDlg = IniSectionGetInt(pIniSection, L"OpenWithDlgSizeY", 0);
cxCopyMoveDlg = IniSectionGetInt(pIniSection, L"CopyMoveDlgSizeX", 0);
Expand Down Expand Up @@ -2602,6 +2604,7 @@ void SaveSettings(BOOL bSaveSettingsNow) {
IniSectionSetInt(pIniSection, L"GotoDlgSizeX", cxGotoDlg);
IniSectionSetInt(pIniSection, L"FileFilterDlgX", cxFileFilterDlg);
IniSectionSetInt(pIniSection, L"RenameFileDlgX", cxRenameFileDlg);
IniSectionSetInt(pIniSection, L"NewDirectoryDlgX", cxNewDirectoryDlg);
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 @@ -333,6 +333,7 @@ BEGIN
EDITTEXT IDC_NEWDIR,7,22,158,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,59,45,50,14,WS_DISABLED
PUSHBUTTON "Cancel",IDCANCEL,115,45,50,14
SCROLLBAR IDC_RESIZEGRIP,7,45,10,10
END

IDD_COPYMOVE DIALOGEX 0, 0, 230, 95
Expand Down

0 comments on commit ea83c2b

Please sign in to comment.