Commit 3196563c authored by Michael Natterer's avatar Michael Natterer Committed by Michael Natterer

app/Makefile.am removed.

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

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

	* app/core/gimp.c: s/gimage_new/gimp_image_new/

	* app/gui/gui.c
	* app/tools/tool_manager.c: added the handlers from gimage.c
parent b70ee4b7
2001-07-07 Michael Natterer <mitch@gimp.org>
* app/Makefile.am
* app/gimage.[ch]: removed.
* app/core/gimp.c: s/gimage_new/gimp_image_new/
* app/gui/gui.c
* app/tools/tool_manager.c: added the handlers from gimage.c
2001-07-07 Michael Natterer <mitch@gimp.org>
* app/tools/tool_manager.[ch]: put all tool_manager variables into
......
......@@ -85,8 +85,6 @@ gimp_SOURCES = @STRIP_BEGIN@ \
drawable.h \
floating_sel.c \
floating_sel.h \
gimage.c \
gimage.h \
gimpparasite.c \
gimpparasite.h \
gimpunit.c \
......
......@@ -46,7 +46,6 @@
#include "appenv.h"
#include "app_procs.h"
#include "gimage.h"
#include "gimpparasite.h"
#include "libgimp/gimpintl.h"
......@@ -353,7 +352,7 @@ gimp_create_image (Gimp *gimp,
g_return_val_if_fail (gimp != NULL, NULL);
g_return_val_if_fail (GIMP_IS_GIMP (gimp), NULL);
gimage = gimage_new (gimp, width, height, type);
gimage = gimp_image_new (gimp, width, height, type);
gimp_container_add (gimp->images, GIMP_OBJECT (gimage));
......
/* 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 <gtk/gtk.h>
#include "core/core-types.h"
#include "tools/tools-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpimage.h"
#include "tools/gimptool.h"
#include "tools/tool_manager.h"
#include "dialog_handler.h"
#include "gdisplay.h"
#include "gui/palette-import-dialog.h"
#include "gimage.h"
#include "undo.h"
/* gimage.c: Junk (ugly dependencies) from gimpimage.c on its way
* to proper places. That is, the handlers should be moved to
* layers_dialog, gdisplay, tools, etc..
*/
static void gimage_dirty_handler (GimpImage *gimage);
static void gimage_destroy_handler (GimpImage *gimage);
static void gimage_cmap_change_handler (GimpImage *gimage,
gint ncol,
gpointer user_data);
static void gimage_rename_handler (GimpImage *gimage);
static void gimage_size_changed_handler (GimpImage *gimage);
static void gimage_alpha_changed_handler (GimpImage *gimage);
static void gimage_repaint_handler (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h);
GimpImage *
gimage_new (Gimp *gimp,
gint width,
gint height,
GimpImageBaseType base_type)
{
GimpImage *gimage = gimp_image_new (gimp, width, height, base_type);
gtk_signal_connect (GTK_OBJECT (gimage), "dirty",
GTK_SIGNAL_FUNC (gimage_dirty_handler),
NULL);
gtk_signal_connect (GTK_OBJECT (gimage), "destroy",
GTK_SIGNAL_FUNC (gimage_destroy_handler),
NULL);
gtk_signal_connect (GTK_OBJECT (gimage), "name_changed",
GTK_SIGNAL_FUNC (gimage_rename_handler),
NULL);
gtk_signal_connect (GTK_OBJECT (gimage), "size_changed",
GTK_SIGNAL_FUNC (gimage_size_changed_handler),
NULL);
gtk_signal_connect (GTK_OBJECT (gimage), "alpha_changed",
GTK_SIGNAL_FUNC (gimage_alpha_changed_handler),
NULL);
gtk_signal_connect (GTK_OBJECT (gimage), "repaint",
GTK_SIGNAL_FUNC (gimage_repaint_handler),
NULL);
gtk_signal_connect (GTK_OBJECT (gimage), "colormap_changed",
GTK_SIGNAL_FUNC (gimage_cmap_change_handler),
NULL);
return gimage;
}
static void
gimage_dirty_handler (GimpImage *gimage)
{
GimpTool *active_tool;
active_tool = tool_manager_get_active (gimage->gimp);
if (active_tool && ! active_tool->preserve)
{
GDisplay* gdisp = active_tool->gdisp;
if (gdisp)
{
if (gdisp->gimage == gimage)
tool_manager_initialize_tool (gimage->gimp, active_tool, gdisp);
else
tool_manager_initialize_tool (gimage->gimp, active_tool, NULL);
}
}
}
static void
gimage_destroy_handler (GimpImage *gimage)
{
/* check if this is the last image */
if (gimp_container_num_children (gimage->gimp->images) == 1)
{
dialog_show_toolbox ();
}
}
static void
gimage_cmap_change_handler (GimpImage *gimage,
gint ncol,
gpointer user_data)
{
if (gimp_image_base_type (gimage) == INDEXED)
gdisplays_update_full (gimage);
}
static void
gimage_rename_handler (GimpImage *gimage)
{
gdisplays_update_title (gimage);
palette_import_image_renamed (gimage);
}
static void
gimage_size_changed_handler (GimpImage *gimage)
{
/* shrink wrap and update all views */
gdisplays_resize_cursor_label (gimage);
gdisplays_update_full (gimage);
gdisplays_shrink_wrap (gimage);
}
static void
gimage_alpha_changed_handler (GimpImage *gimage)
{
gdisplays_update_title (gimage);
}
static void
gimage_repaint_handler (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h)
{
gdisplays_update_area (gimage, x, y, w, h);
}
/* 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.
*/
#ifndef __GIMAGE_H__
#define __GIMAGE_H__
GimpImage * gimage_new (Gimp *gimp,
gint width,
gint height,
GimpImageBaseType base_type);
#endif /* __GIMAGE_H__ */
......@@ -29,6 +29,7 @@
#include "widgets/widgets-types.h"
#include "core/gimp.h"
#include "core/gimpcontainer.h"
#include "core/gimpcontext.h"
#include "core/gimpimage.h"
......@@ -48,6 +49,7 @@
#include "image_render.h"
#include "menus.h"
#include "palette-editor.h"
#include "palette-import-dialog.h"
#include "pattern-select.h"
#include "session.h"
#include "tool-options-dialog.h"
......@@ -67,16 +69,35 @@
/* local function prototypes */
static void gui_display_new (GimpImage *gimage);
static gint gui_rotate_the_shield_harmonics (GtkWidget *widget,
GdkEvent *eevent,
gpointer data);
static void gui_really_quit_callback (GtkWidget *button,
gboolean quit,
gpointer data);
static void gui_display_changed (GimpContext *context,
GDisplay *display,
gpointer data);
static void gui_display_new (GimpImage *gimage);
static gint gui_rotate_the_shield_harmonics (GtkWidget *widget,
GdkEvent *eevent,
gpointer data);
static void gui_really_quit_callback (GtkWidget *button,
gboolean quit,
gpointer data);
static void gui_display_changed (GimpContext *context,
GDisplay *display,
gpointer data);
static void gui_image_destroy (GimpImage *gimage,
gpointer data);
static void gui_image_colormap_changed (GimpImage *gimage,
gint ncol,
gpointer data);
static void gui_image_name_changed (GimpImage *gimage,
gpointer data);
static void gui_image_size_changed (GimpImage *gimage,
gpointer data);
static void gui_image_alpha_changed (GimpImage *gimage,
gpointer data);
static void gui_image_repaint (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gpointer data);
/* global variables */
......@@ -84,6 +105,16 @@ static void gui_display_changed (GimpContext *context,
extern GSList *display_list; /* from gdisplay.c */
/* private variables */
static GQuark image_destroy_handler_id = 0;
static GQuark image_colormap_changed_handler_id = 0;
static GQuark image_name_changed_handler_id = 0;
static GQuark image_size_changed_handler_id = 0;
static GQuark image_alpha_changed_handler_id = 0;
static GQuark image_repaint_handler_id = 0;
/* public functions */
void
......@@ -91,10 +122,40 @@ gui_init (Gimp *gimp)
{
gimp->create_display_func = gui_display_new;
image_destroy_handler_id =
gimp_container_add_handler (gimp->images, "destroy",
GTK_SIGNAL_FUNC (gui_image_destroy),
gimp);
image_colormap_changed_handler_id =
gimp_container_add_handler (gimp->images, "colormap_changed",
GTK_SIGNAL_FUNC (gui_image_colormap_changed),
gimp);
image_name_changed_handler_id =
gimp_container_add_handler (gimp->images, "name_changed",
GTK_SIGNAL_FUNC (gui_image_name_changed),
gimp);
image_size_changed_handler_id =
gimp_container_add_handler (gimp->images, "size_changed",
GTK_SIGNAL_FUNC (gui_image_size_changed),
gimp);
image_alpha_changed_handler_id =
gimp_container_add_handler (gimp->images, "alpha_changed",
GTK_SIGNAL_FUNC (gui_image_alpha_changed),
gimp);
image_repaint_handler_id =
gimp_container_add_handler (gimp->images, "repaint",
GTK_SIGNAL_FUNC (gui_image_repaint),
gimp);
gtk_signal_connect (GTK_OBJECT (gimp_get_user_context (gimp)),
"display_changed",
GTK_SIGNAL_FUNC (gui_display_changed),
NULL);
gimp);
/* make sure the monitor resolution is valid */
if (gimprc.monitor_xres < GIMP_MIN_RESOLUTION ||
......@@ -200,6 +261,20 @@ gui_exit (Gimp *gimp)
toolbox_free ();
gimp_help_free ();
gimp_container_remove_handler (gimp->images, image_destroy_handler_id);
gimp_container_remove_handler (gimp->images, image_colormap_changed_handler_id);
gimp_container_remove_handler (gimp->images, image_name_changed_handler_id);
gimp_container_remove_handler (gimp->images, image_size_changed_handler_id);
gimp_container_remove_handler (gimp->images, image_alpha_changed_handler_id);
gimp_container_remove_handler (gimp->images, image_repaint_handler_id);
image_destroy_handler_id = 0;
image_colormap_changed_handler_id = 0;
image_name_changed_handler_id = 0;
image_size_changed_handler_id = 0;
image_alpha_changed_handler_id = 0;
image_repaint_handler_id = 0;
}
void
......@@ -341,10 +416,98 @@ gui_really_quit_callback (GtkWidget *button,
}
}
/* FIXME: this junk should mostly go to the display subsystem */
static void
gui_display_changed (GimpContext *context,
GDisplay *display,
gpointer data)
{
Gimp *gimp;
gimp = (Gimp *) data;
gdisplay_set_menu_sensitivity (display);
}
static void
gui_image_destroy (GimpImage *gimage,
gpointer data)
{
Gimp *gimp;
gimp = (Gimp *) data;
/* check if this is the last image */
if (gimp_container_num_children (gimp->images) == 1)
{
dialog_show_toolbox ();
}
}
static void
gui_image_colormap_changed (GimpImage *gimage,
gint ncol,
gpointer data)
{
Gimp *gimp;
gimp = (Gimp *) data;
if (gimp_image_base_type (gimage) == INDEXED)
gdisplays_update_full (gimage);
}
static void
gui_image_name_changed (GimpImage *gimage,
gpointer data)
{
Gimp *gimp;
gimp = (Gimp *) data;
gdisplays_update_title (gimage);
palette_import_image_renamed (gimage);
}
static void
gui_image_size_changed (GimpImage *gimage,
gpointer data)
{
Gimp *gimp;
gimp = (Gimp *) data;
/* shrink wrap and update all views */
gdisplays_resize_cursor_label (gimage);
gdisplays_update_full (gimage);
gdisplays_shrink_wrap (gimage);
}
static void
gui_image_alpha_changed (GimpImage *gimage,
gpointer data)
{
Gimp *gimp;
gimp = (Gimp *) data;
gdisplays_update_title (gimage);
}
static void
gui_image_repaint (GimpImage *gimage,
gint x,
gint y,
gint w,
gint h,
gpointer data)
{
Gimp *gimp;
gimp = (Gimp *) data;
gdisplays_update_area (gimage, x, y, w, h);
}
......@@ -68,17 +68,21 @@ struct _GimpToolManager
GSList *tool_stack;
GimpContext *global_tool_context;
GQuark image_dirty_handler_id;
};
/* local function prototypes */
static GimpToolManager * tool_manager_get (Gimp *gimp);
static void tool_manager_set (Gimp *gimp,
GimpToolManager *tool_manager);
static void tool_manager_tool_changed (GimpContext *user_context,
GimpToolInfo *tool_info,
gpointer data);
static GimpToolManager * tool_manager_get (Gimp *gimp);
static void tool_manager_set (Gimp *gimp,
GimpToolManager *tool_manager);
static void tool_manager_tool_changed (GimpContext *user_context,
GimpToolInfo *tool_info,
gpointer data);
static void tool_manager_image_dirty (GimpImage *gimage,
gpointer data);
/* public functions */
......@@ -92,12 +96,18 @@ tool_manager_init (Gimp *gimp)
tool_manager = g_new0 (GimpToolManager, 1);
tool_manager->active_tool = NULL;
tool_manager->tool_stack = NULL;
tool_manager->global_tool_context = NULL;
tool_manager->active_tool = NULL;
tool_manager->tool_stack = NULL;
tool_manager->global_tool_context = NULL;
tool_manager->image_dirty_handler_id = 0;
tool_manager_set (gimp, tool_manager);
tool_manager->image_dirty_handler_id =
gimp_container_add_handler (gimp->images, "dirty",
GTK_SIGNAL_FUNC (tool_manager_image_dirty),
tool_manager);
user_context = gimp_get_user_context (gimp);
gtk_signal_connect (GTK_OBJECT (user_context), "tool_changed",
......@@ -146,6 +156,9 @@ tool_manager_exit (Gimp *gimp)
gtk_object_unref (GTK_OBJECT (tool_manager->global_tool_context));
gimp_container_remove_handler (gimp->images,
tool_manager->image_dirty_handler_id);
g_free (tool_manager);
tool_manager_set (gimp, NULL);
......@@ -635,3 +648,29 @@ tool_manager_tool_changed (GimpContext *user_context,
tool_manager_select_tool (user_context->gimp, new_tool);
}
static void
tool_manager_image_dirty (GimpImage *gimage,
gpointer data)
{
GimpToolManager *tool_manager;
tool_manager = (GimpToolManager *) data;
if (tool_manager->active_tool && ! tool_manager->active_tool->preserve)
{
GDisplay *gdisp = tool_manager->active_tool->gdisp;
if (gdisp)
{
if (gdisp->gimage == gimage)
tool_manager_initialize_tool (gimage->gimp,
tool_manager->active_tool,
gdisp);
else
tool_manager_initialize_tool (gimage->gimp,
tool_manager->active_tool,
NULL);
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment