mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 13:20:27 -06:00
ControlReference: hide is_input behind function
This commit is contained in:
@ -291,7 +291,7 @@ void ControlDialog::UpdateListContents()
|
|||||||
const auto dev = g_controller_interface.FindDevice(m_devq);
|
const auto dev = g_controller_interface.FindDevice(m_devq);
|
||||||
if (dev != nullptr)
|
if (dev != nullptr)
|
||||||
{
|
{
|
||||||
if (control_reference->is_input)
|
if (control_reference->IsInput())
|
||||||
{
|
{
|
||||||
for (ciface::Core::Device::Input* input : dev->Inputs())
|
for (ciface::Core::Device::Input* input : dev->Inputs())
|
||||||
{
|
{
|
||||||
@ -720,7 +720,7 @@ bool InputConfigDialog::DetectButton(ControlButton* button)
|
|||||||
wxStaticBoxSizer* ControlDialog::CreateControlChooser(InputConfigDialog* const parent)
|
wxStaticBoxSizer* ControlDialog::CreateControlChooser(InputConfigDialog* const parent)
|
||||||
{
|
{
|
||||||
wxStaticBoxSizer* const main_szr = new wxStaticBoxSizer(
|
wxStaticBoxSizer* const main_szr = new wxStaticBoxSizer(
|
||||||
wxVERTICAL, this, control_reference->is_input ? _("Input") : _("Output"));
|
wxVERTICAL, this, control_reference->IsInput() ? _("Input") : _("Output"));
|
||||||
const int space5 = FromDIP(5);
|
const int space5 = FromDIP(5);
|
||||||
|
|
||||||
textctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition,
|
textctrl = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition,
|
||||||
@ -730,7 +730,7 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(InputConfigDialog* const p
|
|||||||
textctrl->SetFont(font);
|
textctrl->SetFont(font);
|
||||||
|
|
||||||
wxButton* const detect_button =
|
wxButton* const detect_button =
|
||||||
new wxButton(this, wxID_ANY, control_reference->is_input ? _("Detect") : _("Test"));
|
new wxButton(this, wxID_ANY, control_reference->IsInput() ? _("Detect") : _("Test"));
|
||||||
|
|
||||||
wxButton* const clear_button = new wxButton(this, wxID_ANY, _("Clear"));
|
wxButton* const clear_button = new wxButton(this, wxID_ANY, _("Clear"));
|
||||||
|
|
||||||
@ -747,7 +747,7 @@ wxStaticBoxSizer* ControlDialog::CreateControlChooser(InputConfigDialog* const p
|
|||||||
button_sizer->Add(select_button, 1);
|
button_sizer->Add(select_button, 1);
|
||||||
button_sizer->Add(or_button, 1);
|
button_sizer->Add(or_button, 1);
|
||||||
|
|
||||||
if (control_reference->is_input)
|
if (control_reference->IsInput())
|
||||||
{
|
{
|
||||||
// TODO: check if && is good on other OS
|
// TODO: check if && is good on other OS
|
||||||
wxButton* const and_button = new wxButton(this, wxID_ANY, _("&& AND"));
|
wxButton* const and_button = new wxButton(this, wxID_ANY, _("&& AND"));
|
||||||
@ -964,7 +964,7 @@ ControlGroupBox::ControlGroupBox(ControllerEmu::ControlGroup* const group, wxWin
|
|||||||
exclude_buttons.end())
|
exclude_buttons.end())
|
||||||
eventsink->control_buttons.push_back(control_button);
|
eventsink->control_buttons.push_back(control_button);
|
||||||
|
|
||||||
if (control->control_ref->is_input)
|
if (control->control_ref->IsInput())
|
||||||
{
|
{
|
||||||
control_button->SetToolTip(
|
control_button->SetToolTip(
|
||||||
_("Left-click to detect input.\nMiddle-click to clear.\nRight-click for more options."));
|
_("Left-click to detect input.\nMiddle-click to clear.\nRight-click for more options."));
|
||||||
|
@ -32,7 +32,7 @@ void ControlReference::UpdateReference(ciface::Core::DeviceContainer& devices,
|
|||||||
delete parsed_expression;
|
delete parsed_expression;
|
||||||
parsed_expression = nullptr;
|
parsed_expression = nullptr;
|
||||||
|
|
||||||
ControlFinder finder(devices, default_device, is_input);
|
ControlFinder finder(devices, default_device, IsInput());
|
||||||
parse_error = ParseExpression(expression, finder, &parsed_expression);
|
parse_error = ParseExpression(expression, finder, &parsed_expression);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,19 +48,27 @@ int ControlReference::BoundCount() const
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
ControlReference::ControlReference(const bool _is_input)
|
ControlReference::ControlReference() : range(1), parsed_expression(nullptr)
|
||||||
: range(1), is_input(_is_input), parsed_expression(nullptr)
|
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
InputReference::InputReference() : ControlReference(true)
|
InputReference::InputReference() : ControlReference()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
OutputReference::OutputReference() : ControlReference(false)
|
OutputReference::OutputReference() : ControlReference()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool InputReference::IsInput() const
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
bool OutputReference::IsInput() const
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// InputReference :: State
|
// InputReference :: State
|
||||||
//
|
//
|
||||||
|
@ -26,6 +26,7 @@ public:
|
|||||||
virtual ControlState State(const ControlState state = 0) = 0;
|
virtual ControlState State(const ControlState state = 0) = 0;
|
||||||
virtual ciface::Core::Device::Control* Detect(const unsigned int ms,
|
virtual ciface::Core::Device::Control* Detect(const unsigned int ms,
|
||||||
ciface::Core::Device* const device) = 0;
|
ciface::Core::Device* const device) = 0;
|
||||||
|
virtual bool IsInput() const = 0;
|
||||||
|
|
||||||
int BoundCount() const;
|
int BoundCount() const;
|
||||||
void UpdateReference(ciface::Core::DeviceContainer& devices,
|
void UpdateReference(ciface::Core::DeviceContainer& devices,
|
||||||
@ -33,11 +34,10 @@ public:
|
|||||||
|
|
||||||
ControlState range;
|
ControlState range;
|
||||||
std::string expression;
|
std::string expression;
|
||||||
const bool is_input;
|
|
||||||
ciface::ExpressionParser::ExpressionParseStatus parse_error;
|
ciface::ExpressionParser::ExpressionParseStatus parse_error;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ControlReference(const bool _is_input);
|
ControlReference();
|
||||||
ciface::ExpressionParser::Expression* parsed_expression;
|
ciface::ExpressionParser::Expression* parsed_expression;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,6 +50,7 @@ class InputReference : public ControlReference
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
InputReference();
|
InputReference();
|
||||||
|
bool IsInput() const override;
|
||||||
ControlState State(const ControlState state) override;
|
ControlState State(const ControlState state) override;
|
||||||
ciface::Core::Device::Control* Detect(const unsigned int ms,
|
ciface::Core::Device::Control* Detect(const unsigned int ms,
|
||||||
ciface::Core::Device* const device) override;
|
ciface::Core::Device* const device) override;
|
||||||
@ -64,6 +65,7 @@ class OutputReference : public ControlReference
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
OutputReference();
|
OutputReference();
|
||||||
|
bool IsInput() const override;
|
||||||
ControlState State(const ControlState state) override;
|
ControlState State(const ControlState state) override;
|
||||||
ciface::Core::Device::Control* Detect(const unsigned int ms,
|
ciface::Core::Device::Control* Detect(const unsigned int ms,
|
||||||
ciface::Core::Device* const device) override;
|
ciface::Core::Device* const device) override;
|
||||||
|
Reference in New Issue
Block a user