X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=example%2Fmedit.c;h=a4e08d1d89108cdeafe1f3a75cc9e5146c7c9cf8;hb=5f8f274062adc55ae40c775de26aa10a2186ba78;hp=f63a5b69c5cda18da50ce4ff1e087b4d1f54d9f1;hpb=b0bd8f90bd525062923f6002410d6d93939024f6;p=m17n%2Fm17n-lib.git diff --git a/example/medit.c b/example/medit.c index f63a5b6..a4e08d1 100644 --- a/example/medit.c +++ b/example/medit.c @@ -1,5 +1,5 @@ /* medit.c -- simple multilingual editor. -*- coding: euc-jp; -*- - Copyright (C) 2003, 2004, 2005 + Copyright (C) 2003, 2004, 2005, 2006, 2007 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 @@ -17,7 +17,7 @@ You should have received a copy of the GNU Lesser General Public License along with the m17n library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 02111-1307, USA. */ /***en @@ -120,8 +120,6 @@ #include #include -#define VERSION "1.2.0" - /* Global variables. */ char *filename; @@ -865,7 +863,8 @@ show_cursor (XtPointer client_data) 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); @@ -2184,7 +2183,7 @@ surrounding_text_handler (MInputContext *ic, MSymbol command) { int len = (int) mplist_value (ic->plist); int pos; - MText *surround = NULL; + MText *surround; if (len < 0) { @@ -2200,11 +2199,10 @@ surrounding_text_handler (MInputContext *ic, MSymbol command) pos = nchars; surround = mtext_duplicate (mt, cursor.from, pos); } - if (surround) - { - mplist_set (ic->plist, Mtext, surround); - m17n_object_unref (surround); - } + else + surround = mtext (); + mplist_set (ic->plist, Mtext, surround); + m17n_object_unref (surround); } else if (command == Minput_delete_surrounding_text) { @@ -2290,16 +2288,16 @@ setup_input_methods (int with_xim, char *initial_input_method) qsort (input_method_table, num_input_methods, sizeof input_method_table[0], compare_input_method); - mplist_put (minput_driver->callback_list, Minput_status_start, - (void *) input_status); - mplist_put (minput_driver->callback_list, Minput_status_draw, - (void *) input_status); - mplist_put (minput_driver->callback_list, Minput_status_done, - (void *) input_status); - mplist_put (minput_driver->callback_list, Minput_get_surrounding_text, - (void *) surrounding_text_handler); - mplist_put (minput_driver->callback_list, Minput_delete_surrounding_text, - (void *) surrounding_text_handler); + mplist_put_func (minput_driver->callback_list, Minput_status_start, + M17N_FUNC (input_status)); + mplist_put_func (minput_driver->callback_list, Minput_status_draw, + M17N_FUNC (input_status)); + mplist_put_func (minput_driver->callback_list, Minput_status_done, + M17N_FUNC (input_status)); + mplist_put_func (minput_driver->callback_list, Minput_get_surrounding_text, + M17N_FUNC (surrounding_text_handler)); + mplist_put_func (minput_driver->callback_list, Minput_delete_surrounding_text, + M17N_FUNC (surrounding_text_handler)); current_input_context = NULL; current_input_method = -1; @@ -2652,8 +2650,8 @@ main (int argc, char **argv) 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 AIST, JAPAN\n"); exit (0); } else if (! strcmp (argv[i], "--geometry"))