aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/interface-gtk.h25
-rw-r--r--src/interface-ncurses.h28
-rw-r--r--src/interface.h15
3 files changed, 15 insertions, 53 deletions
diff --git a/src/interface-gtk.h b/src/interface-gtk.h
index f74bf24..5a083ab 100644
--- a/src/interface-gtk.h
+++ b/src/interface-gtk.h
@@ -59,16 +59,15 @@ typedef class InterfaceGtk : public Interface<InterfaceGtk, ViewGtk> {
GtkWidget *popup_widget;
- ViewGtk *current_view;
GtkWidget *current_view_widget;
public:
- InterfaceGtk() : window(NULL),
+ InterfaceGtk() : Interface(),
+ window(NULL),
vbox(NULL),
cmdline_widget(NULL),
info_widget(NULL), message_widget(NULL),
popup_widget(NULL),
- current_view(NULL),
current_view_widget(NULL) {}
~InterfaceGtk();
@@ -89,26 +88,6 @@ public:
/* implementation of Interface::show_view() */
void show_view_impl(ViewGtk *view);
- /* implementation of Interface::get_current_view() */
- inline ViewGtk *
- get_current_view_impl(void)
- {
- return current_view;
- }
-
- /* implementation of Interface::ssm() */
- inline sptr_t
- ssm_impl(unsigned int iMessage, uptr_t wParam = 0, sptr_t lParam = 0)
- {
- return current_view->ssm(iMessage, wParam, lParam);
- }
- /* implementation of Interface::undo_ssm() */
- inline void
- undo_ssm_impl(unsigned int iMessage,
- uptr_t wParam = 0, sptr_t lParam = 0)
- {
- current_view->undo_ssm(iMessage, wParam, lParam);
- }
/* implementation of Interface::info_update() */
void info_update_impl(QRegister *reg);
diff --git a/src/interface-ncurses.h b/src/interface-ncurses.h
index 0d13615..d245e86 100644
--- a/src/interface-ncurses.h
+++ b/src/interface-ncurses.h
@@ -68,8 +68,6 @@ typedef class InterfaceNCurses : public Interface<InterfaceNCurses, ViewNCurses>
WINDOW *cmdline_window;
gchar *cmdline_current;
- ViewNCurses *current_view;
-
struct Popup {
WINDOW *window;
GSList *list;
@@ -81,14 +79,14 @@ typedef class InterfaceNCurses : public Interface<InterfaceNCurses, ViewNCurses>
} popup;
public:
- InterfaceNCurses() : screen(NULL),
+ InterfaceNCurses() : Interface(),
+ screen(NULL),
screen_tty(NULL),
info_window(NULL),
info_current(NULL),
msg_window(NULL),
cmdline_window(NULL),
- cmdline_current(NULL),
- current_view(NULL) {}
+ cmdline_current(NULL) {}
~InterfaceNCurses();
/* implementation of Interface::main() */
@@ -101,26 +99,6 @@ public:
/* implementation of Interface::show_view() */
void show_view_impl(ViewNCurses *view);
- /* implementation of Interface::get_current_view() */
- inline ViewNCurses *
- get_current_view_impl(void)
- {
- return current_view;
- }
-
- /* implementation of Interface::ssm() */
- inline sptr_t
- ssm_impl(unsigned int iMessage, uptr_t wParam = 0, sptr_t lParam = 0)
- {
- return current_view->ssm(iMessage, wParam, lParam);
- }
- /* implementation of Interface::undo_ssm() */
- inline void
- undo_ssm_impl(unsigned int iMessage,
- uptr_t wParam = 0, sptr_t lParam = 0)
- {
- current_view->undo_ssm(iMessage, wParam, lParam);
- }
/* implementation of Interface::info_update() */
void info_update_impl(QRegister *reg);
diff --git a/src/interface.h b/src/interface.h
index 09b3c9a..01684fd 100644
--- a/src/interface.h
+++ b/src/interface.h
@@ -162,7 +162,12 @@ class Interface {
void run(void);
};
+protected:
+ ViewImpl *current_view;
+
public:
+ Interface() : current_view(NULL) {}
+
/* default implementation */
inline GOptionGroup *
get_options(void)
@@ -210,23 +215,23 @@ public:
{
undo.push(new UndoTokenShowView(view));
}
+
inline ViewImpl *
get_current_view(void)
{
- return impl().get_current_view_impl();
+ return current_view;
}
inline sptr_t
- ssm(unsigned int iMessage,
- uptr_t wParam = 0, sptr_t lParam = 0)
+ ssm(unsigned int iMessage, uptr_t wParam = 0, sptr_t lParam = 0)
{
- return impl().ssm_impl(iMessage, wParam, lParam);
+ return current_view->ssm(iMessage, wParam, lParam);
}
inline void
undo_ssm(unsigned int iMessage,
uptr_t wParam = 0, sptr_t lParam = 0)
{
- impl().undo_ssm_impl(iMessage, wParam, lParam);
+ current_view->undo_ssm(iMessage, wParam, lParam);
}
/*