… | |
… | |
74 | |
74 | |
75 | # XXX: last_map_window is a dirty trick to get the position and size |
75 | # XXX: last_map_window is a dirty trick to get the position and size |
76 | # for save layout |
76 | # for save layout |
77 | |
77 | |
78 | my $w = $self->{last_map_window} = GCE::MapEditor->new; |
78 | my $w = $self->{last_map_window} = GCE::MapEditor->new; |
79 | $self->{mapedit} = $w->{mapedit}; |
79 | $self->{mapedit} = $w->{mapedit}; # this line can be ignored and will be deleted :) |
80 | $w->open_map ($mapfile); |
80 | $w->open_map ($mapfile); |
81 | |
81 | |
82 | main::set_pos_and_size ($w, $main::CFG->{map_window}); |
82 | main::set_pos_and_size ($w, $main::CFG->{map_window}); |
83 | |
83 | |
84 | $w->show_all; |
84 | $w->show_all; |
… | |
… | |
158 | } |
158 | } |
159 | |
159 | |
160 | $p->show_all; |
160 | $p->show_all; |
161 | |
161 | |
162 | $p->set_selection ($layout->{selection}); |
162 | $p->set_selection ($layout->{selection}); |
|
|
163 | } |
|
|
164 | |
|
|
165 | sub undo { |
|
|
166 | my ($self) = @_; |
|
|
167 | |
|
|
168 | # XXX: Move to GCE::MapEdior in a popup-menu or real menu |
|
|
169 | my $map = $self->{last_map_window}->{mapedit}; # the Crossfire::MapWidget |
|
|
170 | |
|
|
171 | # revert map to last state |
|
|
172 | } |
|
|
173 | |
|
|
174 | sub redo { |
|
|
175 | my ($self) = @_; |
|
|
176 | |
|
|
177 | # XXX: Move to GCE::MapEdior in a popup-menu or real menu |
|
|
178 | my $map = $self->{last_map_window}->{mapedit}; # the Crossfire::MapWidget |
|
|
179 | |
|
|
180 | # re-revert map to state after last state? :-) |
163 | } |
181 | } |
164 | |
182 | |
165 | sub build_menu { |
183 | sub build_menu { |
166 | my ($self) = @_; |
184 | my ($self) = @_; |
167 | |
185 | |
… | |
… | |
188 | ] |
206 | ] |
189 | }, |
207 | }, |
190 | _Edit => { |
208 | _Edit => { |
191 | item_type => '<Branch>', |
209 | item_type => '<Branch>', |
192 | children => [ |
210 | children => [ |
|
|
211 | "_Undo" => { |
|
|
212 | callback => sub { $self->undo }, |
|
|
213 | accelerator => "<ctrl>Z" |
|
|
214 | }, |
|
|
215 | "_Redo" => { |
|
|
216 | callback => sub { $self->redo }, |
|
|
217 | accelerator => "<ctrl>Y" |
|
|
218 | }, |
193 | "_Attr Editor" => { |
219 | "_Attr Editor" => { |
194 | callback => sub { $self->show_attr_editor }, |
220 | callback => sub { $self->show_attr_editor }, |
195 | accelerator => "<ctrl>A" |
221 | accelerator => "<ctrl>A" |
196 | }, |
222 | }, |
197 | "_Picker" => { |
223 | "_Picker" => { |