X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Fwx%2Ftimeline_dialog.cc;h=3a720cfecff8ec958d336c139c920bb64bcc6144;hp=d2194f5c750b16e09bbd7680c97809bfc3940fbd;hb=386e25f3b9d3fa59cbdeed458d9b3e0d21e338b8;hpb=9e065519743ff8eac63207552a97314febca24c7 diff --git a/src/wx/timeline_dialog.cc b/src/wx/timeline_dialog.cc index d2194f5c7..3a720cfec 100644 --- a/src/wx/timeline_dialog.cc +++ b/src/wx/timeline_dialog.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2013-2018 Carl Hetherington + Copyright (C) 2013-2019 Carl Hetherington 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) +TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr film, weak_ptr viewer) : wxDialog ( - cp->panel(), + cp->window(), wxID_ANY, _("Timeline"), wxDefaultPosition, @@ -51,7 +52,7 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr film) #endif ) , _film (film) - , _timeline (this, cp, film) + , _timeline (this, cp, film, viewer) { wxBoxSizer* sizer = new wxBoxSizer (wxVERTICAL); @@ -87,21 +88,39 @@ TimelineDialog::TimelineDialog (ContentPanel* cp, shared_ptr film) sizer->SetSizeHints (this); _toolbar->ToggleTool ((int) Timeline::SNAP, _timeline.snap ()); - film_changed (Film::SEQUENCE); + film_change (CHANGE_TYPE_DONE, Film::SEQUENCE); - _film_changed_connection = film->Changed.connect (bind (&TimelineDialog::film_changed, this, _1)); + _film_changed_connection = film->Change.connect (bind (&TimelineDialog::film_change, this, _1, _2)); } 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()); } void -TimelineDialog::film_changed (Film::Property p) +TimelineDialog::film_change (ChangeType type, Film::Property p) { + if (type != CHANGE_TYPE_DONE) { + return; + } + shared_ptr film = _film.lock (); if (!film) { return;