Skip to content

Commit 5704fa1

Browse files
committed
Merge remote branch 'jl/jl/reduce-headers-dep'
2 parents 048b7c7 + 4603158 commit 5704fa1

17 files changed

Lines changed: 192 additions & 123 deletions

NppPlugin/include/Docking.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
4747
#define DWS_DF_FLOATING 0x80000000 // default state is floating
4848

4949

50-
typedef struct {
50+
struct tTbData
51+
{
5152
HWND hClient; // client Window Handle
5253
TCHAR *pszName; // name of plugin (shown in window)
5354
int dlgID; // a funcItem provides the function pointer to start a dialog. Please parse here these ID
@@ -61,13 +62,14 @@ typedef struct {
6162
RECT rcFloat; // floating position
6263
int iPrevCont; // stores the privious container (toggling between float and dock)
6364
const TCHAR* pszModuleName; // it's the plugin file name. It's used to identify the plugin
64-
} tTbData;
65+
};
6566

6667

67-
typedef struct {
68+
struct tDockMgr
69+
{
6870
HWND hWnd; // the docking manager wnd
6971
RECT rcRegion[DOCKCONT_MAX]; // position of docked dialogs
70-
} tDockMgr;
72+
} ;
7173

7274

7375
#define HIT_TEST_THICKNESS 20

NppPlugin/include/DockingDlgInterface.h

Lines changed: 12 additions & 92 deletions
Original file line numberDiff line numberDiff line change
@@ -20,106 +20,26 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
2020
#ifndef DOCKINGDLGINTERFACE_H
2121
#define DOCKINGDLGINTERFACE_H
2222

23-
#ifndef DOCKING_RESOURCE_H
24-
#include "dockingResource.h"
25-
#endif //DOCKING_RESOURCE_H
26-
27-
#ifndef DOCKING_H
28-
#include "Docking.h"
29-
#endif //DOCKING_H
30-
23+
#ifndef STATIC_DIALOG_H
3124
#include "StaticDialog.h"
25+
#endif
26+
27+
struct tTbData;
3228

3329
class DockingDlgInterface : public StaticDialog
3430
{
3531
public:
36-
DockingDlgInterface(): StaticDialog(), _HSource(NULL), _data(NULL),\
37-
_dlgID(-1), _isFloating(TRUE), _iDockedPos(0), _pluginName(TEXT("")) {};
38-
39-
DockingDlgInterface(int dlgID): StaticDialog(), _HSource(NULL), _data(NULL),\
40-
_dlgID(dlgID), _isFloating(TRUE), _iDockedPos(0), _pluginName(TEXT("")) {};
32+
DockingDlgInterface();
33+
DockingDlgInterface(int dlgID);
4134

42-
virtual void init(HINSTANCE hInst, HWND parent) {
43-
StaticDialog::init(hInst, parent);
44-
TCHAR temp[MAX_PATH];
45-
::GetModuleFileName((HMODULE)hInst, temp, MAX_PATH);
46-
_moduleName = PathFindFileName(temp);
47-
};
48-
49-
void create(tTbData * data, bool isRTL = false){
50-
StaticDialog::create(_dlgID, isRTL);
51-
TCHAR temp[MAX_PATH];
52-
::GetWindowText(_hSelf, temp, MAX_PATH);
53-
_pluginName = temp;
54-
// user information
55-
data->hClient = _hSelf;
56-
data->pszName = (TCHAR *)_pluginName.c_str();
57-
58-
// supported features by plugin
59-
data->uMask = 0;
60-
61-
// additional info
62-
data->pszAddInfo = NULL;
63-
64-
_data = data;
65-
66-
};
67-
68-
virtual void updateDockingDlg() {
69-
::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, (LPARAM)_hSelf);
70-
}
71-
72-
virtual void destroy() {
73-
};
74-
75-
virtual void display(bool toShow = true) const {
76-
::SendMessage(_hParent, toShow?NPPM_DMMSHOW:NPPM_DMMHIDE, 0, (LPARAM)_hSelf);
77-
};
78-
79-
const TCHAR * getPluginFileName() const {
80-
return _moduleName.c_str();
81-
};
35+
virtual void init(HINSTANCE hInst, HWND parent);
36+
void create(tTbData * data, bool isRTL = false);
37+
virtual void updateDockingDlg();
38+
virtual void display(bool toShow = true) const;
39+
const TCHAR * getPluginFileName() const;
8240

8341
protected :
84-
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM, LPARAM lParam)
85-
{
86-
switch (message)
87-
{
88-
89-
case WM_NOTIFY:
90-
{
91-
LPNMHDR pnmh = (LPNMHDR)lParam;
92-
93-
if (pnmh->hwndFrom == _hParent)
94-
{
95-
switch (LOWORD(pnmh->code))
96-
{
97-
case DMN_CLOSE:
98-
{
99-
break;
100-
}
101-
case DMN_FLOAT:
102-
{
103-
_isFloating = true;
104-
break;
105-
}
106-
case DMN_DOCK:
107-
{
108-
_iDockedPos = HIWORD(pnmh->code);
109-
_isFloating = false;
110-
break;
111-
}
112-
default:
113-
break;
114-
}
115-
}
116-
break;
117-
}
118-
default:
119-
break;
120-
}
121-
return FALSE;
122-
};
42+
virtual BOOL CALLBACK run_dlgProc(UINT message, WPARAM, LPARAM lParam);
12343

12444
// Handles
12545
HWND _HSource;

NppPlugin/include/PluginInterface.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
#ifndef PLUGININTERFACE_H
1919
#define PLUGININTERFACE_H
2020

21-
#include "Notepad_plus_msgs.h"
22-
2321
struct SCNotification;
2422
const int nbChar = 64;
2523

NppPlugin/include/StaticDialog.h

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
#ifndef STATIC_DIALOG_H
1919
#define STATIC_DIALOG_H
2020

21-
//#include "resource.h"
2221
#include "Window.h"
23-
#include "Notepad_plus_msgs.h"
2422

2523
enum PosAlign{ALIGNPOS_LEFT, ALIGNPOS_RIGHT, ALIGNPOS_TOP, ALIGNPOS_BOTTOM};
2624

@@ -41,20 +39,17 @@ struct DLGTEMPLATEEX {
4139
class StaticDialog : public Window
4240
{
4341
public :
44-
StaticDialog() : Window() {};
45-
~StaticDialog();
42+
StaticDialog(){}
43+
~StaticDialog()
4644

4745
virtual void create(int dialogID, bool isRTL = false);
4846

4947
virtual bool isCreated() const {
5048
return (_hSelf != NULL);
51-
};
49+
}
5250

5351
void goToCenter();
54-
void destroy() {
55-
::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)_hSelf);
56-
::DestroyWindow(_hSelf);
57-
};
52+
void destroy();
5853

5954
protected :
6055
RECT _rc;

NppPlugin/project/NppPlugin.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
</ClCompile>
134134
</ItemDefinitionGroup>
135135
<ItemGroup>
136+
<ClCompile Include="..\src\DockingDlgInterface.cpp" />
136137
<ClCompile Include="..\src\StaticDialog.cpp" />
137138
<ClCompile Include="..\stdafx.cpp">
138139
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>

