1 /* === S I N F G =========================================================== */
2 /*! \file widget_timeslider.h
3 ** \brief Time Slider Widget Header
5 ** $Id: widget_timeslider.h,v 1.1.1.1 2005/01/07 03:34:37 darco Exp $
8 ** Copyright (c) 2004 Adrian Bentley
10 ** This software and associated documentation
11 ** are CONFIDENTIAL and PROPRIETARY property of
12 ** the above-mentioned copyright holder.
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.
20 /* ========================================================================= */
22 /* === S T A R T =========================================================== */
24 #ifndef __SINFG_WIDGET_TIMESLIDER_H
25 #define __SINFG_WIDGET_TIMESLIDER_H
27 /* === H E A D E R S ======================================================= */
28 #include <gtkmm/drawingarea.h>
29 #include <gtkmm/adjustment.h>
31 #include <sinfg/time.h>
32 #include "canvasview.h"
34 /* === M A C R O S ========================================================= */
36 /* === T Y P E D E F S ===================================================== */
38 /* === C L A S S E S & S T R U C T S ======================================= */
42 void render_time_point_to_window(const Glib::RefPtr<Gdk::Drawable>& window,const Gdk::Rectangle& ca,const sinfg::TimePoint &tp,bool selected=false);
45 /* Design for the timeslider...
47 Concept: Scalable ruler
48 Ticks are done every so often (30 s, 10 frames, 5 frames, etc.)
49 Print out frame numbers next to the big ticks
50 Show blue pills in separate area (above or below)
53 class Widget_Timeslider : public Gtk::DrawingArea
55 protected: //implementation that other interfaces can see
56 Glib::RefPtr<Pango::Layout> layout; //implementation awesomeness for text drawing
58 Gtk::Adjustment adj_default;
59 Gtk::Adjustment *adj_timescale;
61 //HACK - I should not have to see this...
62 Gtk::Adjustment *adj_bounds;
64 //Statistics used for drawing stuff (and making sure we don't if we don't need to)
70 guint32 last_event_time;
74 sigc::connection time_value_change;
75 sigc::connection time_other_change;
77 //TODO: fill out blue pill stuff
81 virtual bool on_motion_notify_event(GdkEventMotion* event); //for dragging
82 virtual bool on_scroll_event(GdkEventScroll* event); //for zooming
83 virtual bool on_button_press_event(GdkEventButton *event); //for clicking
84 virtual bool on_button_release_event(GdkEventButton *event); //for clicking
86 virtual bool on_expose_event(GdkEventExpose *event) {redraw(); return true;}//for drawing
88 virtual bool redraw(bool doublebuffer = false);
90 //void update_times();
92 void zoom_in(bool centerontime = false);
93 void zoom_out(bool centerontime = false);
98 /*NOTE: if we can set the mouse position to the original position
99 this would only have to be set once (and it would be good otherwise too)
101 double lastx; //last mouse position for dragging
105 ~Widget_Timeslider();
107 public: //Normal Interface
109 void draw() {redraw();}
110 virtual void refresh(); //reget bluepills, time values and queue_draw if need be
112 public: //Time Interface
114 //Run FPS stuff through it to the MAX
115 double get_global_fps() const {return fps;}
116 void set_global_fps(float d);
118 //accessors for the time adjustment
119 Gtk::Adjustment &get_time_adjustment() const {return *adj_timescale;}
120 void set_time_adjustment(Gtk::Adjustment *x);
122 //HACK - I should not have to see these bounds (should be boundless)
123 Gtk::Adjustment &get_bounds_adjustment() const {return *adj_bounds;}
124 void set_bounds_adjustment(Gtk::Adjustment *x) {adj_bounds = x;}
127 }; // END of namespace studio
129 /* === E N D =============================================================== */