Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,5 @@ Release_Archive/
installer/build/
installer/temp/
Thumbs.db
installer/buildPaths.bat
installer/buildPaths.bat
.vs/
5 changes: 4 additions & 1 deletion PythonScript/src/NotepadPlusWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ NotepadPlusWrapper::NotepadPlusWrapper(HINSTANCE hInst, HWND nppHandle)
m_hInst(hInst),
m_notificationsEnabled(false),
m_callbackMutex(::CreateMutex(NULL, FALSE, NULL))
{ }
{
hwnd = (intptr_t)nppHandle;
}

NotepadPlusWrapper::~NotepadPlusWrapper()
{
Expand All @@ -40,6 +42,7 @@ NotepadPlusWrapper::~NotepadPlusWrapper()
// To please Lint, let's NULL these handles and pointers
m_nppHandle = NULL;
m_hInst = NULL;
hwnd = NULL;
}

void NotepadPlusWrapper::notify(SCNotification *notifyCode)
Expand Down
2 changes: 2 additions & 0 deletions PythonScript/src/NotepadPlusWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,8 @@ class NotepadPlusWrapper
void setStatusBar(StatusBarSection section, const char *text);

intptr_t getPluginMenuHandle();

intptr_t hwnd;

void activateIndex(int view, int index);

Expand Down
1 change: 1 addition & 0 deletions PythonScript/src/NotepadPython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ void export_notepad()
boost::python::register_exception_translator<InvalidValueProvidedException>(&translateInvalidValueProvidedException);

boost::python::class_<NotepadPlusWrapper, boost::shared_ptr<NotepadPlusWrapper>, boost::noncopyable>("Notepad", boost::python::no_init)
.add_property("hwnd", &NotepadPlusWrapper::hwnd)
.def("new", &NotepadPlusWrapper::newDocument, "Create a new document")
.def("new", &NotepadPlusWrapper::newDocumentWithFilename, "Create a new document with the given filename")
.def("save", &NotepadPlusWrapper::save, "Save the current file")
Expand Down
1 change: 0 additions & 1 deletion PythonScript/src/PythonConsole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,6 @@ void export_console()
.def("run", &PythonConsole::runCommand, "Runs a command on the console")
.def("run", &PythonConsole::runCommandNoStderr, "Runs a command on the console")
.def("run", &PythonConsole::runCommandNoStdout, "Runs a command on the console")
.def("getScintillaHwnd", &PythonConsole::getScintillaHwndPython, "Provide HWnd for scintilla of console")
.add_static_property("encoding", &PythonConsole::getEncoding)
.add_property("editor", &PythonConsole::getScintillaWrapper);
//lint +e1793
Expand Down
1 change: 0 additions & 1 deletion PythonScript/src/PythonConsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ class PythonConsole : public PyProducerConsumer<std::string>, public ConsoleInte
}

HWND getScintillaHwnd();
intptr_t getScintillaHwndPython() { return (intptr_t)getScintillaHwnd(); }

boost::shared_ptr<ScintillaWrapper> getScintillaWrapper() { return mp_scintillaWrapper; }

Expand Down
1 change: 1 addition & 0 deletions PythonScript/src/ScintillaPython.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ BOOST_PYTHON_MODULE(Npp)
boost::python::register_exception_translator<NotAllowedInCallbackException>(&translateNotAllowedInCallbackException);

boost::python::class_<ScintillaWrapper, boost::shared_ptr<ScintillaWrapper>, boost::noncopyable >("Editor", boost::python::no_init)
.add_property("hwnd", &ScintillaWrapper::hwnd)
.def("write", &ScintillaWrapper::AddText, "Add text to the document at current position (alias for addText).")
.def("callbackSync", &ScintillaWrapper::addSyncCallback, boost::python::args("callable", "listOfNotifications"), "Registers a callback to a Python function when a Scintilla event occurs. See also callback() to register an asynchronous callback. Callbacks are called synchronously with the event, so try not to perform too much work in the event handler.\nCertain operations cannot be performed in a synchronous callback. setDocPointer, searchInTarget or findText calls are examples. Scintilla doesn't allow recursively modifying the text, so you can't modify the text in a SCINTILLANOTIFICATION.MODIFIED callback - use a standard Asynchronous callback to do this.\ne.g. editor.callbackSync(my_function, [SCINTILLANOTIFICATION.CHARADDED])")
.def("callback", &ScintillaWrapper::addAsyncCallback, boost::python::args("callable", "listOfNotifications"), "Registers a callback to call a Python function synchronously when a Scintilla event occurs. Events are queued up, and run in the order they arrive, one after the other, but asynchronously with the main GUI. See editor.callbackSync() to register a synchronous callback. e.g. editor.callback(my_function, [SCINTILLANOTIFICATION.CHARADDED])")
Expand Down
2 changes: 2 additions & 0 deletions PythonScript/src/ScintillaWrapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,14 @@ ScintillaWrapper::ScintillaWrapper(const HWND handle, const HWND notepadHandle)
m_notificationsEnabled(false),
m_callbackMutex(::CreateMutex(NULL, FALSE, NULL))
{
hwnd = (intptr_t)handle;
}

ScintillaWrapper::~ScintillaWrapper()
{
// m_handle isn't allocated here. Let's just NULL out reference to it, then.
m_handle = NULL;
hwnd = NULL;
}


Expand Down
6 changes: 5 additions & 1 deletion PythonScript/src/ScintillaWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ class ScintillaWrapper : public PyProducerConsumer<CallbackExecArgs>
explicit ScintillaWrapper(HWND handle, HWND notepadHandle);
virtual ~ScintillaWrapper();

void setHandle(const HWND handle) { m_handle = handle; };
intptr_t hwnd;
void setHandle(const HWND handle) {
m_handle = handle;
hwnd = (intptr_t)handle;
};
HWND getHandle() { return m_handle; };
void invalidateHandle() { m_handle = NULL; };

Expand Down
3 changes: 3 additions & 0 deletions docs/source/console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ Console Object
.. class:: Console


.. property:: hwnd

Returns the handle of the Scintilla window of the editor object used in the console.

.. method:: console.write(string)

Expand Down
4 changes: 4 additions & 0 deletions docs/source/notepad.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Notepad++ Object
.. class:: Notepad


.. property:: hwnd

Returns the handle of the Notepad++ window.


.. method:: notepad.activateBufferID(bufferID)

Expand Down
5 changes: 5 additions & 0 deletions docs/source/scintilla.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ Scintilla Methods
-----------------
.. class:: Editor

.. property:: hwnd

Returns the handles of the two Scintilla windows of the editor object.
Editor.hwnd refers to the active window handle, while editor1 and editor2 return the concrete handles.

.. method:: editor.getCharacterPointer() -> str

Gets a copy of the text of the document, without first allowing Scintilla to make it's copy of it.
Expand Down