Magnifier: Both views positions are preserved on switching to Spare and back. Changing zoom with dropdown menu doesn't accidentally zoom on mouse
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1298 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
051f5e60cf
commit
e96be96ce1
11
buttons.c
11
buttons.c
@ -1309,7 +1309,14 @@ void Button_Page(void)
|
|||||||
|
|
||||||
// A la fin, on affiche l'écran
|
// A la fin, on affiche l'écran
|
||||||
for (factor_index=0; ZOOM_FACTOR[factor_index]!=Main_magnifier_factor; factor_index++);
|
for (factor_index=0; ZOOM_FACTOR[factor_index]!=Main_magnifier_factor; factor_index++);
|
||||||
Change_magnifier_factor(factor_index);
|
//Change_magnifier_factor(factor_index,0);
|
||||||
|
Compute_magnifier_data();
|
||||||
|
if (Main_magnifier_mode)
|
||||||
|
Pixel_preview=Pixel_preview_magnifier;
|
||||||
|
else
|
||||||
|
Pixel_preview=Pixel_preview_normal;
|
||||||
|
Compute_limits();
|
||||||
|
Compute_paintbrush_coordinates();
|
||||||
|
|
||||||
Set_palette(Main_palette);
|
Set_palette(Main_palette);
|
||||||
Compute_optimal_menu_colors(Main_palette);
|
Compute_optimal_menu_colors(Main_palette);
|
||||||
@ -3325,7 +3332,7 @@ void Button_Magnify_menu(void)
|
|||||||
|
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
Change_magnifier_factor(item->Number);
|
Change_magnifier_factor(item->Number,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( (!item) && (!Main_magnifier_mode) && (Current_operation!=OPERATION_MAGNIFY) ) // Cancel
|
if ( (!item) && (!Main_magnifier_mode) && (Current_operation!=OPERATION_MAGNIFY) ) // Cancel
|
||||||
|
|||||||
@ -390,7 +390,7 @@ void Zoom(short delta)
|
|||||||
if ( (index>=0) && (index<NB_ZOOM_FACTORS) )
|
if ( (index>=0) && (index<NB_ZOOM_FACTORS) )
|
||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
Change_magnifier_factor(index);
|
Change_magnifier_factor(index,1);
|
||||||
if (Main_magnifier_mode)
|
if (Main_magnifier_mode)
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
@ -411,7 +411,7 @@ void Zoom_set(int index)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Change_magnifier_factor(index);
|
Change_magnifier_factor(index,1);
|
||||||
if (!Main_magnifier_mode)
|
if (!Main_magnifier_mode)
|
||||||
Select_button(BUTTON_MAGNIFIER,1);
|
Select_button(BUTTON_MAGNIFIER,1);
|
||||||
Display_all_screen();
|
Display_all_screen();
|
||||||
|
|||||||
@ -1777,18 +1777,18 @@ void Compute_magnifier_data(void)
|
|||||||
|
|
||||||
|
|
||||||
/// Changes magnifier factor and updates everything needed
|
/// Changes magnifier factor and updates everything needed
|
||||||
void Change_magnifier_factor(byte factor_index)
|
void Change_magnifier_factor(byte factor_index, byte point_at_mouse)
|
||||||
{
|
{
|
||||||
int target_x,target_y; // These coordinates are in image space
|
int target_x,target_y; // These coordinates are in image space
|
||||||
byte point_at_mouse=0;
|
|
||||||
byte magnified_view_leads=1;
|
byte magnified_view_leads=1;
|
||||||
|
|
||||||
// Values that need to be computed before switching to the new zoom factor
|
// Values that need to be computed before switching to the new zoom factor
|
||||||
if (Cursor_in_menu || !Main_magnifier_mode)
|
if (!point_at_mouse || Cursor_in_menu || !Main_magnifier_mode)
|
||||||
{
|
{
|
||||||
// Locate the pixel in center of the magnified area
|
// Locate the pixel in center of the magnified area
|
||||||
target_x = Main_magnifier_offset_X + (Main_magnifier_width >> 1);
|
target_x = Main_magnifier_offset_X + (Main_magnifier_width >> 1);
|
||||||
target_y = Main_magnifier_offset_Y + (Main_magnifier_height >> 1);
|
target_y = Main_magnifier_offset_Y + (Main_magnifier_height >> 1);
|
||||||
|
point_at_mouse=0;
|
||||||
}
|
}
|
||||||
else if (Mouse_X>=Main_X_zoom)
|
else if (Mouse_X>=Main_X_zoom)
|
||||||
{
|
{
|
||||||
@ -1803,6 +1803,7 @@ void Change_magnifier_factor(byte factor_index)
|
|||||||
target_x=Mouse_X+Main_offset_X;
|
target_x=Mouse_X+Main_offset_X;
|
||||||
target_y=Mouse_Y+Main_offset_Y;
|
target_y=Mouse_Y+Main_offset_Y;
|
||||||
magnified_view_leads=0;
|
magnified_view_leads=0;
|
||||||
|
point_at_mouse=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Main_magnifier_factor=ZOOM_FACTOR[factor_index];
|
Main_magnifier_factor=ZOOM_FACTOR[factor_index];
|
||||||
|
|||||||
@ -102,7 +102,7 @@ byte Best_color_nonexcluded(byte red,byte green,byte blue);
|
|||||||
void Horizontal_XOR_line_zoom(short x_pos, short y_pos, short width);
|
void Horizontal_XOR_line_zoom(short x_pos, short y_pos, short width);
|
||||||
void Vertical_XOR_line_zoom(short x_pos, short y_pos, short height);
|
void Vertical_XOR_line_zoom(short x_pos, short y_pos, short height);
|
||||||
|
|
||||||
void Change_magnifier_factor(byte factor_index);
|
void Change_magnifier_factor(byte factor_index, byte point_at_mouse);
|
||||||
|
|
||||||
/// Width of one layer button, in pixels before scaling
|
/// Width of one layer button, in pixels before scaling
|
||||||
extern word Layer_button_width;
|
extern word Layer_button_width;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user