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

Comparing deliantra/gde/GCE/MainWindow.pm (file contents):
Revision 1.24 by root, Tue Feb 21 18:06:35 2006 UTC vs.
Revision 1.25 by root, Tue Feb 21 18:18:35 2006 UTC

72 72
73 # XXX: last_map_window is a dirty trick to get the position and size 73 # XXX: last_map_window is a dirty trick to get the position and size
74 # for save layout 74 # for save layout
75 75
76 my $w = $self->{last_map_window} = GCE::MapEditor->new; 76 my $w = $self->{last_map_window} = GCE::MapEditor->new;
77
77 $w->open_map ($mapfile); 78 $w->open_map ($mapfile);
78 79
79 main::set_pos_and_size ($w, $main::CFG->{map_window}); 80 ::set_pos_and_size ($w, $main::CFG->{map_window});
80 81
81 $w->show_all; 82 $w->show_all;
82# my $w = $self->{last_map_window} = Gtk2::Window->new ('toplevel'); 83# my $w = $self->{last_map_window} = Gtk2::Window->new ('toplevel');
83# $w->set_title ('gce - map editor'); 84# $w->set_title ('gce - map editor');
84# $w->add (my $mapedit = $self->{mapedit} = new GCE::MapEditor); 85# $w->add (my $mapedit = $self->{mapedit} = new GCE::MapEditor);
298 ::set_pos_and_size ($self, $main::CFG->{main_window}); 299 ::set_pos_and_size ($self, $main::CFG->{main_window});
299} 300}
300 301
301sub new_cb { 302sub new_cb {
302 my ($self) = @_; 303 my ($self) = @_;
303 die "NOT IMPLEMENTED YET"; 304 warn "new map not yet implemented\n";
304} 305}
305 306
306sub open_cb { 307sub new_filechooser {
307 my ($self) = @_; 308 my ($self) = @_;
308 309
309 my $fc =
310 Gtk2::FileChooserDialog->new ( 310 my $fc = new Gtk2::FileChooserDialog (
311 'gce - open map', undef, 'open', 'gtk-cancel' => 'cancel', 'gtk-ok' => 'ok' 311 'gce - open map', undef, 'open', 'gtk-cancel' => 'cancel', 'gtk-ok' => 'ok'
312 ); 312 );
313 313
314 $fc->add_shortcut_folder ("$Crossfire::LIB/maps"); 314 $fc->add_shortcut_folder ("$Crossfire::LIB/maps");
315 $fc->add_shortcut_folder ($_) for keys %{$self->{fc_last_folders}}; 315 $fc->add_shortcut_folder ($_) for keys %{$self->{fc_last_folders}};
316 $fc->set_current_folder ($self->{fc_last_folder} || "$Crossfire::LIB/maps"); 316 $fc->set_current_folder ($self->{fc_last_folder} || "$Crossfire::LIB/maps");
317 317
318 $fc
319}
320
321sub open_cb {
322 my ($self) = @_;
323
324 my $fc = $self->new_filechooser;
325
318 if ('ok' eq $fc->run) { 326 if ('ok' eq $fc->run) {
319 327
320 $self->{fc_last_folder} = $fc->get_current_folder; 328 $self->{fc_last_folder} = $fc->get_current_folder;
321 $self->{fc_last_folders}->{$self->{fc_last_folder}}++; 329 $self->{fc_last_folders}->{$self->{fc_last_folder}}++;
322 330

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines