Andreas Kling
39d1a9ae66
Meta: Tweak .clang-format to not wrap braces after enums.
2019-06-07 17:13:23 +02:00
Robin Burchell
1024dfa81a
StringViewize a bunch of things -- mostly LibGUI
2019-06-03 20:27:05 +02:00
Robin Burchell
0dc9af5f7e
Add clang-format file
...
Also run it across the whole tree to get everything using the One True Style.
We don't yet run this in an automated fashion as it's a little slow, but
there is a snippet to do so in makeall.sh.
2019-05-28 17:31:20 +02:00
Robin Burchell
8aecebe8f3
GTextEditor: Introduce triple click to select all
2019-05-16 01:24:34 +02:00
Andreas Kling
6b40b081b2
GTextEditor: Add a readonly mode.
2019-05-08 05:00:28 +02:00
Andreas Kling
71770e000b
GTextEditor: Add very basic automatic indentation.
...
This is off by default, but enabled by TextEditor. It simply inserts the
same number of leading spaces as the previous line when hitting Enter. :^)
2019-04-25 22:56:09 +02:00
Andreas Kling
e2e2c78332
GTextEditor: Double-clicking on a word should select that word.
2019-04-25 22:29:25 +02:00
Andreas Kling
0c88ce9ee3
GTextEditor: Expand the content "to-fill" for right aligned text.
...
When using a right-side text alignment, hook the resize event to make sure
that the content width is at least frame_inner_rect().width() wide.
This allows us to use content_width() as the anchor point for right aligned
text, rather than using the frame inner rect, which was clearly wrong in
the overflow case.
2019-04-24 23:42:49 +02:00
Andreas Kling
4bea3a4aa6
GTextEditor: Turn off the ruler by default.
...
You're usually not gonna want the ruler. TextEditor can enable it manually.
2019-04-24 23:06:44 +02:00
Andreas Kling
5c240af3f7
GTextEditor: Fix line_content_rect() behavior with custom alignments.
2019-04-24 22:46:27 +02:00
Andreas Kling
62f0aae4ca
GTextEditor: Add support for different text alignments.
...
Currently only CenterLeft and CenterRight are supported, but it would be
very straightforward to add other alignments as well.
2019-04-24 22:24:16 +02:00
Andreas Kling
ae3ec3fc37
LibGUI: Give GTextEditor a context menu.
...
Now GTextEditor manages its own editing actions (cut/copy/paste/etc) and
will show a context menu containing them when requested.
Apps that want to put a GTextEditor's actions in its menu can get to the
actions via public getters. :^)
2019-04-18 12:28:29 +02:00
Andreas Kling
32e5c8c689
GTextEditor: Add on_selection_changed callback.
...
This is probably a bit eager and won't coalesce all updates or even
ignore no-op changes to the selection.
2019-04-12 02:52:34 +02:00
Andreas Kling
c71ece77fa
VisualBuilder: Tweak grid size and add an (empty) toolbox window.
2019-04-11 04:01:17 +02:00
Andreas Kling
b8062f69d8
LibCore: Add CEvent and make LibGUI/GEvent inherit from it.
2019-04-10 16:56:55 +02:00
Andreas Kling
313ac51832
LibGUI: Turn GTextBox into a wrapper around a single-line GTextEditor.
2019-04-10 03:08:29 +02:00
Andreas Kling
151b7149e6
GTextEditor: Add GTextEditor::on_change callback for when content changes.
2019-04-09 16:20:36 +02:00
Andreas Kling
dcf6726487
WindowServer: Add support for per-window override cursors.
...
Use this to implement automatic switching to an I-beam cursor when hovering
over a GTextEditor. :^)
2019-03-31 23:52:02 +02:00
Andreas Kling
838a06096a
GTextEditor: Shift+Delete should delete the current line.
2019-03-25 13:14:02 +01:00
Andreas Kling
ed2303e2d8
TextEditor: The delete key should work even when there's no selection.
2019-03-20 23:11:00 +01:00
Andreas Kling
f0915641c5
TextEditor: Add "delete" action.
2019-03-20 18:16:04 +01:00
Andreas Kling
a6538feed1
LibGUI: Add GInputBox for getting a string from a modal dialog.
...
Use this to implement some of the toolbar actions in IRCClient. :^)
2019-03-19 01:41:00 +01:00
Andreas Kling
ec8bffb06d
LibGUI: Let GTextEditor deal with its horizontal padding internally.
...
I originally wanted to have the padding concept in GScrollableWidget
but it's really finicky with the ruler and everything.
2019-03-16 23:16:37 +01:00
Andreas Kling
3854e752cb
LibGUI: Make GTextEditor inherit from GScrollableWidget.
...
This is quite nice, now we can share a ton of logic. :^)
2019-03-16 16:54:51 +01:00
Andreas Kling
eb610b309e
LibGUI: Make class_name() public so you can always call it.
...
I found myself having to cast to GWidget* all the time when writing some
generic debugging code that just wanted to dump widget info.
2019-03-16 12:57:04 +01:00
Andreas Kling
7e3673f710
GTextEditor: Disable the ruler in single-line mode.
...
Also make it possible to hide the ruler in multi-line mode, if you should
want to do that. :^)
2019-03-15 17:54:05 +01:00
Andreas Kling
1fc283ed7d
IRCClient+LibGUI: Add an input box so we can send messages to channels.
...
Implement this using a GTextEditor with a special single-line mode.
This new mode needs some polishing, but it's already very useful.
2019-03-15 17:37:13 +01:00
Andreas Kling
8017c1e17c
GTextEditor: Let the Tab key insert up to 4 spaces.
2019-03-10 11:08:36 +01:00
Andreas Kling
5a28392660
GTextEditor: Use a subwidget for the scrollbar corner and tighten clipping.
2019-03-08 18:58:40 +01:00
Andreas Kling
032549d7bf
GTextEditor: Refactor selection into a GTextRange class.
...
This is a bit more expressive than "selection start + current cursor".
2019-03-08 18:28:24 +01:00
Andreas Kling
f40d11f06d
LibGUI+WindowServer: Implement drag-to-select behavior in GTextEditor.
...
To make this feel right, I needed to start passing keyboard modifiers along
with mouse events. That allows shift-clicking to extend the selection. :^)
2019-03-08 17:53:02 +01:00
Andreas Kling
c4937f01d8
GTextEditor: Simplify delete_selection().
2019-03-08 15:55:58 +01:00
Andreas Kling
48d48679b0
GTextEditor: Work on cut/copy/paste operations.
2019-03-08 14:08:15 +01:00
Andreas Kling
6576ac8332
GTextEditor: Add selected_text() function.
...
I don't have a clipboard to actually put the copied selection onto yet,
so just print the selected text to stdout so we can see what it is.
2019-03-08 01:59:59 +01:00
Andreas Kling
b5521e1b0d
GTextEditor: Add basic selection support.
2019-03-08 00:49:45 +01:00
Andreas Kling
9867fe1025
GTextEditor: Add a ruler column that always shows the line numbers.
2019-03-07 20:05:05 +01:00
Andreas Kling
187d7cb400
GTextEditor: Add write_to_file(String path) :^)
2019-03-07 17:06:11 +01:00
Andreas Kling
43d56b6f3a
GTextEditor: Support splitting lines at the cursor with the Return key.
2019-03-07 16:49:21 +01:00
Andreas Kling
38662f884d
GTextEditor: Merge with previous line if backspacing at column 0.
2019-03-07 16:15:25 +01:00
Andreas Kling
6094f592a9
GTextEditor: More work on basic line editing. Insert/remove characters.
2019-03-07 16:04:21 +01:00
Andreas Kling
8425ea971a
GTextEditor: Start working on editing, starting with inserting newlines.
2019-03-07 15:52:11 +01:00
Andreas Kling
b4df33e453
GTextEditor: Only paint lines inside the dirty rect.
...
This dramatically improves performance in large documents. :^)
2019-03-07 15:03:38 +01:00
Andreas Kling
ce35cddb1b
GTextEditor: Let's use a Vector for the line backing store.
...
I'm eventually gonna want to replace this with something more clever,
like a automagically splicing vector or something, but for now, at least
we move away from immutable Strings.
2019-03-07 14:35:32 +01:00
Andreas Kling
a21ecd440a
GTextEditor: Allow moving the cursor by clicking.
2019-03-07 14:02:10 +01:00
Andreas Kling
9997992907
GTextEditor: Make the cursor invalidation work with the padding().
2019-03-07 13:54:02 +01:00
Andreas Kling
6a6bcc5daf
GTextEditor: Add Home/End and Ctrl+Home/Ctrl+End navigation shortcuts.
...
For start/end of line and start/end of document respectively.
2019-03-07 13:21:51 +01:00
Andreas Kling
1ac71d1fb1
GTextEditor: Improvements to cursor rendering.
...
The view now scrolls along with you as you move the cursor around.
2019-03-07 13:13:25 +01:00
Andreas Kling
6db132069f
GTextEditor: Draw the cursor line in a slightly darker shade.
2019-03-07 02:24:46 +01:00
Andreas Kling
1f92636c6d
GTextEditor: Make the cursor blink while the editor is focused.
2019-03-07 01:05:35 +01:00
Andreas Kling
ca65ca2f2d
TextEditor: Show the current cursor position in the statusbar.
2019-03-07 00:46:29 +01:00