mirror of
https://github.com/weechat/weechat.git
synced 2026-07-01 07:16:37 +02:00
Allow more flexible format for palette options
Order of alias, pair and rgb is free and semicolon is not required any more before or after pair.
This commit is contained in:
@@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-12-20 12:52+0100\n"
|
||||
"POT-Creation-Date: 2010-12-21 09:22+0100\n"
|
||||
"PO-Revision-Date: 2010-11-06 11:55+0100\n"
|
||||
"Last-Translator: Jiri Golembiovsky <golemj@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -1766,7 +1766,7 @@ msgid ""
|
||||
"custom color in palette, format is: \"alias;fg,bg;r/g/b\" where alias is "
|
||||
"color name, fg,bg is \"foreground,background\" (example: \"200,-1\"), r/g/b "
|
||||
"is redefinition of color (terminal must support it) (everything is optional "
|
||||
"in this format)"
|
||||
"in this format and order is not important)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
|
||||
@@ -22,7 +22,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.3-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-12-20 12:52+0100\n"
|
||||
"POT-Creation-Date: 2010-12-21 09:22+0100\n"
|
||||
"PO-Revision-Date: 2010-12-07 23:21+0100\n"
|
||||
"Last-Translator: Nils G.\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -1825,7 +1825,7 @@ msgid ""
|
||||
"custom color in palette, format is: \"alias;fg,bg;r/g/b\" where alias is "
|
||||
"color name, fg,bg is \"foreground,background\" (example: \"200,-1\"), r/g/b "
|
||||
"is redefinition of color (terminal must support it) (everything is optional "
|
||||
"in this format)"
|
||||
"in this format and order is not important)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
|
||||
@@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-12-20 12:52+0100\n"
|
||||
"POT-Creation-Date: 2010-12-21 09:22+0100\n"
|
||||
"PO-Revision-Date: 2010-11-06 11:56+0100\n"
|
||||
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -1779,7 +1779,7 @@ msgid ""
|
||||
"custom color in palette, format is: \"alias;fg,bg;r/g/b\" where alias is "
|
||||
"color name, fg,bg is \"foreground,background\" (example: \"200,-1\"), r/g/b "
|
||||
"is redefinition of color (terminal must support it) (everything is optional "
|
||||
"in this format)"
|
||||
"in this format and order is not important)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
|
||||
@@ -21,8 +21,8 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-12-20 12:52+0100\n"
|
||||
"PO-Revision-Date: 2010-12-20 12:15+0100\n"
|
||||
"POT-Creation-Date: 2010-12-21 09:22+0100\n"
|
||||
"PO-Revision-Date: 2010-12-21 09:22+0100\n"
|
||||
"Last-Translator: Sebastien Helleu <flashcode@flashtux.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
"Language: French\n"
|
||||
@@ -1795,12 +1795,8 @@ msgid ""
|
||||
"custom color in palette, format is: \"alias;fg,bg;r/g/b\" where alias is "
|
||||
"color name, fg,bg is \"foreground,background\" (example: \"200,-1\"), r/g/b "
|
||||
"is redefinition of color (terminal must support it) (everything is optional "
|
||||
"in this format)"
|
||||
msgstr ""
|
||||
"couleur personnalisée dans la palette, le format est: \"alias;fg,bg;r/g/b\" "
|
||||
"où alias est le nom de la couleur, fg,bg est \"texte,fond\" (par exemple: "
|
||||
"\"200,-1\"), r/g/b est la redéfinition de la couleur (le terminal doit le "
|
||||
"supporter) (tout est optionnel dans ce format)"
|
||||
"in this format and order is not important)"
|
||||
msgstr "couleur personnalisée dans la palette, le format est: \"alias;fg,bg;r/g/b\" où alias est le nom de la couleur, fg,bg est \"texte,fond\" (par exemple: \"200,-1\"), r/g/b est la redéfinition de la couleur (le terminal doit le supporter) (tout est optionnel dans ce format et l'ordre n'est pas important)"
|
||||
|
||||
#, c-format
|
||||
msgid "%sError: palette option must be numeric"
|
||||
|
||||
@@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-12-20 12:52+0100\n"
|
||||
"POT-Creation-Date: 2010-12-21 09:22+0100\n"
|
||||
"PO-Revision-Date: 2010-11-05 17:17+0100\n"
|
||||
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -1589,7 +1589,7 @@ msgid ""
|
||||
"custom color in palette, format is: \"alias;fg,bg;r/g/b\" where alias is "
|
||||
"color name, fg,bg is \"foreground,background\" (example: \"200,-1\"), r/g/b "
|
||||
"is redefinition of color (terminal must support it) (everything is optional "
|
||||
"in this format)"
|
||||
"in this format and order is not important)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
|
||||
@@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-12-20 12:52+0100\n"
|
||||
"POT-Creation-Date: 2010-12-21 09:22+0100\n"
|
||||
"PO-Revision-Date: 2010-12-10 14:11+0100\n"
|
||||
"Last-Translator: Marco Paolone <marcopaolone@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -1786,7 +1786,7 @@ msgid ""
|
||||
"custom color in palette, format is: \"alias;fg,bg;r/g/b\" where alias is "
|
||||
"color name, fg,bg is \"foreground,background\" (example: \"200,-1\"), r/g/b "
|
||||
"is redefinition of color (terminal must support it) (everything is optional "
|
||||
"in this format)"
|
||||
"in this format and order is not important)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
|
||||
@@ -21,7 +21,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-12-20 12:52+0100\n"
|
||||
"POT-Creation-Date: 2010-12-21 09:22+0100\n"
|
||||
"PO-Revision-Date: 2010-11-06 11:56+0100\n"
|
||||
"Last-Translator: Krzysztof Koroscik <soltys@szluug.org>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -1787,7 +1787,7 @@ msgid ""
|
||||
"custom color in palette, format is: \"alias;fg,bg;r/g/b\" where alias is "
|
||||
"color name, fg,bg is \"foreground,background\" (example: \"200,-1\"), r/g/b "
|
||||
"is redefinition of color (terminal must support it) (everything is optional "
|
||||
"in this format)"
|
||||
"in this format and order is not important)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
|
||||
+2
-2
@@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-12-20 12:52+0100\n"
|
||||
"POT-Creation-Date: 2010-12-21 09:22+0100\n"
|
||||
"PO-Revision-Date: 2010-11-13 09:26+0100\n"
|
||||
"Last-Translator: Ivan Sichmann Freitas <ivansichfreitas@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -1420,7 +1420,7 @@ msgid ""
|
||||
"custom color in palette, format is: \"alias;fg,bg;r/g/b\" where alias is "
|
||||
"color name, fg,bg is \"foreground,background\" (example: \"200,-1\"), r/g/b "
|
||||
"is redefinition of color (terminal must support it) (everything is optional "
|
||||
"in this format)"
|
||||
"in this format and order is not important)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
|
||||
@@ -20,7 +20,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: WeeChat 0.3.4-dev\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-12-20 12:52+0100\n"
|
||||
"POT-Creation-Date: 2010-12-21 09:22+0100\n"
|
||||
"PO-Revision-Date: 2010-11-05 17:17+0100\n"
|
||||
"Last-Translator: Pavel Shevchuk <stlwrt@gmail.com>\n"
|
||||
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
|
||||
@@ -1598,7 +1598,7 @@ msgid ""
|
||||
"custom color in palette, format is: \"alias;fg,bg;r/g/b\" where alias is "
|
||||
"color name, fg,bg is \"foreground,background\" (example: \"200,-1\"), r/g/b "
|
||||
"is redefinition of color (terminal must support it) (everything is optional "
|
||||
"in this format)"
|
||||
"in this format and order is not important)"
|
||||
msgstr ""
|
||||
|
||||
#, fuzzy, c-format
|
||||
|
||||
+2
-2
@@ -7,7 +7,7 @@ msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: PACKAGE VERSION\n"
|
||||
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
|
||||
"POT-Creation-Date: 2010-12-20 12:52+0100\n"
|
||||
"POT-Creation-Date: 2010-12-21 09:22+0100\n"
|
||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||
@@ -1359,7 +1359,7 @@ msgid ""
|
||||
"custom color in palette, format is: \"alias;fg,bg;r/g/b\" where alias is "
|
||||
"color name, fg,bg is \"foreground,background\" (example: \"200,-1\"), r/g/b "
|
||||
"is redefinition of color (terminal must support it) (everything is optional "
|
||||
"in this format)"
|
||||
"in this format and order is not important)"
|
||||
msgstr ""
|
||||
|
||||
#, c-format
|
||||
|
||||
@@ -732,7 +732,7 @@ config_weechat_palette_create_option_cb (void *data,
|
||||
"where alias is color name, fg,bg is \"foreground,background\" "
|
||||
"(example: \"200,-1\"), r/g/b is redefinition of color "
|
||||
"(terminal must support it) (everything is optional "
|
||||
"in this format)"),
|
||||
"in this format and order is not important)"),
|
||||
NULL, 0, 0, "", value, 0, NULL, NULL,
|
||||
&config_weechat_palette_change_cb, NULL,
|
||||
NULL, NULL);
|
||||
|
||||
@@ -590,9 +590,9 @@ struct t_gui_color_palette *
|
||||
gui_color_palette_new (int number, const char *value)
|
||||
{
|
||||
struct t_gui_color_palette *new_color_palette;
|
||||
char *pos_semicolon, *ptr_value, *pos, *pos2, *error1, *error2, *error3;
|
||||
char **items, *pos, *pos2, *error1, *error2, *error3;
|
||||
char *str_alias, *str_pair, *str_rgb, str_number[64];
|
||||
int fg, bg, r, g, b;
|
||||
int num_items, i, fg, bg, r, g, b;
|
||||
|
||||
if (!value)
|
||||
return NULL;
|
||||
@@ -611,104 +611,85 @@ gui_color_palette_new (int number, const char *value)
|
||||
str_pair = NULL;
|
||||
str_rgb = NULL;
|
||||
|
||||
pos_semicolon = strchr (value, ';');
|
||||
if (pos_semicolon)
|
||||
items = string_split (value, ";", 0, 0, &num_items);
|
||||
if (items)
|
||||
{
|
||||
if (pos_semicolon > value)
|
||||
for (i = 0; i < num_items; i++)
|
||||
{
|
||||
str_alias = string_strndup (value, pos_semicolon - value);
|
||||
}
|
||||
ptr_value = pos_semicolon + 1;
|
||||
if (ptr_value[0])
|
||||
{
|
||||
pos_semicolon = strchr (ptr_value, ';');
|
||||
if (pos_semicolon)
|
||||
{
|
||||
if (pos_semicolon > ptr_value)
|
||||
{
|
||||
str_pair = string_strndup (ptr_value,
|
||||
pos_semicolon - ptr_value);
|
||||
}
|
||||
ptr_value = pos_semicolon + 1;
|
||||
if (ptr_value[0])
|
||||
{
|
||||
str_rgb = strdup (ptr_value);
|
||||
}
|
||||
}
|
||||
pos = strchr (items[i], ',');
|
||||
if (pos)
|
||||
str_pair = items[i];
|
||||
else
|
||||
str_pair = strdup (ptr_value);
|
||||
}
|
||||
}
|
||||
else if (value[0])
|
||||
{
|
||||
str_alias = strdup (value);
|
||||
}
|
||||
|
||||
if (str_alias)
|
||||
{
|
||||
new_color_palette->alias = strdup (str_alias);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf (str_number, sizeof (str_number), "%d", number);
|
||||
new_color_palette->alias = strdup (str_number);
|
||||
}
|
||||
|
||||
if (str_pair)
|
||||
{
|
||||
pos = strchr (str_pair, ',');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
error1 = NULL;
|
||||
fg = (int)strtol (str_pair, &error1, 10);
|
||||
error2 = NULL;
|
||||
bg = (int)strtol (pos + 1, &error2, 10);
|
||||
if (error1 && !error1[0] && error2 && !error2[0]
|
||||
&& (fg >= -1) && (bg >= -1))
|
||||
{
|
||||
new_color_palette->foreground = fg;
|
||||
new_color_palette->background = bg;
|
||||
pos = strchr (items[i], '/');
|
||||
if (pos)
|
||||
str_rgb = items[i];
|
||||
else
|
||||
str_alias = items[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (str_rgb)
|
||||
{
|
||||
pos = strchr (str_rgb, '/');
|
||||
if (pos)
|
||||
|
||||
if (str_alias)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos2 = strchr (pos + 1, '/');
|
||||
if (pos2)
|
||||
new_color_palette->alias = strdup (str_alias);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf (str_number, sizeof (str_number), "%d", number);
|
||||
new_color_palette->alias = strdup (str_number);
|
||||
}
|
||||
|
||||
if (str_pair)
|
||||
{
|
||||
pos = strchr (str_pair, ',');
|
||||
if (pos)
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
pos[0] = '\0';
|
||||
error1 = NULL;
|
||||
r = (int)strtol (str_rgb, &error1, 10);
|
||||
fg = (int)strtol (str_pair, &error1, 10);
|
||||
error2 = NULL;
|
||||
g = (int)strtol (pos + 1, &error2, 10);
|
||||
error3 = NULL;
|
||||
b = (int)strtol (pos2 + 1, &error3, 10);
|
||||
bg = (int)strtol (pos + 1, &error2, 10);
|
||||
if (error1 && !error1[0] && error2 && !error2[0]
|
||||
&& error3 && !error3[0]
|
||||
&& (r >= 0) && (r <= 1000)
|
||||
&& (g >= 0) && (g <= 1000)
|
||||
&& (b >= 0) && (b <= 1000))
|
||||
&& (fg >= -1) && (bg >= -1))
|
||||
{
|
||||
new_color_palette->r = r;
|
||||
new_color_palette->g = g;
|
||||
new_color_palette->b = b;
|
||||
new_color_palette->foreground = fg;
|
||||
new_color_palette->background = bg;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (str_rgb)
|
||||
{
|
||||
pos = strchr (str_rgb, '/');
|
||||
if (pos)
|
||||
{
|
||||
pos[0] = '\0';
|
||||
pos2 = strchr (pos + 1, '/');
|
||||
if (pos2)
|
||||
{
|
||||
pos2[0] = '\0';
|
||||
error1 = NULL;
|
||||
r = (int)strtol (str_rgb, &error1, 10);
|
||||
error2 = NULL;
|
||||
g = (int)strtol (pos + 1, &error2, 10);
|
||||
error3 = NULL;
|
||||
b = (int)strtol (pos2 + 1, &error3, 10);
|
||||
if (error1 && !error1[0] && error2 && !error2[0]
|
||||
&& error3 && !error3[0]
|
||||
&& (r >= 0) && (r <= 1000)
|
||||
&& (g >= 0) && (g <= 1000)
|
||||
&& (b >= 0) && (b <= 1000))
|
||||
{
|
||||
new_color_palette->r = r;
|
||||
new_color_palette->g = g;
|
||||
new_color_palette->b = b;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string_free_split (items);
|
||||
}
|
||||
|
||||
if (str_alias)
|
||||
free (str_alias);
|
||||
if (str_pair)
|
||||
free (str_pair);
|
||||
if (str_rgb)
|
||||
free (str_rgb);
|
||||
}
|
||||
|
||||
return new_color_palette;
|
||||
|
||||
Reference in New Issue
Block a user