From 1b183d586150a167343b3490c41be21b6c13484b Mon Sep 17 00:00:00 2001 From: Franck Charlet Date: Wed, 12 Nov 2008 13:30:22 +0000 Subject: [PATCH] - Added handling for right mouse button when entering filenames input array (clears it) also using escape key restores old filename. - Clicking the button with default filename in an empty directory wouldn't work. git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@334 416bcca6-2ee7-4201-b75f-2eb2f807beb1 --- boutons.c | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/boutons.c b/boutons.c index f850d794..6c069f07 100644 --- a/boutons.c +++ b/boutons.c @@ -2400,6 +2400,7 @@ byte Bouton_Load_ou_Save(byte Load, byte Image) char Repertoire_precedent[TAILLE_CHEMIN_FICHIER]; // Répertoire d'où l'on vient après un CHDIR char Commentaire_initial[TAILLE_COMMENTAIRE+1]; char Fichier_recherche[TAILLE_CHEMIN_FICHIER]=""; + char Nom_fichier_Save[TAILLE_CHEMIN_FICHIER]; char * Fichier_le_plus_ressemblant; Palette_initiale=(struct Composantes *)malloc(sizeof(T_Palette)); @@ -2535,6 +2536,24 @@ byte Bouton_Load_ou_Save(byte Load, byte Image) break; case 1 : // Load ou Save + if(Load) + { + // Determine the type + if(Fichier_existe(Principal_Nom_fichier)) + { + Type_selectionne = 0; + if(Repertoire_existe(Principal_Nom_fichier)) Type_selectionne = 1; + } + else + { + Type_selectionne = 1; + } + } + else + { + if(Repertoire_existe(Principal_Nom_fichier)) Type_selectionne = 1; + else Type_selectionne = 0; + } On_a_clicke_sur_OK=1; break; @@ -2633,7 +2652,7 @@ byte Bouton_Load_ou_Save(byte Load, byte Image) Principal_File_list_Decalage=Temp; // On récupére le nom du schmilblick à "accéder" - Determiner_element_de_la_liste(Principal_File_list_Position,Principal_File_list_Decalage,Principal_Nom_fichier,&Type_selectionne); + Determiner_element_de_la_liste(Principal_File_list_Position,Principal_File_list_Decalage,Principal_Nom_fichier,&Type_selectionne); // On affiche le nouveau nom de fichier Print_Nom_fichier_dans_selecteur(); // On affiche à nouveau la liste @@ -2697,7 +2716,16 @@ byte Bouton_Load_ou_Save(byte Load, byte Image) break; case 8 : // Saisie du nom de fichier Effacer_curseur(); - Principal_Nom_fichier[0] = '\0'; + + // Save the filename + strcpy(Nom_fichier_Save, Principal_Nom_fichier); + + // Erase the content when the right mouse button is used. + + if (Mouse_K==2) + { + Principal_Nom_fichier[0] = '\0'; + } if (Readline(13+9*8,90,Principal_Nom_fichier,27,2)) { // On regarde s'il faut rajouter une extension. C'est-à-dire s'il @@ -2746,6 +2774,12 @@ byte Bouton_Load_ou_Save(byte Load, byte Image) } On_a_clicke_sur_OK=1; } + else + { + // Restore the old filename + strcpy(Principal_Nom_fichier, Nom_fichier_Save); + Print_dans_fenetre(13+9*8,90,Principal_Nom_fichier,CM_Noir,CM_Clair); + } Afficher_curseur(); break; case 9 : // Volume Select