Fixes all the tabulation problems.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@465 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
bdf86b06a8
commit
154f5e824a
88
Makefile
88
Makefile
@ -153,7 +153,7 @@ else
|
|||||||
else
|
else
|
||||||
|
|
||||||
ifdef GP2XCROSS
|
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
|
CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc
|
||||||
BIN = grafx2.gpe
|
BIN = grafx2.gpe
|
||||||
CFGBIN = gfxcfg.gpe
|
CFGBIN = gfxcfg.gpe
|
||||||
@ -207,76 +207,76 @@ all : $(BIN) $(CFGBIN)
|
|||||||
debug : $(BIN)
|
debug : $(BIN)
|
||||||
|
|
||||||
release : $(BIN) $(CFGBIN)
|
release : $(BIN) $(CFGBIN)
|
||||||
$(STRIP) $(BIN)
|
$(STRIP) $(BIN)
|
||||||
$(STRIP) $(CFGBIN)
|
$(STRIP) $(CFGBIN)
|
||||||
|
|
||||||
# A release zip archive
|
# A release zip archive
|
||||||
ziprelease: version $(BIN) $(BINCFG) release
|
ziprelease: version $(BIN) $(BINCFG) release
|
||||||
tar cvzf src-svn`svnversion | sed 's/:/-/'`.tgz *.c *.h Makefile Makefile.dep gfx2.ico gfx2cfg.ico
|
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)
|
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
|
$(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 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)
|
$(BIN) : $(OBJ) $(OBJRES)
|
||||||
$(CC) $(OBJ) $(OBJRES) -o $(BIN) $(LOPT)
|
$(CC) $(OBJ) $(OBJRES) -o $(BIN) $(LOPT)
|
||||||
|
|
||||||
$(CFGBIN) : $(CFGOBJ) $(CFGOBJRES)
|
$(CFGBIN) : $(CFGOBJ) $(CFGOBJRES)
|
||||||
$(CC) $(CFGOBJ) $(CFGOBJRES) -o $(CFGBIN) $(LOPT)
|
$(CC) $(CFGOBJ) $(CFGOBJRES) -o $(CFGBIN) $(LOPT)
|
||||||
|
|
||||||
# SVN revision number
|
# SVN revision number
|
||||||
version.c :
|
version.c :
|
||||||
echo "char SVNRevision[]=\"`svnversion`\";" > version.c
|
echo "char SVNRevision[]=\"`svnversion`\";" > version.c
|
||||||
|
|
||||||
version : delversion version.c $(OBJDIR)/version.o
|
version : delversion version.c $(OBJDIR)/version.o
|
||||||
|
|
||||||
delversion :
|
delversion :
|
||||||
$(DELCOMMAND) version.c
|
$(DELCOMMAND) version.c
|
||||||
|
|
||||||
$(OBJDIR)/%.o :
|
$(OBJDIR)/%.o :
|
||||||
$(if $(wildcard $(OBJDIR)),,$(MKDIR) $(OBJDIR))
|
$(if $(wildcard $(OBJDIR)),,$(MKDIR) $(OBJDIR))
|
||||||
$(CC) $(COPT) -c $*.c -o $(OBJDIR)/$*.o
|
$(CC) $(COPT) -c $*.c -o $(OBJDIR)/$*.o
|
||||||
|
|
||||||
depend :
|
depend :
|
||||||
$(CC) -MM *.c | sed 's:^[^ ]:$$(OBJDIR)/&:' > Makefile.dep
|
$(CC) -MM *.c | sed 's:^[^ ]:$$(OBJDIR)/&:' > Makefile.dep
|
||||||
|
|
||||||
$(OBJDIR)/winres.o : gfx2.ico
|
$(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
|
$(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 :
|
clean :
|
||||||
$(DELCOMMAND) $(OBJ) $(CFGOBJ) $(OBJDIR)/version.o $(OBJRES) $(CFGOBJRES)
|
$(DELCOMMAND) $(OBJ) $(CFGOBJ) $(OBJDIR)/version.o $(OBJRES) $(CFGOBJRES)
|
||||||
$(DELCOMMAND) $(BIN) $(CFGBIN)
|
$(DELCOMMAND) $(BIN) $(CFGBIN)
|
||||||
|
|
||||||
install : $(BIN) $(CFGBIN)
|
install : $(BIN) $(CFGBIN)
|
||||||
echo "#!/bin/sh" > $(bindir)/grafx2
|
echo "#!/bin/sh" > $(bindir)/grafx2
|
||||||
echo $(datadir)/grafx2/$(BIN) '$$*' >> $(bindir)/grafx2
|
echo $(datadir)/grafx2/$(BIN) '$$*' >> $(bindir)/grafx2
|
||||||
chmod 755 $(bindir)/grafx2
|
chmod 755 $(bindir)/grafx2
|
||||||
echo "#!/bin/sh" > $(bindir)/gfxcfg
|
echo "#!/bin/sh" > $(bindir)/gfxcfg
|
||||||
echo $(datadir)/grafx2/$(CFGBIN) '$$*' >> $(bindir)/gfxcfg
|
echo $(datadir)/grafx2/$(CFGBIN) '$$*' >> $(bindir)/gfxcfg
|
||||||
chmod 755 $(bindir)/gfxcfg
|
chmod 755 $(bindir)/gfxcfg
|
||||||
$(if $(wildcard $(datadir)/grafx2),,$(MKDIR) $(datadir)/grafx2)
|
$(if $(wildcard $(datadir)/grafx2),,$(MKDIR) $(datadir)/grafx2)
|
||||||
$(CP) $(BIN) $(datadir)/grafx2/
|
$(CP) $(BIN) $(datadir)/grafx2/
|
||||||
$(CP) $(CFGBIN) $(datadir)/grafx2/
|
$(CP) $(CFGBIN) $(datadir)/grafx2/
|
||||||
$(CP) gfx2.dat $(datadir)/grafx2/
|
$(CP) gfx2.dat $(datadir)/grafx2/
|
||||||
$(CP) gfx2.gif $(datadir)/grafx2/
|
$(CP) gfx2.gif $(datadir)/grafx2/
|
||||||
$(CP) gfx2cfg.gif $(datadir)/grafx2/
|
$(CP) gfx2cfg.gif $(datadir)/grafx2/
|
||||||
$(if $(wildcard $(datadir)/grafx2/fonts),,$(MKDIR) $(datadir)/grafx2/fonts)
|
$(if $(wildcard $(datadir)/grafx2/fonts),,$(MKDIR) $(datadir)/grafx2/fonts)
|
||||||
cd fonts && $(CP) * $(datadir)/grafx2/fonts/
|
cd fonts && $(CP) * $(datadir)/grafx2/fonts/
|
||||||
@echo Install complete
|
@echo Install complete
|
||||||
|
|
||||||
uninstall :
|
uninstall :
|
||||||
$(DELCOMMAND) $(bindir)/grafx2
|
$(DELCOMMAND) $(bindir)/grafx2
|
||||||
$(DELCOMMAND) $(bindir)/gfxcfg
|
$(DELCOMMAND) $(bindir)/gfxcfg
|
||||||
$(DELCOMMAND) $(datadir)/grafx2/$(BIN)
|
$(DELCOMMAND) $(datadir)/grafx2/$(BIN)
|
||||||
$(DELCOMMAND) $(datadir)/grafx2/$(CFGBIN)
|
$(DELCOMMAND) $(datadir)/grafx2/$(CFGBIN)
|
||||||
$(DELCOMMAND) $(datadir)/grafx2/gfx2.dat
|
$(DELCOMMAND) $(datadir)/grafx2/gfx2.dat
|
||||||
$(DELCOMMAND) $(datadir)/grafx2/gfx2.gif
|
$(DELCOMMAND) $(datadir)/grafx2/gfx2.gif
|
||||||
$(DELCOMMAND) $(datadir)/grafx2/gfx2cfg.gif
|
$(DELCOMMAND) $(datadir)/grafx2/gfx2cfg.gif
|
||||||
$(DELCOMMAND) $(datadir)/grafx2/fonts/*
|
$(DELCOMMAND) $(datadir)/grafx2/fonts/*
|
||||||
$(if $(wildcard $(datadir)/grafx2/fonts),,$(RMDIR) $(datadir)/grafx2/fonts)
|
$(if $(wildcard $(datadir)/grafx2/fonts),,$(RMDIR) $(datadir)/grafx2/fonts)
|
||||||
$(if $(wildcard $(datadir)/grafx2),,$(RMDIR) $(datadir)/grafx2)
|
$(if $(wildcard $(datadir)/grafx2),,$(RMDIR) $(datadir)/grafx2)
|
||||||
@echo Uninstall complete
|
@echo Uninstall complete
|
||||||
|
|
||||||
-include Makefile.dep
|
-include Makefile.dep
|
||||||
|
|
||||||
|
|||||||
10
SFont.h
10
SFont.h
@ -46,9 +46,9 @@ extern "C" {
|
|||||||
// To load the fonts, load the font image into YourFont->Surface
|
// To load the fonts, load the font image into YourFont->Surface
|
||||||
// and call InitFont( YourFont );
|
// and call InitFont( YourFont );
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SDL_Surface *Surface;
|
SDL_Surface *Surface;
|
||||||
int CharPos[512];
|
int CharPos[512];
|
||||||
int MaxPos;
|
int MaxPos;
|
||||||
} SFont_Font;
|
} SFont_Font;
|
||||||
|
|
||||||
// Initializes the font
|
// Initializes the font
|
||||||
@ -65,7 +65,7 @@ void SFont_FreeFont(SFont_Font* Font);
|
|||||||
// Destination: the suface you want to blit to
|
// Destination: the suface you want to blit to
|
||||||
// text: a string containing the text you want to blit.
|
// text: a string containing the text you want to blit.
|
||||||
void SFont_Write(SDL_Surface *Surface, const SFont_Font *Font, int x, int y,
|
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
|
// Returns the width of "text" in pixels
|
||||||
int SFont_TextWidth(const SFont_Font* Font, const char *text);
|
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
|
// Blits a string to Surface with centered x position
|
||||||
void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font* Font, int y,
|
void SFont_WriteCenter(SDL_Surface *Surface, const SFont_Font* Font, int y,
|
||||||
const char *text);
|
const char *text);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4820,7 +4820,7 @@ void Bouton_Spray_Menu(void)
|
|||||||
Print_dans_fenetre(50,151," Mono",CM_Noir,CM_Clair);
|
Print_dans_fenetre(50,151," Mono",CM_Noir,CM_Clair);
|
||||||
else
|
else
|
||||||
Print_dans_fenetre(50,151,"Multi",CM_Noir,CM_Clair);
|
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();
|
Afficher_curseur();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
24
brush.c
24
brush.c
@ -1,6 +1,6 @@
|
|||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||||
|
|
||||||
Copyright 2008 Franck Charlet
|
Copyright 2008 Franck Charlet
|
||||||
Copyright 2007-2008 Adrien Destugues
|
Copyright 2007-2008 Adrien Destugues
|
||||||
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
|
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
|
else
|
||||||
@ -210,7 +210,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
|
|||||||
Smear_Brosse_Largeur
|
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;
|
Smear_Debut=0;
|
||||||
}
|
}
|
||||||
@ -236,7 +236,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
|
|||||||
Smear_Brosse[Position]=Couleur_temporaire;
|
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;
|
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);
|
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;
|
break;
|
||||||
@ -320,7 +320,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
|
|||||||
if (Smear_Debut)
|
if (Smear_Debut)
|
||||||
{
|
{
|
||||||
if ((Largeur>0) && (Hauteur>0))
|
if ((Largeur>0) && (Hauteur>0))
|
||||||
{
|
{
|
||||||
Copier_une_partie_d_image_dans_une_autre(Principal_Ecran,
|
Copier_une_partie_d_image_dans_une_autre(Principal_Ecran,
|
||||||
Debut_X,Debut_Y,
|
Debut_X,Debut_Y,
|
||||||
Largeur,Hauteur,
|
Largeur,Hauteur,
|
||||||
@ -330,7 +330,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
|
|||||||
Debut_Compteur_Y,
|
Debut_Compteur_Y,
|
||||||
Smear_Brosse_Largeur);
|
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;
|
Smear_Debut=0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -425,7 +425,7 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
|
|||||||
if (Smear_Debut)
|
if (Smear_Debut)
|
||||||
{
|
{
|
||||||
if ((Largeur>0) && (Hauteur>0))
|
if ((Largeur>0) && (Hauteur>0))
|
||||||
{
|
{
|
||||||
Copier_une_partie_d_image_dans_une_autre(Principal_Ecran,
|
Copier_une_partie_d_image_dans_une_autre(Principal_Ecran,
|
||||||
Debut_X,Debut_Y,
|
Debut_X,Debut_Y,
|
||||||
Largeur,Hauteur,
|
Largeur,Hauteur,
|
||||||
@ -434,8 +434,8 @@ void Afficher_pinceau(short X,short Y,byte Couleur,byte Preview)
|
|||||||
Debut_Compteur_X,
|
Debut_Compteur_X,
|
||||||
Debut_Compteur_Y,
|
Debut_Compteur_Y,
|
||||||
Smear_Brosse_Largeur);
|
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;
|
Smear_Debut=0;
|
||||||
}
|
}
|
||||||
else
|
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);
|
Couleur_temporaire=Lit_pixel_dans_ecran_courant(Pos_X,Pos_Y);
|
||||||
Position=(Compteur_Y*Smear_Brosse_Largeur)+Compteur_X;
|
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
|
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) )
|
&& (Compteur_Y>=Smear_Min_Y) && (Compteur_X>=Smear_Min_X) )
|
||||||
Afficher_pixel(Pos_X,Pos_Y,Smear_Brosse[Position]);
|
Afficher_pixel(Pos_X,Pos_Y,Smear_Brosse[Position]);
|
||||||
Smear_Brosse[Position]=Couleur_temporaire;
|
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])
|
if (Pinceau_Sprite[(TAILLE_MAXI_PINCEAU*Compteur_Y)+Compteur_X])
|
||||||
Afficher_pixel(Pos_X,Pos_Y,Couleur);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
42
divers.c
42
divers.c
@ -163,9 +163,9 @@ int Get_input(void)
|
|||||||
INPUT_Nouveau_Mouse_X = event.motion.x/Pixel_width;
|
INPUT_Nouveau_Mouse_X = event.motion.x/Pixel_width;
|
||||||
INPUT_Nouveau_Mouse_Y = event.motion.y/Pixel_height;
|
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...
|
// 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.
|
// 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;
|
if (INPUT_Nouveau_Mouse_X == Mouse_X && INPUT_Nouveau_Mouse_Y == Mouse_Y) return 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_MOUSEBUTTONDOWN:
|
case SDL_MOUSEBUTTONDOWN:
|
||||||
@ -173,8 +173,8 @@ int Get_input(void)
|
|||||||
switch(event.button.button)
|
switch(event.button.button)
|
||||||
{
|
{
|
||||||
case SDL_BUTTON_LEFT:
|
case SDL_BUTTON_LEFT:
|
||||||
INPUT_Nouveau_Mouse_K = 1;
|
INPUT_Nouveau_Mouse_K = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_BUTTON_MIDDLE: // Pour SDL, 2 = clic milieu. Pour nous c'est le clic droit
|
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)
|
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:
|
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);
|
int ToucheR = Conversion_Touche(event.key.keysym);
|
||||||
|
|
||||||
if(ToucheR == Config_Touche[4])
|
if(ToucheR == Config_Touche[4])
|
||||||
@ -300,23 +300,23 @@ int Get_input(void)
|
|||||||
// Mostly useful for the gp2x
|
// Mostly useful for the gp2x
|
||||||
// FIXME : should be made configurable with gfxcfg.
|
// FIXME : should be made configurable with gfxcfg.
|
||||||
case SDL_JOYBUTTONUP:
|
case SDL_JOYBUTTONUP:
|
||||||
if(event.jbutton.button==13 || event.jbutton.button==14)
|
if(event.jbutton.button==13 || event.jbutton.button==14)
|
||||||
INPUT_Nouveau_Mouse_K=0;
|
INPUT_Nouveau_Mouse_K=0;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SDL_JOYBUTTONDOWN:
|
case SDL_JOYBUTTONDOWN:
|
||||||
switch(event.jbutton.button)
|
switch(event.jbutton.button)
|
||||||
{
|
{
|
||||||
|
|
||||||
case 13:
|
case 13:
|
||||||
INPUT_Nouveau_Mouse_K = 1;
|
INPUT_Nouveau_Mouse_K = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 14:
|
case 14:
|
||||||
INPUT_Nouveau_Mouse_K = 2;
|
INPUT_Nouveau_Mouse_K = 2;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -484,12 +484,12 @@ int Get_input(void)
|
|||||||
INPUT_Nouveau_Mouse_X*Pixel_width,
|
INPUT_Nouveau_Mouse_X*Pixel_width,
|
||||||
INPUT_Nouveau_Mouse_Y*Pixel_height
|
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();
|
Flush_update();
|
||||||
return 0; // Il ne s'est rien passé
|
return 0; // Il ne s'est rien passé
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Gestion "avancée" du curseur: interdire la descente du curseur dans le
|
//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)
|
// AvailMem is misleading on os4 (os4 caches stuff in memory that you can still allocate)
|
||||||
return 10*1024*1024;
|
return 10*1024*1024;
|
||||||
#elif defined(__AROS__) || defined(__MORPHOS__)
|
#elif defined(__AROS__) || defined(__MORPHOS__)
|
||||||
return AvailMem(MEMF_ANY);
|
return AvailMem(MEMF_ANY);
|
||||||
#else
|
#else
|
||||||
struct sysinfo info;
|
struct sysinfo info;
|
||||||
sysinfo(&info);
|
sysinfo(&info);
|
||||||
|
|||||||
2
files.c
2
files.c
@ -642,7 +642,7 @@ void for_each_file(const char * Nom_repertoire, void Callback(const char *))
|
|||||||
int Position_nom_fichier;
|
int Position_nom_fichier;
|
||||||
strcpy(Nom_fichier_complet, Nom_repertoire);
|
strcpy(Nom_fichier_complet, Nom_repertoire);
|
||||||
Repertoire_Courant=opendir(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);
|
strcat(Nom_fichier_complet, SEPARATEUR_CHEMIN);
|
||||||
Position_nom_fichier = strlen(Nom_fichier_complet);
|
Position_nom_fichier = strlen(Nom_fichier_complet);
|
||||||
while ((Enreg=readdir(Repertoire_Courant)))
|
while ((Enreg=readdir(Repertoire_Courant)))
|
||||||
|
|||||||
372
gfxcfg.c
372
gfxcfg.c
@ -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 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 ***/
|
/*** 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...
|
// Utilisé pour afficher la liste complète des raccourcis dans le format du wiki...
|
||||||
/* printf("||%s||%s||%s %s||\n", ConfigTouche[Indice_touche].Libelle,
|
/* printf("||%s||%s||%s %s||\n", ConfigTouche[Indice_touche].Libelle,
|
||||||
Nom_touche(Touche),
|
Nom_touche(Touche),
|
||||||
ConfigTouche[Indice_touche].Explic1,
|
ConfigTouche[Indice_touche].Explic1,
|
||||||
ConfigTouche[Indice_touche].Explic2); */
|
ConfigTouche[Indice_touche].Explic2); */
|
||||||
break;
|
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 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];
|
char Temp[70];
|
||||||
uint8_t i,j,Num_titre,Num_choix;
|
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
|
// SFont ne gère pas les \n donc on le fait nous même
|
||||||
for(i=0;i<=strlen(Titre);i++)
|
for(i=0;i<=strlen(Titre);i++)
|
||||||
{
|
{
|
||||||
if (Titre[i]=='\n' || Titre[i]==0)
|
if (Titre[i]=='\n' || Titre[i]==0)
|
||||||
{
|
{
|
||||||
memcpy(Temp,Titre+j,i-j);
|
memcpy(Temp,Titre+j,i-j);
|
||||||
Temp[i-j]=0;
|
Temp[i-j]=0;
|
||||||
j=i+1;
|
j=i+1;
|
||||||
SFont_Write(Ecran,MyFont,x1+3,y1+Num_titre*9,Temp);
|
SFont_Write(Ecran,MyFont,x1+3,y1+Num_titre*9,Temp);
|
||||||
Num_titre++;
|
Num_titre++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Maintenant on fait pareil pour les divers choix proposés
|
// 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
|
// SFont ne gère pas les \n donc on le fait nous même
|
||||||
for(i=0;i<=strlen(Choix);i++)
|
for(i=0;i<=strlen(Choix);i++)
|
||||||
{
|
{
|
||||||
if (Choix[i]=='\n' || Choix[i]==0)
|
if (Choix[i]=='\n' || Choix[i]==0)
|
||||||
{
|
{
|
||||||
memcpy(Temp,Choix+j,i-j);
|
memcpy(Temp,Choix+j,i-j);
|
||||||
Temp[i-j]=0;
|
Temp[i-j]=0;
|
||||||
j=i+1;
|
j=i+1;
|
||||||
SFont_Write(Ecran,MyFont,x1+3+50*Num_choix,y1+(Num_titre+2)*9,Temp);
|
SFont_Write(Ecran,MyFont,x1+3+50*Num_choix,y1+(Num_titre+2)*9,Temp);
|
||||||
Num_choix++;
|
Num_choix++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Option_choisie = Choix_debut;
|
Option_choisie = Choix_debut;
|
||||||
@ -351,25 +351,25 @@ uint8_t Fenetre_choix(int Largeur, int Hauteur, const char* Titre, const char* C
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
Touche = Lire_Touche();
|
Touche = Lire_Touche();
|
||||||
switch(Touche)
|
switch(Touche)
|
||||||
{
|
{
|
||||||
case SDLK_LEFT:
|
case SDLK_LEFT:
|
||||||
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur);
|
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur);
|
||||||
if(Option_choisie==0) Option_choisie = Num_choix - 1;
|
if(Option_choisie==0) Option_choisie = Num_choix - 1;
|
||||||
else Option_choisie --;
|
else Option_choisie --;
|
||||||
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur_choix);
|
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur_choix);
|
||||||
break;
|
break;
|
||||||
case SDLK_RIGHT:
|
case SDLK_RIGHT:
|
||||||
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur);
|
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur);
|
||||||
if(Option_choisie==Num_choix-1) Option_choisie = 0;
|
if(Option_choisie==Num_choix-1) Option_choisie = 0;
|
||||||
else Option_choisie ++;
|
else Option_choisie ++;
|
||||||
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur_choix);
|
Cadre(x1+3+50*Option_choisie,y1+(Num_titre+3)*9,15,2,Couleur_choix);
|
||||||
default:
|
default:
|
||||||
break;
|
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);
|
}while(Touche!=SDLK_RETURN);
|
||||||
|
|
||||||
Tout_ecrire(); // Efface la boite de dialogue
|
Tout_ecrire(); // Efface la boite de dialogue
|
||||||
@ -384,21 +384,21 @@ void Test_duplic()
|
|||||||
|
|
||||||
for(i=0;i<NB_MAX_TOUCHES;i++)
|
for(i=0;i<NB_MAX_TOUCHES;i++)
|
||||||
{
|
{
|
||||||
if(ConfigTouche[i].Touche!=0xFF) // FIXME
|
if(ConfigTouche[i].Touche!=0xFF) // FIXME
|
||||||
{
|
{
|
||||||
j=0;
|
j=0;
|
||||||
Pas_encore_erreur=true;
|
Pas_encore_erreur=true;
|
||||||
while(j<NB_MAX_TOUCHES && Pas_encore_erreur)
|
while(j<NB_MAX_TOUCHES && Pas_encore_erreur)
|
||||||
{
|
{
|
||||||
if(i!=j && ConfigTouche[i].Touche==ConfigTouche[j].Touche)
|
if(i!=j && ConfigTouche[i].Touche==ConfigTouche[j].Touche)
|
||||||
{
|
{
|
||||||
Pas_encore_erreur = false;
|
Pas_encore_erreur = false;
|
||||||
Erreur[i] = true;
|
Erreur[i] = true;
|
||||||
}
|
}
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
if (Pas_encore_erreur) Erreur[i] = false;
|
if (Pas_encore_erreur) Erreur[i] = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,15 +410,15 @@ bool Validation()
|
|||||||
|
|
||||||
while(i<NB_MAX_TOUCHES && !Y_a_des_erreurs)
|
while(i<NB_MAX_TOUCHES && !Y_a_des_erreurs)
|
||||||
{
|
{
|
||||||
Y_a_des_erreurs = Erreur[i];
|
Y_a_des_erreurs = Erreur[i];
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Y_a_des_erreurs)
|
if (Y_a_des_erreurs)
|
||||||
Choix_enreg = 4 - Fenetre_choix(30,12,
|
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);
|
"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
|
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;
|
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 + Decalage_curseur > 0)
|
||||||
{
|
{
|
||||||
if(Position_curseur <= HAUTEUR_FIN_SETUP - HAUTEUR_DEBUT_SETUP && Position_curseur > 0)
|
if(Position_curseur <= HAUTEUR_FIN_SETUP - HAUTEUR_DEBUT_SETUP && Position_curseur > 0)
|
||||||
{
|
{
|
||||||
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
|
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
|
||||||
COULEUR_SETUP);
|
COULEUR_SETUP);
|
||||||
(Position_curseur) -- ;
|
(Position_curseur) -- ;
|
||||||
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
|
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
|
||||||
COULEUR_SELECT);
|
COULEUR_SELECT);
|
||||||
}
|
}
|
||||||
else if(Decalage_curseur>0)
|
else if(Decalage_curseur>0)
|
||||||
{
|
{
|
||||||
(Decalage_curseur) -- ;
|
(Decalage_curseur) -- ;
|
||||||
Tout_ecrire();
|
Tout_ecrire();
|
||||||
}
|
}
|
||||||
Ecrire_commentaire(Position_curseur + Decalage_curseur);
|
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 + Decalage_curseur < (NB_MAX_TOUCHES-1))
|
||||||
{
|
{
|
||||||
if(Position_curseur < 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,
|
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
|
||||||
COULEUR_SETUP);
|
COULEUR_SETUP);
|
||||||
(Position_curseur) ++ ;
|
(Position_curseur) ++ ;
|
||||||
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
|
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
|
||||||
COULEUR_SELECT);
|
COULEUR_SELECT);
|
||||||
}
|
}
|
||||||
else if(Decalage_curseur < (NB_MAX_TOUCHES-1))
|
else if(Decalage_curseur < (NB_MAX_TOUCHES-1))
|
||||||
{
|
{
|
||||||
(Decalage_curseur) ++ ;
|
(Decalage_curseur) ++ ;
|
||||||
Tout_ecrire();
|
Tout_ecrire();
|
||||||
}
|
}
|
||||||
Ecrire_commentaire(Position_curseur + Decalage_curseur );
|
Ecrire_commentaire(Position_curseur + Decalage_curseur );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -471,23 +471,23 @@ void Page_up()
|
|||||||
{
|
{
|
||||||
if(Position_curseur+Decalage_curseur>0)
|
if(Position_curseur+Decalage_curseur>0)
|
||||||
{
|
{
|
||||||
if(Position_curseur>0)
|
if(Position_curseur>0)
|
||||||
{
|
{
|
||||||
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
|
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
|
||||||
COULEUR_SETUP);
|
COULEUR_SETUP);
|
||||||
Position_curseur = 0 ;
|
Position_curseur = 0 ;
|
||||||
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
|
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
|
||||||
COULEUR_SELECT);
|
COULEUR_SELECT);
|
||||||
}
|
}
|
||||||
else if(Decalage_curseur>0)
|
else if(Decalage_curseur>0)
|
||||||
{
|
{
|
||||||
if(Decalage_curseur > HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP)
|
if(Decalage_curseur > HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP)
|
||||||
Decalage_curseur-=HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP;
|
Decalage_curseur-=HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP;
|
||||||
else Decalage_curseur=0;
|
else Decalage_curseur=0;
|
||||||
|
|
||||||
Tout_ecrire();
|
Tout_ecrire();
|
||||||
}
|
}
|
||||||
Ecrire_commentaire(Position_curseur+Decalage_curseur);
|
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+Decalage_curseur<(NB_MAX_TOUCHES-1))
|
||||||
{
|
{
|
||||||
if(Position_curseur<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,
|
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
|
||||||
COULEUR_SETUP);
|
COULEUR_SETUP);
|
||||||
Position_curseur = HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP ;
|
Position_curseur = HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP ;
|
||||||
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
|
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur,
|
||||||
COULEUR_SELECT);
|
COULEUR_SELECT);
|
||||||
}
|
}
|
||||||
else if(Decalage_curseur<(NB_MAX_TOUCHES-1))
|
else if(Decalage_curseur<(NB_MAX_TOUCHES-1))
|
||||||
{
|
{
|
||||||
if(Decalage_curseur + Position_curseur + HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP < (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;
|
Decalage_curseur+=HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Decalage_curseur=NB_MAX_TOUCHES-1-HAUTEUR_FIN_SETUP+HAUTEUR_DEBUT_SETUP;
|
Decalage_curseur=NB_MAX_TOUCHES-1-HAUTEUR_FIN_SETUP+HAUTEUR_DEBUT_SETUP;
|
||||||
|
|
||||||
Tout_ecrire();
|
Tout_ecrire();
|
||||||
}
|
}
|
||||||
Ecrire_commentaire(Position_curseur+Decalage_curseur);
|
Ecrire_commentaire(Position_curseur+Decalage_curseur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -528,12 +528,12 @@ void Select()
|
|||||||
SDL_UpdateRect(Ecran,3,(HAUTEUR_DEBUT_SETUP+Position_curseur)*9,630,9);
|
SDL_UpdateRect(Ecran,3,(HAUTEUR_DEBUT_SETUP+Position_curseur)*9,630,9);
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
Touche = Lire_Touche();
|
Touche = Lire_Touche();
|
||||||
if (Touche == SDLK_ESCAPE)
|
if (Touche == SDLK_ESCAPE)
|
||||||
{
|
{
|
||||||
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
|
Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur,
|
||||||
COULEUR_SETUP);
|
COULEUR_SETUP);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Touche != 0)
|
if (Touche != 0)
|
||||||
{
|
{
|
||||||
@ -541,7 +541,7 @@ void Select()
|
|||||||
Test_duplic();
|
Test_duplic();
|
||||||
// Des X ont pu être ajoutés ou enlevés sur n'importe quelle ligne..
|
// Des X ont pu être ajoutés ou enlevés sur n'importe quelle ligne..
|
||||||
// pour faire simple, on rafraîchit toute la page.
|
// pour faire simple, on rafraîchit toute la page.
|
||||||
Tout_ecrire();
|
Tout_ecrire();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -555,33 +555,33 @@ void Setup()
|
|||||||
Test_duplic();
|
Test_duplic();
|
||||||
Tout_ecrire();
|
Tout_ecrire();
|
||||||
do{
|
do{
|
||||||
Touche = Lire_Touche();
|
Touche = Lire_Touche();
|
||||||
switch(Touche)
|
switch(Touche)
|
||||||
{
|
{
|
||||||
case SDLK_UP:
|
case SDLK_UP:
|
||||||
Scroll_haut();
|
Scroll_haut();
|
||||||
break;
|
break;
|
||||||
case SDLK_DOWN:
|
case SDLK_DOWN:
|
||||||
Scroll_bas();
|
Scroll_bas();
|
||||||
break;
|
break;
|
||||||
case SDLK_PAGEUP:
|
case SDLK_PAGEUP:
|
||||||
Page_up();
|
Page_up();
|
||||||
break;
|
break;
|
||||||
case SDLK_PAGEDOWN:
|
case SDLK_PAGEDOWN:
|
||||||
Page_down();
|
Page_down();
|
||||||
break;
|
break;
|
||||||
case SDLK_RETURN:
|
case SDLK_RETURN:
|
||||||
Select();
|
Select();
|
||||||
break;
|
break;
|
||||||
case SDLK_DELETE:
|
case SDLK_DELETE:
|
||||||
//Unselect();
|
//Unselect();
|
||||||
break;
|
break;
|
||||||
case SDLK_ESCAPE:
|
case SDLK_ESCAPE:
|
||||||
Sortie_OK=Validation();
|
Sortie_OK=Validation();
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break; // On ne fait rien pour les autres touches
|
break; // On ne fait rien pour les autres touches
|
||||||
}
|
}
|
||||||
} while(!Sortie_OK);
|
} while(!Sortie_OK);
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -637,9 +637,9 @@ void Enregistrer_config()
|
|||||||
|
|
||||||
for(Indice_touche=0; Indice_touche<NB_MAX_TOUCHES;Indice_touche++)
|
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].Numero);
|
||||||
write_word_le(Fichier,ConfigTouche[Indice_touche].Touche);
|
write_word_le(Fichier,ConfigTouche[Indice_touche].Touche);
|
||||||
write_word_le(Fichier,0xFF);
|
write_word_le(Fichier,0xFF);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -664,8 +664,8 @@ int main(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
|
|||||||
|
|
||||||
if (Verifier_ecriture_possible())
|
if (Verifier_ecriture_possible())
|
||||||
{
|
{
|
||||||
/* On initialise SDL */
|
/* On initialise SDL */
|
||||||
SDL_Init(SDL_INIT_VIDEO);
|
SDL_Init(SDL_INIT_VIDEO);
|
||||||
{
|
{
|
||||||
// Routine pour définir l'icone.
|
// Routine pour définir l'icone.
|
||||||
SDL_Surface * Icone;
|
SDL_Surface * Icone;
|
||||||
@ -690,44 +690,44 @@ int main(__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
|
|||||||
SDL_EnableKeyRepeat(250, 32);
|
SDL_EnableKeyRepeat(250, 32);
|
||||||
SDL_EnableUNICODE(SDL_ENABLE);
|
SDL_EnableUNICODE(SDL_ENABLE);
|
||||||
|
|
||||||
/* On initialise SFont */
|
/* On initialise SFont */
|
||||||
strcpy(Nom_fichier, Repertoire_donnees);
|
strcpy(Nom_fichier, Repertoire_donnees);
|
||||||
strcat(Nom_fichier, "fonts/8pxfont.png");
|
strcat(Nom_fichier, "fonts/8pxfont.png");
|
||||||
MyFont = SFont_InitFont(IMG_Load(Nom_fichier));
|
MyFont = SFont_InitFont(IMG_Load(Nom_fichier));
|
||||||
|
|
||||||
if(MyFont==NULL)
|
if(MyFont==NULL)
|
||||||
{
|
{
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Dessiner_ecran_principal();
|
Dessiner_ecran_principal();
|
||||||
|
|
||||||
if(!Initialiser_config())
|
if(!Initialiser_config())
|
||||||
{
|
{
|
||||||
Setup();
|
Setup();
|
||||||
Enregistrer_config();
|
Enregistrer_config();
|
||||||
|
|
||||||
/* On fait un peu de nettoyage avant de s'en aller */
|
/* On fait un peu de nettoyage avant de s'en aller */
|
||||||
SFont_FreeFont(MyFont);
|
SFont_FreeFont(MyFont);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SFont_FreeFont(MyFont);
|
SFont_FreeFont(MyFont);
|
||||||
SDL_Quit();
|
SDL_Quit();
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
puts("Error: you mustn't run this setup program from a read-only drive!\n");
|
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("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("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("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.");
|
puts("unprotect your floppy disk if you really want to run it from this outdated medium.");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
2
graph.h
2
graph.h
@ -20,7 +20,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void Liste2tables(word * Liste, short Pas, byte Mode, byte * Table_inc,
|
void Liste2tables(word * Liste, short Pas, byte Mode, byte * Table_inc,
|
||||||
byte * Table_dec
|
byte * Table_dec
|
||||||
);
|
);
|
||||||
|
|
||||||
void Transformer_point(short X, short Y,
|
void Transformer_point(short X, short Y,
|
||||||
|
|||||||
154
init.c
154
init.c
@ -77,74 +77,74 @@ void Rechercher_drives(void)
|
|||||||
dosList = LockDosList(lockDosListFlags);
|
dosList = LockDosList(lockDosListFlags);
|
||||||
if (dosList)
|
if (dosList)
|
||||||
{
|
{
|
||||||
dosList = NextDosEntry(dosList, LDF_VOLUMES);
|
dosList = NextDosEntry(dosList, LDF_VOLUMES);
|
||||||
while (dosList)
|
while (dosList)
|
||||||
{
|
{
|
||||||
if (dosList->dol_Type == DLT_VOLUME dosList->dol_Name && dosList->dol_Task)
|
if (dosList->dol_Type == DLT_VOLUME dosList->dol_Name && dosList->dol_Task)
|
||||||
{
|
{
|
||||||
TEXT name[256];
|
TEXT name[256];
|
||||||
CONST_STRPTR volume_name = (CONST_STRPTR)BADDR(dosList->dol_Name)+1;
|
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;
|
CONST_STRPTR device_name = (CONST_STRPTR)((struct Task *)dosList->dol_Task->mp_SigTask)->tc_Node.ln_Name;
|
||||||
BPTR volume_lock;
|
BPTR volume_lock;
|
||||||
|
|
||||||
stccpy(name, volume_name, sizeof(name));
|
stccpy(name, volume_name, sizeof(name));
|
||||||
strncat(name, ":", sizeof(name));
|
strncat(name, ":", sizeof(name));
|
||||||
|
|
||||||
volume_lock = Lock(name, SHARED_LOCK);
|
volume_lock = Lock(name, SHARED_LOCK);
|
||||||
if (volume_lock)
|
if (volume_lock)
|
||||||
{
|
{
|
||||||
Ajouter_lecteur(device_name[0],LECTEUR_HDD,name);
|
Ajouter_lecteur(device_name[0],LECTEUR_HDD,name);
|
||||||
UnLock(volume_lock);
|
UnLock(volume_lock);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dosList = NextDosEntry(dosList, LDF_VOLUMES);
|
dosList = NextDosEntry(dosList, LDF_VOLUMES);
|
||||||
}
|
}
|
||||||
|
|
||||||
UnLockDosList(lockDosListFlags);
|
UnLockDosList(lockDosListFlags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#elif defined (__WIN32__)
|
#elif defined (__WIN32__)
|
||||||
|
|
||||||
char NomLecteur[]="A:\\";
|
char NomLecteur[]="A:\\";
|
||||||
int DriveBits = GetLogicalDrives();
|
int DriveBits = GetLogicalDrives();
|
||||||
int IndiceLecteur;
|
int IndiceLecteur;
|
||||||
int IndiceBit;
|
int IndiceBit;
|
||||||
// Sous Windows, on a la totale, presque aussi bien que sous DOS:
|
// Sous Windows, on a la totale, presque aussi bien que sous DOS:
|
||||||
IndiceLecteur = 0;
|
IndiceLecteur = 0;
|
||||||
for (IndiceBit=0; IndiceBit<26 && IndiceLecteur<23; IndiceBit++)
|
for (IndiceBit=0; IndiceBit<26 && IndiceLecteur<23; IndiceBit++)
|
||||||
{
|
{
|
||||||
if ( (1 << IndiceBit) & DriveBits )
|
if ( (1 << IndiceBit) & DriveBits )
|
||||||
{
|
{
|
||||||
// On a ce lecteur, il faut maintenant déterminer son type "physique".
|
// On a ce lecteur, il faut maintenant déterminer son type "physique".
|
||||||
// pour profiter des jolies icones de X-man.
|
// pour profiter des jolies icones de X-man.
|
||||||
int TypeLecteur;
|
int TypeLecteur;
|
||||||
char CheminLecteur[]="A:\\";
|
char CheminLecteur[]="A:\\";
|
||||||
// Cette API Windows est étrange, je dois m'y faire...
|
// Cette API Windows est étrange, je dois m'y faire...
|
||||||
CheminLecteur[0]='A'+IndiceBit;
|
CheminLecteur[0]='A'+IndiceBit;
|
||||||
switch (GetDriveType(CheminLecteur))
|
switch (GetDriveType(CheminLecteur))
|
||||||
{
|
{
|
||||||
case DRIVE_CDROM:
|
case DRIVE_CDROM:
|
||||||
TypeLecteur=LECTEUR_CDROM;
|
TypeLecteur=LECTEUR_CDROM;
|
||||||
break;
|
break;
|
||||||
case DRIVE_REMOTE:
|
case DRIVE_REMOTE:
|
||||||
TypeLecteur=LECTEUR_NETWORK;
|
TypeLecteur=LECTEUR_NETWORK;
|
||||||
break;
|
break;
|
||||||
case DRIVE_REMOVABLE:
|
case DRIVE_REMOVABLE:
|
||||||
TypeLecteur=LECTEUR_FLOPPY_3_5;
|
TypeLecteur=LECTEUR_FLOPPY_3_5;
|
||||||
break;
|
break;
|
||||||
case DRIVE_FIXED:
|
case DRIVE_FIXED:
|
||||||
TypeLecteur=LECTEUR_HDD;
|
TypeLecteur=LECTEUR_HDD;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
TypeLecteur=LECTEUR_NETWORK;
|
TypeLecteur=LECTEUR_NETWORK;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
NomLecteur[0]='A'+IndiceBit;
|
NomLecteur[0]='A'+IndiceBit;
|
||||||
Ajouter_lecteur(NomLecteur[0], TypeLecteur,NomLecteur);
|
Ajouter_lecteur(NomLecteur[0], TypeLecteur,NomLecteur);
|
||||||
IndiceLecteur++;
|
IndiceLecteur++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
//Sous les différents unix, on va mettre
|
//Sous les différents unix, on va mettre
|
||||||
@ -158,28 +158,28 @@ void Rechercher_drives(void)
|
|||||||
char lettre = 'A';
|
char lettre = 'A';
|
||||||
|
|
||||||
#if defined(__BEOS__) || defined(__HAIKU__)
|
#if defined(__BEOS__) || defined(__HAIKU__)
|
||||||
char * Home = getenv("$HOME");
|
char * Home = getenv("$HOME");
|
||||||
#else
|
#else
|
||||||
char * Home = getenv("HOME");
|
char * Home = getenv("HOME");
|
||||||
#endif
|
#endif
|
||||||
Ajouter_lecteur('/', LECTEUR_HDD, "/");
|
Ajouter_lecteur('/', LECTEUR_HDD, "/");
|
||||||
if(Home)
|
if(Home)
|
||||||
Ajouter_lecteur('~', LECTEUR_HDD, Home);
|
Ajouter_lecteur('~', LECTEUR_HDD, Home);
|
||||||
|
|
||||||
Liste_points_montage = read_file_system_list(false);
|
Liste_points_montage = read_file_system_list(false);
|
||||||
|
|
||||||
while(Liste_points_montage != NULL)
|
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"))
|
if(Liste_points_montage -> me_dummy == 0 && !strcmp(Liste_points_montage->me_mountdir,"/") && !strcmp(Liste_points_montage->me_mountdir,"/home"))
|
||||||
{
|
{
|
||||||
Ajouter_lecteur(lettre++,
|
Ajouter_lecteur(lettre++,
|
||||||
Liste_points_montage->me_remote==1?LECTEUR_NETWORK:LECTEUR_HDD,
|
Liste_points_montage->me_remote==1?LECTEUR_NETWORK:LECTEUR_HDD,
|
||||||
Liste_points_montage->me_mountdir);
|
Liste_points_montage->me_mountdir);
|
||||||
}
|
}
|
||||||
next = Liste_points_montage -> me_next;
|
next = Liste_points_montage -> me_next;
|
||||||
free(Liste_points_montage -> me_type);
|
free(Liste_points_montage -> me_type);
|
||||||
free(Liste_points_montage);
|
free(Liste_points_montage);
|
||||||
Liste_points_montage = next;
|
Liste_points_montage = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -234,8 +234,8 @@ void Charger_DAT(void)
|
|||||||
Handle=fopen(Nom_du_fichier,"rb");
|
Handle=fopen(Nom_du_fichier,"rb");
|
||||||
if (Handle==NULL)
|
if (Handle==NULL)
|
||||||
{
|
{
|
||||||
DEBUG("Absent",0);
|
DEBUG("Absent",0);
|
||||||
Erreur(ERREUR_DAT_ABSENT);
|
Erreur(ERREUR_DAT_ABSENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!read_bytes(Handle, Palette_defaut,sizeof(T_Palette)))
|
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].Largeur = Largeur;
|
||||||
Mode_video[Nb_modes_video].Hauteur = Hauteur;
|
Mode_video[Nb_modes_video].Hauteur = Hauteur;
|
||||||
Mode_video[Nb_modes_video].Mode = Mode;
|
Mode_video[Nb_modes_video].Mode = Mode;
|
||||||
Mode_video[Nb_modes_video].Fullscreen = Fullscreen;
|
Mode_video[Nb_modes_video].Fullscreen = Fullscreen;
|
||||||
Mode_video[Nb_modes_video].Etat = Supporte;
|
Mode_video[Nb_modes_video].Etat = Supporte;
|
||||||
Nb_modes_video ++;
|
Nb_modes_video ++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -48,9 +48,9 @@
|
|||||||
// Taille de fichier, en octets
|
// Taille de fichier, en octets
|
||||||
int FileLength(FILE * Fichier)
|
int FileLength(FILE * Fichier)
|
||||||
{
|
{
|
||||||
struct stat infos_fichier;
|
struct stat infos_fichier;
|
||||||
fstat(fileno(Fichier),&infos_fichier);
|
fstat(fileno(Fichier),&infos_fichier);
|
||||||
return infos_fichier.st_size;
|
return infos_fichier.st_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Chargement des pixels dans l'écran principal
|
// Chargement des pixels dans l'écran principal
|
||||||
|
|||||||
42
moteur.c
42
moteur.c
@ -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
|
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
|
// Gestion de la souris
|
||||||
|
|
||||||
@ -975,7 +975,7 @@ void Gestion_principale(void)
|
|||||||
|
|
||||||
if(Curseur_dans_menu)
|
if(Curseur_dans_menu)
|
||||||
{
|
{
|
||||||
Curseur_dans_menu_precedent = 1;
|
Curseur_dans_menu_precedent = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -1991,29 +1991,29 @@ short Fenetre_Bouton_clicke(void)
|
|||||||
void Remappe_fond_fenetres(byte * Table_de_conversion, int Min_Y, int Max_Y)
|
void Remappe_fond_fenetres(byte * Table_de_conversion, int Min_Y, int Max_Y)
|
||||||
{
|
{
|
||||||
int Indice_fenetre;
|
int Indice_fenetre;
|
||||||
byte* EDI;
|
byte* EDI;
|
||||||
int dx,cx;
|
int dx,cx;
|
||||||
|
|
||||||
for (Indice_fenetre=0; Indice_fenetre<Fenetre; Indice_fenetre++)
|
for (Indice_fenetre=0; Indice_fenetre<Fenetre; Indice_fenetre++)
|
||||||
{
|
{
|
||||||
EDI = Fond_fenetre[Indice_fenetre];
|
EDI = Fond_fenetre[Indice_fenetre];
|
||||||
|
|
||||||
// Pour chaque ligne
|
// Pour chaque ligne
|
||||||
for(dx=0; dx<Pile_Fenetre_Hauteur[Indice_fenetre]*Menu_Facteur_Y;dx++)
|
for(dx=0; dx<Pile_Fenetre_Hauteur[Indice_fenetre]*Menu_Facteur_Y;dx++)
|
||||||
{
|
{
|
||||||
if (dx+Pile_Fenetre_Pos_Y[Indice_fenetre]>Max_Y)
|
if (dx+Pile_Fenetre_Pos_Y[Indice_fenetre]>Max_Y)
|
||||||
return;
|
return;
|
||||||
if (dx+Pile_Fenetre_Pos_Y[Indice_fenetre]<Min_Y)
|
if (dx+Pile_Fenetre_Pos_Y[Indice_fenetre]<Min_Y)
|
||||||
{
|
{
|
||||||
EDI += Pile_Fenetre_Largeur[Indice_fenetre]*Menu_Facteur_X;
|
EDI += Pile_Fenetre_Largeur[Indice_fenetre]*Menu_Facteur_X;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// Pour chaque pixel
|
// Pour chaque pixel
|
||||||
for(cx=Pile_Fenetre_Largeur[Indice_fenetre]*Menu_Facteur_X;cx>0;cx--)
|
for(cx=Pile_Fenetre_Largeur[Indice_fenetre]*Menu_Facteur_X;cx>0;cx--)
|
||||||
{
|
{
|
||||||
*EDI = Table_de_conversion[*EDI];
|
*EDI = Table_de_conversion[*EDI];
|
||||||
EDI ++;
|
EDI ++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
454
mountlist.c
454
mountlist.c
@ -39,10 +39,10 @@
|
|||||||
# include <sys/param.h>
|
# include <sys/param.h>
|
||||||
#endif
|
#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
|
# if HAVE_SYS_UCRED_H
|
||||||
# include <grp.h> /* needed on OSF V4.0 for definition of NGROUPS,
|
# 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 */
|
# include <sys/ucred.h> /* needed by powerpc-apple-darwin1.3.7 */
|
||||||
# endif
|
# endif
|
||||||
# if HAVE_SYS_MOUNT_H
|
# if HAVE_SYS_MOUNT_H
|
||||||
@ -58,44 +58,44 @@
|
|||||||
# endif
|
# endif
|
||||||
#endif /* MOUNTED_GETFSSTAT */
|
#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>
|
# include <mntent.h>
|
||||||
# if !defined MOUNTED
|
# if !defined MOUNTED
|
||||||
# if defined _PATH_MOUNTED /* GNU libc */
|
# if defined _PATH_MOUNTED /* GNU libc */
|
||||||
# define MOUNTED _PATH_MOUNTED
|
# define MOUNTED _PATH_MOUNTED
|
||||||
# endif
|
# endif
|
||||||
# if defined MNT_MNTTAB /* HP-UX. */
|
# if defined MNT_MNTTAB /* HP-UX. */
|
||||||
# define MOUNTED MNT_MNTTAB
|
# define MOUNTED MNT_MNTTAB
|
||||||
# endif
|
# endif
|
||||||
# if defined MNTTABNAME /* Dynix. */
|
# if defined MNTTABNAME /* Dynix. */
|
||||||
# define MOUNTED MNTTABNAME
|
# define MOUNTED MNTTABNAME
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
|
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
|
||||||
# include <sys/mount.h>
|
# include <sys/mount.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
|
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
|
||||||
# include <sys/statvfs.h>
|
# include <sys/statvfs.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOUNTED_GETMNT /* Ultrix. */
|
#ifdef MOUNTED_GETMNT /* Ultrix. */
|
||||||
# include <sys/mount.h>
|
# include <sys/mount.h>
|
||||||
# include <sys/fs_types.h>
|
# include <sys/fs_types.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOUNTED_FS_STAT_DEV /* BeOS. */
|
#ifdef MOUNTED_FS_STAT_DEV /* BeOS. */
|
||||||
# include <fs_info.h>
|
# include <fs_info.h>
|
||||||
# include <dirent.h>
|
# include <dirent.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOUNTED_FREAD /* SVR2. */
|
#ifdef MOUNTED_FREAD /* SVR2. */
|
||||||
# include <mnttab.h>
|
# include <mnttab.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOUNTED_FREAD_FSTYP /* SVR3. */
|
#ifdef MOUNTED_FREAD_FSTYP /* SVR3. */
|
||||||
# include <mnttab.h>
|
# include <mnttab.h>
|
||||||
# include <sys/fstyp.h>
|
# include <sys/fstyp.h>
|
||||||
# include <sys/statfs.h>
|
# include <sys/statfs.h>
|
||||||
@ -105,11 +105,11 @@
|
|||||||
# include <mntent.h>
|
# include <mntent.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
|
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
|
||||||
# include <sys/mnttab.h>
|
# include <sys/mnttab.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOUNTED_VMOUNT /* AIX. */
|
#ifdef MOUNTED_VMOUNT /* AIX. */
|
||||||
# include <fshelp.h>
|
# include <fshelp.h>
|
||||||
# include <sys/vfs.h>
|
# include <sys/vfs.h>
|
||||||
#endif
|
#endif
|
||||||
@ -151,30 +151,30 @@
|
|||||||
#undef closedir
|
#undef closedir
|
||||||
|
|
||||||
#ifndef ME_DUMMY
|
#ifndef ME_DUMMY
|
||||||
# define ME_DUMMY(Fs_name, Fs_type) \
|
# define ME_DUMMY(Fs_name, Fs_type) \
|
||||||
(strcmp (Fs_type, "autofs") == 0 \
|
(strcmp (Fs_type, "autofs") == 0 \
|
||||||
|| strcmp (Fs_type, "none") == 0 \
|
|| strcmp (Fs_type, "none") == 0 \
|
||||||
|| strcmp (Fs_type, "proc") == 0 \
|
|| strcmp (Fs_type, "proc") == 0 \
|
||||||
|| strcmp (Fs_type, "subfs") == 0 \
|
|| strcmp (Fs_type, "subfs") == 0 \
|
||||||
|| strcmp (Fs_type, "sysfs") == 0 \
|
|| strcmp (Fs_type, "sysfs") == 0 \
|
||||||
|| strcmp (Fs_type, "usbfs") == 0 \
|
|| strcmp (Fs_type, "usbfs") == 0 \
|
||||||
|| strcmp (Fs_type, "devpts") == 0 \
|
|| strcmp (Fs_type, "devpts") == 0 \
|
||||||
|| strcmp (Fs_type, "tmpfs") == 0 \
|
|| strcmp (Fs_type, "tmpfs") == 0 \
|
||||||
/* for NetBSD 3.0 */ \
|
/* for NetBSD 3.0 */ \
|
||||||
|| strcmp (Fs_type, "kernfs") == 0 \
|
|| strcmp (Fs_type, "kernfs") == 0 \
|
||||||
/* for Irix 6.5 */ \
|
/* for Irix 6.5 */ \
|
||||||
|| strcmp (Fs_type, "ignore") == 0)
|
|| strcmp (Fs_type, "ignore") == 0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef ME_REMOTE
|
#ifndef ME_REMOTE
|
||||||
/* A file system is `remote' if its Fs_name contains a `:'
|
/* 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 `//'). */
|
or if (it is of type (smbfs or cifs) and its Fs_name starts with `//'). */
|
||||||
# define ME_REMOTE(Fs_name, Fs_type) \
|
# define ME_REMOTE(Fs_name, Fs_type) \
|
||||||
(strchr (Fs_name, ':') != NULL \
|
(strchr (Fs_name, ':') != NULL \
|
||||||
|| ((Fs_name)[0] == '/' \
|
|| ((Fs_name)[0] == '/' \
|
||||||
&& (Fs_name)[1] == '/' \
|
&& (Fs_name)[1] == '/' \
|
||||||
&& (strcmp (Fs_type, "smbfs") == 0 \
|
&& (strcmp (Fs_type, "smbfs") == 0 \
|
||||||
|| strcmp (Fs_type, "cifs") == 0)))
|
|| strcmp (Fs_type, "cifs") == 0)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if MOUNTED_GETMNTINFO
|
#if MOUNTED_GETMNTINFO
|
||||||
@ -287,7 +287,7 @@ fsp_to_string (const struct statfs *fsp)
|
|||||||
|
|
||||||
#endif /* MOUNTED_GETMNTINFO */
|
#endif /* MOUNTED_GETMNTINFO */
|
||||||
|
|
||||||
#ifdef MOUNTED_VMOUNT /* AIX. */
|
#ifdef MOUNTED_VMOUNT /* AIX. */
|
||||||
static char *
|
static char *
|
||||||
fstype_to_string (int t)
|
fstype_to_string (int t)
|
||||||
{
|
{
|
||||||
@ -326,10 +326,10 @@ dev_from_mount_options (char const *mount_options)
|
|||||||
errno = 0;
|
errno = 0;
|
||||||
dev = strtoul (optval, &optvalend, 16);
|
dev = strtoul (optval, &optvalend, 16);
|
||||||
if (optval != optvalend
|
if (optval != optvalend
|
||||||
&& (*optvalend == '\0' || *optvalend == ',')
|
&& (*optvalend == '\0' || *optvalend == ',')
|
||||||
&& ! (dev == ULONG_MAX && errno == ERANGE)
|
&& ! (dev == ULONG_MAX && errno == ERANGE)
|
||||||
&& dev == (dev_t) dev)
|
&& dev == (dev_t) dev)
|
||||||
return dev;
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
# endif
|
# endif
|
||||||
@ -394,18 +394,18 @@ read_file_system_list (bool need_fs_type)
|
|||||||
|
|
||||||
while ((mnt = getmntent (fp)))
|
while ((mnt = getmntent (fp)))
|
||||||
{
|
{
|
||||||
me = malloc (sizeof *me);
|
me = malloc (sizeof *me);
|
||||||
me->me_devname = strdup (mnt->mnt_fsname);
|
me->me_devname = strdup (mnt->mnt_fsname);
|
||||||
me->me_mountdir = strdup (mnt->mnt_dir);
|
me->me_mountdir = strdup (mnt->mnt_dir);
|
||||||
me->me_type = strdup (mnt->mnt_type);
|
me->me_type = strdup (mnt->mnt_type);
|
||||||
me->me_type_malloced = 1;
|
me->me_type_malloced = 1;
|
||||||
me->me_dummy = ME_DUMMY (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);
|
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
|
||||||
me->me_dev = dev_from_mount_options (mnt->mnt_opts);
|
me->me_dev = dev_from_mount_options (mnt->mnt_opts);
|
||||||
|
|
||||||
/* Add to the linked list. */
|
/* Add to the linked list. */
|
||||||
*mtail = me;
|
*mtail = me;
|
||||||
mtail = &me->me_next;
|
mtail = &me->me_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (endmntent (fp) == 0)
|
if (endmntent (fp) == 0)
|
||||||
@ -413,7 +413,7 @@ read_file_system_list (bool need_fs_type)
|
|||||||
}
|
}
|
||||||
#endif /* MOUNTED_GETMNTENT1. */
|
#endif /* MOUNTED_GETMNTENT1. */
|
||||||
|
|
||||||
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
|
#ifdef MOUNTED_GETMNTINFO /* 4.4BSD. */
|
||||||
{
|
{
|
||||||
struct statfs *fsp;
|
struct statfs *fsp;
|
||||||
int entries;
|
int entries;
|
||||||
@ -423,25 +423,25 @@ read_file_system_list (bool need_fs_type)
|
|||||||
return NULL;
|
return NULL;
|
||||||
for (; entries-- > 0; fsp++)
|
for (; entries-- > 0; fsp++)
|
||||||
{
|
{
|
||||||
char *fs_type = fsp_to_string (fsp);
|
char *fs_type = fsp_to_string (fsp);
|
||||||
|
|
||||||
me = xmalloc (sizeof *me);
|
me = xmalloc (sizeof *me);
|
||||||
me->me_devname = xstrdup (fsp->f_mntfromname);
|
me->me_devname = xstrdup (fsp->f_mntfromname);
|
||||||
me->me_mountdir = xstrdup (fsp->f_mntonname);
|
me->me_mountdir = xstrdup (fsp->f_mntonname);
|
||||||
me->me_type = fs_type;
|
me->me_type = fs_type;
|
||||||
me->me_type_malloced = 0;
|
me->me_type_malloced = 0;
|
||||||
me->me_dummy = ME_DUMMY (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);
|
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
|
||||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||||
|
|
||||||
/* Add to the linked list. */
|
/* Add to the linked list. */
|
||||||
*mtail = me;
|
*mtail = me;
|
||||||
mtail = &me->me_next;
|
mtail = &me->me_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* MOUNTED_GETMNTINFO */
|
#endif /* MOUNTED_GETMNTINFO */
|
||||||
|
|
||||||
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
|
#ifdef MOUNTED_GETMNTINFO2 /* NetBSD 3.0. */
|
||||||
{
|
{
|
||||||
struct statvfs *fsp;
|
struct statvfs *fsp;
|
||||||
int entries;
|
int entries;
|
||||||
@ -451,44 +451,44 @@ read_file_system_list (bool need_fs_type)
|
|||||||
return NULL;
|
return NULL;
|
||||||
for (; entries-- > 0; fsp++)
|
for (; entries-- > 0; fsp++)
|
||||||
{
|
{
|
||||||
me = xmalloc (sizeof *me);
|
me = xmalloc (sizeof *me);
|
||||||
me->me_devname = xstrdup (fsp->f_mntfromname);
|
me->me_devname = xstrdup (fsp->f_mntfromname);
|
||||||
me->me_mountdir = xstrdup (fsp->f_mntonname);
|
me->me_mountdir = xstrdup (fsp->f_mntonname);
|
||||||
me->me_type = xstrdup (fsp->f_fstypename);
|
me->me_type = xstrdup (fsp->f_fstypename);
|
||||||
me->me_type_malloced = 1;
|
me->me_type_malloced = 1;
|
||||||
me->me_dummy = ME_DUMMY (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);
|
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
|
||||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||||
|
|
||||||
/* Add to the linked list. */
|
/* Add to the linked list. */
|
||||||
*mtail = me;
|
*mtail = me;
|
||||||
mtail = &me->me_next;
|
mtail = &me->me_next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* MOUNTED_GETMNTINFO2 */
|
#endif /* MOUNTED_GETMNTINFO2 */
|
||||||
|
|
||||||
#ifdef MOUNTED_GETMNT /* Ultrix. */
|
#ifdef MOUNTED_GETMNT /* Ultrix. */
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
int val;
|
int val;
|
||||||
struct fs_data fsd;
|
struct fs_data fsd;
|
||||||
|
|
||||||
while (errno = 0,
|
while (errno = 0,
|
||||||
0 < (val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
|
0 < (val = getmnt (&offset, &fsd, sizeof (fsd), NOSTAT_MANY,
|
||||||
(char *) 0)))
|
(char *) 0)))
|
||||||
{
|
{
|
||||||
me = xmalloc (sizeof *me);
|
me = xmalloc (sizeof *me);
|
||||||
me->me_devname = xstrdup (fsd.fd_req.devname);
|
me->me_devname = xstrdup (fsd.fd_req.devname);
|
||||||
me->me_mountdir = xstrdup (fsd.fd_req.path);
|
me->me_mountdir = xstrdup (fsd.fd_req.path);
|
||||||
me->me_type = gt_names[fsd.fd_req.fstype];
|
me->me_type = gt_names[fsd.fd_req.fstype];
|
||||||
me->me_type_malloced = 0;
|
me->me_type_malloced = 0;
|
||||||
me->me_dummy = ME_DUMMY (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);
|
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
|
||||||
me->me_dev = fsd.fd_req.dev;
|
me->me_dev = fsd.fd_req.dev;
|
||||||
|
|
||||||
/* Add to the linked list. */
|
/* Add to the linked list. */
|
||||||
*mtail = me;
|
*mtail = me;
|
||||||
mtail = &me->me_next;
|
mtail = &me->me_next;
|
||||||
}
|
}
|
||||||
if (val < 0)
|
if (val < 0)
|
||||||
goto free_then_fail;
|
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))
|
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->name = name;
|
||||||
re->dev = statbuf.st_dev;
|
re->dev = statbuf.st_dev;
|
||||||
re->ino = statbuf.st_ino;
|
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)
|
if (re->dev == fi.dev && re->ino == fi.root)
|
||||||
break;
|
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_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_mountdir = xstrdup (re != NULL ? re->name : fi.fsh_name);
|
||||||
me->me_type = xstrdup (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_dev = fi.dev;
|
||||||
me->me_dummy = 0;
|
me->me_dummy = 0;
|
||||||
me->me_remote = (fi.flags & B_FS_IS_SHARED) != 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 */
|
#endif /* MOUNTED_FS_STAT_DEV */
|
||||||
|
|
||||||
#if defined MOUNTED_GETFSSTAT /* __alpha running OSF_1 */
|
#if defined MOUNTED_GETFSSTAT /* __alpha running OSF_1 */
|
||||||
{
|
{
|
||||||
int numsys, counter;
|
int numsys, counter;
|
||||||
size_t bufsize;
|
size_t bufsize;
|
||||||
@ -617,24 +617,24 @@ read_file_system_list (bool need_fs_type)
|
|||||||
|
|
||||||
if (numsys < 0)
|
if (numsys < 0)
|
||||||
{
|
{
|
||||||
free (stats);
|
free (stats);
|
||||||
return (NULL);
|
return (NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (counter = 0; counter < numsys; counter++)
|
for (counter = 0; counter < numsys; counter++)
|
||||||
{
|
{
|
||||||
me = xmalloc (sizeof *me);
|
me = xmalloc (sizeof *me);
|
||||||
me->me_devname = xstrdup (stats[counter].f_mntfromname);
|
me->me_devname = xstrdup (stats[counter].f_mntfromname);
|
||||||
me->me_mountdir = xstrdup (stats[counter].f_mntonname);
|
me->me_mountdir = xstrdup (stats[counter].f_mntonname);
|
||||||
me->me_type = xstrdup (FS_TYPE (stats[counter]));
|
me->me_type = xstrdup (FS_TYPE (stats[counter]));
|
||||||
me->me_type_malloced = 1;
|
me->me_type_malloced = 1;
|
||||||
me->me_dummy = ME_DUMMY (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);
|
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
|
||||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||||
|
|
||||||
/* Add to the linked list. */
|
/* Add to the linked list. */
|
||||||
*mtail = me;
|
*mtail = me;
|
||||||
mtail = &me->me_next;
|
mtail = &me->me_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
free (stats);
|
free (stats);
|
||||||
@ -653,47 +653,47 @@ read_file_system_list (bool need_fs_type)
|
|||||||
|
|
||||||
while (fread (&mnt, sizeof mnt, 1, fp) > 0)
|
while (fread (&mnt, sizeof mnt, 1, fp) > 0)
|
||||||
{
|
{
|
||||||
me = xmalloc (sizeof *me);
|
me = xmalloc (sizeof *me);
|
||||||
# ifdef GETFSTYP /* SVR3. */
|
# ifdef GETFSTYP /* SVR3. */
|
||||||
me->me_devname = xstrdup (mnt.mt_dev);
|
me->me_devname = xstrdup (mnt.mt_dev);
|
||||||
# else
|
# else
|
||||||
me->me_devname = xmalloc (strlen (mnt.mt_dev) + 6);
|
me->me_devname = xmalloc (strlen (mnt.mt_dev) + 6);
|
||||||
strcpy (me->me_devname, "/dev/");
|
strcpy (me->me_devname, "/dev/");
|
||||||
strcpy (me->me_devname + 5, mnt.mt_dev);
|
strcpy (me->me_devname + 5, mnt.mt_dev);
|
||||||
# endif
|
# endif
|
||||||
me->me_mountdir = xstrdup (mnt.mt_filsys);
|
me->me_mountdir = xstrdup (mnt.mt_filsys);
|
||||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||||
me->me_type = "";
|
me->me_type = "";
|
||||||
me->me_type_malloced = 0;
|
me->me_type_malloced = 0;
|
||||||
# ifdef GETFSTYP /* SVR3. */
|
# ifdef GETFSTYP /* SVR3. */
|
||||||
if (need_fs_type)
|
if (need_fs_type)
|
||||||
{
|
{
|
||||||
struct statfs fsd;
|
struct statfs fsd;
|
||||||
char typebuf[FSTYPSZ];
|
char typebuf[FSTYPSZ];
|
||||||
|
|
||||||
if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
|
if (statfs (me->me_mountdir, &fsd, sizeof fsd, 0) != -1
|
||||||
&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
|
&& sysfs (GETFSTYP, fsd.f_fstyp, typebuf) != -1)
|
||||||
{
|
{
|
||||||
me->me_type = xstrdup (typebuf);
|
me->me_type = xstrdup (typebuf);
|
||||||
me->me_type_malloced = 1;
|
me->me_type_malloced = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
me->me_dummy = ME_DUMMY (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);
|
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
|
||||||
|
|
||||||
/* Add to the linked list. */
|
/* Add to the linked list. */
|
||||||
*mtail = me;
|
*mtail = me;
|
||||||
mtail = &me->me_next;
|
mtail = &me->me_next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ferror (fp))
|
if (ferror (fp))
|
||||||
{
|
{
|
||||||
/* The last fread() call must have failed. */
|
/* The last fread() call must have failed. */
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
goto free_then_fail;
|
goto free_then_fail;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fclose (fp) == EOF)
|
if (fclose (fp) == EOF)
|
||||||
@ -701,29 +701,29 @@ read_file_system_list (bool need_fs_type)
|
|||||||
}
|
}
|
||||||
#endif /* MOUNTED_FREAD || MOUNTED_FREAD_FSTYP. */
|
#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;
|
struct mntent **mnttbl = getmnttbl (), **ent;
|
||||||
for (ent=mnttbl;*ent;ent++)
|
for (ent=mnttbl;*ent;ent++)
|
||||||
{
|
{
|
||||||
me = xmalloc (sizeof *me);
|
me = xmalloc (sizeof *me);
|
||||||
me->me_devname = xstrdup ( (*ent)->mt_resource);
|
me->me_devname = xstrdup ( (*ent)->mt_resource);
|
||||||
me->me_mountdir = xstrdup ( (*ent)->mt_directory);
|
me->me_mountdir = xstrdup ( (*ent)->mt_directory);
|
||||||
me->me_type = xstrdup ((*ent)->mt_fstype);
|
me->me_type = xstrdup ((*ent)->mt_fstype);
|
||||||
me->me_type_malloced = 1;
|
me->me_type_malloced = 1;
|
||||||
me->me_dummy = ME_DUMMY (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);
|
me->me_remote = ME_REMOTE (me->me_devname, me->me_type);
|
||||||
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
me->me_dev = (dev_t) -1; /* Magic; means not known yet. */
|
||||||
|
|
||||||
/* Add to the linked list. */
|
/* Add to the linked list. */
|
||||||
*mtail = me;
|
*mtail = me;
|
||||||
mtail = &me->me_next;
|
mtail = &me->me_next;
|
||||||
}
|
}
|
||||||
endmnttbl ();
|
endmnttbl ();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
|
#ifdef MOUNTED_GETMNTENT2 /* SVR4. */
|
||||||
{
|
{
|
||||||
struct mnttab mnt;
|
struct mnttab mnt;
|
||||||
char *table = MNTTAB;
|
char *table = MNTTAB;
|
||||||
@ -742,19 +742,19 @@ read_file_system_list (bool need_fs_type)
|
|||||||
lockfd = open (MNTTAB_LOCK, O_RDONLY);
|
lockfd = open (MNTTAB_LOCK, O_RDONLY);
|
||||||
if (0 <= lockfd)
|
if (0 <= lockfd)
|
||||||
{
|
{
|
||||||
struct flock flock;
|
struct flock flock;
|
||||||
flock.l_type = F_RDLCK;
|
flock.l_type = F_RDLCK;
|
||||||
flock.l_whence = SEEK_SET;
|
flock.l_whence = SEEK_SET;
|
||||||
flock.l_start = 0;
|
flock.l_start = 0;
|
||||||
flock.l_len = 0;
|
flock.l_len = 0;
|
||||||
while (fcntl (lockfd, F_SETLKW, &flock) == -1)
|
while (fcntl (lockfd, F_SETLKW, &flock) == -1)
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
close (lockfd);
|
close (lockfd);
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (errno != ENOENT)
|
else if (errno != ENOENT)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -766,23 +766,23 @@ read_file_system_list (bool need_fs_type)
|
|||||||
ret = errno;
|
ret = errno;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while ((ret = getmntent (fp, &mnt)) == 0)
|
while ((ret = getmntent (fp, &mnt)) == 0)
|
||||||
{
|
{
|
||||||
me = xmalloc (sizeof *me);
|
me = xmalloc (sizeof *me);
|
||||||
me->me_devname = xstrdup (mnt.mnt_special);
|
me->me_devname = xstrdup (mnt.mnt_special);
|
||||||
me->me_mountdir = xstrdup (mnt.mnt_mountp);
|
me->me_mountdir = xstrdup (mnt.mnt_mountp);
|
||||||
me->me_type = xstrdup (mnt.mnt_fstype);
|
me->me_type = xstrdup (mnt.mnt_fstype);
|
||||||
me->me_type_malloced = 1;
|
me->me_type_malloced = 1;
|
||||||
me->me_dummy = MNT_IGNORE (&mnt) != 0;
|
me->me_dummy = MNT_IGNORE (&mnt) != 0;
|
||||||
me->me_remote = ME_REMOTE (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_mntopts);
|
me->me_dev = dev_from_mount_options (mnt.mnt_mntopts);
|
||||||
|
|
||||||
/* Add to the linked list. */
|
/* Add to the linked list. */
|
||||||
*mtail = me;
|
*mtail = me;
|
||||||
mtail = &me->me_next;
|
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)
|
if (0 <= lockfd && close (lockfd) != 0)
|
||||||
@ -790,13 +790,13 @@ read_file_system_list (bool need_fs_type)
|
|||||||
|
|
||||||
if (0 <= ret)
|
if (0 <= ret)
|
||||||
{
|
{
|
||||||
errno = ret;
|
errno = ret;
|
||||||
goto free_then_fail;
|
goto free_then_fail;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* MOUNTED_GETMNTENT2. */
|
#endif /* MOUNTED_GETMNTENT2. */
|
||||||
|
|
||||||
#ifdef MOUNTED_VMOUNT /* AIX. */
|
#ifdef MOUNTED_VMOUNT /* AIX. */
|
||||||
{
|
{
|
||||||
int bufsize;
|
int bufsize;
|
||||||
char *entries, *thisent;
|
char *entries, *thisent;
|
||||||
@ -813,53 +813,53 @@ read_file_system_list (bool need_fs_type)
|
|||||||
n_entries = mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries);
|
n_entries = mntctl (MCTL_QUERY, bufsize, (struct vmount *) entries);
|
||||||
if (n_entries < 0)
|
if (n_entries < 0)
|
||||||
{
|
{
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
free (entries);
|
free (entries);
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, thisent = entries;
|
for (i = 0, thisent = entries;
|
||||||
i < n_entries;
|
i < n_entries;
|
||||||
i++, thisent += vmp->vmt_length)
|
i++, thisent += vmp->vmt_length)
|
||||||
{
|
{
|
||||||
char *options, *ignore;
|
char *options, *ignore;
|
||||||
|
|
||||||
vmp = (struct vmount *) thisent;
|
vmp = (struct vmount *) thisent;
|
||||||
me = xmalloc (sizeof *me);
|
me = xmalloc (sizeof *me);
|
||||||
if (vmp->vmt_flags & MNT_REMOTE)
|
if (vmp->vmt_flags & MNT_REMOTE)
|
||||||
{
|
{
|
||||||
char *host, *dir;
|
char *host, *dir;
|
||||||
|
|
||||||
me->me_remote = 1;
|
me->me_remote = 1;
|
||||||
/* Prepend the remote dirname. */
|
/* Prepend the remote dirname. */
|
||||||
host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off;
|
host = thisent + vmp->vmt_data[VMT_HOSTNAME].vmt_off;
|
||||||
dir = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off;
|
dir = thisent + vmp->vmt_data[VMT_OBJECT].vmt_off;
|
||||||
me->me_devname = xmalloc (strlen (host) + strlen (dir) + 2);
|
me->me_devname = xmalloc (strlen (host) + strlen (dir) + 2);
|
||||||
strcpy (me->me_devname, host);
|
strcpy (me->me_devname, host);
|
||||||
strcat (me->me_devname, ":");
|
strcat (me->me_devname, ":");
|
||||||
strcat (me->me_devname, dir);
|
strcat (me->me_devname, dir);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
me->me_remote = 0;
|
me->me_remote = 0;
|
||||||
me->me_devname = xstrdup (thisent +
|
me->me_devname = xstrdup (thisent +
|
||||||
vmp->vmt_data[VMT_OBJECT].vmt_off);
|
vmp->vmt_data[VMT_OBJECT].vmt_off);
|
||||||
}
|
}
|
||||||
me->me_mountdir = xstrdup (thisent + vmp->vmt_data[VMT_STUB].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 = xstrdup (fstype_to_string (vmp->vmt_gfstype));
|
||||||
me->me_type_malloced = 1;
|
me->me_type_malloced = 1;
|
||||||
options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
|
options = thisent + vmp->vmt_data[VMT_ARGS].vmt_off;
|
||||||
ignore = strstr (options, "ignore");
|
ignore = strstr (options, "ignore");
|
||||||
me->me_dummy = (ignore
|
me->me_dummy = (ignore
|
||||||
&& (ignore == options || ignore[-1] == ',')
|
&& (ignore == options || ignore[-1] == ',')
|
||||||
&& (ignore[sizeof "ignore" - 1] == ','
|
&& (ignore[sizeof "ignore" - 1] == ','
|
||||||
|| ignore[sizeof "ignore" - 1] == '\0'));
|
|| ignore[sizeof "ignore" - 1] == '\0'));
|
||||||
me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want. */
|
me->me_dev = (dev_t) -1; /* vmt_fsid might be the info we want. */
|
||||||
|
|
||||||
/* Add to the linked list. */
|
/* Add to the linked list. */
|
||||||
*mtail = me;
|
*mtail = me;
|
||||||
mtail = &me->me_next;
|
mtail = &me->me_next;
|
||||||
}
|
}
|
||||||
free (entries);
|
free (entries);
|
||||||
}
|
}
|
||||||
@ -876,13 +876,13 @@ read_file_system_list (bool need_fs_type)
|
|||||||
|
|
||||||
while (mount_list)
|
while (mount_list)
|
||||||
{
|
{
|
||||||
me = mount_list->me_next;
|
me = mount_list->me_next;
|
||||||
free (mount_list->me_devname);
|
free (mount_list->me_devname);
|
||||||
free (mount_list->me_mountdir);
|
free (mount_list->me_mountdir);
|
||||||
if (mount_list->me_type_malloced)
|
if (mount_list->me_type_malloced)
|
||||||
free (mount_list->me_type);
|
free (mount_list->me_type);
|
||||||
free (mount_list);
|
free (mount_list);
|
||||||
mount_list = me;
|
mount_list = me;
|
||||||
}
|
}
|
||||||
|
|
||||||
errno = saved_errno;
|
errno = saved_errno;
|
||||||
|
|||||||
12
mountlist.h
12
mountlist.h
@ -26,12 +26,12 @@
|
|||||||
/* A mount table entry. */
|
/* A mount table entry. */
|
||||||
struct mount_entry
|
struct mount_entry
|
||||||
{
|
{
|
||||||
char *me_devname; /* Device node name, including "/dev/". */
|
char *me_devname; /* Device node name, including "/dev/". */
|
||||||
char *me_mountdir; /* Mount point directory name. */
|
char *me_mountdir; /* Mount point directory name. */
|
||||||
char *me_type; /* "nfs", "4.2", etc. */
|
char *me_type; /* "nfs", "4.2", etc. */
|
||||||
dev_t me_dev; /* Device number of me_mountdir. */
|
dev_t me_dev; /* Device number of me_mountdir. */
|
||||||
unsigned int me_dummy : 1; /* Nonzero for dummy file systems. */
|
unsigned int me_dummy : 1; /* Nonzero for dummy file systems. */
|
||||||
unsigned int me_remote : 1; /* Nonzero for remote fileystems. */
|
unsigned int me_remote : 1; /* Nonzero for remote fileystems. */
|
||||||
unsigned int me_type_malloced : 1; /* Nonzero if me_type was malloced. */
|
unsigned int me_type_malloced : 1; /* Nonzero if me_type was malloced. */
|
||||||
struct mount_entry *me_next;
|
struct mount_entry *me_next;
|
||||||
};
|
};
|
||||||
|
|||||||
230
op_c.c
230
op_c.c
@ -85,16 +85,16 @@ void RGBtoHSL(int r,int g,int b,byte * hr,byte * sr,byte* lr)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (l<=0.5)
|
if (l<=0.5)
|
||||||
s = (max - min) / (max + min);
|
s = (max - min) / (max + min);
|
||||||
else
|
else
|
||||||
s = (max - min) / (2 - (max + min));
|
s = (max - min) / (2 - (max + min));
|
||||||
|
|
||||||
if (max == rd)
|
if (max == rd)
|
||||||
h = 42.5 * (gd-bd)/(max-min);
|
h = 42.5 * (gd-bd)/(max-min);
|
||||||
else if (max == gd)
|
else if (max == gd)
|
||||||
h = 42.5 * (bd-rd)/(max-min)+85;
|
h = 42.5 * (bd-rd)/(max-min)+85;
|
||||||
else
|
else
|
||||||
h = 42.5 * (rd-gd)/(max-min)+170;
|
h = 42.5 * (rd-gd)/(max-min)+170;
|
||||||
if (h<0) h+=255;
|
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)
|
if(S==0)
|
||||||
{
|
{
|
||||||
*R=*G=*B=L;
|
*R=*G=*B=L;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hf = H / 255.0;
|
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;
|
sf = S / 255.0;
|
||||||
|
|
||||||
if (lf<=0.5)
|
if (lf<=0.5)
|
||||||
q = lf*(1+sf);
|
q = lf*(1+sf);
|
||||||
else
|
else
|
||||||
q = lf+sf-lf*sf;
|
q = lf+sf-lf*sf;
|
||||||
p = 2*lf-q;
|
p = 2*lf-q;
|
||||||
|
|
||||||
rf = hf + (1 / 3.0);
|
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 (bf > 1) bf-=1;
|
||||||
|
|
||||||
if (rf < 1/6.0)
|
if (rf < 1/6.0)
|
||||||
rf = p + ((q-p)*6*rf);
|
rf = p + ((q-p)*6*rf);
|
||||||
else if(rf < 0.5)
|
else if(rf < 0.5)
|
||||||
rf = q;
|
rf = q;
|
||||||
else if(rf < 2/3.0)
|
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
|
else
|
||||||
rf = p;
|
rf = p;
|
||||||
|
|
||||||
if (gf < 1/6.0)
|
if (gf < 1/6.0)
|
||||||
gf = p + ((q-p)*6*gf);
|
gf = p + ((q-p)*6*gf);
|
||||||
else if(gf < 0.5)
|
else if(gf < 0.5)
|
||||||
gf = q;
|
gf = q;
|
||||||
else if(gf < 2/3.0)
|
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
|
else
|
||||||
gf = p;
|
gf = p;
|
||||||
|
|
||||||
if (bf < 1/6.0)
|
if (bf < 1/6.0)
|
||||||
bf = p + ((q-p)*6*bf);
|
bf = p + ((q-p)*6*bf);
|
||||||
else if(bf < 0.5)
|
else if(bf < 0.5)
|
||||||
bf = q;
|
bf = q;
|
||||||
else if(bf < 2/3.0)
|
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
|
else
|
||||||
bf = p;
|
bf = p;
|
||||||
|
|
||||||
*R = rf * (255);
|
*R = rf * (255);
|
||||||
*G = gf * (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 (v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
|
||||||
for (b=c->bmin;b<=c->bmax;b++)
|
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 (nbocc)
|
||||||
{
|
{
|
||||||
if (r<rmin) rmin=r;
|
if (r<rmin) rmin=r;
|
||||||
else if (r>rmax) rmax=r;
|
else if (r>rmax) rmax=r;
|
||||||
if (v<vmin) vmin=v;
|
if (v<vmin) vmin=v;
|
||||||
else if (v>vmax) vmax=v;
|
else if (v>vmax) vmax=v;
|
||||||
if (b<bmin) bmin=b;
|
if (b<bmin) bmin=b;
|
||||||
else if (b>bmax) bmax=b;
|
else if (b>bmax) bmax=b;
|
||||||
c->occurences+=nbocc;
|
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(r=c->rmin<<16;r<=c->rmax<<16;r+=1<<16)
|
||||||
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
|
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
|
||||||
for(b=c->bmin;b<=c->bmax;b++)
|
for(b=c->bmin;b<=c->bmax;b++)
|
||||||
{
|
{
|
||||||
if(to->table[r + v + b]) // TO_Get
|
if(to->table[r + v + b]) // TO_Get
|
||||||
{
|
{
|
||||||
rmin=r;
|
rmin=r;
|
||||||
goto RMAX;
|
goto RMAX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RMAX:
|
RMAX:
|
||||||
for(r=c->rmax<<16;r>=rmin;r-=1<<16)
|
for(r=c->rmax<<16;r>=rmin;r-=1<<16)
|
||||||
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
|
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
|
||||||
for(b=c->bmin;b<=c->bmax;b++)
|
for(b=c->bmin;b<=c->bmax;b++)
|
||||||
{
|
{
|
||||||
if(to->table[r + v + b]) // TO_Get
|
if(to->table[r + v + b]) // TO_Get
|
||||||
{
|
{
|
||||||
rmax=r;
|
rmax=r;
|
||||||
goto VMIN;
|
goto VMIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VMIN:
|
VMIN:
|
||||||
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
|
for(v=c->vmin<<8;v<=c->vmax<<8;v+=1<<8)
|
||||||
for(r=rmin;r<=rmax;r+=1<<16)
|
for(r=rmin;r<=rmax;r+=1<<16)
|
||||||
for(b=c->bmin;b<=c->bmax;b++)
|
for(b=c->bmin;b<=c->bmax;b++)
|
||||||
{
|
{
|
||||||
if(to->table[r + v + b]) // TO_Get
|
if(to->table[r + v + b]) // TO_Get
|
||||||
{
|
{
|
||||||
vmin=v;
|
vmin=v;
|
||||||
goto VMAX;
|
goto VMAX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
VMAX:
|
VMAX:
|
||||||
for(v=c->vmax<<8;v>=vmin;v-=1<<8)
|
for(v=c->vmax<<8;v>=vmin;v-=1<<8)
|
||||||
for(r=rmin;r<=rmax;r+=1<<16)
|
for(r=rmin;r<=rmax;r+=1<<16)
|
||||||
for(b=c->bmin;b<=c->bmax;b++)
|
for(b=c->bmin;b<=c->bmax;b++)
|
||||||
{
|
{
|
||||||
if(to->table[r + v + b]) // TO_Get
|
if(to->table[r + v + b]) // TO_Get
|
||||||
{
|
{
|
||||||
vmax=v;
|
vmax=v;
|
||||||
goto BMIN;
|
goto BMIN;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BMIN:
|
BMIN:
|
||||||
for(b=c->bmin;b<=c->bmax;b++)
|
for(b=c->bmin;b<=c->bmax;b++)
|
||||||
for(r=rmin;r<=rmax;r+=1<<16)
|
for(r=rmin;r<=rmax;r+=1<<16)
|
||||||
for(v=vmin;v<=vmax;v+=1<<8)
|
for(v=vmin;v<=vmax;v+=1<<8)
|
||||||
{
|
{
|
||||||
if(to->table[r + v + b]) // TO_Get
|
if(to->table[r + v + b]) // TO_Get
|
||||||
{
|
{
|
||||||
bmin=b;
|
bmin=b;
|
||||||
goto BMAX;
|
goto BMAX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
BMAX:
|
BMAX:
|
||||||
for(b=c->bmax;b>=bmin;b--)
|
for(b=c->bmax;b>=bmin;b--)
|
||||||
for(r=rmin;r<=rmax;r+=1<<16)
|
for(r=rmin;r<=rmax;r+=1<<16)
|
||||||
for(v=vmin;v<=vmax;v+=1<<8)
|
for(v=vmin;v<=vmax;v+=1<<8)
|
||||||
{
|
{
|
||||||
if(to->table[r + v + b]) // TO_Get
|
if(to->table[r + v + b]) // TO_Get
|
||||||
{
|
{
|
||||||
bmax=b;
|
bmax=b;
|
||||||
goto ENDCRUSH;
|
goto ENDCRUSH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ENDCRUSH:
|
ENDCRUSH:
|
||||||
// Il faut quand même parcourir la partie utile du cluster, pour savoir combien il y a d'occurences
|
// 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(r=rmin;r<=rmax;r+=1<<16)
|
||||||
for(v=vmin;v<=vmax;v+=1<<8)
|
for(v=vmin;v<=vmax;v+=1<<8)
|
||||||
for(b=bmin;b<=bmax;b++)
|
for(b=bmin;b<=bmax;b++)
|
||||||
{
|
{
|
||||||
c->occurences+=to->table[r + v + b]; // TO_Get
|
c->occurences+=to->table[r + v + b]; // TO_Get
|
||||||
}
|
}
|
||||||
|
|
||||||
c->rmin=rmin>>16; c->rmax=rmax>>16;
|
c->rmin=rmin>>16; c->rmax=rmax>>16;
|
||||||
c->vmin=vmin>>8; c->vmax=vmax>>8;
|
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
|
// On met ces deux nouveaux clusters dans le clusterSet... sauf s'ils sont vides
|
||||||
if(Nouveau1.occurences>0)
|
if(Nouveau1.occurences>0)
|
||||||
CS_Set(cs,&Nouveau1);
|
CS_Set(cs,&Nouveau1);
|
||||||
if(Nouveau2.occurences>0)
|
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));
|
n=(DegradeSet *)malloc(sizeof(DegradeSet));
|
||||||
if (n!=NULL)
|
if (n!=NULL)
|
||||||
{
|
{
|
||||||
// On recopie les paramŠtres demand‚s
|
// On recopie les paramŠtres demand‚s
|
||||||
n->nbmax=cs->nbmax;
|
n->nbmax=cs->nbmax;
|
||||||
|
|
||||||
// On tente d'allouer la table
|
// On tente d'allouer la table
|
||||||
n->degrades=(Degrade *)malloc((n->nbmax)*sizeof(Degrade));
|
n->degrades=(Degrade *)malloc((n->nbmax)*sizeof(Degrade));
|
||||||
if (n->degrades!=0)
|
if (n->degrades!=0)
|
||||||
// C'est bon! On initialise
|
// C'est bon! On initialise
|
||||||
DS_Init(n,cs);
|
DS_Init(n,cs);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Table impossible … allouer
|
// Table impossible … allouer
|
||||||
free(n);
|
free(n);
|
||||||
n=0;
|
n=0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return n;
|
return n;
|
||||||
@ -969,21 +969,21 @@ void DS_Generer(DegradeSet * ds,ClusterSet * cs)
|
|||||||
// Pour chacun des clusters … traiter
|
// Pour chacun des clusters … traiter
|
||||||
for (ic=1;ic<cs->nb;ic++)
|
for (ic=1;ic<cs->nb;ic++)
|
||||||
{
|
{
|
||||||
// On recherche le d‚grad‚ le plus proche de la chrominance du cluster
|
// On recherche le d‚grad‚ le plus proche de la chrominance du cluster
|
||||||
mdegr=-1;
|
mdegr=-1;
|
||||||
mdiff=99999999;
|
mdiff=99999999;
|
||||||
for (id=0;id<ds->nb;id++)
|
for (id=0;id<ds->nb;id++)
|
||||||
{
|
{
|
||||||
diff=abs(cs->clusters[ic].h - ds->degrades[id].hue);
|
diff=abs(cs->clusters[ic].h - ds->degrades[id].hue);
|
||||||
if ((mdiff>diff) && (diff<16))
|
if ((mdiff>diff) && (diff<16))
|
||||||
{
|
{
|
||||||
mdegr=id;
|
mdegr=id;
|
||||||
mdiff=diff;
|
mdiff=diff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si on a trouv‚ un d‚grad‚ dans lequel inclure le cluster
|
// Si on a trouv‚ un d‚grad‚ dans lequel inclure le cluster
|
||||||
if (mdegr!=-1)
|
if (mdegr!=-1)
|
||||||
{
|
{
|
||||||
// On met … jour le d‚grad‚
|
// On met … jour le d‚grad‚
|
||||||
if (cs->clusters[ic].h < ds->degrades[mdegr].min)
|
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
|
// 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);
|
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);
|
CS_Calculer_teintes(cs,to);
|
||||||
|
|
||||||
ds=DS_New(cs);
|
ds=DS_New(cs);
|
||||||
@ -1055,11 +1055,11 @@ Table_conversion * Optimiser_palette(Bitmap24B image,int taille,struct Composant
|
|||||||
DS_Delete(ds);
|
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_luminance(cs);
|
||||||
CS_Trier_par_chrominance(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_Generer_TC_et_Palette(cs,tc,palette);
|
||||||
|
|
||||||
CS_Delete(cs);
|
CS_Delete(cs);
|
||||||
@ -1105,11 +1105,11 @@ void Convert_bitmap_24B_to_256_Floyd_Steinberg(Bitmap256 Dest,Bitmap24B Source,i
|
|||||||
float ERouge,EVert,EBleu;
|
float ERouge,EVert,EBleu;
|
||||||
|
|
||||||
// On initialise les variables de parcours:
|
// 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
|
Suivant =Courant+largeur; // Le pixel en dessous
|
||||||
C_plus1 =Courant+1; // Le pixel à droite
|
C_plus1 =Courant+1; // Le pixel à droite
|
||||||
S_moins1=Suivant-1; // Le pixel en bas à gauche
|
S_moins1=Suivant-1; // Le pixel en bas à gauche
|
||||||
S_plus1 =Suivant+1; // Le pixel en bas à droite
|
S_plus1 =Suivant+1; // Le pixel en bas à droite
|
||||||
D =Dest;
|
D =Dest;
|
||||||
|
|
||||||
// On parcours chaque pixel:
|
// 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;
|
EBleu =(Bleu *7)/16.0;
|
||||||
if (Pos_X+1<largeur)
|
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->R=Valeur_modifiee(C_plus1->R,ERouge);
|
||||||
C_plus1->V=Valeur_modifiee(C_plus1->V,EVert );
|
C_plus1->V=Valeur_modifiee(C_plus1->V,EVert );
|
||||||
C_plus1->B=Valeur_modifiee(C_plus1->B,EBleu );
|
C_plus1->B=Valeur_modifiee(C_plus1->B,EBleu );
|
||||||
|
|||||||
32
operatio.c
32
operatio.c
@ -4308,38 +4308,38 @@ void Rectangle_Degrade_0_5(void)
|
|||||||
|
|
||||||
if(Min(RAX,RBX)<Limite_Gauche_Zoom) // On dépasse du zoom à gauche
|
if(Min(RAX,RBX)<Limite_Gauche_Zoom) // On dépasse du zoom à gauche
|
||||||
{
|
{
|
||||||
decalage_largeur += Limite_Gauche_Zoom - Min(RAX,RBX);
|
decalage_largeur += Limite_Gauche_Zoom - Min(RAX,RBX);
|
||||||
decalage_gauche = Limite_Gauche_Zoom;
|
decalage_gauche = Limite_Gauche_Zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Max(RAX,RBX)>Limite_visible_Droite_Zoom) // On dépasse du zoom à droite
|
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
|
if(Min(RAY,RBY)<Limite_Haut_Zoom) // On dépasse du zoom en haut
|
||||||
{
|
{
|
||||||
decalage_hauteur += Limite_Haut_Zoom - Min(RAY,RBY);
|
decalage_hauteur += Limite_Haut_Zoom - Min(RAY,RBY);
|
||||||
decalage_haut = Limite_Haut_Zoom;
|
decalage_haut = Limite_Haut_Zoom;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Max(RAY,RBY)>Limite_visible_Bas_Zoom) // On dépasse du zoom en bas
|
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(largeur > decalage_largeur)
|
||||||
{
|
{
|
||||||
if(decalage_haut==0) // La ligne du haut est visible
|
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
|
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(hauteur>decalage_hauteur)
|
||||||
{
|
{
|
||||||
if(decalage_gauche==0) // La ligne de gauche est visible
|
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
|
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);
|
Operation_POP(&Debut_X);
|
||||||
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
// On corrige les coordonnées de la ligne si la touche shift est appuyée...
|
||||||
if(SDL_GetModState() & KMOD_SHIFT)
|
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);
|
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);
|
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 !
|
// 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.
|
// 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);
|
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();
|
Attendre_fin_de_click();
|
||||||
|
|
||||||
if ((Config.Coords_rel) && (Menu_visible))
|
if ((Config.Coords_rel) && (Menu_visible))
|
||||||
{
|
{
|
||||||
Print_dans_menu("X: Y: ",0);
|
Print_dans_menu("X: Y: ",0);
|
||||||
Print_coordonnees();
|
Print_coordonnees();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/////////////////////////////////////////////////// OPERATION_LIGNES_CENTREES
|
/////////////////////////////////////////////////// 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;
|
Shade_Table=(Mouse_K==A_GAUCHE)?Shade_Table_gauche:Shade_Table_droite;
|
||||||
|
|
||||||
if ((Config.Coords_rel) && (Menu_visible))
|
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(Mouse_K);
|
||||||
Operation_PUSH(Pinceau_X);
|
Operation_PUSH(Pinceau_X);
|
||||||
|
|||||||
124
realpath.c
124
realpath.c
@ -16,82 +16,82 @@
|
|||||||
|
|
||||||
static char *sep(char *path)
|
static char *sep(char *path)
|
||||||
{
|
{
|
||||||
char *tmp, c;
|
char *tmp, c;
|
||||||
|
|
||||||
tmp = strrchr(path, '/');
|
tmp = strrchr(path, '/');
|
||||||
if(tmp) {
|
if(tmp) {
|
||||||
c = tmp[1];
|
c = tmp[1];
|
||||||
tmp[1] = 0;
|
tmp[1] = 0;
|
||||||
if (chdir(path)) {
|
if (chdir(path)) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
tmp[1] = c;
|
tmp[1] = c;
|
||||||
|
|
||||||
return tmp + 1;
|
return tmp + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *realpath(const char *_path, char *resolved_path)
|
char *realpath(const char *_path, char *resolved_path)
|
||||||
{
|
{
|
||||||
int fd = open(".", O_RDONLY), l;
|
int fd = open(".", O_RDONLY), l;
|
||||||
char current_dir_path[PATH_MAX];
|
char current_dir_path[PATH_MAX];
|
||||||
char path[PATH_MAX], lnk[PATH_MAX], *tmp = (char *)"";
|
char path[PATH_MAX], lnk[PATH_MAX], *tmp = (char *)"";
|
||||||
|
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
getcwd(current_dir_path,PATH_MAX);
|
getcwd(current_dir_path,PATH_MAX);
|
||||||
strncpy(path, _path, PATH_MAX);
|
strncpy(path, _path, PATH_MAX);
|
||||||
|
|
||||||
if (chdir(path)) {
|
if (chdir(path)) {
|
||||||
if (errno == ENOTDIR) {
|
if (errno == ENOTDIR) {
|
||||||
#if defined(__WIN32__) || defined(__MORPHOS__)
|
#if defined(__WIN32__) || defined(__MORPHOS__)
|
||||||
// No symbolic links and no readlink()
|
// No symbolic links and no readlink()
|
||||||
l = -1;
|
l = -1;
|
||||||
#else
|
#else
|
||||||
l = readlink(path, lnk, PATH_MAX);
|
l = readlink(path, lnk, PATH_MAX);
|
||||||
#endif
|
#endif
|
||||||
if (!(tmp = sep(path))) {
|
if (!(tmp = sep(path))) {
|
||||||
resolved_path = NULL;
|
resolved_path = NULL;
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
if (l < 0) {
|
if (l < 0) {
|
||||||
if (errno != EINVAL) {
|
if (errno != EINVAL) {
|
||||||
resolved_path = NULL;
|
resolved_path = NULL;
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lnk[l] = 0;
|
lnk[l] = 0;
|
||||||
if (!(tmp = sep(lnk))) {
|
if (!(tmp = sep(lnk))) {
|
||||||
resolved_path = NULL;
|
resolved_path = NULL;
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
resolved_path = NULL;
|
resolved_path = NULL;
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(resolved_path==NULL) // if we called realpath with null as a 2nd arg
|
if(resolved_path==NULL) // if we called realpath with null as a 2nd arg
|
||||||
resolved_path = (char*) malloc( PATH_MAX );
|
resolved_path = (char*) malloc( PATH_MAX );
|
||||||
|
|
||||||
if (!getcwd(resolved_path, PATH_MAX)) {
|
if (!getcwd(resolved_path, PATH_MAX)) {
|
||||||
resolved_path = NULL;
|
resolved_path = NULL;
|
||||||
goto abort;
|
goto abort;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strcmp(resolved_path, "/") && *tmp) {
|
if(strcmp(resolved_path, "/") && *tmp) {
|
||||||
strcat(resolved_path, "/");
|
strcat(resolved_path, "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
strcat(resolved_path, tmp);
|
strcat(resolved_path, tmp);
|
||||||
abort:
|
abort:
|
||||||
chdir(current_dir_path);
|
chdir(current_dir_path);
|
||||||
close(fd);
|
close(fd);
|
||||||
return resolved_path;
|
return resolved_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
18
texte.c
18
texte.c
@ -149,7 +149,7 @@ void Ajout_fonte(const char *Nom)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
return;
|
return;
|
||||||
@ -303,8 +303,8 @@ void Initialisation_Texte(void)
|
|||||||
int i,number;
|
int i,number;
|
||||||
char home_dir[MAXPATHLEN];
|
char home_dir[MAXPATHLEN];
|
||||||
char *font_path_list[3] = {
|
char *font_path_list[3] = {
|
||||||
"/System/Library/Fonts",
|
"/System/Library/Fonts",
|
||||||
"/Library/Fonts"
|
"/Library/Fonts"
|
||||||
};
|
};
|
||||||
number = 3;
|
number = 3;
|
||||||
// Make sure we also search into the user's fonts directory
|
// Make sure we also search into the user's fonts directory
|
||||||
@ -325,14 +325,14 @@ void Initialisation_Texte(void)
|
|||||||
|
|
||||||
#ifdef USE_XLIB
|
#ifdef USE_XLIB
|
||||||
{
|
{
|
||||||
int i,number;
|
int i,number;
|
||||||
Display* dpy = XOpenDisplay(NULL);
|
Display* dpy = XOpenDisplay(NULL);
|
||||||
char** font_path_list = XGetFontPath(dpy,&number);
|
char** font_path_list = XGetFontPath(dpy,&number);
|
||||||
|
|
||||||
for(i=0;i<number;i++)
|
for(i=0;i<number;i++)
|
||||||
for_each_file(*(font_path_list+i),Ajout_fonte);
|
for_each_file(*(font_path_list+i),Ajout_fonte);
|
||||||
|
|
||||||
XFreeFontPath(font_path_list);
|
XFreeFontPath(font_path_list);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
46
windows.c
46
windows.c
@ -1,6 +1,6 @@
|
|||||||
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
/* Grafx2 - The Ultimate 256-color bitmap paint program
|
||||||
|
|
||||||
Copyright 2008 Franck Charlet
|
Copyright 2008 Franck Charlet
|
||||||
Copyright 2007-2008 Adrien Destugues
|
Copyright 2007-2008 Adrien Destugues
|
||||||
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
|
Copyright 1996-2001 Sunset Design (Guillaume Dorme & Karl Maritaud)
|
||||||
|
|
||||||
@ -283,7 +283,7 @@ void Afficher_menu(void)
|
|||||||
|
|
||||||
if (!Fenetre)
|
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) ))
|
( (!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)
|
// 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.
|
// Macros pour écrire des litteraux binaires.
|
||||||
// Ex: Ob(11110000) == 0xF0
|
// Ex: Ob(11110000) == 0xF0
|
||||||
#define Ob(x) ((unsigned)Ob_(0 ## x ## uL))
|
#define Ob(x) ((unsigned)Ob_(0 ## x ## uL))
|
||||||
#define Ob_(x) ((x & 1) | (x >> 2 & 2) | (x >> 4 & 4) | (x >> 6 & 8) | \
|
#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))
|
(x >> 8 & 16) | (x >> 10 & 32) | (x >> 12 & 64) | (x >> 14 & 128))
|
||||||
|
|
||||||
byte Caractere[14][8] = {
|
byte Caractere[14][8] = {
|
||||||
{ // 0
|
{ // 0
|
||||||
@ -1431,17 +1431,17 @@ void Afficher_curseur(void)
|
|||||||
Debut_Y=Mouse_Y-Curseur_Decalage_Y[Temp];
|
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++)
|
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++)
|
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];
|
Couleur=SPRITE_CURSEUR[Temp][Compteur_Y][Compteur_X];
|
||||||
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(Pos_X,Pos_Y);
|
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(Pos_X,Pos_Y);
|
||||||
if (Couleur!=CM_Trans)
|
if (Couleur!=CM_Trans)
|
||||||
Pixel(Pos_X,Pos_Y,Couleur);
|
Pixel(Pos_X,Pos_Y,Couleur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),Compteur_X,Compteur_Y);
|
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];
|
Debut_Y=Mouse_Y-Curseur_Decalage_Y[Forme];
|
||||||
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15;Pos_X++,Compteur_X++)
|
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15;Pos_X++,Compteur_X++)
|
||||||
{
|
{
|
||||||
if(Pos_X<0) continue;
|
if(Pos_X<0) continue;
|
||||||
if(Pos_X>=Largeur_ecran) break;
|
if(Pos_X>=Largeur_ecran) break;
|
||||||
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15;Pos_Y++,Compteur_Y++)
|
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15;Pos_Y++,Compteur_Y++)
|
||||||
{
|
{
|
||||||
if(Pos_Y<0) continue;
|
if(Pos_Y<0) continue;
|
||||||
if(Pos_Y>=Hauteur_ecran) break;
|
if(Pos_Y>=Hauteur_ecran) break;
|
||||||
Couleur=SPRITE_CURSEUR[Forme][Compteur_Y][Compteur_X];
|
Couleur=SPRITE_CURSEUR[Forme][Compteur_Y][Compteur_X];
|
||||||
// On sauvegarde dans FOND_CURSEUR pour restaurer plus tard
|
// On sauvegarde dans FOND_CURSEUR pour restaurer plus tard
|
||||||
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(Pos_X,Pos_Y);
|
FOND_CURSEUR[Compteur_Y][Compteur_X]=Lit_pixel(Pos_X,Pos_Y);
|
||||||
if (Couleur!=CM_Trans)
|
if (Couleur!=CM_Trans)
|
||||||
Pixel(Pos_X,Pos_Y,Couleur);
|
Pixel(Pos_X,Pos_Y,Couleur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),Compteur_X,Compteur_Y);
|
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),Compteur_X,Compteur_Y);
|
||||||
break;
|
break;
|
||||||
@ -1824,14 +1824,14 @@ void Effacer_curseur(void)
|
|||||||
|
|
||||||
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15;Pos_X++,Compteur_X++)
|
for (Pos_X=Debut_X,Compteur_X=0;Compteur_X<15;Pos_X++,Compteur_X++)
|
||||||
{
|
{
|
||||||
if(Pos_X<0) continue;
|
if(Pos_X<0) continue;
|
||||||
if(Pos_X>=Largeur_ecran) break;
|
if(Pos_X>=Largeur_ecran) break;
|
||||||
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15;Pos_Y++,Compteur_Y++)
|
for (Pos_Y=Debut_Y,Compteur_Y=0;Compteur_Y<15;Pos_Y++,Compteur_Y++)
|
||||||
{
|
{
|
||||||
if(Pos_Y<0) continue;
|
if(Pos_Y<0) continue;
|
||||||
if(Pos_Y>=Hauteur_ecran) break;
|
if(Pos_Y>=Hauteur_ecran) break;
|
||||||
Pixel(Pos_X,Pos_Y,FOND_CURSEUR[Compteur_Y][Compteur_X]);
|
Pixel(Pos_X,Pos_Y,FOND_CURSEUR[Compteur_Y][Compteur_X]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),Compteur_X,Compteur_Y);
|
UpdateRect(Max(Debut_X,0),Max(Debut_Y,0),Compteur_X,Compteur_Y);
|
||||||
break;
|
break;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user