Allow to use a negative number as menu ratio. This will set it as the max allowed zoom for the GUI display. Fixes issue 101

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@949 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2009-07-22 15:48:23 +00:00
parent ff402b204b
commit 5a59dc4abb
3 changed files with 14 additions and 9 deletions

15
graph.c
View File

@ -468,7 +468,7 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
Clear_border(MC_Black); // Requires up-to-date Screen_* and Pixel_*
// Taille des menus
// Set menu size (software zoom)
if (Screen_width/320 > Screen_height/200)
factor=Screen_height/200;
else
@ -476,19 +476,23 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
switch (Config.Ratio)
{
case 1: // adapter tout
case 1: // Always the biggest possible
Menu_factor_X=factor;
Menu_factor_Y=factor;
break;
case 2: // adapter légèrement
case 2: // Only keep the aspect ratio
Menu_factor_X=factor-1;
if (Menu_factor_X<1) Menu_factor_X=1;
Menu_factor_Y=factor-1;
if (Menu_factor_Y<1) Menu_factor_Y=1;
break;
default: // ne pas adapter
case 0: // Always smallest possible
Menu_factor_X=1;
Menu_factor_Y=1;
break;
default: // Stay below some reasonable size
Menu_factor_X=Min(factor,abs(Config.Ratio));
Menu_factor_Y=Min(factor,abs(Config.Ratio));
}
if (Pixel_height>Pixel_width && Screen_width>=Menu_factor_X*2*320)
Menu_factor_X*=2;
@ -496,7 +500,8 @@ int Init_mode_video(int width, int height, int fullscreen, int pix_ratio)
Menu_factor_Y*=2;
free(Horizontal_line_buffer);
Horizontal_line_buffer=(byte *)malloc(Pixel_width*((Screen_width>Main_image_width)?Screen_width:Main_image_width));
Horizontal_line_buffer=(byte *)malloc(Pixel_width *
((Screen_width>Main_image_width)?Screen_width:Main_image_width));
Set_palette(Main_palette);

View File

@ -519,7 +519,7 @@ int Load_INI(T_Config * conf)
if ((return_code=Load_INI_get_values (file,buffer,"Menu_ratio",1,values)))
goto Erreur_Retour;
if ((values[0]<0) || (values[0]>2))
if (values[0]>2)
goto Erreur_ERREUR_INI_CORROMPU;
conf->Ratio=values[0];

View File

@ -258,11 +258,11 @@ typedef struct
word Key2; ///< Alternate keyboard shortcut: SDLK_something, or -1 for none
} __attribute__((__packed__)) T_Config_shortcut_info;
/// This structure holds all the settings which are saved and loaded as gfx2.ini.
/// This structure holds all the settings saved and loaded as gfx2.ini.
typedef struct
{
char *Font_file; ///< Name of the font used in the menus. Matches file skins/font_*.png (Case-sensitive on some filesystems)
char *Skin_file; ///< String, name of the file where all the graphic data is stored
char *Skin_file; ///< String, name of the file where all the graphic data is stored
int Show_hidden_files; ///< Boolean, true to show hidden files in fileselectors.
int Show_hidden_directories; ///< Boolean, true to show hidden directories in fileselectors.
// int Show_system_directories; ///< (removed when converted from DOS)
@ -287,7 +287,7 @@ typedef struct
int Nb_max_vertices_per_polygon; ///< Limit for the number of vertices in polygon tools.
byte Clear_palette; ///< Boolean, true to reset the palette (to black) before loading an image.
byte Set_resolution_according_to; ///< When Auto_set_res is on, this determines if the mode should be chosen according to the "original screen" information in the file (1) or the picture dimensons (2)
byte Ratio; ///< Determines the scaling of menu and windows: 0 no scaling, 1 scaling, 2 slight scaling.
int8_t Ratio; ///< Determines the scaling of menu and windows: 0 no scaling, 1 scaling, 2 slight scaling, negative= opposite of max scaling
byte Fast_zoom; ///< Boolean, true if the magnifier shortcut should automatically view the mouse area.
byte Find_file_fast; ///< In fileselectors, this determines which entries should be sought when typing letters: 0 all, 1 files only, 2 directories only.
byte Separate_colors; ///< Boolean, true if the menu palette should separate color cells with a black outline.