1 /* === S Y N F I G ========================================================= */
2 /*! \file widget_keyframe_list.h
3 ** \brief A custom widget to manage keyframes in the timeline.
8 ** Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
9 ** Copyright (c) 2009 Carlos López
11 ** This package is free software; you can redistribute it and/or
12 ** modify it under the terms of the GNU General Public License as
13 ** published by the Free Software Foundation; either version 2 of
14 ** the License, or (at your option) any later version.
16 ** This package is distributed in the hope that it will be useful,
17 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
18 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 ** General Public License for more details.
22 /* ========================================================================= */
24 /* === S T A R T =========================================================== */
26 #ifndef __SYNFIG_STUDIO_WIDGET_KEYFRAME_LIST_H
27 #define __SYNFIG_STUDIO_WIDGET_KEYFRAME_LIST_H
29 /* === H E A D E R S ======================================================= */
31 #include <gtkmm/drawingarea.h>
32 #include <gtkmm/adjustment.h>
33 #include <synfig/keyframe.h>
34 #include <sigc++/connection.h>
37 /* === M A C R O S ========================================================= */
39 /* === T Y P E D E F S ===================================================== */
41 /* === C L A S S E S & S T R U C T S ======================================= */
45 class Widget_Keyframe_List : public Gtk::DrawingArea
47 //! Time adjustment window
48 Gtk::Adjustment adj_default;
49 Gtk::Adjustment *adj_timescale;
51 //!The list of keyframes to be drawn on the widget and moved with mouse
52 synfig::KeyframeList kf_list_;
54 //! The frames per second of the canvas
56 //!True if it is editable. Keyframes can be moved.
59 //!True if a keyframe is being dragged.
62 //!True if a keyframe has been moved
65 //!Holds the selected keyframe of the keyframe list
66 synfig::Keyframe selected_kf;
68 //!The time of the selected keyframe
69 synfig::Time selected_kf_time;
71 //!The time of the selected keyframe during draging
72 synfig::Time dragging_kf_time;
74 //!Connectors for handling the signals of the time adjustment
75 sigc::connection time_value_change;
76 sigc::connection time_other_change;
80 //!Default constructor
81 Widget_Keyframe_List();
84 ~Widget_Keyframe_List();
86 //!Loads a new keyframe list on the widget.
87 void set_kf_list(const synfig::KeyframeList& x);
89 //!Member for private data.
90 const synfig::KeyframeList& get_kf_list()const { return kf_list_; }
92 //!Member for private data
93 void set_editable(bool x=true) { editable_=x; }
95 //!Member for private data
96 bool get_editable()const { return editable_; }
99 //!Store the selected keyframe value
100 void set_selected_keyframe(const synfig::Keyframe &x);
102 //!Returns the selected keyframe
103 const synfig::Keyframe& get_selected_keyframe() { return selected_kf; }
105 //! Set the time adjustment and proper connects its change signals
106 void set_time_adjustment(Gtk::Adjustment *x);
108 //! Performs the keyframe movement. Returns true if it was sucessful
109 bool perform_move_kf();
113 /* ======================= EVENTS HANDLERS ===========================*/
114 //!Redraw event. Should draw all the keyframes + the selected + the dragged
115 bool redraw(GdkEventExpose*bleh=NULL);
117 //!Mouse event handler.
118 bool on_event(GdkEvent *event);
119 }; // END of class Keyframe_List
121 }; // END of namespace studio
123 /* === E N D =============================================================== */