From c5c86d17dc5f8fcb4421a9e745b443ea33f143c4 Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Mon, 17 Jun 2013 06:52:03 -0400 Subject: [PATCH] InputConfigDiag: Use "..." for complicated expressions The full expression is quite often too big for a simple button label, so encourage people to use the full editor to edit it. --- Source/Core/DolphinWX/Src/InputConfigDiag.cpp | 9 +++++++-- .../ControllerInterface/ControllerInterface.h | 7 +++++++ .../ControllerInterface/ExpressionParser.cpp | 17 +++++++++++++++++ .../Src/ControllerInterface/ExpressionParser.h | 1 + 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp index aebc201bc9..e036d5ec71 100644 --- a/Source/Core/DolphinWX/Src/InputConfigDiag.cpp +++ b/Source/Core/DolphinWX/Src/InputConfigDiag.cpp @@ -238,8 +238,13 @@ void GamepadPage::UpdateGUI() // buttons std::vector::const_iterator i = (*g)->control_buttons.begin() , e = (*g)->control_buttons.end(); - for (; i!=e; ++i) - (*i)->SetLabel(StrToWxStr((*i)->control_reference->expression)); + for (; i!=e; ++i) { + ControllerInterface::ControlReference *r = (*i)->control_reference; + if (r->IsComplicated()) + (*i)->SetLabel("..."); + else + (*i)->SetLabel(StrToWxStr((*i)->control_reference->expression)); + } // cboxes std::vector::const_iterator si = (*g)->options.begin() diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h index 57903a08a7..e130c951aa 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h +++ b/Source/Core/InputCommon/Src/ControllerInterface/ControllerInterface.h @@ -73,6 +73,13 @@ public: return 0; } + bool IsComplicated() { + if (parsed_expression) + return parsed_expression->is_complicated; + else + return false; + } + protected: ControlReference(const bool _is_input) : range(1), is_input(_is_input), parsed_expression(NULL) {} ciface::ExpressionParser::Expression *parsed_expression; diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp b/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp index 2023debd56..91c275e71b 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp +++ b/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.cpp @@ -209,6 +209,7 @@ public: virtual ~ExpressionNode() {} virtual ControlState GetValue() { return 0; } virtual void SetValue(ControlState state) {} + virtual bool IsComplicated() { return false; } virtual operator std::string() { return ""; } }; @@ -230,6 +231,11 @@ public: control->ToOutput()->SetState(value); } + virtual bool IsComplicated() + { + return false; + } + virtual operator std::string() { return "`" + (std::string)qualifier + "`"; @@ -276,6 +282,11 @@ public: rhs->SetValue(value); } + virtual bool IsComplicated() + { + return true; + } + virtual operator std::string() { return OpName(op) + "(" + (std::string)(*lhs) + ", " + (std::string)(*rhs) + ")"; @@ -318,6 +329,11 @@ public: } } + virtual bool IsComplicated() + { + return true; + } + virtual operator std::string() { return OpName(op) + "(" + (std::string)(*inner) + ")"; @@ -361,6 +377,7 @@ public: expr = new Expression(); expr->expr = expr_node; expr->num_controls = CountNumControls(); + expr->is_complicated = expr_node->IsComplicated(); *expr_out = expr; return EXPRESSION_PARSE_SUCCESS; diff --git a/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.h b/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.h index 631c84cd9c..342f513f5c 100644 --- a/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.h +++ b/Source/Core/InputCommon/Src/ControllerInterface/ExpressionParser.h @@ -53,6 +53,7 @@ public: ControlState GetValue(); void SetValue (ControlState state); int num_controls; + bool is_complicated; private: ExpressionNode *expr;