start using the now-compilable MidiView

Nothing yet derives from this, but MIDI display items and drags
do use it.
This commit is contained in:
Paul Davis 2024-01-04 19:07:52 -07:00
parent 2830cda07e
commit 4d4fba51f6
24 changed files with 445 additions and 543 deletions

View File

@ -92,8 +92,6 @@ class CueEditor : public EditingContext
}
VerboseCursor* verbose_cursor () const;
void set_snapped_cursor_position (Temporal::timepos_t const & pos);
std::vector<MidiRegionView*> filter_to_unique_midi_region_views (RegionSelection const & ms) const;

View File

@ -25,7 +25,7 @@
#include "gtkmm2ext/utils.h"
#include "edit_note_dialog.h"
#include "midi_region_view.h"
#include "midi_view.h"
#include "note_base.h"
#include "pbd/i18n.h"
@ -41,7 +41,7 @@ using namespace Gtkmm2ext;
* @param n Notes to edit.
*/
EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n)
EditNoteDialog::EditNoteDialog (MidiView* rv, set<NoteBase*> n)
: ArdourDialog (_("Note"))
, _region_view (rv)
, _events (n)
@ -94,12 +94,11 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n)
table->attach (_time_all, 2, 3, r, r + 1);
++r;
_time_clock.set_session (_region_view->get_time_axis_view().session ());
// XXXX _time_clock.set_session (_region_view->get_time_axis_view().session ());
_time_clock.set_mode (AudioClock::BBT);
/* Calculate absolute position of the event on time timeline */
std::shared_ptr<ARDOUR::Region> region (_region_view->region ());
timepos_t const pos = region->source_position() + timecnt_t ((*_events.begin())->note()->time ());
timepos_t const pos = _region_view->current_slice().source_position() + timecnt_t ((*_events.begin())->note()->time ());
_time_clock.set (pos, true);
@ -109,7 +108,7 @@ EditNoteDialog::EditNoteDialog (MidiRegionView* rv, set<NoteBase*> n)
table->attach (_length_all, 2, 3, r, r + 1);
++r;
_length_clock.set_session (_region_view->get_time_axis_view().session ());
// XXXX _length_clock.set_session (_region_view->get_time_axis_view().session ());
_length_clock.set_mode (AudioClock::BBT);
_length_clock.set_duration (timecnt_t ((*_events.begin())->note()->length()), true);
@ -201,10 +200,8 @@ EditNoteDialog::done (int r)
}
}
std::shared_ptr<ARDOUR::Region> region (_region_view->region ());
/* convert current clock time into an offset from the start of the source */
timecnt_t const time_clock_source_relative = region->source_position ().distance (_time_clock.last_when ());
timecnt_t const time_clock_source_relative = _region_view->current_slice().source_position ().distance (_time_clock.last_when ());
/* convert that into a position in Beats - this will be the new note time (as an offset inside the source) */
Beats const new_note_time_source_relative_beats = time_clock_source_relative.beats ();

View File

