Add ability to pre-populate the predefined color sets to the custom tone
Allow to reset custom tone colors with other predefined color sets. Fix #15055, close #15387
This commit is contained in:
parent
c2da907f34
commit
5501485c0b
|
@ -503,7 +503,7 @@ namespace NppDarkMode
|
|||
g_advOptions._enableWindowsMode = enable;
|
||||
}
|
||||
|
||||
void setThemeName(const generic_string& newThemeName)
|
||||
void setThemeName(const std::wstring& newThemeName)
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
g_advOptions._darkDefaults._xmlFileName = newThemeName;
|
||||
|
@ -511,7 +511,7 @@ namespace NppDarkMode
|
|||
g_advOptions._lightDefaults._xmlFileName = newThemeName;
|
||||
}
|
||||
|
||||
generic_string getThemeName()
|
||||
std::wstring getThemeName()
|
||||
{
|
||||
auto& theme = NppDarkMode::isEnabled() ? g_advOptions._darkDefaults._xmlFileName : g_advOptions._lightDefaults._xmlFileName;
|
||||
return (lstrcmp(theme.c_str(), L"stylers.xml") == 0) ? L"" : theme;
|
||||
|
@ -728,10 +728,35 @@ namespace NppDarkMode
|
|||
getTheme().change(clrs);
|
||||
}
|
||||
|
||||
Colors getDarkModeDefaultColors()
|
||||
Colors getDarkModeDefaultColors(ColorTone colorTone)
|
||||
{
|
||||
switch (colorTone)
|
||||
{
|
||||
case NppDarkMode::ColorTone::redTone:
|
||||
return darkRedColors;
|
||||
|
||||
case NppDarkMode::ColorTone::greenTone:
|
||||
return darkGreenColors;
|
||||
|
||||
case NppDarkMode::ColorTone::blueTone:
|
||||
return darkBlueColors;
|
||||
|
||||
case NppDarkMode::ColorTone::purpleTone:
|
||||
return darkPurpleColors;
|
||||
|
||||
case NppDarkMode::ColorTone::cyanTone:
|
||||
return darkCyanColors;
|
||||
|
||||
case NppDarkMode::ColorTone::oliveTone:
|
||||
return darkOliveColors;
|
||||
|
||||
case NppDarkMode::ColorTone::customizedTone:
|
||||
case NppDarkMode::ColorTone::blackTone:
|
||||
default:
|
||||
return darkColors;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void changeCustomTheme(const Colors& colors)
|
||||
{
|
||||
|
@ -1612,7 +1637,7 @@ namespace NppDarkMode
|
|||
|
||||
SetBkMode(hdc, TRANSPARENT);
|
||||
|
||||
TCHAR label[MAX_PATH]{};
|
||||
wchar_t label[MAX_PATH]{};
|
||||
TCITEM tci{};
|
||||
tci.mask = TCIF_TEXT;
|
||||
tci.pszText = label;
|
||||
|
@ -1971,7 +1996,7 @@ namespace NppDarkMode
|
|||
::SetTextColor(hdc, isWindowEnabled ? NppDarkMode::getTextColor() : NppDarkMode::getDisabledTextColor());
|
||||
::SetBkColor(hdc, NppDarkMode::getBackgroundColor());
|
||||
auto bufferLen = static_cast<size_t>(::SendMessage(hWnd, CB_GETLBTEXTLEN, index, 0));
|
||||
TCHAR* buffer = new TCHAR[(bufferLen + 1)];
|
||||
wchar_t* buffer = new wchar_t[(bufferLen + 1)];
|
||||
::SendMessage(hWnd, CB_GETLBTEXT, index, reinterpret_cast<LPARAM>(buffer));
|
||||
|
||||
RECT rcText = rcTextBg;
|
||||
|
@ -2002,7 +2027,7 @@ namespace NppDarkMode
|
|||
::SetTextColor(hdc, isWindowEnabled ? colorEnabledText : NppDarkMode::getDisabledTextColor());
|
||||
::SetBkColor(hdc, isHot ? NppDarkMode::getHotBackgroundColor() : NppDarkMode::getBackgroundColor());
|
||||
::FillRect(hdc, &rcArrow, isHot ? NppDarkMode::getHotBackgroundBrush() : NppDarkMode::getBackgroundBrush());
|
||||
TCHAR arrow[] = L"˅";
|
||||
wchar_t arrow[] = L"˅";
|
||||
::DrawText(hdc, arrow, -1, &rcArrow, DT_NOPREFIX | DT_CENTER | DT_VCENTER | DT_SINGLELINE | DT_NOCLIP);
|
||||
::SetBkColor(hdc, NppDarkMode::getBackgroundColor());
|
||||
|
||||
|
@ -2275,7 +2300,7 @@ namespace NppDarkMode
|
|||
bool subclassTabUpDownControl(HWND hwnd)
|
||||
{
|
||||
constexpr size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen]{};
|
||||
wchar_t className[classNameLen]{};
|
||||
GetClassName(hwnd, className, classNameLen);
|
||||
if (wcscmp(className, UPDOWN_CLASS) == 0)
|
||||
{
|
||||
|
@ -2301,7 +2326,7 @@ namespace NppDarkMode
|
|||
EnumChildWindows(hwndParent, [](HWND hwnd, LPARAM lParam) WINAPI_LAMBDA {
|
||||
auto& p = *reinterpret_cast<NppDarkModeParams*>(lParam);
|
||||
constexpr size_t classNameLen = 32;
|
||||
TCHAR className[classNameLen]{};
|
||||
wchar_t className[classNameLen]{};
|
||||
GetClassName(hwnd, className, classNameLen);
|
||||
|
||||
if (wcscmp(className, WC_BUTTON) == 0)
|
||||
|
@ -2881,7 +2906,7 @@ namespace NppDarkMode
|
|||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
constexpr size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen]{};
|
||||
wchar_t className[classNameLen]{};
|
||||
auto hwndEdit = reinterpret_cast<HWND>(lParam);
|
||||
GetClassName(hwndEdit, className, classNameLen);
|
||||
if (wcscmp(className, WC_EDIT) == 0)
|
||||
|
@ -2910,7 +2935,7 @@ namespace NppDarkMode
|
|||
case NM_CUSTOMDRAW:
|
||||
{
|
||||
constexpr size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen]{};
|
||||
wchar_t className[classNameLen]{};
|
||||
GetClassName(nmhdr->hwndFrom, className, classNameLen);
|
||||
|
||||
if (wcscmp(className, TOOLBARCLASSNAME) == 0)
|
||||
|
@ -3059,7 +3084,7 @@ namespace NppDarkMode
|
|||
auto nmhdr = reinterpret_cast<LPNMHDR>(lParam);
|
||||
|
||||
constexpr size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen]{};
|
||||
wchar_t className[classNameLen]{};
|
||||
GetClassName(nmhdr->hwndFrom, className, classNameLen);
|
||||
|
||||
switch (nmhdr->code)
|
||||
|
@ -3305,7 +3330,7 @@ namespace NppDarkMode
|
|||
static BOOL CALLBACK enumAutocompleteProc(HWND hwnd, LPARAM /*lParam*/)
|
||||
{
|
||||
constexpr size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen]{};
|
||||
wchar_t className[classNameLen]{};
|
||||
GetClassName(hwnd, className, classNameLen);
|
||||
if ((wcscmp(className, L"ListBoxX") == 0))
|
||||
{
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#include <windows.h>
|
||||
|
||||
#include "Common.h" // for generic_string
|
||||
|
||||
namespace NppDarkMode
|
||||
{
|
||||
|
@ -81,7 +81,7 @@ namespace NppDarkMode
|
|||
|
||||
struct AdvOptDefaults
|
||||
{
|
||||
generic_string _xmlFileName;
|
||||
std::wstring _xmlFileName;
|
||||
int _toolBarIconSet = -1;
|
||||
int _tabIconSet = -1;
|
||||
bool _tabUseTheme = false;
|
||||
|
@ -110,8 +110,8 @@ namespace NppDarkMode
|
|||
|
||||
bool isWindowsModeEnabled();
|
||||
void setWindowsMode(bool enable);
|
||||
generic_string getThemeName();
|
||||
void setThemeName(const generic_string& newThemeName);
|
||||
std::wstring getThemeName();
|
||||
void setThemeName(const std::wstring& newThemeName);
|
||||
int getToolBarIconSet(bool useDark);
|
||||
void setToolBarIconSet(int state2Set, bool useDark);
|
||||
int getTabIconSet(bool useDark);
|
||||
|
@ -173,7 +173,7 @@ namespace NppDarkMode
|
|||
void setHotEdgeColor(COLORREF c);
|
||||
void setDisabledEdgeColor(COLORREF c);
|
||||
|
||||
Colors getDarkModeDefaultColors();
|
||||
Colors getDarkModeDefaultColors(ColorTone colorTone = ColorTone::blackTone);
|
||||
void changeCustomTheme(const Colors& colors);
|
||||
|
||||
// handle events
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "Parameters.h"
|
||||
#include "localization.h"
|
||||
|
||||
MenuItemUnit::MenuItemUnit(unsigned long cmdID, const TCHAR *itemName, const TCHAR *parentFolderName) : _cmdID(cmdID)
|
||||
MenuItemUnit::MenuItemUnit(unsigned long cmdID, const wchar_t* itemName, const wchar_t* parentFolderName) : _cmdID(cmdID)
|
||||
{
|
||||
if (!itemName)
|
||||
_itemName.clear();
|
||||
|
@ -33,27 +33,15 @@ MenuItemUnit::MenuItemUnit(unsigned long cmdID, const TCHAR *itemName, const TCH
|
|||
_parentFolderName = parentFolderName;
|
||||
}
|
||||
|
||||
|
||||
ContextMenu::~ContextMenu()
|
||||
{
|
||||
if (isCreated())
|
||||
{
|
||||
for (size_t i = 0, len = _subMenus.size(); i < len; ++i)
|
||||
::DestroyMenu(_subMenus[i]);
|
||||
::DestroyMenu(_hMenu);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ContextMenu::create(HWND hParent, const std::vector<MenuItemUnit> & menuItemArray, const HMENU mainMenuHandle, bool copyLink)
|
||||
{
|
||||
_hParent = hParent;
|
||||
_hMenu = ::CreatePopupMenu();
|
||||
bool lastIsSep = false;
|
||||
HMENU hParentFolder = NULL;
|
||||
generic_string currentParentFolderStr;
|
||||
std::wstring currentParentFolderStr;
|
||||
int j = 0;
|
||||
MENUITEMINFO mii;
|
||||
MENUITEMINFO mii{};
|
||||
|
||||
for (size_t i = 0, len = menuItemArray.size(); i < len; ++i)
|
||||
{
|
||||
|
@ -127,17 +115,46 @@ void ContextMenu::create(HWND hParent, const std::vector<MenuItemUnit> & menuIte
|
|||
if (copyLink && (item._cmdID == IDM_EDIT_COPY))
|
||||
{
|
||||
NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
|
||||
generic_string localized = nativeLangSpeaker->getNativeLangMenuString(IDM_EDIT_COPY_LINK);
|
||||
std::wstring localized = nativeLangSpeaker->getNativeLangMenuString(IDM_EDIT_COPY_LINK);
|
||||
if (localized.length() == 0)
|
||||
localized = L"Copy link";
|
||||
memset(&mii, 0, sizeof(mii));
|
||||
mii.cbSize = sizeof(MENUITEMINFO);
|
||||
mii.fMask = MIIM_ID | MIIM_STRING | MIIM_STATE;
|
||||
mii.wID = IDM_EDIT_COPY_LINK;
|
||||
mii.dwTypeData = (TCHAR*) localized.c_str();
|
||||
mii.dwTypeData = (wchar_t*) localized.c_str();
|
||||
mii.fState = MFS_ENABLED;
|
||||
int c = GetMenuItemCount(_hMenu);
|
||||
SetMenuItemInfo(_hMenu, c - 1, TRUE, & mii);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ContextMenu::display(HWND hwnd) const
|
||||
{
|
||||
RECT rcItem{};
|
||||
::GetClientRect(hwnd, &rcItem);
|
||||
::MapWindowPoints(hwnd, HWND_DESKTOP, reinterpret_cast<LPPOINT>(&rcItem), 2);
|
||||
|
||||
TPMPARAMS tpm{};
|
||||
tpm.cbSize = sizeof(TPMPARAMS);
|
||||
tpm.rcExclude = rcItem;
|
||||
|
||||
const NativeLangSpeaker* nativeLangSpeaker = NppParameters::getInstance().getNativeLangSpeaker();
|
||||
const UINT flags = nativeLangSpeaker->isRTL() ? (TPM_RIGHTALIGN | TPM_RIGHTBUTTON | TPM_LAYOUTRTL) : (TPM_LEFTALIGN | TPM_LEFTBUTTON);
|
||||
::TrackPopupMenuEx(_hMenu, flags | TPM_VERTICAL, rcItem.left, rcItem.bottom, _hParent, &tpm);
|
||||
}
|
||||
|
||||
void ContextMenu::destroy()
|
||||
{
|
||||
if (isCreated())
|
||||
{
|
||||
for (size_t i = 0, len = _subMenus.size(); i < len; ++i)
|
||||
{
|
||||
::DestroyMenu(_subMenus[i]);
|
||||
_subMenus[i] = nullptr;
|
||||
}
|
||||
::DestroyMenu(_hMenu);
|
||||
_hMenu = nullptr;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,20 +21,22 @@
|
|||
struct MenuItemUnit final
|
||||
{
|
||||
unsigned long _cmdID = 0;
|
||||
generic_string _itemName;
|
||||
generic_string _parentFolderName;
|
||||
std::wstring _itemName;
|
||||
std::wstring _parentFolderName;
|
||||
|
||||
MenuItemUnit() = default;
|
||||
MenuItemUnit(unsigned long cmdID, const generic_string& itemName, const generic_string& parentFolderName = generic_string())
|
||||
MenuItemUnit(unsigned long cmdID, const std::wstring& itemName, const std::wstring& parentFolderName = std::wstring())
|
||||
: _cmdID(cmdID), _itemName(itemName), _parentFolderName(parentFolderName){};
|
||||
MenuItemUnit(unsigned long cmdID, const TCHAR *itemName, const TCHAR *parentFolderName = nullptr);
|
||||
MenuItemUnit(unsigned long cmdID, const wchar_t* itemName, const wchar_t* parentFolderName = nullptr);
|
||||
};
|
||||
|
||||
|
||||
class ContextMenu final
|
||||
{
|
||||
public:
|
||||
~ContextMenu();
|
||||
~ContextMenu() {
|
||||
destroy();
|
||||
}
|
||||
|
||||
void create(HWND hParent, const std::vector<MenuItemUnit> & menuItemArray, const HMENU mainMenuHandle = NULL, bool copyLink = false);
|
||||
bool isCreated() const {return _hMenu != NULL;}
|
||||
|
@ -43,6 +45,8 @@ public:
|
|||
::TrackPopupMenu(_hMenu, TPM_LEFTALIGN, p.x, p.y, 0, _hParent, NULL);
|
||||
}
|
||||
|
||||
void display(HWND hwnd) const;
|
||||
|
||||
void enableItem(int cmdID, bool doEnable) const
|
||||
{
|
||||
int flag = doEnable ? (MF_ENABLED | MF_BYCOMMAND) : (MF_DISABLED | MF_GRAYED | MF_BYCOMMAND);
|
||||
|
@ -59,9 +63,10 @@ public:
|
|||
return _hMenu;
|
||||
}
|
||||
|
||||
void destroy();
|
||||
|
||||
private:
|
||||
HWND _hParent = NULL;
|
||||
HMENU _hMenu = NULL;
|
||||
std::vector<HMENU> _subMenus;
|
||||
|
||||
};
|
||||
|
|
|
@ -160,7 +160,7 @@ BEGIN
|
|||
LTEXT "Edge",IDD_CUSTOMIZED_COLOR9_STATIC,342,80,94,8
|
||||
LTEXT "Edge highlight",IDD_CUSTOMIZED_COLOR11_STATIC,342,100,94,8
|
||||
LTEXT "Edge disabled",IDD_CUSTOMIZED_COLOR12_STATIC,342,120,94,8
|
||||
PUSHBUTTON "Reset",IDD_CUSTOMIZED_RESET_BUTTON,340,158,45,14
|
||||
CONTROL "Reset",IDD_CUSTOMIZED_RESET_BUTTON,"Button",BS_SPLITBUTTON | WS_TABSTOP,330,158,65,14
|
||||
END
|
||||
|
||||
|
||||
|
|
|
@ -1662,6 +1662,8 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
|||
delete _pHotEdgeColorPicker;
|
||||
delete _pDisabledEdgeColorPicker;
|
||||
|
||||
destroyResetMenu();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1685,6 +1687,51 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
auto lpnmhdr = reinterpret_cast<LPNMHDR>(lParam);
|
||||
switch (lpnmhdr->code)
|
||||
{
|
||||
case BCN_DROPDOWN:
|
||||
{
|
||||
switch (lpnmhdr->idFrom)
|
||||
{
|
||||
case IDD_CUSTOMIZED_RESET_BUTTON:
|
||||
{
|
||||
if (!_resetPopupMenu.isCreated())
|
||||
{
|
||||
NativeLangSpeaker* pNativeSpeaker = nppParam.getNativeLangSpeaker();
|
||||
std::vector<const char*> nodeNames{ "Dialog", "Preference", "DarkMode" };
|
||||
|
||||
std::vector<MenuItemUnit> itemUnitArray;
|
||||
itemUnitArray.push_back(MenuItemUnit(IDD_CUSTOMIZED_RESET_BUTTON, pNativeSpeaker->getCmdLangStr(nodeNames, IDC_RADIO_DARKMODE_BLACK ,L"Black")));
|
||||
itemUnitArray.push_back(MenuItemUnit(IDD_DROPDOWN_RESET_RED, pNativeSpeaker->getCmdLangStr(nodeNames, IDC_RADIO_DARKMODE_RED, L"Red")));
|
||||
itemUnitArray.push_back(MenuItemUnit(IDD_DROPDOWN_RESET_GREEN, pNativeSpeaker->getCmdLangStr(nodeNames, IDC_RADIO_DARKMODE_GREEN, L"Green")));
|
||||
itemUnitArray.push_back(MenuItemUnit(IDD_DROPDOWN_RESET_BLUE, pNativeSpeaker->getCmdLangStr(nodeNames, IDC_RADIO_DARKMODE_BLUE, L"Blue")));
|
||||
itemUnitArray.push_back(MenuItemUnit(IDD_DROPDOWN_RESET_PURPLE, pNativeSpeaker->getCmdLangStr(nodeNames, IDC_RADIO_DARKMODE_PURPLE, L"Purple")));
|
||||
itemUnitArray.push_back(MenuItemUnit(IDD_DROPDOWN_RESET_CYAN, pNativeSpeaker->getCmdLangStr(nodeNames, IDC_RADIO_DARKMODE_CYAN, L"Cyan")));
|
||||
itemUnitArray.push_back(MenuItemUnit(IDD_DROPDOWN_RESET_OLIVE, pNativeSpeaker->getCmdLangStr(nodeNames, IDC_RADIO_DARKMODE_OLIVE, L"Olive")));
|
||||
|
||||
_resetPopupMenu.create(_hSelf, itemUnitArray);
|
||||
}
|
||||
|
||||
_resetPopupMenu.display(lpnmhdr->hwndFrom);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
{
|
||||
bool changed = false;
|
||||
|
@ -1734,6 +1781,12 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
|||
case IDC_RADIO_DARKMODE_OLIVE:
|
||||
case IDC_RADIO_DARKMODE_CUSTOMIZED:
|
||||
case IDD_CUSTOMIZED_RESET_BUTTON:
|
||||
case IDD_DROPDOWN_RESET_RED:
|
||||
case IDD_DROPDOWN_RESET_GREEN:
|
||||
case IDD_DROPDOWN_RESET_BLUE:
|
||||
case IDD_DROPDOWN_RESET_PURPLE:
|
||||
case IDD_DROPDOWN_RESET_CYAN:
|
||||
case IDD_DROPDOWN_RESET_OLIVE:
|
||||
{
|
||||
if (wParam == IDC_RADIO_DARKMODE_BLACK)
|
||||
{
|
||||
|
@ -1791,7 +1844,61 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
|||
NppDarkMode::changeCustomTheme(nppGUI._darkmode._customColors);
|
||||
doEnableCustomizedColorCtrls = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
doEnableCustomizedColorCtrls = true;
|
||||
switch (wParam)
|
||||
{
|
||||
case IDD_CUSTOMIZED_RESET_BUTTON:
|
||||
{
|
||||
nppGUI._darkmode._customColors = NppDarkMode::getDarkModeDefaultColors();
|
||||
break;
|
||||
}
|
||||
|
||||
case IDD_DROPDOWN_RESET_RED:
|
||||
{
|
||||
nppGUI._darkmode._customColors = NppDarkMode::getDarkModeDefaultColors(NppDarkMode::ColorTone::redTone);
|
||||
break;
|
||||
}
|
||||
|
||||
case IDD_DROPDOWN_RESET_GREEN:
|
||||
{
|
||||
nppGUI._darkmode._customColors = NppDarkMode::getDarkModeDefaultColors(NppDarkMode::ColorTone::greenTone);
|
||||
break;
|
||||
}
|
||||
|
||||
case IDD_DROPDOWN_RESET_BLUE:
|
||||
{
|
||||
nppGUI._darkmode._customColors = NppDarkMode::getDarkModeDefaultColors(NppDarkMode::ColorTone::blueTone);
|
||||
break;
|
||||
}
|
||||
|
||||
case IDD_DROPDOWN_RESET_PURPLE:
|
||||
{
|
||||
nppGUI._darkmode._customColors = NppDarkMode::getDarkModeDefaultColors(NppDarkMode::ColorTone::purpleTone);
|
||||
break;
|
||||
}
|
||||
|
||||
case IDD_DROPDOWN_RESET_CYAN:
|
||||
{
|
||||
nppGUI._darkmode._customColors = NppDarkMode::getDarkModeDefaultColors(NppDarkMode::ColorTone::cyanTone);
|
||||
break;
|
||||
}
|
||||
|
||||
case IDD_DROPDOWN_RESET_OLIVE:
|
||||
{
|
||||
nppGUI._darkmode._customColors = NppDarkMode::getDarkModeDefaultColors(NppDarkMode::ColorTone::oliveTone);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
doEnableCustomizedColorCtrls = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (doEnableCustomizedColorCtrls)
|
||||
NppDarkMode::changeCustomTheme(nppGUI._darkmode._customColors);
|
||||
}
|
||||
|
||||
// switch to chosen dark mode
|
||||
nppGUI._darkmode._isEnabled = true;
|
||||
|
|
|
@ -94,6 +94,10 @@ class DarkModeSubDlg : public StaticDialog
|
|||
public:
|
||||
DarkModeSubDlg() = default;
|
||||
|
||||
void destroyResetMenu() {
|
||||
_resetPopupMenu.destroy();
|
||||
}
|
||||
|
||||
private:
|
||||
ColourPicker* _pBackgroundColorPicker = nullptr;
|
||||
ColourPicker* _pSofterBackgroundColorPicker = nullptr;
|
||||
|
@ -108,6 +112,8 @@ private:
|
|||
ColourPicker* _pHotEdgeColorPicker = nullptr;
|
||||
ColourPicker* _pDisabledEdgeColorPicker = nullptr;
|
||||
|
||||
ContextMenu _resetPopupMenu;
|
||||
|
||||
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
|
||||
void enableCustomizedColorCtrls(bool doEnable);
|
||||
void move2CtrlLeft(int ctrlID, HWND handle2Move, int handle2MoveWidth, int handle2MoveHeight);
|
||||
|
|
|
@ -481,6 +481,12 @@
|
|||
#define IDC_RADIO_DARKMODE_DARKMODE (IDD_PREFERENCE_SUB_DARKMODE + 32)
|
||||
#define IDC_RADIO_DARKMODE_FOLLOWWINDOWS (IDD_PREFERENCE_SUB_DARKMODE + 33)
|
||||
#define IDC_DARKMODE_TONES_GB_STATIC (IDD_PREFERENCE_SUB_DARKMODE + 35)
|
||||
#define IDD_DROPDOWN_RESET_RED (IDD_PREFERENCE_SUB_DARKMODE + 36)
|
||||
#define IDD_DROPDOWN_RESET_GREEN (IDD_PREFERENCE_SUB_DARKMODE + 37)
|
||||
#define IDD_DROPDOWN_RESET_BLUE (IDD_PREFERENCE_SUB_DARKMODE + 38)
|
||||
#define IDD_DROPDOWN_RESET_PURPLE (IDD_PREFERENCE_SUB_DARKMODE + 39)
|
||||
#define IDD_DROPDOWN_RESET_CYAN (IDD_PREFERENCE_SUB_DARKMODE + 40)
|
||||
#define IDD_DROPDOWN_RESET_OLIVE (IDD_PREFERENCE_SUB_DARKMODE + 41)
|
||||
|
||||
#define IDD_PREFERENCE_SUB_PERFORMANCE 7140 //(IDD_PREFERENCE_BOX + 1100)
|
||||
#define IDC_GROUPSTATIC_PERFORMANCE_RESTRICTION (IDD_PREFERENCE_SUB_PERFORMANCE + 1)
|
||||
|
|
|
@ -1124,6 +1124,8 @@ void NativeLangSpeaker::changePrefereceDlgLang(PreferenceDlg & preference)
|
|||
preference.renameDialogTitle(L"SearchEngine", nameW);
|
||||
}
|
||||
|
||||
preference._darkModeSubDlg.destroyResetMenu();
|
||||
|
||||
preference.setListSelection(currentSel);
|
||||
}
|
||||
|
||||
|
@ -1428,7 +1430,51 @@ wstring NativeLangSpeaker::getDlgLangMenuStr(const char* firstLevelNodeName, con
|
|||
return defaultStr;
|
||||
}
|
||||
|
||||
wstring NativeLangSpeaker::getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const wchar_t *defaultStr) const
|
||||
std::wstring NativeLangSpeaker::getCmdLangStr(std::vector<const char*> nodeNames, int cmdID, const wchar_t* defaultStr) const
|
||||
{
|
||||
if (!_nativeLangA) return defaultStr;
|
||||
TiXmlNodeA* targetNode = _nativeLangA->FirstChild(nodeNames.at(0));
|
||||
if (targetNode == nullptr)
|
||||
return defaultStr;
|
||||
|
||||
auto it = nodeNames.begin();
|
||||
++it;
|
||||
|
||||
for (auto end = nodeNames.end(); it != end; ++it)
|
||||
{
|
||||
targetNode = targetNode->FirstChild(*it);
|
||||
if (targetNode == nullptr)
|
||||
return defaultStr;
|
||||
}
|
||||
|
||||
if (targetNode == nullptr)
|
||||
return defaultStr;
|
||||
|
||||
const char* name = nullptr;
|
||||
for (TiXmlNodeA* childNode = targetNode->FirstChildElement("Item");
|
||||
childNode;
|
||||
childNode = childNode->NextSibling("Item"))
|
||||
{
|
||||
TiXmlElementA* element = childNode->ToElement();
|
||||
int id = 0;
|
||||
const char* idStr = element->Attribute("id", &id);
|
||||
|
||||
if (idStr && id == cmdID)
|
||||
{
|
||||
name = element->Attribute("name");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (name && name[0])
|
||||
{
|
||||
WcharMbcsConvertor& wmc = WcharMbcsConvertor::getInstance();
|
||||
return wmc.char2wchar(name, _nativeLangEncoding);
|
||||
}
|
||||
return defaultStr;
|
||||
}
|
||||
|
||||
std::wstring NativeLangSpeaker::getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const wchar_t *defaultStr) const
|
||||
{
|
||||
if (!_nativeLangA) return defaultStr;
|
||||
|
||||
|
|
|
@ -84,6 +84,7 @@ public:
|
|||
std::wstring getShortcutMapperLangStr(const char *nodeName, const wchar_t *defaultStr) const;
|
||||
std::wstring getProjectPanelLangMenuStr(const char * nodeName, int cmdID, const wchar_t *defaultStr) const;
|
||||
std::wstring getDlgLangMenuStr(const char* firstLevelNodeName, const char* secondLevelNodeName, int cmdID, const wchar_t *defaultStr) const;
|
||||
std::wstring getCmdLangStr(std::vector<const char*> nodeNames, int cmdID, const wchar_t* defaultStr) const;
|
||||
std::wstring getAttrNameStr(const wchar_t *defaultStr, const char *nodeL1Name, const char *nodeL2Name, const char *nodeL3Name = "name") const;
|
||||
std::wstring getAttrNameByIdStr(const wchar_t *defaultStr, TiXmlNodeA *targetNode, const char *nodeL1Value, const char *nodeL1Name = "id", const char *nodeL2Name = "name") const;
|
||||
std::wstring getLocalizedStrFromID(const char *strID, const std::wstring& defaultString) const;
|
||||
|
|
Loading…
Reference in New Issue