summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wx/screens_panel.cc16
-rw-r--r--src/wx/screens_panel.h4
2 files changed, 11 insertions, 9 deletions
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 <cth@carlh.net>
+ Copyright (C) 2015-2016 Carl Hetherington <cth@carlh.net>
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<Cinema> c)
_targets->SortChildren (_root);
}
-void
+optional<wxTreeItemId>
ScreensPanel::add_screen (shared_ptr<Cinema> c, shared_ptr<Screen> s)
{
CinemaMap::const_iterator i = _cinemas.begin();
@@ -138,11 +137,11 @@ ScreensPanel::add_screen (shared_ptr<Cinema> c, shared_ptr<Screen> s)
}
if (i == _cinemas.end()) {
- return;
+ return optional<wxTreeItemId> ();
}
_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<Screen> s (new Screen (d->name(), d->recipient(), d->trusted_devices()));
c->add_screen (s);
- add_screen (c, s);
+ optional<wxTreeItemId> 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 <cth@carlh.net>
+ Copyright (C) 2015-2016 Carl Hetherington <cth@carlh.net>
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<Cinema>);
- void add_screen (boost::shared_ptr<Cinema>, boost::shared_ptr<Screen>);
+ boost::optional<wxTreeItemId> add_screen (boost::shared_ptr<Cinema>, boost::shared_ptr<Screen>);
void add_cinema_clicked ();
void edit_cinema_clicked ();
void remove_cinema_clicked ();