Skip to content

Commit

Permalink
GUI spatial tab: add menu option for undef branch colour
Browse files Browse the repository at this point in the history
  • Loading branch information
shawnlaffan committed May 31, 2024
1 parent a1a4d2d commit 877df27
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions lib/Biodiverse/GUI/Tabs/Spatial.pm
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,13 @@ sub get_tree_menu_items {
},
active => 0,
},
{
type => 'Gtk2::MenuItem',
label => 'Set colour for undefined list values',
tooltip => 'Set the colour used to display list values that are undefined.',
event => 'activate',
callback => \&on_tree_undef_colour_changed,
},
{
type => 'submenu_radio_group',
label => 'Colour mode',
Expand Down Expand Up @@ -2641,6 +2648,29 @@ sub on_tree_colour_mode_changed {
return;
}

sub on_tree_undef_colour_changed {
my ($self, $menu_item) = @_;

return if !$menu_item;

# Pop up dialog for choosing the hue to use in saturation mode
my $colour_dialog = Gtk2::ColorSelectionDialog->new('Select colour');
my $colour_select = $colour_dialog->get_color_selection();
if (my $current_colour = $self->get_dendrogram_colour_for_undef) {
$colour_select->set_current_color ($current_colour);
}
$colour_dialog->show_all();
my $response = $colour_dialog->run;
if ($response eq 'ok') {
my $hue = $colour_select->get_current_color();
$self->set_dendrogram_colour_for_undef ($hue);
$self->{dendrogram}->update_legend;
}
$colour_dialog->destroy();

return;
}


# methods aren't inherited when called as GTK callbacks
# so we have to manually inherit them using SUPER::
Expand Down

0 comments on commit 877df27

Please sign in to comment.