diff options
author | David Robillard <d@drobilla.net> | 2007-08-04 04:18:34 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-08-04 04:18:34 +0000 |
commit | 604a0079ce5882cd6afd619b79020d9c694d7165 (patch) | |
tree | 747ceb53da3397e7b930463f858602e394822f61 /gtk2_ardour/midi_streamview.h | |
parent | 93dbcbd606deb404c2296c4b7d63e4fcd316e81d (diff) |
Moved note height/range/etc stuff from MidiRegionView to MidiStreamView, since it's all shared anyway.
Fixed positioning of percussion hits.
Note row separator lines (ie a "piano roll".. if it counts as a piano roll without an actual piano on the side of it, anyway).
git-svn-id: svn://localhost/ardour2/trunk@2237 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'gtk2_ardour/midi_streamview.h')
-rw-r--r-- | gtk2_ardour/midi_streamview.h | 32 |
1 files changed, 29 insertions, 3 deletions
diff --git a/gtk2_ardour/midi_streamview.h b/gtk2_ardour/midi_streamview.h index ceee4dc444..6ba2b7146f 100644 --- a/gtk2_ardour/midi_streamview.h +++ b/gtk2_ardour/midi_streamview.h @@ -26,6 +26,8 @@ #include "enums.h" #include "simplerect.h" #include "streamview.h" +#include "time_axis_view_item.h" +#include "route_time_axis.h" namespace Gdk { class Color; @@ -72,6 +74,24 @@ class MidiStreamView : public StreamView void update_bounds(uint8_t note_num); void redisplay_diskstream (); + + inline double contents_height() const + { return (_trackview.height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2); } + + inline double note_to_y(uint8_t note) const + { return contents_height() + - (note + 1 - _lowest_note) * note_height() + 1; } + + inline uint8_t y_to_note(double y) const + { return (uint8_t)((contents_height() - y - 1) + / contents_height() * (double)contents_note_range()) + + _lowest_note; } + + inline double note_height() const + { return contents_height() / (double)contents_note_range(); } + + inline uint8_t contents_note_range() const + { return _highest_note - _lowest_note + 1; } private: void setup_rec_box (); @@ -80,12 +100,18 @@ class MidiStreamView : public StreamView RegionView* add_region_view_internal (boost::shared_ptr<ARDOUR::Region>, bool wait_for_waves); void display_region(MidiRegionView* region_view, bool load_model); + void display_diskstream (boost::shared_ptr<ARDOUR::Diskstream> ds); + + void update_contents_y_position_and_height (); + void draw_note_separators(); void color_handler (); - VisibleNoteRange _range; - uint8_t _lowest_note; - uint8_t _highest_note; + VisibleNoteRange _range; + uint8_t _lowest_note; + uint8_t _highest_note; + ArdourCanvas::Group* _note_line_group; + ArdourCanvas::SimpleLine* _note_lines[127]; }; #endif /* __ardour_midi_streamview_h__ */ |