Commit Graph

120 Commits

Author SHA1 Message Date
Benjamin Otte
3be7ef17ff node-editor: Make this app non-unique
There's no benefit in having multiple windows share the process.

But there's a huge disadvantage because running the app a 2nd time with
different environment variables will open a window in the first process
instead and discard the variables.

And my use of GSK_RENDERER hates that.
2024-06-21 19:53:46 +02:00
Matthias Clasen
9904259661 gsk: Serialize hint metrics too
We need this to ensure that we properly roundtrip text nodes
without any changes.
2024-05-01 14:00:18 -04:00
Matthias Clasen
b018da2acd gsk: Accept font options in node files
The goal is to fix all the context that influences the rendering
of text nodes in the node file. This will help with better font
testing.

The newly accepted properties are

hint-style: none/slight/full
antialias: none/gray

We are omitting font options and values that aren't supported
in GSK or have no influence on the rendering.

Note that these settings will get incorporated in the PangoFont
that gets set on the resulting text node.

Parser tests included.
2024-03-02 18:39:14 -05:00
Matthias Clasen
f5159e1ecb gsk: Make glyph parsing more flexible
It is a bit annoying that one has to specify the glyph width
when specifying glyphs numerically for a text node, since this
information really is part of the font.

Make the parser more flexible, and allow to specify just the glyph
ids, without an explicit width. In this case, the width will be
determined from the font.

With this, glyphs can now be specified in any of the follwing
ways:

glyphs: "ABC";              (ASCII)
glyphs: 23, 45, 1001;       (Glyph IDs)
glyphs: 23 10, 100 11.1;    (Glyph IDs and advance widths)
glyphs: 23 10 1 2 color;    (with offsets and flags)

Tests have been updated to cover these variants.
2024-03-01 11:22:28 -05:00
Matthias Clasen
b7422c0f62 nodeparser: Change default font
Use Cantarell 15px instead of Cantarell 11, ot make roundtrip
tests easier to read.
2024-02-27 23:45:46 -05:00
Matthias Clasen
f858daeca4 node-editor: Don't help too much
This was somehow duplicated when the reload action was added.
2024-02-12 14:19:21 -05:00
Matthias Clasen
d3e4d310b2 node-editor: Improve the crash warning
Hint in the text how to reenable auto-reload. A button for this
is not practical in the notification itself, since it will just
crash again if you reenable it without editing the content.
2024-02-06 18:41:47 +00:00
Matthias Clasen
77c115c224 node-editor: Make crash handling more robust
Handle cases where the crash only happens in render(), and not
in reload().
2024-02-06 18:41:47 +00:00
Matthias Clasen
f2ec2f2a58 node-editor: Make the crash warning work
In some cases, we leave behind both an autosave and an
autosave-unsafe file, so check for the unsafe one first.
2024-01-27 10:21:26 -05:00
Matthias Clasen
3bd1f491d1 node-editor: Remove some dead code
We ended up not needing a map implementation after all.
Remove the vestiges.
2024-01-23 00:07:23 -05:00
Matthias Clasen
c7b345f73e build: Move and rename demo_conf.h header
We want to use the same header in the inspector, so move it to
the toplevel. And since it is no longer for demos only, rename
it to profile_conf.h, and also rename the build option back
to profile.
2024-01-18 20:20:58 -05:00
Matthias Clasen
c2abf30c46 Revert "node-editor: Make test fonts available"
This reverts commit 4882514234.

We can now put custom fonts into node files, so there is
no more need for this.
2024-01-16 07:04:45 -05:00
Matthias Clasen
8158945de9 gsk: Allow custom fonts in node files
This will let us store complete test fonts inside node files,
as data: urls. You can also use a file: url to refer to a local
file.

The syntax is as follows:

text {
  font: "FONT DESCRIPTION" url("data:font/ttf;base64,FONT DATA");
}

with the url being optional.
2024-01-15 18:58:17 -05:00
Matthias Clasen
48dc7df5b7 Update the node format docs
Mention the new syntax for naming and reusing textures.
2024-01-15 07:46:18 -05:00
Matthias Clasen
550e98090a node-editor: Redo crash recovery UX
Switch from a dialog to an in-app notification, and make use
of the new auto-reload property for it.
2024-01-14 14:40:51 -05:00
Matthias Clasen
2771befdd9 node-editor: Add a menu items for auto reloading
Expose the auto-reload property as a toggle action, and add
a menu item for it.
2024-01-14 14:40:51 -05:00
Matthias Clasen
911730493d node-editor: Add an auto-reload property
This is not exposed anywhere yet.
2024-01-14 14:40:51 -05:00
Matthias Clasen
d41fb7c5a6 node-editor: Add commandline options
Add --reset to remove the autosave file. While we're at it, also
add --version.
2024-01-12 20:50:34 -05:00
Matthias Clasen
3b28c46595 node-editor: Add autosave
Save the buffer contents to a file in ~/.cache/gtk4-node-editor
and restore it on startup.
2024-01-12 20:50:34 -05:00
Matthias Clasen
4882514234 node-editor: Make test fonts available
Add the directory containing test fonts for gsk tests to the
font configuration, so that node files from the testsuite using
these fonts just work.
2024-01-10 21:10:36 -05:00
Benjamin Otte
ee14b96c28 node-editor: Don't #include <gsk/gl/gskglrenderer.h> 2024-01-07 14:47:22 +01:00
Benjamin Otte
f57e211ba9 node-editor: Use gsk_renderer_realize_for_display()
... in all the places where we used realize (NULL) before.
2024-01-07 14:47:22 +01:00
Benjamin Otte
5f03053569 gsk: include Vulkan renderer in public header
The Vulkan renderer can just be public API, because it doesn't expose
any Vulkan-specific APIs.
And it can just exist when compiled without Vulkan, because it can fail
to realize.

Also move get rid of the gsk/vulkan/gskvulkanrenderer.h header. It was
experimental and isn't necessary now that the renderer is included via
gsk.h.
2024-01-07 14:47:22 +01:00
Benjamin Otte
10f934f782 node-editor: Add the new renderer(s) 2024-01-07 07:22:49 +01:00
Benjamin Otte
1e54e838e0 vulkan: Remove GskVulkanRenderer
We want to introduce a new one next.

Technically, this breaks API, because gsk_vulkan_renderer_new() is going
away, but practically, we're gonna bring it back once we introduce that
renderer in a few commits.
2024-01-07 07:22:49 +01:00
Matthias Clasen
d21a691f44 node-editor: Convert headers to #pragma once
That is our current coding style.
2023-12-20 09:51:19 -05:00
Matthias Clasen
0bf1ae033d Document node format for stroke and fill nodes 2023-08-26 07:39:23 -04:00
Benjamin Otte
bac41ce644 node-editor: Print default renderer in title
If there is a value passed to GSK_RENDERER, display it in the window
title.

This is mostly so that when I show off screenshots, people know what
renderer I'm using.
2023-05-16 18:53:53 +02:00
Matthias Clasen
f2a297f56d Stop using gtk_css_provider_load_from_data 2023-05-13 19:59:17 -04:00
Matthias Clasen
823f56d263 Cleanup 2023-05-07 09:32:09 -04:00
Matthias Clasen
87332920d5 node-editor: Add some editor smarts
Allow control-clicks on some fields to bring up
a more specific UI. This functionality is also
available via Ctrl-E and the context menu.

At this point, it can edit colors, fonts and
files in some places, as well as a few enums.
2023-05-07 09:19:44 -04:00
Matthias Clasen
d2a358206c Fix a typo in the node format definition 2023-05-07 09:19:44 -04:00
Matthias Clasen
1fba59f1d1 node-editor: Be a bit better about saving
When we have a file, suggest it for saving.
This has the side benefit of giving us a test case
for gtk_file_dialog_set_initial_file.
2023-05-05 14:18:40 -04:00
Matthias Clasen
c237643b24 node-editor: Plug a memory leak 2023-04-27 13:42:03 +02:00
Matthias Clasen
3eee1c0724 node-editor: Typo fixes
Fix some typos in the node format documentation.
2023-04-10 16:04:17 +02:00
Matthias Clasen
6182f4a332 node-editor: Improve the scaling
We only want to scale the main rendering, not whats
shown in the sidebar. Also, make the scale logarithmic.
2023-04-03 22:33:34 -04:00
Benjamin Otte
47ba29bc14 docs: Document additions to the node format 2023-03-29 03:53:52 +02:00
Matthias Clasen
0a3eceb15d node-editor: Embed textures in testcases
It is useless to have node files with references
to external files in the testsuite, so turn such
textures into data urls by doing a serialization
roundtrip.
2023-03-19 10:04:46 -04:00
Benjamin Otte
7c96003471 node-editor: Add more export options
Auto-detect tiff and svg and if those are chosen, save to that format.
2023-03-11 00:08:44 +01:00
William Roy
aaeec84d75 Fix compile_resources present source directory
In certain scenarios, address the issue where gnome.compile_resources 
fails to transmit the present source directory. This is most notably 
visible with MSBuild.
2023-03-07 21:59:50 +00:00
Matthias Clasen
0d97d03fc1 Document mask node parser format 2023-02-14 19:07:01 -05:00
Matthias Clasen
dc3a72cf38 nodeparser: Support texture-scale nodes 2023-02-11 15:09:38 -05:00
Benjamin Otte
e2f730c0bf filedialog: Add gtk_file_dialog_set_initial_file()
A shortcut for setting initial-folder and initial-name at the same time.

We can remove all arguments from the actual async calls this way.
2022-12-24 07:56:57 -05:00
Benjamin Otte
8a2d35b9fb filedialog: Add gtk_file_dialog_set_initial_name() 2022-12-24 07:56:57 -05:00
Benjamin Otte
26cec4a021 filedialog: Rename current-folder to initial-folder
It's not the current one - unlike in GtkFileChooser - because there are
no live updates. So we use a more descriptive name.
2022-12-24 07:56:57 -05:00
Matthias Clasen
3007b0fd7f Remove leftover debug spew 2022-12-09 10:04:42 -05:00
Matthias Clasen
96b9ac84f8 node-editor: Redo saving location
Determine the location to save testcases in dynamically,
trying first a GTK_SOURCE_DIR environment variable
and then the current directory as the GTK source dir,
ultimatively falling back to just saving in the current
directory.

This avoids leaking details of the build environment
into the produced artifacts and should make GTK builds
more reproducible.

Fixes: #5403
2022-12-09 09:35:32 -05:00
Matthias Clasen
e7de4c1f99 node-editor: Port to async dialog API 2022-10-29 13:31:41 -04:00
Matthias Clasen
63c61340ac Merge branch 'test-coverage' into 'main'
node-editor: Make the help more helpful

See merge request GNOME/gtk!4874
2022-07-15 22:34:02 +00:00
Marco Melorio
d8a73cbd03 picture: Add content-fit property
It allows to specify the resize mode of the paintable inside the
GtkPicture allocation. This also deprecates the keep-aspect-ratio
property.

Fixes #5027.
2022-07-15 23:01:23 +02:00