[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: g_rc.nw
User: cnieves
Date: 05/10/28 18:26:32
Modified: . g_rc.nw g_register.nw i_vars.nw o_undo.nw
Log:
Added support for backup copies and autosaving.
Autosaving is done every "interval" seconds (configurable
through system-gschemrc).
Revision Changes Path
1.32 +31 -0 eda/geda/devel/gschem/noweb/g_rc.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_rc.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/g_rc.nw,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -b -r1.31 -r1.32
--- g_rc.nw 15 Aug 2005 01:26:51 -0000 1.31
+++ g_rc.nw 28 Oct 2005 22:26:32 -0000 1.32
@@ -99,6 +99,7 @@
<<g_rc.c : g_rc_grid_fixed_threshold()>>
<<g_rc.c : g_rc_output_vector_threshold()>>
<<g_rc.c : g_rc_add_attribute_offset()>>
+<<g_rc.c : g_rc_auto_save_interval()>>
@
@@ -2094,3 +2095,33 @@
@ %def g_rc_add_attribute_offset
+@section Function @code{g_rc_auto_save_interval()}
+
+@defun g_rc_auto_save_interval seconds
+@end defun
+
+<<g_rc.c : g_rc_auto_save_interval()>>=
+SCM
+g_rc_auto_save_interval(SCM seconds)
+{
+ int val;
+
+ SCM_ASSERT (SCM_INUMP (seconds), seconds, SCM_ARG1, "auto-save-interval");
+
+ val = SCM_INUM (seconds);
+
+ if (val < 0) {
+ fprintf(stderr, _("Invalid number of seconds [%d] passed to auto-save-interval\n"),
+ val);
+ val = 120; /* absolute default */
+ }
+
+ default_auto_save_interval = val;
+
+ return SCM_BOOL_T;
+}
+
+
+@ %def g_rc_auto_save_interval
+
+
1.28 +4 -0 eda/geda/devel/gschem/noweb/g_register.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_register.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/g_register.nw,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -b -r1.27 -r1.28
--- g_register.nw 15 Aug 2005 01:26:51 -0000 1.27
+++ g_register.nw 28 Oct 2005 22:26:32 -0000 1.28
@@ -173,6 +173,9 @@
{ "output-vector-threshold", 1, 0, 0, g_rc_output_vector_threshold },
{ "add-attribute-offset", 1, 0, 0, g_rc_add_attribute_offset },
+ /* backup functions */
+ { "auto-save-interval", 1, 0, 0, g_rc_auto_save_interval },
+
/* general guile functions */
{ "gschem-print", 1, 0, 0, g_funcs_print },
{ "gschem-image", 1, 0, 0, g_funcs_image },
@@ -319,6 +322,7 @@
/*help functions for generating netlists*/
{ "get-selected-filename", 0, 0, 0, g_get_selected_filename },
{ "get-selected-component-attributes", 0, 0, 0, g_get_selected_component_attributes },
+
{ NULL, 0, 0, 0, NULL } };
@ %def gschem_funcs
1.19 +9 -1 eda/geda/devel/gschem/noweb/i_vars.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i_vars.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/i_vars.nw,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -b -r1.18 -r1.19
--- i_vars.nw 15 Aug 2005 01:26:51 -0000 1.18
+++ i_vars.nw 28 Oct 2005 22:26:32 -0000 1.19
@@ -143,6 +143,8 @@
int default_print_vector_threshold = 3;
int default_add_attribute_offset = 50;
+int default_auto_save_interval = 120;
+
int default_width = 800; /* these variables are used in x_window.c */
int default_height = 600;
@@ -151,7 +153,7 @@
int default_text_feedback = ONLY_WHEN_READABLE;
-@ %def default_graphic_color default_text_color default_text_size default_text_caps default_attribute_color default_detachattr_color default_net_color default_bus_color default_net_endpoint_color default_override_net_color default_override_bus_color default_override_pin_color default_net_endpoint_mode default_net_midpoint_mode default_pin_color default_pin_style default_net_style default_bus_style default_grid_color default_background_color default_select_color default_bb_color default_lock_color default_zoom_box_color default_logic_bubble_color default_actionfeedback_mode default_zoom_with_pan default_object_clipping default_do_logging default_logging_dest default_embed_complex default_include_complex default_text_output default_snap_size default_stroke_color default_paper_width default_paper_height default_scrollbars_flag default_print_orientation default_image_color default_print_color default_print_color_background default_print_output_type default_print_output_capstyle default_series_name default_untitled_name default_scheme_directory default_font_directory default_bitmap_directory default_log_window default_log_window_type default_third_button default_middle_button default_middle_button default_net_consolidate default_file_preview default_enforce_hierarchy default_text_origin_marker default_fast_mousepan default_raise_dialog_boxes default_attribute_promotion default_promote_invisible default_keep_invisible default_continue_component_place default_undo_levels default_undo_control default_undo_type default_draw_grips default_netconn_rubberband default_text_display_zoomfactor default_text_feedback default_sort_component_library default_setpagedevice_orientation default_setpagedevice_pagesize default_bus_ripper_size default_bus_ripper_symname default_bus_ripper_type default_bus_ripper_rotation default_force_boundingbox default_image_width default_image_height
+@ %def default_graphic_color default_text_color default_text_size default_text_caps default_attribute_color default_detachattr_color default_net_color default_bus_color default_net_endpoint_color default_override_net_color default_override_bus_color default_override_pin_color default_net_endpoint_mode default_net_midpoint_mode default_pin_color default_pin_style default_net_style default_bus_style default_grid_color default_background_color default_select_color default_bb_color default_lock_color default_zoom_box_color default_logic_bubble_color default_actionfeedback_mode default_zoom_with_pan default_object_clipping default_do_logging default_logging_dest default_embed_complex default_include_complex default_text_output default_snap_size default_stroke_color default_paper_width default_paper_height default_scrollbars_flag default_print_orientation default_image_color default_print_color default_print_color_background default_print_output_type default_print_output_capstyle default_series_name default_untitled_name default_scheme_directory default_font_directory default_bitmap_directory default_log_window default_log_window_type default_third_button default_middle_button default_middle_button default_net_consolidate default_file_preview default_enforce_hierarchy default_text_origin_marker default_fast_mousepan default_raise_dialog_boxes default_attribute_promotion default_promote_invisible default_keep_invisible default_continue_component_place default_undo_levels default_undo_control default_undo_type default_draw_grips default_netconn_rubberband default_text_display_zoomfactor default_text_feedback default_sort_component_library default_setpagedevice_orientation default_setpagedevice_pagesize default_bus_ripper_size default_bus_ripper_symname default_bus_ripper_type default_bus_ripper_rotation default_force_boundingbox default_image_width default_image_height default_auto_save_interval
@section Function @code{i_vars_set()}
@@ -265,6 +267,12 @@
w_current->grid_fixed_threshold = default_grid_fixed_threshold;
w_current->print_vector_threshold = default_print_vector_threshold;
w_current->add_attribute_offset = default_add_attribute_offset;
+
+ w_current->auto_save_interval = default_auto_save_interval;
+ if (w_current->auto_save_interval != 0) {
+ w_current->auto_save_timeout = g_timeout_add(w_current->auto_save_interval*1000,
+ s_page_autosave, w_current);
+ }
}
1.14 +19 -1 eda/geda/devel/gschem/noweb/o_undo.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_undo.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_undo.nw,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- o_undo.nw 11 Feb 2005 21:49:14 -0000 1.13
+++ o_undo.nw 28 Oct 2005 22:26:32 -0000 1.14
@@ -139,6 +139,13 @@
}
if (w_current->undo_type == UNDO_DISK && flag == UNDO_ALL) {
+
+ /* Increment the number of operations since last backup if
+ auto-save is enabled */
+ if (w_current->auto_save_interval != 0) {
+ w_current->page_current->ops_since_last_backup++;
+ }
+
/* 32 is? for max length of pid and index */
@@ -149,10 +156,21 @@
prog_pid,
undo_file_index++);
- f_save(w_current, filename);
+ /* Changed from f_save to o_save when adding backup copy creation. */
+ /* f_save manages the creaton of backup copies.
+ This way, f_save is called only when saving a file, and not when
+ saving an undo backup copy */
+ o_save(w_current, filename);
} else if (w_current->undo_type == UNDO_MEMORY && flag == UNDO_ALL) {
+
+ /* Increment the number of operations since last backup if
+ auto-save is enabled */
+ if (w_current->auto_save_interval != 0) {
+ w_current->page_current->ops_since_last_backup++;
+ }
+
object_head = s_basic_init_object("undo_head");
o_list_copy_all(w_current,