From: Emmanuel Rodriguez Date: Mon, 13 Apr 2009 08:03:20 +0000 (+0200) Subject: Adapt the test to the new markers API X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=eb3df1bfeb6e15bca51b96f04d3cf3500e7171a1;p=libchamplain Adapt the test to the new markers API --- diff --git a/bindings/perl/Champlain/examples/animated-marker.pl b/bindings/perl/Champlain/examples/animated-marker.pl index 3c6303a..fe7a985 100755 --- a/bindings/perl/Champlain/examples/animated-marker.pl +++ b/bindings/perl/Champlain/examples/animated-marker.pl @@ -24,7 +24,7 @@ my $MARKER_SIZE = 10; # Another way it so create a base class of Marker and to keep this timeline and # the behaviours associated with the marker. This approach is implemented here. # -use Glib::Object::Subclass 'Champlain::Marker' => +use Glib::Object::Subclass 'Champlain::BaseMarker' => properties => [ # The timeline controlling the animation diff --git a/bindings/perl/Champlain/examples/capitals.pl b/bindings/perl/Champlain/examples/capitals.pl index 6fbf6e4..26c7cea 100755 --- a/bindings/perl/Champlain/examples/capitals.pl +++ b/bindings/perl/Champlain/examples/capitals.pl @@ -160,7 +160,7 @@ sub capital_callback { $layer->remove($last); # And then recreate it with another color - my $marker = Champlain::Marker->new_with_label($last->{name}, $font, undef, undef); + my $marker = Champlain::Marker->new_with_text($last->{name}, $font, undef, undef); $marker->set_position($last->get('latitude', 'longitude')); push @markers, $marker; $layer->add($marker); @@ -170,7 +170,7 @@ sub capital_callback { my $white = Clutter::Color->new(0xff, 0xff, 0xff, 0xff); my $orange = Clutter::Color->new(0xf3, 0x94, 0x07, 0xbb); - my $marker = Champlain::Marker->new_with_label($name, $font, $white, $orange); + my $marker = Champlain::Marker->new_with_text($name, $font, $white, $orange); $marker->{name} = $name; $marker->set_position($latitude, $longitude); push @markers, $marker; diff --git a/bindings/perl/Champlain/examples/gtk2.pl b/bindings/perl/Champlain/examples/gtk2.pl index 3d84326..ca2f971 100755 --- a/bindings/perl/Champlain/examples/gtk2.pl +++ b/bindings/perl/Champlain/examples/gtk2.pl @@ -134,17 +134,23 @@ sub create_marker_layer { my $marker; - $marker = Champlain::Marker->new_with_label("Montr\x{e9}al", "Airmole 14", undef, undef); + $marker = Champlain::Marker->new_with_text( + "Montr\x{e9}al", "Airmole 14", undef, undef + ); $marker->set_position(45.528178, -73.563788); $marker->set_reactive(TRUE); $marker->signal_connect_after("button-release-event", \&marker_button_release_cb, $map); $layer->add($marker); - $marker = Champlain::Marker->new_with_label("New York", "Sans 15", $white, undef); + $marker = Champlain::Marker->new_with_text( + "New York", "Sans 15", $white, undef + ); $marker->set_position(40.77, -73.98); $layer->add($marker); - $marker = Champlain::Marker->new_with_label("Bratislava", "Sans 15", $orange, undef); + $marker = Champlain::Marker->new_with_text( + "Bratislava", "Sans 15", $orange, undef + ); $marker->set_position(47.130885, -70.764141); $layer->add($marker); @@ -155,18 +161,16 @@ sub create_marker_layer { sub marker_button_release_cb { my ($marker, $event, $map) = @_; + return FALSE unless $event->button == 1 && $event->click_count == 1; - return FALSE if $event->button != 1 || $event->click_count > 1; - print "Montreal was clicked\n"; - return TRUE; } sub map_view_button_release_cb { my ($actor, $event, $map) = @_; - return FALSE if $event->button != 2 || $event->click_count > 1; + return FALSE unless $event->button == 2 && $event->click_count == 1; my ($lat, $lon) = $map->get_coords_from_event($event); printf "Map was clicked at %f, %f\n", $lat, $lon; diff --git a/bindings/perl/Champlain/examples/launcher.pl b/bindings/perl/Champlain/examples/launcher.pl index 09bf8a9..c1b1711 100755 --- a/bindings/perl/Champlain/examples/launcher.pl +++ b/bindings/perl/Champlain/examples/launcher.pl @@ -105,19 +105,23 @@ sub create_marker_layer { my $marker; - $marker = Champlain::Marker->new_with_label("Montr\x{e9}al", "Airmole 14", undef, undef); + $marker = Champlain::Marker->new_with_text( + "Montr\x{e9}al", "Airmole 14", undef, undef + ); $marker->set_position(45.528178, -73.563788); $marker->set_reactive(TRUE); $marker->signal_connect_after("button-release-event", \&marker_button_release_cb, $map); $layer->add($marker); - $marker = Champlain::Marker->new_with_label("New York", "Sans 15", $white, undef); + $marker = Champlain::Marker->new_with_text( + "New York", "Sans 15", $white, undef + ); $marker->set_position(40.77, -73.98); $layer->add($marker); my $file = File::Spec->catfile($FindBin::Bin, 'images', 'who.png'); eval { - $marker = Champlain::Marker->new_with_image_full($file, 40, 40, 20, 20); + $marker = Champlain::Marker->new_with_image($file); $marker->set_position(47.130885, -70.764141); $layer->add($marker); }; @@ -132,18 +136,16 @@ sub create_marker_layer { sub marker_button_release_cb { my ($marker, $event, $map) = @_; + return FALSE unless $event->button == 1 && $event->click_count == 1; - return FALSE if $event->button != 1 || $event->click_count > 1; - print "Montreal was clicked\n"; - return TRUE; } sub map_view_button_release_cb { my ($actor, $event, $map) = @_; - return FALSE if $event->button != 2 || $event->click_count > 1; + return FALSE unless $event->button == 2 && $event->click_count == 1; my ($lat, $lon) = $map->get_coords_from_event($event); printf "Map was clicked at %f, %f\n", $lat, $lon;