ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/gde/GCE/AttrEdit.pm
(Generate patch)

Comparing deliantra/gde/GCE/AttrEdit.pm (file contents):
Revision 1.36 by elmex, Thu Apr 20 08:58:29 2006 UTC vs.
Revision 1.37 by elmex, Sun Aug 27 17:24:20 2006 UTC

10use Gtk2::Gdk::Keysyms; 10use Gtk2::Gdk::Keysyms;
11use Gtk2::SimpleList; 11use Gtk2::SimpleList;
12 12
13use GCE::Util; 13use GCE::Util;
14use GCE::InventoryEditor; 14use GCE::InventoryEditor;
15use GCE::AttachEditor;
15 16
16use Glib::Object::Subclass Gtk2::HPaned; 17use Glib::Object::Subclass
18 Gtk2::HPaned;
17 19
18use Crossfire; 20use Crossfire;
19use strict; 21use strict;
20 22
21sub save_layout { 23sub save_layout {
22 my ($self) = @_; 24 my ($self) = @_;
23 25
24 $::CFG->{attr_view_hpane_pos} = $self->get_position; 26 $::CFG->{attr_view_hpane_pos} = $self->get_position;
25 $::CFG->{attr_view_show_use} = $self->{use_btn}->get_active * 1; 27 $::CFG->{attr_view_show_use} = $self->{use_btn}->get_active * 1;
28
29 $self->{attach_editor}->save_layout
30 if $self->{attach_editor};
26} 31}
27 32
28sub load_layout { 33sub load_layout {
29 my ($self) = @_; 34 my ($self) = @_;
30 35
55 $defbtn->signal_connect (clicked => sub { 60 $defbtn->signal_connect (clicked => sub {
56 my $ar = $self->{archref}; 61 my $ar = $self->{archref};
57 $ar->reset_to_defaults; 62 $ar->reset_to_defaults;
58#XXXAR $self->set_arch ($arch, $self->{change_cb}); 63#XXXAR $self->set_arch ($arch, $self->{change_cb});
59 }); 64 });
65
66 $hb2->pack_start (my $attbtn = Gtk2::Button->new ('attach'), 0, 0, 0);
67 $attbtn->signal_connect (clicked => sub {
68 my $ar = $self->{archref};
69 return unless $ar;
70 unless ($self->{attach_editor}) {
71 my $w = GCE::AttachEditor->new;
72 $w->set_attachment (
73 $ar->get ('attach'),
74 sub {
75 if (@{$_[0]}) {
76 $ar->set (attach => $_[0])
77 } else {
78 $ar->set (attach => undef)
79 }
80 }
81 );
82 $self->{attach_editor} = $w;
83 $w->signal_connect (destroy => sub { delete $self->{attach_editor} });
84 $w->show_all;
85 }
86 });
87
60 88
61 $topvb->pack_start (my $docal = Gtk2::Alignment->new (0, 0.5, 0, 1), 0, 1, 0); 89 $topvb->pack_start (my $docal = Gtk2::Alignment->new (0, 0.5, 0, 1), 0, 1, 0);
62 $topvb->pack_start (my $usebtn = $self->{use_btn} = Gtk2::ToggleButton->new ('show use'), 0, 1, 0); 90 $topvb->pack_start (my $usebtn = $self->{use_btn} = Gtk2::ToggleButton->new ('show use'), 0, 1, 0);
63 $topvb->pack_start (my $useal = $self->{use_al} = Gtk2::Alignment->new (0, 0.5, 0, 1), 0, 1, 0); 91 $topvb->pack_start (my $useal = $self->{use_al} = Gtk2::Alignment->new (0, 0.5, 0, 1), 0, 1, 0);
64 $topvb->pack_start (my $ntbook = $self->{ntbook} = Gtk2::Notebook->new, 1, 1, 0); 92 $topvb->pack_start (my $ntbook = $self->{ntbook} = Gtk2::Notebook->new, 1, 1, 0);
142 $ar->add_on_change (attredit => sub { $self->set_arch ($_[0]) }); 170 $ar->add_on_change (attredit => sub { $self->set_arch ($_[0]) });
143 171
144 } elsif (not defined $self->{archref}) { 172 } elsif (not defined $self->{archref}) {
145 $ar->add_on_change (attredit => sub { $self->set_arch ($_[0]) }); 173 $ar->add_on_change (attredit => sub { $self->set_arch ($_[0]) });
146 } 174 }
147
148 175
149 $self->{inv_edit}->clear_inv_hist if $clear_inv; 176 $self->{inv_edit}->clear_inv_hist if $clear_inv;
150 $self->{inv_edit}->set_arch ($ar); 177 $self->{inv_edit}->set_arch ($ar);
151 178
152 $self->{archref} = $ar; 179 $self->{archref} = $ar;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines