Hand-apply d7329603f8698f5302d11acfc233ca67695e654d from master; timecode labelling.
authorCarl Hetherington <cth@carlh.net>
Fri, 9 Jan 2015 21:53:38 +0000 (21:53 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 9 Jan 2015 21:53:38 +0000 (21:53 +0000)
TO_PORT
src/wx/timecode.cc
src/wx/timecode.h
src/wx/timing_panel.cc

diff --git a/TO_PORT b/TO_PORT
index f7662f18afd0804e97d889ea8d6557562b0388e7..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
--- a/TO_PORT
+++ b/TO_PORT
@@ -1 +0,0 @@
-8a1014523dea0253efa30f3831c086bf367e8e67
index bd0a182c2f4d6b1d3dd027875449c31863c25410..fe6819cd087ca0f7246e66cdbdc48a735790087c 100644 (file)
@@ -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;
+}
+
+
index 1d1d6a7f530da0ee03d8732a322151fda7ee22cb..1e66b8d94554220fee97cb963f9917477d01ccde 100644 (file)
@@ -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 ();
index 716a27b66d70f9474e40fd5f51695011e0b25068..ab98a5094ea23bbb8391c354fbf1f4a910505ba5 100644 (file)
@@ -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);