mirror of https://github.com/GNOME/gimp.git
changed based on a patch by Joao S. O. Bueno to remove mnemonics as used
2004-11-13 Sven Neumann <sven@gimp.org> * libgimpbase/gimputils.c (gimp_strip_uline): changed based on a patch by Joao S. O. Bueno to remove mnemonics as used in languages like Chinese. Fixes bug #157561.
This commit is contained in:
parent
4cbef9ff1b
commit
4cc6564a0e
|
@ -1,3 +1,9 @@
|
||||||
|
2004-11-13 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* libgimpbase/gimputils.c (gimp_strip_uline): changed based on a
|
||||||
|
patch by Joao S. O. Bueno to remove mnemonics as used in languages
|
||||||
|
like Chinese. Fixes bug #157561.
|
||||||
|
|
||||||
2004-11-13 Sven Neumann <sven@gimp.org>
|
2004-11-13 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* plug-ins/ifscompose/README.ifscompose: updated link to the
|
* plug-ins/ifscompose/README.ifscompose: updated link to the
|
||||||
|
|
|
@ -220,20 +220,26 @@ gimp_filename_to_utf8 (const gchar *filename)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* gimp_strip_uline:
|
* gimp_strip_uline:
|
||||||
* @str: Underline infested string (or %NULL)
|
* @str: underline infested string (or %NULL)
|
||||||
*
|
*
|
||||||
* This function returns a copy of @str stripped of underline
|
* This function returns a copy of @str stripped of underline
|
||||||
* characters. This comes in handy when needing to strip mnemonics
|
* characters. This comes in handy when needing to strip mnemonics
|
||||||
* from menu paths etc.
|
* from menu paths etc.
|
||||||
*
|
*
|
||||||
|
* In some languages, mnemonics are handled by adding the mnemonic
|
||||||
|
* character in brackets (like "File (_F)"). This function recognizes
|
||||||
|
* this construct and removes the whole bracket construction to get
|
||||||
|
* rid of the mnemonic (see bug #157561).
|
||||||
|
*
|
||||||
* Return value: A (possibly stripped) copy of @str which should be
|
* Return value: A (possibly stripped) copy of @str which should be
|
||||||
* freed using g_free() when it is not needed any longer.
|
* freed using g_free() when it is not needed any longer.
|
||||||
**/
|
**/
|
||||||
gchar *
|
gchar *
|
||||||
gimp_strip_uline (const gchar *str)
|
gimp_strip_uline (const gchar *str)
|
||||||
{
|
{
|
||||||
gchar *escaped;
|
gchar *escaped;
|
||||||
gchar *p;
|
gchar *p;
|
||||||
|
gboolean past_bracket = FALSE;
|
||||||
|
|
||||||
if (! str)
|
if (! str)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -246,12 +252,26 @@ gimp_strip_uline (const gchar *str)
|
||||||
{
|
{
|
||||||
/* "__" means a literal "_" in the menu path */
|
/* "__" means a literal "_" in the menu path */
|
||||||
if (str[1] == '_')
|
if (str[1] == '_')
|
||||||
*p++ = *str++;
|
{
|
||||||
|
*p++ = *str++;
|
||||||
|
*p++ = *str++;
|
||||||
|
}
|
||||||
|
|
||||||
str++;
|
/* find the "(_X)" construct and remove it entirely */
|
||||||
|
if (past_bracket && str[1] && *(g_utf8_next_char (str + 1)) == ')')
|
||||||
|
{
|
||||||
|
str = g_utf8_next_char (str + 1) + 1;
|
||||||
|
p--;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
past_bracket = (*str == '(');
|
||||||
|
|
||||||
*p++ = *str++;
|
*p++ = *str++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue