splash image for GIMP 2.0 by Jimmac.
2004-03-15 Sven Neumann <sven@gimp.org> * data/images/gimp_splash.png: splash image for GIMP 2.0 by Jimmac. * app/gui/splash.[ch]: draw the text on the splash image, not below it. * app/app_procs.[ch] * app/gui/gui.[ch] * app/main.c * docs/gimp.1.in: dropped support for the --no-splash-image command-line option (not to be confused with --no-splash). It was never very useful and makes even less sense in times where startup notification is available.
This commit is contained in:

committed by
Sven Neumann

parent
96285dc8f5
commit
1951ad2146
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2004-03-15 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* data/images/gimp_splash.png: splash image for GIMP 2.0 by Jimmac.
|
||||
|
||||
* app/gui/splash.[ch]: draw the text on the splash image, not
|
||||
below it.
|
||||
|
||||
* app/app_procs.[ch]
|
||||
* app/gui/gui.[ch]
|
||||
* app/main.c
|
||||
* docs/gimp.1.in: dropped support for the --no-splash-image
|
||||
command-line option (not to be confused with --no-splash). It was
|
||||
never very useful and makes even less sense in times where startup
|
||||
notification is available.
|
||||
|
||||
2004-03-15 Simon Budig <simon@gimp.org>
|
||||
|
||||
* app/core/gimpimage.[ch]
|
||||
|
@ -89,7 +89,6 @@ app_run (const gchar *full_prog_name,
|
||||
gboolean no_data,
|
||||
gboolean no_fonts,
|
||||
gboolean no_splash,
|
||||
gboolean no_splash_image,
|
||||
gboolean be_verbose,
|
||||
gboolean use_shm,
|
||||
gboolean use_cpu_accel,
|
||||
@ -200,7 +199,7 @@ app_run (const gchar *full_prog_name,
|
||||
base_init (GIMP_BASE_CONFIG (gimp->config), use_cpu_accel);
|
||||
|
||||
if (! no_interface)
|
||||
update_status_func = gui_init (gimp, no_splash, no_splash_image);
|
||||
update_status_func = gui_init (gimp, no_splash);
|
||||
|
||||
if (! update_status_func)
|
||||
update_status_func = app_init_update_none;
|
||||
|
@ -39,7 +39,6 @@ void app_run (const gchar *full_prog_name,
|
||||
gboolean no_data,
|
||||
gboolean no_fonts,
|
||||
gboolean no_splash,
|
||||
gboolean no_splash_image,
|
||||
gboolean be_verbose,
|
||||
gboolean use_shm,
|
||||
gboolean use_cpu_accel,
|
||||
|
@ -216,8 +216,7 @@ gui_libs_init (gint *argc,
|
||||
|
||||
GimpInitStatusFunc
|
||||
gui_init (Gimp *gimp,
|
||||
gboolean no_splash,
|
||||
gboolean no_splash_image)
|
||||
gboolean no_splash)
|
||||
{
|
||||
GimpInitStatusFunc status_callback = NULL;
|
||||
GdkScreen *screen;
|
||||
@ -239,8 +238,7 @@ gui_init (Gimp *gimp,
|
||||
|
||||
if (! no_splash)
|
||||
{
|
||||
splash_create (! no_splash_image);
|
||||
|
||||
splash_create ();
|
||||
status_callback = splash_update;
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,7 @@ gboolean gui_libs_init (gint *argc,
|
||||
gchar ***argv);
|
||||
|
||||
GimpInitStatusFunc gui_init (Gimp *gimp,
|
||||
gboolean no_spash,
|
||||
gboolean no_splash_image);
|
||||
gboolean no_spash);
|
||||
void gui_post_init (Gimp *gimp);
|
||||
|
||||
|
||||
|
158
app/gui/splash.c
158
app/gui/splash.c
@ -31,31 +31,48 @@
|
||||
#include "gimp-intl.h"
|
||||
|
||||
|
||||
#define DEFAULT_WIDTH 300
|
||||
|
||||
static GtkWidget *splash = NULL;
|
||||
static GtkWidget *label1 = NULL;
|
||||
static GtkWidget *label2 = NULL;
|
||||
static GtkWidget *progress = NULL;
|
||||
static GtkWidget *splash = NULL;
|
||||
static PangoLayout *upper = NULL;
|
||||
static PangoLayout *lower = NULL;
|
||||
static GtkWidget *progress = NULL;
|
||||
static gint width = 0;
|
||||
static gint height = 0;
|
||||
|
||||
|
||||
static void splash_map (void);
|
||||
static void splash_map (void);
|
||||
static gboolean splash_area_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
GdkPixmap *pixmap);
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
void
|
||||
splash_create (gboolean show_image)
|
||||
splash_create (void)
|
||||
{
|
||||
GtkWidget *frame;
|
||||
GtkWidget *vbox;
|
||||
GdkPixbuf *pixbuf = NULL;
|
||||
GtkWidget *area;
|
||||
GdkPixbuf *pixbuf;
|
||||
GdkPixmap *pixmap;
|
||||
gchar *filename;
|
||||
|
||||
filename = g_build_filename (gimp_data_directory (),
|
||||
"images", "gimp_splash.png", NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
|
||||
g_free (filename);
|
||||
|
||||
if (! pixbuf)
|
||||
return;
|
||||
|
||||
width = gdk_pixbuf_get_width (pixbuf);
|
||||
height = gdk_pixbuf_get_height (pixbuf);
|
||||
|
||||
splash = g_object_new (GTK_TYPE_WINDOW,
|
||||
"type", GTK_WINDOW_TOPLEVEL,
|
||||
"type_hint", GDK_WINDOW_TYPE_HINT_SPLASHSCREEN,
|
||||
"title", _("GIMP Startup"),
|
||||
"window_position", GTK_WIN_POS_CENTER,
|
||||
"window_position", GTK_WIN_POS_CENTER,
|
||||
"resizable", FALSE,
|
||||
NULL);
|
||||
|
||||
@ -76,65 +93,36 @@ splash_create (gboolean show_image)
|
||||
gtk_container_add (GTK_CONTAINER (splash), frame);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
vbox = gtk_vbox_new (FALSE, 4);
|
||||
vbox = gtk_vbox_new (FALSE, 0);
|
||||
gtk_container_add (GTK_CONTAINER (frame), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
if (show_image)
|
||||
{
|
||||
gchar *filename;
|
||||
area = gtk_drawing_area_new ();
|
||||
gtk_box_pack_start_defaults (GTK_BOX (vbox), area);
|
||||
gtk_widget_show (area);
|
||||
|
||||
filename = g_build_filename (gimp_data_directory (),
|
||||
"images", "gimp_splash.png", NULL);
|
||||
pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
|
||||
g_free (filename);
|
||||
gtk_widget_set_size_request (area, width, height);
|
||||
|
||||
if (pixbuf)
|
||||
{
|
||||
GtkWidget *align;
|
||||
GtkWidget *image;
|
||||
gtk_widget_realize (area);
|
||||
pixmap = gdk_pixmap_new (area->window, width, height, -1);
|
||||
|
||||
image = gtk_image_new_from_pixbuf (pixbuf);
|
||||
g_object_unref (pixbuf);
|
||||
gdk_draw_pixbuf (pixmap, area->style->black_gc,
|
||||
pixbuf, 0, 0, 0, 0, width, height,
|
||||
GDK_RGB_DITHER_NORMAL, 0, 0);
|
||||
g_object_unref (pixbuf);
|
||||
|
||||
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);
|
||||
g_signal_connect (area, "expose_event",
|
||||
G_CALLBACK (splash_area_expose),
|
||||
pixmap);
|
||||
g_signal_connect_swapped (area, "destroy",
|
||||
G_CALLBACK (g_object_unref),
|
||||
pixmap);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (align), image);
|
||||
gtk_widget_show (image);
|
||||
}
|
||||
}
|
||||
|
||||
if (! pixbuf)
|
||||
{
|
||||
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);
|
||||
|
||||
gtk_widget_set_size_request (splash, DEFAULT_WIDTH, -1);
|
||||
}
|
||||
|
||||
label1 = gtk_label_new ("");
|
||||
gtk_box_pack_start_defaults (GTK_BOX (vbox), label1);
|
||||
gtk_widget_show (label1);
|
||||
|
||||
label2 = gtk_label_new ("");
|
||||
gtk_box_pack_start_defaults (GTK_BOX (vbox), label2);
|
||||
gtk_widget_show (label2);
|
||||
upper = gtk_widget_create_pango_layout (splash, "");
|
||||
lower = gtk_widget_create_pango_layout (splash, "");
|
||||
|
||||
progress = gtk_progress_bar_new ();
|
||||
gtk_box_pack_start_defaults (GTK_BOX (vbox), progress);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), progress, FALSE, FALSE, 0);
|
||||
gtk_widget_show (progress);
|
||||
|
||||
gtk_widget_show (splash);
|
||||
@ -147,6 +135,12 @@ splash_destroy (void)
|
||||
{
|
||||
gtk_widget_destroy (splash);
|
||||
splash = NULL;
|
||||
|
||||
g_object_unref (upper);
|
||||
upper = NULL;
|
||||
|
||||
g_object_unref (lower);
|
||||
lower = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
@ -159,14 +153,17 @@ splash_update (const gchar *text1,
|
||||
return;
|
||||
|
||||
if (text1)
|
||||
gtk_label_set_text (GTK_LABEL (label1), text1);
|
||||
pango_layout_set_text (upper, text1, -1);
|
||||
|
||||
if (text2)
|
||||
gtk_label_set_text (GTK_LABEL (label2), text2);
|
||||
pango_layout_set_text (lower, text2, -2);
|
||||
|
||||
gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (progress),
|
||||
CLAMP (percentage, 0.0, 1.0));
|
||||
|
||||
/* FIXME: It would be more effective to expose the text area only. */
|
||||
gtk_widget_queue_draw (splash);
|
||||
|
||||
while (gtk_events_pending ())
|
||||
gtk_main_iteration ();
|
||||
}
|
||||
@ -174,6 +171,44 @@ splash_update (const gchar *text1,
|
||||
|
||||
/* private functions */
|
||||
|
||||
static gboolean
|
||||
splash_area_expose (GtkWidget *widget,
|
||||
GdkEventExpose *event,
|
||||
GdkPixmap *pixmap)
|
||||
{
|
||||
GdkRectangle rect;
|
||||
GdkRectangle draw;
|
||||
gint x, y;
|
||||
|
||||
rect.x = (widget->allocation.width - width) / 2;
|
||||
rect.y = (widget->allocation.height - height) / 2;
|
||||
rect.width = width;
|
||||
rect.height = height;
|
||||
|
||||
if (gdk_rectangle_intersect (&rect, &event->area, &draw))
|
||||
{
|
||||
gdk_draw_drawable (widget->window,
|
||||
widget->style->black_gc,
|
||||
pixmap,
|
||||
draw.x - rect.x, draw.y - rect.y,
|
||||
draw.x, draw.y, draw.width, draw.height);
|
||||
}
|
||||
|
||||
pango_layout_get_pixel_size (upper, &x, &y);
|
||||
|
||||
x = (widget->allocation.width - x) / 2;
|
||||
y = widget->allocation.height - 2 * y - 16;
|
||||
gdk_draw_layout (widget->window, widget->style->black_gc, x, y, upper);
|
||||
|
||||
pango_layout_get_pixel_size (lower, &x, &y);
|
||||
|
||||
x = (widget->allocation.width - x) / 2;
|
||||
y = widget->allocation.height - y - 8;
|
||||
gdk_draw_layout (widget->window, widget->style->black_gc, x, y, lower);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void
|
||||
splash_map (void)
|
||||
{
|
||||
@ -182,4 +217,3 @@ splash_map (void)
|
||||
*/
|
||||
gtk_window_set_auto_startup_notification (TRUE);
|
||||
}
|
||||
|
||||
|
@ -20,7 +20,7 @@
|
||||
#define __SPLASH_H__
|
||||
|
||||
|
||||
void splash_create (gboolean show_image);
|
||||
void splash_create (void);
|
||||
void splash_destroy (void);
|
||||
|
||||
void splash_update (const gchar *label1,
|
||||
|
@ -101,7 +101,6 @@ main (int argc,
|
||||
gboolean no_data = FALSE;
|
||||
gboolean no_fonts = FALSE;
|
||||
gboolean no_splash = FALSE;
|
||||
gboolean no_splash_image = FALSE;
|
||||
gboolean be_verbose = FALSE;
|
||||
gboolean use_shm = FALSE;
|
||||
gboolean use_cpu_accel = TRUE;
|
||||
@ -306,12 +305,6 @@ main (int argc,
|
||||
no_splash = TRUE;
|
||||
argv[i] = NULL;
|
||||
}
|
||||
else if ((strcmp (argv[i], "--no-splash-image") == 0) ||
|
||||
(strcmp (argv[i], "-S") == 0))
|
||||
{
|
||||
no_splash_image = TRUE;
|
||||
argv[i] = NULL;
|
||||
}
|
||||
else if (strcmp (argv[i], "--verbose") == 0)
|
||||
{
|
||||
be_verbose = TRUE;
|
||||
@ -478,7 +471,6 @@ main (int argc,
|
||||
no_data,
|
||||
no_fonts,
|
||||
no_splash,
|
||||
no_splash_image,
|
||||
be_verbose,
|
||||
use_shm,
|
||||
use_cpu_accel,
|
||||
@ -516,7 +508,6 @@ gimp_show_help (const gchar *progname)
|
||||
g_print (_(" -i, --no-interface Run without a user interface.\n"));
|
||||
g_print (_(" --display <display> Use the designated X display.\n"));
|
||||
g_print (_(" -s, --no-splash Do not show the startup window.\n"));
|
||||
g_print (_(" -S, --no-splash-image Do not add an image to the startup window.\n"));
|
||||
g_print (_(" --session <name> Use an alternate sessionrc file.\n"));
|
||||
g_print (_(" -g, --gimprc <gimprc> Use an alternate gimprc file.\n"));
|
||||
g_print (_(" --system-gimprc <gimprc> Use an alternate system gimprc file.\n"));
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 35 KiB After Width: | Height: | Size: 42 KiB |
@ -6,9 +6,9 @@ gimp - an image manipulation and paint program.
|
||||
[\-h] [\-\-help] [-v] [\-\-version] [\-\-verbose] [\-\-no\-shm]
|
||||
[\-\-no\-cpu\-accel] [\-\-display \fIdisplay\fP] [\-d] [\-\-no\-data]
|
||||
[\-f] [\-\-no\-fonts] [\-i] [\-\-no\-interface] [\-s] [\-\-no\-splash]
|
||||
[\-S] [\-\-no\-splash\-image] [\-\-session \fI<name>\fP]
|
||||
[\-g] [\-\-gimprc \fI<gimprc>\fP] [\-\-system\-gimprc \fI<gimprc>\fP]
|
||||
[\-\-dump\-gimprc\fP] [\-\-console\-messages] [\-\-debug\-handlers]
|
||||
[\-\-session \fI<name>\fP] [\-g] [\-\-gimprc \fI<gimprc>\fP]
|
||||
[\-\-system\-gimprc \fI<gimprc>\fP] [\-\-dump\-gimprc\fP]
|
||||
[\-\-console\-messages] [\-\-debug\-handlers]
|
||||
[\-b] [\-\-batch \fI<commands>\fP]
|
||||
[\fIfilename\fP] ...
|
||||
|
||||
@ -71,9 +71,6 @@ Use the designated X display.
|
||||
.B \-s, \-\-no\-splash
|
||||
Do not show the splash screen.
|
||||
.TP 8
|
||||
.B \-S, \-\-no\-splash\-image
|
||||
Do not show the splash screen image as part of the splash screen.
|
||||
.TP 8
|
||||
.B \-\-session \fI<name>\fP
|
||||
Use a different sessionrc for this GIMP session. The given session
|
||||
name is appended to the default sessionrc filename.
|
||||
|
Reference in New Issue
Block a user