diff --git a/gfx2def.ini b/gfx2def.ini index fe166e40..38b5d657 100644 --- a/gfx2def.ini +++ b/gfx2def.ini @@ -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 diff --git a/global.h b/global.h index 8887d7b5..4044ae73 100644 --- a/global.h +++ b/global.h @@ -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 diff --git a/graph.c b/graph.c index 9029f439..7be0f8fe 100644 --- a/graph.c +++ b/graph.c @@ -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=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 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)