# gfxcfg.c File Reference

`#include <stdbool.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <unistd.h>`
`#include <SDL.h>`
`#include <SDL_image.h>`
`#include <SDL_events.h>`
`#include "SFont.h"`
`#include "struct.h"`
`#include "clavier.h"`
`#include "const.h"`
`#include "io.h"`
`#include "hotkeys.h"`
`#include "setup.h"`

## Defines
#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)
#define | TOUCHE_ESC SDLK_ESCAPE
#define | NB_MAX_TOUCHES 134
#define | HAUTEUR_DEBUT_SETUP 7
#define | HAUTEUR_FIN_SETUP 44
#define | Header_size sizeof(struct Config_Header)
#define | Chunk_size sizeof(struct Config_Chunk)
#define | COULEUR_SETUP 1
#define | COULEUR_SELECT 8
## Functions
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)
word | Lire_Touche (void)
void | Cadre (int x, int y, int w, int h, uint8_t color)
void | Dessiner_ecran_principal ()
void | Ecrire (uint8_t Ligne, uint16_t Num_option, uint8_t Couleur)
void | Ecrire_commentaire (uint16_t Num_option)
void | Tout_ecrire ()
char * | Interpretation_du_fichier_config ()
bool | Initialiser_config ()
void | Test_duplic ()
bool | Validation ()
void | Scroll_haut ()
void | Scroll_bas ()
void | Page_up ()
void | Page_down ()
void | Select ()
void | Setup ()
bool | Verifier_ecriture_possible ()
void | Enregistrer_config ()
int | main (__attribute__((unused)) int argc, __attribute__((unused)) char *argv[])
## 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]
struct Config_Chunk | Chunk [CHUNK_MAX]

## Define Documentation

#define MOD_SHIFT 0x1000

Referenced by Bouton_Degrades(), Bouton_Palette(), Bouton_Trame_Menu(), Fenetre_Numero_bouton_touche(), Handle_Joystick_Release(), Handle_Key_Release(), Modificateurs_Touche(), and Nom_touche().

#define MOD_CTRL 0x2000

Referenced by Handle_Joystick_Release(), Handle_Key_Release(), Modificateurs_Touche(), and Nom_touche().

#define MOD_ALT 0x4000

Referenced by Handle_Joystick_Release(), Handle_Key_Release(), Modificateurs_Touche(), and Nom_touche().

#define TOUCHE_MOUSEMIDDLE (SDLK_LAST+1)

Referenced by Handle_Mouse_Click(), and Nom_touche().

#define TOUCHE_MOUSEWHEELUP (SDLK_LAST+2)

Referenced by Bouton_Load_ou_Save(), Bouton_Texte(), Fenetre_aide(), Handle_Mouse_Click(), and Nom_touche().

#define TOUCHE_MOUSEWHEELDOWN (SDLK_LAST+3)

Referenced by Bouton_Load_ou_Save(), Bouton_Texte(), Fenetre_aide(), Handle_Mouse_Click(), and Nom_touche().

#define TOUCHE_BUTTON (SDLK_LAST+4)

Referenced by Handle_Joystick_Press(), and Nom_touche().

#define TOUCHE_ESC SDLK_ESCAPE

Referenced by Attendre_click_dans_palette(), Attendre_click_dans_shade(), Bouton_Brush_FX(), Bouton_Colorize_Menu(), Bouton_Copy_page(), Bouton_Degrades(), Bouton_Effets(), Bouton_Load_ou_Save(), Bouton_Menu_Grille(), Bouton_Menu_Loupe(), Bouton_Menu_pinceaux(), Bouton_Palette(), Bouton_Palette_secondaire(), Bouton_Quick_shade_Menu(), Bouton_Quitter_Routine_locale(), Bouton_Resol(), Bouton_Settings(), Bouton_Smooth_Menu(), Bouton_Spray_Menu(), Bouton_Stats(), Bouton_Texte(), Bouton_Tiling_Menu(), Bouton_Trame_Menu(), Demande_de_confirmation(), Fenetre_aide(), Fenetre_controle(), Menu_Shade(), Menu_Tag_couleurs(), Message_Memoire_insuffisante(), Message_Non_disponible(), Readline_ex(), Recuperer_couleur_derriere_fenetre(), Redefinir_controle(), and Warning_message().

#define NB_MAX_TOUCHES 134

Referenced by Enregistrer_config(), Interpretation_du_fichier_config(), Page_down(), Scroll_bas(), Test_duplic(), Tout_ecrire(), and Validation().

#define HAUTEUR_DEBUT_SETUP 7

Referenced by Page_down(), Page_up(), Scroll_bas(), Scroll_haut(), Select(), and Tout_ecrire().

#define HAUTEUR_FIN_SETUP 44

Referenced by Page_down(), Page_up(), Scroll_bas(), and Tout_ecrire().

#define Header_size sizeof(struct Config_Header)

Referenced by Interpretation_du_fichier_config().

#define Chunk_size sizeof(struct Config_Chunk)

#define COULEUR_SETUP 1

Referenced by Page_down(), Page_up(), Scroll_bas(), Scroll_haut(), Select(), and Tout_ecrire().

#define COULEUR_SELECT 8

Referenced by Page_down(), Page_up(), Scroll_bas(), Scroll_haut(), and Tout_ecrire().

## Function Documentation

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 |
| ) |  |  |

References Cadre(), Ecran, Lire_Touche(), SFont_Write(), Touche, and Tout_ecrire().

Referenced by Initialiser_config(), and Validation().

word Lire_Touche | ( | void |  | ) |

References Conversion_Touche(), and Touche.

Referenced by Fenetre_choix(), Select(), and Setup().

void Cadre | ( | int | x,
|  | int | y,
|  | int | w,
|  | int | h,
|  | uint8_t | color |
| ) |  |  |

References Ecran.

Referenced by Dessiner_ecran_principal(), Ecrire(), Ecrire_commentaire(), Fenetre_choix(), Select(), and Tout_ecrire().

void Dessiner_ecran_principal | ( |  | ) |

References Cadre(), Ecran, and SFont_Write().

Referenced by main().

void Ecrire | ( | uint8_t | Ligne,
|  | uint16_t | Num_option,
|  | uint8_t | Couleur |
| ) |  |  |

References Cadre(), ConfigTouche, Ecran, Erreur, Nom_touche(), SFont_Write(), and Touche.

Referenced by Page_down(), Page_up(), Scroll_bas(), Scroll_haut(), Select(), and Tout_ecrire().

void Ecrire_commentaire | ( | uint16_t | Num_option | ) |

References Cadre(), ConfigTouche, Ecran, and SFont_Write().

Referenced by Page_down(), Page_up(), Scroll_bas(), Scroll_haut(), and Tout_ecrire().

void Tout_ecrire | ( |  | ) |

References Cadre(), COULEUR_SELECT, COULEUR_SETUP, Decalage_curseur, Ecran, Ecrire(), Ecrire_commentaire(), HAUTEUR_DEBUT_SETUP, HAUTEUR_FIN_SETUP, NB_MAX_TOUCHES, and Position_curseur.

Referenced by Fenetre_choix(), Page_down(), Page_up(), Scroll_bas(), Scroll_haut(), Select(), and Setup().

char* Interpretation_du_fichier_config | ( |  | ) |

References Chunk, CHUNK_MAX, CHUNK_TOUCHES, ChunkData, ConfigTouche, endian_magic16(), FichierConfig, Header_size, NB_MAX_TOUCHES, Config_Infos_touche::Numero, Config_Chunk::Numero, read_bytes(), Repertoire_config, Config_Chunk::Taille, TAILLE_CHEMIN_FICHIER, S_ConfigTouche::Touche, Touche, and Config_Infos_touche::Touche2.

