Commit Graph

119 Commits

Author SHA1 Message Date
Matthias Clasen
32d00ca9ed path-tool: Add a restrict command
This lets you subset a path between two given lengths.
2023-08-25 22:26:54 -04:00
Matthias Clasen
25e6231a88 path: Switch back to conics
Arcs were appealing, but they have a fatal flaw: we can't
split our arcs without changing the ellipse they trace.
That could be fixed by adding an extra parameter, but then
it is no longer any better than conics.

So switch back to conics, which have the advantage that they
are used elsewhere.
2023-08-25 07:33:16 -04:00
Matthias Clasen
d33ed4f9ab path: Add elliptical arcs
Add a new curve type for elliptical arcs
and use it for rounded rectangles and circles.
We use the 'E' command to represent elliptical
arcs in serialized paths.
2023-08-23 12:43:52 -04:00
Matthias Clasen
79e132ab7b path-tool: Reorganize options
Put fill and stroke options into their own group.
This helps produce understandable --help output.
2023-08-22 09:56:43 -04:00
Matthias Clasen
03a511aab4 path-tool: Make info show statistics
It is somewhat interesting to know how many
contours, lines, etc. a path consists of.
2023-08-15 13:33:23 -04:00
Matthias Clasen
62176a3bd0 tools: Add gtk4-path-tool
This comes in handy for testing, among other things.

For now, this supports decomposing, reversing, rendering,
info and preview.
2023-08-12 16:34:19 -04:00
Benjamin Otte
3aa3816125 gsk: Add GskStrokeNode
Take a rendernode as source and a GskPath and GskStroke,
and fill the area that is covered when stroking the path
with the given stroke parameters, like cairo_stroke() would.
2023-08-07 13:02:57 -04:00
Benjamin Otte
fc4a464b47 gsk: Add GskFillNode
Take a rendernode as source and a GskPath and fill
the region inside the path with the source, just like
cairo_fill() would.
2023-08-06 21:01:11 -04:00
Benjamin Otte
3f16f7e0d4 rendernode-tool: Add another magic format
Make .svg use the Cairo renderer to save to an SVG file.

It's useful when comparing rendering behavior and times with
web browsers (as long as one is aware that browsers build a full
DOM tree out of those SVGs).
2023-07-31 16:51:03 +02:00
Benjamin Otte
166777dd55 rendernode-tool: Move code
No functional changes yet.
2023-07-31 16:51:03 +02:00
Benjamin Otte
1f848bf9fd rendernode-tool: Save to tiff
If the save filename ends in .tiff, save to tiff instead.

For now this is a sneaky autodetect feature, not sure if/how to make it
more explicit.
2023-07-28 09:06:14 +03:00
Benjamin Otte
1e75fc35c8 tools: No need for --force when specifying filename
If people specify the filename, they should know what they're doing.

If they don't, abort if the guessed filename already exists and insist
on the user explicitly giving it.
2023-07-22 23:30:15 +02:00
Daniel Boles
8da96b9353 tools: Replace references to GTK+ with GTK no plus 2023-07-21 12:05:25 +01:00
Matthias Clasen
601011ccc0 Add a gtk4-rendernode-tool
This is meant to work with serialized render nodes.
2023-07-21 06:26:11 -04:00
Matthias Clasen
411e0c5fbd tools: Use #pragma once
We are trying to be consistent about this.
2023-07-20 15:18:13 -04:00
Matthias Clasen
e523d3a50e tools: Drop unnecessary conditionals
We require GLib 2.76 now.
2023-07-20 15:18:13 -04:00
Matthias Clasen
ab809d1dc3 buildertool: Exit orderly
The validate command does need a display connection,
for better or worse. So exit in an orderly fashion
if we don't have one, instead of crashing.

Fixes: #5948
2023-07-12 15:49:11 -04:00
Chun-wei Fan
6d1537647c tools/generate-uac-manifest.py: Fix formatting
As this script is now also used in GLib, unify the formatting between
GLib and GTK. Make the formatting of the script conformant to the
Black[1] tool, as GLib requires, and add a copyright header to this
script.

