00001 /* === S Y N F I G ========================================================= */ 00021 /* ========================================================================= */ 00022 00023 /* === S T A R T =========================================================== */ 00024 00025 #ifndef __SYNFIG_APP_INSTANCE_H 00026 #define __SYNFIG_APP_INSTANCE_H 00027 00028 /* === H E A D E R S ======================================================= */ 00029 00030 #include "action.h" 00031 #include <ETL/handle> 00032 #include <synfig/canvas.h> 00033 #include <synfig/string.h> 00034 #include <list> 00035 #include <sigc++/signal.h> 00036 #include <sigc++/object.h> 00037 #include "action_system.h" 00038 #include "selectionmanager.h" 00039 #include "cvs.h" 00040 00041 /* === M A C R O S ========================================================= */ 00042 00043 /* === T Y P E D E F S ===================================================== */ 00044 00045 /* === C L A S S E S & S T R U C T S ======================================= */ 00046 00047 namespace synfigapp { 00048 00049 class CanvasInterface; 00050 00051 00052 class Instance : public Action::System , public CVSInfo 00053 { 00054 friend class PassiveGrouper; 00055 /* 00056 -- ** -- P U B L I C T Y P E S --------------------------------------------- 00057 */ 00058 00059 public: 00060 00061 typedef std::list< etl::handle<CanvasInterface> > CanvasInterfaceList; 00062 00063 using etl::shared_object::ref; 00064 using etl::shared_object::unref; 00065 00066 /* 00067 -- ** -- P U B L I C D A T A ------------------------------------------------ 00068 */ 00069 00070 public: 00071 00072 /* 00073 -- ** -- P R I V A T E D A T A --------------------------------------------- 00074 */ 00075 00076 private: 00078 synfig::Canvas::Handle canvas_; 00079 00080 00081 CanvasInterfaceList canvas_interface_list_; 00082 00083 sigc::signal<void> signal_filename_changed_; 00084 sigc::signal<void> signal_saved_; 00085 etl::handle<SelectionManager> selection_manager_; 00086 00087 protected: 00088 Instance(etl::handle<synfig::Canvas>); 00089 00090 /* 00091 -- ** -- P U B L I C M E T H O D S ----------------------------------------- 00092 */ 00093 00094 public: 00095 00096 ~Instance(); 00097 00098 void set_selection_manager(const etl::handle<SelectionManager> &sm) { assert(sm); selection_manager_=sm; } 00099 void unset_selection_manager() { selection_manager_=new NullSelectionManager(); } 00100 const etl::handle<SelectionManager> &get_selection_manager() { return selection_manager_; } 00101 00102 00103 00104 etl::handle<CanvasInterface> find_canvas_interface(synfig::Canvas::Handle canvas); 00105 00106 synfig::Canvas::Handle get_canvas()const { return canvas_; } 00107 00109 bool save()const; 00110 00111 bool save_as(const synfig::String &filename); 00112 00113 public: // Interfaces to internal information 00114 sigc::signal<void>& signal_filename_changed() { return signal_filename_changed_; } 00115 sigc::signal<void>& signal_saved() { return signal_saved_; } 00116 00117 CanvasInterfaceList & canvas_interface_list() { return canvas_interface_list_; } 00118 const CanvasInterfaceList & canvas_interface_list()const { return canvas_interface_list_; } 00119 00120 synfig::String get_file_name()const; 00121 00122 void set_file_name(const synfig::String &name); 00123 00124 public: 00125 00126 00127 public: // Constructor interfaces 00128 static etl::handle<Instance> create(etl::handle<synfig::Canvas> canvas); 00129 }; // END class Instance 00130 00131 etl::handle<Instance> find_instance(etl::handle<synfig::Canvas> canvas); 00132 00133 bool is_editable(synfig::ValueNode::Handle value_node); 00134 00135 }; // END namespace studio 00136 00137 /* === E N D =============================================================== */ 00138 00139 #endif