version 1.3.0
[vimprobable/e.git] / vimprobable.h
blob16bd93792a8828a391119a90b9bc2e41ed2bf719
1 /*
2 (c) 2009 by Leon Winter
3 (c) 2009-2012 by Hannes Schueller
4 (c) 2009-2010 by Matto Fransen
5 (c) 2010-2011 by Hans-Peter Deifel
6 (c) 2010-2011 by Thomas Adam
7 see LICENSE file
8 */
10 /* macros */
11 #define LENGTH(x) (sizeof(x)/sizeof(x[0]))
13 /* enums */
14 enum { ModeNormal, ModePassThrough, ModeSendKey, ModeInsert, ModeHints }; /* modes */
15 enum { TargetCurrent, TargetNew }; /* target */
16 /* bitmask,
17 1 << 0: 0 = jumpTo, 1 = scroll
18 1 << 1: 0 = top/down, 1 = left/right
19 1 << 2: 0 = top/left, 1 = bottom/right
20 1 << 3: 0 = paging/halfpage, 1 = line
21 1 << 4: 0 = paging, 1 = halfpage aka buffer
23 enum { ScrollJumpTo, ScrollMove };
24 enum { OrientationVert, OrientationHoriz = (1 << 1) };
25 enum { DirectionTop,
26 DirectionBottom = (1 << 2),
27 DirectionLeft = OrientationHoriz,
28 DirectionRight = OrientationHoriz | (1 << 2)
30 enum { UnitPage,
31 UnitLine = (1 << 3),
32 UnitBuffer = (1 << 4)
34 /* bitmask:
35 1 << 0: 0 = Reload/Cancel 1 = Forward/Back
36 Forward/Back:
37 1 << 1: 0 = Forward 1 = Back
38 Reload/Cancel:
39 1 << 1: 0 = Cancel 1 = Force/Normal Reload
40 1 << 2: 0 = Force Reload 1 = Reload
42 enum { NavigationForwardBack = 1, NavigationReloadActions = (1 << 1) };
43 enum { NavigationCancel,
44 NavigationBack = (NavigationForwardBack | 1 << 1),
45 NavigationForward = (NavigationForwardBack),
46 NavigationReload = (NavigationReloadActions | 1 << 2),
47 NavigationForceReload = NavigationReloadActions
49 /* bitmask:
50 1 << 1: ClipboardPrimary (X11)
51 1 << 2: ClipboardGTK
52 1 << 3: SourceURL
53 1 << 4: SourceSelection
55 enum { ClipboardPrimary = 1 << 1, ClipboardGTK = 1 << 2 };
56 enum { SourceSelection = 1 << 4, SourceURL = 1 << 3 };
57 /* bitmask:
58 1 << 0: 0 = ZoomReset 1 = ZoomIn/Out
59 1 << 1: 0 = ZoomOut 1 = ZoomIn
60 1 << 2: 0 = TextZoom 1 = FullContentZoom
62 enum { ZoomReset,
63 ZoomOut,
64 ZoomIn = ZoomOut | (1 << 1)
66 enum { ZoomText, ZoomFullContent = (1 << 2) };
67 /* bitmask:
68 0 = Info, 1 = Warning, 2 = Error
69 1 << 2: 0 = AutoHide 1 = NoAutoHide
70 relevant for script:
71 1 << 3: 1 = Silent (no echo)
73 typedef enum {
74 Info,
75 Warning,
76 Error,
77 NoAutoHide = 1 << 2,
78 Silent = 1 << 3
79 } MessageType;
80 enum { NthSubdir, Rootdir };
81 enum { InsertCurrentURL = 1 };
82 enum { Increment, Decrement };
83 /* bitmask:
84 1 << 0: 0 = DirectionNext 1 = DirectionPrev (Relative)
85 1 << 0: 0 = DirectionBackwards 1 = DirectionForward (Absolute)
87 1 << 1: 0 = DirectionRelative 1 = DirectionAbsolute
89 1 << 2: 0 = CaseInsensitive 1 = CaseSensitive
90 1 << 3: 0 = No Wrapping 1 = Wrapping
92 enum { DirectionRelative, DirectionAbsolute = 1 << 1 };
93 enum { DirectionNext, DirectionPrev, HideCompletion };
94 enum { DirectionBackwards = DirectionAbsolute, DirectionForward =
95 (1 << 0) | DirectionAbsolute };
96 enum { CaseInsensitive, CaseSensitive = 1 << 2 };
97 enum { Wrapping = 1 << 3 };
99 /* structs here */
100 typedef struct {
101 int i;
102 char *s;
103 } Arg;
105 typedef struct {
106 guint mask;
107 guint modkey;
108 guint key;
109 gboolean(*func) (const Arg * func);
110 Arg arg;
111 } Key;
113 typedef struct {
114 void *next;
115 Key Element;
116 } KeyList;
118 typedef struct {
119 guint mask;
120 guint modkey;
121 guint button;
122 gboolean(*func) (const Arg * arg);
123 const Arg arg;
124 } Mouse;
126 typedef struct {
127 char *name;
128 char (*var);
129 char *webkit;
130 gboolean intval;
131 gboolean boolval;
132 gboolean colourval;
133 gboolean reload;
134 } Setting;
136 typedef struct {
137 char *cmd;
138 gboolean(*func) (const Arg * arg);
139 const Arg arg;
140 } Command;
142 typedef struct {
143 char *handle;
144 char *uri;
145 } Searchengine;
147 typedef struct {
148 char *handle;
149 char *handler;
150 } URIHandler;
152 typedef struct {
153 char *alias;
154 char *target;
155 } Alias;
157 struct map_pair {
158 char *line;
159 char what[20];
160 char value[240];
161 } my_pair;
163 typedef struct {
164 void *next;
165 char element[255];
166 } Listelement;
168 enum ConfigFileError {
169 SUCCESS = 0,
170 FILE_NOT_FOUND = -1,
171 READING_FAILED = -2,
172 SYNTAX_ERROR = -3
175 /* constants */
176 #define MOUSE_BUTTON_1 1
177 #define MOUSE_BUTTON_2 2
178 #define MOUSE_BUTTON_3 3
179 #define MOUSE_BUTTON_4 4
180 #define MOUSE_BUTTON_5 5
181 #define BUFFERSIZE 255
182 #define MAXTAGSIZE 200
184 /* bookmarks */
185 #define BOOKMARKS_STORAGE_FILENAME "%s/vimprobable/bookmarks", client.config.config_base
187 /* quickmarks */
188 #define QUICKMARK_FILE "%s/vimprobable/quickmarks", client.config.config_base
190 /* history */
191 #define HISTORY_MAX_ENTRIES 1000
192 #define HISTORY_STORAGE_FILENAME "%s/vimprobable/history", client.config.config_base
193 #define CLOSED_URL_FILENAME "%s/vimprobable/closed", client.config.config_base
195 /* Command size */
196 #define COMMANDSIZE 47
198 /* maximum size of internal string variable handled by :set
199 * if you set this to anything lower than 8, colour values
200 * will stop working */
201 #define MAX_SETTING_SIZE 1024
203 /* completion list size */
204 #define MAX_LIST_SIZE 40
206 /* Size of (some) I/O buffers */
207 #define BUF_SIZE 1024