Commit graph

283 commits

Author SHA1 Message Date
demostanis 34acae90c7 Userland: Let applications make use of make_command_palette_action() 2022-10-25 10:21:18 +01:00
Ali Mohammad Pur 166a905951 Userland: Properly populate GENERATED_SOURCES
We previously put the generated headers in SOURCES, which did not mark
them as GENERATED (and did not produce a proper dependency).
This commit moves all generated headers into GENERATED_SOURCES, and
removes useless header SOURCES.
2022-10-12 15:55:15 +01:00
networkException 4230dbbb21 AK+Everywhere: Replace "protocol" with "scheme" url helpers
URL had properly named replacements for protocol(), set_protocol() and
create_with_file_protocol() already. This patch removes these function
and updates all call sites to use the functions named according to the
specification.

See https://url.spec.whatwg.org/#concept-url-scheme
2022-09-29 09:39:04 +01:00
Timothy Flynn fc8bf7ac3e LibUnicode+Userland: Migrate generated CLDR data to LibLocaleData
Currently, LibUnicodeData contains the generated UCD and CLDR data. Move
the UCD data to the main LibUnicode library, and rename LibUnicodeData
to LibLocaleData. This is another prepatory change to migrate to
LibLocale.
2022-09-05 14:37:16 -04:00
thankyouverycool 0d4fd4e2a6 LibGfx+LibGUI+WindowServer+Apps+Demos: Replace ToolWindows
with the RenderAbove WindowMode. This mode will ensure child
windows always draw above their parents, even when focus is lost.
RenderAbove modals are automatically themed the same as the old
ToolWindows. Fixes ToolWindows rendering above ALL normal windows,
regardless of parent. We can't rely on WindowType to create these
sort of effects because of WindowManager's strict display hierarchy.
2022-08-25 13:28:50 +02:00
Sam Atkins ca0e32e59f FontEditor: Mark pasted glyphs as modified
Co-authored-by: thankyouverycool <66646555+thankyouverycool@users.noreply.github.com>
2022-08-14 13:59:19 +01:00
Sam Atkins 5b7168b247 FontEditor: Add an option to show or hide modification highlights 2022-08-14 13:59:19 +01:00
Sam Atkins 7f6bf8c7c1 FontEditor: Store glyph modified state on the undo stack
This means that if you modify a glyph, then undo that modification, we
stop showing the glyph as modified.
2022-08-14 13:59:19 +01:00
thankyouverycool a808cfa75c LibGUI+Applications: Govern Splitter resizing by opportunistic growth
This patch replaces the concept of fixed resizees with opportunistic
ones which use the new SpecialDimension::OpportunisticGrow UISize.
This lets us simplify splitter resize code and take advantage of
the layout system's automatic calculations for minimum size and
expansion. Functionally the same as before, but fixes Splitter's
unintended ability to grow window size.
2022-08-05 13:54:18 +02:00
thankyouverycool 7537a045e5 Applications: Make a few of the larger Toolbars collapsible
Some Toolbars for FileManager, FontEditor and PixelPaint can now
collapse on resize.
2022-08-04 02:56:17 +02:00
thankyouverycool 407231f11c FontEditor: Move new font creation to NewFontDialog and handle errors
Fixes potential OOM crashes when creating a new font and an oversight
in which glyph spacing was not being set.
2022-08-04 02:54:00 +02:00
thankyouverycool 807bd6da6c FontEditor: Improve error handling opening, saving and editing fonts
Adds fallible functions for opening and saving fonts and cutting
and copying selections. FontEditor now falls back on a guaranteed
default BitmapFont on startup. Fixes crashing on start when the
default system font is set to TrueType.
2022-08-04 02:54:00 +02:00
thankyouverycool e9a150c87c FontEditor: Add show_error() helper 2022-08-04 02:54:00 +02:00
thankyouverycool c044a556db FontEditor: Let editor recover from failed initializations
Fail early during font initialization and leave the editor in a
valid state in case of errors during UndoSelection creation.
2022-08-04 02:54:00 +02:00
sin-ack c8585b77d2 Everywhere: Replace single-char StringView op. arguments with chars
This prevents us from needing a sv suffix, and potentially reduces the
need to run generic code for a single character (as contains,
starts_with, ends_with etc. for a char will be just a length and
equality check).

No functional changes.
2022-07-12 23:11:35 +02:00
sin-ack 3f3f45580a Everywhere: Add sv suffix to strings relying on StringView(char const*)
Each of these strings would previously rely on StringView's char const*
constructor overload, which would call __builtin_strlen on the string.
Since we now have operator ""sv, we can replace these with much simpler
versions. This opens the door to being able to remove
StringView(char const*).

No functional changes.
2022-07-12 23:11:35 +02:00
thankyouverycool 69a385f559 FontEditor: Rename FontEditorWidget => FontEditor::MainWidget 2022-07-06 14:25:30 +02:00
thankyouverycool dcf6454059 FontEditor: Hide Widget::set_font() in GlyphEditorWidget
We were already doing the same for its getters, and this makes its
API more consistent with GlyphMapWidget.
2022-07-06 14:25:30 +02:00
thankyouverycool bae36a7264 FontEditor: Remove unused headers and member variables 2022-07-06 14:25:30 +02:00
thankyouverycool 2227f8f8ae FontEditor: Simplify GlyphMapWidget context menu construction 2022-07-06 14:25:30 +02:00
thankyouverycool dc3ee84aca FontEditor: Update GML for new layout system
This patch removes deprecated GML properties and manual sizing
calculations in favor of the new UIDimensions, and registers more
widgets in the FontEditor namespace to simplify widget setup.
2022-07-06 14:25:30 +02:00
thankyouverycool 1b9dff5fb1 FontEditor: Convert preview window to GML and propagate its errors 2022-07-06 14:25:30 +02:00
thankyouverycool 7376c68652 FontEditor: Propagate errors when pushing undo commands 2022-07-06 14:25:30 +02:00
thankyouverycool ae333fad98 FontEditor: Normalize GlyphMap selection before creating UndoSelection
Fixes bogus indexing crashes when creating new restore states.
2022-07-06 14:25:30 +02:00
thankyouverycool 9962a744eb FontEditor: Improve error propagation during construction
FontEditor now builds its actions, toolbars, models and menus
with fallible methods. Widget assignment from GML is now organized
in order of use.
2022-07-06 14:25:30 +02:00
Sam Atkins cdffe556c8 LibGUI+Userland: Make Dialog::ExecResult an enum class 2022-05-13 16:27:43 +02:00
Simon Wanner 206d6ece55 LibGfx: Move other font-related files to LibGfx/Font/ 2022-04-09 23:48:18 +02:00
thankyouverycool b8cc18896f LibGUI+FontEditor: Add context menu for editor actions
GlyphMapWidget now reports context menu requests when secondary
clicking the map. This also adds a new Select All action and updates
the Copy Character action to work on multi-glyph selections. Glyph
navigation actions have been moved to a separate Go menu, as is
common in other apps.
2022-03-20 20:00:25 +01:00
thankyouverycool 42284a1550 FontEditor: Change flip action shortcuts to Ctrl+Shift+{Q,W}
To not interfere with the command palette.
2022-03-20 20:00:25 +01:00
thankyouverycool cdd1bc64f6 FontEditor: Set width on copy only if source glyph is present
Fixes empty glyphs copying as present in fixed-width fonts.
2022-03-20 20:00:25 +01:00
thankyouverycool 212817ea20 FontEditor: Restore selections on undo/redo actions
This makes navigating undo history a lot easier to follow.
Individual glyph alterations now reset selection size if necessary
to save space.
2022-03-20 20:00:25 +01:00
thankyouverycool ab86294660 FontEditor: Reset unicode block view on undo/redo actions
If the previous active glyph is outside the currently selected
block range, reset GlyphMap to show all glyphs. This is less
disorienting when undoing changes outside the visible range.
2022-03-18 01:12:26 +01:00
thankyouverycool a3956da6dc FontEditor: Make undo/redo compatible with multi-glyph selections
Previously the glyph undo stack saved an array of bytes representing
the restore state of an individual glyph when modified. Now the
selection undo stack saves a byte buffer of the entire selection,
letting us restore changes to multiple glyphs at once.
2022-03-18 01:12:26 +01:00
thankyouverycool 17b16f3997 FontEditor: Use memset/memcpy to copy/paste/delete glyphs
Iterating over each glyph to set bits was rather slow in large
selections. This lets us edit the entire character set almost
instantly.
2022-03-18 01:12:26 +01:00
electrikmilk 056ca62778 FontEditor: Add code previews for fixed-width fonts
Add pseudo code to font preview for fixed-width programming fonts.
2022-03-05 21:24:25 +01:00
Karol Kosek cef595aa5c CharacterMap+FontEditor: Switch current Unicode block on arrow press 2022-03-04 11:53:04 -05:00
Lenny Maiorani 064cfd6cb7 Applications: Fix undefined behavior capturing non-static constexpr 2022-03-02 22:01:58 -08:00
Lenny Maiorani 1dd70a6f49 Applications: Change static constexpr variables to constexpr
Function-local `static constexpr` variables can be `constexpr`. This
can reduce memory consumption, binary size, and offer additional
compiler optimizations.
2022-02-28 13:54:27 +01:00
thankyouverycool c3ce562240 LibGUI+Apps: Let Splitters select which resizee to set fixed
This gives Splitters more versatility when the right resizee is
intended to remain fixed or be toggled on and off.
2022-02-23 18:56:22 +02:00
thankyouverycool cd4c11ebaf FontEditor: Remove listener client
FontEditor was relying on a hack to get notified about i32 config
changes, and scale is not a setting we want updated across all
editor instances, nor do we have any settings that make sense to
monitor universally, so let's remove listener privileges for now.
2022-02-18 07:38:29 -05:00
thankyouverycool 0d29419ed4 FontEditor: Save settings for showing metadata and unicode blocks 2022-02-18 07:38:29 -05:00
thankyouverycool 0061af170f FontEditor: Add a search box to filter Unicode blocks 2022-02-18 07:38:29 -05:00
Idan Horowitz a8e329461f Applications: Run gml-format 2022-02-15 19:33:46 +02:00
thankyouverycool aefb2bcf43 FontEditor: Add a ListView to sort glyphs by their Unicode block 2022-02-15 10:13:19 -05:00
Lenny Maiorani 160bda7228 Applications: Use default constructors/destructors
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules

"The compiler is more likely to get the default semantics right and
you cannot implement these functions better than the compiler."
2022-02-14 22:06:55 +00:00
Idan Horowitz c8ab45e79f Userland: Run gml-format
This brings the existing GML files up to spec with the new requirements
2022-02-13 02:36:35 +02:00
Vitaly Dyachkov 32b8795091 LibConfig: Rename pledge_domains(String) => pledge_domain(String)
pledge_domains() that takes only one String argument was specifically
added as a shortcut for pledging a single domain. So, it makes sense to
use singular here.
2022-02-11 18:06:39 +01:00
kleines Filmröllchen 6ee597369d Meta+Userland: Run the GML formatter on CI and pre-commit
Now that the GML formatter is both perserving comments and also mostly
agrees to the existing GML style, it can be used to auto-format all the
GML files in the system. This commit does not only contain the scripts
for running the formatting on CI and the pre-commit hook, but also
initially formats all the existing GML files so that the hook is
successfull.
2022-02-07 18:39:50 +01:00
Timothy Flynn d51d5f9591 FontEditor: Retrieve code point abbreviations from LibUnicode
Rather than using a hard-coded list from AK::UnicodeUtils, LibUnicode
contains the up-to-date official names and contains abbreviations for
more control code points.
2022-01-18 15:13:25 +00:00
thankyouverycool c094bb60bc FontEditor: Set GlyphEditor glyph on initialization
Fixes GlyphEditor appearing blank on start and subsequent
re-initializations.
2022-01-16 21:36:39 +01:00
thankyouverycool 8f60ea4470 FontEditor: Disambiguate save function from save-as action 2022-01-16 21:36:39 +01:00
thankyouverycool c2b7bbbb2c FontEditor: Update GlyphEditor and width widgets on paste and delete
Fixes unsynced state between widgets after paste and delete actions.
2022-01-16 21:36:39 +01:00
thankyouverycool 7d7f683715 FontEditor: Correct GroupBox height
Font Metadata's GroupBox height was off by an _unsightly_ 2 pixels.
Now we make heights explicit for all child widgets and let shrink_to_fit
automatically calculate things.
2022-01-16 21:36:39 +01:00
thankyouverycool 24bd2a427c FontEditor: Calculate GlyphEditor toolbar widths more precisely
Fixes pixel imperfect toolbar widths when editing small fonts.
2022-01-16 21:36:39 +01:00
thankyouverycool 2e849250eb FontEditor: Remove unnecessary call during GlyphEditor init
GlyphEditor's relative rect is automatically set during layout.
2022-01-16 21:36:39 +01:00
thankyouverycool ff42ad88ee FontEditor: Remove .gitignore artifact from old build system 2022-01-16 21:36:39 +01:00
Sam Atkins e975db23c0 LibGUI+FontEditor: Move seek-prev/next-glyph logic into GlyphMapWidget 2022-01-16 11:17:03 +01:00
Sam Atkins 21a24c36a8 LibGUI: Make GlyphMapWidget work with vector fonts
This basically just meant replacing the `m_font` field with the one
inherited from Widget.
2022-01-16 11:17:03 +01:00
Sam Atkins 8175cd0a28 LibGUI+FontEditor: Move GlyphMapWidget to LibGUI
This will allow us to use this in other apps, such as the upcoming
Character Map. :^)
2022-01-16 11:17:03 +01:00
Lady Gegga 10a52c0b32 FontEditor: Add Klingon phrase to Preview Font 2022-01-12 22:54:59 +01:00
creator1creeper1 deed6388ef FontEditor: Propagate errors using try_set_main_widget in main 2022-01-09 00:56:11 +01:00
Maciej 1d98499234 FontEditor: Support selection ranges
This makes editing much easier, e.g. you don't need longer to copy
hundreds of glyphs one by one.

It has some flaws, e.g. it's not integrated with undo stack,
but we need to start with something!
2022-01-09 00:18:46 +01:00
Maciej 22b3c25f10 FontEditor: Save scale to config file 2022-01-09 00:18:46 +01:00
Maciej 4d4764e0fb FontEditor: Display something for emoji glyphs
This commit makes FontEditor displaying emojis in GlyphMapWidget. They
are not editable, what is marked by red background of a glyph.

Additionally, a proper information is displayed in statusbar.

Fixes #10900.
2022-01-09 00:18:46 +01:00
Marcus Nilsson cecbed467b LibGUI: Move rotate cw/ccw to CommonActions
The rotate clockwise/rotate counterclockwise actions can be added to
CommonActions since they are repeated in FontEditor, ImageViewer and
PixelPaint. This keeps the shortcuts and icons consistent across
applications.
2022-01-06 21:25:02 +01:00
Andreas Kling 219339d2a5 FontEditor: Use GUI::MessageBox::ask_about_unsaved_changes() 2022-01-04 21:49:44 +01:00
Timothy Flynn 565a880ce5 Userland: Link directly against LibUnicodeData where needed
This is partially a revert of commits:
    10a8b6d411
    561b67a1ad

Rather than adding the prot_exec pledge requried to use dlopen(), we can
link directly against LibUnicodeData in applications that we know need
that library.

This might make the dlopen() dance a bit unnecessary. The same purpose
might now be fulfilled with weak symbols. That can be revisted next, but
for now, this at least removes the potential security risk of apps like
the Browser having prot_exec privileges.
2021-12-30 14:18:12 +01:00
Timothy Flynn 10a8b6d411 Userland: Add unveil/pledge requisites for dynamic Unicode data loading
Loading libunicodedata.so will require dlopen(), which in turn requires
mmap(). The 'prot_exec' pledge is needed for this.

