ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/cvsroot/cf.schmorp.de/gde/GCE/MainWindow.pm
Revision: 1.72
Committed: Fri Jan 5 13:38:07 2007 UTC (19 years, 9 months ago) by elmex
Branch: MAIN
Changes since 1.71: +9 -1 lines
Log Message:
improved error handling a bit when opening maps.

File Contents

# User Rev Content
1 elmex 1.1 package GCE::MainWindow;
2    
3     =head1 NAME
4    
5     GCE::MainWindow - the main window class for gce
6    
7     =cut
8    
9 elmex 1.58 use Cwd qw/abs_path getcwd/;
10 elmex 1.1 use Gtk2;
11     use Gtk2::Gdk::Keysyms;
12 elmex 1.2 use Gtk2::SimpleMenu;
13 root 1.7
14     use Crossfire;
15 elmex 1.32 use Crossfire::Map;
16 root 1.7 use Crossfire::MapWidget;
17    
18 elmex 1.2 use GCE::AttrEdit;
19 elmex 1.13 use GCE::MapEditor;
20 elmex 1.15 use GCE::StackView;
21 elmex 1.17 use GCE::EditAction;
22     use GCE::PickWindow;
23 elmex 1.2
24 elmex 1.53 use Glib::Object::Subclass
25 elmex 1.13 Gtk2::Window;
26 elmex 1.2
27 elmex 1.28 use GCE::Util;
28 elmex 1.54 use GCE::DragHelper;
29 elmex 1.28
30 elmex 1.2 use strict;
31    
32 elmex 1.18 # XXX: make a recursive call from save_layout to all (interesting) sub-widgets
33 elmex 1.17 sub save_layout {
34     my ($self) = @_;
35    
36 elmex 1.58 # $main::CFG->{attr_edit_on} = exists $self->{attr_edit} ? 1 : 0;
37 elmex 1.17 $main::CFG->{stack_view_on} = exists $self->{sv} ? 1 : 0;
38     $main::CFG->{picker_on} = exists $self->{last_pick_window} ? 1 : 0;
39     $main::CFG->{main_window} = main::get_pos_and_size ($self);
40     $main::CFG->{stack_view} = main::get_pos_and_size ($self->{sv_win}) if $self->{sv_win};
41     $main::CFG->{attr_view} = main::get_pos_and_size ($self->{attr_edit_win}) if $self->{attr_edit_win};
42    
43 elmex 1.70 if ($self->{last_map_window}) {
44     $main::CFG->{map_window} = main::get_pos_and_size ($self->{last_map_window});
45     $self->{last_map_window}->save_layout ();
46     }
47 elmex 1.69
48 elmex 1.37 $main::CFG->{last_folders} = $self->{fc_last_folders};
49    
50 elmex 1.17 $main::CFG->{open_pickers} = [];
51    
52     for (@{$self->{open_pick_windows}}) {
53    
54     next unless defined $_;
55    
56     push @{$main::CFG->{open_pickers}}, {
57     p_and_s => main::get_pos_and_size ($_),
58     selection => $_->{last_selection}
59     };
60     }
61    
62 elmex 1.59 $self->{attr_edit}->save_layout;
63    
64 root 1.26 main::write_cfg ("$Crossfire::VARDIR/gceconfig");
65 elmex 1.17 }
66    
67     sub load_layout {
68     my ($self) = @_;
69    
70 elmex 1.37 $self->{fc_last_folders} = $main::CFG->{last_folders};
71    
72 elmex 1.58 # $main::CFG->{attr_edit_on}
73     # and $self->show_attr_editor;
74 elmex 1.17
75     $main::CFG->{stack_view_on}
76     and $self->show_stack_view;
77    
78     for (@{$main::CFG->{open_pickers}}) {
79     $self->open_pick_window ($_);
80     }
81 elmex 1.59
82     $self->{attr_edit}->load_layout;
83 elmex 1.17 }
84    
85     sub open_map_editor {
86     my ($self, $mapfile) = @_;
87    
88 elmex 1.44 my $mapkey;
89 elmex 1.39 unless (ref $mapfile) {
90 elmex 1.58 # unless (File::Spec->file_name_is_absolute ($mapfile)) {
91     # $mapfile = File::Spec->rel2abs ($mapfile);
92     # }
93     $mapkey = abs_path ($mapfile);
94     # File::Spec->abs2rel ($mapfile, File::Spec->catfile ($::CFG->{MAPDIR}));
95     } else {
96     $mapkey = "$mapfile";
97 elmex 1.38 }
98    
99 elmex 1.17 # XXX: last_map_window is a dirty trick to get the position and size
100     # for save layout
101    
102 elmex 1.58 if (defined $self->{loaded_maps}->{$mapkey}) {
103     $self->{loaded_maps}->{$mapkey}->get_toplevel->present;
104     return;
105 elmex 1.38 }
106    
107 elmex 1.17 my $w = $self->{last_map_window} = GCE::MapEditor->new;
108 root 1.25
109 elmex 1.53 $self->{editors}->{$w} = $w;
110    
111     $w->signal_connect (destroy => sub {
112     my ($w) = @_;
113 elmex 1.67 $w->close_windows;
114 elmex 1.53 delete $self->{loaded_maps}->{$w->{mapkey}};
115     delete $self->{editors}->{$w};
116     0;
117     });
118    
119 elmex 1.58 $self->{loaded_maps}->{$mapkey} = $w;
120 elmex 1.38
121 elmex 1.72 eval { $w->open_map ($mapfile, $mapkey) };
122     if ($@) {
123     quick_msg ($self, "$@", 1);
124     $w->close_windows;
125     delete $self->{loaded_maps}->{$w->{mapkey}};
126     delete $self->{editors}->{$w};
127     $w->destroy;
128     return;
129     }
130 elmex 1.17
131 elmex 1.54 $w->set_edit_tool ($self->{sel_editaction});
132    
133 elmex 1.17 $w->show_all;
134     }
135    
136 elmex 1.47 sub show_help_window {
137     my ($self) = @_;
138    
139     return if defined $self->{help_win};
140 elmex 1.51 require Gtk2::Ex::PodViewer;
141 elmex 1.47 my $w = $self->{help_win} = Gtk2::Window->new;
142 elmex 1.66 $w->set_title ("gcrossedit - help");
143 elmex 1.47 $w->set_default_size (500, 300);
144 elmex 1.56 $w->signal_connect (destroy => sub {
145 elmex 1.53 $self->{help_win}->hide; $self->{help_win} = undef;
146     0
147     });
148 elmex 1.47 $w->add (my $sw = Gtk2::ScrolledWindow->new);
149 elmex 1.51 $sw->add (my $h = Gtk2::Ex::PodViewer->new);
150 elmex 1.47 $h->load_string ($::DOCUMENTATION);
151     $w->show_all;
152     }
153    
154 elmex 1.17 sub show_stack_view {
155 elmex 1.15 my ($self) = @_;
156    
157     return if defined $self->{sv};
158    
159 elmex 1.17 my $w = $self->{sv_win} = Gtk2::Window->new ('toplevel');
160 elmex 1.66 $w->set_title ('gcrossedit - stack view');
161 elmex 1.56 $w->signal_connect (destroy => sub { delete $self->{sv}; 0 });
162 elmex 1.15 $w->add ($self->{sv} = GCE::StackView->new);
163 elmex 1.17
164 elmex 1.30 main::set_pos_and_size ($w, $main::CFG->{stack_view}, 150, 250);
165 elmex 1.17
166 elmex 1.15 $w->show_all;
167     }
168    
169 elmex 1.46 sub show_editor_properties {
170     my ($self) = @_;
171    
172     return if $self->{prop_edit};
173    
174     my $w = $self->{prop_edit} = Gtk2::Window->new;
175 elmex 1.66 $w->set_title ("gcrossedit - preferences");
176 elmex 1.46 $w->add (my $t = Gtk2::Table->new (2, 4));
177 elmex 1.68 $t->attach_defaults (my $lbl1 = Gtk2::Label->new ("LIBDIR"), 0, 1, 0, 1);
178 elmex 1.46 $t->attach_defaults (my $lib = Gtk2::Entry->new, 1, 2, 0, 1);
179     $lib->set_text ($::CFG->{LIBDIR});
180 elmex 1.68 $t->attach_defaults (my $lbl2 = Gtk2::Label->new ("MAPDIR"), 0, 1, 1, 2);
181 elmex 1.46 $t->attach_defaults (my $map = Gtk2::Entry->new, 1, 2, 1, 2);
182     $map->set_text ($::CFG->{MAPDIR});
183     $t->attach_defaults (my $save = Gtk2::Button->new ('save'), 0, 2, 2, 3);
184     $save->signal_connect (clicked => sub {
185 elmex 1.68 $::LIBDIR = $::CFG->{LIBDIR} = $lib->get_text;
186     $::MAPDIR = $::CFG->{MAPDIR} = $map->get_text;
187 elmex 1.46 Crossfire::set_libdir ($::CFG->{LIBDIR});
188     Crossfire::load_archetypes;
189     Crossfire::load_tilecache;
190     main::write_cfg ("$Crossfire::VARDIR/gceconfig");
191     $w->destroy;
192     });
193     $t->attach_defaults (my $close = Gtk2::Button->new ('close'), 0, 2, 3, 4);
194     $close->signal_connect (clicked => sub { $w->destroy });
195    
196 elmex 1.56 $w->signal_connect (destroy => sub { delete $self->{prop_edit}; 0 });
197 elmex 1.46
198     main::set_pos_and_size ($w, $main::CFG->{prop_edit}, 200, 200);
199    
200     $w->show_all;
201     }
202    
203 elmex 1.15 sub show_attr_editor {
204     my ($self) = @_;
205    
206     my $w = $self->{attr_edit_win} = Gtk2::Window->new;
207 elmex 1.66 $w->set_title ("gcrossedit - edit attrs");
208 elmex 1.15 $w->add ($self->{attr_edit} = GCE::AttrEdit->new);
209 elmex 1.17
210 elmex 1.64 main::set_pos_and_size ($w, $main::CFG->{attr_view}, 400, 300, 250, 0);
211 elmex 1.17
212 elmex 1.15 $w->show_all;
213     }
214    
215     sub update_attr_editor {
216 elmex 1.61 my ($self, $ar) = @_;
217    
218     if (ref ($ar) ne 'GCE::ArchRef') { require Carp; Carp::confess ("$ar no ARCHREF!") }
219 elmex 1.15
220 elmex 1.58 $self->{attr_edit}
221     or die "SERIOUS BUG: Couldn't find attribut editor!";
222 elmex 1.15
223 elmex 1.61 $self->{attr_edit}->set_arch ($ar, 1);
224 elmex 1.66 $self->{attr_edit_win}->set_title ("gcrossedit - edit " . $ar->longname);
225 elmex 1.15 }
226    
227     sub update_stack_view {
228 elmex 1.17 my ($self, $mapedit, $x, $y) = @_;
229 elmex 1.15
230     return unless $self->{sv};
231    
232 elmex 1.17 $self->{sv}->set_stack ($mapedit, $x, $y);
233 elmex 1.62
234 elmex 1.15 }
235    
236 elmex 1.17 sub open_pick_window {
237     my ($self, $layout) = @_;
238    
239 root 1.29 # XXX: Yes, also fix this, save _every_ pick window and their positions and their
240 elmex 1.17 # selection
241     my $p = GCE::PickWindow->new ();
242 elmex 1.15
243 elmex 1.17 push @{$self->{open_pick_windows}}, $p;
244    
245     my $idx = (@{$self->{open_pick_windows}}) - 1;
246 elmex 1.15
247 elmex 1.17 $p->signal_connect ('delete-event' => sub {
248     $self->{open_pick_windows}->[$idx] = undef;
249     });
250 elmex 1.10
251 elmex 1.17 if ($layout) {
252 elmex 1.30 main::set_pos_and_size ($p, $layout->{p_and_s}, 200, 200);
253 elmex 1.17 }
254 elmex 1.10
255 elmex 1.17 $p->show_all;
256 elmex 1.10
257 elmex 1.17 $p->set_selection ($layout->{selection});
258 elmex 1.10 }
259    
260 elmex 1.13 sub build_menu {
261 elmex 1.1 my ($self) = @_;
262    
263 elmex 1.2 my $menu_tree = [
264     _File => {
265     item_type => '<Branch>',
266     children => [
267     _New => {
268     callback => sub { $self->new_cb },
269     accelerator => '<ctrl>N'
270     },
271     _Open => {
272     callback => sub { $self->open_cb },
273     accelerator => '<ctrl>O'
274     },
275 elmex 1.71 'Open special' => {
276     item_type => '<Branch>',
277     children => [
278     "world map at"=> {
279     callback => sub { $self->open_worldmap_cb },
280     },
281     "world overlay map at (CF+);"=> {
282     callback => sub { $self->open_worldmap_cb ('overlay') },
283     },
284     ]
285     },
286 elmex 1.17 "_Save Layout" => {
287     callback => sub { $self->save_layout },
288     accelerator => '<ctrl>L'
289     },
290 elmex 1.52 "_Preferences" => {
291 elmex 1.46 callback => sub { $self->show_editor_properties },
292     accelerator => "<ctrl>T"
293     },
294 elmex 1.49 _Quit => {
295 elmex 1.2 callback => sub { Gtk2->main_quit },
296     accelerator => '<ctrl>Q'
297 elmex 1.47 },
298 elmex 1.2 ]
299     },
300 root 1.24 _Dialogs => {
301 elmex 1.2 item_type => '<Branch>',
302     children => [
303 elmex 1.17 "_Picker" => {
304     callback => sub { $self->open_pick_window },
305     accelerator => "<ctrl>P"
306     },
307     "_Stack View" => {
308     callback => sub { $self->show_stack_view },
309     accelerator => "<ctrl>V"
310     },
311 elmex 1.2 ]
312 elmex 1.47 },
313 elmex 1.49 _Help => {
314     item_type => '<Branch>',
315     children => [
316 elmex 1.50 _Manual => {
317 elmex 1.49 callback => sub { $self->show_help_window },
318     accelerator => "<ctrl>H"
319     },
320     ]
321     },
322 elmex 1.2 ];
323    
324 elmex 1.13 my $men =
325     Gtk2::SimpleMenu->new (
326     menu_tree => $menu_tree,
327     default_callback => \&default_cb,
328     );
329 elmex 1.10
330 elmex 1.2 $self->add_accel_group ($men->{accel_group});
331    
332 elmex 1.13 return $men->{widget};
333     }
334 elmex 1.10
335 elmex 1.17 sub add_button {
336     my ($self, $table, $plcinfo, $lbl, $cb) = @_;
337    
338     my ($lx, $ly) = @{$plcinfo->{next}};
339    
340     unless ($lx < $plcinfo->{width}) {
341    
342     $ly++;
343     $lx = 0;
344     }
345    
346     $ly < $plcinfo->{height}
347     or die "too many buttons, make table bigger!";
348    
349 elmex 1.42 $table->attach_defaults (my $btn = Gtk2::Button->new_with_mnemonic ($lbl), $lx, $lx + 1, $ly, $ly + 1);
350 elmex 1.17 $btn->signal_connect (clicked => $cb);
351    
352     $plcinfo->{next} = [$lx + 1, $ly];
353     }
354    
355     sub build_buttons {
356     my ($self) = @_;
357    
358 elmex 1.38 my $tbl = Gtk2::Table->new (2, 4);
359     my $plcinfo = { width => 2, height => 4, next => [0, 0] };
360 elmex 1.17
361 elmex 1.38 $self->{edit_collection}{pick} = GCE::EditAction::Pick->new;
362     $self->{edit_collection}{place} = GCE::EditAction::Place->new;
363     $self->{edit_collection}{erase} = GCE::EditAction::Erase->new;
364     $self->{edit_collection}{select} = GCE::EditAction::Select->new;
365     $self->{edit_collection}{perl} = GCE::EditAction::Perl->new;
366 elmex 1.63 $self->{edit_collection}{connect} = GCE::EditAction::Connect->new;
367 elmex 1.38 $self->{edit_collection}{followexit} = GCE::EditAction::FollowExit->new;
368 elmex 1.17
369 elmex 1.33 $self->set_edit_tool ('pick');
370 elmex 1.28
371 elmex 1.42 $self->add_button ($tbl, $plcinfo, "P_ick", sub { $self->set_edit_tool ('pick') });
372     $self->add_button ($tbl, $plcinfo, "_Place", sub { $self->set_edit_tool ('place') });
373     $self->add_button ($tbl, $plcinfo, "_Erase", sub { $self->set_edit_tool ('erase') });
374     $self->add_button ($tbl, $plcinfo, "_Select", sub { $self->set_edit_tool ('select') });
375     $self->add_button ($tbl, $plcinfo, "Eva_l", sub { $self->set_edit_tool ('perl') });
376 elmex 1.63 $self->add_button ($tbl, $plcinfo, "Connec_t", sub { $self->set_edit_tool ('connect') });
377 elmex 1.42 $self->add_button ($tbl, $plcinfo, "_Follow Exit", sub { $self->set_edit_tool ('followexit') });
378 elmex 1.33
379     return $tbl;
380     }
381    
382     sub set_edit_tool {
383     my ($self, $name) = @_;
384    
385     if ($name eq 'pick') {
386 elmex 1.28 $self->update_edit_tool ($self->{edit_collection}{pick}, "Pick");;
387 elmex 1.33 } elsif ($name eq 'place') {
388 elmex 1.28 $self->update_edit_tool ($self->{edit_collection}{place}, "Place");;
389 elmex 1.33 } elsif ($name eq 'erase') {
390 elmex 1.28 $self->update_edit_tool ($self->{edit_collection}{erase}, "Erase");;
391 elmex 1.34 } elsif ($name eq 'select') {
392     $self->update_edit_tool ($self->{edit_collection}{select}, "Select");;
393 elmex 1.57 $self->{edit_collection}{select}->update_overlay;
394 elmex 1.35 } elsif ($name eq 'perl') {
395     $self->update_edit_tool ($self->{edit_collection}{perl}, "Eval");;
396 elmex 1.63 } elsif ($name eq 'connect') {
397     $self->update_edit_tool ($self->{edit_collection}{connect}, "Connect");;
398 elmex 1.38 } elsif ($name eq 'followexit') {
399     $self->update_edit_tool ($self->{edit_collection}{followexit}, "Follow Exit");;
400 elmex 1.33 }
401 elmex 1.17 }
402 elmex 1.10
403 elmex 1.28 sub update_edit_tool {
404     my ($self, $tool, $name) = @_;
405    
406 elmex 1.57 for (values %{$self->{loaded_maps}}) {
407     $_->{map}->overlay ('selection')
408     }
409    
410 elmex 1.28 $self->{edit_tool}->set_text ($name);
411     $self->{sel_editaction} = $tool;
412    
413     my $widget = $tool->tool_widget;
414    
415     for ($self->{edit_tool_cont}->get_children) {
416     $_->hide;
417     $self->{edit_tool_cont}->remove ($_);
418     }
419    
420 elmex 1.53 $_->set_edit_tool ($self->{sel_editaction}) for (values %{$self->{editors}});
421    
422 elmex 1.28 defined $widget or return;
423    
424     $self->{edit_tool_cont}->add ($widget);
425     $widget->show_all;
426     }
427    
428     sub update_pick_view {
429     my ($self, $arch) = @_;
430    
431     defined $arch->{_face}
432     or $arch = $Crossfire::ARCH{$arch->{_name}};
433    
434     fill_pb_from_arch ($self->{pick_view_pb}, $arch);
435     $self->{pick_view_img}->set_from_pixbuf ($self->{pick_view_pb});
436    
437 elmex 1.33 $self->{pick_view_btn}->set_label ($arch->{_name});
438 elmex 1.28 }
439    
440 elmex 1.13 sub INIT_INSTANCE {
441     my ($self) = @_;
442 elmex 1.10
443 root 1.24 $::MAINWIN = $self;
444 elmex 1.15
445 elmex 1.66 $self->set_title ("gcrossedit - toolbox");
446 elmex 1.10
447 elmex 1.28 $self->{edit_tool} = Gtk2::Label->new;
448     $self->{edit_tool_cont} = Gtk2::VBox->new;
449    
450 elmex 1.13 $self->add (my $vb = Gtk2::VBox->new);
451     $vb->pack_start ($self->build_menu, 0, 1, 0);
452 elmex 1.28 $vb->pack_start (my $tbl = $self->build_buttons, 0, 1, 0);
453    
454     $vb->pack_start (Gtk2::HSeparator->new, 0, 1, 0);
455     $vb->pack_start ($self->{edit_tool}, 0, 1, 0);
456    
457     $vb->pack_start (Gtk2::HSeparator->new, 0, 1, 0);
458 elmex 1.35 $vb->pack_start ($self->{edit_tool_cont}, 1, 1, 0);
459 elmex 1.10
460 elmex 1.13 # XXX:load $ARGV _cleanly_?
461 root 1.27 $self->open_map_editor ($_)
462     for @ARGV;
463 root 1.11
464 elmex 1.13 $self->signal_connect ('delete-event' => sub {
465     Gtk2->main_quit;
466 elmex 1.10 });
467 elmex 1.17
468 elmex 1.30 ::set_pos_and_size ($self, $main::CFG->{main_window}, 150, 200, 0, 0);
469 elmex 1.58
470    
471     $self->show_attr_editor;
472 elmex 1.2 }
473    
474     sub new_cb {
475     my ($self) = @_;
476 elmex 1.32
477     my $w = Gtk2::Window->new ('toplevel');
478     my $width = [width => 20];
479     my $height = [height => 20];
480     $w->add (my $tbl = Gtk2::Table->new (2, 3));
481     add_table_widget ($tbl, 0, $width, 'string');
482     add_table_widget ($tbl, 1, $height, 'string');
483     add_table_widget ($tbl, 2, 'new', 'button', sub {
484     if ($width->[1] > 0 and $height->[1] > 0) {
485     my $map = Crossfire::Map->new ($width->[1], $height->[1]);
486 elmex 1.69 $map->{info}->{width} = $width->[1];
487     $map->{info}->{height} = $height->[1];
488 elmex 1.33 $map->resize ($width->[1], $height->[1]);
489 elmex 1.32 $self->open_map_editor ($map);
490     }
491     $w->destroy;
492     1;
493     });
494     add_table_widget ($tbl, 3, 'close', 'button', sub { $w->destroy });
495     $w->show_all;
496 elmex 1.2 }
497    
498 root 1.25 sub new_filechooser {
499 elmex 1.37 my ($self, $title, $save, $filename) = @_;
500 elmex 1.2
501 elmex 1.66 $title ||= 'gcrossedit - open map';
502 root 1.25 my $fc = new Gtk2::FileChooserDialog (
503 elmex 1.33 $title, undef, $save ? 'save' : 'open', 'gtk-cancel' => 'cancel', 'gtk-ok' => 'ok'
504 elmex 1.13 );
505    
506 elmex 1.46 $fc->add_shortcut_folder ($::CFG->{MAPDIR}) if -d $::CFG->{MAPDIR};
507 elmex 1.45 $fc->add_shortcut_folder ($_) for grep { $_ && ($_ ne '') } keys %{$self->{fc_last_folders}};
508 elmex 1.55 $fc->set_current_folder (getcwd);
509 elmex 1.2
510 elmex 1.37 if ($filename) {
511     $fc->set_filename ($filename);
512     }
513    
514 root 1.25 $fc
515     }
516    
517 elmex 1.71 sub new_coord_query {
518     my ($self, $mode, $finishcb) = @_;
519    
520     my $coordhash = { x => 105, y => 115 };
521     my $diag = GCE::HashDialogue->new;
522     $diag->init (
523     layout_name => 'worldmap_coord_query_'.$mode,
524     info => "Open $mode worldmap at ...",
525     dialog_default_size => [ 200, 200, 200, 0 ],
526     title => 'Worldmap coordinate entry',
527     ref_hash => $coordhash,
528     dialog => [
529     [x => 'X Coordinate' => 'string'],
530     [y => 'Y Coordinate' => 'string'],
531     ],
532     save_button_label => 'open',
533     save_cb => sub {
534     $finishcb->($mode, $_[0]->{x}, $_[0]->{y});
535     }
536     );
537     $diag->show_all;
538     }
539    
540     sub open_worldmap_cb {
541     my ($self, $mode) = @_;
542    
543     $self->new_coord_query ($mode, sub {
544     my ($mode, $x, $y) = @_;
545     my $map = $::CFG->{MAPDIR}
546     . "/world" . ($mode eq 'overlay' ? '-overlay' : '')
547     . "/world_$x\_$y";
548     $self->open_map_editor ($map);
549     });
550     }
551    
552 root 1.25 sub open_cb {
553     my ($self) = @_;
554    
555     my $fc = $self->new_filechooser;
556    
557 elmex 1.2 if ('ok' eq $fc->run) {
558 elmex 1.13
559 elmex 1.10 $self->{fc_last_folder} = $fc->get_current_folder;
560 elmex 1.13 $self->{fc_last_folders}->{$self->{fc_last_folder}}++;
561 elmex 1.17
562     $self->open_map_editor ($fc->get_filename);
563 elmex 1.2 }
564    
565     $fc->destroy;
566     }
567    
568 elmex 1.17 sub get_pick {
569     my ($self) = @_;
570    
571 elmex 1.58 $self->{attr_edit}
572     or die "Couldn't find attribute editor! SERIOUS BUG!";
573    
574 elmex 1.17 # XXX: This is just to make sure that this function always returns something
575 elmex 1.61
576     my $ar = $self->{attr_edit}->get_arch;
577     return { _name => 'platinacoin' } unless defined $ar;
578     return $ar->getarch || { _name => 'platinacoin' };
579 elmex 1.17 }
580    
581 elmex 1.1 =head1 AUTHOR
582    
583     Marc Lehmann <schmorp@schmorp.de>
584     http://home.schmorp.de/
585    
586     Robin Redeker <elmex@ta-sa.org>
587     http://www.ta-sa.org/
588    
589     =cut
590     1;
591