Commit Graph

393 Commits

Author SHA1 Message Date
Rudy Huyn
c877b0a2e9 Replace AppChromeAcrylicHostBackdropMediumLowBrush from OverflowTextBlock + improvements (#647)
* replace acrylic brush by margin/padding

* Modify how the control manages the focus

* remove comment

* Prevent deadlock
2019-09-05 11:01:58 -07:00
Stephanie Anderl
98908c627f
Updated Win UI to 2.2 for Calculator and CalcViewModel projects (#658) 2019-09-05 10:23:35 -07:00
Pepe Rivera
6b8a83a2f9
Remove ProgModeRadixChange unload (#641) 2019-09-04 14:20:58 -07:00
Rudy Huyn
41e2e97591 Optimize BitFlipPanel to suppress flicker when users switch between bit lengths (#640)
* Optimize BitFlipPanel

* remove namespace in cpp file

* improve localization + add tests

* add helper to compare ivector

* Modify how the control manages AutomationProperties::Name
2019-08-26 09:31:13 -07:00
Rudy Huyn
eb24c085bc General improvement of the title bar for Always-On-Top. (#634)
* Make sure TitleBar takes into account the AOT mode change

* remove namespaces in cpp files

* code linting

* use macro for IsAlwaysOnTop and make IsAlwaysOnTop/DisplayNormalAlwaysOnTopOption read-only

* Fix FontWeight
2019-08-23 13:42:00 -07:00
Matt Cooley
5b2d976e64 Remove colorize and fullcolor app list icons (#644) 2019-08-21 15:40:01 -07:00
Rudy Huyn
71b010483b Remove unused expression item template selector (#623)
* remove unused AlwaysOnTopExpressionItemTemplateSelector

* replace incorrect ThemeResource by StaticResource references
2019-08-20 12:55:49 -07:00
Rudy Huyn
5966503703 Fix regression bug with application title no longer grayed out. (#632)
Move back the VisualStateManager node to the root XAML element to fix visual states of the titlebar.

### How changes were validated:
- Manually

Fixes #631
2019-08-19 16:34:49 -07:00
Wei (Waley) Zhang
1c9755d38a Adds zoom buttons to graph controls (#637) 2019-08-16 16:11:43 -07:00
David Shoemaker
c1efa3d3e3 Adding share functionality to Graphing Calculator (#601)
* Plumebd with data transfer

* Getting mainpage to talk to getbitmap.  moving share callbacks from mainpage to graphingcalculator

* Trying to get bitmap from renderer.

* work

* Share worked

* cleanups

* Cleanups progressing

* Share working, need loc for title string and user notification incase of a failure.  Then add the equations key.

* More cleanup, now using share icon image and resources for strings.  Still need to do the graph equation key.

* Change share to html based start.

* Key working, with UL but going to try changing to table.

* Fix a html formating error, generating a new UL for each equation.

* Switched over to a table for equation key and have color block formating

* Updates from PR feedback, using Graphing::IBitmap abstraction.

* Update src/Calculator/Views/GraphingCalculator/GraphingCalculator.xaml.h

Fixed

Co-Authored-By: Pepe Rivera <joseartrivera@gmail.com>

* PR Updates.

* Add variables to the graph key.

* PR Updates.
2019-08-13 12:57:13 -07:00
Matt Cooley
24d997dd00
Update localized strings 2019-08-08 (#636) 2019-08-08 18:37:05 -07:00
Wei (Waley) Zhang
672e88187b Fixes Always-on-Top crashes (#626) 2019-08-06 19:52:19 -07:00
Howard Wolosky
c994e49279
Prevent Dev title from showing up on Store builds (#627)
Commit 0722781fc updated the app to use `DevAppName` for the
app's window title when it was a non-official build, based on
the state of `IsStoreBuild`.

Unfortunately, `IsStoreBuild` is a _project_ level variable defined in
[build-app-internal.yaml](0722781fc6/build/pipelines/templates/build-app-internal.yaml (L36)),
but not a _compile-time_ defined value.

To solve this, we are now defining `IS_STORE_BUILD` in
`Calculator.vcxproj` when `IsStoreBuild='True'`, the same way that
we set `SEND_DIAGNOSTICS` for official builds, and we'll change the
window title based on that new `#define`.

Using this new `#define` can lead us down a slippery slope.  We need to
limit the amount of divergent code that we have between dev/official
builds.  This should be hopefully one of very few instances where
this value is ever used.
2019-08-06 16:32:13 -07:00
Rudy Huyn
a7d668e568 Fix the thumbprint of the certificate in the vcxproj file (#617) 2019-08-03 14:22:11 -07:00
Rudy Huyn
cc8491a3d7 Currency rate: always display minimum 4 significant decimals or 2 trailing zeros if the number is integer (#256)
* Currency rate: Compute how many decimals we need to display two meaningful digits at minimum

* formatting

* nit

* Increase the number of meaningfull digits (2->4)

* Revert "Increase the number of meaningfull digits (2->4)"

This reverts commit 9ad93e0d591a386e3e229e09b39a58158d544069.

* Rename constants

* modify FORMATTER_RATE_* values

* format CurrencyConverterUnitTests.cpp
2019-08-01 15:07:27 -07:00
Wei (Waley) Zhang
796d171960 Always-on-Top mode implemented (#579) 2019-07-30 17:53:39 -07:00
Seulgi Kim
af8322617f Restore user preferences (#456)
### Description of the changes:
**1) Do not set units to default values if they already have valid values** 
This fixes the actual issue. `UnitConverter::InitializeSelectedUnits()` ( this function resets all units to their default units if available for the current category ) gets called after `UnitConverterViewModel::RestoreUserPreferences()` ( this function restores user preferences ).
So Calculator has been restoring saved values, and then overriding the restored values with default values.
I modified `InitializeSelectedUnits()` so that we only initialize units only when they are not already set to valid units for the current category.

**2) Removed `m_isFirstTime`** 
I noticed that we are calling `RestoreUserPreferences()`  twice when Calculator starts up, and the function is restoring the same value both times

The below happens when Calculator starts up
1) On startup, in `UnitConverterViewModel::InitializeView()`, `RestoreUserPreferences()` is called.
2) `RestoreUserPreferences()` in turn triggers `OnUnitChanged()`
3) During the first call to `OnUnitChanged()`, m_IsFirstTime is `True`, so we call `RestoreUserPreferences()` again while also setting `m_IsFirstTime` to `False`. 
4) `RestoreUserPreference()` again triggers `OnUnitChanged()`
5) During the second call to `OnUnitChanged()`,  m_IsFirstTime is `False`, so we call `SaveUserPreferences()`

I think we should only call `SaveUserPreferences()` inside `OnUnitChanged()` since we already restored user preferences during view initialization. I can't really think of a reason to restore units after view has been initialized. This led me to just delete `m_isFirstTime`.


### How changes were validated:
Manually tested that units and the current category are properly selected when you quit and start Calculator.

![GifMaker_20190414182150911](https://user-images.githubusercontent.com/3166423/56102706-88f73400-5ee3-11e9-8bbf-7a0c8e051a5c.gif)

![GifMaker_20190414183403644](https://user-images.githubusercontent.com/3166423/56102763-f0ad7f00-5ee3-11e9-99ef-3b932f587393.gif)

## Fixes #445.
2019-07-29 09:39:19 -07:00
Stephanie Anderl
8106691d7c
Fixed issue where UI Responsive events were not fired (#603)
* Fixed the WindowIdLog so that it is updated when a new WindowCreated event is fired

* Updated the windowidlog check in LogWindowCreated to use IsWindowIdInLog
2019-07-26 11:51:01 -07:00
Michał Janiszewski
60c5c39ee5 Fix #563: Odd dependency cycle (#570)
There is an odd dependency in CalcEngine.

`CalculatorManager` inherits `ICalcDisplay` and implements a set of virtual calls it exposes, in particular `SetPrimaryDisplay`.
2517854836/src/CalcManager/Header%20Files/ICalcDisplay.h (L13)

When setting a mode in `CalculatorManager`, e.g. 2517854836/src/CalcManager/CalculatorManager.cpp (L208)
`this` (here: an instance of `CalculatorManager`) gets passed as an argument to the newly created `CCalcEngine` as `ICalcDisplay` pointer and the engine is stored as `unique_ptr` member field of `CalculatorManager`.

In the destructor of `CalculatorManager`, a single function is called, `MemorizedNumberClearAll` which then invokes `ProcessCommand(IDC_MCLEAR)` on current engine, gets passed on to `CCalcEngine::ProcessCommandWorker`, to `DisplayNum`, to `CCalcEngine::SetPrimaryDisplay` and finally to `m_pCalcDisplay->SetPrimaryDisplay`, but here `m_pCalcDisplay` _was_ the instance of `CalculatorManager` that just got its destructor called.

2517854836/src/CalcManager/CalculatorManager.cpp (L46)
2517854836/src/CalcManager/CalculatorManager.cpp (L475)
2517854836/src/CalcManager/CEngine/scicomm.cpp (L87)
2517854836/src/CalcManager/CEngine/scicomm.cpp (L133)
2517854836/src/CalcManager/CEngine/scidisp.cpp (L124)
2517854836/src/CalcManager/CEngine/scicomm.cpp (L837)

It will likely differ by implementation on how exactly, but the [standard suggests](http://eel.is/c++draft/class.cdtor#4) that will invoke the pure virtual `ICalcDisplay::SetPrimaryDisplay`. In case of GCC I believe the vtable is already destroyed by the time you enter dtor's body.

There appears to be no reason to call `MemorizedNumberClearAll` in `CalculatorManager::~CalculatorManager()` because the calc manager and all its engines are going down anyway.  Therefore, removing the call (and thus, the destructor which would then be empty).


Fixes #563: Odd dependency cycle
2019-07-25 23:24:12 -07:00
Tanuja Kirthi Doddapaneni
0722781fc6 Modifying the title of the window to "Calculator [Dev]" (#531)
* Modifying the title of the window to "Calculator [Dev]" when the build isn't configured with `IsStoreBuild`

Fixes #439
2019-07-25 23:02:37 -07:00
Pepe Rivera
46f11c7c72
Add variable editing (#581) 2019-07-24 11:23:33 -07:00
Stephanie Anderl
bb027aa9c3
Added Input pasted event and added to all modes (#593) 2019-07-18 11:21:35 -07:00
Matt Cooley
01cfe6dd89
Fix 32-bit build (#588) 2019-07-17 19:00:19 -07:00
Stephanie Anderl
a6384269bc Updated Calculator diagnostic data collection per the specification (#572)
- Removed unneeded diagnostic events and code
- Added and consolidated events into the events defined in the spec
2019-07-17 18:09:39 -07:00
Rudy Huyn
2ff7bb4089 Unit Converter - Calculate the rounding precision of results based on the source (#498)
* precisely calculates the number of digits of the source and compute the number of significant digits of the result based on that.

* fix unit test

* Fix warning C4267

* Optimize how we calculate the number of digits in the integer part and don't trim the value when used by the currency converter

* modify GetNumberSignificantDigits

* fix CI error

* Access to wstring::npos from static calls

* Move UnitConverter static methods related to number to NumberFormattingUtils

* rename namespace

* Add comment and fix typo

* Move standard headers
2019-07-16 17:00:57 -07:00
Rudy Huyn
23550f751c Make History and Memory list items context menu accessible using keyboard (#432)
* Move History and Memory context menus to ListViewItemContainer so users can open them with keyboards

* replace static_cast by dynamic_cast
2019-07-16 14:24:27 -07:00
pi1024e
5b59bdcb60 Removed need for trimIdx and fDigitsFound, resulting in less code. (#576)
Having an extra integer variable to hold onto an i or i-1 value is inefficient, for "if (m_token.at(i) != chZero)", the code under "fDigitsFound" will always run, so it makes sense to put the fDigitsFound code under the if statement, which can return from the function entirely instead of breaking.

### How changes were validated:
- Manual Testing verified the code having identical behavior as before, with no side effects.
2019-07-16 14:53:34 -05:00
Rudy Huyn
a35a030683 Use the current locale to sort country names (#259) 2019-07-16 11:44:12 -07:00
Stephanie Anderl
a418777f02
Merge master into feature/GraphingCalculator branch (#585)
* Merge master into feature/GraphingCalculator branch
2019-07-15 11:17:21 -07:00
Nicholas Baron
c3d3581240 Applying NR 1 to CalculatorVector.h (#491)
Applied [NR 1](https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#Rnr-top) from the ISO C++ Guidelines to CalculatorVector.h

### Description of the changes:
- Move towards understandable and maintainable code
2019-07-11 12:46:13 -05:00
Rudy Huyn
2a5a52d44d Date difference: display the difference in days (only) when we aren't able to calculate the difference in days/weeks/months.. (#555)
* Display date difference in days if can't display in days/weeks/months/...

* add comments

* remove not used variable totalDaysDiff

* improve UpdateDisplayResult

* Display error message when the calculator can't calculate the difference between 2 dates
2019-06-30 18:22:29 -07:00
Howard Wolosky
25708f0bef
Ensure consistent margins/padding with currency converter keypad (#566)
Simplifies the layout of `ConverterNumPad` to match that
seen of `NumpadPanel` in Calculator.xaml by using the same
static margin and removing the use of columns that had been used
for dynamic margins.

Fixes #87
2019-06-28 15:45:43 -07:00
Matt Cooley
b3432c93c8
Update to SDK 18362 (#568) 2019-06-27 09:53:06 -07:00
Rudy Huyn
cb5dfdda7b Modify ClipTime to adjust to local time before clipping (#558) 2019-06-26 16:17:47 -07:00
Pepe Rivera
1475b49120
Create EquationTextBox control (#547) 2019-06-25 13:40:56 -07:00
Matt Cooley
499e29933c
UI tests should be able to test both dev and store-released builds (#567)
Fixes #462

- Add x64 and x86 UI tests to the release builds (internal builds for the store)
- UI tests now accept the target app ID as a parameter in the runsettings file
2019-06-25 11:29:32 -07:00
Matt Cooley
33b885ac17
Update to v142 build tools for Visual Studio 2019 (#548)
* Update to build tools v142
* Update official build pipelines to use VS2019
* Update instructions to suggest updating to VS2019
2019-06-24 16:38:45 -07:00
Stephanie Anderl
2517854836 Added Calculator Standard Mode UI Tests (#501)
- Added the CalculatorUIFramework to handle the WinAppDriver logic.
- Added Standard Mode smoke tests and BVTs to the CalculatorUITests project.
- Removed old UI tests that did not use the CalculatorUIFramework
2019-06-21 14:54:36 -07:00
Stephanie Anderl
c3c001af28
Updating GraphingInterfaces to use Graphing Engine 2.0 (#561)
* Updated Graphing Interfaces to version 2.0.1
2019-06-21 13:17:39 -07:00
Michał Janiszewski
e9551e3774 Ensure gldPrevious is scoped to its own translation unit (#556) 2019-06-18 13:05:18 -07:00
Michał Janiszewski
711b37f0bc Add missing override/final to CalculatorManagerDisplayTester (#551) 2019-06-18 13:02:39 -07:00
Michał Janiszewski
841906a4ed Update comment in scicomm.cpp (#549)
While reading this part of code I had hard time understanding the
comment, especially the misused `serious`. I tried rewording it
slightly.
2019-06-17 17:15:35 -07:00
Michał Janiszewski
da9f4ea856 Fix type of m_openParenCount (#550)
m_openParenCount is always used as unsigned and compared against unsigneds
2019-06-17 17:10:15 -07:00
Peter Tissen
dab589b3e0 Handle date difference for ends of months (#553)
The incrementally calling `Window::Globalization::Calendar::AddMonths`
resulted in a negative value for `GetDifferenceInDays` which was then
assigned to an unsigned variable `daysDiff`.

One example of the issue when running the calculator in UTC+2 was the
difference between July 31st and December 30th.

The initial guess was 4 months which then landed on November 30th.
This date was stored and then in the loop incremeted by one month.
This then landed precisely on the end date December 30th.
After the loop the final value is then used July 31st + 5 months
which results in the 31st of December.
The resulting difference of -1 days is then assigned to the unsigned
value `daysDiff`.

This commit makes the minimal changes to remedy this bug.
It makes sure to only ever call `AddMonths` with the same starting date
instead of incrementally to different dates.

fixes #552
2019-06-17 16:05:31 -07:00
David Kheri
1ee438ddaf Bound the calendar picker to the control above (#507)
* Bound the calendar picker to the control above

* collapsed textbox and added headertext to the calendar picker element

* collpased textbox from both To and From calendar picker used headertext instead

* localized strings for the new headers added for the calendar date pickers

* modified the resoruces file so as to localize the strings

* remapped the grid components after the removal of the text Block

* restored original spacing between components
2019-06-14 18:41:02 -07:00
Wei (Waley) Zhang
7276b5c7ce Fixes bug #483 by setting AccessibilityView property to Raw for hidden units
* Fixes bug #483 by setting AccessibilityView property to Raw for hidden units
2019-06-12 17:37:19 -07:00
Michał Janiszewski
81aec1ebe8 Drop __inline from conflicting declarations (#545)
`mulnum` et al. are declared `extern` in `ratpak.h`, which conflicts
with the `__inline` used with them. Additionally, most similar functions
don't have such keyword applied to them.
2019-06-10 14:36:05 -07:00
Michał Janiszewski
fe30c7cabc Add CMake project, GCC support (#540)
This is extract from #211 that enables compilation with GCC. With #211
now in the state of bitrot, I would rather try approaching it in smaller
steps that can be hopefully merged quicker, even if it does not provide
full support for all the features #211 provided.

This will _compile_ correctly with my (@janisozaur) GCC, but clang is
more picky about flexible array members and refuses to compile it yet.
I will extract remaining parts of #211 in future PRs.

I marked @fwcd as author, as he did most of the work in #211.
2019-06-06 14:08:31 -07:00
Pepe Rivera
6e3fe90eb5
Wrap json parsing in try/catch (#534) 2019-06-03 13:58:37 -07:00
Pepe Rivera
2b17f82652 Migrate currency converter endpoints (#524)
We are migrating the REST endpoint that Currency Converter uses. The REST endpoint is not licensed for your use. To continue to enable community participation in the development of the feature, developer builds will use an alternate REST endpoint that serves mock data (clearly identifiable as it references planets instead of countries).
2019-05-31 12:55:06 -07:00
Matt Cooley
2fd8dc1f9d
Update localized strings 2019-05-24 (#521) 2019-05-24 10:41:42 -07:00
Northurland
d4028cda95 Force compiler to use utf-8 so the project compiles on systems in Chinese (#516) 2019-05-22 10:16:17 -07:00
MelulekiDube
00f0f25dfc Added the name property for CalculationResult right/left scroll buttons on screen (#503)
* Added the property name to be shown on the Scrollable links to solve issue 482

* Added the x:uid tag for the buttons and also added the automationID

* Added two new uids keys for the left and right scroll buttons for the calculation result.
2019-05-17 15:54:34 -07:00
Mahdi Ghiasi
9b920f0d86 Removed entrance transition for about button in NavigationView (#506) 2019-05-17 11:10:28 -07:00
Rudy Huyn
9f47fe3fc8 Fix unit tests to run on non-english devices (#289)
* Force en-US for unit tests

* fix some spacing issues after merge

* remove default argument of LocalizationService to fix compilation issue in Release mode
2019-05-14 09:57:58 -07:00
Mahdi Ghiasi
860d6d3eb2 Removed GroupName from JumpList so items can't be pinened or removed by user. (#499)
https://stackoverflow.com/a/39436591/942659
2019-05-13 17:01:28 -07:00
Rudy Huyn
d8cb5c82a8 Keep spaces when users copy an error message (#430)
Verify if the StandardCalculatorViewModel::DisplayValue isn't an error message before removing group separators (including space character).

How changes were validated:
Tested in english and french
Tested with "Cannot divide by zero" and "Result is undefined"

Fixes #420
2019-05-10 22:55:15 -04:00
Matt Cooley
c568ec787e
Update localized strings 2019-05-09 (#496) 2019-05-09 16:13:32 -07:00
Rudy Huyn
28888d8df1 Remove Serialize/Deserialize functions never used in StandardCalculatorViewModel, UnitConverter, UnitConverterViewModel and CalculatorManager (#392)
* remove unused serializer

* remove all unused serialization/deserialization from StandardCalculatorViewModel and UnitConverterViewModel

* formatting
2019-05-09 11:01:43 -07:00
Rudy Huyn
750130c2bc Accept exponential numbers without -/+ sign. (#270)
* add exponential without sign support

* Add unit tests

* fix formatting

* remove extra spaces

* modify unit tests
2019-05-09 10:10:17 -07:00
Daniel Belcher
9f01c8168b
Secondary formatting changes (#489)
Description of the changes:
Adjusted some of the values in .clang-format
Add clang-format-all.ps1
Fix path to .clang-format in Calculator.sln

How changes were validated:
Manual.
2019-05-02 16:48:33 -07:00
Oleg Abrazhaev
2826d37056 Fix the project code style, as it is not consistent. (#236)
Fixes #202
This PR fixes code style for the project files.

The Problem
Different files in the project use different code style. That is not consistent and leads to harder maintenance of the project.

Description of the changes:
Have investigated and determined the most used code style across the given codebase
Have configured IDE and applied code style to all project files.
Have crafted clang-formatter config.
see https://clang.llvm.org/docs/ClangFormat.html
https://clang.llvm.org/docs/ClangFormatStyleOptions.html
Some cases were fixed manually
How changes were validated:
manual/ad-hoc testing, automated testing

All tests pass as before because these are only code style changes.
Additional
Please review, and let me know if I have any mistake in the code style. In case of any mistake, I will change the configuration and re-apply it to the project.
2019-05-02 11:59:19 -07:00
Pepe Rivera
c77f1de84c
Update winui to 2.1 (#484) 2019-05-01 09:26:30 -07:00
Eric Wong
32aaa0d7e1
fixes #471 (#481)
Expand fix for ja era to handle months and days
2019-04-30 12:26:05 -07:00
Rudy Huyn
9728ccf119 Fix bug when the negate sign is before a space (#345)
* Ignore None characters while parsing the clipboard

* reformat
2019-04-26 16:07:14 -07:00
Hassan Uraizee
8e1a14793a Added WinAppDriver UI Tests to the Calculator Project. (#411) 2019-04-25 16:54:36 -07:00
Eric Wong
1dee9dc984
Fix #471 (#473)
[JaEra] Calc: subtracting 1-year from date during Reiwa 1 yields unexpected results.
2019-04-24 13:37:49 -07:00
Eric Wong
2a29947a28 Collapse CurrencySecondaryStatus when no text is present in the text block (#467)
Fixes #313
In Scan/Item mode, Narrator focus navigates to hidden element “No next item” after “Update rates” link in "Currency Converter" window #313

Description of the changes:
Adds an x:Name to the CurrencySecondaryStatus text block
Adds a NormalCurrencyStatus visual state to the CurrencySecondaryStatusStates
Adds functionality to the CurrencySecondaryStatusStates to show or hide the CurrencySecondaryStatus text block.

How changes were validated:
Verified that the textblock is not visible in the accessibility tree via inspect.exe from the windows sdk.
Verified that Narrator also does not stop on the block when in scan mode.
Verified that the textblock is visible in the accessibility tree and read out in Narrator when the ChargesMayApplyCurrencyStatus or FailedCurrencyStatus viewstates are set.
2019-04-22 17:30:59 -07:00
Nicholas Baron
cdd2b1c8ad Updates to copypastemanager (#390)
Related to #55 and #64
Description of the changes:
Added constexpr to formerly static const or #define variables
Applied C++ Core Guideline NR.2
Added auto and const in appropriate places

How changes were validated:
Used the provided unit tests
2019-04-22 16:59:13 -07:00
Daniel Belcher
5ffe1bc858
Add Pan/Zoom support for the graph surface (#458)
Description of the changes:
Add Pan/Zoom support for the graph surface.
Currently only supports Mouse/Pen/Touch interactions. Keyboard support will be added separately.

How changes were validated:
Manual
2019-04-22 14:29:57 -07:00
cheezwhines
fab21191e2 Clicking on the same element in the hamburger view should re-open that view, like the menu items do (#447)
Fixes #437.
Clicking on the same element in the hamburger view should re-open that view, like the menu items do

Description of the changes:
-Fixed the bug that was listed

How changes were validated:
-manual
2019-04-19 18:59:10 -07:00
Rudy Huyn
bd04c92c1c Simplify title bar (#442)
Fixes #407 (partially) and #441

Description of the changes:
Remove TitleBarHelper and all <Border x:Name="CustomTitleBar" />
Let the system defines the draggable region
Centralize all events and functions associated to the title bar in a single control TitleBar instead of code splitted between MainPage/TitleBar/HistoryList/Memory.
Use the standard title bar when high contrast is activated instead of the custom one.
Modify the color of the title when the window doesn't have focus
Fix the right padding of the title bar with high contrast

How changes were validated:
Manually tested with LtR and RtL languages
Manually tested with high contrast
Tested when History and Memory flyout are opened
2019-04-19 18:49:08 -07:00
Rudy Huyn
0d31d5a5a2 Fix UI issues with UnitConverter in RtL (#410)
Fix #409 - Some content in Currency Converter not right-aligned properly in RtL
Fix #59 Currency symbol precedence is opposite of system setting in RTL languages

Description of the changes:
Add a property FlowDirectionHorizontalAlignment in UnitConverter to align some controls to the right (without modifying the FlowDirection of their parent items)
Force FlowDirection of Value1Container and Value2Container to LeftToRight (but align panels to the right)

How changes were validated:
Tested with LtR and RtL languages and with currency symbols on the left and on the right.
2019-04-19 18:37:50 -07:00
Eric Wong
43b2d4e536 Fix test code that never executes (#465)
Fixes #175.
Fixes loop in test code to verify that commands not supported by the unit converter viewmodel result in no-op.

Description of the changes:
Removed loop of range of enums with a being tested for no-ops since it added no intrinsic value (and the way that the range was handled was incorrect).  Considered adding an iterator over a static list of commands to validate against, but determined it didn't add any notable value.

How changes were validated:
Ran modified test to ensure it passes
2019-04-18 17:05:44 -07:00
Lance McCarthy
8520d3fc74 Refactored XAML x:Names (#433)
Description of the changes:
-Refactored all x:Names to use the generally accepted Pascal-Casing

How changes were validated:
Unit Tests
Manual Tests
2019-04-18 16:01:47 -07:00
Rudy Huyn
de65db6197 Decrease CPU usage of OverflowTextBlock + optimization (#403)
Fixes #402 and #414
Divide by 4 the CPU usage of OverflowTextBlock when buttons are pressed very quickly.

Description of the changes:

Xaml-side:
OverflowTextBlock has some performance issues:
double scrollviewer: the listview was in a scrollviewer, while the control already containing one -> it breaks the virtualization of the listview and impacts on UI performance.
The listview used a StackPanel, this panel doesn't support virtualization of ListViewItems contrary to ItemsStackPanel

No ListView-specific features were used, an ItemsControl is more efficient and lighter.
refactor how we manage the visibility of the left/right buttons in OverflowTextBlock, the new version is more reactive and will not display the right arrow when not necessary (see GIF below).
remove the ItemContainerSelector ExpressionItemContainerStyle, not really used by OverflowTextBlock

remove UI glitches generated by ChangeView when users type fast (control partially hidden and scrolling issues, see the GIF below).
only modify the accessibility view when it's necessary

ViewModel-side:
stop fully refreshing ExpressionTokens in StandardCalculatorViewModel when a new command were sent, instead, use a IObservableVector to only send new tokens to the UI (in average only 1 or 2 UI items are refreshed while the full expression was refreshed before)

How changes were validated:
Manually
2019-04-18 15:21:33 -07:00
Daniel Belcher
d21a47d5a1
Compile CalcManager project with or without precompiled headers (#436)
Fixes #324 .

Description of the changes:
In an effort to support other compilers (#109), this change reworks how precompiled headers are handled. For toolchains where precompiled headers are not used, there is unnecessary compilation cost because each source file explicity includes the pch, meaning all system headers in the pch were recompiled for each translation unit. This change modifies the project's files so that each translation unit includes a minimal set of dependent headers. For MSVC users, the precompiled headers option is still enabled and the precompiled header is added to each translation unit using the compiler's Forced Includes option. The end result is that MSVC users still see the same build times, but other toolchains are free to use or not use precompiled headers.

Risks introduced
Given that our CI build uses MSVC, this change introduces the risk that a system header is added to the pch and the CalcManager project builds correctly, but builds could be broken for other toolsets that don't use pch. We know we want to add support for Clang in our CI build (#211). It seems reasonable to also compile without precompiled headers there so that we can regression test this setup.

How changes were validated:
Rebuild CalcManager project. Compile time: ~4.5s.
Disable precompiled headers, keeping explicit include for pch in each source file. Compile time: ~13s.
Remove explicit pch inclusion and add the appropriate headers to each translation unit to allow the project to compile. Compile time: ~8s.
Re-enable pch and include it using the Forced Includes compiler option. MSVC compile time: ~4.5s.
Minor changes
Delete 'targetver.h'. I found this while looking around for system headers in the project. It's unused and unreferenced so let's remove it.
2019-04-17 17:28:45 -07:00
Seulgi Kim
853704c1c2 Add support for Pyeong, a Korean floorspace unit. (#444)
Fixes #382
Description of the changes:
Add Pyeong as an Area conversion unit.
Pyeong shows up only if the user's current region is Korea ( i.e. region is either KP or KR ).
Added Korean translation for Pyeong (평). For other locales, we default to English ( Pyeong ).
How changes were validated:
Manually tested the below

For non-Korean regions, Pyeong does not show up.

Korean region with Korean locale => Pyeong shows up and Pyeong is correctly translated.
pyeong_Korean

Korean region with English locale => Pyeong shows up and Pyeong is in English.
pyeong_English

Korean region with simplified Chinese locale => Pyeong shows up and Pyeong is in English.
pyeong_Chinese
2019-04-16 17:53:08 -07:00
jatinkumar
c150cd4ece Removed AppBar, OperatorTextBox and OperandTextBox controls (#440)
Fixes #407 
Removed AppBar, OperatorTextBox and OperandTextBox controls
2019-04-16 17:46:07 -07:00
Rudy Huyn
7a7ceb5888 Modify how modulo is calculated in Normal and Scientific mode. (#412)
## Fixes #111

> The modulo operator on this calculator gives the result that is different to the most used calculators.

The current `modrate` function is the equivalent of rem(...)/remainder(...), not mod(...)/modulo(...) available in some popular Math apps. 

### Description of the changes:
- rename `modrate` in `remrate` to be more accurate.
- add `modrate`, calculating modulo similarly to Matlab, Bing, Google calculator, Maxima, Wolfram Alpha and Microsoft Excel 
- Add `RationalMath::Mod` using `modrate` as an alternative to `Rational::operator%` using `remrate`
- Add a helper `SIGN` to retrieve the sign of a `Rational`.
- modify `CalcEngine` to use `modrate` in Normal and Scientific mode and `remrate` in Programmer mode.

### How changes were validated:
- manually and unit tests added
2019-04-16 17:17:24 -07:00
Rudy Huyn
ad25feda6b Keep input when users refresh currency rates (#369)
Fixes #260

Description of the changes:
prevent UnitConverterViewModel to reset values when users click on update rates.
recompute UnitConverter's caches (m_ratioMap and m_categoryToUnits) once rates are updated (but check first if the user did/didn't change the category)

How changes were validated:
Manually tested with fake currency rates (HTTP responses modified on the fly via FiddlerCore)
Verified that it works no matter the selected field (From or To)
Verified that the currencies selected are kept after a refresh
2019-04-16 11:29:43 -07:00
Rudy Huyn
5a6c6f4274 Prevent the application to crash when the current page is Date Calculation and users paste a text (#391)
Fix the else condition in ApplicationViewModel::OnPaste

How changes were validated:
Manually

Fixes #389
2019-04-15 09:51:06 -07:00
Rudy Huyn
109326508f Improve the support of Narrator with parenthesis (#368)
* Modify how we manage Narrator with parenthesis and refactor right parenthesis

* Optimization

* remove extra spaces

* take feedback into account
2019-04-15 09:31:02 -07:00
Michał Janiszewski
afdda581a4 Drop unneeded const-qualifier on return type (#396) 2019-04-12 13:40:02 -07:00
Pepe Rivera
f6f10444f7 Simplify some of the calc engine string logic (#449)
Description of the changes:
Currently Calculator handles strings by defining integers for each type of function that can be performed, this integer will eventually correspond with an index in s_engineStrings which holds the corresponding display string for each function. Some functions such as Sin can have multiple strings (degrees, rads, grads, inverse). Functions like Sin are mapped to another array called "rgUfne" where a new integer is given depending on the output string which will then be given to s_engineStrings. The new integer returned by the "rgUfne" array runs the risk of overlapping with any new functions that may be added in CCommand.h. Furthermore, it is expected that the strings in s_engineStrings and rgUfne are defined in a particular order (not necessarily sequential), otherwise the logic will break. This makes adding new strings for new functions confusing and difficult, since a lot of the logic is not clearly defined.

This PR attempts to make this a bit simpler by changing the s_engineStrings and rgUfne arrays to be unordered_maps instead of arrays. For s_engineStrings the keys will now be strings, allowing the existing logic for indexing to be used by simply converting the number into a string to access the value. This will also allow us to create keys in the future that are not limited to integers but to strings that hold more meaning.

The rgUfne array will also be updated to be a map that will take in an integer and give you the corresponding string that can be passed to s_engineStrings. The UFNE object in the rgUfne array will also be updated to hold all the possible string keys for a function, instead of indexing them on other numbers that may overlap with existing definitions.

Now to add a new string for a new IDC_FOO function, we would just need to add the "FooString" resource keys to the g_sids array and use the updated rgUfne map to link the IDC_FOO value to the corresponding "FooString" resource key. This way the resource key can be a meaningful string, and not an integer that must be in any particular order.

How changes were validated:
Tested each function manually in standard, scientific, and programmer modes.
2019-04-11 15:20:01 -07:00
Daniel Belcher
091732aa94
Feature/GraphingCalculator initial commit (#450)
Initial PR for the feature/GraphingCalculator feature branch, part of #338.

The feature incorporates a proprietary Microsoft-owned graphing engine to drive graphing experiences in the Windows Calculator app. Due to the private nature of the graphing engine, the source available in the public repo will make use of a mock graphing engine. See README.md for more details.

This PR simply serves as a base for future feature development. As such, the PR will be immediately merged. Feedback on the content of this PR, and on the feature in general, is encouraged. If there is feedback related to the content of this specific PR, please leave comments on the PR page. We will address the comments in future PRs to the feature branch.
2019-04-10 18:15:10 -07:00
Daniel Belcher
7ac750f7e5
Fix invalid check of m_precedenceOpCount (#298)
The conditional m_precedenceOpCount >= 0 was always true because m_precendenceOpCount is an unsigned type. Update the conditional to simply be true and rely on a break statement in the loop. Although this member variable used to be a signed type, in practice, the value was never less than 0.

How changes were validated:
Manual. Unit tests pass locally.
2019-04-09 14:12:28 -07:00
Rudy Huyn
af41a183a7 Optimize and simplify CalculationResult to be able to update the FontSize and the DisplayMargin without fully updating the Style. (#217)
- Merge the 3 CalculationResultStyle(S|M|L) in App.xaml
- Only modify CalculationResult::*FontSize in Calculator.xaml instead of fully updating the style of the control.
- Create a new property MaxFontSize in order to be able to update it without being forced to fully update the Style (because m_startingFontSize was set in OnApplyTemplate)
- Modify how DisplayMargin is managed to prevent the textblock Margin to shift when we update its value (without fully updating the Style).
2019-04-05 13:04:39 -07:00
Matt Cooley
e7eace57f8
Update localized strings 2019-04-04 (#438) 2019-04-05 08:39:29 -07:00
Rudy Huyn
6f49b17bf0 Add Reveal Highlight on AccentCalcButtonStyle + fix accessibility iss… (#374)
Add Reveal Highlight effect on the 4 basic operator buttons + Equal button (effect more visible with purple and all grey-ish accent colors). Also fixes a high contrast issue when the operator buttons were pressed.
2019-04-04 16:55:12 -07:00
Michał Janiszewski
f6a6aae6e6 Add additional defines for MSVC ARM and ARM64 to conv.cpp (#399)
Fixes ARM(64) regression introduced with #212
2019-03-28 11:17:06 -07:00
Michał Janiszewski
7a48f66807 Replace custom types with standard ones (#212)
Replace custom types with standard ones
2019-03-26 14:30:46 -07:00
Rudy Huyn
ef3f5e9cbb Improve performance of SupplementaryResult + Modify the height of RowDltrUnits when UnitConverter is in Landscape (#249)
* Modify the height of RowDltrUnits when UnitConverter  is in LandscapeLayout mode

* clean

* Use the same layout than the existing one while fixing the issue

* Refactor SupplementaryItemsControl to improve performance, not rely on parents and not force the parent element to be HorizonAlignment="stretch"

* take feedback into account

* add HorizontalNoOverflowStackPanel to vcproj.filters

* format conditionals

* replace max by std::max
2019-03-26 11:24:36 -07:00
Rudy Huyn
e9aea9237d Fix padding of unit converter when the current locale displays symbols on the left (#373) 2019-03-26 10:54:14 -07:00
Rudy Huyn
176718211a Accept plus/minus sign before a parenthesis in ClipboardManager (#346)
Modify scientificModePatterns regexes to support minus sign before parenthesis.
2019-03-25 19:09:05 -07:00
Daniel Belcher
19e61e2b53 Disable use of min/max macros defined by Windows headers. (#363)
Description of the changes:
  Disable Windows-provided min/max macros using the NOMINMAX flag. Add the flag to each project's pch to disable the macros across the solution.

How changes were validated:
  Project builds.
  Unit tests pass.
  Smoke tests.

Fixes #362.
2019-03-25 11:28:29 -07:00
Matt Cooley
e55ffe5b8d [Build] Remove conditional inclusion of resw files (#360)
The .resw files for all languages are expected to be checked into the repo (this used to not the the case). Let's remove the conditions in the project file which ignore them if they don't exist.

Additionally removes pseudo-loc resource references from the build as pseudo-loc resources aren't currently being generated.
2019-03-25 11:16:15 -07:00
Rudy Huyn
65045e9375 Update the year in the Copyright string (#320)
Templatize the copyright string and use a build variable to set the year for use across the entire app.

How changes were validated:
Tested with English and French and with different dates.
2019-03-25 11:11:24 -07:00
Matt Cooley
c4361e2bdf
Update localized strings (#357) 2019-03-22 12:29:18 -07:00
Matt Cooley
2a7c53a27d
Add TemporaryKey.pfx (#354) 2019-03-21 17:03:42 -07:00
Shamkhal Maharramov
fd317f5623 Simplify multiple "or" operators (#341)
Use implicit enum to int conversion to simplify some value checking against the Command enum.
2019-03-21 10:43:59 -07:00
Michał Janiszewski
80a5fa01b0 Make CalculatorManager final rather than sealed (#331)
I have no idea if it is required to be `sealed`, I have seen no `^`
operator which makes me think it could be a regular C++ code, barring
the concurrency stuff.
2019-03-20 17:23:09 -07:00
Michał Janiszewski
597caf9c6b Fix order of initialization list in CalculatorManager, COpndCommand (#332)
This ensures the initialization order matches the layout of member
fields in class declaration
2019-03-20 16:45:30 -07:00
Michał Janiszewski
426a6c058d Remove expression with no effects from CalculatorManager (#337) 2019-03-20 16:43:51 -07:00
Shamkhal Maharramov
251ffffc50 Propose code-cleanups#2 (#253)
Description of the changes:

Remove redundancy
Simplify if statements
2019-03-20 14:28:30 -07:00
Michał Janiszewski
683b91aeec Remove redundant type qualifiers on function return type (#329) 2019-03-20 14:22:31 -07:00
Michał Janiszewski
94f0e8b320 Replace fallthrough comment with C++17's attribute (#334) 2019-03-20 14:19:30 -07:00
Michał Janiszewski
462694dcef Remove unused member field from CalculatorHistory (#330) 2019-03-20 10:58:32 -07:00
Daniel Belcher
3bff99b323 ViewModelProperties namespaces converted to static member properties. (#306) 2019-03-20 09:56:59 -07:00
Rudy Huyn
4b6b8fa8fa Fix auto-scaling of CalculationResult when the current locale displays currency symbols on the right (#246)
* Fix auto-scaling of CalculationResult when the current locale displays symbols at the right

* Formatting

* add padding

* modify padding of ValueContainer
2019-03-20 09:54:02 -07:00
Rudy Huyn
21e15c426e hide history button in programmer mode (#327)
Description of the changes:
  Hide the History button when in Programmer mode via VisualState

How changes were validated:
  Open Standard mode
  Switch to Programmer mode
  Verify that the History button isn't visible

Fixes #326
2019-03-18 14:22:44 -07:00
Rudy Huyn
62b2fafdd0 Fix formatting issues with CurrencyConverter and some locales (#242)
The ViewModel wrongly assumed that non-breaking spaces were only used between the value and the symbol. It's not the case of all locales using non-breaking spaces as a thousand delimiter (French for example).

When it was the case, the function only replaced the first thousand delimiter found and kept the extra space at the end of the string, generating 2 issues:

Extra space at the end: #240
Bad formatting of the number: #232

Description of the changes:
   Replace currencyResult.find(L'\u00a0') by a regex only removing spaces at the end of the string.

Fixes #240 and #232
2019-03-18 14:09:13 -07:00
Michał Janiszewski
3d18dd38c2 Add explicit [[fallthrough]] attributes in Ratpack (#323) 2019-03-18 14:02:02 -07:00
Shamkhal Maharramov
965e36cc5d Propose minor code-cleanups (#241)
Description of the changes:
Remove unnecessary 'else', 'continue' statements

How changes were validated:
Manual.
2019-03-18 13:38:04 -07:00
Cyril
b8b0fdf86b Improving code style : verbosity, indentation levels (#200)
Fixing some nested if() statements and reducing indentation levels.

Making some sections less verbose, e.g:

if (a == 1)
{
    b = true;
}
else
{
    b = false;
}
↓

b = (a == 1)
2019-03-18 12:31:04 -07:00
Rudy Huyn
cd7c266a6b Fix issue with Date diff when it includes a Daylight Saving Time (#193)
The application uses local time to calculate the number of days between 2 dates. If a Daylight Saving Time takes place during this period of time (only Clocks Forward 2am->3am), the application will miss 1 day and fail to calculate the number of days/weeks/months between the 2 dates.
image

Description of the changes:
DateCalculationEngine uses local time to modify dates, however, AddDays, AddWeeks,... won't add 24 hours or 7 days if DST happens between the 2 dates, but instead add ~23.9/24.1 hours or ~6.9/7.1 days (depends if it's the DST clock backward or clock forward). When the DST is clock forward, DateCalculationEngine will miss one day.

Solution
use UTC dates to calculate date difference.

Extra Fix:
use calendar->FirstPeriodInThisDay and calendar->FirstHourInThisPeriod in ClipTime (else it will set the time to 12PM (noon) in some regions.
replace OBSERVABLE_PROPERTY_RW by OBSERVABLE_PROPERTY_R when possible.
remove the definition of CheckClipTimeSameDay (implementation missing)

How changes were validated:
Tested manually with different regions (FR, US, ES, JP).

Fixes #178
2019-03-18 11:22:32 -07:00
Rudy Huyn
e40791d7ad Fix compilation issues due to unsigned/signed warnings treated as errors (#317) 2019-03-15 21:21:30 -07:00
Brandon Williams
4a41e37c87 Added support for pasting of monetary values (#176)
Fixes #52

Description of the changes:
Added support for pasting of prefix currency symbols supported by the Windows keyboard.
yen or yuan (¥)
unspecified currency sign (¤)
Ghanaian cedi (₵)
dollar or peso ($)
colón (₡)
won (₩)
shekel (₪)
naira (₦)
Indian rupee (₹)
pound (£)
euro (€)

How changes were validated:
Manually tested each prefix currency symbol supported by the Windows keyboard and ran unit tests.
2019-03-15 17:45:49 -07:00
Rudy Huyn
ca15f05227 DateDiff: Optimize how we build the string used when we calculate the difference between 2 dates (#195)
Optimize how we build the result of GetDateDiffString and GetDateDiffStringInDays, using std::wstring (mutuable) instead of Platform::String (immutable)
2019-03-15 17:20:33 -07:00
Nikita Potapenko
244fd8deee Fix grid.Row (#279)
Fixes #265
Fixes invalid grid.Row assignment for decimalSeparatorButton
2019-03-15 02:06:10 -07:00
Will
1113ff4b86 Updating comments per the C++ core guidelines and removing trailing whitespace (#194)
Fixed comments that were inconsistent with the style guidelines described in C++ core guidelines and the modern C++/WinRT language projections and removed trailing whitespace.

Inserted a space after the beginning of the comment so the text wasn't touching the // on all occurrences.

Removed all occurrences of trailing whitespace
2019-03-14 23:30:07 -07:00
Rudy Huyn
62317fd63b Activate TextSelection on all interesting values/results (#213)
If we allow users to select texts, the application will feel more like a "Desktop app", will be easier to use on a tablet and users will be more prompt to use Ctrl+C to use the result in another app.
2019-03-14 22:35:55 -07:00
Satya
7cad778cc0 Fix memory leak (#300)
Free memory allocated to temp before returning from the function.
2019-03-14 21:21:17 -07:00
Michał Janiszewski
a5e07418df Replace custom ARRAYSIZE macro with std::size (#208)
* Replace custom ARRAYSIZE macro with std::size
2019-03-14 21:06:12 -07:00
Stephanie Anderl
d37c75fec2
Fixes #282 Narrator does not convey error information when no more Right Parenthesis can be added in expression. (#284)
* Added narrator announcements when right parenthesis is clicked
2019-03-14 16:20:05 -07:00
Guillaume Rischard
ac5292cf88 Optimised images losslessly. (#229)
Saved 301 KB out of 9.2 MB. 15.8% per file on average (up to 82.2%)
Fixes #.
Saves 301 KB (although not all files are included in the build)
Description of the changes:
For PNG files: used a combination of Pngcrush, OxiPNG, AdvPNG, PNGOUT and Zopfli
For GIF files: used Gifsicle
How changes were validated:
No changes to behaviour or source code.
Previewed the changed files to make sure they still work
2019-03-13 16:37:50 -07:00
Rudy Huyn
6f4ecf35b3 Remove RenderTransform that is never used (#247) 2019-03-13 15:08:51 -07:00
Michał Janiszewski
be31288187 Fix declarations of functions (#186)
Move file-scope functions to anonymous namespaces.
Drop #pragma once from .cpp files
2019-03-13 13:15:08 -07:00
Jeff Genovy
251578047f Make 73 numeric constants const, moving them into .rdata (#234)
This change makes the 73 variables in ratconst.h actually
inline const, which allows them to move from the mutable .data
section of the executable, and into the read-only .rdata
section instead.

Moving data to the .rdata section has a number of benefits,
such as preventing possible corruption due to stray writes,
or other memory corruption.

Additionally, the initialization at run-time start-up is no
longer needed, so there is also a reduction in the .text
(code) section as well.

As a result the overall size of the Calculator.exe binary
(on x64 Release builds) decreases by 1,536 bytes (or ~1.5 KB)
with no change in behavior other than a small performance benefit.
2019-03-13 13:10:14 -07:00
Rudy Huyn
7663c0d5f2 Remove .editorconfig from sln (#290)
#225 accidentally added a duplicate .editorconfig to the repo as well as to the solution.
#257 removed the duplicate .editorconfig, but not its entry in the solution.
This update removes the extra .editorconfig reference to a version that #257 already removed from the repo.
2019-03-13 12:50:23 -07:00
Howard Wolosky
29c362657b
Remove logging of invalid pasted text (#286)
Addressing community feedback for removal of diagnostic data
2019-03-13 03:34:06 -07:00
Jeff Genovy
e6bd36ec2a Eliminate redundant copies of EMPTY_UNIT object, saving 2.5 KB. (#235)
### Description of the changes:

There are currently 11 copies of the `EMPTY_UNIT` object in the
`Calculator.exe` binary, which not only wastes space/footprint in the
binary itself, but also means that each copy must be separately
initialized, which effects performance.

The reason for this is that the object is defined in a shared header
file, which then is included by multiple .cpp files, causing each
translation unit (.obj) to get a full complete copy of the object.

By marking the object as `inline` we can
instruct the linker to define the object once, as we do
not need to have 11 unique versions of the EMPTY_UNIT object,
we only need 1.

The net result is that the `Calculator.exe` binary size is reduced by
2,560 bytes (or 2.5 KB) with no change in behavior, other than
the small performance benefit of not initializing 10 redundant copies
of the object.

### How changes were validated:
- Manually tested.
2019-03-12 19:24:37 -07:00
Rudy Huyn
a80d082242 CopyPasteManagerTest fails to test all values (#269)
CopyPasteManager unit tests were not fully run, the first item of arrays were never tested. (Luckily, the not-tested values were ok).

Updated from using a pre-decrement while loop to using a standard for loop with an iterator.
2019-03-12 14:58:47 -07:00
Johan Laanstra
67fa2286eb Remove duplicate .editorconfig. (#257)
* Remove duplicate .editorconfig
* Update .editorconfig to remove forcing crlf as discussed in #225.
2019-03-11 17:04:17 -07:00
Rudy Huyn
0f615faff9 Remove end-of-line from .editorconfig (#239)
* Add Editor config

* reset sln

* remove end-of-line setting
2019-03-09 15:46:32 -08:00
Shamkhal Maharramov
a98cb50a70 fix: redundant semicolons (#230)
### Description of the changes:
- Remove redundant semicolons in:
  - [x] UnitConverter.cpp
  - [x] DateCalculator.xaml.cpp
  - [x] CopyPasteManagerTest.cpp

### How changes were validated:
-  Manual
2019-03-09 08:16:05 -08:00
Rudy Huyn
140a5b3b21 add .editorconfig to set some basic coding styles (#225)
To maintain consistent code style between contributors and simplify merging, the solution should provide a .editorconfig to set some basic rules (already used by the current code source).

- use `UTF-8` with BOM (some files are without)
- use CR-LF
- use <kbd>Space</kbd> to indent (sorry #teamTab)
- trim trailing whitespace 
- be sure to add a new line at the end of files.

[Documentation](https://docs.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2017)
2019-03-09 08:09:51 -08:00
Petr Sedláček
248b762b80 Fix indentation and extra newline (#198) 2019-03-08 23:47:40 -08:00
Brett Waldbaum
64c6493312
Build with /W4 (#197)
All projects are built with warning level 4 (/W4) and treat warnings as errors (/WX).
Fixed build errors resulting from enabling these compiler flags.
2019-03-08 23:15:28 -08:00
marcellogianola
e0f70e8c37 fixed typo (#171) 2019-03-08 13:46:36 -08:00
Michał Janiszewski
c85d7ec454 Compare locale strings, not their pointers (#183)
Change the stored locale type to wstring to make the comparison operator
work.
2019-03-08 13:45:39 -08:00
Michał Janiszewski
0197bf18c1 Add override keyword where applicable (#188) 2019-03-08 11:18:01 -08:00
Michał Janiszewski
c6b770eec8 Fix usage of temporary string (#185) 2019-03-07 22:10:20 -08:00
Michał Janiszewski
c325cb1b3a Remove duplicated condition checks (#187) 2019-03-07 22:09:37 -08:00
Michał Janiszewski
13ba479a0c Remove unused variable (#184) 2019-03-07 21:38:40 -08:00
Michał Janiszewski
e2c7db644d Mark classes as final where applicable (#189) 2019-03-07 19:46:53 -08:00
Michał Janiszewski
0166daf5c7 Replace escape sequences with path separators in include paths 2019-03-07 15:51:00 -08:00
Josh Soref
84941c698e Spelling (#135) 2019-03-07 10:27:13 -08:00
Michał Janiszewski
2320697562 Catch polymorphic types by const-ref (#125) 2019-03-07 09:45:51 -08:00
Rudy Huyn
20afac5572 Modify how default units are selected for conversions (#126) 2019-03-07 09:24:34 -08:00
Josh Soref
8a75dcd09d Switch urls from http: to https: (#137) 2019-03-07 08:56:25 -08:00
Karan Nandwani
dc00380d0f updating nuget.org source to point to V3 (#129) 2019-03-07 07:33:22 -08:00
Jared Fuchs
8fa9a691cc Fix comment on IsEven
Looks like the comment on IsEven should read this way instead of "The assumption here is its numerator is 1 and we are testing the numerator is even or not"
2019-03-06 17:14:50 -08:00
Michał Janiszewski
6c0e4e81e7 Remove unused values 2019-03-06 16:47:02 -08:00
Michał Janiszewski
ca01a7e444 Add explicit [[fallthrough]] attribute 2019-03-06 16:44:28 -08:00
Edward Betts
0197fa41da Correct spelling mistakes 2019-03-06 16:10:14 -08:00
Michał Janiszewski
07ff1c372f Fix initialization order in CEngine (#118)
The order of initialization of fields is required to match the one in
class member fields declaration.
2019-03-06 14:51:21 -08:00
Daniel Belcher
057401f5f2 Suppress conversion warning in Ratpack/conv.cpp.
When building for x64, the compiler complains:
    warning C4267: 'argument': conversion from 'size_t' to 'ULONG', possible loss of data

In practice, the number string will not exceed a ULONG in length.
2019-03-05 21:42:24 -08:00
Stephanie Anderl
b865b1b2aa
Add Checked Event Handler to Add/Subtract Radio Buttons to enable Narrator (#91)
* added bug report and feature request issue tempaltes

* copied pull_request_template.md to .github folder

* Updated the DateCalculation narrator logic to use PropertyChangedCallbacks for the DateResultLabel and DateDiffAllUnitsResultLabel TextBlocks.

* Reverted textblock callback changes and added an event handler for when the radio buttons are checked.

* Revert NarratorAnnouncement.h changes and removed unused code from DataCalculator.xaml.h. Updated comments in RaiseNotification method in DateCalculator.xaml.cpp

* Reverted changes in NarratorAnnouncement.h and NarratorAnnouncement.cpp

* Added SAL annotation to AddSubtractOption_Checked

* Remove namespaces from input types on AddSubtractOption_Checked
2019-03-05 20:26:37 -08:00
Stephanie Anderl
b0e24c6f4c Updated UnitConvert ComboBox and Programmer Mode Radio Button Styles to Enable IsTextScaleFactorEnabled (#92) 2019-03-05 17:27:07 -08:00
Howard Wolosky
a0e2dacd98 Updating all icons/images to latest version of the "developer build" icons
All Calculator app iconography uses the "developer version" icon from Design,
to help differentiate a developer build of Calculator from the official version.

Assets have been run through the image compression tools to ensure all unnecessary
metadata has been removed.
2019-03-04 12:30:30 -08:00
Stephanie Anderl
321672995d
Update Rates Hyperlink changed to a HyperlinkButton (#29)
* update currency hyperlink changed to a hyperlink button

* added bug report and feature request issue tempaltes

* copied pull_request_template.md to .github folder

* update currency hyperlink changed to a hyperlink button

* Updated hyperlink button to move text that should not be linked outside the hyperlink button

* Updated hyperlink button to move CurrencySecondaryStatus text out of the hyperlinkbutton control.

* Updated the HyperlinkButton to set the content without using a TextBlock and fixed the AutomationTree issue where the HyperlinkButton wasn't being seen
2019-03-01 13:11:05 -08:00
Lance McCarthy
060139f493 Readability Improvements to Calculator.xaml (#85)
* Calculator.xaml - Simple Readability Adjustments

Improved readability of the XAML document by inserting newline where they were missing and removed rextra newlines from others.

* Added comments and organized resources for superior readability

Using comments and grouping DataTemplates, Styles and other resources significantly increases the readability and discovery of resources.
2019-03-01 11:40:02 -08:00
Daniel Belcher
dd79d6fcd3 Move the CalculatorManager instance to be direct member data of the StandardCalculatorViewModel class.
Previously, the CalculatorManager was managed with a unique_ptr that was instantiated in the ViewModel's constructor and was never re-assigned.  Objects with long lifetime and larger memory footprint should live in dynamic memory, but the ViewModel itself lives in dynamic memory so that goal is still satisfied by storing the CalculatorManager directly in the class. The change allows the compiler to write a more efficient memory footprint for the same data.

- Verified by testing basic app functionality and running unit tests locally.
2019-02-28 16:26:19 -08:00
Matt Cooley
28f982a6e1
Apply spell check (#41) 2019-02-26 20:41:04 -08:00
Matt Cooley
654f09f544
Fix spelling in some comments (#38) 2019-02-25 15:41:16 -08:00
Josh Koon
ddc470949c
Rename scimath.h/cpp to RationalMath.h/cpp (#36) 2019-02-25 14:04:38 -08:00
Josh Koon
0cb5e9bae0
CalcEngine: Manage precision internally to Rational and convert functions to operator overrides (#35)
* Convert Rational::Negate to an operator override
* Convert Rational::Add to + and += operator overrides.
* Convert Rational::Sub to - and -= operator overrides.
* Convert Rational::Div and ::Mul to use /, /=, *, *= operator overrides.
* Convert Rational::Mod to use %= and % operator overrides
* Convert Rational::Rsh and ::Lsh to use >>=, >>, <<=, << operator overrides
* Convert Rational::And, ::Or, ::Xor to use &=, &, |=, |, ^=, ^ operator overrides
* Convert Rational relational functions to operator overrides
* Remove unnecessary precision arguments from Rational class and remove use of explicit Rational constructors in favor of implicit conversions for value types
* Remove unnecessary precision variable from RationalMath operations
* Replace unnecessary Rational::Not with Xor operation
* Remove unnecessary Rational::IsZero() in favor of == 0 comparisons
* Fix rounding issues in ratpak that result from using large precisions.
* Move assignment stmt out of IsCurrentTooBigForTrig
2019-02-25 11:41:32 -08:00
Josh Koon
73372283a0
CalcEngine: Remove the need to specify base/radix when working with Rational values (#31)
- Separates values from the representation (base/radix) of those values.
- Uses a single base for all values represented as Rationals.
- Rationals are converted to/from a specific base when they are converted to/from strings.
2019-02-22 10:00:19 -08:00
Josh Koon
5a530c4bed
Change m_nPrecNum from int to size_t and rename to m_precedenceOpCount (#33) 2019-02-21 16:36:54 -08:00
Josh Koon
32fb8500cb
Fix Log10 function (#27) 2019-02-21 10:50:32 -08:00
Josh Koon
2e18f6f477
Move RADIX_TYPE enum into its own header (#25)
This change moves the RADIX_TYPE enum into its own header. This resolves a compilation error and reduces the dependency graph by allowing RadixToStringConverter to include just the enum header rather than the entire CalcEngine header.

Change verified by ensuring Calculator build locally.
2019-02-20 11:07:32 -08:00
Josh Koon
995f077127
CalcEngine: Convert NumObj* functions to use Rationals and move under CalcEngine::RationalMath namespace (#12)
* Converts NumObj* functions to use Rationals. Places new functions under CalcEngine::RationalMath namespace
* Moves functions that correspond to an operator to the Rational class with intent to convert to operators in the future
* Consolidates use of RatPack's NUMBER and RAT data types to Number/Rational classes and RationalMath namespace.
2019-02-19 07:46:17 -08:00
Daniel Belcher
f210290ddc - Avoid referencing project headers from precompiled headers.
Before this change, the pchs for CalcViewModel and Calculator project referenced project headers.  If those project headers (or any of their dependencies) were to change, then the pch would be recompiled, slowing local build times.

  By removing references to project headers, the pch will be compiled once and is resilient to changes in the project.  Now that project headers are explicit about their dependencies, when there is a change to a project header only the translation units referencing the modified header will need to be rebuilt.

- Manually tested by ensuring Calculator project builds locally.

@Microsoft/calculator-team
2019-02-14 18:20:25 -08:00
Pepe Rivera
362b4f9d1e
Merge pull request #16 from joseartrivera/joriv/OnLaunchSize
Resize app to appropriate dimensions on first launch
2019-02-13 09:56:01 -08:00
Matt Cooley
2ab114a71f
Update WinUI to 2.0.181018004 (#18)
Update the Microsoft.UI.Xaml NuGet package to a new version. The ARM64 framework package in 2.0.181018003.1 had entries missing from its manifest, so the classes in the package couldn't be activated.
2019-02-13 09:44:02 -08:00
Pepe Rivera
531a8a1b7b Use TryResizeView to resize calc on first launch 2019-02-12 13:50:09 -08:00
Stephanie Anderl
cb8775926a
Merge pull request #13 from Microsoft/sanderl/JapaneseEra
Date Calculation: Updated AdjustCalendarDate() to ensure we always add 365 when adding 1 year for Japanese calendar
2019-02-08 15:51:28 -08:00
Stephanie Anderl
2fc8196104 Moved all the Japanese Era logic inside the Year case of the switch statement 2019-02-08 15:42:28 -08:00
Stephanie Anderl
1bd4f1870c Updated calendar strings to use the CalendarIdentifiers object 2019-02-08 15:33:00 -08:00
Stephanie Anderl
f8029942d4 Updated the AdjustCalendarDate() to account for the transition year quirk in the Japanese calendar. 2019-02-08 12:30:16 -08:00
Matt Cooley
a2739b8de2
Don't send AppLifecycle telemetry unless SEND_TELEMETRY is defined (#10)
The app currently logs diagnostic events to ETW in various places. If we add certain flags to those events, the data is eligible to be sent as telemetry. (Whether it actually gets sent is controlled outside of Calculator--for example, there are lots of checks at the system level to ensure privacy settings are honored.)

Currently we set the "eligible for telemetry" flags only in official builds, so no telemetry gets uploaded while the app is in development. We already have this set up for the main TraceLogging provider, but we also need to do this for the AppLifecycle performance logging.
2019-02-04 12:06:02 -08:00
Matt Cooley
ac63c1e1c2
Remove calcmanager ref (#9)
Calculator (the main app project) depends on CalcManager, but only transitively: Calculator -> CalcViewModel -> CalcManager.

However, Calculator's project file currently has a direct dependency on CalcManager. Let's remove this to make it harder to accidentally introduce new dependencies between the layers.

Also cleaning up some commented-out directives in the CalcManager MSBuild file.
2019-02-04 11:53:02 -08:00
Matt Cooley
177a606012
Clean up project structure in Visual Studio (#8)
A few small changes to improve the view of the code in Solution Explorer:
* Delete folders from solution explorer which don't appear on disk (Resource Files, PerfTrack)
* Delete files on disk which aren't compiled into the project (Type.xaml)
* Rename CalculatorHistory.Cpp to CalculatorHistory.cpp, for consistency with other files
2019-02-04 11:52:28 -08:00
Matt Cooley
4cadfb204d
Remove unused PLM code (#7)
Remove LayoutAwarePage, SuspensionManager, and other suspend-resume handling code. SuspensionManager::SaveAsync and related methods weren't actually called anywhere. I didn't attempt to remove the serialize/deserialize code at the ViewModel layer, although much of that is likely not needed either.

We may decide we want to persist more state through a suspend-terminate-resume cycle (as the app might have done a long time ago). But if we decide we want that, we should not use a persistence mechanism that's closely coupled to frame navigation.
2019-02-01 15:15:48 -08:00
Matt Cooley
8df88c7106
Fix file path in CalculatorUnitTests.vcxproj.filters (#6) 2019-01-31 13:05:10 -08:00
Matt Cooley
278a1e714e
Remove MSBuild directives which were used only in the internal build system (#5)
Remove some properties which were only used when XefOutputRoot was set in the previous internal-only build environment.
2019-01-29 19:39:20 -08:00
Matt Cooley
1c7187f632
Clean up unit test projects (#4)
* Rename CalculatorUnitTests_VS to CalculatorUnitTests, fix gitignore

* Delete internal unit tests

* Update pipeline paths
2019-01-29 19:37:37 -08:00
Josh Koon
ebfce5a8cd Remove empty COpndCommand destructor. Cleanup constructor declaration. 2019-01-29 14:28:03 -08:00
Josh Koon
b70a12c6cf Add clarifying comment to call to CHistoryCollector::AddOpndToHistory 2019-01-29 14:27:24 -08:00
Josh Koon
db4a6eb9ea Return to initialization pattern in ExpressionCommand 2019-01-28 19:34:36 -08:00
Josh Koon
4883fab7f7 Convert ExpressionCommand and History collector to use Rational instead of PRAT 2019-01-28 19:14:15 -08:00
Howard Wolosky
c13b8a099e Hello GitHub 2019-01-28 16:24:37 -08:00