Skip to content

Commit

Permalink
Make "Customize Schemes" dialog resizable.
Browse files Browse the repository at this point in the history
Rearrange control id, grouped by type and dialog.
  • Loading branch information
zufuliu committed Nov 5, 2018
1 parent 7a4fa70 commit 536fb1f
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 44 deletions.
1 change: 1 addition & 0 deletions src/Notepad2.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1133,6 +1133,7 @@ BEGIN
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 "Associated file&name extensions:|Style &settings:",IDC_STYLELABELS,315,230,152,8,NOT WS_VISIBLE
SCROLLBAR IDC_RESIZEGRIP3,7,217,10,10
END

IDD_TABSETTINGS DIALOGEX 0, 0, 174, 90
Expand Down
26 changes: 26 additions & 0 deletions src/Styles.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ static int iDefaultLexer;
static BOOL bAutoSelect;
static int cxStyleSelectDlg;
static int cyStyleSelectDlg;
static int cyStyleCustomizeDlg;

#define ALL_FILE_EXTENSIONS_BYTE_SIZE ((NUMLEXERS * MAX_EDITLEXER_EXT_SIZE) * sizeof(WCHAR))
static LPWSTR g_AllFileExtensions = NULL;
Expand Down Expand Up @@ -380,6 +381,7 @@ void Style_Load(void) {
// scheme select dlg dimensions
cxStyleSelectDlg = IniSectionGetInt(pIniSection, L"SelectDlgSizeX", 0);
cyStyleSelectDlg = IniSectionGetInt(pIniSection, L"SelectDlgSizeY", 0);
cyStyleCustomizeDlg = IniSectionGetInt(pIniSection, L"CustomizeDlgSizeY", 0);

LoadIniSection(INI_SECTION_NAME_FILE_EXTENSIONS, pIniSectionBuf, cchIniSection);
IniSectionParse(pIniSection, pIniSectionBuf);
Expand Down Expand Up @@ -497,6 +499,7 @@ void Style_Save(void) {
// scheme select dlg dimensions
IniSectionSetInt(pIniSection, L"SelectDlgSizeX", cxStyleSelectDlg);
IniSectionSetInt(pIniSection, L"SelectDlgSizeY", cyStyleSelectDlg);
IniSectionSetInt(pIniSection, L"CustomizeDlgSizeY", cyStyleCustomizeDlg);

SaveIniSection(INI_SECTION_NAME_STYLES, pIniSectionBuf);

Expand Down Expand Up @@ -2888,6 +2891,8 @@ static INT_PTR CALLBACK Style_ConfigDlgProc(HWND hwnd, UINT umsg, WPARAM wParam,

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

hwndTV = GetDlgItem(hwnd, IDC_STYLELIST);
fDragging = FALSE;

Expand Down Expand Up @@ -2943,9 +2948,30 @@ 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);
}
return FALSE;

case WM_SIZE: {
int 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);
hdwp = DeferCtlPos(hdwp, hwnd, IDC_STYLELIST, 0, dy, SWP_NOMOVE);
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);
}
return TRUE;

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

case WM_NOTIFY:
if (((LPNMHDR)(lParam))->idFrom == IDC_STYLELIST) {
LPNMTREEVIEW lpnmtv = (LPNMTREEVIEW)lParam;
Expand Down
95 changes: 51 additions & 44 deletions src/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,122 +3,129 @@
// Used by Notepad2.rc
//
#define IDR_RT_MANIFEST 1
// Icon, Accelerator, Menu
#define IDR_MAINWND 100
#define IDR_POPUPMENU 101
#define IDR_ACCFINDREPLACE 101
#define IDI_RUN 101
#define IDI_STYLES 102
// Bitmap
#define IDB_OPEN 101
#define IDB_PREV 102
#define IDB_NEXT 103
#define IDB_PICK 104
#define IDB_ENCODING 105
// Cursor
#define IDC_COPY 100

// About
#define IDD_ABOUT 100
#define IDC_VERSION 100
#define IDC_COPYRIGHT 101
#define IDC_AUTHORNAME 102
#define IDC_WEBPAGE_TEXT 103
#define IDC_WEBPAGE_LINK 104
#define IDC_EMAIL_TEXT 105
#define IDC_EMAIL_LINK 106
#define IDC_MOD_PAGE_TEXT 107
#define IDC_MOD_PAGE_LINK 108
#define IDC_NEW_PAGE_TEXT 109
#define IDC_NEW_PAGE_LINK 110
#define IDC_SCI_PAGE_TEXT 111
#define IDC_SCI_PAGE_LINK 112

#define IDC_FINDTEXT 100
#define IDC_LINENUM 100
#define IDC_COMMANDLINE 100
#define IDC_OPENWITHDIR 100
#define IDC_FILEMRU 100
#define IDC_STYLELIST 100
#define IDC_FAVORITESDIR 100
#define IDC_FAVORITESFILE 100
#define IDC_COLUMNWRAP 100
#define IDC_INFOBOXICON 100
#define IDC_COPY 100
#define IDC_ENCODINGLIST 100
#define IDC_EOLMODELIST 100
#define IDC_MODIFY_LINE_PREFIX 100
#define IDC_MODIFY_LINE_APPEND 101
#define IDC_SEARCHEXE 101
#define IDR_POPUPMENU 101
#define IDC_GETOPENWITHDIR 101
#define IDC_RESIZEGRIP 101
#define IDD_OPENWITH 101
#define IDC_REPLACETEXT 101
#define IDI_RUN 101
#define IDC_COLNUM 101
#define IDC_DEFAULTSCHEME 101
#define IDC_GETFAVORITESDIR 101
#define IDC_INFOBOXTEXT 101
#define IDB_OPEN 101
#define IDR_ACCFINDREPLACE 101
#define IDC_STYLELABEL 101
#define IDC_RESIZEGRIP2 102
#define IDC_NOUNICODEDETECTION 101
#define IDC_WARNINCONSISTENTEOLS 101
#define IDC_STYLEEDIT 102
#define IDC_OPENWITHDESCR 102
#define IDC_SAVEMRU 102
#define IDD_RUN 102
#define IDC_RUNDESC 102
#define IDC_AUTOSELECT 102
#define IDC_FAVORITESDESCR 102
#define IDC_INFOBOXCHECK 102
#define IDC_CONSISTENTEOLS 102
#define IDB_PREV 102
#define IDI_STYLES 102
#define IDC_ASCIIASUTF8 102
#define IDC_LINE_RANGE 102
#define IDC_EOL_SUM_CRLF 102
#define IDD_DEFENCODING 103
#define IDC_FINDCASE 103
#define IDC_RESIZEGRIP3 103
#define IDB_NEXT 103
#define IDC_STYLEFORE 103
#define IDC_AUTOSTRIPBLANKS 103
#define IDC_ENCODINGFROMFILEVARS 103
#define IDC_EMPTY_MRU 103
#define IDC_EOL_SUM_LF 103
#define IDC_EOL_SUM_CR 104
#define IDC_FINDWORD 104

#define IDD_ABOUT 100
#define IDC_VERSION 100
#define IDC_COPYRIGHT 101
#define IDC_AUTHORNAME 102
#define IDC_WEBPAGE_TEXT 103
#define IDC_WEBPAGE_LINK 104
#define IDC_EMAIL_TEXT 105
#define IDC_EMAIL_LINK 106
#define IDC_MOD_PAGE_TEXT 107
#define IDC_MOD_PAGE_LINK 108
#define IDC_NEW_PAGE_TEXT 109
#define IDC_NEW_PAGE_LINK 110
#define IDC_SCI_PAGE_TEXT 111
#define IDC_SCI_PAGE_LINK 112
// Select Scheme
#define IDD_STYLESELECT 120
#define IDC_STYLELIST 100
#define IDC_DEFAULTSCHEME 101
#define IDC_AUTOSELECT 102
// Customize Schemes
#define IDD_STYLECONFIG 121
#define IDC_STYLELABEL 101
#define IDC_STYLEEDIT 102
#define IDC_STYLEFORE 104
#define IDC_STYLEBACK 105
#define IDC_STYLEFONT 106
#define IDC_PREVIEW 107
#define IDC_STYLEDEFAULT 108
#define IDC_PREVSTYLE 109
#define IDC_NEXTSTYLE 110
#define IDC_IMPORT 111
#define IDC_EXPORT 112
#define IDC_TITLE 113
#define IDC_STYLELABELS 114
#define IDC_RESETALL 115

#define IDD_ENCODING 104
#define IDB_PICK 104
#define IDC_STYLEBACK 104
#define IDC_FINDSTART 105
#define IDD_RECODE 105
#define IDC_STYLEFONT 105
#define IDB_ENCODING 105
#define IDC_FINDREGEXP 106
#define IDD_DEFEOLMODE 106
#define IDC_PREVIEW 106
#define IDC_FINDTRANSFORMBS 107
#define IDD_FAVORITES 107
#define IDC_STYLEDEFAULT 107
#define IDC_NOWRAP 108
#define IDD_ADDTOFAV 108
#define IDC_PREVSTYLE 108
#define IDC_FINDCLOSE 109
#define IDD_FILEMRU 109
#define IDC_NEXTSTYLE 109
#define IDC_FINDPREV 110
#define IDD_CHANGENOTIFY 110
#define IDC_IMPORT 110
#define IDD_MODIFYLINES 111
#define IDC_EXPORT 111
#define IDC_REPLACE 112
#define IDC_TITLE 112
#define IDD_ALIGN 112
#define IDC_BUILD_INFO 113
#define IDD_ENCLOSESELECTION 113
#define IDC_REPLACEALL 113
#define IDC_STYLELABELS 113
#define IDD_INSERTTAG 114
#define IDC_REPLACEINSEL 114
#define IDC_RESETALL 114
#define IDD_SORT 115
#define IDC_TOGGLEFINDREPLACE 115
#define IDD_COLUMNWRAP 116
#define IDD_LINENUM 117
#define IDD_FIND 118
#define IDD_REPLACE 119
#define IDD_STYLESELECT 120
#define IDD_STYLECONFIG 121
#define IDD_WORDWRAP 122
#define IDD_LONGLINES 123
#define IDD_TABSETTINGS 124
Expand Down

0 comments on commit 536fb1f

Please sign in to comment.