Back to index

im-sdk  12.3.91
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
IIIMP_ICState Class Reference

#include <IIIMP_ICState.hh>

Inheritance diagram for IIIMP_ICState:
Inheritance graph
[legend]
Collaboration diagram for IIIMP_ICState:
Collaboration graph
[legend]

List of all members.

Classes

struct  SharedState

Public Member Functions

iml_session_tget_iml_session ()
iml_methods_tget_iml_methods ()
IIIMPTransget_iiimptrans ()
bool conversion_enable_p ()
IMLangListget_langlist (iml_desktop_t *)
bool create_langimlist ()
LangIMListget_langimlist ()
virtual bool message_proc (void *message)
IMInputContextget_iminputcontext ()
IMSvrget_imsvr ()
LEMgrget_lemgr ()
virtual ~IIIMP_ICState ()
bool send_avail_p ()
IMStateget_imstate ()
CARD16BIT get_im_id ()
IIIMP_hotkey_profileget_hotkey_profile ()
CARD16BIT get_ic_id () const
bool substatep () const
bool deliver (void *message)
virtual int toggle_client_convmode (bool flag)
virtual int forward_keyevent (IMKeyEventStruct *pkeyevent)
virtual int commit_string (IMText *pimtext)
virtual int preedit_start ()
virtual int draw_preedit (IMPreeditDrawCallbackStruct *pimpdraw)
virtual int preedit_done ()
virtual int status_start ()
virtual int draw_status (IMStatusDrawCallbackStruct *pimsdraw)
virtual int status_done ()
virtual int lookup_start (IMLookupStartCallbackStruct *pimls)
virtual int draw_lookup (IMLookupDrawCallbackStruct *pimld)
virtual int lookup_process (IMLookupProcessCallbackStruct *pimlp)
virtual int lookup_done ()
virtual int aux_start (IMAuxStartCallbackStruct *pimauxstart)
virtual int draw_aux (IMAuxDrawCallbackStruct *pimauxstart)
virtual int aux_done (IMAuxDoneCallbackStruct *pimauxstart)
virtual int ns_listener (IMNSListenerStruct *pons)

Static Public Member Functions

static IIIMP_ICStatecreate (CARD16BIT ic_id, IIIMP_IMState *piiims, ICHandler *pich)

Protected Member Functions

IIIMP_IMStateget_iiimp_imstate ()
bool send (IIIMP_message *pmes, bool deletep)
IIIMP_ICState_REQUESTEDstart_request ()
 IIIMP_ICState (CARD16BIT ic_id, IIIMP_IMState *piiims, ICHandler *pich, IMLExec_ICState *pimlex)
IMLExec_ICStateget_imlexec ()
bool mark_terminal ()
void reset_state ()
void change_state (ICState &newstate, bool destroyp=true)
IMProtocolget_improtocol ()
ICHandlerget_ichandler ()
void invalidate_ichandler ()
bool check_protocol_version (int version)
int invalid_operation (const char *opstr)

Protected Attributes

SharedStatepshared
IIIMP_hotkeyihk

Private Member Functions

virtual bool state_send_available_p ()
virtual void destroy ()

Private Attributes

IIIMP_IMStatepims
LangIMList langimlist

Friends

class IIIMP_hotkey

Detailed Description

Definition at line 17 of file IIIMP_ICState.hh.


Class Documentation

struct IIIMP_ICState::SharedState

Definition at line 28 of file IIIMP_ICState.hh.

Class Members
bool conversion_mode
bool lookup_choice
bool preedit
bool status

Constructor & Destructor Documentation

IIIMP_ICState::IIIMP_ICState ( CARD16BIT  ic_id,
IIIMP_IMState piiims,
ICHandler pich,
IMLExec_ICState pimlex 
) [protected]

Definition at line 94 of file IIIMP_ICState.cpp.

  : ICState(ic_id, piiims, pich, pimlex)
{
    pshared = new SharedState();
    pshared->conversion_mode = false;
    pshared->preedit = false;
    pshared->status = false;
    pshared->lookup_choice = false;

    langimlist.clear();
    ihk = new IIIMP_hotkey(this);
}

Here is the caller graph for this function:

Definition at line 218 of file IIIMP_ICState.cpp.

{
    if (!substatep()) {
       delete pshared;
       delete get_imlexec();
        if (ihk) delete ihk;
    }
}

Here is the call graph for this function:


Member Function Documentation

int ICState::aux_done ( IMAuxDoneCallbackStruct pimauxstart) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 164 of file ICState.cpp.

{
    return invalid_operation("aux_done");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::aux_start ( IMAuxStartCallbackStruct pimauxstart) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 148 of file ICState.cpp.

{
    return invalid_operation("aux_start");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ICState::change_state ( ICState newstate,
bool  destroyp = true 
) [inline, protected, inherited]

Definition at line 154 of file ICState.hh.

    {
       ICState *p = pbase_state;
       if (destroyp && p->pproc_state) delete p->pproc_state;
       if (p == &newstate) {
           p->pproc_state = NULL;
       } else {
           p->pproc_state = &newstate;
       }
       p->pshared->pimlex->set_icstate(&newstate);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

bool ICState::check_protocol_version ( int  version) [inline, protected, inherited]

Definition at line 175 of file ICState.hh.

    { return get_imstate()->check_protocol_version(version); }

Here is the call graph for this function:

int ICState::commit_string ( IMText pimtext) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 70 of file ICState.cpp.

{
    return invalid_operation("commit_string");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 64 of file IIIMP_ICState.hh.

    { return pshared->conversion_mode; }

Here is the caller graph for this function:

IIIMP_ICState * IIIMP_ICState::create ( CARD16BIT  ic_id,
IIIMP_IMState piiims,
ICHandler pich 
) [static]

Definition at line 112 of file IIIMP_ICState.cpp.

{
    // The current implementation use the same IMLExec.
    // Note that it will be changed later.
    IMLExec_ICState *pimlex = new IMLExec_ICState();
    // memory error;
    if (!pimlex) return NULL;
    IIIMP_ICState *pics = new IIIMP_ICState(ic_id, piiims, pich, pimlex);
    // memory error;
    if (!pics) {
       delete pimlex;
       return NULL;
    }
    return pics;
}

Here is the call graph for this function:

Definition at line 183 of file IIIMP_ICState.cpp.

{
    LEMgr *plemgr = get_lemgr ();
    IMDescriptorList::iterator it;
    IMLangList::iterator itt;

    IMDescriptorList *pimdlist = const_cast<IMDescriptorList *>(plemgr->get_all_imdesclist(get_ichandler()->get_current_desktop()));

    langimlist.clear();
    for (it = pimdlist->begin (); it != pimdlist->end (); it++){
        u16string imname;
        u16string hrn;
        imname = it->get_imname();
        hrn = it->get_hrn();
        IMLangList *llist = const_cast<IMLangList *>(it->get_languages());
        for (itt = llist->begin (); itt != llist->end (); itt++) { 
           langimlist.push_back(LangIM(langimlist.size() + 1,
              // this '+ 1' is a crack - index in lang choice starts from 1...
              itt->get_id(),
              u16string(imname),
              u16string(hrn),
              it->get_hotkey_profile()
              )
           );
        }
    }
    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool ICState::deliver ( void *  message) [inherited]

Definition at line 7 of file ICState.cpp.

{
    ICState *p;
    bool result = true;

    if (pproc_state) p = pproc_state;
    else p = this;

    if (!p->message_proc(message)) return false;

    if (send_avail_p() && get_imlexec()) {
       result = get_imlexec()->execute();
    }

    if (terminatingp()) {
       LOG_DEBUG("Try to terminate IC(%d).", get_ic_id());
       if (pproc_state) {
           LOG_DEBUG("Right now, the current state in IC(%d) may be "
                    "waiting for client responce.",
                    get_ic_id());
       } else if (!(get_imlexec()->empty())){
           LOG_DEBUG("Pending IML instruction(s) still remain in IC(%d), "
                    "wait for the next chance.",
                    get_ic_id());
       } else {
           int id = get_ic_id();
           destroy();
           LOG_DEBUG("Successfully IC(%d) is terminated.", id);
       }
    }

    return result;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void IIIMP_ICState::destroy ( ) [private, virtual]

Reimplemented from ICState.

Definition at line 133 of file IIIMP_ICState.cpp.

{
    if (get_ichandler()) {
       /* Normally, client must send IM_DESTROYIC before terminating IC,
          hence, ichandler must be dead here.  But when client abruptly
          shut down the connection, we have to clean up ichandler.  */
       get_ichandler()->destroy();
       invalidate_ichandler();
    }
    ICState::destroy();
}

Here is the call graph for this function:

int ICState::draw_aux ( IMAuxDrawCallbackStruct pimauxstart) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 156 of file ICState.cpp.

{
    return invalid_operation("draw_aux");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::draw_lookup ( IMLookupDrawCallbackStruct pimld) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 126 of file ICState.cpp.

{
    return invalid_operation("draw_lookup");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::draw_preedit ( IMPreeditDrawCallbackStruct pimpdraw) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 84 of file ICState.cpp.

{
    return invalid_operation("draw_preedit");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::draw_status ( IMStatusDrawCallbackStruct pimsdraw) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 104 of file ICState.cpp.

{
    return invalid_operation("draw_status");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::forward_keyevent ( IMKeyEventStruct pkeyevent) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 62 of file ICState.cpp.

{
    return invalid_operation("forward_keyevent");
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 215 of file ICState.hh.

    { return get_imstate()->get_hotkey_profile(); }

Here is the call graph for this function:

Here is the caller graph for this function:

CARD16BIT ICState::get_ic_id ( ) const [inline, inherited]

Definition at line 217 of file ICState.hh.

    { return pshared->ic_id; }

Here is the caller graph for this function:

ICHandler* ICState::get_ichandler ( ) [inline, protected, inherited]

Definition at line 171 of file ICState.hh.

    { return pshared->pich; }

Here is the caller graph for this function:

Definition at line 36 of file IIIMP_ICState.hh.

    { return (IIIMP_IMState*) get_imstate(); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 58 of file IIIMP_ICState.hh.

Here is the call graph for this function:

Here is the caller graph for this function:

CARD16BIT ICState::get_im_id ( ) [inline, inherited]

Definition at line 213 of file ICState.hh.

    { return get_imstate()->get_im_id(); }

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 81 of file IIIMP_ICState.hh.

    {
       IMInputContext *pimic;
       pimic = dynamic_cast<IMInputContext *>(get_ichandler());
       return pimic;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

IMLExec_ICState* ICState::get_imlexec ( ) [inline, protected, inherited]

Definition at line 138 of file ICState.hh.

    { return pshared->pimlex; }

Here is the caller graph for this function:

IMProtocol* ICState::get_improtocol ( ) [inline, protected, inherited]

Definition at line 169 of file ICState.hh.

    { return pshared->pims->get_improtocol(); }

Here is the call graph for this function:

IMState* ICState::get_imstate ( ) [inline, inherited]

Definition at line 211 of file ICState.hh.

    { return pshared->pims; }

Here is the caller graph for this function:

Definition at line 146 of file IIIMP_ICState.cpp.

{
    IMSvr *imsvr;
    IMInputContext *pimic;

    pimic = get_iminputcontext ();
    imsvr = pimic->get_imconnection()->get_imsvr();

    if (imsvr) return imsvr;
    else return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 213 of file IIIMP_ICState.cpp.

{
    return &langimlist;
}

Here is the caller graph for this function:

Definition at line 167 of file IIIMP_ICState.cpp.

{
    LEMgr *plemgr = get_lemgr ();

    IMLangList *planglist =
        const_cast<IMLangList *>(plemgr->get_all_langlist(curr_desktop));
    IMLangList::iterator it;
    for (it = planglist->begin (); it != planglist->end (); it++){
       // LOG_DEBUG("LangID [%s]", it->get_id ());
    }
    return planglist;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 159 of file IIIMP_ICState.cpp.

{
    IMSvr *pimsvr = get_imsvr ();
    return pimsvr->get_lemgr();

}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::invalid_operation ( const char *  opstr) [protected, inherited]

Definition at line 44 of file ICState.cpp.

{
    LOG_ERROR("Current IC state cannot deal with %s.", opstr);
    abort();
    return 0;
}

Here is the caller graph for this function:

void ICState::invalidate_ichandler ( ) [inline, protected, inherited]

Definition at line 173 of file ICState.hh.

    { pshared->pich = NULL; }

Here is the caller graph for this function:

int ICState::lookup_done ( ) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 142 of file ICState.cpp.

{
    return invalid_operation("lookup_done");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::lookup_process ( IMLookupProcessCallbackStruct pimlp) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 134 of file ICState.cpp.

{
    return invalid_operation("lookup_process");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::lookup_start ( IMLookupStartCallbackStruct pimls) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 118 of file ICState.cpp.

{
    return invalid_operation("lookup_start");
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool ICState::mark_terminal ( ) [inline, protected, inherited]

Definition at line 140 of file ICState.hh.

    { 
       pshared->terminating = true;
       return true;
    }

Here is the caller graph for this function:

bool IIIMP_ICState::message_proc ( void *  message) [virtual]

Implements ICState.

Reimplemented in IIIMP_ICState_WAITING, and IIIMP_ICState_REQUESTED.

Definition at line 23 of file IIIMP_ICState.cpp.

{
    IIIMP_message *pmes = (IIIMP_message*) x_pmes;

    switch (pmes->opcode) {
      case IM_TRIGGER_NOTIFY:
      {
         bool flag = (pmes->v.trigger_notify.flag == 0) ? true : false;
          if (ihk->get_lang_selection())
              ihk->set_lang_selection(false);
         return start_request()->toggle_server_convmode(flag);
      }
      case IM_HOTKEY_NOTIFY:
      {
          int hotkey_id = pmes->v.hotkey_notify.hotkey_id;
          int ikev = pmes->v.hotkey_notify.index;
          ihk->set_hotkey_mode(true);
          return ihk->process_hotkey(this, hotkey_id, ikev);
      }
      case IM_LOOKUP_CHOICE_START_REPLY:
      {
          int keycode = 0;
          return ihk->draw_lang_selection_window(this, keycode);
      }
      case IM_LOOKUP_CHOICE_DRAW_REPLY:
      {
          if (ihk->get_hotkey_mode())
              return ihk->send_hotkey_reply(this);
          return true;
      }
      case IM_LOOKUP_CHOICE_DONE_REPLY:
      {
          if (ihk->get_hotkey_mode())
              return ihk->send_hotkey_reply(this);
          return true;
      }
      case IM_SETICVALUES:
       return start_request()->set_values(pmes);
      case IM_SETICFOCUS:
      {
         return start_request()->toggle_icfocus(true);
      }
      case IM_UNSETICFOCUS:
       return start_request()->toggle_icfocus(false);
      case IM_RESETIC:
       return start_request()->reset();
      case IM_AUX_SETVALUES:
       return start_request()->aux_setvalues(pmes);
      case IM_AUX_GETVALUES:
       return start_request()->aux_getvalues(pmes);
      case IM_FORWARD_EVENT:
      {
         if (ihk->get_lang_selection()) {
             ihk->set_forward_event(true);
             return ihk->process_lang_selection_window(this, pmes);
         } else
             return start_request()->forward_event(pmes);
      }
      case IM_FORWARD_EVENT_WITH_OPERATIONS:
       return start_request()->forward_event_with_operations(pmes);
      case IM_DESTROYIC:
       return start_request()->destroyic();

      default:
       LOG_ERROR("Invalid message(IC normal state):%d", pmes->opcode);
    }
    return true;
}

Here is the call graph for this function:

int ICState::ns_listener ( IMNSListenerStruct pons) [virtual, inherited]

Definition at line 172 of file ICState.cpp.

{
    return invalid_operation("ns_listener");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::preedit_done ( ) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 92 of file ICState.cpp.

{
    return invalid_operation("preedit_done");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::preedit_start ( ) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 78 of file ICState.cpp.

{
    return invalid_operation("preedit_start");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void ICState::reset_state ( ) [inline, protected, inherited]

Definition at line 147 of file ICState.hh.

    { 
       ICState *p = pbase_state;
       if (p->pproc_state) delete p->pproc_state;
       p->pproc_state = NULL;
       p->pshared->pimlex->set_icstate(p);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

bool IIIMP_ICState::send ( IIIMP_message pmes,
bool  deletep 
) [inline, protected]

Definition at line 39 of file IIIMP_ICState.hh.

    { return get_iiimp_imstate()->send(pmes, deletep); }

Here is the call graph for this function:

Here is the caller graph for this function:

bool ICState::send_avail_p ( ) [inline, inherited]

Definition at line 204 of file ICState.hh.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 13 of file IIIMP_ICState.cpp.

{
    IIIMP_ICState_REQUESTED *picsr = new IIIMP_ICState_REQUESTED(this);
    // TODO: throw memory error.
    change_state(*picsr, false);
    return picsr;
}

Here is the call graph for this function:

Here is the caller graph for this function:

virtual bool IIIMP_ICState::state_send_available_p ( ) [inline, private, virtual]

Implements ICState.

Reimplemented in IIIMP_ICState_WAITING, and IIIMP_ICState_REQUESTED.

Definition at line 22 of file IIIMP_ICState.hh.

    { return false; }
int ICState::status_done ( ) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 112 of file ICState.cpp.

{
    return invalid_operation("status_done");
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ICState::status_start ( ) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 98 of file ICState.cpp.

{
    return invalid_operation("status_start");
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool ICState::substatep ( ) const [inline, inherited]

Definition at line 219 of file ICState.hh.

    { return (pbase_state != this); }

Here is the caller graph for this function:

int ICState::toggle_client_convmode ( bool  flag) [virtual, inherited]

Reimplemented in IIIMP_ICState_REQUESTED.

Definition at line 54 of file ICState.cpp.

{
    return invalid_operation("toggle_client_convmode");
}

Here is the call graph for this function:

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class IIIMP_hotkey [friend]

Definition at line 92 of file IIIMP_ICState.hh.


Member Data Documentation

Definition at line 35 of file IIIMP_ICState.hh.

Definition at line 20 of file IIIMP_ICState.hh.

Definition at line 19 of file IIIMP_ICState.hh.

Reimplemented from ICState.

Definition at line 34 of file IIIMP_ICState.hh.


The documentation for this class was generated from the following files: