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.271 by root, Fri Jun 2 22:13:47 2006 UTC vs.
Revision 1.278 by root, Sun Jun 4 23:05:06 2006 UTC

371sub size_allocate { 371sub size_allocate {
372 # nothing to be done 372 # nothing to be done
373} 373}
374 374
375sub children { 375sub children {
376 # nop
377}
378
379sub visible_children {
380 $_[0]->children
376} 381}
377 382
378sub set_max_size { 383sub set_max_size {
379 my ($self, $w, $h) = @_; 384 my ($self, $w, $h) = @_;
380 385
543 return if ($draw_x + $self->{w} < 0) || ($draw_x >= $draw_w) 548 return if ($draw_x + $self->{w} < 0) || ($draw_x >= $draw_w)
544 || ($draw_y + $self->{h} < 0) || ($draw_y >= $draw_h); 549 || ($draw_y + $self->{h} < 0) || ($draw_y >= $draw_h);
545 550
546 glPushMatrix; 551 glPushMatrix;
547 glTranslate $self->{x}, $self->{y}, 0; 552 glTranslate $self->{x}, $self->{y}, 0;
548 $self->_draw;
549 glPopMatrix;
550 553
551 if ($self == $HOVER && $self->{can_hover}) { 554 if ($self == $HOVER && $self->{can_hover}) {
552 my ($x, $y) = @$self{qw(x y)};
553
554 glColor 1, 0.8, 0.5, 0.2; 555 glColor 1*0.2, 0.8*0.2, 0.5*0.2, 0.2;
555 glEnable GL_BLEND; 556 glEnable GL_BLEND;
556 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 557 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
557 glBegin GL_QUADS; 558 glBegin GL_QUADS;
558 glVertex $x , $y; 559 glVertex 0 , 0;
559 glVertex $x + $self->{w}, $y; 560 glVertex $self->{w}, 0;
560 glVertex $x + $self->{w}, $y + $self->{h}; 561 glVertex $self->{w}, $self->{h};
561 glVertex $x , $y + $self->{h}; 562 glVertex 0 , $self->{h};
562 glEnd; 563 glEnd;
563 glDisable GL_BLEND; 564 glDisable GL_BLEND;
564 } 565 }
565 566
566 if ($ENV{CFPLUS_DEBUG} & 1) { 567 if ($ENV{CFPLUS_DEBUG} & 1) {
567 glPushMatrix; 568 glPushMatrix;
568 glColor 1, 1, 0, 1; 569 glColor 1, 1, 0, 1;
569 glTranslate $self->{x} + 0.375, $self->{y} + 0.375; 570 glTranslate 0.375, 0.375;
570 glBegin GL_LINE_LOOP; 571 glBegin GL_LINE_LOOP;
571 glVertex 0 , 0; 572 glVertex 0 , 0;
572 glVertex $self->{w} - 1, 0; 573 glVertex $self->{w} - 1, 0;
573 glVertex $self->{w} - 1, $self->{h} - 1; 574 glVertex $self->{w} - 1, $self->{h} - 1;
574 glVertex 0 , $self->{h} - 1; 575 glVertex 0 , $self->{h} - 1;
575 glEnd; 576 glEnd;
576 glPopMatrix; 577 glPopMatrix;
577 #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;
578 } 579 }
580
581 $self->_draw;
582 glPopMatrix;
579} 583}
580 584
581sub _draw { 585sub _draw {
582 my ($self) = @_; 586 my ($self) = @_;
583 587
621 625
622 if ($color && (@$color < 4 || $color->[3])) { 626 if ($color && (@$color < 4 || $color->[3])) {
623 my ($w, $h) = @$self{qw(w h)}; 627 my ($w, $h) = @$self{qw(w h)};
624 628
625 glEnable GL_BLEND; 629 glEnable GL_BLEND;
626 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 630 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
627 glColor @$color; 631 glColor_premultiply @$color;
628 632
629 glBegin GL_QUADS; 633 glBegin GL_QUADS;
630 glVertex 0 , 0; 634 glVertex 0 , 0;
631 glVertex 0 , $h; 635 glVertex 0 , $h;
632 glVertex $w, $h; 636 glVertex $w, $h;
663our @ISA = CFClient::UI::Base::; 667our @ISA = CFClient::UI::Base::;
664 668
665sub new { 669sub new {
666 my ($class, %arg) = @_; 670 my ($class, %arg) = @_;
667 671
668 my $children = delete $arg{children} || []; 672 my $children = delete $arg{children};
669 673
670 my $self = $class->SUPER::new ( 674 my $self = $class->SUPER::new (
671 children => [], 675 children => [],
672 can_events => 0, 676 can_events => 0,
673 %arg, 677 %arg,
674 ); 678 );
679
675 $self->add ($_) for @$children; 680 $self->add (@$children)
681 if $children;
676 682
677 $self 683 $self
678} 684}
679 685
680sub add { 686sub add {
728 $x -= $self->{x}; 734 $x -= $self->{x};
729 $y -= $self->{y}; 735 $y -= $self->{y};
730 736
731 my $res; 737 my $res;
732 738
733 for (reverse @{ $self->{children} }) { 739 for (reverse $self->visible_children) {
734 $res = $_->find_widget ($x, $y) 740 $res = $_->find_widget ($x, $y)
735 and return $res; 741 and return $res;
736 } 742 }
737 743
738 $self->SUPER::find_widget ($x + $self->{x}, $y + $self->{y}) 744 $self->SUPER::find_widget ($x + $self->{x}, $y + $self->{y})
787 $self->{children}[0]->configure (0, 0, $w, $h); 793 $self->{children}[0]->configure (0, 0, $w, $h);
788} 794}
789 795
790############################################################################# 796#############################################################################
791 797
798# back-buffered drawing area
799
792package CFClient::UI::Window; 800package CFClient::UI::Window;
793 801
794our @ISA = CFClient::UI::Bin::; 802our @ISA = CFClient::UI::Bin::;
795 803
796use CFClient::OpenGL; 804use CFClient::OpenGL;
847 my $tex = $self->{texture} 855 my $tex = $self->{texture}
848 or return; 856 or return;
849 857
850 glEnable GL_TEXTURE_2D; 858 glEnable GL_TEXTURE_2D;
851 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 859 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
860 glEnable GL_BLEND;
861 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
852 glColor 1, 1, 1, 1; 862 glColor 0, 0, 0, 1;
853 863
854 $tex->draw_quad_alpha_premultiplied (0, 0, $w, $h); 864 $tex->draw_quad (0, 0, $w, $h);
855 865
866 glDisable GL_BLEND;
856 glDisable GL_TEXTURE_2D; 867 glDisable GL_TEXTURE_2D;
857} 868}
858 869
859############################################################################# 870#############################################################################
860 871
948package CFClient::UI::ScrolledWindow; 959package CFClient::UI::ScrolledWindow;
949 960
950our @ISA = CFClient::UI::HBox::; 961our @ISA = CFClient::UI::HBox::;
951 962
952sub new { 963sub new {
953 my $class = shift; 964 my ($class, %arg) = @_;
965
966 my $child = delete $arg{child};
954 967
955 my $self; 968 my $self;
956 969
957 my $slider = new CFClient::UI::Slider 970 my $slider = new CFClient::UI::Slider
958 vertical => 1, 971 vertical => 1,
963 ; 976 ;
964 977
965 $self = $class->SUPER::new ( 978 $self = $class->SUPER::new (
966 vp => (new CFClient::UI::ViewPort expand => 1), 979 vp => (new CFClient::UI::ViewPort expand => 1),
967 slider => $slider, 980 slider => $slider,
968 @_, 981 %arg,
969 ); 982 );
970 983
971 $self->{vp}->add ($self->{scrolled});
972 $self->add ($self->{vp});
973 $self->add ($self->{slider}); 984 $self->SUPER::add ($self->{vp}, $self->{slider});
985 $self->add ($child) if $child;
974 986
975 $self 987 $self
988}
989
990sub add {
991 my ($self, $widget) = @_;
992
993 $self->{vp}->add ($self->{child} = $widget);
976} 994}
977 995
978sub update { 996sub update {
979 my ($self) = @_; 997 my ($self) = @_;
980 998
1019 1037
1020 if ($self->{bg}) { 1038 if ($self->{bg}) {
1021 my ($w, $h) = @$self{qw(w h)}; 1039 my ($w, $h) = @$self{qw(w h)};
1022 1040
1023 glEnable GL_BLEND; 1041 glEnable GL_BLEND;
1024 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1042 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
1025 glColor @{ $self->{bg} }; 1043 glColor_premultiply @{ $self->{bg} };
1026 1044
1027 glBegin GL_QUADS; 1045 glBegin GL_QUADS;
1028 glVertex 0 , 0; 1046 glVertex 0 , 0;
1029 glVertex 0 , $h; 1047 glVertex 0 , $h;
1030 glVertex $w, $h; 1048 glVertex $w, $h;
1144 my $dy = $ev->{y} - $oy; 1162 my $dy = $ev->{y} - $oy;
1145 1163
1146 $self->{force_w} = $bw + $dx * ($mx ? -1 : 1); 1164 $self->{force_w} = $bw + $dx * ($mx ? -1 : 1);
1147 $self->{force_h} = $bh + $dy * ($my ? -1 : 1); 1165 $self->{force_h} = $bh + $dy * ($my ? -1 : 1);
1148 1166
1167 $self->move_abs ($wx + $dx * $mx, $wy + $dy * $my);
1149 $self->realloc; 1168 $self->realloc;
1150 $self->move_abs ($wx + $dx * $mx, $wy + $dy * $my);
1151 }; 1169 };
1152 1170
1153 } elsif ($lr ^ $td) { 1171 } elsif ($lr ^ $td) {
1154 my ($ox, $oy) = ($ev->{x}, $ev->{y}); 1172 my ($ox, $oy) = ($ev->{x}, $ev->{y});
1155 my ($bx, $by) = ($self->{x}, $self->{y}); 1173 my ($bx, $by) = ($self->{x}, $self->{y});
1158 my ($ev, $x, $y) = @_; 1176 my ($ev, $x, $y) = @_;
1159 1177
1160 ($x, $y) = ($ev->{x}, $ev->{y}); 1178 ($x, $y) = ($ev->{x}, $ev->{y});
1161 1179
1162 $self->move_abs ($bx + $x - $ox, $by + $y - $oy); 1180 $self->move_abs ($bx + $x - $ox, $by + $y - $oy);
1181 # HACK: the next line is required to enforce placement
1182 $self->{parent}->size_allocate ($self->{parent}{w}, $self->{parent}{h});
1163 }; 1183 };
1164 } else { 1184 } else {
1165 return 0; 1185 return 0;
1166 } 1186 }
1167 1187
1660 1680
1661 delete $self->{cur_h}; 1681 delete $self->{cur_h};
1662 1682
1663 return if $self->{text} eq $text; 1683 return if $self->{text} eq $text;
1664 1684
1665 delete $self->{texture};
1666
1667 $self->{last_activity} = $::NOW; 1685 $self->{last_activity} = $::NOW;
1668 $self->{text} = $text; 1686 $self->{text} = $text;
1669 1687
1670 $text =~ s/./*/g if $self->{hidden}; 1688 $text =~ s/./*/g if $self->{hidden};
1671 $self->{layout}->set_text ("$text "); 1689 $self->{layout}->set_text ("$text ");
1672 1690
1673 $self->_emit (changed => $self->{text}); 1691 $self->_emit (changed => $self->{text});
1692 $self->update;
1674} 1693}
1675 1694
1676sub set_text { 1695sub set_text {
1677 my ($self, $text) = @_; 1696 my ($self, $text) = @_;
1678 1697
1767 my ($self) = @_; 1786 my ($self) = @_;
1768 1787
1769 local $self->{fg} = $self->{fg}; 1788 local $self->{fg} = $self->{fg};
1770 1789
1771 if ($FOCUS == $self) { 1790 if ($FOCUS == $self) {
1772 glColor @{$self->{active_bg}}; 1791 glColor_premultiply @{$self->{active_bg}};
1773 $self->{fg} = $self->{active_fg}; 1792 $self->{fg} = $self->{active_fg};
1774 } else { 1793 } else {
1775 glColor @{$self->{bg}}; 1794 glColor_premultiply @{$self->{bg}};
1776 } 1795 }
1777 1796
1778 glEnable GL_BLEND; 1797 glEnable GL_BLEND;
1779 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 1798 glBlendFunc GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
1780 glBegin GL_QUADS; 1799 glBegin GL_QUADS;
1781 glVertex 0 , 0; 1800 glVertex 0 , 0;
1782 glVertex 0 , $self->{h}; 1801 glVertex 0 , $self->{h};
1783 glVertex $self->{w}, $self->{h}; 1802 glVertex $self->{w}, $self->{h};
1784 glVertex $self->{w}, 0; 1803 glVertex $self->{w}, 0;
2133 2152
2134 my $h1 = $self->{h} * (1 - $ycut1); 2153 my $h1 = $self->{h} * (1 - $ycut1);
2135 my $h2 = $self->{h} * (1 - $ycut2); 2154 my $h2 = $self->{h} * (1 - $ycut2);
2136 2155
2137 glEnable GL_BLEND; 2156 glEnable GL_BLEND;
2138 glBlendFunc GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA; 2157 glBlendFuncSeparate GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
2158 GL_ONE, GL_ONE_MINUS_SRC_ALPHA;
2139 glEnable GL_TEXTURE_2D; 2159 glEnable GL_TEXTURE_2D;
2140 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE; 2160 glTexEnv GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE;
2141 2161
2142 glBindTexture GL_TEXTURE_2D, $t1->{name}; 2162 glBindTexture GL_TEXTURE_2D, $t1->{name};
2143 glBegin GL_QUADS; 2163 glBegin GL_QUADS;
2328} 2348}
2329 2349
2330sub update { 2350sub update {
2331 my ($self) = @_; 2351 my ($self) = @_;
2332 2352
2333 $CFClient::UI::ROOT->on_post_alloc ($self => sub { 2353 delete $self->{knob_w};
2354 $self->SUPER::update;
2355}
2356
2357sub _draw {
2358 my ($self) = @_;
2359
2360 unless ($self->{knob_w}) {
2334 $self->set_value ($self->{range}[0]); 2361 $self->set_value ($self->{range}[0]);
2335 2362
2336 my ($value, $lo, $hi, $page) = @{$self->{range}}; 2363 my ($value, $lo, $hi, $page) = @{$self->{range}};
2337 my $range = ($hi - $page - $lo) || 1e-100; 2364 my $range = ($hi - $page - $lo) || 1e-100;
2338 2365
2344 $value = ($value - $lo) / $range; 2371 $value = ($value - $lo) / $range;
2345 $value = $value * $self->{scale} + $self->{offset}; 2372 $value = $value * $self->{scale} + $self->{offset};
2346 2373
2347 $self->{knob_x} = $value - $knob_w * 0.5; 2374 $self->{knob_x} = $value - $knob_w * 0.5;
2348 $self->{knob_w} = $knob_w; 2375 $self->{knob_w} = $knob_w;
2349 }); 2376 }
2350
2351 $self->SUPER::update;
2352}
2353
2354sub _draw {
2355 my ($self) = @_;
2356 2377
2357 $self->SUPER::_draw (); 2378 $self->SUPER::_draw ();
2358 2379
2359 glScale $self->{w}, $self->{h}; 2380 glScale $self->{w}, $self->{h};
2360 2381
2854 $self->SUPER::DESTROY; 2875 $self->SUPER::DESTROY;
2855} 2876}
2856 2877
2857############################################################################# 2878#############################################################################
2858 2879
2880package CFClient::UI::Buttonbar;
2881
2882our @ISA = CFClient::UI::HBox::;
2883
2884# TODO: should actualyl wrap buttons and other goodies.
2885
2886#############################################################################
2887
2859package CFClient::UI::Menu; 2888package CFClient::UI::Menu;
2860 2889
2861our @ISA = CFClient::UI::FancyFrame::; 2890our @ISA = CFClient::UI::FancyFrame::;
2862 2891
2863use CFClient::OpenGL; 2892use CFClient::OpenGL;
2928 } else { 2957 } else {
2929 return 0 2958 return 0
2930 } 2959 }
2931 2960
2932 1 2961 1
2962}
2963
2964#############################################################################
2965
2966package CFClient::UI::Multiplexer;
2967
2968our @ISA = CFClient::UI::Container::;
2969
2970sub new {
2971 my $class = shift;
2972
2973 my $self = $class->SUPER::new (
2974 @_,
2975 );
2976
2977 $self->{current} = $self->{children}[0]
2978 if @{ $self->{children} };
2979
2980 $self
2981}
2982
2983sub add {
2984 my ($self, @widgets) = @_;
2985
2986 $self->SUPER::add (@widgets);
2987
2988 $self->{current} = $self->{children}[0]
2989 if @{ $self->{children} };
2990}
2991
2992sub set_current_page {
2993 my ($self, $page_or_widget) = @_;
2994
2995 my $widget = ref $page_or_widget
2996 ? $page_or_widget
2997 : $self->{children}[$page_or_widget];
2998
2999 $self->{current} = $widget;
3000 $self->{current}->configure (0, 0, $self->{w}, $self->{h});
3001
3002 $self->_emit (page_changed => $self->{current});
3003
3004 $self->realloc;
3005}
3006
3007sub visible_children {
3008 $_[0]{current}
3009}
3010
3011sub size_request {
3012 my ($self) = @_;
3013
3014 $self->{current}->size_request
3015}
3016
3017sub size_allocate {
3018 my ($self, $w, $h) = @_;
3019
3020 $self->{current}->configure (0, 0, $w, $h);
3021}
3022
3023sub _draw {
3024 my ($self) = @_;
3025
3026 $self->{current}->draw;
3027}
3028
3029#############################################################################
3030
3031package CFClient::UI::Notebook;
3032
3033our @ISA = CFClient::UI::VBox::;
3034
3035sub new {
3036 my $class = shift;
3037
3038 my $self = $class->SUPER::new (
3039 buttonbar => (new CFClient::UI::Buttonbar),
3040 multiplexer => (new CFClient::UI::Multiplexer expand => 1),
3041 # filter => # will be put between multiplexer and $self
3042 @_,
3043 );
3044
3045 $self->{filter}->add ($self->{multiplexer}) if $self->{filter};
3046 $self->SUPER::add ($self->{buttonbar}, $self->{filter} || $self->{multiplexer});
3047
3048 $self
3049}
3050
3051sub add {
3052 my ($self, $title, $widget, $tooltip) = @_;
3053
3054 Scalar::Util::weaken $self;
3055
3056 $self->{buttonbar}->add (new CFClient::UI::Button
3057 markup => $title,
3058 tooltip => $tooltip,
3059 on_activate => sub { $self->set_current_page ($widget) },
3060 );
3061
3062 $self->{multiplexer}->add ($widget);
3063}
3064
3065sub set_current_page {
3066 my ($self, $page) = @_;
3067
3068 $self->{multiplexer}->set_current_page ($page);
3069 $self->_emit (page_changed => $self->{multiplexer}{current});
2933} 3070}
2934 3071
2935############################################################################# 3072#############################################################################
2936 3073
2937package CFClient::UI::Statusbox; 3074package CFClient::UI::Statusbox;
3050 3187
3051sub new { 3188sub new {
3052 my $class = shift; 3189 my $class = shift;
3053 3190
3054 my $self = $class->SUPER::new ( 3191 my $self = $class->SUPER::new (
3055 scrolled => (new CFClient::UI::Table col_expand => [0, 1, 0]), 3192 child => (new CFClient::UI::Table col_expand => [0, 1, 0]),
3056 @_, 3193 @_,
3057 ); 3194 );
3058 3195
3059 $self 3196 $self
3060} 3197}
3061 3198
3062sub set_items { 3199sub set_items {
3063 my ($self, $items) = @_; 3200 my ($self, $items) = @_;
3064 3201
3065 $self->{scrolled}->clear; 3202 $self->{child}->clear;
3066 return unless $items; 3203 return unless $items;
3067 3204
3068 my @items = sort { 3205 my @items = sort {
3069 ($a->{type} <=> $b->{type}) 3206 ($a->{type} <=> $b->{type})
3070 or ($a->{name} cmp $b->{name}) 3207 or ($a->{name} cmp $b->{name})
3074 3211
3075 my $row = 0; 3212 my $row = 0;
3076 for my $item (@items) { 3213 for my $item (@items) {
3077 CFClient::Item::update_widgets $item; 3214 CFClient::Item::update_widgets $item;
3078 3215
3079 $self->{scrolled}->add (0, $row, $item->{face_widget}); 3216 $self->{child}->add (0, $row, $item->{face_widget});
3080 $self->{scrolled}->add (1, $row, $item->{desc_widget}); 3217 $self->{child}->add (1, $row, $item->{desc_widget});
3081 $self->{scrolled}->add (2, $row, $item->{weight_widget}); 3218 $self->{child}->add (2, $row, $item->{weight_widget});
3082 3219
3083 $row++; 3220 $row++;
3084 } 3221 }
3085} 3222}
3086 3223
3283 3420
3284############################################################################# 3421#############################################################################
3285 3422
3286package CFClient::UI::SpellList; 3423package CFClient::UI::SpellList;
3287 3424
3288our @ISA = CFClient::UI::FancyFrame::; 3425our @ISA = CFClient::UI::Table::;
3289 3426
3290sub new { 3427sub new {
3291 my $class = shift; 3428 my $class = shift;
3292 3429
3293 my $self = $class->SUPER::new (binding => [], commands => [], @_); 3430 my $self = $class->SUPER::new (
3294 3431 binding => [],
3295 $self->add (new CFClient::UI::ScrolledWindow 3432 commands => [],
3296 scrolled => $self->{spellbox} = new CFClient::UI::Table); 3433 @_,
3297 3434 )
3298 $self;
3299} 3435}
3300 3436
3301# XXX: Do sorting? Argl... 3437# XXX: Do sorting? Argl...
3302sub add_spell { 3438sub add_spell {
3303 my ($self, $spell) = @_; 3439 my ($self, $spell) = @_;
3304 $self->{spells}->{$spell->{name}} = $spell; 3440 $self->{spells}->{$spell->{name}} = $spell;
3305 3441
3306 $self->{spellbox}->add (0, $self->{tbl_idx}, new CFClient::UI::Face 3442 $self->add (0, $self->{tbl_idx}, new CFClient::UI::Face
3307 face => $spell->{face}, 3443 face => $spell->{face},
3308 can_hover => 1, 3444 can_hover => 1,
3309 can_events => 1, 3445 can_events => 1,
3310 tooltip => $spell->{message}); 3446 tooltip => $spell->{message});
3311 3447
3312 $self->{spellbox}->add (1, $self->{tbl_idx}, new CFClient::UI::Label 3448 $self->add (1, $self->{tbl_idx}, new CFClient::UI::Label
3313 text => $spell->{name}, 3449 text => $spell->{name},
3314 can_hover => 1, 3450 can_hover => 1,
3315 can_events => 1, 3451 can_events => 1,
3316 tooltip => $spell->{message}, 3452 tooltip => $spell->{message},
3317 expand => 1); 3453 expand => 1);
3318 3454
3319 $self->{spellbox}->add (2, $self->{tbl_idx}, new CFClient::UI::Label 3455 $self->add (2, $self->{tbl_idx}, new CFClient::UI::Label
3320 text => (sprintf "lvl: %2d sp: %2d dmg: %2d", 3456 text => (sprintf "lvl: %2d sp: %2d dmg: %2d",
3321 $spell->{level}, ($spell->{mana} || $spell->{grace}), $spell->{damage}), 3457 $spell->{level}, ($spell->{mana} || $spell->{grace}), $spell->{damage}),
3322 expand => 1); 3458 expand => 1);
3323 3459
3324 $self->{spellbox}->add (3, $self->{tbl_idx}++, new CFClient::UI::Button 3460 $self->add (3, $self->{tbl_idx}++, new CFClient::UI::Button
3325 text => "bind to key", 3461 text => "bind to key",
3326 on_activate => sub { $::BIND_EDITOR->do_quick_binding (["cast $spell->{name}"]) }); 3462 on_activate => sub { $::BIND_EDITOR->do_quick_binding (["cast $spell->{name}"]) });
3327} 3463}
3328 3464
3329sub rebuild_spell_list { 3465sub rebuild_spell_list {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines