Used object instead of array to hold data for the hints.
[vimprobable/e.git] / vimprobable.h
blob711faf3865028ca7f63fce85c9779c3fd145dd5e
1 /*
2 (c) 2009 by Leon Winter
3 (c) 2009-2011 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: 0 = SourceSelection 1 = SourceURL
54 enum { ClipboardPrimary = 1 << 1, ClipboardGTK = 1 << 2 };
55 enum { SourceSelection, SourceURL = 1 << 3 };
56 /* bitmask:
57 1 << 0: 0 = ZoomReset 1 = ZoomIn/Out
58 1 << 1: 0 = ZoomOut 1 = ZoomIn
59 1 << 2: 0 = TextZoom 1 = FullContentZoom
61 enum { ZoomReset,
62 ZoomOut,
63 ZoomIn = ZoomOut | (1 << 1)
65 enum { ZoomText, ZoomFullContent = (1 << 2) };
66 /* bitmask:
67 0 = Info, 1 = Warning, 2 = Error
68 1 << 2: 0 = AutoHide 1 = NoAutoHide
69 relevant for script:
70 1 << 3: 1 = Silent (no echo)
72 enum { Info, Warning, Error, NoAutoHide = 1 << 2, Silent = 1 << 3 };
73 enum { NthSubdir, Rootdir };
74 enum { InsertCurrentURL = 1 };
75 enum { Increment, Decrement };
76 /* bitmask:
77 1 << 0: 0 = DirectionNext 1 = DirectionPrev (Relative)
78 1 << 0: 0 = DirectionBackwards 1 = DirectionForward (Absolute)
80 1 << 1: 0 = DirectionRelative 1 = DirectionAbsolute
82 1 << 2: 0 = CaseInsensitive 1 = CaseSensitive
83 1 << 3: 0 = No Wrapping 1 = Wrapping
85 enum { DirectionRelative, DirectionAbsolute = 1 << 1 };
86 enum { DirectionNext, DirectionPrev, HideCompletion };
87 enum { DirectionBackwards = DirectionAbsolute, DirectionForward =
88 (1 << 0) | DirectionAbsolute };
89 enum { CaseInsensitive, CaseSensitive = 1 << 2 };
90 enum { Wrapping = 1 << 3 };
92 /* structs here */
93 typedef struct {
94 int i;
95 char *s;
96 } Arg;
98 typedef struct {
99 guint mask;
100 guint modkey;
101 guint key;
102 gboolean(*func) (const Arg * func);
103 Arg arg;
104 } Key;
106 typedef struct {
107 void *next;
108 Key Element;
109 } KeyList;
111 typedef struct {
112 guint mask;
113 guint modkey;
114 guint button;
115 gboolean(*func) (const Arg * arg);
116 const Arg arg;
117 } Mouse;
119 typedef struct {
120 char *name;
121 char (*var);
122 char *webkit;
123 gboolean intval;
124 gboolean boolval;
125 gboolean colourval;
126 gboolean reload;
127 } Setting;
129 typedef struct {
130 char *cmd;
131 gboolean(*func) (const Arg * arg);
132 const Arg arg;
133 } Command;
135 typedef struct {
136 char *handle;
137 char *uri;
138 } Searchengine;
140 struct map_pair {
141 char *line;
142 char what[20];
143 char value[240];
144 } my_pair;
146 typedef struct {
147 void *next;
148 char element[255];
149 } Listelement;
151 enum ConfigFileError {
152 SUCCESS = 0,
153 FILE_NOT_FOUND = -1,
154 READING_FAILED = -2,
155 SYNTAX_ERROR = -3
158 /* constants */
159 #define MOUSE_BUTTON_1 1
160 #define MOUSE_BUTTON_2 2
161 #define MOUSE_BUTTON_3 3
162 #define MOUSE_BUTTON_4 4
163 #define MOUSE_BUTTON_5 5
164 #define BUFFERSIZE 255
165 #define MAXTAGSIZE 200
167 /* bookmarks */
168 #define BOOKMARKS_STORAGE_FILENAME "%s/.config/vimprobable/bookmarks", getenv("HOME")
170 /* quickmarks */
171 #define QUICKMARK_FILE "%s/.config/vimprobable/quickmarks", getenv("HOME")
173 /* history */
174 #define HISTORY_MAX_ENTRIES 1000
175 #define HISTORY_STORAGE_FILENAME "%s/.config/vimprobable/history", getenv("HOME")
176 #define CLOSED_URL_FILENAME "%s/.config/vimprobable/closed", getenv("HOME")
178 /* searchengines */
179 #define SEARCHENGINES_STORAGE_FILENAME "%s/.config/vimprobable/searchengines", getenv("HOME")
181 /* Command size */
182 #define COMMANDSIZE 1024
184 /* maximum size of internal string variable handled by :set
185 * if you set this to anything lower than 8, colour values
186 * will stop working */
187 #define MAX_SETTING_SIZE 1024
189 /* completion list size */
190 #define MAX_LIST_SIZE 40