app/gdisplay.c app/gdisplay_ops.c app/info_window.c app/layer.c

2001-01-22  Sven Neumann  <sven@gimp.org>

	* app/gdisplay.c
	* app/gdisplay_ops.c
	* app/info_window.c
	* app/layer.c
	* app/menus.c
	* app/nav_window.c
	* app/path.c
	* app/scroll.[ch]: removed inclusion of superfluous headers and
	cleaned up the source a little.
This commit is contained in:
Sven Neumann 2001-01-22 20:46:50 +00:00 committed by Sven Neumann
parent ae435be264
commit 5591b7cd2d
26 changed files with 351 additions and 362 deletions

View File

@ -1,3 +1,15 @@
2001-01-22 Sven Neumann <sven@gimp.org>
* app/gdisplay.c
* app/gdisplay_ops.c
* app/info_window.c
* app/layer.c
* app/menus.c
* app/nav_window.c
* app/path.c
* app/scroll.[ch]: removed inclusion of superfluous headers and
cleaned up the source a little.
2001-01-22 Michael Natterer <mitch@gimp.org>
* app/tools/Makefile.am

View File

@ -33,13 +33,13 @@
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpimage.h"
#include "gimppreviewcache.h"
#include "layer.h"
#include "parasitelist.h"
#include "paint_funcs.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "parasitelist.h"
#include "undo.h"
#include "gimppreviewcache.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"

View File

@ -49,7 +49,6 @@
#include "plug_in.h"
#include "qmask.h"
#include "scale.h"
#include "scroll.h"
#include "selection.h"
#include "undo.h"
@ -58,7 +57,6 @@
#include "gdisplay_color.h"
#endif /* DISPLAY_FILTERS */
#include "tools/bezier_selectP.h"
#include "tools/tools.h"
#include "libgimp/gimpmath.h"

View File

@ -23,17 +23,14 @@
#include "apptypes.h"
#include "appenv.h"
#include "apptypes.h"
#include "colormaps.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpset.h"
#include "gimpui.h"
#include "gximage.h"
#include "info_dialog.h"
#include "info_window.h"
#include "scroll.h"
#include "tools/tools.h"
@ -115,7 +112,7 @@ info_window_page_switch (GtkWidget *widget,
GtkNotebookPage *page,
gint page_num)
{
InfoDialog *info_win;
InfoDialog *info_win;
InfoWinData *iwd;
info_win = (InfoDialog *) gtk_object_get_user_data (GTK_OBJECT (widget));
@ -134,13 +131,12 @@ info_window_page_switch (GtkWidget *widget,
static void
info_window_create_extended (InfoDialog *info_win)
{
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *alignment;
GtkWidget *table;
GtkWidget *label;
GtkWidget *pixmap;
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *alignment;
GtkWidget *table;
GtkWidget *label;
GtkWidget *pixmap;
InfoWinData *iwd;
iwd = (InfoWinData *) info_win->user_data;
@ -245,10 +241,11 @@ info_window_create_extended (InfoDialog *info_win)
InfoDialog *
info_window_create (GDisplay *gdisp)
{
InfoDialog *info_win;
InfoDialog *info_win;
InfoWinData *iwd;
gchar *title, *title_buf;
gint type;
gchar *title;
gchar *title_buf;
gint type;
title = g_basename (gimp_image_filename (gdisp->gimage));
type = gimp_image_base_type (gdisp->gimage);
@ -335,9 +332,9 @@ info_window_change_display (GimpContext *context, /* NOT USED */
GDisplay *newdisp,
gpointer data /* Not used */)
{
GDisplay * gdisp = newdisp;
GDisplay * old_gdisp;
GimpImage * gimage;
GDisplay *gdisp = newdisp;
GDisplay *old_gdisp;
GimpImage *gimage;
InfoWinData *iwd;
iwd = (InfoWinData *) info_window_auto->user_data;
@ -345,16 +342,14 @@ info_window_change_display (GimpContext *context, /* NOT USED */
old_gdisp = (GDisplay *) iwd->gdisp;
if (!info_window_auto || gdisp == old_gdisp || !gdisp)
{
return;
}
return;
gimage = gdisp->gimage;
if (gimage && gimp_set_have (image_context, gimage))
{
iwd->gdisp = gdisp;
info_window_update(gdisp);
info_window_update (gdisp);
}
}
@ -371,9 +366,11 @@ info_window_follow_auto (void)
if(!info_window_auto)
{
info_window_auto = info_window_create ((void *) gdisp);
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), "display_changed",
GTK_SIGNAL_FUNC (info_window_change_display), NULL);
info_window_update(gdisp); /* Update to include the info */
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()),
"display_changed",
GTK_SIGNAL_FUNC (info_window_change_display),
NULL);
info_window_update (gdisp); /* Update to include the info */
}
info_dialog_popup (info_window_auto);
@ -389,41 +386,38 @@ info_window_update_RGB (GDisplay *gdisp,
gdouble tx,
gdouble ty)
{
InfoWinData *iwd;
gchar buff[4];
guchar *color;
GimpImageType sample_type;
InfoDialog *info_win = gdisp->window_info_dialog;
gboolean force_update = FALSE;
InfoWinData *iwd;
gchar buff[4];
guchar *color;
GimpImageType sample_type;
InfoDialog *info_win = gdisp->window_info_dialog;
gboolean force_update = FALSE;
if (!info_win && info_window_auto != NULL)
{
info_win = info_window_auto;
}
info_win = info_window_auto;
if (!info_win)
return;
iwd = (InfoWinData *) info_win->user_data;
if(iwd->gdisp != gdisp)
if (iwd->gdisp != gdisp)
force_update = TRUE;
iwd->gdisp = gdisp;
if(force_update == TRUE)
if (force_update)
{
gchar *title_buf;
info_window_update(gdisp);
title_buf = info_window_title(gdisp);
gtk_window_set_title (GTK_WINDOW (info_window_auto->shell), title_buf);
g_free (title_buf);
gchar *title;
info_window_update (gdisp);
title = info_window_title (gdisp);
gtk_window_set_title (GTK_WINDOW (info_window_auto->shell), title);
g_free (title);
}
if (!iwd || iwd->showingPreview == FALSE)
if (!iwd || !iwd->showingPreview)
return;
/* gimp_image_active_drawable (gdisp->gimage) */
@ -464,7 +458,6 @@ void
info_window_free (InfoDialog *info_win)
{
InfoWinData *iwd;
extern gint gimage_image_count (void);
if (!info_win && info_window_auto)
{
@ -491,7 +484,7 @@ info_window_update (GDisplay *gdisp)
gdouble unit_factor;
gint unit_digits;
gchar format_buf[32];
InfoDialog *info_win = gdisp->window_info_dialog;
InfoDialog *info_win = gdisp->window_info_dialog;
if (!info_win && info_window_auto != NULL)
info_win = info_window_auto;

View File

@ -25,13 +25,9 @@
#include "appenv.h"
#include "colormaps.h"
#include "cursorutil.h"
#include "fileops.h"
#include "gdisplay_ops.h"
#include "gimpimage.h"
#include "gimpui.h"
#include "gximage.h"
#include "menus.h"
#include "scale.h"
#include "gimprc.h"
#include "libgimp/gimphelpui.h"

View File

@ -41,9 +41,9 @@
/* STATIC variables */
/* These are the values of the initial pointer grab */
static int startx, starty;
static gint startx, starty;
gint
gboolean
scrollbar_vert_update (GtkAdjustment *adjustment,
gpointer data)
{
@ -57,7 +57,7 @@ scrollbar_vert_update (GtkAdjustment *adjustment,
}
gint
gboolean
scrollbar_horz_update (GtkAdjustment *adjustment,
gpointer data)
{
@ -100,9 +100,7 @@ grab_and_scroll (GDisplay *gdisp,
GdkEventMotion *mevent)
{
if (mevent && mevent->window != gdisp->canvas->window)
{
return;
}
return;
scroll_display (gdisp,
startx - mevent->x - gdisp->offset_x,
@ -114,8 +112,8 @@ void
scroll_to_pointer_position (GDisplay *gdisp,
GdkEventMotion *mevent)
{
double child_x, child_y;
int off_x, off_y;
gdouble child_x, child_y;
gint off_x, off_y;
off_x = off_y = 0;
@ -124,6 +122,7 @@ scroll_to_pointer_position (GDisplay *gdisp,
off_x = mevent->x;
else if (mevent->x > gdisp->disp_width)
off_x = mevent->x - gdisp->disp_width;
if (mevent->y < 0)
off_y = mevent->y;
else if (mevent->y > gdisp->disp_height)
@ -145,15 +144,14 @@ scroll_to_pointer_position (GDisplay *gdisp,
}
}
int
gboolean
scroll_display (GDisplay *gdisp,
gint x_offset,
gint y_offset)
{
int old_x, old_y;
int src_x, src_y;
int dest_x, dest_y;
gint old_x, old_y;
gint src_x, src_y;
gint dest_x, dest_y;
GdkEvent *event;
old_x = gdisp->offset_x;
@ -229,16 +227,18 @@ scroll_display (GDisplay *gdisp,
!= NULL)
{
gtk_widget_event (gdisp->canvas, event);
if (event->expose.count == 0)
{
gdk_event_free (event);
break;
}
gdk_event_free (event);
}
return 1;
return TRUE;
}
return 0;
return FALSE;
}

View File

@ -21,31 +21,31 @@
/* app init and exit routines */
void init_scrolling (void);
void free_scrolling (void);
void init_scrolling (void);
void free_scrolling (void);
/* routines for scrolling the image via the scrollbars */
void scrollbar_disconnect (GtkAdjustment *adjuatment,
gpointer data);
gint scrollbar_vert_update (GtkAdjustment *adjuatment,
gpointer data);
gint scrollbar_horz_update (GtkAdjustment *adjuatment,
gpointer data);
void scrollbar_disconnect (GtkAdjustment *adjuatment,
gpointer data);
gboolean scrollbar_vert_update (GtkAdjustment *adjuatment,
gpointer data);
gboolean scrollbar_horz_update (GtkAdjustment *adjuatment,
gpointer data);
/* routines for grabbing the image and scrolling via the pointer */
void start_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void end_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void grab_and_scroll (GDisplay *gdisp,
GdkEventMotion *mevent);
void scroll_to_pointer_position (GDisplay *gdisp,
GdkEventMotion *mevent);
void start_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void end_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void grab_and_scroll (GDisplay *gdisp,
GdkEventMotion *mevent);
void scroll_to_pointer_position (GDisplay *gdisp,
GdkEventMotion *mevent);
/* generic scroll-by-offset function */
gint scroll_display (GDisplay *,
gint ,
gint );
gboolean scroll_display (GDisplay *gdisp,
gint x_offset,
gint y_offset);
#endif /* __SCROLL_H__ */

View File

@ -49,7 +49,6 @@
#include "plug_in.h"
#include "qmask.h"
#include "scale.h"
#include "scroll.h"
#include "selection.h"
#include "undo.h"
@ -58,7 +57,6 @@
#include "gdisplay_color.h"
#endif /* DISPLAY_FILTERS */
#include "tools/bezier_selectP.h"
#include "tools/tools.h"
#include "libgimp/gimpmath.h"

View File

@ -41,9 +41,9 @@
/* STATIC variables */
/* These are the values of the initial pointer grab */
static int startx, starty;
static gint startx, starty;
gint
gboolean
scrollbar_vert_update (GtkAdjustment *adjustment,
gpointer data)
{
@ -57,7 +57,7 @@ scrollbar_vert_update (GtkAdjustment *adjustment,
}
gint
gboolean
scrollbar_horz_update (GtkAdjustment *adjustment,
gpointer data)
{
@ -100,9 +100,7 @@ grab_and_scroll (GDisplay *gdisp,
GdkEventMotion *mevent)
{
if (mevent && mevent->window != gdisp->canvas->window)
{
return;
}
return;
scroll_display (gdisp,
startx - mevent->x - gdisp->offset_x,
@ -114,8 +112,8 @@ void
scroll_to_pointer_position (GDisplay *gdisp,
GdkEventMotion *mevent)
{
double child_x, child_y;
int off_x, off_y;
gdouble child_x, child_y;
gint off_x, off_y;
off_x = off_y = 0;
@ -124,6 +122,7 @@ scroll_to_pointer_position (GDisplay *gdisp,
off_x = mevent->x;
else if (mevent->x > gdisp->disp_width)
off_x = mevent->x - gdisp->disp_width;
if (mevent->y < 0)
off_y = mevent->y;
else if (mevent->y > gdisp->disp_height)
@ -145,15 +144,14 @@ scroll_to_pointer_position (GDisplay *gdisp,
}
}
int
gboolean
scroll_display (GDisplay *gdisp,
gint x_offset,
gint y_offset)
{
int old_x, old_y;
int src_x, src_y;
int dest_x, dest_y;
gint old_x, old_y;
gint src_x, src_y;
gint dest_x, dest_y;
GdkEvent *event;
old_x = gdisp->offset_x;
@ -229,16 +227,18 @@ scroll_display (GDisplay *gdisp,
!= NULL)
{
gtk_widget_event (gdisp->canvas, event);
if (event->expose.count == 0)
{
gdk_event_free (event);
break;
}
gdk_event_free (event);
}
return 1;
return TRUE;
}
return 0;
return FALSE;
}

View File

@ -21,31 +21,31 @@
/* app init and exit routines */
void init_scrolling (void);
void free_scrolling (void);
void init_scrolling (void);
void free_scrolling (void);
/* routines for scrolling the image via the scrollbars */
void scrollbar_disconnect (GtkAdjustment *adjuatment,
gpointer data);
gint scrollbar_vert_update (GtkAdjustment *adjuatment,
gpointer data);
gint scrollbar_horz_update (GtkAdjustment *adjuatment,
gpointer data);
void scrollbar_disconnect (GtkAdjustment *adjuatment,
gpointer data);
gboolean scrollbar_vert_update (GtkAdjustment *adjuatment,
gpointer data);
gboolean scrollbar_horz_update (GtkAdjustment *adjuatment,
gpointer data);
/* routines for grabbing the image and scrolling via the pointer */
void start_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void end_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void grab_and_scroll (GDisplay *gdisp,
GdkEventMotion *mevent);
void scroll_to_pointer_position (GDisplay *gdisp,
GdkEventMotion *mevent);
void start_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void end_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void grab_and_scroll (GDisplay *gdisp,
GdkEventMotion *mevent);
void scroll_to_pointer_position (GDisplay *gdisp,
GdkEventMotion *mevent);
/* generic scroll-by-offset function */
gint scroll_display (GDisplay *,
gint ,
gint );
gboolean scroll_display (GDisplay *gdisp,
gint x_offset,
gint y_offset);
#endif /* __SCROLL_H__ */

View File

@ -37,7 +37,6 @@
#include "gimpset.h"
#include "gimprc.h"
#include "gimpui.h"
#include "gximage.h"
#include "nav_window.h"
#include "scroll.h"
#include "scale.h"

View File

@ -37,7 +37,6 @@
#include "gimpset.h"
#include "gimprc.h"
#include "gimpui.h"
#include "gximage.h"
#include "nav_window.h"
#include "scroll.h"
#include "scale.h"

View File

@ -49,7 +49,6 @@
#include "plug_in.h"
#include "qmask.h"
#include "scale.h"
#include "scroll.h"
#include "selection.h"
#include "undo.h"
@ -58,7 +57,6 @@
#include "gdisplay_color.h"
#endif /* DISPLAY_FILTERS */
#include "tools/bezier_selectP.h"
#include "tools/tools.h"
#include "libgimp/gimpmath.h"

View File

@ -25,13 +25,9 @@
#include "appenv.h"
#include "colormaps.h"
#include "cursorutil.h"
#include "fileops.h"
#include "gdisplay_ops.h"
#include "gimpimage.h"
#include "gimpui.h"
#include "gximage.h"
#include "menus.h"
#include "scale.h"
#include "gimprc.h"
#include "libgimp/gimphelpui.h"

View File

@ -33,13 +33,13 @@
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpimage.h"
#include "gimppreviewcache.h"
#include "layer.h"
#include "parasitelist.h"
#include "paint_funcs.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "parasitelist.h"
#include "undo.h"
#include "gimppreviewcache.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"

View File

@ -23,17 +23,14 @@
#include "apptypes.h"
#include "appenv.h"
#include "apptypes.h"
#include "colormaps.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpset.h"
#include "gimpui.h"
#include "gximage.h"
#include "info_dialog.h"
#include "info_window.h"
#include "scroll.h"
#include "tools/tools.h"
@ -115,7 +112,7 @@ info_window_page_switch (GtkWidget *widget,
GtkNotebookPage *page,
gint page_num)
{
InfoDialog *info_win;
InfoDialog *info_win;
InfoWinData *iwd;
info_win = (InfoDialog *) gtk_object_get_user_data (GTK_OBJECT (widget));
@ -134,13 +131,12 @@ info_window_page_switch (GtkWidget *widget,
static void
info_window_create_extended (InfoDialog *info_win)
{
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *alignment;
GtkWidget *table;
GtkWidget *label;
GtkWidget *pixmap;
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *alignment;
GtkWidget *table;
GtkWidget *label;
GtkWidget *pixmap;
InfoWinData *iwd;
iwd = (InfoWinData *) info_win->user_data;
@ -245,10 +241,11 @@ info_window_create_extended (InfoDialog *info_win)
InfoDialog *
info_window_create (GDisplay *gdisp)
{
InfoDialog *info_win;
InfoDialog *info_win;
InfoWinData *iwd;
gchar *title, *title_buf;
gint type;
gchar *title;
gchar *title_buf;
gint type;
title = g_basename (gimp_image_filename (gdisp->gimage));
type = gimp_image_base_type (gdisp->gimage);
@ -335,9 +332,9 @@ info_window_change_display (GimpContext *context, /* NOT USED */
GDisplay *newdisp,
gpointer data /* Not used */)
{
GDisplay * gdisp = newdisp;
GDisplay * old_gdisp;
GimpImage * gimage;
GDisplay *gdisp = newdisp;
GDisplay *old_gdisp;
GimpImage *gimage;
InfoWinData *iwd;
iwd = (InfoWinData *) info_window_auto->user_data;
@ -345,16 +342,14 @@ info_window_change_display (GimpContext *context, /* NOT USED */
old_gdisp = (GDisplay *) iwd->gdisp;
if (!info_window_auto || gdisp == old_gdisp || !gdisp)
{
return;
}
return;
gimage = gdisp->gimage;
if (gimage && gimp_set_have (image_context, gimage))
{
iwd->gdisp = gdisp;
info_window_update(gdisp);
info_window_update (gdisp);
}
}
@ -371,9 +366,11 @@ info_window_follow_auto (void)
if(!info_window_auto)
{
info_window_auto = info_window_create ((void *) gdisp);
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), "display_changed",
GTK_SIGNAL_FUNC (info_window_change_display), NULL);
info_window_update(gdisp); /* Update to include the info */
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()),
"display_changed",
GTK_SIGNAL_FUNC (info_window_change_display),
NULL);
info_window_update (gdisp); /* Update to include the info */
}
info_dialog_popup (info_window_auto);
@ -389,41 +386,38 @@ info_window_update_RGB (GDisplay *gdisp,
gdouble tx,
gdouble ty)
{
InfoWinData *iwd;
gchar buff[4];
guchar *color;
GimpImageType sample_type;
InfoDialog *info_win = gdisp->window_info_dialog;
gboolean force_update = FALSE;
InfoWinData *iwd;
gchar buff[4];
guchar *color;
GimpImageType sample_type;
InfoDialog *info_win = gdisp->window_info_dialog;
gboolean force_update = FALSE;
if (!info_win && info_window_auto != NULL)
{
info_win = info_window_auto;
}
info_win = info_window_auto;
if (!info_win)
return;
iwd = (InfoWinData *) info_win->user_data;
if(iwd->gdisp != gdisp)
if (iwd->gdisp != gdisp)
force_update = TRUE;
iwd->gdisp = gdisp;
if(force_update == TRUE)
if (force_update)
{
gchar *title_buf;
info_window_update(gdisp);
title_buf = info_window_title(gdisp);
gtk_window_set_title (GTK_WINDOW (info_window_auto->shell), title_buf);
g_free (title_buf);
gchar *title;
info_window_update (gdisp);
title = info_window_title (gdisp);
gtk_window_set_title (GTK_WINDOW (info_window_auto->shell), title);
g_free (title);
}
if (!iwd || iwd->showingPreview == FALSE)
if (!iwd || !iwd->showingPreview)
return;
/* gimp_image_active_drawable (gdisp->gimage) */
@ -464,7 +458,6 @@ void
info_window_free (InfoDialog *info_win)
{
InfoWinData *iwd;
extern gint gimage_image_count (void);
if (!info_win && info_window_auto)
{
@ -491,7 +484,7 @@ info_window_update (GDisplay *gdisp)
gdouble unit_factor;
gint unit_digits;
gchar format_buf[32];
InfoDialog *info_win = gdisp->window_info_dialog;
InfoDialog *info_win = gdisp->window_info_dialog;
if (!info_win && info_window_auto != NULL)
info_win = info_window_auto;

View File

@ -38,9 +38,7 @@
#include "layers_dialog.h"
#include "menus.h"
#include "paths_dialog.h"
#include "paint_funcs.h"
#include "preferences_dialog.h"
#include "scale.h"
#include "toolbox.h"
#include "tools/tools.h"
@ -1018,9 +1016,9 @@ menus_reorder_plugins (void)
GtkItemFactory *item_factory;
GtkWidget *menu_item;
GtkWidget *menu;
GList *list;
gchar *path;
gint i, pos;
GList *list;
gchar *path;
gint i, pos;
/* Move all menu items under "<Toolbox>/Xtns" which are not submenus or
* separators to the top of the menu
@ -1212,7 +1210,7 @@ menus_set_sensitive (gchar *path,
gboolean sensitive)
{
GtkItemFactory *ifactory;
GtkWidget *widget = NULL;
GtkWidget *widget = NULL;
if (! path)
return;
@ -1240,7 +1238,7 @@ menus_set_state (gchar *path,
gboolean state)
{
GtkItemFactory *ifactory;
GtkWidget *widget = NULL;
GtkWidget *widget = NULL;
if (!menus_initialized)
menus_init ();
@ -1297,9 +1295,10 @@ menus_last_opened_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint num)
{
gchar *filename, *raw_filename;
guint num_entries;
gint status;
gchar *filename;
gchar *raw_filename;
guint num_entries;
gint status;
num_entries = g_slist_length (last_opened_raw_filenames);
if (num >= num_entries)

View File

@ -23,17 +23,14 @@
#include "apptypes.h"
#include "appenv.h"
#include "apptypes.h"
#include "colormaps.h"
#include "gdisplay.h"
#include "gimpcontext.h"
#include "gimpimage.h"
#include "gimpset.h"
#include "gimpui.h"
#include "gximage.h"
#include "info_dialog.h"
#include "info_window.h"
#include "scroll.h"
#include "tools/tools.h"
@ -115,7 +112,7 @@ info_window_page_switch (GtkWidget *widget,
GtkNotebookPage *page,
gint page_num)
{
InfoDialog *info_win;
InfoDialog *info_win;
InfoWinData *iwd;
info_win = (InfoDialog *) gtk_object_get_user_data (GTK_OBJECT (widget));
@ -134,13 +131,12 @@ info_window_page_switch (GtkWidget *widget,
static void
info_window_create_extended (InfoDialog *info_win)
{
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *alignment;
GtkWidget *table;
GtkWidget *label;
GtkWidget *pixmap;
GtkWidget *hbox;
GtkWidget *frame;
GtkWidget *alignment;
GtkWidget *table;
GtkWidget *label;
GtkWidget *pixmap;
InfoWinData *iwd;
iwd = (InfoWinData *) info_win->user_data;
@ -245,10 +241,11 @@ info_window_create_extended (InfoDialog *info_win)
InfoDialog *
info_window_create (GDisplay *gdisp)
{
InfoDialog *info_win;
InfoDialog *info_win;
InfoWinData *iwd;
gchar *title, *title_buf;
gint type;
gchar *title;
gchar *title_buf;
gint type;
title = g_basename (gimp_image_filename (gdisp->gimage));
type = gimp_image_base_type (gdisp->gimage);
@ -335,9 +332,9 @@ info_window_change_display (GimpContext *context, /* NOT USED */
GDisplay *newdisp,
gpointer data /* Not used */)
{
GDisplay * gdisp = newdisp;
GDisplay * old_gdisp;
GimpImage * gimage;
GDisplay *gdisp = newdisp;
GDisplay *old_gdisp;
GimpImage *gimage;
InfoWinData *iwd;
iwd = (InfoWinData *) info_window_auto->user_data;
@ -345,16 +342,14 @@ info_window_change_display (GimpContext *context, /* NOT USED */
old_gdisp = (GDisplay *) iwd->gdisp;
if (!info_window_auto || gdisp == old_gdisp || !gdisp)
{
return;
}
return;
gimage = gdisp->gimage;
if (gimage && gimp_set_have (image_context, gimage))
{
iwd->gdisp = gdisp;
info_window_update(gdisp);
info_window_update (gdisp);
}
}
@ -371,9 +366,11 @@ info_window_follow_auto (void)
if(!info_window_auto)
{
info_window_auto = info_window_create ((void *) gdisp);
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()), "display_changed",
GTK_SIGNAL_FUNC (info_window_change_display), NULL);
info_window_update(gdisp); /* Update to include the info */
gtk_signal_connect (GTK_OBJECT (gimp_context_get_user ()),
"display_changed",
GTK_SIGNAL_FUNC (info_window_change_display),
NULL);
info_window_update (gdisp); /* Update to include the info */
}
info_dialog_popup (info_window_auto);
@ -389,41 +386,38 @@ info_window_update_RGB (GDisplay *gdisp,
gdouble tx,
gdouble ty)
{
InfoWinData *iwd;
gchar buff[4];
guchar *color;
GimpImageType sample_type;
InfoDialog *info_win = gdisp->window_info_dialog;
gboolean force_update = FALSE;
InfoWinData *iwd;
gchar buff[4];
guchar *color;
GimpImageType sample_type;
InfoDialog *info_win = gdisp->window_info_dialog;
gboolean force_update = FALSE;
if (!info_win && info_window_auto != NULL)
{
info_win = info_window_auto;
}
info_win = info_window_auto;
if (!info_win)
return;
iwd = (InfoWinData *) info_win->user_data;
if(iwd->gdisp != gdisp)
if (iwd->gdisp != gdisp)
force_update = TRUE;
iwd->gdisp = gdisp;
if(force_update == TRUE)
if (force_update)
{
gchar *title_buf;
info_window_update(gdisp);
title_buf = info_window_title(gdisp);
gtk_window_set_title (GTK_WINDOW (info_window_auto->shell), title_buf);
g_free (title_buf);
gchar *title;
info_window_update (gdisp);
title = info_window_title (gdisp);
gtk_window_set_title (GTK_WINDOW (info_window_auto->shell), title);
g_free (title);
}
if (!iwd || iwd->showingPreview == FALSE)
if (!iwd || !iwd->showingPreview)
return;
/* gimp_image_active_drawable (gdisp->gimage) */
@ -464,7 +458,6 @@ void
info_window_free (InfoDialog *info_win)
{
InfoWinData *iwd;
extern gint gimage_image_count (void);
if (!info_win && info_window_auto)
{
@ -491,7 +484,7 @@ info_window_update (GDisplay *gdisp)
gdouble unit_factor;
gint unit_digits;
gchar format_buf[32];
InfoDialog *info_win = gdisp->window_info_dialog;
InfoDialog *info_win = gdisp->window_info_dialog;
if (!info_win && info_window_auto != NULL)
info_win = info_window_auto;

View File

@ -33,13 +33,13 @@
#include "gdisplay.h"
#include "gimage_mask.h"
#include "gimpimage.h"
#include "gimppreviewcache.h"
#include "layer.h"
#include "parasitelist.h"
#include "paint_funcs.h"
#include "pixel_region.h"
#include "temp_buf.h"
#include "parasitelist.h"
#include "undo.h"
#include "gimppreviewcache.h"
#include "temp_buf.h"
#include "tile_manager.h"
#include "tile.h"

View File

@ -38,9 +38,7 @@
#include "layers_dialog.h"
#include "menus.h"
#include "paths_dialog.h"
#include "paint_funcs.h"
#include "preferences_dialog.h"
#include "scale.h"
#include "toolbox.h"
#include "tools/tools.h"
@ -1018,9 +1016,9 @@ menus_reorder_plugins (void)
GtkItemFactory *item_factory;
GtkWidget *menu_item;
GtkWidget *menu;
GList *list;
gchar *path;
gint i, pos;
GList *list;
gchar *path;
gint i, pos;
/* Move all menu items under "<Toolbox>/Xtns" which are not submenus or
* separators to the top of the menu
@ -1212,7 +1210,7 @@ menus_set_sensitive (gchar *path,
gboolean sensitive)
{
GtkItemFactory *ifactory;
GtkWidget *widget = NULL;
GtkWidget *widget = NULL;
if (! path)
return;
@ -1240,7 +1238,7 @@ menus_set_state (gchar *path,
gboolean state)
{
GtkItemFactory *ifactory;
GtkWidget *widget = NULL;
GtkWidget *widget = NULL;
if (!menus_initialized)
menus_init ();
@ -1297,9 +1295,10 @@ menus_last_opened_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint num)
{
gchar *filename, *raw_filename;
guint num_entries;
gint status;
gchar *filename;
gchar *raw_filename;
guint num_entries;
gint status;
num_entries = g_slist_length (last_opened_raw_filenames);
if (num >= num_entries)

View File

@ -38,9 +38,7 @@
#include "layers_dialog.h"
#include "menus.h"
#include "paths_dialog.h"
#include "paint_funcs.h"
#include "preferences_dialog.h"
#include "scale.h"
#include "toolbox.h"
#include "tools/tools.h"
@ -1018,9 +1016,9 @@ menus_reorder_plugins (void)
GtkItemFactory *item_factory;
GtkWidget *menu_item;
GtkWidget *menu;
GList *list;
gchar *path;
gint i, pos;
GList *list;
gchar *path;
gint i, pos;
/* Move all menu items under "<Toolbox>/Xtns" which are not submenus or
* separators to the top of the menu
@ -1212,7 +1210,7 @@ menus_set_sensitive (gchar *path,
gboolean sensitive)
{
GtkItemFactory *ifactory;
GtkWidget *widget = NULL;
GtkWidget *widget = NULL;
if (! path)
return;
@ -1240,7 +1238,7 @@ menus_set_state (gchar *path,
gboolean state)
{
GtkItemFactory *ifactory;
GtkWidget *widget = NULL;
GtkWidget *widget = NULL;
if (!menus_initialized)
menus_init ();
@ -1297,9 +1295,10 @@ menus_last_opened_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint num)
{
gchar *filename, *raw_filename;
guint num_entries;
gint status;
gchar *filename;
gchar *raw_filename;
guint num_entries;
gint status;
num_entries = g_slist_length (last_opened_raw_filenames);
if (num >= num_entries)

View File

@ -37,7 +37,6 @@
#include "gimpset.h"
#include "gimprc.h"
#include "gimpui.h"
#include "gximage.h"
#include "nav_window.h"
#include "scroll.h"
#include "scale.h"

View File

@ -36,10 +36,11 @@
#include "libgimp/gimpmath.h"
static gchar * unique_name (GimpImage *, gchar *);
static gchar * unique_name (GimpImage *gimage,
gchar *cstr);
Path*
Path *
path_new (GimpImage *gimage,
PathType ptype,
GSList *path_details,
@ -59,10 +60,11 @@ path_new (GimpImage *gimage,
path->name = g_strdup (name);
path->path_details = path_details;
path->closed = closed;
path->state = state;
path->locked = locked;
path->pathtype = ptype;
path->closed = closed;
path->state = state;
path->locked = locked;
path->pathtype = ptype;
if(tattoo)
path->tattoo = tattoo;
else
@ -71,23 +73,25 @@ path_new (GimpImage *gimage,
return path;
}
Path*
Path *
path_copy (GimpImage *gimage,
Path *path)
{
Path* p_copy = g_new0 (Path, 1);
Path *p_copy = g_new0 (Path, 1);
gchar *name;
name = unique_name (gimage, path->name);
if (name)
p_copy->name = name;
else
p_copy->name = g_strdup (path->name);
p_copy->closed = path->closed;
p_copy->state = path->state;
p_copy->pathtype = path->pathtype;
p_copy->closed = path->closed;
p_copy->state = path->state;
p_copy->pathtype = path->pathtype;
p_copy->path_details = pathpoints_copy (path->path_details);
if (gimage)
p_copy->tattoo = gimp_image_get_new_tattoo (gimage);
else
@ -107,17 +111,18 @@ path_free (Path *path)
}
PathPoint*
PathPoint *
path_point_new (guint type,
gdouble x,
gdouble y)
{
PathPoint* pathpoint = g_new0 (PathPoint,1);
PathPoint *pathpoint = g_new0 (PathPoint,1);
pathpoint->type = type;
pathpoint->x = x;
pathpoint->y = y;
return(pathpoint);
pathpoint->x = x;
pathpoint->y = y;
return pathpoint;
}
void
@ -131,8 +136,8 @@ path_stroke (GimpImage *gimage,
PathList *pl,
Path *bzp)
{
BezierSelect * bezier_sel;
GDisplay * gdisp;
BezierSelect *bezier_sel;
GDisplay *gdisp;
gdisp = gdisplays_check_valid (pl->gdisp, gimage);
bezier_sel = path_to_beziersel (bzp);
@ -147,24 +152,26 @@ path_distance (Path *bzp,
gint *y,
gdouble *grad)
{
gint ret;
BezierSelect * bezier_sel;
gint ret;
BezierSelect *bezier_sel;
bezier_sel = path_to_beziersel (bzp);
ret = bezier_distance_along (bezier_sel, !bzp->closed, dist, x, y, grad);
bezier_select_free (bezier_sel);
return (ret);
return ret;
}
Tattoo
path_get_tattoo (Path* p)
{
if(!p)
if (!p)
{
g_warning("path_get_tattoo: invalid path");
g_warning ("path_get_tattoo: invalid path");
return 0;
}
return (p->tattoo);
return p->tattoo;
}
Path*
@ -174,7 +181,7 @@ path_get_path_by_tattoo (GimpImage *gimage,
GSList *tlist;
PathList *plp;
if(!gimage || !tattoo)
if (!gimage || !tattoo)
return NULL;
/* Go around the list and check all tattoos. */
@ -182,18 +189,17 @@ path_get_path_by_tattoo (GimpImage *gimage,
/* Get path structure */
plp = (PathList*) gimp_image_get_paths (gimage);
if(!plp)
if (!plp)
return (NULL);
tlist = plp->bz_paths;
while(tlist)
for (tlist = plp->bz_paths; tlist; tlist = g_slist_next(tlist))
{
Path* p = (Path*)(tlist->data);
if(p->tattoo == tattoo)
if (p->tattoo == tattoo)
return (p);
tlist = g_slist_next(tlist);
}
return (NULL);
}
@ -203,29 +209,32 @@ path_list_new (GimpImage *gimage,
GSList *bz_paths)
{
PathList *pip = g_new0 (PathList, 1);
pip->gimage = gimage;
pip->gimage = gimage;
pip->last_selected_row = last_selected_row;
/* add connector to image delete/destroy */
pip->sig_id = gtk_signal_connect(GTK_OBJECT (gimage),
"destroy",
GTK_SIGNAL_FUNC (paths_dialog_destroy_cb),
pip);
pip->sig_id = gtk_signal_connect (GTK_OBJECT (gimage),
"destroy",
GTK_SIGNAL_FUNC (paths_dialog_destroy_cb),
pip);
pip->bz_paths = bz_paths;
return (PathList *)pip;
return (PathList *) pip;
}
void
path_list_free (PathList* iml)
{
g_return_if_fail (iml != NULL);
if (iml->bz_paths)
{
g_slist_foreach (iml->bz_paths, (GFunc)path_free, NULL);
g_slist_foreach (iml->bz_paths, (GFunc) path_free, NULL);
g_slist_free (iml->bz_paths);
}
g_free (iml);
}
@ -243,32 +252,36 @@ path_to_beziersel (Path *bzp)
bezier_sel = g_new0 (BezierSelect, 1);
bezier_sel->num_points = 0;
bezier_sel->mask = NULL;
bezier_sel->core = NULL; /* not required will be reset in bezier code */
bezier_sel->mask = NULL;
bezier_sel->core = NULL; /* not required will be reset in bezier code */
bezier_select_reset (bezier_sel);
bezier_sel->closed = bzp->closed;
/* bezier_sel->state = BEZIER_ADD; */
bezier_sel->state = bzp->state;
bezier_sel->state = bzp->state;
while (list)
{
PathPoint *pdata;
pdata = (PathPoint*)list->data;
pdata = (PathPoint *) list->data;
if (pdata->type == BEZIER_MOVE)
{
/* printf("Close last curve off\n"); */
bezier_sel->last_point->next = bpnt;
bpnt->prev = bezier_sel->last_point;
bezier_sel->cur_anchor = NULL;
bezier_sel->cur_anchor = NULL;
bezier_sel->cur_control = NULL;
bpnt = NULL;
}
bezier_add_point (bezier_sel,
(gint) pdata->type,
RINT(pdata->x), /* ALT add rint() */
RINT(pdata->y));
RINT (pdata->x),
RINT (pdata->y));
if (bpnt == NULL)
bpnt = bezier_sel->last_point;
list = g_slist_next (list);
}
@ -303,7 +316,8 @@ strip_off_cnumber (gchar *str)
(num = atoi(hashptr+1)) > 0 && /* which is a number */
((int) log10 (num) + 1) == strlen (hashptr+1)) /* which is at the end */
{
gchar * tstr;
gchar *tstr;
/* Has a #<number> */
*hashptr = '\0';
tstr = g_strdup (copy);
@ -320,13 +334,13 @@ static gchar *
unique_name (GimpImage *gimage,
gchar *cstr)
{
GSList *tlist;
GSList *tlist;
PathList *plp;
gboolean unique = TRUE;
gchar *copy_cstr;
gchar *copy_test;
gchar *stripped_copy;
gint counter = 1;
gboolean unique = TRUE;
gchar *copy_cstr;
gchar *copy_test;
gchar *stripped_copy;
gint counter = 1;
/* Get bzpath structure */
if (!gimage || !(plp = (PathList*) gimp_image_get_paths(gimage)))
@ -336,7 +350,10 @@ unique_name (GimpImage *gimage,
while (tlist)
{
gchar *test_str = ((Path*)(tlist->data))->name;
gchar *test_str;
test_str = ((Path *) (tlist->data))->name;
if (strcmp (cstr, test_str) == 0)
{
unique = FALSE;
@ -356,16 +373,18 @@ unique_name (GimpImage *gimage,
tlist = plp->bz_paths;
while(tlist)
while (tlist)
{
copy_test = ((Path*)(tlist->data))->name;
if(strcmp(copy_cstr,copy_test) == 0)
if (strcmp (copy_cstr,copy_test) == 0)
{
g_free(copy_cstr);
copy_cstr = g_strdup_printf("%s#%d",stripped_copy,counter++);
g_free (copy_cstr);
copy_cstr = g_strdup_printf ("%s#%d", stripped_copy, counter++);
tlist = plp->bz_paths;
continue;
}
tlist = g_slist_next(tlist);
}

View File

@ -41,9 +41,9 @@
/* STATIC variables */
/* These are the values of the initial pointer grab */
static int startx, starty;
static gint startx, starty;
gint
gboolean
scrollbar_vert_update (GtkAdjustment *adjustment,
gpointer data)
{
@ -57,7 +57,7 @@ scrollbar_vert_update (GtkAdjustment *adjustment,
}
gint
gboolean
scrollbar_horz_update (GtkAdjustment *adjustment,
gpointer data)
{
@ -100,9 +100,7 @@ grab_and_scroll (GDisplay *gdisp,
GdkEventMotion *mevent)
{
if (mevent && mevent->window != gdisp->canvas->window)
{
return;
}
return;
scroll_display (gdisp,
startx - mevent->x - gdisp->offset_x,
@ -114,8 +112,8 @@ void
scroll_to_pointer_position (GDisplay *gdisp,
GdkEventMotion *mevent)
{
double child_x, child_y;
int off_x, off_y;
gdouble child_x, child_y;
gint off_x, off_y;
off_x = off_y = 0;
@ -124,6 +122,7 @@ scroll_to_pointer_position (GDisplay *gdisp,
off_x = mevent->x;
else if (mevent->x > gdisp->disp_width)
off_x = mevent->x - gdisp->disp_width;
if (mevent->y < 0)
off_y = mevent->y;
else if (mevent->y > gdisp->disp_height)
@ -145,15 +144,14 @@ scroll_to_pointer_position (GDisplay *gdisp,
}
}
int
gboolean
scroll_display (GDisplay *gdisp,
gint x_offset,
gint y_offset)
{
int old_x, old_y;
int src_x, src_y;
int dest_x, dest_y;
gint old_x, old_y;
gint src_x, src_y;
gint dest_x, dest_y;
GdkEvent *event;
old_x = gdisp->offset_x;
@ -229,16 +227,18 @@ scroll_display (GDisplay *gdisp,
!= NULL)
{
gtk_widget_event (gdisp->canvas, event);
if (event->expose.count == 0)
{
gdk_event_free (event);
break;
}
gdk_event_free (event);
}
return 1;
return TRUE;
}
return 0;
return FALSE;
}

View File

@ -21,31 +21,31 @@
/* app init and exit routines */
void init_scrolling (void);
void free_scrolling (void);
void init_scrolling (void);
void free_scrolling (void);
/* routines for scrolling the image via the scrollbars */
void scrollbar_disconnect (GtkAdjustment *adjuatment,
gpointer data);
gint scrollbar_vert_update (GtkAdjustment *adjuatment,
gpointer data);
gint scrollbar_horz_update (GtkAdjustment *adjuatment,
gpointer data);
void scrollbar_disconnect (GtkAdjustment *adjuatment,
gpointer data);
gboolean scrollbar_vert_update (GtkAdjustment *adjuatment,
gpointer data);
gboolean scrollbar_horz_update (GtkAdjustment *adjuatment,
gpointer data);
/* routines for grabbing the image and scrolling via the pointer */
void start_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void end_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void grab_and_scroll (GDisplay *gdisp,
GdkEventMotion *mevent);
void scroll_to_pointer_position (GDisplay *gdisp,
GdkEventMotion *mevent);
void start_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void end_grab_and_scroll (GDisplay *gdisp,
GdkEventButton *bevent);
void grab_and_scroll (GDisplay *gdisp,
GdkEventMotion *mevent);
void scroll_to_pointer_position (GDisplay *gdisp,
GdkEventMotion *mevent);
/* generic scroll-by-offset function */
gint scroll_display (GDisplay *,
gint ,
gint );
gboolean scroll_display (GDisplay *gdisp,
gint x_offset,
gint y_offset);
#endif /* __SCROLL_H__ */

View File

@ -38,9 +38,7 @@
#include "layers_dialog.h"
#include "menus.h"
#include "paths_dialog.h"
#include "paint_funcs.h"
#include "preferences_dialog.h"
#include "scale.h"
#include "toolbox.h"
#include "tools/tools.h"
@ -1018,9 +1016,9 @@ menus_reorder_plugins (void)
GtkItemFactory *item_factory;
GtkWidget *menu_item;
GtkWidget *menu;
GList *list;
gchar *path;
gint i, pos;
GList *list;
gchar *path;
gint i, pos;
/* Move all menu items under "<Toolbox>/Xtns" which are not submenus or
* separators to the top of the menu
@ -1212,7 +1210,7 @@ menus_set_sensitive (gchar *path,
gboolean sensitive)
{
GtkItemFactory *ifactory;
GtkWidget *widget = NULL;
GtkWidget *widget = NULL;
if (! path)
return;
@ -1240,7 +1238,7 @@ menus_set_state (gchar *path,
gboolean state)
{
GtkItemFactory *ifactory;
GtkWidget *widget = NULL;
GtkWidget *widget = NULL;
if (!menus_initialized)
menus_init ();
@ -1297,9 +1295,10 @@ menus_last_opened_cmd_callback (GtkWidget *widget,
gpointer callback_data,
guint num)
{
gchar *filename, *raw_filename;
guint num_entries;
gint status;
gchar *filename;
gchar *raw_filename;
guint num_entries;
gint status;
num_entries = g_slist_length (last_opened_raw_filenames);
if (num >= num_entries)