Commit ff5f6051 authored by Thomas White's avatar Thomas White Committed by Thomas White
Browse files

hdfsee: Initial geometry stuff

parent b57080f2
......@@ -52,7 +52,7 @@ endif
if HAVE_GTK
src_hdfsee_SOURCES = src/hdfsee.c src/displaywindow.c src/render.c \
src/hdf5-file.c src/utils.c src/image.c src/filters.c \
src/thread-pool.c
src/thread-pool.c src/detector.c
src_geomatic_SOURCES = src/geomatic.c src/dw-geomatic.c src/render.c \
src/hdf5-file.c src/utils.c src/image.c src/filters.c \
......
......@@ -146,12 +146,13 @@ src_get_hkl_LDADD = $(LDADD)
src_get_hkl_DEPENDENCIES = $(top_builddir)/lib/libgnu.a
am__src_hdfsee_SOURCES_DIST = src/hdfsee.c src/displaywindow.c \
src/render.c src/hdf5-file.c src/utils.c src/image.c \
src/filters.c src/thread-pool.c
src/filters.c src/thread-pool.c src/detector.c
@HAVE_GTK_TRUE@am_src_hdfsee_OBJECTS = src/hdfsee.$(OBJEXT) \
@HAVE_GTK_TRUE@ src/displaywindow.$(OBJEXT) \
@HAVE_GTK_TRUE@ src/render.$(OBJEXT) src/hdf5-file.$(OBJEXT) \
@HAVE_GTK_TRUE@ src/utils.$(OBJEXT) src/image.$(OBJEXT) \
@HAVE_GTK_TRUE@ src/filters.$(OBJEXT) src/thread-pool.$(OBJEXT)
@HAVE_GTK_TRUE@ src/filters.$(OBJEXT) src/thread-pool.$(OBJEXT) \
@HAVE_GTK_TRUE@ src/detector.$(OBJEXT)
src_hdfsee_OBJECTS = $(am_src_hdfsee_OBJECTS)
src_hdfsee_LDADD = $(LDADD)
src_hdfsee_DEPENDENCIES = $(top_builddir)/lib/libgnu.a
......@@ -616,7 +617,7 @@ src_indexamajig_SOURCES = src/indexamajig.c src/hdf5-file.c \
src/beam-parameters.c src/reflist.c $(am__append_4)
@HAVE_GTK_TRUE@src_hdfsee_SOURCES = src/hdfsee.c src/displaywindow.c src/render.c \
@HAVE_GTK_TRUE@ src/hdf5-file.c src/utils.c src/image.c src/filters.c \
@HAVE_GTK_TRUE@ src/thread-pool.c
@HAVE_GTK_TRUE@ src/thread-pool.c src/detector.c
@HAVE_GTK_TRUE@src_geomatic_SOURCES = src/geomatic.c src/dw-geomatic.c src/render.c \
@HAVE_GTK_TRUE@ src/hdf5-file.c src/utils.c src/image.c src/filters.c \
......
......@@ -23,6 +23,7 @@
<menu name="tools" action="ToolsAction">
<menuitem name="numbers" action="NumbersAction" />
<menuitem name="peaks" action="PeaksAction" />
<menuitem name="geometry" action="LoadGeomAction" />
</menu>
<menu name="help" action="HelpAction">
......
......@@ -532,6 +532,65 @@ static gint displaywindow_about(GtkWidget *widget, DisplayWindow *dw)
}
static int load_geometry_file(DisplayWindow *dw, struct image *image,
const char *filename)
{
struct detector *geom;
geom = get_detector_geometry(filename);
if ( geom == NULL ) return -1;
if ( image->det != NULL ) free_detector_geometry(image->det);
image->det = geom;
return 0;
}
static gint displaywindow_loadgeom_response(GtkWidget *d, gint response,
DisplayWindow *dw)
{
if ( response == GTK_RESPONSE_ACCEPT ) {
char *filename;
filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(d));
if ( load_geometry_file(dw, dw->image, filename) == 0 ) {
displaywindow_update(dw);
} else {
displaywindow_error(dw, "Failed to load geometry file");
}
g_free(filename);
}
gtk_widget_destroy(d);
return 0;
}
static gint displaywindow_load_geom(GtkWidget *widget, DisplayWindow *dw)
{
GtkWidget *d;
d = gtk_file_chooser_dialog_new("Load Geometry File",
GTK_WINDOW(dw->window),
GTK_FILE_CHOOSER_ACTION_OPEN,
GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
g_signal_connect(G_OBJECT(d), "response",
G_CALLBACK(displaywindow_loadgeom_response), dw);
gtk_widget_show_all(d);
return 0;
}
static gint displaywindow_peak_overlay(GtkWidget *widget, DisplayWindow *dw)
{
GtkWidget *d;
......@@ -552,6 +611,14 @@ static gint displaywindow_peak_overlay(GtkWidget *widget, DisplayWindow *dw)
}
static gint displaywindow_set_usegeom(GtkWidget *d, gint response,
DisplayWindow *dw)
{
return 0;
}
struct savedialog {
DisplayWindow *dw;
GtkWidget *cb;
......@@ -850,12 +917,16 @@ static void displaywindow_addmenubar(DisplayWindow *dw, GtkWidget *vbox,
G_CALLBACK(displaywindow_set_binning) },
{ "BoostIntAction", NULL, "Boost Intensity...", "F5", NULL,
G_CALLBACK(displaywindow_set_boostint) },
{ "GeometryAction", NULL, "Use Detector Geometry", NULL, NULL,
G_CALLBACK(displaywindow_set_usegeom) },
{ "ToolsAction", NULL, "_Tools", NULL, NULL, NULL },
{ "NumbersAction", NULL, "View Numbers...", "F2", NULL,
G_CALLBACK(displaywindow_show_numbers) },
{ "PeaksAction", NULL, "Peak Position Overlay...", NULL, NULL,
G_CALLBACK(displaywindow_peak_overlay) },
{ "LoadGeomAction", NULL, "Load Geometry File...", NULL, NULL,
G_CALLBACK(displaywindow_load_geom) },
{ "HelpAction", NULL, "_Help", NULL, NULL, NULL },
{ "AboutAction", GTK_STOCK_ABOUT, "_About hdfsee...",
......
......@@ -51,6 +51,7 @@ static void show_help(const char *s)
" -yellow-white.\n"
" -e, --image=<element> Start up displaying this image from the\n"
" HDF5 file. Example: /data/data0.\n"
" -g, --geometry=<filename> Use geometry from file for display.\n"
"\n");
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment