source: synfigstudio/trunk/fuentes/.pc/c++11.patch/src/gui/docks/dock_params.cpp @ 481

Last change on this file since 481 was 481, checked in by jrpelegrina, 4 years ago

First release to xenial

File size: 3.0 KB
Line 
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 "docks/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 "trees/layerparamtreestore.h"
43#include "workarea.h"
44
45#include "general.h"
46
47#endif
48
49/* === U S I N G =========================================================== */
50
51using namespace std;
52using namespace etl;
53using namespace synfig;
54using 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
64Dock_Params::Dock_Params():
65        Dock_CanvasSpecific("params",_("Parameters"),Gtk::StockID("synfig-params")),
66        action_group(Gtk::ActionGroup::create("action_group_dock_params"))
67{
68}
69
70Dock_Params::~Dock_Params()
71{
72}
73
74
75void
76Dock_Params::init_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view)
77{
78        Gtk::TreeView* tree_view(
79                static_cast<Gtk::TreeView*>(canvas_view->get_ext_widget(get_name()))
80        );
81
82        if(tree_view)
83        {
84                tree_view->get_selection()->signal_changed().connect(
85                        sigc::mem_fun(
86                                *this,
87                                &Dock_Params::refresh_selected_param
88                        )
89                );
90        }
91}
92
93void
94Dock_Params::refresh_selected_param()
95{
96        Gtk::TreeView* tree_view(
97                static_cast<Gtk::TreeView*>(get_canvas_view()->get_ext_widget(get_name()))
98        );
99        Gtk::TreeModel::iterator iter(tree_view->get_selection()->get_selected());
100
101        if(iter)
102        {
103                LayerParamTreeStore::Model model;
104                get_canvas_view()->work_area->set_selected_value_node(
105                        (synfig::ValueNode::Handle)(*iter)[model.value_node]
106                );
107        }
108        else
109        {
110                get_canvas_view()->work_area->set_selected_value_node(0);
111        }
112}
113
114void
115Dock_Params::changed_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view)
116{
117        if(canvas_view)
118        {
119                Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name()));
120
121                add(*tree_view);
122                tree_view->show();
123                show_all();
124        }
125        else clear_previous();
126}
Note: See TracBrowser for help on using the repository browser.