Initial stuff; mostly ok but some hints are still not implemented as warnings. attic/warnings
authorCarl Hetherington <cth@carlh.net>
Wed, 6 Jan 2016 23:45:28 +0000 (23:45 +0000)
committerCarl Hetherington <cth@carlh.net>
Tue, 26 Apr 2016 22:05:14 +0000 (23:05 +0100)
graphics/blank.png [new file with mode: 0644]
graphics/warning.png [new file with mode: 0644]
graphics/wscript
src/wx/dcp_panel.cc
src/wx/dcp_panel.h
src/wx/fonts_dialog.cc
src/wx/fonts_dialog.h
src/wx/hints_dialog.cc
src/wx/warning.cc [new file with mode: 0644]
src/wx/warning.h [new file with mode: 0644]
src/wx/wscript

diff --git a/graphics/blank.png b/graphics/blank.png
new file mode 100644 (file)
index 0000000..c110dde
Binary files /dev/null and b/graphics/blank.png differ
diff --git a/graphics/warning.png b/graphics/warning.png
new file mode 100644 (file)
index 0000000..45b64a7
Binary files /dev/null and b/graphics/warning.png differ
index 88e11124f5efc117c35d2fded768f077e66c4357..cd2c58d43851bd19d9a9aaa136b71d0b9a7ab7f7 100644 (file)
@@ -29,3 +29,5 @@ def build(bld):
     if not bld.env.TARGET_WINDOWS:
         bld.install_files('${PREFIX}/share/dcpomatic2', 'dcpomatic2_server_small.png')
         bld.install_files('${PREFIX}/share/dcpomatic2', 'splash.png')
+        bld.install_files('${PREFIX}/share/dcpomatic2', 'warning.png')
+        bld.install_files('${PREFIX}/share/dcpomatic2', 'blank.png')
index bc3309a6ba8e830f908307c101ffeda0003f1c2c..5c71187ada247971e02c3cb27d035e247f8eec2c 100644 (file)
@@ -22,6 +22,7 @@
 #include "key_dialog.h"
 #include "isdcf_metadata_dialog.h"
 #include "audio_dialog.h"
+#include "warning.h"
 #include "lib/ratio.h"
 #include "lib/config.h"
 #include "lib/dcp_content_type.h"
@@ -30,6 +31,7 @@
 #include "lib/ffmpeg_content.h"
 #include "lib/audio_processor.h"
 #include "lib/dcp_content.h"
+#include "lib/cross.h"
 #include <dcp/key.h>
 #include <dcp/raw_convert.h>
 #include <wx/wx.h>
@@ -49,6 +51,7 @@ using std::max;
 using std::make_pair;
 using boost::lexical_cast;
 using boost::shared_ptr;
+using boost::dynamic_pointer_cast;
 
 DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
        : _audio_dialog (0)
@@ -64,9 +67,9 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
 
        int r = 0;
 
-       add_label_to_sizer (grid, _panel, _("Name"), true, wxGBPosition (r, 0));
+       add_label_to_sizer (grid, _panel, _("Name"), true, wxGBPosition (r, 0), wxGBSpan (1, 2));
        _name = new wxTextCtrl (_panel, wxID_ANY);
-       grid->Add (_name, wxGBPosition(r, 1), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
+       grid->Add (_name, wxGBPosition(r, 2), wxDefaultSpan, wxEXPAND | wxLEFT | wxRIGHT);
        ++r;
 
        int flags = wxALIGN_CENTER_VERTICAL;
@@ -83,7 +86,7 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
                s->Add (_edit_isdcf_button, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
                _copy_isdcf_name_button = new wxButton (_panel, wxID_ANY, _("Copy as name"));
                s->Add (_copy_isdcf_name_button, 1, wxEXPAND | wxLEFT, DCPOMATIC_SIZER_X_GAP);
-               grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxEXPAND);
+               grid->Add (s, wxGBPosition (r, 2), wxDefaultSpan, wxEXPAND);
                ++r;
        }
 
@@ -95,12 +98,12 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
                wxALIGN_CENTRE_HORIZONTAL | wxST_NO_AUTORESIZE | wxST_ELLIPSIZE_MIDDLE
                );
 
-       grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL | wxEXPAND);
+       grid->Add (_dcp_name, wxGBPosition(r, 0), wxGBSpan (1, 3), wxALIGN_CENTER_VERTICAL | wxEXPAND);
        ++r;
 
        add_label_to_sizer (grid, _panel, _("Content Type"), true, wxGBPosition (r, 0));
        _dcp_content_type = new wxChoice (_panel, wxID_ANY);
-       grid->Add (_dcp_content_type, wxGBPosition (r, 1));
+       grid->Add (_dcp_content_type, wxGBPosition (r, 2));
        ++r;
 
        _notebook = new wxNotebook (_panel, wxID_ANY);
@@ -110,11 +113,11 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
        _notebook->AddPage (make_audio_panel (), _("Audio"), false);
 
        _signed = new wxCheckBox (_panel, wxID_ANY, _("Signed"));
-       grid->Add (_signed, wxGBPosition (r, 0), wxGBSpan (1, 2));
+       grid->Add (_signed, wxGBPosition (r, 0));
        ++r;
 
        _encrypted = new wxCheckBox (_panel, wxID_ANY, _("Encrypted"));
-       grid->Add (_encrypted, wxGBPosition (r, 0), wxGBSpan (1, 2));
+       grid->Add (_encrypted, wxGBPosition (r, 0));
        ++r;
 
         wxClientDC dc (_panel);
@@ -122,19 +125,19 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
         size.SetHeight (-1);
 
        {
-               add_label_to_sizer (grid, _panel, _("Key"), true, wxGBPosition (r, 0));
-               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-               _key = new wxStaticText (_panel, wxID_ANY, "", wxDefaultPosition, size);
-               s->Add (_key, 1, wxALIGN_CENTER_VERTICAL);
-               _edit_key = new wxButton (_panel, wxID_ANY, _("Edit..."));
-               s->Add (_edit_key);
-               grid->Add (s, wxGBPosition (r, 1));
-               ++r;
+               add_label_to_sizer (grid, _panel, _("Key"), true, wxGBPosition (r, 0));
+               wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+               _key = new wxStaticText (_panel, wxID_ANY, "", wxDefaultPosition, size);
+               s->Add (_key, 1, wxALIGN_CENTER_VERTICAL);
+               _edit_key = new wxButton (_panel, wxID_ANY, _("Edit..."));
+               s->Add (_edit_key);
+               grid->Add (s, wxGBPosition (r, 2));
+               ++r;
        }
 
        add_label_to_sizer (grid, _panel, _("Reels"), true, wxGBPosition (r, 0));
        _reel_type = new wxChoice (_panel, wxID_ANY);
-       grid->Add (_reel_type, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+       grid->Add (_reel_type, wxGBPosition (r, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
        ++r;
 
        add_label_to_sizer (grid, _panel, _("Reel length"), true, wxGBPosition (r, 0));
@@ -144,13 +147,15 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
                _reel_length = new wxSpinCtrl (_panel, wxID_ANY);
                s->Add (_reel_length);
                add_label_to_sizer (s, _panel, _("GB"), false);
-               grid->Add (s, wxGBPosition (r, 1));
+               grid->Add (s, wxGBPosition (r, 2));
                ++r;
        }
 
        add_label_to_sizer (grid, _panel, _("Standard"), true, wxGBPosition (r, 0));
+       _standard_warning = new Warning (_panel);
+       grid->Add (_standard_warning->get(), wxGBPosition (r, 1));
        _standard = new wxChoice (_panel, wxID_ANY);
-       grid->Add (_standard, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+       grid->Add (_standard, wxGBPosition (r, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
        ++r;
 
        _upload_after_make_dcp = new wxCheckBox (_panel, wxID_ANY, _("Upload DCP to TMS after it is made"));
@@ -185,6 +190,8 @@ DCPPanel::DCPPanel (wxNotebook* n, boost::shared_ptr<Film> film)
        _standard->Append (_("Interop"));
 
        Config::instance()->Changed.connect (boost::bind (&DCPPanel::config_changed, this));
+
+       setup_warnings ();
 }
 
 void
@@ -418,6 +425,8 @@ DCPPanel::film_changed (int p)
        default:
                break;
        }
+
+       setup_warnings ();
 }
 
 void
@@ -432,6 +441,8 @@ DCPPanel::film_content_changed (int property)
            property == DCPContentProperty::REFERENCE_SUBTITLE) {
                setup_dcp_name ();
        }
+
+       setup_warnings ();
 }
 
 
@@ -616,6 +627,7 @@ DCPPanel::setup_frame_rate_widget ()
        }
 
        _frame_rate_sizer->Layout ();
+       _video_grid->Layout ();
 }
 
 wxPanel *
@@ -623,24 +635,28 @@ DCPPanel::make_video_panel ()
 {
        wxPanel* panel = new wxPanel (_notebook);
        wxSizer* sizer = new wxBoxSizer (wxVERTICAL);
-       wxGridBagSizer* grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
-       sizer->Add (grid, 0, wxALL, 8);
+       _video_grid = new wxGridBagSizer (DCPOMATIC_SIZER_X_GAP, DCPOMATIC_SIZER_Y_GAP);
+       sizer->Add (_video_grid, 0, wxALL, 8);
        panel->SetSizer (sizer);
 
        int r = 0;
 
-       add_label_to_sizer (grid, panel, _("Container"), true, wxGBPosition (r, 0));
+       add_label_to_sizer (_video_grid, panel, _("Container"), true, wxGBPosition (r, 0));
+       _container_warning = new Warning (panel);
+       _video_grid->Add (_container_warning->get(), wxGBPosition (r, 1));
        {
                wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
                _container = new wxChoice (panel, wxID_ANY);
                s->Add (_container, 1, wxEXPAND | wxRIGHT, DCPOMATIC_SIZER_X_GAP);
                _container_size = new wxStaticText (panel, wxID_ANY, wxT (""));
                s->Add (_container_size, 1, wxLEFT | wxALIGN_CENTER_VERTICAL);
-               grid->Add (s, wxGBPosition (r,1 ), wxDefaultSpan, wxEXPAND);
+               _video_grid->Add (s, wxGBPosition (r, 2), wxDefaultSpan, wxEXPAND);
                ++r;
        }
 
-       add_label_to_sizer (grid, panel, _("Frame Rate"), true, wxGBPosition (r, 0));
+       add_label_to_sizer (_video_grid, panel, _("Frame Rate"), true, wxGBPosition (r, 0));
+       _frame_rate_warning = new Warning (panel);
+       _video_grid->Add (_frame_rate_warning->get(), wxGBPosition (r, 1));
        {
                _frame_rate_sizer = new wxBoxSizer (wxHORIZONTAL);
                _frame_rate_choice = new wxChoice (panel, wxID_ANY);
@@ -649,27 +665,31 @@ DCPPanel::make_video_panel ()
                _frame_rate_sizer->Add (_frame_rate_spin, 1, wxALIGN_CENTER_VERTICAL);
                setup_frame_rate_widget ();
                _best_frame_rate = new wxButton (panel, wxID_ANY, _("Use best"));
-               _frame_rate_sizer->Add (_best_frame_rate, 1, wxALIGN_CENTER_VERTICAL);
-               grid->Add (_frame_rate_sizer, wxGBPosition (r, 1));
+               _frame_rate_sizer->Add (_best_frame_rate, 0, wxALIGN_CENTER_VERTICAL);
+               _video_grid->Add (_frame_rate_sizer, wxGBPosition (r, 2));
                ++r;
        }
 
        _three_d = new wxCheckBox (panel, wxID_ANY, _("3D"));
-       grid->Add (_three_d, wxGBPosition (r, 0), wxGBSpan (1, 2));
+       _video_grid->Add (_three_d, wxGBPosition (r, 0));
+       _three_d_warning = new Warning (panel);
+       _video_grid->Add (_three_d_warning->get(), wxGBPosition (r, 1));
        ++r;
 
-       add_label_to_sizer (grid, panel, _("Resolution"), true, wxGBPosition (r, 0));
+       add_label_to_sizer (_video_grid, panel, _("Resolution"), true, wxGBPosition (r, 0), wxGBSpan (1, 2));
        _resolution = new wxChoice (panel, wxID_ANY);
-       grid->Add (_resolution, wxGBPosition (r, 1));
+       _video_grid->Add (_resolution, wxGBPosition (r, 2));
        ++r;
 
        {
-               add_label_to_sizer (grid, panel, _("JPEG2000 bandwidth"), true, wxGBPosition (r, 0));
+               add_label_to_sizer (_video_grid, panel, _("JPEG2000 bandwidth"), true, wxGBPosition (r, 0));
+               _j2k_bandwidth_warning = new Warning (panel);
+               _video_grid->Add (_j2k_bandwidth_warning->get(), wxGBPosition (r, 1));
                wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
                _j2k_bandwidth = new wxSpinCtrl (panel, wxID_ANY);
                s->Add (_j2k_bandwidth, 1);
                add_label_to_sizer (s, panel, _("Mbit/s"), false);
-               grid->Add (s, wxGBPosition (r, 1));
+               _video_grid->Add (s, wxGBPosition (r, 2));
        }
        ++r;
 
@@ -742,16 +762,18 @@ DCPPanel::make_audio_panel ()
        add_label_to_sizer (grid, panel, _("Channels"), true, wxGBPosition (r, 0));
        _audio_channels = new wxChoice (panel, wxID_ANY);
        setup_audio_channels_choice ();
-       grid->Add (_audio_channels, wxGBPosition (r, 1));
+       _audio_channels_warning = new Warning (panel);
+       grid->Add (_audio_channels_warning->get(), wxGBPosition (r, 1));
+       grid->Add (_audio_channels, wxGBPosition (r, 2));
        ++r;
 
-       add_label_to_sizer (grid, panel, _("Processor"), true, wxGBPosition (r, 0));
+       add_label_to_sizer (grid, panel, _("Processor"), true, wxGBPosition (r, 0), wxGBSpan (1, 2));
        _audio_processor = new wxChoice (panel, wxID_ANY);
        _audio_processor->Append (_("None"), new wxStringClientData (N_("none")));
        BOOST_FOREACH (AudioProcessor const * ap, AudioProcessor::all ()) {
                _audio_processor->Append (std_to_wx (ap->name ()), new wxStringClientData (std_to_wx (ap->id ())));
        }
-       grid->Add (_audio_processor, wxGBPosition (r, 1));
+       grid->Add (_audio_processor, wxGBPosition (r, 2));
        ++r;
 
        _show_audio = new wxButton (panel, wxID_ANY, _("Show audio..."));
@@ -818,3 +840,73 @@ DCPPanel::reel_length_changed ()
 
        _film->set_reel_length (_reel_length->GetValue() * 1000000000LL);
 }
