2006-12-10 05:33:38 +08:00
|
|
|
/* GIMP - The GNU Image Manipulation Program
|
1998-05-03 05:50:29 +08:00
|
|
|
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
|
|
|
|
*
|
2009-01-18 06:28:01 +08:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
1998-05-03 05:50:29 +08:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
2009-01-18 06:28:01 +08:00
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
1998-05-03 05:50:29 +08:00
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
2009-01-18 06:28:01 +08:00
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
1998-05-03 05:50:29 +08:00
|
|
|
*/
|
2000-07-16 20:49:04 +08:00
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
1999-03-07 20:56:03 +08:00
|
|
|
#include <string.h>
|
1998-07-15 10:28:31 +08:00
|
|
|
|
2012-03-30 01:19:01 +08:00
|
|
|
#include <gegl.h>
|
1998-05-03 05:50:29 +08:00
|
|
|
#include <gtk/gtk.h>
|
1998-07-15 10:28:31 +08:00
|
|
|
|
2001-05-22 04:30:16 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2007-03-09 21:00:01 +08:00
|
|
|
#include "libgimpmath/gimpmath.h"
|
2006-09-09 08:36:23 +08:00
|
|
|
#include "libgimpwidgets/gimpwidgets.h"
|
2001-01-24 07:56:18 +08:00
|
|
|
|
2004-09-13 23:15:23 +08:00
|
|
|
#include "dialogs-types.h"
|
2000-12-17 05:37:03 +08:00
|
|
|
|
2006-04-26 17:13:47 +08:00
|
|
|
#include "core/gimp.h"
|
2005-08-20 00:32:01 +08:00
|
|
|
#include "core/gimpcontext.h"
|
2001-02-21 20:18:09 +08:00
|
|
|
|
2006-04-26 17:13:47 +08:00
|
|
|
#include "pdb/gimppdb.h"
|
2001-05-09 03:29:15 +08:00
|
|
|
|
2005-12-29 04:45:52 +08:00
|
|
|
#include "about.h"
|
2010-09-28 20:23:41 +08:00
|
|
|
#include "git-version.h"
|
2005-12-29 04:45:52 +08:00
|
|
|
|
2001-04-18 05:43:29 +08:00
|
|
|
#include "about-dialog.h"
|
2001-06-05 08:22:25 +08:00
|
|
|
#include "authors.h"
|
2001-04-18 05:43:29 +08:00
|
|
|
|
2003-03-26 00:38:19 +08:00
|
|
|
#include "gimp-intl.h"
|
2000-12-29 23:22:01 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2011-01-28 01:48:30 +08:00
|
|
|
/* The first authors are the creators and maintainers, don't shuffle
|
|
|
|
* them
|
|
|
|
*/
|
|
|
|
#define START_INDEX (G_N_ELEMENTS (creators) - 1 /*NULL*/ + \
|
|
|
|
G_N_ELEMENTS (maintainers) - 1 /*NULL*/)
|
2011-01-28 01:35:01 +08:00
|
|
|
|
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
typedef struct
|
|
|
|
{
|
2008-10-10 03:16:54 +08:00
|
|
|
GtkWidget *dialog;
|
2005-08-20 00:32:01 +08:00
|
|
|
|
2008-10-10 03:16:54 +08:00
|
|
|
GtkWidget *anim_area;
|
|
|
|
PangoLayout *layout;
|
2005-08-20 00:32:01 +08:00
|
|
|
|
2008-10-10 03:16:54 +08:00
|
|
|
gint n_authors;
|
|
|
|
gint shuffle[G_N_ELEMENTS (authors) - 1]; /* NULL terminated */
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2008-10-10 03:16:54 +08:00
|
|
|
guint timer;
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2008-10-10 03:16:54 +08:00
|
|
|
gint index;
|
|
|
|
gint animstep;
|
|
|
|
gint textrange[2];
|
|
|
|
gint state;
|
|
|
|
gboolean visible;
|
2005-08-20 00:32:01 +08:00
|
|
|
} GimpAboutDialog;
|
2003-12-29 10:57:07 +08:00
|
|
|
|
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
static void about_dialog_map (GtkWidget *widget,
|
|
|
|
GimpAboutDialog *dialog);
|
|
|
|
static void about_dialog_unmap (GtkWidget *widget,
|
|
|
|
GimpAboutDialog *dialog);
|
|
|
|
static GdkPixbuf * about_dialog_load_logo (void);
|
|
|
|
static void about_dialog_add_animation (GtkWidget *vbox,
|
|
|
|
GimpAboutDialog *dialog);
|
|
|
|
static gboolean about_dialog_anim_expose (GtkWidget *widget,
|
|
|
|
GdkEventExpose *event,
|
|
|
|
GimpAboutDialog *dialog);
|
|
|
|
static void about_dialog_reshuffle (GimpAboutDialog *dialog);
|
|
|
|
static gboolean about_dialog_timer (gpointer data);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2012-02-20 00:44:36 +08:00
|
|
|
#ifdef GIMP_UNSTABLE
|
2012-02-19 18:59:51 +08:00
|
|
|
static void about_dialog_add_unstable_message
|
|
|
|
(GtkWidget *vbox);
|
2012-02-20 00:44:36 +08:00
|
|
|
#endif /* GIMP_UNSTABLE */
|
2006-08-16 06:21:32 +08:00
|
|
|
|
2001-10-25 21:30:01 +08:00
|
|
|
|
2001-04-19 00:39:34 +08:00
|
|
|
GtkWidget *
|
2005-08-20 00:32:01 +08:00
|
|
|
about_dialog_create (GimpContext *context)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2012-02-07 21:06:12 +08:00
|
|
|
static GimpAboutDialog dialog;
|
2005-08-20 00:32:01 +08:00
|
|
|
|
|
|
|
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
|
|
|
|
|
2012-02-07 21:06:12 +08:00
|
|
|
if (! dialog.dialog)
|
2003-12-29 10:57:07 +08:00
|
|
|
{
|
2006-06-19 21:24:44 +08:00
|
|
|
GtkWidget *widget;
|
|
|
|
GtkWidget *container;
|
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
GList *children;
|
2010-09-28 20:23:41 +08:00
|
|
|
gchar *copyright;
|
2005-08-20 00:32:01 +08:00
|
|
|
|
2012-02-07 21:06:12 +08:00
|
|
|
dialog.n_authors = G_N_ELEMENTS (authors) - 1;
|
2005-08-20 00:32:01 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
pixbuf = about_dialog_load_logo ();
|
|
|
|
|
2010-09-30 04:26:02 +08:00
|
|
|
copyright = g_strdup_printf (GIMP_COPYRIGHT, GIMP_GIT_LAST_COMMIT_YEAR);
|
2010-09-28 20:23:41 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
widget = g_object_new (GTK_TYPE_ABOUT_DIALOG,
|
2011-03-31 02:20:47 +08:00
|
|
|
"role", "gimp-about",
|
2005-08-20 01:15:28 +08:00
|
|
|
"window-position", GTK_WIN_POS_CENTER,
|
2007-05-21 15:53:01 +08:00
|
|
|
"title", _("About GIMP"),
|
|
|
|
"program-name", GIMP_ACRONYM,
|
2005-08-20 00:32:01 +08:00
|
|
|
"version", GIMP_VERSION,
|
2010-09-28 20:23:41 +08:00
|
|
|
"copyright", copyright,
|
2005-12-29 04:45:52 +08:00
|
|
|
"comments", GIMP_NAME,
|
|
|
|
"license", GIMP_LICENSE,
|
2005-12-29 03:53:46 +08:00
|
|
|
"wrap-license", TRUE,
|
2006-06-19 21:24:44 +08:00
|
|
|
"logo", pixbuf,
|
2005-12-29 04:45:52 +08:00
|
|
|
"website", "http://www.gimp.org/",
|
|
|
|
"website-label", _("Visit the GIMP website"),
|
2005-08-20 00:32:01 +08:00
|
|
|
"authors", authors,
|
2005-08-20 10:28:29 +08:00
|
|
|
"artists", artists,
|
|
|
|
"documenters", documenters,
|
2010-09-30 04:26:02 +08:00
|
|
|
/* Translators: insert your names here,
|
|
|
|
separated by newline */
|
2005-08-20 00:32:01 +08:00
|
|
|
"translator-credits", _("translator-credits"),
|
2004-03-15 04:55:13 +08:00
|
|
|
NULL);
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2006-06-20 17:14:26 +08:00
|
|
|
if (pixbuf)
|
|
|
|
g_object_unref (pixbuf);
|
2006-06-19 21:24:44 +08:00
|
|
|
|
2010-09-30 04:26:02 +08:00
|
|
|
g_free (copyright);
|
2010-09-28 20:23:41 +08:00
|
|
|
|
2012-02-07 21:06:12 +08:00
|
|
|
dialog.dialog = widget;
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2012-02-07 21:06:12 +08:00
|
|
|
g_object_add_weak_pointer (G_OBJECT (widget), (gpointer) &dialog.dialog);
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
g_signal_connect (widget, "response",
|
|
|
|
G_CALLBACK (gtk_widget_destroy),
|
2003-12-29 10:57:07 +08:00
|
|
|
NULL);
|
2005-08-20 00:32:01 +08:00
|
|
|
|
|
|
|
g_signal_connect (widget, "map",
|
|
|
|
G_CALLBACK (about_dialog_map),
|
2012-02-07 21:06:12 +08:00
|
|
|
&dialog);
|
2003-12-29 10:57:07 +08:00
|
|
|
g_signal_connect (widget, "unmap",
|
|
|
|
G_CALLBACK (about_dialog_unmap),
|
2012-02-07 21:06:12 +08:00
|
|
|
&dialog);
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
/* kids, don't try this at home! */
|
2009-07-15 22:19:32 +08:00
|
|
|
container = gtk_dialog_get_content_area (GTK_DIALOG (widget));
|
2005-08-20 00:32:01 +08:00
|
|
|
children = gtk_container_get_children (GTK_CONTAINER (container));
|
2004-03-15 04:55:13 +08:00
|
|
|
|
2011-07-28 02:21:58 +08:00
|
|
|
if (GTK_IS_BOX (children->data))
|
2006-08-16 06:21:32 +08:00
|
|
|
{
|
2012-02-07 21:06:12 +08:00
|
|
|
about_dialog_add_animation (children->data, &dialog);
|
2012-02-20 00:44:36 +08:00
|
|
|
#ifdef GIMP_UNSTABLE
|
2012-02-19 18:59:51 +08:00
|
|
|
about_dialog_add_unstable_message (children->data);
|
2012-02-20 00:44:36 +08:00
|
|
|
#endif /* GIMP_UNSTABLE */
|
2006-08-16 06:21:32 +08:00
|
|
|
}
|
2005-08-20 00:32:01 +08:00
|
|
|
else
|
2011-07-28 02:21:58 +08:00
|
|
|
g_warning ("%s: ooops, no box in this container?", G_STRLOC);
|
2004-01-18 09:29:37 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
g_list_free (children);
|
|
|
|
}
|
2004-01-14 07:19:05 +08:00
|
|
|
|
2012-02-07 21:06:12 +08:00
|
|
|
gtk_window_present (GTK_WINDOW (dialog.dialog));
|
2004-01-14 07:19:05 +08:00
|
|
|
|
2012-02-07 21:06:12 +08:00
|
|
|
return dialog.dialog;
|
2005-08-20 00:32:01 +08:00
|
|
|
}
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
static void
|
|
|
|
about_dialog_map (GtkWidget *widget,
|
|
|
|
GimpAboutDialog *dialog)
|
|
|
|
{
|
|
|
|
if (dialog->layout && dialog->timer == 0)
|
|
|
|
{
|
|
|
|
dialog->state = 0;
|
|
|
|
dialog->index = 0;
|
|
|
|
dialog->animstep = 0;
|
|
|
|
dialog->visible = FALSE;
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
about_dialog_reshuffle (dialog);
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
dialog->timer = g_timeout_add (800, about_dialog_timer, dialog);
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2005-08-20 00:32:01 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
static void
|
|
|
|
about_dialog_unmap (GtkWidget *widget,
|
|
|
|
GimpAboutDialog *dialog)
|
|
|
|
{
|
|
|
|
if (dialog->timer)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2005-08-20 00:32:01 +08:00
|
|
|
g_source_remove (dialog->timer);
|
|
|
|
dialog->timer = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
static GdkPixbuf *
|
|
|
|
about_dialog_load_logo (void)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2006-06-19 21:24:44 +08:00
|
|
|
GdkPixbuf *pixbuf;
|
|
|
|
gchar *filename;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
filename = g_build_filename (gimp_data_directory (), "images",
|
2008-10-10 03:16:54 +08:00
|
|
|
#ifdef GIMP_UNSTABLE
|
|
|
|
"gimp-devel-logo.png",
|
|
|
|
#else
|
2006-06-19 21:24:44 +08:00
|
|
|
"gimp-logo.png",
|
2008-10-10 03:16:54 +08:00
|
|
|
#endif
|
2006-06-19 21:24:44 +08:00
|
|
|
NULL);
|
2005-08-20 00:32:01 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
|
|
|
|
g_free (filename);
|
2005-08-20 00:32:01 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
return pixbuf;
|
|
|
|
}
|
2004-05-06 22:26:31 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
static void
|
|
|
|
about_dialog_add_animation (GtkWidget *vbox,
|
|
|
|
GimpAboutDialog *dialog)
|
|
|
|
{
|
|
|
|
gint height;
|
2004-05-06 22:26:31 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
dialog->anim_area = gtk_drawing_area_new ();
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), dialog->anim_area, FALSE, FALSE, 0);
|
|
|
|
gtk_box_reorder_child (GTK_BOX (vbox), dialog->anim_area, 4);
|
|
|
|
gtk_widget_show (dialog->anim_area);
|
2004-05-06 22:26:31 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
dialog->layout = gtk_widget_create_pango_layout (dialog->anim_area, NULL);
|
|
|
|
g_object_weak_ref (G_OBJECT (dialog->anim_area),
|
2005-08-20 00:32:01 +08:00
|
|
|
(GWeakNotify) g_object_unref, dialog->layout);
|
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
pango_layout_get_pixel_size (dialog->layout, NULL, &height);
|
|
|
|
|
|
|
|
gtk_widget_set_size_request (dialog->anim_area, -1, 2 * height);
|
2005-08-20 00:32:01 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
g_signal_connect (dialog->anim_area, "expose-event",
|
|
|
|
G_CALLBACK (about_dialog_anim_expose),
|
|
|
|
dialog);
|
2004-05-06 22:26:31 +08:00
|
|
|
}
|
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
static void
|
|
|
|
about_dialog_reshuffle (GimpAboutDialog *dialog)
|
1997-11-25 06:05:25 +08:00
|
|
|
{
|
2005-08-20 00:32:01 +08:00
|
|
|
GRand *gr = g_rand_new ();
|
|
|
|
gint i;
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
for (i = 0; i < dialog->n_authors; i++)
|
|
|
|
dialog->shuffle[i] = i;
|
2004-01-14 07:19:05 +08:00
|
|
|
|
2005-08-20 09:16:41 +08:00
|
|
|
for (i = START_INDEX; i < dialog->n_authors; i++)
|
2005-08-20 00:32:01 +08:00
|
|
|
{
|
2005-08-20 09:16:41 +08:00
|
|
|
gint j = g_rand_int_range (gr, START_INDEX, dialog->n_authors);
|
2004-01-14 07:19:05 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
if (i != j)
|
|
|
|
{
|
|
|
|
gint t;
|
2004-01-14 07:19:05 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
t = dialog->shuffle[j];
|
|
|
|
dialog->shuffle[j] = dialog->shuffle[i];
|
|
|
|
dialog->shuffle[i] = t;
|
|
|
|
}
|
2003-12-30 01:52:46 +08:00
|
|
|
}
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
g_rand_free (gr);
|
|
|
|
}
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
static gboolean
|
2006-06-19 21:24:44 +08:00
|
|
|
about_dialog_anim_expose (GtkWidget *widget,
|
2005-08-20 00:32:01 +08:00
|
|
|
GdkEventExpose *event,
|
|
|
|
GimpAboutDialog *dialog)
|
|
|
|
{
|
2009-10-18 01:03:24 +08:00
|
|
|
GtkStyle *style = gtk_widget_get_style (widget);
|
2010-07-28 00:01:34 +08:00
|
|
|
cairo_t *cr;
|
2009-10-18 01:03:24 +08:00
|
|
|
GtkAllocation allocation;
|
|
|
|
gint x, y;
|
|
|
|
gint width, height;
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
if (! dialog->visible)
|
|
|
|
return FALSE;
|
2004-01-14 07:19:05 +08:00
|
|
|
|
2010-07-28 00:01:34 +08:00
|
|
|
cr = gdk_cairo_create (event->window);
|
2009-10-18 01:03:24 +08:00
|
|
|
|
2010-07-28 00:01:34 +08:00
|
|
|
gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
|
2005-08-20 00:32:01 +08:00
|
|
|
|
2010-07-28 00:01:34 +08:00
|
|
|
gtk_widget_get_allocation (widget, &allocation);
|
2006-06-19 21:24:44 +08:00
|
|
|
pango_layout_get_pixel_size (dialog->layout, &width, &height);
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2009-10-18 01:03:24 +08:00
|
|
|
x = (allocation.width - width) / 2;
|
|
|
|
y = (allocation.height - height) / 2;
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
if (dialog->textrange[1] > 0)
|
|
|
|
{
|
2010-07-28 00:01:34 +08:00
|
|
|
GdkRegion *covered_region;
|
2004-02-18 21:43:50 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
covered_region = gdk_pango_layout_get_clip_region (dialog->layout,
|
|
|
|
x, y,
|
|
|
|
dialog->textrange, 1);
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2010-07-28 00:01:34 +08:00
|
|
|
gdk_region_intersect (covered_region, event->region);
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2010-07-28 00:01:34 +08:00
|
|
|
gdk_cairo_region (cr, covered_region);
|
|
|
|
cairo_clip (cr);
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
gdk_region_destroy (covered_region);
|
|
|
|
}
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2010-07-28 00:01:34 +08:00
|
|
|
cairo_move_to (cr, x, y);
|
|
|
|
|
|
|
|
pango_cairo_show_layout (cr, dialog->layout);
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2010-07-28 00:01:34 +08:00
|
|
|
cairo_destroy (cr);
|
2004-02-18 21:43:50 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gchar *
|
|
|
|
insert_spacers (const gchar *string)
|
|
|
|
{
|
2005-08-20 00:32:01 +08:00
|
|
|
GString *str = g_string_new (NULL);
|
|
|
|
gchar *normalized;
|
|
|
|
gchar *ptr;
|
|
|
|
gunichar unichr;
|
2000-08-24 08:33:11 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
normalized = g_utf8_normalize (string, -1, G_NORMALIZE_DEFAULT_COMPOSE);
|
|
|
|
ptr = normalized;
|
|
|
|
|
|
|
|
while ((unichr = g_utf8_get_char (ptr)))
|
2000-08-24 08:33:11 +08:00
|
|
|
{
|
2003-12-29 10:57:07 +08:00
|
|
|
g_string_append_unichar (str, unichr);
|
|
|
|
g_string_append_unichar (str, 0x200b); /* ZERO WIDTH SPACE */
|
|
|
|
ptr = g_utf8_next_char (ptr);
|
|
|
|
}
|
2003-11-08 01:29:02 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
g_free (normalized);
|
2003-11-08 01:29:02 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
return g_string_free (str, FALSE);
|
|
|
|
}
|
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
static void inline
|
2006-06-19 21:24:44 +08:00
|
|
|
mix_colors (const GdkColor *start,
|
|
|
|
const GdkColor *end,
|
|
|
|
GdkColor *target,
|
|
|
|
gdouble pos)
|
2000-07-16 20:49:04 +08:00
|
|
|
{
|
2003-12-29 10:57:07 +08:00
|
|
|
target->red = start->red * (1.0 - pos) + end->red * pos;
|
|
|
|
target->green = start->green * (1.0 - pos) + end->green * pos;
|
|
|
|
target->blue = start->blue * (1.0 - pos) + end->blue * pos;
|
|
|
|
}
|
2001-09-20 03:06:36 +08:00
|
|
|
|
2003-12-30 01:52:46 +08:00
|
|
|
static void
|
2005-08-20 00:32:01 +08:00
|
|
|
decorate_text (GimpAboutDialog *dialog,
|
|
|
|
gint anim_type,
|
|
|
|
gdouble time)
|
2003-12-30 01:52:46 +08:00
|
|
|
{
|
2008-06-28 23:12:13 +08:00
|
|
|
GtkStyle *style = gtk_widget_get_style (dialog->anim_area);
|
2005-08-20 00:32:01 +08:00
|
|
|
const gchar *text;
|
|
|
|
const gchar *ptr;
|
|
|
|
gint letter_count = 0;
|
|
|
|
gint text_length = 0;
|
|
|
|
gint text_bytelen = 0;
|
|
|
|
gint cluster_start, cluster_end;
|
|
|
|
gunichar unichr;
|
|
|
|
PangoAttrList *attrlist = NULL;
|
2003-12-29 10:57:07 +08:00
|
|
|
PangoAttribute *attr;
|
2005-08-20 00:32:01 +08:00
|
|
|
PangoRectangle irect = {0, 0, 0, 0};
|
|
|
|
PangoRectangle lrect = {0, 0, 0, 0};
|
2006-06-19 21:24:44 +08:00
|
|
|
GdkColor mix;
|
2005-08-20 00:32:01 +08:00
|
|
|
|
2008-06-28 23:12:13 +08:00
|
|
|
mix_colors (style->bg + GTK_STATE_NORMAL,
|
|
|
|
style->fg + GTK_STATE_NORMAL, &mix, time);
|
2003-12-29 10:57:07 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
text = pango_layout_get_text (dialog->layout);
|
|
|
|
g_return_if_fail (text != NULL);
|
2003-12-29 10:57:07 +08:00
|
|
|
|
|
|
|
text_length = g_utf8_strlen (text, -1);
|
|
|
|
text_bytelen = strlen (text);
|
|
|
|
|
|
|
|
attrlist = pango_attr_list_new ();
|
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
dialog->textrange[0] = 0;
|
|
|
|
dialog->textrange[1] = text_bytelen;
|
2003-12-29 10:57:07 +08:00
|
|
|
|
|
|
|
switch (anim_type)
|
2005-08-20 00:32:01 +08:00
|
|
|
{
|
2003-12-29 10:57:07 +08:00
|
|
|
case 0: /* Fade in */
|
|
|
|
attr = pango_attr_foreground_new (mix.red, mix.green, mix.blue);
|
|
|
|
attr->start_index = 0;
|
|
|
|
attr->end_index = text_bytelen;
|
|
|
|
pango_attr_list_insert (attrlist, attr);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 1: /* Fade in, spread */
|
|
|
|
attr = pango_attr_foreground_new (mix.red, mix.green, mix.blue);
|
|
|
|
attr->start_index = 0;
|
|
|
|
attr->end_index = text_bytelen;
|
|
|
|
pango_attr_list_change (attrlist, attr);
|
|
|
|
|
|
|
|
ptr = text;
|
|
|
|
|
|
|
|
cluster_start = 0;
|
|
|
|
while ((unichr = g_utf8_get_char (ptr)))
|
|
|
|
{
|
|
|
|
ptr = g_utf8_next_char (ptr);
|
|
|
|
cluster_end = (ptr - text);
|
|
|
|
|
|
|
|
if (unichr == 0x200b)
|
|
|
|
{
|
|
|
|
lrect.width = (1.0 - time) * 15.0 * PANGO_SCALE + 0.5;
|
|
|
|
attr = pango_attr_shape_new (&irect, &lrect);
|
|
|
|
attr->start_index = cluster_start;
|
|
|
|
attr->end_index = cluster_end;
|
|
|
|
pango_attr_list_change (attrlist, attr);
|
|
|
|
}
|
|
|
|
cluster_start = cluster_end;
|
|
|
|
}
|
|
|
|
break;
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
case 2: /* Fade in, sinewave */
|
|
|
|
attr = pango_attr_foreground_new (mix.red, mix.green, mix.blue);
|
|
|
|
attr->start_index = 0;
|
|
|
|
attr->end_index = text_bytelen;
|
|
|
|
pango_attr_list_change (attrlist, attr);
|
|
|
|
|
|
|
|
ptr = text;
|
|
|
|
|
|
|
|
cluster_start = 0;
|
2005-08-20 00:32:01 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
while ((unichr = g_utf8_get_char (ptr)))
|
|
|
|
{
|
|
|
|
if (unichr == 0x200b)
|
|
|
|
{
|
|
|
|
cluster_end = ptr - text;
|
|
|
|
attr = pango_attr_rise_new ((1.0 -time) * 18000 *
|
|
|
|
sin (4.0 * time +
|
|
|
|
(float) letter_count * 0.7));
|
|
|
|
attr->start_index = cluster_start;
|
|
|
|
attr->end_index = cluster_end;
|
|
|
|
pango_attr_list_change (attrlist, attr);
|
|
|
|
|
|
|
|
letter_count++;
|
|
|
|
cluster_start = cluster_end;
|
|
|
|
}
|
|
|
|
|
|
|
|
ptr = g_utf8_next_char (ptr);
|
|
|
|
}
|
|
|
|
break;
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
case 3: /* letterwise Fade in */
|
|
|
|
ptr = text;
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
letter_count = 0;
|
2003-12-29 10:57:07 +08:00
|
|
|
cluster_start = 0;
|
2005-08-20 00:32:01 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
while ((unichr = g_utf8_get_char (ptr)))
|
|
|
|
{
|
2005-08-20 00:32:01 +08:00
|
|
|
gint border = (text_length + 15) * time - 15;
|
2003-12-29 10:57:07 +08:00
|
|
|
gdouble pos;
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
if (letter_count < border)
|
|
|
|
pos = 0;
|
|
|
|
else if (letter_count > border + 15)
|
|
|
|
pos = 1;
|
|
|
|
else
|
|
|
|
pos = ((gdouble) (letter_count - border)) / 15;
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2008-06-28 23:12:13 +08:00
|
|
|
mix_colors (style->fg + GTK_STATE_NORMAL,
|
|
|
|
style->bg + GTK_STATE_NORMAL,
|
2003-12-29 10:57:07 +08:00
|
|
|
&mix, pos);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
ptr = g_utf8_next_char (ptr);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
cluster_end = ptr - text;
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
attr = pango_attr_foreground_new (mix.red, mix.green, mix.blue);
|
|
|
|
attr->start_index = cluster_start;
|
|
|
|
attr->end_index = cluster_end;
|
|
|
|
pango_attr_list_change (attrlist, attr);
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
if (pos < 1.0)
|
2005-08-20 00:32:01 +08:00
|
|
|
dialog->textrange[1] = cluster_end;
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
letter_count++;
|
|
|
|
cluster_start = cluster_end;
|
|
|
|
}
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
break;
|
2000-07-16 20:49:04 +08:00
|
|
|
|
2003-12-29 10:57:07 +08:00
|
|
|
default:
|
|
|
|
g_printerr ("Unknown animation type %d\n", anim_type);
|
2005-08-20 00:32:01 +08:00
|
|
|
}
|
2004-02-18 21:43:50 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
pango_layout_set_attributes (dialog->layout, attrlist);
|
2003-12-29 10:57:07 +08:00
|
|
|
pango_attr_list_unref (attrlist);
|
2000-07-16 20:49:04 +08:00
|
|
|
}
|
|
|
|
|
2001-09-20 03:06:36 +08:00
|
|
|
static gboolean
|
1997-11-25 06:05:25 +08:00
|
|
|
about_dialog_timer (gpointer data)
|
|
|
|
{
|
2005-08-20 00:32:01 +08:00
|
|
|
GimpAboutDialog *dialog = data;
|
|
|
|
gint timeout = 0;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
if (dialog->animstep == 0)
|
|
|
|
{
|
2006-06-19 21:24:44 +08:00
|
|
|
gchar *text = NULL;
|
2004-01-14 07:19:05 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
dialog->visible = TRUE;
|
2004-01-14 07:19:05 +08:00
|
|
|
|
2005-08-20 09:16:41 +08:00
|
|
|
switch (dialog->state)
|
2004-01-14 07:19:05 +08:00
|
|
|
{
|
2005-08-20 09:16:41 +08:00
|
|
|
case 0:
|
|
|
|
dialog->timer = g_timeout_add (30, about_dialog_timer, dialog);
|
|
|
|
dialog->state += 1;
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
text = insert_spacers (_("GIMP is brought to you by"));
|
|
|
|
dialog->state += 1;
|
|
|
|
break;
|
2004-02-18 21:43:50 +08:00
|
|
|
|
2005-08-20 09:16:41 +08:00
|
|
|
case 2:
|
|
|
|
if (! (dialog->index < dialog->n_authors))
|
2005-08-20 00:32:01 +08:00
|
|
|
dialog->index = 0;
|
2003-12-31 04:10:36 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
text = insert_spacers (authors[dialog->shuffle[dialog->index]]);
|
2005-08-20 09:16:41 +08:00
|
|
|
dialog->index += 1;
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
g_return_val_if_reached (TRUE);
|
|
|
|
break;
|
2003-12-31 04:10:36 +08:00
|
|
|
}
|
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
g_return_val_if_fail (text != NULL, TRUE);
|
2004-02-18 21:43:50 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
pango_layout_set_text (dialog->layout, text, -1);
|
|
|
|
pango_layout_set_attributes (dialog->layout, NULL);
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
g_free (text);
|
2003-12-29 10:57:07 +08:00
|
|
|
}
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
if (dialog->animstep < 16)
|
2003-12-29 10:57:07 +08:00
|
|
|
{
|
2006-06-19 21:32:04 +08:00
|
|
|
decorate_text (dialog, 2, ((gfloat) dialog->animstep) / 15.0);
|
2003-12-29 10:57:07 +08:00
|
|
|
}
|
2005-08-20 00:32:01 +08:00
|
|
|
else if (dialog->animstep == 16)
|
2003-12-29 10:57:07 +08:00
|
|
|
{
|
2005-08-20 00:32:01 +08:00
|
|
|
timeout = 800;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2005-08-20 00:32:01 +08:00
|
|
|
else if (dialog->animstep == 17)
|
2003-12-29 10:57:07 +08:00
|
|
|
{
|
2005-08-20 00:32:01 +08:00
|
|
|
timeout = 30;
|
2003-12-29 10:57:07 +08:00
|
|
|
}
|
2005-08-20 00:32:01 +08:00
|
|
|
else if (dialog->animstep < 33)
|
2003-12-29 10:57:07 +08:00
|
|
|
{
|
2005-08-20 00:32:01 +08:00
|
|
|
decorate_text (dialog, 1,
|
|
|
|
1.0 - ((gfloat) (dialog->animstep - 17)) / 15.0);
|
2003-12-29 10:57:07 +08:00
|
|
|
}
|
2005-08-20 00:32:01 +08:00
|
|
|
else if (dialog->animstep == 33)
|
2003-12-29 10:57:07 +08:00
|
|
|
{
|
2005-08-20 00:32:01 +08:00
|
|
|
dialog->visible = FALSE;
|
|
|
|
timeout = 300;
|
2003-12-29 10:57:07 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-08-20 00:32:01 +08:00
|
|
|
dialog->visible = FALSE;
|
|
|
|
dialog->animstep = -1;
|
|
|
|
timeout = 30;
|
2003-12-29 10:57:07 +08:00
|
|
|
}
|
|
|
|
|
2005-08-20 00:32:01 +08:00
|
|
|
dialog->animstep++;
|
1997-11-25 06:05:25 +08:00
|
|
|
|
2006-06-19 21:24:44 +08:00
|
|
|
gtk_widget_queue_draw (dialog->anim_area);
|
2005-08-20 00:32:01 +08:00
|
|
|
|
|
|
|
if (timeout > 0)
|
|
|
|
{
|
|
|
|
dialog->timer = g_timeout_add (timeout, about_dialog_timer, dialog);
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* else keep the current timeout */
|
|
|
|
return TRUE;
|
1997-11-25 06:05:25 +08:00
|
|
|
}
|
2006-08-16 06:21:32 +08:00
|
|
|
|
2012-02-20 00:44:36 +08:00
|
|
|
#ifdef GIMP_UNSTABLE
|
|
|
|
|
2006-08-16 06:21:32 +08:00
|
|
|
static void
|
2012-02-19 18:59:51 +08:00
|
|
|
about_dialog_add_unstable_message (GtkWidget *vbox)
|
2006-08-16 06:21:32 +08:00
|
|
|
{
|
2006-08-16 18:42:44 +08:00
|
|
|
GtkWidget *label;
|
|
|
|
|
|
|
|
label = gtk_label_new (_("This is an unstable development release."));
|
|
|
|
gimp_label_set_attributes (GTK_LABEL (label),
|
|
|
|
PANGO_ATTR_STYLE, PANGO_STYLE_ITALIC,
|
|
|
|
-1);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
|
|
|
gtk_box_reorder_child (GTK_BOX (vbox), label, 2);
|
|
|
|
gtk_widget_show (label);
|
|
|
|
}
|
2006-08-16 06:21:32 +08:00
|
|
|
|
2012-02-20 00:44:36 +08:00
|
|
|
#endif /* GIMP_UNSTABLE */
|