1 /* === S Y N F I G ========================================================= */
5 ** $Id: instance.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
8 ** Copyright (c) 2002 Robert B. Quattlebaum Jr.
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
14 ** You may not copy, print, publish, or in any
15 ** other way distribute this software without
16 ** a prior written agreement with
17 ** the copyright holder.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SYNFIG_APP_INSTANCE_H
25 #define __SYNFIG_APP_INSTANCE_H
27 /* === H E A D E R S ======================================================= */
31 #include <synfig/canvas.h>
32 #include <synfig/string.h>
34 #include <sigc++/signal.h>
35 #include <sigc++/object.h>
36 #include "action_system.h"
37 #include "selectionmanager.h"
40 /* === M A C R O S ========================================================= */
42 /* === T Y P E D E F S ===================================================== */
44 /* === C L A S S E S & S T R U C T S ======================================= */
48 class CanvasInterface;
51 class Instance : public Action::System , public CVSInfo
53 friend class PassiveGrouper;
55 -- ** -- P U B L I C T Y P E S ---------------------------------------------
60 typedef std::list< etl::handle<CanvasInterface> > CanvasInterfaceList;
62 using etl::shared_object::ref;
63 using etl::shared_object::unref;
66 -- ** -- P U B L I C D A T A ------------------------------------------------
72 -- ** -- P R I V A T E D A T A ---------------------------------------------
76 //! Handle for root canvas
77 synfig::Canvas::Handle canvas_;
80 CanvasInterfaceList canvas_interface_list_;
82 sigc::signal<void> signal_filename_changed_;
83 sigc::signal<void> signal_saved_;
84 etl::handle<SelectionManager> selection_manager_;
87 Instance(etl::handle<synfig::Canvas>);
90 -- ** -- P U B L I C M E T H O D S -----------------------------------------
97 void set_selection_manager(const etl::handle<SelectionManager> &sm) { assert(sm); selection_manager_=sm; }
98 void unset_selection_manager() { selection_manager_=new NullSelectionManager(); }
99 const etl::handle<SelectionManager> &get_selection_manager() { return selection_manager_; }
103 etl::handle<CanvasInterface> find_canvas_interface(synfig::Canvas::Handle canvas);
105 synfig::Canvas::Handle get_canvas()const { return canvas_; }
107 //! Saves the instance to filename_
110 bool save_as(const synfig::String &filename)const;
112 bool save_as(const synfig::String &filename);
114 public: // Interfaces to internal information
115 sigc::signal<void>& signal_filename_changed() { return signal_filename_changed_; }
116 sigc::signal<void>& signal_saved() { return signal_saved_; }
118 CanvasInterfaceList & canvas_interface_list() { return canvas_interface_list_; }
119 const CanvasInterfaceList & canvas_interface_list()const { return canvas_interface_list_; }
121 synfig::String get_file_name()const;
123 void set_file_name(const synfig::String &name);
128 public: // Constructor interfaces
129 static etl::handle<Instance> create(etl::handle<synfig::Canvas> canvas);
130 }; // END class Instance
132 etl::handle<Instance> find_instance(etl::handle<synfig::Canvas> canvas);
134 bool is_editable(synfig::ValueNode::Handle value_node);
136 }; // END namespace studio
138 /* === E N D =============================================================== */