Referenced by Initialiser_config().

bool Initialiser_config | ( |  | ) |

References Fenetre_choix(), and Interpretation_du_fichier_config().

Referenced by main().

void Test_duplic | ( |  | ) |

References ConfigTouche, Erreur, NB_MAX_TOUCHES, and Touche.

Referenced by Select(), and Setup().

bool Validation | ( |  | ) |

References Choix_enreg, Erreur, Fenetre_choix(), and NB_MAX_TOUCHES.

Referenced by Setup().

void Scroll_haut | ( |  | ) |

References COULEUR_SELECT, COULEUR_SETUP, Decalage_curseur, Ecrire(), Ecrire_commentaire(), HAUTEUR_DEBUT_SETUP, Position_curseur, and Tout_ecrire().

Referenced by Setup().

void Scroll_bas | ( |  | ) |

References COULEUR_SELECT, COULEUR_SETUP, Decalage_curseur, Ecrire(), Ecrire_commentaire(), HAUTEUR_DEBUT_SETUP, HAUTEUR_FIN_SETUP, NB_MAX_TOUCHES, Position_curseur, and Tout_ecrire().

Referenced by Setup().

void Page_up | ( |  | ) |

References COULEUR_SELECT, COULEUR_SETUP, Decalage_curseur, Ecrire(), Ecrire_commentaire(), HAUTEUR_DEBUT_SETUP, HAUTEUR_FIN_SETUP, Position_curseur, and Tout_ecrire().

Referenced by Setup().

void Page_down | ( |  | ) |

References COULEUR_SELECT, COULEUR_SETUP, Decalage_curseur, Ecrire(), Ecrire_commentaire(), HAUTEUR_DEBUT_SETUP, HAUTEUR_FIN_SETUP, NB_MAX_TOUCHES, Position_curseur, and Tout_ecrire().

Referenced by Setup().

void Select | ( |  | ) |

References Cadre(), ConfigTouche, COULEUR_SETUP, Decalage_curseur, Ecran, Ecrire(), HAUTEUR_DEBUT_SETUP, Lire_Touche(), Position_curseur, SFont_Write(), Test_duplic(), S_ConfigTouche::Touche, Touche, and Tout_ecrire().

Referenced by Setup().

void Setup | ( |  | ) |

References Lire_Touche(), Page_down(), Page_up(), Scroll_bas(), Scroll_haut(), Select(), Test_duplic(), Touche, Tout_ecrire(), and Validation().

Referenced by main().

bool Verifier_ecriture_possible | ( |  | ) |

References Repertoire_config.

Referenced by main().

void Enregistrer_config | ( |  | ) |

References BETA1, Config_Header::Beta1, BETA2, Config_Header::Beta2, Choix_enreg, Chunk, CHUNK_MAX, CHUNK_TOUCHES, ChunkData, ConfigTouche, NB_MAX_TOUCHES, Config_Infos_touche::Numero, Config_Chunk::Numero, Repertoire_config, Config_Header::Signature, Config_Chunk::Taille, TAILLE_CHEMIN_FICHIER, Touche, Config_Infos_touche::Touche2, VERSION1, Config_Header::Version1, VERSION2, Config_Header::Version2, write_bytes(), and write_word_le().

Referenced by main().

int main | ( | __attribute__((unused)) int | argc,
|  | __attribute__((unused)) char * | argv[] |
| ) |  |  |

References Dessiner_ecran_principal(), Ecran, Enregistrer_config(), Initialiser_config(), Repertoire_config, Repertoire_donnees, Set_Config_Directory(), Set_Data_Directory(), Set_Program_Directory(), Setup(), SFont_FreeFont(), SFont_InitFont(), TAILLE_CHEMIN_FICHIER, and Verifier_ecriture_possible().

## Variable Documentation

SFont_Font* MyFont

SDL_Surface* Ecran

Referenced by Affiche_brosse_Double(), Affiche_brosse_Simple(), Affiche_brosse_Tall(), Affiche_brosse_Wide(), Afficher_partie_de_l_ecran_Double(), Afficher_partie_de_l_ecran_Simple(), Afficher_partie_de_l_ecran_Tall(), Afficher_partie_de_l_ecran_Wide(), Afficher_une_ligne_ecran_Double(), Afficher_une_ligne_ecran_fast_Double(), Afficher_une_ligne_ecran_fast_Wide(), Afficher_une_ligne_ecran_Simple(), Afficher_une_ligne_ecran_Tall(), Afficher_une_ligne_ecran_Wide(), Afficher_une_ligne_transparente_a_l_ecran_Simple(), Afficher_une_ligne_transparente_a_l_ecran_Wide(), Afficher_une_ligne_transparente_mono_a_l_ecran_Double(), Afficher_une_ligne_transparente_mono_a_l_ecran_Simple(), Afficher_une_ligne_transparente_mono_a_l_ecran_Wide(), Cadre(), Clear_brush_Double(), Clear_brush_Simple(), Clear_brush_Tall(), Clear_brush_Wide(), Dessiner_ecran_principal(), Display_brush_Color_Double(), Display_brush_Color_Simple(), Display_brush_Color_Tall(), Display_brush_Color_Wide(), Display_brush_Color_zoom_Double(), Display_brush_Color_zoom_Tall(), Display_brush_Mono_Double(), Display_brush_Mono_Simple(), Display_brush_Mono_Tall(), Display_brush_Mono_Wide(), Ecrire(), Ecrire_commentaire(), Effacer_image_courante_Stencil(), Fenetre_choix(), Ligne_horizontale_XOR_Double(), Ligne_horizontale_XOR_Simple(), Ligne_horizontale_XOR_Tall(), Ligne_horizontale_XOR_Wide(), Ligne_verticale_XOR_Double(), Ligne_verticale_XOR_Simple(), Ligne_verticale_XOR_Tall(), Ligne_verticale_XOR_Wide(), Lire_une_ligne_ecran_Double(), Lire_une_ligne_ecran_Simple(), Lire_une_ligne_ecran_Tall(), Lire_une_ligne_ecran_Wide(), Lit_Pixel_Double(), Lit_Pixel_Simple(), Lit_Pixel_Tall(), Lit_Pixel_Wide(), main(), Pixel_Double(), Pixel_Simple(), Pixel_Tall(), Pixel_Wide(), Remap_screen_Double(), Remap_screen_Simple(), Remap_screen_Tall(), Remap_screen_Wide(), Select(), Set_Mode_SDL(), and Tout_ecrire().

char Repertoire_config[TAILLE_CHEMIN_FICHIER]

Referenced by Enregistrer_config(), Interpretation_du_fichier_config(), main(), and Verifier_ecriture_possible().

char Repertoire_donnees[TAILLE_CHEMIN_FICHIER]

Referenced by main().

bool Erreur[NB_MAX_TOUCHES]

uint8_t Choix_enreg

Referenced by Enregistrer_config(), and Validation().

uint16_t Decalage_curseur = 0

Referenced by Page_down(), Page_up(), Scroll_bas(), Scroll_haut(), Select(), and Tout_ecrire().

uint16_t Position_curseur = 0

Referenced by Bouton_Resol(), Bouton_Texte(), Page_down(), Page_up(), Scroll_bas(), Scroll_haut(), Select(), and Tout_ecrire().

byte* FichierConfig = NULL

Referenced by Interpretation_du_fichier_config().

byte* ChunkData[CHUNK_MAX]

Referenced by Enregistrer_config(), and Interpretation_du_fichier_config().

struct Config_Chunk Chunk[CHUNK_MAX]

Referenced by Enregistrer_config(), and Interpretation_du_fichier_config().