Commit Graph

125 Commits

Author SHA1 Message Date
Michał Janiszewski
f30e9494ce
Clang-format most of the sources (#1467) 2021-05-10 10:18:39 -07:00
Michał Janiszewski
d4be50490f
Add headers missing for compilation with GCC (#1468)
Things that required such update included:
* `wstringstream`
* `setprecision`
* `SCODE_CODE`, `E_BOUNDS`
* Various SAL macros
2021-02-01 08:40:49 -08:00
Wei (Waley) Zhang
565e3e2714
Improve clarity of math expressions in history for Standard Calculator (feature #138) (#1453)
* Implemented feature & added unit tests

* Fixed more unit/ui tests

* Refactored tests

* Update HistoryTests.cpp

* Update HistoryTests.cpp

* Update HistoryTests.cpp

* Update HistoryTests.cpp

* Update HistoryTests.cpp

* Update HistoryTests.cpp

* Update HistoryTests.cpp

* Update HistoryTests.cpp
2021-01-20 13:21:27 -08:00
Hongxu Xu
61d06b2d2f
Use different formatter for different currency (#1432)
* Use different formatter for different currency

* Add functional tests for currency fraction digit format

* Revert "Add functional tests for currency fraction digit format"

This reverts commit bd8aab33847425f4dcfd0d76ce310c918729b2fd.

* Add TestCurrencyFormattingLogic in UnitConverterViewModelUnitTests

* Fix InitializeMultipleConverterTest

* Add comment for a line of code

* Add default case for switch in ConvertToLocalizedString

* Remove trailing decimal
Disable decimal input if maxFractionDigits is 0
Fix input may be blocked after switched active

* Fix: UpdateIsDecimalEnabled should do nothing for non-currency converter

* Remove unnecessary SetValue method

* Add a comment

* Add functional UI Tests for currency converter
Reset currency before tests
Fix: input is blocked after switching to currency with less fractional digits

* Set Priority=0 for currency format related tests

* Truncate digits in display value after switcing
To fix incorrect result after switching currency with less fractional digits
2020-12-02 11:04:22 -08:00
Seija
13d8b04d8d
Changed output of GetCurrentRadix to match the variable type of m_radix (#1416)
Co-authored-by: PokeCodec <67983839+PokeCodec@users.noreply.github.com>
2020-10-28 14:40:57 -07:00
Stephanie Anderl
96c1a45774
Revert "Updated the Calculator projects to include the /Z7 compiler flag" (#1356)
* Revert "Updated the Calculator projects to include the /Z7 compiler flag (#1337)"

This reverts commit 6299ec2303.

* Update Calculator.vcxproj

Add  %(AdditionalOptions) where it is missing

* Update TraceLogging.vcxproj

Updated the AdditionalOptions to add /await /std:c++17 /utf-8  so this project is consistent with the other projects.
2020-08-25 09:31:40 -07:00
Stephanie Anderl
6299ec2303
Updated the Calculator projects to include the /Z7 compiler flag (#1337)
* Added the /Z7 compiler flag

* added /Z7 compiler flag to remaining calculator projects

* Add %(AdditionalOptions) to complier configuration where it is missing
2020-08-11 15:39:32 -07:00
Quentin Al-Timimi
54d81721cf
Pre-Unit conversion work refactor, replace category with categoryID (#1260)
Removed category as key in category to unit vector map and replaced with category id to reduce memory footprint.
2020-06-04 08:51:06 -07:00
Rudy Huyn
75fde82f46
Fix how we calculate the precision in Unit converter and update GetNumberDigitsWholeNumberPart (#1256)
* Fix 1255

* optimization

* spacing
2020-06-01 16:50:45 -07:00
Rudy Huyn
143907f21f
Remove dead code from History (#1228)
* Clean history

* clean unit tests

* cleaning

* Remove friend class in HistoryViewModel
2020-05-25 15:02:27 -07:00
Rudy Huyn
c37f540265
Remove saved commands from CalculatorManager (#1230) 2020-05-25 10:43:31 -07:00
pi1024e
c1fefd3a7b
Change precision and variables regarding the number of digits to be unsigned instead of signed (#1092) 2020-05-18 20:14:40 -07:00
Rudy Huyn
6e521d8f29
Remove LRE/LRO characters from results and error messages (#1161)
* Remove LRE/LRO characters and rely on Xaml to correctly displayed the numbers and error messages RtL

* unit tests
2020-04-30 12:04:33 -07:00
dovisutu
5403adc914
Fix the operand order of logbasex for consistency (#1115)
* Fix #851: inconsistent operand order for log_y(x)

 - fixed the bug in scioper.cpp
 - changed the related test in CalculatorUnitTests
 - also changed the text in GraphingNumpad

* Change the name of LogBaseX for consistency

basically every occurence is repalced by logbasey, except
for the localized string for narrator, which I left for
the localization team to fix.

* Fix the test

* Revert GraphingNumPad.cpp

* Fixup according to review
2020-04-03 10:34:59 -07:00
pi1024e
0550cb7e92
Simplify bools. (#1116) 2020-04-02 10:20:17 -07:00
Matt Cooley
f552428d97
Fix some code analysis warnings in CalcManager (#1074) 2020-03-30 15:23:22 -07:00
pi1024e
475aafdbc4
Replace old C headers with the C++ ones (#1099) 2020-03-23 08:44:06 -07:00
pi1024e
1b72ecb6b3
Remove unused "this" in async lambda expression (#1094) 2020-03-17 09:56:54 -07:00
pi1024e
172bf08122
No need to invoke the compare method when we have an overloaded == operator. (#1091) 2020-03-16 16:02:51 -07:00
pi1024e
d14423d0f1
Merge initializers and assignments (#1088) 2020-03-16 15:52:48 -07:00
pi1024e
f527dce88d
Use static_cast instead of C-style cast in UnitConverter.cpp (#1089) 2020-03-16 09:29:58 -07:00
Matt Cooley
41dcbf53ec
Remove CMakeLists for now (#1086) 2020-03-13 12:40:57 -07:00
Scott Freeman
0490d8cd20
Reducing the number of wstring copies when constructing Unit and Category (#936) 2020-03-13 11:06:20 -07:00
pi1024e
880072016f
Push back if the vector is a whimsical (#1062) 2020-03-03 13:47:26 -08:00
Eric Wong (PAX)
d2b2853114 Merge remote-tracking branch 'upstream/feature/GraphingCalculator' into mergeFeature 2020-01-06 14:42:40 -08:00
Scott Freeman
563404fd99 Wstring view overrun (#884) 2020-01-06 13:44:40 -08:00
Scott Freeman
fb18b639e3 Using wstring::find_last_not_of in CalcManager::NumberFormattingUtils::TrimTrailingZeroes (#898) 2020-01-06 13:36:58 -08:00
dovisutu
9e52256196 Fix prefix 0s after deleting decimal point (#825) 2020-01-03 02:21:12 -08:00
Scott Freeman
a21b4a2d1a Using wstring instead of wstringstream where appropriate (#881) 2019-12-19 01:50:31 -08:00
Scott Freeman
be4e437f4d Removing call to stripzeroesnum if no number exists. (#877) 2019-12-18 02:02:04 -08:00
Scott Freeman
3c6b5a808e Cleaning up some UnitConverter code and making some of it more efficient. (#875) 2019-12-18 01:19:28 -08:00
Stephanie Anderl
f593c621aa
Update GraphingCalculator Projects to allow official builds (#852)
* renamed MockGraphingImpl to GraphingImpl, updated the nuget.config to include the WindowsApps feed

* Revert nuget.config change

* Updated vcxproj files to output to the same directory regardless of configuration

* Removed outder used GenerateProjectSpecificOutputfolder instead

* revert commenting out the temporary.pfx cert in the calculator.vcxproj file
2019-12-10 16:15:49 -08:00
Scott Freeman
b6f9634e34 Removing unused serialization code in CalculatorManager (#858) 2019-12-10 14:32:00 -08:00
Matt Cooley
03c2d6514f
Build GraphingCalculator against SDK 18362 (#841) 2019-12-03 13:28:49 -08:00
Rudy Huyn
73d6a32add merge with master 2019-12-02 19:36:54 -08:00
Scott Freeman
369843dd37 Changing CCalcEngine::s_engineStrings to use string_view for keys (#829) 2019-12-01 08:59:50 -08:00
Scott Freeman
6e2b82c8bf Changing CalculatorManager::GetSavedCommands to return a const ref (#812) 2019-11-21 21:50:26 -08:00
Stephanie Anderl
442ed6a861
Key graph features (#704)
* Added IGraphAnalyzer

* Key Graph Features called and getting returned to the client. To do put all strings into the Equation object

* Updated UpdateKeyGraphFeatures to add function analysis data to all properties in Equation object

* Update KGF when variables are updated

* Key graph features ui started

* Added MathRichEditBox and started hooking up key graph features to the UI

* Updated EquationViewModel to include parity and periodicity

* Updated key graph features to update the EquationViewModel

* updated key graph features to display more values

* Key graph features populating uing MathRichEdit mode

* moved KeyGraphFeatures control to GraphingCalculator.xaml

* Use MathML formatting instead of MathRichEdit for strings passed back from the engine

* cleaned up project targeting and equation.h comments

* Updated equation edit box to populate for KeyGraphFeatures

* Fixed vcxproj files to have the correct targeting and certificates. KGF Title strings moved to x:Uid instead of the code behind

* Updated per PR feedback

* Update MathRichEditBox to detect if the string is a mathml string and use the appropriate set method to set the text

* fixed the issue where parity, periodicity and monotonicity could be set with an old value if the next one is empty

* KGF control UI adjustments and error handling

* Error control updates

* Error handling added when analysis fails

* fixed alignment on rich edit boxes

* Add monotonicity direction into the mathml string and only have 1 richeditbox

* Set hover state on KGF EquationEditBox to change button opacity and fixed spacing in Monotonicity RichEditBox

* remove sideload package certificate info VS added

* updated logic for setting error strings to be in the viewmodel

* Updated KeyGraphFeatures to populate dynamically using a ListView and TemplateSelector

* Update periodicity to not show if it isn't supported

* Fixed issue where y-intercept was using the x-intercept value

* Remove ItemsControl ItemsContainerStyle

* Updated per pr feedback. Fixed bug where analysis error would not reset

* Update MathRichEdit box to remove selection when focus is lost

* Updated mathrichedit to get LAF access for Dev, Release and Graphing projects

* Remove OnLostFocus in MathRichEdit, Change KGF ItemsControl back to ListView

* Clean up styles for KGF and ensure the match the comps

* Moved formatoptions logic to the Grapher constructor and reverted LineColor.Text resource that was mistakenly taken out

* Add copyright header to KGF Files

* fixed issue where asymptote values were not populating

* Disable KGF button when there is no equation. Fixed issue where equation populated in a new equationtextbox after the previous one was deleted

* Removed formatoptions testing lines used for debugging
2019-11-12 13:46:11 -08:00
Scott Freeman
01299a92cd Updating code to append a wchar_t instead of const wchar_t (#778) 2019-11-11 09:23:34 -08:00
Matt Cooley
44e1984f6b
Enable code analysis in the CalcManager project (#689) 2019-11-04 07:41:13 -08:00
Scott Freeman
5e46ceabc8 Making string concatenations more efficent (#760)
by appending wchar_ts instead of  wstrings
2019-10-31 11:44:25 -07:00
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
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
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
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
Pepe Rivera
b2dd55a64f Switch to RichEdit math mode in EquationTextBox (#672)
* Use RichEdit Math Mode

* Add comment

Co-Authored-By: Stephanie Anderl <46726333+sanderl@users.noreply.github.com>
2019-09-23 11:51:08 -07:00
Pepe Rivera
41fbcfe9c5
Merge master into feature/GraphingCalculator branch (#660) 2019-09-05 15:01:12 -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
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