source: synfigstudio/trunk/fuentes/src/gui/docks/dock_children.cpp @ 481

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

First release to xenial

File size: 2.9 KB
Line 
1/* === S Y N F I G ========================================================= */
2/*!     \file dock_children.cpp
3**      \brief Template File
4**
5**      $Id$
6**
7**      \legal
8**      Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9**      Copyright (c) 2007 Chris Moore
10**
11**      This package is free software; you can redistribute it and/or
12**      modify it under the terms of the GNU General Public License as
13**      published by the Free Software Foundation; either version 2 of
14**      the License, or (at your option) any later version.
15**
16**      This package is distributed in the hope that it will be useful,
17**      but WITHOUT ANY WARRANTY; without even the implied warranty of
18**      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19**      General Public License for more details.
20**      \endlegal
21*/
22/* ========================================================================= */
23
24/* === H E A D E R S ======================================================= */
25
26#ifdef USING_PCH
27#       include "pch.h"
28#else
29#ifdef HAVE_CONFIG_H
30#       include <config.h>
31#endif
32
33#include "docks/dock_children.h"
34#include "app.h"
35
36#include <gtkmm/scrolledwindow.h>
37#include <cassert>
38#include "instance.h"
39#include <sigc++/sigc++.h>
40#include "trees/childrentreestore.h"
41#include "trees/childrentree.h"
42#include "canvasview.h"
43
44#include "general.h"
45
46#endif
47
48/* === U S I N G =========================================================== */
49
50using namespace std;
51using namespace etl;
52using namespace synfig;
53using namespace studio;
54
55/* === M A C R O S ========================================================= */
56
57/* === G L O B A L S ======================================================= */
58
59/* === P R O C E D U R E S ================================================= */
60
61/* === M E T H O D S ======================================================= */
62
63Dock_Children::Dock_Children():
64        Dock_CanvasSpecific("children",_("Library"),Gtk::StockID("synfig-children"))
65{
66    //! \todo the combination of set_use_scrolled(false) and
67        //!       add(*tree_view) causes crashes when
68        //!       Dockable::prev_widget_ is left referencing a
69        //!       ChildrenTree that has already been destroyed.
70        // set_use_scrolled(false);
71}
72
73Dock_Children::~Dock_Children()
74{
75}
76
77void
78Dock_Children::init_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view)
79{
80        Glib::RefPtr<ChildrenTreeStore> children_tree_store;
81        children_tree_store=ChildrenTreeStore::create(canvas_view->canvas_interface());
82
83        ChildrenTree* children_tree(new ChildrenTree());
84        children_tree->set_model(children_tree_store);
85        children_tree->set_time_adjustment(canvas_view->time_adjustment());
86
87        canvas_view->set_tree_model(get_name(),children_tree_store);
88        canvas_view->set_ext_widget(get_name(),children_tree);
89}
90
91void
92Dock_Children::changed_canvas_view_vfunc(etl::loose_handle<CanvasView> canvas_view)
93{
94        if(canvas_view)
95        {
96                Gtk::Widget* tree_view(canvas_view->get_ext_widget(get_name()));
97
98                add(*tree_view);
99                tree_view->show();
100        }
101        else clear_previous();
102
103}
Note: See TracBrowser for help on using the repository browser.