Commit graph

1866 commits

Author SHA1 Message Date
AnotherTest
f17874ecd2 Spreadsheet: Add a 'contents' getter/setter to Position
This makes it possible to change the cells' contents programmatically!
2020-12-29 00:58:43 +01:00
Andreas Kling
f7116bba43 LibGUI: Refactor AbstractView "multi select" mode into "selection mode"
There are three possible selection modes for a GUI::AbstractView.

- NoSelection
- SingleSelection
- MultiSelection

We don't enforce these modes fully yet, this patch mostly adds them in
place of the old "multi select" flag.
2020-12-28 21:28:40 +01:00
Idan Horowitz
b4bb2b141c FileManager: Implement the cut file operation
This exploits the comment lines in the text/uri-list specification:
https://tools.ietf.org/rfc/rfc2483.txt (page 11), which might be a bit
hackish, but the specification suggests doing the same for other uses,
so it should be fine.
2020-12-28 19:13:45 +01:00
Idan Horowitz
7450f20b81 FileManager: Add a delete_path helper for singular paths
This is just the syscalls and error handling that was done for each
file in delete_paths.

This will be used to prevent the unneeded construction of vectors
when performing cut operations
2020-12-28 19:13:45 +01:00
Andreas Kling
a35693915e LibGUI: Make syntax highlighter communicate boldness instead of font
Now that fonts know their own weight, we no longer need highlighters to
tell us which font to use. Instead, they can just say "this should be
bold" and we'll find the right font ourselves.
2020-12-28 15:53:10 +01:00
Andreas Kling
ffa241250b LibGUI: Make GUI::FileIconProvider::icon_for_executable() a public API
This way we can use it instead of icon_for_path() in a bunch of places
and avoid loading the full FileIconProvider configuration.
2020-12-28 11:41:09 +01:00
Idan Horowitz
a49fd0ff5e Terminal: Created a simple Find window for searching within the terminal
This is simply a gui wrapper around the pre-existing TerminalWidget
methods for finding and scrolling.
2020-12-28 11:40:35 +01:00
Idan Horowitz
6efdabfc6f Base: Rename maximize/minimize icons to a more generic name
This reduces naming confusion when the icons are used for other
use cases that require a triangle shape
2020-12-28 11:40:35 +01:00
Andreas Kling
26cb083c6e FileManager: Created desktop shortcuts should use full basename
A shortcut to ReadMe.md should be called "ReadMe.md", not "ReadMe".
2020-12-28 09:38:11 +01:00
Andreas Kling
327f595f63 Browser: Show destination URLs as tooltips in the bookmarks bar 2020-12-28 01:43:58 +01:00
Andreas Kling
27262b639d Browser: Use Core::Object::remove_all_children() in bookmarks bar 2020-12-28 01:42:41 +01:00
Linus Groh
ddeb261bc2 Terminal+LibVT: Use GUI::AppFile 2020-12-27 22:46:52 +01:00
Rok Povsic
c7911fdce9 HexEditor: Select first character by default
The first character was already selected (with the selection greyed-out),
and a selection span of 1 was shown, so it's natural than the selection
from/to numbers should be 0/0, not -1/-1.
2020-12-27 21:25:54 +01:00
Rok Povsic
b2a6d2cea4 HexEditor: Don't update selection numbers when clicking the last+1 char
Clicking at the cell after the last one, where there's no character,
used to update the selection from/to numbers. Since there's no character
there, that shouldn't happen.
2020-12-27 21:25:54 +01:00
Rok Povsic
5e66eda688 HexEditor: Make single-character selection display proper start/end
Previously, -1 / -1 was displayed.

Fixes #3555
2020-12-27 21:25:54 +01:00
Andreas Kling
590fd45461 Terminal: Tweak settings window layout slightly
Make it a little taller so we can see the focus rect around the radio
buttons when they are focused.
2020-12-27 15:29:13 +01:00
Andreas Kling
55e990cbc4 FileManager: Layout the desktop icons from top-to-bottom :^)
This looks way nicer than left-to-right!
2020-12-27 14:48:12 +01:00
Andreas Kling
2e846631a8 SystemMonitor: Fetch process icons from their executable
Instead of using the extremely hackish icon_id field in /proc/all,
we now retrieve process icons from their executable by using
GUI::FileIconProvider.
2020-12-27 01:16:56 +01:00
Andreas Kling
5452c8a566 LibGUI: Rename Link => LinkLabel 2020-12-26 13:03:38 +01:00
Andreas Kling
6e5a73c11a TextEditor+HexEditor: Tweak dirty document warning messages 2020-12-26 01:31:24 +01:00
Linus Groh
721b00a83a FileManager: Fix missing launch action icons
I missed this when updating everything to use GUI::FileIconProvider
rather than loading icons from .af files, it broke as a result as none
of them have icon info anymore. :^)
2020-12-26 01:09:13 +01:00
Andreas Kling
cb2c8f71f4 AK: Remove custom %b format string specifier
This was a non-standard specifier alias for %02x. This patch replaces
all uses of it with new-style formatting functions instead.
2020-12-25 17:04:28 +01:00
Andreas Kling
f1b1558c7b Everywhere: Tweak "2020-2020" => "2020" in copyright headers 2020-12-25 12:24:05 +01:00
Andreas Kling
1e4c010643 LibELF: Remove ELF::Loader and move everyone to ELF::Image
This commit gets rid of ELF::Loader entirely since its very ambiguous
purpose was actually to load executables for the kernel, and that is
now handled by the kernel itself.

This patch includes some drive-by cleanup in LibDebug and CrashDaemon
enabled by the fact that we no longer need to keep the ref-counted
ELF::Loader around.
2020-12-25 02:14:56 +01:00
Alex McGrath
a5f4cb78cf FileManager: Add a button to open links in their real directory 2020-12-24 21:52:02 +01:00
Linus Groh
b53011a198 Terminal+LibVT: Use GUI::FileIconProvider for app icons 2020-12-24 20:50:30 +01:00
Xavier Cooney
5f58fe1643 Spreadsheet: Prompt user before closing with unsaved changes 2020-12-23 15:41:49 +01:00
Linus Groh
488a613858 TextEditor: Rename {Main => TextEditor}Window.gml
Calling the file MainWindow.gml (and subsequently using MainWindowGML.h
for the generated file's name) suggests that's possible for every
application, but having a second one anywhere results in the following
CMake error:

    add_custom_target cannot create target "generate_MainWindowGML.h"
    because another target with the same name already exists. The
    existing target is a custom target created in source directory [...]

It's now also more consistent with the other applications already using
GML, namely "BrowserWindow.gml" and "FileManagerWindow.gml".
2020-12-23 01:33:43 +01:00
Alex McGrath
abc98dea09 FileManager: Allow creating desktop shortcut from FileManager 2020-12-22 23:35:41 +01:00
AnotherTest
ca2e7b6746 Spreadsheet: Fix invalid check in SheetGlobalObject::column_index() 2020-12-22 23:35:29 +01:00
AnotherTest
8f05e4e765 Spreadsheet: Improve sheet update efficiency
There's no need to leave the cell dirty when not updating it, and
there's definitely no need to update the cells as we're selecting them.
This makes navigating a sheet and selecting cells significantly faster
as we no longer update unrelated cells just because they appear to have
a cyclic update dependency :^)
2020-12-22 23:35:29 +01:00
AnotherTest
bfb25855cb Spreadsheet: Do not attempt to create columns with "negative" indices 2020-12-22 23:35:29 +01:00
AnotherTest
7c8d35600c Spreadsheet: Override visit_edges() and visit stored JS objects
...and don't let them leak out of their evaluation contexts.
Also keep the exceptions separate from the actual values.
This greatly reduces the number of assertions hit while entering random
data into a sheet.
2020-12-22 23:35:29 +01:00
AnotherTest
b3a9a25416 Spreadsheet: Make it possible to rename sheets 2020-12-22 23:35:29 +01:00
AnotherTest
f1f9fd1c60 Spreadsheet: struct Cell => class Cell
Hide private members, and make the odd update() -> sheet->update(cell)
-> update(Badge<Sheet>) -> update_data() less odd by removing the
update(Badge<Sheet>) step.
2020-12-22 23:35:29 +01:00
AnotherTest
28428beb5c Spreadsheet: Accept (and ignore) invalid 'columns' in json
The save functionality omits these when the names are standard, so just
ignore them if they don't exist (or are not valid).
2020-12-22 23:35:29 +01:00
Andreas Kling
ab549cf942 LibGUI+TextEditor+HackStudio: Add GML syntax highlighter :^) 2020-12-21 18:26:18 +01:00
Tom
5f51d85184 Kernel: Improve time keeping and dramatically reduce interrupt load
This implements a number of changes related to time:
* If a HPET is present, it is now used only as a system timer, unless
  the Local APIC timer is used (in which case the HPET timer will not
  trigger any interrupts at all).
* If a HPET is present, the current time can now be as accurate as the
  chip can be, independently from the system timer. We now query the
  HPET main counter for the current time in CPU #0's system timer
  interrupt, and use that as a base line. If a high precision time is
  queried, that base line is used in combination with quering the HPET
  timer directly, which should give a much more accurate time stamp at
  the expense of more overhead. For faster time stamps, the more coarse
  value based on the last interrupt will be returned. This also means
  that any missed interrupts should not cause the time to drift.
* The default system interrupt rate is reduced to about 250 per second.
* Fix calculation of Thread CPU usage by using the amount of ticks they
  used rather than the number of times a context switch happened.
* Implement CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE and use it
  for most cases where precise timestamps are not needed.
2020-12-21 18:26:12 +01:00
Alex McGrath
f1d7d864ae LibVT+Terminal: Add the option to disable the bell 2020-12-21 00:17:12 +01:00
William Marlow
39364bdda4 Build: Embed application icons directly in the executables.
New serenity_app() targets can be defined which allows application
icons to be emedded directly into the executable. The embedded
icons will then be used when creating an icon for that file in
LibGUI.
2020-12-21 00:12:59 +01:00
Lenny Maiorani
765936ebae
Everywhere: Switch from (void) to [[maybe_unused]] (#4473)
Problem:
- `(void)` simply casts the expression to void. This is understood to
  indicate that it is ignored, but this is really a compiler trick to
  get the compiler to not generate a warning.

Solution:
- Use the `[[maybe_unused]]` attribute to indicate the value is unused.

Note:
- Functions taking a `(void)` argument list have also been changed to
  `()` because this is not needed and shows up in the same grep
  command.
2020-12-21 00:09:48 +01:00
Andreas Kling
64ba41ea13 LibGUI: Make GUI::Label auto-sizing declarative
You can now set the "autosize" property on a GUI::Label and it will
automatically update its width preference to fit the text.
2020-12-20 12:36:32 +01:00
Andreas Kling
de08e7b8c9 LibGUI: Rename ProgressBar property caption => text and expose to GML 2020-12-20 12:29:40 +01:00
Andreas Kling
92afdd0c86 FileManager: Move the main window UI to GML
This was pretty straightforward although it does expose a bunch of
missing functionality (mostly properties.)
2020-12-20 12:17:59 +01:00
Andreas Kling
822dc56ef3 LibGUI: Introduce GML - a simple GUI Markup Language :^)
This patch replaces the UI-from-JSON mechanism with a more
human-friendly DSL.

The current implementation simply converts the GML into a JSON object
that can be consumed by GUI::Widget::load_from_json(). The parser is
not very helpful if you make a mistake.

The language offers a very simple way to instantiate any registered
Core::Object class by simply saying @ClassName

@GUI::Label {
    text: "Hello friends!"
    tooltip: ":^)"
}

Layouts are Core::Objects and can be assigned to the "layout" property:

@GUI::Widget {
    layout: @GUI::VerticalBoxLayout {
        spacing: 2
        margins: [8, 8, 8, 8]
    }
}

And finally, child objects are simply nested within their parent:

@GUI::Widget {
    layout: @GUI::HorizontalBoxLayout {
    }
    @GUI::Button {
        text: "OK"
    }
    @GUI::Button {
        text: "Cancel"
    }
}

This feels a *lot* more pleasant to write than the JSON we had. The fact
that no new code was being written with the JSON mechanism was pretty
telling, so let's approach this with developer convenience in mind. :^)
2020-12-20 11:59:40 +01:00
Andreas Kling
685d5f4e25 LibProtocol: Remove use of ByteBuffer::wrap() in protocol API 2020-12-19 13:09:02 +01:00
Andreas Kling
f0138fcb25 LibGUI: Move selection behavior from TableView up to AbstractView
Let's make SelectionBehavior a view concept where views can either
select individual items (row, index) or whole rows. Maybe some day
we'll do whole columns, but I don't think we need that now.
2020-12-17 00:54:58 +01:00
Andreas Kling
5eacf62ba3 FileManager: Fix assertion when drag&dropping a file to the desktop 2020-12-16 19:40:24 +01:00
Conrad Pankoff
ee3056ba11 IRCClient: Remove unnecessary temporary variable from connect() 2020-12-16 17:11:52 +01:00
Andreas Kling
04bc654ae7 FileManager: Make symlink icons show up nicely in properties dialog 2020-12-16 16:09:27 +01:00