From 9415dad9ccbc20b8bea22a9b979fb8dc1f3cc1f3 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Wed, 16 Apr 2025 20:43:10 -0600 Subject: [PATCH] fix the visible channel in a pianoroll if the model has no channel data --- gtk2_ardour/midi_clip_editor.cc | 98 --------------------------------- gtk2_ardour/midi_clip_editor.h | 75 ------------------------- gtk2_ardour/midi_view.cc | 3 +- 3 files changed, 2 insertions(+), 174 deletions(-) delete mode 100644 gtk2_ardour/midi_clip_editor.cc delete mode 100644 gtk2_ardour/midi_clip_editor.h diff --git a/gtk2_ardour/midi_clip_editor.cc b/gtk2_ardour/midi_clip_editor.cc deleted file mode 100644 index 1876d2f922..0000000000 --- a/gtk2_ardour/midi_clip_editor.cc +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2011-2017 Paul Davis - * Copyright (C) 2021 Ben Loftis - * - * 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" -#include - -#include "gtkmm2ext/actions.h" -#include "gtkmm2ext/gui_thread.h" -#include "gtkmm2ext/utils.h" - -#include "canvas/canvas.h" -#include "canvas/debug.h" -#include "canvas/utils.h" - -#include "ardour/location.h" -#include "ardour/profile.h" -#include "ardour/session.h" - -#include "widgets/ardour_button.h" - -#include "audio_clock.h" -#include "editor_automation_line.h" -#include "control_point.h" -#include "editor.h" -#include "pianoroll.h" -#include "region_view.h" -#include "ui_config.h" - -#include "midi_clip_editor.h" - -#include "pbd/i18n.h" - -using namespace Gtk; -using namespace ARDOUR; -using namespace ArdourCanvas; -using std::max; -using std::min; - - -MidiClipEditorBox::MidiClipEditorBox () -{ - _header_label.set_text (_("MIDI Region Trimmer:")); - _header_label.set_alignment (0.0, 0.5); - pack_start (_header_label, false, false, 6); - - editor = new Pianoroll (X_("MIDICueEditor")); - editor->viewport().set_size_request (600, 120); - - pack_start (editor->viewport(), true, true); - editor->viewport().show (); -} - -MidiClipEditorBox::~MidiClipEditorBox () -{ - delete editor; -} - -void -MidiClipEditorBox::set_session (Session* s) -{ - SessionHandlePtr::set_session (s); - if (s) { - editor->set_session (s); - } -} - -void -MidiClipEditorBox::set_region (std::shared_ptr r, TriggerReference /*notused*/) -{ - delete _midi_view; - _midi_view = nullptr; - - if (!r) { - set_session (nullptr); - return; - } - - set_session (&r->session ()); - - editor->set_region (r); -} - diff --git a/gtk2_ardour/midi_clip_editor.h b/gtk2_ardour/midi_clip_editor.h deleted file mode 100644 index b56b8ed354..0000000000 --- a/gtk2_ardour/midi_clip_editor.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2021 Paul Davis - * Copyright (C) 2021 Ben Loftis - * - * 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. - */ - -#pragma once - -#include - -#include -#include -#include - -#include "ardour/ardour.h" -#include "ardour/session_handle.h" - -#include "gtkmm2ext/cairo_packer.h" - -#include "canvas/canvas.h" -#include "canvas/rectangle.h" - -#include "audio_clip_editor.h" - -#include "audio_clock.h" - -namespace ARDOUR -{ - class Session; - class Location; -} - -namespace ArdourCanvas -{ - class Text; - class Polygon; -} - -class Pianoroll; - -class MidiClipEditorBox : public ClipEditorBox -{ -public: - MidiClipEditorBox (); - ~MidiClipEditorBox (); - - void set_session (ARDOUR::Session*); - - void set_region (std::shared_ptr, ARDOUR::TriggerReference); - void region_changed (const PBD::PropertyChange& what_changed); - -private: - Gtk::Label _header_label; - Gtk::Table table; - - Pianoroll* editor; - - PBD::ScopedConnection state_connection; - - std::shared_ptr _region; -}; - diff --git a/gtk2_ardour/midi_view.cc b/gtk2_ardour/midi_view.cc index c81b60e9a7..d8469e4af5 100644 --- a/gtk2_ardour/midi_view.cc +++ b/gtk2_ardour/midi_view.cc @@ -385,7 +385,8 @@ MidiView::set_model (std::shared_ptr m) } if (n == 16) { - set_visible_channel (n); + /* No channel data in model, use channel 0 (1) */ + set_visible_channel (0); } }