diff --git a/NppPlugin/include/DockingDlgInterface.h b/NppPlugin/include/DockingDlgInterface.h index c4bacf90..73155ff7 100644 --- a/NppPlugin/include/DockingDlgInterface.h +++ b/NppPlugin/include/DockingDlgInterface.h @@ -20,8 +20,6 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. #ifndef DOCKINGDLGINTERFACE_H #define DOCKINGDLGINTERFACE_H -#include "stdafx.h" - #ifndef DOCKING_RESOURCE_H #include "dockingResource.h" #endif //DOCKING_RESOURCE_H diff --git a/NppPlugin/include/PluginInterface.h b/NppPlugin/include/PluginInterface.h index ddc5bd08..3e5e4d9b 100644 --- a/NppPlugin/include/PluginInterface.h +++ b/NppPlugin/include/PluginInterface.h @@ -18,10 +18,9 @@ #ifndef PLUGININTERFACE_H #define PLUGININTERFACE_H -#include -#include "Scintilla.h" #include "Notepad_plus_msgs.h" +struct SCNotification; const int nbChar = 64; typedef const TCHAR * (__cdecl * PFUNCGETNAME)(); diff --git a/NppPlugin/include/Window.h b/NppPlugin/include/Window.h index 7bd64cbd..16a0462e 100644 --- a/NppPlugin/include/Window.h +++ b/NppPlugin/include/Window.h @@ -18,8 +18,6 @@ #ifndef WINDOW_CONTROL_H #define WINDOW_CONTROL_H -#include - class Window { public: diff --git a/PythonScript/include/PythonScript/NppPythonScript.h b/PythonScript/include/PythonScript/NppPythonScript.h index 29540b05..26aa9b4a 100644 --- a/PythonScript/include/PythonScript/NppPythonScript.h +++ b/PythonScript/include/PythonScript/NppPythonScript.h @@ -2,13 +2,6 @@ #define _NPPPYTHONSCRIPT_H - -#define WIN32_LEAN_AND_MEAN -#include -#undef WIN32_LEAN_AND_MEAN - -#include - #define PYSCR_START (WM_USER + 3500) /** Execute a script in a file diff --git a/PythonScript/src/AboutDialog.h b/PythonScript/src/AboutDialog.h index 71cc023e..bc0814c1 100644 --- a/PythonScript/src/AboutDialog.h +++ b/PythonScript/src/AboutDialog.h @@ -1,8 +1,11 @@ -#pragma once -#include "stdafx.h" +#ifndef _ABOUTDIALOG_H +#define _ABOUTDIALOG_H +#ifndef STATIC_DIALOG_H #include "StaticDialog.h" -#include "PluginInterface.h" +#endif + +struct NppData; class AboutDialog : public StaticDialog { @@ -10,17 +13,13 @@ class AboutDialog : public StaticDialog AboutDialog(void); ~AboutDialog(void); - void init(HINSTANCE hInst, NppData nppData) - { - _nppData = nppData; - Window::init(hInst, nppData._nppHandle); - }; + void init(HINSTANCE hInst, NppData& nppData); void doDialog(); BOOL CALLBACK AboutDialog::run_dlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam); private: - NppData _nppData; - HBRUSH m_hbrBackground; }; + +#endif // _ABOUTDIALOG_H \ No newline at end of file diff --git a/PythonScript/src/AboutDialog2.cpp b/PythonScript/src/AboutDialog2.cpp index 45f98b86..9c35ff25 100644 --- a/PythonScript/src/AboutDialog2.cpp +++ b/PythonScript/src/AboutDialog2.cpp @@ -2,8 +2,7 @@ #include "AboutDialog.h" #include "PythonScriptVersion.h" #include "resource.h" - -//using namespace std; +#include "PluginInterface.h" AboutDialog::AboutDialog(void) { @@ -73,4 +72,9 @@ BOOL CALLBACK AboutDialog::run_dlgProc(HWND hWnd, UINT Message, WPARAM wParam, L } } return FALSE; -} \ No newline at end of file +} + +void AboutDialog::init( HINSTANCE hInst, NppData& nppData ) +{ + Window::init(hInst, nppData._nppHandle); +} diff --git a/PythonScript/src/ConfigFile.cpp b/PythonScript/src/ConfigFile.cpp index 30756c92..75344d2f 100644 --- a/PythonScript/src/ConfigFile.cpp +++ b/PythonScript/src/ConfigFile.cpp @@ -159,4 +159,4 @@ const std::string& ConfigFile::getMenuScript(int index) const { return m_emptyString; } -} \ No newline at end of file +} diff --git a/PythonScript/src/ConfigFile.h b/PythonScript/src/ConfigFile.h index 0cf498c7..45a78074 100644 --- a/PythonScript/src/ConfigFile.h +++ b/PythonScript/src/ConfigFile.h @@ -1,8 +1,6 @@ #ifndef _CONFIGFILE_H #define _CONFIGFILE_H -#include "stdafx.h" - class ConfigFile { public: diff --git a/PythonScript/src/ConsoleDialog.cpp b/PythonScript/src/ConsoleDialog.cpp index b7f3c35f..09bbf893 100644 --- a/PythonScript/src/ConsoleDialog.cpp +++ b/PythonScript/src/ConsoleDialog.cpp @@ -1,11 +1,10 @@ #include "stdafx.h" #include "ConsoleDialog.h" -#include "Notepad_Plus_msgs.h" -#include "DockingDlgInterface.h" #include "Scintilla.h" #include "SciLexer.h" #include "resource.h" #include "PythonConsole.h" +#include "PluginInterface.h" using namespace std; @@ -29,7 +28,7 @@ ConsoleDialog::~ConsoleDialog() } -void ConsoleDialog::init(HINSTANCE hInst, NppData nppData, ConsoleInterface* console) +void ConsoleDialog::init(HINSTANCE hInst, NppData& nppData, ConsoleInterface* console) { DockingDlgInterface::init(hInst, nppData._nppHandle); @@ -993,4 +992,4 @@ void ConsoleDialog::onHotspotClick(SCNotification* notification) } } -} \ No newline at end of file +} diff --git a/PythonScript/src/ConsoleDialog.h b/PythonScript/src/ConsoleDialog.h index e9e087ec..ba9f449d 100644 --- a/PythonScript/src/ConsoleDialog.h +++ b/PythonScript/src/ConsoleDialog.h @@ -1,12 +1,14 @@ #ifndef _CONSOLEDIALOG_H #define _CONSOLEDIALOG_H -#include "stdafx.h" +#ifndef DOCKINGDLGINTERFACE_H #include "DockingDlgInterface.h" -#include "PluginInterface.h" +#endif void export_console(); +struct SCNotification; +struct NppData; class ConsoleInterface; struct LineDetails; @@ -17,7 +19,7 @@ class ConsoleDialog : public DockingDlgInterface ~ConsoleDialog(); - void init(HINSTANCE hInst, NppData nppData, ConsoleInterface *console); + void init(HINSTANCE hInst, NppData& nppData, ConsoleInterface *console); void doDialog(); void hide(); diff --git a/PythonScript/src/ConsoleInterface.h b/PythonScript/src/ConsoleInterface.h index 064575bd..a5c66f25 100644 --- a/PythonScript/src/ConsoleInterface.h +++ b/PythonScript/src/ConsoleInterface.h @@ -1,8 +1,6 @@ #ifndef _CONSOLEINTERFACE_H #define _CONSOLEINTERFACE_H -#include "stdafx.h" - class ConsoleInterface { public: diff --git a/PythonScript/src/DynamicIDManager.cpp b/PythonScript/src/DynamicIDManager.cpp index e39d39ed..1563504a 100644 --- a/PythonScript/src/DynamicIDManager.cpp +++ b/PythonScript/src/DynamicIDManager.cpp @@ -2,6 +2,7 @@ #include "stdafx.h" #include "DynamicIDManager.h" +#include "IDAllocator.h" using namespace std; @@ -144,4 +145,4 @@ bool DynamicIDManager::inRange(int id) } return retVal; -} \ No newline at end of file +} diff --git a/PythonScript/src/DynamicIDManager.h b/PythonScript/src/DynamicIDManager.h index 024a817a..f45a0dc0 100644 --- a/PythonScript/src/DynamicIDManager.h +++ b/PythonScript/src/DynamicIDManager.h @@ -1,7 +1,7 @@ #ifndef _DYNAMICIDMANAGER_H #define _DYNAMICIDMANAGER_H -#include "IDAllocator.h" +class IDAllocator; class DynamicIDManager { diff --git a/PythonScript/src/Enums.h b/PythonScript/src/Enums.h index 3adf37ea..ef7805ca 100644 --- a/PythonScript/src/Enums.h +++ b/PythonScript/src/Enums.h @@ -1,10 +1,13 @@ #ifndef _ENUMS_H #define _ENUMS_H -#include "stdafx.h" -#include "Scintilla.h" +#ifndef SCILEXER_H #include "SciLexer.h" +#endif + +#ifndef _SCINTILLANOTIFICATIONS_H #include "ScintillaNotifications.h" +#endif void export_enums(); diff --git a/PythonScript/src/EnumsWrapper.cpp b/PythonScript/src/EnumsWrapper.cpp index f51fb66f..01e8c4c8 100644 --- a/PythonScript/src/EnumsWrapper.cpp +++ b/PythonScript/src/EnumsWrapper.cpp @@ -1,8 +1,6 @@ #include "stdafx.h" -#include "Scintilla.h" #include "Enums.h" - using namespace boost::python; void export_enums() @@ -1178,4 +1176,4 @@ void export_enums() .value("SCI_DESCRIBEKEYWORDSETS", PYSCR_SCI_DESCRIBEKEYWORDSETS); /* --Autogenerated --------------------------------------------*/ -} \ No newline at end of file +} diff --git a/PythonScript/src/HelpController.cpp b/PythonScript/src/HelpController.cpp index 5e8c19e0..dd46a610 100644 --- a/PythonScript/src/HelpController.cpp +++ b/PythonScript/src/HelpController.cpp @@ -2,7 +2,6 @@ #include "HelpController.h" #include "Scintilla.h" -#include #include "Notepad_plus_msgs.h" #include "WcharMbcsConverter.h" #include "PythonScriptVersion.h" diff --git a/PythonScript/src/MenuManager.cpp b/PythonScript/src/MenuManager.cpp index 6aad9d3c..9bd48dcb 100644 --- a/PythonScript/src/MenuManager.cpp +++ b/PythonScript/src/MenuManager.cpp @@ -1,10 +1,9 @@ #include "stdafx.h" #include "keys.h" #include "MenuManager.h" -#include "Notepad_Plus_Msgs.h" #include "WcharMbcsConverter.h" #include "ConfigFile.h" -#include +#include "PluginInterface.h" #include "StaticIDAllocator.h" #include "NppAllocator.h" #include "DynamicIDManager.h" @@ -1074,4 +1073,4 @@ bool MenuManager::inDynamicRange(int commandID) bool MenuManager::inFixedRange(int commandID) { return m_originalDynamicMenuManager->inRange(commandID); -} \ No newline at end of file +} diff --git a/PythonScript/src/MenuManager.h b/PythonScript/src/MenuManager.h index 8a57afac..70b12510 100644 --- a/PythonScript/src/MenuManager.h +++ b/PythonScript/src/MenuManager.h @@ -1,7 +1,11 @@ -#include "stdafx.h" +#ifndef _MENUMANAGER_H +#define _MENUMANAGER_H +#ifndef _PYTHONSCRIPT_H #include "PythonScript.h" -#include "PluginInterface.h" +#endif + +struct ShortcutKey; // The DYNAMIC_ADD_ID is used for the CommandIDs for dynamic menu entries added between restarts // It is added to the ID allocated to the first /real/ menu item (ie. probably "New Script") @@ -196,3 +200,4 @@ class MenuManager }; +#endif _MENUMANAGER_H diff --git a/PythonScript/src/NotepadPlusBuffer.h b/PythonScript/src/NotepadPlusBuffer.h index 824ecaeb..f30001e9 100644 --- a/PythonScript/src/NotepadPlusBuffer.h +++ b/PythonScript/src/NotepadPlusBuffer.h @@ -1,4 +1,5 @@ -#include "stdafx.h" +#ifndef _NOTEPADPLUSBUFFER_H +#define _NOTEPADPLUSBUFFER_H enum DOCUMENTSTATUS { @@ -31,4 +32,6 @@ class NotepadPlusBuffer int m_bufferID; tstring m_filename; DOCUMENTSTATUS m_status; -}; \ No newline at end of file +}; + +#endif \ No newline at end of file diff --git a/PythonScript/src/NotepadPlusWrapper.cpp b/PythonScript/src/NotepadPlusWrapper.cpp index e2ed3752..afd07142 100644 --- a/PythonScript/src/NotepadPlusWrapper.cpp +++ b/PythonScript/src/NotepadPlusWrapper.cpp @@ -1,10 +1,12 @@ #include "stdafx.h" +#include "Scintilla.h" #include "WcharMbcsConverter.h" #include "NotepadPlusWrapper.h" -#include "menuCmdID.h" #include "PromptDialog.h" #include "MenuManager.h" +#include "PluginInterface.h" +#include "ScintillaWrapper.h" using namespace std; using namespace boost::python; @@ -855,4 +857,4 @@ object NotepadPlusWrapper::allocateMarker(int quantity) { return object(); } -} \ No newline at end of file +} diff --git a/PythonScript/src/NotepadPlusWrapper.h b/PythonScript/src/NotepadPlusWrapper.h index ac2c9e2a..96986042 100644 --- a/PythonScript/src/NotepadPlusWrapper.h +++ b/PythonScript/src/NotepadPlusWrapper.h @@ -1,11 +1,16 @@ #ifndef _NOTEPADPLUSWRAPPER_H #define _NOTEPADPLUSWRAPPER_H -#include "stdafx.h" +#ifndef NOTEPAD_PLUS_MSGS_H #include "Notepad_plus_msgs.h" +#endif + +#ifndef MENUCMDID_H #include "menuCmdID.h" -#include "PluginInterface.h" -#include "ScintillaWrapper.h" +#endif + +struct SCNotification; +class ScintillaWrapper; enum FormatType { @@ -460,9 +465,9 @@ class NotepadPlusWrapper void loadSession(boost::python::str filename); - void activateFileString(str filename); + void activateFileString(boost::python::str filename); - void reloadFile(str filename, bool withAlert); + void reloadFile(boost::python::str filename, bool withAlert); void saveAllFiles(); @@ -529,7 +534,7 @@ class NotepadPlusWrapper boost::python::object prompt(boost::python::object promptObj, boost::python::object title, boost::python::object initial); boost::python::object promptDefault(boost::python::object promptObj, boost::python::object title) - { return prompt(promptObj, title, object()); }; + { return prompt(promptObj, title, boost::python::object()); }; boost::python::str getBufferFilename(int bufferID); boost::python::str getCurrentFilename(); diff --git a/PythonScript/src/NotepadPython.cpp b/PythonScript/src/NotepadPython.cpp index 4a209cdb..6b8b89f0 100644 --- a/PythonScript/src/NotepadPython.cpp +++ b/PythonScript/src/NotepadPython.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" -#include "NotepadPython.h" -#include "Notepad_Plus_msgs.h" #include "NotepadPlusWrapper.h" +#include "ScintillaWrapper.h" + #include "ProcessExecute.h" using namespace boost::python; diff --git a/PythonScript/src/NotepadPython.h b/PythonScript/src/NotepadPython.h index 97622679..948da367 100644 --- a/PythonScript/src/NotepadPython.h +++ b/PythonScript/src/NotepadPython.h @@ -1,12 +1,10 @@ #ifndef _NOTEPADPYTHON_H #define _NOTEPADPYTHON_H -#include "stdafx.h" -#include "NotepadPlusWrapper.h" +class NotepadPlusWrapper; void export_notepad(); - void importNotepad(NotepadPlusWrapper* instance); diff --git a/PythonScript/src/NppAllocator.cpp b/PythonScript/src/NppAllocator.cpp index 1b222559..f59bf347 100644 --- a/PythonScript/src/NppAllocator.cpp +++ b/PythonScript/src/NppAllocator.cpp @@ -1,8 +1,8 @@ #include "stdafx.h" #include "NppAllocator.h" -#include +#include "Notepad_plus_msgs.h" bool NppAllocator::allocate(int quantity, int *start) { return TRUE == ::SendMessage(m_hNotepad, NPPM_ALLOCATECMDID, quantity, reinterpret_cast(start)); -} \ No newline at end of file +} diff --git a/PythonScript/src/NppAllocator.h b/PythonScript/src/NppAllocator.h index 0241b2e4..f92db268 100644 --- a/PythonScript/src/NppAllocator.h +++ b/PythonScript/src/NppAllocator.h @@ -1,7 +1,9 @@ #ifndef _NPPALLOCATOR_H #define _NPPALLOCATOR_H +#ifndef _IDALLOCATOR_H #include "IDAllocator.h" +#endif class NppAllocator : public IDAllocator { diff --git a/PythonScript/src/ProcessExecute.cpp b/PythonScript/src/ProcessExecute.cpp index 07e73fce..75786c54 100644 --- a/PythonScript/src/ProcessExecute.cpp +++ b/PythonScript/src/ProcessExecute.cpp @@ -1,7 +1,6 @@ #include "stdafx.h" #include "ProcessExecute.h" #include "WcharMbcsConverter.h" -#include /* The Console Redirection is taken from the TagsView plugin from Vitaliy Dovgan. * My thanks to him for pointing me in the right direction. :) @@ -422,4 +421,4 @@ void ProcessExecute::spoolFile(fstream* file, object pyStdout, object pyStderr) } -} \ No newline at end of file +} diff --git a/PythonScript/src/ProcessExecute.h b/PythonScript/src/ProcessExecute.h index 6e28cb0c..616328cb 100644 --- a/PythonScript/src/ProcessExecute.h +++ b/PythonScript/src/ProcessExecute.h @@ -1,7 +1,5 @@ #ifndef _PROCESSEXECUTE_H #define _PROCESSEXECUTE_H -#include -#include "stdafx.h" struct PipeReaderArgs; diff --git a/PythonScript/src/PromptDialog.h b/PythonScript/src/PromptDialog.h index 364f2fd7..efa0b5a3 100644 --- a/PythonScript/src/PromptDialog.h +++ b/PythonScript/src/PromptDialog.h @@ -1,11 +1,6 @@ #ifndef _PROMPTDIALOG_H #define _PROMPTDIALOG_H -#include "stdafx.h" - - - - class PromptDialog { public: diff --git a/PythonScript/src/PyProducerConsumer.h b/PythonScript/src/PyProducerConsumer.h index aaec707b..91869b8e 100644 --- a/PythonScript/src/PyProducerConsumer.h +++ b/PythonScript/src/PyProducerConsumer.h @@ -1,7 +1,5 @@ #ifndef _PYPRODUCER_H #define _PYPRODUCER_H -#include "stdafx.h" -#include namespace NppPythonScript { diff --git a/PythonScript/src/PythonConsole.cpp b/PythonScript/src/PythonConsole.cpp index 9c2b8a05..643e2e8f 100644 --- a/PythonScript/src/PythonConsole.cpp +++ b/PythonScript/src/PythonConsole.cpp @@ -1,4 +1,3 @@ - #include "stdafx.h" #include "WcharMbcsConverter.h" #include "PythonConsole.h" @@ -7,8 +6,8 @@ #include "ProcessExecute.h" #include "PluginInterface.h" #include "ScintillaWrapper.h" -#include "Notepad_plus_msgs.h" #include "PythonScript/NppPythonScript.h" +#include "scintilla.h" // Sad, but we need to know if we're in an event handler when running an external command // Not sure how I can extrapolate this info and not tie PythonConsole and NotepadPlusWrapper together. @@ -22,25 +21,27 @@ PythonConsole::PythonConsole(HWND hNotepad) : PyProducerConsumer(), m_consumerStarted(false), m_hNotepad(hNotepad), - mp_scintillaWrapper(NULL) + mp_scintillaWrapper(new ScintillaWrapper(NULL)), + m_nppData(new NppData) { mp_consoleDlg = new ConsoleDialog(); m_statementRunning = CreateEvent(NULL, FALSE, TRUE, NULL); - } PythonConsole::~PythonConsole() { delete mp_consoleDlg; + delete m_nppData; + delete mp_scintillaWrapper; } -void PythonConsole::init(HINSTANCE hInst, NppData nppData) +void PythonConsole::init(HINSTANCE hInst, NppData& nppData) { mp_consoleDlg->init(hInst, nppData, this); - m_nppData = nppData; - mp_scintillaWrapper.setHandle(mp_consoleDlg->getScintillaHwnd()); + *m_nppData = nppData; + mp_scintillaWrapper->setHandle(mp_consoleDlg->getScintillaHwnd()); } @@ -248,6 +249,11 @@ void PythonConsole::openFile(const char *filename, int lineNo) int currentView; SendMessage(m_hNotepad, NPPM_GETCURRENTSCINTILLA, 0, reinterpret_cast(¤tView)); - SendMessage(currentView ? m_nppData._scintillaSecondHandle : m_nppData._scintillaMainHandle, SCI_GOTOLINE, lineNo, 0); + SendMessage(currentView ? m_nppData->_scintillaSecondHandle : m_nppData->_scintillaMainHandle, SCI_GOTOLINE, lineNo, 0); } -} \ No newline at end of file +} + +HWND PythonConsole::getScintillaHwnd() +{ + return mp_consoleDlg->getScintillaHwnd(); +} diff --git a/PythonScript/src/PythonConsole.h b/PythonScript/src/PythonConsole.h index 54aefc23..45be0150 100644 --- a/PythonScript/src/PythonConsole.h +++ b/PythonScript/src/PythonConsole.h @@ -1,16 +1,19 @@ #ifndef _PYTHONCONSOLE_H #define _PYTHONCONSOLE_H -#include "stdafx.h" -#include "PluginInterface.h" -#include "ConsoleDialog.h" -#include "PyProducerConsumer.h" +#ifndef _CONSOLEINTERFACE_H #include "ConsoleInterface.h" -#include "ScintillaWrapper.h" +#endif + +#ifndef _PYPRODUCER_H +#include "PyProducerConsumer.h" +#endif class PythonHandler; class ScintillaWrapper; +class ConsoleDialog; struct RunStatementArgs; +struct NppData; class PythonConsole : public NppPythonScript::PyProducerConsumer, ConsoleInterface { @@ -18,7 +21,7 @@ class PythonConsole : public NppPythonScript::PyProducerConsumer, PythonConsole(HWND hNotepad); ~PythonConsole(); - void init(HINSTANCE hInst, NppData nppData); + void init(HINSTANCE hInst, NppData& nppData); void initPython(PythonHandler *pythonHandler); void showDialog(); @@ -48,26 +51,24 @@ class PythonConsole : public NppPythonScript::PyProducerConsumer, long runCommand(boost::python::str text, boost::python::object pyStdout, boost::python::object pyStderr); long runCommandNoStderr(boost::python::str text, boost::python::object pyStdout) - { - boost::python::object sys_module( (boost::python::handle<>(PyImport_ImportModule("sys"))) ); - boost::python::object sys_namespace = sys_module.attr("__dict__"); - return runCommand(text, pyStdout, sys_namespace["stderr"]); - } + { + boost::python::object sys_module( (boost::python::handle<>(PyImport_ImportModule("sys"))) ); + boost::python::object sys_namespace = sys_module.attr("__dict__"); + return runCommand(text, pyStdout, sys_namespace["stderr"]); + } long runCommandNoStdout(boost::python::str text) - { - boost::python::object sys_module( (boost::python::handle<>(PyImport_ImportModule("sys"))) ); - boost::python::object sys_namespace = sys_module.attr("__dict__"); - boost::python::object npp_module( (boost::python::handle<>(PyImport_ImportModule("Npp"))) ); - boost::python::object npp_namespace = npp_module.attr("__dict__"); - return runCommand(text, npp_namespace["console"], sys_namespace["stderr"]); - } - - + { + boost::python::object sys_module( (boost::python::handle<>(PyImport_ImportModule("sys"))) ); + boost::python::object sys_namespace = sys_module.attr("__dict__"); + boost::python::object npp_module( (boost::python::handle<>(PyImport_ImportModule("Npp"))) ); + boost::python::object npp_namespace = npp_module.attr("__dict__"); + return runCommand(text, npp_namespace["console"], sys_namespace["stderr"]); + } - HWND getScintillaHwnd() { return mp_consoleDlg->getScintillaHwnd(); }; + HWND getScintillaHwnd(); - ScintillaWrapper mp_scintillaWrapper; + ScintillaWrapper* mp_scintillaWrapper; protected: virtual void queueComplete(); @@ -84,7 +85,7 @@ class PythonConsole : public NppPythonScript::PyProducerConsumer, HWND m_hNotepad; bool m_consumerStarted; - NppData m_nppData; + NppData* m_nppData; }; void export_console(); diff --git a/PythonScript/src/PythonHandler.cpp b/PythonScript/src/PythonHandler.cpp index fcd061f8..00712f1f 100644 --- a/PythonScript/src/PythonHandler.cpp +++ b/PythonScript/src/PythonHandler.cpp @@ -1,15 +1,12 @@ #include "stdafx.h" #include "PythonHandler.h" -#include "Python.h" - +#include "Scintilla.h" #include "ScintillaWrapper.h" #include "ScintillaPython.h" #include "NotepadPlusWrapper.h" #include "NotepadPython.h" #include "PythonConsole.h" -#include "PluginInterface.h" -#include "PyProducerConsumer.h" #include "MenuManager.h" @@ -284,4 +281,4 @@ void PythonHandler::stopScriptWorker(PythonHandler *handler) PyThreadState_SetAsyncExc(handler->getExecutingThreadID(), PyExc_KeyboardInterrupt); PyGILState_Release(gstate); -} \ No newline at end of file +} diff --git a/PythonScript/src/PythonHandler.h b/PythonScript/src/PythonHandler.h index 75997e11..80154ab0 100644 --- a/PythonScript/src/PythonHandler.h +++ b/PythonScript/src/PythonHandler.h @@ -1,9 +1,9 @@ -#pragma once +#ifndef _PYTHONHANDLER_H +#define _PYTHONHANDLER_H - -#include "stdafx.h" +#ifndef _PYPRODUCER_H #include "PyProducerConsumer.h" - +#endif // Forward def class ScintillaWrapper; @@ -12,8 +12,6 @@ class PythonConsole; struct SCNotification; struct RunScriptArgs; - - class PythonHandler : NppPythonScript::PyProducerConsumer { public: @@ -85,3 +83,5 @@ struct RunScriptArgs HANDLE completedEvent; bool isStatement; }; + +#endif \ No newline at end of file diff --git a/PythonScript/src/PythonScript.cpp b/PythonScript/src/PythonScript.cpp index eb905186..a2bac964 100644 --- a/PythonScript/src/PythonScript.cpp +++ b/PythonScript/src/PythonScript.cpp @@ -3,22 +3,16 @@ #include "stdafx.h" #include "PluginInterface.h" -#include "PythonScript.h" #include "AboutDialog.h" -#include "ConsoleDialog.h" #include "MenuManager.h" +#include "Scintilla.h" #include "WcharMbcsConverter.h" #include "PythonHandler.h" #include "PythonConsole.h" -//#include "NotepadPlusWrapper.h" #include "ShortcutDlg.h" -#include "Python.h" -#include "ConfigFile.h" #include "HelpController.h" #include "PythonScript/NppPythonScript.h" -#include -#include using namespace boost::python; @@ -567,7 +561,7 @@ void newScript() ofn.lStructSize = sizeof(OPENFILENAMEA); ofn.hwndOwner = nppData._nppHandle; - shared_ptr userScriptsDir = WcharMbcsConverter::tchar2char(ConfigFile::getInstance()->getUserScriptsDir().c_str()); + std::tr1::shared_ptr userScriptsDir = WcharMbcsConverter::tchar2char(ConfigFile::getInstance()->getUserScriptsDir().c_str()); ofn.lpstrInitialDir = userScriptsDir.get(); //ofn.lpstrFileTitle = "Choose filename for new script"; ofn.lpstrFile = new char[MAX_PATH]; @@ -647,4 +641,4 @@ void doHelp() void previousScript() { runScript(g_previousScript.c_str(), false); -} \ No newline at end of file +} diff --git a/PythonScript/src/PythonScript.h b/PythonScript/src/PythonScript.h index 47387b7e..c5330902 100644 --- a/PythonScript/src/PythonScript.h +++ b/PythonScript/src/PythonScript.h @@ -1,15 +1,9 @@ - #ifndef _PYTHONSCRIPT_H #define _PYTHONSCRIPT_H - - -#include "Notepad_plus_msgs.h" - #define PLUGINTEMPLATE_INI _T("\\PythonScript.ini") #define MAX_MENU_SCRIPTS 50 #define FIXED_MENU_ITEMS 9 - #endif diff --git a/PythonScript/src/PythonScriptVersion.h b/PythonScript/src/PythonScriptVersion.h index a3b334e0..7e3d7d00 100644 --- a/PythonScript/src/PythonScriptVersion.h +++ b/PythonScript/src/PythonScriptVersion.h @@ -1,13 +1,7 @@ #ifndef _PYTHONSCRIPTVERSION_H #define _PYTHONSCRIPTVERSION_H -#ifndef RC_INVOKED -#include "stdafx.h" -#endif - #define PYSCR_VERSION_NUMERIC 0,8,0,0 #define PYSCR_VERSION_STRING "0.8.0.0" - - #endif diff --git a/PythonScript/src/Scintilla.h b/PythonScript/src/Scintilla.h index c20a063f..e1547c9e 100644 --- a/PythonScript/src/Scintilla.h +++ b/PythonScript/src/Scintilla.h @@ -29,9 +29,9 @@ int Scintilla_LinkLexers(); /* Here should be placed typedefs for uptr_t, an unsigned integer type large enough to * hold a pointer and sptr_t, a signed integer large enough to hold a pointer. * May need to be changed for 64 bit platforms. */ -#if defined(_WIN32) -#include -#endif +//#if defined(_WIN32) +//#include +//#endif #ifdef MAXULONG_PTR typedef ULONG_PTR uptr_t; typedef LONG_PTR sptr_t; diff --git a/PythonScript/src/ScintillaCells.cpp b/PythonScript/src/ScintillaCells.cpp index 8f0e6317..448ddb22 100644 --- a/PythonScript/src/ScintillaCells.cpp +++ b/PythonScript/src/ScintillaCells.cpp @@ -1,9 +1,5 @@ #include "stdafx.h" -#include "Python.h" -#include - - #include "ScintillaCells.h" using namespace boost::python; diff --git a/PythonScript/src/ScintillaCells.h b/PythonScript/src/ScintillaCells.h index bf7563fe..a4adaa3e 100644 --- a/PythonScript/src/ScintillaCells.h +++ b/PythonScript/src/ScintillaCells.h @@ -1,9 +1,6 @@ #ifndef _SCINTILLACELL_H #define _SCINTILLACELL_H -#include -#include - class ScintillaCells { public: diff --git a/PythonScript/src/ScintillaNotifications.h b/PythonScript/src/ScintillaNotifications.h index a17e6bba..f70c16b5 100644 --- a/PythonScript/src/ScintillaNotifications.h +++ b/PythonScript/src/ScintillaNotifications.h @@ -1,9 +1,9 @@ #ifndef _SCINTILLANOTIFICATIONS_H #define _SCINTILLANOTIFICATIONS_H -#include "stdafx.h" - +#ifndef SCINTILLA_H #include "Scintilla.h" +#endif enum ScintillaNotificationInternal { diff --git a/PythonScript/src/ScintillaPython.cpp b/PythonScript/src/ScintillaPython.cpp index b323250d..564b742f 100644 --- a/PythonScript/src/ScintillaPython.cpp +++ b/PythonScript/src/ScintillaPython.cpp @@ -1,16 +1,12 @@ #include "stdafx.h" -#include -#include "Python.h" +#include "NotepadPlusWrapper.h" #include "ScintillaWrapper.h" -#include "ScintillaPython.h" -#include "ScintillaCells.h" -#include "Scintilla.h" -#include "Enums.h" #include "NotepadPython.h" #include "PythonConsole.h" +#include "enums.h" using namespace boost::python; @@ -702,4 +698,4 @@ void importConsole(PythonConsole* instance) // Create an instance variable buffer in __main__ that points to the PythonConsole instance main_namespace["console"] = ptr(instance); -} \ No newline at end of file +} diff --git a/PythonScript/src/ScintillaWrapper.cpp b/PythonScript/src/ScintillaWrapper.cpp index ab38f7b8..03cc621c 100644 --- a/PythonScript/src/ScintillaWrapper.cpp +++ b/PythonScript/src/ScintillaWrapper.cpp @@ -3,12 +3,6 @@ #include "ScintillaWrapper.h" #include "Scintilla.h" -#include - -#include "ScintillaCells.h" -#include "PyProducerConsumer.h" -#include "ProcessExecute.h" - using namespace std; using namespace boost::python; @@ -997,4 +991,4 @@ str ScintillaWrapper::getWord(object position, object useOnlyWordChars /* = true str retVal(const_cast(tr.lpstrText)); delete[] tr.lpstrText; return retVal; -} \ No newline at end of file +} diff --git a/PythonScript/src/ScintillaWrapper.h b/PythonScript/src/ScintillaWrapper.h index 9cbca3e7..696a4e68 100644 --- a/PythonScript/src/ScintillaWrapper.h +++ b/PythonScript/src/ScintillaWrapper.h @@ -1,12 +1,15 @@ #ifndef _SCINTILLAWRAPPER_H #define _SCINTILLAWRAPPER_H -#include "stdafx.h" -#include "ScintillaNotifications.h" +#ifndef _SCINTILLACELL_H #include "ScintillaCells.h" -#include "Enums.h" +#endif + +#ifndef _PYPRODUCER_H #include "PyProducerConsumer.h" -#include +#endif + +struct SCNotification; using namespace boost::python; diff --git a/PythonScript/src/ShortcutDlg.cpp b/PythonScript/src/ShortcutDlg.cpp index ab3f21d0..265e3b44 100644 --- a/PythonScript/src/ShortcutDlg.cpp +++ b/PythonScript/src/ShortcutDlg.cpp @@ -1,12 +1,8 @@ #include "stdafx.h" -#include - #include "ShortcutDlg.h" #include "PluginInterface.h" #include "resource.h" -#include "Notepad_Plus_Msgs.h" -#include "ConfigFile.h" #include "MenuManager.h" using namespace std; @@ -15,7 +11,7 @@ using namespace std; //const int ShortcutDlg::COLUMN_PADDING; -ShortcutDlg::ShortcutDlg(HINSTANCE hInst, NppData nppData, const TCHAR *scriptDirAppend) +ShortcutDlg::ShortcutDlg(HINSTANCE hInst, NppData& nppData, const TCHAR *scriptDirAppend) { Window::init(hInst, nppData._nppHandle); TCHAR temp[MAX_PATH]; @@ -542,4 +538,4 @@ void ShortcutDlg::toolbarSetIcon() ListView_SetItem(m_hListToolbarItems, &lvItem); } } -} \ No newline at end of file +} diff --git a/PythonScript/src/ShortcutDlg.h b/PythonScript/src/ShortcutDlg.h index 00069e6b..27455425 100644 --- a/PythonScript/src/ShortcutDlg.h +++ b/PythonScript/src/ShortcutDlg.h @@ -1,15 +1,20 @@ #ifndef _SHORTCUTDLG_H #define _SHORTCUTDLG_H -#include "stdafx.h" +#ifndef STATIC_DIALOG_H #include "StaticDialog.h" -#include "PluginInterface.h" +#endif + +#ifndef _CONFIGFILE_H #include "ConfigFile.h" +#endif + +struct NppData; class ShortcutDlg : StaticDialog { public: - ShortcutDlg(HINSTANCE hInst, NppData nppData, const TCHAR *scriptDirAppend); + ShortcutDlg(HINSTANCE hInst, NppData& nppData, const TCHAR *scriptDirAppend); BOOL CALLBACK run_dlgProc(HWND hWnd, UINT Message, WPARAM wParam, LPARAM lParam); void doDialog(); diff --git a/PythonScript/src/StaticIDAllocator.cpp b/PythonScript/src/StaticIDAllocator.cpp index 7bfa9041..af13dfda 100644 --- a/PythonScript/src/StaticIDAllocator.cpp +++ b/PythonScript/src/StaticIDAllocator.cpp @@ -15,6 +15,3 @@ bool StaticIDAllocator::allocate(int quantity, int *start) return retVal; } - - - \ No newline at end of file diff --git a/PythonScript/src/StaticIDAllocator.h b/PythonScript/src/StaticIDAllocator.h index b65597cd..6dc63876 100644 --- a/PythonScript/src/StaticIDAllocator.h +++ b/PythonScript/src/StaticIDAllocator.h @@ -1,7 +1,9 @@ #ifndef _STATICIDALLOCATOR_H #define _STATICIDALLOCATOR_H +#ifndef _IDALLOCATOR_H #include "IDAllocator.h" +#endif class StaticIDAllocator : public IDAllocator { diff --git a/PythonScript/src/WcharMbcsConverter.cpp b/PythonScript/src/WcharMbcsConverter.cpp index 3dba5fda..0d6cd112 100644 --- a/PythonScript/src/WcharMbcsConverter.cpp +++ b/PythonScript/src/WcharMbcsConverter.cpp @@ -21,7 +21,7 @@ Modified for inclusion in VS2010 project "Python Script" */ #include "stdafx.h" #include "WcharMbcsConverter.h" -#include + using namespace std; diff --git a/PythonScript/src/WcharMbcsConverter.h b/PythonScript/src/WcharMbcsConverter.h index e2619b42..401f7f8f 100644 --- a/PythonScript/src/WcharMbcsConverter.h +++ b/PythonScript/src/WcharMbcsConverter.h @@ -22,9 +22,6 @@ Modified for inclusion in VS2010 project "Python Script" #ifndef _WCHARMBCSCONVERTER_H #define _WCHARMBCSCONVERTER_H -#include -#include - class WcharMbcsConverter { public: diff --git a/PythonScript/src/stdafx.h b/PythonScript/src/stdafx.h index 97211743..6d35677a 100644 --- a/PythonScript/src/stdafx.h +++ b/PythonScript/src/stdafx.h @@ -27,20 +27,23 @@ // Windows Header Files: #include #include - - +#include +#include +#include +#include +#include +#include #include + +#include #include -#include #include #include #include -#include #include -#include -#include -#include +#include +#include #pragma warning( push ) @@ -54,6 +57,6 @@ #include #pragma warning( pop ) -#include "Python.h" +#include typedef std::basic_string tstring;