Ardour  9.0-pre0-582-g084a23a80d
NoteBase Class Referenceabstract

#include <note_base.h>

Inheritance diagram for NoteBase:
[legend]

Public Types

typedef Evoral::Note< Temporal::BeatsNoteType
 

Public Member Functions

 NoteBase (MidiView &region, bool, const std::shared_ptr< NoteType > note=std::shared_ptr< NoteType >())
 
virtual ~NoteBase ()
 
void set_item (ArdourCanvas::Item *)
 
ArdourCanvas::Itemitem () const
 
virtual void show ()=0
 
virtual void hide ()=0
 
bool valid () const
 
void invalidate ()
 
void validate ()
 
bool selected () const
 
void set_selected (bool yn)
 
void set_hide_selection (bool yn)
 
virtual void move_event (double dx, double dy)=0
 
uint32_t base_color ()
 
void show_velocity ()
 
void hide_velocity ()
 
void on_channel_change (uint8_t channel)
 
void on_channel_selection_change (uint16_t selection)
 
virtual void set_outline_color (uint32_t c)=0
 
virtual void set_fill_color (uint32_t c)=0
 
virtual void set_ignore_events (bool ignore)=0
 
virtual ArdourCanvas::Coord x0 () const =0
 
virtual ArdourCanvas::Coord y0 () const =0
 
virtual ArdourCanvas::Coord x1 () const =0
 
virtual ArdourCanvas::Coord y1 () const =0
 
virtual void set_velocity (double)
 
virtual double visual_velocity () const =0
 
float mouse_x_fraction () const
 
float mouse_y_fraction () const
 
const std::shared_ptr< NoteTypenote () const
 
MidiViewregion_view () const
 
bool mouse_near_ends () const
 
virtual bool big_enough_to_trim () const
 

Static Public Member Functions

static uint32_t base_color (int velocity, ARDOUR::ColorMode color_mode, Gtkmm2ext::Color, int channel, bool selected)
 
static void set_colors ()
 
static Gtkmm2ext::Color meter_style_fill_color (uint8_t vel, bool selected)
 
static uint32_t calculate_outline (uint32_t color, bool showing_selection=false)
 calculate outline colors from fill colors of notes More...
 

Static Public Attributes

static const uint32_t midi_channel_colors [16]
 hue circle divided into 16 equal-looking parts, courtesy Thorsten Wilms More...
 

Protected Types

enum  State { None , Pressed , Dragging }
 

Protected Member Functions

void set_mouse_fractions (GdkEvent *)
 

Protected Attributes

MidiView_region
 
ArdourCanvas::Item_item
 
ArdourCanvas::Text_text
 
State _state
 
const std::shared_ptr< NoteType_note
 
bool _with_events
 
bool _own_note
 
Flags _flags
 
bool _valid
 
float _mouse_x_fraction
 
float _mouse_y_fraction
 

Private Types

enum  Flags { Selected = 0x1 , HideSelection = 0x2 }
 

Private Member Functions

bool event_handler (GdkEvent *)
 

Static Private Attributes

static Gtkmm2ext::Color _selected_col
 
static Gtkmm2ext::SVAModifier color_modifier
 
static Gtkmm2ext::Color velocity_color_table [128]
 
static bool _color_init
 

Detailed Description

Base class for canvas notes (sustained note rectangles, percussive hit diamonds, and velocity lollipops)

This is not actually a canvas item itself to avoid the dreaded diamond inheritance pattern, since various types of canvas items (Note (rect), Hit (diamond), etc) need to share this functionality but can't share an ancestor.

Note: Because of this, derived classes need to manually bounce events to on_event, it won't happen automatically.

Definition at line 58 of file note_base.h.

Member Typedef Documentation

◆ NoteType

Definition at line 67 of file note_base.h.

Member Enumeration Documentation

◆ Flags

enum NoteBase::Flags
private
Enumerator
Selected 
HideSelection 

Definition at line 61 of file note_base.h.

◆ State

enum NoteBase::State
protected
Enumerator
None 
Pressed 
Dragging 

Definition at line 139 of file note_base.h.

Constructor & Destructor Documentation

◆ NoteBase()

NoteBase::NoteBase ( MidiView region,
bool  ,
const std::shared_ptr< NoteType note = std::shared_ptr< NoteType >() 
)

◆ ~NoteBase()

virtual NoteBase::~NoteBase ( )
virtual

Member Function Documentation

◆ base_color() [1/2]

uint32_t NoteBase::base_color ( )

◆ base_color() [2/2]

static uint32_t NoteBase::base_color ( int  velocity,
ARDOUR::ColorMode  color_mode,
Gtkmm2ext::Color  ,
int  channel,
bool  selected 
)
static

◆ big_enough_to_trim()

virtual bool NoteBase::big_enough_to_trim ( ) const
virtual

Reimplemented in Hit.

◆ calculate_outline()

static uint32_t NoteBase::calculate_outline ( uint32_t  color,
bool  showing_selection = false 
)
inlinestatic

calculate outline colors from fill colors of notes

Definition at line 124 of file note_base.h.

◆ event_handler()

bool NoteBase::event_handler ( GdkEvent )
private

◆ hide()

virtual void NoteBase::hide ( )
pure virtual

Implemented in Note, and Hit.

◆ hide_velocity()

void NoteBase::hide_velocity ( )

◆ invalidate()

void NoteBase::invalidate ( )

◆ item()

ArdourCanvas::Item* NoteBase::item ( ) const
inline

Definition at line 73 of file note_base.h.

◆ meter_style_fill_color()

static Gtkmm2ext::Color NoteBase::meter_style_fill_color ( uint8_t  vel,
bool  selected 
)
static

◆ mouse_near_ends()

bool NoteBase::mouse_near_ends ( ) const

◆ mouse_x_fraction()

float NoteBase::mouse_x_fraction ( ) const
inline

Definition at line 113 of file note_base.h.

◆ mouse_y_fraction()

float NoteBase::mouse_y_fraction ( ) const
inline

Definition at line 114 of file note_base.h.

◆ move_event()

virtual void NoteBase::move_event ( double  dx,
double  dy 
)
pure virtual

Implemented in Hit, and Note.

◆ note()

const std::shared_ptr<NoteType> NoteBase::note ( ) const
inline

Definition at line 116 of file note_base.h.

◆ on_channel_change()

void NoteBase::on_channel_change ( uint8_t  channel)

Channel changed for this specific event

◆ on_channel_selection_change()

void NoteBase::on_channel_selection_change ( uint16_t  selection)

Channel selection changed

◆ region_view()

MidiView& NoteBase::region_view ( ) const
inline

Definition at line 117 of file note_base.h.

◆ selected()

bool NoteBase::selected ( ) const
inline

Definition at line 82 of file note_base.h.

◆ set_colors()

static void NoteBase::set_colors ( )
static

◆ set_fill_color()

virtual void NoteBase::set_fill_color ( uint32_t  c)
pure virtual

Implemented in Note, and Hit.

◆ set_hide_selection()

void NoteBase::set_hide_selection ( bool  yn)

◆ set_ignore_events()

virtual void NoteBase::set_ignore_events ( bool  ignore)
pure virtual

Implemented in Note, and Hit.

◆ set_item()

void NoteBase::set_item ( ArdourCanvas::Item )

◆ set_mouse_fractions()

void NoteBase::set_mouse_fractions ( GdkEvent )
protected

◆ set_outline_color()

virtual void NoteBase::set_outline_color ( uint32_t  c)
pure virtual

Implemented in Note, and Hit.

◆ set_selected()

void NoteBase::set_selected ( bool  yn)

◆ set_velocity()

virtual void NoteBase::set_velocity ( double  )
inlinevirtual

Reimplemented in Note.

Definition at line 110 of file note_base.h.

◆ show()

virtual void NoteBase::show ( )
pure virtual

Implemented in Note, and Hit.

◆ show_velocity()

void NoteBase::show_velocity ( )

◆ valid()

bool NoteBase::valid ( ) const
inline

Definition at line 78 of file note_base.h.

◆ validate()

void NoteBase::validate ( )

◆ visual_velocity()

virtual double NoteBase::visual_velocity ( ) const
pure virtual

Implemented in Note, and Hit.

◆ x0()

virtual ArdourCanvas::Coord NoteBase::x0 ( ) const
pure virtual

Implemented in Note, and Hit.

◆ x1()

virtual ArdourCanvas::Coord NoteBase::x1 ( ) const
pure virtual

Implemented in Note, and Hit.

◆ y0()

virtual ArdourCanvas::Coord NoteBase::y0 ( ) const
pure virtual

Implemented in Note, and Hit.

◆ y1()

virtual ArdourCanvas::Coord NoteBase::y1 ( ) const
pure virtual

Implemented in Note, and Hit.

Member Data Documentation

◆ _color_init

bool NoteBase::_color_init
staticprivate

Definition at line 161 of file note_base.h.

◆ _flags

Flags NoteBase::_flags
protected

Definition at line 148 of file note_base.h.

◆ _item

ArdourCanvas::Item* NoteBase::_item
protected

Definition at line 142 of file note_base.h.

◆ _mouse_x_fraction

float NoteBase::_mouse_x_fraction
protected

Definition at line 150 of file note_base.h.

◆ _mouse_y_fraction

float NoteBase::_mouse_y_fraction
protected

Definition at line 151 of file note_base.h.

◆ _note

const std::shared_ptr<NoteType> NoteBase::_note
protected

Definition at line 145 of file note_base.h.

◆ _own_note

bool NoteBase::_own_note
protected

Definition at line 147 of file note_base.h.

◆ _region

MidiView& NoteBase::_region
protected

Definition at line 141 of file note_base.h.

◆ _selected_col

Gtkmm2ext::Color NoteBase::_selected_col
staticprivate

Definition at line 158 of file note_base.h.

◆ _state

State NoteBase::_state
protected

Definition at line 144 of file note_base.h.

◆ _text

ArdourCanvas::Text* NoteBase::_text
protected

Definition at line 143 of file note_base.h.

◆ _valid

bool NoteBase::_valid
protected

Definition at line 149 of file note_base.h.

◆ _with_events

bool NoteBase::_with_events
protected

Definition at line 146 of file note_base.h.

◆ color_modifier

Gtkmm2ext::SVAModifier NoteBase::color_modifier
staticprivate

Definition at line 159 of file note_base.h.

◆ midi_channel_colors

const uint32_t NoteBase::midi_channel_colors[16]
static

hue circle divided into 16 equal-looking parts, courtesy Thorsten Wilms

Definition at line 133 of file note_base.h.

◆ velocity_color_table

Gtkmm2ext::Color NoteBase::velocity_color_table[128]
staticprivate

Definition at line 160 of file note_base.h.


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