Fix crashing bug when you click a layer button, hold it, and release past the edges of the layer buttons. Fix a display bug when layer bar is hidden and you use the shortcut actions.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1202 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									e2f4ed00f1
								
							
						
					
					
						commit
						951600da1e
					
				
							
								
								
									
										2
									
								
								engine.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								engine.c
									
									
									
									
									
								
							@ -69,7 +69,7 @@ char * Menu_tooltip[NB_BUTTONS]=
 | 
				
			|||||||
  "Layerbar / Hide menu    ",
 | 
					  "Layerbar / Hide menu    ",
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  "Layers manager          ",
 | 
					  "Layers manager          ",
 | 
				
			||||||
  "Select transparent color",
 | 
					  "Get/Set transparent col.",
 | 
				
			||||||
  "Merge layer             ",
 | 
					  "Merge layer             ",
 | 
				
			||||||
  "Add layer               ",
 | 
					  "Add layer               ",
 | 
				
			||||||
  "Drop layer              ",
 | 
					  "Drop layer              ",
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										16
									
								
								layers.c
									
									
									
									
									
								
							
							
						
						
									
										16
									
								
								layers.c
									
									
									
									
									
								
							@ -134,21 +134,33 @@ void Button_Layer_remove(void)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
void Button_Layer_select(void)
 | 
					void Button_Layer_select(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  word layer;
 | 
					  short layer;
 | 
				
			||||||
  // Determine which button is clicked according to mouse position
 | 
					  // Determine which button is clicked according to mouse position
 | 
				
			||||||
  layer = (Mouse_X/Menu_factor_X - Menu_bars[MENUBAR_LAYERS].Skin_width)
 | 
					  layer = (Mouse_X/Menu_factor_X - Menu_bars[MENUBAR_LAYERS].Skin_width)
 | 
				
			||||||
    / Layer_button_width;
 | 
					    / Layer_button_width;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Safety required because the mouse cursor can have slided outside button.
 | 
				
			||||||
 | 
					  if (layer < 0)
 | 
				
			||||||
 | 
					    layer=0;
 | 
				
			||||||
 | 
					  else if (layer > Main_backups->Pages->Nb_layers-1)
 | 
				
			||||||
 | 
					    layer=Main_backups->Pages->Nb_layers-1;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  Layer_activate(layer, LEFT_SIDE);
 | 
					  Layer_activate(layer, LEFT_SIDE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void Button_Layer_toggle(void)
 | 
					void Button_Layer_toggle(void)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  word layer;
 | 
					  short layer;
 | 
				
			||||||
  // Determine which button is clicked according to mouse position
 | 
					  // Determine which button is clicked according to mouse position
 | 
				
			||||||
  layer = (Mouse_X/Menu_factor_X - Menu_bars[MENUBAR_LAYERS].Skin_width)
 | 
					  layer = (Mouse_X/Menu_factor_X - Menu_bars[MENUBAR_LAYERS].Skin_width)
 | 
				
			||||||
    / Layer_button_width;
 | 
					    / Layer_button_width;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  // Safety required because the mouse cursor can have slided outside button.
 | 
				
			||||||
 | 
					  if (layer < 0)
 | 
				
			||||||
 | 
					    layer=0;
 | 
				
			||||||
 | 
					  else if (layer > Main_backups->Pages->Nb_layers-1)
 | 
				
			||||||
 | 
					    layer=Main_backups->Pages->Nb_layers-1;
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  Layer_activate(layer, RIGHT_SIDE);
 | 
					  Layer_activate(layer, RIGHT_SIDE);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -460,6 +460,9 @@ void Display_layerbar(void)
 | 
				
			|||||||
  word current_button;
 | 
					  word current_button;
 | 
				
			||||||
  word repeats=1;
 | 
					  word repeats=1;
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
 | 
					  if (! Menu_bars[MENUBAR_LAYERS].Visible)
 | 
				
			||||||
 | 
					    return;
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
  // Find top
 | 
					  // Find top
 | 
				
			||||||
  for (current_menu = MENUBAR_COUNT - 1; current_menu > MENUBAR_LAYERS; current_menu --)
 | 
					  for (current_menu = MENUBAR_COUNT - 1; current_menu > MENUBAR_LAYERS; current_menu --)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user