21cb435ed5eb250a7f94887ddd75f6b367ea231f from master; better colour conversion selection.
authorCarl Hetherington <cth@carlh.net>
Tue, 2 Jun 2015 15:26:54 +0000 (16:26 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 2 Jun 2015 15:26:54 +0000 (16:26 +0100)
ChangeLog
TO_PORT
src/wx/video_panel.cc
src/wx/video_panel.h

index 64c253550e3cd8ef1ba7e9cb4f8e9bce855738e8..55836c9416f4db26836014e547d6215d07d5be1a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2015-06-02  c.hetherington  <cth@carlh.net>
+
+       * Allow use of all content audio streams, not just
+       the selected one.
+
+       * Tweak colour conversion controls so that it's easier
+       to use a preset without seeing the details.
+
 2015-05-25  Carl Hetherington  <cth@carlh.net>
 
        * Block all but alphanumeric characters with a few bits
diff --git a/TO_PORT b/TO_PORT
index 300df899d138f5ddd289f109b989e3c3746647df..035082c0b2fbb44d49b556520e3098d30fd9901e 100644 (file)
--- a/TO_PORT
+++ b/TO_PORT
@@ -1,4 +1,3 @@
-21cb435ed5eb250a7f94887ddd75f6b367ea231f
 f952568be9c4438d5b024c133b18b2590de968e7
 77d7a03cf0785140caf37276edac9a1a0c9a8799
 26d4079c0a1eb010b0909e8f046f04381408b6f3
index 9ddfd671407bb314d4dea09d4f3f390aa097d761..5030f78371461c8535e99d3a5be64ea215b95981 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2014 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2015 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
@@ -31,6 +31,7 @@
 #include "content_widget.h"
 #include "content_panel.h"
 #include <wx/spinctrl.h>
+#include <boost/foreach.hpp>
 #include <set>
 
 using std::vector;
@@ -168,13 +169,28 @@ VideoPanel::VideoPanel (ContentPanel* p)
        _filters_button = new wxButton (this, wxID_ANY, _("Edit..."));
        grid->Add (_filters_button, wxGBPosition (r, 3), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
        ++r;
-       
-       _enable_colour_conversion = new wxCheckBox (this, wxID_ANY, _("Colour conversion"));
-       grid->Add (_enable_colour_conversion, wxGBPosition (r, 0), wxGBSpan (1, 2), wxALIGN_CENTER_VERTICAL);
-       _colour_conversion = new wxStaticText (this, wxID_ANY, wxT (""), wxDefaultPosition, size);
-       grid->Add (_colour_conversion, wxGBPosition (r, 2), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
-       _colour_conversion_button = new wxButton (this, wxID_ANY, _("Edit..."));
-       grid->Add (_colour_conversion_button, wxGBPosition (r, 3), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+
+       add_label_to_grid_bag_sizer (grid, this, _("Colour conversion"), true, wxGBPosition (r, 0));
+       {
+               wxSizer* s = new wxBoxSizer (wxHORIZONTAL);
+
+               wxClientDC dc (this);
+               wxSize size = dc.GetTextExtent (wxT ("A quite long-ish name"));
+               size.SetHeight (-1);
+               
+               _colour_conversion = new wxChoice (this, wxID_ANY, wxDefaultPosition, size);
+               _colour_conversion->Append (_("None"));
+               BOOST_FOREACH (PresetColourConversion const & i, PresetColourConversion::all()) {
+                       _colour_conversion->Append (std_to_wx (i.name));
+               }
+               _colour_conversion->Append (_("Custom"));
+               s->Add (_colour_conversion, 1, wxEXPAND | wxALIGN_CENTER_VERTICAL | wxTOP | wxBOTTOM | wxRIGHT, 6);
+               
+               _edit_colour_conversion_button = new wxButton (this, wxID_ANY, _("Edit..."));
+               s->Add (_edit_colour_conversion_button, 0, wxALIGN_CENTER_VERTICAL);
+               
+               grid->Add (s, wxGBPosition (r, 1), wxDefaultSpan, wxALIGN_CENTER_VERTICAL);
+       }
        ++r;
 
        _description = new wxStaticText (this, wxID_ANY, wxT ("\n \n \n \n \n"), wxDefaultPosition, wxDefaultSize);
@@ -206,9 +222,9 @@ VideoPanel::VideoPanel (ContentPanel* p)
        _fade_in->Changed.connect (boost::bind (&VideoPanel::fade_in_changed, this));
        _fade_out->Changed.connect (boost::bind (&VideoPanel::fade_out_changed, this));
        
-       _filters_button->Bind           (wxEVT_COMMAND_BUTTON_CLICKED,   boost::bind (&VideoPanel::edit_filters_clicked, this));
-       _enable_colour_conversion->Bind (wxEVT_COMMAND_CHECKBOX_CLICKED, boost::bind (&VideoPanel::enable_colour_conversion_clicked, this));
-       _colour_conversion_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED,   boost::bind (&VideoPanel::edit_colour_conversion_clicked, this));
+       _filters_button->Bind                (wxEVT_COMMAND_BUTTON_CLICKED,  boost::bind (&VideoPanel::edit_filters_clicked, this));
+       _colour_conversion->Bind             (wxEVT_COMMAND_CHOICE_SELECTED, boost::bind (&VideoPanel::colour_conversion_changed, this));
+       _edit_colour_conversion_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED,  boost::bind (&VideoPanel::edit_colour_conversion_clicked, this));
 }
 
 void
@@ -246,23 +262,21 @@ VideoPanel::film_content_changed (int property)
                setup_description ();
        } else if (property == VideoContentProperty::COLOUR_CONVERSION) {
                if (!vcs) {
-                       checked_set (_colour_conversion, wxT (""));
+                       checked_set (_colour_conversion, 0);
+                       _edit_colour_conversion_button->Enable (false);
                } else if (vcs->colour_conversion ()) {
                        optional<size_t> preset = vcs->colour_conversion().get().preset ();
                        vector<PresetColourConversion> cc = PresetColourConversion::all ();
                        if (preset) {
-                               checked_set (_colour_conversion, std_to_wx (cc[preset.get()].name));
+                               checked_set (_colour_conversion, preset.get() + 1);
+                               _edit_colour_conversion_button->Enable (false);
                        } else {
-                               checked_set (_colour_conversion, _("Custom"));
+                               checked_set (_colour_conversion, cc.size() + 1);
+                               _edit_colour_conversion_button->Enable (true);
                        }
-                       _enable_colour_conversion->SetValue (true);
-                       _colour_conversion->Enable (true);
-                       _colour_conversion_button->Enable (true);
                } else {
-                       checked_set (_colour_conversion, _("None"));
-                       _enable_colour_conversion->SetValue (false);
-                       _colour_conversion->Enable (false);
-                       _colour_conversion_button->Enable (false);
+                       checked_set (_colour_conversion, 0);
+                       _edit_colour_conversion_button->Enable (false);
                }
        } else if (property == FFmpegContentProperty::FILTERS) {
                if (fcs) {
@@ -340,22 +354,36 @@ VideoPanel::setup_description ()
 }
 
 void
-VideoPanel::edit_colour_conversion_clicked ()
+VideoPanel::colour_conversion_changed ()
 {
        VideoContentList vc = _parent->selected_video ();
        if (vc.size() != 1) {
                return;
        }
 
-       if (!vc.front()->colour_conversion ()) {
+       int const s = _colour_conversion->GetSelection ();
+       vector<PresetColourConversion> all = PresetColourConversion::all ();
+
+       if (s == 0) {
+               vc.front()->unset_colour_conversion ();
+       } else if (s == int (all.size() + 1)) {
+               edit_colour_conversion_clicked ();
+       } else {
+               vc.front()->set_colour_conversion (all[s - 1].conversion);
+       }
+}
+
+void
+VideoPanel::edit_colour_conversion_clicked ()
+{
+       VideoContentList vc = _parent->selected_video ();
+       if (vc.size() != 1) {
                return;
        }
 
-       ColourConversion conversion = vc.front()->colour_conversion().get ();
        ContentColourConversionDialog* d = new ContentColourConversionDialog (this);
-       d->set (conversion);
+       d->set (vc.front()->colour_conversion().get_value_or (PresetColourConversion::all().front ().conversion));
        d->ShowModal ();
-
        vc.front()->set_colour_conversion (d->get ());
        d->Destroy ();
 }
@@ -378,8 +406,6 @@ VideoPanel::content_selection_changed ()
        _scale->set_content (video_sel);
 
        _filters_button->Enable (single && !ffmpeg_sel.empty ());
-       _enable_colour_conversion->Enable (single);
-       _colour_conversion_button->Enable (single);
 
        film_content_changed (VideoContentProperty::VIDEO_CROP);
        film_content_changed (VideoContentProperty::VIDEO_FRAME_RATE);
@@ -408,18 +434,3 @@ VideoPanel::fade_out_changed ()
                (*i)->set_fade_out (_fade_out->get (vfr).frames (vfr));
        }
 }
-
-void
-VideoPanel::enable_colour_conversion_clicked ()
-{
-       VideoContentList vc = _parent->selected_video ();
-       if (vc.size() != 1) {
-               return;
-       }
-
-       if (_enable_colour_conversion->GetValue()) {
-               vc.front()->set_default_colour_conversion ();
-       } else {
-               vc.front()->unset_colour_conversion ();
-       }
-}
index 9c496c4ee3a4d08b6b9a56bbfb45c39995f8f2d3..d90612fdda0fe7d8a37118e5d4998682c877f3aa 100644 (file)
@@ -45,7 +45,7 @@ public:
 
 private:
        void edit_filters_clicked ();
-       void enable_colour_conversion_clicked ();
+       void colour_conversion_changed ();
        void edit_colour_conversion_clicked ();
        void fade_in_changed ();
        void fade_out_changed ();
@@ -63,7 +63,6 @@ private:
        wxStaticText* _description;
        wxStaticText* _filters;
        wxButton* _filters_button;
-       wxCheckBox* _enable_colour_conversion;
-       wxStaticText* _colour_conversion;
-       wxButton* _colour_conversion_button;
+       wxChoice* _colour_conversion;
+       wxButton* _edit_colour_conversion_button;
 };