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.7 by elmex, Wed Jul 25 16:03:08 2007 UTC vs.
Revision 1.8 by elmex, Fri Jul 27 17:24:29 2007 UTC

27 force_h => $::HEIGHT * 0.5, 27 force_h => $::HEIGHT * 0.5,
28 child => (my $nb = CFPlus::UI::Notebook->new (expand => 1)), 28 child => (my $nb = CFPlus::UI::Notebook->new (expand => 1)),
29 has_close_button => 1 29 has_close_button => 1
30 ); 30 );
31 31
32 $nb->add_tab (
33 "Log",
34 $self->{main_log} = CFPlus::UI::ChatView->new (expand => 1, say_command => ''),
35 "This is the main log of the server."
36 );
37
38 $self->{nb} = $nb; 32 $self->{nb} = $nb;
39 $self->{chatviews} = {}; 33 $self->{chatviews} = {};
34
35 $nb->connect (page_changed => sub {
36 my ($nb, $page) = @_;
37 $self->update_current_tab ($page);
38 });
39
40 my $l = $self->{main_log} =
41 CFPlus::UI::ChatView->new (expand => 1, say_command => '');
42 $l->{_tab_button} =
43 $l->{c_tab} =
44 CFPlus::UI::Button->new (
45 markup => "Log", tooltip => "This is the main log of the server."
46 );
47
48 $nb->add ($l);
49 $self->update_current_tab ($l);
40 50
41 $self 51 $self
42} 52}
43 53
44sub add_chat { 54sub add_chat {
65 my $b = CFPlus::UI::Label->new ( 75 my $b = CFPlus::UI::Label->new (
66 expand => 1, markup => $chaninfo->{title}, valign => 0, align => 0 76 expand => 1, markup => $chaninfo->{title}, valign => 0, align => 0
67 ) 77 )
68 ); 78 );
69 79
80 $cv->{_chat_id} = $id;
70 $cv->{_tab_button} = $b; 81 $cv->{_tab_button} = $b;
71 weaken $cv->{_tab_button}; 82 weaken $cv->{_tab_button};
72 83
73 $vb->add ( 84 $vb->add (
74 my $b = CFPlus::UI::ImageButton->new ( 85 my $b = CFPlus::UI::ImageButton->new (
108} 119}
109 120
110sub highlight_channel { 121sub highlight_channel {
111 my ($self, $id) = @_; 122 my ($self, $id) = @_;
112 my $cv = $self->{chatviews}->{$id}; 123 my $cv = $self->{chatviews}->{$id};
124 $cv->{_channel_highlighted} = 1;
113 my $tab = $cv->{_tab_button}; 125 my $tab = $cv->{_tab_button};
114 $tab->set_markup ("<span foreground='#ff0000'>" . $self->{channel_info}->{$id}->{title} . "</span>"); 126 $tab->set_markup (
127 "<span foreground='#ff0000'>"
128 .$self->{channel_info}->{$id}->{title}
129 ."</span>"
130 );
115} 131}
116 132
117sub unhighlight_channel { 133sub unhighlight_channel {
118 my ($self, $id) = @_; 134 my ($self, $id) = @_;
135
119 my $cv = $self->{chatviews}->{$id}; 136 my $cv = $self->{chatviews}->{$id};
137 $cv->{_channel_highlighted} = 0;
120 my $tab = $cv->{_tab_button}; 138 my $tab = $cv->{_tab_button};
139 $tab->set_markup (
140 "<span foreground='#ffff00'><b>"
121 $tab->set_markup ($self->{channel_info}->{$id}->{title}); 141 .$self->{channel_info}->{$id}->{title}
142 ."</b></span>"
143 );
144}
145
146sub update_current_tab {
147 my ($self, $page) = @_;
148 my $tab = $page->{_tab_button};
149 my $label = $self->{channel_info}->{$page->{_chat_id}}->{title};
150 $label = "Log" unless defined $label;
151 $tab->set_markup (
152 "<span foreground='#ffff00'><b>"
153 .$label
154 ."</b></span>"
155 );
156
157 for ($self->{nb}->pages) {
158 next if $_ eq $page;
159 my $tab = $_->{_tab_button};
160 next if $_->{_channel_highlighted};
161 next unless $tab;
162
163 my $label = $self->{channel_info}->{$_->{_chat_id}}->{title};
164 $label = "Log" unless defined $label;
165
166 $tab->set_markup (
167 "<span foreground='#ffffff'>"
168 .$label
169 ."</span>"
170 );
171 }
122} 172}
123 173
124sub add_channel { 174sub add_channel {
125 my ($self, $info) = @_; 175 my ($self, $info) = @_;
126 $self->{channel_info}->{$info->{id}} = $info; 176 $self->{channel_info}->{$info->{id}} = $info;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines