Open kanru opened 11 years ago
The issue https://github.com/chewing/windows-chewing-tsf/issues/12 is related to high-level API changed.
The following are purposed new APIs for external use:
// candidate windows
chewing_cand_open(ChewingContext *ctx);
chewing_cand_close(ChewingContext *ctx);
chewing_cand_choose_by_index(ChewingContext *ctx, int index);
chewing_cand_String_by_index(ChewingContext *ctx, int index); // Already implemented, but not yet in any official release.
chewing_cand_next_cand_list(ChewingContext *ctx); // Change to next candidate list. For example: 2 words candidate list to 1 word candidate list
// add userphrase in preedit buffer
chewing_userphrase_add_in_preedit_buf(ChewingContext *ctx, unsigned int start, unsigned int end);
chewing_commit_preedit_buf(ChewingContext *ctx);
chewing_clean_bopomofo_buf(ChewingContext *ctx);
See also #65, #71, #92
// candidate windows
int chewing_cand_is_open(ChewingContext *ctx);
int chewing_cand_open(ChewingContext *ctx);
itn chewing_cand_close(ChewingContext *ctx);
int chewing_cand_choose_by_index(ChewingContext *ctx, int index);
int chewing_cand_String_by_index(ChewingContext *ctx, int index); // Already implemented, but not yet in any official release.
// candidate list
int chewing_cand_has_next_cand_list(ChewingContext *ctx);
int chewing_cand_next_cand_list(ChewingContext *ctx);
int chewing_cand_prev_cand_list(ChewingContext *ctx);
// add userphrase in preedit buffer
int chewing_userphrase_add_from_preedit_buf(ChewingContext *ctx, unsigned int start, unsigned int end);
int chewing_commit_preedit_buf(ChewingContext *ctx);
int chewing_clean_preedit_buf(ChewingContext *ctx);
int chewing_clean_bopomofo_buf(ChewingContext *ctx);
Currently we call high-level API like chewing_handle_CtrlNum in other high-level APIs. This means if we change the high-level API implementation would also affect the other high-level user.
We should create mid-level API to operate on the internal state and dictionary data. These API will also be useful to external users.
Example: select_candidate, add_phrase (note these API are different with the low-level API which operates on data directly. The mid-level API operates on buffers and candidates.)