diff options
| author | Carl Hetherington <cth@carlh.net> | 2013-07-30 20:14:47 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2013-07-30 20:14:47 +0100 |
| commit | e241b3d295fe4158239170f17391e08473e159c5 (patch) | |
| tree | f6a41e3d1d7aa098bec7c5ab097718d93b9b5e68 /src/wx/timecode.cc | |
| parent | 7951f34412a4e2e71928fb3494075b70a3b29a4a (diff) | |
Make length editable only for still images.
Diffstat (limited to 'src/wx/timecode.cc')
| -rw-r--r-- | src/wx/timecode.cc | 51 |
1 files changed, 35 insertions, 16 deletions
diff --git a/src/wx/timecode.cc b/src/wx/timecode.cc index f826dd93f..033bd2bd0 100644 --- a/src/wx/timecode.cc +++ b/src/wx/timecode.cc @@ -42,26 +42,33 @@ Timecode::Timecode (wxWindow* parent) } validator.SetIncludes (list); + + _sizer = new wxBoxSizer (wxHORIZONTAL); - wxBoxSizer* sizer = new wxBoxSizer (wxHORIZONTAL); - _hours = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, size, 0, validator); + _editable = new wxPanel (this); + wxSizer* editable_sizer = new wxBoxSizer (wxHORIZONTAL); + _hours = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, size, 0, validator); _hours->SetMaxLength (2); - sizer->Add (_hours); - add_label_to_sizer (sizer, this, wxT (":"), false); - _minutes = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, size, 0, validator); + editable_sizer->Add (_hours); + add_label_to_sizer (editable_sizer, _editable, wxT (":"), false); + _minutes = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, size, 0, validator); _minutes->SetMaxLength (2); - sizer->Add (_minutes); - add_label_to_sizer (sizer, this, wxT (":"), false); - _seconds = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, size, 0, validator); + editable_sizer->Add (_minutes); + add_label_to_sizer (editable_sizer, _editable, wxT (":"), false); + _seconds = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, size, 0, validator); _seconds->SetMaxLength (2); - sizer->Add (_seconds); - add_label_to_sizer (sizer, this, wxT ("."), false); - _frames = new wxTextCtrl (this, wxID_ANY, wxT(""), wxDefaultPosition, size, 0, validator); + editable_sizer->Add (_seconds); + add_label_to_sizer (editable_sizer, _editable, wxT ("."), false); + _frames = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, size, 0, validator); _frames->SetMaxLength (2); - sizer->Add (_frames); - _set_button = new wxButton (this, wxID_ANY, _("Set")); - sizer->Add (_set_button, 0, wxLEFT | wxRIGHT, 8); + editable_sizer->Add (_frames); + _set_button = new wxButton (_editable, wxID_ANY, _("Set")); + editable_sizer->Add (_set_button, 0, wxLEFT | wxRIGHT, 8); + _editable->SetSizerAndFit (editable_sizer); + _sizer->Add (_editable); + _fixed = add_label_to_sizer (_sizer, this, wxT ("42"), false); + _hours->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&Timecode::changed, this)); _minutes->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&Timecode::changed, this)); _seconds->Bind (wxEVT_COMMAND_TEXT_UPDATED, boost::bind (&Timecode::changed, this)); @@ -69,8 +76,10 @@ Timecode::Timecode (wxWindow* parent) _set_button->Bind (wxEVT_COMMAND_BUTTON_CLICKED, boost::bind (&Timecode::set_clicked, this)); _set_button->Enable (false); - - SetSizerAndFit (sizer); + + set_editable (true); + + SetSizerAndFit (_sizer); } void @@ -88,6 +97,8 @@ Timecode::set (Time t, int fps) checked_set (_minutes, lexical_cast<string> (m)); checked_set (_seconds, lexical_cast<string> (s)); checked_set (_frames, lexical_cast<string> (f)); + + _fixed->SetLabel (wxString::Format ("%02d:%02d:%02d.%02d", h, m, s, f)); } Time @@ -118,3 +129,11 @@ Timecode::set_clicked () Changed (); _set_button->Enable (false); } + +void +Timecode::set_editable (bool e) +{ + _editable->Show (e); + _fixed->Show (!e); + _sizer->Layout (); +} |
