* 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.
* eod
* Passive graph value tracing working.
* Basic active tracing cursor working.
* Move active tracing from graphingcalculator to grapher to save some hops.
Also block tracking of the active tracing key's when in the EquationTextBox.
* Active tracing working, need to put button on screen for activation.
* Added active tracing control button (placeholder image)
* Eod
* Popup trace value now tracks the highlighted point.
* Popup skined
* PR Updates.
* Update certificate thumbnail so VS2019 doesn't have a build error.
* PR comments in process.
* PR Updates
* PR Updates, change tracing value to use tooltip static resource so we automatically change depending on system values. And changed text formatting of the value to be generic (x,y) value.
* PR updates, changed how we detect who has focus so we don't eat keys when not in active tracing.
* Additional filtering for the Key Up/Down in the grapher.
* Fix bug where active tracing would turn back on after clicking button to turn it off.
* 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
* 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.
* eod
* Passive graph value tracing working.
* Basic active tracing cursor working.
* Move active tracing from graphingcalculator to grapher to save some hops.
Also block tracking of the active tracing key's when in the EquationTextBox.
* Active tracing working, need to put button on screen for activation.
* Added active tracing control button (placeholder image)
* Eod
* Popup trace value now tracks the highlighted point.
* Popup skined
* PR Updates.
* Update certificate thumbnail so VS2019 doesn't have a build error.
* PR comments in process.
* PR Updates
* PR Updates, change tracing value to use tooltip static resource so we automatically change depending on system values. And changed text formatting of the value to be generic (x,y) value.
* PR updates, changed how we detect who has focus so we don't eat keys when not in active tracing.
* Additional filtering for the Key Up/Down in the grapher.
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.
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
* 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
Move back the VisualStateManager node to the root XAML element to fix visual states of the titlebar.
### How changes were validated:
- Manually
Fixes#631
* 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.
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.
* 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
### 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.


## Fixes#445.
* Fixed the WindowIdLog so that it is updated when a new WindowCreated event is fired
* Updated the windowidlog check in LogWindowCreated to use IsWindowIdInLog
* 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
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.
* 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
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
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
- 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
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
* 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
`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.
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.
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).
* 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.
* Force en-US for unit tests
* fix some spacing issues after merge
* remove default argument of LocalizationService to fix compilation issue in Release mode
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
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.
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.htmlhttps://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.
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.
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
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
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
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
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.
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
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
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.
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
## 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
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
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.
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.
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.
- 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).
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.
* 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
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.
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.
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.
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.
* Fix auto-scaling of CalculationResult when the current locale displays symbols at the right
* Formatting
* add padding
* modify padding of ValueContainer
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
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
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)
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
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.
Optimize how we build the result of GetDateDiffString and GetDateDiffStringInDays, using std::wstring (mutuable) instead of Platform::String (immutable)
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
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.
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
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.
#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.
### 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.
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.
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)
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"
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.
* 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
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.
* 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
* 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.
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.
* 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
- 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.
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.
* 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.
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