diff options
-rw-r--r-- | curses/ScintillaCurses.cxx | 38 | ||||
-rw-r--r-- | curses/ScintillaCurses.h | 27 | ||||
-rw-r--r-- | curses/jinx/jinx.c | 2 |
3 files changed, 33 insertions, 34 deletions
diff --git a/curses/ScintillaCurses.cxx b/curses/ScintillaCurses.cxx index b66ec0920..a126ec1ce 100644 --- a/curses/ScintillaCurses.cxx +++ b/curses/ScintillaCurses.cxx @@ -62,6 +62,8 @@ #define wcwidth(_) 1 // TODO: http://www.cl.cam.ac.uk/~mgk25/ucs/wcwidth.c #endif +using namespace Scintilla; + // Font handling. /** @@ -879,7 +881,7 @@ void Platform::Assert(const char *c, const char *file, int line) { class ScintillaCurses : public ScintillaBase { Surface *sur; // window surface to draw on int width, height; // window dimensions - void (*callback)(Scintilla *, int, void *, void *); // SCNotification callback + void (*callback)(void *, int, void *, void *); // SCNotification callback int scrollBarVPos, scrollBarHPos; // positions of the scroll bars int scrollBarHeight, scrollBarWidth; // height and width of the scroll bars SelectionText clipboard; // current clipboard text @@ -920,8 +922,8 @@ public: * necessary. When the `WINDOW` is created, it will initially be full-screen. * @param callback_ Callback function for Scintilla notifications. */ - ScintillaCurses(void (*callback_)(Scintilla *, int, void *, void *)) : - width(0), height(0), scrollBarHeight(1), scrollBarWidth(1) { + ScintillaCurses(void (*callback_)(void *, int, void *, void *)) : + width(0), height(0), scrollBarHeight(1), scrollBarWidth(1) { callback = callback_; sur = Surface::Allocate(SC_TECHNOLOGY_DEFAULT); @@ -1056,7 +1058,7 @@ public: /** Send Scintilla notifications to the parent. */ void NotifyParent(SCNotification scn) { if (callback) - (*callback)(reinterpret_cast<Scintilla *>(this), 0, (void *)&scn, 0); + (*callback)(reinterpret_cast<void *>(this), 0, (void *)&scn, 0); } /** * Handles an unconsumed key. @@ -1398,24 +1400,22 @@ public: // Link with C. Documentation in Scintilla.h. extern "C" { -Scintilla *scintilla_new(void (*callback)(Scintilla *, int, void *, void *)) { - return reinterpret_cast<Scintilla *>(new ScintillaCurses(callback)); +void *scintilla_new(void (*callback)(void *, int, void *, void *)) { + return reinterpret_cast<void *>(new ScintillaCurses(callback)); } -WINDOW *scintilla_get_window(Scintilla *sci) { +WINDOW *scintilla_get_window(void *sci) { return reinterpret_cast<ScintillaCurses *>(sci)->GetWINDOW(); } -sptr_t scintilla_send_message(Scintilla *sci, unsigned int iMessage, - uptr_t wParam, sptr_t lParam) { +sptr_t scintilla_send_message(void *sci, unsigned int iMessage, uptr_t wParam, + sptr_t lParam) { return reinterpret_cast<ScintillaCurses *>(sci)->WndProc(iMessage, wParam, - lParam); + lParam); } -void scintilla_send_key(Scintilla *sci, int key, bool shift, bool ctrl, - bool alt) { +void scintilla_send_key(void *sci, int key, bool shift, bool ctrl, bool alt) { reinterpret_cast<ScintillaCurses *>(sci)->KeyPress(key, shift, ctrl, alt); } -bool scintilla_send_mouse(Scintilla *sci, int event, unsigned int time, - int button, int y, int x, bool shift, bool ctrl, - bool alt) { +bool scintilla_send_mouse(void *sci, int event, unsigned int time, int button, + int y, int x, bool shift, bool ctrl, bool alt) { ScintillaCurses *scicurses = reinterpret_cast<ScintillaCurses *>(sci); WINDOW *w = scicurses->GetWINDOW(); int begy = getbegy(w), begx = getbegx(w); @@ -1432,16 +1432,16 @@ bool scintilla_send_mouse(Scintilla *sci, int event, unsigned int time, return (scicurses->MouseRelease(time, y, x, ctrl), true); return false; } -int scintilla_get_clipboard(Scintilla *sci, char *buffer) { +int scintilla_get_clipboard(void *sci, char *buffer) { return reinterpret_cast<ScintillaCurses *>(sci)->GetClipboard(buffer); } -void scintilla_noutrefresh(Scintilla *sci) { +void scintilla_noutrefresh(void *sci) { reinterpret_cast<ScintillaCurses *>(sci)->NoutRefresh(); } -void scintilla_refresh(Scintilla *sci) { +void scintilla_refresh(void *sci) { reinterpret_cast<ScintillaCurses *>(sci)->Refresh(); } -void scintilla_delete(Scintilla *sci) { +void scintilla_delete(void *sci) { delete reinterpret_cast<ScintillaCurses *>(sci); } } diff --git a/curses/ScintillaCurses.h b/curses/ScintillaCurses.h index 620982c2d..1705d0de2 100644 --- a/curses/ScintillaCurses.h +++ b/curses/ScintillaCurses.h @@ -10,21 +10,20 @@ extern "C" { #endif -typedef void *Scintilla; /** * Creates a new Scintilla window. * Curses does not have to be initialized before calling this function. * @param callback A callback function for Scintilla notifications. */ -Scintilla *scintilla_new(void (*callback)(Scintilla *sci, int iMessage, - void *wParam, void *lParam)); +void *scintilla_new(void (*callback)(void *sci, int iMessage, void *wParam, + void *lParam)); /** * Returns the curses `WINDOW` associated with the given Scintilla window. * Curses must have been initialized prior to calling this function. * @param sci The Scintilla window returned by `scintilla_new()`. * @return curses `WINDOW`. */ -WINDOW *scintilla_get_window(Scintilla *sci); +WINDOW *scintilla_get_window(void *sci); /** * Sends the given message with parameters to the given Scintilla window. * Curses does not have to be initialized before calling this function. @@ -33,8 +32,8 @@ WINDOW *scintilla_get_window(Scintilla *sci); * @param wParam The first parameter. * @param lParam The second parameter. */ -sptr_t scintilla_send_message(Scintilla *sci, unsigned int iMessage, - uptr_t wParam, sptr_t lParam); +sptr_t scintilla_send_message(void *sci, unsigned int iMessage, uptr_t wParam, + sptr_t lParam); /** * Sends the specified key to the given Scintilla window for processing. * If it is not consumed, an SCNotification will be emitted. @@ -47,8 +46,7 @@ sptr_t scintilla_send_message(Scintilla *sci, unsigned int iMessage, * pressed. * @param alt Flag indicating whether or not the alt modifier key is pressed. */ -void scintilla_send_key(Scintilla *sci, int key, bool shift, bool ctrl, - bool alt); +void scintilla_send_key(void *sci, int key, bool shift, bool ctrl, bool alt); /** * Sends the specified mouse event to the given Scintilla window for processing. * Curses must have been initialized prior to calling this function. @@ -66,9 +64,8 @@ void scintilla_send_key(Scintilla *sci, int key, bool shift, bool ctrl, * @param alt Flag indicating whether or not the alt modifier key is pressed. * @return whether or not Scintilla handled the mouse event */ -bool scintilla_send_mouse(Scintilla *sci, int event, unsigned int time, - int button, int y, int x, bool shift, bool ctrl, - bool alt); +bool scintilla_send_mouse(void *sci, int event, unsigned int time, int button, + int y, int x, bool shift, bool ctrl, bool alt); /** * Copies the text of Scintilla's internal clipboard, not the primary and/or * secondary X selections, into the given buffer and returns the size of the @@ -81,7 +78,7 @@ bool scintilla_send_mouse(Scintilla *sci, int event, unsigned int time, * @param buffer The buffer to copy clipboard text to. * @return size of the clipboard text. */ -int scintilla_get_clipboard(Scintilla *sci, char *buffer); +int scintilla_get_clipboard(void *sci, char *buffer); /** * Refreshes the Scintilla window on the virtual screen. * This should be done along with the normal curses `noutrefresh()`, as the @@ -89,7 +86,7 @@ int scintilla_get_clipboard(Scintilla *sci, char *buffer); * Curses must have been initialized prior to calling this function. * @param sci The Scintilla window returned by `scintilla_new()`. */ -void scintilla_noutrefresh(Scintilla *sci); +void scintilla_noutrefresh(void *sci); /** * Refreshes the Scintilla window on the physical screen. * This should be done along with the normal curses `refresh()`, as the physical @@ -97,13 +94,13 @@ void scintilla_noutrefresh(Scintilla *sci); * Curses must have been initialized prior to calling this function. * @param sci The Scintilla window returned by `scintilla_new()`. */ -void scintilla_refresh(Scintilla *sci); +void scintilla_refresh(void *sci); /** * Deletes the given Scintilla window. * Curses must have been initialized prior to calling this function. * @param sci The Scintilla window returned by `scintilla_new()`. */ -void scintilla_delete(Scintilla *sci); +void scintilla_delete(void *sci); /** * Returns the curses `COLOR_PAIR` for the given curses foreground and diff --git a/curses/jinx/jinx.c b/curses/jinx/jinx.c index bea88f67f..7cf0ba375 100644 --- a/curses/jinx/jinx.c +++ b/curses/jinx/jinx.c @@ -10,6 +10,8 @@ #define SSM(m, w, l) scintilla_send_message(sci, m, w, l) +typedef void Scintilla; + void scnotification(Scintilla *view, int msg, void *lParam, void *wParam) { //struct SCNotification *scn = (struct SCNotification *)lParam; //printw("SCNotification received: %i", scn->nmhdr.code); |