/* === H E A D E R S ======================================================= */
#include <gtkmm/drawingarea.h>
+#include <gtkmm/adjustment.h>
+#include <gtkmm/tooltips.h>
#include <synfig/keyframe.h>
+#include <sigc++/connection.h>
+#include <synfigapp/canvasinterface.h>
+
/* === M A C R O S ========================================================= */
class Widget_Keyframe_List : public Gtk::DrawingArea
{
- sigc::signal<void> signal_value_changed_;
- sigc::signal<void> signal_clicked_;
+ //! Tooltips class. It is deprecated since gtkmm 2.12
+ //! replace with Tooltip class or use the own tooltip widget's members
+ Gtk::Tooltips tooltips;
+
+ //! The canvas interface being watched
+ etl::loose_handle<synfigapp::CanvasInterface> canvas_interface_;
+
+ //! Time adjustment window
+ Gtk::Adjustment adj_default;
+ Gtk::Adjustment *adj_timescale;
- sigc::signal<void,synfig::Keyframe> signal_keyframe_selected_;
+ //!The list of keyframes to be drawn on the widget and moved with mouse
+ synfig::KeyframeList default_kf_list_;
+ mutable synfig::KeyframeList* kf_list_;
- synfig::KeyframeList kf_list_;
+ //! The frames per second of the canvas
+ float fps;
+ //! Time radius to click a keyframe
+ synfig::Time time_ratio;
+
+ //!True if it is editable. Keyframes can be moved.
bool editable_;
+ //!True if a keyframe is being dragged.
+ bool dragging_;
+
+ //!True if a keyframe has been moved
bool changed_;
+ //!Holds the selected keyframe of the keyframe list
synfig::Keyframe selected_kf;
+ synfig::Keyframe selected_none;
+ bool selected_;
- void popup_menu(float x);
+ //!The time of the selected keyframe
+ synfig::Time selected_kf_time;
- //void insert_cpoint(float x);
+ //!The time of the selected keyframe during draging
+ synfig::Time dragging_kf_time;
- //void remove_cpoint(float x);
+ //!Connectors for handling the signals of the time adjustment
+ sigc::connection time_value_change;
+ sigc::connection time_other_change;
public:
+ //!Default constructor
Widget_Keyframe_List();
+ //!Destructror
~Widget_Keyframe_List();
- sigc::signal<void>& signal_value_changed() { return signal_value_changed_; }
- sigc::signal<void>& signal_clicked() { return signal_clicked_; }
-
- sigc::signal<void,synfig::Keyframe>& signal_keyframe_selected() { return signal_keyframe_selected_; }
+ //!Loads a new keyframe list on the widget.
+ void set_kf_list(synfig::KeyframeList* x);
- void set_value(const synfig::KeyframeList& x);
-
- const synfig::KayframeList& get_value()const { return kf_list_; }
+ //!Member for private data.
+ synfig::KeyframeList* get_kf_list()const { return kf_list_; }
+ //!Member for private data
void set_editable(bool x=true) { editable_=x; }
+ //!Member for private data
bool get_editable()const { return editable_; }
-
+ //!Store the selected keyframe value
void set_selected_keyframe(const synfig::Keyframe &x);
- const synfig::Kayframe& get_selected_keyframe() { return selected_kf; }
+ //!Returns the selected keyframe
+ const synfig::Keyframe& get_selected_keyframe() { return selected_kf; }
+
+ //! Set the time adjustment and proper connects its change signals
+ void set_time_adjustment(Gtk::Adjustment *x);
- void update_keyframe(const synfig::Keyframe &x);
+ //! Set the fps
+ void set_fps(float x);
+ //! Set the canvas interface
+ void set_canvas_interface(etl::loose_handle<synfigapp::CanvasInterface> h);
+ //! Performs the keyframe movement. Returns true if it was sucessful
+ //! @return true: if success otherwise false
+ //! |delta=false: permorm normal move. true: perform delta movement
+ bool perform_move_kf(bool delta);
+
+
+/* ======================= EVENTS HANDLERS ===========================*/
+ //!Redraw event. Should draw all the keyframes + the selected + the dragged
bool redraw(GdkEventExpose*bleh=NULL);
+ //!Mouse event handler.
bool on_event(GdkEvent *event);
}; // END of class Keyframe_List
}; // END of namespace studio
+
/* === E N D =============================================================== */
#endif