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>
-8d92cce7d2885afa13ee4cb6f546dbf43942124b
c994839239e84a1f62865ed82fdc090900a66b03
1114df4c0d2167f6b7b394bfbf85890cd0a4a3e3
03bee41ebb15a9ddd61af1607426d22d906ad226
*/
-#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;
_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) {
{
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
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
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
}
}
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);
}
}
}
}
+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)
{
}
}
+void
+checked_set (wxTextCtrl* widget, wxString value)
+{
+ if (widget->GetValue() != value) {
+ widget->ChangeValue (value);
+ }
+}
+
void
checked_set (wxStaticText* widget, string 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);