Skip to content

Commit

Permalink
Enable both horizontal and vertical (commit 536fb1f) resizing for "Cu…
Browse files Browse the repository at this point in the history
…stomize Schemes" dialog.
  • Loading branch information
zufuliu committed Nov 6, 2018
1 parent a713ae7 commit 0f32f31
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 10 deletions.
1 change: 0 additions & 1 deletion src/Helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,6 @@ NP2_inline void ResizeDlg_InitX(HWND hwnd, int cxFrame, int nIdGrip) {
NP2_inline void ResizeDlg_InitY(HWND hwnd, int cyFrame, int nIdGrip) {
ResizeDlg_InitEx(hwnd, 0, cyFrame, nIdGrip, ResizeDlgDirection_OnlyY);
}
void ResizeDlg_Init(HWND hwnd, int cxFrame, int cyFrame, int nIdGrip);
void ResizeDlg_Destroy(HWND hwnd, int *cxFrame, int *cyFrame);
void ResizeDlg_Size(HWND hwnd, LPARAM lParam, int *cx, int *cy);
void ResizeDlg_GetMinMaxInfo(HWND hwnd, LPARAM lParam);
Expand Down
2 changes: 1 addition & 1 deletion src/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,7 @@ BEGIN
PUSHBUTTON "Reset All",IDC_RESETALL,293,217,50,14
DEFPUSHBUTTON "OK",IDOK,355,217,50,14
PUSHBUTTON "Cancel",IDCANCEL,411,217,50,14
GROUPBOX "Info",IDC_STATIC,181,7,280,127
GROUPBOX "Info",IDC_INFO_GROUPBOX,181,7,280,127
ICON IDI_STYLES,IDC_STATIC,189,19,20,20
LTEXT "Customize Schemes",IDC_TITLE,220,25,200,12
LTEXT "Filename extensions must be separated by semicolon (;)",IDC_STATIC,191,44,247,13
Expand Down
28 changes: 20 additions & 8 deletions src/Styles.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ static BOOL bAutoSelect;
static int cxStyleSelectDlg;
static int cyStyleSelectDlg;
static int cyStyleCustomizeDlg;
static int cxStyleCustomizeDlg;

#define ALL_FILE_EXTENSIONS_BYTE_SIZE ((NUMLEXERS * MAX_EDITLEXER_EXT_SIZE) * sizeof(WCHAR))
static LPWSTR g_AllFileExtensions = NULL;
Expand Down Expand Up @@ -382,6 +383,7 @@ void Style_Load(void) {
cxStyleSelectDlg = IniSectionGetInt(pIniSection, L"SelectDlgSizeX", 0);
cyStyleSelectDlg = IniSectionGetInt(pIniSection, L"SelectDlgSizeY", 0);
cyStyleCustomizeDlg = IniSectionGetInt(pIniSection, L"CustomizeDlgSizeY", 0);
cxStyleCustomizeDlg = IniSectionGetInt(pIniSection, L"CustomizeDlgSizeX", 0);

LoadIniSection(INI_SECTION_NAME_FILE_EXTENSIONS, pIniSectionBuf, cchIniSection);
IniSectionParse(pIniSection, pIniSectionBuf);
Expand Down Expand Up @@ -500,6 +502,7 @@ void Style_Save(void) {
IniSectionSetInt(pIniSection, L"SelectDlgSizeX", cxStyleSelectDlg);
IniSectionSetInt(pIniSection, L"SelectDlgSizeY", cyStyleSelectDlg);
IniSectionSetInt(pIniSection, L"CustomizeDlgSizeY", cyStyleCustomizeDlg);
IniSectionSetInt(pIniSection, L"CustomizeDlgSizeX", cxStyleCustomizeDlg);

SaveIniSection(INI_SECTION_NAME_STYLES, pIniSectionBuf);

Expand Down Expand Up @@ -2903,7 +2906,7 @@ static INT_PTR CALLBACK Style_ConfigDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,

switch (umsg) {
case WM_INITDIALOG: {
ResizeDlg_InitY(hwnd, cyStyleCustomizeDlg, IDC_RESIZEGRIP3);
ResizeDlg_Init(hwnd, cxStyleCustomizeDlg, cyStyleCustomizeDlg, IDC_RESIZEGRIP3);

hwndTV = GetDlgItem(hwnd, IDC_STYLELIST);
fDragging = FALSE;
Expand Down Expand Up @@ -2960,19 +2963,28 @@ static INT_PTR CALLBACK Style_ConfigDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
DeleteBitmapButton(hwnd, IDC_STYLEBACK);
DeleteBitmapButton(hwnd, IDC_PREVSTYLE);
DeleteBitmapButton(hwnd, IDC_NEXTSTYLE);
ResizeDlg_Destroy(hwnd, NULL, &cyStyleCustomizeDlg);
ResizeDlg_Destroy(hwnd, &cxStyleCustomizeDlg, &cyStyleCustomizeDlg);
}
return FALSE;

case WM_SIZE: {
int dy;
int dx, dy;

ResizeDlg_Size(hwnd, lParam, NULL, &dy);
HDWP hdwp = BeginDeferWindowPos(7);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_RESIZEGRIP3, 0, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDOK, 0, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDCANCEL, 0, dy, SWP_NOSIZE);
ResizeDlg_Size(hwnd, lParam, &dx, &dy);
HDWP hdwp = BeginDeferWindowPos(16);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_RESIZEGRIP3, dx, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDOK, dx, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDCANCEL, dx, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLELIST, 0, dy, SWP_NOMOVE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_INFO_GROUPBOX, dx, 0, SWP_NOMOVE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLEEDIT, dx, 0, SWP_NOMOVE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLEFORE, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLEBACK, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLEFONT, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_PREVIEW, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLEDEFAULT, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_PREVSTYLE, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_NEXTSTYLE, dx, 0, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_IMPORT, 0, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_EXPORT, 0, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_RESETALL, 0, dy, SWP_NOSIZE);
Expand Down
1 change: 1 addition & 0 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@
#define IDC_TITLE 113
#define IDC_STYLELABELS 114
#define IDC_RESETALL 115
#define IDC_INFO_GROUPBOX 116
// Tab Settings
#define IDD_TABSETTINGS 124
// Long Lines
Expand Down

0 comments on commit 0f32f31

Please sign in to comment.