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>
43 /* === U S I N G =========================================================== */
47 using namespace synfig;
48 using namespace studio;
50 /* === M A C R O S ========================================================= */
52 /* === G L O B A L S ======================================================= */
54 /* === P R O C E D U R E S ================================================= */
56 /* === M E T H O D S ======================================================= */
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)
64 Gtk::Button *ok_button(manage(new class Gtk::Button(Gtk::StockID("gtk-ok"))));
66 add_action_widget(*ok_button,2);
67 ok_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_ok_pressed));
69 /* Gtk::Button *apply_button(manage(new class Gtk::Button(Gtk::StockID("gtk-apply"))));
71 add_action_widget(*apply_button,1);
72 apply_button->signal_clicked().connect(sigc::mem_fun(*this, &Dialog_Keyframe::on_apply_pressed));
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));
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));
85 Gtk::Table *table=manage(new Gtk::Table(2,2,false));
87 get_vbox()->pack_start(*table);
89 entry_description.set_text(_("Not yet implemented"));
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);
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);
102 Dialog_Keyframe::~Dialog_Keyframe()
106 const synfig::Keyframe&
107 Dialog_Keyframe::get_keyframe()const
113 Dialog_Keyframe::set_keyframe(const synfig::Keyframe& x)
119 Dialog_Keyframe::on_ok_pressed()
121 if(widget_waypoint_model->get_waypoint_model().is_trivial())
124 synfigapp::Action::Handle action(synfigapp::Action::create("KeyframeWaypointSet"));
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());
133 if(!canvas_interface->get_instance()->perform_action(action))
140 Dialog_Keyframe::on_delete_pressed()
146 Dialog_Keyframe::on_apply_pressed()