@ -22,18 +22,18 @@
#include "ardour_dialog.h"
#include "audio_clock.h"
class MidiRegionView;
class MidiView;
class NoteBase;
class EditNoteDialog : public ArdourDialog
{
public:
EditNoteDialog (MidiRegionView* rv, std::set<NoteBase*> n);
EditNoteDialog (MidiView* rv, std::set<NoteBase*> n);
void done (int);
private:
MidiRegionView* _region_view;
MidiView* _region_view;
std::set<NoteBase*> _events;
Gtk::SpinButton _channel;
Gtk::CheckButton _channel_all;

View File

@ -137,6 +137,7 @@
#include "marker.h"
#include "midi_region_view.h"
#include "midi_time_axis.h"
#include "midi_view.h"
#include "mixer_strip.h"
#include "mixer_ui.h"
#include "mouse_cursors.h"
@ -6073,7 +6074,7 @@ Editor::popup_note_context_menu (ArdourCanvas::Item* item, GdkEvent* event)
popping up the menu will cause a region leave event which clears
entered_regionview. */
MidiRegionView& mrv = note->region_view();
MidiView& mrv = note->region_view();
const RegionSelection rs = get_regions_from_selection_and_entered ();
const uint32_t sel_size = mrv.selection_size ();
@ -6082,7 +6083,7 @@ Editor::popup_note_context_menu (ArdourCanvas::Item* item, GdkEvent* event)
if (sel_size > 0) {
items.push_back(MenuElem(_("Delete"),
sigc::mem_fun(mrv, &MidiRegionView::delete_selection)));
sigc::mem_fun(mrv, &MidiView::delete_selection)));
}
items.push_back(MenuElem(_("Edit..."),
@ -6209,7 +6210,7 @@ Editor::instant_save ()
}
void
Editor::snap_to_internal (timepos_t& start, Temporal::RoundMode direction, SnapPref pref, bool ensure_snap)
Editor::snap_to_internal (timepos_t& start, Temporal::RoundMode direction, SnapPref pref, bool ensure_snap) const
{
UIConfiguration const& uic (UIConfiguration::instance ());
const timepos_t presnap = start;
@ -6246,8 +6247,8 @@ Editor::snap_to_internal (timepos_t& start, Temporal::RoundMode direction, SnapP
if (!region_boundary_cache.empty ()) {
vector<timepos_t>::iterator prev = region_boundary_cache.begin ();
vector<timepos_t>::iterator next = std::upper_bound (region_boundary_cache.begin (), region_boundary_cache.end (), presnap);
auto prev = region_boundary_cache.begin ();
auto next = std::upper_bound (region_boundary_cache.begin (), region_boundary_cache.end (), presnap);
if (next != region_boundary_cache.begin ()) {
prev = next;
prev--;

View File

@ -134,6 +134,7 @@ class EditorSummary;
class GUIObjectState;
class ArdourMarker;
class MidiRegionView;
class MidiView;
class MidiExportDialog;
class MixerStrip;
class MouseCursors;
@ -1699,7 +1700,7 @@ private:
void edit_meter_marker (MeterMarker&);
void edit_bbt_marker (BBTMarker&);
void edit_control_point (ArdourCanvas::Item*);
void edit_notes (MidiRegionView*);
void edit_notes (MidiView*);
void edit_region (RegionView*);
void edit_current_meter ();

View File

@ -72,6 +72,7 @@
#include "midi_region_view.h"
#include "midi_selection.h"
#include "midi_time_axis.h"
#include "midi_view.h"
#include "mouse_cursors.h"
#include "note_base.h"
#include "patch_change.h"
@ -2384,12 +2385,14 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
Drag::start_grab (event, cursor);
#warning paul fix me MRV/MV
#if 0
region = &cnote->region_view ();
double temp;
temp = region->snap_to_pixel (cnote->x0 (), true);
_snap_delta = temp - cnote->x0 ();
#endif
_item->grab ();
if (event->motion.state & ArdourKeyboard::note_size_relative_modifier ()) {
@ -6150,13 +6153,13 @@ NoteDrag::NoteDrag (EditingContext& ec, ArdourCanvas::Item* i)
_primary = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
assert (_primary);
_region = &_primary->region_view ();
_note_height = _region->midi_stream_view ()->note_height ();
_note_height = _region->midi_context().note_height ();
}
void
NoteDrag::setup_pointer_offset ()
{
_pointer_offset = _region->region ()->source_beats_to_absolute_time (_primary->note ()->time ()).distance (raw_grab_time ());
_pointer_offset = _region->current_slice().source_beats_to_absolute_time (_primary->note ()->time ()).distance (raw_grab_time ());
}
void
@ -6170,7 +6173,7 @@ NoteDrag::start_grab (GdkEvent* event, Gdk::Cursor*)
_copy = false;
}
setup_snap_delta (_region->region ()->source_beats_to_absolute_time (_primary->note ()->time ()));
setup_snap_delta (_region->current_slice().source_beats_to_absolute_time (_primary->note ()->time ()));
if (!(_was_selected = _primary->selected ())) {
/* tertiary-click means extend selection - we'll do that on button release,
@ -6205,7 +6208,7 @@ NoteDrag::total_dx (GdkEvent* event) const
timecnt_t const dx = timecnt_t (pixel_to_time (_drags->current_pointer_x () - grab_x ()), timepos_t ());
/* primary note time in quarter notes */
timepos_t const n_qn = _region->region ()->source_beats_to_absolute_time (_primary->note ()->time ());
timepos_t const n_qn = _region->current_slice().source_beats_to_absolute_time (_primary->note ()->time ());
/* new session relative time of the primary note (will be in beats)
@ -6225,8 +6228,8 @@ NoteDrag::total_dx (GdkEvent* event) const
timecnt_t ret (snap.earlier (n_qn).earlier (snap_delta (event->button.state)), n_qn);
/* prevent the earliest note being dragged earlier than the region's start position */
if (_earliest + ret < _region->region ()->start ()) {
ret -= (ret + _earliest) - _region->region ()->start ();
if (_earliest + ret < _region->current_slice().start ()) {
ret -= (ret + _earliest) - _region->current_slice().start ();
}
return ret;
@ -6240,13 +6243,13 @@ NoteDrag::total_dy () const
return 0;
}
double const y = _region->midi_view ()->y_position ();
double const y = _region->midi_context().y_position ();
/* new current note */
uint8_t n = _region->y_to_note (current_pointer_y () - y);
/* clamp */
MidiStreamView* msv = _region->midi_stream_view ();
n = max (msv->lowest_note (), n);
n = min (msv->highest_note (), n);
MidiViewBackground& mvb = _region->midi_context ();
n = max (mvb.lowest_note (), n);
n = min (mvb.highest_note (), n);
/* and work out delta */
return n - _region->y_to_note (grab_y () - y);
}
@ -6292,7 +6295,7 @@ NoteDrag::motion (GdkEvent* event, bool first_move)
_region->show_verbose_cursor_for_new_note_value (_primary->note (), new_note);
editing_context.set_snapped_cursor_position (_region->region ()->region_beats_to_absolute_time (_primary->note ()->time ()) + dx_qn);
editing_context.set_snapped_cursor_position (_region->current_slice().region_beats_to_absolute_time (_primary->note ()->time ()) + dx_qn);
}
}
@ -6659,21 +6662,21 @@ DraggingView::DraggingView (RegionView* v, RegionDrag* parent, TimeAxisView* ita
initial_end = v->region ()->position () + v->region ()->length ();
}
PatchChangeDrag::PatchChangeDrag (EditingContext& ec, PatchChange* i, MidiRegionView* r)
PatchChangeDrag::PatchChangeDrag (EditingContext& ec, PatchChange* i, MidiView* r)
: Drag (ec, i->canvas_item (), Temporal::BeatTime, true, false)
, _region_view (r)
, _patch_change (i)
, _cumulative_dx (0)
{
DEBUG_TRACE (DEBUG::Drags, string_compose ("New PatchChangeDrag, patch @ %1, grab @ %2\n",
_region_view->region ()->source_beats_to_absolute_time (_patch_change->patch ()->time ()),
_region_view->current_slice().source_beats_to_absolute_time (_patch_change->patch ()->time ()),
grab_time ()));
}
void
PatchChangeDrag::motion (GdkEvent* ev, bool)
{
std::shared_ptr<Region> r = _region_view->region ();
std::shared_ptr<Region> r = _region_view->midi_region ();
timepos_t f = adjusted_current_time (ev);
f = max (f, r->position ());
@ -6697,13 +6700,13 @@ PatchChangeDrag::finished (GdkEvent* ev, bool movement_occurred)
return;
}
std::shared_ptr<Region> r (_region_view->region ());
std::shared_ptr<Region> r (_region_view->midi_region ());
timepos_t f = adjusted_current_time (ev);
f = max (f, r->position ());
f = min (f, r->nt_last ());
_region_view->move_patch_change (*_patch_change, _region_view->region ()->absolute_time_to_source_beats (f));
_region_view->move_patch_change (*_patch_change, r->absolute_time_to_source_beats (f));
}
void
@ -6715,8 +6718,7 @@ PatchChangeDrag::aborted (bool)
void
PatchChangeDrag::setup_pointer_offset ()
{
std::shared_ptr<Region> region = _region_view->region ();
_pointer_offset = region->source_beats_to_absolute_time (_patch_change->patch ()->time ()).distance (raw_grab_time ());
_pointer_offset = _region_view->current_slice().source_beats_to_absolute_time (_patch_change->patch ()->time ()).distance (raw_grab_time ());
}
MidiRubberbandSelectDrag::MidiRubberbandSelectDrag (EditingContext& ec, MidiRegionView* rv)

View File

@ -77,6 +77,7 @@ class TimeAxisView;
class RouteTimeAxisView;
class RegionSelection;
class MidiRegionView;
class MidiView;
class MeterMarker;
class ArdourMarker;
class TempoMarker;
@ -643,7 +644,7 @@ private:
Temporal::timecnt_t total_dx (GdkEvent * event) const; // total movement in quarter notes
int8_t total_dy () const;
MidiRegionView* _region;
MidiView* _region;
NoteBase* _primary;
Temporal::timecnt_t _cumulative_dx;
double _cumulative_dy;
@ -727,7 +728,7 @@ private:
class PatchChangeDrag : public Drag
{
public:
PatchChangeDrag (EditingContext&, PatchChange *, MidiRegionView *);
PatchChangeDrag (EditingContext&, PatchChange *, MidiView *);
void motion (GdkEvent *, bool);
void finished (GdkEvent *, bool);
@ -744,7 +745,7 @@ public:
void setup_pointer_offset ();
private:
MidiRegionView* _region_view;
MidiView* _region_view;
PatchChange* _patch_change;
double _cumulative_dx;
};

View File

@ -65,6 +65,7 @@
#include "audio_time_axis.h"
#include "audio_region_view.h"
#include "midi_region_view.h"
#include "midi_view.h"
#include "marker.h"
#include "streamview.h"
#include "region_gain_line.h"
@ -2356,9 +2357,9 @@ Editor::edit_control_point (ArdourCanvas::Item* item)
}
void
Editor::edit_notes (MidiRegionView* mrv)
Editor::edit_notes (MidiView* mrv)
{
MidiRegionView::Selection const & s = mrv->selection();
MidiView::Selection const & s = mrv->selection();
if (s.empty ()) {
return;

View File

@ -29,7 +29,7 @@
using namespace ARDOUR;
using namespace ArdourCanvas;
Hit::Hit (MidiRegionView& region, Item* parent, double size, const std::shared_ptr<NoteType> note, bool with_events)
Hit::Hit (MidiView& region, Item* parent, double size, const std::shared_ptr<NoteType> note, bool with_events)
: NoteBase (region, with_events, note)
{
_polygon = new ArdourCanvas::Polygon (parent);

View File

@ -32,7 +32,7 @@ class Hit : public NoteBase
public:
typedef Evoral::Note<Temporal::Beats> NoteType;
Hit (MidiRegionView& region,
Hit (MidiView& region,
ArdourCanvas::Item* parent,
double size,
const std::shared_ptr<NoteType> note = std::shared_ptr<NoteType>(),

View File

@ -168,3 +168,9 @@ MidiCueEditor::apply_midi_note_edit_op_to_region (ARDOUR::MidiOperator& op, Midi
return nullptr;
}
bool
MidiCueEditor::canvas_note_event (GdkEvent* event, ArdourCanvas::Item*)
{
return false;
}

View File

@ -110,11 +110,11 @@ MidiStreamView::create_region_view (std::shared_ptr<Region> r, bool /*wfd*/, boo
if (recording) {
region_view = new MidiRegionView (
_region_group, _trackview.editor(), _trackview, region,
_samples_per_pixel, region_color, recording,
_samples_per_pixel, MidiViewBackground::region_color(), recording,
TimeAxisViewItem::Visibility(TimeAxisViewItem::ShowFrame));
} else {
region_view = new MidiRegionView (_region_group, _trackview.editor(), _trackview, region,
_samples_per_pixel, region_color);
_samples_per_pixel, MidiViewBackground::region_color());
}
region_view->init (false);
@ -494,3 +494,20 @@ MidiStreamView::get_regions_with_selected_data (RegionSelection& rs)
}
}
void
MidiStreamView::set_note_highlight (bool yn)
{
dynamic_cast<MidiTimeAxisView*> (&_trackview)->set_note_highlight (yn);
}
uint8_t
MidiStreamView::get_preferred_midi_channel () const
{
return dynamic_cast<MidiTimeAxisView*> (&_trackview)->get_preferred_midi_channel();
}
void
MidiStreamView::record_layer_check (std::shared_ptr<ARDOUR::Region> r, samplepos_t t)
{
check_record_layers (r, t);
}

View File

@ -85,6 +85,9 @@ public:
ArdourCanvas::Container* region_canvas () const { return _region_group; }
void parameter_changed (std::string const &);
uint8_t get_preferred_midi_channel () const;
void record_layer_check (std::shared_ptr<ARDOUR::Region>, samplepos_t);
void set_note_highlight (bool);
protected:
void setup_rec_box ();

File diff suppressed because it is too large Load Diff

View File

@ -29,9 +29,14 @@
#include <vector>
#include <stdint.h>
#include <boost/unordered_map.hpp>
#include <sigc++/signal.h>
#include "pbd/signals.h"
#include "ardour/midi_model.h"
#include "ardour/slice.h"
#include "ardour/types.h"
#include "editing.h"
@ -44,6 +49,7 @@
namespace ARDOUR {
class MidiRegion;
class MidiModel;
class MidiTrack;
class Filter;
};
@ -69,15 +75,16 @@ class ItemCounts;
class CursorContext;
class VelocityGhostRegion;
class EditingContext;
class PasteContext;
class MidiView
class MidiView : public virtual sigc::trackable
{
public:
typedef Evoral::Note<Temporal::Beats> NoteType;
typedef Evoral::Sequence<Temporal::Beats>::Notes Notes;
MidiView (std::shared_ptr<ARDOUR::MidiTrack> mt,
ArdourCanvas::Container* parent,
ArdourCanvas::Container& parent,
EditingContext& ec,
MidiViewBackground& bg,
uint32_t basic_color);
@ -85,11 +92,12 @@ class MidiView
virtual ~MidiView ();
void init (bool wfd);
virtual bool display_enabled() const { return true; }
void step_add_note (uint8_t channel, uint8_t number, uint8_t velocity,
Temporal::Beats pos, Temporal::Beats len);
void step_sustain (Temporal::Beats beats);
void set_height (double);
virtual void set_height (double);
void apply_note_range(uint8_t lowest, uint8_t highest, bool force=false);
// inline ARDOUR::ColorMode color_mode() const { return _background->color_mode(); }
@ -102,9 +110,11 @@ class MidiView
void hide_step_edit_cursor ();
void set_step_edit_cursor_width (Temporal::Beats beats);
virtual GhostRegion* add_ghost (TimeAxisView&) {}
virtual GhostRegion* add_ghost (TimeAxisView&) { return nullptr; }
virtual std::string get_modifier_name() const;
void set_model (std::shared_ptr<ARDOUR::MidiModel>);
NoteBase* add_note(const std::shared_ptr<NoteType> note, bool visible);
void cut_copy_clear (Editing::CutCopyOp);
@ -310,22 +320,25 @@ class MidiView
*/
void clear_selection ();
ARDOUR::InstrumentInfo& instrument_info() const;
void note_deleted (NoteBase*);
void clear_note_selection ();
void show_verbose_cursor_for_new_note_value(std::shared_ptr<NoteType> current_note, uint8_t new_note) const;
std::shared_ptr<ARDOUR::MidiRegion> midi_region() const { return _region; }
EditingContext& editing_context() const { return _editing_context; }
MidiViewBackground& midi_context() const { return _midi_context; }
virtual ARDOUR::Slice const & current_slice() const { return _current_slice; }
protected:
void init ();
void region_resized (const PBD::PropertyChange&);
void set_flags (XMLNode *);
void store_flags ();
void reset_width_dependent_items (double pixel_width);
virtual void reset_width_dependent_items (double pixel_width);
void parameter_changed (std::string const & p);
void _redisplay (bool view_only);
protected:
@ -406,6 +419,12 @@ class MidiView
void clear_selection_internal ();
void clear_events ();
virtual void clear_ghost_events() {}
virtual void ghosts_model_changed() {}
virtual void ghosts_view_changed() {}
virtual void ghost_remove_note (NoteBase*) {}
virtual void ghost_add_note (NoteBase*) {}
virtual void ghost_sync_selection (NoteBase*) {}
bool canvas_group_event(GdkEvent* ev);
bool note_canvas_event(GdkEvent* ev);
@ -443,9 +462,11 @@ class MidiView
typedef std::vector<NoteBase*> CopyDragEvents;
std::shared_ptr<ARDOUR::MidiTrack> _midi_track;
EditingContext& editing_context;
EditingContext& _editing_context;
MidiViewBackground& _midi_context;
std::shared_ptr<ARDOUR::MidiModel> _model;
MidiViewBackground& _background;
std::shared_ptr<ARDOUR::MidiRegion> _region;
ARDOUR::Slice _current_slice;
Events _events;
CopyDragEvents _copy_drag_events;
PatchChanges _patch_changes;
@ -461,6 +482,9 @@ class MidiView
Temporal::Beats _step_edit_cursor_position;
NoteBase* _channel_selection_scoped_note;
uint8_t _current_range_min;
uint8_t _current_range_max;
MouseState _mouse_state;
int _pressed_button;
@ -508,14 +532,14 @@ class MidiView
void snap_changed ();
PBD::ScopedConnection snap_changed_connection;
bool motion (GdkEventMotion*);
bool scroll (GdkEventScroll*);
bool key_press (GdkEventKey*);
bool key_release (GdkEventKey*);
bool button_press (GdkEventButton*);
bool button_release (GdkEventButton*);
bool enter_notify (GdkEventCrossing*);
bool leave_notify (GdkEventCrossing*);
virtual bool motion (GdkEventMotion*);
virtual bool scroll (GdkEventScroll*);
virtual bool key_press (GdkEventKey*);
virtual bool key_release (GdkEventKey*);
virtual bool button_press (GdkEventButton*);
virtual bool button_release (GdkEventButton*);
virtual bool enter_notify (GdkEventCrossing*);
virtual bool leave_notify (GdkEventCrossing*);
void drop_down_keys ();
void maybe_select_by_position (GdkEventButton* ev, double x, double y);
@ -533,8 +557,8 @@ class MidiView
void remove_ghost_note ();
void mouse_mode_changed ();
void enter_internal (uint32_t state);
void leave_internal ();
virtual void enter_internal (uint32_t state);
virtual void leave_internal ();
void hide_verbose_cursor ();
samplecnt_t _last_display_zoom;
@ -557,7 +581,9 @@ class MidiView
ARDOUR::ChannelMode get_channel_mode() const;
uint16_t get_selected_channels () const;
inline double contents_height() const { return _height - 2; }
virtual double height() const = 0;
virtual double contents_height() const { return height() - 2; }
inline double contents_note_range () const { return (double)(_current_range_max - _current_range_min + 1); }
inline double note_height() const { return contents_height() / contents_note_range(); }

View File

@ -40,6 +40,8 @@ MidiViewBackground::MidiViewBackground (ArdourCanvas::Item* parent)
, _data_note_min (60)
, _data_note_max (71)
, _note_lines (new ArdourCanvas::LineSet (parent, ArdourCanvas::LineSet::Horizontal))
, _note_mode (ARDOUR::Sustained)
, _color_mode (ARDOUR::MeterColors)
{
_note_lines->lower_to_bottom();

View File

@ -27,13 +27,13 @@
#include <gtkmm/adjustment.h>
#include "ardour/types.h"
namespace ArdourCanvas {
class Item;
class LineSet;
class Item;
class LineSet;
}
class MidiViewBackground
{
public:
@ -47,6 +47,14 @@ class MidiViewBackground
ContentsRange
};
ARDOUR::NoteMode note_mode() const { return _note_mode; }
void set_note_mode (ARDOUR::NoteMode nm);
ARDOUR::ColorMode color_mode() const { return _color_mode; }
void set_color_mode (ARDOUR::ColorMode);
Gtkmm2ext::Color region_color() const { return _region_color; }
void set_note_range (VisibleNoteRange r);
inline uint8_t lowest_note() const { return _lowest_note; }
@ -73,6 +81,13 @@ class MidiViewBackground
sigc::signal<void> NoteRangeChanged;
void apply_note_range (uint8_t lowest, uint8_t highest, bool to_children);
/** @return y position, or -1 if hidden */
virtual double y_position () const { return 0.; }
virtual uint8_t get_preferred_midi_channel () const = 0;
virtual void set_note_highlight (bool) = 0;
virtual void record_layer_check (std::shared_ptr<ARDOUR::Region>, samplepos_t) = 0;
protected:
bool _range_dirty;
double _range_sum_cache;
@ -81,6 +96,9 @@ class MidiViewBackground
uint8_t _data_note_min; ///< in data
uint8_t _data_note_max; ///< in data
ArdourCanvas::LineSet* _note_lines;
ARDOUR::NoteMode _note_mode;
Gtkmm2ext::Color _region_color;
ARDOUR::ColorMode _color_mode;
void color_handler ();
void parameter_changed (std::string const &);

View File

@ -29,8 +29,7 @@ using namespace ARDOUR;
using ArdourCanvas::Coord;
using ArdourCanvas::Duple;
Note::Note (
MidiRegionView& region, ArdourCanvas::Item* parent, const std::shared_ptr<NoteType> note, bool with_events)
Note::Note (MidiView& region, ArdourCanvas::Item* parent, const std::shared_ptr<NoteType> note, bool with_events)
: NoteBase (region, with_events, note)
, _visual_note (new ArdourCanvas::Note (parent))
{

View File

@ -33,7 +33,7 @@ class Note : public NoteBase
public:
typedef Evoral::Note<Temporal::Beats> NoteType;
Note (MidiRegionView& region,
Note (MidiView& region,
ArdourCanvas::Item* parent,
const std::shared_ptr<NoteType> note = std::shared_ptr<NoteType>(),
bool with_events = true);

View File

@ -28,10 +28,10 @@
#include "canvas/text.h"
#include "note_base.h"
#include "public_editor.h"
#include "editing_context.h"
#include "editing_syms.h"
#include "keyboard.h"
#include "midi_region_view.h"
#include "midi_view.h"
using namespace std;
using namespace Gtkmm2ext;
@ -61,7 +61,7 @@ NoteBase::set_colors ()
color_modifier = UIConfiguration::instance().modifier ("midi note");
}
NoteBase::NoteBase(MidiRegionView& region, bool with_events, const std::shared_ptr<NoteType> note)
NoteBase::NoteBase(MidiView& region, bool with_events, const std::shared_ptr<NoteType> note)
: _region(region)
, _item (0)
, _text(0)
@ -183,7 +183,7 @@ NoteBase::set_selected(bool selected)
uint32_t
NoteBase::base_color ()
{
return base_color (_note->velocity(), _region.color_mode(), _region.midi_stream_view()->get_region_color(), _note->channel(), selected());
return base_color (_note->velocity(), _region.midi_context().color_mode(), _region.midi_context().region_color(), _note->channel(), selected());
}
uint32_t
@ -288,7 +288,7 @@ NoteBase::set_mouse_fractions (GdkEvent* ev)
bool
NoteBase::event_handler (GdkEvent* ev)
{
PublicEditor& editor = _region.get_time_axis_view().editor();
EditingContext& editor = _region.editing_context();
if (!editor.internal_editing()) {
return false;
}

View File

@ -33,7 +33,7 @@
#include "ui_config.h"
class Editor;
class MidiRegionView;
class MidiView;
namespace Evoral {
template<typename T> class Note;
@ -67,7 +67,7 @@ class NoteBase : public sigc::trackable
public:
typedef Evoral::Note<Temporal::Beats> NoteType;
NoteBase (MidiRegionView& region, bool, const std::shared_ptr<NoteType> note = std::shared_ptr<NoteType>());
NoteBase (MidiView& region, bool, const std::shared_ptr<NoteType> note = std::shared_ptr<NoteType>());
virtual ~NoteBase ();
void set_item (ArdourCanvas::Item *);
@ -115,7 +115,7 @@ class NoteBase : public sigc::trackable
float mouse_y_fraction() const { return _mouse_y_fraction; }
const std::shared_ptr<NoteType> note() const { return _note; }
MidiRegionView& region_view() const { return _region; }
MidiView& region_view() const { return _region; }
static void set_colors ();
@ -139,7 +139,7 @@ class NoteBase : public sigc::trackable
protected:
enum State { None, Pressed, Dragging };
MidiRegionView& _region;
MidiView& _region;
ArdourCanvas::Item* _item;
ArdourCanvas::Text* _text;
State _state;

View File

@ -34,7 +34,7 @@
#include "editor.h"
#include "editor_drag.h"
#include "midi_region_view.h"
#include "midi_view.h"
#include "patch_change.h"
#include "ui_config.h"
@ -44,8 +44,8 @@ using Gtkmm2ext::Keyboard;
/** @param x x position in pixels.
*/
PatchChange::PatchChange (MidiRegionView& region,
ArdourCanvas::Container* parent,
PatchChange::PatchChange (MidiView& region,
ArdourCanvas::Item* parent,
double height,
double x,
double y,
@ -153,15 +153,15 @@ bool
PatchChange::event_handler (GdkEvent* ev)
{
/* XXX: icky dcast */
Editor* e = dynamic_cast<Editor*> (&_region.get_time_axis_view ().editor ());
EditingContext& e = _region.editing_context();
if (!e->internal_editing ()) {
if (!e.internal_editing ()) {
return false;
}
switch (ev->type) {
case GDK_BUTTON_PRESS:
if (e->current_mouse_mode () == Editing::MouseContent) {
if (e.current_mouse_mode () == Editing::MouseContent) {
if (Gtkmm2ext::Keyboard::is_delete_event (&ev->button)) {
_region.delete_patch_change (this);
return true;
@ -171,7 +171,7 @@ PatchChange::event_handler (GdkEvent* ev)
return true;
} else if (ev->button.button == 1) {
e->drags ()->set (new PatchChangeDrag (*e, this, &_region), ev);
e.drags ()->set (new PatchChangeDrag (e, this, &_region), ev);
return true;
}
}

View File

@ -34,8 +34,8 @@ namespace MIDI {
class PatchChange
{
public:
PatchChange (MidiRegionView& region,
ArdourCanvas::Container* parent,
PatchChange (MidiView& region,
ArdourCanvas::Item* parent,
double height,
double x,
double y,
@ -65,7 +65,7 @@ public:
private:
bool event_handler (GdkEvent*);
MidiRegionView& _region;
MidiView& _region;
ARDOUR::InstrumentInfo& _info;
ARDOUR::MidiModel::PatchChangePtr _patch;
Gtk::Menu _popup;

View File

@ -96,6 +96,7 @@ class MeterMarker;
class MixerStrip;
class MouseCursors;
class RegionView;
class MidiView;
class RouteTimeAxisView;
class Selection;
class SimpleExport;
@ -321,7 +322,7 @@ public:
virtual void add_to_idle_resize (TimeAxisView*, int32_t) = 0;
virtual Temporal::timecnt_t get_paste_offset (Temporal::timepos_t const & pos, unsigned paste_count, Temporal::timecnt_t const & duration) = 0;
virtual void edit_notes (MidiRegionView*) = 0;
virtual void edit_notes (MidiView*) = 0;
virtual void queue_visual_videotimeline_update () = 0;
virtual void set_close_video_sensitive (bool) = 0;
@ -397,8 +398,6 @@ public:
virtual bool canvas_bbt_marker_event (GdkEvent* event, ArdourCanvas::Item*, BBTMarker*) = 0;
virtual bool canvas_automation_track_event(GdkEvent* event, ArdourCanvas::Item*, AutomationTimeAxisView*) = 0;
virtual bool canvas_note_event (GdkEvent* event, ArdourCanvas::Item*) = 0;
static const int window_border_width;
static const int container_border_width;
static const int vertical_spacing;