summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2015-01-09 21:53:38 +0000
committerCarl Hetherington <cth@carlh.net>2015-01-09 21:53:38 +0000
commit772c2476431ebf42ac83b371cd7edbc9717248f9 (patch)
tree1145e3b122b409a4f2c31cbc19bff6a3c31792f4 /src
parentcc10bdda89782bcce39952c5b740d3a6c9598600 (diff)
Hand-apply d7329603f8698f5302d11acfc233ca67695e654d from master; timecode labelling.
Diffstat (limited to 'src')
-rw-r--r--src/wx/timecode.cc25
-rw-r--r--src/wx/timecode.h4
-rw-r--r--src/wx/timing_panel.cc34
3 files changed, 54 insertions, 9 deletions
diff --git a/src/wx/timecode.cc b/src/wx/timecode.cc
index bd0a182c2..fe6819cd0 100644
--- a/src/wx/timecode.cc
+++ b/src/wx/timecode.cc
@@ -29,10 +29,8 @@ using boost::lexical_cast;
TimecodeBase::TimecodeBase (wxWindow* parent)
: wxPanel (parent)
{
- wxClientDC dc (parent);
- wxSize size = dc.GetTextExtent (wxT ("9999"));
- size.SetHeight (-1);
-
+ wxSize const s = TimecodeBase::size (parent);
+
wxTextValidator validator (wxFILTER_INCLUDE_CHAR_LIST);
wxArrayString list;
@@ -47,19 +45,19 @@ TimecodeBase::TimecodeBase (wxWindow* parent)
_editable = new wxPanel (this);
wxSizer* editable_sizer = new wxBoxSizer (wxHORIZONTAL);
- _hours = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, size, 0, validator);
+ _hours = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, s, 0, validator);
_hours->SetMaxLength (2);
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 = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, s, 0, validator);
_minutes->SetMaxLength (2);
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 = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, s, 0, validator);
_seconds->SetMaxLength (2);
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 = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, s, 0, validator);
_frames->SetMaxLength (2);
editable_sizer->Add (_frames);
_set_button = new wxButton (_editable, wxID_ANY, _("Set"));
@@ -112,3 +110,14 @@ TimecodeBase::set_editable (bool e)
_fixed->Show (!e);
_sizer->Layout ();
}
+
+wxSize
+TimecodeBase::size (wxWindow* parent)
+{
+ wxClientDC dc (parent);
+ wxSize size = dc.GetTextExtent (wxT ("9999"));
+ size.SetHeight (-1);
+ return size;
+}
+
+
diff --git a/src/wx/timecode.h b/src/wx/timecode.h
index 1d1d6a7f5..1e66b8d94 100644
--- a/src/wx/timecode.h
+++ b/src/wx/timecode.h
@@ -1,5 +1,5 @@
/*
- Copyright (C) 2013-2014 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2013-2015 Carl Hetherington <cth@carlh.net>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -37,6 +37,8 @@ public:
boost::signals2::signal<void ()> Changed;
+ static wxSize size (wxWindow* parent);
+
protected:
void changed ();
void set_clicked ();
diff --git a/src/wx/timing_panel.cc b/src/wx/timing_panel.cc
index 716a27b66..ab98a5094 100644
--- a/src/wx/timing_panel.cc
+++ b/src/wx/timing_panel.cc
@@ -40,6 +40,40 @@ TimingPanel::TimingPanel (ContentPanel* p)
wxFlexGridSizer* grid = new wxFlexGridSizer (2, 4, 4);
_sizer->Add (grid, 0, wxALL, 8);
+ wxSize size = TimecodeBase::size (this);
+
+ wxSizer* labels = new wxBoxSizer (wxHORIZONTAL);
+ //// TRANSLATORS: this is an abbreviation for "hours"
+ wxStaticText* t = new wxStaticText (this, wxID_ANY, _("h"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
+#ifdef DCPOMATIC_LINUX
+ /* Hack to work around failure to centre text on GTK */
+ gtk_label_set_line_wrap (GTK_LABEL (t->GetHandle()), FALSE);
+#endif
+ labels->Add (t, 1, wxEXPAND);
+ add_label_to_sizer (labels, this, wxT (":"), false);
+ //// TRANSLATORS: this is an abbreviation for "minutes"
+ t = new wxStaticText (this, wxID_ANY, _("m"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
+#ifdef DCPOMATIC_LINUX
+ gtk_label_set_line_wrap (GTK_LABEL (t->GetHandle()), FALSE);
+#endif
+ labels->Add (t, 1, wxEXPAND);
+ add_label_to_sizer (labels, this, wxT (":"), false);
+ //// TRANSLATORS: this is an abbreviation for "seconds"
+ t = new wxStaticText (this, wxID_ANY, _("s"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
+#ifdef DCPOMATIC_LINUX
+ gtk_label_set_line_wrap (GTK_LABEL (t->GetHandle()), FALSE);
+#endif
+ labels->Add (t, 1, wxEXPAND);
+ add_label_to_sizer (labels, this, wxT (":"), false);
+ //// TRANSLATORS: this is an abbreviation for "frames"
+ t = new wxStaticText (this, wxID_ANY, _("f"), wxDefaultPosition, size, wxALIGN_CENTRE_HORIZONTAL);
+#ifdef DCPOMATIC_LINUX
+ gtk_label_set_line_wrap (GTK_LABEL (t->GetHandle()), FALSE);
+#endif
+ labels->Add (t, 1, wxEXPAND);
+ grid->Add (new wxStaticText (this, wxID_ANY, wxT ("")));
+ grid->Add (labels);
+
add_label_to_sizer (grid, this, _("Position"), true);
_position = new Timecode<DCPTime> (this);
grid->Add (_position);