Replace incorrect uses of raw_convert with a new locale_convert.
authorCarl Hetherington <cth@carlh.net>
Thu, 11 Aug 2016 11:49:23 +0000 (12:49 +0100)
committerCarl Hetherington <cth@carlh.net>
Fri, 12 Aug 2016 08:14:06 +0000 (09:14 +0100)
25 files changed:
src/lib/audio_content.cc
src/lib/cinema.cc
src/lib/content.cc
src/lib/dcp_content.cc
src/lib/ffmpeg_content.cc
src/lib/locale_convert.cc [new file with mode: 0644]
src/lib/locale_convert.h [new file with mode: 0644]
src/lib/user_property.h
src/lib/util.cc
src/lib/video_content.cc
src/lib/wscript
src/tools/dcpomatic.cc
src/wx/audio_mapping_view.cc
src/wx/colour_conversion_editor.cc
src/wx/config_dialog.cc
src/wx/content_properties_dialog.cc
src/wx/dcp_panel.cc
src/wx/dolby_doremi_certificate_panel.cc
src/wx/image_sequence_dialog.cc
src/wx/playhead_to_frame_dialog.cc
src/wx/time_picker.cc
src/wx/timing_panel.cc
src/wx/video_waveform_plot.cc
src/wx/wx_util.cc
test/video_content_scale_test.cc

index e66b8b998ded170d9ec2d56df47417c278c653b7..25a7ef8a51c96f14f4aca221ddd7edeb8630185a 100644 (file)
@@ -24,6 +24,7 @@
 #include "config.h"
 #include "frame_rate_change.h"
 #include "compose.hpp"
+#include "locale_convert.h"
 #include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 #include <libxml++/libxml++.h>
index 469cf2e6b2de20d56687e91ff42cf2d3c1f5a452..61862fa6dd9554f369aa6d7733d66acf5ef55eaf 100644 (file)
@@ -30,6 +30,7 @@
 using std::list;
 using std::string;
 using boost::shared_ptr;
+using dcp::raw_convert;
 
 Cinema::Cinema (cxml::ConstNodePtr node)
        : name (node->string_child ("Name"))
@@ -71,8 +72,8 @@ Cinema::as_xml (xmlpp::Element* parent) const
 
        parent->add_child("Notes")->add_child_text (notes);
 
-       parent->add_child("UTCOffsetHour")->add_child_text (dcp::raw_convert<string> (_utc_offset_hour));
-       parent->add_child("UTCOffsetMinute")->add_child_text (dcp::raw_convert<string> (_utc_offset_minute));
+       parent->add_child("UTCOffsetHour")->add_child_text (raw_convert<string> (_utc_offset_hour));
+       parent->add_child("UTCOffsetMinute")->add_child_text (raw_convert<string> (_utc_offset_minute));
 
        BOOST_FOREACH (shared_ptr<Screen> i, _screens) {
                i->as_xml (parent->add_child ("Screen"));
index 0fd503edd5134a8a809a579801e2b23bbab1381f..536036ff7e2f047c0b46ad4cc5f309b18725c00d 100644 (file)
@@ -27,6 +27,7 @@
 #include "content_factory.h"
 #include "exceptions.h"
 #include "film.h"
+#include "locale_convert.h"
 #include "job.h"
 #include "compose.hpp"
 #include <dcp/raw_convert.h>
@@ -365,7 +366,7 @@ Content::add_properties (list<UserProperty>& p) const
                                UserProperty (
                                        UserProperty::VIDEO,
                                        _("Frame rate"),
-                                       raw_convert<string> (_video_frame_rate.get(), 5),
+                                       locale_convert<string> (_video_frame_rate.get(), 5),
                                        _("frames per second")
                                        )
                                );
@@ -374,7 +375,7 @@ Content::add_properties (list<UserProperty>& p) const
                                UserProperty (
                                        UserProperty::GENERAL,
                                        _("Prepared for video frame rate"),
-                                       raw_convert<string> (_video_frame_rate.get(), 5),
+                                       locale_convert<string> (_video_frame_rate.get(), 5),
                                        _("frames per second")
                                        )
                                );
index 9e767596cf7619e34ae6673a53d21c054036496a..44c7ce5784b2ec08a52a6be888d3f8abce6433e7 100644 (file)
@@ -30,6 +30,7 @@
 #include "dcp_decoder.h"
 #include "subtitle_content.h"
 #include <dcp/dcp.h>
+#include <dcp/raw_convert.h>
 #include <dcp/exceptions.h>
 #include <dcp/reel_picture_asset.h>
 #include <dcp/reel.h>
index d64c829711ee98729cdb6811a4a266f0b2545c82..71cda084c6b48f66057d2fd12fd53dd25bc8d4c9 100644 (file)
@@ -33,6 +33,7 @@
 #include "exceptions.h"
 #include "frame_rate_change.h"
 #include "subtitle_content.h"
+#include "locale_convert.h"
 #include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 extern "C" {
@@ -566,7 +567,7 @@ FFmpegContent::add_properties (list<UserProperty>& p) const
                p.push_back (UserProperty (UserProperty::VIDEO, _("Colourspace"), spaces[_colorspace]));
 
                if (_bits_per_pixel) {
-                       p.push_back (UserProperty (UserProperty::VIDEO, _("Bits per pixel"), raw_convert<string> (_bits_per_pixel.get ())));
+                       p.push_back (UserProperty (UserProperty::VIDEO, _("Bits per pixel"), _bits_per_pixel.get ()));
                }
        }
 
diff --git a/src/lib/locale_convert.cc b/src/lib/locale_convert.cc
new file mode 100644 (file)
index 0000000..6358c0f
--- /dev/null
@@ -0,0 +1,122 @@
+/*
+    Copyright (C) 2012-2016 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 "locale_convert.h"
+#include <string>
+#include <inttypes.h>
+
+using std::string;
+
+template<>
+string
+locale_convert (int x, int)
+{
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "%d", x);
+       return buffer;
+}
+
+template<>
+string
+locale_convert (int64_t x, int)
+{
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), "%" PRId64, x);
+       return buffer;
+}
+
+template<>
+string
+locale_convert (float x, int precision)
+{
+       char format[64];
+       snprintf (format, sizeof(format), "%%.%df", precision);
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), format, x);
+       return buffer;
+}
+
+template<>
+string
+locale_convert (double x, int precision)
+{
+       char format[64];
+       snprintf (format, sizeof(format), "%%.%df", precision);
+       char buffer[64];
+       snprintf (buffer, sizeof(buffer), format, x);
+       return buffer;
+}
+
+template<>
+string
+locale_convert (string x, int)
+{
+       return x;
+}
+
+template<>
+string
+locale_convert (char* x, int)
+{
+       return x;
+}
+
+template<>
+string
+locale_convert (char const * x, int)
+{
+       return x;
+}
+
+template<>
+int
+locale_convert (string x, int)
+{
+       int y = 0;
+       sscanf (x.c_str(), "%d", &y);
+       return y;
+}
+
+template<>
+int64_t
+locale_convert (string x, int)
+{
+       int64_t y = 0;
+       sscanf (x.c_str(), "%" PRId64, &y);
+       return y;
+}
+
+template<>
+float
+locale_convert (string x, int)
+{
+       float y = 0;
+       sscanf (x.c_str(), "%f", &y);
+       return y;
+}
+
+template<>
+double
+locale_convert (string x, int)
+{
+       double y = 0;
+       sscanf (x.c_str(), "%lf", &y);
+       return y;
+}
diff --git a/src/lib/locale_convert.h b/src/lib/locale_convert.h
new file mode 100644 (file)
index 0000000..b5c38ca
--- /dev/null
@@ -0,0 +1,81 @@
+/*
+    Copyright (C) 2012-2016 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/>.
+
+*/
+
+#ifndef DCPOMATIC_LOCALE_CONVERT_H
+#define DCPOMATIC_LOCALE_CONVERT_H
+
+#include <boost/static_assert.hpp>
+#include <string>
+
+template <typename P, typename Q>
+P
+locale_convert (Q x, int precision = 16)
+{
+       /* We can't write a generic version of locale_convert; all required
+          versions must be specialised.
+       */
+       BOOST_STATIC_ASSERT (sizeof (Q) == 0);
+}
+
+template <>
+std::string
+locale_convert (int x, int);
+
+template <>
+std::string
+locale_convert (int64_t x, int);
+
+template <>
+std::string
+locale_convert (float x, int precision);
+
+template <>
+std::string
+locale_convert (double x, int precision);
+
+template <>
+std::string
+locale_convert (std::string x, int);
+
+template <>
+std::string
+locale_convert (char* x, int);
+
+template <>
+std::string
+locale_convert (char const * x, int);
+
+template <>
+int
+locale_convert (std::string x, int);
+
+template <>
+int64_t
+locale_convert (std::string x, int);
+
+template <>
+float
+locale_convert (std::string x, int);
+
+template <>
+double
+locale_convert (std::string x, int);
+
+#endif
index 6e147fd768ebf067776eb3130d127be85ac8e47e..8b69b7687bf18de3acc570021e788b37280ce30e 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef DCPOMATIC_USER_PROPERTY_H
 #define DCPOMATIC_USER_PROPERTY_H
 
-#include <dcp/raw_convert.h>
+#include "locale_convert.h"
 
 class UserProperty
 {
@@ -37,7 +37,7 @@ public:
        UserProperty (Category category_, std::string key_, T value_, std::string unit_ = "")
                : category (category_)
                , key (key_)
-               , value (dcp::raw_convert<std::string> (value_))
+               , value (locale_convert<std::string> (value_))
                , unit (unit_)
        {}
 
index da45919b426df35dd6c7943673267d5307f25ae1..eedc7ddb5bc692847d927485f780806dbd064d57 100644 (file)
@@ -36,7 +36,9 @@
 #include "digester.h"
 #include "audio_processor.h"
 #include "compose.hpp"
+#include "locale_convert.h"
 #include <dcp/util.h>
+#include <dcp/raw_convert.h>
 #include <dcp/picture_asset.h>
 #include <dcp/sound_asset.h>
 #include <dcp/subtitle_asset.h>
@@ -140,10 +142,10 @@ seconds_to_approximate_hms (int s)
        if (hours) {
                if (m > 30 && !minutes) {
                        /// TRANSLATORS: h here is an abbreviation for hours
-                       ap += raw_convert<string>(h + 1) + _("h");
+                       ap += locale_convert<string>(h + 1) + _("h");
                } else {
                        /// TRANSLATORS: h here is an abbreviation for hours
-                       ap += raw_convert<string>(h) + _("h");
+                       ap += locale_convert<string>(h) + _("h");
                }
 
                if (minutes || seconds) {
@@ -155,10 +157,10 @@ seconds_to_approximate_hms (int s)
                /* Minutes */
                if (s > 30 && !seconds) {
                        /// TRANSLATORS: m here is an abbreviation for minutes
-                       ap += raw_convert<string>(m + 1) + _("m");
+                       ap += locale_convert<string>(m + 1) + _("m");
                } else {
                        /// TRANSLATORS: m here is an abbreviation for minutes
-                       ap += raw_convert<string>(m) + _("m");
+                       ap += locale_convert<string>(m) + _("m");
                }
 
                if (seconds) {
@@ -169,7 +171,7 @@ seconds_to_approximate_hms (int s)
        if (seconds) {
                /* Seconds */
                /// TRANSLATORS: s here is an abbreviation for seconds
-               ap += raw_convert<string>(s) + _("s");
+               ap += locale_convert<string>(s) + _("s");
        }
 
        return ap;
index 20e0866a166377f6ba90666d472ebe7052e8668c..ac038678c9762d7898953267e6e82fcc2ab03584 100644 (file)
@@ -30,6 +30,7 @@
 #include "exceptions.h"
 #include "frame_rate_change.h"
 #include "log.h"
+#include "locale_convert.h"
 #include <dcp/raw_convert.h>
 #include <libcxml/cxml.h>
 #include <dcp/colour_matrix.h>
@@ -456,8 +457,8 @@ VideoContent::processing_description () const
 void
 VideoContent::add_properties (list<UserProperty>& p) const
 {
-       p.push_back (UserProperty (UserProperty::VIDEO, _("Length"), raw_convert<string> (length ()), _("video frames")));
-       p.push_back (UserProperty (UserProperty::VIDEO, _("Size"), raw_convert<string> (size().width) + "x" + raw_convert<string> (size().height)));
+       p.push_back (UserProperty (UserProperty::VIDEO, _("Length"), length (), _("video frames")));
+       p.push_back (UserProperty (UserProperty::VIDEO, _("Size"), size().width + "x" + size().height));
 }
 
 void
index 911ee0af43ac8c12cfe51906fc17a2f4684db09e..074c12ad406af425f4a426b4921f01542fc1e453 100644 (file)
@@ -94,6 +94,7 @@ sources = """
           job.cc
           job_manager.cc
           json_server.cc
+          locale_convert.cc
           log.cc
           log_entry.cc
           magick_image_proxy.cc
index a99e3298061492fe1d2c32e4f7040c8955a93bb6..1f320f088ec57be6c0aba504b78ae2b995d044a5 100644 (file)
@@ -60,6 +60,7 @@
 #include "lib/dcpomatic_socket.h"
 #include "lib/hints.h"
 #include <dcp/exceptions.h>
+#include <dcp/raw_convert.h>
 #include <wx/generic/aboutdlgg.h>
 #include <wx/stdpaths.h>
 #include <wx/cmdline.h>
index 1ec9dd5b2918ce556a10eb7a1583febd3de2b696..866156336e2fb1f621a024045853187874c878b6 100644 (file)
  *  @brief AudioMappingView class and helpers.
  */
 
-#include "lib/audio_mapping.h"
-#include "lib/util.h"
 #include "audio_mapping_view.h"
 #include "wx_util.h"
 #include "audio_gain_dialog.h"
-#include <dcp/raw_convert.h>
+#include "lib/audio_mapping.h"
+#include "lib/util.h"
+#include "lib/locale_convert.h"
 #include <dcp/types.h>
 #include <wx/wx.h>
 #include <wx/renderer.h>
@@ -45,7 +45,6 @@ using std::vector;
 using std::pair;
 using std::make_pair;
 using boost::shared_ptr;
-using dcp::raw_convert;
 
 #define INDICATOR_SIZE 16
 #define LEFT_WIDTH 48
@@ -86,7 +85,7 @@ public:
                dc.SetBrush (*wxTheBrushList->FindOrCreateBrush (wxColour (255, 255, 255), wxBRUSHSTYLE_SOLID));
                dc.DrawRectangle (wxRect (rect.GetLeft() + xo, rect.GetTop() + yo, INDICATOR_SIZE, INDICATOR_SIZE));
 
-               float const value = raw_convert<float> (wx_to_std (grid.GetCellValue (row, col)));
+               float const value = locale_convert<float> (wx_to_std (grid.GetCellValue (row, col)));
                float const value_dB = 20 * log10 (value);
                int const range = 18;
                int height = 0;
@@ -301,7 +300,7 @@ AudioMappingView::update_cells ()
                        _grid->SetCellValue (i, 0, std_to_wx (row_names[i]));
                }
                for (int j = 1; j < _grid->GetNumberCols(); ++j) {
-                       _grid->SetCellValue (i, j, std_to_wx (raw_convert<string> (_map.get (i, j - 1))));
+                       _grid->SetCellValue (i, j, std_to_wx (locale_convert<string> (_map.get (i, j - 1))));
                }
        }
 
index 0a775b4890c8aa83650f277e22e997a478d68023..e56f30baf219f04e1ca05f83e69000b5aa18bd4f 100644 (file)
 
 */
 
-#include "lib/colour_conversion.h"
 #include "wx_util.h"
 #include "colour_conversion_editor.h"
-#include <dcp/raw_convert.h>
+#include "lib/colour_conversion.h"
+#include "lib/locale_convert.h"
 #include <dcp/gamma_transfer_function.h>
 #include <dcp/modified_gamma_transfer_function.h>
 #include <wx/spinctrl.h>
@@ -32,7 +32,6 @@ using std::string;
 using std::cout;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
-using dcp::raw_convert;
 
 ColourConversionEditor::ColourConversionEditor (wxWindow* parent, bool yuv)
        : wxPanel (parent, wxID_ANY)
@@ -292,9 +291,9 @@ ColourConversionEditor::get () const
                        shared_ptr<dcp::ModifiedGammaTransferFunction> (
                                new dcp::ModifiedGammaTransferFunction (
                                        _input_power->GetValue (),
-                                       raw_convert<double> (wx_to_std (_input_threshold->GetValue ())),
-                                       raw_convert<double> (wx_to_std (_input_A->GetValue ())),
-                                       raw_convert<double> (wx_to_std (_input_B->GetValue ()))
+                                       locale_convert<double> (wx_to_std (_input_threshold->GetValue ())),
+                                       locale_convert<double> (wx_to_std (_input_A->GetValue ())),
+                                       locale_convert<double> (wx_to_std (_input_B->GetValue ()))
                                        )
                                )
                        );
@@ -307,23 +306,23 @@ ColourConversionEditor::get () const
        conversion.set_yuv_to_rgb (static_cast<dcp::YUVToRGB> (_yuv_to_rgb->GetSelection ()));
 
        conversion.set_red (
-               dcp::Chromaticity (raw_convert<double> (wx_to_std (_red_x->GetValue ())), raw_convert<double> (wx_to_std (_red_y->GetValue ())))
+               dcp::Chromaticity (locale_convert<double> (wx_to_std (_red_x->GetValue ())), locale_convert<double> (wx_to_std (_red_y->GetValue ())))
                );
        conversion.set_green (
-               dcp::Chromaticity (raw_convert<double> (wx_to_std (_green_x->GetValue ())), raw_convert<double> (wx_to_std (_green_y->GetValue ())))
+               dcp::Chromaticity (locale_convert<double> (wx_to_std (_green_x->GetValue ())), locale_convert<double> (wx_to_std (_green_y->GetValue ())))
                );
        conversion.set_blue (
-               dcp::Chromaticity (raw_convert<double> (wx_to_std (_blue_x->GetValue ())), raw_convert<double> (wx_to_std (_blue_y->GetValue ())))
+               dcp::Chromaticity (locale_convert<double> (wx_to_std (_blue_x->GetValue ())), locale_convert<double> (wx_to_std (_blue_y->GetValue ())))
                );
        conversion.set_white (
-               dcp::Chromaticity (raw_convert<double> (wx_to_std (_white_x->GetValue ())), raw_convert<double> (wx_to_std (_white_y->GetValue ())))
+               dcp::Chromaticity (locale_convert<double> (wx_to_std (_white_x->GetValue ())), locale_convert<double> (wx_to_std (_white_y->GetValue ())))
                );
 
        if (_adjust_white->GetValue ()) {
                conversion.set_adjusted_white (
                        dcp::Chromaticity (
-                               raw_convert<double> (wx_to_std (_adjusted_white_x->GetValue ())),
-                               raw_convert<double> (wx_to_std (_adjusted_white_y->GetValue ()))
+                               locale_convert<double> (wx_to_std (_adjusted_white_x->GetValue ())),
+                               locale_convert<double> (wx_to_std (_adjusted_white_y->GetValue ()))
                                )
                        );
        } else {
index 0098ecb2bb9e7dfd82d8d0bbb2a5b716c7e8d305..6006ba782bf336373e2d3604da7af6fc9d96628a 100644 (file)
@@ -41,7 +41,7 @@
 #include "lib/util.h"
 #include "lib/cross.h"
 #include "lib/exceptions.h"
-#include <dcp/raw_convert.h>
+#include "lib/locale_convert.h"
 #include <dcp/exceptions.h>
 #include <dcp/certificate_chain.h>
 #include <wx/stdpaths.h>
@@ -63,7 +63,6 @@ using boost::bind;
 using boost::shared_ptr;
 using boost::function;
 using boost::optional;
-using dcp::raw_convert;
 
 class Page
 {
@@ -517,7 +516,7 @@ private:
                _directory->SetPath (std_to_wx (config->default_directory_or (wx_to_std (wxStandardPaths::Get().GetDocumentsDir())).string ()));
                checked_set (_j2k_bandwidth, config->default_j2k_bandwidth() / 1000000);
                _j2k_bandwidth->SetRange (50, config->maximum_j2k_bandwidth() / 1000000);
-               checked_set (_dcp_audio_channels, raw_convert<string> (config->default_dcp_audio_channels()));
+               checked_set (_dcp_audio_channels, locale_convert<string> (config->default_dcp_audio_channels()));
                checked_set (_audio_delay, config->default_audio_delay ());
                checked_set (_standard, config->default_interop() ? 1 : 0);
        }
@@ -536,7 +535,9 @@ private:
        {
                int const s = _dcp_audio_channels->GetSelection ();
                if (s != wxNOT_FOUND) {
-                       Config::instance()->set_default_dcp_audio_channels (dcp::raw_convert<int> (string_client_data (_dcp_audio_channels->GetClientObject (s))));
+                       Config::instance()->set_default_dcp_audio_channels (
+                               locale_convert<int> (string_client_data (_dcp_audio_channels->GetClientObject (s)))
+                               );
                }
        }
 
index acc232df4cd8445c69ec5ba12f1d763d8ec1b681..2f4e1a48bcadf6f0bbf242e717b30a6313d9b6c2 100644 (file)
@@ -23,7 +23,6 @@
 #include "lib/content.h"
 #include "lib/video_content.h"
 #include "lib/audio_content.h"
-#include <dcp/raw_convert.h>
 #include <boost/algorithm/string.hpp>
 #include <boost/foreach.hpp>
 
@@ -33,7 +32,6 @@ using std::pair;
 using std::map;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
-using dcp::raw_convert;
 
 ContentPropertiesDialog::ContentPropertiesDialog (wxWindow* parent, shared_ptr<Content> content)
        : TableDialog (parent, _("Content Properties"), 2, 1, false)
index f41f977695cd72977c72f18971703afb3bd0d7dc..8cbd1dbb654ed947038b1e03b6f5789aceccaf6d 100644 (file)
@@ -34,8 +34,8 @@
 #include "lib/subtitle_content.h"
 #include "lib/dcp_content.h"
 #include "lib/audio_content.h"
+#include "lib/locale_convert.h"
 #include <dcp/key.h>
-#include <dcp/raw_convert.h>
 #include <wx/wx.h>
 #include <wx/notebook.h>
 #include <wx/gbsizer.h>
@@ -275,7 +275,7 @@ DCPPanel::audio_channels_changed ()
                return;
        }
 
-       _film->set_audio_channels (dcp::raw_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
+       _film->set_audio_channels (locale_convert<int> (string_client_data (_audio_channels->GetClientObject (_audio_channels->GetSelection ()))));
 }
 
 void
@@ -386,7 +386,7 @@ DCPPanel::film_changed (int p)
                if (_film->audio_channels () < minimum_allowed_audio_channels ()) {
                        _film->set_audio_channels (minimum_allowed_audio_channels ());
                } else {
-                       checked_set (_audio_channels, dcp::raw_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
+                       checked_set (_audio_channels, locale_convert<string> (max (minimum_allowed_audio_channels(), _film->audio_channels ())));
                        setup_dcp_name ();
                }
                break;
index 18a0ed66ec34ba63e8156065329cc15ca1048873..cb1de387f61299d122454126991203324b06f3b6 100644 (file)
@@ -36,6 +36,7 @@ using std::cout;
 using std::list;
 using boost::function;
 using boost::optional;
+using dcp::raw_convert;
 
 DolbyDoremiCertificatePanel::DolbyDoremiCertificatePanel (wxWindow* parent, DownloadCertificateDialog* dialog)
        : DownloadCertificatePanel (parent, dialog)
@@ -90,7 +91,7 @@ try_ims (list<string>& urls, list<string>& files, string prefix, string serial)
 static void
 try_cat862 (list<string>& urls, list<string>& files, string prefix, string serial)
 {
-       int const serial_int = dcp::raw_convert<int> (serial);
+       int const serial_int = raw_convert<int> (serial);
 
        string cat862;
        if (serial_int <= 510999) {
@@ -109,7 +110,7 @@ try_cat862 (list<string>& urls, list<string>& files, string prefix, string seria
 static void
 try_dsp100 (list<string>& urls, list<string>& files, string prefix, string serial)
 {
-       int const serial_int = dcp::raw_convert<int> (serial);
+       int const serial_int = raw_convert<int> (serial);
 
        string dsp100;
        if (serial_int <= 999) {
@@ -128,7 +129,7 @@ try_dsp100 (list<string>& urls, list<string>& files, string prefix, string seria
 static void
 try_cat745 (list<string>& urls, list<string>& files, string prefix, string serial)
 {
-       int const serial_int = dcp::raw_convert<int> (serial.substr (1));
+       int const serial_int = raw_convert<int> (serial.substr (1));
 
        string cat745;
        if (serial_int <= 999) {
@@ -147,7 +148,7 @@ try_cat745 (list<string>& urls, list<string>& files, string prefix, string seria
 static void
 try_cp850 (list<string>& urls, list<string>& files, string prefix, string serial)
 {
-       int const serial_int = dcp::raw_convert<int> (serial.substr (1));
+       int const serial_int = raw_convert<int> (serial.substr (1));
 
        int const lower = serial_int - (serial_int % 1000);
        urls.push_back (String::compose ("%1CP850_CAT1600_F%2-F%3/cert_RMB_SPB_MDE_FMA.Dolby-CP850-F%4.zip", prefix, lower, lower + 999, serial_int));
index 6200018d10e2966595f62fa12b3f9f855676ce7b..a207338a1b6ee68cd29071ca01e99501a7cc1ece 100644 (file)
@@ -20,9 +20,7 @@
 
 #include "wx_util.h"
 #include "image_sequence_dialog.h"
-#include <dcp/raw_convert.h>
-
-using dcp::raw_convert;
+#include "lib/locale_convert.h"
 
 ImageSequenceDialog::ImageSequenceDialog (wxWindow* parent)
        : TableDialog (parent, _("Add image sequence"), 2, 1, true)
@@ -36,7 +34,7 @@ double
 ImageSequenceDialog::frame_rate () const
 {
        try {
-               return raw_convert<double> (wx_to_std (_frame_rate->GetValue ()));
+               return locale_convert<double> (wx_to_std (_frame_rate->GetValue ()));
        } catch (...) {
 
        }
index af20c159268c352b4a60f7cae3277c7018647306..3f1d06d2a9affa4a953bdf6f6b18f8957ece8ebf 100644 (file)
@@ -19,9 +19,7 @@
 */
 
 #include "playhead_to_frame_dialog.h"
-#include <dcp/raw_convert.h>
-
-using dcp::raw_convert;
+#include "lib/locale_convert.h"
 
 PlayheadToFrameDialog::PlayheadToFrameDialog (wxWindow* parent, int fps)
        : TableDialog (parent, _("Go to frame"), 2, 1, true)
@@ -36,5 +34,5 @@ PlayheadToFrameDialog::PlayheadToFrameDialog (wxWindow* parent, int fps)
 DCPTime
 PlayheadToFrameDialog::get () const
 {
-       return DCPTime::from_frames (raw_convert<Frame> (wx_to_std (_frame->GetValue ())) - 1, _fps);
+       return DCPTime::from_frames (locale_convert<Frame> (wx_to_std (_frame->GetValue ())) - 1, _fps);
 }
index 1378af967b09a95adf2361343a4d9a4ea25964f2..bddf615d0c68ce1ed276787c115a3206aede1dea 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "time_picker.h"
 #include "wx_util.h"
-#include <dcp/raw_convert.h>
+#include "lib/locale_convert.h"
 #include <wx/spinctrl.h>
 #include <boost/bind.hpp>
 #include <iomanip>
@@ -32,7 +32,6 @@ using std::max;
 using std::string;
 using std::cout;
 using boost::bind;
-using dcp::raw_convert;
 
 TimePicker::TimePicker (wxWindow* parent, wxDateTime time)
        : wxPanel (parent)
@@ -97,8 +96,8 @@ TimePicker::update_spin ()
        }
 
        _block_update = true;
-       _hours_spin->SetValue (raw_convert<int> (wx_to_std (_hours->GetValue())));
-       _minutes_spin->SetValue (raw_convert<int> (wx_to_std (_minutes->GetValue())));
+       _hours_spin->SetValue (locale_convert<int> (wx_to_std (_hours->GetValue())));
+       _minutes_spin->SetValue (locale_convert<int> (wx_to_std (_minutes->GetValue())));
        _block_update = false;
 
        Changed ();
index f4de5502838a53526e18c69da085d5d5546c5199..25cf2b5248ae46ccdfeda0ff5ce19c9e4b4a53dc 100644 (file)
@@ -30,8 +30,8 @@
 #include "lib/dcp_subtitle_content.h"
 #include "lib/audio_content.h"
 #include "lib/text_subtitle_content.h"
+#include "lib/locale_convert.h"
 #include "lib/video_content.h"
-#include <dcp/raw_convert.h>
 #include <boost/foreach.hpp>
 #include <set>
 #include <iostream>
@@ -42,7 +42,6 @@ using std::set;
 using boost::shared_ptr;
 using boost::dynamic_pointer_cast;
 using boost::optional;
-using dcp::raw_convert;
 
 TimingPanel::TimingPanel (ContentPanel* p, FilmViewer* viewer)
        /* horrid hack for apparent lack of context support with wxWidgets i18n code */
@@ -288,7 +287,7 @@ TimingPanel::film_content_changed (int property)
                bool const single_frame_image_content = content && dynamic_pointer_cast<const ImageContent> (content) && content->number_of_paths() == 1;
 
                if ((check_vc.size() == 1 || count_ac == 1 || count_sc == 1) && !single_frame_image_content) {
-                       checked_set (_video_frame_rate, raw_convert<string> (content->video_frame_rate().get(), 5));
+                       checked_set (_video_frame_rate, locale_convert<string> (content->video_frame_rate().get(), 5));
                        _video_frame_rate->Enable (true);
                } else {
                        checked_set (_video_frame_rate, wxT (""));
@@ -399,7 +398,7 @@ TimingPanel::video_frame_rate_changed ()
 void
 TimingPanel::set_video_frame_rate ()
 {
-       double const fr = raw_convert<double> (wx_to_std (_video_frame_rate->GetValue ()));
+       double const fr = locale_convert<double> (wx_to_std (_video_frame_rate->GetValue ()));
        BOOST_FOREACH (shared_ptr<Content> i, _parent->selected ()) {
                i->set_video_frame_rate (fr);
        }
index efaf76e28620aab1f4522e496bb4683fc9c259ee..096d340e868b8c4139547b5ca1a572b82cd32d20 100644 (file)
@@ -23,8 +23,8 @@
 #include "wx_util.h"
 #include "lib/image.h"
 #include "lib/dcp_video.h"
+#include "lib/locale_convert.h"
 #include <dcp/openjpeg_image.h>
-#include <dcp/raw_convert.h>
 #include <wx/rawbmp.h>
 #include <wx/graphics.h>
 #include <boost/bind.hpp>
@@ -35,7 +35,6 @@ using std::min;
 using std::string;
 using boost::weak_ptr;
 using boost::shared_ptr;
-using dcp::raw_convert;
 
 int const VideoWaveformPlot::_vertical_margin = 8;
 
@@ -119,7 +118,7 @@ VideoWaveformPlot::paint ()
                } else if (n < 1000) {
                        x += extra[2];
                }
-               gc->DrawText (std_to_wx (raw_convert<string> (n)), x, y - (label_height / 2));
+               gc->DrawText (std_to_wx (locale_convert<string> (n)), x, y - (label_height / 2));
        }
 
        wxImage waveform (_waveform->size().width, height, _waveform->data()[0], true);
index e12443dd34bc7b27c147604f3828c9d95a3a4fa0..cb9f72a42b0e689e1edd83d045570587f73609c8 100644 (file)
@@ -26,7 +26,7 @@
 #include "file_picker_ctrl.h"
 #include "lib/config.h"
 #include "lib/util.h"
-#include <dcp/raw_convert.h>
+#include "lib/locale_convert.h"
 #include <wx/spinctrl.h>
 #include <boost/thread.hpp>
 
@@ -365,17 +365,17 @@ setup_audio_channels_choice (wxChoice* choice, int minimum)
        vector<pair<string, string> > items;
        for (int i = minimum; i <= 16; i += 2) {
                if (i == 2) {
-                       items.push_back (make_pair (wx_to_std (_("2 - stereo")), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (wx_to_std (_("2 - stereo")), locale_convert<string> (i)));
                } else if (i == 4) {
-                       items.push_back (make_pair (wx_to_std (_("4 - L/C/R/Lfe")), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (wx_to_std (_("4 - L/C/R/Lfe")), locale_convert<string> (i)));
                } else if (i == 6) {
-                       items.push_back (make_pair (wx_to_std (_("6 - 5.1")), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (wx_to_std (_("6 - 5.1")), locale_convert<string> (i)));
                } else if (i == 8) {
-                       items.push_back (make_pair (wx_to_std (_("8 - 5.1/HI/VI")), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (wx_to_std (_("8 - 5.1/HI/VI")), locale_convert<string> (i)));
                } else if (i == 12) {
-                       items.push_back (make_pair (wx_to_std (_("12 - 7.1/HI/VI")), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (wx_to_std (_("12 - 7.1/HI/VI")), locale_convert<string> (i)));
                } else {
-                       items.push_back (make_pair (dcp::raw_convert<string> (i), dcp::raw_convert<string> (i)));
+                       items.push_back (make_pair (locale_convert<string> (i), locale_convert<string> (i)));
                }
        }
 
index bb6694db223a0d75b4a8fbf45963f87c25f9a69f..e7fddd720e72b9d6b5719e36c60c85914c00d9bd 100644 (file)
 
 */
 
-#include <boost/test/unit_test.hpp>
 #include "lib/ffmpeg_content.h"
 #include "lib/ratio.h"
 #include "lib/video_content.h"
+#include <dcp/raw_convert.h>
+#include <boost/test/unit_test.hpp>
 
 using std::list;
 using std::string;