Update Tabbable c'tor to allow member as top-level widget
Derived classes cannot use `Tabbable (_content_vbox,..)` `_content_vbox` is a member of Tabbable (which has not yet been initialized) at the point of construction. This breaks internal API, hence the omnibus commit
This commit is contained in:
parent
8ca9e6bcdd
commit
b2e4dd91b9
@ -132,7 +132,7 @@ Mixer_UI::instance ()
|
||||
}
|
||||
|
||||
Mixer_UI::Mixer_UI ()
|
||||
: Tabbable (_content, _("Mixer"), X_("mixer"))
|
||||
: Tabbable (_("Mixer"), X_("mixer"), &_content)
|
||||
, plugin_search_clear_button (X_("Clear"))
|
||||
, _mixer_scene_release (0)
|
||||
, no_track_list_redisplay (false)
|
||||
|
@ -33,7 +33,7 @@ ARDOUR::DataType PublicEditor::pbdid_dragged_dt = ARDOUR::DataType::NIL;
|
||||
|
||||
PublicEditor::PublicEditor (Gtk::Widget& content)
|
||||
: EditingContext (X_("Editor"))
|
||||
, Tabbable (content, _("Editor"), X_("editor"))
|
||||
, Tabbable (_("Editor"), X_("editor"), &content)
|
||||
{
|
||||
_suspend_route_redisplay_counter.store (0);
|
||||
}
|
||||
|
@ -2363,7 +2363,7 @@ MidiPortOptions::pretty_name_edit (std::string const & path, string const & new_
|
||||
RCOptionEditor::RCOptionEditor ()
|
||||
: OptionEditorContainer (Config)
|
||||
/* pack self-as-vbox into tabbable */
|
||||
, Tabbable (*this, _("Preferences"), X_("preferences"), /* detached by default */ false)
|
||||
, Tabbable (_("Preferences"), X_("preferences"), this, /* detached by default */ false)
|
||||
, _rc_config (Config)
|
||||
, _mixer_strip_visibility ("mixer-element-visibility")
|
||||
, _cairo_image_surface (0)
|
||||
|
@ -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 (_content, _("Recorder"), X_("recorder"))
|
||||
: Tabbable (_("Recorder"), X_("recorder"), &_content)
|
||||
, _toolbar_sep (1.0)
|
||||
, _btn_rec_all (_("All"))
|
||||
, _btn_rec_none (_("None"))
|
||||
|
@ -65,7 +65,7 @@ using namespace Gtk;
|
||||
using namespace std;
|
||||
|
||||
TriggerPage::TriggerPage ()
|
||||
: Tabbable (_content, _("Cues"), X_("trigger"))
|
||||
: Tabbable (_("Cues"), X_("trigger"), &_content)
|
||||
, _cue_area_frame (0.5, 0, 1.0, 0)
|
||||
, _cue_box (16, 16 * TriggerBox::default_triggers_per_box)
|
||||
, _master_widget (16, 16)
|
||||
|
@ -37,13 +37,17 @@ using namespace Gtk;
|
||||
using namespace Gtkmm2ext;
|
||||
using namespace ArdourWidgets;
|
||||
|
||||
Tabbable::Tabbable (Gtk::Widget& w, const string& visible_name, string const & nontranslatable_name, bool tabbed_by_default)
|
||||
Tabbable::Tabbable (const string& visible_name, string const & nontranslatable_name, Widget* w, bool tabbed_by_default)
|
||||
: WindowProxy (visible_name, nontranslatable_name)
|
||||
, _contents (w)
|
||||
, _parent_notebook (0)
|
||||
, tab_requested_by_state (tabbed_by_default)
|
||||
{
|
||||
if (w) {
|
||||
_contents = w;
|
||||
} else {
|
||||
_contents = &_content_vbox;
|
||||
default_layout ();
|
||||
}
|
||||
}
|
||||
|
||||
Tabbable::~Tabbable ()
|
||||
@ -119,13 +123,13 @@ Tabbable::use_own_window (bool and_pack_it)
|
||||
Gtk::Window* win = get (true);
|
||||
|
||||
if (and_pack_it) {
|
||||
Gtk::Container* parent = _contents.get_parent();
|
||||
Gtk::Container* parent = _contents->get_parent();
|
||||
if (parent) {
|
||||
_contents.hide ();
|
||||
parent->remove (_contents);
|
||||
_contents->hide ();
|
||||
parent->remove (*_contents);
|
||||
}
|
||||
_own_notebook.append_page (_contents);
|
||||
_contents.show ();
|
||||
_own_notebook.append_page (*_contents);
|
||||
_contents->show ();
|
||||
}
|
||||
|
||||
return win;
|
||||
@ -179,7 +183,7 @@ Tabbable::get (bool create)
|
||||
void
|
||||
Tabbable::show_own_window (bool and_pack_it)
|
||||
{
|
||||
Gtk::Widget* parent = _contents.get_parent();
|
||||
Gtk::Widget* parent = _contents->get_parent();
|
||||
Gtk::Allocation alloc;
|
||||
|
||||
if (parent) {
|
||||
@ -231,7 +235,7 @@ void
|
||||
Tabbable::change_visibility ()
|
||||
{
|
||||
if (tabbed()) {
|
||||
_parent_notebook->set_current_page (_parent_notebook->page_num (_contents));
|
||||
_parent_notebook->set_current_page (_parent_notebook->page_num (*_contents));
|
||||
return;
|
||||
}
|
||||
|
||||
@ -299,22 +303,22 @@ Tabbable::attach ()
|
||||
|
||||
save_pos_and_size ();
|
||||
|
||||
_contents.hide ();
|
||||
_contents.get_parent()->remove (_contents);
|
||||
_contents->hide ();
|
||||
_contents->get_parent()->remove (*_contents);
|
||||
|
||||
/* leave the window around */
|
||||
|
||||
_window->hide ();
|
||||
}
|
||||
|
||||
_parent_notebook->append_page (_contents);
|
||||
_parent_notebook->set_tab_detachable (_contents);
|
||||
_parent_notebook->set_tab_reorderable (_contents);
|
||||
_parent_notebook->set_current_page (_parent_notebook->page_num (_contents));
|
||||
_parent_notebook->append_page (*_contents);
|
||||
_parent_notebook->set_tab_detachable (*_contents);
|
||||
_parent_notebook->set_tab_reorderable (*_contents);
|
||||
_parent_notebook->set_current_page (_parent_notebook->page_num (*_contents));
|
||||
|
||||
signal_tabbed_changed (true);
|
||||
|
||||
_contents.show ();
|
||||
_contents->show ();
|
||||
|
||||
/* have to force this on, which is semantically correct, since
|
||||
* the user has effectively asked for it.
|
||||
@ -339,7 +343,7 @@ Tabbable::tabbed () const
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_parent_notebook && (_parent_notebook->page_num (_contents) >= 0)) {
|
||||
if (_parent_notebook && (_parent_notebook->page_num (*_contents) >= 0)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -350,8 +354,8 @@ void
|
||||
Tabbable::hide_tab ()
|
||||
{
|
||||
if (tabbed()) {
|
||||
_contents.hide();
|
||||
_parent_notebook->remove_page (_contents);
|
||||
_contents->hide();
|
||||
_parent_notebook->remove_page (*_contents);
|
||||
StateChange (*this);
|
||||
}
|
||||
}
|
||||
@ -360,12 +364,12 @@ void
|
||||
Tabbable::show_tab ()
|
||||
{
|
||||
if (!window_visible() && _parent_notebook) {
|
||||
if (_contents.get_parent() == 0) {
|
||||
if (_contents->get_parent() == 0) {
|
||||
tab_requested_by_state = true;
|
||||
add_to_notebook (*_parent_notebook);
|
||||
}
|
||||
_parent_notebook->set_current_page (_parent_notebook->page_num (_contents));
|
||||
_contents.show ();
|
||||
_parent_notebook->set_current_page (_parent_notebook->page_num (*_contents));
|
||||
_contents->show ();
|
||||
current_toplevel()->present ();
|
||||
}
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ namespace ArdourWidgets {
|
||||
class LIBWIDGETS_API Tabbable : public Gtkmm2ext::WindowProxy
|
||||
{
|
||||
public:
|
||||
Tabbable (Gtk::Widget&, const std::string& user_visible_name, std::string const & untranslated_name, bool tabbed_by_default = true);
|
||||
Tabbable (const std::string& user_visible_name, std::string const & untranslated_name, Gtk::Widget* top = NULL, bool tabbed_by_default = true);
|
||||
~Tabbable ();
|
||||
|
||||
void add_to_notebook (Gtk::Notebook& notebook);
|
||||
@ -58,7 +58,7 @@ public:
|
||||
void attach ();
|
||||
void detach ();
|
||||
|
||||
Gtk::Widget& contents() const { return _contents; }
|
||||
Gtk::Widget& contents() const { return *_contents; }
|
||||
|
||||
/* this is where ArdourUI packs the tab switchers
|
||||
* (record/cues/edit/mix) into my toolbar area,
|
||||
@ -127,7 +127,6 @@ protected:
|
||||
EventBoxExt content_att_bottom; /* a placeholder for the property box, if you want one */
|
||||
/* clang-format on */
|
||||
|
||||
|
||||
/* visibility controls */
|
||||
ArdourWidgets::ArdourButton left_attachment_button;
|
||||
ArdourWidgets::ArdourButton right_attachment_button;
|
||||
@ -143,7 +142,7 @@ private:
|
||||
void window_unmapped ();
|
||||
|
||||
Gtk::VBox _content_vbox; /* this is the root widget for a full-featured tabbable, which contains: */
|
||||
Gtk::Widget& _contents; /* for most Tabbables this will be content_vbox; but rc_options, for example, does something different. */
|
||||
Gtk::Widget* _contents; /* for most Tabbables this will be content_vbox; but rc_options, for example, does something different. */
|
||||
Gtk::Notebook _own_notebook;
|
||||
Gtk::Notebook* _parent_notebook;
|
||||
bool tab_requested_by_state;
|
||||
|
Loading…
Reference in New Issue
Block a user