Commit d010bb5f authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

removed more GUI initialisation code.

2001-05-01  Michael Natterer  <mitch@gimp.org>

	* app/app_procs.c: removed more GUI initialisation code.

	* app/color_transfer.c: removed useless includes.

	* app/gui/brush-editor.[ch]
	* app/gui/dialogs-constructors.c:
	s/BrushEditGeneratedWindow/BrushEditor/, s/begw/brush_editor/, made
	the brush preview of the editor autoresizing.

	* app/gui/dialogs.h: removed "extern" declaration of non-existant
	variable.

	* app/gui/gui.[ch]: new function gui_post_init() which shows the
	tips dialog.

	* app/gui/tips-dialog.c: made signal handling nicer (clean up in a
	"destroy" handler).

	* app/gui/toolbox.[ch]: removed toolbox_raise(), removed the help
	system (de)initialisation code which is now in gui.c, cleanup.
parent 2c7f99d9
2001-05-01 Michael Natterer <mitch@gimp.org>
* app/app_procs.c: removed more GUI initialisation code.
* app/color_transfer.c: removed useless includes.
* app/gui/brush-editor.[ch]
* app/gui/dialogs-constructors.c:
s/BrushEditGeneratedWindow/BrushEditor/, s/begw/brush_editor/, made
the brush preview of the editor autoresizing.
* app/gui/dialogs.h: removed "extern" declaration of non-existant
variable.
* app/gui/gui.[ch]
* app/gui/tips-dialog.c
* app/gui/toolbox.[ch]
2001-04-30 Dave Neary <dneary@eircom.net>
* app/tools/tool_options.c: Ensure that option widgets are set to
......
......@@ -59,7 +59,6 @@
#include "gui/file-open-dialog.h"
#include "gui/gui.h"
#include "gui/splash.h"
#include "gui/tips-dialog.h"
#include "appenv.h"
#include "app_procs.h"
......@@ -121,9 +120,10 @@ gimp_init (gint gimp_argc,
batch_init ();
/* Handle showing dialogs with gdk_quit_adds here */
if (!no_interface && show_tips)
tips_dialog_create ();
if (! no_interface)
{
gui_post_init ();
}
}
void
......@@ -266,9 +266,6 @@ app_init (void)
color_transfer_init ();
paint_funcs_setup ();
/* register internal color selectors */
color_select_init ();
if (! no_interface)
{
gui_restore ();
......
......@@ -18,16 +18,12 @@
#include "config.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "libgimpmath/gimpmath.h"
#include "apptypes.h"
#include "appenv.h"
#include "color_transfer.h"
......
......@@ -598,7 +598,7 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
void
dialogs_edit_brush_func (GimpData *data)
{
static BrushEditGeneratedWindow *brush_editor_dialog = NULL;
static BrushEditor *brush_editor_dialog = NULL;
GimpBrush *brush;
......@@ -608,10 +608,10 @@ dialogs_edit_brush_func (GimpData *data)
{
if (! brush_editor_dialog)
{
brush_editor_dialog = brush_edit_generated_new ();
brush_editor_dialog = brush_editor_new ();
}
brush_edit_generated_set_brush (brush_editor_dialog, brush);
brush_editor_set_brush (brush_editor_dialog, brush);
}
else
{
......
......@@ -22,7 +22,6 @@
extern GimpDialogFactory *global_dialog_factory;
extern GimpDialogFactory *global_dock_factory;
extern GimpDialogFactory *global_image_dock_factory;
void dialogs_init (void);
......
......@@ -96,11 +96,12 @@ tips_dialog_create (void)
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_destroy),
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
gtk_signal_connect (GTK_OBJECT (tips_dialog), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&tips_dialog);
GTK_SIGNAL_FUNC (tips_dialog_destroy),
NULL);
/* destroy the tips window if the mainlevel gtk_main() function is left */
gtk_quit_add_destroy (1, GTK_OBJECT (tips_dialog));
......@@ -155,9 +156,9 @@ tips_dialog_create (void)
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_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (tips_dialog));
gtk_container_add (GTK_CONTAINER (bbox), button);
gtk_widget_show (button);
......@@ -198,7 +199,7 @@ tips_dialog_destroy (GtkWidget *widget,
GList *update = NULL; /* options that should be updated in .gimprc */
GList *remove = NULL; /* options that should be commented out */
gtk_widget_destroy (tips_dialog);
tips_dialog = NULL;
/* the last-shown-tip is now saved in sessionrc */
......
This diff is collapsed.
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* brush_edit module Copyright 1998 Jay Cox <jaycox@earthlink.net>
* brush-editor.h
* Copyright 1998 Jay Cox <jaycox@earthlink.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -18,18 +19,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __BRUSH_EDIT_H__
#define __BRUSH_EDIT_H__
#ifndef __BRUSH_EDITOR_H__
#define __BRUSH_EDITOR_H__
typedef struct _BrushEditGeneratedWindow BrushEditGeneratedWindow;
typedef struct _BrushEditor BrushEditor;
BrushEditGeneratedWindow * brush_edit_generated_new (void);
BrushEditor * brush_editor_new (void);
void brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
GimpBrush *brush);
void brush_edit_generated_free (BrushEditGeneratedWindow *begw);
void brush_editor_set_brush (BrushEditor *brush_editor,
GimpBrush *brush);
void brush_editor_free (BrushEditor *brush_editor);
#endif /* __BRUSH_EDIT_H__ */
#endif /* __BRUSH_EDITOR_H__ */
......@@ -598,7 +598,7 @@ dialogs_channel_list_view_new (GimpDialogFactory *factory,
void
dialogs_edit_brush_func (GimpData *data)
{
static BrushEditGeneratedWindow *brush_editor_dialog = NULL;
static BrushEditor *brush_editor_dialog = NULL;
GimpBrush *brush;
......@@ -608,10 +608,10 @@ dialogs_edit_brush_func (GimpData *data)
{
if (! brush_editor_dialog)
{
brush_editor_dialog = brush_edit_generated_new ();
brush_editor_dialog = brush_editor_new ();
}
brush_edit_generated_set_brush (brush_editor_dialog, brush);
brush_editor_set_brush (brush_editor_dialog, brush);
}
else
{
......
......@@ -22,7 +22,6 @@
extern GimpDialogFactory *global_dialog_factory;
extern GimpDialogFactory *global_dock_factory;
extern GimpDialogFactory *global_image_dock_factory;
void dialogs_init (void);
......
......@@ -31,6 +31,7 @@
#include "widgets/gimpdialogfactory.h"
#include "brush-select.h"
#include "color-select.h"
#include "devices.h"
#include "dialogs.h"
#include "docindex.h"
......@@ -77,6 +78,12 @@ gui_init (void)
devices_init ();
session_init ();
/* tooltips */
gimp_help_init ();
if (! show_tool_tips)
gimp_help_disable_tooltips ();
gimp_dialog_factory_dialog_new (global_dialog_factory, "gimp:toolbox");
/* Fill the "last opened" menu items with the first last_opened_size
......@@ -111,10 +118,21 @@ gui_init (void)
void
gui_restore (void)
{
color_select_init ();
devices_restore ();
session_restore ();
}
void
gui_post_init (void)
{
if (show_tips)
{
gimp_dialog_factory_dialog_new (global_dialog_factory, "gimp:tips-dialog");
}
}
void
gui_shutdown (void)
{
......@@ -142,6 +160,8 @@ gui_exit (void)
error_console_free ();
tool_options_dialog_free ();
toolbox_free ();
gimp_help_free ();
}
void
......
......@@ -22,6 +22,8 @@
void gui_init (void);
void gui_restore (void);
void gui_post_init (void);
void gui_shutdown (void);
void gui_exit (void);
......
......@@ -96,11 +96,12 @@ tips_dialog_create (void)
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_destroy),
GTK_SIGNAL_FUNC (gtk_widget_destroy),
NULL);
gtk_signal_connect (GTK_OBJECT (tips_dialog), "destroy",
GTK_SIGNAL_FUNC (gtk_widget_destroyed),
&tips_dialog);
GTK_SIGNAL_FUNC (tips_dialog_destroy),
NULL);
/* destroy the tips window if the mainlevel gtk_main() function is left */
gtk_quit_add_destroy (1, GTK_OBJECT (tips_dialog));
......@@ -155,9 +156,9 @@ tips_dialog_create (void)
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_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (tips_dialog));
gtk_container_add (GTK_CONTAINER (bbox), button);
gtk_widget_show (button);
......@@ -198,7 +199,7 @@ tips_dialog_destroy (GtkWidget *widget,
GList *update = NULL; /* options that should be updated in .gimprc */
GList *remove = NULL; /* options that should be commented out */
gtk_widget_destroy (tips_dialog);
tips_dialog = NULL;
/* the last-shown-tip is now saved in sessionrc */
......
......@@ -31,12 +31,14 @@
#include "tools/gimptoolinfo.h"
#include "tools/tool_manager.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimppreview.h"
#include "widgets/gtkhwrapbox.h"
#include "color-area.h"
#include "devices.h"
#include "dialog_handler.h"
#include "dialogs.h"
#include "dialogs-commands.h"
#include "gdisplay.h"
#include "gimpdnd.h"
......@@ -126,8 +128,8 @@ toolbox_tool_button_press (GtkWidget *widget,
{
if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1))
{
dialogs_create_toplevel_cmd_callback (NULL, NULL,
GPOINTER_TO_UINT ("gimp:tool-options-dialog"));
gimp_dialog_factory_dialog_new (global_dialog_factory,
"gimp:tool-options-dialog");
}
return FALSE;
......@@ -263,27 +265,19 @@ toolbox_tool_changed (GimpContext *context,
}
static void
create_tools (GtkWidget *parent,
create_tools (GtkWidget *wbox,
GimpContext *context)
{
GtkWidget *wbox;
GtkWidget *button;
GtkWidget *alignment;
GList *list;
GSList *group;
wbox = parent;
if (! GTK_WIDGET_REALIZED (gtk_widget_get_toplevel (wbox)))
gtk_widget_realize (gtk_widget_get_toplevel (wbox));
group = NULL;
GList *list;
GSList *group = NULL;
for (list = GIMP_LIST (global_tool_info_list)->list;
list;
list = g_list_next (list))
{
GimpToolInfo *tool_info;
GtkWidget *alignment;
GtkWidget *button;
GtkWidget *preview;
tool_info = (GimpToolInfo *) list->data;
......@@ -334,11 +328,12 @@ toolbox_create (void)
GtkWidget *window;
GtkWidget *main_vbox;
GtkWidget *wbox;
GtkWidget *menubar;
GList *list;
GtkAccelGroup *table;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
gtk_window_set_title (GTK_WINDOW (window), _("The GIMP"));
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
/* Register dialog */
dialog_register_toolbox (window);
......@@ -351,6 +346,10 @@ toolbox_create (void)
GTK_SIGNAL_FUNC (toolbox_destroy),
NULL);
gtk_signal_connect (GTK_OBJECT (window), "style_set",
GTK_SIGNAL_FUNC (toolbox_style_set_callback),
NULL);
/* We need to know when the current device changes, so we can update
* the correct tool - to do this we connect to motion events.
* We can't just use EXTENSION_EVENTS_CURSOR though, since that
......@@ -373,39 +372,19 @@ toolbox_create (void)
gtk_widget_set_events (window, GDK_POINTER_MOTION_MASK);
gtk_widget_set_extension_events (window, GDK_EXTENSION_EVENTS_CURSOR);
}
/* set up the window geometry after the events have been set,
since we need to realize the widget */
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
gtk_window_set_title (GTK_WINDOW (window), _("The GIMP"));
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
gtk_signal_connect (GTK_OBJECT (window), "style_set",
GTK_SIGNAL_FUNC (toolbox_style_set_callback),
NULL);
toolbox_factory = menus_get_toolbox_factory ();
main_vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1);
gtk_container_add (GTK_CONTAINER (window), main_vbox);
gtk_widget_show (main_vbox);
/* tooltips */
gimp_help_init ();
if (!show_tool_tips)
gimp_help_disable_tooltips ();
/* Build the menu bar with menus */
toolbox_factory = menus_get_toolbox_factory ();
menubar = toolbox_factory->widget;
table = toolbox_factory->accel_group;
gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
gtk_widget_show (menubar);
gtk_box_pack_start (GTK_BOX (main_vbox), toolbox_factory->widget,
FALSE, TRUE, 0);
gtk_widget_show (toolbox_factory->widget);
/* Install the accelerator table in the main window */
gtk_window_add_accel_group (GTK_WINDOW (window), table);
gtk_window_add_accel_group (GTK_WINDOW (window), toolbox_factory->accel_group);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (window,
......@@ -459,14 +438,6 @@ void
toolbox_free (void)
{
gtk_widget_destroy (toolbox_shell);
gimp_help_free ();
}
void
toolbox_raise (void)
{
gdk_window_raise (toolbox_shell->window);
}
static void
......
......@@ -23,7 +23,5 @@
GtkWidget * toolbox_create (void);
void toolbox_free (void);
void toolbox_raise (void);
#endif /* __TOOLBOX_H__ */
This diff is collapsed.
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* brush_edit module Copyright 1998 Jay Cox <jaycox@earthlink.net>
* brush-editor.h
* Copyright 1998 Jay Cox <jaycox@earthlink.net>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
......@@ -18,18 +19,18 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __BRUSH_EDIT_H__
#define __BRUSH_EDIT_H__
#ifndef __BRUSH_EDITOR_H__
#define __BRUSH_EDITOR_H__
typedef struct _BrushEditGeneratedWindow BrushEditGeneratedWindow;
typedef struct _BrushEditor BrushEditor;
BrushEditGeneratedWindow * brush_edit_generated_new (void);
BrushEditor * brush_editor_new (void);
void brush_edit_generated_set_brush (BrushEditGeneratedWindow *begw,
GimpBrush *brush);
void brush_edit_generated_free (BrushEditGeneratedWindow *begw);
void brush_editor_set_brush (BrushEditor *brush_editor,
GimpBrush *brush);
void brush_editor_free (BrushEditor *brush_editor);
#endif /* __BRUSH_EDIT_H__ */
#endif /* __BRUSH_EDITOR_H__ */
......@@ -31,12 +31,14 @@
#include "tools/gimptoolinfo.h"
#include "tools/tool_manager.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimppreview.h"
#include "widgets/gtkhwrapbox.h"
#include "color-area.h"
#include "devices.h"
#include "dialog_handler.h"
#include "dialogs.h"
#include "dialogs-commands.h"
#include "gdisplay.h"
#include "gimpdnd.h"
......@@ -126,8 +128,8 @@ toolbox_tool_button_press (GtkWidget *widget,
{
if ((event->type == GDK_2BUTTON_PRESS) && (event->button == 1))
{
dialogs_create_toplevel_cmd_callback (NULL, NULL,
GPOINTER_TO_UINT ("gimp:tool-options-dialog"));
gimp_dialog_factory_dialog_new (global_dialog_factory,
"gimp:tool-options-dialog");
}
return FALSE;
......@@ -263,27 +265,19 @@ toolbox_tool_changed (GimpContext *context,
}
static void
create_tools (GtkWidget *parent,
create_tools (GtkWidget *wbox,
GimpContext *context)
{
GtkWidget *wbox;
GtkWidget *button;
GtkWidget *alignment;
GList *list;
GSList *group;
wbox = parent;
if (! GTK_WIDGET_REALIZED (gtk_widget_get_toplevel (wbox)))
gtk_widget_realize (gtk_widget_get_toplevel (wbox));
group = NULL;
GList *list;
GSList *group = NULL;
for (list = GIMP_LIST (global_tool_info_list)->list;
list;
list = g_list_next (list))
{
GimpToolInfo *tool_info;
GtkWidget *alignment;
GtkWidget *button;
GtkWidget *preview;
tool_info = (GimpToolInfo *) list->data;
......@@ -334,11 +328,12 @@ toolbox_create (void)
GtkWidget *window;
GtkWidget *main_vbox;
GtkWidget *wbox;
GtkWidget *menubar;
GList *list;
GtkAccelGroup *table;
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
gtk_window_set_title (GTK_WINDOW (window), _("The GIMP"));
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
/* Register dialog */
dialog_register_toolbox (window);
......@@ -351,6 +346,10 @@ toolbox_create (void)
GTK_SIGNAL_FUNC (toolbox_destroy),
NULL);
gtk_signal_connect (GTK_OBJECT (window), "style_set",
GTK_SIGNAL_FUNC (toolbox_style_set_callback),
NULL);
/* We need to know when the current device changes, so we can update
* the correct tool - to do this we connect to motion events.
* We can't just use EXTENSION_EVENTS_CURSOR though, since that
......@@ -373,39 +372,19 @@ toolbox_create (void)
gtk_widget_set_events (window, GDK_POINTER_MOTION_MASK);
gtk_widget_set_extension_events (window, GDK_EXTENSION_EVENTS_CURSOR);
}
/* set up the window geometry after the events have been set,
since we need to realize the widget */
gtk_window_set_wmclass (GTK_WINDOW (window), "toolbox", "Gimp");
gtk_window_set_title (GTK_WINDOW (window), _("The GIMP"));
gtk_window_set_policy (GTK_WINDOW (window), TRUE, TRUE, FALSE);
gtk_signal_connect (GTK_OBJECT (window), "style_set",
GTK_SIGNAL_FUNC (toolbox_style_set_callback),
NULL);
toolbox_factory = menus_get_toolbox_factory ();
main_vbox = gtk_vbox_new (FALSE, 1);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 1);
gtk_container_add (GTK_CONTAINER (window), main_vbox);
gtk_widget_show (main_vbox);
/* tooltips */
gimp_help_init ();
if (!show_tool_tips)
gimp_help_disable_tooltips ();
/* Build the menu bar with menus */
toolbox_factory = menus_get_toolbox_factory ();
menubar = toolbox_factory->widget;
table = toolbox_factory->accel_group;
gtk_box_pack_start (GTK_BOX (main_vbox), menubar, FALSE, TRUE, 0);
gtk_widget_show (menubar);
gtk_box_pack_start (GTK_BOX (main_vbox), toolbox_factory->widget,
FALSE, TRUE, 0);
gtk_widget_show (toolbox_factory->widget);
/* Install the accelerator table in the main window */
gtk_window_add_accel_group (GTK_WINDOW (window), table);
gtk_window_add_accel_group (GTK_WINDOW (window), toolbox_factory->accel_group);
/* Connect the "F1" help key */
gimp_help_connect_help_accel (window,
......@@ -459,14 +438,6 @@ void
toolbox_free (void)
{