Fix broken characters >127 in the help window.

Fix broken characters >127 in normal fonts.
(Pkm: I unsigned the characters during gcc port, please don't re-sign them :)
Got rid of OEM->ANSI character translation in normal text.
Now displays the nice '...' character for filenames that dont fit windows/menus.
(dev) Added a sample Amstrad CPC picture with wide pixels. Remember to run grafx2 with '/wide'


git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@394 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2008-12-16 19:26:19 +00:00
parent 22670e7215
commit 78df30d844
10 changed files with 42 additions and 56 deletions

4
aide.c
View File

@ -90,7 +90,7 @@ void Afficher_aide(void)
short Largeur; // Largeur physique d'une ligne de texte
char TypeLigne; // N: Normale, T: Titre, S: Sous-titre
// -: Ligne inférieur de sous-titre
const char * Ligne;
const unsigned char * Ligne;
char Buffer[44]; // Buffer texte utilisé pour formater les noms de
// raccourcis clavier
short Position_lien=0; // Position du premier caractère "variable"
@ -122,7 +122,7 @@ void Afficher_aide(void)
else if (TypeLigne == 'K')
{
const char *Lien;
Position_lien = strstr(Ligne,"%s") - Ligne;
Position_lien = (unsigned char *)strstr(Ligne,"%s") - Ligne;
Lien=Valeur_Raccourci_Clavier(Table_d_aide[Section_d_aide_en_cours].Table_aide[Ligne_de_depart + Indice_de_ligne].valeur);
Taille_lien=strlen(Lien);
sprintf(Buffer, Ligne, Lien);

View File

@ -69,6 +69,7 @@
// Caractères présents dans les deux fontes
#define CARACTERE_TRIANGLE_DROIT 16
#define CARACTERE_TRIANGLE_GAUCHE 17
#define CARACTERE_SUSPENSION '…'
// On impose à l'allocation dynamique des pages de backups de conserver un
// minimum de 256 Ko pour que le reste du programme puisse continuer à

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,21 +1,21 @@
@ Grafx2 - The Ultimate 256-color bitmap paint program
@
@ Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
@
@ Grafx2 is free software; you can redistribute it and/or
@ modify it under the terms of the GNU General Public License
@ as published by the Free Software Foundation; version 2
@ of the License.
@
@ Grafx2 is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@ GNU General Public License for more details.
@
@ You should have received a copy of the GNU General Public License
@ along with Grafx2; if not, see <http://www.gnu.org/licenses/> or
@ write to the Free Software Foundation, Inc.,
@ 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@rem Grafx2 - The Ultimate 256-color bitmap paint program
@rem
@rem Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
@rem
@rem Grafx2 is free software; you can redistribute it and/or
@rem modify it under the terms of the GNU General Public License
@rem as published by the Free Software Foundation; version 2
@rem of the License.
@rem
@rem Grafx2 is distributed in the hope that it will be useful,
@rem but WITHOUT ANY WARRANTY; without even the implied warranty of
@rem MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@rem GNU General Public License for more details.
@rem
@rem You should have received a copy of the GNU General Public License
@rem along with Grafx2; if not, see <http://www.gnu.org/licenses/> or
@rem write to the Free Software Foundation, Inc.,
@rem 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
@echo off
img2fnt fonts fonte1

View File

@ -118,7 +118,7 @@ char * Nom_formate(char * Nom, int Type)
Resultat[Curseur]=Nom[Curseur];
// Un caractère spécial pour indiquer que l'affichage est tronqué
if (Curseur >= 12)
Resultat[11]=CARACTERE_TRIANGLE_DROIT;
Resultat[11]=CARACTERE_SUSPENSION;
}
else
{
@ -131,7 +131,7 @@ char * Nom_formate(char * Nom, int Type)
}
// Un caractère spécial pour indiquer que l'affichage est tronqué
if (Curseur > 8)
Resultat[7]=CARACTERE_TRIANGLE_DROIT;
Resultat[7]=CARACTERE_SUSPENSION;
// On recherche le dernier point dans le reste du nom
for (Pos_DernierPoint = Curseur; Nom[Curseur]!='\0'; Curseur++)
if (Nom[Curseur]=='.')

BIN
gfx2.dat

Binary file not shown.

53
graph.c
View File

@ -1571,25 +1571,6 @@ void Afficher_menu(void)
}
}
// Table de conversion ANSI->OEM
// Les deux fontes générales sont en encodage OEM
unsigned char Caractere_OEM[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63,
64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79,
80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111,
112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127,
63, 63, 39, 159, 34, 46, 197, 206, 94, 37, 83, 60, 79, 63, 90, 63,
63, 39, 39, 34, 34, 7, 45, 45, 126, 84, 115, 62, 111, 63, 122, 89,
255, 173, 189, 156, 207, 190, 221, 245, 249, 184, 166, 174, 170, 240, 169, 238,
248, 241, 253, 252, 239, 230, 244, 250, 247, 251, 167, 175, 172, 171, 243, 168,
183, 181, 182, 199, 142, 143, 146, 128, 212, 144, 210, 211, 222, 214, 215, 216,
209, 165, 227, 224, 226, 229, 153, 158, 157, 235, 233, 234, 154, 237, 232, 225,
133, 160, 131, 198, 132, 134, 145, 135, 138, 130, 136, 137, 141, 161, 140, 139,
208, 164, 149, 162, 147, 228, 148, 246, 155, 151, 163, 150, 129, 236, 231};
// -- Affichage de texte -----------------------------------------------------
// -- Afficher une chaîne n'importe où à l'écran --
@ -1597,9 +1578,9 @@ unsigned char Caractere_OEM[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
void Print_general(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleur_fond)
{
word Indice;
short Pos_X;
short Pos_Y;
short Caractere;
int Pos_X;
int Pos_Y;
byte *Caractere;
short Reel_X;
short Reel_Y;
byte Repeat_Menu_Facteur_X;
@ -1611,10 +1592,11 @@ void Print_general(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleur
Reel_X=0; // Position dans le buffer
for (Indice=0;Chaine[Indice]!='\0';Indice++)
{
Caractere=(Chaine[Indice])<<6;
// Pointeur sur le premier pixel du caractère
Caractere=Fonte+(((unsigned char)Chaine[Indice])<<6);
for (Pos_X=0;Pos_X<8<<3;Pos_X+=1<<3)
for (Repeat_Menu_Facteur_X=0;Repeat_Menu_Facteur_X<Menu_Facteur_X*Pixel_width;Repeat_Menu_Facteur_X++)
Buffer_de_ligne_horizontale[Reel_X++]=Fonte[Caractere+Pos_X+Pos_Y]?Couleur_texte:Couleur_fond;
Buffer_de_ligne_horizontale[Reel_X++]=*(Caractere+Pos_X+Pos_Y)?Couleur_texte:Couleur_fond;
}
for (Repeat_Menu_Facteur_Y=0;Repeat_Menu_Facteur_Y<Menu_Facteur_Y;Repeat_Menu_Facteur_Y++)
Afficher_ligne_fast(X,Reel_Y++,Indice*Menu_Facteur_X*8,Buffer_de_ligne_horizontale);
@ -1626,14 +1608,16 @@ void Print_general(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleur
void Print_char_dans_fenetre(short Pos_X,short Pos_Y,unsigned char Caractere,byte Couleur_texte,byte Couleur_fond)
{
short X,Y;
byte *Carac;
Pos_X=(Pos_X*Menu_Facteur_X)+Fenetre_Pos_X;
Pos_Y=(Pos_Y*Menu_Facteur_Y)+Fenetre_Pos_Y;
// Premier pixel du caractère
Carac=Fonte + (Caractere<<6);
for (X=0;X<8;X++)
for (Y=0;Y<8;Y++)
Block(Pos_X+(X*Menu_Facteur_X), Pos_Y+(Y*Menu_Facteur_Y),
Menu_Facteur_X, Menu_Facteur_Y,
(*(Fonte+(*(Caractere_OEM+Caractere)<<6)+(X<<3)+Y)?Couleur_texte:Couleur_fond));
(*(Carac+(X<<3)+Y)?Couleur_texte:Couleur_fond));
}
// -- Afficher un caractère sans fond dans une fenêtre --
@ -1648,7 +1632,7 @@ void Print_char_transparent_dans_fenetre(short Pos_X,short Pos_Y,unsigned char C
for (X=0;X<8;X++)
for (Y=0;Y<8;Y++)
{
if (*(Fonte+(*(Caractere_OEM+Caractere)<<6)+(X<<3)+Y))
if (*(Fonte+((int)Caractere<<6)+(X<<3)+Y))
Block(Pos_X+(X*Menu_Facteur_X), Pos_Y+(Y*Menu_Facteur_Y),
Menu_Facteur_X, Menu_Facteur_Y, Couleur);
}
@ -1662,10 +1646,9 @@ void Print_dans_fenetre_limite(short X,short Y,char * Chaine,byte Taille,byte Co
strncpy(Chaine_affichee, Chaine, Taille);
Chaine_affichee[Taille]='\0';
if (strlen(Chaine_affichee) > Taille)
if (strlen(Chaine) > Taille)
{
Chaine_affichee[Taille-1]=CARACTERE_TRIANGLE_DROIT;
Chaine_affichee[Taille]='\0';
Chaine_affichee[Taille-1]=CARACTERE_SUSPENSION;
}
Print_dans_fenetre(X, Y, Chaine_affichee, Couleur_texte, Couleur_fond);
}
@ -1727,15 +1710,17 @@ void Print_coordonnees(void)
void Print_nom_fichier(void)
{
short Debut_X;
char Nom_affiche[12+1];
int Taille_nom;
if (Menu_visible)
{
// Si le nom de fichier fait plus de 12 caractères, on n'affiche que les 12 derniers
char * Nom_affiche = Principal_Nom_fichier;
int Taille_nom =strlen(Principal_Nom_fichier);
strncpy(Nom_affiche,Principal_Nom_fichier,12);
Taille_nom=strlen(Principal_Nom_fichier);
Nom_affiche[12]='\0';
if (Taille_nom>12)
{
Nom_affiche=Principal_Nom_fichier + Taille_nom - 12;
Nom_affiche[11]=CARACTERE_SUSPENSION;
Taille_nom = 12;
}

BIN
pic-samples/cpc_mode0.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.2 KiB