Further, the .so itself must be unveiled for reading. The "real" path is
unveiled (libunicodedata.so.serenity) as the symlink (libunicodedata.so)
itself cannot be unveiled.
2021-12-21 13:09:49 -08:00
thankyouverycool 298a6b9937 LibGUI+FontEditor: Allow ComboBox on_change callback to be toggled
When calling set_selected_index() on ComboBox, allow its on_change
callback to be disabled. Fixes FontEditor window state erroneously
switching to modified when initializing between different slopes
and weights.
2021-11-30 10:51:51 +01:00
thankyouverycool ca062d83db FontEditor: Convert to east const 2021-11-30 10:51:51 +01:00
thankyouverycool de77e28360 FontEditor: Correct member type and initialization in UndoGlyph
Makes code_point type u32, consistent with the rest of the system,
and properly initializes it.
2021-11-30 10:51:51 +01:00
thankyouverycool e3e3c03dca FontEditor: Remove unused Vector<String> 2021-11-30 10:51:51 +01:00
thankyouverycool ca77aea099 FontEditor: Correct NewFontDialog layout issues
Fixes incorrect scale initialization and inconsistent margins, sets
minimum values for glyph width and height to 1, and labels page 1
more precisely as "Typeface" properties.
2021-11-30 10:51:51 +01:00
thankyouverycool 9b184fc1cb FontEditor: Clean up GlyphMapWidget header
Fixes minor organizational inconsistency and zeroes initializations
for rows and columns as the previous values haven't been meaningful
since the map was converted to a scrollable widget. No functional
changes.
2021-11-30 10:51:51 +01:00
thankyouverycool 7d73d2dfc8 FontEditor: Remove superfluous 'this' pointers 2021-11-30 10:51:51 +01:00
thankyouverycool e29abc5395 LibGfx+FontEditor: Consolidate BitmapFont width and height limits
And make them more self-documenting. Previously these constraints
were duplicated across multiple files.
2021-11-30 10:51:51 +01:00
thankyouverycool 541f1de3a8 FontEditor: Add scaled offset members to GlyphEditor
Previously these were undescriptive globals making them a bit cryptic.
2021-11-30 10:51:51 +01:00
thankyouverycool aa09e40eb2 FontEditor: Update status bar on initialization
Fixes incorrect glyph status immediately after loading a new font.
2021-11-30 10:51:51 +01:00
thankyouverycool ae922c67fd FontEditor: Remove code duplication when resizing GlyphEditor
The left column now also enforces a minimum width to prevent especially
small fonts from hiding the glyph toolbars and width widgets.
2021-11-30 10:51:51 +01:00
thankyouverycool c1744822a1 FontEditor: Account for glyph width when pasting
Fixes glyphs not expanding up to their maximum width if necessary
when pasting larger glyphs into smaller ones.
2021-11-30 10:51:51 +01:00
thankyouverycool 281805696b FontEditor: Don't allow cutting and copying absent glyphs
And update status bar on cut. Fixes placing these effectless actions
on the undo stack.
2021-11-30 10:51:51 +01:00
thankyouverycool d2b211f14a FontEditor: Don't null check newly created NonnullRefPtr fonts 2021-11-30 10:51:51 +01:00
thankyouverycool 74938e6f42 FontEditor: Factor out redundant code for a request to close 2021-11-30 10:51:51 +01:00
thankyouverycool 1e052f5a91 FontEditor: Convert mode and transform buttons into toolbar actions
This will let us more easily organize and assign shortcuts to new
modes and transformations as they are built, and it generally looks
more polished as a uniform interface. Also adds a counterclockwise
option to the rotate action, moves Copy as Character to the edit
menu as it doesn't directly impact GlyphEditor, and makes the paint
and move modes exclusive checkables to make the editor's state more
visually obvious.
2021-11-30 10:51:51 +01:00
thankyouverycool 922e80e72b FontEditor: Simplify start-up
Previusly a cloned or newly loaded font was moved twice from main to
the constructor and then from constructor to an init routine where it
was finally used. The unmasked font is now moved only once, directly
to initialization, and redundant error checking is discarded.
2021-11-30 10:51:51 +01:00
thankyouverycool 56a8a2b493 FontEditor: Use LibUnicode to convert character case
Fixes characters beyond the Basic Latin code block not showing
their upper-case form in the preview window.
2021-11-30 10:51:51 +01:00
thankyouverycool edf86af4f4 LibGfx+FontEditor: Add helper to determine raw glyph presence
GlyphBitmaps are considered present if they have a width greater
than zero. This adds a counterpart method for raw (unmasked) glyphs
and makes intent more explicit throughout FontEditor.
2021-11-30 10:51:51 +01:00
Brian Gianforcaro cf4fa936be Everywhere: Use default execpromises argument for Core::System::pledge 2021-11-28 08:04:57 +01:00
Andreas Kling b6f49924be LibDesktop: Make allowlist APIs return ErrorOr<void>
This makes it very smooth to use TRY() when setting up these lists,
as you can see in the rest of this commit. :^)
2021-11-24 00:25:23 +01:00
Andreas Kling ba4fd8fa15 FontEditor: Port to LibMain :^) 2021-11-24 00:25:23 +01:00
Ben Wiederhake 69cbaac50a FontEditor: Make glyph parsing more robust
In particular, we sanity-check the received width, height, and buffer
size, before allocating.
2021-11-21 11:49:06 +00:00
Ben Wiederhake f22c0ffe0c LibGUI+Everywhere: Make sync requests to Clipboard server more obvious 2021-11-21 11:49:06 +00:00
Ben Wiederhake d29f094ffa FontEditor: Make paste access to Clipboard atomic
This avoids data race issues and saves three out of four synchronous
requests to the ClipboardServer.
2021-11-21 11:49:06 +00:00
Ben Wiederhake 63078ba7fc FontEditor: Set all pixels when pasting a glyph
For an empty glyph (all pixels initially clear), this makes no
difference. However, if the glyph for the selected code point already
contains some set pixels, pasting used to "add" the set pixels, instead
of overwriting.
2021-11-20 12:56:35 +01:00
Ben Wiederhake 8d80d1346d FontEditor: Add ability to copy the selected code point
This makes it easier to preview the current glyph, if it is not easily
typable.
2021-11-20 12:56:35 +01:00
Ben Wiederhake 7180813cd4 FontEditor: Support flipping and rotating
This is especially useful for highly symmetric scripts like this:
https://www.unicode.org/charts/PDF/U1400.pdf
2021-11-20 12:56:35 +01:00
Ben Wiederhake 1dfb3ff4eb FontEditor: Tighten type of UndoGlyph::undo_state (cannot fail) 2021-11-20 12:56:35 +01:00
Ben Wiederhake bce5a0a00d FontEditor: Don't show focus box after clicking 'present' checkbox 2021-11-20 12:56:35 +01:00
Ben Wiederhake 197b5f7c4a FontEditor: More reasonable labels, move property to GML 2021-11-20 12:56:35 +01:00
Ben Wiederhake a8c95097b5 FontEditor: Convert UI from fixed to implicit height
This gets rid of a magic number, and means that the widget will adapt
nicely when the system font changes.
2021-11-20 12:56:35 +01:00
Ben Wiederhake b224efe73b FontEditor: Show code point name in status bar 2021-11-20 00:31:55 +01:00
Andreas Kling a7f1f1c34b LibCore: Use ErrorOr<T> for Core::File::open() 2021-11-08 00:35:27 +01:00
Andreas Kling 235f39e449 LibGfx: Use ErrorOr<T> for Bitmap::try_load_from_file()
This was used in a lot of places, so this patch makes liberal use of
ErrorOr<T>::release_value_but_fixme_should_propagate_errors().
2021-11-08 00:35:27 +01:00
FrHun 54605794f9 Applications: Remove border from GroupBox margins 2021-11-03 16:13:19 +01:00
Filiph Sandström d6a0726302 Everywhere: Rename left/right-click to primary/secondary
This resolves #10641.
2021-10-27 22:05:58 +03:00
Karol Kosek 0a54a86a8b FontEditor: Accept file drops 2021-10-17 13:53:08 +01:00
Karol Kosek a0cb8cfefd FontEditor: Add FontEditorWidget::open_file() function
This part is also quite needed when opening files from drag-and-drop
events.
2021-10-17 13:53:08 +01:00
Karol Kosek 72378fd36c FontEditor: Reuse the request_close() function in Open action 2021-10-17 13:53:08 +01:00
Gal Horowitz cfc5df27f0 FontEditor: Close preview window when the main window is closed 2021-10-02 20:55:14 +02:00
thankyouverycool fde48f1a7a FontEditor: Allow editing new font header
And make use of mapping functions moved from
LibGUI/FontPickerWeightModel.h => LibGfx/FontStyleMapping.h
2021-09-24 14:59:39 +02:00
thankyouverycool bbaebdcd00 FontEditor: Keep selected glyph in view on resize 2021-09-22 21:35:42 +02:00
thankyouverycool efe44451ca FontEditor: Make update_{statusbar,preview} member functions
For use outside constructor. Renames demo to preview to make
the UI and code comport.
2021-09-22 21:35:42 +02:00
thankyouverycool e8f3fda3cf FontEditor: Remove reprobe_font()
This was used to update GlyphMapWidget on Type changes and is
no longer needed since removal of Type enumeration in bb592ae.
2021-09-22 21:35:42 +02:00
thankyouverycool 144d32d537 FontEditor: Sanitize RTL and control glyphs in Clipboard metadata
Fixes display issues in ClipboardHistory.
2021-09-22 21:35:42 +02:00
thankyouverycool 0a4640e892 FontEditor: Put glyph width changes on the undo stack
And select the restored glyph on undo/redo.
2021-09-22 21:35:42 +02:00
thankyouverycool 1ae4caca4b FontEditor: Set width to zero when deleting a glyph
Previously, Delete left a glyph's width maximized.
2021-09-22 21:35:42 +02:00
thankyouverycool ca6cb6cec3 FontEditor: Simplify initialization by disabling widget callbacks
Reduces some complexity dealing with callback effects and fixes
redundant calls to update_title and erroneously set glyph widths.
2021-09-22 21:35:42 +02:00
thankyouverycool dc65535b7c FontEditor: Add new tools to navigate code points
Visible glyphs can now be cycled through, or a code point specified
and jumped to directly.
2021-09-19 00:58:59 +02:00
thankyouverycool a486415f03 FontEditor: Update editor to handle new font format
The editor now unmasks fonts on load, mapping their glyphs to the
complete unicode character set, and masks them upon saving to
reduce disk space. This is a naive approach in terms of memory
usage and can be improved but whose immediate goal is to allow
editing any glyph without concern for range allocation.
2021-09-19 00:58:59 +02:00
Mustafa Quraish 0f749681a9 Everywhere: Use my fancy new serenityos.org email :^) 2021-09-13 20:51:50 +00:00
Mustafa Quraish c1ede97543 FontEditor: Don't loop over all glyphs to find selected one
Previously we would loop over all glyphs in the GlyphMap, compute
their rects, and then test to see if the mouse click position was
inside that rect. This is silly since each element in the glyph
map for a particular font is the same size, and we can just do
some coordinate manipulation to get the index directly.
2021-09-06 14:01:24 +04:30
Ali Mohammad Pur 97e97bccab Everywhere: Make ByteBuffer::{create_*,copy}() OOM-safe 2021-09-06 01:53:26 +02:00
sin-ack 8ea22121ac Userland: Migrate to argument-less deferred_invoke
Only one place used this argument and it was to hold on to a strong ref
for the object. Since we already do that now, there's no need to keep
this argument around since this can be easily captured.

This commit contains no changes.
2021-09-02 03:47:47 +04:30
thankyouverycool 96dee93d3f FontEditor: Adjust margins and spacing
Brings vertical spacing in line with most other apps using
ToolbarContainers. Fixes GroupBox margins since CSS ordering
change.
2021-08-27 12:38:29 +02:00
thankyouverycool e8e7c59c34 FontEditor: Let WindowServer manage modified markings
Simplifies building modified/new font titles and lets FontEditor
make use of the comfy ellipsis close button.
2021-08-27 12:38:29 +02:00
thankyouverycool a621932c11 FontEditor: Save discrete undo and redo states for each Command
Makes undo/redo actions compatible with the updated UndoStack sans
finalization. Fixes having to click actions twice.
2021-08-27 12:38:29 +02:00
sin-ack e11d177618 Userland+LibGUI: Add shorthand versions of the Margins constructor
This allows for typing [8] instead of [8, 8, 8, 8] to specify the same
margin on all edges, for example. The constructors follow CSS' style of
specifying margins. The added constructors are:

- Margins(int all): Sets the same margin on all edges.
- Margins(int vertical, int horizontal): Sets the first argument to top
  and bottom margins, and the second argument to left and right margins.
- Margins(int top, int vertical, int bottom): Sets the first argument to
  the top margin, the second argument to the left and right margins,
  and the third argument to the bottom margin.
2021-08-18 10:30:50 +02:00
sin-ack 9c9a5c55cb Userland+LibGUI: Make Margins arguments match CSS ordering
Previously the argument order for Margins was (left, top, right,
bottom). To make it more familiar and closer to how CSS does it, the
argument order is now (top, right, bottom, left).
2021-08-18 10:30:50 +02:00
Brian Gianforcaro a51e6547aa Applications: Remove unused header includes 2021-08-01 08:10:16 +02:00
FrHun 033c14e574 FontEditor: Fix minor margin inconsistency 2021-07-27 22:17:23 +02:00
Andreas Kling 687a12d7fb Userland: Add GUI::Window::add_menu() and use it everywhere
Applications previously had to create a GUI::Menubar object, add menus
to it, and then call GUI::Window::set_menubar().

This patch introduces GUI::Window::add_menu() which creates the menubar
automatically and adds items to it. Application code becomes slightly
simpler as a result. :^)
2021-07-21 21:24:26 +02:00
Andreas Kling c7d891765c LibGfx: Use "try_" prefix for static factory functions
Also mark them as [[nodiscard]].
2021-07-21 18:02:15 +02:00
Andreas Kling 42fab36f02 FontEditor: Tweak offensive padding :^) 2021-07-10 16:13:44 +02:00
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
Ali Mohammad Pur 51c2c69357 AK+Everywhere: Disallow constructing Functions from incompatible types
Previously, AK::Function would accept _any_ callable type, and try to
call it when called, first with the given set of arguments, then with
zero arguments, and if all of those failed, it would simply not call the
function and **return a value-constructed Out type**.
This lead to many, many, many hard to debug situations when someone
forgot a `const` in their lambda argument types, and many cases of
people taking zero arguments in their lambdas to ignore them.
This commit reworks the Function interface to not include any such
surprising behaviour, if your function instance is not callable with
the declared argument set of the Function, it can simply not be
assigned to that Function instance, end of story.
2021-06-06 00:27:30 +04:30
Linus Groh d60ebbbba6 Revert "Userland: static vs non-static constexpr variables"
This reverts commit 800ea8ea96.

Booting the system no longer worked after these changes.
2021-05-21 10:30:52 +01:00
Lenny Maiorani 800ea8ea96 Userland: static vs non-static constexpr variables
Problem:
- `static` variables consume memory and sometimes are less
  optimizable.
- `static const` variables can be `constexpr`, usually.
- `static` function-local variables require an initialization check
  every time the function is run.

Solution:
- If a global `static` variable is only used in a single function then
  move it into the function and make it non-`static` and `constexpr`.
- Make all global `static` variables `constexpr` instead of `const`.
- Change function-local `static const[expr]` variables to be just
  `constexpr`.
2021-05-21 10:07:06 +01:00
Max Wipfli 4cd8ca07e3 FontEditor: Make statusbar text generation more robust
This makes a few modifications to the statusbar text generation:
* Use the canonical U+XXXX representation of unicode characters.
* For control characters, display their alias instead of whitespace.
* Substitute RTL codepoints with U+FFFD so the text paints correctly.
* Only show the glyph's dimensions if it actually exists in the font.

This fixes #7286.
2021-05-20 22:10:45 +02:00
Max Wipfli 621a4008e6 FontEditor: Add tooltip to "Move Glyph" button
This adds a simple tooltip to the "Move Glyph" button to indicate its
functionality.
2021-05-20 22:10:45 +02:00
Daniel Bertalan a5801e9919
FontEditor: Add missing unix pledge
Without this change, FontEditor would crash due to LibDesktop opening an
IPC connection.

Fixes #7137.
2021-05-15 16:07:05 +01:00
Andreas Kling 31d4bcf5bf Userland: Tighten a *lot* of pledges! :^)
Since applications using Core::EventLoop no longer need to create a
socket in /tmp/rpc/, and also don't need to listen for incoming
connections on this socket, we can remove a whole bunch of pledges!
2021-05-13 23:28:40 +02:00
Andreas Kling 161568103e LibGUI: Remove UndoStack's automatic command combo'ing
UndoStack will now merge adjacent commands *if they want to be merged*
instead of bundling everything you push onto it until you tell it
to "finalize the combo."

This uses less memory and gives applications full control over how
their undo stacks end up. :^)
2021-05-08 22:17:51 +02:00
Andreas Kling d47f15ab8b LibGUI: Rename ScrollableWidget => AbstractScrollableWidget 2021-05-03 21:03:13 +02:00
Andreas Kling 4b0098e52f Everywhere: Rename app_menu to file_menu or game_menu 2021-05-01 17:40:54 +02:00
Linus Groh 649d2faeab Everywhere: Use "the SerenityOS developers." in copyright headers
We had some inconsistencies before:

- Sometimes "The", sometimes "the"
- Sometimes trailing ".", sometimes no trailing "."

I picked the most common one (lowecase "the", trailing ".") and applied
it to all copyright headers.

By using the exact same string everywhere we can ensure nothing gets
missed during a global search (and replace), and that these
inconsistencies are not spread any further (as copyright headers are
commonly copied to new files).
2021-04-29 00:59:26 +02:00
thankyouverycool ed634a4582 FontEditor: Don't put invalid clicks on the undo stack 2021-04-26 18:43:35 +02:00
thankyouverycool 8febfb169d FontEditor: Warn on unsaved changes
Standardizes saving conventions: Editor now warns on close, new,
and open if there are unsaved changes, and new files prompt to
Save As.
2021-04-26 18:43:35 +02:00
Andreas Kling b91c49364d AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to
create a NonnullOwnPtr from the result of a naked new.)
2021-04-23 16:46:57 +02:00
thankyouverycool f0f487babd FontEditor: Set proper defaults in NewFontDialog
GlyphBitmap width is currently limited to twiddling 32 bits so
abide by a 32x36 standard for now. Fixes incorrect line values and
ranges and removes unused RefPtr.
2021-04-23 11:08:11 +02:00
thankyouverycool cc7744f6ca LibGfx+FontEditor: Account for raw width when painting glyphs
Fixes hidden glyphs being painted in editor and map, and '?'
subsitute glyphs being overdrawn in the system.
2021-04-23 11:08:11 +02:00