From 82a000662ba0ff69f5b75a9f98a2df87b47655c1 Mon Sep 17 00:00:00 2001 From: Joel Holdsworth Date: Sat, 19 Apr 2008 19:15:59 +0100 Subject: [PATCH] Added the data model of a project --- gui/src/Makefile.am | 8 ++-- gui/src/gtk-lumiera.cpp | 9 ++-- gui/src/model/project.cpp | 38 ++++++++++++++++ gui/src/model/project.hpp | 44 +++++++++++++++++++ gui/src/workspace/actions.cpp | 12 ++--- gui/src/workspace/actions.hpp | 8 ++-- .../{main-window.cpp => workspace-window.cpp} | 17 ++++--- .../{main-window.hpp => workspace-window.hpp} | 33 +++++++++----- 8 files changed, 135 insertions(+), 34 deletions(-) create mode 100644 gui/src/model/project.cpp create mode 100644 gui/src/model/project.hpp rename gui/src/workspace/{main-window.cpp => workspace-window.cpp} (91%) rename gui/src/workspace/{main-window.hpp => workspace-window.hpp} (78%) diff --git a/gui/src/Makefile.am b/gui/src/Makefile.am index e35cf0494..59ca02604 100644 --- a/gui/src/Makefile.am +++ b/gui/src/Makefile.am @@ -17,8 +17,8 @@ gtk_lumiera_SOURCES = \ gtk-lumiera.hpp \ workspace/actions.cpp \ workspace/actions.hpp \ - workspace/main-window.cpp \ - workspace/main-window.hpp \ + workspace/workspace-window.cpp \ + workspace/workspace-window.hpp \ dialogs/render.cpp \ dialogs/render.hpp \ panels/panel.cpp \ @@ -30,7 +30,9 @@ gtk_lumiera_SOURCES = \ panels/assets.cpp \ panels/assets.hpp \ widgets/video-display.cpp \ - widgets/video-display.hpp + widgets/video-display.hpp \ + model/project.cpp \ + model/project.hpp gtk_lumiera_LDFLAGS = diff --git a/gui/src/gtk-lumiera.cpp b/gui/src/gtk-lumiera.cpp index 4dff269b4..a7951b3a0 100644 --- a/gui/src/gtk-lumiera.cpp +++ b/gui/src/gtk-lumiera.cpp @@ -28,11 +28,13 @@ #endif #include "gtk-lumiera.hpp" -#include "workspace/main-window.hpp" +#include "workspace/workspace-window.hpp" +#include "model/project.hpp" +using namespace Gtk; using namespace lumiera::gui; using namespace lumiera::gui::workspace; -using namespace Gtk; +using namespace lumiera::gui::model; GtkLumiera the_application; @@ -54,7 +56,8 @@ namespace gui { Glib::set_application_name(AppTitle); - MainWindow main_window; + Project project; + WorkspaceWindow main_window(&project); kit.run(main_window); } diff --git a/gui/src/model/project.cpp b/gui/src/model/project.cpp new file mode 100644 index 000000000..345398c7a --- /dev/null +++ b/gui/src/model/project.cpp @@ -0,0 +1,38 @@ +/* + panel.cpp - Implementation of the Project class + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + 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. + +* *****************************************************/ + +#include "project.hpp" + +namespace lumiera { +namespace gui { +namespace model { + +Project::Project() +{ + +} + +} // namespace model +} // namespace gui +} // namespace lumiera + + diff --git a/gui/src/model/project.hpp b/gui/src/model/project.hpp new file mode 100644 index 000000000..c7d02c51a --- /dev/null +++ b/gui/src/model/project.hpp @@ -0,0 +1,44 @@ +/* + project.hpp - Definition of the Project class + + Copyright (C) Lumiera.org + 2008, Joel Holdsworth + + 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. + +*/ +/** @file project.hpp + ** This file contains the definition of Project, a class which + ** store project data, and wraps proc layer data + */ + +#ifndef PROJECT_HPP +#define PROJECT_HPP + +namespace lumiera { +namespace gui { +namespace model { + +class Project +{ +public: + Project(); +}; + +} // namespace model +} // namespace gui +} // namespace lumiera + +#endif // PROJECT_HPP diff --git a/gui/src/workspace/actions.cpp b/gui/src/workspace/actions.cpp index 2303b1000..8adfcc141 100644 --- a/gui/src/workspace/actions.cpp +++ b/gui/src/workspace/actions.cpp @@ -22,7 +22,7 @@ #include "../gtk-lumiera.hpp" #include "actions.hpp" -#include "main-window.hpp" +#include "workspace-window.hpp" #include "../dialogs/render.hpp" @@ -34,8 +34,8 @@ namespace lumiera { namespace gui { namespace workspace { - Actions::Actions(MainWindow &main_window) : - mainWindow(main_window) + Actions::Actions(WorkspaceWindow &workspace_window) : + workspaceWindow(workspace_window) { actionGroup = ActionGroup::create(); @@ -81,14 +81,14 @@ namespace workspace { void Actions::on_menu_file_render() { - dialogs::Render dialog(mainWindow); + dialogs::Render dialog(workspaceWindow); dialog.run(); } void Actions::on_menu_file_quit() { - mainWindow.hide(); // Closes the main window to stop the Gtk::Main::run(). + workspaceWindow.hide(); // Closes the main window to stop the Gtk::Main::run(). } void @@ -106,7 +106,7 @@ namespace workspace { sizeof(AppAuthors) / sizeof(gchar*), OWNERSHIP_NONE)); - dialog.set_transient_for(mainWindow); + dialog.set_transient_for(workspaceWindow); // Show the about dialog dialog.run(); diff --git a/gui/src/workspace/actions.hpp b/gui/src/workspace/actions.hpp index 2f24517c9..27b744549 100644 --- a/gui/src/workspace/actions.hpp +++ b/gui/src/workspace/actions.hpp @@ -35,7 +35,7 @@ namespace lumiera { namespace gui { namespace workspace { -class MainWindow; +class WorkspaceWindow; /** * A helper class which registers and handles @@ -44,12 +44,12 @@ class MainWindow; class Actions { private: - Actions(MainWindow &main_window); + Actions(WorkspaceWindow &workspace_window); /** * A reference to the MainWindow which owns * this helper */ - MainWindow &mainWindow; + WorkspaceWindow &workspaceWindow; /* ===== Event Handlers ===== */ void on_menu_file_new_project(); @@ -66,7 +66,7 @@ class MainWindow; Glib::RefPtr actionGroup; Glib::RefPtr m_refChoiceOne, m_refChoiceTwo; - friend class MainWindow; + friend class WorkspaceWindow; }; } // namespace workspace diff --git a/gui/src/workspace/main-window.cpp b/gui/src/workspace/workspace-window.cpp similarity index 91% rename from gui/src/workspace/main-window.cpp rename to gui/src/workspace/workspace-window.cpp index b3b728353..5d06b6d18 100644 --- a/gui/src/workspace/main-window.cpp +++ b/gui/src/workspace/workspace-window.cpp @@ -1,5 +1,5 @@ /* - main-window.cpp - Definition of the main workspace window object + workspace-window.cpp - Definition of the main workspace window object Copyright (C) Lumiera.org 2008, Joel Holdsworth @@ -33,26 +33,31 @@ #include #include "gtk-lumiera.hpp" -#include "main-window.hpp" +#include "workspace-window.hpp" using namespace Gtk; +using namespace lumiera::gui::model; namespace lumiera { namespace gui { namespace workspace { - MainWindow::MainWindow() - : actions(*this) + WorkspaceWindow::WorkspaceWindow(Project *source_project) : + project(source_project), + actions(*this) { + layout = NULL; + create_ui(); } - MainWindow::~MainWindow() + WorkspaceWindow::~WorkspaceWindow() { + if(layout != NULL) g_object_unref(layout); } void - MainWindow::create_ui() + WorkspaceWindow::create_ui() { //----- Configure the Window -----// set_title(AppTitle); diff --git a/gui/src/workspace/main-window.hpp b/gui/src/workspace/workspace-window.hpp similarity index 78% rename from gui/src/workspace/main-window.hpp rename to gui/src/workspace/workspace-window.hpp index c544ce5b0..5718ddc25 100644 --- a/gui/src/workspace/main-window.hpp +++ b/gui/src/workspace/workspace-window.hpp @@ -1,5 +1,5 @@ /* - main-window.hpp - Definition of the main workspace window object + workspace-window.hpp - Definition of the main workspace window object Copyright (C) Lumiera.org 2008, Joel Holdsworth @@ -19,15 +19,15 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -/** @file mainwindow.hpp +/** @file workspace-window.hpp ** This file contains the definition of the main workspace window ** parent, which is the toplevel parent of the whole workspace. ** ** @see actions.hpp */ -#ifndef MAIN_WINDOW_HPP -#define MAIN_WINDOW_HPP +#ifndef WORKSPACE_WINDOW_HPP +#define WORKSPACE_WINDOW_HPP #include #include @@ -42,22 +42,31 @@ using namespace lumiera::gui::panels; namespace lumiera { namespace gui { + +namespace model { + class Project; +} // model + namespace workspace { /** * The main lumiera workspace window */ - class MainWindow : public Gtk::Window + class WorkspaceWindow : public Gtk::Window { public: - MainWindow(); - virtual ~MainWindow(); + WorkspaceWindow(lumiera::gui::model::Project *source_project); + virtual ~WorkspaceWindow(); - protected: + private: void create_ui(); + /* ===== Model ===== */ + private: + lumiera::gui::model::Project *project; + /* ===== UI ===== */ - protected: + private: Glib::RefPtr uiManager; Gtk::VBox base_container; Gtk::HBox dock_container; @@ -67,13 +76,13 @@ namespace workspace { GdlDockLayout *layout; /* ===== Panels ===== */ - protected: + private: Assets assets; Viewer viewer; Timeline timeline; /* ===== Helpers ===== */ - protected: + private: /** * The instantiation of the actions helper class, which * registers and handles user action events */ @@ -86,4 +95,4 @@ namespace workspace { } // namespace gui } // namespace lumiera -#endif // MAIN_WINDOW_HPP +#endif // WORKSPACE_WINDOW_HPP