Added the data model of a project

This commit is contained in:
Joel Holdsworth 2008-04-19 19:15:59 +01:00
parent f360ead450
commit 82a000662b
8 changed files with 135 additions and 34 deletions

View file

@ -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 =

View file

@ -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);
}

38
gui/src/model/project.cpp Normal file
View file

@ -0,0 +1,38 @@
/*
panel.cpp - Implementation of the Project class
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.
* *****************************************************/
#include "project.hpp"
namespace lumiera {
namespace gui {
namespace model {
Project::Project()
{
}
} // namespace model
} // namespace gui
} // namespace lumiera

44
gui/src/model/project.hpp Normal file
View file

@ -0,0 +1,44 @@
/*
project.hpp - Definition of the Project class
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.
*/
/** @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

View file

@ -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();

View file

@ -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<Gtk::ActionGroup> actionGroup;
Glib::RefPtr<Gtk::RadioAction> m_refChoiceOne, m_refChoiceTwo;
friend class MainWindow;
friend class WorkspaceWindow;
};
} // namespace workspace

View file

@ -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 <joel@airwebreathe.org.uk>
@ -33,26 +33,31 @@
#include <libgdl-1.0/gdl/gdl-dock-bar.h>
#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);

View file

@ -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 <joel@airwebreathe.org.uk>
@ -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 <gtkmm.h>
#include <libgdl-1.0/gdl/gdl-dock-layout.h>
@ -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<Gtk::UIManager> 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