Commit graph

9850 commits

Author SHA1 Message Date
AnotherTest
98d25324fd LibLine: Add a hook to run when an interrupt is handled
We do not want to clog up signal handlers by putting possibly complex
logic inside them, so allow the editor to handle that.
2020-05-13 15:07:44 +02:00
Andreas Kling
2c45076e68 PaintBrush: Let's have a tool (pen) checked on startup 2020-05-13 15:06:11 +02:00
Andreas Kling
1631077b74 PaintBrush: Put all the tool buttons into an action group
This allows us to easily make them exclusive and uncheckable. :^)
2020-05-13 14:48:17 +02:00
Andreas Kling
0de3b1c4bf PaintBrush: Oops, fix typo in ImageEditor::keyup_event() 2020-05-13 14:37:12 +02:00
Andreas Kling
d045972559 PaintBrush: Add keyboard shortcuts for all tools
I've used the shortcuts from GIMP for the most part, since that's what
I'm used to. We can definitely iterate on these to find better options
as the app develops. :^)
2020-05-13 14:23:08 +02:00
Andreas Kling
24f9406784 PaintBrush: Most tools still care about mousemoves outside layer
This allows you to do things like start a line outside the layer,
or spray a little outside but still partly hitting the layer. :^)
2020-05-13 13:50:35 +02:00
Andreas Kling
96d03546ef PaintBrush: Make the line, rectangle and ellipsis preview work again
You can now see what you're drawing before committing to it. This works
by passing the second_paint_event from the ImageEditor to the tool.
We also pass the active layer which makes it easier for the tool to
keep his logic in layer-relative coordinates even while drawing preview
states directly into the ImageEditor backing bitmap.
2020-05-13 13:43:20 +02:00
Andreas Kling
8318842c7e PaintBrush: Make the move tool handle arrow key events
You can now nudge layers around with the arrow keys. :^)
2020-05-13 13:21:49 +02:00
Andreas Kling
06405e83d7 PaintBrush: Make ImageEditor forward keydown and keyup events to tool 2020-05-13 13:21:49 +02:00
Andreas Kling
55d96715ff PaintBrush: Make the ImageEditor accept focus 2020-05-13 13:21:49 +02:00
Andreas Kling
8882b6bd9a PaintBrush: Remove the PaintableWidget
Moved the current colors to ImageEditor for now, although I don't think
that will be their final home.
2020-05-13 13:21:47 +02:00
Linus Groh
de42ddfd93 LibJS: Trim whitespace from string before coercing to number 2020-05-13 09:36:20 +02:00
Linus Groh
f39c7c2978 LibJS: Use String::trim_whitespace() for String.prototype.trim*() 2020-05-13 09:36:20 +02:00
Linus Groh
1febee768d AK: Replace String::trim_spaces() with String::trim_whitespace()
As suggested by @awesomekling in a code review and (initially) ignored
by me :^)

Implementation is roughly based on LibJS's trim_string(), but with a fix
for trimming all-whitespace strings.
2020-05-13 09:36:20 +02:00
Linus Groh
0c14ee035c LibJS: Make string to number coercion work for doubles 2020-05-13 09:36:20 +02:00
Linus Groh
7b8765c311 LibJS: Make the Function() constructor throw a SyntaxError, not return 2020-05-13 09:34:25 +02:00
DexesTTP
aab998e776 WindowServer: Invalidate the cursor when setting an override cursor 2020-05-13 09:33:37 +02:00
Andreas Kling
415d6fb230 Revert "Build: Use fakeroot if non-root build is possible"
This reverts commit 3d342f72a7.

This is causing trouble for macOS users. Also it's painfully slow
compared to using the sudo method. This should definitely not be
the default since it punishes people who have genext2fs installed.
2020-05-13 01:18:14 +02:00
Linus Groh
d69ed91790 LibJS: Check AssignmentExpression LHS in parser
There are many cases which shouldn't even parse, like

null = ...
true = ...
false = ...
123 = ...
"foo" = ...

However this *is* valid syntax:

foo() = ...

So we still have to keep the current code doing a runtime check if the
LHS value is a resolvable reference. I believe this was declared valid
syntax to *in theory* allow functions returning references - though in
practice that isn't a thing.

Fixes #2204.
2020-05-13 01:15:29 +02:00
Linus Groh
063228c02e LibJS: Handle empty values in operator<<()
Otherwise something like dbg() << Value(); chokes on
ASSERT_NOT_REACHED() in Value::to_string()
2020-05-13 01:14:22 +02:00
Andreas Kling
fbeaf76f96 PaintBrush: Update the LayerModel when moving layers around
This ensures that the layer table view always shows the correct
coordinates for the layer.
2020-05-13 00:21:13 +02:00
Andreas Kling
40ffa8c626 PaintBrush: Switch to the "move" cursor while moving layers around 2020-05-13 00:16:54 +02:00
Andreas Kling
c2b5519ce2 LibGUI+WindowServer: Allow apps to use the "move" cursor :^) 2020-05-13 00:16:40 +02:00
Andreas Kling
23ee68c63e PaintBrush: Borrow the "move" cursor for the "move" tool :^) 2020-05-13 00:11:47 +02:00
Andreas Kling
3d50f40396 PaintBrush: Add a "Move" tool for moving layers around :^)
Tool mouse event handlers now receive both a layer-relative mouse event
and the original event. This is needed for the move tool since it moves
the layer and thereby changes the origin of future events every time it
moves.
2020-05-13 00:09:04 +02:00
Andreas Kling
58ee75c87a PaintBrush: Silence debug spam in Image compositing 2020-05-13 00:00:24 +02:00
Andreas Kling
9566f6c8b3 PaintBrush: Let's have Layer::rect() and Layer::relative_rect()
These two have the same semantics as GUI::Widget. The rect() is always
at location { 0, 0 }, while the relative_rect()'s location is relative
to the "parent", which in this case is the Layer's Image.
2020-05-12 23:49:52 +02:00
Andreas Kling
83d24dcb1d PaintBrush: Port all the existing toolbox tools to the Layer world :^)
Many tools are not working perfectly right yet, but we'll fix them!
2020-05-12 23:44:46 +02:00
Andreas Kling
7dd8f1b921 LibGUI: Add missing Vector.h include to Event.h 2020-05-12 23:28:08 +02:00
Andreas Kling
35c2d389f5 PaintBrush: Show the layer stack in a table view on the right hand side 2020-05-12 23:00:23 +02:00
Andreas Kling
985c2550c1 PaintBrush: Start refactoring to support layer-based images
The main editing widget is now the new ImageEditor widget, which works
on an Image object, which internally has a stack of Layer objects.

