Extract marker strings out to a separate method.
authorCarl Hetherington <cth@carlh.net>
Sat, 15 Jan 2022 20:42:37 +0000 (21:42 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 28 Apr 2022 23:09:39 +0000 (01:09 +0200)
src/wx/markers.cc [new file with mode: 0644]
src/wx/markers.h [new file with mode: 0644]
src/wx/markers_dialog.cc
src/wx/wscript

diff --git a/src/wx/markers.cc b/src/wx/markers.cc
new file mode 100644 (file)
index 0000000..1ae5cc2
--- /dev/null
@@ -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 (file)
index 0000000..04c6488
--- /dev/null
@@ -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 ();
index ed0b68c8fdae4ce288d935d22e6092537d824939..2e4dc42c5950e4f6922651521b9971eebc3e76a2 100644 (file)
@@ -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);
 
index e000a9ed84b56c0b72101b1a67054cc5ff0686e2..d2b4e58e228858287514c955fce0050aa2d3063f 100644 (file)
@@ -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