Merge master.
[dcpomatic.git] / src / wx / hints_dialog.cc
index 18b1f5451dc4bb460ba6265ea03841d7780c0040..74ac055082461c7897b58a0248e35785f9451858 100644 (file)
 #include <boost/algorithm/string.hpp>
 #include <wx/richtext/richtextctrl.h>
 #include "lib/film.h"
+#include "lib/ratio.h"
 #include "hints_dialog.h"
 
+using boost::shared_ptr;
+using boost::dynamic_pointer_cast;
+
 HintsDialog::HintsDialog (wxWindow* parent, boost::weak_ptr<Film> f)
        : wxDialog (parent, wxID_ANY, _("Hints"))
        , _film (f)
@@ -44,6 +48,7 @@ HintsDialog::HintsDialog (wxWindow* parent, boost::weak_ptr<Film> f)
        boost::shared_ptr<Film> film = _film.lock ();
        if (film) {
                film->Changed.connect (boost::bind (&HintsDialog::film_changed, this));
+               film->ContentChanged.connect (boost::bind (&HintsDialog::film_changed, this));
        }
 
        film_changed ();
@@ -71,13 +76,39 @@ HintsDialog::film_changed ()
                _text->Newline ();
        }
 
+       ContentList content = film->content ();
+       int flat_or_narrower = 0;
+       int scope = 0;
+       for (ContentList::const_iterator i = content.begin(); i != content.end(); ++i) {
+               shared_ptr<VideoContent> vc = dynamic_pointer_cast<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 ();
        }
 
-       ContentList content = film->content ();
        int vob = 0;
        for (ContentList::const_iterator i = content.begin(); i != content.end(); ++i) {
                if (boost::algorithm::starts_with ((*i)->path(0).filename().string(), "VTS_")) {
@@ -87,7 +118,7 @@ HintsDialog::film_changed ()
 
        if (vob > 1) {
                hint = true;
-               _text->WriteText (wxString::Format (_("You have %d files that look like they are VOB files from DVD.  You should coalesce them to ensure smooth joins between the files."), vob));
+               _text->WriteText (wxString::Format (_("You have %d files that look like they are VOB files from DVD. You should join them to ensure smooth joins between the files."), vob));
                _text->Newline ();
        }