Commit Graph

1368 Commits

Author SHA1 Message Date
Nico Weber
6c9bc18a79 Userland: Fix typos 2021-10-01 01:18:52 +01:00
davidot
0f5fe3b70e SpreadSheet: Fix that non first sheets could not access global functions
Because we declare the functions in runtime.js we need the correct
global object to be setup otherwise they cannot be accessed when
switching to the SheetGlobalObject.
2021-09-30 15:37:56 +01:00
davidot
5611285312 SpreadSheet: Fix that the js integration abused global objects
Before this commit it only allocated the global object so when it wanted
to lookup 'thisSheet' it could not find it in the global environment.
We now hotswap the global object everytime a cell evaluated.

This also fixes that SheetGlobalObject did not have an
internal_has_property meaning 'A0' could not be referenced unless it was
via a member lookup (this.A0). This was already broken before the
bindings refactoring.

The correct behavior of realms in spreadsheet is not completely clear
since what is shared between sheets is not very well defined.

The reason that just setting the SheetGlobalObject as the
global_this_value is not enough is because ECMAScript does not check the
global_this_value for members when resolving a reference in the global
environment.
2021-09-30 08:16:32 +01:00
Rodrigo Tobar
840822b8f1 LibSymbolication+SystemMonitor: Show ELF object in stack
This small patch allows SystemMonitor's Stack tab to show the name of
the ELF object to which the displayed address refers to. This gives a
bit more of contextual information to the viewer.

A better to show this is probably a table, but I'm not that familiar yet
with the GUI framework in general, so I'm keeping things simple.
2021-09-30 00:51:08 +02:00
Linus Groh
e5409c6ead LibJS: Convert internal_set() to ThrowCompletionOr 2021-09-29 23:49:53 +01:00
Linus Groh
6c2b974db2 LibJS: Convert internal_get() to ThrowCompletionOr 2021-09-29 23:49:53 +01:00
Marcus Nilsson
1026819135 PixelPaint: Add new icons for layer actions
Add icons for three more layer actions.
2021-09-29 20:04:20 +02:00
Marcus Nilsson
578318ca0f Browser: Use CommonActions where possible and various fixes
This replaces some actions with CommonActions and also adds '...' to
menu items that require user input.
2021-09-29 20:04:20 +02:00
Brian Gianforcaro
ea2d68d14b Assistant: Zero initialize fuzzy match array
SonarCloud flagged the read of the matches array as a potential garbage
read. I don't believe the case it flagged was possible to reach due to
how the code is structured, however we should really just be zero
initializing these stack arrays.
2021-09-28 10:58:09 +02:00
Rodrigo Tobar
ad33efbc8c SystemMonitor: Unveil /usr/local/lib
This is necessary to symbolicate libraries installed under
/usr/local/lib.
2021-09-28 10:55:14 +02:00
Andreas Kling
a79bdd2bd5 LibWeb+Browser: Make ad blocking work in the multi-process world
We now send the list of content filters over to new WebContent processes
after creating an OutOfProcessWebView. :^)
2021-09-27 11:40:56 +02:00
Karol Kosek
1803c5966d ThemeEditor: Show currently opened theme path in the window title
You can open files since #9979, so let's show the path there
to distinguish open theme files more easily!
2021-09-26 12:44:51 +02:00
Karol Kosek
5a5f6d11ef PixelPaint: Close image tabs on middle click 2021-09-25 23:34:02 +02:00
Karol Kosek
df195188bc PixelPaint: Close New Image dialog after pressing return key
13e526de43 added the feature to new Layer
dialog. This patch adds it to Image dialog to stay consistent across
the app. :^)
2021-09-25 23:34:02 +02:00
thankyouverycool
fde48f1a7a FontEditor: Allow editing new font header
And make use of mapping functions moved from
LibGUI/FontPickerWeightModel.h => LibGfx/FontStyleMapping.h
2021-09-24 14:59:39 +02:00
Idan Horowitz
ab594e5f2f LibJS: Convert Value::invoke and VM::call to ThrowCompletionOr 2021-09-23 23:59:13 +03:00
thankyouverycool
bbaebdcd00 FontEditor: Keep selected glyph in view on resize 2021-09-22 21:35:42 +02:00
thankyouverycool
efe44451ca FontEditor: Make update_{statusbar,preview} member functions
For use outside constructor. Renames demo to preview to make
the UI and code comport.
2021-09-22 21:35:42 +02:00
thankyouverycool
e8f3fda3cf FontEditor: Remove reprobe_font()
This was used to update GlyphMapWidget on Type changes and is
no longer needed since removal of Type enumeration in bb592ae.
2021-09-22 21:35:42 +02:00
thankyouverycool
144d32d537 FontEditor: Sanitize RTL and control glyphs in Clipboard metadata
Fixes display issues in ClipboardHistory.
2021-09-22 21:35:42 +02:00
thankyouverycool
0a4640e892 FontEditor: Put glyph width changes on the undo stack
And select the restored glyph on undo/redo.
2021-09-22 21:35:42 +02:00
thankyouverycool
1ae4caca4b FontEditor: Set width to zero when deleting a glyph
Previously, Delete left a glyph's width maximized.
2021-09-22 21:35:42 +02:00
thankyouverycool
ca6cb6cec3 FontEditor: Simplify initialization by disabling widget callbacks
Reduces some complexity dealing with callback effects and fixes
redundant calls to update_title and erroneously set glyph widths.
2021-09-22 21:35:42 +02:00
Andreas Kling
9d7fe39640 CrashReporter: Show coredump loading progress in the Taskbar :^) 2021-09-21 20:52:29 +02:00
Andreas Kling
f6f9599899 CrashReporter+LibCoredump: Show progress window while loading coredump
Some coredumps take a long time to symbolicate, so let's show a simple
window with a progress bar while they are loading.

I'm not super happy with the factoring of this feature, but it's an
absolutely kickass feature that makes crashing feel 100% more responsive
than before, since you now get GUI feedback almost immediately after a
crash occurs. :^)
2021-09-21 20:52:29 +02:00
Andreas Kling
4f224b15ed CrashDaemon+CrashReporter: Streamline crash reporting a little bit
Before this patch, this is what would happen after something crashed:

1. CrashDaemon finds a new coredump in /tmp
2. CrashDaemon compresses the new coredump (gzip)
3. CrashDaemon parses the uncompressed coredump and prints a backtrace
4. CrashDaemon launches CrashReporter
5. CrashReporter parses the uncompressed coredump (again)
6. CrashReporter unlinks the uncompressed coredump
7. CrashReporter displays a GUI

This was taking quite a long time when dealing with large programs
crashing (like Browser's WebContent processes.)

The new flow:

1. CrashDaemon finds a new coredump in /tmp
2. CrashDaemon mmap()'s the (uncompressed) coredump
3. CrashDaemon launches CrashReporter
4. CrashDaemon goes to sleep for 3 seconds (hack alert!)
5. CrashReporter parses the (uncompressed) coredump
6. CrashReporter unlinks the (uncompressed) coredump
7. CrashReporter displays a GUI
8. CrashDaemon wakes up (after step 4)
9. CrashDaemon compresses the coredump (gzip)

TL;DR: we no longer parse the coredumps twice, and we also prioritize
launching the CrashReporter GUI immediately when a new coredump shows
up, instead of compressing and parsing it in CrashDaemon first.

The net effect of this is that you get a backtrace on screen much
sooner. That's pretty nice. :^)
2021-09-21 20:52:29 +02:00
Karol Kosek
d1846867cd WidgetGallery+MouseSettings: Use LexicalPath::basename() 2021-09-20 15:59:34 +02:00
Marcus Nilsson
f9e0815c3b PixelPaint: Move Tools to it's own subdirectory
The PixelPaint source directory was getting a bit large, let's move all
the Tools to it's own subdirectory. Also remove some unused includes.
2021-09-20 03:04:24 +00:00
Karol Kosek
65a5d66387 PixelPaint: Use main window's icon in the 'Create new image' widget 2021-09-19 20:05:58 +02:00
Andreas Kling
58f6bf8a4d CrashReporter: Add some margin around the backtrace & register views 2021-09-19 17:25:52 +02:00
thankyouverycool
dc65535b7c FontEditor: Add new tools to navigate code points
Visible glyphs can now be cycled through, or a code point specified
and jumped to directly.
2021-09-19 00:58:59 +02:00
thankyouverycool
a486415f03 FontEditor: Update editor to handle new font format
The editor now unmasks fonts on load, mapping their glyphs to the
complete unicode character set, and masks them upon saving to
reduce disk space. This is a naive approach in terms of memory
usage and can be improved but whose immediate goal is to allow
editing any glyph without concern for range allocation.
2021-09-19 00:58:59 +02:00
thankyouverycool
4540c1ffab TextEditor: Show total character and word count without selection 2021-09-19 00:21:37 +02:00
Andreas Kling
291dbff2e1 LibWeb: Remove the unused LayoutTreeModel
If we want to bring back this functionality, we'll have to rewrite it
for multi-process mode anyway.
2021-09-18 19:54:24 +02:00
Marcus Nilsson
401ea85655 Magnifier: Add 8x magnification and pausing
This adds an option for even more magnification, when you really need to
count pixels, as well as pausing the capture by pressing Space and
switching between magnification levels with keys 2, 4 & 8.
2021-09-17 23:48:42 +02:00
Julian Offenhäuser
8657148194 SystemMonitor: Make process memory statistics more human readable
These are the only instances in SystemMonitor which still show memory
statistics in KiB only. They will now adapt to the input size better.
2021-09-17 20:12:48 +02:00
Mustafa Quraish
090962823b PixelPaint: Allow selecting a custom aspect ratio for RectangleTool
If you enter a custom aspect ratio, and are not holding down shift,
the rectangle will be constrained to the entered aspect ratio
2021-09-17 11:54:13 +02:00
Mustafa Quraish
6ba3fc559f PixelPaint: Allow selecting a custom aspect ratio for EllipseTool
If you enter a custom aspect ratio, and are not holding down shift,
the bounding rect for the ellipse will be constrained to the entered
aspect ratio
2021-09-17 11:54:13 +02:00
Mustafa Quraish
f14c891ba5 LibGfx+PixelPaint: Add Point::end_point_for_aspect_ratio method
Previously we only had `Point::end_point_for_square_aspect_ratio`,
which was convenient for PixelPaint but assumed the aspect ratio
was always fixed at 1. This patch replaces it with a new mthod that
takes in an arbitrary aspect ratio and computes the end point based
off that.

There's some explicit casting going on in `Point.cpp` to ensure that
the types line up, since we're templating Point based on `T`.`
2021-09-17 11:54:13 +02:00
Eyad Hossam
fe9e2f463c Browser: Remove redundant tab::view() call from the tab constructor 2021-09-17 10:45:37 +03:00
Marcus Nilsson
dc9b18da22 PixelPaint: Implement automatic scrolling in LayerListWidget
The previous implementation of automatic scrolling in LayerListWidget
relied on mousemove events to perform the scrolling, which didn't
produce the expected behavior. Instead use the new auto scroll timer.
2021-09-16 22:29:21 +02:00
Marcus Nilsson
9fe43041f5 PixelPaint: Tweak layer/tool properties widget heights
There's no use for these two to be larger than necessary when
resizing the window.
2021-09-16 16:54:34 +02:00
Marcus Nilsson
b76fe6357a PixelPaint: Don't select the same layer twice in LayerListWidget
Without this check we would do an unnecessary partial second round
trip because of the call chain:
LayerListWidget::set_selected_layer() ->
LayerListWidget::on_layer_select() ->
ImageEditor::set_active_layer() ->
ImageEditor::on_active_layer_change() ->
LayerListWidget::set_selected_layer()
2021-09-16 16:54:34 +02:00
Marcus Nilsson
eaa99968fb PixelPaint: Don't update ImageEditor in set_active_layer()
Setting the active layer does not cause anything to render differently.
Thus no update is needed and the call to layers_did_change() is
unnecessary.
2021-09-16 16:54:34 +02:00
Karol Kosek
8f36429cb5 ThemeEditor: Save theme metrics and paths to file
Prior this change, custom title metrics seen in the Basalt theme
and custom icon paths in Redmond themes were dropped when saving a file.

Now any entry, even empty, will be saved.  This may end up with slightly
larger files, but on other hand, users will be able to see every option
in a text editor, without a need to look at the code/docs.
2021-09-16 16:52:55 +02:00
Zyper
344397557c PixelPaint: Add ability to draw squares and circles
Shift-key modifier for tools forces square aspect ratio.
It allows drawing squares with Rectangle Tool and circles
with Ellipse Tool.
2021-09-15 00:10:14 +00:00
Mustafa Quraish
0f749681a9 Everywhere: Use my fancy new serenityos.org email :^) 2021-09-13 20:51:50 +00:00
Andreas Kling
7f71f54fc3 Browser: Rename "DOM Inspector" to just "Inspector"
It inspects more than the DOM, after all. :^)
2021-09-13 22:21:57 +02:00
Mustafa Quraish
f28b2a875a PixelPaint: Make CloneTool change cursor temporarily while selecting
This just provides some nice visual feedback when you are in the
middle of selecting a color. An eyedropper might not be the ideal
choice here, but among the cursors we already have it is the
best one.
2021-09-13 22:13:22 +02:00
Mustafa Quraish
11263beaca PixelPaint: Add ImageEditor::update_tool_cursor() method
This just allows us to ask the image editor to update the tool's
current cursor. This is useful in cases where a tool may want to
change it's cursor for some operation, and wants to invalidate the
active cursor cached in the ImageEditor.
2021-09-13 22:13:22 +02:00
Mustafa Quraish
0472063b96 PixelPaint: Add a marker for CloneTool's selected position
Now we add a little marker to show the current sample position of
the CloneTool. The current implementation for updating the cursor
location is really dumb since it just updates the whole editor,
but that's a yak on the stack to fix.
2021-09-13 22:13:22 +02:00
Mustafa Quraish
fafbe417d1 PixelPaint: Incorporate CloneTool into toolbox 2021-09-13 22:13:22 +02:00
Mustafa Quraish
22b78226b3 PixelPaint: Add Clone Tool :^)
There's still a lot to be desired in terms of functionality and
usability, but this is a start. When using the clone tool, you
can press Alt to sample a location, and then the brush will clone
the color from there.
2021-09-13 22:13:22 +02:00
Mohsan Ali
102d345a8f ImageViewer: Enable and disable navigation
Before there was dialogs to indicate if
current file is last or first.

So in this commit, I added functionality to enable
and disable forward and backward navigation based
on if the next file is avialable or not and if the
pervious file is avialable or not, respectively.

ImageViewer: Refactor code and init data

Data intialization was not happening properly, now I did
Initializations properly so that navigation can work from
the very first image.
2021-09-13 23:46:16 +04:30
Andreas Kling
af8732435c Browser: Add some UI padding in the Inspector widget 2021-09-13 19:11:33 +02:00
Tetsui Ohkubo
eb326db028 FileOperation: Deduplicate destination file names on copy
When there is a file with the same name in the destination directory,
FileManager overwrites that file without any warning. With this change,
such a file will be automatically renamed to "emoji-2.txt", for example.

Also, currently there is a check in FileManager that makes copy and
paste of a file in the same directory no-op. This change removes that
check, because it is no longer a problem.
2021-09-13 18:08:34 +04:30
Mustafa Quraish
1d47d41c01 PixelPaint: Fix Line/Rectangle second paint alignment with pixels
The problem was a bit more complex than originally anticipated,
and the root of the problem is that the "coordinates" of a pixel
are actually the top left of the pixel, and when we're really
zoomed in, the difference in editor coordinates of the top-left
and the center of the pixel is significant.

So, we need to offset the "start" point when we are painting on
the editor to account for this, based on the current scale. This
patch adds a `editor_stroke_position` in `Tool` which can be used
to compute what point (in editor coords) we should use for a given
pixel and it's corresponding stroke thickness.

Note that this doesn't really work well with the ellipse, since that
is drawn with a different mechanism. Using this new method with the
`EllipseTool` seems to give the same (or slightly worse) results, so
I have not changed anything there for now.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
9097f86e51 PixelPaint: Call Layer::did_modify_bitmap() after drawing Ellipse
Previously, Any potential ImageClients would not have received an
update about the layer bitmap having been modified. This is similar
to what the other shape tools do upon completion.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
a5c8d1f7dd PixelPaint: Update editor after drawing shapes to clear outside
Previously, we didn't ask the editor to update after drawing a
Rectangle/Line. This meant that if any part of your shape went
outside the bounds of the image, that part would not be cleared out
until the next update of the editor.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
36bcd63c0c PixelPaint: Ensure thickness of shapes is never 0 when drawing
When drawing a line/rectangle/ellipse in `Tool::on_second_paint()`,
if `m_thickness * m_editor->scale()` was less than one, it would
get converted to 0 because of truncation. This was causing infinite
loops somewhere in the painter code and causing the application to
freeze.

Fixes #9986.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
c0373c3119 PixelPaint: Allowing drawing line from center, like other shapes
You could draw a Rectangle/Ellipse from the center by pressing down
the Alt key, but this was missing for lines. This commit adds it in
to keep consistency among the different shapes.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
c5b14fce54 PixelPaint: Adjust menu ampersand shortcut characters
A few of the menu items were missing shortcut characters completely,
so in the interest of keyboard navigation some have been added (even
if they are not ideal).

In a few menus, severals actions had the same menu shortcut, so the
later ones were not accessible through it. These have also been
differentiated.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
351dee4f8f PixelPaint: Properly transfer active tool to editor on tab close
Previously the code assumed that the active tool had a reference to
the old editor, which is the only way we had to check if it is
active without having a reference to the editor. However, when a
tab in PixelPaint is closed, the editor is destroyed, so the `WeakPtr`
in a tool referencing the old editor is no longer valid.

This made it so that if you closed a tab, the tool would appear to be
selected in the ToolBox, but the editor would not know about it at all.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
ecf8f243a6 PixelPaint: Have ToolboxWidget keep track of active tool
Since there's only one global toolbox, it makes sense to store the
active tool in here, since we don't really have control over the
deletion of an editor.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
ee25e2adc2 PixelPaint: Call Layer::did_modify_bitmap() when applying filters
Previously applying filters was not calling this method, which was
not correctly triggering the `image_did_modify_bitmap` call for
the `ImageClient`s. This patch makes the filter actions call this
method.

It seems that just opening one of the Window menus triggers a repaint
of the entire editor, which is what was causing filters to update
earlier, since we were only accessing them from the menu. Using
the keyboard shortcut added in a previous commit highlighted this issue.
2021-09-13 13:43:53 +02:00
Mustafa Quraish
672c4cdbc2 PixelPaint: Add keyboard shortcut for Invert filter
Many of the popular photo editing applications have Ctrl+I as a
shortcut to invert the colors, so let's get on board :^)
2021-09-13 13:43:53 +02:00
Mustafa Quraish
3dccafb2a0 PixelPaint: Draw layers from the top of LayerList
As pointed out by Andreas, drawing them from the bottom feels odd
since no other list in the UI is bottom-justified. The commit draws
the layers from the top of the list again.
2021-09-13 13:43:53 +02:00
kleines Filmröllchen
152ec28da0 Audio: Change how volume works
Across the entire audio system, audio now works in 0-1 terms instead of
0-100 as before. Therefore, volume is now a double instead of an int.
The master volume of the AudioServer changes smoothly through a
FadingProperty, preventing clicks. Finally, volume computations are done
with logarithmic scaling, which is more natural for the human ear.

Note that this could be 4-5 different commits, but as they change each
other's code all the time, it makes no sense to split them up.
2021-09-12 23:38:57 +02:00
Brian Gianforcaro
9a1181f748 Assistant: Use ElapsedTimer::start_new() 2021-09-12 17:24:44 +00:00
Brian Gianforcaro
6c0329c806 3DFileViewer: Use ElapsedTimer::start_new() 2021-09-12 17:24:44 +00:00
Mustafa Quraish
2afa28d297 PixelPaint: Let PickerTool optionally sample all layers
Previously, only the color from the selected layer would be picked.
Now, we allow the user to select if they want to sample the color
from all layers.
2021-09-12 17:48:14 +02:00
Mustafa Quraish
70d13ea66b PixelPaint: Write changed settings back to config file
In a previous commit we read default values from a commit file, this
commit now also writes back any changes to those settings made by
the user. Persistent settings always feel good :^)
2021-09-12 17:15:30 +02:00
Mustafa Quraish
677aa7b769 PixelPaint: Use config to get default values for Guides/Rulers/PixelGrid
Someone may not want to have these things enabled by default on every
startup, but toggle them on manually. So instead of having hard-coded
everything to be enabled by default, we now query LibConfig to find
out what the preference is. These values can still always be changed
from the Menus / with shortcuts.

It's not really ideal querying LibConfig twice, but when initializing
the menu we may not have an active editor, so we need to get the
value for both the menu checkbox as well as the internal property.
This shouldn't be too much of a big deal since LibConfig caches the
values anyway :^)
2021-09-12 17:15:30 +02:00
Mustafa Quraish
dd0cc58d6c PixelPaint: Allow panning when right-clicking with MoveTool
The MoveTool now lets you pan if you're dragging with a right click.
Previously, right-clicking did not perform any actions at all, so this
isn't removing any old functionality.
2021-09-12 17:14:57 +02:00
Mustafa Quraish
abefe2391d PixelPaint: Add setter/getter for ImageEditor::m_pan_origin
This allows us to use tools to change the panned position, since
right now this is only accessible internally to the editor.
2021-09-12 17:14:57 +02:00
Tobias Christiansen
acf3e230b0 PixelPaint: Fix zooming to cursor
This patch fixes the behavior of zooming. Now the cursor stays over the
same spot in the image when zooming.
2021-09-12 16:30:09 +02:00
Karol Kosek
a9ec98028b ThemeEditor: Accept drop events 2021-09-12 11:49:52 +02:00
Karol Kosek
4e1a794abe ThemeEditor: Update theme path on theme load
Prior to this change, the 'Save' action was saving a file to the startup
path (or just showed a File Picker dialog) if a file has been opened
by the Open action or by drag-n-dropping a file to the program.
2021-09-12 11:49:52 +02:00
Karol Kosek
be7ae76829 ThemeEditor: Rename main()'s preview_palette to startup_preview_palette
This is to avoid ambiguity from the preview_widget.preview_palette().
2021-09-12 11:49:52 +02:00
Karol Kosek
483db9334e ThemeEditor: Use preview_palette from the PreviewWidget
Prior this change, when you opened a file using the brand new Open
action and tried to change the Color Role or save it, then it would just
go back to the startup palette.
2021-09-12 11:49:52 +02:00
Karol Kosek
23137f0a8d ThemeEditor: Add 'Open file' menu action 2021-09-12 11:49:52 +02:00
Karol Kosek
09314ad611 ThemeEditor: Open files from an argument
This commit allows you to open a theme file from an argument, i.e.
`ThemeEditor Theme.ini`.
2021-09-12 11:49:52 +02:00
Karol Kosek
8c47f38ca5 ThemeEditor: Reference FileSystemAccessClient::Result in save_to_result
Found by clazy. It says the size is 32 bytes.
2021-09-12 11:49:52 +02:00
Karol Kosek
6995e428db ThemeEditor: Create menu contents after creating widgets
My next commits will be more readable that way. :^)
2021-09-12 11:49:52 +02:00
Andreas Kling
19de6bb1cc LibWeb+Browser: Add Debug menu action for toggling Same-Origin Policy
Sometimes it's useful to turn off the SOP for testing purposes.
Let's make that easy by having a Debug menu item for it. :^)
2021-09-12 02:13:28 +02:00
Mustafa Quraish
d38d03ce28 PixelPaint: Fit image to view when opened
When opening a file, make it fit on the screen. I think this is
sensible default behaviour.
2021-09-12 00:17:04 +02:00
Mustafa Quraish
f890f8529a PixelPaint: Make Fit Image To View account for rulers
Because of the way rulers are implemented in the ImageEditor
currently, the `Fit Image To View` action doesn't work correctly
with them enabled. This patch makes them adjust to the effective
viewport area and account for the rulers.

This is a bit of a hack, but the correct way to deal with this would
be to put the rulers in a new widget so they don't interfere with
the actual viewport rect (which is being used all over).
2021-09-12 00:17:04 +02:00
Mustafa Quraish
1e1e5bb5f7 PixelPaint: Remove unused methods to access files directly
After transitioning to FileSystemAccessServer, some of the methods
in `MainWidget` and `ProjectLoader` for opening files directly with
a filename as opposed to with a file descriptor are unused. This
commit removes them.
2021-09-12 00:17:04 +02:00
Mustafa Quraish
f337580191 PixelPaint: Use FileSystemAccessServer exclusively, remove unveil
Use the newly added API in FileSystemAccessServer to get read-only
access to a file specified on the commandline. We no longer need to
unveil any image / .pp files on the filesystem :^)
2021-09-12 00:17:04 +02:00
Mustafa Quraish
3141d51164 PixelPaint: Use LibConfig to allow custom pixel grid threshold
Depending on the size / scaling of the UI, someone might want to
change what the threshold is to show the pixel grid. For instance
if you are working on a 50x50 image, and want to see the grid while
still fitting the whole image in the editor.

Since there's no UI for settings in PixelPaint right now, this
commit just uses LibConfig to read the following entry:
    ("PixelPaint", "PixelGrid", "Threshold")
which is then used when drawing the grid.
2021-09-12 00:17:04 +02:00
Mustafa Quraish
451cba8b47 PixelPaint: Don't draw pixel grid outside image bounds
Fixes #9971
2021-09-12 00:17:04 +02:00
Timothy Flynn
9def17d4cb Spreadsheet: Use ErrorType::NotAnObjectOfType instead of NotA 2021-09-12 00:16:39 +02:00
Idan Horowitz
6704961c82 AK: Replace the mutable String::replace API with an immutable version
This removes the awkward String::replace API which was the only String
API which mutated the String and replaces it with a new immutable
version that returns a new String with the replacements applied. This
also fixes a couple of UAFs that were caused by the use of this API.

As an optimization an equivalent StringView::replace API was also added
to remove an unnecessary String allocations in the format of:
`String { view }.replace(...);`
2021-09-11 20:36:43 +03:00
Idan Horowitz
aba4c9579f Browser: Use String::count instead of String::replace(X, X, true)
There's no need to create a new String just to count the amount of
occurrences of a substring.
2021-09-11 20:36:43 +03:00
thankyouverycool
4e40eaf34c TextEditor: Remove wordiness and a separator in View menu
In many cases we can lean on the name of a menu to reduce verbosity.
"View"->"Visualize/Show/Turn on/etc" is a bit redundant and clutters
the menu. It's a little thing, but it makes the system feel more
tightly integrated if we stick to the same word patterns across apps.
2021-09-11 19:22:14 +02:00
thankyouverycool
9a5a9fbee0 LibGUI+TextEditor: Allow cursor line highlighting to be toggled 2021-09-11 19:22:14 +02:00
David Isaksson
a5ff941c86 PixelPaint: Add mouse indicators to the rulers 2021-09-11 19:16:29 +02:00
David Isaksson
e56764bd74 PixelPaint: Add rulers 2021-09-11 19:16:29 +02:00
David Isaksson
9bc8707cda PixelPaint: Draw guide lines and selections above the pixel grid 2021-09-11 19:16:29 +02:00
Andreas Kling
d42d655853 LibJS+LibWeb+Spreadsheet: Upcall visit_edges() via Base typedef
Let's use Base::visit_edges() when calling the base class, to prevent
accidentally skipping over anyone in the inheritance chain.
2021-09-11 14:10:11 +02:00
Mustafa Quraish
79bcb90887 PixelPaint: Add menu action to toggle pixel grid visibility
You can now toggle on/off the visibility of the pixel grid from
the View menu, if you don't want it shown for some reason.
2021-09-11 13:17:31 +02:00
Mustafa Quraish
4af0a99634 PixelPaint: Show a pixel grid when zoomed in enough
The editor now draws a grid showing the pixels if you are zoomed
in enough. Currently the threshold is a scale of 15 (so if one
pixel side on the image takes up > 15 pixels in the editor)
2021-09-11 13:17:31 +02:00
Ben Wiederhake
2223f22590 SystemMonitor: Avoid making StringView of temporary ByteBuffer 2021-09-11 13:22:51 +03:00
Ben Wiederhake
4ef9a1ba48 Spreadsheet: Avoid making StringView of temporary ByteBuffer 2021-09-11 13:22:51 +03:00
Tobias Christiansen
6f2a016565 PixelPaint: Add "Clear Guides" to remove all Guides
This patch adds a "Clear Guides" option to the "View"-menu.
2021-09-11 00:28:27 +02:00
Mustafa Quraish
a9e9bd8d84 HexEditor: Remove unveil() for CLI file, use FileSystemAccessServer
Previously we unveiled the file specified through the command-line
interface. Now, we just make the request through the
FileSystemAccessServer instead.
2021-09-10 20:46:50 +04:30
Mustafa Quraish
3a7e42ba73 TextEditor: Remove unveil() for CLI file, use FileSystemAccessServer
Previously we unveiled the file specified through the command-line
interface. Now, we just make the request through the
FileSystemAccessServer instead.
2021-09-10 20:46:50 +04:30
Mustafa Quraish
8378ecc67b TextEditor/FileArgument: Remove file existance check for early exit
This check was fine earlier when we had access to the full filesystem,
but now that we are moving away from applications having unveiled
access to the filesystem, this check would just get rejected from
the kernel. This is rare / fast enough that performance should not
really matter in any case.
2021-09-10 20:46:50 +04:30
Mustafa Quraish
63ff5873d8 PDFViewer: Open CLI files through FileSystemAccessServer without prompt
Use `request_file_read_only_approved()` for the file (if any) is
specified through a command line argument.
2021-09-10 20:46:50 +04:30
Mustafa Quraish
d9832f8d0b PixelPaint: Add Fit Image To View action
This is a feature I missed from Photoshop: it sets the scale and
position so that the image fits (it's longest dimension) into
the editor view. There's a 5% border left around the image to
provide context. This is just arbitrary seemed like the right
amount after some trial and error.
2021-09-09 11:35:50 +02:00
Mustafa Quraish
111ef19114 PixelPaint: Add "Brush Mode" to EraseTool :^)
Previously EraseTool would only let you have hard lines, similar
to PenTool. After inheriting from BrushTool in previous commits,
making the eraser (optionally) behave like a brush is much easier.

We only need to change how the colors are handled for the hardness,
which is why the `draw_point()` call is a bit more involved. Just
blending the colors doesn't work here since we actually want to
replace the previous color, unlike in BrushTool where we are just
layering the color on top.
2021-09-09 11:35:50 +02:00
Mustafa Quraish
ec73247e90 PixelPaint: Make EraseTool inherit from BrushTool
This removes all the code to handle events that was essentially
duplicated from BrushTool anyway :^)

I've also renamed "thickness"->"size" to have consistent
terminology.
2021-09-09 11:35:50 +02:00
Mustafa Quraish
160bd33874 PixelPaint: Make PenTool inherit from BrushTool
Most of the logic implemented in PenTool was the same as BrushTool
anyway, with the only difference being how the actual lines were
drawn at the end. We now just override the `draw_line()` and
`draw_point()` methods instead.

We don't strictly need to override `draw_line()` here, but that
would just result in repeated calls to `draw_point()`, which is
wasteful.

Also renamed "thickness"->"size" to have consistent terminology.
2021-09-09 11:35:50 +02:00
Mustafa Quraish
fbfa6543ab PixelPaint: Reoriganize drawing in BrushTool to allow more code reuse
The BrushTool is very cool, but it doesn't allow us to re-use any
of the code in other classes. Many of the other tools have duplicated
code for handling mouse events / keeping track of previous location,
etc.

This commit sets up BrushTool so that other tools can inherit from
it and override some virtual functions to allow similar behavior
without re-writing the code to keep track of mouse positions, etc.
In particular, we add public setters/getters for `size` and
`hardness` properties, and make `draw_point()` and `draw_line()`
virtual so that derived classes can override them.

Note: We still pass in `color` as a parameter for `draw_line()` and
`draw_point()` instead of using `color_for()` directly because it
doesn't really make sense to be constantly asking the ImageEditor
for the color when it's not really changing (for instance along all
the points of a line)
2021-09-09 11:35:50 +02:00
Mustafa Quraish
30df74b015 PixelPaint: Allow drawing line between 2 points with BrushTool
Sometimes you want to draw a straight line between 2 points, but
using the nice-looking brush we have instead of the hard line we
would get using the LineTool.

This patch adds the ability to click somewhere with the brush, and
then Shift+click somewhere else to draw a line between the two
points using the brush stroke. Seems like an obvious addition
considering we already have a helper function to draw lines :^)
2021-09-09 11:35:50 +02:00
Mustafa Quraish
3bf204fd03 PixelPaint: Fix BucketTool out of memory crashes
The BFS implementation for BucketTool's flood-fill had sitations
which could result in infinite loop, causing OOM crashes due to
the queue growing unbounded. The way to fix this is to keep track
of the pixels we have already visited in the flood-fill algorithm
and ignore those if we ever encounter them again.

This also fixes the crashing issue from #9003. We still need a
better way to account for transparency, but that is beyond the scope
of this commit, and this issue still exists without any transparent
pixels.
2021-09-09 11:27:48 +02:00
Timothy
1c78ff1b9f 3DFileViewer: Use unveil and FileSystemAccessServer
This will restrict 3DFileViewer's access to the file system.

3DFileViewer loads a texture based on the path of the model loaded, this
will request access to the texture file before loading.
2021-09-09 02:34:29 +02:00
Dawid Wolosowicz
ac798da642 SystemMonitor: West Const to East Const refactor 2021-09-08 15:48:02 +04:30
Dawid Wolosowicz
ec7879f628 SystemMonitor: Remove an unnecessarily specific inline capacity 2021-09-08 15:48:02 +04:30
Dawid Wolosowicz
000c74e6a8 SystemMonitor: Make the process list searchable 2021-09-08 15:48:02 +04:30
Andreas Kling
e91edcaa28 LibWeb: Rename InitialContainingBlockBox => InitialContainingBlock
The "Box" suffix added nothing here.
2021-09-08 11:27:46 +02:00
Ben Wiederhake
0a69da08aa Magnifier: Remove unnecessary global cursor tracking 2021-09-08 10:53:49 +02:00
Ben Wiederhake
2f38cad987 Assistant: Fix lockfile logic
Previously, Assistant was able to re-execute itself due to a quirk in
the global cursor tracking logic, it seems.

Now it has become necessary to explicitly drop the lockfile before
activating the new Assistant instance.

Alternatively, this has always been a latent bug that only now has
become more likely.
2021-09-08 10:53:49 +02:00
Ben Wiederhake
dbc8465c20 Assistant: Remove unnecessary global cursor tracking 2021-09-08 10:53:49 +02:00
Mustafa Quraish
405b282bc3 PixelPaint: Show mouse position in statusbar without active tool
Showing the position only with an active tool seems a bit confusing,
if you've opened up an image just to find out the coordinates of
a pixel for instance, there shouldn't be a need to have to select
a tool first.
2021-09-07 16:53:40 +02:00
Mustafa Quraish
736ab4f83a PixelPaint: Add Menu action/shortcut to close current image tab
Ctrl+W now closes the current Image tab.
2021-09-07 16:53:40 +02:00
Mustafa Quraish
255f729c1f PixelPaint: Register RectangleTool thickness slider as primary
... So we can use `[` and `]` shortcuts to change the size.
2021-09-07 16:53:40 +02:00
Mustafa Quraish
d6348e1b32 PixelPaint: Use correct thickness in RectangleTool::on_second_paint()
Previously, we were ignoring the scale of the editor in the second
paint step. If you were zoomed in, the size while you were drawing
was not the same as the size of the final shape.
2021-09-07 16:53:40 +02:00
Mustafa Quraish
603d3a5dc6 PixelPaint: Use correct thickness in LineTool::on_second_paint()
Previously, we were ignoring the scale of the editor in the second
paint step. If you were zoomed in, the size while you were drawing
was not the same as the size of the final shape.
2021-09-07 16:53:40 +02:00
Mustafa Quraish
0a9c64a4f5 PixelPaint: Use correct thickness in EllipseTool::on_second_paint()
Previously, we were ignoring the scale of the editor in the second
paint step. If you were zoomed in, the size while you were drawing
was not the same as the size of the final shape.
2021-09-07 16:53:40 +02:00
Andreas Kling
6ad427993a Everywhere: Behaviour => Behavior 2021-09-07 13:53:14 +02:00
Mustafa Quraish
285a888b61 PixelPaint: Fix layer dragging bug
A previous commit I made broke layer dragging since the hole_index
was always being computed with respect to the top of the layer list
widget, however we were now drawing layers from the bottom. When
you didn't have enough layers to fill up the full height, dragging
them around would be weird.

This patch computes the hole index correctly using the same offset
we start drawing from, and fixes the behavior.
2021-09-07 00:48:48 +02:00
Mustafa Quraish
905bc79387 PixelPaint: Add Crop to Selection Action
In addition to adding the action, this commit also makes the
`did_change_rect()` method take in an optional rect, which
represents the new rect position. By default it is the same as
`rect()`.

When we are cropping an image, we don't want to move the whole
cropped section to the top-left of the original image in the
ImageEditor widget, so this allows us to keep the cropped image's
position fixed.
2021-09-06 23:43:49 +02:00
Sam Atkins
95aa6562db Browser+WebContent: Initialize WebContentConsoleClient earlier
With this patch, we now initialize the `WebContentConsoleClient` as soon
as the Page has loaded, instead of waiting for the Console Window to be
shown. This finally lets us see log messages that happened before the
window was opened! :^)

However, it is not perfect. Waiting until the page has loaded means we
lose any messages that happen *during* page load. Ideally we would
initialize the WCCC when the page *starts* loading instead, but it
requires that the page has a document and interpreter assigned and
accessible. As far as I can tell with my limited knowledge, this is not
the case until the page has completed loading.
2021-09-06 18:20:26 +02:00
Sam Atkins
703bd4c9da Browser: Convert JS ConsoleWidget to new API
The console widget now requests messages and receives them in bulk,
using the shiny new IPC calls. This lets it display console messages
that occurred before the widget was created. :^)
2021-09-06 18:20:26 +02:00
Sam Atkins
ca2c129923 Browser: Reconnect the JS console when the current page changes
Previously, it would keep a pointer to the interpreter of the previous
page, which resulted in Crashy Fun Times.

This also changes the clearing behavior - instead of clearing the
console output every time the window is shown, we clear it when the page
changes. This is more useful, since before you would lose any log
messages that had happened before opening the window.
2021-09-06 18:20:26 +02:00
Sam Atkins
2b2158595f Browser: Move show_console_window() to Tab
Having the BrowserWindow assigning Tab's internals felt a bit wrong.
This is also a step towards removing BrowserWindow as a friend class.

While I was at it, changed the Tab to having a pointer to the
ConsoleWidget instead of the Window, since that is usually what we want
to use, and it's awkward having to static_cast the main-widget
repeatedly.
2021-09-06 18:20:26 +02:00
Sam Atkins
931f462b6e Browser: Delete unused BrowserConsoleClient.{h,cpp}
Since the Browser now only runs in multi-process mode, we have no use
for this single-process ConsoleClient. :^)
2021-09-06 18:20:26 +02:00
Anders Fimreite
2ecbe5dd71 Keyboard Mapper: Better text color for buttons in dark theme
When using a dark theme the name of the key does not show up well at
all. This is due to it being set with pallete().button_text(), which for
dark themes is a light color. As Keyboard Mapper does not follow the
system color theme, the text on the keys should not either.
2021-09-06 17:38:59 +02:00
Karol Kosek
cbc4c98a87 ThemeEditor: Make the model derived from ItemListModel
This will make the Combo Box list searchable as you type, because
ItemListModel has already that implemented.
2021-09-06 14:05:10 +04:30
Mustafa Quraish
c1ede97543 FontEditor: Don't loop over all glyphs to find selected one
Previously we would loop over all glyphs in the GlyphMap, compute
their rects, and then test to see if the mouse click position was
inside that rect. This is silly since each element in the glyph
map for a particular font is the same size, and we can just do
some coordinate manipulation to get the index directly.
2021-09-06 14:01:24 +04:30
Mustafa Quraish
f8570bd773 PixelPaint: Allow opening of files dropped onto application :^)
We can now drag-and-drop files onto PixelPaint to be able to open
them. Each dropped file opens in a separate editor (which is the
default behavior of Photoshop).
2021-09-06 10:36:08 +02:00
Mustafa Quraish
5a8c6b95e6 PixelPaint: Refactor main.cpp into MainWidget
Previously, all the UI setup was done in `main.cpp`, with a whole
bunch of lambdas,, and actions etc just being stored in the main
function. This is probably an artifact from back when it was first
created.

Most other applications now have a "MainWidget" class of some sort
which handles setting up all the UI/menubars, etc. More importantly,,
it also lets us handle application-wide events which we were
previously not able to do directly, since the main widget was just
a default GUI::Widget.

