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
This commit is contained in:
Tim Mayberry 2016-02-10 22:55:37 +10:00
parent 2b42dc13fd
commit 90e35c7143
3 changed files with 30 additions and 13 deletions

View File

@ -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);
}
}

View File

@ -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

View File

@ -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;