--- deliantra/Deliantra-Client/DC/Item.pm 2007/12/26 18:09:30 1.9 +++ deliantra/Deliantra-Client/DC/Item.pm 2007/12/26 20:46:39 1.10 @@ -1,4 +1,4 @@ -package CFPlus::Item; +package dc::Item; use strict; use utf8; @@ -45,14 +45,14 @@ sub do_n_dialog { my ($cb) = @_; - my $w = new CFPlus::UI::Toplevel + my $w = new dc::UI::Toplevel on_delete => sub { $_[0]->destroy; 1 }, has_close_button => 1, ; - $w->add (my $vb = new CFPlus::UI::VBox x => "center", y => "center"); - $vb->add (new CFPlus::UI::Label text => "Enter item count:"); - $vb->add (my $entry = new CFPlus::UI::Entry + $w->add (my $vb = new dc::UI::VBox x => "center", y => "center"); + $vb->add (new dc::UI::Label text => "Enter item count:"); + $vb->add (my $entry = new dc::UI::Entry text => $last_enter_count, on_activate => sub { my ($entry) = @_; @@ -73,7 +73,7 @@ my ($self) = @_; # necessary to avoid cyclic references - CFPlus::weaken $self; + dc::weaken $self; my $button_cb = sub { my (undef, $ev, $x, $y) = @_; @@ -84,10 +84,10 @@ $targ = $::CONN->{open_container}; } - if (($ev->{mod} & CFPlus::KMOD_SHIFT) && $ev->{button} == 1) { + if (($ev->{mod} & dc::KMOD_SHIFT) && $ev->{button} == 1) { $::CONN->send ("move $targ $self->{tag} 0") if $targ || !($self->{flags} & F_LOCKED); - } elsif (($ev->{mod} & CFPlus::KMOD_SHIFT) && $ev->{button} == 2) { + } elsif (($ev->{mod} & dc::KMOD_SHIFT) && $ev->{button} == 2) { $self->{flags} & F_LOCKED ? $::CONN->send ("lock " . pack "CN", 0, $self->{tag}) : $::CONN->send ("lock " . pack "CN", 1, $self->{tag}) @@ -101,7 +101,7 @@ $move_prefix = "take"; } - my $shortname = CFPlus::shorten $self->{name}, 14; + my $shortname = dc::shorten $self->{name}, 14; my @menu_items = ( ["examine", sub { $::CONN->send ("examine $self->{tag}") }], @@ -147,10 +147,10 @@ ] ) ), - ["bind apply $shortname to a key" => sub { CFPlus::Macro::quick_macro ["apply $self->{name}"] }], + ["bind apply $shortname to a key" => sub { dc::Macro::quick_macro ["apply $self->{name}"] }], ); - CFPlus::UI::Menu->new (items => \@menu_items)->popup ($ev); + dc::UI::Menu->new (items => \@menu_items)->popup ($ev); } 1 @@ -169,9 +169,9 @@ : $self->{flags} & F_MAGIC ? [0.2, 0.2, 1, 0.5] : undef; - my $desc = CFPlus::Item::desc_string $self; + my $desc = dc::Item::desc_string $self; - $self->{face_widget} ||= new CFPlus::UI::Face + $self->{face_widget} ||= new dc::UI::Face can_events => 1, can_hover => 1, anim => $self->{anim}, @@ -190,7 +190,7 @@ # ); $self->{face_widget}->set_tooltip ("$desc\n\n$tooltip_std"); - $self->{desc_widget} ||= new CFPlus::UI::Label + $self->{desc_widget} ||= new dc::UI::Label can_events => 1, can_hover => 1, ellipsise => 2, @@ -217,7 +217,7 @@ my $long_desc = $self->{long_desc} || $desc; $self->{desc_widget}->set_tooltip ("$long_desc\n\n$tooltip_std"); - $self->{weight_widget} ||= new CFPlus::UI::Label + $self->{weight_widget} ||= new dc::UI::Label can_events => 1, can_hover => 1, ellipsise => 0, @@ -225,7 +225,7 @@ on_button_down => $button_cb, ; $self->{weight_widget}{bg} = $bg; - $self->{weight_widget}->set_text (CFPlus::Item::weight_string $self); + $self->{weight_widget}->set_text (dc::Item::weight_string $self); $self->{weight_widget}->set_tooltip ( "Weight.\n" . ($self->{weight} >= 0 ? "One item weighs $self->{weight}g. " : "You have no idea how much this weighs. ")