~ubuntu-branches/ubuntu/precise/hime/precise

« back to all changes in this revision

Viewing changes to src/modules/chewing.h

  • Committer: Package Import Robot
  • Author(s): Yao Wei (魏銘廷)
  • Date: 2012-01-14 00:24:08 UTC
  • Revision ID: package-import@ubuntu.com-20120114002408-e79gagbeg1rt8npv
Tags: upstream-0.9.9
Import upstream version 0.9.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 2011 cwlin <https://github.com/cwlin>
 
2
 *
 
3
 * This library is free software; you can redistribute it and/or
 
4
 * modify it under the terms of the GNU Lesser General Public
 
5
 * License as published by the Free Software Foundation; either
 
6
 * version 2.1 of the License, or (at your option) any later version.
 
7
 *
 
8
 * This library is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
11
 * Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public
 
14
 * License along with this library; if not, write to the Free Software
 
15
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
16
 */
 
17
 
 
18
#ifndef CHEWING_H
 
19
#define CHEWING_H
 
20
 
 
21
#include <chewing/chewing.h>
 
22
#include <sys/stat.h>
 
23
#include <fcntl.h>
 
24
#include <stdint.h>
 
25
 
 
26
#include "hime.h"
 
27
#include "pho.h"
 
28
#include "gst.h"
 
29
#include "im-client/hime-im-client-attr.h"
 
30
#include "hime-module.h"
 
31
#include "hime-module-cb.h"
 
32
#include "hime-conf.h"
 
33
 
 
34
#define MAX_SEG_NUM  128
 
35
#define HIME_CHEWING_CONFIG "/.config/hime/config/chewing_conf.dat"
 
36
#define HIME_KB_CONFIG "/.config/hime/config/phonetic-keyboard2"
 
37
 
 
38
#define HIME_CHEWING_DEFAULT_SELECT_KEYS { '1', '2', '3', '4', \
 
39
                                           '5', '6', '7', '8', \
 
40
                                           '9', '0' }
 
41
 
 
42
#define HIME_CHEWING_DEFAULT_KEY_MIN (XK_space)
 
43
#define HIME_CHEWING_DEFAULT_KEY_MAX (XK_asciitilde + 1)
 
44
#define HIME_CHEWING_KEY_MAX         (XK_Delete + 1)
 
45
 
 
46
#define HIME_CHEWING_WRAPPER_FUNC(FUNC_NAME) return (chewing_buffer_Len (g_pChewingCtx) \
 
47
                                             == 0 ? (-1) : FUNC_NAME(g_pChewingCtx));
 
48
 
 
49
typedef struct _SEGMENT 
 
50
{
 
51
    GtkWidget *label;
 
52
    unsigned char selidx, selN;
 
53
} SEG;
 
54
 
 
55
typedef struct KB_MAPPING
 
56
{
 
57
    char *pszHimeKbName;
 
58
    char *pszChewingKbName;
 
59
} kbmapping_t;
 
60
 
 
61
// hime module callbacks
 
62
int module_init_win (HIME_module_main_functions *pFuncs);
 
63
void module_get_win_geom (void);
 
64
int module_reset (void);
 
65
int module_get_preedit (char *pszStr, HIME_PREEDIT_ATTR attr[],
 
66
                        int *pnCursor, int *pCompFlag);
 
67
gboolean module_feedkey (int nKeyVal, int nKeyState);
 
68
int module_feedkey_release (KeySym xkey, int nKbState);
 
69
void module_move_win(int x, int y);
 
70
void module_change_font_size (void);
 
71
void module_show_win (void);
 
72
void module_hide_win (void);
 
73
int module_win_visible (void);
 
74
int module_flush_input (void);
 
75
 
 
76
// config funcs
 
77
void chewing_config_open (gboolean bWrite);
 
78
void chewing_config_load (ChewingConfigData *pChewingConfig);
 
79
void chewing_config_set (ChewingContext *pChewingContext);
 
80
void chewing_config_dump (void);
 
81
void chewing_config_close (void);
 
82
gboolean chewing_config_save (int nVal[]);
 
83
 
 
84
#endif