Commit Graph

182 Commits

Author SHA1 Message Date
Andreas Kling
f13c62f225 GTextEditor: Fix double effect of backspace/delete in some cases. 2019-03-07 17:18:22 +01:00
Andreas Kling
f8b72ab3ab GTextEditor: Add basic PageUp/PageDown navigation support. 2019-03-07 17:11:17 +01:00
Andreas Kling
187d7cb400 GTextEditor: Add write_to_file(String path) :^) 2019-03-07 17:06:11 +01:00
Andreas Kling
a5bc20c733 GTextEditor: Support starting with an empty document. 2019-03-07 16:51:47 +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
a64b71fb3d GTextEditor: Support forward delete/merge with the Delete key. 2019-03-07 16:33:20 +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
60c1ab5fbe GTextEditor: Scroll the cursor into view before updating it. 2019-03-07 13:34:00 +01:00
Andreas Kling
9591acc212 GTextEditor: Remove some debug spam. 2019-03-07 13:26:02 +01:00
Andreas Kling
77198ef735 GTextEditor: Simplify update_cursor(). 2019-03-07 13:23:17 +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
dff57909a7 GTextEditor: Only draw the cursor line background shade when focused. 2019-03-07 02:26:44 +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
Andreas Kling
9158de6c41 Begin working on a graphical TextEditor.
It's gonna be a wrapper around a new GTextEditor widget so I can easily
reuse the functionality anywhere I need it. :^)
2019-03-07 00:31:06 +01:00
Andreas Kling
7df1121e1c LibGUI: GTableModel::data() should take a GModelIndex instead of int,int. 2019-03-06 19:56:47 +01:00
Andreas Kling
dc4e6dd7bc LibGUI: Fix LibGUI::to_string() for GVariant::Type::Float. 2019-03-06 19:49:59 +01:00
Andreas Kling
09ecef6299 GTableView: Ignore right clicks for now. 2019-03-06 19:44:18 +01:00
Andreas Kling
31d6b640eb Add a bold variant of Katica and make that the system's default bold font.
..and do some minor tweaks to the font rendering code.
2019-03-06 14:50:27 +01:00
Andreas Kling
66a5ddd94a More work on the variable-width font support.
Katica is now the default system font, and it looks quite nice. :^)
I'm gonna need to refine the GTextBox movement stuff eventually,
but it works well-enough for basic editing now.
2019-03-06 14:06:40 +01:00
Andreas Kling
7f6c81d90f Implement basic support for variable-width fonts.
Also add a nice new font called Katica. It's not used anywhere yet but
I'm definitely itching to start using it. :^)
2019-03-06 12:52:41 +01:00
Andreas Kling
0a86366c71 Make a preparation pass for variable-width fonts. 2019-03-06 11:03:10 +01:00
Andreas Kling
086a0fc969 LibGUI: Let GApplication::exec() call exit() instead of returning to main().
This sidesteps the problem of having various things on the heap that don't
get torn down. It's obviously not a great solution, but it'll work for now.
2019-03-05 12:48:59 +01:00
Andreas Kling
d932c03843 GTableView: Tweak focus appearance for selected items. 2019-03-04 11:17:25 +01:00
Andreas Kling
06bd2fb2d5 GTableView: Allow initiating keyboard navigation with no current selection. 2019-03-04 10:57:26 +01:00
Andreas Kling
7e955f7b60 GTableView: Tweak the look of column headers. 2019-03-04 10:54:34 +01:00
Andreas Kling
4ea7a51ecd LibGUI: Improve GStatusBar and GToolBar and share some code via GStyle. 2019-03-04 10:47:54 +01:00
Andreas Kling
ac2a3f7fdf GTableView: Make the last column header separator look right. 2019-03-04 10:26:16 +01:00
Andreas Kling
f91a20f9d0 LibGUI: Unbreak clearing GTableView selection by clicking outside items.
Also, clicking on the column headers should not clear selection.
2019-03-04 10:18:05 +01:00
Andreas Kling
ef4d517429 LibGUI: Tweak focus appearance and add it to GTableView. 2019-03-04 10:12:09 +01:00
Andreas Kling
57fe316e01 Detect the "Logo" (Windows/Apple/whatever) key and use it for window resize.
This will be comfortable enough while I'm still developing with emulators.
QEMU keeps eating my "Alt" key presses and it's making things difficult.
2019-03-03 12:56:48 +01:00
Andreas Kling
5e40aa4f1a LibGUI: Move shortcut actions from GEventLoop to GApplications.
I'm gonna want to have nested event loops sooner or later, so let's not
pollute GEventLoop with things that are meant to work globally.

This patch also changes key events to pass around their modifiers as a
bitfield all the way around the system instead of breaking them up.
2019-03-03 12:32:15 +01:00
Andreas Kling
b0c673265a Applications: Map Alt+F4 to Quit in FileManager/ProcessManager/Terminal. 2019-03-03 02:52:22 +01:00
Andreas Kling
d94abc4f81 FileManager+LibGUI: Add a simple location textbox.
The widget layout here is a bit off and needs work.
2019-03-03 00:34:40 +01:00
Andreas Kling
63cdc3d2d5 LibGUI: Support GTableView navigation with Page Up and Page Down.
Also base the vertical scrollbar's gutter range on the visible content rect,
making it very similar to a Page Up/Down. Maybe they should be exactly the
same, I don't know.
2019-03-02 23:58:45 +01:00
Andreas Kling
596a5ce5a4 LibGUI+WindowServer: Add app-global keyboard shortcuts.
This patch adds a GShortcut class. Each GAction can have a GShortcut which
will cause the event loop to listen for that key combination app-globally
and activate the event in case it's pressed.

The shortcut will also be displayed when the action is added to a menu.

Use this to hook up Alt+Up with the "open parent directory" action in the
FileManager app. :^)
2019-03-02 10:10:06 +01:00
Andreas Kling
574a399347 LibGUI: GTableView should scroll items into view when keyboard navigating. 2019-03-01 14:29:34 +01:00
Andreas Kling
b5dcad932e LibGUI: Allow basic keyboard navigation in GTableView.
Pressing Enter will now "activate" the selected index, meaning that
the model gets a call to activate(GModelIndex).
2019-03-01 13:48:08 +01:00
Andreas Kling
e1d0a3f226 LibGUI: Let GTableModel handle the selection instead of doing it virtually.
It's silly to force every subclass models to deal with selection.
2019-03-01 13:03:13 +01:00
Andreas Kling
9c21874d33 LibGUI: GTableView scrolling ranges should be based on the available area.
We have to subtract the headers and scrollbars to get the correct behavior.
2019-03-01 11:04:55 +01:00
Andreas Kling
6c2089c59d Put miscellaneous debug spam behind #ifdefs. 2019-03-01 10:51:58 +01:00
Andreas Kling
b5e5f26a82 Base: Add Csilla Bold 7x10 variant.
It's nice to have a thin and a bold variant to complement each other.
2019-03-01 02:50:50 +01:00