From 324e60d15a9ba0a6dcf03b4189019100c9f164cd Mon Sep 17 00:00:00 2001 From: Shawn Laffan Date: Thu, 2 Jul 2020 17:23:00 +1000 Subject: [PATCH] Start shift to GooCanvas2 (currently non-functional) Also update color parse calls for Gtk3 Updates #770 and #771 --- lib/Biodiverse/GUI/Dendrogram.pm | 93 +++++++++++++++--------------- lib/Biodiverse/GUI/Grid.pm | 66 ++++++++++----------- lib/Biodiverse/GUI/Legend.pm | 20 +++---- lib/Biodiverse/GUI/MatrixGrid.pm | 39 +++++++------ lib/Biodiverse/GUI/Overlays.pm | 2 +- lib/Biodiverse/GUI/Tabs/Spatial.pm | 2 +- 6 files changed, 112 insertions(+), 110 deletions(-) diff --git a/lib/Biodiverse/GUI/Dendrogram.pm b/lib/Biodiverse/GUI/Dendrogram.pm index bd903b49b..822949dd3 100644 --- a/lib/Biodiverse/GUI/Dendrogram.pm +++ b/lib/Biodiverse/GUI/Dendrogram.pm @@ -14,7 +14,7 @@ use List::Util 1.29 qw /min pairs/; use List::MoreUtils qw /firstidx/; use Gtk3; -use Gnome2::Canvas; +use GooCanvas2; use POSIX qw /ceil/; # for ceil() our $VERSION = '3.1'; @@ -46,7 +46,7 @@ use constant COLOUR_LIST_UNDEF => COLOUR_WHITE; use constant DEFAULT_LINE_COLOUR => COLOUR_BLACK; use constant DEFAULT_LINE_COLOUR_RGB => "#000000"; -use constant DEFAULT_LINE_COLOUR_VERT => Gtk3::Gdk::Color->parse('#7F7F7F'); # '#4D4D4D' +use constant DEFAULT_LINE_COLOUR_VERT => Gtk3::Gdk::Color::parse('#7F7F7F'); # '#4D4D4D' use constant HOVER_CURSOR => 'hand2'; @@ -168,9 +168,9 @@ sub new { $self->{height_scale} = 1; # Create background rectangle to receive mouse events for panning - my $rect = Gnome2::Canvas::Item->new ( + my $rect = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => 0, y1 => 0, x2 => 1, @@ -277,9 +277,9 @@ sub make_slider { return; } - $self->{slider} = Gnome2::Canvas::Item->new ( + $self->{slider} = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => 0, y1 => 0, x2 => 1, @@ -289,9 +289,9 @@ sub make_slider { $self->{slider}->signal_connect_swapped (event => \&on_slider_event, $self); # Slider for the graph at the bottom - $self->{graph_slider} = Gnome2::Canvas::Item->new ( + $self->{graph_slider} = GooCanvas2::CanvasItem->new ( $self->{graph}->root, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => 0, y1 => 0, x2 => 1, @@ -301,17 +301,17 @@ sub make_slider { $self->{graph_slider}->signal_connect_swapped (event => \&on_slider_event, $self); # Make the #Clusters textbox - $self->{clusters_group} = Gnome2::Canvas::Item->new ( + $self->{clusters_group} = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Group', + 'GooCanvas2::CanvasGroup', x => 0, y => 0, ); $self->{clusters_group}->lower_to_bottom(); - $self->{clusters_rect} = Gnome2::Canvas::Item->new ( + $self->{clusters_rect} = GooCanvas2::CanvasItem->new ( $self->{clusters_group}, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => 0, y1 => 0, x2 => 0, @@ -319,9 +319,9 @@ sub make_slider { 'fill-color' => 'blue', ); - $self->{clusters_text} = Gnome2::Canvas::Item->new ( + $self->{clusters_text} = GooCanvas2::CanvasItem->new ( $self->{clusters_group}, - 'Gnome2::Canvas::Text', + 'GooCanvas2::CanvasText', x => 0, y => 0, anchor => 'nw', @@ -552,7 +552,7 @@ sub get_palette_colorbrewer13 { sub get_gdk_colors_colorbrewer9 { my $self = shift; my @colours - = map {Gtk3::Gdk::Color->parse ($_)} + = map {Gtk3::Gdk::Color::parse ($_)} $self->get_palette_colorbrewer9; return @colours; } @@ -560,7 +560,7 @@ sub get_gdk_colors_colorbrewer9 { sub get_gdk_colors_colorbrewer13 { my $self = shift; my @colours - = map {Gtk3::Gdk::Color->parse ($_)} + = map {Gtk3::Gdk::Color::parse ($_)} $self->get_palette_colorbrewer13; return @colours; } @@ -796,7 +796,7 @@ sub assign_cluster_palette_colours { # assign colours my $colour_ref; foreach my $k (0..$#sorted_clusters) { - $colour_ref = Gtk3::Gdk::Color->parse($palette[$k]); + $colour_ref = Gtk3::Gdk::Color::parse($palette[$k]); #$sorted_clusters[$k]->set_cached_value(__gui_palette_colour => $colour_ref); $self->{node_palette_colours}{$sorted_clusters[$k]->get_name} = $colour_ref; } @@ -1071,7 +1071,7 @@ sub set_current_multiselect_colour { eval { if ((blessed $colour // '') !~ /Gtk3::Gdk::Color/) { - $colour = Gtk3::Gdk::Color->parse ($colour); + $colour = Gtk3::Gdk::Color::parse ($colour); } $colour = $self->{selector_colorbutton}->set_color ($colour); }; @@ -2234,9 +2234,9 @@ sub render_tree { $self->{root_circle}->destroy() if $self->{root_circle}; # Make group so we can transform everything together - my $lines_group = Gnome2::Canvas::Item->new ( + my $lines_group = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Group', + 'GooCanvas2::CanvasGroup', x => 0, y => 0 ); @@ -2275,7 +2275,7 @@ sub render_tree { # Draw a circle to mark out the root node my $root_y = $tree->get_value('_y') * $self->{height_scale}; my $root_circ_diameter = 0.5 * $self->{border_len} * $self->{length_scale}; - $self->{root_circle} = Gnome2::Canvas::Item->new ( + $self->{root_circle} = GooCanvas2::CanvasItem->new ( $self->{lines_group}, 'Gnome2::Canvas::Ellipse', x1 => $root_offset, @@ -2292,24 +2292,25 @@ sub render_tree { $self->{root_circle}->lower_to_bottom(); $self->{back_rect}->lower_to_bottom(); - if (0) { - # Spent ages on this - not working - NO IDEA WHY!! - - # Draw an equilateral triangle to mark out the root node - # Vertex pointing at the root, the up-down side half border_len behind - my $perp_height = 0.5 * $self->{length_scale} * $self->{border_len} / 1.732; # 1.723 ~ sqrt(3) - my $triangle_path = Gnome2::Canvas::PathDef->new; - $triangle_path->moveto($root_offset, $root_y); - $triangle_path->lineto($root_offset - 0.5 * $self->{border_len}, $root_y + $perp_height); - $triangle_path->lineto($root_offset - 0.5 * $self->{border_len}, $root_y - $perp_height); - $triangle_path->closepath(); - - my $triangle = Gnome2::Canvas::Item->new ( $lines_group, - "Gnome2::Canvas::Shape", - fill_color => "green", - ); - $triangle->set_path_def($triangle_path); - } + #if (0) { + # # Spent ages on this - not working - NO IDEA WHY!! + # + # # Draw an equilateral triangle to mark out the root node + # # Vertex pointing at the root, the up-down side half border_len behind + # my $perp_height = 0.5 * $self->{length_scale} * $self->{border_len} / 1.732; # 1.723 ~ sqrt(3) + # my $triangle_path = Gnome2::Canvas::PathDef->new; + # $triangle_path->moveto($root_offset, $root_y); + # $triangle_path->lineto($root_offset - 0.5 * $self->{border_len}, $root_y + $perp_height); + # $triangle_path->lineto($root_offset - 0.5 * $self->{border_len}, $root_y - $perp_height); + # $triangle_path->closepath(); + # + # my $triangle = GooCanvas2::CanvasItem->new ( + # $lines_group, + # "GooCanvas2::CanvasPolyline", # maybe not a polyline? was shape + # fill_color => "green", + # ); + # $triangle->set_path_def($triangle_path); + #} #$self->restore_line_colours(); @@ -2351,9 +2352,9 @@ sub render_graph { } # Make group so we can transform everything together - my $graph_group = Gnome2::Canvas::Item->new ( + my $graph_group = GooCanvas2::CanvasItem->new ( $self->{graph}->root, - 'Gnome2::Canvas::Group', + 'GooCanvas2::CanvasGroup', x => 0, y => 0 ); @@ -2401,7 +2402,7 @@ sub render_graph { my $segment_y = ($i * $graph_height_units) / $y_offset; #print "[render_graph] segment_y=$segment_y current_x=$current_x\n"; - my $hline = Gnome2::Canvas::Item->new ( + my $hline = GooCanvas2::CanvasItem->new ( $graph_group, 'Gnome2::Canvas::Line', points => [$current_x - $segment_length, $segment_y, $current_x, $segment_y], @@ -2411,7 +2412,7 @@ sub render_graph { # Now the vertical line if ($previous_y) { - my $vline = Gnome2::Canvas::Item->new ( + my $vline = GooCanvas2::CanvasItem->new ( $graph_group, 'Gnome2::Canvas::Line', points => [$current_x, $previous_y, $current_x, $segment_y], @@ -2531,7 +2532,7 @@ sub draw_line { ? 'solid' : 'on-off-dash'; - return Gnome2::Canvas::Item->new ( + return GooCanvas2::CanvasItem->new ( $self->{lines_group}, 'Gnome2::Canvas::Line', points => $vertices, @@ -2700,9 +2701,9 @@ sub on_background_event { ); $self->{selecting} = 1; - $self->{sel_rect} = Gnome2::Canvas::Item->new ( + $self->{sel_rect} = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => $x, y1 => $y, x2 => $x, diff --git a/lib/Biodiverse/GUI/Grid.pm b/lib/Biodiverse/GUI/Grid.pm index 835f1f5f4..201a5bf67 100644 --- a/lib/Biodiverse/GUI/Grid.pm +++ b/lib/Biodiverse/GUI/Grid.pm @@ -15,7 +15,7 @@ use Scalar::Util qw /blessed/; use List::Util qw /min max/; use Gtk3; -use Gnome2::Canvas; +use GooCanvas2; use Tree::R; use Geo::ShapeFile; @@ -60,7 +60,7 @@ use constant HIGHLIGHT_COLOUR => Gtk3::Gdk::Color->new(255*257,0,0); # red use constant COLOUR_BLACK => Gtk3::Gdk::Color->new(0, 0, 0); use constant COLOUR_WHITE => Gtk3::Gdk::Color->new(255*257, 255*257, 255*257); use constant CELL_OUTLINE_COLOUR => Gtk3::Gdk::Color->new(0, 0, 0); -use constant OVERLAY_COLOUR => Gtk3::Gdk::Color->parse('#001169'); +use constant OVERLAY_COLOUR => Gtk3::Gdk::Color::parse('#001169'); use constant DARKEST_GREY_FRAC => 0.2; use constant LIGHTEST_GREY_FRAC => 0.8; @@ -166,9 +166,9 @@ sub new { } # Create background rectangle to receive mouse events for panning - my $rect = Gnome2::Canvas::Item->new ( + my $rect = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => 0, y1 => 0, x2 => CELL_SIZE_X, @@ -307,16 +307,16 @@ sub setup_value_label { my $self = shift; my $group = shift; - my $value_group = Gnome2::Canvas::Item->new ( + my $value_group = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Group', + 'GooCanvas2::CanvasGroup', x => 0, y => 100, ); - my $text = Gnome2::Canvas::Item->new ( + my $text = GooCanvas2::CanvasItem->new ( $value_group, - 'Gnome2::Canvas::Text', + 'GooCanvas2::CanvasText', x => 0, y => 0, markup => "Value: ", anchor => 'nw', @@ -326,9 +326,9 @@ sub setup_value_label { my ($text_width, $text_height) = $text->get('text-width', 'text-height'); - my $rect = Gnome2::Canvas::Item->new ( + my $rect = GooCanvas2::CanvasItem->new ( $value_group, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => 0, y1 => 0, x2 => $text_width, @@ -466,9 +466,9 @@ sub set_base_struct { } # Make group so we can transform everything together - my $cells_group = Gnome2::Canvas::Item->new ( + my $cells_group = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Group', + 'GooCanvas2::CanvasGroup', x => 0, y => 0, ); @@ -477,15 +477,15 @@ sub set_base_struct { ## Make container group ("cell") for the rectangle and any marks #my $xx = eval {($max_x - $min_x) / $cell_x}; #my $yy = eval {($max_y - $min_y) / $cell_y}; -#my $container_xx = Gnome2::Canvas::Item->new ( +#my $container_xx = GooCanvas2::CanvasItem->new ( # $cells_group, -# 'Gnome2::Canvas::Group', +# 'GooCanvas2::CanvasGroup', # x => 0, # y => 0, #); -#my $rect = Gnome2::Canvas::Item->new ( +#my $rect = GooCanvas2::CanvasItem->new ( # $container_xx, -# 'Gnome2::Canvas::Rect', +# 'GooCanvas2::CanvasRect', # x1 => 0, # y1 => 0, # x2 => $xx * CELL_SIZE_X, @@ -521,17 +521,17 @@ sub set_base_struct { my $ycoord = $y * $cell_size_y - $cell_size_y / 2; # Make container group ("cell") for the rectangle and any marks - my $container = Gnome2::Canvas::Item->new ( + my $container = GooCanvas2::CanvasItem->new ( $cells_group, - 'Gnome2::Canvas::Group', + 'GooCanvas2::CanvasGroup', x => $xcoord, y => $ycoord ); # (all coords now relative to the group) - my $rect = Gnome2::Canvas::Item->new ( + my $rect = GooCanvas2::CanvasItem->new ( $container, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => 0, y1 => 0, x2 => CELL_SIZE_X, @@ -669,9 +669,9 @@ sub load_shapefile { my @bnd_extrema = (1e20, 1e20, -1e20, -1e20); # Put it into a group so that it can be deleted more easily - my $shapefile_group = Gnome2::Canvas::Item->new ( + my $shapefile_group = GooCanvas2::CanvasItem->new ( $self->{cells_group}, - 'Gnome2::Canvas::Group', + 'GooCanvas2::CanvasGroup', x => 0, y => 0, ); @@ -718,7 +718,7 @@ sub load_shapefile { #print "@plot_points\n"; if (@plot_points > 2) { # must have more than one point (two coords) - my $poly = Gnome2::Canvas::Item->new ( + my $poly = GooCanvas2::CanvasItem->new ( $shapefile_group, 'Gnome2::Canvas::Line', points => \@plot_points, @@ -1018,7 +1018,7 @@ sub draw_circle { my $offset_x = (CELL_SIZE_X - CIRCLE_DIAMETER) / 2; my $offset_y = ($self->{cell_size_y} - CIRCLE_DIAMETER) / 2; - my $item = Gnome2::Canvas::Item->new ( + my $item = GooCanvas2::CanvasItem->new ( $group, 'Gnome2::Canvas::Ellipse', x1 => $offset_x, @@ -1043,20 +1043,20 @@ sub on_marker_event { #sub draw_cross { # my ($self, $group) = @_; # # Use a group to hold the two lines -# my $cross_group = Gnome2::Canvas::Item->new ( +# my $cross_group = GooCanvas2::CanvasItem->new ( # $group, -# "Gnome2::Canvas::Group", +# "GooCanvas2::CanvasGroup", # x => 0, y => 0, # ); # -# Gnome2::Canvas::Item->new ( +# GooCanvas2::CanvasItem->new ( # $cross_group, # "Gnome2::Canvas::Line", # points => [MARK_OFFSET_X, MARK_OFFSET_X, MARK_END_OFFSET_X, MARK_END_OFFSET_X], # fill_color_gdk => COLOUR_BLACK, # width_units => 1, # ); -# Gnome2::Canvas::Item->new ( +# GooCanvas2::CanvasItem->new ( # $cross_group, # "Gnome2::Canvas::Line", # points => [MARK_END_OFFSET_X, MARK_OFFSET_X, MARK_OFFSET_X, MARK_END_OFFSET_X], @@ -1071,7 +1071,7 @@ sub draw_minus { my ($self, $group) = @_; my $offset_y = ($self->{cell_size_y} - 1) / 2; - return Gnome2::Canvas::Item->new ( + return GooCanvas2::CanvasItem->new ( $group, 'Gnome2::Canvas::Line', points => [ @@ -1465,9 +1465,9 @@ sub on_event { $self->{selecting} = 1; $self->{grabbed_cell} = $cell; - $self->{sel_rect} = Gnome2::Canvas::Item->new ( + $self->{sel_rect} = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => $event->x, y1 => $event->y, x2 => $event->x, @@ -1577,9 +1577,9 @@ sub on_background_event { $self->{selecting} = 1; $self->{grabbed_cell} = $cell; - $self->{sel_rect} = Gnome2::Canvas::Item->new ( + $self->{sel_rect} = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => $event->x, y1 => $event->y, x2 => $event->x + 1, diff --git a/lib/Biodiverse/GUI/Legend.pm b/lib/Biodiverse/GUI/Legend.pm index 1f3518627..30fbcca04 100644 --- a/lib/Biodiverse/GUI/Legend.pm +++ b/lib/Biodiverse/GUI/Legend.pm @@ -15,7 +15,7 @@ use Scalar::Util qw /blessed/; use List::Util qw /min max/; use Gtk3; -use Gnome2::Canvas; +use GooCanvas2; use Tree::R; #use Geo::ShapeFile; @@ -82,9 +82,9 @@ sub new { # Make group so we can pack the coloured # rectangles into it. - $self->{legend_group} = Gnome2::Canvas::Item->new ( - $self->{canvas}->root, - 'Gnome2::Canvas::Group', + $self->{legend_group} = GooCanvas2::CanvasItem->new ( + $self->{canvas}->get_root_item, # root? + 'GooCanvas2::CanvasGroup', x => $width - $self->get_width, y => 0, ); @@ -141,9 +141,9 @@ sub make_rect { # Make a group so we can pack the coloured # rectangles into it to create the legend. - $self->{legend_colours_group} = Gnome2::Canvas::Item->new ( + $self->{legend_colours_group} = GooCanvas2::CanvasItem->new ( $self->{legend_group}, - 'Gnome2::Canvas::Group', + 'GooCanvas2::CanvasGroup', x => 0, y => 0, ); @@ -208,9 +208,9 @@ sub add_row { my $width = $self->get_width; - my $legend_colour_row = Gnome2::Canvas::Item->new ( + my $legend_colour_row = GooCanvas2::CanvasItem->new ( $group, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => 0, x2 => $width, y1 => $row, @@ -226,9 +226,9 @@ sub add_row { sub make_mark { my $self = shift; my $anchor = shift; - my $mark = Gnome2::Canvas::Item->new ( + my $mark = GooCanvas2::CanvasItem->new ( $self->{legend_group}, - 'Gnome2::Canvas::Text', + 'GooCanvas2::CanvasText', text => q{0}, anchor => $anchor, fill_color_gdk => COLOUR_BLACK, diff --git a/lib/Biodiverse/GUI/MatrixGrid.pm b/lib/Biodiverse/GUI/MatrixGrid.pm index edab3e8c7..1fde13919 100644 --- a/lib/Biodiverse/GUI/MatrixGrid.pm +++ b/lib/Biodiverse/GUI/MatrixGrid.pm @@ -18,7 +18,7 @@ use List::Util qw /min max/; our $VERSION = '3.1'; use Gtk3; -use Gnome2::Canvas; +use GooCanvas2; use Biodiverse::GUI::GUIManager; use Biodiverse::GUI::CellPopup; @@ -46,9 +46,9 @@ use constant HOVER_CURSOR => 'hand2'; use constant HIGHLIGHT_COLOUR => Gtk3::Gdk::Color->new(255*257, 0, 0); # red use constant CELL_BLACK => Gtk3::Gdk::Color->new(0, 0, 0); use constant CELL_WHITE => Gtk3::Gdk::Color->new(255*257, 255*257, 255*257); -#use constant CELL_COLOUR => Gtk3::Gdk::Color->parse('#B3FFFF'); -use constant CELL_COLOUR => Gtk3::Gdk::Color->parse('#FFFFFF'); -use constant OVERLAY_COLOUR => Gtk3::Gdk::Color->parse('#001169'); +#use constant CELL_COLOUR => Gtk3::Gdk::Color::parse('#B3FFFF'); +use constant CELL_COLOUR => Gtk3::Gdk::Color::parse('#FFFFFF'); +use constant OVERLAY_COLOUR => Gtk3::Gdk::Color::parse('#001169'); # Stiple for the selection-masking shape my $gray50_width = 2; @@ -79,7 +79,7 @@ sub new { $self->{grid_click_func} = $args{grid_click_func}; # click on a cell # Make the canvas and hook it up - $self->{canvas} = Gnome2::Canvas->new(); + $self->{canvas} = GooCanvas2::Canvas->new(); $frame->add($self->{canvas}); $self->{canvas}->signal_connect_swapped ( @@ -125,9 +125,9 @@ sub new { $self->{selecting} = 0; # Create background rectangle to receive mouse events for panning - my $rect = Gnome2::Canvas::Item->new ( + my $rect = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => 0, y1 => 0, x2 => CELL_SIZE, @@ -233,9 +233,9 @@ sub destroy { sub make_mark { my $self = shift; my $anchor = shift; - my $mark = Gnome2::Canvas::Item->new ( + my $mark = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Text', + 'GooCanvas2::CanvasText', text => q{}, anchor => $anchor, fill_color_gdk => CELL_BLACK, @@ -264,9 +264,9 @@ sub draw_matrix { } # Make group so we can transform everything together - my $cells_group = Gnome2::Canvas::Item->new ( + my $cells_group = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Group', + 'GooCanvas2::CanvasGroup', x => 0, y => 0, ); @@ -289,9 +289,9 @@ sub draw_matrix { $progress_bar->update ($progress_text, $progress); - my $rect = Gnome2::Canvas::Item->new ( + my $rect = GooCanvas2::CanvasItem->new ( $cells_group, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => $x * CELL_SIZE, y1 => $y * CELL_SIZE, x2 => ($x + 1) * CELL_SIZE, @@ -429,7 +429,8 @@ sub highlight { my ($x, $y, $w, $h); foreach my $rect (@mask_rects) { - my $pathdef = Gnome2::Canvas::PathDef->new; + # should be rectangles? + my $pathdef = GooCanvas2::CanvasPathModel->new; # was PathDef under Gnome2 ($x, $y, $w, $h) = ($rect->x, $rect->y, $rect->width, $rect->height); #print "MASK RECT: ($x, $y) w=$w h=$h\n"; @@ -445,7 +446,7 @@ sub highlight { # concatenate each region # mask and stipple need to use Cairo # - see issue 480 https://github.com/shawnlaffan/biodiverse/issues/480 - my $mask_path = Gnome2::Canvas::PathDef->concat(@paths); + my $mask_path = GooCanvas2::CanvasPathModel->concat(@paths); my $mask_stipple = Gtk3::Gdk::Bitmap->create_from_data( undef, $gray50_bits, @@ -453,9 +454,9 @@ sub highlight { $gray50_height, ); - $self->{mask} = Gnome2::Canvas::Item->new ( + $self->{mask} = GooCanvas2::CanvasItem->new ( $self->{cells_group}, - 'Gnome2::Canvas::Shape', + 'GooCanvas2::CanvasPolyline', # maybe not a polyline? was shape #fill_color => 'white', #fill_stipple => $mask_stipple, # off for now - issue 480 #fill_color_rgba => 0xFFFFFFFF, @@ -736,9 +737,9 @@ sub on_event { $event->time, ); $self->{selecting} = 1; - $self->{sel_rect} = Gnome2::Canvas::Item->new ( + $self->{sel_rect} = GooCanvas2::CanvasItem->new ( $self->{canvas}->root, - 'Gnome2::Canvas::Rect', + 'GooCanvas2::CanvasRect', x1 => $x, y1 => $y, x2 => $x, diff --git a/lib/Biodiverse/GUI/Overlays.pm b/lib/Biodiverse/GUI/Overlays.pm index f1fd87f92..4b1926b07 100644 --- a/lib/Biodiverse/GUI/Overlays.pm +++ b/lib/Biodiverse/GUI/Overlays.pm @@ -11,7 +11,7 @@ our $VERSION = '3.1'; use Biodiverse::GUI::GUIManager; use Biodiverse::GUI::Project; -my $default_colour = Gtk3::Gdk::Color->parse('#001169'); +my $default_colour = Gtk3::Gdk::Color::parse('#001169'); my $last_selected_colour = $default_colour; sub show_dialog { diff --git a/lib/Biodiverse/GUI/Tabs/Spatial.pm b/lib/Biodiverse/GUI/Tabs/Spatial.pm index 7016fec27..4df5d44ee 100644 --- a/lib/Biodiverse/GUI/Tabs/Spatial.pm +++ b/lib/Biodiverse/GUI/Tabs/Spatial.pm @@ -1469,7 +1469,7 @@ sub on_grid_hover { # #000000 = black # #00FFFC = cyan(ish) my @dendro_highlight_branch_colours - = map {Gtk3::Gdk::Color->parse($_)} ('#1F78B4', '#E31A1C', '#000000'); + = map {Gtk3::Gdk::Color::parse($_)} ('#1F78B4', '#E31A1C', '#000000'); sub highlight_paths_on_dendrogram { my ($self, $hashrefs, $group) = @_;