1 /* Copyright © 2007-2016 Evgeny Ratnikov
2  *
3  * This program is free software: you can redistribute it and/or modify
4  * it under the terms of the GNU General Public License as published by
5  * the Free Software Foundation, either version 3 of the License, or
6  * (at your option) any later version.
7  *
8  * This program 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
11  * GNU General Public License for more details.
12  *
13  * You should have received a copy of the GNU General Public License
14  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
15  */
16 
17 #ifndef TERMIT_CONFIGS_H
18 #define TERMIT_CONFIGS_H
19 
20 #include <gtk/gtk.h>
21 #include <gdk/gdk.h>
22 
23 #include "termit_style.h"
24 
25 enum TermitKbPolicy {TermitKbUseKeycode = 1, TermitKbUseKeysym = 2};
26 
27 struct Configs
28 {
29     gchar* default_window_title;
30     gchar* default_tab_name;
31     gchar* default_command;
32     gchar* default_encoding;
33     gchar* default_word_char_exceptions;
34     guint scrollback_lines;
35     guint cols;
36     guint rows;
37     VteEraseBinding default_bksp;
38     VteEraseBinding default_delete;
39     VteCursorBlinkMode default_blink;
40     VteCursorShape default_shape;
41     GArray* user_menus;         // UserMenu
42     GArray* user_popup_menus;   // UserMenu
43     GArray* key_bindings;       // KeyBinding
44     GArray* mouse_bindings;     // MouseBinding
45     GArray* matches;            // Match
46     gboolean start_maximized;
47     gboolean hide_titlebar_when_maximized;
48     gboolean hide_single_tab;
49     gboolean show_scrollbar;
50     gboolean hide_menubar;
51     gboolean hide_tabbar;
52     gboolean fill_tabbar;
53     gboolean show_border;
54     gboolean urgency_on_bell;
55     gboolean allow_changing_title;
56     gboolean audible_bell;
57     gboolean scroll_on_output;
58     gboolean scroll_on_keystroke;
59     int get_window_title_callback;
60     int get_tab_title_callback;
61     int get_statusbar_callback;
62     enum TermitKbPolicy kb_policy;
63     GtkPositionType tab_pos;
64     struct TermitStyle style;
65     GArray* default_tabs;       // TabInfo
66 };
67 
68 struct Match
69 {
70     gchar* pattern;
71     VteRegex* regex;
72     guint32 flags;
73     int tag;
74     int lua_callback;
75 };
76 struct UserMenuItem
77 {
78     gchar* name;
79     gchar* accel;
80     int lua_callback;
81 };
82 struct UserMenu
83 {
84     gchar* name;
85     GArray* items; // UserMenuItem
86 };
87 
88 extern struct Configs configs;
89 
90 void termit_config_deinit();
91 void termit_configs_set_defaults();
92 void termit_config_load();
93 
94 void termit_config_trace();
95 void termit_keys_trace();
96 
97 const char* termit_erase_binding_to_string(VteEraseBinding val);
98 VteEraseBinding termit_erase_binding_from_string(const char* str);
99 
100 const char* termit_cursor_blink_mode_to_string(VteCursorBlinkMode val);
101 VteCursorBlinkMode termit_cursor_blink_mode_from_string(const char* str);
102 
103 const char* termit_cursor_shape_to_string(VteCursorShape val);
104 VteCursorShape termit_cursor_shape_from_string(const char* str);
105 
106 #define TERMIT_USER_MENU_ITEM_DATA "termit.umi_data"
107 #define TERMIT_TAB_DATA "termit.tab_data"
108 
109 #endif /* TERMIT_CONFIGS_H */
110