diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-16 14:42:47 +0100 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-11-16 14:42:47 +0100 |
commit | f6ff327f0b7b50b74328e448ce862f7212dcae23 (patch) | |
tree | 4a773dcb9120d6a7fb96fce92422667e8702dbdf /interface.h | |
parent | 0a8f940ffe1aaf77ba12ccc02d4e382be2118151 (diff) | |
download | sciteco-f6ff327f0b7b50b74328e448ce862f7212dcae23.tar.gz |
keep a buffer dirty flag and display infos about the current buffer in the interfaces (including the dirty flag)
* was a bit tricky because the Scintilla SAVEPOINTS cannot be (fully) used
* when a file is loaded or saved, a Scintilla SAVEPOINT is set
* SAVEPOINTLEFT notifications are used to set a buffer dirty
* SAVEPOINTREACHED notifications are useless since Scintilla does not consider the saves themselves to be undoable
* GTK interface displays infos in window title bar
* NCURSES interface has also been updated and cleaned up a bit. Infos are displayed in a new info line.
* NCURSES: fixed popup display after terminal resizing
Diffstat (limited to 'interface.h')
-rw-r--r-- | interface.h | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/interface.h b/interface.h index d40506a..f89307e 100644 --- a/interface.h +++ b/interface.h @@ -7,6 +7,12 @@ #include <Scintilla.h> +#include "undo.h" + +/* avoid include dependency conflict */ +class QRegister; +class Buffer; + /* * Base class for all user interfaces - used mereley as a class interface. * The actual instance of the interface has the platform-specific type @@ -16,6 +22,22 @@ * There's only one Interface* instance in the system. */ class Interface { + template <class Type> + class UndoTokenInfoUpdate : public UndoToken { + Interface *iface; + Type *obj; + + public: + UndoTokenInfoUpdate(Interface *_iface, Type *_obj) + : iface(_iface), obj(_obj) {} + + void + run(void) + { + iface->info_update(obj); + } + }; + public: virtual GOptionGroup * get_options(void) @@ -44,6 +66,16 @@ public: virtual sptr_t ssm(unsigned int iMessage, uptr_t wParam = 0, sptr_t lParam = 0) = 0; + virtual void info_update(QRegister *reg) = 0; + virtual void info_update(Buffer *buffer) = 0; + + template <class Type> + inline void + undo_info_update(Type *obj) + { + undo.push(new UndoTokenInfoUpdate<Type>(this, obj)); + } + /* NULL means to redraw the current cmdline if necessary */ virtual void cmdline_update(const gchar *cmdline = NULL) = 0; @@ -60,9 +92,14 @@ public: /* main entry point */ virtual void event_loop(void) = 0; + /* + * Interfacing to the external SciTECO world + * See main.cpp + */ protected: - /* see main.cpp */ void stdio_vmsg(MessageType type, const gchar *fmt, va_list ap); +public: + void process_notify(SCNotification *notify); }; #ifdef INTERFACE_GTK |