1 /*
2  *  This program is free software; you can redistribute it and/or modify
3  *  it under the terms of the GNU General Public License as published by
4  *  the Free Software Foundation; either version 2 of the License, or
5  *  (at your option) any later version.
6  *
7  *  This program is distributed in the hope that it will be useful,
8  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  *  GNU General Public License for more details.
11  *
12  *  You should have received a copy of the GNU General Public License
13  *  along with this program; if not, write to the Free Software
14  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
15  *
16  *  Copyright (C) 2006-2016 XNeur Team
17  *
18  */
19 
20 #ifndef _PROGRAM_H_
21 #define _PROGRAM_H_
22 
23 #include "detection.h"
24 
25 struct _program
26 {
27 	struct _switchlang *switchlang;
28 	struct _selection *selection;
29 	struct _event *event;
30 	struct _focus *focus;
31 	struct _buffer *buffer;
32 	struct _plugin *plugin;
33 
34 	int  last_action;
35 	int  changed_manual;
36 	int  app_forced_mode;
37 	int  app_focus_mode;
38 	int  app_autocompletion_mode;
39 
40 	int  action_mode;
41 
42 	int  last_layout;
43 	Window  last_window;
44 
45 	int user_action;
46 	enum _hotkey_action action;
47 
48 	enum _correction_action correction_action;
49 	struct _buffer *correction_buffer;
50 
51 	int last_pattern_id;
52 
53 	void (*layout_update) (struct _program *p);
54 	void (*update) (struct _program *p);
55 	void (*on_key_action) (struct _program *p, int type, KeySym key, int modifier);
56 	void (*process_input) (struct _program *p);
57 	int  (*perform_action) (struct _program *p, enum _hotkey_action action);
58 	void (*perform_auto_action) (struct _program *p, int action);
59 	void (*perform_user_action) (struct _program *p, int action);
60 	int  (*check_lang_last_word) (struct _program *p);
61 	int  (*check_lang_last_syllable) (struct _program *p);
62 	void (*check_caps_last_word) (struct _program *p);
63 	void (*check_tcl_last_word) (struct _program *p);
64 	void (*check_space_before_punctuation) (struct _program *p);
65 	void (*check_space_with_bracket) (struct _program *p);
66 	void (*check_brackets_with_symbols) (struct _program *p);
67 	void (*check_capital_letter_after_dot) (struct _program *p);
68 	void (*check_two_space) (struct _program *p);
69 	void (*check_two_minus) (struct _program *p);
70 	void (*check_copyright) (struct _program *p);
71 	void (*check_trademark) (struct _program *p);
72 	void (*check_registered) (struct _program *p);
73 	void (*check_ellipsis) (struct _program *p);
74 	void (*check_pattern) (struct _program *p);
75 	void (*rotate_pattern) (struct _program *p);
76 	void (*change_word) (struct _program *p, enum _change_action action);
77 	void (*add_word_to_dict) (struct _program *p, int new_lang);
78 	void (*add_word_to_pattern) (struct _program *p, int new_lang);
79 	void (*process_selection_notify) (struct _program *p);
80 	void (*change_lang) (struct _program *p, int new_lang);
81 	void (*change_incidental_caps) (struct _program *p);
82 	void (*unchange_incidental_caps) (struct _program *p);
83 	void (*change_two_capital_letter) (struct _program *p);
84 	void (*unchange_two_capital_letter) (struct _program *p);
85 	void (*check_misprint) (struct _program *p);
86 	void (*send_string_silent) (struct _program *p, int send_backspaces);
87 	void (*plugin_process) ();
88 	void (*uninit) (struct _program *p);
89 };
90 
91 struct _program* program_init(void);
92 
93 #endif /* _PROGRAM_H_ */
94