aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2010-01-08 13:56:49 +0100
committerThomas White <taw@physics.org>2010-01-08 13:56:49 +0100
commitc2244a71c1f15ef2c8bf333de71d1d033f04c896 (patch)
tree7661be5a8da2df03c91591da55651dbdef57d747
parent9f9b025f888e2d635f4211bf7dcfc79b98a214e0 (diff)
Initial peak overlay stuff
-rw-r--r--data/displaywindow.ui1
-rw-r--r--src/displaywindow.c43
-rw-r--r--src/indexamajig.c1
3 files changed, 45 insertions, 0 deletions
diff --git a/data/displaywindow.ui b/data/displaywindow.ui
index 8097d706..a435c754 100644
--- a/data/displaywindow.ui
+++ b/data/displaywindow.ui
@@ -16,6 +16,7 @@
<menu name="tools" action="ToolsAction">
<menuitem name="numbers" action="NumbersAction" />
+ <menuitem name="peaks" action="PeaksAction" />
</menu>
<menu name="help" action="HelpAction">
diff --git a/src/displaywindow.c b/src/displaywindow.c
index 49c094ec..ebcaddd6 100644
--- a/src/displaywindow.c
+++ b/src/displaywindow.c
@@ -399,6 +399,27 @@ static gint displaywindow_set_boostint(GtkWidget *widget, DisplayWindow *dw)
}
+static gint displaywindow_peaklist_response(GtkWidget *d, gint response,
+ DisplayWindow *dw)
+{
+ if ( response == GTK_RESPONSE_ACCEPT ) {
+
+ char *filename;
+
+ filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(d));
+
+ load_features_from_file(dw->image);
+
+ g_free(filename);
+
+ }
+
+ gtk_widget_destroy(d);
+
+ return 0;
+}
+
+
static gint displaywindow_about(GtkWidget *widget, DisplayWindow *dw)
{
GtkWidget *window;
@@ -435,6 +456,26 @@ static gint displaywindow_about(GtkWidget *widget, DisplayWindow *dw)
}
+static gint displaywindow_peak_overlay(GtkWidget *widget, DisplayWindow *dw)
+{
+ GtkWidget *d;
+
+ d = gtk_file_chooser_dialog_new("Choose Peak List",
+ 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_peaklist_response), dw);
+
+ gtk_widget_show_all(d);
+
+ return 0;
+}
+
+
static gint displaywindow_set_colscale(GtkWidget *widget, DisplayWindow *dw)
{
dw->show_col_scale = 1 - dw->show_col_scale;
@@ -592,6 +633,8 @@ static void displaywindow_addmenubar(DisplayWindow *dw, GtkWidget *vbox)
{ "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) },
{ "HelpAction", NULL, "_Help", NULL, NULL, NULL },
{ "AboutAction", GTK_STOCK_ABOUT, "_About hdfsee...",
diff --git a/src/indexamajig.c b/src/indexamajig.c
index 76ed6ed6..952433dd 100644
--- a/src/indexamajig.c
+++ b/src/indexamajig.c
@@ -176,6 +176,7 @@ static int image_fom(struct image *image)
n_valid = 0;
for ( i=0; i<n_peaks; i++ ) {
if ( peaks[i].invalid ) continue;
+ printf("%i %i\n", peaks[i].x, peaks[i].y);
n_valid++;
}