Fix a crash that happened in Palette screen when right-clicking near top of screen: it opened the 'Copy/Paste' dropdown outside of screen edge. Now this dropdown menu only appears when you click in the palette area
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1938 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
2e5b97eb41
commit
a137e063f0
38
src/engine.c
38
src/engine.c
@ -597,7 +597,7 @@ void Layer_preview_on(int * preview_is_visible)
|
|||||||
}
|
}
|
||||||
|
|
||||||
Open_popup((Buttons_Pool[BUTTON_LAYER_SELECT].X_offset + 2)*Menu_factor_X,
|
Open_popup((Buttons_Pool[BUTTON_LAYER_SELECT].X_offset + 2)*Menu_factor_X,
|
||||||
Menu_Y - previewH * Menu_factor_Y, Buttons_Pool[BUTTON_LAYER_SELECT].Width, previewH);
|
Menu_Y - previewH * Menu_factor_Y, Buttons_Pool[BUTTON_LAYER_SELECT].Width, previewH);
|
||||||
*preview_is_visible = 1;
|
*preview_is_visible = 1;
|
||||||
|
|
||||||
// Make the system think the menu is visible (Open_popup hides it)
|
// Make the system think the menu is visible (Open_popup hides it)
|
||||||
@ -622,11 +622,11 @@ void Layer_preview_on(int * preview_is_visible)
|
|||||||
for (y = 0; y < previewH*Pixel_height*Menu_factor_Y; y++)
|
for (y = 0; y < previewH*Pixel_height*Menu_factor_Y; y++)
|
||||||
for (x = 0; x < previewW*Pixel_width*Menu_factor_X; x++)
|
for (x = 0; x < previewW*Pixel_width*Menu_factor_X; x++)
|
||||||
{
|
{
|
||||||
int imgx = x * Main_image_width / previewW/Pixel_width/Menu_factor_X;
|
int imgx = x * Main_image_width / previewW/Pixel_width/Menu_factor_X;
|
||||||
int imgy = y * Main_image_height / previewH/Pixel_height/Menu_factor_Y;
|
int imgy = y * Main_image_height / previewH/Pixel_height/Menu_factor_Y;
|
||||||
// Use Pixel_simple() in order to get highest resolution
|
// Use Pixel_simple() in order to get highest resolution
|
||||||
Pixel_simple(x+((layer*Layer_button_width+offset)*Menu_factor_X+Window_pos_X)*Pixel_width, y+Window_pos_Y*Pixel_height, *(Main_backups->Pages->Image[layer].Pixels
|
Pixel_simple(x+((layer*Layer_button_width+offset)*Menu_factor_X+Window_pos_X)*Pixel_width, y+Window_pos_Y*Pixel_height, *(Main_backups->Pages->Image[layer].Pixels
|
||||||
+ imgx + imgy * Main_image_width));
|
+ imgx + imgy * Main_image_width));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Update_window_area(0,0,Window_width, Window_height);
|
Update_window_area(0,0,Window_width, Window_height);
|
||||||
@ -1443,11 +1443,11 @@ void Main_handler(void)
|
|||||||
Update_rect(18*Menu_factor_X,Menu_status_Y,192*Menu_factor_X,Menu_factor_Y<<3);
|
Update_rect(18*Menu_factor_X,Menu_status_Y,192*Menu_factor_X,Menu_factor_Y<<3);
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
|
|
||||||
// If we get here, we mayjust have left the layerbar (towards the
|
// If we get here, we mayjust have left the layerbar (towards the
|
||||||
// main menu or statusbar). If so, close the popup.
|
// main menu or statusbar). If so, close the popup.
|
||||||
Layer_preview_off(&preview_is_visible);
|
Layer_preview_off(&preview_is_visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ( (prev_button_number!=BUTTON_CHOOSE_COL)
|
if ( (prev_button_number!=BUTTON_CHOOSE_COL)
|
||||||
@ -1465,11 +1465,11 @@ void Main_handler(void)
|
|||||||
|
|
||||||
if (button_index == BUTTON_LAYER_SELECT)
|
if (button_index == BUTTON_LAYER_SELECT)
|
||||||
{
|
{
|
||||||
Layer_preview_on(&preview_is_visible);
|
Layer_preview_on(&preview_is_visible);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Layer_preview_off(&preview_is_visible);
|
Layer_preview_off(&preview_is_visible);
|
||||||
}
|
}
|
||||||
|
|
||||||
Print_in_menu(Buttons_Pool[button_index].Tooltip,0);
|
Print_in_menu(Buttons_Pool[button_index].Tooltip,0);
|
||||||
@ -1500,9 +1500,9 @@ void Main_handler(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we get here, we mayjust have left the layerbar (towards the
|
// If we get here, we mayjust have left the layerbar (towards the
|
||||||
// main menu or statusbar). If so, close the popup.
|
// main menu or statusbar). If so, close the popup.
|
||||||
Layer_preview_off(&preview_is_visible);
|
Layer_preview_off(&preview_is_visible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1227,7 +1227,23 @@ void Button_Palette(void)
|
|||||||
{
|
{
|
||||||
Hide_cursor();
|
Hide_cursor();
|
||||||
temp_color=(clicked_button==1) ? Window_attribute2 : Read_pixel(Mouse_X,Mouse_Y);
|
temp_color=(clicked_button==1) ? Window_attribute2 : Read_pixel(Mouse_X,Mouse_Y);
|
||||||
if (Mouse_K==RIGHT_SIDE)
|
// Right click outside the window
|
||||||
|
if (Mouse_K==RIGHT_SIDE && clicked_button==-1)
|
||||||
|
{
|
||||||
|
if (Back_color!=temp_color)
|
||||||
|
{
|
||||||
|
Back_color=temp_color;
|
||||||
|
// 4 blocks de back_color entourant la fore_color
|
||||||
|
Window_rectangle(BGCOLOR_DISPLAY_X,BGCOLOR_DISPLAY_Y,BGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_Y-BGCOLOR_DISPLAY_Y,Back_color);
|
||||||
|
Window_rectangle(BGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y+FGCOLOR_DISPLAY_H,BGCOLOR_DISPLAY_W,BGCOLOR_DISPLAY_Y+BGCOLOR_DISPLAY_H-FGCOLOR_DISPLAY_Y-FGCOLOR_DISPLAY_H,Back_color);
|
||||||
|
Window_rectangle(BGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_Y,FGCOLOR_DISPLAY_X-BGCOLOR_DISPLAY_X,FGCOLOR_DISPLAY_H,Back_color);
|
||||||
|
Window_rectangle(FGCOLOR_DISPLAY_X+FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_Y,BGCOLOR_DISPLAY_X+BGCOLOR_DISPLAY_W-FGCOLOR_DISPLAY_X-FGCOLOR_DISPLAY_W,FGCOLOR_DISPLAY_H,Back_color);
|
||||||
|
Update_window_area(BGCOLOR_DISPLAY_X,BGCOLOR_DISPLAY_Y,BGCOLOR_DISPLAY_W,BGCOLOR_DISPLAY_H);
|
||||||
|
}
|
||||||
|
Display_cursor();
|
||||||
|
}
|
||||||
|
// Right-click inside the palette
|
||||||
|
else if (Mouse_K==RIGHT_SIDE)
|
||||||
{
|
{
|
||||||
// Contextual menu
|
// Contextual menu
|
||||||
T_Dropdown_button dropdown;
|
T_Dropdown_button dropdown;
|
||||||
@ -1291,8 +1307,6 @@ void Button_Palette(void)
|
|||||||
{
|
{
|
||||||
Display_cursor();
|
Display_cursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Window_dropdown_clear_items(&dropdown);
|
Window_dropdown_clear_items(&dropdown);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user