Commit cbce3390 authored by Michael Natterer's avatar Michael Natterer

fscking broken pipe...

parent 5f63e079
......@@ -135,7 +135,6 @@ edit_paste_cmd_callback (GtkWidget *widget,
gdisp->gimage->gimp->global_buffer,
FALSE))
{
gdisplays_update_title (gdisp->gimage);
gdisplays_flush ();
}
}
......@@ -158,7 +157,6 @@ edit_paste_into_cmd_callback (GtkWidget *widget,
gdisp->gimage->gimp->global_buffer,
TRUE))
{
gdisplays_update_title (gdisp->gimage);
gdisplays_flush ();
}
}
......
......@@ -35,7 +35,7 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplay-ops.h"
#include "display/gimpdisplayshell.h"
#include "file-commands.h"
#include "file-new-dialog.h"
......@@ -272,7 +272,7 @@ file_close_cmd_callback (GtkWidget *widget,
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gdisplay_close_window (gdisp, FALSE);
gimp_display_shell_close (GIMP_DISPLAY_SHELL (gdisp->shell), FALSE);
}
void
......@@ -315,11 +315,12 @@ file_revert_confirm_callback (GtkWidget *widget,
if (new_gimage != NULL)
{
undo_free (new_gimage);
gdisplays_reconnect (old_gimage, new_gimage);
gdisplays_resize_cursor_label (new_gimage);
gdisplays_update_full (new_gimage);
gdisplays_shrink_wrap (new_gimage);
gimp_image_clean_all (new_gimage);
gdisplays_flush ();
}
else if (status != GIMP_PDB_CANCEL)
{
......
......@@ -268,7 +268,9 @@ image_duplicate_cmd_callback (GtkWidget *widget,
new_gimage = gimp_image_duplicate (gimage);
gimp_create_display (new_gimage->gimp, new_gimage);
gimp_create_display (new_gimage->gimp, new_gimage, 0x0101);
g_object_unref (G_OBJECT (new_gimage));
}
......@@ -375,7 +377,6 @@ static void
image_scale_implement (ImageResize *image_scale)
{
GimpImage *gimage = NULL;
gboolean rulers_flush = FALSE;
gboolean display_flush = FALSE; /* this is a bit ugly:
we hijack the flush variable
to check if an undo_group was
......@@ -395,20 +396,16 @@ image_scale_implement (ImageResize *image_scale)
image_scale->resize->resolution_x,
image_scale->resize->resolution_y);
rulers_flush = TRUE;
display_flush = TRUE;
}
if (image_scale->resize->unit != gimage->unit)
{
if (!display_flush)
if (! display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
gimp_image_set_unit (gimage, image_scale->resize->unit);
gdisplays_setup_scale (gimage);
gdisplays_resize_cursor_label (gimage);
rulers_flush = TRUE;
display_flush = TRUE;
}
......@@ -418,7 +415,7 @@ image_scale_implement (ImageResize *image_scale)
if (image_scale->resize->width > 0 &&
image_scale->resize->height > 0)
{
if (!display_flush)
if (! display_flush)
undo_push_group_start (gimage, IMAGE_SCALE_UNDO);
gimp_image_scale (gimage,
......@@ -435,12 +432,6 @@ image_scale_implement (ImageResize *image_scale)
}
}
if (rulers_flush)
{
gdisplays_setup_scale (gimage);
gdisplays_resize_cursor_label (gimage);
}
if (display_flush)
{
undo_push_group_end (gimage);
......
......@@ -30,9 +30,9 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplay-ops.h"
#include "display/gimpdisplay-scale.h"
#include "display/gimpdisplay-selection.h"
#include "display/gimpdisplayshell.h"
#include "info-dialog.h"
#include "info-window.h"
......@@ -55,7 +55,7 @@ view_zoomin_cmd_callback (GtkWidget *widget,
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_display_scale (gdisp, GIMP_ZOOM_IN);
gimp_display_shell_scale (GIMP_DISPLAY_SHELL (gdisp->shell), GIMP_ZOOM_IN);
}
void
......@@ -65,7 +65,7 @@ view_zoomout_cmd_callback (GtkWidget *widget,
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_display_scale (gdisp, GIMP_ZOOM_OUT);
gimp_display_shell_scale (GIMP_DISPLAY_SHELL (gdisp->shell), GIMP_ZOOM_OUT);
}
void
......@@ -76,7 +76,7 @@ view_zoom_cmd_callback (GtkWidget *widget,
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_display_scale (gdisp, action);
gimp_display_shell_scale (GIMP_DISPLAY_SHELL (gdisp->shell), action);
}
void
......@@ -86,23 +86,26 @@ view_dot_for_dot_cmd_callback (GtkWidget *widget,
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gdisplay_set_dot_for_dot (gdisp, GTK_CHECK_MENU_ITEM (widget)->active);
gimp_display_shell_scale_set_dot_for_dot (GIMP_DISPLAY_SHELL (gdisp->shell),
GTK_CHECK_MENU_ITEM (widget)->active);
}
void
view_info_window_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (! gimprc.info_window_follows_mouse)
{
if (! gdisp->window_info_dialog)
gdisp->window_info_dialog = info_window_create (gdisp);
if (! shell->info_dialog)
shell->info_dialog = info_window_create (gdisp);
info_window_update (gdisp);
info_dialog_popup (gdisp->window_info_dialog);
info_dialog_popup (shell->info_dialog);
}
else
{
......@@ -114,15 +117,18 @@ void
view_nav_window_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (gimprc.nav_window_per_display)
{
if (! gdisp->window_nav_dialog)
gdisp->window_nav_dialog = nav_dialog_create (gdisp);
if (! shell->nav_dialog)
shell->nav_dialog = nav_dialog_create (gdisp);
nav_dialog_popup (gdisp->window_nav_dialog);
nav_dialog_popup (shell->nav_dialog);
}
else
{
......@@ -154,29 +160,32 @@ void
view_toggle_rulers_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (! GTK_CHECK_MENU_ITEM (widget)->active)
{
if (GTK_WIDGET_VISIBLE (gdisp->origin))
if (GTK_WIDGET_VISIBLE (shell->origin))
{
gtk_widget_hide (gdisp->origin);
gtk_widget_hide (gdisp->hrule);
gtk_widget_hide (gdisp->vrule);
gtk_widget_hide (shell->origin);
gtk_widget_hide (shell->hrule);
gtk_widget_hide (shell->vrule);
gtk_widget_queue_resize (GTK_WIDGET (gdisp->origin->parent));
gtk_widget_queue_resize (GTK_WIDGET (shell->origin->parent));
}
}
else
{
if (! GTK_WIDGET_VISIBLE (gdisp->origin))
if (! GTK_WIDGET_VISIBLE (shell->origin))
{
gtk_widget_show (gdisp->origin);
gtk_widget_show (gdisp->hrule);
gtk_widget_show (gdisp->vrule);
gtk_widget_show (shell->origin);
gtk_widget_show (shell->hrule);
gtk_widget_show (shell->vrule);
gtk_widget_queue_resize (GTK_WIDGET (gdisp->origin->parent));
gtk_widget_queue_resize (GTK_WIDGET (shell->origin->parent));
}
}
}
......@@ -185,18 +194,21 @@ void
view_toggle_statusbar_cmd_callback (GtkWidget *widget,
gpointer data)
{
GimpDisplay *gdisp;
GimpDisplay *gdisp;
GimpDisplayShell *shell;
return_if_no_display (gdisp, data);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
if (! GTK_CHECK_MENU_ITEM (widget)->active)
{
if (GTK_WIDGET_VISIBLE (gdisp->statusarea))
gtk_widget_hide (gdisp->statusarea);
if (GTK_WIDGET_VISIBLE (shell->statusarea))
gtk_widget_hide (shell->statusarea);
}
else
{
if (! GTK_WIDGET_VISIBLE (gdisp->statusarea))
gtk_widget_show (gdisp->statusarea);
if (! GTK_WIDGET_VISIBLE (shell->statusarea))
gtk_widget_show (shell->statusarea);
}
}
......@@ -213,8 +225,8 @@ view_toggle_guides_cmd_callback (GtkWidget *widget,
if ((old_val != gdisp->draw_guides) && gdisp->gimage->guides)
{
gdisplay_expose_full (gdisp);
gdisplays_flush ();
gimp_display_shell_expose_full (GIMP_DISPLAY_SHELL (gdisp->shell));
gdisplay_flush (gdisp);
}
}
......@@ -235,7 +247,7 @@ view_new_view_cmd_callback (GtkWidget *widget,
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gdisplay_new_view (gdisp);
gimp_create_display (gdisp->gimage->gimp, gdisp->gimage, gdisp->scale);
}
void
......@@ -245,5 +257,5 @@ view_shrink_wrap_cmd_callback (GtkWidget *widget,
GimpDisplay *gdisp;
return_if_no_display (gdisp, data);
gimp_display_scale_shrink_wrap (gdisp);
gimp_display_shell_scale_shrink_wrap (GIMP_DISPLAY_SHELL (gdisp->shell));
}
......@@ -50,6 +50,7 @@
#include "display/gimpdisplay.h"
#include "display/gimpdisplay-foreach.h"
#include "display/gimpdisplayshell.h"
#include "tool_manager.h"
#include "tool_options.h"
......@@ -355,16 +356,19 @@ gimp_transform_tool_button_press (GimpTool *tool,
GdkEventButton *bevent,
GimpDisplay *gdisp)
{
GimpTransformTool *gt_tool;
GimpDrawable *drawable;
gint dist;
gint closest_dist;
gint x, y;
gint i;
gint off_x, off_y;
GimpTransformTool *gt_tool;
GimpDisplayShell *shell;
GimpDrawable *drawable;
gint dist;
gint closest_dist;
gint x, y;
gint i;
gint off_x, off_y;
gt_tool = GIMP_TRANSFORM_TOOL (tool);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gt_tool->bpressed = TRUE; /* ALT */
drawable = gimp_image_active_drawable (gdisp->gimage);
......@@ -383,7 +387,7 @@ gimp_transform_tool_button_press (GimpTool *tool,
if ((gdisp == tool->gdisp) && gt_tool->interactive)
{
/* start drawing the bounding box and handles... */
gimp_draw_tool_start (GIMP_DRAW_TOOL (gt_tool), gdisp->canvas->window);
gimp_draw_tool_start (GIMP_DRAW_TOOL (tool), shell->canvas->window);
x = bevent->x;
y = bevent->y;
......@@ -425,7 +429,7 @@ gimp_transform_tool_button_press (GimpTool *tool,
gt_tool->lastx = gt_tool->startx;
gt_tool->lasty = gt_tool->starty;
gdk_pointer_grab (gdisp->canvas->window, FALSE,
gdk_pointer_grab (shell->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
......@@ -472,10 +476,10 @@ gimp_transform_tool_button_press (GimpTool *tool,
/* Grab the pointer if we're in non-interactive mode */
if (!gt_tool->interactive)
gdk_pointer_grab (gdisp->canvas->window, FALSE,
(GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK),
gdk_pointer_grab (shell->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
/* Find the transform bounds for some tools (like scale,
......@@ -592,17 +596,20 @@ static void
gimp_transform_tool_doit (GimpTransformTool *gt_tool,
GimpDisplay *gdisp)
{
GimpTool *tool;
TileManager *new_tiles;
TransformUndo *tu;
PathUndo *pundo;
gboolean new_layer;
gint i, x, y;
GimpDisplayShell *shell;
GimpTool *tool;
TileManager *new_tiles;
TransformUndo *tu;
PathUndo *pundo;
gboolean new_layer;
gint i, x, y;
gimp_set_busy (gdisp->gimage->gimp);
tool = GIMP_TOOL (gt_tool);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
/* undraw the tool before we muck around with the transform matrix */
gimp_draw_tool_pause (GIMP_DRAW_TOOL (gt_tool));
......@@ -679,22 +686,28 @@ gimp_transform_tool_doit (GimpTransformTool *gt_tool,
/* Flush the gdisplays */
if (gdisp->disp_xoffset || gdisp->disp_yoffset)
{
x = gdisp->canvas->allocation.width;
y = gdisp->canvas->allocation.height;
x = shell->canvas->allocation.width;
y = shell->canvas->allocation.height;
if (gdisp->disp_yoffset)
{
gdisplay_expose_area (gdisp, 0, 0, gdisp->disp_width,
gdisp->disp_yoffset);
gdisplay_expose_area (gdisp, 0, gdisp->disp_yoffset + y,
gdisp->disp_width, gdisp->disp_height);
gimp_display_shell_add_expose_area (shell,
0, 0,
gdisp->disp_width,
gdisp->disp_yoffset);
gimp_display_shell_add_expose_area (shell,
0, gdisp->disp_yoffset + y,
gdisp->disp_width, gdisp->disp_height);
}
if (gdisp->disp_xoffset)
{
gdisplay_expose_area (gdisp, 0, 0, gdisp->disp_xoffset,
gdisp->disp_height);
gdisplay_expose_area (gdisp, gdisp->disp_xoffset + x, 0,
gdisp->disp_width, gdisp->disp_height);
gimp_display_shell_add_expose_area (shell,
0, 0,
gdisp->disp_xoffset, gdisp->disp_height);
gimp_display_shell_add_expose_area (shell,
gdisp->disp_xoffset + x, 0,
gdisp->disp_width, gdisp->disp_height);
}
}
......@@ -752,12 +765,15 @@ gimp_transform_tool_cursor_update (GimpTool *tool,
GimpDisplay *gdisp)
{
GimpTransformTool *tr_tool;
GimpDisplayShell *shell;
GimpDrawable *drawable;
GdkCursorType ctype = GDK_TOP_LEFT_ARROW;
gint x, y;
tr_tool = GIMP_TRANSFORM_TOOL (tool);
shell = GIMP_DISPLAY_SHELL (gdisp->shell);
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y,
FALSE, FALSE);
......@@ -781,10 +797,10 @@ gimp_transform_tool_cursor_update (GimpTool *tool,
}
}
gdisplay_install_tool_cursor (gdisp,
ctype,
tool->tool_cursor,
GIMP_CURSOR_MODIFIER_NONE);
gimp_display_shell_install_tool_cursor (shell,
ctype,
tool->tool_cursor,
GIMP_CURSOR_MODIFIER_NONE);
}
static void
......@@ -1647,11 +1663,11 @@ gimp_transform_tool_paste (GimpImage *gimage,
if (floating_layer)
floating_sel_relax (floating_layer, TRUE);
gdisplays_update_area (gimage,
drawable->offset_x,
drawable->offset_y,
drawable->width,
drawable->height);
gimp_image_update (gimage,
drawable->offset_x,
drawable->offset_y,
drawable->width,
drawable->height);
/* Push an undo */
if (layer)
......
/* 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 "display-types.h"
#include "gimpdisplay-area.h"
#define OVERHEAD 25 /* in units of pixel area */
/*
* As far as I can tell, this function takes a GimpArea and unifies it with
* an existing list of GimpAreas, trying to avoid overdraw. [adam]
*/
GSList *
gimp_display_area_list_process (GSList *list,
GimpArea *area)
{
GSList *new_list;
GSList *l;
gint area1, area2, area3;
GimpArea *ga2;
/* start new list off */
new_list = g_slist_prepend (NULL, area);
for (l = list; l; l = g_slist_next (l))
{
ga2 = (GimpArea *) l->data;
area1 = (area->x2 - area->x1) * (area->y2 - area->y1) + OVERHEAD;
area2 = (ga2->x2 - ga2->x1) * (ga2->y2 - ga2->y1) + OVERHEAD;
area3 = (MAX (ga2->x2, area->x2) - MIN (ga2->x1, area->x1)) *
(MAX (ga2->y2, area->y2) - MIN (ga2->y1, area->y1)) + OVERHEAD;
if ((area1 + area2) < area3)
{
new_list = g_slist_prepend (new_list, ga2);
}
else
{
area->x1 = MIN (area->x1, ga2->x1);
area->y1 = MIN (area->y1, ga2->y1);
area->x2 = MAX (area->x2, ga2->x2);
area->y2 = MAX (area->y2, ga2->y2);
g_free (ga2);
}
}
if (list)
g_slist_free (list);
return new_list;
}
GSList *
gimp_display_area_list_free (GSList *list)
{
if (list)
{
g_slist_foreach (list, (GFunc) g_free, NULL);
g_slist_free (list);
}
return NULL;
}
......@@ -16,22 +16,21 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef __GIMPDISPLAY_OPS_H__
#define __GIMPDISPLAY_OPS_H__
#ifndef __GIMP_DISPLAY_AREA_H__
#define __GIMP_DISPLAY_AREA_H__
gulong gdisplay_black_pixel (GimpDisplay *gdisp);
gulong gdisplay_gray_pixel (GimpDisplay *gdisp);
gulong gdisplay_white_pixel (GimpDisplay *gdisp);
gulong gdisplay_color_pixel (GimpDisplay *gdisp);
typedef struct _GimpArea GimpArea;
void gdisplay_xserver_resolution (gdouble *xres,
gdouble *yres);
struct _GimpArea
{
gint x1, y1, x2, y2; /* area bounds */
};
void gdisplay_new_view (GimpDisplay *gdisp);
void gdisplay_close_window (GimpDisplay *gdisp,
gboolean kill_it);
void gdisplay_shrink_wrap (GimpDisplay *gdisp);
GSList * gimp_display_area_list_process (GSList *list,