1 /* === S Y N F I G ========================================================= */
2 /*! \file dock_canvasspecific.cpp
3 ** \brief Template File
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"
50 /* === U S I N G =========================================================== */
54 using namespace synfig;
55 using namespace studio;
57 /* === M A C R O S ========================================================= */
59 /* === G L O B A L S ======================================================= */
61 /* === P R O C E D U R E S ================================================= */
63 /* === M E T H O D S ======================================================= */
65 Dock_CanvasSpecific::Dock_CanvasSpecific(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_):
66 Dockable(name,local_name,stock_id_)
68 App::signal_instance_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_instance));
71 Dock_CanvasSpecific::~Dock_CanvasSpecific()
75 etl::loose_handle<studio::CanvasView>
76 Dock_CanvasSpecific::get_canvas_view()
78 return App::get_selected_canvas_view();
81 etl::loose_handle<synfigapp::CanvasInterface>
82 Dock_CanvasSpecific::get_canvas_interface()
85 return get_canvas_view()->canvas_interface();
90 Dock_CanvasSpecific::init_canvas_view_vfunc(etl::loose_handle<CanvasView> /*canvas_view*/)
95 Dock_CanvasSpecific::init_instance_vfunc(etl::loose_handle<Instance> /*instance*/)
100 Dock_CanvasSpecific::changed_canvas_view_vfunc(etl::loose_handle<CanvasView> /*canvas_view*/)
105 Dock_CanvasSpecific::init_instance(etl::handle<Instance> instance)
107 etl::clock timer;timer.reset();
108 instance->signal_canvas_view_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_canvas_view));
109 init_instance_vfunc(instance);
110 // synfig::info("%s init_instance() took %f seconds",get_local_name().c_str(),float(timer()));
114 Dock_CanvasSpecific::delete_instance(etl::handle<Instance> /*instance*/)
116 changed_canvas_view_vfunc(0);
120 Dock_CanvasSpecific::init_canvas_view(CanvasView* canvas_view)
123 canvas_view->signal_focus_in_event().connect(
128 &Dock_CanvasSpecific::canvas_view_changed
135 // synfig::info("%s init_canvas_view() Starting init...",get_local_name().c_str());
136 etl::clock timer;timer.reset();
137 App::signal_canvas_view_focus().connect(
141 &Dock_CanvasSpecific::canvas_view_changed
145 init_canvas_view_vfunc(canvas_view);
146 // synfig::info("%s init_canvas_view() took %f seconds",get_local_name().c_str(),float(timer()));
150 Dock_CanvasSpecific::canvas_view_changed()
152 etl::loose_handle<CanvasView> canvas_view(App::get_selected_canvas_view());
155 canvas_delete_connection.disconnect();
156 canvas_delete_connection=canvas_view->signal_deleted().connect(
160 &Dock_CanvasSpecific::changed_canvas_view
162 etl::loose_handle<CanvasView>(0)
169 // synfig::info("%s canvas_view_changed: start",get_local_name().c_str());
171 changed_canvas_view_vfunc(canvas_view);
173 // synfig::info("%s canvas_view_changed: end",get_local_name().c_str());