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