Gnome2-Canvas-1.002/0040755000076600000240000000000010110014241013236 5ustar muppetstaffGnome2-Canvas-1.002/AUTHORS0100644000076600000240000000114007777601251014333 0ustar muppetstaff The Gtk2-Perl Team - contact us at gtk-perl-list@gnome.org ================================================================ muppet scott at asofyet dot org Ross McFarland rwmcfa1 at neces dot com Goran Thyni goran at kirra dot net Joern Reder joern at zyn dot de Chas Owens alas at wilma dot widomaker dot com Guillaume Cottenceau gc at mandrakesoft dot com several important bits of gtk2-perl were heavily inspired by pygtk, gtk-perl, and a good read-through of the gtk source code, so credit goes to those guys as well -- thanks! Gnome2-Canvas-1.002/Canvas.pm0100644000076600000240000000112610110014101014777 0ustar muppetstaff# # $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/Canvas.pm,v 1.22 2004/08/16 02:13:21 muppetman Exp $ # package Gnome2::Canvas; use 5.008; use strict; use warnings; use Gtk2; require DynaLoader; our @ISA = qw(DynaLoader); our $VERSION = '1.002'; sub import { my $class = shift; $class->VERSION (@_); } sub dl_load_flags { $^O eq 'darwin' ? 0x00 : 0x01 } bootstrap Gnome2::Canvas $VERSION; # Preloaded methods go here. 1; __END__ This is not the POD you're looking for. The documentation for this module is generated from the XS source, and is stored in separate .pod files. Gnome2-Canvas-1.002/canvas.typemap0100644000076600000240000000047107764013415016140 0ustar muppetstaffTYPEMAP const GnomeCanvasPathDef * T_GPERL_GENERIC_WRAPPER GnomeCanvasPathDef * T_GPERL_GENERIC_WRAPPER GnomeCanvasPathDef_own * T_GPERL_GENERIC_WRAPPER GnomeCanvasPathDef_ornull * T_GPERL_GENERIC_WRAPPER GnomeCanvasPathDef_copy * T_GPERL_GENERIC_WRAPPER GnomeCanvasPathDef_own_ornull * T_GPERL_GENERIC_WRAPPER Gnome2-Canvas-1.002/canvas_demo/0040755000076600000240000000000010110014241015515 5ustar muppetstaffGnome2-Canvas-1.002/canvas_demo/canvas-arrowhead.pl0100644000076600000240000002375610027213456021331 0ustar muppetstaffpackage CanvasArrowhead; use strict; use Glib qw(TRUE FALSE); use Gnome2::Canvas; use constant LEFT => 50.0; use constant RIGHT => 350.0; use constant MIDDLE => 150.0; use constant DEFAULT_WIDTH => 2; use constant DEFAULT_SHAPE_A => 8; use constant DEFAULT_SHAPE_B => 10; use constant DEFAULT_SHAPE_C => 3; sub set_dimension { my ($canvas, $arrow_name, $text_name, $x1, $y1, $x2, $y2, $tx, $ty, $dim) = @_; $canvas->{$arrow_name}->set (points => [$x1, $y1, $x2, $y2]); $canvas->{$text_name}->set (text => $dim, x => $tx, y => $ty); } sub move_drag_box { my ($item, $x, $y) = @_; $item->set (x1 => $x - 5.0, y1 => $y - 5.0, x2 => $x + 5.0, y2 => $y + 5.0); } sub set_arrow_shape { my $canvas = shift; my $width = $canvas->{width}; my $shape_a = $canvas->{shape_a}; my $shape_b = $canvas->{shape_b}; my $shape_c = $canvas->{shape_c}; # Big arrow $canvas->{big_arrow}->set (width_pixels => 10 * $width, arrow_shape_a => $shape_a * 10, arrow_shape_b => $shape_b * 10, arrow_shape_c => $shape_c * 10); # Outline my @coords = (); $coords[0] = RIGHT - 10 * $shape_a; $coords[1] = MIDDLE; $coords[2] = RIGHT - 10 * $shape_b; $coords[3] = MIDDLE - 10 * ($shape_c + $width / 2.0); $coords[4] = RIGHT; $coords[5] = MIDDLE; $coords[6] = $coords[2]; $coords[7] = MIDDLE + 10 * ($shape_c + $width / 2.0); $coords[8] = $coords[0]; $coords[9] = $coords[1]; $canvas->{outline}->set (points => \@coords); # Drag boxes move_drag_box ($canvas->{width_drag_box}, LEFT, MIDDLE - 10 * $width / 2.0); move_drag_box ($canvas->{shape_a_drag_box}, RIGHT - 10 * $shape_a, MIDDLE); move_drag_box ($canvas->{shape_b_c_drag_box}, RIGHT - 10 * $shape_b, MIDDLE - 10 * ($shape_c + $width / 2.0)); # Dimensions set_dimension ($canvas, "width_arrow", "width_text", LEFT - 10, MIDDLE - 10 * $width / 2.0, LEFT - 10, MIDDLE + 10 * $width / 2.0, LEFT - 15, MIDDLE, $width); set_dimension ($canvas, "shape_a_arrow", "shape_a_text", RIGHT - 10 * $shape_a, MIDDLE + 10 * ($width / 2.0 + $shape_c) + 10, RIGHT, MIDDLE + 10 * ($width / 2.0 + $shape_c) + 10, RIGHT - 10 * $shape_a / 2.0, MIDDLE + 10 * ($width / 2.0 + $shape_c) + 15, $shape_a); set_dimension ($canvas, "shape_b_arrow", "shape_b_text", RIGHT - 10 * $shape_b, MIDDLE + 10 * ($width / 2.0 + $shape_c) + 35, RIGHT, MIDDLE + 10 * ($width / 2.0 + $shape_c) + 35, RIGHT - 10 * $shape_b / 2.0, MIDDLE + 10 * ($width / 2.0 + $shape_c) + 40, $shape_b); set_dimension ($canvas, "shape_c_arrow", "shape_c_text", RIGHT + 10, MIDDLE - 10 * $width / 2.0, RIGHT + 10, MIDDLE - 10 * ($width / 2.0 + $shape_c), RIGHT + 15, MIDDLE - 10 * ($width / 2.0 + $shape_c / 2.0), $shape_c); # Info $canvas->{width_info}->set (text => "width: $width"); $canvas->{shape_a_info}->set (text => "arrow_shape_a: $shape_a"); $canvas->{shape_b_info}->set (text => "arrow_shape_b: $shape_b"); $canvas->{shape_c_info}->set (text => "arrow_shape_c: $shape_c"); # Sample arrows $canvas->{sample_1}->set (width_pixels => $width, arrow_shape_a => $shape_a, arrow_shape_b => $shape_b, arrow_shape_c => $shape_c); $canvas->{sample_2}->set (width_pixels => $width, arrow_shape_a => $shape_a, arrow_shape_b => $shape_b, arrow_shape_c => $shape_c); $canvas->{sample_3}->set (width_pixels => $width, arrow_shape_a => $shape_a, arrow_shape_b => $shape_b, arrow_shape_c => $shape_c); } sub highlight_box { my ($item, $event) = @_; if ($event->type eq 'enter-notify') { $item->set (fill_color => 'red'); } elsif ($event->type eq 'leave-notify') { $item->set (fill_color => undef) unless $event->state & 'button1-mask'; } elsif ($event->type eq 'button-press') { $item->grab ([qw/pointer-motion-mask button-release-mask/], Gtk2::Gdk::Cursor->new ('fleur'), $event->time); } elsif ($event->type eq 'button-release') { $item->ungrab ($event->time); } return FALSE; } sub create_drag_box { my ($root, $box_name, $callback) = @_; my $box = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Rect', fill_color => undef, outline_color => 'black', width_pixels => 0); $box->signal_connect (event => \&highlight_box); $box->signal_connect (event => $callback); $root->canvas->{$box_name} = $box; } sub width_event { my ($item, $event) = @_; return FALSE if (($event->type ne 'motion-notify') || !($event->state >= 'button1-mask')); my $width = (MIDDLE - $event->y) / 5; return FALSE if $width < 0; $item->canvas->{width} = $width; set_arrow_shape ($item->canvas); return FALSE; } sub shape_a_event { my ($item, $event) = @_; return FALSE if (($event->type ne 'motion-notify') || !($event->state >= 'button1-mask')); my $shape_a = (RIGHT - $event->x) / 10; return FALSE if (($shape_a < 0) || ($shape_a > 30)); $item->canvas->{shape_a} = $shape_a; set_arrow_shape ($item->canvas); return FALSE; } sub shape_b_c_event { my ($item, $event) = @_; return FALSE if (($event->type ne 'motion-notify') || !($event->state >= 'button1-mask')); my $change = FALSE; my $shape_b = (RIGHT - $event->x) / 10; if (($shape_b >= 0) && ($shape_b <= 30)) { $item->canvas->{shape_b} = $shape_b; $change = TRUE; } my $width = $item->canvas->{width}; my $shape_c = ((MIDDLE - 5 * $width) - $event->y) / 10; if ($shape_c >= 0) { $item->canvas->{shape_c} = $shape_c; $change = TRUE; } set_arrow_shape ($item->canvas) if $change; return FALSE; } sub create_dimension { my ($root, $arrow_name, $text_name, $anchor) = @_; my $item = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Line', fill_color => 'black', first_arrowhead => TRUE, last_arrowhead => TRUE, arrow_shape_a => 5.0, arrow_shape_b => 5.0, arrow_shape_c => 3.0); $root->canvas->{$arrow_name} = $item; $item = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Text', fill_color => 'black', font => 'Sans 12', anchor => $anchor); $root->canvas->{$text_name} = $item; } sub create_info { my ($root, $info_name, $x, $y) = @_; my $item = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Text', x => $x, y => $y, fill_color => 'black', font => 'Sans 14', anchor => 'GTK_ANCHOR_NW'); $root->canvas->{$info_name} = $item; } sub create_sample_arrow { my ($root, $sample_name, $x1, $y1, $x2, $y2) = @_; my $item = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Line', points => [$x1, $y1, $x2, $y2], fill_color => 'black', first_arrowhead => TRUE, last_arrowhead => TRUE); $root->canvas->{$sample_name} = $item; } sub create { my $vbox = Gtk2::VBox->new (FALSE, 4); $vbox->set_border_width (4); $vbox->show; my $w = Gtk2::Label->new ("This demo allows you to edit arrowhead shapes. Drag the little boxes\n" . "to change the shape of the line and its arrowhead. You can see the\n" . "arrows at their normal scale on the right hand side of the window."); $vbox->pack_start ($w, FALSE, FALSE, 0); $w->show; $w = Gtk2::Alignment->new (0.5, 0.5, 0.0, 0.0); $vbox->pack_start ($w, TRUE, TRUE, 0); $w->show; my $frame = Gtk2::Frame->new; $frame->set_shadow_type ('in'); $w->add ($frame); $frame->show; my $canvas = Gnome2::Canvas->new; $canvas->set_size_request (500, 350); $canvas->set_scroll_region (0, 0, 500, 350); $frame->add ($canvas); $canvas->show; my $root = $canvas->root; $canvas->{width} = DEFAULT_WIDTH; $canvas->{shape_a} = DEFAULT_SHAPE_A; $canvas->{shape_b} = DEFAULT_SHAPE_B; $canvas->{shape_c} = DEFAULT_SHAPE_C; # Big arrow my $item = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Line', points => [LEFT, MIDDLE, RIGHT, MIDDLE], fill_color => 'mediumseagreen', width_pixels => DEFAULT_WIDTH * 10, last_arrowhead => TRUE); $canvas->{big_arrow} = $item; # Arrow outline $item = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Line', fill_color => 'black', width_pixels => 2, cap_style => 'round', join_style => 'round'); $canvas->{outline} = $item; # Drag boxes create_drag_box ($root, "width_drag_box", \&width_event); create_drag_box ($root, "shape_a_drag_box", \&shape_a_event); create_drag_box ($root, "shape_b_c_drag_box", \&shape_b_c_event); # Dimensions create_dimension ($root, "width_arrow", "width_text", 'e'); create_dimension ($root, "shape_a_arrow", "shape_a_text", 'n'); create_dimension ($root, "shape_b_arrow", "shape_b_text", 'n'); create_dimension ($root, "shape_c_arrow", "shape_c_text", 'w'); # Info create_info ($root, "width_info", LEFT, 260); create_info ($root, "shape_a_info", LEFT, 280); create_info ($root, "shape_b_info", LEFT, 300); create_info ($root, "shape_c_info", LEFT, 320); # Division line Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Line', points => [RIGHT + 50, 0, RIGHT + 50, 1000], fill_color => 'black', width_pixels => 2); # Sample arrows create_sample_arrow ($root, "sample_1", RIGHT + 100, 30, RIGHT + 100, MIDDLE - 30); create_sample_arrow ($root, "sample_2", RIGHT + 70, MIDDLE, RIGHT + 130, MIDDLE); create_sample_arrow ($root, "sample_3", RIGHT + 70, MIDDLE + 30, RIGHT + 130, MIDDLE + 120); # Done! set_arrow_shape ($canvas); return $vbox; } 1; Gnome2-Canvas-1.002/canvas_demo/canvas-curve.pl0100644000076600000240000001521610027213456020471 0ustar muppetstaffpackage CanvasBezierCurve; # # canvas-curve.c: bezier curve demo. # # Copyright (C) 2002 Mark McLoughlin # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA # 02111-1307, USA. # # Authors: # Mark McLoughlin # muppet (gtk2-perl port) # # FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME # # there's a nasty workaround in here. # # you can't set or get the bpath property of the GnomeCanvasBpath via # Glib::Object->get or Glib::Object->set (of course, that includes # Gnome::Canvas::Item->new) -- you have to use $bpath->set_path_def and # $bpath->get_path_def. # # the problem is that the bpath property of of GnomeCanvasBpath is defined as a # G_TYPE_POINTER, rather than a G_TYPE_BOXED as it should be. we can't register # copy/free/whatever functions for pointer values, so we can't use any of our # way-cool Glib binding tools. thus, until libgnomecanvas fixes this bug, # we have to work around at this level. # # FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME use strict; use Carp; use Glib qw(TRUE FALSE); use Gnome2::Canvas; use constant STATE_INIT => 0; use constant STATE_FIRST_PRESS => 1; use constant STATE_FIRST_RELEASE => 2; use constant STATE_SECOND_PRESS => 3; my $current_state = STATE_INIT; my $current_item; my @current_points = (); sub draw_curve { my ($item, $x, $y) = @_; my $root = $item->parent; if ($current_state == STATE_INIT) { $current_points[0] = $x; $current_points[1] = $y; } elsif ($current_state == STATE_FIRST_PRESS) { $current_points[2] = $x; $current_points[3] = $y; my $path_def = Gnome2::Canvas::PathDef->new; $path_def->moveto ($current_points[0], $current_points[1]); $path_def->lineto ($current_points[2], $current_points[3]); if ($current_item) { ##$current_item->set (bpath => $path_def); $current_item->set_path_def ($path_def); } else { $current_item = Gnome2::Canvas::Item->new ( $root, 'Gnome2::Canvas::Bpath', ### can't do this here, see below ### bpath => $path_def, outline_color => 'blue', width_pixels => 5, cap_style => 'round'); # hack, see above $current_item->set_path_def ($path_def); $current_item->signal_connect (event => \&item_event); } } elsif ($current_state == STATE_FIRST_RELEASE) { $current_points[4] = $x; $current_points[5] = $y; my $path_def = Gnome2::Canvas::PathDef->new; $path_def->moveto ($current_points[0], $current_points[1]); $path_def->curveto ($current_points[4], $current_points[5], $current_points[4], $current_points[5], $current_points[2], $current_points[3]); ###$current_item->set (bpath => $path_def); $current_item->set_path_def ($path_def); } elsif ($current_state == STATE_SECOND_PRESS) { $current_points[6] = $x; $current_points[7] = $y; my $path_def = Gnome2::Canvas::PathDef->new; $path_def->moveto ($current_points[0], $current_points[1]); $path_def->curveto ($current_points[4], $current_points[5], $current_points[6], $current_points[7], $current_points[2], $current_points[3]); ####$current_item->set (bpath => $path_def); $current_item->set_path_def ($path_def); $current_item = undef; } else { croak "not reached"; } } sub item_event { my ($item, $event) = @_; if ($event->type eq 'button-press' && $event->button == 1 && $event->state >= 'shift-mask') { if ($item == $current_item) { $current_item = undef; $current_state = STATE_INIT; } $item->destroy; $item = undef; return TRUE; } return FALSE; } sub canvas_event { my ($item, $event) = @_; if ($event->type eq 'button-press') { return FALSE if $event->button != 1; if ($current_state == STATE_INIT) { draw_curve ($item, $event->x, $event->y); $current_state = STATE_FIRST_PRESS; } elsif ($current_state == STATE_FIRST_RELEASE) { draw_curve ($item, $event->x, $event->y); $current_state = STATE_SECOND_PRESS; } elsif ($current_state == STATE_SECOND_PRESS) { draw_curve ($item, $event->x, $event->y); $current_state = STATE_INIT; } else { croak "shouldn't have reached here $current_state"; } } elsif ($event->type eq 'button-release') { return FALSE if $event->button != 1; if ($current_state == STATE_FIRST_PRESS) { draw_curve ($item, $event->x, $event->y); $current_state = STATE_FIRST_RELEASE; } else { } } elsif ($event->type eq 'motion-notify') { if ($current_state == STATE_FIRST_PRESS) { draw_curve ($item, $event->x, $event->y); } } return FALSE; } sub create_canvas { my $aa = shift; # gtk_widget_push_colormap (gdk_rgb_get_cmap ()); my $canvas = $aa ? Gnome2::Canvas->new_aa : Gnome2::Canvas->new; $canvas->set_size_request (600, 250); $canvas->set_scroll_region (0, 0, 600, 250); $canvas->show; my $root = $canvas->root; my $item = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Rect', outline_color => 'black', fill_color => 'white', x1 => 0.0, y1 => 0.0, x2 => 600.0, y2 => 250.0); Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Text', text => ($aa ? "AntiAlias" : "Non-AntiAlias"), x => 270.0, y => 5.0, font => 'Sans 12', anchor => 'n', fill_color => 'black'); # gtk_widget_pop_colormap (); $item->signal_connect (event => \&canvas_event); my $frame = Gtk2::Frame->new; $frame->set_shadow_type ('in'); $frame->add ($canvas); return $frame; } sub create { my $vbox = Gtk2::VBox->new (FALSE, 4); $vbox->set_border_width (4); $vbox->show; my $label = Gtk2::Label->new ("Drag a line with button 1. Then mark 2 control points wth\n" ."button 1. Shift+click with button 1 to destroy the curve.\n"); $vbox->pack_start ($label, FALSE, FALSE, 0); $label->show; my $canvas = create_canvas (FALSE); $vbox->pack_start ($canvas, TRUE, TRUE, 0); $canvas->show; my $aa_canvas = create_canvas (TRUE); $vbox->pack_start ($aa_canvas, TRUE, TRUE, 0); $aa_canvas->show; return $vbox; } 1; Gnome2-Canvas-1.002/canvas_demo/canvas-features.pl0100644000076600000240000000575210027213456021167 0ustar muppetstaffpackage CanvasFeatures; use strict; use Glib qw(TRUE FALSE); use Gnome2::Canvas; use constant GNOME_PAD_SMALL => 4; # # Event handler for the item to be reparented. When the user clicks on the # item, it will be reparented to another group. # sub item_event { my ($item, $event) = @_; return FALSE if ($event->type ne 'button-press') || ($event->button != 1); my $parent1 = $item->{parent1}; my $parent2 = $item->{parent2}; $item->reparent ($item->parent == $parent1 ? $parent2 : $parent1); return TRUE; } sub create { my $vbox = Gtk2::VBox->new (FALSE, GNOME_PAD_SMALL); $vbox->set_border_width (GNOME_PAD_SMALL); $vbox->show; # Instructions my $w = Gtk2::Label->new ("Reparent test: click on the items to switch them between parents"); $vbox->pack_start ($w, FALSE, FALSE, 0); $w->show; # Frame and canvas my $alignment = Gtk2::Alignment->new (0.5, 0.5, 0.0, 0.0); $vbox->pack_start ($alignment, FALSE, FALSE, 0); $alignment->show; my $frame = Gtk2::Frame->new; $frame->set_shadow_type ('in'); $alignment->add ($frame); $frame->show; my $canvas = Gnome2::Canvas->new; $canvas->set_size_request (400, 200); $canvas->set_scroll_region (0, 0, 400, 200); $frame->add ($canvas); $canvas->show; # First parent and box my $parent1 = Gnome2::Canvas::Item->new ($canvas->root, 'Gnome2::Canvas::Group', x => 0.0, y => 0.0); Gnome2::Canvas::Item->new ($parent1, 'Gnome2::Canvas::Rect', x1 => 0.0, y1 => 0.0, x2 => 200.0, y2 => 200.0, fill_color => 'tan'); # Second parent and box my $parent2 = Gnome2::Canvas::Item->new ($canvas->root, 'Gnome2::Canvas::Group', x => 200.0, y => 0.0); Gnome2::Canvas::Item->new ($parent2, 'Gnome2::Canvas::Rect', x1 => 0.0, y1 => 0.0, x2 => 200.0, y2 => 200.0, fill_color => "#204060"); # Big circle to be reparented my $item = Gnome2::Canvas::Item->new ($parent1, 'Gnome2::Canvas::Ellipse', x1 => 10.0, y1 => 10.0, x2 => 190.0, y2 => 190.0, outline_color => 'black', fill_color => 'mediumseagreen', width_units => 3.0); $item->{parent1} = $parent1; $item->{parent2} = $parent2; $item->signal_connect (event => \&item_event); # A group to be reparented my $group = Gnome2::Canvas::Item->new ($parent2, 'Gnome2::Canvas::Group', x => 100.0, y => 100.0); Gnome2::Canvas::Item->new ($group, 'Gnome2::Canvas::Ellipse', x1 => -50.0, y1 => -50.0, x2 => 50.0, y2 => 50.0, outline_color => 'black', fill_color => 'wheat', width_units => 3.0); Gnome2::Canvas::Item->new ($group, 'Gnome2::Canvas::Ellipse', x1 => -25.0, y1 => -25.0, x2 => 25.0, y2 => 25.0, fill_color => 'steelblue'); $group->{parent1} = $parent1; $group->{parent2} = $parent2; $group->signal_connect (event => \&item_event); # Done return $vbox; } 1; Gnome2-Canvas-1.002/canvas_demo/canvas-fifteen.pl0100644000076600000240000001106410027213457020763 0ustar muppetstaffpackage CanvasFifteen; use strict; use Gnome2::Canvas; use Glib qw(TRUE FALSE); use constant PIECE_SIZE => 50; sub test_win { my ($window, $board) = @_; for (my $i = 0; $i < 15; $i++) { if (!$board->[$i] || ($board->[$i]{piece_num} != $i)) { return; } } my $dlg = Gtk2::MessageDialog->new ($window, 'destroy-with-parent', 'info', 'ok', "You stud, you win!"); $dlg->signal_connect (response => sub {$_[0]->destroy}); $dlg->run; } sub get_piece_color { my ($piece) = @_; my $y = $piece / 4; my $x = $piece % 4; my $r = ((4 - $x) * 255) / 4; my $g = ((4 - $y) * 255) / 4; my $b = 128; return sprintf "#%02x%02x%02x", $r, $g, $b; } sub piece_event { my ($item, $event) = @_; my $board = $item->canvas->{board}; my $num = $item->{piece_num}; my $pos = $item->{piece_pos}; my $text = $item->{text}; if ($event->type eq 'enter-notify') { $text->set (fill_color => "white"); } elsif ($event->type eq 'leave-notify') { $text->set (fill_color => "black"); } elsif ($event->type eq 'button-press') { my $y = int ($pos / 4); my $x = int ($pos % 4); my ($dx, $dy) = (0.0, 0.0); my $move = TRUE; if (($y > 0) && (! $board->[($y - 1) * 4 + $x])) { $dx = 0.0; $dy = -1.0; $y--; } elsif (($y < 3) && (! $board->[($y + 1) * 4 + $x])) { $dx = 0.0; $dy = 1.0; $y++; } elsif (($x > 0) && (! $board->[$y * 4 + $x - 1])) { $dx = -1.0; $dy = 0.0; $x--; } elsif (($x < 3) && (! $board->[$y * 4 + $x + 1])) { $dx = 1.0; $dy = 0.0; $x++; } else { $move = FALSE; } if ($move) { my $newpos = $y * 4 + $x; $board->[$pos] = undef; $board->[$newpos] = $item; $item->{piece_pos} = $newpos; $item->move ($dx * PIECE_SIZE, $dy * PIECE_SIZE); test_win ($item->canvas->get_toplevel, $board); } } return FALSE; } use constant SCRAMBLE_MOVES => 256; sub scramble { my (undef, $canvas) = @_; my $board = $canvas->{board}; # First, find the blank spot my $pos; for ($pos = 0; $pos < 16; $pos++) { last if not defined $board->[$pos]; } # "Move the blank spot" around in order to scramble the pieces for (my $i = 0; $i < SCRAMBLE_MOVES; $i++) { my ($x, $y) = (0, 0); do { my $dir = rand (65535) % 4; ($x, $y) = (0, 0); if (($dir == 0) && ($pos > 3)) { # up $y = -1; } elsif (($dir == 1) && ($pos < 12)) { # down $y = 1; } elsif (($dir == 2) && (($pos % 4) != 0)) { # left $x = -1; } elsif (($dir == 3) && (($pos % 4) != 3)) { # right $x = 1; } } while ($x == $y); my $oldpos = $pos + $y * 4 + $x; $board->[$pos] = $board->[$oldpos]; $board->[$oldpos] = undef; $board->[$pos]{piece_pos} = $pos; $board->[$pos]->move (-$x * PIECE_SIZE, -$y * PIECE_SIZE); $canvas->update_now; $pos = $oldpos; } } sub create { my $vbox = Gtk2::VBox->new (FALSE, 4); $vbox->set_border_width (4); $vbox->show; my $alignment = Gtk2::Alignment->new (0.5, 0.5, 0.0, 0.0); $vbox->pack_start ($alignment, TRUE, TRUE, 0); $alignment->show; my $frame = Gtk2::Frame->new; $frame->set_shadow_type ('in'); $alignment->add ($frame); $frame->show; # Create the canvas and board my $canvas = Gnome2::Canvas->new; $canvas->set_size_request (PIECE_SIZE * 4 + 1, PIECE_SIZE * 4 + 1); $canvas->set_scroll_region (0, 0, PIECE_SIZE * 4 + 1, PIECE_SIZE * 4 + 1); $frame->add ($canvas); $canvas->show; my @board = (); $canvas->{board} = \@board; for (my $i = 0; $i < 15; $i++) { my $y = int ($i / 4); my $x = int ($i % 4); $board[$i] = Gnome2::Canvas::Item->new ($canvas->root, Gnome2::Canvas::Group::, x => $x * PIECE_SIZE, y => $y * PIECE_SIZE); Gnome2::Canvas::Item->new ($board[$i], Gnome2::Canvas::Rect::, x1 => 0.0, y1 => 0.0, x2 => PIECE_SIZE, y2 => PIECE_SIZE, fill_color => get_piece_color ($i), outline_color => "black", width_pixels => 0); my $text = Gnome2::Canvas::Item->new ($board[$i], Gnome2::Canvas::Text::, text => sprintf ('%d', $i+1), x => PIECE_SIZE / 2.0, y => PIECE_SIZE / 2.0, font => 'Sans bold 24', anchor => 'center', fill_color => 'black'); $board[$i]{piece_num} = $i; $board[$i]{piece_pos} = $i; $board[$i]{text} = $text; $board[$i]->signal_connect (event => \&piece_event); } $board[15] = undef; # Scramble button my $button = Gtk2::Button->new_with_label ("Scramble"); $vbox->pack_start ($button, FALSE, FALSE, 0); $button->{board} = \@board; $button->signal_connect (clicked => \&scramble, $canvas); $button->show; return $vbox; } 1; Gnome2-Canvas-1.002/canvas_demo/canvas-primitives.pl0100644000076600000240000004240510027213457021541 0ustar muppetstaffpackage CanvasPrimitives; use strict; use Gnome2::Canvas; use Gtk2::Gdk::Keysyms; use Glib qw(TRUE FALSE); use constant M_PI => 3.141529; sub zoom_changed { my ($adj, $canvas) = @_; $canvas->set_pixels_per_unit ($adj->value); } my $dragging = FALSE; my ($x, $y); sub item_event { my ($item, $event) = @_; # set item_[xy] to the event x,y position in the parent's # item-relative coordinates my ($item_x, $item_y) = $item->parent->w2i ($event->coords); if ($event->type eq 'button-press') { if ($event->button == 1) { if ($event->state >= 'shift-mask') { $item->destroy; } else { $x = $item_x; $y = $item_y; $item->grab ([qw/pointer-motion-mask button-release-mask/], Gtk2::Gdk::Cursor->new ('fleur'), $event->time); $dragging = TRUE; } } elsif ($event->button == 2) { if ($event->state >= 'shift-mask') { $item->lower_to_bottom; } else { $item->lower (1); } } elsif ($event->button == 3) { if ($event->state >= 'shift-mask') { $item->raise_to_top; } else { $item->raise (1); } } } elsif ($event->type eq 'motion-notify') { if ($dragging && $event->state >= 'button1-mask') { my $new_x = $item_x; my $new_y = $item_y; $item->move ($new_x - $x, $new_y - $y); $x = $new_x; $y = $new_y; } } elsif ($event->type eq 'button-release') { $item->ungrab ($event->time); $dragging = FALSE; } return FALSE; } sub setup_item { my $item = shift; $item->signal_connect (event => \&item_event); } sub setup_heading { my ($root, $text, $pos) = @_; Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Text', text => 'text', x => (($pos % 3) * 200 + 100), y => (($pos / 3) * 150 + 5), font => 'Sans 12', anchor => 'n', #GTK_ANCHOR_N, fill_color => 'black'); } sub setup_divisions { my $root = shift; my $group = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Group', x => 0.0, y => 0.0); setup_item ($group); Gnome2::Canvas::Item->new ($group, 'Gnome2::Canvas::Rect', x1 => 0.0, y1 => 0.0, x2 => 600.0, y2 => 450.0, outline_color => 'black', width_units => 4.0); Gnome2::Canvas::Item->new ($group, 'Gnome2::Canvas::Line', points => [0.0, 150.0, 600.0, 150.0], fill_color => 'black', width_units => 4.0); Gnome2::Canvas::Item->new ($group, 'Gnome2::Canvas::Line', points => [0.0, 300.0, 600.0, 300.0], fill_color => 'black', width_units => 4.0); Gnome2::Canvas::Item->new ($group, 'Gnome2::Canvas::Line', points => [200.0, 0.0, 200.0, 450.0], fill_color => 'black', width_units => 4.0); Gnome2::Canvas::Item->new ($group, 'Gnome2::Canvas::Line', points => [400.0, 0.0, 400.0, 450.0], fill_color => 'black', width_units => 4.0); setup_heading ($group, "Rectangles", 0); setup_heading ($group, "Ellipses", 1); setup_heading ($group, "Texts", 2); setup_heading ($group, "Images", 3); setup_heading ($group, "Lines", 4); setup_heading ($group, "Curves", 5); setup_heading ($group, "Arcs", 6); setup_heading ($group, "Polygons", 7); setup_heading ($group, "Widgets", 8); } my $gray50_width = 2; my $gray50_height = 2; my $gray50_bits = pack "CC", 0x02, 0x01; sub setup_rectangles { my $root = shift; setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Rect', x1 => 20.0, y1 => 30.0, x2 => 70.0, y2 => 60.0, outline_color => 'red', width_pixels => 8)); if ($root->canvas->aa) { setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Rect', x1 => 90.0, y1 => 40.0, x2 => 180.0, y2 => 100.0, fill_color_rgba => 0x3cb37180, outline_color => 'black', width_units => 4.0)); } else { my $stipple = Gtk2::Gdk::Bitmap->create_from_data (undef, $gray50_bits, $gray50_width, $gray50_height); setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Rect', x1 => 90.0, y1 => 40.0, x2 => 180.0, y2 => 100.0, fill_color => "mediumseagreen", fill_stipple => $stipple, outline_color => "black", width_units => 4.0)); } setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Rect', x1 => 10.0, y1 => 80.0, x2 => 80.0, y2 => 140.0, fill_color => 'steelblue')); } sub setup_ellipses { my $root = shift; setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Ellipse', "x1", 220.0, "y1", 30.0, "x2", 270.0, "y2", 60.0, "outline_color", "goldenrod", "width_pixels", 8)); setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Ellipse', "x1", 290.0, "y1", 40.0, "x2", 380.0, "y2", 100.0, "fill_color", "wheat", "outline_color", "midnightblue", "width_units", 4.0)); if ($root->canvas->aa) { setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Ellipse', "x1", 210.0, "y1", 80.0, "x2", 280.0, "y2", 140.0, "fill_color_rgba", 0x5f9ea080, "outline_color", "black", "width_pixels", 0)); } else { my $stipple = Gtk2::Gdk::Bitmap->create_from_data (undef, $gray50_bits, $gray50_width, $gray50_height); setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Ellipse', "x1", 210.0, "y1", 80.0, "x2", 280.0, "y2", 140.0, "fill_color", "cadetblue", "fill_stipple", $stipple, "outline_color", "black", "width_pixels", 0)); } } sub make_anchor { my ($root, $x, $y) = @_; my $group = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Group', x => $x, y => $y); setup_item ($group); Gnome2::Canvas::Item->new ($group, 'Gnome2::Canvas::Rect', x1 => -2.0, y1 => -2.0, x2 => 2.0, y2 => 2.0, outline_color => "black", width_pixels => 0); return $group; } sub setup_texts { my $root = shift; if ($root->canvas->aa) { Gnome2::Canvas::Item->new (make_anchor ($root, 420.0, 20.0), 'Gnome2::Canvas::Text', "text", "Anchor NW", "x", 0.0, "y", 0.0, "font", "Sans Bold 24", "anchor", 'GTK_ANCHOR_NW', "fill_color_rgba", 0x0000ff80); } else { my $stipple = Gtk2::Gdk::Bitmap->create_from_data (undef, $gray50_bits, $gray50_width, $gray50_height); Gnome2::Canvas::Item->new (make_anchor ($root, 420.0, 20.0), 'Gnome2::Canvas::Text', "text", "Anchor NW", "x", 0.0, "y", 0.0, "font", "Sans Bold 24", "anchor", 'GTK_ANCHOR_NW', "fill_color", "blue", "fill_stipple", $stipple); } Gnome2::Canvas::Item->new (make_anchor ($root, 470.0, 75.0), 'Gnome2::Canvas::Text', "text", "Anchor center\nJustify center\nMultiline text", "x", 0.0, "y", 0.0, "font", "monospace bold 14", "anchor", 'GTK_ANCHOR_CENTER', "justification", 'GTK_JUSTIFY_CENTER', "fill_color", "firebrick"); Gnome2::Canvas::Item->new (make_anchor ($root, 590.0, 140.0), 'Gnome2::Canvas::Text', "text", "Clipped text\nClipped text\nClipped text\nClipped text\nClipped text\nClipped text", "x", 0.0, "y", 0.0, "font", "Sans 12", "anchor", 'GTK_ANCHOR_SE', "clip", TRUE, "clip_width", 50.0, "clip_height", 55.0, "x_offset", 10.0, "fill_color", "darkgreen"); } sub plant_flower { my ($root, $x, $y, $anchor, $aa) = @_; eval { my $im = Gtk2::Gdk::Pixbuf->new_from_file("flower.png"); my $image = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Pixbuf', "pixbuf", $im, "x", $x, "y", $y, "width", $im->get_width, "height", $im->get_height, "anchor", $anchor, ); setup_item ($image); } } sub setup_images { my ($root, $aa) = @_; eval { my $im = Gtk2::Gdk::Pixbuf->new_from_file("toroid.png"); my $image = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Pixbuf', pixbuf => $im, x => 100.0, y => 225.0, width => $im->get_width, height => $im->get_height, anchor => 'center', ); setup_item ($image); plant_flower ($root, 20.0, 170.0, 'GTK_ANCHOR_NW', $aa); plant_flower ($root, 180.0, 170.0, 'GTK_ANCHOR_NE', $aa); plant_flower ($root, 20.0, 280.0, 'GTK_ANCHOR_SW', $aa); plant_flower ($root, 180.0, 280.0, 'GTK_ANCHOR_SE', $aa); } } use constant VERTICES => 10; use constant RADIUS => 60.0; sub polish_diamond { my $root = shift; my $group = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Group', x => 270.0, y => 230.0); setup_item ($group); my @coords; for (my $i = 0; $i < VERTICES; $i++) { my $a = 2.0 * M_PI * $i / VERTICES; $coords[0] = RADIUS * cos ($a); $coords[1] = RADIUS * sin ($a); for (my $j = $i + 1; $j < VERTICES; $j++) { $a = 2.0 * M_PI * $j / VERTICES; $coords[2] = RADIUS * cos ($a); $coords[3] = RADIUS * sin ($a); Gnome2::Canvas::Item->new ($group, 'Gnome2::Canvas::Line', points => \@coords, fill_color => 'black', width_units => 1.0, cap_style => 'round'); } } } use constant SCALE => 7.0; sub make_hilbert { my $root = shift; my $hilbert = "urdrrulurulldluuruluurdrurddldrrruluurdrurddldrddlulldrdldrrurd"; my @coords = (340.0, 290.0); my @d = split //, $hilbert; for (my $i = 0 ; $i < @d ; $i++) { if ($d[$i] eq 'u') { $coords[2*($i+1)+0] = $coords[2*$i+0]; $coords[2*($i+1)+1] = $coords[2*$i+1] - SCALE; } elsif ($d[$i] eq 'd ') { $coords[2*($i+1)+0] = $coords[2*$i+0]; $coords[2*($i+1)+1] = $coords[2*$i+1] + SCALE; } elsif ($d[$i] eq 'l ') { $coords[2*($i+1)+0] = $coords[2*$i+0] - SCALE; $coords[2*($i+1)+1] = $coords[2*$i+1]; } elsif ($d[$i] eq 'r ') { $coords[2*($i+1)+0] = $coords[2*$i+0] + SCALE; $coords[2*($i+1)+1] = $coords[2*$i+1]; } } if ($root->canvas->aa) { setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Line', points => \@coords, fill_color_rgba => 0xff000080, width_units => 4.0, cap_style => 'projecting', join_style => 'miter')); } else { my $stipple = Gtk2::Gdk::Bitmap->create_from_data (undef, $gray50_bits, $gray50_width, $gray50_height); setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Line', points => \@coords, fill_color => "red", fill_stipple => $stipple, width_units => 4.0, cap_style => 'projecting', join_style => 'miter')); } } sub setup_lines { my $root = shift; polish_diamond ($root); make_hilbert ($root); # Arrow tests setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Line', "points", [340.0, 170.0, 340.0, 230.0, 390.0, 230.0, 390.0, 170.0], "fill_color", "midnightblue", "width_units", 3.0, "first_arrowhead", TRUE, "last_arrowhead", TRUE, "arrow_shape_a", 8.0, "arrow_shape_b", 12.0, "arrow_shape_c", 4.0)); setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Line', "points", [356.0, 180.0, 374.0, 220.0], "fill_color", "blue", "width_pixels", 0, "first_arrowhead", TRUE, "last_arrowhead", TRUE, "arrow_shape_a", 6.0, "arrow_shape_b", 6.0, "arrow_shape_c", 4.0)); setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Line', "points", [356.0, 220.0, 374.0, 180.0], "fill_color", "blue", "width_pixels", 0, "first_arrowhead", TRUE, "last_arrowhead", TRUE, "arrow_shape_a", 6.0, "arrow_shape_b", 6.0, "arrow_shape_c", 4.0)); } sub setup_curves { my $root = shift; my $path_def = Gnome2::Canvas::PathDef->new; $path_def->moveto (500.0, 175.0); $path_def->curveto (550.0, 175.0, 550.0, 275.0, 500.0, 275.0); my $item = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Bpath', #### can't set this here ####bpath => $path_def, outline_color => "black", width_pixels => 4); $item->set_path_def ($path_def); setup_item ($item); } sub setup_polygons { my $root = shift; my @points = (210.0, 320.0, 210.0, 380.0, 260.0, 350.0); if ($root->canvas->aa) { setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Polygon', points => \@points, fill_color_rgba => 0x0000ff80, outline_color => 'black')); } else { my $stipple = Gtk2::Gdk::Bitmap->create_from_data (undef, $gray50_bits, $gray50_width, $gray50_height); setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Polygon', points => \@points, fill_color => "blue", fill_stipple => $stipple, outline_color => "black")); } @points = (270.0, 330.0, 270.0, 430.0, 390.0, 430.0, 390.0, 330.0, 310.0, 330.0, 310.0, 390.0, 350.0, 390.0, 350.0, 370.0, 330.0, 370.0, 330.0, 350.0, 370.0, 350.0, 370.0, 410.0, 290.0, 410.0, 290.0, 330.0); setup_item (Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Polygon', points => \@points, fill_color => 'tan', outline_color => 'black', width_units => 3.0)); } sub setup_widgets { my $group = shift; my $w = Gtk2::Button->new ("Hello world!"); setup_item (Gnome2::Canvas::Item->new ($group, 'Gnome2::Canvas::Widget', widget => $w, x => 420.0, y => 330.0, width => 100.0, height => 40.0, anchor => 'nw', #GTK_ANCHOR_NW, size_pixels => FALSE)); $w->show; } sub key_press { my ($canvas, $event) = @_; my ($x, $y) = $canvas->get_scroll_offsets; if ($event->keyval == $Gtk2::Gdk::Keysyms{Up}) { $canvas->scroll_to ($x, $y - 20); } elsif ($event->keyval == $Gtk2::Gdk::Keysyms{Down}) { $canvas->scroll_to ($x, $y + 20); } elsif ($event->keyval == $Gtk2::Gdk::Keysyms{Left}) { $canvas->scroll_to ($x - 10, $y); } elsif ($event->keyval == $Gtk2::Gdk::Keysyms{Right}) { $canvas->scroll_to ($x + 10, $y); } else { return FALSE; } return TRUE; } sub create { my $aa = shift; my $vbox = Gtk2::VBox->new (FALSE, 4); $vbox->set_border_width (4); $vbox->show; my $w = Gtk2::Label->new ("Drag an item with button 1. Click button 2 on an item to lower it,\n" . "or button 3 to raise it. Shift+click with buttons 2 or 3 to send\n" . "an item to the bottom or top, respectively."); $vbox->pack_start ($w, FALSE, FALSE, 0); $w->show; my $hbox = Gtk2::HBox->new (FALSE, 4); $vbox->pack_start ($hbox, FALSE, FALSE, 0); $hbox->show; # Create the canvas #gtk_widget_push_colormap (gdk_rgb_get_cmap ()); #### FIXME ### Gtk2::Widget->push_colormap (Gtk2::Gdk::Rgb->get_cmap); my $canvas = $aa ? Gnome2::Canvas->new_aa : Gnome2::Canvas->new; $canvas->set_center_scroll_region (FALSE); # Setup canvas items my $root = $canvas->root; setup_divisions ($root); setup_rectangles ($root); setup_ellipses ($root); setup_texts ($root); setup_images ($root, $aa); setup_lines ($root); setup_polygons ($root); setup_curves ($root); setup_widgets ($root); ## (this FIXME was in the original C source, too) ## FIXME: we should have a 'rotation' spinbutton too - and fix the acute ## bugs with that ... ##if 0 # { # double affine[6]; # ##if 1 # art_affine_rotate (affine, 15); ##else # art_affine_scale (affine, 1.5, 0.7); ##endif # gnome_canvas_item_affine_relative (root, affine); # } ##endif ### FIXME #### Gtk2::Widget->pop_colormap; # Zoom $w = Gtk2::Label->new ("Zoom:"); $hbox->pack_start ($w, FALSE, FALSE, 0); $w->show; my $adj = Gtk2::Adjustment->new (1.00, 0.05, 5.00, 0.05, 0.50, 0.50); $adj->signal_connect (value_changed => \&zoom_changed, $canvas); $w = Gtk2::SpinButton->new ($adj, 0.0, 2); $w->set_size_request (50, -1); $hbox->pack_start ($w, FALSE, FALSE, 0); $w->show; # Layout the stuff my $table = Gtk2::Table->new (2, 2, FALSE); $table->set_row_spacings (4); $table->set_col_spacings (4); $vbox->pack_start ($table, TRUE, TRUE, 0); $table->show; my $frame = Gtk2::Frame->new; $frame->set_shadow_type ('in'); $table->attach ($frame, 0, 1, 0, 1, [qw/expand fill shrink/], [qw/expand fill shrink/], 0, 0); $frame->show; $canvas->set_size_request (600, 450); $canvas->set_scroll_region (0, 0, 600, 450); $frame->add ($canvas); $canvas->show; $canvas->signal_connect_after (key_press_event => \&key_press); $w = Gtk2::HScrollBar->new ($canvas->get_hadjustment); $table->attach ($w, 0, 1, 1, 2, [qw/expand fill shrink/], [qw/fill/], 0, 0); $w->show;; $w = Gtk2::VScrollBar->new ($canvas->get_vadjustment); $table->attach ($w, 1, 2, 0, 1, ['fill'], [qw/expand fill shrink/], 0, 0); $w->show; $canvas->set_flags ('can-focus'); $canvas->grab_focus; return $vbox; } Gnome2-Canvas-1.002/canvas_demo/canvas-rich-text.pl0100644000076600000240000000621410027213457021253 0ustar muppetstaffpackage CanvasRichText; use strict; use utf8; use Gnome2::Canvas; use Glib qw(TRUE FALSE); sub setup_text { my $root = shift; Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Rect', "x1", -90.0, "y1", -50.0, "x2", 110.0, "y2", 50.0, "fill_color", "green", "outline_color", "green", ); Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::RichText', "x", -90.0, "y", -50.0, "width", 200.0, "height", 100.0, "text", "English is so boring because everyone uses it.\n" ."Here is something exciting: " ."وقد بدأ ثلاث من أكثر المؤسسات تقدما في شبكة اكسيون برامجها كمنظمات لا تسعى للربح، ثم تحولت في السنوات الخمس الماضية إلى مؤسسات مالية منظمة، وباتت جزءا من النظام المالي في بلدانها، ولكنها تتخصص في خدمة قطاع المشروعات الصغيرة. وأحد أكثر هذه المؤسسات نجاحا هو »بانكوسول« في بوليفيا.\n" ."And here is some more plain, boring English.", "grow_height", TRUE, ); Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Ellipse', "x1", -5.0, "y1", -5.0, "x2", 5.0, "y2", 5.0, "fill_color", "white", ); Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Rect', "x1", 100.0, "y1", -30.0, "x2", 200.0, "y2", 30.0, "fill_color", "yellow", "outline_color", "yellow", ); Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::RichText', "x", 100.0, "y", -30.0, "width", 100.0, "height", 60.0, "text", "The quick brown fox jumped over the lazy dog.\n", "cursor_visible", TRUE, "cursor_blink", TRUE, "grow_height", TRUE, ); Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Rect', "x1", 50.0, "y1", 70.0, "x2", 150.0, "y2", 100.0, "fill_color", "pink", "outline_color", "pink", ); Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::RichText', "x", 50.0, "y", 70.0, "width", 100.0, "height", 30.0, "text", "This is a test.\nI enjoy tests a great deal\nThree lines!", "cursor_visible", TRUE, "cursor_blink", TRUE, ); } sub create { my $vbox = Gtk2::VBox->new (FALSE, 4); $vbox->set_border_width (4); $vbox->show; my $alignment = Gtk2::Alignment->new (0.5, 0.5, 0.0, 0.0); $vbox->pack_start ($alignment, TRUE, TRUE, 0); $alignment->show; my $frame = Gtk2::Frame->new; $frame->set_shadow_type ('in'); $alignment->add ($frame); $frame->show; # Create the canvas and board my $canvas = Gnome2::Canvas->new; $canvas->set_size_request (600, 450); $frame->add ($canvas); $canvas->show; my $root = $canvas->root; setup_text ($root); return $vbox; } 1; Gnome2-Canvas-1.002/canvas_demo/canvas.pl0100644000076600000240000000210010027213500017321 0ustar muppetstaffuse strict; use Gnome2::Canvas; require "canvas-arrowhead.pl"; require "canvas-curve.pl"; require "canvas-features.pl"; require "canvas-fifteen.pl"; require "canvas-primitives.pl"; require "canvas-rich-text.pl"; sub create_canvas { my $app = Gtk2::Window->new; $app->signal_connect (delete_event => sub { Gtk2->main_quit; 1 }); my $notebook = Gtk2::Notebook->new; $notebook->show; $app->add ($notebook); $notebook->append_page (CanvasPrimitives::create (0), Gtk2::Label->new ("Primitives")); $notebook->append_page (CanvasPrimitives::create (1), Gtk2::Label->new ("Antialias")); $notebook->append_page (CanvasArrowhead::create (), Gtk2::Label->new ("Arrowhead")); $notebook->append_page (CanvasFifteen::create (), Gtk2::Label->new ("Fifteen")); $notebook->append_page (CanvasFeatures::create (), Gtk2::Label->new ("Features")); $notebook->append_page (CanvasRichText::create (), Gtk2::Label->new ("Rich Text")); $notebook->append_page (CanvasBezierCurve::create (), Gtk2::Label->new ("Bezier Curve")); $app->show; } Gtk2->init; create_canvas (); Gtk2->main; Gnome2-Canvas-1.002/canvas_demo/ENTRYPOINT_IS_canvas.pl0100644000076600000240000000000007673401543021527 0ustar muppetstaffGnome2-Canvas-1.002/canvas_demo/toroid.png0100644000076600000240000004102507673401543017553 0ustar muppetstaffPNG  IHDRNgAMA1_ IDATx{UY{}}}{gz^f2 @eBʱŽ$`W*6qQeR$e 4h4g=^cv+Pe r~un߾}9Zw}=uyʼn -P\}&?ϊjrY=\oά5zf;,Ap&ao/ˮ/{/z)L,)DIW^f&n!oX/}sJi$u̅GD?(߷xO8gBu/+3w=$6 wZ5UWR*%60HNC麞Mٴ ]A䢿i/OoZnygng)$zpqAo:z^N3J+SR$BX !̡Zڋk]eR7RM10MM ե+!h wHKMsW}M<`_+,KW -rO*V"VUPIRgU%k@ޅ;5uH2E ՛ozрu"a牔TwZ/xYH!5*7:=)DTLĪj EU+f#a6R&G0"4amqk+UᯕHBBOLk՝fjγǗDR"$J@ѓanGnh  u(2]+E)|&,N1 !Pvt؅$5 AAT(o|Eצ?y\!ܺ+eui`9'X y<. vC/b$"v ԹɁģ^Q*Bw{x|<')TY~AAZ.~[7|%T ayw.VfU8WBY|:-eqs#9f3 +&Ī .֋"&DŦPY(TokPP5@7:|>4]C5@9& ן(YB7yۛ;"Aġ *w#v*Z "\Jh ,/ut ,VX Բr u3+;/|eH+;݋o|' ' Zm[!U0 $hO VR$ t>j> :h`]1:CvA 6xzVQ@%g`9լ0FP$lҙa:<R<Xy77XQTIĤ 4 U*f0+N2`p/Ji[x%@`#Ձ}TZjx+նrZ< Ts_wq-h$(!]H͡(,IA1+d+YLIgMbJULwnpsZK9 2ɥ?(SX/NpKjH%#) 5LUZ)pY%(L0 隠VhP t* ׷#`=j8~_(+Z6,ͯ% z}ٟ/vJ/:yI;ˡ,NG G ha2qTf l<ѡ|DC ``4!6 Zˆ×5V%y³+X\ O( O/ ;Jqd: wT3>0)V܀/#8YZFGCkBUM~T@K` B+(˹v6Аw<uh'lb"6Ӏޘ1fHH J@h,UY .K@a.PxՁ4N54=ߢraȒldF&,v&pt$ %p-]ع fhmY mh(rm̕pf ^׵CfUt6 l̃ !1oZn2mfґmE_dfռߓU do@#(y4?Aݙ5&t-: *j zUʣSxTHlOiagSt 'iN4$uɊ0hu}9m_h҅a9),R{r5/%z0衋؇^ )g⳱M@P1=,BoZ/Q3h#LFˡ: 5l4z;4SC :`J&B]VJQ6*D$g{IrOM^/~?O~Gp -^r>ۅ!HxI(.pG+4TJ1:y%̽2WR̩ie;Y[8ppP076ք0&Q8H @57b`qS(J5.h kCU)Z°4vJG%á#LpF' VWdOL)@B'1PE^OWQb@mݖT3 6V[i=<a*pPht^M $9GȤB >DW:(+Nն (JI 'X,eМ#XT=\V!+kzURݳ(:Il(g0Sht$2 jaF< Ea>rtf TXY=#̯ҋppg}Q!mvL;H-X2z# z݀WQ**%Z4b\[2B7?o̕d0skLjC3` i"tv=BD;Nn(Q@-fc - 8TQW!Yyv+Y%sT! yO 3EgT5KFP+nW)GubPLP(QD%/ ^VazFCȓ wvsNNcF+YxP\ƻ,,,LdOShY +,pIf)"!=/dS!Qـ!a{I4#T#*n\A۞BR9%EOO}W=pb9DDdJ9 &m($R N9ׁ EDl NyNP Db+̃9R.ȏ.w?=2xjsGz3>cĤYVf3'υ,\ID\tqUi!kO Y*dMVWHݙH \T¬H'ixћ 3'"KmJ. ͅTl*U##$1)o ! e7Ul!%b &5D"D=dyՈDʙlSk^ȓ 2[NGZSY;yBk=br%)Rdgdx/HoxHD I $/3Gte ҘvS$?;I:#'ۜ;`1neiJAq(P:Bw|: 6{ 4 -%1=Crb^XPB ]SAsE-hRiLI\lGف2U1Dwj)U͞ ^4^):(2HnN|ykG^'Ϻյ[4[*2XGHޏ l Ƽ`6=IS$B#NzEMt^!&)`HC@6 % j& ,PZs  h 5 o(a:ujCh "Qv'-a:X,=+^(l<,n3)b t/A9f mUT|D @Ԑx8AN&̧~żWOk+.f2H[#iMىXA&4XB3vY$OH1F`TFsn Pa)nkkt\S"3w PpI4qQ'/ITZy3h$Vo+ei_%,jnygo%Xflh =`DՏz+B)h%SLHPlTK1B"J_5,~*?OoXŏ{ !i!GG*`ȻH_`#It\f` p pu'0/A OVٖ i ;dߠ-' Z/I4Ka&EOn"ij̇_Կwx=| 4QrQ0b0(Fvgn)E)HY]Hݏ !Af~ru/DN$?Y4)jL zhb͔%EH0XXL``3lb^ ۖ;ɵW>5kZ5hǶ[hy3~5 i,$ECKtZ2bsegu*H""?db>sם:V70E4!]s{%snKϔ/Y<1MXP LRܶYIOr7ok5JB-ySL9}2#mt$D`S?\,SI? qǻ :sXuUn7֐)Be9^i2?~M/"F'œٖ.9!>@ڌu]Rp)xkkжʁZMsdRMY\;0dZ:$UKO1MN'CeOO{gYvIHd +Ǟ~+X¿Usr0؄^6=ypi~Ңh AC%?vP'LR`+FDD}Euy GQɠ,S8xcWzoKCF]IRd^Cq;f__,NÕd2=~s֬43-u*c"JfV ]rFLHRТŊhXRJ X&,k~p&%IzA!H Eb| 3LF]7a:*Xdm>Г[f1{fGK e8qc:_/T!0+*s~`$-*SyB+ QLۑI%t QHלSpҥ&6"E[Y HIȎH?f{RjjO~au*KӼH@:04aL+ Np?+CK xRp%S<CĒS3BYIlf{uYH/Zy=1į*}t2E,~#1OṗH9" [NG|di>xߒ>qZi%ϽB=ŀ))NK14DH`gO )9 2 IDATG$Ma{!~*X˸M QVv'x*x܈u= ٺp*zM0~e7jH0'_g'o o?VHhSaHBa:-F3rӀ7Ԅ6)d .AdȠ$B":Q;.R;iDRT})t]|_wW4aY$;~CrZz68pT)1#Qc6 :'(URBuD7`oF% ǶkpW0ޮf:3Dx5m!&,ubH f_ h_7IhiդS}?iuQMiԲwuZ_b%^ݫ'=OY͙!$tX&39HCqoQk<'ӫۡx!≿BX@6:9dvbTCֵ0u:`z栩MAf8zgՍ{?,|Wh?=Oo[/lJy 3d>9YM"DRK nKZsM1O3RM1n(@Ds,M0-Aɜ@VDcp,) jROO4譼5x<8Q"@6_E<~Vr "&P1*1Ȣ)`v75N{+,)Y$:0IAQ2y&yrm=]H[a4ɘտ~Z-wړx\d"Iϝ{z]ξ$ZI"#'#CI۬=ܦyR] l}nxDza uPV̤hlR偣MOI(T(qGe Blnl6q8@uWImcQ *w!jsD8$1xP~ACHn!P/Ff["RZ=üFƷn-̱ .~B`l2%h\.2 Dg*>ު\~9Goj˷Z`73xEF)IZ,sJnABXpċ.CpoI}z7W2!g KBV/w7 7Hi\S̚g4,u5(Gs3Z;3gt8戜ib9tr2gNEYFZ hУbJŜ?6ׯ1 rtX;",i۱-!*$[H_ou$=ĞC>zXl0waC^k#5&8(3$xzPc}Z W(pbpLI II8#,Y-nsT'@%(,hj4hhoM#eˁ܀g2e4LТKOc@:TZ,b^`LBN]w,n/|P_P@1&Tdŗnh ^g6>8paC]/0NsףPI]bUHIXa6g & <9KSrMonOf{x}쩅my^A8uO֍n*cs}ΈCQ$$XlҜe4i0e8_caiQlT8<g Lӣ2`OJ}fL9dΌy]bqmu,_{RwI]qQ.m0{Iba9yb )[6CqԗA4 zv;FzN9`i!4Xgc;7 vhm/Oq#|y =>mRɄ3aMN#ttFf 0a\dNFJ :i$''2J6-2K2`Qiu;PQfL2eY,2YÐ!; 9J7t-}覎??|P_6oo!8\![F^ MW:9%)T@GcYM &ZYtǤ"3Mf!Sxr#{Ď(-E>AITԣ]g;}"%3d۪uX x=_R*h hAL $UN\efUj#JI:Ew9''8m?JFA2w+X8l uzfiiV"zaSq K"JAɗI>ki> vDVTu-,l\b١i.dMwy[h+*,Uֽ VO5PH*]K&=:x@E@Dɒh!2%&aFFʌ A;r|{=5J>IU8!:g=Xd*zlnܿ"i41YsbHCnc$II¬2ؤ|_,:66]1,q-Wb} CߡNLcJFQxO)\e-9qU+CLy\;*X(|Xc N ζ79]4,dOS=a"]7"$%&%D!iѤK)3&L 1cLM7cFJ-<-e{2Տt.ӫBW}h.? j{-2y|.^پmsyO8[K8 E\9@ x SXl#q(2_@Θ'9k,qD MD ^_q#y=} pU P#aXmqBH |:,:k:Ol*00%&$6M1!ѱ3J2lE(ЄD䴰!RECd^\lOzF|]QA_]"e:4YIۓߧ).5ayј P᳾e7gWwgC7F!A5"d@Ș ~h?%2GL 0fB 6m,GH 7;cgr%_շQ?=jw(㉐oHgA :2\f6II6j 4rC~ Q-nB>H4>k4mCW\T4pnv5r|z'8=M0逊6.k2p+NȰUӥIN'{bCBD2%gfhp łM1ej0%$$ 'Em|,$) /˷_/^pVNfUTz_\}QUBDKZԥqp3OX)kF 6FіGE.ϐB1  䀔̸Gɐj%Es,\|FvYNbrHF+"~| h {a;cv ߵiO%̿mxX(4%!&0aB@HB.y]\~Cf1R(y+vD{~Jj{kw5ZR܇%@An@A_jy&8RfZ!"/NHK HPnsHP p6Ai2qi$ Q2)m"&-F^f{/f2EUVM|OeÔ=f-a3<f!g&X8+7WFAzw_DcUTSO>f;B~@6zQc( B ʠQƐŌ1obFvHb:45󶦄) #PhrQ4(SDj2` RƣGs,sC49-P،&d G=>ErXn1 -ڜg3|yVdb#jT8Xx8celá0&"6ˤA!3y/Gs)t3H@CP%V#Qb )5\Z8VP0Ty0E03} ל2-69"gLΐĤ&)Bn3x8 !DҤGP6]V鰌%{g$O?=&3Ҍ"]?itir[=}LYQҰcs~2ZoB PǐGdM! :5V 4|Uh]=屟HspJrpNe c+?gBC2h lYz,-,~^Ir@h8>.lkDL,[Wy]%L~KORtv&/R͡+n=gp|<HʗU/??c""jcfLaW mQs&0,}$1)׭.-ppro얕(x k%.=j8cw틽9jq! RUW!ϬKi^GHE%Bvo̢srj'Of|=#➸=zo}!bzgѻY??tY+P,N`M ׼G8 3rnjVv)c=|a&-Vq2:-ə(iaV̑nʰ W_j=$%V.*,c\C\9^Fz q4Iۜ[Ys]Yʅwt   ,R.qlׁupi1E`M2n9X# '!!`,w7x;ƛ#Od+fz73D%խlWwKGz)}pρwZ~up[ lKESXiX48ϷiVQe}|f¡G&q)6M\ZبZj^2YY&z@PDe._nHݮ=G]kQ'QNKOItOI햢!a9bXyse `ĦTq4ԦM,16]w"$wx뛯U5݌݇IDAT@6X36[K XgڷppP$$ (M{zn9h6a5?-*Rsw3q{i+ߣ4+'=k+YXty3v,s|S"#}fuX:` &mz1 xy]U"Ay?o?Uڌ5gՔ4?f9t6,Z]%$*D2WbNxEZlY3k[uezzen qSV4h)W4҈2ωbpV˔%ed.I~U KӒƪaԒt$;7uvڠflg|IrS#G6MwpHfJ{4还 JIENDB`Gnome2-Canvas-1.002/ChangeLog0100644000076600000240000002712610110013737015026 0ustar muppetstaff2004/08/15 22:11 (-0400) muppetman * Canvas.pm, NEWS, README: stable bugfix release 1.002 2004/08/15 22:07 (-0400) muppetman * t/GnomeCanvas.t, t/GnomeCanvasItem.t, xs/GnomeCanvas.xs, xs/GnomeCanvasItem.xs: fix the unusably broken bindings for Gnome2::Canvas::w2c_affine(), Gnome2::Canvas::Item::i2w_affine(), and Gnome2::Canvas::Item::i2c_affine(). we retain compatibility with the broken signature, and include tests for both broken and fixed. 2004/08/15 22:01 (-0400) muppetman * xs/GnomeCanvasUtil.xs: minor doc updates. 2004/08/15 19:37 (-0400) muppetman * xs/GnomeCanvasUtil.xs: fixed mysterious failure on darwin of polygon_to_point(); was passing the wrong length value to the C function. don't know how it worked in the first place. 2004/08/13 22:33 (-0400) muppetman * Canvas.pm: don't set dl_load_flags on darwin. 2004/08/13 22:22 (-0400) muppetman * xs/GnomeCanvasItem.xs: apidoc fixes 2004/08/13 07:49 (-0400) muppetman * xs/GnomeCanvas.xs: force generation of docs for Gnome2::Canvas::Text, which has properties but no methods. 2004/06/06 11:52 (-0400) muppetman * Canvas.pm, NEWS, README: stable release 1.001 2004/06/02 15:53 (-0400) muppetman * xs/GnomeCanvas.xs: fix the broken example in the synopsis. 2004/05/17 18:15 (+0200) kaffeetisch * t/GnomeCanvasPathDef.t: Skip the open_parts and closed_parts tests to pass when working with 2.0.x. 2004/05/06 21:11 (-0400) muppetman * xs/GnomeCanvas.xs: unused var 2004/03/29 12:04 (-0500) muppetman * Canvas.pm, README, NEWS: stable release 1.0 * Makefile.PL: require stable Glib and Gtk2. * Canvas.pm: add import version checking, so we don't later wish we'd added it now. 2004/03/20 23:27 (-0500) muppetman * canvas_demo/canvas-arrowhead.pl, canvas_demo/canvas-curve.pl, canvas_demo/canvas-features.pl, canvas_demo/canvas-fifteen.pl, canvas_demo/canvas-primitives.pl, canvas_demo/canvas-rich-text.pl: use Glib's TRUE and FALSE constants instead of defining our own. 2004/03/18 14:26 (-0500) muppetman * Makefile.PL, README: patch from Torsten corrects the EU::PkgConfig version requirements. 2004/03/16 13:58 (-0500) muppetman * Canvas.pm, NEWS, README: beta release 0.93 * Makefile.PL: require ExtUtils::PkgConfig 1.03 and Glib 1.039 2004/03/16 13:58 (-0500) muppetman * xs/GnomeCanvas.xs: flesh out the pod for GET_VERSION_INFO. 2004/03/16 01:05 (-0500) muppetman * Makefile.PL, xs/GnomeCanvas.xs, gnomecanvasperl.h: modified patch from emmanuele adds GET_VERSION and CHECK_VERSION, and the required Makefile.PL magic to get that information. Refactor the Makefile.PL code a bit, too. 2004/03/07 00:40 (-0500) muppetman * Makefile.PL: check the version of ExtUtils::Depends. 2004/03/07 00:35 (-0500) muppetman * Canvas.pm, xs/GnomeCanvas.xs: move pod from Canvas.pm to xs/GnomeCanvas.xs, and beef it up. use the description text from libgnomecanvas' gtk-doc. assume the reader doesn't care that this is a binding and just wants to know about the perl object. 2004/02/26 17:37 (-0500) muppetman * README: fix the spelling of license; update the sandbox instructions. 2004/02/12 19:00 (-0500) muppetman * Canvas.pm, Makefile.PL, README, NEWS: unstable release 0.92 2004/02/10 01:43 (-0500) muppetman * xs/GnomeCanvasItem.xs, xs/GnomeCanvasPathDef.xs, xs/GnomeCanvasUtil.xs: pod updates 2004/01/29 19:22 (-0500) rwmcfa1 * Canvas.pm, README: beta release 0.91 * NEWS: initial import * MANIFEST: NEWS added 2004/01/25 23:13 (-0500) muppetman * gnomecanvasperl.h, maps: rearrange the boxed type support for GnomeCanvasPathDef. it's now defined in the maps file like the rest, and the definition in gnomecanvasperl.h can be easily avoided if/when libgnomecanvas provides the appropriate boxed type support. * xs/GnomeCanvasPathDef.xs: change boxed type support to use ref instead of duplicate for copy. add \$pathdef->copy, with doc that reminds people it's not the same as Glib::Boxed::copy. 2004/01/24 21:44 (-0500) rwmcfa1 * Makefile.PL: removed runtime_reqs stuff, replaced by the pkg-config trick * perl-Gnome2-Canvas.spec.in: use pkg-config for Requires version 2004/01/12 22:48 (-0500) muppetman * Canvas.pm: updated docs. * xs/GnomeCanvas.xs: doc fixes. re-order some xsubs to have better doc ordering. hide pixels_per_unit from docs; prefer get_pixels_per unit since there's a set_pixels_per_unit. adjust ALIASed xsubs to avoid having an extra unused name in the symbol table. * xs/GnomeCanvasItem.xs: mangle ALIAS ordering to remove invalid entries from the symbol table. 2004/01/12 18:34 (-0500) muppetman * canvas_demo/canvas-curve.pl, canvas_demo/canvas-arrowhead.pl, canvas_demo/canvas-primitives.pl: use operators rather than grep on flags values, and other sundry cleanup. * canvas_demo/canvas-fifteen.pl, canvas_demo/canvas.pl: port canvas-fifteen to perl at long last 2004/01/08 23:48 (-0500) muppetman * Canvas.pm, README: beta release 0.90 * Makefile.PL, README: require Glib-1.020, since we require MakeHelper and lots of doc stuff. * Makefile.PL: supply the DATE replacement if using a Glib whose MakeHelper doesn't actually perform that sub. (it was added after 1.020 was released.) 2003/12/29 22:52 (+0100) kaffeetisch * t/GnomeCanvasPathDef.t: Don't loop over the return values of split, open_parts and closed_parts but only look at the first returned list element. This makes the test independent from implementation details. 2003/12/29 16:32 (-0500) rwmcfa1 * perl-Gnome2-Canvas.spec.in: use the new DATE replacement in conjunction with VERSION to create the changlog on the fly, which is better. 2003/12/23 00:00 (-0500) muppetman * xs/GnomeCanvas.xs, xs/GnomeCanvasItem.xs: hush warnings about uninitialized and unused parameters. 2003/12/17 10:58 (-0500) muppetman * t/GnomeCanvasPathDef.t: patch from kaffee hushes some warnings on FreeBSD. * t/GnomeCanvasItem.t: added commentary about how we can't do anything about warnings from get_bounds() on shapes on libgnomecanvas 2.0.x. 2003/12/07 13:47 (+0100) kaffeetisch A t/GnomeCanvas.t A t/GnomeCanvasItem.t A t/GnomeCanvasPathDef.t * MANIFEST: Add a test suite. * t/GnomeCanvas.t * xs/GnomeCanvasUtil.xs: Implement and test Gnome2::Canvas::point_to_polygon. 2003/12/05 16:04 (-0500) muppetman * Canvas.pm, Makefile.PL: can't get ABSTRACT without head name, so put it into the WriteMakefile call. * xs/GnomeCanvas.xs, xs/GnomeCanvasUtil.xs: okay, Canvas_methods is *really* gone now. 2003/12/05 15:51 (-0500) muppetman * xs/GnomeCanvasPathDef.xs: another update from kaffee -- don't leak the return values of pathdef functions. * Makefile.PL, Canvas.pm, xs/GnomeCanvas.xs: some hacks to the pod generation for the Gnome2::Canvas manpage, in an attempt to get rid of the horrible Gnome2::Canvas_methods. this merges the pod from the pm file into the pod generated from the xs file; the output is... well, functional. 2003/12/05 00:14 (-0500) muppetman stuff from kaffee, who is working on a test suite. A xs/GnomeCanvasShape.xs * MANIFEST: added new file for GnomeCanvasShape's functions * canvas.typemap: typemap for const GnomeCanvasPathDef* * xs/GnomeCanvas.xs: remove =for object Gnome2::Canvas::Shape, it has its own xs file. fix b0rken call signature for $canvas->get_color, which was requiring a returned parameter. * xs/GnomeCanvasItem.xs: use actual typemaps for some enum/flags types instead of plain integers. * xs/GnomeCanvasPathDef.xs: implement a bunch of missing pathdef methods. * xs/GnomeCanvasRichText.xs: don't leak. 2003/11/13 23:58 (-0500) muppetman * Makefile.PL, README, Canvas.pm: bump version to 0.34. require Glib 1.01, but only Gtk2 1.00 -- we only need the docgen stuff from Glib, and nothing new from Gtk2. 2003/11/11 00:36 (-0500) muppetman * MANIFEST, debian/*: remove the debian packaging files, since having them in the upstream dist makes it difficult for the maintainers * Canvas.pm: add pointer to generated docs 2003/11/06 16:54 (-0500) muppetman * xs/GnomeCanvas.xs: accessors for pixels_per_unit 2003/11/06 11:37 (-0500) muppetman * xs/GnomeCanvas.xs: route GnomeCanvas's log domains through perl's warn() and croak() * xs/GnomeCanvasItem.xs, xs/GnomeCanvasPathDef.xs, xs/GnomeCanvasUtil.xs: remove type on class params so that the doc shows them correctly (and so that the bindings don't waste cycles on unused params) 2003/11/02 14:17 muppetman * Makefile.PL: remove the stupid atleast version checks -- Glib and Gtk2 have been corrected. 2003/10/29 02:00 muppetman * Canvas.pm: bump version for next devel series. * Makefile.PL: use the latest CVS Glib and Gtk2 features -- atleast version checks, MakeHelper, doc generation, etc. * xs/GnomeCanvas.xs: doc comments 2003/09/21 20:19 rwmcfa1 * Makefile.PL: fixed bug in specfile generation 2003/09/21 19:42 muppetman * Makefile.PL perl-Gnome2-Canvas.spec.in: there was some disagreement about the actual substitution symbols... 2003/09/21 19:36 muppetman * Canvas.pm META.yml Makefile.PL README debian/changelog debian/control: updated for 0.32 release 2003/09/17 10:44 rwmcfa1 * Makefile.PL: ExtUtils::PkgConfig can now deal with version requirements using pkg-config's interface, make use of it. 2003/09/16 23:50 rwmcfa1 * Makefile.PL, perl-*spec.in: somewhat automated versioning system implemented for depenancy modules 2003/09/15 22:26 rwmcfa1 * Makefile.PL: spec file dependancies improved 2003/09/06 19:23 rwmcfa1 * Makefile.PL: dist-rpms build target added * perl-Gnome2-Canvas.spec.in: initial import 2003/09/02 21:08 muppetman * Canvas.pm, README, META.yml, debian/changelog: prep for 0.30 release. flesh out the pod a bit. * canvas.typemap: use T_GPERL_GENERIC_WRAPPER * Makefile.PL: require Glib 0.97 (because of the new typemap stuff); update the build to do prereqs properly * TODO, MANIFEST: updated * MANIFEST.SKIP: new * canvas_demo/canvas-primitives.pl, xs/GnomeCanvasPathDef.xs: commentary * xs/GnomeCanvas.xs: consolidate the constructors into one aliased xsub 2003/08/19 21:11 rwmcfa1 * Makefile.PL: added realclean removal of build dir to postamble section. 2003/08/18 12:34 muppetman * debian/*: patch from james curbo adds debian packaging stuff 2003/07/18 13:00 muppetman * Canvas.pm, Makefile.PL, README: bump version information for 0.28 release 2003/07/07 23:06 muppetman * Makefile.PL: use new args of Gtk2::CodeGen->write_boot to avoid boot problems 2003/07/05 00:42 muppetman * xs/GnomeCanvasBpath.xs, canvas_demo/canvas-curve.pl, xs/GnomeCanvas.xs, xs/GnomeCanvasPathDef.xs: hackish workaround for bug in libgnomecanvas * Canvas.pm: bump version to 0.26 for release 2003/06/27 17:00 muppetman * Makefile.PL, canvas_demo/canvas_arrowhead.pl, canvas_demo/canvas-features.pl: require latest Gtk2 and Glib, which treat objects as hashes. * canvas_demo/canvas-curve.pl: mark known crash. 2003/06/20 12:00 muppetman * Canvas.pm Makefile.PL README: bump version info and prepare for 0.24 release * gnomecanvasperl.h: one-time-include stuff used the wrong name, would prevent inclusion of gnome2perl.h (copy and paste bug - bad muppet, no biscuit) 2003/06/19 17:11 pcg * t/01.t: make it actually work. 2003/06/16 13:46 muppetman * xs/GnomeCanvasUtil.xs, canvas_demo/canvas-primitives.pl, canvas_demo/canvas-arrowhead.pl: use a GPerlBoxedWrapperClass override to allow GnomeCanvasPoints to be implemented as simple perl array references. * Makefile.PL, MANIFEST: make sure we're ready to go out 2003/06/04 23:45 muppetman cleanup, making it ready to share with other people * canvas_demo/canvas-curve.pl 2003/06/03 13:42 muppetman * canvas_demo/canvas-rich-text.pl 2003/06/02 12:00 muppetman started from a copy of the Gnome2-Perl module. Gnome2-Canvas-1.002/genmaps.pl0100644000076600000240000000424407673401543015257 0ustar muppetstaff#read !grep _TYPE_ /usr/include/gtk-2.0/gtk/*.h | grep get_type #% s/^.*[ \t]\([_A-Z0-9]*_TYPE_[_A-Z0-9]*\)[ \t].*$/\1/ # # $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/genmaps.pl,v 1.1 2003/06/16 17:50:27 muppetman Exp $ # =out libgnomecanvas-2.0 =cut @dirs = ( '/usr/include/libgnomecanvas-2.0/libgnomecanvas/', ); foreach $dir (@dirs) { @lines = `grep _TYPE_ $dir/*.h | grep get_type`; foreach (@lines) { chomp; s/^.*\s([A-Z][A-Z0-9_]*_TYPE_[A-Z0-9_]*)\s.*$/$1/; # print "$1\n"; push @types, $_; } } open FOO, "> foo.c"; select FOO; print '#include #include const char * find_base (GType gtype) { if (g_type_is_a (gtype, GTK_TYPE_OBJECT)) return "GtkObject"; if (g_type_is_a (gtype, G_TYPE_OBJECT)) return "GObject"; if (g_type_is_a (gtype, G_TYPE_BOXED)) return "GBoxed"; if (g_type_is_a (gtype, G_TYPE_FLAGS)) return "GFlags"; if (g_type_is_a (gtype, G_TYPE_ENUM)) return "GEnum"; if (g_type_is_a (gtype, G_TYPE_INTERFACE)) return "GInterface"; if (g_type_is_a (gtype, G_TYPE_STRING)) return "GString"; { GType parent = gtype; while (parent != 0) { gtype = parent; parent = g_type_parent (gtype); } return g_type_name (gtype); } return "-"; } int main (int argc, char * argv []) { g_type_init (); '; foreach (@types) { print '#ifdef '.$_.' { GType gtype = '.$_.'; printf ("%s\t%s\t%s\n", "'.$_.'", g_type_name (gtype), find_base (gtype)); } #endif /* '.$_.' */ '; } print ' return 0; } '; close FOO; select STDOUT; system 'gcc -DGTK_DISABLE_DEPRECATED -Wall -o foo foo.c `pkg-config libgnomecanvas-2.0 --cflags --libs`' and die "couldn't compile helper program"; @packagemap = ( # [ Art => 'Gnome2::Art' ], # no gobject hooks [ GnomeCanvas => 'Gnome2::Canvas' ], [ Gnome => 'Gnome2' ], # fallback ); foreach (`./foo`) { chomp; my @p = split; my $pkg = 'Gnome2'; my $prefix = 'Gnome'; foreach $f (@packagemap) { my $t = $f->[0]; if ($p[1] =~ /^$t/) { $prefix = $f->[0]; $pkg = $f->[1]; last; } } (my $fullname = $p[1]) =~ s/^$prefix/$pkg\::/; $fullname =~ s/\::$//; print join("\t", @p, $fullname), "\n"; } Gnome2-Canvas-1.002/gnomecanvasperl.h0100644000076600000240000000314710025513523016611 0ustar muppetstaff/* * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307 USA. * * $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/gnomecanvasperl.h,v 1.4 2004/03/16 05:57:39 muppetman Exp $ */ #ifndef _GNOMECANVASPERL_H_ #define _GNOMECANVASPERL_H_ #include #include #ifndef GNOME_TYPE_CANVAS_PATH_DEF /* custom boxed wrapper for GnomeCanvasPathDef, since the library doesn't * supply one. */ # define GNOME_TYPE_CANVAS_PATH_DEF (gnomecanvasperl_canvas_path_def_get_type()) GType gnomecanvasperl_canvas_path_def_get_type (void) G_GNUC_CONST; #endif /* not defined GNOME_TYPE_CANVAS_PATH_DEF */ #include "gnomecanvasperl-autogen.h" #include "gnomecanvasperl-version.h" /* special handling for libart affine transform arrays */ SV * newSVArtAffine (double affine[6]); double * SvArtAffine (SV * sv); #endif /* _GNOMECANVASPERL_H_ */ Gnome2-Canvas-1.002/LICENSE0100644000076600000240000006131407673401543014276 0ustar muppetstaff GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA. Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! Gnome2-Canvas-1.002/Makefile.PL0100644000076600000240000000724110032052435015223 0ustar muppetstaff# # $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/Makefile.PL,v 1.29 2004/03/29 16:55:57 muppetman Exp $ # use strict; use 5.008; use ExtUtils::MakeMaker; use Cwd; use File::Spec; # minimum required version of dependencies we need to build our %build_reqs = ( 'perl-ExtUtils-Depends' => '0.200', 'perl-ExtUtils-PkgConfig' => '1.03', 'perl-Glib' => '1.040', 'perl-Gtk2' => '1.040', 'GnomeCanvas' => '2.0.0', ); # Writing a fake Makefile ensures that CPAN will pick up the correct # dependencies and install them. unless (eval "use ExtUtils::Depends '$build_reqs{'perl-ExtUtils-Depends'}';" . "use ExtUtils::PkgConfig;" # just seeing if Glib is available isn't enough, make sure # it's recent enough, too . "use Glib '$build_reqs{'perl-Glib'}';" . "use Glib::MakeHelper;" . "use Gtk2 '$build_reqs{'perl-Gtk2'}';" . "use Gtk2::CodeGen;" . "1") { warn "$@\n"; WriteMakefile( PREREQ_FATAL => 1, PREREQ_PM => { Glib:: => $build_reqs{'perl-Glib'}, Gtk2:: => $build_reqs{'perl-Gtk2'}, ExtUtils::Depends:: => $build_reqs{'perl-ExtUtils-Depends'}, ExtUtils::PkgConfig:: => $build_reqs{'perl-ExtUtils-PkgConfig'}, }, ); exit 1; # not reached } my %pkgcfg = ExtUtils::PkgConfig->find ('libgnomecanvas-2.0 >= ' . $build_reqs{GnomeCanvas}); mkdir 'build', 0777; # # autogeneration # Gtk2::CodeGen->parse_maps ('gnomecanvasperl'); Gtk2::CodeGen->write_boot (ignore => '^Gnome2::Canvas$'); ExtUtils::PkgConfig->write_version_macros ("build/gnomecanvasperl-version.h", 'libgnomecanvas-2.0' => 'GNOME_CANVAS'); our @xs_files = ; our %pm_files = ('Canvas.pm' => '$(INST_LIBDIR)/Canvas.pm',); our %pod_files = Glib::MakeHelper->do_pod_files (@xs_files); our @typemaps = qw(canvas.typemap build/gnomecanvasperl.typemap); our @headers = qw(gnomecanvasperl.h build/gnomecanvasperl-autogen.h build/gnomecanvasperl-version.h); # now we're ready to start creating the makefile. # we need to use ExtUtils::Depends to get relevant information out of # the Glib extension, and to save config information for other modules which # will chain from this one. my $gnomecanvas = ExtUtils::Depends->new ('Gnome2::Canvas', 'Gtk2'); $gnomecanvas->set_inc ($pkgcfg{cflags}); $gnomecanvas->set_libs ($pkgcfg{libs}); $gnomecanvas->add_xs (@xs_files); $gnomecanvas->add_pm (%pm_files); my $cwd = cwd(); $gnomecanvas->add_typemaps (map {File::Spec->catfile($cwd,$_)} @typemaps); $gnomecanvas->install (@headers); $gnomecanvas->save_config ('build/IFiles.pm'); WriteMakefile( NAME => 'Gnome2::Canvas', VERSION_FROM => 'Canvas.pm', # finds $VERSION ABSTRACT => 'Perl bindings for the 2.x series of the Gnome Canvas widget', XSPROTOARG => '-noprototypes', MAN3PODS => \%pod_files, $gnomecanvas->get_makefile_vars, ); sub MY::postamble { return Glib::MakeHelper->postamble_clean () . Glib::MakeHelper->postamble_docs_full ( DEPENDS => $gnomecanvas, COPYRIGHT => "Copyright (C) 2003-2004 by the Gtk2-Perl Team.\n\nThis software is licensed under the LGPL; see L for a full notice.", ) . Glib::MakeHelper->postamble_rpms ( 'GNOME_CANVAS' => $build_reqs{'GnomeCanvas'}, 'PERL_EXTUTILS_DEPENDS' => $build_reqs{'perl-ExtUtils-Depends'}, 'PERL_EXTUTILS_PKGCONFIG' => $build_reqs{'perl-ExtUtils-PkgConfig'}, 'PERL_GLIB' => $build_reqs{'perl-Glib'}, 'PERL_GTK' => $build_reqs{'perl-Gtk2'}, ); } Gnome2-Canvas-1.002/MANIFEST0100644000076600000240000000126410006322115014375 0ustar muppetstaffAUTHORS Canvas.pm canvas.typemap canvas_demo/canvas-arrowhead.pl canvas_demo/canvas-curve.pl canvas_demo/canvas-features.pl canvas_demo/canvas-fifteen.pl canvas_demo/canvas-primitives.pl canvas_demo/canvas-rich-text.pl canvas_demo/canvas.pl canvas_demo/ENTRYPOINT_IS_canvas.pl canvas_demo/toroid.png ChangeLog genmaps.pl gnomecanvasperl.h LICENSE Makefile.PL MANIFEST MANIFEST.SKIP maps META.yml Module meta-data in YAML NEWS perl-Gnome2-Canvas.spec.in README t/01.t t/GnomeCanvas.t t/GnomeCanvasItem.t t/GnomeCanvasPathDef.t TODO xs/GnomeCanvas.xs xs/GnomeCanvasBpath.xs xs/GnomeCanvasItem.xs xs/GnomeCanvasPathDef.xs xs/GnomeCanvasRichText.xs xs/GnomeCanvasShape.xs xs/GnomeCanvasUtil.xs Gnome2-Canvas-1.002/MANIFEST.SKIP0100644000076600000240000000012607725761606015170 0ustar muppetstaffCVS \.bak$ \.bs$ \.c$ \.o$ Makefile$ Makefile\.old$ ~$ \.sw.$ \.cvsignore$ blib build Gnome2-Canvas-1.002/maps0100644000076600000240000000221110005112507014121 0ustar muppetstaffGNOME_TYPE_CANVAS_BPATH GnomeCanvasBpath GtkObject Gnome2::Canvas::Bpath GNOME_TYPE_CANVAS_ITEM GnomeCanvasItem GtkObject Gnome2::Canvas::Item GNOME_TYPE_CANVAS_GROUP GnomeCanvasGroup GtkObject Gnome2::Canvas::Group GNOME_TYPE_CANVAS GnomeCanvas GtkObject Gnome2::Canvas GNOME_TYPE_CANVAS_LINE GnomeCanvasLine GtkObject Gnome2::Canvas::Line GNOME_TYPE_CANVAS_PIXBUF GnomeCanvasPixbuf GtkObject Gnome2::Canvas::Pixbuf GNOME_TYPE_CANVAS_POLYGON GnomeCanvasPolygon GtkObject Gnome2::Canvas::Polygon GNOME_TYPE_CANVAS_RE GnomeCanvasRE GtkObject Gnome2::Canvas::RE GNOME_TYPE_CANVAS_RECT GnomeCanvasRect GtkObject Gnome2::Canvas::Rect GNOME_TYPE_CANVAS_ELLIPSE GnomeCanvasEllipse GtkObject Gnome2::Canvas::Ellipse GNOME_TYPE_CANVAS_RICH_TEXT GnomeCanvasRichText GtkObject Gnome2::Canvas::RichText GNOME_TYPE_CANVAS_SHAPE GnomeCanvasShape GtkObject Gnome2::Canvas::Shape GNOME_TYPE_CANVAS_TEXT GnomeCanvasText GtkObject Gnome2::Canvas::Text GNOME_TYPE_CANVAS_WIDGET GnomeCanvasWidget GtkObject Gnome2::Canvas::Widget GNOME_TYPE_CANVAS_POINTS GnomeCanvasPoints GBoxed Gnome2::Canvas::Points GNOME_TYPE_CANVAS_PATH_DEF GnomeCanvasPathDef GBoxed Gnome2::Canvas::PathDef Gnome2-Canvas-1.002/META.yml0100644000076600000240000000036710110014241014512 0ustar muppetstaff#XXXXXXX This is a prototype!!! It will change in the future!!! XXXXX# name: Gnome2-Canvas version: 1.002 version_from: Canvas.pm installdirs: site requires: distribution_type: module generated_by: ExtUtils::MakeMaker version 6.12 Gnome2-Canvas-1.002/NEWS0100644000076600000240000000264210110014034013736 0ustar muppetstaffOverview of Changes in 1.002 ============================ * Fix a bug in Gnome2::Canvas::polygon_to_point(). [muppet] * Fix unusably broken bindings of Gnome2::Canvas::w2c_affine(), Gnome2::Canvas::Item::i2w_affine(), and Gnome2::Canvas::Item::i2c_affine(), with regression tests. [muppet] * Portability fixes for Mac OS X. [muppet] * Minor documentation enhancements. [muppet] Overview of Changes in 1.001 ============================ * Fix the broken example in the documentation synopsis. [muppet] * Skip the open_parts and closed_parts tests to pass when working with libgnomecanvas 2.0.x. [Torsten] * Hush unused variable warning. [muppet] Overview of Changes in 1.0 ========================== * Require stable Glib/Gtk2 1.040 * Add import version checking. * Spit and polish. Overview of Changes in 0.93 =========================== * Check that we're using at least ExtUtils::Depends 0.2. * Require ExtUtils::PkgConfig 1.03. * Add Gnome2::Canvas::GET_VERSION and Gnome2::CHECK_VERSION. [Emmaneule Bassi] * Pod improvements. Overview of Changes in Gnome2::Canvas 0.92 ========================================== * Updated Glib requirement to 1.035. * Made use of Glib 1.035's MakeHelper features for documentation generation. Overview of Changes in Gnome2::Canvas 0.91 ========================================== * GnomeCancasPathDef, handling re-worked. * apidoc POD updates * some new demos added, others updated Gnome2-Canvas-1.002/perl-Gnome2-Canvas.spec.in0100644000076600000240000000376510004631353020042 0ustar muppetstaffSummary: Gnome2-Canvas Perl module Name: perl-Gnome2-Canvas Version: @VERSION@ Release: 1 Packager: gtk-perl-list@gnome.org License: LGPL Group: Development/Libraries URL: http://search.cpan.org/dist/Gnome2-Canvas/ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildRequires: perl >= 2:5.8.0 BuildRequires: libgnomecanvas-devel >= @GNOME_CANVAS@ BuildRequires: perl-ExtUtils-Depends >= @PERL_EXTUTILS_DEPENDS@ BuildRequires: perl-ExtUtils-PkgConfig >= @PERL_EXTUTILS_DEPENDS@ BuildRequires: perl-Glib >= @PERL_GLIB@ BuildRequires: perl-Gtk2 >= @PERL_GTK@ Requires: libgnomecanvas >= %(pkg-config --modversion libgnomecanvas-2.0) Requires: perl-Glib >= @PERL_GLIB@ Requires: perl-Gtk2 >= @PERL_GTK@ Requires: %(perl -MConfig -le 'if (defined $Config{useithreads}) { print "perl(:WITH_ITHREADS)" } else { print "perl(:WITHOUT_ITHREADS)" }') Requires: %(perl -MConfig -le 'if (defined $Config{usethreads}) { print "perl(:WITH_THREADS)" } else { print "perl(:WITHOUT_THREADS)" }') Requires: %(perl -MConfig -le 'if (defined $Config{uselargefiles}) { print "perl(:WITH_LARGEFILES)" } else { print "perl(:WITHOUT_LARGEFILES)" }') Source0: @SOURCE@ %description %{summary}. %prep %setup -q -n Gnome2-Canvas-%{version} %build CFLAGS="$RPM_OPT_FLAGS" perl Makefile.PL PREFIX=$RPM_BUILD_ROOT%{_prefix} make OPTIMIZE="$RPM_OPT_FLAGS" make test %install rm -rf $RPM_BUILD_ROOT eval `perl '-V:installarchlib'` mkdir -p $RPM_BUILD_ROOT$installarchlib %makeinstall rm -f `find $RPM_BUILD_ROOT -type f -name perllocal.pod -o -name .packlist` [ -x %{_libdir}/rpm/brp-compress ] && %{_libdir}/rpm/brp-compress find $RPM_BUILD_ROOT%{_prefix} -type f -print | \ sed "s@^$RPM_BUILD_ROOT@@g" > %{name}-%{version}-%{release}-filelist if [ "$(cat %{name}-%{version}-%{release}-filelist)X" = "X" ] ; then echo "ERROR: EMPTY FILE LIST" exit 1 fi %clean rm -rf $RPM_BUILD_ROOT %files -f %{name}-%{version}-%{release}-filelist %defattr(-,root,root,-) %changelog * @DATE@ gtk-perl-list@gnome.org - @VERSION@ - Specfile autogenerated. Gnome2-Canvas-1.002/README0100644000076600000240000000515710110011765014133 0ustar muppetstaff Gnome2::Canvas version 1.002 ============================ The Gnome2::Canvas module allows a perl developer to use the GnomeCanvas widget with Gtk2-Perl. Find out more about Gnome+ at http://www.gnome.org. Like the Gtk2 module on which it depends, Gnome2::Canvas follows the C API of libgnomecanvas-2.0 as closely as possible while still being perlish. Thus, the C API reference remains the canonical documentation. To discuss gtk2-perl, ask questions and flame/praise the authors, join gtk-perl-list@gnome.org at lists.gnome.org. Also have a look at the gtk2-perl website and sourceforge project page, http://gtk2-perl.sourceforge.net INSTALLATION To install this module type the following: perl Makefile.PL make make test make install To avoid installing to a system directory, since this is a beta release, you can change the installation prefix at Makefile.PL time with perl Makefile.PL PREFIX=/some/other/place This will install the module to the subdirectory lib/perl5 under the given prefix. If this is not already in perl's include path, you'll need to tell perl how to get to this library directory so you can use it; there are three ways: in your environment (the easiest): # assuming a bourne-style shell PERL5LIB=/some/other/place/lib/perl5/site_perl export PERL5LIB on the perl command line: perl -I /some/other/place/lib/perl5/site_perl yourscript in the code of your perl script: use lib '/some/other/place/lib/perl5/site_perl'; DEPENDENCIES This module requires these other modules and libraries: perl >= 5.8.0 Glib >= 1.040 (perl module and requisite C libraries) Gtk2 >= 1.040 (perl module and requisite C libraries) libgnomecanvas > 2.x (C library) In order to build it from source, you'll also need ExtUtils::Depends >= 0.2 ExtUtils::PkgConfig >= 1.03 COPYRIGHT AND LICENSE Copyright (C) 2003-2004 by the gtk2-perl team (see the file AUTHORS for a complete list) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA. Gnome2-Canvas-1.002/t/0040755000076600000240000000000010110014241013501 5ustar muppetstaffGnome2-Canvas-1.002/t/01.t0100644000076600000240000000010107674367421014133 0ustar muppetstaffuse Test::More tests => 1; BEGIN { use_ok('Gnome2::Canvas') }; Gnome2-Canvas-1.002/t/GnomeCanvas.t0100644000076600000240000000403310110013050016061 0ustar muppetstaff#!/usr/bin/perl -w use strict; use Test::More; use Gnome2::Canvas; if (Gtk2->init_check) { plan tests => 25; } else { plan skip_all => 'unable to open display, nothing to test'; } my $canvas = Gnome2::Canvas -> new(); isa_ok($canvas, "Gnome2::Canvas"); $canvas = Gnome2::Canvas -> new_aa(); isa_ok($canvas, "Gnome2::Canvas"); $canvas -> update_now(); isa_ok($canvas -> root(), "Gnome2::Canvas::Group"); $canvas -> set_scroll_region(23, 42, 23, 42); is_deeply([$canvas -> get_scroll_region()], [23, 42, 23, 42]); $canvas -> set_center_scroll_region(1); ok($canvas -> get_center_scroll_region()); $canvas -> set_pixels_per_unit(96); $canvas -> scroll_to(10, 10); is_deeply([$canvas -> get_scroll_offsets()], [0, 0]); # $canvas -> get_item_at(..., ...); # $canvas -> request_redraw_uta(...); $canvas -> request_redraw(10, 10, 12, 12); # w2c_affine was misbound before 1.002; make sure we still allow # code that uses the broken signature. warn "\n# ignore the warning about w2c_affine here:\n"; $canvas -> w2c_affine([10, 10, 12, 12, 23, 23]); # and test the proper signature. my $affine = $canvas->w2c_affine; isa_ok ($affine, 'ARRAY'); is (scalar(@$affine), 6); print "w2c_affine @$affine\n"; is_deeply([$canvas -> w2c(23, 43)], [0, 96]); is_deeply([$canvas -> w2c_d(23, 43)], [0, 96]); is_deeply([$canvas -> c2w(0, 96)], [23, 43]); is_deeply([$canvas -> window_to_world(0, 0)], [23, 42]); is_deeply([$canvas -> world_to_window(23, 42)], [0, 0]); my ($result, $color) = $canvas -> get_color("red"); is($result, 1); isa_ok($color, "Gtk2::Gdk::Color"); # is($canvas -> get_color_pixel(0xFF00FFFF), 63519); my $window = Gtk2::Window -> new("toplevel"); $window -> realize(); $canvas -> set_stipple_origin(Gtk2::Gdk::GC -> new($window -> window())); $canvas -> set_dither("max"); is($canvas -> get_dither(), "max"); foreach (Gnome2::Canvas -> get_miter_points(1, 2, 3, 4, 5, 6, 100), Gnome2::Canvas -> get_butt_points(1, 2, 3, 4, 100, 200)) { like(int(abs($_)), qr/^\d+$/); } is(Gnome2::Canvas -> polygon_to_point([10, 10, 20, 20], 23, 24), 5); Gnome2-Canvas-1.002/t/GnomeCanvasItem.t0100644000076600000240000000663310110011456016720 0ustar muppetstaff#!/usr/bin/perl -w use strict; use Test::More; use Gnome2::Canvas; if (Gtk2->init_check) { plan tests => 19; } else { plan skip_all => 'unable to open display, nothing to test'; } my $window = Gtk2::Window -> new("toplevel"); my $canvas = Gnome2::Canvas -> new(); my $group = $canvas -> root(); $window -> add($canvas); $window -> realize(); $window -> show_all(); my $item = Gnome2::Canvas::Item -> new($group, "Gnome2::Canvas::Rect", fill_color => "black"); isa_ok($item, "Gnome2::Canvas::Item"); $item -> set(width_units => 6); $item -> move(10, 10); $item -> affine_relative([23, 23, 42, 42, 0, 0]); $item -> affine_absolute([23, 23, 42, 42, 0, 0]); $item -> raise(3); $item -> lower(2); $item -> raise_to_top(); $item -> lower_to_bottom(); $item -> show(); $item -> request_update(); # is($item -> grab(qw(button-release-mask), Gtk2::Gdk::Cursor -> new("arrow")), "success"); # $item -> ungrab(); # warn $item -> w2i(0, 0); # warn $item -> i2w(23, 42); # this is broken, and will generate warnings warn "\n# ignore the next two warnings\n"; $item -> i2w_affine([23, 23, 42, 42, 0, 0]); $item -> i2c_affine([23, 23, 42, 42, 0, 0]); # these signatures requires 1.002. my $affine; $affine = $item -> i2w_affine; isa_ok ($affine, 'ARRAY'); is (scalar(@$affine), 6); print "i2w_affine @$affine\n"; $affine = $item -> i2c_affine; isa_ok ($affine, 'ARRAY'); is (scalar(@$affine), 6); print "i2c_affine @$affine\n"; $item -> reparent($group); $item -> grab_focus(); # versions of libgnomecanvas prior to 2.1.0 did not properly check the # validity of paths when getting bounds on shape items. # so, it is normal to get a GnomeCanvas-CRITICAL assertion from this line # on Gnome 2.0 systems. is_deeply([$item -> get_bounds()], [0, 0, 0, 0]); $item -> hide(); $item -> reset_bounds(); $item -> update_bbox(10, 10, 23, 23); ############################################################################### $item = Gnome2::Canvas::Item -> new($group, "Gnome2::Canvas::RichText"); my $buffer = $item -> get_buffer(); isa_ok($buffer, "Gtk2::TextBuffer"); $item -> set_buffer($buffer); is($item -> get_buffer(), $buffer); my $iter = $item -> get_iter_at_location(0, 0); is($item -> get_iter_location($iter) -> x(), 0); ############################################################################### $item = Gnome2::Canvas::Item -> new($group, "Gnome2::Canvas::Bpath"); my $path_def = Gnome2::Canvas::PathDef -> new(); $item -> set_path_def($path_def); # is($item -> get_path_def(), $path_def); isa_ok($item -> get_path_def(), "Gnome2::Canvas::PathDef"); ############################################################################### $item = Gnome2::Canvas::Item -> new($group, "Gnome2::Canvas::Shape"); $path_def = Gnome2::Canvas::PathDef -> new(); $item -> set_path_def($path_def); # is($item -> get_path_def(), $path_def); isa_ok($item -> get_path_def(), "Gnome2::Canvas::PathDef"); ############################################################################### $item = Gnome2::Canvas::Item -> new($group, "Gnome2::Canvas::Line"); $item -> set(points => [10 => 11, 12 => 13, 14 => 15]); is_deeply($item -> get("points"), [10, 11, 12, 13, 14, 15]); ############################################################################### # Gnome2::Canvas::Clipgroup? foreach (qw(Ellipse Group Pixbuf Polygon RE Text Widget)) { isa_ok(Gnome2::Canvas::Item -> new($group, "Gnome2::Canvas::$_"), "Gnome2::Canvas::Item"); } Gnome2-Canvas-1.002/t/GnomeCanvasPathDef.t0100644000076600000240000000262310052433430017335 0ustar muppetstaff#!/usr/bin/perl -w use strict; use Test::More tests => 14; use Gnome2::Canvas; my $def_one = Gnome2::Canvas::PathDef -> new_sized(10); isa_ok($def_one, "Gnome2::Canvas::PathDef"); isa_ok($def_one -> duplicate(), "Gnome2::Canvas::PathDef"); my $def_two = Gnome2::Canvas::PathDef -> new(); isa_ok($def_two, "Gnome2::Canvas::PathDef"); $def_two -> ensure_space(10); $def_one -> moveto(0, 0); $def_two -> moveto(23, 42); $def_one -> lineto(10, 10); $def_two -> lineto(30, 43); $def_one -> lineto_moving(15, 20); $def_two -> curveto(35, 45, 50, 50, 55, 60); ok($def_one -> has_currentpoint()); ok($def_one -> any_open()); ok($def_one -> all_open()); ok(not $def_one -> any_closed()); ok(not $def_one -> all_closed()); $def_one -> closepath_current(); $def_two -> closepath(); is($def_one -> length(), 4); ok(not $def_one -> is_empty()); my $concat = Gnome2::Canvas::PathDef -> concat($def_one, $def_two); isa_ok($concat, "Gnome2::Canvas::PathDef"); isa_ok(($concat -> split())[0], "Gnome2::Canvas::PathDef"); SKIP: { skip("open_parts and closed_parts seem to be broken in 2.0", 2) unless (Gnome2::Canvas -> CHECK_VERSION(2, 2, 0)); isa_ok(($concat -> open_parts())[0], "Gnome2::Canvas::PathDef"); isa_ok(($concat -> closed_parts())[0], "Gnome2::Canvas::PathDef"); } $def_one -> close_all(); $def_two -> close_all(); # $def_one -> finish(); # $def_two -> finish(); $def_one -> reset(); $def_two -> reset(); Gnome2-Canvas-1.002/TODO0100644000076600000240000000123107725761312013752 0ustar muppetstaff# # $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/TODO,v 1.2 2003/09/05 01:11:38 muppetman Exp $ # these are brand-new, very quickly made bindings, so there are still some bugs. the ones i know about are: - zooming the canvases in canvas_demo by holding the arrows in the spinbuttons sometimes results in a segfault. not at all sure why. - the non-english text in canvas_demo/canvas-rich-text.pl is apparently very much not right. undone: - test suite!!! - the path def and bpath stuff needs serious testing - there is no typemap for ArtBpath, so several things are missing from GnomeCanvasPathDef.xs - ditto for ArtSVP and GnomeCanvasUtil.xs Gnome2-Canvas-1.002/xs/0040755000076600000240000000000010110014241013670 5ustar muppetstaffGnome2-Canvas-1.002/xs/GnomeCanvas.xs0100644000076600000240000004155510110013622016456 0ustar muppetstaff/* * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307 USA. * * $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/xs/GnomeCanvas.xs,v 1.20 2004/08/16 02:10:26 muppetman Exp $ */ #include "gnomecanvasperl.h" SV * newSVArtAffine (double affine[6]) { AV * a; if (!affine) return &PL_sv_undef; a = newAV(); av_push (a, newSVnv (affine[0])); av_push (a, newSVnv (affine[1])); av_push (a, newSVnv (affine[2])); av_push (a, newSVnv (affine[3])); av_push (a, newSVnv (affine[4])); av_push (a, newSVnv (affine[5])); return newRV_noinc ((SV*)a); } double* SvArtAffine (SV * sv) { AV * av; double * affine; if ((!sv) || (!SvOK (sv)) || (!SvRV (sv)) || (SvTYPE (SvRV(sv)) != SVt_PVAV) || 5 != av_len ((AV*) SvRV (sv))) croak ("affine transforms must be expressed as a reference to an array containing the six transform values"); av = (AV*) SvRV (sv); affine = gperl_alloc_temp (6 * sizeof (double)); affine[0] = SvNV (*av_fetch (av, 0, 0)); affine[1] = SvNV (*av_fetch (av, 1, 0)); affine[2] = SvNV (*av_fetch (av, 2, 0)); affine[3] = SvNV (*av_fetch (av, 3, 0)); affine[4] = SvNV (*av_fetch (av, 4, 0)); affine[5] = SvNV (*av_fetch (av, 5, 0)); return affine; } MODULE = Gnome2::Canvas PACKAGE = Gnome2::Canvas PREFIX = gnome_canvas_ BOOT: { #include "register.xsh" #include "boot.xsh" gperl_handle_logs_for ("GnomeCanvas"); } # # there are several classes in the library which have no non-virtual # methods, and thus have no direct bindings. let's declare object # sections for them here, so they'll show up in the documentation. # =for object Gnome2::Canvas::Group - A group of Gnome2::CanvasItems =cut =for object Gnome2::Canvas::Line - Lines as CanvasItems =cut =for object Gnome2::Canvas::Pixbuf - Pixbufs as CanvasItems =cut =for object Gnome2::Canvas::RE - base class for rectangles and ellipses =cut =for object Gnome2::Canvas::Rect - Rectangles as CanvasItems =cut =for object Gnome2::Canvas::Ellipse - Ellipses as CanvasItems =cut =for object Gnome2::Canvas::Text - Text as CanvasItems =cut =for object Gnome2::Canvas::Widget - Gtk2::Widgets as CanvasItems =cut # # and now back to Gnome2::Canvas # =for object Gnome2::Canvas A structured graphics canvas =cut =for position SYNOPSIS =head1 SYNOPSIS use strict; use Gtk2 -init; use Gnome2::Canvas; my $window = Gtk2::Window->new; my $scroller = Gtk2::ScrolledWindow->new; my $canvas = Gnome2::Canvas->new; $scroller->add ($canvas); $window->add ($scroller); $window->set_default_size (150, 150); $canvas->set_scroll_region (0, 0, 200, 200); $window->show_all; my $root = $canvas->root; Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Text', x => 20, y => 15, fill_color => 'black', font => 'Sans 14', anchor => 'GTK_ANCHOR_NW', text => 'Hello, World!'); my $box = Gnome2::Canvas::Item->new ($root, 'Gnome2::Canvas::Rect', x1 => 10, y1 => 5, x2 => 150, y2 => 135, fill_color => 'red', outline_color => 'black'); $box->lower_to_bottom; $box->signal_connect (event => sub { my ($item, $event) = @_; warn "event ".$event->type."\n"; }); Gtk2->main; =cut =for position DESCRIPTION =head1 DESCRIPTION The Gnome Canvas is an engine for structured graphics that offers a rich imaging model, high-performance rendering, and a powerful, high level API. It offers a choice of two rendering back-ends, one based on GDK for extremely fast display, and another based on Libart, a sophisticated, antialiased, alpha-compositing engine. This widget can be used for flexible display of graphics and for creating interactive user interface elements. To create a new Gnome2::Canvas widget call C<< Gnome2::Canvas->new >> or C<< Gnome2::Canvas->new_aa >> for an anti-aliased mode canvas. A Gnome2::Canvas contains one or more Gnome2::CanvasItem objects. Items consist of graphing elements like lines, ellipses, polygons, images, text, and curves. These items are organized using Gnome2::CanvasGroup objects, which are themselves derived from Gnome2::CanvasItem. Since a group is an item it can be contained within other groups, forming a tree of canvas items. Certain operations, like translating and scaling, can be performed on all items in a group. There is a special root group created by a Gnome2::Canvas. This is the top level group under which all items in a canvas are contained. The root group is available as C<< $canvas->root >>. There are several different coordinate systems used by Gnome2::Canvas widgets. The primary system is a logical, abstract coordinate space called world coordinates. World coordinates are expressed as unbounded double floating point numbers. When it comes to rendering to a screen the canvas pixel coordinate system (also referred to as just canvas coordinates) is used. This system uses integers to specify screen pixel positions. A user defined scaling factor and offset are used to convert between world coordinates and canvas coordinates. Each item in a canvas has its own coordinate system called item coordinates. This system is specified in world coordinates but they are relative to an item (0.0, 0.0 would be the top left corner of the item). The final coordinate system of interest is window coordinates. These are like canvas coordinates but are offsets from within a window a canvas is displayed in. This last system is rarely used, but is useful when manually handling GDK events (such as drag and drop) which are specified in window coordinates (the events processed by the canvas are already converted for you). Along with different coordinate systems come methods to convert between them. C<< $canvas->w2c >> converts world to canvas pixel coordinates and C<< canvas->c2w >> converts from canvas to world. To get the affine transform matrix for converting from world coordinates to canvas coordinates call C<< $canvas->w2c_affine >>. C<< $canvas->window_to_world >> converts from window to world coordinates and C<< $canvas->world_to_window >> converts in the other direction. There are no methods for converting between canvas and window coordinates, since this is just a matter of subtracting the canvas scrolling offset. To convert to/from item coordinates use the methods defined for Gnome2::CanvasItem objects. To set the canvas zoom factor (canvas pixels per world unit, the scaling factor) call C<< $canvas->set_pixels_per_unit >>; setting this to 1.0 will cause the two coordinate systems to correspond (e.g., [5, 6] in pixel units would be [5.0, 6.0] in world units). Defining the scrollable area of a canvas widget is done by calling C<< $canvas->set_scroll_region >> and to get the current region C<< $canvas->get_scroll_region >> can be used. If the window is larger than the canvas scrolling region it can optionally be centered in the window. Use C<< $canvas->set_center_scroll_region >> to enable or disable this behavior. To scroll to a particular canvas pixel coordinate use C<< $canvas->scroll_to >> (typically not used since scrollbars are usually set up to handle the scrolling), and to get the current canvas pixel scroll offset call C<< $canvas->get_scroll_offsets >>. =cut =for position SEE_ALSO =head1 SEE ALSO Gnome2::Canvas::index(3pm) lists the generated Perl API reference PODs. Frederico Mena Quintero's whitepaper on the GNOME Canvas: http://developer.gnome.org/doc/whitepapers/canvas/canvas.html The real GnomeCanvas is implemented in a C library; the Gnome2::Canvas module allows a Perl developer to use the canvas like a normal gtk2-perl object. Like the Gtk2 module on which it depends, Gnome2::Canvas follows the C API of libgnomecanvas-2.0 as closely as possible while still being perlish. Thus, the C API reference remains the canonical documentation; the Perl reference documentation lists call signatures and argument types, and is meant to be used in conjunction with the C API reference. GNOME Canvas Library Reference Manual http://developer.gnome.org/doc/API/2.0/libgnomecanvas/index.html perl(1), Glib(3pm), Gtk2(3pm). To discuss gtk2-perl, ask questions and flame/praise the authors, join gtk-perl-list@gnome.org at lists.gnome.org. =cut =for position COPYRIGHT =head1 AUTHOR muppet , with patches from Torsten Schoenfeld . The DESCRIPTION section of this page is adapted from the documentation of libgnomecanvas. =head1 COPYRIGHT AND LICENSE Copyright 2003-2004 by the gtk2-perl team. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307 USA. =cut =for apidoc new_aa Create a new empty canvas in antialiased mode. =cut =for apidoc Create a new empty canvas in non-antialiased mode. =cut ## GtkWidget *gnome_canvas_new (void) ## GtkWidget *gnome_canvas_new_aa (void) GtkWidget * gnome_canvas_new (class) ALIAS: new_aa = 1 CODE: if (ix == 1) RETVAL = gnome_canvas_new_aa (); else RETVAL = gnome_canvas_new (); OUTPUT: RETVAL ## GnomeCanvasGroup *gnome_canvas_root (GnomeCanvas *canvas) GnomeCanvasGroup * gnome_canvas_root (canvas) GnomeCanvas *canvas =for apidoc pixels_per_unit __hide__ This is an alias for get_pixels_per_unit, but we won't clutter the docs with it. We'll condone the get_pixels_per_unit/set_pixels_per_unit pair. =cut =for apidoc get_pixels_per_unit =for signature double = $canvas->get_pixels_per_unit Fetch I<$canvas>' scale factor. =cut =for apidoc =for signature boolean = $canvas->aa Returns true if I<$canvas> was created in anti-aliased mode. =cut SV * aa (canvas) GnomeCanvas * canvas ALIAS: pixels_per_unit = 1 get_pixels_per_unit = 2 CODE: RETVAL = NULL; switch (ix) { case 0: RETVAL = newSViv (canvas->aa); break; case 1: /* fall through */ case 2: RETVAL = newSVnv (canvas->pixels_per_unit); break; } OUTPUT: RETVAL =for apidoc Set the zooming factor of I<$canvas> by specifying the number of screen pixels that correspond to one canvas unit. =cut ## void gnome_canvas_set_pixels_per_unit (GnomeCanvas *canvas, double n) void gnome_canvas_set_pixels_per_unit (canvas, n) GnomeCanvas *canvas double n ## void gnome_canvas_set_scroll_region (GnomeCanvas *canvas, double x1, double y1, double x2, double y2) void gnome_canvas_set_scroll_region (canvas, x1, y1, x2, y2) GnomeCanvas *canvas double x1 double y1 double x2 double y2 ## void gnome_canvas_get_scroll_region (GnomeCanvas *canvas, double *x1, double *y1, double *x2, double *y2) void gnome_canvas_get_scroll_region (GnomeCanvas *canvas, OUTLIST double x1, OUTLIST double y1, OUTLIST double x2, OUTLIST double y2) ## void gnome_canvas_set_center_scroll_region (GnomeCanvas *canvas, gboolean center_scroll_region) void gnome_canvas_set_center_scroll_region (canvas, center_scroll_region) GnomeCanvas *canvas gboolean center_scroll_region ## gboolean gnome_canvas_get_center_scroll_region (GnomeCanvas *canvas) gboolean gnome_canvas_get_center_scroll_region (canvas) GnomeCanvas *canvas ## void gnome_canvas_scroll_to (GnomeCanvas *canvas, int cx, int cy) void gnome_canvas_scroll_to (canvas, cx, cy) GnomeCanvas *canvas int cx int cy ## void gnome_canvas_get_scroll_offsets (GnomeCanvas *canvas, int *cx, int *cy) void gnome_canvas_get_scroll_offsets (GnomeCanvas *canvas, OUTLIST int cx, OUTLIST int cy) ## void gnome_canvas_update_now (GnomeCanvas *canvas) void gnome_canvas_update_now (canvas) GnomeCanvas *canvas ## GnomeCanvasItem *gnome_canvas_get_item_at (GnomeCanvas *canvas, double x, double y) GnomeCanvasItem * gnome_canvas_get_item_at (canvas, x, y) GnomeCanvas *canvas double x double y ### void gnome_canvas_request_redraw_uta (GnomeCanvas *canvas, ArtUta *uta) #void #gnome_canvas_request_redraw_uta (canvas, uta) # GnomeCanvas *canvas # ArtUta *uta ## void gnome_canvas_request_redraw (GnomeCanvas *canvas, int x1, int y1, int x2, int y2) void gnome_canvas_request_redraw (canvas, x1, y1, x2, y2) GnomeCanvas *canvas int x1 int y1 int x2 int y2 ## void gnome_canvas_w2c_affine (GnomeCanvas *canvas, double affine[6]) =for apidoc =for signature $affine = $canvas->w2c_affine =for arg a (__hide__) Fetch the affine transform that converts from world coordinates to canvas pixel coordinates. Note: This method was completely broken for all $Gnome2::Canvas::VERSION < 1.002. =cut SV * gnome_canvas_w2c_affine (canvas, a=NULL) GnomeCanvas *canvas SV * a PREINIT: double affine[6]; CODE: if (a != NULL || items > 1) warn ("Gnome2::Canvas::w2c_affine() was broken before 1.002;" " the second parameter does nothing (see the Gnome2::" "Canvas manpage)"); gnome_canvas_w2c_affine (canvas, affine); RETVAL = newSVArtAffine (affine); OUTPUT: RETVAL ## void gnome_canvas_w2c (GnomeCanvas *canvas, double wx, double wy, int *cx, int *cy) ## void gnome_canvas_w2c_d (GnomeCanvas *canvas, double wx, double wy, double *cx, double *cy) void gnome_canvas_w2c_d (GnomeCanvas *canvas, double wx, double wy, OUTLIST double cx, OUTLIST double cy) ALIAS: Gnome2::Canvas::w2c = 1 CLEANUP: PERL_UNUSED_VAR (ix); ## void gnome_canvas_c2w (GnomeCanvas *canvas, int cx, int cy, double *wx, double *wy) void gnome_canvas_c2w (GnomeCanvas *canvas, int cx, int cy, OUTLIST double wx, OUTLIST double wy) ## void gnome_canvas_window_to_world (GnomeCanvas *canvas, double winx, double winy, double *worldx, double *worldy) void gnome_canvas_window_to_world (GnomeCanvas *canvas, double winx, double winy, OUTLIST double worldx, OUTLIST double worldy) ## void gnome_canvas_world_to_window (GnomeCanvas *canvas, double worldx, double worldy, double *winx, double *winy) void gnome_canvas_world_to_window (GnomeCanvas *canvas, double worldx, double worldy, OUTLIST double winx, OUTLIST double winy) =for apidoc Returns an integer indicating the success of the color allocation and a GdkColor. =cut ## int gnome_canvas_get_color (GnomeCanvas *canvas, const char *spec, GdkColor *color) void gnome_canvas_get_color (canvas, spec) GnomeCanvas *canvas const char *spec PREINIT: int result; GdkColor color; PPCODE: result = gnome_canvas_get_color (canvas, spec, &color); EXTEND (sp, 2); PUSHs (sv_2mortal (newSViv (result))); PUSHs (sv_2mortal (newSVGdkColor (&color))); ## gulong gnome_canvas_get_color_pixel (GnomeCanvas *canvas, guint rgba) gulong gnome_canvas_get_color_pixel (canvas, rgba) GnomeCanvas *canvas guint rgba ## void gnome_canvas_set_stipple_origin (GnomeCanvas *canvas, GdkGC *gc) void gnome_canvas_set_stipple_origin (canvas, gc) GnomeCanvas *canvas GdkGC *gc ## void gnome_canvas_set_dither (GnomeCanvas *canvas, GdkRgbDither dither) void gnome_canvas_set_dither (canvas, dither) GnomeCanvas *canvas GdkRgbDither dither ## GdkRgbDither gnome_canvas_get_dither (GnomeCanvas *canvas) GdkRgbDither gnome_canvas_get_dither (canvas) GnomeCanvas *canvas =for object Gnome2::Canvas::version =cut =for see_also Glib::version =for apidoc =for signature (MAJOR, MINOR, MICRO) = Gnome2::Canvas->GET_VERSION_INFO Fetch as a list the version of libgnomecanvas for which Gnome2::Canvas was built. =cut void GET_VERSION_INFO (class) PPCODE: EXTEND (SP, 3); PUSHs (sv_2mortal (newSViv (GNOME_CANVAS_MAJOR_VERSION))); PUSHs (sv_2mortal (newSViv (GNOME_CANVAS_MINOR_VERSION))); PUSHs (sv_2mortal (newSViv (GNOME_CANVAS_MICRO_VERSION))); PERL_UNUSED_VAR (ax); gboolean CHECK_VERSION (class, major, minor, micro) int major int minor int micro CODE: RETVAL = GNOME_CANVAS_CHECK_VERSION (major, minor, micro); OUTPUT: RETVAL Gnome2-Canvas-1.002/xs/GnomeCanvasBpath.xs0100644000076600000240000000357707701454461017465 0ustar muppetstaff/* * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307 USA. * * $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/xs/GnomeCanvasBpath.xs,v 1.1 2003/07/05 04:50:57 muppetman Exp $ */ #include "gnomecanvasperl.h" /* * libgnomecanvas installs the object property bpath with G_TYPE_POINTER. * because of this, we can't use any of our existing bindings tools, because * G_TYPE_POINTER carries no type information and doesn't take anything * useful like copy and free functions. i filed a bug report about this, * #116734. * * as a workaround, you must use extra functions to set and get the bpath. */ MODULE = Gnome2::Canvas::Bpath PACKAGE = Gnome2::Canvas::Bpath ## ## TODO: if/when libgnomecanvas fixes the bpath to be a boxed type, we'll ## need to add an #ifdef around this, based on the library version. ## void set_path_def (bpath, path_def) GnomeCanvasBpath * bpath GnomeCanvasPathDef * path_def CODE: g_object_set (G_OBJECT (bpath), "bpath", path_def, NULL); GnomeCanvasPathDef_copy * get_path_def (bpath) GnomeCanvasBpath * bpath CODE: g_object_get (G_OBJECT (bpath), "bpath", (gpointer) &RETVAL, NULL); OUTPUT: RETVAL Gnome2-Canvas-1.002/xs/GnomeCanvasItem.xs0100644000076600000240000001652410110013622017273 0ustar muppetstaff/* * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307 USA. * * $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/xs/GnomeCanvasItem.xs,v 1.8 2004/08/16 02:10:26 muppetman Exp $ */ #include "gnomecanvasperl.h" MODULE = Gnome2::Canvas::Item PACKAGE = Gnome2::Canvas::Item PREFIX = gnome_canvas_item_ =for apidoc parent =for signature $canvasgroup = $item->parent Fetch I<$item>'s parent group item. =cut =for apidoc =for signature $canvas = $item->canvas Fetch the Gnome2::Canvas to which I<$item> is attached. =cut SV * canvas (item) GnomeCanvasItem * item ALIAS: parent = 1 CODE: RETVAL = NULL; switch (ix) { case 0: RETVAL = newSVGnomeCanvas (item->canvas); break; case 1: RETVAL = newSVGnomeCanvasGroup_ornull (item->parent); break; } OUTPUT: RETVAL ## GnomeCanvasItem *gnome_canvas_item_new (GnomeCanvasGroup *parent, GType type, const gchar *first_arg_name, ...) =for apidoc =for arg ... property name => value pairs Factory constructor for Gnome2::Canvas::Item subclasses. =cut GnomeCanvasItem * gnome_canvas_item_new (class, parent, object_class, ...) GnomeCanvasGroup *parent const char * object_class PREINIT: GValue value = {0, }; GType gtype; int i; CODE: if (0 != ((items - 3) % 2)) croak ("expected name => value pairs to follow object class;" "odd number of arguments detected"); gtype = gperl_object_type_from_package (object_class); if (!gtype) croak ("%s is not registered with gperl as an object type", object_class); RETVAL = gnome_canvas_item_new (parent, gtype, NULL); for (i = 3; i < items ; i+=2) { const char * name = SvPV_nolen (ST (i)); SV * newval = ST (i + 1); GParamSpec * pspec; pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (RETVAL), name); if (!pspec) croak ("property %s not found in object class %s", name, g_type_name (gtype)); g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (pspec)); gperl_value_from_sv (&value, newval); g_object_set_property (G_OBJECT (RETVAL), name, &value); g_value_unset (&value); } OUTPUT: RETVAL ## use g_object_set instead ## void gnome_canvas_item_set (GnomeCanvasItem *item, const gchar *first_arg_name, ...) ## void gnome_canvas_item_set_valist (GnomeCanvasItem *item, const gchar *first_arg_name, va_list args) ## void gnome_canvas_item_move (GnomeCanvasItem *item, double dx, double dy) void gnome_canvas_item_move (item, dx, dy) GnomeCanvasItem *item double dx double dy ## void gnome_canvas_item_affine_relative (GnomeCanvasItem *item, const double affine[6]) =for apidoc =for arg affine (arrayref) affine transformation matrix Combines I<$affine> with I<$item>'s current transformation. =cut void gnome_canvas_item_affine_relative (item, affine) GnomeCanvasItem *item SV * affine C_ARGS: item, SvArtAffine (affine) ## void gnome_canvas_item_affine_absolute (GnomeCanvasItem *item, const double affine[6]) =for apidoc =for arg affine (arrayref) affine transformation matrix Replaces I<$item>'s transformation matrix. =cut void gnome_canvas_item_affine_absolute (item, affine) GnomeCanvasItem *item SV * affine C_ARGS: item, SvArtAffine (affine) ## void gnome_canvas_item_raise (GnomeCanvasItem *item, int positions) void gnome_canvas_item_raise (item, positions) GnomeCanvasItem *item int positions ## void gnome_canvas_item_lower (GnomeCanvasItem *item, int positions) void gnome_canvas_item_lower (item, positions) GnomeCanvasItem *item int positions ## void gnome_canvas_item_raise_to_top (GnomeCanvasItem *item) void gnome_canvas_item_raise_to_top (item) GnomeCanvasItem *item ## void gnome_canvas_item_lower_to_bottom (GnomeCanvasItem *item) void gnome_canvas_item_lower_to_bottom (item) GnomeCanvasItem *item ## void gnome_canvas_item_show (GnomeCanvasItem *item) void gnome_canvas_item_show (item) GnomeCanvasItem *item ## void gnome_canvas_item_hide (GnomeCanvasItem *item) void gnome_canvas_item_hide (item) GnomeCanvasItem *item ## int gnome_canvas_item_grab (GnomeCanvasItem *item, unsigned int event_mask, GdkCursor *cursor, guint32 etime) GdkGrabStatus gnome_canvas_item_grab (item, event_mask, cursor, etime=GDK_CURRENT_TIME) GnomeCanvasItem *item GdkEventMask event_mask GdkCursor *cursor guint32 etime ## void gnome_canvas_item_ungrab (GnomeCanvasItem *item, guint32 etime) void gnome_canvas_item_ungrab (item, etime=GDK_CURRENT_TIME) GnomeCanvasItem *item guint32 etime ## void gnome_canvas_item_w2i (GnomeCanvasItem *item, double *x, double *y) void gnome_canvas_item_w2i (GnomeCanvasItem * item, IN_OUTLIST double x, IN_OUTLIST double y) ## void gnome_canvas_item_i2w (GnomeCanvasItem *item, double *x, double *y) void gnome_canvas_item_i2w (GnomeCanvasItem *item, IN_OUTLIST double x, IN_OUTLIST double y) ## void gnome_canvas_item_i2w_affine (GnomeCanvasItem *item, double affine[6]) ## void gnome_canvas_item_i2c_affine (GnomeCanvasItem *item, double affine[6]) =for apidoc i2c_affine =for signature $affine = $item->i2c_affine =for arg a (__hide__) Fetch the affine transform that converts from item-relative coordinates to canvas pixel coordinates. Note: This method was completely broken for all $Gnome2::Canvas::VERSION < 1.002. =cut =for apidoc =for signature $affine = $item->i2w_affine =for arg a (__hide__) Fetch the affine transform that converts from item's coordinate system to world coordinates. Note: This method was completely broken for all $Gnome2::Canvas::VERSION < 1.002. =cut SV * gnome_canvas_item_i2w_affine (item, a=NULL) GnomeCanvasItem *item SV * a ALIAS: i2c_affine = 1 PREINIT: double affine[6]; CODE: if (a != NULL || items > 1) warn ("Gnome2::Canvas::%s() was broken before 1.002;" " the second parameter does nothing (see the Gnome2::" "Canvas manpage)", ix == 0 ? "i2w_affine" : "i2c_affine"); if (ix == 1) gnome_canvas_item_i2c_affine (item, affine); else gnome_canvas_item_i2w_affine (item, affine); RETVAL = newSVArtAffine (affine); OUTPUT: RETVAL ## void gnome_canvas_item_reparent (GnomeCanvasItem *item, GnomeCanvasGroup *new_group) void gnome_canvas_item_reparent (item, new_group) GnomeCanvasItem *item GnomeCanvasGroup *new_group ## void gnome_canvas_item_grab_focus (GnomeCanvasItem *item) void gnome_canvas_item_grab_focus (item) GnomeCanvasItem *item ## void gnome_canvas_item_get_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2) void gnome_canvas_item_get_bounds (GnomeCanvasItem *item, OUTLIST double x1, OUTLIST double y1, OUTLIST double x2, OUTLIST double y2) ## void gnome_canvas_item_request_update (GnomeCanvasItem *item) void gnome_canvas_item_request_update (item) GnomeCanvasItem *item Gnome2-Canvas-1.002/xs/GnomeCanvasPathDef.xs0100644000076600000240000002014410012076156017715 0ustar muppetstaff/* * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307 USA. * * $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/xs/GnomeCanvasPathDef.xs,v 1.8 2004/02/10 06:38:38 muppetman Exp $ */ #include "gnomecanvasperl.h" /* * if/when libgnomecanvas provides a boxed wrapper for GnomeCanvasPathDef, * we'll have to put these two functions behind version guards. */ static GnomeCanvasPathDef * path_def_boxed_copy (GnomeCanvasPathDef * path_def) { if (path_def) gnome_canvas_path_def_ref (path_def); return path_def; } GType gnomecanvasperl_canvas_path_def_get_type (void) { static GType id = 0; if (!id) id = g_boxed_type_register_static ("GnomeCanvasPathDef", (GBoxedCopyFunc) path_def_boxed_copy, (GBoxedFreeFunc) gnome_canvas_path_def_unref); return id; } MODULE = Gnome2::Canvas::PathDef PACKAGE = Gnome2::Canvas::PathDef PREFIX = gnome_canvas_path_def_ BOOT: gperl_register_boxed (GNOME_TYPE_CANVAS_PATH_DEF, "Gnome2::Canvas::PathDef", NULL); ## GnomeCanvasPathDef * gnome_canvas_path_def_new (void) GnomeCanvasPathDef_own * gnome_canvas_path_def_new (class) C_ARGS: /*void*/ ## GnomeCanvasPathDef * gnome_canvas_path_def_new_sized (gint length) GnomeCanvasPathDef_own * gnome_canvas_path_def_new_sized (class, length) gint length C_ARGS: length #### GnomeCanvasPathDef * gnome_canvas_path_def_new_from_bpath (ArtBpath * bpath) ##GnomeCanvasPathDef * ##gnome_canvas_path_def_new_from_bpath (bpath) ## ArtBpath * bpath ## #### GnomeCanvasPathDef * gnome_canvas_path_def_new_from_static_bpath (ArtBpath * bpath) ##GnomeCanvasPathDef * ##gnome_canvas_path_def_new_from_static_bpath (bpath) ## ArtBpath * bpath ## #### GnomeCanvasPathDef * gnome_canvas_path_def_new_from_foreign_bpath (ArtBpath * bpath) ##GnomeCanvasPathDef * ##gnome_canvas_path_def_new_from_foreign_bpath (bpath) ## ArtBpath * bpath ## void gnome_canvas_path_def_finish (GnomeCanvasPathDef * path) void gnome_canvas_path_def_finish (path) GnomeCanvasPathDef * path ## void gnome_canvas_path_def_ensure_space (GnomeCanvasPathDef * path, gint space) void gnome_canvas_path_def_ensure_space (path, space) GnomeCanvasPathDef * path gint space #### void gnome_canvas_path_def_copy (GnomeCanvasPathDef * dst, const GnomeCanvasPathDef * src) =for apidoc Copy the path from I<$src> into I<$dst>. Note: this method has very different semantics than the copy provided by Glib::Boxed. C is the analog there. =cut void gnome_canvas_path_def_copy (dst, src) GnomeCanvasPathDef * dst const GnomeCanvasPathDef * src ## GnomeCanvasPathDef * gnome_canvas_path_def_duplicate (const GnomeCanvasPathDef * path) GnomeCanvasPathDef_own * gnome_canvas_path_def_duplicate (path) GnomeCanvasPathDef * path ## GnomeCanvasPathDef * gnome_canvas_path_def_concat (const GSList * list) =for apidoc =for arg ... Gnome2::Canvas::PathDef objects to concatenate =cut GnomeCanvasPathDef_own * gnome_canvas_path_def_concat (class, ...) PREINIT: GSList * list = NULL; int i; CODE: for (i = 1 ; i < items ; i++) list = g_slist_append (list, SvGnomeCanvasPathDef (ST (i))); RETVAL = gnome_canvas_path_def_concat (list); OUTPUT: RETVAL CLEANUP: g_slist_free (list); #### GSList * gnome_canvas_path_def_split (const GnomeCanvasPathDef * path) =for apidoc =for signature @pathdefs = $path->split =cut void gnome_canvas_path_def_split (path) GnomeCanvasPathDef * path PREINIT: GSList * list, * i; PPCODE: list = gnome_canvas_path_def_split (path); for (i = list ; i != NULL ; i = i->next) XPUSHs (sv_2mortal (newSVGnomeCanvasPathDef_own (i->data))); g_slist_free (list); ## GnomeCanvasPathDef * gnome_canvas_path_def_open_parts (const GnomeCanvasPathDef * path) GnomeCanvasPathDef_own * gnome_canvas_path_def_open_parts (path) const GnomeCanvasPathDef * path ## GnomeCanvasPathDef * gnome_canvas_path_def_closed_parts (const GnomeCanvasPathDef * path) GnomeCanvasPathDef_own * gnome_canvas_path_def_closed_parts (path) const GnomeCanvasPathDef * path ## GnomeCanvasPathDef * gnome_canvas_path_def_close_all (const GnomeCanvasPathDef * path) GnomeCanvasPathDef_own * gnome_canvas_path_def_close_all (path) const GnomeCanvasPathDef * path ## void gnome_canvas_path_def_reset (GnomeCanvasPathDef * path) void gnome_canvas_path_def_reset (path) GnomeCanvasPathDef * path ## void gnome_canvas_path_def_moveto (GnomeCanvasPathDef * path, gdouble x, gdouble y) void gnome_canvas_path_def_moveto (path, x, y) GnomeCanvasPathDef * path gdouble x gdouble y ## void gnome_canvas_path_def_lineto (GnomeCanvasPathDef * path, gdouble x, gdouble y) void gnome_canvas_path_def_lineto (path, x, y) GnomeCanvasPathDef * path gdouble x gdouble y ## void gnome_canvas_path_def_lineto_moving (GnomeCanvasPathDef * path, gdouble x, gdouble y) void gnome_canvas_path_def_lineto_moving (path, x, y) GnomeCanvasPathDef * path gdouble x gdouble y ## void gnome_canvas_path_def_curveto (GnomeCanvasPathDef * path, gdouble x0, gdouble y0,gdouble x1, gdouble y1, gdouble x2, gdouble y2) void gnome_canvas_path_def_curveto (path, x0, y0, x1, y1, x2, y2) GnomeCanvasPathDef * path gdouble x0 gdouble y0 gdouble x1 gdouble y1 gdouble x2 gdouble y2 ## void gnome_canvas_path_def_closepath (GnomeCanvasPathDef * path) void gnome_canvas_path_def_closepath (path) GnomeCanvasPathDef * path ## void gnome_canvas_path_def_closepath_current (GnomeCanvasPathDef * path) void gnome_canvas_path_def_closepath_current (path) GnomeCanvasPathDef * path #### ArtBpath * gnome_canvas_path_def_bpath (const GnomeCanvasPathDef * path) ##ArtBpath * ##gnome_canvas_path_def_bpath (path) ## const GnomeCanvasPathDef * path ## gint gnome_canvas_path_def_length (const GnomeCanvasPathDef * path) gint gnome_canvas_path_def_length (path) GnomeCanvasPathDef * path ## gboolean gnome_canvas_path_def_is_empty (const GnomeCanvasPathDef * path) gboolean gnome_canvas_path_def_is_empty (path) GnomeCanvasPathDef * path ## gboolean gnome_canvas_path_def_has_currentpoint (const GnomeCanvasPathDef * path) gboolean gnome_canvas_path_def_has_currentpoint (path) GnomeCanvasPathDef * path #### void gnome_canvas_path_def_currentpoint (const GnomeCanvasPathDef * path, ArtPoint * p) ##void ##gnome_canvas_path_def_currentpoint (path, p) ## const GnomeCanvasPathDef * path ## ArtPoint * p ## #### ArtBpath * gnome_canvas_path_def_last_bpath (const GnomeCanvasPathDef * path) ##ArtBpath * ##gnome_canvas_path_def_last_bpath (path) ## const GnomeCanvasPathDef * path ## #### ArtBpath * gnome_canvas_path_def_first_bpath (const GnomeCanvasPathDef * path) ##ArtBpath * ##gnome_canvas_path_def_first_bpath (path) ## const GnomeCanvasPathDef * path ## gboolean gnome_canvas_path_def_any_open (const GnomeCanvasPathDef * path) gboolean gnome_canvas_path_def_any_open (path) GnomeCanvasPathDef * path ## gboolean gnome_canvas_path_def_all_open (const GnomeCanvasPathDef * path) gboolean gnome_canvas_path_def_all_open (path) GnomeCanvasPathDef * path ## gboolean gnome_canvas_path_def_any_closed (const GnomeCanvasPathDef * path) gboolean gnome_canvas_path_def_any_closed (path) GnomeCanvasPathDef * path ## gboolean gnome_canvas_path_def_all_closed (const GnomeCanvasPathDef * path) gboolean gnome_canvas_path_def_all_closed (path) GnomeCanvasPathDef * path ### will not be bound #### void gnome_canvas_path_def_ref (GnomeCanvasPathDef * path) #### void gnome_canvas_path_def_unref (GnomeCanvasPathDef * path) Gnome2-Canvas-1.002/xs/GnomeCanvasRichText.xs0100644000076600000240000000520707764013421020145 0ustar muppetstaff/* * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307 USA. * * $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/xs/GnomeCanvasRichText.xs,v 1.2 2003/12/05 05:26:41 muppetman Exp $ */ #include "gnomecanvasperl.h" MODULE = Gnome2::Canvas::RichText PACKAGE = Gnome2::Canvas::RichText PREFIX = gnome_canvas_rich_text_ ## void gnome_canvas_rich_text_cut_clipboard(GnomeCanvasRichText *text) void gnome_canvas_rich_text_cut_clipboard (text) GnomeCanvasRichText *text ## void gnome_canvas_rich_text_copy_clipboard(GnomeCanvasRichText *text) void gnome_canvas_rich_text_copy_clipboard (text) GnomeCanvasRichText *text ## void gnome_canvas_rich_text_paste_clipboard(GnomeCanvasRichText *text) void gnome_canvas_rich_text_paste_clipboard (text) GnomeCanvasRichText *text ## void gnome_canvas_rich_text_set_buffer(GnomeCanvasRichText *text, GtkTextBuffer *buffer) void gnome_canvas_rich_text_set_buffer (text, buffer) GnomeCanvasRichText *text GtkTextBuffer *buffer ## GtkTextBuffer *gnome_canvas_rich_text_get_buffer(GnomeCanvasRichText *text) GtkTextBuffer * gnome_canvas_rich_text_get_buffer (text) GnomeCanvasRichText *text ## void gnome_canvas_rich_text_get_iter_location (GnomeCanvasRichText *text, const GtkTextIter *iter, GdkRectangle *location) GdkRectangle_copy * gnome_canvas_rich_text_get_iter_location (text, iter) GnomeCanvasRichText *text GtkTextIter * iter; PREINIT: GdkRectangle location; CODE: gnome_canvas_rich_text_get_iter_location (text, iter, &location); RETVAL = &location; OUTPUT: RETVAL ## void gnome_canvas_rich_text_get_iter_at_location (GnomeCanvasRichText *text, GtkTextIter *iter, gint x, gint y) GtkTextIter_copy * gnome_canvas_rich_text_get_iter_at_location (text, x, y) GnomeCanvasRichText *text gint x gint y PREINIT: GtkTextIter iter; CODE: gnome_canvas_rich_text_get_iter_at_location (text, &iter, x, y); RETVAL = &iter; OUTPUT: RETVAL Gnome2-Canvas-1.002/xs/GnomeCanvasShape.xs0100644000076600000240000000237107764013421017452 0ustar muppetstaff/* * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307 USA. * * $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/xs/GnomeCanvasShape.xs,v 1.1 2003/12/05 05:26:41 muppetman Exp $ */ #include "gnomecanvasperl.h" MODULE = Gnome2::Canvas::Shape PACKAGE = Gnome2::Canvas::Shape PREFIX = gnome_canvas_shape_ void gnome_canvas_shape_set_path_def (shape, path_def) GnomeCanvasShape * shape GnomeCanvasPathDef * path_def GnomeCanvasPathDef_copy * gnome_canvas_shape_get_path_def (shape) GnomeCanvasShape * shape Gnome2-Canvas-1.002/xs/GnomeCanvasUtil.xs0100644000076600000240000002126710110012740017312 0ustar muppetstaff/* * Copyright (c) 2003 by the gtk2-perl team (see the file AUTHORS) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307 USA. * * $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/xs/GnomeCanvasUtil.xs,v 1.7 2004/08/16 02:03:12 muppetman Exp $ */ #include "gnomecanvasperl.h" static SV* gnomecanvasperl_points_wrap (GType gtype, const char * package, gpointer boxed, gboolean own); static gpointer gnomecanvasperl_points_unwrap (GType gtype, const char * package, SV * sv); static GPerlBoxedWrapperClass point_wrapper_class = { gnomecanvasperl_points_wrap, gnomecanvasperl_points_unwrap, NULL }; static SV* gnomecanvasperl_points_wrap (GType gtype, const char * package, gpointer boxed, gboolean own) { AV * av; int i; GnomeCanvasPoints * points; if (!boxed) return &PL_sv_undef; points = (GnomeCanvasPoints*) boxed; av = newAV (); for (i = 0; i < points->num_points * 2 ; i++) av_push (av, newSVnv (points->coords[i])); if (own) g_boxed_free (gtype, boxed); return newRV_noinc ((SV*)av); } static gpointer gnomecanvasperl_points_unwrap (GType gtype, const char * package, SV * sv) { GnomeCanvasPoints * points; AV * av; int i, n; if (!sv || !SvROK (sv) || SvTYPE (SvRV (sv)) != SVt_PVAV) return NULL; av = (AV*) SvRV (sv); n = av_len (av) + 1; points = gperl_alloc_temp (sizeof (GnomeCanvasPoints)); points->ref_count = 1; points->num_points = n / 2; points->coords = gperl_alloc_temp (sizeof (double) * n); for (i = 0 ; i < n ; i++) { SV ** svp = av_fetch (av, i, FALSE); points->coords[i] = svp ? SvNV (*svp) : 0.0; } return points; } MODULE = Gnome2::Canvas::Util PACKAGE = Gnome2::Canvas::Points PREFIX = gnome_canvas_points_ BOOT: /* override default wrapper implementation for GnomeCanvasPoints */ gperl_register_boxed (GNOME_TYPE_CANVAS_POINTS, "Gnome2::Canvas::Points", &point_wrapper_class); ## not needed ### GnomeCanvasPoints *gnome_canvas_points_new (int num_points) ### GnomeCanvasPoints *gnome_canvas_points_ref (GnomeCanvasPoints *points) ### void gnome_canvas_points_free (GnomeCanvasPoints *points) MODULE = Gnome2::Canvas::Util PACKAGE = Gnome2::Canvas PREFIX = gnome_canvas_ ## int gnome_canvas_get_miter_points (double x1, double y1, double x2, double y2, double x3, double y3, double width, double *mx1, double *my1, double *mx2, double *my2) =for apidoc =for signature ($mx1, $my1, $mx2, $my2) = Gnome2::Canvas->get_miter_points ($x1, $y1, $x2, $y2, $x3, $y3, $width) =cut void gnome_canvas_get_miter_points (class, x1, y1, x2, y2, x3, y3, width) double x1 double y1 double x2 double y2 double x3 double y3 double width PREINIT: double mx1, my1, mx2, my2; PPCODE: if (!gnome_canvas_get_miter_points (x1, y1, x2, y2, x3, y3, width, &mx1, &my1, &mx2, &my2)) XSRETURN_EMPTY; EXTEND (SP, 4); PUSHs (sv_2mortal (newSVnv (mx1))); PUSHs (sv_2mortal (newSVnv (my1))); PUSHs (sv_2mortal (newSVnv (mx2))); PUSHs (sv_2mortal (newSVnv (my2))); ## void gnome_canvas_get_butt_points (double x1, double y1, double x2, double y2, double width, int project, double *bx1, double *by1, double *bx2, double *by2) =for apidoc =for signature ($bx1, $by1, $bx2, $by2) = Gnome2::Canvas->get_butt_points ($x1, $y1, $x2, $y2, $width, $project) =cut void gnome_canvas_get_butt_points (class, x1, y1, x2, y2, width, project) double x1 double y1 double x2 double y2 double width int project PREINIT: double bx1, by1, bx2, by2; PPCODE: gnome_canvas_get_butt_points (x1, y1, x2, y2, width, project, &bx1, &by1, &bx2, &by2); EXTEND (SP, 4); PUSHs (sv_2mortal (newSVnv (bx1))); PUSHs (sv_2mortal (newSVnv (by1))); PUSHs (sv_2mortal (newSVnv (bx2))); PUSHs (sv_2mortal (newSVnv (by2))); ## double gnome_canvas_polygon_to_point (double *poly, int num_points, double x, double y) =for apidoc =for arg poly_ref (arrayref) coordinate pairs that make up the polygon Return the distance from the point I<$x>,I<$y> to the polygon described by the vertices in I<$poly_ref>, or zero if the point is inside the polygon. =cut double gnome_canvas_polygon_to_point (class, poly_ref, x, y) SV *poly_ref double x double y PREINIT: double *poly; AV *array; int length, i; CODE: if (! (SvRV (poly_ref) && SvTYPE (SvRV (poly_ref)) == SVt_PVAV)) croak ("the polygon parameter should be a reference to an " "array of coordinate pairs"); array = (AV *) SvRV (poly_ref); length = av_len (array) + 1; if (length % 2 != 0) croak ("the polygon array must contain x,y coordinate pairs," " so its length cannot be odd (got %d)", length); poly = g_new0 (double, length); for (i = 0; i < length; i += 2) { SV **value; value = av_fetch (array, i, 0); if (value && SvOK (*value)) poly[i] = SvNV (*value); value = av_fetch (array, i + 1, 0); if (value && SvOK (*value)) poly[i + 1] = SvNV (*value); } RETVAL = gnome_canvas_polygon_to_point (poly, length/2, x, y); g_free (poly); OUTPUT: RETVAL ### void gnome_canvas_render_svp (GnomeCanvasBuf *buf, ArtSVP *svp, guint32 rgba) #void #gnome_canvas_render_svp (buf, svp, rgba) # GnomeCanvasBuf *buf # ArtSVP *svp # guint32 rgba # ### void gnome_canvas_update_svp (GnomeCanvas *canvas, ArtSVP **p_svp, ArtSVP *new_svp) #void #gnome_canvas_update_svp (canvas, p_svp, new_svp) # GnomeCanvas *canvas # ArtSVP **p_svp # ArtSVP *new_svp # ### void gnome_canvas_update_svp_clip (GnomeCanvas *canvas, ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp) #void #gnome_canvas_update_svp_clip (canvas, p_svp, new_svp, clip_svp) # GnomeCanvas *canvas # ArtSVP **p_svp # ArtSVP *new_svp # ArtSVP *clip_svp MODULE = Gnome2::Canvas::Util PACKAGE = Gnome2::Canvas::Item PREFIX = gnome_canvas_item_ ## void gnome_canvas_item_reset_bounds (GnomeCanvasItem *item) =for apidoc Reset the bounding box of I<$item> to an empty rectangle. =cut void gnome_canvas_item_reset_bounds (item) GnomeCanvasItem *item ### void gnome_canvas_item_update_svp (GnomeCanvasItem *item, ArtSVP **p_svp, ArtSVP *new_svp) #void #gnome_canvas_item_update_svp (item, p_svp, new_svp) # GnomeCanvasItem *item # ArtSVP **p_svp # ArtSVP *new_svp # ### void gnome_canvas_item_update_svp_clip (GnomeCanvasItem *item, ArtSVP **p_svp, ArtSVP *new_svp, ArtSVP *clip_svp) #void #gnome_canvas_item_update_svp_clip (item, p_svp, new_svp, clip_svp) # GnomeCanvasItem *item # ArtSVP **p_svp # ArtSVP *new_svp # ArtSVP *clip_svp # ### void gnome_canvas_item_request_redraw_svp (GnomeCanvasItem *item, const ArtSVP *svp) #void #gnome_canvas_item_request_redraw_svp (item, svp) # GnomeCanvasItem *item # const ArtSVP *svp MODULE = Gnome2::Canvas::Util PACKAGE = Gnome2::Canvas::Item PREFIX = gnome_canvas_ ## void gnome_canvas_update_bbox (GnomeCanvasItem *item, int x1, int y1, int x2, int y2) =for apidoc Set I<$item>'s bounding box to a new rectangle, and request a full repaint. =cut void gnome_canvas_update_bbox (item, x1, y1, x2, y2) GnomeCanvasItem *item int x1 int y1 int x2 int y2 ##MODULE = Gnome2::Canvas::Util PACKAGE = Gnome2::Canvas::Buf PREFIX = gnome_canvas_buf_ ## #### void gnome_canvas_buf_ensure_buf (GnomeCanvasBuf *buf) ##void ##gnome_canvas_buf_ensure_buf (buf) ## GnomeCanvasBuf *buf ## ##MODULE = Gnome2::Canvas::Util PACKAGE = Gnome2::Canvas PREFIX = gnome_canvas_ ## #### ArtPathStrokeJoinType gnome_canvas_join_gdk_to_art (GdkJoinStyle gdk_join) ##ArtPathStrokeJoinType ##gnome_canvas_join_gdk_to_art (gdk_join) ## GdkJoinStyle gdk_join ## #### ArtPathStrokeCapType gnome_canvas_cap_gdk_to_art (GdkCapStyle gdk_cap) ##ArtPathStrokeCapType ##gnome_canvas_cap_gdk_to_art (gdk_cap) ## GdkCapStyle gdk_cap ##