This patch moves all the core functionality of the PixelPaint
application into PixelPaint::MainWidget, which is then instantiated
by the main function. There is likely some more refactoring that
would help, but this commit is big enough as it is doing mostly
a direct port.
2021-09-06 10:36:08 +02:00
Ali Mohammad Pur
97e97bccab Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
Ali Mohammad Pur
3a9f00c59b Everywhere: Use OOM-safe ByteBuffer APIs where possible
If we can easily communicate failure, let's avoid asserting and report
failure instead.
2021-09-06 01:53:26 +02:00
Karol Kosek
1814f66c63 SoundPlayer: Convert to double before calculating
freq_bin was converted to double after it was calculated, so there was
a much higher probability it could be 0 instead of some comma number,
which meant that the bars always stayed on top.
2021-09-04 22:52:02 +02:00
Karol Kosek
43c37ae701 SoundPlayer: Simplify Bars Visualization drawing logic a bit
The freq_bin in bins_per_group was multiplied only to be divided later,
which could even result in a crash if you set higher buffer size
(like 1000ms) in PlaybackManager, due to rounding errors I presume.
2021-09-04 22:52:02 +02:00
Tom
d14d68c462 SystemMonitor: Fix CPU usage calculation
Casting u64 to float is probably not a safe thing to do. Also, keep
time deltas in u64 values as they can easily wrap between calculations.
This fixes CPU usage calculation when a process is spinning in a loop.
2021-09-04 21:48:46 +02:00
Karol Kosek
83c412ee9e SoundPlayer: Create only one playlist widget
Prior this change, opening a playlist always spawned a new widget.
This could end up with having a few the same widgets, which you couldn't
even close (besides the last one).
2021-09-04 21:03:01 +02:00
Andreas Kling
769f777098 Assistant: Use HashMap::ensure() in Database::did_receive_results() 2021-09-04 20:30:56 +02:00
Andreas Kling
6f6473d6a4 SystemMonitor: Use HashMap::ensure() in ProcessModel::update() 2021-09-04 20:30:56 +02:00
Tobias Christiansen
5d732711a2 PixelPaint: Fix broken opening of files from Shell
The fd would get closed when the File went out of scope, so we couldn't
open any file specified by 'pp <path to file>'. We need the fd to be
alive and we solemnly swear to take good care of it and close it
ourselves later.
2021-09-04 16:07:10 +02:00
David Isaksson
9699648b2a SystemMonitor: Make memory statistics dynamically formatted by size
Previously all memory values on the performance was formatted as KiB,
but with such formatting it can be quite hard to read large numbers
(as mentioned by Andreas on todays office hours livestream :^)).
This patch makes use of the human readable formatting utilies and
displays them in an easier to read format.
2021-09-04 16:05:32 +02:00
Mustafa Quraish
92df9d464a PixelPaint: Use Zoom and Eyedropper cursors
Use the newly added cursors for ZoomTool and PickerTool
2021-09-04 03:35:23 +02:00
Musab Kılıç
81326ac8c7 PixelPaint: Add invert filter 2021-09-04 03:35:17 +02:00
Mustafa Quraish
280cbf2e18 PixelPaint: Make tools use the new API for property change shortcuts
Every tool that has a slider now registers the primary/secondary
sliders and now uses the same keyboard shortcuts to modify the
primary and secondary properties. `[` and `]` for the primary,
`{` and `}` for the secondary.
2021-09-04 03:33:44 +02:00
Mustafa Quraish
d28fb8926f PixelPaint: Add mechanism for tools to use keyboard shortcuts
There are quite a few tools that might want to change certain values
based on consistent keyboard shortcuts. This commit allows tools to
hook up a "primary" and "secondary" slider with the base `Tool`
class, which can then handle updating those sliders with the common
shortcuts.

Note that any derived classes that want to override the `on_keydown`
function will manually need to call `Tool::on_keydown()`.
2021-09-04 03:33:44 +02:00
Thitat Auareesuksakul
8d36893ddf SoundPlayer: Add spacebar keyboard shortcut for play/pause 2021-09-04 03:33:35 +02:00
Mustafa Quraish
8f2521ce52 HexEditor: Use FileSystemAccessClient, add unveils
Most of the code here is based off the implementation of how
TextEditor uses FileSystemAccessClient.
2021-09-04 03:32:58 +02:00
Mustafa Quraish
eae21c7e31 PDFViewer: Use FileSystemAccessClient to open files 2021-09-04 03:32:30 +02:00
Mustafa Quraish
d645f637f1 PixelPaint: Add separator in image menu
I think it looks a bit nicer having a separator between the
"flip" and "rotate" sections.
2021-09-04 03:30:03 +02:00
Mustafa Quraish
7263e57ce8 PixelPaint: Allow modifiable thickness for RectangleTool :^) 2021-09-04 03:30:03 +02:00
Mustafa Quraish
6910cbc075 PixelPaint: Add Copy Merged action
This allows the user to copy the merged bitmap (all visible layers).
2021-09-04 03:30:03 +02:00
Tobias Christiansen
65d52467f4 PixelPaint: Parse saved Guides from the ProjectLoader in main
This patch allows PixelPaint to recreate saved Guides from .pp files.
2021-09-04 03:29:09 +02:00
Tobias Christiansen
508d563189 PixelPaint: Add ProjectLoader to abstract away opening of files
This new class will open and parse files (either images directly or .pp
project files) and one can get the parsed Image as well as other
information from it.

This patch removes a bunch of 'try_create_from..." methods from Image in
favor of using the ProjectLoader.

The only json_metadata that is available are Guides for now.
2021-09-04 03:29:09 +02:00
Tobias Christiansen
b3f53a0b5a PixelPaint: Save Guides when writing project to file 2021-09-04 03:29:09 +02:00
Tobias Christiansen
e867e4b84b PixelPaint: Move saving a project from Image into ImageEditor
The ImageEditor knows more about the image than Image itself. So to save
a project with all the information known to the program about an image
it's logical that ImageEditor performs that task rather than the Image.

There isn't any additional data added yet, but now there's the
possibility to do so.
2021-09-04 03:29:09 +02:00
Tobias Christiansen
60e526fdd2 PixelPaint: Move serialization of Image into seperate function
This eliminates duplicated code.
2021-09-04 03:29:09 +02:00
Karol Kosek
d81ba98976 SoundPlayer: Don't try to dereference null-pointer buffers
d049626f40 tried to resample the buffer
before checking if it points to a valid location.
This caused a crash, generally at the end of the file.
2021-09-04 03:28:33 +02:00
Musab Kılıç
0139a56aa5 Piano: Format slider values when initially set 2021-09-04 03:24:03 +02:00
Musab Kılıç
7b45653331 ImageViewer: Kindly ask the user if they want to delete a file 2021-09-04 03:22:46 +02:00
Musab Kılıç
764d31b6c3 Piano: Draw note names on top of notes 2021-09-03 23:34:38 +02:00
Daniel Bertalan
d7b6cc6421 Everywhere: Prevent risky implicit casts of (Nonnull)RefPtr
Our existing implementation did not check the element type of the other
pointer in the constructors and move assignment operators. This meant
that some operations that would require explicit casting on raw pointers
were done implicitly, such as:
- downcasting a base class to a derived class (e.g. `Kernel::Inode` =>
  `Kernel::ProcFSDirectoryInode` in Kernel/ProcFS.cpp),
- casting to an unrelated type (e.g. `Promise<bool>` => `Promise<Empty>`
  in LibIMAP/Client.cpp)

This, of course, allows gross violations of the type system, and makes
the need to type-check less obvious before downcasting. Luckily, while
adding the `static_ptr_cast`s, only two truly incorrect usages were
found; in the other instances, our casts just needed to be made
explicit.
2021-09-03 23:20:23 +02:00
Karol Kosek
ad5bd209ba DisplaySettings: Add context menu for wallpapers
This adds a 'Show in File Manager' action and copy path action to file
context menu for quicker navigation. :^)
2021-09-03 23:15:47 +02:00
Sam Atkins
e2c32a6c65 Everywhere: Use my shiny new serenityos.org email :^) 2021-09-03 12:22:36 +02:00
Andreas Kling
eaf88cc78a AK: Rename create<T> => make_ref_counted<T>
And also try_create<T> => try_make_ref_counted<T>.

