Revert "Use make_shared<>."
[dcpomatic.git] / src / wx / screens_panel.cc
index ddb088c2fcf2564de5b05493ab5a225c109cef92..0638763fe364ce0743b05320d070819ad8674be4 100644 (file)
@@ -1,19 +1,20 @@
 /*
     Copyright (C) 2015-2016 Carl Hetherington <cth@carlh.net>
 
-    This program is free software; you can redistribute it and/or modify
+    This file is part of DCP-o-matic.
+
+    DCP-o-matic is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
     the Free Software Foundation; either version 2 of the License, or
     (at your option) any later version.
 
-    This program is distributed in the hope that it will be useful,
+    DCP-o-matic is distributed in the hope that it will be useful,
     but WITHOUT ANY WARRANTY; without even the implied warranty of
     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     GNU General Public License for more details.
 
     You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
 
 */
 
@@ -51,21 +52,20 @@ ScreensPanel::ScreensPanel (wxWindow* parent)
 
        add_cinemas ();
 
-       wxBoxSizer* target_buttons = new wxBoxSizer (wxVERTICAL);
+       wxGridSizer* target_buttons = new wxGridSizer (2, DCPOMATIC_BUTTON_STACK_GAP * 2, DCPOMATIC_SIZER_Y_GAP);
 
        _add_cinema = new wxButton (this, wxID_ANY, _("Add Cinema..."));
-       target_buttons->Add (_add_cinema, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
-       _edit_cinema = new wxButton (this, wxID_ANY, _("Edit Cinema..."));
-       target_buttons->Add (_edit_cinema, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
-       _remove_cinema = new wxButton (this, wxID_ANY, _("Remove Cinema"));
-       target_buttons->Add (_remove_cinema, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
-
+       target_buttons->Add (_add_cinema, 1, wxEXPAND);
        _add_screen = new wxButton (this, wxID_ANY, _("Add Screen..."));
-       target_buttons->Add (_add_screen, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+       target_buttons->Add (_add_screen, 1, wxEXPAND);
+       _edit_cinema = new wxButton (this, wxID_ANY, _("Edit Cinema..."));
+       target_buttons->Add (_edit_cinema, 1, wxEXPAND);
        _edit_screen = new wxButton (this, wxID_ANY, _("Edit Screen..."));
-       target_buttons->Add (_edit_screen, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+       target_buttons->Add (_edit_screen, 1, wxEXPAND);
+       _remove_cinema = new wxButton (this, wxID_ANY, _("Remove Cinema"));
+       target_buttons->Add (_remove_cinema, 1, wxEXPAND);
        _remove_screen = new wxButton (this, wxID_ANY, _("Remove Screen"));
-       target_buttons->Add (_remove_screen, 1, wxEXPAND | wxALL, DCPOMATIC_BUTTON_STACK_GAP);
+       target_buttons->Add (_remove_screen, 1, wxEXPAND);
 
        targets->Add (target_buttons, 0, 0);
 
@@ -147,9 +147,9 @@ ScreensPanel::add_screen (shared_ptr<Cinema> c, shared_ptr<Screen> s)
 void
 ScreensPanel::add_cinema_clicked ()
 {
-       CinemaDialog* d = new CinemaDialog (this, "Add Cinema");
+       CinemaDialog* d = new CinemaDialog (this, _("Add Cinema"));
        if (d->ShowModal () == wxID_OK) {
-               shared_ptr<Cinema> c (new Cinema (d->name(), d->emails(), d->utc_offset_hour(), d->utc_offset_minute()));
+               shared_ptr<Cinema> c (new Cinema (d->name(), d->emails(), d->notes(), d->utc_offset_hour(), d->utc_offset_minute()));
                Config::instance()->add_cinema (c);
                add_cinema (c);
        }
@@ -166,10 +166,14 @@ ScreensPanel::edit_cinema_clicked ()
 
        pair<wxTreeItemId, shared_ptr<Cinema> > c = *_selected_cinemas.begin();
 
-       CinemaDialog* d = new CinemaDialog (this, "Edit cinema", c.second->name, c.second->emails, c.second->utc_offset_hour(), c.second->utc_offset_minute());
+       CinemaDialog* d = new CinemaDialog (
+               this, _("Edit cinema"), c.second->name, c.second->emails, c.second->notes, c.second->utc_offset_hour(), c.second->utc_offset_minute()
+               );
+
        if (d->ShowModal () == wxID_OK) {
                c.second->name = d->name ();
                c.second->emails = d->emails ();
+               c.second->notes = d->notes ();
                c.second->set_utc_offset_hour (d->utc_offset_hour ());
                c.second->set_utc_offset_minute (d->utc_offset_minute ());
                _targets->SetItemText (c.first, std_to_wx (d->name()));
@@ -199,7 +203,7 @@ ScreensPanel::add_screen_clicked ()
 
        shared_ptr<Cinema> c = _selected_cinemas.begin()->second;
 
-       ScreenDialog* d = new ScreenDialog (this, "Add Screen");
+       ScreenDialog* d = new ScreenDialog (this, _("Add Screen"));
        if (d->ShowModal () != wxID_OK) {
                return;
        }
@@ -225,9 +229,10 @@ ScreensPanel::edit_screen_clicked ()
 
        pair<wxTreeItemId, shared_ptr<Screen> > s = *_selected_screens.begin();
 
-       ScreenDialog* d = new ScreenDialog (this, "Edit screen", s.second->name, s.second->recipient, s.second->trusted_devices);
+       ScreenDialog* d = new ScreenDialog (this, _("Edit screen"), s.second->name, s.second->notes, s.second->recipient, s.second->trusted_devices);
        if (d->ShowModal () == wxID_OK) {
                s.second->name = d->name ();
+               s.second->notes = d->notes ();
                s.second->recipient = d->recipient ();
                s.second->trusted_devices = d->trusted_devices ();
                _targets->SetItemText (s.first, std_to_wx (d->name()));