Makefile.am a proper naming scheme for all cursor files. Added zoom_in and

2000-03-01  Michael Natterer  <mitch@gimp.org>

	* Makefile.am
	* cursors/*: a proper naming scheme for all cursor files. Added
	zoom_in and zoom_out cursors.

	* app/bezier_select.c
	* app/by_color_select.c
	* app/cursorutil.[ch]
	* app/rect_select.c
	* app/scale.[ch]: changed according to the new cursor names. Some
	minor fixes.

	* app/magnify.[ch]: made the zoom_in/zoom_out toggle a proper
	tool_toggle and show cursors for the two modes.

	* plug-ins/print/print-util.c: patch from Robert Kravitz which
	fixes printing layers with alpha.
This commit is contained in:
Michael Natterer 2000-03-01 19:32:41 +00:00 committed by Michael Natterer
parent 39e29d705a
commit 723662a460
57 changed files with 1155 additions and 762 deletions

View File

@ -1,4 +1,23 @@
Wed Mar 1 00:46:09 CET 2000 Sven Neumann <sven@gimp.org
2000-03-01 Michael Natterer <mitch@gimp.org>
* Makefile.am
* cursors/*: a proper naming scheme for all cursor files. Added
zoom_in and zoom_out cursors.
* app/bezier_select.c
* app/by_color_select.c
* app/cursorutil.[ch]
* app/rect_select.c
* app/scale.[ch]: changed according to the new cursor names. Some
minor fixes.
* app/magnify.[ch]: made the zoom_in/zoom_out toggle a proper
tool_toggle and show cursors for the two modes.
* plug-ins/print/print-util.c: patch from Robert Kravitz which
fixes printing layers with alpha.
Wed Mar 1 00:46:09 CET 2000 Sven Neumann <sven@gimp.org>
* app/layers_dialog.c
* app/menus.c: remove ellipses from menu entries

View File

@ -22,32 +22,36 @@ bin_SCRIPTS = gimptool @GIMPINSTALL@
EXTRA_SCRIPTS = gimpinstall
EXTRA_DIST = \
cursors/bad \
cursors/badmsk \
cursors/dropper \
cursors/droppermsk \
cursors/mouse1 \
cursors/mouse1msk \
cursors/mouse1_ap \
cursors/mouse1_apmsk \
cursors/mouse1_cp \
cursors/mouse1_cpmsk \
cursors/mouse1_m \
cursors/mouse1_mmsk \
cursors/mouse1_mm \
cursors/mouse1_mmmsk \
cursors/mouse1_p \
cursors/mouse1_pmsk \
cursors/mouse1_sel \
cursors/mouse1_selmsk \
cursors/mouse1_selm \
cursors/mouse1_selmmsk \
cursors/mouse1_selp \
cursors/mouse1_selpmsk \
cursors/mouse1_selu \
cursors/mouse1_selumsk \
cursors/mouse1_u \
cursors/mouse1_umsk \
cursors/mouse.xbm \
cursors/mouse_mask.xbm \
cursors/mouse_add.xbm \
cursors/mouse_add_mask.xbm \
cursors/mouse_subtract.xbm \
cursors/mouse_subtract_mask.xbm \
cursors/mouse_intersect.xbm \
cursors/mouse_intersect_mask.xbm \
cursors/mouse_point.xbm \
cursors/mouse_point_mask.xbm \
cursors/mouse_rectangle.xbm \
cursors/mouse_rectangle_mask.xbm \
cursors/mouse_move.xbm \
cursors/mouse_move_mask.xbm \
cursors/selection.xbm \
cursors/selection_mask.xbm \
cursors/selection_add.xbm \
cursors/selection_add_mask.xbm \
cursors/selection_subtract.xbm \
cursors/selection_subtract_mask.xbm \
cursors/selection_intersect.xbm \
cursors/selection_intersect_mask.xbm \
cursors/bad.xbm \
cursors/bad_mask.xbm \
cursors/dropper.xbm \
cursors/dropper_mask.xbm \
cursors/zoom_in.xbm \
cursors/zoom_in_mask.xbm \
cursors/zoom_out.xbm \
cursors/zoom_out_mask.xbm \
pixmaps/anchor.xpm \
pixmaps/chain.xpm \
pixmaps/channel.xbm \

View File

@ -1443,12 +1443,12 @@ points_in_box(BezierPoint *points,
return c;
}
static int
bezier_point_on_curve(GDisplay *gdisp,
BezierSelect *bezier_sel,
gint x,
gint y,
gint halfwidth)
static gint
bezier_point_on_curve (GDisplay *gdisp,
BezierSelect *bezier_sel,
gint x,
gint y,
gint halfwidth)
{
BezierCheckPnts chkpnts;
BezierPoint * points;
@ -1462,41 +1462,45 @@ bezier_point_on_curve(GDisplay *gdisp,
chkpnts.halfwidth = halfwidth;
chkpnts.found = FALSE;
if(cnt)
if (cnt)
cnt->count = 0;
points = bezier_sel->points;
start_pt = bezier_sel->points;
if(bezier_sel->num_points >= 4)
if (bezier_sel->num_points >= 4)
{
do {
point_counts = count_points_on_curve(points);
if(point_counts >= 4)
{
do {
if(points_in_box(points,x,y))
do
{
point_counts = count_points_on_curve(points);
if (point_counts >= 4)
{
do
{
bezier_draw_segment (bezier_sel, points,
SUBDIVIDE, IMAGE_COORDS,
bezier_check_points,
&chkpnts);
if (points_in_box (points, x, y))
{
bezier_draw_segment (bezier_sel, points,
SUBDIVIDE, IMAGE_COORDS,
bezier_check_points,
&chkpnts);
}
points = next_anchor (points, &next_curve);
/* g_print ("next_anchor = %p\n",points); */
}
points = next_anchor(points,&next_curve);
/* g_print ("next_anchor = %p\n",points); */
} while (points != start_pt && points);
if(cnt)
cnt->count++;
start_pt = next_curve;
points = next_curve;
}
else
break; /* must be last curve since only this one is allowed < 4
* points.
*/
} while(next_curve);
while (points != start_pt && points);
if (cnt)
cnt->count++;
start_pt = next_curve;
points = next_curve;
}
else
break; /* must be last curve since only this one is allowed < 4
* points.
*/
}
while (next_curve);
}
return (chkpnts.found);
return chkpnts.found;
}
static void
@ -1512,120 +1516,132 @@ bezier_select_cursor_update (Tool *tool,
gint halfwidth,dummy;
gint x,y;
gdisp = (GDisplay *)gdisp_ptr;
gdisp = (GDisplay *) gdisp_ptr;
bezier_sel = tool->private;
if(gdisp != tool->gdisp_ptr || bezier_sel->core->draw_state == INVISIBLE)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR);
return;
}
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, TRUE, 0);
/* get halfwidth in image coord */
gdisplay_untransform_coords (gdisp, mevent->x + BEZIER_HALFWIDTH, 0, &halfwidth, &dummy, TRUE, 0);
gdisplay_untransform_coords (gdisp, mevent->x + BEZIER_HALFWIDTH, 0,
&halfwidth, &dummy, TRUE, 0);
halfwidth -= x;
on_control_pnt = bezier_on_control_point(gdisp,bezier_sel,x,y,halfwidth);
on_control_pnt = bezier_on_control_point (gdisp, bezier_sel, x, y, halfwidth);
on_curve = bezier_point_on_curve(gdisp,bezier_sel,x,y,halfwidth);
on_curve = bezier_point_on_curve (gdisp, bezier_sel, x, y, halfwidth);
if(bezier_sel->mask && bezier_sel->closed &&
channel_value(bezier_sel->mask, x, y) &&
!on_control_pnt &&
(!on_curve || ModeEdit != EXTEND_ADD))
if (bezier_sel->mask && bezier_sel->closed &&
channel_value(bezier_sel->mask, x, y) &&
!on_control_pnt &&
(!on_curve || ModeEdit != EXTEND_ADD))
{
in_selection_area = TRUE;
if ((mevent->state & GDK_SHIFT_MASK) && !(mevent->state & GDK_CONTROL_MASK))
gdisplay_install_tool_cursor (gdisp,GIMP_MOUSE1SELP_CURSOR );
else if ((mevent->state & GDK_CONTROL_MASK) && !(mevent->state & GDK_SHIFT_MASK))
gdisplay_install_tool_cursor (gdisp,GIMP_MOUSE1SELM_CURSOR );
else if ((mevent->state & GDK_CONTROL_MASK) && (mevent->state & GDK_SHIFT_MASK))
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1SELU_CURSOR);
else
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1SEL_CURSOR);
return;
}
if(mevent->state & GDK_MOD1_MASK)
{
/* Moving curve */
if(mevent->state & GDK_SHIFT_MASK)
if ((mevent->state & GDK_SHIFT_MASK) &&
!(mevent->state & GDK_CONTROL_MASK))
{
/* moving on 1 curve */
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1MM_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_SELECTION_ADD_CURSOR);
}
else if ((mevent->state & GDK_CONTROL_MASK) &&
!(mevent->state & GDK_SHIFT_MASK))
{
gdisplay_install_tool_cursor (gdisp, GIMP_SELECTION_SUBTRACT_CURSOR);
}
else if ((mevent->state & GDK_CONTROL_MASK) &&
(mevent->state & GDK_SHIFT_MASK))
{
gdisplay_install_tool_cursor (gdisp, GIMP_SELECTION_INTERSECT_CURSOR);
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1MM_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_SELECTION_CURSOR);
}
return;
}
if (mevent->state & GDK_MOD1_MASK)
{
/* Moving curve */
if (mevent->state & GDK_SHIFT_MASK)
{
/* moving on 1 curve */
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_MOVE_CURSOR);
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_MOVE_CURSOR);
}
}
else
{
switch(ModeEdit)
switch (ModeEdit)
{
case EXTEND_NEW:
if(on_control_pnt && bezier_sel->closed)
if (on_control_pnt && bezier_sel->closed)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1CP_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_RECTANGLE_CURSOR);
/* g_print ("add to curve cursor\n"); */
}
else if(on_curve)
else if (on_curve)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1AP_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_POINT_CURSOR);
/* g_print ("edit control point cursor\n"); */
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1AP_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_POINT_CURSOR);
}
break;
case EXTEND_ADD:
if(on_curve)
if (on_curve)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1P_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_ADD_CURSOR);
/* g_print ("add to curve cursor\n"); */
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR);
/* g_print ("default no action cursor\n"); */
}
break;
case EXTEND_EDIT:
if(on_control_pnt)
if (on_control_pnt)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1CP_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_RECTANGLE_CURSOR);
/* g_print ("edit control point cursor\n"); */
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR);
/* g_print ("default no action cursor\n"); */
}
break;
case EXTEND_REMOVE:
if(on_control_pnt && mevent->state & GDK_SHIFT_MASK)
if (on_control_pnt && mevent->state & GDK_SHIFT_MASK)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1M_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_SUBTRACT_CURSOR);
g_print ("delete whole curve cursor\n");
}
else if(on_control_pnt)
else if (on_control_pnt)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1M_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_SUBTRACT_CURSOR);
/* g_print ("remove point cursor\n"); */
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR);
/* g_print ("default no action cursor\n"); */
}
break;
default:
g_print ("In default\n");
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR);
break;
}
}

View File

@ -454,13 +454,13 @@ by_color_select_cursor_update (Tool *tool,
switch (by_col_sel->operation)
{
case SELECTION_ADD:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1P_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_ADD_CURSOR);
break;
case SELECTION_SUB:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1M_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_SUBTRACT_CURSOR);
break;
case SELECTION_INTERSECT:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1U_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_INTERSECT_CURSOR);
break;
case SELECTION_REPLACE:
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);

View File

@ -19,77 +19,130 @@
#include "cursorutil.h"
#include "dialog_handler.h"
#include "gdisplay.h" /* for gdisplay_*_override_cursor() */
#include "../cursors/mouse1"
#include "../cursors/mouse1msk"
#include "../cursors/mouse1_p"
#include "../cursors/mouse1_pmsk"
#include "../cursors/mouse1_m"
#include "../cursors/mouse1_mmsk"
#include "../cursors/mouse1_u"
#include "../cursors/mouse1_umsk"
#include "../cursors/dropper"
#include "../cursors/droppermsk"
#include "../cursors/mouse1_ap"
#include "../cursors/mouse1_apmsk"
#include "../cursors/mouse1_cp"
#include "../cursors/mouse1_cpmsk"
#include "../cursors/mouse1_mm"
#include "../cursors/mouse1_mmmsk"
#include "../cursors/mouse1_selm"
#include "../cursors/mouse1_selmmsk"
#include "../cursors/mouse1_selp"
#include "../cursors/mouse1_selpmsk"
#include "../cursors/mouse1_selu"
#include "../cursors/mouse1_selumsk"
#include "../cursors/mouse1_sel"
#include "../cursors/mouse1_selmsk"
#include "../cursors/bad"
#include "../cursors/badmsk"
#include "cursors/mouse.xbm"
#include "cursors/mouse_mask.xbm"
#include "cursors/mouse_add.xbm"
#include "cursors/mouse_add_mask.xbm"
#include "cursors/mouse_subtract.xbm"
#include "cursors/mouse_subtract_mask.xbm"
#include "cursors/mouse_intersect.xbm"
#include "cursors/mouse_intersect_mask.xbm"
#include "cursors/mouse_point.xbm"
#include "cursors/mouse_point_mask.xbm"
#include "cursors/mouse_rectangle.xbm"
#include "cursors/mouse_rectangle_mask.xbm"
#include "cursors/mouse_move.xbm"
#include "cursors/mouse_move_mask.xbm"
#include "cursors/selection.xbm"
#include "cursors/selection_mask.xbm"
#include "cursors/selection_add.xbm"
#include "cursors/selection_add_mask.xbm"
#include "cursors/selection_subtract.xbm"
#include "cursors/selection_subtract_mask.xbm"
#include "cursors/selection_intersect.xbm"
#include "cursors/selection_intersect_mask.xbm"
#include "cursors/bad.xbm"
#include "cursors/bad_mask.xbm"
#include "cursors/dropper.xbm"
#include "cursors/dropper_mask.xbm"
#include "cursors/zoom_in.xbm"
#include "cursors/zoom_in_mask.xbm"
#include "cursors/zoom_out.xbm"
#include "cursors/zoom_out_mask.xbm"
typedef struct
{
unsigned char *bits;
unsigned char *mask_bits;
int width, height;
int x_hot, y_hot;
guchar *bits;
guchar *mask_bits;
gint width, height;
gint x_hot, y_hot;
GdkCursor *cursor;
} BM_Cursor;
static BM_Cursor gimp_cursors[] =
/* these have to match up with the enum in cursorutil.h */
{
{ mouse1_bits, mouse1msk_bits, mouse1_width, mouse1_height,
mouse1_x_hot, mouse1_y_hot, NULL},
{ mouse1_p_bits, mouse1_pmsk_bits, mouse1_p_width, mouse1_p_height,
mouse1_p_x_hot, mouse1_p_y_hot, NULL},
{ mouse1_m_bits, mouse1_mmsk_bits, mouse1_m_width, mouse1_m_height,
mouse1_m_x_hot, mouse1_m_y_hot, NULL},
{ mouse1_u_bits, mouse1_umsk_bits, mouse1_u_width, mouse1_u_height,
mouse1_u_x_hot, mouse1_u_y_hot, NULL},
{ dropper_bits, droppermsk_bits, dropper_width, dropper_height,
dropper_x_hot, dropper_y_hot, NULL},
{ mouse1_ap_bits, mouse1_apmsk_bits, mouse1_ap_width, mouse1_ap_height,
mouse1_ap_x_hot, mouse1_ap_y_hot, NULL},
{ mouse1_cp_bits, mouse1_cpmsk_bits, mouse1_cp_width, mouse1_cp_height,
mouse1_cp_x_hot, mouse1_cp_y_hot, NULL},
{ mouse1_mm_bits, mouse1_mmmsk_bits, mouse1_mm_width, mouse1_mm_height,
mouse1_mm_x_hot, mouse1_mm_y_hot, NULL},
{ mouse1_selp_bits, mouse1_selpmsk_bits, mouse1_selp_width, mouse1_selp_height,
mouse1_selp_x_hot, mouse1_selp_y_hot, NULL},
{ mouse1_selm_bits, mouse1_selmmsk_bits, mouse1_selm_width, mouse1_selm_height,
mouse1_selm_x_hot, mouse1_selm_y_hot, NULL},
{ mouse1_selu_bits, mouse1_selumsk_bits, mouse1_selu_width, mouse1_selu_height,
mouse1_selu_x_hot, mouse1_selu_y_hot, NULL},
{ mouse1_sel_bits, mouse1_selmsk_bits, mouse1_sel_width, mouse1_sel_height,
mouse1_sel_x_hot, mouse1_sel_y_hot, NULL},
{ bad_bits, badmsk_bits, bad_width, bad_height,
bad_x_hot, bad_y_hot, NULL},
{
mouse_bits, mouse_mask_bits,
mouse_width, mouse_height,
mouse_x_hot, mouse_y_hot, NULL
},
{
mouse_add_bits, mouse_add_mask_bits,
mouse_add_width, mouse_add_height,
mouse_add_x_hot, mouse_add_y_hot, NULL
},
{
mouse_subtract_bits, mouse_subtract_mask_bits,
mouse_subtract_width, mouse_subtract_height,
mouse_subtract_x_hot, mouse_subtract_y_hot, NULL
},
{
mouse_intersect_bits, mouse_intersect_mask_bits,
mouse_intersect_width, mouse_intersect_height,
mouse_intersect_x_hot, mouse_intersect_y_hot, NULL
},
{
mouse_point_bits, mouse_point_mask_bits,
mouse_point_width, mouse_point_height,
mouse_point_x_hot, mouse_point_y_hot, NULL
},
{
mouse_rectangle_bits, mouse_rectangle_mask_bits,
mouse_rectangle_width, mouse_rectangle_height,
mouse_rectangle_x_hot, mouse_rectangle_y_hot, NULL
},
{
mouse_move_bits, mouse_move_mask_bits,
mouse_move_width, mouse_move_height,
mouse_move_x_hot, mouse_move_y_hot, NULL
},
{
selection_bits, selection_mask_bits,
selection_width, selection_height,
selection_x_hot, selection_y_hot, NULL
},
{
selection_add_bits, selection_add_mask_bits,
selection_add_width, selection_add_height,
selection_add_x_hot, selection_add_y_hot, NULL
},
{
selection_subtract_bits, selection_subtract_mask_bits,
selection_subtract_width, selection_subtract_height,
selection_subtract_x_hot, selection_subtract_y_hot, NULL
},
{
selection_intersect_bits, selection_intersect_mask_bits,
selection_intersect_width, selection_intersect_height,
selection_intersect_x_hot, selection_intersect_y_hot, NULL
},
{
bad_bits, bad_mask_bits,
bad_width, bad_height,
bad_x_hot, bad_y_hot, NULL
},
{
dropper_bits, dropper_mask_bits,
dropper_width, dropper_height,
dropper_x_hot, dropper_y_hot, NULL
},
{
zoom_in_bits, zoom_in_mask_bits,
zoom_in_width, zoom_in_height,
zoom_in_x_hot, zoom_in_y_hot, NULL
},
{
zoom_out_bits, zoom_out_mask_bits,
zoom_out_width, zoom_out_height,
zoom_out_x_hot, zoom_out_y_hot, NULL
}
};
extern GSList* display_list; /* It's in gdisplay.c, FYI */
static gboolean pending_removebusy = FALSE;
extern GSList *display_list; /* It's in gdisplay.c, FYI */
static gboolean pending_removebusy = FALSE;
static void
@ -100,8 +153,8 @@ create_cursor (BM_Cursor *bmcursor)
GdkColor fg, bg;
/* should have a way to configure the mouse colors */
gdk_color_parse("#FFFFFF", &bg);
gdk_color_parse("#000000", &fg);
gdk_color_parse ("#FFFFFF", &bg);
gdk_color_parse ("#000000", &fg);
pixmap = gdk_bitmap_create_from_data (NULL, bmcursor->bits,
bmcursor->width, bmcursor->height);
@ -111,7 +164,7 @@ create_cursor (BM_Cursor *bmcursor)
bmcursor->width,
bmcursor->height);
g_return_if_fail (pixmapmsk != NULL);
bmcursor->cursor = gdk_cursor_new_from_pixmap (pixmap, pixmapmsk, &fg, &bg,
bmcursor->x_hot,
bmcursor->y_hot);
@ -119,39 +172,37 @@ create_cursor (BM_Cursor *bmcursor)
}
static void
gimp_change_win_cursor (GdkWindow *win, GimpCursorType curtype)
gimp_change_win_cursor (GdkWindow *win,
GimpCursorType curtype)
{
GdkCursor *cursor;
g_return_if_fail (curtype < GIMP_LAST_CURSOR_ENTRY);
curtype -= GIMP_MOUSE1_CURSOR;
curtype -= GIMP_MOUSE_CURSOR;
if (!gimp_cursors[(int)curtype].cursor)
create_cursor (&gimp_cursors[(int)curtype]);
cursor = gimp_cursors[(int)curtype].cursor;
gdk_window_set_cursor (win, cursor);
}
void
change_win_cursor (win, cursortype)
GdkWindow *win;
GdkCursorType cursortype;
change_win_cursor (GdkWindow *win,
GdkCursorType cursortype)
{
GdkCursor *cursor;
if (cursortype > GDK_LAST_CURSOR)
{
gimp_change_win_cursor(win, (GimpCursorType)cursortype);
return;
}
{
gimp_change_win_cursor (win, (GimpCursorType)cursortype);
return;
}
cursor = gdk_cursor_new (cursortype);
gdk_window_set_cursor (win, cursor);
gdk_cursor_destroy (cursor);
}
void
unset_win_cursor (win)
GdkWindow *win;
unset_win_cursor (GdkWindow *win)
{
gdk_window_set_cursor (win, NULL);
}
@ -161,7 +212,7 @@ gimp_add_busy_cursors_until_idle (void)
{
if (!pending_removebusy)
{
gimp_add_busy_cursors();
gimp_add_busy_cursors ();
gtk_idle_add_priority (GTK_PRIORITY_HIGH,
gimp_remove_busy_cursors, NULL);
pending_removebusy = TRUE;
@ -172,40 +223,36 @@ void
gimp_add_busy_cursors (void)
{
GDisplay *gdisp;
GSList *list = display_list;
GSList *list;
/* Canvases */
while (list)
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
gdisplay_install_override_cursor (gdisp, GDK_WATCH);
list = g_slist_next (list);
}
/* Dialogs */
dialog_idle_all();
dialog_idle_all ();
gdk_flush();
gdk_flush ();
}
gint
gimp_remove_busy_cursors (gpointer data)
{
GDisplay *gdisp;
GSList *list = display_list;
GSList *list;
/* Canvases */
while (list)
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
gdisplay_remove_override_cursor (gdisp);
list = g_slist_next (list);
}
/* Dialogs */
dialog_unidle_all();
dialog_unidle_all ();
pending_removebusy = FALSE;
@ -227,8 +274,8 @@ gimp_remove_busy_cursors (gpointer data)
the XFree86-style license. <adam@gimp.org> */
gboolean
gtkutil_compress_motion (GtkWidget *widget,
gdouble *lastmotion_x,
gdouble *lastmotion_y)
gdouble *lastmotion_x,
gdouble *lastmotion_y)
{
GdkEvent *event;
GList *requeued_events = NULL;
@ -246,7 +293,7 @@ gtkutil_compress_motion (GtkWidget *widget,
*lastmotion_x = event->motion.x;
*lastmotion_y = event->motion.y;
gdk_event_free(event);
gdk_event_free (event);
success = TRUE;
}
else
@ -259,9 +306,9 @@ gtkutil_compress_motion (GtkWidget *widget,
event queue in order. */
while (requeued_events)
{
gdk_event_put ((GdkEvent*)requeued_events->data);
gdk_event_put ((GdkEvent*) requeued_events->data);
gdk_event_free ((GdkEvent*)requeued_events->data);
gdk_event_free ((GdkEvent*) requeued_events->data);
requeued_events =
g_list_remove_link (requeued_events, requeued_events);
}

View File

@ -30,30 +30,34 @@
typedef enum
{
GIMP_MOUSE1_CURSOR = (GDK_LAST_CURSOR + 2),
GIMP_MOUSE1P_CURSOR,
GIMP_MOUSE1M_CURSOR,
GIMP_MOUSE1U_CURSOR,
GIMP_COLOR_PICKER_CURSOR,
GIMP_MOUSE1AP_CURSOR,
GIMP_MOUSE1CP_CURSOR,
GIMP_MOUSE1MM_CURSOR,
GIMP_MOUSE1SELP_CURSOR,
GIMP_MOUSE1SELM_CURSOR,
GIMP_MOUSE1SELU_CURSOR,
GIMP_MOUSE1SEL_CURSOR,
GIMP_MOUSE_CURSOR = (GDK_LAST_CURSOR + 2),
GIMP_MOUSE_ADD_CURSOR,
GIMP_MOUSE_SUBTRACT_CURSOR,
GIMP_MOUSE_INTERSECT_CURSOR,
GIMP_MOUSE_POINT_CURSOR,
GIMP_MOUSE_RECTANGLE_CURSOR,
GIMP_MOUSE_MOVE_CURSOR,
GIMP_SELECTION_CURSOR,
GIMP_SELECTION_ADD_CURSOR,
GIMP_SELECTION_SUBTRACT_CURSOR,
GIMP_SELECTION_INTERSECT_CURSOR,
GIMP_BAD_CURSOR,
GIMP_COLOR_PICKER_CURSOR,
GIMP_ZOOM_IN_CURSOR,
GIMP_ZOOM_OUT_CURSOR,
GIMP_LAST_CURSOR_ENTRY
} GimpCursorType;
void change_win_cursor (GdkWindow *, GdkCursorType);
void unset_win_cursor (GdkWindow *);
void change_win_cursor (GdkWindow *win,
GdkCursorType curtype);
void unset_win_cursor (GdkWindow *win);
void gimp_add_busy_cursors_until_idle (void);
void gimp_add_busy_cursors (void);
gint gimp_remove_busy_cursors (gpointer);
void gimp_add_busy_cursors_until_idle (void);
void gimp_add_busy_cursors (void);
gint gimp_remove_busy_cursors (gpointer data);
gboolean gtkutil_compress_motion (GtkWidget *widget,
gdouble *lastmotion_x, gdouble *lastmotion_y);
gboolean gtkutil_compress_motion (GtkWidget *widget,
gdouble *lastmotion_x,
gdouble *lastmotion_y);
#endif /* __CURSORUTIL_H__ */

View File

@ -43,8 +43,8 @@ bounds_checking (GDisplay *gdisp)
void
resize_display (GDisplay *gdisp,
gint resize_window,
gint redisplay)
gboolean resize_window,
gboolean redisplay)
{
/* freeze the active tool */
active_tool_control (PAUSE, (void *) gdisp);
@ -89,7 +89,7 @@ shrink_wrap_display (GDisplay *gdisp)
void
change_scale (GDisplay *gdisp,
gint dir)
ZoomType zoom_type)
{
guchar scalesrc, scaledest;
gdouble offset_x, offset_y;
@ -105,7 +105,7 @@ change_scale (GDisplay *gdisp,
offset_x *= ((double) scalesrc / (double) scaledest);
offset_y *= ((double) scalesrc / (double) scaledest);
switch (dir)
switch (zoom_type)
{
case ZOOMIN :
if (scalesrc > 1)
@ -124,12 +124,12 @@ change_scale (GDisplay *gdisp,
break;
default :
scalesrc = dir%100;
scalesrc = zoom_type % 100;
if (scalesrc < 1)
scalesrc = 1;
else if (scalesrc > 0x10)
scalesrc = 0x10;
scaledest = dir/100;
scaledest = zoom_type / 100;
if (scaledest < 1)
scaledest = 1;
else if (scaledest > 0x10)

View File

@ -20,17 +20,21 @@
#include "gdisplay.h"
#define ZOOMIN 0
#define ZOOMOUT 1
typedef enum
{
ZOOMIN,
ZOOMOUT
} ZoomType;
/* Functions */
void change_scale (GDisplay *, int);
void resize_display (GDisplay *, int, int);
void shrink_wrap_display (GDisplay *);
void setup_scale (GDisplay *);
void scale_image (GDisplay *, long, long, long, long);
void bounds_checking (GDisplay *);
void change_scale (GDisplay *gdisp,
ZoomType zoom_type);
void resize_display (GDisplay *gdisp,
gboolean resize_window,
gboolean redisplay);
void shrink_wrap_display (GDisplay *gdisp);
void setup_scale (GDisplay *gdisp);
void bounds_checking (GDisplay *gdisp);
#endif /* __SCALE_H__ */

View File

@ -43,8 +43,8 @@ bounds_checking (GDisplay *gdisp)
void
resize_display (GDisplay *gdisp,
gint resize_window,
gint redisplay)
gboolean resize_window,
gboolean redisplay)
{
/* freeze the active tool */
active_tool_control (PAUSE, (void *) gdisp);
@ -89,7 +89,7 @@ shrink_wrap_display (GDisplay *gdisp)
void
change_scale (GDisplay *gdisp,
gint dir)
ZoomType zoom_type)
{
guchar scalesrc, scaledest;
gdouble offset_x, offset_y;
@ -105,7 +105,7 @@ change_scale (GDisplay *gdisp,
offset_x *= ((double) scalesrc / (double) scaledest);
offset_y *= ((double) scalesrc / (double) scaledest);
switch (dir)
switch (zoom_type)
{
case ZOOMIN :
if (scalesrc > 1)
@ -124,12 +124,12 @@ change_scale (GDisplay *gdisp,
break;
default :
scalesrc = dir%100;
scalesrc = zoom_type % 100;
if (scalesrc < 1)
scalesrc = 1;
else if (scalesrc > 0x10)
scalesrc = 0x10;
scaledest = dir/100;
scaledest = zoom_type / 100;
if (scaledest < 1)
scaledest = 1;
else if (scaledest > 0x10)

View File

@ -20,17 +20,21 @@
#include "gdisplay.h"
#define ZOOMIN 0
#define ZOOMOUT 1
typedef enum
{
ZOOMIN,
ZOOMOUT
} ZoomType;
/* Functions */
void change_scale (GDisplay *, int);
void resize_display (GDisplay *, int, int);
void shrink_wrap_display (GDisplay *);
void setup_scale (GDisplay *);
void scale_image (GDisplay *, long, long, long, long);
void bounds_checking (GDisplay *);
void change_scale (GDisplay *gdisp,
ZoomType zoom_type);
void resize_display (GDisplay *gdisp,
gboolean resize_window,
gboolean redisplay);
void shrink_wrap_display (GDisplay *gdisp);
void setup_scale (GDisplay *gdisp);
void bounds_checking (GDisplay *gdisp);
#endif /* __SCALE_H__ */

View File

@ -17,7 +17,10 @@
*/
#include <stdlib.h>
#include <gdk/gdkkeysyms.h>
#include "appenv.h"
#include "cursorutil.h"
#include "draw_core.h"
#include "gdisplay.h"
#include "gimprc.h"
@ -29,10 +32,6 @@
#include "config.h"
#include "libgimp/gimpintl.h"
/* types of magnify operations */
#define ZOOMIN 0
#define ZOOMOUT 1
/* the magnify structures */
typedef struct _Magnify Magnify;
@ -56,6 +55,10 @@ struct _MagnifyOptions
/* gint allow_resize_windows; (from gimprc) */
gint allow_resize_d;
GtkWidget *allow_resize_w;
ZoomType type;
ZoomType type_d;
GtkWidget *type_w[2];
};
@ -67,12 +70,17 @@ static MagnifyOptions *magnify_options = NULL;
static void magnify_button_press (Tool *, GdkEventButton *, gpointer);
static void magnify_button_release (Tool *, GdkEventButton *, gpointer);
static void magnify_motion (Tool *, GdkEventMotion *, gpointer);
static void magnify_modifier_update (Tool *, GdkEventKey *, gpointer);
static void magnify_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void magnify_control (Tool *, ToolAction, gpointer);
/* magnify utility functions */
static void zoom_in (int *, int *, int);
static void zoom_out (int *, int *, int);
static void zoom_in (gint *src,
gint *dest,
gint scale);
static void zoom_out (gint *src,
gint *dest,
gint scale);
/* magnify tool options functions */
@ -84,6 +92,9 @@ magnify_options_reset (void)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->allow_resize_w),
options->allow_resize_d);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static MagnifyOptions *
@ -92,6 +103,7 @@ magnify_options_new (void)
MagnifyOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
/* the new magnify tool options structure */
options = g_new (MagnifyOptions, 1);
@ -99,6 +111,7 @@ magnify_options_new (void)
_("Magnify Tool"),
magnify_options_reset);
options->allow_resize_d = allow_resize_windows;
options->type_d = options->type = ZOOMIN;
/* the main vbox */
vbox = options->tool_options.main_vbox;
@ -114,10 +127,25 @@ magnify_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), options->allow_resize_w, FALSE, FALSE, 0);
gtk_widget_show (options->allow_resize_w);
/* tool toggle */
frame =
gimp_radio_group_new2 (TRUE, _("Tool Toggle"),
gimp_radio_button_update,
&options->type, (gpointer) options->type,
_("Zoom in"), (gpointer) ZOOMIN,
&options->type_w[0],
_("Zoom out"), (gpointer) ZOOMOUT,
&options->type_w[1],
NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
/* magnify utility functions */
static void
@ -182,11 +210,6 @@ magnify_button_press (Tool *tool,
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
if (bevent->state & GDK_SHIFT_MASK)
magnify->op = ZOOMOUT;
else
magnify->op = ZOOMIN; /* default */
draw_core_start (magnify->core,
gdisp->canvas->window,
tool);
@ -240,6 +263,8 @@ magnify_button_release (Tool *tool,
else
scale = MIN ((width / w), (height / h));
magnify->op = magnify_options->type;
switch (magnify->op)
{
case ZOOMIN:
@ -286,6 +311,28 @@ magnify_motion (Tool *tool,
}
static void
magnify_modifier_update (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (kevent->keyval)
{
case GDK_Alt_L: case GDK_Alt_R:
break;
case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
if (magnify_options->type == ZOOMIN)
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (magnify_options->type_w[ZOOMOUT]), TRUE);
else
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (magnify_options->type_w[ZOOMIN]), TRUE);
break;
}
}
static void
magnify_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -295,7 +342,14 @@ magnify_cursor_update (Tool *tool,
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);
if (magnify_options->type == ZOOMIN)
{
gdisplay_install_tool_cursor (gdisp, GIMP_ZOOM_IN_CURSOR);
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_ZOOM_OUT_CURSOR);
}
}
@ -379,6 +433,7 @@ tools_new_magnify (void)
tool->button_press_func = magnify_button_press;
tool->button_release_func = magnify_button_release;
tool->motion_func = magnify_motion;
tool->modifier_key_func = magnify_modifier_update;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;

View File

@ -22,9 +22,9 @@
/* magnify functions */
void magnify_draw (Tool *);
Tool * tools_new_magnify (void);
void tools_free_magnify (Tool *);
Tool * tools_new_magnify (void);
void tools_free_magnify (Tool *tool);
void magnify_draw (Tool *tool);
#endif /* __MAGNIFY_H__ */

View File

@ -154,7 +154,8 @@ rect_select_button_press (Tool *tool,
rect_sel->center = FALSE;
gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
@ -306,41 +307,47 @@ rect_select_motion (Tool *tool,
}
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, TRUE, 0);
if (rect_sel->fixed_size) {
if (mevent->state & GDK_SHIFT_MASK) {
ratio = (double)(rect_sel->fixed_height /
(double)rect_sel->fixed_width);
tw = x - ox;
th = y - oy;
/*
* This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm
*/
if (rect_sel->fixed_size)
{
if (mevent->state & GDK_SHIFT_MASK)
{
ratio = (double)(rect_sel->fixed_height /
(double)rect_sel->fixed_width);
tw = x - ox;
th = y - oy;
/*
* This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm
*/
if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio)))
{
w = tw;
h = (int)(tw * ratio);
/* h should have the sign of th */
if ((th < 0 && h > 0) || (th > 0 && h < 0))
h = -h;
}
else
{
h = th;
w = (int)(th / ratio);
/* w should have the sign of tw */
if ((tw < 0 && w > 0) || (tw > 0 && w < 0))
w = -w;
}
} else {
w = (x - ox > 0 ? rect_sel->fixed_width : -rect_sel->fixed_width);
h = (y - oy > 0 ? rect_sel->fixed_height : -rect_sel->fixed_height);
}
} else {
w = (x - ox);
h = (y - oy);
}
if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio)))
{
w = tw;
h = (int)(tw * ratio);
/* h should have the sign of th */
if ((th < 0 && h > 0) || (th > 0 && h < 0))
h = -h;
}
else
{
h = th;
w = (int)(th / ratio);
/* w should have the sign of tw */
if ((tw < 0 && w > 0) || (tw > 0 && w < 0))
w = -w;
}
}
else
{
w = (x - ox > 0 ? rect_sel->fixed_width : -rect_sel->fixed_width);
h = (y - oy > 0 ? rect_sel->fixed_height : -rect_sel->fixed_height);
}
}
else
{
w = (x - ox);
h = (y - oy);
}
/* If the shift key is down, then make the rectangle square (or ellipse circular) */
if ((mevent->state & GDK_SHIFT_MASK) && !rect_sel->fixed_size)
@ -502,25 +509,25 @@ rect_select_cursor_update (Tool *tool,
rect_sel = (RectSelect*)tool->private;
switch (rect_sel->op)
{
case SELECTION_ADD:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1P_CURSOR);
break;
case SELECTION_SUB:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1M_CURSOR);
break;
case SELECTION_INTERSECT:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1U_CURSOR);
break;
case SELECTION_REPLACE:
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);
break;
case SELECTION_MOVE_MASK:
gdisplay_install_tool_cursor (gdisp, GDK_DIAMOND_CROSS);
break;
case SELECTION_MOVE:
gdisplay_install_tool_cursor (gdisp, GDK_FLEUR);
}
{
case SELECTION_ADD:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_ADD_CURSOR);
break;
case SELECTION_SUB:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_SUBTRACT_CURSOR);
break;
case SELECTION_INTERSECT:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_INTERSECT_CURSOR);
break;
case SELECTION_REPLACE:
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);
break;
case SELECTION_MOVE_MASK:
gdisplay_install_tool_cursor (gdisp, GDK_DIAMOND_CROSS);
break;
case SELECTION_MOVE:
gdisplay_install_tool_cursor (gdisp, GDK_FLEUR);
}
}
void

View File

@ -43,8 +43,8 @@ bounds_checking (GDisplay *gdisp)
void
resize_display (GDisplay *gdisp,
gint resize_window,
gint redisplay)
gboolean resize_window,
gboolean redisplay)
{
/* freeze the active tool */
active_tool_control (PAUSE, (void *) gdisp);
@ -89,7 +89,7 @@ shrink_wrap_display (GDisplay *gdisp)
void
change_scale (GDisplay *gdisp,
gint dir)
ZoomType zoom_type)
{
guchar scalesrc, scaledest;
gdouble offset_x, offset_y;
@ -105,7 +105,7 @@ change_scale (GDisplay *gdisp,
offset_x *= ((double) scalesrc / (double) scaledest);
offset_y *= ((double) scalesrc / (double) scaledest);
switch (dir)
switch (zoom_type)
{
case ZOOMIN :
if (scalesrc > 1)
@ -124,12 +124,12 @@ change_scale (GDisplay *gdisp,
break;
default :
scalesrc = dir%100;
scalesrc = zoom_type % 100;
if (scalesrc < 1)
scalesrc = 1;
else if (scalesrc > 0x10)
scalesrc = 0x10;
scaledest = dir/100;
scaledest = zoom_type / 100;
if (scaledest < 1)
scaledest = 1;
else if (scaledest > 0x10)

View File

@ -20,17 +20,21 @@
#include "gdisplay.h"
#define ZOOMIN 0
#define ZOOMOUT 1
typedef enum
{
ZOOMIN,
ZOOMOUT
} ZoomType;
/* Functions */
void change_scale (GDisplay *, int);
void resize_display (GDisplay *, int, int);
void shrink_wrap_display (GDisplay *);
void setup_scale (GDisplay *);
void scale_image (GDisplay *, long, long, long, long);
void bounds_checking (GDisplay *);
void change_scale (GDisplay *gdisp,
ZoomType zoom_type);
void resize_display (GDisplay *gdisp,
gboolean resize_window,
gboolean redisplay);
void shrink_wrap_display (GDisplay *gdisp);
void setup_scale (GDisplay *gdisp);
void bounds_checking (GDisplay *gdisp);
#endif /* __SCALE_H__ */

View File

@ -1443,12 +1443,12 @@ points_in_box(BezierPoint *points,
return c;
}
static int
bezier_point_on_curve(GDisplay *gdisp,
BezierSelect *bezier_sel,
gint x,
gint y,
gint halfwidth)
static gint
bezier_point_on_curve (GDisplay *gdisp,
BezierSelect *bezier_sel,
gint x,
gint y,
gint halfwidth)
{
BezierCheckPnts chkpnts;
BezierPoint * points;
@ -1462,41 +1462,45 @@ bezier_point_on_curve(GDisplay *gdisp,
chkpnts.halfwidth = halfwidth;
chkpnts.found = FALSE;
if(cnt)
if (cnt)
cnt->count = 0;
points = bezier_sel->points;
start_pt = bezier_sel->points;
if(bezier_sel->num_points >= 4)
if (bezier_sel->num_points >= 4)
{
do {
point_counts = count_points_on_curve(points);
if(point_counts >= 4)
{
do {
if(points_in_box(points,x,y))
do
{
point_counts = count_points_on_curve(points);
if (point_counts >= 4)
{
do
{
bezier_draw_segment (bezier_sel, points,
SUBDIVIDE, IMAGE_COORDS,
bezier_check_points,
&chkpnts);
if (points_in_box (points, x, y))
{
bezier_draw_segment (bezier_sel, points,
SUBDIVIDE, IMAGE_COORDS,
bezier_check_points,
&chkpnts);
}
points = next_anchor (points, &next_curve);
/* g_print ("next_anchor = %p\n",points); */
}
points = next_anchor(points,&next_curve);
/* g_print ("next_anchor = %p\n",points); */
} while (points != start_pt && points);
if(cnt)
cnt->count++;
start_pt = next_curve;
points = next_curve;
}
else
break; /* must be last curve since only this one is allowed < 4
* points.
*/
} while(next_curve);
while (points != start_pt && points);
if (cnt)
cnt->count++;
start_pt = next_curve;
points = next_curve;
}
else
break; /* must be last curve since only this one is allowed < 4
* points.
*/
}
while (next_curve);
}
return (chkpnts.found);
return chkpnts.found;
}
static void
@ -1512,120 +1516,132 @@ bezier_select_cursor_update (Tool *tool,
gint halfwidth,dummy;
gint x,y;
gdisp = (GDisplay *)gdisp_ptr;
gdisp = (GDisplay *) gdisp_ptr;
bezier_sel = tool->private;
if(gdisp != tool->gdisp_ptr || bezier_sel->core->draw_state == INVISIBLE)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR);
return;
}
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, TRUE, 0);
/* get halfwidth in image coord */
gdisplay_untransform_coords (gdisp, mevent->x + BEZIER_HALFWIDTH, 0, &halfwidth, &dummy, TRUE, 0);
gdisplay_untransform_coords (gdisp, mevent->x + BEZIER_HALFWIDTH, 0,
&halfwidth, &dummy, TRUE, 0);
halfwidth -= x;
on_control_pnt = bezier_on_control_point(gdisp,bezier_sel,x,y,halfwidth);
on_control_pnt = bezier_on_control_point (gdisp, bezier_sel, x, y, halfwidth);
on_curve = bezier_point_on_curve(gdisp,bezier_sel,x,y,halfwidth);
on_curve = bezier_point_on_curve (gdisp, bezier_sel, x, y, halfwidth);
if(bezier_sel->mask && bezier_sel->closed &&
channel_value(bezier_sel->mask, x, y) &&
!on_control_pnt &&
(!on_curve || ModeEdit != EXTEND_ADD))
if (bezier_sel->mask && bezier_sel->closed &&
channel_value(bezier_sel->mask, x, y) &&
!on_control_pnt &&
(!on_curve || ModeEdit != EXTEND_ADD))
{
in_selection_area = TRUE;
if ((mevent->state & GDK_SHIFT_MASK) && !(mevent->state & GDK_CONTROL_MASK))
gdisplay_install_tool_cursor (gdisp,GIMP_MOUSE1SELP_CURSOR );
else if ((mevent->state & GDK_CONTROL_MASK) && !(mevent->state & GDK_SHIFT_MASK))
gdisplay_install_tool_cursor (gdisp,GIMP_MOUSE1SELM_CURSOR );
else if ((mevent->state & GDK_CONTROL_MASK) && (mevent->state & GDK_SHIFT_MASK))
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1SELU_CURSOR);
else
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1SEL_CURSOR);
return;
}
if(mevent->state & GDK_MOD1_MASK)
{
/* Moving curve */
if(mevent->state & GDK_SHIFT_MASK)
if ((mevent->state & GDK_SHIFT_MASK) &&
!(mevent->state & GDK_CONTROL_MASK))
{
/* moving on 1 curve */
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1MM_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_SELECTION_ADD_CURSOR);
}
else if ((mevent->state & GDK_CONTROL_MASK) &&
!(mevent->state & GDK_SHIFT_MASK))
{
gdisplay_install_tool_cursor (gdisp, GIMP_SELECTION_SUBTRACT_CURSOR);
}
else if ((mevent->state & GDK_CONTROL_MASK) &&
(mevent->state & GDK_SHIFT_MASK))
{
gdisplay_install_tool_cursor (gdisp, GIMP_SELECTION_INTERSECT_CURSOR);
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1MM_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_SELECTION_CURSOR);
}
return;
}
if (mevent->state & GDK_MOD1_MASK)
{
/* Moving curve */
if (mevent->state & GDK_SHIFT_MASK)
{
/* moving on 1 curve */
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_MOVE_CURSOR);
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_MOVE_CURSOR);
}
}
else
{
switch(ModeEdit)
switch (ModeEdit)
{
case EXTEND_NEW:
if(on_control_pnt && bezier_sel->closed)
if (on_control_pnt && bezier_sel->closed)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1CP_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_RECTANGLE_CURSOR);
/* g_print ("add to curve cursor\n"); */
}
else if(on_curve)
else if (on_curve)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1AP_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_POINT_CURSOR);
/* g_print ("edit control point cursor\n"); */
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1AP_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_POINT_CURSOR);
}
break;
case EXTEND_ADD:
if(on_curve)
if (on_curve)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1P_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_ADD_CURSOR);
/* g_print ("add to curve cursor\n"); */
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR);
/* g_print ("default no action cursor\n"); */
}
break;
case EXTEND_EDIT:
if(on_control_pnt)
if (on_control_pnt)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1CP_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_RECTANGLE_CURSOR);
/* g_print ("edit control point cursor\n"); */
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR);
/* g_print ("default no action cursor\n"); */
}
break;
case EXTEND_REMOVE:
if(on_control_pnt && mevent->state & GDK_SHIFT_MASK)
if (on_control_pnt && mevent->state & GDK_SHIFT_MASK)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1M_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_SUBTRACT_CURSOR);
g_print ("delete whole curve cursor\n");
}
else if(on_control_pnt)
else if (on_control_pnt)
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1M_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_SUBTRACT_CURSOR);
/* g_print ("remove point cursor\n"); */
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR);
/* g_print ("default no action cursor\n"); */
}
break;
default:
g_print ("In default\n");
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_CURSOR);
break;
}
}

View File

@ -454,13 +454,13 @@ by_color_select_cursor_update (Tool *tool,
switch (by_col_sel->operation)
{
case SELECTION_ADD:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1P_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_ADD_CURSOR);
break;
case SELECTION_SUB:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1M_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_SUBTRACT_CURSOR);
break;
case SELECTION_INTERSECT:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1U_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_INTERSECT_CURSOR);
break;
case SELECTION_REPLACE:
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);

View File

@ -454,13 +454,13 @@ by_color_select_cursor_update (Tool *tool,
switch (by_col_sel->operation)
{
case SELECTION_ADD:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1P_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_ADD_CURSOR);
break;
case SELECTION_SUB:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1M_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_SUBTRACT_CURSOR);
break;
case SELECTION_INTERSECT:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1U_CURSOR);
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_INTERSECT_CURSOR);
break;
case SELECTION_REPLACE:
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);

View File

@ -17,7 +17,10 @@
*/
#include <stdlib.h>
#include <gdk/gdkkeysyms.h>
#include "appenv.h"
#include "cursorutil.h"
#include "draw_core.h"
#include "gdisplay.h"
#include "gimprc.h"
@ -29,10 +32,6 @@
#include "config.h"
#include "libgimp/gimpintl.h"
/* types of magnify operations */
#define ZOOMIN 0
#define ZOOMOUT 1
/* the magnify structures */
typedef struct _Magnify Magnify;
@ -56,6 +55,10 @@ struct _MagnifyOptions
/* gint allow_resize_windows; (from gimprc) */
gint allow_resize_d;
GtkWidget *allow_resize_w;
ZoomType type;
ZoomType type_d;
GtkWidget *type_w[2];
};
@ -67,12 +70,17 @@ static MagnifyOptions *magnify_options = NULL;
static void magnify_button_press (Tool *, GdkEventButton *, gpointer);
static void magnify_button_release (Tool *, GdkEventButton *, gpointer);
static void magnify_motion (Tool *, GdkEventMotion *, gpointer);
static void magnify_modifier_update (Tool *, GdkEventKey *, gpointer);
static void magnify_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void magnify_control (Tool *, ToolAction, gpointer);
/* magnify utility functions */
static void zoom_in (int *, int *, int);
static void zoom_out (int *, int *, int);
static void zoom_in (gint *src,
gint *dest,
gint scale);
static void zoom_out (gint *src,
gint *dest,
gint scale);
/* magnify tool options functions */
@ -84,6 +92,9 @@ magnify_options_reset (void)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->allow_resize_w),
options->allow_resize_d);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static MagnifyOptions *
@ -92,6 +103,7 @@ magnify_options_new (void)
MagnifyOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
/* the new magnify tool options structure */
options = g_new (MagnifyOptions, 1);
@ -99,6 +111,7 @@ magnify_options_new (void)
_("Magnify Tool"),
magnify_options_reset);
options->allow_resize_d = allow_resize_windows;
options->type_d = options->type = ZOOMIN;
/* the main vbox */
vbox = options->tool_options.main_vbox;
@ -114,10 +127,25 @@ magnify_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), options->allow_resize_w, FALSE, FALSE, 0);
gtk_widget_show (options->allow_resize_w);
/* tool toggle */
frame =
gimp_radio_group_new2 (TRUE, _("Tool Toggle"),
gimp_radio_button_update,
&options->type, (gpointer) options->type,
_("Zoom in"), (gpointer) ZOOMIN,
&options->type_w[0],
_("Zoom out"), (gpointer) ZOOMOUT,
&options->type_w[1],
NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
/* magnify utility functions */
static void
@ -182,11 +210,6 @@ magnify_button_press (Tool *tool,
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
if (bevent->state & GDK_SHIFT_MASK)
magnify->op = ZOOMOUT;
else
magnify->op = ZOOMIN; /* default */
draw_core_start (magnify->core,
gdisp->canvas->window,
tool);
@ -240,6 +263,8 @@ magnify_button_release (Tool *tool,
else
scale = MIN ((width / w), (height / h));
magnify->op = magnify_options->type;
switch (magnify->op)
{
case ZOOMIN:
@ -286,6 +311,28 @@ magnify_motion (Tool *tool,
}
static void
magnify_modifier_update (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (kevent->keyval)
{
case GDK_Alt_L: case GDK_Alt_R:
break;
case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
if (magnify_options->type == ZOOMIN)
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (magnify_options->type_w[ZOOMOUT]), TRUE);
else
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (magnify_options->type_w[ZOOMIN]), TRUE);
break;
}
}
static void
magnify_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -295,7 +342,14 @@ magnify_cursor_update (Tool *tool,
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);
if (magnify_options->type == ZOOMIN)
{
gdisplay_install_tool_cursor (gdisp, GIMP_ZOOM_IN_CURSOR);
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_ZOOM_OUT_CURSOR);
}
}
@ -379,6 +433,7 @@ tools_new_magnify (void)
tool->button_press_func = magnify_button_press;
tool->button_release_func = magnify_button_release;
tool->motion_func = magnify_motion;
tool->modifier_key_func = magnify_modifier_update;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;

View File

@ -22,9 +22,9 @@
/* magnify functions */
void magnify_draw (Tool *);
Tool * tools_new_magnify (void);
void tools_free_magnify (Tool *);
Tool * tools_new_magnify (void);
void tools_free_magnify (Tool *tool);
void magnify_draw (Tool *tool);
#endif /* __MAGNIFY_H__ */

View File

@ -154,7 +154,8 @@ rect_select_button_press (Tool *tool,
rect_sel->center = FALSE;
gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
@ -306,41 +307,47 @@ rect_select_motion (Tool *tool,
}
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, TRUE, 0);
if (rect_sel->fixed_size) {
if (mevent->state & GDK_SHIFT_MASK) {
ratio = (double)(rect_sel->fixed_height /
(double)rect_sel->fixed_width);
tw = x - ox;
th = y - oy;
/*
* This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm
*/
if (rect_sel->fixed_size)
{
if (mevent->state & GDK_SHIFT_MASK)
{
ratio = (double)(rect_sel->fixed_height /
(double)rect_sel->fixed_width);
tw = x - ox;
th = y - oy;
/*
* This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm
*/
if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio)))
{
w = tw;
h = (int)(tw * ratio);
/* h should have the sign of th */
if ((th < 0 && h > 0) || (th > 0 && h < 0))
h = -h;
}
else
{
h = th;
w = (int)(th / ratio);
/* w should have the sign of tw */
if ((tw < 0 && w > 0) || (tw > 0 && w < 0))
w = -w;
}
} else {
w = (x - ox > 0 ? rect_sel->fixed_width : -rect_sel->fixed_width);
h = (y - oy > 0 ? rect_sel->fixed_height : -rect_sel->fixed_height);
}
} else {
w = (x - ox);
h = (y - oy);
}
if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio)))
{
w = tw;
h = (int)(tw * ratio);
/* h should have the sign of th */
if ((th < 0 && h > 0) || (th > 0 && h < 0))
h = -h;
}
else
{
h = th;
w = (int)(th / ratio);
/* w should have the sign of tw */
if ((tw < 0 && w > 0) || (tw > 0 && w < 0))
w = -w;
}
}
else
{
w = (x - ox > 0 ? rect_sel->fixed_width : -rect_sel->fixed_width);
h = (y - oy > 0 ? rect_sel->fixed_height : -rect_sel->fixed_height);
}
}
else
{
w = (x - ox);
h = (y - oy);
}
/* If the shift key is down, then make the rectangle square (or ellipse circular) */
if ((mevent->state & GDK_SHIFT_MASK) && !rect_sel->fixed_size)
@ -502,25 +509,25 @@ rect_select_cursor_update (Tool *tool,
rect_sel = (RectSelect*)tool->private;
switch (rect_sel->op)
{
case SELECTION_ADD:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1P_CURSOR);
break;
case SELECTION_SUB:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1M_CURSOR);
break;
case SELECTION_INTERSECT:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1U_CURSOR);
break;
case SELECTION_REPLACE:
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);
break;
case SELECTION_MOVE_MASK:
gdisplay_install_tool_cursor (gdisp, GDK_DIAMOND_CROSS);
break;
case SELECTION_MOVE:
gdisplay_install_tool_cursor (gdisp, GDK_FLEUR);
}
{
case SELECTION_ADD:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_ADD_CURSOR);
break;
case SELECTION_SUB:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_SUBTRACT_CURSOR);
break;
case SELECTION_INTERSECT:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_INTERSECT_CURSOR);
break;
case SELECTION_REPLACE:
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);
break;
case SELECTION_MOVE_MASK:
gdisplay_install_tool_cursor (gdisp, GDK_DIAMOND_CROSS);
break;
case SELECTION_MOVE:
gdisplay_install_tool_cursor (gdisp, GDK_FLEUR);
}
}
void

View File

@ -17,7 +17,10 @@
*/
#include <stdlib.h>
#include <gdk/gdkkeysyms.h>
#include "appenv.h"
#include "cursorutil.h"
#include "draw_core.h"
#include "gdisplay.h"
#include "gimprc.h"
@ -29,10 +32,6 @@
#include "config.h"
#include "libgimp/gimpintl.h"
/* types of magnify operations */
#define ZOOMIN 0
#define ZOOMOUT 1
/* the magnify structures */
typedef struct _Magnify Magnify;
@ -56,6 +55,10 @@ struct _MagnifyOptions
/* gint allow_resize_windows; (from gimprc) */
gint allow_resize_d;
GtkWidget *allow_resize_w;
ZoomType type;
ZoomType type_d;
GtkWidget *type_w[2];
};
@ -67,12 +70,17 @@ static MagnifyOptions *magnify_options = NULL;
static void magnify_button_press (Tool *, GdkEventButton *, gpointer);
static void magnify_button_release (Tool *, GdkEventButton *, gpointer);
static void magnify_motion (Tool *, GdkEventMotion *, gpointer);
static void magnify_modifier_update (Tool *, GdkEventKey *, gpointer);
static void magnify_cursor_update (Tool *, GdkEventMotion *, gpointer);
static void magnify_control (Tool *, ToolAction, gpointer);
/* magnify utility functions */
static void zoom_in (int *, int *, int);
static void zoom_out (int *, int *, int);
static void zoom_in (gint *src,
gint *dest,
gint scale);
static void zoom_out (gint *src,
gint *dest,
gint scale);
/* magnify tool options functions */
@ -84,6 +92,9 @@ magnify_options_reset (void)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (options->allow_resize_w),
options->allow_resize_d);
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (options->type_w[options->type_d]), TRUE);
}
static MagnifyOptions *
@ -92,6 +103,7 @@ magnify_options_new (void)
MagnifyOptions *options;
GtkWidget *vbox;
GtkWidget *frame;
/* the new magnify tool options structure */
options = g_new (MagnifyOptions, 1);
@ -99,6 +111,7 @@ magnify_options_new (void)
_("Magnify Tool"),
magnify_options_reset);
options->allow_resize_d = allow_resize_windows;
options->type_d = options->type = ZOOMIN;
/* the main vbox */
vbox = options->tool_options.main_vbox;
@ -114,10 +127,25 @@ magnify_options_new (void)
gtk_box_pack_start (GTK_BOX (vbox), options->allow_resize_w, FALSE, FALSE, 0);
gtk_widget_show (options->allow_resize_w);
/* tool toggle */
frame =
gimp_radio_group_new2 (TRUE, _("Tool Toggle"),
gimp_radio_button_update,
&options->type, (gpointer) options->type,
_("Zoom in"), (gpointer) ZOOMIN,
&options->type_w[0],
_("Zoom out"), (gpointer) ZOOMOUT,
&options->type_w[1],
NULL);
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
return options;
}
/* magnify utility functions */
static void
@ -182,11 +210,6 @@ magnify_button_press (Tool *tool,
tool->state = ACTIVE;
tool->gdisp_ptr = gdisp_ptr;
if (bevent->state & GDK_SHIFT_MASK)
magnify->op = ZOOMOUT;
else
magnify->op = ZOOMIN; /* default */
draw_core_start (magnify->core,
gdisp->canvas->window,
tool);
@ -240,6 +263,8 @@ magnify_button_release (Tool *tool,
else
scale = MIN ((width / w), (height / h));
magnify->op = magnify_options->type;
switch (magnify->op)
{
case ZOOMIN:
@ -286,6 +311,28 @@ magnify_motion (Tool *tool,
}
static void
magnify_modifier_update (Tool *tool,
GdkEventKey *kevent,
gpointer gdisp_ptr)
{
switch (kevent->keyval)
{
case GDK_Alt_L: case GDK_Alt_R:
break;
case GDK_Shift_L: case GDK_Shift_R:
break;
case GDK_Control_L: case GDK_Control_R:
if (magnify_options->type == ZOOMIN)
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (magnify_options->type_w[ZOOMOUT]), TRUE);
else
gtk_toggle_button_set_active
(GTK_TOGGLE_BUTTON (magnify_options->type_w[ZOOMIN]), TRUE);
break;
}
}
static void
magnify_cursor_update (Tool *tool,
GdkEventMotion *mevent,
@ -295,7 +342,14 @@ magnify_cursor_update (Tool *tool,
gdisp = (GDisplay *) gdisp_ptr;
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);
if (magnify_options->type == ZOOMIN)
{
gdisplay_install_tool_cursor (gdisp, GIMP_ZOOM_IN_CURSOR);
}
else
{
gdisplay_install_tool_cursor (gdisp, GIMP_ZOOM_OUT_CURSOR);
}
}
@ -379,6 +433,7 @@ tools_new_magnify (void)
tool->button_press_func = magnify_button_press;
tool->button_release_func = magnify_button_release;
tool->motion_func = magnify_motion;
tool->modifier_key_func = magnify_modifier_update;
tool->cursor_update_func = magnify_cursor_update;
tool->control_func = magnify_control;

View File

@ -22,9 +22,9 @@
/* magnify functions */
void magnify_draw (Tool *);
Tool * tools_new_magnify (void);
void tools_free_magnify (Tool *);
Tool * tools_new_magnify (void);
void tools_free_magnify (Tool *tool);
void magnify_draw (Tool *tool);
#endif /* __MAGNIFY_H__ */

View File

@ -154,7 +154,8 @@ rect_select_button_press (Tool *tool,
rect_sel->center = FALSE;
gdk_pointer_grab (gdisp->canvas->window, FALSE,
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON1_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK |
GDK_BUTTON1_MOTION_MASK |
GDK_BUTTON_RELEASE_MASK,
NULL, NULL, bevent->time);
@ -306,41 +307,47 @@ rect_select_motion (Tool *tool,
}
gdisplay_untransform_coords (gdisp, mevent->x, mevent->y, &x, &y, TRUE, 0);
if (rect_sel->fixed_size) {
if (mevent->state & GDK_SHIFT_MASK) {
ratio = (double)(rect_sel->fixed_height /
(double)rect_sel->fixed_width);
tw = x - ox;
th = y - oy;
/*
* This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm
*/
if (rect_sel->fixed_size)
{
if (mevent->state & GDK_SHIFT_MASK)
{
ratio = (double)(rect_sel->fixed_height /
(double)rect_sel->fixed_width);
tw = x - ox;
th = y - oy;
/*
* This is probably an inefficient way to do it, but it gives
* nicer, more predictable results than the original agorithm
*/
if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio)))
{
w = tw;
h = (int)(tw * ratio);
/* h should have the sign of th */
if ((th < 0 && h > 0) || (th > 0 && h < 0))
h = -h;
}
else
{
h = th;
w = (int)(th / ratio);
/* w should have the sign of tw */
if ((tw < 0 && w > 0) || (tw > 0 && w < 0))
w = -w;
}
} else {
w = (x - ox > 0 ? rect_sel->fixed_width : -rect_sel->fixed_width);
h = (y - oy > 0 ? rect_sel->fixed_height : -rect_sel->fixed_height);
}
} else {
w = (x - ox);
h = (y - oy);
}
if ((abs(th) < (ratio * abs(tw))) && (abs(tw) > (abs(th) / ratio)))
{
w = tw;
h = (int)(tw * ratio);
/* h should have the sign of th */
if ((th < 0 && h > 0) || (th > 0 && h < 0))
h = -h;
}
else
{
h = th;
w = (int)(th / ratio);
/* w should have the sign of tw */
if ((tw < 0 && w > 0) || (tw > 0 && w < 0))
w = -w;
}
}
else
{
w = (x - ox > 0 ? rect_sel->fixed_width : -rect_sel->fixed_width);
h = (y - oy > 0 ? rect_sel->fixed_height : -rect_sel->fixed_height);
}
}
else
{
w = (x - ox);
h = (y - oy);
}
/* If the shift key is down, then make the rectangle square (or ellipse circular) */
if ((mevent->state & GDK_SHIFT_MASK) && !rect_sel->fixed_size)
@ -502,25 +509,25 @@ rect_select_cursor_update (Tool *tool,
rect_sel = (RectSelect*)tool->private;
switch (rect_sel->op)
{
case SELECTION_ADD:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1P_CURSOR);
break;
case SELECTION_SUB:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1M_CURSOR);
break;
case SELECTION_INTERSECT:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE1U_CURSOR);
break;
case SELECTION_REPLACE:
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);
break;
case SELECTION_MOVE_MASK:
gdisplay_install_tool_cursor (gdisp, GDK_DIAMOND_CROSS);
break;
case SELECTION_MOVE:
gdisplay_install_tool_cursor (gdisp, GDK_FLEUR);
}
{
case SELECTION_ADD:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_ADD_CURSOR);
break;
case SELECTION_SUB:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_SUBTRACT_CURSOR);
break;
case SELECTION_INTERSECT:
gdisplay_install_tool_cursor (gdisp, GIMP_MOUSE_INTERSECT_CURSOR);
break;
case SELECTION_REPLACE:
gdisplay_install_tool_cursor (gdisp, GDK_TCROSS);
break;
case SELECTION_MOVE_MASK:
gdisplay_install_tool_cursor (gdisp, GDK_DIAMOND_CROSS);
break;
case SELECTION_MOVE:
gdisplay_install_tool_cursor (gdisp, GDK_FLEUR);
}
}
void

View File

@ -19,77 +19,130 @@
#include "cursorutil.h"
#include "dialog_handler.h"
#include "gdisplay.h" /* for gdisplay_*_override_cursor() */
#include "../cursors/mouse1"
#include "../cursors/mouse1msk"
#include "../cursors/mouse1_p"
#include "../cursors/mouse1_pmsk"
#include "../cursors/mouse1_m"
#include "../cursors/mouse1_mmsk"
#include "../cursors/mouse1_u"
#include "../cursors/mouse1_umsk"
#include "../cursors/dropper"
#include "../cursors/droppermsk"
#include "../cursors/mouse1_ap"
#include "../cursors/mouse1_apmsk"
#include "../cursors/mouse1_cp"
#include "../cursors/mouse1_cpmsk"
#include "../cursors/mouse1_mm"
#include "../cursors/mouse1_mmmsk"
#include "../cursors/mouse1_selm"
#include "../cursors/mouse1_selmmsk"
#include "../cursors/mouse1_selp"
#include "../cursors/mouse1_selpmsk"
#include "../cursors/mouse1_selu"
#include "../cursors/mouse1_selumsk"
#include "../cursors/mouse1_sel"
#include "../cursors/mouse1_selmsk"
#include "../cursors/bad"
#include "../cursors/badmsk"
#include "cursors/mouse.xbm"
#include "cursors/mouse_mask.xbm"
#include "cursors/mouse_add.xbm"
#include "cursors/mouse_add_mask.xbm"
#include "cursors/mouse_subtract.xbm"
#include "cursors/mouse_subtract_mask.xbm"
#include "cursors/mouse_intersect.xbm"
#include "cursors/mouse_intersect_mask.xbm"
#include "cursors/mouse_point.xbm"
#include "cursors/mouse_point_mask.xbm"
#include "cursors/mouse_rectangle.xbm"
#include "cursors/mouse_rectangle_mask.xbm"
#include "cursors/mouse_move.xbm"
#include "cursors/mouse_move_mask.xbm"
#include "cursors/selection.xbm"
#include "cursors/selection_mask.xbm"
#include "cursors/selection_add.xbm"
#include "cursors/selection_add_mask.xbm"
#include "cursors/selection_subtract.xbm"
#include "cursors/selection_subtract_mask.xbm"
#include "cursors/selection_intersect.xbm"
#include "cursors/selection_intersect_mask.xbm"
#include "cursors/bad.xbm"
#include "cursors/bad_mask.xbm"
#include "cursors/dropper.xbm"
#include "cursors/dropper_mask.xbm"
#include "cursors/zoom_in.xbm"
#include "cursors/zoom_in_mask.xbm"
#include "cursors/zoom_out.xbm"
#include "cursors/zoom_out_mask.xbm"
typedef struct
{
unsigned char *bits;
unsigned char *mask_bits;
int width, height;
int x_hot, y_hot;
guchar *bits;
guchar *mask_bits;
gint width, height;
gint x_hot, y_hot;
GdkCursor *cursor;
} BM_Cursor;
static BM_Cursor gimp_cursors[] =
/* these have to match up with the enum in cursorutil.h */
{
{ mouse1_bits, mouse1msk_bits, mouse1_width, mouse1_height,
mouse1_x_hot, mouse1_y_hot, NULL},
{ mouse1_p_bits, mouse1_pmsk_bits, mouse1_p_width, mouse1_p_height,
mouse1_p_x_hot, mouse1_p_y_hot, NULL},
{ mouse1_m_bits, mouse1_mmsk_bits, mouse1_m_width, mouse1_m_height,
mouse1_m_x_hot, mouse1_m_y_hot, NULL},
{ mouse1_u_bits, mouse1_umsk_bits, mouse1_u_width, mouse1_u_height,
mouse1_u_x_hot, mouse1_u_y_hot, NULL},
{ dropper_bits, droppermsk_bits, dropper_width, dropper_height,
dropper_x_hot, dropper_y_hot, NULL},
{ mouse1_ap_bits, mouse1_apmsk_bits, mouse1_ap_width, mouse1_ap_height,
mouse1_ap_x_hot, mouse1_ap_y_hot, NULL},
{ mouse1_cp_bits, mouse1_cpmsk_bits, mouse1_cp_width, mouse1_cp_height,
mouse1_cp_x_hot, mouse1_cp_y_hot, NULL},
{ mouse1_mm_bits, mouse1_mmmsk_bits, mouse1_mm_width, mouse1_mm_height,
mouse1_mm_x_hot, mouse1_mm_y_hot, NULL},
{ mouse1_selp_bits, mouse1_selpmsk_bits, mouse1_selp_width, mouse1_selp_height,
mouse1_selp_x_hot, mouse1_selp_y_hot, NULL},
{ mouse1_selm_bits, mouse1_selmmsk_bits, mouse1_selm_width, mouse1_selm_height,
mouse1_selm_x_hot, mouse1_selm_y_hot, NULL},
{ mouse1_selu_bits, mouse1_selumsk_bits, mouse1_selu_width, mouse1_selu_height,
mouse1_selu_x_hot, mouse1_selu_y_hot, NULL},
{ mouse1_sel_bits, mouse1_selmsk_bits, mouse1_sel_width, mouse1_sel_height,
mouse1_sel_x_hot, mouse1_sel_y_hot, NULL},
{ bad_bits, badmsk_bits, bad_width, bad_height,
bad_x_hot, bad_y_hot, NULL},
{
mouse_bits, mouse_mask_bits,
mouse_width, mouse_height,
mouse_x_hot, mouse_y_hot, NULL
},
{
mouse_add_bits, mouse_add_mask_bits,
mouse_add_width, mouse_add_height,
mouse_add_x_hot, mouse_add_y_hot, NULL
},
{
mouse_subtract_bits, mouse_subtract_mask_bits,
mouse_subtract_width, mouse_subtract_height,
mouse_subtract_x_hot, mouse_subtract_y_hot, NULL
},
{
mouse_intersect_bits, mouse_intersect_mask_bits,
mouse_intersect_width, mouse_intersect_height,
mouse_intersect_x_hot, mouse_intersect_y_hot, NULL
},
{
mouse_point_bits, mouse_point_mask_bits,
mouse_point_width, mouse_point_height,
mouse_point_x_hot, mouse_point_y_hot, NULL
},
{
mouse_rectangle_bits, mouse_rectangle_mask_bits,
mouse_rectangle_width, mouse_rectangle_height,
mouse_rectangle_x_hot, mouse_rectangle_y_hot, NULL
},
{
mouse_move_bits, mouse_move_mask_bits,
mouse_move_width, mouse_move_height,
mouse_move_x_hot, mouse_move_y_hot, NULL
},
{
selection_bits, selection_mask_bits,
selection_width, selection_height,
selection_x_hot, selection_y_hot, NULL
},
{
selection_add_bits, selection_add_mask_bits,
selection_add_width, selection_add_height,
selection_add_x_hot, selection_add_y_hot, NULL
},
{
selection_subtract_bits, selection_subtract_mask_bits,
selection_subtract_width, selection_subtract_height,
selection_subtract_x_hot, selection_subtract_y_hot, NULL
},
{
selection_intersect_bits, selection_intersect_mask_bits,
selection_intersect_width, selection_intersect_height,
selection_intersect_x_hot, selection_intersect_y_hot, NULL
},
{
bad_bits, bad_mask_bits,
bad_width, bad_height,
bad_x_hot, bad_y_hot, NULL
},
{
dropper_bits, dropper_mask_bits,
dropper_width, dropper_height,
dropper_x_hot, dropper_y_hot, NULL
},
{
zoom_in_bits, zoom_in_mask_bits,
zoom_in_width, zoom_in_height,
zoom_in_x_hot, zoom_in_y_hot, NULL
},
{
zoom_out_bits, zoom_out_mask_bits,
zoom_out_width, zoom_out_height,
zoom_out_x_hot, zoom_out_y_hot, NULL
}
};
extern GSList* display_list; /* It's in gdisplay.c, FYI */
static gboolean pending_removebusy = FALSE;
extern GSList *display_list; /* It's in gdisplay.c, FYI */
static gboolean pending_removebusy = FALSE;
static void
@ -100,8 +153,8 @@ create_cursor (BM_Cursor *bmcursor)
GdkColor fg, bg;
/* should have a way to configure the mouse colors */
gdk_color_parse("#FFFFFF", &bg);
gdk_color_parse("#000000", &fg);
gdk_color_parse ("#FFFFFF", &bg);
gdk_color_parse ("#000000", &fg);
pixmap = gdk_bitmap_create_from_data (NULL, bmcursor->bits,
bmcursor->width, bmcursor->height);
@ -111,7 +164,7 @@ create_cursor (BM_Cursor *bmcursor)
bmcursor->width,
bmcursor->height);
g_return_if_fail (pixmapmsk != NULL);
bmcursor->cursor = gdk_cursor_new_from_pixmap (pixmap, pixmapmsk, &fg, &bg,
bmcursor->x_hot,
bmcursor->y_hot);
@ -119,39 +172,37 @@ create_cursor (BM_Cursor *bmcursor)
}
static void
gimp_change_win_cursor (GdkWindow *win, GimpCursorType curtype)
gimp_change_win_cursor (GdkWindow *win,
GimpCursorType curtype)
{
GdkCursor *cursor;
g_return_if_fail (curtype < GIMP_LAST_CURSOR_ENTRY);
curtype -= GIMP_MOUSE1_CURSOR;
curtype -= GIMP_MOUSE_CURSOR;
if (!gimp_cursors[(int)curtype].cursor)
create_cursor (&gimp_cursors[(int)curtype]);
cursor = gimp_cursors[(int)curtype].cursor;
gdk_window_set_cursor (win, cursor);
}
void
change_win_cursor (win, cursortype)
GdkWindow *win;
GdkCursorType cursortype;
change_win_cursor (GdkWindow *win,
GdkCursorType cursortype)
{
GdkCursor *cursor;
if (cursortype > GDK_LAST_CURSOR)
{
gimp_change_win_cursor(win, (GimpCursorType)cursortype);
return;
}
{
gimp_change_win_cursor (win, (GimpCursorType)cursortype);
return;
}
cursor = gdk_cursor_new (cursortype);
gdk_window_set_cursor (win, cursor);
gdk_cursor_destroy (cursor);
}
void
unset_win_cursor (win)
GdkWindow *win;
unset_win_cursor (GdkWindow *win)
{
gdk_window_set_cursor (win, NULL);
}
@ -161,7 +212,7 @@ gimp_add_busy_cursors_until_idle (void)
{
if (!pending_removebusy)
{
gimp_add_busy_cursors();
gimp_add_busy_cursors ();
gtk_idle_add_priority (GTK_PRIORITY_HIGH,
gimp_remove_busy_cursors, NULL);
pending_removebusy = TRUE;
@ -172,40 +223,36 @@ void
gimp_add_busy_cursors (void)
{
GDisplay *gdisp;
GSList *list = display_list;
GSList *list;
/* Canvases */
while (list)
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
gdisplay_install_override_cursor (gdisp, GDK_WATCH);
list = g_slist_next (list);
}
/* Dialogs */
dialog_idle_all();
dialog_idle_all ();
gdk_flush();
gdk_flush ();
}
gint
gimp_remove_busy_cursors (gpointer data)
{
GDisplay *gdisp;
GSList *list = display_list;
GSList *list;
/* Canvases */
while (list)
for (list = display_list; list; list = g_slist_next (list))
{
gdisp = (GDisplay *) list->data;
gdisplay_remove_override_cursor (gdisp);
list = g_slist_next (list);
}
/* Dialogs */
dialog_unidle_all();
dialog_unidle_all ();
pending_removebusy = FALSE;
@ -227,8 +274,8 @@ gimp_remove_busy_cursors (gpointer data)
the XFree86-style license. <adam@gimp.org> */
gboolean
gtkutil_compress_motion (GtkWidget *widget,
gdouble *lastmotion_x,
gdouble *lastmotion_y)
gdouble *lastmotion_x,
gdouble *lastmotion_y)
{
GdkEvent *event;
GList *requeued_events = NULL;
@ -246,7 +293,7 @@ gtkutil_compress_motion (GtkWidget *widget,
*lastmotion_x = event->motion.x;
*lastmotion_y = event->motion.y;
gdk_event_free(event);
gdk_event_free (event);
success = TRUE;
}
else
@ -259,9 +306,9 @@ gtkutil_compress_motion (GtkWidget *widget,
event queue in order. */
while (requeued_events)
{
gdk_event_put ((GdkEvent*)requeued_events->data);
gdk_event_put ((GdkEvent*) requeued_events->data);
gdk_event_free ((GdkEvent*)requeued_events->data);
gdk_event_free ((GdkEvent*) requeued_events->data);
requeued_events =
g_list_remove_link (requeued_events, requeued_events);
}

View File

@ -30,30 +30,34 @@
typedef enum
{
GIMP_MOUSE1_CURSOR = (GDK_LAST_CURSOR + 2),
GIMP_MOUSE1P_CURSOR,
GIMP_MOUSE1M_CURSOR,
GIMP_MOUSE1U_CURSOR,
GIMP_COLOR_PICKER_CURSOR,
GIMP_MOUSE1AP_CURSOR,
GIMP_MOUSE1CP_CURSOR,
GIMP_MOUSE1MM_CURSOR,
GIMP_MOUSE1SELP_CURSOR,
GIMP_MOUSE1SELM_CURSOR,
GIMP_MOUSE1SELU_CURSOR,
GIMP_MOUSE1SEL_CURSOR,
GIMP_MOUSE_CURSOR = (GDK_LAST_CURSOR + 2),
GIMP_MOUSE_ADD_CURSOR,
GIMP_MOUSE_SUBTRACT_CURSOR,
GIMP_MOUSE_INTERSECT_CURSOR,
GIMP_MOUSE_POINT_CURSOR,
GIMP_MOUSE_RECTANGLE_CURSOR,
GIMP_MOUSE_MOVE_CURSOR,
GIMP_SELECTION_CURSOR,
GIMP_SELECTION_ADD_CURSOR,
GIMP_SELECTION_SUBTRACT_CURSOR,
GIMP_SELECTION_INTERSECT_CURSOR,
GIMP_BAD_CURSOR,
GIMP_COLOR_PICKER_CURSOR,
GIMP_ZOOM_IN_CURSOR,
GIMP_ZOOM_OUT_CURSOR,
GIMP_LAST_CURSOR_ENTRY
} GimpCursorType;
void change_win_cursor (GdkWindow *, GdkCursorType);
void unset_win_cursor (GdkWindow *);
void change_win_cursor (GdkWindow *win,
GdkCursorType curtype);
void unset_win_cursor (GdkWindow *win);
void gimp_add_busy_cursors_until_idle (void);
void gimp_add_busy_cursors (void);
gint gimp_remove_busy_cursors (gpointer);
void gimp_add_busy_cursors_until_idle (void);
void gimp_add_busy_cursors (void);
gint gimp_remove_busy_cursors (gpointer data);
gboolean gtkutil_compress_motion (GtkWidget *widget,
gdouble *lastmotion_x, gdouble *lastmotion_y);
gboolean gtkutil_compress_motion (GtkWidget *widget,
gdouble *lastmotion_x,
gdouble *lastmotion_y);
#endif /* __CURSORUTIL_H__ */

View File

@ -1,8 +1,6 @@
#define badmsk_width 16
#define badmsk_height 16
#define badmsk_x_hot 7
#define badmsk_y_hot 7
static unsigned char badmsk_bits[] = {
#define bad_mask_width 16
#define bad_mask_height 16
static unsigned char bad_mask_bits[] = {
0xc0, 0x01, 0xf0, 0x07, 0xf8, 0x0f, 0x1c, 0x1c, 0x0e, 0x3e, 0x06, 0x37,
0x87, 0x73, 0xc7, 0x71, 0xe7, 0x70, 0x76, 0x30, 0x3e, 0x38, 0x1c, 0x1c,
0xf8, 0x0f, 0xf0, 0x07, 0xc0, 0x01, 0x00, 0x00};

View File

@ -1,7 +1,7 @@
/* Made with GIMP */
#define droppermsk_width 22
#define droppermsk_height 22
static char droppermsk_bits[] = {
#define dropper_mask_width 22
#define dropper_mask_height 22
static char dropper_mask_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0xc0, 0x07,
0x00, 0xe0, 0x0f, 0x00, 0xf8, 0x1f, 0x00, 0xfc, 0x1f, 0x00, 0xf8, 0x1f,
0x00, 0xf8, 0x0f, 0x00, 0xfc, 0x07, 0x00, 0xfe, 0x03, 0x00, 0xff, 0x03,

View File

@ -1,8 +1,8 @@
#define mouse1_width 14
#define mouse1_height 17
#define mouse1_x_hot 1
#define mouse1_y_hot 1
static unsigned char mouse1_bits[] = {
#define mouse_width 14
#define mouse_height 17
#define mouse_x_hot 1
#define mouse_y_hot 1
static unsigned char mouse_bits[] = {
0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0x00, 0x3e, 0x00,
0x7e, 0x00, 0xfe, 0x00, 0xfe, 0x01, 0x3e, 0x00, 0x06, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@ -1,8 +1,8 @@
#define mouse1_p_width 14
#define mouse1_p_height 17
#define mouse1_p_x_hot 1
#define mouse1_p_y_hot 1
static unsigned char mouse1_p_bits[] = {
#define mouse_add_width 14
#define mouse_add_height 17
#define mouse_add_x_hot 1
#define mouse_add_y_hot 1
static unsigned char mouse_add_bits[] = {
0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0x00, 0x3e, 0x00,
0x7e, 0x00, 0xfe, 0x00, 0xfe, 0x01, 0x3e, 0x00, 0x06, 0x00, 0x02, 0x04,
0x00, 0x04, 0x00, 0x1f, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00};

View File

@ -1,6 +1,6 @@
#define mouse1_pmsk_width 14
#define mouse1_pmsk_height 17
static unsigned char mouse1_pmsk_bits[] = {
#define mouse_add_mask_width 14
#define mouse_add_mask_height 17
static unsigned char mouse_add_mask_bits[] = {
0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3f, 0x00, 0x7f, 0x00,
0xff, 0x00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x01, 0x3f, 0x0e, 0x07, 0x0e,
0x83, 0x3f, 0x80, 0x3f, 0x80, 0x3f, 0x00, 0x0e, 0x00, 0x0e};

View File

@ -1,8 +1,8 @@
#define mouse1_u_width 13
#define mouse1_u_height 17
#define mouse1_u_x_hot 1
#define mouse1_u_y_hot 1
static unsigned char mouse1_u_bits[] = {
#define mouse_intersect_width 13
#define mouse_intersect_height 17
#define mouse_intersect_x_hot 1
#define mouse_intersect_y_hot 1
static unsigned char mouse_intersect_bits[] = {
0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0x00, 0x3e, 0x00,
0x7e, 0x00, 0xfe, 0x00, 0xfe, 0x01, 0x3e, 0x00, 0x06, 0x00, 0x02, 0x06,
0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, 0x09, 0x00, 0x00};

View File

@ -1,6 +1,6 @@
#define mouse1_umsk_width 13
#define mouse1_umsk_height 17
static unsigned char mouse1_umsk_bits[] = {
#define mouse_intersect_mask_width 13
#define mouse_intersect_mask_height 17
static unsigned char mouse_intersect_mask_bits[] = {
0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3f, 0x00, 0x7f, 0x00,
0xff, 0x00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x01, 0x3f, 0x06, 0x07, 0x0f,
0x83, 0x1f, 0x80, 0x1f, 0x80, 0x1f, 0x80, 0x1f, 0x00, 0x09};

View File

@ -1,6 +1,6 @@
#define mouse1msk_width 14
#define mouse1msk_height 17
static unsigned char mouse1msk_bits[] = {
#define mouse_mask_width 14
#define mouse_mask_height 17
static unsigned char mouse_mask_bits[] = {
0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3f, 0x00, 0x7f, 0x00,
0xff, 0x00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x01, 0x3f, 0x00, 0x07, 0x00,
0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@ -1,8 +1,8 @@
#define mouse1_mm_width 14
#define mouse1_mm_height 17
#define mouse1_mm_x_hot 1
#define mouse1_mm_y_hot 1
static unsigned char mouse1_mm_bits[] = {
#define mouse_move_width 14
#define mouse_move_height 17
#define mouse_move_x_hot 1
#define mouse_move_y_hot 1
static unsigned char mouse_move_bits[] = {
0x00, 0x00, 0x02, 0x00, 0x16, 0x00, 0x16, 0x00, 0xb6, 0x00, 0xb6, 0x01,
0xb6, 0x03, 0xb6, 0x07, 0xb6, 0x0f, 0xb6, 0x1f, 0xb6, 0x3f, 0xb6, 0x3f,
0xb2, 0x0f, 0xa0, 0x03, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, };

View File

@ -1,6 +1,6 @@
#define mouse1_mmmsk_width 14
#define mouse1_mmmsk_height 17
static unsigned char mouse1_mmmsk_bits[] = {
#define mouse_move_mask_width 14
#define mouse_move_mask_height 17
static unsigned char mouse_move_mask_bits[] = {
0x0e, 0x00, 0x1e, 0x00, 0x7e, 0x00, 0xfe, 0x00, 0xfe, 0x01, 0xfe, 0x03,
0xfe, 0x07, 0xfe, 0x0f, 0xfe, 0x1f, 0xfe, 0x3f, 0xfe, 0x3f, 0xfe, 0x3f,
0xfe, 0x3f, 0xf8, 0x0f, 0xe0, 0x07, 0xc0, 0x01, 0x00, 0x00, };

View File

@ -1,8 +1,8 @@
#define mouse1_ap_width 14
#define mouse1_ap_height 17
#define mouse1_ap_x_hot 1
#define mouse1_ap_y_hot 1
static unsigned char mouse1_ap_bits[] = {
#define mouse_point_width 14
#define mouse_point_height 17
#define mouse_point_x_hot 1
#define mouse_point_y_hot 1
static unsigned char mouse_point_bits[] = {
0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0x00, 0x3e, 0x00,
0x7e, 0x00, 0xfe, 0x00, 0xfe, 0x01, 0x3e, 0x00, 0x06, 0x00, 0x02, 0x0e,
0x00, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x0e, 0x00, 0x00, };

View File

@ -1,6 +1,6 @@
#define mouse1_apmsk_width 14
#define mouse1_apmsk_height 17
static unsigned char mouse1_apmsk_bits[] = {
#define mouse_point_mask_width 14
#define mouse_point_mask_height 17
static unsigned char mouse_point_mask_bits[] = {
0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3f, 0x00, 0x7f, 0x00,
0xff, 0x00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x01, 0x3f, 0x1f, 0x87, 0x3f,
0x83, 0x3f, 0x80, 0x3f, 0x80, 0x3f, 0x80, 0x3f, 0x00, 0x1f, };

View File

@ -1,8 +1,8 @@
#define mouse1_cp_width 14
#define mouse1_cp_height 17
#define mouse1_cp_x_hot 1
#define mouse1_cp_y_hot 1
static unsigned char mouse1_cp_bits[] = {
#define mouse_rectangle_width 14
#define mouse_rectangle_height 17
#define mouse_rectangle_x_hot 1
#define mouse_rectangle_y_hot 1
static unsigned char mouse_rectangle_bits[] = {
0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0x00, 0x3e, 0x00,
0x7e, 0x00, 0xfe, 0x00, 0xfe, 0x01, 0x3e, 0x00, 0x06, 0x00, 0x02, 0x1f,
0x00, 0x11, 0x00, 0x11, 0x00, 0x11, 0x00, 0x1f, 0x00, 0x00, };

View File

@ -1,6 +1,6 @@
#define mouse1_cpmsk_width 14
#define mouse1_cpmsk_height 17
static unsigned char mouse1_cpmsk_bits[] = {
#define mouse_rectangle_mask_width 14
#define mouse_rectangle_mask_height 17
static unsigned char mouse_rectangle_mask_bits[] = {
0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3f, 0x00, 0x7f, 0x00,
0xff, 0x00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x01, 0xbf, 0x3f, 0x87, 0x3f,
0x83, 0x3f, 0x80, 0x3f, 0x80, 0x3f, 0x80, 0x3f, 0x80, 0x3f, };

View File

@ -1,8 +1,8 @@
#define mouse1_m_width 14
#define mouse1_m_height 17
#define mouse1_m_x_hot 1
#define mouse1_m_y_hot 1
static unsigned char mouse1_m_bits[] = {
#define mouse_subtract_width 14
#define mouse_subtract_height 17
#define mouse_subtract_x_hot 1
#define mouse_subtract_y_hot 1
static unsigned char mouse_subtract_bits[] = {
0x00, 0x00, 0x02, 0x00, 0x06, 0x00, 0x0e, 0x00, 0x1e, 0x00, 0x3e, 0x00,
0x7e, 0x00, 0xfe, 0x00, 0xfe, 0x01, 0x3e, 0x00, 0x06, 0x00, 0x02, 0x00,
0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@ -1,6 +1,6 @@
#define mouse1_mmsk_width 14
#define mouse1_mmsk_height 17
static unsigned char mouse1_mmsk_bits[] = {
#define mouse_subtract_mask_width 14
#define mouse_subtract_mask_height 17
static unsigned char mouse_subtract_mask_bits[] = {
0x03, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x1f, 0x00, 0x3f, 0x00, 0x7f, 0x00,
0xff, 0x00, 0xff, 0x01, 0xff, 0x03, 0xff, 0x01, 0x3f, 0x00, 0x07, 0x00,
0x83, 0x3f, 0x80, 0x3f, 0x80, 0x3f, 0x00, 0x00, 0x00, 0x00};

View File

@ -1,8 +1,8 @@
#define mouse1_sel_width 14
#define mouse1_sel_height 17
#define mouse1_sel_x_hot 1
#define mouse1_sel_y_hot 1
static unsigned char mouse1_sel_bits[] = {
#define selection_width 14
#define selection_height 17
#define selection_x_hot 1
#define selection_y_hot 1
static unsigned char selection_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x6c, 0x01, 0x00, 0x01, 0x04, 0x00, 0x04, 0x01,
0x00, 0x01, 0x04, 0x00, 0x04, 0x01, 0x00, 0x01, 0x04, 0x00, 0xb4, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };

View File

@ -1,8 +1,8 @@
#define mouse1_selp_width 14
#define mouse1_selp_height 17
#define mouse1_selp_x_hot 1
#define mouse1_selp_y_hot 1
static unsigned char mouse1_selp_bits[] = {
#define selection_add_width 14
#define selection_add_height 17
#define selection_add_x_hot 1
#define selection_add_y_hot 1
static unsigned char selection_add_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xb4, 0x01, 0x04, 0x00, 0x00, 0x01, 0x04, 0x01,
0x04, 0x00, 0x00, 0x01, 0x04, 0x01, 0x04, 0x00, 0x00, 0x01, 0x6c, 0x05,
0x00, 0x04, 0x00, 0x1f, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, };

View File

@ -1,6 +1,6 @@
#define mouse1_selpmsk_width 14
#define mouse1_selpmsk_height 17
static unsigned char mouse1_selpmsk_bits[] = {
#define selection_add_mask_width 14
#define selection_add_mask_height 17
static unsigned char selection_add_mask_bits[] = {
0x00, 0x00, 0xfe, 0x03, 0xfe, 0x03, 0xfe, 0x03, 0x8e, 0x03, 0x8e, 0x03,
0x8e, 0x03, 0x8e, 0x03, 0x8e, 0x03, 0x8e, 0x03, 0xfe, 0x03, 0xfe, 0x0f,
0xfe, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x0e, 0x00, 0x00, };

View File

@ -1,8 +1,8 @@
#define mouse1_selu_width 14
#define mouse1_selu_height 17
#define mouse1_selu_x_hot 1
#define mouse1_selu_y_hot 1
static unsigned char mouse1_selu_bits[] = {
#define selection_intersect_width 14
#define selection_intersect_height 17
#define selection_intersect_x_hot 1
#define selection_intersect_y_hot 1
static unsigned char selection_intersect_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x04, 0x01, 0x04, 0x01, 0x00, 0x00,
0x04, 0x01, 0x04, 0x01, 0x00, 0x00, 0x04, 0x01, 0x04, 0x01, 0xd8, 0x00,
0x00, 0x12, 0x00, 0x12, 0x00, 0x12, 0x00, 0x0c, 0x00, 0x00 };

View File

@ -1,6 +1,6 @@
#define mouse1_selumsk_width 14
#define mouse1_selumsk_height 17
static unsigned char mouse1_selumsk_bits[] = {
#define selection_intersect_mask_width 14
#define selection_intersect_mask_height 17
static unsigned char selection_intersect_mask_bits[] = {
0x00, 0x00, 0xfe, 0x03, 0xfe, 0x03, 0xfe, 0x03, 0x8e, 0x03, 0x8e, 0x03,
0x8e, 0x03, 0x8e, 0x03, 0x8e, 0x03, 0x8e, 0x03, 0xfe, 0x03, 0xfe, 0x3f,
0xfe, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x3f, 0x00, 0x1e };

View File

@ -1,6 +1,6 @@
#define mouse1_selmsk_width 14
#define mouse1_selmsk_height 17
static unsigned char mouse1_selmsk_bits[] = {
#define selection_mask_width 14
#define selection_mask_height 17
static unsigned char selection_mask_bits[] = {
0x00, 0x00, 0xfe, 0x03, 0xfe, 0x03, 0xfe, 0x03, 0x8e, 0x03, 0x8e, 0x03,
0x8e, 0x03, 0x8e, 0x03, 0x8e, 0x03, 0x8e, 0x03, 0xfe, 0x03, 0xfe, 0x03,
0xfe, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };

View File

@ -1,8 +1,8 @@
#define mouse1_selm_width 14
#define mouse1_selm_height 17
#define mouse1_selm_x_hot 1
#define mouse1_selm_y_hot 1
static unsigned char mouse1_selm_bits[] = {
#define selection_subtract_width 14
#define selection_subtract_height 17
#define selection_subtract_x_hot 1
#define selection_subtract_y_hot 1
static unsigned char selection_subtract_bits[] = {
0x00, 0x00, 0x00, 0x00, 0xd8, 0x00, 0x04, 0x01, 0x04, 0x01, 0x00, 0x00,
0x04, 0x01, 0x04, 0x01, 0x00, 0x00, 0x04, 0x01, 0x04, 0x01, 0xd8, 0x00,
0x00, 0x00, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };

View File

@ -1,6 +1,6 @@
#define mouse1_selmmsk_width 14
#define mouse1_selmmsk_height 17
static unsigned char mouse1_selmmsk_bits[] = {
#define selection_subtract_mask_width 14
#define selection_subtract_mask_height 17
static unsigned char selection_subtract_mask_bits[] = {
0x00, 0x00, 0xfe, 0x03, 0xfe, 0x03, 0xfe, 0x03, 0x8e, 0x03, 0x8e, 0x03,
0x8e, 0x03, 0x8e, 0x03, 0x8e, 0x03, 0x8e, 0x03, 0xfe, 0x03, 0xfe, 0x03,
0xfe, 0x1f, 0x00, 0x1f, 0x00, 0x1f, 0x00, 0x00, 0x00, 0x00, };

11
cursors/zoom_in.xbm Normal file
View File

@ -0,0 +1,11 @@
/* Created with The GIMP */
#define zoom_in_width 22
#define zoom_in_height 18
#define zoom_in_x_hot 6
#define zoom_in_y_hot 6
static char zoom_in_bits[] = {
0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x08, 0x02, 0x00, 0x04, 0x04, 0x00,
0x02, 0x08, 0x04, 0x02, 0x08, 0x04, 0x02, 0x08, 0x1f, 0x02, 0x08, 0x04,
0x02, 0x08, 0x04, 0x04, 0x04, 0x00, 0x08, 0x0e, 0x00, 0xf0, 0x1d, 0x00,
0x00, 0x38, 0x00, 0x00, 0x70, 0x00, 0x00, 0xe0, 0x00, 0x00, 0xc0, 0x01,
0x00, 0x80, 0x00, 0x00, 0x00, 0x00 };

9
cursors/zoom_in_mask.xbm Normal file
View File

@ -0,0 +1,9 @@
/* Created with The GIMP */
#define zoom_in_mask_width 22
#define zoom_in_mask_height 18
static char zoom_in_mask_bits[] = {
0xf8, 0x03, 0x00, 0xfc, 0x07, 0x00, 0xfe, 0x0f, 0x00, 0x1f, 0x1f, 0x0e,
0x0f, 0x1e, 0x0e, 0x07, 0x9c, 0x3f, 0x07, 0x9c, 0x3f, 0x07, 0x9c, 0x3f,
0x0f, 0x1e, 0x0e, 0x1f, 0x1f, 0x0e, 0xfe, 0x3f, 0x00, 0xfc, 0x7f, 0x00,
0xf8, 0xff, 0x00, 0x00, 0xfc, 0x01, 0x00, 0xf8, 0x03, 0x00, 0xf0, 0x03,
0x00, 0xe0, 0x03, 0x00, 0xc0, 0x01 };

11
cursors/zoom_out.xbm Normal file
View File

@ -0,0 +1,11 @@
/* Created with The GIMP */
#define zoom_out_width 22
#define zoom_out_height 18
#define zoom_out_x_hot 6
#define zoom_out_y_hot 6
static char zoom_out_bits[] = {
0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x08, 0x02, 0x00, 0x04, 0x04, 0x00,
0x02, 0x08, 0x00, 0x02, 0x08, 0x00, 0x02, 0x08, 0x1f, 0x02, 0x08, 0x00,
0x02, 0x08, 0x00, 0x04, 0x04, 0x00, 0x08, 0x0e, 0x00, 0xf0, 0x1d, 0x00,
0x00, 0x38, 0x00, 0x00, 0x70, 0x00, 0x00, 0xe0, 0x00, 0x00, 0xc0, 0x01,
0x00, 0x80, 0x00, 0x00, 0x00, 0x00 };

View File

@ -0,0 +1,9 @@
/* Created with The GIMP */
#define zoom_out_mask_width 22
#define zoom_out_mask_height 18
static char zoom_out_mask_bits[] = {
0xf8, 0x03, 0x00, 0xfc, 0x07, 0x00, 0xfe, 0x0f, 0x00, 0x1f, 0x1f, 0x00,
0x0f, 0x1e, 0x00, 0x07, 0x9c, 0x3f, 0x07, 0x9c, 0x3f, 0x07, 0x9c, 0x3f,
0x0f, 0x1e, 0x00, 0x1f, 0x1f, 0x00, 0xfe, 0x3f, 0x00, 0xfc, 0x7f, 0x00,
0xf8, 0xff, 0x00, 0x00, 0xfc, 0x01, 0x00, 0xf8, 0x03, 0x00, 0xf0, 0x03,
0x00, 0xe0, 0x03, 0x00, 0xc0, 0x01 };

View File

@ -1622,7 +1622,7 @@ rgb_to_gray(unsigned char *rgb, /* I - RGB pixels */
*gray = lut->composite[((rgb[0] * LUM_RED +
rgb[1] * LUM_GREEN +
rgb[2] * LUM_BLUE) *
rgb[3] / 255 + 255 - rgb[3])];
rgb[3] / 25500 + 255 - rgb[3])];
gray ++;
rgb += bpp;
width --;