From adcc9b681043f3bbb8a60760032cb45e0052c5fc Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Sat, 15 Jan 2022 21:42:37 +0100 Subject: [PATCH] Extract marker strings out to a separate method. --- src/wx/markers.cc | 46 ++++++++++++++++++++++++++++++++++++++++ src/wx/markers.h | 28 ++++++++++++++++++++++++ src/wx/markers_dialog.cc | 28 ++++++++++-------------- src/wx/wscript | 1 + 4 files changed, 86 insertions(+), 17 deletions(-) create mode 100644 src/wx/markers.cc create mode 100644 src/wx/markers.h diff --git a/src/wx/markers.cc b/src/wx/markers.cc new file mode 100644 index 000000000..1ae5cc287 --- /dev/null +++ b/src/wx/markers.cc @@ -0,0 +1,46 @@ +/* + Copyright (C) 2022 Carl Hetherington + + 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. + + 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 DCP-o-matic. If not, see . + +*/ + + +#include "markers.h" + + +using std::make_pair; +using std::pair; +using std::vector; + + +vector> +all_markers () +{ + vector> out; + out.push_back (make_pair(_("First frame of composition"), dcp::Marker::FFOC)); + out.push_back (make_pair(_("Last frame of composition"), dcp::Marker::LFOC)); + out.push_back (make_pair(_("First frame of title credits"), dcp::Marker::FFTC)); + out.push_back (make_pair(_("Last frame of title credits"), dcp::Marker::LFTC)); + out.push_back (make_pair(_("First frame of intermission"), dcp::Marker::FFOI)); + out.push_back (make_pair(_("Last frame of intermission"), dcp::Marker::LFOI)); + out.push_back (make_pair(_("First frame of end credits"), dcp::Marker::FFEC)); + out.push_back (make_pair(_("Last frame of end credits"), dcp::Marker::LFEC)); + out.push_back (make_pair(_("First frame of moving credits"), dcp::Marker::FFMC)); + out.push_back (make_pair(_("Last frame of moving credits"), dcp::Marker::LFMC)); + return out; +} + diff --git a/src/wx/markers.h b/src/wx/markers.h new file mode 100644 index 000000000..04c6488b1 --- /dev/null +++ b/src/wx/markers.h @@ -0,0 +1,28 @@ +/* + Copyright (C) 2022 Carl Hetherington + + 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. + + 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 DCP-o-matic. If not, see . + +*/ + + +#include +#include +#include +#include + + +extern std::vector> all_markers (); diff --git a/src/wx/markers_dialog.cc b/src/wx/markers_dialog.cc index 205d44195..e6107e253 100644 --- a/src/wx/markers_dialog.cc +++ b/src/wx/markers_dialog.cc @@ -19,13 +19,14 @@ */ -#include "markers_dialog.h" -#include "wx_util.h" -#include "timecode.h" -#include "static_text.h" -#include "dcpomatic_button.h" #include "check_box.h" +#include "dcpomatic_button.h" #include "film_viewer.h" +#include "markers.h" +#include "markers_dialog.h" +#include "static_text.h" +#include "timecode.h" +#include "wx_util.h" #include "lib/film.h" #include #include @@ -34,11 +35,11 @@ using std::cout; +using std::make_shared; using std::shared_ptr; using std::weak_ptr; -using std::make_shared; -using boost::optional; using boost::bind; +using boost::optional; using dcpomatic::DCPTime; @@ -130,16 +131,9 @@ MarkersDialog::MarkersDialog (wxWindow* parent, weak_ptr film, weak_ptr(this, grid, r++, film, viewer, _("First frame of composition"), dcp::Marker::FFOC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("Last frame of composition"), dcp::Marker::LFOC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("First frame of title credits"), dcp::Marker::FFTC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("Last frame of title credits"), dcp::Marker::LFTC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("First frame of intermission"), dcp::Marker::FFOI)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("Last frame of intermission"), dcp::Marker::LFOI)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("First frame of end credits"), dcp::Marker::FFEC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("Last frame of end credits"), dcp::Marker::LFEC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("First frame of moving credits"), dcp::Marker::FFMC)); - _markers.push_back (make_shared(this, grid, r++, film, viewer, _("Last frame of moving credits"), dcp::Marker::LFMC)); + for (auto const& marker: all_markers()) { + _markers.push_back (make_shared(this, grid, r++, film, viewer, marker.first, marker.second)); + } sizer->Add (grid, 0, wxALL, 8); diff --git a/src/wx/wscript b/src/wx/wscript index 50c078f2b..d30edb406 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -96,6 +96,7 @@ sources = """ language_tag_dialog.cc language_tag_widget.cc make_chain_dialog.cc + markers.cc markers_dialog.cc message_dialog.cc metadata_dialog.cc -- 2.30.2