implements selection of circle/ellipse mode with right button
see http://pulkomandy.tk/projects/GrafX2/ticket/54
This commit is contained in:
parent
df73e91c08
commit
f2d579695c
100
src/buttons.c
100
src/buttons.c
@ -2345,38 +2345,79 @@ void Button_Filled_rectangle(void)
|
||||
|
||||
// -- Gestion des boutons de cercle (ellipse) vide et plein(e) --------------
|
||||
|
||||
void Button_Empty_circle(void)
|
||||
void Button_circle_ellipse(int btn)
|
||||
{
|
||||
word operation;
|
||||
|
||||
switch (btn)
|
||||
{
|
||||
default:
|
||||
case BUTTON_CIRCLES:
|
||||
operation = OPERATION_EMPTY_CIRCLE_CTR;
|
||||
break;
|
||||
case BUTTON_FILLCIRC:
|
||||
operation = OPERATION_FILLED_CIRCLE_CTR;
|
||||
break;
|
||||
case BUTTON_SPHERES:
|
||||
operation = OPERATION_GRAD_CIRCLE_CTR;
|
||||
break;
|
||||
}
|
||||
operation += Selected_circle_ellipse_mode; // CIRCLE_CTR/CIRCLE_CRN/ELLIPSE_CTR/ELLIPSE_CRN;
|
||||
Hide_cursor();
|
||||
Start_operation_stack(OPERATION_EMPTY_CIRCLE);
|
||||
Start_operation_stack(operation);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
|
||||
void Button_Empty_ellipse(void)
|
||||
void Button_Circle_switch_mode(int btn)
|
||||
{
|
||||
T_Dropdown_button dropdown;
|
||||
T_Dropdown_choice *item = NULL;
|
||||
int i;
|
||||
static const char * text[4] =
|
||||
{ "Circle (center/radius)", "Circle (corners)",
|
||||
"Ellipse (center/radiuses)", "Ellipse (corners)" };
|
||||
|
||||
dropdown.Pos_X =Buttons_Pool[btn].X_offset;
|
||||
dropdown.Pos_Y =Buttons_Pool[btn].Y_offset;
|
||||
dropdown.Height =Buttons_Pool[btn].Height;
|
||||
dropdown.Dropdown_width=26*8;
|
||||
dropdown.First_item =NULL;
|
||||
dropdown.Bottom_up =1;
|
||||
|
||||
Hide_cursor();
|
||||
Start_operation_stack(OPERATION_EMPTY_ELLIPSE);
|
||||
|
||||
// If we get here from a keyboard shortcut, don't show the menu and directly
|
||||
// switch to the next drawing mode.
|
||||
if (Mouse_K != 0) {
|
||||
for(i = 0; i < 4; i++) {
|
||||
Window_dropdown_add_item(&dropdown, i, text[i]);
|
||||
}
|
||||
item=Dropdown_activate(&dropdown,0,Menu_Y);
|
||||
}
|
||||
|
||||
if (item)
|
||||
{
|
||||
Selected_circle_ellipse_mode = item->Number;
|
||||
} else {
|
||||
Selected_circle_ellipse_mode = (Selected_circle_ellipse_mode + 1) & 3;
|
||||
}
|
||||
|
||||
Display_sprite_in_menu(BUTTON_CIRCLES,
|
||||
(Selected_circle_ellipse_mode >= 2) ? MENU_SPRITE_ELLIPSES : -1);
|
||||
Draw_menu_button(BUTTON_CIRCLES,BUTTON_RELEASED);
|
||||
Display_sprite_in_menu(BUTTON_FILLCIRC,
|
||||
(Selected_circle_ellipse_mode >= 2) ? MENU_SPRITE_ELLIPSES : -1);
|
||||
Draw_menu_button(BUTTON_FILLCIRC,BUTTON_RELEASED);
|
||||
Display_sprite_in_menu(BUTTON_SPHERES,
|
||||
(Selected_circle_ellipse_mode >= 2) ? MENU_SPRITE_GRAD_ELLIPSE : -1);
|
||||
Draw_menu_button(BUTTON_SPHERES,BUTTON_RELEASED);
|
||||
Draw_menu_button(btn,BUTTON_PRESSED);
|
||||
|
||||
Display_cursor();
|
||||
Button_circle_ellipse(btn);
|
||||
Window_dropdown_clear_items(&dropdown);
|
||||
}
|
||||
|
||||
|
||||
void Button_Filled_circle(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Start_operation_stack(OPERATION_FILLED_CIRCLE);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
|
||||
void Button_Filled_ellipse(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Start_operation_stack(OPERATION_FILLED_ELLIPSE);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
|
||||
// -- Gestion du menu des dégradés ------------------------------------------
|
||||
void Draw_button_gradient_style(short x_pos,short y_pos,int technique)
|
||||
{
|
||||
@ -2774,21 +2815,6 @@ void Button_Gradients(void)
|
||||
|
||||
// -- Gestion des boutons de cercle / ellipse / rectangle dégradés --------------------
|
||||
|
||||
void Button_Grad_circle(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Start_operation_stack(OPERATION_GRAD_CIRCLE);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
|
||||
void Button_Grad_ellipse(void)
|
||||
{
|
||||
Hide_cursor();
|
||||
Start_operation_stack(OPERATION_GRAD_ELLIPSE);
|
||||
Display_cursor();
|
||||
}
|
||||
|
||||
|
||||
void Button_Grad_rectangle(void)
|
||||
{
|
||||
|
||||
@ -218,20 +218,6 @@ void Button_Gradients(void);
|
||||
*/
|
||||
void Load_gradient_data(int index);
|
||||
|
||||
// Boutons relatifs aux cercles (ellipses) dégradé(e)s
|
||||
|
||||
/*!
|
||||
Callback for the gradation circle button left click.
|
||||
Starts drawing a gradation circle.
|
||||
*/
|
||||
void Button_Grad_circle(void);
|
||||
|
||||
/*!
|
||||
Callback for the gradation circle right click.
|
||||
Starts drawing a gradation ellipsis.
|
||||
*/
|
||||
void Button_Grad_ellipse(void);
|
||||
|
||||
/*!
|
||||
Callback for the gradation rectangle button.
|
||||
Starts the gradation rectangle drawing operation.
|
||||
@ -241,28 +227,16 @@ void Button_Grad_rectangle(void);
|
||||
// Boutons relatifs aux cercles (ellipses) plein(e)s et vides
|
||||
|
||||
/*!
|
||||
Callback for the circle button left click.
|
||||
Starts drawing an empty circle
|
||||
Callback for the circle/ellipse buttons
|
||||
Starts drawing circle/ellipse
|
||||
*/
|
||||
void Button_Empty_circle(void);
|
||||
void Button_circle_ellipse(int btn);
|
||||
|
||||
/*!
|
||||
Callback for the circle button left click.
|
||||
Starts drawing an empty ellipsis
|
||||
Callback for the cicle button right click.
|
||||
Circle modes
|
||||
*/
|
||||
void Button_Empty_ellipse(void);
|
||||
|
||||
/*!
|
||||
Callback for the filled circle button ledt click.
|
||||
Starts drawing a filled circle.
|
||||
*/
|
||||
void Button_Filled_circle(void);
|
||||
|
||||
/*!
|
||||
Callback for the filled circle right click.
|
||||
Starts drawing a filled ellipsis.
|
||||
*/
|
||||
void Button_Filled_ellipse(void);
|
||||
void Button_Circle_switch_mode(int);
|
||||
|
||||
// Boutons relatifs aux polygones vides et pleins
|
||||
|
||||
|
||||
30
src/const.h
30
src/const.h
@ -567,10 +567,14 @@ enum OPERATIONS
|
||||
OPERATION_CENTERED_LINES, ///< Centered lines
|
||||
OPERATION_EMPTY_RECTANGLE, ///< Empty rectangle
|
||||
OPERATION_FILLED_RECTANGLE, ///< Filled rectangle
|
||||
OPERATION_EMPTY_CIRCLE, ///< Empty circle
|
||||
OPERATION_FILLED_CIRCLE, ///< Filled circle
|
||||
OPERATION_EMPTY_ELLIPSE, ///< Empty ellipse
|
||||
OPERATION_FILLED_ELLIPSE, ///< Filled ellipse
|
||||
OPERATION_EMPTY_CIRCLE_CTR, ///< Empty circle (center radius)
|
||||
OPERATION_EMPTY_CIRCLE_CRN, ///< Empty circle (corners)
|
||||
OPERATION_EMPTY_ELLIPSE_CTR, ///< Empty ellipse (center radius)
|
||||
OPERATION_EMPTY_ELLIPSE_CRN, ///< Empty ellipse (corners)
|
||||
OPERATION_FILLED_CIRCLE_CTR, ///< Filled circle (center radius)
|
||||
OPERATION_FILLED_CIRCLE_CRN, ///< Filled circle (corners)
|
||||
OPERATION_FILLED_ELLIPSE_CTR,///< Filled ellipse (center radius)
|
||||
OPERATION_FILLED_ELLIPSE_CRN,///< Filled ellipse (corners)
|
||||
OPERATION_FILL, ///< Fill
|
||||
OPERATION_REPLACE, ///< Color replacer
|
||||
OPERATION_GRAB_BRUSH, ///< Rectangular brush grabbing
|
||||
@ -585,8 +589,10 @@ enum OPERATIONS
|
||||
OPERATION_POLYFILL, ///< Filled polygon
|
||||
OPERATION_FILLED_POLYFORM, ///< Filled polyform
|
||||
OPERATION_SCROLL, ///< Scroll (pan)
|
||||
OPERATION_GRAD_CIRCLE, ///< Gradient-filled circle
|
||||
OPERATION_GRAD_ELLIPSE, ///< Gradient-filled ellipse
|
||||
OPERATION_GRAD_CIRCLE_CTR, ///< Gradient-filled circle (center radius)
|
||||
OPERATION_GRAD_CIRCLE_CRN, ///< Gradient-filled circle (corners)
|
||||
OPERATION_GRAD_ELLIPSE_CTR, ///< Gradient-filled ellipse (center radius)
|
||||
OPERATION_GRAD_ELLIPSE_CRN, ///< Gradient-filled ellipse (corners)
|
||||
OPERATION_ROTATE_BRUSH, ///< Rotate brush
|
||||
OPERATION_STRETCH_BRUSH, ///< Stretch brush
|
||||
OPERATION_DISTORT_BRUSH, ///< Distort brush
|
||||
@ -608,4 +614,16 @@ enum IMAGE_MODES
|
||||
IMAGE_MODE_MODE5, ///< CPC mode 5
|
||||
};
|
||||
|
||||
/// Circle / Ellipse Modes
|
||||
#define MASK_CIRCLE_ELLIPSE (2)
|
||||
#define MASK_CENTER_CORNERS (1)
|
||||
#define MODE_CIRCLE (0)
|
||||
#define MODE_ELLIPSE (2)
|
||||
#define MODE_CENTER (0)
|
||||
#define MODE_CORNERS (1)
|
||||
#define MODE_CIRCLE_CTR (MODE_CIRCLE|MODE_CENTER)
|
||||
#define MODE_CIRCLE_CRN (MODE_CIRCLE|MODE_CORNERS)
|
||||
#define MODE_ELLIPSE_CTR (MODE_ELLIPSE|MODE_CENTER)
|
||||
#define MODE_ELLIPSE_CRN (MODE_ELLIPSE|MODE_CORNERS)
|
||||
|
||||
#endif
|
||||
|
||||
13
src/engine.c
13
src/engine.c
@ -379,7 +379,7 @@ void Unselect_button(int btn_number)
|
||||
// On affiche le cadre autour du bouton de façon à ce qu'il paraisse relâché
|
||||
Draw_menu_button(btn_number,BUTTON_RELEASED);
|
||||
// On appelle le désenclenchement particulier au bouton:
|
||||
Buttons_Pool[btn_number].Unselect_action();
|
||||
Buttons_Pool[btn_number].Unselect_action(btn_number);
|
||||
}
|
||||
}
|
||||
|
||||
@ -404,13 +404,6 @@ void Select_button(int btn_number,byte click)
|
||||
case BUTTON_FLOODFILL:
|
||||
icon=MENU_SPRITE_REPLACE;
|
||||
break;
|
||||
case BUTTON_CIRCLES:
|
||||
case BUTTON_FILLCIRC:
|
||||
icon=MENU_SPRITE_ELLIPSES;
|
||||
break;
|
||||
case BUTTON_SPHERES:
|
||||
icon=MENU_SPRITE_GRAD_ELLIPSE;
|
||||
break;
|
||||
}
|
||||
if (icon!=-1)
|
||||
{
|
||||
@ -493,9 +486,9 @@ void Select_button(int btn_number,byte click)
|
||||
|
||||
// Puis on se contente d'appeler l'action correspondant au bouton:
|
||||
if (click==1)
|
||||
Buttons_Pool[btn_number].Left_action();
|
||||
Buttons_Pool[btn_number].Left_action(btn_number);
|
||||
else
|
||||
Buttons_Pool[btn_number].Right_action();
|
||||
Buttons_Pool[btn_number].Right_action(btn_number);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -627,6 +627,8 @@ GFX2_GLOBAL byte Selected_freehand_mode;
|
||||
GFX2_GLOBAL byte Selected_curve_mode;
|
||||
/// For the Line tool, this determines which variant is selected, either ::OPERATION_LINE, ::OPERATION_K_LINE or ::OPERATION_CENTERED_LINES
|
||||
GFX2_GLOBAL byte Selected_line_mode;
|
||||
/// Select which kind of Circle/ellipse mode is selected from 0 to 3 : CIRCLE_CTR/CIRCLE_CRN/ELLIPSE_CTR/ELLIPSE_CRN
|
||||
GFX2_GLOBAL byte Selected_circle_ellipse_mode;
|
||||
/// Determines which color appears in the first cell of the menu palette. Change this value to "scroll" the palette.
|
||||
GFX2_GLOBAL byte First_color_in_palette;
|
||||
/// Boolean, true if Grafx2 was run with a command-line argument to set a resolution on startup (overrides config)
|
||||
|
||||
14
src/graph.c
14
src/graph.c
@ -1484,6 +1484,13 @@ static void Draw_inscribed_ellipse_general(short x1, short y1, short x2, short y
|
||||
dbl_center_y = top+bottom;
|
||||
dbl_x_radius = right-left+1;
|
||||
dbl_y_radius = bottom-top+1;
|
||||
if ((Selected_circle_ellipse_mode & MASK_CIRCLE_ELLIPSE) == MODE_CIRCLE)
|
||||
{
|
||||
if (dbl_x_radius > dbl_y_radius)
|
||||
dbl_x_radius = dbl_y_radius;
|
||||
else
|
||||
dbl_y_radius = dbl_x_radius;
|
||||
}
|
||||
sq_dbl_x_radius = (long)dbl_x_radius*dbl_x_radius;
|
||||
sq_dbl_y_radius = (long)dbl_y_radius*dbl_y_radius;
|
||||
sq_dbl_radius_product = (qword)sq_dbl_x_radius * sq_dbl_y_radius;
|
||||
@ -2475,6 +2482,13 @@ void Draw_grad_inscribed_ellipse(short x1, short y1, short x2, short y2, short s
|
||||
dbl_center_y = top+bottom;
|
||||
dbl_x_radius = right-left+1;
|
||||
dbl_y_radius = bottom-top+1;
|
||||
if ((Selected_circle_ellipse_mode & MASK_CIRCLE_ELLIPSE) == MODE_CIRCLE)
|
||||
{
|
||||
if (dbl_x_radius > dbl_y_radius)
|
||||
dbl_x_radius = dbl_y_radius;
|
||||
else
|
||||
dbl_y_radius = dbl_x_radius;
|
||||
}
|
||||
sq_dbl_x_radius = (long)dbl_x_radius*dbl_x_radius;
|
||||
sq_dbl_y_radius = (long)dbl_y_radius*dbl_y_radius;
|
||||
sq_dbl_radius_product = (qword)sq_dbl_x_radius * sq_dbl_y_radius;
|
||||
|
||||
179
src/init.c
179
src/init.c
@ -820,21 +820,22 @@ void Load_Unicode_fonts(void)
|
||||
|
||||
// Action factice:
|
||||
|
||||
void Do_nothing(void)
|
||||
{}
|
||||
static void Do_nothing(int btn)
|
||||
{
|
||||
(void)btn;
|
||||
}
|
||||
|
||||
// Initialiseur d'un bouton:
|
||||
|
||||
static
|
||||
void Init_button(byte btn_number,
|
||||
const char* tooltip,
|
||||
word x_offset, word y_offset,
|
||||
word width, word height,
|
||||
byte shape,
|
||||
Func_action left_action,
|
||||
Func_action right_action,
|
||||
byte left_instant,
|
||||
byte right_instant,
|
||||
Func_action unselect_action,
|
||||
Func_btn_action left_action, Func_btn_action right_action,
|
||||
byte left_instant, byte right_instant,
|
||||
Func_btn_action unselect_action,
|
||||
byte family)
|
||||
{
|
||||
Buttons_Pool[btn_number].X_offset =x_offset;
|
||||
@ -990,22 +991,22 @@ void Init_buttons(void)
|
||||
FAMILY_TOOL);
|
||||
|
||||
Init_button(BUTTON_CIRCLES,
|
||||
"Empty circles / ellipses",
|
||||
"Empty circles / Toggle ",
|
||||
68,18,
|
||||
15,15,
|
||||
BUTTON_SHAPE_TRIANGLE_TOP_LEFT,
|
||||
Button_Empty_circle,Button_Empty_ellipse,
|
||||
0,0,
|
||||
Button_circle_ellipse,Button_Circle_switch_mode,
|
||||
0,1,
|
||||
Do_nothing,
|
||||
FAMILY_TOOL);
|
||||
|
||||
Init_button(BUTTON_FILLCIRC,
|
||||
"Filled circles / ellips.",
|
||||
"Filled circles / Toggle ",
|
||||
69,19,
|
||||
15,15,
|
||||
BUTTON_SHAPE_TRIANGLE_BOTTOM_RIGHT,
|
||||
Button_Filled_circle,Button_Filled_ellipse,
|
||||
0,0,
|
||||
Button_circle_ellipse,Button_Circle_switch_mode,
|
||||
0,1,
|
||||
Do_nothing,
|
||||
FAMILY_TOOL);
|
||||
|
||||
@ -1020,12 +1021,12 @@ void Init_buttons(void)
|
||||
FAMILY_TOOL);
|
||||
|
||||
Init_button(BUTTON_SPHERES,
|
||||
"Grad. spheres / ellipses",
|
||||
"Grad. spheres / Toggle. ",
|
||||
85,18,
|
||||
16,16,
|
||||
BUTTON_SHAPE_RECTANGLE,
|
||||
Button_Grad_circle,Button_Grad_ellipse,
|
||||
0,0,
|
||||
Button_circle_ellipse,Button_Circle_switch_mode,
|
||||
0,1,
|
||||
Do_nothing,
|
||||
FAMILY_TOOL);
|
||||
|
||||
@ -1547,48 +1548,92 @@ void Init_operations(void)
|
||||
Init_operation(OPERATION_FILLED_RECTANGLE,0,5,
|
||||
Filled_rectangle_0_5,HIDE_CURSOR,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE,1,0,
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE_CTR,1,0,
|
||||
Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE,2,0,
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE_CTR,2,0,
|
||||
Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE,1,5,
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE_CTR,1,5,
|
||||
Circle_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE,2,5,
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE_CTR,2,5,
|
||||
Circle_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE,0,5,
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE_CTR,0,5,
|
||||
Empty_circle_0_5,HIDE_CURSOR,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_FILLED_CIRCLE,1,0,
|
||||
Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_CIRCLE,2,0,
|
||||
Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_CIRCLE,1,5,
|
||||
Circle_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_CIRCLE,2,5,
|
||||
Circle_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_CIRCLE,0,5,
|
||||
Filled_circle_0_5,HIDE_CURSOR,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE,1,0,
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE_CRN,1,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE,2,0,
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE_CRN,2,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE,1,5,
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE_CRN,1,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE,2,5,
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE_CRN,2,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE,0,5,
|
||||
Init_operation(OPERATION_EMPTY_CIRCLE_CRN,0,5,
|
||||
Empty_ellipse_0_5,HIDE_CURSOR,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE,1,0,
|
||||
Init_operation(OPERATION_FILLED_CIRCLE_CTR,1,0,
|
||||
Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_CIRCLE_CTR,2,0,
|
||||
Circle_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_CIRCLE_CTR,1,5,
|
||||
Circle_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_CIRCLE_CTR,2,5,
|
||||
Circle_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_CIRCLE_CTR,0,5,
|
||||
Filled_circle_0_5,HIDE_CURSOR,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_FILLED_CIRCLE_CRN,1,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE,2,0,
|
||||
Init_operation(OPERATION_FILLED_CIRCLE_CRN,2,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE,1,5,
|
||||
Init_operation(OPERATION_FILLED_CIRCLE_CRN,1,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE,2,5,
|
||||
Init_operation(OPERATION_FILLED_CIRCLE_CRN,2,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE,0,5,
|
||||
Init_operation(OPERATION_FILLED_CIRCLE_CRN,0,5,
|
||||
Filled_ellipse_0_5,HIDE_CURSOR,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE_CTR,1,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE_CTR,2,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE_CTR,1,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE_CTR,2,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE_CTR,0,5,
|
||||
Empty_ellipse_0_5,HIDE_CURSOR,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE_CRN,1,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE_CRN,2,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE_CRN,1,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE_CRN,2,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_EMPTY_ELLIPSE_CRN,0,5,
|
||||
Empty_ellipse_0_5,HIDE_CURSOR,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE_CTR,1,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE_CTR,2,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE_CTR,1,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE_CTR,2,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE_CTR,0,5,
|
||||
Filled_ellipse_0_5,HIDE_CURSOR,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE_CRN,1,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE_CRN,2,0,
|
||||
Ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE_CRN,1,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE_CRN,2,5,
|
||||
Ellipse_12_5,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_FILLED_ELLIPSE_CRN,0,5,
|
||||
Filled_ellipse_0_5,HIDE_CURSOR,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_FILL,1,0,
|
||||
@ -1799,23 +1844,41 @@ void Init_operations(void)
|
||||
Init_operation(OPERATION_SCROLL,0,5,
|
||||
Scroll_0_5,HIDE_CURSOR,FAST_MOUSE);
|
||||
|
||||
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_CIRCLE_CTR,1,0,Grad_circle_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CTR,2,0,Grad_circle_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CTR,1,6,Grad_circle_12_6,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CTR,2,6,Grad_circle_12_6,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CTR,0,6,Grad_circle_0_6,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CTR,1,8,Grad_circle_12_8,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CTR,2,8,Grad_circle_12_8,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CTR,0,8,Grad_circle_or_ellipse_0_8,0,FAST_MOUSE);
|
||||
|
||||
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_CIRCLE_CRN,1,0,Grad_ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CRN,2,0,Grad_ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CRN,1,6,Grad_ellipse_12_6,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CRN,2,6,Grad_ellipse_12_6,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CRN,0,6,Grad_ellipse_0_6,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CRN,1,8,Grad_ellipse_12_8,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CRN,2,8,Grad_ellipse_12_8,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_CIRCLE_CRN,0,8,Grad_circle_or_ellipse_0_8,0,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CTR,1,0,Grad_ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CTR,2,0,Grad_ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CTR,1,6,Grad_ellipse_12_6,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CTR,2,6,Grad_ellipse_12_6,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CTR,0,6,Grad_ellipse_0_6,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CTR,1,8,Grad_ellipse_12_8,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CTR,2,8,Grad_ellipse_12_8,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CTR,0,8,Grad_circle_or_ellipse_0_8,0,FAST_MOUSE);
|
||||
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CRN,1,0,Grad_ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CRN,2,0,Grad_ellipse_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CRN,1,6,Grad_ellipse_12_6,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CRN,2,6,Grad_ellipse_12_6,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CRN,0,6,Grad_ellipse_0_6,HIDE_CURSOR,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CRN,1,8,Grad_ellipse_12_8,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CRN,2,8,Grad_ellipse_12_8,0,FAST_MOUSE);
|
||||
Init_operation(OPERATION_GRAD_ELLIPSE_CRN,0,8,Grad_circle_or_ellipse_0_8,0,FAST_MOUSE);
|
||||
|
||||
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);
|
||||
|
||||
131
src/operatio.c
131
src/operatio.c
@ -45,13 +45,6 @@
|
||||
#define M_PI 3.14159265358979323846
|
||||
#endif
|
||||
|
||||
/// when this macro is defined, the ellipses are inscribed in
|
||||
/// the rectangle of the mouse button press position and the
|
||||
/// release position.
|
||||
/// Otherwise, the mouse button press position is the center and
|
||||
/// the release postion defines the vertical and horizontal radiuses.
|
||||
#define INSCRIBED_ELLIPSE
|
||||
|
||||
/// Time (in SDL ticks) when the next airbrush drawing should be done. Also used
|
||||
/// for discontinuous freehand drawing.
|
||||
Uint32 Airbrush_next_time;
|
||||
@ -1179,10 +1172,8 @@ void Ellipse_12_5(void)
|
||||
short center_x;
|
||||
short center_y;
|
||||
short color;
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
short horizontal_radius;
|
||||
short vertical_radius;
|
||||
#endif
|
||||
|
||||
Operation_pop(&tangent_y);
|
||||
Operation_pop(&tangent_x);
|
||||
@ -1194,12 +1185,11 @@ void Ellipse_12_5(void)
|
||||
if ( (tangent_x!=Paintbrush_X) || (tangent_y!=Paintbrush_Y) )
|
||||
{
|
||||
Hide_cursor();
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
Cursor_shape=CURSOR_SHAPE_TARGET;
|
||||
#endif
|
||||
Display_coords_rel_or_abs(center_x,center_y);
|
||||
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
if ((Selected_circle_ellipse_mode & MASK_CENTER_CORNERS) == MODE_CENTER)
|
||||
{
|
||||
Cursor_shape=CURSOR_SHAPE_TARGET;
|
||||
horizontal_radius=(tangent_x>center_x)?tangent_x-center_x
|
||||
:center_x-tangent_x;
|
||||
vertical_radius =(tangent_y>center_y)?tangent_y-center_y
|
||||
@ -1211,10 +1201,12 @@ void Ellipse_12_5(void)
|
||||
vertical_radius =(Paintbrush_Y>center_y)?Paintbrush_Y-center_y
|
||||
:center_y-Paintbrush_Y;
|
||||
Draw_empty_ellipse_preview(center_x,center_y,horizontal_radius,vertical_radius,color);
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
Hide_empty_inscribed_ellipse_preview(center_x,center_y,tangent_x,tangent_y);
|
||||
Draw_empty_inscribed_ellipse_preview(center_x,center_y,Paintbrush_X,Paintbrush_Y,color);
|
||||
#endif
|
||||
}
|
||||
|
||||
Display_cursor();
|
||||
}
|
||||
@ -1241,10 +1233,8 @@ void Empty_ellipse_0_5(void)
|
||||
short center_x;
|
||||
short center_y;
|
||||
short color;
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
short horizontal_radius;
|
||||
short vertical_radius;
|
||||
#endif
|
||||
|
||||
Operation_pop(&tangent_y);
|
||||
Operation_pop(&tangent_x);
|
||||
@ -1252,23 +1242,22 @@ void Empty_ellipse_0_5(void)
|
||||
Operation_pop(¢er_x);
|
||||
Operation_pop(&color);
|
||||
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
if ((Selected_circle_ellipse_mode & MASK_CENTER_CORNERS) == MODE_CENTER)
|
||||
{
|
||||
horizontal_radius=(tangent_x>center_x)?tangent_x-center_x
|
||||
:center_x-tangent_x;
|
||||
vertical_radius =(tangent_y>center_y)?tangent_y-center_y
|
||||
:center_y-tangent_y;
|
||||
Hide_empty_ellipse_preview(center_x,center_y,horizontal_radius,vertical_radius);
|
||||
#else
|
||||
Hide_empty_inscribed_ellipse_preview(center_x,center_y,tangent_x,tangent_y);
|
||||
#endif
|
||||
|
||||
Paintbrush_shape=Paintbrush_shape_before_operation;
|
||||
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
Draw_empty_ellipse_permanent(center_x,center_y,horizontal_radius,vertical_radius,color);
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
Hide_empty_inscribed_ellipse_preview(center_x,center_y,tangent_x,tangent_y);
|
||||
Paintbrush_shape=Paintbrush_shape_before_operation;
|
||||
Draw_empty_inscribed_ellipse_permanent(center_x,center_y,tangent_x,tangent_y,color);
|
||||
#endif
|
||||
}
|
||||
|
||||
End_of_modification();
|
||||
|
||||
@ -1295,10 +1284,8 @@ void Filled_ellipse_0_5(void)
|
||||
short center_x;
|
||||
short center_y;
|
||||
short color;
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
short horizontal_radius;
|
||||
short vertical_radius;
|
||||
#endif
|
||||
|
||||
Operation_pop(&tangent_y);
|
||||
Operation_pop(&tangent_x);
|
||||
@ -1306,23 +1293,22 @@ void Filled_ellipse_0_5(void)
|
||||
Operation_pop(¢er_x);
|
||||
Operation_pop(&color);
|
||||
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
if ((Selected_circle_ellipse_mode & MASK_CENTER_CORNERS) == MODE_CENTER)
|
||||
{
|
||||
horizontal_radius=(tangent_x>center_x)?tangent_x-center_x
|
||||
:center_x-tangent_x;
|
||||
vertical_radius =(tangent_y>center_y)?tangent_y-center_y
|
||||
:center_y-tangent_y;
|
||||
Hide_empty_ellipse_preview(center_x,center_y,horizontal_radius,vertical_radius);
|
||||
#else
|
||||
Hide_empty_inscribed_ellipse_preview(center_x,center_y,tangent_x,tangent_y);
|
||||
#endif
|
||||
|
||||
Paintbrush_shape=Paintbrush_shape_before_operation;
|
||||
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
Draw_filled_ellipse(center_x,center_y,horizontal_radius,vertical_radius,color);
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
Hide_empty_inscribed_ellipse_preview(center_x,center_y,tangent_x,tangent_y);
|
||||
Paintbrush_shape=Paintbrush_shape_before_operation;
|
||||
Draw_filled_inscribed_ellipse(center_x,center_y,tangent_x,tangent_y,color);
|
||||
#endif
|
||||
}
|
||||
|
||||
End_of_modification();
|
||||
if ( (Config.Coords_rel) && (Menu_is_visible) )
|
||||
@ -3272,10 +3258,8 @@ void Grad_ellipse_12_6(void)
|
||||
short center_x;
|
||||
short center_y;
|
||||
short color;
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
short horizontal_radius;
|
||||
short vertical_radius;
|
||||
#endif
|
||||
|
||||
Operation_pop(&tangent_y);
|
||||
Operation_pop(&tangent_x);
|
||||
@ -3286,12 +3270,11 @@ void Grad_ellipse_12_6(void)
|
||||
if ( (tangent_x!=Paintbrush_X) || (tangent_y!=Paintbrush_Y) )
|
||||
{
|
||||
Hide_cursor();
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
Cursor_shape=CURSOR_SHAPE_TARGET;
|
||||
#endif
|
||||
Display_coords_rel_or_abs(center_x,center_y);
|
||||
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
if ((Selected_circle_ellipse_mode & MASK_CENTER_CORNERS) == MODE_CENTER)
|
||||
{
|
||||
Cursor_shape=CURSOR_SHAPE_TARGET;
|
||||
horizontal_radius=(tangent_x>center_x)?tangent_x-center_x
|
||||
:center_x-tangent_x;
|
||||
vertical_radius =(tangent_y>center_y)?tangent_y-center_y
|
||||
@ -3303,10 +3286,12 @@ void Grad_ellipse_12_6(void)
|
||||
vertical_radius =(Paintbrush_Y>center_y)?Paintbrush_Y-center_y
|
||||
:center_y-Paintbrush_Y;
|
||||
Draw_empty_ellipse_preview(center_x,center_y,horizontal_radius,vertical_radius,color);
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
Hide_empty_inscribed_ellipse_preview(center_x,center_y,tangent_x,tangent_y);
|
||||
Draw_empty_inscribed_ellipse_preview(center_x,center_y,Paintbrush_X,Paintbrush_Y,color);
|
||||
#endif
|
||||
}
|
||||
|
||||
Display_cursor();
|
||||
}
|
||||
@ -3335,10 +3320,8 @@ void Grad_ellipse_0_6(void)
|
||||
short color;
|
||||
short click;
|
||||
//short radius;
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
short horizontal_radius;
|
||||
short vertical_radius;
|
||||
#endif
|
||||
|
||||
Operation_pop(&tangent_y);
|
||||
Operation_pop(&tangent_x);
|
||||
@ -3365,11 +3348,10 @@ void Grad_ellipse_0_6(void)
|
||||
Cursor_shape=CURSOR_SHAPE_XOR_TARGET;
|
||||
|
||||
// On affiche une croix XOR au centre du cercle
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
if ((Selected_circle_ellipse_mode & MASK_CENTER_CORNERS) == MODE_CENTER)
|
||||
Draw_curve_cross(center_x,center_y);
|
||||
#else
|
||||
else
|
||||
Draw_curve_cross((center_x+tangent_x)/2, (center_y+tangent_y)/2);
|
||||
#endif
|
||||
|
||||
if (Menu_is_visible)
|
||||
{
|
||||
@ -3382,24 +3364,23 @@ void Grad_ellipse_0_6(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
Paintbrush_hidden=Paintbrush_hidden_before_scroll;
|
||||
Cursor_shape=CURSOR_SHAPE_TARGET;
|
||||
|
||||
if ((Selected_circle_ellipse_mode & MASK_CENTER_CORNERS) == MODE_CENTER)
|
||||
{
|
||||
horizontal_radius=(tangent_x>center_x)?tangent_x-center_x
|
||||
:center_x-tangent_x;
|
||||
vertical_radius =(tangent_y>center_y)?tangent_y-center_y
|
||||
:center_y-tangent_y;
|
||||
Hide_empty_ellipse_preview(center_x,center_y,horizontal_radius,vertical_radius);
|
||||
#else
|
||||
Hide_empty_inscribed_ellipse_preview(center_x,center_y,tangent_x,tangent_y);
|
||||
#endif
|
||||
|
||||
Paintbrush_hidden=Paintbrush_hidden_before_scroll;
|
||||
Cursor_shape=CURSOR_SHAPE_TARGET;
|
||||
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
Draw_filled_ellipse(center_x,center_y,horizontal_radius,vertical_radius,Back_color);
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
Hide_empty_inscribed_ellipse_preview(center_x,center_y,tangent_x,tangent_y);
|
||||
Draw_filled_inscribed_ellipse(center_x,center_y,tangent_x,tangent_y,Back_color);
|
||||
#endif
|
||||
}
|
||||
|
||||
End_of_modification();
|
||||
if ((Config.Coords_rel) && (Menu_is_visible))
|
||||
@ -3425,10 +3406,8 @@ void Grad_ellipse_12_8(void)
|
||||
short center_x;
|
||||
short center_y;
|
||||
short color;
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
short horizontal_radius;
|
||||
short vertical_radius;
|
||||
#endif
|
||||
short horizontal_radius=0;
|
||||
short vertical_radius=0;
|
||||
short old_mouse_k;
|
||||
|
||||
Operation_stack_size-=2; // On fait sauter les 2 derniers élts de la pile
|
||||
@ -3441,31 +3420,31 @@ void Grad_ellipse_12_8(void)
|
||||
|
||||
Hide_cursor();
|
||||
// On efface la croix XOR au centre de l'ellipse
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
if ((Selected_circle_ellipse_mode & MASK_CENTER_CORNERS) == MODE_CENTER)
|
||||
{
|
||||
Draw_curve_cross(center_x,center_y);
|
||||
#else
|
||||
Draw_curve_cross((center_x+tangent_x)/2, (center_y+tangent_y)/2);
|
||||
#endif
|
||||
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
horizontal_radius=(tangent_x>center_x)?tangent_x-center_x
|
||||
:center_x-tangent_x;
|
||||
vertical_radius =(tangent_y>center_y)?tangent_y-center_y
|
||||
:center_y-tangent_y;
|
||||
Hide_empty_ellipse_preview(center_x,center_y,horizontal_radius,vertical_radius);
|
||||
#else
|
||||
}
|
||||
else
|
||||
{
|
||||
Draw_curve_cross((center_x+tangent_x)/2, (center_y+tangent_y)/2);
|
||||
Hide_empty_inscribed_ellipse_preview(center_x,center_y,tangent_x,tangent_y);
|
||||
#endif
|
||||
}
|
||||
|
||||
Paintbrush_hidden=Paintbrush_hidden_before_scroll;
|
||||
Cursor_shape=CURSOR_SHAPE_XOR_TARGET;
|
||||
|
||||
if (Mouse_K==old_mouse_k)
|
||||
#ifndef INSCRIBED_ELLIPSE
|
||||
{
|
||||
if ((Selected_circle_ellipse_mode & MASK_CENTER_CORNERS) == MODE_CENTER)
|
||||
Draw_grad_ellipse(center_x,center_y,horizontal_radius,vertical_radius,Paintbrush_X,Paintbrush_Y);
|
||||
#else
|
||||
else
|
||||
Draw_grad_inscribed_ellipse(center_x,center_y,tangent_x,tangent_y,Paintbrush_X,Paintbrush_Y);
|
||||
#endif
|
||||
}
|
||||
|
||||
Display_cursor();
|
||||
End_of_modification();
|
||||
|
||||
@ -59,7 +59,8 @@ typedef uint64_t qword;
|
||||
|
||||
// Named function prototypes
|
||||
// GrafX2 use a lot of function pointer to do the drawing depending in the "fake hardware zoom" and the magnifier status.
|
||||
typedef void (* Func_action) (void); ///< An action. Used when you click a menu button or trigger a keyboard shortcut.
|
||||
typedef void (* Func_action) (void); ///< An action.
|
||||
typedef void (* Func_btn_action) (int); ///< An action. Used when you click a menu button or trigger a keyboard shortcut.
|
||||
typedef void (* Func_pixel) (word,word,byte); ///< Set pixel at position (x,y) to color c. Used in load screen to write the data to brush, picture, or preview area.
|
||||
typedef byte (* Func_read) (word,word); ///< Read a pixel at position (x,y) on something. Used for example in save to tell if the data is a brush or a picture
|
||||
typedef void (* Func_clear) (byte);
|
||||
|
||||
@ -130,8 +130,8 @@ typedef struct
|
||||
signed char Icon; ///< Which icon to display: Either the one from the toolbar (-1) or one of ::MENU_SPRITE
|
||||
|
||||
// Triggers on mouse/keyboard
|
||||
Func_action Left_action; ///< Action triggered by a left mouseclick on the button
|
||||
Func_action Right_action; ///< Action triggered by a right mouseclick on the button
|
||||
Func_btn_action Left_action; ///< Action triggered by a left mouseclick on the button
|
||||
Func_btn_action Right_action; ///< Action triggered by a right mouseclick on the button
|
||||
word Left_shortcut[2]; ///< Keyboard shortcut for a left mouseclick
|
||||
word Right_shortcut[2];///< Keyboard shortcut for a right mouseclick
|
||||
byte Left_instant; ///< Will not wait for mouse release before triggering action
|
||||
@ -139,7 +139,7 @@ typedef struct
|
||||
const char * Tooltip; ///< Text in status bar when button is hovered
|
||||
|
||||
// Data used when the button is unselected
|
||||
Func_action Unselect_action; ///< Action triggered by unselecting the button
|
||||
Func_btn_action Unselect_action; ///< Action triggered by unselecting the button
|
||||
byte Family; ///< enum ::FAMILY_OF_BUTTONS.
|
||||
|
||||
} T_Toolbar_button;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user