Fix changing toolbar icon set not change to matched panel icon set issue

Synchronize dockable panel tab icons with toolbar icons.

Fix #16595, close #16556
This commit is contained in:
ozone10 2025-05-16 19:13:53 +02:00 committed by Don Ho
parent 8bc77857a7
commit 19a1897eaa
11 changed files with 180 additions and 112 deletions

View File

@ -7285,20 +7285,13 @@ void Notepad_plus::launchClipboardHistoryPanel()
NativeLangSpeaker *pNativeSpeaker = nppParams.getNativeLangSpeaker();
bool isRTL = pNativeSpeaker->isRTL();
tTbData data{};
_pClipboardHistoryPanel->create(&data, isRTL);
_pClipboardHistoryPanel->create(&data, { IDR_CLIPBOARDPANEL_ICO, IDR_CLIPBOARDPANEL_ICO_DM, IDR_CLIPBOARDPANEL_ICO2 }, isRTL);
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pClipboardHistoryPanel->getHSelf()));
// define the default docking behaviour
data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
int icoID = IDR_CLIPBOARDPANEL_ICO2;
if (nppParams.getNppGUI()._tbIconInfo._tbIconSet == TB_STANDARD)
icoID = IDR_CLIPBOARDPANEL_ICO;
else if (NppDarkMode::isEnabled())
icoID = IDR_CLIPBOARDPANEL_ICO_DM;
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, _pClipboardHistoryPanel->getHSelf());
DPIManagerV2::loadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(icoID), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
loadPanelIcon(_pPublicInterface->getHinst(), _pClipboardHistoryPanel, &data.hIconTab);
data.pszModuleName = NPP_INTERNAL_FUNCTION_STR;
@ -7349,20 +7342,13 @@ void Notepad_plus::launchDocumentListPanel(bool changeFromBtnCmd)
NativeLangSpeaker *pNativeSpeaker = nppParams.getNativeLangSpeaker();
bool isRTL = pNativeSpeaker->isRTL();
tTbData data{};
_pDocumentListPanel->create(&data, isRTL);
_pDocumentListPanel->create(&data, { IDR_DOCLIST_ICO, IDR_DOCLIST_ICO_DM, IDR_DOCLIST_ICO2 }, isRTL);
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pDocumentListPanel->getHSelf()));
// define the default docking behaviour
data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
int icoID = IDR_DOCLIST_ICO2;
if (nppParams.getNppGUI()._tbIconInfo._tbIconSet == TB_STANDARD)
icoID = IDR_DOCLIST_ICO;
else if (NppDarkMode::isEnabled())
icoID = IDR_DOCLIST_ICO_DM;
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, _pDocumentListPanel->getHSelf());
DPIManagerV2::loadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(icoID), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
loadPanelIcon(_pPublicInterface->getHinst(), _pDocumentListPanel, &data.hIconTab);
data.pszModuleName = NPP_INTERNAL_FUNCTION_STR;
@ -7437,20 +7423,13 @@ void Notepad_plus::launchAnsiCharPanel()
NativeLangSpeaker *pNativeSpeaker = nppParams.getNativeLangSpeaker();
bool isRTL = pNativeSpeaker->isRTL();
tTbData data{};
_pAnsiCharPanel->create(&data, isRTL);
_pAnsiCharPanel->create(&data, { IDR_ASCIIPANEL_ICO, IDR_ASCIIPANEL_ICO_DM, IDR_ASCIIPANEL_ICO2 }, isRTL);
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pAnsiCharPanel->getHSelf()));
// define the default docking behaviour
data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
int icoID = IDR_ASCIIPANEL_ICO2;
if (nppParams.getNppGUI()._tbIconInfo._tbIconSet == TB_STANDARD)
icoID = IDR_ASCIIPANEL_ICO;
else if (NppDarkMode::isEnabled())
icoID = IDR_ASCIIPANEL_ICO_DM;
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, _pAnsiCharPanel->getHSelf());
DPIManagerV2::loadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(icoID), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
loadPanelIcon(_pPublicInterface->getHinst(), _pAnsiCharPanel, &data.hIconTab);
data.pszModuleName = NPP_INTERNAL_FUNCTION_STR;
@ -7486,7 +7465,7 @@ void Notepad_plus::launchFileBrowser(const vector<wstring> & folders, const wstr
_pFileBrowser->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf());
tTbData data{};
_pFileBrowser->create(&data, _nativeLangSpeaker.isRTL());
_pFileBrowser->create(&data, { IDR_FILEBROWSER_ICO, IDR_FILEBROWSER_ICO_DM, IDR_FILEBROWSER_ICO2 }, _nativeLangSpeaker.isRTL());
data.pszName = L"ST";
NppParameters& nppParams = NppParameters::getInstance();
@ -7495,14 +7474,7 @@ void Notepad_plus::launchFileBrowser(const vector<wstring> & folders, const wstr
// define the default docking behaviour
data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
int icoID = IDR_FILEBROWSER_ICO2;
if (nppParams.getNppGUI()._tbIconInfo._tbIconSet == TB_STANDARD)
icoID = IDR_FILEBROWSER_ICO;
else if (NppDarkMode::isEnabled())
icoID = IDR_FILEBROWSER_ICO_DM;
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, _pFileBrowser->getHSelf());
DPIManagerV2::loadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(icoID), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
loadPanelIcon(_pPublicInterface->getHinst(), _pFileBrowser, &data.hIconTab);
data.pszModuleName = NPP_INTERNAL_FUNCTION_STR;
@ -7598,21 +7570,14 @@ void Notepad_plus::launchProjectPanel(int cmdID, ProjectPanel ** pProjPanel, int
NativeLangSpeaker *pNativeSpeaker = nppParam.getNativeLangSpeaker();
bool isRTL = pNativeSpeaker->isRTL();
tTbData data{};
(*pProjPanel)->create(&data, isRTL);
(*pProjPanel)->create(&data, { IDR_PROJECTPANEL_ICO, IDR_PROJECTPANEL_ICO_DM, IDR_PROJECTPANEL_ICO2 }, isRTL);
data.pszName = L"ST";
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>((*pProjPanel)->getHSelf()));
// define the default docking behaviour
data.uMask = DWS_DF_CONT_LEFT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
int icoID = IDR_PROJECTPANEL_ICO2;
if (nppParam.getNppGUI()._tbIconInfo._tbIconSet == TB_STANDARD)
icoID = IDR_PROJECTPANEL_ICO;
else if (NppDarkMode::isEnabled())
icoID = IDR_PROJECTPANEL_ICO_DM;
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, (*pProjPanel)->getHSelf());
DPIManagerV2::loadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(icoID), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
loadPanelIcon(_pPublicInterface->getHinst(), (*pProjPanel), &data.hIconTab);
data.pszModuleName = NPP_INTERNAL_FUNCTION_STR;
@ -7665,20 +7630,13 @@ void Notepad_plus::launchDocMap()
_pDocMap->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), &_pEditView);
tTbData data{};
_pDocMap->create(&data);
_pDocMap->create(&data, { IDR_DOCMAP_ICO, IDR_DOCMAP_ICO_DM, IDR_DOCMAP_ICO2 });
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pDocMap->getHSelf()));
// define the default docking behaviour
data.uMask = DWS_DF_CONT_RIGHT | DWS_ICONTAB | DWS_USEOWNDARKMODE;
int icoID = IDR_DOCMAP_ICO2;
if (nppParam.getNppGUI()._tbIconInfo._tbIconSet == TB_STANDARD)
icoID = IDR_DOCMAP_ICO;
else if (NppDarkMode::isEnabled())
icoID = IDR_DOCMAP_ICO_DM;
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, _pDocMap->getHSelf());
DPIManagerV2::loadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(icoID), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
loadPanelIcon(_pPublicInterface->getHinst(), _pDocMap, &data.hIconTab);
data.pszModuleName = NPP_INTERNAL_FUNCTION_STR;
@ -7714,7 +7672,7 @@ void Notepad_plus::launchFunctionList()
_pFuncList->init(_pPublicInterface->getHinst(), _pPublicInterface->getHSelf(), &_pEditView);
tTbData data{};
_pFuncList->create(&data);
_pFuncList->create(&data, { IDR_FUNC_LIST_ICO, IDR_FUNC_LIST_ICO_DM, IDR_FUNC_LIST_ICO2 });
::SendMessage(_pPublicInterface->getHSelf(), NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, reinterpret_cast<LPARAM>(_pFuncList->getHSelf()));
// define the default docking behaviour
@ -7722,14 +7680,7 @@ void Notepad_plus::launchFunctionList()
NppParameters& nppParam = NppParameters::getInstance();
int icoID = IDR_FUNC_LIST_ICO2;
if (nppParam.getNppGUI()._tbIconInfo._tbIconSet == TB_STANDARD)
icoID = IDR_FUNC_LIST_ICO;
else if (NppDarkMode::isEnabled())
icoID = IDR_FUNC_LIST_ICO_DM;
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, _pFuncList->getHSelf());
DPIManagerV2::loadIcon(_pPublicInterface->getHinst(), MAKEINTRESOURCE(icoID), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
loadPanelIcon(_pPublicInterface->getHinst(), _pFuncList, &data.hIconTab);
data.pszModuleName = NPP_INTERNAL_FUNCTION_STR;
@ -8641,6 +8592,81 @@ void Notepad_plus::refreshDarkMode(bool resetStyle)
}
}
int Notepad_plus::getIcoID(DockingDlgInterface* panel)
{
if (_toolBar.getState() == TB_STANDARD)
return panel->getIconIDs().at(0);
if (NppDarkMode::isEnabled())
return panel->getIconIDs().at(1);
return panel->getIconIDs().at(2);
}
void Notepad_plus::loadPanelIcon(HINSTANCE hInst, DockingDlgInterface* panel, HICON* phIcon)
{
const int icoID = getIcoID(panel);
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, panel->getHSelf());
DPIManagerV2::loadIcon(hInst, MAKEINTRESOURCE(icoID), iconSize, iconSize, phIcon, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
}
void Notepad_plus::refreshPanelIcon(HINSTANCE hInst, DockingDlgInterface* panel)
{
HWND hWnd = panel->getHSelf();
for (const auto& docCont : _dockingManager.getContainerInfo())
{
auto data = docCont->findToolbarByWnd(hWnd);
if (data != nullptr)
{
if (data->hIconTab != nullptr)
{
::DestroyIcon(data->hIconTab);
data->hIconTab = nullptr;
}
loadPanelIcon(hInst, panel, &data->hIconTab);
break;
}
}
}
void Notepad_plus::refreshInternalPanelIcons()
{
std::array<DockingDlgInterface*, 9> internalPanels = { _pProjectPanel_1, _pProjectPanel_2, _pProjectPanel_3,
_pFuncList, _pDocMap, _pFileBrowser,
_pAnsiCharPanel, _pDocumentListPanel, _pClipboardHistoryPanel };
for (const auto& panel : internalPanels)
{
if (panel != nullptr)
{
refreshPanelIcon(_pPublicInterface->getHinst(), panel);
}
}
const auto mainFinder = _findReplaceDlg.getMainFinder();
if (mainFinder != nullptr)
{
refreshPanelIcon(_pPublicInterface->getHinst(), mainFinder);
const auto& finders = _findReplaceDlg.getFindersOfFinder();
if (!finders.empty())
{
for (const auto& finder : finders)
{
if (finder != nullptr)
{
refreshPanelIcon(_pPublicInterface->getHinst(), finder);
}
}
}
}
for (const auto& docCont : _dockingManager.getContainerInfo())
{
auto hTab = docCont->getTabWnd();
::RedrawWindow(hTab, nullptr, nullptr, RDW_INVALIDATE | RDW_ERASE);
}
}
void Notepad_plus::launchDocumentBackupTask()
{
HANDLE hThread = ::CreateThread(NULL, 0, backupDocument, NULL, 0, NULL);

View File

@ -273,6 +273,8 @@ public:
void refreshDarkMode(bool resetStyle = false);
void refreshInternalPanelIcons();
private:
Notepad_plus_Window* _pPublicInterface = nullptr;
Window* _pMainWindow = nullptr;
@ -662,4 +664,8 @@ private:
HMENU createMenuFromMenu(HMENU hSourceMenu, const std::vector<int>& commandIds);
BOOL notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId);
BOOL notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId, const std::vector<int>& cmdIDs);
int getIcoID(DockingDlgInterface* panel);
void loadPanelIcon(HINSTANCE hInst, DockingDlgInterface* panel, HICON* phIcon);
void refreshPanelIcon(HINSTANCE hInst, DockingDlgInterface* panel);
};

View File

@ -374,6 +374,18 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
return TRUE;
}
case NPPM_INTERNAL_TOOLBARICONSCHANGED:
{
refreshInternalPanelIcons();
// Notify plugins that toolbar icons have changed TODO
//SCNotification scnN{};
//scnN.nmhdr.code = ;
//scnN.nmhdr.hwndFrom = hwnd;
//scnN.nmhdr.idFrom = 0;
//_pluginsManager.notify(&scnN);
return TRUE;
}
case WM_DRAWITEM:
{
DRAWITEMSTRUCT *dis = reinterpret_cast<DRAWITEMSTRUCT *>(lParam);

View File

@ -3632,16 +3632,16 @@ void FindReplaceDlg::findAllIn(InWhat op)
_pFinder->setVolatiled(false);
tTbData data{};
_pFinder->create(&data);
_pFinder->create(&data, { IDI_FIND_RESULT_ICON, IDR_FIND_RESULT_ICO_DM, IDR_FIND_RESULT_ICO2 });
::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 | DWS_USEOWNDARKMODE;
int icoID = IDR_FIND_RESULT_ICO2;
int icoID = _pFinder->getIconIDs().at(2);
if (nppParam.getNppGUI()._tbIconInfo._tbIconSet == TB_STANDARD)
icoID = IDI_FIND_RESULT_ICON;
icoID = _pFinder->getIconIDs().at(0);
else if (NppDarkMode::isEnabled())
icoID = IDR_FIND_RESULT_ICO_DM;
icoID = _pFinder->getIconIDs().at(1);
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, _pFinder->getHSelf());
DPIManagerV2::loadIcon(_hInst, MAKEINTRESOURCE(icoID), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);
@ -3780,16 +3780,16 @@ Finder* FindReplaceDlg::createFinder()
tTbData data{};
bool isRTL = _pFinder->_scintView.isTextDirectionRTL();
pFinder->create(&data, isRTL);
pFinder->create(&data, { IDI_FIND_RESULT_ICON, IDR_FIND_RESULT_ICO_DM, IDR_FIND_RESULT_ICO2 }, 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 | DWS_USEOWNDARKMODE;
int icoID = IDR_FIND_RESULT_ICO2;
int icoID = pFinder->getIconIDs().at(2);
if (nppParam.getNppGUI()._tbIconInfo._tbIconSet == TB_STANDARD)
icoID = IDI_FIND_RESULT_ICON;
icoID = pFinder->getIconIDs().at(0);
else if (NppDarkMode::isEnabled())
icoID = IDR_FIND_RESULT_ICO_DM;
icoID = pFinder->getIconIDs().at(1);
const int iconSize = DPIManagerV2::scale(g_dockingContTabIconSize, _pFinder->getHSelf());
DPIManagerV2::loadIcon(_hInst, MAKEINTRESOURCE(icoID), iconSize, iconSize, &data.hIconTab, LR_LOADMAP3DCOLORS | LR_LOADTRANSPARENT);

View File

@ -403,6 +403,14 @@ public :
}
};
Finder* getMainFinder() const {
return _pFinder;
}
const std::vector<Finder*>& getFindersOfFinder() const {
return _findersOfFinder;
}
void execSavedCommand(int cmd, uptr_t intValue, const std::wstring& stringValue);
void clearMarks(const FindOption& opt);
void setStatusbarMessage(const std::wstring & msg, FindStatus status, const std::wstring& tooltipMsg = L"");

