1 /* === S Y N F I G ========================================================= */
2 /*! \file dock_canvasspecific.cpp
3 ** \brief Template File
5 ** $Id: dock_canvasspecific.cpp,v 1.3 2005/01/13 20:23:01 darco Exp $
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 /* === H E A D E R S ======================================================= */
33 #include "dock_canvasspecific.h"
35 #include <gtkmm/scrolledwindow.h>
38 #include <sigc++/signal.h>
39 #include <sigc++/adaptors/hide.h>
40 //#include <sigc++/hide.h>
41 #include <sigc++/slot.h>
42 #include "metadatatreestore.h"
43 #include "canvasview.h"
48 /* === U S I N G =========================================================== */
52 using namespace synfig;
53 using namespace studio;
55 /* === M A C R O S ========================================================= */
57 /* === G L O B A L S ======================================================= */
59 /* === P R O C E D U R E S ================================================= */
61 /* === M E T H O D S ======================================================= */
63 Dock_CanvasSpecific::Dock_CanvasSpecific(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_):
64 Dockable(name,local_name,stock_id_)
66 App::signal_instance_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_instance));
69 Dock_CanvasSpecific::~Dock_CanvasSpecific()
73 etl::loose_handle<studio::CanvasView>
74 Dock_CanvasSpecific::get_canvas_view()
76 return App::get_selected_canvas_view();
79 etl::loose_handle<synfigapp::CanvasInterface>
80 Dock_CanvasSpecific::get_canvas_interface()
83 return get_canvas_view()->canvas_interface();
88 Dock_CanvasSpecific::init_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view)
93 Dock_CanvasSpecific::init_instance_vfunc(etl::loose_handle<Instance> instance)
98 Dock_CanvasSpecific::changed_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view)
103 Dock_CanvasSpecific::init_instance(etl::handle<Instance> instance)
105 etl::clock timer;timer.reset();
106 instance->signal_canvas_view_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_canvas_view));
107 init_instance_vfunc(instance);
108 synfig::info("%s init_instance() took %f seconds",get_local_name().c_str(),float(timer()));
112 Dock_CanvasSpecific::delete_instance(etl::handle<Instance> instance)
114 changed_canvas_view_vfunc(0);
118 Dock_CanvasSpecific::init_canvas_view(CanvasView* canvas_view)
121 canvas_view->signal_focus_in_event().connect(
126 &Dock_CanvasSpecific::canvas_view_changed
133 synfig::info("%s init_canvas_view() Starting init...",get_local_name().c_str());
134 etl::clock timer;timer.reset();
135 App::signal_canvas_view_focus().connect(
139 &Dock_CanvasSpecific::canvas_view_changed
143 init_canvas_view_vfunc(canvas_view);
144 synfig::info("%s init_canvas_view() took %f seconds",get_local_name().c_str(),float(timer()));
148 Dock_CanvasSpecific::canvas_view_changed()
150 etl::loose_handle<CanvasView> canvas_view(App::get_selected_canvas_view());
153 canvas_delete_connection.disconnect();
154 canvas_delete_connection=canvas_view->signal_deleted().connect(
158 &Dock_CanvasSpecific::changed_canvas_view
160 etl::loose_handle<CanvasView>(0)
167 synfig::info("%s canvas_view_changed: start",get_local_name().c_str());
169 changed_canvas_view_vfunc(canvas_view);
171 synfig::info("%s canvas_view_changed: end",get_local_name().c_str());