Layers are composited back-to-front when painting the Image inside an
ImageEditor.
2020-05-12 22:22:45 +02:00
Andreas Kling
a87f5e4154 Browser: Allow Ctrl+clicking on bookmark bar buttons :^) 2020-05-12 20:35:45 +02:00
Andreas Kling
977863ea07 LibGUI: Include keyboard modifier state with button on_click calls
This will allow you us to implement special behavior when Ctrl+clicking
a button.
2020-05-12 20:31:16 +02:00
Andreas Kling
3a905aed06 SystemMonitor: Remove the toolbar above the process table
This was looking a bit too whimsical and didn't really fit with the
overall look of the window anymore. The actions are available via
the context menu still.
2020-05-12 19:51:36 +02:00
Andreas Kling
8b8a5fc6c6 LibHTTP+ProtocolServer: Use CaseInsensitiveStringTraits for headers
These are supposed to be interpreted caselessly so let's just use the
case insensitive traits throughout. This means we'll understand things
like "Content-Length" even when they send "content-length" etc.
2020-05-12 19:10:01 +02:00
Andreas Kling
413ab652c8 LibIPC+IPCCompiler: Templatize encoding/decoding of Optional<T>
This was the last one! IPCCompiler no longer has any type-specific
encoding/decoding logic! :^)
2020-05-12 19:04:05 +02:00
Andreas Kling
6800f6eff5 LibDesktop: Remove accidental unused struct 2020-05-12 19:04:05 +02:00
Andreas Kling
fbda28248a LibGfx+IPCCompiler: Add IPC encoders for Color and ShareableBitmap 2020-05-12 19:04:03 +02:00
Andreas Kling
f8e3c8326d Terminal: When offering to open a URL, show name + icon for handler app
Instead of just saying "Open URL" when you right click on a hyperlink
in the terminal, we now say something like "Open in Browser". :^)
2020-05-12 18:49:24 +02:00
Andreas Kling
512c04c64f LaunchServer+LibDesktop: Add API to list handlers for a given URL
You can now ask for a list of applications that can handle opening
a given URL. This will be useful for creating context menus.
2020-05-12 18:49:24 +02:00
Andreas Kling
3775983dfe LibIPC+LibGfx: Templatize IPC encoding as well as decoding
Now most classes dictate how they are serialized and deserialized when
transmitted across LibIPC sockets. This also makes the IPC compiler
a bit simpler. :^)
2020-05-12 18:49:24 +02:00
Andreas Kling
cba4880301 LaunchServer: Remove tab characters in LaunchServer.ipc 2020-05-12 18:49:24 +02:00
Linus Groh
1383cd23bc LibJS: Add missing keywords/tokens
Some of these are required for syntax we have not implemented yet, some
are future reserved words in strict mode.
2020-05-12 18:47:38 +02:00
Andreas Kling
388ae07960 Browser: Some action fixes
- Use the same reload action in menu and toolbar
- Scope more actions inside Browser::Tab
2020-05-12 17:07:20 +02:00
Andreas Kling
8c51063a88 LibGUI: Actually check widgets in focus chain for keyboard shortcuts
We were iterating the ancestor chain of the focused widget when looking
for a matching keyboard shortcut, but we didn't actually look at the
ancestors at each step.

With this fix, we now correctly activate actions found in the ancestor
chain of the focused widgets. :^)
2020-05-12 17:05:00 +02:00
Andreas Kling
479f16bb6c LibGUI: Add KeyEvent::to_string()
This makes it way easier to debug key events.
2020-05-12 17:03:17 +02:00
Andreas Kling
90eec0a3d7 LibGUI: Use KeyCode stringification helper in Shortcut::to_string() 2020-05-12 17:02:33 +02:00
Andreas Kling
0ac9986c2f Kernel: Add a stringification helper for KeyCode 2020-05-12 17:02:20 +02:00
Andreas Kling
39d55d1d76 LibGUI: Add a way to highlight the focused widget for debugging
You can now pass --gui-focus-debug to any GUI::Application and it will
draw a cyan rectangle around the currently focused widget.
2020-05-12 15:48:31 +02:00
Andreas Kling
e064999e0d LibGUI: Allow scrolling through a ComboBox with the mouse wheel 2020-05-12 15:11:06 +02:00