[1]: https://black.readthedocs.io/en/stable/, see also
$(glibsrcroot)/.gitlab-ci/run-bash.sh
2023-07-03 12:50:55 +08:00
Matthias Clasen
723fb6c8be gtk4-builder-tool: Fix naming
We install the tool as gtk4-builder-tool, so that
is what it should call itself.

String change.
2023-06-27 07:09:04 -04:00
Matthias Clasen
33fc4d6495 buildertool: Make render an alias for screenshot
Its a more neutral name and will align better with
other tools.
2023-06-26 10:58:35 -04:00
Matthias Clasen
c2ba1d69a1 Rename pixbuf utils to texture utils
That is what this is now.
2023-05-16 22:00:08 -04:00
Matthias Clasen
847739aed7 Reduce pixbuf helpers
Concentrate pixbuf handling in gdkpixbufutils.c.
2023-05-16 21:56:22 -04:00
Matthias Clasen
9463e0f56c Only build iconcache validator if it is used 2023-05-15 23:06:07 -04:00
Matthias Clasen
2f8c0b7aec tools: Cosmetics
Make gtk-builder-tool screenshot be quiet unless
it had to make up a filename. And tweak --help
output a bit.
2023-05-15 08:03:20 -04:00
Matthias Clasen
63b50f48a9 Merge branch 'harmonize-would_drop' into 'main'
Harmonize would_drop() replacement for g_log_writer_default_would_drop()

See merge request GNOME/gtk!4935
2023-04-28 22:55:42 +00:00
Matthias Clasen
2dc17aeca9 gtk4-builder-tool: Localization fixes
Be consistent about marking strings for
translation. And make locatization actually
work by including gi18n-lib.h instead of gi18n.h.
2023-03-17 22:04:25 -04:00
Matthias Clasen
3de10847b9 gtk4-builder-tool: Prefer child properties
Rewrite <child> elements to use child properties
where that is easily possible.

Fixes: #5609
2023-02-19 21:48:56 -05:00
Matthias Clasen
a9f03be588 builder-tool: Try harder to find template parents
This will make it work (in some cases) to add extra
libraries via LD_PRELOAD.

Based on work by Julian Sparber,
https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/5084

Fixes: #5232
2023-02-19 18:17:34 -05:00
Benjamin Otte
ac81e71f78 gtk-launch: Fix unused variable warning on macOS 2023-01-06 19:46:58 -05:00
Benjamin Otte
63fa5b7f52 gtk-launch: Remove compile-time warning
This warning causes a -Werror build to fail.
2023-01-06 19:46:58 -05:00
Matthias Clasen
1ee39d7555 tools: Stop using gtk_widget_show/hide 2022-11-28 14:34:55 -05:00
Matthias Clasen
ebe6d52252 Drop redundant glib version checks
We require GLib 2.72 now.
2022-11-17 22:49:56 -05:00
Matthias Clasen
dd60a9abd6 buildertool: Support enumerating callbacks
The new scope approach makes this easy, and
it can be useful to know what functions are
needed.
2022-10-19 13:36:14 -04:00
Matthias Clasen
50835ffbf6 buildertool: Improve validate implementation
Reimplement deprecation checking via a scope.
This lets us ignore missing callbacks, and helps
for validating templates.
2022-10-19 13:36:14 -04:00
Matthias Clasen
637713fe72 buildertool: Add a builder scope implementation
This will be used in future commits.
2022-10-19 13:36:14 -04:00
Matthias Clasen
7e71c868ab buildertool: Use --deprecations for templates
Use this option for templates too.

We still can't parse most templates, since they are
missing their callbacks.
2022-10-19 13:36:14 -04:00
Matthias Clasen
bcabe77799 buildertool: Warn about deprecations
Add a new option --deprecations to the validate
command that will warn about use of deprecated types.

The list of current deprecations is unfortunately
hardcoded in the source, so this list will have to
be kept up-to-date.

Fixes: #5256
2022-10-19 02:51:29 -04:00
Matthias Clasen
64cf31f348 buildertool: Fix template handling
We were not properly parsing the error message
here, leading to badness.
2022-10-19 02:51:29 -04:00
Matthias Clasen
4941ef659f tools: Ignore deprecations
For now, just ignore deprecations. Eventually,
we will have to go through and drop code that is
dealing with widgets that are going away.
2022-10-11 17:18:21 -04:00
Hannes Müller
f23c124af2 Harmonize would_drop() replacement for g_log_writer_default_would_drop()
Reuse a better to read would_drop() from ./testsuite/reftests/gtk-reftest.c
in ./tools/gtk-builder-tool.c

Fixed wrong indentation in ./testsuite/reftests/gtk-reftest.c
2022-08-08 20:12:50 +02:00
Matthias Clasen
c0acf264a9 builder-tool: Screenshot popovers properly
Do the necessary shenanigans to get popovers to show
up in screenshots.
2022-05-06 14:43:45 -04:00
Matthias Clasen
e3abd7df5c builder-tool: Include shadows in screenshots
Remove the clipping to the widget area that
GtkWidgetPaintable imposes, so we can see shadows
and other out-of-bounds rendering. This is particularly
useful for toplevel windows with client-side decorations.
2022-05-05 18:29:05 -04:00
Matthias Clasen
e89365e9e3 gtk-builder-tool: Error out if screenshooting fails
If we don't produce a texture for whatever reason,
apologize and fail.
2022-04-18 11:16:05 -04:00
Matthias Clasen
499687a11d gtk-builder-tool: Add a screenshot command
This is an obvious variation of the preview
command. It can save a .ui file as either
.png or .node.
2022-04-17 12:57:46 -04:00
Matthias Clasen
c5e26dd591 gtk-builder-tool: Reshuffle --help
Use GOptionContext better.
2022-04-17 12:57:46 -04:00
Matthias Clasen
b88ac0890e gtk-builder-tool: Small reshuffle
Move the display check into the preview command.
2022-04-17 11:23:00 -04:00
Xavier Claessens
bcd0704511 Remove #ifdef ENABLE_NLS
libintl API is guaranteed to always be available, glib will fallback to
proxy-libintl in case gettext is not found.
2022-03-31 11:41:34 -04:00
Matthias Clasen
525f96f2f8 gtk-builder-tool: Operate without display
The simplify and validate commands can function
without a display connection, only preview absolutely
needs one. Allow this, by using gtk_init_check().
2022-03-14 15:40:12 -04:00
Günther Wagner
86a3400f2e tools: updated gtk4builder.rng to current state 2022-02-08 21:42:41 +01:00
Rafael Fontenelle
bed709a322 buildertool: use curly apostrophe 2022-01-24 17:04:17 +00:00
Emmanuele Bassi
9e83eb6501 i18n: Detect more translatable attribute values
GtkBuilder uses GMarkup, which defines a boolean attribute value as:

- yes/no
- true/false
- 1/0

The ITS file for GtkBuilder UI definitions is only using the first pair,
likely because Glade only ever used those values. GTK's own tools, though,
will typically simplify the full yes/no and true/false strings to 1 and 0,
to minimise the parsing time.

Fixes: #4596
2022-01-16 14:03:05 +00:00
Matthias Clasen
66d8631c23 buildertool: Be more robust
Don't pass a NULL string to gtk_builder_value_from_string.
2021-12-13 15:09:48 -05:00
Matthias Clasen
5c1ad88137 builderparser: Be more robust
If a document contains no useful content,
just say so instead of crashing.
2021-12-13 15:09:48 -05:00
Matthias Clasen
6d24a2c942 buildertool: Be more robust
A lot of crashes in simplify can be avoided
if get_class_name does not return NULL.
2021-12-13 14:33:19 -05:00
Matthias Clasen
5222dc0cd1 buildertool: Fix a possible crash
We need to call g_markup_parse_context_end_parse
to catch incomplete documents that we might not
handle well later.
2021-12-13 13:52:50 -05:00
Benjamin Otte
27965d5fdc builder-tool: Don't simplify enums too much
Store the enum nick, not the enum value. That way the file remains
human-readable.

Updated reftests to new expected output.
2021-11-21 02:19:57 +01:00
Chun-wei Fan
53705a537c tools/generate-uac-manifest.py: Fix UAC manifest .rc
The resource compiler in the Windows 11 SDK does not allow one to include
winuser.h directly in resource scripts (.rc) with a rather cryptic error
message, so fix generating the .rc file to embed the UAC manifest by including
windows.h with WIN32_LEAN_AND_MEAN instead.
2021-10-13 12:21:10 +08:00
Matthias Clasen
fd0a5e3c23 buildertool: Fix a simplify issue
<lookup> elements can contain a type name, we can't just
ignore the pcdata content. This was breaking some of our
ui files when simplifying them.
2021-09-29 10:58:23 -04:00
Matthias Clasen
6f002678be gtk-builder-tool: Simplify more
Simplify enum properties as well.

Update affected tests.
2021-09-29 10:58:21 -04:00
Matthias Clasen
5bc3923bae builder-tool: Avoid <style> when converting
We can just set the css-classes property instead.

Update affected tests.
2021-09-28 17:48:50 -04:00
Rafał Dzięgiel
c66bd791c4
Fix wrong gettext ITS target
The installed ITS rule filename is "gtk4builder.its". The .loc file
is wrongly pointing to old "gtkbuilder.its" which makes gettext fail
on systems without GTK3 installed.
2021-08-25 10:08:50 +02:00
Matthias Clasen
98d2320c93 gtk-builder-tool: Replace can-focus with focusable
The focusable property has the meaning that can-focus had
in GTK 3.

Update tests, and mention this in the migration guide.

Fixes: #3638
2021-06-05 17:56:35 -04:00
Matthias Clasen
fa10264759 updateiconcache: Static analysis fixes 2021-05-03 07:44:38 -04:00
Matthias Clasen
5fbfe5203c buildertool: Static analysis fixes 2021-05-03 07:44:38 -04:00
Matthias Clasen
6a66ccd3e6 gtk-builder-tool: Avoid a crash with <placeholder/>
Not sure we can do much with a ui file that has
<placeholder/> elements littered throughout. But
at least we can avoid crashing while trying to
convert it.

Fixes: #3781
2021-03-23 15:25:53 -04:00
Xavier Claessens
629e70f89d Meson: Use gnome.post_install()
See https://github.com/mesonbuild/meson/pull/8272 and
https://github.com/mesonbuild/meson/issues/8268.
2021-03-08 21:19:09 -05:00
Chun-wei Fan
f0967fa5e4 gtk4-update-icon-cache: Avoid UAC on 32-bit Windows
As the program executable name has 'update' in its filename,
gtk4-update-icon-cache.exe is considered to be an installer program on 32-bit
Windows [1], which will cause the program to fail to run unless it is running
with elevated privileges (i.e. UAC).

Avoid this situation by embedding a manifest file into the final executable
that tells Windows that this is not a program that requires elevation.

Fixes issue #3632.

[1]: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-vista/cc709628(v=ws.10)?redirectedfrom=MSDN,
     under section "Installer Detection  Technology"
2021-02-03 02:16:58 +00:00
Xavier Claessens
1048ad1a01 tools: Don't static and dynamic link on libgtk4 2021-01-31 11:09:20 -05:00
Matthias Clasen
ac0f524722 build: Redo the tools build
Move the tools directory to be toplevel, and instead of
recompiling sources twice, link them with the our new
static libgtk.a.
2021-01-28 12:27:07 -05:00