summaryrefslogtreecommitdiff
path: root/gtk2_ardour
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2016-02-10 22:55:37 +1000
committerTim Mayberry <mojofunk@gmail.com>2016-02-11 08:17:18 +1000
commit90e35c7143b09669497370df33b8056275cede22 (patch)
treebea9746d986204d18c47373bdff27410d65fa299 /gtk2_ardour
parent2b42dc13fd60739727199f4dc9ed61e1a4a97912 (diff)
Fix bug #6762, MIDNAM note read outs don't work when dragging MIDI note
Also fixes it so the key is selected in the piano roll header
Diffstat (limited to 'gtk2_ardour')
-rw-r--r--gtk2_ardour/editor_drag.cc6
-rw-r--r--gtk2_ardour/midi_region_view.cc32
-rw-r--r--gtk2_ardour/midi_region_view.h5
3 files changed, 30 insertions, 13 deletions
diff --git a/gtk2_ardour/editor_drag.cc b/gtk2_ardour/editor_drag.cc
index 0aac54ebc0..21cd043304 100644
--- a/gtk2_ardour/editor_drag.cc
+++ b/gtk2_ardour/editor_drag.cc
@@ -5506,13 +5506,9 @@ NoteDrag::motion (GdkEvent * event, bool)
* odd with them. so show the note value anyway, always.
*/
- char buf[12];
uint8_t new_note = min (max (_primary->note()->note() + note_delta, 0), 127);
- snprintf (buf, sizeof (buf), "%s (%d)", Evoral::midi_note_name (new_note).c_str(),
- (int) floor ((double)new_note));
-
- show_verbose_cursor_text (buf);
+ _region->show_verbose_cursor_for_new_note_value (_primary->note(), new_note);
}
}
diff --git a/gtk2_ardour/midi_region_view.cc b/gtk2_ardour/midi_region_view.cc
index c62686170a..0b13c3ff4e 100644
--- a/gtk2_ardour/midi_region_view.cc
+++ b/gtk2_ardour/midi_region_view.cc
@@ -3997,11 +3997,10 @@ MidiRegionView::delete_sysex (SysEx* /*sysex*/)
// display_sysexes();
}
-void
-MidiRegionView::show_verbose_cursor (boost::shared_ptr<NoteType> n) const
+std::string
+MidiRegionView::get_note_name (boost::shared_ptr<NoteType> n, uint8_t note_value) const
{
using namespace MIDI::Name;
-
std::string name;
MidiTimeAxisView* mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
@@ -4014,19 +4013,36 @@ MidiRegionView::show_verbose_cursor (boost::shared_ptr<NoteType> n) const
n->channel(),
patch_key.bank(),
patch_key.program(),
- n->note());
+ note_value);
}
- mtv->set_note_highlight (n->note());
}
char buf[128];
snprintf (buf, sizeof (buf), "%d %s\nCh %d Vel %d",
- (int) n->note (),
- name.empty() ? Evoral::midi_note_name (n->note()).c_str() : name.c_str(),
+ (int) note_value,
+ name.empty() ? Evoral::midi_note_name (note_value).c_str() : name.c_str(),
(int) n->channel() + 1,
(int) n->velocity());
- show_verbose_cursor(buf, 10, 20);
+ return buf;
+}
+
+void
+MidiRegionView::show_verbose_cursor_for_new_note_value(boost::shared_ptr<NoteType> current_note,
+ uint8_t new_value) const
+{
+ MidiTimeAxisView* mtv = dynamic_cast<MidiTimeAxisView*>(&trackview);
+ if (mtv) {
+ mtv->set_note_highlight (new_value);
+ }
+
+ show_verbose_cursor(get_note_name(current_note, new_value), 10, 20);
+}
+
+void
+MidiRegionView::show_verbose_cursor (boost::shared_ptr<NoteType> n) const
+{
+ show_verbose_cursor_for_new_note_value(n, n->note());
}
void
diff --git a/gtk2_ardour/midi_region_view.h b/gtk2_ardour/midi_region_view.h
index 5733861d87..b24b767981 100644
--- a/gtk2_ardour/midi_region_view.h
+++ b/gtk2_ardour/midi_region_view.h
@@ -337,6 +337,9 @@ public:
void note_deleted (NoteBase*);
+ void show_verbose_cursor_for_new_note_value(boost::shared_ptr<NoteType> current_note,
+ uint8_t new_note) const;
+
protected:
void region_resized (const PBD::PropertyChange&);
@@ -391,6 +394,8 @@ private:
void add_to_selection (NoteBase*);
void remove_from_selection (NoteBase*);
+ std::string get_note_name (boost::shared_ptr<NoteType> note, uint8_t note_value) const;
+
void show_verbose_cursor (std::string const &, double, double) const;
void show_verbose_cursor (boost::shared_ptr<NoteType>) const;