Extract translatable strings from some more files
[synfig.git] / synfig-studio / trunk / src / gtkmm / dock_canvasspecific.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file dock_canvasspecific.cpp
3 **      \brief Template File
4 **
5 **      $Id$
6 **
7 **      \legal
8 **      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 **
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.
14 **
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.
19 **      \endlegal
20 */
21 /* ========================================================================= */
22
23 /* === H E A D E R S ======================================================= */
24
25 #ifdef USING_PCH
26 #       include "pch.h"
27 #else
28 #ifdef HAVE_CONFIG_H
29 #       include <config.h>
30 #endif
31
32 #include "app.h"
33 #include "dock_canvasspecific.h"
34
35 #include <gtkmm/scrolledwindow.h>
36 #include <cassert>
37 #include "instance.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"
44 #include <ETL/clock>
45
46 #include "general.h"
47
48 #endif
49
50 /* === U S I N G =========================================================== */
51
52 using namespace std;
53 using namespace etl;
54 using namespace synfig;
55 using namespace studio;
56
57 /* === M A C R O S ========================================================= */
58
59 /* === G L O B A L S ======================================================= */
60
61 /* === P R O C E D U R E S ================================================= */
62
63 /* === M E T H O D S ======================================================= */
64
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_)
67 {
68         App::signal_instance_created().connect(sigc::mem_fun(*this,&Dock_CanvasSpecific::init_instance));
69 }
70
71 Dock_CanvasSpecific::~Dock_CanvasSpecific()
72 {
73 }
74
75 etl::loose_handle<studio::CanvasView>
76 Dock_CanvasSpecific::get_canvas_view()
77 {
78         return App::get_selected_canvas_view();
79 }
80
81 etl::loose_handle<synfigapp::CanvasInterface>
82 Dock_CanvasSpecific::get_canvas_interface()
83 {
84         if(get_canvas_view())
85                 return get_canvas_view()->canvas_interface();
86         return 0;
87 }
88
89 void
90 Dock_CanvasSpecific::init_canvas_view_vfunc(etl::loose_handle<CanvasView> /*canvas_view*/)
91 {
92 }
93
94 void
95 Dock_CanvasSpecific::init_instance_vfunc(etl::loose_handle<Instance> /*instance*/)
96 {
97 }
98
99 void
100 Dock_CanvasSpecific::changed_canvas_view_vfunc(etl::loose_handle<CanvasView> /*canvas_view*/)
101 {
102 }
103
104 void
105 Dock_CanvasSpecific::init_instance(etl::handle<Instance> instance)
106 {
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()));
111 }
112
113 void
114 Dock_CanvasSpecific::delete_instance(etl::handle<Instance> /*instance*/)
115 {
116         changed_canvas_view_vfunc(0);
117 }
118
119 void
120 Dock_CanvasSpecific::init_canvas_view(CanvasView* canvas_view)
121 {
122         /*
123         canvas_view->signal_focus_in_event().connect(
124                 sigc::hide(
125                         sigc::bind_return(
126                                 sigc::mem_fun(
127                                         *this,
128                                         &Dock_CanvasSpecific::canvas_view_changed
129                                 ),
130                                 false
131                         )
132                 )
133         );
134         */
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(
138                 sigc::hide(
139                         sigc::mem_fun(
140                                 *this,
141                                 &Dock_CanvasSpecific::canvas_view_changed
142                         )
143                 )
144         );
145         init_canvas_view_vfunc(canvas_view);
146         // synfig::info("%s init_canvas_view() took %f seconds",get_local_name().c_str(),float(timer()));
147 }
148
149 void
150 Dock_CanvasSpecific::canvas_view_changed()
151 {
152         etl::loose_handle<CanvasView> canvas_view(App::get_selected_canvas_view());
153 /*      if(canvas_view)
154         {
155                 canvas_delete_connection.disconnect();
156                 canvas_delete_connection=canvas_view->signal_deleted().connect(
157                         sigc::bind(
158                                 sigc::mem_fun(
159                                         *this,
160                                         &Dock_CanvasSpecific::changed_canvas_view
161                                 ),
162                                 etl::loose_handle<CanvasView>(0)
163                         )
164                 );
165         }
166 */
167
168 // #ifdef _DEBUG
169 //      synfig::info("%s canvas_view_changed: start",get_local_name().c_str());
170 // #endif
171         changed_canvas_view_vfunc(canvas_view);
172 // #ifdef _DEBUG
173 //      synfig::info("%s canvas_view_changed: end",get_local_name().c_str());
174 // #endif
175 }