-
Notifications
You must be signed in to change notification settings - Fork 15
/
NppMessager.cpp
97 lines (79 loc) · 2.63 KB
/
NppMessager.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include <windows.h>
#include "NPP/menuCmdID.h"
#include "NppMessager.h"
CNppMessager::CNppMessager()
{
m_nppData._nppHandle = NULL;
m_nppData._scintillaMainHandle = NULL;
m_nppData._scintillaSecondHandle = NULL;
}
CNppMessager::CNppMessager( const NppData& nppd )
{
m_nppData = nppd;
}
CNppMessager::~CNppMessager()
{
}
LRESULT CNppMessager::SendNppMsg( UINT uMsg, WPARAM wParam , LPARAM lParam )
{
return ::SendMessage( m_nppData._nppHandle, uMsg, wParam, lParam );
}
LRESULT CNppMessager::SendNppMsg( UINT uMsg, WPARAM wParam , LPARAM lParam ) const
{
return ::SendMessage( m_nppData._nppHandle, uMsg, wParam, lParam );
}
BOOL CNppMessager::getCurrentFileFullPath( int strLen, TCHAR *str ) const
{
return ( BOOL ) SendNppMsg( NPPM_GETFULLCURRENTPATH, ( WPARAM ) strLen, ( LPARAM ) str );
}
BOOL CNppMessager::getCurrentFileDirectory( int strLen, TCHAR *str ) const
{
return ( BOOL ) SendNppMsg( NPPM_GETCURRENTDIRECTORY, ( WPARAM ) strLen, ( LPARAM ) str );
}
BOOL CNppMessager::getCurrentFileNameExt( int strLen, TCHAR *str ) const
{
return ( BOOL ) SendNppMsg( NPPM_GETFILENAME, ( WPARAM ) strLen, ( LPARAM ) str );
}
BOOL CNppMessager::getCurrentFileNamePart( int strLen, TCHAR *str ) const
{
return ( BOOL ) SendNppMsg( NPPM_GETNAMEPART, ( WPARAM ) strLen, ( LPARAM ) str );
}
BOOL CNppMessager::getCurrentFileExtPart( int strLen, TCHAR *str ) const
{
return ( BOOL ) SendNppMsg( NPPM_GETEXTPART, ( WPARAM ) strLen, ( LPARAM ) str );
}
HWND CNppMessager::getCurrentScintillaWnd() const
{
int currentView = 0;
SendNppMsg( NPPM_GETCURRENTSCINTILLA, 0, ( LPARAM ) ¤tView );
return ( ( currentView == 0 ) ?
m_nppData._scintillaMainHandle : m_nppData._scintillaSecondHandle );
}
BOOL CNppMessager::getCurrentWord( int strLen, TCHAR *str ) const
{
return ( BOOL ) SendNppMsg( NPPM_GETCURRENTWORD, ( WPARAM ) strLen, ( LPARAM ) str );
}
BOOL CNppMessager::getNppDirectory( int strLen, TCHAR *str ) const
{
return ( BOOL ) SendNppMsg( NPPM_GETNPPDIRECTORY, ( WPARAM ) strLen, ( LPARAM ) str );
}
int CNppMessager::getCurrentBufferID() const
{
return ( int ) SendNppMsg( NPPM_GETCURRENTBUFFERID );
}
HMENU CNppMessager::getNppMainMenu() const
{
return ::GetMenu( m_nppData._nppHandle );
}
HMENU CNppMessager::getNppPluginMenu() const
{
return ( HMENU ) SendNppMsg( NPPM_GETMENUHANDLE, NPPPLUGINMENU, 0 );
}
void CNppMessager::getPluginsConfigDir( int strLen, TCHAR *str ) const
{
SendNppMsg( NPPM_GETPLUGINSCONFIGDIR, ( WPARAM ) strLen, ( LPARAM ) str );
}
void CNppMessager::makeCurrentBufferDirty()
{
SendNppMsg( NPPM_MAKECURRENTBUFFERDIRTY );
}