Ardour  9.0-pre0-582-g084a23a80d
ArdourCanvas::Meter Class Reference

#include <meter.h>

Inheritance diagram for ArdourCanvas::Meter:
[legend]

Classes

struct  Pattern10MapKey
 
struct  PatternBgMapKey
 

Public Types

enum  Orientation { Horizontal , Vertical }
 
- Public Types inherited from ArdourCanvas::Fill
typedef std::vector< std::pair< double, Gtkmm2ext::Color > > StopList
 

Public Member Functions

 Meter (Item *parent, long hold_cnt, unsigned long width, Orientation, int len=0, int clr0=0x008800ff, int clr1=0x008800ff, int clr2=0x00ff00ff, int clr3=0x00ff00ff, int clr4=0xffaa00ff, int clr5=0xffaa00ff, int clr6=0xffff00ff, int clr7=0xffff00ff, int clr8=0xff0000ff, int clr9=0xff0000ff, int bgc0=0x333333ff, int bgc1=0x444444ff, int bgh0=0x991122ff, int bgh1=0x551111ff, float stp0=55.0, float stp1=77.5, float stp2=92.5, float stp3=100.0, int styleflags=3)
 
 Meter (ArdourCanvas::Canvas *canvas, long hold_cnt, unsigned long width, Orientation, int len=0, int clr0=0x008800ff, int clr1=0x008800ff, int clr2=0x00ff00ff, int clr3=0x00ff00ff, int clr4=0xffaa00ff, int clr5=0xffaa00ff, int clr6=0xffff00ff, int clr7=0xffff00ff, int clr8=0xff0000ff, int clr9=0xff0000ff, int bgc0=0x333333ff, int bgc1=0x444444ff, int bgh0=0x991122ff, int bgh1=0x551111ff, float stp0=55.0, float stp1=77.5, float stp2=92.5, float stp3=100.0, int styleflags=3)
 
virtual ~Meter ()
 
void set (float level, float peak=-1)
 
void clear ()
 
float get_level ()
 
float get_user_level ()
 
float get_peak ()
 
long hold_count ()
 
void set_hold_count (long)
 
void set_highlight (bool)
 
bool get_highlight ()
 
void render (ArdourCanvas::Rect const &, Cairo::RefPtr< Cairo::Context >) const
 
void compute_bounding_box () const
 
- Public Member Functions inherited from ArdourCanvas::Item
 Item (Canvas *)
 
 Item (Item *)
 
 Item (Item *, Duple const &p)
 
virtual ~Item ()
 
void redraw () const
 
virtual void prepare_for_render (Rect const &area) const
 
virtual void add_items_at_point (Duple point, std::vector< Item const * > &items) const
 
virtual bool covers (Duple const &point) const
 
void grab ()
 
void ungrab ()
 
void unparent ()
 
void reparent (Item *, bool already_added=false)
 
Itemparent () const
 
uint32_t depth () const
 
const Itemclosest_ancestor_with (const Item &other) const
 
bool common_ancestor_within (uint32_t, const Item &other) const
 
bool is_ancestor_of (const Item &candidate) const
 
bool is_descendant_of (const Item &candidate) const
 
void set_position (Duple)
 
void set_x_position (Coord)
 
void set_y_position (Coord)
 
void move (Duple)
 
Duple position () const
 
Duple window_origin () const
 
Duple canvas_origin () const
 
ScrollGroupscroll_parent () const
 
virtual void size_request (double &w, double &h) const
 
void set_size_request (double w, double h)
 
void set_size_request_to_display_given_text (const std::vector< std::string > &strings, gint hpadding, gint vpadding)
 
void size_allocate (Rect const &)
 
virtual void _size_allocate (Rect const &)
 
virtual void size_allocate_children (Rect const &r)
 
Rect allocation () const
 
void set_layout_sensitive (bool)
 
bool layout_sensitive () const
 
Rect bounding_box () const
 
Coord height () const
 
