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.23 by root, Tue Feb 21 00:05:39 2006 UTC vs.
Revision 1.24 by root, Tue Feb 21 18:06:35 2006 UTC

23 23
24use Glib::Object::Subclass 24use Glib::Object::Subclass
25 Gtk2::Window; 25 Gtk2::Window;
26 26
27use strict; 27use strict;
28
29our $MAINWIN;
30 28
31# XXX: make a recursive call from save_layout to all (interesting) sub-widgets 29# XXX: make a recursive call from save_layout to all (interesting) sub-widgets
32sub save_layout { 30sub save_layout {
33 my ($self) = @_; 31 my ($self) = @_;
34 32
159 $p->show_all; 157 $p->show_all;
160 158
161 $p->set_selection ($layout->{selection}); 159 $p->set_selection ($layout->{selection});
162} 160}
163 161
164sub undo {
165 my ($self) = @_;
166
167 # XXX: Move to GCE::MapEdior in a popup-menu or real menu
168 my $map = $self->{last_map_window}{map}; # the Crossfire::MapWidget
169
170 $map->{undo_stack_pos}
171 or return;
172
173 $map->change_swap ($map->{undo_stack}[--$map->{undo_stack_pos}]);
174}
175
176sub redo {
177 my ($self) = @_;
178
179 # XXX: Move to GCE::MapEdior in a popup-menu or real menu
180 my $map = $self->{last_map_window}{map}; # the Crossfire::MapWidget
181
182 $map->{undo_stack_pos} < @{$map->{undo_stack}}
183 or return;
184
185 $map->change_swap ($map->{undo_stack}[$map->{undo_stack_pos}++]);
186}
187
188sub build_menu { 162sub build_menu {
189 my ($self) = @_; 163 my ($self) = @_;
190 164
191 my $menu_tree = [ 165 my $menu_tree = [
192 _File => { 166 _File => {
208 callback => sub { Gtk2->main_quit }, 182 callback => sub { Gtk2->main_quit },
209 accelerator => '<ctrl>Q' 183 accelerator => '<ctrl>Q'
210 } 184 }
211 ] 185 ]
212 }, 186 },
213 _Edit => { 187 _Dialogs => {
214 item_type => '<Branch>', 188 item_type => '<Branch>',
215 children => [ 189 children => [
216 "_Undo" => {
217 callback => sub { $self->undo },
218 accelerator => "<ctrl>Z"
219 },
220 "_Redo" => {
221 callback => sub { $self->redo },
222 accelerator => "<ctrl>Y"
223 },
224 "_Attr Editor" => { 190 "_Attr Editor" => {
225 callback => sub { $self->show_attr_editor }, 191 callback => sub { $self->show_attr_editor },
226 accelerator => "<ctrl>A" 192 accelerator => "<ctrl>A"
227 }, 193 },
228 "_Picker" => { 194 "_Picker" => {
231 }, 197 },
232 "_Stack View" => { 198 "_Stack View" => {
233 callback => sub { $self->show_stack_view }, 199 callback => sub { $self->show_stack_view },
234 accelerator => "<ctrl>V" 200 accelerator => "<ctrl>V"
235 }, 201 },
236
237 ]
238 },
239 _View => {
240 item_type => '<Branch>',
241 children => [
242 "Open _Attr Editor" => { 202 "Open _Attr Editor" => {
243 callback => sub { $self->show_attr_editor }, 203 callback => sub { $self->show_attr_editor },
244 accelerator => "<ctrl>A" 204 accelerator => "<ctrl>A"
245 }, 205 },
246 "Open _Picker" => { 206 "Open _Picker" => {
316 276
317 277
318sub INIT_INSTANCE { 278sub INIT_INSTANCE {
319 my ($self) = @_; 279 my ($self) = @_;
320 280
321 $MAINWIN = $self; 281 $::MAINWIN = $self;
322 282
323 $self->set_title ("gce - main window"); 283 $self->set_title ("gce - main window");
324 284
325 $self->add (my $vb = Gtk2::VBox->new); 285 $self->add (my $vb = Gtk2::VBox->new);
326 $vb->pack_start ($self->build_menu, 0, 1, 0); 286 $vb->pack_start ($self->build_menu, 0, 1, 0);
333 293
334 $self->signal_connect ('delete-event' => sub { 294 $self->signal_connect ('delete-event' => sub {
335 Gtk2->main_quit; 295 Gtk2->main_quit;
336 }); 296 });
337 297
338 main::set_pos_and_size ($self, $main::CFG->{main_window}); 298 ::set_pos_and_size ($self, $main::CFG->{main_window});
339} 299}
340 300
341sub new_cb { 301sub new_cb {
342 my ($self) = @_; 302 my ($self) = @_;
343 die "NOT IMPLEMENTED YET"; 303 die "NOT IMPLEMENTED YET";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines