ardour
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | List of all members
NoteBase Class Referenceabstract

#include <note_base.h>

Inheritance diagram for NoteBase:
Hit Note

Public Types

typedef Evoral::Note
< Evoral::Beats
NoteType
 

Public Member Functions

 NoteBase (MidiRegionView &region, bool, const boost::shared_ptr< NoteType > note=boost::shared_ptr< NoteType >())
 
virtual ~NoteBase ()
 
void set_item (ArdourCanvas::Item *)
 
ArdourCanvas::Item * item () const
 
virtual void show ()=0
 
virtual void hide ()=0
 
bool valid () const
 
void invalidate ()
 
void validate ()
 
bool selected () const
 
void set_selected (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
 
float mouse_x_fraction () const
 
float mouse_y_fraction () const
 
const boost::shared_ptr< NoteTypenote () const
 
MidiRegionViewregion_view () const
 
bool mouse_near_ends () const
 
virtual bool big_enough_to_trim () const
 

Static Public Member Functions

static uint32_t meter_style_fill_color (uint8_t vel, bool selected)
 
static uint32_t calculate_outline (uint32_t color, bool selected=false)
 calculate outline colors from fill colors of notes More...
 

Static Public Attributes

static PBD::Signal1< void,
NoteBase * > 
NoteBaseDeleted
 
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

MidiRegionView_region
 
ArdourCanvas::Item * _item
 
ArdourCanvas::Text * _text
 
State _state
 
const boost::shared_ptr< NoteType_note
 
bool _with_events
 
bool _own_note
 
bool _selected
 
bool _valid
 
float _mouse_x_fraction
 
float _mouse_y_fraction
 

Private Member Functions

bool event_handler (GdkEvent *)
 

Detailed Description

Base class for canvas notes (sustained note rectangles and hit diamonds).

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 54 of file note_base.h.

Member Typedef Documentation

Definition at line 57 of file note_base.h.

Member Enumeration Documentation

enum NoteBase::State
protected
Enumerator
None 
Pressed 
Dragging 

Definition at line 138 of file note_base.h.

Constructor & Destructor Documentation

NoteBase::NoteBase ( MidiRegionView region,
bool  with_events,
const boost::shared_ptr< NoteType note = boost::shared_ptr<NoteType>() 
)

Definition at line 49 of file note_base.cc.

NoteBase::~NoteBase ( )
virtual

Definition at line 63 of file note_base.cc.

Member Function Documentation

uint32_t NoteBase::base_color ( )

Definition at line 159 of file note_base.cc.

bool NoteBase::big_enough_to_trim ( ) const
virtual

Reimplemented in Hit.

Definition at line 300 of file note_base.cc.

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

calculate outline colors from fill colors of notes

Definition at line 123 of file note_base.h.

bool NoteBase::event_handler ( GdkEvent *  ev)
private

Definition at line 255 of file note_base.cc.

virtual void NoteBase::hide ( )
pure virtual

Implemented in Note, and Hit.

void NoteBase::hide_velocity ( )

Definition at line 113 of file note_base.cc.

void NoteBase::invalidate ( )

Definition at line 82 of file note_base.cc.

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

Definition at line 63 of file note_base.h.

static uint32_t NoteBase::meter_style_fill_color ( uint8_t  vel,
bool  selected 
)
inlinestatic

Definition at line 106 of file note_base.h.

bool NoteBase::mouse_near_ends ( ) const

Definition at line 293 of file note_base.cc.

float NoteBase::mouse_x_fraction ( ) const
inline

Definition at line 100 of file note_base.h.

float NoteBase::mouse_y_fraction ( ) const
inline

Definition at line 101 of file note_base.h.

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

Implemented in Note, and Hit.

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

Definition at line 103 of file note_base.h.

void NoteBase::on_channel_change ( uint8_t  channel)

Channel changed for this specific event

Definition at line 137 of file note_base.cc.

void NoteBase::on_channel_selection_change ( uint16_t  selection)

Channel selection changed

Definition at line 120 of file note_base.cc.

MidiRegionView& NoteBase::region_view ( ) const
inline

Definition at line 104 of file note_base.h.

bool NoteBase::selected ( ) const
inline

Definition at line 74 of file note_base.h.

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

Implemented in Hit, and Note.

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

Implemented in Note, and Hit.

void NoteBase::set_item ( ArdourCanvas::Item *  )

Definition at line 71 of file note_base.cc.

void NoteBase::set_mouse_fractions ( GdkEvent *  ev)
protected

Definition at line 189 of file note_base.cc.

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

Implemented in Hit, and Note.

void NoteBase::set_selected ( bool  yn)

Definition at line 144 of file note_base.cc.

virtual void NoteBase::show ( )
pure virtual

Implemented in Note, and Hit.

void NoteBase::show_velocity ( )

Definition at line 94 of file note_base.cc.

bool NoteBase::valid ( ) const
inline

Definition at line 70 of file note_base.h.

void NoteBase::validate ( )

Definition at line 88 of file note_base.cc.

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

Implemented in Hit, and Note.

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

Implemented in Hit, and Note.

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

Implemented in Hit, and Note.

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

Implemented in Hit, and Note.

Member Data Documentation

ArdourCanvas::Item* NoteBase::_item
protected

Definition at line 141 of file note_base.h.

float NoteBase::_mouse_x_fraction
protected

Definition at line 149 of file note_base.h.

float NoteBase::_mouse_y_fraction
protected

Definition at line 150 of file note_base.h.

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

Definition at line 144 of file note_base.h.

bool NoteBase::_own_note
protected

Definition at line 146 of file note_base.h.

MidiRegionView& NoteBase::_region
protected

Definition at line 140 of file note_base.h.

bool NoteBase::_selected
protected

Definition at line 147 of file note_base.h.

State NoteBase::_state
protected

Definition at line 143 of file note_base.h.

ArdourCanvas::Text* NoteBase::_text
protected

Definition at line 142 of file note_base.h.

bool NoteBase::_valid
protected

Definition at line 148 of file note_base.h.

bool NoteBase::_with_events
protected

Definition at line 145 of file note_base.h.

const uint32_t NoteBase::midi_channel_colors
static
Initial value:
= {
0xd32d2dff, 0xd36b2dff, 0xd3972dff, 0xd3d12dff,
0xa0d32dff, 0x7dd32dff, 0x2dd45eff, 0x2dd3c4ff,
0x2da5d3ff, 0x2d6fd3ff, 0x432dd3ff, 0x662dd3ff,
0x832dd3ff, 0xa92dd3ff, 0xd32dbfff, 0xd32d67ff
}

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

dividing the hue circle in 16 parts, hand adjusted for equal look, courtesy Thorsten Wilms

Definition at line 132 of file note_base.h.

PBD::Signal1< void, NoteBase * > NoteBase::NoteBaseDeleted
static

Definition at line 65 of file note_base.h.


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