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

app/Makefile.am removed.

2001-07-20  Michael Natterer  <mitch@gimp.org>

	* app/Makefile.am
	* app/dialog_handler.[ch]: removed.

	* app/widgets/gimpdialogfactory.[ch]: added the missing features
	from the dialog_handler: idle/unidle all dialogs and the show_all
	-> hide_all -> show_toolbox -> show_all cycling (a bit ugly
	currently because the toolbox's factory and it's identifier has to
	be passed to gimp_dialog_factories_toggle()).

	* app/disp_callbacks.c
	* app/gui/gui.c: call the new dialog factory class methods.

	* app/devices.c
	* app/docindex.c
	* app/errorconsole.c
	* app/nav_window.c
	* app/undo_history.c
	* app/gui/info-dialog.c
	* app/gui/file-open-dialog.c
	* app/gui/file-save-dialog.c: currently "unmanaged" because they
	are not yet registered with a dialog factory.

	* app/gui/menus.c: ditto for the tearoff menus.

	* app/gui/brush-select.c
	* app/gui/colormap-dialog.c
	* app/gui/gradient-select.c
	* app/gui/palette-select.c
	* app/gui/pattern-select.c
	* app/gui/tool-options-dialog.c
	* app/gui/toolbox.c: these are already factory created so toggling
	and (un)idling works like before.

	* app/widgets/gimpdock.c: reduced the minimal width from 280 to 250.

	* app/widgets/gimplayerlistview.c: use a toggle button instead of
	a check button for "Keep transp.".
parent 35d7c141
2001-07-20 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/dialog_handler.[ch]: removed.
* app/widgets/gimpdialogfactory.[ch]: added the missing features
from the dialog_handler: idle/unidle all dialogs and the show_all
-> hide_all -> show_toolbox -> show_all cycling (a bit ugly
currently because the toolbox's factory and it's identifier has to
be passed to gimp_dialog_factories_toggle()).
* app/disp_callbacks.c
* app/gui/gui.c: call the new dialog factory class methods.
* app/devices.c
* app/docindex.c
* app/errorconsole.c
* app/nav_window.c
* app/undo_history.c
* app/gui/info-dialog.c
* app/gui/file-open-dialog.c
* app/gui/file-save-dialog.c: currently "unmanaged" because they
are not yet registered with a dialog factory.
* app/gui/menus.c: ditto for the tearoff menus.
* app/gui/brush-select.c
* app/gui/colormap-dialog.c
* app/gui/gradient-select.c
* app/gui/palette-select.c
* app/gui/pattern-select.c
* app/gui/tool-options-dialog.c
* app/gui/toolbox.c: these are already factory created so toggling
and (un)idling works like before.
* app/widgets/gimpdock.c: reduced the minimal width from 280 to 250.
* app/widgets/gimplayerlistview.c: use a toggle button instead of
a check button for "Keep transp.".
2001-07-19 Sven Neumann <sven@gimp.org>
* configure.in: ran autoupdate on this file
......
......@@ -14,8 +14,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \
colormaps.h \
devices.c \
devices.h \
dialog_handler.c \
dialog_handler.h \
docindex.c \
docindex.h \
errorconsole.c \
......
......@@ -44,7 +44,6 @@
#include "appenv.h"
#include "app_procs.h"
#include "devices.h"
#include "dialog_handler.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
......@@ -220,9 +219,6 @@ input_dialog_create (void)
inputd = gtk_input_dialog_new ();
/* register this one only */
dialog_register (inputd);
gtk_container_set_border_width
(GTK_CONTAINER (GTK_DIALOG (inputd)->action_area), 2);
gtk_box_set_homogeneous (GTK_BOX (GTK_DIALOG (inputd)->action_area),
......@@ -761,8 +757,6 @@ device_status_create (void)
NULL);
dialog_register (deviceD->shell);
deviceD->num_devices = 0;
for (list = device_info_list; list; list = g_list_next (list))
......
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* Copyright (C) 1999 Andy Thomas (alt@picnic.demon.co.uk)
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#define __DIALOG_HANDLER_C__ 1
#include "config.h"
#include <gtk/gtk.h>
#include <gmodule.h>
#include "widgets/widgets-types.h"
#include "widgets/gimpcursor.h"
#include "dialog_handler.h"
/* State of individual dialogs */
typedef enum
{
VISIBILITY_INVISIBLE,
VISIBILITY_VISIBLE,
VISIBILITY_UNKNOWN
} VisibilityState;
typedef struct _DialogState DialogState;
struct _DialogState
{
GtkWidget *dialog;
VisibilityState saved_state;
};
/* This keeps track of the state the dialogs are in
* ie how many times we have pressed the tab key
*/
typedef enum
{
SHOW_ALL,
HIDE_ALL,
SHOW_TOOLBOX,
LAST_SHOW_STATE
} ShowState;
/* Start off with all dialogs showing */
static ShowState dialogs_showing = SHOW_ALL;
/* Prevent multiple keypresses from unsetting me. */
static gboolean doing_update = FALSE;
/* List of dialogs that have been created and are on screen
* (may be hidden already).
*/
static GSList * active_dialogs = NULL;
/* Used as a placeholder when a member of active_dialogs is removed due to
* a detected error.
*/
static GSList error_tmp_list = { NULL, NULL };
/* Those have a special behaviour */
static DialogState * toolbox_shell = NULL;
static DialogState * fileload_shell = NULL;
/* Private */
/* Hide all currently registered dialogs */
static void
dialog_hide_all (void)
{
DialogState *dstate;
GSList *list;
for (list = active_dialogs; list; list = g_slist_next (list))
{
dstate = (DialogState *) list->data;
if (GTK_WIDGET_VISIBLE (dstate->dialog))
{
dstate->saved_state = VISIBILITY_VISIBLE;
gtk_widget_hide (dstate->dialog);
}
else
{
dstate->saved_state = VISIBILITY_INVISIBLE;
}
}
}
/* Show all currently registered dialogs */
static void
dialog_show_all (void)
{
DialogState *dstate;
GSList *list;
for (list = active_dialogs; list; list = g_slist_next (list))
{
dstate = (DialogState *) list->data;
if (dstate->saved_state == VISIBILITY_VISIBLE &&
!GTK_WIDGET_VISIBLE (dstate->dialog))
gtk_widget_show(dstate->dialog);
}
}
/* Handle the tool box in a special way */
static void
dialog_hide_toolbox (void)
{
if (toolbox_shell && GTK_WIDGET_VISIBLE (toolbox_shell->dialog))
{
gtk_widget_hide (toolbox_shell->dialog);
toolbox_shell->saved_state = VISIBILITY_VISIBLE;
}
}
/* public */
void
dialog_show_toolbox (void)
{
if (toolbox_shell &&
toolbox_shell->saved_state == VISIBILITY_VISIBLE &&
!GTK_WIDGET_VISIBLE (toolbox_shell->dialog))
{
gtk_widget_show (toolbox_shell->dialog);
}
}
/* Set hourglass cursor on all currently registered dialogs */
void
dialog_idle_all (void)
{
DialogState *dstate;
GSList *list;
for (list = active_dialogs; list; list = g_slist_next (list))
{
dstate = (DialogState *) list->data;
if(!GTK_IS_WIDGET (dstate->dialog) ||
(GTK_WIDGET_VISIBLE (dstate->dialog) && !dstate->dialog->window))
{
g_warning("%s discovered non-widget thing %p in list of "
"active_dialogs. Calling dialog_unregister on it.\n",
G_GNUC_PRETTY_FUNCTION, dstate->dialog);
error_tmp_list.next=list->next;
list=&error_tmp_list;
dialog_unregister (dstate->dialog);
}
else if(GTK_WIDGET_VISIBLE (dstate->dialog))
{
GdkCursor *cursor;
cursor = gimp_cursor_new (GDK_WATCH,
GIMP_TOOL_CURSOR_NONE,
GIMP_CURSOR_MODIFIER_NONE);
gdk_window_set_cursor (dstate->dialog->window, cursor);
gdk_cursor_destroy (cursor);
}
}
if (toolbox_shell && GTK_WIDGET_VISIBLE (toolbox_shell->dialog))
{
GdkCursor *cursor;
cursor = gimp_cursor_new (GDK_WATCH,
GIMP_TOOL_CURSOR_NONE,
GIMP_CURSOR_MODIFIER_NONE);
gdk_window_set_cursor (toolbox_shell->dialog->window, cursor);
gdk_cursor_destroy (cursor);
}
if (fileload_shell && GTK_WIDGET_VISIBLE (fileload_shell->dialog))
{
GdkCursor *cursor;
cursor = gimp_cursor_new (GDK_WATCH,
GIMP_TOOL_CURSOR_NONE,
GIMP_CURSOR_MODIFIER_NONE);
gdk_window_set_cursor (fileload_shell->dialog->window, cursor);
gdk_cursor_destroy (cursor);
}
}
/* And remove the hourglass again. */
void
dialog_unidle_all (void)
{
DialogState *dstate;
GSList *list;
for (list = active_dialogs; list; list = g_slist_next (list))
{
dstate = (DialogState *) list->data;
if(!GTK_IS_WIDGET(dstate->dialog) ||
(GTK_WIDGET_VISIBLE (dstate->dialog) && !dstate->dialog->window))
{
g_warning("%s discovered non-widget thing %p in list of "
"active_dialogs. Calling dialog_unregister on it.\n",
G_GNUC_PRETTY_FUNCTION, dstate->dialog);
error_tmp_list.next=list->next;
list=&error_tmp_list;
dialog_unregister(dstate->dialog);
}
else if (GTK_WIDGET_VISIBLE (dstate->dialog))
{
gdk_window_set_cursor (dstate->dialog->window, NULL);
}
}
if (toolbox_shell && GTK_WIDGET_VISIBLE (toolbox_shell->dialog))
{
gdk_window_set_cursor (toolbox_shell->dialog->window, NULL);
}
if (fileload_shell && GTK_WIDGET_VISIBLE (fileload_shell->dialog))
{
gdk_window_set_cursor (fileload_shell->dialog->window, NULL);
}
}
/* Register a dialog that we can handle */
G_MODULE_EXPORT
void
dialog_register (GtkWidget *dialog)
{
DialogState *dstate;
dstate = g_new (DialogState, 1);
dstate->dialog = dialog;
dstate->saved_state = VISIBILITY_UNKNOWN;
active_dialogs = g_slist_append (active_dialogs, dstate);
}
void
dialog_register_toolbox (GtkWidget *dialog)
{
toolbox_shell = g_new (DialogState, 1);
toolbox_shell->dialog = dialog;
toolbox_shell->saved_state = VISIBILITY_UNKNOWN;
}
void
dialog_register_fileload (GtkWidget *dialog)
{
fileload_shell = g_new (DialogState, 1);
fileload_shell->dialog = dialog;
fileload_shell->saved_state = VISIBILITY_UNKNOWN;
}
/* unregister dialog */
G_MODULE_EXPORT
void
dialog_unregister (GtkWidget *dialog)
{
DialogState *dstate = NULL;
GSList *list;
for (list = active_dialogs; list; list = g_slist_next (list))
{
dstate = (DialogState *) list->data;
if (dstate->dialog == dialog)
break;
}
if (dstate != NULL)
{
active_dialogs = g_slist_remove (active_dialogs, dstate);
g_free (dstate);
}
}
/* Toggle showing of dialogs
*
* States:-
* SHOW_ALL -> HIDE_ALL -> SHOW_TOOLBOX -> SHOW_ALL ....
*/
void
dialog_toggle (void)
{
GSList *list;
if (doing_update)
return;
doing_update = TRUE;
/* Paranoid error checking on our active_dialogs list, because
3rd party modules access this list through dialog_register
and we don't want them wreaking havoc on our internal state.
Attempts to recover gracefully, but *is not bulletproof* since
GTK_IS_WIDGET *may* succeed, even if it's pointing to garbage,
if the garbage looks a little like a widget structure. */
for (list = active_dialogs; list; list = g_slist_next (list))
{
DialogState* dstate = (DialogState *) list->data;
if(!GTK_IS_WIDGET(dstate->dialog))
{
g_warning("%s discovered non-widget thing %p in list of "
"active_dialogs. Calling dialog_unregister on it.\n",
G_GNUC_PRETTY_FUNCTION, dstate->dialog);
/* We must find the next list element before the current one
is destroyed by the call to unregister. */
error_tmp_list.next=list->next;
list=&error_tmp_list;
dialog_unregister(dstate->dialog);
}
}
switch (dialogs_showing)
{
case SHOW_ALL:
dialogs_showing = HIDE_ALL;
dialog_hide_all ();
dialog_hide_toolbox ();
break;
case HIDE_ALL:
dialogs_showing = SHOW_TOOLBOX;
dialog_show_toolbox ();
break;
case SHOW_TOOLBOX:
dialogs_showing = SHOW_ALL;
dialog_show_all ();
default:
break;
}
gdk_flush ();
while (gtk_events_pending ())
{
gtk_main_iteration ();
gdk_flush ();
}
doing_update = FALSE;
}
/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
* Copyright (C) 1999 Andy Thomas
*
* 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
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __DIALOG_HANDLER_H__
#define __DIALOG_HANDLER_H__
#include <gmodule.h>
G_MODULE_EXPORT
void dialog_register (GtkWidget *dialog);
G_MODULE_EXPORT
void dialog_unregister (GtkWidget *dialog);
void dialog_register_toolbox (GtkWidget *dialog);
void dialog_register_fileload (GtkWidget *dialog);
void dialog_toggle (void);
void dialog_idle_all (void);
void dialog_unidle_all (void);
void dialog_show_toolbox (void);
#endif /* __DIALOG_HANDLER_H__ */
......@@ -52,7 +52,6 @@
#include "menus.h"
#include "app_procs.h"
#include "dialog_handler.h"
#include "docindex.h"
#include "file-open.h"
#include "file-utils.h"
......@@ -213,8 +212,6 @@ file_open_dialog_create (void)
gtk_container_set_border_width
(GTK_CONTAINER (GTK_FILE_SELECTION (fileload)->button_area), 2);
dialog_register_fileload (fileload);
gtk_signal_connect_object
(GTK_OBJECT (GTK_FILE_SELECTION (fileload)->cancel_button), "clicked",
GTK_SIGNAL_FUNC (file_dialog_hide),
......
......@@ -37,13 +37,12 @@
#include "core/gimpdrawable.h"
#include "core/gimpimage.h"
#include "dialog_handler.h"
#include "docindex.h"
#include "file-dialog-utils.h"
#include "file-save-dialog.h"
#include "menus.h"
#include "app_procs.h"
#include "docindex.h"
#include "gimprc.h"
#include "file-save.h"
#include "file-utils.h"
......
......@@ -26,7 +26,6 @@
#include "core/core-types.h"
#include "dialog_handler.h"
#include "info-dialog.h"
#include "gimprc.h"
......@@ -180,8 +179,6 @@ info_dialog_new_extended (gchar *title,
gtk_window_set_wmclass (GTK_WINDOW (shell), "info_dialog", "Gimp");
gtk_window_set_title (GTK_WINDOW (shell), title);
dialog_register (shell);
gtk_signal_connect (GTK_OBJECT (shell), "delete_event",
GTK_SIGNAL_FUNC (info_dialog_delete_callback),
idialog);
......@@ -256,8 +253,6 @@ info_dialog_free (InfoDialog *idialog)
/* Free the actual field linked list */
g_slist_free (idialog->field_list);
dialog_unregister (idialog->shell);
/* Destroy the associated widgets */
gtk_widget_destroy (idialog->shell);
......
......@@ -48,13 +48,14 @@
#include "tools/gimpmovetool.h"
#include "tools/tool_manager.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "gui/dialogs.h"
#include "gui/info-window.h"
#include "gui/layer-select.h"
#include "devices.h"
#include "dialog_handler.h"
#include "disp_callbacks.h"
#include "gdisplay.h"
#include "gimprc.h"
......@@ -585,7 +586,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* Hide or show all dialogs */
if (! kevent->state)
dialog_toggle ();
gimp_dialog_factories_toggle (global_dialog_factory,
"gimp:toolbox");
return_val = TRUE;
break;
......
......@@ -48,13 +48,14 @@
#include "tools/gimpmovetool.h"
#include "tools/tool_manager.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "gui/dialogs.h"
#include "gui/info-window.h"
#include "gui/layer-select.h"
#include "devices.h"
#include "dialog_handler.h"
#include "disp_callbacks.h"
#include "gdisplay.h"
#include "gimprc.h"
......@@ -585,7 +586,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* Hide or show all dialogs */
if (! kevent->state)
dialog_toggle ();
gimp_dialog_factories_toggle (global_dialog_factory,
"gimp:toolbox");
return_val = TRUE;
break;
......
......@@ -48,13 +48,14 @@
#include "tools/gimpmovetool.h"
#include "tools/tool_manager.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimpwidgets-utils.h"
#include "gui/dialogs.h"
#include "gui/info-window.h"
#include "gui/layer-select.h"
#include "devices.h"
#include "dialog_handler.h"
#include "disp_callbacks.h"
#include "gdisplay.h"
#include "gimprc.h"
......@@ -585,7 +586,8 @@ gdisplay_canvas_events (GtkWidget *canvas,
/* Hide or show all dialogs */
if (! kevent->state)
dialog_toggle ();
gimp_dialog_factories_toggle (global_dialog_factory,
"gimp:toolbox");
return_val = TRUE;
break;
......