00001 /* === S Y N F I G ========================================================= */ 00021 /* ========================================================================= */ 00022 00023 /* === S T A R T =========================================================== */ 00024 00025 #ifndef __SYNFIG_WIDGET_TIMESLIDER_H 00026 #define __SYNFIG_WIDGET_TIMESLIDER_H 00027 00028 /* === H E A D E R S ======================================================= */ 00029 #include <gtkmm/drawingarea.h> 00030 #include <gtkmm/adjustment.h> 00031 00032 #include <synfig/time.h> 00033 #include "canvasview.h" 00034 00035 /* === M A C R O S ========================================================= */ 00036 00037 /* === T Y P E D E F S ===================================================== */ 00038 00039 /* === C L A S S E S & S T R U C T S ======================================= */ 00040 00041 namespace studio { 00042 00043 void render_time_point_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const synfig::TimePoint &tp,bool selected=false); 00044 00045 00046 /* Design for the timeslider... 00047 00048 Concept: Scalable ruler 00049 Ticks are done every so often (30 s, 10 frames, 5 frames, etc.) 00050 Print out frame numbers next to the big ticks 00051 Show blue pills in separate area (above or below) 00052 */ 00053 00054 class Widget_Timeslider : public Gtk::DrawingArea 00055 { 00056 protected: //implementation that other interfaces can see 00057 Glib::RefPtr<Pango::Layout> layout; //implementation awesomeness for text drawing 00058 00059 Gtk::Adjustment adj_default; 00060 Gtk::Adjustment *adj_timescale; 00061 00062 //HACK - I should not have to see this... 00063 Gtk::Adjustment *adj_bounds; 00064 double time_per_tickmark; 00065 00066 //Statistics used for drawing stuff (and making sure we don't if we don't need to) 00067 /*double start,end; 00068 double current; 00069 00070 bool invalidated;*/ 00071 00072 guint32 last_event_time; 00073 00074 float fps; 00075 00076 sigc::connection time_value_change; 00077 sigc::connection time_other_change; 00078 00079 //TODO: fill out blue pill stuff 00080 00081 //input functions 00082 00083 virtual bool on_motion_notify_event(GdkEventMotion* event); //for dragging 00084 virtual bool on_scroll_event(GdkEventScroll* event); //for zooming 00085 virtual bool on_button_press_event(GdkEventButton *event); //for clicking 00086 virtual bool on_button_release_event(GdkEventButton *event); //for clicking 00087 00088 virtual bool on_expose_event(GdkEventExpose */*event*/) {redraw(); return true;}//for drawing 00089 00090 virtual bool redraw(bool doublebuffer = false); 00091 00092 //void update_times(); 00093 00094 void zoom_in(bool centerontime = false); 00095 void zoom_out(bool centerontime = false); 00096 00097 //Drag the Frame 00098 bool dragscroll; 00099 00100 /*NOTE: if we can set the mouse position to the original position 00101 this would only have to be set once (and it would be good otherwise too) 00102 */ 00103 double lastx; //last mouse position for dragging 00104 00105 public: //structors 00106 Widget_Timeslider(); 00107 ~Widget_Timeslider(); 00108 00109 public: //Normal Interface 00110 00111 void draw() {redraw();} 00112 virtual void refresh(); //reget bluepills, time values and queue_draw if need be 00113 00114 public: //Time Interface 00115 00116 //Run FPS stuff through it to the MAX 00117 double get_global_fps() const {return fps;} 00118 void set_global_fps(float d); 00119 00120 //accessors for the time adjustment 00121 Gtk::Adjustment &get_time_adjustment() const {return *adj_timescale;} 00122 void set_time_adjustment(Gtk::Adjustment *x); 00123 00124 //HACK - I should not have to see these bounds (should be boundless) 00125 Gtk::Adjustment &get_bounds_adjustment() const {return *adj_bounds;} 00126 void set_bounds_adjustment(Gtk::Adjustment *x) {adj_bounds = x;} 00127 }; 00128 00129 }; // END of namespace studio 00130 00131 /* === E N D =============================================================== */ 00132 00133 #endif