mirror of https://github.com/GNOME/gimp.git
app/gui/about-dialog.c draw text using PangoLayouts, now compiles with
2001-09-03 Sven Neumann <sven@gimp.org> * app/gui/about-dialog.c * app/gui/splash.c: draw text using PangoLayouts, now compiles with GDK_DISABLE_DEPRECATED being defined. * app/gui/authors.h * tools/authorsgen/authorsgen.pl * tools/authorsgen/contributors: converted to use UTF-8 strings.
This commit is contained in:
parent
1ccb029ead
commit
c739ef8929
12
ChangeLog
12
ChangeLog
|
@ -1,4 +1,14 @@
|
|||
2001-09-02 Michael Natterer <mitch@gimp.org>
|
||||
2001-09-03 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/gui/about-dialog.c
|
||||
* app/gui/splash.c: draw text using PangoLayouts, now compiles with
|
||||
GDK_DISABLE_DEPRECATED being defined.
|
||||
|
||||
* app/gui/authors.h
|
||||
* tools/authorsgen/authorsgen.pl
|
||||
* tools/authorsgen/contributors: converted to use UTF-8 strings.
|
||||
|
||||
2001-09-03 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* configure.in: added -DGDK_DISABLE_DEPRECATED.
|
||||
|
||||
|
|
|
@ -23,12 +23,6 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
|
@ -76,29 +70,30 @@ static void about_dialog_tool_drop (GtkWidget *widget,
|
|||
static gint about_dialog_timer (gpointer data);
|
||||
|
||||
|
||||
static GtkWidget *about_dialog = NULL;
|
||||
static GtkWidget *logo_area = NULL;
|
||||
static GtkWidget *scroll_area = NULL;
|
||||
static GdkPixmap *logo_pixmap = NULL;
|
||||
static GdkPixmap *scroll_pixmap = NULL;
|
||||
static guchar *dissolve_map = NULL;
|
||||
static gint dissolve_width;
|
||||
static gint dissolve_height;
|
||||
static gint logo_width = 0;
|
||||
static gint logo_height = 0;
|
||||
static gboolean do_animation = FALSE;
|
||||
static gboolean do_scrolling = FALSE;
|
||||
static gint scroll_state = 0;
|
||||
static gint frame = 0;
|
||||
static gint offset = 0;
|
||||
static gint timer = 0;
|
||||
static gint hadja_state = 0;
|
||||
static gchar **scroll_text = authors;
|
||||
static gint nscroll_texts = sizeof (authors) / sizeof (authors[0]);
|
||||
static gint scroll_text_widths[sizeof (authors) / sizeof (authors[0])];
|
||||
static gint cur_scroll_text = 0;
|
||||
static gint cur_scroll_index = 0;
|
||||
static gint shuffle_array[sizeof (authors) / sizeof (authors[0])];
|
||||
static GtkWidget *about_dialog = NULL;
|
||||
static GtkWidget *logo_area = NULL;
|
||||
static GtkWidget *scroll_area = NULL;
|
||||
static GdkPixmap *logo_pixmap = NULL;
|
||||
static GdkPixmap *scroll_pixmap = NULL;
|
||||
static PangoLayout *scroll_layout = NULL;
|
||||
static guchar *dissolve_map = NULL;
|
||||
static gint dissolve_width;
|
||||
static gint dissolve_height;
|
||||
static gint logo_width = 0;
|
||||
static gint logo_height = 0;
|
||||
static gboolean do_animation = FALSE;
|
||||
static gboolean do_scrolling = FALSE;
|
||||
static gint scroll_state = 0;
|
||||
static gint frame = 0;
|
||||
static gint offset = 0;
|
||||
static gint timer = 0;
|
||||
static gint hadja_state = 0;
|
||||
static gchar **scroll_text = authors;
|
||||
static gint nscroll_texts = G_N_ELEMENTS (authors);
|
||||
static gint scroll_text_widths[G_N_ELEMENTS (authors)];
|
||||
static gint cur_scroll_text = 0;
|
||||
static gint cur_scroll_index = 0;
|
||||
static gint shuffle_array[G_N_ELEMENTS (authors)];
|
||||
|
||||
|
||||
static gchar *drop_text[] =
|
||||
|
@ -112,11 +107,7 @@ static gchar *hadja_text[] =
|
|||
{
|
||||
"Hadjaha!",
|
||||
"Nej!",
|
||||
#ifndef GDK_USE_UTF8_MBS
|
||||
"Tvärtom!"
|
||||
#else
|
||||
"Tvärtom!"
|
||||
#endif
|
||||
};
|
||||
|
||||
GtkWidget *
|
||||
|
@ -126,11 +117,9 @@ about_dialog_create (void)
|
|||
GtkWidget *aboutframe;
|
||||
GtkWidget *label;
|
||||
GtkWidget *alignment;
|
||||
#if 0
|
||||
GtkStyle *style;
|
||||
GdkFont *font;
|
||||
#endif
|
||||
gint max_width;
|
||||
gint width;
|
||||
gint height;
|
||||
gint i;
|
||||
gchar *label_text;
|
||||
|
||||
|
@ -204,22 +193,6 @@ about_dialog_create (void)
|
|||
gtk_widget_realize (logo_area);
|
||||
gdk_window_set_background (logo_area->window, &logo_area->style->black);
|
||||
|
||||
/* this is a font, provide only one single font definition */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: font description
|
||||
#endif
|
||||
#if 0
|
||||
font = gdk_font_load (_("-*-helvetica-medium-r-normal--*-140-*-*-*-*-*-*"));
|
||||
if (font)
|
||||
{
|
||||
style = gtk_style_new ();
|
||||
gdk_font_unref (style->font);
|
||||
style->font = font;
|
||||
gdk_font_ref (style->font);
|
||||
gtk_widget_push_style (style);
|
||||
gtk_style_unref (style);
|
||||
}
|
||||
#endif
|
||||
label_text = g_strdup_printf (_("Version %s brought to you by"),
|
||||
GIMP_VERSION);
|
||||
label = gtk_label_new (label_text);
|
||||
|
@ -232,10 +205,6 @@ about_dialog_create (void)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
#if 0
|
||||
gtk_widget_pop_style ();
|
||||
#endif
|
||||
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, TRUE, 0);
|
||||
gtk_widget_show (alignment);
|
||||
|
@ -246,28 +215,33 @@ about_dialog_create (void)
|
|||
gtk_container_add (GTK_CONTAINER (alignment), aboutframe);
|
||||
gtk_widget_show (aboutframe);
|
||||
|
||||
scroll_layout = gtk_widget_create_pango_layout (aboutframe, NULL);
|
||||
g_object_weak_ref (G_OBJECT (aboutframe),
|
||||
(GWeakNotify) g_object_unref, scroll_layout);
|
||||
|
||||
max_width = 0;
|
||||
for (i = 0; i < nscroll_texts; i++)
|
||||
{
|
||||
scroll_text_widths[i] = gdk_string_width (aboutframe->style->font,
|
||||
scroll_text[i]);
|
||||
pango_layout_set_text (scroll_layout, scroll_text[i], -1);
|
||||
pango_layout_get_pixel_size (scroll_layout,
|
||||
&scroll_text_widths[i], &height);
|
||||
max_width = MAX (max_width, scroll_text_widths[i]);
|
||||
}
|
||||
for (i = 0; i < (sizeof (drop_text) / sizeof (drop_text[0])); i++)
|
||||
{
|
||||
max_width = MAX (max_width,
|
||||
gdk_string_width (aboutframe->style->font, drop_text[i]));
|
||||
pango_layout_set_text (scroll_layout, drop_text[i], -1);
|
||||
pango_layout_get_pixel_size (scroll_layout, &width, NULL);
|
||||
max_width = MAX (max_width, width);
|
||||
}
|
||||
for (i = 0; i < (sizeof (hadja_text) / sizeof (hadja_text[0])); i++)
|
||||
{
|
||||
max_width = MAX (max_width,
|
||||
gdk_string_width (aboutframe->style->font, hadja_text[i]));
|
||||
}
|
||||
pango_layout_set_text (scroll_layout, hadja_text[i], -1);
|
||||
pango_layout_get_pixel_size (scroll_layout, &width, NULL);
|
||||
max_width = MAX (max_width, width);
|
||||
}
|
||||
scroll_area = gtk_drawing_area_new ();
|
||||
gtk_drawing_area_size (GTK_DRAWING_AREA (scroll_area),
|
||||
max_width + 10,
|
||||
aboutframe->style->font->ascent +
|
||||
aboutframe->style->font->descent);
|
||||
max_width + 6, height + 1);
|
||||
gtk_widget_set_events (scroll_area, GDK_BUTTON_PRESS_MASK);
|
||||
gtk_container_add (GTK_CONTAINER (aboutframe), scroll_area);
|
||||
gtk_widget_show (scroll_area);
|
||||
|
@ -313,7 +287,10 @@ about_dialog_create (void)
|
|||
shuffle_array[i] = t;
|
||||
}
|
||||
}
|
||||
cur_scroll_text = rand() % nscroll_texts;
|
||||
cur_scroll_text = rand() % nscroll_texts;
|
||||
pango_layout_set_text (scroll_layout,
|
||||
scroll_text[cur_scroll_text], -1);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -531,19 +508,21 @@ about_dialog_key (GtkWidget *widget,
|
|||
if (hadja_state == 7)
|
||||
{
|
||||
scroll_text = hadja_text;
|
||||
nscroll_texts = sizeof (hadja_text) / sizeof (hadja_text[0]);
|
||||
nscroll_texts = G_N_ELEMENTS (hadja_text);
|
||||
|
||||
for (i = 0; i < nscroll_texts; i++)
|
||||
{
|
||||
shuffle_array[i] = i;
|
||||
scroll_text_widths[i] = gdk_string_width (scroll_area->style->font,
|
||||
scroll_text[i]);
|
||||
pango_layout_set_text (scroll_layout, scroll_text[i], -1);
|
||||
pango_layout_get_pixel_size (scroll_layout,
|
||||
&scroll_text_widths[i], NULL);
|
||||
}
|
||||
|
||||
scroll_state = 0;
|
||||
cur_scroll_index = 0;
|
||||
cur_scroll_text = 0;
|
||||
offset = 0;
|
||||
pango_layout_set_text (scroll_layout, scroll_text[cur_scroll_text], -1);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -611,19 +590,21 @@ about_dialog_tool_drop (GtkWidget *widget,
|
|||
gdk_drawable_unref (mask);
|
||||
|
||||
scroll_text = drop_text;
|
||||
nscroll_texts = sizeof (drop_text) / sizeof (drop_text[0]);
|
||||
nscroll_texts = G_N_ELEMENTS (drop_text);
|
||||
|
||||
for (i = 0; i < nscroll_texts; i++)
|
||||
{
|
||||
shuffle_array[i] = i;
|
||||
scroll_text_widths[i] = gdk_string_width (scroll_area->style->font,
|
||||
scroll_text[i]);
|
||||
pango_layout_set_text (scroll_layout, scroll_text[i], -1);
|
||||
pango_layout_get_pixel_size (scroll_layout,
|
||||
&scroll_text_widths[i], NULL);
|
||||
}
|
||||
|
||||
scroll_state = 0;
|
||||
cur_scroll_index = 0;
|
||||
cur_scroll_text = 0;
|
||||
offset = 0;
|
||||
pango_layout_set_text (scroll_layout, scroll_text[cur_scroll_text], -1);
|
||||
|
||||
double_speed = TRUE;
|
||||
}
|
||||
|
@ -698,7 +679,8 @@ about_dialog_timer (gpointer data)
|
|||
cur_scroll_index = 0;
|
||||
|
||||
cur_scroll_text = shuffle_array[cur_scroll_index];
|
||||
|
||||
pango_layout_set_text (scroll_layout,
|
||||
scroll_text[cur_scroll_text], -1);
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
|
@ -707,12 +689,10 @@ about_dialog_timer (gpointer data)
|
|||
TRUE, 0, 0,
|
||||
scroll_area->allocation.width,
|
||||
scroll_area->allocation.height);
|
||||
gdk_draw_string (scroll_pixmap,
|
||||
scroll_area->style->font,
|
||||
scroll_area->style->black_gc,
|
||||
scroll_area->allocation.width - offset,
|
||||
scroll_area->style->font->ascent,
|
||||
scroll_text[cur_scroll_text]);
|
||||
gdk_draw_layout (scroll_pixmap,
|
||||
scroll_area->style->black_gc,
|
||||
scroll_area->allocation.width - offset, 0,
|
||||
scroll_layout);
|
||||
gdk_draw_drawable (scroll_area->window,
|
||||
scroll_area->style->black_gc,
|
||||
scroll_pixmap, 0, 0, 0, 0,
|
||||
|
|
|
@ -59,11 +59,7 @@ static gchar *authors[] =
|
|||
"Pavel Grinfeld",
|
||||
"Michael Hammel",
|
||||
"Henrik Hansen",
|
||||
#ifndef GDK_USE_UTF8_MBS
|
||||
"Ville Hautamäki",
|
||||
#else
|
||||
"Ville Hautamäki",
|
||||
#endif
|
||||
"James Henstridge",
|
||||
"Eric Hernes",
|
||||
"David Hodson",
|
||||
|
@ -124,11 +120,7 @@ static gchar *authors[] =
|
|||
"Stephen Robert Norris",
|
||||
"Tim Newsome",
|
||||
"Erik Nygren",
|
||||
#ifndef GDK_USE_UTF8_MBS
|
||||
"Tomas Ögren",
|
||||
#else
|
||||
"Tomas Ögren",
|
||||
#endif
|
||||
"Miles O'Neal",
|
||||
"Thom van Os",
|
||||
"Garry R. Osgood",
|
||||
|
|
|
@ -23,12 +23,6 @@
|
|||
#include <string.h>
|
||||
#include <time.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
|
||||
|
@ -76,29 +70,30 @@ static void about_dialog_tool_drop (GtkWidget *widget,
|
|||
static gint about_dialog_timer (gpointer data);
|
||||
|
||||
|
||||
static GtkWidget *about_dialog = NULL;
|
||||
static GtkWidget *logo_area = NULL;
|
||||
static GtkWidget *scroll_area = NULL;
|
||||
static GdkPixmap *logo_pixmap = NULL;
|
||||
static GdkPixmap *scroll_pixmap = NULL;
|
||||
static guchar *dissolve_map = NULL;
|
||||
static gint dissolve_width;
|
||||
static gint dissolve_height;
|
||||
static gint logo_width = 0;
|
||||
static gint logo_height = 0;
|
||||
static gboolean do_animation = FALSE;
|
||||
static gboolean do_scrolling = FALSE;
|
||||
static gint scroll_state = 0;
|
||||
static gint frame = 0;
|
||||
static gint offset = 0;
|
||||
static gint timer = 0;
|
||||
static gint hadja_state = 0;
|
||||
static gchar **scroll_text = authors;
|
||||
static gint nscroll_texts = sizeof (authors) / sizeof (authors[0]);
|
||||
static gint scroll_text_widths[sizeof (authors) / sizeof (authors[0])];
|
||||
static gint cur_scroll_text = 0;
|
||||
static gint cur_scroll_index = 0;
|
||||
static gint shuffle_array[sizeof (authors) / sizeof (authors[0])];
|
||||
static GtkWidget *about_dialog = NULL;
|
||||
static GtkWidget *logo_area = NULL;
|
||||
static GtkWidget *scroll_area = NULL;
|
||||
static GdkPixmap *logo_pixmap = NULL;
|
||||
static GdkPixmap *scroll_pixmap = NULL;
|
||||
static PangoLayout *scroll_layout = NULL;
|
||||
static guchar *dissolve_map = NULL;
|
||||
static gint dissolve_width;
|
||||
static gint dissolve_height;
|
||||
static gint logo_width = 0;
|
||||
static gint logo_height = 0;
|
||||
static gboolean do_animation = FALSE;
|
||||
static gboolean do_scrolling = FALSE;
|
||||
static gint scroll_state = 0;
|
||||
static gint frame = 0;
|
||||
static gint offset = 0;
|
||||
static gint timer = 0;
|
||||
static gint hadja_state = 0;
|
||||
static gchar **scroll_text = authors;
|
||||
static gint nscroll_texts = G_N_ELEMENTS (authors);
|
||||
static gint scroll_text_widths[G_N_ELEMENTS (authors)];
|
||||
static gint cur_scroll_text = 0;
|
||||
static gint cur_scroll_index = 0;
|
||||
static gint shuffle_array[G_N_ELEMENTS (authors)];
|
||||
|
||||
|
||||
static gchar *drop_text[] =
|
||||
|
@ -112,11 +107,7 @@ static gchar *hadja_text[] =
|
|||
{
|
||||
"Hadjaha!",
|
||||
"Nej!",
|
||||
#ifndef GDK_USE_UTF8_MBS
|
||||
"Tvärtom!"
|
||||
#else
|
||||
"Tvärtom!"
|
||||
#endif
|
||||
};
|
||||
|
||||
GtkWidget *
|
||||
|
@ -126,11 +117,9 @@ about_dialog_create (void)
|
|||
GtkWidget *aboutframe;
|
||||
GtkWidget *label;
|
||||
GtkWidget *alignment;
|
||||
#if 0
|
||||
GtkStyle *style;
|
||||
GdkFont *font;
|
||||
#endif
|
||||
gint max_width;
|
||||
gint width;
|
||||
gint height;
|
||||
gint i;
|
||||
gchar *label_text;
|
||||
|
||||
|
@ -204,22 +193,6 @@ about_dialog_create (void)
|
|||
gtk_widget_realize (logo_area);
|
||||
gdk_window_set_background (logo_area->window, &logo_area->style->black);
|
||||
|
||||
/* this is a font, provide only one single font definition */
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: font description
|
||||
#endif
|
||||
#if 0
|
||||
font = gdk_font_load (_("-*-helvetica-medium-r-normal--*-140-*-*-*-*-*-*"));
|
||||
if (font)
|
||||
{
|
||||
style = gtk_style_new ();
|
||||
gdk_font_unref (style->font);
|
||||
style->font = font;
|
||||
gdk_font_ref (style->font);
|
||||
gtk_widget_push_style (style);
|
||||
gtk_style_unref (style);
|
||||
}
|
||||
#endif
|
||||
label_text = g_strdup_printf (_("Version %s brought to you by"),
|
||||
GIMP_VERSION);
|
||||
label = gtk_label_new (label_text);
|
||||
|
@ -232,10 +205,6 @@ about_dialog_create (void)
|
|||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
|
||||
gtk_widget_show (label);
|
||||
|
||||
#if 0
|
||||
gtk_widget_pop_style ();
|
||||
#endif
|
||||
|
||||
alignment = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, TRUE, 0);
|
||||
gtk_widget_show (alignment);
|
||||
|
@ -246,28 +215,33 @@ about_dialog_create (void)
|
|||
gtk_container_add (GTK_CONTAINER (alignment), aboutframe);
|
||||
gtk_widget_show (aboutframe);
|
||||
|
||||
scroll_layout = gtk_widget_create_pango_layout (aboutframe, NULL);
|
||||
g_object_weak_ref (G_OBJECT (aboutframe),
|
||||
(GWeakNotify) g_object_unref, scroll_layout);
|
||||
|
||||
max_width = 0;
|
||||
for (i = 0; i < nscroll_texts; i++)
|
||||
{
|
||||
scroll_text_widths[i] = gdk_string_width (aboutframe->style->font,
|
||||
scroll_text[i]);
|
||||
pango_layout_set_text (scroll_layout, scroll_text[i], -1);
|
||||
pango_layout_get_pixel_size (scroll_layout,
|
||||
&scroll_text_widths[i], &height);
|
||||
max_width = MAX (max_width, scroll_text_widths[i]);
|
||||
}
|
||||
for (i = 0; i < (sizeof (drop_text) / sizeof (drop_text[0])); i++)
|
||||
{
|
||||
max_width = MAX (max_width,
|
||||
gdk_string_width (aboutframe->style->font, drop_text[i]));
|
||||
pango_layout_set_text (scroll_layout, drop_text[i], -1);
|
||||
pango_layout_get_pixel_size (scroll_layout, &width, NULL);
|
||||
max_width = MAX (max_width, width);
|
||||
}
|
||||
for (i = 0; i < (sizeof (hadja_text) / sizeof (hadja_text[0])); i++)
|
||||
{
|
||||
max_width = MAX (max_width,
|
||||
gdk_string_width (aboutframe->style->font, hadja_text[i]));
|
||||
}
|
||||
pango_layout_set_text (scroll_layout, hadja_text[i], -1);
|
||||
pango_layout_get_pixel_size (scroll_layout, &width, NULL);
|
||||
max_width = MAX (max_width, width);
|
||||
}
|
||||
scroll_area = gtk_drawing_area_new ();
|
||||
gtk_drawing_area_size (GTK_DRAWING_AREA (scroll_area),
|
||||
max_width + 10,
|
||||
aboutframe->style->font->ascent +
|
||||
aboutframe->style->font->descent);
|
||||
max_width + 6, height + 1);
|
||||
gtk_widget_set_events (scroll_area, GDK_BUTTON_PRESS_MASK);
|
||||
gtk_container_add (GTK_CONTAINER (aboutframe), scroll_area);
|
||||
gtk_widget_show (scroll_area);
|
||||
|
@ -313,7 +287,10 @@ about_dialog_create (void)
|
|||
shuffle_array[i] = t;
|
||||
}
|
||||
}
|
||||
cur_scroll_text = rand() % nscroll_texts;
|
||||
cur_scroll_text = rand() % nscroll_texts;
|
||||
pango_layout_set_text (scroll_layout,
|
||||
scroll_text[cur_scroll_text], -1);
|
||||
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -531,19 +508,21 @@ about_dialog_key (GtkWidget *widget,
|
|||
if (hadja_state == 7)
|
||||
{
|
||||
scroll_text = hadja_text;
|
||||
nscroll_texts = sizeof (hadja_text) / sizeof (hadja_text[0]);
|
||||
nscroll_texts = G_N_ELEMENTS (hadja_text);
|
||||
|
||||
for (i = 0; i < nscroll_texts; i++)
|
||||
{
|
||||
shuffle_array[i] = i;
|
||||
scroll_text_widths[i] = gdk_string_width (scroll_area->style->font,
|
||||
scroll_text[i]);
|
||||
pango_layout_set_text (scroll_layout, scroll_text[i], -1);
|
||||
pango_layout_get_pixel_size (scroll_layout,
|
||||
&scroll_text_widths[i], NULL);
|
||||
}
|
||||
|
||||
scroll_state = 0;
|
||||
cur_scroll_index = 0;
|
||||
cur_scroll_text = 0;
|
||||
offset = 0;
|
||||
pango_layout_set_text (scroll_layout, scroll_text[cur_scroll_text], -1);
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
|
@ -611,19 +590,21 @@ about_dialog_tool_drop (GtkWidget *widget,
|
|||
gdk_drawable_unref (mask);
|
||||
|
||||
scroll_text = drop_text;
|
||||
nscroll_texts = sizeof (drop_text) / sizeof (drop_text[0]);
|
||||
nscroll_texts = G_N_ELEMENTS (drop_text);
|
||||
|
||||
for (i = 0; i < nscroll_texts; i++)
|
||||
{
|
||||
shuffle_array[i] = i;
|
||||
scroll_text_widths[i] = gdk_string_width (scroll_area->style->font,
|
||||
scroll_text[i]);
|
||||
pango_layout_set_text (scroll_layout, scroll_text[i], -1);
|
||||
pango_layout_get_pixel_size (scroll_layout,
|
||||
&scroll_text_widths[i], NULL);
|
||||
}
|
||||
|
||||
scroll_state = 0;
|
||||
cur_scroll_index = 0;
|
||||
cur_scroll_text = 0;
|
||||
offset = 0;
|
||||
pango_layout_set_text (scroll_layout, scroll_text[cur_scroll_text], -1);
|
||||
|
||||
double_speed = TRUE;
|
||||
}
|
||||
|
@ -698,7 +679,8 @@ about_dialog_timer (gpointer data)
|
|||
cur_scroll_index = 0;
|
||||
|
||||
cur_scroll_text = shuffle_array[cur_scroll_index];
|
||||
|
||||
pango_layout_set_text (scroll_layout,
|
||||
scroll_text[cur_scroll_text], -1);
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
|
@ -707,12 +689,10 @@ about_dialog_timer (gpointer data)
|
|||
TRUE, 0, 0,
|
||||
scroll_area->allocation.width,
|
||||
scroll_area->allocation.height);
|
||||
gdk_draw_string (scroll_pixmap,
|
||||
scroll_area->style->font,
|
||||
scroll_area->style->black_gc,
|
||||
scroll_area->allocation.width - offset,
|
||||
scroll_area->style->font->ascent,
|
||||
scroll_text[cur_scroll_text]);
|
||||
gdk_draw_layout (scroll_pixmap,
|
||||
scroll_area->style->black_gc,
|
||||
scroll_area->allocation.width - offset, 0,
|
||||
scroll_layout);
|
||||
gdk_draw_drawable (scroll_area->window,
|
||||
scroll_area->style->black_gc,
|
||||
scroll_pixmap, 0, 0, 0, 0,
|
||||
|
|
|
@ -59,11 +59,7 @@ static gchar *authors[] =
|
|||
"Pavel Grinfeld",
|
||||
"Michael Hammel",
|
||||
"Henrik Hansen",
|
||||
#ifndef GDK_USE_UTF8_MBS
|
||||
"Ville Hautamäki",
|
||||
#else
|
||||
"Ville Hautamäki",
|
||||
#endif
|
||||
"James Henstridge",
|
||||
"Eric Hernes",
|
||||
"David Hodson",
|
||||
|
@ -124,11 +120,7 @@ static gchar *authors[] =
|
|||
"Stephen Robert Norris",
|
||||
"Tim Newsome",
|
||||
"Erik Nygren",
|
||||
#ifndef GDK_USE_UTF8_MBS
|
||||
"Tomas Ögren",
|
||||
#else
|
||||
"Tomas Ögren",
|
||||
#endif
|
||||
"Miles O'Neal",
|
||||
"Thom van Os",
|
||||
"Garry R. Osgood",
|
||||
|
|
128
app/gui/splash.c
128
app/gui/splash.c
|
@ -21,12 +21,6 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#ifdef __GNUC__
|
||||
#warning FIXME: GDK_DISABLE_DEPRECATED
|
||||
#endif
|
||||
|
||||
#undef GDK_DISABLE_DEPRECATED
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "libgimpbase/gimpbase.h"
|
||||
|
@ -51,7 +45,6 @@ enum
|
|||
|
||||
#define LOGO_WIDTH_MIN 300
|
||||
#define LOGO_HEIGHT_MIN 110
|
||||
#define AUTHORS "Spencer Kimball & Peter Mattis"
|
||||
|
||||
|
||||
static gboolean splash_logo_load_size (GtkWidget *window);
|
||||
|
@ -60,20 +53,22 @@ static void splash_text_draw (GtkWidget *widget);
|
|||
static void splash_logo_expose (GtkWidget *widget);
|
||||
|
||||
|
||||
static gint splash_show_logo = SPLASH_SHOW_LOGO_NEVER;
|
||||
static gint splash_show_logo = SPLASH_SHOW_LOGO_NEVER;
|
||||
|
||||
static GtkWidget *logo_area = NULL;
|
||||
static GdkPixmap *logo_pixmap = NULL;
|
||||
static gint logo_width = 0;
|
||||
static gint logo_height = 0;
|
||||
static gint logo_area_width = 0;
|
||||
static gint logo_area_height = 0;
|
||||
static gint max_label_length = 1024;
|
||||
static GtkWidget *logo_area = NULL;
|
||||
static GdkPixmap *logo_pixmap = NULL;
|
||||
static gint logo_width = 0;
|
||||
static gint logo_height = 0;
|
||||
static gint logo_area_width = 0;
|
||||
static gint logo_area_height = 0;
|
||||
static PangoLayout *logo_layout = NULL;
|
||||
|
||||
static GtkWidget *win_initstatus = NULL;
|
||||
static GtkWidget *label1 = NULL;
|
||||
static GtkWidget *label2 = NULL;
|
||||
static GtkWidget *pbar = NULL;
|
||||
static gint max_label_length = 1024;
|
||||
|
||||
static GtkWidget *win_initstatus = NULL;
|
||||
static GtkWidget *label1 = NULL;
|
||||
static GtkWidget *label2 = NULL;
|
||||
static GtkWidget *progress = NULL;
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
@ -81,9 +76,10 @@ static GtkWidget *pbar = NULL;
|
|||
void
|
||||
splash_create (void)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *logo_hbox;
|
||||
GtkStyle *style;
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *logo_hbox;
|
||||
PangoFontMetrics metrics;
|
||||
PangoContext *context;
|
||||
|
||||
win_initstatus = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_type_hint (GTK_WINDOW (win_initstatus),
|
||||
|
@ -126,28 +122,33 @@ splash_create (void)
|
|||
label2 = gtk_label_new ("");
|
||||
gtk_box_pack_start_defaults (GTK_BOX (vbox), label2);
|
||||
|
||||
pbar = gtk_progress_bar_new ();
|
||||
gtk_box_pack_start_defaults (GTK_BOX (vbox), pbar);
|
||||
progress = gtk_progress_bar_new ();
|
||||
gtk_box_pack_start_defaults (GTK_BOX (vbox), progress);
|
||||
|
||||
gtk_widget_show (vbox);
|
||||
gtk_widget_show (logo_hbox);
|
||||
gtk_widget_show (logo_area);
|
||||
gtk_widget_show (label1);
|
||||
gtk_widget_show (label2);
|
||||
gtk_widget_show (pbar);
|
||||
|
||||
gtk_widget_show (win_initstatus);
|
||||
gtk_widget_show (progress);
|
||||
|
||||
/* This is a hack: we try to compute a good guess for the maximum
|
||||
* number of charcters that will fit into the splash-screen using
|
||||
* the default_font
|
||||
*/
|
||||
style = gtk_widget_get_style (win_initstatus);
|
||||
max_label_length = (0.8 * (gfloat) strlen (AUTHORS) *
|
||||
((gfloat) logo_area_width /
|
||||
(gfloat) gdk_string_width (style->font, AUTHORS)));
|
||||
context = gtk_widget_get_pango_context (label2);
|
||||
pango_context_get_metrics (context,
|
||||
label2->style->font_desc,
|
||||
pango_context_get_language (context),
|
||||
&metrics);
|
||||
max_label_length = (0.9 * (gdouble) logo_area_width /
|
||||
(gdouble) PANGO_PIXELS (metrics.approximate_char_width));
|
||||
|
||||
splash_text_draw (logo_area);
|
||||
logo_layout = gtk_widget_create_pango_layout (logo_area, NULL);
|
||||
g_object_weak_ref (G_OBJECT (win_initstatus),
|
||||
(GWeakNotify) g_object_unref, logo_layout);
|
||||
|
||||
gtk_widget_show (win_initstatus);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -159,7 +160,7 @@ splash_destroy (void)
|
|||
if (logo_pixmap != NULL)
|
||||
gdk_drawable_unref (logo_pixmap);
|
||||
|
||||
win_initstatus = label1 = label2 = pbar = logo_area = NULL;
|
||||
win_initstatus = label1 = label2 = progress = logo_area = NULL;
|
||||
logo_pixmap = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +193,7 @@ splash_update (const gchar *text1,
|
|||
|
||||
percentage = CLAMP (percentage, 0.0, 1.0);
|
||||
|
||||
gtk_progress_bar_update (GTK_PROGRESS_BAR (pbar), percentage);
|
||||
gtk_progress_bar_update (GTK_PROGRESS_BAR (progress), percentage);
|
||||
|
||||
while (gtk_events_pending ())
|
||||
gtk_main_iteration ();
|
||||
|
@ -296,7 +297,8 @@ splash_logo_load (void)
|
|||
}
|
||||
|
||||
gtk_widget_realize (win_initstatus);
|
||||
logo_pixmap = gdk_pixmap_new (win_initstatus->window, logo_width, logo_height,
|
||||
logo_pixmap = gdk_pixmap_new (win_initstatus->window,
|
||||
logo_width, logo_height,
|
||||
gtk_preview_get_visual ()->depth);
|
||||
gc = gdk_gc_new (logo_pixmap);
|
||||
gtk_preview_put (GTK_PREVIEW (preview),
|
||||
|
@ -317,55 +319,25 @@ splash_logo_load (void)
|
|||
static void
|
||||
splash_text_draw (GtkWidget *widget)
|
||||
{
|
||||
GdkFont *font;
|
||||
gint width;
|
||||
|
||||
/* this is a font, provide only one single font definition */
|
||||
font = gdk_font_load (_("-*-helvetica-bold-r-normal--*-140-*-*-*-*-*-*"));
|
||||
if (!font)
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
font = style->font;
|
||||
gdk_font_ref (font);
|
||||
}
|
||||
pango_layout_set_text (logo_layout, _("The GIMP"), -1);
|
||||
pango_layout_get_pixel_size (logo_layout, &width, NULL);
|
||||
|
||||
gdk_draw_string (widget->window,
|
||||
font,
|
||||
gdk_draw_layout (widget->window,
|
||||
widget->style->fg_gc[GTK_STATE_NORMAL],
|
||||
((logo_area_width - gdk_string_width (font, _("The GIMP"))) / 2),
|
||||
(0.25 * logo_area_height),
|
||||
_("The GIMP"));
|
||||
(logo_area_width - width) / 2,
|
||||
0.25 * logo_area_height,
|
||||
logo_layout);
|
||||
|
||||
gdk_font_unref (font);
|
||||
pango_layout_set_text (logo_layout, GIMP_VERSION, -1);
|
||||
pango_layout_get_pixel_size (logo_layout, &width, NULL);
|
||||
|
||||
/* this is a fontset, e.g. multiple comma-separated font definitions */
|
||||
font = gdk_fontset_load (_("-*-helvetica-bold-r-normal--*-120-*-*-*-*-*-*,*"));
|
||||
if (!font)
|
||||
{
|
||||
GtkStyle *style = gtk_widget_get_style (widget);
|
||||
font = style->font;
|
||||
gdk_font_ref (font);
|
||||
}
|
||||
|
||||
gdk_draw_string (widget->window,
|
||||
font,
|
||||
gdk_draw_layout (widget->window,
|
||||
widget->style->fg_gc[GTK_STATE_NORMAL],
|
||||
((logo_area_width - gdk_string_width (font, GIMP_VERSION)) / 2),
|
||||
(0.45 * logo_area_height),
|
||||
GIMP_VERSION);
|
||||
gdk_draw_string (widget->window,
|
||||
font,
|
||||
widget->style->fg_gc[GTK_STATE_NORMAL],
|
||||
((logo_area_width - gdk_string_width (font, _("brought to you by"))) / 2),
|
||||
(0.65 * logo_area_height),
|
||||
_("brought to you by"));
|
||||
gdk_draw_string (widget->window,
|
||||
font,
|
||||
widget->style->fg_gc[GTK_STATE_NORMAL],
|
||||
((logo_area_width - gdk_string_width (font, AUTHORS)) / 2),
|
||||
(0.80 * logo_area_height),
|
||||
AUTHORS);
|
||||
|
||||
gdk_font_unref (font);
|
||||
(logo_area_width - width) / 2,
|
||||
0.45 * logo_area_height,
|
||||
logo_layout);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -21,7 +21,7 @@ while (<INPUT>)
|
|||
{
|
||||
if (/(.{1,})\[(.{1,})\]/)
|
||||
{
|
||||
$iso{$1} = $2;
|
||||
$utf{$1} = $2;
|
||||
push (@contributors, $1);
|
||||
}
|
||||
else
|
||||
|
@ -33,20 +33,6 @@ while (<INPUT>)
|
|||
close (INPUT);
|
||||
|
||||
|
||||
open (ICONV, "iconv -f iso-8859-1 -t utf-8 contributors |")
|
||||
or die ("Call to iconv failed.");
|
||||
while (<ICONV>)
|
||||
{
|
||||
chomp;
|
||||
if (length ($_) and not (/^\#/) and (/(.{1,})\[(.{1,})\]/))
|
||||
{
|
||||
$utf{$1} = $2;
|
||||
}
|
||||
}
|
||||
close (ICONV);
|
||||
|
||||
|
||||
|
||||
open (AUTHORS, ">../../AUTHORS")
|
||||
or die ("Couldn't write to file '../../AUTHORS'.");
|
||||
print AUTHORS <<EOT;
|
||||
|
@ -89,13 +75,9 @@ static gchar *authors[] =
|
|||
EOT
|
||||
foreach $author (@contributors)
|
||||
{
|
||||
if ($iso{$author} and $utf{$author})
|
||||
if ($utf{$author})
|
||||
{
|
||||
print AUTHORS "#ifndef GDK_USE_UTF8_MBS\n";
|
||||
print AUTHORS " \"$iso{$author}\",\n";
|
||||
print AUTHORS "#else\n";
|
||||
print AUTHORS " \"$utf{$author}\",\n";
|
||||
print AUTHORS "#endif\n";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -105,5 +87,4 @@ foreach $author (@contributors)
|
|||
print AUTHORS "};\n";
|
||||
close (AUTHORS);
|
||||
|
||||
|
||||
exit;
|
||||
|
|
|
@ -5,10 +5,7 @@
|
|||
#
|
||||
# The format is one name per line in alphabetical order.
|
||||
# Names are 7bit ASCII. To include special characters, append
|
||||
# an ISO-8859-1 encoded string in brackets on the same line.
|
||||
# We might want to change to UTF-8 as soon as all ports use
|
||||
# GTK+-2.0. Right now the authorsgen script takes care of
|
||||
# converting to UTF-8.
|
||||
# an UTF-8 encoded string in brackets on the same line.
|
||||
#
|
||||
# Spencer Kimball and Peter Mattis are always listed separatly.
|
||||
#
|
||||
|
@ -65,7 +62,7 @@ Marcelo de Gomensoro Malheiros
|
|||
Pavel Grinfeld
|
||||
Michael Hammel
|
||||
Henrik Hansen
|
||||
Ville Hautamaki [Ville Hautamäki]
|
||||
Ville Hautamaki [Ville Hautamäki]
|
||||
James Henstridge
|
||||
Eric Hernes
|
||||
David Hodson
|
||||
|
@ -126,7 +123,7 @@ Sven Neumann
|
|||
Stephen Robert Norris
|
||||
Tim Newsome
|
||||
Erik Nygren
|
||||
Tomas Ogren [Tomas Ögren]
|
||||
Tomas Ogren [Tomas Ögren]
|
||||
Miles O'Neal
|
||||
Thom van Os
|
||||
Garry R. Osgood
|
||||
|
|
Loading…
Reference in New Issue