2023-01-08 11:52:20 -05:00
|
|
|
/*
|
|
|
|
* Copyright (C) 2022 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <utility>
|
|
|
|
|
|
|
|
#include "pbd/memento_command.h"
|
|
|
|
|
|
|
|
#include "ardour/automation_control.h"
|
|
|
|
#include "ardour/event_type_map.h"
|
|
|
|
#include "ardour/midi_automation_list_binder.h"
|
|
|
|
#include "ardour/midi_region.h"
|
|
|
|
#include "ardour/midi_track.h"
|
|
|
|
#include "ardour/session.h"
|
|
|
|
|
|
|
|
#include "gtkmm2ext/keyboard.h"
|
2023-06-22 19:31:53 -04:00
|
|
|
#include "gtkmm2ext/utils.h"
|
2023-01-08 11:52:20 -05:00
|
|
|
|
2023-01-10 23:41:47 -05:00
|
|
|
#include "canvas/lollipop.h"
|
|
|
|
|
2023-01-08 11:52:20 -05:00
|
|
|
#include "editing.h"
|
|
|
|
#include "editor.h"
|
|
|
|
#include "editor_drag.h"
|
2024-08-26 15:09:50 -04:00
|
|
|
#include "ghost_event.h"
|
2023-01-08 11:52:20 -05:00
|
|
|
#include "gui_thread.h"
|
|
|
|
#include "midi_automation_line.h"
|
2023-06-20 15:47:12 -04:00
|
|
|
#include "midi_region_view.h"
|
2023-01-10 23:41:47 -05:00
|
|
|
#include "note_base.h"
|
2023-01-08 11:52:20 -05:00
|
|
|
#include "public_editor.h"
|
|
|
|
#include "ui_config.h"
|
2024-08-26 15:09:50 -04:00
|
|
|
#include "velocity_ghost_region.h"
|
2023-06-21 19:32:52 -04:00
|
|
|
#include "verbose_cursor.h"
|
2023-01-08 11:52:20 -05:00
|
|
|
|
|
|
|
#include "pbd/i18n.h"
|
|
|
|
|
|
|
|
using namespace Temporal;
|
|
|
|
|
|
|
|
VelocityGhostRegion::VelocityGhostRegion (MidiRegionView& mrv, TimeAxisView& tv, TimeAxisView& source_tv, double initial_unit_pos)
|
|
|
|
: MidiGhostRegion (mrv, tv, source_tv, initial_unit_pos)
|
2024-08-26 15:09:50 -04:00
|
|
|
, VelocityDisplay (trackview.editor(), *mrv.midi_stream_view(), mrv, *base_rect, *_note_group, MidiGhostRegion::events, MidiGhostRegion::_outline)
|
2024-09-16 20:19:40 -04:00
|
|
|
|
2023-01-08 11:52:20 -05:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
VelocityGhostRegion::~VelocityGhostRegion ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2024-09-16 20:19:40 -04:00
|
|
|
void
|
|
|
|
VelocityGhostRegion::add_note (NoteBase* nb)
|
|
|
|
{
|
|
|
|
VelocityDisplay::add_note (nb);
|
|
|
|
}
|
|
|
|
|
2023-01-11 13:51:03 -05:00
|
|
|
void
|
|
|
|
VelocityGhostRegion::set_colors ()
|
|
|
|
{
|
2023-09-29 10:49:40 -04:00
|
|
|
base_rect->set_fill_color (UIConfiguration::instance().color_mod ("ghost track base", "ghost track midi fill"));
|
2023-06-21 19:32:52 -04:00
|
|
|
|
2024-08-26 15:09:50 -04:00
|
|
|
for (auto & gev : MidiGhostRegion::events) {
|
2023-06-27 11:19:29 -04:00
|
|
|
gev.second->item->set_fill_color (gev.second->event->base_color());
|
2023-06-21 19:32:52 -04:00
|
|
|
}
|
2023-01-11 13:51:03 -05:00
|
|
|
}
|
2023-06-20 13:28:59 -04:00
|
|
|
|
|
|
|
void
|
2024-08-26 15:09:50 -04:00
|
|
|
VelocityGhostRegion::remove_note (NoteBase* nb)
|
2023-07-10 19:32:18 -04:00
|
|
|
{
|
2024-08-26 15:09:50 -04:00
|
|
|
MidiGhostRegion::remove_note (nb);
|
2023-07-10 19:32:18 -04:00
|
|
|
}
|
|
|
|
|
2024-08-26 15:09:50 -04:00
|
|
|
bool
|
|
|
|
VelocityGhostRegion::base_event (GdkEvent* ev)
|
2023-06-22 19:31:53 -04:00
|
|
|
{
|
2024-08-26 15:09:50 -04:00
|
|
|
return trackview.editor().canvas_velocity_base_event (ev, base_rect);
|
2023-06-22 19:31:53 -04:00
|
|
|
}
|
|
|
|
|
2024-08-26 15:09:50 -04:00
|
|
|
bool
|
|
|
|
VelocityGhostRegion::lollevent (GdkEvent* ev, GhostEvent* gev)
|
2023-06-22 19:31:53 -04:00
|
|
|
{
|
2024-08-26 15:09:50 -04:00
|
|
|
return trackview.editor().canvas_velocity_event (ev, gev->item);
|
2023-06-22 19:31:53 -04:00
|
|
|
}
|
|
|
|
|
2024-09-16 20:19:40 -04:00
|
|
|
ArdourCanvas::Rectangle&
|
|
|
|
VelocityGhostRegion::base_item()
|
|
|
|
{
|
|
|
|
return VelocityDisplay::base_item();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VelocityGhostRegion::update_note (GhostEvent* ev)
|
|
|
|
{
|
|
|
|
VelocityDisplay::update_note (ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VelocityGhostRegion::note_selected (NoteBase* nb)
|
|
|
|
{
|
|
|
|
VelocityDisplay::note_selected (nb);
|
|
|
|
}
|
2024-09-17 00:57:17 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
VelocityGhostRegion::update_contents_height ()
|
|
|
|
{
|
|
|
|
VelocityDisplay::redisplay ();
|
|
|
|
}
|
2024-09-17 11:35:02 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
VelocityGhostRegion::update_hit (GhostEvent* gev)
|
|
|
|
{
|
|
|
|
update_note (gev);
|
|
|
|
}
|