aboutsummaryrefslogtreecommitdiff
path: root/src/displaywindow.c
diff options
context:
space:
mode:
authortaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-02 17:17:45 +0000
committertaw27 <taw27@bf6ca9ba-c028-0410-8290-897cf20841d1>2007-10-02 17:17:45 +0000
commit80828d43d4959122c549be8e44b26815bdb61519 (patch)
tree02edf84522e8bdfa095ec822ca25c6b9dcd34102 /src/displaywindow.c
parent21741980a3499e6d5ef44f27f2ae1d63a51152c7 (diff)
Further DirAx improvements
git-svn-id: svn://cook.msm.cam.ac.uk:745/diff-tomo/dtr@142 bf6ca9ba-c028-0410-8290-897cf20841d1
Diffstat (limited to 'src/displaywindow.c')
-rw-r--r--src/displaywindow.c28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/displaywindow.c b/src/displaywindow.c
index 1d3eb20..8899e0b 100644
--- a/src/displaywindow.c
+++ b/src/displaywindow.c
@@ -79,6 +79,10 @@ static void displaywindow_dirax(GtkWidget *widget, DisplayWindow *dw) {
dirax_invoke(dw->ctx);
}
+static void displaywindow_dirax_stop(GtkWidget *widget, DisplayWindow *dw) {
+ dirax_stop(dw->ctx);
+}
+
static void displaywindow_gl_set_ortho(DisplayWindow *dw, GLfloat w, GLfloat h) {
glMatrixMode(GL_PROJECTION);
@@ -173,7 +177,8 @@ static void displaywindow_addmenubar(DisplayWindow *dw) {
{ "ViewAction", NULL, "_View", NULL, NULL, NULL },
{ "ToolsAction", NULL, "_Tools", NULL, NULL, NULL },
- { "DirAxAction", GTK_STOCK_EXECUTE, "Invoke _DirAx", "<Ctrl>D", NULL, G_CALLBACK(displaywindow_dirax) },
+ { "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) },
{ "HelpAction", NULL, "_Help", NULL, NULL, NULL },
{ "AboutAction", GTK_STOCK_ABOUT, "_About DTR...", NULL, NULL, G_CALLBACK(displaywindow_about) },
@@ -912,6 +917,8 @@ DisplayWindow *displaywindow_open(ControlContext *ctx) {
g_signal_connect(GTK_OBJECT(dw->drawing_area), "button_press_event", G_CALLBACK(displaywindow_gl_button_press), dw);
g_signal_connect(GTK_OBJECT(dw->drawing_area), "motion_notify_event", G_CALLBACK(displaywindow_gl_motion_notify), dw);
+ displaywindow_update_dirax(ctx, dw);
+
gtk_widget_show_all(dw->window);
return dw;
@@ -924,3 +931,22 @@ void displaywindow_update(DisplayWindow *dw) {
gdk_window_invalidate_rect(dw->drawing_area->window, &dw->drawing_area->allocation, FALSE);
}
+/* Update the disabling of the menu for DirAx functions */
+void displaywindow_update_dirax(ControlContext *ctx, DisplayWindow *dw) {
+
+ GtkWidget *start;
+ GtkWidget *stop;
+
+ start = gtk_ui_manager_get_widget(dw->ui, "/ui/displaywindow/tools/dirax");
+ stop = gtk_ui_manager_get_widget(dw->ui, "/ui/displaywindow/tools/diraxstop");
+
+ if ( ctx->dirax ) {
+ gtk_widget_set_sensitive(GTK_WIDGET(start), FALSE);
+ gtk_widget_set_sensitive(GTK_WIDGET(stop), TRUE);
+ } else {
+ gtk_widget_set_sensitive(GTK_WIDGET(start), TRUE);
+ gtk_widget_set_sensitive(GTK_WIDGET(stop), FALSE);
+ }
+
+}
+