Skip to content

Commit bfc0f26

Browse files
committed
- update files from N++ with version 7.9.2
- removed unused CharToWideChar()
1 parent b92cec2 commit bfc0f26

19 files changed

+2016
-965
lines changed

NppTaskList.vcxproj

+1
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183
<ClInclude Include="include\PluginDefinition.h" />
184184
<ClInclude Include="include\PluginInterface.h" />
185185
<ClInclude Include="include\Scintilla.h" />
186+
<ClInclude Include="include\Sci_Position.h" />
186187
<ClInclude Include="include\StaticDialog.h" />
187188
<ClInclude Include="include\TaskListDlg.h" />
188189
<ClInclude Include="include\URLCtrl.h" />

NppTaskList.vcxproj.filters

+3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@
6363
<ClInclude Include="include\Common.h">
6464
<Filter>Header Files</Filter>
6565
</ClInclude>
66+
<ClInclude Include="include\Sci_Position.h">
67+
<Filter>Header Files</Filter>
68+
</ClInclude>
6669
</ItemGroup>
6770
<ItemGroup>
6871
<ClCompile Include="src\NppTaskListPlugin.cpp">

include/Common.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// This file is part of Notepad++ project
2-
// Copyright (C)2003 Don HO <[email protected]>
2+
// Copyright (C)2020 Don HO <[email protected]>
33
//
44
// This program is free software; you can redistribute it and/or
55
// modify it under the terms of the GNU General Public License
@@ -27,8 +27,7 @@
2727

2828
// NOTE : Extremely cleaned out, if you need more go to: https://github.com/notepad-plus-plus/notepad-plus-plus/blob/master/PowerEditor/src/MISC/Common/Common.h
2929

30-
#ifndef COMMON_INCLUDED
31-
#define COMMON_INCLUDED
30+
#pragma once
3231

3332
#include <string>
3433
#include <windows.h>
@@ -37,4 +36,5 @@ typedef std::basic_string<TCHAR> generic_string;
3736

3837
COLORREF getCtrlBgColor(HWND hWnd);
3938

40-
#endif // COMMON_INCLUDED
39+
generic_string GetLastErrorAsString(DWORD errorCode = 0);
40+

include/Docking.h

+33-25
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,34 @@
1-
/*
2-
this file is part of Function List Plugin for Notepad++
3-
Copyright (C)2005 Jens Lorenz <[email protected]>
4-
5-
This program is free software; you can redistribute it and/or
6-
modify it under the terms of the GNU General Public License
7-
as published by the Free Software Foundation; either
8-
version 2 of the License, or (at your option) any later version.
9-
10-
This program is distributed in the hope that it will be useful,
11-
but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
GNU General Public License for more details.
14-
15-
You should have received a copy of the GNU General Public License
16-
along with this program; if not, write to the Free Software
17-
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18-
*/
19-
20-
#ifndef DOCKING_H
21-
#define DOCKING_H
1+
// this file is part of Notepad++
2+
// Copyright (C)2005 Jens Lorenz <[email protected]>
3+
//
4+
// This program is free software; you can redistribute it and/or
5+
// modify it under the terms of the GNU General Public License
6+
// as published by the Free Software Foundation; either
7+
// version 2 of the License, or (at your option) any later version.
8+
//
9+
// // Note that the GPL places important restrictions on "derived works", yet
10+
// it does not provide a detailed definition of that term. To avoid
11+
// misunderstandings, we consider an application to constitute a
12+
// "derivative work" for the purpose of this license if it does any of the
13+
// following:
14+
// 1. Integrates source code from Notepad++.
15+
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
16+
// installer, such as those produced by InstallShield.
17+
// 3. Links to a library or executes a program that does any of the above.
18+
//
19+
// This program is distributed in the hope that it will be useful,
20+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
// GNU General Public License for more details.
23+
//
24+
// You should have received a copy of the GNU General Public License
25+
// along with this program; if not, write to the Free Software
26+
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
27+
28+
29+
#pragma once
30+
31+
#include <windows.h>
2232

2333
// ATTENTION : It's a part of interface header, so don't include the others header here
2434

@@ -49,13 +59,13 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4959

5060
typedef struct {
5161
HWND hClient; // client Window Handle
52-
TCHAR *pszName; // name of plugin (shown in window)
62+
const TCHAR *pszName; // name of plugin (shown in window)
5363
int dlgID; // a funcItem provides the function pointer to start a dialog. Please parse here these ID
5464

5565
// user modifications
5666
UINT uMask; // mask params: look to above defines
5767
HICON hIconTab; // icon for tabs
58-
TCHAR *pszAddInfo; // for plugin to display additional informations
68+
const TCHAR *pszAddInfo; // for plugin to display additional informations
5969

6070
// internal data, do not use !!!
6171
RECT rcFloat; // floating position
@@ -73,5 +83,3 @@ typedef struct {
7383
#define HIT_TEST_THICKNESS 20
7484
#define SPLITTER_WIDTH 4
7585

76-
77-
#endif // DOCKING_H

include/DockingDlgInterface.h

+79-61
Original file line numberDiff line numberDiff line change
@@ -1,85 +1,112 @@
1-
/*
2-
this file is part of Function List Plugin for Notepad++
3-
Copyright (C)2005 Jens Lorenz <[email protected]>
1+
// this file is part of Function List Plugin for Notepad++
2+
// Copyright (C)2005 Jens Lorenz <[email protected]>
3+
//
4+
// This program is free software; you can redistribute it and/or
5+
// modify it under the terms of the GNU General Public License
6+
// as published by the Free Software Foundation; either
7+
// version 2 of the License, or (at your option) any later version.
8+
//
9+
// Note that the GPL places important restrictions on "derived works", yet
10+
// it does not provide a detailed definition of that term. To avoid
11+
// misunderstandings, we consider an application to constitute a
12+
// "derivative work" for the purpose of this license if it does any of the
13+
// following:
14+
// 1. Integrates source code from Notepad++.
15+
// 2. Integrates/includes/aggregates Notepad++ into a proprietary executable
16+
// installer, such as those produced by InstallShield.
17+
// 3. Links to a library or executes a program that does any of the above.
18+
//
19+
// This program is distributed in the hope that it will be useful,
20+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
21+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22+
// GNU General Public License for more details.
23+
//
24+
// You should have received a copy of the GNU General Public License
25+
// along with this program; if not, write to the Free Software
26+
27+
28+
#pragma once
429

5-
This program is free software; you can redistribute it and/or
6-
modify it under the terms of the GNU General Public License
7-
as published by the Free Software Foundation; either
8-
version 2 of the License, or (at your option) any later version.
9-
10-
This program is distributed in the hope that it will be useful,
11-
but WITHOUT ANY WARRANTY; without even the implied warranty of
12-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13-
GNU General Public License for more details.
14-
15-
You should have received a copy of the GNU General Public License
16-
along with this program; if not, write to the Free Software
17-
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18-
*/
19-
20-
#ifndef DOCKINGDLGINTERFACE_H
21-
#define DOCKINGDLGINTERFACE_H
22-
23-
#include "StaticDialog.h"
2430
#include "dockingResource.h"
2531
#include "Docking.h"
32+
33+
#include <assert.h>
2634
#include <shlwapi.h>
35+
#include "Common.h"
36+
#include "StaticDialog.h"
37+
2738

2839

2940
class DockingDlgInterface : public StaticDialog
3041
{
3142
public:
32-
DockingDlgInterface(): StaticDialog() {};
33-
DockingDlgInterface(int dlgID): StaticDialog(), _dlgID(dlgID) {};
34-
35-
virtual void init(HINSTANCE hInst, HWND parent)
36-
{
43+
DockingDlgInterface() = default;
44+
explicit DockingDlgInterface(int dlgID): _dlgID(dlgID) {}
45+
46+
virtual void init(HINSTANCE hInst, HWND parent) {
3747
StaticDialog::init(hInst, parent);
38-
::GetModuleFileName((HMODULE)hInst, _moduleName, MAX_PATH);
39-
lstrcpy(_moduleName, PathFindFileName(_moduleName));
48+
TCHAR temp[MAX_PATH];
49+
::GetModuleFileName(reinterpret_cast<HMODULE>(hInst), temp, MAX_PATH);
50+
_moduleName = ::PathFindFileName(temp);
4051
}
4152

42-
void create(tTbData * data, bool isRTL = false){
53+
void create(tTbData* data, bool isRTL = false) {
54+
assert(data != nullptr);
4355
StaticDialog::create(_dlgID, isRTL);
44-
::GetWindowText(_hSelf, _pluginName, sizeof(_pluginName)/sizeof(TCHAR));
56+
TCHAR temp[MAX_PATH];
57+
::GetWindowText(_hSelf, temp, MAX_PATH);
58+
_pluginName = temp;
4559

4660
// user information
47-
data->hClient = _hSelf;
48-
data->pszName = _pluginName;
61+
data->hClient = _hSelf;
62+
data->pszName = _pluginName.c_str();
4963

5064
// supported features by plugin
51-
data->uMask = 0;
65+
data->uMask = 0;
5266

5367
// additional info
54-
data->pszAddInfo = NULL;
55-
_data = data;
56-
57-
};
68+
data->pszAddInfo = NULL;
69+
}
5870

59-
virtual void updateDockingDlg(void) {
60-
::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, (LPARAM)_hSelf);
71+
virtual void updateDockingDlg() {
72+
::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, reinterpret_cast<LPARAM>(_hSelf));
6173
}
6274

63-
virtual void destroy() {
64-
};
75+
virtual void destroy() {}
76+
77+
virtual void setBackgroundColor(COLORREF) {}
78+
virtual void setForegroundColor(COLORREF) {}
6579

6680
virtual void display(bool toShow = true) const {
67-
::SendMessage(_hParent, toShow?NPPM_DMMSHOW:NPPM_DMMHIDE, 0, (LPARAM)_hSelf);
68-
};
81+
::SendMessage(_hParent, toShow ? NPPM_DMMSHOW : NPPM_DMMHIDE, 0, reinterpret_cast<LPARAM>(_hSelf));
82+
}
83+
84+
bool isClosed() const {
85+
return _isClosed;
86+
}
87+
88+
void setClosed(bool toClose) {
89+
_isClosed = toClose;
90+
}
6991

7092
const TCHAR * getPluginFileName() const {
71-
return _moduleName;
72-
};
93+
return _moduleName.c_str();
94+
}
7395

7496
protected :
75-
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM /*wParam*/, LPARAM lParam)
76-
{
77-
switch (message)
97+
int _dlgID = -1;
98+
bool _isFloating = true;
99+
int _iDockedPos = 0;
100+
generic_string _moduleName;
101+
generic_string _pluginName;
102+
bool _isClosed = false;
103+
104+
virtual INT_PTR CALLBACK run_dlgProc(UINT message, WPARAM, LPARAM lParam) {
105+
switch (message)
78106
{
79-
80107
case WM_NOTIFY:
81108
{
82-
LPNMHDR pnmh = (LPNMHDR)lParam;
109+
LPNMHDR pnmh = reinterpret_cast<LPNMHDR>(lParam);
83110

84111
if (pnmh->hwndFrom == _hParent)
85112
{
@@ -96,6 +123,7 @@ protected :
96123
}
97124
case DMN_DOCK:
98125
{
126+
_iDockedPos = HIWORD(pnmh->code);
99127
_isFloating = false;
100128
break;
101129
}
@@ -110,14 +138,4 @@ protected :
110138
}
111139
return FALSE;
112140
};
113-
114-
// Handles
115-
HWND _HSource;
116-
tTbData* _data;
117-
int _dlgID;
118-
bool _isFloating;
119-
TCHAR _moduleName[MAX_PATH];
120-
TCHAR _pluginName[MAX_PATH];
121141
};
122-
123-
#endif // DOCKINGDLGINTERFACE_H

0 commit comments

Comments
 (0)