get region-create drags working and no crashes (nut also no note) for note-drags
This commit is contained in:
parent
15e3c235ac
commit
4416fa698f
|
@ -297,6 +297,7 @@ Drag::Drag (EditingContext& ec, ArdourCanvas::Item* i, Temporal::TimeDomain td,
|
|||
, _constraint_pressed (false)
|
||||
, _grab_button (-1)
|
||||
{
|
||||
DEBUG_TRACE (DEBUG::Drags, "some kind of drag\n");
|
||||
}
|
||||
|
||||
Drag::~Drag ()
|
||||
|
@ -6721,16 +6722,16 @@ PatchChangeDrag::setup_pointer_offset ()
|
|||
_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)
|
||||
: RubberbandSelectDrag (ec, rv->get_canvas_group ())
|
||||
, _region_view (rv)
|
||||
MidiRubberbandSelectDrag::MidiRubberbandSelectDrag (EditingContext& ec, MidiView* mv)
|
||||
: RubberbandSelectDrag (ec, mv->drag_group ())
|
||||
, _midi_view (mv)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
MidiRubberbandSelectDrag::select_things (int button_state, timepos_t const& x1, timepos_t const& x2, double y1, double y2, bool /*drag_in_progress*/)
|
||||
{
|
||||
_region_view->update_drag_selection (
|
||||
_midi_view->update_drag_selection (
|
||||
x1, x2, y1, y2,
|
||||
Keyboard::modifier_state_contains (button_state, Keyboard::TertiaryModifier));
|
||||
}
|
||||
|
@ -6741,9 +6742,9 @@ MidiRubberbandSelectDrag::deselect_things ()
|
|||
/* XXX */
|
||||
}
|
||||
|
||||
MidiVerticalSelectDrag::MidiVerticalSelectDrag (EditingContext& ec, MidiRegionView* rv)
|
||||
: RubberbandSelectDrag (ec, rv->get_canvas_group ())
|
||||
, _region_view (rv)
|
||||
MidiVerticalSelectDrag::MidiVerticalSelectDrag (EditingContext& ec, MidiView* mv)
|
||||
: RubberbandSelectDrag (ec, mv->drag_group ())
|
||||
, _midi_view (mv)
|
||||
{
|
||||
_vertical_only = true;
|
||||
}
|
||||
|
@ -6751,12 +6752,12 @@ MidiVerticalSelectDrag::MidiVerticalSelectDrag (EditingContext& ec, MidiRegionVi
|
|||
void
|
||||
MidiVerticalSelectDrag::select_things (int button_state, timepos_t const& /*x1*/, timepos_t const& /*x2*/, double y1, double y2, bool /*drag_in_progress*/)
|
||||
{
|
||||
double const y = _region_view->midi_view ()->y_position ();
|
||||
double const y = _midi_view->midi_context().y_position ();
|
||||
|
||||
y1 = max (0.0, y1 - y);
|
||||
y2 = max (0.0, y2 - y);
|
||||
|
||||
_region_view->update_vertical_drag_selection (
|
||||
_midi_view->update_vertical_drag_selection (
|
||||
y1, y2,
|
||||
Keyboard::modifier_state_contains (button_state, Keyboard::TertiaryModifier));
|
||||
}
|
||||
|
@ -6802,9 +6803,9 @@ EditorRubberbandSelectDrag::deselect_things ()
|
|||
editing_context.commit_reversible_selection_op ();
|
||||
}
|
||||
|
||||
NoteCreateDrag::NoteCreateDrag (EditingContext& ec, ArdourCanvas::Item* i, MidiRegionView* rv)
|
||||
NoteCreateDrag::NoteCreateDrag (EditingContext& ec, ArdourCanvas::Item* i, MidiView* mv)
|
||||
: Drag (ec, i, Temporal::BeatTime)
|
||||
, _region_view (rv)
|
||||
, _midi_view (mv)
|
||||
, _drag_rect (0)
|
||||
{
|
||||
_note[0] = _note[1] = timepos_t (Temporal::BeatTime);
|
||||
|
@ -6828,11 +6829,11 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
|
|||
{
|
||||
Drag::start_grab (event, cursor);
|
||||
|
||||
_drag_rect = new ArdourCanvas::Rectangle (_region_view->get_canvas_group ());
|
||||
_drag_rect = new ArdourCanvas::Rectangle (_midi_view->drag_group ());
|
||||
|
||||
const timepos_t pos = _drags->current_pointer_time ();
|
||||
Temporal::Beats aligned_beats (round_to_grid (pos, event));
|
||||
const Temporal::Beats grid_beats (_region_view->get_draw_length_beats (pos));
|
||||
const Temporal::Beats grid_beats (_midi_view->get_draw_length_beats (pos));
|
||||
|
||||
_note[0] = timepos_t (aligned_beats);
|
||||
/* minimum initial length is grid beats */
|
||||
|
@ -6843,14 +6844,14 @@ NoteCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
|
|||
* coordinates relative to the region in order to draw it correctly.
|
||||
*/
|
||||
|
||||
const timecnt_t rrp1 (_region_view->region ()->region_relative_position (_note[0]));
|
||||
const timecnt_t rrp2 (_region_view->region ()->region_relative_position (_note[1]));
|
||||
const timecnt_t rrp1 (_midi_view->midi_region ()->region_relative_position (_note[0]));
|
||||
const timecnt_t rrp2 (_midi_view->midi_region ()->region_relative_position (_note[1]));
|
||||
|
||||
double const x0 = editing_context.sample_to_pixel (rrp1.samples ());
|
||||
double const x1 = editing_context.sample_to_pixel (rrp2.samples ());
|
||||
double const y = _region_view->note_to_y (_region_view->y_to_note (y_to_region (event->button.y)));
|
||||
double const y = _midi_view->note_to_y (_midi_view->y_to_note (y_to_region (event->button.y)));
|
||||
|
||||
_drag_rect->set (ArdourCanvas::Rect (x0, y, x1, y + floor (_region_view->midi_stream_view ()->note_height ())));
|
||||
_drag_rect->set (ArdourCanvas::Rect (x0, y, x1, y + floor (_midi_view->midi_context ().note_height ())));
|
||||
_drag_rect->set_outline_all ();
|
||||
_drag_rect->set_outline_color (0xffffff99);
|
||||
_drag_rect->set_fill_color (0xffffff66);
|
||||
|
@ -6862,13 +6863,13 @@ NoteCreateDrag::motion (GdkEvent* event, bool)
|
|||
const timepos_t pos = _drags->current_pointer_time ();
|
||||
|
||||
/* when the user clicks and starts a drag to define the note's length, require notes to be at least |this| long */
|
||||
const Temporal::Beats min_length (_region_view->get_draw_length_beats (pos));
|
||||
const Temporal::Beats min_length (_midi_view->get_draw_length_beats (pos));
|
||||
Temporal::Beats aligned_beats = round_to_grid (pos, event);
|
||||
|
||||
_note[1] = std::max (aligned_beats, (_note[0].beats () + min_length));
|
||||
|
||||
const timecnt_t rrp1 (_region_view->region ()->region_relative_position (_note[0]));
|
||||
const timecnt_t rrp2 (_region_view->region ()->region_relative_position (_note[1]));
|
||||
const timecnt_t rrp1 (_midi_view->midi_region ()->region_relative_position (_note[0]));
|
||||
const timecnt_t rrp2 (_midi_view->midi_region ()->region_relative_position (_note[1]));
|
||||
|
||||
double const x0 = editing_context.sample_to_pixel (rrp1.samples ());
|
||||
double const x1 = editing_context.sample_to_pixel (rrp2.samples ());
|
||||
|
@ -6883,21 +6884,21 @@ NoteCreateDrag::finished (GdkEvent* ev, bool had_movement)
|
|||
|
||||
/* Compute start within region, rather than absolute time start */
|
||||
|
||||
Beats const start = _region_view->region ()->absolute_time_to_region_beats (min (_note[0], _note[1]));
|
||||
Beats const start = _midi_view->midi_region ()->absolute_time_to_region_beats (min (_note[0], _note[1]));
|
||||
Beats length = max (Beats (0, 1), (_note[0].distance (_note[1]).abs ().beats ()));
|
||||
|
||||
/* create_note_at() implements UNDO for us */
|
||||
if (UIConfiguration::instance().get_select_last_drawn_note_only()) {
|
||||
_region_view->clear_note_selection ();
|
||||
_midi_view->clear_note_selection ();
|
||||
}
|
||||
_region_view->create_note_at (timepos_t (start), _drag_rect->y0 (), length, ev->button.state, false);
|
||||
_midi_view->create_note_at (timepos_t (start), _drag_rect->y0 (), length, ev->button.state, false);
|
||||
}
|
||||
|
||||
double
|
||||
NoteCreateDrag::y_to_region (double y) const
|
||||
{
|
||||
double x = 0;
|
||||
_region_view->get_canvas_group ()->canvas_to_item (x, y);
|
||||
_midi_view->drag_group ()->canvas_to_item (x, y);
|
||||
return y;
|
||||
}
|
||||
|
||||
|
@ -6906,9 +6907,9 @@ NoteCreateDrag::aborted (bool)
|
|||
{
|
||||
}
|
||||
|
||||
HitCreateDrag::HitCreateDrag (EditingContext& ec, ArdourCanvas::Item* i, MidiRegionView* rv)
|
||||
HitCreateDrag::HitCreateDrag (EditingContext& ec, ArdourCanvas::Item* i, MidiView* mv)
|
||||
: Drag (ec, i, Temporal::BeatTime)
|
||||
, _region_view (rv)
|
||||
, _midi_view (mv)
|
||||
, _last_pos (Temporal::Beats ())
|
||||
, _y (0.0)
|
||||
{
|
||||
|
@ -6923,7 +6924,7 @@ HitCreateDrag::start_grab (GdkEvent* event, Gdk::Cursor* cursor)
|
|||
{
|
||||
Drag::start_grab (event, cursor);
|
||||
|
||||
_y = _region_view->note_to_y (_region_view->y_to_note (y_to_region (event->button.y)));
|
||||
_y = _midi_view->note_to_y (_midi_view->y_to_note (y_to_region (event->button.y)));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -6933,26 +6934,26 @@ HitCreateDrag::finished (GdkEvent* event, bool had_movement)
|
|||
return;
|
||||
}
|
||||
|
||||
std::shared_ptr<MidiRegion> mr = _region_view->midi_region ();
|
||||
std::shared_ptr<MidiRegion> mr = _midi_view->midi_region ();
|
||||
|
||||
timepos_t pos (_drags->current_pointer_time ());
|
||||
editing_context.snap_to (pos, RoundNearest, SnapToGrid_Scaled);
|
||||
Temporal::Beats aligned_beats (pos.beats ());
|
||||
|
||||
Beats const start = _region_view->region ()->absolute_time_to_region_beats (timepos_t (aligned_beats));
|
||||
Beats const start = _midi_view->midi_region ()->absolute_time_to_region_beats (timepos_t (aligned_beats));
|
||||
|
||||
/* Percussive hits are as short as possible */
|
||||
Beats length (0, 1);
|
||||
|
||||
/* create_note_at() implements UNDO for us */
|
||||
_region_view->create_note_at (timepos_t (start), _y, length, event->button.state, false);
|
||||
_midi_view->create_note_at (timepos_t (start), _y, length, event->button.state, false);
|
||||
}
|
||||
|
||||
double
|
||||
HitCreateDrag::y_to_region (double y) const
|
||||
{
|
||||
double x = 0;
|
||||
_region_view->get_canvas_group ()->canvas_to_item (x, y);
|
||||
_midi_view->drag_group ()->canvas_to_item (x, y);
|
||||
return y;
|
||||
}
|
||||
|
||||
|
|
|
@ -657,7 +657,7 @@ private:
|
|||
class NoteCreateDrag : public Drag
|
||||
{
|
||||
public:
|
||||
NoteCreateDrag (EditingContext&, ArdourCanvas::Item *, MidiRegionView *);
|
||||
NoteCreateDrag (EditingContext&, ArdourCanvas::Item *, MidiView *);
|
||||
~NoteCreateDrag ();
|
||||
|
||||
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
|
||||
|
@ -686,7 +686,7 @@ private:
|
|||
return std::make_pair (Temporal::timecnt_t (0, Temporal::AudioTime), 0);
|
||||
}
|
||||
|
||||
MidiRegionView* _region_view;
|
||||
MidiView* _midi_view;
|
||||
ArdourCanvas::Rectangle* _drag_rect;
|
||||
Temporal::timepos_t _note[2];
|
||||
};
|
||||
|
@ -694,7 +694,7 @@ private:
|
|||
class HitCreateDrag : public Drag
|
||||
{
|
||||
public:
|
||||
HitCreateDrag (EditingContext&, ArdourCanvas::Item *, MidiRegionView *);
|
||||
HitCreateDrag (EditingContext&, ArdourCanvas::Item *, MidiView *);
|
||||
~HitCreateDrag ();
|
||||
|
||||
void start_grab (GdkEvent *, Gdk::Cursor* c = 0);
|
||||
|
@ -718,7 +718,7 @@ private:
|
|||
return std::make_pair (Temporal::timecnt_t::zero (Temporal::AudioTime), 0);
|
||||
}
|
||||
|
||||
MidiRegionView* _region_view;
|
||||
MidiView* _midi_view;
|
||||
Temporal::timepos_t _last_pos;
|
||||
double _y;
|
||||
|
||||
|
@ -1326,26 +1326,26 @@ public:
|
|||
class MidiRubberbandSelectDrag : public RubberbandSelectDrag
|
||||
{
|
||||
public:
|
||||
MidiRubberbandSelectDrag (EditingContext&, MidiRegionView *);
|
||||
MidiRubberbandSelectDrag (EditingContext&, MidiView *);
|
||||
|
||||
void select_things (int, Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, bool);
|
||||
void deselect_things ();
|
||||
|
||||
private:
|
||||
MidiRegionView* _region_view;
|
||||
MidiView* _midi_view;
|
||||
};
|
||||
|
||||
/** A RubberbandSelectDrag for selecting MIDI notes but with no horizontal component */
|
||||
class MidiVerticalSelectDrag : public RubberbandSelectDrag
|
||||
{
|
||||
public:
|
||||
MidiVerticalSelectDrag (EditingContext&, MidiRegionView *);
|
||||
MidiVerticalSelectDrag (EditingContext&, MidiView *);
|
||||
|
||||
void select_things (int, Temporal::timepos_t const &, Temporal::timepos_t const &, double, double, bool);
|
||||
void deselect_things ();
|
||||
|
||||
private:
|
||||
MidiRegionView* _region_view;
|
||||
MidiView* _midi_view;
|
||||
};
|
||||
|
||||
/** Region drag in time-FX mode */
|
||||
|
|
|
@ -128,6 +128,46 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Container* parent,
|
|||
connect_to_diskstream ();
|
||||
}
|
||||
|
||||
MidiRegionView::MidiRegionView (const MidiRegionView& other)
|
||||
: sigc::trackable(other)
|
||||
, RegionView (other)
|
||||
, MidiView (other)
|
||||
{
|
||||
init (false);
|
||||
}
|
||||
|
||||
MidiRegionView::MidiRegionView (const MidiRegionView& other, std::shared_ptr<MidiRegion> region)
|
||||
: RegionView (other, std::shared_ptr<Region> (region))
|
||||
, MidiView (other)
|
||||
{
|
||||
init (true);
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::init (bool /*wfd*/)
|
||||
{
|
||||
DisplaySuspender ds (*this, true);
|
||||
|
||||
RegionView::init (false);
|
||||
|
||||
set_region (std::dynamic_pointer_cast<MidiRegion> (_region));
|
||||
|
||||
//set_height (trackview.current_height());
|
||||
|
||||
region_muted ();
|
||||
region_sync_changed ();
|
||||
region_resized (ARDOUR::bounds_change);
|
||||
//region_locked ();
|
||||
|
||||
set_colors ();
|
||||
reset_width_dependent_items (_pixel_width);
|
||||
|
||||
_note_group->parent()->raise_to_top();
|
||||
|
||||
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&MidiRegionView::parameter_changed, this, _1), gui_context());
|
||||
connect_to_diskstream ();
|
||||
}
|
||||
|
||||
bool
|
||||
MidiRegionView::display_is_enabled () const
|
||||
{
|
||||
|
@ -138,6 +178,7 @@ void
|
|||
MidiRegionView::parameter_changed (std::string const & p)
|
||||
{
|
||||
RegionView::parameter_changed (p);
|
||||
|
||||
if (p == "display-first-midi-bank-as-zero") {
|
||||
if (display_enabled()) {
|
||||
view_changed ();
|
||||
|
@ -156,21 +197,6 @@ MidiRegionView::color_handler ()
|
|||
MidiView::color_handler ();
|
||||
}
|
||||
|
||||
MidiRegionView::MidiRegionView (const MidiRegionView& other)
|
||||
: sigc::trackable(other)
|
||||
, RegionView (other)
|
||||
, MidiView (other)
|
||||
{
|
||||
init (false);
|
||||
}
|
||||
|
||||
MidiRegionView::MidiRegionView (const MidiRegionView& other, std::shared_ptr<MidiRegion> region)
|
||||
: RegionView (other, std::shared_ptr<Region> (region))
|
||||
, MidiView (other)
|
||||
{
|
||||
init (true);
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::region_resized (PBD::PropertyChange const & change)
|
||||
{
|
||||
|
@ -178,47 +204,6 @@ MidiRegionView::region_resized (PBD::PropertyChange const & change)
|
|||
MidiView::region_resized (change);
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::init (bool /*wfd*/)
|
||||
{
|
||||
DisplaySuspender ds (*this, true);
|
||||
|
||||
_model = midi_region()->midi_source(0)->model();
|
||||
assert (_model);
|
||||
|
||||
RegionView::init (false);
|
||||
|
||||
//set_height (trackview.current_height());
|
||||
|
||||
region_muted ();
|
||||
region_sync_changed ();
|
||||
region_resized (ARDOUR::bounds_change);
|
||||
//region_locked ();
|
||||
|
||||
set_colors ();
|
||||
reset_width_dependent_items (_pixel_width);
|
||||
|
||||
group->raise_to_top();
|
||||
|
||||
midi_view()->midi_track()->playback_filter().ChannelModeChanged.connect (_channel_mode_changed_connection, invalidator (*this),
|
||||
boost::bind (&MidiRegionView::midi_channel_mode_changed, this),
|
||||
gui_context ());
|
||||
|
||||
instrument_info().Changed.connect (_instrument_changed_connection, invalidator (*this),
|
||||
boost::bind (&MidiRegionView::instrument_settings_changed, this), gui_context());
|
||||
|
||||
_editing_context.SnapChanged.connect(snap_changed_connection, invalidator(*this),
|
||||
boost::bind (&MidiRegionView::snap_changed, this),
|
||||
gui_context());
|
||||
|
||||
_editing_context.MouseModeChanged.connect(_mouse_mode_connection, invalidator (*this),
|
||||
boost::bind (&MidiRegionView::mouse_mode_changed, this),
|
||||
gui_context ());
|
||||
|
||||
Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&MidiRegionView::parameter_changed, this, _1), gui_context());
|
||||
connect_to_diskstream ();
|
||||
}
|
||||
|
||||
InstrumentInfo&
|
||||
MidiRegionView::instrument_info () const
|
||||
{
|
||||
|
@ -306,13 +291,7 @@ MidiRegionView::canvas_group_event(GdkEvent* ev)
|
|||
return RegionView::canvas_group_event (ev);
|
||||
}
|
||||
|
||||
bool ret = MidiView::canvas_group_event (ev);
|
||||
|
||||
if (!ret) {
|
||||
ret = RegionView::canvas_group_event (ev);
|
||||
}
|
||||
|
||||
return ret;
|
||||
return MidiView::canvas_group_event (ev);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -765,3 +744,9 @@ MidiRegionView::redisplay (bool view_only)
|
|||
{
|
||||
MidiView::redisplay (view_only);
|
||||
}
|
||||
|
||||
ArdourCanvas::Item*
|
||||
MidiRegionView::drag_group () const
|
||||
{
|
||||
return get_canvas_group ();
|
||||
}
|
||||
|
|
|
@ -125,6 +125,8 @@ public:
|
|||
double height() const;
|
||||
void redisplay (bool);
|
||||
|
||||
ArdourCanvas::Item* drag_group() const;
|
||||
|
||||
protected:
|
||||
void reset_width_dependent_items (double pixel_width);
|
||||
void parameter_changed (std::string const & p);
|
||||
|
|
|
@ -106,7 +106,7 @@ using Gtkmm2ext::Keyboard;
|
|||
#define MIDI_BP_ZERO ((Config->get_first_midi_bank_is_zero())?0:1)
|
||||
|
||||
MidiView::MidiView (std::shared_ptr<MidiTrack> mt,
|
||||
ArdourCanvas::Container& parent,
|
||||
ArdourCanvas::Item& parent,
|
||||
EditingContext& ec,
|
||||
MidiViewBackground& bg,
|
||||
uint32_t basic_color)
|
||||
|
@ -141,6 +141,39 @@ MidiView::MidiView (std::shared_ptr<MidiTrack> mt,
|
|||
init ();
|
||||
}
|
||||
|
||||
|
||||
MidiView::MidiView (MidiView const & other)
|
||||
: _midi_track (other._midi_track)
|
||||
, _editing_context (other.editing_context())
|
||||
, _midi_context (other.midi_context())
|
||||
, _current_slice (other.current_slice())
|
||||
, _active_notes(0)
|
||||
, _note_group (new ArdourCanvas::Container (other._note_group->parent()))
|
||||
, _note_diff_command (0)
|
||||
, _ghost_note(0)
|
||||
, _step_edit_cursor (0)
|
||||
, _step_edit_cursor_width (1, 0)
|
||||
, _channel_selection_scoped_note (0)
|
||||
, _current_range_min(0)
|
||||
, _current_range_max(0)
|
||||
, _mouse_state(None)
|
||||
, _pressed_button(0)
|
||||
, _optimization_iterator (_events.end())
|
||||
, _list_editor (0)
|
||||
, _no_sound_notes (false)
|
||||
, _last_display_zoom (0)
|
||||
, _last_event_x (0)
|
||||
, _last_event_y (0)
|
||||
, _entered (false)
|
||||
, _entered_note (0)
|
||||
, _select_all_notes_after_add (false)
|
||||
, _mouse_changed_selection (false)
|
||||
, split_tuple (0)
|
||||
, note_splitting (false)
|
||||
{
|
||||
init ();
|
||||
}
|
||||
|
||||
void
|
||||
MidiView::init ()
|
||||
{
|
||||
|
@ -151,9 +184,18 @@ MidiView::init ()
|
|||
|
||||
_note_group->raise_to_top();
|
||||
EditingContext::DropDownKeys.connect (sigc::mem_fun (*this, &MidiView::drop_down_keys));
|
||||
}
|
||||
|
||||
// XXXX Config->ParameterChanged.connect (*this, invalidator (*this), boost::bind (&MidiView::parameter_changed, this, _1), gui_context());
|
||||
EditingContext::DropDownKeys.connect (sigc::mem_fun (*this, &MidiView::drop_down_keys));
|
||||
void
|
||||
MidiView::set_region (std::shared_ptr<MidiRegion> mr)
|
||||
{
|
||||
_midi_region = mr;
|
||||
if (!_midi_region) {
|
||||
_model.reset ();
|
||||
connections_requiring_model.drop_connections();
|
||||
return;
|
||||
}
|
||||
set_model (_midi_region->midi_source (0)->model());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -173,26 +215,29 @@ MidiView::set_model (std::shared_ptr<MidiModel> m)
|
|||
set_colors ();
|
||||
reset_width_dependent_items (_pixel_width);
|
||||
*/
|
||||
// XXX group->raise_to_top();
|
||||
|
||||
_midi_track->playback_filter().ChannelModeChanged.connect (_channel_mode_changed_connection, invalidator (*this),
|
||||
connections_requiring_model.drop_connections ();
|
||||
|
||||
_model->ContentsChanged.connect (connections_requiring_model, invalidator (*this), boost::bind (&MidiView::model_changed, this), gui_context());
|
||||
|
||||
_midi_track->playback_filter().ChannelModeChanged.connect (connections_requiring_model, invalidator (*this),
|
||||
boost::bind (&MidiView::midi_channel_mode_changed, this),
|
||||
gui_context ());
|
||||
|
||||
_midi_track->instrument_info().Changed.connect (_instrument_changed_connection, invalidator (*this),
|
||||
_midi_track->instrument_info().Changed.connect (connections_requiring_model, invalidator (*this),
|
||||
boost::bind (&MidiView::instrument_settings_changed, this), gui_context());
|
||||
|
||||
_editing_context.SnapChanged.connect(snap_changed_connection, invalidator(*this),
|
||||
_editing_context.SnapChanged.connect (connections_requiring_model, invalidator(*this),
|
||||
boost::bind (&MidiView::snap_changed, this),
|
||||
gui_context());
|
||||
|
||||
_editing_context.MouseModeChanged.connect(_mouse_mode_connection, invalidator (*this),
|
||||
_editing_context.MouseModeChanged.connect (connections_requiring_model, invalidator (*this),
|
||||
boost::bind (&MidiView::mouse_mode_changed, this),
|
||||
gui_context ());
|
||||
}
|
||||
|
||||
bool
|
||||
MidiView::canvas_group_event(GdkEvent* ev)
|
||||
MidiView::canvas_group_event (GdkEvent* ev)
|
||||
{
|
||||
//For now, move the snapped cursor aside so it doesn't bother you during internal editing
|
||||
//_editing_context.set_snapped_cursor_position(_midi_region->position());
|
||||
|
@ -343,9 +388,9 @@ MidiView::button_press (GdkEventButton* ev)
|
|||
if (m == MouseDraw || (m == MouseContent && Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier()))) {
|
||||
|
||||
if (_midi_context.note_mode() == Percussive) {
|
||||
// XXX _editing_context.drags()->set (new HitCreateDrag (_editing_context, _note_group->parent(), this), (GdkEvent *) ev);
|
||||
_editing_context.drags()->set (new HitCreateDrag (_editing_context, _note_group->parent(), this), (GdkEvent *) ev);
|
||||
} else {
|
||||
// XXX _editing_context.drags()->set (new NoteCreateDrag (_editing_context, _note_group->parent(), this), (GdkEvent *) ev);
|
||||
_editing_context.drags()->set (new NoteCreateDrag (_editing_context, _note_group->parent(), this), (GdkEvent *) ev);
|
||||
}
|
||||
|
||||
_mouse_state = AddDragging;
|
||||
|
@ -477,7 +522,7 @@ MidiView::motion (GdkEventMotion* ev)
|
|||
MouseMode m = _editing_context.current_mouse_mode();
|
||||
|
||||
if (m == MouseContent && !Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier())) {
|
||||
// XXX _editing_context.drags()->set (new MidiRubberbandSelectDrag (_editing_context, this), (GdkEvent *) ev);
|
||||
_editing_context.drags()->set (new MidiRubberbandSelectDrag (_editing_context, this), (GdkEvent *) ev);
|
||||
if (!Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
|
||||
clear_selection_internal ();
|
||||
_mouse_changed_selection = true;
|
||||
|
@ -485,7 +530,7 @@ MidiView::motion (GdkEventMotion* ev)
|
|||
_mouse_state = SelectRectDragging;
|
||||
return true;
|
||||
} else if (m == MouseRange) {
|
||||
// XXX _editing_context.drags()->set (new MidiVerticalSelectDrag (_editing_context, this), (GdkEvent *) ev);
|
||||
_editing_context.drags()->set (new MidiVerticalSelectDrag (_editing_context, this), (GdkEvent *) ev);
|
||||
_mouse_state = SelectVerticalDragging;
|
||||
return true;
|
||||
}
|
||||
|
@ -759,10 +804,7 @@ MidiView::clear_events ()
|
|||
void
|
||||
MidiView::display_model (std::shared_ptr<MidiModel> model)
|
||||
{
|
||||
_model = model;
|
||||
|
||||
content_connection.disconnect ();
|
||||
_model->ContentsChanged.connect (content_connection, invalidator (*this), boost::bind (&MidiView::model_changed, this), gui_context());
|
||||
set_model (_model);
|
||||
/* Don't signal as nobody else needs to know until selection has been altered. */
|
||||
clear_events();
|
||||
model_changed ();
|
||||
|
@ -4629,3 +4671,9 @@ MidiView::add_split_notes ()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
ArdourCanvas::Item*
|
||||
MidiView::drag_group () const
|
||||
{
|
||||
return _note_group->parent();
|
||||
}
|
||||
|
|
|
@ -84,16 +84,19 @@ class MidiView : public virtual sigc::trackable
|
|||
typedef Evoral::Sequence<Temporal::Beats>::Notes Notes;
|
||||
|
||||
MidiView (std::shared_ptr<ARDOUR::MidiTrack> mt,
|
||||
ArdourCanvas::Container& parent,
|
||||
ArdourCanvas::Item& parent,
|
||||
EditingContext& ec,
|
||||
MidiViewBackground& bg,
|
||||
uint32_t basic_color);
|
||||
MidiView (MidiView const & other);
|
||||
|
||||
virtual ~MidiView ();
|
||||
|
||||
void init (bool wfd);
|
||||
virtual bool display_is_enabled() const { return true; }
|
||||
|
||||
virtual ArdourCanvas::Item* drag_group() const;
|
||||
|
||||
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);
|
||||
|
@ -113,6 +116,7 @@ class MidiView : public virtual sigc::trackable
|
|||
virtual GhostRegion* add_ghost (TimeAxisView&) { return nullptr; }
|
||||
virtual std::string get_modifier_name() const;
|
||||
|
||||
void set_region (std::shared_ptr<ARDOUR::MidiRegion>);
|
||||
void set_model (std::shared_ptr<ARDOUR::MidiModel>);
|
||||
|
||||
NoteBase* add_note(const std::shared_ptr<NoteType> note, bool visible);
|
||||
|
@ -429,10 +433,10 @@ class MidiView : public virtual sigc::trackable
|
|||
virtual bool canvas_group_event(GdkEvent* ev);
|
||||
bool note_canvas_event(GdkEvent* ev);
|
||||
|
||||
PBD::ScopedConnectionList connections_requiring_model;
|
||||
|
||||
void midi_channel_mode_changed ();
|
||||
PBD::ScopedConnection _channel_mode_changed_connection;
|
||||
void instrument_settings_changed ();
|
||||
PBD::ScopedConnection _instrument_changed_connection;
|
||||
|
||||
void change_note_channel (NoteBase *, int8_t, bool relative=false);
|
||||
void change_note_velocity(NoteBase* ev, int8_t vel, bool relative=false);
|
||||
|
@ -507,7 +511,6 @@ class MidiView : public virtual sigc::trackable
|
|||
std::vector<NoteResizeData *> _resize_data;
|
||||
|
||||
/** connection used to connect to model's ContentChanged signal */
|
||||
PBD::ScopedConnection content_connection;
|
||||
|
||||
NoteBase* find_canvas_note (std::shared_ptr<NoteType>);
|
||||
NoteBase* find_canvas_note (Evoral::event_id_t id);
|
||||
|
@ -530,7 +533,6 @@ class MidiView : public virtual sigc::trackable
|
|||
bool _no_sound_notes;
|
||||
|
||||
void snap_changed ();
|
||||
PBD::ScopedConnection snap_changed_connection;
|
||||
|
||||
virtual bool motion (GdkEventMotion*);
|
||||
virtual bool scroll (GdkEventScroll*);
|
||||
|
@ -573,8 +575,6 @@ class MidiView : public virtual sigc::trackable
|
|||
Gtkmm2ext::Color _patch_change_outline;
|
||||
Gtkmm2ext::Color _patch_change_fill;
|
||||
|
||||
PBD::ScopedConnection _mouse_mode_connection;
|
||||
|
||||
std::shared_ptr<CursorContext> _press_cursor_ctx;
|
||||
|
||||
ARDOUR::ChannelMode get_channel_mode() const;
|
||||
|
|
|
@ -618,7 +618,7 @@ TimeAxisViewItem::get_canvas_frame()
|
|||
}
|
||||
|
||||
ArdourCanvas::Item*
|
||||
TimeAxisViewItem::get_canvas_group()
|
||||
TimeAxisViewItem::get_canvas_group() const
|
||||
{
|
||||
return group;
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ public:
|
|||
virtual uint32_t get_fill_color () const;
|
||||
|
||||
ArdourCanvas::Item* get_canvas_frame();
|
||||
ArdourCanvas::Item* get_canvas_group();
|
||||
ArdourCanvas::Item* get_canvas_group() const;
|
||||
ArdourCanvas::Item* get_name_highlight();
|
||||
|
||||
virtual void set_samples_per_pixel (double);
|
||||
|
|
Loading…
Reference in New Issue