… | |
… | |
92 | unless (ref $mapfile) { |
92 | unless (ref $mapfile) { |
93 | # unless (File::Spec->file_name_is_absolute ($mapfile)) { |
93 | # unless (File::Spec->file_name_is_absolute ($mapfile)) { |
94 | # $mapfile = File::Spec->rel2abs ($mapfile); |
94 | # $mapfile = File::Spec->rel2abs ($mapfile); |
95 | # } |
95 | # } |
96 | $mapkey = abs_path ($mapfile); |
96 | $mapkey = abs_path ($mapfile); |
97 | # File::Spec->abs2rel ($mapfile, File::Spec->catfile ($::CFG->{MAPDIR})); |
97 | # File::Spec->abs2rel ($mapfile, File::Spec->catfile ($::MAPDIR)); |
98 | } else { |
98 | } else { |
99 | $mapkey = "$mapfile"; |
99 | $mapkey = "$mapfile"; |
100 | } |
100 | } |
101 | |
101 | |
102 | # XXX: last_map_window is a dirty trick to get the position and size |
102 | # XXX: last_map_window is a dirty trick to get the position and size |
… | |
… | |
507 | $title ||= 'gcrossedit - open map'; |
507 | $title ||= 'gcrossedit - open map'; |
508 | my $fc = new Gtk2::FileChooserDialog ( |
508 | my $fc = new Gtk2::FileChooserDialog ( |
509 | $title, undef, $save ? 'save' : 'open', 'gtk-cancel' => 'cancel', 'gtk-ok' => 'ok' |
509 | $title, undef, $save ? 'save' : 'open', 'gtk-cancel' => 'cancel', 'gtk-ok' => 'ok' |
510 | ); |
510 | ); |
511 | |
511 | |
512 | $fc->add_shortcut_folder ($::CFG->{MAPDIR}) if -d $::CFG->{MAPDIR}; |
512 | $fc->add_shortcut_folder ($::MAPDIR) |
513 | $fc->add_shortcut_folder ($_) for grep { $_ && ($_ ne '') } keys %{$self->{fc_last_folders}}; |
513 | if -d $::MAPDIR; |
|
|
514 | |
|
|
515 | $fc->add_shortcut_folder ($_) |
|
|
516 | for |
|
|
517 | grep { $_ && ($_ ne '') && -e $_ } |
|
|
518 | keys %{$self->{fc_last_folders}}; |
|
|
519 | |
514 | $fc->set_current_folder (getcwd); |
520 | $fc->set_current_folder (getcwd); |
515 | |
521 | |
516 | if ($filename) { |
522 | if ($filename) { |
517 | $fc->set_filename ($filename); |
523 | $fc->set_filename ($filename); |
518 | } |
524 | } |
… | |
… | |
554 | |
560 | |
555 | $self->new_coord_query (sub { |
561 | $self->new_coord_query (sub { |
556 | my ($info) = @_; |
562 | my ($info) = @_; |
557 | my ($x, $y) = ($info->{x}, $info->{y}); |
563 | my ($x, $y) = ($info->{x}, $info->{y}); |
558 | my ($worldmap, $overlay) = ($info->{worldmap}, $info->{overlay}); |
564 | my ($worldmap, $overlay) = ($info->{worldmap}, $info->{overlay}); |
559 | $self->open_map_editor ($::CFG->{MAPDIR} . "/world/world_$x\_$y") |
565 | $self->open_map_editor ($::MAPDIR . "/world/world_$x\_$y") |
560 | if $worldmap; |
566 | if $worldmap; |
561 | $self->open_map_editor ($::CFG->{MAPDIR} . "/world-overlay/world_$x\_$y") |
567 | $self->open_map_editor ($::MAPDIR . "/world-overlay/world_$x\_$y") |
562 | if $overlay; |
568 | if $overlay; |
563 | }); |
569 | }); |
564 | } |
570 | } |
565 | |
571 | |
566 | sub open_cb { |
572 | sub open_cb { |