diff options
| author | Carl Hetherington <cth@carlh.net> | 2022-01-15 21:42:37 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2022-04-29 01:09:39 +0200 |
| commit | 7861a2f4fe15952d43323a64284afd71427d09f4 (patch) | |
| tree | abaf0f1129998500d561a12dd944e400432d8269 | |
| parent | 78ca79cde19db630b1abfe8f00f49e87bb7e4068 (diff) | |
Extract marker strings out to a separate method.
| -rw-r--r-- | src/wx/markers.cc | 46 | ||||
| -rw-r--r-- | src/wx/markers.h | 28 | ||||
| -rw-r--r-- | src/wx/markers_dialog.cc | 14 | ||||
| -rw-r--r-- | src/wx/wscript | 1 |
4 files changed, 79 insertions, 10 deletions
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 <cth@carlh.net> + + 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 <http://www.gnu.org/licenses/>. + +*/ + + +#include "markers.h" + + +using std::make_pair; +using std::pair; +using std::vector; + + +vector<pair<wxString, dcp::Marker>> +all_markers () +{ + vector<pair<wxString, dcp::Marker>> 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 <cth@carlh.net> + + 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 <http://www.gnu.org/licenses/>. + +*/ + + +#include <dcp/types.h> +#include <wx/wx.h> +#include <utility> +#include <vector> + + +extern std::vector<std::pair<wxString, dcp::Marker>> all_markers (); diff --git a/src/wx/markers_dialog.cc b/src/wx/markers_dialog.cc index ed0b68c8f..2e4dc42c5 100644 --- a/src/wx/markers_dialog.cc +++ b/src/wx/markers_dialog.cc @@ -22,6 +22,7 @@ #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" @@ -131,16 +132,9 @@ MarkersDialog::MarkersDialog (wxWindow* parent, weak_ptr<Film> film, weak_ptr<Fi auto grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP); int r = 0; - _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("First frame of composition"), dcp::Marker::FFOC)); - _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("Last frame of composition"), dcp::Marker::LFOC)); - _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("First frame of title credits"), dcp::Marker::FFTC)); - _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("Last frame of title credits"), dcp::Marker::LFTC)); - _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("First frame of intermission"), dcp::Marker::FFOI)); - _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("Last frame of intermission"), dcp::Marker::LFOI)); - _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("First frame of end credits"), dcp::Marker::FFEC)); - _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("Last frame of end credits"), dcp::Marker::LFEC)); - _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("First frame of moving credits"), dcp::Marker::FFMC)); - _markers.push_back (make_shared<Marker>(this, grid, r++, film, viewer, _("Last frame of moving credits"), dcp::Marker::LFMC)); + for (auto const& marker: all_markers()) { + _markers.push_back (make_shared<Marker>(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 e000a9ed8..d2b4e58e2 100644 --- a/src/wx/wscript +++ b/src/wx/wscript @@ -97,6 +97,7 @@ sources = """ language_tag_widget.cc kdm_choice.cc make_chain_dialog.cc + markers.cc markers_dialog.cc message_dialog.cc metadata_dialog.cc |
