basics of region property editor in pianoroll window

This commit is contained in:
Paul Davis
2025-02-08 10:25:17 -07:00
parent a288698756
commit d68be57c43
7 changed files with 22 additions and 9 deletions

View File

@@ -55,7 +55,7 @@ _peak_amplitude_thread (void* arg)
}
AudioRegionEditor::AudioRegionEditor (Session* s, AudioRegionView* arv)
: RegionEditor (s, arv)
: RegionEditor (s, arv->region())
, _arv (arv)
, _audio_region (arv->audio_region ())
, _gain_adjustment (accurate_coefficient_to_dB (fabsf (_audio_region->scale_amplitude ())), -40.0, +40.0, 0.1, 1.0, 0)
@@ -129,7 +129,7 @@ AudioRegionEditor::AudioRegionEditor (Session* s, AudioRegionView* arv)
_fade_before_fx_toggle.signal_toggled ().connect (sigc::mem_fun (*this, &AudioRegionEditor::fade_before_fx_toggle_changed));
_show_on_touch.signal_toggled ().connect (sigc::mem_fun (*this, &AudioRegionEditor::show_on_touch_changed));
arv->region_line_changed.connect ((sigc::mem_fun (*this, &AudioRegionEditor::refill_region_line)));
_arv->region_line_changed.connect ((sigc::mem_fun (*this, &AudioRegionEditor::refill_region_line)));
_peak_amplitude.property_editable () = false;
_peak_amplitude.set_width_chars (9);

View File

@@ -18,11 +18,14 @@
#include "pbd/compose.h"
#include "ardour/midi_region.h"
#include "gtkmm2ext/doi.h"
#include "ardour_ui.h"
#include "pianoroll.h"
#include "pianoroll_window.h"
#include "region_editor.h"
using namespace ARDOUR;
@@ -33,8 +36,8 @@ PianorollWindow::PianorollWindow (std::string const & name, Session& s)
pianoroll->set_session (&s);
pianoroll->viewport().set_size_request (600, 120);
add (pianoroll->contents());
pianoroll->contents().show ();
add (hpacker);
hpacker.show ();
}
PianorollWindow::~PianorollWindow ()
@@ -47,6 +50,13 @@ PianorollWindow::set (std::shared_ptr<MidiTrack> track, std::shared_ptr<MidiRegi
{
pianoroll->set_track (track);
pianoroll->set_region (region);
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 ();
}
bool

View File

@@ -26,6 +26,7 @@ namespace ARDOUR {
}
class Pianoroll;
class RegionEditor;
class PianorollWindow : public ArdourWindow
{
@@ -38,5 +39,7 @@ class PianorollWindow : public ArdourWindow
bool on_delete_event (GdkEventAny*);
private:
Gtk::HBox hpacker;
Pianoroll* pianoroll;
RegionEditor* region_editor;
};

View File

@@ -69,9 +69,9 @@ Glib::RefPtr<Gtk::ActionGroup> RegionEditor::RegionFxBox::rfx_box_actions;
Gtkmm2ext::Bindings* RegionEditor::RegionFxBox::bindings = 0;
RegionEditor::RegionFxBox* RegionEditor::RegionFxBox::current_rfx_box = 0;
RegionEditor::RegionEditor (Session* s, RegionView* rv)
RegionEditor::RegionEditor (Session* s, std::shared_ptr<Region> r)
: SessionHandlePtr (s)
, _region (rv->region ())
, _region (r)
, _name_label (_("Name:"))
, _audition_button (_("Audition"))
, _clock_group (new ClockGroup)

View File

@@ -61,7 +61,7 @@ class ClockGroup;
class RegionEditor : public ArdourWidgets::Frame, public ARDOUR::SessionHandlePtr
{
public:
RegionEditor (ARDOUR::Session*, RegionView*);
RegionEditor (ARDOUR::Session*, std::shared_ptr<ARDOUR::Region>);
virtual ~RegionEditor ();
std::shared_ptr<ARDOUR::Region> region () const { return _region; }

View File

@@ -31,7 +31,7 @@ RegionEditorWindow::RegionEditorWindow (Session* s, RegionView* rv)
if (arv) {
_region_editor = new AudioRegionEditor (s, arv);
} else {
_region_editor = new RegionEditor (s, rv);
_region_editor = new RegionEditor (s, rv->region());
}
add (*_region_editor);
set_name ("RegionEditorWindow");

View File

@@ -169,7 +169,7 @@ SelectionPropertiesBox::selection_changed ()
if (arv) {
_region_editor = new AudioRegionEditor (_session, arv);
} else {
_region_editor = new RegionEditor (_session, rv);
_region_editor = new RegionEditor (_session, rv->region());
}
// TODO subscribe to region name changes
_region_editor->set_label (string_compose (_("Region '%1'"), rv->region()->name ()));