Commit Graph

28 Commits

Author SHA1 Message Date
Andres Vieira
be8dc41b9c LibGUI: Paint TextEditor background same as widget's if it's not enabled
Now TextEditor draws it's background as a colour that does not make the
user think it can be writed into. This also affects TextBox.
2020-04-28 15:14:02 +02:00
DexesTTP
424f47cbe5 LibGUI: Fix display issue when selecting multi-lines in TextEditor
When selecting the start of a multi-line line, a selection rect was
displayed for the whole line but the text wasn't rendered properly.
This change prevents the selection rect from being drawn in virtual
lines with no selected characters.
2020-04-24 20:29:47 +02:00
Andreas Kling
c350bb9178 LibGUI: Fix laggy mouse selection in TextEditor widget
We were letting the automatic scrolling timer drive all selection
updates to fix an unwanted acceleration that was happening. However,
if a mousemove occurs *within* the editor widget, we should just
handle it right then and there.
2020-04-24 19:14:22 +02:00
Valtteri Koskivuori
3339a77f6c
LibGUI: Don't accelerate TextEditor autoscroll on wiggle (#1897)
This little tweak fixes the issue where the scrolling speeds up
significantly if the user wiggles their cursor. Just something obvious
I spotted while watching the video :^)
2020-04-21 09:54:46 +02:00
angel
441c2715bb LibGUI: Add Select all action to TextEditor
Previously, TextEditor processed the Select all command directly on the
keydown event handler. For this reason, WindowManager would not process
it as an action for the focused control and an action with the same
keyboard shortcut from the parent could override the TextEditor's one
even when it is focused.

For instance, when pressing Ctrl+A on the FileManager's path bar, all
files were selected instead, which is not the expected behavior.

Now the Select all command is an actual action on TextEditor, so that
WindowManager can process it correctly before any other actions. I also
added an icon for it!
2020-04-20 22:43:40 +02:00
Andreas Kling
563a377f6b LibGUI: Fix unpleasant selection behavior when dragging far to the left
If you select some text and drag the cursor outside the widget on the
left hand side, we would previously suddenly snap the selection cursor
to the end of the line instead of keeping it at the start of the line
as you would expect. This patch fixes that. :^)
2020-04-20 21:39:07 +02:00
Andreas Kling
5c15c24976 LibGUI: Keep scrolling while drag-selecting outside a TextEditor
If you start selecting text and move the cursor outside the TextEditor
widget area without letting go of the mouse button, we will now keep
scrolling a little bit every 100ms.
2020-04-20 21:31:49 +02:00
Tibor Nagy
9e6e731a78 LibGUI: Remove G prefix from macros 2020-03-19 23:17:34 +01:00
Oriko
2a32330257 LibGUI: Add a ThemeChange event 2020-03-16 13:39:34 +01:00
Oriko
2b162ef794 LibGUI: Use themes for syntax highlighting 2020-03-16 13:39:34 +01:00
Oriko
137d68a2ae HackStudio: Abstract over syntax highlighter 2020-03-12 19:04:59 +01:00
Oriko
6d89f48dd8 LibGUI: Add underlines to highlighting 2020-03-12 19:04:59 +01:00
Oriko
03b1748d3f LibGUI: Clear old syntax highlighting 2020-03-11 10:05:01 +01:00
Shannon Booth
6a3b12664a LibGUI: Move Icon and FontDatabase into the GUI namespace
We also clean up some old references to the old G prefixed GUI classes

This also fixes a potential bug with using: C_OBJECT_ABSTRACT(GAbstractButton)
instead of C_OBJECT_ABSTRACT(AbstractButton)
2020-03-07 01:33:53 +01:00
Andreas Kling
3a34323a78 LibGUI: TextEditor should paint text with disabled color when disabled 2020-03-04 21:19:35 +01:00
Andreas Kling
22d0a6d92f AK: Remove unnecessary casts to size_t, after Vector changes
Now that Vector uses size_t, we can remove a whole bunch of redundant
casts to size_t.
2020-03-01 12:58:22 +01:00
Andreas Kling
ceec1a7d38 AK: Make Vector use size_t for its size and capacity 2020-02-25 14:52:35 +01:00
Tibor Nagy
5f913c67d9 LibGUI: Implement keyboard and mouse wheel events for SpinBox 2020-02-24 10:40:32 +01:00
Andreas Kling
c5d913970a LibGUI: Remove parent parameter to GUI::Widget constructor 2020-02-23 12:27:53 +01:00
Andreas Kling
bfd86c4631 LibGUI: Make GUI::Frame have the 2px sunken container look by default
The overwhelming majority of GUI::Frame users set the same appearance,
so let's just make it the default.
2020-02-23 11:10:52 +01:00
Tibor Nagy
c8bc53e987 LibGfx+LibGUI: Allow theming the text cursor 2020-02-20 14:19:30 +01:00
Tibor Nagy
33864ab715 LibGUI: Update TextEditor to use ruler colors from the system theme 2020-02-19 12:24:39 +01:00
Tibor Nagy
7ec1b2e44b LibGUI: Unfocused TextEditors should use inactive selection colors 2020-02-15 18:42:13 +01:00
Andreas Kling
e1ff4fa034 LibGUI: Remove more header dependencies from Widget.h 2020-02-15 00:24:14 +01:00
Andreas Kling
3fe2640c8c LibGfx: Add forward declaration header
This patch adds <LibGfx/Forward.h> with forward declarations for Gfx.
2020-02-14 23:31:18 +01:00
Andreas Kling
7323d085dd LibGUI: Single-line GUI::TextEditor should not have "go to line" action 2020-02-10 19:49:49 +01:00
Andreas Kling
bb8e65be41 LibGUI+HackStudio: Move syntax highlighting from HackStudio to LibGUI
This patch introduces the GUI::SyntaxHighlighter class, which can be
attached to a GUI::TextEditor to provide syntax highlighting.

The C++ syntax highlighting from HackStudio becomes a new class called
GUI::CppSyntaxHighlighter. This will make it possible to get C++ syntax
highlighting in any app that uses a GUI::TextEditor. :^)

Sidenote: It does feel a bit weird having a C++ lexer in a GUI toolkit
library, and we'll probably end up moving this out to a separate place
as this functionality grows larger.
2020-02-07 20:07:15 +01:00
Andreas Kling
6a9cc66b97 LibGUI: Remove leading G from filenames 2020-02-06 20:33:02 +01:00