5fbf61cb0566e847c3909f74236481310efa94c0
[synfig.git] /
1 /* === S Y N F I G ========================================================= */
2 /*!     \file dialog_waypoint.cpp
3 **      \brief Template Header
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 <gtkmm/label.h>
33 #include "dialog_waypoint.h"
34 #include <gtk/gtk.h>
35 #include <gtkmm/spinbutton.h>
36 #include <gtkmm/combo.h>
37 #include <ETL/stringf>
38 #include "widget_value.h"
39 #include "app.h"
40 #include <gtkmm/menu.h>
41 #include <gtkmm/optionmenu.h>
42 #include "widget_time.h"
43 #include "widget_waypoint.h"
44
45 #include "general.h"
46
47 #endif
48
49 using namespace synfig;
50 using namespace std;
51 using namespace etl;
52 using namespace studio;
53
54 /* === M A C R O S ========================================================= */
55
56 /* === G L O B A L S ======================================================= */
57
58 /* === P R O C E D U R E S ================================================= */
59
60 /* === M E T H O D S ======================================================= */
61
62 Dialog_Waypoint::Dialog_Waypoint(Gtk::Window& parent,etl::handle<synfig::Canvas> canvas):
63         Dialog(_("Waypoint Editor"),parent,false,true),
64         canvas(canvas)
65 {
66         assert(canvas);
67     waypointwidget=manage(new class Widget_Waypoint(canvas));
68         get_vbox()->pack_start(*waypointwidget);
69
70         Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))));
71         ok_button->show();
72         add_action_widget(*ok_button,2);
73         ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_ok_pressed));
74
75         Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply"))));
76         apply_button->show();
77         add_action_widget(*apply_button,1);
78         apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_apply_pressed));
79
80         Gtk::Button *delete_button(manage(new class Gtk::Button(Gtk::StockID("gtk-delete"))));
81         delete_button->show();
82         add_action_widget(*delete_button,3);
83         delete_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_delete_pressed));
84
85         Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close"))));
86         cancel_button->show();
87         add_action_widget(*cancel_button,0);
88         cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::hide));
89
90
91         waypointwidget->show_all();
92 }
93
94 Dialog_Waypoint::~Dialog_Waypoint()
95 {
96 }
97
98 void
99 Dialog_Waypoint::on_ok_pressed()
100 {
101         hide();
102     signal_changed_();
103 }
104
105 void
106 Dialog_Waypoint::on_apply_pressed()
107 {
108     signal_changed_();
109 }
110
111 void
112 Dialog_Waypoint::on_delete_pressed()
113 {
114         hide();
115     signal_delete_();
116 }
117
118 void
119 Dialog_Waypoint::set_waypoint(synfig::ValueNode_Animated::Waypoint x)
120 {
121         waypointwidget->set_waypoint(x);
122 }
123
124 const synfig::ValueNode_Animated::Waypoint &
125 Dialog_Waypoint::get_waypoint()const
126 {
127         return waypointwidget->get_waypoint();
128 }
129
130 void
131 Dialog_Waypoint::set_value_desc(synfigapp::ValueDesc value_desc)
132 {
133         value_desc_=value_desc;
134         if(value_desc.get_value_node() && value_desc.get_value_node()->get_parent_canvas())
135                 waypointwidget->set_canvas(value_desc.get_value_node()->get_parent_canvas());
136 }
137
138 void
139 Dialog_Waypoint::reset()
140 {
141 }