Coord width () const
 
Duple item_to_parent (Duple const &) const
 
Rect item_to_parent (Rect const &) const
 
Duple parent_to_item (Duple const &) const
 
Rect parent_to_item (Rect const &) const
 
void canvas_to_item (Coord &, Coord &) const
 
void item_to_canvas (Coord &, Coord &) const
 
Duple canvas_to_item (Duple const &) const
 
Rect item_to_canvas (Rect const &) const
 
Duple item_to_canvas (Duple const &) const
 
Rect canvas_to_item (Rect const &) const
 
Duple item_to_window (Duple const &, bool rounded=true) const
 
Duple window_to_item (Duple const &) const
 
Rect item_to_window (Rect const &, bool rounded=true) const
 
Rect window_to_item (Rect const &) const
 
void raise_to_top ()
 
void raise (int)
 
void lower_to_bottom ()
 
virtual void hide ()
 
virtual void show ()
 
void block_change_notifications ()
 
void unblock_change_notifications ()
 
bool self_visible () const
 
bool visible () const
 
Canvascanvas () const
 
void set_ignore_events (bool)
 
bool ignore_events () const
 
void set_data (std::string const &, void *)
 
void * get_data (std::string const &) const
 
virtual void add (Item *)
 
virtual void add_front (Item *)
 
virtual void remove (Item *)
 
void clear (bool with_delete=false)
 
std::list< Item * > const & items () const
 
void raise_child_to_top (Item *)
 
void raise_child (Item *, int)
 
void lower_child_to_bottom (Item *)
 
virtual void child_changed (bool bbox_changed)
 
PackOptions pack_options () const
 
void set_pack_options (PackOptions)
 
std::string whoami () const
 
const std::string & tooltip () const
 
void set_tooltip (const std::string &)
 
void start_tooltip_timeout ()
 
void stop_tooltip_timeout ()
 
virtual void dump (std::ostream &) const
 
std::string whatami () const
 
bool resize_queued () const
 
void queue_resize ()
 
bool scroll_translation () const
 
void disable_scroll_translation ()
 
virtual void layout ()
 
Duple position_offset () const
 
- Public Member Functions inherited from ArdourCanvas::Fill
 Fill (Item &self)
 
 Fill (const Fill &)=delete
 
Filloperator= (const Fill &)=delete
 
virtual ~Fill ()
 
virtual void set_fill_color (Gtkmm2ext::Color)
 
virtual void set_fill (bool)
 
Gtkmm2ext::Color fill_color () const
 
bool fill () const
 
void set_gradient (StopList const &stops, bool is_vertical)
 
void set_pattern (Cairo::RefPtr< Cairo::Pattern >)
 
- Public Member Functions inherited from ArdourCanvas::Outline
 Outline (Item &self)
 
 Outline (const Outline &)=delete
 
Outlineoperator= (const Outline &)=delete
 
virtual ~Outline ()
 
Gtkmm2ext::Color outline_color () const
 
virtual void set_outline_color (Gtkmm2ext::Color)
 
Distance outline_width () const
 
virtual void set_outline_width (Distance)
 
bool outline () const
 
virtual void set_outline (bool)
 

Static Public Member Functions

static void flush_pattern_cache ()
 

Private Types

typedef std::map< Pattern10MapKey, Cairo::RefPtr< Cairo::Pattern > > Pattern10Map
 
typedef std::map< PatternBgMapKey, Cairo::RefPtr< Cairo::Pattern > > PatternBgMap
 

Private Member Functions

void init (int clr0, int clr1, int clr2, int clr3, int clr4, int clr5, int clr6, int clr7, int clr8, int clr9, int bgc0, int bgc1, int bgh0, int bgh1, float stp0, float stp1, float stp2, float stp3, int dimen, int len)
 
void vertical_expose (ArdourCanvas::Rect const &area, Cairo::RefPtr< Cairo::Context > context) const
 
void queue_vertical_redraw (float old_level)
 
void horizontal_expose (ArdourCanvas::Rect const &area, Cairo::RefPtr< Cairo::Context > context) const
 
void queue_horizontal_redraw (float old_level)
 

Static Private Member Functions

static Cairo::RefPtr< Cairo::Pattern > generate_meter_pattern (int, int, int *, float *, int, bool)
 
static Cairo::RefPtr< Cairo::Pattern > vertical_meter_pattern (int, int, int *, float *, int)
 
static Cairo::RefPtr< Cairo::Pattern > horizontal_meter_pattern (int, int, int *, float *, int)
 
static Cairo::RefPtr< Cairo::Pattern > generate_meter_background (int, int, int *, bool, bool)
 
static Cairo::RefPtr< Cairo::Pattern > vertical_background (int, int, int *, bool)
 
static Cairo::RefPtr< Cairo::Pattern > horizontal_background (int, int, int *, bool)
 

Private Attributes

Cairo::RefPtr< Cairo::Pattern > fgpattern
 
Cairo::RefPtr< Cairo::Pattern > bgpattern
 
gint pixheight
 
gint pixwidth
 
float _stp [4]
 
int _clr [10]
 
int _bgc [2]
 
int _bgh [2]
 
int _styleflags
 
Orientation orientation
 
Cairo::RectangleInt pixrect
 
Cairo::RectangleInt last_peak_rect
 
unsigned long hold_cnt
 
unsigned long hold_state
 
bool bright_hold
 
float current_level
 
float current_peak
 
float current_user_level
 
bool highlight
 

Static Private Attributes

static bool no_rgba_overlay
 
static Pattern10Map vm_pattern_cache
 
static PatternBgMap vb_pattern_cache
 
static Pattern10Map hm_pattern_cache
 
static PatternBgMap hb_pattern_cache
 
static int min_pattern_metric_size
 
static int max_pattern_metric_size
 

Additional Inherited Members

- Public Attributes inherited from ArdourCanvas::Item
sigc::signal1< bool, GdkEvent *, EventAccumulator< bool > > Event
 
bool _resize_queued
 
double _requested_width
 
double _requested_height
 
- Static Public Attributes inherited from ArdourCanvas::Item
static int default_items_per_cell
 
- Protected Member Functions inherited from ArdourCanvas::Item
void begin_change ()
 
void end_change ()
 
void begin_visual_change ()
 
void end_visual_change ()
 
void set_bbox_clean () const
 
void set_bbox_dirty () const
 
bool bbox_dirty () const
 
void invalidate_lut () const
 
void clear_items (bool with_delete)
 
void ensure_lut () const
 
void add_child_bounding_boxes (bool include_hidden=false) const
 
void render_children (Rect const &area, Cairo::RefPtr< Cairo::Context > context) const
 
void prepare_for_render_children (Rect const &area) const
 
Duple scroll_offset () const
 
- Protected Member Functions inherited from ArdourCanvas::Fill
void setup_fill_context (Cairo::RefPtr< Cairo::Context >) const
 
void setup_gradient_context (Cairo::RefPtr< Cairo::Context >, Rect const &, Duple const &) const
 
- Protected Member Functions inherited from ArdourCanvas::Outline
void setup_outline_context (Cairo::RefPtr< Cairo::Context >) const
 
- Protected Attributes inherited from ArdourCanvas::Item
Canvas_canvas
 
Item_parent
 
ScrollGroup_scroll_parent
 
Duple _position
 
bool _visible
 
Rect _pre_change_bounding_box
 
Rect _bounding_box
 
PackOptions _pack_options
 
Rect _allocation
 
bool _layout_sensitive
 
std::map< std::string, void * > _data
 
LookupTable_lut
 
std::list< Item * > _items
 
- Protected Attributes inherited from ArdourCanvas::Fill
Item_self
 
Gtkmm2ext::Color _fill_color
 
bool _fill
 
bool _transparent
 
StopList _stops
 
bool _vertical_gradient
 
Cairo::RefPtr< Cairo::Pattern > _pattern
 
- Protected Attributes inherited from ArdourCanvas::Outline
Item_self
 
Gtkmm2ext::Color _outline_color
 
Distance _outline_width
 
bool _outline
 

Detailed Description

Definition at line 34 of file canvas/canvas/meter.h.

Member Typedef Documentation

◆ Pattern10Map

typedef std::map<Pattern10MapKey, Cairo::RefPtr<Cairo::Pattern> > ArdourCanvas::Meter::Pattern10Map
private

Definition at line 163 of file canvas/canvas/meter.h.

◆ PatternBgMap

typedef std::map<PatternBgMapKey, Cairo::RefPtr<Cairo::Pattern> > ArdourCanvas::Meter::PatternBgMap
private

Definition at line 178 of file canvas/canvas/meter.h.

Member Enumeration Documentation

◆ Orientation

Enumerator
Horizontal 
Vertical 

Definition at line 36 of file canvas/canvas/meter.h.

Constructor & Destructor Documentation

◆ Meter() [1/2]

ArdourCanvas::Meter::Meter ( Item parent,
long  hold_cnt,
unsigned long  width,
Orientation  ,
int  len = 0,
int  clr0 = 0x008800ff,
int  clr1 = 0x008800ff,
int  clr2 = 0x00ff00ff,
int  clr3 = 0x00ff00ff,
int  clr4 = 0xffaa00ff,
int  clr5 = 0xffaa00ff,
int  clr6 = 0xffff00ff,
int  clr7 = 0xffff00ff,
int  clr8 = 0xff0000ff,
int  clr9 = 0xff0000ff,
int  bgc0 = 0x333333ff,
int  bgc1 = 0x444444ff,
int  bgh0 = 0x991122ff,
int  bgh1 = 0x551111ff,
float  stp0 = 55.0,
float  stp1 = 77.5,
float  stp2 = 92.5,
float  stp3 = 100.0,
int  styleflags = 3 
)

◆ Meter() [2/2]

ArdourCanvas::Meter::Meter ( ArdourCanvas::Canvas canvas,
long  hold_cnt,
unsigned long  width,
Orientation  ,
int  len = 0,
int  clr0 = 0x008800ff,
int  clr1 = 0x008800ff,
int  clr2 = 0x00ff00ff,
int  clr3 = 0x00ff00ff,
int  clr4 = 0xffaa00ff,
int  clr5 = 0xffaa00ff,
int  clr6 = 0xffff00ff,
int  clr7 = 0xffff00ff,
int  clr8 = 0xff0000ff,
int  clr9 = 0xff0000ff,
int  bgc0 = 0x333333ff,
int  bgc1 = 0x444444ff,
int  bgh0 = 0x991122ff,
int  bgh1 = 0x551111ff,
float  stp0 = 55.0,
float  stp1 = 77.5,
float  stp2 = 92.5,
float  stp3 = 100.0,
int  styleflags = 3 
)

◆ ~Meter()

virtual ArdourCanvas::Meter::~Meter ( )
virtual

Member Function Documentation

◆ clear()

void ArdourCanvas::Meter::clear ( )

◆ compute_bounding_box()

void ArdourCanvas::Meter::compute_bounding_box ( ) const
virtual

Update _bounding_box and _bounding_box_dirty

Implements ArdourCanvas::Item.

◆ flush_pattern_cache()

static void ArdourCanvas::Meter::flush_pattern_cache ( )
static

◆ generate_meter_background()

static Cairo::RefPtr<Cairo::Pattern> ArdourCanvas::Meter::generate_meter_background ( int  ,
int  ,
int *  ,
bool  ,
bool   
)
staticprivate

◆ generate_meter_pattern()

static Cairo::RefPtr<Cairo::Pattern> ArdourCanvas::Meter::generate_meter_pattern ( int  ,
int  ,
int *  ,
float *  ,
int  ,
bool   
)
staticprivate

◆ get_highlight()

bool ArdourCanvas::Meter::get_highlight ( )
inline

Definition at line 85 of file canvas/canvas/meter.h.

◆ get_level()

float ArdourCanvas::Meter::get_level ( )
inline

Definition at line 78 of file canvas/canvas/meter.h.

◆ get_peak()

float ArdourCanvas::Meter::get_peak ( )
inline

Definition at line 80 of file canvas/canvas/meter.h.

◆ get_user_level()

float ArdourCanvas::Meter::get_user_level ( )
inline

Definition at line 79 of file canvas/canvas/meter.h.

◆ hold_count()

long ArdourCanvas::Meter::hold_count ( )
inline

Definition at line 82 of file canvas/canvas/meter.h.

◆ horizontal_background()

static Cairo::RefPtr<Cairo::Pattern> ArdourCanvas::Meter::horizontal_background ( int  ,
int  ,
int *  ,
bool   
)
staticprivate

◆ horizontal_expose()

void ArdourCanvas::Meter::horizontal_expose ( ArdourCanvas::Rect const &  area,
Cairo::RefPtr< Cairo::Context >  context 
) const
private

◆ horizontal_meter_pattern()

static Cairo::RefPtr<Cairo::Pattern> ArdourCanvas::Meter::horizontal_meter_pattern ( int  ,
int  ,
int *  ,
float *  ,
int   
)
staticprivate

◆ init()

void ArdourCanvas::Meter::init ( int  clr0,
int  clr1,
int  clr2,
int  clr3,
int  clr4,
int  clr5,
int  clr6,
int  clr7,
int  clr8,
int  clr9,
int  bgc0,
int  bgc1,
int  bgh0,
int  bgh1,
float  stp0,
float  stp1,
float  stp2,
float  stp3,
int  dimen,
int  len 
)
private

◆ queue_horizontal_redraw()

void ArdourCanvas::Meter::queue_horizontal_redraw ( float  old_level)
private

◆ queue_vertical_redraw()

void ArdourCanvas::Meter::queue_vertical_redraw ( float  old_level)
private

◆ render()

void ArdourCanvas::Meter::render ( ArdourCanvas::Rect const &  area,
Cairo::RefPtr< Cairo::Context >   
) const
virtual

Render this item to a Cairo context.

Parameters
areaArea to draw, in window coordinates

Items must convert their own coordinates into window coordinates because Cairo is limited to a fixed point coordinate space that does not extend as far as the Ardour timeline. All rendering must be done using coordinates that do not exceed the (rough) limits of the canvas' window, to avoid odd errors within Cairo as it converts doubles into its fixed point format and then tesselates the results.

Implements ArdourCanvas::Item.

◆ set()

void ArdourCanvas::Meter::set ( float  level,
float  peak = -1 
)

◆ set_highlight()

void ArdourCanvas::Meter::set_highlight ( bool  )

◆ set_hold_count()

void ArdourCanvas::Meter::set_hold_count ( long  )

◆ vertical_background()

static Cairo::RefPtr<Cairo::Pattern> ArdourCanvas::Meter::vertical_background ( int  ,
int  ,
int *  ,
bool   
)
staticprivate

◆ vertical_expose()

void ArdourCanvas::Meter::vertical_expose ( ArdourCanvas::Rect const &  area,
Cairo::RefPtr< Cairo::Context >  context 
) const
private

◆ vertical_meter_pattern()

static Cairo::RefPtr<Cairo::Pattern> ArdourCanvas::Meter::vertical_meter_pattern ( int  ,
int  ,
int *  ,
float *  ,
int   
)
staticprivate

Member Data Documentation

◆ _bgc

int ArdourCanvas::Meter::_bgc[2]
private

Definition at line 99 of file canvas/canvas/meter.h.

◆ _bgh

int ArdourCanvas::Meter::_bgh[2]
private

Definition at line 100 of file canvas/canvas/meter.h.

◆ _clr

int ArdourCanvas::Meter::_clr[10]
private

Definition at line 98 of file canvas/canvas/meter.h.

◆ _stp

float ArdourCanvas::Meter::_stp[4]
private

Definition at line 97 of file canvas/canvas/meter.h.

◆ _styleflags

int ArdourCanvas::Meter::_styleflags
private

Definition at line 101 of file canvas/canvas/meter.h.

◆ bgpattern

Cairo::RefPtr<Cairo::Pattern> ArdourCanvas::Meter::bgpattern
private

Definition at line 93 of file canvas/canvas/meter.h.

◆ bright_hold

bool ArdourCanvas::Meter::bright_hold
private

Definition at line 108 of file canvas/canvas/meter.h.

◆ current_level

float ArdourCanvas::Meter::current_level
private

Definition at line 109 of file canvas/canvas/meter.h.

◆ current_peak

float ArdourCanvas::Meter::current_peak
private

Definition at line 110 of file canvas/canvas/meter.h.

◆ current_user_level

float ArdourCanvas::Meter::current_user_level
private

Definition at line 111 of file canvas/canvas/meter.h.

◆ fgpattern

Cairo::RefPtr<Cairo::Pattern> ArdourCanvas::Meter::fgpattern
private

Definition at line 92 of file canvas/canvas/meter.h.

◆ hb_pattern_cache

PatternBgMap ArdourCanvas::Meter::hb_pattern_cache
staticprivate

Definition at line 183 of file canvas/canvas/meter.h.

◆ highlight

bool ArdourCanvas::Meter::highlight
private

Definition at line 112 of file canvas/canvas/meter.h.

◆ hm_pattern_cache

Pattern10Map ArdourCanvas::Meter::hm_pattern_cache
staticprivate

Definition at line 182 of file canvas/canvas/meter.h.

◆ hold_cnt

unsigned long ArdourCanvas::Meter::hold_cnt
private

Definition at line 106 of file canvas/canvas/meter.h.

◆ hold_state

unsigned long ArdourCanvas::Meter::hold_state
private

Definition at line 107 of file canvas/canvas/meter.h.

◆ last_peak_rect

Cairo::RectangleInt ArdourCanvas::Meter::last_peak_rect
mutableprivate

Definition at line 105 of file canvas/canvas/meter.h.

◆ max_pattern_metric_size

int ArdourCanvas::Meter::max_pattern_metric_size
staticprivate

Definition at line 185 of file canvas/canvas/meter.h.

◆ min_pattern_metric_size

int ArdourCanvas::Meter::min_pattern_metric_size
staticprivate

Definition at line 184 of file canvas/canvas/meter.h.

◆ no_rgba_overlay

bool ArdourCanvas::Meter::no_rgba_overlay
staticprivate

Definition at line 129 of file canvas/canvas/meter.h.

◆ orientation

Orientation ArdourCanvas::Meter::orientation
private

Definition at line 103 of file canvas/canvas/meter.h.

◆ pixheight

gint ArdourCanvas::Meter::pixheight
private

Definition at line 94 of file canvas/canvas/meter.h.

◆ pixrect

Cairo::RectangleInt ArdourCanvas::Meter::pixrect
mutableprivate

Definition at line 104 of file canvas/canvas/meter.h.

◆ pixwidth

gint ArdourCanvas::Meter::pixwidth
private

Definition at line 95 of file canvas/canvas/meter.h.

◆ vb_pattern_cache

PatternBgMap ArdourCanvas::Meter::vb_pattern_cache
staticprivate

Definition at line 181 of file canvas/canvas/meter.h.

◆ vm_pattern_cache

Pattern10Map ArdourCanvas::Meter::vm_pattern_cache
staticprivate

Definition at line 180 of file canvas/canvas/meter.h.


The documentation for this class was generated from the following file: