Commit graph

653 commits

Author SHA1 Message Date
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