Skip to content

Commit

Permalink
Add enable check to beNotified() to short circuit actions if disabled
Browse files Browse the repository at this point in the history
  • Loading branch information
VinsWorldcom committed Dec 1, 2023
1 parent c005e14 commit f0f0fb0
Showing 1 changed file with 24 additions and 15 deletions.
39 changes: 24 additions & 15 deletions DllMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
extern FuncItem funcItem[COMMNAD_COUNT];
extern NppData nppData;
extern bool doCloseTag;

extern bool _enable_qcp;

BOOL APIENTRY DllMain( HANDLE hModule,
DWORD reasonForCall,
Expand Down Expand Up @@ -57,39 +57,47 @@ extern "C" __declspec(dllexport) void beNotified(SCNotification *notifyCode) {
}
case SCN_PAINTED:
{
HighlightColorCode();
if (_enable_qcp)
HighlightColorCode();
}
case SCN_UPDATEUI:
{
if (notifyCode->updated & SC_UPDATE_SELECTION ) {
if (!HasSelection())
HideColorPicker();
if (_enable_qcp) {
if (notifyCode->updated & SC_UPDATE_SELECTION ) {
if (!HasSelection())
HideColorPicker();
}
}
break;
}
case SCN_DOUBLECLICK:
{
ShowColorPicker();
if (_enable_qcp)
ShowColorPicker();
break;
}
case SCN_ZOOM:
{
HideColorPicker();
if (_enable_qcp)
HideColorPicker();
break;
}
case SCN_MODIFIED:
{
if (notifyCode->modificationType & SC_MOD_DELETETEXT
|| notifyCode->modificationType & SC_MOD_INSERTTEXT) {
HideColorPicker();
}
break;
if (_enable_qcp) {
if (notifyCode->modificationType & SC_MOD_DELETETEXT
|| notifyCode->modificationType & SC_MOD_INSERTTEXT) {
HideColorPicker();
}
}
break;
}
case NPPN_LANGCHANGED:
case NPPN_BUFFERACTIVATED:
{
HideColorPicker();
break;
if (_enable_qcp)
HideColorPicker();
break;
}
default:
{
Expand All @@ -108,7 +116,8 @@ extern "C" __declspec(dllexport) void beNotified(SCNotification *notifyCode) {
extern "C" __declspec(dllexport) LRESULT messageProc(UINT message, WPARAM wParam, LPARAM lParam) {

if (message == WM_MOVE) {
HideColorPicker();
if (_enable_qcp)
HideColorPicker();
}
return TRUE;

Expand Down

0 comments on commit f0f0fb0

Please sign in to comment.