Fix crash in verification due to mismatched wxString::Format placeholder.
[dcpomatic.git] / src / wx / timeline_dialog.cc
index 050f900534f7431e64724e4af2038985f36709e9..3a720cfecff8ec958d336c139c920bb64bcc6144 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2013-2018 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2013-2019 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -33,10 +33,11 @@ using std::list;
 using std::cout;
 using std::string;
 using boost::shared_ptr;
+using boost::weak_ptr;
 
-TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film)
+TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film, weak_ptr<FilmViewer> viewer)
        : wxDialog (
-               cp->panel(),
+               cp->window(),
                wxID_ANY,
                _("Timeline"),
                wxDefaultPosition,
@@ -51,7 +52,7 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film)
 #endif
                )
        , _film (film)
-       , _timeline (this, cp, film)
+       , _timeline (this, cp, film, viewer)
 {
        wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL);
 
@@ -95,7 +96,21 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr<Film> film)
 wxString
 TimelineDialog::bitmap_path (string name)
 {
-       boost::filesystem::path p = shared_path() / String::compose("%1.png", name);
+       boost::filesystem::path base;
+
+#ifdef DCPOMATIC_DEBUG
+       /* Hack to allow OS X to find icons when running from the source tree */
+       char* path = getenv ("DCPOMATIC_GRAPHICS");
+       if (path) {
+               base = path;
+       } else {
+               base = shared_path();
+       }
+#else
+       base = shared_path();
+#endif
+
+       boost::filesystem::path p = base / String::compose("%1.png", name);
        return std_to_wx (p.string());
 }