+
+void
+DCPPanel::setup_warnings ()
+{
+       if (!_film) {
+               _container_warning->disable ();
+               return;
+       }
+
+       ContentList content = _film->content ();
+
+       int flat_or_narrower = 0;
+       int scope = 0;
+       BOOST_FOREACH (shared_ptr<const Content> i, content) {
+               shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (i);
+               if (vc) {
+                       Ratio const * r = vc->scale().ratio ();
+                       if (r && r->id() == "239") {
+                               ++scope;
+                       } else if (r && r->id() != "239" && r->id() != "full-frame") {
+                               ++flat_or_narrower;
+                       }
+               }
+       }
+
+       _container_warning->disable ();
+       _frame_rate_warning->disable ();
+       _j2k_bandwidth_warning->disable ();
+       _three_d_warning->disable ();
+       _audio_channels_warning->disable ();
+       _standard_warning->disable ();
+
+       if (scope && !flat_or_narrower && _film->container()->id() == "185") {
+               _container_warning->enable (_("All of your content is in Scope (2.39:1) but your DCP's container is Flat (1.85:1).  This will letter-box your content inside a Flat (1.85:1) frame.  You may prefer to set the container to Scope (2.39:1)."));
+       }
+
+       if (!scope && flat_or_narrower && _film->container()->id() == "239") {
+               _container_warning->enable (_("All of your content is at 1.85:1 or narrower but your DCP's container is Scope (2.39:1).  This will pillar-box your content inside a Flat (1.85:1) frame.  You may prefer to set the container to Flat."));
+       }
+
+       if (_film->video_frame_rate() != 24 && _film->video_frame_rate() != 48) {
+               _frame_rate_warning->enable (wxString::Format (_("Your DCP frame rate (%d fps) may cause problems in a few (mostly older) projectors.  If possible, use 24 or 48 frames per second."), _film->video_frame_rate()));
+       }
+
+       if (_film->j2k_bandwidth() >= 245000000) {
+               _j2k_bandwidth_warning->enable (_("A few projectors have problems playing back very high bit-rate DCPs.  It is a good idea to drop the JPEG2000 bandwidth down to about 200Mbit/s; this is unlikely to have any visible effect on the image."));
+       }
+
+       int three_d = 0;
+       BOOST_FOREACH (shared_ptr<const Content> i, content) {
+               shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (i);
+               if (vc && vc->video_frame_type() != VIDEO_FRAME_TYPE_2D) {
+                       ++three_d;
+               }
+       }
+
+       if (three_d > 0 && !_film->three_d()) {
+               _three_d_warning->enable (_("You are using 3D content but your DCP is set to 2D.  Set the DCP to 3D if you want to play it back on a 3D system (e.g. Real-D, MasterImage etc.)"));
+       }
+
+       if (_film->audio_channels() < 6) {
+               _audio_channels_warning->enable (_("Your DCP has fewer than 6 audio channels.  This may cause problems on some projectors."));
+       }
+
+       if (_film->interop() && _film->video_frame_rate() != 24 && _film->video_frame_rate() != 48) {
+               _standard_warning->enable (_("You are set up for an Interop DCP at a frame rate which is not officially supported.  You are advised to make a SMPTE DCP instead."));
+       }
+
+       _video_grid->Layout ();
+}
index 510a18744ba0eb9a485a8a8912a78029806be29c..e0b6b89d9add897eac0a317a393e8b9a7574c181 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2015 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -17,6 +17,7 @@
 
 */
 
