From: Carl Hetherington Date: Tue, 8 Dec 2020 19:13:09 +0000 (+0100) Subject: Shrink some big buttons. X-Git-Tag: 11.0-build-runs~49 X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=commitdiff_plain;h=e06d1831abc6786933db935f298c8a4e8e76e599 Shrink some big buttons. --- diff --git a/src/wx/timecode.cc b/src/wx/timecode.cc index 684f29b19..0602358a9 100644 --- a/src/wx/timecode.cc +++ b/src/wx/timecode.cc @@ -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); diff --git a/src/wx/video_panel.cc b/src/wx/video_panel.cc index f5e514fab..8841005fa 100644 --- a/src/wx/video_panel.cc +++ b/src/wx/video_panel.cc @@ -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); diff --git a/src/wx/wx_util.cc b/src/wx/wx_util.cc index 758d57a80..7948dd13c 100644 --- a/src/wx/wx_util.cc +++ b/src/wx/wx_util.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2019 Carl Hetherington + Copyright (C) 2012-2020 Carl Hetherington 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; +} + diff --git a/src/wx/wx_util.h b/src/wx/wx_util.h index 0e5397b68..4131ec0f7 100644 --- a/src/wx/wx_util.h +++ b/src/wx/wx_util.h @@ -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 {