ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/Deliantra/Deliantra/MapWidget.pm
(Generate patch)

Comparing deliantra/Deliantra/Deliantra/MapWidget.pm (file contents):
Revision 1.7 by root, Sun Feb 5 23:35:57 2006 UTC vs.
Revision 1.8 by root, Sun Feb 5 23:39:36 2006 UTC

31sub INIT_INSTANCE { 31sub INIT_INSTANCE {
32 my ($self) = @_; 32 my ($self) = @_;
33 33
34 $self->signal_connect (destroy => sub { 34 $self->signal_connect (destroy => sub {
35 my ($self) = @_; 35 my ($self) = @_;
36
36 $self->{tip}->destroy if $self->{tip}; 37 $self->{tip}->destroy if $self->{tip};
38
37 %$self = (); 39 %$self = ();
40
38 0 41 0
39 }); 42 });
40 $self->signal_connect (realize => sub { 43 $self->signal_connect (realize => sub {
41 my ($self) = @_; 44 my ($self) = @_;
42 45
119 0 122 0
120 }); 123 });
121 124
122 # gtk+ supports no motion compression, a major lacking feature. we have to pay for the 125 # gtk+ supports no motion compression, a major lacking feature. we have to pay for the
123 # workaround with incorrect behaviour and extra server-turnarounds. 126 # workaround with incorrect behaviour and extra server-turnarounds.
124 $self->add_events ([qw(key_press_mask key_release_mask 127 $self->add_events ([qw(button_press_mask button_release_mask button-motion-mask
125 button_press_mask button_release_mask button-motion-mask
126 pointer-motion-mask pointer-motion-hint-mask 128 pointer-motion-mask pointer-motion-hint-mask
127 enter-notify-mask leave-notify-mask)]); 129 enter-notify-mask leave-notify-mask)]);
128 $self->can_focus (1); 130 $self->can_focus (1);
129 131
130# $self->signal_connect (key_press_event => sub { $self->handle_key ($_[1]->keyval, $_[1]->state) }); 132# $self->signal_connect (key_press_event => sub { $self->handle_key ($_[1]->keyval, $_[1]->state) });
174 $self->{tip}->set_name ("gtk-tooltips"); 176 $self->{tip}->set_name ("gtk-tooltips");
175 $self->{tip}->set_decorated (0); 177 $self->{tip}->set_decorated (0);
176 $self->{tip}->set_border_width (4); 178 $self->{tip}->set_border_width (4);
177 $self->{tip}->set_has_frame (0); 179 $self->{tip}->set_has_frame (0);
178 $self->{tip}->set_resizable (0); 180 $self->{tip}->set_resizable (0);
181 $self->{tip}->set_transient_for ($self->get_toplevel);
179 } 182 }
180 183
181 my ($mx, $my) = $self->coord ($self->get_pointer); 184 my ($mx, $my) = $self->coord ($self->get_pointer);
182 185
183 if ($self->{tipinfo}[0] != $mx || $self->{tipinfo}[1] != $my) { 186 if ($self->{tipinfo}[0] != $mx || $self->{tipinfo}[1] != $my) {
303# 306#
304# if ($state * "control-mask") { 307# if ($state * "control-mask") {
305# if ($key == $Gtk2::Gdk::Keysyms{g}) { 308# if ($key == $Gtk2::Gdk::Keysyms{g}) {
306# my @sel = keys %{$self->{sel}}; 309# my @sel = keys %{$self->{sel}};
307# $self->generate_thumbnails (@sel ? @sel : 0 .. $#{$self->{entry}}); 310# $self->generate_thumbnails (@sel ? @sel : 0 .. $#{$self->{entry}});
308# } elsif ($key == $Gtk2::Gdk::Keysyms{a}) {
309# $self->select_all;
310# } elsif ($key == $Gtk2::Gdk::Keysyms{A}) {
311# $self->select_range ($self->{offs}, $self->{offs} + $self->{cols} * $self->{page} - 1);
312# } elsif ($key == $Gtk2::Gdk::Keysyms{s}) {
313# $self->rescan;
314# } elsif ($key == $Gtk2::Gdk::Keysyms{d}) {
315# $self->unlink (keys %{$self->{sel}});
316# } elsif ($key == $Gtk2::Gdk::Keysyms{u}) {
317# my @sel = keys %{$self->{sel}};
318# $self->update_thumbnails (@sel ? @sel : 0 .. $#{$self->{entry}});
319#
320# } elsif ($key == $Gtk2::Gdk::Keysyms{Return}) {
321# $self->cursor_move (0) unless $self->cursor_valid;
322# $self->emit_activate ($self->{cursor});
323# } elsif ($key == $Gtk2::Gdk::Keysyms{space}) {
324# $self->cursor_move (1) or return 1
325# if $self->{cursor_current} || !$self->cursor_valid;
326# $self->emit_activate ($self->{cursor}) if $self->cursor_valid;
327# $self->prefetch (1);
328# } elsif ($key == $Gtk2::Gdk::Keysyms{BackSpace}) {
329# $self->cursor_move (-1) or return 1;
330# $self->emit_activate ($self->{cursor}) if $self->cursor_valid;
331# $self->prefetch (-1);
332#
333# } else {
334# return 0;
335# }
336# } else {
337# if ($key == $Gtk2::Gdk::Keysyms{Page_Up}) {
338# my $value = $self->{adj}->value;
339# $self->{adj}->set_value ($value >= $self->{page} ? $value - $self->{page} : 0);
340# $self->clear_cursor;
341# } elsif ($key == $Gtk2::Gdk::Keysyms{Page_Down}) {
342# my $value = $self->{adj}->value + $self->{page};
343# $self->{adj}->set_value ($value <= $self->{maxrow} ? $value : $self->{maxrow});
344# $self->clear_cursor;
345#
346# } elsif ($key == $Gtk2::Gdk::Keysyms{Home}) {
347# $self->{adj}->set_value (0);
348# $self->clear_cursor;
349# } elsif ($key == $Gtk2::Gdk::Keysyms{End}) {
350# $self->{adj}->set_value ($self->{maxrow});
351# $self->clear_cursor;
352#
353# } elsif ($key == $Gtk2::Gdk::Keysyms{Up}) {
354# $self->cursor_move (-$self->{cols});
355# } elsif ($key == $Gtk2::Gdk::Keysyms{Down}) {
356# $self->cursor_move (+$self->{cols});
357# } elsif ($key == $Gtk2::Gdk::Keysyms{Left}) {
358# $self->cursor_move (-1);
359# } elsif ($key == $Gtk2::Gdk::Keysyms{Right}) {
360# $self->cursor_move (+1);
361#
362# } elsif ($key == $Gtk2::Gdk::Keysyms{Return}) {
363# $self->cursor_move (0) unless $self->cursor_valid;
364# $self->emit_activate ($self->{cursor});
365# } elsif ($key == $Gtk2::Gdk::Keysyms{space}) {
366# $self->cursor_move (1) or return 1
367# if $self->{cursor_current} || !$self->cursor_valid;
368# $self->emit_activate ($self->{cursor}) if $self->cursor_valid;
369# $self->prefetch (1);
370# } elsif ($key == $Gtk2::Gdk::Keysyms{BackSpace}) {
371# $self->cursor_move (-1) or return 1;
372# $self->emit_activate ($self->{cursor}) if $self->cursor_valid;
373# $self->prefetch (-1);
374#
375# } elsif ($key == ord '^') {
376# $self->updir if exists $self->{dir};
377#
378# } elsif (($key >= (ord '0') && $key <= (ord '9'))
379# || ($key >= (ord 'a') && $key <= (ord 'z'))) {
380#
381# $key = chr $key;
382#
383# my ($idx, $cursor) = (0, 0);
384#
385# $self->clear_selection;
386#
387# for my $entry (@{$self->{entry}}) {
388# $idx++;
389# $cursor = $idx if $key gt lcfirst $entry->[1];
390# }
391#
392# if ($cursor < @{$self->{entry}}) {
393# delete $self->{cursor_current};
394# $self->{sel}{$cursor} = $self->{entry}[$cursor];
395# $self->{cursor} = $cursor;
396#
397# $self->{adj}->set_value (min $self->{maxrow}, $cursor / $self->{cols});
398# $self->emit_sel_changed;
399# $self->invalidate_all;
400# }
401# } else {
402# return 0;
403# }
404# } 311# }
405# 312#
406# 1 313# 1
407#} 314#}
408 315

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines