13
0

Pack Pages using Tabbable constructs

This commit is contained in:
Ben Loftis 2024-10-17 15:48:58 -05:00 committed by Robin Gareus
parent 948b49d72d
commit 4b1e09f810
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
12 changed files with 90 additions and 102 deletions

View File

@ -229,7 +229,7 @@ static const gchar *_rb_opt_strings[] = {
#endif
Editor::Editor ()
: PublicEditor (global_hpacker)
: PublicEditor ()
, editor_mixer_strip_width (Wide)
, constructed (false)
, _properties_box (0)
@ -660,23 +660,13 @@ Editor::Editor ()
_summary_hbox.pack_start (*summary_arrows_right, false, false);
editor_summary_pane.add (_summary_hbox);
edit_pane.set_check_divider_position (true);
edit_pane.add (editor_summary_pane);
_editor_list_vbox.pack_start (_the_notebook);
_editor_list_vbox.pack_start (*_properties_box, false, false, 0);
edit_pane.add (_editor_list_vbox);
edit_pane.set_child_minsize (_editor_list_vbox, 30); /* rough guess at width of notebook tabs */
edit_pane.set_drag_cursor (*_cursors->expand_left_right);
content_right_pane.set_drag_cursor (*_cursors->expand_left_right);
editor_summary_pane.set_drag_cursor (*_cursors->expand_up_down);
float fract;
if (!settings || !settings->get_property ("edit-horizontal-pane-pos", fract) || fract > 1.0) {
/* initial allocation is 90% to canvas, 10% to notebook */
fract = 0.90;
}
edit_pane.set_divider (0, fract);
if (!settings || !settings->get_property ("edit-vertical-pane-pos", fract) || fract > 1.0) {
/* initial allocation is 90% to canvas, 10% to summary */
fract = 0.90;
@ -686,20 +676,6 @@ Editor::Editor ()
global_vpacker.set_spacing (0);
global_vpacker.set_border_width (0);
/* the next three EventBoxes provide the ability for their child widgets to have a background color. That is all. */
Gtk::EventBox* ebox = manage (new Gtk::EventBox); // a themeable box
ebox->set_name("EditorWindow");
ebox->add (ebox_hpacker);
Gtk::EventBox* epane_box = manage (new EventBoxExt); // a themeable box
epane_box->set_name("EditorWindow");
epane_box->add (edit_pane);
Gtk::EventBox* epane_box2 = manage (new EventBoxExt); // a themeable box
epane_box2->set_name("EditorWindow");
epane_box2->add (global_vpacker);
ArdourWidgets::ArdourDropShadow *toolbar_shadow = manage (new (ArdourWidgets::ArdourDropShadow));
toolbar_shadow->set_size_request (-1, 4);
toolbar_shadow->set_mode(ArdourWidgets::ArdourDropShadow::DropShadowBoth);
@ -707,16 +683,21 @@ Editor::Editor ()
toolbar_shadow->show();
global_vpacker.pack_start (*toolbar_shadow, false, false);
global_vpacker.pack_start (*ebox, false, false);
global_vpacker.pack_start (*epane_box, true, true);
global_hpacker.pack_start (*epane_box2, true, true);
global_vpacker.pack_start (editor_summary_pane, true, true);
/* pack all the main pieces into appropriate containers from _tabbable
*/
content_app_bar.add (_application_bar);
content_att_right.add (_editor_list_vbox);
content_toolbar.add (ebox_hpacker);
content_innermost_hbox.add (global_vpacker);
/* need to show the "contents" widget so that notebook will show if tab is switched to
*/
global_hpacker.show ();
content_hbox.show ();
ebox_hpacker.show();
ebox->show();
global_vpacker.show();
/* register actions now so that set_state() can find them and set toggles/checks etc */
@ -2329,7 +2310,6 @@ Editor::get_state () const
node->add_child_nocopy (Tabbable::get_state());
node->set_property("edit-horizontal-pane-pos", edit_pane.get_divider ());
node->set_property("notebook-shrunk", _notebook_shrunk);
node->set_property("edit-vertical-pane-pos", editor_summary_pane.get_divider());
@ -5511,7 +5491,7 @@ Editor::session_going_away ()
if (current_mixer_strip) {
if (current_mixer_strip->get_parent() != 0) {
global_hpacker.remove (*current_mixer_strip);
content_att_left.remove ();
}
delete current_mixer_strip;
current_mixer_strip = 0;
@ -5660,16 +5640,16 @@ Editor::notebook_tab_clicked (GdkEventButton* ev, Gtk::Widget* page)
if (_notebook_shrunk) {
if (pre_notebook_shrink_pane_width) {
edit_pane.set_divider (0, *pre_notebook_shrink_pane_width);
content_right_pane.set_divider (0, *pre_notebook_shrink_pane_width);
}
_notebook_shrunk = false;
} else {
pre_notebook_shrink_pane_width = edit_pane.get_divider();
pre_notebook_shrink_pane_width = content_right_pane.get_divider();
/* this expands the LHS of the edit pane to cover the notebook
PAGE but leaves the tabs visible.
*/
edit_pane.set_divider (0, edit_pane.get_divider() + page->get_width());
content_right_pane.set_divider (0, content_right_pane.get_divider() + page->get_width());
_notebook_shrunk = true;
}
}
@ -5709,7 +5689,7 @@ Editor::ui_parameter_changed (string parameter)
}
_cursors->set_cursor_set (UIConfiguration::instance().get_icon_set());
_cursor_stack.push_back(_cursors->grabber);
edit_pane.set_drag_cursor (*_cursors->expand_left_right);
content_right_pane.set_drag_cursor (*PublicEditor::instance().cursors()->expand_left_right);
editor_summary_pane.set_drag_cursor (*_cursors->expand_up_down);
} else if (parameter == "sensitize-playhead") {

View File

@ -589,7 +589,6 @@ private:
void add_notebook_page (std::string const&, Gtk::Widget&);
bool notebook_tab_clicked (GdkEventButton*, Gtk::Widget*);
ArdourWidgets::HPane edit_pane;
ArdourWidgets::VPane editor_summary_pane;
Gtk::EventBox meter_base;
@ -766,7 +765,6 @@ private:
void timeaxisview_deleted (TimeAxisView*);
void add_vcas (ARDOUR::VCAList&);
Gtk::HBox global_hpacker;
Gtk::VBox global_vpacker;
Gdk::Cursor* which_track_cursor () const;

View File

@ -754,7 +754,7 @@ void
Editor::load_bindings ()
{
bindings = Bindings::get_bindings (editor_name());
global_hpacker.set_data ("ardour-bindings", bindings);
contents().set_data ("ardour-bindings", bindings);
/* This set of bindings may expand in the future to include things
* other than MIDI editing, but for now this is all we've got as far as

View File

@ -151,8 +151,8 @@ Editor::show_editor_mixer (bool yn)
}
if (current_mixer_strip && current_mixer_strip->get_parent() == 0) {
global_hpacker.pack_start (*current_mixer_strip, Gtk::PACK_SHRINK );
global_hpacker.reorder_child (*current_mixer_strip, 0);
content_hbox.pack_start (*current_mixer_strip, Gtk::PACK_SHRINK );
content_hbox.reorder_child (*current_mixer_strip, 0);
current_mixer_strip->show ();
}
@ -165,7 +165,7 @@ Editor::show_editor_mixer (bool yn)
if (current_mixer_strip) {
if (current_mixer_strip->get_parent() != 0) {
global_hpacker.remove (*current_mixer_strip);
content_hbox.remove (*current_mixer_strip);
}
}
}

View File

@ -55,6 +55,7 @@
#include "ardour/monitor_control.h"
#include "ardour/panner_shell.h"
#include "ardour/plugin_manager.h"
#include "ardour/profile.h"
#include "ardour/route_group.h"
#include "ardour/selection.h"
#include "ardour/session.h"
@ -132,7 +133,7 @@ Mixer_UI::instance ()
}
Mixer_UI::Mixer_UI ()
: Tabbable (_("Mixer"), X_("mixer"), &_content)
: Tabbable (_("Mixer"), X_("mixer"))
, plugin_search_clear_button (X_("Clear"))
, _mixer_scene_release (0)
, no_track_list_redisplay (false)
@ -161,7 +162,7 @@ Mixer_UI::Mixer_UI ()
Glib::RefPtr<ToggleAction> fb_act = ActionManager::get_toggle_action ("Mixer", "ToggleFoldbackStrip");
fb_act->set_sensitive (false);
_content.set_data ("ardour-bindings", bindings);
contents().set_data ("ardour-bindings", bindings);
PresentationInfo::Change.connect (*this, invalidator (*this), std::bind (&Mixer_UI::presentation_info_changed, this, _1), gui_context());
Route::FanOut.connect (*this, invalidator (*this), std::bind (&Mixer_UI::fan_out, this, _1, false, true), gui_context());
@ -375,27 +376,26 @@ Mixer_UI::Mixer_UI ()
global_hpacker.pack_start (inner_pane, true, true);
global_hpacker.pack_start (out_packer, false, false);
list_hpane.set_check_divider_position (true);
list_hpane.add (list_vpacker);
list_hpane.add (global_hpacker);
list_hpane.set_child_minsize (list_vpacker, 30);
rhs_pane1.set_divider (0, .6);
rhs_pane2.set_divider (0, .7);
list_hpane.set_divider (0, .2);
inner_pane.set_divider (0, .8);
rhs_pane1.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down);
rhs_pane2.set_drag_cursor (*PublicEditor::instance().cursors()->expand_up_down);
list_hpane.set_drag_cursor (*PublicEditor::instance().cursors()->expand_left_right);
inner_pane.set_drag_cursor (*PublicEditor::instance().cursors()->expand_left_right);
_content.pack_start (list_hpane, true, true);
content_app_bar.add (_application_bar);
content_innermost_hbox.add (global_hpacker);
if (!Profile->get_mixbus ()) {
content_att_left.add (list_vpacker);
} else {
content_att_right.add (list_vpacker);
}
update_title ();
_content.show ();
_content.set_name ("MixerWindow");
contents().set_name ("MixerWindow");
global_hpacker.show();
scroller.show();
@ -420,7 +420,6 @@ Mixer_UI::Mixer_UI ()
vca_label.show();
vca_scroller_base.show();
out_packer.show();
list_hpane.show();
group_display.show();
favorite_plugins_display.show();
@ -1483,7 +1482,7 @@ Mixer_UI::stop_updating ()
void
Mixer_UI::fast_update_strips ()
{
if (!UIConfiguration::instance().get_no_strobe() && _content.get_mapped () && _session) {
if (!UIConfiguration::instance().get_no_strobe() && contents().get_mapped () && _session) {
for (auto & s : strips) {
s->fast_update ();
}
@ -2648,11 +2647,6 @@ Mixer_UI::set_state (const XMLNode& node, int version)
}
rhs_pane2.set_divider (0, fract);
if (!node.get_property ("mixer-list-hpane-pos", fract) || fract > 1.0) {
fract = 0.2f;
}
list_hpane.set_divider (0, fract);
if (!node.get_property ("mixer-inner-pane-pos", fract) || fract > 1.0) {
fract = 0.8f;
}
@ -2699,7 +2693,6 @@ Mixer_UI::get_state () const
node->set_property (X_("mixer-rhs-pane1-pos"), rhs_pane1.get_divider());
node->set_property (X_("mixer-rhs_pane2-pos"), rhs_pane2.get_divider());
node->set_property (X_("mixer-list-hpane-pos"), list_hpane.get_divider());
node->set_property (X_("mixer-inner-pane-pos"), inner_pane.get_divider());
node->set_property ("narrow-strips", (_strip_width == Narrow));
@ -3024,7 +3017,7 @@ Mixer_UI::strip_by_x (int x)
for (list<MixerStrip*>::iterator i = strips.begin(); i != strips.end(); ++i) {
int x1, x2, y;
(*i)->translate_coordinates (_content, 0, 0, x1, y);
(*i)->translate_coordinates (contents(), 0, 0, x1, y);
x2 = x1 + (*i)->get_width();
if (x >= x1 && x <= x2) {

View File

@ -177,7 +177,7 @@ protected:
private:
Mixer_UI ();
static Mixer_UI* _instance;
Gtk::VBox _content;
Gtk::HBox global_hpacker;
Gtk::VBox global_vpacker;
Gtk::ScrolledWindow scroller;
@ -210,7 +210,6 @@ private:
Gtk::Label vca_label;
Gtk::EventBox vca_scroller_base;
Gtk::HBox out_packer;
ArdourWidgets::HPane list_hpane;
Gtk::EventBox _mixer_scene_spacer;
Gtk::Frame _mixer_scene_frame;

View File

@ -31,9 +31,9 @@ const int PublicEditor::horizontal_spacing = 6;
ARDOUR::DataType PublicEditor::pbdid_dragged_dt = ARDOUR::DataType::NIL;
PublicEditor::PublicEditor (Gtk::Widget& content)
PublicEditor::PublicEditor ()
: EditingContext (X_("Editor"))
, Tabbable (_("Editor"), X_("editor"), &content)
, Tabbable (_("Editor"), X_("editor"))
{
_suspend_route_redisplay_counter.store (0);
}

View File

@ -126,7 +126,7 @@ using ARDOUR::samplecnt_t;
class PublicEditor : public EditingContext, public ArdourWidgets::Tabbable
{
public:
PublicEditor (Gtk::Widget& content);
PublicEditor ();
virtual ~PublicEditor ();
/** @return Singleton PublicEditor instance */

View File

@ -78,7 +78,7 @@ using namespace Menu_Helpers;
#define PX_SCALE(px) std::max ((float)px, rintf ((float)px* UIConfiguration::instance ().get_ui_scale ()))
RecorderUI::RecorderUI ()
: Tabbable (_("Recorder"), X_("recorder"), &_content)
: Tabbable (_("Recorder"), X_("recorder"))
, _toolbar_sep (1.0)
, _btn_rec_all (_("All"))
, _btn_rec_none (_("None"))
@ -193,9 +193,10 @@ RecorderUI::RecorderUI ()
_pane.add (_meter_scroller);
/* Top-level VBox */
_content.pack_start (_toolbar_sep, false, false, 1);
_content.pack_start (_toolbar, false, false, 2);
_content.pack_start (_pane, true, true);
content_app_bar.add (_application_bar);
//content_att_right.add (_editor_list_vbox); // TODO
content_toolbar.add(_toolbar);
content_innermost_hbox.add (_pane);
/* button_table setup is similar to transport_table in ardour_ui */
int vpadding = 1;
@ -280,10 +281,9 @@ RecorderUI::RecorderUI ()
_meter_area.show ();
_meter_scroller.show ();
_pane.show ();
_content.show ();
/* setup keybidings */
_content.set_data ("ardour-bindings", bindings);
contents().set_data ("ardour-bindings", bindings);
/* subscribe to signals */
AudioEngine::instance ()->Running.connect (_engine_connections, invalidator (*this), std::bind (&RecorderUI::start_updating, this), gui_context ());

View File

@ -126,7 +126,6 @@ private:
static int calc_columns (int child_width, int parent_width);
Gtkmm2ext::Bindings* bindings;
Gtk::VBox _content;
Gtk::HBox _toolbar;
Gtk::Table _button_table;
ArdourWidgets::VPane _pane;

View File

@ -66,11 +66,12 @@ using namespace Gtk;
using namespace std;
TriggerPage::TriggerPage ()
: Tabbable (_("Cues"), X_("trigger"), &_content)
: Tabbable (_("Cues"), X_("trigger"))
, _cue_area_frame (0.5, 0, 1.0, 0)
, _cue_box (16, 16 * TriggerBox::default_triggers_per_box)
, _master_widget (16, 16)
, _master (_master_widget.root ())
, _show_bottom_pane (false)
, _selection (*this, *this)
{
load_bindings ();
@ -126,16 +127,11 @@ TriggerPage::TriggerPage ()
_sidebar_notebook.popup_disable ();
_sidebar_notebook.set_tab_pos (Gtk::POS_RIGHT);
_sidebar_vbox.pack_start (_sidebar_notebook);
add_sidebar_page (_("Clips"), _trigger_clip_picker);
add_sidebar_page (_("Tracks"), _trigger_route_list.widget ());
add_sidebar_page (_("Sources"), _trigger_source_list.widget ());
add_sidebar_page (_("Regions"), _trigger_region_list.widget ());
/* Upper pane ([slot | strips] | file browser) */
_pane_upper.add (_strip_group_box);
_pane_upper.add (_sidebar_vbox);
_midi_editor = new MidiCueEditor;
/* Bottom -- Properties of selected Slot/Region */
@ -152,15 +148,25 @@ TriggerPage::TriggerPage ()
table->attach (_midi_editor->toolbox(), col, col + 1, 0, 1, Gtk::EXPAND|Gtk::FILL, Gtk::EXPAND|Gtk::FILL);
++col;
table->show_all ();
_parameter_box.pack_start (*table);
_parameter_box.set_no_show_all ();
/* Top-level Layout */
_content.add (_pane_upper);
_content.add (_parameter_box);
_content.show ();
content_app_bar.add (_application_bar);
content_innermost_hbox.add (_pane);
_pane.add (_strip_group_box);
/* we cannot `content_midlevel_vbox.remove(_content_att_bottom)` and add it to the _pane
* because visibility updates are not propagated upward, and the pane will not collapse
* when the _parameter_box is hidden
*/
_pane.add (_parameter_box);
content_att_right.add (_sidebar_notebook);
/* Show all */
_pane_upper.show ();
_strip_group_box.show ();
_strip_scroller.show ();
_strip_packer.show ();
@ -170,7 +176,7 @@ TriggerPage::TriggerPage ()
_sidebar_notebook.show_all ();
/* setup keybidings */
_content.set_data ("ardour-bindings", bindings);
contents().set_data ("ardour-bindings", bindings);
/* subscribe to signals */
Config->ParameterChanged.connect (*this, invalidator (*this), std::bind (&TriggerPage::parameter_changed, this, _1), gui_context ());
@ -178,14 +184,6 @@ TriggerPage::TriggerPage ()
/* init */
update_title ();
/* Restore pane state */
float fract;
XMLNode const* settings = ARDOUR_UI::instance ()->trigger_page_settings ();
if (!settings || !settings->get_property ("triggerpage-hpane-pos", fract) || fract > 1.0) {
fract = 0.75f;
}
_pane_upper.set_divider (0, fract);
}
TriggerPage::~TriggerPage ()
@ -216,13 +214,28 @@ TriggerPage::use_own_window (bool and_fill_it)
return win;
}
void
TriggerPage::showhide_att_bottom (bool yn)
{
if (_show_bottom_pane == yn) {
return;
}
_show_bottom_pane = yn;
if (!_show_bottom_pane) {
_parameter_box.hide ();
} else if (!Editor::instance ().get_selection ().triggers.empty ()) {
_parameter_box.show ();
}
}
XMLNode&
TriggerPage::get_state () const
{
XMLNode* node = new XMLNode (X_("TriggerPage"));
node->add_child_nocopy (Tabbable::get_state ());
node->set_property (X_("triggerpage-hpane-pos"), _pane_upper.get_divider ());
node->set_property (X_("triggerpage-sidebar-page"), _sidebar_notebook.get_current_page ());
node->add_child_nocopy (_midi_editor->get_state());
@ -425,7 +438,9 @@ TriggerPage::rec_enable_changed (Trigger const * trigger)
_midi_editor->viewport().show ();
}
if (_show_bottom_pane) {
_parameter_box.show ();
}
}
void
@ -465,8 +480,10 @@ TriggerPage::selection_changed ()
_midi_editor->viewport().show ();
}
if (_show_bottom_pane) {
_parameter_box.show ();
}
}
}
void
@ -817,7 +834,7 @@ TriggerPage::stop_updating ()
void
TriggerPage::fast_update_strips ()
{
if (_content.get_mapped () && _session) {
if (contents().get_mapped () && _session) {
for (list<TriggerStrip*>::iterator i = _strips.begin (); i != _strips.end (); ++i) {
(*i)->fast_update ();
}

View File

@ -81,6 +81,8 @@ private:
void pi_property_changed (PBD::PropertyChange const&);
void stripable_property_changed (PBD::PropertyChange const&, std::weak_ptr<ARDOUR::Stripable>);
void showhide_att_bottom (bool);
void rec_state_changed ();
void rec_state_clicked ();
@ -108,9 +110,8 @@ private:
ApplicationBar _application_bar;
Gtkmm2ext::Bindings* bindings;
ArdourWidgets::VPane _content;
ArdourWidgets::HPane _pane_upper;
ArdourWidgets::VPane _pane;
Gtk::HBox _strip_group_box;
Gtk::ScrolledWindow _strip_scroller;
Gtk::HBox _strip_packer;
@ -118,7 +119,6 @@ private:
Gtk::Alignment _cue_area_frame;
Gtk::VBox _cue_area_box;
Gtk::HBox _parameter_box;
Gtk::VBox _sidebar_vbox;
Gtk::Notebook _sidebar_notebook;
TriggerClipPicker _trigger_clip_picker;
TriggerSourceList _trigger_source_list;
@ -129,6 +129,8 @@ private:
FittedCanvasWidget _master_widget;
CueMaster _master;
bool _show_bottom_pane;
SlotPropertiesBox _slot_prop_box;
AudioTriggerPropertiesBox _audio_trig_box;