1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-19 02:35:06 +00:00
Commit graph

1186 commits

Author SHA1 Message Date
Andreas Kling
7b638e2d0d LibGUI: Make the Cancel/Okay buttons in GUI::FilePicker a little taller 2020-10-25 15:36:09 +01:00
Andreas Kling
8b12d200ba LibGUI: Raise toolbar button icons slightly when hovered :^)
This make buttons look extra clickable when hovered by lifting up their
icons (-1,-1) and painting a little icon-shaped shadow under them.

Partially inspired by the Office XP toolbars, although we don't go all
the way with the faux-hyperlink stuff that was all the rage back then.
2020-10-25 15:32:19 +01:00
Andreas Kling
688675e89b LibGUI: Make table view row height+padding font-size-relative
This makes tables look a lot nicer with different-sized fonts. :^)
2020-10-25 10:12:03 +01:00
AnotherTest
107a083b5a LibGUI: Update ShellSyntaxHighlighter to also highlight brace expansions 2020-10-25 10:09:27 +01:00
Tom
567f2f3548 LibGUI: Fix walking Splitter's child widgets 2020-10-25 06:52:48 +01:00
Tom
5f9906f188 LibGUI: Fix Splitter sometimes not working after widgets were resized
We need to skip over widgets that are not visible as the layout does
not update their location. This fixes finding the correct widgets
surrounding the splitter.

Fixes #3491
2020-10-25 00:13:20 +02:00
Tom
a19d8aade4 LibGUI: TableView should only scroll to the selected cell
Fixes #3825
2020-10-23 19:04:51 +02:00
Andreas Kling
3c5da01f94 LibGUI+LibGfx+Base: Make tooltips color theme aware :^)
Also tweak the default tooltip color to be more bright and yellow!
2020-10-23 12:01:14 +02:00
Andreas Kling
332d05f3fd LibGUI: Make GUI::Label respect the foreground color role 2020-10-23 11:57:00 +02:00
Andreas Kling
06a29e8aa5 LibGUI: Add some horizontal padding to multi-line IconView item titles
And don't use the padding from the item's text rect as extra space for
glyphs when breaking lines.
2020-10-23 09:44:56 +02:00
Andreas Kling
5b50174e5d LibGUI: Break IconView item titles into two lines if necessary
This is nice when long item titles don't fit. You can now hover them
(or select them) and we'll break the item text into two lines instead
of just one.

It might make sense to go even further in some cases. Perhaps when
hovering an item, we could show the full item text, painted above
all other items. That's something for a future patch.

It would also be nice if the text didn't jump back and forth when
going in and out of this mode. Also for a future patch.
2020-10-23 09:39:45 +02:00
Andreas Kling
0b746075d8 LibGUI: Tolerate Window::set_icon(nullptr)
Don't try to dereference a null icon. Instead just set a 16x16 empty
bitmap as the window icon.

This looks like the crash mentioned in #3817.
2020-10-22 18:24:15 +02:00
Tom
52a847a0eb LibGUI: Implement searching/jumping as you type in views
This allows the user to start typing and highlighting and jumping
to a match in ColumnsView, IconView, TableView and TreeView if
the model supports it.
2020-10-22 15:23:45 +02:00
Tom
307f0bc778 LibGUI: Fix scroll_into_view flipping between left/top and right/bottom
This fixes flipping between left/top and right/bottom when the rectangle
to make visible doesn't fit into the visible portion each time the
function is called.
2020-10-22 15:23:45 +02:00
Andreas Kling
1d96ecf148 Everywhere: Add missing <AK/TemporaryChange.h> includes
Don't rely on HashTable.h pulling this in.
2020-10-15 23:49:53 +02:00
AnotherTest
9545ed1c21 LibGUI: Fix wrong Sequence highlight range in ShellSyntaxHighlighter
This fixes the wrong highlight behaviour when a newline is used as
sequence separator:
```sh
echo foo
if foo {}
^ This character would previously be bold
```
2020-10-14 21:05:39 +02:00
Nico Weber
397e5766ff LibGUI: Make arrow-left/right with selection move cursor to edge of selection
This matches behavior on Linux, macOS, Windows, and it makes it possible
to hit ctrl-L arrow-right ctrl-backspace to edit the last component of
an URL in browser, or of the current path in File Manager.

Also make it so that ctrl-left/right does a word movement that starts
at the edge of the selection. This matches Linux and macOS, but not
Windows (which instead does a word movement relative to the cursor,
not the selection edge).
2020-10-08 23:22:30 +02:00
Andreas Kling
18b6c47178 LibGUI: Set initial AbstractButton background/foreground color roles
Widgets should respect the background/foreground roles in a way that
makes sense for the widget.
2020-10-08 23:21:39 +02:00
asynts
6ed3a4b5fe LibGUI: Add formatters for TextPosition and TextRange. 2020-10-06 20:29:26 +02:00
asynts
93d04b9f8d LibGUI: Add formatter for ModelIndex. 2020-10-06 15:04:37 +02:00
Tom
a7533eb29c LibGUI: Clear selection if right-clicking item that isn't selected
If we're right-clicking on an item that isn't currently selected, clear
the selection first.

Fixes #3665
2020-10-06 15:04:23 +02:00
Linus Groh
e80217a746 LibJS: Unify syntax highlighting
So far we have three different syntax highlighters for LibJS:

- js's Line::Editor stylization
- JS::MarkupGenerator
- GUI::JSSyntaxHighlighter

This not only caused repetition of most token types in each highlighter
but also a lot of inconsistency regarding the styling of certain tokens:

- JSSyntaxHighlighter was considering TokenType::Period to be an
  operator whereas MarkupGenerator categorized it as punctuation.
- MarkupGenerator was considering TokenType::{Break,Case,Continue,
  Default,Switch,With} control keywords whereas JSSyntaxHighlighter just
  disregarded them
- MarkupGenerator considered some future reserved keywords invalid and
  others not. JSSyntaxHighlighter and js disregarded most

Adding a new token type meant adding it to ENUMERATE_JS_TOKENS as well
as each individual highlighter's switch/case construct.

I added a TokenCategory enum, and each TokenType is now associated to a
certain category, which the syntax highlighters then can use for styling
rather than operating on the token type directly. This also makes
changing a token's category everywhere easier, should we need to do that
(e.g. I decided to make TokenType::{Period,QuestionMarkPeriod}
TokenCategory::Operator for now, but we might want to change them to
Punctuation.
2020-10-04 23:41:31 +02:00
AnotherTest
f164b808b5 Shell: Move everything to the Shell namespace
Also provide a basic default-constructor.
2020-10-04 23:12:28 +02:00
Andreas Kling
e64f43c3a7 LibGUI: Fix null pointer dereference in enter/leave event handling
If an enter/leave event is delivered to a widget after it is removed
from a window, we can't just assume a window is gonna be there.

Fixes #3669.
2020-10-03 19:47:56 +02:00
Andreas Kling
3b2120e7b6 LibGUI: Don't paint borders for invisible bars in ToolBarContainer 2020-10-03 19:43:25 +02:00
Andreas Kling
00f47bba23 LibGUI: Don't accomodate invisible children in ToolBarContainer height
Skip over invisible children so they don't take up vertical space in
the container. Also make sure we update the preferred size whenever the
widget layout is invalidated.

Fixes #3139.
2020-10-03 14:01:37 +02:00
Nico Weber
ef1b21004f Everywhere: Fix typos
Mostly in comments, but sprintf() now prints "August" instead of
"Auguest" so that's something.
2020-10-02 16:03:17 +02:00
Tom
7399874479 AK: Add trivial structure validation to SharedBuffer
If we're sharing buffers, we only want to share trivial structures
as anything else could potentially share internal pointers, which
most likely is going to cause problems due to different address
spaces.

Fix the GUI::SystemTheme structure, which was not trivial, which
is now caught at compile time.

Fixes #3650
2020-10-02 15:38:07 +02:00
Tibor Nagy
18c67b4002 LibGUI: Fix 1px misalignment of ColorButton selections in ColorPicker
Also use shrunken() to calculate the selection rects.
2020-10-02 13:08:32 +02:00
Itamar
a39c4cc340 HackStudio: Integrate with C++ Language Server
Editors now communicate with the c++ language server when openning and
editing c++ source files, and go through the language server to get
autocomplete suggestions.
2020-09-30 21:46:59 +02:00
Itamar
863f14788f HackStudio: Add C++ Language Server
The language server keeps track of the content of currently edited
files by receiving updates about edit actions.

Also, C++ autocompletion is no longer tied to HackStudio itself and
moved to be part of the language server.
2020-09-30 21:46:59 +02:00
Itamar
bf53d7ff64 LibCpp: Add library for working with c++ code
Moved the C++ Lexer we have from LibGUI to here, so that other
components could use it without linking with LibGUI.
2020-09-30 21:46:59 +02:00
AnotherTest
72b68221cc LibGUI: Add a Shell syntax highlighter 2020-09-30 20:05:24 +02:00
Andreas Kling
9225bfa95e LibGUI: Correct inline editor placement in ColumnsView
Thanks to @bugaevc for noticing that I didn't account for the 1px space
between columns, and for the space occupied by the item icon.
2020-09-28 12:27:56 +02:00
Tibor Nagy
8b293119ab LibGUI: Update color widgets when has_alpha is toggled in ColorPicker
Fixing a bug where the alpha spinbox wasn't immediately disabled when
color_has_alpha_channel was set to false.
2020-09-26 19:55:54 +02:00
Tibor Nagy
5b7decc3af LibGUI: Add alpha preview to ColorPicker 2020-09-26 00:00:08 +02:00
Linus Groh
7d83665635 LibJS+LibGUI+js: Handle UnterminatedRegexLiteral in syntax highlighters 2020-09-25 23:58:42 +02:00
AnotherTest
e250591ff3 LibGUI: Do not clear the selection on right-click 2020-09-25 23:55:33 +02:00
AnotherTest
6902a09e47 LibGUI: Register the 'ColorInput' and 'Frame' widgets 2020-09-25 23:55:33 +02:00
Ben Wiederhake
08f9bc26a6 Meta+LibHTTP through LibWeb: Make clang-format-10 clean 2020-09-25 21:18:17 +02:00
Ben Wiederhake
ede5dbd7b3 Meta+LibC through LibHTTP: Make clang-format-10 clean
Why break at LibHTTP? Because "Meta+Libraries" would be insanely large,
and breaking between LibHTTP and LibJS makes the commits roughly evenly large.
2020-09-25 21:18:17 +02:00
Andreas Kling
468a29f4a1 LibGUI: Register the "text" property on GUI::TextEditor 2020-09-25 20:43:35 +02:00
Andreas Kling
a5878175e2 LibGUI: Register the "text" property on GUI::Label 2020-09-25 20:41:30 +02:00
Andreas Kling
d3adbed231 LibGUI: Move keyboard item activation up to AbstractView
All views want the same behavior, so move this to the base class. :^)
2020-09-24 21:35:47 +02:00
Andreas Kling
d8553a6406 LibGUI: Stop editing in views when the view is hidden
This fixes an issue in FileManager where an editor opened in the table
view mode would remain open after switching to the icon mode.
2020-09-24 21:14:14 +02:00
Andreas Kling
5a0b1c46aa LibGUI: Make inline editing work in ColumnsView
All it took was overriding content_rect() :^)
2020-09-24 11:50:47 +02:00
Andreas Kling
f52527ef9c LibGUI: Move editing key handling up to AbstractView
We want all views to respond to the editing key as long as the relevant
edit trigger is activated.
2020-09-24 11:42:11 +02:00
Andreas Kling
ece555b684 LibGUI: Support inline editing in GUI::IconView
IconView now responds to the editing key (F2) if the view is editable.
It does feel a little bit weird to have content_rect() return the text
rect for an item, and not the whole item rect. This internal API could
probably be better.
2020-09-24 11:40:19 +02:00
Andreas Kling
701787b906 LibGUI: Support editing filenames through FileSystemModel :^) 2020-09-24 11:30:14 +02:00
Andreas Kling
7f8e18b86a LibGUI: Make SortingProxyModel forward is_editable() and set_data()
This will allow us to edit models through a SortingProxyModel. :^)
2020-09-24 11:29:21 +02:00