mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
heavy-handed and crude way to stop WM-stolen-alt keys from causing MidiRegionView from losing track of SelectTouchDraggingMode (may not be optimal or in the right place, but it works for now); add primary-click-on-MRV-blank-space and tertiary-click-on-MRV-blank-space to select all notes above or below the click, using recently committed methods for Sequence
git-svn-id: svn://localhost/ardour2/branches/3.0@7192 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
parent
60ec5dd339
commit
a04b1fee6a
6 changed files with 73 additions and 2 deletions
|
|
@ -750,6 +750,7 @@ Editor::stop_canvas_autoscroll ()
|
|||
bool
|
||||
Editor::left_track_canvas (GdkEventCrossing */*ev*/)
|
||||
{
|
||||
DropDownKeys ();
|
||||
set_entered_track (0);
|
||||
set_entered_regionview (0);
|
||||
reset_canvas_action_sensitivity (false);
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
|||
, no_sound_notes (false)
|
||||
{
|
||||
_note_group->raise_to_top();
|
||||
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
||||
}
|
||||
|
||||
MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &tv,
|
||||
|
|
@ -119,9 +120,9 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
|||
, no_sound_notes (false)
|
||||
{
|
||||
_note_group->raise_to_top();
|
||||
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
||||
}
|
||||
|
||||
|
||||
MidiRegionView::MidiRegionView (const MidiRegionView& other)
|
||||
: sigc::trackable(other)
|
||||
, RegionView (other)
|
||||
|
|
@ -182,6 +183,8 @@ MidiRegionView::MidiRegionView (const MidiRegionView& other, boost::shared_ptr<M
|
|||
void
|
||||
MidiRegionView::init (Gdk::Color const & basic_color, bool wfd)
|
||||
{
|
||||
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
||||
|
||||
CanvasNoteEvent::CanvasNoteEventDeleted.connect (note_delete_connection, MISSING_INVALIDATOR,
|
||||
ui_bind (&MidiRegionView::maybe_remove_deleted_note_from_selection, this, _1),
|
||||
gui_context());
|
||||
|
|
@ -338,7 +341,9 @@ MidiRegionView::button_release (GdkEventButton* ev)
|
|||
case MouseObject:
|
||||
case MouseTimeFX:
|
||||
clear_selection();
|
||||
maybe_select_by_position (ev, event_x, event_y);
|
||||
break;
|
||||
|
||||
case MouseRange:
|
||||
{
|
||||
bool success;
|
||||
|
|
@ -882,6 +887,20 @@ MidiRegionView::find_canvas_note (boost::shared_ptr<NoteType> note)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::get_events (Events& e, Evoral::Sequence<Evoral::MusicalTime>::NoteOperator op, uint8_t val, int chan_mask)
|
||||
{
|
||||
MidiModel::Notes notes;
|
||||
_model->get_notes (notes, op, val, chan_mask);
|
||||
|
||||
for (MidiModel::Notes::iterator n = notes.begin(); n != notes.end(); ++n) {
|
||||
CanvasNoteEvent* cne = find_canvas_note (*n);
|
||||
if (cne) {
|
||||
e.push_back (cne);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::redisplay_model()
|
||||
{
|
||||
|
|
@ -1716,7 +1735,7 @@ MidiRegionView::select_matching_notes (uint8_t notenum, uint16_t channel_mask, b
|
|||
CanvasNoteEvent* cne;
|
||||
bool select = false;
|
||||
|
||||
if (((0x0001 << note->channel()) & channel_mask) != 0) {
|
||||
if (((1 << note->channel()) & channel_mask) != 0) {
|
||||
if (extend) {
|
||||
if ((note->note() >= low_note && note->note() <= high_note)) {
|
||||
select = true;
|
||||
|
|
@ -2848,3 +2867,44 @@ MidiRegionView::show_verbose_canvas_cursor (boost::shared_ptr<NoteType> n) const
|
|||
snprintf (buf, sizeof (buf), "%s (%d)", Evoral::midi_note_name (n->note()).c_str(), (int) n->note ());
|
||||
trackview.editor().show_verbose_canvas_cursor_with (buf);
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::drop_down_keys ()
|
||||
{
|
||||
_mouse_state = None;
|
||||
}
|
||||
|
||||
void
|
||||
MidiRegionView::maybe_select_by_position (GdkEventButton* ev, double x, double y)
|
||||
{
|
||||
double note = midi_stream_view()->y_to_note(y);
|
||||
Events e;
|
||||
MidiTimeAxisView* const mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
|
||||
|
||||
uint16_t chn_mask = mtv->channel_selector().get_selected_channels();
|
||||
|
||||
if (Keyboard::modifier_state_equals (ev->state, Keyboard::TertiaryModifier)) {
|
||||
get_events (e, Evoral::Sequence<Evoral::MusicalTime>::PitchGreaterThanOrEqual, (uint8_t) floor (note), chn_mask);
|
||||
} else if (Keyboard::modifier_state_equals (ev->state, Keyboard::PrimaryModifier)) {
|
||||
get_events (e, Evoral::Sequence<Evoral::MusicalTime>::PitchLessThanOrEqual, (uint8_t) floor (note), chn_mask);
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
bool add_mrv_selection = false;
|
||||
|
||||
if (_selection.empty()) {
|
||||
add_mrv_selection = true;
|
||||
}
|
||||
|
||||
for (Events::iterator i = e.begin(); i != e.end(); ++i) {
|
||||
if (_selection.insert (*i).second) {
|
||||
(*i)->selected (true);
|
||||
}
|
||||
}
|
||||
|
||||
if (add_mrv_selection) {
|
||||
PublicEditor& editor (trackview.editor());
|
||||
editor.get_selection().add (this);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -430,6 +430,10 @@ class MidiRegionView : public RegionView
|
|||
bool button_release (GdkEventButton*);
|
||||
bool enter_notify (GdkEventCrossing*);
|
||||
bool leave_notify (GdkEventCrossing*);
|
||||
|
||||
void drop_down_keys ();
|
||||
void maybe_select_by_position (GdkEventButton* ev, double x, double y);
|
||||
void get_events (Events& e, Evoral::Sequence<Evoral::MusicalTime>::NoteOperator op, uint8_t val, int chan_mask = 0);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -91,6 +91,8 @@ class MidiTimeAxisView : public RouteTimeAxisView
|
|||
void check_step_edit ();
|
||||
void step_edit_rest ();
|
||||
|
||||
const MidiMultipleChannelSelector& channel_selector() { return _channel_selector; }
|
||||
|
||||
private:
|
||||
sigc::signal<void, std::string, std::string> _midi_patch_settings_changed;
|
||||
|
||||
|
|
|
|||
|
|
@ -27,6 +27,8 @@ const int PublicEditor::container_border_width = 12;
|
|||
const int PublicEditor::vertical_spacing = 6;
|
||||
const int PublicEditor::horizontal_spacing = 6;
|
||||
|
||||
sigc::signal<void> PublicEditor::DropDownKeys;
|
||||
|
||||
PublicEditor::PublicEditor ()
|
||||
: Window (Gtk::WINDOW_TOPLEVEL)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -283,6 +283,8 @@ class PublicEditor : public Gtk::Window, public PBD::StatefulDestructible {
|
|||
sigc::signal<void> Realized;
|
||||
sigc::signal<void,nframes64_t> UpdateAllTransportClocks;
|
||||
|
||||
static sigc::signal<void> DropDownKeys;
|
||||
|
||||
Glib::RefPtr<Gtk::ActionGroup> editor_actions;
|
||||
|
||||
virtual void reset_focus () = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue