From 8c2b33dc86c976dae8bbdabaaa343f7e0a008287 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Wed, 10 Apr 2019 16:13:51 +0200 Subject: cell_explorer: Exclude cells when centering type is set to grey This is more useful than just changing the colours. Fixes CRYS-224. --- src/cell_explorer.c | 94 ++++++++++++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 45 deletions(-) diff --git a/src/cell_explorer.c b/src/cell_explorer.c index 6ade77f4..e2875399 100644 --- a/src/cell_explorer.c +++ b/src/cell_explorer.c @@ -519,36 +519,6 @@ static gboolean keyconf_sig(GtkWidget *key, GdkEventConfigure *event, } -static gint keyclick_sig(GtkWidget *widget, GdkEventButton *event, - CellWindow *w) -{ - int width, cat; - GtkAllocation alloc; - - /* Ignore extra events for double click */ - if ( event->type != GDK_BUTTON_PRESS ) return FALSE; - - gtk_widget_get_allocation(widget, &alloc); - width = alloc.width; - - cat = 8*event->x / width; - - if ( cat == 0 ) { - /* Special handling for P so that it doesn't go - * black->black->grey */ - w->cols_on[cat] = (w->cols_on[cat]+1) % 2; - } else { - w->cols_on[cat] = (w->cols_on[cat]+1) % 3; - } - - gtk_widget_queue_draw(widget); - redraw_all(w); - - return TRUE; -} - - - static gboolean keydraw_sig(GtkWidget *da, cairo_t *cr, CellWindow *w) { int width, height; @@ -694,14 +664,14 @@ static void scan_cells(CellWindow *w) al = rad2deg(al); be = rad2deg(be); ga = rad2deg(ga); switch ( cell_get_centering(cells[i]) ) { - case 'P' : cat = 1<hist_be, be) || check_exclude(w->hist_ga, ga) ) { - cat = (unsigned)1<cols_on[cat] == 0 ) { + cat = CAT_EXCLUDE; n_excl++; } - multihistogram_add_value(w->hist_a->h, a, cat); - multihistogram_add_value(w->hist_b->h, b, cat); - multihistogram_add_value(w->hist_c->h, c, cat); - multihistogram_add_value(w->hist_al->h, al, cat); - multihistogram_add_value(w->hist_be->h, be, cat); - multihistogram_add_value(w->hist_ga->h, ga, cat); + multihistogram_add_value(w->hist_a->h, a, 1<hist_b->h, b, 1<hist_c->h, c, 1<hist_al->h, al, 1<hist_be->h, be, 1<hist_ga->h, ga, 1<type != GDK_BUTTON_PRESS ) return FALSE; + + gtk_widget_get_allocation(widget, &alloc); + width = alloc.width; + + cat = 8*event->x / width; + + if ( cat == 0 ) { + /* Special handling for P so that it doesn't go + * black->black->grey */ + w->cols_on[cat] = (w->cols_on[cat]+1) % 2; + } else { + w->cols_on[cat] = (w->cols_on[cat]+1) % 3; + } + + scan_cells(w); + redraw_all(w); + + gtk_widget_queue_draw(widget); + + return TRUE; +} + + static void check_minmax(HistoBox *h, double val) { if ( val > h->max ) h->max = val; -- cgit v1.2.3