major design changes: use glib event loop for MIDI thread/UI; rework design of BaseUI...
[ardour.git] / libs / gtkmm2ext / gtkmm2ext / fastmeter.h
index c59e85b674464180db83a0f911c896797264a0d7..2bf4539d877393bb39562af028580c4ac308859a 100644 (file)
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
 #ifndef __gtkmm2ext_fastmeter_h__
@@ -33,10 +32,10 @@ class FastMeter : public Gtk::DrawingArea {
                Vertical
        };
        
-       FastMeter (long hold_cnt, unsigned long width, Orientation);
+       FastMeter (long hold_cnt, unsigned long width, Orientation, int len=0, int clrb0=0x00ff00, int clr1=0xffff00, int clr2=0xffaa00, int clr3=0xff0000);
        virtual ~FastMeter ();
        
-       void set (float level, float user_level=0.0f);
+       void set (float level);
        void clear ();
 
        float get_level() { return current_level; }
@@ -46,26 +45,21 @@ class FastMeter : public Gtk::DrawingArea {
        long hold_count() { return hold_cnt; }
        void set_hold_count (long);
        
-       static void set_horizontal_xpm (std::string);
-       static void set_vertical_xpm (std::string);
-       
   protected:
        bool on_expose_event (GdkEventExpose*);
        void on_size_request (GtkRequisition*);
+       void on_size_allocate (Gtk::Allocation&);
 
   private:  
-       static std::string h_image_path;
-       static std::string v_image_path;
-       static Glib::RefPtr<Gdk::Pixbuf> h_pixbuf;
-       static gint h_pixheight;
-       static gint h_pixwidth;
 
-       static Glib::RefPtr<Gdk::Pixbuf> v_pixbuf;
-       static gint v_pixheight;
-       static gint v_pixwidth;
+       Glib::RefPtr<Gdk::Pixbuf> pixbuf;
+       gint pixheight;
+       gint pixwidth;
+       static int _clr0, _clr1, _clr2, _clr3;
 
        Orientation orientation;
        GdkRectangle pixrect;
+       GdkRectangle last_peak_rect;
        gint request_width;
        gint request_height;
        unsigned long hold_cnt;
@@ -76,6 +70,20 @@ class FastMeter : public Gtk::DrawingArea {
        
        bool vertical_expose (GdkEventExpose*);
        bool horizontal_expose (GdkEventExpose*);
+       void queue_vertical_redraw (const Glib::RefPtr<Gdk::Window>&, float);
+       void queue_horizontal_redraw (const Glib::RefPtr<Gdk::Window>&, float);
+
+       static Glib::RefPtr<Gdk::Pixbuf> request_vertical_meter(int w, int h);
+
+       static Glib::RefPtr<Gdk::Pixbuf> *v_pixbuf_cache;
+       static int min_v_pixbuf_size;
+       static int max_v_pixbuf_size;
+
+       static Glib::RefPtr<Gdk::Pixbuf> request_horizontal_meter(int w, int h);
+
+       static Glib::RefPtr<Gdk::Pixbuf> *h_pixbuf_cache;
+       static int min_h_pixbuf_size;
+       static int max_h_pixbuf_size;
 };