diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index b8ca194ef..5fb6bbde8 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -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(_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(_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(_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 & 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 & 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((*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(_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(_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 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); diff --git a/PowerEditor/src/Notepad_plus.h b/PowerEditor/src/Notepad_plus.h index ca893fcb5..21544834e 100644 --- a/PowerEditor/src/Notepad_plus.h +++ b/PowerEditor/src/Notepad_plus.h @@ -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& commandIds); BOOL notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId); BOOL notifyTBShowMenu(LPNMTOOLBARW lpnmtb, const char* menuPosId, const std::vector& cmdIDs); + + int getIcoID(DockingDlgInterface* panel); + void loadPanelIcon(HINSTANCE hInst, DockingDlgInterface* panel, HICON* phIcon); + void refreshPanelIcon(HINSTANCE hInst, DockingDlgInterface* panel); }; diff --git a/PowerEditor/src/NppBigSwitch.cpp b/PowerEditor/src/NppBigSwitch.cpp index df05dcff8..75902690b 100644 --- a/PowerEditor/src/NppBigSwitch.cpp +++ b/PowerEditor/src/NppBigSwitch.cpp @@ -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(lParam); diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp index 75e51f066..2f49c83e1 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp @@ -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(_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(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); diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h index a63e9ecfb..bf7c932e2 100644 --- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h +++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h @@ -403,6 +403,14 @@ public : } }; + Finder* getMainFinder() const { + return _pFinder; + } + + const std::vector& 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""); diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp index 18a7ed987..8f86e4790 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp +++ b/PowerEditor/src/WinControls/DockingWnd/DockingCont.cpp @@ -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) diff --git a/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h b/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h index 071bc931f..e2b47cb74 100644 --- a/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h +++ b/PowerEditor/src/WinControls/DockingWnd/DockingDlgInterface.h @@ -20,6 +20,7 @@ #include "dockingResource.h" #include "Docking.h" +#include #include #include #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 iconIDs, bool isRTL = false) { + create(data, isRTL); + _iconIDs = iconIDs; } virtual void updateDockingDlg() { @@ -82,12 +88,17 @@ public: return _moduleName.c_str(); } + const std::array& getIconIDs() const { + return _iconIDs; + } + protected : int _dlgID = -1; - bool _isFloating = true; int _iDockedPos = 0; std::wstring _moduleName; std::wstring _pluginName; + std::array _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(wParam), &rc, NppDarkMode::getDlgBackgroundBrush()); return TRUE; } - case WM_NOTIFY: + case WM_NOTIFY: { - LPNMHDR pnmh = reinterpret_cast(lParam); + auto* pnmh = reinterpret_cast(lParam); if (pnmh->hwndFrom == _hParent) { diff --git a/PowerEditor/src/WinControls/DocumentMap/documentMap.h b/PowerEditor/src/WinControls/DocumentMap/documentMap.h index 8f559dcdb..94fdea6f2 100644 --- a/PowerEditor/src/WinControls/DocumentMap/documentMap.h +++ b/PowerEditor/src/WinControls/DocumentMap/documentMap.h @@ -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,26 +96,31 @@ 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 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 { - DockingDlgInterface::display(toShow); + 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; - }; + void setParent(HWND parent2set){ + _hParent = parent2set; + }; void vzDlgDisplay(bool toShow = true) { _vzDlg.display(toShow); @@ -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: diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp index cf0894d04..5aa098909 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.cpp @@ -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! diff --git a/PowerEditor/src/WinControls/ToolBar/ToolBar.h b/PowerEditor/src/WinControls/ToolBar/ToolBar.h index f13ccf6ec..40ec2a35d 100644 --- a/PowerEditor/src/WinControls/ToolBar/ToolBar.h +++ b/PowerEditor/src/WinControls/ToolBar/ToolBar.h @@ -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(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); diff --git a/PowerEditor/src/resource.h b/PowerEditor/src/resource.h index c1d4606a7..e12adc4f4 100644 --- a/PowerEditor/src/resource.h +++ b/PowerEditor/src/resource.h @@ -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)