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");
WorkspaceWindow main_window(&project);
WorkspaceWindow main_window(project);
kit.run(main_window);

View file

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

View file

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

View file

@ -26,12 +26,11 @@
namespace gui {
namespace panels {
Panel::Panel(model::Project *const owner_project,
Panel::Panel(model::Project &owner_project,
const gchar *name, const gchar *long_name,
GdlDockItemBehavior behavior) :
project(owner_project)
{
REQUIRE(owner_project != NULL);
REQUIRE(name != NULL);
REQUIRE(long_name != NULL);
@ -42,12 +41,11 @@ Panel::Panel(model::Project *const owner_project,
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,
GdlDockItemBehavior behavior) :
project(owner_project)
{
REQUIRE(owner_project != NULL);
REQUIRE(name != NULL);
REQUIRE(long_name != NULL);
REQUIRE(stock_id != NULL);

View file

@ -51,7 +51,7 @@ protected:
* @param long_name The name to display on the caption
* @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,
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 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,
GdlDockItemBehavior behavior = GDL_DOCK_ITEM_BEH_NORMAL);
@ -99,7 +99,7 @@ private:
protected:
model::Project *const project;
model::Project &project;
GdlDockItem* dock_item;
};

View file

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

View file

@ -50,7 +50,7 @@ public:
* Constructor
* @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 panels {
ViewerPanel::ViewerPanel(model::Project *const owner_project) :
ViewerPanel::ViewerPanel(model::Project &owner_project) :
Panel(owner_project, "viewer", _("Viewer"), "panel_viewer")
{
//----- Pack in the Widgets -----//

View file

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

View file

@ -188,7 +188,7 @@ Actions::on_menu_sequence_add()
dialogs::NameChooser dialog(workspaceWindow,
_("Add Sequence"), _("New Sequence"));
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 ===== */

View file

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

View file

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