X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=example%2Fmimx-ispell.c;h=39777b790959f42250effc817416339b4c93ef94;hb=31ba8766800e46cf772cf59f418e1cd9e87b8a2c;hp=c81b5fcb4cd37bf186b449b871634678201dca0e;hpb=1359a5c46aaaa266d1d6a0f30f2478a18e439b5c;p=m17n%2Fm17n-lib.git diff --git a/example/mimx-ispell.c b/example/mimx-ispell.c index c81b5fc..39777b7 100644 --- a/example/mimx-ispell.c +++ b/example/mimx-ispell.c @@ -1,4 +1,4 @@ -/* imx-ispell.c -- Input method external module for Ispell. +/* imx-ispell.c -- Ispell input method external module. -*- coding: euc-jp; -*- Copyright (C) 2003, 2004 National Institute of Advanced Industrial Science and Technology (AIST) Registration Number H15PRO112 @@ -21,7 +21,7 @@ 02111-1307, USA. */ /***en - @page mimx-ispell external module for the input method + @enpage mimx-ispell external module for the input method @section mimx-ispell-description DESCRIPTION @@ -50,17 +50,47 @@ @section mimx-ispell-seealso See also @ref mdbIM */ +/***ja + @japage mimx-ispell ÆþÎϥ᥽¥Ã¥É Íѳ°Éô¥â¥¸¥å¡¼¥ë + + @section mimx-ispell-description DESCRIPTION + + ¶¦Í­¥é¥¤¥Ö¥é¥ê mimx-ispell.so ¤ÏÆþÎϥ᥽¥Ã¥É ¤ËÍѤ¤¤é + ¤ì¤ë³°Éô¥â¥¸¥å¡¼¥ë¤Ç¤¢¤ê¡¢°Ê²¼¤Î´Ø¿ô¤ò export ¤·¤Æ¤¤¤ë¡£ + +
    +
  • init + + ¥é¥¤¥Ö¥é¥ê¤Î½é´ü²½¡£ + +
  • fini + + ¥é¥¤¥Ö¥é¥ê¤Î½ªÎ»¡£ + +
  • ispell_word + + ¸½ºß¤Î preedit ¥Æ¥­¥¹¥È (±Ñʸ) ¤ÎÄÖ¤òÄ´¤Ù¡¢´Ö°ã¤Ã¤Æ¤¤¤ì¤Ð¸õÊä¤Î¥ê + ¥¹¥È¤òÊÖ¤¹¡£ + +
+ + ¤³¤Î¥×¥í¥°¥é¥à¤Ïm17n ÆþÎϥ᥽¥Ã¥ÉÍѳ°Éô¥â¥¸¥å¡¼¥ë¤Î½ñ¤­Êý¤ò¼¨¤¹¤¿ + ¤á¤Î¤â¤Î¤Ç¤¢¤ê¡¢¼ÂºÝ¤ÎÍøÍѤò°Õ¿Þ¤·¤¿¤â¤Î¤Ç¤Ï¤Ê¤¤¡£ + + @section mimx-ispell-seealso »²¾È + @ref mdbIM +*/ #ifndef FOR_DOXYGEN #include #include -#include #include #ifdef HAVE_ISPELL static int initialized = 0; +static int face_available; static MFace *mface_overstrike = NULL; static MPlist * @@ -83,11 +113,16 @@ init (MPlist *args) { MFaceHLineProp hline; - hline.type = MFACE_HLINE_STRIKE_THROUGH; - hline.width = 1; - hline.color = msymbol ("black"); - mface_overstrike = mface (); - mface_put_prop (mface_overstrike, Mhline, &hline); + face_available = 0; + if (m17n_status () == M17N_GUI_INITIALIZED) + { + face_available = 1; + hline.type = MFACE_HLINE_STRIKE_THROUGH; + hline.width = 1; + hline.color = msymbol ("black"); + mface_overstrike = mface (); + mface_put_prop (mface_overstrike, Mhline, &hline); + } } return NULL; } @@ -95,7 +130,9 @@ init (MPlist *args) MPlist * fini (MPlist *args) { - if (! --initialized) + if (initialized != 0 + && --initialized == 0 + && face_available) m17n_object_unref (mface_overstrike); return NULL; } @@ -148,7 +185,8 @@ ispell_word (MPlist *args) if (*p == '#') { mt = mtext_dup (ic->preedit); - mtext_push_prop (mt, 0, mtext_len (mt), Mface, mface_overstrike); + if (face_available) + mtext_push_prop (mt, 0, mtext_len (mt), Mface, mface_overstrike); mplist_add (actions, Mtext, mt); add_action (actions, msymbol ("shift"), Msymbol, init_state); m17n_object_unref (mt); @@ -182,7 +220,8 @@ ispell_word (MPlist *args) m17n_object_unref (mt); } mt = mtext_dup (ic->preedit); - mtext_push_prop (mt, 0, mtext_len (mt), Mface, mface_overstrike); + if (face_available) + mtext_push_prop (mt, 0, mtext_len (mt), Mface, mface_overstrike); mplist_add (candidates, Mtext, mt); m17n_object_unref (mt); plist = mplist_add (mplist (), Mplist, candidates);