… | |
… | |
5 | |
5 | |
6 | our @ISA = CFPlus::UI::Toplevel::; |
6 | our @ISA = CFPlus::UI::Toplevel::; |
7 | |
7 | |
8 | sub new { |
8 | sub new { |
9 | my $class = shift; |
9 | my $class = shift; |
|
|
10 | |
10 | my $self = $class->SUPER::new ( |
11 | my $self = $class->SUPER::new ( |
11 | name => "message_window", |
12 | name => "message_window", |
12 | title => "Messages", |
13 | title => "Messages", |
13 | border_bg => [1, 1, 1, 1], |
14 | border_bg => [1, 1, 1, 1], |
14 | x => "max", |
15 | x => "max", |
… | |
… | |
16 | force_w => $::WIDTH * 0.4, |
17 | force_w => $::WIDTH * 0.4, |
17 | force_h => $::HEIGHT * 0.5, |
18 | force_h => $::HEIGHT * 0.5, |
18 | child => (my $vbox = new CFPlus::UI::VBox), |
19 | child => (my $vbox = new CFPlus::UI::VBox), |
19 | has_close_button => 1 |
20 | has_close_button => 1 |
20 | ); |
21 | ); |
|
|
22 | |
21 | my $nb = $self->{nb} = CFPlus::UI::Notebook->new (expand => 1); |
23 | my $nb = $self->{nb} = CFPlus::UI::Notebook->new (expand => 1); |
22 | my $txt = $self->{log} = new CFPlus::UI::TextScroller |
24 | my $txt = $self->{log} = new CFPlus::UI::TextScroller |
23 | expand => 1, |
25 | expand => 1, |
24 | font => $::FONT_FIXED, |
26 | font => $::FONT_FIXED, |
25 | fontsize => $::CFG->{log_fontsize}, |
27 | fontsize => $::CFG->{log_fontsize}, |
… | |
… | |
27 | can_hover => 1, |
29 | can_hover => 1, |
28 | can_events => 1, |
30 | can_events => 1, |
29 | max_par => $::CFG->{logview_max_par}, |
31 | max_par => $::CFG->{logview_max_par}, |
30 | tooltip => "<b>Server Log</b>. This text viewer contains all recent messages sent by the server.", |
32 | tooltip => "<b>Server Log</b>. This text viewer contains all recent messages sent by the server.", |
31 | ; |
33 | ; |
|
|
34 | |
32 | my $vb2 = CFPlus::UI::VBox->new; |
35 | my $vb2 = CFPlus::UI::VBox->new; |
33 | $vb2->add ($txt); |
36 | $vb2->add ($txt); |
34 | $nb->add ("Log", $vb2, "This is the main log of the server."); |
37 | $nb->add_tab (Log => $vb2, "This is the main log of the server."); |
35 | $vbox->add ($nb); |
38 | $vbox->add ($nb); |
36 | |
39 | |
37 | $vbox->add ($self->{input} = CFPlus::UI::Entry->new ( |
40 | $vbox->add ($self->{input} = CFPlus::UI::Entry->new ( |
38 | tooltip => "<b>Chat Box</b>. If you enter a text and press return/enter here, the current <i>communication command</i> " |
41 | tooltip => "<b>Chat Box</b>. If you enter a text and press return/enter here, the current <i>communication command</i> " |
39 | . "from the client setup will be prepended (e.g. <b>shout</b>, <b>chat</b>...). " |
42 | . "from the client setup will be prepended (e.g. <b>shout</b>, <b>chat</b>...). " |
… | |
… | |
90 | $log->scroll_to_bottom; |
93 | $log->scroll_to_bottom; |
91 | } |
94 | } |
92 | |
95 | |
93 | sub activate_console { |
96 | sub activate_console { |
94 | my ($self, $preset) = @_; |
97 | my ($self, $preset) = @_; |
|
|
98 | |
95 | $self->{input}->{auto_activated} = 1; |
99 | $self->{input}->{auto_activated} = 1; |
96 | $self->{input}->grab_focus; |
100 | $self->{input}->grab_focus; |
|
|
101 | |
97 | if ($preset && $self->{input}->get_text eq '') { |
102 | if ($preset && $self->{input}->get_text eq '') { |
98 | $self->{input}->set_text ($preset); |
103 | $self->{input}->set_text ($preset); |
99 | } |
104 | } |
100 | } |
105 | } |
101 | |
106 | |
… | |
… | |
104 | $self->{log}->set_fontsize ($size); |
109 | $self->{log}->set_fontsize ($size); |
105 | } |
110 | } |
106 | |
111 | |
107 | sub set_max_para { |
112 | sub set_max_para { |
108 | my ($self, $max_par) = @_; |
113 | my ($self, $max_par) = @_; |
109 | $self->{log}->{max_par} = $max_par; |
114 | $self->{log}{max_par} = $max_par; |
110 | } |
115 | } |
|
|
116 | |
|
|
117 | 1; |
|
|
118 | |