+#include <wx/bitmap.h>
 #include <boost/shared_ptr.hpp>
 #include <boost/noncopyable.hpp>
 
@@ -30,7 +31,11 @@ class wxChoice;
 class wxButton;
 class wxSpinCtrl;
 class wxSizer;
+class wxStaticBitmap;
+class wxWindow;
+class wxGridBagSizer;
 
+class Warning;
 class AudioDialog;
 
 class Film;
@@ -79,6 +84,7 @@ private:
        void setup_container ();
        void setup_dcp_name ();
        void setup_audio_channels_choice ();
+       void setup_warnings ();
 
        int minimum_allowed_audio_channels () const;
 
@@ -95,21 +101,27 @@ private:
        wxTextCtrl* _name;
        wxStaticText* _dcp_name;
        wxCheckBox* _use_isdcf_name;
+       Warning* _container_warning;
        wxChoice* _container;
        wxStaticText* _container_size;
        wxButton* _edit_isdcf_button;
        wxButton* _copy_isdcf_name_button;
+       Warning* _j2k_bandwidth_warning;
        wxSpinCtrl* _j2k_bandwidth;
+       Warning* _frame_rate_warning;
        wxChoice* _dcp_content_type;
        wxChoice* _frame_rate_choice;
        wxSpinCtrl* _frame_rate_spin;
        wxSizer* _frame_rate_sizer;
+       Warning* _audio_channels_warning;
        wxChoice* _audio_channels;
        wxChoice* _audio_processor;
        wxButton* _show_audio;
        wxButton* _best_frame_rate;
+       Warning* _three_d_warning;
        wxCheckBox* _three_d;
        wxChoice* _resolution;
+       Warning* _standard_warning;
        wxChoice* _standard;
        wxCheckBox* _signed;
        wxCheckBox* _encrypted;
@@ -119,6 +131,8 @@ private:
        wxSpinCtrl* _reel_length;
        wxCheckBox* _upload_after_make_dcp;
 
+       wxGridBagSizer* _video_grid;
+
        AudioDialog* _audio_dialog;
 
        boost::shared_ptr<Film> _film;
index b79580d7cf9ad5dec487e5ca4bd86f6ced062f81..f93b93a9c2d832cda79f86cc30f79537a12e47de 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -23,7 +23,9 @@
 #include "font_files_dialog.h"
 #include "lib/font.h"
 #include "lib/subtitle_content.h"
+#include "lib/cross.h"
 #include <wx/wx.h>
+#include <wx/imaglist.h>
 #include <boost/foreach.hpp>
 #include <iostream>
 
@@ -31,6 +33,7 @@ using std::list;
 using std::string;
 using std::cout;
 using boost::shared_ptr;
+using boost::optional;
 
 FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<SubtitleContent> content)
        : wxDialog (parent, wxID_ANY, _("Fonts"))
@@ -38,6 +41,13 @@ FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<SubtitleContent> content)
 {
        _fonts = new wxListCtrl (this, wxID_ANY, wxDefaultPosition, wxSize (550, 200), wxLC_REPORT | wxLC_SINGLE_SEL);
 
+       wxImageList* image_list = new wxImageList ();
+       boost::filesystem::path p = shared_path() / "warning.png";
+       wxBitmap warning;
+       warning.LoadFile (std_to_wx(p.string()), wxBITMAP_TYPE_PNG);
+       image_list->Add (warning);
+       _fonts->AssignImageList (image_list, wxIMAGE_LIST_SMALL);
+
        {
                wxListItem ip;
                ip.SetId (0);
@@ -93,6 +103,35 @@ FontsDialog::FontsDialog (wxWindow* parent, shared_ptr<SubtitleContent> content)
        setup ();
 }
 
+void
+FontsDialog::set_variant (int n, shared_ptr<Font> font, FontFiles::Variant variant)
+{
+       if (font->file(variant)) {
+               wxListItem item;
+
+               item.SetId (n);
+               optional<boost::filesystem::path> const p = font->file (variant);
+               if (p && boost::filesystem::file_size (p.get()) >= (640 * 1024)) {
+                       item.SetImage (0);
+               }
+               item.SetText (font->file(variant).get().leaf().string ());
+
+               switch (variant) {
+               case FontFiles::NORMAL:
+                       _fonts->SetColumn (1, item);
+                       break;
+               case FontFiles::ITALIC:
+                       _fonts->SetColumn (2, item);
+                       break;
+               case FontFiles::BOLD:
+                       _fonts->SetColumn (3, item);
+                       break;
+               default:
+                       DCPOMATIC_ASSERT (false);
+               }
+       }
+}
+
 void
 FontsDialog::setup ()
 {
@@ -108,9 +147,9 @@ FontsDialog::setup ()
                item.SetId (n);
                _fonts->InsertItem (item);
                _fonts->SetItem (n, 0, std_to_wx (i->id ()));
-               if (i->file(FontFiles::NORMAL)) {
-                       _fonts->SetItem (n, 1, i->file(FontFiles::NORMAL).get().leaf().string ());
-               }
+               set_variant (n, i, FontFiles::NORMAL);
+               set_variant (n, i, FontFiles::BOLD);
+               set_variant (n, i, FontFiles::ITALIC);
                ++n;
        }
 
index e04dc9937035407362eb25ac8c7401a8686dd6f9..bdb7380c9727de46f7c0903fde61625d984b3c02 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2014-2015 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2014-2016 Carl Hetherington <cth@carlh.net>
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
@@ -17,6 +17,7 @@
 
 */
 
+#include "lib/font_files.h"
 #include <wx/listctrl.h>
 #include <wx/wx.h>
 #include <boost/shared_ptr.hpp>
@@ -24,6 +25,7 @@
 #include <boost/filesystem.hpp>
 
 class SubtitleContent;
+class Font;
 
 class FontsDialog : public wxDialog
 {
@@ -35,6 +37,7 @@ private:
        void setup_sensitivity ();
        void selection_changed ();
        void edit_clicked ();
+       void set_variant (int n, boost::shared_ptr<Font> font, FontFiles::Variant variant);
 
        boost::weak_ptr<SubtitleContent> _content;
        wxListCtrl* _fonts;
index 2cf109e5512a944f2c05293e348a4378b2b2bb6e..bcfe6af05d65b718bb0d294b14d50ad3a5881fd7 100644 (file)
@@ -96,56 +96,6 @@ HintsDialog::film_changed ()
                _text->WriteText (_("You have specified a font file which is larger than 640kB.  This is very likely to cause problems on playback."));
        }
 
-       if (film->audio_channels() < 6) {
-               hint = true;
-               _text->WriteText (_("Your DCP has fewer than 6 audio channels.  This may cause problems on some projectors."));
-               _text->Newline ();
-       }
-
-       int flat_or_narrower = 0;
-       int scope = 0;
-       BOOST_FOREACH (shared_ptr<const Content> i, content) {
-               shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (i);
-               if (vc) {
-                       Ratio const * r = vc->scale().ratio ();
-                       if (r && r->id() == "239") {
-                               ++scope;
-                       } else if (r && r->id() != "239" && r->id() != "full-frame") {
-                               ++flat_or_narrower;
-                       }
-               }
-       }
-
-       if (scope && !flat_or_narrower && film->container()->id() == "185") {
-               hint = true;
-               _text->WriteText (_("All of your content is in Scope (2.39:1) but your DCP's container is Flat (1.85:1).  This will letter-box your content inside a Flat (1.85:1) frame.  You may prefer to set your DCP's container to Scope (2.39:1) in the \"DCP\" tab."));
-               _text->Newline ();
-       }
-
-       if (!scope && flat_or_narrower && film->container()->id() == "239") {
-               hint = true;
-               _text->WriteText (_("All of your content is at 1.85:1 or narrower but your DCP's container is Scope (2.39:1).  This will pillar-box your content inside a Flat (1.85:1) frame.  You may prefer to set your DCP's container to Flat (1.85:1) in the \"DCP\" tab."));
-               _text->Newline ();
-       }
-
-       if (film->video_frame_rate() != 24 && film->video_frame_rate() != 48) {
-               hint = true;
-               _text->WriteText (wxString::Format (_("Your DCP frame rate (%d fps) may cause problems in a few (mostly older) projectors.  Use 24 or 48 frames per second to be on the safe side."), film->video_frame_rate()));
-               _text->Newline ();
-       }
-
-       if (film->j2k_bandwidth() >= 245000000) {
-               hint = true;
-               _text->WriteText (_("A few projectors have problems playing back very high bit-rate DCPs.  It is a good idea to drop the JPEG2000 bandwidth down to about 200Mbit/s; this is unlikely to have any visible effect on the image."));
-               _text->Newline ();
-       }
-
-       if (film->interop() && film->video_frame_rate() != 24 && film->video_frame_rate() != 48) {
-               hint = true;
-               _text->WriteText (_("You are set up for an Interop DCP at a frame rate which is not officially supported.  You are advised to make a SMPTE DCP instead."));
-               _text->Newline ();
-       }
-
        int vob = 0;
        BOOST_FOREACH (shared_ptr<const Content> i, content) {
                if (boost::algorithm::starts_with (i->path(0).filename().string(), "VTS_")) {
@@ -159,20 +109,6 @@ HintsDialog::film_changed ()
                _text->Newline ();
        }
 
-       int three_d = 0;
-       BOOST_FOREACH (shared_ptr<const Content> i, content) {
-               shared_ptr<const VideoContent> vc = dynamic_pointer_cast<const VideoContent> (i);
-               if (vc && vc->video_frame_type() != VIDEO_FRAME_TYPE_2D) {
-                       ++three_d;
-               }
-       }
-
-       if (three_d > 0 && !film->three_d()) {
-               hint = true;
-               _text->WriteText (_("You are using 3D content but your DCP is set to 2D.  Set the DCP to 3D if you want to play it back on a 3D system (e.g. Real-D, MasterImage etc.)"));
-               _text->Newline ();
-       }
-
        _text->EndSymbolBullet ();
 
        if (!hint) {
diff --git a/src/wx/warning.cc b/src/wx/warning.cc
new file mode 100644 (file)
index 0000000..f970780
--- /dev/null
@@ -0,0 +1,58 @@
+/*
+    Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+
+    This program 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,
+    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.
+
+*/
+
+#include "lib/cross.h"
+#include "warning.h"
+#include "wx_util.h"
+#include <boost/filesystem.hpp>
+
+using boost::optional;
+
+optional<wxBitmap> Warning::_blank;
+optional<wxBitmap> Warning::_warning;
+
+Warning::Warning (wxWindow* parent)
+{
+       if (!_blank) {
+               boost::filesystem::path p = shared_path() / "blank.png";
+               _blank = wxBitmap ();
+               _blank->LoadFile (std_to_wx(p.string()), wxBITMAP_TYPE_PNG);
+       }
+
+       if (!_warning) {
+               boost::filesystem::path p = shared_path() / "warning.png";
+               _warning = wxBitmap ();
+               _warning->LoadFile (std_to_wx(p.string()), wxBITMAP_TYPE_PNG);
+       }
+
+       _bitmap = new wxStaticBitmap (parent, wxID_ANY, _blank.get());
+}
+
+void
+Warning::enable (wxString tooltip)
+{
+       _bitmap->SetBitmap (_warning.get ());
+       _bitmap->SetToolTip (tooltip);
+}
+
+void
+Warning::disable ()
+{
+       _bitmap->SetBitmap (_blank.get ());
+}
diff --git a/src/wx/warning.h b/src/wx/warning.h
new file mode 100644 (file)
index 0000000..79900c0
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+    Copyright (C) 2015 Carl Hetherington <cth@carlh.net>
+
+    This program 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,
+    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.
+
+*/
+
+#include <wx/wx.h>
+#include <boost/noncopyable.hpp>
+#include <boost/optional.hpp>
+
+class Warning : public boost::noncopyable
+{
+public:
+       Warning (wxWindow* parent);
+
+       void enable (wxString tooltip);
+       void disable ();
+
+       wxWindow* get () const {
+               return _bitmap;
+       }
+
+private:
+       wxStaticBitmap* _bitmap;
+       static boost::optional<wxBitmap> _blank;
+       static boost::optional<wxBitmap> _warning;
+};
index 19ff17d4e6707f77300f365c5572bf60b7b30f20..e6200c100c5ea6890fad2c6d93e0ccc648f91104 100644 (file)
@@ -97,6 +97,7 @@ sources = """
           video_panel.cc
           video_waveform_dialog.cc
           video_waveform_plot.cc
+          warning.cc
           wx_util.cc
           wx_signal_manager.cc
           """