gimp/app/gui/gui.c

247 lines
4.8 KiB
C
Raw Normal View History

/* The GIMP -- an image manipulation program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* 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.
*/
#include "config.h"
#include <stdio.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "apptypes.h"
removed some forgotten tools types. 2001-05-13 Michael Natterer <mitch@gimp.org> * app/apptypes.h: removed some forgotten tools types. * app/tools/tools-types.h: and added them here. * app/interface.c * app/disp_callbacks.[ch]: ported dropping of drawables to the new DND system. * app/app_procs.c * app/core/gimpdatafactory.c * app/core/gimpimage-duplicate.c * app/core/gimptoolinfo.h * app/gui/gui.c * app/tools/tool_options.c * app/widgets/gimpchannellistview.c * app/widgets/gimplayerlistview.c: removed/fixed includes. * app/gui/brush-select.[ch] * app/gui/pattern-select.[ch]: removed the display of the current name (done by the grid view now). * app/gui/palette-select.c: fixed palette preview size. * app/gui/dialogs-constructors.c: added get_name() functions for brushes, patterns, images and palettes. * app/widgets/gimpcontainergridview.[ch]: added a label for the name of the active item. * app/widgets/gimpdnd.[ch]: removed the old drawable DND preview icon code. * tools/pdbgen/app.pl: braino: the $tool_eek hack has to be initialized to 0 at the beginning of each file, otherwise we end up including "tools/tools-types.h" everywhere. * tools/pdbgen/pdb/color.pdb * tools/pdbgen/pdb/text_tool.pdb * tools/pdbgen/pdb/tools.pdb: add "tools/tools-types.h" where needed. * app/pdb/color_cmds.c * app/pdb/pattern_select_cmds.c * app/pdb/patterns_cmds.c * app/pdb/plug_in_cmds.c * app/pdb/procedural_db_cmds.c * app/pdb/selection_cmds.c * app/pdb/undo_cmds.c * app/pdb/unit_cmds.c: regenerated.
2001-05-13 19:35:20 +08:00
#include "tools/tools-types.h"
#include "widgets/widgets-types.h"
#include "tools/tool_options_dialog.h"
#include "widgets/gimpdialogfactory.h"
#include "brush-select.h"
#include "color-select.h"
#include "devices.h"
#include "dialogs.h"
#include "docindex.h"
#include "errorconsole.h"
#include "file-open-dialog.h"
#include "file-save-dialog.h"
#include "gimprc.h"
#include "gradient-select.h"
#include "gui.h"
#include "gximage.h"
#include "image_render.h"
#include "menus.h"
#include "palette-editor.h"
#include "pattern-select.h"
#include "session.h"
#include "toolbox.h"
#include "app_procs.h"
app/Makefile.am removed. Stuff now lives in app_procs.[ch] and in 2001-05-13 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/cursorutil.[ch]: removed. Stuff now lives in app_procs.[ch] and in widgets/gimpcursor.[ch] * app/appenv.h: added the "gimp_busy" boolean. * app/app_procs.[ch]: added the "busy" stuff here. * app/gui/gui.[ch]: "busy" stuff for the gui. * app/widgets/Makefile.am * app/widgets/gimpcursor.[ch]: exports only one function: gimp_cursor_new() which returns a GdkCursor which has to be destroyed. * app/apptypes.h * app/appenums.h: removed the cursor types. * app/widgets/widgets-types.h: added here. * app/tools/gimpeditselectiontool.[ch]: added gtkutil_compress_motion() here (will go to some utils file in widgets/). * app/tools/tools-types.h: #include "widgets/widgets-types.h" * app/dialog_handler.c * app/disp_callbacks.c * app/gdisplay.[ch] * app/nav_window.c * app/scroll.c * app/xcf.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/gui/file-open-dialog.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptransformtool.c * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c: use the new cursor and "busy" functions. * app/gdisplay.h * app/core/gimpbrush.c: added some ugly cross-includes. * app/context_manager.c * app/gdisplay_ops.c * app/gimprc.c * app/core/gimpdrawable-offset.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/preferences-dialog.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.c: removed inclusion of "cursorutil.h"
2001-05-14 05:51:20 +08:00
#include "dialog_handler.h"
#include "gdisplay.h" /* for gdisplay_*_override_cursor() */
#include "libgimp/gimpintl.h"
static void really_quit_callback (GtkWidget *button,
gboolean quit,
gpointer data);
app/Makefile.am removed. Stuff now lives in app_procs.[ch] and in 2001-05-13 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/cursorutil.[ch]: removed. Stuff now lives in app_procs.[ch] and in widgets/gimpcursor.[ch] * app/appenv.h: added the "gimp_busy" boolean. * app/app_procs.[ch]: added the "busy" stuff here. * app/gui/gui.[ch]: "busy" stuff for the gui. * app/widgets/Makefile.am * app/widgets/gimpcursor.[ch]: exports only one function: gimp_cursor_new() which returns a GdkCursor which has to be destroyed. * app/apptypes.h * app/appenums.h: removed the cursor types. * app/widgets/widgets-types.h: added here. * app/tools/gimpeditselectiontool.[ch]: added gtkutil_compress_motion() here (will go to some utils file in widgets/). * app/tools/tools-types.h: #include "widgets/widgets-types.h" * app/dialog_handler.c * app/disp_callbacks.c * app/gdisplay.[ch] * app/nav_window.c * app/scroll.c * app/xcf.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/gui/file-open-dialog.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptransformtool.c * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c: use the new cursor and "busy" functions. * app/gdisplay.h * app/core/gimpbrush.c: added some ugly cross-includes. * app/context_manager.c * app/gdisplay_ops.c * app/gimprc.c * app/core/gimpdrawable-offset.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/preferences-dialog.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.c: removed inclusion of "cursorutil.h"
2001-05-14 05:51:20 +08:00
extern GSList *display_list; /* from gdisplay.c */
/* public functions */
void
gui_init (void)
{
file_open_menu_init ();
file_save_menu_init ();
menus_reorder_plugins ();
gximage_init ();
render_setup (transparency_type, transparency_size);
dialogs_init ();
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
* elements of the docindex
*/
{
FILE *fp;
gchar **filenames = g_new0 (gchar *, last_opened_size);
gint i;
if ((fp = document_index_parse_init ()))
{
/* read the filenames... */
for (i = 0; i < last_opened_size; i++)
if ((filenames[i] = document_index_parse_line (fp)) == NULL)
break;
/* ...and add them in reverse order */
for (--i; i >= 0; i--)
{
menus_last_opened_add (filenames[i]);
g_free (filenames[i]);
}
fclose (fp);
}
g_free (filenames);
}
}
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)
{
session_save ();
device_status_free ();
brush_dialog_free ();
pattern_dialog_free ();
palette_dialog_free ();
gradient_dialog_free ();
}
void
gui_exit (void)
{
menus_quit ();
gximage_free ();
render_free ();
dialogs_exit ();
/* handle this in the dialog factory: */
document_index_free ();
error_console_free ();
tool_options_dialog_free ();
toolbox_free ();
gimp_help_free ();
}
app/Makefile.am removed. Stuff now lives in app_procs.[ch] and in 2001-05-13 Michael Natterer <mitch@gimp.org> * app/Makefile.am * app/cursorutil.[ch]: removed. Stuff now lives in app_procs.[ch] and in widgets/gimpcursor.[ch] * app/appenv.h: added the "gimp_busy" boolean. * app/app_procs.[ch]: added the "busy" stuff here. * app/gui/gui.[ch]: "busy" stuff for the gui. * app/widgets/Makefile.am * app/widgets/gimpcursor.[ch]: exports only one function: gimp_cursor_new() which returns a GdkCursor which has to be destroyed. * app/apptypes.h * app/appenums.h: removed the cursor types. * app/widgets/widgets-types.h: added here. * app/tools/gimpeditselectiontool.[ch]: added gtkutil_compress_motion() here (will go to some utils file in widgets/). * app/tools/tools-types.h: #include "widgets/widgets-types.h" * app/dialog_handler.c * app/disp_callbacks.c * app/gdisplay.[ch] * app/nav_window.c * app/scroll.c * app/xcf.c * app/core/gimpimage-convert.c * app/core/gimpimage-duplicate.c * app/core/gimpimage.c * app/gui/file-open-dialog.c * app/tools/gimpblendtool.c * app/tools/gimpbucketfilltool.c * app/tools/gimpcroptool.c * app/tools/gimpfuzzyselecttool.c * app/tools/gimptransformtool.c * tools/pdbgen/pdb/image.pdb * app/pdb/image_cmds.c: use the new cursor and "busy" functions. * app/gdisplay.h * app/core/gimpbrush.c: added some ugly cross-includes. * app/context_manager.c * app/gdisplay_ops.c * app/gimprc.c * app/core/gimpdrawable-offset.c * app/gui/file-save-dialog.c * app/gui/gradient-editor.c * app/gui/preferences-dialog.c * app/tools/gimpbezierselecttool.c * app/tools/gimpbycolorselecttool.c * app/tools/gimpclonetool.c * app/tools/gimpcolorpickertool.c * app/tools/gimperasertool.c * app/tools/gimpfliptool.c * app/tools/gimpinktool.c * app/tools/gimpiscissorstool.c * app/tools/gimpmagnifytool.c * app/tools/gimpmeasuretool.c * app/tools/gimpmovetool.c * app/tools/gimppainttool.c * app/tools/gimprectselecttool.c * app/tools/gimprotatetool.c * app/tools/gimpselectiontool.c: removed inclusion of "cursorutil.h"
2001-05-14 05:51:20 +08:00
void
gui_set_busy (void)
{
GDisplay *gdisp;
GSList *list;
/* Canvases */
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
gdisplay_install_override_cursor (gdisp, GDK_WATCH);
}
/* Dialogs */
dialog_idle_all ();
gdk_flush ();
}
void
gui_unset_busy (void)
{
GDisplay *gdisp;
GSList *list;
/* Canvases */
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
gdisplay_remove_override_cursor (gdisp);
}
/* Dialogs */
dialog_unidle_all ();
}
void
really_quit_dialog (void)
{
GtkWidget *dialog;
menus_set_sensitive ("<Toolbox>/File/Quit", FALSE);
menus_set_sensitive ("<Image>/File/Quit", FALSE);
dialog = gimp_query_boolean_box (_("Really Quit?"),
gimp_standard_help_func,
"dialogs/really_quit.html",
TRUE,
_("Some files unsaved.\n\nQuit the GIMP?"),
_("Quit"), _("Cancel"),
NULL, NULL,
really_quit_callback,
NULL);
gtk_widget_show (dialog);
}
/* private functions */
static void
really_quit_callback (GtkWidget *button,
gboolean quit,
gpointer data)
{
if (quit)
{
app_exit_finish ();
}
else
{
menus_set_sensitive ("<Toolbox>/File/Quit", TRUE);
menus_set_sensitive ("<Image>/File/Quit", TRUE);
}
}