Until we have better control over cell content alignment, let's make
them all right-aligned by default since that makes numbers look nice,
and numbers are the bread & butter of spreadsheets. :^)
Customize the cell editing delegate to stop editing when one of the
various cursor movement keys is hit. This allows you to type into a
cell and then move to an adjacent cell by simply pressing an arrow.
This may not be the best factoring for this feature, but it's pretty
dang cool and we'll see how it evolves over time. :^)
This commit adds a generic interface for cell types and hooks it up.
There is no way to set these from the UI, and so they're not saved
anywhere yet.
Also implicitly converts numeric values (strictly integers) to numeric
javascript values, as numbery-looking + numbery-looking === string is
not very interesting. :^)
This commit just moves some code around:
- Give Cell its own file
- Pull all forward-declared classes/structs into Forward.h
- Clean up the order of member functions a bit
Now that the table view has a cursor, we can distinguish it from the
selected cells. Draw the cells with a nice variant of the selection
color as background.
Before, we had about these occurrence counts:
COPY: 13 without, 33 with
MOVE: 12 without, 28 with
Clearly, 'with' was the preferred way. However, this introduced double-semicolons
all over the place, and caused some warnings to trigger.
This patch *forces* the usage of a semi-colon when calling the macro,
by removing the semi-colon within the macro. (And thus also gets rid
of the double-semicolon.)
The fact that a `MarkedValueList` had to be created was just annoying,
so here's an alternative.
This patchset also removes some (now) unneeded MarkedValueList.h includes.
This patch introduces the HeaderView class, which is a widget that
implements the column headers of TableView and TreeView.
This greatly simplifies event management in the view implementations
and also makes it much easier to eventually implement row headers.
The motivation for this change is twofold:
- Returning a JS::Value is misleading as one would expect it to carry
some meaningful information, like maybe the error object that's being
created, but in fact it is always empty. Supposedly to serve as a
shortcut for the common case of "throw and return empty value", but
that's just leading us to my second point.
- Inconsistent usage / coding style: as of this commit there are 114
uses of throw_exception() discarding its return value and 55 uses
directly returning the call result (in LibJS, not counting LibWeb);
with the first style often having a more explicit empty value (or
nullptr in some cases) return anyway.
One more line to always make the return value obvious is should be
worth it.
So now it's basically always these steps, which is already being used in
the majority of cases (as outlined above):
- Throw an exception. This mutates interpreter state by updating
m_exception and unwinding, but doesn't return anything.
- Let the caller explicitly return an empty value, nullptr or anything
else itself.
Refactors the Calendar widget into LibGUI and updates the Calendar
app interface. Calendar widget lets layout engine manage most of
its geometry now and has a few new features like tile click
navigation, hover highlighting and a togglable year/month mode.
This is not perfect and kinda clunky to use, but these are the best
input widgets we have available at the moment, so let's make do with
what we have. :^)
urls were previously added to history in the Tab::load()
function, which excluded the setter on window.location.href.
This commit adds all urls to browser history when the page loads,
as long as the load_type is not LoadType::HistoryNavigation.
Closes#3148
Instead of translating between the sorting proxy and the underlying
file system model at all the DirectoryView API boundaries, just hand
out indexes into the sorting proxy model.
The only thing those indexes are used for on the outside is to
retrieve a GUI::FileSystemModel::Node for an index, so add a nice
helper on DirectoryView that turns a ModelIndex into a Node&.
The Node API was obnoxiously requiring you to pass the model into it
all the time, simply because nodes could not find their way back to
the containing model. This patch adds a back-reference to the model
and simplifies the API.
This patch begins the process of converting FileManager's desktop mode
to using the DirectoryView class.
This will allow us to share most of the code between the two different
runtime modes of FileManager.
We lose a bit of functionality in this patch, but we'll bring it back!
I noticed that nothing actually applies the wallpaper on startup.
I wasn't sure where to put the responsibility, so I gave it to
the desktop mode file manager.
Also adds a save_config option to set_wallpaper so it doesn't
needlessly save the config.
If the process table grows or shrinks, we need to invalidate all the
ProcessModel indexes. This is not great, but it's the most precise
invalidation we can do at the moment.
Instead of SortingProxyModel having a column+order, we move that state
to AbstractView. When you click on a column header, the view tells the
model to resort the relevant column with the new order.
This is implemented in SortingProxyModel by simply walking all the
reified source/proxy mappings and resorting their row indexes.
This removes one major source of confusion in DirectoryView. It's still
weird that we mix sorting model indexes with filesystem model indexes
a bit willy-nilly but we'll improve that separately.
This changes the graph caption from KB to KiB, but it keeps just "K"
instead of "KiB" for all the numbers in columns in the table, since "K"
is fairly well-established as abbreviation of "KiB" (the SI prefix is
lower-case), and space is at a premium here.
Let's use the one in AK/NumberFormat.h everywhere.
It has slightly different behavior than some of the copies this
removes, but it's probably nice to have uniform human readable
size outputs across the system.
The SI prefixes "k", "M", "G" mean "10^3", "10^6", "10^9".
The IEC prefixes "Ki", "Mi", "Gi" mean "2^10", "2^20", "2^30".
Let's use the correct name, at least in code.
Only changes the name of the constants, no other behavior change.
This is a follow up to #2936 / d3e3b4ae56aa79d9bde12ca1f143dcf116f89a4c.
Affected programs:
- Applications: Browser (Download, View source, Inspect DOM tree, JS
console), Terminal (Settings)
- Demos: Cube, Eyes, Fire, HelloWorld, LibGfxDemo, WebView,
WidgetGallery
- DevTools: HackStudio, Inspector, Profiler
- Games: 2048, Minesweeper, Snake, Solitaire
- Userland: test-web
A few have been left out where manual positioning is done on purpose,
e.g. ClipboardManager (to be close to the menu bar) or VisualBuilder (to
preserve alignment of the multiple application windows).
Various applications were using the same slightly verbose code to center
themselves on the screen/desktop:
Gfx::IntRect window_rect { 0, 0, width, height };
window_rect.center_within(GUI::Desktop::the().rect());
window->set_rect(window_rect);
Which now becomes:
window->resize(width, height);
window->center_on_screen();
This patch adds GUI::FocusEvent which has a GUI::FocusSource.
The focus source is one of three things:
- Programmatic
- Mouse
- Keyboard
This allows receivers of focus events to implement different behaviors
depending on how they receive/lose focus.
We should stop accessing the FileSystemModel outside DirectoryView.
This whole app is pretty badly factored, due to LibGUI being in its
infancy while it first developed.
With this information, it's a bit easier to intuit the current 'process tree'.
If you're reading this, can I convince you to implement a nice process tree for
SystemMonitor? It could be via PPID (unbounded depth), or SID+PGID (depth 3).
Or something else entirely :D
So far, clicking on a link from the Markdown/HTML preview Web::PageView did
nothing - now we pass that link to Desktop::Launcher, which will then
open it in Browser, FileManager, another TextEditor instance etc.
LibWeb keeps growing and the Web namespace is filling up fast.
Let's put DOM stuff into Web::DOM, just like we already started doing
with SVG stuff in Web::SVG.
Since the vast majority of message boxes should be modal, require
the parent window to be passed in, which can be nullptr for the
rare case that they don't. By it being the first argument, the
default arguments also don't need to be explicitly stated in most
cases, and it encourages passing in a parent window handle.
Fix up several message boxes that should have been modal.
Ctrl-L focuses the location bar in all file managers I know of,
and does so in SerenityOS's browser too. It should work in
SerenityOS's file manager as well.
Unfortunately, Ctrl-L was already "View List", so change the
shortcuts of all the view modes to Ctrl-1/2/3 which is what
several other file managers use. (I tried Ctrl-Shift-1/2/3
which is what Windows Explorer uses after 8.1, but it didn't
Just Work, and Ctrl-1/2/3 are currently free anyways. If
we ever want to use them for tabs or whatever, we can
change the view shortcuts then.)
Adds a new, more restrictive read-only state to TextEditor which
forbids copying, selecting, editor cursors, and context menus.
Provides a unique appearance on focus which accomodates ComboBox
widgets. All TextEditor modes are now accessed by enum and
set_mode() which sets the editor to Editable, ReadOnly or
DisplayOnly. Updates applications still using set_readonly().
By adding a special LauncherType::Application we can still
get meta data for the application, but also know that we should
consider executing that binary as the default action. LaunchServer
will not do this for us, as it should probably not be allowed to
run arbitrary binaries that haven't been registered as handlers.
Links which do not have the "file" protocol (most commonly links to
external websites - http and https) are now not treated as file paths
anymore but instead handled by Desktop::Launcher.
The same applies to files outside of /usr/share/man.
Fixes#2727.
This code was previously relying on the PageView::on_load_start hook
firing synchronously when calling PageView::load(). This was not
happening with WebContentView, so it broke the back/forward history.
Instead, we now differentiate between history navigations and normal
loads in Tab::load(). History navigations don't push new entries into
history, but instead just move the history pointer.
This adds a new 32x32 Help application icon, a new open book icon,
copies the current book icon as Help's 16x16 icon, and updates
the Help application file to reflect these changes.
Change: on_link_hover(String) -> on_link_hover(URL)
Also, we now fire the hook when a link is unhovered as well, allowing
the embedder to react to nothing being hovered anymore.
Activating a "#foo" fragment link will now be handled internally by
the Frame instead of involving the widget layer.
If the viewport needs to be scrolled as a result, we will simply ask
the PageClient to scroll a new rect into view.
This patch adds a PreviewMode enum with the following values:
- None
- Markdown
- HTML
This makes it a bit more logical to implement exclusive behavior.