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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines