2024-02-13 12:22:49 -07: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.
|
|
|
|
|
*/
|
|
|
|
|
|
2024-09-25 18:38:59 -06:00
|
|
|
#pragma once
|
2024-02-13 12:22:49 -07:00
|
|
|
|
2024-11-07 16:10:31 -07:00
|
|
|
#include <map>
|
|
|
|
|
|
|
|
|
|
#include "ardour/types.h"
|
|
|
|
|
|
2024-02-13 12:22:49 -07:00
|
|
|
#include "midi_view.h"
|
|
|
|
|
|
2024-08-30 12:31:20 -06:00
|
|
|
class VelocityDisplay;
|
2025-01-07 11:45:58 -07:00
|
|
|
class PianorollAutomationLine;
|
2024-08-30 12:31:20 -06:00
|
|
|
|
2024-11-05 13:27:16 -07:00
|
|
|
namespace ArdourCanvas {
|
2024-11-05 14:59:20 -07:00
|
|
|
class Box;
|
2024-11-05 13:27:16 -07:00
|
|
|
}
|
|
|
|
|
|
2025-01-07 11:42:37 -07:00
|
|
|
class PianorollMidiView : public MidiView
|
2024-02-13 12:22:49 -07:00
|
|
|
{
|
|
|
|
|
public:
|
2025-01-07 11:42:37 -07:00
|
|
|
PianorollMidiView (std::shared_ptr<ARDOUR::MidiTrack> mt,
|
2024-06-25 22:59:14 -06:00
|
|
|
ArdourCanvas::Item& parent,
|
2024-11-11 21:49:55 -07:00
|
|
|
ArdourCanvas::Item& noscroll_parent,
|
2024-06-25 22:59:14 -06:00
|
|
|
EditingContext& ec,
|
|
|
|
|
MidiViewBackground& bg,
|
|
|
|
|
uint32_t basic_color
|
|
|
|
|
);
|
2024-02-13 12:22:49 -07:00
|
|
|
|
2025-01-07 11:42:37 -07:00
|
|
|
~PianorollMidiView();
|
2024-11-08 12:15:51 -07:00
|
|
|
|
2024-02-13 12:22:49 -07:00
|
|
|
void set_samples_per_pixel (double);
|
|
|
|
|
void set_height (double);
|
|
|
|
|
|
2024-08-30 12:31:20 -06:00
|
|
|
void clear_ghost_events();
|
|
|
|
|
void ghosts_model_changed();
|
|
|
|
|
void ghosts_view_changed();
|
|
|
|
|
void ghost_remove_note (NoteBase*);
|
|
|
|
|
void ghost_add_note (NoteBase*);
|
|
|
|
|
void ghost_sync_selection (NoteBase*);
|
|
|
|
|
|
2025-03-19 20:18:52 -06:00
|
|
|
void toggle_visibility (Evoral::Parameter const & param);
|
2024-12-20 11:48:40 -07:00
|
|
|
void swap_automation_channel (int);
|
2024-12-20 10:08:20 -07:00
|
|
|
void set_active_automation (Evoral::Parameter const &);
|
|
|
|
|
bool is_active_automation (Evoral::Parameter const &) const;
|
|
|
|
|
bool is_visible_automation (Evoral::Parameter const &) const;
|
2024-09-18 22:05:02 -06:00
|
|
|
|
2025-01-19 15:04:51 -07:00
|
|
|
AutomationLine* active_automation_line() const;
|
|
|
|
|
ArdourCanvas::Duple automation_group_position() const;
|
|
|
|
|
|
2024-02-13 12:22:49 -07:00
|
|
|
ArdourCanvas::Item* drag_group() const;
|
|
|
|
|
|
2024-10-07 13:20:11 -06:00
|
|
|
std::list<SelectableOwner*> selectable_owners();
|
2024-10-07 16:28:54 -06:00
|
|
|
MergeableLine* make_merger ();
|
2024-10-07 13:20:11 -06:00
|
|
|
|
2024-10-09 11:34:01 -06:00
|
|
|
bool automation_rb_click (GdkEvent*, Temporal::timepos_t const &);
|
2025-02-01 13:31:26 -07:00
|
|
|
bool velocity_rb_click (GdkEvent*, Temporal::timepos_t const &);
|
2024-10-09 12:49:48 -06:00
|
|
|
void line_drag_click (GdkEvent*, Temporal::timepos_t const &);
|
2024-10-09 11:34:01 -06:00
|
|
|
|
2024-11-08 12:15:51 -07:00
|
|
|
void automation_entry();
|
|
|
|
|
void automation_leave ();
|
|
|
|
|
|
2025-01-14 15:28:51 -07:00
|
|
|
void point_selection_changed ();
|
2025-01-15 18:09:18 -07:00
|
|
|
void clear_selection ();
|
2025-01-14 15:28:51 -07:00
|
|
|
|
2024-12-20 10:08:20 -07:00
|
|
|
sigc::signal<void> AutomationStateChange;
|
|
|
|
|
|
2025-04-09 11:11:32 -06:00
|
|
|
void set_overlay_text (std::string const &);
|
|
|
|
|
void hide_overlay_text ();
|
|
|
|
|
void show_overlay_text ();
|
|
|
|
|
|
2025-09-14 13:49:07 -06:00
|
|
|
void cut_copy_clear (::Selection& selection, Editing::CutCopyOp);
|
|
|
|
|
|
2024-02-13 12:22:49 -07:00
|
|
|
protected:
|
|
|
|
|
bool scroll (GdkEventScroll* ev);
|
|
|
|
|
|
2025-12-01 13:27:11 -07:00
|
|
|
ArdourCanvas::Item* _noscroll_parent;
|
2024-08-30 12:31:20 -06:00
|
|
|
ArdourCanvas::Rectangle* automation_group;
|
2025-04-09 11:11:32 -06:00
|
|
|
ArdourCanvas::Text* overlay_text;
|
2024-09-18 22:05:02 -06:00
|
|
|
|
2025-01-07 11:45:58 -07:00
|
|
|
typedef std::shared_ptr<PianorollAutomationLine> CueAutomationLine;
|
2024-11-07 16:10:31 -07:00
|
|
|
typedef std::shared_ptr<ARDOUR::AutomationControl> CueAutomationControl;
|
|
|
|
|
|
|
|
|
|
struct AutomationDisplayState {
|
|
|
|
|
|
|
|
|
|
AutomationDisplayState (CueAutomationControl ctl, CueAutomationLine ln, bool vis)
|
|
|
|
|
: control (ctl), line (ln), velocity_display (nullptr), visible (vis) {}
|
|
|
|
|
AutomationDisplayState (VelocityDisplay& vdisp, bool vis)
|
2024-11-08 12:15:51 -07:00
|
|
|
: control (nullptr), line (nullptr), velocity_display (&vdisp), visible (vis) {}
|
2024-11-07 16:10:31 -07:00
|
|
|
|
|
|
|
|
~AutomationDisplayState();
|
|
|
|
|
|
|
|
|
|
CueAutomationControl control;
|
|
|
|
|
CueAutomationLine line;
|
|
|
|
|
VelocityDisplay* velocity_display;
|
|
|
|
|
bool visible;
|
|
|
|
|
|
|
|
|
|
void hide ();
|
|
|
|
|
void show ();
|
2025-03-19 20:18:52 -06:00
|
|
|
void set_sensitive (bool);
|
2024-11-07 16:10:31 -07:00
|
|
|
void set_height (double);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef std::map<Evoral::Parameter, AutomationDisplayState> CueAutomationMap;
|
|
|
|
|
|
|
|
|
|
CueAutomationMap automation_map;
|
|
|
|
|
AutomationDisplayState* active_automation;
|
|
|
|
|
|
2024-08-30 12:31:20 -06:00
|
|
|
VelocityDisplay* velocity_display;
|
|
|
|
|
|
2024-02-13 12:22:49 -07:00
|
|
|
std::shared_ptr<Temporal::TempoMap const> tempo_map;
|
|
|
|
|
ArdourCanvas::Rectangle* event_rect;
|
2024-09-11 18:37:47 -06:00
|
|
|
|
|
|
|
|
void update_sustained (Note *);
|
|
|
|
|
void update_hit (Hit *);
|
2024-11-12 08:51:29 -07:00
|
|
|
|
|
|
|
|
double _height;
|
2024-12-20 10:08:20 -07:00
|
|
|
|
2025-03-19 20:18:52 -06:00
|
|
|
AutomationDisplayState* find_or_create_automation_display_state (Evoral::Parameter const &);
|
|
|
|
|
void internal_set_active_automation (AutomationDisplayState&);
|
2024-12-20 10:08:20 -07:00
|
|
|
void unset_active_automation ();
|
2024-12-27 14:00:55 -07:00
|
|
|
|
|
|
|
|
bool midi_canvas_group_event (GdkEvent*);
|
2025-01-06 20:40:50 -07:00
|
|
|
Gtkmm2ext::Color line_color_for (Evoral::Parameter const &);
|
2025-01-13 14:06:21 -07:00
|
|
|
|
|
|
|
|
void reset_width_dependent_items (double pixel_width);
|
2025-03-20 11:39:39 -06:00
|
|
|
bool have_visible_automation () const;
|
2025-09-14 13:49:07 -06:00
|
|
|
|
|
|
|
|
void cut_copy_clear_one (AutomationLine& line, ::Selection& selection, Editing::CutCopyOp op);
|
|
|
|
|
void cut_copy_points (Editing::CutCopyOp op, Temporal::timepos_t const & earliest_time);
|
2024-02-13 12:22:49 -07:00
|
|
|
};
|