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

Comparing deliantra/gde/GCE/PickWindow.pm (file contents):
Revision 1.15 by elmex, Sun Mar 19 19:30:38 2006 UTC vs.
Revision 1.16 by elmex, Sun Mar 26 20:42:12 2006 UTC

18use GCE::StackView; 18use GCE::StackView;
19use GCE::EditAction; 19use GCE::EditAction;
20use GCE::PickWindow; 20use GCE::PickWindow;
21 21
22use GCE::AttrTypemap; 22use GCE::AttrTypemap;
23
24use GCE::DragHelper;
23 25
24use Glib::Object::Subclass 26use Glib::Object::Subclass
25 Gtk2::Window; 27 Gtk2::Window;
26 28
27use strict; 29use strict;
55 my $arch = $cb->get_active_text; 57 my $arch = $cb->get_active_text;
56 $self->set_selection ($arch); 58 $self->set_selection ($arch);
57 }); 59 });
58 60
59 $hb->pack_start (my $map = $self->{map} = new Crossfire::MapWidget, 1, 1, 0); 61 $hb->pack_start (my $map = $self->{map} = new Crossfire::MapWidget, 1, 1, 0);
62# XXX: Doesn't work yet beacuse of tooltips
63# GCE::DragHelper::set_drag_source (
64# $map, arch => sub { { arch => $self->{last_pick} } }
65# );
60 66
61 $map->set_size_request (TILESIZE * 10, TILESIZE * 10); 67 $map->set_size_request (TILESIZE * 10, TILESIZE * 10);
62 68
63 $map->signal_connect (button_press_event => sub { 69 $map->signal_connect (button_press_event => sub {
64 my ($f, $event) = @_; 70 my ($map, $event) = @_;
65 71
66 if ($event->button == 3) { 72 if ($event->button == 3) {
67 73
68 my ($mx, $my) = $map->coord ($event->x, $event->y); 74 my ($mx, $my) = $map->coord ($event->x, $event->y);
69 my $as = $map->get ($mx, $my); 75 my $as = $map->get ($mx, $my);
84 90
85 if ($arch->{_virtual}) { 91 if ($arch->{_virtual}) {
86 $arch = $arch->{_virtual}; 92 $arch = $arch->{_virtual};
87 } 93 }
88 94
95 $self->{last_pick} = $arch;
89 $::MAINWIN->set_pick ($arch); 96 $::MAINWIN->set_pick ($arch);
90 $::MAINWIN->update_attr_editor ($arch); 97 $::MAINWIN->update_attr_editor ($arch);
91 $::MAINWIN->set_edit_tool ('place'); 98 $::MAINWIN->set_edit_tool ('place');
92 } 99 }
100
101#my $d = $map->disable_tooltip;
102
103 1
93 }); 104 });
105
106 $map->signal_connect (button_release_event => sub {
107 my ($map, $event) = @_;
108
109# $map->enable_tooltip;
110
111 1
112 });
113
94} 114}
95 115
96sub set_selection { 116sub set_selection {
97 my ($self, $arch) = @_; 117 my ($self, $arch) = @_;
98 118
99 return unless defined $arch; 119 return unless defined $arch;
100 120
101 $self->{map}->set_map ( 121 $self->{map}->set_map (
102 new_pickmap Crossfire::Map $self->{toplevel_archs}->{$arch} 122 new_pickmap Crossfire::Map $self->{toplevel_archs}->{$arch}
103 ); 123 );
124 $self->{map}->enable_tooltip;
104 125
105 $self->{combo}->set_active ($self->{arch_txt_to_idx}->{$arch}); 126 $self->{combo}->set_active ($self->{arch_txt_to_idx}->{$arch});
106 127
107 $self->{last_selection} = $arch; 128 $self->{last_selection} = $arch;
108
109 $self->{map}->enable_tooltip;
110
111} 129}
112 130
113 131
114=head1 AUTHOR 132=head1 AUTHOR
115 133

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines