static void left_drag(int dy, int y, GdkModifierType state) { scope_disp_t *disp = &(ctrl_usr->disp); scope_vert_t *vert = &(ctrl_usr->vert); scope_chan_t *chan = &(ctrl_usr->chan[vert->selected - 1]); if(vert->selected == -1) return; if(disp->selected_part == 2 || (state & GDK_CONTROL_MASK)) { double new_position = snap(y); set_trigger_level(new_position); } else if(disp->selected_part == 1 || (state & GDK_SHIFT_MASK)) { double new_position = snap(y); set_vert_pos(new_position); // chan->position = new_position; refresh_display(); motion_y = y; } else { if(abs(dy) > 5) { int direction = dy > 0 ? 1 : -1; int baseline_y = chan->position * disp-> height; int side = select_y > baseline_y ? -1 : 1; set_vert_scale(chan->scale_index + direction * side); motion_y = y; } } }
static char *vpos_cmd(void * arg) { double *argp; int rv; argp = (double *)(arg); rv = set_vert_pos(*argp); if ( rv < 0 ) { return "could not set vertical position"; } return NULL; }
static void pos_changed(GtkAdjustment * adj, gpointer gdata) { set_vert_pos(adj->value / VERT_POS_RESOLUTION); }