Add link text color in customized dark colors of Preferences dialog
This commit is contained in:
parent
a3ba150e89
commit
50dfdb2a8d
|
@ -1,4 +1,21 @@
|
|||
#include "NppDarkMode.h"
|
||||
// This file is part of Notepad++ project
|
||||
// Copyright (C)2021 adzm / Adam D. Walling
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// at your option any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
#include "NppDarkMode.h"
|
||||
|
||||
#include "DarkMode/DarkMode.h"
|
||||
#include "DarkMode/UAHMenuBar.h"
|
||||
|
|
|
@ -1,3 +1,19 @@
|
|||
// This file is part of Notepad++ project
|
||||
// Copyright (c) 2021 adzm / Adam D. Walling
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// at your option any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Windows.h>
|
||||
|
|
|
@ -107,17 +107,18 @@ BEGIN
|
|||
CONTROL "Purple tone",IDC_RADIO_DARKMODE_PURPLE, "Button",BS_AUTORADIOBUTTON ,35,100,90,10
|
||||
CONTROL "Cyan tone",IDC_RADIO_DARKMODE_CYAN, "Button",BS_AUTORADIOBUTTON ,35,115,90,10
|
||||
CONTROL "Olive tone",IDC_RADIO_DARKMODE_OLIVE, "Button",BS_AUTORADIOBUTTON ,35,130,90,10
|
||||
CONTROL "Customized tone",IDC_RADIO_DARKMODE_CUSTOMIZED, "Button",BS_AUTORADIOBUTTON,140,40,120,10
|
||||
LTEXT "Top", IDD_CUSTOMIZED_COLOR1_STATIC,170,60,100,8
|
||||
LTEXT "Menu hot track", IDD_CUSTOMIZED_COLOR2_STATIC,170,80,100,8
|
||||
LTEXT "Active", IDD_CUSTOMIZED_COLOR3_STATIC,170,100,100,8
|
||||
LTEXT "Main", IDD_CUSTOMIZED_COLOR4_STATIC,170,120,100,8
|
||||
LTEXT "Error", IDD_CUSTOMIZED_COLOR5_STATIC,170,140,100,8
|
||||
LTEXT "Text", IDD_CUSTOMIZED_COLOR6_STATIC,295,60,100,8
|
||||
LTEXT "Darker text", IDD_CUSTOMIZED_COLOR7_STATIC,295,80,100,8
|
||||
LTEXT "Disabled text", IDD_CUSTOMIZED_COLOR8_STATIC,295,100,100,8
|
||||
LTEXT "Edge", IDD_CUSTOMIZED_COLOR9_STATIC,295,120,100,8
|
||||
PUSHBUTTON "Reset",IDD_CUSTOMIZED_RESET_BUTTON,270,140,45,14
|
||||
CONTROL "Customized tone",IDC_RADIO_DARKMODE_CUSTOMIZED, "Button",BS_AUTORADIOBUTTON,135,40,120,10
|
||||
LTEXT "Top", IDD_CUSTOMIZED_COLOR1_STATIC,165,60,100,8
|
||||
LTEXT "Menu hot track", IDD_CUSTOMIZED_COLOR2_STATIC,165,80,100,8
|
||||
LTEXT "Active", IDD_CUSTOMIZED_COLOR3_STATIC,165,100,100,8
|
||||
LTEXT "Main", IDD_CUSTOMIZED_COLOR4_STATIC,165,120,100,8
|
||||
LTEXT "Error", IDD_CUSTOMIZED_COLOR5_STATIC,165,140,100,8
|
||||
LTEXT "Text", IDD_CUSTOMIZED_COLOR6_STATIC,280,60,100,8
|
||||
LTEXT "Darker text", IDD_CUSTOMIZED_COLOR7_STATIC,280,80,100,8
|
||||
LTEXT "Disabled text", IDD_CUSTOMIZED_COLOR8_STATIC,280,100,100,8
|
||||
LTEXT "Edge", IDD_CUSTOMIZED_COLOR9_STATIC,280,120,100,8
|
||||
LTEXT "Link", IDD_CUSTOMIZED_COLOR10_STATIC,280,140,100,8
|
||||
PUSHBUTTON "Reset",IDD_CUSTOMIZED_RESET_BUTTON,360,140,45,14
|
||||
END
|
||||
|
||||
IDD_PREFERENCE_SUB_MARGING_BORDER_EDGE DIALOGEX 0, 0, 455, 185
|
||||
|
|
|
@ -807,6 +807,7 @@ void DarkModeSubDlg::enableCustomizedColorCtrls(bool doEnable)
|
|||
::EnableWindow(_pDarkerTextColorPicker->getHSelf(), doEnable);
|
||||
::EnableWindow(_pDisabledTextColorPicker->getHSelf(), doEnable);
|
||||
::EnableWindow(_pEdgeColorPicker->getHSelf(), doEnable);
|
||||
::EnableWindow(_pLinkColorPicker->getHSelf(), doEnable);
|
||||
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR1_STATIC), doEnable);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR2_STATIC), doEnable);
|
||||
|
@ -817,6 +818,7 @@ void DarkModeSubDlg::enableCustomizedColorCtrls(bool doEnable)
|
|||
::EnableWindow(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR7_STATIC), doEnable);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR8_STATIC), doEnable);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR9_STATIC), doEnable);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR10_STATIC), doEnable);
|
||||
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_RESET_BUTTON), doEnable);
|
||||
|
||||
|
@ -831,6 +833,7 @@ void DarkModeSubDlg::enableCustomizedColorCtrls(bool doEnable)
|
|||
_pDarkerTextColorPicker->setColour(NppDarkMode::getDarkerTextColor());
|
||||
_pDisabledTextColorPicker->setColour(NppDarkMode::getDisabledTextColor());
|
||||
_pEdgeColorPicker->setColour(NppDarkMode::getEdgeColor());
|
||||
_pLinkColorPicker->setColour(NppDarkMode::getLinkTextColor());
|
||||
|
||||
redraw();
|
||||
}
|
||||
|
@ -884,6 +887,7 @@ INT_PTR CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
_pDarkerTextColorPicker = new ColourPicker;
|
||||
_pDisabledTextColorPicker = new ColourPicker;
|
||||
_pEdgeColorPicker = new ColourPicker;
|
||||
_pLinkColorPicker = new ColourPicker;
|
||||
|
||||
_pBackgroundColorPicker->init(_hInst, _hSelf);
|
||||
_pSofterBackgroundColorPicker->init(_hInst, _hSelf);
|
||||
|
@ -895,8 +899,9 @@ INT_PTR CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
_pDarkerTextColorPicker->init(_hInst, _hSelf);
|
||||
_pDisabledTextColorPicker->init(_hInst, _hSelf);
|
||||
_pEdgeColorPicker->init(_hInst, _hSelf);
|
||||
_pLinkColorPicker->init(_hInst, _hSelf);
|
||||
|
||||
POINT p1, p2, p3, p4, p5, p6, p7, p8, p9;
|
||||
POINT p1, p2, p3, p4, p5, p6, p7, p8, p9, p10;
|
||||
alignWith(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR1_STATIC), _pPureBackgroundColorPicker->getHSelf(), PosAlign::left, p1);
|
||||
alignWith(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR2_STATIC), _pHotBackgroundColorPicker->getHSelf(), PosAlign::left, p2);
|
||||
alignWith(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR3_STATIC), _pSofterBackgroundColorPicker->getHSelf(), PosAlign::left, p3);
|
||||
|
@ -906,19 +911,21 @@ INT_PTR CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
alignWith(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR7_STATIC), _pDarkerTextColorPicker->getHSelf(), PosAlign::left, p7);
|
||||
alignWith(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR8_STATIC), _pDisabledTextColorPicker->getHSelf(), PosAlign::left, p8);
|
||||
alignWith(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR9_STATIC), _pEdgeColorPicker->getHSelf(), PosAlign::left, p9);
|
||||
alignWith(::GetDlgItem(_hSelf, IDD_CUSTOMIZED_COLOR10_STATIC), _pLinkColorPicker->getHSelf(), PosAlign::left, p10);
|
||||
|
||||
int cpDynamicalWidth = NppParameters::getInstance()._dpiManager.scaleX(25);
|
||||
int cpDynamicalHeight = NppParameters::getInstance()._dpiManager.scaleY(25);
|
||||
|
||||
p1.x -= cpDynamicalWidth + 5; p1.y -= cpDynamicalHeight / 6;
|
||||
p2.x -= cpDynamicalWidth + 5; p2.y -= cpDynamicalHeight / 6;
|
||||
p3.x -= cpDynamicalWidth + 5; p3.y -= cpDynamicalHeight / 6;
|
||||
p4.x -= cpDynamicalWidth + 5; p4.y -= cpDynamicalHeight / 6;
|
||||
p5.x -= cpDynamicalWidth + 5; p5.y -= cpDynamicalHeight / 6;
|
||||
p6.x -= cpDynamicalWidth + 5; p6.y -= cpDynamicalHeight / 6;
|
||||
p7.x -= cpDynamicalWidth + 5; p7.y -= cpDynamicalHeight / 6;
|
||||
p8.x -= cpDynamicalWidth + 5; p8.y -= cpDynamicalHeight / 6;
|
||||
p9.x -= cpDynamicalWidth + 5; p9.y -= cpDynamicalHeight / 6;
|
||||
p1.x -= cpDynamicalWidth ; p1.y -= cpDynamicalHeight / 6;
|
||||
p2.x -= cpDynamicalWidth ; p2.y -= cpDynamicalHeight / 6;
|
||||
p3.x -= cpDynamicalWidth ; p3.y -= cpDynamicalHeight / 6;
|
||||
p4.x -= cpDynamicalWidth ; p4.y -= cpDynamicalHeight / 6;
|
||||
p5.x -= cpDynamicalWidth ; p5.y -= cpDynamicalHeight / 6;
|
||||
p6.x -= cpDynamicalWidth ; p6.y -= cpDynamicalHeight / 6;
|
||||
p7.x -= cpDynamicalWidth ; p7.y -= cpDynamicalHeight / 6;
|
||||
p8.x -= cpDynamicalWidth ; p8.y -= cpDynamicalHeight / 6;
|
||||
p9.x -= cpDynamicalWidth ; p9.y -= cpDynamicalHeight / 6;
|
||||
p10.x -= cpDynamicalWidth; p10.y -= cpDynamicalHeight / 6;
|
||||
|
||||
::MoveWindow(reinterpret_cast<HWND>(_pPureBackgroundColorPicker->getHSelf()), p1.x, p1.y, cpDynamicalWidth, cpDynamicalHeight, TRUE);
|
||||
::MoveWindow(reinterpret_cast<HWND>(_pHotBackgroundColorPicker->getHSelf()), p2.x, p2.y, cpDynamicalWidth, cpDynamicalHeight, TRUE);
|
||||
|
@ -929,6 +936,7 @@ INT_PTR CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
::MoveWindow(reinterpret_cast<HWND>(_pDarkerTextColorPicker->getHSelf()), p7.x, p7.y, cpDynamicalWidth, cpDynamicalHeight, TRUE);
|
||||
::MoveWindow(reinterpret_cast<HWND>(_pDisabledTextColorPicker->getHSelf()), p8.x, p8.y, cpDynamicalWidth, cpDynamicalHeight, TRUE);
|
||||
::MoveWindow(reinterpret_cast<HWND>(_pEdgeColorPicker->getHSelf()), p9.x, p9.y, cpDynamicalWidth, cpDynamicalHeight, TRUE);
|
||||
::MoveWindow(reinterpret_cast<HWND>(_pLinkColorPicker->getHSelf()), p10.x, p10.y, cpDynamicalWidth, cpDynamicalHeight, TRUE);
|
||||
|
||||
_pBackgroundColorPicker->display();
|
||||
_pSofterBackgroundColorPicker->display();
|
||||
|
@ -939,6 +947,7 @@ INT_PTR CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
_pDarkerTextColorPicker->display();
|
||||
_pDisabledTextColorPicker->display();
|
||||
_pEdgeColorPicker->display();
|
||||
_pLinkColorPicker->display();
|
||||
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_DARKMODE_BLACK), nppGUI._darkmode._isEnabled);
|
||||
::EnableWindow(::GetDlgItem(_hSelf, IDC_RADIO_DARKMODE_RED), nppGUI._darkmode._isEnabled);
|
||||
|
@ -968,6 +977,7 @@ INT_PTR CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
_pDarkerTextColorPicker->destroy();
|
||||
_pDisabledTextColorPicker->destroy();
|
||||
_pEdgeColorPicker->destroy();
|
||||
_pLinkColorPicker->destroy();
|
||||
|
||||
delete _pBackgroundColorPicker;
|
||||
delete _pSofterBackgroundColorPicker;
|
||||
|
@ -978,6 +988,7 @@ INT_PTR CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
delete _pDarkerTextColorPicker;
|
||||
delete _pDisabledTextColorPicker;
|
||||
delete _pEdgeColorPicker;
|
||||
delete _pLinkColorPicker;
|
||||
}
|
||||
|
||||
case WM_COMMAND:
|
||||
|
@ -1156,6 +1167,12 @@ INT_PTR CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
NppDarkMode::setEdgeColor(c);
|
||||
nppGUI._darkmode._customColors.edge = c;
|
||||
}
|
||||
else if (reinterpret_cast<HWND>(lParam) == _pLinkColorPicker->getHSelf())
|
||||
{
|
||||
c = _pLinkColorPicker->getColour();
|
||||
NppDarkMode::setLinkTextColor(c);
|
||||
nppGUI._darkmode._customColors.linkText = c;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
|
|
|
@ -69,6 +69,7 @@ private:
|
|||
ColourPicker* _pDarkerTextColorPicker = nullptr;
|
||||
ColourPicker* _pDisabledTextColorPicker = nullptr;
|
||||
ColourPicker* _pEdgeColorPicker = nullptr;
|
||||
ColourPicker* _pLinkColorPicker = nullptr;
|
||||
|
||||
INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
|
||||
void enableCustomizedColorCtrls(bool doEnable);
|
||||
|
|
|
@ -391,5 +391,6 @@
|
|||
#define IDD_CUSTOMIZED_COLOR7_STATIC (IDD_PREFERENCE_SUB_DARKMODE + 22)
|
||||
#define IDD_CUSTOMIZED_COLOR8_STATIC (IDD_PREFERENCE_SUB_DARKMODE + 23)
|
||||
#define IDD_CUSTOMIZED_COLOR9_STATIC (IDD_PREFERENCE_SUB_DARKMODE + 24)
|
||||
#define IDD_CUSTOMIZED_COLOR10_STATIC (IDD_PREFERENCE_SUB_DARKMODE + 25)
|
||||
#define IDD_CUSTOMIZED_RESET_BUTTON (IDD_PREFERENCE_SUB_DARKMODE + 30)
|
||||
#endif //PREFERENCE_RC_H
|
||||
|
|
Loading…
Reference in New Issue