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.42 by elmex, Sun Jun 17 18:54:13 2007 UTC vs.
Revision 1.43 by elmex, Sun Jun 24 08:09:34 2007 UTC

47 my ($self) = @_; 47 my ($self) = @_;
48 48
49 my $pb = $self->{arch_pb} = new_arch_pb; 49 my $pb = $self->{arch_pb} = new_arch_pb;
50 50
51 $self->add (my $topvb = Gtk2::VBox->new); 51 $self->add (my $topvb = Gtk2::VBox->new);
52 $topvb->pack_start (my $menubar = Gtk2::MenuBar->new, 0, 0, 0);
53 $menubar->append (my $actions_menu = Gtk2::MenuItem->new ('Actions'));
54 my $actmenu = Gtk2::Menu->new;
55 $actmenu->append (my $defitm = Gtk2::MenuItem->new ('reset to defaults'));
56 $defitm->signal_connect (activate => sub {
57 my $ar = $self->{archref};
58 $ar->reset_to_defaults;
59 #XXXAR $self->set_arch ($arch, $self->{change_cb});
60 });
61
62 $actmenu->append (my $attitm = Gtk2::MenuItem->new ('attach'));
63 $attitm->signal_connect (activate => sub {
64 my $ar = $self->{archref};
65 return unless $ar;
66 unless ($self->{attach_editor}) {
67 my $w = GCE::AttachEditor->new;
68 $w->set_attachment (
69 $ar->get ('attach'),
70 sub {
71 if (@{$_[0]}) {
72 $ar->set_silent (attach => $_[0])
73 } else {
74 $ar->set_silent (attach => undef)
75 }
76 }
77 );
78 $self->{attach_editor} = $w;
79 $w->signal_connect (destroy => sub { delete $self->{attach_editor} });
80 $w->show_all;
81 }
82 });
83
84 $actions_menu->set_submenu ($actmenu);
85 $actmenu->show_all;
86
52 $topvb->pack_start (my $hb2 = Gtk2::HBox->new, 0, 1, 0); 87 $topvb->pack_start (my $hb2 = Gtk2::HBox->new, 0, 1, 0);
53 $hb2->pack_start (my $img = $self->{arch_img} = (new_from_pixbuf Gtk2::Image $pb), 0, 0, 0); 88 $hb2->pack_start (my $img = $self->{arch_img} = (new_from_pixbuf Gtk2::Image $pb), 0, 0, 0);
54 $img->set_alignment (0, 0.5); 89 $img->set_alignment (0, 0.5);
55 90
56 $hb2->pack_start (my $lbl = $self->{arch_name_lbl} = Gtk2::Label->new, 0, 0, 0); 91 $hb2->pack_start (my $lbl = $self->{arch_name_lbl} = Gtk2::Label->new, 0, 0, 0);
57 $lbl->set_alignment (0, 0.5); 92 $lbl->set_alignment (0, 0.5);
58 93
59 $hb2->pack_start (my $defbtn = Gtk2::Button->new ('reset to defaults'), 0, 0, 0); 94 $hb2->pack_start (my $statbtn = $self->{arch_stat_btn} = Gtk2::Button->new, 0, 0, 0);
60 $defbtn->signal_connect (clicked => sub {
61 my $ar = $self->{archref};
62 $ar->reset_to_defaults;
63#XXXAR $self->set_arch ($arch, $self->{change_cb});
64 });
65
66 $hb2->pack_start (my $attbtn = Gtk2::Button->new ('attach (CF+)'), 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_silent (attach => $_[0])
77 } else {
78 $ar->set_silent (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
88 95
89 $topvb->pack_start (my $docal = Gtk2::Alignment->new (0, 0.5, 0, 1), 0, 1, 0); 96 $topvb->pack_start (my $docal = Gtk2::Alignment->new (0, 0.5, 0, 1), 0, 1, 0);
90 $topvb->pack_start (my $usebtn = $self->{use_btn} = Gtk2::ToggleButton->new ('show use'), 0, 1, 0); 97 $topvb->pack_start (my $usebtn = $self->{use_btn} = Gtk2::ToggleButton->new ('show use'), 0, 1, 0);
91 $topvb->pack_start (my $useal = $self->{use_al} = Gtk2::Alignment->new (0, 0.5, 0, 1), 0, 1, 0); 98 $topvb->pack_start (my $useal = $self->{use_al} = Gtk2::Alignment->new (0, 0.5, 0, 1), 0, 1, 0);
92 $topvb->pack_start (my $ntbook = $self->{ntbook} = Gtk2::Notebook->new, 1, 1, 0); 99 $topvb->pack_start (my $ntbook = $self->{ntbook} = Gtk2::Notebook->new, 1, 1, 0);
181 188
182 $self->{arch_name_lbl}->set_text ($ar->longname); 189 $self->{arch_name_lbl}->set_text ($ar->longname);
183 190
184 fill_pb_from_arch ($self->{arch_pb}, $ar->getarch); 191 fill_pb_from_arch ($self->{arch_pb}, $ar->getarch);
185 $self->{arch_img}->set_from_pixbuf ($self->{arch_pb}); 192 $self->{arch_img}->set_from_pixbuf ($self->{arch_pb});
193 $self->label_set_color ($self->{arch_name_lbl}, 0);
194
195 $self->{arch_stat_btn}->set_label ($ar->{source});
186 196
187 # get current page (to remember it for later) 197 # get current page (to remember it for later)
188 my $pgnum = $self->{ntbook}->get_current_page; 198 my $pgnum = $self->{ntbook}->get_current_page;
189 my $curwid = $self->{ntbook}->get_nth_page ($pgnum); 199 my $curwid = $self->{ntbook}->get_nth_page ($pgnum);
190 my $curpage_text = defined $curwid ? $self->{ntbook}->get_tab_label_text ($curwid) : undef; 200 my $curpage_text = defined $curwid ? $self->{ntbook}->get_tab_label_text ($curwid) : undef;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines