Port DCP range dialog.
[dcpomatic.git] / src / wx / film_editor.cc
1 /*
2     Copyright (C) 2012 Carl Hetherington <cth@carlh.net>
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 /** @file src/film_editor.cc
21  *  @brief A wx widget to edit a film's metadata, and perform various functions.
22  */
23
24 #include <iostream>
25 #include <iomanip>
26 #include <wx/wx.h>
27 #include <boost/thread.hpp>
28 #include <boost/filesystem.hpp>
29 #include <boost/lexical_cast.hpp>
30 #include "lib/format.h"
31 #include "lib/film.h"
32 #include "lib/transcode_job.h"
33 #include "lib/exceptions.h"
34 #include "lib/ab_transcode_job.h"
35 #include "lib/thumbs_job.h"
36 #include "lib/job_manager.h"
37 #include "lib/filter.h"
38 #include "lib/screen.h"
39 #include "lib/config.h"
40 #include "filter_dialog.h"
41 #include "wx_util.h"
42 #include "film_editor.h"
43 #include "dcp_range_dialog.h"
44
45 using namespace std;
46 using namespace boost;
47
48 /** @param f Film to edit */
49 FilmEditor::FilmEditor (Film* f, wxWindow* parent)
50         : wxPanel (parent)
51         , _ignore_changes (false)
52         , _film (f)
53 {
54         _sizer = new wxFlexGridSizer (2, 6, 6);
55         SetSizer (_sizer);
56
57         add_label_to_sizer (_sizer, this, "Name");
58         _name = new wxTextCtrl (this, wxID_ANY);
59         _sizer->Add (_name, 1, wxEXPAND);
60
61         add_label_to_sizer (_sizer, this, "Content");
62         _content = new wxFilePickerCtrl (this, wxID_ANY, wxT (""), wxT ("Select Content File"), wxT("*.*"));
63         _sizer->Add (_content, 1, wxEXPAND);
64
65         add_label_to_sizer (_sizer, this, "Content Type");
66         _dcp_content_type = new wxComboBox (this, wxID_ANY);
67         _sizer->Add (_dcp_content_type);
68
69         add_label_to_sizer (_sizer, this, "Format");
70         _format = new wxComboBox (this, wxID_ANY);
71         _sizer->Add (_format);
72
73         {
74                 add_label_to_sizer (_sizer, this, "Crop");
75                 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
76
77                 add_label_to_sizer (s, this, "L");
78                 _left_crop = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
79                 s->Add (_left_crop, 0);
80                 add_label_to_sizer (s, this, "R");
81                 _right_crop = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
82                 s->Add (_right_crop, 0);
83                 add_label_to_sizer (s, this, "T");
84                 _top_crop = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
85                 s->Add (_top_crop, 0);
86                 add_label_to_sizer (s, this, "B");
87                 _bottom_crop = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
88                 s->Add (_bottom_crop, 0);
89
90                 _sizer->Add (s);
91         }
92
93         /* VIDEO-only stuff */
94         {
95                 video_control (add_label_to_sizer (_sizer, this, "Filters"));
96                 wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
97                 _filters = new wxStaticText (this, wxID_ANY, wxT (""));
98                 s->Add (_filters, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
99                 _filters_button = new wxButton (this, wxID_ANY, wxT ("Edit..."));
100                 s->Add (_filters_button, 0);
101                 _sizer->Add (s, 1);
102         }
103
104         video_control (add_label_to_sizer (_sizer, this, "Scaler"));
105         _scaler = new wxComboBox (this, wxID_ANY);
106         _sizer->Add (video_control (_scaler), 1);
107
108         {
109                 video_control (add_label_to_sizer (_sizer, this, "Audio Gain"));
110                 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
111                 _audio_gain = new wxSpinCtrl (this);
112                 s->Add (video_control (_audio_gain), 1);
113                 video_control (add_label_to_sizer (s, this, "dB"));
114                 _sizer->Add (s);
115         }
116
117         {
118                 video_control (add_label_to_sizer (_sizer, this, "Audio Delay"));
119                 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
120                 _audio_delay = new wxSpinCtrl (this);
121                 s->Add (video_control (_audio_delay), 1);
122                 video_control (add_label_to_sizer (s, this, "ms"));
123                 _sizer->Add (s);
124         }
125
126         video_control (add_label_to_sizer (_sizer, this, "Frames Per Second"));
127         _frames_per_second = new wxTextCtrl (this, wxID_ANY, wxT (""), wxDefaultPosition, wxDefaultSize, 0, wxTextValidator (wxFILTER_NUMERIC));
128         _sizer->Add (video_control (_frames_per_second));
129         
130         video_control (add_label_to_sizer (_sizer, this, "Original Size"));
131         _original_size = new wxStaticText (this, wxID_ANY, wxT (""));
132         _sizer->Add (video_control (_original_size), 1, wxALIGN_CENTER_VERTICAL);
133         
134         video_control (add_label_to_sizer (_sizer, this, "Length"));
135         _length = new wxStaticText (this, wxID_ANY, wxT (""));
136         _sizer->Add (video_control (_length), 1, wxALIGN_CENTER_VERTICAL);
137
138         video_control (add_label_to_sizer (_sizer, this, "Audio"));
139         _audio = new wxStaticText (this, wxID_ANY, wxT (""));
140         _sizer->Add (video_control (_audio), 1, wxALIGN_CENTER_VERTICAL);
141
142         {
143                 video_control (add_label_to_sizer (_sizer, this, "Range"));
144                 wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
145                 _dcp_range = new wxStaticText (this, wxID_ANY, wxT (""));
146                 s->Add (video_control (_dcp_range), 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
147                 _change_dcp_range_button = new wxButton (this, wxID_ANY, wxT ("Edit..."));
148                 s->Add (video_control (_change_dcp_range_button), 0, 0, 6);
149                 _sizer->Add (s);
150         }
151
152         _dcp_ab = new wxCheckBox (this, wxID_ANY, wxT ("A/B"));
153         video_control (_dcp_ab);
154         _sizer->Add (_dcp_ab, 1);
155         _sizer->AddSpacer (0);
156
157         /* STILL-only stuff */
158         still_control (add_label_to_sizer (_sizer, this, "Duration"));
159         _still_duration = new wxSpinCtrl (this);
160         _sizer->Add (still_control (_still_duration));
161         still_control (add_label_to_sizer (_sizer, this, "s"));
162
163         /* Set up our editing widgets */
164         
165         _left_crop->SetRange (0, 1024);
166         _top_crop->SetRange (0, 1024);
167         _right_crop->SetRange (0, 1024);
168         _bottom_crop->SetRange (0, 1024);
169         _audio_gain->SetRange (-60, 60);
170         _audio_delay->SetRange (-1000, 1000);
171         _still_duration->SetRange (0, 60 * 60);
172
173         vector<Format const *> fmt = Format::all ();
174         for (vector<Format const *>::iterator i = fmt.begin(); i != fmt.end(); ++i) {
175                 _format->Append (std_to_wx ((*i)->name ()));
176         }
177
178         vector<DCPContentType const *> const ct = DCPContentType::all ();
179         for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
180                 _dcp_content_type->Append (std_to_wx ((*i)->pretty_name ()));
181         }
182
183         vector<Scaler const *> const sc = Scaler::all ();
184         for (vector<Scaler const *>::const_iterator i = sc.begin(); i != sc.end(); ++i) {
185                 _scaler->Append (std_to_wx ((*i)->name()));
186         }
187
188         /* And set their values from the Film */
189         set_film (f);
190         
191         /* Now connect to them, since initial values are safely set */
192         _name->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (FilmEditor::name_changed), 0, this);
193         _frames_per_second->Connect (wxID_ANY, wxEVT_COMMAND_TEXT_UPDATED, wxCommandEventHandler (FilmEditor::frames_per_second_changed), 0, this);
194         _format->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::format_changed), 0, this);
195         _content->Connect (wxID_ANY, wxEVT_COMMAND_FILEPICKER_CHANGED, wxCommandEventHandler (FilmEditor::content_changed), 0, this);
196         _left_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::left_crop_changed), 0, this);
197         _right_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::right_crop_changed), 0, this);
198         _top_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::top_crop_changed), 0, this);
199         _bottom_crop->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::bottom_crop_changed), 0, this);
200         _filters_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::edit_filters_clicked), 0, this);
201         _scaler->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::scaler_changed), 0, this);
202         _dcp_content_type->Connect (wxID_ANY, wxEVT_COMMAND_COMBOBOX_SELECTED, wxCommandEventHandler (FilmEditor::dcp_content_type_changed), 0, this);
203         _dcp_ab->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::dcp_ab_toggled), 0, this);
204         _audio_gain->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_gain_changed), 0, this);
205         _audio_delay->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_delay_changed), 0, this);
206         _still_duration->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::still_duration_changed), 0, this);
207         _change_dcp_range_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::change_dcp_range_clicked), 0, this);
208
209         setup_visibility ();
210 }
211
212 /** Called when the left crop widget has been changed */
213 void
214 FilmEditor::left_crop_changed (wxCommandEvent &)
215 {
216         if (!_film) {
217                 return;
218         }
219
220         _ignore_changes = true;
221         _film->set_left_crop (_left_crop->GetValue ());
222         _ignore_changes = false;
223 }
224
225 /** Called when the right crop widget has been changed */
226 void
227 FilmEditor::right_crop_changed (wxCommandEvent &)
228 {
229         if (!_film) {
230                 return;
231         }
232
233         _ignore_changes = true;
234         _film->set_right_crop (_right_crop->GetValue ());
235         _ignore_changes = false;
236 }
237
238 /** Called when the top crop widget has been changed */
239 void
240 FilmEditor::top_crop_changed (wxCommandEvent &)
241 {
242         if (!_film) {
243                 return;
244         }
245
246         _ignore_changes = true;
247         _film->set_top_crop (_top_crop->GetValue ());
248         _ignore_changes = false;
249 }
250
251 /** Called when the bottom crop value has been changed */
252 void
253 FilmEditor::bottom_crop_changed (wxCommandEvent &)
254 {
255         if (!_film) {
256                 return;
257         }
258
259         _ignore_changes = true;
260         _film->set_bottom_crop (_bottom_crop->GetValue ());
261         _ignore_changes = false;
262 }
263
264 /** Called when the content filename has been changed */
265 void
266 FilmEditor::content_changed (wxCommandEvent &)
267 {
268         if (!_film) {
269                 return;
270         }
271
272         _ignore_changes = true;
273         
274         try {
275                 _film->set_content (wx_to_std (_content->GetPath ()));
276         } catch (std::exception& e) {
277                 _content->SetPath (std_to_wx (_film->directory ()));
278                 stringstream m;
279                 m << "Could not set content: " << e.what() << ".";
280                 error_dialog (this, m.str ());
281         }
282
283         _ignore_changes = false;
284 }
285
286 /** Called when the DCP A/B switch has been toggled */
287 void
288 FilmEditor::dcp_ab_toggled (wxCommandEvent &)
289 {
290         if (!_film) {
291                 return;
292         }
293         
294         _ignore_changes = true;
295         _film->set_dcp_ab (_dcp_ab->GetValue ());
296         _ignore_changes = false;
297 }
298
299 /** Called when the name widget has been changed */
300 void
301 FilmEditor::name_changed (wxCommandEvent &)
302 {
303         if (!_film) {
304                 return;
305         }
306
307         _ignore_changes = true;
308         _film->set_name (string (_name->GetValue().mb_str()));
309         _ignore_changes = false;
310 }
311
312 /** Called when the metadata stored in the Film object has changed;
313  *  so that we can update the GUI.
314  *  @param p Property of the Film that has changed.
315  */
316 void
317 FilmEditor::film_changed (Film::Property p)
318 {
319         if (!_film || _ignore_changes) {
320                 return;
321         }
322
323         stringstream s;
324                 
325         switch (p) {
326         case Film::CONTENT:
327                 _content->SetPath (std_to_wx (_film->content ()));
328                 setup_visibility ();
329                 break;
330         case Film::FORMAT:
331                 _format->SetSelection (Format::as_index (_film->format ()));
332                 break;
333         case Film::LEFT_CROP:
334                 _left_crop->SetValue (_film->left_crop ());
335                 break;
336         case Film::RIGHT_CROP:
337                 _right_crop->SetValue (_film->right_crop ());
338                 break;
339         case Film::TOP_CROP:
340                 _top_crop->SetValue (_film->top_crop ());
341                 break;
342         case Film::BOTTOM_CROP:
343                 _bottom_crop->SetValue (_film->bottom_crop ());
344                 break;
345         case Film::FILTERS:
346         {
347                 pair<string, string> p = Filter::ffmpeg_strings (_film->filters ());
348                 string const b = p.first + " " + p.second;
349                 _filters->SetLabel (std_to_wx (b));
350                 _sizer->Layout ();
351                 break;
352         }
353         case Film::NAME:
354                 _name->ChangeValue (std_to_wx (_film->name ()));
355                 break;
356         case Film::FRAMES_PER_SECOND:
357         {
358                 stringstream s;
359                 s << fixed << setprecision(2) << _film->frames_per_second();
360                 _frames_per_second->ChangeValue (std_to_wx (s.str ()));
361                 break;
362         }
363         case Film::AUDIO_CHANNELS:
364         case Film::AUDIO_SAMPLE_RATE:
365                 if (_film->audio_channels() == 0 && _film->audio_sample_rate() == 0) {
366                         _audio->SetLabel (wxT (""));
367                 } else {
368                         s << _film->audio_channels () << " channels, " << _film->audio_sample_rate() << "Hz";
369                         _audio->SetLabel (std_to_wx (s.str ()));
370                 }
371                 break;
372         case Film::SIZE:
373                 if (_film->size().width == 0 && _film->size().height == 0) {
374                         _original_size->SetLabel (wxT (""));
375                 } else {
376                         s << _film->size().width << " x " << _film->size().height;
377                         _original_size->SetLabel (std_to_wx (s.str ()));
378                 }
379                 break;
380         case Film::LENGTH:
381                 if (_film->frames_per_second() > 0 && _film->length() > 0) {
382                         s << _film->length() << " frames; " << seconds_to_hms (_film->length() / _film->frames_per_second());
383                 } else if (_film->length() > 0) {
384                         s << _film->length() << " frames";
385                 } 
386                 _length->SetLabel (std_to_wx (s.str ()));
387                 break;
388         case Film::DCP_CONTENT_TYPE:
389                 _dcp_content_type->SetSelection (DCPContentType::as_index (_film->dcp_content_type ()));
390                 break;
391         case Film::THUMBS:
392                 break;
393         case Film::DCP_FRAMES:
394                 if (_film->dcp_frames() == 0) {
395                         _dcp_range->SetLabel (wxT ("Whole film"));
396                 } else {
397                         stringstream s;
398                         s << "First " << _film->dcp_frames() << " frames";
399                         _dcp_range->SetLabel (std_to_wx (s.str ()));
400                 }
401                 _sizer->Layout ();
402                 break;
403         case Film::DCP_TRIM_ACTION:
404                 break;
405         case Film::DCP_AB:
406                 _dcp_ab->SetValue (_film->dcp_ab ());
407                 break;
408         case Film::SCALER:
409                 _scaler->SetSelection (Scaler::as_index (_film->scaler ()));
410                 break;
411         case Film::AUDIO_GAIN:
412                 _audio_gain->SetValue (_film->audio_gain ());
413                 break;
414         case Film::AUDIO_DELAY:
415                 _audio_delay->SetValue (_film->audio_delay ());
416                 break;
417         case Film::STILL_DURATION:
418                 _still_duration->SetValue (_film->still_duration ());
419                 break;
420         }
421 }
422
423 /** Called when the format widget has been changed */
424 void
425 FilmEditor::format_changed (wxCommandEvent &)
426 {
427         if (!_film) {
428                 return;
429         }
430
431         _ignore_changes = true;
432         int const n = _format->GetSelection ();
433         if (n >= 0) {
434                 _film->set_format (Format::from_index (n));
435         }
436         _ignore_changes = false;
437 }
438
439 /** Called when the DCP content type widget has been changed */
440 void
441 FilmEditor::dcp_content_type_changed (wxCommandEvent &)
442 {
443         if (!_film) {
444                 return;
445         }
446
447         _ignore_changes = true;
448         int const n = _dcp_content_type->GetSelection ();
449         if (n >= 0) {
450                 _film->set_dcp_content_type (DCPContentType::from_index (n));
451         }
452         _ignore_changes = false;
453 }
454
455 /** Sets the Film that we are editing */
456 void
457 FilmEditor::set_film (Film* f)
458 {
459         _film = f;
460
461         set_things_sensitive (_film != 0);
462
463         if (_film) {
464                 _film->Changed.connect (sigc::mem_fun (*this, &FilmEditor::film_changed));
465         }
466
467         if (_film) {
468                 FileChanged (_film->directory ());
469         } else {
470                 FileChanged ("");
471         }
472         
473         film_changed (Film::NAME);
474         film_changed (Film::CONTENT);
475         film_changed (Film::DCP_CONTENT_TYPE);
476         film_changed (Film::FORMAT);
477         film_changed (Film::LEFT_CROP);
478         film_changed (Film::RIGHT_CROP);
479         film_changed (Film::TOP_CROP);
480         film_changed (Film::BOTTOM_CROP);
481         film_changed (Film::FILTERS);
482         film_changed (Film::DCP_FRAMES);
483         film_changed (Film::DCP_TRIM_ACTION);
484         film_changed (Film::DCP_AB);
485         film_changed (Film::SIZE);
486         film_changed (Film::LENGTH);
487         film_changed (Film::FRAMES_PER_SECOND);
488         film_changed (Film::AUDIO_CHANNELS);
489         film_changed (Film::AUDIO_SAMPLE_RATE);
490         film_changed (Film::SCALER);
491         film_changed (Film::AUDIO_GAIN);
492         film_changed (Film::AUDIO_DELAY);
493         film_changed (Film::STILL_DURATION);
494 }
495
496 /** Updates the sensitivity of lots of widgets to a given value.
497  *  @param s true to make sensitive, false to make insensitive.
498  */
499 void
500 FilmEditor::set_things_sensitive (bool s)
501 {
502         _name->Enable (s);
503         _frames_per_second->Enable (s);
504         _format->Enable (s);
505         _content->Enable (s);
506         _left_crop->Enable (s);
507         _right_crop->Enable (s);
508         _top_crop->Enable (s);
509         _bottom_crop->Enable (s);
510         _filters_button->Enable (s);
511         _scaler->Enable (s);
512         _dcp_content_type->Enable (s);
513         _dcp_range->Enable (s);
514         _change_dcp_range_button->Enable (s);
515         _dcp_ab->Enable (s);
516         _audio_gain->Enable (s);
517         _audio_delay->Enable (s);
518         _still_duration->Enable (s);
519 }
520
521 /** Called when the `Edit filters' button has been clicked */
522 void
523 FilmEditor::edit_filters_clicked (wxCommandEvent &)
524 {
525         FilterDialog* d = new FilterDialog (this, _film->filters ());
526         d->ActiveChanged.connect (sigc::mem_fun (*_film, &Film::set_filters));
527         d->ShowModal ();
528         d->Destroy ();
529 }
530
531 /** Called when the scaler widget has been changed */
532 void
533 FilmEditor::scaler_changed (wxCommandEvent &)
534 {
535         if (!_film) {
536                 return;
537         }
538
539         _ignore_changes = true;
540         int const n = _scaler->GetSelection ();
541         if (n >= 0) {
542                 _film->set_scaler (Scaler::from_index (n));
543         }
544         _ignore_changes = false;
545 }
546
547 /** Called when the frames per second widget has been changed */
548 void
549 FilmEditor::frames_per_second_changed (wxCommandEvent &)
550 {
551         if (!_film) {
552                 return;
553         }
554
555         _ignore_changes = true;
556         _film->set_frames_per_second (boost::lexical_cast<float> (wx_to_std (_frames_per_second->GetValue ())));
557         _ignore_changes = false;
558 }
559
560 void
561 FilmEditor::audio_gain_changed (wxCommandEvent &)
562 {
563         if (!_film) {
564                 return;
565         }
566
567         _ignore_changes = true;
568         _film->set_audio_gain (_audio_gain->GetValue ());
569         _ignore_changes = false;
570 }
571
572 void
573 FilmEditor::audio_delay_changed (wxCommandEvent &)
574 {
575         if (!_film) {
576                 return;
577         }
578
579         _ignore_changes = true;
580         _film->set_audio_delay (_audio_delay->GetValue ());
581         _ignore_changes = false;
582 }
583
584 wxControl *
585 FilmEditor::video_control (wxControl* c)
586 {
587         _video_controls.push_back (c);
588         return c;
589 }
590
591 wxControl *
592 FilmEditor::still_control (wxControl* c)
593 {
594         _still_controls.push_back (c);
595         return c;
596 }
597
598 void
599 FilmEditor::setup_visibility ()
600 {
601         ContentType c = VIDEO;
602
603         if (_film) {
604                 c = _film->content_type ();
605         }
606
607         for (list<wxControl*>::iterator i = _video_controls.begin(); i != _video_controls.end(); ++i) {
608                 (*i)->Show (c == VIDEO);
609         }
610
611         for (list<wxControl*>::iterator i = _still_controls.begin(); i != _still_controls.end(); ++i) {
612                 (*i)->Show (c == STILL);
613         }
614 }
615
616 void
617 FilmEditor::still_duration_changed (wxCommandEvent &)
618 {
619         if (!_film) {
620                 return;
621         }
622
623         _ignore_changes = true;
624         _film->set_still_duration (_still_duration->GetValue ());
625         _ignore_changes = false;
626 }
627
628 void
629 FilmEditor::change_dcp_range_clicked (wxCommandEvent &)
630 {
631         DCPRangeDialog* d = new DCPRangeDialog (this, _film);
632         d->Changed.connect (sigc::mem_fun (*this, &FilmEditor::dcp_range_changed));
633         d->ShowModal ();
634 }
635
636 void
637 FilmEditor::dcp_range_changed (int frames, TrimAction action)
638 {
639         _film->set_dcp_frames (frames);
640         _film->set_dcp_trim_action (action);
641 }