1 // vim:syntax=javascript
3 //! Helper function to toggle frame
4 function toggle_frame(map)
6 if (map.getFrameType() == "NoFrame" ) {
7 map.setFrameType ("RoundedRectangle");
9 map.setFrameType ("NoFrame");
11 function colorSubtreeWithQuickColor(n)
13 map = vym.currentMap();
14 vym.selectQuickColor(n);
15 c = vym.currentColor();
19 //! Macro F1: Color subtree red
22 colorSubtreeWithQuickColor(0);
25 //! Macro F2: Color subtree orange
28 colorSubtreeWithQuickColor(1);
30 // Or if you prefer to edit the heading of a branch using "F2"-key,
31 // you can use below instead of above:
35 //! Macro F3: Color subtree green
38 colorSubtreeWithQuickColor(2);
42 //! Macro F4: Color subtree purple
45 colorSubtreeWithQuickColor(3);
48 //! Macro F5: Color subtree blue
51 colorSubtreeWithQuickColor(4);
54 //! Macro F6: Color subtree blue
57 colorSubtreeWithQuickColor(5);
60 //! Macro F7: Color subtree black
63 colorSubtreeWithQuickColor(6);
66 //! Macro F8: Color subtree dark gray
69 colorSubtreeWithQuickColor(7);
72 //! Macro F9: Color subtree light gray
75 colorSubtreeWithQuickColor(8);
78 //! Macro F10: Color subtree light white
81 colorSubtreeWithQuickColor(9);
84 //! Macro F11: Repeat last command
87 map = vym.currentMap();
88 map.repeatLastCommand();
91 //! Macro F12: toggle high prio task
94 // Assuming 3 states, which are cycled:
96 // 1 - high prio task with arrows
97 // 2 - done task without arrows, but green hook
98 map = vym.currentMap();
102 map.unsetFlagByName("2arrow-up");
103 map.unsetFlagByName("stopsign");
104 map.setFlagByName("hook-green");
105 map.colorBranch("#0000ff");
107 if (map.hasActiveFlag("hook-green")) {
109 map.unsetFlagByName("hook-green");
112 map.setFlagByName("2arrow-up");
119 //! Macro Shift + F1: Frame background light red
120 function macro_shift_f1()
122 map = vym.currentMap();
123 status = "Background off";
124 if (map.getFrameType() == "NoFrame") {
125 status = "Background light red";
127 toggle_frame ( map );
128 map.setFrameBrushColor("#ffb3b4");
129 statusMessage(status);
132 //! Macro Shift + F2: Frame background light green
133 function macro_shift_f2()
135 map = vym.currentMap();
136 status = "Background off";
137 if (map.getFrameType() == "NoFrame") {
138 status = "Background light green";
140 toggle_frame ( map );
141 map.setFrameBrushColor("#bdffd6");
142 statusMessage(status);
145 //! Macro Shift + F3: Frame background light yellow
146 function macro_shift_f3()
148 map = vym.currentMap();
149 status = "Background off";
150 if (map.getFrameType() == "NoFrame") {
151 status = "Background light yellow";
153 toggle_frame ( map );
154 map.setFrameBrushColor("#efefb3");
155 statusMessage(status);
158 //! Macro Shift + F4: Frame background light blue
159 function macro_shift_f4()
161 map = vym.currentMap();
162 status = "Background off";
163 if (map.getFrameType() == "NoFrame") {
164 status = "Background light blue";
166 toggle_frame ( map );
167 map.setFrameBrushColor("#e2e6ff");
168 statusMessage(status);
171 //! Macro Shift + F5: Frame background light grey
172 function macro_shift_f5()
174 map = vym.currentMap();
175 status = "Background off";
176 if (map.getFrameType() == "NoFrame") {
177 status = "Background light grey";
179 toggle_frame ( map );
180 map.setFrameBrushColor("#d6d6d6");
181 statusMessage(status);
184 //! Macro Shift + F6: Frame background purple
185 function macro_shift_f6()
187 map = vym.currentMap();
188 status = "Background off";
189 if (map.getFrameType() == "NoFrame") {
190 status = "Background purple";
192 toggle_frame ( map );
193 map.setFrameBrushColor("#ffaaff");
194 statusMessage(status);
197 //! Macro Shift + F7: Frame background white
198 function macro_shift_f7()
200 map = vym.currentMap();
201 status = "Background off";
202 if (map.getFrameType() == "NoFrame") {
203 status = "Background white";
205 toggle_frame ( map );
206 map.setFrameBrushColor("#ffffff");
207 statusMessage(status);
210 //! Macro Shift + F8: Frame background black
211 function macro_shift_f8()
213 map = vym.currentMap();
214 status = "Background off";
215 if (map.getFrameType() == "NoFrame") {
216 status = "Background black";
218 toggle_frame ( map );
219 map.setFrameBrushColor("#000000");
220 statusMessage(status);
223 //! Macro Shift + F9: Toggle frame to include children
224 function macro_shift_f9()
226 map = vym.currentMap();
227 map.toggleFrameIncludeChildren();
230 //! Macro Shift + F10:
231 // Useful for timestamps created on last entry
232 function macro_shift_f10()
236 //! Macro Shift + F11: Replace "@..." by mutt aliases
237 function macro_shift_f11()
239 map = vym.currentMap();
240 lines = vym.loadFile("/home/uwe/.mutt/eb-aliases").split('\n');
243 if (map.getHeadingPlainText() == "parts") {
244 map.setHeadingPlainText("Participants");
247 map.initIterator("foobar");
249 while (map.nextIterator("foobar") ) {
250 heading = map.getHeadingPlainText();
252 // Search for "@alias" at beginning of heading
253 if (heading.search(/^@\w/) == 0) {
254 alias_map = heading.replace(/@/,"");
256 for(var i = 0;i < lines.length;i++){
257 if (lines[i].search(/^alias/) == 0) {
258 if (lines[i].search(alias_map) == 6) {
259 name = lines[i].replace(/^.+?\"/, "");
260 name = name.replace(/\".+/, "");
262 email = lines[i].replace(/^.+?</, "");
263 email = email.replace(/>.*/, "");
265 map.setHeadingPlainText(name);
270 print ("No alias found");
275 //! Macro Shift + F12:
276 function macro_shift_f12()
278 statusMessage("Macro F12 + Shift triggered");
282 // New /////////////////////////////////////
284 function macro_ctrl_f1()
286 statusMessage("Macro F1 + Ctrl triggered");
290 function macro_ctrl_f2()
292 statusMessage("Macro F2 + Ctrl triggered");
296 function macro_ctrl_f3()
298 statusMessage("Macro F3 + Ctrl triggered");
302 function macro_ctrl_f4()
304 statusMessage("Macro F4 + Ctrl triggered");
308 function macro_ctrl_f5()
310 statusMessage("Macro F5 + Ctrl triggered");
314 function macro_ctrl_f6()
316 statusMessage("Macro F6 + Ctrl triggered");
320 function macro_ctrl_f7()
322 statusMessage("Macro F7 + Ctrl triggered");
326 function macro_ctrl_f8()
328 statusMessage("Macro F8 + Ctrl triggered");
332 function macro_ctrl_f9()
334 statusMessage("Macro F9 + Ctrl triggered");
337 //! Macro Ctrl + F10:
338 function macro_ctrl_f10()
340 statusMessage("Macro F10 + Ctrl triggered");
343 //! Macro Ctrl + F11:
344 function macro_ctrl_f11()
346 statusMessage("Macro F11 + Ctrl triggered");
349 //! Macro Ctrl + F12:
350 function macro_ctrl_f12()
352 statusMessage("Macro F12 + Ctrl triggered");
355 //! Macro Ctrl + Shift + F1:
356 function macro_ctrl_shift_f1()
358 statusMessage("Macro F1 + Ctrl + Shift triggered");
361 //! Macro Ctrl + Shift + F2:
362 function macro_ctrl_shift_f2()
364 statusMessage("Macro F2 + Ctrl + Shift triggered");
367 //! Macro Ctrl + Shift + F3:
368 function macro_ctrl_shift_f3()
370 statusMessage("Macro F3 + Ctrl + Shift triggered");
373 //! Macro Ctrl + Shift + F4:
374 function macro_ctrl_shift_f4()
376 statusMessage("Macro F4 + Ctrl + Shift triggered");
379 //! Macro Ctrl + Shift + F5:
380 function macro_ctrl_shift_f5()
382 statusMessage("Macro F5 + Ctrl + Shift triggered");
385 //! Macro Ctrl + Shift + F6:
386 function macro_ctrl_shift_f6()
388 statusMessage("Macro F6 + Ctrl + Shift triggered");
391 //! Macro Ctrl + Shift + F7:
392 function macro_ctrl_shift_f7()
394 statusMessage("Macro F7 + Ctrl + Shift triggered");
397 //! Macro Ctrl + Shift + F8:
398 function macro_ctrl_shift_f8()
400 statusMessage("Macro F8 + Ctrl + Shift triggered");
403 //! Macro Ctrl + Shift + F9:
404 function macro_ctrl_shift_f9()
406 statusMessage("Macro F9 + Ctrl + Shift triggered");
409 //! Macro Ctrl + Shift + F10:
410 function macro_ctrl_shift_f10()
412 statusMessage("Macro F10 + Ctrl + Shift triggered");
415 //! Macro Ctrl + Shift + F11:
416 function macro_ctrl_shift_f11()
418 statusMessage("Macro F11 + Ctrl + Shift triggered");
421 //! Macro Ctrl + Shift + F12:
422 function macro_ctrl_shift_f12()
424 statusMessage("Macro F12 + Ctrl + Shift triggered");