remove use of current_toplevel() where unnecessary, fix broken necessary cases, generally fix up show/hide/attach/detach for Tabbables

This commit is contained in:
Paul Davis 2015-07-22 17:49:41 -04:00
parent 308f6ed828
commit 16731d07d3
6 changed files with 37 additions and 11 deletions

View File

@ -332,6 +332,10 @@ _hide_splash (gpointer arg)
void
ARDOUR_UI::show_tabbable (Tabbable* t)
{
if (!t) {
return;
}
if (splash && splash->is_visible()) {
// in 2 seconds, hide the splash screen
Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (_hide_splash), this), 2000);
@ -343,12 +347,18 @@ ARDOUR_UI::show_tabbable (Tabbable* t)
void
ARDOUR_UI::hide_tabbable (Tabbable* t)
{
if (!t) {
return;
}
t->make_invisible ();
}
void
ARDOUR_UI::attach_tabbable (Tabbable* t)
{
if (!t) {
return;
}
if (splash && splash->is_visible()) {
// in 2 seconds, hide the splash screen
Glib::signal_timeout().connect (sigc::bind (sigc::ptr_fun (_hide_splash), this), 2000);
@ -360,6 +370,9 @@ ARDOUR_UI::attach_tabbable (Tabbable* t)
void
ARDOUR_UI::detach_tabbable (Tabbable* t)
{
if (!t) {
return;
}
t->detach ();
}

View File

@ -85,6 +85,7 @@ ARDOUR_UI::create_editor ()
return -1;
}
editor->Realized.connect (sigc::mem_fun (*this, &ARDOUR_UI::editor_realized));
editor->signal_event().connect (sigc::bind (sigc::ptr_fun (&Keyboard::catch_user_event_for_pre_dialog_focus), editor));

View File

@ -4203,9 +4203,12 @@ Editor::maximise_editing_space ()
return;
}
current_toplevel()->fullscreen ();
Gtk::Window* toplevel = current_toplevel();
_maximised = true;
if (toplevel) {
toplevel->fullscreen ();
_maximised = true;
}
}
void
@ -4215,9 +4218,12 @@ Editor::restore_editing_space ()
return;
}
current_toplevel()->unfullscreen();
Gtk::Window* toplevel = current_toplevel();
_maximised = false;
if (toplevel) {
toplevel->unfullscreen();
_maximised = false;
}
}
/**
@ -4989,7 +4995,6 @@ Editor::first_idle ()
if (track_views.size() > 1) {
Timers::TimerSuspender t;
dialog = new MessageDialog (
*current_toplevel(),
string_compose (_("Please wait while %1 loads visual data."), PROGRAM_NAME),
true
);

View File

@ -3762,12 +3762,14 @@ MarkerDrag::MarkerDrag (Editor* e, ArdourCanvas::Item* i)
, _selection_changed (false)
{
DEBUG_TRACE (DEBUG::Drags, "New MarkerDrag\n");
Gtk::Window* toplevel = _editor->current_toplevel();
_marker = reinterpret_cast<Marker*> (_item->get_data ("marker"));
_marker = reinterpret_cast<ArdourMarker*> (_item->get_data ("marker"));
assert (_marker);
_points.push_back (ArdourCanvas::Duple (0, 0));
_points.push_back (ArdourCanvas::Duple (0, physical_screen_height (_editor->current_toplevel()->get_window())));
_points.push_back (ArdourCanvas::Duple (0, toplevel ? physical_screen_height (toplevel->get_window()) : 900));
}
MarkerDrag::~MarkerDrag ()

View File

@ -78,11 +78,16 @@ Editor::show_editor_mixer (bool yn)
show_editor_mixer_when_tracks_arrive = false;
if (yn) {
Glib::RefPtr<Gdk::Window> win = current_toplevel()->get_window ();
Gtk::Window* toplevel = current_toplevel();
Glib::RefPtr<Gdk::Window> win;
Glib::RefPtr<Gdk::Screen> screen;
if (toplevel) {
win = toplevel->get_window();
}
if (win) {
screen = win->get_screen();
screen = win->get_screen();
} else {
screen = Gdk::Screen::get_default();
}

View File

@ -2782,7 +2782,7 @@ Editor::rename_region ()
return;
}
ArdourDialog d (*current_toplevel(), _("Rename Region"), true, false);
ArdourDialog d (_("Rename Region"), true, false);
Entry entry;
Label label (_("New name:"));
HBox hbox;
@ -7597,7 +7597,7 @@ Editor::fit_tracks (TrackViewList & tracks)
double first_y_pos = DBL_MAX;
if (h < TimeAxisView::preset_height (HeightSmall)) {
MessageDialog msg (*current_toplevel(), _("There are too many tracks to fit in the current window"));
MessageDialog msg (_("There are too many tracks to fit in the current window"));
/* too small to be displayed */
return;
}