Skip to content

Commit

Permalink
createManipulatorRow() no longer takes a parent parameter
Browse files Browse the repository at this point in the history
The only parent ever used is "this" (the SurfaceInspector itself) so there is
no need for it to be passed as a parameter.
  • Loading branch information
Matthew Mott committed Nov 3, 2021
1 parent 3433719 commit 37fdf7f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
35 changes: 21 additions & 14 deletions radiant/ui/surfaceinspector/SurfaceInspector.cpp
Expand Up @@ -401,17 +401,23 @@ void SurfaceInspector::populateWindow()
dialogVBox->Add(table, 0, wxEXPAND | wxLEFT, 18); // 18 pixels left indentation

// Initial parameter editing rows
_manipulators[HSHIFT] = createManipulatorRow(this, _(LABEL_HSHIFT), table, "arrow_left_blue.png", "arrow_right_blue.png");
_manipulators[VSHIFT] = createManipulatorRow(this, _(LABEL_VSHIFT), table, "arrow_down_blue.png", "arrow_up_blue.png");
_manipulators[HSCALE] = createManipulatorRow(this, _(LABEL_HSCALE), table, "hscale_down.png", "hscale_up.png");
_manipulators[HSHIFT] = createManipulatorRow(
_(LABEL_HSHIFT), table, "arrow_left_blue.png", "arrow_right_blue.png"
);
_manipulators[VSHIFT] = createManipulatorRow(
_(LABEL_VSHIFT), table, "arrow_down_blue.png", "arrow_up_blue.png"
);
_manipulators[HSCALE] = createManipulatorRow(
_(LABEL_HSCALE), table, "hscale_down.png", "hscale_up.png"
);

// Scale link widgets
table->AddSpacer(1); // instead of a label
createScaleLinkButtons(*table);

// Remaining parameter rows
_manipulators[VSCALE] = createManipulatorRow(this, _(LABEL_VSCALE), table, "vscale_down.png", "vscale_up.png");
_manipulators[ROTATION] = createManipulatorRow(this, _(LABEL_ROTATION), table, "rotate_cw.png", "rotate_ccw.png");
_manipulators[VSCALE] = createManipulatorRow(_(LABEL_VSCALE), table, "vscale_down.png", "vscale_up.png");
_manipulators[ROTATION] = createManipulatorRow(_(LABEL_ROTATION), table, "rotate_cw.png", "rotate_ccw.png");

// ======================== Texture Operations ====================================

Expand Down Expand Up @@ -517,35 +523,36 @@ void SurfaceInspector::populateWindow()
SetSizerAndFit(border);
}

SurfaceInspector::ManipulatorRow SurfaceInspector::createManipulatorRow(
wxWindow* parent, const std::string& label, wxFlexGridSizer* table,
const std::string& bitmapSmaller, const std::string& bitmapLarger)
SurfaceInspector::ManipulatorRow
SurfaceInspector::createManipulatorRow(const std::string& label, wxFlexGridSizer* table,
const std::string& bitmapSmaller,
const std::string& bitmapLarger)
{
ManipulatorRow manipRow;

wxStaticText* text = new wxStaticText(parent, wxID_ANY, label);
wxStaticText* text = new wxStaticText(this, wxID_ANY, label);
table->Add(text, 0, wxALIGN_CENTER_VERTICAL);

wxBoxSizer* hbox = new wxBoxSizer(wxHORIZONTAL);

// Create the entry field
manipRow.value = new wxTextCtrl(parent, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
manipRow.value = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER);
manipRow.value->SetMinSize(PixelSize(50, -1));
manipRow.value->Bind(wxEVT_TEXT_ENTER, &SurfaceInspector::onValueEntryActivate, this);

// Create the nudge buttons
wxBoxSizer* controlButtonBox = new wxBoxSizer(wxHORIZONTAL);
manipRow.smaller = new wxutil::ControlButton(parent, wxutil::GetLocalBitmap(bitmapSmaller));
manipRow.smaller = new wxutil::ControlButton(this, wxutil::GetLocalBitmap(bitmapSmaller));
controlButtonBox->Add(manipRow.smaller, 0, wxEXPAND);
controlButtonBox->AddSpacer(2);
manipRow.larger = new wxutil::ControlButton(parent, wxutil::GetLocalBitmap(bitmapLarger));
manipRow.larger = new wxutil::ControlButton(this, wxutil::GetLocalBitmap(bitmapLarger));
controlButtonBox->Add(manipRow.larger, 0, wxEXPAND);

// Create the label
wxStaticText* steplabel = new wxStaticText(parent, wxID_ANY, _(LABEL_STEP));
wxStaticText* steplabel = new wxStaticText(this, wxID_ANY, _(LABEL_STEP));

// Create the entry field
manipRow.stepEntry = new wxTextCtrl(parent, wxID_ANY, "");
manipRow.stepEntry = new wxTextCtrl(this, wxID_ANY, "");
manipRow.stepEntry->SetMinSize(PixelSize(30, -1));

// Arrange all items in a row
Expand Down
6 changes: 3 additions & 3 deletions radiant/ui/surfaceinspector/SurfaceInspector.h
Expand Up @@ -144,9 +144,9 @@ class SurfaceInspector :
*
* @returns: the structure containing the widget pointers.
*/
ManipulatorRow createManipulatorRow(wxWindow* parent,
const std::string& label, wxFlexGridSizer* table,
const std::string& bitmapSmaller, const std::string& bitmapLarger);
ManipulatorRow createManipulatorRow(const std::string& label, wxFlexGridSizer* table,
const std::string& bitmapSmaller,
const std::string& bitmapLarger);

// Widget construction
void populateWindow();
Expand Down

0 comments on commit 37fdf7f

Please sign in to comment.