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 "docks/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 "canvasview.h"
49 /* === U S I N G =========================================================== */
53 using namespace synfig;
54 using namespace studio;
56 /* === M A C R O S ========================================================= */
58 /* === G L O B A L S ======================================================= */
60 /* === P R O C E D U R E S ================================================= */
62 /* === M E T H O D S ======================================================= */
64 Dock_CanvasSpecific::Dock_CanvasSpecific(const synfig::String& name,const synfig::String& local_name,Gtk::StockID stock_id_):
65 Dockable(name,local_name,stock_id_)
67 App::signal_instance_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_instance));
70 Dock_CanvasSpecific::~Dock_CanvasSpecific()
74 etl::loose_handle<studio::CanvasView>
75 Dock_CanvasSpecific::get_canvas_view()
77 return App::get_selected_canvas_view();
80 etl::loose_handle<synfigapp::CanvasInterface>
81 Dock_CanvasSpecific::get_canvas_interface()
84 return get_canvas_view()->canvas_interface();
89 Dock_CanvasSpecific::init_canvas_view_vfunc(etl::loose_handle<CanvasView> /*canvas_view*/)
94 Dock_CanvasSpecific::init_instance_vfunc(etl::loose_handle<Instance> /*instance*/)
99 Dock_CanvasSpecific::changed_canvas_view_vfunc(etl::loose_handle<CanvasView> /*canvas_view*/)
104 Dock_CanvasSpecific::init_instance(etl::handle<Instance> instance)
106 etl::clock timer;timer.reset();
107 instance->signal_canvas_view_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_canvas_view));
108 init_instance_vfunc(instance);
109 // synfig::info("%s init_instance() took %f seconds",get_local_name().c_str(),float(timer()));
113 Dock_CanvasSpecific::delete_instance(etl::handle<Instance> /*instance*/)
115 changed_canvas_view_vfunc(0);
119 Dock_CanvasSpecific::init_canvas_view(CanvasView* canvas_view)
122 canvas_view->signal_focus_in_event().connect(
127 &Dock_CanvasSpecific::canvas_view_changed
134 // synfig::info("%s init_canvas_view() Starting init...",get_local_name().c_str());
135 etl::clock timer;timer.reset();
136 App::signal_canvas_view_focus().connect(
140 &Dock_CanvasSpecific::canvas_view_changed
144 init_canvas_view_vfunc(canvas_view);
145 // synfig::info("%s init_canvas_view() took %f seconds",get_local_name().c_str(),float(timer()));
149 Dock_CanvasSpecific::canvas_view_changed()
151 etl::loose_handle<CanvasView> canvas_view(App::get_selected_canvas_view());
154 canvas_delete_connection.disconnect();
155 canvas_delete_connection=canvas_view->signal_deleted().connect(
159 &Dock_CanvasSpecific::changed_canvas_view
161 etl::loose_handle<CanvasView>(0)
168 // synfig::info("%s canvas_view_changed: start",get_local_name().c_str());
170 changed_canvas_view_vfunc(canvas_view);
172 // synfig::info("%s canvas_view_changed: end",get_local_name().c_str());