2001-04-16 04:12:16 +08:00
|
|
|
/* The GIMP -- an 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 2 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, write to the Free Software
|
|
|
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#include <gtk/gtk.h>
|
|
|
|
|
2001-08-17 22:27:31 +08:00
|
|
|
#include "gui-types.h"
|
2001-04-16 04:12:16 +08:00
|
|
|
|
|
|
|
#include "splash.h"
|
|
|
|
|
2001-11-23 07:46:13 +08:00
|
|
|
#include "libgimpbase/gimpbase.h"
|
2001-04-16 04:12:16 +08:00
|
|
|
|
2001-11-23 07:46:13 +08:00
|
|
|
#include "libgimp/gimpintl.h"
|
2001-04-16 04:12:16 +08:00
|
|
|
|
|
|
|
|
2001-11-23 07:46:13 +08:00
|
|
|
#define DEFAULT_WIDTH 300
|
2001-04-16 04:12:16 +08:00
|
|
|
|
2002-05-16 22:13:20 +08:00
|
|
|
static GtkWidget *win_initstatus = NULL;
|
|
|
|
static GtkWidget *label1 = NULL;
|
|
|
|
static GtkWidget *label2 = NULL;
|
|
|
|
static GtkWidget *progress = NULL;
|
2001-04-16 04:12:16 +08:00
|
|
|
|
|
|
|
|
|
|
|
/* public functions */
|
|
|
|
|
|
|
|
void
|
2001-10-22 20:13:44 +08:00
|
|
|
splash_create (gboolean show_image)
|
2001-04-16 04:12:16 +08:00
|
|
|
{
|
2001-11-25 04:31:15 +08:00
|
|
|
GtkWidget *vbox;
|
2002-05-15 23:55:10 +08:00
|
|
|
GdkPixbuf *pixbuf = NULL;
|
2001-04-16 04:12:16 +08:00
|
|
|
|
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
2001-07-24 Michael Natterer <mitch@gimp.org>
Port to glib/gtk+ 2.0 episode I (every segfault has it's beginning)
* configure.in: require glib/gtk+ >= 1.3.7, commented out the
gtkxmhtml stuff.
From now on, you will need glib, pango, atk and gtk+ HEAD from CVS
to hack or use GIMP HEAD.
Beware, it crashes randomly :)
* app/core/Makefile.am
* app/core/gimpmarshal.list: new file plus rules to generate
gimpmarshal.[ch] from it.
* app/core/*
* app/tools/*
* app/widgets/*
* libgimpwidgets/*: started to use the glib object system. All
core/ objects are still gtk objects however. All signals are
created using g_signal_new(). There are many gtk+ artefacts left.
Finally, we will _not_ use the gtk_signal_foo() wrappers and
friends any more.
* app/colormaps.c
* app/devices.[ch]
* app/disp_callbacks.c
* app/errorconsole.c
* app/file-save.[ch]
* app/interface.c
* app/module_db.c
* app/nav_window.c
* app/ops_buttons.c
* app/scroll.c
* app/user_install.c
* app/gui/about-dialog.c
* app/gui/brush-editor.c
* app/gui/brushes-commands.c
* app/gui/color-notebook.c
* app/gui/colormap-dialog.c
* app/gui/dialogs-commands.c
* app/gui/dialogs-constructors.c
* app/gui/file-commands.c
* app/gui/file-dialog-utils.c
* app/gui/file-new-dialog.c
* app/gui/file-open-dialog.[ch]
* app/gui/file-save-dialog.c
* app/gui/gradient-editor.c
* app/gui/gradients-commands.c
* app/gui/image-commands.c
* app/gui/info-dialog.[ch]
* app/gui/layer-select.c
* app/gui/layers-commands.c
* app/gui/menus.c
* app/gui/offset-dialog.c
* app/gui/palette-editor.c
* app/gui/palettes-commands.c
* app/gui/patterns-commands.c
* app/gui/preferences-dialog.c
* app/gui/resize-dialog.[ch]
* app/gui/splash.c
* app/gui/tips-dialog.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c
* app/gui/tools-commands.c
* libgimp/gimpbrushmenu.c
* libgimp/gimpmenu.c
* libgimp/gimppatternmenu.c
* libgimp/gimpui.c
* libgimpbase/gimpenv.c: tons and tons of changes like "const
gchar*", switch from GdkDeviceInfo to GdkDevice (very incomplete
and currently disables), lots of s/gtk_signal/g_signal/,
removal/replacement of deprecated stuff,
s/GtkSignalFunc/GCallback/ and lots of small changes and fixes
while I was on it, zillions of warnings left...
* modules/Makefile.am: disabled the water color selector
temporarily (XInput issues).
* plug-ins/Makefile.am
* plug-ins/common/.cvsignore
* plug-ins/common/Makefile.am
* plug-ins/common/plugin-defs.pl: simply excluded all plug-ins
which did not build (including Script-Fu). They are trivial to
fix.
2001-07-25 05:27:11 +08:00
|
|
|
win_initstatus = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
|
|
|
gtk_window_set_type_hint (GTK_WINDOW (win_initstatus),
|
|
|
|
GDK_WINDOW_TYPE_HINT_DIALOG);
|
2001-04-16 04:12:16 +08:00
|
|
|
|
|
|
|
gtk_window_set_title (GTK_WINDOW (win_initstatus), _("GIMP Startup"));
|
|
|
|
gtk_window_set_wmclass (GTK_WINDOW (win_initstatus), "gimp_startup", "Gimp");
|
|
|
|
gtk_window_set_position (GTK_WINDOW (win_initstatus), GTK_WIN_POS_CENTER);
|
2002-05-15 23:55:10 +08:00
|
|
|
gtk_window_set_resizable (GTK_WINDOW (win_initstatus), FALSE);
|
2001-04-16 04:12:16 +08:00
|
|
|
|
2002-05-16 22:13:20 +08:00
|
|
|
g_signal_connect (G_OBJECT (win_initstatus), "delete_event",
|
|
|
|
G_CALLBACK (gtk_true), NULL);
|
|
|
|
|
2001-04-16 04:12:16 +08:00
|
|
|
vbox = gtk_vbox_new (FALSE, 4);
|
|
|
|
gtk_container_add (GTK_CONTAINER (win_initstatus), vbox);
|
2001-11-23 07:46:13 +08:00
|
|
|
gtk_widget_show (vbox);
|
2001-04-16 04:12:16 +08:00
|
|
|
|
2001-11-23 07:46:13 +08:00
|
|
|
if (show_image)
|
|
|
|
{
|
|
|
|
gchar *filename;
|
|
|
|
|
|
|
|
filename = g_build_filename (gimp_data_directory (),
|
2002-05-15 23:55:10 +08:00
|
|
|
"images", "gimp_splash.png", NULL);
|
|
|
|
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
|
2001-11-23 07:46:13 +08:00
|
|
|
g_free (filename);
|
|
|
|
|
2002-05-15 23:55:10 +08:00
|
|
|
if (pixbuf)
|
2001-11-23 07:46:13 +08:00
|
|
|
{
|
|
|
|
GtkWidget *align;
|
|
|
|
GtkWidget *image;
|
|
|
|
|
2002-05-15 23:55:10 +08:00
|
|
|
image = gtk_image_new_from_pixbuf (pixbuf);
|
|
|
|
g_object_unref (pixbuf);
|
2001-11-23 07:46:13 +08:00
|
|
|
|
|
|
|
align = gtk_alignment_new (0.5, 0.5, 1.0, 1.0);
|
|
|
|
gtk_box_pack_start (GTK_BOX (vbox), align, FALSE, TRUE, 0);
|
|
|
|
gtk_widget_show (align);
|
|
|
|
|
|
|
|
gtk_container_add (GTK_CONTAINER (align), image);
|
|
|
|
gtk_widget_show (image);
|
|
|
|
}
|
|
|
|
}
|
2001-04-16 04:12:16 +08:00
|
|
|
|
2002-05-15 23:55:10 +08:00
|
|
|
if (!pixbuf)
|
2001-11-23 07:46:13 +08:00
|
|
|
{
|
|
|
|
GtkWidget *line;
|
|
|
|
|
|
|
|
label1 = gtk_label_new (_("The GIMP"));
|
|
|
|
gtk_box_pack_start_defaults (GTK_BOX (vbox), label1);
|
|
|
|
gtk_widget_show (label1);
|
|
|
|
|
|
|
|
label2 = gtk_label_new (GIMP_VERSION);
|
|
|
|
gtk_box_pack_start_defaults (GTK_BOX (vbox), label2);
|
|
|
|
gtk_widget_show (label2);
|
|
|
|
|
|
|
|
line = gtk_hseparator_new ();
|
|
|
|
gtk_box_pack_start_defaults (GTK_BOX (vbox), line);
|
|
|
|
gtk_widget_show (line);
|
2002-05-15 23:55:10 +08:00
|
|
|
|
|
|
|
gtk_widget_set_size_request (win_initstatus, DEFAULT_WIDTH, -1);
|
2001-11-23 07:46:13 +08:00
|
|
|
}
|
2001-04-16 04:12:16 +08:00
|
|
|
|
|
|
|
label1 = gtk_label_new ("");
|
|
|
|
gtk_box_pack_start_defaults (GTK_BOX (vbox), label1);
|
2001-11-23 07:46:13 +08:00
|
|
|
gtk_widget_show (label1);
|
|
|
|
|
2001-04-16 04:12:16 +08:00
|
|
|
label2 = gtk_label_new ("");
|
|
|
|
gtk_box_pack_start_defaults (GTK_BOX (vbox), label2);
|
2001-11-23 07:46:13 +08:00
|
|
|
gtk_widget_show (label2);
|
2001-04-16 04:12:16 +08:00
|
|
|
|
2001-09-03 21:13:48 +08:00
|
|
|
progress = gtk_progress_bar_new ();
|
|
|
|
gtk_box_pack_start_defaults (GTK_BOX (vbox), progress);
|
|
|
|
gtk_widget_show (progress);
|
2001-04-16 04:12:16 +08:00
|
|
|
|
2001-09-03 21:13:48 +08:00
|
|
|
gtk_widget_show (win_initstatus);
|
2001-04-16 04:12:16 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
splash_destroy (void)
|
|
|
|
{
|
|
|
|
if (win_initstatus)
|
|
|
|
{
|
|
|
|
gtk_widget_destroy (win_initstatus);
|
2001-11-23 07:46:13 +08:00
|
|
|
win_initstatus = NULL;
|
2001-04-16 04:12:16 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
splash_update (const gchar *text1,
|
|
|
|
const gchar *text2,
|
|
|
|
gdouble percentage)
|
|
|
|
{
|
2001-11-25 04:31:15 +08:00
|
|
|
if (!win_initstatus)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if (text1)
|
|
|
|
gtk_label_set_text (GTK_LABEL (label1), text1);
|
|
|
|
|
|
|
|
if (text2)
|
|
|
|
gtk_label_set_text (GTK_LABEL (label2), text2);
|
|
|
|
|
2001-12-29 21:26:29 +08:00
|
|
|
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress),
|
|
|
|
CLAMP (percentage, 0.0, 1.0));
|
2001-11-25 04:31:15 +08:00
|
|
|
|
|
|
|
while (gtk_events_pending ())
|
|
|
|
gtk_main_iteration ();
|
2001-04-16 04:12:16 +08:00
|
|
|
}
|