mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-24 06:14:47 +02:00
Fix wrong plugin toolbar icon display if the ICO format is absent
An empty icon will be displayed after this fix.
This commit is contained in:
parent
f7a04caca7
commit
46b3e3c7b2
@ -90,6 +90,8 @@ void Notepad_plus_Window::init(HINSTANCE hInst, HWND parent, const TCHAR *cmdLin
|
|||||||
|
|
||||||
nppGUI._isCmdlineNosessionActivated = cmdLineParams->_isNoSession;
|
nppGUI._isCmdlineNosessionActivated = cmdLineParams->_isNoSession;
|
||||||
|
|
||||||
|
_hIconAbsent = ::LoadIcon(hInst, MAKEINTRESOURCE(IDI_ICONABSENT));
|
||||||
|
|
||||||
_hSelf = ::CreateWindowEx(
|
_hSelf = ::CreateWindowEx(
|
||||||
WS_EX_ACCEPTFILES | (_notepad_plus_plus_core._nativeLangSpeaker.isRTL()?WS_EX_LAYOUTRTL:0),
|
WS_EX_ACCEPTFILES | (_notepad_plus_plus_core._nativeLangSpeaker.isRTL()?WS_EX_LAYOUTRTL:0),
|
||||||
_className,
|
_className,
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include "Notepad_plus.h"
|
#include "Notepad_plus.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
|
const TCHAR COMMAND_ARG_HELP[] = TEXT("Usage :\r\
|
||||||
\r\
|
\r\
|
||||||
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qn=\"Easter egg name\" | -qt=\"a text to display.\" | -qf=\"D:\\my quote.txt\"] [-qSpeed1|2|3] [-quickPrint] [-settingsDir=\"d:\\your settings dir\\\"] [-openFoldersAsWorkspace] [-titleAdd=\"additional title bar text\"][filePath]\r\
|
notepad++ [--help] [-multiInst] [-noPlugin] [-lLanguage] [-LlangCode] [-nLineNumber] [-cColumnNumber] [-pPosition] [-xLeftPos] [-yTopPos] [-nosession] [-notabbar] [-ro] [-systemtray] [-loadingTime] [-alwaysOnTop] [-openSession] [-r] [-qn=\"Easter egg name\" | -qt=\"a text to display.\" | -qf=\"D:\\my quote.txt\"] [-qSpeed1|2|3] [-quickPrint] [-settingsDir=\"d:\\your settings dir\\\"] [-openFoldersAsWorkspace] [-titleAdd=\"additional title bar text\"][filePath]\r\
|
||||||
@ -53,9 +51,6 @@ filePath : file or folder name to open (absolute or relative path name)\r\
|
|||||||
");
|
");
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Notepad_plus_Window : public Window
|
class Notepad_plus_Window : public Window
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -63,40 +58,39 @@ public:
|
|||||||
|
|
||||||
bool isDlgsMsg(MSG *msg) const;
|
bool isDlgsMsg(MSG *msg) const;
|
||||||
|
|
||||||
HACCEL getAccTable() const
|
HACCEL getAccTable() const {
|
||||||
{
|
|
||||||
return _notepad_plus_plus_core.getAccTable();
|
return _notepad_plus_plus_core.getAccTable();
|
||||||
}
|
};
|
||||||
|
|
||||||
bool emergency(const generic_string& emergencySavedDir)
|
bool emergency(const generic_string& emergencySavedDir) {
|
||||||
{
|
|
||||||
return _notepad_plus_plus_core.emergency(emergencySavedDir);
|
return _notepad_plus_plus_core.emergency(emergencySavedDir);
|
||||||
}
|
};
|
||||||
|
|
||||||
bool isPrelaunch() const
|
bool isPrelaunch() const {
|
||||||
{
|
|
||||||
return _isPrelaunch;
|
return _isPrelaunch;
|
||||||
}
|
};
|
||||||
|
|
||||||
void setIsPrelaunch(bool val)
|
void setIsPrelaunch(bool val) {
|
||||||
{
|
|
||||||
_isPrelaunch = val;
|
_isPrelaunch = val;
|
||||||
}
|
};
|
||||||
|
|
||||||
generic_string getPluginListVerStr() const
|
generic_string getPluginListVerStr() const {
|
||||||
{
|
|
||||||
return _notepad_plus_plus_core.getPluginListVerStr();
|
return _notepad_plus_plus_core.getPluginListVerStr();
|
||||||
}
|
};
|
||||||
|
|
||||||
virtual void destroy()
|
virtual void destroy() {
|
||||||
{
|
if (_hIconAbsent)
|
||||||
|
::DestroyIcon(_hIconAbsent);
|
||||||
::DestroyWindow(_hSelf);
|
::DestroyWindow(_hSelf);
|
||||||
}
|
};
|
||||||
|
|
||||||
static const TCHAR * getClassName()
|
static const TCHAR * getClassName() {
|
||||||
{
|
|
||||||
return _className;
|
return _className;
|
||||||
}
|
};
|
||||||
|
|
||||||
|
HICON getAbsentIcoHandle() {
|
||||||
|
return _hIconAbsent;
|
||||||
|
};
|
||||||
|
|
||||||
static HWND gNppHWND; //static handle to Notepad++ window, NULL if non-existant
|
static HWND gNppHWND; //static handle to Notepad++ window, NULL if non-existant
|
||||||
|
|
||||||
@ -112,4 +106,6 @@ private:
|
|||||||
|
|
||||||
QuoteParams _quoteParams; // keep the availability of quote parameters for thread using
|
QuoteParams _quoteParams; // keep the availability of quote parameters for thread using
|
||||||
std::wstring _userQuote; // keep the availability of this string for thread using
|
std::wstring _userQuote; // keep the availability of this string for thread using
|
||||||
|
|
||||||
|
HICON _hIconAbsent = nullptr;
|
||||||
};
|
};
|
||||||
|
@ -2157,7 +2157,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
|
|||||||
|
|
||||||
case NPPM_ADDTOOLBARICON:
|
case NPPM_ADDTOOLBARICON:
|
||||||
{
|
{
|
||||||
_toolBar.registerDynBtn(static_cast<UINT>(wParam), reinterpret_cast<toolbarIcons*>(lParam));
|
_toolBar.registerDynBtn(static_cast<UINT>(wParam), reinterpret_cast<toolbarIcons*>(lParam), _pPublicInterface->getAbsentIcoHandle());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -648,7 +648,8 @@ void Gripper::drawRectangle(const POINT* pPt)
|
|||||||
_hdc = NULL;
|
_hdc = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else _bPtOldValid= TRUE;
|
else
|
||||||
|
_bPtOldValid = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -25,16 +25,6 @@
|
|||||||
|
|
||||||
const int WS_TOOLBARSTYLE = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS |TBSTYLE_FLAT | CCS_TOP | BTNS_AUTOSIZE | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_NODIVIDER;
|
const int WS_TOOLBARSTYLE = WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS | TBSTYLE_TOOLTIPS |TBSTYLE_FLAT | CCS_TOP | BTNS_AUTOSIZE | CCS_NOPARENTALIGN | CCS_NORESIZE | CCS_NODIVIDER;
|
||||||
|
|
||||||
ToolBar::ToolBar()
|
|
||||||
{
|
|
||||||
_hIconAbsent = (HICON)::LoadImage(_hInst, MAKEINTRESOURCE(IDI_ICONABSENT), IMAGE_ICON, 16, 16, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ToolBar::~ToolBar()
|
|
||||||
{
|
|
||||||
::DestroyIcon(_hIconAbsent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ToolBar::initTheme(TiXmlDocument *toolIconsDocRoot)
|
void ToolBar::initTheme(TiXmlDocument *toolIconsDocRoot)
|
||||||
{
|
{
|
||||||
_toolIcons = toolIconsDocRoot->FirstChild(TEXT("NotepadPlus"));
|
_toolIcons = toolIconsDocRoot->FirstChild(TEXT("NotepadPlus"));
|
||||||
@ -382,7 +372,7 @@ void ToolBar::reset(bool create)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolBar::registerDynBtn(UINT messageID, toolbarIcons* tIcon)
|
void ToolBar::registerDynBtn(UINT messageID, toolbarIcons* tIcon, HICON absentIco)
|
||||||
{
|
{
|
||||||
// Note: Register of buttons only possible before init!
|
// Note: Register of buttons only possible before init!
|
||||||
if ((_hSelf == NULL) && (messageID != 0) && (tIcon->hToolbarBmp != NULL))
|
if ((_hSelf == NULL) && (messageID != 0) && (tIcon->hToolbarBmp != NULL))
|
||||||
@ -390,7 +380,7 @@ void ToolBar::registerDynBtn(UINT messageID, toolbarIcons* tIcon)
|
|||||||
DynamicCmdIcoBmp dynList;
|
DynamicCmdIcoBmp dynList;
|
||||||
dynList._message = messageID;
|
dynList._message = messageID;
|
||||||
dynList._hBmp = tIcon->hToolbarBmp;
|
dynList._hBmp = tIcon->hToolbarBmp;
|
||||||
dynList._hIcon = tIcon->hToolbarIcon ? tIcon->hToolbarIcon : _hIconAbsent;
|
dynList._hIcon = tIcon->hToolbarIcon ? tIcon->hToolbarIcon : absentIco;
|
||||||
_vDynBtnReg.push_back(dynList);
|
_vDynBtnReg.push_back(dynList);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -49,8 +49,8 @@ class TiXmlNode;
|
|||||||
class ToolBar : public Window
|
class ToolBar : public Window
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
ToolBar();
|
ToolBar() = default;
|
||||||
~ToolBar();
|
~ToolBar() = default;
|
||||||
|
|
||||||
void initTheme(TiXmlDocument *toolIconsDocRoot);
|
void initTheme(TiXmlDocument *toolIconsDocRoot);
|
||||||
virtual bool init(HINSTANCE hInst, HWND hPere, toolBarStatusType type,
|
virtual bool init(HINSTANCE hInst, HWND hPere, toolBarStatusType type,
|
||||||
@ -94,7 +94,7 @@ public :
|
|||||||
return _toolBarIcons.replaceIcon(whichLst, iconIndex, iconLocation);
|
return _toolBarIcons.replaceIcon(whichLst, iconIndex, iconLocation);
|
||||||
};
|
};
|
||||||
|
|
||||||
void registerDynBtn(UINT message, toolbarIcons* hBmp);
|
void registerDynBtn(UINT message, toolbarIcons* hBmp, HICON absentIco);
|
||||||
|
|
||||||
void doPopop(POINT chevPoint); //show the popup if buttons are hidden
|
void doPopop(POINT chevPoint); //show the popup if buttons are hidden
|
||||||
|
|
||||||
@ -113,7 +113,6 @@ private :
|
|||||||
REBARBANDINFO _rbBand;
|
REBARBANDINFO _rbBand;
|
||||||
std::vector<iconLocator> _customIconVect;
|
std::vector<iconLocator> _customIconVect;
|
||||||
TiXmlNode *_toolIcons = nullptr;
|
TiXmlNode *_toolIcons = nullptr;
|
||||||
HICON _hIconAbsent = nullptr;
|
|
||||||
|
|
||||||
void setDefaultImageList() {
|
void setDefaultImageList() {
|
||||||
::SendMessage(_hSelf, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_toolBarIcons.getDefaultLst()));
|
::SendMessage(_hSelf, TB_SETIMAGELIST, 0, reinterpret_cast<LPARAM>(_toolBarIcons.getDefaultLst()));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user