diff options
| author | Carl Hetherington <cth@carlh.net> | 2015-04-29 22:10:50 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2015-04-29 22:10:50 +0100 |
| commit | b4e9d90b9d83c952563ccabc435a5d4310ee4853 (patch) | |
| tree | 2eddd6bab831528fce9c93a57f09ae61a44fe69a /src | |
| parent | d43aadb0bbb5cbdebbc5c95cb3065ed0aa49296a (diff) | |
Hand-apply b737b25e10a4bcfb8cb645e95a089192347b4805 from master; more deflickering.
Diffstat (limited to 'src')
| -rw-r--r-- | src/wx/audio_panel.cc | 20 | ||||
| -rw-r--r-- | src/wx/timecode.cc | 10 | ||||
| -rw-r--r-- | src/wx/timecode.h | 2 | ||||
| -rw-r--r-- | src/wx/timing_panel.cc | 4 | ||||
| -rw-r--r-- | src/wx/wx_util.cc | 31 | ||||
| -rw-r--r-- | src/wx/wx_util.h | 2 |
6 files changed, 53 insertions, 16 deletions
diff --git a/src/wx/audio_panel.cc b/src/wx/audio_panel.cc index 7a7b4674c..2a41aeb2d 100644 --- a/src/wx/audio_panel.cc +++ b/src/wx/audio_panel.cc @@ -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" @@ -30,11 +28,15 @@ #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 diff --git a/src/wx/timecode.cc b/src/wx/timecode.cc index fe6819cd0..291a6ba58 100644 --- a/src/wx/timecode.cc +++ b/src/wx/timecode.cc @@ -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 diff --git a/src/wx/timecode.h b/src/wx/timecode.h index 1e66b8d94..620782567 100644 --- a/src/wx/timecode.h +++ b/src/wx/timecode.h @@ -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 diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc index 55c53e79d..cafb06dfc 100644 --- a/src/wx/timing_panel.cc +++ b/src/wx/timing_panel.cc @@ -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); } } diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index cd3d39c67..a46ba98e2 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -180,6 +180,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) { if (widget->GetValue() != std_to_wx (value)) { @@ -188,6 +211,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) { if (widget->GetLabel() != std_to_wx (value)) { diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index f55ecbd52..dfa0fca5e 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -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); |
