Commit Graph

724 Commits

Author SHA1 Message Date
DoubleNegation
e992658c12 DisplaySettings: Adjust FontSettings.gml to work with dark themes
The FontSettings widget now uses background_role instead of
background_color to ensure that it displays properly independently of
the active system theme.
2021-07-01 00:10:25 +02:00
Hendiadyoin1
2c2cf90661 Utilities: Fix Build on x86_64 2021-06-30 19:05:51 +02:00
Hendiadyoin1
8e575d2f62 Debugger: Compile on x86_64
This is not guaranteed to work at all
2021-06-30 19:05:51 +02:00
Andreas Kling
80cf8bb27c Assistant: Use static_cast instead of dynamic_cast
When the type is guaranteed to be known, there's no need to use RTTI.
2021-06-30 11:44:52 +02:00
Andreas Kling
6c630437e9 Assistant: Don't add a subtitle label widget if we don't need it 2021-06-30 11:44:34 +02:00
Max Wipfli
d8be530397 AK+Everywhere: Remove "null state" of LexicalPath
This removes the default constructor of LexicalPath, and subsequently
modifies all its users to accommodate the change.
2021-06-30 11:13:54 +02:00
Max Wipfli
fc6d051dfd AK+Everywhere: Add and use static APIs for LexicalPath
The LexicalPath instance methods dirname(), basename(), title() and
extension() will be changed to return StringView const& in a further
commit. Due to this, users creating temporary LexicalPath objects just
to call one of those getters will recieve a StringView const& pointing
to a possible freed buffer.

To avoid this, static methods for those APIs have been added, which will
return a String by value to avoid those problems. All cases where
temporary LexicalPath objects have been used as described above haven
been changed to use the static APIs.
2021-06-30 11:13:54 +02:00
Max Wipfli
9b8f35259c AK: Remove the LexicalPath::is_valid() API
Since this is always set to true on the non-default constructor and
subsequently never modified, it is somewhat pointless. Furthermore,
there are arguably no invalid relative paths.
2021-06-30 11:13:54 +02:00
FalseHonesty
988e17ed05 LibVideo: Migrate to east-const style & apply other minor fixes
This patch brings all of LibVideo up to the east-const style in the
project. Additionally, it applies a few fixes from the reviews in #8170
that referred to older LibVideo code.
2021-06-30 11:03:51 +02:00
Adam Hodgen
1e5e02c70b LibWeb+Browser: Support DOM Inspector for OutOfProcessWebView
This introduces a new DOMTreeJSONModel, which provides the Model for the
InspectorWidget when the Browser is running using the
OutOfProcessWebView.

This Model is constructed with a JSON object received via IPC from the
WebContentServer.
2021-06-29 23:06:48 +02:00
ngc6302h
e2187f2956 SoundPlayer: Don't limit duration inference to WAV files 2021-06-30 00:58:06 +04:30
Andreas Kling
3ecd1d603f Assistant: Add subtitle field to the Result class
This allows providers to specify an appropriate subtitle instead of
making that something the UI layer has to figure out. :^)
2021-06-29 13:23:51 +02:00
Max Wipfli
9c8a2a5f69 AK+Spreadsheet+LibWeb: Remove JsonObject::get_or()
This removes JsonObject::get_or(), which is inefficient because it has
to copy the returned value. It was only used in a few cases, some of
which resulted in copying JsonObjects, which can become quite large.
2021-06-29 13:18:03 +02:00
Max Wipfli
e0ed160372 AK: Use OrderedHashMap in JsonObject
This changes JsonObject to use the new OrderedHashMap instead of an
extra vector for tracking the insertion order.

This also adds a default value for the KeyTraits template argument in
OrderedHashMap. Furthermore, it fixes two cases where code iterating
over a JsonObject relied on the value argument being copied before
invoking the callback.
2021-06-29 13:18:03 +02:00
Andreas Kling
9179a2ea73 Assistant: Fix crash when activating empty search result
If there are no search results in the list, we shouldn't do anything
when you try to active the selected result, since there isn't one.

Fix this by using an Optional<size_t> to store the selected index.
2021-06-29 13:08:21 +02:00
Spencer Dixon
b9d1ef99de Assistant+Taskbar: Use AppFile::spawn() utility 2021-06-28 16:29:02 +02:00
Spencer Dixon
66c13edb98 Userland: Add new app called Assistant
'Assistant' is similar to macOS spotlight where you can quickly open a
text input, start typing, and hit 'enter' to launch apps or open
directories.
2021-06-28 16:29:02 +02:00
Spencer Dixon
d16db6a67c Meta: Tidy up include path and alphabetic ordering 2021-06-28 16:29:02 +02:00
Andreas Kling
ba9d5c4d54 LibJS: Rename Function => FunctionObject 2021-06-27 22:36:04 +02:00
Andreas Kling
67d1b28b97 FileManager: Pass launch origin rects to spawned programs
This makes GUI applications animate their initial window showing up
on screen. :^)
2021-06-27 19:38:11 +02:00
Gunnar Beutner
233ef26e4d Kernel+Userland: Add x86_64 registers to RegisterState/PtraceRegisters 2021-06-27 15:46:42 +02:00
Tom
8b26debda1 DisplaySettings: Show screen numbers when showing the Monitors tab
This will be helpful once we allow the user to rearrange the displays.
2021-06-25 20:38:13 +02:00
Sam Atkins
8e9fb3766d FileManager: Add "Open in New Window" context menu action 2021-06-25 19:19:57 +02:00
Aatos Majava
457edaa4d2 Browser: Add alternate shortcut F6 for focusing the location box 2021-06-25 01:01:37 +02:00
Andreas Kling
ee3a73ddbb AK: Rename downcast<T> => verify_cast<T>
This makes it much clearer what this cast actually does: it will
VERIFY that the thing we're casting is a T (using is<T>()).
2021-06-24 19:57:01 +02:00
Gunnar Beutner
c9a8dfa1bf Userland: Add more TODO()s for arch-specific code
This enables building more of the userspace applications for x86_64.
2021-06-24 09:27:13 +02:00
Jan de Visser
4198f7e1af LibSQL: Move Lexer and Parser machinery to AST directory
The SQL engine is expected to be a fairly sizeable piece of software.
Therefore we're starting to restructure the codebase for growth.
2021-06-24 00:36:53 +02:00
Gunnar Beutner
7a87e920f2 HexEditor: Change name for unsaved files to 'Untitled' 2021-06-23 13:08:14 +02:00
Gunnar Beutner
b246221eac HexEditor: Prompt the user to save changes when opening a file 2021-06-23 13:08:14 +02:00
Xavier Defrang
9dfc96f89b DisplaySettings: Revert changes unless confirmed 2021-06-23 01:27:21 +02:00
Gunnar Beutner
928364e102 TextEditor: Don't open files when the user cancelled saving changes
Steps to reproduce:

1. Start TextEditor and make some changes to the document.
2. Try to open an existing file.
3. When prompted choose to save the changes to the existing document.
4. Close the file picker by clicking 'Cancel'.
5. Note how the file was opened anyway and your changes were lost.

Same applies to the 'New File' action.
2021-06-22 22:56:22 +02:00
Davipb
20b2c46019 PixelPaint: Allow copying arbitrary selections
This replaces the naive copy algorithm that only supported rectangular
and 100% opaque selections with a more general approach that supports
any shape and alpha value.

Note that we now make a brand new bitmap with a hardcoded format instead
of just cropping the layer's existing bitmap. This is done to ensure
that the final clipboard image will have an alpha channel.
2021-06-22 11:00:00 +02:00
Davipb
e58f78e667 PixelPaint: Add more options to RectangleSelectTool
A "feather" value sets by how much the borders of the selection will be
smoothed, and a "mode" value sets how the newly selected region will
interact with an existing image selection (if any).
2021-06-22 11:00:00 +02:00
Davipb
22585e2845 PixelPaint: Expose more complex selection operations
Now that we use RectMask internally to store the selection, we can
expose more powerful APIs to allow for better control over the image
selection.
2021-06-22 11:00:00 +02:00
Davipb
d922e35579 PixelPaint: Use Mask internally in Selection
While the external API has not changed, this will allow us to have
non-rectangular selections in the future.
2021-06-22 11:00:00 +02:00
Davipb
0828c75e57 PixelPaint: Add a Mask class
The Mask class represents an opacity mask over a rectangular section
of an image, linking every pixel to an alpha value ranging from 0 (not
selected) to 255 (fully selected). "Partially selected" pixels can be
used to simulate anti-aliased curves.

This class will be used as the basis for the new non-rectangular
selection feature.
2021-06-22 11:00:00 +02:00
FalseHonesty
4f0a75224c PDFViewer: Update the page number when scrolling between pages 2021-06-22 06:26:44 +04:30
Felix Rauch
8d91dbf6c0 PixelPaint: Add loading and saving of color palettes
Color palettes can now be stored in and read from files. The default
palette will be read from `/res/color-palettes/default.palette`
instead of being hard-coded in PaletteWidget.

The file format is one color per line, in any format that can be
understood by `Gfx::Color::from_string`.
2021-06-21 22:32:58 +02:00
Nick Miller
9a2c80c791 SoundPlayer: Handle any input file sample rate
This commit addresses two issues:
1. If you play a 96 KHz Wave file, the slider position is incorrect,
   because it is assumed all files are 44.1 KHz.
2. For high-bitrate files, there are audio dropouts due to not
   buffering enough audio data.

Issue 1 is addressed by scaling the number of played samples by the
ratio between the source and destination sample rates.

Issue 2 is addressed by buffering a certain number of milliseconds
worth of audio data (instead of a fixed number of bytes).
This makes the the buffer size independent of the source sample rate.

Some of the code is redesigned to be simpler. The code that did the
book-keeping of which buffers need to be loaded and which have been
already played has been removed. Instead, we enqueue a new buffer based
on a low watermark of samples remaining in the audio server queue.

Other small fixes include:
1. Disable the stop button when playback is finished.
2. Remove hard-coded instances of 44100.
3. Update the GUI every 50 ms (was 100), which improves visualizations.
2021-06-21 03:13:59 +04:30
Marcus Nilsson
f2aa5efbeb PixelPaint: Add basic support for closing tabs
This enables closing of tabs in PixelPaint, for the moment
very basic with no checking if the image is modified or saved.
2021-06-20 15:16:26 +02:00
Marcus Nilsson
32fc8da917 Browser: Enable close button on tabs 2021-06-20 15:16:26 +02:00
Tom
aa15bf81e4 WindowServer: Add API to set/get screen layouts
This sets the stage so that DisplaySettings can configure the screen
layout and set various screen resolutions in one go. It also allows
for an easy "atomic" revert of the previous settings.
2021-06-20 14:57:26 +02:00
Tom
4392da970a WindowServer: Add initial support for rendering on multiple screens
This allows WindowServer to use multiple framebuffer devices and
compose the desktop with any arbitrary layout. Currently, it is assumed
that it is configured contiguous and non-overlapping, but this should
eventually be enforced.

To make rendering efficient, each window now also tracks on which
screens it needs to be rendered. This way we don't have to iterate all
the windows for each screen but instead use the same rendering loop and
then only render to the screen (or screens) that the window actually
uses.
2021-06-20 14:57:26 +02:00
Marco Cutecchia
24c243942d Browser: Add setting to change homepage URL 2021-06-18 10:20:24 +02:00
Elliot Maisl
90873781c1 PixelPaint: Add new selection moving modes
If you press "spacebar" while moving a selection, it will now move the
origin point of the selection; and if you press "control" it will move
it relatively to the center.
2021-06-17 23:02:53 +02:00
Erik Sommer
96588adbd4
PixelPaint: Update debug message in the copy action to the used method (#8113) 2021-06-17 19:53:45 +02:00
Idan Horowitz
dcb55db99b LibJS: Replace boolean without_side_effects parameters with an enum 2021-06-17 16:52:15 +02:00
stelar7
22851287b1 Spreadsheet: Pledge 'fattr' to avoid crashing after exporting as csv 2021-06-17 18:49:44 +04:30
Gunnar Beutner
631d36fd98 Everywhere: Add component declarations
This adds component declarations so that users can select to not build
certain parts of the OS.
2021-06-17 11:03:51 +02:00
Linus Groh
317b88a8c3 LibJS: Replace Object's create_empty() with create() taking a prototype
This now matches the spec's OrdinaryObjectCreate() across the board:
instead of implicitly setting the created object's prototype to
%Object.prototype% and then in many cases setting it to a nullptr right
away, it now has an 'Object* prototype' parameter with _no default
value_. This makes the code easier to compare with the spec, very clear
in terms of what prototype is being used as well as avoiding unnecessary
shape transitions.

Also fixes a couple of cases were we weren't setting the correct
prototype.

There's no reason to assume that the object would not be empty (as in
having own properties), so let's follow our existing pattern of
Type::create(...) and simply call it 'create'.
2021-06-16 22:49:04 +01:00
Ali Mohammad Pur
66e5e74374 Spreadsheet: Remove the offset used for exception TextRanges
After yet another rewrite of how GUI::TextEditor interprets text ranges
this was broken yet again :P
2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
0c9a505ad1 Spreadsheet: Remove 'return (...)' workaround in conditional formatting
Now that LibJS can evaluate expressions correctly, that workaround was
breaking conditional formatting.
2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
16b4a78072 Spreadsheet: Do not cancel drag-select when moving over a cell corner
Fixes #4277.
2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
a01358f015 Spreadsheet: Correctly resolve nonstandard column names 2021-06-17 01:08:27 +04:30
Ali Mohammad Pur
b11b3c2f1c Spreadsheet: Make the XSV parser start with a preview parse
Instead of parsing the whole document. That's really wasteful and
super slow.
2021-06-17 01:08:27 +04:30
Aatos Majava
a49a15cabf PixelPaint: Set the image title when creating a new image 2021-06-16 21:27:05 +02:00
Timon Kruiper
3e73cfc08c Help: When opening a page, make sure it is selected in the tree view
This has to be called with a `deferred_invoke`, since on startup the
tree view contains no data yet.
2021-06-16 16:30:54 +04:30
Timon Kruiper
a5ecac5494 Help: Make sure the home page is actually shown when opening the app
Previously `open_page` was called multiple times when opening the
application, once for the actual page, but also in
`tree_view.on_selection_change`. At startup there is no valid selection
yet, which caused an empty page to be loaded. Prevent this by early
returning if the `path` is null.
2021-06-16 16:30:54 +04:30
Andreas Kling
0c8dce60a2 PixelPaint: Don't open new images in background tabs
When opening/creating a new image, let's make it the foreground tab.
2021-06-16 12:12:39 +02:00
Andreas Kling
abc40af809 PixelPaint: Make images keep track of their path & title
The title is either "Untitled" (default), or the basename of the
image after we've opened or saved it.
2021-06-16 12:12:39 +02:00
Andreas Kling
35456f035c PixelPaint: Make ImageEditor::image() return a reference (Image&)
In the new tabbed world, every ImageEditor always has an associated
Image, so this simplifies a bunch of things. :^)
2021-06-16 12:12:39 +02:00
Andreas Kling
c6dd3377ee PixelPaint: Make the main UI tabbed and allow multiple open images :^)
This patch adds a GUI::TabWidget to the main UI and allows having
multiple images open at the same time.

Some of the changes here are a bit hackish and mechanical and there's
still code around that needs more work to fit better in the new world.

One nice side-effect of this change is that ImageEditor now always
has one Image associated with it, and it never changes.
2021-06-16 12:12:39 +02:00
Andreas Kling
8763492e34 PixelPaint: Make main window a little bit taller by default 2021-06-16 12:12:39 +02:00
Apoorv Mishra
89855d0b8c HexEditor: Use Yes/No/Cancel prompts for message boxes
Use Yes/No/Cancel prompts in message box for saving changes
on closing a file with unsaved changes.

Fixes #7169
2021-06-16 10:52:23 +02:00
Idan Horowitz
8c7fe8d6c8 AK: Add support for removing SinglyLinkedList nodes during iteration
This commit also fixes the now-broken usage of SinglyLinkedList::remove
in the Piano application.
2021-06-15 23:59:21 +01:00
Mateusz Górzyński
4aff4249aa PixelPaint: Alternate selection outline between black and white 2021-06-15 16:15:09 +02:00
Andreas Kling
a1eadc755d LibGUI: Allow tweaking each edge of TabWidget's content margins
Instead of having a single uniform margin around the child content of
a TabWidget, use a GUI::Margins to allow individual per-edge margins.
2021-06-15 14:28:39 +02:00
Andreas Kling
2052796947 PixelPaint: Clear selection when opening a new image 2021-06-15 13:38:43 +02:00
Andreas Kling
91100f2f94 PixelPaint: Display an error message if exporting to PNG/BMP fails 2021-06-15 13:38:43 +02:00
Andreas Kling
3e4b48f68e PixelPaint: Avoid unnecessary temporary layer bitmaps during PP load
When opening a PP file, we were creating a layer first with an empty
bitmap, and then replacing it with the loaded bitmap from the file.

This patch reorders things so we never create the empty bitmap in
between, saving time and avoiding a memory spike.
2021-06-15 10:05:50 +02:00
Andreas Kling
398bf045c6 PixelPaint: Increase default size of new images from 1x1 to 480x360 2021-06-15 10:05:16 +02:00
Andreas Kling
eb76b18ee3 PixelPaint: Don't allow creating empty layers or images 2021-06-15 10:05:16 +02:00
Andreas Kling
8731bc9ead PixelPaint: Display an error message if opening a file fails 2021-06-15 10:05:16 +02:00
Andreas Kling
c333aec9f3 PixelPaint: Display an error message if saving to PP file fails 2021-06-15 01:16:34 +02:00
Andreas Kling
fa7bb98b1e PixelPaint: No need to pass ImageEditor& to Selection::paint()
It already has a reference to the editor in m_editor.
2021-06-15 01:16:34 +02:00
LepkoQQ
e6f27cec39 PixelPaint: Add actions to swap colors or reset them to default values 2021-06-15 00:13:03 +02:00
LepkoQQ
db99e0917c PixelPaint: Add menu items for Select All and Clear Selection
We also need to update the image editor when clearing selection
otherwise the last state of the selection will be displayed until an
update happens.
2021-06-15 00:13:03 +02:00
Andreas Kling
068ca3a394 PixelPaint: Always animate marching ants during interactive selection
The Selection object now tracks whether there is an ongoing interactive
selection (originating from one of the selection tools). If so it makes
sure to pump the marching ants animation.
2021-06-14 18:25:17 +02:00
Andreas Kling
f54164e8ae PixelPaint: Make new pasted layer active immediately
Also clear any selection that existed before pasting. This feels a bit
more intuitive. We may also want to consider switching to the "Move"
tool automatically on paste, but I'm less sure about that.
2021-06-14 18:25:17 +02:00
Andreas Kling
765286f691 PixelPaint: Add copy action (copies the selection from active layer)
You can now select a part of a layer, copy it, and then paste it as
a new layer. Very cool :^)
2021-06-14 18:25:17 +02:00
Andreas Kling
4cecd79000 PixelPaint: Draw the current editor selection as marching ants
This patch moves the marching ants painting code to Selection and
unifies the timer mechanism so that all marching ants are synchronized
which looks neat. :^)
2021-06-14 18:25:17 +02:00
Andreas Kling
1b897ec561 PixelPaint: Add a Selection class (ImageEditor has a Selection)
This will represent a complex, region-based selection in the future.
For now though, it's just a simple rectangle. :^)
2021-06-14 18:25:17 +02:00
Andreas Kling
96b52f13e4 PixelPaint: Implement basic rectangular selection (preview only)
Using the rectangle select tool, you can now drag out a selection which
will be drawn in the form of "marching ants" :^)
2021-06-14 18:25:17 +02:00
Andreas Kling
4bd905de0e PixelPaint: Add a new "Rectangle Select" tool :^)
This patch only adds the tool along with a toolbar icon for it.
It doesn't do anything yet.
2021-06-14 18:25:17 +02:00
Andreas Kling
3ed6a3fea8 Calculator: Fix offensive button misalignment
The UI of this application is still quite bad/uneven, but this at
least fixes the most egregious button misalignment.
2021-06-13 21:48:15 +02:00
Andreas Kling
7d90455fad Browser: Fix build breakage from 29cce65 2021-06-13 21:22:11 +02:00
Marcus Nilsson
4faff69974 Browser: Add download finished graphics to download widget
Not the prettiest, but visually indicates that the download has finished
successfully.
2021-06-13 20:55:58 +02:00
Marcus Nilsson
29cce65d2f Browser: Add close on finished checkbox to download widget
Let the user choose if they want the download widget to close when
finished, also save the users choice for future downloads.
2021-06-13 20:55:58 +02:00
Jelle Raaijmakers
c247d7a662 Utilities: Change unzip -o option to -d
Other `unzip` implementations universally use `-d` to indicate the
output directory, so let's follow this convention.
2021-06-13 17:05:48 +01:00
sinmineryt
2e1a01a499
TextEditor: Don't allow opening directories
Previously it was possible to open a directory in the TextEditor
application. Like device files, these are now rejected with an error
message.
2021-06-13 12:38:07 +01:00
FalseHonesty
fa101d6bf6 VideoPlayer: Create application to parse (and eventually play) videos
This application will eventually be able to actually play videos, but
for now it is used to parse and dump decoded data from the VP9 decoder.
2021-06-12 22:48:28 +04:30
Matthew Olsson
69410d7f4e PDFViewer: Switch back to up/down page icons
This time I remembered to actually commit the image files, oops :^)
2021-06-12 22:45:01 +04:30
Matthew Olsson
e7b70a1435 PDFViewer: Display error dialog if necessary instead of crashing 2021-06-12 22:45:01 +04:30
Matthew Olsson
1ef5071d1b LibPDF: Harden the document/parser against errors 2021-06-12 22:45:01 +04:30
Andreas Kling
dc65f54c06 AK: Rename Vector::append(Vector) => Vector::extend(Vector)
Let's make it a bit more clear when we're appending the elements from
one vector to the end of another vector.
2021-06-12 13:24:45 +02:00
Andreas Kling
de77946a8c Terminal: Don't show window until we've added menubar to it
This removes the janky-looking window growth during startup.
2021-06-12 12:01:54 +02:00
Andreas Kling
68a307be4e PixelPaint: Use ImageDecoder to load images out-of-process
This sandboxes the image decoding work done by PixelPaint to prevent
bugs in the decoding framework from compromising PixelPaint itself. :^)
2021-06-12 11:19:29 +02:00
Andreas Kling
92203c9821 PixelPaint: Don't allow Image::try_create_from_bitmap(nullptr)
This is not a valid use-case so let's prevent it at compile time.
2021-06-12 11:19:29 +02:00
Andreas Kling
9038bc675f PixelPaint: Guarantee that constructed Layer always has a Gfx::Bitmap
Hoist any allocation failures so that layer factories never return a
bitmap-less layer.
2021-06-12 11:19:29 +02:00
Andreas Kling
c7f7c1f7f0 PixelPaint: Use move semantics around Layer construction and accessors 2021-06-12 11:19:29 +02:00