Removed a bunch more DEBUGPOINT()s.
[synfig.git] / synfig-studio / trunk / src / gtkmm / dock_params.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file dock_params.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 "dock_params.h"
33 #include "app.h"
34
35 #include <gtkmm/scrolledwindow.h>
36 #include <cassert>
37 #include "instance.h"
38 #include <sigc++/signal.h>
39 #include <sigc++/hide.h>
40 #include <sigc++/slot.h>
41 #include "canvasview.h"
42 #include "layerparamtreestore.h"
43 #include "workarea.h"
44
45 #include "general.h"
46
47 #endif
48
49 /* === U S I N G =========================================================== */
50
51 using namespace std;
52 using namespace etl;
53 using namespace synfig;
54 using namespace studio;
55
56 /* === M A C R O S ========================================================= */
57
58 /* === G L O B A L S ======================================================= */
59
60 /* === P R O C E D U R E S ================================================= */
61
62 /* === M E T H O D S ======================================================= */
63
64 Dock_Params::Dock_Params():
65         Dock_CanvasSpecific("params",_("Params"),Gtk::Stock::INDEX/*Gtk::StockID("synfig-params")*/),
66         action_group(Gtk::ActionGroup::create())
67 {
68 /*
69         App::ui_manager()->insert_action_group(action_group_layer_ops);
70
71     Glib::ustring ui_info =
72         "<ui>"
73         "       <toolbar action='toolbar-palette'>"
74         "       <toolitem action='amount-increase' />"
75         "       <toolitem action='amount-decrease' />"
76         "       </toolbar>"
77         "</ui>"
78         ;
79
80         App::ui_manager()->add_ui_from_string(ui_info);
81         */
82 }
83
84 Dock_Params::~Dock_Params()
85 {
86 }
87
88
89 void
90 Dock_Params::init_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view)
91 {
92         Gtk::TreeView* tree_view(
93                 static_cast<Gtk::TreeView*>(canvas_view->get_ext_widget(get_name()))
94         );
95
96         if(tree_view)
97         {
98                 tree_view->get_selection()->signal_changed().connect(
99                         sigc::mem_fun(
100                                 *this,
101                                 &Dock_Params::refresh_selected_param
102                         )
103                 );
104         }
105 }
106
107 void
108 Dock_Params::refresh_selected_param()
109 {
110         Gtk::TreeView* tree_view(
111                 static_cast<Gtk::TreeView*>(get_canvas_view()->get_ext_widget(get_name()))
112         );
113         Gtk::TreeModel::iterator iter(tree_view->get_selection()->get_selected());
114
115         if(iter)
116         {
117                 LayerParamTreeStore::Model model;
118                 get_canvas_view()->work_area->set_selected_value_node(
119                         (synfig::ValueNode::Handle)(*iter)[model.value_node]
120                 );
121         }
122         else
123         {
124                 get_canvas_view()->work_area->set_selected_value_node(0);
125         }
126 }
127
128 void
129 Dock_Params::changed_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view)
130 {
131         if(canvas_view)
132         {
133                 Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name()));
134
135                 add(*tree_view);
136                 tree_view->show();
137                 show_all();
138         }
139         else clear_previous();
140 }