2009-10-14 12:10:01 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2009-2015 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2009-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
*/
|
2009-08-26 23:09:30 -04:00
|
|
|
|
|
|
|
#ifndef __ardour_gtk2_midi_list_editor_h_
|
|
|
|
#define __ardour_gtk2_midi_list_editor_h_
|
|
|
|
|
2012-01-31 22:33:42 -05:00
|
|
|
#include <gtkmm/box.h>
|
2009-08-26 23:09:30 -04:00
|
|
|
#include <gtkmm/liststore.h>
|
|
|
|
#include <gtkmm/scrolledwindow.h>
|
2023-09-24 08:25:14 -04:00
|
|
|
#include <gtkmm/table.h>
|
|
|
|
#include <gtkmm/treeview.h>
|
2009-08-26 23:09:30 -04:00
|
|
|
|
2023-09-24 08:27:29 -04:00
|
|
|
#include "temporal/beats.h"
|
|
|
|
|
2009-12-17 13:24:23 -05:00
|
|
|
#include "ardour/session_handle.h"
|
|
|
|
|
2011-11-18 19:56:35 -05:00
|
|
|
#include "ardour_window.h"
|
2009-08-26 23:09:30 -04:00
|
|
|
|
2011-10-19 17:53:09 -04:00
|
|
|
namespace Evoral {
|
2023-09-24 08:25:14 -04:00
|
|
|
template <typename Time> class Note;
|
2011-10-19 17:53:09 -04:00
|
|
|
};
|
|
|
|
|
2009-08-26 23:09:30 -04:00
|
|
|
namespace ARDOUR {
|
|
|
|
class MidiRegion;
|
|
|
|
class MidiModel;
|
2012-01-31 22:33:42 -05:00
|
|
|
class MidiTrack;
|
2009-09-03 08:39:50 -04:00
|
|
|
class Session;
|
2009-08-26 23:09:30 -04:00
|
|
|
};
|
|
|
|
|
2011-11-18 19:56:35 -05:00
|
|
|
class MidiListEditor : public ArdourWindow
|
2009-08-26 23:09:30 -04:00
|
|
|
{
|
2017-07-01 15:11:14 -04:00
|
|
|
public:
|
2017-09-24 12:03:54 -04:00
|
|
|
typedef Evoral::Note<Temporal::Beats> NoteType;
|
2009-09-03 08:39:50 -04:00
|
|
|
|
2023-09-24 08:25:14 -04:00
|
|
|
MidiListEditor (ARDOUR::Session*, std::shared_ptr<ARDOUR::MidiRegion>,
|
|
|
|
std::shared_ptr<ARDOUR::MidiTrack>);
|
|
|
|
~MidiListEditor ();
|
2009-08-26 23:09:30 -04:00
|
|
|
|
2017-07-01 15:11:14 -04:00
|
|
|
private:
|
2023-09-24 08:25:14 -04:00
|
|
|
struct MidiListModelColumns : public Gtk::TreeModel::ColumnRecord {
|
|
|
|
MidiListModelColumns ()
|
|
|
|
{
|
2009-08-26 23:09:30 -04:00
|
|
|
add (channel);
|
|
|
|
add (note);
|
|
|
|
add (note_name);
|
|
|
|
add (velocity);
|
|
|
|
add (start);
|
|
|
|
add (length);
|
2010-01-04 22:52:30 -05:00
|
|
|
add (_note);
|
2009-08-26 23:09:30 -04:00
|
|
|
};
|
2023-09-24 08:25:14 -04:00
|
|
|
Gtk::TreeModelColumn<uint8_t> channel;
|
|
|
|
Gtk::TreeModelColumn<uint8_t> note;
|
|
|
|
Gtk::TreeModelColumn<std::string> note_name;
|
|
|
|
Gtk::TreeModelColumn<uint8_t> velocity;
|
|
|
|
Gtk::TreeModelColumn<std::string> start;
|
|
|
|
Gtk::TreeModelColumn<std::string> length;
|
|
|
|
Gtk::TreeModelColumn<std::shared_ptr<NoteType>> _note;
|
2009-08-26 23:09:30 -04:00
|
|
|
};
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2023-09-24 08:25:14 -04:00
|
|
|
struct NoteLengthColumns : public Gtk::TreeModel::ColumnRecord {
|
|
|
|
NoteLengthColumns ()
|
|
|
|
{
|
2012-01-31 22:33:42 -05:00
|
|
|
add (ticks);
|
|
|
|
add (name);
|
|
|
|
}
|
|
|
|
Gtk::TreeModelColumn<int> ticks;
|
|
|
|
Gtk::TreeModelColumn<std::string> name;
|
|
|
|
};
|
|
|
|
|
2009-08-26 23:09:30 -04:00
|
|
|
MidiListModelColumns columns;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> model;
|
2012-01-31 22:33:42 -05:00
|
|
|
NoteLengthColumns note_length_columns;
|
|
|
|
Glib::RefPtr<Gtk::ListStore> note_length_model;
|
2009-08-26 23:09:30 -04:00
|
|
|
Gtk::TreeView view;
|
|
|
|
Gtk::ScrolledWindow scroller;
|
2012-01-31 22:33:42 -05:00
|
|
|
Gtk::TreeModel::Path edit_path;
|
|
|
|
int edit_column;
|
|
|
|
Gtk::CellRendererText* editing_renderer;
|
2012-02-01 15:11:57 -05:00
|
|
|
Gtk::CellEditable* editing_editable;
|
2012-01-31 22:33:42 -05:00
|
|
|
Gtk::Table buttons;
|
|
|
|
Gtk::VBox vbox;
|
2012-02-01 15:11:57 -05:00
|
|
|
Gtk::ToggleButton sound_notes_button;
|
2009-08-26 23:09:30 -04:00
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::MidiRegion> region;
|
|
|
|
std::shared_ptr<ARDOUR::MidiTrack> track;
|
2009-08-26 23:09:30 -04:00
|
|
|
|
2012-01-30 22:03:13 -05:00
|
|
|
/** connection used to connect to model's ContentChanged signal */
|
2020-03-26 17:30:32 -04:00
|
|
|
PBD::ScopedConnectionList content_connections;
|
2012-01-30 22:03:13 -05:00
|
|
|
|
2010-09-14 12:51:02 -04:00
|
|
|
void edited (const std::string&, const std::string&);
|
|
|
|
void editing_started (Gtk::CellEditable*, const std::string& path, int);
|
2010-01-05 09:56:42 -05:00
|
|
|
void editing_canceled ();
|
2012-01-31 22:33:42 -05:00
|
|
|
void stop_editing (bool cancelled = false);
|
2010-01-05 09:56:42 -05:00
|
|
|
|
2009-08-26 23:09:30 -04:00
|
|
|
void redisplay_model ();
|
2010-01-04 22:52:30 -05:00
|
|
|
|
|
|
|
bool key_press (GdkEventKey* ev);
|
|
|
|
bool key_release (GdkEventKey* ev);
|
2012-02-01 16:30:00 -05:00
|
|
|
bool scroll_event (GdkEventScroll*);
|
2011-06-01 13:00:29 -04:00
|
|
|
|
2010-01-04 22:52:30 -05:00
|
|
|
void delete_selected_note ();
|
2012-01-31 22:33:42 -05:00
|
|
|
void selection_changed ();
|
2009-08-26 23:09:30 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* __ardour_gtk2_midi_list_editor_h_ */
|