Commit Graph

738 Commits

Author SHA1 Message Date
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
Dave Grochocki
47f4757f07 Update Roadmap.md (#339)
Adding Graphing Mode to the roadmap.
2019-03-20 14:13:57 -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
Ruige Lee
595ae6a8ff Update punctuation in README.md (#205) 2019-03-08 23:18:41 -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
Lorenz Nickel
c1174e057d Remove invalid links from comments (#201)
Remove invalid links from comments
2019-03-08 10:28:35 -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
Christian Oliff
07f4cc1926 HTTPS link to editorconfig.org (#134) 2019-03-07 10:02:44 -08:00
Michał Janiszewski
2320697562 Catch polymorphic types by const-ref (#125) 2019-03-07 09:45:51 -08:00