Commit f283b957 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

app/session.[ch] removed the old dialog session management code...

2001-04-17  Michael Natterer  <mitch@gimp.org>

	* app/session.[ch]
	* app/gimprc.c: removed the old dialog session management code...

	* app/widgets/gimpdialogfactory.[ch]: ...and manage all dialogs here.

	* app/gui/dialogs-constructors.[ch]: dialog factory compliant
	constructors for all session managed toplevel dialogs.

	* app/brush_select.[ch]
	* app/devices.[ch]
	* app/docindex.[ch]
	* app/errorconsole.[ch]
	* app/gradient_select.[ch]
	* app/info_dialog.c
	* app/lc_dialog.[ch]
	* app/palette.[ch]
	* app/pattern_select.[ch]
	* app/toolbox.[ch]
	* app/tools/tool_options_dialog.[ch]: all dialog constructors have
	to return the dialog now (even the legacy ones that will go away).
	Removed the session management code as this is now done for the
	dialogs, not by them.

	* app/app_procs.c
	* app/color_select.c
	* app/commands.[ch]
	* app/indicator_area.c
	* app/menus.c
	* app/palette_select.c
	* app/preferences_dialog.c
	* app/gui/dialogs.c
	* app/gui/dialogs-commands.[ch]
	* app/gui/gui.c
	* app/tools/gimptool.c
	* app/widgets/gimpdock.c: changed accordingly.
parent 53802634
2001-04-17 Michael Natterer <mitch@gimp.org>
* app/session.[ch]
* app/gimprc.c: removed the old dialog session management code...
* app/widgets/gimpdialogfactory.[ch]: ...and manage all dialogs here.
* app/gui/dialogs-constructors.[ch]: dialog factory compliant
constructors for all session managed toplevel dialogs.
* app/brush_select.[ch]
* app/devices.[ch]
* app/docindex.[ch]
* app/errorconsole.[ch]
* app/gradient_select.[ch]
* app/info_dialog.c
* app/lc_dialog.[ch]
* app/palette.[ch]
* app/pattern_select.[ch]
* app/toolbox.[ch]
* app/tools/tool_options_dialog.[ch]: all dialog constructors have
to return the dialog now (even the legacy ones that will go away).
Removed the session management code as this is now done for the
dialogs, not by them.
* app/app_procs.c
* app/color_select.c
* app/commands.[ch]
* app/indicator_area.c
* app/menus.c
* app/palette_select.c
* app/preferences_dialog.c
* app/gui/dialogs.c
* app/gui/dialogs-commands.[ch]
* app/gui/gui.c
* app/tools/gimptool.c
* app/widgets/gimpdock.c: changed accordingly.
2001-04-16 Michael Natterer <mitch@gimp.org>
First attempt to get the docks session managed:
......
......@@ -27,9 +27,22 @@
#include "widgets/gimpdockable.h"
#include "widgets/gimpdockbook.h"
#include "dialogs.h"
#include "dialogs-commands.h"
void
dialogs_create_toplevel_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
if (action)
{
gimp_dialog_factory_dialog_new (global_dialog_factory,
GUINT_TO_POINTER (action));
}
}
void
dialogs_add_tab_cmd_callback (GtkWidget *widget,
gpointer data,
......
......@@ -20,12 +20,16 @@
#define __DIALOGS_COMMANDS_H__
void dialogs_add_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_remove_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_create_toplevel_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_add_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
void dialogs_remove_tab_cmd_callback (GtkWidget *widget,
gpointer data,
guint action);
#endif /* __DIALOGS_COMMANDS_H__ */
......@@ -31,12 +31,10 @@
#include "tools/gimptool.h"
#include "tools/gimptoolinfo.h"
#include "tools/tool_options_dialog.h"
#include "tools/tool_manager.h"
#include "about_dialog.h"
#include "app_procs.h"
#include "brush_select.h"
#include "colormap_dialog.h"
#include "color_area.h"
#include "commands.h"
......@@ -44,7 +42,6 @@
#include "convert.h"
#include "desaturate.h"
#include "devices.h"
#include "docindex.h"
#include "channel_ops.h"
#include "equalize.h"
#include "errorconsole.h"
......@@ -62,7 +59,6 @@
#include "gimprc.h"
#include "gimpui.h"
#include "global_edit.h"
#include "gradient_select.h"
#include "image_render.h"
#include "info_dialog.h"
#include "info_window.h"
......@@ -72,8 +68,6 @@
#include "layer_select.h"
#include "layers_dialogP.h"
#include "module_db.h"
#include "palette.h"
#include "pattern_select.h"
#include "plug_in.h"
#include "preferences_dialog.h"
#include "resize.h"
......@@ -1206,51 +1200,6 @@ dialogs_preferences_cmd_callback (GtkWidget *widget,
preferences_dialog_create ();
}
void
dialogs_lc_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
gdisp = gdisplay_active ();
lc_dialog_create (gdisp ? gdisp->gimage : NULL);
}
void
dialogs_tool_options_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
tool_options_dialog_show ();
}
void
dialogs_brushes_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
brush_dialog_create ();
}
void
dialogs_patterns_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
pattern_dialog_create ();
}
void
dialogs_gradients_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
gradient_dialog_create ();
}
void
dialogs_palette_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
palette_dialog_create ();
}
static void
dialogs_indexed_palette_select_callback (GimpColormapDialog *dialog,
gpointer data)
......@@ -1303,27 +1252,6 @@ dialogs_input_devices_cmd_callback (GtkWidget *widget,
input_dialog_create ();
}
void
dialogs_device_status_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
device_status_create ();
}
void
dialogs_document_index_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
document_index_create ();
}
void
dialogs_error_console_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
error_console_add (NULL);
}
#ifdef DISPLAY_FILTERS
void
dialogs_display_filters_cmd_callback (GtkWidget *widget,
......
......@@ -117,17 +117,8 @@ void filters_repeat_cmd_callback (GtkWidget *widget,
guint callback_action);
void dialogs_preferences_cmd_callback (GtkWidget *, gpointer);
void dialogs_lc_cmd_callback (GtkWidget *, gpointer);
void dialogs_tool_options_cmd_callback (GtkWidget *, gpointer);
void dialogs_brushes_cmd_callback (GtkWidget *, gpointer);
void dialogs_patterns_cmd_callback (GtkWidget *, gpointer);
void dialogs_gradients_cmd_callback (GtkWidget *, gpointer);
void dialogs_palette_cmd_callback (GtkWidget *, gpointer);
void dialogs_indexed_palette_cmd_callback (GtkWidget *, gpointer);
void dialogs_input_devices_cmd_callback (GtkWidget *, gpointer);
void dialogs_device_status_cmd_callback (GtkWidget *, gpointer);
void dialogs_document_index_cmd_callback (GtkWidget *, gpointer);
void dialogs_error_console_cmd_callback (GtkWidget *, gpointer);
void dialogs_undo_history_cmd_callback (GtkWidget *, gpointer);
void dialogs_module_browser_cmd_callback (GtkWidget *, gpointer);
......
......@@ -315,7 +315,6 @@ app_exit_finish (void)
}
module_db_free ();
lc_dialog_free ();
gdisplays_delete ();
global_edit_free ();
named_buffers_free ();
......
......@@ -39,7 +39,6 @@
#include "gimpdata.h"
#include "gimpdatafactory.h"
#include "gimprc.h"
#include "session.h"
#include "temp_buf.h"
#include "tools/paint_options.h"
......@@ -97,7 +96,7 @@ static BrushEditGeneratedWindow *brush_edit_generated_dialog = NULL;
/* public functions */
void
GtkWidget *
brush_dialog_create (void)
{
if (! brush_select_dialog)
......@@ -111,6 +110,8 @@ brush_dialog_create (void)
else
gdk_window_raise (brush_select_dialog->shell->window);
}
return brush_select_dialog->shell;
}
void
......@@ -118,15 +119,6 @@ brush_dialog_free (void)
{
if (brush_select_dialog)
{
session_get_window_info (brush_select_dialog->shell,
&brush_select_session_info);
/* save the size of the preview */
brush_select_session_info.width =
brush_select_dialog->view->allocation.width;
brush_select_session_info.height =
brush_select_dialog->view->allocation.height;
brush_select_free (brush_select_dialog);
brush_select_dialog = NULL;
}
......@@ -182,8 +174,6 @@ brush_select_new (gchar *title,
{
bsp->context = gimp_context_get_user ();
session_set_window_geometry (bsp->shell, &brush_select_session_info,
FALSE);
dialog_register (bsp->shell);
}
......
......@@ -74,8 +74,8 @@ void brush_select_show_paint_options (BrushSelect *bsp,
/* the main brush selection */
GtkWidget * brush_dialog_create (void);
void brush_dialog_free (void);
void brush_dialog_create (void);
#endif /* __BRUSH_SELECT_H__ */
......@@ -34,7 +34,6 @@
#include "colormaps.h"
#include "gimpdnd.h"
#include "gimprc.h"
#include "session.h"
#include "color_area.h"
#include "libgimp/gimpcolorselector.h"
......
......@@ -31,12 +31,10 @@
#include "tools/gimptool.h"
#include "tools/gimptoolinfo.h"
#include "tools/tool_options_dialog.h"
#include "tools/tool_manager.h"
#include "about_dialog.h"
#include "app_procs.h"
#include "brush_select.h"
#include "colormap_dialog.h"
#include "color_area.h"
#include "commands.h"
......@@ -44,7 +42,6 @@
#include "convert.h"
#include "desaturate.h"
#include "devices.h"
#include "docindex.h"
#include "channel_ops.h"
#include "equalize.h"
#include "errorconsole.h"
......@@ -62,7 +59,6 @@
#include "gimprc.h"
#include "gimpui.h"
#include "global_edit.h"
#include "gradient_select.h"
#include "image_render.h"
#include "info_dialog.h"
#include "info_window.h"
......@@ -72,8 +68,6 @@
#include "layer_select.h"
#include "layers_dialogP.h"
#include "module_db.h"
#include "palette.h"
#include "pattern_select.h"
#include "plug_in.h"
#include "preferences_dialog.h"
#include "resize.h"
......@@ -1206,51 +1200,6 @@ dialogs_preferences_cmd_callback (GtkWidget *widget,
preferences_dialog_create ();
}
void
dialogs_lc_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
GDisplay *gdisp;
gdisp = gdisplay_active ();
lc_dialog_create (gdisp ? gdisp->gimage : NULL);
}
void
dialogs_tool_options_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
tool_options_dialog_show ();
}
void
dialogs_brushes_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
brush_dialog_create ();
}
void
dialogs_patterns_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
pattern_dialog_create ();
}
void
dialogs_gradients_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
gradient_dialog_create ();
}
void
dialogs_palette_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
palette_dialog_create ();
}
static void
dialogs_indexed_palette_select_callback (GimpColormapDialog *dialog,
gpointer data)
......@@ -1303,27 +1252,6 @@ dialogs_input_devices_cmd_callback (GtkWidget *widget,
input_dialog_create ();
}
void
dialogs_device_status_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
device_status_create ();
}
void
dialogs_document_index_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
document_index_create ();
}
void
dialogs_error_console_cmd_callback (GtkWidget *widget,
gpointer client_data)
{
error_console_add (NULL);
}
#ifdef DISPLAY_FILTERS
void
dialogs_display_filters_cmd_callback (GtkWidget *widget,
......
......@@ -117,17 +117,8 @@ void filters_repeat_cmd_callback (GtkWidget *widget,
guint callback_action);
void dialogs_preferences_cmd_callback (GtkWidget *, gpointer);
void dialogs_lc_cmd_callback (GtkWidget *, gpointer);
void dialogs_tool_options_cmd_callback (GtkWidget *, gpointer);
void dialogs_brushes_cmd_callback (GtkWidget *, gpointer);
void dialogs_patterns_cmd_callback (GtkWidget *, gpointer);
void dialogs_gradients_cmd_callback (GtkWidget *, gpointer);
void dialogs_palette_cmd_callback (GtkWidget *, gpointer);
void dialogs_indexed_palette_cmd_callback (GtkWidget *, gpointer);
void dialogs_input_devices_cmd_callback (GtkWidget *, gpointer);
void dialogs_device_status_cmd_callback (GtkWidget *, gpointer);
void dialogs_document_index_cmd_callback (GtkWidget *, gpointer);
void dialogs_error_console_cmd_callback (GtkWidget *, gpointer);
void dialogs_undo_history_cmd_callback (GtkWidget *, gpointer);
void dialogs_module_browser_cmd_callback (GtkWidget *, gpointer);
......
......@@ -45,7 +45,6 @@
#include "gimppattern.h"
#include "gimplist.h"
#include "gimprc.h"
#include "session.h"
#include "libgimp/gimpenv.h"
#include "libgimp/gimpintl.h"
......@@ -210,7 +209,7 @@ device_info_get_by_name (gchar *name)
/* the gtk input dialog */
void
void
input_dialog_create (void)
{
static GtkWidget *inputd = NULL;
......@@ -738,7 +737,7 @@ devices_write_rc (void)
fclose (fp);
}
void
GtkWidget *
device_status_create (void)
{
DeviceInfo *device_info;
......@@ -747,220 +746,218 @@ device_status_create (void)
GList *list;
gint i;
if (deviceD == NULL)
if (deviceD)
{
deviceD = g_new (DeviceInfoDialog, 1);
if (! GTK_WIDGET_MAPPED (deviceD->shell))
gtk_widget_show (deviceD->shell);
else
gdk_window_raise (deviceD->shell->window);
deviceD->shell =
gimp_dialog_new (_("Device Status"), "device_status",
gimp_standard_help_func,
"dialogs/device_status.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, TRUE,
return deviceD->shell;
}
_("Save"), (GtkSignalFunc) devices_write_rc,
NULL, NULL, NULL, FALSE, FALSE,
_("Close"), devices_close_callback,
NULL, NULL, NULL, TRUE, TRUE,
deviceD = g_new (DeviceInfoDialog, 1);
NULL);
deviceD->shell = gimp_dialog_new (_("Device Status"), "device_status",
gimp_standard_help_func,
"dialogs/device_status.html",
GTK_WIN_POS_NONE,
FALSE, FALSE, TRUE,
dialog_register (deviceD->shell);
session_set_window_geometry (deviceD->shell, &device_status_session_info,
FALSE);
_("Save"), (GtkSignalFunc) devices_write_rc,
NULL, NULL, NULL, FALSE, FALSE,
_("Close"), devices_close_callback,
NULL, NULL, NULL, TRUE, TRUE,
deviceD->num_devices = 0;
NULL);
for (list = device_info_list; list; list = g_list_next (list))
{
if (((DeviceInfo *) list->data)->is_present)
deviceD->num_devices++;
}
dialog_register (deviceD->shell);
/* devices table */
deviceD->table = gtk_table_new (deviceD->num_devices, 7, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (deviceD->table), 3);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (deviceD->shell)->vbox),
deviceD->table);
gtk_widget_realize (deviceD->table);
gtk_widget_show (deviceD->table);
deviceD->ids = g_new (guint32, deviceD->num_devices);
deviceD->frames = g_new (GtkWidget *, deviceD->num_devices);
deviceD->tools = g_new (GtkWidget *, deviceD->num_devices);
deviceD->foregrounds = g_new (GtkWidget *, deviceD->num_devices);
deviceD->backgrounds = g_new (GtkWidget *, deviceD->num_devices);
deviceD->brushes = g_new (GtkWidget *, deviceD->num_devices);
deviceD->patterns = g_new (GtkWidget *, deviceD->num_devices);
deviceD->gradients = g_new (GtkWidget *, deviceD->num_devices);
for (list = device_info_list, i = 0; list; list = g_list_next (list), i++)
{
if (!((DeviceInfo *) list->data)->is_present)
continue;
device_info = (DeviceInfo *) list->data;
deviceD->ids[i] = device_info->device;
/* the device name */
deviceD->frames[i] = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(deviceD->frames[i]),
GTK_SHADOW_OUT);
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->frames[i],
0, 1, i, i+1,
GTK_FILL, GTK_FILL, 2, 0);
label = gtk_label_new (device_info->name);
gtk_misc_set_padding (GTK_MISC(label), 2, 0);
gtk_container_add (GTK_CONTAINER(deviceD->frames[i]), label);
gtk_widget_show(label);
/* the tool */
deviceD->tools[i] =
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_tool (device_info->context)),
CELL_SIZE, CELL_SIZE, 0,
FALSE, FALSE, TRUE);
gtk_signal_connect_object_while_alive
(GTK_OBJECT (device_info->context),
"tool_changed",
GTK_SIGNAL_FUNC (gimp_preview_set_viewable),
GTK_OBJECT (deviceD->tools[i]));
gimp_gtk_drag_dest_set_by_type (deviceD->tools[i],
GTK_DEST_DEFAULT_ALL,
GIMP_TYPE_TOOL_INFO,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (deviceD->tools[i],
deviceD->num_devices = 0;
for (list = device_info_list; list; list = g_list_next (list))
{
if (((DeviceInfo *) list->data)->is_present)
deviceD->num_devices++;
}
/* devices table */
deviceD->table = gtk_table_new (deviceD->num_devices, 7, FALSE);
gtk_container_set_border_width (GTK_CONTAINER (deviceD->table), 3);
gtk_container_add (GTK_CONTAINER (GTK_DIALOG (deviceD->shell)->vbox),
deviceD->table);
gtk_widget_realize (deviceD->table);
gtk_widget_show (deviceD->table);
deviceD->ids = g_new (guint32, deviceD->num_devices);
deviceD->frames = g_new (GtkWidget *, deviceD->num_devices);
deviceD->tools = g_new (GtkWidget *, deviceD->num_devices);
deviceD->foregrounds = g_new (GtkWidget *, deviceD->num_devices);
deviceD->backgrounds = g_new (GtkWidget *, deviceD->num_devices);
deviceD->brushes = g_new (GtkWidget *, deviceD->num_devices);
deviceD->patterns = g_new (GtkWidget *, deviceD->num_devices);
deviceD->gradients = g_new (GtkWidget *, deviceD->num_devices);
for (list = device_info_list, i = 0; list; list = g_list_next (list), i++)
{
if (!((DeviceInfo *) list->data)->is_present)
continue;
device_info = (DeviceInfo *) list->data;
deviceD->ids[i] = device_info->device;
/* the device name */
deviceD->frames[i] = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME(deviceD->frames[i]), GTK_SHADOW_OUT);
gtk_table_attach (GTK_TABLE(deviceD->table), deviceD->frames[i],
0, 1, i, i+1,
GTK_FILL, GTK_FILL, 2, 0);
label = gtk_label_new (device_info->name);
gtk_misc_set_padding (GTK_MISC(label), 2, 0);
gtk_container_add (GTK_CONTAINER(deviceD->frames[i]), label);
gtk_widget_show(label);
/* the tool */
deviceD->tools[i] =
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_tool (device_info->context)),
CELL_SIZE, CELL_SIZE, 0,
FALSE, FALSE, TRUE);
gtk_signal_connect_object_while_alive
(GTK_OBJECT (device_info->context),
"tool_changed",
GTK_SIGNAL_FUNC (gimp_preview_set_viewable),
GTK_OBJECT (deviceD->tools[i]));
gimp_gtk_drag_dest_set_by_type (deviceD->tools[i],
GTK_DEST_DEFAULT_ALL,
GIMP_TYPE_TOOL_INFO,
device_status_drop_tool,
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE (deviceD->table), deviceD->tools[i],
1, 2, i, i+1,
0, 0, 2, 2);
/* the foreground color */
deviceD->foregrounds[i] =
gimp_color_area_new (&color,
GIMP_COLOR_AREA_FLAT,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
gtk_widget_set_usize (deviceD->foregrounds[i], CELL_SIZE, CELL_SIZE);
gtk_signal_connect (GTK_OBJECT (deviceD->foregrounds[i]),
"color_changed",
GTK_SIGNAL_FUNC (device_status_foreground_changed),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE (deviceD->table),
deviceD->foregrounds[i],
2, 3, i, i+1,
0, 0, 2, 2);
/* the background color */
deviceD->backgrounds[i] =
gimp_color_area_new (&color,
GIMP_COLOR_AREA_FLAT,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
gtk_widget_set_usize (deviceD->backgrounds[i], CELL_SIZE, CELL_SIZE);
gtk_signal_connect (GTK_OBJECT (deviceD->backgrounds[i]),
"color_changed",
GTK_SIGNAL_FUNC (device_status_background_changed),
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE (deviceD->table),
deviceD->backgrounds[i],
3, 4, i, i+1,
0, 0, 2, 2);
/* the brush */
deviceD->brushes[i] =
gimp_preview_new_full (GIMP_VIEWABLE (gimp_context_get_brush (device_info->context)),
CELL_SIZE, CELL_SIZE, 0,
FALSE, FALSE, TRUE);
gtk_signal_connect_object_while_alive
(GTK_OBJECT (device_info->context),
"brush_changed",
GTK_SIGNAL_FUNC (gimp_preview_set_viewable),
GTK_OBJECT (deviceD->brushes[i]));
gimp_gtk_drag_dest_set_by_type (deviceD->brushes[i],
GTK_DEST_DEFAULT_ALL,
GIMP_TYPE_BRUSH,
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (deviceD->brushes[i],
GDK_ACTION_COPY);
gimp_dnd_viewable_dest_set (deviceD->tools[i],
GIMP_TYPE_TOOL_INFO,
device_status_drop_tool,
GUINT_TO_POINTER (device_info->device));
gtk_table_attach (GTK_TABLE (deviceD->table), deviceD->tools[i],
1, 2, i, i+1,
0, 0, 2, 2);
/* the foreground color */
deviceD->foregrounds[i] =
gimp_color_area_new (&color,
GIMP_COLOR_AREA_FLAT,
GDK_BUTTON1_MASK | GDK_BUTTON2_MASK);
gtk_widget_set_usize (deviceD->foregrounds[i], CELL_SIZE, CELL_SIZE);
gtk_signal_connect (GTK_OBJECT (deviceD->foregrounds[i]),
"color_changed",
GTK_SIGNAL_FUNC (device_status_foreground_changed),