Commit Graph

111 Commits

Author SHA1 Message Date
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
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
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
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
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
Matt Cooley
b3432c93c8
Update to SDK 18362 (#568) 2019-06-27 09:53:06 -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
Michał Janiszewski
e9551e3774 Ensure gldPrevious is scoped to its own translation unit (#556) 2019-06-18 13:05:18 -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
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
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
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