Implemented New Window command
This commit is contained in:
parent
cef0e0e074
commit
852377c1f1
4 changed files with 31 additions and 10 deletions
|
|
@ -65,10 +65,11 @@ GtkLumiera::main(int argc, char *argv[])
|
||||||
|
|
||||||
Project project;
|
Project project;
|
||||||
Controller controller(project);
|
Controller controller(project);
|
||||||
WindowManager window_manager;
|
|
||||||
|
|
||||||
window_manager.set_theme("lumiera_ui.rc");
|
WindowManager *manager = WindowManager::instance();
|
||||||
window_manager.new_window(project, controller);
|
REQUIRE(manager);
|
||||||
|
manager->set_theme("lumiera_ui.rc");
|
||||||
|
manager->new_window(project, controller);
|
||||||
|
|
||||||
kit.run();
|
kit.run();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -73,17 +73,31 @@ WindowManager::set_theme(Glib::ustring path)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WindowManager*
|
||||||
|
WindowManager::instance()
|
||||||
|
{
|
||||||
|
// Initialized during first access
|
||||||
|
static WindowManager manager;
|
||||||
|
return &manager;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
WindowManager::on_window_closed(GdkEventAny*)
|
WindowManager::on_window_closed(GdkEventAny* event)
|
||||||
{
|
{
|
||||||
|
REQUIRE(event);
|
||||||
|
REQUIRE(event->window);
|
||||||
|
|
||||||
list< shared_ptr<WorkspaceWindow> >::iterator iterator =
|
list< shared_ptr<WorkspaceWindow> >::iterator iterator =
|
||||||
windowList.begin();
|
windowList.begin();
|
||||||
|
|
||||||
while(iterator != windowList.end())
|
while(iterator != windowList.end())
|
||||||
{
|
{
|
||||||
shared_ptr<WorkspaceWindow> window(*iterator);
|
shared_ptr<WorkspaceWindow> workspace_window(*iterator);
|
||||||
REQUIRE(window);
|
REQUIRE(workspace_window);
|
||||||
|
|
||||||
if(!window->get_frame())
|
RefPtr<Gdk::Window> window = workspace_window->get_window();
|
||||||
|
REQUIRE(window);
|
||||||
|
if(window->gobj() == event->window)
|
||||||
{
|
{
|
||||||
// This window has been closed
|
// This window has been closed
|
||||||
iterator = windowList.erase(iterator);
|
iterator = windowList.erase(iterator);
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,9 @@ public:
|
||||||
bool set_theme(Glib::ustring path);
|
bool set_theme(Glib::ustring path);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static WindowManager* instance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A utility function which reads a colour style from the GTK Style.
|
* A utility function which reads a colour style from the GTK Style.
|
||||||
* @param widget The widget to load the style out of.
|
* @param widget The widget to load the style out of.
|
||||||
|
|
@ -87,7 +90,7 @@ private:
|
||||||
/**
|
/**
|
||||||
* An event handler for when a window has been closed.
|
* An event handler for when a window has been closed.
|
||||||
**/
|
**/
|
||||||
bool on_window_closed(GdkEventAny*);
|
bool on_window_closed(GdkEventAny* event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,8 @@
|
||||||
#include "actions.hpp"
|
#include "actions.hpp"
|
||||||
#include "workspace-window.hpp"
|
#include "workspace-window.hpp"
|
||||||
|
|
||||||
|
#include "../window-manager.hpp"
|
||||||
|
|
||||||
#include "../dialogs/render.hpp"
|
#include "../dialogs/render.hpp"
|
||||||
#include "../dialogs/preferences-dialog.hpp"
|
#include "../dialogs/preferences-dialog.hpp"
|
||||||
#include "../dialogs/name-chooser.hpp"
|
#include "../dialogs/name-chooser.hpp"
|
||||||
|
|
@ -188,7 +190,8 @@ Actions::on_menu_view_viewer()
|
||||||
void
|
void
|
||||||
Actions::on_menu_view_new_window()
|
Actions::on_menu_view_new_window()
|
||||||
{
|
{
|
||||||
g_message("New Window");
|
WindowManager::instance()->new_window(workspaceWindow.project,
|
||||||
|
workspaceWindow.controller);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ===== Sequence Menu Event Handlers ===== */
|
/* ===== Sequence Menu Event Handlers ===== */
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue