LUMIERA.clone/src/gui/workspace/workspace-window.cpp

124 lines
3.1 KiB
C++
Raw Normal View History

/*
2008-04-19 20:15:59 +02:00
workspace-window.cpp - Definition of the main workspace window object
Copyright (C) Lumiera.org
2008, Joel Holdsworth <joel@airwebreathe.org.uk>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
* *****************************************************/
2008-04-11 21:28:15 +02:00
#include <gtkmm/stock.h>
#ifdef ENABLE_NLS
# include <libintl.h>
#endif
#include <gdl/gdl-tools.h>
#include <gdl/gdl-dock.h>
#include <gdl/gdl-dock-bar.h>
#include <gdl/gdl-dock-item.h>
#include <gdl/gdl-dock-placeholder.h>
2008-05-14 01:26:00 +02:00
#include "../gtk-lumiera.hpp"
2008-04-19 20:15:59 +02:00
#include "workspace-window.hpp"
#include "include/logging.h"
2008-04-11 21:28:15 +02:00
using namespace Gtk;
2009-04-15 19:14:16 +02:00
using namespace Glib;
using namespace gui::model;
2009-01-17 17:12:11 +01:00
using namespace gui::controller;
namespace gui {
namespace workspace {
2008-04-11 21:28:15 +02:00
2009-01-17 17:12:11 +01:00
WorkspaceWindow::WorkspaceWindow(Project &source_project,
gui::controller::Controller &source_controller) :
project(source_project),
2009-01-17 17:12:11 +01:00
controller(source_controller),
panelManager(*this),
actions(*this)
{
create_ui();
}
2008-04-11 21:28:15 +02:00
WorkspaceWindow::~WorkspaceWindow()
{
INFO (gui_dbg, "closing workspace window...");
}
2008-04-11 21:28:15 +02:00
Project&
WorkspaceWindow::get_project()
2008-11-22 20:08:12 +01:00
{
return project;
}
2009-01-17 17:12:11 +01:00
Controller&
WorkspaceWindow::get_controller()
{
return controller;
}
2009-04-05 00:01:50 +02:00
PanelManager&
WorkspaceWindow::get_panel_manager()
{
return panelManager;
}
void
WorkspaceWindow::create_ui()
{
// RTL Test Code
//set_default_direction (TEXT_DIR_RTL);
//----- Configure the Window -----//
set_title(GtkLumiera::get_app_title());
set_default_size(1024, 768);
//----- Set up the UI Manager -----//
// The UI will be nested within a VBox
2008-08-16 21:02:46 +02:00
add(baseContainer);
uiManager = Gtk::UIManager::create();
2009-04-15 19:14:16 +02:00
actions.populate_main_actions(uiManager);
add_accel_group(uiManager->get_accel_group());
//----- Set up the Menu Bar -----//
Gtk::Widget* menu_bar = uiManager->get_widget("/MenuBar");
2008-12-26 19:58:29 +01:00
REQUIRE(menu_bar != NULL);
2008-08-16 21:02:46 +02:00
baseContainer.pack_start(*menu_bar, Gtk::PACK_SHRINK);
2009-06-26 12:14:01 +02:00
//----- Create the Docks -----//
panelManager.setup_dock();
GdlDock const *dock = panelManager.get_dock();
gtk_box_pack_start(GTK_BOX(dockContainer.gobj()),
GTK_WIDGET(panelManager.get_dock_bar()), FALSE, FALSE, 0);
gtk_box_pack_start(GTK_BOX(dockContainer.gobj()),
GTK_WIDGET(dock), TRUE, TRUE, 0);
2008-08-16 21:02:46 +02:00
baseContainer.pack_start(dockContainer, PACK_EXPAND_WIDGET);
//----- Create the status bar -----//
statusBar.set_has_resize_grip();
baseContainer.pack_start(statusBar, PACK_SHRINK);
show_all_children();
}
2009-04-15 19:14:16 +02:00
2008-04-11 21:28:15 +02:00
} // namespace workspace
} // namespace gui