[xiph-commits] r12008 - trunk/sushivision
xiphmont at svn.xiph.org
xiphmont at svn.xiph.org
Fri Nov 3 23:17:09 PST 2006
Author: xiphmont
Date: 2006-11-03 23:17:08 -0800 (Fri, 03 Nov 2006)
New Revision: 12008
Modified:
trunk/sushivision/panel-2d.c
trunk/sushivision/plot.c
Log:
fix box undo bug where box undo goes active->inactive
Modified: trunk/sushivision/panel-2d.c
===================================================================
--- trunk/sushivision/panel-2d.c 2006-11-04 06:18:45 UTC (rev 12007)
+++ trunk/sushivision/panel-2d.c 2006-11-04 07:17:08 UTC (rev 12008)
@@ -633,6 +633,7 @@
slider_set_value(p2->dim_scales[i],1,x);
if(d == p2->y_d)
slider_set_value(p2->dim_scales[i],1,y);
+ p2->oldbox_active = 0;
}
panel2d_undo_resume(p);
}
@@ -642,21 +643,24 @@
sushiv_panel2d_t *p2 = (sushiv_panel2d_t *)p->internal;
Plot *plot = PLOT(p2->graph);
- // zoom current dimensions to box
- panel2d_undo_push(p);
- panel2d_undo_suspend(p);
-
- if(state == 0){
+
+ switch(state){
+ case 0: // box set
+ panel2d_undo_push(p);
plot_box_vals(plot,p2->oldbox);
p2->oldbox_active = plot->box_active;
- }else{ // click, not just create
+ break;
+ case 1: // box activate
+ panel2d_undo_push(p);
+ panel2d_undo_suspend(p);
slider_set_value(p2->x_scale,0,p2->oldbox[0]);
slider_set_value(p2->x_scale,2,p2->oldbox[1]);
slider_set_value(p2->y_scale,0,p2->oldbox[2]);
slider_set_value(p2->y_scale,2,p2->oldbox[3]);
+ p2->oldbox_active = 0;
+ panel2d_undo_resume(p);
+ break;
}
- panel2d_undo_resume(p);
-
}
// called from one/all of the worker threads; the idea is that several
@@ -903,10 +907,13 @@
update_xy_availability(p);
- if(u->box_active)
+ if(u->box_active){
plot_box_set(plot,u->box);
- else
+ p2->oldbox_active = 1;
+ }else{
plot_unset_box(plot);
+ p2->oldbox_active = 0;
+ }
if(recomp_flag)
_mark_recompute_2d(p);
Modified: trunk/sushivision/plot.c
===================================================================
--- trunk/sushivision/plot.c 2006-11-04 06:18:45 UTC (rev 12007)
+++ trunk/sushivision/plot.c 2006-11-04 07:17:08 UTC (rev 12008)
@@ -23,6 +23,7 @@
#include <gtk/gtk.h>
#include <gtk/gtkmain.h>
#include <gdk/gdk.h>
+#include <gdk/gdkkeysyms.h>
#include <stdlib.h>
#include <math.h>
#include <stdio.h>
@@ -291,6 +292,41 @@
requisition->height = 200; // XXX
}
+static gboolean key_press(GtkWidget *widget,
+ GdkEventKey *event){
+ Plot *p = PLOT(widget);
+
+ fprintf(stderr,"KEY");
+ int shift = (event->state&GDK_SHIFT_MASK);
+ if(event->state&GDK_MOD1_MASK) return FALSE;
+ if(event->state&GDK_CONTROL_MASK)return FALSE;
+
+ /* non-control keypresses */
+ switch(event->keyval){
+
+ case GDK_Return:
+ // if box is active, effect it
+ if(p->box_active){
+
+ if(p->box_callback)
+ p->box_callback(p->cross_data,1);
+
+ p->button_down=0;
+ p->box_active=0;
+ }
+ return TRUE;
+
+ case GDK_Left:
+ case GDK_Right:
+ case GDK_Up:
+ case GDK_Down:
+ break;
+ }
+
+
+ return FALSE;
+}
+
static void plot_realize (GtkWidget *widget){
GdkWindowAttr attributes;
gint attributes_mask;
@@ -506,6 +542,7 @@
widget_class->motion_notify_event = mouse_motion;
widget_class->enter_notify_event = plot_enter;
widget_class->leave_notify_event = plot_leave;
+ widget_class->key_press_event = key_press;
}
More information about the commits
mailing list