Commit Graph

125 Commits

Author SHA1 Message Date
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
Matthias Clasen
35e6a2fdb8 node-editor: Sort help better
Move the gshader section where it belongs.
2022-07-15 15:46:06 -04:00
Matthias Clasen
69336fa5f1 node-editor: Make the help more helpful
I struggled to remember how newlines vs strings work in
this format, so put it in the docs.
2022-07-15 15:46:06 -04:00
Emmanuele Bassi
f4f683a469 Rename clear_template to dispose_template
Make it more clear that the function is supposed to be called during the
dispose sequence of a widget.
2022-07-11 18:24:37 +01:00
Emmanuele Bassi
bf75a21deb Port node editor to gtk_widget_clear_template() 2022-07-11 18:24:37 +01:00
Matthias Clasen
27db4b5c2f node-editor: Add a zoom button
This is a bit more convenient than manually
adding a transform node in the text editor.
2022-06-07 13:39:22 -04:00
Matthias Clasen
726a92200f Install gtk4-node-editor
It is an application worth having around.
2022-05-07 07:18:36 -04:00
Matthias Clasen
78d34c098e node-editor: Add things
Add a desktop file and appdata.
2022-05-07 07:18:36 -04:00
Emmanuele Bassi
6f2ff620bd build: Replace deprecated 'gui_app'
Use `win_subsystem: 'windows'` instead.
2021-12-24 15:51:11 +00:00
Benjamin Otte
8d1956921d node-editor: Display errors
When opening a file or pasting DND fails, display the error as the
actual node.
2021-11-30 14:12:10 +01:00
Matthias Clasen
6690197673 node-editor: Don't make paned shrinkable
When the handle is dragged all the way to the left,
it is impossible to get it back. Which is not fun.
2021-11-18 17:25:29 -05:00
Matthias Clasen
96778fca92 Fix formatting error in demo about dialogs
Try harder to format things nicely.
2021-11-16 16:45:56 -05:00
Benjamin Otte
869d2f281a node-editor: Create renderers surfaceless 2021-10-20 21:49:32 +02:00
Matthias Clasen
144f727d5a Rename ngl to gl
We have only one gl renderer now, and it is
a bit odd for it not be called gl.
2021-10-07 13:05:53 -04:00
Matthias Clasen
27d662f1aa node editor: Preserve aspect ratio
We don't want to distort our rendering.
Tell the paintable to keep the aspect
ratio.
2021-09-17 10:28:49 -04:00
Benjamin Otte
2863095f06 node-editor: Allow dragging and dropping the center picture
Dragging will just drag the render node.

Dropping will replace the current contents of the textview with the
dropped node.

Neat side effect: You can drag the node onto itself to do a
deserialize/serialize of the current text.
2021-08-30 06:02:16 +02:00
Matthias Clasen
e9e373913e gsk: Drop the gl renderer
ngl supports all the same platforms as gl
now, and has seen more improvements in the
last cycle.
2021-08-20 22:58:30 -04:00
Matthias Clasen
ae41697d83 node-editor: Make header buttons not steal focus
This is rarely useful, and is confusing when it
happens as side-effect of dragging the window.
2021-04-11 15:32:15 -04:00
Matthias Clasen
678e6fc6d6 nodeeditor: Make the help window wide enough
Make the help window wide enough to show the
tables without wrapping.
2021-04-11 12:50:34 -04:00
Matthias Clasen
1e1f199b56 node-editor: Support pasting the image
Add a button that copies the image to the clipboard.
2021-04-02 21:24:59 -04:00
Matthias Clasen
062383bfd3 node-format: Small docs fixes 2021-03-08 17:49:21 -05:00
Christian Hergert
2a38cecd33 gsk: add OpenGL based GskNglRenderer
The primary goal here was to cleanup the current GL renderer to make
maintenance easier going forward. Furthermore, it tracks state to allow
us to implement more advanced renderer features going forward.

Reordering

This renderer will reorder batches by render target to reduce the number
of times render targets are changed.

In the future, we could also reorder by program within the render target
if we can determine that vertices do not overlap.

Uniform Snapshots

To allow for reordering of batches all uniforms need to be tracked for
the programs. This allows us to create the full uniform state when the
batch has been moved into a new position.

Some care was taken as it can be performance sensitive.

Attachment Snapshots

Similar to uniform snapshots, we need to know all of the texture
attachments so that we can rebind them when necessary.

Render Jobs

To help isolate the process of creating GL commands from the renderer
abstraction a render job abstraction was added. This could be extended
in the future if we decided to do tiling.

Command Queue

Render jobs create batches using the command queue. The command queue
will snapshot uniform and attachment state so that it can reorder
batches right before executing them.

Currently, the only reordering done is to ensure that we only visit
each render target once. We could extend this by tracking vertices,
attachments, and others.

This code currently uses an inline array helper to reduce overhead
from GArray which was showing up on profiles. It could be changed to
use GdkArray without too much work, but had roughly double the
instructions. Cycle counts have not yet been determined.

GLSL Programs

This was simplified to use XMACROS so that we can just extend one file
(gskglprograms.defs) instead of multiple places. The programs are added
as fields in the driver for easy access.

Driver

The driver manages textures, render targets, access to atlases,
programs, and more. There is one driver per display, by using the
shared GL context.

Some work could be done here to batch uploads so that we make fewer
calls to upload when sending icon theme data to the GPU. We'd need
to keep a copy of the atlas data for such purposes.
2021-02-23 14:41:52 -08:00
Matthias Clasen
3aa3c21d69 demos: Add devel styling
Add a -Dprofile=devel meson option, and add some visual
hints to the demos that you are running a nightly build.
2021-02-12 00:08:55 -05:00
Matthias Clasen
3c91a2b0a8 node-editor: Use the non-devel icon
We're now a respectable, stable node editor.
2021-02-10 07:44:59 -05:00
Matthias Clasen
1484b4ae9f node editor: Add a dark mode toggle
This is useful to see light rendering clearly.
2021-01-30 19:57:24 -05:00
Timm Bäder
aba14e6a43 node editor: Show some default node data
Show case the icon and the render node format this way.
2021-01-29 09:45:25 +01:00
Timm Bäder
00956a3770 node editor: Make help textview monospace
Otherwise the nice markdown tables don't line up.
2021-01-29 08:07:39 +01:00
Emmanuele Bassi
6039a36183 Merge branch 'ebassi/for-master' into 'master'
Clean up the build system

See merge request GNOME/gtk!2955
2020-12-15 16:54:59 +00:00
Matthias Clasen
7335e166b7 Update the node format docs
Update this document to mention all the render nodes we
have, and the default values for their properties.
2020-12-15 10:30:18 -05:00
Emmanuele Bassi
99e0929d6c build: Use a consistent style for Meson files 2020-12-15 12:46:59 +00:00
Matthias Clasen
b75b359f19 Drop devel styling from our windows
We are about to do a stable release. Time to get used
again to plain old, boring header bars.
2020-11-23 12:10:01 -05:00
Christian Hergert
3003f37e9d node-editor: fix length of text during save
The length parameter for g_file_replace_contents() is a gsize, so -1 is
unsuitable here. Just use strlen() directly.
2020-11-17 14:34:11 -08:00
Matthias Clasen
121e61cf01 gsk: Avoid using gtk css types in public api
Using GtkCssSection in public headers here may be
ok from the C perspective, since it all ends up in
the same library anyway. But it causes circular
dependency problems for our gir files that are still
split by namespace.

To avoid this problem, copy the GtkCssLocation struct
struct as GskParseLocation, and pass take two of them
instead of a GtkCssSection in the error callback.

Update all users.

Fixes: #2454
2020-11-16 23:27:44 -05:00
Matthias Clasen
5640208f31 node-editor: Don't insert hyphens
This can be a bit confusing in multi-line strings.
2020-10-03 13:11:20 -04:00
Matthias Clasen
2c5c938f0d Clean up uses of gtk_toggle_button_get/set_active
Replace all uses on check buttons by the corresponding
check button api.
2020-08-30 21:23:25 -04:00
Matthias Clasen
6e9de7f271 node-editor: Don't install the icon
We don't want to install an icon if we're not
installing the app. Also give the artist credit.

Fixes: #3051
2020-08-09 20:28:56 -04:00
Matthias Clasen
ed13e6a41e grid layout: Rename some properties
Rename GtkGridLayoutChild:left-attach/top-attach to
GtkGridLayoutChild:column/row. Update all users.

Fixes: #2967
2020-08-02 17:58:03 -04:00
Benjamin Otte
d375dce9f5 Replace "gchar" with "char" 2020-07-25 00:47:36 +02:00
Benjamin Otte
d7266b25ba Replace "gint" with "int" 2020-07-25 00:47:36 +02:00
Matthias Clasen
53831e67a7 Integrate the new icons
Install and use the node-editor and print-editor icons.
2020-07-13 07:30:46 -04:00
Jakub Steiner
e742fc1206 demos: icons for Print and Node Editors
- probably needs meson build hooks
2020-07-13 07:30:46 -04:00
Alexander Mikhaylenko
7c3b30036e headerbar: Show title buttons by default
Most of the time show-title-buttons is set to TRUE. Go ahead and make that
the default.
2020-07-02 23:51:16 +05:00
Matthias Clasen
d4ff275002 node-editor: Add a help window
Add a Help item to the gear menu that opens the
node-format.md file in a new window. This could
be improved if we could parse markdown and apply
tags, similar to how we can load pango markup.
2020-06-29 07:36:55 -04:00
Matthias Clasen
2b6f243578 node-editor: Cosmetics
Use a title style class for the labels.
2020-06-29 07:36:55 -04:00
Matthias Clasen
8770584bfb node-editor: Add a gear menu
Add a gear menu with Inspector and About menu items.
2020-06-29 07:36:55 -04:00
Matthias Clasen
4f7f15700c node-editor: Document the node format
Add a markdown file with the documentation of the
node format.

Fixes: #1887
2020-06-29 07:36:55 -04:00
Timm Bäder
949eb8d17a node-editor: Monitor file and reload on changes 2020-05-13 08:07:55 +02:00
Matthias Clasen
2a24b8c653 Replace most remaining uses of container api
These are all on GtkBox or enumerating children.
2020-05-11 22:38:21 -04:00
Matthias Clasen
bc6643f3c2 paned: Redo the api
This commit is porting GtkPaned to be derived
from GtkWidget instead of GtkContainer, while adding
start-child and end-child properties. The existing
properties are renamed to follow the start/end naming
scheme, and we add proper getters and setters.

Update all users.

See #2719
2020-05-11 22:21:33 -04:00
Matthias Clasen
cd0081d08a Use gtk_window_destroy
Replace calls to gtk_widget_destroy on windows
with gtk_window_destroy.
2020-05-11 12:20:57 -04:00
Matthias Clasen
e09287a109 nodeeditor: Don't use container api on list box rows
GtkListBoxRow is not a container anymore.
2020-05-06 17:03:12 -04:00
Alexander Mikhaylenko
c2e4e1af73 headerbar: Remove user-settable title
Use window title, or custom title widget if it's set. Remove 'title'
property.

Update demos and tests to set the title on the window instead of
headerbar.
2020-05-01 19:48:05 +05:00
Matthias Clasen
79e1c66657 gsk: Don't autoinclude backend-specific headers
Don't install headers for code that we don't build.
And don't include those headers in gsk.h.

Just as we do in gdk, require applications to include
the backend-specific headers they need explicitly.

Update the one affected demo, gtk4-node-editor.
2020-04-24 21:40:30 -04:00
Matthias Clasen
5a362c6759 nodeeditor: Don't set has-focus
That is now a readonly property. Set focus-widget
on the toplevel instead.
2020-04-17 16:17:01 -04:00
Timm Bäder
6f6ed1e4af demos/node-editor: Add common_cflags to build
And fix the generated warnings
2020-03-06 18:54:37 +01:00
Matthias Clasen
a9c05193a7 Drop the expand property
The hexpand and vexpand properties are sufficient.
2020-02-25 18:29:15 -05:00
Emmanuele Bassi
063ad28b1a Remove overwrite confirmation machinery from GtkFileChooser
Overwrite confirmation should not be optional, and it should not loop
into application code to create their own dialog and user response.
2020-02-22 15:22:06 +00:00
Emmanuele Bassi
5f070ff233 Remove filename/URI API from GtkFileChooser
GtkFileChooser's API predates GIO by a few years, so it started off with
filenames and URI as character arrays. After introducing GIO as a
dependency, the API included GFile-based entry points.

It's much more appropriate to use GFile everywhere, as we want to
encourage people to use GIO instead of passing random bytes to low level
POSIX API.

See: #2455
2020-02-22 15:22:06 +00:00
nana-4
3eec90cdc0 node editor: Avoid inheriting textview styles
...to its descendant selectors

Without ">", "text" style is propagated to entry in the emoji chooser.

https://gitlab.gnome.org/GNOME/gtk/issues/2061
2019-09-03 01:44:55 +09:00
Timm Bäder
0f3ca349e7 node editor: Manually unrealize all created renderers
This has not been a problem before since we were leaking them.
2019-07-13 09:37:47 +02:00
Timm Bäder
3874f37395 node editor: Add a quick way to save a testcase 2019-05-29 20:30:21 +02:00
Matthias Clasen
7447abb52b Stop using gtk_widget_get_toplevel
All uses of it can be replaced by gtk_widget_get_root.
2019-05-28 20:25:16 +00:00
Matthias Clasen
302d2a04ae Stop using gtk_widget_get_surface
Replace all uses of gtk_widget_get_surface by
gtk_native_get_surface.
2019-05-28 20:25:16 +00:00
Matthias Clasen
c1d5e82d95 Use GtkNative APIs instead of GtkRoot 2019-05-28 20:24:39 +00:00
Benjamin Otte
4bccd17941 node-editor: Report all errors in tooltip
Don't just report the first one.
2019-05-12 17:27:01 +02:00
Benjamin Otte
0049b39375 node-editor: Don't remove all text tags when saving 2019-05-12 17:27:01 +02:00
Benjamin Otte
9117ee83eb node-editor: Never scale nodes up
Scaling down is fine so one can see the nodes, but scaling up just
makes the nodes wrong for no reason at all.
2019-05-08 19:47:40 +02:00
Timm Bäder
b3c4320bc2 node editor: Do some simple syntax highlighting 2019-05-07 17:21:16 +02:00
Timm Bäder
759a97403c Some node editor improvements 2019-05-06 17:34:48 +02:00
Benjamin Otte
00b947124f node-editor: Add renderings with alternative renderers
That's pretty rough around the edges, but it mostly works.
Apart from sizing, screw listbox sizing.
2019-05-05 07:18:39 +02:00
Benjamin Otte
008b7bc94f Add gtk4-node-editor
It's meant to be a little editor for render nodes so we can do testing
with it.
2019-05-05 07:18:39 +02:00