2006-08-11 03:24:57 +00:00
|
|
|
/*
|
2019-08-02 23:26:43 +02: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-11 03:24:57 +00:00
|
|
|
|
2024-09-25 18:38:59 -06:00
|
|
|
#pragma once
|
2006-08-11 03:24:57 +00:00
|
|
|
|
2009-02-16 05:54:12 +00:00
|
|
|
#include <string>
|
2006-08-11 03:24:57 +00:00
|
|
|
#include <vector>
|
2014-06-03 16:38:33 -04:00
|
|
|
#include <stdint.h>
|
2009-12-17 18:24:23 +00:00
|
|
|
|
2009-12-21 18:23:07 +00:00
|
|
|
#include "pbd/signals.h"
|
2009-12-17 18:24:23 +00:00
|
|
|
|
2009-02-25 18:26:51 +00:00
|
|
|
#include "ardour/midi_model.h"
|
|
|
|
|
#include "ardour/types.h"
|
2006-08-11 03:24:57 +00:00
|
|
|
|
2009-08-10 19:29:29 +00:00
|
|
|
#include "editing.h"
|
2006-08-11 03:24:57 +00:00
|
|
|
#include "region_view.h"
|
2007-08-02 02:05:00 +00:00
|
|
|
#include "midi_time_axis.h"
|
2024-01-08 22:35:37 -07:00
|
|
|
#include "midi_view.h"
|
2006-08-11 03:24:57 +00:00
|
|
|
#include "time_axis_view_item.h"
|
2024-09-20 20:00:46 -06:00
|
|
|
#include "editor_automation_line.h"
|
2006-08-11 03:24:57 +00:00
|
|
|
#include "enums.h"
|
|
|
|
|
|
|
|
|
|
namespace ARDOUR {
|
|
|
|
|
class MidiRegion;
|
2007-07-31 02:16:46 +00:00
|
|
|
class MidiModel;
|
2009-08-27 03:09:30 +00:00
|
|
|
class Filter;
|
2006-08-11 03:24:57 +00:00
|
|
|
};
|
|
|
|
|
|
2008-12-15 11:05:41 +00:00
|
|
|
namespace MIDI {
|
|
|
|
|
namespace Name {
|
|
|
|
|
struct PatchPrimaryKey;
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2013-04-04 00:32:52 -04:00
|
|
|
class SysEx;
|
|
|
|
|
class Note;
|
|
|
|
|
class Hit;
|
2006-08-11 03:24:57 +00:00
|
|
|
class MidiTimeAxisView;
|
2023-06-20 11:28:59 -06:00
|
|
|
class NoteBase;
|
2006-08-11 03:24:57 +00:00
|
|
|
class GhostRegion;
|
|
|
|
|
class AutomationTimeAxisView;
|
2007-08-17 17:25:20 +00:00
|
|
|
class AutomationRegionView;
|
2009-08-13 01:57:03 +00:00
|
|
|
class MidiCutBuffer;
|
2010-01-05 03:52:30 +00:00
|
|
|
class MidiListEditor;
|
2010-08-14 02:00:50 +00: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 11:28:59 -06:00
|
|
|
class VelocityGhostRegion;
|
2023-10-16 22:34:30 -06:00
|
|
|
class EditingContext;
|
2006-08-11 03:24:57 +00:00
|
|
|
|
2024-01-08 22:35:37 -07:00
|
|
|
class MidiRegionView : public RegionView, public MidiView
|
2006-08-11 03:24:57 +00:00
|
|
|
{
|
2011-05-19 21:11:21 +00: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-02 02:36:05 +00:00
|
|
|
|
2014-12-17 02:34:30 -05:00
|
|
|
MidiRegionView (ArdourCanvas::Container* parent,
|
2023-10-16 22:34:30 -06:00
|
|
|
EditingContext&,
|
2014-12-17 02:34:30 -05:00
|
|
|
RouteTimeAxisView& tv,
|
2023-02-16 16:33:28 -07: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-16 22:34:30 -06:00
|
|
|
EditingContext&,
|
2014-12-17 02:34:30 -05:00
|
|
|
RouteTimeAxisView& tv,
|
2023-02-16 16:33:28 -07: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 16:10:01 +00:00
|
|
|
|
2008-09-26 17:18:22 +00:00
|
|
|
MidiRegionView (const MidiRegionView& other);
|
2023-02-16 16:33:28 -07:00
|
|
|
MidiRegionView (const MidiRegionView& other, std::shared_ptr<ARDOUR::MidiRegion>);
|
2006-08-11 03:24:57 +00:00
|
|
|
|
|
|
|
|
~MidiRegionView ();
|
2008-03-15 00:37:17 +00:00
|
|
|
|
2014-06-09 23:28:32 -04:00
|
|
|
void init (bool wfd);
|
2024-01-08 22:35:37 -07:00
|
|
|
bool display_is_enabled() const;
|
2008-03-15 00:37:17 +00:00
|
|
|
|
2022-04-17 22:58:16 -06:00
|
|
|
void set_selected (bool yn);
|
|
|
|
|
|
2023-02-16 16:33:28 -07:00
|
|
|
const std::shared_ptr<ARDOUR::MidiRegion> midi_region() const;
|
2007-08-02 02:05:00 +00:00
|
|
|
|
2009-07-09 17:58:13 +00:00
|
|
|
inline MidiTimeAxisView* midi_view() const
|
2011-05-19 21:11:21 +00:00
|
|
|
{ return dynamic_cast<MidiTimeAxisView*>(&trackview); }
|
2007-08-02 02:05:00 +00:00
|
|
|
|
|
|
|
|
inline MidiStreamView* midi_stream_view() const
|
2011-05-19 21:11:21 +00:00
|
|
|
{ return midi_view()->midi_view(); }
|
2008-03-15 00:37:17 +00:00
|
|
|
|
2008-09-19 19:32:10 +00:00
|
|
|
void set_height (double);
|
2024-11-04 15:47:30 -07:00
|
|
|
void set_model (std::shared_ptr<ARDOUR::MidiModel>);
|
2008-03-15 00:37:17 +00:00
|
|
|
|
2008-12-24 01:24:49 +00:00
|
|
|
inline ARDOUR::ColorMode color_mode() const { return midi_view()->color_mode(); }
|
2009-10-14 16:10:01 +00:00
|
|
|
|
2023-11-25 15:25:29 -07:00
|
|
|
std::string get_modifier_name() const;
|
2008-01-13 17:45:17 +00:00
|
|
|
|
2009-07-09 17:58:13 +00:00
|
|
|
GhostRegion* add_ghost (TimeAxisView&);
|
2006-08-11 03:24:57 +00:00
|
|
|
|
2015-10-28 12:58:55 +10:00
|
|
|
ARDOUR::InstrumentInfo& instrument_info() const;
|
2015-10-05 16:17:49 +02:00
|
|
|
|
2024-01-08 22:35:37 -07:00
|
|
|
double height() const;
|
|
|
|
|
void redisplay (bool);
|
2016-02-10 22:55:37 +10:00
|
|
|
|
2024-01-09 14:36:19 -07:00
|
|
|
ArdourCanvas::Item* drag_group() const;
|
2024-01-12 11:34:59 -07:00
|
|
|
void select_self (bool add);
|
|
|
|
|
void unselect_self ();
|
|
|
|
|
void select_self_uniquely ();
|
|
|
|
|
void begin_drag_edit (std::string const & why);
|
2024-01-09 14:36:19 -07:00
|
|
|
|
2024-02-09 13:03:24 -07:00
|
|
|
void set_visibility_note_range (MidiViewBackground::VisibleNoteRange, bool);
|
|
|
|
|
|
2024-10-07 16:28:54 -06:00
|
|
|
MergeableLine* make_merger ();
|
|
|
|
|
|
2020-04-16 12:11:10 -06:00
|
|
|
protected:
|
2007-06-09 06:10:30 +00:00
|
|
|
void reset_width_dependent_items (double pixel_width);
|
2011-08-03 11:15:01 +00:00
|
|
|
void parameter_changed (std::string const & p);
|
2024-01-08 22:35:37 -07:00
|
|
|
uint32_t get_fill_color() const;
|
|
|
|
|
void color_handler ();
|
|
|
|
|
void region_resized (const PBD::PropertyChange&);
|
|
|
|
|
bool canvas_group_event (GdkEvent*);
|
2024-11-22 13:51:50 -07:00
|
|
|
void add_control_points_to_selection (Temporal::timepos_t const &, Temporal::timepos_t const &, double y0, double y1);
|
2022-08-31 13:53:55 -06:00
|
|
|
|
2020-04-16 11:00:50 -06:00
|
|
|
private:
|
2010-08-14 02:00:50 +00:00
|
|
|
|
2011-11-16 20:11:33 +00:00
|
|
|
friend class MidiRubberbandSelectDrag;
|
2012-01-20 02:54:23 +00:00
|
|
|
friend class MidiVerticalSelectDrag;
|
2016-11-23 08:04:14 +11:00
|
|
|
friend class NoteDrag;
|
2016-11-22 01:59:57 +11:00
|
|
|
friend class NoteCreateDrag;
|
|
|
|
|
friend class HitCreateDrag;
|
2017-01-30 01:46:38 +11:00
|
|
|
friend class MidiGhostRegion;
|
2011-11-16 20:11:33 +00:00
|
|
|
|
2010-08-14 02:00:50 +00:00
|
|
|
friend class EditNoteDialog;
|
2010-09-15 16:16:37 +00:00
|
|
|
|
2024-09-16 18:19:40 -06:00
|
|
|
void clear_ghost_events();
|
|
|
|
|
void ghosts_model_changed();
|
2024-01-08 22:35:37 -07:00
|
|
|
void ghosts_view_changed();
|
2024-09-16 18:19:40 -06:00
|
|
|
void ghost_remove_note (NoteBase*);
|
|
|
|
|
void ghost_add_note (NoteBase*);
|
2024-01-08 22:35:37 -07:00
|
|
|
void ghost_sync_selection (NoteBase*);
|
2010-05-26 11:54:49 +00:00
|
|
|
|
2011-05-19 21:11:21 +00: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 21:39:12 +00:00
|
|
|
|
2016-08-31 03:27:35 +10:00
|
|
|
void enter_internal (uint32_t state);
|
2014-12-06 19:56:36 -05:00
|
|
|
void leave_internal ();
|
2024-01-08 22:35:37 -07:00
|
|
|
void mouse_mode_changed ();
|
2023-11-21 15:07:33 -07:00
|
|
|
|
2024-01-08 22:35:37 -07:00
|
|
|
double contents_height() const { return (_height - TimeAxisViewItem::NAME_HIGHLIGHT_SIZE - 2); }
|
2023-11-21 17:07:28 -07:00
|
|
|
|
2024-01-08 22:35:37 -07:00
|
|
|
void connect_to_diskstream ();
|
2009-10-14 16:10:01 +00:00
|
|
|
};
|
2009-08-27 03:09:30 +00:00
|
|
|
|
2006-08-11 03:24:57 +00:00
|
|
|
|