gimp/app/dialogs/about-dialog.c

607 lines
16 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (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
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.h"
1999-03-07 20:56:03 +08:00
#include <string.h>
1998-07-15 10:28:31 +08:00
#include <gegl.h>
#include <gtk/gtk.h>
1998-07-15 10:28:31 +08:00
#include "libgimpbase/gimpbase.h"
#include "libgimpmath/gimpmath.h"
#include "libgimpwidgets/gimpwidgets.h"
configure.in added new directory app/dialogs and link libappdialogs.c into 2004-09-13 Michael Natterer <mitch@gimp.org> * configure.in * app/Makefile.am: added new directory app/dialogs and link libappdialogs.c into the gimp binary. * app/gui/Makefile.am * app/gui/gui-types.h * app/gui/gui-vtable.c * app/gui/gui.c * app/gui/about-dialog.[ch] * app/gui/authors.h * app/gui/color-notebook.[ch] * app/gui/convert-dialog.[ch] * app/gui/dialogs-constructors.[ch] * app/gui/dialogs.[ch] * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.[ch] * app/gui/file-open-dialog.[ch] * app/gui/file-open-location-dialog.[ch] * app/gui/file-save-dialog.[ch] * app/gui/grid-dialog.[ch] * app/gui/info-dialog.[ch] * app/gui/info-window.[ch] * app/gui/module-browser.[ch] * app/gui/offset-dialog.[ch] * app/gui/palette-import-dialog.[ch] * app/gui/preferences-dialog.[ch] * app/gui/quit-dialog.[ch] * app/gui/resize-dialog.[ch] * app/gui/resolution-calibrate-dialog.[ch] * app/gui/stroke-dialog.[ch] * app/gui/tips-dialog.[ch] * app/gui/tips-parser.[ch] * app/gui/user-install-dialog.[ch]: removed these files... * app/dialogs/Makefile.am * app/dialogs/dialogs-types.h * app/dialogs/*.[ch]: ...and added them here. Changed some filenames like module-browser -> module-dialog. * app/app_procs.c * app/actions/actions-types.h * app/actions/actions.c * app/actions/dialogs-actions.c * app/actions/dialogs-commands.c * app/actions/dockable-commands.c * app/actions/drawable-commands.c * app/actions/edit-commands.c * app/actions/file-commands.c * app/actions/gradient-editor-commands.c * app/actions/image-commands.c * app/actions/layers-commands.c * app/actions/palettes-commands.c * app/actions/select-commands.c * app/actions/templates-commands.c * app/actions/templates-commands.h * app/actions/vectors-commands.c * app/actions/view-commands.c * app/display/gimpdisplayshell-cursor.c * app/display/gimpdisplayshell-title.c * app/display/gimpdisplayshell.[ch] * app/tools/gimpcroptool.c * app/tools/gimpperspectivetool.c * app/tools/gimprotatetool.c * app/tools/gimpscaletool.c * app/tools/gimpsheartool.c * app/tools/gimptransformtool.[ch] * app/tools/gimpvectortool.c * app/widgets/gimpcolormapeditor.[ch] * app/widgets/gimpcolorpanel.c * app/widgets/gimpgradienteditor.[ch] * app/widgets/gimppaletteeditor.[ch] * app/widgets/gimptoolbox-color-area.c * menus/toolbox-menu.xml.in * tools/authorsgen/authorsgen.pl: changed accordingly.
2004-09-13 23:15:23 +08:00
#include "dialogs-types.h"
app/pdb/Makefile.am app/pdb/pdb-types.h new object GimpPDB which keeps all 2006-04-26 Michael Natterer <mitch@gimp.org> * app/pdb/Makefile.am * app/pdb/pdb-types.h * app/pdb/gimppdb.[ch]: new object GimpPDB which keeps all procedures and functions to register and run them. Renamed all functions and did some cleanups. * app/pdb/gimp-pdb.[ch] * app/core/gimp.[ch]: removed the same stuff here. * app/pdb/gimp-pdb-query.[ch]: removed these files... * app/pdb/gimppdb-query.[ch]: ...added here as members of GimpPDB. * app/pdb/gimp-pdb-compat.h: fix include guard. * app/batch.c * app/actions/vectors-commands.c * app/dialogs/about-dialog.c * app/file/file-open.c * app/file/file-save.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/widgets/gimpfiledialog.c * app/widgets/gimphelp.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/procedural_db.pdb: changed includes and function calls accordingly. * tools/pdbgen/app.pl: pass around GimpPDB instead of Gimp pointers to register the internal procedures with. Changed some newlines in the generated code. * app/pdb/*_cmds.c * app/pdb/internal_procs.[ch]: regenerated. * app/core/gimppdbprogress.[ch] * app/widgets/gimppdbdialog.[ch]: added "pdb" CONSTRUCT_ONLY properties. * app/plug-in/plug-in-progress.c * app/gui/gui-vtable.c: pass gimp->pdb when creating them. * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: use the new local pdb pointers instead of some foo->bar->gimp->pdb overkill.
2006-04-26 17:13:47 +08:00
#include "core/gimp.h"
#include "core/gimpcontext.h"
Made the tool system work again and integrated it back with the 2001-02-21 Michael Natterer <mitch@gimp.org> Made the tool system work again and integrated it back with the GimpContext. It's a hack between old, new and freshly hacked stuff. There are still lots of warnings but at least we can switch tools again. * app/tools/Makefile.am * app/tools/gimptoolinfo.[ch]: resurrected as real object. The GimpToolInfo objects are derived from GimpData, which gives us the tool icon stuff for free. Also, we need a list of _objects_ which is allocated all the time. All tools are required to have a "register" function which registers themselves with the list of GimpToolInfo objects which is maintained by the tool manager. * app/tools/tool.[ch]: made a real GtkObject with properly named functions out of it. The former "active_tool_control" is of course not the default implementation of the tool's "control" method but a hack _around_ it, so it went to the tool manager. * app/tools/color_picker.[ch] * app/tools/measure.[ch]: ditto. Added "register" functions and "destroy" implementations so the tools go away after use. * app/tools/tool_manager.[ch]: badly hacked at the moment to keep both the list of class structures _and_ the tool info list. * app/tools/tools.c: call the tools' register functions. * app/gimpcontext.[ch]: store a pointer to a GimpToolInfo object as "active_tool" in the context, so we're independent of tools being allocated or not. It's treated just like a brush or pattern now. * app/gimpdnd.[ch]: made tool DND work like all other DND types. * app/devices.[ch]: also here: the tool is just a normal data object now, resulting in removal of lots of code. * app/commands.c * app/context_manager.c: updated the tool select and context stuff to work again. * app/toolbox.c: removed the old pixmap buttons and put GimpPreviews inside the tool buttons. Still needs an own preview type to look nice. * app/disp_callbacks.c * app/about_dialog.c * app/app_procs.c * app/appenums.h * app/apptypes.h * app/gimage.c * app/gimppalette.c * app/gimppreview.c * app/gimprc.c * app/info_window.c * app/menus.c * app/palette_select.h * app/scale.c * app/scroll.c: lots of changes to make it work again.
2001-02-21 20:18:09 +08:00
app/pdb/Makefile.am app/pdb/pdb-types.h new object GimpPDB which keeps all 2006-04-26 Michael Natterer <mitch@gimp.org> * app/pdb/Makefile.am * app/pdb/pdb-types.h * app/pdb/gimppdb.[ch]: new object GimpPDB which keeps all procedures and functions to register and run them. Renamed all functions and did some cleanups. * app/pdb/gimp-pdb.[ch] * app/core/gimp.[ch]: removed the same stuff here. * app/pdb/gimp-pdb-query.[ch]: removed these files... * app/pdb/gimppdb-query.[ch]: ...added here as members of GimpPDB. * app/pdb/gimp-pdb-compat.h: fix include guard. * app/batch.c * app/actions/vectors-commands.c * app/dialogs/about-dialog.c * app/file/file-open.c * app/file/file-save.c * app/plug-in/plug-in-message.c * app/plug-in/plug-ins.c * app/widgets/gimpfiledialog.c * app/widgets/gimphelp.c * app/xcf/xcf.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/font_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/palette_select.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/procedural_db.pdb: changed includes and function calls accordingly. * tools/pdbgen/app.pl: pass around GimpPDB instead of Gimp pointers to register the internal procedures with. Changed some newlines in the generated code. * app/pdb/*_cmds.c * app/pdb/internal_procs.[ch]: regenerated. * app/core/gimppdbprogress.[ch] * app/widgets/gimppdbdialog.[ch]: added "pdb" CONSTRUCT_ONLY properties. * app/plug-in/plug-in-progress.c * app/gui/gui-vtable.c: pass gimp->pdb when creating them. * app/widgets/gimpbrushselect.c * app/widgets/gimpfontselect.c * app/widgets/gimpgradientselect.c * app/widgets/gimppaletteselect.c * app/widgets/gimppatternselect.c: use the new local pdb pointers instead of some foo->bar->gimp->pdb overkill.
2006-04-26 17:13:47 +08:00
#include "pdb/gimppdb.h"
#include "about.h"
#include "git-version.h"
app/Makefile.am app/gui/Makefile.am app/about_dialog.[ch] 2001-04-17 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gui/Makefile.am * app/about_dialog.[ch] * app/brush_edit.[ch] * app/brush_select.[ch] * app/channels_dialog.[ch] * app/color_area.[ch] * app/color_notebook.[ch] * app/color_select.[ch] * app/colormap_dialog.[ch] * app/commands.[ch] * app/file_new_dialog.[ch] * app/gradient_editor.[ch] * app/gradient_select.[ch] * app/indicator_area.[ch] * app/info_dialog.[ch] * app/info_window.[ch] * app/layer_select.[ch] * app/layers_dialog.[ch] * app/menus.[ch] * app/palette.[ch] * app/palette_import.[ch] * app/palette_select.[ch] * app/paths_dialog.[ch] * app/pattern_select.[ch] * app/preferences_dialog.[ch] * app/session.[ch] * app/test_commands.[ch] * app/tips_dialog.[ch] * app/toolbox.[ch]: moved to gui/ (s/_/-/ and some more useful filenames on the way). * app/app_procs.c * app/context_manager.c * app/convert.c * app/disp_callbacks.c * app/errorconsole.c * app/file-open.c * app/file-save.c * app/file-utils.c * app/gdisplay.c * app/gimage.c * app/gimprc.c * app/image_new.c * app/interface.c * app/nav_window.c * app/path.c * app/plug_in.c * app/gui/dialogs-constructors.c * app/pdb/brush_select_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/pattern_select_cmds.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpscaletool.c * app/tools/gimptransformtool.c * app/widgets/gimpcolorpanel.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/pattern_select.pdb * po/POTFILES.in: changed accordingly.
2001-04-18 05:43:29 +08:00
#include "about-dialog.h"
#include "authors.h"
app/Makefile.am app/gui/Makefile.am app/about_dialog.[ch] 2001-04-17 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/gui/Makefile.am * app/about_dialog.[ch] * app/brush_edit.[ch] * app/brush_select.[ch] * app/channels_dialog.[ch] * app/color_area.[ch] * app/color_notebook.[ch] * app/color_select.[ch] * app/colormap_dialog.[ch] * app/commands.[ch] * app/file_new_dialog.[ch] * app/gradient_editor.[ch] * app/gradient_select.[ch] * app/indicator_area.[ch] * app/info_dialog.[ch] * app/info_window.[ch] * app/layer_select.[ch] * app/layers_dialog.[ch] * app/menus.[ch] * app/palette.[ch] * app/palette_import.[ch] * app/palette_select.[ch] * app/paths_dialog.[ch] * app/pattern_select.[ch] * app/preferences_dialog.[ch] * app/session.[ch] * app/test_commands.[ch] * app/tips_dialog.[ch] * app/toolbox.[ch]: moved to gui/ (s/_/-/ and some more useful filenames on the way). * app/app_procs.c * app/context_manager.c * app/convert.c * app/disp_callbacks.c * app/errorconsole.c * app/file-open.c * app/file-save.c * app/file-utils.c * app/gdisplay.c * app/gimage.c * app/gimprc.c * app/image_new.c * app/interface.c * app/nav_window.c * app/path.c * app/plug_in.c * app/gui/dialogs-constructors.c * app/pdb/brush_select_cmds.c * app/pdb/convert_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/pattern_select_cmds.c * app/tools/gimpcolorpickertool.c * app/tools/gimpcroptool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpscaletool.c * app/tools/gimptransformtool.c * app/widgets/gimpcolorpanel.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/pattern_select.pdb * po/POTFILES.in: changed accordingly.
2001-04-18 05:43:29 +08:00
#include "gimp-intl.h"
app/Makefile.am app/channel_pvt.h app/drawable_pvt.h app/gdisplayF.h 2000-12-29 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/channel_pvt.h * app/drawable_pvt.h * app/gdisplayF.h * app/gimpdrawableP.h * app/gimpimageP.h * app/layer_pvt.h * app/toolsF.h: removed these files. * app/apptypes.h * tools/pdbgen/enums.pl: added tons of opaque typedefs and enums. * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/brushes.pdb * tools/pdbgen/pdb/channel.pdb * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/convert.pdb * tools/pdbgen/pdb/display.pdb * tools/pdbgen/pdb/drawable.pdb * tools/pdbgen/pdb/fileops.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/gradients.pdb * tools/pdbgen/pdb/help.pdb * tools/pdbgen/pdb/image.pdb * tools/pdbgen/pdb/layer.pdb * tools/pdbgen/pdb/pattern_select.pdb * tools/pdbgen/pdb/patterns.pdb * tools/pdbgen/pdb/selection.pdb * tools/pdbgen/pdb/tools.pdb * app/*: chainsaw #include cleanup: - Never (never!!) include stuff in header files except where we need access to structures' contents (like derived objects). - Added prototypes and proper formating in many files. - The #include order in *all* *.c files is as follows: #include "config.h" #include <system stuff> #include <gtk/gtk.h> #include "apptypes.h" #include "gimp stuff" #include "libgimp stuff" #include "libgimp/gimpintl.h" By following this scheme we can easily see a file's dependencies from it's #include's and can grep for the inclusion to find out where a file is used. * tools/pdbgen/app.pl: changed to follow the include scheme above. * libgimp/Makefile.am * libgimp/gimpuitypes.h: new file, included from libgimp/gimpui.h and from app/apptypes.h. * libgimp/gimpcolorbutton.[ch] * libgimp/gimpdialog.[ch] * libgimp/gimphelpui.[ch] * libgimp/gimpparasite.[ch] * libgimp/gimppatheditor.[ch] * libgimp/gimpprotocol.c * libgimp/gimpquerybox.[ch] * libgimp/gimpsizeentry.[ch] * libgimp/gimptypes.h * libgimp/gimpui.h * libgimp/gimpunit.h * libgimp/gimpunitmenu.[ch] * libgimp/gimpwidgets.[ch]: changed accordingly. * plug-ins/FractalExplorer/Dialogs.c * plug-ins/gdyntext/message_window.c * plug-ins/imagemap/imap_default_dialog.c * plug-ins/imagemap/imap_file.c: these files used to include "libgimp/gimpui.h" without including "libgimp/gimp.h". This is no longer possible because the libgimpui headers don't inlcude "libgimp/gimpunit.h" any more.
2000-12-29 23:22:01 +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*/)
typedef struct
{
GtkWidget *dialog;
GtkWidget *anim_area;
PangoLayout *layout;
gint n_authors;
gint shuffle[G_N_ELEMENTS (authors) - 1]; /* NULL terminated */
guint timer;
gint index;
gint animstep;
gint textrange[2];
gint state;
gboolean visible;
} GimpAboutDialog;
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);
#ifdef GIMP_UNSTABLE
static void about_dialog_add_unstable_message
(GtkWidget *vbox);
#endif /* GIMP_UNSTABLE */
generate app/file/Makefile 2001-10-25 Michael Natterer <mitch@gimp.org> * configure.in: generate app/file/Makefile * app/Makefile.am * app/file-open.[ch] * app/file-save.[ch] * app/file-utils.[ch]: removed... * app/file/Makefile.am * app/file/file-open.[ch] * app/file/file-save.[ch] * app/file/file-utils.[ch]: ...and added here. * app/gui/file-commands.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * tools/pdbgen/pdb/fileops.pdb: changed includes accordingly. * app/app_procs.[ch]: removed app_exit_finish() and app_exit_finish_done() from the public API, call gtk_main() here, pass "no_data" to gimp_new() and "restore_session" to gui_restore(). * app/main.c: removed global variable "double_speed", don't call gtk_main() in main.c. Added some missing log domains. * app/appenv.h: removed "double_speed". * app/core/gimp.[ch]: added "gboolean no_data" property which must be passed to gimp_new(). * app/display/gimpdisplay-foreach.[ch]: added gdisplays_set_busy() and gdisplays_unset_busy(). * app/gui/about-dialog.c: don't include "appenv.h", declare "double_speed" extern. * app/gui/brush-select.[ch] * app/gui/gradient-select.[ch] * app/gui/palette-select.[ch] * app/gui/pattern-select.[ch]: made the list of dialogs and the global selection dialogs private. Added functions which get a dialog by PDB callback_name. Pass a "Gimp" and the callback_name to the constructors. Don't include "app_procs.h" for "the_gimp" and "appenv.h" for "no_data" any more. Use the passed "Gimp" instead and look at gimp->no_data. * app/gui/toolbox.[ch]: pass a "Gimp" to the constructor. * app/gui/gui.[ch]: use the new gdisplays_[un]set_busy() functions, use the passed "Gimp" all over the place, don't include "appenv.h" and "app_procs.h". gui_really_quit_dialog() takes a "quit_func" callback now and calls it instead of calling app_exit_finish() (which is now private) directly. * app/gui/convert-dialog.c * app/gui/dialogs-constructors.c * app/gui/palette-import-dialog.c * tools/pdbgen/pdb/brush_select.pdb * tools/pdbgen/pdb/gradient_select.pdb * tools/pdbgen/pdb/pattern_select.pdb: changed accordingly. * app/pdb/brush_select_cmds.c * app/pdb/fileops_cmds.c * app/pdb/gradient_select_cmds.c * app/pdb/pattern_select_cmds.c: regenerated. 2001-10-25 Michael Natterer <mitch@gimp.org> * POTFILES.in: app/file-*.c -> app/file/file-*.c
2001-10-25 21:30:01 +08:00
GtkWidget *
about_dialog_create (GimpContext *context)
1997-11-25 06:05:25 +08:00
{
2012-02-07 21:06:12 +08:00
static GimpAboutDialog dialog;
g_return_val_if_fail (GIMP_IS_CONTEXT (context), NULL);
2012-02-07 21:06:12 +08:00
if (! dialog.dialog)
{
GtkWidget *widget;
GtkWidget *container;
GdkPixbuf *pixbuf;
GList *children;
gchar *copyright;
2012-02-07 21:06:12 +08:00
dialog.n_authors = G_N_ELEMENTS (authors) - 1;
pixbuf = about_dialog_load_logo ();
2010-09-30 04:26:02 +08:00
copyright = g_strdup_printf (GIMP_COPYRIGHT, GIMP_GIT_LAST_COMMIT_YEAR);
widget = g_object_new (GTK_TYPE_ABOUT_DIALOG,
"role", "gimp-about",
"window-position", GTK_WIN_POS_CENTER,
"title", _("About GIMP"),
"program-name", GIMP_ACRONYM,
"version", GIMP_VERSION,
"copyright", copyright,
"comments", GIMP_NAME,
"license", GIMP_LICENSE,
"wrap-license", TRUE,
"logo", pixbuf,
"website", "http://www.gimp.org/",
"website-label", _("Visit the GIMP website"),
"authors", authors,
"artists", artists,
"documenters", documenters,
2010-09-30 04:26:02 +08:00
/* Translators: insert your names here,
separated by newline */
"translator-credits", _("translator-credits"),
NULL);
if (pixbuf)
g_object_unref (pixbuf);
2010-09-30 04:26:02 +08:00
g_free (copyright);
2012-02-07 21:06:12 +08:00
dialog.dialog = widget;
2012-02-07 21:06:12 +08:00
g_object_add_weak_pointer (G_OBJECT (widget), (gpointer) &dialog.dialog);
g_signal_connect (widget, "response",
G_CALLBACK (gtk_widget_destroy),
NULL);
g_signal_connect (widget, "map",
G_CALLBACK (about_dialog_map),
2012-02-07 21:06:12 +08:00
&dialog);
g_signal_connect (widget, "unmap",
G_CALLBACK (about_dialog_unmap),
2012-02-07 21:06:12 +08:00
&dialog);
/* kids, don't try this at home! */
container = gtk_dialog_get_content_area (GTK_DIALOG (widget));
children = gtk_container_get_children (GTK_CONTAINER (container));
if (GTK_IS_BOX (children->data))
{
2012-02-07 21:06:12 +08:00
about_dialog_add_animation (children->data, &dialog);
#ifdef GIMP_UNSTABLE
about_dialog_add_unstable_message (children->data);
#endif /* GIMP_UNSTABLE */
}
else
g_warning ("%s: ooops, no box in this container?", G_STRLOC);
g_list_free (children);
}
2012-02-07 21:06:12 +08:00
gtk_window_present (GTK_WINDOW (dialog.dialog));
2012-02-07 21:06:12 +08:00
return dialog.dialog;
}
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;
about_dialog_reshuffle (dialog);
dialog->timer = g_timeout_add (800, about_dialog_timer, dialog);
1997-11-25 06:05:25 +08:00
}
}
1997-11-25 06:05:25 +08:00
static void
about_dialog_unmap (GtkWidget *widget,
GimpAboutDialog *dialog)
{
if (dialog->timer)
1997-11-25 06:05:25 +08:00
{
g_source_remove (dialog->timer);
dialog->timer = 0;
1997-11-25 06:05:25 +08:00
}
}
static GdkPixbuf *
about_dialog_load_logo (void)
1997-11-25 06:05:25 +08:00
{
GdkPixbuf *pixbuf;
gchar *filename;
1997-11-25 06:05:25 +08:00
filename = g_build_filename (gimp_data_directory (), "images",
#ifdef GIMP_UNSTABLE
"gimp-devel-logo.png",
#else
"gimp-logo.png",
#endif
NULL);
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
g_free (filename);
return pixbuf;
}
static void
about_dialog_add_animation (GtkWidget *vbox,
GimpAboutDialog *dialog)
{
gint height;
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);
dialog->layout = gtk_widget_create_pango_layout (dialog->anim_area, NULL);
g_object_weak_ref (G_OBJECT (dialog->anim_area),
(GWeakNotify) g_object_unref, dialog->layout);
pango_layout_get_pixel_size (dialog->layout, NULL, &height);
gtk_widget_set_size_request (dialog->anim_area, -1, 2 * height);
g_signal_connect (dialog->anim_area, "expose-event",
G_CALLBACK (about_dialog_anim_expose),
dialog);
}
static void
about_dialog_reshuffle (GimpAboutDialog *dialog)
1997-11-25 06:05:25 +08:00
{
GRand *gr = g_rand_new ();
gint i;
for (i = 0; i < dialog->n_authors; i++)
dialog->shuffle[i] = i;
for (i = START_INDEX; i < dialog->n_authors; i++)
{
gint j = g_rand_int_range (gr, START_INDEX, dialog->n_authors);
if (i != j)
{
gint t;
t = dialog->shuffle[j];
dialog->shuffle[j] = dialog->shuffle[i];
dialog->shuffle[i] = t;
}
}
g_rand_free (gr);
}
static gboolean
about_dialog_anim_expose (GtkWidget *widget,
GdkEventExpose *event,
GimpAboutDialog *dialog)
{
GtkStyle *style = gtk_widget_get_style (widget);
cairo_t *cr;
GtkAllocation allocation;
gint x, y;
gint width, height;
if (! dialog->visible)
return FALSE;
cr = gdk_cairo_create (event->window);
gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
gtk_widget_get_allocation (widget, &allocation);
pango_layout_get_pixel_size (dialog->layout, &width, &height);
x = (allocation.width - width) / 2;
y = (allocation.height - height) / 2;
if (dialog->textrange[1] > 0)
{
GdkRegion *covered_region;
covered_region = gdk_pango_layout_get_clip_region (dialog->layout,
x, y,
dialog->textrange, 1);
gdk_region_intersect (covered_region, event->region);
gdk_cairo_region (cr, covered_region);
cairo_clip (cr);
gdk_region_destroy (covered_region);
}
cairo_move_to (cr, x, y);
pango_cairo_show_layout (cr, dialog->layout);
cairo_destroy (cr);
return FALSE;
}
static gchar *
insert_spacers (const gchar *string)
{
GString *str = g_string_new (NULL);
gchar *normalized;
gchar *ptr;
gunichar unichr;
normalized = g_utf8_normalize (string, -1, G_NORMALIZE_DEFAULT_COMPOSE);
ptr = normalized;
while ((unichr = g_utf8_get_char (ptr)))
{
g_string_append_unichar (str, unichr);
g_string_append_unichar (str, 0x200b); /* ZERO WIDTH SPACE */
ptr = g_utf8_next_char (ptr);
}
added "wm_name", "wm_class", "display_name" and "monitor_number" to the 2003-11-07 Michael Natterer <mitch@gimp.org> * libgimpbase/gimpprotocol.[ch]: added "wm_name", "wm_class", "display_name" and "monitor_number" to the GPConfig message. Increased protocol version number. * libgimp/gimp.[ch] (gimp_config): read them from the GPConfig message and remember them. Added public accessors for the new config values. * libgimp/gimpui.c (gimp_ui_init): pass wm_name and wm_class to gtk_init() and export the display/screen to use to the environment. * app/core/gimp.[ch]: added vtable entries to get the values from the GUI. * app/gui/gui-vtable.c: implement the vtable entries. * app/plug-in/plug-in-run.c: fill in the GPConfig values using the new Gimp vtable functions. * app/display/gimpdisplayshell-layer-select.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor-commands.c * app/gui/gradients-commands.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/splash.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tips-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c * app/widgets/gimpdock.c * app/widgets/gimperrorconsole.c * app/widgets/gimptexteditor.c * app/widgets/gimptoolbox.c * app/widgets/gimpviewabledialog.[ch] * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c * plug-ins/helpbrowser/dialog.c * plug-ins/ifscompose/ifscompose.c: replaced all calls to gtk_window_set_wmclass() by gtk_window_set_role() and all "const gchar *wmclass_name" parameters by "const gchar *role". Cleaned up the window role strings.
2003-11-08 01:29:02 +08:00
g_free (normalized);
added "wm_name", "wm_class", "display_name" and "monitor_number" to the 2003-11-07 Michael Natterer <mitch@gimp.org> * libgimpbase/gimpprotocol.[ch]: added "wm_name", "wm_class", "display_name" and "monitor_number" to the GPConfig message. Increased protocol version number. * libgimp/gimp.[ch] (gimp_config): read them from the GPConfig message and remember them. Added public accessors for the new config values. * libgimp/gimpui.c (gimp_ui_init): pass wm_name and wm_class to gtk_init() and export the display/screen to use to the environment. * app/core/gimp.[ch]: added vtable entries to get the values from the GUI. * app/gui/gui-vtable.c: implement the vtable entries. * app/plug-in/plug-in-run.c: fill in the GPConfig values using the new Gimp vtable functions. * app/display/gimpdisplayshell-layer-select.c * app/display/gimpdisplayshell.c * app/gui/about-dialog.c * app/gui/channels-commands.c * app/gui/color-notebook.c * app/gui/convert-dialog.c * app/gui/file-dialog-utils.[ch] * app/gui/file-new-dialog.c * app/gui/file-open-dialog.c * app/gui/file-save-dialog.c * app/gui/gradient-editor-commands.c * app/gui/gradients-commands.c * app/gui/grid-dialog.c * app/gui/image-commands.c * app/gui/info-dialog.[ch] * app/gui/info-window.c * app/gui/layers-commands.c * app/gui/module-browser.c * app/gui/offset-dialog.c * app/gui/palette-import-dialog.c * app/gui/qmask-commands.c * app/gui/resize-dialog.c * app/gui/splash.c * app/gui/stroke-dialog.c * app/gui/templates-commands.c * app/gui/tips-dialog.c * app/gui/vectors-commands.c * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c * app/widgets/gimpdock.c * app/widgets/gimperrorconsole.c * app/widgets/gimptexteditor.c * app/widgets/gimptoolbox.c * app/widgets/gimpviewabledialog.[ch] * libgimpwidgets/gimpfileselection.c * libgimpwidgets/gimpquerybox.c * libgimpwidgets/gimpunitmenu.c * plug-ins/helpbrowser/dialog.c * plug-ins/ifscompose/ifscompose.c: replaced all calls to gtk_window_set_wmclass() by gtk_window_set_role() and all "const gchar *wmclass_name" parameters by "const gchar *role". Cleaned up the window role strings.
2003-11-08 01:29:02 +08:00
return g_string_free (str, FALSE);
}
static void inline
mix_colors (const GdkColor *start,
const GdkColor *end,
GdkColor *target,
gdouble pos)
{
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;
}
static void
decorate_text (GimpAboutDialog *dialog,
gint anim_type,
gdouble time)
{
GtkStyle *style = gtk_widget_get_style (dialog->anim_area);
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;
PangoAttribute *attr;
PangoRectangle irect = {0, 0, 0, 0};
PangoRectangle lrect = {0, 0, 0, 0};
GdkColor mix;
mix_colors (style->bg + GTK_STATE_NORMAL,
style->fg + GTK_STATE_NORMAL, &mix, time);
text = pango_layout_get_text (dialog->layout);
g_return_if_fail (text != NULL);
text_length = g_utf8_strlen (text, -1);
text_bytelen = strlen (text);
attrlist = pango_attr_list_new ();
dialog->textrange[0] = 0;
dialog->textrange[1] = text_bytelen;
switch (anim_type)
{
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;
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;
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;
case 3: /* letterwise Fade in */
ptr = text;
letter_count = 0;
cluster_start = 0;
while ((unichr = g_utf8_get_char (ptr)))
{
gint border = (text_length + 15) * time - 15;
gdouble pos;
if (letter_count < border)
pos = 0;
else if (letter_count > border + 15)
pos = 1;
else
pos = ((gdouble) (letter_count - border)) / 15;
mix_colors (style->fg + GTK_STATE_NORMAL,
style->bg + GTK_STATE_NORMAL,
&mix, pos);
ptr = g_utf8_next_char (ptr);
cluster_end = ptr - text;
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);
if (pos < 1.0)
dialog->textrange[1] = cluster_end;
letter_count++;
cluster_start = cluster_end;
}
break;
default:
g_printerr ("Unknown animation type %d\n", anim_type);
}
pango_layout_set_attributes (dialog->layout, attrlist);
pango_attr_list_unref (attrlist);
}
static gboolean
1997-11-25 06:05:25 +08:00
about_dialog_timer (gpointer data)
{
GimpAboutDialog *dialog = data;
gint timeout = 0;
1997-11-25 06:05:25 +08:00
if (dialog->animstep == 0)
{
gchar *text = NULL;
dialog->visible = TRUE;
switch (dialog->state)
{
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;
case 2:
if (! (dialog->index < dialog->n_authors))
dialog->index = 0;
text = insert_spacers (authors[dialog->shuffle[dialog->index]]);
dialog->index += 1;
break;
default:
g_return_val_if_reached (TRUE);
break;
}
g_return_val_if_fail (text != NULL, TRUE);
pango_layout_set_text (dialog->layout, text, -1);
pango_layout_set_attributes (dialog->layout, NULL);
1997-11-25 06:05:25 +08:00
g_free (text);
}
1997-11-25 06:05:25 +08:00
if (dialog->animstep < 16)
{
decorate_text (dialog, 2, ((gfloat) dialog->animstep) / 15.0);
}
else if (dialog->animstep == 16)
{
timeout = 800;
1997-11-25 06:05:25 +08:00
}
else if (dialog->animstep == 17)
{
timeout = 30;
}
else if (dialog->animstep < 33)
{
decorate_text (dialog, 1,
1.0 - ((gfloat) (dialog->animstep - 17)) / 15.0);
}
else if (dialog->animstep == 33)
{
dialog->visible = FALSE;
timeout = 300;
}
else
{
dialog->visible = FALSE;
dialog->animstep = -1;
timeout = 30;
}
dialog->animstep++;
1997-11-25 06:05:25 +08:00
gtk_widget_queue_draw (dialog->anim_area);
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
}
#ifdef GIMP_UNSTABLE
static void
about_dialog_add_unstable_message (GtkWidget *vbox)
{
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);
}
#endif /* GIMP_UNSTABLE */