mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-08 17:50:10 +00:00
Remove the old doc shooter infrastructure
This is no longer used.
This commit is contained in:
parent
3307b8ce88
commit
8ee6203e2c
@ -1,13 +0,0 @@
|
||||
The doc shooter is used to take screenshots of widgets for the GTK
|
||||
reference manuals. We use these images for both the headers of the
|
||||
images, and for the visual index of GNOME images. They aren't part of
|
||||
the docs build. Instead, the images are taken, and then copied by hand
|
||||
into gtk/docs/reference/gtk/images/
|
||||
|
||||
Ideally, the images should be taken once a release, and all images
|
||||
should be updated at the same time. A simple theme should be used to
|
||||
take the screenshots, and in the future, we may include a gtkrc file in
|
||||
this directory for the shooter to use. Currently, all shots are
|
||||
constrained to the same width. Care should be taken when adding new
|
||||
widgets to keep this constraint.
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
Before Width: | Height: | Size: 4.6 KiB |
@ -1,17 +0,0 @@
|
||||
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
|
@ -1,152 +0,0 @@
|
||||
#include "shadow.h"
|
||||
#include <math.h>
|
||||
|
||||
#define BLUR_RADIUS 5
|
||||
#define SHADOW_OFFSET (BLUR_RADIUS * 4 / 5)
|
||||
#define SHADOW_OPACITY 0.75
|
||||
|
||||
typedef struct {
|
||||
int size;
|
||||
double *data;
|
||||
} ConvFilter;
|
||||
|
||||
static double
|
||||
gaussian (double x, double y, double r)
|
||||
{
|
||||
return ((1 / (2 * M_PI * r)) *
|
||||
exp ((- (x * x + y * y)) / (2 * r * r)));
|
||||
}
|
||||
|
||||
static ConvFilter *
|
||||
create_blur_filter (int radius)
|
||||
{
|
||||
ConvFilter *filter;
|
||||
int x, y;
|
||||
double sum;
|
||||
|
||||
filter = g_new0 (ConvFilter, 1);
|
||||
filter->size = radius * 2 + 1;
|
||||
filter->data = g_new (double, filter->size * filter->size);
|
||||
|
||||
sum = 0.0;
|
||||
|
||||
for (y = 0 ; y < filter->size; y++)
|
||||
{
|
||||
for (x = 0 ; x < filter->size; x++)
|
||||
{
|
||||
sum += filter->data[y * filter->size + x] = gaussian (x - (filter->size >> 1),
|
||||
y - (filter->size >> 1),
|
||||
radius);
|
||||
}
|
||||
}
|
||||
|
||||
for (y = 0; y < filter->size; y++)
|
||||
{
|
||||
for (x = 0; x < filter->size; x++)
|
||||
{
|
||||
filter->data[y * filter->size + x] /= sum;
|
||||
}
|
||||
}
|
||||
|
||||
return filter;
|
||||
|
||||
}
|
||||
|
||||
static GdkPixbuf *
|
||||
create_shadow (GdkPixbuf *src)
|
||||
{
|
||||
int x, y, i, j;
|
||||
int width, height;
|
||||
GdkPixbuf *dest;
|
||||
static ConvFilter *filter = NULL;
|
||||
int src_rowstride, dest_rowstride;
|
||||
int src_bpp, dest_bpp;
|
||||
|
||||
guchar *src_pixels, *dest_pixels;
|
||||
|
||||
if (!filter)
|
||||
filter = create_blur_filter (BLUR_RADIUS);
|
||||
|
||||
width = gdk_pixbuf_get_width (src) + BLUR_RADIUS * 2 + SHADOW_OFFSET;
|
||||
height = gdk_pixbuf_get_height (src) + BLUR_RADIUS * 2 + SHADOW_OFFSET;
|
||||
|
||||
dest = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (src),
|
||||
gdk_pixbuf_get_has_alpha (src),
|
||||
gdk_pixbuf_get_bits_per_sample (src),
|
||||
width, height);
|
||||
gdk_pixbuf_fill (dest, 0);
|
||||
src_pixels = gdk_pixbuf_get_pixels (src);
|
||||
src_rowstride = gdk_pixbuf_get_rowstride (src);
|
||||
src_bpp = gdk_pixbuf_get_has_alpha (src) ? 4 : 3;
|
||||
|
||||
dest_pixels = gdk_pixbuf_get_pixels (dest);
|
||||
dest_rowstride = gdk_pixbuf_get_rowstride (dest);
|
||||
dest_bpp = gdk_pixbuf_get_has_alpha (dest) ? 4 : 3;
|
||||
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
int sumr = 0, sumg = 0, sumb = 0, suma = 0;
|
||||
|
||||
for (i = 0; i < filter->size; i++)
|
||||
{
|
||||
for (j = 0; j < filter->size; j++)
|
||||
{
|
||||
int src_x, src_y;
|
||||
|
||||
src_y = -(BLUR_RADIUS + SHADOW_OFFSET) + y - (filter->size >> 1) + i;
|
||||
src_x = -(BLUR_RADIUS + SHADOW_OFFSET) + x - (filter->size >> 1) + j;
|
||||
|
||||
if (src_y < 0 || src_y > gdk_pixbuf_get_height (src) ||
|
||||
src_x < 0 || src_x > gdk_pixbuf_get_width (src))
|
||||
continue;
|
||||
|
||||
sumr += src_pixels [src_y * src_rowstride +
|
||||
src_x * src_bpp + 0] *
|
||||
filter->data [i * filter->size + j];
|
||||
sumg += src_pixels [src_y * src_rowstride +
|
||||
src_x * src_bpp + 1] *
|
||||
filter->data [i * filter->size + j];
|
||||
|
||||
sumb += src_pixels [src_y * src_rowstride +
|
||||
src_x * src_bpp + 2] *
|
||||
filter->data [i * filter->size + j];
|
||||
|
||||
if (src_bpp == 4)
|
||||
suma += src_pixels [src_y * src_rowstride +
|
||||
src_x * src_bpp + 3] *
|
||||
filter->data [i * filter->size + j];
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (dest_bpp == 4)
|
||||
dest_pixels [y * dest_rowstride +
|
||||
x * dest_bpp + 3] = suma * SHADOW_OPACITY;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
GdkPixbuf *
|
||||
add_shadow (GdkPixbuf *src)
|
||||
{
|
||||
GdkPixbuf *dest;
|
||||
|
||||
dest = create_shadow (src);
|
||||
|
||||
gdk_pixbuf_composite (src, dest,
|
||||
BLUR_RADIUS, BLUR_RADIUS,
|
||||
gdk_pixbuf_get_width (src),
|
||||
gdk_pixbuf_get_height (src),
|
||||
BLUR_RADIUS, BLUR_RADIUS, 1.0, 1.0,
|
||||
GDK_INTERP_NEAREST, 255);
|
||||
|
||||
g_object_unref (src);
|
||||
|
||||
return dest;
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#ifndef __SHADOW_H__
|
||||
#define __SHADOW_H__
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
|
||||
GdkPixbuf *add_shadow (GdkPixbuf *src);
|
||||
|
||||
#endif /* __SHADOW_H__ */
|
@ -1,199 +0,0 @@
|
||||
#include <gdk/gdk.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdkx.h>
|
||||
#include <cairo-xlib.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
|
||||
#include <gdk-pixbuf/gdk-pixbuf.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/wait.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <locale.h>
|
||||
#include "widgets.h"
|
||||
#include "shadow.h"
|
||||
|
||||
static GdkPixbuf *
|
||||
add_border (GdkPixbuf *pixbuf)
|
||||
{
|
||||
GdkPixbuf *retval;
|
||||
|
||||
retval = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8,
|
||||
gdk_pixbuf_get_width (pixbuf) + 2,
|
||||
gdk_pixbuf_get_height (pixbuf) + 2);
|
||||
|
||||
/* Fill with solid black */
|
||||
gdk_pixbuf_fill (retval, 0xFF);
|
||||
gdk_pixbuf_copy_area (pixbuf,
|
||||
0, 0,
|
||||
gdk_pixbuf_get_width (pixbuf),
|
||||
gdk_pixbuf_get_height (pixbuf),
|
||||
retval, 1, 1);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static GMainLoop *loop;
|
||||
|
||||
static gboolean
|
||||
quit_when_idle (gpointer loop)
|
||||
{
|
||||
g_main_loop_quit (loop);
|
||||
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
static void
|
||||
draw_paintable (GdkPaintable *paintable,
|
||||
gpointer out_surface)
|
||||
{
|
||||
GtkSnapshot *snapshot;
|
||||
GskRenderNode *node;
|
||||
cairo_surface_t *surface;
|
||||
cairo_t *cr;
|
||||
|
||||
snapshot = gtk_snapshot_new ();
|
||||
gdk_paintable_snapshot (paintable,
|
||||
snapshot,
|
||||
gdk_paintable_get_intrinsic_width (paintable),
|
||||
gdk_paintable_get_intrinsic_height (paintable));
|
||||
node = gtk_snapshot_free_to_node (snapshot);
|
||||
|
||||
/* If the window literally draws nothing, we assume it hasn't been mapped yet and as such
|
||||
* the invalidations were only side effects of resizes.
|
||||
*/
|
||||
if (node == NULL)
|
||||
return;
|
||||
|
||||
surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32,
|
||||
gdk_paintable_get_intrinsic_width (paintable),
|
||||
gdk_paintable_get_intrinsic_height (paintable));
|
||||
|
||||
cr = cairo_create (surface);
|
||||
gsk_render_node_draw (node, cr);
|
||||
cairo_destroy (cr);
|
||||
gsk_render_node_unref (node);
|
||||
|
||||
g_signal_handlers_disconnect_by_func (paintable, draw_paintable, out_surface);
|
||||
|
||||
*(cairo_surface_t **) out_surface = surface;
|
||||
|
||||
g_idle_add (quit_when_idle, loop);
|
||||
}
|
||||
|
||||
static cairo_surface_t *
|
||||
snapshot_widget (GtkWidget *widget)
|
||||
{
|
||||
GdkPaintable *paintable;
|
||||
cairo_surface_t *surface;
|
||||
|
||||
g_assert (gtk_widget_get_realized (widget));
|
||||
|
||||
loop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
/* We wait until the widget is drawn for the first time.
|
||||
*
|
||||
* We also use an inhibit mechanism, to give module functions a chance
|
||||
* to delay the snapshot.
|
||||
*/
|
||||
paintable = gtk_widget_paintable_new (widget);
|
||||
g_signal_connect (paintable, "invalidate-contents", G_CALLBACK (draw_paintable), &surface);
|
||||
g_main_loop_run (loop);
|
||||
|
||||
g_main_loop_unref (loop);
|
||||
g_object_unref (paintable);
|
||||
gtk_window_destroy (GTK_WINDOW (gtk_widget_get_root (widget)));
|
||||
|
||||
return surface;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
quit_cb (gpointer data)
|
||||
{
|
||||
*(gboolean *)data = TRUE;
|
||||
g_main_context_wakeup (NULL);
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
GList *toplevels, *node;
|
||||
|
||||
gtk_init ();
|
||||
|
||||
toplevels = get_all_widgets ();
|
||||
|
||||
for (node = toplevels; node; node = node->next)
|
||||
{
|
||||
WidgetInfo *info;
|
||||
char *filename;
|
||||
cairo_surface_t *surface;
|
||||
GdkPixbuf *pixbuf;
|
||||
GtkWidget *widget;
|
||||
|
||||
info = node->data;
|
||||
|
||||
gtk_widget_show (info->window);
|
||||
|
||||
if (info->no_focus)
|
||||
{
|
||||
gtk_root_set_focus (GTK_ROOT (info->window), NULL);
|
||||
gdk_clipboard_set_content (gdk_display_get_primary_clipboard (gdk_display_get_default ()),
|
||||
NULL);
|
||||
}
|
||||
|
||||
if (info->snapshot_popover)
|
||||
{
|
||||
GtkWidget *button = gtk_window_get_child (GTK_WINDOW (info->window));
|
||||
|
||||
gtk_menu_button_popup (GTK_MENU_BUTTON (button));
|
||||
widget = GTK_WIDGET (gtk_menu_button_get_popover (GTK_MENU_BUTTON (button)));
|
||||
}
|
||||
else
|
||||
{
|
||||
widget = info->window;
|
||||
}
|
||||
|
||||
if (info->wait > 0)
|
||||
{
|
||||
gboolean quit = FALSE;
|
||||
|
||||
g_timeout_add (info->wait, quit_cb, &quit);
|
||||
|
||||
while (!quit)
|
||||
g_main_context_iteration (NULL, TRUE);
|
||||
}
|
||||
|
||||
surface = snapshot_widget (widget);
|
||||
|
||||
pixbuf = gdk_pixbuf_get_from_surface (surface, 0, 0,
|
||||
cairo_image_surface_get_width (surface),
|
||||
cairo_image_surface_get_height (surface));
|
||||
|
||||
if (!info->include_decorations)
|
||||
pixbuf = add_border (pixbuf);
|
||||
|
||||
pixbuf = add_shadow (pixbuf);
|
||||
|
||||
filename = g_strdup_printf ("./%s.png", info->name);
|
||||
|
||||
gdk_pixbuf_save (pixbuf, filename, "png", NULL, NULL);
|
||||
g_free (filename);
|
||||
|
||||
g_object_unref (pixbuf);
|
||||
cairo_surface_destroy (surface);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
<gresources>
|
||||
<gresource prefix="/">
|
||||
<file>shortcuts-boxes.ui</file>
|
||||
</gresource>
|
||||
</gresources>
|
@ -1,120 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkShortcutsWindow" id="shortcuts-boxes">
|
||||
<property name="modal">1</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsSection">
|
||||
<property name="section-name">shortcuts</property>
|
||||
<property name="max-height">12</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsGroup">
|
||||
<property name="title" translatable="yes">Overview</property>
|
||||
<property name="view">overview</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator">F1</property>
|
||||
<property name="title" translatable="yes">Help</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Ctrl>n</property>
|
||||
<property name="title" translatable="yes">Create a new box</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Ctrl>f</property>
|
||||
<property name="title" translatable="yes">Search</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Ctrl>k</property>
|
||||
<property name="title" translatable="yes">Keyboard shortcuts</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Ctrl>q</property>
|
||||
<property name="title" translatable="yes">Close Window/Quit Boxes</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsGroup">
|
||||
<property name="title" translatable="yes">Box Creation and Properties</property>
|
||||
<property name="view">wizard</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="direction">ltr</property>
|
||||
<property name="accelerator"><Alt>Right</property>
|
||||
<property name="title" translatable="yes">Switch to the next page</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="direction">ltr</property>
|
||||
<property name="accelerator"><Alt>Left</property>
|
||||
<property name="title" translatable="yes">Switch to the previous page</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="direction">rtl</property>
|
||||
<property name="accelerator"><Alt>Left</property>
|
||||
<property name="title" translatable="yes">Switch to the next page</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="direction">rtl</property>
|
||||
<property name="accelerator"><Alt>Right</property>
|
||||
<property name="title" translatable="yes">Switch to the previous page</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsGroup">
|
||||
<property name="title" translatable="yes">Box Display</property>
|
||||
<property name="view">display</property>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator">Control_L+Alt_L</property>
|
||||
<property name="title" translatable="yes">Grab/Ungrab keyboard</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="direction">ltr</property>
|
||||
<property name="accelerator"><Alt>Left</property>
|
||||
<property name="title" translatable="yes">Back to overview</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="direction">rtl</property>
|
||||
<property name="accelerator"><Alt>Right</property>
|
||||
<property name="title" translatable="yes">Back to overview</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator"><Ctrl>q</property>
|
||||
<property name="title" translatable="yes">Close window/Quit Boxes</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkShortcutsShortcut">
|
||||
<property name="accelerator">F11</property>
|
||||
<property name="title" translatable="yes">Fullscreen/Restore from fullscreen</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</interface>
|
2221
docs/tools/widgets.c
2221
docs/tools/widgets.c
File diff suppressed because it is too large
Load Diff
@ -1,29 +0,0 @@
|
||||
#ifndef __WIDGETS_H__
|
||||
#define __WIDGETS_H__
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
typedef enum
|
||||
{
|
||||
SMALL,
|
||||
MEDIUM,
|
||||
LARGE,
|
||||
ASIS
|
||||
} WidgetSize;
|
||||
|
||||
typedef struct WidgetInfo
|
||||
{
|
||||
GtkWidget *window;
|
||||
char *name;
|
||||
gboolean no_focus;
|
||||
gboolean include_decorations;
|
||||
gboolean snapshot_popover;
|
||||
guint wait;
|
||||
WidgetSize size;
|
||||
} WidgetInfo;
|
||||
|
||||
GList *get_all_widgets (void);
|
||||
|
||||
|
||||
#endif /* __WIDGETS_H__ */
|
@ -894,7 +894,6 @@ endif
|
||||
subdir('po')
|
||||
subdir('po-properties')
|
||||
|
||||
subdir('docs/tools')
|
||||
subdir('docs/reference')
|
||||
|
||||
if not meson.is_cross_build()
|
||||
|
Loading…
Reference in New Issue
Block a user