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.18 by root, Mon May 5 16:19:47 2008 UTC vs.
Revision 1.22 by root, Sat Apr 3 02:58:24 2010 UTC

1package DC::Macro; 1package DC::Macro;
2 2
3use strict; 3use common::sense;
4 4
5use List::Util (); 5use List::Util ();
6use DC::UI; 6use DC::UI;
7 7
8our $REFRESH_MACRO_LIST; 8our $REFRESH_MACRO_LIST;
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 "LAlt-x" => "!close-current-tab", 27 "LRAM-x" => "!close-current-tab",
28
28 "return" => "!activate-chat", 29 "return" => "!activate-chat",
29 "." => "!repeat-command", 30 "." => "!repeat-command",
30 31
31 "," => "take", 32 "," => "take",
32 "space" => "apply", 33 "space" => "apply",
33 "enter" => "examine", 34 "enter" => "examine",
34 "[+]" => "rotateshoottype +", 35 "[+]" => "rotateshoottype +",
35 "[-]" => "rotateshoottype -", 36 "[-]" => "rotateshoottype -",
37
36 "LAlt-e" => "examine", 38 "LRAM-e" => "examine",
37 "LAlt-s" => "ready_skill find traps", 39 "LRAM-s" => "ready_skill find traps",
38 "LAlt-d" => "ready_skill disarm traps", 40 "LRAM-d" => "ready_skill disarm traps",
39 "LAlt-p" => "ready_skill praying", 41 "LRAM-p" => "ready_skill praying",
40); 42);
41 43
42# allowed modifiers 44# allowed modifiers
43our %MODIFIER = ( 45our %MODIFIER = (
44 "LShift" => DC::KMOD_LSHIFT, 46 "LShift" => DC::KMOD_LSHIFT,
107 109
108our $DEFAULT_KEYMAP; 110our $DEFAULT_KEYMAP;
109 111
110sub init { 112sub init {
111 $DEFAULT_KEYMAP ||= do { 113 $DEFAULT_KEYMAP ||= do {
114 local $MODIFIER{LRAM} = DC::KMOD_LRAM; # hack to enable internal LRAM modifer
115
112 my %sym = map +(DC::SDL_GetKeyName $_, $_), DC::SDLK_FIRST .. DC::SDLK_LAST; 116 my %sym = map +(DC::SDL_GetKeyName $_, $_), DC::SDLK_FIRST .. DC::SDLK_LAST;
113 my $map; 117 my $map;
114 118
115 while (my ($k, $v) = each %DEFAULT_KEYMAP) { 119 while (my ($k, $v) = each %DEFAULT_KEYMAP) {
116 if ($k =~ /^\((.)\)$/) { 120 if ($k =~ /^\((.)\)$/) {
452 my ($widget, $ev) = @_; 456 my ($widget, $ev) = @_;
453 457
454 if ($ev->{button} == 1) { 458 if ($ev->{button} == 1) {
455 $edit_macro->($macro), 459 $edit_macro->($macro),
456 } elsif ($ev->{button} == 2) { 460 } elsif ($ev->{button} == 2) {
457 $::CONN->macro_send ($macro) if $::CONN; 461 execute ($macro);
458 } elsif ($ev->{button} == 3) { 462 } elsif ($ev->{button} == 3) {
459 (new DC::UI::Menu 463 (new DC::UI::Menu
460 items => [ 464 items => [
461 ["Edit" => sub { $edit_macro->($macro) }], 465 ["Edit" => sub { $edit_macro->($macro) }],
462 ["Invoke" => sub { $::CONN->macro_send ($macro) if $::CONN }], 466 ["Invoke" => sub { execute ($macro) }],
463 ["Delete" => sub { 467 ["Delete" => sub {
464 # might want to use grep instead 468 # might want to use grep instead
465 splice @{$::PROFILE->{macro}}, $idx, 1, (); 469 splice @{$::PROFILE->{macro}}, $idx, 1, ();
466 $refresh->(); 470 $refresh->();
467 }], 471 }],

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines