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

Comparing deliantra/Deliantra-Client/DC/UI.pm (file contents):
Revision 1.272 by root, Sat Jun 3 01:47:14 2006 UTC vs.
Revision 1.279 by root, Mon Jun 5 00:17:47 2006 UTC

548 return if ($draw_x + $self->{w} < 0) || ($draw_x >= $draw_w) 548 return if ($draw_x + $self->{w} < 0) || ($draw_x >= $draw_w)
549 || ($draw_y + $self->{h} < 0) || ($draw_y >= $draw_h); 549 || ($draw_y + $self->{h} < 0) || ($draw_y >= $draw_h);
550 550
551 glPushMatrix; 551 glPushMatrix;
552 glTranslate $self->{x}, $self->{y}, 0; 552 glTranslate $self->{x}, $self->{y}, 0;
553 $self->_draw;
554 glPopMatrix;
555 553
556 if ($self == $HOVER && $self->{can_hover}) { 554 if ($self == $HOVER && $self->{can_hover}) {
557 my ($x, $y) = @$self{qw(x y)};
558
559 glColor 1, 0.8, 0.5, 0.2; 555 glColor 1*0.2, 0.8*0.2, 0.5*0.2, 0.2;
560 glEnable GL_BLEND; 556 glEnable GL_BLEND;
561 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 557 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
562 glBegin GL_QUADS; 558 glBegin GL_QUADS;
563 glVertex $x , $y; 559 glVertex 0 , 0;
564 glVertex $x + $self->{w}, $y; 560 glVertex $self->{w}, 0;
565 glVertex $x + $self->{w}, $y + $self->{h}; 561 glVertex $self->{w}, $self->{h};
566 glVertex $x , $y + $self->{h}; 562 glVertex 0 , $self->{h};
567 glEnd; 563 glEnd;
568 glDisable GL_BLEND; 564 glDisable GL_BLEND;
569 } 565 }
570 566
571 if ($ENV{CFPLUS_DEBUG} & 1) { 567 if ($ENV{CFPLUS_DEBUG} & 1) {
572 glPushMatrix; 568 glPushMatrix;
573 glColor 1, 1, 0, 1; 569 glColor 1, 1, 0, 1;
574 glTranslate $self->{x} + 0.375, $self->{y} + 0.375; 570 glTranslate 0.375, 0.375;
575 glBegin GL_LINE_LOOP; 571 glBegin GL_LINE_LOOP;
576 glVertex 0 , 0; 572 glVertex 0 , 0;
577 glVertex $self->{w} - 1, 0; 573 glVertex $self->{w} - 1, 0;
578 glVertex $self->{w} - 1, $self->{h} - 1; 574 glVertex $self->{w} - 1, $self->{h} - 1;
579 glVertex 0 , $self->{h} - 1; 575 glVertex 0 , $self->{h} - 1;
580 glEnd; 576 glEnd;
581 glPopMatrix; 577 glPopMatrix;
582 #CFClient::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw; 578 #CFClient::UI::Label->new (w => $self->{w}, h => $self->{h}, text => $self, fontsize => 0)->_draw;
583 } 579 }
580
581 $self->_draw;
582 glPopMatrix;
584} 583}
585 584
586sub _draw { 585sub _draw {
587 my ($self) = @_; 586 my ($self) = @_;
588 587
626 625
627 if ($color && (@$color < 4 || $color->[3])) { 626 if ($color && (@$color < 4 || $color->[3])) {
628 my ($w, $h) = @$self{qw(w h)}; 627 my ($w, $h) = @$self{qw(w h)};
629 628
630 glEnable GL_BLEND; 629 glEnable GL_BLEND;
631 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 630 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
632 glColor @$color; 631 glColor_premultiply @$color;
633 632
634 glBegin GL_QUADS; 633 glBegin GL_QUADS;
635 glVertex 0 , 0; 634 glVertex 0 , 0;
636 glVertex 0 , $h; 635 glVertex 0 , $h;
637 glVertex $w, $h; 636 glVertex $w, $h;
794 $self->{children}[0]->configure (0, 0, $w, $h); 793 $self->{children}[0]->configure (0, 0, $w, $h);
795} 794}
796 795
797############################################################################# 796#############################################################################
798 797
798# back-buffered drawing area
799
799package CFClient::UI::Window; 800package CFClient::UI::Window;
800 801
801our @ISA = CFClient::UI::Bin::; 802our @ISA = CFClient::UI::Bin::;
802 803
803use CFClient::OpenGL; 804use CFClient::OpenGL;
854 my $tex = $self->{texture} 855 my $tex = $self->{texture}
855 or return; 856 or return;
856 857
857 glEnable GL_TEXTURE_2D; 858 glEnable GL_TEXTURE_2D;
858 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 859 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
859 glColor 1, 1, 1, 1; 860 glColor 0, 0, 0, 1;
860 861
861 $tex->draw_quad_alpha_premultiplied (0, 0, $w, $h); 862 $tex->draw_quad_alpha_premultiplied (0, 0, $w, $h);
862 863
863 glDisable GL_TEXTURE_2D; 864 glDisable GL_TEXTURE_2D;
864} 865}
955package CFClient::UI::ScrolledWindow; 956package CFClient::UI::ScrolledWindow;
956 957
957our @ISA = CFClient::UI::HBox::; 958our @ISA = CFClient::UI::HBox::;
958 959
959sub new { 960sub new {
960 my $class = shift; 961 my ($class, %arg) = @_;
962
963 my $child = delete $arg{child};
961 964
962 my $self; 965 my $self;
963 966
964 my $slider = new CFClient::UI::Slider 967 my $slider = new CFClient::UI::Slider
965 vertical => 1, 968 vertical => 1,
970 ; 973 ;
971 974
972 $self = $class->SUPER::new ( 975 $self = $class->SUPER::new (
973 vp => (new CFClient::UI::ViewPort expand => 1), 976 vp => (new CFClient::UI::ViewPort expand => 1),
974 slider => $slider, 977 slider => $slider,
975 @_, 978 %arg,
976 ); 979 );
977 980
978 $self->{vp}->add ($self->{scrolled});
979 $self->add ($self->{vp});
980 $self->add ($self->{slider}); 981 $self->SUPER::add ($self->{vp}, $self->{slider});
982 $self->add ($child) if $child;
981 983
982 $self 984 $self
985}
986
987sub add {
988 my ($self, $widget) = @_;
989
990 $self->{vp}->add ($self->{child} = $widget);
983} 991}
984 992
985sub update { 993sub update {
986 my ($self) = @_; 994 my ($self) = @_;
987 995
1026 1034
1027 if ($self->{bg}) { 1035 if ($self->{bg}) {
1028 my ($w, $h) = @$self{qw(w h)}; 1036 my ($w, $h) = @$self{qw(w h)};
1029 1037
1030 glEnable GL_BLEND; 1038 glEnable GL_BLEND;
1031 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1039 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
1032 glColor @{ $self->{bg} }; 1040 glColor_premultiply @{ $self->{bg} };
1033 1041
1034 glBegin GL_QUADS; 1042 glBegin GL_QUADS;
1035 glVertex 0 , 0; 1043 glVertex 0 , 0;
1036 glVertex 0 , $h; 1044 glVertex 0 , $h;
1037 glVertex $w, $h; 1045 glVertex $w, $h;
1151 my $dy = $ev->{y} - $oy; 1159 my $dy = $ev->{y} - $oy;
1152 1160
1153 $self->{force_w} = $bw + $dx * ($mx ? -1 : 1); 1161 $self->{force_w} = $bw + $dx * ($mx ? -1 : 1);
1154 $self->{force_h} = $bh + $dy * ($my ? -1 : 1); 1162 $self->{force_h} = $bh + $dy * ($my ? -1 : 1);
1155 1163
1164 $self->move_abs ($wx + $dx * $mx, $wy + $dy * $my);
1156 $self->realloc; 1165 $self->realloc;
1157 $self->move_abs ($wx + $dx * $mx, $wy + $dy * $my);
1158 }; 1166 };
1159 1167
1160 } elsif ($lr ^ $td) { 1168 } elsif ($lr ^ $td) {
1161 my ($ox, $oy) = ($ev->{x}, $ev->{y}); 1169 my ($ox, $oy) = ($ev->{x}, $ev->{y});
1162 my ($bx, $by) = ($self->{x}, $self->{y}); 1170 my ($bx, $by) = ($self->{x}, $self->{y});
1165 my ($ev, $x, $y) = @_; 1173 my ($ev, $x, $y) = @_;
1166 1174
1167 ($x, $y) = ($ev->{x}, $ev->{y}); 1175 ($x, $y) = ($ev->{x}, $ev->{y});
1168 1176
1169 $self->move_abs ($bx + $x - $ox, $by + $y - $oy); 1177 $self->move_abs ($bx + $x - $ox, $by + $y - $oy);
1178 # HACK: the next line is required to enforce placement
1179 $self->{parent}->size_allocate ($self->{parent}{w}, $self->{parent}{h});
1170 }; 1180 };
1171 } else { 1181 } else {
1172 return 0; 1182 return 0;
1173 } 1183 }
1174 1184
1625 }; 1635 };
1626 1636
1627 glEnable GL_TEXTURE_2D; 1637 glEnable GL_TEXTURE_2D;
1628 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1638 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1629 1639
1640 glColor_premultiply @{$self->{fg}}
1630 if ($tex->{format} == GL_ALPHA) { 1641 if $tex->{format} == GL_ALPHA;
1631 glColor @{$self->{fg}}; 1642
1632 $tex->draw_quad_alpha ($self->{ox}, $self->{oy});
1633 } else {
1634 $tex->draw_quad_alpha_premultiplied ($self->{ox}, $self->{oy}); 1643 $tex->draw_quad_alpha_premultiplied ($self->{ox}, $self->{oy});
1635 }
1636 1644
1637 glDisable GL_TEXTURE_2D; 1645 glDisable GL_TEXTURE_2D;
1638} 1646}
1639 1647
1640############################################################################# 1648#############################################################################
1667 1675
1668 delete $self->{cur_h}; 1676 delete $self->{cur_h};
1669 1677
1670 return if $self->{text} eq $text; 1678 return if $self->{text} eq $text;
1671 1679
1672 delete $self->{texture};
1673
1674 $self->{last_activity} = $::NOW; 1680 $self->{last_activity} = $::NOW;
1675 $self->{text} = $text; 1681 $self->{text} = $text;
1676 1682
1677 $text =~ s/./*/g if $self->{hidden}; 1683 $text =~ s/./*/g if $self->{hidden};
1678 $self->{layout}->set_text ("$text "); 1684 $self->{layout}->set_text ("$text ");
1679 1685
1680 $self->_emit (changed => $self->{text}); 1686 $self->_emit (changed => $self->{text});
1687 $self->update;
1681} 1688}
1682 1689
1683sub set_text { 1690sub set_text {
1684 my ($self, $text) = @_; 1691 my ($self, $text) = @_;
1685 1692
1774 my ($self) = @_; 1781 my ($self) = @_;
1775 1782
1776 local $self->{fg} = $self->{fg}; 1783 local $self->{fg} = $self->{fg};
1777 1784
1778 if ($FOCUS == $self) { 1785 if ($FOCUS == $self) {
1779 glColor @{$self->{active_bg}}; 1786 glColor_premultiply @{$self->{active_bg}};
1780 $self->{fg} = $self->{active_fg}; 1787 $self->{fg} = $self->{active_fg};
1781 } else { 1788 } else {
1782 glColor @{$self->{bg}}; 1789 glColor_premultiply @{$self->{bg}};
1783 } 1790 }
1784 1791
1785 glEnable GL_BLEND; 1792 glEnable GL_BLEND;
1786 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1793 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
1787 glBegin GL_QUADS; 1794 glBegin GL_QUADS;
1788 glVertex 0 , 0; 1795 glVertex 0 , 0;
1789 glVertex 0 , $self->{h}; 1796 glVertex 0 , $self->{h};
1790 glVertex $self->{w}, $self->{h}; 1797 glVertex $self->{w}, $self->{h};
1791 glVertex $self->{w}, 0; 1798 glVertex $self->{w}, 0;
1901} 1908}
1902 1909
1903sub _draw { 1910sub _draw {
1904 my ($self) = @_; 1911 my ($self) = @_;
1905 1912
1906 local $self->{fg} = $self->{fg}; 1913 local $self->{fg} = $GRAB == $self ? $self->{active_fg} : $self->{fg};
1907
1908 if ($GRAB == $self) {
1909 $self->{fg} = $self->{active_fg};
1910 }
1911 1914
1912 glEnable GL_TEXTURE_2D; 1915 glEnable GL_TEXTURE_2D;
1913 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 1916 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
1914 glColor 0, 0, 0, 1; 1917 glColor 0, 0, 0, 1;
1915 1918
2140 2143
2141 my $h1 = $self->{h} * (1 - $ycut1); 2144 my $h1 = $self->{h} * (1 - $ycut1);
2142 my $h2 = $self->{h} * (1 - $ycut2); 2145 my $h2 = $self->{h} * (1 - $ycut2);
2143 2146
2144 glEnable GL_BLEND; 2147 glEnable GL_BLEND;
2145 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 2148 glBlendFuncSeparate GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
2149 GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
2146 glEnable GL_TEXTURE_2D; 2150 glEnable GL_TEXTURE_2D;
2147 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 2151 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
2148 2152
2149 glBindTexture GL_TEXTURE_2D, $t1->{name}; 2153 glBindTexture GL_TEXTURE_2D, $t1->{name};
2150 glBegin GL_QUADS; 2154 glBegin GL_QUADS;
2335} 2339}
2336 2340
2337sub update { 2341sub update {
2338 my ($self) = @_; 2342 my ($self) = @_;
2339 2343
2340 $CFClient::UI::ROOT->on_post_alloc ($self => sub { 2344 delete $self->{knob_w};
2345 $self->SUPER::update;
2346}
2347
2348sub _draw {
2349 my ($self) = @_;
2350
2351 unless ($self->{knob_w}) {
2341 $self->set_value ($self->{range}[0]); 2352 $self->set_value ($self->{range}[0]);
2342 2353
2343 my ($value, $lo, $hi, $page) = @{$self->{range}}; 2354 my ($value, $lo, $hi, $page) = @{$self->{range}};
2344 my $range = ($hi - $page - $lo) || 1e-100; 2355 my $range = ($hi - $page - $lo) || 1e-100;
2345 2356
2351 $value = ($value - $lo) / $range; 2362 $value = ($value - $lo) / $range;
2352 $value = $value * $self->{scale} + $self->{offset}; 2363 $value = $value * $self->{scale} + $self->{offset};
2353 2364
2354 $self->{knob_x} = $value - $knob_w * 0.5; 2365 $self->{knob_x} = $value - $knob_w * 0.5;
2355 $self->{knob_w} = $knob_w; 2366 $self->{knob_w} = $knob_w;
2356 }); 2367 }
2357
2358 $self->SUPER::update;
2359}
2360
2361sub _draw {
2362 my ($self) = @_;
2363 2368
2364 $self->SUPER::_draw (); 2369 $self->SUPER::_draw ();
2365 2370
2366 glScale $self->{w}, $self->{h}; 2371 glScale $self->{w}, $self->{h};
2367 2372
2561 2566
2562 delete $self->{texture}; 2567 delete $self->{texture};
2563 } 2568 }
2564 2569
2565 $self->{texture} ||= new_from_opengl CFClient::Texture $W, $H, sub { 2570 $self->{texture} ||= new_from_opengl CFClient::Texture $W, $H, sub {
2566 glClearColor 0.5, 0.5, 0.5, 0; 2571 glClearColor 0, 0, 0, 0;
2567 glClear GL_COLOR_BUFFER_BIT; 2572 glClear GL_COLOR_BUFFER_BIT;
2568 2573
2569 my $top = int $self->{children}[1]{range}[0]; 2574 my $top = int $self->{children}[1]{range}[0];
2570 2575
2571 my $y0 = $top; 2576 my $y0 = $top;
2606sub _draw { 2611sub _draw {
2607 my ($self) = @_; 2612 my ($self) = @_;
2608 2613
2609 glEnable GL_TEXTURE_2D; 2614 glEnable GL_TEXTURE_2D;
2610 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 2615 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
2611 glColor 1, 1, 1, 1; 2616 glColor 0, 0, 0, 1;
2612 $self->{texture}->draw_quad_alpha (0, 0, $self->{children}[0]{w}, $self->{children}[0]{h}); 2617 $self->{texture}->draw_quad_alpha_premultiplied (0, 0, $self->{children}[0]{w}, $self->{children}[0]{h});
2613 glDisable GL_TEXTURE_2D; 2618 glDisable GL_TEXTURE_2D;
2614 2619
2615 $self->{children}[1]->draw; 2620 $self->{children}[1]->draw;
2616 2621
2617} 2622}
2844 my $tex = $::CONN->{texture}[$::CONN->{faceid}[$face || $self->{face}]]; 2849 my $tex = $::CONN->{texture}[$::CONN->{faceid}[$face || $self->{face}]];
2845 2850
2846 if ($tex) { 2851 if ($tex) {
2847 glEnable GL_TEXTURE_2D; 2852 glEnable GL_TEXTURE_2D;
2848 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 2853 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
2849 glColor 1, 1, 1, 1; 2854 glColor 0, 0, 0, 1;
2850 $tex->draw_quad_alpha (0, 0, $self->{w}, $self->{h}); 2855 $tex->draw_quad_alpha (0, 0, $self->{w}, $self->{h});
2851 glDisable GL_TEXTURE_2D; 2856 glDisable GL_TEXTURE_2D;
2852 } 2857 }
2853} 2858}
2854 2859
3022 my $class = shift; 3027 my $class = shift;
3023 3028
3024 my $self = $class->SUPER::new ( 3029 my $self = $class->SUPER::new (
3025 buttonbar => (new CFClient::UI::Buttonbar), 3030 buttonbar => (new CFClient::UI::Buttonbar),
3026 multiplexer => (new CFClient::UI::Multiplexer expand => 1), 3031 multiplexer => (new CFClient::UI::Multiplexer expand => 1),
3032 # filter => # will be put between multiplexer and $self
3027 @_, 3033 @_,
3028 ); 3034 );
3029 3035
3036 $self->{filter}->add ($self->{multiplexer}) if $self->{filter};
3030 $self->SUPER::add ($self->{buttonbar}, $self->{multiplexer}); 3037 $self->SUPER::add ($self->{buttonbar}, $self->{filter} || $self->{multiplexer});
3031 3038
3032 $self 3039 $self
3033} 3040}
3034 3041
3035sub add { 3042sub add {
3171 3178
3172sub new { 3179sub new {
3173 my $class = shift; 3180 my $class = shift;
3174 3181
3175 my $self = $class->SUPER::new ( 3182 my $self = $class->SUPER::new (
3176 scrolled => (new CFClient::UI::Table col_expand => [0, 1, 0]), 3183 child => (new CFClient::UI::Table col_expand => [0, 1, 0]),
3177 @_, 3184 @_,
3178 ); 3185 );
3179 3186
3180 $self 3187 $self
3181} 3188}
3182 3189
3183sub set_items { 3190sub set_items {
3184 my ($self, $items) = @_; 3191 my ($self, $items) = @_;
3185 3192
3186 $self->{scrolled}->clear; 3193 $self->{child}->clear;
3187 return unless $items; 3194 return unless $items;
3188 3195
3189 my @items = sort { 3196 my @items = sort {
3190 ($a->{type} <=> $b->{type}) 3197 ($a->{type} <=> $b->{type})
3191 or ($a->{name} cmp $b->{name}) 3198 or ($a->{name} cmp $b->{name})
3195 3202
3196 my $row = 0; 3203 my $row = 0;
3197 for my $item (@items) { 3204 for my $item (@items) {
3198 CFClient::Item::update_widgets $item; 3205 CFClient::Item::update_widgets $item;
3199 3206
3200 $self->{scrolled}->add (0, $row, $item->{face_widget}); 3207 $self->{child}->add (0, $row, $item->{face_widget});
3201 $self->{scrolled}->add (1, $row, $item->{desc_widget}); 3208 $self->{child}->add (1, $row, $item->{desc_widget});
3202 $self->{scrolled}->add (2, $row, $item->{weight_widget}); 3209 $self->{child}->add (2, $row, $item->{weight_widget});
3203 3210
3204 $row++; 3211 $row++;
3205 } 3212 }
3206} 3213}
3207 3214
3404 3411
3405############################################################################# 3412#############################################################################
3406 3413
3407package CFClient::UI::SpellList; 3414package CFClient::UI::SpellList;
3408 3415
3409our @ISA = CFClient::UI::ScrolledWindow::; 3416our @ISA = CFClient::UI::Table::;
3410 3417
3411sub new { 3418sub new {
3412 my $class = shift; 3419 my $class = shift;
3413 3420
3414 my $self = $class->SUPER::new ( 3421 my $self = $class->SUPER::new (
3415 binding => [], 3422 binding => [],
3416 commands => [], 3423 commands => [],
3417 scrolled => (new CFClient::UI::Table),
3418 @_, 3424 @_,
3419 ) 3425 )
3420} 3426}
3421 3427
3422# XXX: Do sorting? Argl... 3428# XXX: Do sorting? Argl...
3423sub add_spell { 3429sub add_spell {
3424 my ($self, $spell) = @_; 3430 my ($self, $spell) = @_;
3425 $self->{spells}->{$spell->{name}} = $spell; 3431 $self->{spells}->{$spell->{name}} = $spell;
3426 3432
3427 $self->{scrolled}->add (0, $self->{tbl_idx}, new CFClient::UI::Face 3433 $self->add (0, $self->{tbl_idx}, new CFClient::UI::Face
3428 face => $spell->{face}, 3434 face => $spell->{face},
3429 can_hover => 1, 3435 can_hover => 1,
3430 can_events => 1, 3436 can_events => 1,
3431 tooltip => $spell->{message}); 3437 tooltip => $spell->{message});
3432 3438
3433 $self->{scrolled}->add (1, $self->{tbl_idx}, new CFClient::UI::Label 3439 $self->add (1, $self->{tbl_idx}, new CFClient::UI::Label
3434 text => $spell->{name}, 3440 text => $spell->{name},
3435 can_hover => 1, 3441 can_hover => 1,
3436 can_events => 1, 3442 can_events => 1,
3437 tooltip => $spell->{message}, 3443 tooltip => $spell->{message},
3438 expand => 1); 3444 expand => 1);
3439 3445
3440 $self->{scrolled}->add (2, $self->{tbl_idx}, new CFClient::UI::Label 3446 $self->add (2, $self->{tbl_idx}, new CFClient::UI::Label
3441 text => (sprintf "lvl: %2d sp: %2d dmg: %2d", 3447 text => (sprintf "lvl: %2d sp: %2d dmg: %2d",
3442 $spell->{level}, ($spell->{mana} || $spell->{grace}), $spell->{damage}), 3448 $spell->{level}, ($spell->{mana} || $spell->{grace}), $spell->{damage}),
3443 expand => 1); 3449 expand => 1);
3444 3450
3445 $self->{scrolled}->add (3, $self->{tbl_idx}++, new CFClient::UI::Button 3451 $self->add (3, $self->{tbl_idx}++, new CFClient::UI::Button
3446 text => "bind to key", 3452 text => "bind to key",
3447 on_activate => sub { $::BIND_EDITOR->do_quick_binding (["cast $spell->{name}"]) }); 3453 on_activate => sub { $::BIND_EDITOR->do_quick_binding (["cast $spell->{name}"]) });
3448} 3454}
3449 3455
3450sub rebuild_spell_list { 3456sub rebuild_spell_list {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines