summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorneoraider <devnull@localhost>2007-10-30 22:54:00 +0100
committerneoraider <devnull@localhost>2007-10-30 22:54:00 +0100
commitbc2b34ead69f7fa1ef997308e0cff6123179f40e (patch)
treed8b56573c7ca7fa8526ed90afbd7c603daa05967
parent29ecb9c039d28768a8e5136c18ce76030e451654 (diff)
downloadzoomedit-bc2b34ead69f7fa1ef997308e0cff6123179f40e.tar
zoomedit-bc2b34ead69f7fa1ef997308e0cff6123179f40e.zip
zoomedit: Toolbar-Zoom-Buttons funktionieren wieder.
-rw-r--r--UIManager.cpp15
-rw-r--r--UIManager.h13
-rw-r--r--Window.cpp13
-rw-r--r--Window.h2
4 files changed, 34 insertions, 9 deletions
diff --git a/UIManager.cpp b/UIManager.cpp
index d6216fd..c1b1e45 100644
--- a/UIManager.cpp
+++ b/UIManager.cpp
@@ -1,4 +1,5 @@
#include "UIManager.h"
+#include "Window.h"
const gchar* const UIManager::uiData = (const gchar*)
@@ -23,12 +24,14 @@ const gchar* const UIManager::uiData = (const gchar*)
void UIManager::handleAction(GtkAction *action, UIManager *uiManager) {
- //const gchar* name = gtk_action_get_name(action);
+ const gchar* name = gtk_action_get_name(action);
- /*if(!strcmp(name, "zoomIn"))
- zoomInCentered(1.2f);
+ if(!strcmp(name, "zoomIn"))
+ uiManager->window->handleAction(ZOOM_IN);
+ //zoomInCentered(1.2f);
else if(!strcmp(name, "zoomOut"))
- zoomOutCentered(1.2f);*/
+ uiManager->window->handleAction(ZOOM_OUT);
+ //zoomOutCentered(1.2f);
}
GtkActionGroup* UIManager::createActions() {
@@ -77,7 +80,9 @@ GtkActionGroup* UIManager::createActions() {
return actionGroup;
}
-UIManager::UIManager() {
+UIManager::UIManager(Window *window) {
+ this->window = window;
+
uiManager = gtk_ui_manager_new();
gtk_ui_manager_add_ui_from_string(uiManager, uiData, -1, NULL);
diff --git a/UIManager.h b/UIManager.h
index 09000ac..4d833e0 100644
--- a/UIManager.h
+++ b/UIManager.h
@@ -4,18 +4,27 @@
#include <gtk/gtk.h>
+class Window;
+
+
class UIManager {
private:
static const gchar* const uiData;
GtkUIManager *uiManager;
+ Window *window;
+
+ GtkActionGroup* createActions();
static void handleAction(GtkAction *action, UIManager *uiManager);
- GtkActionGroup* createActions();
public:
- UIManager();
+ enum Action {
+ ZOOM_IN, ZOOM_OUT
+ };
+
+ UIManager(Window *window);
virtual ~UIManager();
GtkWidget* getMenu() {
diff --git a/Window.cpp b/Window.cpp
index a1e3917..f69e148 100644
--- a/Window.cpp
+++ b/Window.cpp
@@ -11,7 +11,7 @@ gboolean Window::deleteEvent(GtkWidget *widget, GdkEvent *event, Window *window)
}
Window::Window(GdkGLConfig *glconfig, WindowManager *manager)
- : editor(this), drawer(this, glconfig), sidebar(&editor)
+ : uiManager(this), editor(this), drawer(this, glconfig), sidebar(&editor)
{
this->manager = manager;
@@ -50,3 +50,14 @@ void Window::update() {
drawer.update();
sidebar.update();
}
+
+void Window::handleAction(UIManager::Action action) {
+ switch(action) {
+ case UIManager::ZOOM_IN:
+ drawer.zoom(2);
+ break;
+
+ case UIManager::ZOOM_OUT:
+ drawer.zoom(-2);
+ }
+}
diff --git a/Window.h b/Window.h
index e58b786..3dd36d5 100644
--- a/Window.h
+++ b/Window.h
@@ -38,8 +38,8 @@ class Window {
virtual ~Window();
void show();
-
void update();
+ void handleAction(UIManager::Action action);
EditManager& getEditManager() {
return editor;