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