#include #include #include #include "projet.h" #include "projetx.m" struct DIFF_INFO{ const char *fichier; const char *ref; }; /* Edite le commentaire d'un fichier. */ static void change_editdoc( const char *fichier,// Fichier source … documenter const char *ref, // Path vers le fichier original SSTRING &doc) // Texte à éditer { DIALOG dia; dia.newf_textarea ("",doc,70,10); dia.setbutinfo (MENU_USR1,MSG_U(B_RESET,"Reset"),MSG_R(B_RESET)); DIFF_INFO diff_info; diff_info.fichier = fichier; diff_info.ref = ref; if (ref != NULL){ dia.setbutinfo (MENU_USR2,MSG_U(B_DIFF,"Diff"),MSG_R(B_DIFF)); } char title[100]; if (ref == NULL){ snprintf (title,sizeof(title)-1,MSG_U(T_NEWSRC,"Nouveau fichier %s") ,fichier); }else{ snprintf (title,sizeof(title)-1,MSG_U(T_CHANGESRC,"Fichier %s") ,fichier); } int nof =0; while (1){ MENU_STATUS code = dia.edit (title,"",help_nil,nof ,MENUBUT_CANCEL|MENUBUT_ACCEPT|MENUBUT_USR1|MENUBUT_USR2); if (code == MENU_ESCAPE || code == MENU_CANCEL){ dia.restore(); break; }else if (code == MENU_USR1){ doc.setfrom (""); dia.reload(); }else if (code == MENU_USR2){ }else{ doc.strip_end (); break; } } } /* Pr‚sentation des fichiers d'un projet et ‚dition de la courte description des changements qu'ils ont subis. Retourne -1 si abandon ou erreur. */ int change_edit ( USERINFO *user, const char *projet) { PRJCTRL ctrl(user); int ret = -1; char path[MAXSIZ_PATH]; user->makusrpath(projet,path); SAVEPATH save; if (path_pushdir (user,path,&save) != -1){ SSTRINGS tb; int nb = ctrl.dirsource (".",WILD_ALLFILE,tb); if (nb <= 0){ xconf_error (MSG_U(E_NOSOURCE,"Aucun fichier modifié\n" "pour le projet %s") ,projet); }else{ CHANGE_DAT change ("change.dat"); MAKEFILE mkf ("makefile.dat",false,projet,user); DIALOG_RECORDS dia; dia.newf_head ("",MSG_U(H_FNAME,"File name\tStatus")); ret = 0; int select=0; while (1){ for (int i=0; iget(); dia.set_menuitem (i,fichier ,change.getdoc(fichier)==NULL ? "" : MSG_U(I_SOMEDOC,"Documented")); } MENU_STATUS code = dia.editmenu (MSG_U(T_CHANGE,"Fichiers changés") ,"",help_nil,select,0); if (code == MENU_QUIT || code == MENU_ESCAPE){ break; }else{ const char *fichier = tb.getitem(select)->get(); if (ctrl.isdir (fichier)){ char sous_projet[MAXSIZ_PATH]; path_make (projet,fichier,sous_projet); path_stripsep (sous_projet,sous_projet); change_edit (user,sous_projet); }else{ const char *doc = change.getdoc(fichier); SSTRING newdoc (doc); change_editdoc(fichier,mkf.getref(fichier) ,newdoc); change.setdoc (fichier,newdoc.get()); } } } change.save(); } path_popdir (&save); } return ret; }