Commit Graph

288 Commits

Author SHA1 Message Date
Scott Freeman
6366e0c535 Replacing CalculatorVector usage with std::vector (#756)
* Replacing CalculatorVector usage with std::vector

Assumptions made here are that memory allocations
are not recoverable.  If it can be proved that an index
will be in range, then the indexing operation is used.
If not (without manual checks) the std::vector::at function
is used to throw an exception in case of a programmer bug.

* Changes based on PR feedback

Using auto& in CalculatorCollector::UpdateHistoryExpression
so the token.first value is properly updated.

Using range for loop to GenerateExpressions.

Setting isEditable directly to the result of boolean expression.

Using token.second directly instead of creating a
separate tokenCommandIndex variable.

* Fixing issue with generating expressions strings.

A space should not be added before the first item.
2019-10-30 10:55:13 -07:00
Rudy Huyn
25cdca991c make ControlSizeTrigger works even if the control is already loaded (#738) 2019-10-29 15:21:32 -07:00
Rudy Huyn
bc2d2d4e9d use short date (#739) 2019-10-29 11:14:11 -07:00
Matt Cooley
afa144cd16
Remove unnecessary dependencies from UITestFramework project (#745)
The CalculatorUITestFramework project does not need Microsoft.NET.Test.Sdk or MSTest.TestAdapter. These dependencies are needed only in the project which produces the actual test assembly (in our case, the CalculatorUITests project).

Removing these resolves a build warning, since the test adapter package does not target .NET Standard.
2019-10-28 10:54:26 -07:00
Rudy Huyn
8db4c2b25a Allow negative numbers without digits before the decimal point (#743) 2019-10-28 10:17:02 -07:00
Howard Wolosky
bc298efc97
Fix release pipeline yaml (#733)
There were two issues:

* The indentation for the PowerShell script task was off,
  causing a parsing error
* The flighting task needed to be named so that the Aero
  task would be able to reference its output variable.
2019-10-24 22:33:26 -07:00
Howard Wolosky
357bb34c21
Update release pipeline to use newer StoreBroker tasks (#727)
Updating the release pipeline to use the newer StoreBroker v2 tasks
for automated deployment to the Store.

Must rev the version of the internals package in order to get the
latest version of the PDP files and config file.
2019-10-22 15:41:26 -07:00
Matt Cooley
d5046e1ffc
Update localized strings 2019-10-21 (#724) 2019-10-21 14:47:32 -07:00
Scott Freeman
f6a061c486 Updating CalculatorHistory to use a default destructor. (#723)
Its memory will be cleaned up by std::vector's destructor.
2019-10-21 12:47:09 -07:00
Mateusz
bfa5f81ef6 Do not hide expression when user presses Enter or = (#695)
* #653 Do not hide expression on EQU operation

* #653 Clear expression, when user makes an action

* #653 Fixed UI tests

* #653 Review fixes
2019-10-18 13:40:13 -07:00
Rudy Huyn
b97046ad67 Allow users to paste expressions with ^or % (#682) 2019-10-18 11:07:51 -07:00
Rudy Huyn
00064fba11 Modify how the Calculator control manages the focus (#686) 2019-10-17 14:18:35 -07:00
Rudy Huyn
1a9edff26b add fallback colors to RevealBrush missing them (#685) 2019-10-17 14:10:26 -07:00
Rudy Huyn
05eda81ba2 Add E-notation support to CopyPasteManager for standard mode (#687)
* Add scientific notation support to CopyPasteManager for standard mode

* improve c_signedDecFloat to ignore '.'

* fix c_signedDecFloat
2019-10-14 10:16:31 -07:00
James Inkster
033f7757e2 fix 505 (#710)
* fix 505

* Update CalcErr.h

Updated to have line of code changed to be right below the comment referring to line of code. (Line 45-44)
2019-10-13 09:56:19 -07:00
svsrk praveen
51c4845f88 Fix the focus when right-clicking CalculationResult's TextBlock (#698)
* Fixed issue with focus when right-clicking result

* Using dynamic_cast in place of safe_cast
2019-10-09 07:39:55 -07:00
Stephanie Anderl
16e8e2d89e
Added new dev app icons and update version to 1909 (#705)
* Added new dev app icons

* Removed VS added page include in calculator.vcsxproj.filters and increased the internal version number and the app version number
2019-10-08 10:44:13 -07:00
Pepe Rivera
55074c2312
Update Calculator keyboard for greater consistency and extensibility (#688) 2019-10-03 15:56:44 -07:00
Pepe Rivera
9cb0932eaa
Update Calc Engine for new functions needed for keyboard refresh (#662)
* Update Calc Engine to Support New Functionality

* Address PR comments

* Address PR comments
2019-09-30 14:04:20 -07:00
Matt Cooley
d9bf57ff99
Code cleanup: simplify NarratorNotifier (#646)
Now that the RaiseNotificationEvent API is available on all platforms where the Calculator app runs, we can remove the factory classes which switched between RaiseNotificationEvent and an alternative implementation based on live regions.
2019-09-29 16:42:37 -07:00
Rudy Huyn
5c0785743c Modify how narrator names the first and last bits of a number in Bit Flip (#675)
* Replace 0th by "least significant bit"

* Add support of Most Significant Bit

* Fix issue with narrator not updating text of some bits
2019-09-27 10:39:50 -07:00
David Shoemaker
9a099acb3a Updated signature which VS 2019 is actually enforcing (#681) 2019-09-26 16:28:05 -07:00
Zach Herman
f6f864c88c Do not collapse Update Rates button in a transient state (#619)
* Do not collapse Update Rates button in a transient state

* Address PR feedback and add animation to everything affected by IsCurrencyLoadingVisible
2019-09-26 11:38:40 -07:00
Rudy Huyn
80912a33d0 Prevent the history panel to be displayed when using the Programmer mode (#676)
Be sure we don't display the panel when the current view is the Programmer mode.

Fixes #665
2019-09-20 16:29:45 -07:00
Pepe Rivera
c4fe87a118
Disable ProgrammerRadixOperators when not visible 2019-09-20 15:04:28 -07:00
Zach Herman
d68e505b04 Add copy button to history menu item context menu (#628)
Adds a Copy button to the context menu for history menu items located above the delete button in the menu. Copy only copies the result and not the entire content of the history item (equation and result).

Fixes #429
2019-09-19 16:41:50 -07:00
Matt Cooley
d6d5591148
Move unit test runs to hosted pools (#671)
We can now run our unit tests in the Hosted VS2019 pool since bugs have been fixed in the version of Visual Studio deployed on those agents.
2019-09-16 06:43:53 -07:00
Rudy Huyn
f0b51ae1ee Fix scroll buttons in CalculationResult (#652)
* Fix scroll buttons of CalculationResult

* Unregister click events

* Add comment
2019-09-09 09:57:30 -07:00
Stephanie Anderl
a7fb172028
Update app version to 1908 (#661)
* Update app version to 1908

* Update app versionMinor to 1908
2019-09-05 16:00:27 -07:00
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
Howard Wolosky
ae30322ab9
Update documentation for communicating discovered security vulnerabilities (#657)
Aligning to recently published common SECURITY.md file available at
https://github.com/microsoft/microsoft.github.io/blob/master/SECURITY.MD
2019-09-03 14:12:50 -07:00
Matt Cooley
c9ac7baebb
Update internals package to 0.0.18 (#645) 2019-08-26 10:29:56 -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
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
Howard Wolosky
25e2a14257
Updated README to note the requirement for installing WinAppDriver (#624)
- Our documentation should make it clear to contributors what the expected developer
  environment is in order for the project to work.  In this case, a user tried to run the UI
  tests, unaware that they needed WinAppDriver installed on their machine.  This updates
  the README to indicate that requirement.
- Trailing spaces from other parts of the document were also removed as part of this change

Fixes #621
2019-08-06 14:42:39 -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