Hand-apply b737b25e10a4bcfb8cb645e95a089192347b4805 from master; more deflickering.
authorCarl Hetherington <cth@carlh.net>
Wed, 29 Apr 2015 21:10:50 +0000 (22:10 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 29 Apr 2015 21:10:50 +0000 (22:10 +0100)
ChangeLog
TO_PORT
src/wx/audio_panel.cc
src/wx/timecode.cc
src/wx/timecode.h
src/wx/timing_panel.cc
src/wx/wx_util.cc
src/wx/wx_util.h

index c6ba37bdf5ac8f41d1bf58680df53d0bc4110cd6..84deaaffe745962c350f1b80f019e31104ba59d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,7 +1,8 @@
 2015-04-29  c.hetherington  <cth@carlh.net>
 
-       * Hand-apply 291179175729b62e17a9c322cd27ae134d1310d9 from master;
-       stop more flickering when dragging in the timeline on OS X.
+       * Hand-apply 291179175729b62e17a9c322cd27ae134d1310d9 and
+       8d92cce7d2885afa13ee4cb6f546dbf43942124b from master;
+       stop flickering when dragging in the timeline on OS X.
 
 2015-04-22  c.hetherington  <cth@carlh.net>
 
diff --git a/TO_PORT b/TO_PORT
index af1f4d145cfd2df16088fa826c7ef3313694669c..a318eefce06866da38a2681e09e46a3fdc520829 100644 (file)
--- a/TO_PORT
+++ b/TO_PORT
@@ -1,4 +1,3 @@
-8d92cce7d2885afa13ee4cb6f546dbf43942124b
 c994839239e84a1f62865ed82fdc090900a66b03
 1114df4c0d2167f6b7b394bfbf85890cd0a4a3e3
 03bee41ebb15a9ddd61af1607426d22d906ad226
index 7a7b4674cab0de3599ac9c4b689ebf09a62f9e67..2a41aeb2def0543b497bd3879d2ee643af24f90f 100644 (file)
@@ -17,8 +17,6 @@
 
 */
 
-#include <boost/lexical_cast.hpp>
-#include <wx/spinctrl.h>
 #include "lib/config.h"
 #include "lib/ffmpeg_content.h"
 #include "lib/ffmpeg_audio_stream.h"
 #include "wx_util.h"
 #include "gain_calculator_dialog.h"
 #include "content_panel.h"
+#include <wx/spinctrl.h>
+#include <boost/lexical_cast.hpp>
+#include <boost/foreach.hpp>
 
 using std::vector;
 using std::cout;
 using std::string;
 using std::list;
+using std::pair;
 using boost::dynamic_pointer_cast;
 using boost::lexical_cast;
 using boost::shared_ptr;
@@ -154,16 +156,18 @@ AudioPanel::film_content_changed (int property)
                _mapping->set (acs ? acs->audio_mapping () : AudioMapping ());
                _sizer->Layout ();
        } else if (property == FFmpegContentProperty::AUDIO_STREAMS) {
-               _stream->Clear ();
                if (fcs) {
-                       vector<shared_ptr<FFmpegAudioStream> > a = fcs->audio_streams ();
-                       for (vector<shared_ptr<FFmpegAudioStream> >::iterator i = a.begin(); i != a.end(); ++i) {
-                               _stream->Append (std_to_wx ((*i)->name), new wxStringClientData (std_to_wx ((*i)->identifier ())));
+                       vector<pair<string, string> > data;
+                       BOOST_FOREACH (shared_ptr<FFmpegAudioStream> i, fcs->audio_streams ()) {
+                               data.push_back (make_pair (i->name, i->identifier ()));
                        }
+                       checked_set (_stream, data);
                        
                        if (fcs->audio_stream()) {
                                checked_set (_stream, fcs->audio_stream()->identifier ());
                        }
+               } else {
+                       _stream->Clear ();
                }
        } else if (property == AudioContentProperty::AUDIO_PROCESSOR) {
                if (acs) {
@@ -264,11 +268,11 @@ AudioPanel::setup_description ()
 {
        AudioContentList ac = _parent->selected_audio ();
        if (ac.size () != 1) {
-               _description->SetLabel ("");
+               checked_set (_description, wxT (""));
                return;
        }
 
-       _description->SetLabel (std_to_wx (ac.front()->processing_description ()));
+       checked_set (_description, ac.front()->processing_description ());
 }
 
 void
index fe6819cd087ca0f7246e66cdbdc48a735790087c..291a6ba5889ab9edd223bf9f309f320638e09cc5 100644 (file)
@@ -83,11 +83,11 @@ TimecodeBase::TimecodeBase (wxWindow* parent)
 void
 TimecodeBase::clear ()
 {
-       checked_set (_hours, "");
-       checked_set (_minutes, "");
-       checked_set (_seconds, "");
-       checked_set (_frames, "");
-       _fixed->SetLabel ("");
+       checked_set (_hours, wxT (""));
+       checked_set (_minutes, wxT (""));
+       checked_set (_seconds, wxT (""));
+       checked_set (_frames, wxT (""));
+       checked_set (_fixed, wxT (""));
 }
 
 void
index 1e66b8d94554220fee97cb963f9917477d01ccde..620782567fabf789b51523c7a2facc7c46955334 100644 (file)
@@ -76,7 +76,7 @@ public:
                checked_set (_seconds, boost::lexical_cast<std::string> (s));
                checked_set (_frames, boost::lexical_cast<std::string> (f));
                
-               _fixed->SetLabel (std_to_wx (t.timecode (fps)));
+               checked_set (_fixed, t.timecode (fps));
        }
 
        T get (int fps) const
index 55c53e79d2924cc4889c86ec61ea910443eb9431..cafb06dfcffa6162e4ff88dc59e2980d1c5c2ea4 100644 (file)
@@ -247,10 +247,10 @@ TimingPanel::film_content_changed (int property)
                        }
                }
                if (check.size() == 1) {
-                       _video_frame_rate->SetValue (std_to_wx (raw_convert<string> (vc->video_frame_rate (), 5)));
+                       checked_set (_video_frame_rate, raw_convert<string> (vc->video_frame_rate (), 5));
                        _video_frame_rate->Enable (true);
                } else {
-                       _video_frame_rate->SetValue ("");
+                       checked_set (_video_frame_rate, wxT (""));
                        _video_frame_rate->Enable (false);
                }
        }
index cd3d39c67d129ddd05967fd2cf3b522d75c418d9..a46ba98e27a55ebbc998db346f53de2c3d8af52b 100644 (file)
@@ -179,6 +179,29 @@ checked_set (wxChoice* widget, string value)
        }
 }
 
+void
+checked_set (wxChoice* widget, vector<pair<string, string> > items)
+{
+       vector<pair<string, string> > current;
+       for (unsigned int i = 0; i < widget->GetCount(); ++i) {
+               current.push_back (
+                       make_pair (
+                               wx_to_std (widget->GetString (i)),
+                               string_client_data (widget->GetClientObject (i))
+                               )
+                       );
+       }
+
+       if (current == items) {
+               return;
+       }
+
+       widget->Clear ();
+       for (vector<pair<string, string> >::const_iterator i = items.begin(); i != items.end(); ++i) {
+               widget->Append (std_to_wx (i->first), new wxStringClientData (std_to_wx (i->second)));
+       }
+}
+
 void
 checked_set (wxTextCtrl* widget, string value)
 {
@@ -187,6 +210,14 @@ checked_set (wxTextCtrl* widget, string value)
        }
 }
 
+void
+checked_set (wxTextCtrl* widget, wxString value)
+{
+       if (widget->GetValue() != value) {
+               widget->ChangeValue (value);
+       }
+}
+
 void
 checked_set (wxStaticText* widget, string value)
 {
index f55ecbd5272a0fc0c2043730fdd763d6fbd926e2..dfa0fca5e4c6e1d1744a7b675ad5bc9a93a88f15 100644 (file)
@@ -71,7 +71,9 @@ extern void checked_set (wxSpinCtrl* widget, int value);
 extern void checked_set (wxSpinCtrlDouble* widget, double value);
 extern void checked_set (wxChoice* widget, int value);
 extern void checked_set (wxChoice* widget, std::string value);
+extern void checked_set (wxChoice* widget, std::vector<std::pair<std::string, std::string> > items);
 extern void checked_set (wxTextCtrl* widget, std::string value);
+extern void checked_set (wxTextCtrl* widget, wxString value);
 extern void checked_set (wxCheckBox* widget, bool value);
 extern void checked_set (wxRadioButton* widget, bool value);
 extern void checked_set (wxStaticText* widget, std::string value);