aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2017-11-14 15:16:17 +0100
committerThomas White <taw@physics.org>2017-11-14 15:16:17 +0100
commit4aec51c0b83598e05e802aee1da7068751072d8c (patch)
tree027b35bb3753e908a807a2c4f339412fa27ec44d
parent28e15e49cf211d2e853003b90e82ff98352bcde9 (diff)
hdfsee: Use a/b keys to change ring size
-rw-r--r--src/dw-hdfsee.c79
1 files changed, 52 insertions, 27 deletions
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c
index 6a1d3344..6687c304 100644
--- a/src/dw-hdfsee.c
+++ b/src/dw-hdfsee.c
@@ -2780,47 +2780,72 @@ static void calibmode_right(DisplayWindow *dw)
}
+static void change_ring(DisplayWindow *dw, double inc)
+{
+ if ( dw->n_rings < 1 ) return;
+ if ( dw->n_rings == 1 ) {
+ dw->ring_radii[0] += inc;
+ STATUS("Ring radius = %.1f px\n", dw->ring_radii[0]);
+ } else {
+ dw->ring_radii[1] += inc;
+ STATUS("Ring radius = %.1f px\n", dw->ring_radii[1]);
+ }
+}
+
+
static gint displaywindow_keypress(GtkWidget *widget, GdkEventKey *event,
DisplayWindow *dw)
{
+ if ( dw->calib_mode ) {
- if ( !dw->calib_mode ) {
- return 0;
- }
+ switch ( event->keyval ) {
- switch ( event->keyval ) {
+ case GDK_Up:
+ case GDK_KP_Up:
+ calibmode_up(dw);
+ redraw_window(dw);
+ break;
- case GDK_Up:
- case GDK_KP_Up:
- calibmode_up(dw);
- redraw_window(dw);
- break;
+ case GDK_Down:
+ case GDK_KP_Down:
+ calibmode_down(dw);
+ redraw_window(dw);
+ break;
- case GDK_Down:
- case GDK_KP_Down:
- calibmode_down(dw);
- redraw_window(dw);
- break;
+ case GDK_Left:
+ case GDK_KP_Left:
+ calibmode_left(dw);
+ redraw_window(dw);
+ break;
- case GDK_Left:
- case GDK_KP_Left:
- calibmode_left(dw);
- redraw_window(dw);
- break;
+ case GDK_Right:
+ case GDK_KP_Right:
+ calibmode_right(dw);
+ redraw_window(dw); break;
+
+ case GDK_KP_Add:
+ calibmode_next(NULL, dw);
+ break;
+
+ case GDK_KP_Subtract:
+ calibmode_prev(NULL, dw);
+ break;
+ }
- case GDK_Right:
- case GDK_KP_Right:
- calibmode_right(dw);
+ }
+
+ switch ( event->keyval ) {
+
+ case GDK_KEY_a:
+ change_ring(dw, +1.0);
redraw_window(dw);
break;
- case GDK_KP_Add:
- calibmode_next(NULL, dw);
+ case GDK_KEY_b:
+ change_ring(dw, -1.0);
+ redraw_window(dw);
break;
- case GDK_KP_Subtract:
- calibmode_prev(NULL, dw);
- break;
}
return 0;