2025-01-08 18:05:11 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (C) 2025 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 "pbd/compose.h"
|
|
|
|
|
|
2025-02-08 10:25:17 -07:00
|
|
|
#include "ardour/midi_region.h"
|
2025-07-29 14:55:46 -06:00
|
|
|
#include "ardour/midi_track.h"
|
2025-02-08 10:25:17 -07:00
|
|
|
|
2025-01-28 13:29:11 -07:00
|
|
|
#include "gtkmm2ext/doi.h"
|
|
|
|
|
|
2025-01-26 19:57:41 -07:00
|
|
|
#include "ardour_ui.h"
|
2025-01-08 18:05:11 -07:00
|
|
|
#include "pianoroll.h"
|
|
|
|
|
#include "pianoroll_window.h"
|
2025-02-08 10:25:17 -07:00
|
|
|
#include "region_editor.h"
|
2025-01-08 18:05:11 -07:00
|
|
|
|
|
|
|
|
using namespace ARDOUR;
|
|
|
|
|
|
2025-01-20 18:05:19 -07:00
|
|
|
PianorollWindow::PianorollWindow (std::string const & name, Session& s)
|
2025-01-08 18:05:11 -07:00
|
|
|
: ArdourWindow (string_compose ("%1 - %2", PROGRAM_NAME, name))
|
2025-03-15 16:07:39 -06:00
|
|
|
, pianoroll (new Pianoroll (name, true))
|
2025-03-12 23:20:35 +01:00
|
|
|
, region_editor (nullptr)
|
2025-01-08 18:05:11 -07:00
|
|
|
{
|
2025-01-20 18:05:19 -07:00
|
|
|
pianoroll->set_session (&s);
|
2025-07-29 14:55:46 -06:00
|
|
|
pianoroll->get_canvas_viewport()->set_size_request (600, 120);
|
2025-01-08 18:05:11 -07:00
|
|
|
|
2025-02-08 10:25:17 -07:00
|
|
|
add (hpacker);
|
|
|
|
|
hpacker.show ();
|
2025-01-08 18:05:11 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
PianorollWindow::~PianorollWindow ()
|
|
|
|
|
{
|
|
|
|
|
delete pianoroll;
|
2025-03-12 23:20:35 +01:00
|
|
|
delete region_editor;
|
2025-01-08 18:05:11 -07:00
|
|
|
}
|
2025-01-20 18:05:19 -07:00
|
|
|
|
2025-07-04 12:22:55 -06:00
|
|
|
void
|
|
|
|
|
PianorollWindow::set_show_source (bool yn)
|
|
|
|
|
{
|
|
|
|
|
pianoroll->set_show_source (yn);
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-20 18:05:19 -07:00
|
|
|
void
|
|
|
|
|
PianorollWindow::set (std::shared_ptr<MidiTrack> track, std::shared_ptr<MidiRegion> region)
|
|
|
|
|
{
|
|
|
|
|
pianoroll->set_track (track);
|
|
|
|
|
pianoroll->set_region (region);
|
2025-02-08 10:25:17 -07:00
|
|
|
|
2025-03-12 23:20:35 +01:00
|
|
|
delete region_editor;
|
2025-02-08 10:25:17 -07:00
|
|
|
region_editor = new RegionEditor (pianoroll->session(), region);
|
|
|
|
|
hpacker.pack_start (*region_editor, false, false);
|
|
|
|
|
hpacker.pack_start (pianoroll->contents(), true, true);
|
|
|
|
|
|
|
|
|
|
region_editor->show ();
|
|
|
|
|
pianoroll->contents().show ();
|
2025-01-20 18:05:19 -07:00
|
|
|
}
|
2025-01-26 19:57:41 -07:00
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
PianorollWindow::on_key_press_event (GdkEventKey* ev)
|
|
|
|
|
{
|
|
|
|
|
return ARDOUR_UI::instance()->key_event_handler (ev, this);
|
|
|
|
|
}
|
2025-01-28 13:29:11 -07:00
|
|
|
|
|
|
|
|
bool
|
|
|
|
|
PianorollWindow::on_delete_event (GdkEventAny*)
|
|
|
|
|
{
|
|
|
|
|
delete_when_idle (this);
|
|
|
|
|
return true;
|
|
|
|
|
}
|