View File

@ -156,20 +156,15 @@ void DockingCont::removeToolbar(const tTbData& data)
}
}
tTbData* DockingCont::findToolbarByWnd(HWND hClient)
{
tTbData* pTbData = NULL;
auto matchesWnd = [hClient](const tTbData* pTb) -> bool {
return pTb->hClient == hClient;
};
// find entry by handle
for (size_t iTb = 0, len = _vTbData.size(); iTb < len; ++iTb)
{
if (hClient == _vTbData[iTb]->hClient)
{
pTbData = _vTbData[iTb];
}
}
return pTbData;
auto it = std::find_if(_vTbData.begin(), _vTbData.end(), matchesWnd);
return (it != _vTbData.end()) ? *it : nullptr;
}
tTbData* DockingCont::findToolbarByName(wchar_t* pszName)

View File

@ -20,6 +20,7 @@
#include "dockingResource.h"
#include "Docking.h"
#include <array>
#include <assert.h>
#include <shlwapi.h>
#include "Common.h"
@ -41,7 +42,7 @@ public:
_moduleName = ::PathFindFileName(temp);
}
void create(tTbData* data, bool isRTL = false) {
virtual void create(tTbData* data, bool isRTL = false) {
assert(data != nullptr);
StaticDialog::create(_dlgID, isRTL);
wchar_t temp[MAX_PATH];
@ -56,7 +57,12 @@ public:
data->uMask = 0;
// additional info
data->pszAddInfo = NULL;
data->pszAddInfo = nullptr;
}
virtual void create(tTbData* data, std::array<int, 3> iconIDs, bool isRTL = false) {
create(data, isRTL);
_iconIDs = iconIDs;
}
virtual void updateDockingDlg() {
@ -82,12 +88,17 @@ public:
return _moduleName.c_str();
}
const std::array<int, 3>& getIconIDs() const {
return _iconIDs;
}
protected :
int _dlgID = -1;
bool _isFloating = true;
int _iDockedPos = 0;
std::wstring _moduleName;
std::wstring _pluginName;
std::array<int, 3> _iconIDs{};
bool _isFloating = true;
bool _isClosed = false;
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override {
@ -100,14 +111,14 @@ protected :
break;
}
RECT rc = {};
RECT rc{};
getClientRect(rc);
::FillRect(reinterpret_cast<HDC>(wParam), &rc, NppDarkMode::getDlgBackgroundBrush());
return TRUE;
}
case WM_NOTIFY:
{
LPNMHDR pnmh = reinterpret_cast<LPNMHDR>(lParam);
auto* pnmh = reinterpret_cast<LPNMHDR>(lParam);
if (pnmh->hwndFrom == _hParent)
{

View File

@ -44,7 +44,7 @@ enum moveMode {
class ViewZoneDlg : public StaticDialog
{
public :
ViewZoneDlg() : StaticDialog(), _viewZoneCanvas(NULL), _canvasDefaultProc(nullptr), _higherY(0), _lowerY(0) {}
ViewZoneDlg() : StaticDialog(), _viewZoneCanvas(nullptr), _canvasDefaultProc(nullptr), _higherY(0), _lowerY(0) {}
enum class ViewZoneColorIndex {
focus,
@ -53,13 +53,13 @@ public :
void doDialog();
virtual void destroy() {};
void destroy() override {};
void drawZone(long hY, long lY) {
_higherY = hY;
_lowerY = lY;
if (NULL != _viewZoneCanvas)
::InvalidateRect(_viewZoneCanvas, NULL, TRUE);
if (nullptr != _viewZoneCanvas)
::InvalidateRect(_viewZoneCanvas, nullptr, TRUE);
};
int getViewerHeight() const {
@ -73,7 +73,7 @@ public :
static void setColour(COLORREF colour2Set, ViewZoneColorIndex i);
protected :
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
static LRESULT CALLBACK canvasStaticProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
LRESULT CALLBACK canvas_runProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);
@ -96,22 +96,27 @@ class DocumentMap : public DockingDlgInterface {
public:
DocumentMap(): DockingDlgInterface(IDD_DOCUMENTMAP) {};
void create(tTbData * data, bool isRTL = false) {
void create(tTbData * data, bool isRTL = false) override {
DockingDlgInterface::create(data, isRTL);
data->pszAddInfo = id4dockingCont.c_str();
};
void create(tTbData* data, std::array<int, 3> iconIDs, bool isRTL = false) override {
DockingDlgInterface::create(data, iconIDs, isRTL);
data->pszAddInfo = id4dockingCont.c_str();
};
void init(HINSTANCE hInst, HWND hPere, ScintillaEditView **ppEditView) {
DockingDlgInterface::init(hInst, hPere);
_ppEditView = ppEditView;
};
virtual void display(bool toShow = true) const {
void display(bool toShow = true) const override {
DockingDlgInterface::display(toShow);
_vzDlg.display();
};
virtual void redraw(bool forceUpdate = false) const;
void redraw(bool forceUpdate = false) const override;
void setParent(HWND parent2set){
_hParent = parent2set;
@ -137,7 +142,7 @@ public:
void setTemporarilyShowing(bool tempShowing) { _isTemporarilyShowing = tempShowing; }
protected:
virtual intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam);
intptr_t CALLBACK run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) override;
bool needToRecomputeWith(const ScintillaEditView *editView = nullptr);
private:

View File

@ -509,6 +509,13 @@ void ToolBar::reset(bool create)
}
}
void ToolBar::setState(toolBarStatusType state)
{
_state = state;
HWND hRoot = ::GetAncestor(_hSelf, GA_ROOTOWNER);
::SendMessage(hRoot, NPPM_INTERNAL_TOOLBARICONSCHANGED, 0, 0);
}
void ToolBar::registerDynBtn(UINT messageID, toolbarIcons* iconHandles, HICON absentIco)
{
// Note: Register of buttons only possible before init!

View File

@ -64,13 +64,13 @@ public :
virtual bool init(HINSTANCE hInst, HWND hPere, toolBarStatusType type, ToolBarButtonUnit* buttonUnitArray, int arraySize);
virtual void destroy();
void destroy() override;
void enable(int cmdID, bool doEnable) const {
::SendMessage(_hSelf, TB_ENABLEBUTTON, cmdID, static_cast<LPARAM>(doEnable));
};
int getWidth() const;
int getHeight() const;
int getWidth() const override;
int getHeight() const override;
void reduce();
void enlarge();
@ -163,10 +163,7 @@ private :
};
void reset(bool create = false);
void setState(toolBarStatusType state) {
_state = state;
}
void setState(toolBarStatusType state);
};
class ReBar : public Window
@ -174,13 +171,13 @@ class ReBar : public Window
public :
ReBar():Window() { usedIDs.clear(); };
virtual void destroy() {
void destroy() override {
::DestroyWindow(_hSelf);
_hSelf = NULL;
_hSelf = nullptr;
usedIDs.clear();
};
void init(HINSTANCE hInst, HWND hPere);
void init(HINSTANCE hInst, HWND hPere) override;
bool addBand(REBARBANDINFO * rBand, bool useID); //useID true if ID from info should be used (false for plugins). wID in bandinfo will be set to used ID
void reNew(int id, REBARBANDINFO * rBand); //wID from bandinfo is used for update
void removeBand(int id);

View File

@ -748,6 +748,7 @@
#define NPPM_INTERNAL_HIDEMENURIGHTSHORTCUTS (NOTEPADPLUS_USER_INTERNAL + 107)
#define NPPM_INTERNAL_CHANGETOOLBARCOLORABLESTATE (NOTEPADPLUS_USER_INTERNAL + 108)
#define NPPM_INTERNAL_SQLBACKSLASHESCAPE (NOTEPADPLUS_USER_INTERNAL + 109)
#define NPPM_INTERNAL_TOOLBARICONSCHANGED (NOTEPADPLUS_USER_INTERNAL + 110)
// See Notepad_plus_msgs.h
//#define NPPMSG (WM_USER + 1000)