Commit Graph

1574 Commits

Author SHA1 Message Date
RasmusNylander
35afd32a51 KeyboardMapper: Fix displaying null characters
Fixes a bug where KeyButtons would display null characters. A single
null character should be handled as an empty string.
2022-01-06 17:54:03 +01:00
RasmusNylander
41b0795f99 KeyboardMapper: Name formerly inlined variables
Renames some variables in KeyButton.cpp to increase clarity and grants
some slightly opaque inline variables names.
2022-01-06 17:54:03 +01:00
RasmusNylander
c4b2efd95e KeyboardMapper: Show multiple pressed keys at once
When depressing a key, KeyboardMapperWidget::keydown_event() will now
update only the pressed state of the button associated with the specific
key, instead of also setting the pressed state of the all the buttons to
false.

This makes it possible to highlight multiple pressed keys at once and
makes the code more consistent; the implementation of keyup_event
implied that this was a feature of the program.
2022-01-06 17:54:03 +01:00
RasmusNylander
a1531dba91 KeyboardMapper: Extract method map_from_name
Extract the mapping of a name to a character map into its own method.
This only slightly reduces the number of lines, going from 24 to 17
lines, but makes the code somewhat more readable and reduces repetition.
2022-01-06 17:54:03 +01:00
RasmusNylander
b2a6c9e5ea KeyboardMapper: Extract creation of map-selection buttons
Extract the creation of map-selection radio buttons from create_frame
into the new private method add_map_radio_button(map_name, button_text)
turning 24 lines into 4 + 6 lines. This makes create_frame a little
easier to read. :^)
2022-01-06 17:54:03 +01:00
Tobias Christiansen
923979ca93 PixelPaint: Unveil FileIconProvider.ini
This is used by the Filter Gallery and previously complained in the
debug log that it was not unveiled.
2022-01-06 15:13:05 +01:00
Lucas CHOLLET
75d1840cfc FileManager: Show Dotfiles when passing a Dotfile as an argument
Before this patch, FileManager was failing to open the directory and
open `/` instead.
2022-01-05 15:20:54 -08:00
Lucas CHOLLET
693ae73606 FileManager: Use String const& instead of String
Change ErrorOr<int> run_in_windowed_mode(String, String)
to ErrorOr<int> run_in_windowed_mode(String const&, String const&)
2022-01-05 15:20:54 -08:00
Mustafa Quraish
7c69830169 PixelPaint: Add new icon for New Image from Clipboard
This is just a slight variation of `/res/icons/16x16/paste.png`, I've
removed the lines on the paper to make it look consistent with the
"New Image" icon, which is an empty piece of paper.
2022-01-05 12:08:20 +01:00
Mustafa Quraish
e2c73a114d PixelPaint: Use 'save' action in toolbar instead of 'save as'
I think this is likely the more common operation and makes more sense
in the toolbar. It calls the 'save as' action internally anyway if there
is no associated file.
2022-01-05 12:08:20 +01:00
Mustafa Quraish
c03f271bbf PixelPaint: Ask about unsaved changes for all tabs on close
Now, when trying to close the application, there is a separate prompt
for each open tab with unsaved changes. Each tab is closed after it is
handled appropriately (assuming the user didn't Cancel), this makes it
so that the message box is always asking about the currently active tab,
allowing the user to see that the image contains.

If at any point the user presses "Cancel", all remaining tabs are kept
open.
2022-01-05 12:08:20 +01:00
Mustafa Quraish
915211252d PixelPaint: Mark editor as unmodified when creating a default image
This is similar to opening an empty text file in TextEditor, the user
is only asked to saved changes if they have made any changes to it.
2022-01-05 12:08:20 +01:00
Mustafa Quraish
fc5c327751 PixelPaint: Mark editor as unmodified when opening an image
Previously a newly opened (and unedited) project was considered
modified, even though there was no need to actually re-save the
contents.
2022-01-05 12:08:20 +01:00
Mustafa Quraish
8c4579bced PixelPaint: Only prompt for unsaved changes if there any
Previously MainWidget::request_close() would always put up the
message box asking to save unsaved changes, even if there aren't any.
This patch makes it so that the message box is only shown if the
undo stack is in a modified state.
2022-01-05 12:08:20 +01:00
Mustafa Quraish
2440d2c2fe PixelPaint: Move title and path from Image to ImageEditor
As noted in the latest hacking video, it doesn't seem to make much
sense to store the title and path in the image itself. These fields
have now been moved to the actual ImageEditor itself.

This allows some nice simplicfications, including getting rid of the
`image_did_change_title` hook of ImageClient (which was just a way to
report back to the editor that the title had changed).
2022-01-05 12:08:20 +01:00
Andreas Kling
219339d2a5 FontEditor: Use GUI::MessageBox::ask_about_unsaved_changes() 2022-01-04 21:49:44 +01:00
Andreas Kling
1a54ac262a PixelPaint: Make ImageEditor::m_undo_stack a regular value member 2022-01-04 21:49:44 +01:00
Andreas Kling
490d385d01 PixelPaint: Use GUI::MessageBox::ask_about_unsaved_changes()
To make the last-saved-at timestamp show up correctly, we also now mark
the editor's undo stack as unmodified on save.
2022-01-04 21:49:44 +01:00
Andreas Kling
82b071943d PixelPaint: Add "save" action
Let's have this as a complement to the "save as" action :^)
2022-01-04 21:49:44 +01:00
Andreas Kling
5c68e91dd7 TextEditor: Use early return style in "save" action callback 2022-01-04 21:49:44 +01:00
Andreas Kling
7178c39a78 TextEditor: Show time-since-last-save in "unsaved changes" dialogs :^) 2022-01-04 21:49:44 +01:00
Andreas Kling
c08872f5da TextEditor: Use GUI::MessageBox::ask_about_unsaved_changes() 2022-01-04 21:49:44 +01:00
Tobias Christiansen
f92172c7c3 PixelPaint: Add a Bloom filter
A bloom filter creates fringes around bright areas in the image
mimicking the behavior of real-world cameras.
It gets its own category "Artistic" in the Filter Gallery since its not
one filter per se but a combination of multiple.

The filter works as follows:
- Get only the light areas (above a threshold) of the image
- Blur that image
- Compose onto the original image
2022-01-04 21:41:14 +02:00
Tobias Christiansen
9d45e5ac8f PixelPaint: Add the FastBoxBlurFilter with configurable parameters :^)
The FastBoxBlurFilter has been living in LibGfx for a while and now
it's accessible in PixelPaint. The parameters for the filter are exposed
via the new Filter Gallery.
2022-01-04 21:41:14 +02:00
Rummskartoffel
902b8f1583 Calendar: Port to LibMain and TRY all the things 2022-01-04 20:46:17 +02:00
Tobias Christiansen
fd90e10600 PixelPaint: Fix crash on applying with no filter selected
The wrong conception that done() would stop the program flow right there
lead to the lambda not properly aborting when no filter was selected.

The ExecAborted would be processed and then the nullptr that was
m_selected_filter would be happily dereferenced.

This patch fixes that.
2022-01-04 18:36:27 +02:00
Tobias Christiansen
d42abb3c7b PixelPaint: Use the wrapped filters for the Filter Gallery
Now, the filters can supply the Filter Gallery with a GUI::Widget such
that the user can interact with the filter. The Filter Gallery in turn
only calls apply() on the filter once it should be run.

This decouples the PixelPaint filters a lot from the ones supported by
LibGfx and paves the way to filters with settings.

For now there still are just the plain LibGfx filters so this change
feels like introducing a lot of boilerplate, but in the future there
will be a lot more to see.
2022-01-04 14:40:00 +01:00
Tobias Christiansen
0deadcdb28 PixelPaint: Create wrappers for all supported filters 2022-01-04 14:40:00 +01:00
Tobias Christiansen
5cf0357be1 PixelPaint: Create Filter base class
All the filters will need a wrapper around them, and this is going to be
their base class
2022-01-04 14:40:00 +01:00
Tobias Christiansen
ea19f6dd4a PixelPaint: Extend Filter Gallery dialog to accommodate settings
For now, the space is empty, but it's there.
2022-01-04 14:40:00 +01:00
Andrew Kaster
5cbc734081 SystemMonitor: Remove unused functions and enable warning globally
These two helpers were the only unused functions clang could detect in
the entire codebase. Now that's commitment to no dead code :^)
2022-01-04 07:51:31 +00:00
Andrew Kaster
f8ea9cd64e Userland: Resolve unused-but-set-varaible warnings
These are almost always bugs, so enable globally.

Remove unused counter variables in SystemMonitor and disk_benchmark.
2022-01-04 07:51:31 +00:00
Andrew Kaster
a103a85ae6 Userland: Locally suppress -Wc99-designator and re-enable globally
There's only two places where we're using the C99 feature of array
designated initalizers. This feature seemingly wasn't included with
C++20 designated initalizers for classes and structs. The only two
places we were using this feature are suitably old and isolated that
it makes sense to just suppress the warning at the usage sites while
discouraging future array designated intializers in new code.
2022-01-04 07:51:31 +00:00
Andrew Kaster
c8cfd6661a Userland: Resolve -Woverloaded-virtual in LibGUI and SoundPlayer
Enable the warning project-wide. It catches when a non-virtual method
creates an overload set with a virtual method. This might cause
surprising overload resolution depending on how the method is invoked.
2022-01-04 07:51:31 +00:00
Maciej
28ea412251 PixelPaint: Make paste action create new image if no editor is opened
This matches GIMP behaviour.
2022-01-04 07:29:50 +00:00
Maciej
41d02bd5e6 PixelPaint: Add a way to quickly create an image from clipboard
Ctrl+Shift+V, like in GIMP.
2022-01-04 07:29:50 +00:00
Linus Groh
85f0fc2b83 LibJS: Return Optional<T> from Completion::{value,target}(), not T
In the end this is a nicer API than having separate has_{value,target}()
and having to check those first, and then making another Optional from
the unwrapped value:

    completion.has_value() ? completion.value() : Optional<Value> {}
    //                       ^^^^^^^^^^^^^^^^^^
    //         Implicit creation of non-empty Optional<Value>

This way we need to unwrap the optional ourselves, but can easily pass
it to something else as well.

This is in anticipation of the AST using completions :^)
2022-01-03 21:50:50 +01:00
martinfalisse
b39aede8fe Spreadsheet: Background fill color after reaching vertical end
When selecting a cell in the spreadsheet that was added
automatically as per the InfinitelyScrollableTableView
implementation, the background color is now filled correctly.

Previously, when navigating horizontally in a spreadsheet, after
a certain point the cells would not have the same background fill
color as the user would have experienced in the previous column
ranges (A-Z).
2022-01-03 22:30:04 +03:30
Samuel Bowman
4711d789c9 CrashReporter: Move progressbar into main window
Previously we would create a temporary progress window to show a
progressbar while the coredump is processed. Since we're only waiting
on backtraces and CPU register states, we can move the progressbar
into the main window and show everything else immediately while the
slow parts are generated in a BackgroundAction.
2022-01-03 16:19:47 +01:00
kleines Filmröllchen
c748c0726a SoundPlayer: Don't enqueue samples depending on the GUI loop
Previously, SoundPlayer would read and enqueue samples in the GUI loop
(through a Timer). Apart from general problems with doing audio on the
GUI thread, this is particularly bad as the audio would lag or drop out
when the GUI lags (e.g. window resizes and moves, changing the
visualizer). As Piano does, now SoundPlayer enqueues more audio once the
audio server signals that a buffer has finished playing. The GUI-
dependent decoding is still kept as a "backup" and to start the entire
cycle, but it's not solely depended on. A queue of buffer IDs is used to
keep track of playing buffers and how many there are. The buffer
overhead, i.e. how many buffers "too many" currently exist, is currently
set to its absolute minimum of 2.
2022-01-02 22:18:37 +01:00
kleines Filmröllchen
59601b67a0 SoundPlayer: Remove resolved FIXME
I already resolved this some time ago but apparently forgot about it :^)
2022-01-02 22:18:37 +01:00
Lucas CHOLLET
7532ef78ad Calculator: Round small number to prevent crash
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-02 15:42:13 +01:00
Lucas CHOLLET
939bf3e864 Calculator: Remove KeypadValue::operator>
This method was declared but not implemented, and will probably never be
useful.
2022-01-02 15:42:13 +01:00
Lucas CHOLLET
eb8df0ae2a Calculator: Display zero with only one character
This patch prevents zero to be displayed as "0.00". The value is now
always printed with only one character.
2022-01-02 15:42:13 +01:00
Filiph Sandström
ec28af0aef DisplaySettings: Add 1440p ultrawide resolution 2022-01-02 13:27:02 +01:00
Filiph Sandström
022b4a3ed3 ThemeEditor: Add "alignment" support 2022-01-01 22:51:53 +01:00
Conor Byrne
e92b6047ad HexEditor: Port HexEditor to LibMain 2022-01-01 14:47:15 +01:00
Tobias Christiansen
3528563e3d PixelPaint: Move all filters into the Filter Gallery 2022-01-01 14:38:59 +01:00
Tobias Christiansen
f2feebc6f6 PixelPaint: Expand Filter Gallery to know how to apply filters 2022-01-01 14:38:59 +01:00
Tobias Christiansen
ddaf496aa0 PixelPaint: Make the ImageEditor known throughout the Filter Gallery 2022-01-01 14:38:59 +01:00