diff options
Diffstat (limited to 'src/displaywindow.c')
-rw-r--r-- | src/displaywindow.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c index 8e99411..5d4a8c2 100644 --- a/src/displaywindow.c +++ b/src/displaywindow.c @@ -33,6 +33,7 @@ #include "basis.h" #include "dirax.h" #include "reproject.h" +#include "cache.h" enum { DW_ORTHO, @@ -275,8 +276,6 @@ static void displaywindow_gl_create_list(DisplayWindow *dw) { dw->gl_ref_vertex_array = vertices; dw->gl_ref_normal_array = normals; } - } else { - printf("Drawing no 'measured' reflections\n"); } /* Marker "reflections" */ @@ -848,6 +847,35 @@ static gint displaywindow_changelines(GtkWidget *widget, DisplayWindow *dw) { return 0; } +static gint displaywindow_savecache_response(GtkWidget *widget, gint response, ControlContext *ctx) { + + if ( response == GTK_RESPONSE_ACCEPT ) { + char *cache_filename; + cache_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(widget)); + cache_save(ctx->reflectionlist, cache_filename); + g_free(cache_filename); + } + + gtk_widget_destroy(widget); + + return 0; + +} + +static gint displaywindow_savecache(GtkWidget *widget, DisplayWindow *dw) { + + dw->savecache_window = gtk_file_chooser_dialog_new("Save Reflections to Cache", GTK_WINDOW(dw->window), + GTK_FILE_CHOOSER_ACTION_SAVE, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + g_signal_connect(G_OBJECT(dw->savecache_window), "response", G_CALLBACK(displaywindow_savecache_response), dw->ctx); + gtk_widget_show_all(dw->savecache_window); + + return 0; + +} + static void displaywindow_addmenubar(DisplayWindow *dw) { GtkActionEntry entries[] = { @@ -859,8 +887,9 @@ static void displaywindow_addmenubar(DisplayWindow *dw) { { "ToolsAction", NULL, "_Tools", NULL, NULL, NULL }, { "DirAxAction", GTK_STOCK_EXECUTE, "Start _DirAx", "<Ctrl>D", NULL, G_CALLBACK(displaywindow_dirax) }, - { "StopDirAxAction", GTK_STOCK_CLOSE, "Stop DirAx", "<Ctrl>D", NULL, G_CALLBACK(displaywindow_dirax_stop) }, - { "ReprojectAction", NULL, "_Reproject Diffraction Patterns", "<Ctrl>R", NULL, G_CALLBACK(displaywindow_reproject) }, + { "StopDirAxAction", GTK_STOCK_CLOSE, "Stop DirAx", NULL, NULL, G_CALLBACK(displaywindow_dirax_stop) }, + { "ReprojectAction", NULL, "_Reproject Diffraction Patterns", NULL, NULL, G_CALLBACK(displaywindow_reproject) }, + { "SaveCacheAction", NULL, "Save Reflections to _Cache", NULL, NULL, G_CALLBACK(displaywindow_savecache) }, { "HelpAction", NULL, "_Help", NULL, NULL, NULL }, { "AboutAction", GTK_STOCK_ABOUT, "_About DTR...", NULL, NULL, G_CALLBACK(displaywindow_about) }, @@ -873,8 +902,8 @@ static void displaywindow_addmenubar(DisplayWindow *dw) { }; guint n_radios = G_N_ELEMENTS(radios); GtkToggleActionEntry toggles[] = { - { "CubeAction", NULL, "Show 100 nm^-1 _Cube", "<Ctrl>C", NULL, G_CALLBACK(displaywindow_changecube), dw->cube }, - { "LinesAction", NULL, "Show Indexing Lines", "<Ctrl>L", NULL, G_CALLBACK(displaywindow_changelines), dw->lines }, + { "CubeAction", NULL, "Show 100 nm^-1 _Cube", NULL, NULL, G_CALLBACK(displaywindow_changecube), dw->cube }, + { "LinesAction", NULL, "Show Indexing Lines", NULL, NULL, G_CALLBACK(displaywindow_changelines), dw->lines }, }; guint n_toggles = G_N_ELEMENTS(toggles); |