Skip to content

Commit

Permalink
Make metapath's "Target Application" dialog resizable.
Browse files Browse the repository at this point in the history
  • Loading branch information
zufuliu committed Nov 4, 2018
1 parent e84703d commit 2afad02
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 18 deletions.
26 changes: 25 additions & 1 deletion metapath/src/Dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM lParam)
int dx;

ResizeDlg_Size(hwnd, lParam, &dx, NULL);
HDWP hdwp = BeginDeferWindowPos(5);
HDWP hdwp = BeginDeferWindowPos(6);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_RESIZEGRIP3, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDOK, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDCANCEL, dx, 0, SWP_NOSIZE);
Expand Down Expand Up @@ -2026,6 +2026,7 @@ static INT_PTR CALLBACK FindWinDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPAR
//
extern int iUseTargetApplication;
extern int iTargetApplicationMode;
extern int cxTargetApplicationDlg;
extern BOOL bLoadLaunchSetingsLoaded;
extern WCHAR szTargetApplication[MAX_PATH];
extern WCHAR szTargetApplicationParams[MAX_PATH];
Expand All @@ -2041,6 +2042,7 @@ INT_PTR CALLBACK FindTargetDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM l

switch (umsg) {
case WM_INITDIALOG: {
ResizeDlg_InitX(hwnd, cxTargetApplicationDlg, IDC_RESIZEGRIP4);
// ToolTip for browse button
HWND hwndToolTip = CreateWindowEx(0, TOOLTIPS_CLASS, NULL, 0, 0, 0, 0, 0, hwnd, NULL, g_hInstance, NULL);

Expand Down Expand Up @@ -2117,10 +2119,32 @@ INT_PTR CALLBACK FindTargetDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM l
return TRUE;

case WM_DESTROY:
ResizeDlg_Destroy(hwnd, &cxTargetApplicationDlg, NULL);
DeleteBitmapButton(hwnd, IDC_BROWSE);
//DeleteBitmapButton(hwnd, IDC_FINDWIN);
return FALSE;

case WM_SIZE: {
int dx;

ResizeDlg_Size(hwnd, lParam, &dx, NULL);
HDWP hdwp = BeginDeferWindowPos(8);
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_TARGETPATH, dx, 0, SWP_NOMOVE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_BROWSE, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_DDEMSG, dx, 0, SWP_NOMOVE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_DDEAPP, dx, 0, SWP_NOMOVE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_DDETOPIC, 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_BROWSE: {
Expand Down
3 changes: 3 additions & 0 deletions metapath/src/metapath.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ int cxNewDirectoryDlg;
int cxOpenWithDlg;
int cyOpenWithDlg;
int cxCopyMoveDlg;
int cxTargetApplicationDlg;
int cxFindWindowDlg;

WCHAR tchFilter[DL_FILTER_BUFSIZE];
Expand Down Expand Up @@ -2478,6 +2479,7 @@ void LoadSettings(void) {
cxOpenWithDlg = IniSectionGetInt(pIniSection, L"OpenWithDlgSizeX", 0);
cyOpenWithDlg = IniSectionGetInt(pIniSection, L"OpenWithDlgSizeY", 0);
cxCopyMoveDlg = IniSectionGetInt(pIniSection, L"CopyMoveDlgSizeX", 0);
cxTargetApplicationDlg = IniSectionGetInt(pIniSection, L"TargetApplicationDlgSizeX", 0);
cxFindWindowDlg = IniSectionGetInt(pIniSection, L"FindWindowDlgSizeX", 0);

if (!flagPosParam) {
Expand Down Expand Up @@ -2610,6 +2612,7 @@ void SaveSettings(BOOL bSaveSettingsNow) {
IniSectionSetInt(pIniSection, L"OpenWithDlgSizeX", cxOpenWithDlg);
IniSectionSetInt(pIniSection, L"OpenWithDlgSizeY", cyOpenWithDlg);
IniSectionSetInt(pIniSection, L"CopyMoveDlgSizeX", cxCopyMoveDlg);
IniSectionSetInt(pIniSection, L"TargetApplicationDlgSizeX", cxTargetApplicationDlg);
IniSectionSetInt(pIniSection, L"FindWindowDlgSizeX", cxFindWindowDlg);

SaveIniSection(INI_SECTION_NAME_SETTINGS, pIniSectionBuf);
Expand Down
19 changes: 10 additions & 9 deletions metapath/src/metapath.rc
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,7 @@ BEGIN
PUSHBUTTON "",IDC_BROWSE_F,204,87,14,14,BS_BITMAP
END

IDD_FINDTARGET DIALOGEX 0, 0, 272, 180
IDD_FINDTARGET DIALOGEX 0, 0, 272, 210
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION |
WS_SYSMENU
CAPTION "Target Application"
Expand All @@ -478,21 +478,22 @@ BEGIN
IDC_STATIC,7,64,260,8
EDITTEXT IDC_TARGETPATH,20,35,226,14,ES_AUTOHSCROLL
PUSHBUTTON "",IDC_BROWSE,251,35,14,14,BS_BITMAP
LTEXT "Message:",IDC_STATIC,20,120,32,8
LTEXT "Message:",IDC_STATIC,29,124,35,8
CONTROL "None, run target application each time a file is opened.",
IDC_ALWAYSRUN,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,7,78,240,10
CONTROL "Send a file open message to target application window:",
IDC_SENDDROPMSG,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP,7,92,194,10
CONTROL "Execute the following DDE command:",IDC_USEDDE,"Button",
BS_AUTORADIOBUTTON | WS_TABSTOP,7,106,160,10
LTEXT "Application:",IDC_STATIC,128,120,46,8
LTEXT "Application:",IDC_STATIC,23,145,42,8
PUSHBUTTON "Find Window...",IDC_FINDWIN,204,91,60,14
LTEXT "Topic:",IDC_STATIC,198,120,24,8
EDITTEXT IDC_DDEMSG,20,130,104,14,ES_AUTOHSCROLL
EDITTEXT IDC_DDEAPP,128,130,66,14,ES_AUTOHSCROLL
EDITTEXT IDC_DDETOPIC,198,130,66,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,160,159,50,14
PUSHBUTTON "Cancel",IDCANCEL,214,159,50,14
LTEXT "Topic:",IDC_STATIC,40,165,24,8
EDITTEXT IDC_DDEMSG,65,122,200,14,ES_AUTOHSCROLL
EDITTEXT IDC_DDEAPP,65,142,200,14,ES_AUTOHSCROLL
EDITTEXT IDC_DDETOPIC,65,162,200,14,ES_AUTOHSCROLL
DEFPUSHBUTTON "OK",IDOK,159,189,50,14
PUSHBUTTON "Cancel",IDCANCEL,215,189,50,14
SCROLLBAR IDC_RESIZEGRIP4,7,189,10,10
END

IDD_FINDWIN DIALOGEX 0, 0, 210, 85
Expand Down
15 changes: 8 additions & 7 deletions metapath/src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,48 +64,49 @@
#define IDC_GOTODESC 103
#define IDD_RENAME 104
#define IDC_FUNCMOVE 104
#define IDC_RESIZEGRIP4 104
#define IDC_RENAMEONCOLLISION 104
#define IDC_COLOR_DEF2 104
#define IDC_ALWAYSRUN 104
#define IDC_ALWAYSONTOP 104
#define IDI_OPTIONS2 104
#define IDC_AUTHORNAME 104
#define IDC_FINDWINDESC 104
#define IDD_COPYMOVE 105
#define IDC_ALWAYSRUN 105
#define IDC_RESIZEGRIP5 105
#define IDC_USERECYCLEBIN 105
#define IDC_COLOR_CUST2 105
#define IDC_SENDDROPMSG 105
#define IDC_MINIMIZETOTRAY 105
#define IDI_ITEMS 105
#define IDC_EMAIL_LINK 105
#define IDC_SENDDROPMSG 106
#define IDD_OPENWITH 106
#define IDC_NOCONFIRMDELETE 106
#define IDC_COLOR_SAMP2 106
#define IDC_USEDDE 106
#define IDC_REUSEWINDOW 106
#define IDI_PROGS 106
#define IDC_EMAIL_TEXT 106
#define IDC_EMPTY_MRU 106
#define IDC_USEDDE 107
#define IDD_NEWDIR 107
#define IDC_ESCFUNCTION 107
#define IDC_COLOR_PICK2 107
#define IDC_FINDWIN 107
#define IDC_SAVESETTINGS 107
#define IDI_CROSS1 107
#define IDC_FINDWIN 108
#define IDC_ESCMIN 108
#define IDD_FINDTARGET 108
#define IDC_DDEMSG 108
#define IDI_CROSS2 108
#define IDC_CLEARWINPOS 108
#define IDC_DDEMSG 109
#define IDC_ESCEXIT 109
#define IDD_FINDWIN 109
#define IDC_DDEAPP 109
#define IDC_RTL_LAYOUT 109
#define IDC_NEW_PAGE_TEXT 109
#define IDC_NEW_PAGE_LINK 110
#define IDPP_GENERAL 110
#define IDC_DDETOPIC 110
#define IDC_DDEAPP 110
#define IDC_DDETOPIC 111
#define IDC_BUILD_INFO 111
#define IDPP_ADVANCED 111
#define IDPP_ITEMS 112
Expand Down
2 changes: 1 addition & 1 deletion src/Dialogs.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ static INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT umsg, WPARAM wParam, LPARAM l
int dx;

ResizeDlg_Size(hwnd, lParam, &dx, NULL);
HDWP hdwp = BeginDeferWindowPos(5);
HDWP hdwp = BeginDeferWindowPos(6);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_RESIZEGRIP3, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDOK, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDCANCEL, dx, 0, SWP_NOSIZE);
Expand Down

0 comments on commit 2afad02

Please sign in to comment.