zoomedit: Toolbar-Zoom-Buttons funktionieren wieder.
This commit is contained in:
parent
29ecb9c039
commit
bc2b34ead6
4 changed files with 35 additions and 10 deletions
|
@ -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);
|
||||
|
|
15
UIManager.h
15
UIManager.h
|
@ -4,18 +4,27 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
class Window;
|
||||
|
||||
|
||||
class UIManager {
|
||||
private:
|
||||
static const gchar* const uiData;
|
||||
|
||||
GtkUIManager *uiManager;
|
||||
|
||||
static void handleAction(GtkAction *action, UIManager *uiManager);
|
||||
Window *window;
|
||||
|
||||
GtkActionGroup* createActions();
|
||||
|
||||
static void handleAction(GtkAction *action, UIManager *uiManager);
|
||||
|
||||
|
||||
public:
|
||||
UIManager();
|
||||
enum Action {
|
||||
ZOOM_IN, ZOOM_OUT
|
||||
};
|
||||
|
||||
UIManager(Window *window);
|
||||
virtual ~UIManager();
|
||||
|
||||
GtkWidget* getMenu() {
|
||||
|
|
13
Window.cpp
13
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);
|
||||
}
|
||||
}
|
||||
|
|
2
Window.h
2
Window.h
|
@ -38,8 +38,8 @@ class Window {
|
|||
virtual ~Window();
|
||||
|
||||
void show();
|
||||
|
||||
void update();
|
||||
void handleAction(UIManager::Action action);
|
||||
|
||||
EditManager& getEditManager() {
|
||||
return editor;
|
||||
|
|
Reference in a new issue