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.11 by root, Sun Sep 2 08:31:53 2007 UTC vs.
Revision 1.19 by root, Sat Aug 30 08:04:01 2008 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines