summaryrefslogtreecommitdiff
path: root/Userland/Applications/Calculator
AgeCommit message (Collapse)Author
2022-07-17Calculator: Set button colors from system paletteKarol Kosek
Previously, changing a system theme with Calculator opened made buttons with custom color not to update to the new theme - the background color remained from the previous one. This is because when setting the color, the widget has to copy the current palette and modify the foreground color there, which means it will no longer refer to the system theme and any change there will not happen here. Using colors from a system palette fixes this issue and makes buttons look slightly different from what was here before. But that is because they're now somewhat more integrated with the system themes! :^) Type | Old color | New color role ---- | --------- | -------------- Numbers | "blue" | SyntaxNumber Functions (sqrt, %) | "blue" | SyntaxFunction Operators (+ - * /) | text-default | SyntaxOperator Backspace, CE and C | "brown" | SyntaxControlKeyword Memory operators, = | "red" | SyntaxPreprocessorValue
2022-07-12Everywhere: Replace single-char StringView op. arguments with charssin-ack
This prevents us from needing a sv suffix, and potentially reduces the need to run generic code for a single character (as contains, starts_with, ends_with etc. for a char will be just a length and equality check). No functional changes.
2022-07-12Everywhere: Add sv suffix to strings relying on StringView(char const*)sin-ack
Each of these strings would previously rely on StringView's char const* constructor overload, which would call __builtin_strlen on the string. Since we now have operator ""sv, we can replace these with much simpler versions. This opens the door to being able to remove StringView(char const*). No functional changes.
2022-06-10Calculator: Replace "Euler's Constant" with "Euler's Number" in menuredsnout
This is meant to address #14234 by renaming the "Euler's Constant" menu item to "Euler's Number". This commit removes the existing "eulers.png" and replaces with a new "eulers_number.png" for clarity.
2022-06-09Calculator: Add Phi constantAndrew Dykema
2022-04-09LibGfx: Move other font-related files to LibGfx/Font/Simon Wanner
2022-04-03Calculator: Update mimic_pressed for refactor into the Button classRob Ryan
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-03Calculator: Add keyboard input for more operationsForLoveOfCats
2022-03-03Calculator: Avoid focusing any keypad button other than the equal buttonForLoveOfCats
Having the return key sometimes press the equal button when nothing is focused and press a different button when there is focus felt confusing. The equal button is still able to be focused for the tab cycle to have something to go to in order to jump out of the textbox but no other keypad button can be focused now.
2022-03-03Calculator: Utilize Button `mimic_pressed` to show when keys are pressedForLoveOfCats
2022-02-14Applications: Use default constructors/destructorsLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-02-13Base+Calculator: Add iconselectrikmilk
Adds icons for Pi and Euler's Constant to the Constants menu.
2022-02-13Userland: Run gml-formatIdan Horowitz
This brings the existing GML files up to spec with the new requirements
2022-02-06Userland: Use AK::pow<I> where applicableHendiadyoin1
2022-01-09Calculator: Propagate errors using try_set_main_widget in maincreator1creeper1
2022-01-02Calculator: Round small number to prevent crashLucas CHOLLET
Small numbers (smaller than 1e-19) can't be displayed in the calculator. They provoke a division by zero in Keypad::set_value(), as 10^20 overflows.
2022-01-02Calculator: Remove KeypadValue::operator>Lucas CHOLLET
This method was declared but not implemented, and will probably never be useful.
2022-01-02Calculator: Display zero with only one characterLucas CHOLLET
This patch prevents zero to be displayed as "0.00". The value is now always printed with only one character.
2021-12-22Calculator: Make double construction and conversion privatecreator1creeper1
At this point, the double conversions should really only be implementation details of the KeypadValue class. Therefore, the constructor-from double and conversion-operator-to double of KeypadValue are made private. Instead, the required functionality is provided by KeypadValue itself. The internal implementation is still done using doubles. However, this opens us up to the possibility of having loss-free square root, inversion and division in the future.
2021-12-21Calculator: Construct KeypadValue precisely from the Clipboard contentscreator1creeper1
Previously, we would use lossy strtod() conversion. This was bad, especially since we switched from internally storing Calculator state in a double to storing it in the KeypadValue class some time ago. This commit adds a constructor for the KeypadValue class that is not lossy by using strtoll(). It handles numbers with and without decimal points as well as negative numbers correctly.
2021-11-28Everywhere: Use default execpromises argument for Core::System::pledgeBrian Gianforcaro
2021-11-24Calculator: Port to LibMain :^)Andreas Kling
2021-11-21LibGUI+Everywhere: Make sync requests to Clipboard server more obviousBen Wiederhake
2021-10-31Calculator: Add Constants menuMusab Kılıç
2021-10-31Calculator: Fix copy button not copying the fractional part bug :^)Musab Kılıç
2021-10-31Calculator: Improve KeypadValue conversion to handle integer valuesMusab Kılıç
2021-08-26Calculator: The equal key will now also finish the operationScott R. Parish
Prior to this if you typed "1+2=" you would not get the answer, instead you'd be left with "2" on the screen; Calculator wanted you to hit the enter key to get the answer. Now you can either use the enter or the equal key to finish the operation and get the answer.
2021-08-18Userland+LibGUI: Add shorthand versions of the Margins constructorsin-ack
This allows for typing [8] instead of [8, 8, 8, 8] to specify the same margin on all edges, for example. The constructors follow CSS' style of specifying margins. The added constructors are: - Margins(int all): Sets the same margin on all edges. - Margins(int vertical, int horizontal): Sets the first argument to top and bottom margins, and the second argument to left and right margins. - Margins(int top, int vertical, int bottom): Sets the first argument to the top margin, the second argument to the left and right margins, and the third argument to the bottom margin.
2021-08-03Calculator: Use KeypadValue class instead of doublecreator1creeper1
Calculator now uses the KeypadValue class instead of double in its internal calculations. By not constantly converting to double back-and-forth, we do not use precision simply by, for example, negating a number. This fixes #7484.
2021-08-03Calculator: Add KeypadValue classcreator1creeper1
This commit adds a basic KeypadValue class which abstracts away Keypad's internal representation in a slightly simpler format. This will allow arithmetic operations in the Calculator to not lose any precision. In cases where losing precision is necessary, an explicit conversion operator to double is provided, as well as an explicit constructor from double.
2021-07-31Calculator: Add menus before showing the windowLuK1337
Otherwise, space is reserved but menus aren't shown.
2021-07-27Calculator: Improve UI margin consistencyFrHun
2021-07-21Userland: Add GUI::Window::add_menu() and use it everywhereAndreas Kling
Applications previously had to create a GUI::Menubar object, add menus to it, and then call GUI::Window::set_menubar(). This patch introduces GUI::Window::add_menu() which creates the menubar automatically and adds items to it. Application code becomes slightly simpler as a result. :^)
2021-07-19Everywhere: Use AK/Math.h if applicableHendiadyoin1
AK's version should see better inlining behaviors, than the LibM one. We avoid mixed usage for now though. Also clean up some stale math includes and improper floatingpoint usage.
2021-07-04Everywhere: Prefer using "..."sv over StringView { "..." }Gunnar Beutner
2021-06-17Everywhere: Add component declarationsGunnar Beutner
This adds component declarations so that users can select to not build certain parts of the OS.
2021-06-13Calculator: Fix offensive button misalignmentAndreas Kling
The UI of this application is still quite bad/uneven, but this at least fixes the most egregious button misalignment.
2021-05-23Calculator: Remove unused headersMax Wipfli
2021-05-23Calculator: Fix behavior when entering number starting with decimalMax Wipfli
This fixes a bug where entering a number like ".15" would result in "15" instead of "0.15"
2021-05-23Calculator: Use Checked to ensure entered values do not overflowMax Wipfli
This replaces the types of m_int_value and m_frac_value with Checked<u64> which makes it possible to check if the value overflowed when entering a digit. If that happens, the digit will just be ignored. This fixes #1263.
2021-05-23Calculator: Show decimal point immediately when typedMax Wipfli
2021-05-23Calculator: Handle keydown events correctly with all keyboard layoutsMax Wipfli
This changes the keydown_event handler to use codepoints instead of key codes for comparison if possible. This is so the functionality still works as intended with keyboard layouts where e.g. typing '+' actually results in KeyCode::Key_ExclamationPoint rather than KeyCode::Key_Plus. This also removes the unnecessary call to atoi().
2021-05-13Userland: Tighten a *lot* of pledges! :^)Andreas Kling
Since applications using Core::EventLoop no longer need to create a socket in /tmp/rpc/, and also don't need to listen for incoming connections on this socket, we can remove a whole bunch of pledges!
2021-05-01Everywhere: Rename app_menu to file_menu or game_menuAndreas Kling
2021-04-29Everywhere: Add missing comma between copyright year and nameLinus Groh
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-04-13Everywhere: It's now "Foobar", not "FooBar", and not "foo bar"Andreas Kling
I hereby declare these to be full nouns that we don't split, neither by space, nor by underscore: - Breadcrumbbar - Coolbar - Menubar - Progressbar - Scrollbar - Statusbar - Taskbar - Toolbar This patch makes everything consistent by replacing every other variant of these with the proper one. :^)
2021-04-10Calculator: Alt shortcuts and book title capitalization in menusAndreas Kling
2021-04-10Calculator: Add a separator line between the menu and the main UIAndreas Kling