X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=synfig-studio%2Fsrc%2Fsynfigapp%2Finstance.h;fp=synfig-studio%2Fsrc%2Fsynfigapp%2Finstance.h;h=19749ad56e9a48f875368d37fb42f11492b19738;hb=a095981e18cc37a8ecc7cd237cc22b9c10329264;hp=0000000000000000000000000000000000000000;hpb=9459638ad6797b8139f1e9f0715c96076dbf0890;p=synfig.git diff --git a/synfig-studio/src/synfigapp/instance.h b/synfig-studio/src/synfigapp/instance.h new file mode 100644 index 0000000..19749ad --- /dev/null +++ b/synfig-studio/src/synfigapp/instance.h @@ -0,0 +1,139 @@ +/* === S Y N F I G ========================================================= */ +/*! \file synfigapp/instance.h +** \brief writeme +** +** $Id$ +** +** \legal +** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley +** +** This package is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 2 of +** the License, or (at your option) any later version. +** +** This package is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** \endlegal +*/ +/* ========================================================================= */ + +/* === S T A R T =========================================================== */ + +#ifndef __SYNFIG_APP_INSTANCE_H +#define __SYNFIG_APP_INSTANCE_H + +/* === H E A D E R S ======================================================= */ + +#include "action.h" +#include +#include +#include +#include +#include +#include +#include "action_system.h" +#include "selectionmanager.h" +#include "cvs.h" + +/* === M A C R O S ========================================================= */ + +/* === T Y P E D E F S ===================================================== */ + +/* === C L A S S E S & S T R U C T S ======================================= */ + +namespace synfigapp { + +class CanvasInterface; + + +class Instance : public Action::System , public CVSInfo +{ + friend class PassiveGrouper; + /* + -- ** -- P U B L I C T Y P E S --------------------------------------------- + */ + +public: + + typedef std::list< etl::handle > CanvasInterfaceList; + + using etl::shared_object::ref; + using etl::shared_object::unref; + + /* + -- ** -- P U B L I C D A T A ------------------------------------------------ + */ + +public: + + /* + -- ** -- P R I V A T E D A T A --------------------------------------------- + */ + +private: + //! Handle for root canvas + synfig::Canvas::Handle canvas_; + + + CanvasInterfaceList canvas_interface_list_; + + sigc::signal signal_filename_changed_; + sigc::signal signal_saved_; + etl::handle selection_manager_; + +protected: + Instance(etl::handle); + + /* + -- ** -- P U B L I C M E T H O D S ----------------------------------------- + */ + +public: + + ~Instance(); + + void set_selection_manager(const etl::handle &sm) { assert(sm); selection_manager_=sm; } + void unset_selection_manager() { selection_manager_=new NullSelectionManager(); } + const etl::handle &get_selection_manager() { return selection_manager_; } + + + + etl::handle find_canvas_interface(synfig::Canvas::Handle canvas); + + synfig::Canvas::Handle get_canvas()const { return canvas_; } + + //! Saves the instance to filename_ + bool save()const; + + bool save_as(const synfig::String &filename); + +public: // Interfaces to internal information + sigc::signal& signal_filename_changed() { return signal_filename_changed_; } + sigc::signal& signal_saved() { return signal_saved_; } + + CanvasInterfaceList & canvas_interface_list() { return canvas_interface_list_; } + const CanvasInterfaceList & canvas_interface_list()const { return canvas_interface_list_; } + + synfig::String get_file_name()const; + + void set_file_name(const synfig::String &name); + +public: + + +public: // Constructor interfaces + static etl::handle create(etl::handle canvas); +}; // END class Instance + +etl::handle find_instance(etl::handle canvas); + +bool is_editable(synfig::ValueNode::Handle value_node); + +}; // END namespace studio + +/* === E N D =============================================================== */ + +#endif