Fix default shortcuts from previous commit (in code). Implemented user-definable mouse-click speed and double-keypress speed.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@865 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
		
							parent
							
								
									8478d29373
								
							
						
					
					
						commit
						69dbed8d04
					
				@ -287,7 +287,7 @@ void Button_Select_forecolor(void)
 | 
			
		||||
  if (color == Fore_color)
 | 
			
		||||
  {
 | 
			
		||||
    // Check if it's a double-click    
 | 
			
		||||
    if (time_click - time_previous < 500)
 | 
			
		||||
    if (time_click - time_previous < Config.Double_click_speed)
 | 
			
		||||
    {
 | 
			
		||||
    	// Open palette window
 | 
			
		||||
    	Button_Palette();
 | 
			
		||||
@ -3814,7 +3814,7 @@ void Effects_off(void)
 | 
			
		||||
 | 
			
		||||
void Transparency_set(byte amount)
 | 
			
		||||
{
 | 
			
		||||
  const int doubleclick_delay = 500;
 | 
			
		||||
  const int doubleclick_delay = Config.Double_key_speed;
 | 
			
		||||
  static long time_click = 0;
 | 
			
		||||
  long time_previous;
 | 
			
		||||
  
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										11
									
								
								gfx2def.ini
									
									
									
									
									
								
							
							
						
						
									
										11
									
								
								gfx2def.ini
									
									
									
									
									
								
							@ -312,4 +312,15 @@
 | 
			
		||||
  ; OS isn't able to do it by itself. (ie: Windows)
 | 
			
		||||
  Window_position = 9999,9999; (Default 9999,9999 which means: NA)
 | 
			
		||||
 | 
			
		||||
  ; This is the time (in milliseconds) between two clicks for Grafx2 to
 | 
			
		||||
  ; recognize a double-click. Double-click is used mostly in the palette
 | 
			
		||||
  ; area of the menu: double-click a color to open the palette.
 | 
			
		||||
  Double_click_speed = 500; (Default 500)
 | 
			
		||||
 | 
			
		||||
  ; When you press two digit keys in rapid succession (ex: 3 8), Grafx2
 | 
			
		||||
  ; sets transparency to 38% (instead of 30% then 80%). This setting
 | 
			
		||||
  ; allows you to set the maximum delay between two keypresses for
 | 
			
		||||
  ; GrafX2 to recognize them as a combo.
 | 
			
		||||
  Double_key_speed = 500; (Default 500)
 | 
			
		||||
 | 
			
		||||
  ; end of configuration
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								hotkeys.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								hotkeys.c
									
									
									
									
									
								
							@ -1116,7 +1116,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
 | 
			
		||||
  "opacity at 20%.",
 | 
			
		||||
  "",
 | 
			
		||||
  true,
 | 
			
		||||
  SDLK_1, // 1
 | 
			
		||||
  SDLK_2, // 2
 | 
			
		||||
  0},
 | 
			
		||||
  {137,
 | 
			
		||||
  "Transparency 30%",
 | 
			
		||||
@ -1124,7 +1124,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
 | 
			
		||||
  "opacity at 30%.",
 | 
			
		||||
  "",
 | 
			
		||||
  true,
 | 
			
		||||
  SDLK_1, // 1
 | 
			
		||||
  SDLK_3, // 3
 | 
			
		||||
  0},
 | 
			
		||||
  {138,
 | 
			
		||||
  "Transparency 40%",
 | 
			
		||||
@ -1132,7 +1132,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
 | 
			
		||||
  "opacity at 40%.",
 | 
			
		||||
  "",
 | 
			
		||||
  true,
 | 
			
		||||
  SDLK_1, // 1
 | 
			
		||||
  SDLK_4, // 4
 | 
			
		||||
  0},
 | 
			
		||||
  {139,
 | 
			
		||||
  "Transparency 50%",
 | 
			
		||||
@ -1140,7 +1140,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
 | 
			
		||||
  "opacity at 50%.",
 | 
			
		||||
  "",
 | 
			
		||||
  true,
 | 
			
		||||
  SDLK_1, // 1
 | 
			
		||||
  SDLK_5, // 5
 | 
			
		||||
  0},
 | 
			
		||||
  {140,
 | 
			
		||||
  "Transparency 60%",
 | 
			
		||||
@ -1148,7 +1148,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
 | 
			
		||||
  "opacity at 60%.",
 | 
			
		||||
  "",
 | 
			
		||||
  true,
 | 
			
		||||
  SDLK_1, // 1
 | 
			
		||||
  SDLK_6, // 6
 | 
			
		||||
  0},
 | 
			
		||||
  {141,
 | 
			
		||||
  "Transparency 70%",
 | 
			
		||||
@ -1156,7 +1156,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
 | 
			
		||||
  "opacity at 70%.",
 | 
			
		||||
  "",
 | 
			
		||||
  true,
 | 
			
		||||
  SDLK_1, // 1
 | 
			
		||||
  SDLK_7, // 7
 | 
			
		||||
  0},
 | 
			
		||||
  {142,
 | 
			
		||||
  "Transparency 80%",
 | 
			
		||||
@ -1164,7 +1164,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
 | 
			
		||||
  "opacity at 80%.",
 | 
			
		||||
  "",
 | 
			
		||||
  true,
 | 
			
		||||
  SDLK_1, // 1
 | 
			
		||||
  SDLK_8, // 8
 | 
			
		||||
  0},
 | 
			
		||||
  {143,
 | 
			
		||||
  "Transparency 90%",
 | 
			
		||||
@ -1172,7 +1172,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
 | 
			
		||||
  "opacity at 90%.",
 | 
			
		||||
  "",
 | 
			
		||||
  true,
 | 
			
		||||
  SDLK_1, // 1
 | 
			
		||||
  SDLK_9, // 9
 | 
			
		||||
  0},
 | 
			
		||||
  {144,
 | 
			
		||||
  "Transparency 0%",
 | 
			
		||||
@ -1180,7 +1180,7 @@ T_Key_config ConfigKey[NB_SHORTCUTS] = {
 | 
			
		||||
  "opacity at 0%.",
 | 
			
		||||
  "",
 | 
			
		||||
  true,
 | 
			
		||||
  SDLK_1, // 1
 | 
			
		||||
  SDLK_0, // 0
 | 
			
		||||
  0},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										18
									
								
								readini.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								readini.c
									
									
									
									
									
								
							@ -788,7 +788,7 @@ int Load_INI(T_Config * conf)
 | 
			
		||||
      break;
 | 
			
		||||
  }
 | 
			
		||||
  conf->Palette_vertical=0;
 | 
			
		||||
  // Optionnel, vertical palette option (>98.0%)
 | 
			
		||||
  // Optional, vertical palette option (>98.0%)
 | 
			
		||||
  if (!Load_INI_get_values (file,buffer,"Palette_vertical",1,values))
 | 
			
		||||
  {
 | 
			
		||||
    if ((values[0]<0) || (values[0]>1))
 | 
			
		||||
@ -804,6 +804,22 @@ int Load_INI(T_Config * conf)
 | 
			
		||||
    conf->Window_pos_x = values[0];
 | 
			
		||||
    conf->Window_pos_y = values[1];
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  conf->Double_click_speed=500;
 | 
			
		||||
  // Optional, speed of double-click (>98.0%)
 | 
			
		||||
  if (!Load_INI_get_values (file,buffer,"Double_click_speed",1,values))
 | 
			
		||||
  {
 | 
			
		||||
    if ((values[0]>0) || (values[0]<=2000))
 | 
			
		||||
      conf->Double_click_speed=values[0];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  conf->Double_key_speed=500;
 | 
			
		||||
  // Optional, speed of double-keypress (>98.0%)
 | 
			
		||||
  if (!Load_INI_get_values (file,buffer,"Double_key_speed",1,values))
 | 
			
		||||
  {
 | 
			
		||||
    if ((values[0]>0) || (values[0]<=2000))
 | 
			
		||||
      conf->Double_key_speed=values[0];
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
  fclose(file);
 | 
			
		||||
 | 
			
		||||
@ -635,6 +635,13 @@ int Save_INI(T_Config * conf)
 | 
			
		||||
  if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Window_position",2,values,0)))
 | 
			
		||||
    goto Erreur_Retour;
 | 
			
		||||
 | 
			
		||||
  values[0]=(conf->Double_click_speed);
 | 
			
		||||
  if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Double_click_speed",1,values,0)))
 | 
			
		||||
    goto Erreur_Retour;
 | 
			
		||||
    
 | 
			
		||||
  values[0]=(conf->Double_key_speed);
 | 
			
		||||
  if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Double_key_speed",1,values,0)))
 | 
			
		||||
    goto Erreur_Retour;
 | 
			
		||||
    
 | 
			
		||||
  Save_INI_flush(Ancien_fichier,Nouveau_fichier,buffer);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								struct.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								struct.h
									
									
									
									
									
								
							@ -269,6 +269,8 @@ typedef struct
 | 
			
		||||
  char Bookmark_label[NB_BOOKMARKS][8+1];///< Bookmarked directories in fileselectors: This is the displayed name.
 | 
			
		||||
  int  Window_pos_x;                     ///< Last window x position (9999 if unsupportd/irrelevant for the platform)
 | 
			
		||||
  int  Window_pos_y;                     ///< Last window y position (9999 if unsupportd/irrelevant for the platform)
 | 
			
		||||
  word Double_click_speed;               ///< Maximum delay for double-click, in ms.
 | 
			
		||||
  word Double_key_speed;                 ///< Maximum delay for double-keypress, in ms.
 | 
			
		||||
} T_Config;
 | 
			
		||||
 | 
			
		||||
// Structures utilisées pour les descriptions de pages et de liste de pages.
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user