Fixes all the tabulation problems.

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@465 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Adrien Destugues 2009-01-05 22:55:30 +00:00
parent bdf86b06a8
commit 154f5e824a
18 changed files with 841 additions and 841 deletions

View File

@ -153,7 +153,7 @@ else
else
ifdef GP2XCROSS
#cross compile an exec for the gp2x
#cross compile an exec for the gp2x
CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc
BIN = grafx2.gpe
CFGBIN = gfxcfg.gpe
@ -207,76 +207,76 @@ all : $(BIN) $(CFGBIN)
debug : $(BIN)
release : $(BIN) $(CFGBIN)
$(STRIP) $(BIN)
$(STRIP) $(CFGBIN)
$(STRIP) $(BIN)
$(STRIP) $(CFGBIN)
# A release zip archive
ziprelease: version $(BIN) $(BINCFG) release
tar cvzf src-svn`svnversion | sed 's/:/-/'`.tgz *.c *.h Makefile Makefile.dep gfx2.ico gfx2cfg.ico
zip grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-$(PLATFORM).zip $(BIN) $(CFGBIN) gfx2.dat gfx2.gif gfx2cfg.gif doc/gpl-2.0.txt fonts/8pxfont.png doc/README-zlib1.txt doc/README-SDL.txt doc/README-SDL_image.txt doc/README-SDL_ttf.txt fonts/Tuffy.ttf src-svn`svnversion | sed 's/:/-/'`.tgz $(PLATFORMFILES)
$(DELCOMMAND) src-svn`svnversion | sed 's/:/-/'`.tgz
tar cvzf grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-src.tgz *.c *.h Makefile Makefile.dep gfx2.dat gfx2.ico gfx2.gif gfx2cfg.gif doc/gpl-2.0.txt fonts/8pxfont.png fonts/Tuffy.ttf
tar cvzf src-svn`svnversion | sed 's/:/-/'`.tgz *.c *.h Makefile Makefile.dep gfx2.ico gfx2cfg.ico
zip grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-$(PLATFORM).zip $(BIN) $(CFGBIN) gfx2.dat gfx2.gif gfx2cfg.gif doc/gpl-2.0.txt fonts/8pxfont.png doc/README-zlib1.txt doc/README-SDL.txt doc/README-SDL_image.txt doc/README-SDL_ttf.txt fonts/Tuffy.ttf src-svn`svnversion | sed 's/:/-/'`.tgz $(PLATFORMFILES)
$(DELCOMMAND) src-svn`svnversion | sed 's/:/-/'`.tgz
tar cvzf grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-src.tgz *.c *.h Makefile Makefile.dep gfx2.dat gfx2.ico gfx2.gif gfx2cfg.gif doc/gpl-2.0.txt fonts/8pxfont.png fonts/Tuffy.ttf
$(BIN) : $(OBJ) $(OBJRES)
$(CC) $(OBJ) $(OBJRES) -o $(BIN) $(LOPT)
$(CC) $(OBJ) $(OBJRES) -o $(BIN) $(LOPT)
$(CFGBIN) : $(CFGOBJ) $(CFGOBJRES)
$(CC) $(CFGOBJ) $(CFGOBJRES) -o $(CFGBIN) $(LOPT)
$(CC) $(CFGOBJ) $(CFGOBJRES) -o $(CFGBIN) $(LOPT)
# SVN revision number
version.c :
echo "char SVNRevision[]=\"`svnversion`\";" > version.c
echo "char SVNRevision[]=\"`svnversion`\";" > version.c
version : delversion version.c $(OBJDIR)/version.o
delversion :
$(DELCOMMAND) version.c
$(DELCOMMAND) version.c
$(OBJDIR)/%.o :
$(if $(wildcard $(OBJDIR)),,$(MKDIR) $(OBJDIR))
$(CC) $(COPT) -c $*.c -o $(OBJDIR)/$*.o
$(if $(wildcard $(OBJDIR)),,$(MKDIR) $(OBJDIR))
$(CC) $(COPT) -c $*.c -o $(OBJDIR)/$*.o
depend :
$(CC) -MM *.c | sed 's:^[^ ]:$$(OBJDIR)/&:' > Makefile.dep
$(CC) -MM *.c | sed 's:^[^ ]:$$(OBJDIR)/&:' > Makefile.dep
$(OBJDIR)/winres.o : gfx2.ico
echo "1 ICON \"gfx2.ico\"" | $(WINDRES) -o $(OBJDIR)/winres.o
echo "1 ICON \"gfx2.ico\"" | $(WINDRES) -o $(OBJDIR)/winres.o
$(OBJDIR)/wincfgres.o : gfx2cfg.ico
echo "1 ICON \"gfx2cfg.ico\"" | $(WINDRES) -o $(OBJDIR)/wincfgres.o
echo "1 ICON \"gfx2cfg.ico\"" | $(WINDRES) -o $(OBJDIR)/wincfgres.o
clean :
$(DELCOMMAND) $(OBJ) $(CFGOBJ) $(OBJDIR)/version.o $(OBJRES) $(CFGOBJRES)
$(DELCOMMAND) $(BIN) $(CFGBIN)
$(DELCOMMAND) $(OBJ) $(CFGOBJ) $(OBJDIR)/version.o $(OBJRES) $(CFGOBJRES)
$(DELCOMMAND) $(BIN) $(CFGBIN)
install : $(BIN) $(CFGBIN)
echo "#!/bin/sh" > $(bindir)/grafx2
echo $(datadir)/grafx2/$(BIN) '$$*' >> $(bindir)/grafx2
chmod 755 $(bindir)/grafx2
echo "#!/bin/sh" > $(bindir)/gfxcfg
echo $(datadir)/grafx2/$(CFGBIN) '$$*' >> $(bindir)/gfxcfg
chmod 755 $(bindir)/gfxcfg
$(if $(wildcard $(datadir)/grafx2),,$(MKDIR) $(datadir)/grafx2)
$(CP) $(BIN) $(datadir)/grafx2/
$(CP) $(CFGBIN) $(datadir)/grafx2/
$(CP) gfx2.dat $(datadir)/grafx2/
$(CP) gfx2.gif $(datadir)/grafx2/
$(CP) gfx2cfg.gif $(datadir)/grafx2/
$(if $(wildcard $(datadir)/grafx2/fonts),,$(MKDIR) $(datadir)/grafx2/fonts)
cd fonts && $(CP) * $(datadir)/grafx2/fonts/
@echo Install complete
echo "#!/bin/sh" > $(bindir)/grafx2
echo $(datadir)/grafx2/$(BIN) '$$*' >> $(bindir)/grafx2
chmod 755 $(bindir)/grafx2
echo "#!/bin/sh" > $(bindir)/gfxcfg
echo $(datadir)/grafx2/$(CFGBIN) '$$*' >> $(bindir)/gfxcfg
chmod 755 $(bindir)/gfxcfg
$(if $(wildcard $(datadir)/grafx2),,$(MKDIR) $(datadir)/grafx2)
$(CP) $(BIN) $(datadir)/grafx2/
$(CP) $(CFGBIN) $(datadir)/grafx2/
$(CP) gfx2.dat $(datadir)/grafx2/
$(CP) gfx2.gif $(datadir)/grafx2/
$(CP) gfx2cfg.gif $(datadir)/grafx2/
$(if $(wildcard $(datadir)/grafx2/fonts),,$(MKDIR) $(datadir)/grafx2/fonts)
cd fonts && $(CP) * $(datadir)/grafx2/fonts/
@echo Install complete
uninstall :
$(DELCOMMAND) $(bindir)/grafx2
$(DELCOMMAND) $(bindir)/gfxcfg
$(DELCOMMAND) $(datadir)/grafx2/$(BIN)
$(DELCOMMAND) $(datadir)/grafx2/$(CFGBIN)
$(DELCOMMAND) $(datadir)/grafx2/gfx2.dat
$(DELCOMMAND) $(datadir)/grafx2/gfx2.gif
$(DELCOMMAND) $(datadir)/grafx2/gfx2cfg.gif
$(DELCOMMAND) $(datadir)/grafx2/fonts/*
$(if $(wildcard $(datadir)/grafx2/fonts),,$(RMDIR) $(datadir)/grafx2/fonts)
$(if $(wildcard $(datadir)/grafx2),,$(RMDIR) $(datadir)/grafx2)
@echo Uninstall complete
$(DELCOMMAND) $(bindir)/grafx2
$(DELCOMMAND) $(bindir)/gfxcfg
$(DELCOMMAND) $(datadir)/grafx2/$(BIN)
$(DELCOMMAND) $(datadir)/grafx2/$(CFGBIN)
$(DELCOMMAND) $(datadir)/grafx2/gfx2.dat
$(DELCOMMAND) $(datadir)/grafx2/gfx2.gif
$(DELCOMMAND) $(datadir)/grafx2/gfx2cfg.gif
$(DELCOMMAND) $(datadir)/grafx2/fonts/*
$(if $(wildcard $(datadir)/grafx2/fonts),,$(RMDIR) $(datadir)/grafx2/fonts)
$(if $(wildcard $(datadir)/grafx2),,$(RMDIR) $(datadir)/grafx2)
@echo Uninstall complete
-include Makefile.dep

10
SFont.h
View File

@ -46,9 +46,9 @@ extern "C" {
// To load the fonts, load the font image into YourFont->Surface
// and call InitFont( YourFont );
typedef struct {
SDL_Surface *Surface;
int CharPos[512];
int MaxPos;
SDL_Surface *Surface;
int CharPos[512];
int MaxPos;
} SFont_Font;
// Initializes the font
@ -65,7 +65,7 @@ void SFont_FreeFont(SFont_Font* Font);
// Destination: the suface you want to blit to
// text: a string containing the text you want to blit.
void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font, int x, int y,
const char *text);
const char *text);
// Returns the width of "text" in pixels
int SFont_TextWidth(const SFont_Font* Font, const char *text);
@ -74,7 +74,7 @@ int SFont_TextHeight(const SFont_Font* Font);
// Blits a string to Surface with centered x position
void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font* Font, int y,
const char *text);
const char *text);
#ifdef __cplusplus
}

View File

@ -4820,7 +4820,7 @@ void Bouton_Spray_Menu(void)
Print_dans_fenetre(50,151," Mono",CM_Noir,CM_Clair);
else
Print_dans_fenetre(50,151,"Multi",CM_Noir,CM_Clair);
UpdateRect(Fenetre_Pos_X+50*Menu_Facteur_X,Fenetre_Pos_Y+151*Menu_Facteur_Y,5*8*Menu_Facteur_X,8*Menu_Facteur_Y);
UpdateRect(Fenetre_Pos_X+50*Menu_Facteur_X,Fenetre_Pos_Y+151*Menu_Facteur_Y,5*8*Menu_Facteur_X,8*Menu_Facteur_Y);
Afficher_curseur();
break;

24
brush.c
View File

@ -1,6 +1,6 @@
/* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2008 Franck Charlet
Copyright 2008 Franck Charlet
Copyright 2007-2008 Adrien Destugues
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
@ -192,7 +192,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
}
}
Mettre_Ecran_A_Jour(X-Brosse_Decalage_X,Y-Brosse_Decalage_Y,Brosse_Largeur,Brosse_Hauteur);
Mettre_Ecran_A_Jour(X-Brosse_Decalage_X,Y-Brosse_Decalage_Y,Brosse_Largeur,Brosse_Hauteur);
}
else
@ -210,7 +210,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
Smear_Brosse_Largeur
);
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Largeur,Hauteur);
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Largeur,Hauteur);
}
Smear_Debut=0;
}
@ -236,7 +236,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
Smear_Brosse[Position]=Couleur_temporaire;
}
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Largeur,Hauteur);
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Largeur,Hauteur);
}
Smear_Min_X=Debut_Compteur_X;
@ -262,7 +262,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
Afficher_pixel(Pos_X,Pos_Y,Couleur);
}
}
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Largeur,Hauteur);
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Largeur,Hauteur);
}
break;
@ -320,7 +320,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
if (Smear_Debut)
{
if ((Largeur>0) && (Hauteur>0))
{
{
Copier_une_partie_d_image_dans_une_autre(Principal_Ecran,
Debut_X,Debut_Y,
Largeur,Hauteur,
@ -330,7 +330,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
Debut_Compteur_Y,
Smear_Brosse_Largeur);
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Largeur,Hauteur);
}
}
Smear_Debut=0;
}
else
@ -425,7 +425,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
if (Smear_Debut)
{
if ((Largeur>0) && (Hauteur>0))
{
{
Copier_une_partie_d_image_dans_une_autre(Principal_Ecran,
Debut_X,Debut_Y,
Largeur,Hauteur,
@ -434,8 +434,8 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
Debut_Compteur_X,
Debut_Compteur_Y,
Smear_Brosse_Largeur);
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Largeur,Hauteur);
}
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Largeur,Hauteur);
}
Smear_Debut=0;
}
else
@ -446,7 +446,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
Couleur_temporaire=Lit_pixel_dans_ecran_courant(Pos_X,Pos_Y);
Position=(Compteur_Y*Smear_Brosse_Largeur)+Compteur_X;
if ( (Pinceau_Sprite[(TAILLE_MAXI_PINCEAU*Compteur_Y)+Compteur_X]) // Le pinceau sert de masque pour dire quels pixels on doit traiter dans le rectangle
&& (Compteur_Y<Smear_Max_Y) && (Compteur_X<Smear_Max_X) // On clippe l'effet smear entre Smear_Min et Smear_Max
&& (Compteur_Y<Smear_Max_Y) && (Compteur_X<Smear_Max_X) // On clippe l'effet smear entre Smear_Min et Smear_Max
&& (Compteur_Y>=Smear_Min_Y) && (Compteur_X>=Smear_Min_X) )
Afficher_pixel(Pos_X,Pos_Y,Smear_Brosse[Position]);
Smear_Brosse[Position]=Couleur_temporaire;
@ -468,7 +468,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
if (Pinceau_Sprite[(TAILLE_MAXI_PINCEAU*Compteur_Y)+Compteur_X])
Afficher_pixel(Pos_X,Pos_Y,Couleur);
}
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Largeur,Hauteur);
Mettre_Ecran_A_Jour(Debut_X,Debut_Y,Largeur,Hauteur);
}
}
}

View File

@ -163,9 +163,9 @@ int Get_input(void)
INPUT_Nouveau_Mouse_X = event.motion.x/Pixel_width;
INPUT_Nouveau_Mouse_Y = event.motion.y/Pixel_height;
// Il peut arriver (à cause de la division ci dessus) que les nouvelles coordonnees soient égales aux anciennes...
// Dans ce cas on ne traite pas l'évènement.
if (INPUT_Nouveau_Mouse_X == Mouse_X && INPUT_Nouveau_Mouse_Y == Mouse_Y) return 0;
// Il peut arriver (à cause de la division ci dessus) que les nouvelles coordonnees soient égales aux anciennes...
// Dans ce cas on ne traite pas l'évènement.
if (INPUT_Nouveau_Mouse_X == Mouse_X && INPUT_Nouveau_Mouse_Y == Mouse_Y) return 0;
break;
case SDL_MOUSEBUTTONDOWN:
@ -173,8 +173,8 @@ int Get_input(void)
switch(event.button.button)
{
case SDL_BUTTON_LEFT:
INPUT_Nouveau_Mouse_K = 1;
break;
INPUT_Nouveau_Mouse_K = 1;
break;
case SDL_BUTTON_MIDDLE: // Pour SDL, 2 = clic milieu. Pour nous c'est le clic droit
case SDL_BUTTON_RIGHT: // Clic droit SDL, clic droit pour nous aussi ( pour le moment en tout cas)
@ -189,7 +189,7 @@ int Get_input(void)
case SDL_KEYUP:
{
// Il faut remettre à 0 les touches qui simulent un clic sinon c'est comme
// Il faut remettre à 0 les touches qui simulent un clic sinon c'est comme
int ToucheR = Conversion_Touche(event.key.keysym);
if(ToucheR == Config_Touche[4])
@ -300,23 +300,23 @@ int Get_input(void)
// Mostly useful for the gp2x
// FIXME : should be made configurable with gfxcfg.
case SDL_JOYBUTTONUP:
if(event.jbutton.button==13 || event.jbutton.button==14)
INPUT_Nouveau_Mouse_K=0;
if(event.jbutton.button==13 || event.jbutton.button==14)
INPUT_Nouveau_Mouse_K=0;
break;
case SDL_JOYBUTTONDOWN:
switch(event.jbutton.button)
{
switch(event.jbutton.button)
{
case 13:
INPUT_Nouveau_Mouse_K = 1;
break;
case 13:
INPUT_Nouveau_Mouse_K = 1;
break;
case 14:
INPUT_Nouveau_Mouse_K = 2;
break;
}
case 14:
INPUT_Nouveau_Mouse_K = 2;
break;
}
break;
}
}
@ -484,12 +484,12 @@ int Get_input(void)
INPUT_Nouveau_Mouse_X*Pixel_width,
INPUT_Nouveau_Mouse_Y*Pixel_height
);
SDL_Delay(10/Menu_Facteur_X); // Histoire que ça bouge pas trop vite ...
SDL_Delay(10/Menu_Facteur_X); // Histoire que ça bouge pas trop vite ...
}
else{
else{
Flush_update();
return 0; // Il ne s'est rien passé
}
}
}
//Gestion "avancée" du curseur: interdire la descente du curseur dans le
@ -1157,7 +1157,7 @@ unsigned long Memoire_libre(void)
// AvailMem is misleading on os4 (os4 caches stuff in memory that you can still allocate)
return 10*1024*1024;
#elif defined(__AROS__) || defined(__MORPHOS__)
return AvailMem(MEMF_ANY);
return AvailMem(MEMF_ANY);
#else
struct sysinfo info;
sysinfo(&info);

View File

@ -642,7 +642,7 @@ void for_each_file(const char * Nom_repertoire, void Callback(const char *))
int Position_nom_fichier;
strcpy(Nom_fichier_complet, Nom_repertoire);
Repertoire_Courant=opendir(Nom_repertoire);
if(Repertoire_Courant == NULL) return; // Répertoire invalide ...
if(Repertoire_Courant == NULL) return; // Répertoire invalide ...
strcat(Nom_fichier_complet, SEPARATEUR_CHEMIN);
Position_nom_fichier = strlen(Nom_fichier_complet);
while ((Enreg=readdir(Repertoire_Courant)))

372
gfxcfg.c
View File

@ -79,7 +79,7 @@ struct Config_Chunk Chunk[CHUNK_MAX];
uint8_t Fenetre_choix(int Largeur, int Hauteur, const char* Titre, const char* Choix, uint8_t Choix_debut,
uint8_t Couleur,uint8_t Couleur_choix);
uint8_t Couleur,uint8_t Couleur_choix);
/*** Fonctions de gestion des évènements SDL ***/
@ -268,9 +268,9 @@ char * Interpretation_du_fichier_config()
// Utilisé pour afficher la liste complète des raccourcis dans le format du wiki...
/* printf("||%s||%s||%s %s||\n", ConfigTouche[Indice_touche].Libelle,
Nom_touche(Touche),
ConfigTouche[Indice_touche].Explic1,
ConfigTouche[Indice_touche].Explic2); */
Nom_touche(Touche),
ConfigTouche[Indice_touche].Explic1,
ConfigTouche[Indice_touche].Explic2); */
break;
}
}
@ -296,7 +296,7 @@ bool Initialiser_config()
}
uint8_t Fenetre_choix(int Largeur, int Hauteur, const char* Titre, const char* Choix, uint8_t Choix_debut,
uint8_t Couleur,uint8_t Couleur_choix)
uint8_t Couleur,uint8_t Couleur_choix)
{
char Temp[70];
uint8_t i,j,Num_titre,Num_choix;
@ -319,14 +319,14 @@ uint8_t Fenetre_choix(int Largeur, int Hauteur, const char* Titre, const char* C
// SFont ne gère pas les \n donc on le fait nous même
for(i=0;i<=strlen(Titre);i++)
{
if (Titre[i]=='\n' || Titre[i]==0)
{
memcpy(Temp,Titre+j,i-j);
Temp[i-j]=0;
j=i+1;
SFont_Write(Ecran,MyFont,x1+3,y1+Num_titre*9,Temp);
Num_titre++;
}
if (Titre[i]=='\n' || Titre[i]==0)
{
memcpy(Temp,Titre+j,i-j);
Temp[i-j]=0;
j=i+1;
SFont_Write(Ecran,MyFont,x1+3,y1+Num_titre*9,Temp);
Num_titre++;
}
}
// Maintenant on fait pareil pour les divers choix proposés
@ -335,14 +335,14 @@ uint8_t Fenetre_choix(int Largeur, int Hauteur, const char* Titre, const char* C
// SFont ne gère pas les \n donc on le fait nous même
for(i=0;i<=strlen(Choix);i++)
{
if (Choix[i]=='\n' || Choix[i]==0)
{
memcpy(Temp,Choix+j,i-j);
Temp[i-j]=0;
j=i+1;
SFont_Write(Ecran,MyFont,x1+3+50*Num_choix,y1+(Num_titre+2)*9,Temp);
Num_choix++;
}
if (Choix[i]=='\n' || Choix[i]==0)
{
memcpy(Temp,Choix+j,i-j);
Temp[i-j]=0;
j=i+1;
SFont_Write(Ecran,MyFont,x1+3+50*Num_choix,y1+(Num_titre+2)*9,Temp);
Num_choix++;
}
}
Option_choisie = Choix_debut;
@ -351,25 +351,25 @@ uint8_t Fenetre_choix(int Largeur, int Hauteur, const char* Titre, const char* C
do
{
Touche = Lire_Touche();
switch(Touche)
{
case SDLK_LEFT:
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur);
if(Option_choisie==0) Option_choisie = Num_choix - 1;
else Option_choisie --;
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur_choix);
break;
case SDLK_RIGHT:
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur);
if(Option_choisie==Num_choix-1) Option_choisie = 0;
else Option_choisie ++;
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur_choix);
default:
break;
Touche = Lire_Touche();
switch(Touche)
{
case SDLK_LEFT:
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur);
if(Option_choisie==0) Option_choisie = Num_choix - 1;
else Option_choisie --;
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur_choix);
break;
case SDLK_RIGHT:
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur);
if(Option_choisie==Num_choix-1) Option_choisie = 0;
else Option_choisie ++;
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur_choix);
default:
break;
}
SDL_UpdateRect(Ecran,x1+3,y1+(Num_titre+3)*9,50*Num_choix,2);
}
SDL_UpdateRect(Ecran,x1+3,y1+(Num_titre+3)*9,50*Num_choix,2);
}while(Touche!=SDLK_RETURN);
Tout_ecrire(); // Efface la boite de dialogue
@ -384,21 +384,21 @@ void Test_duplic()
for(i=0;i<NB_MAX_TOUCHES;i++)
{
if(ConfigTouche[i].Touche!=0xFF) // FIXME
{
j=0;
Pas_encore_erreur=true;
while(j<NB_MAX_TOUCHES && Pas_encore_erreur)
{
if(i!=j && ConfigTouche[i].Touche==ConfigTouche[j].Touche)
{
Pas_encore_erreur = false;
Erreur[i] = true;
}
j++;
}
if (Pas_encore_erreur) Erreur[i] = false;
}
if(ConfigTouche[i].Touche!=0xFF) // FIXME
{
j=0;
Pas_encore_erreur=true;
while(j<NB_MAX_TOUCHES && Pas_encore_erreur)
{
if(i!=j && ConfigTouche[i].Touche==ConfigTouche[j].Touche)
{
Pas_encore_erreur = false;
Erreur[i] = true;
}
j++;
}
if (Pas_encore_erreur) Erreur[i] = false;
}
}
}
@ -410,15 +410,15 @@ bool Validation()
while(i<NB_MAX_TOUCHES && !Y_a_des_erreurs)
{
Y_a_des_erreurs = Erreur[i];
i++;
Y_a_des_erreurs = Erreur[i];
i++;
}
if (Y_a_des_erreurs)
Choix_enreg = 4 - Fenetre_choix(30,12,
"There are errors in the\nhot-keys configuration.\nCheck out the \"Err\" column\nin order to correct them.","OK\nQuit anyway",1,0x4C,0x3F);
Choix_enreg = 4 - Fenetre_choix(30,12,
"There are errors in the\nhot-keys configuration.\nCheck out the \"Err\" column\nin order to correct them.","OK\nQuit anyway",1,0x4C,0x3F);
else
Choix_enreg = Fenetre_choix(30,10,"Save configuration?","Yes\nNo\nCancel",1,0x2A,0x6F);
Choix_enreg = Fenetre_choix(30,10,"Save configuration?","Yes\nNo\nCancel",1,0x2A,0x6F);
if (Choix_enreg!=3) return true; else return false;
}
@ -427,20 +427,20 @@ void Scroll_haut()
{
if(Position_curseur + Decalage_curseur > 0)
{
if(Position_curseur <= HAUTEUR_FIN_SETUP - HAUTEUR_DEBUT_SETUP && Position_curseur > 0)
{
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SETUP);
(Position_curseur) -- ;
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SELECT);
}
else if(Decalage_curseur>0)
{
(Decalage_curseur) -- ;
Tout_ecrire();
}
Ecrire_commentaire(Position_curseur + Decalage_curseur);
if(Position_curseur <= HAUTEUR_FIN_SETUP - HAUTEUR_DEBUT_SETUP && Position_curseur > 0)
{
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SETUP);
(Position_curseur) -- ;
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SELECT);
}
else if(Decalage_curseur>0)
{
(Decalage_curseur) -- ;
Tout_ecrire();
}
Ecrire_commentaire(Position_curseur + Decalage_curseur);
}
}
@ -449,20 +449,20 @@ void Scroll_bas()
{
if(Position_curseur + Decalage_curseur < (NB_MAX_TOUCHES-1))
{
if(Position_curseur < HAUTEUR_FIN_SETUP - HAUTEUR_DEBUT_SETUP)
{
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
COULEUR_SETUP);
(Position_curseur) ++ ;
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
COULEUR_SELECT);
}
else if(Decalage_curseur < (NB_MAX_TOUCHES-1))
{
(Decalage_curseur) ++ ;
Tout_ecrire();
}
Ecrire_commentaire(Position_curseur + Decalage_curseur );
if(Position_curseur < HAUTEUR_FIN_SETUP - HAUTEUR_DEBUT_SETUP)
{
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
COULEUR_SETUP);
(Position_curseur) ++ ;
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
COULEUR_SELECT);
}
else if(Decalage_curseur < (NB_MAX_TOUCHES-1))
{
(Decalage_curseur) ++ ;
Tout_ecrire();
}
Ecrire_commentaire(Position_curseur + Decalage_curseur );
}
}
@ -471,23 +471,23 @@ void Page_up()
{
if(Position_curseur+Decalage_curseur>0)
{
if(Position_curseur>0)
{
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SETUP);
Position_curseur = 0 ;
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SELECT);
}
else if(Decalage_curseur>0)
{
if(Decalage_curseur > HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP)
Decalage_curseur-=HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP;
else Decalage_curseur=0;
if(Position_curseur>0)
{
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SETUP);
Position_curseur = 0 ;
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SELECT);
}
else if(Decalage_curseur>0)
{
if(Decalage_curseur > HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP)
Decalage_curseur-=HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP;
else Decalage_curseur=0;
Tout_ecrire();
}
Ecrire_commentaire(Position_curseur+Decalage_curseur);
Tout_ecrire();
}
Ecrire_commentaire(Position_curseur+Decalage_curseur);
}
}
@ -496,26 +496,26 @@ void Page_down()
{
if(Position_curseur+Decalage_curseur<(NB_MAX_TOUCHES-1))
{
if(Position_curseur<HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP)
{
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SETUP);
Position_curseur = HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP ;
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SELECT);
}
else if(Decalage_curseur<(NB_MAX_TOUCHES-1))
{
if(Decalage_curseur + Position_curseur + HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP < (NB_MAX_TOUCHES-1))
{
Decalage_curseur+=HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP;
}
else
Decalage_curseur=NB_MAX_TOUCHES-1-HAUTEUR_FIN_SETUP+HAUTEUR_DEBUT_SETUP;
if(Position_curseur<HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP)
{
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SETUP);
Position_curseur = HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP ;
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
COULEUR_SELECT);
}
else if(Decalage_curseur<(NB_MAX_TOUCHES-1))
{
if(Decalage_curseur + Position_curseur + HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP < (NB_MAX_TOUCHES-1))
{
Decalage_curseur+=HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP;
}
else
Decalage_curseur=NB_MAX_TOUCHES-1-HAUTEUR_FIN_SETUP+HAUTEUR_DEBUT_SETUP;
Tout_ecrire();
}
Ecrire_commentaire(Position_curseur+Decalage_curseur);
Tout_ecrire();
}
Ecrire_commentaire(Position_curseur+Decalage_curseur);
}
}
@ -528,12 +528,12 @@ void Select()
SDL_UpdateRect(Ecran,3,(HAUTEUR_DEBUT_SETUP+Position_curseur)*9,630,9);
while (1)
{
Touche = Lire_Touche();
Touche = Lire_Touche();
if (Touche == SDLK_ESCAPE)
{
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
COULEUR_SETUP);
return;
COULEUR_SETUP);
return;
}
if (Touche != 0)
{
@ -541,7 +541,7 @@ void Select()
Test_duplic();
// Des X ont pu être ajoutés ou enlevés sur n'importe quelle ligne..
// pour faire simple, on rafraîchit toute la page.
Tout_ecrire();
Tout_ecrire();
return;
}
}
@ -555,33 +555,33 @@ void Setup()
Test_duplic();
Tout_ecrire();
do{
Touche = Lire_Touche();
switch(Touche)
{
case SDLK_UP:
Scroll_haut();
break;
case SDLK_DOWN:
Scroll_bas();
break;
case SDLK_PAGEUP:
Page_up();
break;
case SDLK_PAGEDOWN:
Page_down();
break;
case SDLK_RETURN:
Select();
break;
case SDLK_DELETE:
//Unselect();
break;
case SDLK_ESCAPE:
Sortie_OK=Validation();
break;
default:
break; // On ne fait rien pour les autres touches
}
Touche = Lire_Touche();
switch(Touche)
{
case SDLK_UP:
Scroll_haut();
break;
case SDLK_DOWN:
Scroll_bas();
break;
case SDLK_PAGEUP:
Page_up();
break;
case SDLK_PAGEDOWN:
Page_down();
break;
case SDLK_RETURN:
Select();
break;
case SDLK_DELETE:
//Unselect();
break;
case SDLK_ESCAPE:
Sortie_OK=Validation();
break;
default:
break; // On ne fait rien pour les autres touches
}
} while(!Sortie_OK);
}
@ -637,9 +637,9 @@ void Enregistrer_config()
for(Indice_touche=0; Indice_touche<NB_MAX_TOUCHES;Indice_touche++)
{
write_word_le(Fichier,ConfigTouche[Indice_touche].Numero);
write_word_le(Fichier,ConfigTouche[Indice_touche].Touche);
write_word_le(Fichier,0xFF);
write_word_le(Fichier,ConfigTouche[Indice_touche].Numero);
write_word_le(Fichier,ConfigTouche[Indice_touche].Touche);
write_word_le(Fichier,0xFF);
}
}
else
@ -664,8 +664,8 @@ int main(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
if (Verifier_ecriture_possible())
{
/* On initialise SDL */
SDL_Init(SDL_INIT_VIDEO);
/* On initialise SDL */
SDL_Init(SDL_INIT_VIDEO);
{
// Routine pour définir l'icone.
SDL_Surface * Icone;
@ -690,44 +690,44 @@ int main(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
SDL_EnableKeyRepeat(250, 32);
SDL_EnableUNICODE(SDL_ENABLE);
/* On initialise SFont */
/* On initialise SFont */
strcpy(Nom_fichier, Repertoire_donnees);
strcat(Nom_fichier, "fonts/8pxfont.png");
MyFont = SFont_InitFont(IMG_Load(Nom_fichier));
if(MyFont==NULL)
{
SDL_Quit();
exit(0);
}
if(MyFont==NULL)
{
SDL_Quit();
exit(0);
}
Dessiner_ecran_principal();
Dessiner_ecran_principal();
if(!Initialiser_config())
{
Setup();
Enregistrer_config();
if(!Initialiser_config())
{
Setup();
Enregistrer_config();
/* On fait un peu de nettoyage avant de s'en aller */
SFont_FreeFont(MyFont);
SDL_Quit();
exit(0);
}
else
{
SFont_FreeFont(MyFont);
SDL_Quit();
exit(1);
}
/* On fait un peu de nettoyage avant de s'en aller */
SFont_FreeFont(MyFont);
SDL_Quit();
exit(0);
}
else
{
SFont_FreeFont(MyFont);
SDL_Quit();
exit(1);
}
}
else
{
puts("Error: you mustn't run this setup program from a read-only drive!\n");
puts("The most probable cause of this error is that you are running this program");
puts("from a CD-Rom or a protected floppy disk.");
puts("You should try to copy all the files of Grafx2 on a hard drive or to");
puts("unprotect your floppy disk if you really want to run it from this outdated medium.");
exit(1);
puts("Error: you mustn't run this setup program from a read-only drive!\n");
puts("The most probable cause of this error is that you are running this program");
puts("from a CD-Rom or a protected floppy disk.");
puts("You should try to copy all the files of Grafx2 on a hard drive or to");
puts("unprotect your floppy disk if you really want to run it from this outdated medium.");
exit(1);
}
return 0;

View File

@ -20,7 +20,7 @@
*/
void Liste2tables(word * Liste, short Pas, byte Mode, byte * Table_inc,
byte * Table_dec
byte * Table_dec
);
void Transformer_point(short X, short Y,

154
init.c
View File

@ -77,74 +77,74 @@ void Rechercher_drives(void)
dosList = LockDosList(lockDosListFlags);
if (dosList)
{
dosList = NextDosEntry(dosList, LDF_VOLUMES);
while (dosList)
{
if (dosList->dol_Type == DLT_VOLUME dosList->dol_Name && dosList->dol_Task)
{
TEXT name[256];
CONST_STRPTR volume_name = (CONST_STRPTR)BADDR(dosList->dol_Name)+1;
CONST_STRPTR device_name = (CONST_STRPTR)((struct Task *)dosList->dol_Task->mp_SigTask)->tc_Node.ln_Name;
BPTR volume_lock;
dosList = NextDosEntry(dosList, LDF_VOLUMES);
while (dosList)
{
if (dosList->dol_Type == DLT_VOLUME dosList->dol_Name && dosList->dol_Task)
{
TEXT name[256];
CONST_STRPTR volume_name = (CONST_STRPTR)BADDR(dosList->dol_Name)+1;
CONST_STRPTR device_name = (CONST_STRPTR)((struct Task *)dosList->dol_Task->mp_SigTask)->tc_Node.ln_Name;
BPTR volume_lock;
stccpy(name, volume_name, sizeof(name));
strncat(name, ":", sizeof(name));
stccpy(name, volume_name, sizeof(name));
strncat(name, ":", sizeof(name));
volume_lock = Lock(name, SHARED_LOCK);
if (volume_lock)
{
Ajouter_lecteur(device_name[0],LECTEUR_HDD,name);
UnLock(volume_lock);
}
}
dosList = NextDosEntry(dosList, LDF_VOLUMES);
}
volume_lock = Lock(name, SHARED_LOCK);
if (volume_lock)
{
Ajouter_lecteur(device_name[0],LECTEUR_HDD,name);
UnLock(volume_lock);
}
}
dosList = NextDosEntry(dosList, LDF_VOLUMES);
}
UnLockDosList(lockDosListFlags);
}
UnLockDosList(lockDosListFlags);
}
#elif defined (__WIN32__)
char NomLecteur[]="A:\\";
int DriveBits = GetLogicalDrives();
int IndiceLecteur;
int IndiceBit;
// Sous Windows, on a la totale, presque aussi bien que sous DOS:
IndiceLecteur = 0;
for (IndiceBit=0; IndiceBit<26 && IndiceLecteur<23; IndiceBit++)
{
if ( (1 << IndiceBit) & DriveBits )
{
// On a ce lecteur, il faut maintenant déterminer son type "physique".
// pour profiter des jolies icones de X-man.
int TypeLecteur;
char CheminLecteur[]="A:\\";
// Cette API Windows est étrange, je dois m'y faire...
CheminLecteur[0]='A'+IndiceBit;
switch (GetDriveType(CheminLecteur))
{
case DRIVE_CDROM:
TypeLecteur=LECTEUR_CDROM;
break;
case DRIVE_REMOTE:
TypeLecteur=LECTEUR_NETWORK;
break;
case DRIVE_REMOVABLE:
TypeLecteur=LECTEUR_FLOPPY_3_5;
break;
case DRIVE_FIXED:
TypeLecteur=LECTEUR_HDD;
break;
default:
TypeLecteur=LECTEUR_NETWORK;
break;
}
char NomLecteur[]="A:\\";
int DriveBits = GetLogicalDrives();
int IndiceLecteur;
int IndiceBit;
// Sous Windows, on a la totale, presque aussi bien que sous DOS:
IndiceLecteur = 0;
for (IndiceBit=0; IndiceBit<26 && IndiceLecteur<23; IndiceBit++)
{
if ( (1 << IndiceBit) & DriveBits )
{
// On a ce lecteur, il faut maintenant déterminer son type "physique".
// pour profiter des jolies icones de X-man.
int TypeLecteur;
char CheminLecteur[]="A:\\";
// Cette API Windows est étrange, je dois m'y faire...
CheminLecteur[0]='A'+IndiceBit;
switch (GetDriveType(CheminLecteur))
{
case DRIVE_CDROM:
TypeLecteur=LECTEUR_CDROM;
break;
case DRIVE_REMOTE:
TypeLecteur=LECTEUR_NETWORK;
break;
case DRIVE_REMOVABLE:
TypeLecteur=LECTEUR_FLOPPY_3_5;
break;
case DRIVE_FIXED:
TypeLecteur=LECTEUR_HDD;
break;
default:
TypeLecteur=LECTEUR_NETWORK;
break;
}
NomLecteur[0]='A'+IndiceBit;
Ajouter_lecteur(NomLecteur[0], TypeLecteur,NomLecteur);
IndiceLecteur++;
}
}
Ajouter_lecteur(NomLecteur[0], TypeLecteur,NomLecteur);
IndiceLecteur++;
}
}
#else
//Sous les différents unix, on va mettre
@ -158,28 +158,28 @@ void Rechercher_drives(void)
char lettre = 'A';
#if defined(__BEOS__) || defined(__HAIKU__)
char * Home = getenv("$HOME");
char * Home = getenv("$HOME");
#else
char * Home = getenv("HOME");
char * Home = getenv("HOME");
#endif
Ajouter_lecteur('/', LECTEUR_HDD, "/");
if(Home)
Ajouter_lecteur('~', LECTEUR_HDD, Home);
Ajouter_lecteur('~', LECTEUR_HDD, Home);
Liste_points_montage = read_file_system_list(false);
while(Liste_points_montage != NULL)
{
if(Liste_points_montage -> me_dummy == 0 && !strcmp(Liste_points_montage->me_mountdir,"/") && !strcmp(Liste_points_montage->me_mountdir,"/home"))
{
Ajouter_lecteur(lettre++,
Liste_points_montage->me_remote==1?LECTEUR_NETWORK:LECTEUR_HDD,
Liste_points_montage->me_mountdir);
}
next = Liste_points_montage -> me_next;
free(Liste_points_montage -> me_type);
free(Liste_points_montage);
Liste_points_montage = next;
if(Liste_points_montage -> me_dummy == 0 && !strcmp(Liste_points_montage->me_mountdir,"/") && !strcmp(Liste_points_montage->me_mountdir,"/home"))
{
Ajouter_lecteur(lettre++,
Liste_points_montage->me_remote==1?LECTEUR_NETWORK:LECTEUR_HDD,
Liste_points_montage->me_mountdir);
}
next = Liste_points_montage -> me_next;
free(Liste_points_montage -> me_type);
free(Liste_points_montage);
Liste_points_montage = next;
}
#endif
@ -234,8 +234,8 @@ void Charger_DAT(void)
Handle=fopen(Nom_du_fichier,"rb");
if (Handle==NULL)
{
DEBUG("Absent",0);
Erreur(ERREUR_DAT_ABSENT);
DEBUG("Absent",0);
Erreur(ERREUR_DAT_ABSENT);
}
if (!read_bytes(Handle, Palette_defaut,sizeof(T_Palette)))
@ -1317,8 +1317,8 @@ void Definir_mode_video(short Largeur,
Mode_video[Nb_modes_video].Largeur = Largeur;
Mode_video[Nb_modes_video].Hauteur = Hauteur;
Mode_video[Nb_modes_video].Mode = Mode;
Mode_video[Nb_modes_video].Fullscreen = Fullscreen;
Mode_video[Nb_modes_video].Etat = Supporte;
Mode_video[Nb_modes_video].Fullscreen = Fullscreen;
Mode_video[Nb_modes_video].Etat = Supporte;
Nb_modes_video ++;
}

View File

@ -48,9 +48,9 @@
// Taille de fichier, en octets
int FileLength(FILE * Fichier)
{
struct stat infos_fichier;
fstat(fileno(Fichier),&infos_fichier);
return infos_fichier.st_size;
struct stat infos_fichier;
fstat(fileno(Fichier),&infos_fichier);
return infos_fichier.st_size;
}
// Chargement des pixels dans l'écran principal

View File

@ -848,7 +848,7 @@ void Gestion_principale(void)
}
}
else Wait_VBL(); // S'il n'y a pas d'évènement, on ne gère pas tout ça et on attend un peu. La partie en dessous doit être exécutée quand
// même pour les trucs asynchrones, par exemple le spray.
// même pour les trucs asynchrones, par exemple le spray.
// Gestion de la souris
@ -975,7 +975,7 @@ void Gestion_principale(void)
if(Curseur_dans_menu)
{
Curseur_dans_menu_precedent = 1;
Curseur_dans_menu_precedent = 1;
}
else
{
@ -1991,29 +1991,29 @@ short Fenetre_Bouton_clicke(void)
void Remappe_fond_fenetres(byte * Table_de_conversion, int Min_Y, int Max_Y)
{
int Indice_fenetre;
byte* EDI;
int dx,cx;
byte* EDI;
int dx,cx;
for (Indice_fenetre=0; Indice_fenetre<Fenetre; Indice_fenetre++)
{
EDI = Fond_fenetre[Indice_fenetre];
// Pour chaque ligne
for(dx=0; dx<Pile_Fenetre_Hauteur[Indice_fenetre]*Menu_Facteur_Y;dx++)
{
if (dx+Pile_Fenetre_Pos_Y[Indice_fenetre]>Max_Y)
return;
if (dx+Pile_Fenetre_Pos_Y[Indice_fenetre]<Min_Y)
{
EDI += Pile_Fenetre_Largeur[Indice_fenetre]*Menu_Facteur_X;
}
else
// Pour chaque pixel
for(cx=Pile_Fenetre_Largeur[Indice_fenetre]*Menu_Facteur_X;cx>0;cx--)
{
*EDI = Table_de_conversion[*EDI];
EDI ++;
}
}
// Pour chaque ligne
for(dx=0; dx<Pile_Fenetre_Hauteur[Indice_fenetre]*Menu_Facteur_Y;dx++)
{
if (dx+Pile_Fenetre_Pos_Y[Indice_fenetre]>Max_Y)
return;
if (dx+Pile_Fenetre_Pos_Y[Indice_fenetre]<Min_Y)
{
EDI += Pile_Fenetre_Largeur[Indice_fenetre]*Menu_Facteur_X;
}
else
// Pour chaque pixel
for(cx=Pile_Fenetre_Largeur[Indice_fenetre]*Menu_Facteur_X;cx>0;cx--)
{
*EDI = Table_de_conversion[*EDI];
EDI ++;
}
}
}
}

View File

@ -39,10 +39,10 @@
# include <sys/param.h>
#endif
#if defined MOUNTED_GETFSSTAT /* OSF_1 and Darwin1.3.x */
#if defined MOUNTED_GETFSSTAT /* OSF_1 and Darwin1.3.x */
# if HAVE_SYS_UCRED_H
# include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
NGROUPS is used as an array dimension in ucred.h */
NGROUPS is used as an array dimension in ucred.h */
# include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
# endif
# if HAVE_SYS_MOUNT_H
@ -58,44 +58,44 @@
# endif
#endif /* MOUNTED_GETFSSTAT */
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
#ifdef MOUNTED_GETMNTENT1 /* 4.3BSD, SunOS, HP-UX, Dynix, Irix. */
# include <mntent.h>
# if !defined MOUNTED
# if defined _PATH_MOUNTED /* GNU libc */
# if defined _PATH_MOUNTED /* GNU libc */
# define MOUNTED _PATH_MOUNTED
# endif
# if defined MNT_MNTTAB /* HP-UX. */
# if defined MNT_MNTTAB /* HP-UX. */
# define MOUNTED MNT_MNTTAB
# endif
# if defined MNTTABNAME /* Dynix. */
# if defined MNTTABNAME /* Dynix. */
# define MOUNTED MNTTABNAME
# endif
# endif
#endif
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
# include <sys/mount.h>
#endif
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
# include <sys/statvfs.h>
#endif
#ifdef MOUNTED_GETMNT /* Ultrix. */
#ifdef MOUNTED_GETMNT /* Ultrix. */
# include <sys/mount.h>
# include <sys/fs_types.h>
#endif
#ifdef MOUNTED_FS_STAT_DEV /* BeOS. */
#ifdef MOUNTED_FS_STAT_DEV /* BeOS. */
# include <fs_info.h>
# include <dirent.h>
#endif
#ifdef MOUNTED_FREAD /* SVR2. */
#ifdef MOUNTED_FREAD /* SVR2. */
# include <mnttab.h>
#endif
#ifdef MOUNTED_FREAD_FSTYP /* SVR3. */
#ifdef MOUNTED_FREAD_FSTYP /* SVR3. */
# include <mnttab.h>
# include <sys/fstyp.h>
# include <sys/statfs.h>
@ -105,11 +105,11 @@
# include <mntent.h>
#endif
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
# include <sys/mnttab.h>
#endif
#ifdef MOUNTED_VMOUNT /* AIX. */
#ifdef MOUNTED_VMOUNT /* AIX. */
# include <fshelp.h>
# include <sys/vfs.h>
#endif
@ -151,30 +151,30 @@
#undef closedir
#ifndef ME_DUMMY
# define ME_DUMMY(Fs_name, Fs_type) \
(strcmp (Fs_type, "autofs") == 0 \
|| strcmp (Fs_type, "none") == 0 \
|| strcmp (Fs_type, "proc") == 0 \
|| strcmp (Fs_type, "subfs") == 0 \
|| strcmp (Fs_type, "sysfs") == 0 \
|| strcmp (Fs_type, "usbfs") == 0 \
|| strcmp (Fs_type, "devpts") == 0 \
|| strcmp (Fs_type, "tmpfs") == 0 \
/* for NetBSD 3.0 */ \
|| strcmp (Fs_type, "kernfs") == 0 \
/* for Irix 6.5 */ \
# define ME_DUMMY(Fs_name, Fs_type) \
(strcmp (Fs_type, "autofs") == 0 \
|| strcmp (Fs_type, "none") == 0 \
|| strcmp (Fs_type, "proc") == 0 \
|| strcmp (Fs_type, "subfs") == 0 \
|| strcmp (Fs_type, "sysfs") == 0 \
|| strcmp (Fs_type, "usbfs") == 0 \
|| strcmp (Fs_type, "devpts") == 0 \
|| strcmp (Fs_type, "tmpfs") == 0 \
/* for NetBSD 3.0 */ \
|| strcmp (Fs_type, "kernfs") == 0 \
/* for Irix 6.5 */ \
|| strcmp (Fs_type, "ignore") == 0)
#endif
#ifndef ME_REMOTE
/* A file system is `remote' if its Fs_name contains a `:'
or if (it is of type (smbfs or cifs) and its Fs_name starts with `//'). */
# define ME_REMOTE(Fs_name, Fs_type) \
(strchr (Fs_name, ':') != NULL \
|| ((Fs_name)[0] == '/' \
&& (Fs_name)[1] == '/' \
&& (strcmp (Fs_type, "smbfs") == 0 \
|| strcmp (Fs_type, "cifs") == 0)))
# define ME_REMOTE(Fs_name, Fs_type) \
(strchr (Fs_name, ':') != NULL \
|| ((Fs_name)[0] == '/' \
&& (Fs_name)[1] == '/' \
&& (strcmp (Fs_type, "smbfs") == 0 \
|| strcmp (Fs_type, "cifs") == 0)))
#endif
#if MOUNTED_GETMNTINFO
@ -287,7 +287,7 @@ fsp_to_string (const struct statfs *fsp)
#endif /* MOUNTED_GETMNTINFO */
#ifdef MOUNTED_VMOUNT /* AIX. */
#ifdef MOUNTED_VMOUNT /* AIX. */
static char *
fstype_to_string (int t)
{
@ -326,10 +326,10 @@ dev_from_mount_options (char const *mount_options)
errno = 0;
dev = strtoul (optval, &optvalend, 16);
if (optval != optvalend
&& (*optvalend == '\0' || *optvalend == ',')
&& ! (dev == ULONG_MAX && errno == ERANGE)
&& dev == (dev_t) dev)
return dev;
&& (*optvalend == '\0' || *optvalend == ',')
&& ! (dev == ULONG_MAX && errno == ERANGE)
&& dev == (dev_t) dev)
return dev;
}
# endif
@ -394,18 +394,18 @@ read_file_system_list (bool need_fs_type)
while ((mnt = getmntent (fp)))
{
me = malloc (sizeof *me);
me->me_devname = strdup (mnt->mnt_fsname);
me->me_mountdir = strdup (mnt->mnt_dir);
me->me_type = strdup (mnt->mnt_type);
me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = dev_from_mount_options (mnt->mnt_opts);
me = malloc (sizeof *me);
me->me_devname = strdup (mnt->mnt_fsname);
me->me_mountdir = strdup (mnt->mnt_dir);
me->me_type = strdup (mnt->mnt_type);
me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = dev_from_mount_options (mnt->mnt_opts);
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
}
if (endmntent (fp) == 0)
@ -413,7 +413,7 @@ read_file_system_list (bool need_fs_type)
}
#endif /* MOUNTED_GETMNTENT1. */
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
{
struct statfs *fsp;
int entries;
@ -423,25 +423,25 @@ read_file_system_list (bool need_fs_type)
return NULL;
for (; entries-- > 0; fsp++)
{
char *fs_type = fsp_to_string (fsp);
char *fs_type = fsp_to_string (fsp);
me = xmalloc (sizeof *me);
me->me_devname = xstrdup (fsp->f_mntfromname);
me->me_mountdir = xstrdup (fsp->f_mntonname);
me->me_type = fs_type;
me->me_type_malloced = 0;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me = xmalloc (sizeof *me);
me->me_devname = xstrdup (fsp->f_mntfromname);
me->me_mountdir = xstrdup (fsp->f_mntonname);
me->me_type = fs_type;
me->me_type_malloced = 0;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
}
}
#endif /* MOUNTED_GETMNTINFO */
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
{
struct statvfs *fsp;
int entries;
@ -451,44 +451,44 @@ read_file_system_list (bool need_fs_type)
return NULL;
for (; entries-- > 0; fsp++)
{
me = xmalloc (sizeof *me);
me->me_devname = xstrdup (fsp->f_mntfromname);
me->me_mountdir = xstrdup (fsp->f_mntonname);
me->me_type = xstrdup (fsp->f_fstypename);
me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me = xmalloc (sizeof *me);
me->me_devname = xstrdup (fsp->f_mntfromname);
me->me_mountdir = xstrdup (fsp->f_mntonname);
me->me_type = xstrdup (fsp->f_fstypename);
me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
}
}
#endif /* MOUNTED_GETMNTINFO2 */
#ifdef MOUNTED_GETMNT /* Ultrix. */
#ifdef MOUNTED_GETMNT /* Ultrix. */
{
int offset = 0;
int val;
struct fs_data fsd;
while (errno = 0,
0 < (val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
(char *) 0)))
0 < (val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
(char *) 0)))
{
me = xmalloc (sizeof *me);
me->me_devname = xstrdup (fsd.fd_req.devname);
me->me_mountdir = xstrdup (fsd.fd_req.path);
me->me_type = gt_names[fsd.fd_req.fstype];
me->me_type_malloced = 0;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = fsd.fd_req.dev;
me = xmalloc (sizeof *me);
me->me_devname = xstrdup (fsd.fd_req.devname);
me->me_mountdir = xstrdup (fsd.fd_req.path);
me->me_type = gt_names[fsd.fd_req.fstype];
me->me_type_malloced = 0;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = fsd.fd_req.dev;
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
}
if (val < 0)
goto free_then_fail;
@ -548,7 +548,7 @@ read_file_system_list (bool need_fs_type)
if (lstat (name, &statbuf) >= 0 && S_ISDIR (statbuf.st_mode))
{
struct rootdir_entry *re = xmalloc (sizeof *re);
struct rootdir_entry *re = xmalloc (sizeof *re);
re->name = name;
re->dev = statbuf.st_dev;
re->ino = statbuf.st_ino;
@ -574,11 +574,11 @@ read_file_system_list (bool need_fs_type)
if (re->dev == fi.dev && re->ino == fi.root)
break;
me = xmalloc (sizeof *me);
me = xmalloc (sizeof *me);
me->me_devname = xstrdup (fi.device_name[0] != '\0' ? fi.device_name : fi.fsh_name);
me->me_mountdir = xstrdup (re != NULL ? re->name : fi.fsh_name);
me->me_type = xstrdup (fi.fsh_name);
me->me_type_malloced = 1;
me->me_type_malloced = 1;
me->me_dev = fi.dev;
me->me_dummy = 0;
me->me_remote = (fi.flags & B_FS_IS_SHARED) != 0;
@ -599,7 +599,7 @@ read_file_system_list (bool need_fs_type)
}
#endif /* MOUNTED_FS_STAT_DEV */
#if defined MOUNTED_GETFSSTAT /* __alpha running OSF_1 */
#if defined MOUNTED_GETFSSTAT /* __alpha running OSF_1 */
{
int numsys, counter;
size_t bufsize;
@ -617,24 +617,24 @@ read_file_system_list (bool need_fs_type)
if (numsys < 0)
{
free (stats);
return (NULL);
free (stats);
return (NULL);
}
for (counter = 0; counter < numsys; counter++)
{
me = xmalloc (sizeof *me);
me->me_devname = xstrdup (stats[counter].f_mntfromname);
me->me_mountdir = xstrdup (stats[counter].f_mntonname);
me->me_type = xstrdup (FS_TYPE (stats[counter]));
me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me = xmalloc (sizeof *me);
me->me_devname = xstrdup (stats[counter].f_mntfromname);
me->me_mountdir = xstrdup (stats[counter].f_mntonname);
me->me_type = xstrdup (FS_TYPE (stats[counter]));
me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
}
free (stats);
@ -653,47 +653,47 @@ read_file_system_list (bool need_fs_type)
while (fread (&mnt, sizeof mnt, 1, fp) > 0)
{
me = xmalloc (sizeof *me);
# ifdef GETFSTYP /* SVR3. */
me->me_devname = xstrdup (mnt.mt_dev);
me = xmalloc (sizeof *me);
# ifdef GETFSTYP /* SVR3. */
me->me_devname = xstrdup (mnt.mt_dev);
# else
me->me_devname = xmalloc (strlen (mnt.mt_dev) + 6);
strcpy (me->me_devname, "/dev/");
strcpy (me->me_devname + 5, mnt.mt_dev);
me->me_devname = xmalloc (strlen (mnt.mt_dev) + 6);
strcpy (me->me_devname, "/dev/");
strcpy (me->me_devname + 5, mnt.mt_dev);
# endif
me->me_mountdir = xstrdup (mnt.mt_filsys);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me->me_type = "";
me->me_type_malloced = 0;
# ifdef GETFSTYP /* SVR3. */
if (need_fs_type)
{
struct statfs fsd;
char typebuf[FSTYPSZ];
me->me_mountdir = xstrdup (mnt.mt_filsys);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me->me_type = "";
me->me_type_malloced = 0;
# ifdef GETFSTYP /* SVR3. */
if (need_fs_type)
{
struct statfs fsd;
char typebuf[FSTYPSZ];
if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
{
me->me_type = xstrdup (typebuf);
me->me_type_malloced = 1;
}
}
if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
{
me->me_type = xstrdup (typebuf);
me->me_type_malloced = 1;
}
}
# endif
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
}
if (ferror (fp))
{
/* The last fread() call must have failed. */
int saved_errno = errno;
fclose (fp);
errno = saved_errno;
goto free_then_fail;
/* The last fread() call must have failed. */
int saved_errno = errno;
fclose (fp);
errno = saved_errno;
goto free_then_fail;
}
if (fclose (fp) == EOF)
@ -701,29 +701,29 @@ read_file_system_list (bool need_fs_type)
}
#endif /* MOUNTED_FREAD || MOUNTED_FREAD_FSTYP. */
#ifdef MOUNTED_GETMNTTBL /* DolphinOS goes its own way. */
#ifdef MOUNTED_GETMNTTBL /* DolphinOS goes its own way. */
{
struct mntent **mnttbl = getmnttbl (), **ent;
for (ent=mnttbl;*ent;ent++)
{
me = xmalloc (sizeof *me);
me->me_devname = xstrdup ( (*ent)->mt_resource);
me->me_mountdir = xstrdup ( (*ent)->mt_directory);
me->me_type = xstrdup ((*ent)->mt_fstype);
me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
me = xmalloc (sizeof *me);
me->me_devname = xstrdup ( (*ent)->mt_resource);
me->me_mountdir = xstrdup ( (*ent)->mt_directory);
me->me_type = xstrdup ((*ent)->mt_fstype);
me->me_type_malloced = 1;
me->me_dummy = ME_DUMMY (me->me_devname, me->me_type);
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
}
endmnttbl ();
}
#endif
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
{
struct mnttab mnt;
char *table = MNTTAB;
@ -742,19 +742,19 @@ read_file_system_list (bool need_fs_type)
lockfd = open (MNTTAB_LOCK, O_RDONLY);
if (0 <= lockfd)
{
struct flock flock;
flock.l_type = F_RDLCK;
flock.l_whence = SEEK_SET;
flock.l_start = 0;
flock.l_len = 0;
while (fcntl (lockfd, F_SETLKW, &flock) == -1)
if (errno != EINTR)
{
int saved_errno = errno;
close (lockfd);
errno = saved_errno;
return NULL;
}
struct flock flock;
flock.l_type = F_RDLCK;
flock.l_whence = SEEK_SET;
flock.l_start = 0;
flock.l_len = 0;
while (fcntl (lockfd, F_SETLKW, &flock) == -1)
if (errno != EINTR)
{
int saved_errno = errno;
close (lockfd);
errno = saved_errno;
return NULL;
}
}
else if (errno != ENOENT)
return NULL;
@ -766,23 +766,23 @@ read_file_system_list (bool need_fs_type)
ret = errno;
else
{
while ((ret = getmntent (fp, &mnt)) == 0)
{
me = xmalloc (sizeof *me);
me->me_devname = xstrdup (mnt.mnt_special);
me->me_mountdir = xstrdup (mnt.mnt_mountp);
me->me_type = xstrdup (mnt.mnt_fstype);
me->me_type_malloced = 1;
me->me_dummy = MNT_IGNORE (&mnt) != 0;
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = dev_from_mount_options (mnt.mnt_mntopts);
while ((ret = getmntent (fp, &mnt)) == 0)
{
me = xmalloc (sizeof *me);
me->me_devname = xstrdup (mnt.mnt_special);
me->me_mountdir = xstrdup (mnt.mnt_mountp);
me->me_type = xstrdup (mnt.mnt_fstype);
me->me_type_malloced = 1;
me->me_dummy = MNT_IGNORE (&mnt) != 0;
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
me->me_dev = dev_from_mount_options (mnt.mnt_mntopts);
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
}
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
}
ret = fclose (fp) == EOF ? errno : 0 < ret ? 0 : -1;
ret = fclose (fp) == EOF ? errno : 0 < ret ? 0 : -1;
}
if (0 <= lockfd && close (lockfd) != 0)
@ -790,13 +790,13 @@ read_file_system_list (bool need_fs_type)
if (0 <= ret)
{
errno = ret;
goto free_then_fail;
errno = ret;
goto free_then_fail;
}
}
#endif /* MOUNTED_GETMNTENT2. */
#ifdef MOUNTED_VMOUNT /* AIX. */
#ifdef MOUNTED_VMOUNT /* AIX. */
{
int bufsize;
char *entries, *thisent;
@ -813,53 +813,53 @@ read_file_system_list (bool need_fs_type)
n_entries = mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries);
if (n_entries < 0)
{
int saved_errno = errno;
free (entries);
errno = saved_errno;
return NULL;
int saved_errno = errno;
free (entries);
errno = saved_errno;
return NULL;
}
for (i = 0, thisent = entries;
i < n_entries;
i++, thisent += vmp->vmt_length)
i < n_entries;
i++, thisent += vmp->vmt_length)
{
char *options, *ignore;
char *options, *ignore;
vmp = (struct vmount *) thisent;
me = xmalloc (sizeof *me);
if (vmp->vmt_flags & MNT_REMOTE)
{
char *host, *dir;
vmp = (struct vmount *) thisent;
me = xmalloc (sizeof *me);
if (vmp->vmt_flags & MNT_REMOTE)
{
char *host, *dir;
me->me_remote = 1;
/* Prepend the remote dirname. */
host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off;
dir = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off;
me->me_devname = xmalloc (strlen (host) + strlen (dir) + 2);
strcpy (me->me_devname, host);
strcat (me->me_devname, ":");
strcat (me->me_devname, dir);
}
else
{
me->me_remote = 0;
me->me_devname = xstrdup (thisent +
vmp->vmt_data[VMT_OBJECT].vmt_off);
}
me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype));
me->me_type_malloced = 1;
options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
ignore = strstr (options, "ignore");
me->me_dummy = (ignore
&& (ignore == options || ignore[-1] == ',')
&& (ignore[sizeof "ignore" - 1] == ','
|| ignore[sizeof "ignore" - 1] == '\0'));
me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want. */
me->me_remote = 1;
/* Prepend the remote dirname. */
host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off;
dir = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off;
me->me_devname = xmalloc (strlen (host) + strlen (dir) + 2);
strcpy (me->me_devname, host);
strcat (me->me_devname, ":");
strcat (me->me_devname, dir);
}
else
{
me->me_remote = 0;
me->me_devname = xstrdup (thisent +
vmp->vmt_data[VMT_OBJECT].vmt_off);
}
me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].vmt_off);
me->me_type = xstrdup (fstype_to_string (vmp->vmt_gfstype));
me->me_type_malloced = 1;
options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
ignore = strstr (options, "ignore");
me->me_dummy = (ignore
&& (ignore == options || ignore[-1] == ',')
&& (ignore[sizeof "ignore" - 1] == ','
|| ignore[sizeof "ignore" - 1] == '\0'));
me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want. */
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
/* Add to the linked list. */
*mtail = me;
mtail = &me->me_next;
}
free (entries);
}
@ -876,13 +876,13 @@ read_file_system_list (bool need_fs_type)
while (mount_list)
{
me = mount_list->me_next;
free (mount_list->me_devname);
free (mount_list->me_mountdir);
if (mount_list->me_type_malloced)
free (mount_list->me_type);
free (mount_list);
mount_list = me;
me = mount_list->me_next;
free (mount_list->me_devname);
free (mount_list->me_mountdir);
if (mount_list->me_type_malloced)
free (mount_list->me_type);
free (mount_list);
mount_list = me;
}
errno = saved_errno;

View File

@ -26,12 +26,12 @@
/* A mount table entry. */
struct mount_entry
{
char *me_devname; /* Device node name, including "/dev/". */
char *me_mountdir; /* Mount point directory name. */
char *me_type; /* "nfs", "4.2", etc. */
dev_t me_dev; /* Device number of me_mountdir. */
unsigned int me_dummy : 1; /* Nonzero for dummy file systems. */
unsigned int me_remote : 1; /* Nonzero for remote fileystems. */
char *me_devname; /* Device node name, including "/dev/". */
char *me_mountdir; /* Mount point directory name. */
char *me_type; /* "nfs", "4.2", etc. */
dev_t me_dev; /* Device number of me_mountdir. */
unsigned int me_dummy : 1; /* Nonzero for dummy file systems. */
unsigned int me_remote : 1; /* Nonzero for remote fileystems. */
unsigned int me_type_malloced : 1; /* Nonzero if me_type was malloced. */
struct mount_entry *me_next;
};

230
op_c.c
View File

@ -85,16 +85,16 @@ void RGBtoHSL(int r,int g,int b,byte * hr,byte * sr,byte* lr)
else
{
if (l<=0.5)
s = (max - min) / (max + min);
s = (max - min) / (max + min);
else
s = (max - min) / (2 - (max + min));
s = (max - min) / (2 - (max + min));
if (max == rd)
h = 42.5 * (gd-bd)/(max-min);
h = 42.5 * (gd-bd)/(max-min);
else if (max == gd)
h = 42.5 * (bd-rd)/(max-min)+85;
h = 42.5 * (bd-rd)/(max-min)+85;
else
h = 42.5 * (rd-gd)/(max-min)+170;
h = 42.5 * (rd-gd)/(max-min)+170;
if (h<0) h+=255;
}
@ -111,8 +111,8 @@ void HSLtoRGB(byte H,byte S,byte L, byte* R, byte* G, byte* B)
if(S==0)
{
*R=*G=*B=L;
return;
*R=*G=*B=L;
return;
}
hf = H / 255.0;
@ -120,9 +120,9 @@ void HSLtoRGB(byte H,byte S,byte L, byte* R, byte* G, byte* B)
sf = S / 255.0;
if (lf<=0.5)
q = lf*(1+sf);
q = lf*(1+sf);
else
q = lf+sf-lf*sf;
q = lf+sf-lf*sf;
p = 2*lf-q;
rf = hf + (1 / 3.0);
@ -137,31 +137,31 @@ void HSLtoRGB(byte H,byte S,byte L, byte* R, byte* G, byte* B)
if (bf > 1) bf-=1;
if (rf < 1/6.0)
rf = p + ((q-p)*6*rf);
rf = p + ((q-p)*6*rf);
else if(rf < 0.5)
rf = q;
rf = q;
else if(rf < 2/3.0)
rf = p + ((q-p)*6*(2/3.0-rf));
rf = p + ((q-p)*6*(2/3.0-rf));
else
rf = p;
rf = p;
if (gf < 1/6.0)
gf = p + ((q-p)*6*gf);
gf = p + ((q-p)*6*gf);
else if(gf < 0.5)
gf = q;
gf = q;
else if(gf < 2/3.0)
gf = p + ((q-p)*6*(2/3.0-gf));
gf = p + ((q-p)*6*(2/3.0-gf));
else
gf = p;
gf = p;
if (bf < 1/6.0)
bf = p + ((q-p)*6*bf);
bf = p + ((q-p)*6*bf);
else if(bf < 0.5)
bf = q;
bf = q;
else if(bf < 2/3.0)
bf = p + ((q-p)*6*(2/3.0-bf));
bf = p + ((q-p)*6*(2/3.0-bf));
else
bf = p;
bf = p;
*R = rf * (255);
*G = gf * (255);
@ -382,15 +382,15 @@ void Cluster_Analyser(Cluster * c,Table_occurence * to)
for (v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
for (b=c->bmin;b<=c->bmax;b++)
{
nbocc=to->table[r + v + b]; // TO_Get
nbocc=to->table[r + v + b]; // TO_Get
if (nbocc)
{
if (r<rmin) rmin=r;
else if (r>rmax) rmax=r;
else if (r>rmax) rmax=r;
if (v<vmin) vmin=v;
else if (v>vmax) vmax=v;
else if (v>vmax) vmax=v;
if (b<bmin) bmin=b;
else if (b>bmax) bmax=b;
else if (b>bmax) bmax=b;
c->occurences+=nbocc;
}
}
@ -402,77 +402,77 @@ void Cluster_Analyser(Cluster * c,Table_occurence * to)
for(r=c->rmin<<16;r<=c->rmax<<16;r+=1<<16)
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
{
rmin=r;
goto RMAX;
}
}
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
{
rmin=r;
goto RMAX;
}
}
RMAX:
for(r=c->rmax<<16;r>=rmin;r-=1<<16)
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
{
rmax=r;
goto VMIN;
}
}
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
{
rmax=r;
goto VMIN;
}
}
VMIN:
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
for(r=rmin;r<=rmax;r+=1<<16)
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
{
vmin=v;
goto VMAX;
}
}
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
{
vmin=v;
goto VMAX;
}
}
VMAX:
for(v=c->vmax<<8;v>=vmin;v-=1<<8)
for(r=rmin;r<=rmax;r+=1<<16)
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
{
vmax=v;
goto BMIN;
}
}
for(b=c->bmin;b<=c->bmax;b++)
{
if(to->table[r + v + b]) // TO_Get
{
vmax=v;
goto BMIN;
}
}
BMIN:
for(b=c->bmin;b<=c->bmax;b++)
for(r=rmin;r<=rmax;r+=1<<16)
for(v=vmin;v<=vmax;v+=1<<8)
{
if(to->table[r + v + b]) // TO_Get
{
bmin=b;
goto BMAX;
}
}
for(v=vmin;v<=vmax;v+=1<<8)
{
if(to->table[r + v + b]) // TO_Get
{
bmin=b;
goto BMAX;
}
}
BMAX:
for(b=c->bmax;b>=bmin;b--)
for(r=rmin;r<=rmax;r+=1<<16)
for(v=vmin;v<=vmax;v+=1<<8)
{
if(to->table[r + v + b]) // TO_Get
{
bmax=b;
goto ENDCRUSH;
}
}
for(v=vmin;v<=vmax;v+=1<<8)
{
if(to->table[r + v + b]) // TO_Get
{
bmax=b;
goto ENDCRUSH;
}
}
ENDCRUSH:
// Il faut quand même parcourir la partie utile du cluster, pour savoir combien il y a d'occurences
for(r=rmin;r<=rmax;r+=1<<16)
for(v=vmin;v<=vmax;v+=1<<8)
for(b=bmin;b<=bmax;b++)
{
c->occurences+=to->table[r + v + b]; // TO_Get
}
for(b=bmin;b<=bmax;b++)
{
c->occurences+=to->table[r + v + b]; // TO_Get
}
c->rmin=rmin>>16; c->rmax=rmax>>16;
c->vmin=vmin>>8; c->vmax=vmax>>8;
@ -812,9 +812,9 @@ void CS_Generer(ClusterSet * cs,Table_occurence * to)
// On met ces deux nouveaux clusters dans le clusterSet... sauf s'ils sont vides
if(Nouveau1.occurences>0)
CS_Set(cs,&Nouveau1);
CS_Set(cs,&Nouveau1);
if(Nouveau2.occurences>0)
CS_Set(cs,&Nouveau2);
CS_Set(cs,&Nouveau2);
}
}
@ -934,20 +934,20 @@ DegradeSet * DS_New(ClusterSet * cs)
n=(DegradeSet *)malloc(sizeof(DegradeSet));
if (n!=NULL)
{
// On recopie les paramŠtres demands
n->nbmax=cs->nbmax;
// On recopie les paramŠtres demands
n->nbmax=cs->nbmax;
// On tente d'allouer la table
n->degrades=(Degrade *)malloc((n->nbmax)*sizeof(Degrade));
if (n->degrades!=0)
// C'est bon! On initialise
DS_Init(n,cs);
else
{
// Table impossible … allouer
free(n);
n=0;
}
// On tente d'allouer la table
n->degrades=(Degrade *)malloc((n->nbmax)*sizeof(Degrade));
if (n->degrades!=0)
// C'est bon! On initialise
DS_Init(n,cs);
else
{
// Table impossible … allouer
free(n);
n=0;
}
}
return n;
@ -969,21 +969,21 @@ void DS_Generer(DegradeSet * ds,ClusterSet * cs)
// Pour chacun des clusters … traiter
for (ic=1;ic<cs->nb;ic++)
{
// On recherche le dgrad le plus proche de la chrominance du cluster
mdegr=-1;
mdiff=99999999;
for (id=0;id<ds->nb;id++)
{
diff=abs(cs->clusters[ic].h - ds->degrades[id].hue);
if ((mdiff>diff) && (diff<16))
{
mdegr=id;
mdiff=diff;
}
}
// On recherche le dgrad le plus proche de la chrominance du cluster
mdegr=-1;
mdiff=99999999;
for (id=0;id<ds->nb;id++)
{
diff=abs(cs->clusters[ic].h - ds->degrades[id].hue);
if ((mdiff>diff) && (diff<16))
{
mdegr=id;
mdiff=diff;
}
}
// Si on a trouv un dgrad dans lequel inclure le cluster
if (mdegr!=-1)
// Si on a trouv un dgrad dans lequel inclure le cluster
if (mdegr!=-1)
{
// On met … jour le dgrad
if (cs->clusters[ic].h < ds->degrades[mdegr].min)
@ -1042,10 +1042,10 @@ Table_conversion * Optimiser_palette(Bitmap24B image,int taille,struct Composant
{
// C'est bon, on a pu tout allouer
// On génère les clusters (avec l'algo du median cut)
// On génère les clusters (avec l'algo du median cut)
CS_Generer(cs,to);
// On calcule la teinte de chaque pixel (Luminance et chrominance)
// On calcule la teinte de chaque pixel (Luminance et chrominance)
CS_Calculer_teintes(cs,to);
ds=DS_New(cs);
@ -1055,11 +1055,11 @@ Table_conversion * Optimiser_palette(Bitmap24B image,int taille,struct Composant
DS_Delete(ds);
}
// Enfin on trie les clusters (donc les couleurs de la palette) dans un ordre sympa : par couleur, et par luminosité pour chaque couleur
// Enfin on trie les clusters (donc les couleurs de la palette) dans un ordre sympa : par couleur, et par luminosité pour chaque couleur
CS_Trier_par_luminance(cs);
CS_Trier_par_chrominance(cs);
// Enfin on génère la palette et la table de correspondance entre chaque couleur 24b et sa couleur palette associée.
// Enfin on génère la palette et la table de correspondance entre chaque couleur 24b et sa couleur palette associée.
CS_Generer_TC_et_Palette(cs,tc,palette);
CS_Delete(cs);
@ -1105,11 +1105,11 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i
float ERouge,EVert,EBleu;
// On initialise les variables de parcours:
Courant =Source; // Le pixel dont on s'occupe
Courant =Source; // Le pixel dont on s'occupe
Suivant =Courant+largeur; // Le pixel en dessous
C_plus1 =Courant+1; // Le pixel à droite
S_moins1=Suivant-1; // Le pixel en bas à gauche
S_plus1 =Suivant+1; // Le pixel en bas à droite
C_plus1 =Courant+1; // Le pixel à droite
S_moins1=Suivant-1; // Le pixel en bas à gauche
S_plus1 =Suivant+1; // Le pixel en bas à droite
D =Dest;
// On parcours chaque pixel:
@ -1137,7 +1137,7 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i
EBleu =(Bleu *7)/16.0;
if (Pos_X+1<largeur)
{
// Valeur_modifiee fait la somme des 2 params en bornant sur [0,255]
// Valeur_modifiee fait la somme des 2 params en bornant sur [0,255]
C_plus1->R=Valeur_modifiee(C_plus1->R,ERouge);
C_plus1->V=Valeur_modifiee(C_plus1->V,EVert );
C_plus1->B=Valeur_modifiee(C_plus1->B,EBleu );

View File

@ -4308,38 +4308,38 @@ void Rectangle_Degrade_0_5(void)
if(Min(RAX,RBX)<Limite_Gauche_Zoom) // On dépasse du zoom à gauche
{
decalage_largeur += Limite_Gauche_Zoom - Min(RAX,RBX);
decalage_gauche = Limite_Gauche_Zoom;
decalage_largeur += Limite_Gauche_Zoom - Min(RAX,RBX);
decalage_gauche = Limite_Gauche_Zoom;
}
if(Max(RAX,RBX)>Limite_visible_Droite_Zoom) // On dépasse du zoom à droite
decalage_largeur += Max(RAX,RBX) - Limite_visible_Droite_Zoom;
decalage_largeur += Max(RAX,RBX) - Limite_visible_Droite_Zoom;
if(Min(RAY,RBY)<Limite_Haut_Zoom) // On dépasse du zoom en haut
{
decalage_hauteur += Limite_Haut_Zoom - Min(RAY,RBY);
decalage_haut = Limite_Haut_Zoom;
decalage_hauteur += Limite_Haut_Zoom - Min(RAY,RBY);
decalage_haut = Limite_Haut_Zoom;
}
if(Max(RAY,RBY)>Limite_visible_Bas_Zoom) // On dépasse du zoom en bas
decalage_hauteur += Max(RAY,RBY) - Limite_visible_Bas_Zoom;
decalage_hauteur += Max(RAY,RBY) - Limite_visible_Bas_Zoom;
if(largeur > decalage_largeur)
{
if(decalage_haut==0) // La ligne du haut est visible
Ligne_horizontale_XOR_Zoom(decalage_gauche>0?decalage_gauche:Min(RAX,RBX),Min(RAY,RBY),largeur-decalage_largeur);
Ligne_horizontale_XOR_Zoom(decalage_gauche>0?decalage_gauche:Min(RAX,RBX),Min(RAY,RBY),largeur-decalage_largeur);
if(Max(RAY,RBY)<Limite_visible_Bas_Zoom) // La ligne du bas est visible
Ligne_horizontale_XOR_Zoom(decalage_gauche>0?decalage_gauche:Min(RAX,RBX),Max(RAY,RBY),largeur-decalage_largeur);
Ligne_horizontale_XOR_Zoom(decalage_gauche>0?decalage_gauche:Min(RAX,RBX),Max(RAY,RBY),largeur-decalage_largeur);
}
if(hauteur>decalage_hauteur)
{
if(decalage_gauche==0) // La ligne de gauche est visible
Ligne_verticale_XOR_Zoom(Min(RAX,RBX),decalage_haut>0?decalage_haut:Min(RAY,RBY),hauteur-decalage_hauteur);
Ligne_verticale_XOR_Zoom(Min(RAX,RBX),decalage_haut>0?decalage_haut:Min(RAY,RBY),hauteur-decalage_hauteur);
if(Max(RAX,RBX)<Limite_visible_Droite_Zoom) // La ligne de droite est visible
Ligne_verticale_XOR_Zoom(Max(RAX,RBX),decalage_haut>0?decalage_haut:Min(RAY,RBY),hauteur-decalage_hauteur);
Ligne_verticale_XOR_Zoom(Max(RAX,RBX),decalage_haut>0?decalage_haut:Min(RAY,RBY),hauteur-decalage_hauteur);
}
}
@ -4405,7 +4405,7 @@ void Rectangle_Degrade_12_9(void)
Operation_POP(&Debut_X);
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
if(SDL_GetModState() & KMOD_SHIFT)
Rectifier_coordonnees_a_45_degres(Debut_X,Debut_Y,&Pinceau_X,&Pinceau_Y);
Rectifier_coordonnees_a_45_degres(Debut_X,Debut_Y,&Pinceau_X,&Pinceau_Y);
Aff_coords_rel_ou_abs(Debut_X,Debut_Y);
@ -4454,15 +4454,15 @@ void Rectangle_Degrade_0_9(void)
Effacer_ligne_Preview(Vecteur_Debut_X,Vecteur_Debut_Y,Vecteur_Fin_X,Vecteur_Fin_Y);
// Et enfin on trace le rectangle avec le dégradé dedans !
// if (Mouse_K==Ancien_Mouse_K) // TODO sauver l'ancien mouse K à la place de la couleur dans l'étape 1. Modifier aussi les autres étapes pour pouvoir annuler à tout moment.
Tracer_rectangle_degrade(Rect_Debut_X,Rect_Debut_Y,Rect_Fin_X,Rect_Fin_Y,Vecteur_Debut_X,Vecteur_Debut_Y,Vecteur_Fin_X,Vecteur_Fin_Y);
// if (Mouse_K==Ancien_Mouse_K) // TODO sauver l'ancien mouse K à la place de la couleur dans l'étape 1. Modifier aussi les autres étapes pour pouvoir annuler à tout moment.
Tracer_rectangle_degrade(Rect_Debut_X,Rect_Debut_Y,Rect_Fin_X,Rect_Fin_Y,Vecteur_Debut_X,Vecteur_Debut_Y,Vecteur_Fin_X,Vecteur_Fin_Y);
Attendre_fin_de_click();
if ((Config.Coords_rel) && (Menu_visible))
{
Print_dans_menu("X: Y: ",0);
Print_coordonnees();
Print_dans_menu("X: Y: ",0);
Print_coordonnees();
}
}
/////////////////////////////////////////////////// OPERATION_LIGNES_CENTREES
@ -4480,7 +4480,7 @@ void Lignes_centrees_12_0(void)
Shade_Table=(Mouse_K==A_GAUCHE)?Shade_Table_gauche:Shade_Table_droite;
if ((Config.Coords_rel) && (Menu_visible))
Print_dans_menu("X:± 0 Y:± 0",0);
Print_dans_menu("X:± 0 Y:± 0",0);
Operation_PUSH(Mouse_K);
Operation_PUSH(Pinceau_X);

View File

@ -16,82 +16,82 @@
static char *sep(char *path)
{
char *tmp, c;
char *tmp, c;
tmp = strrchr(path, '/');
if(tmp) {
c = tmp[1];
tmp[1] = 0;
if (chdir(path)) {
return NULL;
}
tmp[1] = c;
tmp = strrchr(path, '/');
if(tmp) {
c = tmp[1];
tmp[1] = 0;
if (chdir(path)) {
return NULL;
}
tmp[1] = c;
return tmp + 1;
}
return tmp + 1;
}
return path;
return path;
}
char *realpath(const char *_path, char *resolved_path)
{
int fd = open(".", O_RDONLY), l;
char current_dir_path[PATH_MAX];
char path[PATH_MAX], lnk[PATH_MAX], *tmp = (char *)"";
int fd = open(".", O_RDONLY), l;
char current_dir_path[PATH_MAX];
char path[PATH_MAX], lnk[PATH_MAX], *tmp = (char *)"";
if (fd < 0) {
return NULL;
}
getcwd(current_dir_path,PATH_MAX);
strncpy(path, _path, PATH_MAX);
if (fd < 0) {
return NULL;
}
getcwd(current_dir_path,PATH_MAX);
strncpy(path, _path, PATH_MAX);
if (chdir(path)) {
if (errno == ENOTDIR) {
#if defined(__WIN32__) || defined(__MORPHOS__)
// No symbolic links and no readlink()
l = -1;
#else
l = readlink(path, lnk, PATH_MAX);
#endif
if (!(tmp = sep(path))) {
resolved_path = NULL;
goto abort;
}
if (l < 0) {
if (errno != EINVAL) {
resolved_path = NULL;
goto abort;
}
} else {
lnk[l] = 0;
if (!(tmp = sep(lnk))) {
resolved_path = NULL;
goto abort;
}
}
} else {
resolved_path = NULL;
goto abort;
}
}
if (chdir(path)) {
if (errno == ENOTDIR) {
#if defined(__WIN32__) || defined(__MORPHOS__)
// No symbolic links and no readlink()
l = -1;
#else
l = readlink(path, lnk, PATH_MAX);
#endif
if (!(tmp = sep(path))) {
resolved_path = NULL;
goto abort;
}
if (l < 0) {
if (errno != EINVAL) {
resolved_path = NULL;
goto abort;
}
} else {
lnk[l] = 0;
if (!(tmp = sep(lnk))) {
resolved_path = NULL;
goto abort;
}
}
} else {
resolved_path = NULL;
goto abort;
}
}
if(resolved_path==NULL) // if we called realpath with null as a 2nd arg
resolved_path = (char*) malloc( PATH_MAX );
if(resolved_path==NULL) // if we called realpath with null as a 2nd arg
resolved_path = (char*) malloc( PATH_MAX );
if (!getcwd(resolved_path, PATH_MAX)) {
resolved_path = NULL;
goto abort;
}
if (!getcwd(resolved_path, PATH_MAX)) {
resolved_path = NULL;
goto abort;
}
if(strcmp(resolved_path, "/") && *tmp) {
strcat(resolved_path, "/");
}
if(strcmp(resolved_path, "/") && *tmp) {
strcat(resolved_path, "/");
}
strcat(resolved_path, tmp);
strcat(resolved_path, tmp);
abort:
chdir(current_dir_path);
close(fd);
return resolved_path;
chdir(current_dir_path);
close(fd);
return resolved_path;
}

18
texte.c
View File

@ -149,7 +149,7 @@ void Ajout_fonte(const char *Nom)
}
else
{
return;
return;
}
#else
return;
@ -303,8 +303,8 @@ void Initialisation_Texte(void)
int i,number;
char home_dir[MAXPATHLEN];
char *font_path_list[3] = {
"/System/Library/Fonts",
"/Library/Fonts"
"/System/Library/Fonts",
"/Library/Fonts"
};
number = 3;
// Make sure we also search into the user's fonts directory
@ -325,14 +325,14 @@ void Initialisation_Texte(void)
#ifdef USE_XLIB
{
int i,number;
Display* dpy = XOpenDisplay(NULL);
char** font_path_list = XGetFontPath(dpy,&number);
int i,number;
Display* dpy = XOpenDisplay(NULL);
char** font_path_list = XGetFontPath(dpy,&number);
for(i=0;i<number;i++)
for_each_file(*(font_path_list+i),Ajout_fonte);
for(i=0;i<number;i++)
for_each_file(*(font_path_list+i),Ajout_fonte);
XFreeFontPath(font_path_list);
XFreeFontPath(font_path_list);
}
#endif
#endif

View File

@ -1,6 +1,6 @@
/* Grafx2 - The Ultimate 256-color bitmap paint program
Copyright 2008 Franck Charlet
Copyright 2008 Franck Charlet
Copyright 2007-2008 Adrien Destugues
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
@ -283,7 +283,7 @@ void Afficher_menu(void)
if (!Fenetre)
{
if ((Mouse_Y<Menu_Ordonnee) && // Souris dans l'image
if ((Mouse_Y<Menu_Ordonnee) && // Souris dans l'image
( (!Loupe_Mode) || (Mouse_X<Principal_Split) || (Mouse_X>=Principal_X_Zoom) ))
{
// Dans ces deux cas, on met dans la barre les XY courant, même s'il y a des chances que ça soit recouvert si la souris est sur un bouton (trop chiant à vérifier)
@ -474,8 +474,8 @@ void Print_compteur(short X,short Y,char * Chaine,byte Couleur_texte,byte Couleu
// Macros pour écrire des litteraux binaires.
// Ex: Ob(11110000) == 0xF0
#define Ob(x) ((unsigned)Ob_(0 ## x ## uL))
#define Ob_(x) ((x & 1) | (x >> 2 & 2) | (x >> 4 & 4) | (x >> 6 & 8) | \
(x >> 8 & 16) | (x >> 10 & 32) | (x >> 12 & 64) | (x >> 14 & 128))
#define Ob_(x) ((x & 1) | (x >> 2 & 2) | (x >> 4 & 4) | (x >> 6 & 8) | \
(x >> 8 & 16) | (x >> 10 & 32) | (x >> 12 & 64) | (x >> 14 & 128))
byte Caractere[14][8] = {
{ // 0
@ -1431,17 +1431,17 @@ void Afficher_curseur(void)
Debut_Y=Mouse_Y-Curseur_Decalage_Y[Temp];
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15 && Pos_X < Largeur_ecran;Pos_X++,Compteur_X++)
{
if( Pos_X < 0 ) continue;
{
if( Pos_X < 0 ) continue;
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15 && Pos_Y < Hauteur_ecran;Pos_Y++,Compteur_Y++)
{
if( Pos_Y < 0 || Pos_Y >= Hauteur_ecran) continue;
if( Pos_Y < 0 || Pos_Y >= Hauteur_ecran) continue;
Couleur=SPRITE_CURSEUR[Temp][Compteur_Y][Compteur_X];
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(Pos_X,Pos_Y);
if (Couleur!=CM_Trans)
Pixel(Pos_X,Pos_Y,Couleur);
}
}
}
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),Compteur_X,Compteur_Y);
}
@ -1526,18 +1526,18 @@ void Afficher_curseur(void)
Debut_Y=Mouse_Y-Curseur_Decalage_Y[Forme];
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15;Pos_X++,Compteur_X++)
{
if(Pos_X<0) continue;
if(Pos_X>=Largeur_ecran) break;
if(Pos_X<0) continue;
if(Pos_X>=Largeur_ecran) break;
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15;Pos_Y++,Compteur_Y++)
{
if(Pos_Y<0) continue;
if(Pos_Y>=Hauteur_ecran) break;
if(Pos_Y<0) continue;
if(Pos_Y>=Hauteur_ecran) break;
Couleur=SPRITE_CURSEUR[Forme][Compteur_Y][Compteur_X];
// On sauvegarde dans FOND_CURSEUR pour restaurer plus tard
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(Pos_X,Pos_Y);
if (Couleur!=CM_Trans)
Pixel(Pos_X,Pos_Y,Couleur);
}
// On sauvegarde dans FOND_CURSEUR pour restaurer plus tard
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(Pos_X,Pos_Y);
if (Couleur!=CM_Trans)
Pixel(Pos_X,Pos_Y,Couleur);
}
}
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),Compteur_X,Compteur_Y);
break;
@ -1824,14 +1824,14 @@ void Effacer_curseur(void)
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15;Pos_X++,Compteur_X++)
{
if(Pos_X<0) continue;
if(Pos_X>=Largeur_ecran) break;
if(Pos_X<0) continue;
if(Pos_X>=Largeur_ecran) break;
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15;Pos_Y++,Compteur_Y++)
{
if(Pos_Y<0) continue;
if(Pos_Y>=Hauteur_ecran) break;
{
if(Pos_Y<0) continue;
if(Pos_Y>=Hauteur_ecran) break;
Pixel(Pos_X,Pos_Y,FOND_CURSEUR[Compteur_Y][Compteur_X]);
}
}
}
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),Compteur_X,Compteur_Y);
break;