1 /* === S Y N F I G ========================================================= */
2 /*! \file synfigapp/instance.h
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
10 ** This package is free software; you can redistribute it and/or
11 ** modify it under the terms of the GNU General Public License as
12 ** published by the Free Software Foundation; either version 2 of
13 ** the License, or (at your option) any later version.
15 ** This package is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 ** General Public License for more details.
21 /* ========================================================================= */
23 /* === S T A R T =========================================================== */
25 #ifndef __SYNFIG_APP_INSTANCE_H
26 #define __SYNFIG_APP_INSTANCE_H
28 /* === H E A D E R S ======================================================= */
32 #include <synfig/canvas.h>
33 #include <synfig/string.h>
35 #include <sigc++/signal.h>
36 #include <sigc++/object.h>
37 #include "action_system.h"
38 #include "selectionmanager.h"
41 /* === M A C R O S ========================================================= */
43 /* === T Y P E D E F S ===================================================== */
45 /* === C L A S S E S & S T R U C T S ======================================= */
49 class CanvasInterface;
52 class Instance : public Action::System , public CVSInfo
54 friend class PassiveGrouper;
56 -- ** -- P U B L I C T Y P E S ---------------------------------------------
61 typedef std::list< etl::handle<CanvasInterface> > CanvasInterfaceList;
63 using etl::shared_object::ref;
64 using etl::shared_object::unref;
67 -- ** -- P U B L I C D A T A ------------------------------------------------
73 -- ** -- P R I V A T E D A T A ---------------------------------------------
77 //! Handle for root canvas
78 synfig::Canvas::Handle canvas_;
81 CanvasInterfaceList canvas_interface_list_;
83 sigc::signal<void> signal_filename_changed_;
84 sigc::signal<void> signal_saved_;
85 etl::handle<SelectionManager> selection_manager_;
88 Instance(etl::handle<synfig::Canvas>);
91 -- ** -- P U B L I C M E T H O D S -----------------------------------------
98 void set_selection_manager(const etl::handle<SelectionManager> &sm) { assert(sm); selection_manager_=sm; }
99 void unset_selection_manager() { selection_manager_=new NullSelectionManager(); }
100 const etl::handle<SelectionManager> &get_selection_manager() { return selection_manager_; }
104 etl::handle<CanvasInterface> find_canvas_interface(synfig::Canvas::Handle canvas);
106 synfig::Canvas::Handle get_canvas()const { return canvas_; }
108 //! Saves the instance to filename_
111 bool save_as(const synfig::String &filename)const;
113 bool save_as(const synfig::String &filename);
115 public: // Interfaces to internal information
116 sigc::signal<void>& signal_filename_changed() { return signal_filename_changed_; }
117 sigc::signal<void>& signal_saved() { return signal_saved_; }
119 CanvasInterfaceList & canvas_interface_list() { return canvas_interface_list_; }
120 const CanvasInterfaceList & canvas_interface_list()const { return canvas_interface_list_; }
122 synfig::String get_file_name()const;
124 void set_file_name(const synfig::String &name);
129 public: // Constructor interfaces
130 static etl::handle<Instance> create(etl::handle<synfig::Canvas> canvas);
131 }; // END class Instance
133 etl::handle<Instance> find_instance(etl::handle<synfig::Canvas> canvas);
135 bool is_editable(synfig::ValueNode::Handle value_node);
137 }; // END namespace studio
139 /* === E N D =============================================================== */