Load/Save: Removed the drive icons

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@651 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-02-21 20:49:50 +00:00
parent 4db4454794
commit b9f1116fd3
6 changed files with 85 additions and 77 deletions

View File

@ -2457,9 +2457,7 @@ byte Bouton_Load_ou_Save(byte Load, byte Image)
struct Fenetre_Bouton_dropdown * Dropdown_des_formats;
short Temp;
int Bidon=0; // Sert à appeler SDL_GetKeyState
word Drives_Debut_Y;
byte Charger_ou_sauver_l_image=0;
char Nom_drive[3]=" ";
byte On_a_clicke_sur_OK=0;// Indique si on a clické sur Load ou Save ou sur
//un bouton enclenchant Load ou Save juste après.
struct Composantes * Palette_initiale; // | Données concernant l'image qui
@ -2568,15 +2566,6 @@ byte Bouton_Load_ou_Save(byte Load, byte Image)
// Selecteur de Lecteur / Volume
Fenetre_Definir_bouton_normal(8,21,120,14,"Select drive",0,1,SDLK_LAST); // 9
// Définition des boutons représentant les lecteurs
Drives_Debut_Y=(Nb_drives<=8)? 23 : 18;
for (Temp=0; Temp<Nb_drives; Temp++)
{
Nom_drive[0]=Drive[Temp].Lettre;
Fenetre_Definir_bouton_normal(130+((Temp%8)*20),Drives_Debut_Y+((Temp/8)*12),19,11,Nom_drive,0,1, SDLK_LAST); // 10 et +
Fenetre_Afficher_sprite_drive(140+((Temp%8)*20),Drives_Debut_Y+2+((Temp/8)*12),Drive[Temp].Type);
}
// On prend bien soin de passer dans le répertoire courant (le bon qui faut! Oui madame!)
if (Load)
{
@ -2852,27 +2841,8 @@ byte Bouton_Load_ou_Save(byte Load, byte Image)
Afficher_curseur();
Nouvelle_preview=1;
break;
default : // Drives
// On change de lecteur:
if (! ActiverLecteur(Bouton_clicke-10))
{
Effacer_curseur();
// On lit le répertoire courant de ce lecteur
Determiner_repertoire_courant();
// Comme on tombe sur un disque qu'on connait pas, on se place en
// début de liste:
Principal_File_list_Position=0;
Principal_File_list_Decalage=0;
// Affichage des premiers fichiers visibles:
Relire_liste_fichiers(Principal_Format,Principal_File_list_Position,Principal_File_list_Decalage,Scroller_de_fichiers);
Afficher_curseur();
Nouvelle_preview=1;
}
else
{
// Un ptit flash rouge pour signaler le lecteur invalide.
Erreur(0);
}
default:
break;
}
switch (Touche)

97
files.c
View File

@ -290,9 +290,6 @@ void bstrtostr( BSTR in, STRPTR out, TEXT max )
// -- Lecture d'une liste de lecteurs / volumes -----------------------------
void Lire_liste_des_lecteurs(void)
{
#ifndef __amigaos4__
int Indice;
#endif
// Empty the current content of fileselector:
Detruire_liste_du_fileselect();
@ -318,23 +315,89 @@ void Lire_liste_des_lecteurs(void)
UnLockDosList( LDF_VOLUMES | LDF_READ );
}
}
// Other platforms: simply read the "static" list of Drives.
// This should be made dynamic because in the multitask world, user can mount new drives,
// connect to network ones, and so on, while Grafx2 is running.
#else
#ifndef __macosx__
#warning "Your platform is missing some specific code here ! please check and correct ! :)"
#endif
for (Indice=0; Indice<Nb_drives; Indice++)
#elif defined (__WIN32__)
{
char NomLecteur[]="A:\\";
int DriveBits = GetLogicalDrives();
int IndiceLecteur;
int IndiceBit;
// Sous Windows, on a la totale, presque aussi bien que sous DOS:
IndiceLecteur = 0;
for (IndiceBit=0; IndiceBit<26 && IndiceLecteur<23; IndiceBit++)
{
// Add the drive's name ("c:\\", "/" etc.) to the list
Ajouter_element_a_la_liste(Drive[Indice].Chemin, 2);
Liste_Nb_repertoires++;
if ( (1 << IndiceBit) & DriveBits )
{
// On a ce lecteur, il faut maintenant déterminer son type "physique".
// pour profiter des jolies icones de X-man.
int TypeLecteur;
char CheminLecteur[]="A:\\";
// Cette API Windows est étrange, je dois m'y faire...
CheminLecteur[0]='A'+IndiceBit;
switch (GetDriveType(CheminLecteur))
{
case DRIVE_CDROM:
TypeLecteur=LECTEUR_CDROM;
break;
case DRIVE_REMOTE:
TypeLecteur=LECTEUR_NETWORK;
break;
case DRIVE_REMOVABLE:
TypeLecteur=LECTEUR_FLOPPY_3_5;
break;
case DRIVE_FIXED:
TypeLecteur=LECTEUR_HDD;
break;
default:
TypeLecteur=LECTEUR_NETWORK;
break;
}
NomLecteur[0]='A'+IndiceBit;
Ajouter_element_a_la_liste(NomLecteur,2);
Liste_Nb_repertoires++;
IndiceLecteur++;
}
}
}
#else
{
//Sous les différents unix, on va mettre
// un disque dur qui pointera vers la racine,
// et un autre vers le home directory de l'utilisateur.
// Ensuite on utilise read_file_system_list pour compléter
struct mount_entry* Liste_points_montage;
struct mount_entry* next;
#if defined(__BEOS__) || defined(__HAIKU__)
char * Home = getenv("$HOME");
#else
char * Home = getenv("HOME");
#endif
Ajouter_lecteur('/', LECTEUR_HDD, "/");
if(Home)
Ajouter_lecteur('~', LECTEUR_HDD, Home);
Liste_points_montage = read_file_system_list(false);
while(Liste_points_montage != NULL)
{
if(Liste_points_montage->me_dummy == 0 && strcmp(Liste_points_montage->me_mountdir,"/") && strcmp(Liste_points_montage->me_mountdir,"/home"))
{
Ajouter_element_a_la_liste(Liste_points_montage->me_mountdir,2);
Liste_Nb_repertoires++;
}
next = Liste_points_montage -> me_next;
#if !(defined(__macosx__) || defined(__FreeBSD__))
free(Liste_points_montage -> me_type);
#endif
free(Liste_points_montage -> me_devname);
free(Liste_points_montage -> me_mountdir);
free(Liste_points_montage);
Liste_points_montage = next;
}
}
#endif
Liste_Nb_elements=Liste_Nb_repertoires+Liste_Nb_fichiers;

View File

@ -651,10 +651,7 @@ GFX2_GLOBAL struct
// Informations sur les lecteurs
GFX2_GLOBAL byte Nb_drives;
GFX2_GLOBAL struct T_Drive Drive[26];
// Informations sur les lecteurs et autres images
GFX2_GLOBAL byte SPRITE_DRIVE[NB_SPRITES_DRIVES][HAUTEUR_SPRITE_DRIVE][LARGEUR_SPRITE_DRIVE];

22
init.c
View File

@ -69,23 +69,12 @@
#include "mountlist.h" // read_file_system_list
#include "loadsave.h" // Image_emergency_backup
// Ajouter un lecteur à la liste de lecteurs
void Ajouter_lecteur(char Lettre, byte Type, char *Chemin)
{
Drive[Nb_drives].Lettre=Lettre;
Drive[Nb_drives].Type =Type;
Drive[Nb_drives].Chemin=(char *)malloc(strlen(Chemin)+1);
strcpy(Drive[Nb_drives].Chemin, Chemin);
Nb_drives++;
}
// Rechercher la liste et le type des lecteurs de la machine
#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__)
void bstrtostr( BSTR in, STRPTR out, TEXT max );
#endif
/*
void Rechercher_drives(void)
{
#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__)
@ -188,14 +177,7 @@ void Rechercher_drives(void)
#endif
}
// Active un lecteur, changeant normalement le répertoire en cours.
// Renvoie 0 si ok, -1 si problème.
int ActiverLecteur(int NumeroLecteur)
{
return chdir(Drive[NumeroLecteur].Chemin);
}
*/
// Fonctions de lecture dans la skin de l'interface graphique
void Chercher_bas(SDL_Surface *GUI, int *Debut_X, int *Debut_Y, byte Couleur_neutre,char * Section)
{

2
init.h
View File

@ -18,7 +18,6 @@
write to the Free Software Foundation, Inc.,
59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
void Rechercher_drives(void);
void Charger_DAT(void);
void Initialisation_des_boutons(void);
void Initialisation_des_operations(void);
@ -26,6 +25,5 @@ int Charger_CFG(int Tout_charger);
int Sauver_CFG(void);
void Initialiser_les_tables_de_multiplication(void);
void Definition_des_modes_video(void);
int ActiverLecteur(int);
void Config_par_defaut(void);
void Initialiser_sighandler(void);

2
main.c
View File

@ -304,8 +304,6 @@ void Initialisation_du_programme(int argc,char * argv[])
// Choose directory for settings (read/write)
Set_Config_Directory(Repertoire_du_programme,Repertoire_de_configuration);
// On détecte les lecteurs qui sont accessibles:
Rechercher_drives();
// On détermine le répertoire courant:
Determiner_repertoire_courant();