/* medit.c -- simple multilingual editor. -*- coding: euc-jp; -*-
- Copyright (C) 2003, 2004, 2005
+ Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008
National Institute of Advanced Industrial Science and Technology (AIST)
Registration Number H15PRO112
#include <X11/Xaw/SmeLine.h>
#include <X11/Xaw/MenuButton.h>
-#define VERSION "1.3.4"
-
/* Global variables. */
char *filename;
int num_input_methods;
int current_input_method = -1; /* i.e. none */
+int unicode_input_method = -1;
int auto_input_method = 0;
+int saved_input_method = -3;
MInputContext *current_input_context;
struct FaceRec
{
float top = (float) from / nchars;
float shown = (float) (to - from) / nchars;
- XtArgVal *l_top = (XtArgVal *) ⊤
- XtArgVal *l_shown = (XtArgVal *) &shown;
- XtSetArg (arg[0], XtNtopOfThumb, *l_top);
- XtSetArg (arg[1], XtNshown, *l_shown);
- XtSetValues (SbarWidget, arg, 2);
+ XawScrollbarSetThumb (SbarWidget, top, shown);
}
{
MDrawMetric rect;
+ control.cursor_pos = pos;
if (full)
{
/* CUR is inaccurate. We can trust only TOP. */
else
{
XtSetArg (arg[0], XtNborderWidth, 1);
- XtSetArg (arg[1], XtNlabel, mlanguage_name (sym));
+ sym = mlanguage_name (sym);
+ XtSetArg (arg[1], XtNlabel, msymbol_name (sym));
XtSetValues (CurLangWidget, arg, 2);
}
XtSetValues (CurLangWidget, arg, 2);
update_cursor (pos1, 1);
}
+static void InputMethodProc (Widget, XtPointer, XtPointer);
static void
KeyProc (Widget w, XEvent *event, String *str, Cardinal *num)
ret = XLookupString (key_event, buf, sizeof (buf), &keysym, NULL);
m17n_object_unref (produced);
+ if (saved_input_method > -3)
+ {
+ InputMethodProc (w, (XtPointer) saved_input_method, NULL);
+ saved_input_method = -3;
+ }
+
switch (keysym)
{
case XK_Delete:
redraw (0, win_height, 1, 1);
return;
}
+ else if (buf[0] == '='
+ && (event->xkey.state & ControlMask)
+ && unicode_input_method >= 0)
+ {
+ saved_input_method = current_input_method;
+ InputMethodProc (w, (XtPointer) unicode_input_method, NULL);
+ minput_filter (current_input_context, msymbol ("C-u"), NULL);
+ }
else
{
MText *temp = mtext ();
handle = dlopen (filter_module, RTLD_NOW);
if (! handle)
return;
- *(void **) (&func) = dlsym (handle, "filter");
+ func = (void (*) (MText *, int, int)) dlsym (handle, "filter");
if (func)
(*func) (mt, mtext_property_start (selection),
mtext_property_end (selection));
MPlist *plist = mdatabase_list (msymbol ("input-method"), Mnil, Mnil, Mnil);
MPlist *pl;
int i;
+ MSymbol Municode = msymbol ("unicode");
num_input_methods = plist ? mplist_length (plist) : 0;
if (with_xim)
qsort (input_method_table, num_input_methods, sizeof input_method_table[0],
compare_input_method);
+ for (i = 0; i < num_input_methods; i++)
+ if (input_method_table[i].language == Mt
+ && input_method_table[i].name == Municode)
+ {
+ unicode_input_method = i;
+ break;
+ }
mplist_put_func (minput_driver->callback_list, Minput_status_start,
M17N_FUNC (input_status));
mplist_put_func (minput_driver->callback_list, Minput_status_draw,
help_exit (argv[0], 0);
else if (! strcmp (argv[i], "--version"))
{
- printf ("m17n-edit (m17n library) %s\n", VERSION);
- printf ("Copyright (C) 2003 AIST, JAPAN\n");
+ printf ("m17n-edit (m17n library) %s\n", M17NLIB_VERSION_NAME);
+ printf ("Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008 AIST, JAPAN\n");
exit (0);
}
else if (! strcmp (argv[i], "--geometry"))