From f6ff327f0b7b50b74328e448ce862f7212dcae23 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Fri, 16 Nov 2012 14:42:47 +0100 Subject: 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 --- interface.h | 39 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) (limited to 'interface.h') diff --git a/interface.h b/interface.h index d40506a..f89307e 100644 --- a/interface.h +++ b/interface.h @@ -7,6 +7,12 @@ #include +#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 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 + inline void + undo_info_update(Type *obj) + { + undo.push(new UndoTokenInfoUpdate(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 -- cgit v1.2.3