[xiph-commits] r12608 - trunk/sushivision

xiphmont at svn.xiph.org xiphmont at svn.xiph.org
Fri Mar 2 11:51:39 PST 2007


Author: xiphmont
Date: 2007-03-02 11:51:35 -0800 (Fri, 02 Mar 2007)
New Revision: 12608

Modified:
   trunk/sushivision/dimension.c
   trunk/sushivision/internal.h
   trunk/sushivision/panel-1d.c
   trunk/sushivision/panel-2d.c
   trunk/sushivision/panel.c
   trunk/sushivision/plot.c
   trunk/sushivision/plot.h
   trunk/sushivision/sushi-gtkrc.in
   trunk/sushivision/undo.c
Log:
More text size changes to default built in gtkrc

Set miter limits on text shadow rendering

implement undo on menu-based plot configurations



Modified: trunk/sushivision/dimension.c
===================================================================
--- trunk/sushivision/dimension.c	2007-03-02 17:30:04 UTC (rev 12607)
+++ trunk/sushivision/dimension.c	2007-03-02 19:51:35 UTC (rev 12608)
@@ -235,8 +235,8 @@
     dw->center_updating = 1;
     
     if(buttonstate == 0){
-      _sushiv_panel_undo_push(p);
-      _sushiv_panel_undo_suspend(p);
+      _sushiv_undo_push(p->sushi);
+      _sushiv_undo_suspend(p->sushi);
     }
     
     if(d->val != val){
@@ -259,7 +259,7 @@
     }
     
     if(buttonstate == 2)
-      _sushiv_panel_undo_resume(p);
+      _sushiv_undo_resume(p->sushi);
 
     snprintf(buffer,80,"%.10g",d->bracket[0]);
     gtk_entry_set_text(GTK_ENTRY(dw->entry[0]),buffer);
@@ -291,8 +291,8 @@
     dw->bracket_updating = 1;
     
     if(buttonstate == 0){
-      _sushiv_panel_undo_push(p);
-      _sushiv_panel_undo_suspend(p);
+      _sushiv_undo_push(p->sushi);
+      _sushiv_undo_suspend(p->sushi);
     }
 
     if(d->bracket[0] != lo || d->bracket[1] != hi){
@@ -318,7 +318,7 @@
     }
     
     if(buttonstate == 2)
-      _sushiv_panel_undo_resume(p);
+      _sushiv_undo_resume(p->sushi);
     
     snprintf(buffer,80,"%.10g",d->bracket[0]);
     gtk_entry_set_text(GTK_ENTRY(dw->entry[0]),buffer);
@@ -345,8 +345,8 @@
  
     dw->center_updating = 1;
     
-    _sushiv_panel_undo_push(p);
-    _sushiv_panel_undo_suspend(p);
+    _sushiv_undo_push(p->sushi);
+    _sushiv_undo_suspend(p->sushi);
     
     if(d->val != val){
       int i;
@@ -368,7 +368,7 @@
 	w->center_callback(dw->dl);
       }
     }
-    _sushiv_panel_undo_resume(p);
+    _sushiv_undo_resume(p->sushi);
     
     dw->center_updating = 0;
   }

Modified: trunk/sushivision/internal.h
===================================================================
--- trunk/sushivision/internal.h	2007-03-02 17:30:04 UTC (rev 12607)
+++ trunk/sushivision/internal.h	2007-03-02 19:51:35 UTC (rev 12608)
@@ -54,6 +54,16 @@
 
   double box[4];
   int box_active;
+
+  int grid_mode;
+  unsigned char cross_mode;
+  unsigned char legend_mode;
+  unsigned char bg_mode;
+  unsigned char text_mode;
+  unsigned char menu_cursamp;
+  int oversample_n;
+  int oversample_d;
+
 } sushiv_panel_undo_t;
 
 typedef union {
@@ -92,12 +102,12 @@
 
   time_t last_map_throttle;
 
+  int menu_cursamp;
   int oversample_n;
   int oversample_d;
   int def_oversample_n;
   int def_oversample_d;
 
-  int menu_cursamp;
 
   // function bundles 
   void (*realize)(sushiv_panel_t *p);
@@ -139,14 +149,17 @@
 extern void _sushiv_panel_clean_legend(sushiv_panel_t *p);
 extern void _sushiv_panel_clean_plot(sushiv_panel_t *p);
 
-extern void _sushiv_panel_undo_log(sushiv_panel_t *p);
-extern void _sushiv_panel_undo_push(sushiv_panel_t *p);
-extern void _sushiv_panel_undo_suspend(sushiv_panel_t *p);
-extern void _sushiv_panel_undo_resume(sushiv_panel_t *p);
-extern void _sushiv_panel_undo_restore(sushiv_panel_t *p);
-extern void _sushiv_panel_undo_up(sushiv_panel_t *p);
-extern void _sushiv_panel_undo_down(sushiv_panel_t *p);
+extern void _sushiv_undo_log(sushiv_instance_t *s);
+extern void _sushiv_undo_push(sushiv_instance_t *s);
+extern void _sushiv_undo_suspend(sushiv_instance_t *s);
+extern void _sushiv_undo_resume(sushiv_instance_t *s);
+extern void _sushiv_undo_restore(sushiv_instance_t *s);
+extern void _sushiv_undo_up(sushiv_instance_t *s);
+extern void _sushiv_undo_down(sushiv_instance_t *s);
 
+extern void _sushiv_panel_undo_log(sushiv_panel_t *p, sushiv_panel_undo_t *u);
+extern void _sushiv_panel_undo_restore(sushiv_panel_t *p, sushiv_panel_undo_t *u);
+
 extern void _sushiv_panel1d_mark_recompute_linked(sushiv_panel_t *p); 
 extern void _sushiv_panel1d_update_linked_crosshairs(sushiv_panel_t *p, int xflag, int yflag); 
 extern void _sushiv_panel_update_menus(sushiv_panel_t *p);

Modified: trunk/sushivision/panel-1d.c
===================================================================
--- trunk/sushivision/panel-1d.c	2007-03-02 17:30:04 UTC (rev 12607)
+++ trunk/sushivision/panel-1d.c	2007-03-02 19:51:35 UTC (rev 12608)
@@ -458,8 +458,8 @@
   sushiv_panel1d_t *p1 = p->subtype->p1;
   int onum = optr - p->objective_list;
   
-  _sushiv_panel_undo_push(p);
-  _sushiv_panel_undo_suspend(p);
+  _sushiv_undo_push(p->sushi);
+  _sushiv_undo_suspend(p->sushi);
 
   // update colormap
   // oh, the wasteful
@@ -469,7 +469,7 @@
   
   _sushiv_panel_dirty_map(p);
   _sushiv_panel_dirty_legend(p);
-  _sushiv_panel_undo_resume(p);
+  _sushiv_undo_resume(p->sushi);
 }
 
 static void alpha_callback_1d(void * in, int buttonstate){
@@ -479,15 +479,15 @@
   //  int onum = optr - p->objective_list;
 
   if(buttonstate == 0){
-    _sushiv_panel_undo_push(p);
-    _sushiv_panel_undo_suspend(p);
+    _sushiv_undo_push(p->sushi);
+    _sushiv_undo_suspend(p->sushi);
   }
 
   _sushiv_panel_dirty_map(p);
   _sushiv_panel_dirty_legend(p);
 
   if(buttonstate == 2)
-    _sushiv_panel_undo_resume(p);
+    _sushiv_undo_resume(p->sushi);
 }
 
 static void linetype_callback_1d(GtkWidget *w,gpointer in){
@@ -496,14 +496,14 @@
   sushiv_panel1d_t *p1 = p->subtype->p1;
   int onum = optr - p->objective_list;
   
-  _sushiv_panel_undo_push(p);
-  _sushiv_panel_undo_suspend(p);
+  _sushiv_undo_push(p->sushi);
+  _sushiv_undo_suspend(p->sushi);
 
   // update colormap
   p1->linetype[onum]=gtk_combo_box_get_active(GTK_COMBO_BOX(w));
 
   _sushiv_panel_dirty_map(p);
-  _sushiv_panel_undo_resume(p);
+  _sushiv_undo_resume(p->sushi);
 }
 
 static void pointtype_callback_1d(GtkWidget *w,gpointer in){
@@ -512,14 +512,14 @@
   sushiv_panel1d_t *p1 = p->subtype->p1;
   int onum = optr - p->objective_list;
   
-  _sushiv_panel_undo_push(p);
-  _sushiv_panel_undo_suspend(p);
+  _sushiv_undo_push(p->sushi);
+  _sushiv_undo_suspend(p->sushi);
 
   // update colormap
   p1->pointtype[onum]=gtk_combo_box_get_active(GTK_COMBO_BOX(w));
 
   _sushiv_panel_dirty_map(p);
-  _sushiv_panel_undo_resume(p);
+  _sushiv_undo_resume(p->sushi);
 }
 
 static void map_callback_1d(void *in,int buttonstate){
@@ -528,8 +528,8 @@
   Plot *plot = PLOT(p->private->graph);
   
   if(buttonstate == 0){
-    _sushiv_panel_undo_push(p);
-    _sushiv_panel_undo_suspend(p);
+    _sushiv_undo_push(p->sushi);
+    _sushiv_undo_suspend(p->sushi);
   }
 
   // has new bracketing changed the plot range scale?
@@ -561,7 +561,7 @@
   //redraw the plot
   _sushiv_panel_dirty_map(p);
   if(buttonstate == 2)
-    _sushiv_panel_undo_resume(p);
+    _sushiv_undo_resume(p->sushi);
 }
 
 static void update_x_sel(sushiv_panel_t *p){
@@ -872,15 +872,15 @@
 
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))){
 
-    _sushiv_panel_undo_push(p);
-    _sushiv_panel_undo_suspend(p);
+    _sushiv_undo_push(p->sushi);
+    _sushiv_undo_suspend(p->sushi);
 
     update_x_sel(p);
     update_crosshair(p);
     plot_unset_box(PLOT(p->private->graph));
     _mark_recompute_1d(p);
 
-    _sushiv_panel_undo_resume(p);
+    _sushiv_undo_resume(p->sushi);
   }
 }
 
