Commit 396cc003 authored by Ziirish's avatar Ziirish

fixing newline character in gui tips

parent 2d188cc9
......@@ -46,10 +46,10 @@ ROTATION=0
#b Keep corners during rotate
KEEP_CORNERS=
#c+4[0;1] Color of the background (r,g,b,a)
#c+4[0;1] Color of the background (r,g,b,a)/
COLOR=1;1;1;0.2;
#c+4[0;1] Color of the mask when the mouse is over
#c+4[0;1] Color of the mask when the mouse is over/
FLYING_COLOR=0;0;0;0.7;
#b Show the mask over the image
......@@ -99,10 +99,10 @@ TITLE=
#ti[5;20] Size of the police
POLICE_SIZE=15
#tc+4[0;1] Color of the text
#tc+4[0;1] Color of the text/
POLICE_COLOR=1;1;1;1;
#tc+4[0;1] Color of outline's text
#tc+4[0;1] Color of outline's text/
OUTLINE_COLOR=0;0;0;0.5;
......
......@@ -456,13 +456,16 @@ cid_generate_ihm_from_keyfile (GKeyFile *pKeyFile, const gchar *cTitle, GtkWindo
pHBox = gtk_hbox_new (FALSE, 1);
if (pTipString != NULL)
{
//g_print ("pTipString : '%s'\n", pTipString);
gchar *pTmpTip = g_strdup (dgettext (cGettextDomain, pTipString));
cid_parse_nl (&pTmpTip);
//g_print ("pTmpTip : '%s'\n", pTmpTip);
pEventBox = gtk_event_box_new ();
gtk_container_add (GTK_CONTAINER (pEventBox), pHBox);
gtk_tooltips_set_tip (GTK_TOOLTIPS (pToolTipsGroup),
pEventBox,
dgettext (cGettextDomain, pTipString),
pTmpTip,
"pouet");
g_free (pTmpTip);
} else
pEventBox = NULL;
......
......@@ -1130,4 +1130,32 @@ cid_free_substitute (CidSubstitute *pSub)
g_free (pSub->replacement);
g_free (pSub);
}
void
cid_parse_nl (gchar **input)
{
gchar *in = *input;
gint length = strlen (in);
gint ind = 0, cpt = 0;
gchar *output = g_malloc (sizeof(gchar)*length+1);
while (ind<length)
{
if (in[ind] == '\\' && ind < length-1 && in[ind+1] == 'n')
{
output[cpt] = '\n';
ind++;
}
else
{
output[cpt] = in[ind];
}
ind++,cpt++;
}
output[cpt] = '\0';
g_free (in);
in = NULL;
in = g_strdup (output);
g_free (output);
}
......@@ -275,12 +275,18 @@ void cid_substitute_user_params (gchar **cPath);
*/
CidSubstitute *cid_new_substitute (const gchar *regex, const gchar *replacement);
/**
* Libère une structure CidSubstitute.
* @param pSub La structure à libérer.
*/
/**
* Libère une structure CidSubstitute.
* @param pSub La structure à libérer.
*/
void cid_free_substitute (CidSubstitute *pSub);
/**
* Permet de transformer une chaîne "\n" en caractère '\n'.
* @param input Pointeur vers la chaîne à parser.
*/
void cid_parse_nl (gchar **input);
#define BEGIN_FOREACH_DT(dt) \
CidDataTable *p_dt=dt; \
CidDataCase *p_temp=p_dt->head; \
......
......@@ -221,7 +221,7 @@ main ( int argc, char **argv )
{
//char **argvBis = malloc(sizeof(argv));
//memcpy(argvBis,argv,sizeof(argv));
struct sigaction action;
cid = g_malloc0 (sizeof(*cid));
......@@ -230,7 +230,7 @@ main ( int argc, char **argv )
cid->defaut = g_malloc0 (sizeof(*(cid->defaut)));
/// TODO: debug
/*
/*
int argcBis = argc, a=0;
char **argvBis = calloc(argc,sizeof(char));
if (argvBis==NULL)
......@@ -342,6 +342,17 @@ main ( int argc, char **argv )
g_free (test);
*/
/*
int i = 1;
for (;i<argc;i++)
{
gchar *tmp = g_strdup (argv[i]);
fprintf (stdout,"avant: %s\n",tmp);
cid_parse_nl (&tmp);
fprintf (stdout,"après: %s\n",tmp);
g_free (tmp);
}
*/
fprintf (stdout,"Bye !\n");
return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment