ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/Macro.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/Macro.pm (file contents):
Revision 1.9 by root, Tue Aug 28 01:23:47 2007 UTC vs.
Revision 1.22 by root, Sat Apr 3 02:58:24 2010 UTC

1package CFPlus::Macro; 1package DC::Macro;
2 2
3use strict; 3use common::sense;
4 4
5use List::Util (); 5use List::Util ();
6use CFPlus::UI; 6use DC::UI;
7 7
8our $REFRESH_MACRO_LIST; 8our $REFRESH_MACRO_LIST;
9 9
10our %DEFAULT_KEYMAP = ( 10our %DEFAULT_KEYMAP = (
11 (map +($_ => "!completer $_"), "a" .. "z"), 11 (map +("($_)" => "!completer $_"), "a" .. "z"),
12 "(!)" => "!completer shout ", 12 "(!)" => "!completer shout ",
13 "(\")" => "!completer say ", 13 "(\")" => "!completer say ",
14 "(')" => "!completer", 14 "(')" => "!completer",
15 15
16 "LShift-tab" => "!toggle-messagewindow", 16# "LShift-tab" => "!toggle-messagewindow",
17 "RShift-tab" => "!toggle-messagewindow", 17# "RShift-tab" => "!toggle-messagewindow",
18 "tab" => "!toggle-playerbook", 18 "tab" => "!toggle-playerbook",
19 "f1" => "!toggle-help", 19 "f1" => "!toggle-help",
20 "f2" => "!toggle-stats", 20 "f2" => "!toggle-stats",
21 "f3" => "!toggle-skills", 21 "f3" => "!toggle-skills",
22 "f4" => "!toggle-spells", 22 "f4" => "!toggle-spells",
23 "f5" => "!toggle-inventory", 23 "f5" => "!toggle-inventory",
24 "f9" => "!toggle-setup", 24 "f9" => "!toggle-setup",
25
25 (map +("LAlt-$_" => "!switch-tab $_"), 0..9), 26 (map +("LRAM-$_" => "!switch-tab $_"), 0..9),
26 (map +("RAlt-$_" => "!switch-tab $_"), 0..9), 27 "LRAM-x" => "!close-current-tab",
28
27 "return" => "!activate-chat", 29 "return" => "!activate-chat",
28 "." => "!repeat-command", 30 "." => "!repeat-command",
29 31
30 "," => "take", 32 "," => "take",
31 "space" => "apply", 33 "space" => "apply",
34 "enter" => "examine",
32 "[+]" => "rotateshoottype +", 35 "[+]" => "rotateshoottype +",
33 "[-]" => "rotateshoottype -", 36 "[-]" => "rotateshoottype -",
37
38 "LRAM-e" => "examine",
39 "LRAM-s" => "ready_skill find traps",
40 "LRAM-d" => "ready_skill disarm traps",
41 "LRAM-p" => "ready_skill praying",
34); 42);
35 43
36# allowed modifiers 44# allowed modifiers
37our %MODIFIER = ( 45our %MODIFIER = (
38 "LShift" => CFPlus::KMOD_LSHIFT, 46 "LShift" => DC::KMOD_LSHIFT,
39 "RShift" => CFPlus::KMOD_RSHIFT, 47 "RShift" => DC::KMOD_RSHIFT,
40# "Shift" => CFPlus::KMOD_LSHIFT | CFPlus::KMOD_RSHIFT, 48# "Shift" => DC::KMOD_LSHIFT | DC::KMOD_RSHIFT,
41 "LCtrl" => CFPlus::KMOD_LCTRL, 49 "LCtrl" => DC::KMOD_LCTRL,
42 "RCtrl" => CFPlus::KMOD_RCTRL, 50 "RCtrl" => DC::KMOD_RCTRL,
43# "Ctrl" => CFPlus::KMOD_LCTRL | CFPlus::KMOD_RCTRL, 51# "Ctrl" => DC::KMOD_LCTRL | DC::KMOD_RCTRL,
44 "LAlt" => CFPlus::KMOD_LALT, 52 "LAlt" => DC::KMOD_LALT,
45 "RAlt" => CFPlus::KMOD_RALT, 53 "RAlt" => DC::KMOD_RALT,
46# "Alt" => CFPlus::KMOD_LALT | CFPlus::KMOD_RALT, 54# "Alt" => DC::KMOD_LALT | DC::KMOD_RALT,
47 "LMeta" => CFPlus::KMOD_LMETA, 55 "LMeta" => DC::KMOD_LMETA,
48 "RMeta" => CFPlus::KMOD_RMETA, 56 "RMeta" => DC::KMOD_RMETA,
49# "Meta" => CFPlus::KMOD_LMETA | CFPlus::KMOD_RMETA, 57# "Meta" => DC::KMOD_LMETA | DC::KMOD_RMETA,
50); 58);
51 59
52# allowed modifiers 60# allowed modifiers
53our $MODIFIER_MASK |= $_ for values %MODIFIER; 61our $MODIFIER_MASK |= $_ for values %MODIFIER;
54 62
55# can bind to these without any modifier 63# can bind to these without any modifier
56our @DIRECT_CHARS = qw(0 1 2 3 4 5 6 7 8 9); 64our @DIRECT_CHARS = qw(0 1 2 3 4 5 6 7 8 9);
57 65
58our @DIRECT_KEYS = ( 66our @DIRECT_KEYS = (
59 CFPlus::SDLK_F1, 67 DC::SDLK_F1,
60 CFPlus::SDLK_F2, 68 DC::SDLK_F2,
61 CFPlus::SDLK_F3, 69 DC::SDLK_F3,
62 CFPlus::SDLK_F4, 70 DC::SDLK_F4,
63 CFPlus::SDLK_F5, 71 DC::SDLK_F5,
64 CFPlus::SDLK_F6, 72 DC::SDLK_F6,
65 CFPlus::SDLK_F7, 73 DC::SDLK_F7,
66 CFPlus::SDLK_F8, 74 DC::SDLK_F8,
67 CFPlus::SDLK_F9, 75 DC::SDLK_F9,
68 CFPlus::SDLK_F10, 76 DC::SDLK_F10,
69 CFPlus::SDLK_F11, 77 DC::SDLK_F11,
70 CFPlus::SDLK_F12, 78 DC::SDLK_F12,
71 CFPlus::SDLK_F13, 79 DC::SDLK_F13,
72 CFPlus::SDLK_F14, 80 DC::SDLK_F14,
73 CFPlus::SDLK_F15, 81 DC::SDLK_F15,
74); 82);
75 83
76our %MACRO_FUNCTION = ( 84our %MACRO_FUNCTION = (
77 "toggle-messagewindow" => sub { $::MESSAGE_WINDOW->toggle_visibility }, 85 "toggle-messagewindow" => sub { $::MESSAGE_WINDOW->toggle_visibility },
78 "toggle-playerbook" => sub { $::PL_WINDOW->toggle_visibility }, 86 "toggle-playerbook" => sub { $::PL_WINDOW->toggle_visibility },
83 "toggle-inventory" => sub { ::toggle_player_page ($::INVENTORY_PAGE) }, 91 "toggle-inventory" => sub { ::toggle_player_page ($::INVENTORY_PAGE) },
84 "toggle-pickup" => sub { ::toggle_player_page ($::PICKUP_PAGE) }, 92 "toggle-pickup" => sub { ::toggle_player_page ($::PICKUP_PAGE) },
85 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility }, 93 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility },
86 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility }, 94 "toggle-setup" => sub { $::SETUP_DIALOG->toggle_visibility },
87 "switch-tab" => sub { $::MESSAGE_WINDOW->user_switch_to_page (0 + shift) }, 95 "switch-tab" => sub { $::MESSAGE_WINDOW->user_switch_to_page (0 + shift) },
96 "close-current-tab" => sub { $::MESSAGE_WINDOW->close_current_tab },
88 "activate-chat" => sub { $::MESSAGE_WINDOW->activate_current }, 97 "activate-chat" => sub { $::MESSAGE_WINDOW->activate_current },
89 "repeat-command" => sub { 98 "repeat-command" => sub {
90 $::CONN->user_send ($::COMPLETER->{last_command}) 99 $::CONN->user_send ($::COMPLETER->{last_command})
91 if $::CONN && exists $::COMPLETER->{last_command}; 100 if $::CONN && exists $::COMPLETER->{last_command};
92 }, 101 },
100 109
101our $DEFAULT_KEYMAP; 110our $DEFAULT_KEYMAP;
102 111
103sub init { 112sub init {
104 $DEFAULT_KEYMAP ||= do { 113 $DEFAULT_KEYMAP ||= do {
114 local $MODIFIER{LRAM} = DC::KMOD_LRAM; # hack to enable internal LRAM modifer
115
105 my %sym = map +(CFPlus::SDL_GetKeyName $_, $_), CFPlus::SDLK_FIRST .. CFPlus::SDLK_LAST; 116 my %sym = map +(DC::SDL_GetKeyName $_, $_), DC::SDLK_FIRST .. DC::SDLK_LAST;
106 my $map; 117 my $map;
107 118
108 while (my ($k, $v) = each %DEFAULT_KEYMAP) { 119 while (my ($k, $v) = each %DEFAULT_KEYMAP) {
109 if ($k =~ /^\((.)\)$/) { 120 if ($k =~ /^\((.)\)$/) {
110 $map->{U}{ord $1} = $v; 121 $map->{U}{ord $1} = $v;
113 my $sym = $sym{pop @mod} 124 my $sym = $sym{pop @mod}
114 or warn "unknown keysym $k\n"; 125 or warn "unknown keysym $k\n";
115 126
116 my $mod = 0; $mod |= $MODIFIER{$_} for @mod; 127 my $mod = 0; $mod |= $MODIFIER{$_} for @mod;
117 128
118 $map->{K}[CFPlus::popcount $mod]{$mod}{$sym} = $v; 129 $map->{K}[DC::popcount $mod]{$mod}{$sym} = $v;
119 } 130 }
120 } 131 }
121 132
122 %DEFAULT_KEYMAP = (); 133 %DEFAULT_KEYMAP = ();
123 $map 134 $map
125} 136}
126 137
127sub accelkey_to_string($) { 138sub accelkey_to_string($) {
128 join "-", 139 join "-",
129 (grep $_[0][0] & $MODIFIER{$_}, keys %MODIFIER), 140 (grep $_[0][0] & $MODIFIER{$_}, keys %MODIFIER),
130 CFPlus::SDL_GetKeyName $_[0][1] 141 DC::SDL_GetKeyName $_[0][1]
131} 142}
132 143
133sub trigger_to_string($) { 144sub trigger_to_string($) {
134 my ($macro) = @_; 145 my ($macro) = @_;
135 146
162 $window->disconnect_all ("focus_out"); 173 $window->disconnect_all ("focus_out");
163 $window->destroy; 174 $window->destroy;
164 &$end_cb; 175 &$end_cb;
165 }; 176 };
166 177
167 $window = new CFPlus::UI::Toplevel 178 $window = new DC::UI::Toplevel
168 title => "Edit Macro Trigger", 179 title => "Edit Macro Trigger",
169 x => "center", 180 x => "center",
170 y => "center", 181 y => "center",
171 z => 1000, 182 z => 1000,
172 can_events => 1, 183 can_events => 1,
180 $done->(0); 191 $done->(0);
181 1 192 1
182 }, 193 },
183 ; 194 ;
184 195
185 $window->add (my $vb = new CFPlus::UI::VBox); 196 $window->add (my $vb = new DC::UI::VBox);
186 197
187 $vb->add (new CFPlus::UI::Label 198 $vb->add (new DC::UI::Label
188 text => "To bind the macro to a key,\n" 199 text => "To bind the macro to a key,\n"
189 . "press a modifier (Ctrl, Alt\n" 200 . "press a modifier (Ctrl, Alt\n"
190 . "and/or Shift) and a key, or\n" 201 . "and/or Shift) and a key, or\n"
191 . "0-9 and F1-F15 without any modifier\n\n" 202 . "0-9 and F1-F15 without any modifier\n\n"
192 . "To cancel press Escape or close this.\n\n" 203 . "To cancel press Escape or close this.\n\n"
193 . "Accelerator key combo:", 204 . "Accelerator key combo:",
194 ellipsise => 0, 205 ellipsise => 0,
195 ); 206 );
196 207
197 $vb->add (my $entry = new CFPlus::UI::Label 208 $vb->add (my $entry = new DC::UI::Label
198 fg => [0, 0, 0, 1], 209 fg => [0, 0, 0, 1],
199 bg => [1, 1, 0, 1], 210 bg => [1, 1, 0, 1],
200 ); 211 );
201 212
202 my $key_cb = sub { 213 my $key_cb = sub {
215 map "$_-", 226 map "$_-",
216 grep $mod & $MODIFIER{$_}, 227 grep $mod & $MODIFIER{$_},
217 keys %MODIFIER 228 keys %MODIFIER
218 ); 229 );
219 230
220 return if $sym >= CFPlus::SDLK_MODIFIER_MIN 231 return if $sym >= DC::SDLK_MODIFIER_MIN
221 && $sym <= CFPlus::SDLK_MODIFIER_MAX; 232 && $sym <= DC::SDLK_MODIFIER_MAX;
222 233
223 if ($mod 234 if ($mod
224 || ((grep $_ eq chr $ev->{unicode}, @DIRECT_CHARS) 235 || ((grep $_ eq chr $ev->{unicode}, @DIRECT_CHARS)
225 || (grep $_ == $sym, @DIRECT_KEYS))) 236 || (grep $_ == $sym, @DIRECT_KEYS)))
226 { 237 {
227 $macro->{accelkey} = [$mod, $sym]; 238 $macro->{accelkey} = [$mod, $sym];
228 $done->(1); 239 $done->(1);
229 } else { 240 } else {
230 $entry->set_text ("cannot bind " . (CFPlus::SDL_GetKeyName $sym) . " without modifier."); 241 $entry->set_text ("cannot bind " . (DC::SDL_GetKeyName $sym) . " without modifier.");
231 } 242 }
232 1 243 1
233 }; 244 };
234 245
235 $window->connect (key_up => $key_cb); 246 $window->connect (key_up => $key_cb);
239 $window->show; 250 $window->show;
240} 251}
241 252
242sub find_default($) { 253sub find_default($) {
243 my ($ev) = @_; 254 my ($ev) = @_;
244
245 if (my $cmd = $DEFAULT_KEYMAP->{U}{$ev->{unicode}}) {
246 return $cmd;
247 }
248 255
249 for my $m (reverse grep $_, @{ $DEFAULT_KEYMAP->{K} }) { 256 for my $m (reverse grep $_, @{ $DEFAULT_KEYMAP->{K} }) {
250 for (keys %$m) { 257 for (keys %$m) {
251 if ($_ == ($ev->{mod} & $_)) { 258 if ($_ == ($ev->{mod} & $_)) {
252 if (defined (my $cmd = $m->{$_}{$ev->{sym}})) { 259 if (defined (my $cmd = $m->{$_}{$ev->{sym}})) {
253 return $cmd; 260 return $cmd;
254 } 261 }
255 } 262 }
256 } 263 }
264 }
265
266 if (my $cmd = $DEFAULT_KEYMAP->{U}{$ev->{unicode}}) {
267 return $cmd;
257 } 268 }
258 269
259 () 270 ()
260} 271}
261 272
300 } 311 }
301 } 312 }
302} 313}
303 314
304sub keyboard_setup { 315sub keyboard_setup {
305 my $kbd_setup = new CFPlus::UI::VBox; 316 my $kbd_setup = new DC::UI::VBox;
306 317
307 $kbd_setup->add (my $list = new CFPlus::UI::VBox); 318 $kbd_setup->add (my $list = new DC::UI::VBox);
308 319
309 $list->add (new CFPlus::UI::FancyFrame 320 $list->add (new DC::UI::FancyFrame
310 label => "Options", 321 label => "Options",
311 child => (my $hb = new CFPlus::UI::HBox), 322 child => (my $hb = new DC::UI::HBox),
312 ); 323 );
313 $hb->add (new CFPlus::UI::Label text => "only shift-up stops fire"); 324 $hb->add (new DC::UI::Label text => "only shift-up stops fire");
314 $hb->add (new CFPlus::UI::CheckBox 325 $hb->add (new DC::UI::CheckBox
315 expand => 1, 326 expand => 1,
316 state => $::CFG->{shift_fire_stop}, 327 state => $::CFG->{shift_fire_stop},
317 tooltip => "If this checkbox is enabled you will stop fire only if you stop pressing shift.", 328 tooltip => "If this checkbox is enabled you will stop fire only if you stop pressing shift.",
318 on_changed => sub { 329 on_changed => sub {
319 my ($cbox, $value) = @_; 330 my ($cbox, $value) = @_;
320 $::CFG->{shift_fire_stop} = $value; 331 $::CFG->{shift_fire_stop} = $value;
321 0 332 0
322 }, 333 },
323 ); 334 );
324 335
325 $list->add (new CFPlus::UI::FancyFrame 336 $list->add (new DC::UI::FancyFrame
326 label => "Macros", 337 label => "Macros",
327 child => (my $macros = new CFPlus::UI::VBox), 338 child => (my $macros = new DC::UI::VBox),
328 ); 339 );
329 340
330 my $refresh; 341 my $refresh;
331 342
332 my $tooltip_common = "\n\n<small>Left click - edit macro\nMiddle click - invoke macro\nRight click - further options</small>"; 343 my $tooltip_common = "\n\n<small>Left click - edit macro\nMiddle click - invoke macro\nRight click - further options</small>";
335 346
336 my $edit_macro = sub { 347 my $edit_macro = sub {
337 my ($macro) = @_; 348 my ($macro) = @_;
338 349
339 $kbd_setup->clear; 350 $kbd_setup->clear;
340 $kbd_setup->add (new CFPlus::UI::Button 351 $kbd_setup->add (new DC::UI::Button
341 text => "Return", 352 text => "Return",
342 tooltip => "Return to the macro list.", 353 tooltip => "Return to the macro list.",
343 on_activate => sub { 354 on_activate => sub {
344 $kbd_setup->clear; 355 $kbd_setup->clear;
345 $kbd_setup->add ($list); 356 $kbd_setup->add ($list);
346 $refresh->(); 357 $refresh->();
347 1 358 1
348 }, 359 },
349 ); 360 );
350 $kbd_setup->add (new CFPlus::UI::FancyFrame 361 $kbd_setup->add (new DC::UI::FancyFrame
351 label => "Edit Macro", 362 label => "Edit Macro",
352 child => (my $editor = new CFPlus::UI::Table col_expand => [0, 1]), 363 child => (my $editor = new DC::UI::Table col_expand => [0, 1]),
353 ); 364 );
354 365
355 $editor->add_at (0, 1, new CFPlus::UI::Label 366 $editor->add_at (0, 1, new DC::UI::Label
356 text => "Trigger", 367 text => "Trigger",
357 tooltip => $tooltip_trigger, 368 tooltip => $tooltip_trigger,
358 can_hover => 1, 369 can_hover => 1,
359 can_events => 1, 370 can_events => 1,
360 ); 371 );
361 $editor->add_at (0, 2, new CFPlus::UI::Label 372 $editor->add_at (0, 2, new DC::UI::Label
362 text => "Actions", 373 text => "Actions",
363 tooltip => $tooltip_commands, 374 tooltip => $tooltip_commands,
364 can_hover => 1, 375 can_hover => 1,
365 can_events => 1, 376 can_events => 1,
366 ); 377 );
367 378
368 $editor->add_at (1, 2, my $textedit = new CFPlus::UI::TextEdit 379 $editor->add_at (1, 2, my $textedit = new DC::UI::TextEdit
369 text => macro_to_text $macro, 380 text => macro_to_text $macro,
370 tooltip => $tooltip_commands, 381 tooltip => $tooltip_commands,
371 on_changed => sub { 382 on_changed => sub {
372 $macro->{action} = macro_from_text $macro, $_[1]; 383 $macro->{action} = macro_from_text $macro, $_[1];
373 }, 384 },
374 ); 385 );
375 386
376 $editor->add_at (1, 1, my $accel = new CFPlus::UI::Button 387 $editor->add_at (1, 1, my $accel = new DC::UI::Button
377 text => trigger_to_string $macro, 388 text => trigger_to_string $macro,
378 tooltip => "To change the trigger for a macro, activate this button.", 389 tooltip => "To change the trigger for a macro, activate this button.",
379 on_activate => sub { 390 on_activate => sub {
380 my ($accel) = @_; 391 my ($accel) = @_;
381 trigger_edit $macro, sub { 392 trigger_edit $macro, sub {
384 1 395 1
385 }, 396 },
386 ); 397 );
387 398
388 my $recording; 399 my $recording;
389 $editor->add_at (1, 3, new CFPlus::UI::Button 400 $editor->add_at (1, 3, new DC::UI::Button
390 text => "Start Recording", 401 text => "Start Recording",
391 tooltip => "Start/Stop command recording: when recording, " 402 tooltip => "Start/Stop command recording: when recording, "
392 . "actions and commands you invoke are appended to this macro. " 403 . "actions and commands you invoke are appended to this macro. "
393 . "You can only record when you are logged in.", 404 . "You can only record when you are logged in.",
394 on_destroy => sub { 405 on_destroy => sub {
410 } 421 }
411 }, 422 },
412 ); 423 );
413 }; 424 };
414 425
415 $macros->add (new CFPlus::UI::Button 426 $macros->add (new DC::UI::Button
416 text => "New Macro", 427 text => "New Macro",
417 tooltip => "Creates a new, empty, macro you can edit.", 428 tooltip => "Creates a new, empty, macro you can edit.",
418 on_activate => sub { 429 on_activate => sub {
419 my $macro = { }; 430 my $macro = { };
420 push @{ $::PROFILE->{macro} }, $macro; 431 push @{ $::PROFILE->{macro} }, $macro;
421 $edit_macro->($macro); 432 $edit_macro->($macro);
422 }, 433 },
423 ); 434 );
424 435
425 $macros->add (my $macrolist = new CFPlus::UI::Table col_expand => [0, 1]); 436 $macros->add (my $macrolist = new DC::UI::Table col_expand => [0, 1]);
426 437
427 $REFRESH_MACRO_LIST = $refresh = sub { 438 $REFRESH_MACRO_LIST = $refresh = sub {
428 $macrolist->clear; 439 $macrolist->clear;
429 440
430 $macrolist->add_at (0, 1, new CFPlus::UI::Label 441 $macrolist->add_at (0, 1, new DC::UI::Label
431 text => "Trigger", 442 text => "Trigger",
443 tooltip => $tooltip_trigger . $tooltip_common,
444 );
445 $macrolist->add_at (1, 1, new DC::UI::Label
446 text => "Actions",
432 align => 0, 447 align => 0,
433 tooltip => $tooltip_trigger . $tooltip_common,
434 );
435 $macrolist->add_at (1, 1, new CFPlus::UI::Label
436 text => "Commands",
437 tooltip => $tooltip_commands . $tooltip_common, 448 tooltip => $tooltip_commands . $tooltip_common,
438 ); 449 );
439 450
440 for my $idx (0 .. $#{$::PROFILE->{macro} || []}) { 451 for my $idx (0 .. $#{$::PROFILE->{macro} || []}) {
441 my $macro = $::PROFILE->{macro}[$idx]; 452 my $macro = $::PROFILE->{macro}[$idx];
445 my ($widget, $ev) = @_; 456 my ($widget, $ev) = @_;
446 457
447 if ($ev->{button} == 1) { 458 if ($ev->{button} == 1) {
448 $edit_macro->($macro), 459 $edit_macro->($macro),
449 } elsif ($ev->{button} == 2) { 460 } elsif ($ev->{button} == 2) {
450 $::CONN->macro_send ($macro) if $::CONN; 461 execute ($macro);
451 } elsif ($ev->{button} == 3) { 462 } elsif ($ev->{button} == 3) {
452 (new CFPlus::UI::Menu 463 (new DC::UI::Menu
453 items => [ 464 items => [
454 ["Edit" => sub { $edit_macro->($macro) }], 465 ["Edit" => sub { $edit_macro->($macro) }],
455 ["Invoke" => sub { $::CONN->macro_send ($macro) if $::CONN }], 466 ["Invoke" => sub { execute ($macro) }],
456 ["Delete" => sub { 467 ["Delete" => sub {
457 # might want to use grep instead 468 # might want to use grep instead
458 splice @{$::PROFILE->{macro}}, $idx, 1, (); 469 splice @{$::PROFILE->{macro}}, $idx, 1, ();
459 $refresh->(); 470 $refresh->();
460 }], 471 }],
465 } 476 }
466 477
467 1 478 1
468 }; 479 };
469 480
470 $macrolist->add_at (0, $y, new CFPlus::UI::Label 481 $macrolist->add_at (0, $y, new DC::UI::Label
471 text => trigger_to_string $macro, 482 text => trigger_to_string $macro,
472 tooltip => $tooltip_trigger . $tooltip_common, 483 tooltip => $tooltip_trigger . $tooltip_common,
473 align => 0, 484 fg => [1, 0.8, 0.8],
474 can_hover => 1, 485 can_hover => 1,
475 can_events => 1, 486 can_events => 1,
476 on_button_down => $macro_cb, 487 on_button_down => $macro_cb,
477 ); 488 );
478 489
479 $macrolist->add_at (1, $y, new CFPlus::UI::Label 490 $macrolist->add_at (1, $y, new DC::UI::Label
480 text => (join "; ", @{ $macro->{action} || [] }), 491 text => (join "; ", @{ $macro->{action} || [] }),
481 tooltip => $tooltip_commands . $tooltip_common, 492 tooltip => $tooltip_commands . $tooltip_common,
493 fg => [0.9, 0.9, 0.9],
494 align => 0,
482 expand => 1, 495 expand => 1,
483 ellipsise => 3, 496 ellipsise => 3,
484 can_hover => 1, 497 can_hover => 1,
485 can_events => 1, 498 can_events => 1,
486 on_button_down => $macro_cb, 499 on_button_down => $macro_cb,

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines