an initial guess at using the new region-edit-disposition parameter

No editing of the parameter yet
This commit is contained in:
Paul Davis 2025-08-18 18:26:10 -06:00 committed by Edgar Aichinger
parent 5873cf12df
commit 34e964b370
3 changed files with 55 additions and 16 deletions

View file

@ -232,6 +232,7 @@ public:
bool extend_selection_to_track (TimeAxisView&); bool extend_selection_to_track (TimeAxisView&);
void edit_region_in_pianoroll_window (); void edit_region_in_pianoroll_window ();
void maybe_edit_region_in_bottom_pane (RegionView&);
void play_selection (); void play_selection ();
void maybe_locate_with_edit_preroll (samplepos_t); void maybe_locate_with_edit_preroll (samplepos_t);

View file

@ -1912,8 +1912,29 @@ Editor::edit_region (RegionView* rv)
{ {
if (UIConfiguration::instance().get_use_double_click_to_zoom_to_selection()) { if (UIConfiguration::instance().get_use_double_click_to_zoom_to_selection()) {
temporal_zoom_selection (Both); temporal_zoom_selection (Both);
} else { return;
}
switch (UIConfiguration::instance().get_region_edit_disposition()) {
case Editing::BottomPaneOnly:
maybe_edit_region_in_bottom_pane (*rv);
break;
case Editing::OpenBottomPane:
if (!att_bottom_visible()) {
/* XXX do something */
}
maybe_edit_region_in_bottom_pane (*rv);
break;
case Editing::PreferBottomPane:
if (att_bottom_visible()) {
maybe_edit_region_in_bottom_pane (*rv);
} else {
rv->show_region_editor ();
}
break;
case Editing::NeverBottomPane:
rv->show_region_editor (); rv->show_region_editor ();
break;
} }
} }

View file

@ -1716,31 +1716,48 @@ Editor::region_selection_changed ()
} }
update_selection_markers (); update_selection_markers ();
bool pack_pianoroll = false;
if (selection->regions.size () == 1) { if (selection->regions.size () == 1) {
RegionView* rv = (selection->regions.front ()); RegionView* rv = (selection->regions.front ());
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv); assert (rv);
if (mrv) { maybe_edit_region_in_bottom_pane (*rv);
std::shared_ptr<ARDOUR::MidiTrack> mt = std::dynamic_pointer_cast<ARDOUR::MidiTrack> (mrv->midi_view()->track()); } else {
std::shared_ptr<MidiRegion> mr = std::dynamic_pointer_cast<MidiRegion>(mrv->region()); Gtkmm2ext::container_clear (_bottom_hbox);
if (mrv && mt && mr) { }
_pianoroll->set_track (mt); }
_pianoroll->set_region (mr);
pack_pianoroll = true; void
} Editor::maybe_edit_region_in_bottom_pane (RegionView& rv)
{
Gtkmm2ext::container_clear (_bottom_hbox);
if (UIConfiguration::instance().get_region_edit_disposition() == Editing::NeverBottomPane) {
/* Just the properties box. XXX does that make sense ? */
_bottom_hbox.pack_start (*_properties_box, true, true);
_properties_box->show ();
return;
}
bool pack_pianoroll = false;
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (&rv);
if (mrv) {
std::shared_ptr<ARDOUR::MidiTrack> mt = std::dynamic_pointer_cast<ARDOUR::MidiTrack> (mrv->midi_view()->track());
std::shared_ptr<MidiRegion> mr = std::dynamic_pointer_cast<MidiRegion>(mrv->region());
if (mrv && mt && mr) {
_pianoroll->set_track (mt);
_pianoroll->set_region (mr);
pack_pianoroll = true;
} }
} }
Gtkmm2ext::container_clear (_bottom_hbox);
if (pack_pianoroll) { if (pack_pianoroll) {
_bottom_hbox.pack_start(*_properties_box, false, false); _bottom_hbox.pack_start (*_properties_box, false, false);
_bottom_hbox.pack_start(_pianoroll->contents(), true, true); _bottom_hbox.pack_start (_pianoroll->contents(), true, true);
_pianoroll->contents().hide (); _pianoroll->contents().hide ();
_pianoroll->contents().show_all (); _pianoroll->contents().show_all ();
_properties_box->show (); _properties_box->show ();
} else { } else {
_bottom_hbox.pack_start(*_properties_box, true, true); _bottom_hbox.pack_start (*_properties_box, true, true);
_properties_box->show (); _properties_box->show ();
} }
} }