1 /* === S Y N F I G ========================================================= */
2 /*! \file dialog_keyframe.cpp
3 ** \brief Template File
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
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.
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.
21 /* ========================================================================= */
23 /* === H E A D E R S ======================================================= */
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>
41 /* === U S I N G =========================================================== */
45 using namespace synfig;
46 using namespace studio;
48 /* === M A C R O S ========================================================= */
50 /* === G L O B A L S ======================================================= */
52 /* === P R O C E D U R E S ================================================= */
54 /* === M E T H O D S ======================================================= */
56 Dialog_Keyframe::Dialog_Keyframe(Gtk::Window& parent,handle<synfigapp::CanvasInterface> canvas_interface):
57 Gtk::Dialog(_("Keyframe Dialog"),parent,false,true),
58 canvas_interface(canvas_interface)
62 Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))));
64 add_action_widget(*ok_button,2);
65 ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_ok_pressed));
67 /* Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply"))));
69 add_action_widget(*apply_button,1);
70 apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_apply_pressed));
72 Gtk::Button *delete_button(manage(new class Gtk::Button(Gtk::StockID("gtk-delete"))));
73 delete_button->show();
74 add_action_widget(*delete_button,3);
75 delete_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_delete_pressed));
77 Gtk::Button *cancel_button(manage(new class Gtk::Button(Gtk::StockID("gtk-close"))));
78 cancel_button->show();
79 add_action_widget(*cancel_button,0);
80 cancel_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::hide));
83 Gtk::Table *table=manage(new Gtk::Table(2,2,false));
85 get_vbox()->pack_start(*table);
87 entry_description.set_text("Not yet implemented");
89 //table->attach(*manage(new Gtk::Label(_("Description"))), 0, 1, 0, 1, Gtk::SHRINK|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
90 //table->attach(entry_description, 1, 2, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
94 widget_waypoint_model=Gtk::manage(new Widget_WaypointModel());
95 widget_waypoint_model->show();
96 table->attach(*widget_waypoint_model, 0, 2, 1, 2, Gtk::EXPAND|Gtk::FILL, Gtk::SHRINK|Gtk::FILL, 0, 0);
100 Dialog_Keyframe::~Dialog_Keyframe()
104 const synfig::Keyframe&
105 Dialog_Keyframe::get_keyframe()const
111 Dialog_Keyframe::set_keyframe(const synfig::Keyframe& x)
117 Dialog_Keyframe::on_ok_pressed()
119 if(widget_waypoint_model->get_waypoint_model().is_trivial())
122 synfigapp::Action::Handle action(synfigapp::Action::create("keyframe_waypoint_set"));
126 action->set_param("canvas",canvas_interface->get_canvas());
127 action->set_param("canvas_interface",canvas_interface);
128 action->set_param("keyframe",keyframe_);
129 action->set_param("model",widget_waypoint_model->get_waypoint_model());
131 if(!canvas_interface->get_instance()->perform_action(action))
138 Dialog_Keyframe::on_delete_pressed()
144 Dialog_Keyframe::on_apply_pressed()