Remove range dialog which I think is pointless now.
authorCarl Hetherington <cth@carlh.net>
Mon, 5 Nov 2012 10:47:25 +0000 (10:47 +0000)
committerCarl Hetherington <cth@carlh.net>
Mon, 5 Nov 2012 10:47:25 +0000 (10:47 +0000)
src/wx/dcp_range_dialog.cc [deleted file]
src/wx/dcp_range_dialog.h [deleted file]
src/wx/film_editor.cc
src/wx/film_editor.h
src/wx/wscript

diff --git a/src/wx/dcp_range_dialog.cc b/src/wx/dcp_range_dialog.cc
deleted file mode 100644 (file)
index 9eced92..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
-    Copyright (C) 2012 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/film.h"
-#include "dcp_range_dialog.h"
-#include "wx_util.h"
-
-using boost::shared_ptr;
-
-DCPRangeDialog::DCPRangeDialog (wxWindow* p, shared_ptr<Film> f)
-       : wxDialog (p, wxID_ANY, wxString (_("DCP Range")))
-       , _film (f)
-{
-       wxFlexGridSizer* table = new wxFlexGridSizer (3, 6, 6);
-
-       add_label_to_sizer (table, this, "Trim start");
-       _trim_start = new wxSpinCtrl (this, wxID_ANY);
-       table->Add (_trim_start, 1);
-       add_label_to_sizer (table, this, "frames");
-
-       add_label_to_sizer (table, this, "Trim end");
-       _trim_end = new wxSpinCtrl (this, wxID_ANY);
-       table->Add (_trim_end, 1);
-       add_label_to_sizer (table, this, "frames");
-
-       if (_film->length()) {
-               _trim_start->SetRange (0, _film->length().get());
-               _trim_end->SetRange (0, _film->length().get());
-       }
-
-       _trim_start->SetValue (_film->dcp_trim_start());
-       _trim_end->SetValue (_film->dcp_trim_end());
-
-       _trim_start->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (DCPRangeDialog::emit_changed), 0, this);
-       _trim_end->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (DCPRangeDialog::emit_changed), 0, this);
-
-       wxBoxSizer* overall_sizer = new wxBoxSizer (wxVERTICAL);
-       overall_sizer->Add (table, 0, wxALL, 6);
-       
-       wxSizer* buttons = CreateSeparatedButtonSizer (wxOK);
-       if (buttons) {
-               overall_sizer->Add (buttons, wxSizerFlags().Expand().DoubleBorder());
-       }
-
-       SetSizer (overall_sizer);
-       overall_sizer->SetSizeHints (this);
-}
-
-void
-DCPRangeDialog::emit_changed (wxCommandEvent &)
-{
-       Changed (_trim_start->GetValue(), _trim_end->GetValue());
-}
diff --git a/src/wx/dcp_range_dialog.h b/src/wx/dcp_range_dialog.h
deleted file mode 100644 (file)
index 2196c26..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
-    Copyright (C) 2012 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 <wx/spinctrl.h>
-#include <boost/signals2.hpp>
-
-class Film;
-
-class DCPRangeDialog : public wxDialog
-{
-public:
-       DCPRangeDialog (wxWindow *, boost::shared_ptr<Film>);
-
-       boost::signals2::signal<void (int, int)> Changed;
-
-private:
-       void trim_start_changed (wxCommandEvent &);
-       void trim_end_changed (wxCommandEvent &);
-       
-       void emit_changed (wxCommandEvent &);
-       
-       boost::shared_ptr<Film> _film;
-       wxSpinCtrl* _trim_start;
-       wxSpinCtrl* _trim_end;
-};
index 36e0f05b0b0ba8b9c863ea933b74a414c92e69c7..96d61838ab10d2974b6bb4075fa3a2d9a84c2814 100644 (file)
@@ -39,7 +39,6 @@
 #include "filter_dialog.h"
 #include "wx_util.h"
 #include "film_editor.h"
-#include "dcp_range_dialog.h"
 #include "gain_calculator_dialog.h"
 #include "sound_processor.h"
 #include "dci_name_dialog.h"
@@ -190,12 +189,15 @@ FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
 
 
        {
-               video_control (add_label_to_sizer (_sizer, this, "Range"));
+               video_control (add_label_to_sizer (_sizer, this, "Trim frames"));
                wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
-               _dcp_range = new wxStaticText (this, wxID_ANY, wxT (""));
-               s->Add (video_control (_dcp_range), 1, wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
-               _change_dcp_range_button = new wxButton (this, wxID_ANY, wxT ("Edit..."));
-               s->Add (video_control (_change_dcp_range_button), 0, 0, 6);
+               add_label_to_sizer (s, this, "Start");
+               _dcp_trim_start = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
+               s->Add (_dcp_trim_start);
+               add_label_to_sizer (s, this, "End");
+               _dcp_trim_end = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize (64, -1));
+               s->Add (_dcp_trim_end);
+
                _sizer->Add (s);
        }
 
@@ -226,6 +228,8 @@ FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
        _still_duration->SetRange (0, 60 * 60);
        _subtitle_offset->SetRange (-1024, 1024);
        _subtitle_scale->SetRange (1, 1000);
+       _dcp_trim_start->SetRange (0, 100);
+       _dcp_trim_end->SetRange (0, 100);
 
        vector<DCPContentType const *> const ct = DCPContentType::all ();
        for (vector<DCPContentType const *>::const_iterator i = ct.begin(); i != ct.end(); ++i) {
@@ -264,7 +268,8 @@ FilmEditor::FilmEditor (shared_ptr<Film> f, wxWindow* parent)
                );
        _audio_delay->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::audio_delay_changed), 0, this);
        _still_duration->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::still_duration_changed), 0, this);
