Merge remote-tracking branch 'upstream/master' into Fix245
|
@ -5,7 +5,6 @@ root = true
|
|||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
end_of_line = crlf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
|
14
README.md
|
@ -2,7 +2,7 @@
|
|||
The Windows Calculator app is a modern Windows app written in C++ that ships pre-installed with Windows.
|
||||
The app provides standard, scientific, and programmer calculator functionality, as well as a set of converters between various units of measurement and currencies.
|
||||
|
||||
Calculator ships regularly with new features and bug fixes. You can get the latest version of Calculator in the [Microsoft Store.](https://www.microsoft.com/store/apps/9WZDNCRFHVN5)
|
||||
Calculator ships regularly with new features and bug fixes. You can get the latest version of Calculator in the [Microsoft Store](https://www.microsoft.com/store/apps/9WZDNCRFHVN5).
|
||||
|
||||
[](https://dev.azure.com/ms/calculator/_build/latest?definitionId=57&branchName=master)
|
||||
|
||||
|
@ -18,14 +18,14 @@ Calculator ships regularly with new features and bug fixes. You can get the late
|
|||
|
||||
## Getting started
|
||||
Prerequisites:
|
||||
- Your computer must be running Windows 10, version 1803 or newer
|
||||
- Install the latest version of [Visual Studio](https://developer.microsoft.com/en-us/windows/downloads) (the free community edition is sufficient)
|
||||
- Install the "Universal Windows Platform Development" workload
|
||||
- Install the optional "C++ Universal Windows Platform tools" component
|
||||
- Install the latest Windows 10 SDK
|
||||
- Your computer must be running Windows 10, version 1803 or newer.
|
||||
- Install the latest version of [Visual Studio](https://developer.microsoft.com/en-us/windows/downloads) (the free community edition is sufficient).
|
||||
- Install the "Universal Windows Platform Development" workload.
|
||||
- Install the optional "C++ Universal Windows Platform tools" component.
|
||||
- Install the latest Windows 10 SDK.
|
||||
|
||||

|
||||
- Install the [XAML Styler](https://marketplace.visualstudio.com/items?itemName=TeamXavalon.XAMLStyler) Visual Studio extension
|
||||
- Install the [XAML Styler](https://marketplace.visualstudio.com/items?itemName=TeamXavalon.XAMLStyler) Visual Studio extension.
|
||||
|
||||
- Get the code:
|
||||
```
|
||||
|
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 61 KiB |
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 64 KiB |
Before Width: | Height: | Size: 3.1 MiB After Width: | Height: | Size: 3 MiB |
Before Width: | Height: | Size: 2.2 MiB After Width: | Height: | Size: 2.1 MiB |
Before Width: | Height: | Size: 3.2 MiB After Width: | Height: | Size: 3.1 MiB |
|
@ -11,9 +11,6 @@ namespace Calculator.UIAutomationLibrary.Components
|
|||
/// <summary>
|
||||
/// Physical Object Model for the app window.
|
||||
/// POM is the implementation model of the app.
|
||||
/// See following references to POM:
|
||||
/// * https://blogs.msdn.microsoft.com/wltester/2011/11/14/object-model-design/
|
||||
/// * https://blogs.msdn.microsoft.com/micahel/2005/06/03/how-do-i-invoke-thee-let-me-count-the-ways-the-physical-object-model/
|
||||
/// See https://en.wikipedia.org/wiki/Model-based_testing for model-based testing.
|
||||
/// </summary>
|
||||
public class MainPagePom : UIObject
|
||||
|
|
|
@ -261,7 +261,7 @@ void CalcInput::SetDecimalSymbol(wchar_t decSymbol)
|
|||
}
|
||||
}
|
||||
|
||||
wstring CalcInput::ToString(uint32_t radix, bool isIntegerMode)
|
||||
wstring CalcInput::ToString(uint32_t radix)
|
||||
{
|
||||
// In theory both the base and exponent could be C_NUM_MAX_DIGITS long.
|
||||
wstringstream resStream;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include "pch.h"
|
||||
#include "Header Files/CalcEngine.h"
|
||||
#include "Header Files/CalcUtils.h"
|
||||
|
||||
bool IsOpInRange(WPARAM op, uint32_t x, uint32_t y)
|
||||
{
|
||||
|
|
|
@ -2,18 +2,25 @@
|
|||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
#pragma once
|
||||
#include "Header Files/CalcEngine.h"
|
||||
#include "Command.h"
|
||||
#include "CalculatorVector.h"
|
||||
#include "ExpressionCommand.h"
|
||||
#include "CalcException.h"
|
||||
|
||||
constexpr int ASCII_0 = 48;
|
||||
|
||||
using namespace std;
|
||||
using namespace CalcEngine;
|
||||
|
||||
namespace {
|
||||
void IFT(HRESULT hr)
|
||||
{
|
||||
if (FAILED(hr))
|
||||
{
|
||||
throw hr;
|
||||
}
|
||||
}
|
||||
}
|
||||
void CHistoryCollector::ReinitHistory()
|
||||
{
|
||||
m_lastOpStartIndex = -1;
|
||||
|
@ -223,11 +230,11 @@ void CHistoryCollector::AddUnaryOpToHistory(int nOpCode, bool fInv, ANGLE_TYPE a
|
|||
{
|
||||
angleOpCode = CalculationManager::Command::CommandDEG;
|
||||
}
|
||||
if (angletype == ANGLE_RAD)
|
||||
else if (angletype == ANGLE_RAD)
|
||||
{
|
||||
angleOpCode = CalculationManager::Command::CommandRAD;
|
||||
}
|
||||
if (angletype == ANGLE_GRAD)
|
||||
else // (angletype == ANGLE_GRAD)
|
||||
{
|
||||
angleOpCode = CalculationManager::Command::CommandGRAD;
|
||||
}
|
||||
|
@ -428,7 +435,7 @@ void CHistoryCollector::UpdateHistoryExpression(uint32_t radix, int32_t precisio
|
|||
std::shared_ptr<COpndCommand> opndCommand = std::static_pointer_cast<COpndCommand>(expCommand);
|
||||
if (opndCommand != nullptr)
|
||||
{
|
||||
token.first = opndCommand->GetString(radix, precision, m_decimalSymbol);
|
||||
token.first = opndCommand->GetString(radix, precision);
|
||||
IFT(m_spTokens->SetAt(i, token));
|
||||
opndCommand->SetCommands(GetOperandCommandsFromString(token.first));
|
||||
}
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
using namespace std;
|
||||
using namespace CalcEngine;
|
||||
|
||||
namespace {
|
||||
// NPrecedenceOfOp
|
||||
//
|
||||
// returns a virtual number for precedence for the operator. We expect binary operator only, otherwise the lowest number
|
||||
|
@ -35,20 +36,21 @@ INT NPrecedenceOfOp(int nopCode)
|
|||
static BYTE rgbPrec[] = { 0,0, IDC_OR,0, IDC_XOR,0, IDC_AND,1,
|
||||
IDC_ADD,2, IDC_SUB,2, IDC_RSHF,3, IDC_LSHF,3,
|
||||
IDC_MOD,3, IDC_DIV,3, IDC_MUL,3, IDC_PWR,4, IDC_ROOT, 4 };
|
||||
int iPrec;
|
||||
unsigned int iPrec;
|
||||
|
||||
iPrec = 0;
|
||||
while ((iPrec < ARRAYSIZE(rgbPrec)) && (nopCode != rgbPrec[iPrec]))
|
||||
while ((iPrec < size(rgbPrec)) && (nopCode != rgbPrec[iPrec]))
|
||||
{
|
||||
iPrec += 2;
|
||||
}
|
||||
if (iPrec >= ARRAYSIZE(rgbPrec))
|
||||
if (iPrec >= size(rgbPrec))
|
||||
{
|
||||
iPrec = 0;
|
||||
}
|
||||
return rgbPrec[iPrec + 1];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// HandleErrorCommand
|
||||
//
|
||||
|
@ -58,7 +60,7 @@ void CCalcEngine::HandleErrorCommand(WPARAM idc)
|
|||
{
|
||||
if (!IsGuiSettingOpCode(idc))
|
||||
{
|
||||
// we would have saved the prev command. Need to forget this state
|
||||
// We would have saved the prev command. Need to forget this state
|
||||
m_nTempCom = m_nLastCom;
|
||||
}
|
||||
}
|
||||
|
@ -180,7 +182,7 @@ void CCalcEngine::ProcessCommandWorker(WPARAM wParam)
|
|||
// BINARY OPERATORS:
|
||||
if (IsBinOpCode(wParam))
|
||||
{
|
||||
/* Change the operation if last input was operation. */
|
||||
// Change the operation if last input was operation.
|
||||
if (IsBinOpCode(m_nLastCom))
|
||||
{
|
||||
INT nPrev;
|
||||
|
@ -544,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;
|
||||
}
|
||||
|
@ -940,7 +947,7 @@ wstring_view CCalcEngine::OpCodeToUnaryString(int nOpCode, bool fInv, ANGLE_TYPE
|
|||
// Try to lookup the ID in the UFNE table
|
||||
int ids = 0;
|
||||
int iufne = nOpCode - IDC_UNARYFIRST;
|
||||
if (iufne >= 0 && iufne < ARRAYSIZE(rgUfne))
|
||||
if (iufne >= 0 && (size_t)iufne < size(rgUfne))
|
||||
{
|
||||
if (fInv)
|
||||
{
|
||||
|
@ -1020,7 +1027,7 @@ wstring CCalcEngine::GetCurrentResultForRadix(uint32_t radix, int32_t precision)
|
|||
wstring numberString = GetStringForDisplay(rat, radix);
|
||||
if (!numberString.empty())
|
||||
{
|
||||
//revert the precision to previously stored precision
|
||||
// Revert the precision to previously stored precision
|
||||
ChangeConstants(m_radix, m_precision);
|
||||
}
|
||||
|
||||
|
|
|
@ -104,7 +104,7 @@ void CCalcEngine::DisplayNum(void)
|
|||
if (m_bRecord)
|
||||
{
|
||||
// Display the string and return.
|
||||
m_numberString = m_input.ToString(m_radix, m_fIntegerMode);
|
||||
m_numberString = m_input.ToString(m_radix);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
using namespace CalcEngine;
|
||||
using namespace CalcEngine::RationalMath;
|
||||
using namespace std;
|
||||
|
||||
// To be called when either the radix or num width changes. You can use -1 in either of these values to mean
|
||||
// dont change that.
|
||||
|
@ -55,7 +56,7 @@ LONG CCalcEngine::DwWordBitWidthFromeNumWidth(NUM_WIDTH /*numwidth*/)
|
|||
static constexpr int nBitMax[] = { 64, 32, 16, 8 };
|
||||
LONG wmax = nBitMax[0];
|
||||
|
||||
if (m_numwidth >= 0 && m_numwidth < ARRAYSIZE(nBitMax))
|
||||
if (m_numwidth >= 0 && (size_t)m_numwidth < size(nBitMax))
|
||||
{
|
||||
wmax = nBitMax[m_numwidth];
|
||||
}
|
||||
|
@ -68,7 +69,7 @@ uint32_t CCalcEngine::NRadixFromRadixType(RADIX_TYPE radixtype)
|
|||
uint32_t radix = 10;
|
||||
|
||||
// convert special bases into symbolic values
|
||||
if (radixtype >= 0 && radixtype < ARRAYSIZE(rgnRadish))
|
||||
if (radixtype >= 0 && (size_t)radixtype < size(rgnRadish))
|
||||
{
|
||||
radix = rgnRadish[radixtype];
|
||||
}
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
class CalcException : std::exception
|
||||
{
|
||||
public:
|
||||
CalcException(HRESULT hr)
|
||||
{
|
||||
m_hr = hr;
|
||||
}
|
||||
HRESULT GetException()
|
||||
{
|
||||
return m_hr;
|
||||
}
|
||||
private:
|
||||
HRESULT m_hr;
|
||||
};
|
||||
|
||||
void IFT(HRESULT hr)
|
||||
{
|
||||
if (FAILED(hr))
|
||||
{
|
||||
CalcException exception(hr);
|
||||
throw(exception);
|
||||
}
|
||||
}
|
|
@ -155,6 +155,8 @@
|
|||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -169,6 +171,8 @@
|
|||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -183,6 +187,8 @@
|
|||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -197,6 +203,8 @@
|
|||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -212,6 +220,8 @@
|
|||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>_UNICODE;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -226,6 +236,8 @@
|
|||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -240,6 +252,8 @@
|
|||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -254,6 +268,8 @@
|
|||
<SDLCheck>true</SDLCheck>
|
||||
<AdditionalOptions>/Zm250 /await /std:c++17 /permissive- /Zc:twoPhase- %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
|
|
@ -119,7 +119,6 @@
|
|||
<ClInclude Include="Ratpack\ratpak.h">
|
||||
<Filter>RatPack</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="CalcException.h" />
|
||||
<ClInclude Include="CalculatorVector.h" />
|
||||
<ClInclude Include="Header Files\CalcEngine.h">
|
||||
<Filter>Header Files</Filter>
|
||||
|
@ -136,9 +135,6 @@
|
|||
<ClInclude Include="Header Files\History.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Header Files\scimath.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="UnitConverter.h" />
|
||||
<ClInclude Include="CalculatorHistory.h" />
|
||||
<ClInclude Include="CalculatorManager.h" />
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -287,7 +287,7 @@ const wstring & COpndCommand::GetToken(wchar_t decimalSymbol)
|
|||
return m_token;
|
||||
}
|
||||
|
||||
wstring COpndCommand::GetString(uint32_t radix, int32_t precision, wchar_t decimalSymbol)
|
||||
wstring COpndCommand::GetString(uint32_t radix, int32_t precision)
|
||||
{
|
||||
wstring result{};
|
||||
|
||||
|
@ -303,4 +303,3 @@ void COpndCommand::Accept(_In_ ISerializeCommandVisitor &commandVisitor)
|
|||
{
|
||||
commandVisitor.Visit(*this);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,9 +10,9 @@ class CParentheses final : public IParenthesisCommand
|
|||
{
|
||||
public:
|
||||
CParentheses(_In_ int command);
|
||||
int GetCommand() const;
|
||||
CalculationManager::CommandType GetCommandType() const;
|
||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor);
|
||||
int GetCommand() const override;
|
||||
CalculationManager::CommandType GetCommandType() const override;
|
||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override;
|
||||
|
||||
private:
|
||||
int m_command;
|
||||
|
@ -23,11 +23,11 @@ class CUnaryCommand final : public IUnaryCommand
|
|||
public:
|
||||
CUnaryCommand(int command);
|
||||
CUnaryCommand(int command1, int command2);
|
||||
const std::shared_ptr<CalculatorVector<int>> & GetCommands() const;
|
||||
CalculationManager::CommandType GetCommandType() const;
|
||||
void SetCommand(int command);
|
||||
void SetCommands(int command1, int command2);
|
||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor);
|
||||
const std::shared_ptr<CalculatorVector<int>> & GetCommands() const override;
|
||||
CalculationManager::CommandType GetCommandType() const override;
|
||||
void SetCommand(int command) override;
|
||||
void SetCommands(int command1, int command2) override;
|
||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override;
|
||||
|
||||
private:
|
||||
std::shared_ptr<CalculatorVector<int>> m_command;
|
||||
|
@ -37,10 +37,10 @@ class CBinaryCommand final : public IBinaryCommand
|
|||
{
|
||||
public:
|
||||
CBinaryCommand(int command);
|
||||
void SetCommand(int command);
|
||||
int GetCommand() const;
|
||||
CalculationManager::CommandType GetCommandType() const;
|
||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor);
|
||||
void SetCommand(int command) override;
|
||||
int GetCommand() const override;
|
||||
CalculationManager::CommandType GetCommandType() const override;
|
||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override;
|
||||
|
||||
private:
|
||||
int m_command;
|
||||
|
@ -56,18 +56,18 @@ public:
|
|||
bool fSciFmt);
|
||||
void Initialize(CalcEngine::Rational const& rat);
|
||||
|
||||
const std::shared_ptr<CalculatorVector<int>> & GetCommands() const;
|
||||
void SetCommands(std::shared_ptr<CalculatorVector<int>> const& commands);
|
||||
void AppendCommand(int command);
|
||||
void ToggleSign();
|
||||
void RemoveFromEnd();
|
||||
bool IsNegative() const;
|
||||
bool IsSciFmt() const;
|
||||
bool IsDecimalPresent() const;
|
||||
const std::wstring & GetToken(wchar_t decimalSymbol);
|
||||
CalculationManager::CommandType GetCommandType() const;
|
||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor);
|
||||
std::wstring GetString(uint32_t radix, int32_t precision, wchar_t decimalSymbol);
|
||||
const std::shared_ptr<CalculatorVector<int>> & GetCommands() const override;
|
||||
void SetCommands(std::shared_ptr<CalculatorVector<int>> const& commands) override;
|
||||
void AppendCommand(int command) override;
|
||||
void ToggleSign() override;
|
||||
void RemoveFromEnd() override;
|
||||
bool IsNegative() const override;
|
||||
bool IsSciFmt() const override;
|
||||
bool IsDecimalPresent() const override;
|
||||
const std::wstring & GetToken(wchar_t decimalSymbol) override;
|
||||
CalculationManager::CommandType GetCommandType() const override;
|
||||
void Accept(_In_ ISerializeCommandVisitor &commandVisitor) override;
|
||||
std::wstring GetString(uint32_t radix, int32_t precision);
|
||||
|
||||
private:
|
||||
std::shared_ptr<CalculatorVector<int>> m_commands;
|
||||
|
|
|
@ -30,7 +30,7 @@ public:
|
|||
class IBinaryCommand : public IOperatorCommand
|
||||
{
|
||||
public:
|
||||
virtual void SetCommand(int command) = 0;
|
||||
virtual void SetCommand(int command) override = 0;
|
||||
virtual int GetCommand() const = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace CalcEngine
|
|||
bool IsEmpty() { return value.empty(); }
|
||||
|
||||
bool IsNegative() { return m_isNegative; }
|
||||
void IsNegative(bool value) { m_isNegative = value; }
|
||||
void IsNegative(bool isNegative) { m_isNegative = isNegative; }
|
||||
|
||||
std::wstring value;
|
||||
|
||||
|
@ -53,7 +53,7 @@ namespace CalcEngine
|
|||
bool TryBeginExponent();
|
||||
void Backspace();
|
||||
void SetDecimalSymbol(wchar_t decSymbol);
|
||||
std::wstring ToString(uint32_t radix, bool isIntegerMode);
|
||||
std::wstring ToString(uint32_t radix);
|
||||
Rational ToRational(uint32_t radix, int32_t precision);
|
||||
|
||||
private:
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -61,7 +61,7 @@ void* zmalloc(size_t a)
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void _dupnum(_In_ PNUMBER dest, _In_ PNUMBER src)
|
||||
void _dupnum(_In_ PNUMBER dest, _In_ const NUMBER * const src)
|
||||
{
|
||||
memcpy(dest, src, (int)(sizeof(NUMBER) + ((src)->cdigit)*(sizeof(MANTTYPE))));
|
||||
}
|
||||
|
@ -566,7 +566,7 @@ wchar_t NormalizeCharDigit(wchar_t c, uint32_t radix)
|
|||
// is in the range where this is not ambiguous.
|
||||
if (size_t{ radix } >= DIGITS.find(L'A') && size_t { radix } <= DIGITS.find(L'Z'))
|
||||
{
|
||||
return toupper(c);
|
||||
return towupper(c);
|
||||
}
|
||||
|
||||
return c;
|
||||
|
@ -1057,10 +1057,6 @@ wstring NumberToString(_Inout_ PNUMBER& pnum, int format, uint32_t radix, int32_
|
|||
length = precision;
|
||||
}
|
||||
|
||||
// 2 for signs, 1 for 'e'(or leading zero), 1 for dp, 1 for null and
|
||||
// 10 for maximum exponent size.
|
||||
int cchNum = (precision + 16);
|
||||
|
||||
// If there is a chance a round has to occur, round.
|
||||
// - if number is zero no rounding
|
||||
// - if number of digits is less than the maximum output no rounding
|
||||
|
|
|
@ -216,4 +216,3 @@ void modrat( PRAT *pa, PRAT b )
|
|||
|
||||
destroyrat( tmp );
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ using namespace std;
|
|||
//
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
void gcdrat( PRAT *pa, uint32_t radix, int32_t precision)
|
||||
void gcdrat( PRAT *pa, int32_t precision)
|
||||
|
||||
{
|
||||
PNUMBER pgcd= nullptr;
|
||||
|
|
|
@ -1,480 +1,482 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_num_one= {
|
||||
#pragma once
|
||||
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_num_one= {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_num_two= {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_num_two= {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 2,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_num_five= {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_num_five= {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 5,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_num_six= {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_num_six= {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 6,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_num_ten= {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_num_ten= {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 10,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_smallest = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_smallest = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
NUMBER init_q_rat_smallest = {
|
||||
inline const NUMBER init_q_rat_smallest = {
|
||||
1,
|
||||
4,
|
||||
0,
|
||||
{ 0, 190439170, 901055854, 10097,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_negsmallest = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_negsmallest = {
|
||||
-1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
NUMBER init_q_rat_negsmallest = {
|
||||
inline const NUMBER init_q_rat_negsmallest = {
|
||||
1,
|
||||
4,
|
||||
0,
|
||||
{ 0, 190439170, 901055854, 10097,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_pt_eight_five = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_pt_eight_five = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 85,}
|
||||
};
|
||||
NUMBER init_q_pt_eight_five = {
|
||||
inline const NUMBER init_q_pt_eight_five = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 100,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_six = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_six = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 6,}
|
||||
};
|
||||
NUMBER init_q_rat_six = {
|
||||
inline const NUMBER init_q_rat_six = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_two = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_two = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 2,}
|
||||
};
|
||||
NUMBER init_q_rat_two = {
|
||||
inline const NUMBER init_q_rat_two = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_zero = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_zero = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 0,}
|
||||
};
|
||||
NUMBER init_q_rat_zero = {
|
||||
inline const NUMBER init_q_rat_zero = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_one = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_one = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
NUMBER init_q_rat_one = {
|
||||
inline const NUMBER init_q_rat_one = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_neg_one = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_neg_one = {
|
||||
-1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
NUMBER init_q_rat_neg_one = {
|
||||
inline const NUMBER init_q_rat_neg_one = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_half = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_half = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
NUMBER init_q_rat_half = {
|
||||
inline const NUMBER init_q_rat_half = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 2,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_ten = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_ten = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 10,}
|
||||
};
|
||||
NUMBER init_q_rat_ten = {
|
||||
inline const NUMBER init_q_rat_ten = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_pi = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 125527896, 283898350, 1960493936, 1672850762, 1288168272, 8,}
|
||||
};
|
||||
NUMBER init_q_pi = {
|
||||
inline const NUMBER init_q_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1288380402, 1120116153, 1860424692, 1944118326, 1583591604, 2,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_two_pi = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_two_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 251055792, 567796700, 1773504224, 1198217877, 428852897, 17,}
|
||||
};
|
||||
NUMBER init_q_two_pi = {
|
||||
inline const NUMBER init_q_two_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1288380402, 1120116153, 1860424692, 1944118326, 1583591604, 2,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_pi_over_two = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_pi_over_two = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 125527896, 283898350, 1960493936, 1672850762, 1288168272, 8,}
|
||||
};
|
||||
NUMBER init_q_pi_over_two = {
|
||||
inline const NUMBER init_q_pi_over_two = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 429277156, 92748659, 1573365737, 1740753005, 1019699561, 5,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_one_pt_five_pi = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_one_pt_five_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1241201312, 270061909, 1051574664, 1924965045, 1340320627, 70,}
|
||||
};
|
||||
NUMBER init_q_one_pt_five_pi = {
|
||||
inline const NUMBER init_q_one_pt_five_pi = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1579671539, 1837970263, 1067644340, 523549916, 2119366659, 14,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_e_to_one_half = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_e_to_one_half = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 256945612, 216219427, 223516738, 477442596, 581063757, 23,}
|
||||
};
|
||||
NUMBER init_q_e_to_one_half = {
|
||||
inline const NUMBER init_q_e_to_one_half = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1536828363, 698484484, 1127331835, 224219346, 245499408, 14,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_exp = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_exp = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 943665199, 1606559160, 1094967530, 1759391384, 1671799163, 1123581,}
|
||||
};
|
||||
NUMBER init_q_rat_exp = {
|
||||
inline const NUMBER init_q_rat_exp = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 879242208, 2022880100, 617392930, 1374929092, 1367479163, 413342,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_ln_ten = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_ln_ten = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 2086268922, 165794492, 1416063951, 1851428830, 1893239400, 65366841,}
|
||||
};
|
||||
NUMBER init_q_ln_ten = {
|
||||
inline const NUMBER init_q_ln_ten = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 26790652, 564532679, 783998273, 216030448, 1564709968, 28388458,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_ln_two = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_ln_two = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1789230241, 1057927868, 715399197, 908801241, 1411265331, 3,}
|
||||
};
|
||||
NUMBER init_q_ln_two = {
|
||||
inline const NUMBER init_q_ln_two = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 1559869847, 1930657510, 1228561531, 219003871, 593099283, 5,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rad_to_deg = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rad_to_deg = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 2127722024, 1904928383, 2016479213, 2048947859, 1578647346, 492,}
|
||||
};
|
||||
NUMBER init_q_rad_to_deg = {
|
||||
inline const NUMBER init_q_rad_to_deg = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 125527896, 283898350, 1960493936, 1672850762, 1288168272, 8,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rad_to_grad = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rad_to_grad = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 2125526288, 684931327, 570267400, 129125085, 1038224725, 547,}
|
||||
};
|
||||
NUMBER init_q_rad_to_grad = {
|
||||
inline const NUMBER init_q_rad_to_grad = {
|
||||
1,
|
||||
6,
|
||||
0,
|
||||
{ 125527896, 283898350, 1960493936, 1672850762, 1288168272, 8,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_qword = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_qword = {
|
||||
1,
|
||||
3,
|
||||
0,
|
||||
{ 2147483647, 2147483647, 3,}
|
||||
};
|
||||
NUMBER init_q_rat_qword = {
|
||||
inline const NUMBER init_q_rat_qword = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_dword = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_dword = {
|
||||
1,
|
||||
2,
|
||||
0,
|
||||
{ 2147483647, 1,}
|
||||
};
|
||||
NUMBER init_q_rat_dword = {
|
||||
inline const NUMBER init_q_rat_dword = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_max_long = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_max_long = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 2147483647,}
|
||||
};
|
||||
NUMBER init_q_rat_max_long = {
|
||||
inline const NUMBER init_q_rat_max_long = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_min_long = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_min_long = {
|
||||
-1,
|
||||
2,
|
||||
0,
|
||||
{ 0, 1,}
|
||||
};
|
||||
NUMBER init_q_rat_min_long = {
|
||||
inline const NUMBER init_q_rat_min_long = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_word = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_word = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 65535,}
|
||||
};
|
||||
NUMBER init_q_rat_word = {
|
||||
inline const NUMBER init_q_rat_word = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_byte = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_byte = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 255,}
|
||||
};
|
||||
NUMBER init_q_rat_byte = {
|
||||
inline const NUMBER init_q_rat_byte = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_400 = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_400 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 400,}
|
||||
};
|
||||
NUMBER init_q_rat_400 = {
|
||||
inline const NUMBER init_q_rat_400 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_360 = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_360 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 360,}
|
||||
};
|
||||
NUMBER init_q_rat_360 = {
|
||||
inline const NUMBER init_q_rat_360 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_200 = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_200 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 200,}
|
||||
};
|
||||
NUMBER init_q_rat_200 = {
|
||||
inline const NUMBER init_q_rat_200 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_180 = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_180 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 180,}
|
||||
};
|
||||
NUMBER init_q_rat_180 = {
|
||||
inline const NUMBER init_q_rat_180 = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_max_exp = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_max_exp = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 100000,}
|
||||
};
|
||||
NUMBER init_q_rat_max_exp = {
|
||||
inline const NUMBER init_q_rat_max_exp = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_min_exp = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_min_exp = {
|
||||
-1,
|
||||
1,
|
||||
0,
|
||||
{ 100000,}
|
||||
};
|
||||
NUMBER init_q_rat_min_exp = {
|
||||
inline const NUMBER init_q_rat_min_exp = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1,}
|
||||
};
|
||||
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_max_fact = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_max_fact = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 3249, }
|
||||
};
|
||||
NUMBER init_q_rat_max_fact = {
|
||||
inline const NUMBER init_q_rat_max_fact = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
{ 1, }
|
||||
};
|
||||
|
||||
// Autogenerated by _dumprawrat in support.c
|
||||
NUMBER init_p_rat_min_fact = {
|
||||
// Autogenerated by _dumprawrat in support.cpp
|
||||
inline const NUMBER init_p_rat_min_fact = {
|
||||
-1,
|
||||
1,
|
||||
0,
|
||||
{ 1000, }
|
||||
};
|
||||
NUMBER init_q_rat_min_fact = {
|
||||
inline const NUMBER init_q_rat_min_fact = {
|
||||
1,
|
||||
1,
|
||||
0,
|
||||
|
|
|
@ -411,7 +411,7 @@ extern void tanrat( _Inout_ PRAT *px, uint32_t radix, int32_t precision);
|
|||
// angle type
|
||||
extern void tananglerat( _Inout_ PRAT *px, ANGLE_TYPE angletype, uint32_t radix, int32_t precision);
|
||||
|
||||
extern void _dupnum(_In_ PNUMBER dest, _In_ PNUMBER src);
|
||||
extern void _dupnum(_In_ PNUMBER dest, _In_ const NUMBER * const src);
|
||||
|
||||
extern void _destroynum( _In_ PNUMBER pnum );
|
||||
extern void _destroyrat( _In_ PRAT prat );
|
||||
|
@ -424,7 +424,7 @@ extern void divrat( _Inout_ PRAT *pa, _In_ PRAT b, int32_t precision);
|
|||
extern void fracrat( _Inout_ PRAT *pa , uint32_t radix, int32_t precision);
|
||||
extern void factrat( _Inout_ PRAT *pa, uint32_t radix, int32_t precision);
|
||||
extern void modrat( _Inout_ PRAT *pa, _In_ PRAT b );
|
||||
extern void gcdrat( _Inout_ PRAT *pa, uint32_t radix, int32_t precision);
|
||||
extern void gcdrat( _Inout_ PRAT *pa, int32_t precision);
|
||||
extern void intrat( _Inout_ PRAT *px, uint32_t radix, int32_t precision);
|
||||
extern void mulnum( _Inout_ PNUMBER *pa, _In_ PNUMBER b, uint32_t radix);
|
||||
extern void mulnumx( _Inout_ PNUMBER *pa, _In_ PNUMBER b );
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -31,8 +31,8 @@ static int cbitsofprecision = 0;
|
|||
#define READRAWNUM(v)
|
||||
#define DUMPRAWRAT(v) _dumprawrat(#v,v, wcout)
|
||||
#define DUMPRAWNUM(v) fprintf( stderr, \
|
||||
"// Autogenerated by _dumprawrat in support.c\n" ); \
|
||||
fprintf( stderr, "NUMBER init_" #v "= {\n" ); \
|
||||
"// Autogenerated by _dumprawrat in support.cpp\n" ); \
|
||||
fprintf( stderr, "inline const NUMBER init_" #v "= {\n" ); \
|
||||
_dumprawnum(v, wcout); \
|
||||
fprintf( stderr, "};\n" )
|
||||
|
||||
|
|
|
@ -302,8 +302,8 @@ wstring UnitConverter::Serialize()
|
|||
out << std::to_wstring(m_currentHasDecimal) << delimiter << std::to_wstring(m_returnHasDecimal) << delimiter << std::to_wstring(m_switchedActive) << delimiter;
|
||||
out << m_currentDisplay << delimiter << m_returnDisplay << delimiter << "|";
|
||||
wstringstream categoryString(wstringstream::out);
|
||||
wstringstream categoryToUnitString(wstringstream::out);;
|
||||
wstringstream unitToUnitToDoubleString(wstringstream::out);;
|
||||
wstringstream categoryToUnitString(wstringstream::out);
|
||||
wstringstream unitToUnitToDoubleString(wstringstream::out);
|
||||
for (const Category& c : m_categories)
|
||||
{
|
||||
categoryString << CategoryToString(c, delimiter) << ",";
|
||||
|
@ -479,7 +479,7 @@ wstring UnitConverter::Unquote(const wstring& s)
|
|||
}
|
||||
if (cursor == s.end())
|
||||
{
|
||||
//badly formatted
|
||||
// Badly formatted
|
||||
break;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -51,7 +51,7 @@ namespace UnitConversionManager
|
|||
// null checks.
|
||||
//
|
||||
// unitId, name, abbreviation, isConversionSource, isConversionTarget, isWhimsical
|
||||
const Unit EMPTY_UNIT = Unit{ -1, L"", L"", true, true, false };
|
||||
inline const Unit EMPTY_UNIT = Unit{ -1, L"", L"", true, true, false };
|
||||
|
||||
struct Category
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <winerror.h>
|
||||
#include <sstream>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
|
|
@ -154,6 +154,8 @@
|
|||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/bigobj /await /std:c++17 %(AdditionalOptions)</AdditionalOptions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -172,6 +174,8 @@
|
|||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/bigobj /await /std:c++17 %(AdditionalOptions)</AdditionalOptions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -190,6 +194,8 @@
|
|||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/bigobj /await /std:c++17 %(AdditionalOptions)</AdditionalOptions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -208,6 +214,8 @@
|
|||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/bigobj /await /std:c++17 %(AdditionalOptions)</AdditionalOptions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -226,6 +234,8 @@
|
|||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/bigobj /await /std:c++17 %(AdditionalOptions)</AdditionalOptions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -244,6 +254,8 @@
|
|||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/bigobj /await /std:c++17 %(AdditionalOptions)</AdditionalOptions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -262,6 +274,8 @@
|
|||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/bigobj /await /std:c++17 %(AdditionalOptions)</AdditionalOptions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -280,6 +294,8 @@
|
|||
<AdditionalIncludeDirectories>$(SolutionDir)..\src\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<DisableSpecificWarnings>4453</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/bigobj /await /std:c++17 %(AdditionalOptions)</AdditionalOptions>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
#include "AppResourceProvider.h"
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#include "pch.h"
|
||||
|
@ -20,6 +20,8 @@ namespace CalculatorApp::Common::Automation
|
|||
StringReference CategoryNameChanged(L"CategoryNameChanged");
|
||||
StringReference UpdateCurrencyRates(L"UpdateCurrencyRates");
|
||||
StringReference DisplayCopied(L"DisplayCopied");
|
||||
StringReference OpenParenthesisCountChanged(L"OpenParenthesisCountChanged");
|
||||
StringReference NoParenthesisAdded(L"NoParenthesisAdded");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -142,3 +144,21 @@ NarratorAnnouncement^ CalculatorAnnouncement::GetDisplayCopiedAnnouncement(Strin
|
|||
AutomationNotificationKind::ActionCompleted,
|
||||
AutomationNotificationProcessing::ImportantMostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement^ CalculatorAnnouncement::GetOpenParenthesisCountChangedAnnouncement(String^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement,
|
||||
CalculatorActivityIds::OpenParenthesisCountChanged,
|
||||
AutomationNotificationKind::ActionCompleted,
|
||||
AutomationNotificationProcessing::ImportantMostRecent);
|
||||
}
|
||||
|
||||
NarratorAnnouncement^ CalculatorAnnouncement::GetNoRightParenthesisAddedAnnouncement(String^ announcement)
|
||||
{
|
||||
return ref new NarratorAnnouncement(
|
||||
announcement,
|
||||
CalculatorActivityIds::NoParenthesisAdded,
|
||||
AutomationNotificationKind::ActionCompleted,
|
||||
AutomationNotificationProcessing::ImportantMostRecent);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
@ -90,5 +90,8 @@ namespace CalculatorApp::Common::Automation
|
|||
static NarratorAnnouncement^ GetUpdateCurrencyRatesAnnouncement(Platform::String^ announcement);
|
||||
|
||||
static NarratorAnnouncement^ GetDisplayCopiedAnnouncement(Platform::String^ announcement);
|
||||
|
||||
static NarratorAnnouncement^ GetOpenParenthesisCountChangedAnnouncement(Platform::String^ announcement);
|
||||
static NarratorAnnouncement^ GetNoRightParenthesisAddedAnnouncement(Platform::String ^ announcement);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -29,8 +29,7 @@ void CalculatorDisplay::SetPrimaryDisplay(_In_ const wstring& displayStringValue
|
|||
{
|
||||
if (m_callbackReference)
|
||||
{
|
||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
||||
if (calcVM)
|
||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||
{
|
||||
calcVM->SetPrimaryDisplay(displayStringValue, isError);
|
||||
}
|
||||
|
@ -41,20 +40,29 @@ void CalculatorDisplay::SetParenDisplayText(_In_ const std::wstring& parenthesis
|
|||
{
|
||||
if (m_callbackReference != nullptr)
|
||||
{
|
||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
||||
if (calcVM)
|
||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||
{
|
||||
calcVM->SetParenthesisCount(parenthesisCount);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorDisplay::OnNoRightParenAdded()
|
||||
{
|
||||
if (m_callbackReference != nullptr)
|
||||
{
|
||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||
{
|
||||
calcVM->OnNoRightParenAdded();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CalculatorDisplay::SetIsInError(bool isError)
|
||||
{
|
||||
if (m_callbackReference != nullptr)
|
||||
{
|
||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
||||
if (calcVM)
|
||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||
{
|
||||
calcVM->IsInError = isError;
|
||||
}
|
||||
|
@ -65,8 +73,7 @@ void CalculatorDisplay::SetExpressionDisplay(_Inout_ std::shared_ptr<CalculatorV
|
|||
{
|
||||
if (m_callbackReference != nullptr)
|
||||
{
|
||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
||||
if (calcVM)
|
||||
if(auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||
{
|
||||
calcVM->SetExpressionDisplay(tokens, commands);
|
||||
}
|
||||
|
@ -77,8 +84,7 @@ void CalculatorDisplay::SetMemorizedNumbers(_In_ const vector<std::wstring>& new
|
|||
{
|
||||
if (m_callbackReference != nullptr)
|
||||
{
|
||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
||||
if (calcVM)
|
||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||
{
|
||||
calcVM->SetMemorizedNumbers(newMemorizedNumbers);
|
||||
}
|
||||
|
@ -89,8 +95,7 @@ void CalculatorDisplay::OnHistoryItemAdded(_In_ unsigned int addedItemIndex)
|
|||
{
|
||||
if (m_historyCallbackReference != nullptr)
|
||||
{
|
||||
auto historyVM = m_historyCallbackReference.Resolve<ViewModel::HistoryViewModel>();
|
||||
if (historyVM)
|
||||
if (auto historyVM = m_historyCallbackReference.Resolve<ViewModel::HistoryViewModel>())
|
||||
{
|
||||
historyVM->OnHistoryItemAdded(addedItemIndex);
|
||||
}
|
||||
|
@ -101,8 +106,7 @@ void CalculatorDisplay::MaxDigitsReached()
|
|||
{
|
||||
if (m_callbackReference != nullptr)
|
||||
{
|
||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
||||
if (calcVM)
|
||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||
{
|
||||
calcVM->OnMaxDigitsReached();
|
||||
}
|
||||
|
@ -113,8 +117,7 @@ void CalculatorDisplay::BinaryOperatorReceived()
|
|||
{
|
||||
if (m_callbackReference != nullptr)
|
||||
{
|
||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
||||
if (calcVM)
|
||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||
{
|
||||
calcVM->OnBinaryOperatorReceived();
|
||||
}
|
||||
|
@ -125,8 +128,7 @@ void CalculatorDisplay::MemoryItemChanged(unsigned int indexOfMemory)
|
|||
{
|
||||
if (m_callbackReference != nullptr)
|
||||
{
|
||||
auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>();
|
||||
if (calcVM)
|
||||
if (auto calcVM = m_callbackReference.Resolve<ViewModel::StandardCalculatorViewModel>())
|
||||
{
|
||||
calcVM->OnMemoryItemChanged(indexOfMemory);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@ namespace CalculatorApp
|
|||
void SetMemorizedNumbers(_In_ const std::vector<std::wstring>& memorizedNumbers) override;
|
||||
void OnHistoryItemAdded(_In_ unsigned int addedItemIndex) override;
|
||||
void SetParenDisplayText(_In_ const std::wstring& parenthesisCount) override;
|
||||
void OnNoRightParenAdded() override;
|
||||
void MaxDigitsReached() override;
|
||||
void BinaryOperatorReceived() override;
|
||||
void MemoryItemChanged(unsigned int indexOfMemory) override;
|
||||
|
|
|
@ -15,7 +15,6 @@ using namespace Windows::Foundation;
|
|||
using namespace Windows::System;
|
||||
using namespace Windows::ApplicationModel::DataTransfer;
|
||||
|
||||
size_t maxOperandLength;
|
||||
unsigned long long maxOperandNumber;
|
||||
|
||||
String^ CopyPasteManager::supportedFormats[] =
|
||||
|
@ -130,7 +129,7 @@ String^ CopyPasteManager::ValidatePasteExpression(String^ pastedText, ViewMode m
|
|||
if (pastedText->Length() > MaxPasteableLength)
|
||||
{
|
||||
// return NoOp to indicate don't paste anything.
|
||||
TraceLogger::GetInstance().LogInvalidInputPasted(L"PastedExpressionSizeGreaterThanMaxAllowed", L"MoreThanMaxInput", mode, programmerNumberBase, bitLengthType);
|
||||
TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"PastedExpressionSizeGreaterThanMaxAllowed", mode, programmerNumberBase, bitLengthType);
|
||||
return StringReference(PasteErrorString);
|
||||
}
|
||||
|
||||
|
@ -140,7 +139,7 @@ String^ CopyPasteManager::ValidatePasteExpression(String^ pastedText, ViewMode m
|
|||
String^ englishString = LocalizationSettings::GetInstance().GetEnglishValueFromLocalizedDigits(pasteExpression);
|
||||
|
||||
// Removing the spaces, comma separator from the pasteExpression to allow pasting of expressions like 1 + 2+1,333
|
||||
pasteExpression = Utils::RemoveUnwantedCharsFromWstring(englishString->Data());
|
||||
pasteExpression = RemoveUnwantedCharsFromWstring(englishString->Data());
|
||||
|
||||
// If the last character is an = sign, remove it from the pasteExpression to allow evaluating the result on paste.
|
||||
if (!pasteExpression.empty() && pasteExpression.back() == L'=')
|
||||
|
@ -165,7 +164,7 @@ String^ CopyPasteManager::ValidatePasteExpression(String^ pastedText, ViewMode m
|
|||
// validate each operand with patterns for different modes
|
||||
if (!ExpressionRegExMatch(operands, mode, modeType, programmerNumberBase, bitLengthType))
|
||||
{
|
||||
TraceLogger::GetInstance().LogInvalidInputPasted(L"InvalidExpressionForPresentMode", pastedText->Data(), mode, programmerNumberBase, bitLengthType);
|
||||
TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"InvalidExpressionForPresentMode", mode, programmerNumberBase, bitLengthType);
|
||||
return StringReference(PasteErrorString);
|
||||
}
|
||||
|
||||
|
@ -194,7 +193,7 @@ vector<wstring> CopyPasteManager::ExtractOperands(const wstring& pasteExpression
|
|||
|
||||
if (operands.size() >= MaxOperandCount)
|
||||
{
|
||||
TraceLogger::GetInstance().LogInvalidInputPasted(L"OperandCountGreaterThanMaxCount", pasteExpression.c_str(), mode, programmerNumberBase, bitLengthType);
|
||||
TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"OperandCountGreaterThanMaxCount", mode, programmerNumberBase, bitLengthType);
|
||||
operands.clear();
|
||||
return operands;
|
||||
}
|
||||
|
@ -208,7 +207,7 @@ vector<wstring> CopyPasteManager::ExtractOperands(const wstring& pasteExpression
|
|||
// to disallow pasting of 1e+12345 as 1e+1234, max exponent that can be pasted is 9999.
|
||||
if (expLength > MaxExponentLength)
|
||||
{
|
||||
TraceLogger::GetInstance().LogInvalidInputPasted(L"ExponentLengthGreaterThanMaxLength", pasteExpression.c_str(), mode, programmerNumberBase, bitLengthType);
|
||||
TraceLogger::GetInstance().LogInvalidPastedInputOccurred(L"ExponentLengthGreaterThanMaxLength", mode, programmerNumberBase, bitLengthType);
|
||||
operands.clear();
|
||||
return operands;
|
||||
}
|
||||
|
@ -405,7 +404,7 @@ wstring CopyPasteManager::SanitizeOperand(const wstring& operand)
|
|||
{
|
||||
wchar_t unWantedChars[] = { L'\'', L'_', L'`', L'(', L')', L'-' };
|
||||
|
||||
return Utils::RemoveUnwantedCharsFromWstring(operand, unWantedChars, ARRAYSIZE(unWantedChars));
|
||||
return Utils::RemoveUnwantedCharsFromWstring(operand, unWantedChars, static_cast<int>(size(unWantedChars)));
|
||||
}
|
||||
|
||||
bool CopyPasteManager::TryOperandToULL(const wstring& operand, int numberBase, unsigned long long int& result)
|
||||
|
@ -533,7 +532,7 @@ size_t CopyPasteManager::ProgrammerOperandLength(const wstring& operand, int num
|
|||
suffixes.insert(suffixes.end(), uintSuffixes.begin(), uintSuffixes.end());
|
||||
|
||||
wstring operandUpper = operand;
|
||||
transform(operandUpper.begin(), operandUpper.end(), operandUpper.begin(), toupper);
|
||||
transform(operandUpper.begin(), operandUpper.end(), operandUpper.begin(), towupper);
|
||||
|
||||
// Detect if there is a suffix and subtract its length
|
||||
// Check suffixes first to allow e.g. "0b" to result in length 1 (value 0), rather than length 0 (no value).
|
||||
|
@ -568,3 +567,21 @@ size_t CopyPasteManager::ProgrammerOperandLength(const wstring& operand, int num
|
|||
|
||||
return len;
|
||||
}
|
||||
|
||||
// return wstring after removing characters like space, comma, double quotes, and monetary prefix currency symbols supported by the Windows keyboard:
|
||||
// yen or yuan(¥) - 165
|
||||
// unspecified currency sign(¤) - 164
|
||||
// Ghanaian cedi(₵) - 8373
|
||||
// dollar or peso($) - 36
|
||||
// colón(₡) - 8353
|
||||
// won(₩) - 8361
|
||||
// shekel(₪) - 8362
|
||||
// naira(₦) - 8358
|
||||
// Indian rupee(₹) - 8377
|
||||
// pound(£) - 163
|
||||
// euro(€) - 8364
|
||||
wstring CopyPasteManager::RemoveUnwantedCharsFromWstring(const wstring& input)
|
||||
{
|
||||
wchar_t unWantedChars[] = { L' ', L',', L'"', 165, 164, 8373, 36, 8353, 8361, 8362, 8358, 8377, 163, 8364, 8234, 8235, 8236, 8237 };
|
||||
return Utils::RemoveUnwantedCharsFromWstring(input, unWantedChars, 18);
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@ namespace CalculatorApp
|
|||
static size_t OperandLength(std::wstring operand, CalculatorApp::Common::ViewMode mode, CalculatorApp::Common::CategoryGroupType modeType, int programmerNumberBase = -1);
|
||||
static size_t StandardScientificOperandLength(std::wstring operand);
|
||||
static size_t ProgrammerOperandLength(const std::wstring& operand, int numberBase);
|
||||
static std::wstring RemoveUnwantedCharsFromWstring(const std::wstring& input);
|
||||
|
||||
static constexpr size_t MaxStandardOperandLength = 16;
|
||||
static constexpr size_t MaxScientificOperandLength = 32;
|
||||
|
|
|
@ -43,7 +43,6 @@ static multimap<int, multimap<MyVirtualKey, WeakReference>> s_VirtualKeyControlS
|
|||
static multimap<int, multimap<MyVirtualKey, WeakReference>> s_VirtualKeyInverseChordsForButtons;
|
||||
static multimap<int, multimap<MyVirtualKey, WeakReference>> s_VirtualKeyControlInverseChordsForButtons;
|
||||
|
||||
static const TimeSpan c_lightUpTime = { 500000 }; // Quarter of a second
|
||||
static multimap<int, bool> s_ShiftKeyPressed;
|
||||
static multimap<int, bool> s_ControlKeyPressed;
|
||||
static multimap<int, bool> s_ShiftButtonChecked;
|
||||
|
@ -83,11 +82,13 @@ namespace CalculatorApp
|
|||
// The button will go into the visual Pressed state with this call
|
||||
VisualStateManager::GoToState(button, "Pressed", true);
|
||||
|
||||
// This timer will fire after c_lightUpTime and make the button
|
||||
// This timer will fire after lightUpTime and make the button
|
||||
// go back to the normal state.
|
||||
// This timer will only fire once after which it will be destroyed
|
||||
auto timer = ref new DispatcherTimer();
|
||||
timer->Interval = c_lightUpTime;
|
||||
TimeSpan lightUpTime{};
|
||||
lightUpTime.Duration = 500000L; // Half second (in 100-ns units)
|
||||
timer->Interval = lightUpTime;
|
||||
|
||||
WeakReference timerWeakReference(timer);
|
||||
WeakReference buttonWeakReference(button);
|
||||
|
@ -579,9 +580,9 @@ void KeyboardShortcutManager::OnKeyDownHandler(CoreWindow^ sender, KeyEventArgs^
|
|||
// Writer lock for the static maps
|
||||
reader_writer_lock::scoped_lock lock(s_keyboardShortcutMapLock);
|
||||
|
||||
auto currentControlKeyPressed = s_ControlKeyPressed.find(viewId);
|
||||
auto currControlKeyPressed = s_ControlKeyPressed.find(viewId);
|
||||
|
||||
if (currentControlKeyPressed != s_ControlKeyPressed.end())
|
||||
if (currControlKeyPressed != s_ControlKeyPressed.end())
|
||||
{
|
||||
s_ControlKeyPressed.erase(viewId);
|
||||
s_ControlKeyPressed.insert(std::make_pair(viewId, true));
|
||||
|
@ -593,9 +594,9 @@ void KeyboardShortcutManager::OnKeyDownHandler(CoreWindow^ sender, KeyEventArgs^
|
|||
// Writer lock for the static maps
|
||||
reader_writer_lock::scoped_lock lock(s_keyboardShortcutMapLock);
|
||||
|
||||
auto currentShiftKeyPressed = s_ShiftKeyPressed.find(viewId);
|
||||
auto currShiftKeyPressed = s_ShiftKeyPressed.find(viewId);
|
||||
|
||||
if (currentShiftKeyPressed != s_ShiftKeyPressed.end())
|
||||
if (currShiftKeyPressed != s_ShiftKeyPressed.end())
|
||||
{
|
||||
s_ShiftKeyPressed.erase(viewId);
|
||||
s_ShiftKeyPressed.insert(std::make_pair(viewId, true));
|
||||
|
@ -636,7 +637,7 @@ void KeyboardShortcutManager::OnKeyUpHandler(CoreWindow^ sender, KeyEventArgs^ a
|
|||
int viewId = Utils::GetWindowId();
|
||||
auto key = args->VirtualKey;
|
||||
|
||||
if (args->VirtualKey == VirtualKey::Shift)
|
||||
if (key == VirtualKey::Shift)
|
||||
{
|
||||
// Writer lock for the static maps
|
||||
reader_writer_lock::scoped_lock lock(s_keyboardShortcutMapLock);
|
||||
|
@ -649,14 +650,14 @@ void KeyboardShortcutManager::OnKeyUpHandler(CoreWindow^ sender, KeyEventArgs^ a
|
|||
s_ShiftKeyPressed.insert(std::make_pair(viewId, false));
|
||||
}
|
||||
}
|
||||
else if (args->VirtualKey == VirtualKey::Control)
|
||||
else if (key == VirtualKey::Control)
|
||||
{
|
||||
// Writer lock for the static maps
|
||||
reader_writer_lock::scoped_lock lock(s_keyboardShortcutMapLock);
|
||||
|
||||
auto currentControlKeyPressed = s_ControlKeyPressed.find(viewId);
|
||||
auto currControlKeyPressed = s_ControlKeyPressed.find(viewId);
|
||||
|
||||
if (currentControlKeyPressed != s_ControlKeyPressed.end())
|
||||
if (currControlKeyPressed != s_ControlKeyPressed.end())
|
||||
{
|
||||
s_ControlKeyPressed.erase(viewId);
|
||||
s_ControlKeyPressed.insert(std::make_pair(viewId, false));
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#pragma once
|
||||
#include "LocalizationService.h"
|
||||
|
||||
#include <iterator>
|
||||
|
||||
namespace CalculatorApp
|
||||
{
|
||||
namespace Common
|
||||
|
@ -26,8 +28,9 @@ namespace CalculatorApp
|
|||
m_digitSymbols.at(i) = formatter->FormatUInt(i)->Data()[0];
|
||||
}
|
||||
|
||||
wchar_t resolvedName[LOCALE_NAME_MAX_LENGTH];
|
||||
result = ResolveLocaleName(formatter->ResolvedLanguage->Data(),
|
||||
m_resolvedName,
|
||||
resolvedName,
|
||||
LOCALE_NAME_MAX_LENGTH);
|
||||
if (result == 0)
|
||||
{
|
||||
|
@ -35,31 +38,32 @@ namespace CalculatorApp
|
|||
}
|
||||
else
|
||||
{
|
||||
m_resolvedName = resolvedName;
|
||||
wchar_t decimalString[LocaleSettingBufferSize] = L"";
|
||||
result = GetLocaleInfoEx(m_resolvedName,
|
||||
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
||||
LOCALE_SDECIMAL,
|
||||
decimalString,
|
||||
ARRAYSIZE(decimalString));
|
||||
static_cast<int>(std::size(decimalString)));
|
||||
if (result == 0)
|
||||
{
|
||||
throw std::runtime_error("Unexpected error while getting locale info");
|
||||
}
|
||||
|
||||
wchar_t groupingSymbolString[LocaleSettingBufferSize] = L"";
|
||||
result = GetLocaleInfoEx(m_resolvedName,
|
||||
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
||||
LOCALE_STHOUSAND,
|
||||
groupingSymbolString,
|
||||
ARRAYSIZE(groupingSymbolString));
|
||||
static_cast<int>(std::size(groupingSymbolString)));
|
||||
if (result == 0)
|
||||
{
|
||||
throw std::runtime_error("Unexpected error while getting locale info");
|
||||
}
|
||||
|
||||
wchar_t numberGroupingString[LocaleSettingBufferSize] = L"";
|
||||
result = GetLocaleInfoEx(m_resolvedName,
|
||||
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
||||
LOCALE_SGROUPING,
|
||||
numberGroupingString,
|
||||
ARRAYSIZE(numberGroupingString));
|
||||
static_cast<int>(std::size(numberGroupingString)));
|
||||
if (result == 0)
|
||||
{
|
||||
throw std::runtime_error("Unexpected error while getting locale info");
|
||||
|
@ -70,14 +74,14 @@ namespace CalculatorApp
|
|||
result = ::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT,
|
||||
LOCALE_SLIST,
|
||||
listSeparatorString,
|
||||
ARRAYSIZE(listSeparatorString)); // Max length of the expected return value is 4
|
||||
static_cast<int>(std::size(listSeparatorString))); // Max length of the expected return value is 4
|
||||
if (result == 0)
|
||||
{
|
||||
throw std::runtime_error("Unexpected error while getting locale info");
|
||||
}
|
||||
|
||||
int currencyTrailingDigits = 0;
|
||||
result = GetLocaleInfoEx(m_resolvedName,
|
||||
result = GetLocaleInfoEx(m_resolvedName.c_str(),
|
||||
LOCALE_ICURRDIGITS | LOCALE_RETURN_NUMBER,
|
||||
(LPWSTR)¤cyTrailingDigits,
|
||||
sizeof(currencyTrailingDigits) / sizeof(WCHAR));
|
||||
|
@ -120,7 +124,7 @@ namespace CalculatorApp
|
|||
::GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT,
|
||||
LOCALE_IFIRSTDAYOFWEEK, // The first day in a week
|
||||
reinterpret_cast<PWSTR>(day), // Argument is of type PWSTR
|
||||
ARRAYSIZE(day)); // Max return size are 80 characters
|
||||
static_cast<int>(std::size(day))); // Max return size are 80 characters
|
||||
|
||||
// The LOCALE_IFIRSTDAYOFWEEK integer value varies from 0, 1, .. 6 for Monday, Tuesday, ... Sunday
|
||||
// DayOfWeek enum value varies from 0, 1, .. 6 for Sunday, Monday, ... Saturday
|
||||
|
@ -147,7 +151,7 @@ namespace CalculatorApp
|
|||
|
||||
Platform::String^ GetLocaleName() const
|
||||
{
|
||||
return ref new Platform::String(m_resolvedName);
|
||||
return ref new Platform::String(m_resolvedName.c_str());
|
||||
}
|
||||
|
||||
bool IsDigitEnUsSetting() const
|
||||
|
@ -377,7 +381,7 @@ namespace CalculatorApp
|
|||
Platform::String^ m_calendarIdentifier;
|
||||
Windows::Globalization::DayOfWeek m_firstDayOfWeek;
|
||||
int m_currencySymbolPrecedence;
|
||||
wchar_t m_resolvedName[LOCALE_NAME_MAX_LENGTH];
|
||||
std::wstring m_resolvedName;
|
||||
int m_currencyTrailingDigits;
|
||||
static const unsigned int LocaleSettingBufferSize = 16;
|
||||
};
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "pch.h"
|
||||
#include "TraceLogger.h"
|
||||
#include "NetworkManager.h"
|
||||
|
@ -59,7 +57,7 @@ namespace CalculatorApp
|
|||
constexpr auto EVENT_NAME_MEMORY_FLYOUT_OPEN_BEGIN = L"MemoryFlyoutOpenBegin";
|
||||
constexpr auto EVENT_NAME_MEMORY_FLYOUT_OPEN_END = L"MemoryFlyoutOpenEnd";
|
||||
constexpr auto EVENT_NAME_MEMORY_CLEAR_ALL = L"MemoryClearAll";
|
||||
constexpr auto EVENT_NAME_INVALID_INPUT_PASTED = L"InvalidInputPasted";
|
||||
constexpr auto EVENT_NAME_INVALID_PASTED_INPUT_OCCURRED = L"InvalidPastedInputOccurred";
|
||||
constexpr auto EVENT_NAME_VALID_INPUT_PASTED = L"ValidInputPasted";
|
||||
constexpr auto EVENT_NAME_BITFLIP_PANE_CLICKED = L"BitFlipPaneClicked";
|
||||
constexpr auto EVENT_NAME_BITFLIP_BUTTONS_USED = L"BitFlipToggleButtonUsed";
|
||||
|
@ -81,6 +79,9 @@ namespace CalculatorApp
|
|||
|
||||
constexpr auto EVENT_NAME_EXCEPTION = L"Exception";
|
||||
|
||||
constexpr auto PDT_PRIVACY_DATA_TAG = L"PartA_PrivTags";
|
||||
constexpr auto PDT_PRODUCT_AND_SERVICE_USAGE = 0x0000'0000'0200'0000u;
|
||||
|
||||
#ifdef SEND_TELEMETRY
|
||||
// c.f. WINEVENT_KEYWORD_RESERVED_63-56 0xFF00000000000000 // Bits 63-56 - channel keywords
|
||||
// c.f. WINEVENT_KEYWORD_* 0x00FF000000000000 // Bits 55-48 - system-reserved keywords
|
||||
|
@ -176,7 +177,7 @@ namespace CalculatorApp
|
|||
{
|
||||
iterMap->second.insert(iterMap->second.begin(), L"Programmer");
|
||||
}
|
||||
else
|
||||
else if (isStandard)
|
||||
{
|
||||
iterMap->second.insert(iterMap->second.begin(), L"Standard");
|
||||
}
|
||||
|
@ -199,7 +200,7 @@ namespace CalculatorApp
|
|||
{
|
||||
iterMap->second[memoryPosition] = L"Programmer";
|
||||
}
|
||||
else
|
||||
else if (isStandard)
|
||||
{
|
||||
iterMap->second[memoryPosition] = L"Standard";
|
||||
}
|
||||
|
@ -641,17 +642,17 @@ namespace CalculatorApp
|
|||
LogTelemetryEvent(EVENT_NAME_SINGLE_MEMORY_USED, fields);
|
||||
}
|
||||
|
||||
void TraceLogger::LogInvalidInputPasted(wstring_view reason, wstring_view pastedExpression, ViewMode mode, int programmerNumberBase, int bitLengthType)
|
||||
void TraceLogger::LogInvalidPastedInputOccurred(wstring_view reason, ViewMode mode, int programmerNumberBase, int bitLengthType)
|
||||
{
|
||||
if (!GetTraceLoggingProviderEnabled()) return;
|
||||
|
||||
LoggingFields fields{};
|
||||
fields.AddString(L"Mode", NavCategory::GetFriendlyName(mode)->Data());
|
||||
fields.AddString(L"Reason", reason);
|
||||
fields.AddString(L"PastedExpression", pastedExpression);
|
||||
fields.AddString(L"ProgrammerNumberBase", GetProgrammerType(programmerNumberBase).c_str());
|
||||
fields.AddString(L"BitLengthType", GetProgrammerType(bitLengthType).c_str());
|
||||
LogTelemetryEvent(EVENT_NAME_INVALID_INPUT_PASTED, fields);
|
||||
fields.AddUInt64(PDT_PRIVACY_DATA_TAG, PDT_PRODUCT_AND_SERVICE_USAGE);
|
||||
LogTelemetryEvent(EVENT_NAME_INVALID_PASTED_INPUT_OCCURRED, fields);
|
||||
}
|
||||
|
||||
void TraceLogger::LogValidInputPasted(ViewMode mode) const
|
||||
|
@ -872,6 +873,7 @@ namespace CalculatorApp
|
|||
if (!m_dateDiffUsageLoggedInSession)
|
||||
{
|
||||
LoggingFields fields{};
|
||||
fields.AddUInt32(L"WindowId", windowId);
|
||||
LogTelemetryEvent(EVENT_NAME_DATE_DIFFERENCE_USED, fields);
|
||||
|
||||
m_dateDiffUsageLoggedInSession = true;
|
||||
|
|
|
@ -64,7 +64,7 @@ namespace CalculatorApp
|
|||
void LogMemoryFlyoutOpenBegin(unsigned int) const;
|
||||
void LogDebug(std::wstring_view debugData);
|
||||
void LogMemoryFlyoutOpenEnd(unsigned int) const;
|
||||
void LogInvalidInputPasted(std::wstring_view reason, std::wstring_view pastedExpression, CalculatorApp::Common::ViewMode mode, int ProgrammerNumberBase, int bitLengthType);
|
||||
void LogInvalidPastedInputOccurred(std::wstring_view reason, CalculatorApp::Common::ViewMode mode, int ProgrammerNumberBase, int bitLengthType);
|
||||
void LogValidInputPasted(CalculatorApp::Common::ViewMode mode) const;
|
||||
void UpdateFunctionUsage(int func);
|
||||
void LogFunctionUsage(int);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
// Licensed under the MIT License.
|
||||
|
||||
//
|
||||
|
@ -54,7 +54,7 @@ double Utils::GetDoubleFromWstring(wstring input)
|
|||
return ::atof(inputString.c_str());
|
||||
}
|
||||
|
||||
//returns windowId for the current view
|
||||
// Returns windowId for the current view
|
||||
int Utils::GetWindowId()
|
||||
{
|
||||
int windowId = -1;
|
||||
|
@ -80,20 +80,13 @@ void Utils::RunOnUIThreadNonblocking(std::function<void()>&& function, _In_ Core
|
|||
}
|
||||
}
|
||||
|
||||
// returns if the last character of a wstring is the target wchar_t
|
||||
// Returns if the last character of a wstring is the target wchar_t
|
||||
bool Utils::IsLastCharacterTarget(_In_ wstring const &input, _In_ wchar_t target)
|
||||
{
|
||||
return !input.empty() && input.back() == target;
|
||||
}
|
||||
|
||||
//return wstring after removing characters like space, comma, and double quotes
|
||||
wstring Utils::RemoveUnwantedCharsFromWstring(wstring input)
|
||||
{
|
||||
wchar_t unWantedChars[] = { L' ', L',', L'"', 8234, 8235, 8236, 8237 };
|
||||
return RemoveUnwantedCharsFromWstring(input, unWantedChars, 6);
|
||||
}
|
||||
|
||||
//return wstring after removing characters specified by unwantedChars array
|
||||
// Return wstring after removing characters specified by unwantedChars array
|
||||
wstring Utils::RemoveUnwantedCharsFromWstring(wstring input, wchar_t* unwantedChars, unsigned int size)
|
||||
{
|
||||
for (unsigned int i = 0; i < size; ++i)
|
||||
|
@ -110,7 +103,7 @@ void Utils::SerializeCommandsAndTokens(_In_ shared_ptr<CalculatorVector <pair<ws
|
|||
unsigned int commandsSize;
|
||||
IFTPlatformException(commands->GetSize(&commandsSize));
|
||||
|
||||
// save the size of the commands vector
|
||||
// Save the size of the commands vector
|
||||
writer->WriteUInt32(commandsSize);
|
||||
|
||||
SerializeCommandVisitor cmdVisitor(writer);
|
||||
|
|
|
@ -280,7 +280,6 @@ namespace Utils
|
|||
Platform::String^ GetStringValue(Platform::String^ input);
|
||||
bool IsLastCharacterTarget(std::wstring const &input, wchar_t target);
|
||||
std::wstring RemoveUnwantedCharsFromWstring(std::wstring inputString, wchar_t* unwantedChars, unsigned int size);
|
||||
std::wstring RemoveUnwantedCharsFromWstring(std::wstring input);
|
||||
double GetDoubleFromWstring(std::wstring input);
|
||||
int GetWindowId();
|
||||
void RunOnUIThreadNonblocking(std::function<void()>&& function, _In_ Windows::UI::Core::CoreDispatcher^ currentDispatcher);
|
||||
|
|
|
@ -275,7 +275,7 @@ pair<wstring, wstring> CurrencyDataLoader::GetCurrencyRatioEquality(_In_ const U
|
|||
{
|
||||
double ratio = (iter2->second).ratio;
|
||||
|
||||
// Round the raio to FORMATTER_DIGIT_COUNT digits using int math.
|
||||
// Round the ratio to FORMATTER_DIGIT_COUNT digits using int math.
|
||||
// Ex: to round 1.23456 to three digits, use
|
||||
// ((int) 1.23456 * (10^3)) / (10^3)
|
||||
double scale = pow(10, FORMATTER_DIGIT_COUNT);
|
||||
|
|
|
@ -73,7 +73,7 @@ DateCalculatorViewModel::DateCalculatorViewModel() :
|
|||
|
||||
// Initialize the list separator delimiter appended with a space at the end, e.g. ", "
|
||||
// This will be used for date difference formatting: Y years, M months, W weeks, D days
|
||||
m_listSeparator = ref new String((localizationSettings.GetListSeparator() + L" ").c_str());
|
||||
m_listSeparator = localizationSettings.GetListSeparator() + L" ";
|
||||
|
||||
// Initialize the output results
|
||||
UpdateDisplayResult();
|
||||
|
@ -245,22 +245,23 @@ void DateCalculatorViewModel::InitializeDateOutputFormats(_In_ String^ calendarI
|
|||
|
||||
String^ DateCalculatorViewModel::GetDateDiffString() const
|
||||
{
|
||||
String^ result = L"";
|
||||
wstring result;
|
||||
bool addDelimiter = false;
|
||||
AppResourceProvider resourceLoader = AppResourceProvider::GetInstance();
|
||||
|
||||
auto yearCount = m_dateDiffResult.year;
|
||||
if (yearCount > 0)
|
||||
{
|
||||
result = String::Concat(GetLocalizedNumberString(yearCount), L" ");
|
||||
result += GetLocalizedNumberString(yearCount)->Data();
|
||||
result += L" ";
|
||||
|
||||
if (yearCount > 1)
|
||||
{
|
||||
result = String::Concat(result, resourceLoader.GetResourceString(L"Date_Years"));
|
||||
result += resourceLoader.GetResourceString(L"Date_Years")->Data();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = String::Concat(result, resourceLoader.GetResourceString(L"Date_Year"));
|
||||
result += resourceLoader.GetResourceString(L"Date_Year")->Data();
|
||||
}
|
||||
|
||||
// set the flags to add a delimiter whenever the next unit is added
|
||||
|
@ -272,22 +273,23 @@ String^ DateCalculatorViewModel::GetDateDiffString() const
|
|||
{
|
||||
if (addDelimiter)
|
||||
{
|
||||
result = String::Concat(result, m_listSeparator);
|
||||
result += m_listSeparator;
|
||||
}
|
||||
else
|
||||
{
|
||||
addDelimiter = true;
|
||||
}
|
||||
|
||||
result = String::Concat(result, String::Concat(GetLocalizedNumberString(monthCount), L" "));
|
||||
result += GetLocalizedNumberString(monthCount)->Data();
|
||||
result += L" ";
|
||||
|
||||
if (monthCount > 1)
|
||||
{
|
||||
result = String::Concat(result, resourceLoader.GetResourceString(L"Date_Months"));
|
||||
result += resourceLoader.GetResourceString(L"Date_Months")->Data();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = String::Concat(result, resourceLoader.GetResourceString(L"Date_Month"));
|
||||
result += resourceLoader.GetResourceString(L"Date_Month")->Data();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,22 +298,23 @@ String^ DateCalculatorViewModel::GetDateDiffString() const
|
|||
{
|
||||
if (addDelimiter)
|
||||
{
|
||||
result = String::Concat(result, m_listSeparator);
|
||||
result += m_listSeparator;
|
||||
}
|
||||
else
|
||||
{
|
||||
addDelimiter = true;
|
||||
}
|
||||
|
||||
result = String::Concat(result, String::Concat(GetLocalizedNumberString(weekCount), L" "));
|
||||
result += GetLocalizedNumberString(weekCount)->Data();
|
||||
result += L" ";
|
||||
|
||||
if (weekCount > 1)
|
||||
{
|
||||
result = String::Concat(result, resourceLoader.GetResourceString(L"Date_Weeks"));
|
||||
result += resourceLoader.GetResourceString(L"Date_Weeks")->Data();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = String::Concat(result, resourceLoader.GetResourceString(L"Date_Week"));
|
||||
result += resourceLoader.GetResourceString(L"Date_Week")->Data();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -320,43 +323,45 @@ String^ DateCalculatorViewModel::GetDateDiffString() const
|
|||
{
|
||||
if (addDelimiter)
|
||||
{
|
||||
result = String::Concat(result, m_listSeparator);
|
||||
result += m_listSeparator;
|
||||
}
|
||||
else
|
||||
{
|
||||
addDelimiter = true;
|
||||
}
|
||||
|
||||
result = String::Concat(result, String::Concat(GetLocalizedNumberString(dayCount), L" "));
|
||||
result += GetLocalizedNumberString(dayCount)->Data();
|
||||
result += L" ";
|
||||
|
||||
if (dayCount > 1)
|
||||
{
|
||||
result = String::Concat(result, resourceLoader.GetResourceString(L"Date_Days"));
|
||||
result += resourceLoader.GetResourceString(L"Date_Days")->Data();
|
||||
}
|
||||
else
|
||||
{
|
||||
result = String::Concat(result, resourceLoader.GetResourceString(L"Date_Day"));
|
||||
result += resourceLoader.GetResourceString(L"Date_Day")->Data();
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
return ref new String(result.data());
|
||||
}
|
||||
|
||||
String^ DateCalculatorViewModel::GetDateDiffStringInDays() const
|
||||
{
|
||||
String^ strDateUnit;
|
||||
wstring result = GetLocalizedNumberString(m_dateDiffResultInDays.day)->Data();
|
||||
result += L" ";
|
||||
|
||||
// Display the result as '1 day' or 'N days'
|
||||
if (m_dateDiffResultInDays.day > 1)
|
||||
{
|
||||
strDateUnit = AppResourceProvider::GetInstance().GetResourceString(L"Date_Days");
|
||||
result += AppResourceProvider::GetInstance().GetResourceString(L"Date_Days")->Data();
|
||||
}
|
||||
else
|
||||
{
|
||||
strDateUnit = AppResourceProvider::GetInstance().GetResourceString(L"Date_Day");
|
||||
result += AppResourceProvider::GetInstance().GetResourceString(L"Date_Day")->Data();
|
||||
}
|
||||
|
||||
return String::Concat(GetLocalizedNumberString(m_dateDiffResultInDays.day), String::Concat(L" ", strDateUnit));
|
||||
return ref new String(result.data());
|
||||
}
|
||||
|
||||
void DateCalculatorViewModel::OnCopyCommand(Platform::Object^ parameter)
|
||||
|
|
|
@ -146,7 +146,7 @@ namespace CalculatorApp
|
|||
CalculatorApp::Common::DateCalculation::DateUnit m_daysOutputFormat;
|
||||
CalculatorApp::Common::DateCalculation::DateUnit m_allDateUnitsOutputFormat;
|
||||
Windows::Globalization::DateTimeFormatting::DateTimeFormatter^ m_dateTimeFormatter;
|
||||
Platform::String^ m_listSeparator;
|
||||
std::wstring m_listSeparator;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -291,7 +291,6 @@ void HistoryViewModel::SaveHistory()
|
|||
// this serializes a history item into a base64 encoded string
|
||||
Platform::String^ HistoryViewModel::SerializeHistoryItem(_In_ std::shared_ptr<CalculationManager::HISTORYITEM> const &item)
|
||||
{
|
||||
HRESULT hr = S_OK;
|
||||
DataWriter^ writer = ref new DataWriter();
|
||||
auto expr = item->historyItemVector.expression;
|
||||
auto result = item->historyItemVector.result;
|
||||
|
|
|
@ -41,6 +41,7 @@ namespace CalculatorApp::ViewModel
|
|||
StringReference DisplayValue(L"DisplayValue");
|
||||
StringReference IsInError(L"IsInError");
|
||||
StringReference BinaryDisplayValue(L"BinaryDisplayValue");
|
||||
StringReference OpenParenthesisCount(L"OpenParenthesisCount");
|
||||
}
|
||||
|
||||
namespace CalculatorResourceKeys
|
||||
|
@ -53,6 +54,8 @@ namespace CalculatorApp::ViewModel
|
|||
StringReference OctButton(L"Format_OctButtonValue");
|
||||
StringReference BinButton(L"Format_BinButtonValue");
|
||||
StringReference LeftParenthesisAutomationFormat(L"Format_OpenParenthesisAutomationNamePrefix");
|
||||
StringReference OpenParenthesisCountAutomationFormat(L"Format_OpenParenthesisCountAutomationNamePrefix");
|
||||
StringReference NoParenthesisAdded(L"NoRightParenthesisAdded_Announcement");
|
||||
StringReference MaxDigitsReachedFormat(L"Format_MaxDigitsReached");
|
||||
StringReference ButtonPressFeedbackFormat(L"Format_ButtonPressAuditoryFeedback");
|
||||
StringReference MemorySave(L"Format_MemorySave");
|
||||
|
@ -92,7 +95,9 @@ StandardCalculatorViewModel::StandardCalculatorViewModel() :
|
|||
m_localizedMemorySavedAutomationFormat(nullptr),
|
||||
m_localizedMemoryItemChangedAutomationFormat(nullptr),
|
||||
m_localizedMemoryItemClearedAutomationFormat(nullptr),
|
||||
m_localizedMemoryCleared(nullptr)
|
||||
m_localizedMemoryCleared(nullptr),
|
||||
m_localizedOpenParenthesisCountChangedAutomationFormat(nullptr),
|
||||
m_localizedNoRightParenthesisAddedFormat(nullptr)
|
||||
{
|
||||
WeakReference calculatorViewModel(this);
|
||||
m_calculatorDisplay.SetCallback(calculatorViewModel);
|
||||
|
@ -178,7 +183,6 @@ String^ StandardCalculatorViewModel::CalculateNarratorDisplayValue(_In_ wstring
|
|||
String^ StandardCalculatorViewModel::GetNarratorStringReadRawNumbers(_In_ String^ localizedDisplayValue)
|
||||
{
|
||||
wstringstream wss;
|
||||
RADIX_TYPE radix = static_cast<RADIX_TYPE>(CurrentRadixType);
|
||||
auto& locSettings = LocalizationSettings::GetInstance();
|
||||
|
||||
// Insert a space after each digit in the string, to force Narrator to read them as separate numbers.
|
||||
|
@ -227,6 +231,34 @@ void StandardCalculatorViewModel::SetParenthesisCount(_In_ const wstring& parent
|
|||
}
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::SetOpenParenthesisCountNarratorAnnouncement()
|
||||
{
|
||||
String^ parenthesisCount = ((m_OpenParenthesisCount == nullptr) ? "0" : m_OpenParenthesisCount);
|
||||
wstring localizedParenthesisCount = parenthesisCount->Data();
|
||||
LocalizationSettings::GetInstance().LocalizeDisplayValue(&localizedParenthesisCount);
|
||||
|
||||
String^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(
|
||||
CalculatorResourceKeys::OpenParenthesisCountAutomationFormat,
|
||||
m_localizedOpenParenthesisCountChangedAutomationFormat,
|
||||
localizedParenthesisCount.c_str());
|
||||
|
||||
Announcement = CalculatorAnnouncement::GetOpenParenthesisCountChangedAnnouncement(announcement);
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::OnNoRightParenAdded()
|
||||
{
|
||||
SetNoParenAddedNarratorAnnouncement();
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::SetNoParenAddedNarratorAnnouncement()
|
||||
{
|
||||
String^ announcement = LocalizationStringUtil::GetLocalizedNarratorAnnouncement(
|
||||
CalculatorResourceKeys::NoParenthesisAdded,
|
||||
m_localizedNoRightParenthesisAddedFormat);
|
||||
|
||||
Announcement = CalculatorAnnouncement::GetNoRightParenthesisAddedAnnouncement(announcement);
|
||||
}
|
||||
|
||||
void StandardCalculatorViewModel::DisableButtons(CommandType selectedExpressionCommandType)
|
||||
{
|
||||
if (selectedExpressionCommandType == CommandType::OperandCommand)
|
||||
|
@ -426,50 +458,50 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum)
|
|||
displayExpressionToken->CommandIndex = 0;
|
||||
}
|
||||
|
||||
wchar_t ch;
|
||||
wchar_t ch = 0;
|
||||
if ((cmdenum >= Command::Command0) && (cmdenum <= Command::Command9))
|
||||
{
|
||||
switch (cmdenum)
|
||||
{
|
||||
case Command::Command0:
|
||||
ch = '0';
|
||||
ch = L'0';
|
||||
break;
|
||||
case Command::Command1:
|
||||
ch = '1';
|
||||
ch = L'1';
|
||||
break;
|
||||
case Command::Command2:
|
||||
ch = '2';
|
||||
ch = L'2';
|
||||
break;
|
||||
case Command::Command3:
|
||||
ch = '3';
|
||||
ch = L'3';
|
||||
break;
|
||||
case Command::Command4:
|
||||
ch = '4';
|
||||
ch = L'4';
|
||||
break;
|
||||
case Command::Command5:
|
||||
ch = '5';
|
||||
ch = L'5';
|
||||
break;
|
||||
case Command::Command6:
|
||||
ch = '6';
|
||||
ch = L'6';
|
||||
break;
|
||||
case Command::Command7:
|
||||
ch = '7';
|
||||
ch = L'7';
|
||||
break;
|
||||
case Command::Command8:
|
||||
ch = '8';
|
||||
ch = L'8';
|
||||
break;
|
||||
case Command::Command9:
|
||||
ch = '9';
|
||||
ch = L'9';
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (cmdenum == Command::CommandPNT)
|
||||
{
|
||||
ch = '.';
|
||||
ch = L'.';
|
||||
}
|
||||
else if (cmdenum == Command::CommandBACK)
|
||||
{
|
||||
ch = 'x';
|
||||
ch = L'x';
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -486,7 +518,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum)
|
|||
{
|
||||
// Clear older text;
|
||||
m_selectedExpressionLastData = L"";
|
||||
if (ch == 'x')
|
||||
if (ch == L'x')
|
||||
{
|
||||
temp[0] = L'\0';
|
||||
commandIndex = 0;
|
||||
|
@ -501,7 +533,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum)
|
|||
}
|
||||
else
|
||||
{
|
||||
if (ch == 'x')
|
||||
if (ch == L'x')
|
||||
{
|
||||
if (commandIndex == 0)
|
||||
{
|
||||
|
@ -518,7 +550,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum)
|
|||
}
|
||||
temp[i++] = data[j];
|
||||
}
|
||||
temp[i] = '\0';
|
||||
temp[i] = L'\0';
|
||||
commandIndex -= 1;
|
||||
}
|
||||
else
|
||||
|
@ -526,6 +558,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum)
|
|||
length = m_selectedExpressionLastData->Length() + 1;
|
||||
if (length > 50)
|
||||
{
|
||||
delete [] temp;
|
||||
return;
|
||||
}
|
||||
for (; i < length; ++i)
|
||||
|
@ -537,7 +570,7 @@ void StandardCalculatorViewModel::HandleUpdatedOperandData(Command cmdenum)
|
|||
}
|
||||
temp[i] = data[j++];
|
||||
}
|
||||
temp[i] = '\0';
|
||||
temp[i] = L'\0';
|
||||
commandIndex += 1;
|
||||
}
|
||||
}
|
||||
|
@ -567,7 +600,6 @@ void StandardCalculatorViewModel::OnButtonPressed(Object^ parameter)
|
|||
m_feedbackForButtonPress = CalculatorButtonPressedEventArgs::GetAuditoryFeedbackFromCommandParameter(parameter);
|
||||
NumbersAndOperatorsEnum numOpEnum = CalculatorButtonPressedEventArgs::GetOperationFromCommandParameter(parameter);
|
||||
Command cmdenum = ConvertToOperatorsEnum(numOpEnum);
|
||||
bool isOperator = IsOperator(cmdenum);
|
||||
|
||||
TraceLogger::GetInstance().UpdateFunctionUsage((int)numOpEnum);
|
||||
|
||||
|
@ -748,7 +780,6 @@ void StandardCalculatorViewModel::OnPaste(String^ pastedString, ViewMode mode)
|
|||
bool isFirstLegalChar = true;
|
||||
m_standardCalculatorManager.SendCommand(Command::CommandCENTR);
|
||||
bool sendNegate = false;
|
||||
bool processedExp = false;
|
||||
bool processedDigit = false;
|
||||
bool sentEquals = false;
|
||||
bool isPreviousOperator = false;
|
||||
|
@ -1371,7 +1402,6 @@ ANGLE_TYPE GetAngleTypeFromCommand(Command command)
|
|||
void StandardCalculatorViewModel::SaveEditedCommand(_In_ unsigned int tokenPosition, _In_ Command command)
|
||||
{
|
||||
pair<wstring, int> token;
|
||||
bool fNegative = false;
|
||||
bool handleOperand = false;
|
||||
int nOpCode = static_cast<int>(command);
|
||||
wstring updatedToken = L"";
|
||||
|
@ -1618,7 +1648,7 @@ bool StandardCalculatorViewModel::IsOpnd(int nOpCode)
|
|||
Command::CommandPNT
|
||||
};
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(opnd); i++)
|
||||
for (unsigned int i = 0; i < size(opnd); i++)
|
||||
{
|
||||
if (nOpCode == static_cast<int>(opnd[i]))
|
||||
{
|
||||
|
@ -1649,7 +1679,7 @@ bool StandardCalculatorViewModel::IsUnaryOp(int nOpCode)
|
|||
Command::CommandCUB
|
||||
};
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(unaryOp); i++)
|
||||
for (unsigned int i = 0; i < size(unaryOp); i++)
|
||||
{
|
||||
if (nOpCode == static_cast<int>(unaryOp[i]))
|
||||
{
|
||||
|
@ -1676,7 +1706,7 @@ bool StandardCalculatorViewModel::IsTrigOp(int nOpCode)
|
|||
Command::CommandATAN
|
||||
};
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(trigOp); i++)
|
||||
for (unsigned int i = 0; i < size(trigOp); i++)
|
||||
{
|
||||
if (nOpCode == static_cast<int>(trigOp[i]))
|
||||
{
|
||||
|
@ -1699,7 +1729,7 @@ bool StandardCalculatorViewModel::IsBinOp(int nOpCode)
|
|||
Command::CommandPWR
|
||||
};
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(binOp); i++)
|
||||
for (unsigned int i = 0; i < size(binOp); i++)
|
||||
{
|
||||
if (nOpCode == static_cast<int>(binOp[i]))
|
||||
{
|
||||
|
@ -1733,7 +1763,7 @@ bool StandardCalculatorViewModel::IsRecoverableCommand(int nOpCode)
|
|||
Command::CommandF
|
||||
};
|
||||
|
||||
for (int i = 0; i < ARRAYSIZE(recoverableCommands); i++)
|
||||
for (unsigned int i = 0; i < size(recoverableCommands); i++)
|
||||
{
|
||||
if (nOpCode == static_cast<int>(recoverableCommands[i]))
|
||||
{
|
||||
|
@ -1951,7 +1981,7 @@ void StandardCalculatorViewModel::UpdatecommandsInRecordingMode()
|
|||
}
|
||||
else
|
||||
{
|
||||
//reset all vars
|
||||
// Reset all vars
|
||||
isDecimal = false;
|
||||
isNegative = false;
|
||||
isExpMode = false;
|
||||
|
|
|
@ -36,6 +36,7 @@ namespace CalculatorApp
|
|||
extern Platform::StringReference IsMemoryEmpty;
|
||||
extern Platform::StringReference IsInError;
|
||||
extern Platform::StringReference BinaryDisplayValue;
|
||||
extern Platform::StringReference OpenParenthesisCount;
|
||||
}
|
||||
|
||||
[Windows::UI::Xaml::Data::Bindable]
|
||||
|
@ -290,6 +291,9 @@ namespace CalculatorApp
|
|||
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);
|
||||
void SetHistoryExpressionDisplay(_Inout_ std::shared_ptr<CalculatorVector<std::pair<std::wstring, int>>> const &tokens, _Inout_ std::shared_ptr<CalculatorVector <std::shared_ptr<IExpressionCommand>>> const &commands);
|
||||
void SetParenthesisCount(_In_ const std::wstring& parenthesisCount);
|
||||
void SetOpenParenthesisCountNarratorAnnouncement();
|
||||
void OnNoRightParenAdded();
|
||||
void SetNoParenAddedNarratorAnnouncement();
|
||||
void OnMaxDigitsReached();
|
||||
void OnBinaryOperatorReceived();
|
||||
void OnMemoryItemChanged(unsigned int indexOfMemory);
|
||||
|
@ -337,6 +341,8 @@ namespace CalculatorApp
|
|||
Platform::String^ m_localizedMemoryItemChangedAutomationFormat;
|
||||
Platform::String^ m_localizedMemoryItemClearedAutomationFormat;
|
||||
Platform::String^ m_localizedMemoryCleared;
|
||||
Platform::String^ m_localizedOpenParenthesisCountChangedAutomationFormat;
|
||||
Platform::String^ m_localizedNoRightParenthesisAddedFormat;
|
||||
|
||||
bool m_pinned;
|
||||
bool m_isOperandEnabled;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include <sstream>
|
||||
#include <concrt.h>
|
||||
#include <regex>
|
||||
|
||||
#include <iterator>
|
||||
// C++\WinRT Headers
|
||||
#include "winrt/base.h"
|
||||
#include "winrt/Windows.Foundation.Diagnostics.h"
|
||||
|
|
|
@ -371,12 +371,13 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="ActiveStates">
|
||||
<VisualState x:Name="Active"/>
|
||||
<VisualState x:Name="Normal">
|
||||
<VisualState x:Name="Active">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="normalOutput.FontWeight" Value="Light"/>
|
||||
<Setter Target="normalOutput.FontWeight" Value="SemiBold"/>
|
||||
<Setter Target="normalOutput.IsTextSelectionEnabled" Value="True"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Normal"/>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<ScrollViewer x:Name="textContainer"
|
||||
|
@ -390,7 +391,7 @@
|
|||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="SemiBold"
|
||||
FontWeight="Light"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Text="{TemplateBinding DisplayValue}"
|
||||
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
|
@ -457,12 +458,13 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="ActiveStates">
|
||||
<VisualState x:Name="Active"/>
|
||||
<VisualState x:Name="Normal">
|
||||
<VisualState x:Name="Active">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="normalOutput.FontWeight" Value="Light"/>
|
||||
<Setter Target="normalOutput.IsTextSelectionEnabled" Value="True"/>
|
||||
<Setter Target="normalOutput.FontWeight" Value="SemiBold"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Normal"/>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<ScrollViewer x:Name="textContainer"
|
||||
|
@ -476,7 +478,7 @@
|
|||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="SemiBold"
|
||||
FontWeight="Light"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Text="{TemplateBinding DisplayValue}"
|
||||
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
|
@ -544,12 +546,13 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="ActiveStates">
|
||||
<VisualState x:Name="Active"/>
|
||||
<VisualState x:Name="Normal">
|
||||
<VisualState x:Name="Active">
|
||||
<VisualState.Setters>
|
||||
<Setter Target="normalOutput.FontWeight" Value="Light"/>
|
||||
<Setter Target="normalOutput.FontWeight" Value="SemiBold"/>
|
||||
<Setter Target="normalOutput.IsTextSelectionEnabled" Value="True"/>
|
||||
</VisualState.Setters>
|
||||
</VisualState>
|
||||
<VisualState x:Name="Normal"/>
|
||||
</VisualStateGroup>
|
||||
</VisualStateManager.VisualStateGroups>
|
||||
<ScrollViewer x:Name="textContainer"
|
||||
|
@ -563,7 +566,7 @@
|
|||
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
|
||||
Foreground="{TemplateBinding Foreground}"
|
||||
FontSize="{TemplateBinding FontSize}"
|
||||
FontWeight="SemiBold"
|
||||
FontWeight="Light"
|
||||
AutomationProperties.AccessibilityView="Raw"
|
||||
Text="{TemplateBinding DisplayValue}"
|
||||
TextAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||
|
|
Before Width: | Height: | Size: 391 B After Width: | Height: | Size: 384 B |
Before Width: | Height: | Size: 513 B After Width: | Height: | Size: 484 B |
Before Width: | Height: | Size: 806 B After Width: | Height: | Size: 728 B |
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 456 B After Width: | Height: | Size: 441 B |
Before Width: | Height: | Size: 487 B After Width: | Height: | Size: 470 B |
Before Width: | Height: | Size: 532 B After Width: | Height: | Size: 511 B |
Before Width: | Height: | Size: 557 B After Width: | Height: | Size: 503 B |
Before Width: | Height: | Size: 683 B After Width: | Height: | Size: 634 B |
Before Width: | Height: | Size: 485 B After Width: | Height: | Size: 296 B |
Before Width: | Height: | Size: 524 B After Width: | Height: | Size: 331 B |
Before Width: | Height: | Size: 577 B After Width: | Height: | Size: 390 B |
Before Width: | Height: | Size: 690 B After Width: | Height: | Size: 484 B |
Before Width: | Height: | Size: 996 B After Width: | Height: | Size: 728 B |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 453 B After Width: | Height: | Size: 262 B |
Before Width: | Height: | Size: 474 B After Width: | Height: | Size: 284 B |
Before Width: | Height: | Size: 491 B After Width: | Height: | Size: 303 B |
Before Width: | Height: | Size: 505 B After Width: | Height: | Size: 311 B |
Before Width: | Height: | Size: 558 B After Width: | Height: | Size: 370 B |
Before Width: | Height: | Size: 630 B After Width: | Height: | Size: 445 B |
Before Width: | Height: | Size: 665 B After Width: | Height: | Size: 471 B |
Before Width: | Height: | Size: 707 B After Width: | Height: | Size: 506 B |
Before Width: | Height: | Size: 737 B After Width: | Height: | Size: 507 B |
Before Width: | Height: | Size: 867 B After Width: | Height: | Size: 639 B |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 371 B After Width: | Height: | Size: 180 B |
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 384 B After Width: | Height: | Size: 193 B |
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 235 B After Width: | Height: | Size: 234 B |
Before Width: | Height: | Size: 421 B After Width: | Height: | Size: 231 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.4 KiB |
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.4 KiB |