Add some shortcuts in Styler Configurator to preferences dialog

Shortcuts to Preferences dialog are added only for the following styles (Global Styles):

1.  "Current line background colour"
2.  "Caret colour"
3.  "Edge colour"
4.  "Line number margin"
5.  "Bookmark margin"
6.  "Fold"
7.  "Fold active"
8.  "Fold margin"
9.  "Smart Highlighting"
10. "Tags match highlighting"
11. "Tags attribute"
12. "Mark Style 1"
13. "Mark Style 2"
14. "Mark Style 3"
15. "Mark Style 4"
16. "Mark Style 5"
17. "URL hovered"
18. "EOL custom color"

Fix #11890, close #11904
This commit is contained in:
Don Ho 2022-07-12 04:35:27 +02:00
parent 57bb83846b
commit 67ab4d5527
12 changed files with 159 additions and 44 deletions

View File

@ -548,6 +548,7 @@ The comments are here for explanation, it's not necessary to translate them.
<Item id="2230" name="Enable global bold font style"/>
<Item id="2231" name="Enable global italic font style"/>
<Item id="2232" name="Enable global underline font style"/>
<Item id="2234" name="Go to settings"/>
</SubDialog>
</StyleConfig>

View File

@ -548,6 +548,7 @@ The comments are here for explanation, it's not necessary to translate them.
<Item id="2230" name="Appliquer le style gras global"/>
<Item id="2231" name="Appliquer le style italique global"/>
<Item id="2232" name="Appliquer le style souligné global"/>
<Item id="2234" name="Aller à la boîte de dialogue Préferences"/>
</SubDialog>
</StyleConfig>

View File

@ -535,6 +535,7 @@
<Item id="2230" name="開啟共用粗體"/>
<Item id="2231" name="開啟共用斜體"/>
<Item id="2232" name="開啟共用底線"/>
<Item id="2234" name="至相關的偏好設定"/>
</SubDialog>
</StyleConfig>
<ShortcutMapper title="管理快捷鍵">

View File

@ -2666,6 +2666,17 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return TRUE;
}
case NPPM_INTERNAL_LAUNCHPREFERENCES:
{
// Launch _configStyleDlg (create or display it)
command(IDM_SETTING_PREFERENCE);
// go into the section we need
_preference.goToSection(wParam, lParam);
return TRUE;
}
case NPPM_INTERNAL_DISABLEAUTOUPDATE:
{
//printStr(TEXT("you've got me"));

View File

@ -20,6 +20,7 @@
#include "ScintillaEditView.h"
#include "documentMap.h"
#include "AutoCompletion.h"
#include "preference_rc.h"
using namespace std;
@ -150,6 +151,11 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
updateGlobalOverrideCtrls();
setVisualFromStyleList();
_goToSettings.init(_hInst, _hSelf);
_goToSettings.create(::GetDlgItem(_hSelf, IDC_GLOBAL_GOTOSETTINGS_LINK), TEXT(""));
std::pair<intptr_t, intptr_t> pageAndCtrlID = goToPreferencesSettings();
_goToSettings.display(pageAndCtrlID.first != -1);
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
goToCenter();
@ -320,6 +326,15 @@ intptr_t CALLBACK WordStyleDlg::run_dlgProc(UINT Message, WPARAM wParam, LPARAM
apply();
break;
case IDC_GLOBAL_GOTOSETTINGS_LINK :
{
std::pair<intptr_t, intptr_t> pageAndCtrlID = goToPreferencesSettings();
if (pageAndCtrlID.first != -1)
::SendMessage(_hParent, NPPM_INTERNAL_LAUNCHPREFERENCES, pageAndCtrlID.first, pageAndCtrlID.second);
}
break;
case IDCANCEL :
if (_isDirty)
{
@ -890,6 +905,81 @@ void WordStyleDlg::setStyleListFromLexer(int index)
setVisualFromStyleList();
}
std::pair<intptr_t, intptr_t> WordStyleDlg::goToPreferencesSettings()
{
std::pair<intptr_t, intptr_t> result;
result.first = -1;
result.second = -1;
Style& style = getCurrentStyler();
// Global override style
if (style._styleDesc == TEXT("Current line background colour"))
{
result.first = 1;
result.second = IDC_RADIO_CLM_HILITE;
}
else if (style._styleDesc == TEXT("Caret colour"))
{
result.first = 1;
result.second = IDC_WIDTH_COMBO;
}
else if (style._styleDesc == TEXT("Edge colour"))
{
result.first = 3;
result.second = IDC_COLUMNPOS_EDIT;
}
else if (style._styleDesc == TEXT("Line number margin"))
{
result.first = 3;
result.second = IDC_CHECK_LINENUMBERMARGE;
}
else if (style._styleDesc == TEXT("Bookmark margin"))
{
result.first = 3;
result.second = IDC_CHECK_BOOKMARKMARGE;
}
else if (style._styleDesc == TEXT("Fold") || style._styleDesc == TEXT("Fold active") || style._styleDesc == TEXT("Fold margin"))
{
result.first = 3;
result.second = IDC_RADIO_BOX;
}
else if (style._styleDesc == TEXT("Smart Highlighting"))
{
result.first = 9;
result.second = IDC_CHECK_ENABLSMARTHILITE;
}
else if (style._styleDesc == TEXT("Tags match highlighting"))
{
result.first = 9;
result.second = IDC_CHECK_ENABLTAGSMATCHHILITE;
}
else if (style._styleDesc == TEXT("Tags attribute"))
{
result.first = 9;
result.second = IDC_CHECK_ENABLTAGATTRHILITE;
}
else if (style._styleDesc == TEXT("Mark Style 1") || style._styleDesc == TEXT("Mark Style 2") || style._styleDesc == TEXT("Mark Style 3")
|| style._styleDesc == TEXT("Mark Style 4") || style._styleDesc == TEXT("Mark Style 5"))
{
result.first = 9;
result.second = IDC_CHECK_MARKALLCASESENSITIVE;
}
else if (style._styleDesc == TEXT("URL hovered"))
{
result.first = 16;
result.second = IDC_CHECK_CLICKABLELINK_ENABLE;
}
else if (style._styleDesc == TEXT("EOL custom color"))
{
result.first = 1;
result.second = IDC_CHECK_WITHCUSTOMCOLOR_CRLF;
}
return result;
}
void WordStyleDlg::setVisualFromStyleList()
{
showGlobalOverrideCtrls(false);
@ -902,6 +992,9 @@ void WordStyleDlg::setVisualFromStyleList()
showGlobalOverrideCtrls(true);
}
std::pair<intptr_t, intptr_t> pageAndCtrlID = goToPreferencesSettings();
_goToSettings.display(pageAndCtrlID.first != -1);
//--Warning text
//bool showWarning = ((_currentLexerIndex == 0) && (style._styleID == STYLE_DEFAULT));//?SW_SHOW:SW_HIDE;

View File

@ -18,6 +18,7 @@
#pragma once
#include "ColourPicker.h"
#include "URLCtrl.h"
#include "WordStyleDlgRes.h"
#include "Parameters.h"
@ -132,6 +133,8 @@ private :
HWND _hFontSizeStaticText = nullptr;
HWND _hStyleInfoStaticText = nullptr;
URLCtrl _goToSettings;
LexerStylerArray _lsArray;
StyleArray _globalStyles;
generic_string _themeName;
@ -180,6 +183,7 @@ private :
void updateUserKeywords();
void switchToTheme();
void updateThemeName(const generic_string& themeName);
std::pair<intptr_t, intptr_t> goToPreferencesSettings();
void loadLangListFromNppParam();

View File

@ -62,17 +62,13 @@ BEGIN
LTEXT "Language :",IDC_LANGDESC_STATIC,19,34,61,8
GROUPBOX "",IDC_STATIC,181,24,310,184
LTEXT "+",IDC_PLUSSYMBOL2_STATIC,83,217,8,8
CONTROL "Enable global foreground colour",IDC_GLOBAL_FG_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,138,132,10
CONTROL "Enable global background colour",IDC_GLOBAL_BG_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,153,131,10
CONTROL "Enable global foreground colour",IDC_GLOBAL_FG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,138,132,10
CONTROL "Enable global background colour",IDC_GLOBAL_BG_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,191,153,131,10
CONTROL "Enable global font",IDC_GLOBAL_FONT_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,134,153,10
CONTROL "Enable global font size",IDC_GLOBAL_FONTSIZE_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,149,135,10
CONTROL "Enable global bold font style",IDC_GLOBAL_BOLD_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,164,135,10
CONTROL "Enable global italic font style",IDC_GLOBAL_ITALIC_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,179,135,10
CONTROL "Enable global underline font style",IDC_GLOBAL_UNDERLINE_CHECK,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,194,135,10
CONTROL "Enable global font size",IDC_GLOBAL_FONTSIZE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,327,149,135,10
CONTROL "Enable global bold font style",IDC_GLOBAL_BOLD_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,164,135,10
CONTROL "Enable global italic font style",IDC_GLOBAL_ITALIC_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,179,135,10
CONTROL "Enable global underline font style",IDC_GLOBAL_UNDERLINE_CHECK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,328,194,135,10
LTEXT "Go to settings",IDC_GLOBAL_GOTOSETTINGS_LINK,210,153,131,10,WS_TABSTOP
END

View File

@ -55,6 +55,7 @@
#define IDC_GLOBAL_ITALIC_CHECK (IDD_STYLER_DLG + 31)
#define IDC_GLOBAL_UNDERLINE_CHECK (IDD_STYLER_DLG + 32)
#define IDC_STYLEDESCRIPTION_STATIC (IDD_STYLER_DLG + 33)
#define IDC_GLOBAL_GOTOSETTINGS_LINK (IDD_STYLER_DLG + 34)
# define IDD_GLOBAL_STYLER_DLG 2300
#define IDC_SAVECLOSE_BUTTON (IDD_GLOBAL_STYLER_DLG + 1)

View File

@ -54,17 +54,12 @@ BEGIN
CONTROL "Alternate icons",IDC_CHECK_TAB_ALTICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,67,164,10
CONTROL "Lock (no drag and drop)",IDC_CHECK_LOCK,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,80,134,10
CONTROL "Darken inactive tabs",IDC_CHECK_DRAWINACTIVE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,93,134,10
CONTROL "Draw a coloured bar on active tab",IDC_CHECK_ORANGE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,106,137,10
CONTROL "Show close button on each tab",IDC_CHECK_ENABLETABCLOSE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,119,133,10
CONTROL "Double click to close document",IDC_CHECK_DBCLICK2CLOSE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,132,133,10
CONTROL "Exit on close the last tab",IDC_CHECK_TAB_LAST_EXIT,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,145,165,10
CONTROL "Draw a coloured bar on active tab",IDC_CHECK_ORANGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,106,137,10
CONTROL "Show close button on each tab",IDC_CHECK_ENABLETABCLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,119,133,10
CONTROL "Double click to close document",IDC_CHECK_DBCLICK2CLOSE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,132,133,10
CONTROL "Exit on close the last tab",IDC_CHECK_TAB_LAST_EXIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,229,145,165,10
CONTROL "Show status bar",IDC_CHECK_SHOWSTATUSBAR,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,64,132,130,10
CONTROL "Hide menu bar (use Alt or F10 key to toggle)",IDC_CHECK_HIDEMENUBAR,
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,223,169,218,10
CONTROL "Hide menu bar (use Alt or F10 key to toggle)",IDC_CHECK_HIDEMENUBAR,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,223,169,218,10
END
@ -72,13 +67,11 @@ IDD_PREFERENCE_SUB_EDITING DIALOGEX 0, 0, 455, 203
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Caret Settings",IDC_CARETSETTING_STATIC,284,77,156,48,BS_CENTER
LTEXT "Width :",IDC_WIDTH_STATIC,311,93,37,8,0,WS_EX_RIGHT
COMBOBOX IDC_WIDTH_COMBO,355,91,40,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Blink rate :",IDC_BLINKRATE_STATIC,286,108,60,8
CONTROL "",IDC_CARETBLINKRATE_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,363,106,57,13
LTEXT "S",IDC_CARETBLINKRATE_S_STATIC,424,107,12,8
LTEXT "F",IDC_CARETBLINKRATE_F_STATIC,351,107,12,8,0,WS_EX_RIGHT
GROUPBOX "EOL (CRLF)",IDC_GB_STATIC_CRLF,32,6,150,67,BS_CENTER
CONTROL "Default",IDC_RADIO_ROUNDCORNER_CRLF,"Button",BS_AUTORADIOBUTTON | WS_TABSTOP | WS_GROUP,39,18,118,10
CONTROL "Plain Text",IDC_RADIO_PLEINTEXT_CRLF,"Button",BS_AUTORADIOBUTTON,39,33,117,10
CONTROL "Custom Color",IDC_CHECK_WITHCUSTOMCOLOR_CRLF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,50,100,10
PUSHBUTTON "...",IDC_BUTTON_LAUNCHSTYLECONF_CRLF,140,48,14,14
GROUPBOX "Line Wrap",IDC_LW_GB_STATIC,194,6,78,67,BS_CENTER
CONTROL "Default",IDC_RADIO_LWDEF,"Button",BS_AUTORADIOBUTTON | WS_GROUP,203,21,59,10
CONTROL "Aligned",IDC_RADIO_LWALIGN,"Button",BS_AUTORADIOBUTTON,203,36,60,10
@ -90,23 +83,20 @@ BEGIN
LTEXT "Width :",IDC_CARETLINEFRAME_WIDTH_STATIC,291,60,37,8,0,WS_EX_RIGHT
CONTROL "",IDC_CARETLINEFRAME_WIDTH_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,329,59,57,13
LTEXT "1",IDC_CARETLINEFRAME_WIDTH_DISPLAY,388,60,12,8
GROUPBOX "Caret Settings",IDC_CARETSETTING_STATIC,284,77,156,48,BS_CENTER
LTEXT "Width :",IDC_WIDTH_STATIC,311,93,37,8,0,WS_EX_RIGHT
COMBOBOX IDC_WIDTH_COMBO,355,91,40,30,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
RTEXT "Blink rate :",IDC_BLINKRATE_STATIC,286,108,60,8
CONTROL "",IDC_CARETBLINKRATE_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | TBS_NOTICKS | TBS_TRANSPARENTBKGND | WS_TABSTOP,363,106,57,13
LTEXT "S",IDC_CARETBLINKRATE_S_STATIC,424,107,12,8
LTEXT "F",IDC_CARETBLINKRATE_F_STATIC,351,107,12,8,0,WS_EX_RIGHT
CONTROL "Enable smooth font",IDC_CHECK_SMOOTHFONT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,103,250,10
CONTROL "Enable virtual space",IDC_CHECK_VIRTUALSPACE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,116,250,10
CONTROL "Make current level folding/unfolding commands toggleable",IDC_CHECK_FOLDINGTOGGLE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,129,270,10
CONTROL "Enable Multi-Editing (Ctrl+Mouse click/selection)",IDC_CHECK_MULTISELECTION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,142,270,10
CONTROL "Enable scrolling beyond last line",IDC_CHECK_SCROLLBEYONDLASTLINE,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,155,270,10
CONTROL "Keep selection when right-click outside of selection",IDC_CHECK_RIGHTCLICKKEEPSSELECTION,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,168,270,10
CONTROL "Disable advanced scrolling feature due to touchpad issue",IDC_CHECK_DISABLEADVANCEDSCROLL,
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,181,270,10
GROUPBOX "EOL (CRLF)",IDC_GB_STATIC_CRLF,32,6,150,67,BS_CENTER
CONTROL "Default",IDC_RADIO_ROUNDCORNER_CRLF,"Button",BS_AUTORADIOBUTTON | WS_GROUP,39,18,118,10
CONTROL "Plain Text",IDC_RADIO_PLEINTEXT_CRLF,"Button",BS_AUTORADIOBUTTON,39,33,117,10
CONTROL "Custom Color",IDC_CHECK_WITHCUSTOMCOLOR_CRLF,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,39,50,100,10
PUSHBUTTON "...",IDC_BUTTON_LAUNCHSTYLECONF_CRLF,140,48,14,14
CONTROL "Make current level folding/unfolding commands toggleable",IDC_CHECK_FOLDINGTOGGLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,129,270,10
CONTROL "Enable Multi-Editing (Ctrl+Mouse click/selection)",IDC_CHECK_MULTISELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,142,270,10
CONTROL "Enable scrolling beyond last line",IDC_CHECK_SCROLLBEYONDLASTLINE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,155,270,10
CONTROL "Keep selection when right-click outside of selection",IDC_CHECK_RIGHTCLICKKEEPSSELECTION,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,168,270,10
CONTROL "Disable advanced scrolling feature due to touchpad issue",IDC_CHECK_DISABLEADVANCEDSCROLL,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,26,181,270,10
END

View File

@ -95,6 +95,20 @@ static int encodings[] = {
20866
};
bool PreferenceDlg::goToSection(size_t iPage, intptr_t ctrlID)
{
::SendDlgItemMessage(_hSelf, IDC_LIST_DLGTITLE, LB_SETCURSEL, iPage, 0);
showDialogByIndex(iPage);
getFocus();
if (ctrlID != -1)
{
::SetFocus(::GetDlgItem(_wVector[iPage]._dlg->getHSelf(), int(ctrlID)));
}
return true;
}
intptr_t CALLBACK PreferenceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)

View File

@ -280,6 +280,8 @@ public :
void showDialogByName(const TCHAR *name) const;
bool setListSelection(size_t currentSel) const;
bool goToSection(size_t iPage, intptr_t ctrlID = -1);
virtual void destroy();
private :

View File

@ -639,6 +639,7 @@
#define NPPM_INTERNAL_CARETLINEFRAME (NOTEPADPLUS_USER_INTERNAL + 63)
#define NPPM_INTERNAL_CRLFFORMCHANGED (NOTEPADPLUS_USER_INTERNAL + 64)
#define NPPM_INTERNAL_CRLFLAUNCHSTYLECONF (NOTEPADPLUS_USER_INTERNAL + 65)
#define NPPM_INTERNAL_LAUNCHPREFERENCES (NOTEPADPLUS_USER_INTERNAL + 66)
// See Notepad_plus_msgs.h
//#define NOTEPADPLUS_USER (WM_USER + 1000)