Commit 811b8f44 authored by Noah Levitt's avatar Noah Levitt

2003-12-15 Noah Levitt

	* gucharmap/Makefile.am:
	* gucharmap/gucharmap-codepoint-list.h:
	* gucharmap/gucharmap-mini-fontsel.c:
	* gucharmap/gucharmap-script-codepoint-list.c:
	* gucharmap/gucharmap-script-codepoint-list.h:
	* gucharmap/gucharmap-table.c:
	* gucharmap/gucharmap-unicode-info.h:
	* gucharmap/gucharmap.h: Script codepoint list implementation.

	* gucharmap/gen-guch-unicode-tables.pl:
	* gucharmap/unicode-scripts.h:
	* po/POTFILES.in: Unicode Scripts.txt info.
parent 59c40f8d
2003-12-15 Noah Levitt
* gucharmap/Makefile.am:
* gucharmap/gucharmap-codepoint-list.h:
* gucharmap/gucharmap-mini-fontsel.c:
* gucharmap/gucharmap-script-codepoint-list.c:
* gucharmap/gucharmap-script-codepoint-list.h:
* gucharmap/gucharmap-table.c:
* gucharmap/gucharmap-unicode-info.h:
* gucharmap/gucharmap.h: Script codepoint list implementation.
* gucharmap/gen-guch-unicode-tables.pl:
* gucharmap/unicode-scripts.h:
* po/POTFILES.in: Unicode Scripts.txt info.
2003-12-15 Noah Levitt
* gucharmap/gucharmap-unicode-info.c: If glib is new enough, don’t
......
......@@ -40,8 +40,10 @@ libgucharmap_la_SOURCES = gucharmap_marshal.c gucharmap_marshal.h \
gucharmap-table.c gucharmap-table.h \
gucharmap-unicode-info.c gucharmap-unicode-info.h \
gucharmap-window.c gucharmap-window.h \
gucharmap-codepoint-list.c gucharmap-codepoint-list.h
gucharmap-codepoint-list.c gucharmap-codepoint-list.h \
gucharmap-script-codepoint-list.c gucharmap-script-codepoint-list.h \
unicode-blocks.h unicode-categories.h unicode-names.h \
unicode-nameslist.h unicode-scripts.h unicode-unihan.h
# this is different from the project version
libgucharmap_la_LDFLAGS = -version-info 3:3:0
......@@ -54,8 +56,8 @@ libgucharmapinclude_HEADERS = gucharmap.h \
gucharmap-window.h \
gucharmap-mini-fontsel.h \
gucharmap-unicode-info.h \
gucharmap-codepoint-list.h
gucharmap-codepoint-list.h \
gucharmap-script-codepoint-list.h
bin_PROGRAMS = gucharmap
gucharmap_SOURCES = main.c
......
......@@ -8,9 +8,10 @@
# - unicode-nameslist.h
# - unicode-unihan.h
# - unicode-categories.h
# - unicode-scripts.h
#
# usage: ./gen-guch-unicode-tables.pl DIRECTORY
# where DIRECTORY contains UnicodeData.txt Unihan.zip NamesList.txt Blocks.txt
# where DIRECTORY contains UnicodeData.txt Unihan.zip NamesList.txt Blocks.txt Scripts.txt
#
use strict;
......@@ -24,16 +25,26 @@ sub process_unicode_data_txt ($);
sub process_unihan_zip ($);
sub process_nameslist_txt ($);
sub process_blocks_txt ($);
sub process_scripts_txt ($);
$| = 1; # flush stdout buffer
if (@ARGV != 2)
{
$0 =~ s@.*/@@;
die "\nUsage: $0 UNICODE-VERSION DIRECTORY\n\n DIRECTORY should contain the following Unicode data files:\n UnicodeData.txt Unihan.zip NamesList.txt Blocks.txt\n\n";
die <<EOF
Usage: $0 UNICODE-VERSION DIRECTORY
DIRECTORY should contain the following Unicode data files:
UnicodeData.txt Unihan.zip NamesList.txt Blocks.txt
which can be found at http://www.unicode.org/Public/UNIDATA/
EOF
}
my ($unicodedata_txt, $unihan_zip, $nameslist_txt, $blocks_txt);
my ($unicodedata_txt, $unihan_zip, $nameslist_txt, $blocks_txt, $scripts_txt);
my $d = $ARGV[1];
opendir (my $dir, $d) or die "Cannot open Unicode data dir $d: $!\n";
......@@ -43,16 +54,19 @@ for my $f (readdir ($dir))
$unihan_zip = "$d/$f" if ($f =~ /Unihan.*\.zip/);
$nameslist_txt = "$d/$f" if ($f =~ /NamesList.*\.txt/);
$blocks_txt = "$d/$f" if ($f =~ /Blocks.*\.txt/);
$scripts_txt = "$d/$f" if ($f =~ /Scripts.*\.txt/);
}
defined $unicodedata_txt or die "Did not find $d/UnicodeData.txt";
defined $unihan_zip or die "Did not find $d/Unihan.zip";
defined $nameslist_txt or die "Did not find $d/NamesList.txt";
defined $blocks_txt or die "Did not find $d/Blocks.txt";
defined $scripts_txt or die "Did not find $d/Scripts.txt";
process_unicode_data_txt ($unicodedata_txt);
process_nameslist_txt ($nameslist_txt);
process_blocks_txt ($blocks_txt);
process_scripts_txt ($scripts_txt);
process_unihan_zip ($unihan_zip);
exit;
......@@ -580,3 +594,85 @@ sub process_blocks_txt ($)
print " done.\n";
}
#------------------------#
sub process_scripts_txt ($)
{
my ($scripts_txt) = @_;
my %script_hash;
my %scripts;
open (my $scripts, $scripts_txt) or die;
open (my $out, "> unicode-scripts.h") or die;
print "processing $scripts_txt...";
while (my $line = <$scripts>)
{
my ($start, $end, $raw_script);
if ($line =~ /^([0-9A-F]+)\.\.([0-9A-F]+)\s+;\s+(\S+)/)
{
$start = hex ($1);
$end = hex ($2);
$raw_script = $3;
}
elsif ($line =~ /^([0-9A-F]+)\s+;\s+(\S+)/)
{
$start = hex ($1);
$end = $start;
$raw_script = $2;
}
else
{
next;
}
my $script = $raw_script;
$script =~ tr/_/ /;
$script =~ s/(\w+)/\u\L$1/g;
$script_hash{$start} = { 'end' => $end, 'script' => $script };
$scripts{$script} = 1;
}
print $out "/* unicode-blocks.h */\n";
print $out "/* THIS IS A GENERATED FILE. CHANGES WILL BE OVERWRITTEN. */\n";
print $out "/* Generated by $0 */\n\n";
print $out "#include <glib/gunicode.h>\n";
print $out "#include <gucharmap/gucharmap_intl.h>\n\n";
print $out "typedef struct _UnicodeScript UnicodeScript;\n\n";
print $out "static const gchar *unicode_script_list[] =\n";
print $out "{\n";
my $i = 0;
for my $script (sort keys %scripts)
{
$scripts{$script} = $i;
print $out qq/ N_("$script"),\n/;
$i++;
}
print $out " NULL\n";
print $out "};\n\n";
print $out "static const struct _UnicodeScript\n";
print $out "{\n";
print $out " gunichar first;\n";
print $out " gunichar last;\n";
print $out " guint script_index; /* index into unicode_script_list */\n";
print $out "}\n";
print $out "unicode_scripts[] =\n";
print $out "{\n";
for my $start (sort { $a <=> $b } keys %script_hash)
{
printf $out (qq/ { 0x%04X, 0x%04X, \%2d },\n/,
$start, $script_hash{$start}->{'end'}, $scripts{$script_hash{$start}->{'script'}});
}
print $out "};\n\n";
close ($out);
print " done.\n";
}
......@@ -24,8 +24,8 @@
G_BEGIN_DECLS
#define GUCHARMAP_CODEPOINT_LIST (obj) \
(G_TYPE_CHECK_INSTANCE_CASE ((obj), gucharmap_codepoint_list_get_type (), GucharmapCodepointList))
#define GUCHARMAP_CODEPOINT_LIST(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), gucharmap_codepoint_list_get_type (), GucharmapCodepointList))
#define GUCHARMAP_CODEPOINT_LIST_CLASS(clazz) \
(G_TYPE_CHECK_CLASS_CAST ((clazz), gucharmap_codepoint_list_get_type (), GucharmapCodepointListClass))
......@@ -55,7 +55,7 @@ struct _GucharmapCodepointListClass
};
GType gucharmap_codepoint_list_get_type ();
GucharmapCodepointList * gucharmap_codepoint_list_new ();
GucharmapCodepointList * gucharmap_codepoint_list_new ();
gunichar gucharmap_codepoint_list_get_char (GucharmapCodepointList *list,
guint index);
guint gucharmap_codepoint_list_get_index (GucharmapCodepointList *list,
......
......@@ -149,7 +149,7 @@ mini_font_selection_finalize (GObject *object)
}
void
static void
gucharmap_mini_font_selection_class_init (GucharmapMiniFontSelectionClass *clazz)
{
clazz->changed = NULL;
......@@ -191,7 +191,7 @@ italic_toggled (GtkToggleButton *toggle,
}
void
static void
gucharmap_mini_font_selection_init (GucharmapMiniFontSelection *fontsel)
{
AtkObject *accessib;
......
/* $Id$ */
/*
* Copyright (c) 2003 Noah Levitt
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
/* XXX move this after it’s confirmed to work */
#include <gucharmap/gucharmap-script-codepoint-list.h>
#include "unicode-scripts.h"
#include "config.h"
#include <glib.h>
#include <string.h>
typedef struct
{
gunichar start;
gunichar end;
gint index; /* index of @start in the codepoint list */
}
UnicodeRange;
typedef struct _ScriptCodepointListPrivate ScriptCodepointListPrivate;
struct _ScriptCodepointListPrivate
{
gchar *script;
UnicodeRange *ranges;
gint n_ranges;
};
#define GUCHARMAP_SCRIPT_CODEPOINT_LIST_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), gucharmap_script_codepoint_list_get_type (), \
ScriptCodepointListPrivate))
#if 0
G_CONST_RETURN gchar *
gucharmap_get_script_for_char (gunichar wc)
{
gint min = 0;
gint mid;
gint max = sizeof (unicode_scripts) / sizeof (UnicodeScript) - 1;
if (!gucharmap_unichar_isdefined (wc))
return NULL;
while (max >= min)
{
mid = (min + max) / 2;
if (wc > unicode_scripts[mid].last)
min = mid + 1;
else if (wc < unicode_scripts[mid].first)
max = mid - 1;
else
return unicode_scripts[mid].script;
}
/* Unicode assigns "Common" as the script name for any character not
* specifically listed in Scripts.txt */
return _("Common");
}
#endif
static guint
find_script (const gchar *script)
{
gint min, mid, max;
min = 0;
max = sizeof (unicode_script_list) / sizeof (gchar *) - 2; /* it’s NULL-terminated */
while (max >= min)
{
mid = (min + max) / 2;
if (strcmp (script, unicode_script_list[mid]) > 0)
min = mid + 1;
else if (strcmp (script, unicode_script_list[mid]) < 0)
max = mid - 1;
else
return mid;
}
return (guint)(-1);
}
/* *ranges should be freed by caller */
static gboolean
get_chars_for_script (const gchar *script,
UnicodeRange **ranges,
gint *size)
{
gint i, j, index;
guint script_index = find_script (script);
if (script_index == (guint)(-1))
return FALSE;
for (i = 0, j = 0; i < sizeof (unicode_scripts) / sizeof (UnicodeScript); i++)
if (unicode_scripts[i].script_index == script_index)
j++;
*size = j;
*ranges = g_new (UnicodeRange, *size);
for (i = 0, j = 0, index = 0; i < sizeof (unicode_scripts) / sizeof (UnicodeScript); i++)
if (unicode_scripts[i].script_index == script_index)
{
(*ranges)[j].start = unicode_scripts[i].first;
(*ranges)[j].end = unicode_scripts[i].last;
(*ranges)[j].index = index;
index += (*ranges)[j].end - (*ranges)[j].start + 1;
j++;
}
g_assert (j == *size);
return TRUE;
}
static void
ensure_initialized (GucharmapScriptCodepointList *guscl)
{
ScriptCodepointListPrivate *priv = GUCHARMAP_SCRIPT_CODEPOINT_LIST_GET_PRIVATE (guscl);
gboolean success;
if (priv->script != NULL)
return;
success = gucharmap_script_codepoint_list_set_script (guscl, "Latin");
g_assert (success);
}
static gunichar
get_char (GucharmapCodepointList *list,
guint index)
{
GucharmapScriptCodepointList *guscl = GUCHARMAP_SCRIPT_CODEPOINT_LIST (list);
ScriptCodepointListPrivate *priv = GUCHARMAP_SCRIPT_CODEPOINT_LIST_GET_PRIVATE (guscl);
gint min, mid, max;
/* g_print ("GucharmapScriptCodepointList::get_char: index = %u\n", index); */
ensure_initialized (guscl);
min = 0;
max = priv->n_ranges - 1;
while (max >= min)
{
mid = (min + max) / 2;
if (index > priv->ranges[mid].index + priv->ranges[mid].end - priv->ranges[mid].start)
min = mid + 1;
else if (index < priv->ranges[mid].index)
max = mid - 1;
else
return priv->ranges[mid].start + index - priv->ranges[mid].index;
}
return (gunichar)(-1);
}
static guint
get_index (GucharmapCodepointList *list,
gunichar wc)
{
GucharmapScriptCodepointList *guscl = GUCHARMAP_SCRIPT_CODEPOINT_LIST (list);
ScriptCodepointListPrivate *priv = GUCHARMAP_SCRIPT_CODEPOINT_LIST_GET_PRIVATE (guscl);
gint min, mid, max;
/* g_print ("GucharmapScriptCodepointList::get_index: wc = %04X\n", wc); */
ensure_initialized (guscl);
if (!gucharmap_unichar_isdefined (wc))
return (gunichar)(-1);
min = 0;
max = priv->n_ranges - 1;
while (max >= min)
{
mid = (min + max) / 2;
if (wc > priv->ranges[mid].end)
min = mid + 1;
else if (wc < priv->ranges[mid].start)
max = mid - 1;
else
return priv->ranges[mid].index + wc - priv->ranges[mid].start;
}
return (guint)(-1);
}
static guint
get_last_index (GucharmapCodepointList *list)
{
GucharmapScriptCodepointList *guscl = GUCHARMAP_SCRIPT_CODEPOINT_LIST (list);
ScriptCodepointListPrivate *priv = GUCHARMAP_SCRIPT_CODEPOINT_LIST_GET_PRIVATE (guscl);
/* g_print ("GucharmapScriptCodepointList::get_last_index\n"); */
ensure_initialized (guscl);
return priv->ranges[priv->n_ranges-1].index + priv->ranges[priv->n_ranges-1].end - priv->ranges[priv->n_ranges-1].start;
}
static void
gucharmap_script_codepoint_list_class_init (GucharmapScriptCodepointListClass *clazz)
{
GucharmapCodepointListClass *codepoint_list_class = (GucharmapCodepointListClass *) clazz;
/* g_print ("gucharmap_script_codepoint_list_class_init\n"); */
g_type_class_add_private (codepoint_list_class, sizeof (ScriptCodepointListPrivate));
codepoint_list_class->get_char = get_char;
codepoint_list_class->get_index = get_index;
codepoint_list_class->get_last_index = get_last_index;
}
static void
gucharmap_script_codepoint_list_init (GucharmapScriptCodepointList *guscl)
{
ScriptCodepointListPrivate *priv = GUCHARMAP_SCRIPT_CODEPOINT_LIST_GET_PRIVATE (guscl);
priv->script = NULL;
priv->ranges = NULL;
priv->n_ranges = 0;
}
GType
gucharmap_script_codepoint_list_get_type ()
{
static GType t = 0;
if (t == 0)
{
static const GTypeInfo type_info =
{
sizeof (GucharmapScriptCodepointListClass),
NULL,
NULL,
(GClassInitFunc) gucharmap_script_codepoint_list_class_init,
NULL,
NULL,
sizeof (GucharmapScriptCodepointList),
0,
(GInstanceInitFunc) gucharmap_script_codepoint_list_init,
NULL
};
t = g_type_register_static (gucharmap_codepoint_list_get_type (),
"GucharmapScriptCodepointList", &type_info, 0);
}
return t;
}
/**
* gucharmap_script_codepoint_list_new:
*
* Creates a new script codepoint list. The default script is Latin.
*
* Return value: the newly-created #GucharmapCodepointList. Use
* g_object_unref() to free the result.
**/
GucharmapCodepointList *
gucharmap_script_codepoint_list_new ()
{
g_print ("gucharmap_script_codepoint_list_new\n");
return GUCHARMAP_CODEPOINT_LIST (g_object_new (gucharmap_script_codepoint_list_get_type (), NULL));
}
/**
* gucharmap_script_codepoint_list_set_script:
*
* Sets the script for the codepoint list.
*
* Return value: %TRUE on success, %FALSE if there is no such script, in
* which case the script is not changed.
**/
gboolean
gucharmap_script_codepoint_list_set_script (GucharmapScriptCodepointList *list,
const gchar *script)
{
ScriptCodepointListPrivate *priv = GUCHARMAP_SCRIPT_CODEPOINT_LIST_GET_PRIVATE (list);
UnicodeRange *ranges;
gint size;
if (priv->script && strcmp (script, priv->script) == 0)
return TRUE;
if (get_chars_for_script (script, &ranges, &size))
{
g_free (priv->script);
g_free (priv->ranges);
priv->script = g_strdup (script);
priv->ranges = ranges;
priv->n_ranges = size;
return TRUE;
}
else
return FALSE;
}
/**
* gucharmap_unicode_list_scripts:
*
* Return value: NULL-terminated array of script names. These have been
* marked for translation with N_(). Neither the list nor the scripts
* should be modified by the caller.
**/
G_CONST_RETURN gchar **
gucharmap_unicode_list_scripts ()
{
return unicode_script_list;
}
/* $Id$ */
/*
* Copyright (c) 2003 Noah Levitt
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef GUCHARMAP_SCRIPT_CODEPOINT_LIST_H
#define GUCHARMAP_SCRIPT_CODEPOINT_LIST_H
#include <glib-object.h>
#include <gucharmap/gucharmap-codepoint-list.h>
#include <gucharmap/gucharmap-unicode-info.h>
G_BEGIN_DECLS
#define GUCHARMAP_SCRIPT_CODEPOINT_LIST(obj) \
(G_TYPE_CHECK_INSTANCE_CAST ((obj), gucharmap_script_codepoint_list_get_type (), GucharmapScriptCodepointList))
#define GUCHARMAP_SCRIPT_CODEPOINT_LIST_CLASS(clazz) \
(G_TYPE_CHECK_CLASS_CAST ((clazz), gucharmap_script_codepoint_list_get_type (), GucharmapScriptCodepointListClass))
#define IS_GUCHARMAP_SCRIPT_CODEPOINT_LIST(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), gucharmap_script_codepoint_list_get_type ()))
#define GUCHARMAP_SCRIPT_CODEPOINT_LIST_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), gucharmap_script_codepoint_list_get_type (), GucharmapScriptCodepointListClass))
typedef struct _GucharmapScriptCodepointList GucharmapScriptCodepointList;
typedef struct _GucharmapScriptCodepointListClass GucharmapScriptCodepointListClass;
struct _GucharmapScriptCodepointList
{
GucharmapCodepointList parent;
};
struct _GucharmapScriptCodepointListClass
{
GucharmapCodepointListClass parent_class;
};
GType gucharmap_script_codepoint_list_get_type ();
GucharmapCodepointList * gucharmap_script_codepoint_list_new ();
gboolean gucharmap_script_codepoint_list_set_script (GucharmapScriptCodepointList *list,
const gchar *script);
/* XXX: gucharmap_script_codepoint_list_get_script? seems unnecessary */
G_END_DECLS
#endif /* #ifndef GUCHARMAP_SCRIPT_CODEPOINT_LIST_H */
......@@ -1159,7 +1159,7 @@ size_allocate (GtkWidget *widget,
/* adjust the adjustment, since it's based on the size of a row */
adjustment = GTK_ADJUSTMENT (chartable->adjustment);
adjustment->upper = 1.0 * UNICHAR_MAX / chartable->cols;
adjustment->upper = 1.0 * gucharmap_codepoint_list_get_last_index (chartable->codepoint_list) / chartable->cols;
adjustment->page_increment = 3.0 * chartable->rows;
gtk_adjustment_changed (adjustment);
set_scrollbar_adjustment (chartable);
......@@ -1187,7 +1187,7 @@ move_up (GucharmapTable *chartable)
static void
move_down (GucharmapTable *chartable)
{
if (chartable->active_cell <= UNICHAR_MAX - chartable->cols)
if (chartable->active_cell <= gucharmap_codepoint_list_get_last_index (chartable->codepoint_list) - chartable->cols)
set_active_cell (chartable, chartable->active_cell + chartable->cols);
}
......@@ -1327,7 +1327,7 @@ set_top_row (GucharmapTable *chartable, gint row)
{
gint r, c;
g_return_if_fail (row >= 0 && row <= UNICHAR_MAX / chartable->cols);
g_return_if_fail (row >= 0 && row <= gucharmap_codepoint_list_get_last_index (chartable->codepoint_list) / chartable->cols);
chartable->old_page_first_cell = chartable->page_first_cell;
chartable->old_active_cell = chartable->active_cell;
......@@ -1477,7 +1477,7 @@ static GtkWidget *
make_scrollbar (GucharmapTable *chartable)
{
chartable->adjustment = gtk_adjustment_new (
0.0, 0.0, 1.0 * UNICHAR_MAX / chartable->cols,
0.0, 0.0, 1.0 * gucharmap_codepoint_list_get_last_index (chartable->codepoint_list) / chartable->cols,
2.0, 3.0 * chartable->rows, 0.0);
chartable->adjustment_changed_handler_id = g_signal_connect (
......@@ -1561,8 +1561,7 @@ mouse_wheel_up (GucharmapTable *chartable)
static void
mouse_wheel_down (GucharmapTable *chartable)
{
if (chartable->page_first_cell
< UNICHAR_MAX - chartable->rows * chartable->cols / 2)
if (chartable->page_first_cell < gucharmap_codepoint_list_get_last_index (chartable->codepoint_list) - chartable->rows * chartable->cols / 2)
{
set_top_row (chartable, (chartable->page_first_cell
+ chartable->rows * chartable->cols / 2)
......@@ -1570,7 +1569,7 @@ mouse_wheel_down (GucharmapTable *chartable)
}
else
{
set_top_row (chartable, UNICHAR_MAX / chartable->cols);
set_top_row (chartable, gucharmap_codepoint_list_get_last_index (chartable->codepoint_list) / chartable->cols);
}
gucharmap_table_redraw (chartable, TRUE);
......@@ -1621,23 +1620,23 @@ drag_data_received (GtkWidget *widget,
GucharmapTable *chartable)
{
gchar *text;
gunichar uc;
gunichar wc;
text = gtk_selection_data_get_text (selection_data);
if (text == NULL) /* XXX: say something in the statusbar? */
return;
uc = g_utf8_get_char_validated (text, -1);
wc = g_utf8_get_char_validated (text, -1);
if (uc == (gunichar)(-2) || uc == (gunichar)(-1) || uc > UNICHAR_MAX)
{
status_message (chartable, _("Unknown character, unable to identify."));
}
if (wc == (gunichar)(-2) || wc == (gunichar)(-1) || wc > UNICHAR_MAX)
status_message (chartable, _("Unknown character, unable to identify."));
else if (gucharmap_codepoint_list_get_index (chartable->codepoint_list, wc) == (guint)(-1))
status_message (chartable, _("Not found."));
else
{
status_message (chartable, _("Character found."));
set_active_char (chartable, uc);
set_active_char (chartable, wc);
gucharmap_table_redraw (chartable, TRUE);
}
......@@ -1682,7 +1681,7 @@ drag_data_get (GtkWidget *widget,
gchar buf[7];
gint n;
n = g_unichar_to_utf8 (chartable->active_cell, buf);
n = g_unichar_to_utf8 (gucharmap_codepoint_list_get_char (chartable->codepoint_list, chartable->active_cell), buf);
gtk_selection_data_set_text (selection_data, buf, n);
}
......
......@@ -67,16 +67,20 @@ gunichar gucharmap_find_substring_match (gunichar start,
gint direction);
/* nameslist stuff */
G_CONST_RETURN gchar ** gucharmap_get_nameslist_stars (gunichar uc);
G_CONST_RETURN gchar ** gucharmap_get_nameslist_equals (gunichar uc);
gunichar * gucharmap_get_nameslist_exes (gunichar uc);
G_CONST_RETURN gchar ** gucharmap_get_nameslist_pounds (gunichar uc);
G_CONST_RETURN gchar ** gucharmap_get_nameslist_colons (gunichar uc);