00001
00002
00003
00004 void App_ChargerConfig()
00005 {
00006 FILE *pF=NULL;
00007 gchar c, mot[200], *tmp=NULL;
00008 guchar flag=0, b=0;
00009
00010
00011 if ( !(pF = fopen (AppConf,"r")) )
00012 {
00013
00014 return;
00015 }
00016 memset(mot,0,200);
00017
00018
00019 while ((c = fgetc (pF)) != EOF)
00020 {
00021 if (c == ':')
00022 {
00023 if (g_strcasecmp(mot, "LEFT" )==0) flag=1;
00024 else if (g_strcasecmp(mot, "TOP" )==0) flag=2;
00025 else if (g_strcasecmp(mot, "HEIGHT" )==0) flag=3;
00026 else if (g_strcasecmp(mot, "WIDTH" )==0) flag=4;
00027 else if (g_strcasecmp(mot, "MAXIMIZED" )==0) flag=5;
00028 else if (g_strcasecmp(mot, "BGROUND" )==0) flag=6;
00029 else if (g_strcasecmp(mot, "FONT" )==0) flag=7;
00030 else if (g_strcasecmp(mot, "SHOWRIGHTMARGIN")==0) flag=8;
00031 else if (g_strcasecmp(mot, "UNDOLEVELS" )==0) flag=9;
00032 else flag=0;
00033 memset(mot,0,b); b=0;
00034 }
00035 else if (c ==0XA)
00036 {
00037 if (flag==1)
00038 {
00039 tmp = g_locale_to_utf8 (mot, -1, NULL, NULL, NULL);
00040 AppLEFT = g_ascii_strtod(tmp,NULL);
00041 }
00042 else if (flag==2)
00043 {
00044 tmp = g_locale_to_utf8 (mot, -1, NULL, NULL, NULL);
00045 AppTOP = g_ascii_strtod(tmp,NULL);
00046 }
00047 else if (flag==3)
00048 {
00049 tmp = g_locale_to_utf8 (mot, -1, NULL, NULL, NULL);
00050 AppHEIGHT = g_ascii_strtod(tmp,NULL);
00051 }
00052 else if (flag==4)
00053 {
00054 tmp = g_locale_to_utf8 (mot, -1, NULL, NULL, NULL);
00055 AppWIDTH = g_ascii_strtod(tmp,NULL);
00056 }
00057 else if (flag==5)
00058 {
00059 tmp = g_locale_to_utf8 (mot, -1, NULL, NULL, NULL);
00060 AppMAXIMIZED = (g_ascii_strtod(tmp,NULL)) ? TRUE : FALSE;
00061 }
00062 else if (flag==6)
00063 AppBGROUND = g_locale_to_utf8 (mot, -1, NULL, NULL, NULL);
00064 else if (flag==7)
00065 AppFONT = g_locale_to_utf8 (mot, -1, NULL, NULL, NULL);
00066 else if (flag==8)
00067 {
00068 tmp = g_locale_to_utf8 (mot, -1, NULL, NULL, NULL);
00069 ShowRightMARGIN = (g_ascii_strtod(tmp,NULL)) ? TRUE : FALSE;
00070 }
00071 else if (flag==9)
00072 {
00073 tmp = g_locale_to_utf8 (mot, -1, NULL, NULL, NULL);
00074 AppUNDOLEVELS = (g_ascii_strtod(tmp,NULL))?TRUE:FALSE;
00075 }
00076 memset(mot,0,b); b=flag=0;
00077 }
00078 else if (c !=0XD) mot[b++] = c;
00079 }
00080 fclose (pF);
00081 if (tmp) g_free(tmp);
00082
00083 }
00084
00085
00086
00087
00088
00089
00090
00091
00092 void App_Lister_Tableau()
00093 {
00094 guint i;
00095 if (!NB) return;
00096 g_print("\nNB=%d NBfichiersOuverts=%d "
00097 "idOngletACTIF=%d idACTIF=%d\n",NB,NBfichiersOuverts,idOngletACTIF,idACTIF);
00098
00099 g_print("\tnom\tid\tExt\tModif\tOnglet\tchemin\n"
00100 "----------------------------------------------------------------\n");
00101 for (i=0; i<NB; i++)
00102 g_print("(%10s)\t%d\t%d\t%d\t%d\t(%s)\n", nom[i],
00103 i,
00104 ext[i],
00105 estModifie[i],
00106 IDOnglet[i],
00107 chemin[i]);
00108 }
00109
00110
00111
00112 gchar *getNomSansExtension(gchar *fich)
00113 {
00114 gchar *nom =NULL;
00115 gushort n,pos;
00116
00117 if (!fich) return NULL;
00118 n = strlen(fich);
00119 pos=n;
00120 while(pos>0)
00121 {
00122 if (fich[pos]=='.') break;
00123 pos--;
00124 };
00125
00126 if (pos)
00127 {
00128 nom=g_malloc(pos);
00129 strncpy(nom, fich, pos);
00130 nom[pos]='\0';
00131 }
00132 return nom;
00133 }
00134
00135
00136
00137
00138 gshort getExtension(gchar* fich)
00139 {
00140 gchar *exta =NULL;
00141 guint n,pos,len;
00142
00143
00144 if (g_file_test(fich, G_FILE_TEST_IS_DIR)) return -1;
00145
00146 n = pos = strlen(fich);
00147
00148 while(pos>0)
00149 {
00150 if (fich[pos]=='.') break;
00151 pos--;
00152 }
00153
00154 if (!pos)
00155 {
00156 if (g_strcasecmp(fich, "Makefile")==0) return -2;
00157 else return 0;
00158 }
00159
00160 len = n-pos;
00161 exta=g_malloc(len);
00162 strncpy(exta, fich+pos+1, len-1);
00163 exta[len-1]='\0';
00164 len=0;
00165
00166 for (n=1; n<nbEXT; n++)
00167 {
00168 if (g_strcasecmp(exta, EXTs[n])==0)
00169 {
00170 len=n;
00171 break;
00172 }
00173 }
00174 g_free (exta);
00175 return len;
00176 }
00177
00178
00179
00180
00181 void Ajouter_ELEMENT(gchar* unNom, gchar* unChemin, gshort onglet)
00182 {
00183
00184 nom [NB] = g_strdup(unNom);
00185 chemin [NB] = (unChemin) ? g_strdup(unChemin) : NULL;
00186 estModifie[NB] = FALSE;
00187 IDOnglet [NB] = onglet;
00188
00189 }
00190
00191
00192
00193