diff options
author | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-12-03 00:05:51 +0000 |
---|---|---|
committer | taw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1> | 2007-12-03 00:05:51 +0000 |
commit | 7fce8715762390de88450c777f2fba474bf6bf12 (patch) | |
tree | 83fa16fcb5997bb4de4cf785d880a73e482ff3d3 /src/reproject.c | |
parent | cf7a9b848cfa0ec4b649f54100b6ff92e5553232 (diff) |
UI revamp
Bump version number to 1.0.7
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@217 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/reproject.c')
-rw-r--r-- | src/reproject.c | 108 |
1 files changed, 16 insertions, 92 deletions
diff --git a/src/reproject.c b/src/reproject.c index 2bb33dc..dc19e9a 100644 --- a/src/reproject.c +++ b/src/reproject.c @@ -204,108 +204,32 @@ ImageFeatureList *reproject_get_reflections(ImageRecord *image, ReflectionList * } -static void reproject_mark_peaks(ControlContext *ctx) { +/* Ensure ctx->cell_lattice matches ctx->cell */ +void reproject_cell_to_lattice(ControlContext *ctx) { - ImageFeatureList *flist; - size_t j; - ImageRecord *image; - - image = &ctx->images->images[ctx->reproject_cur_image]; - - /* Draw the reprojected peaks */ - if ( !image->rflist ) { - image->rflist = reproject_get_reflections(image, ctx->cell_lattice); - } - for ( j=0; j<image->rflist->n_features; j++ ) { - imagedisplay_add_mark(ctx->reproject_id, image->rflist->features[j].x, image->rflist->features[j].y, - IMAGEDISPLAY_MARK_CIRCLE_1, image->rflist->features[j].intensity); - } - - /* Now draw the original measured peaks */ - flist = image->features; - for ( j=0; j<flist->n_features; j++ ) { - imagedisplay_add_mark(ctx->reproject_id, flist->features[j].x, flist->features[j].y, - IMAGEDISPLAY_MARK_CIRCLE_2, image->rflist->features[j].intensity); - } - - /* Now connect partners */ - for ( j=0; j<image->rflist->n_features; j++ ) { - if ( image->rflist->features[j].partner ) { - imagedisplay_add_line(ctx->reproject_id, image->rflist->features[j].x, image->rflist->features[j].y, - image->rflist->features[j].partner->x, image->rflist->features[j].partner->y, - IMAGEDISPLAY_MARK_LINE_1); - } - } - -} - -static void reproject_update(ControlContext *ctx) { - - imagedisplay_clear_marks(ctx->reproject_id); - - reproject_mark_peaks(ctx); - - imagedisplay_put_data(ctx->reproject_id, ctx->images->images[ctx->reproject_cur_image]); - -} - -static gint reproject_clicked(GtkWidget *widget, GdkEventButton *event, ControlContext *ctx) { - - ctx->reproject_cur_image++; - if ( ctx->reproject_cur_image == ctx->images->n_images ) ctx->reproject_cur_image = 0; - - reproject_update(ctx); + int i; - return 0; - -} - -void reproject_lattice_changed(ControlContext *ctx) { - if ( ctx->cell_lattice ) { reflection_list_from_new_cell(ctx->cell_lattice, ctx->cell); } else { ctx->cell_lattice = reflection_list_from_cell(ctx->cell); } - if ( ctx->reproject_id ) reproject_update(ctx); - -} - -static gint reproject_closed(GtkWidget *widget, ControlContext *ctx) { - ctx->reproject_id = NULL; - return 0; -} - -void reproject_open(ControlContext *ctx) { - - if ( ctx->reproject_id ) { - displaywindow_error("Reprojection window is already open.", ctx->dw); - return; - } - - if ( !ctx->cell ) { - printf("RP: No current cell\n"); - displaywindow_error("No reciprocal unit cell has been specified.", ctx->dw); - return; - } + displaywindow_enable_cell_functions(ctx->dw, TRUE); - if ( !ctx->images ) { - printf("RP: No images!\n"); - displaywindow_error("No images to reproject!", ctx->dw); - return; + /* Invalidate all the reprojected feature lists */ + for ( i=0; i<ctx->images->n_images; i++ ) { + image_feature_list_free(ctx->images->images[i].rflist); + ctx->images->images[i].rflist = NULL; } - ctx->reproject_cur_image = 0; - reproject_lattice_changed(ctx); - - ctx->reproject_id = imagedisplay_open_with_message(ctx->images->images[ctx->reproject_cur_image], - "Reprojected Diffraction Pattern", "Click to change image", - IMAGEDISPLAY_SHOW_CENTRE | IMAGEDISPLAY_SHOW_TILT_AXIS, G_CALLBACK(reproject_clicked), ctx); - - reproject_mark_peaks(ctx); - - g_signal_connect(GTK_OBJECT(ctx->reproject_id->drawingarea), "destroy", G_CALLBACK(reproject_closed), ctx); - +} + +/* Notify that ctx->cell has changed (also need to call displaywindow_update) */ +void reproject_lattice_changed(ControlContext *ctx) { + + reproject_cell_to_lattice(ctx); + displaywindow_update_imagestack(ctx->dw); + } |