aboutsummaryrefslogtreecommitdiff
path: root/src/crystfel_gui.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2022-11-24 15:27:29 +0100
committerThomas White <taw@physics.org>2022-11-24 17:48:13 +0100
commit2754cd0ecdd199f46edf656100a4a9cd0440b7a1 (patch)
tree26d8cf71310750702d69ad3d97ac6d2e9221f8aa /src/crystfel_gui.c
parentacb2e3cb545b64fe94f399e18ae91577ffcac6d0 (diff)
GUI: Colour scale, part 3: Use the values in CrystFELImageView
Diffstat (limited to 'src/crystfel_gui.c')
-rw-r--r--src/crystfel_gui.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index 81f563a8..25b7e1d8 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -282,7 +282,9 @@ void update_imageview(struct crystfelproject *proj)
crystfel_colour_scale_scan_image(CRYSTFEL_COLOUR_SCALE(proj->colscale),
proj->cur_image);
- crystfel_colour_scale_auto_range(CRYSTFEL_COLOUR_SCALE(proj->colscale));
+ if ( !proj->range_set ) {
+ crystfel_colour_scale_auto_range(CRYSTFEL_COLOUR_SCALE(proj->colscale));
+ }
gtk_widget_set_sensitive(proj->next_button,
!(proj->cur_frame == proj->n_frames-1));
@@ -965,6 +967,19 @@ static void clear_log_sig(GtkMenuItem *widget,
}
+static void colscale_change_sig(CrystFELColourScale *colscale,
+ struct crystfelproject *proj)
+{
+ double lo, hi;
+ crystfel_colour_scale_get_range(colscale, &lo, &hi);
+ crystfel_image_view_set_colour_scale(CRYSTFEL_IMAGE_VIEW(proj->imageview),
+ lo, hi);
+ if ( proj->cur_image != NULL ) {
+ proj->range_set = 1;
+ }
+}
+
+
static void add_log_menu_items(GtkTextView *textview,
GtkWidget *popup,
struct crystfelproject *proj)
@@ -1206,6 +1221,8 @@ int main(int argc, char *argv[])
proj.colscale = crystfel_colour_scale_new();
gtk_box_pack_start(GTK_BOX(iv_hbox), proj.colscale, FALSE, FALSE, 0.0);
+ g_signal_connect(proj.colscale, "range-changed",
+ G_CALLBACK(colscale_change_sig), &proj);
/* Icon region at left */
proj.icons = gtk_vbox_new(FALSE, 0.0);