Transitioned to references of project instead of pointers

This commit is contained in:
Joel Holdsworth 2009-01-17 15:38:39 +00:00
parent 47296381a8
commit ebb552e323
12 changed files with 22 additions and 26 deletions

View file

@ -65,7 +65,7 @@ GtkLumiera::main(int argc, char *argv[])
window_manager.set_theme("lumiera_ui.rc"); window_manager.set_theme("lumiera_ui.rc");
WorkspaceWindow main_window(&project); WorkspaceWindow main_window(project);
kit.run(main_window); kit.run(main_window);

View file

@ -26,7 +26,7 @@
namespace gui { namespace gui {
namespace panels { namespace panels {
AssetsPanel::AssetsPanel(model::Project *const owner_project) : AssetsPanel::AssetsPanel(model::Project &owner_project) :
Panel(owner_project, "assets", _("Assets"), "panel_assets"), Panel(owner_project, "assets", _("Assets"), "panel_assets"),
placeholder("Assets/Media") placeholder("Assets/Media")
{ {

View file

@ -38,7 +38,7 @@ public:
* Constructor * Constructor
* @param owner_project The project associated with this panel. * @param owner_project The project associated with this panel.
**/ **/
AssetsPanel(model::Project *const owner_project); AssetsPanel(model::Project &owner_project);
protected: protected:
Gtk::Label placeholder; Gtk::Label placeholder;

View file

@ -26,12 +26,11 @@
namespace gui { namespace gui {
namespace panels { namespace panels {
Panel::Panel(model::Project *const owner_project, Panel::Panel(model::Project &owner_project,
const gchar *name, const gchar *long_name, const gchar *name, const gchar *long_name,
GdlDockItemBehavior behavior) : GdlDockItemBehavior behavior) :
project(owner_project) project(owner_project)
{ {
REQUIRE(owner_project != NULL);
REQUIRE(name != NULL); REQUIRE(name != NULL);
REQUIRE(long_name != NULL); REQUIRE(long_name != NULL);
@ -42,12 +41,11 @@ Panel::Panel(model::Project *const owner_project,
ENSURE(dock_item != NULL); ENSURE(dock_item != NULL);
} }
Panel::Panel(model::Project *const owner_project, Panel::Panel(model::Project &owner_project,
const gchar *name, const gchar *long_name, const gchar *stock_id, const gchar *name, const gchar *long_name, const gchar *stock_id,
GdlDockItemBehavior behavior) : GdlDockItemBehavior behavior) :
project(owner_project) project(owner_project)
{ {
REQUIRE(owner_project != NULL);
REQUIRE(name != NULL); REQUIRE(name != NULL);
REQUIRE(long_name != NULL); REQUIRE(long_name != NULL);
REQUIRE(stock_id != NULL); REQUIRE(stock_id != NULL);

View file

@ -51,7 +51,7 @@ protected:
* @param long_name The name to display on the caption * @param long_name The name to display on the caption
* @param behavior The GDL behaviour of this item * @param behavior The GDL behaviour of this item
*/ */
Panel(model::Project *const owner_project, Panel(model::Project &owner_project,
const gchar *name, const gchar *long_name, const gchar *name, const gchar *long_name,
GdlDockItemBehavior behavior = GDL_DOCK_ITEM_BEH_NORMAL); GdlDockItemBehavior behavior = GDL_DOCK_ITEM_BEH_NORMAL);
@ -63,7 +63,7 @@ protected:
* @param stock_id The id of the stock item to display on the caption * @param stock_id The id of the stock item to display on the caption
* @param behavior The GDL behaviour of this item * @param behavior The GDL behaviour of this item
*/ */
Panel(model::Project *const owner_project, Panel(model::Project &owner_project,
const gchar *name, const gchar *long_name, const gchar *stock_id, const gchar *name, const gchar *long_name, const gchar *stock_id,
GdlDockItemBehavior behavior = GDL_DOCK_ITEM_BEH_NORMAL); GdlDockItemBehavior behavior = GDL_DOCK_ITEM_BEH_NORMAL);
@ -99,7 +99,7 @@ private:
protected: protected:
model::Project *const project; model::Project &project;
GdlDockItem* dock_item; GdlDockItem* dock_item;
}; };

View file

@ -43,7 +43,7 @@ namespace panels {
const int TimelinePanel::ZoomToolSteps = 2; // 2 seems comfortable const int TimelinePanel::ZoomToolSteps = 2; // 2 seems comfortable
TimelinePanel::TimelinePanel(model::Project *const owner_project) : TimelinePanel::TimelinePanel(model::Project &owner_project) :
Panel(owner_project, "timeline", _("Timeline"), "panel_timeline"), Panel(owner_project, "timeline", _("Timeline"), "panel_timeline"),
timeIndicator(), timeIndicator(),
previousButton(Stock::MEDIA_PREVIOUS), previousButton(Stock::MEDIA_PREVIOUS),
@ -65,7 +65,7 @@ TimelinePanel::TimelinePanel(model::Project *const owner_project) :
// mem_fun(this, &TimelinePanel::on_playback_period_drag_released)); // mem_fun(this, &TimelinePanel::on_playback_period_drag_released));
// Hook up notifications // Hook up notifications
project->get_sequences().signal_changed().connect( project.get_sequences().signal_changed().connect(
mem_fun(this, &TimelinePanel::on_sequence_list_changed)); mem_fun(this, &TimelinePanel::on_sequence_list_changed));
// Setup the notebook // Setup the notebook
@ -223,7 +223,7 @@ TimelinePanel::update_notebook()
old_pages.swap(notebook_pages); old_pages.swap(notebook_pages);
BOOST_FOREACH( shared_ptr< model::Sequence > sequence, BOOST_FOREACH( shared_ptr< model::Sequence > sequence,
project->get_sequences() ) project.get_sequences() )
{ {
std::map<const model::Sequence*, shared_ptr<TimelineWidget> >:: std::map<const model::Sequence*, shared_ptr<TimelineWidget> >::
iterator iterator = old_pages.find(sequence.get()); iterator iterator = old_pages.find(sequence.get());

View file

@ -50,7 +50,7 @@ public:
* Constructor * Constructor
* @param owner_project The project associated with this panel. * @param owner_project The project associated with this panel.
*/ */
TimelinePanel(model::Project *const owner_project); TimelinePanel(model::Project &owner_project);
/** /**

View file

@ -29,7 +29,7 @@ using namespace Gtk;
namespace gui { namespace gui {
namespace panels { namespace panels {
ViewerPanel::ViewerPanel(model::Project *const owner_project) : ViewerPanel::ViewerPanel(model::Project &owner_project) :
Panel(owner_project, "viewer", _("Viewer"), "panel_viewer") Panel(owner_project, "viewer", _("Viewer"), "panel_viewer")
{ {
//----- Pack in the Widgets -----// //----- Pack in the Widgets -----//

View file

@ -44,7 +44,7 @@ public:
* Contructor. * Contructor.
@param owner_project The project associated with this panel. @param owner_project The project associated with this panel.
**/ **/
ViewerPanel(model::Project *const owner_project); ViewerPanel(model::Project &owner_project);
protected: protected:

View file

@ -188,7 +188,7 @@ Actions::on_menu_sequence_add()
dialogs::NameChooser dialog(workspaceWindow, dialogs::NameChooser dialog(workspaceWindow,
_("Add Sequence"), _("New Sequence")); _("Add Sequence"), _("New Sequence"));
if(dialog.run() == RESPONSE_OK) if(dialog.run() == RESPONSE_OK)
workspaceWindow.get_project()->add_new_sequence(dialog.get_name()); workspaceWindow.get_project().add_new_sequence(dialog.get_name());
} }
/* ===== Track Menu Event Handlers ===== */ /* ===== Track Menu Event Handlers ===== */

View file

@ -41,12 +41,10 @@ using namespace gui::model;
namespace gui { namespace gui {
namespace workspace { namespace workspace {
WorkspaceWindow::WorkspaceWindow(Project *source_project) : WorkspaceWindow::WorkspaceWindow(Project &source_project) :
project(source_project), project(source_project),
actions(*this) actions(*this)
{ {
REQUIRE(source_project != NULL);
layout = NULL; layout = NULL;
assetsPanel = NULL; assetsPanel = NULL;
viewerPanel = NULL; viewerPanel = NULL;
@ -68,8 +66,8 @@ WorkspaceWindow::~WorkspaceWindow()
timelinePanel->unreference(); timelinePanel->unreference();
} }
Project* Project&
WorkspaceWindow::get_project() const WorkspaceWindow::get_project()
{ {
return project; return project;
} }

View file

@ -54,18 +54,18 @@ namespace workspace {
class WorkspaceWindow : public Gtk::Window class WorkspaceWindow : public Gtk::Window
{ {
public: public:
WorkspaceWindow(gui::model::Project *source_project); WorkspaceWindow(gui::model::Project &source_project);
~WorkspaceWindow(); ~WorkspaceWindow();
gui::model::Project* get_project() const; gui::model::Project& get_project();
private: private:
void create_ui(); void create_ui();
/* ===== Model ===== */ /* ===== Model ===== */
private: private:
gui::model::Project *project; gui::model::Project &project;
/* ===== UI ===== */ /* ===== UI ===== */
private: private: