Fix session-open after selecting new, template, then back
[ardour.git] / gtk2_ardour / midi_list_editor.cc
index e0eda7a53647737105762ca2ec20ce3f08242cdb..b6100aa552c936af0e4b00bd4c4a3dde4121e90e 100644 (file)
@@ -39,7 +39,7 @@
 #include "note_player.h"
 #include "ui_config.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace Gtk;
@@ -612,6 +612,13 @@ MidiListEditor::edited (const std::string& path, const std::string& text)
                }
                break;
        case 3: // name
+               ival = ParameterDescriptor::midi_note_num (text);
+               if (ival < 128) {
+                       idelta = ival - note->note();
+                       prop = MidiModel::NoteDiffCommand::NoteNumber;
+                       opname = _("change note number");
+                       apply = true;
+               }
                break;
        case 4: // velocity
                if (sscanf (text.c_str(), "%d", &ival) == 1 && ival != note->velocity()) {
@@ -760,11 +767,11 @@ MidiListEditor::redisplay_model ()
                for (MidiModel::Notes::iterator i = notes.begin(); i != notes.end(); ++i) {
                        row = *(model->append());
                        row[columns.channel] = (*i)->channel() + 1;
-                       row[columns.note_name] = Evoral::midi_note_name ((*i)->note());
+                       row[columns.note_name] = ParameterDescriptor::midi_note_name ((*i)->note());
                        row[columns.note] = (*i)->note();
                        row[columns.velocity] = (*i)->velocity();
 
-                       Timecode::BBT_Time bbt (_session->tempo_map().bbt_at_frame (conv.to ((*i)->time())));
+                       Timecode::BBT_Time bbt (_session->tempo_map().bbt_at_frame (region->position() + conv.to ((*i)->time())));
 
                        ss.str ("");
                        ss << bbt;