New .INI setting to allow disable unicode (issue 167)

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@814 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-05-22 19:02:23 +00:00
parent f4cb7985f2
commit 8f5fc2c923
5 changed files with 25 additions and 3 deletions

View File

@ -333,4 +333,15 @@
; OS isn't able to do it by itself. (ie: Windows)
Window_position = 9999,9999; (Default 9999,9999 which means: NA)
; The program uses SDL's Unicode support to translate key combinations
; into characters, when you're typing in textboxes. However, on
; Windows 98 and if you're using a French or German keyboard, SDL has a
; rather severe bug: The key ^ causes an instant crash if the key
; that follows it isn't space or a vowel (the ones that make it a valid
; combination : ^âêîôû)
; If this problem concerns you, disable unicode below, and it will never
; crash. This won't affect keyboard shortcuts, but in text fields you will be
; unable to type many punctuation characters.
Use_unicode = yes ; (Default 'yes')
; end of configuration

View File

@ -798,7 +798,12 @@ int Load_INI(T_Config * conf)
conf->Window_pos_x = values[0];
conf->Window_pos_y = values[1];
}
// Optional, Unicode support on/off (>98.0%)
conf->Use_unicode=1;
if (!Load_INI_get_values (file,buffer,"Use_unicode",1,values))
{
conf->Use_unicode = (values[0]!=0);
}
fclose(file);

View File

@ -142,6 +142,7 @@ byte Readline_ex(word x_pos,word y_pos,char * str,byte visible_size,byte max_siz
byte offset=0; // index du premier caractère affiché
if (Config.Use_unicode)
SDL_EnableUNICODE(SDL_ENABLE);
Hide_cursor();
@ -348,6 +349,7 @@ affichage:
Update_rect(Window_pos_X+(x_pos*Menu_factor_X),Window_pos_Y+(y_pos*Menu_factor_Y),
visible_size*(Menu_factor_X<<3),(Menu_factor_Y<<3));
if (Config.Use_unicode)
SDL_EnableUNICODE(SDL_DISABLE);
return (input_key==SDLK_RETURN);

View File

@ -635,6 +635,9 @@ 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->Use_unicode;
if ((return_code=Save_INI_set_values (Ancien_fichier,Nouveau_fichier,buffer,"Use_unicode",1,values,1)))
goto Erreur_Retour;
Save_INI_flush(Ancien_fichier,Nouveau_fichier,buffer);

View File

@ -269,6 +269,7 @@ 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)
byte Use_unicode; ///< Boolean, true to use Unicode for keyboard input
} T_Config;
// Structures utilisées pour les descriptions de pages et de liste de pages.