Skip to content

Commit

Permalink
Show built-in default value in "Customize Schemes" dialog, change edi…
Browse files Browse the repository at this point in the history
…t box in "Customize Schemes" dialog to multiline.
  • Loading branch information
zufuliu committed Nov 9, 2018
1 parent f34d7c4 commit dc6eadb
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
24 changes: 13 additions & 11 deletions src/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1112,27 +1112,29 @@ CAPTION "Customize Schemes"
FONT 8, "MS Shell Dlg", 400, 0, 0x1
BEGIN
CONTROL "",IDC_STYLELIST,"SysTreeView32",TVS_SHOWSELALWAYS | TVS_SINGLEEXPAND | WS_BORDER | WS_HSCROLL | WS_TABSTOP,7,7,164,224
LTEXT "",IDC_STYLELABEL,181,140,280,8
EDITTEXT IDC_STYLEEDIT,181,152,280,15,ES_AUTOHSCROLL
PUSHBUTTON "For&e...",IDC_STYLEFORE,181,174,46,14
PUSHBUTTON "&Back...",IDC_STYLEBACK,232,174,46,14
PUSHBUTTON "&Font...",IDC_STYLEFONT,283,174,42,14
PUSHBUTTON "&Preview",IDC_PREVIEW,330,174,42,14
PUSHBUTTON "&Reset",IDC_STYLEDEFAULT,377,174,42,14
PUSHBUTTON "",IDC_PREVSTYLE,426,174,15,14
PUSHBUTTON "",IDC_NEXTSTYLE,446,174,15,14
LTEXT "",IDC_STYLELABEL,181,132,280,8
EDITTEXT IDC_STYLEEDIT,181,142,280,18,ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL
PUSHBUTTON "For&e...",IDC_STYLEFORE,181,195,46,14
PUSHBUTTON "&Back...",IDC_STYLEBACK,232,195,46,14
PUSHBUTTON "&Font...",IDC_STYLEFONT,283,195,42,14
PUSHBUTTON "&Preview",IDC_PREVIEW,330,195,42,14
PUSHBUTTON "&Reset",IDC_STYLEDEFAULT,377,195,42,14
PUSHBUTTON "",IDC_PREVSTYLE,426,195,15,14
PUSHBUTTON "",IDC_NEXTSTYLE,446,195,15,14
PUSHBUTTON "&Import...",IDC_IMPORT,181,217,50,14
PUSHBUTTON "E&xport...",IDC_EXPORT,237,217,50,14
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_INFO_GROUPBOX,181,7,280,127
GROUPBOX "Info",IDC_INFO_GROUPBOX,181,7,280,122
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
LTEXT "Style format:\n\tfont:Name; size:[+|-]nn.mm; bold; italic; underline; strike;\n\tcharset:dd; case:[U|L];\n\tfore:#ffffff; back:#bbbbbb; alpha:aa; eolfilled;",IDC_STATIC,191,60,260,34
LTEXT "Style properties can be copied using copy and paste or drag and drop.\n\nThe ""Preview"" button will not apply any changes.",IDC_STATIC,191,100,247,30
LTEXT "Style properties can be copied using copy and paste or drag and drop.\n\nThe ""Preview"" button will not apply any changes.",IDC_STATIC,191,100,260,26
LTEXT "Associated file&name extensions:|Style &settings:",IDC_STYLELABELS,315,230,152,8,NOT WS_VISIBLE
LTEXT "Built-in default value:",IDC_STYLELABEL_DEFAULT,181,162,160,8
EDITTEXT IDC_STYLEVALUE_DEFAULT,181,172,280,18,ES_READONLY | ES_MULTILINE | ES_AUTOVSCROLL | WS_VSCROLL
SCROLLBAR IDC_RESIZEGRIP3,7,217,10,10
END

Expand Down
26 changes: 17 additions & 9 deletions src/Styles.c
Original file line number Diff line number Diff line change
Expand Up @@ -2976,24 +2976,28 @@ static INT_PTR CALLBACK Style_ConfigDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
int dx, dy;

