From: Carl Hetherington Date: Fri, 8 Jan 2016 14:49:03 +0000 (+0000) Subject: Don't expand all cinemas on opening KDM dialogs (#779). X-Git-Tag: v2.6.15~8 X-Git-Url: https://git.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=1d40c94c23881c99f7c39cfd7ca017989c7d2c6a Don't expand all cinemas on opening KDM dialogs (#779). --- diff --git a/ChangeLog b/ChangeLog index 8e80ea29b..3a68a1722 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2016-01-08 c.hetherington + + * Don't expand all cinemas on opening KDM dialogs (#779). + 2016-01-07 Carl Hetherington * Version 2.6.14 released. diff --git a/src/wx/screens_panel.cc b/src/wx/screens_panel.cc index a081e2dfc..7a5eb5fad 100644 --- a/src/wx/screens_panel.cc +++ b/src/wx/screens_panel.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2015 Carl Hetherington + Copyright (C) 2015-2016 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -33,6 +33,7 @@ using std::map; using std::string; using std::make_pair; using boost::shared_ptr; +using boost::optional; ScreensPanel::ScreensPanel (wxWindow* parent) : wxPanel (parent, wxID_ANY) @@ -50,8 +51,6 @@ ScreensPanel::ScreensPanel (wxWindow* parent) add_cinemas (); - _targets->ExpandAll (); - wxBoxSizer* target_buttons = new wxBoxSizer (wxVERTICAL); _add_cinema = new wxButton (this, wxID_ANY, _("Add Cinema...")); @@ -129,7 +128,7 @@ ScreensPanel::add_cinema (shared_ptr c) _targets->SortChildren (_root); } -void +optional ScreensPanel::add_screen (shared_ptr c, shared_ptr s) { CinemaMap::const_iterator i = _cinemas.begin(); @@ -138,11 +137,11 @@ ScreensPanel::add_screen (shared_ptr c, shared_ptr s) } if (i == _cinemas.end()) { - return; + return optional (); } _screens[_targets->AppendItem (i->first, std_to_wx (s->name))] = s; - _targets->Expand (i->first); + return i->first; } void @@ -207,7 +206,10 @@ ScreensPanel::add_screen_clicked () shared_ptr s (new Screen (d->name(), d->recipient(), d->trusted_devices())); c->add_screen (s); - add_screen (c, s); + optional id = add_screen (c, s); + if (id) { + _targets->Expand (id.get ()); + } Config::instance()->changed (); diff --git a/src/wx/screens_panel.h b/src/wx/screens_panel.h index 0095937b7..cc5170d97 100644 --- a/src/wx/screens_panel.h +++ b/src/wx/screens_panel.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2015 Carl Hetherington + Copyright (C) 2015-2016 Carl Hetherington This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -41,7 +41,7 @@ public: private: void add_cinemas (); void add_cinema (boost::shared_ptr); - void add_screen (boost::shared_ptr, boost::shared_ptr); + boost::optional add_screen (boost::shared_ptr, boost::shared_ptr); void add_cinema_clicked (); void edit_cinema_clicked (); void remove_cinema_clicked ();