… | |
… | |
102 | |
102 | |
103 | our $INV_WINDOW; |
103 | our $INV_WINDOW; |
104 | our $INV; |
104 | our $INV; |
105 | our $INVR; |
105 | our $INVR; |
106 | our $INVR_LBL; |
106 | our $INVR_LBL; |
|
|
107 | |
|
|
108 | our $BIND_WINDOW; |
107 | |
109 | |
108 | sub status { |
110 | sub status { |
109 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
111 | $STATUSBOX->add (CFClient::UI::Label::escape $_[0], pri => -10, group => "status", timeout => 10, fg => [1, 1, 0, 1]); |
110 | } |
112 | } |
111 | |
113 | |
… | |
… | |
435 | |
437 | |
436 | &set_gauge_window_fontsize; |
438 | &set_gauge_window_fontsize; |
437 | |
439 | |
438 | $win |
440 | $win |
439 | } |
441 | } |
|
|
442 | |
440 | |
443 | |
441 | sub make_stats_window { |
444 | sub make_stats_window { |
442 | my $tgw = new CFClient::UI::FancyFrame |
445 | my $tgw = new CFClient::UI::FancyFrame |
443 | req_y => $HEIGHT * (2/8), |
446 | req_y => $HEIGHT * (2/8), |
444 | req_x => -1, |
447 | req_x => -1, |
… | |
… | |
864 | }, |
867 | }, |
865 | on_activate => sub { |
868 | on_activate => sub { |
866 | my ($input, $text) = @_; |
869 | my ($input, $text) = @_; |
867 | $input->set_text (''); |
870 | $input->set_text (''); |
868 | |
871 | |
|
|
872 | if ($text =~ /^\/bind\s+(.*)$/) { |
|
|
873 | CFClient::Recorder::open_binding_dialog ([$1]); |
869 | if ($text =~ /^\/(.*)/) { |
874 | } elsif ($text =~ /^\/(.*)/) { |
870 | $::CONN->user_send ($1); |
875 | $::CONN->user_send ($1); |
871 | } else { |
876 | } else { |
872 | my $say_cmd = $::CFG->{say_command} || 'say'; |
877 | my $say_cmd = $::CFG->{say_command} || 'say'; |
873 | $::CONN->user_send ("$say_cmd $text"); |
878 | $::CONN->user_send ("$say_cmd $text"); |
874 | } |
879 | } |
… | |
… | |
952 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
957 | $vb2->add ($INVR = new CFClient::UI::Inventory expand => 1); |
953 | |
958 | |
954 | $invwin |
959 | $invwin |
955 | } |
960 | } |
956 | |
961 | |
|
|
962 | sub make_binding_window { |
|
|
963 | my $binding_list = new CFClient::UI::VBox; |
|
|
964 | |
|
|
965 | my $refresh = sub { |
|
|
966 | $binding_list->clear (); |
|
|
967 | |
|
|
968 | for my $mod (keys %{$::CFG->{bindings}}) { |
|
|
969 | for my $sym (keys %{$::CFG->{bindings}->{$mod}}) { |
|
|
970 | my $cmds = $::CFG->{bindings}->{$mod}->{$sym}; |
|
|
971 | next unless ref $cmds eq 'ARRAY' and @$cmds > 0; |
|
|
972 | |
|
|
973 | my $lbl = join "; ", @$cmds; |
|
|
974 | my $nam = CFClient::Recorder::keycombo_to_name ($mod, $sym); |
|
|
975 | $binding_list->add (my $hb = new CFClient::UI::HBox); |
|
|
976 | $hb->add (new CFClient::UI::Button |
|
|
977 | text => "del", |
|
|
978 | on_activate => sub { |
|
|
979 | $binding_list->remove ($hb); |
|
|
980 | delete $::CFG->{bindings}->{$mod}->{$sym}; |
|
|
981 | }); |
|
|
982 | $hb->add (new CFClient::UI::Label text => "($nam)"); |
|
|
983 | $hb->add (new CFClient::UI::Label text => $lbl, expand => 1); |
|
|
984 | } |
|
|
985 | } |
|
|
986 | }; |
|
|
987 | |
|
|
988 | $BIND_WINDOW = new CFClient::UI::FancyFrame |
|
|
989 | title => "Bindings", |
|
|
990 | def_w => int $WIDTH * 7/8, |
|
|
991 | def_h => int $HEIGHT * 7/8, |
|
|
992 | on_visibility_change => sub { |
|
|
993 | my ($self, $visible) = @_; |
|
|
994 | if ($visible) { |
|
|
995 | $self->center; |
|
|
996 | $refresh->() |
|
|
997 | } |
|
|
998 | }; |
|
|
999 | |
|
|
1000 | $BIND_WINDOW->add ($binding_list); |
|
|
1001 | $refresh->(); |
|
|
1002 | $BIND_WINDOW |
|
|
1003 | } |
|
|
1004 | |
957 | sub make_help_window { |
1005 | sub make_help_window { |
958 | my $win = new CFClient::UI::FancyFrame |
1006 | my $win = new CFClient::UI::FancyFrame |
959 | def_w => int $WIDTH * 7/8, |
1007 | def_w => int $WIDTH * 7/8, |
960 | def_h => int $HEIGHT * 7/8, |
1008 | def_h => int $HEIGHT * 7/8, |
961 | title => "Documentation"; |
1009 | title => "Documentation"; |
… | |
… | |
1100 | }, |
1148 | }, |
1101 | ); |
1149 | ); |
1102 | |
1150 | |
1103 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, |
1151 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "Help!", other => make_help_window, |
1104 | tooltip => "View Documentation"); |
1152 | tooltip => "View Documentation"); |
|
|
1153 | |
|
|
1154 | $BUTTONBAR->add (new CFClient::UI::Flopper |
|
|
1155 | text => "Bindings", |
|
|
1156 | other => make_binding_window, |
|
|
1157 | tooltip => "Lets you delete bindings you have made with the recorder" |
|
|
1158 | ); |
|
|
1159 | $BUTTONBAR->add (new CFClient::UI::Flopper text => "[Rec]", other => CFClient::Recorder::make_window, |
|
|
1160 | tooltip => "This feature lets you record a series of actions (eg. walking a path or ready a skill) and bind them to keys"); |
1105 | |
1161 | |
1106 | $BUTTONBAR->add (new CFClient::UI::Button |
1162 | $BUTTONBAR->add (new CFClient::UI::Button |
1107 | text => "Quit", |
1163 | text => "Quit", |
1108 | tooltip => "Terminates the program", |
1164 | tooltip => "Terminates the program", |
1109 | on_activate => sub { |
1165 | on_activate => sub { |