Back to index

im-sdk  12.3.91
IIIMP_hotkey.cpp
Go to the documentation of this file.
00001 #include <config.h>
00002 #include <stdio.h>
00003 #include <vector>
00004 #include "IIIMP_ICState.hh"
00005 #include "IIIMPTrans.hh"
00006 #include "IIIMPUtil.hh"
00007 #include "IMHotkeyPrimitive.hh"
00008 #include "IIIMP_hotkey.hh"
00009 #include "IIIMP_hotkey_profile.hh"
00010 
00011 IIIMP_hotkey::IIIMP_hotkey(
00012     IIIMP_ICState *hics
00013 ) 
00014 {
00015     hotkey_mode = false;
00016     lang_selection = false;
00017     forward_event = false;
00018     first_candidate = -1;
00019     last_candidate = -1;
00020     current = -1;
00021     curr_hotkeyid = -1;
00022     curr_langid = 0;
00023 }
00024 
00025 IIIMP_hotkey::~IIIMP_hotkey()
00026 {   
00027 }
00028 
00029 bool
00030 IIIMP_hotkey::process_hotkey(
00031     IIIMP_ICState *hics,
00032     int hotkey_id,
00033     int index
00034 )
00035 {
00036     bool result = false;
00037     bool flag;
00038     IIIMP_message *p;
00039 
00040     curr_hotkeyid = hotkey_id;
00041 
00042     if (hotkey_id == (hics->get_hotkey_profile()->get_default_hotkey_lang_switch_id())) {
00043        if (get_lang_selection()) {
00044            set_lang_selection(false);
00045            result = stop_lang_selection_window(hics);
00046        } else {
00047            set_lang_selection(true);
00048            result = start_lang_selection_window(hics);
00049        }
00050     } else if (hotkey_id == hics->get_hotkey_profile()->get_default_hotkey_trigger_notify_id()) {
00051        if (hics->pshared->conversion_mode)
00052            flag = false;
00053        else 
00054            flag = true;
00055        result = hics->get_ichandler()->toggle_conversion(hics->get_imlexec(), flag);
00056         hics->pshared->conversion_mode = flag;
00057         if ((hics->start_request()->dealing()) && result) {
00058            if (!hics->pshared->conversion_mode) {
00059               p = iiimp_hotkey_state_notify_new(hics->get_iiimptrans()->get_data_s(), hics->get_im_id(), hics->get_ic_id(), hotkey_id, EVENT_FORWARDING_OFF);
00060               if (!hics->send(p, true)) return false;
00061               return true;
00062            } 
00063            return result;
00064         }
00065     } else if (hotkey_id == hics->get_hotkey_profile()->get_default_hotkey_cycle_lang_switch_id()) {
00066        set_lang_selection(true);
00067        result = do_cycle_lang_selection(hics, 1);
00068     } else if (hotkey_id == hics->get_hotkey_profile()->get_default_hotkey_reverse_cycle_lang_switch_id()) {
00069        set_lang_selection(true);
00070        result = do_cycle_lang_selection(hics, -1);
00071     }else {
00072         if (forward_hotkey_to_LE(hics, hotkey_id, index)) {
00073          // if (!hics->pshared->conversion_mode)
00074            // hics->get_ichandler()->toggle_conversion(hics->get_imlexec(), false);
00075           result = hics->start_request()->dealing();
00076          p = iiimp_hotkey_state_notify_new(hics->get_iiimptrans()->get_data_s(), hics->get_im_id(), hics->get_ic_id(), hotkey_id, EVENT_FORWARDING_OFF);
00077          if (!hics->send(p, true)) return false;
00078         }
00079     }
00080     return result;
00081 }
00082 
00083 bool
00084 IIIMP_hotkey::forward_hotkey_to_LE(
00085     IIIMP_ICState *hics,
00086     int hotkey_id,
00087     int index
00088 )
00089 {
00090     bool result = false;
00091 
00092     const IMHotkeyProfileList *hkplist = hics->get_hotkey_profile()->get_profile_list();
00093     for (IMHotkeyProfileList::const_iterator it = hkplist->begin();
00094          it != hkplist->end();
00095          ++it) {
00096         const IMHotkeyList *phklist = it->get_hotkey_list();
00097        IMHotkeyList::const_iterator it2 = phklist->begin();
00098         for (; it2 != phklist->end(); ++it2) {
00099            if (hotkey_id == it2->get_hotkey_id()) {
00100                 const IMKeySpecList *keylist = it2->get_keylist();
00101               IMKeySpecList::const_iterator it3 = keylist->begin();
00102               // vector<IMKeyEventStruct> keyvec(keylist->size());
00103               vector<IMKeyEventStruct> keyvec;
00104               IMInputEvent ev;
00105               IMKeyEventStruct kev;
00106 
00107               for (int i=0; it3 != keylist->end(); ++it3, ++i) {
00108                   if (i == index) {
00109                      kev.keyCode = it3->get_keycode();
00110                      kev.keyChar = it3->get_keychar();
00111                      kev.modifier = it3->get_modifier();
00112                      kev.time_stamp = it3->get_timestamp();
00113                      keyvec.push_back(kev);
00114     
00115                      IMKeyListEvent *pimkey = &ev.keylist;
00116                      memset(pimkey, 0,sizeof(*pimkey));
00117                      pimkey->type = IM_HotkeyEvent;
00118                      pimkey->n_operation = hotkey_id;  // Use the existing IMKeyListEvent
00119                                                           // to store the Hotkey details
00120                      pimkey->n_key = index;            // pimkey->n_operation holds hotkey_id 
00121                                                           // pimkey->n_key holds the Index
00122                      pimkey->keylist = &keyvec[0];
00123   
00124                      result = hics->get_ichandler()->send_event(hics->get_imlexec(), &ev); 
00125                      return result;
00126                   }
00127                 }
00128            }
00129        }
00130     }
00131     return result;
00132 }
00133 
00134 bool
00135 IIIMP_hotkey::send_hotkey_reply(
00136     IIIMP_ICState *hics
00137 )
00138 {
00139     IIIMP_message *p;
00140     p = iiimp_hotkey_notify_reply_new(hics->get_iiimptrans()->get_data_s(), hics->get_im_id(), hics->get_ic_id());   
00141     set_hotkey_mode(false);
00142     if (!hics->send(p, true)) return false;
00143     return true;
00144 }
00145 
00146 bool
00147 IIIMP_hotkey::start_lang_selection_window(
00148     IIIMP_ICState *hics
00149 )
00150 {
00151     IMLangList *planglist = hics->get_langlist(hics->get_ichandler()->get_current_desktop());
00152     IIIMP_message *p;
00153 
00154     p = iiimp_lookup_choice_start_new(hics->get_iiimptrans()->get_data_s(),
00155                                   hics->get_im_id(),
00156                                   hics->get_ic_id(),
00157                                   IM_LOOKUP_CHOICE_START_SERVER_IS_MASTER,
00158                                   planglist->size(),
00159                                   planglist->size(),
00160                                   1,
00161                                   IM_LOOKUP_CHOICE_START_DRAWING_UP_HORIZONTALLY,
00162                                   IM_LOOKUP_CHOICE_START_SERVER_OWNS_LABEL);
00163     if (!hics->send(p, true)) return false;
00164    
00165     hics->create_langimlist();
00166 
00167     return true;
00168 }
00169 
00170 void
00171 IIIMP_hotkey::print_LangIMList(
00172     IIIMP_ICState *hics
00173 )
00174 {
00175     LangIMList::iterator it;
00176     LangIMList *plangimlist = hics->get_langimlist();
00177 
00178     for (it = plangimlist->begin (); it != plangimlist->end (); it++){
00179        u16string imname = it->get_hrn();
00180         if (imname.get_charstr() == NULL) {
00181            imname  = it->get_imname();
00182         }
00183        LOG_DEBUG("Index [%d], Lang_ID [%s], IMName [%s]\n",it->get_index(), it->get_id(), imname.get_charstr());
00184     }
00185 }
00186 
00187 bool
00188 IIIMP_hotkey::stop_lang_selection_window(
00189     IIIMP_ICState *hics
00190 )
00191 {
00192     IIIMP_message *p;
00193     p = iiimp_lookup_choice_done_new(hics->get_iiimptrans()->get_data_s(),
00194                                  hics->get_im_id(),
00195                                  hics->get_ic_id());
00196     if (!hics->send(p, true)) return false;
00197     return true;
00198 }
00199 
00200 int
00201 IIIMP_hotkey::UTFCHARLen(
00202     UTFCHAR * p
00203 )
00204 {
00205     int i;
00206     for (i = 0; *p; i++)
00207        p++;
00208     return i;
00209 }
00210 
00211 int
00212 IIIMP_hotkey::UTFCHARLen(
00213     const char *p
00214 )
00215 {
00216     int i;
00217     for (i = 0; *p; i++)
00218        p++;
00219     return i;
00220 }
00221 
00222 int
00223 IIIMP_hotkey::UTFCHARCpy(
00224     UTFCHAR * dest,
00225     const char *original
00226 )
00227 {
00228     int i;
00229     for (i = 0; *original; i++) {
00230        *dest++ = *original++;
00231     }
00232     *dest = 0;
00233     return i;
00234 }
00235 
00236 int
00237 IIIMP_hotkey::UTFCHARCpy(
00238     UTFCHAR * dest,
00239     UTFCHAR * original
00240 )
00241 {
00242     int i;
00243     for (i = 0; *original; i++) {
00244        *dest++ = *original++;
00245     }
00246     *dest = 0;
00247     return i;
00248 }
00249 
00250 int 
00251 IIIMP_hotkey::UTFCHARCat(
00252     UTFCHAR *dest,
00253     UTFCHAR *str1,
00254     UTFCHAR *str2
00255 )
00256 {
00257     int i;
00258     for (i = 0; *str1; i++) {
00259        *dest++ = *str1++;
00260     }
00261     for (i = 0; *str2; i++) {
00262        *dest++ = *str2++;
00263     }
00264     *dest = 0;
00265     return i;
00266 }
00267 
00268 int
00269 IIIMP_hotkey::UTFCHARCat(
00270     UTFCHAR *dest, 
00271     const char *str1, 
00272     const char *str2,
00273     const char *str3,
00274     const char *str4
00275 )
00276 {
00277     int i;
00278     for (i = 0; *str1; i++) { 
00279        *dest++ = *str1++;
00280     }
00281     for (i = 0; *str2; i++) {
00282        *dest++ = *str2++;
00283     }
00284     for (i = 0; *str3; i++) {
00285        *dest++ = *str3++;
00286     }
00287     for (i = 0; *str4; i++) {
00288        *dest++ = *str4++;
00289     }
00290     *dest = 0;
00291     return i;
00292 } 
00293 
00294 IMFeedbackList *
00295 IIIMP_hotkey::create_feedback(
00296     int size
00297 )
00298 {
00299     int i;
00300     IMFeedbackList *feedback, *fbl;
00301 
00302     feedback = (IMFeedbackList *) calloc(size, sizeof(IMFeedbackList));
00303     for (i = 0; i < size; i++) {
00304        fbl = &feedback[i];
00305        fbl->count_feedbacks = 1;
00306        fbl->feedbacks = (IMFeedback *) calloc(4, sizeof(IMFeedback));
00307        memset(fbl->feedbacks, 0, sizeof(IMFeedback) * 4);
00308     }
00309     return feedback;
00310 }
00311 
00312 void
00313 IIIMP_hotkey::free_feedback(
00314     IMFeedbackList *feedback,
00315     int size
00316 )
00317 {
00318     int i;
00319     IMFeedbackList *fbl;
00320 
00321     if (feedback == NULL) return;
00322 
00323     for (i = 0; i < size; i++) {
00324        fbl = &feedback[i];
00325        if (fbl->feedbacks != NULL)
00326            free(fbl->feedbacks);
00327     }
00328     free(feedback);
00329 }
00330 
00331 bool
00332 IIIMP_hotkey::process_lang_selection_window(
00333     IIIMP_ICState *hics,
00334     IIIMP_message *pmes
00335 )
00336 {
00337     IIIMP_contents *pc = pmes->v.forward_event.contents;
00338     IIIMP_keyevent *piiimpkey = pc->value.keyevent_list->keyevent;
00339     int keycode = piiimpkey->keycode;
00340     /* For Key Release Event */
00341     bool is_key_release = piiimpkey->modifier & 0x80000000;
00342     int index = 0;
00343     IIIMP_message *p;
00344     int hotkey_id = 0;
00345 
00346     /* just ignore key release event */
00347     if (is_key_release) goto HOTKEY_MESSAGE_REPLY;
00348 
00349     hotkey_id = check_for_hotkey(hics, piiimpkey);
00350 
00351     if (hotkey_id) process_hotkey(hics, hotkey_id, 0);
00352 
00353     // print_LangIMList(hics);
00354 
00355     switch(keycode) {
00356       case IM_VK_PAGE_UP:
00357       case IM_VK_PAGE_DOWN:
00358       case IM_VK_SPACE:
00359       case IM_VK_DOWN:
00360       case IM_VK_UP:
00361       case IM_VK_LEFT:
00362       case IM_VK_RIGHT:
00363        draw_lang_selection_window(hics, keycode);
00364        break;
00365 
00366       case IM_VK_ENTER:
00367        index = current + 1;
00368        if (switch_language(hics, index, curr_hotkeyid)) return true;
00369        break;
00370       
00371       case IM_VK_1:
00372       case IM_VK_2:
00373       case IM_VK_3:
00374       case IM_VK_4:
00375       case IM_VK_5:
00376       case IM_VK_6:
00377       case IM_VK_7:
00378       case IM_VK_8:
00379       case IM_VK_9:
00380        index = first_candidate + ((piiimpkey->keychar - '0') % 10);
00381        if (switch_language(hics, index, curr_hotkeyid)) return true;
00382        break;
00383       case IM_VK_ESCAPE:
00384        if (get_lang_selection()) {
00385           set_lang_selection(false);
00386           stop_lang_selection_window(hics);
00387        } 
00388        break;
00389     }
00390 
00391 HOTKEY_MESSAGE_REPLY:
00392     p = iiimp_forward_event_reply_new(hics->get_iiimptrans()->get_data_s(),
00393                                   hics->get_im_id(),
00394                                   hics->get_ic_id());
00395     if (!hics->send(p, true)) return false;
00396     set_forward_event(false);
00397     return true;
00398 }
00399 
00400 int
00401 IIIMP_hotkey::check_for_hotkey(
00402     IIIMP_ICState *hics,
00403     IIIMP_keyevent *kev
00404 )
00405 {
00406     int hotkey_id = 0;
00407     size_t i,j;
00408 
00409     const IMHotkeyProfileList *hkplist = hics->get_hotkey_profile()->get_profile_list();
00410     IMHotkeyProfileList::const_iterator it1 = hkplist->begin();
00411     for (it1 = hkplist->begin(); it1 != hkplist->end(); it1++) {
00412        const IMHotkeyList *phklist = it1->get_hotkey_list();
00413         IMHotkeyList::const_iterator it2 = phklist->begin();
00414        for (i = 0; it2 != phklist->end(), i < phklist->size(); ++it2, ++i) {
00415            const IMKeySpecList *keylist = it2->get_keylist();
00416             IMKeySpecList::const_iterator it3 = keylist->begin();
00417            for (j = 0; it3 != keylist->end(), j < keylist->size(); ++it3, ++j) {
00418               if ((kev->keycode == it3->get_keycode()) && (kev->modifier == it3->get_modifier())) {
00419                   return it2->get_hotkey_id();
00420               }
00421            }
00422        }
00423     } 
00424     return hotkey_id;
00425 }
00426 
00427 bool
00428 IIIMP_hotkey::switch_language(
00429     IIIMP_ICState *hics,
00430     int index,
00431     int hotkey_id
00432 )
00433 {
00434     IIIMP_message *p;
00435     LangIMList::iterator it;
00436     LangIMList *plangimlist = hics->get_langimlist();
00437     ICAttribute attr;
00438     bool result = false;
00439 
00440     hics->get_ichandler()->toggle_conversion(hics->get_imlexec(), false);
00441     hics->pshared->conversion_mode = false;
00442 
00443     for (it = plangimlist->begin (); it != plangimlist->end (); it++){
00444        if (index == it->get_index()) {
00445            u16string imname = it->get_imname();
00446 
00447             // Select the Client's profile to the selected LE's profile
00448             IIIMP_card16 scope_and_profile_id = 0;
00449            const IMHotkeyProfileStruct *hkps = it->get_hotkey_profile();
00450 
00451            // safe enough to use default profile anyway
00452            int p_id = hics->get_hotkey_profile()->get_default_hotkey_profile_id();
00453             if (hkps != NULL) {
00454               IMHotkeyProfileList::iterator it1;
00455               IMHotkeyProfileList *hkplist = const_cast<IMHotkeyProfileList*>(hics->get_hotkey_profile()->get_profile_list());
00456               for (it1 = hkplist->begin(); it1 != hkplist->end(); it1++) {
00457                   if (it1->get_hotkey_profile_struct()->name == hkps->name) { // crack, crack
00458                      p_id = it1->get_profile_id();
00459                      break;
00460                   }
00461               }
00462            }
00463            LOG_DEBUG("IIIMP_hotkey:Switching profile to [%d] for [%s]\n",p_id, imname.get_charstr());
00464             scope_and_profile_id = (GLOBAL_HOTKEY << 15) | p_id;
00465            p = iiimp_select_hotkey_profile_new(hics->get_iiimptrans()->get_data_s(), hics->get_im_id(), scope_and_profile_id);
00466            if (!hics->send(p, true)) return false;
00467             
00468            attr.set_inputlanguage(it->get_id());
00469            attr.set_inputmethod(imname);
00470            hics->get_ichandler()->set_icattr(attr);
00471            if (get_lang_selection()) {
00472               set_lang_selection(false);
00473               result = hics->get_ichandler()->toggle_conversion(hics->get_imlexec(), true);
00474               hics->pshared->conversion_mode = true;
00475               if ((hics->start_request()->dealing()) && result) {
00476                   stop_lang_selection_window(hics);
00477                   p = iiimp_hotkey_state_notify_new(hics->get_iiimptrans()->get_data_s(), hics->get_im_id(), hics->get_ic_id(), hotkey_id, EVENT_FORWARDING_ON);
00478                   if (!hics->send(p, true)) return false;
00479                   return true;
00480               }
00481            } 
00482        }
00483     }
00484     return false;
00485 }
00486 
00487 bool
00488 IIIMP_hotkey::draw_lang_selection_window(
00489     IIIMP_ICState *hics,
00490     int kc
00491 )
00492 {
00493     IIIMP_message *p;
00494     IIIMP_text *pchoiceh, *pchoice = NULL;
00495     IIIMP_text *plabelh, *plabel = NULL;
00496     IIIMP_text *ptitle;
00497     IIIMP_text *pcur;
00498     IMText *title;
00499     IMText **vt;             /* for value */
00500     IMText **lt;             /* for label */
00501     LangIMList::iterator it;
00502     LangIMList *plangimlist;
00503     UTFCHAR title_string[] = {'S','W','I','T','C','H',' ','L','A','N','G',' ',' ',0};
00504     UTFCHAR *tmp_str;
00505     char label[32];
00506     char pos[32];
00507     int idx_first, idx_last, size;
00508     size_t i;
00509     int j, k, l;
00510     bool flag = false;
00511 
00512     idx_first = idx_last = size = 0;
00513     pchoiceh = plabelh = ptitle = NULL;
00514 
00515     plangimlist = hics->get_langimlist();
00516     size = plangimlist->size();
00517 
00518     if (kc == 0) {
00519         first_candidate = 0;
00520         last_candidate = 8;
00521         if (size < last_candidate)
00522           last_candidate = size -1;
00523         current = 0;
00524         k = current;
00525     } 
00526 
00527     switch(kc) {
00528       case IM_VK_UP:
00529        if (last_candidate > size)
00530           last_candidate = size;
00531        if (current == first_candidate) {
00532           current = last_candidate;
00533           flag = true;
00534        } else
00535           current -= 1;
00536        break;
00537       case IM_VK_DOWN:
00538       case IM_VK_SPACE:
00539        if (current == last_candidate)
00540           current = first_candidate;
00541        else
00542           current += 1;
00543        break;
00544       case IM_VK_PAGE_UP:
00545       case IM_VK_LEFT:
00546        idx_first = first_candidate - 9;
00547        if (idx_first >= 0) {
00548           last_candidate = first_candidate -1;
00549           first_candidate = idx_first;
00550           current = first_candidate;
00551        }
00552        break;
00553       case IM_VK_PAGE_DOWN:
00554       case IM_VK_RIGHT:
00555        idx_first = first_candidate + 9;
00556        idx_last = last_candidate + 9;
00557        if (idx_first < size) {
00558           first_candidate = idx_first;
00559           current = first_candidate;
00560        }
00561        if (idx_last <= size)
00562           last_candidate = idx_last;
00563        else if (idx_last > size) 
00564           last_candidate = size;
00565        break;
00566     }
00567 
00568     title = (IMText *)calloc(1, sizeof(IMText));
00569     (void)memset(pos, 0, 32);
00570 
00571     if (current < size) 
00572        k = current + 1;
00573     else if (current >= size) {
00574        if (!flag)
00575            current = first_candidate;
00576        else 
00577            current -= 1;
00578        k = current + 1;
00579     }
00580     l = size;
00581     snprintf((char *)pos,sizeof(pos),"%c%d%c%d%c",'[', k, '/', l, ']');
00582     title->char_length = UTFCHARLen(title_string) + strlen(pos);
00583     title->text.utf_chars = (UTFCHAR *) calloc((title->char_length + 1), sizeof(UTFCHAR));
00584     tmp_str = (UTFCHAR *) calloc ((strlen(pos) + 1), sizeof(UTFCHAR));
00585     UTFCHARCpy(tmp_str, pos);
00586     UTFCHARCat(title->text.utf_chars, title_string, tmp_str);
00587     title->feedback = create_feedback(title->char_length);
00588     ptitle = convert_IMText_to_iiimp_text(hics->get_iiimptrans()->get_data_s(), title);
00589   
00590     if (title->text.utf_chars) free(title->text.utf_chars);
00591     if (title->feedback) free_feedback(title->feedback, title->char_length);
00592     if (title) free(title);
00593     if (tmp_str) free(tmp_str);
00594 
00595     vt = (IMText **)calloc(size, sizeof(IMText *));
00596     lt = (IMText **)calloc(size, sizeof(IMText *));
00597 
00598     for (i = 0, it = plangimlist->begin(); i < plangimlist->size(); it++,i++) {
00599         u16string imname  = it->get_hrn();
00600 
00601         if (imname.get_charstr() == NULL) {
00602            imname  = it->get_imname();
00603         }
00604 
00605         vt[i] = (IMText *)calloc(1, sizeof(IMText));
00606         vt[i]->char_length = UTFCHARLen(imname.get_charstr()) + 3 + UTFCHARLen(it->get_id());
00607         vt[i]->text.utf_chars = (UTFCHAR *) calloc((vt[i]->char_length + 1), sizeof(UTFCHAR));
00608 
00609         UTFCHARCat(vt[i]->text.utf_chars, it->get_id(), " (", imname.get_charstr(), ")");
00610         vt[i]->feedback = create_feedback(vt[i]->char_length);
00611 
00612         // Value
00613         pcur = convert_IMText_to_iiimp_text(hics->get_iiimptrans()->get_data_s(), vt[i]);
00614         if (!pchoiceh) {
00615            pchoiceh = pcur;
00616         }else{
00617            pchoice->next = pcur;
00618         }
00619         pchoice = pcur;
00620 
00621         lt[i] = (IMText *)calloc(1, sizeof(IMText));
00622         (void)memset(label, 0, 32);
00623         lt[i]->char_length = 3;
00624         lt[i]->text.utf_chars = (UTFCHAR *) calloc((lt[i]->char_length + 1), sizeof(UTFCHAR));
00625         if (i > 8) {
00626            j = i % 9;
00627            snprintf((char *)label,sizeof(label),"%d%c%c",j+1,'.',' ');
00628         } else {
00629            snprintf((char *)label,sizeof(label),"%d%c%c",i+1,'.',' ');
00630         }
00631         UTFCHARCpy(lt[i]->text.utf_chars, label);
00632         lt[i]->feedback = create_feedback(lt[i]->char_length);
00633 
00634         // Label
00635         pcur = convert_IMText_to_iiimp_text(hics->get_iiimptrans()->get_data_s(), lt[i]);
00636         if (!plabelh) {
00637             plabelh = pcur;
00638         } else {
00639             plabel->next = pcur;
00640         }
00641         plabel = pcur;
00642 
00643         free_feedback(vt[i]->feedback, vt[i]->char_length);
00644         free(vt[i]->text.utf_chars);
00645         free(vt[i]);
00646 
00647         free_feedback(lt[i]->feedback, lt[i]->char_length);
00648         free(lt[i]->text.utf_chars);
00649         free(lt[i]);
00650     }
00651  
00652     free(vt);
00653     free(lt);
00654 
00655     p = iiimp_lookup_choice_draw_new(hics->get_iiimptrans()->get_data_s(),
00656                                  hics->get_im_id(),
00657                                  hics->get_ic_id(),
00658                                  first_candidate,
00659                                  last_candidate,
00660                                  current,
00661                                  pchoiceh,
00662                                  plabelh,
00663                                  ptitle);
00664     if (!hics->send(p, true)) return false;
00665     return true;
00666 }
00667 
00668 bool
00669 IIIMP_hotkey::do_cycle_lang_selection(
00670     IIIMP_ICState *hics,
00671     int orientation
00672 )
00673 {
00674     LangIMList *plangimlist = hics->get_langimlist();
00675 
00676     if (plangimlist->size() == 0)
00677        hics->create_langimlist();
00678 
00679     print_LangIMList(hics);
00680     curr_langid += orientation;
00681     if (orientation > 0 && curr_langid > plangimlist->size())
00682        curr_langid = 1;
00683     if (orientation < 0 && curr_langid <= 0)
00684        curr_langid = plangimlist->size();
00685 
00686     return switch_language(hics, curr_langid, curr_hotkeyid);
00687 }
00688 
00689 /* Local Variables: */
00690 /* c-file-style: "iiim-project" */
00691 /* End: */