Shrink some big buttons.
authorCarl Hetherington <cth@carlh.net>
Tue, 8 Dec 2020 19:13:09 +0000 (20:13 +0100)
committerCarl Hetherington <cth@carlh.net>
Tue, 8 Dec 2020 19:23:14 +0000 (20:23 +0100)
src/wx/timecode.cc
src/wx/video_panel.cc
src/wx/wx_util.cc
src/wx/wx_util.h

index 684f29b197aa886c11fd28aa9933efb38ce54e67..0602358a9788083ac2b7fcfa58b160bb2b379037 100644 (file)
@@ -62,8 +62,9 @@ TimecodeBase::TimecodeBase (wxWindow* parent, bool set_button)
        _frames = new wxTextCtrl (_editable, wxID_ANY, wxT(""), wxDefaultPosition, s, 0, validator);
        _frames->SetMaxLength (2);
        editable_sizer->Add (_frames);
+
        if (set_button) {
-               _set_button = new Button (_editable, _("Set"));
+               _set_button = new Button (_editable, _("Set"), wxDefaultPosition, small_button_size(parent, _("Set")));
                editable_sizer->Add (_set_button, 0, wxLEFT | wxRIGHT, 8);
        }
        _editable->SetSizerAndFit (editable_sizer);
index f5e514fab867e08bb81535215d9f3651e9459c15..8841005faa8de671310c2eb82a4af46826648e90 100644 (file)
@@ -166,7 +166,7 @@ VideoPanel::VideoPanel (ContentPanel* p)
        _scale_label = create_label (this, _("Scale"), true);
        _scale_fit = new wxRadioButton (this, wxID_ANY, _("to fit DCP"));
        _scale_custom = new wxRadioButton (this, wxID_ANY, _("custom"));
-       _scale_custom_edit = new Button (this, _("Edit..."));
+       _scale_custom_edit = new Button (this, _("Edit..."), wxDefaultPosition, small_button_size(this, _("Edit...")));
 
        _colour_conversion_label = create_label (this, _("Colour conversion"), true);
        _colour_conversion = new wxChoice (this, wxID_ANY, wxDefaultPosition, size);
@@ -177,7 +177,7 @@ VideoPanel::VideoPanel (ContentPanel* p)
 
        /// TRANSLATORS: translate the word "Custom" here; do not include the "Colour|" prefix
        _colour_conversion->Append (S_("Colour|Custom"));
-       _edit_colour_conversion_button = new Button (this, _("Edit..."));
+       _edit_colour_conversion_button = new Button (this, _("Edit..."), wxDefaultPosition, small_button_size(this, _("Edit...")));
 
        _range_label = create_label (this, _("Range"), true);
        _range = new wxChoice (this, wxID_ANY);
index 758d57a80a022a54db586668c638368de534b524..7948dd13c37ed3c4a3a9f9610236b28f08b36012 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2019 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2020 Carl Hetherington <cth@carlh.net>
 
     This file is part of DCP-o-matic.
 
@@ -592,3 +592,14 @@ bitmap_path (string name)
        return std_to_wx (p.string());
 }
 
+
+wxSize
+small_button_size (wxWindow* parent, wxString text)
+{
+       wxClientDC dc (parent);
+       wxSize size = dc.GetTextExtent (text);
+       size.SetHeight (-1);
+       size.IncBy (24, 0);
+       return size;
+}
+
index 0e5397b68289b2242191de261265cfad2d18e1d6..4131ec0f795034e633e41ec44d12bd936c196a60 100644 (file)
@@ -91,6 +91,7 @@ extern double calculate_mark_interval (double start);
 extern bool display_progress (wxString title, wxString task);
 extern bool report_errors_from_last_job (wxWindow* parent);
 extern wxString bitmap_path (std::string name);
+extern wxSize small_button_size (wxWindow* parent, wxString text);
 
 struct Offset
 {