NppPlugin/project/NppPlugin.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121
<ClCompile Include="..\stdafx.cpp">
2222
<Filter>Source Files</Filter>
2323
</ClCompile>
24+
<ClCompile Include="..\src\DockingDlgInterface.cpp">
25+
<Filter>Source Files</Filter>
26+
</ClCompile>
2427
</ItemGroup>
2528
<ItemGroup>
2629
<ClInclude Include="..\include\Common.h">
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
//this file is part of notepad++
2+
//Copyright (C)2003 Don HO ( donho@altern.org )
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+
//This program is distributed in the hope that it will be useful,
10+
//but WITHOUT ANY WARRANTY; without even the implied warranty of
11+
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12+
//GNU General Public License for more details.
13+
//
14+
//You should have received a copy of the GNU General Public License
15+
//along with this program; if not, write to the Free Software
16+
//Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17+
18+
#include "stdafx.h"
19+
#include "Notepad_plus_msgs.h"
20+
#include "Docking.h"
21+
#include "dockingResource.h"
22+
#include "DockingDlgInterface.h"
23+
24+
DockingDlgInterface::DockingDlgInterface():
25+
_HSource(NULL),
26+
_data(NULL),
27+
_dlgID(-1),
28+
_isFloating(TRUE),
29+
_iDockedPos(0),
30+
_pluginName(TEXT(""))
31+
{}
32+
33+
DockingDlgInterface::DockingDlgInterface(int dlgID):
34+
_HSource(NULL),
35+
_data(NULL),
36+
_dlgID(dlgID),
37+
_isFloating(TRUE),
38+
_iDockedPos(0),
39+
_pluginName(TEXT(""))
40+
{}
41+
42+
void DockingDlgInterface::init(HINSTANCE hInst, HWND parent)
43+
{
44+
StaticDialog::init(hInst, parent);
45+
TCHAR temp[MAX_PATH];
46+
::GetModuleFileName((HMODULE)hInst, temp, MAX_PATH);
47+
_moduleName = PathFindFileName(temp);
48+
}
49+
50+
void DockingDlgInterface::create(tTbData * data, bool isRTL/* = false*/)
51+
{
52+
StaticDialog::create(_dlgID, isRTL);
53+
TCHAR temp[MAX_PATH];
54+
::GetWindowText(_hSelf, temp, MAX_PATH);
55+
_pluginName = temp;
56+
// user information
57+
data->hClient = _hSelf;
58+
data->pszName = (TCHAR *)_pluginName.c_str();
59+
60+
// supported features by plugin
61+
data->uMask = 0;
62+
63+
// additional info
64+
data->pszAddInfo = NULL;
65+
66+
_data = data;
67+
68+
}
69+
70+
void DockingDlgInterface::updateDockingDlg()
71+
{
72+
::SendMessage(_hParent, NPPM_DMMUPDATEDISPINFO, 0, (LPARAM)_hSelf);
73+
}
74+
75+
void DockingDlgInterface::display(bool toShow /*= true*/) const
76+
{
77+
::SendMessage(_hParent, toShow?NPPM_DMMSHOW:NPPM_DMMHIDE, 0, (LPARAM)_hSelf);
78+
}
79+
80+
const TCHAR * DockingDlgInterface::getPluginFileName() const
81+
{
82+
return _moduleName.c_str();
83+
}
84+
85+
BOOL CALLBACK DockingDlgInterface::run_dlgProc(UINT message, WPARAM, LPARAM lParam)
86+
{
87+
switch (message)
88+
{
89+
90+
case WM_NOTIFY:
91+
{
92+
LPNMHDR pnmh = (LPNMHDR)lParam;
93+
94+
if (pnmh->hwndFrom == _hParent)
95+
{
96+
switch (LOWORD(pnmh->code))
97+
{
98+
case DMN_CLOSE:
99+
{
100+
break;
101+
}
102+
case DMN_FLOAT:
103+
{
104+
_isFloating = true;
105+
break;
106+
}
107+
case DMN_DOCK:
108+
{
109+
_iDockedPos = HIWORD(pnmh->code);
110+
_isFloating = false;
111+
break;
112+
}
113+
default:
114+
break;
115+
}
116+
}
117+
break;
118+
}
119+
default:
120+
break;
121+
}
122+
return FALSE;
123+
}
124+

NppPlugin/src/StaticDialog.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "stdafx.h"
1919
#include "StaticDialog.h"
2020
#include "SysMsg.h"
21+
#include "Notepad_plus_msgs.h"
2122

2223
#define WS_EX_LAYOUTRTL 0x00400000L
2324

@@ -149,3 +150,9 @@ void StaticDialog::alignWith(HWND handle, HWND handle2Align, PosAlign pos, POINT
149150

150151
::ScreenToClient(_hSelf, &point);
151152
}
153+
154+
void StaticDialog::destroy()
155+
{
156+
::SendMessage(_hParent, NPPM_MODELESSDIALOG, MODELESSDIALOGREMOVE, (WPARAM)_hSelf);
157+
::DestroyWindow(_hSelf);
158+
}

NppPlugin/stdafx.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,8 @@
2121
#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers
2222
// Windows Header Files:
2323
#include <windows.h>
24+
#include <shlwapi.h>
25+
26+
#include <string>
27+
typedef std::basic_string<TCHAR> tstring;
28+

0 commit comments

Comments
 (0)