2006-08-10 23:24:57 -04:00
|
|
|
/*
|
2019-08-02 17:26:43 -04:00
|
|
|
* Copyright (C) 2006-2015 David Robillard <d@drobilla.net>
|
|
|
|
* Copyright (C) 2008-2012 Hans Baier <hansfbaier@googlemail.com>
|
|
|
|
* Copyright (C) 2008-2017 Paul Davis <paul@linuxaudiosystems.com>
|
|
|
|
* Copyright (C) 2009-2012 Carl Hetherington <carl@carlh.net>
|
|
|
|
* Copyright (C) 2015-2016 Tim Mayberry <mojofunk@gmail.com>
|
|
|
|
* Copyright (C) 2015-2017 Nick Mainsbridge <mainsbridge@gmail.com>
|
|
|
|
* Copyright (C) 2015-2017 Robin Gareus <robin@gareus.org>
|
|
|
|
*
|
|
|
|
* 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.
|
|
|
|
*/
|
2006-08-10 23:24:57 -04:00
|
|
|
|
2024-09-25 20:38:59 -04:00
|
|
|
#pragma once
|
2006-08-10 23:24:57 -04:00
|
|
|
|
2009-02-16 00:54:12 -05:00
|
|
|
#include <string>
|
2006-08-10 23:24:57 -04:00
|
|
|
#include <vector>
|
2014-06-03 16:38:33 -04:00
|
|
|
#include <stdint.h>
|
2009-12-17 13:24:23 -05:00
|
|
|
|
2009-12-21 13:23:07 -05:00
|
|
|
#include "pbd/signals.h"
|
2009-12-17 13:24:23 -05:00
|
|
|
|
2009-02-25 13:26:51 -05:00
|
|
|
#include "ardour/midi_model.h"
|
|
|
|
#include "ardour/types.h"
|
2006-08-10 23:24:57 -04:00
|
|
|
|
2009-08-10 15:29:29 -04:00
|
|
|
#include "editing.h"
|
2006-08-10 23:24:57 -04:00
|
|
|
#include "region_view.h"
|
2007-08-01 22:05:00 -04:00
|
|
|
#include "midi_time_axis.h"
|
2024-01-09 00:35:37 -05:00
|
|
|
#include "midi_view.h"
|
2006-08-10 23:24:57 -04:00
|
|
|
#include "time_axis_view_item.h"
|
2024-09-20 22:00:46 -04:00
|
|
|
#include "editor_automation_line.h"
|
2006-08-10 23:24:57 -04:00
|
|
|
#include "enums.h"
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
class MidiRegion;
|
2007-07-30 22:16:46 -04:00
|
|
|
class MidiModel;
|
2009-08-26 23:09:30 -04:00
|
|
|
class Filter;
|
2006-08-10 23:24:57 -04:00
|
|
|
};
|
|
|
|
|
2008-12-15 06:05:41 -05:00
|
|
|
namespace MIDI {
|
|
|
|
namespace Name {
|
|
|
|
struct PatchPrimaryKey;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
class SysEx;
|
|
|
|
class Note;
|
|
|
|
class Hit;
|
2006-08-10 23:24:57 -04:00
|
|
|
class MidiTimeAxisView;
|
2023-06-20 13:28:59 -04:00
|
|
|
class NoteBase;
|
2006-08-10 23:24:57 -04:00
|
|
|
class GhostRegion;
|
|
|
|
class AutomationTimeAxisView;
|
2007-08-17 13:25:20 -04:00
|
|
|
class AutomationRegionView;
|
2009-08-12 21:57:03 -04:00
|
|
|
class MidiCutBuffer;
|
2010-01-04 22:52:30 -05:00
|
|
|
class MidiListEditor;
|
2010-08-13 22:00:50 -04:00
|
|
|
class EditNoteDialog;
|
2013-04-04 18:45:27 -04:00
|
|
|
class PatchChange;
|
2014-11-16 22:35:37 -05:00
|
|
|
class ItemCounts;
|
2014-12-20 01:11:28 -05:00
|
|
|
class CursorContext;
|
2023-06-20 13:28:59 -04:00
|
|
|
class VelocityGhostRegion;
|
2023-10-17 00:34:30 -04:00
|
|
|
class EditingContext;
|
2006-08-10 23:24:57 -04:00
|
|
|
|
2024-01-09 00:35:37 -05:00
|
|
|
class MidiRegionView : public RegionView, public MidiView
|
2006-08-10 23:24:57 -04:00
|
|
|
{
|
2011-05-19 17:11:21 -04:00
|
|
|
public:
|
2017-09-24 12:03:54 -04:00
|
|
|
typedef Evoral::Note<Temporal::Beats> NoteType;
|
|
|
|
typedef Evoral::Sequence<Temporal::Beats>::Notes Notes;
|
2009-02-01 21:36:05 -05:00
|
|
|
|
2014-12-17 02:34:30 -05:00
|
|
|
MidiRegionView (ArdourCanvas::Container* parent,
|
2023-10-17 00:34:30 -04:00
|
|
|
EditingContext&,
|
2014-12-17 02:34:30 -05:00
|
|
|
RouteTimeAxisView& tv,
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::MidiRegion> r,
|
2014-12-17 02:34:30 -05:00
|
|
|
double samples_per_pixel,
|
|
|
|
uint32_t basic_color);
|
|
|
|
|
|
|
|
MidiRegionView (ArdourCanvas::Container* parent,
|
2023-10-17 00:34:30 -04:00
|
|
|
EditingContext&,
|
2014-12-17 02:34:30 -05:00
|
|
|
RouteTimeAxisView& tv,
|
2023-02-16 18:33:28 -05:00
|
|
|
std::shared_ptr<ARDOUR::MidiRegion> r,
|
2014-12-17 02:34:30 -05:00
|
|
|
double samples_per_pixel,
|
|
|
|
uint32_t basic_color,
|
|
|
|
bool recording,
|
|
|
|
Visibility visibility);
|
|
|
|
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2008-09-26 13:18:22 -04:00
|
|
|
MidiRegionView (const MidiRegionView& other);
|
2023-02-16 18:33:28 -05:00
|
|
|
MidiRegionView (const MidiRegionView& other, std::shared_ptr<ARDOUR::MidiRegion>);
|
2006-08-10 23:24:57 -04:00
|
|
|
|
|
|
|
~MidiRegionView ();
|
2008-03-14 20:37:17 -04:00
|
|
|
|
2014-06-09 23:28:32 -04:00
|
|
|
void init (bool wfd);
|
2024-01-09 00:35:37 -05:00
|
|
|
bool display_is_enabled() const;
|
2008-03-14 20:37:17 -04:00
|
|
|
|
2022-04-18 00:58:16 -04:00
|
|
|
void set_selected (bool yn);
|
|
|
|
|
2023-02-16 18:33:28 -05:00
|
|
|
const std::shared_ptr<ARDOUR::MidiRegion> midi_region() const;
|
2007-08-01 22:05:00 -04:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
inline MidiTimeAxisView* midi_view() const
|
2011-05-19 17:11:21 -04:00
|
|
|
{ return dynamic_cast<MidiTimeAxisView*>(&trackview); }
|
2007-08-01 22:05:00 -04:00
|
|
|
|
|
|
|
inline MidiStreamView* midi_stream_view() const
|
2011-05-19 17:11:21 -04:00
|
|
|
{ return midi_view()->midi_view(); }
|
2008-03-14 20:37:17 -04:00
|
|
|
|
2008-09-19 15:32:10 -04:00
|
|
|
void set_height (double);
|
2024-11-04 17:47:30 -05:00
|
|
|
void set_model (std::shared_ptr<ARDOUR::MidiModel>);
|
2008-03-14 20:37:17 -04:00
|
|
|
|
2008-12-23 20:24:49 -05:00
|
|
|
inline ARDOUR::ColorMode color_mode() const { return midi_view()->color_mode(); }
|
2009-10-14 12:10:01 -04:00
|
|
|
|
2023-11-25 17:25:29 -05:00
|
|
|
std::string get_modifier_name() const;
|
2008-01-13 12:45:17 -05:00
|
|
|
|
2009-07-09 13:58:13 -04:00
|
|
|
GhostRegion* add_ghost (TimeAxisView&);
|
2006-08-10 23:24:57 -04:00
|
|
|
|
2015-10-27 22:58:55 -04:00
|
|
|
ARDOUR::InstrumentInfo& instrument_info() const;
|
2015-10-05 10:17:49 -04:00
|
|
|
|
2024-01-09 00:35:37 -05:00
|
|
|
double height() const;
|
|
|
|
void redisplay (bool);
|
2016-02-10 07:55:37 -05:00
|
|
|
|
2024-01-09 16:36:19 -05:00
|
|
|
ArdourCanvas::Item* drag_group() const;
|
2024-01-12 13:34:59 -05:00
|
|
|
void select_self (bool add);
|
|
|
|
void unselect_self ();
|
|
|
|
void select_self_uniquely ();
|
|
|
|
void begin_drag_edit (std::string const & why);
|
2024-01-09 16:36:19 -05:00
|
|
|
|
2024-02-09 15:03:24 -05:00
|
|
|
void set_visibility_note_range (MidiViewBackground::VisibleNoteRange, bool);
|
|
|
|
|
2024-10-07 18:28:54 -04:00
|
|
|
MergeableLine* make_merger ();
|
|
|
|
|
2020-04-16 14:11:10 -04:00
|
|
|
protected:
|
2007-06-09 02:10:30 -04:00
|
|
|
void reset_width_dependent_items (double pixel_width);
|
2011-08-03 07:15:01 -04:00
|
|
|
void parameter_changed (std::string const & p);
|
2024-01-09 00:35:37 -05:00
|
|
|
uint32_t get_fill_color() const;
|
|
|
|
void color_handler ();
|
|
|
|
void region_resized (const PBD::PropertyChange&);
|
|
|
|
bool canvas_group_event (GdkEvent*);
|
2022-08-31 15:53:55 -04:00
|
|
|
|
2020-04-16 13:00:50 -04:00
|
|
|
private:
|
2010-08-13 22:00:50 -04:00
|
|
|
|
2011-11-16 15:11:33 -05:00
|
|
|
friend class MidiRubberbandSelectDrag;
|
2012-01-19 21:54:23 -05:00
|
|
|
friend class MidiVerticalSelectDrag;
|
2016-11-22 16:04:14 -05:00
|
|
|
friend class NoteDrag;
|
2016-11-21 09:59:57 -05:00
|
|
|
friend class NoteCreateDrag;
|
|
|
|
friend class HitCreateDrag;
|
2017-01-29 09:46:38 -05:00
|
|
|
friend class MidiGhostRegion;
|
2011-11-16 15:11:33 -05:00
|
|
|
|
2010-08-13 22:00:50 -04:00
|
|
|
friend class EditNoteDialog;
|
2010-09-15 12:16:37 -04:00
|
|
|
|
2024-09-16 20:19:40 -04:00
|
|
|
void clear_ghost_events();
|
|
|
|
void ghosts_model_changed();
|
2024-01-09 00:35:37 -05:00
|
|
|
void ghosts_view_changed();
|
2024-09-16 20:19:40 -04:00
|
|
|
void ghost_remove_note (NoteBase*);
|
|
|
|
void ghost_add_note (NoteBase*);
|
2024-01-09 00:35:37 -05:00
|
|
|
void ghost_sync_selection (NoteBase*);
|
2010-05-26 07:54:49 -04:00
|
|
|
|
2011-05-19 17:11:21 -04:00
|
|
|
bool motion (GdkEventMotion*);
|
|
|
|
bool scroll (GdkEventScroll*);
|
|
|
|
bool button_press (GdkEventButton*);
|
|
|
|
bool button_release (GdkEventButton*);
|
|
|
|
bool enter_notify (GdkEventCrossing*);
|
|
|
|
bool leave_notify (GdkEventCrossing*);
|
2010-05-28 17:39:12 -04:00
|
|
|
|
2016-08-30 13:27:35 -04:00
|
|
|
void enter_internal (uint32_t state);
|
2014-12-06 19:56:36 -05:00
|
|
|
void leave_internal ();
|
2024-01-09 00:35:37 -05:00
|
|
|
void mouse_mode_changed ();
|
2023-11-21 17:07:33 -05:00
|
|
|
|
2024-01-09 00:35:37 -05:00
|
|
|
double contents_height() const { return (_height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2); }
|
2023-11-21 19:07:28 -05:00
|
|
|
|
2024-01-09 00:35:37 -05:00
|
|
|
void connect_to_diskstream ();
|
2009-10-14 12:10:01 -04:00
|
|
|
};
|
2009-08-26 23:09:30 -04:00
|
|
|
|
2006-08-10 23:24:57 -04:00
|
|
|
|