ardour
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
AudioClock Class Reference

#include <audio_clock.h>

Inheritance diagram for AudioClock:
CairoWidget ARDOUR::SessionHandlePtr MainClock

Public Types

enum  Mode { Timecode, BBT, MinSec, Frames }
 

Public Member Functions

 AudioClock (const std::string &clock_name, bool is_transient, const std::string &widget_name, bool editable, bool follows_playhead, bool duration=false, bool with_info=false)
 
 ~AudioClock ()
 
Mode mode () const
 
void set_off (bool yn)
 
bool off () const
 
void set_widget_name (const std::string &name)
 
void set_active_state (Gtkmm2ext::ActiveState s)
 
void set_editable (bool yn)
 
void set_corner_radius (double)
 
void focus ()
 
void set (framepos_t, bool force=false, ARDOUR::framecnt_t offset=0)
 
void set_from_playhead ()
 
void locate ()
 
void set_mode (Mode)
 
void set_bbt_reference (framepos_t)
 
void set_is_duration (bool)
 
void copy_text_to_clipboard () const
 
std::string name () const
 
framepos_t current_time (framepos_t position=0) const
 
framepos_t current_duration (framepos_t position=0) const
 
void set_session (ARDOUR::Session *s)
 
void set_negative_allowed (bool yn)
 
void set_scale (double x, double y)
 
- Public Member Functions inherited from CairoWidget
 CairoWidget ()
 
virtual ~CairoWidget ()
 
void set_dirty ()
 
Gtkmm2ext::ActiveState active_state () const
 
Gtkmm2ext::VisualState visual_state () const
 
virtual void set_visual_state (Gtkmm2ext::VisualState)
 
void unset_active_state ()
 
void unset_visual_state ()
 
void set_active (bool)
 
bool get_active ()
 
void set_draw_background (bool yn)
 
- Public Member Functions inherited from ARDOUR::SessionHandlePtr
 SessionHandlePtr (ARDOUR::Session *s)
 
 SessionHandlePtr ()
 
virtual ~SessionHandlePtr ()
 

Static Public Member Functions

static void print_minsec (framepos_t, char *buf, size_t bufsize, float frame_rate)
 
- Static Public Member Functions inherited from CairoWidget
static void provide_background_for_cairo_widget (Gtk::Widget &w, const Gdk::Color &bg)
 
static void set_flat_buttons (bool yn)
 
static bool flat_buttons ()
 
static void set_widget_prelight (bool yn)
 
static bool widget_prelight ()
 
static void set_source_rgb_a (cairo_t *cr, Gdk::Color, float a=1.0)
 
static void set_focus_handler (sigc::slot< void >)
 

Public Attributes

sigc::signal< void > ValueChanged
 
sigc::signal< void > mode_changed
 
sigc::signal< void > ChangeAborted
 
- Public Attributes inherited from CairoWidget
sigc::signal< void > StateChanged
 

Static Public Attributes

static sigc::signal< void > ModeChanged
 
static std::vector< AudioClock * > clocks
 

Protected Member Functions

void render (cairo_t *, cairo_rectangle_t *)
 
bool get_is_duration () const
 
virtual void build_ops_menu ()
 
bool on_button_press_event (GdkEventButton *ev)
 
bool on_button_release_event (GdkEventButton *ev)
 
bool is_lower_layout_click (int y) const
 
bool is_right_layout_click (int x) const
 
double get_left_rect_width () const
 
- Protected Member Functions inherited from CairoWidget
virtual bool on_expose_event (GdkEventExpose *)
 
void on_size_allocate (Gtk::Allocation &)
 
void on_state_changed (Gtk::StateType)
 
void on_style_changed (const Glib::RefPtr< Gtk::Style > &)
 
bool on_button_press_event (GdkEventButton *)
 
Gdk::Color get_parent_bg ()
 
virtual void on_name_changed ()
 
- Protected Member Functions inherited from ARDOUR::SessionHandlePtr
virtual void session_going_away ()
 

Protected Attributes

Gtk::Menu * ops_menu
 
- Protected Attributes inherited from CairoWidget
Gtkmm2ext::ActiveState _active_state
 
Gtkmm2ext::VisualState _visual_state
 
bool _need_bg
 
bool _grabbed
 
- Protected Attributes inherited from ARDOUR::SessionHandlePtr
ARDOUR::Session_session
 
PBD::ScopedConnectionList _session_connections
 

Private Types

enum  Field {
  Timecode_Hours = 1, Timecode_Minutes, Timecode_Seconds, Timecode_Frames,
  MS_Hours, MS_Minutes, MS_Seconds, MS_Milliseconds,
  Bars, Beats, Ticks, AudioFrames
}
 

Private Member Functions

Field index_to_field (int index) const
 
void on_realize ()
 
bool on_key_press_event (GdkEventKey *)
 
bool on_key_release_event (GdkEventKey *)
 
bool on_scroll_event (GdkEventScroll *ev)
 
void on_style_changed (const Glib::RefPtr< Gtk::Style > &)
 
void on_size_request (Gtk::Requisition *req)
 
bool on_motion_notify_event (GdkEventMotion *ev)
 
void on_size_allocate (Gtk::Allocation &)
 
bool on_focus_out_event (GdkEventFocus *)
 
void set_slave_info ()
 
void set_timecode (framepos_t, bool)
 
void set_bbt (framepos_t, bool)
 
void set_minsec (framepos_t, bool)
 
void set_frames (framepos_t, bool)
 
void set_clock_dimensions (Gtk::Requisition &)
 
framepos_t get_frame_step (Field, framepos_t pos=0, int dir=1)
 
bool timecode_validate_edit (const std::string &)
 
bool bbt_validate_edit (const std::string &)
 
bool minsec_validate_edit (const std::string &)
 
framepos_t frames_from_timecode_string (const std::string &) const
 
framepos_t frames_from_bbt_string (framepos_t, const std::string &) const
 
framepos_t frame_duration_from_bbt_string (framepos_t, const std::string &) const
 
framepos_t frames_from_minsec_string (const std::string &) const
 
framepos_t frames_from_audioframes_string (const std::string &) const
 
void session_configuration_changed (std::string)
 
void session_property_changed (const PBD::PropertyChange &)
 
Field index_to_field () const
 
void start_edit (Field f=Field(0))
 
void end_edit (bool)
 
void end_edit_relative (bool)
 
void edit_next_field ()
 
ARDOUR::framecnt_t parse_as_distance (const std::string &)
 
ARDOUR::framecnt_t parse_as_timecode_distance (const std::string &)
 
ARDOUR::framecnt_t parse_as_minsec_distance (const std::string &)
 
ARDOUR::framecnt_t parse_as_bbt_distance (const std::string &)
 
ARDOUR::framecnt_t parse_as_frames_distance (const std::string &)
 
void set_font (Pango::FontDescription)
 
void set_colors ()
 
void show_edit_status (int length)
 
int merge_input_and_edit_string ()
 
std::string get_field (Field)
 
void drop_focus ()
 
void dpi_reset ()
 

Private Attributes

Mode _mode
 
std::string _name
 
bool is_transient
 
bool is_duration
 
bool editable
 
bool _follows_playhead
 
bool _off
 
int em_width
 
bool _edit_by_click_field
 
bool _negative_allowed
 
bool edit_is_negative
 
Glib::RefPtr< Pango::Layout > _layout
 
Glib::RefPtr< Pango::Layout > _left_layout
 
Glib::RefPtr< Pango::Layout > _right_layout
 
Pango::AttrColor * editing_attr
 
Pango::AttrColor * foreground_attr
 
Pango::AttrList normal_attributes
 
Pango::AttrList editing_attributes
 
Pango::AttrList info_attributes
 
int first_height
 
int first_width
 
bool style_resets_first
 
int layout_height
 
int layout_width
 
int info_height
 
int upper_height
 
double mode_based_info_ratio
 
double corner_radius
 
uint32_t font_size
 
std::vector< int > insert_map
 
bool editing
 
std::string edit_string
 
std::string pre_edit_string
 
std::string input_string
 
framepos_t bbt_reference_time
 
framepos_t last_when
 
bool last_pdelta
 
bool last_sdelta
 
bool dragging
 
double drag_start_y
 
double drag_y
 
double drag_accum
 
Field drag_field
 
double bg_r
 
double bg_g
 
double bg_b
 
double bg_a
 
double cursor_r
 
double cursor_g
 
double cursor_b
 
double cursor_a
 
double xscale
 
double yscale
 

Static Private Attributes

static const double info_font_scale_factor = 0.60
 
static const double separator_height = 0.0
 
static const double x_leading_padding = 6.0
 

Additional Inherited Members

- Static Protected Attributes inherited from CairoWidget
static bool _flat_buttons = false
 
static bool _widget_prelight = true
 
static sigc::slot< void > focus_handler
 

Detailed Description

Definition at line 42 of file audio_clock.h.

Member Enumeration Documentation

enum AudioClock::Field
private
Enumerator
Timecode_Hours 
Timecode_Minutes 
Timecode_Seconds 
Timecode_Frames 
MS_Hours 
MS_Minutes 
MS_Seconds 
MS_Milliseconds 
Bars 
Beats 
Ticks 
AudioFrames 

Definition at line 157 of file audio_clock.h.

Enumerator
Timecode 
BBT 
MinSec 
Frames 

Definition at line 45 of file audio_clock.h.

Constructor & Destructor Documentation

AudioClock::AudioClock ( const std::string &  clock_name,
bool  is_transient,
const std::string &  widget_name,
bool  editable,
bool  follows_playhead,
bool  duration = false,
bool  with_info = false 
)

Definition at line 67 of file audio_clock.cc.

AudioClock::~AudioClock ( )

Definition at line 126 of file audio_clock.cc.

Member Function Documentation

bool AudioClock::bbt_validate_edit ( const std::string &  )
private

Definition at line 1904 of file audio_clock.cc.

void AudioClock::build_ops_menu ( )
protectedvirtual

Reimplemented in MainClock.

Definition at line 2101 of file audio_clock.cc.

void AudioClock::copy_text_to_clipboard ( ) const

Definition at line 2083 of file audio_clock.cc.

framepos_t AudioClock::current_duration ( framepos_t  position = 0) const

Definition at line 1879 of file audio_clock.cc.

framepos_t AudioClock::current_time ( framepos_t  position = 0) const

Definition at line 1873 of file audio_clock.cc.

void AudioClock::dpi_reset ( )
private

Definition at line 2292 of file audio_clock.cc.

void AudioClock::drop_focus ( )
private

Definition at line 703 of file audio_clock.cc.

void AudioClock::edit_next_field ( )
private
void AudioClock::end_edit ( bool  modify)
private

Definition at line 623 of file audio_clock.cc.

void AudioClock::end_edit_relative ( bool  add)
private

Definition at line 858 of file audio_clock.cc.

void AudioClock::focus ( )

Definition at line 2277 of file audio_clock.cc.

framepos_t AudioClock::frame_duration_from_bbt_string ( framepos_t  ,
const std::string &   
) const
private

Definition at line 2058 of file audio_clock.cc.

framepos_t AudioClock::frames_from_audioframes_string ( const std::string &  ) const
private

Definition at line 2075 of file audio_clock.cc.

framepos_t AudioClock::frames_from_bbt_string ( framepos_t  ,
const std::string &   
) const
private

Definition at line 2033 of file audio_clock.cc.

framepos_t AudioClock::frames_from_minsec_string ( const std::string &  ) const
private

Definition at line 2015 of file audio_clock.cc.

framepos_t AudioClock::frames_from_timecode_string ( const std::string &  ) const
private

Definition at line 1985 of file audio_clock.cc.

string AudioClock::get_field ( Field  f)
private

Definition at line 579 of file audio_clock.cc.

framepos_t AudioClock::get_frame_step ( Field  field,
framepos_t  pos = 0,
int  dir = 1 
)
private

Definition at line 1810 of file audio_clock.cc.

bool AudioClock::get_is_duration ( ) const
inlineprotected

Definition at line 101 of file audio_clock.h.

double AudioClock::get_left_rect_width ( ) const
inlineprotected

Definition at line 114 of file audio_clock.h.

AudioClock::Field AudioClock::index_to_field ( int  index) const
private

Definition at line 1539 of file audio_clock.cc.

Field AudioClock::index_to_field ( ) const
private
bool AudioClock::is_lower_layout_click ( int  y) const
inlineprotected

Definition at line 108 of file audio_clock.h.

bool AudioClock::is_right_layout_click ( int  x) const
inlineprotected

Definition at line 111 of file audio_clock.h.

void AudioClock::locate ( )

Definition at line 2136 of file audio_clock.cc.

int AudioClock::merge_input_and_edit_string ( )
private

Definition at line 1470 of file audio_clock.cc.

bool AudioClock::minsec_validate_edit ( const std::string &  )
private

Definition at line 1969 of file audio_clock.cc.

Mode AudioClock::mode ( ) const
inline

Definition at line 56 of file audio_clock.h.

std::string AudioClock::name ( ) const
inline

Definition at line 75 of file audio_clock.h.

bool AudioClock::off ( ) const
inline

Definition at line 58 of file audio_clock.h.

bool AudioClock::on_button_press_event ( GdkEventButton *  ev)
protected

Definition at line 1582 of file audio_clock.cc.

bool AudioClock::on_button_release_event ( GdkEventButton *  ev)
protected

Definition at line 1625 of file audio_clock.cc.

bool AudioClock::on_focus_out_event ( GdkEventFocus *  ev)
private

Definition at line 1683 of file audio_clock.cc.

bool AudioClock::on_key_press_event ( GdkEventKey *  ev)
private

Definition at line 1325 of file audio_clock.cc.

bool AudioClock::on_key_release_event ( GdkEventKey *  ev)
private

Definition at line 1491 of file audio_clock.cc.

bool AudioClock::on_motion_notify_event ( GdkEventMotion *  ev)
private

Definition at line 1762 of file audio_clock.cc.

void AudioClock::on_realize ( )
private

Definition at line 148 of file audio_clock.cc.

bool AudioClock::on_scroll_event ( GdkEventScroll *  ev)
private

Definition at line 1695 of file audio_clock.cc.

void AudioClock::on_size_allocate ( Gtk::Allocation &  alloc)
private

Definition at line 444 of file audio_clock.cc.

void AudioClock::on_size_request ( Gtk::Requisition *  req)
private

Definition at line 481 of file audio_clock.cc.

void AudioClock::on_style_changed ( const Glib::RefPtr< Gtk::Style > &  old_style)
private

Definition at line 2231 of file audio_clock.cc.

framecnt_t AudioClock::parse_as_bbt_distance ( const std::string &  )
private

Definition at line 832 of file audio_clock.cc.

framecnt_t AudioClock::parse_as_distance ( const std::string &  instr)
private

Definition at line 838 of file audio_clock.cc.

framecnt_t AudioClock::parse_as_frames_distance ( const std::string &  str)
private

Definition at line 721 of file audio_clock.cc.

framecnt_t AudioClock::parse_as_minsec_distance ( const std::string &  str)
private

Definition at line 733 of file audio_clock.cc.

framecnt_t AudioClock::parse_as_timecode_distance ( const std::string &  str)
private

Definition at line 783 of file audio_clock.cc.

void AudioClock::print_minsec ( framepos_t  when,
char *  buf,
size_t  bufsize,
float  frame_rate 
)
static

Definition at line 1134 of file audio_clock.cc.

void AudioClock::render ( cairo_t *  cr,
cairo_rectangle_t *   
)
protectedvirtual

Implements CairoWidget.

Definition at line 293 of file audio_clock.cc.

void AudioClock::session_configuration_changed ( std::string  p)
private

Definition at line 923 of file audio_clock.cc.

void AudioClock::session_property_changed ( const PBD::PropertyChange )
private

Definition at line 917 of file audio_clock.cc.

void AudioClock::set ( framepos_t  when,
bool  force = false,
ARDOUR::framecnt_t  offset = 0 
)

Definition at line 956 of file audio_clock.cc.

void AudioClock::set_active_state ( Gtkmm2ext::ActiveState  s)
virtual

Reimplemented from CairoWidget.

Definition at line 205 of file audio_clock.cc.

void AudioClock::set_bbt ( framepos_t  when,
bool   
)
private

Definition at line 1224 of file audio_clock.cc.

void AudioClock::set_bbt_reference ( framepos_t  pos)

Definition at line 2225 of file audio_clock.cc.

void AudioClock::set_clock_dimensions ( Gtk::Requisition &  req)
private

Definition at line 456 of file audio_clock.cc.

void AudioClock::set_colors ( )
private

Definition at line 212 of file audio_clock.cc.

void AudioClock::set_corner_radius ( double  r)

Definition at line 2283 of file audio_clock.cc.

void AudioClock::set_editable ( bool  yn)

Definition at line 2244 of file audio_clock.cc.

void AudioClock::set_font ( Pango::FontDescription  font)
private

Definition at line 165 of file audio_clock.cc.

void AudioClock::set_frames ( framepos_t  when,
bool   
)
private

Definition at line 1079 of file audio_clock.cc.

void AudioClock::set_from_playhead ( )

Definition at line 2125 of file audio_clock.cc.

void AudioClock::set_is_duration ( bool  yn)

Definition at line 2250 of file audio_clock.cc.

void AudioClock::set_minsec ( framepos_t  when,
bool   
)
private

Definition at line 1168 of file audio_clock.cc.

void AudioClock::set_mode ( Mode  m)

Definition at line 2146 of file audio_clock.cc.

void AudioClock::set_negative_allowed ( bool  yn)

Definition at line 2302 of file audio_clock.cc.

void AudioClock::set_off ( bool  yn)

Definition at line 2261 of file audio_clock.cc.

void AudioClock::set_scale ( double  x,
double  y 
)

Alter cairo scaling during rendering.

Used by clocks that resize themselves to fit any given space. Can lead to font distortion.

Definition at line 284 of file audio_clock.cc.

void AudioClock::set_session ( ARDOUR::Session s)
virtual

Reimplemented from ARDOUR::SessionHandlePtr.

Definition at line 1291 of file audio_clock.cc.

void AudioClock::set_slave_info ( )
private

Definition at line 1022 of file audio_clock.cc.

void AudioClock::set_timecode ( framepos_t  when,
bool   
)
private

Definition at line 1190 of file audio_clock.cc.

void AudioClock::set_widget_name ( const std::string &  name)

Definition at line 133 of file audio_clock.cc.

void AudioClock::show_edit_status ( int  length)
private

Definition at line 538 of file audio_clock.cc.

void AudioClock::start_edit ( Field  f = Field (0))
private

Definition at line 550 of file audio_clock.cc.

bool AudioClock::timecode_validate_edit ( const std::string &  )
private

Definition at line 1928 of file audio_clock.cc.

Member Data Documentation

bool AudioClock::_edit_by_click_field
private

Definition at line 127 of file audio_clock.h.

bool AudioClock::_follows_playhead
private

true if this clock follows the playhead, meaning that certain operations are redundant

Definition at line 124 of file audio_clock.h.

Glib::RefPtr<Pango::Layout> AudioClock::_layout
private

Definition at line 131 of file audio_clock.h.

Glib::RefPtr<Pango::Layout> AudioClock::_left_layout
private

Definition at line 132 of file audio_clock.h.

Mode AudioClock::_mode
private

Definition at line 118 of file audio_clock.h.

std::string AudioClock::_name
private

Definition at line 119 of file audio_clock.h.

bool AudioClock::_negative_allowed
private

Definition at line 128 of file audio_clock.h.

bool AudioClock::_off
private

Definition at line 125 of file audio_clock.h.

Glib::RefPtr<Pango::Layout> AudioClock::_right_layout
private

Definition at line 133 of file audio_clock.h.

framepos_t AudioClock::bbt_reference_time
private

Definition at line 187 of file audio_clock.h.

double AudioClock::bg_a
private

Definition at line 253 of file audio_clock.h.

double AudioClock::bg_b
private

Definition at line 253 of file audio_clock.h.

double AudioClock::bg_g
private

Definition at line 253 of file audio_clock.h.

double AudioClock::bg_r
private

Definition at line 253 of file audio_clock.h.

sigc::signal<void> AudioClock::ChangeAborted

Definition at line 94 of file audio_clock.h.

vector< AudioClock * > AudioClock::clocks
static

Definition at line 97 of file audio_clock.h.

double AudioClock::corner_radius
private

