#include "wx_util.h"
using boost::shared_ptr;
+using boost::dynamic_pointer_cast;
ImageMagickContentDialog::ImageMagickContentDialog (wxWindow* parent, shared_ptr<ImageMagickContent> content)
: wxDialog (parent, wxID_ANY, _("Image"))
+ , _content (content)
{
wxFlexGridSizer* grid = new wxFlexGridSizer (3, 6, 6);
grid->AddGrowableCol (1, 1);
{
- add_label_to_sizer (grid, this, (_("Duration")));
+ add_label_to_sizer (grid, this, _("Duration"), true);
wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
_video_length = new wxSpinCtrl (this);
s->Add (_video_length);
/// TRANSLATORS: this is an abbreviation for seconds, the unit of time
- add_label_to_sizer (s, this, _("s"));
+ add_label_to_sizer (s, this, _("s"), false);
grid->Add (s);
}
overall_sizer->SetSizeHints (this);
checked_set (_video_length, content->video_length () / 24);
+ _video_length->Connect (wxID_ANY, wxEVT_COMMAND_SPINCTRL_UPDATED, wxCommandEventHandler (ImageMagickContentDialog::video_length_changed), 0, this);
}
-int
-ImageMagickContentDialog::video_length () const
+void
+ImageMagickContentDialog::video_length_changed (wxCommandEvent &)
{
- return _video_length->GetValue ();
+ shared_ptr<ImageMagickContent> c = _content.lock ();
+ if (!c) {
+ return;
+ }
+
+ c->set_video_length (_video_length->GetValue() * 24);
}