Add dark mode support for plugins
Support dark mode for plugins with docking GUI. Fix #11710, close #11711
This commit is contained in:
parent
b204be9012
commit
d3b026bfeb
|
@ -915,6 +915,7 @@ The comments are here for explanation, it's not necessary to translate them.
|
|||
<Item id="7126" name="Edge highlight"/>
|
||||
<Item id="7130" name="Reset"/>
|
||||
<Item id="7135" name="Tones"/>
|
||||
<Item id="7136" name="Apply dark mode on plugins with docking window (requires Notepad++ restart)"/>
|
||||
</DarkMode>
|
||||
|
||||
<MarginsBorderEdge title="Margins/Border/Edge">
|
||||
|
|
|
@ -6620,7 +6620,7 @@ void Notepad_plus::launchClipboardHistoryPanel()
|
|||
|
||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pClipboardHistoryPanel->getHSelf()));
|
||||
// define the default docking behaviour
|
||||
data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB;
|
||||
data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
|
||||
|
||||
int icoID = IDR_CLIPBOARDPANEL_ICO;
|
||||
if (NppDarkMode::isEnabled())
|
||||
|
@ -6673,7 +6673,7 @@ void Notepad_plus::launchDocumentListPanel()
|
|||
|
||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pDocumentListPanel->getHSelf()));
|
||||
// define the default docking behaviour
|
||||
data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB;
|
||||
data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
|
||||
|
||||
int icoID = IDR_DOCLIST_ICO;
|
||||
if (NppDarkMode::isEnabled())
|
||||
|
@ -6724,7 +6724,7 @@ void Notepad_plus::launchAnsiCharPanel()
|
|||
|
||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pAnsiCharPanel->getHSelf()));
|
||||
// define the default docking behaviour
|
||||
data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB;
|
||||
data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
|
||||
|
||||
int icoID = IDR_ASCIIPANEL_ICO;
|
||||
if (NppDarkMode::isEnabled())
|
||||
|
@ -6775,7 +6775,7 @@ void Notepad_plus::launchFileBrowser(const vector<generic_string> & folders, con
|
|||
|
||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pFileBrowser->getHSelf()));
|
||||
// define the default docking behaviour
|
||||
data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB;
|
||||
data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
|
||||
|
||||
int icoID = IDR_FILEBROWSER_ICO;
|
||||
if (NppDarkMode::isEnabled())
|
||||
|
@ -6883,7 +6883,7 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int
|
|||
|
||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>((*pProjPanel)->getHSelf()));
|
||||
// define the default docking behaviour
|
||||
data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB;
|
||||
data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
|
||||
|
||||
int icoID = IDR_PROJECTPANEL_ICO;
|
||||
if (NppDarkMode::isEnabled())
|
||||
|
@ -6947,7 +6947,7 @@ void Notepad_plus::launchDocMap()
|
|||
|
||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pDocMap->getHSelf()));
|
||||
// define the default docking behaviour
|
||||
data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB;
|
||||
data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
|
||||
|
||||
int icoID = IDR_DOCMAP_ICO;
|
||||
if (NppDarkMode::isEnabled())
|
||||
|
@ -6994,7 +6994,7 @@ void Notepad_plus::launchFunctionList()
|
|||
|
||||
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pFuncList->getHSelf()));
|
||||
// define the default docking behaviour
|
||||
data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB;
|
||||
data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
|
||||
|
||||
NppParameters& nppParam = NppParameters::getInstance();
|
||||
|
||||
|
|
|
@ -323,6 +323,7 @@ namespace NppDarkMode
|
|||
Options opt;
|
||||
opt.enable = nppGui._darkmode._isEnabled;
|
||||
opt.enableMenubar = opt.enable;
|
||||
opt.enablePlugin = nppGui._darkmode._isEnabledPlugin;
|
||||
|
||||
g_colorToneChoice = nppGui._darkmode._colorTone;
|
||||
tCustom.change(nppGui._darkmode._customColors);
|
||||
|
@ -377,6 +378,11 @@ namespace NppDarkMode
|
|||
return _options.enable;
|
||||
}
|
||||
|
||||
bool isEnabledForPlugins()
|
||||
{
|
||||
return _options.enablePlugin;
|
||||
}
|
||||
|
||||
bool isDarkMenuEnabled()
|
||||
{
|
||||
return _options.enableMenubar;
|
||||
|
@ -1493,6 +1499,70 @@ namespace NppDarkMode
|
|||
SetWindowSubclass(hwnd, ComboBoxSubclass, g_comboBoxSubclassID, hwndEditData);
|
||||
}
|
||||
|
||||
constexpr UINT_PTR g_listViewSubclassID = 42;
|
||||
|
||||
LRESULT CALLBACK ListViewSubclass(
|
||||
HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
UINT_PTR uIdSubclass,
|
||||
DWORD_PTR dwRefData
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwRefData);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_NCDESTROY:
|
||||
{
|
||||
::RemoveWindowSubclass(hWnd, ListViewSubclass, uIdSubclass);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
switch (reinterpret_cast<LPNMHDR>(lParam)->code)
|
||||
{
|
||||
case NM_CUSTOMDRAW:
|
||||
{
|
||||
auto lpnmcd = reinterpret_cast<LPNMCUSTOMDRAW>(lParam);
|
||||
switch (lpnmcd->dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
{
|
||||
if (NppDarkMode::isExperimentalSupported() && NppDarkMode::isEnabled())
|
||||
{
|
||||
return CDRF_NOTIFYITEMDRAW;
|
||||
}
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
{
|
||||
SetTextColor(lpnmcd->hdc, NppDarkMode::getDarkerTextColor());
|
||||
|
||||
return CDRF_NEWFONT;
|
||||
}
|
||||
|
||||
default:
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
void subclassListViewControl(HWND hwnd)
|
||||
{
|
||||
SetWindowSubclass(hwnd, ListViewSubclass, g_listViewSubclassID, 0);
|
||||
}
|
||||
|
||||
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass, bool theme)
|
||||
{
|
||||
struct Params
|
||||
|
@ -1512,8 +1582,8 @@ namespace NppDarkMode
|
|||
|
||||
EnumChildWindows(hwndParent, [](HWND hwnd, LPARAM lParam) WINAPI_LAMBDA {
|
||||
auto& p = *reinterpret_cast<Params*>(lParam);
|
||||
const size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen] = { '\0' };
|
||||
constexpr size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen]{};
|
||||
GetClassName(hwnd, className, classNameLen);
|
||||
|
||||
if (wcscmp(className, WC_COMBOBOX) == 0)
|
||||
|
@ -1608,6 +1678,58 @@ namespace NppDarkMode
|
|||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (wcscmp(className, TOOLBARCLASSNAME) == 0)
|
||||
{
|
||||
NppDarkMode::setDarkLineAbovePanelToolbar(hwnd);
|
||||
NppDarkMode::setDarkTooltips(hwnd, NppDarkMode::ToolTipsType::toolbar);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (wcscmp(className, WC_LISTVIEW) == 0)
|
||||
{
|
||||
NppDarkMode::setDarkListView(hwnd);
|
||||
NppDarkMode::setDarkTooltips(hwnd, NppDarkMode::ToolTipsType::listview);
|
||||
|
||||
ListView_SetTextColor(hwnd, NppParameters::getInstance().getCurrentDefaultFgColor());
|
||||
ListView_SetTextBkColor(hwnd, NppParameters::getInstance().getCurrentDefaultBgColor());
|
||||
ListView_SetBkColor(hwnd, NppParameters::getInstance().getCurrentDefaultBgColor());
|
||||
|
||||
if (p.subclass)
|
||||
{
|
||||
auto exStyle = ListView_GetExtendedListViewStyle(hwnd);
|
||||
ListView_SetExtendedListViewStyle(hwnd, exStyle | LVS_EX_DOUBLEBUFFER);
|
||||
NppDarkMode::subclassListViewControl(hwnd);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (wcscmp(className, WC_TREEVIEW) == 0)
|
||||
{
|
||||
TreeView_SetTextColor(hwnd, NppParameters::getInstance().getCurrentDefaultFgColor());
|
||||
TreeView_SetBkColor(hwnd, NppParameters::getInstance().getCurrentDefaultBgColor());
|
||||
|
||||
NppDarkMode::calculateTreeViewStyle();
|
||||
NppDarkMode::setTreeViewStyle(hwnd);
|
||||
|
||||
NppDarkMode::setDarkTooltips(hwnd, NppDarkMode::ToolTipsType::treeview);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (wcscmp(className, L"RichEdit20W") == 0 || wcscmp(className, L"RICHEDIT50W") == 0)
|
||||
{
|
||||
if (p.theme)
|
||||
{
|
||||
//dark scrollbar for richedit
|
||||
SetWindowTheme(hwnd, p.themeClassName, nullptr);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}, reinterpret_cast<LPARAM>(&p));
|
||||
}
|
||||
|
@ -1617,6 +1739,365 @@ namespace NppDarkMode
|
|||
autoSubclassAndThemeChildControls(hwndParent, false, true);
|
||||
}
|
||||
|
||||
LRESULT darkToolBarNotifyCustomDraw(LPARAM lParam)
|
||||
{
|
||||
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(lParam);
|
||||
static int roundCornerValue = 0;
|
||||
|
||||
switch (nmtbcd->nmcd.dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
auto dpiManager = NppParameters::getInstance()._dpiManager;
|
||||
roundCornerValue = NppDarkMode::isWindows11() ? dpiManager.scaleX(5) : 0;
|
||||
|
||||
::FillRect(nmtbcd->nmcd.hdc, &nmtbcd->nmcd.rc, NppDarkMode::getDarkerBackgroundBrush());
|
||||
return CDRF_NOTIFYITEMDRAW;
|
||||
}
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
{
|
||||
nmtbcd->hbrLines = NppDarkMode::getEdgeBrush();
|
||||
nmtbcd->clrText = NppDarkMode::getTextColor();
|
||||
nmtbcd->clrTextHighlight = NppDarkMode::getTextColor();
|
||||
nmtbcd->clrBtnFace = NppDarkMode::getBackgroundColor();
|
||||
nmtbcd->clrBtnHighlight = NppDarkMode::getSofterBackgroundColor();
|
||||
nmtbcd->clrHighlightHotTrack = NppDarkMode::getHotBackgroundColor();
|
||||
nmtbcd->nStringBkMode = TRANSPARENT;
|
||||
nmtbcd->nHLStringBkMode = TRANSPARENT;
|
||||
|
||||
if ((nmtbcd->nmcd.uItemState & CDIS_CHECKED) == CDIS_CHECKED)
|
||||
{
|
||||
auto holdBrush = ::SelectObject(nmtbcd->nmcd.hdc, NppDarkMode::getSofterBackgroundBrush());
|
||||
auto holdPen = ::SelectObject(nmtbcd->nmcd.hdc, NppDarkMode::getEdgePen());
|
||||
::RoundRect(nmtbcd->nmcd.hdc, nmtbcd->nmcd.rc.left, nmtbcd->nmcd.rc.top, nmtbcd->nmcd.rc.right, nmtbcd->nmcd.rc.bottom, roundCornerValue, roundCornerValue);
|
||||
::SelectObject(nmtbcd->nmcd.hdc, holdBrush);
|
||||
::SelectObject(nmtbcd->nmcd.hdc, holdPen);
|
||||
|
||||
nmtbcd->nmcd.uItemState &= ~CDIS_CHECKED;
|
||||
}
|
||||
|
||||
return TBCDRF_HILITEHOTTRACK | TBCDRF_USECDCOLORS | CDRF_NOTIFYPOSTPAINT;
|
||||
}
|
||||
|
||||
case CDDS_ITEMPOSTPAINT:
|
||||
{
|
||||
bool isDropDown = false;
|
||||
|
||||
auto exStyle = ::SendMessage(nmtbcd->nmcd.hdr.hwndFrom, TB_GETEXTENDEDSTYLE, 0, 0);
|
||||
if ((exStyle & TBSTYLE_EX_DRAWDDARROWS) == TBSTYLE_EX_DRAWDDARROWS)
|
||||
{
|
||||
TBBUTTONINFO tbButtonInfo{};
|
||||
tbButtonInfo.cbSize = sizeof(TBBUTTONINFO);
|
||||
tbButtonInfo.dwMask = TBIF_STYLE;
|
||||
::SendMessage(nmtbcd->nmcd.hdr.hwndFrom, TB_GETBUTTONINFO, nmtbcd->nmcd.dwItemSpec, reinterpret_cast<LPARAM>(&tbButtonInfo));
|
||||
|
||||
isDropDown = (tbButtonInfo.fsStyle & BTNS_DROPDOWN) == BTNS_DROPDOWN;
|
||||
}
|
||||
|
||||
if ( !isDropDown && (nmtbcd->nmcd.uItemState & CDIS_HOT) == CDIS_HOT)
|
||||
{
|
||||
NppDarkMode::paintRoundFrameRect(nmtbcd->nmcd.hdc, nmtbcd->nmcd.rc, NppDarkMode::getHotEdgePen(), roundCornerValue, roundCornerValue);
|
||||
}
|
||||
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
|
||||
default:
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT darkListViewNotifyCustomDraw(LPARAM lParam)
|
||||
{
|
||||
auto lplvcd = reinterpret_cast<LPNMLVCUSTOMDRAW>(lParam);
|
||||
|
||||
switch (lplvcd->nmcd.dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
{
|
||||
return CDRF_NOTIFYITEMDRAW;
|
||||
}
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
{
|
||||
auto isSelected = ListView_GetItemState(lplvcd->nmcd.hdr.hwndFrom, lplvcd->nmcd.dwItemSpec, LVIS_SELECTED) == LVIS_SELECTED;
|
||||
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
if (isSelected)
|
||||
{
|
||||
lplvcd->clrText = NppDarkMode::getTextColor();
|
||||
lplvcd->clrTextBk = NppDarkMode::getSofterBackgroundColor();
|
||||
|
||||
::FillRect(lplvcd->nmcd.hdc, &lplvcd->nmcd.rc, NppDarkMode::getSofterBackgroundBrush());
|
||||
}
|
||||
else if ((lplvcd->nmcd.uItemState & CDIS_HOT) == CDIS_HOT)
|
||||
{
|
||||
lplvcd->clrText = NppDarkMode::getTextColor();
|
||||
lplvcd->clrTextBk = NppDarkMode::getHotBackgroundColor();
|
||||
|
||||
::FillRect(lplvcd->nmcd.hdc, &lplvcd->nmcd.rc, NppDarkMode::getHotBackgroundBrush());
|
||||
}
|
||||
}
|
||||
|
||||
if (isSelected)
|
||||
{
|
||||
::DrawFocusRect(lplvcd->nmcd.hdc, &lplvcd->nmcd.rc);
|
||||
}
|
||||
|
||||
return CDRF_NEWFONT;
|
||||
}
|
||||
|
||||
default:
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT darkTreeViewNotifyCustomDraw(LPARAM lParam)
|
||||
{
|
||||
auto lptvcd = reinterpret_cast<LPNMTVCUSTOMDRAW>(lParam);
|
||||
|
||||
switch (lptvcd->nmcd.dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
return CDRF_NOTIFYITEMDRAW;
|
||||
}
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
{
|
||||
if ((lptvcd->nmcd.uItemState & CDIS_SELECTED) == CDIS_SELECTED)
|
||||
{
|
||||
lptvcd->clrText = NppDarkMode::getTextColor();
|
||||
lptvcd->clrTextBk = NppDarkMode::getSofterBackgroundColor();
|
||||
::FillRect(lptvcd->nmcd.hdc, &lptvcd->nmcd.rc, NppDarkMode::getSofterBackgroundBrush());
|
||||
|
||||
return CDRF_NEWFONT | CDRF_NOTIFYPOSTPAINT;
|
||||
}
|
||||
|
||||
if ((lptvcd->nmcd.uItemState & CDIS_HOT) == CDIS_HOT)
|
||||
{
|
||||
lptvcd->clrText = NppDarkMode::getTextColor();
|
||||
lptvcd->clrTextBk = NppDarkMode::getHotBackgroundColor();
|
||||
::FillRect(lptvcd->nmcd.hdc, &lptvcd->nmcd.rc, NppDarkMode::getHotBackgroundBrush());
|
||||
|
||||
return CDRF_NEWFONT | CDRF_NOTIFYPOSTPAINT;
|
||||
}
|
||||
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
|
||||
case CDDS_ITEMPOSTPAINT:
|
||||
{
|
||||
RECT rcFrame = lptvcd->nmcd.rc;
|
||||
rcFrame.left -= 1;
|
||||
rcFrame.right += 1;
|
||||
|
||||
if ((lptvcd->nmcd.uItemState & CDIS_HOT) == CDIS_HOT)
|
||||
{
|
||||
NppDarkMode::paintRoundFrameRect(lptvcd->nmcd.hdc, rcFrame, NppDarkMode::getHotEdgePen(), 0, 0);
|
||||
}
|
||||
else if ((lptvcd->nmcd.uItemState & CDIS_SELECTED) == CDIS_SELECTED)
|
||||
{
|
||||
NppDarkMode::paintRoundFrameRect(lptvcd->nmcd.hdc, rcFrame, NppDarkMode::getEdgePen(), 0, 0);
|
||||
}
|
||||
|
||||
return CDRF_DODEFAULT;
|
||||
|
||||
}
|
||||
|
||||
default:
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
constexpr UINT_PTR g_pluginDockWindowSubclassID = 42;
|
||||
|
||||
LRESULT CALLBACK PluginDockWindowSubclass(
|
||||
HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
UINT_PTR uIdSubclass,
|
||||
DWORD_PTR dwRefData
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwRefData);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_ERASEBKGND:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
RECT rect = {};
|
||||
GetClientRect(hWnd, &rect);
|
||||
::FillRect(reinterpret_cast<HDC>(wParam), &rect, NppDarkMode::getDarkerBackgroundBrush());
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_NCDESTROY:
|
||||
{
|
||||
::RemoveWindowSubclass(hWnd, PluginDockWindowSubclass, uIdSubclass);
|
||||
break;
|
||||
}
|
||||
|
||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||
{
|
||||
NppDarkMode::autoThemeChildControls(hWnd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_CTLCOLOREDIT:
|
||||
{
|
||||
return NppDarkMode::onCtlColorSofter(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
|
||||
case WM_CTLCOLORLISTBOX:
|
||||
case WM_CTLCOLORDLG:
|
||||
{
|
||||
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
|
||||
case WM_CTLCOLORSTATIC:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
constexpr size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen]{};
|
||||
auto hwndEdit = reinterpret_cast<HWND>(lParam);
|
||||
GetClassName(hwndEdit, className, classNameLen);
|
||||
if (wcscmp(className, WC_EDIT) == 0)
|
||||
{
|
||||
return NppDarkMode::onCtlColor(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
return NppDarkMode::onCtlColorDarker(reinterpret_cast<HDC>(wParam));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_PRINTCLIENT:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
auto nmhdr = reinterpret_cast<LPNMHDR>(lParam);
|
||||
|
||||
constexpr size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen]{};
|
||||
GetClassName(nmhdr->hwndFrom, className, classNameLen);
|
||||
|
||||
switch (nmhdr->code)
|
||||
{
|
||||
case NM_CUSTOMDRAW:
|
||||
{
|
||||
if (wcscmp(className, TOOLBARCLASSNAME) == 0)
|
||||
{
|
||||
return NppDarkMode::darkToolBarNotifyCustomDraw(lParam);
|
||||
}
|
||||
|
||||
if (wcscmp(className, WC_LISTVIEW) == 0)
|
||||
{
|
||||
return NppDarkMode::darkListViewNotifyCustomDraw(lParam);
|
||||
}
|
||||
|
||||
if (wcscmp(className, WC_TREEVIEW) == 0)
|
||||
{
|
||||
return NppDarkMode::darkTreeViewNotifyCustomDraw(lParam);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
void autoSubclassAndThemePluginDockWindow(HWND hwnd)
|
||||
{
|
||||
SetWindowSubclass(hwnd, PluginDockWindowSubclass, g_pluginDockWindowSubclassID, 0);
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(hwnd);
|
||||
}
|
||||
|
||||
constexpr UINT_PTR g_windowNotifySubclassID = 42;
|
||||
|
||||
LRESULT CALLBACK WindowNotifySubclass(
|
||||
HWND hWnd,
|
||||
UINT uMsg,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam,
|
||||
UINT_PTR uIdSubclass,
|
||||
DWORD_PTR dwRefData
|
||||
)
|
||||
{
|
||||
UNREFERENCED_PARAMETER(dwRefData);
|
||||
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_NCDESTROY:
|
||||
{
|
||||
::RemoveWindowSubclass(hWnd, PluginDockWindowSubclass, uIdSubclass);
|
||||
break;
|
||||
}
|
||||
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
auto nmhdr = reinterpret_cast<LPNMHDR>(lParam);
|
||||
|
||||
constexpr size_t classNameLen = 16;
|
||||
TCHAR className[classNameLen]{};
|
||||
GetClassName(nmhdr->hwndFrom, className, classNameLen);
|
||||
|
||||
switch (nmhdr->code)
|
||||
{
|
||||
case NM_CUSTOMDRAW:
|
||||
{
|
||||
if (wcscmp(className, TOOLBARCLASSNAME) == 0)
|
||||
{
|
||||
return NppDarkMode::darkToolBarNotifyCustomDraw(lParam);
|
||||
}
|
||||
|
||||
if (wcscmp(className, WC_LISTVIEW) == 0)
|
||||
{
|
||||
return NppDarkMode::darkListViewNotifyCustomDraw(lParam);
|
||||
}
|
||||
|
||||
if (wcscmp(className, WC_TREEVIEW) == 0)
|
||||
{
|
||||
return NppDarkMode::darkTreeViewNotifyCustomDraw(lParam);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
void autoSubclassAndThemeWindowNotify(HWND hwnd)
|
||||
{
|
||||
SetWindowSubclass(hwnd, WindowNotifySubclass, g_windowNotifySubclassID, 0);
|
||||
}
|
||||
|
||||
constexpr UINT_PTR g_tabUpDownSubclassID = 42;
|
||||
|
||||
LRESULT CALLBACK TabUpDownSubclass(
|
||||
|
@ -1841,6 +2322,8 @@ namespace NppDarkMode
|
|||
}
|
||||
|
||||
void setDarkListView(HWND hwnd)
|
||||
{
|
||||
if (NppDarkMode::isExperimentalSupported())
|
||||
{
|
||||
bool useDark = NppDarkMode::isEnabled();
|
||||
|
||||
|
@ -1851,6 +2334,7 @@ namespace NppDarkMode
|
|||
NppDarkMode::allowDarkModeForWindow(hwnd, useDark);
|
||||
SetWindowTheme(hwnd, L"Explorer", nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void disableVisualStyle(HWND hwnd, bool doDisable)
|
||||
{
|
||||
|
|
|
@ -48,6 +48,7 @@ namespace NppDarkMode
|
|||
{
|
||||
bool enable = false;
|
||||
bool enableMenubar = false;
|
||||
bool enablePlugin = false;
|
||||
};
|
||||
|
||||
enum class ToolTipsType
|
||||
|
@ -82,6 +83,7 @@ namespace NppDarkMode
|
|||
|
||||
bool isEnabled();
|
||||
bool isDarkMenuEnabled();
|
||||
bool isEnabledForPlugins();
|
||||
bool isExperimentalSupported();
|
||||
|
||||
bool isWindows11();
|
||||
|
@ -160,6 +162,13 @@ namespace NppDarkMode
|
|||
void autoSubclassAndThemeChildControls(HWND hwndParent, bool subclass = true, bool theme = true);
|
||||
void autoThemeChildControls(HWND hwndParent);
|
||||
|
||||
LRESULT darkToolBarNotifyCustomDraw(LPARAM lParam);
|
||||
LRESULT darkListViewNotifyCustomDraw(LPARAM lParam);
|
||||
LRESULT darkTreeViewNotifyCustomDraw(LPARAM lParam);
|
||||
|
||||
void autoSubclassAndThemePluginDockWindow(HWND hwnd);
|
||||
void autoSubclassAndThemeWindowNotify(HWND hwnd);
|
||||
|
||||
bool subclassTabUpDownControl(HWND hwnd);
|
||||
|
||||
void setDarkTitleBar(HWND hwnd);
|
||||
|
|
|
@ -5547,6 +5547,8 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
|
|||
|
||||
_nppGUI._darkmode._isEnabled = parseYesNoBoolAttribute(TEXT("enable"));
|
||||
|
||||
_nppGUI._darkmode._isEnabledPlugin = parseYesNoBoolAttribute(TEXT("enablePlugin"));
|
||||
|
||||
int i;
|
||||
const TCHAR* val;
|
||||
val = element->Attribute(TEXT("colorTone"), &i);
|
||||
|
@ -6682,6 +6684,7 @@ void NppParameters::createXmlTreeFromGUIParams()
|
|||
};
|
||||
|
||||
setYesNoBoolAttribute(TEXT("enable"), _nppGUI._darkmode._isEnabled);
|
||||
setYesNoBoolAttribute(TEXT("enablePlugin"), _nppGUI._darkmode._isEnabledPlugin);
|
||||
GUIConfigElement->SetAttribute(TEXT("colorTone"), _nppGUI._darkmode._colorTone);
|
||||
|
||||
GUIConfigElement->SetAttribute(TEXT("customColorTop"), _nppGUI._darkmode._customColors.pureBackground);
|
||||
|
|
|
@ -715,6 +715,7 @@ public:
|
|||
struct DarkModeConf final
|
||||
{
|
||||
bool _isEnabled = false;
|
||||
bool _isEnabledPlugin = false;
|
||||
NppDarkMode::ColorTone _colorTone = NppDarkMode::blackTone;
|
||||
NppDarkMode::Colors _customColors = NppDarkMode::getDarkModeDefaultColors();
|
||||
};
|
||||
|
@ -884,6 +885,7 @@ struct NppGUI final
|
|||
bool _shouldSortFunctionList = false;
|
||||
|
||||
DarkModeConf _darkmode;
|
||||
DarkModeConf _darkmodeplugins;
|
||||
};
|
||||
|
||||
struct ScintillaViewParams
|
||||
|
|
|
@ -2648,7 +2648,7 @@ void FindReplaceDlg::findAllIn(InWhat op)
|
|||
_pFinder->create(&data);
|
||||
::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pFinder->getHSelf()));
|
||||
// define the default docking behaviour
|
||||
data.uMask = DWS_DF_CONT_BOTTOM | DWS_ICONTAB | DWS_ADDINFO;
|
||||
data.uMask = DWS_DF_CONT_BOTTOM | DWS_ICONTAB | DWS_ADDINFO | DWS_USEOWNDARKMODE;
|
||||
data.hIconTab = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_FIND_RESULT_ICON), IMAGE_ICON, 0, 0, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
|
||||
data.pszAddInfo = _findAllResultStr;
|
||||
|
||||
|
@ -2779,7 +2779,7 @@ Finder * FindReplaceDlg::createFinder()
|
|||
pFinder->create(&data, isRTL);
|
||||
::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<WPARAM>(pFinder->getHSelf()));
|
||||
// define the default docking behaviour
|
||||
data.uMask = DWS_DF_CONT_BOTTOM | DWS_ICONTAB | DWS_ADDINFO;
|
||||
data.uMask = DWS_DF_CONT_BOTTOM | DWS_ICONTAB | DWS_ADDINFO | DWS_USEOWNDARKMODE;
|
||||
data.hIconTab = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_FIND_RESULT_ICON), IMAGE_ICON, 0, 0, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
|
||||
data.pszAddInfo = _findAllResultStr;
|
||||
|
||||
|
|
|
@ -54,8 +54,6 @@ void ListView::init(HINSTANCE hInst, HWND parent)
|
|||
throw std::runtime_error("ListView::init : CreateWindowEx() function return null");
|
||||
}
|
||||
|
||||
NppDarkMode::setDarkListView(_hSelf);
|
||||
|
||||
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
||||
_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticProc)));
|
||||
|
||||
|
@ -168,36 +166,6 @@ std::vector<size_t> ListView::getCheckedIndexes() const
|
|||
|
||||
LRESULT ListView::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (Message)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
switch (reinterpret_cast<LPNMHDR>(lParam)->code)
|
||||
{
|
||||
case NM_CUSTOMDRAW:
|
||||
{
|
||||
LPNMCUSTOMDRAW nmcd = reinterpret_cast<LPNMCUSTOMDRAW>(lParam);
|
||||
switch (nmcd->dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
{
|
||||
return CDRF_NOTIFYITEMDRAW;
|
||||
}
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
{
|
||||
bool isDarkModeSupported = NppDarkMode::isEnabled() && NppDarkMode::isExperimentalSupported();
|
||||
SetTextColor(nmcd->hdc, isDarkModeSupported ? NppDarkMode::getDarkerTextColor() : GetSysColor(COLOR_BTNTEXT));
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ::CallWindowProc(_defaultProc, hwnd, Message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
|
|
@ -50,12 +50,15 @@ intptr_t CALLBACK AnsiCharPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
_listView.setValues(codepage==-1?0:codepage);
|
||||
_listView.display();
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||
{
|
||||
NppDarkMode::setDarkListView(_listView.getHSelf());
|
||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#define DWS_ICONTAB 0x00000001 // Icon for tabs are available
|
||||
#define DWS_ICONBAR 0x00000002 // Icon for icon bar are available (currently not supported)
|
||||
#define DWS_ADDINFO 0x00000004 // Additional information are in use
|
||||
#define DWS_USEOWNDARKMODE 0x00000008 // Use plugin's own dark mode
|
||||
#define DWS_PARAMSALL (DWS_ICONTAB|DWS_ICONBAR|DWS_ADDINFO)
|
||||
|
||||
// default docking values for first call of plugin
|
||||
|
|
|
@ -572,6 +572,11 @@ void DockingManager::createDockableDlg(tTbData data, int iCont, bool isVisible)
|
|||
_vImageList.push_back(data.hClient);
|
||||
}
|
||||
|
||||
if ((data.uMask & DWS_USEOWNDARKMODE) != DWS_USEOWNDARKMODE && NppDarkMode::isEnabledForPlugins())
|
||||
{
|
||||
NppDarkMode::autoSubclassAndThemePluginDockWindow(data.hClient);
|
||||
}
|
||||
|
||||
// create additional containers if necessary
|
||||
RECT rc = {0,0,0,0};
|
||||
DockingCont* pCont = NULL;
|
||||
|
|
|
@ -102,9 +102,6 @@ intptr_t CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
|
|||
int style = WS_CHILD | WS_VISIBLE | CCS_ADJUSTABLE | TBSTYLE_AUTOSIZE | TBSTYLE_FLAT | TBSTYLE_LIST | TBSTYLE_TRANSPARENT | BTNS_AUTOSIZE | BTNS_SEP | TBSTYLE_TOOLTIPS | TBSTYLE_CUSTOMERASE;
|
||||
_hToolbarMenu = CreateWindowEx(WS_EX_LAYOUTRTL, TOOLBARCLASSNAME, NULL, style, 0, 0, 0, 0, _hSelf, nullptr, _hInst, NULL);
|
||||
|
||||
NppDarkMode::setDarkTooltips(_hToolbarMenu, NppDarkMode::ToolTipsType::toolbar);
|
||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||
|
||||
// Add the bmap image into toolbar's imagelist
|
||||
int iconSizeDyn = nppParam._dpiManager.scaleX(16);
|
||||
::SendMessage(_hToolbarMenu, TB_SETBITMAPSIZE, 0, MAKELPARAM(iconSizeDyn, iconSizeDyn));
|
||||
|
@ -173,6 +170,9 @@ intptr_t CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
|
|||
_treeView.makeLabelEditable(false);
|
||||
_treeView.display();
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -180,10 +180,7 @@ intptr_t CALLBACK FileBrowser::run_dlgProc(UINT message, WPARAM wParam, LPARAM l
|
|||
{
|
||||
if (static_cast<BOOL>(lParam) != TRUE)
|
||||
{
|
||||
NppDarkMode::setDarkTooltips(_hToolbarMenu, NppDarkMode::ToolTipsType::toolbar);
|
||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||
|
||||
NppDarkMode::setDarkTooltips(_treeView.getHSelf(), NppDarkMode::ToolTipsType::treeview);
|
||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||
}
|
||||
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
||||
return TRUE;
|
||||
|
@ -675,14 +672,6 @@ void FileBrowser::notified(LPNMHDR notification)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (notification->code == NM_CUSTOMDRAW && (notification->hwndFrom == _hToolbarMenu))
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(notification);
|
||||
::FillRect(nmtbcd->nmcd.hdc, &nmtbcd->nmcd.rc, NppDarkMode::getDarkerBackgroundBrush());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BrowserNodeType FileBrowser::getNodeType(HTREEITEM hItem)
|
||||
|
|
|
@ -654,14 +654,6 @@ void FunctionListPanel::notified(LPNMHDR notification)
|
|||
{
|
||||
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_FUNC_LIST, 0);
|
||||
}
|
||||
else if (notification->code == NM_CUSTOMDRAW && (notification->hwndFrom == _hToolbarMenu))
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(notification);
|
||||
::FillRect(nmtbcd->nmcd.hdc, &nmtbcd->nmcd.rc, NppDarkMode::getDarkerBackgroundBrush());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FunctionListPanel::searchFuncAndSwitchView()
|
||||
|
@ -833,9 +825,6 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
|
|||
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
|
||||
0,0,0,0,_hSelf,nullptr, _hInst, NULL);
|
||||
|
||||
NppDarkMode::setDarkTooltips(_hToolbarMenu, NppDarkMode::ToolTipsType::toolbar);
|
||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||
|
||||
oldFunclstToolbarProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hToolbarMenu, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(funclstToolbarProc)));
|
||||
|
||||
// Add the bmap image into toolbar's imagelist
|
||||
|
@ -912,8 +901,11 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
|
|||
|
||||
_treeView.makeLabelEditable(false);
|
||||
|
||||
|
||||
_treeView.display();
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -921,10 +913,7 @@ intptr_t CALLBACK FunctionListPanel::run_dlgProc(UINT message, WPARAM wParam, LP
|
|||
{
|
||||
if (static_cast<BOOL>(lParam) != TRUE)
|
||||
{
|
||||
NppDarkMode::setDarkTooltips(_hToolbarMenu, NppDarkMode::ToolTipsType::toolbar);
|
||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||
|
||||
NppDarkMode::setDarkTooltips(_treeView.getHSelf(), NppDarkMode::ToolTipsType::treeview);
|
||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||
}
|
||||
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
||||
return TRUE;
|
||||
|
|
|
@ -266,6 +266,9 @@ void PluginsAdminDlg::create(int dialogID, bool isRTL, bool msgDestParent)
|
|||
|
||||
switchDialog(0);
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
goToCenter();
|
||||
}
|
||||
|
||||
|
@ -1103,12 +1106,6 @@ intptr_t CALLBACK PluginsAdminDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||
{
|
||||
switch (message)
|
||||
{
|
||||
case WM_INITDIALOG :
|
||||
{
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_CTLCOLOREDIT:
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
|
@ -1156,11 +1153,6 @@ intptr_t CALLBACK PluginsAdminDlg::run_dlgProc(UINT message, WPARAM wParam, LPAR
|
|||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||
{
|
||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||
|
||||
NppDarkMode::setDarkListView(_availableList.getViewHwnd());
|
||||
NppDarkMode::setDarkListView(_updateList.getViewHwnd());
|
||||
NppDarkMode::setDarkListView(_installedList.getViewHwnd());
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,6 +108,7 @@ STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
|
|||
FONT 8, "MS Shell Dlg", 0, 0, 0x1
|
||||
BEGIN
|
||||
CONTROL "Enable &dark mode",IDC_CHECK_DARKMODE_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,12,150,10
|
||||
CONTROL "Apply dark mode on plugins with docking window (requires Notepad++ restart)",IDC_CHECK_DARKMODE_PLUGIN,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,165,12,270,10
|
||||
GROUPBOX "Tones",IDC_DARKMODE_TONES_GB_STATIC,10,25,440,154,BS_CENTER
|
||||
CONTROL "Black",IDC_RADIO_DARKMODE_BLACK,"Button",BS_AUTORADIOBUTTON | WS_GROUP,15,35,80,10
|
||||
CONTROL "Red",IDC_RADIO_DARKMODE_RED,"Button",BS_AUTORADIOBUTTON ,15,50,80,10
|
||||
|
|
|
@ -1008,6 +1008,7 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
|||
case WM_INITDIALOG:
|
||||
{
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_DARKMODE_ENABLE, BM_SETCHECK, nppGUI._darkmode._isEnabled, 0);
|
||||
::SendDlgItemMessage(_hSelf, IDC_CHECK_DARKMODE_PLUGIN, BM_SETCHECK, nppGUI._darkmode._isEnabledPlugin, 0);
|
||||
|
||||
int id = IDC_RADIO_DARKMODE_BLACK;
|
||||
switch (nppGUI._darkmode._colorTone)
|
||||
|
@ -1210,6 +1211,13 @@ intptr_t CALLBACK DarkModeSubDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
|
|||
}
|
||||
break;
|
||||
|
||||
case IDC_CHECK_DARKMODE_PLUGIN:
|
||||
{
|
||||
bool enableDarkModePlugin = isCheckedOrNot(static_cast<int>(wParam));
|
||||
nppGUI._darkmode._isEnabledPlugin = enableDarkModePlugin;
|
||||
}
|
||||
break;
|
||||
|
||||
case IDC_RADIO_DARKMODE_BLACK:
|
||||
case IDC_RADIO_DARKMODE_RED:
|
||||
case IDC_RADIO_DARKMODE_GREEN:
|
||||
|
|
|
@ -421,4 +421,5 @@
|
|||
#define IDD_CUSTOMIZED_COLOR11_STATIC (IDD_PREFERENCE_SUB_DARKMODE + 26)
|
||||
#define IDD_CUSTOMIZED_RESET_BUTTON (IDD_PREFERENCE_SUB_DARKMODE + 30)
|
||||
#define IDC_DARKMODE_TONES_GB_STATIC (IDD_PREFERENCE_SUB_DARKMODE + 35)
|
||||
#define IDC_CHECK_DARKMODE_PLUGIN (IDD_PREFERENCE_SUB_DARKMODE + 36)
|
||||
#endif //PREFERENCE_RC_H
|
||||
|
|
|
@ -52,9 +52,6 @@ intptr_t CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
_hToolbarMenu = CreateWindowEx(0,TOOLBARCLASSNAME,NULL, style,
|
||||
0,0,0,0,_hSelf, nullptr, _hInst, nullptr);
|
||||
|
||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||
NppDarkMode::disableVisualStyle(_hToolbarMenu, NppDarkMode::isEnabled());
|
||||
|
||||
TBBUTTON tbButtons[2];
|
||||
|
||||
NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
|
||||
|
@ -92,6 +89,9 @@ intptr_t CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
if (!openWorkSpace(_workSpaceFilePath.c_str(), true))
|
||||
newWorkSpace();
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -99,10 +99,7 @@ intptr_t CALLBACK ProjectPanel::run_dlgProc(UINT message, WPARAM wParam, LPARAM
|
|||
{
|
||||
if (static_cast<BOOL>(lParam) != TRUE)
|
||||
{
|
||||
NppDarkMode::setDarkLineAbovePanelToolbar(_hToolbarMenu);
|
||||
NppDarkMode::disableVisualStyle(_hToolbarMenu, NppDarkMode::isEnabled());
|
||||
|
||||
NppDarkMode::setDarkTooltips(_treeView.getHSelf(), NppDarkMode::ToolTipsType::treeview);
|
||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||
}
|
||||
NppDarkMode::setTreeViewStyle(_treeView.getHSelf());
|
||||
return TRUE;
|
||||
|
@ -749,17 +746,6 @@ void ProjectPanel::notified(LPNMHDR notification)
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (notification->code == NM_CUSTOMDRAW && (notification->hwndFrom == _hToolbarMenu))
|
||||
{
|
||||
if (NppDarkMode::isEnabled())
|
||||
{
|
||||
auto nmtbcd = reinterpret_cast<LPNMTBCUSTOMDRAW>(notification);
|
||||
::FillRect(nmtbcd->nmcd.hdc, &nmtbcd->nmcd.rc, NppDarkMode::getDarkerBackgroundBrush());
|
||||
nmtbcd->clrText = NppDarkMode::getTextColor();
|
||||
nmtbcd->clrHighlightHotTrack = NppDarkMode::getHotBackgroundColor();
|
||||
SetWindowLongPtr(_hSelf, DWLP_MSGRESULT, CDRF_NOTIFYITEMDRAW | TBCDRF_HILITEHOTTRACK);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectPanel::setWorkSpaceDirty(bool isDirty)
|
||||
|
|
|
@ -44,7 +44,6 @@ void TreeView::init(HINSTANCE hInst, HWND parent, int treeViewID)
|
|||
nullptr);
|
||||
|
||||
NppDarkMode::setTreeViewStyle(_hSelf);
|
||||
NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::treeview);
|
||||
|
||||
int itemHeight = NppParameters::getInstance()._dpiManager.scaleY(CY_ITEMHEIGHT);
|
||||
TreeView_SetItemHeight(_hSelf, itemHeight);
|
||||
|
|
|
@ -77,13 +77,15 @@ intptr_t CALLBACK VerticalFileSwitcher::run_dlgProc(UINT message, WPARAM wParam,
|
|||
_fileListView.initList();
|
||||
_fileListView.display();
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||
{
|
||||
NppDarkMode::setDarkListView(_fileListView.getHSelf());
|
||||
NppDarkMode::setDarkTooltips(_fileListView.getHSelf(), NppDarkMode::ToolTipsType::listview);
|
||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -51,9 +51,6 @@ void VerticalFileSwitcherListView::init(HINSTANCE hInst, HWND parent, HIMAGELIST
|
|||
throw std::runtime_error("VerticalFileSwitcherListView::init : CreateWindowEx() function return null");
|
||||
}
|
||||
|
||||
NppDarkMode::setDarkListView(_hSelf);
|
||||
NppDarkMode::setDarkTooltips(_hSelf, NppDarkMode::ToolTipsType::listview);
|
||||
|
||||
::SetWindowLongPtr(_hSelf, GWLP_USERDATA, reinterpret_cast<LONG_PTR>(this));
|
||||
_defaultProc = reinterpret_cast<WNDPROC>(::SetWindowLongPtr(_hSelf, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(staticProc)));
|
||||
|
||||
|
@ -80,36 +77,6 @@ void VerticalFileSwitcherListView::destroy()
|
|||
|
||||
LRESULT VerticalFileSwitcherListView::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (Message)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
switch (reinterpret_cast<LPNMHDR>(lParam)->code)
|
||||
{
|
||||
case NM_CUSTOMDRAW:
|
||||
{
|
||||
LPNMCUSTOMDRAW nmcd = reinterpret_cast<LPNMCUSTOMDRAW>(lParam);
|
||||
switch (nmcd->dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
{
|
||||
return CDRF_NOTIFYITEMDRAW;
|
||||
}
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
{
|
||||
bool isDarkModeSupported = NppDarkMode::isEnabled() && NppDarkMode::isExperimentalSupported();
|
||||
SetTextColor(nmcd->hdc, isDarkModeSupported ? NppDarkMode::getDarkerTextColor() : GetSysColor(COLOR_BTNTEXT));
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return ::CallWindowProc(_defaultProc, hwnd, Message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
|
|
@ -272,6 +272,7 @@ intptr_t CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
pNativeSpeaker->changeDlgLang(_hSelf, "Window");
|
||||
|
||||
NppDarkMode::autoSubclassAndThemeChildControls(_hSelf);
|
||||
NppDarkMode::autoSubclassAndThemeWindowNotify(_hSelf);
|
||||
|
||||
return MyBaseClass::run_dlgProc(message, wParam, lParam);
|
||||
}
|
||||
|
@ -297,8 +298,7 @@ intptr_t CALLBACK WindowsDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
|
|||
|
||||
case NPPM_INTERNAL_REFRESHDARKMODE:
|
||||
{
|
||||
NppDarkMode::autoThemeChildControls(getHSelf());
|
||||
NppDarkMode::setDarkListView(_hList);
|
||||
NppDarkMode::autoThemeChildControls(_hSelf);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -584,7 +584,6 @@ BOOL WindowsDlg::onInitDialog()
|
|||
exStyle |= LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER;
|
||||
ListView_SetExtendedListViewStyle(_hList, exStyle);
|
||||
|
||||
NppDarkMode::setDarkListView(_hList);
|
||||
COLORREF fgColor = (NppParameters::getInstance()).getCurrentDefaultFgColor();
|
||||
COLORREF bgColor = (NppParameters::getInstance()).getCurrentDefaultBgColor();
|
||||
|
||||
|
@ -1115,36 +1114,6 @@ Buffer* WindowsDlg::getBuffer(int index) const
|
|||
|
||||
LRESULT CALLBACK WindowsDlg::listViewProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (Message)
|
||||
{
|
||||
case WM_NOTIFY:
|
||||
{
|
||||
switch (reinterpret_cast<LPNMHDR>(lParam)->code)
|
||||
{
|
||||
case NM_CUSTOMDRAW:
|
||||
{
|
||||
LPNMCUSTOMDRAW nmcd = reinterpret_cast<LPNMCUSTOMDRAW>(lParam);
|
||||
switch (nmcd->dwDrawStage)
|
||||
{
|
||||
case CDDS_PREPAINT:
|
||||
{
|
||||
return CDRF_NOTIFYITEMDRAW;
|
||||
}
|
||||
|
||||
case CDDS_ITEMPREPAINT:
|
||||
{
|
||||
bool isDarkModeSupported = NppDarkMode::isEnabled() && NppDarkMode::isExperimentalSupported();
|
||||
::SetTextColor(nmcd->hdc, isDarkModeSupported ? NppDarkMode::getDarkerTextColor() : GetSysColor(COLOR_BTNTEXT));
|
||||
return CDRF_DODEFAULT;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
return CallWindowProc(reinterpret_cast<WNDPROC>(originalListViewProc), hwnd, Message, wParam, lParam);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue