From cb1cac1b6fa8080281652c1105b04d125a5eb8f2 Mon Sep 17 00:00:00 2001 From: Adrien Destugues Date: Mon, 16 Mar 2009 20:14:52 +0000 Subject: [PATCH] removed gfx2cfg, we don't need it anymore. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@678 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- Makefile | 39 +-- Makefile.dep | 13 +- gfx2cfg.gif | Bin 1134 -> 0 bytes gfx2cfg.ico | Bin 2238 -> 0 bytes gfxcfg.c | 746 --------------------------------------------------- 5 files changed, 13 insertions(+), 785 deletions(-) delete mode 100644 gfx2cfg.gif delete mode 100644 gfx2cfg.ico delete mode 100644 gfxcfg.c diff --git a/Makefile b/Makefile index cb98195b..67b08fa2 100644 --- a/Makefile +++ b/Makefile @@ -40,7 +40,6 @@ ifdef COMSPEC RMDIR = rmdir CP = cp BIN = grafx2.exe - CFGBIN = gfxcfg.exe COPT = -W -Wall -Wdeclaration-after-statement -O -g -ggdb `sdl-config --cflags` $(TTFCOPT) $(JOYCOPT) LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) -lpng CC = gcc @@ -64,7 +63,6 @@ else RMDIR = rmdir CP = cp BIN = grafx2 - CFGBIN = gfxcfg COPT = -Wall -c -gstabs -mcrt=newlib `sdl-config --cflags` -D__USE_INLINE__ $(TTFCOPT) LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) -lft2 CC = gcc @@ -79,7 +77,6 @@ else RMDIR = rmdir CP = cp BIN = grafx2 - CFGBIN = gfxcfg COPT = -Wall -g `sdl-config --cflags` $(TTFCOPT) LOPT = -lSDL_image `sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT) -lfreetype2shared CC = gcc @@ -94,7 +91,6 @@ else RMDIR = rmdir CP = cp BIN = grafx2 - CFGBIN = gfxcfg COPT = -Wall -gstabs -c `sdl-config --cflags` $(TTFCOPT) LOPT = -lSDL_image `sdl-config --libs` -lpng -ljpeg -lz $(TTFLOPT) CC = gcc @@ -109,7 +105,6 @@ else RMDIR = rmdir CP = cp BIN = grafx2 - CFGBIN = gfxcfg COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT) -I/boot/home/config/include LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) CC = gcc @@ -123,7 +118,6 @@ else RMDIR = rmdir CP = cp BIN = grafx2 - CFGBIN = gfxcfg COPT = -W -Wall -c -g `sdl-config --cflags` $(TTFCOPT) -I/boot/common/include LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) CC = gcc @@ -137,7 +131,6 @@ else RMDIR = rmdir CP = cp BIN = grafx2 - CFGBIN = gfxcfg COPT = -W -Wall -Wdeclaration-after-statement -c -g `sdl-config --cflags` $(TTFCOPT) LOPT = `sdl-config --libs` -lSDL_image -lpng -ljpeg -lz $(TTFLOPT) CC = gcc @@ -161,7 +154,6 @@ else ZIP = zip PLATFORMFILS = gfx2.png BIN = grafx2 - CFGBIN = gfxcfg COPT = -c99 LOPT = CC = Logiciels:vbcc/bin/vc @@ -184,7 +176,6 @@ else #cross compile a Win32 executable CC = i586-mingw32msvc-gcc BIN = grafx2.exe - CFGBIN = gfxcfg.exe COPT = -W -Wall -Wdeclaration-after-statement -O -g -ggdb -Dmain=SDL_main `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --cflags` $(TTFCOPT) LOPT = -mwindows -lmingw32 -lSDLmain -lSDL -lshlwapi `/usr/local/cross-tools/i386-mingw32/bin/sdl-config --libs` -lSDL_image $(TTFLOPT) OBJDIR = obj/win32 @@ -194,7 +185,6 @@ else #cross compile an exec for the gp2x CC = /opt/open2x/gcc-4.1.1-glibc-2.3.6/arm-open2x-linux/bin/arm-open2x-linux-gcc BIN = grafx2.gpe - CFGBIN = gfxcfg.gpe COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -static -c -g -O3 `/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config --cflags` $(TTFCOPT) -D__GP2X__ LOPT = -static -lSDL_image `/opt/open2x/gcc-4.1.1-glibc-2.3.6/bin/sdl-config --static-libs` -ljpeg -lpng -lz -lm $(TTFLOPT) OBJDIR = obj/gp2x @@ -205,7 +195,6 @@ else # Compiles a regular linux exectutable for the native platform BIN = grafx2 - CFGBIN = gfxcfg COPT = -W -Wall -Wdeclaration-after-statement -pedantic -std=c99 -c -g `sdl-config --cflags` $(TTFCOPT) LOPT = `sdl-config --libs` -lSDL_image $(TTFLOPT) CC = gcc @@ -246,30 +235,25 @@ endif # This is the list of the objects we want to build. Dependancies are built by "make depend" automatically. OBJ = $(OBJDIR)/main.o $(OBJDIR)/init.o $(OBJDIR)/graph.o $(OBJDIR)/sdlscreen.o $(OBJDIR)/divers.o $(OBJDIR)/special.o $(OBJDIR)/boutons.o $(OBJDIR)/palette.o $(OBJDIR)/aide.o $(OBJDIR)/operatio.o $(OBJDIR)/pages.o $(OBJDIR)/loadsave.o $(OBJDIR)/readline.o $(OBJDIR)/moteur.o $(OBJDIR)/files.o $(OBJDIR)/op_c.o $(OBJDIR)/readini.o $(OBJDIR)/saveini.o $(OBJDIR)/shade.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/version.o $(OBJDIR)/texte.o $(OBJDIR)/SFont.o $(OBJDIR)/setup.o $(OBJDIR)/pxsimple.o $(OBJDIR)/pxtall.o $(OBJDIR)/pxwide.o $(OBJDIR)/pxdouble.o $(OBJDIR)/windows.o $(OBJDIR)/brush.o $(OBJDIR)/realpath.o $(OBJDIR)/mountlist.o $(OBJDIR)/input.o $(OBJDIR)/hotkeys.o -CFGOBJ = $(OBJDIR)/gfxcfg.o $(OBJDIR)/SFont.o $(OBJDIR)/clavier.o $(OBJDIR)/io.o $(OBJDIR)/setup.o $(OBJDIR)/hotkeys.o -all : $(BIN) $(CFGBIN) +all : $(BIN) debug : $(BIN) # Make release will strip the executable to make it smaller but non-debugable -release : $(BIN) $(CFGBIN) +release : $(BIN) $(STRIP) $(BIN) - $(STRIP) $(CFGBIN) # Create a zip archive ready for upload to the website, including binaries and sourcecode -ziprelease: version $(BIN) $(BINCFG) release +ziprelease: version $(BIN) release tar cvzf src-svn`svnversion | sed 's/:/-/'`.tgz *.c *.h Makefile Makefile.dep gfx2.ico gfx2cfg.ico - $(ZIP) $(ZIPOPT) grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-$(PLATFORM).$(ZIP) $(BIN) $(CFGBIN) gfx2def.ini gfx2gui.gif 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) $(ZIPOPT) grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-$(PLATFORM).$(ZIP) $(BIN) gfx2def.ini gfx2gui.gif gfx2.gif gfx2cfg.gif doc/gpl-2.0.txt fonts/8pxfont.png doc/README-zlib1.txt doc/README-SDL.txt doc/README-SDL_image.txt doc/README-SDL_ttf.txt fonts/Tuffy.ttf src-svn`svnversion | sed 's/:/-/'`.tgz $(PLATFORMFILES) $(DELCOMMAND) src-svn`svnversion | sed 's/:/-/'`.tgz tar cvzf grafx2-svn`svnversion | sed 's/:/-/'`$(TTFLABEL)-src.tgz *.c *.h Makefile Makefile.dep gfx2def.ini gfx2gui.gif gfx2.ico gfx2cfg.ico gfx2.gif gfx2cfg.gif doc/gpl-2.0.txt fonts/8pxfont.png fonts/Tuffy.ttf $(BIN) : $(OBJ) $(OBJRES) $(CC) $(OBJ) $(OBJRES) -o $(BIN) $(LOPT) -$(CFGBIN) : $(CFGOBJ) $(CFGOBJRES) - $(CC) $(CFGOBJ) $(CFGOBJRES) -o $(CFGBIN) $(LOPT) - # SVN revision number version.c : echo "char SVN_revision[]=\"`svnversion`\";" > version.c @@ -290,24 +274,17 @@ depend : $(OBJDIR)/winres.o : gfx2.ico echo "1 ICON \"gfx2.ico\"" | $(WINDRES) -o $(OBJDIR)/winres.o -$(OBJDIR)/wincfgres.o : gfx2cfg.ico - echo "1 ICON \"gfx2cfg.ico\"" | $(WINDRES) -o $(OBJDIR)/wincfgres.o - clean : - $(DELCOMMAND) $(OBJ) $(CFGOBJ) $(OBJDIR)/version.o $(OBJRES) $(CFGOBJRES) - $(DELCOMMAND) $(BIN) $(CFGBIN) + $(DELCOMMAND) $(OBJ) $(OBJDIR)/version.o $(OBJRES) + $(DELCOMMAND) $(BIN) # Linux installation of the program -install : $(BIN) $(CFGBIN) +install : $(BIN) echo "#!/bin/sh" > $(bindir)/grafx2 echo $(datadir)/grafx2/$(BIN) '$$*' >> $(bindir)/grafx2 chmod 755 $(bindir)/grafx2 - echo "#!/bin/sh" > $(bindir)/gfxcfg - echo $(datadir)/grafx2/$(CFGBIN) '$$*' >> $(bindir)/gfxcfg - chmod 755 $(bindir)/gfxcfg $(if $(wildcard $(datadir)/grafx2),,$(MKDIR) $(datadir)/grafx2) $(CP) $(BIN) $(datadir)/grafx2/ - $(CP) $(CFGBIN) $(datadir)/grafx2/ $(CP) gfx2def.ini $(datadir)/grafx2/ $(CP) gfx2gui.gif $(datadir)/grafx2/ $(CP) gfx2.gif $(datadir)/grafx2/ @@ -319,9 +296,7 @@ install : $(BIN) $(CFGBIN) # Linux uninstallation of the program uninstall : $(DELCOMMAND) $(bindir)/grafx2 - $(DELCOMMAND) $(bindir)/gfxcfg $(DELCOMMAND) $(datadir)/grafx2/$(BIN) - $(DELCOMMAND) $(datadir)/grafx2/$(CFGBIN) $(DELCOMMAND) $(datadir)/grafx2/gfx2def.ini $(DELCOMMAND) $(datadir)/grafx2/gfx2gui.gif $(DELCOMMAND) $(datadir)/grafx2/gfx2.gif diff --git a/Makefile.dep b/Makefile.dep index 56955749..7b4dcdb5 100644 --- a/Makefile.dep +++ b/Makefile.dep @@ -1,4 +1,3 @@ -$(OBJDIR)/SFont.o: SFont.c SFont.h $(OBJDIR)/aide.o: aide.c const.h struct.h global.h divers.h moteur.h tables_aide.h \ aide.h sdlscreen.h texte.h clavier.h windows.h input.h hotkeys.h \ erreurs.h @@ -12,9 +11,7 @@ $(OBJDIR)/clavier.o: clavier.c global.h struct.h const.h $(OBJDIR)/divers.o: divers.c struct.h const.h sdlscreen.h global.h erreurs.h \ boutons.h moteur.h divers.h clavier.h windows.h palette.h input.h $(OBJDIR)/files.o: files.c const.h struct.h global.h divers.h erreurs.h io.h \ - windows.h loadsave.h -$(OBJDIR)/gfxcfg.o: gfxcfg.c SFont.h struct.h const.h clavier.h io.h hotkeys.h \ - setup.h + windows.h loadsave.h mountlist.h moteur.h $(OBJDIR)/graph.o: graph.c global.h struct.h const.h moteur.h boutons.h pages.h \ erreurs.h sdlscreen.h graph.h divers.h pxsimple.h pxtall.h pxwide.h \ pxdouble.h windows.h @@ -32,8 +29,8 @@ $(OBJDIR)/main.o: main.c const.h struct.h global.h graph.h divers.h init.h \ readini.h saveini.h io.h texte.h setup.h windows.h brush.h palette.h $(OBJDIR)/moteur.o: moteur.c const.h struct.h global.h graph.h divers.h special.h \ boutons.h operatio.h shade.h erreurs.h sdlscreen.h windows.h brush.h \ - input.h -$(OBJDIR)/mountlist.o: mountlist.c + input.h moteur.h +$(OBJDIR)/mountlist.o: mountlist.c mountlist.h $(OBJDIR)/op_c.o: op_c.c op_c.h struct.h const.h erreurs.h $(OBJDIR)/operatio.o: operatio.c const.h struct.h global.h divers.h moteur.h \ graph.h operatio.h boutons.h pages.h erreurs.h sdlscreen.h brush.h \ @@ -43,7 +40,8 @@ $(OBJDIR)/pages.o: pages.c global.h struct.h const.h pages.h erreurs.h divers.h $(OBJDIR)/palette.o: palette.c const.h struct.h global.h divers.h moteur.h \ readline.h boutons.h pages.h aide.h sdlscreen.h erreurs.h op_c.h \ windows.h input.h -$(OBJDIR)/pxdouble.o: pxdouble.c global.h struct.h const.h sdlscreen.h divers.h +$(OBJDIR)/pxdouble.o: pxdouble.c global.h struct.h const.h sdlscreen.h divers.h \ + pxwide.h $(OBJDIR)/pxsimple.o: pxsimple.c global.h struct.h const.h sdlscreen.h divers.h $(OBJDIR)/pxtall.o: pxtall.c global.h struct.h const.h sdlscreen.h divers.h \ pxsimple.h @@ -57,6 +55,7 @@ $(OBJDIR)/saveini.o: saveini.c const.h global.h struct.h readini.h io.h erreurs. $(OBJDIR)/sdlscreen.o: sdlscreen.c global.h struct.h const.h sdlscreen.h erreurs.h \ divers.h $(OBJDIR)/setup.o: setup.c struct.h const.h io.h files.h +$(OBJDIR)/SFont.o: SFont.c SFont.h $(OBJDIR)/shade.o: shade.c global.h struct.h const.h graph.h moteur.h divers.h \ readline.h aide.h sdlscreen.h windows.h input.h $(OBJDIR)/special.o: special.c const.h struct.h global.h graph.h moteur.h windows.h diff --git a/gfx2cfg.gif b/gfx2cfg.gif deleted file mode 100644 index 0a4ca88a8f2b36443539e40473276419bf9395ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1134 zcmZ?wbh9u|RA5kGn9cwK4Pe{=p<-AZ_9QekG#of^;15vz55pfY1*Cy25U8mcMWZ1w zOhSO+j}9=A19O4`13SlmhX0&09vdDwFmMQKh5X2W=+w+0=P{*Y!6H`{HU^V9FCH{D z_j8!Y)g&xf(lA*gQ0#();1b3jRcEfA45OvKjN0Z>1s^V@__WxtN=&E-Rz2Ns*Q&KP zr}?8@owPofT+ZN4OG^W)ux&IzZP&Yjxv@#JCE`PXEmr)@gX9C~uo z+tb@~o^B5R9~Z_ub-apTnW|^i5z+FFbzw-)- zgG)GFE?aJUuzd&q<9EP*&GYL}=`VUm_OV6`ai5GEc=e;BCHW@=GzpAu?SzcYHh2gqb}0mxIIqJ+F63A{q- z^-7_}qk?Uh)tf~zFa?99dDjkVD>P?BHb;Mx=Y&@kR)WG+sWkXVuxb-AxrG9rQAN7R z!XjW51caX8&bz9QTL_a-gEM8AMeruNtS63^*dyWMTDq_eheg2~-0->=tdDE;g;4Nr zP#at9QSt!>wS&?)?*O6oWUIZha_nBPPO or - write to the Free Software Foundation, Inc., - 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -*/ -//C -#include -#include -#include - -//POSIX -#include - -//SDL -#include -#include -#include -//#include - -//mine -#include "SFont.h" - -// Modificateurs pour Touche -#define MOD_SHIFT 0x1000 -#define MOD_CTRL 0x2000 -#define MOD_ALT 0x4000 - -#define TOUCHE_MOUSEMIDDLE (SDLK_LAST+1) -#define TOUCHE_MOUSEWHEELUP (SDLK_LAST+2) -#define TOUCHE_MOUSEWHEELDOWN (SDLK_LAST+3) -#define TOUCHE_BUTTON (SDLK_LAST+4) - -#ifdef __gp2x__ - #define TOUCHE_ESC (TOUCHE_BUTTON+GP2X_BUTTON_X) -#else - #define TOUCHE_ESC SDLK_ESCAPE -#endif - -#include "struct.h" -#include "clavier.h" -#include "const.h" -#include "io.h" -#include "hotkeys.h" -#include "setup.h" - -/*** Constants ***/ -#define NB_MAX_TOUCHES 134 -#define HAUTEUR_DEBUT_SETUP 7 -#define HAUTEUR_FIN_SETUP 44 -#define Header_size sizeof(Config_Header) -#define Chunk_size sizeof(Config_Chunk) - -/* Colors */ -#define COULEUR_SETUP 1 -#define COULEUR_SELECT 8 - - - -/*** Global variables ***/ -SFont_Font* MyFont; -SDL_Surface* Ecran; -char Repertoire_config[TAILLE_CHEMIN_FICHIER]; -char Repertoire_donnees[TAILLE_CHEMIN_FICHIER]; - -bool Erreur[NB_MAX_TOUCHES]; -uint8_t Choix_enreg; -uint16_t Decalage_curseur=0; -uint16_t Position_curseur=0; - -byte * FichierConfig = NULL; -byte * ChunkData[CHUNK_MAX]; -Config_Chunk Chunk[CHUNK_MAX]; - - -uint8_t Fenetre_choix(int Largeur, int Hauteur, const char* Titre, const char* Choix, uint8_t Choix_debut, - uint8_t Couleur,uint8_t Couleur_choix); - -/*** Fonctions de gestion des évènements SDL ***/ - -/* Attend qu'une touche soit pressée. Retourne le code touche. */ -word Lire_Touche(void) -{ - SDL_Event Event; - - do{ - SDL_WaitEvent(&Event); - if(Event.type==SDL_KEYDOWN) - { - word Touche = Conversion_Touche(Event.key.keysym); - if (Touche != 0) - return Touche; - } - }while(1); -} - -/*** Drawing functions ***/ - -/* Draws a filled rectanble */ -void Cadre(int x,int y,int w,int h,uint8_t color) -{ - SDL_Rect rct; - rct.x=x; - rct.y=y; - rct.w=w; - rct.h=h; - - SDL_FillRect(Ecran, &rct, color); -} - -/* Draws the main screen and welcome message */ -void Dessiner_ecran_principal() -{ - Cadre(3,3,630,40,2); - SFont_Write(Ecran, MyFont, 8,6,"Setup program for Grafx2 (c) 1996-98 Sunset Design and 2008 PulkoMandy"); - SFont_Write(Ecran, MyFont, 8,18,"Use Up/Down arrows & Page-Up/Page-Down to scroll, Enter to modify,"); - SFont_Write(Ecran, MyFont, 8,30,"Delete to remove a hot-key and Escape to validate or cancel."); - - Cadre(3,47,630,10,86); - SFont_Write(Ecran,MyFont,8 ,48,"Option"); - SFont_Write(Ecran,MyFont,8*40,48,"Hot-Key"); - SFont_Write(Ecran,MyFont,8*75,48,"Err"); - - SDL_UpdateRect(Ecran,0,0,640,480); -} - -/* Displays informations about an option */ -void Ecrire(uint8_t Ligne, uint16_t Num_option, uint8_t Couleur) -{ - Cadre(3,Ligne*9,630,9,Couleur); - SFont_Write(Ecran,MyFont,8,Ligne*9,ConfigTouche[Num_option].Libelle); - SFont_Write(Ecran,MyFont,40*8,Ligne*9,Nom_touche(ConfigTouche[Num_option].Touche)); - if(Erreur[Num_option]) - SFont_Write(Ecran,MyFont,77*8,Ligne*9,"X"); - Cadre(39*8,Ligne*9,1,9,255); - Cadre(74*8,Ligne*9,1,9,255); - SDL_UpdateRect(Ecran,3,Ligne*9,630,9); -} - -/* Displays comment about an option */ -void Ecrire_commentaire(uint16_t Num_option) -{ - Cadre(8,50*9,630,18,0); - SFont_Write(Ecran,MyFont,8,50*9,ConfigTouche[Num_option].Explic1); - SFont_Write(Ecran,MyFont,8,51*9,ConfigTouche[Num_option].Explic2); - SDL_UpdateRect(Ecran,8,50*9,631,19); -} - -/* Display the options list */ -void Tout_ecrire() -{ - uint8_t i = HAUTEUR_DEBUT_SETUP; - - Cadre(3,64,630,340,COULEUR_SETUP); - while(i<=HAUTEUR_FIN_SETUP && i < NB_MAX_TOUCHES + HAUTEUR_DEBUT_SETUP) - { - Ecrire(i,Decalage_curseur+i-HAUTEUR_DEBUT_SETUP, - (i==HAUTEUR_DEBUT_SETUP+Position_curseur)?COULEUR_SELECT:COULEUR_SETUP); - i++; - } - - Cadre(39*8,46,1,360,255); - Cadre(74*8,46,1,360,255); - - SDL_UpdateRect(Ecran,0,0,640,480); - - Ecrire_commentaire(Decalage_curseur+Position_curseur); -} - -/*** Configuration handling functions ***/ - - -/* Reads the config file */ -/* returns an error message, or NULL if everything OK */ -char * Interpretation_du_fichier_config() -{ - char Nom_Fichier[TAILLE_CHEMIN_FICHIER]; - FILE* Fichier; - long int Taille_fichier; - byte Numero_chunk; - word Taille_chunk; - byte * Ptr; - int i; - - strcpy(Nom_Fichier, Repertoire_config); - strcat(Nom_Fichier, "gfx2.cfg"); - Fichier = fopen(Nom_Fichier,"rb"); - if (!Fichier) - { - return "gfx2.cfg is missing! Please run the\nmain program to generate it."; - } - fseek(Fichier,0,SEEK_END); // Positionnement à la fin - Taille_fichier = ftell(Fichier); - if (!Taille_fichier) - { - fclose(Fichier); - return "gfx2.cfg is empty. Please run the main\nprogram to generate it."; - } - FichierConfig = malloc(Taille_fichier); - if (!Fichier) - { - fclose(Fichier); - return "Out of memory when reading gfx2.cfg."; - } - fseek(Fichier,0,SEEK_SET); // Positionnement au début - if (! read_bytes(Fichier, FichierConfig, Taille_fichier)) - { - fclose(Fichier); - return "Error while reading gfx2.cfg."; - } - fclose(Fichier); - - // Initialisation des "index" - for (i=0; i= CHUNK_MAX) - return "File gfx2.cfg invalid."; - - ChunkData[Numero_chunk] = Ptr; - Chunk[Numero_chunk].Taille = Taille_chunk; -// printf("%d %6X %d\n", Numero_chunk, Ptr - FichierConfig, Taille_chunk); - Ptr+=Taille_chunk; - } - // Si la config contenait des touches, on les initialise: - if (Chunk[CHUNK_TOUCHES].Taille) - { - unsigned int Indice_config; - Ptr = ChunkData[CHUNK_TOUCHES]; - for (Indice_config=0; Indice_config 0) - { - if(Position_curseur <= HAUTEUR_FIN_SETUP - HAUTEUR_DEBUT_SETUP && Position_curseur > 0) - { - Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur, - COULEUR_SETUP); - (Position_curseur) -- ; - Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur, - COULEUR_SELECT); - } - else if(Decalage_curseur>0) - { - (Decalage_curseur) -- ; - Tout_ecrire(); - } - Ecrire_commentaire(Position_curseur + Decalage_curseur); - } -} - -/* Moves one line down */ -void Scroll_bas() -{ - if(Position_curseur + Decalage_curseur < (NB_MAX_TOUCHES-1)) - { - if(Position_curseur < HAUTEUR_FIN_SETUP - HAUTEUR_DEBUT_SETUP) - { - Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur, - COULEUR_SETUP); - (Position_curseur) ++ ; - Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur) ,Position_curseur + Decalage_curseur, - COULEUR_SELECT); - } - else if(Decalage_curseur < (NB_MAX_TOUCHES-1)) - { - (Decalage_curseur) ++ ; - Tout_ecrire(); - } - Ecrire_commentaire(Position_curseur + Decalage_curseur ); - } -} - -/* Moves one screen up */ -void Page_up() -{ - if(Position_curseur+Decalage_curseur>0) - { - if(Position_curseur>0) - { - Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur, - COULEUR_SETUP); - Position_curseur = 0 ; - Ecrire(HAUTEUR_DEBUT_SETUP + (Position_curseur),Position_curseur + Decalage_curseur, - COULEUR_SELECT); - } - else if(Decalage_curseur>0) - { - if(Decalage_curseur > HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP) - Decalage_curseur-=HAUTEUR_FIN_SETUP-HAUTEUR_DEBUT_SETUP; - else Decalage_curseur=0; - - Tout_ecrire(); - } - Ecrire_commentaire(Position_curseur+Decalage_curseur); - } -} - -/* Moves one screen down */ -void Page_down() -{ - if(Position_curseur+Decalage_curseur<(NB_MAX_TOUCHES-1)) - { - if(Position_curseurpixels))[(y*32+x)] != 255) - Masque_icone[(y*32+x)/8] |=0x80>>(x&7); - SDL_WM_SetIcon(Icone,Masque_icone); - } - } - Ecran = SDL_SetVideoMode(640,480,8,0); - SDL_WM_SetCaption ("Grafx2 configuration tool","Gfx2Cfg"); - SDL_EnableKeyRepeat(250, 32); - SDL_EnableUNICODE(SDL_ENABLE); - - /* On initialise SFont */ - strcpy(Nom_fichier, Repertoire_donnees); - strcat(Nom_fichier, "fonts/8pxfont.png"); - MyFont = SFont_InitFont(IMG_Load(Nom_fichier)); - - if(MyFont==NULL) - { - SDL_Quit(); - exit(0); - } - - Dessiner_ecran_principal(); - - if(!Initialiser_config()) - { - Setup(); - Enregistrer_config(); - - /* On fait un peu de nettoyage avant de s'en aller */ - SFont_FreeFont(MyFont); - SDL_Quit(); - exit(0); - } - else - { - SFont_FreeFont(MyFont); - SDL_Quit(); - exit(1); - } - } - else - { - puts("Error: you mustn't run this setup program from a read-only drive!\n"); - puts("The most probable cause of this error is that you are running this program"); - puts("from a CD-Rom or a protected floppy disk."); - puts("You should try to copy all the files of Grafx2 on a hard drive or to"); - puts("unprotect your floppy disk if you really want to run it from this outdated medium."); - exit(1); - } - - return 0; -}