aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/crystfel_gui.c20
-rw-r--r--src/crystfelimageview.c28
-rw-r--r--src/crystfelimageview.h4
-rw-r--r--src/gui_project.c6
-rw-r--r--src/gui_project.h1
5 files changed, 54 insertions, 5 deletions
diff --git a/src/crystfel_gui.c b/src/crystfel_gui.c
index 159b8ec2..3a73a790 100644
--- a/src/crystfel_gui.c
+++ b/src/crystfel_gui.c
@@ -263,6 +263,8 @@ void update_imageview(struct crystfelproject *proj)
proj->indexing_params.ir_inn);
crystfel_image_view_set_show_peaks(CRYSTFEL_IMAGE_VIEW(proj->imageview),
proj->show_peaks);
+ crystfel_image_view_set_show_centre(CRYSTFEL_IMAGE_VIEW(proj->imageview),
+ proj->show_centre);
crystfel_image_view_set_image(CRYSTFEL_IMAGE_VIEW(proj->imageview),
proj->cur_image);
@@ -490,6 +492,15 @@ static gint results_combo_changed_sig(GtkComboBox *w,
}
+static gint show_centre_sig(GtkWidget *w, struct crystfelproject *proj)
+{
+ proj->show_centre = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
+ crystfel_image_view_set_show_centre(CRYSTFEL_IMAGE_VIEW(proj->imageview),
+ proj->show_centre);
+ return FALSE;
+}
+
+
static gint show_peaks_sig(GtkWidget *w, struct crystfelproject *proj)
{
proj->show_peaks = gtk_toggle_action_get_active(GTK_TOGGLE_ACTION(w));
@@ -530,6 +541,7 @@ static void add_menu_bar(struct crystfelproject *proj, GtkWidget *vbox)
" <menuitem name=\"peaks\" action=\"PeaksAction\" />"
" <menuitem name=\"refls\" action=\"ReflsAction\" />"
" <menuitem name=\"labelrefls\" action=\"LabelReflsAction\" />"
+ " <menuitem name=\"centre\" action=\"CentreAction\" />"
" <separator />"
" <menuitem name=\"resetzoom\" action=\"ResetZoomAction\" />"
"</menu>"
@@ -570,6 +582,8 @@ static void add_menu_bar(struct crystfelproject *proj, GtkWidget *vbox)
G_CALLBACK(show_refls_sig), FALSE },
{ "LabelReflsAction", NULL, "Show reflection indices", NULL, NULL,
G_CALLBACK(label_refls_sig), FALSE },
+ { "CentreAction", NULL, "Beam centre", NULL, NULL,
+ G_CALLBACK(show_centre_sig), FALSE },
};
proj->action_group = gtk_action_group_new("cellwindow");
@@ -911,6 +925,10 @@ int main(int argc, char *argv[])
stream_close(st);
}
+ w = gtk_ui_manager_get_action(proj.ui, "/mainwindow/view/centre");
+ gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(w),
+ proj.show_centre);
+
w = gtk_ui_manager_get_action(proj.ui, "/mainwindow/view/peaks");
gtk_toggle_action_set_active(GTK_TOGGLE_ACTION(w),
proj.show_peaks);
@@ -926,6 +944,8 @@ int main(int argc, char *argv[])
update_imageview(&proj);
}
+ w = gtk_ui_manager_get_widget(proj.ui, "/ui/mainwindow/view/centre");
+ gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), proj.show_centre);
w = gtk_ui_manager_get_widget(proj.ui, "/ui/mainwindow/view/peaks");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(w), proj.show_peaks);
w = gtk_ui_manager_get_widget(proj.ui, "/ui/mainwindow/view/refls");
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c
index 6d6cbd60..ec1e373c 100644
--- a/src/crystfelimageview.c
+++ b/src/crystfelimageview.c
@@ -374,11 +374,6 @@ static void draw_panel_rectangle(cairo_t *cr, CrystFELImageView *iv,
cairo_restore(cr);
- cairo_arc(cr, 0.0, 0.0, 0.006, 0, 2.0*M_PI);
- cairo_set_source_rgb(cr, 1.0, 0.0, 0.0);
- cairo_set_line_width(cr, 0.00001);
- cairo_stroke(cr);
-
xs = p.pixel_pitch;
ys = p.pixel_pitch;
cairo_user_to_device_distance(cr, &xs, &ys);
@@ -583,6 +578,19 @@ static gint draw_sig(GtkWidget *window, cairo_t *cr, CrystFELImageView *iv)
}
}
+ if ( iv->show_centre ) {
+ cairo_arc(cr, 0.0, 0.0, 0.006, 0, 2.0*M_PI);
+ cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.9);
+ cairo_set_line_width(cr, 0.0001);
+ cairo_stroke(cr);
+ cairo_move_to(cr, -0.001, 0.0);
+ cairo_line_to(cr, 0.001, 0.0);
+ cairo_move_to(cr, 0.0, -0.001);
+ cairo_line_to(cr, 0.0, 0.001);
+ cairo_set_source_rgba(cr, 1.0, 0.0, 0.0, 0.9);
+ cairo_stroke(cr);
+ }
+
if ( iv->show_peaks ) {
draw_peaks(cr, iv, iv->image->features);
}
@@ -740,6 +748,7 @@ GtkWidget *crystfel_image_view_new()
iv->detector_h = 1.0;
iv->zoom = -1.0;
iv->image = NULL;
+ iv->show_centre = 1;
iv->show_peaks = 0;
iv->brightness = 1.0;
iv->pixbufs = NULL;
@@ -1018,6 +1027,15 @@ void crystfel_image_view_set_brightness(CrystFELImageView *iv,
}
+void crystfel_image_view_set_show_centre(CrystFELImageView *iv,
+ int show_centre)
+{
+ iv->show_centre = show_centre;
+ iv->need_rerender = 1;
+ redraw(iv);
+}
+
+
void crystfel_image_view_set_show_peaks(CrystFELImageView *iv,
int show_peaks)
{
diff --git a/src/crystfelimageview.h b/src/crystfelimageview.h
index 31df0fc2..3de712db 100644
--- a/src/crystfelimageview.h
+++ b/src/crystfelimageview.h
@@ -88,6 +88,7 @@ struct _crystfelimageview
GdkPixbuf **pixbufs;
double brightness;
+ int show_centre;
int show_peaks;
int show_refls;
int label_refls;
@@ -114,6 +115,9 @@ extern void crystfel_image_view_reset_zoom(CrystFELImageView *iv);
extern void crystfel_image_view_set_brightness(CrystFELImageView *iv,
double brightness);
+extern void crystfel_image_view_set_show_centre(CrystFELImageView *iv,
+ int show_centre);
+
extern void crystfel_image_view_set_show_peaks(CrystFELImageView *iv,
int show_peaks);
diff --git a/src/gui_project.c b/src/gui_project.c
index 574e57dd..fba38b7c 100644
--- a/src/gui_project.c
+++ b/src/gui_project.c
@@ -486,6 +486,10 @@ static void handle_var(const char *key, const char *val,
proj->merging_backend_selected = find_backend(val, proj);
}
+ if ( strcmp(key, "show_centre") == 0 ) {
+ proj->show_centre = parse_int(val);
+ }
+
if ( strcmp(key, "show_peaks") == 0 ) {
proj->show_peaks = parse_int(val);
}
@@ -1027,6 +1031,7 @@ int save_project(struct crystfelproject *proj)
fprintf(fh, "fom.min_meas %i\n", proj->fom_min_meas);
fprintf(fh, "fom.cell_file %s\n", proj->fom_cell_filename);
+ fprintf(fh, "show_centre %i\n", proj->show_centre);
fprintf(fh, "show_peaks %i\n", proj->show_peaks);
fprintf(fh, "show_refls %i\n", proj->show_refls);
fprintf(fh, "label_refls %i\n", proj->label_refls);
@@ -1113,6 +1118,7 @@ void default_project(struct crystfelproject *proj)
#endif
/* Default parameter values */
+ proj->show_centre = 1;
proj->show_peaks = 1;
proj->show_refls = 1;
proj->label_refls = 1;
diff --git a/src/gui_project.h b/src/gui_project.h
index 59a93853..e4daeb8d 100644
--- a/src/gui_project.h
+++ b/src/gui_project.h
@@ -282,6 +282,7 @@ struct crystfelproject {
int max_frames;
char **filenames;
char **events;
+ int show_centre;
int show_peaks;
struct peak_params peak_search_params;