… | |
… | |
402 | } |
402 | } |
403 | $self->{path} = $path; |
403 | $self->{path} = $path; |
404 | $self->{map}->set_map (my $m = new_from_file Crossfire::Map $path); |
404 | $self->{map}->set_map (my $m = new_from_file Crossfire::Map $path); |
405 | $self->{meta_info} = load_meta_info ($path); |
405 | $self->{meta_info} = load_meta_info ($path); |
406 | $self->set_title ("gce - map editor - $self->{path}"); |
406 | $self->set_title ("gce - map editor - $self->{path}"); |
|
|
407 | $::MAINWIN->add_recent($path); |
407 | } |
408 | } |
408 | $self->close_windows; |
409 | $self->close_windows; |
409 | } |
410 | } |
410 | |
411 | |
411 | sub save_map { |
412 | sub save_map { |
… | |
… | |
416 | if ($self->{meta_info}) { |
417 | if ($self->{meta_info}) { |
417 | save_meta_info ($self->{path}, $self->{meta_info}); |
418 | save_meta_info ($self->{path}, $self->{meta_info}); |
418 | } |
419 | } |
419 | quick_msg ($self, "saved to $self->{path}"); |
420 | quick_msg ($self, "saved to $self->{path}"); |
420 | $self->set_title ("gce - map editor - $self->{path}"); |
421 | $self->set_title ("gce - map editor - $self->{path}"); |
|
|
422 | $::MAINWIN->add_recent($self->{path}); |
421 | } else { |
423 | } else { |
422 | $self->save_map_as; |
424 | $self->save_map_as; |
423 | } |
425 | } |
424 | } |
426 | } |
425 | |
427 | |
… | |
… | |
431 | if ('ok' eq $fc->run) { |
433 | if ('ok' eq $fc->run) { |
432 | |
434 | |
433 | $::MAINWIN->{fc_last_folder} = $fc->get_current_folder; |
435 | $::MAINWIN->{fc_last_folder} = $fc->get_current_folder; |
434 | $::MAINWIN->{fc_last_folders}->{$self->{fc_last_folder}}++; |
436 | $::MAINWIN->{fc_last_folders}->{$self->{fc_last_folder}}++; |
435 | |
437 | |
436 | $self->{map}{map}->write_file ($self->{path} = $fc->get_filename); |
438 | if($fc->get_filename) { |
437 | if ($self->{meta_info}) { |
439 | $self->{path} = $fc->get_filename; |
438 | save_meta_info ($self->{path}, $self->{meta_info}); |
440 | $self->save_map; |
439 | } |
441 | } |
440 | quick_msg ($self, "saved to $self->{path}"); |
|
|
441 | $self->set_title ("gce - map editor - $self->{path}"); |
|
|
442 | } |
442 | } |
443 | |
443 | |
444 | $fc->destroy; |
444 | $fc->destroy; |
445 | } |
445 | } |
446 | |
446 | |
… | |
… | |
462 | ref_hash => $self->{map}{map}{info}, |
462 | ref_hash => $self->{map}{map}{info}, |
463 | dialog => [ |
463 | dialog => [ |
464 | [width => 'Width' => 'string'], |
464 | [width => 'Width' => 'string'], |
465 | [height => 'Height' => 'string'], |
465 | [height => 'Height' => 'string'], |
466 | ], |
466 | ], |
467 | close_on_save => 1, |
467 | close_on_save => 1, |
|
|
468 | save_button_label => 'resize', |
468 | save_cb => sub { |
469 | save_cb => sub { |
469 | my ($info) = @_; |
470 | my ($info) = @_; |
470 | $self->{map}{map}->resize ($info->{width}, $info->{height}); |
471 | $self->{map}{map}->resize ($info->{width}, $info->{height}); |
471 | $self->{map}->invalidate_all; |
472 | $self->{map}->set_map ($self->{map}{map}); |
472 | } |
473 | } |
473 | ); |
474 | ); |
474 | |
475 | |
475 | $w->signal_connect (destroy => sub { delete $self->{meta_info_win} }); |
476 | $w->signal_connect (destroy => sub { delete $self->{meta_info_win} }); |
476 | |
477 | |
… | |
… | |
671 | [qw/unique Unique check/], |
672 | [qw/unique Unique check/], |
672 | [qw/fixed_resettime Fixed-resettime check/], |
673 | [qw/fixed_resettime Fixed-resettime check/], |
673 | [per_player => 'Per player' => 'check'], |
674 | [per_player => 'Per player' => 'check'], |
674 | [per_party => 'Per party' => 'check'], |
675 | [per_party => 'Per party' => 'check'], |
675 | [no_reset => 'No reset' => 'check'], |
676 | [no_reset => 'No reset' => 'check'], |
|
|
677 | [music => 'Map Music' => 'string'], |
676 | [undef, qw/x sep/], |
678 | [undef, qw/x sep/], |
677 | [qw/tile_path_1 Northpath string/], |
679 | [qw/tile_path_1 Northpath string/], |
678 | [qw/tile_path_2 Eastpath string/], |
680 | [qw/tile_path_2 Eastpath string/], |
679 | [qw/tile_path_3 Southpath string/], |
681 | [qw/tile_path_3 Southpath string/], |
680 | [qw/tile_path_4 Westpath string/], |
682 | [qw/tile_path_4 Westpath string/], |