@@ -911,8 +911,8 @@
     link->private->crosshair_action(link);
   }else{
 
-    _sushiv_panel_undo_push(p);
-    _sushiv_panel_undo_suspend(p);
+    _sushiv_undo_push(p->sushi);
+    _sushiv_undo_suspend(p->sushi);
 
     for(i=0;i<p->dimensions;i++){
       sushiv_dimension_t *d = p->dimension_list[i].d;
@@ -922,7 +922,7 @@
 	            
       p->private->oldbox_active = 0;
     }
-    _sushiv_panel_undo_resume(p);
+    _sushiv_undo_resume(p->sushi);
   }
 }
 
@@ -933,20 +933,20 @@
   
   switch(state){
   case 0: // box set
-    _sushiv_panel_undo_push(p);
+    _sushiv_undo_push(p->sushi);
     plot_box_vals(plot,p1->oldbox);
     p->private->oldbox_active = plot->box_active;
     break;
   case 1: // box activate
-    _sushiv_panel_undo_push(p);
-    _sushiv_panel_undo_suspend(p);
+    _sushiv_undo_push(p->sushi);
+    _sushiv_undo_suspend(p->sushi);
 
     crosshair_callback(p);
     
     _sushiv_dimension_set_value(p1->x_scale,0,p1->oldbox[0]);
     _sushiv_dimension_set_value(p1->x_scale,2,p1->oldbox[1]);
     p->private->oldbox_active = 0;
-    _sushiv_panel_undo_resume(p);
+    _sushiv_undo_resume(p->sushi);
     break;
   }
   _sushiv_panel_update_menus(p);
@@ -1205,7 +1205,7 @@
 void _sushiv_realize_panel1d(sushiv_panel_t *p){
   sushiv_panel1d_t *p1 = p->subtype->p1;
   int i;
-  _sushiv_panel_undo_suspend(p);
+  _sushiv_undo_suspend(p->sushi);
 
   p->private->toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   g_signal_connect_swapped (G_OBJECT (p->private->toplevel), "delete-event",
@@ -1425,7 +1425,7 @@
   gtk_widget_realize(GTK_WIDGET(p->private->spinner));
   gtk_widget_show_all(p->private->toplevel);
 
-  _sushiv_panel_undo_resume(p);
+  _sushiv_undo_resume(p->sushi);
 }
 
 int sushiv_new_panel_1d(sushiv_instance_t *s,

Modified: trunk/sushivision/panel-2d.c
===================================================================
--- trunk/sushivision/panel-2d.c	2007-03-02 17:30:04 UTC (rev 12607)
+++ trunk/sushivision/panel-2d.c	2007-03-02 19:51:35 UTC (rev 12608)
@@ -884,8 +884,8 @@
   sushiv_panel2d_t *p2 = p->subtype->p2;
   int onum = optr - p->objective_list;
 
-  _sushiv_panel_undo_push(p);
-  _sushiv_panel_undo_suspend(p);
+  _sushiv_undo_push(p->sushi);
+  _sushiv_undo_suspend(p->sushi);
 
   mapping_set_func(&p2->mappings[onum],gtk_combo_box_get_active(GTK_COMBO_BOX(w)));
   
@@ -899,7 +899,7 @@
   //redraw the plot
   _dirty_map_one_plane(p,onum,1,0,0);
   _sushiv_panel_dirty_map(p);
-  _sushiv_panel_undo_resume(p);
+  _sushiv_undo_resume(p->sushi);
 }
 
 static void map_callback_2d(void *in,int buttonstate){
@@ -910,8 +910,8 @@
   int onum = optr - p->objective_list;
 
   if(buttonstate == 0){
-    _sushiv_panel_undo_push(p);
-    _sushiv_panel_undo_suspend(p);
+    _sushiv_undo_push(p->sushi);
+    _sushiv_undo_suspend(p->sushi);
   }
 
   // recache alpha del */
@@ -925,7 +925,7 @@
     _sushiv_panel_dirty_map(p);
   }
   if(buttonstate == 2)
-    _sushiv_panel_undo_resume(p);
+    _sushiv_undo_resume(p->sushi);
 }
 
 static void update_xy_availability(sushiv_panel_t *p){
@@ -1216,8 +1216,8 @@
 
   if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button))){
 
-    _sushiv_panel_undo_push(p);
-    _sushiv_panel_undo_suspend(p);
+    _sushiv_undo_push(p->sushi);
+    _sushiv_undo_suspend(p->sushi);
 
     plot_unset_box(PLOT(p->private->graph));
     update_xy_availability(p);
@@ -1226,7 +1226,7 @@
     _mark_recompute_2d(p);
     update_crosshairs(p);
 
-    _sushiv_panel_undo_resume(p);
+    _sushiv_undo_resume(p->sushi);
   }
 }
 
@@ -1236,8 +1236,8 @@
   double y=PLOT(p->private->graph)->sely;
   int i;
   
-  _sushiv_panel_undo_push(p);
-  _sushiv_panel_undo_suspend(p);
+  _sushiv_undo_push(p->sushi);
+  _sushiv_undo_suspend(p->sushi);
 
   //plot_snap_crosshairs(PLOT(p->private->graph));
 
@@ -1262,7 +1262,7 @@
   plot_set_crosshairs(PLOT(p->private->graph),x,y);
 
   _sushiv_panel_dirty_legend(p);
-  _sushiv_panel_undo_resume(p);
+  _sushiv_undo_resume(p->sushi);
 }
 
 static void box_callback(void *in, int state){
@@ -1272,13 +1272,13 @@
   
   switch(state){
   case 0: // box set
-    _sushiv_panel_undo_push(p);
+    _sushiv_undo_push(p->sushi);
     plot_box_vals(plot,p2->oldbox);
     p->private->oldbox_active = plot->box_active;
     break;
   case 1: // box activate
-    _sushiv_panel_undo_push(p);
-    _sushiv_panel_undo_suspend(p);
+    _sushiv_undo_push(p->sushi);
+    _sushiv_undo_suspend(p->sushi);
 
     _sushiv_panel2d_crosshairs_callback(p);
 
@@ -1287,7 +1287,7 @@
     _sushiv_dimension_set_value(p2->y_scale,0,p2->oldbox[2]);
     _sushiv_dimension_set_value(p2->y_scale,2,p2->oldbox[3]);
     p->private->oldbox_active = 0;
-    _sushiv_panel_undo_resume(p);
+    _sushiv_undo_resume(p->sushi);
     break;
   }
   _sushiv_panel_update_menus(p);
@@ -1633,7 +1633,7 @@
   sushiv_panel2d_t *p2 = p->subtype->p2;
   int i;
 
-  _sushiv_panel_undo_suspend(p);
+  _sushiv_undo_suspend(p->sushi);
 
   p->private->toplevel = gtk_window_new (GTK_WINDOW_TOPLEVEL);
   g_signal_connect_swapped (G_OBJECT (p->private->toplevel), "delete-event",
@@ -1798,7 +1798,7 @@
 			     // insensitive buttons when it realized
 			     // them.  This call will restore them.
 
-  _sushiv_panel_undo_resume(p);
+  _sushiv_undo_resume(p->sushi);
 }
 
 int sushiv_new_panel_2d(sushiv_instance_t *s,

Modified: trunk/sushivision/panel.c
===================================================================
--- trunk/sushivision/panel.c	2007-03-02 17:30:04 UTC (rev 12607)
+++ trunk/sushivision/panel.c	2007-03-02 19:51:35 UTC (rev 12608)
@@ -70,68 +70,85 @@
   _sushiv_clean_exit(SIGINT);
 }
 
+// precipitated actions perform undo push
 static void wrap_enter(sushiv_panel_t *p){
   plot_do_enter(PLOT(p->private->graph));
 }
 
 static void wrap_escape(sushiv_panel_t *p){
-  plot_do_escape(PLOT(p->private->graph));
+  _sushiv_undo_push(p->sushi);
+  _sushiv_undo_suspend(p->sushi);
+
+  plot_set_crossactive(PLOT(p->private->graph),0);
   _sushiv_panel_dirty_legend(p);
+
+  _sushiv_undo_resume(p->sushi);
 }
 
 static void wrap_legend(sushiv_panel_t *p){
+  _sushiv_undo_push(p->sushi);
+  _sushiv_undo_suspend(p->sushi);
+
   plot_toggle_legend(PLOT(p->private->graph));
   _sushiv_panel_dirty_legend(p);
+
+  _sushiv_undo_resume(p->sushi);
 }
 
-static void light_scale(sushiv_panel_t *p){
-  plot_set_grid(PLOT(p->private->graph),PLOT_GRID_LIGHT);
+static void set_grid(sushiv_panel_t *p, int mode){
+  _sushiv_undo_push(p->sushi);
+  _sushiv_undo_suspend(p->sushi);
+
+  plot_set_grid(PLOT(p->private->graph),mode);
   _sushiv_panel_update_menus(p);
   refg_if_running(p);
+
+  _sushiv_undo_resume(p->sushi);
 }
+
+static void light_scale(sushiv_panel_t *p){
+  set_grid(p,PLOT_GRID_LIGHT);
+}
 static void mid_scale(sushiv_panel_t *p){
-  plot_set_grid(PLOT(p->private->graph),PLOT_GRID_NORMAL);
-  _sushiv_panel_update_menus(p);
-  refg_if_running(p);
+  set_grid(p,PLOT_GRID_NORMAL);
 }
 static void dark_scale(sushiv_panel_t *p){
-  plot_set_grid(PLOT(p->private->graph),PLOT_GRID_DARK);
-  _sushiv_panel_update_menus(p);
-  refg_if_running(p);
+  set_grid(p,PLOT_GRID_DARK);
 }
 static void tic_scale(sushiv_panel_t *p){
-  plot_set_grid(PLOT(p->private->graph),PLOT_GRID_TICS);
-  _sushiv_panel_update_menus(p);
-  refg_if_running(p);
+  set_grid(p,PLOT_GRID_TICS);
 }
 static void no_scale(sushiv_panel_t *p){
-  plot_set_grid(PLOT(p->private->graph),0);
-  _sushiv_panel_update_menus(p);
-  refg_if_running(p);
+  set_grid(p,0);
 }
 
-static int _sushiv_panel_background_i(sushiv_panel_t *p,
-				      enum sushiv_background bg){
+static int set_background(sushiv_panel_t *p,
+			  enum sushiv_background bg){
   
   sushiv_panel_internal_t *pi = p->private;
   
+  _sushiv_undo_push(p->sushi);
+  _sushiv_undo_suspend(p->sushi);
+
   pi->bg_type = bg;
   
   decide_text_inv(p);
   mid_scale(p);
   redraw_if_running(p);
   _sushiv_panel_update_menus(p);
+
+  _sushiv_undo_resume(p->sushi);
   return 0;
 }
 
 static void white_bg(sushiv_panel_t *p){
-  _sushiv_panel_background_i(p,SUSHIV_BG_WHITE);
+  set_background(p,SUSHIV_BG_WHITE);
 }
 static void black_bg(sushiv_panel_t *p){
-  _sushiv_panel_background_i(p,SUSHIV_BG_BLACK);
+  set_background(p,SUSHIV_BG_BLACK);
 }
 static void checked_bg(sushiv_panel_t *p){
-  _sushiv_panel_background_i(p,SUSHIV_BG_CHECKS);
+  set_background(p,SUSHIV_BG_CHECKS);
 }
 static void cycle_bg(sushiv_panel_t *p){
   switch(p->private->bg_type){
@@ -160,15 +177,22 @@
   }
 }
 
-static void black_text(sushiv_panel_t *p){
-  plot_set_bg_invert(PLOT(p->private->graph),0);
+static void set_text(sushiv_panel_t *p, int mode){
+  _sushiv_undo_push(p->sushi);
+  _sushiv_undo_suspend(p->sushi);
+
+  plot_set_bg_invert(PLOT(p->private->graph),mode);
   _sushiv_panel_update_menus(p);
   refg_if_running(p);
+
+  _sushiv_undo_resume(p->sushi);
 }
+
+static void black_text(sushiv_panel_t *p){
+  set_text(p,0);
+}
 static void white_text(sushiv_panel_t *p){
-  plot_set_bg_invert(PLOT(p->private->graph),1);
-  _sushiv_panel_update_menus(p);
-  refg_if_running(p);
+  set_text(p,1);
 }
 static void cycle_text(sushiv_panel_t *p){
   switch(PLOT(p->private->graph)->bg_inv){
@@ -220,51 +244,50 @@
   }
 }
 
-static void res_set(sushiv_panel_t *p, int n, int d){
+static void res_set(sushiv_panel_t *p, int n, int d, int menu){
   if(n != p->private->oversample_n ||
      d != p->private->oversample_d){
+
+    _sushiv_undo_push(p->sushi);
+    _sushiv_undo_suspend(p->sushi);
+    
+    p->private->menu_cursamp=menu;
     p->private->oversample_n = n;
     p->private->oversample_d = d;
     _sushiv_panel_update_menus(p);
     recompute_if_running(p);
+
+    _sushiv_undo_resume(p->sushi);
   }
 }
 
 static void res_def(sushiv_panel_t *p){
   p->private->menu_cursamp=0;
-  res_set(p,p->private->def_oversample_n,p->private->def_oversample_d);
+  res_set(p,p->private->def_oversample_n,p->private->def_oversample_d,0);
 }
 static void res_1_32(sushiv_panel_t *p){
-  p->private->menu_cursamp=1;
-  res_set(p,1,32);
+  res_set(p,1,32,1);
 }
 static void res_1_16(sushiv_panel_t *p){
-  p->private->menu_cursamp=2;
-  res_set(p,1,16);
+  res_set(p,1,16,2);
 }
 static void res_1_8(sushiv_panel_t *p){
-  p->private->menu_cursamp=3;
-  res_set(p,1,8);
+  res_set(p,1,8,3);
 }
 static void res_1_4(sushiv_panel_t *p){
-  p->private->menu_cursamp=4;
-  res_set(p,1,4);
+  res_set(p,1,4,4);
 }
 static void res_1_2(sushiv_panel_t *p){
-  p->private->menu_cursamp=5;
-  res_set(p,1,2);
+  res_set(p,1,2,5);
 }
 static void res_1_1(sushiv_panel_t *p){
-  p->private->menu_cursamp=6;
-  res_set(p,1,1);
+  res_set(p,1,1,6);
 }
 static void res_2_1(sushiv_panel_t *p){
-  p->private->menu_cursamp=7;
-  res_set(p,2,1);
+  res_set(p,2,1,7);
 }
 static void res_4_1(sushiv_panel_t *p){
-  p->private->menu_cursamp=8;
-  res_set(p,4,1);
+  res_set(p,4,1,8);
 }
 
 static void cycle_res(sushiv_panel_t *p){
@@ -293,7 +316,7 @@
   case 7:
     res_4_1(p);
     break;
-  case 8:
+  default:
     res_def(p);
     break;
   }
@@ -325,7 +348,7 @@
   case 0:
     res_4_1(p);
     break;
-  case 1:
+  default:
     res_def(p);
     break;
   }
@@ -388,6 +411,13 @@
   g_object_unref (op);
 }
 
+static void wrap_undo_down(sushiv_panel_t *p){
+  _sushiv_undo_down(p->sushi);
+}
+static void wrap_undo_up(sushiv_panel_t *p){
+  _sushiv_undo_up(p->sushi);
+}
+
 static menuitem *menu[]={
   &(menuitem){"Open","[<i>o</i>]",NULL,NULL},
   &(menuitem){"Save","[<i>s</i>]",NULL,NULL},
@@ -395,8 +425,8 @@
 
   &(menuitem){"",NULL,NULL,NULL},
 
-  &(menuitem){"Undo","[<i>bksp</i>]",NULL,&_sushiv_panel_undo_down},
-  &(menuitem){"Redo","[<i>space</i>]",NULL,&_sushiv_panel_undo_up},
+  &(menuitem){"Undo","[<i>bksp</i>]",NULL,&wrap_undo_down},
+  &(menuitem){"Redo","[<i>space</i>]",NULL,&wrap_undo_up},
   &(menuitem){"Start zoom box","[<i>enter</i>]",NULL,&wrap_enter},
   &(menuitem){"Clear selection","[<i>escape</i>]",NULL,&wrap_escape},
   &(menuitem){"Toggle Legend","[<i>l</i>]",NULL,&wrap_legend},
@@ -617,13 +647,13 @@
     
   case GDK_BackSpace:
     // undo 
-    _sushiv_panel_undo_down(p);
+    _sushiv_undo_down(p->sushi);
     return TRUE;
     
   case GDK_r:
   case GDK_space:
     // redo/forward
-    _sushiv_panel_undo_up(p);
+    _sushiv_undo_up(p->sushi);
     return TRUE;
 
   case GDK_p:
@@ -805,7 +835,7 @@
   }
   
   sushiv_panel_t *p = s->panel_list[number];
-  return _sushiv_panel_background_i(p,bg);
+  return set_background(p,bg);
 }
 
 int _sushiv_new_panel(sushiv_instance_t *s,
@@ -872,3 +902,30 @@
   return number;
 }
 
+void _sushiv_panel_undo_log(sushiv_panel_t *p, sushiv_panel_undo_t *u){
+  u->cross_mode = PLOT(p->private->graph)->cross_active;
+  u->legend_mode = PLOT(p->private->graph)->legend_active;
+  u->grid_mode = PLOT(p->private->graph)->grid_mode;
+  u->text_mode = PLOT(p->private->graph)->bg_inv;
+  u->bg_mode = p->private->bg_type;
+  u->menu_cursamp = p->private->menu_cursamp;
+  u->oversample_n = p->private->oversample_n;
+  u->oversample_d = p->private->oversample_d;
+
+  // panel-subtype-specific population
+  p->private->undo_log(u,p);
+}
+
+void _sushiv_panel_undo_restore(sushiv_panel_t *p, sushiv_panel_undo_t *u){
+  // go in through setting routines
+  plot_set_crossactive(PLOT(p->private->graph),u->cross_mode);
+  plot_set_legendactive(PLOT(p->private->graph),u->legend_mode);
+  set_background(p, u->bg_mode); // must be first; it can frob grid and test
+  set_text(p, u->text_mode);
+  set_grid(p, u->grid_mode);
+  res_set(p, u->oversample_n, u->oversample_d, u->menu_cursamp);
+
+  // panel-subtype-specific restore
+  p->private->undo_restore(u,p);
+  _sushiv_panel_dirty_legend(p); 
+}

Modified: trunk/sushivision/plot.c
===================================================================
--- trunk/sushivision/plot.c	2007-03-02 17:30:04 UTC (rev 12607)
+++ trunk/sushivision/plot.c	2007-03-02 19:51:35 UTC (rev 12608)
@@ -84,6 +84,8 @@
   int x_height=0;
   int off = (grid == PLOT_GRID_TICS?6:0);
 
+  cairo_set_miter_limit(c,2.);
+
   // draw all axis lines, then stroke
   if(grid){
 
@@ -143,7 +145,7 @@
       if(y - extents.height > 0){
 	
 	double yy = y+.5-(extents.height/2 + extents.y_bearing);
-	
+
 	cairo_move_to(c,2+off, yy);
 	set_shadow(inv_text,c);
 	cairo_text_path (c, buffer);  
@@ -278,6 +280,7 @@
 			    CAIRO_FONT_WEIGHT_NORMAL);
     cairo_set_font_size (c, 10);
     cairo_set_line_width(c,1);
+    cairo_set_miter_limit(c,2.);
     
     /* determine complete x/y extents of text */
     
@@ -862,11 +865,13 @@
   }
 }
 
-void plot_do_escape(Plot *p){
-  p->button_down=0;
-  p->box_active=0;
-  p->cross_active=0;
-  //plot_legend_clear(p);
+void plot_set_crossactive(Plot *p, int active){
+  if(!active){
+    p->button_down=0;
+    p->box_active=0;
+  }
+
+  p->cross_active=active;
   plot_draw_scales(p);
   plot_expose_request(p);
 }
@@ -878,6 +883,11 @@
   plot_expose_request(p);
 }
 
+void plot_set_legendactive(Plot *p, int active){
+  p->legend_active=active;
+  plot_expose_request(p);
+}
+
 static gboolean key_press(GtkWidget *widget,
 			  GdkEventKey *event){
   Plot *p = PLOT(widget);

Modified: trunk/sushivision/plot.h
===================================================================
--- trunk/sushivision/plot.h	2007-03-02 17:30:04 UTC (rev 12607)
+++ trunk/sushivision/plot.h	2007-03-02 19:51:35 UTC (rev 12608)
@@ -122,8 +122,9 @@
 void plot_set_grid(Plot *p, int mode);
 
 void plot_do_enter(Plot *p);
-void plot_do_escape(Plot *p);
+void plot_set_crossactive(Plot *p, int active);
 void plot_toggle_legend(Plot *p);
+void plot_set_legendactive(Plot *p, int active);
 
 void plot_resizable(Plot *p, int rp);
 

Modified: trunk/sushivision/sushi-gtkrc.in
===================================================================
--- trunk/sushivision/sushi-gtkrc.in	2007-03-02 17:30:04 UTC (rev 12607)
+++ trunk/sushivision/sushi-gtkrc.in	2007-03-02 19:51:35 UTC (rev 12608)
@@ -24,7 +24,7 @@
 	GtkWidget::interior_focus = 0 
 	GtkWidget::internal_padding = 0 
 
-	font_name = "sans"
+	font_name = "sans 8"
 }
 
 style "exp-poppy" {
@@ -54,7 +54,7 @@
 	GtkWidget::internal_padding = 0 
 	GtkExpander::expander_size = 14
 
-	font_name = "sans"
+	font_name = "sans 8"
 }
 
 style "slider-poppy" {
@@ -88,7 +88,7 @@
 	text[ACTIVE]="#000000"
 	text[PRELIGHT]="#000000" 
 
-	font_name = "sans"
+	font_name = "sans 7"
 }
 
 style "panel" {
@@ -101,7 +101,7 @@
 	text[ACTIVE]="#000000"
 	text[PRELIGHT]="#000000" 
 
-	font_name = "sans"
+	font_name = "sans 9"
 }
 
 style "panel-text" {

Modified: trunk/sushivision/undo.c
===================================================================
--- trunk/sushivision/undo.c	2007-03-02 17:30:04 UTC (rev 12607)
+++ trunk/sushivision/undo.c	2007-03-02 19:51:35 UTC (rev 12608)
@@ -37,24 +37,23 @@
   }
 }
 
-void _sushiv_panel_undo_suspend(sushiv_panel_t *p){
-  p->sushi->private->undo_suspend++;
+void _sushiv_undo_suspend(sushiv_instance_t *s){
+  s->private->undo_suspend++;
 }
 
-void _sushiv_panel_undo_resume(sushiv_panel_t *p){
-  p->sushi->private->undo_suspend--;
-  if(p->sushi->private->undo_suspend<0){
+void _sushiv_undo_resume(sushiv_instance_t *s){
+  s->private->undo_suspend--;
+  if(s->private->undo_suspend<0){
     fprintf(stderr,"Internal error: undo suspend refcount count < 0\n");
-    p->sushi->private->undo_suspend=0;
+    s->private->undo_suspend=0;
   }
 }
 
-void _sushiv_panel_undo_log(sushiv_panel_t *p){
-  sushiv_instance_t *s = p->sushi;
+void _sushiv_undo_log(sushiv_instance_t *s){
   sushiv_panel_undo_t *u;
   int i,j;
 
-  if(!p->sushi->private->undo_stack)
+  if(!s->private->undo_stack)
     s->private->undo_stack = calloc(2,s->panels*sizeof(*s->private->undo_stack));
 
   // log into a fresh entry; pop this level and all above it 
@@ -83,27 +82,24 @@
   // pass off actual population to panels
   for(j=0;j<s->panels;j++)
     if(s->panel_list[j])
-      s->panel_list[j]->private->undo_log(u+j,s->panel_list[j]);
+      _sushiv_panel_undo_log(s->panel_list[j], u+j);
 }
 
-void _sushiv_panel_undo_restore(sushiv_panel_t *p){
-  sushiv_instance_t *s = p->sushi;
+void _sushiv_undo_restore(sushiv_instance_t *s){
   int i;
   
   for(i=0;i<s->panels;i++){
     sushiv_panel_undo_t *u = &s->private->undo_stack[s->private->undo_level][i];
     
-    s->panel_list[i]->private->undo_restore(u,s->panel_list[i]);
+    _sushiv_panel_undo_restore(s->panel_list[i],u);
     plot_expose_request(PLOT(s->panel_list[i]->private->graph));
   }
 }
 
-void _sushiv_panel_undo_push(sushiv_panel_t *p){
-  sushiv_instance_t *s = p->sushi;
-  
+void _sushiv_undo_push(sushiv_instance_t *s){
   if(s->private->undo_suspend)return;
 
-  _sushiv_panel_undo_log(p);
+  _sushiv_undo_log(s);
 
   // realloc stack 
   s->private->undo_stack = 
@@ -115,32 +111,28 @@
   update_all_menus(s);
 }
 
-void _sushiv_panel_undo_up(sushiv_panel_t *p){
-  sushiv_instance_t *s = p->sushi;
-  
+void _sushiv_undo_up(sushiv_instance_t *s){
   if(!s->private->undo_stack)return;
   if(!s->private->undo_stack[s->private->undo_level])return;
   if(!s->private->undo_stack[s->private->undo_level+1])return;
   
   s->private->undo_level++;
-  _sushiv_panel_undo_suspend(p);
-  _sushiv_panel_undo_restore(p);
-  _sushiv_panel_undo_resume(p);
+  _sushiv_undo_suspend(s);
+  _sushiv_undo_restore(s);
+  _sushiv_undo_resume(s);
   update_all_menus(s);
 }
 
-void _sushiv_panel_undo_down(sushiv_panel_t *p){
-  sushiv_instance_t *s = p->sushi;
-
+void _sushiv_undo_down(sushiv_instance_t *s){
   if(!s->private->undo_stack)return;
   if(!s->private->undo_level)return;
 
   if(!s->private->undo_stack[s->private->undo_level+1])
-    _sushiv_panel_undo_log(p);
+    _sushiv_undo_log(s);
   s->private->undo_level--;
 
-  _sushiv_panel_undo_suspend(p);
-  _sushiv_panel_undo_restore(p);
-  _sushiv_panel_undo_resume(p);
+  _sushiv_undo_suspend(s);
+  _sushiv_undo_restore(s);
+  _sushiv_undo_resume(s);
   update_all_menus(s);
 }



More information about the commits mailing list