2020/* Info for Notepad++ */
2121CONST TCHAR PLUGIN_NAME[] = _T(" Python Script" );
2222
23- FuncItem *funcItem = NULL ;
23+ static FuncItem *funcItem = NULL ;
2424
2525/* Global data */
26- NppData nppData;
27- HANDLE g_hModule = NULL ;
28- TCHAR iniFilePath[MAX_PATH];
26+ static NppData nppData;
27+ static HANDLE g_hModule = NULL ;
2928
3029/* Dialogs */
31- AboutDialog aboutDlg;
32- ShortcutDlg *g_shortcutDlg = NULL ;
30+ static AboutDialog aboutDlg;
31+ static ShortcutDlg *g_shortcutDlg = NULL ;
3332
34- PythonConsole *g_console = 0 ;
33+ static PythonConsole *g_console = 0 ;
3534// Paths
36- char g_pluginDir[MAX_PATH];
37- char g_configDir[MAX_PATH];
38- std::string g_previousScript;
35+ static char g_pluginDir[MAX_PATH];
36+ static char g_configDir[MAX_PATH];
37+ static std::string g_previousScript;
3938
40- bool g_infoSet = false ;
41- int g_scriptsMenuIndex = 0 ;
42- int g_stopScriptIndex = 0 ;
43- bool g_initialised = false ;
44- MenuManager *g_menuManager;
39+ static bool g_infoSet = false ;
40+ static bool g_initialised = false ;
4541
4642// Scripts on the menu
47- std::vector<std::string*> g_menuScripts;
43+ static std::vector<std::string*> g_menuScripts;
4844
4945// Scripts on the toolbar
50- std::vector< std::pair<std::string*, HICON>* > g_toolbarScripts;
46+ static std::vector< std::pair<std::string*, HICON>* > g_toolbarScripts;
5147
5248
5349
54- void doAbout ();
50+ static void doAbout ();
5551
56- void newScript ();
57- void showConsole ();
58- void showShortcutDlg ();
59- void stopScript ();
60- void runScript (idx_t number);
61- void runScript (const char *script, bool synchronous, HANDLE completedEvent = NULL , bool allowQueuing = false );
62- void runStatement (const char *statement, bool synchronous, HANDLE completedEvent = NULL , bool allowQueuing = false );
63- void shutdown (void *);
64- void doHelp ();
65- void previousScript ();
52+ static void newScript ();
53+ static void showConsole ();
54+ static void showShortcutDlg ();
55+ static void stopScript ();
56+ static void runScript (idx_t number);
57+ static void runScript (const char *script, bool synchronous, HANDLE completedEvent = NULL , bool allowQueuing = false );
58+ static void runStatement (const char *statement, bool synchronous, HANDLE completedEvent = NULL , bool allowQueuing = false );
59+ static void shutdown (void *);
60+ static void doHelp ();
61+ static void previousScript ();
6662
67- FuncItem* getGeneratedFuncItemArray (int *nbF);
63+ static FuncItem* getGeneratedFuncItemArray (int *nbF);
6864
6965
7066
@@ -73,10 +69,8 @@ FuncItem* getGeneratedFuncItemArray(int *nbF);
7369
7470
7571
76- HWND getCurrentHScintilla (int which);
77-
7872// Main python handler/wrapper
79- PythonHandler *pythonHandler;
73+ static PythonHandler *pythonHandler;
8074
8175BOOL APIENTRY DllMain ( HMODULE hModule,
8276 DWORD ul_reason_for_call,
@@ -105,7 +99,6 @@ BOOL APIENTRY DllMain( HMODULE hModule,
10599
106100
107101
108-
109102extern " C" __declspec(dllexport) void setInfo (NppData notepadPlusData)
110103{
111104 nppData = notepadPlusData;
@@ -159,13 +152,7 @@ extern "C" __declspec(dllexport) FuncItem * getFuncsArray(int *nbF)
159152 return funcItem;
160153}
161154
162- HWND getCurrentHScintilla (int which)
163- {
164- return (which == 0 )?nppData._scintillaMainHandle :nppData._scintillaSecondHandle ;
165- };
166-
167-
168- FuncItem* getGeneratedFuncItemArray (int *nbF)
155+ static FuncItem* getGeneratedFuncItemArray (int *nbF)
169156{
170157
171158 MenuManager* menuManager = MenuManager::getInstance ();
@@ -216,7 +203,7 @@ FuncItem* getGeneratedFuncItemArray(int *nbF)
216203}
217204
218205
219- void initialise ()
206+ static void initialise ()
220207{
221208 g_console = new PythonConsole (nppData._nppHandle );
222209
@@ -241,7 +228,7 @@ void initialise()
241228
242229}
243230
244- void initialisePython ()
231+ static void initialisePython ()
245232{
246233 g_initialised = true ;
247234 DWORD startTicks = GetTickCount ();
@@ -265,7 +252,7 @@ void initialisePython()
265252
266253}
267254
268- void registerToolbarIcons ()
255+ static void registerToolbarIcons ()
269256{
270257#ifdef DEBUG_STARTUP
271258 MessageBox (NULL , _T (" Register toolbar icons" ), _T (" Python Script" ), 0 );
@@ -427,7 +414,7 @@ extern "C" __declspec(dllexport) BOOL isUnicode()
427414#endif
428415
429416
430- void doAbout ()
417+ static void doAbout ()
431418{
432419 aboutDlg.doDialog ();
433420}
@@ -436,7 +423,7 @@ void doAbout()
436423
437424
438425
439- void stopScript ()
426+ static void stopScript ()
440427{
441428 if (pythonHandler)
442429 {
@@ -445,7 +432,7 @@ void stopScript()
445432}
446433
447434
448- bool shortcutKeyHasCtrl (idx_t number)
435+ static bool shortcutKeyHasCtrl (idx_t number)
449436{
450437 bool retVal = false ;
451438 idx_t cmdID = MenuManager::getInstance ()->getOriginalCommandID (number);
@@ -462,7 +449,7 @@ bool shortcutKeyHasCtrl(idx_t number)
462449}
463450
464451
465- void runScript (idx_t number)
452+ static void runScript (idx_t number)
466453{
467454 /* If the shortcut for the given script number does not have a control in it,
468455 * (or no shortcut key is assigned), then we can pretend the user clicked the menu option.
@@ -482,7 +469,7 @@ void runScript(idx_t number)
482469
483470
484471
485- void runStatement (const char *statement, bool synchronous, HANDLE completedEvent /* = NULL */ , bool allowQueuing /* = false */ )
472+ static void runStatement (const char *statement, bool synchronous, HANDLE completedEvent /* = NULL */ , bool allowQueuing /* = false */ )
486473{
487474 CHECK_INITIALISED ();
488475 MenuManager::getInstance ()->stopScriptEnabled (true );
@@ -493,7 +480,7 @@ void runStatement(const char *statement, bool synchronous, HANDLE completedEvent
493480
494481}
495482
496- void updatePreviousScript (const char *filename)
483+ static void updatePreviousScript (const char *filename)
497484{
498485 if (g_previousScript == filename)
499486 return ;
@@ -504,7 +491,7 @@ void updatePreviousScript(const char *filename)
504491 menuManager->updatePreviousScript (filename);
505492}
506493
507- void runScript (const char *filename, bool synchronous, HANDLE completedEvent /* = NULL */ , bool allowQueuing /* = false */ )
494+ static void runScript (const char *filename, bool synchronous, HANDLE completedEvent /* = NULL */ , bool allowQueuing /* = false */ )
508495{
509496
510497 BYTE keyState[256 ];
@@ -549,15 +536,15 @@ void runScript(const char *filename, bool synchronous, HANDLE completedEvent /*
549536
550537}
551538
552- void showShortcutDlg ()
539+ static void showShortcutDlg ()
553540{
554541 if (g_shortcutDlg)
555542 {
556543 g_shortcutDlg->doDialog ();
557544 }
558545}
559546
560- void showConsole ()
547+ static void showConsole ()
561548{
562549 if (g_console)
563550 {
@@ -566,7 +553,7 @@ void showConsole()
566553 }
567554}
568555
569- void newScript ()
556+ static void newScript ()
570557{
571558
572559 OPENFILENAMEA ofn;
@@ -608,7 +595,7 @@ void newScript()
608595
609596
610597
611- void shutdown (void * /* dummy */ )
598+ static void shutdown (void * /* dummy */ )
612599{
613600 if (pythonHandler)
614601 {
@@ -644,7 +631,7 @@ void shutdown(void* /* dummy */)
644631}
645632
646633
647- void doHelp ()
634+ static void doHelp ()
648635{
649636 int which;
650637
@@ -654,7 +641,7 @@ void doHelp()
654641 help.callHelp ();
655642}
656643
657- void previousScript ()
644+ static void previousScript ()
658645{
659646 runScript (g_previousScript.c_str (), false );
660647}
0 commit comments