-       _change_dcp_range_button->Connect (wxID_ANY, wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler (FilmEditor::change_dcp_range_clicked), 0, this);
+       _dcp_trim_start->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::dcp_trim_start_changed), 0, this);
+       _dcp_trim_end->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::dcp_trim_end_changed), 0, this);
        _with_subtitles->Connect (wxID_ANY, wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler (FilmEditor::with_subtitles_toggled), 0, this);
        _subtitle_offset->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_offset_changed), 0, this);
        _subtitle_scale->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (FilmEditor::subtitle_scale_changed), 0, this);
@@ -495,6 +500,10 @@ FilmEditor::film_changed (Film::Property p)
                        s << _film->length().get() << " frames";
                } 
                _length->SetLabel (std_to_wx (s.str ()));
+               if (_film->length()) {
+                       _dcp_trim_start->SetRange (0, _film->length().get());
+                       _dcp_trim_end->SetRange (0, _film->length().get());
+               }
                break;
        case Film::DCP_CONTENT_TYPE:
                _dcp_content_type->SetSelection (DCPContentType::as_index (_film->dcp_content_type ()));
@@ -509,15 +518,10 @@ FilmEditor::film_changed (Film::Property p)
                _scaler->SetSelection (Scaler::as_index (_film->scaler ()));
                break;
        case Film::DCP_TRIM_START:
+               _dcp_trim_start->SetValue (_film->dcp_trim_start());
+               break;
        case Film::DCP_TRIM_END:
-               if (_film->dcp_trim_start() == 0 && _film->dcp_trim_end() == 0) {
-                       _dcp_range->SetLabel (wxT ("Whole film"));
-               } else {
-                       _dcp_range->SetLabel (
-                               std_to_wx (String::compose ("Trim %1 frames from start and %2 frames from end", _film->dcp_trim_start(), _film->dcp_trim_end()))
-                               );
-               }
-               _sizer->Layout ();
+               _dcp_trim_end->SetValue (_film->dcp_trim_end());
                break;
        case Film::AUDIO_GAIN:
                _audio_gain->SetValue (_film->audio_gain ());
@@ -657,7 +661,8 @@ FilmEditor::set_things_sensitive (bool s)
        _scaler->Enable (s);
        _audio_stream->Enable (s);
        _dcp_content_type->Enable (s);
-       _change_dcp_range_button->Enable (s);
+       _dcp_trim_start->Enable (s);
+       _dcp_trim_end->Enable (s);
        _dcp_ab->Enable (s);
        _audio_gain->Enable (s);
        _audio_gain_calculate_button->Enable (s);
@@ -766,18 +771,27 @@ FilmEditor::still_duration_changed (wxCommandEvent &)
 }
 
 void
-FilmEditor::change_dcp_range_clicked (wxCommandEvent &)
+FilmEditor::dcp_trim_start_changed (wxCommandEvent &)
 {
-       DCPRangeDialog* d = new DCPRangeDialog (this, _film);
-       d->Changed.connect (bind (&FilmEditor::dcp_range_changed, this, _1, _2));
-       d->ShowModal ();
+       if (!_film) {
+               return;
+       }
+
+       _ignore_changes = Film::DCP_TRIM_START;
+       _film->set_dcp_trim_start (_dcp_trim_start->GetValue ());
+       _ignore_changes = Film::NONE;
 }
 
 void
-FilmEditor::dcp_range_changed (int start, int end)
+FilmEditor::dcp_trim_end_changed (wxCommandEvent &)
 {
-       _film->set_dcp_trim_start (start);
-       _film->set_dcp_trim_end (end);
+       if (!_film) {
+               return;
+       }
+
+       _ignore_changes = Film::DCP_TRIM_END;
+       _film->set_dcp_trim_end (_dcp_trim_end->GetValue ());
+       _ignore_changes = Film::NONE;
 }
 
 void
index e9f8d35e5ca349e1bdaed1ecf19826847366bc9d..acccc741b7cc44c9d8d140ff496bbf1355b832b2 100644 (file)
@@ -54,7 +54,8 @@ private:
        void bottom_crop_changed (wxCommandEvent &);
        void content_changed (wxCommandEvent &);
        void format_changed (wxCommandEvent &);
-       void dcp_range_changed (int, int);
+       void dcp_trim_start_changed (wxCommandEvent &);
+       void dcp_trim_end_changed (wxCommandEvent &);
        void dcp_content_type_changed (wxCommandEvent &);
        void dcp_ab_toggled (wxCommandEvent &);
        void scaler_changed (wxCommandEvent &);
@@ -137,10 +138,8 @@ private:
        /** The Film's duration for still sources */
        wxSpinCtrl* _still_duration;
 
-       /** Display of the range of frames that will be used */
-       wxStaticText* _dcp_range;
-       /** Button to change the range */
-       wxButton* _change_dcp_range_button;
+       wxSpinCtrl* _dcp_trim_start;
+       wxSpinCtrl* _dcp_trim_end;
        /** Selector to generate an A/B comparison DCP */
        wxCheckBox* _dcp_ab;
 
index 41514c5b1ba22433c6eee0c3734fdd67463c9cdf..e5431460fe3573fe0933d281d6edb7653caff0dc 100644 (file)
@@ -11,7 +11,6 @@ def build(bld):
     obj.source = """
                  config_dialog.cc
                  dci_name_dialog.cc
-                 dcp_range_dialog.cc
                  dir_picker_ctrl.cc
                  film_editor.cc
                  film_viewer.cc