ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra-Client/DC/UI/MessageWindow.pm
(Generate patch)

Comparing deliantra/Deliantra-Client/DC/UI/MessageWindow.pm (file contents):
Revision 1.25 by root, Wed Dec 26 18:09:30 2007 UTC vs.
Revision 1.26 by root, Wed Dec 26 20:46:40 2007 UTC

1package CFPlus::UI::MessageWindow; 1package dc::UI::MessageWindow;
2 2
3use strict; 3use strict;
4use utf8; 4use utf8;
5 5
6use Scalar::Util qw/weaken/; 6use Scalar::Util qw/weaken/;
7use CFPlus::UI::ChatView; 7use dc::UI::ChatView;
8use Deliantra::Protocol::Constants; 8use Deliantra::Protocol::Constants;
9 9
10our @ISA = CFPlus::UI::Toplevel::; 10our @ISA = dc::UI::Toplevel::;
11 11
12our %channel_info; 12our %channel_info;
13 13
14sub clr_def($) { "<span foreground=\"#ffffff\">$_[0]</span>" } 14sub clr_def($) { "<span foreground=\"#ffffff\">$_[0]</span>" }
15sub clr_act($) { "<span foreground=\"#ffffff\">$_[0]</span>" } 15sub clr_act($) { "<span foreground=\"#ffffff\">$_[0]</span>" }
25 border_bg => [1, 1, 1, 1], 25 border_bg => [1, 1, 1, 1],
26 x => "max", 26 x => "max",
27 y => 0, 27 y => 0,
28 force_w => $::WIDTH * 0.4, 28 force_w => $::WIDTH * 0.4,
29 force_h => $::HEIGHT * 0.5, 29 force_h => $::HEIGHT * 0.5,
30 child => (my $nb = CFPlus::UI::Notebook->new (expand => 1)), 30 child => (my $nb = dc::UI::Notebook->new (expand => 1)),
31 has_close_button => 1 31 has_close_button => 1
32 ); 32 );
33 33
34 $self->{nb} = $nb; 34 $self->{nb} = $nb;
35 $self->{chatviews} = {}; 35 $self->{chatviews} = {};
41 $nb->connect (c_add => sub { 41 $nb->connect (c_add => sub {
42 $self->update_tabs; 42 $self->update_tabs;
43 }); 43 });
44 44
45 my $l = $self->{main_log} = 45 my $l = $self->{main_log} =
46 CFPlus::UI::ChatView->new (expand => 1, say_command => ''); 46 dc::UI::ChatView->new (expand => 1, say_command => '');
47 47
48 $l->{_tab_label} = 48 $l->{_tab_label} =
49 $l->{c_tab} = 49 $l->{c_tab} =
50 CFPlus::UI::Button->new ( 50 dc::UI::Button->new (
51 markup => "Log", tooltip => "This is the main log of the server." 51 markup => "Log", tooltip => "This is the main log of the server."
52 ); 52 );
53 53
54 $nb->add ($l); 54 $nb->add ($l);
55 $nb->set_current_page ($l); 55 $nb->set_current_page ($l);
63 my $chatviews = $self->{chatviews}; 63 my $chatviews = $self->{chatviews};
64 my $chaninfo = $self->{channel_info}->{$id}; 64 my $chaninfo = $self->{channel_info}->{$id};
65 my $nb = $self->{nb}; 65 my $nb = $self->{nb};
66 66
67 my $cv = $chatviews->{$id} = 67 my $cv = $chatviews->{$id} =
68 CFPlus::UI::ChatView->new ( 68 dc::UI::ChatView->new (
69 expand => 1, 69 expand => 1,
70 say_command => $chaninfo->{reply}, 70 say_command => $chaninfo->{reply},
71 entry_tooltip => $chaninfo->{tooltip}, 71 entry_tooltip => $chaninfo->{tooltip},
72 text_tooltip => "Conversation with $chaninfo->{title}" 72 text_tooltip => "Conversation with $chaninfo->{title}"
73 ); 73 );
74 74
75 my $bb = CFPlus::UI::ButtonBin->new (tooltip => $chaninfo->{tooltip}); 75 my $bb = dc::UI::ButtonBin->new (tooltip => $chaninfo->{tooltip});
76 $cv->{c_tab} = $bb; 76 $cv->{c_tab} = $bb;
77 77
78 $bb->add (my $vb = CFPlus::UI::Box->new); 78 $bb->add (my $vb = dc::UI::Box->new);
79 $vb->add ( 79 $vb->add (
80 my $b = CFPlus::UI::Label->new ( 80 my $b = dc::UI::Label->new (
81 expand => 1, markup => clr_def ($chaninfo->{title}), valign => 0, align => 0 81 expand => 1, markup => clr_def ($chaninfo->{title}), valign => 0, align => 0
82 ) 82 )
83 ); 83 );
84 84
85 $cv->{_chat_id} = $id; 85 $cv->{_chat_id} = $id;
86 $cv->{_tab_label} = $b; 86 $cv->{_tab_label} = $b;
87 weaken $cv->{_tab_label}; 87 weaken $cv->{_tab_label};
88 88
89 $vb->add ( 89 $vb->add (
90 my $b = CFPlus::UI::ImageButton->new ( 90 my $b = dc::UI::ImageButton->new (
91 path => 'x1_close.png', 91 path => 'x1_close.png',
92 scale => 0.3, 92 scale => 0.3,
93 ) 93 )
94 ); 94 );
95 $b->connect (activate => sub { 95 $b->connect (activate => sub {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines