Commit graph

3935 commits

Author SHA1 Message Date
Sam Atkins 6850ef9014 HexEditor: Respond to font changes 2024-02-09 16:59:02 +00:00
Sam Atkins 3318563ad9 HexEditor: Size the offset area based on the text width
This gets rid of the last use of the offset_margin_width() magic number.

I initially tried using `character_width() * 10` and found it was not
accurate enough with between-character spacing, so instead this measures
a specific string. All offset strings should be the same width in a
fixed-width font.
2024-02-09 16:59:02 +00:00
Sam Atkins 0fdbdc5084 HexEditor: Use glyph_fixed_width() for character width 2024-02-09 16:59:02 +00:00
Sam Atkins d3012f2df1 HexEditor: Share the code for updating the content size
And make setting the bytes_per_row a no-op if it's the same value.
2024-02-09 16:59:02 +00:00
Sam Atkins db23d0f464 HexEditor: Save and reuse horizontal positions when painting 2024-02-09 16:59:02 +00:00
Sam Atkins 60f52aa0ef HexEditor: Save and reuse vertical positions when painting rows
Rather than repeatedly calculating the same y offset over and over,
calculate it once per row, and re-use that result.
2024-02-09 16:59:02 +00:00
Sam Atkins 4af565362c HexEditor: Remove redundant checks in offset_at()
Neither of these is possible based on the if statement above them.
2024-02-09 16:59:02 +00:00
Sam Atkins ca3f21f273 HexEditor: Account for padding in offset_at()
Compare the x position with the start of the hex characters, which is
m_padding pixels to the right of hex_start_x. (And the same for the
text characters.) If the position is within the padding area, clamp it
so it's on the nearest character.

This was previously covered-up somewhat by using the buggy
m_address_bar_width value to calculate the start and end x positions of
these areas. Fixing that in the previous commit made this more obvious.
2024-02-09 16:59:02 +00:00
Sam Atkins c4dc150ed7 HexEditor: Extract some content-width calculations
We repeat the same calculations a lot, and it's easy to make mistakes.

m_address_bar_width and offset_margin_width() have basically the same
purpose, but both are a little wrong. This removes the former, but
we'll get to the latter soon.
2024-02-09 16:59:02 +00:00
Sam Atkins 4dc3816853 HexEditor: Combine row-iteration loops 2024-02-09 16:59:02 +00:00
Sam Atkins 8b5d2c710b HexEditor: Make border of offset area straight down
Subtracting 1 from both axes causes a kink in the line, because the
start point isn't also translated. The clip rect prevents us from
painting too far down, so we can just remove the translated() call.
2024-02-09 16:59:02 +00:00
Sam Atkins f57d9789f8 HexEditor: Paint byte characters with correct width 2024-02-09 16:59:02 +00:00
Sam Atkins e2f927a7a7 HexEditor: Give i and j variables clearer names 2024-02-09 16:59:02 +00:00
Sanil 433fe3dc26 Calendar: Add ability to view events 2024-02-08 08:13:04 -07:00
ronak69 90d68d43ce KeyboardMapper: Convert Utf-8 char in String to Utf-32 code point
Ensure that the Utf-8 encoded "mapping character" in String (from
InputBox) gets converted to Utf-32 code point. Before, only the first
byte of Utf-8 char sequence was used as a Utf-32 code point.

That used to result in incorrect characters getting written in the
keymap file for all the "non-ascii" characters used as the mapping
character.
2024-02-08 07:07:25 -07:00
Tim Ledbetter f961a0eb61 TerminalSettings: Ensure automark setting is reverted on cancel 2024-02-07 13:35:49 +01:00
Tim Ledbetter fa37a220d6 Terminal: Propagate changes in automark settings to the terminal 2024-02-07 13:35:49 +01:00
Tim Ledbetter 0bdb222953 Terminal: Deduplicate bell mode parsing code 2024-02-07 13:35:49 +01:00
Tim Ledbetter 5c8962b8f1 LibVT+TerminalSettings: Move settings parsing functions to LibVT
This change moves the automark and bell settings parsing functions to
LibVT, so that they can be shared between Terminal and TerminalSettings.
2024-02-07 13:35:49 +01:00
Tim Ledbetter 2850bb881a TerminalSettings: Provide default values for terminal settings
The change ensures that functions that parse string values for terminal
settings fall back to a default value, if there is no value present or
the value is invalid.
2024-02-07 13:35:49 +01:00
Tim Ledbetter 1df31e426d TerminalSettings: Use correct name for the automark_off radio button
This was causing a segfault when opening the Terminal Settings window.
2024-02-07 13:35:49 +01:00
Ali Mohammad Pur 54ab6fe5b9 LibVT+Everywhere: Introduce 'automarks' and 'clear previous command'
Automarks are similar to bookmarks placed by the terminal, allowing the
user to selectively remove a single command and its output from the
terminal scrollback.
This commit implements a single way to add marks: automatically placing
them when the shell becomes interactive.

To make sure the shell behaves correctly after its expected prompt
position changes, the terminal layer forces a resize event to be passed
to the shell on such (possibly) partial clears; this also has the nice
side effect of fixing the disappearing prompt on the preexisting "clear
including history" action: Fixes #4192.
2024-02-07 00:43:11 +01:00
Gabriel Tassinari 946a4d6f0f Presenter: Add Manual link in help menu 2024-02-06 20:43:31 +00:00
Bastiaan van der Plaat 582bf1eaf3 Run: Fix bug where it would crash because uninitialized main widget
The set_main_widget<T>() function only calls the construct and not
`try_create()` that the GMLCompiler generates so all calls to
`find_descendant_of_type_named()` would result in null
pointers that would resolve in a crash.
2024-02-06 08:41:01 +01:00
Bastiaan van der Plaat f4d5ff9ed9 Welcome: Move tips.txt to /usr/share/Welcome because it's system wide 2024-02-05 16:30:52 +01:00
Andrew Kaster 677bdc2a4f Ladybird: Add IPC call for creating a new child tab
This will be used for choosing a navigable that requires opening a new
tab or new window. Such as calls to window.open(), or specific WebDriver
calls.
2024-02-03 20:51:37 -05:00
Sam Atkins d930ea1242 HexEditor: Add an option to load an annotations file on startup 2024-01-31 17:38:56 +00:00
Sam Atkins 4cef57a021 HexEditor: Parse arguments using ArgsParser 2024-01-31 17:38:56 +00:00
Sam Atkins 56caee44e3 HexEditor: Save and load annotations to/from JSON files
This is a fairly simple JSON format: A single array, containing objects,
with the Annotation fields as key:value pairs.

When reading a file, we let invalid or missing keys fall back to the
default values. This is mostly intended to set a pattern so that if we
add new fields in the future, we won't fail to load old annotations
files. If loading the file fails though, we keep the previously loaded
set of annotations.
2024-01-31 17:38:56 +00:00
Sam Atkins aa07c232f1 HexEditor: Optionally display annotations in the side panel 2024-01-30 23:34:49 +00:00
Sam Atkins 8cac2e89a9 HexEditor: Store annotations in a Model
A model is necessary for displaying a list of them in the UI. We might
as well make that their home.
2024-01-30 23:34:49 +00:00
Sam Atkins a54952795a HexEditor: Add comments to annotations
The comment appears as a tooltip when hovering over the annotation.

A couple of properties of the TextEditor would ideally be set in GML,
but either don't have a setter exposed, or the GML compiler doesn't
recognise the enum. I'll fix those up after the current big GML
compiler PR gets merged.
2024-01-30 23:34:49 +00:00
Brendan Kelly 00ab8e0a14 Maps: Add massage_for_display for lat and long
This prevents a crash when attempting to add a
favorite or load favorites list in Maps application
2024-01-30 21:07:37 +00:00
Sam Atkins 1750af83b0 3DFileViewer: Use ByteString for file paths 2024-01-29 23:14:39 +00:00
Sam Atkins 90240c0e02 Spreadsheet: Use ByteString for file paths 2024-01-29 23:14:39 +00:00
Sam Atkins 44ca55aaf8 LibFileSystemAccessClient+Userland: Return file paths as ByteStrings
Where it was straightforward to do so, I've updated the users to also
use ByteStrings for their file paths, but most of them have a temporary
String::from_byte_string() call instead.
2024-01-29 23:14:39 +00:00
Bastiaan van der Plaat 350affe406 LibGUI+WindowServer: Add menu minimum width support 2024-01-29 05:29:41 -07:00
kleines Filmröllchen adc845e0cb Userland: Port to automatic GML initializer where possible 2024-01-29 05:21:48 -07:00
Timothy Flynn dcd9962d7b Browser: Remove some needless indirection from Cookie-related IPCs
We don't need to forward Cookie-related IPCs from the WebView through
the Tab to the BrowserWindow. We can skip the Tab like we do in other
chromes.

This is primarily to reduce overhead when changing Cookie IPCs in future
patches.
2024-01-26 20:22:39 +01:00
Sam Atkins 388856dc7e AK+Userland: Return String from human_readable_size() functions 2024-01-25 09:07:32 +01:00
Sam Atkins 7e8cfb60eb AK+Userland: Return String from human_readable_[digital_]time() 2024-01-25 09:07:32 +01:00
Sam Atkins 9657f4cabb LibGUI+Userland: Take ByteString in set_most_recently_open_file() 2024-01-24 11:07:03 +00:00
Mr.UNIX 69ffdd5738 Welcome: Port to GML Compiler 2024-01-23 21:14:12 +01:00
Dan Klishch b5f1a48a7c AK+Everywhere: Remove JsonValue APIs with implicit default values 2024-01-21 15:47:53 -07:00
Nico Weber 475cef8afd PDFViewer: Remove an unneeded indirection
No behavior change.
2024-01-21 09:32:22 -05:00
Nico Weber d9267a388d PDFViewer: Add Debug menu entries for disabling clipping 2024-01-21 09:32:22 -05:00
Sam Atkins 3df3a85235 LibGfx+Userland: Move FontWeight enum into its own file
FontDatabase.h with its includes add up to quite a lot of code. In the
next commit, compiled GML files are going to need to access the
FontWeight enum, so let's allow them to do that without pulling in lots
of other things.

Also, change users to include FontWeight.h instead of FontDatabase.h
where appropriate.
2024-01-21 09:32:10 -05:00
Tim Ledbetter d06f1cbb9c DisplaySettings: Disable custom color scheme combobox by default
Previously, the GML property declaration that does this was being
ignored, as the value was in quotes.
2024-01-21 08:38:18 -05:00
Tim Ledbetter fd8e8e7f31 DisplaySettings: Remove redundant text_alignment property from GML
Previously, this was causing an error to be shown on the debug console,
as `CenterMiddle` is not a valid value for this property.
2024-01-21 08:38:18 -05:00
Nico Weber 176e9db6cd PDFViewer: Move debug actions from toolbar into a menu
This makes it easier to add more entries. Also, debug toggles
don't need to be quite as visible as they were on the toolbar :^)
2024-01-21 08:22:27 -05:00
Mr.UNIX 2440a2f83f TerminalSettings: Port to GML Compiler 2024-01-19 17:05:53 +01:00
Mr.UNIX 3b73064497 TerminalSettings: Split TerminalSettingsWidget into different files 2024-01-19 17:05:53 +01:00
Sanil ca2aaaeac2 KeyboardSettings: Port to GML compiler 2024-01-19 17:03:30 +01:00
kleines Filmröllchen 8ee014a437 CertificateSettings: Use new GML compiler 2024-01-19 10:50:15 +00:00
kleines Filmröllchen 63687c46ff CalendarSettings: Use new GML compiler 2024-01-19 10:50:15 +00:00
kleines Filmröllchen 14a99bb22d Calendar: Use new GML compiler 2024-01-19 10:50:15 +00:00
kleines Filmröllchen 15a539a5b0 Calculator: Use new GML compiler 2024-01-19 10:50:15 +00:00
kleines Filmröllchen 182126dfda BrowserSettings: Use new GML compiler 2024-01-19 10:50:15 +00:00
kleines Filmröllchen 6f554af9c5 Run: Use new GML compiler 2024-01-19 10:50:15 +00:00
Tim Ledbetter 0d8a013ee1 SoundPlayer: Don't drop the unix pledge
Without it, `SoundPlayer` crashes as soon as you try to open a file.
2024-01-19 09:08:37 +01:00
Bastiaan van der Plaat c94fc7d3b0 Ladybird: Change default new tab URL to about:newtab 2024-01-17 17:32:05 +01:00
Sam Atkins 8d80841e9c LibFileSystem+Everywhere: Return ByteString from read_link() 2024-01-16 08:42:34 +00:00
Sam Atkins 56c5ffe398 LibFileSystem+Userland: Return ByteString from real_path() 2024-01-16 08:42:34 +00:00
Sam Atkins cdf17efb9a LibFileSystem+Userland: Return ByteString from absolute_path() 2024-01-16 08:42:34 +00:00
Sam Atkins fb644d08ac LibFileSystem+Everywhere: Return ByteString current_working_directory()
That is, return it *from* current_working_directory(), but I didn't have
room. :^)
2024-01-16 08:42:34 +00:00
Andrew Kaster 162c334508 Revert "Assistant: Check for access before showing results"
This reverts commit 7c88ab2836.

