}
}
+ group { name: "soft_candidate";
+ images {
+ image: BUTTON_NORMAL_BG COMP;
+ image: BUTTON_PRESS_BG COMP;
+ }
+
+ parts {
+ part { name: "bg";
+ type: RECT;
+ mouse_events: 1;
+ description { state: "default" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 1.0 1.0;
+ color_class: "rect_color";
+ }
+ description { state: "pressed" 0.0;
+ rel1.relative: 0.0 0.0;
+ rel2.relative: 1.0 1.0;
+ color: COLOR_PRESS_BUTTON;
+ }
+ }
+
+ part { name: "candidate";
+ type: TEXT;
+ mouse_events: 0;
+ //effect: SHADOW;
+ description { state: "default" 0.0;
+ color: COLOR_NORMAL_TEXT;
+ color_class: "text_color";
+ text {
+ text_class: "candidate_text_class";
+ text: "Test";
+ font: FONT_NAME;
+ size: FONT_SIZE;
+ align: 0.5 0.5;
+ }
+ rel1.to: "bg";
+ rel1.relative: 0.0 0.0;
+ rel1.offset: 11 0;
+ rel2.to: "bg";
+ rel2.relative: 1.0 1.0;
+ rel2.offset: -11 0;
+ }
+ description { state: "pressed" 0.0;
+ inherit: "default" 0.0;
+ color: COLOR_PRESS_TEXT;
+ }
+ }
+ }
+ programs {
+ program { name: "button_click";
+ signal: "mouse,clicked,1";
+ source: "bg";
+ action: SIGNAL_EMIT "candidate,action,clicked" "";
+ }
+
+ program { name, "button_press";
+ signal, "mouse,down,1";
+ source, "bg";
+ action, STATE_SET "pressed" 0.0;
+ target, "bg";
+ target, "candidate";
+ }
+
+ program { name, "button_release";
+ signal, "mouse,up,1";
+ source, "bg";
+ action, STATE_SET "default" 0.0;
+ target, "bg";
+ target, "candidate";
+ //after, "do_me";
+ }
+
+ program { name, "do_me";
+ //signal, "*";
+ //source, "button_release";
+ action, SIGNAL_EMIT "candidate,action,clicked" "";
+ }
+ }
+ }
+
group { name: "more_button";
images {
static void slot_update_preedit_caret (int caret);
static void slot_update_aux_string (const String &str, const AttributeList &attrs);
static void slot_update_candidate_table (const LookupTable &table);
+static void slot_select_candidate (int index);
static void slot_set_active_ise (const String &uuid, bool changeDefault);
static bool slot_get_ise_list (std::vector<String> &list);
static bool slot_get_ise_information (String uuid, String &name, String &language, int &type, int &option);
_panel_agent->signal_connect_update_preedit_caret (slot (slot_update_preedit_caret));
_panel_agent->signal_connect_update_aux_string (slot (slot_update_aux_string));
_panel_agent->signal_connect_update_lookup_table (slot (slot_update_candidate_table));
+ _panel_agent->signal_connect_select_candidate (slot (slot_select_candidate));
_panel_agent->signal_connect_get_candidate_geometry (slot (slot_get_candidate_geometry));
_panel_agent->signal_connect_get_input_panel_geometry (slot (slot_get_input_panel_geometry));
_panel_agent->signal_connect_set_active_ise_by_uuid (slot (slot_set_active_ise));
static void slot_expand_candidate (void)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
+ if (_candidate_mode == SOFT_CANDIDATE_WINDOW)
+ return;
if (_candidate_area_2 && !evas_object_visible_get (_candidate_area_2))
ui_candidate_window_more_button_cb (NULL, NULL, NULL, NULL);
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
+ if (_candidate_mode == SOFT_CANDIDATE_WINDOW)
+ return;
+
ui_candidate_window_close_button_cb (NULL, NULL, NULL, NULL);
}
if ((portrait_line != _candidate_port_line) || (mode != _candidate_mode)) {
_candidate_mode = (ISF_CANDIDATE_MODE_T)mode;
_candidate_port_line = (ISF_CANDIDATE_PORTRAIT_LINE_T)portrait_line;
+
+ if (_candidate_mode == SOFT_CANDIDATE_WINDOW) {
+ if (_candidate_window)
+ ui_destroy_candidate_window ();
+
+ return;
+ }
+
if (_candidate_window)
ui_create_candidate_window ();
}
*/
static void slot_show_candidate_table (void)
{
- SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
int feedback_result = 0;
+ if (_candidate_mode == SOFT_CANDIDATE_WINDOW) {
+ _panel_agent->helper_candidate_show ();
+ return;
+ }
+
+ SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
if (_candidate_window == NULL)
ui_create_candidate_window ();
int feedback_result = 0;
+ if (_candidate_mode == SOFT_CANDIDATE_WINDOW) {
+ _panel_agent->helper_candidate_hide ();
+ return;
+ }
+
if (!_candidate_area_1)
return;
static void slot_update_candidate_table (const LookupTable &table)
{
SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
+
+ if (_candidate_mode == SOFT_CANDIDATE_WINDOW){
+ _panel_agent->update_helper_lookup_table (table);
+ return ;
+ }
+
if (_candidate_window == NULL)
ui_create_candidate_window ();
}
/**
+ * @brief Send selected candidate index.
+ *
+ * @param selected candidate string index number.
+ */
+static void slot_select_candidate (int index)
+{
+ SCIM_DEBUG_MAIN (3) << __FUNCTION__ << "...\n";
+ _panel_agent->select_candidate (index);
+}
+
+/**
* @brief Get candidate geometry slot function for PanelAgent.
*
* @param info The data is used to store candidate position and size.
int y = 0;
int width = 0;
int height = 0;
+
+ if (_candidate_mode == SOFT_CANDIDATE_WINDOW) {
+ info.pos_x = x;
+ info.pos_y = y;
+ info.width = width;
+ info.height = height;
+ return;
+ }
+
if (!_candidate_will_hide) {
if (_candidate_window && evas_object_visible_get (_candidate_window)) {
/* Get candidate window position */
#include "scim_private.h"
#include "scim.h"
+EAPI scim::CommonLookupTable g_helper_candidate_table;
+
namespace scim {
typedef Signal3<void, const HelperAgent *, int, const String &>
typedef Signal2<void, const HelperAgent *, const std::vector<uint32> &>
HelperAgentSignalUintVector;
+typedef Signal2<void, const HelperAgent *, LookupTable &>
+ HelperAgentSignalLookupTable;
+
class HelperAgent::HelperAgentImpl
{
public:
HelperAgentSignalVoid signal_focus_in;
HelperAgentSignalIntRawVoid signal_ise_show;
HelperAgentSignalVoid signal_ise_hide;
+ HelperAgentSignalVoid signal_candidate_show;
+ HelperAgentSignalVoid signal_candidate_hide;
HelperAgentSignalSize signal_get_geometry;
HelperAgentSignalUintVoid signal_set_mode;
HelperAgentSignalUintVoid signal_set_language;
HelperAgentSignalStringVector signal_update_keyboard_ise_list;
HelperAgentSignalVoid signal_candidate_more_window_show;
HelperAgentSignalVoid signal_candidate_more_window_hide;
+ HelperAgentSignalLookupTable signal_update_lookup_table;
HelperAgentSignalInt signal_select_aux;
HelperAgentSignalInt signal_select_candidate;
HelperAgentSignalVoid signal_candidate_table_page_up;
m_impl->signal_update_candidate_table_page_size (this, ic, ic_uuid, size);
break;
}
+ case ISM_TRANS_CMD_CANDIDATE_SHOW:
+ {
+ m_impl->signal_candidate_show (this, ic, ic_uuid);
+ break;
+ }
+ case ISM_TRANS_CMD_CANDIDATE_HIDE:
+ {
+ m_impl->signal_candidate_hide (this, ic, ic_uuid);
+ break;
+ }
+ case ISM_TRANS_CMD_UPDATE_LOOKUP_TABLE:
+ {
+ if (m_impl->recv.get_data (g_helper_candidate_table))
+ m_impl->signal_update_lookup_table (this, g_helper_candidate_table);
+ break;
+ }
case ISM_TRANS_CMD_UPDATE_CANDIDATE_ITEM_LAYOUT:
{
std::vector<uint32> row_items;
}
/**
+ * @brief Send selected candidate string index number.
+ */
+void
+HelperAgent::select_candidate (int index) const
+{
+ if (m_impl->socket_active.is_connected ()) {
+ m_impl->send.clear ();
+ m_impl->send.put_command (SCIM_TRANS_CMD_REQUEST);
+ m_impl->send.put_data (m_impl->magic_active);
+ m_impl->send.put_command (ISM_TRANS_CMD_SELECT_CANDIDATE);
+ m_impl->send.put_data (index);
+ m_impl->send.write_to_socket (m_impl->socket_active, m_impl->magic_active);
+ }
+}
+
+/**
* @brief Update our ISE is exiting.
*/
void
}
/**
+ * @brief Connect a slot to Helper candidate show signal.
+ *
+ * This signal is used to do candidate show.
+ *
+ * The prototype of the slot is:
+ * void candidate_show (const HelperAgent *agent, int ic, const String &uuid);
+ */
+Connection
+HelperAgent::signal_connect_candidate_show (HelperAgentSlotVoid *slot)
+{
+ return m_impl->signal_candidate_show.connect (slot);
+}
+
+/**
+ * @brief Connect a slot to Helper candidate hide signal.
+ *
+ * This signal is used to do candidate hide.
+ *
+ * The prototype of the slot is:
+ * void candidate_hide (const HelperAgent *agent, int ic, const String &uuid);
+ */
+Connection
+HelperAgent::signal_connect_candidate_hide (HelperAgentSlotVoid *slot)
+{
+ return m_impl->signal_candidate_hide.connect (slot);
+}
+
+/**
+ * @brief Connect a slot to Helper update lookup table signal.
+ *
+ * This signal is used to do someting when update lookup table.
+ *
+ * The prototype of the slot is:
+ * void update_lookup_table (const HelperAgent *agent, int ic, const String &uuid ,LookupTable &table);
+ */
+Connection
+HelperAgent::signal_connect_update_lookup_table (HelperAgentSlotLookupTable *slot)
+{
+ return m_impl->signal_update_lookup_table.connect (slot);
+}
+
+/**
* @brief Connect a slot to Helper select aux signal.
*
* This signal is used to do something when aux is selected.
typedef Slot2<void, const HelperAgent *, const std::vector<uint32> &>
HelperAgentSlotUintVector;
+typedef Slot2<void, const HelperAgent *, LookupTable &>
+ HelperAgentSlotLookupTable;
+
/**
* @brief The accessory class to write a Helper object.
*
void contract_candidate (void) const;
/**
+ * @brief Send selected candidate string index number.
+ */
+ void select_candidate (int index) const;
+
+ /**
* @brief Update ise exit status
*/
void update_ise_exit (void) const;
Connection signal_connect_candidate_more_window_hide (HelperAgentSlotVoid *slot);
/**
+ * @brief Connect a slot to Helper candidate show signal.
+ *
+ * This signal is used to do candidate show.
+ *
+ * The prototype of the slot is:
+ * void candidate_show (const HelperAgent *agent, int ic, const String &uuid);
+ */
+ Connection signal_connect_candidate_show (HelperAgentSlotVoid *slot);
+
+ /**
+ * @brief Connect a slot to Helper candidate hide signal.
+ *
+ * This signal is used to do candidate hide.
+ *
+ * The prototype of the slot is:
+ * void candidate_hide (const HelperAgent *agent,int ic, const String &uuid);
+ */
+ Connection signal_connect_candidate_hide (HelperAgentSlotVoid *slot);
+
+ /**
+ * @brief Connect a slot to Helper update lookup table signal.
+ *
+ * This signal is used to do someting when update lookup table.
+ *
+ * The prototype of the slot is:
+ * void update_lookup_table (const HelperAgent *agent, int ic, const String &uuid, LookupTable &Table);
+ */
+ Connection signal_connect_update_lookup_table (HelperAgentSlotLookupTable *slot);
+
+ /**
* @brief Connect a slot to Helper select aux signal.
*
* This signal is used to do something when aux is selected.
PanelAgentSignalVoid m_signal_focus_out;
PanelAgentSignalVoid m_signal_expand_candidate;
PanelAgentSignalVoid m_signal_contract_candidate;
+ PanelAgentSignalInt m_signal_select_candidate;
PanelAgentSignalBoolStringVector m_signal_get_ise_list;
PanelAgentSignalBoolString3int2 m_signal_get_ise_information;
PanelAgentSignalBoolStringVector m_signal_get_keyboard_ise_list;
return client >= 0;
}
+ bool helper_candidate_show (void)
+ {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
+
+ int client;
+ uint32 context;
+
+ get_focused_context (client, context);
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ Socket client_socket (it->second.id);
+ uint32 ctx = get_helper_ic (client, context);
+
+ m_send_trans.clear ();
+ m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data (ctx);
+ m_send_trans.put_data (m_current_helper_uuid);
+ m_send_trans.put_command (ISM_TRANS_CMD_CANDIDATE_SHOW);
+ m_send_trans.write_to_socket (client_socket);
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ bool helper_candidate_hide (void)
+ {
+ SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
+
+ int client;
+ uint32 context;
+
+ get_focused_context (client, context);
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ Socket client_socket (it->second.id);
+ uint32 ctx = get_helper_ic (client, context);
+
+ m_send_trans.clear ();
+ m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data (ctx);
+ m_send_trans.put_data (m_current_helper_uuid);
+ m_send_trans.put_command (ISM_TRANS_CMD_CANDIDATE_HIDE);
+ m_send_trans.write_to_socket (client_socket);
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
bool candidate_more_window_show (void)
{
SCIM_DEBUG_MAIN(4) << __FUNCTION__ << "...\n";
return false;
}
+ bool update_helper_lookup_table (const LookupTable &table)
+ {
+ int client;
+ uint32 context;
+
+ if (TOOLBAR_HELPER_MODE == m_current_toolbar_mode) {
+ HelperClientIndex::iterator it = m_helper_client_index.find (m_current_helper_uuid);
+
+ if (it != m_helper_client_index.end ()) {
+ Socket client_socket (it->second.id);
+ uint32 ctx;
+
+ get_focused_context (client, context);
+ ctx = get_helper_ic (client, context);
+
+ m_send_trans.clear ();
+ m_send_trans.put_command (SCIM_TRANS_CMD_REPLY);
+ m_send_trans.put_data (ctx);
+ m_send_trans.put_data (m_current_helper_uuid);
+ m_send_trans.put_command (ISM_TRANS_CMD_UPDATE_LOOKUP_TABLE);
+ m_send_trans.put_data (table);
+ m_send_trans.write_to_socket (client_socket);
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
bool select_aux (uint32 item)
{
SCIM_DEBUG_MAIN(1) << "PanelAgent::select_aux (" << item << ")\n";
return m_signal_contract_candidate.connect (slot);
}
+ Connection signal_connect_select_candidate (PanelAgentSlotInt *slot)
+ {
+ return m_signal_select_candidate.connect (slot);
+ }
+
Connection signal_connect_get_ise_list (PanelAgentSlotBoolStringVector *slot)
{
return m_signal_get_ise_list.connect (slot);
socket_helper_expand_candidate (client_id);
} else if (cmd == ISM_TRANS_CMD_CONTRACT_CANDIDATE) {
socket_helper_contract_candidate (client_id);
+ } else if (cmd == ISM_TRANS_CMD_SELECT_CANDIDATE) {
+ socket_helper_select_candidate ();
} else if (cmd == SCIM_TRANS_CMD_GET_SURROUNDING_TEXT) {
socket_helper_get_surrounding_text (client_id);
} else if (cmd == SCIM_TRANS_CMD_DELETE_SURROUNDING_TEXT) {
m_signal_set_keyboard_ise (uuid);
}
+ void socket_helper_select_candidate (void)
+ {
+ SCIM_DEBUG_MAIN(4) << "PanelAgent::socket_set_keyboard_ise ()\n";
+
+ uint32 index;
+ if (m_recv_trans.get_data (index))
+ m_signal_select_candidate (index);
+ }
+
void socket_helper_update_ise_geometry (int client)
{
SCIM_DEBUG_MAIN(4) << __func__ << "\n";
}
bool
+PanelAgent::helper_candidate_show (void)
+{
+ return m_impl->helper_candidate_show ();
+}
+
+bool
+PanelAgent::helper_candidate_hide (void)
+{
+ return m_impl->helper_candidate_hide ();
+}
+
+bool
PanelAgent::candidate_more_window_show (void)
{
return m_impl->candidate_more_window_show ();
}
bool
+PanelAgent::update_helper_lookup_table (const LookupTable &table)
+{
+ return m_impl->update_helper_lookup_table (table);
+}
+
+bool
PanelAgent::select_aux (uint32 item)
{
return m_impl->select_aux (item);
}
Connection
+PanelAgent::signal_connect_select_candidate (PanelAgentSlotInt *slot)
+{
+ return m_impl->signal_connect_select_candidate (slot);
+}
+
+Connection
PanelAgent::signal_connect_get_ise_list (PanelAgentSlotBoolStringVector *slot)
{
return m_impl->signal_connect_get_ise_list (slot);
bool candidate_more_window_hide (void);
/**
+ * @brief Notice Helper ISE that show candidate.
+ * @return true if the command was sent correctly.
+ */
+ bool helper_candidate_show (void);
+
+ /**
+ * @brief Notice Helper ISE that hide candidate.
+ * @return true if the command was sent correctly.
+ */
+ bool helper_candidate_hide (void);
+
+ /**
+ * @brief Update helper lookup table.
+ * @return true if the command was sent correctly.
+ */
+ bool update_helper_lookup_table (const LookupTable &table);
+
+ /**
* @brief Let the focused IMEngineInstance object
* select a aux in current aux string.
*
Connection signal_connect_contract_candidate (PanelAgentSlotVoid *slot);
/**
+ * @brief Signal: Select candidate string index.
+ *
+ * slot prototype: void select_candidate (int index);
+ */
+ Connection signal_connect_select_candidate (PanelAgentSlotInt *slot);
+
+ /**
* @brief Signal: Get the list of ise name.
*
* slot prototype: bool get_ise_list (std::vector<String> &);
const int ISM_TRANS_CMD_EXPAND_CANDIDATE = 1214;
const int ISM_TRANS_CMD_CONTRACT_CANDIDATE = 1215;
const int ISM_TRANS_CMD_UPDATE_ISE_EXIT = 1216;
+const int ISM_TRANS_CMD_SELECT_CANDIDATE = 1217;
/* Panel to ISE */
const int ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_SHOW = 1251;
const int ISM_TRANS_CMD_CANDIDATE_MORE_WINDOW_HIDE = 1252;
const int ISM_TRANS_CMD_UPDATE_DISPLAYED_CANDIDATE = 1253;
const int ISM_TRANS_CMD_LONGPRESS_CANDIDATE = 1254;
+const int ISM_TRANS_CMD_UPDATE_LOOKUP_TABLE = 1255;
+const int ISM_TRANS_CMD_CANDIDATE_SHOW = 1256;
+const int ISM_TRANS_CMD_CANDIDATE_HIDE = 1257;
const int ISM_TRANS_CMD_TURN_ON_LOG = 1301;
{
FIXED_CANDIDATE_WINDOW = 0,
FLOATING_CANDIDATE_WINDOW,
+ SOFT_CANDIDATE_WINDOW
} ISF_CANDIDATE_MODE_T;
typedef enum