(cont'd from previous commit) Fixed Issue 183. Added intermediate screen updates during expensive operations (including rectangle, I forgot it in previous commit). Display more responsive to users of fast mice.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@991 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-08-15 16:56:20 +00:00
parent 562099f17f
commit 025d27ff71
5 changed files with 229 additions and 217 deletions

View File

@ -262,12 +262,15 @@
Default_window_size = 640,480 ; (default '640,480')
; This setting allows you merge successive mouse movements into a single
; mouse movement. Ideally you should leave it at zero, but if you have an
; extremely fast mouse and you see the mouse cursor lagging WHEN YOU'RE NOT
; DRAWING, you may want to set it to 1, 2 or more, so that GrafX2 skips small
; steps. A very high value (100) guarantees that Grafx2 merges all the mouse
; steps into a single one.
Merge_movement = 100 ; (default 100)
; mouse movement. You should only use it if you are using a mouse which
; reports at 200Hz or more, and you experience lag when using discontinuous
; hand-drawing with large brushes (this tool tries to paste the brush and
; update the screen on each new mouse position) In this case, set this to 2
; or more, to ignore some intermediate mouse reports when a more recent one
; is present.
; Note that with a value superior to 1, you lose precision with continuous
; hand-drawing, as intermediate mouse positions are skipped.
Merge_movement = 0 ; (default 0)
; Number of columns in the palette of the menu bar. Can be any number from
; 1 to 256. If there is not enough room, the program will display less

View File

@ -878,8 +878,9 @@ GFX2_GLOBAL short Colorpicker_Y;
/// each operation, and for each mouse state (no button,left button,right button)
GFX2_GLOBAL struct
{
byte Hide_cursor; ///< Boolean: Need to hide/unhide cursor during this step
Func_action Action; ///< Function to call
byte Hide_cursor; ///< Boolean: Need to hide/unhide cursor during this step
byte Fast_mouse; ///< Operation should take shortcuts with mouse movements
} Operation[NB_OPERATIONS][3][OPERATION_STACK_SIZE];
// -- misc

16
graph.c
View File

@ -1670,18 +1670,20 @@ void Draw_empty_rectangle(short start_x,short start_y,short end_x,short end_y,by
}
// On trace le rectangle:
Init_permanent_draw();
for (x_pos=start_x;x_pos<=end_x;x_pos++)
Display_paintbrush(x_pos,start_y,color,0);
{
Pixel_figure_permanent(x_pos,start_y,color);
Pixel_figure_permanent(x_pos, end_y,color);
}
for (y_pos=start_y+1;y_pos<end_y;y_pos++)
{
Display_paintbrush(start_x,y_pos,color,0);
Display_paintbrush( end_x,y_pos,color,0);
Pixel_figure_permanent(start_x,y_pos,color);
Pixel_figure_permanent( end_x,y_pos,color);
}
for (x_pos=start_x;x_pos<=end_x;x_pos++)
Display_paintbrush(x_pos, end_y,color,0);
#if defined(__macosx__) || defined(__FreeBSD__)
Update_part_of_screen(start_x,end_x,end_x-start_x,end_y-start_y);
#endif

381
init.c
View File

@ -1229,13 +1229,16 @@ void Init_buttons(void)
void Init_operation(byte operation_number,
byte mouse_button,
byte stack_index,
Func_action Action,
byte Hide_cursor)
Func_action action,
byte hide_cursor,
byte fast_mouse)
{
Operation[operation_number][mouse_button]
[stack_index].Action=Action;
[stack_index].Action=action;
Operation[operation_number][mouse_button]
[stack_index].Hide_cursor=Hide_cursor;
[stack_index].Hide_cursor=hide_cursor;
Operation[operation_number][mouse_button]
[stack_index].Fast_mouse=fast_mouse;
}
@ -1246,391 +1249,393 @@ void Init_operations(void)
byte number; // Numéro de l'option en cours d'auto-initialisation
byte Button; // Button souris en cours d'auto-initialisation
byte stack_index; // Taille de la pile en cours d'auto-initialisation
#define HIDE_CURSOR 1
#define FAST_MOUSE 1
// Auto-initialisation des opérations (vers des actions inoffensives)
for (number=0;number<NB_OPERATIONS;number++)
for (Button=0;Button<3;Button++)
for (stack_index=0;stack_index<OPERATION_STACK_SIZE;stack_index++)
Init_operation(number,Button,stack_index,Print_coordinates,0);
Init_operation(number,Button,stack_index,Print_coordinates,HIDE_CURSOR,FAST_MOUSE);
// Ici viennent les déclarations détaillées des opérations
Init_operation(OPERATION_CONTINUOUS_DRAW,1,0,
Freehand_mode1_1_0,1);
Freehand_mode1_1_0,HIDE_CURSOR,0);
Init_operation(OPERATION_CONTINUOUS_DRAW,1,2,
Freehand_mode1_1_2,0);
Freehand_mode1_1_2,0,0);
Init_operation(OPERATION_CONTINUOUS_DRAW,0,2,
Freehand_mode12_0_2,0);
Freehand_mode12_0_2,0,0);
Init_operation(OPERATION_CONTINUOUS_DRAW,2,0,
Freehand_mode1_2_0,1);
Freehand_mode1_2_0,HIDE_CURSOR,0);
Init_operation(OPERATION_CONTINUOUS_DRAW,2,2,
Freehand_mode1_2_2,0);
Freehand_mode1_2_2,0,0);
Init_operation(OPERATION_DISCONTINUOUS_DRAW,1,0,
Freehand_mode2_1_0,1);
Freehand_mode2_1_0,HIDE_CURSOR,0);
Init_operation(OPERATION_DISCONTINUOUS_DRAW,1,2,
Freehand_mode2_1_2,0);
Freehand_mode2_1_2,0,0);
Init_operation(OPERATION_DISCONTINUOUS_DRAW,0,2,
Freehand_mode12_0_2,0);
Freehand_mode12_0_2,0,0);
Init_operation(OPERATION_DISCONTINUOUS_DRAW,2,0,
Freehand_mode2_2_0,1);
Freehand_mode2_2_0,HIDE_CURSOR,0);
Init_operation(OPERATION_DISCONTINUOUS_DRAW,2,2,
Freehand_mode2_2_2,0);
Freehand_mode2_2_2,0,0);
Init_operation(OPERATION_POINT_DRAW,1,0,
Freehand_mode3_1_0,1);
Freehand_mode3_1_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POINT_DRAW,2,0,
Freehand_Mode3_2_0,1);
Freehand_Mode3_2_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POINT_DRAW,0,1,
Freehand_mode3_0_1,0);
Freehand_mode3_0_1,0,FAST_MOUSE);
Init_operation(OPERATION_LINE,1,0,
Line_12_0,1);
Line_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_LINE,1,5,
Line_12_5,0);
Line_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_LINE,0,5,
Line_0_5,1);
Line_0_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_LINE,2,0,
Line_12_0,1);
Line_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_LINE,2,5,
Line_12_5,0);
Line_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_K_LIGNE,1,0,
K_line_12_0,1);
K_line_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_K_LIGNE,1,6,
K_line_12_6,0);
K_line_12_6,0,FAST_MOUSE);
Init_operation(OPERATION_K_LIGNE,1,7,
K_line_12_7,1);
Init_operation(OPERATION_K_LIGNE,2,0,
K_line_12_0,1);
K_line_12_7,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_K_LIGNE,2,FAST_MOUSE,
K_line_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_K_LIGNE,2,6,
K_line_12_6,0);
K_line_12_6,0,FAST_MOUSE);
Init_operation(OPERATION_K_LIGNE,2,7,
K_line_12_7,1);
K_line_12_7,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_K_LIGNE,0,6,
K_line_0_6,1);
K_line_0_6,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_K_LIGNE,0,7,
K_line_12_6,0);
K_line_12_6,0,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_RECTANGLE,1,0,
Rectangle_12_0,1);
Rectangle_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_RECTANGLE,2,0,
Rectangle_12_0,1);
Rectangle_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_RECTANGLE,1,5,
Rectangle_12_5,0);
Rectangle_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_RECTANGLE,2,5,
Rectangle_12_5,0);
Rectangle_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_RECTANGLE,0,5,
Empty_rectangle_0_5,1);
Empty_rectangle_0_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILLED_RECTANGLE,1,0,
Rectangle_12_0,1);
Rectangle_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILLED_RECTANGLE,2,0,
Rectangle_12_0,1);
Rectangle_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILLED_RECTANGLE,1,5,
Rectangle_12_5,0);
Rectangle_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_FILLED_RECTANGLE,2,5,
Rectangle_12_5,0);
Rectangle_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_FILLED_RECTANGLE,0,5,
Filled_rectangle_0_5,1);
Filled_rectangle_0_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_CIRCLE,1,0,
Circle_12_0,1);
Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_CIRCLE,2,0,
Circle_12_0,1);
Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_CIRCLE,1,5,
Circle_12_5,0);
Circle_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_CIRCLE,2,5,
Circle_12_5,0);
Circle_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_CIRCLE,0,5,
Empty_circle_0_5,1);
Empty_circle_0_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILLED_CIRCLE,1,0,
Circle_12_0,1);
Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILLED_CIRCLE,2,0,
Circle_12_0,1);
Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILLED_CIRCLE,1,5,
Circle_12_5,0);
Circle_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_FILLED_CIRCLE,2,5,
Circle_12_5,0);
Circle_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_FILLED_CIRCLE,0,5,
Filled_circle_0_5,1);
Filled_circle_0_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_ELLIPSE,1,0,
Ellipse_12_0,1);
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_ELLIPSE,2,0,
Ellipse_12_0,1);
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_ELLIPSE,1,5,
Ellipse_12_5,0);
Ellipse_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_ELLIPSE,2,5,
Ellipse_12_5,0);
Ellipse_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_EMPTY_ELLIPSE,0,5,
Empty_ellipse_0_5,1);
Empty_ellipse_0_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILLED_ELLIPSE,1,0,
Ellipse_12_0,1);
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILLED_ELLIPSE,2,0,
Ellipse_12_0,1);
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILLED_ELLIPSE,1,5,
Ellipse_12_5,0);
Ellipse_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_FILLED_ELLIPSE,2,5,
Ellipse_12_5,0);
Ellipse_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_FILLED_ELLIPSE,0,5,
Filled_ellipse_0_5,1);
Filled_ellipse_0_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILL,1,0,
Fill_1_0,0);
Fill_1_0,0,FAST_MOUSE);
Init_operation(OPERATION_FILL,2,0,
Fill_2_0,0);
Fill_2_0,0,FAST_MOUSE);
Init_operation(OPERATION_REPLACE,1,0,
Replace_1_0,0);
Replace_1_0,0,FAST_MOUSE);
Init_operation(OPERATION_REPLACE,2,0,
Replace_2_0,0);
Replace_2_0,0,FAST_MOUSE);
Init_operation(OPERATION_GRAB_BRUSH,1,0,
Brush_12_0,1);
Brush_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAB_BRUSH,2,0,
Brush_12_0,1);
Brush_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAB_BRUSH,1,5,
Brush_12_5,0);
Brush_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_GRAB_BRUSH,2,5,
Brush_12_5,0);
Brush_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_GRAB_BRUSH,0,5,
Brush_0_5,1);
Brush_0_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_STRETCH_BRUSH,1,0,
Stretch_brush_12_0,1);
Stretch_brush_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_STRETCH_BRUSH,2,0,
Stretch_brush_12_0,1);
Stretch_brush_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_STRETCH_BRUSH,1,7,
Stretch_brush_1_7,0);
Stretch_brush_1_7,0,FAST_MOUSE);
Init_operation(OPERATION_STRETCH_BRUSH,0,7,
Stretch_brush_0_7,0);
Stretch_brush_0_7,0,FAST_MOUSE);
Init_operation(OPERATION_STRETCH_BRUSH,2,7,
Stretch_brush_2_7,1);
Stretch_brush_2_7,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_ROTATE_BRUSH,1,0,
Rotate_brush_12_0,1);
Rotate_brush_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_ROTATE_BRUSH,2,0,
Rotate_brush_12_0,1);
Rotate_brush_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_ROTATE_BRUSH,1,5,
Rotate_brush_1_5,0);
Rotate_brush_1_5,0,FAST_MOUSE);
Init_operation(OPERATION_ROTATE_BRUSH,0,5,
Rotate_brush_0_5,0);
Rotate_brush_0_5,0,FAST_MOUSE);
Init_operation(OPERATION_ROTATE_BRUSH,2,5,
Rotate_brush_2_5,1);
Rotate_brush_2_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_DISTORT_BRUSH,0,0,
Distort_brush_0_0,0);
Distort_brush_0_0,0,FAST_MOUSE);
Init_operation(OPERATION_DISTORT_BRUSH,1,0,
Distort_brush_1_0,0);
Distort_brush_1_0,0,FAST_MOUSE);
Init_operation(OPERATION_DISTORT_BRUSH,1,8,
Distort_brush_1_8,0);
Distort_brush_1_8,0,FAST_MOUSE);
Init_operation(OPERATION_DISTORT_BRUSH,2,8,
Distort_brush_2_8,1);
Distort_brush_2_8,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_DISTORT_BRUSH,2,0,
Distort_brush_2_0,1);
Distort_brush_2_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_DISTORT_BRUSH,1,9,
Distort_brush_1_9,0);
Distort_brush_1_9,0,FAST_MOUSE);
Init_operation(OPERATION_DISTORT_BRUSH,0,9,
Distort_brush_0_9,0);
Distort_brush_0_9,0,FAST_MOUSE);
Init_operation(OPERATION_POLYBRUSH,1,0,
Filled_polyform_12_0,1);
Filled_polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYBRUSH,2,0,
Filled_polyform_12_0,1);
Filled_polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYBRUSH,1,8,
Polybrush_12_8,0);
Polybrush_12_8,0,0);
Init_operation(OPERATION_POLYBRUSH,2,8,
Polybrush_12_8,0);
Polybrush_12_8,0,0);
Init_operation(OPERATION_POLYBRUSH,0,8,
Filled_polyform_0_8,0);
Filled_polyform_0_8,0,FAST_MOUSE);
Colorpicker_color=-1;
Init_operation(OPERATION_COLORPICK,1,0,
Colorpicker_12_0,1);
Colorpicker_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_COLORPICK,2,0,
Colorpicker_12_0,0);
Colorpicker_12_0,0,FAST_MOUSE);
Init_operation(OPERATION_COLORPICK,1,1,
Colorpicker_1_1,0);
Colorpicker_1_1,0,FAST_MOUSE);
Init_operation(OPERATION_COLORPICK,2,1,
Colorpicker_2_1,0);
Colorpicker_2_1,0,FAST_MOUSE);
Init_operation(OPERATION_COLORPICK,0,1,
Colorpicker_0_1,1);
Colorpicker_0_1,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_MAGNIFY,1,0,
Magnifier_12_0,0);
Magnifier_12_0,0,FAST_MOUSE);
Init_operation(OPERATION_MAGNIFY,2,0,
Magnifier_12_0,0);
Magnifier_12_0,0,FAST_MOUSE);
Init_operation(OPERATION_4_POINTS_CURVE,1,0,
Curve_34_points_1_0,1);
Curve_34_points_1_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_4_POINTS_CURVE,2,0,
Curve_34_points_2_0,1);
Curve_34_points_2_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_4_POINTS_CURVE,1,5,
Curve_34_points_1_5,0);
Curve_34_points_1_5,0,FAST_MOUSE);
Init_operation(OPERATION_4_POINTS_CURVE,2,5,
Curve_34_points_2_5,0);
Curve_34_points_2_5,0,FAST_MOUSE);
Init_operation(OPERATION_4_POINTS_CURVE,0,5,
Curve_4_points_0_5,1);
Curve_4_points_0_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_4_POINTS_CURVE,1,9,
Curve_4_points_1_9,0);
Curve_4_points_1_9,0,FAST_MOUSE);
Init_operation(OPERATION_4_POINTS_CURVE,2,9,
Curve_4_points_2_9,0);
Curve_4_points_2_9,0,FAST_MOUSE);
Init_operation(OPERATION_3_POINTS_CURVE,1,0,
Curve_34_points_1_0,1);
Curve_34_points_1_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_3_POINTS_CURVE,2,0,
Curve_34_points_2_0,1);
Curve_34_points_2_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_3_POINTS_CURVE,1,5,
Curve_34_points_1_5,0);
Curve_34_points_1_5,0,FAST_MOUSE);
Init_operation(OPERATION_3_POINTS_CURVE,2,5,
Curve_34_points_2_5,0);
Curve_34_points_2_5,0,FAST_MOUSE);
Init_operation(OPERATION_3_POINTS_CURVE,0,5,
Curve_3_points_0_5,1);
Curve_3_points_0_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_3_POINTS_CURVE,0,11,
Curve_3_points_0_11,0);
Curve_3_points_0_11,0,FAST_MOUSE);
Init_operation(OPERATION_3_POINTS_CURVE,1,11,
Curve_3_points_12_11,0);
Curve_3_points_12_11,0,FAST_MOUSE);
Init_operation(OPERATION_3_POINTS_CURVE,2,11,
Curve_3_points_12_11,0);
Curve_3_points_12_11,0,FAST_MOUSE);
Init_operation(OPERATION_AIRBRUSH,1,0,
Airbrush_1_0,0);
Airbrush_1_0,0,0);
Init_operation(OPERATION_AIRBRUSH,2,0,
Airbrush_2_0,0);
Airbrush_2_0,0,0);
Init_operation(OPERATION_AIRBRUSH,1,2,
Airbrush_12_2,0);
Airbrush_12_2,0,0);
Init_operation(OPERATION_AIRBRUSH,2,2,
Airbrush_12_2,0);
Airbrush_12_2,0,0);
Init_operation(OPERATION_AIRBRUSH,0,2,
Airbrush_0_2,0);
Airbrush_0_2,0,0);
Init_operation(OPERATION_POLYGON,1,0,
Polygon_12_0,1);
Polygon_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYGON,2,0,
Polygon_12_0,1);
Polygon_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYGON,1,8,
K_line_12_6,0);
K_line_12_6,0,FAST_MOUSE);
Init_operation(OPERATION_POLYGON,2,8,
K_line_12_6,0);
K_line_12_6,0,FAST_MOUSE);
Init_operation(OPERATION_POLYGON,1,9,
Polygon_12_9,1);
Polygon_12_9,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYGON,2,9,
Polygon_12_9,1);
Polygon_12_9,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYGON,0,8,
K_line_0_6,1);
K_line_0_6,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYGON,0,9,
K_line_12_6,0);
K_line_12_6,0,FAST_MOUSE);
Init_operation(OPERATION_POLYFILL,1,0,
Polyfill_12_0,1);
Polyfill_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYFILL,2,0,
Polyfill_12_0,1);
Polyfill_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYFILL,1,8,
Polyfill_12_8,0);
Polyfill_12_8,0,FAST_MOUSE);
Init_operation(OPERATION_POLYFILL,2,8,
Polyfill_12_8,0);
Polyfill_12_8,0,FAST_MOUSE);
Init_operation(OPERATION_POLYFILL,1,9,
Polyfill_12_9,0);
Polyfill_12_9,0,FAST_MOUSE);
Init_operation(OPERATION_POLYFILL,2,9,
Polyfill_12_9,0);
Polyfill_12_9,0,FAST_MOUSE);
Init_operation(OPERATION_POLYFILL,0,8,
Polyfill_0_8,1);
Polyfill_0_8,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYFILL,0,9,
Polyfill_12_8,0);
Polyfill_12_8,0,FAST_MOUSE);
Init_operation(OPERATION_POLYFORM,1,0,
Polyform_12_0,1);
Polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYFORM,2,0,
Polyform_12_0,1);
Polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_POLYFORM,1,8,
Polyform_12_8,0);
Polyform_12_8,0,0);
Init_operation(OPERATION_POLYFORM,2,8,
Polyform_12_8,0);
Polyform_12_8,0,0);
Init_operation(OPERATION_POLYFORM,0,8,
Polyform_0_8,0);
Polyform_0_8,0,FAST_MOUSE);
Init_operation(OPERATION_FILLED_POLYFORM,1,0,
Filled_polyform_12_0,1);
Filled_polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILLED_POLYFORM,2,0,
Filled_polyform_12_0,1);
Filled_polyform_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_FILLED_POLYFORM,1,8,
Filled_polyform_12_8,0);
Filled_polyform_12_8,0,0);
Init_operation(OPERATION_FILLED_POLYFORM,2,8,
Filled_polyform_12_8,0);
Filled_polyform_12_8,0,0);
Init_operation(OPERATION_FILLED_POLYFORM,0,8,
Filled_polyform_0_8,0);
Filled_polyform_0_8,0,FAST_MOUSE);
Init_operation(OPERATION_FILLED_CONTOUR,1,0,
Filled_polyform_12_0,1);
Filled_polyform_12_0,HIDE_CURSOR,0);
Init_operation(OPERATION_FILLED_CONTOUR,2,0,
Filled_polyform_12_0,1);
Filled_polyform_12_0,HIDE_CURSOR,0);
Init_operation(OPERATION_FILLED_CONTOUR,1,8,
Filled_polyform_12_8,0);
Filled_polyform_12_8,0,0);
Init_operation(OPERATION_FILLED_CONTOUR,2,8,
Filled_polyform_12_8,0);
Filled_polyform_12_8,0,0);
Init_operation(OPERATION_FILLED_CONTOUR,0,8,
Filled_contour_0_8,0);
Filled_contour_0_8,0,0);
Init_operation(OPERATION_SCROLL,1,0,
Scroll_12_0,1);
Scroll_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_SCROLL,2,0,
Scroll_12_0,1);
Scroll_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_SCROLL,1,4,
Scroll_12_4,0);
Scroll_12_4,0,FAST_MOUSE);
Init_operation(OPERATION_SCROLL,2,4,
Scroll_12_4,0);
Scroll_12_4,0,FAST_MOUSE);
Init_operation(OPERATION_SCROLL,0,4,
Scroll_0_4,1);
Scroll_0_4,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAD_CIRCLE,1,0,Grad_circle_12_0,1);
Init_operation(OPERATION_GRAD_CIRCLE,2,0,Grad_circle_12_0,1);
Init_operation(OPERATION_GRAD_CIRCLE,1,6,Grad_circle_12_6,0);
Init_operation(OPERATION_GRAD_CIRCLE,2,6,Grad_circle_12_6,0);
Init_operation(OPERATION_GRAD_CIRCLE,0,6,Grad_circle_0_6,1);
Init_operation(OPERATION_GRAD_CIRCLE,1,8,Grad_circle_12_8,0);
Init_operation(OPERATION_GRAD_CIRCLE,2,8,Grad_circle_12_8,0);
Init_operation(OPERATION_GRAD_CIRCLE,0,8,Grad_circle_or_ellipse_0_8,0);
Init_operation(OPERATION_GRAD_CIRCLE,1,0,Grad_circle_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAD_CIRCLE,2,0,Grad_circle_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAD_CIRCLE,1,6,Grad_circle_12_6,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_CIRCLE,2,6,Grad_circle_12_6,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_CIRCLE,0,6,Grad_circle_0_6,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAD_CIRCLE,1,8,Grad_circle_12_8,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_CIRCLE,2,8,Grad_circle_12_8,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_CIRCLE,0,8,Grad_circle_or_ellipse_0_8,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_ELLIPSE,1,0,Grad_ellipse_12_0,1);
Init_operation(OPERATION_GRAD_ELLIPSE,2,0,Grad_ellipse_12_0,1);
Init_operation(OPERATION_GRAD_ELLIPSE,1,6,Grad_ellipse_12_6,0);
Init_operation(OPERATION_GRAD_ELLIPSE,2,6,Grad_ellipse_12_6,0);
Init_operation(OPERATION_GRAD_ELLIPSE,0,6,Grad_ellipse_0_6,1);
Init_operation(OPERATION_GRAD_ELLIPSE,1,8,Grad_ellipse_12_8,0);
Init_operation(OPERATION_GRAD_ELLIPSE,2,8,Grad_ellipse_12_8,0);
Init_operation(OPERATION_GRAD_ELLIPSE,0,8,Grad_circle_or_ellipse_0_8,0);
Init_operation(OPERATION_GRAD_ELLIPSE,1,0,Grad_ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAD_ELLIPSE,2,0,Grad_ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAD_ELLIPSE,1,6,Grad_ellipse_12_6,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_ELLIPSE,2,6,Grad_ellipse_12_6,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_ELLIPSE,0,6,Grad_ellipse_0_6,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAD_ELLIPSE,1,8,Grad_ellipse_12_8,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_ELLIPSE,2,8,Grad_ellipse_12_8,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_ELLIPSE,0,8,Grad_circle_or_ellipse_0_8,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_RECTANGLE,1,0,Grad_rectangle_12_0,0);
Init_operation(OPERATION_GRAD_RECTANGLE,1,5,Grad_rectangle_12_5,0);
Init_operation(OPERATION_GRAD_RECTANGLE,0,5,Grad_rectangle_0_5,1);
Init_operation(OPERATION_GRAD_RECTANGLE,0,7,Grad_rectangle_0_7,0);
Init_operation(OPERATION_GRAD_RECTANGLE,1,7,Grad_rectangle_12_7,1);
Init_operation(OPERATION_GRAD_RECTANGLE,2,7,Grad_rectangle_12_7,1);
Init_operation(OPERATION_GRAD_RECTANGLE,1,9,Grad_rectangle_12_9,1);
Init_operation(OPERATION_GRAD_RECTANGLE,0,9,Grad_rectangle_0_9,0);
Init_operation(OPERATION_GRAD_RECTANGLE,1,0,Grad_rectangle_12_0,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_RECTANGLE,1,5,Grad_rectangle_12_5,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_RECTANGLE,0,5,Grad_rectangle_0_5,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAD_RECTANGLE,0,7,Grad_rectangle_0_7,0,FAST_MOUSE);
Init_operation(OPERATION_GRAD_RECTANGLE,1,7,Grad_rectangle_12_7,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAD_RECTANGLE,2,7,Grad_rectangle_12_7,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAD_RECTANGLE,1,9,Grad_rectangle_12_9,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_GRAD_RECTANGLE,0,9,Grad_rectangle_0_9,0,FAST_MOUSE);
Init_operation(OPERATION_CENTERED_LINES,1,0,
Centered_lines_12_0,1);
Centered_lines_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_CENTERED_LINES,2,0,
Centered_lines_12_0,1);
Centered_lines_12_0,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_CENTERED_LINES,1,3,
Centered_lines_12_3,0);
Centered_lines_12_3,0,FAST_MOUSE);
Init_operation(OPERATION_CENTERED_LINES,2,3,
Centered_lines_12_3,0);
Centered_lines_12_3,0,FAST_MOUSE);
Init_operation(OPERATION_CENTERED_LINES,0,3,
Centered_lines_0_3,1);
Centered_lines_0_3,HIDE_CURSOR,FAST_MOUSE);
Init_operation(OPERATION_CENTERED_LINES,1,7,
Centered_lines_12_7,0);
Centered_lines_12_7,0,FAST_MOUSE);
Init_operation(OPERATION_CENTERED_LINES,2,7,
Centered_lines_12_7,0);
Centered_lines_12_7,0,FAST_MOUSE);
Init_operation(OPERATION_CENTERED_LINES,0,7,
Centered_lines_0_7,0);
Centered_lines_0_7,0,FAST_MOUSE);
}

31
input.c
View File

@ -54,7 +54,6 @@ long Directional_delay;
long Directional_last_move;
long Directional_step;
int Mouse_moved; ///< Boolean, Set to true if any cursor movement occurs.
int Mouse_blocked; ///< Boolean, Set to true if mouse movement was clipped.
word Input_new_mouse_X;
word Input_new_mouse_Y;
@ -113,18 +112,20 @@ int Is_shortcut(word Key, word function)
int Move_cursor_with_constraints()
{
int feedback=0;
int mouse_blocked=0; ///< Boolean, Set to true if mouse movement was clipped.
// Clip mouse to the editing area. There can be a border when using big
// pixels, if the SDL screen dimensions are not factors of the pixel size.
if (Input_new_mouse_Y>=Screen_height)
{
Input_new_mouse_Y=Screen_height-1;
Mouse_blocked=1;
mouse_blocked=1;
}
if (Input_new_mouse_X>=Screen_width)
{
Input_new_mouse_X=Screen_width-1;
Mouse_blocked=1;
mouse_blocked=1;
}
//Gestion "avancée" du curseur: interdire la descente du curseur dans le
//menu lorsqu'on est en train de travailler dans l'image
@ -136,7 +137,7 @@ int Move_cursor_with_constraints()
if(Menu_Y<=Input_new_mouse_Y)
{
//On bloque le curseur en fin d'image
Mouse_blocked=1;
mouse_blocked=1;
Input_new_mouse_Y=Menu_Y-1; //La ligne !!au-dessus!! du menu
}
@ -146,7 +147,7 @@ int Move_cursor_with_constraints()
{
if(Input_new_mouse_X>=Main_separator_position)
{
Mouse_blocked=1;
mouse_blocked=1;
Input_new_mouse_X=Main_separator_position-1;
}
}
@ -154,7 +155,7 @@ int Move_cursor_with_constraints()
{
if(Input_new_mouse_X<Main_X_zoom)
{
Mouse_blocked=1;
mouse_blocked=1;
Input_new_mouse_X=Main_X_zoom;
}
}
@ -175,7 +176,7 @@ int Move_cursor_with_constraints()
// Hide cursor, because even just a click change needs it
if (!Mouse_moved)
{
Mouse_moved=1;
Mouse_moved++;
// Hide cursor (erasing icon and brush on screen
// before changing the coordinates.
Hide_cursor();
@ -184,15 +185,16 @@ int Move_cursor_with_constraints()
{
Mouse_X=Input_new_mouse_X;
Mouse_Y=Input_new_mouse_Y;
if (Mouse_blocked)
Set_mouse_position();
}
Mouse_K=Input_new_mouse_K;
if (Operation_stack_size != 0)
feedback=1;
if (Mouse_moved > Config.Mouse_merge_movement)
if (! Operation[Current_operation][Mouse_K_unique]
[Operation_stack_size].Fast_mouse)
feedback=1;
}
if (mouse_blocked)
Set_mouse_position();
return feedback;
}
@ -654,11 +656,10 @@ int Get_input(void)
{
SDL_Event event;
int user_feedback_required = 0; // Flag qui indique si on doit arrêter de traiter les évènements ou si on peut enchainer
Key_ANSI = 0;
Key = 0;
Mouse_moved=0;
Mouse_blocked=0;
Input_new_mouse_X = Mouse_X;
Input_new_mouse_Y = Mouse_Y;
@ -790,7 +791,7 @@ int Get_input(void)
Flush_update();
return Mouse_moved || user_feedback_required;
return (Mouse_moved!=0) || user_feedback_required;
}
void Adjust_mouse_sensitivity(word fullscreen)