mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-15 19:16:40 +01:00
fix the visible channel in a pianoroll if the model has no channel data
This commit is contained in:
parent
91f6245f44
commit
9415dad9cc
3 changed files with 2 additions and 174 deletions
|
|
@ -1,98 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2011-2017 Paul Davis <paul@linuxaudiosystems.com>
|
||||
* Copyright (C) 2021 Ben Loftis <ben@harrisonconsoles.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"
|
||||
#include <algorithm>
|
||||
|
||||
#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<Region> r, TriggerReference /*notused*/)
|
||||
{
|
||||
delete _midi_view;
|
||||
_midi_view = nullptr;
|
||||
|
||||
if (!r) {
|
||||
set_session (nullptr);
|
||||
return;
|
||||
}
|
||||
|
||||
set_session (&r->session ());
|
||||
|
||||
editor->set_region (r);
|
||||
}
|
||||
|
||||
|
|
@ -1,75 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2021 Paul Davis <paul@linuxaudiosystems.com>
|
||||
* Copyright (C) 2021 Ben Loftis <ben@harrisonconsoles.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.
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <ytkmm/box.h>
|
||||
#include <ytkmm/label.h>
|
||||
#include <ytkmm/table.h>
|
||||
|
||||
#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::Region>, 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<ARDOUR::Region> _region;
|
||||
};
|
||||
|
||||
|
|
@ -385,7 +385,8 @@ MidiView::set_model (std::shared_ptr<MidiModel> m)
|
|||
}
|
||||
|
||||
if (n == 16) {
|
||||
set_visible_channel (n);
|
||||
/* No channel data in model, use channel 0 (1) */
|
||||
set_visible_channel (0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue