From 953a6ff48ac6c46a0d81bedb0fbdafe5d637666e Mon Sep 17 00:00:00 2001 From: neoraider Date: Mon, 24 Dec 2007 00:04:02 +0000 Subject: zoomedit: Use tools for event handling and rendering --- SidebarManager.cpp | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'SidebarManager.cpp') diff --git a/SidebarManager.cpp b/SidebarManager.cpp index 0eb1f7b..393d748 100644 --- a/SidebarManager.cpp +++ b/SidebarManager.cpp @@ -3,10 +3,9 @@ SidebarManager::SidebarManager(Window *window) - : sidebarToolbox(window), sidebarView(&window->getEditManager()), - sidebarAdd(&window->getEditManager()), toolAddPolygon(&window->getEditManager()) + : sidebarToolbox(window), toolAddPolygon(&window->getEditManager()) { - this->editor = &window->getEditManager(); + this->window = window; activeSidebar = NULL; sidebar = gtk_vbox_new(FALSE, 0); @@ -16,7 +15,7 @@ SidebarManager::SidebarManager(Window *window) gtk_box_pack_start(GTK_BOX(sidebar), gtk_hseparator_new(), FALSE, FALSE, 5); - toolLabel = gtk_label_new(sidebarToolbox.getActiveTool()->getName()); + toolLabel = gtk_label_new(sidebarToolbox.getActiveTool().getName()); gtk_box_pack_start(GTK_BOX(sidebar), toolLabel, FALSE, FALSE, 0); @@ -40,13 +39,7 @@ SidebarManager::~SidebarManager() { void SidebarManager::update() { Sidebar *newSidebar = activeSidebar; - switch(editor->getMode()) { - case EditManager::VIEW: - newSidebar = &sidebarView; - break; - case EditManager::ADD: - newSidebar = &sidebarAdd; - } + newSidebar = window->getActiveTool()->getSidebar(); if(activeSidebar != newSidebar) { if(activeSidebar) @@ -57,7 +50,7 @@ void SidebarManager::update() { activeSidebar = newSidebar; } - gtk_label_set_text(GTK_LABEL(toolLabel), sidebarToolbox.getActiveTool()->getName()); + gtk_label_set_text(GTK_LABEL(toolLabel), sidebarToolbox.getActiveTool().getName()); sidebarToolbox.update(); activeSidebar->update(); -- cgit v1.2.3