fix message in startup wizard re: alpha
[ardour.git] / gtk2_ardour / midi_list_editor.h
1 /*
2     Copyright (C) 2009 Paul Davis
3
4         This program is free software; you can redistribute it and/or modify
5         it under the terms of the GNU General Public License as published by
6         the Free Software Foundation; either version 2 of the License, or
7         (at your option) any later version.
8
9         This program is distributed in the hope that it will be useful,
10         but WITHOUT ANY WARRANTY; without even the implied warranty of
11         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12         GNU General Public License for more details.
13
14         You should have received a copy of the GNU General Public License
15         along with this program; if not, write to the Free Software
16         Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 */
18
19 #ifndef __ardour_gtk2_midi_list_editor_h_
20 #define __ardour_gtk2_midi_list_editor_h_
21
22 #include <gtkmm/treeview.h>
23 #include <gtkmm/liststore.h>
24 #include <gtkmm/scrolledwindow.h>
25
26 #include "evoral/types.hpp"
27
28 #include "ardour/session_handle.h"
29
30 #include "ardour_dialog.h"
31
32 namespace Evoral {
33         template<typename Time> class Note;
34 };
35
36 namespace ARDOUR {
37         class MidiRegion;
38         class MidiModel;
39         class Session;
40 };
41
42 class MidiListEditor : public ArdourDialog
43 {
44   public:
45         typedef Evoral::Note<Evoral::MusicalTime> NoteType;
46
47         MidiListEditor(ARDOUR::Session*, boost::shared_ptr<ARDOUR::MidiRegion>);
48         ~MidiListEditor();
49
50   private:
51         struct MidiListModelColumns : public Gtk::TreeModel::ColumnRecord {
52                 MidiListModelColumns() {
53                         add (channel);
54                         add (note);
55                         add (note_name);
56                         add (velocity);
57                         add (start);
58                         add (length);
59                         add (end);
60                         add (_note);
61                 };
62                 Gtk::TreeModelColumn<uint8_t> channel;
63                 Gtk::TreeModelColumn<uint8_t> note;
64                 Gtk::TreeModelColumn<std::string> note_name;
65                 Gtk::TreeModelColumn<uint8_t> velocity;
66                 Gtk::TreeModelColumn<std::string> start;
67                 Gtk::TreeModelColumn<std::string> length;
68                 Gtk::TreeModelColumn<std::string> end;
69                 Gtk::TreeModelColumn<boost::shared_ptr<NoteType> > _note;
70         };
71
72         MidiListModelColumns         columns;
73         Glib::RefPtr<Gtk::ListStore> model;
74         Gtk::TreeView                view;
75         Gtk::ScrolledWindow          scroller;
76         std::string               _current_edit;
77
78         boost::shared_ptr<ARDOUR::MidiRegion> region;
79
80         void edited (const std::string&, const std::string&);
81         void editing_started (Gtk::CellEditable*, const std::string& path, int);
82         void editing_canceled ();
83
84         void redisplay_model ();
85
86         bool key_press (GdkEventKey* ev);
87         bool key_release (GdkEventKey* ev);
88
89         void delete_selected_note ();
90 };
91
92 #endif /* __ardour_gtk2_midi_list_editor_h_ */