Add 2 new valuenode types: "Angle String" and "Int String".
[synfig.git] / synfig-studio / trunk / src / gtkmm / dialog_keyframe.cpp
1 /* === S Y N F I G ========================================================= */
2 /*!     \file dialog_keyframe.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 "dialog_keyframe.h"
33 #include <gtkmm/scrolledwindow.h>
34 #include <gtkmm/button.h>
35 #include "widget_waypointmodel.h"
36 #include <synfigapp/action.h>
37 #include <synfigapp/instance.h>
38
39 #include "general.h"
40
41 #endif
42
43 /* === U S I N G =========================================================== */
44
45 using namespace std;
46 using namespace etl;
47 using namespace synfig;
48 using namespace studio;
49
50 /* === M A C R O S ========================================================= */
51
52 /* === G L O B A L S ======================================================= */
53
54 /* === P R O C E D U R E S ================================================= */
55
56 /* === M E T H O D S ======================================================= */
57
58 Dialog_Keyframe::Dialog_Keyframe(Gtk::Window& parent, etl::handle<synfigapp::CanvasInterface> canvas_interface):
59         Gtk::Dialog(_("Keyframe Dialog"),parent,false,true),
60         canvas_interface(canvas_interface)
61 {
62         // Set up the buttons
63         {
64                 Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))));
65                 ok_button->show();
66                 add_action_widget(*ok_button,2);
67                 ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_ok_pressed));
68
69 /*              Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply"))));
70                 apply_button->show();
71                 add_action_widget(*apply_button,1);
72                 apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_apply_pressed));
73 */
74                 Gtk::Button *delete_button(manage(new class Gtk::Button(Gtk::StockID("gtk-delete"))));
75                 delete_button->show();
76                 add_action_widget(*delete_button,3);
77                 delete_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_delete_pressed));
78
79                 Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close"))));
80                 cancel_button->show();
81                 add_action_widget(*cancel_button,0);
82                 cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::hide));
83         }
84
85         Gtk::Table *table=manage(new Gtk::Table(2,2,false));
86
87         get_vbox()->pack_start(*table);
88
89         entry_description.set_text(_("Not yet implemented"));
90
91         //table->attach(*manage(new Gtk::Label(_("Description"))), 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
92         //table->attach(entry_description, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
93
94         table->show_all();
95
96         widget_waypoint_model=Gtk::manage(new Widget_WaypointModel());
97         widget_waypoint_model->show();
98         table->attach(*widget_waypoint_model, 0, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
99
100 }
101
102 Dialog_Keyframe::~Dialog_Keyframe()
103 {
104 }
105
106 const synfig::Keyframe&
107 Dialog_Keyframe::get_keyframe()const
108 {
109         return keyframe_;
110 }
111
112 void
113 Dialog_Keyframe::set_keyframe(const synfig::Keyframe& x)
114 {
115         keyframe_=x;
116 }
117
118 void
119 Dialog_Keyframe::on_ok_pressed()
120 {
121         if(widget_waypoint_model->get_waypoint_model().is_trivial())
122                 return;
123
124         synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_waypoint_set"));
125
126         assert(action);
127
128         action->set_param("canvas",canvas_interface->get_canvas());
129         action->set_param("canvas_interface",canvas_interface);
130         action->set_param("keyframe",keyframe_);
131         action->set_param("model",widget_waypoint_model->get_waypoint_model());
132
133         if(!canvas_interface->get_instance()->perform_action(action))
134         {
135         }
136 }
137
138
139 void
140 Dialog_Keyframe::on_delete_pressed()
141 {
142 }
143
144
145 void
146 Dialog_Keyframe::on_apply_pressed()
147 {
148 }