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:
Yves Rizoud 2012-03-25 14:44:29 +00:00
parent 2e5b97eb41
commit a137e063f0
2 changed files with 36 additions and 22 deletions

View File

@ -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,
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;
// 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 (x = 0; x < previewW*Pixel_width*Menu_factor_X; 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;
// 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
+ imgx + imgy * Main_image_width));
int imgx = x * Main_image_width / previewW/Pixel_width/Menu_factor_X;
int imgy = y * Main_image_height / previewH/Pixel_height/Menu_factor_Y;
// 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
+ imgx + imgy * Main_image_width));
}
}
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);
Display_cursor();
// If we get here, we mayjust have left the layerbar (towards the
// main menu or statusbar). If so, close the popup.
Layer_preview_off(&preview_is_visible);
}
}
// If we get here, we mayjust have left the layerbar (towards the
// main menu or statusbar). If so, close the popup.
Layer_preview_off(&preview_is_visible);
}
}
else
{
if ( (prev_button_number!=BUTTON_CHOOSE_COL)
@ -1465,11 +1465,11 @@ void Main_handler(void)
if (button_index == BUTTON_LAYER_SELECT)
{
Layer_preview_on(&preview_is_visible);
}
else
{
Layer_preview_off(&preview_is_visible);
Layer_preview_on(&preview_is_visible);
}
else
{
Layer_preview_off(&preview_is_visible);
}
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
// main menu or statusbar). If so, close the popup.
Layer_preview_off(&preview_is_visible);
// If we get here, we mayjust have left the layerbar (towards the
// main menu or statusbar). If so, close the popup.
Layer_preview_off(&preview_is_visible);
}
}
}

View File

@ -1227,7 +1227,23 @@ void Button_Palette(void)
{
Hide_cursor();
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
T_Dropdown_button dropdown;
@ -1291,8 +1307,6 @@ void Button_Palette(void)
{
Display_cursor();
}
Window_dropdown_clear_items(&dropdown);
}
else