summaryrefslogtreecommitdiff
path: root/src/wx/custom_scale_dialog.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2025-05-11 20:22:51 +0200
committerCarl Hetherington <cth@carlh.net>2025-05-11 20:22:51 +0200
commit6bbf7dee3e8ebfad87035aa032e71e06f7a4acb8 (patch)
treec963774deee18830cc3279284b2545733eb00a03 /src/wx/custom_scale_dialog.cc
parentcfe623e43c6f6d8624f06c2115419aedd2c85992 (diff)
White space: custom_scale_dialog.{cc,h}
Diffstat (limited to 'src/wx/custom_scale_dialog.cc')
-rw-r--r--src/wx/custom_scale_dialog.cc102
1 files changed, 51 insertions, 51 deletions
diff --git a/src/wx/custom_scale_dialog.cc b/src/wx/custom_scale_dialog.cc
index 39cf328de..4e7b70f88 100644
--- a/src/wx/custom_scale_dialog.cc
+++ b/src/wx/custom_scale_dialog.cc
@@ -35,76 +35,76 @@ using boost::optional;
using namespace dcp;
-CustomScaleDialog::CustomScaleDialog (wxWindow* parent, dcp::Size initial, dcp::Size film_container, optional<float> custom_ratio, optional<dcp::Size> custom_size)
- : TableDialog (parent, _("Custom scale"), 3, 1, true)
- , _film_container (film_container)
+CustomScaleDialog::CustomScaleDialog(wxWindow* parent, dcp::Size initial, dcp::Size film_container, optional<float> custom_ratio, optional<dcp::Size> custom_size)
+ : TableDialog(parent, _("Custom scale"), 3, 1, true)
+ , _film_container(film_container)
{
- _ratio_to_fit = new wxRadioButton (this, wxID_ANY, _("Set ratio and fit to DCP container"));
- add (_ratio_to_fit);
- wxBoxSizer* s = new wxBoxSizer (wxHORIZONTAL);
- _ratio = new wxTextCtrl (this, wxID_ANY, wxString{}, wxDefaultPosition, wxDefaultSize, 0, wxNumericPropertyValidator(wxNumericPropertyValidator::Float));
- s->Add (_ratio, 1, wxRIGHT, 4);
+ _ratio_to_fit = new wxRadioButton(this, wxID_ANY, _("Set ratio and fit to DCP container"));
+ add(_ratio_to_fit);
+ wxBoxSizer* s = new wxBoxSizer(wxHORIZONTAL);
+ _ratio = new wxTextCtrl(this, wxID_ANY, wxString{}, wxDefaultPosition, wxDefaultSize, 0, wxNumericPropertyValidator(wxNumericPropertyValidator::Float));
+ s->Add(_ratio, 1, wxRIGHT, 4);
add_label_to_sizer(s, this, char_to_wx(":1"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL);
- add (s);
+ add(s);
_size_from_ratio = new wxStaticText(this, wxID_ANY, {});
- add (_size_from_ratio, 1, wxALIGN_CENTER_VERTICAL);
+ add(_size_from_ratio, 1, wxALIGN_CENTER_VERTICAL);
- _size = new wxRadioButton (this, wxID_ANY, _("Set size"));
- add (_size);
- s = new wxBoxSizer (wxHORIZONTAL);
- _width = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(DCPOMATIC_SPIN_CTRL_WIDTH, -1), wxSP_ARROW_KEYS, 1, film_container.width);
- s->Add (_width, 1, wxRIGHT, 4);
+ _size = new wxRadioButton(this, wxID_ANY, _("Set size"));
+ add(_size);
+ s = new wxBoxSizer(wxHORIZONTAL);
+ _width = new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(DCPOMATIC_SPIN_CTRL_WIDTH, -1), wxSP_ARROW_KEYS, 1, film_container.width);
+ s->Add(_width, 1, wxRIGHT, 4);
add_label_to_sizer(s, this, char_to_wx("x"), false, 0, wxLEFT | wxRIGHT | wxALIGN_CENTER_VERTICAL);
- _height = new wxSpinCtrl (this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(DCPOMATIC_SPIN_CTRL_WIDTH, -1), wxSP_ARROW_KEYS, 1, film_container.height);
- s->Add (_height, 1, wxRIGHT, 4);
- add (s);
+ _height = new wxSpinCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(DCPOMATIC_SPIN_CTRL_WIDTH, -1), wxSP_ARROW_KEYS, 1, film_container.height);
+ s->Add(_height, 1, wxRIGHT, 4);
+ add(s);
_ratio_from_size = new wxStaticText(this, wxID_ANY, {});
- add (_ratio_from_size, 1, wxALIGN_CENTER_VERTICAL);
+ add(_ratio_from_size, 1, wxALIGN_CENTER_VERTICAL);
if (custom_ratio) {
- _ratio_to_fit->SetValue (true);
- _size->SetValue (false);
+ _ratio_to_fit->SetValue(true);
+ _size->SetValue(false);
_ratio->SetValue(wxString::Format(char_to_wx("%.2f"), *custom_ratio));
- _width->SetValue (initial.width);
- _height->SetValue (initial.height);
+ _width->SetValue(initial.width);
+ _height->SetValue(initial.height);
} else if (custom_size) {
- _ratio_to_fit->SetValue (false);
- _size->SetValue (true);
+ _ratio_to_fit->SetValue(false);
+ _size->SetValue(true);
_ratio->SetValue(wxString::Format(char_to_wx("%.2f"), initial.ratio()));
- _width->SetValue (custom_size->width);
- _height->SetValue (custom_size->height);
+ _width->SetValue(custom_size->width);
+ _height->SetValue(custom_size->height);
} else {
_ratio_to_fit->SetValue (true);
- _size->SetValue (false);
+ _size->SetValue(false);
_ratio->SetValue(wxString::Format(char_to_wx("%.2f"), initial.ratio()));
- _width->SetValue (initial.width);
- _height->SetValue (initial.height);
+ _width->SetValue(initial.width);
+ _height->SetValue(initial.height);
}
- setup_sensitivity ();
- update_size_from_ratio ();
- update_ratio_from_size ();
+ setup_sensitivity();
+ update_size_from_ratio();
+ update_ratio_from_size();
- layout ();
+ layout();
- _ratio_to_fit->Bind (wxEVT_RADIOBUTTON, boost::bind(&CustomScaleDialog::setup_sensitivity, this));
- _ratio->Bind (wxEVT_TEXT, boost::bind(&CustomScaleDialog::update_size_from_ratio, this));
- _size->Bind (wxEVT_RADIOBUTTON, boost::bind(&CustomScaleDialog::setup_sensitivity, this));
- _width->Bind (wxEVT_TEXT, boost::bind(&CustomScaleDialog::update_ratio_from_size, this));
- _height->Bind (wxEVT_TEXT, boost::bind(&CustomScaleDialog::update_ratio_from_size, this));
+ _ratio_to_fit->Bind(wxEVT_RADIOBUTTON, boost::bind(&CustomScaleDialog::setup_sensitivity, this));
+ _ratio->Bind(wxEVT_TEXT, boost::bind(&CustomScaleDialog::update_size_from_ratio, this));
+ _size->Bind(wxEVT_RADIOBUTTON, boost::bind(&CustomScaleDialog::setup_sensitivity, this));
+ _width->Bind(wxEVT_TEXT, boost::bind(&CustomScaleDialog::update_ratio_from_size, this));
+ _height->Bind(wxEVT_TEXT, boost::bind(&CustomScaleDialog::update_ratio_from_size, this));
}
void
-CustomScaleDialog::update_size_from_ratio ()
+CustomScaleDialog::update_size_from_ratio()
{
- dcp::Size const s = fit_ratio_within (raw_convert<float>(wx_to_std(_ratio->GetValue())), _film_container);
+ dcp::Size const s = fit_ratio_within(raw_convert<float>(wx_to_std(_ratio->GetValue())), _film_container);
_size_from_ratio->SetLabelMarkup(wxString::Format(char_to_wx("<i>%dx%d</i>"), s.width, s.height));
}
void
-CustomScaleDialog::update_ratio_from_size ()
+CustomScaleDialog::update_ratio_from_size()
{
float const ratio = _height->GetValue() > 0 ? (float(_width->GetValue()) / _height->GetValue()) : 2;
_ratio_from_size->SetLabelMarkup(wxString::Format(char_to_wx("<i>%.2f:1</i>"), ratio));
@@ -112,18 +112,18 @@ CustomScaleDialog::update_ratio_from_size ()
void
-CustomScaleDialog::setup_sensitivity ()
+CustomScaleDialog::setup_sensitivity()
{
- _ratio->Enable (_ratio_to_fit->GetValue());
- _size_from_ratio->Enable (_ratio_to_fit->GetValue());
- _width->Enable (_size->GetValue());
- _height->Enable (_size->GetValue());
- _ratio_from_size->Enable (_size->GetValue());
+ _ratio->Enable(_ratio_to_fit->GetValue());
+ _size_from_ratio->Enable(_ratio_to_fit->GetValue());
+ _width->Enable(_size->GetValue());
+ _height->Enable(_size->GetValue());
+ _ratio_from_size->Enable(_size->GetValue());
}
optional<float>
-CustomScaleDialog::custom_ratio () const
+CustomScaleDialog::custom_ratio() const
{
if (!_ratio_to_fit->GetValue()) {
return optional<float>();
@@ -134,12 +134,12 @@ CustomScaleDialog::custom_ratio () const
optional<dcp::Size>
-CustomScaleDialog::custom_size () const
+CustomScaleDialog::custom_size() const
{
if (!_size->GetValue()) {
return optional<dcp::Size>();
}
- return dcp::Size (_width->GetValue(), _height->GetValue());
+ return dcp::Size(_width->GetValue(), _height->GetValue());
}