plug-ins/gdyntext/gdyntext_ui.c set gimp_help accelerator on main window

2000-08-16  Sven Neumann  <sven@gimp.org>

	* plug-ins/gdyntext/gdyntext_ui.c
	* plug-ins/gdyntext/message_window.c: set gimp_help accelerator
	on main window and use gimp_dialog_set_icon () on all windows.
This commit is contained in:
Sven Neumann 2000-08-16 20:29:49 +00:00 committed by Sven Neumann
parent 20037ac2f1
commit f2f819d1c3
3 changed files with 110 additions and 95 deletions

View file

@ -1,3 +1,9 @@
2000-08-16 Sven Neumann <sven@gimp.org>
* plug-ins/gdyntext/gdyntext_ui.c
* plug-ins/gdyntext/message_window.c: set gimp_help accelerator
on main window and use gimp_dialog_set_icon () on all windows.
2000-08-16 Sven Neumann <sven@gimp.org>
* plug-ins/common/animationplay.c: check if drawable returned
@ -32,7 +38,7 @@
2000-08-10 Kevin Turner <acapnotic@users.sourceforge.net>
* tools/pdbgen/enumcode-py.pl:
* tools/pdbgen/enumcode-py.pl:
* plug-ins/pygimp/gimpenums.py: gimpenums.py is now autogenerated by
enumcode-py.pl

View file

@ -152,6 +152,7 @@ create_about_dialog (void)
gtk_window_set_title(GTK_WINDOW(window), _("GDynText: About ..."));
gtk_window_set_policy(GTK_WINDOW(window), FALSE, FALSE, FALSE);
gtk_window_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER);
gimp_dialog_set_icon (GTK_WINDOW (window));
gtk_signal_connect(GTK_OBJECT(window), "destroy",
GTK_SIGNAL_FUNC(on_about_dialog_destroy), NULL);
@ -209,7 +210,6 @@ create_main_window (GdtMainWindow **main_window,
GdtMainWindow *mw;
GtkObject *font_size_adj;
GtkObject *line_spacing_adj;
GtkTooltips *tooltips;
GtkWidget *handlebox;
GtkWidget *vbox;
GtkWidget *hbox;
@ -259,8 +259,6 @@ create_main_window (GdtMainWindow **main_window,
mw->font_preview_enabled = FALSE;
mw->ok_pressed = FALSE;
tooltips = gtk_tooltips_new();
mw->window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
title = g_strconcat (_("GDynText"), " ", GDYNTEXT_VERSION, NULL);
gtk_window_set_title(GTK_WINDOW(mw->window), title);
@ -272,6 +270,9 @@ create_main_window (GdtMainWindow **main_window,
GTK_SIGNAL_FUNC(on_main_window_cancel_clicked), &mw->ok_pressed);
gtk_widget_realize(mw->window);
gimp_help_connect_help_accel (mw->window, gimp_standard_help_func, "filters/gdyntext.html");
gimp_help_init ();
vbox = gtk_vbox_new(FALSE, 0);
gtk_container_add(GTK_CONTAINER(mw->window), vbox);
gtk_widget_show(vbox);
@ -412,10 +413,10 @@ create_main_window (GdtMainWindow **main_window,
gtk_box_pack_start(GTK_BOX(hbox1), label, FALSE, TRUE, 3);
gtk_widget_show(label);
optmenu = gtk_option_menu_new();
optmenu = gtk_option_menu_new ();
gtk_box_pack_start(GTK_BOX(hbox1), optmenu, FALSE, TRUE, 3);
gtk_widget_show(optmenu);
gtk_tooltips_set_tip(tooltips, optmenu, _("Set layer alignment"), "");
gimp_help_set_help_data (optmenu, _("Set layer alignment"), "#layer_align");
menu = gtk_menu_new();
for (i = 0; lalign_menu[i] != NULL; i += 2)
@ -455,7 +456,6 @@ create_main_window (GdtMainWindow **main_window,
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(mw->line_spacing), TRUE);
gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(mw->line_spacing), GTK_UPDATE_ALWAYS);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mw->line_spacing), data->line_spacing);
gtk_tooltips_set_tip(tooltips, mw->line_spacing, _("Set line spacing"), "");
gtk_box_pack_start(GTK_BOX(hbox1), mw->line_spacing, FALSE, TRUE, 2);
gtk_widget_show(mw->line_spacing);
@ -468,7 +468,7 @@ create_main_window (GdtMainWindow **main_window,
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(mw->font_rotation), TRUE);
gtk_spin_button_set_update_policy(GTK_SPIN_BUTTON(mw->font_rotation), GTK_UPDATE_ALWAYS);
gtk_spin_button_set_value(GTK_SPIN_BUTTON(mw->font_rotation), data->rotation);
gtk_tooltips_set_tip(tooltips, mw->font_rotation, _("Set text rotation (degrees)"), "");
gimp_help_set_help_data (mw->font_rotation, _("Set text rotation (degrees)"), NULL);
gtk_box_pack_start(GTK_BOX(hbox1), mw->font_rotation, FALSE, TRUE, 2);
gtk_widget_show(mw->font_rotation);
@ -500,7 +500,7 @@ create_main_window (GdtMainWindow **main_window,
mw->font_preview = gtk_entry_new();
gtk_entry_set_text(GTK_ENTRY(mw->font_preview), DEFAULT_FONT_PREVIEW_TEXT);
gtk_tooltips_set_tip(tooltips, mw->font_preview, _("Editable text sample"), NULL);
gimp_help_set_help_data (mw->font_preview, _("Editable text sample"), NULL);
gtk_box_pack_start(GTK_BOX(mw->hbox_fp), mw->font_preview, TRUE, TRUE, 5);
gtk_widget_show(mw->font_preview);
@ -571,9 +571,9 @@ create_main_window (GdtMainWindow **main_window,
gtk_box_pack_start(GTK_BOX(hbbox2), button_ok, FALSE, FALSE, 0);
gtk_widget_show(button_ok);
gtk_tooltips_set_tip(tooltips, button_ok,
_("Holding the Shift key while pressing this button will force GDynText "
"in changing the layer name as done in GIMP 1.0."), NULL);
gimp_help_set_help_data (button_ok,
_("Holding the Shift key while pressing this button will force GDynText "
"in changing the layer name as done in GIMP 1.0."), NULL);
button_apply = gtk_button_new_with_label(_("Apply"));
GTK_WIDGET_SET_FLAGS(button_apply, GTK_CAN_DEFAULT);
@ -630,8 +630,9 @@ gdt_create_ui (GdtVals *data)
if (MESSAGE_WINDOW(message_window)->contains_messages)
gtk_widget_show(message_window);
gtk_main();
gtk_main ();
gimp_help_free ();
if (main_window->ok_pressed)
set_gdt_vals(data);

View file

@ -20,133 +20,141 @@
* $Id$
*/
#include <stdio.h>
#include <gtk/gtk.h>
#include "libgimp/stdplugins-intl.h"
#include "message_window.h"
static void message_window_class_init(MessageWindowClass *class);
static void message_window_init(MessageWindow *mw);
static void message_window_class_init (MessageWindowClass *class);
static void message_window_init (MessageWindow *mw);
static GtkWindowClass *message_window_parent_class = NULL;
guint message_window_get_type(void)
guint
message_window_get_type (void)
{
static guint mw_type = 0;
if (!mw_type) {
GtkTypeInfo mw_info = {
"MessageWindow",
sizeof(MessageWindow),
sizeof(MessageWindowClass),
(GtkClassInitFunc)message_window_class_init,
(GtkObjectInitFunc)message_window_init,
(GtkArgSetFunc)NULL,
(GtkArgGetFunc)NULL,
static guint mw_type = 0;
if (!mw_type)
{
GtkTypeInfo mw_info =
{
"MessageWindow",
sizeof(MessageWindow),
sizeof(MessageWindowClass),
(GtkClassInitFunc)message_window_class_init,
(GtkObjectInitFunc)message_window_init,
(GtkArgSetFunc)NULL,
(GtkArgGetFunc)NULL,
#ifdef GTK_HAVE_FEATURES_1_1_12
(GtkClassInitFunc)NULL,
(GtkClassInitFunc)NULL,
#endif
};
mw_type = gtk_type_unique(gtk_window_get_type(), &mw_info);
}
return mw_type;
};
mw_type = gtk_type_unique (gtk_window_get_type (), &mw_info);
}
return mw_type;
}
static void message_window_class_init(MessageWindowClass *klass)
static void
message_window_class_init (MessageWindowClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass *)klass;
message_window_parent_class = gtk_type_class(gtk_window_get_type());
GtkObjectClass *object_class;
object_class = (GtkObjectClass *)klass;
message_window_parent_class = gtk_type_class (gtk_window_get_type());
}
static void message_window_init(MessageWindow *mw)
static void
message_window_init (MessageWindow *mw)
{
GtkWidget *vbox;
GtkWidget *hbox1;
GtkWidget *hbbox1;
GtkWidget *vscrollbar;
GtkWidget *hseparator;
GtkStyle *style;
GtkStyle *style;
mw->contains_messages = FALSE;
mw->contains_messages = FALSE;
vbox = gtk_vbox_new(FALSE, 5);
gtk_container_add(GTK_CONTAINER(mw), vbox);
gtk_widget_show(vbox);
vbox = gtk_vbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER(mw), vbox);
gtk_widget_show (vbox);
hbox1 = gtk_hbox_new(FALSE, 0);
gtk_box_pack_start(GTK_BOX(vbox), hbox1, TRUE, TRUE, 0);
gtk_widget_show(hbox1);
hbox1 = gtk_hbox_new (FALSE, 0);
gtk_box_pack_start (GTK_BOX(vbox), hbox1, TRUE, TRUE, 0);
gtk_widget_show (hbox1);
mw->text = gtk_text_new(NULL, NULL);
gtk_box_pack_start(GTK_BOX(hbox1), mw->text, TRUE, TRUE, 5);
gtk_widget_show(mw->text);
mw->text = gtk_text_new (NULL, NULL);
gtk_box_pack_start (GTK_BOX(hbox1), mw->text, TRUE, TRUE, 5);
gtk_widget_show (mw->text);
style = gtk_widget_get_style(mw->text);
gtk_style_unref(style);
style->base[GTK_STATE_NORMAL] = style->bg[GTK_STATE_NORMAL];
gtk_style_ref(style);
gtk_widget_set_style(mw->text, style);
vscrollbar = gtk_vscrollbar_new(GTK_TEXT(mw->text)->vadj);
gtk_box_pack_start(GTK_BOX(hbox1), vscrollbar, FALSE, TRUE, 0);
gtk_widget_show(vscrollbar);
style = gtk_widget_get_style (mw->text);
gtk_style_unref (style);
style->base[GTK_STATE_NORMAL] = style->bg[GTK_STATE_NORMAL];
gtk_style_ref (style);
gtk_widget_set_style (mw->text, style);
vscrollbar = gtk_vscrollbar_new (GTK_TEXT(mw->text)->vadj);
gtk_box_pack_start (GTK_BOX (hbox1), vscrollbar, FALSE, TRUE, 0);
gtk_widget_show (vscrollbar);
hseparator = gtk_hseparator_new();
gtk_box_pack_start(GTK_BOX(vbox), hseparator, FALSE, TRUE, 0);
gtk_widget_show(hseparator);
hseparator = gtk_hseparator_new ();
gtk_box_pack_start (GTK_BOX(vbox), hseparator, FALSE, TRUE, 0);
gtk_widget_show (hseparator);
hbbox1 = gtk_hbutton_box_new();
gtk_box_pack_start(GTK_BOX(vbox), hbbox1, FALSE, FALSE, 0);
gtk_button_box_set_layout(GTK_BUTTON_BOX(hbbox1), GTK_BUTTONBOX_END);
gtk_widget_show(hbbox1);
hbbox1 = gtk_hbutton_box_new ();
gtk_box_pack_start (GTK_BOX(vbox), hbbox1, FALSE, FALSE, 0);
gtk_button_box_set_layout (GTK_BUTTON_BOX(hbbox1), GTK_BUTTONBOX_END);
gtk_widget_show (hbbox1);
mw->dismiss_button = gtk_button_new_with_label(_("Dismiss"));
GTK_WIDGET_SET_FLAGS(mw->dismiss_button, GTK_CAN_DEFAULT);
gtk_box_pack_end(GTK_BOX(hbbox1), mw->dismiss_button, FALSE, TRUE, 0);
gtk_widget_grab_default(mw->dismiss_button);
gtk_widget_show(mw->dismiss_button);
GTK_WIDGET_SET_FLAGS (mw->dismiss_button, GTK_CAN_DEFAULT);
gtk_box_pack_end (GTK_BOX(hbbox1), mw->dismiss_button, FALSE, TRUE, 0);
gtk_widget_grab_default (mw->dismiss_button);
gtk_widget_show (mw->dismiss_button);
}
GtkWidget *message_window_new(const gchar *title)
GtkWidget *
message_window_new (const gchar *title)
{
MessageWindow *mw;
mw = gtk_type_new(message_window_get_type());
gtk_window_set_title(GTK_WINDOW(mw), title);
gtk_container_border_width(GTK_CONTAINER(mw), 4);
gtk_window_set_policy(GTK_WINDOW(mw), TRUE, TRUE, FALSE);
return GTK_WIDGET(mw);
MessageWindow *mw;
mw = gtk_type_new (message_window_get_type());
gtk_window_set_title (GTK_WINDOW(mw), title);
gimp_dialog_set_icon (GTK_WINDOW (mw));
gtk_container_border_width (GTK_CONTAINER(mw), 4);
gtk_window_set_policy (GTK_WINDOW(mw), TRUE, TRUE, FALSE);
return GTK_WIDGET(mw);
}
void message_window_append(MessageWindow *mw, const gchar *msg)
void
message_window_append (MessageWindow *mw,
const gchar *msg)
{
gtk_widget_realize(mw->text);
gtk_text_freeze(GTK_TEXT(mw->text));
gtk_text_insert(GTK_TEXT(mw->text), NULL, NULL, NULL, "* ", -1);
gtk_text_insert(GTK_TEXT(mw->text), NULL, NULL, NULL, msg, -1);
gtk_text_thaw(GTK_TEXT(mw->text));
mw->contains_messages = TRUE;
printf("* %s", msg);
gtk_widget_realize (mw->text);
gtk_text_freeze (GTK_TEXT(mw->text));
gtk_text_insert (GTK_TEXT(mw->text), NULL, NULL, NULL, "* ", -1);
gtk_text_insert (GTK_TEXT(mw->text), NULL, NULL, NULL, msg, -1);
gtk_text_thaw (GTK_TEXT(mw->text));
mw->contains_messages = TRUE;
g_print ("* %s", msg);
}
void message_window_clear(MessageWindow *mw)
void
message_window_clear (MessageWindow *mw)
{
gtk_widget_realize(mw->text);
gtk_text_freeze(GTK_TEXT(mw->text));
gtk_editable_delete_text(GTK_EDITABLE(mw->text), 0, -1);
gtk_text_thaw(GTK_TEXT(mw->text));
mw->contains_messages = FALSE;
gtk_widget_realize (mw->text);
gtk_text_freeze (GTK_TEXT(mw->text));
gtk_editable_delete_text (GTK_EDITABLE(mw->text), 0, -1);
gtk_text_thaw (GTK_TEXT(mw->text));
mw->contains_messages = FALSE;
}
/* vim: set ts=2 sw=2 tw=79 ai nowrap: */