Commit graph

335 commits

Author SHA1 Message Date
Andreas Kling
31ba7ba2cc LibC: #define errno errno
This makes the binutils port build again, after the TLS changes.
2019-09-08 14:20:13 +02:00
Andreas Kling
64b1e9deec GTreeView: Make double-clicking toggle openable items 2019-09-07 21:45:06 +02:00
Andreas Kling
2f5b2685af GModel: Remove selected_index() and set_selected_index()
This breaks GSortingProxyModel selection preservation across resorts.
I'm not yet sure how we're going to solve that, but it's going to have
to work a bit differently than before, since the model itself no longer
knows what's selected.

Selection is now managed by GModelSelection which allows us to select
any arbitrary number of items, and to have different selections in
different views onto the same model. Pretty sweet. :^)
2019-09-07 21:39:44 +02:00
Andreas Kling
6dec328af7 LibGUI+FileManager: Add GAbstractView::on_selection_change hook
This hook will be called whenever the view's selection changes somehow.
Use this in the FileManager to keep the left and right views in sync.
2019-09-07 21:35:04 +02:00
Andreas Kling
fb18613e8a LibGUI: Convert various little things to GModelSelection
All the little things that were using the per-model seletion are now
moving over to GModelSelection.
2019-09-07 20:35:31 +02:00
Andreas Kling
d2d1a30d61 GListView: Switch to using GModelSelection to support multi-select 2019-09-07 20:31:11 +02:00
Andreas Kling
56c360591c GTreeView: Switch to using GModelSelection
We don't support multi-select in GTreeView yet. Some day though :^)
2019-09-07 20:15:33 +02:00
Andreas Kling
55bae788f0 GDirectoryModel: No need to clear the selected index in open()
Now that the view manages selection instead of the model, it's not
something GDirectoryModel needs to worry about anymore.
2019-09-07 20:01:18 +02:00
Andreas Kling
98a68c82bc GItemView: Make Ctrl+click toggle item selection on/off 2019-09-07 19:38:08 +02:00
Andreas Kling
a5e0242992 GTableView: Switch to using GModelSelection to support multi-select 2019-09-07 19:35:45 +02:00
Andreas Kling
b0f42ee672 GModelSelection: Add contains_row(int) and toggle(GModelIndex) 2019-09-07 19:33:58 +02:00
Andreas Kling
94b599e344 GItemView: Switch to using GModelSelection to support multi-select
This is really quite straightforward. Instead of using the GModel's
selected_index(), we now query/update the view's own GModelSelection.
2019-09-07 19:21:07 +02:00
Andreas Kling
82559e211d LibGUI: Add GModelSelection to help implementing multiple-select views
Each GAbstractView now has a GModelSelection backed by a simple
HashTable<GModelIndex>. When the selection changes somehow, the view
gets notified via the notify_selection_changed() callback.

In the future it will probably make sense to move to using some kind of
ranges as the internal representation instead.
2019-09-07 19:21:07 +02:00
Andreas Kling
19b69741ed GModelIndex: Add hash traits so we can make a HashTable<GModelIndex> 2019-09-07 19:21:07 +02:00
Andreas Kling
60cd3c093a LibDraw: Make sure we install libdraw.a so ports can link with -ldraw 2019-09-07 18:19:02 +02:00
Andreas Kling
29f58aef21 LibC: Add some missing pieces in inttypes.h 2019-09-07 18:18:43 +02:00
Andreas Kling
a635619cc0 GTabWidget: Rename get_active_tab() => active_tab_index() 2019-09-07 16:57:26 +02:00
Jesse Buhagiar
3f05799e41 LibGUI: GTabWidget can now return active tab index
`GTabWidget` now allows the user/caller to get the currently active
tab widget, meaning that actions that are applied globally (such as
an 'Apply' or 'OK' button) can now react to specific tabs etc.
2019-09-07 16:51:15 +02:00
Jesse Buhagiar
ecbc0322c1 Applications: Create a display properties manager
An interactive application to modify the current display settings, such as
the current wallpaper as well as the screen resolution. Currently we're
adding the resolutions ourselves, because there's currently no way to
detect was resolutions the current display adapter supports (or at least
I can't see one... Maybe VBE does and I'm stupid). It even comes with
a very nice template'd `ItemList` that can support a vector of any type,
which makes life much simpler.
2019-09-07 16:51:15 +02:00
Andreas Kling
af14b8dc59 LibC: Make "errno" thread-specific
Now that the kernel supports thread-local storage, we can declare errno
with the __thread keyword, which causes it to be per-thread.

This should fix all the stupid issues that happen when many threads use
the same errno. :^)
2019-09-07 15:57:02 +02:00
Andreas Kling
56e0e6be56 LibC: Borrow a slightly more functional getopt()
We were already borrowing a getopt() from the BSD family until the day
we write our own. This patch borrows a slightly more modern one so we
also get getopt_long().

Fixes #190.

See also #91 for the desire to eventually NIH our own getopt()..
2019-09-06 20:03:16 +02:00
Andreas Kling
6ab498edf7 GTextEditor: Paint line numbers with TopRight text alignment
This makes sure they line up with the first visual line for wrapped
lines that span multiple visual lines.
2019-09-06 19:24:16 +02:00
Andreas Kling
a791b86afa LibDraw: Add TextAlignment::TopRight
Also tidy up the alignment code to use switch statements.
2019-09-06 19:23:54 +02:00
Andreas Kling
73fdbba59c AK: Rename <AK/AKString.h> to <AK/String.h>
This was a workaround to be able to build on case-insensitive file
systems where it might get confused about <string.h> vs <String.h>.

Let's just not support building that way, so String.h can have an
objectively nicer name. :^)
2019-09-06 15:36:54 +02:00
Andreas Kling
b4a2bb9383 GScrollBar: Scrolling with the mouse wheel should use step increments 2019-09-06 15:01:08 +02:00
rhin123
1adec6d54b TextEditor: Removed unnecessary use of for_each
Didn't notice that m_visual_rect existed :P
2019-09-06 07:17:57 +02:00
Andreas Kling
7a906ab539 LibGUI: Teach GScrollableWidget how to hide unnecessary scrollbars
This is now an opt-in mode enabled by calling:

    should_hide_unnecessary_scrollbars(true)

This patch enables the mode for GTreeView and GTableView. :^)
2019-09-05 21:37:15 +02:00
Sergey Bugaev
6d3f52c4a4 Terminal: Add some basic emoji support
This is not as perfect as it is elsewhere in the system, as we cannot
really change how terminal "thinks about" characters and bytes. What
we can do though, and what this commit does, is to *render* emojis, but
make it seem as if they take up all the space, and all the columns their
bytes would take if they were all regular characters.
2019-09-05 16:37:39 +02:00
Sergey Bugaev
22e6978c71 WindowServer+LibGUI+FontEditor: Encode special characters as UTF-8 2019-09-05 16:37:39 +02:00
Sergey Bugaev
84bc6a92a7 LibDraw: Add emoji drawing support to Painter
From here on, all strings displayed to the user are expected to
be encoded as UTF-8. The next few commits will deal with a few
existing places where this requirement is currently violated.

https://github.com/SerenityOS/serenity/issues/490
2019-09-05 16:37:39 +02:00
Sergey Bugaev
27380b9d2b LibDraw: Add emoji support to the Font class
https://github.com/SerenityOS/serenity/issues/490
2019-09-05 16:37:39 +02:00
Sergey Bugaev
9d64c60e01 LibDraw: Introduce an Emoji class
This class can locate and load emojis, which are expected to be stored
as regular PNG images at /res/emoji/U+XXXX.png, where XXXX is the
character codepoint.

https://github.com/SerenityOS/serenity/issues/490
2019-09-05 16:37:39 +02:00
rhin123
5594f19624 TextEditor: Added GCommonActions 2019-09-05 09:40:54 +02:00
Andreas Kling
c4d59f64d1 GDirectoryModel: Add a 32x32 filetype icon for sound files 2019-09-04 21:48:03 +02:00
Andreas Kling
6693e56603 LibAudio: Allow tweaking how much get_more_samples() reads from file 2019-09-04 20:13:32 +02:00
Andreas Kling
a98de0b6ee LibAudio: Add AClientConnetion::try_enqueue() API
This is a variant of the enqueue() API that returns immediately and
may fail. It's useful when you don't want to block until the audio
server can receive your sample buffer.
2019-09-04 20:12:24 +02:00
Andreas Kling
123a3cad77 GLayout: Change default spacing to 3 pixels 2019-09-04 18:54:03 +02:00
Andreas Kling
a6bb955c9d GSplitter: Change default spacing to 3 pixels 2019-09-04 18:53:46 +02:00
Andreas Kling
16de02cce0 CIODevice: Add is_open() 2019-09-04 15:13:55 +02:00
rhin123
deb31645aa GAction: Added GCommonActions as a template to create standard actions
Instead of creating actions from the ground up, GCommonActions contains
all related information to that common action. Such as the icon,
keybind, ect.
2019-09-04 06:56:29 +02:00
Andreas Kling
5e34e43b0f LibGUI: Add GAboutDialog, a simple way to show a nice about box in apps 2019-09-02 19:45:55 +02:00
Conrad Pankoff
17cf3c143a LibC: Support _PC_PATH_MAX in [f]pathconf 2019-09-02 08:30:04 +02:00
Andreas Kling
b615a5c780 LibGUI: Add a way for GWidgets to do custom layout on child hide/show
This solves an issue in GScrollableWidget where hiding one of the two
scrollbars needs to trigger a relayout since the other one should grow
into the "shared space" in the bottom right corner.

A GWidget can now override custom_layout() which will be called at any
time we would normally delegate work to the GLayout, e.g on resize
or child visibility changes, size policy changes, etc.
2019-09-01 20:51:20 +02:00
Andreas Kling
77a58119e7 GTextEditor: Hide the horizontal scrollbar when line-wrapping is on 2019-09-01 20:34:50 +02:00
Andreas Kling
906582d8df GTextEditor: Fix wrong width calculations with line-wrapping enabled
There were various little mistakes in the width calculations used by
the line-wrapping layout code.

With this patch, we should no longer see the horizontal scrollbar get
enabled with line-wrapping enabled. I will hide the scrollbar in a
separate patch.
2019-09-01 20:04:25 +02:00
Andreas Kling
74ca299b4b GTextEditor: Make visual lines stop after their last character
Instead of letting each visual line run to the end of the editor when
wrapping lines, stop each visual line where it runs ouf characters.

Fixes #493.
2019-09-01 17:30:23 +02:00
Andreas Kling
72a29d72d3 Rect: Add contains_vertically(y) and contains_horizontally(x) 2019-09-01 17:28:49 +02:00
Andreas Kling
c686264703 LibThread: Add missing install.sh script
This unbreaks the SDL port build.
2019-09-01 16:59:12 +02:00
Rhin
3e6a0a0533 TextEditor: Stopped disappearing text at end of document (#505)
text_position_at() was returning -1 if the position wasn't in
the bounds of a visual line. Now if the position is past the last
line, we simply return the last line index instead of -1.

Fixes #502.
2019-09-01 12:34:14 +02:00
Andreas Kling
3e2e086011 LibGUI: Add a way for GWidget subclasses to learn that the font changed
Use this in GTextEditor to update the vertical scrolling step size so
we always scroll one-line-at-a-time.
2019-09-01 12:26:35 +02:00