Bookmarks: '...' now disappears when Renaming, Clear asks for confirmation, empty bookmarks display the dropdown on both mouse buttons and their only itemis "Set".

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@662 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2009-02-27 23:40:56 +00:00
parent 2688bbb3b4
commit e9bc7f35c4
4 changed files with 42 additions and 23 deletions

View File

@ -2545,9 +2545,6 @@ byte Bouton_Load_ou_Save(byte Load, byte Image)
Dropdown_bookmark[Temp]=
Fenetre_Definir_bouton_dropdown(126+(88+1)*(Temp%2),17+(Temp/2)*12,88,11,56,"",0,0,1,A_DROITE); // 10-13
Fenetre_Afficher_sprite_drive(Dropdown_bookmark[Temp]->Pos_X+3,Dropdown_bookmark[Temp]->Pos_Y+2,5);
Fenetre_Dropdown_choix(Dropdown_bookmark[Temp],0,"Set");
Fenetre_Dropdown_choix(Dropdown_bookmark[Temp],1,"Rename");
Fenetre_Dropdown_choix(Dropdown_bookmark[Temp],2,"Clear");
Afficher_bookmark(Dropdown_bookmark[Temp],Temp);
}
// On prend bien soin de passer dans le répertoire courant (le bon qui faut! Oui madame!)
@ -2873,14 +2870,20 @@ byte Bouton_Load_ou_Save(byte Load, byte Image)
case 1: // Rename
if (Config.Bookmark_directory[Bouton_clicke-10])
{
Readline_ex(Dropdown_bookmark[Bouton_clicke-10]->Pos_X+3+10,Dropdown_bookmark[Bouton_clicke-10]->Pos_Y+2,Config.Bookmark_label[Bouton_clicke-10],8,8,0);
// On enlève les "..." avant l'édition
char Bookmark_label[8+1];
strcpy(Bookmark_label, Config.Bookmark_label[Bouton_clicke-10]);
if (Bookmark_label[7]==CARACTERE_SUSPENSION)
Bookmark_label[7]='\0';
if (Readline_ex(Dropdown_bookmark[Bouton_clicke-10]->Pos_X+3+10,Dropdown_bookmark[Bouton_clicke-10]->Pos_Y+2,Bookmark_label,8,8,0))
strcpy(Config.Bookmark_label[Bouton_clicke-10],Bookmark_label);
Afficher_bookmark(Dropdown_bookmark[Bouton_clicke-10],Bouton_clicke-10);
Afficher_curseur();
}
break;
case 2: // Clear
if (Config.Bookmark_directory[Bouton_clicke-10])
if (Config.Bookmark_directory[Bouton_clicke-10] && Demande_de_confirmation("Erase bookmark ?"))
{
free(Config.Bookmark_directory[Bouton_clicke-10]);
Config.Bookmark_directory[Bouton_clicke-10]=NULL;

17
files.c
View File

@ -54,6 +54,7 @@
#include "windows.h"
#include "loadsave.h"
#include "mountlist.h"
#include "moteur.h"
#define COULEUR_FICHIER_NORMAL CM_Clair // Couleur du texte pour une ligne de fichier non sélectionné
#define COULEUR_REPERTOIRE_NORMAL CM_Fonce // Couleur du texte pour une ligne de répertoire non sélectionné
@ -718,13 +719,29 @@ void Afficher_bookmark(struct Fenetre_Bouton_dropdown * Bouton, int Numero_bookm
if (Config.Bookmark_directory[Numero_bookmark])
{
int Taille;
// Libellé
Print_dans_fenetre_limite(Bouton->Pos_X+3+10,Bouton->Pos_Y+2,Config.Bookmark_label[Numero_bookmark],8,CM_Noir,CM_Clair);
Taille=strlen(Config.Bookmark_label[Numero_bookmark]);
if (Taille<8)
Block(Fenetre_Pos_X+(Menu_Facteur_X*(Bouton->Pos_X+3+10+Taille*8)),Fenetre_Pos_Y+(Menu_Facteur_Y*(Bouton->Pos_Y+2)),Menu_Facteur_X*(8-Taille)*8,Menu_Facteur_Y*8,CM_Clair);
// Menu apparait sur clic droit
Bouton->Bouton_actif=A_DROITE;
// Choix actifs
Fenetre_Dropdown_vider_choix(Bouton);
Fenetre_Dropdown_choix(Bouton,0,"Set");
Fenetre_Dropdown_choix(Bouton,1,"Rename");
Fenetre_Dropdown_choix(Bouton,2,"Clear");
}
else
{
// Libellé
Print_dans_fenetre(Bouton->Pos_X+3+10,Bouton->Pos_Y+2,"--------",CM_Fonce,CM_Clair);
// Menu apparait sur clic droit ou gauche
Bouton->Bouton_actif=A_DROITE|A_GAUCHE;
// Choix actifs
Fenetre_Dropdown_vider_choix(Bouton);
Fenetre_Dropdown_choix(Bouton,0,"Set");
}
}

View File

@ -39,6 +39,8 @@
#include "windows.h"
#include "brush.h"
#include "input.h"
#include "moteur.h"
// we need this as global
short Old_MX = -1;
@ -1160,7 +1162,6 @@ void Fermer_fenetre(void)
struct Fenetre_Bouton_scroller * Temp3;
struct Fenetre_Bouton_special * Temp4;
struct Fenetre_Bouton_dropdown * Temp5;
struct Bouton_dropdown_choix * Temp6;
Effacer_curseur();
@ -1191,15 +1192,7 @@ void Fermer_fenetre(void)
while (Fenetre_Liste_boutons_dropdown)
{
Temp5=Fenetre_Liste_boutons_dropdown->Next;
// Il faut libérer la liste des boutons qui sont dans le dropdown
while (Fenetre_Liste_boutons_dropdown->Premier_choix)
{
Temp6 = Fenetre_Liste_boutons_dropdown->Premier_choix->Next;
free(Fenetre_Liste_boutons_dropdown->Premier_choix);
Fenetre_Liste_boutons_dropdown->Premier_choix = Temp6;
}
Fenetre_Dropdown_vider_choix(Fenetre_Liste_boutons_dropdown);
free(Fenetre_Liste_boutons_dropdown);
Fenetre_Liste_boutons_dropdown=Temp5;
}
@ -1637,6 +1630,18 @@ void Fenetre_Dropdown_choix(struct Fenetre_Bouton_dropdown * Dropdown, word Nume
}
}
// ------------- Suppression de tous les choix d'une dropdown ---------
void Fenetre_Dropdown_vider_choix(struct Fenetre_Bouton_dropdown * Dropdown)
{
struct Bouton_dropdown_choix * Choix_suivant;
while (Dropdown->Premier_choix)
{
Choix_suivant=Dropdown->Premier_choix->Next;
free(Dropdown->Premier_choix);
Dropdown->Premier_choix=Choix_suivant;
}
}
//----------------------- Ouverture d'un pop-up -----------------------
void Ouvrir_popup(word Pos_X, word Pos_Y, word Largeur,word Hauteur)
@ -1730,13 +1735,7 @@ void Fermer_popup(void)
}
while (Fenetre_Liste_boutons_dropdown)
{
while (Fenetre_Liste_boutons_dropdown->Premier_choix)
{
struct Bouton_dropdown_choix *Temp6;
Temp6=Fenetre_Liste_boutons_dropdown->Premier_choix->Next;
free(Fenetre_Liste_boutons_dropdown->Premier_choix);
Fenetre_Liste_boutons_dropdown->Premier_choix=Temp6;
}
Fenetre_Dropdown_vider_choix(Fenetre_Liste_boutons_dropdown);
Temp5=Fenetre_Liste_boutons_dropdown->Next;
free(Fenetre_Liste_boutons_dropdown);
Fenetre_Liste_boutons_dropdown=Temp5;

View File

@ -67,7 +67,7 @@ struct Fenetre_Bouton_special * Fenetre_Definir_bouton_special(word Pos_X,word P
struct Fenetre_Bouton_special * Fenetre_Definir_bouton_saisie(word Pos_X,word Pos_Y,word Largeur_en_caracteres);
struct Fenetre_Bouton_dropdown * Fenetre_Definir_bouton_dropdown(word Pos_X,word Pos_Y,word Largeur,word Hauteur,word Largeur_choix,char *Libelle,byte Affiche_choix,byte Affiche_centre,byte Affiche_fleche,byte Bouton_actif);
void Fenetre_Dropdown_choix(struct Fenetre_Bouton_dropdown * Dropdown, word Numero, const char *Libelle);
void Fenetre_Dropdown_vider_choix(struct Fenetre_Bouton_dropdown * Dropdown);
byte Fenetre_click_dans_zone(short Debut_X,short Debut_Y,short Fin_X,short Fin_Y);
short Attendre_click_dans_palette(struct Fenetre_Bouton_palette * Enreg);
void Recuperer_couleur_derriere_fenetre(byte * Couleur, byte * Click);