aboutsummaryrefslogtreecommitdiff
path: root/src/displaywindow.c
diff options
context:
space:
mode:
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);
+ }
+
+}
+