ResizeDlg_Size(hwnd, lParam, &dx, &dy);
HDWP hdwp = BeginDeferWindowPos(16);
const int cy = (dy > 0) ? (dy - dy / 2) : (dy / 2);
HDWP hdwp = BeginDeferWindowPos(18);
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_STYLEEDIT, dx, cy, SWP_NOMOVE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLELABEL_DEFAULT, 0, cy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLEVALUE_DEFAULT, 0, cy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLEFORE, dx, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLEBACK, dx, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLEFONT, dx, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_PREVIEW, dx, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLEDEFAULT, dx, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_PREVSTYLE, dx, dy, SWP_NOSIZE);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_NEXTSTYLE, dx, dy, 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);
EndDeferWindowPos(hdwp);
ResizeDlgCtl(hwnd, IDC_STYLEVALUE_DEFAULT, dx, dy - cy);
}
return TRUE;

Expand Down Expand Up @@ -3040,6 +3044,7 @@ static INT_PTR CALLBACK Style_ConfigDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
//CheckDlgButton(hwnd, IDC_STYLEUNDERLINE, BST_UNCHECKED);
//CheckDlgButton(hwnd, IDC_STYLEEOLFILLED, BST_UNCHECKED);
SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentLexer->szExtensions);
SetDlgItemText(hwnd, IDC_STYLEVALUE_DEFAULT, pCurrentLexer->pszDefExt);
} else {
SetDlgItemText(hwnd, IDC_STYLELABEL, L"");
EnableWindow(GetDlgItem(hwnd, IDC_STYLEEDIT), FALSE);
Expand All @@ -3056,6 +3061,7 @@ static INT_PTR CALLBACK Style_ConfigDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
//CheckDlgButton(hwnd, IDC_STYLEUNDERLINE, BST_UNCHECKED);
//CheckDlgButton(hwnd, IDC_STYLEEOLFILLED, BST_UNCHECKED);
SetDlgItemText(hwnd, IDC_STYLEEDIT, L"");
SetDlgItemText(hwnd, IDC_STYLEVALUE_DEFAULT, L"");
}
}

Expand Down Expand Up @@ -3085,6 +3091,7 @@ static INT_PTR CALLBACK Style_ConfigDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
//CheckDlgButton(hwnd, IDC_STYLEUNDERLINE, Style_StrGetAttribute(pCurrentStyle->szValue, L"underline") ? BST_CHECKED : BST_UNCHECKED);
//CheckDlgButton(hwnd, IDC_STYLEEOLFILLED, Style_StrGetAttribute(pCurrentStyle->szValue, L"eolfilled") ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemText(hwnd, IDC_STYLEEDIT, pCurrentStyle->szValue);
SetDlgItemText(hwnd, IDC_STYLEVALUE_DEFAULT, pCurrentStyle->pszDefault);
} else {
SetDlgItemText(hwnd, IDC_STYLELABEL, L"");
EnableWindow(GetDlgItem(hwnd, IDC_STYLEEDIT), FALSE);
Expand All @@ -3101,6 +3108,7 @@ static INT_PTR CALLBACK Style_ConfigDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,
//CheckDlgButton(hwnd, IDC_STYLEUNDERLINE, BST_UNCHECKED);
//CheckDlgButton(hwnd, IDC_STYLEEOLFILLED, BST_UNCHECKED);
SetDlgItemText(hwnd, IDC_STYLEEDIT, L"");
SetDlgItemText(hwnd, IDC_STYLEVALUE_DEFAULT, L"");
}
}
}
Expand Down
2 changes: 2 additions & 0 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,8 @@
#define IDC_STYLELABELS 114
#define IDC_RESETALL 115
#define IDC_INFO_GROUPBOX 116
#define IDC_STYLELABEL_DEFAULT 117
#define IDC_STYLEVALUE_DEFAULT 118
// Tab Settings
#define IDD_TABSETTINGS 124
#define IDC_TAB_WIDTH 100
Expand Down

0 comments on commit dc6eadb

Please sign in to comment.