configparser.h - ledit - Text editor (WIP)
HTML git clone git://lumidify.org/ledit.git (fast, but not encrypted)
HTML git clone https://lumidify.org/ledit.git (encrypted, but very slow)
HTML git clone git://4kcetb7mo7hj6grozzybxtotsub5bempzo4lirzc3437amof2c2impyd.onion/ledit.git (over tor)
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
configparser.h (2328B)
---
1 #ifndef _CONFIGPARSER_H_
2 #define _CONFIGPARSER_H_
3
4 #include "common.h"
5 #include "uglycrap.h"
6 #include "keys_command.h"
7 #include "keys_basic.h"
8
9 typedef struct {
10 int scrollbar_width;
11 int scrollbar_step;
12 int text_size;
13 int highlight_search;
14 int extra_line_spacing;
15 XftColor text_fg;
16 XftColor text_bg;
17 XftColor cursor_fg;
18 XftColor cursor_bg;
19 XftColor selection_fg;
20 XftColor selection_bg;
21 XftColor bar_fg;
22 XftColor bar_bg;
23 XftColor bar_cursor;
24 XftColor scrollbar_fg;
25 XftColor scrollbar_bg;
26 const char *text_font;
27 const char *bar_fmt;
28 } ledit_theme;
29
30 typedef struct {
31 char *text; /* for keys that correspond with text */
32 unsigned int mods; /* modifier mask */
33 KeySym keysym; /* for other keys, e.g. arrow keys */
34 ledit_mode modes; /* modes in which this keybinding is functional */
35 basic_key_cb *cb; /* callback */
36 } basic_key_mapping;
37
38 typedef struct {
39 char *text; /* for keys that correspond with text */
40 unsigned int mods; /* modifier mask */
41 KeySym keysym; /* for other keys, e.g. arrow keys */
42 command_mode modes; /* substitute, etc. */
43 command_key_cb *cb; /* callback */
44 } command_key_mapping;
45
46 typedef struct {
47 char *text; /* text typed to call command */
48 command_cb *cb; /* callback */
49 } command_mapping;
50
51 typedef struct {
52 basic_key_mapping *keys;
53 size_t num_keys;
54 size_t alloc_keys;
55 } basic_key_array;
56
57 typedef struct {
58 command_key_mapping *keys;
59 size_t num_keys;
60 size_t alloc_keys;
61 } command_key_array;
62
63 typedef struct {
64 command_mapping *cmds;
65 size_t num_cmds;
66 size_t alloc_cmds;
67 } command_array;
68
69 /* Note: The config is initialized immediately when ledit starts, so these
70 * should not return NULL (unless an invalid language index is given), but
71 * it's still better to check just in case. */
72
73 /* Note: The returned pointers are invalidated if the config is reloaded. */
74
75 ledit_theme *config_get_theme(void);
76 basic_key_array *config_get_basic_keys(size_t lang_index);
77 command_key_array *config_get_command_keys(size_t lang_index);
78 command_array *config_get_commands(size_t lang_index);
79 int config_get_language_index(char *lang, size_t *idx_ret);
80 int config_loadfile(ledit_common *common, char *filename, char **errstr);
81 void config_cleanup(ledit_common *common);
82 char *config_get_language_string(size_t lang_index);
83
84 #endif