Post-merge review revealed that the checks added in this PR prevent
any and all non-executable files from being displayed in Assistant,
which is a regression from intended functionality.
2024-01-14 15:51:32 -07:00
Hugh Davenport e6d0239c23 Settings: Add fullscreen option 2024-01-14 15:18:43 -07:00
Hugh Davenport 7fa0cf194f Applications: Add fullscreen option to Utilities 2024-01-14 15:18:43 -07:00
Hugh Davenport 8886324cbf Applications: Add fullscreen for Office category 2024-01-14 15:18:43 -07:00
Hugh Davenport 4aca883d51 Mail: Add fullscreen option 2024-01-14 15:18:43 -07:00
Hugh Davenport 4c31049d0c PixelPaint: Add fullscreen option 2024-01-14 15:18:43 -07:00
Hugh Davenport 13c66ebf12 DevTools: Add fullscreen option
All except SQLStudio, as that causes a crash
2024-01-14 15:18:43 -07:00
Jelle Raaijmakers 015622bc22 Kernel: Set correct KeyCode count
The underlying value of the `KeyCode::Key_*` enum values starts at 0,
so we should add 1 to `Key_Menu` to get the correct count.
2024-01-14 15:06:37 -07:00
Lucas CHOLLET cb669675f1 FileManager: Start displaying basic metadata for images
Let's add a new group in the Image tab of the properties window. The
goal is to provide generic metadata, only a few tags are displayed here.
2024-01-14 15:04:43 -07:00
Tim Ledbetter b242fe20cc SystemMonitor: Make the icon column in the Processes tab non-selectable 2024-01-14 15:01:47 -07:00
Sam Atkins e0fd5beb36 LibGUI+Applications: Default the SpinBox min/max to the full int range
By default, a SpinBox's value should be unlimited, (or as close as we
can get to that,) and then the GML or code can impose a limit if
needed. This saves the developer from entering an arbitrary "big" max
value when they want the value to have no maximum.

I've audited the use of SpinBox and added `min: 0`, and removed a `max`,
where appropriate. All existing SpinBoxes constructed in code have a
range set explicitly as far as I can tell.
2024-01-14 13:46:14 +00:00
Sam Atkins cbd28c9110 HexEditor: Add annotations system
Allow the user to highlight sections of the edited document, giving them
arbitrary background colors. These annotations can be created from a
selection, or by manually specifying the start and end offsets.
Annotations can be edited or deleted by right-clicking them.

Any color can be used for the background. Dark colors automatically make
the text white for easier readability. When creating a new annotation,
we use whatever color the user last picked as this is slightly more
likely to be the one they want.

Icons contributed by Cubic Love.

Co-authored-by: Cubic Love <7754483+cubiclove@users.noreply.github.com>
2024-01-14 13:45:02 +00:00
Sam Atkins 1168e46c1d HexEditor: Extract pixel-position-to-byte-offset code 2024-01-14 13:45:02 +00:00
Sam Atkins 84dd0ce1ae HexEditor: Wrap selection and behavior in a struct 2024-01-14 13:45:02 +00:00
Tim Ledbetter 48a3a02238 LibCrypto: Make constructing a BigInteger from string fallible
Previously, constructing a `UnsignedBigInteger::from_base()` could
produce an incorrect result if the input string contained a valid
Base36 digit that was out of range of the given base. The same method
would also crash if the input string contained an invalid Base36 digit.
An error is now returned in both these cases.

Constructing a BigFraction from string is now also fallible, so that we
can handle the case where we are given an input string with invalid
digits.
2024-01-13 19:01:35 -07:00
Bastiaan van der Plaat c0acb2918b Ladybird: Rename new-tab.html file to newtab.html 2024-01-13 13:41:09 -05:00
Dan Klishch ccd701809f Everywhere: Add deprecated_ prefix to JsonValue::to_byte_string
`JsonValue::to_byte_string` has peculiar type-erasure semantics which is
not usually intended. Unfortunately, it also has a very stereotypical
name which does not warn about unexpected behavior. So let's prefix it
with `deprecated_` to make new code use `as_string` if it just wants to
get string value or `serialized<StringBuilder>` if it needs to do proper
serialization.
2024-01-12 17:41:34 -07:00
ronak69 4aa04cdf65 Calendar: Add feature to view/edit duration of events in AddEventDialog 2024-01-12 17:13:46 -07:00
ronak69 5b72711beb Calendar: Set the end time relative to the start time in AddEventDialog 2024-01-12 17:13:46 -07:00
ronak69 5875fae9e9 Calendar: Set minimum hour to 0 and maximum hour to 23 in AddEventDialog 2024-01-12 17:13:46 -07:00
kleines Filmröllchen eada4f2ee8 AK: Remove ByteString from GenericLexer
A bunch of users used consume_specific with a constant ByteString
literal, which can be replaced by an allocation-free StringView literal.

The generic consume_while overload gains a requires clause so that
consume_specific("abc") causes a more understandable and actionable
error.
2024-01-12 17:03:53 -07:00
Hugh Davenport 7c88ab2836 Assistant: Check for access before showing results 2024-01-12 16:51:12 -07:00
Hugh Davenport 87e00565f1 Browser: Add help menu item
Contributes towards: #21091
2024-01-12 16:27:40 -07:00
ronak69 75183402fd Calculator: Finish operation-in-progress only on new binary operations
Because of this the unary operations got applied to the result of the
operation-in-progress instead of the current argument as shown here:

    `16 + 9 <sqrt> =`
        Previous output: `sqrt(16 + 9)` = `5`
        Expected output: `16 + sqrt(9)` = `19`
2024-01-12 16:03:09 -07:00
Andrew Kaster 02edd240ae LibWeb+WebContent: Spawn Worker processes from the chrome
Instead of spawning these processes from the WebContent process, we now
create them in the Browser chrome.

Part 1/N of "all processes are owned by the chrome".
2024-01-12 15:53:11 -07:00
Tim Ledbetter 3cd455e554 Calculator: Make the equals button non-focusable
This is not necessary, as pressing Enter will activate the button
whether it is in focus or not. This makes the equals button behave the
same as all other buttons.
2024-01-12 12:53:12 +00:00
Tim Ledbetter 043d5d5c27 Calculator: Make calculator display non-interactive
Previously, it was possible for the user to input text into the
calculator display. With this change, the calculator display is made
read-only.
2024-01-12 12:53:12 +00:00
Tim Ledbetter 7772637d03 SystemMonitor: Condense process statistics displayed in processes tab
Previously, some non-default process statistics were displayed in a
long human readable format in the processes tab, which could negatively
affect readability. A shorter format is now used in the processes tab,
while the process properties window retains the longer format.
2024-01-12 09:07:51 +01:00
Hugh Davenport c566ef2a9d PartitionEditor: Show better error when can't find partition table 2024-01-11 20:57:40 +00:00
Hugh Davenport 91cdda7763 Calculator: Allow system shortcuts
Before the key events for shortcuts such as ALT-F4 did not work as the
widget was swallowing up the shortcut. This changes ignores the event
if nothing else matched
2024-01-11 19:00:46 +00:00
Tim Ledbetter 800cb4eceb SystemMonitor: Don't include the Idle Task in process statistics
The Idle Task is no longer displayed in the Processes tab and is not
included in the process count in the status bar.
2024-01-10 23:28:10 +01:00
Tim Ledbetter 1c1fc67f75 SystemMonitor: Prefer range-based for loop when updating ProcessModel 2024-01-10 23:28:10 +01:00
Sam Atkins 5f0230a57e LibGUI: Make NumericInput work well in GML
- Register the widget
- Register property getters and setters
- Rename getters and setters to match the property names, as required by
  the GML compiler. The names min/max/value are chosen to match SpinBox.
- Prevent a crash when the minimum is less than the maximum (which can
  happen while editing the GML).
2024-01-10 13:13:27 +00:00
Sam Atkins 4b96136803 LibGUI: Store NumericInput value as an i64
Moar range = moar better. I'm hoping to use this for a size_t value
later, so this almost covers that.
2024-01-10 13:13:27 +00:00
Sam Atkins ea31c11aff LibGUI+PDFViewer: Move NumericInput into LibGUI
A text box that is restricted to numbers within a range, is generally
useful. Let's make it available for use!
2024-01-10 13:13:27 +00:00
Nico Weber c997ee7b9d LibGfx+ImageViewer: Replace ImageDecoder::is_vector() with an enum
That makes it easier to extend to other special frame formats.
2024-01-10 09:39:00 +01:00
Mr.UNIX 9507157f04 Escalator: Port Escalator to GML Compiler 2024-01-10 00:03:27 +01:00
Lucas CHOLLET e56eb11dee ImageDecoder: Add plumbing to allow a client to request an ideal size
This is only used for vector graphics format where requesting the true
displayed size leads to visual enhancement.
2024-01-07 20:10:22 +01:00
Timothy Flynn 3a06d5a9a1 Browser: Show an informational dialog after taking a screenshot
The dialog displays where the screenshot is saved and presents an option
to open its containing folder.
2024-01-06 20:11:12 +00:00
david072 a84778f6ee Calendar/AddEventDialog: Prevent inputting invalid date ranges
The calendar now verifies that the user can't input invalid date ranges,
i.e. date ranges where the end is before the start. The UI elements do
this implicitly, by adjusting the values when changing the dates in an
illegal way (e.g. when picking an end date that is before the start
date, the end date will change to the start date).
2024-01-06 10:37:53 -07:00
david072 b657fa6f95 Calendar: Ask about unsaved changes when closing the window :^)
The Calendar now asks about unsaved changes in the calendar when
attempting to close the window.
2024-01-06 10:37:53 -07:00
david072 75faa9239a Calendar/EventManager: Set m_dirty directly 2024-01-06 10:37:53 -07:00
david072 887f040d0e Calendar/EventManager: Store events as structs
Previously, the EventManager stored the calendar events as a raw
JsonArray of objects. Now, we parse the JSON into a Vector<Event>
structure and store that in the EventManager. This makes it easier to
access the events from the outside, as you now don't have to know the
JSON structure anymore.
2024-01-06 10:37:53 -07:00
david072 7df936b660 Calendar/AddEventDialog: Add a cancel button 2024-01-06 10:37:53 -07:00
david072 d0a4f6678c Calendar/AddEventDialog: Change SpinBoxes to accept 24-hour values
Since the meridiem selection was removed in the previous commit and
there currently doesn't seem to be a way to change the system time
format, I'm changing the SpinBoxes here to accept 24-hour format values
for now.
2024-01-06 10:37:53 -07:00
david072 60174cc9aa Calendar/AddEventDialog: Remove meridiem selection
This removes the meridiem selection in the AddEventDialog of the
calendar because it thus far didn't do anything.
2024-01-06 10:37:53 -07:00
david072 18b1f856e5 Calendar/AddEventDialog: Convert pointers to references
This removes some warnings ;^).
2024-01-06 10:37:53 -07:00
david072 2c68554629 Calendar/AddEventDialog: Use the DatePicker to pick dates 2024-01-06 10:37:53 -07:00
david072 039114b728 Calendar: Move MonthListModel into Calendar.h
Previously, we had two versions of MonthListModel for the AddEventDialog
and the DatePickerDialog. Now, a unified version is in the Calendar.h
file, which can be used easily by anyone. Since that model and the
MeridiemListModel weren't used anymore in the AddEventDialog, I have
also removed them from there.
2024-01-06 10:37:53 -07:00
Bastiaan van der Plaat 0dd5aa40a8 LibWeb: Allow input color to give continuous updates 2024-01-06 10:02:15 -07:00
Sam Atkins fb6a9dd2f5 HexEditor: Clarify code for selecting byte colors
Instead of assigning, then sometimes reassigning these colors, set them
once. This makes it easier to see how we prioritize the different
factors that affect the styling.

`highlight_flag` is now `selected` since it represents if the byte is
within the current selection.
2024-01-06 16:08:49 +00:00
Sam Atkins 8ae4464fa5 HexEditor: Propagate HexDocumentFile creation errors in save_as() 2024-01-06 16:08:49 +00:00
Sam Atkins 034ec62cee HexEditor: Get document cells once per paint, not twice
HexDocument::get() involves a hash lookup, so let's store the returned
Cell instead of calling it twice for its two fields.
2024-01-06 16:08:49 +00:00
Sam Atkins da52c5e82a HexEditor: Make edited bytes bold
This will help them still stand out once we introduce annotations, which
also modify the colors.
2024-01-06 16:08:49 +00:00
Sam Atkins 27adbd1792 HexEditor: Stop allocating a String for every character printed
When we have a single char, we can directly construct a StringView for
it instead, which doesn't require a String allocation.
2024-01-06 16:08:49 +00:00
Cubic Love 30ea7b27d4 PixelPaint: Add link to manpage
Add a link to the manpage in the Help menu.
2024-01-04 12:08:37 -07:00
Torstennator 82e85172e5 PixelPaint: Fix crash when started with path
This change fixes the initial tool selection when pixelpaint is started
with a path. Previously an already existing editor was expected when
the default tool was initially propagated - which was not the case if
pixelpaint was launched to directly load an existing image.
2024-01-02 17:14:38 +01:00
Timothy Flynn d8fa226a8f Ladybird+LibWebView+WebContent: Make the screenshot IPCs async
These IPCs are different than other IPCs in that we can't just set up a
callback function to be invoked when WebContent sends us the screenshot
data. There are multiple places that would set that callback, and they
would step on each other's toes.

Instead, the screenshot APIs on ViewImplementation now return a Promise
which callers can interact with to receive the screenshot (or an error).
2024-01-01 10:11:45 +01:00
Andreas Kling b6d4eea7ac LibJS: Never give back virtual memory once it belongs to a cell type
Instead of returning HeapBlock memory to the kernel (or a non-type
specific shared cache), we now keep a BlockAllocator per CellAllocator
and implement "deallocation" by basically informing the kernel that we
don't need the physical memory right now.

This is done with MADV_FREE or MADV_DONTNEED if available, but for other
platforms (including SerenityOS) we munmap and then re-mmap the memory
to achieve the same effect. It's definitely clunky, so I've added a
FIXME about implementing the madvise options on SerenityOS too.

The important outcome of this change is that GC types that use a
type-specific allocator become immune to use-after-free type confusion
attacks, since their virtual addresses will only ever be re-used for
the same exact type again and again.

Fixes #22274
2023-12-31 15:35:56 +01:00
Liav A 60a96b3786 Userland: Actually use the correct character map index from KeyEvent
Instead of using a scan code, which for scan code set 2 will not
represent the expected character mapping index, we could just use
another variable in the KeyEvent structure that correctly points to the
character index.

This change is mostly relevant to the KeyboardMapper application, and
also to the WindowServer code, as both handle KeyEvents and need to
use the character mapping index in various situations.
2023-12-29 16:40:59 +01:00
Lucas CHOLLET 97ded2dc61 FileManager: Conditionally display the "ICC profile:" line
If the "ICC Profile" group is shown, no need to include the related line
in the "Image" group.
2023-12-29 07:57:12 +00:00
Mr.UNIX 44d623d588 CrashReporter: Port CrashReporter to GML Compiler 2023-12-27 15:29:50 +01:00
tetektoza 2751f32a18 HexEditor: Move drawing cursor under a lambda and reuse it
This is a cleanup patch dones for paint event for HexEditor, moving
repeated chunks of code under a common lambda.
2023-12-27 09:22:09 +01:00
tetektoza 017dea2993 HexEditor: Don't initialize background/text colors twice
This is a cleanup patch, moves a chunk of repeated code to one place
instead of assigning variables with the same values twice in two
different places of code.
2023-12-27 09:22:09 +01:00
tetektoza bd1d384cf6 HexEditor: Remove moving cursor outside bounds if selecting with mouse
Currently if users select last bytes in HexEditor with mouse in either
Hex or Text mode, they will be able to move cursor on the byte outside
bounds. If then they try to write something in either of those modes,
app will crash.

This patch moves the recently added "replace" cursor to always be on the
last byte of the selection instead of being on the byte after the last
selected byte.
2023-12-27 09:22:09 +01:00
tetektoza c4c9971ed0 HexEditor: Change cursor type from caret to black box
This patch changes cursor type from caret to black box for both Hex and
Text modes, because right now the way how blinking caret looks like is
more closer to "insert" mode in similar editors, whereas the real
behavior of this cursor is more of a "replace" mode seen in similar
editors like GHex.
2023-12-27 09:22:09 +01:00
tetektoza 1ea675a9ec HexEditor: Remove blinking of the cursor 2023-12-27 09:22:09 +01:00
Mr.UNIX 467faee1b8 Calendar: Add a link to the Manual in Help Menu 2023-12-26 18:37:35 +01:00
Timothy Flynn bacf3cede4 Ladybird+BrowserSettings: Load the NTP/home resource files with LibWeb 2023-12-24 14:09:23 +01:00
Shannon Booth e2e7c4d574 Everywhere: Use to_number<T> instead of to_{int,uint,float,double}
In a bunch of cases, this actually ends up simplifying the code as
to_number will handle something such as:

```
Optional<I> opt;
if constexpr (IsSigned<I>)
    opt = view.to_int<I>();
else
    opt = view.to_uint<I>();
```

For us.

The main goal here however is to have a single generic number conversion
API between all of the String classes.
2023-12-23 20:41:07 +01:00
Ali Mohammad Pur 5e1499d104 Everywhere: Rename {Deprecated => Byte}String
This commit un-deprecates DeprecatedString, and repurposes it as a byte
string.
As the null state has already been removed, there are no other
particularly hairy blockers in repurposing this type as a byte string
(what it _really_ is).

This commit is auto-generated:
  $ xs=$(ack -l \bDeprecatedString\b\|deprecated_string AK Userland \
    Meta Ports Ladybird Tests Kernel)
  $ perl -pie 's/\bDeprecatedString\b/ByteString/g;
    s/deprecated_string/byte_string/g' $xs
  $ clang-format --style=file -i \
    $(git diff --name-only | grep \.cpp\|\.h)
  $ gn format $(git ls-files '*.gn' '*.gni')
2023-12-17 18:25:10 +03:30
Torstennator b61e4e7cd9 PixelPaint: Repaint histogram data when the widget gets resized
This patch enables the histogram to redraw itself when it gets resized
without calculating the data again through the image.
2023-12-14 09:07:20 -07:00
Torstennator c85c61571c PixelPaint: Make use of DynamicWidgetContainer
This patch adds the new DynamicWidgetContainer for the right panel
elements. This allows the user to collapse, expand or even detach
widgets to a separate window. The collapsed or expanded state is
persisted so that they are restored after application startup.
With this change it is possible to shrink the size of widgets to a
minimum in order to give more space to other currently important
widgets.
2023-12-14 09:07:20 -07:00
Torstennator c74e2d04d1 PixelPaint: Fix crash on mouse moves
This pr fixes a problem where the application would crash if the mouse
was moved while the editor was still loading the image. With this
change tool related mouse move events are discarded as long as there is
no active tool.
2023-12-14 09:04:31 -07:00
Torstennator d462d6280a PixelPaint: Fix initial tool selection
This changes how the initial tool is beeing set on application startup.
With this change the initial tool is set the same way as when the tool
is changed via the frontend. Thus it also updates the tool properties
window which wasn't done before leaving the properties empty as long
the tool was changed for the first time.
2023-12-14 09:04:31 -07:00
Timothy Flynn 451df70275 Ladybird+LibWebView: Ensure existing Inspector widgets inspect the page
If the Inspector widget already exists, be sure to inspect the page when
it is re-opened. However, this should be a no-op if the page was already
inspected (as any existing Inspector will be reset if a new page load
began).

Note this is not an issue in the AppKit chrome.
2023-12-10 16:45:08 +01:00
Kyle Pereira 8191f2b47a LibPDF: Add parameter for background color of render 2023-12-10 16:44:24 +01:00
Bastiaan van der Plaat 466153e680 Ladybird+LibWeb: Add basic select element support 2023-12-09 22:06:20 +01:00
tetektoza 8118ea764f NetworkSettings: Port NetworkSettings to GML compilation 2023-12-08 01:06:09 +01:00
tetektoza 1e11116d65 VideoPlayer: Port VideoPlayer to GML compilation 2023-12-08 01:06:09 +01:00
tetektoza e26548989a GamesSettings: Port GamesSettings to GML compilation
Co-Authored-By: Tim Schumacher <timschumi@gmx.de>
2023-12-08 01:06:09 +01:00
tetektoza 935aaab757 HexEditor: Port HexEditor to GML compilation 2023-12-08 01:06:09 +01:00
tetektoza 9deaa74ad6 LibGUI: Split HorizontalSlider to separate header
This patch splits HorizontalSlider to separate header so it can be used
as a component in .gml files with new GML compiler.
2023-12-08 01:06:09 +01:00
Timothy Flynn 7e974f530d Ladybird+LibWebView: Add an Inspector action to clone a DOM node 2023-12-07 23:16:34 +01:00
Timothy Flynn d5d6ff8bf1 Ladybird+LibWebView: Add an Inspector action to insert a child DOM node 2023-12-07 23:16:34 +01:00