[gtk/redo-doc-images] wip: Redo doc image generation




commit 1b2d4b29299a07e6f47aac341e9a86d831840008
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Apr 17 19:26:11 2022 -0400

    wip: Redo doc image generation
    
    Use the new screenshot command of gtk4-builder-tool.

 docs/tools/aboutdialog.ui     | 17 ++++++++++++++++
 docs/tools/button.ui          | 30 +++++++++++++++++++++++++++++
 docs/tools/generate-images.sh | 15 +++++++++++++++
 docs/tools/meson.build        | 18 +----------------
 docs/tools/style.css          |  8 ++++++++
 docs/tools/switch.ui          | 41 +++++++++++++++++++++++++++++++++++++++
 docs/tools/toggle-button.ui   | 45 +++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 157 insertions(+), 17 deletions(-)
---
diff --git a/docs/tools/aboutdialog.ui b/docs/tools/aboutdialog.ui
new file mode 100644
index 0000000000..00815af070
--- /dev/null
+++ b/docs/tools/aboutdialog.ui
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkAboutDialog">
+    <property name="program-name">GTK Code Demos</property>
+    <property name="version">4.8.0</property>
+    <property name="copyright">© 1997-2022 The GTK Team</property>
+    <property name="website">http://www.gtk.org</property>
+    <property name="comments">Program to demonstrate GTK functions.</property>
+    <property name="logo">gtk-logo.png</property>
+    <property name="title">About GTK Code Demos</property>
+    <property name="authors">Peter Mattis
+Spencer Kimball
+Josh MacDonald
+and many more…
+</property>
+  </object>
+</interface>
diff --git a/docs/tools/button.ui b/docs/tools/button.ui
new file mode 100644
index 0000000000..9ed81e1860
--- /dev/null
+++ b/docs/tools/button.ui
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <property name="decorated">0</property>
+    <property name="resizable">0</property>
+    <property name="default-width">280</property>
+    <property name="default-height">120</property>
+    <style>
+       <class name="nobackground"/>
+    </style>
+    <child>
+      <object class="GtkBox">
+        <style>
+          <class name="shadow"/>
+          <class name="background"/>
+          <class name="frame"/>
+        </style>
+        <child>
+          <object class="GtkButton">
+            <property name="hexpand">1</property>
+            <property name="vexpand">1</property>
+            <property name="halign">center</property>
+            <property name="valign">center</property>
+            <property name="label">Button</property>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/docs/tools/generate-images.sh b/docs/tools/generate-images.sh
new file mode 100755
index 0000000000..9a0d0e6694
--- /dev/null
+++ b/docs/tools/generate-images.sh
@@ -0,0 +1,15 @@
+#! /bin/sh
+
+root=../..
+
+source_root=${MESON_SOURCE_ROOT:-$root}
+build_root=${MESON_BUILD_ROOT:-$root/build}
+
+imagedir=${source_root}/docs/reference/gtk/images
+
+cd ${source_root}/docs/tools
+
+for file in *.ui; do
+  output=${imagedir}/${file/.ui/.png}
+  ${build_root}/tools/gtk4-builder-tool screenshot --force --css style.css $file $output
+done
diff --git a/docs/tools/meson.build b/docs/tools/meson.build
index d9a9afb359..962a705775 100644
--- a/docs/tools/meson.build
+++ b/docs/tools/meson.build
@@ -1,17 +1 @@
-if get_option('gtk_doc')
-  doc_shooter_resources = gnome.compile_resources('shooter_resources',
-                                                  'shooter.gresource.xml',
-                                                  source_dir: '.')
-
-  doc_shooter_sources = [
-    'shooter.c',
-    'shadow.c',
-    'widgets.c',
-    '../../tests/gtkgears.c',
-  ]
-
-  doc_shooter = executable('doc-shooter',
-                           doc_shooter_sources, doc_shooter_resources,
-                           include_directories: [ confinc, gdkinc, gtkinc, testinc, ],
-                           dependencies: libgtk_dep)
-endif
+run_target('gallery', command: 'generate-images.sh')
diff --git a/docs/tools/style.css b/docs/tools/style.css
new file mode 100644
index 0000000000..148a682240
--- /dev/null
+++ b/docs/tools/style.css
@@ -0,0 +1,8 @@
+.nobackground {
+  background: none;
+}
+
+.shadow {
+  box-shadow: 0 3px 9px 1px rgba(0, 0, 0, 0.5);
+  margin: 20px;
+}
diff --git a/docs/tools/switch.ui b/docs/tools/switch.ui
new file mode 100644
index 0000000000..bc7136de18
--- /dev/null
+++ b/docs/tools/switch.ui
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <property name="decorated">0</property>
+    <property name="resizable">0</property>
+    <property name="default-width">280</property>
+    <property name="default-height">120</property>
+    <style>
+       <class name="nobackground"/>
+    </style>
+    <child>
+      <object class="GtkBox">
+        <style>
+          <class name="shadow"/>
+          <class name="background"/>
+          <class name="frame"/>
+        </style>
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">vertical</property>
+            <property name="spacing">3</property>
+            <property name="hexpand">1</property>
+            <property name="vexpand">1</property>
+            <property name="halign">center</property>
+            <property name="valign">center</property>
+            <child>
+              <object class="GtkSwitch">
+                <property name="active">1</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSwitch">
+                <property name="active">0</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>
diff --git a/docs/tools/toggle-button.ui b/docs/tools/toggle-button.ui
new file mode 100644
index 0000000000..ff1a323aa8
--- /dev/null
+++ b/docs/tools/toggle-button.ui
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+  <object class="GtkWindow">
+    <property name="decorated">0</property>
+    <property name="resizable">0</property>
+    <property name="default-width">280</property>
+    <property name="default-height">120</property>
+    <style>
+       <class name="nobackground"/>
+    </style>
+    <child>
+      <object class="GtkBox">
+        <style>
+          <class name="shadow"/>
+          <class name="background"/>
+          <class name="frame"/>
+        </style>
+        <child>
+          <object class="GtkBox">
+            <property name="orientation">horizontal</property>
+            <property name="hexpand">1</property>
+            <property name="vexpand">1</property>
+            <property name="halign">center</property>
+            <property name="valign">center</property>
+            <style>
+              <class name="linked"/>
+            </style>
+            <child>
+              <object class="GtkToggleButton">
+                <property name="active">1</property>
+                <property name="label">Toggle</property>
+              </object>
+            </child>
+            <child>
+              <object class="GtkToggleButton">
+                <property name="active">0</property>
+                <property name="label">Button</property>
+              </object>
+            </child>
+          </object>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]