Commit 34c29f13 authored by Noah Levitt's avatar Noah Levitt

Made gucharmap a pkg-config package. Contributed by Dom Lachowicz.

parent c235316c
......@@ -12,6 +12,7 @@ config.sub
configure
depcomp
gucharmap.nsi
gucharmap.pc
install-sh
libtool
ltmain.sh
......
2003-02-27 Noah Levitt <nlevitt аt columbia.edu>
* gucharmap.pc.in:
* Makefile.am:
* configure.ac:
* .cvsignore: Made gucharmap a pkg-config package. Contributed by Dom
Lachowicz.
2003-02-26 Noah Levitt <nlevitt аt columbia.edu>
* src/Makefile.am:
......
......@@ -21,4 +21,7 @@ AUTOMAKE_OPTIONS = foreign
SUBDIRS = src po pixmaps
EXTRA_DIST = gtkrc.win32 gucharmap.nsi.in
EXTRA_DIST = gtkrc.win32 gucharmap.nsi.in gucharmap.pc.in
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = gucharmap.pc
......@@ -63,7 +63,6 @@ fi
# gtk is required
PKG_CHECK_MODULES(GTK, gtk+-2.0 >= 2.0.0)
AC_ARG_ENABLE(gnome,
AC_HELP_STRING([--disable-gnome],
[don't build with GNOME support]))
......@@ -75,6 +74,7 @@ else
have_gnome=no
fi
GNOMEPKGS=""
if test "x$have_gnome" = "xno"
then
libs_bak="$LIBS"
......@@ -86,8 +86,10 @@ then
LIBS="$libs_bak"
AC_SUBST(POPT_LIBS)
else
GNOMEPKGS="libgnomeui-2.0 libgnome-2.0"
fi
AC_SUBST(GNOMEPKGS)
# checks for funcs
AC_CHECK_FUNCS([bind_textdomain_codeset])
......@@ -118,5 +120,10 @@ if test "x$enable_unihan" != "xno" ; then
fi
AC_OUTPUT([Makefile src/Makefile po/Makefile.in
pixmaps/Makefile gucharmap.nsi])
AC_OUTPUT([
gucharmap.pc
Makefile
src/Makefile
po/Makefile.in
pixmaps/Makefile
gucharmap.nsi])
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: gucharmap
Description: GTK+ Unicode Character Map
Version: @VERSION@
Requires: gtk+-2.0 glib-2.0 @GNOMEPKGS@
Libs: -L${libdir} -lgucharmap
Cflags: -I${includedir}
......@@ -441,7 +441,7 @@ set_caption (Charmap *charmap)
(const gchar **) values);
if (values)
g_free (values);
free_array_of_strings (values);
if (exes)
g_free (exes);
......@@ -905,7 +905,6 @@ update_zoom_window (Charmap *charmap)
{
gint width, height;
g_return_if_fail (charmap->zoom_window != NULL);
if (charmap->zoom_pixbuf != NULL)
......@@ -1093,6 +1092,15 @@ expose_event (GtkWidget *widget,
charmap->chartable->allocation.height, -1);
draw_chartable_from_scratch (charmap);
if (charmap->zoom_window)
{
gint x, y;
update_zoom_window (charmap);
get_appropriate_active_char_corner_xy (charmap, &x, &y);
place_zoom_window (charmap, x, y);
}
}
gdk_draw_drawable (charmap->chartable->window,
......@@ -1362,7 +1370,9 @@ compute_drag_font_size (Charmap *charmap)
static void
make_zoom_window (Charmap *charmap)
{
destroy_zoom_window (charmap);
/* if there is already a zoom window, do nothing */
if (charmap->zoom_window)
return;
charmap->zoom_window = gtk_window_new (GTK_WINDOW_POPUP);
......@@ -1486,8 +1496,6 @@ key_press_event (GtkWidget *widget,
GdkEventKey *event,
Charmap *charmap)
{
gint x, y;
/* move the cursor or whatever depending on which key was pressed */
switch (event->keyval)
{
......@@ -1528,27 +1536,6 @@ key_press_event (GtkWidget *widget,
charmap->active_char);
return TRUE;
case GDK_plus: case GDK_KP_Add: case GDK_equal:
make_zoom_window (charmap);
update_zoom_window (charmap);
get_appropriate_active_char_corner_xy (charmap, &x, &y);
place_zoom_window (charmap, x, y);
gtk_widget_show (charmap->zoom_window);
/* must do this after gtk_widget_show */
set_window_background (charmap->zoom_window, charmap->zoom_pixbuf);
gdk_window_clear (charmap->zoom_window->window);
status_message (charmap,
_("Zoom mode enabled. Press <Esc> to disable zoom."));
return TRUE;
case GDK_minus: case GDK_KP_Subtract: case GDK_Escape:
destroy_zoom_window (charmap);
return TRUE;
/* pass on other keys, like tab and stuff that shifts focus */
default:
return FALSE;
......@@ -1572,9 +1559,6 @@ button_press_event (GtkWidget *widget,
/* in case we lost keyboard focus and are clicking to get it back */
gtk_widget_grab_focus (charmap->chartable);
if (event->button == 1)
destroy_zoom_window (charmap);
/* double-click */
if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
{
......@@ -1586,7 +1570,7 @@ button_press_event (GtkWidget *widget,
{
set_active_character (charmap,
get_char_at (charmap, event->x, event->y));
redraw (charmap, FALSE);
redraw (charmap, TRUE);
}
else if (event->button == 2)
{
......@@ -1880,8 +1864,6 @@ static gboolean
focus_in_or_out_event (GtkWidget *widget, GdkEventFocus *event,
Charmap *charmap)
{
destroy_zoom_window (charmap);
if (charmap->chartable != NULL && charmap->chartable_pixmap != NULL)
draw_and_expose_character_square (charmap, charmap->active_char);
......@@ -2470,3 +2452,30 @@ charmap_hide_caption (Charmap *charmap, CharmapCaption caption_id)
}
}
void
charmap_zoom_enable (Charmap *charmap)
{
gint x, y;
make_zoom_window (charmap);
update_zoom_window (charmap);
get_appropriate_active_char_corner_xy (charmap, &x, &y);
place_zoom_window (charmap, x, y);
gtk_widget_show (charmap->zoom_window);
/* must do this after gtk_widget_show */
set_window_background (charmap->zoom_window, charmap->zoom_pixbuf);
gdk_window_clear (charmap->zoom_window->window);
status_message (charmap, _("Zoom mode enabled."));
}
void
charmap_zoom_disable (Charmap *charmap)
{
destroy_zoom_window (charmap);
}
......@@ -160,6 +160,8 @@ void charmap_go_to_character (Charmap *charmap, gunichar uc);
CharmapSearchResult charmap_search (Charmap *charmap, const gchar *search_text);
void charmap_hide_caption (Charmap *charmap, CharmapCaption caption_id);
void charmap_show_caption (Charmap *charmap, CharmapCaption caption_id);
void charmap_zoom_enable (Charmap *charmap);
void charmap_zoom_disable (Charmap *charmap);
G_END_DECLS
......
......@@ -117,6 +117,16 @@ expand_collapse (GtkCheckMenuItem *mi, gpointer data)
}
static void
toggle_zoom_mode (GtkCheckMenuItem *mi, gpointer data)
{
if (gtk_check_menu_item_get_active (mi))
charmap_zoom_enable (CHARMAP (charmap));
else
charmap_zoom_disable (CHARMAP (charmap));
}
#if ENABLE_UNIHAN
static void
show_hide_unihan (GtkCheckMenuItem *mi, gpointer data)
......@@ -702,6 +712,21 @@ make_menu (GtkWindow *window)
G_CALLBACK (font_smaller), NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (view_menu), menu_item);
/* separator */
gtk_menu_shell_append (GTK_MENU_SHELL (view_menu), gtk_menu_item_new ());
/* ctrl-- */
menu_item = gtk_check_menu_item_new_with_mnemonic (_("_Zoom Mode"));
gtk_widget_add_accelerator (menu_item, "activate", accel_group,
GDK_Return, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (menu_item, "activate", accel_group,
GDK_KP_Enter, GDK_CONTROL_MASK, 0);
g_signal_connect (G_OBJECT (menu_item), "activate",
G_CALLBACK (toggle_zoom_mode), NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (view_menu), menu_item);
/* separator */
gtk_menu_shell_append (GTK_MENU_SHELL (view_menu), gtk_menu_item_new ());
......
......@@ -28,7 +28,7 @@
enum
{
MIN_FONT_SIZE = 5,
MAX_FONT_SIZE = 500
MAX_FONT_SIZE = 400,
};
enum
......
......@@ -22,6 +22,7 @@
#endif
#include <gtk/gtk.h>
#include <string.h>
#include <unicode_info.h>
#include <unicode_data.cI>
......
......@@ -441,7 +441,7 @@ set_caption (Charmap *charmap)
(const gchar **) values);
if (values)
g_free (values);
free_array_of_strings (values);
if (exes)
g_free (exes);
......@@ -905,7 +905,6 @@ update_zoom_window (Charmap *charmap)
{
gint width, height;
g_return_if_fail (charmap->zoom_window != NULL);
if (charmap->zoom_pixbuf != NULL)
......@@ -1093,6 +1092,15 @@ expose_event (GtkWidget *widget,
charmap->chartable->allocation.height, -1);
draw_chartable_from_scratch (charmap);
if (charmap->zoom_window)
{
gint x, y;
update_zoom_window (charmap);
get_appropriate_active_char_corner_xy (charmap, &x, &y);
place_zoom_window (charmap, x, y);
}
}
gdk_draw_drawable (charmap->chartable->window,
......@@ -1362,7 +1370,9 @@ compute_drag_font_size (Charmap *charmap)
static void
make_zoom_window (Charmap *charmap)
{
destroy_zoom_window (charmap);
/* if there is already a zoom window, do nothing */
if (charmap->zoom_window)
return;
charmap->zoom_window = gtk_window_new (GTK_WINDOW_POPUP);
......@@ -1486,8 +1496,6 @@ key_press_event (GtkWidget *widget,
GdkEventKey *event,
Charmap *charmap)
{
gint x, y;
/* move the cursor or whatever depending on which key was pressed */
switch (event->keyval)
{
......@@ -1528,27 +1536,6 @@ key_press_event (GtkWidget *widget,
charmap->active_char);
return TRUE;
case GDK_plus: case GDK_KP_Add: case GDK_equal:
make_zoom_window (charmap);
update_zoom_window (charmap);
get_appropriate_active_char_corner_xy (charmap, &x, &y);
place_zoom_window (charmap, x, y);
gtk_widget_show (charmap->zoom_window);
/* must do this after gtk_widget_show */
set_window_background (charmap->zoom_window, charmap->zoom_pixbuf);
gdk_window_clear (charmap->zoom_window->window);
status_message (charmap,
_("Zoom mode enabled. Press <Esc> to disable zoom."));
return TRUE;
case GDK_minus: case GDK_KP_Subtract: case GDK_Escape:
destroy_zoom_window (charmap);
return TRUE;
/* pass on other keys, like tab and stuff that shifts focus */
default:
return FALSE;
......@@ -1572,9 +1559,6 @@ button_press_event (GtkWidget *widget,
/* in case we lost keyboard focus and are clicking to get it back */
gtk_widget_grab_focus (charmap->chartable);
if (event->button == 1)
destroy_zoom_window (charmap);
/* double-click */
if (event->button == 1 && event->type == GDK_2BUTTON_PRESS)
{
......@@ -1586,7 +1570,7 @@ button_press_event (GtkWidget *widget,
{
set_active_character (charmap,
get_char_at (charmap, event->x, event->y));
redraw (charmap, FALSE);
redraw (charmap, TRUE);
}
else if (event->button == 2)
{
......@@ -1880,8 +1864,6 @@ static gboolean
focus_in_or_out_event (GtkWidget *widget, GdkEventFocus *event,
Charmap *charmap)
{
destroy_zoom_window (charmap);
if (charmap->chartable != NULL && charmap->chartable_pixmap != NULL)
draw_and_expose_character_square (charmap, charmap->active_char);
......@@ -2470,3 +2452,30 @@ charmap_hide_caption (Charmap *charmap, CharmapCaption caption_id)
}
}
void
charmap_zoom_enable (Charmap *charmap)
{
gint x, y;
make_zoom_window (charmap);
update_zoom_window (charmap);
get_appropriate_active_char_corner_xy (charmap, &x, &y);
place_zoom_window (charmap, x, y);
gtk_widget_show (charmap->zoom_window);
/* must do this after gtk_widget_show */
set_window_background (charmap->zoom_window, charmap->zoom_pixbuf);
gdk_window_clear (charmap->zoom_window->window);
status_message (charmap, _("Zoom mode enabled."));
}
void
charmap_zoom_disable (Charmap *charmap)
{
destroy_zoom_window (charmap);
}
......@@ -160,6 +160,8 @@ void charmap_go_to_character (Charmap *charmap, gunichar uc);
CharmapSearchResult charmap_search (Charmap *charmap, const gchar *search_text);
void charmap_hide_caption (Charmap *charmap, CharmapCaption caption_id);
void charmap_show_caption (Charmap *charmap, CharmapCaption caption_id);
void charmap_zoom_enable (Charmap *charmap);
void charmap_zoom_disable (Charmap *charmap);
G_END_DECLS
......
......@@ -117,6 +117,16 @@ expand_collapse (GtkCheckMenuItem *mi, gpointer data)
}
static void
toggle_zoom_mode (GtkCheckMenuItem *mi, gpointer data)
{
if (gtk_check_menu_item_get_active (mi))
charmap_zoom_enable (CHARMAP (charmap));
else
charmap_zoom_disable (CHARMAP (charmap));
}
#if ENABLE_UNIHAN
static void
show_hide_unihan (GtkCheckMenuItem *mi, gpointer data)
......@@ -702,6 +712,21 @@ make_menu (GtkWindow *window)
G_CALLBACK (font_smaller), NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (view_menu), menu_item);
/* separator */
gtk_menu_shell_append (GTK_MENU_SHELL (view_menu), gtk_menu_item_new ());
/* ctrl-- */
menu_item = gtk_check_menu_item_new_with_mnemonic (_("_Zoom Mode"));
gtk_widget_add_accelerator (menu_item, "activate", accel_group,
GDK_Return, GDK_CONTROL_MASK, GTK_ACCEL_VISIBLE);
gtk_widget_add_accelerator (menu_item, "activate", accel_group,
GDK_KP_Enter, GDK_CONTROL_MASK, 0);
g_signal_connect (G_OBJECT (menu_item), "activate",
G_CALLBACK (toggle_zoom_mode), NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (view_menu), menu_item);
/* separator */
gtk_menu_shell_append (GTK_MENU_SHELL (view_menu), gtk_menu_item_new ());
......
......@@ -28,7 +28,7 @@
enum
{
MIN_FONT_SIZE = 5,
MAX_FONT_SIZE = 500
MAX_FONT_SIZE = 400,
};
enum
......
......@@ -22,6 +22,7 @@
#endif
#include <gtk/gtk.h>
#include <string.h>
#include <unicode_info.h>
#include <unicode_data.cI>
......
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