(layers branch) Adjust tool implemented. Left click and drag to move a single layer, Right-click and drag to move everything.
git-svn-id: svn://pulkomandy.tk/GrafX2/branches/layers@1041 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
cedb706326
commit
78e59e6127
12
init.c
12
init.c
@ -1585,12 +1585,12 @@ void Init_operations(void)
|
|||||||
Scroll_12_0,HIDE_CURSOR,FAST_MOUSE);
|
Scroll_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||||
Init_operation(OPERATION_SCROLL,2,0,
|
Init_operation(OPERATION_SCROLL,2,0,
|
||||||
Scroll_12_0,HIDE_CURSOR,FAST_MOUSE);
|
Scroll_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||||
Init_operation(OPERATION_SCROLL,1,4,
|
Init_operation(OPERATION_SCROLL,1,5,
|
||||||
Scroll_12_4,0,FAST_MOUSE);
|
Scroll_12_5,0,FAST_MOUSE);
|
||||||
Init_operation(OPERATION_SCROLL,2,4,
|
Init_operation(OPERATION_SCROLL,2,5,
|
||||||
Scroll_12_4,0,FAST_MOUSE);
|
Scroll_12_5,0,FAST_MOUSE);
|
||||||
Init_operation(OPERATION_SCROLL,0,4,
|
Init_operation(OPERATION_SCROLL,0,5,
|
||||||
Scroll_0_4,HIDE_CURSOR,FAST_MOUSE);
|
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,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,2,0,Grad_circle_12_0,HIDE_CURSOR,FAST_MOUSE);
|
||||||
|
|||||||
32
misc.c
32
misc.c
@ -685,33 +685,33 @@ void Slider_timer(byte speed)
|
|||||||
} while (Mouse_K == original_mouse_k && SDL_GetTicks()<end);
|
} while (Mouse_K == original_mouse_k && SDL_GetTicks()<end);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scroll_picture(short x_offset,short y_offset)
|
void Scroll_picture(byte * main_src, byte * main_dest, short x_offset,short y_offset)
|
||||||
{
|
{
|
||||||
byte* esi = Screen_backup; //source de la copie
|
byte* src = main_src; //source de la copie
|
||||||
byte* edi = Main_screen + y_offset * Main_image_width + x_offset;
|
byte* dest = main_dest + y_offset * Main_image_width + x_offset;
|
||||||
const word ax = Main_image_width - x_offset; // Nombre de pixels à copier à droite
|
const word length = Main_image_width - x_offset; // Nombre de pixels à copier à droite
|
||||||
word dx;
|
word y;
|
||||||
for(dx = Main_image_height - y_offset;dx>0;dx--)
|
for(y = Main_image_height - y_offset;y>0;y--)
|
||||||
{
|
{
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
memcpy(edi,esi,ax);
|
memcpy(dest,src,length);
|
||||||
memcpy(edi - x_offset,esi+ax,x_offset);
|
memcpy(dest - x_offset,src+length,x_offset);
|
||||||
|
|
||||||
// On passe à la ligne suivante
|
// On passe à la ligne suivante
|
||||||
edi += Main_image_width;
|
dest += Main_image_width;
|
||||||
esi += Main_image_width;
|
src += Main_image_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
// On vient de faire le traitement pour otutes les lignes au-dessous de y_offset
|
// On vient de faire le traitement pour otutes les lignes au-dessous de y_offset
|
||||||
// Maintenant on traite celles au dessus
|
// Maintenant on traite celles au dessus
|
||||||
edi = x_offset + Main_screen;
|
dest = x_offset + main_dest;
|
||||||
for(dx = y_offset;dx>0;dx--)
|
for(y = y_offset;y>0;y--)
|
||||||
{
|
{
|
||||||
memcpy(edi,esi,ax);
|
memcpy(dest,src,length);
|
||||||
memcpy(edi - x_offset,esi+ax,x_offset);
|
memcpy(dest - x_offset,src+length,x_offset);
|
||||||
|
|
||||||
edi += Main_image_width;
|
dest += Main_image_width;
|
||||||
esi += Main_image_width;
|
src += Main_image_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
Update_rect(0,0,0,0);
|
Update_rect(0,0,0,0);
|
||||||
|
|||||||
2
misc.h
2
misc.h
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
void Copy_image_to_brush(short start_x,short start_y,short Brush_width,short Brush_height,word image_width);
|
void Copy_image_to_brush(short start_x,short start_y,short Brush_width,short Brush_height,word image_width);
|
||||||
void Remap_general_lowlevel(byte * conversion_table,byte * buffer,short width,short height,short buffer_width);
|
void Remap_general_lowlevel(byte * conversion_table,byte * buffer,short width,short height,short buffer_width);
|
||||||
void Scroll_picture(short x_offset,short y_offset);
|
void Scroll_picture(byte * main_src, byte * main_dest, short x_offset,short y_offset);
|
||||||
void Wait_end_of_click(void);
|
void Wait_end_of_click(void);
|
||||||
void Set_color(byte color, byte red, byte green, byte blue);
|
void Set_color(byte color, byte red, byte green, byte blue);
|
||||||
void Set_palette(T_Palette palette);
|
void Set_palette(T_Palette palette);
|
||||||
|
|||||||
67
operatio.c
67
operatio.c
@ -3914,6 +3914,8 @@ void Scroll_12_0(void)
|
|||||||
Operation_push(Paintbrush_Y);
|
Operation_push(Paintbrush_Y);
|
||||||
Operation_push(Paintbrush_X);
|
Operation_push(Paintbrush_X);
|
||||||
Operation_push(Paintbrush_Y);
|
Operation_push(Paintbrush_Y);
|
||||||
|
Operation_push(Mouse_K); // LEFT_SIDE or RIGHT_SIDE
|
||||||
|
|
||||||
Cursor_hidden_before_scroll=Cursor_hidden;
|
Cursor_hidden_before_scroll=Cursor_hidden;
|
||||||
Cursor_hidden=1;
|
Cursor_hidden=1;
|
||||||
if ((Config.Coords_rel) && (Menu_is_visible))
|
if ((Config.Coords_rel) && (Menu_is_visible))
|
||||||
@ -3921,11 +3923,11 @@ void Scroll_12_0(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Scroll_12_4(void)
|
void Scroll_12_5(void)
|
||||||
//
|
//
|
||||||
// Opération : OPERATION_SCROLL
|
// Opération : OPERATION_SCROLL
|
||||||
// Click Souris: 1 ou 2
|
// Click Souris: 1 ou 2
|
||||||
// Taille_Pile : 4
|
// Taille_Pile : 5
|
||||||
//
|
//
|
||||||
// Souris effacée: Non
|
// Souris effacée: Non
|
||||||
//
|
//
|
||||||
@ -3936,8 +3938,10 @@ void Scroll_12_4(void)
|
|||||||
short y_pos;
|
short y_pos;
|
||||||
short x_offset;
|
short x_offset;
|
||||||
short y_offset;
|
short y_offset;
|
||||||
|
short side;
|
||||||
//char str[5];
|
//char str[5];
|
||||||
|
|
||||||
|
Operation_pop(&side);
|
||||||
Operation_pop(&y_pos);
|
Operation_pop(&y_pos);
|
||||||
Operation_pop(&x_pos);
|
Operation_pop(&x_pos);
|
||||||
Operation_pop(¢er_y);
|
Operation_pop(¢er_y);
|
||||||
@ -3959,7 +3963,17 @@ void Scroll_12_4(void)
|
|||||||
|
|
||||||
Display_coords_rel_or_abs(center_x,center_y);
|
Display_coords_rel_or_abs(center_x,center_y);
|
||||||
|
|
||||||
Scroll_picture(x_offset,y_offset);
|
if (side == RIGHT_SIDE)
|
||||||
|
{
|
||||||
|
// All layers at once
|
||||||
|
Scroll_picture(Screen_backup, Main_screen, x_offset,y_offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// One layer at once
|
||||||
|
Scroll_picture(Main_backups->Pages->Next->Image[Main_current_layer], Main_backups->Pages->Image[Main_current_layer], x_offset, y_offset);
|
||||||
|
Redraw_layered_image();
|
||||||
|
}
|
||||||
|
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
}
|
}
|
||||||
@ -3968,19 +3982,60 @@ void Scroll_12_4(void)
|
|||||||
Operation_push(center_y);
|
Operation_push(center_y);
|
||||||
Operation_push(Paintbrush_X);
|
Operation_push(Paintbrush_X);
|
||||||
Operation_push(Paintbrush_Y);
|
Operation_push(Paintbrush_Y);
|
||||||
|
Operation_push(side);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scroll_0_4(void)
|
void Scroll_0_5(void)
|
||||||
//
|
//
|
||||||
// Opération : OPERATION_SCROLL
|
// Opération : OPERATION_SCROLL
|
||||||
// Click Souris: 0
|
// Click Souris: 0
|
||||||
// Taille_Pile : 4
|
// Taille_Pile : 5
|
||||||
//
|
//
|
||||||
// Souris effacée: Oui
|
// Souris effacée: Oui
|
||||||
//
|
//
|
||||||
{
|
{
|
||||||
Operation_stack_size-=4;
|
// All layers at once
|
||||||
|
short center_x;
|
||||||
|
short center_y;
|
||||||
|
short x_pos;
|
||||||
|
short y_pos;
|
||||||
|
short x_offset;
|
||||||
|
short y_offset;
|
||||||
|
short side;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
|
||||||
|
Operation_pop(&side);
|
||||||
|
Operation_pop(&y_pos);
|
||||||
|
Operation_pop(&x_pos);
|
||||||
|
Operation_pop(¢er_y);
|
||||||
|
Operation_pop(¢er_x);
|
||||||
|
|
||||||
|
if (side == RIGHT_SIDE)
|
||||||
|
{
|
||||||
|
// All layers at once
|
||||||
|
if (x_pos>=center_x)
|
||||||
|
x_offset=(x_pos-center_x)%Main_image_width;
|
||||||
|
else
|
||||||
|
x_offset=Main_image_width-((center_x-x_pos)%Main_image_width);
|
||||||
|
|
||||||
|
if (y_pos>=center_y)
|
||||||
|
y_offset=(y_pos-center_y)%Main_image_height;
|
||||||
|
else
|
||||||
|
y_offset=Main_image_height-((center_y-y_pos)%Main_image_height);
|
||||||
|
|
||||||
|
|
||||||
|
// Do the actual scroll operation on all layers.
|
||||||
|
for (i=0; i<NB_LAYERS; i++)
|
||||||
|
Scroll_picture(Main_backups->Pages->Next->Image[i], Main_backups->Pages->Image[i], x_offset, y_offset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// One layer : everything was done while dragging the mouse
|
||||||
|
}
|
||||||
|
|
||||||
Cursor_hidden=Cursor_hidden_before_scroll;
|
Cursor_hidden=Cursor_hidden_before_scroll;
|
||||||
|
|
||||||
End_of_modification();
|
End_of_modification();
|
||||||
if ((Config.Coords_rel) && (Menu_is_visible))
|
if ((Config.Coords_rel) && (Menu_is_visible))
|
||||||
{
|
{
|
||||||
|
|||||||
@ -181,8 +181,8 @@ void Filled_contour_0_8(void);
|
|||||||
//////////////////////////////////////////////////////////// OPERATION_SCROLL
|
//////////////////////////////////////////////////////////// OPERATION_SCROLL
|
||||||
|
|
||||||
void Scroll_12_0(void);
|
void Scroll_12_0(void);
|
||||||
void Scroll_12_4(void);
|
void Scroll_12_5(void);
|
||||||
void Scroll_0_4(void);
|
void Scroll_0_5(void);
|
||||||
|
|
||||||
//////////////////////////////////////////////////// OPERATION_GRAD_CIRCLE
|
//////////////////////////////////////////////////// OPERATION_GRAD_CIRCLE
|
||||||
|
|
||||||
|
|||||||
4
pages.c
4
pages.c
@ -735,7 +735,7 @@ void Exchange_main_and_spare(void)
|
|||||||
|
|
||||||
void End_of_modification(void)
|
void End_of_modification(void)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
Update_visible_page_buffer(1, Main_image_width, Main_image_height);
|
Update_visible_page_buffer(1, Main_image_width, Main_image_height);
|
||||||
memcpy(Visible_image[1].Image,
|
memcpy(Visible_image[1].Image,
|
||||||
Visible_image[0].Image,
|
Visible_image[0].Image,
|
||||||
@ -744,7 +744,7 @@ void End_of_modification(void)
|
|||||||
Main_screen=Visible_image[0].Image;
|
Main_screen=Visible_image[0].Image;
|
||||||
|
|
||||||
Download_infos_backup(Main_backups);
|
Download_infos_backup(Main_backups);
|
||||||
|
/*
|
||||||
Last_backed_up_layers = 0;
|
Last_backed_up_layers = 0;
|
||||||
Backup();
|
Backup();
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user