Fixes #282 Narrator does not convey error information when no more Right Parenthesis can be added in expression. (#284)
* Added narrator announcements when right parenthesis is clicked
This commit is contained in:
@@ -546,6 +546,11 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
||||
if ((m_openParenCount >= MAXPRECDEPTH && nx) || (!m_openParenCount && !nx)
|
||||
|| ((m_precedenceOpCount >= MAXPRECDEPTH && m_nPrecOp[m_precedenceOpCount - 1] != 0)))
|
||||
{
|
||||
if (!m_openParenCount && !nx)
|
||||
{
|
||||
m_pCalcDisplay->OnNoRightParenAdded();
|
||||
}
|
||||
|
||||
HandleErrorCommand(wParam);
|
||||
break;
|
||||
}
|
||||
|
@@ -109,7 +109,6 @@ namespace CalculationManager
|
||||
|
||||
/// <summary>
|
||||
/// Callback from the engine
|
||||
/// Used to set the current unmatched open parenthesis count
|
||||
/// </summary>
|
||||
/// <param name="parenthesisCount">string containing the parenthesis count</param>
|
||||
void CalculatorManager::SetParenDisplayText(const wstring& parenthesisCount)
|
||||
@@ -117,6 +116,14 @@ namespace CalculationManager
|
||||
m_displayCallback->SetParenDisplayText(parenthesisCount);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Callback from the engine
|
||||
/// </summary>
|
||||
void CalculatorManager::OnNoRightParenAdded()
|
||||
{
|
||||
m_displayCallback->OnNoRightParenAdded();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Reset CalculatorManager.
|
||||
/// Set the mode to the standard calculator
|
||||
|
@@ -42,7 +42,7 @@ namespace CalculationManager
|
||||
MemorizedNumberClear = 335
|
||||
};
|
||||
|
||||
class CalculatorManager sealed : public virtual ICalcDisplay
|
||||
class CalculatorManager sealed : public ICalcDisplay
|
||||
{
|
||||
private:
|
||||
ICalcDisplay* const m_displayCallback;
|
||||
@@ -94,7 +94,8 @@ namespace CalculationManager
|
||||
void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const &tokens, _Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const &commands) override;
|
||||
void SetMemorizedNumbers(_In_ const std::vector<std::wstring>& memorizedNumbers) override;
|
||||
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override;
|
||||
void SetParenDisplayText(const std::wstring& parenthesisCount);
|
||||
void SetParenDisplayText(const std::wstring& parenthesisCount) override;
|
||||
void OnNoRightParenAdded() override;
|
||||
void DisplayPasteError();
|
||||
void MaxDigitsReached() override;
|
||||
void BinaryOperatorReceived() override;
|
||||
|
@@ -13,6 +13,7 @@ public:
|
||||
virtual void SetIsInError(bool isInError) = 0;
|
||||
virtual void SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const &tokens, _Inout_ std::shared_ptr<CalculatorVector<std::shared_ptr<IExpressionCommand>>> const &commands) = 0;
|
||||
virtual void SetParenDisplayText(const std::wstring& pszText) = 0;
|
||||
virtual void OnNoRightParenAdded() = 0;
|
||||
virtual void MaxDigitsReached() = 0; // not an error but still need to inform UI layer.
|
||||
virtual void BinaryOperatorReceived() = 0;
|
||||
virtual void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) = 0;
|
||||
|
Reference in New Issue
Block a user