grab stable branch
[synfig.git] / synfig-studio / tags / stable / src / gtkmm / dialog_waypoint.cpp
1 /* === S I N F 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 Robert B. Quattlebaum Jr.
9 **
10 **      This software and associated documentation
11 **      are CONFIDENTIAL and PROPRIETARY property of
12 **      the above-mentioned copyright holder.
13 **
14 **      You may not copy, print, publish, or in any
15 **      other way distribute this software without
16 **      a prior written agreement with
17 **      the copyright holder.
18 **      \endlegal
19 */
20 /* ========================================================================= */
21
22 /* === H E A D E R S ======================================================= */
23
24 #ifdef USING_PCH
25 #       include "pch.h"
26 #else
27 #ifdef HAVE_CONFIG_H
28 #       include <config.h>
29 #endif
30
31 #include <gtkmm/label.h>
32 #include "dialog_waypoint.h"
33 #include <gtk/gtk.h>
34 #include <gtkmm/spinbutton.h>
35 #include <gtkmm/combo.h>
36 #include <ETL/stringf>
37 #include "widget_value.h"
38 #include "app.h"
39 #include <gtkmm/menu.h>
40 #include <gtkmm/optionmenu.h>
41 #include "widget_time.h"
42 #include "widget_waypoint.h"
43
44 #endif
45
46 using namespace sinfg;
47 using namespace std;
48 using namespace etl;
49 using namespace studio;
50
51 /* === M A C R O S ========================================================= */
52
53 /* === G L O B A L S ======================================================= */
54
55 /* === P R O C E D U R E S ================================================= */
56
57 /* === M E T H O D S ======================================================= */
58
59 Dialog_Waypoint::Dialog_Waypoint(Gtk::Window& parent,etl::handle<sinfg::Canvas> canvas):
60         Dialog(_("Waypoint Editor"),parent,false,true),
61         canvas(canvas)
62 {
63         assert(canvas);
64     waypointwidget=manage(new class Widget_Waypoint(canvas));
65         get_vbox()->pack_start(*waypointwidget);
66
67         Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))));
68         ok_button->show();
69         add_action_widget(*ok_button,2);
70         ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_ok_pressed));
71
72         Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply"))));
73         apply_button->show();
74         add_action_widget(*apply_button,1);
75         apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_apply_pressed));
76
77         Gtk::Button *delete_button(manage(new class Gtk::Button(Gtk::StockID("gtk-delete"))));
78         delete_button->show();
79         add_action_widget(*delete_button,3);
80         delete_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::on_delete_pressed));
81
82         Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close"))));
83         cancel_button->show();
84         add_action_widget(*cancel_button,0);
85         cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Waypoint::hide));
86
87         
88         waypointwidget->show_all();
89 }
90
91 Dialog_Waypoint::~Dialog_Waypoint()
92 {
93 }
94
95 void
96 Dialog_Waypoint::on_ok_pressed()
97 {
98         hide();
99     signal_changed_();
100 }
101
102 void
103 Dialog_Waypoint::on_apply_pressed()
104 {
105     signal_changed_();  
106 }
107
108 void
109 Dialog_Waypoint::on_delete_pressed()
110 {
111         hide();
112     signal_delete_();   
113 }
114
115 void
116 Dialog_Waypoint::set_waypoint(sinfg::ValueNode_Animated::Waypoint x)
117 {
118         waypointwidget->set_waypoint(x);
119 }
120
121 const sinfg::ValueNode_Animated::Waypoint &
122 Dialog_Waypoint::get_waypoint()const
123 {
124         return waypointwidget->get_waypoint();
125 }
126
127 void
128 Dialog_Waypoint::set_value_desc(sinfgapp::ValueDesc value_desc)
129 {
130         value_desc_=value_desc;
131         if(value_desc.get_value_node() && value_desc.get_value_node()->get_parent_canvas())
132                 waypointwidget->set_canvas(value_desc.get_value_node()->get_parent_canvas());
133 }
134
135 void
136 Dialog_Waypoint::reset()
137 {
138 }