Ardour  9.0-pre0-822-g12e3bc5c20
midi_list_editor.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2009-2015 David Robillard <d@drobilla.net>
3  * Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 2 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program; if not, write to the Free Software Foundation, Inc.,
17  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef __ardour_gtk2_midi_list_editor_h_
21 #define __ardour_gtk2_midi_list_editor_h_
22 
23 #include <ytkmm/box.h>
24 #include <ytkmm/liststore.h>
25 #include <ytkmm/scrolledwindow.h>
26 #include <ytkmm/table.h>
27 #include <ytkmm/treeview.h>
28 
29 #include "temporal/beats.h"
30 
31 #include "ardour/session_handle.h"
32 
33 #include "ardour_window.h"
34 
35 namespace Evoral {
36  template <typename Time> class Note;
37 };
38 
39 namespace ARDOUR {
40  class MidiRegion;
41  class MidiModel;
42  class MidiTrack;
43  class Session;
44 };
45 
47 {
48 public:
50 
51  MidiListEditor (ARDOUR::Session*, std::shared_ptr<ARDOUR::MidiRegion>,
52  std::shared_ptr<ARDOUR::MidiTrack>);
54 
55 private:
56  struct MidiListModelColumns : public Gtk::TreeModel::ColumnRecord {
58  {
59  add (channel);
60  add (note);
61  add (note_name);
62  add (velocity);
63  add (start);
64  add (length);
65  add (_note);
66  };
67  Gtk::TreeModelColumn<uint8_t> channel;
68  Gtk::TreeModelColumn<uint8_t> note;
69  Gtk::TreeModelColumn<std::string> note_name;
70  Gtk::TreeModelColumn<uint8_t> velocity;
71  Gtk::TreeModelColumn<std::string> start;
72  Gtk::TreeModelColumn<std::string> length;
73  Gtk::TreeModelColumn<std::shared_ptr<NoteType>> _note;
74  };
75 
76  struct NoteLengthColumns : public Gtk::TreeModel::ColumnRecord {
78  {
79  add (ticks);
80  add (name);
81  }
82  Gtk::TreeModelColumn<int> ticks;
83  Gtk::TreeModelColumn<std::string> name;
84  };
85 
87  Glib::RefPtr<Gtk::ListStore> model;
89  Glib::RefPtr<Gtk::ListStore> note_length_model;
90  Gtk::TreeView view;
91  Gtk::ScrolledWindow scroller;
92  Gtk::TreeModel::Path edit_path;
94  Gtk::CellRendererText* editing_renderer;
95  Gtk::CellEditable* editing_editable;
97  Gtk::VBox vbox;
98  Gtk::ToggleButton sound_notes_button;
99 
100  std::shared_ptr<ARDOUR::MidiRegion> region;
101  std::shared_ptr<ARDOUR::MidiTrack> track;
102 
105 
106  void edited (const std::string&, const std::string&);
107  void editing_started (Gtk::CellEditable*, const std::string& path, int);
109  void stop_editing (bool cancelled = false);
110 
112 
113  bool key_press (GdkEventKey* ev);
114  bool key_release (GdkEventKey* ev);
115  bool scroll_event (GdkEventScroll*);
116 
119 };
120 
121 #endif /* __ardour_gtk2_midi_list_editor_h_ */
void stop_editing(bool cancelled=false)
Gtk::TreeModel::Path edit_path
bool scroll_event(GdkEventScroll *)
std::shared_ptr< ARDOUR::MidiTrack > track
void editing_started(Gtk::CellEditable *, const std::string &path, int)
PBD::ScopedConnectionList content_connections
void selection_changed()
Gtk::Table buttons
std::shared_ptr< ARDOUR::MidiRegion > region
MidiListEditor(ARDOUR::Session *, std::shared_ptr< ARDOUR::MidiRegion >, std::shared_ptr< ARDOUR::MidiTrack >)
Gtk::TreeView view
void editing_canceled()
MidiListModelColumns columns
bool key_release(GdkEventKey *ev)
Glib::RefPtr< Gtk::ListStore > model
bool key_press(GdkEventKey *ev)
Glib::RefPtr< Gtk::ListStore > note_length_model
Gtk::ScrolledWindow scroller
Gtk::CellEditable * editing_editable
Evoral::Note< Temporal::Beats > NoteType
NoteLengthColumns note_length_columns
void delete_selected_note()
Gtk::CellRendererText * editing_renderer
void redisplay_model()
Gtk::ToggleButton sound_notes_button
void edited(const std::string &, const std::string &)
struct Table Table
Definition: editor.h:87
Gtk::TreeModelColumn< uint8_t > channel
Gtk::TreeModelColumn< std::string > start
Gtk::TreeModelColumn< std::string > length
Gtk::TreeModelColumn< uint8_t > velocity
Gtk::TreeModelColumn< std::string > note_name
Gtk::TreeModelColumn< std::shared_ptr< NoteType > > _note
Gtk::TreeModelColumn< uint8_t > note
Gtk::TreeModelColumn< int > ticks
Gtk::TreeModelColumn< std::string > name