A global "create" was a bit much. The new name matches make<T> better,
which we've used for making single-owner objects since forever.
2021-09-03 02:36:09 +02:00
Mustafa Quraish
ca6c9be94c PixelPaint: Add actions to rotate image left/right
This also required adding a new hook to `ImageClient`, since there
wasn't a way of telling the ImageEditor that the full rect of the
image has changed (as when we rotate).
2021-09-03 01:50:11 +02:00
Mustafa Quraish
6a8c408856 PixelPaint: Add actions to flip image vertically/horizontally 2021-09-03 01:50:11 +02:00
Mustafa Quraish
0c56f06994 PixelPaint: Draw layers from bottom of panel, adjust spacing
If we don't have enough layers to be able to scroll, the layers
are pushed to be at the top of the layer list. This doesn't make
much sense now that we are correctly drawing the layers in the
right order, so now we draw them justified towards the bottom.

Previously we were also clipping the bottom gadget slightly when
there were enough layers to scroll. Now, I'm adding some offset to
the total height to account for this and give equivalent spacing
from the top and bottom layers.
2021-09-03 01:49:32 +02:00
Mustafa Quraish
339f0d5bca PixelPaint: Add Merge Active Layer Down action
This allows you to merge the active layer with the one below it.
2021-09-03 01:49:32 +02:00
Mustafa Quraish
97cc34c034 PixelPaint: Fix the displayed order of layers in LayerListWidget
Previously the background layer was shown at the top, and layers
in front of it were shown below it. This was really unintuitive.

This patch fixes LayerListWidget to now properly differentiate
between the index of a gadget, and the index of a layer, since they
are essentially mirrored. I chose not to modify the order in which
layers are stored since back-to-front makes it really convenient
there.
2021-09-03 01:49:32 +02:00
Musab Kılıç
432839c2e9 FileManager: Kindly ask the user if they want to delete a file 2021-09-02 23:52:29 +02:00
Sam Atkins
724f45c784 Browser: Reload the DOM Inspector's JSON data when loading a new page
Of course, there are other reasons the DOM might change, but one thing
at a time. :^)
2021-09-02 22:16:41 +02:00
Sam Atkins
73c95bcd5f Browser: Reset the DOM Inspector's state when re-opening it
This resets the DOM Inspector to a default state when re-opening it,
instead of it displaying the previous selection and properties, which
may be outdated. This is closer to how Chrome and Firefox behave.
Eventually, it probably makes sense to copy their behavior of selecting
the `<body>` element by default.
2021-09-02 22:16:41 +02:00
Sam Atkins
97379ace25 Browser: Implement "Inspect Element" context menu action
This is finally working for OOPWV! :^)
2021-09-02 22:16:41 +02:00
Sam Atkins
3b07f49d48 LibWeb+WebContent: Implement asynchronous DOM Node properties call
This lets us "push" a new style-properties list to the DOM Inspector,
for example when JS changes the style of the inspected node.
2021-09-02 22:16:41 +02:00
Sam Atkins
1da07734bb Browser: Display style properties in DOM Inspector
This makes use of the new `inspect_dom_node()` IPC call.
2021-09-02 22:16:41 +02:00
Sam Atkins
fe820f6d5a LibWeb: Replace unused DOMTreeModel with DOMTreeJSONModel
The direct-Document-access DOMTreeModel is no longer used, since the DOM
Inspector has to access the Document remotely over IPC. This commit
removes it, and renames DOMTreeJSONModel to take its place, since it no
longer has to differentiate itself from the non-JSON one.

In case that didn't make sense:
- Delete DOMTreeModel
- Rename DOMTreeJSONModel -> DOMTreeModel
2021-09-02 22:16:41 +02:00
Sam Atkins
08aa7b77a7 Browser: Remove residual InProcessWebView code from DOM Inspector
This is no longer useful, and has to go before I can change how the
Models work.
2021-09-02 22:16:41 +02:00
Sam Atkins
2d6a02f03b Browser: Prevent opening multiple DOM Inspectors for the same Tab
Also simplify the logic by removing `Tab::view_dom_tree()`, and making
the Tab keep a pointer to the InspectorWidget instead of its Window,
since that's more often what we want to access.
2021-09-02 22:16:41 +02:00
Mahmoud Mandour
b069c1306c About: Display the full version 2021-09-02 16:17:18 +01:00
Karol Kosek
e3f7753233 TextEditor: Stop calling window->set_modified(false) on file save
We use TextEditor::on_modified_change() to update the modified window
flag, which it also works on file saves, so we don't have to unset
it there anymore!

It isn't really what the FIXME note asked about -- GUI::TextDocument
only sends us notifications about the changes, but overall I don't
think it's that bad, given that the whole window update logic is now
in one function. :^)
2021-09-02 09:12:51 +02:00
Mustafa Quraish
dd5ceb74e9 PixelPaint: Ctrl+click on palette colors now sets primary/secondary
Previously it would only change the color of the ColorWidget itself,
but not make it the primary/secondary color. I think it feels nicer
this way, if I'm adding a color to the palette I likely want to use
it.

If you *really* need to only change the color of the palette, you
can just Ctrl+Middle click.
2021-09-02 09:09:12 +02:00
Mustafa Quraish
8d8ec6365b PixelPaint: Allow changing colors temporarily without palette
Previously, if you wanted to use a custom color, the only way to
do so was to first Ctrl+click on one of the pallette colors, which
would just change that palette item. Then, you would need to
manually click on that color.

Now, you can just click on the preview of the primary/secondary
color to open up the picker and only temporarily use the new color
without affecting the palette at all.
2021-09-02 09:09:12 +02:00
sin-ack
8ea22121ac Userland: Migrate to argument-less deferred_invoke
Only one place used this argument and it was to hold on to a strong ref
for the object. Since we already do that now, there's no need to keep
this argument around since this can be easily captured.

This commit contains no changes.
2021-09-02 03:47:47 +04:30
thankyouverycool
902d24136b Welcome: Replace rand()/srand() with AK::get_random_uniform() 2021-09-02 00:39:12 +02:00
thankyouverycool
02121336b4 Welcome: Make license headers uniform 2021-09-02 00:39:12 +02:00
Dawid Wolosowicz
977b62a213 3DFileViewer: Maintain the FPS counter's position
Without this, any resize of the GLContextWidget might leave the label
somewhere it shouldn't be. Toggling fullscreen is a single example of
that behavior.
2021-09-01 23:04:10 +02:00
Andreas Kling
51ae913bfe LibIMAP: Stop leaking a Core::Promise<bool> in IMAP::Client::connect() 2021-09-01 23:02:18 +02:00
Dawid Wolosowicz
14c30af7d8 SpaceAnalyzer: Enable icons within the breadcrumbbar
The breadcrumbbar in here serves exactly the same purpose as the one in
File Manager. Given that, I believe it's worth to keep these two
visually consistent.
2021-09-01 23:00:28 +02:00