Definition at line 150 of file audio_clock.h.

double AudioClock::cursor_a
private

Definition at line 254 of file audio_clock.h.

double AudioClock::cursor_b
private

Definition at line 254 of file audio_clock.h.

double AudioClock::cursor_g
private

Definition at line 254 of file audio_clock.h.

double AudioClock::cursor_r
private

Definition at line 254 of file audio_clock.h.

double AudioClock::drag_accum
private

Definition at line 195 of file audio_clock.h.

Field AudioClock::drag_field
private

Definition at line 196 of file audio_clock.h.

double AudioClock::drag_start_y
private

Definition at line 193 of file audio_clock.h.

double AudioClock::drag_y
private

Definition at line 194 of file audio_clock.h.

bool AudioClock::dragging
private

Definition at line 192 of file audio_clock.h.

bool AudioClock::edit_is_negative
private

Definition at line 129 of file audio_clock.h.

std::string AudioClock::edit_string
private

Definition at line 183 of file audio_clock.h.

bool AudioClock::editable
private

Definition at line 122 of file audio_clock.h.

bool AudioClock::editing
private

Definition at line 182 of file audio_clock.h.

Pango::AttrColor* AudioClock::editing_attr
private

Definition at line 135 of file audio_clock.h.

Pango::AttrList AudioClock::editing_attributes
private

Definition at line 139 of file audio_clock.h.

int AudioClock::em_width
private

Definition at line 126 of file audio_clock.h.

int AudioClock::first_height
private

Definition at line 142 of file audio_clock.h.

int AudioClock::first_width
private

Definition at line 143 of file audio_clock.h.

uint32_t AudioClock::font_size
private

Definition at line 151 of file audio_clock.h.

Pango::AttrColor* AudioClock::foreground_attr
private

Definition at line 136 of file audio_clock.h.

Pango::AttrList AudioClock::info_attributes
private

Definition at line 140 of file audio_clock.h.

const double AudioClock::info_font_scale_factor = 0.60
staticprivate

Definition at line 153 of file audio_clock.h.

int AudioClock::info_height
private

Definition at line 147 of file audio_clock.h.

std::string AudioClock::input_string
private

Definition at line 185 of file audio_clock.h.

std::vector<int> AudioClock::insert_map
private

Definition at line 180 of file audio_clock.h.

bool AudioClock::is_duration
private

Definition at line 121 of file audio_clock.h.

bool AudioClock::is_transient
private

Definition at line 120 of file audio_clock.h.

bool AudioClock::last_pdelta
private

Definition at line 189 of file audio_clock.h.

bool AudioClock::last_sdelta
private

Definition at line 190 of file audio_clock.h.

framepos_t AudioClock::last_when
private

Definition at line 188 of file audio_clock.h.

int AudioClock::layout_height
private

Definition at line 145 of file audio_clock.h.

int AudioClock::layout_width
private

Definition at line 146 of file audio_clock.h.

double AudioClock::mode_based_info_ratio
private

Definition at line 149 of file audio_clock.h.

sigc::signal<void> AudioClock::mode_changed

Definition at line 93 of file audio_clock.h.

sigc::signal< void > AudioClock::ModeChanged
static

Definition at line 96 of file audio_clock.h.

Pango::AttrList AudioClock::normal_attributes
private

Definition at line 138 of file audio_clock.h.

Gtk::Menu* AudioClock::ops_menu
protected

Definition at line 104 of file audio_clock.h.

std::string AudioClock::pre_edit_string
private

Definition at line 184 of file audio_clock.h.

const double AudioClock::separator_height = 0.0
staticprivate

Definition at line 154 of file audio_clock.h.

bool AudioClock::style_resets_first
private

Definition at line 144 of file audio_clock.h.

int AudioClock::upper_height
private

Definition at line 148 of file audio_clock.h.

sigc::signal<void> AudioClock::ValueChanged

Definition at line 92 of file audio_clock.h.

const double AudioClock::x_leading_padding = 6.0
staticprivate

Definition at line 155 of file audio_clock.h.

double AudioClock::xscale
private

Definition at line 256 of file audio_clock.h.

double AudioClock::yscale
private

Definition at line 257 of file audio_clock.h.


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