mirror of https://github.com/GNOME/gimp.git
if we cannot load the font we'd like to use, use the gtk+ default font.
* app/app_procs.c: if we cannot load the font we'd like to use, use the gtk+ default font. Fixes bug #8359. * app/about_dialog.c * app/install.c: properly ref/unref fonts * app/text_tool.[ch]: code cleanup (do not rely on TRUE being 1) * app/tips_dialog.c: code cleanup and less resizing --Sven
This commit is contained in:
parent
f41df6dcf9
commit
743516bfb0
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2000-04-06 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/app_procs.c: if we cannot load the font we'd like to use,
|
||||
use the gtk+ default font. Fixes bug #8359.
|
||||
|
||||
* app/about_dialog.c
|
||||
* app/install.c: properly ref/unref fonts
|
||||
|
||||
* app/text_tool.[ch]: code cleanup (do not rely on TRUE being 1)
|
||||
|
||||
* app/tips_dialog.c: code cleanup and less resizing
|
||||
|
||||
2000-04-05 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* plug-ins/common/ps.c: applied patch provided by Peter
|
||||
|
|
|
@ -246,6 +246,7 @@ about_dialog_create (gint timeout)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -246,6 +246,7 @@ about_dialog_create (gint timeout)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -33,13 +33,11 @@
|
|||
|
||||
#define TIPS_DIR_NAME "tips"
|
||||
|
||||
static gint tips_dialog_delete (GtkWidget *widget, GdkEvent *event,
|
||||
gpointer data);
|
||||
static void tips_dialog_hide (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_previous (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_next (GtkWidget *widget, gpointer data);
|
||||
static void tips_toggle_update (GtkWidget *widget, gpointer data);
|
||||
static void read_tips_file (gchar *filename);
|
||||
static void tips_dialog_destroy (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_previous (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_next (GtkWidget *widget, gpointer data);
|
||||
static void tips_toggle_update (GtkWidget *widget, gpointer data);
|
||||
static void read_tips_file (gchar *filename);
|
||||
|
||||
static GtkWidget *tips_dialog = NULL;
|
||||
static GtkWidget *tips_label;
|
||||
|
@ -51,18 +49,11 @@ void
|
|||
tips_dialog_create (void)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *hbox2;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *bbox;
|
||||
GtkWidget *vbox_bbox2;
|
||||
GtkWidget *bbox2;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *preview;
|
||||
GtkWidget *button_close;
|
||||
GtkWidget *button_next;
|
||||
GtkWidget *button_prev;
|
||||
GtkWidget *vbox_check;
|
||||
GtkWidget *button_check;
|
||||
GtkWidget *button;
|
||||
gchar *temp;
|
||||
guchar *utemp;
|
||||
guchar *src;
|
||||
|
@ -89,11 +80,14 @@ tips_dialog_create (void)
|
|||
gtk_window_set_wmclass (GTK_WINDOW (tips_dialog), "tip_of_the_day", "Gimp");
|
||||
gtk_window_set_title (GTK_WINDOW (tips_dialog), _("GIMP Tip of the Day"));
|
||||
gtk_window_set_position (GTK_WINDOW (tips_dialog), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_policy (GTK_WINDOW (tips_dialog), FALSE, FALSE, FALSE);
|
||||
gtk_window_set_policy (GTK_WINDOW (tips_dialog), FALSE, TRUE, FALSE);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (tips_dialog), "delete_event",
|
||||
GTK_SIGNAL_FUNC (tips_dialog_delete),
|
||||
GTK_SIGNAL_FUNC (tips_dialog_destroy),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (tips_dialog), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&tips_dialog);
|
||||
|
||||
/* destroy the tips window if the mainlevel gtk_main() function is left */
|
||||
gtk_quit_add_destroy (1, GTK_OBJECT (tips_dialog));
|
||||
|
@ -102,27 +96,20 @@ tips_dialog_create (void)
|
|||
gtk_container_add (GTK_CONTAINER (tips_dialog), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
hbox1 = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox1), 10);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox1, FALSE, TRUE, 0);
|
||||
gtk_widget_show (hbox1);
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox2), 10);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), hbox2, FALSE, TRUE, 0);
|
||||
gtk_widget_show (hbox2);
|
||||
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_box_pack_end (GTK_BOX (hbox2), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
vbox_bbox2 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox2), vbox_bbox2, FALSE, FALSE, 15);
|
||||
gtk_widget_show (vbox_bbox2);
|
||||
|
||||
bbox2 = gtk_hbox_new (TRUE, 5);
|
||||
gtk_box_pack_end (GTK_BOX (vbox_bbox2), bbox2, TRUE, FALSE, 0);
|
||||
gtk_widget_show(bbox2);
|
||||
tips_label = gtk_label_new (tips_text[last_tip]);
|
||||
gtk_label_set_justify (GTK_LABEL (tips_label), GTK_JUSTIFY_LEFT);
|
||||
gtk_misc_set_alignment (GTK_MISC (tips_label), 0.5, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), tips_label, TRUE, FALSE, 3);
|
||||
gtk_widget_show (tips_label);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
gtk_preview_size (GTK_PREVIEW (preview), wilber_width, wilber_height);
|
||||
|
@ -133,66 +120,68 @@ tips_dialog_create (void)
|
|||
dest = utemp;
|
||||
for (x = 0; x < wilber_width; x++)
|
||||
{
|
||||
HEADER_PIXEL(src, dest);
|
||||
HEADER_PIXEL (src, dest);
|
||||
dest += 3;
|
||||
}
|
||||
gtk_preview_draw_row (GTK_PREVIEW (preview), utemp,
|
||||
0, y, wilber_width);
|
||||
gtk_preview_draw_row (GTK_PREVIEW (preview), utemp, 0, y, wilber_width);
|
||||
}
|
||||
g_free(utemp);
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_end (GTK_BOX (hbox1), frame, FALSE, TRUE, 3);
|
||||
gtk_container_add (GTK_CONTAINER (frame), preview);
|
||||
gtk_widget_show (preview);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
tips_label = gtk_label_new (tips_text[last_tip]);
|
||||
gtk_label_set_justify (GTK_LABEL (tips_label), GTK_JUSTIFY_LEFT);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), tips_label, TRUE, TRUE, 3);
|
||||
gtk_widget_show (tips_label);
|
||||
|
||||
button_prev = gtk_button_new_with_label (_("Previous Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button_prev, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button_prev), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_previous),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox2), button_prev);
|
||||
gtk_widget_show (button_prev);
|
||||
|
||||
button_next = gtk_button_new_with_label (_("Next Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button_next, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button_next), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_next),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox2), button_next);
|
||||
gtk_widget_show (button_next);
|
||||
|
||||
button_close = gtk_button_new_with_label (_("Close"));
|
||||
GTK_WIDGET_SET_FLAGS (button_close, GTK_CAN_DEFAULT);
|
||||
gtk_window_set_default (GTK_WINDOW (tips_dialog), button_close);
|
||||
gtk_signal_connect (GTK_OBJECT (button_close), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_dialog_hide),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button_close);
|
||||
gtk_widget_show (button_close);
|
||||
|
||||
vbox_check = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), vbox_check, FALSE, TRUE, 0);
|
||||
gtk_widget_show (vbox_check);
|
||||
|
||||
button_check = gtk_check_button_new_with_label (_("Show tip next time"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_check),
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 15);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
button = gtk_check_button_new_with_label (_("Show tip next time"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
show_tips);
|
||||
gtk_signal_connect (GTK_OBJECT (button_check), "toggled",
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (tips_toggle_update),
|
||||
(gpointer) &show_tips);
|
||||
gtk_box_pack_start (GTK_BOX (vbox_check), button_check, TRUE, FALSE, 0);
|
||||
gtk_widget_show (button_check);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
old_show_tips = show_tips;
|
||||
|
||||
/* Connect the "F1" help key */
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("Close"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_window_set_default (GTK_WINDOW (tips_dialog), button);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_dialog_destroy),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 5);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("Previous Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_previous),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Next Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_next),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* Connect the "F1" help key */
|
||||
gimp_help_connect_help_accel (tips_dialog,
|
||||
gimp_standard_help_func,
|
||||
"dialogs/tip_of_the_day.html");
|
||||
|
@ -208,24 +197,14 @@ tips_dialog_create (void)
|
|||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
tips_dialog_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
tips_dialog_hide (NULL, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
tips_dialog_hide (GtkWidget *widget,
|
||||
gpointer data)
|
||||
tips_dialog_destroy (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GList *update = NULL; /* options that should be updated in .gimprc */
|
||||
GList *remove = NULL; /* options that should be commented out */
|
||||
|
||||
gtk_widget_hide (tips_dialog);
|
||||
gtk_widget_destroy (tips_dialog);
|
||||
|
||||
/* the last-shown-tip is now saved in sessionrc */
|
||||
|
||||
|
@ -254,7 +233,7 @@ tips_show_previous (GtkWidget *widget,
|
|||
|
||||
static void
|
||||
tips_show_next (GtkWidget *widget,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
last_tip++;
|
||||
|
||||
|
|
|
@ -127,7 +127,6 @@ static GtkWidget *resolution_page = NULL;
|
|||
static GtkWidget *continue_button = NULL;
|
||||
|
||||
static GtkStyle *title_style = NULL;
|
||||
static GdkFont *large_font = NULL;
|
||||
|
||||
static GtkStyle *page_style = NULL;
|
||||
static GdkColormap *colormap = NULL;
|
||||
|
@ -521,6 +520,7 @@ install_dialog_create (InstallCallback callback)
|
|||
GtkWidget *darea;
|
||||
GtkWidget *page;
|
||||
GtkWidget *sep;
|
||||
GdkFont *large_font;
|
||||
|
||||
dialog = install_dialog =
|
||||
gimp_dialog_new (_("GIMP User Installation"), "user_installation",
|
||||
|
@ -555,8 +555,9 @@ install_dialog_create (InstallCallback callback)
|
|||
page_style->text[GTK_STATE_NORMAL] = black_color;
|
||||
page_style->bg[GTK_STATE_NORMAL] = white_color;
|
||||
|
||||
gdk_font_unref (page_style->font);
|
||||
page_style->font = dialog->style->font;
|
||||
/*gdk_font_ref (page_style->font);*/
|
||||
gdk_font_ref (page_style->font);
|
||||
|
||||
/* B/Colored Style for the page title */
|
||||
title_style = gtk_style_copy (page_style);
|
||||
|
@ -570,8 +571,13 @@ install_dialog_create (InstallCallback callback)
|
|||
/* this is a fontset, e.g. multiple comma-separated font definitions */
|
||||
large_font = gdk_fontset_load (_("-*-helvetica-bold-r-normal-*-*-240-*-*-*-*-*-*,*"));
|
||||
|
||||
title_style->font = large_font;
|
||||
|
||||
if (large_font)
|
||||
{
|
||||
gdk_font_unref (title_style->font);
|
||||
title_style->font = large_font;
|
||||
gdk_font_ref (title_style->font);
|
||||
}
|
||||
|
||||
/* W/W GC for the corner */
|
||||
white_gc = gdk_gc_new (dialog->window);
|
||||
gdk_gc_set_foreground (white_gc, &white_color);
|
||||
|
|
|
@ -246,6 +246,7 @@ about_dialog_create (gint timeout)
|
|||
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);
|
||||
}
|
||||
|
|
|
@ -33,13 +33,11 @@
|
|||
|
||||
#define TIPS_DIR_NAME "tips"
|
||||
|
||||
static gint tips_dialog_delete (GtkWidget *widget, GdkEvent *event,
|
||||
gpointer data);
|
||||
static void tips_dialog_hide (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_previous (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_next (GtkWidget *widget, gpointer data);
|
||||
static void tips_toggle_update (GtkWidget *widget, gpointer data);
|
||||
static void read_tips_file (gchar *filename);
|
||||
static void tips_dialog_destroy (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_previous (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_next (GtkWidget *widget, gpointer data);
|
||||
static void tips_toggle_update (GtkWidget *widget, gpointer data);
|
||||
static void read_tips_file (gchar *filename);
|
||||
|
||||
static GtkWidget *tips_dialog = NULL;
|
||||
static GtkWidget *tips_label;
|
||||
|
@ -51,18 +49,11 @@ void
|
|||
tips_dialog_create (void)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *hbox2;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *bbox;
|
||||
GtkWidget *vbox_bbox2;
|
||||
GtkWidget *bbox2;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *preview;
|
||||
GtkWidget *button_close;
|
||||
GtkWidget *button_next;
|
||||
GtkWidget *button_prev;
|
||||
GtkWidget *vbox_check;
|
||||
GtkWidget *button_check;
|
||||
GtkWidget *button;
|
||||
gchar *temp;
|
||||
guchar *utemp;
|
||||
guchar *src;
|
||||
|
@ -89,11 +80,14 @@ tips_dialog_create (void)
|
|||
gtk_window_set_wmclass (GTK_WINDOW (tips_dialog), "tip_of_the_day", "Gimp");
|
||||
gtk_window_set_title (GTK_WINDOW (tips_dialog), _("GIMP Tip of the Day"));
|
||||
gtk_window_set_position (GTK_WINDOW (tips_dialog), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_policy (GTK_WINDOW (tips_dialog), FALSE, FALSE, FALSE);
|
||||
gtk_window_set_policy (GTK_WINDOW (tips_dialog), FALSE, TRUE, FALSE);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (tips_dialog), "delete_event",
|
||||
GTK_SIGNAL_FUNC (tips_dialog_delete),
|
||||
GTK_SIGNAL_FUNC (tips_dialog_destroy),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (tips_dialog), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&tips_dialog);
|
||||
|
||||
/* destroy the tips window if the mainlevel gtk_main() function is left */
|
||||
gtk_quit_add_destroy (1, GTK_OBJECT (tips_dialog));
|
||||
|
@ -102,27 +96,20 @@ tips_dialog_create (void)
|
|||
gtk_container_add (GTK_CONTAINER (tips_dialog), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
hbox1 = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox1), 10);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox1, FALSE, TRUE, 0);
|
||||
gtk_widget_show (hbox1);
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox2), 10);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), hbox2, FALSE, TRUE, 0);
|
||||
gtk_widget_show (hbox2);
|
||||
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_box_pack_end (GTK_BOX (hbox2), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
vbox_bbox2 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox2), vbox_bbox2, FALSE, FALSE, 15);
|
||||
gtk_widget_show (vbox_bbox2);
|
||||
|
||||
bbox2 = gtk_hbox_new (TRUE, 5);
|
||||
gtk_box_pack_end (GTK_BOX (vbox_bbox2), bbox2, TRUE, FALSE, 0);
|
||||
gtk_widget_show(bbox2);
|
||||
tips_label = gtk_label_new (tips_text[last_tip]);
|
||||
gtk_label_set_justify (GTK_LABEL (tips_label), GTK_JUSTIFY_LEFT);
|
||||
gtk_misc_set_alignment (GTK_MISC (tips_label), 0.5, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), tips_label, TRUE, FALSE, 3);
|
||||
gtk_widget_show (tips_label);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
gtk_preview_size (GTK_PREVIEW (preview), wilber_width, wilber_height);
|
||||
|
@ -133,66 +120,68 @@ tips_dialog_create (void)
|
|||
dest = utemp;
|
||||
for (x = 0; x < wilber_width; x++)
|
||||
{
|
||||
HEADER_PIXEL(src, dest);
|
||||
HEADER_PIXEL (src, dest);
|
||||
dest += 3;
|
||||
}
|
||||
gtk_preview_draw_row (GTK_PREVIEW (preview), utemp,
|
||||
0, y, wilber_width);
|
||||
gtk_preview_draw_row (GTK_PREVIEW (preview), utemp, 0, y, wilber_width);
|
||||
}
|
||||
g_free(utemp);
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_end (GTK_BOX (hbox1), frame, FALSE, TRUE, 3);
|
||||
gtk_container_add (GTK_CONTAINER (frame), preview);
|
||||
gtk_widget_show (preview);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
tips_label = gtk_label_new (tips_text[last_tip]);
|
||||
gtk_label_set_justify (GTK_LABEL (tips_label), GTK_JUSTIFY_LEFT);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), tips_label, TRUE, TRUE, 3);
|
||||
gtk_widget_show (tips_label);
|
||||
|
||||
button_prev = gtk_button_new_with_label (_("Previous Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button_prev, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button_prev), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_previous),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox2), button_prev);
|
||||
gtk_widget_show (button_prev);
|
||||
|
||||
button_next = gtk_button_new_with_label (_("Next Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button_next, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button_next), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_next),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox2), button_next);
|
||||
gtk_widget_show (button_next);
|
||||
|
||||
button_close = gtk_button_new_with_label (_("Close"));
|
||||
GTK_WIDGET_SET_FLAGS (button_close, GTK_CAN_DEFAULT);
|
||||
gtk_window_set_default (GTK_WINDOW (tips_dialog), button_close);
|
||||
gtk_signal_connect (GTK_OBJECT (button_close), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_dialog_hide),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button_close);
|
||||
gtk_widget_show (button_close);
|
||||
|
||||
vbox_check = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), vbox_check, FALSE, TRUE, 0);
|
||||
gtk_widget_show (vbox_check);
|
||||
|
||||
button_check = gtk_check_button_new_with_label (_("Show tip next time"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_check),
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 15);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
button = gtk_check_button_new_with_label (_("Show tip next time"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
show_tips);
|
||||
gtk_signal_connect (GTK_OBJECT (button_check), "toggled",
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (tips_toggle_update),
|
||||
(gpointer) &show_tips);
|
||||
gtk_box_pack_start (GTK_BOX (vbox_check), button_check, TRUE, FALSE, 0);
|
||||
gtk_widget_show (button_check);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
old_show_tips = show_tips;
|
||||
|
||||
/* Connect the "F1" help key */
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("Close"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_window_set_default (GTK_WINDOW (tips_dialog), button);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_dialog_destroy),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 5);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("Previous Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_previous),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Next Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_next),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* Connect the "F1" help key */
|
||||
gimp_help_connect_help_accel (tips_dialog,
|
||||
gimp_standard_help_func,
|
||||
"dialogs/tip_of_the_day.html");
|
||||
|
@ -208,24 +197,14 @@ tips_dialog_create (void)
|
|||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
tips_dialog_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
tips_dialog_hide (NULL, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
tips_dialog_hide (GtkWidget *widget,
|
||||
gpointer data)
|
||||
tips_dialog_destroy (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GList *update = NULL; /* options that should be updated in .gimprc */
|
||||
GList *remove = NULL; /* options that should be commented out */
|
||||
|
||||
gtk_widget_hide (tips_dialog);
|
||||
gtk_widget_destroy (tips_dialog);
|
||||
|
||||
/* the last-shown-tip is now saved in sessionrc */
|
||||
|
||||
|
@ -254,7 +233,7 @@ tips_show_previous (GtkWidget *widget,
|
|||
|
||||
static void
|
||||
tips_show_next (GtkWidget *widget,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
last_tip++;
|
||||
|
||||
|
|
|
@ -127,7 +127,6 @@ static GtkWidget *resolution_page = NULL;
|
|||
static GtkWidget *continue_button = NULL;
|
||||
|
||||
static GtkStyle *title_style = NULL;
|
||||
static GdkFont *large_font = NULL;
|
||||
|
||||
static GtkStyle *page_style = NULL;
|
||||
static GdkColormap *colormap = NULL;
|
||||
|
@ -521,6 +520,7 @@ install_dialog_create (InstallCallback callback)
|
|||
GtkWidget *darea;
|
||||
GtkWidget *page;
|
||||
GtkWidget *sep;
|
||||
GdkFont *large_font;
|
||||
|
||||
dialog = install_dialog =
|
||||
gimp_dialog_new (_("GIMP User Installation"), "user_installation",
|
||||
|
@ -555,8 +555,9 @@ install_dialog_create (InstallCallback callback)
|
|||
page_style->text[GTK_STATE_NORMAL] = black_color;
|
||||
page_style->bg[GTK_STATE_NORMAL] = white_color;
|
||||
|
||||
gdk_font_unref (page_style->font);
|
||||
page_style->font = dialog->style->font;
|
||||
/*gdk_font_ref (page_style->font);*/
|
||||
gdk_font_ref (page_style->font);
|
||||
|
||||
/* B/Colored Style for the page title */
|
||||
title_style = gtk_style_copy (page_style);
|
||||
|
@ -570,8 +571,13 @@ install_dialog_create (InstallCallback callback)
|
|||
/* this is a fontset, e.g. multiple comma-separated font definitions */
|
||||
large_font = gdk_fontset_load (_("-*-helvetica-bold-r-normal-*-*-240-*-*-*-*-*-*,*"));
|
||||
|
||||
title_style->font = large_font;
|
||||
|
||||
if (large_font)
|
||||
{
|
||||
gdk_font_unref (title_style->font);
|
||||
title_style->font = large_font;
|
||||
gdk_font_ref (title_style->font);
|
||||
}
|
||||
|
||||
/* W/W GC for the corner */
|
||||
white_gc = gdk_gc_new (dialog->window);
|
||||
gdk_gc_set_foreground (white_gc, &white_color);
|
||||
|
|
|
@ -127,7 +127,6 @@ static GtkWidget *resolution_page = NULL;
|
|||
static GtkWidget *continue_button = NULL;
|
||||
|
||||
static GtkStyle *title_style = NULL;
|
||||
static GdkFont *large_font = NULL;
|
||||
|
||||
static GtkStyle *page_style = NULL;
|
||||
static GdkColormap *colormap = NULL;
|
||||
|
@ -521,6 +520,7 @@ install_dialog_create (InstallCallback callback)
|
|||
GtkWidget *darea;
|
||||
GtkWidget *page;
|
||||
GtkWidget *sep;
|
||||
GdkFont *large_font;
|
||||
|
||||
dialog = install_dialog =
|
||||
gimp_dialog_new (_("GIMP User Installation"), "user_installation",
|
||||
|
@ -555,8 +555,9 @@ install_dialog_create (InstallCallback callback)
|
|||
page_style->text[GTK_STATE_NORMAL] = black_color;
|
||||
page_style->bg[GTK_STATE_NORMAL] = white_color;
|
||||
|
||||
gdk_font_unref (page_style->font);
|
||||
page_style->font = dialog->style->font;
|
||||
/*gdk_font_ref (page_style->font);*/
|
||||
gdk_font_ref (page_style->font);
|
||||
|
||||
/* B/Colored Style for the page title */
|
||||
title_style = gtk_style_copy (page_style);
|
||||
|
@ -570,8 +571,13 @@ install_dialog_create (InstallCallback callback)
|
|||
/* this is a fontset, e.g. multiple comma-separated font definitions */
|
||||
large_font = gdk_fontset_load (_("-*-helvetica-bold-r-normal-*-*-240-*-*-*-*-*-*,*"));
|
||||
|
||||
title_style->font = large_font;
|
||||
|
||||
if (large_font)
|
||||
{
|
||||
gdk_font_unref (title_style->font);
|
||||
title_style->font = large_font;
|
||||
gdk_font_ref (title_style->font);
|
||||
}
|
||||
|
||||
/* W/W GC for the corner */
|
||||
white_gc = gdk_gc_new (dialog->window);
|
||||
gdk_gc_set_foreground (white_gc, &white_color);
|
||||
|
|
|
@ -115,8 +115,8 @@ static void text_gdk_image_to_region (GdkImage *, gint, PixelRegion *);
|
|||
static void text_size_multiply (gchar **fontname, gint);
|
||||
static void text_set_resolution (gchar **fontname, gdouble, gdouble);
|
||||
|
||||
Layer * text_render (GImage *, GimpDrawable *,
|
||||
gint, gint, gchar *, gchar *, gint, gint);
|
||||
/* Layer * text_render (GImage *, GimpDrawable *, */
|
||||
/* gint, gint, gchar *, gchar *, gint, gint); */
|
||||
|
||||
|
||||
/* functions */
|
||||
|
@ -496,7 +496,7 @@ text_init_render (TextTool *text_tool)
|
|||
|
||||
static void
|
||||
text_gdk_image_to_region (GdkImage *image,
|
||||
int scale,
|
||||
gint scale,
|
||||
PixelRegion *textPR)
|
||||
{
|
||||
GdkColor black;
|
||||
|
@ -544,12 +544,12 @@ text_gdk_image_to_region (GdkImage *image,
|
|||
GimpLayer *
|
||||
text_render (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
int text_x,
|
||||
int text_y,
|
||||
char *fontname,
|
||||
char *text,
|
||||
int border,
|
||||
int antialias)
|
||||
gint text_x,
|
||||
gint text_y,
|
||||
gchar *fontname,
|
||||
gchar *text,
|
||||
gint border,
|
||||
gint antialias)
|
||||
{
|
||||
GdkFont *font;
|
||||
GdkPixmap *pixmap;
|
||||
|
@ -563,17 +563,17 @@ text_render (GimpImage *gimage,
|
|||
guchar color[MAX_CHANNELS];
|
||||
gchar *str;
|
||||
gint nstrs;
|
||||
gint crop;
|
||||
gboolean crop;
|
||||
gint line_width, line_height;
|
||||
gint pixmap_width, pixmap_height;
|
||||
gint text_width, text_height;
|
||||
gint width, height;
|
||||
gint x, y, k;
|
||||
void * pr;
|
||||
void *pr;
|
||||
#ifndef GDK_WINDOWING_WIN32
|
||||
XFontStruct *xfs;
|
||||
#endif
|
||||
char *fname;
|
||||
gchar *fname;
|
||||
|
||||
/* determine the layer type */
|
||||
if (drawable)
|
||||
|
@ -585,11 +585,12 @@ text_render (GimpImage *gimage,
|
|||
if (antialias)
|
||||
antialias = SUPERSAMPLE;
|
||||
else
|
||||
antialias = TRUE;
|
||||
antialias = 1;
|
||||
|
||||
/* Dont crop the text if border is negative */
|
||||
crop = (border >= 0);
|
||||
if (!crop) border = 0;
|
||||
if (!crop)
|
||||
border = 0;
|
||||
|
||||
/* load the font in */
|
||||
gdk_error_warnings = 0;
|
||||
|
@ -601,7 +602,7 @@ text_render (GimpImage *gimage,
|
|||
g_message (_("Font '%s' not found."), fontname);
|
||||
return NULL;
|
||||
}
|
||||
xfs = GDK_FONT_XFONT(font);
|
||||
xfs = GDK_FONT_XFONT (font);
|
||||
if (xfs->min_byte1 != 0 || xfs->max_byte1 != 0) {
|
||||
gdk_font_unref(font);
|
||||
fname = g_strdup_printf("%s,*", fontname);
|
||||
|
@ -619,7 +620,7 @@ text_render (GimpImage *gimage,
|
|||
{
|
||||
g_message (_("Font '%s' not found.%s"),
|
||||
fontname,
|
||||
antialias ?
|
||||
antialias > 1 ?
|
||||
_("\nIf you don't have scalable fonts, "
|
||||
"try turning off antialiasing in the tool options.") : "");
|
||||
return NULL;
|
||||
|
@ -801,13 +802,13 @@ text_render (GimpImage *gimage,
|
|||
return layer;
|
||||
}
|
||||
|
||||
int
|
||||
text_get_extents (char *fontname,
|
||||
char *text,
|
||||
int *width,
|
||||
int *height,
|
||||
int *ascent,
|
||||
int *descent)
|
||||
gboolean
|
||||
text_get_extents (gchar *fontname,
|
||||
gchar *text,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *ascent,
|
||||
gint *descent)
|
||||
{
|
||||
GdkFont *font;
|
||||
gchar *str;
|
||||
|
|
|
@ -31,11 +31,23 @@ typedef enum {
|
|||
#define SUPERSAMPLE 3
|
||||
|
||||
/* text functions */
|
||||
Tool * tools_new_text (void);
|
||||
void tools_free_text (Tool *);
|
||||
Tool * tools_new_text (void);
|
||||
void tools_free_text (Tool *);
|
||||
|
||||
int text_get_extents (char *, char *, int *, int *, int *, int *);
|
||||
GimpLayer * text_render (GimpImage *, GimpDrawable *, int, int, char *,
|
||||
char *, int, int);
|
||||
gboolean text_get_extents (gchar *fontname,
|
||||
gchar *text,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *ascent,
|
||||
gint *descent);
|
||||
|
||||
GimpLayer * text_render (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
gint text_x,
|
||||
gint text_y,
|
||||
gchar *fontname,
|
||||
gchar *text,
|
||||
gint border,
|
||||
gint antialias);
|
||||
|
||||
#endif /* __TEXT_TOOL_H__ */
|
||||
|
|
|
@ -33,13 +33,11 @@
|
|||
|
||||
#define TIPS_DIR_NAME "tips"
|
||||
|
||||
static gint tips_dialog_delete (GtkWidget *widget, GdkEvent *event,
|
||||
gpointer data);
|
||||
static void tips_dialog_hide (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_previous (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_next (GtkWidget *widget, gpointer data);
|
||||
static void tips_toggle_update (GtkWidget *widget, gpointer data);
|
||||
static void read_tips_file (gchar *filename);
|
||||
static void tips_dialog_destroy (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_previous (GtkWidget *widget, gpointer data);
|
||||
static void tips_show_next (GtkWidget *widget, gpointer data);
|
||||
static void tips_toggle_update (GtkWidget *widget, gpointer data);
|
||||
static void read_tips_file (gchar *filename);
|
||||
|
||||
static GtkWidget *tips_dialog = NULL;
|
||||
static GtkWidget *tips_label;
|
||||
|
@ -51,18 +49,11 @@ void
|
|||
tips_dialog_create (void)
|
||||
{
|
||||
GtkWidget *vbox;
|
||||
GtkWidget *hbox1;
|
||||
GtkWidget *hbox2;
|
||||
GtkWidget *hbox;
|
||||
GtkWidget *bbox;
|
||||
GtkWidget *vbox_bbox2;
|
||||
GtkWidget *bbox2;
|
||||
GtkWidget *frame;
|
||||
GtkWidget *preview;
|
||||
GtkWidget *button_close;
|
||||
GtkWidget *button_next;
|
||||
GtkWidget *button_prev;
|
||||
GtkWidget *vbox_check;
|
||||
GtkWidget *button_check;
|
||||
GtkWidget *button;
|
||||
gchar *temp;
|
||||
guchar *utemp;
|
||||
guchar *src;
|
||||
|
@ -89,11 +80,14 @@ tips_dialog_create (void)
|
|||
gtk_window_set_wmclass (GTK_WINDOW (tips_dialog), "tip_of_the_day", "Gimp");
|
||||
gtk_window_set_title (GTK_WINDOW (tips_dialog), _("GIMP Tip of the Day"));
|
||||
gtk_window_set_position (GTK_WINDOW (tips_dialog), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_policy (GTK_WINDOW (tips_dialog), FALSE, FALSE, FALSE);
|
||||
gtk_window_set_policy (GTK_WINDOW (tips_dialog), FALSE, TRUE, FALSE);
|
||||
|
||||
gtk_signal_connect (GTK_OBJECT (tips_dialog), "delete_event",
|
||||
GTK_SIGNAL_FUNC (tips_dialog_delete),
|
||||
GTK_SIGNAL_FUNC (tips_dialog_destroy),
|
||||
NULL);
|
||||
gtk_signal_connect (GTK_OBJECT (tips_dialog), "destroy",
|
||||
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
|
||||
&tips_dialog);
|
||||
|
||||
/* destroy the tips window if the mainlevel gtk_main() function is left */
|
||||
gtk_quit_add_destroy (1, GTK_OBJECT (tips_dialog));
|
||||
|
@ -102,27 +96,20 @@ tips_dialog_create (void)
|
|||
gtk_container_add (GTK_CONTAINER (tips_dialog), vbox);
|
||||
gtk_widget_show (vbox);
|
||||
|
||||
hbox1 = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox1), 10);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox1, FALSE, TRUE, 0);
|
||||
gtk_widget_show (hbox1);
|
||||
hbox = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
|
||||
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
hbox2 = gtk_hbox_new (FALSE, 5);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox2), 10);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), hbox2, FALSE, TRUE, 0);
|
||||
gtk_widget_show (hbox2);
|
||||
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_box_pack_end (GTK_BOX (hbox2), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
vbox_bbox2 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_end (GTK_BOX (hbox2), vbox_bbox2, FALSE, FALSE, 15);
|
||||
gtk_widget_show (vbox_bbox2);
|
||||
|
||||
bbox2 = gtk_hbox_new (TRUE, 5);
|
||||
gtk_box_pack_end (GTK_BOX (vbox_bbox2), bbox2, TRUE, FALSE, 0);
|
||||
gtk_widget_show(bbox2);
|
||||
tips_label = gtk_label_new (tips_text[last_tip]);
|
||||
gtk_label_set_justify (GTK_LABEL (tips_label), GTK_JUSTIFY_LEFT);
|
||||
gtk_misc_set_alignment (GTK_MISC (tips_label), 0.5, 0.5);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), tips_label, TRUE, FALSE, 3);
|
||||
gtk_widget_show (tips_label);
|
||||
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), frame, FALSE, FALSE, 0);
|
||||
|
||||
preview = gtk_preview_new (GTK_PREVIEW_COLOR);
|
||||
gtk_preview_size (GTK_PREVIEW (preview), wilber_width, wilber_height);
|
||||
|
@ -133,66 +120,68 @@ tips_dialog_create (void)
|
|||
dest = utemp;
|
||||
for (x = 0; x < wilber_width; x++)
|
||||
{
|
||||
HEADER_PIXEL(src, dest);
|
||||
HEADER_PIXEL (src, dest);
|
||||
dest += 3;
|
||||
}
|
||||
gtk_preview_draw_row (GTK_PREVIEW (preview), utemp,
|
||||
0, y, wilber_width);
|
||||
gtk_preview_draw_row (GTK_PREVIEW (preview), utemp, 0, y, wilber_width);
|
||||
}
|
||||
g_free(utemp);
|
||||
frame = gtk_frame_new (NULL);
|
||||
gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_IN);
|
||||
gtk_box_pack_end (GTK_BOX (hbox1), frame, FALSE, TRUE, 3);
|
||||
gtk_container_add (GTK_CONTAINER (frame), preview);
|
||||
gtk_widget_show (preview);
|
||||
gtk_widget_show (frame);
|
||||
|
||||
tips_label = gtk_label_new (tips_text[last_tip]);
|
||||
gtk_label_set_justify (GTK_LABEL (tips_label), GTK_JUSTIFY_LEFT);
|
||||
gtk_box_pack_start (GTK_BOX (hbox1), tips_label, TRUE, TRUE, 3);
|
||||
gtk_widget_show (tips_label);
|
||||
|
||||
button_prev = gtk_button_new_with_label (_("Previous Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button_prev, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button_prev), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_previous),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox2), button_prev);
|
||||
gtk_widget_show (button_prev);
|
||||
|
||||
button_next = gtk_button_new_with_label (_("Next Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button_next, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button_next), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_next),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox2), button_next);
|
||||
gtk_widget_show (button_next);
|
||||
|
||||
button_close = gtk_button_new_with_label (_("Close"));
|
||||
GTK_WIDGET_SET_FLAGS (button_close, GTK_CAN_DEFAULT);
|
||||
gtk_window_set_default (GTK_WINDOW (tips_dialog), button_close);
|
||||
gtk_signal_connect (GTK_OBJECT (button_close), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_dialog_hide),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button_close);
|
||||
gtk_widget_show (button_close);
|
||||
|
||||
vbox_check = gtk_vbox_new (FALSE, 0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox2), vbox_check, FALSE, TRUE, 0);
|
||||
gtk_widget_show (vbox_check);
|
||||
|
||||
button_check = gtk_check_button_new_with_label (_("Show tip next time"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_check),
|
||||
|
||||
hbox = gtk_hbox_new (FALSE, 15);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (hbox), 10);
|
||||
gtk_box_pack_end (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (hbox);
|
||||
|
||||
button = gtk_check_button_new_with_label (_("Show tip next time"));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button),
|
||||
show_tips);
|
||||
gtk_signal_connect (GTK_OBJECT (button_check), "toggled",
|
||||
gtk_signal_connect (GTK_OBJECT (button), "toggled",
|
||||
GTK_SIGNAL_FUNC (tips_toggle_update),
|
||||
(gpointer) &show_tips);
|
||||
gtk_box_pack_start (GTK_BOX (vbox_check), button_check, TRUE, FALSE, 0);
|
||||
gtk_widget_show (button_check);
|
||||
gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0);
|
||||
gtk_widget_show (button);
|
||||
|
||||
old_show_tips = show_tips;
|
||||
|
||||
/* Connect the "F1" help key */
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("Close"));
|
||||
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
|
||||
gtk_window_set_default (GTK_WINDOW (tips_dialog), button);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_dialog_destroy),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
bbox = gtk_hbutton_box_new ();
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_END);
|
||||
gtk_button_box_set_spacing (GTK_BUTTON_BOX (bbox), 5);
|
||||
gtk_box_pack_end (GTK_BOX (hbox), bbox, FALSE, FALSE, 0);
|
||||
gtk_widget_show (bbox);
|
||||
|
||||
button = gtk_button_new_with_label (_("Previous Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_previous),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
button = gtk_button_new_with_label (_("Next Tip"));
|
||||
GTK_WIDGET_UNSET_FLAGS (button, GTK_RECEIVES_DEFAULT);
|
||||
gtk_signal_connect (GTK_OBJECT (button), "clicked",
|
||||
GTK_SIGNAL_FUNC (tips_show_next),
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (bbox), button);
|
||||
gtk_widget_show (button);
|
||||
|
||||
/* Connect the "F1" help key */
|
||||
gimp_help_connect_help_accel (tips_dialog,
|
||||
gimp_standard_help_func,
|
||||
"dialogs/tip_of_the_day.html");
|
||||
|
@ -208,24 +197,14 @@ tips_dialog_create (void)
|
|||
}
|
||||
}
|
||||
|
||||
static gint
|
||||
tips_dialog_delete (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
gpointer data)
|
||||
{
|
||||
tips_dialog_hide (NULL, NULL);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
tips_dialog_hide (GtkWidget *widget,
|
||||
gpointer data)
|
||||
tips_dialog_destroy (GtkWidget *widget,
|
||||
gpointer data)
|
||||
{
|
||||
GList *update = NULL; /* options that should be updated in .gimprc */
|
||||
GList *remove = NULL; /* options that should be commented out */
|
||||
|
||||
gtk_widget_hide (tips_dialog);
|
||||
gtk_widget_destroy (tips_dialog);
|
||||
|
||||
/* the last-shown-tip is now saved in sessionrc */
|
||||
|
||||
|
@ -254,7 +233,7 @@ tips_show_previous (GtkWidget *widget,
|
|||
|
||||
static void
|
||||
tips_show_next (GtkWidget *widget,
|
||||
gpointer data)
|
||||
gpointer data)
|
||||
{
|
||||
last_tip++;
|
||||
|
||||
|
|
|
@ -115,8 +115,8 @@ static void text_gdk_image_to_region (GdkImage *, gint, PixelRegion *);
|
|||
static void text_size_multiply (gchar **fontname, gint);
|
||||
static void text_set_resolution (gchar **fontname, gdouble, gdouble);
|
||||
|
||||
Layer * text_render (GImage *, GimpDrawable *,
|
||||
gint, gint, gchar *, gchar *, gint, gint);
|
||||
/* Layer * text_render (GImage *, GimpDrawable *, */
|
||||
/* gint, gint, gchar *, gchar *, gint, gint); */
|
||||
|
||||
|
||||
/* functions */
|
||||
|
@ -496,7 +496,7 @@ text_init_render (TextTool *text_tool)
|
|||
|
||||
static void
|
||||
text_gdk_image_to_region (GdkImage *image,
|
||||
int scale,
|
||||
gint scale,
|
||||
PixelRegion *textPR)
|
||||
{
|
||||
GdkColor black;
|
||||
|
@ -544,12 +544,12 @@ text_gdk_image_to_region (GdkImage *image,
|
|||
GimpLayer *
|
||||
text_render (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
int text_x,
|
||||
int text_y,
|
||||
char *fontname,
|
||||
char *text,
|
||||
int border,
|
||||
int antialias)
|
||||
gint text_x,
|
||||
gint text_y,
|
||||
gchar *fontname,
|
||||
gchar *text,
|
||||
gint border,
|
||||
gint antialias)
|
||||
{
|
||||
GdkFont *font;
|
||||
GdkPixmap *pixmap;
|
||||
|
@ -563,17 +563,17 @@ text_render (GimpImage *gimage,
|
|||
guchar color[MAX_CHANNELS];
|
||||
gchar *str;
|
||||
gint nstrs;
|
||||
gint crop;
|
||||
gboolean crop;
|
||||
gint line_width, line_height;
|
||||
gint pixmap_width, pixmap_height;
|
||||
gint text_width, text_height;
|
||||
gint width, height;
|
||||
gint x, y, k;
|
||||
void * pr;
|
||||
void *pr;
|
||||
#ifndef GDK_WINDOWING_WIN32
|
||||
XFontStruct *xfs;
|
||||
#endif
|
||||
char *fname;
|
||||
gchar *fname;
|
||||
|
||||
/* determine the layer type */
|
||||
if (drawable)
|
||||
|
@ -585,11 +585,12 @@ text_render (GimpImage *gimage,
|
|||
if (antialias)
|
||||
antialias = SUPERSAMPLE;
|
||||
else
|
||||
antialias = TRUE;
|
||||
antialias = 1;
|
||||
|
||||
/* Dont crop the text if border is negative */
|
||||
crop = (border >= 0);
|
||||
if (!crop) border = 0;
|
||||
if (!crop)
|
||||
border = 0;
|
||||
|
||||
/* load the font in */
|
||||
gdk_error_warnings = 0;
|
||||
|
@ -601,7 +602,7 @@ text_render (GimpImage *gimage,
|
|||
g_message (_("Font '%s' not found."), fontname);
|
||||
return NULL;
|
||||
}
|
||||
xfs = GDK_FONT_XFONT(font);
|
||||
xfs = GDK_FONT_XFONT (font);
|
||||
if (xfs->min_byte1 != 0 || xfs->max_byte1 != 0) {
|
||||
gdk_font_unref(font);
|
||||
fname = g_strdup_printf("%s,*", fontname);
|
||||
|
@ -619,7 +620,7 @@ text_render (GimpImage *gimage,
|
|||
{
|
||||
g_message (_("Font '%s' not found.%s"),
|
||||
fontname,
|
||||
antialias ?
|
||||
antialias > 1 ?
|
||||
_("\nIf you don't have scalable fonts, "
|
||||
"try turning off antialiasing in the tool options.") : "");
|
||||
return NULL;
|
||||
|
@ -801,13 +802,13 @@ text_render (GimpImage *gimage,
|
|||
return layer;
|
||||
}
|
||||
|
||||
int
|
||||
text_get_extents (char *fontname,
|
||||
char *text,
|
||||
int *width,
|
||||
int *height,
|
||||
int *ascent,
|
||||
int *descent)
|
||||
gboolean
|
||||
text_get_extents (gchar *fontname,
|
||||
gchar *text,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *ascent,
|
||||
gint *descent)
|
||||
{
|
||||
GdkFont *font;
|
||||
gchar *str;
|
||||
|
|
|
@ -31,11 +31,23 @@ typedef enum {
|
|||
#define SUPERSAMPLE 3
|
||||
|
||||
/* text functions */
|
||||
Tool * tools_new_text (void);
|
||||
void tools_free_text (Tool *);
|
||||
Tool * tools_new_text (void);
|
||||
void tools_free_text (Tool *);
|
||||
|
||||
int text_get_extents (char *, char *, int *, int *, int *, int *);
|
||||
GimpLayer * text_render (GimpImage *, GimpDrawable *, int, int, char *,
|
||||
char *, int, int);
|
||||
gboolean text_get_extents (gchar *fontname,
|
||||
gchar *text,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *ascent,
|
||||
gint *descent);
|
||||
|
||||
GimpLayer * text_render (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
gint text_x,
|
||||
gint text_y,
|
||||
gchar *fontname,
|
||||
gchar *text,
|
||||
gint border,
|
||||
gint antialias);
|
||||
|
||||
#endif /* __TEXT_TOOL_H__ */
|
||||
|
|
|
@ -115,8 +115,8 @@ static void text_gdk_image_to_region (GdkImage *, gint, PixelRegion *);
|
|||
static void text_size_multiply (gchar **fontname, gint);
|
||||
static void text_set_resolution (gchar **fontname, gdouble, gdouble);
|
||||
|
||||
Layer * text_render (GImage *, GimpDrawable *,
|
||||
gint, gint, gchar *, gchar *, gint, gint);
|
||||
/* Layer * text_render (GImage *, GimpDrawable *, */
|
||||
/* gint, gint, gchar *, gchar *, gint, gint); */
|
||||
|
||||
|
||||
/* functions */
|
||||
|
@ -496,7 +496,7 @@ text_init_render (TextTool *text_tool)
|
|||
|
||||
static void
|
||||
text_gdk_image_to_region (GdkImage *image,
|
||||
int scale,
|
||||
gint scale,
|
||||
PixelRegion *textPR)
|
||||
{
|
||||
GdkColor black;
|
||||
|
@ -544,12 +544,12 @@ text_gdk_image_to_region (GdkImage *image,
|
|||
GimpLayer *
|
||||
text_render (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
int text_x,
|
||||
int text_y,
|
||||
char *fontname,
|
||||
char *text,
|
||||
int border,
|
||||
int antialias)
|
||||
gint text_x,
|
||||
gint text_y,
|
||||
gchar *fontname,
|
||||
gchar *text,
|
||||
gint border,
|
||||
gint antialias)
|
||||
{
|
||||
GdkFont *font;
|
||||
GdkPixmap *pixmap;
|
||||
|
@ -563,17 +563,17 @@ text_render (GimpImage *gimage,
|
|||
guchar color[MAX_CHANNELS];
|
||||
gchar *str;
|
||||
gint nstrs;
|
||||
gint crop;
|
||||
gboolean crop;
|
||||
gint line_width, line_height;
|
||||
gint pixmap_width, pixmap_height;
|
||||
gint text_width, text_height;
|
||||
gint width, height;
|
||||
gint x, y, k;
|
||||
void * pr;
|
||||
void *pr;
|
||||
#ifndef GDK_WINDOWING_WIN32
|
||||
XFontStruct *xfs;
|
||||
#endif
|
||||
char *fname;
|
||||
gchar *fname;
|
||||
|
||||
/* determine the layer type */
|
||||
if (drawable)
|
||||
|
@ -585,11 +585,12 @@ text_render (GimpImage *gimage,
|
|||
if (antialias)
|
||||
antialias = SUPERSAMPLE;
|
||||
else
|
||||
antialias = TRUE;
|
||||
antialias = 1;
|
||||
|
||||
/* Dont crop the text if border is negative */
|
||||
crop = (border >= 0);
|
||||
if (!crop) border = 0;
|
||||
if (!crop)
|
||||
border = 0;
|
||||
|
||||
/* load the font in */
|
||||
gdk_error_warnings = 0;
|
||||
|
@ -601,7 +602,7 @@ text_render (GimpImage *gimage,
|
|||
g_message (_("Font '%s' not found."), fontname);
|
||||
return NULL;
|
||||
}
|
||||
xfs = GDK_FONT_XFONT(font);
|
||||
xfs = GDK_FONT_XFONT (font);
|
||||
if (xfs->min_byte1 != 0 || xfs->max_byte1 != 0) {
|
||||
gdk_font_unref(font);
|
||||
fname = g_strdup_printf("%s,*", fontname);
|
||||
|
@ -619,7 +620,7 @@ text_render (GimpImage *gimage,
|
|||
{
|
||||
g_message (_("Font '%s' not found.%s"),
|
||||
fontname,
|
||||
antialias ?
|
||||
antialias > 1 ?
|
||||
_("\nIf you don't have scalable fonts, "
|
||||
"try turning off antialiasing in the tool options.") : "");
|
||||
return NULL;
|
||||
|
@ -801,13 +802,13 @@ text_render (GimpImage *gimage,
|
|||
return layer;
|
||||
}
|
||||
|
||||
int
|
||||
text_get_extents (char *fontname,
|
||||
char *text,
|
||||
int *width,
|
||||
int *height,
|
||||
int *ascent,
|
||||
int *descent)
|
||||
gboolean
|
||||
text_get_extents (gchar *fontname,
|
||||
gchar *text,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *ascent,
|
||||
gint *descent)
|
||||
{
|
||||
GdkFont *font;
|
||||
gchar *str;
|
||||
|
|
|
@ -31,11 +31,23 @@ typedef enum {
|
|||
#define SUPERSAMPLE 3
|
||||
|
||||
/* text functions */
|
||||
Tool * tools_new_text (void);
|
||||
void tools_free_text (Tool *);
|
||||
Tool * tools_new_text (void);
|
||||
void tools_free_text (Tool *);
|
||||
|
||||
int text_get_extents (char *, char *, int *, int *, int *, int *);
|
||||
GimpLayer * text_render (GimpImage *, GimpDrawable *, int, int, char *,
|
||||
char *, int, int);
|
||||
gboolean text_get_extents (gchar *fontname,
|
||||
gchar *text,
|
||||
gint *width,
|
||||
gint *height,
|
||||
gint *ascent,
|
||||
gint *descent);
|
||||
|
||||
GimpLayer * text_render (GimpImage *gimage,
|
||||
GimpDrawable *drawable,
|
||||
gint text_x,
|
||||
gint text_y,
|
||||
gchar *fontname,
|
||||
gchar *text,
|
||||
gint border,
|
||||
gint antialias);
|
||||
|
||||
#endif /* __TEXT_TOOL_H__ */
|
||||
|
|
|
@ -127,7 +127,6 @@ static GtkWidget *resolution_page = NULL;
|
|||
static GtkWidget *continue_button = NULL;
|
||||
|
||||
static GtkStyle *title_style = NULL;
|
||||
static GdkFont *large_font = NULL;
|
||||
|
||||
static GtkStyle *page_style = NULL;
|
||||
static GdkColormap *colormap = NULL;
|
||||
|
@ -521,6 +520,7 @@ install_dialog_create (InstallCallback callback)
|
|||
GtkWidget *darea;
|
||||
GtkWidget *page;
|
||||
GtkWidget *sep;
|
||||
GdkFont *large_font;
|
||||
|
||||
dialog = install_dialog =
|
||||
gimp_dialog_new (_("GIMP User Installation"), "user_installation",
|
||||
|
@ -555,8 +555,9 @@ install_dialog_create (InstallCallback callback)
|
|||
page_style->text[GTK_STATE_NORMAL] = black_color;
|
||||
page_style->bg[GTK_STATE_NORMAL] = white_color;
|
||||
|
||||
gdk_font_unref (page_style->font);
|
||||
page_style->font = dialog->style->font;
|
||||
/*gdk_font_ref (page_style->font);*/
|
||||
gdk_font_ref (page_style->font);
|
||||
|
||||
/* B/Colored Style for the page title */
|
||||
title_style = gtk_style_copy (page_style);
|
||||
|
@ -570,8 +571,13 @@ install_dialog_create (InstallCallback callback)
|
|||
/* this is a fontset, e.g. multiple comma-separated font definitions */
|
||||
large_font = gdk_fontset_load (_("-*-helvetica-bold-r-normal-*-*-240-*-*-*-*-*-*,*"));
|
||||
|
||||
title_style->font = large_font;
|
||||
|
||||
if (large_font)
|
||||
{
|
||||
gdk_font_unref (title_style->font);
|
||||
title_style->font = large_font;
|
||||
gdk_font_ref (title_style->font);
|
||||
}
|
||||
|
||||
/* W/W GC for the corner */
|
||||
white_gc = gdk_gc_new (dialog->window);
|
||||
gdk_gc_set_foreground (white_gc, &white_color);
|
||||
|
|
Loading…
Reference in New Issue