[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
gEDA-cvs: CVS update: g_hook.nw
User: cnieves
Date: 06/05/17 10:20:50
Modified: . g_hook.nw g_keys.nw g_rc.nw g_register.nw
i_basic.nw i_callbacks.nw i_vars.nw o_basic.nw
o_complex.nw o_copy.nw o_find.nw o_misc.nw
o_move.nw o_undo.nw x_event.nw
Log:
Added support for moving the selected objects just dragging them.
Added multiple copy command.
Allow rotating while copying or moving objects.
Revision Changes Path
1.9 +3 -1 eda/geda/devel/gschem/noweb/g_hook.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_hook.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/g_hook.nw,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- g_hook.nw 26 Feb 2006 11:26:28 -0000 1.8
+++ g_hook.nw 17 May 2006 14:20:48 -0000 1.9
@@ -399,9 +399,11 @@
changed = TRUE;
}
o_text_recreate(w_current, object);
+ if (!w_current->DONT_REDRAW) {
o_text_draw(w_current, object);
}
}
+ }
return SCM_BOOL_T;
}
@ %def g_set_attrib_text_properties
1.6 +3 -1 eda/geda/devel/gschem/noweb/g_keys.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: g_keys.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/g_keys.nw,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -b -r1.5 -r1.6
--- g_keys.nw 19 Feb 2005 23:27:07 -0000 1.5
+++ g_keys.nw 17 May 2006 14:20:48 -0000 1.6
@@ -191,6 +191,8 @@
DEFINE_G_KEYS(edit_select)
DEFINE_G_KEYS(edit_copy)
DEFINE_G_KEYS(edit_copy_hotkey)
+DEFINE_G_KEYS(edit_mcopy)
+DEFINE_G_KEYS(edit_mcopy_hotkey)
DEFINE_G_KEYS(edit_move)
DEFINE_G_KEYS(edit_move_hotkey)
DEFINE_G_KEYS(edit_delete)
@@ -328,7 +330,7 @@
hack */
DEFINE_G_KEYS(cancel)
-@ %def DEFINE_G_KEYS g_keys_file_new g_keys_file_new_window g_keys_file_open g_keys_file_script g_keys_file_save g_keys_file_save_as g_keys_file_save_all g_keys_file_print g_keys_file_write_png g_keys_file_close g_keys_file_quit g_keys_edit_undo g_keys_edit_redo g_keys_edit_select g_keys_edit_copy g_keys_edit_copy_hotkey g_keys_edit_move g_keys_edit_move_hotkey g_keys_edit_delete g_keys_edit_rotate_90 g_keys_edit_rotate_90_hotkey g_keys_edit_mirror g_keys_edit_mirror_hotkey g_keys_edit_stretch g_keys_edit_stretch_hotkey g_keys_edit_slot g_keys_edit_color g_keys_edit_edit g_keys_edit_text g_keys_edit_lock g_keys_edit_unlock g_keys_edit_linetype g_keys_edit_filltype g_keys_edit_translate g_keys_edit_embed g_keys_edit_unembed g_keys_edit_show_hidden g_keys_buffer_copy1 g_keys_buffer_copy2 g_keys_buffer_copy3 g_keys_buffer_copy4 g_keys_buffer_copy5 g_keys_buffer_cut1 g_keys_buffer_cut2 g_keys_buffer_cut3 g_keys_buffer_cut4 g_keys_buffer_cut5 g_keys_buffer_paste1 g_keys_buffer_paste2 g_keys_buffer_paste3 g_keys_buffer_paste4 g_keys_buffer_paste5 g_keys_buffer_paste1_hotkey g_keys_buffer_paste2_hotkey g_keys_buffer_paste3_hotkey g_keys_buffer_paste4_hotkey g_keys_buffer_paste5_hotkey g_keys_view_redraw g_keys_view_zoom_full g_keys_view_zoom_extents g_keys_view_zoom_in g_keys_view_zoom_out g_keys_view_zoom_in_hotkey g_keys_view_zoom_out_hotkey g_keys_view_zoom_box g_keys_view_zoom_box_hotkey g_keys_view_pan g_keys_view_pan_hotkey g_keys_view_update_cues g_keys_page_manager g_keys_page_next g_keys_page_prev g_keys_page_new g_keys_page_close g_keys_page_revert g_keys_page_discard g_keys_page_print g_keys_add_component g_keys_add_attribute g_keys_add_attribute_hotkey g_keys_add_net g_keys_add_net_hotkey g_keys_add_bus g_keys_add_bus_hotkey g_keys_add_text g_keys_add_line g_keys_add_line_hotkey g_keys_add_box g_keys_add_box_hotkey g_keys_add_picture g_keys_add_picture_hotkey g_keys_add_circle g_keys_add_circle_hotkey g_keys_add_arc g_keys_add_arc_hotkey g_keys_add_pin g_keys_add_pin_hotkey g_keys_hierarchy_down_schematic g_keys_hierarchy_down_symbol g_keys_hierarchy_up g_keys_hierarchy_documentation g_keys_attributes_attach g_keys_attributes_detach g_keys_attributes_show_name g_keys_attributes_show_value g_keys_attributes_show_both g_keys_attributes_visibility_toggle g_keys_script_console g_keys_options_text_size g_keys_options_afeedback g_keys_options_grid g_keys_options_snap g_keys_options_snap_size g_keys_options_rubberband g_keys_options_show_log_window g_keys_options_show_coord_window g_keys_misc g_keys_misc2 g_keys_misc3 g_keys_help_about g_keys_help_manual g_keys_help_hotkeys g_keys_cancel
+@ %def DEFINE_G_KEYS g_keys_file_new g_keys_file_new_window g_keys_file_open g_keys_file_script g_keys_file_save g_keys_file_save_as g_keys_file_save_all g_keys_file_print g_keys_file_write_png g_keys_file_close g_keys_file_quit g_keys_edit_undo g_keys_edit_redo g_keys_edit_select g_keys_edit_copy g_keys_edit_copy_hotkey g_keys_edit_move g_keys_edit_move_hotkey g_keys_edit_delete g_keys_edit_rotate_90 g_keys_edit_rotate_90_hotkey g_keys_edit_mirror g_keys_edit_mirror_hotkey g_keys_edit_stretch g_keys_edit_stretch_hotkey g_keys_edit_slot g_keys_edit_color g_keys_edit_edit g_keys_edit_text g_keys_edit_lock g_keys_edit_unlock g_keys_edit_linetype g_keys_edit_filltype g_keys_edit_translate g_keys_edit_embed g_keys_edit_unembed g_keys_edit_show_hidden g_keys_buffer_copy1 g_keys_buffer_copy2 g_keys_buffer_copy3 g_keys_buffer_copy4 g_keys_buffer_copy5 g_keys_buffer_cut1 g_keys_buffer_cut2 g_keys_buffer_cut3 g_keys_buffer_cut4 g_keys_buffer_cut5 g_keys_buffer_paste1 g_keys_buffer_paste2 g_keys_buffer_paste3 g_keys_buffer_paste4 g_keys_buffer_paste5 g_keys_buffer_paste1_hotkey g_keys_buffer_paste2_hotkey g_keys_buffer_paste3_hotkey g_keys_buffer_paste4_hotkey g_keys_buffer_paste5_hotkey g_keys_view_redraw g_keys_view_zoom_full g_keys_view_zoom_extents g_keys_view_zoom_in g_keys_view_zoom_out g_keys_view_zoom_in_hotkey g_keys_view_zoom_out_hotkey g_keys_view_zoom_box g_keys_view_zoom_box_hotkey g_keys_view_pan g_keys_view_pan_hotkey g_keys_view_update_cues g_keys_page_manager g_keys_page_next g_keys_page_prev g_keys_page_new g_keys_page_close g_keys_page_revert g_keys_page_discard g_keys_page_print g_keys_add_component g_keys_add_attribute g_keys_add_attribute_hotkey g_keys_add_net g_keys_add_net_hotkey g_keys_add_bus g_keys_add_bus_hotkey g_keys_add_text g_keys_add_line g_keys_add_line_hotkey g_keys_add_box g_keys_add_box_hotkey g_keys_add_picture g_keys_add_picture_hotkey g_keys_add_circle g_keys_add_circle_hotkey g_keys_add_arc g_keys_add_arc_hotkey g_keys_add_pin g_keys_add_pin_hotkey g_keys_hierarchy_down_schematic g_keys_hierarchy_down_symbol g_keys_hierarchy_up g_keys_hierarchy_documentation g_keys_attributes_attach g_keys_attributes_detach g_keys_attributes_show_name g_keys_attributes_show_value g_keys_attributes_show_both g_keys_attributes_visibility_toggle g_keys_script_console g_keys_options_text_size g_keys_options_afeedback g_keys_options_grid g_keys_options_snap g_keys_options_snap_size g_keys_options_rubberband g_keys_options_show_log_window g_keys_options_show_coord_window g_keys_misc g_keys_misc2 g_keys_misc3 g_keys_help_about g_keys_help_manual g_keys_help_hotkeys g_keys_cancel g_keys_edit_mcopy g_keys_edit_mcopy_hotkey
@section Function @code{g_get_selected_filename()}
1.33 +20 -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.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- g_rc.nw 28 Oct 2005 22:26:32 -0000 1.32
+++ g_rc.nw 17 May 2006 14:20:48 -0000 1.33
@@ -100,6 +100,7 @@
<<g_rc.c : g_rc_output_vector_threshold()>>
<<g_rc.c : g_rc_add_attribute_offset()>>
<<g_rc.c : g_rc_auto_save_interval()>>
+<<g_rc.c : g_rc_drag_can_move()>>
@
@@ -2125,3 +2126,22 @@
@ %def g_rc_auto_save_interval
+@section Function @code{g_rc_drag_can_move()}
+
+@defun g_rc_drag_can_move mode
+@end defun
+
+<<g_rc.c : g_rc_drag_can_move()>>=
+SCM
+g_rc_drag_can_move(SCM mode)
+{
+ static const vstbl_entry mode_table[] = {
+ {TRUE, "enabled" },
+ {FALSE, "disabled" }
+ };
+
+ RETURN_G_RC_MODE("drag-can-move", default_drag_can_move, 2);
+}
+
+
+@ %def g_rc_drag_can_move
1.33 +5 -1 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.32
retrieving revision 1.33
diff -u -b -r1.32 -r1.33
--- g_register.nw 16 May 2006 22:31:01 -0000 1.32
+++ g_register.nw 17 May 2006 14:20:48 -0000 1.33
@@ -1,6 +1,6 @@
@c -*- mode: Noweb; noweb-doc-mode: texinfo-mode; noweb-code-mode: c-mode -*-
@c
-@c $Id: g_register.nw,v 1.32 2006/05/16 22:31:01 danmc Exp $
+@c $Id: g_register.nw,v 1.33 2006/05/17 14:20:48 cnieves Exp $
@c
@node File g_register.c,,,Top
@@ -156,6 +156,8 @@
{ "undo-control", 1, 0, 0, g_rc_undo_control },
{ "undo-type", 1, 0, 0, g_rc_undo_type },
+ { "drag-can-move", 1, 0, 0, g_rc_drag_can_move },
+
{ "draw-grips", 1, 0, 0, g_rc_draw_grips },
{ "netconn-rubberband", 1, 0, 0, g_rc_netconn_rubberband },
{ "sort-component-library", 1, 0, 0, g_rc_sort_component_library },
@@ -209,6 +211,8 @@
{ "edit-select", 0, 0, 0, g_keys_edit_select },
{ "edit-copy", 0, 0, 0, g_keys_edit_copy },
{ "edit-copy-hotkey", 0, 0, 0, g_keys_edit_copy_hotkey },
+ { "edit-mcopy", 0, 0, 0, g_keys_edit_mcopy },
+ { "edit-mcopy-hotkey", 0, 0, 0, g_keys_edit_mcopy_hotkey },
{ "edit-move", 0, 0, 0, g_keys_edit_move },
{ "edit-move-hotkey", 0, 0, 0, g_keys_edit_move_hotkey },
{ "edit-delete", 0, 0, 0, g_keys_edit_delete },
1.24 +11 -0 eda/geda/devel/gschem/noweb/i_basic.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i_basic.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/i_basic.nw,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- i_basic.nw 7 Nov 2005 02:43:08 -0000 1.23
+++ i_basic.nw 17 May 2006 14:20:48 -0000 1.24
@@ -208,6 +208,11 @@
return _("Copy");
case MOVE:
return _("Move");
+ case MCOPY:
+ return _("Multiple Copy");
+ case STARTMCOPY:
+ case ENDMCOPY:
+ return _("Multiple Copy Mode");
}
return ""; /* should not happen */
}
@@ -489,6 +494,9 @@
case(STARTPASTE): /* TODO */
case(ENDPASTE): /* TODO */
case(GRIPS): /* TODO */
+ case(MCOPY): /* TODO */
+ case(STARTMCOPY): /* TODO */
+ case(ENDMCOPY): /* TODO */
default:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
w_current->toolbar_select), TRUE);
@@ -784,6 +792,9 @@
case(STARTPASTE): /* TODO */
case(ENDPASTE): /* TODO */
case(GRIPS): /* TODO */
+ case(MCOPY): /* TODO */
+ case(MCOPYSTART): /* TODO */
+ case(MCOPYEND): /* TODO */
default:
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
w_current->toolbar_select), TRUE);
1.50 +64 -0 eda/geda/devel/gschem/noweb/i_callbacks.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: i_callbacks.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/i_callbacks.nw,v
retrieving revision 1.49
retrieving revision 1.50
diff -u -b -r1.49 -r1.50
--- i_callbacks.nw 24 Apr 2006 17:21:12 -0000 1.49
+++ i_callbacks.nw 17 May 2006 14:20:48 -0000 1.50
@@ -48,6 +48,8 @@
<<i_callbacks.c : i_callback_toolbar_edit_select()>>
<<i_callbacks.c : i_callback_edit_copy()>>
<<i_callbacks.c : i_callback_edit_copy_hotkey()>>
+<<i_callbacks.c : i_callback_edit_mcopy()>>
+<<i_callbacks.c : i_callback_edit_mcopy_hotkey()>>
<<i_callbacks.c : i_callback_edit_move()>>
<<i_callbacks.c : i_callback_edit_move_hotkey()>>
<<i_callbacks.c : i_callback_edit_delete()>>
@@ -237,6 +239,7 @@
#include <dmalloc.h>
#endif
+extern int rotated_inside;
@
@@ -886,6 +889,7 @@
{
TOPLEVEL *w_current = (TOPLEVEL *) data;
+ w_current->DONT_REDRAW = 0;
o_undo_callback(w_current, UNDO_ACTION);
}
@@ -924,6 +928,7 @@
{
TOPLEVEL *w_current = (TOPLEVEL *) data;
+ w_current->DONT_REDRAW = 0;
o_undo_callback(w_current, REDO_ACTION);
}
@@ -1038,6 +1043,7 @@
i_update_middle_button(w_current, i_callback_edit_copy_hotkey, _("Copy"));
if (o_select_return_first_object(w_current)) {
+ w_current->event_state = COPY;
o_redraw_cleanstates(w_current);
o_copy_start(w_current, mouse_x, mouse_y);
w_current->event_state = ENDCOPY;
@@ -1049,6 +1055,56 @@
@ %def i_callback_edit_copy_hotkey
+@section Function @code{i_callback_edit_mcopy()}
+
+@defun i_callback_edit_mcopy data callback_action widget
+@end defun
+
+<<i_callbacks.c : i_callback_edit_mcopy()>>=
+DEFINE_I_CALLBACK(edit_mcopy)
+{
+ TOPLEVEL *w_current = (TOPLEVEL *) data;
+
+ exit_if_null(w_current);
+
+ i_update_middle_button(w_current, i_callback_edit_copy, _("Multiple Copy"));
+ if (o_select_return_first_object(w_current)) {
+ i_set_state(w_current, STARTMCOPY);
+ } else {
+ i_set_state_msg(w_current, SELECT, _("Select objs first"));
+ }
+}
+
+
+@ %def i_callback_edit_mcopy
+
+
+@section Function @code{i_callback_edit_mcopy_hotkey()}
+
+@defun i_callback_edit_mcopy_hotkey data callback_action widget
+@end defun
+
+<<i_callbacks.c : i_callback_edit_mcopy_hotkey()>>=
+DEFINE_I_CALLBACK(edit_mcopy_hotkey)
+{
+ TOPLEVEL *w_current = (TOPLEVEL *) data;
+
+ exit_if_null(w_current);
+
+ i_update_middle_button(w_current, i_callback_edit_mcopy_hotkey, _("Multiple Copy"));
+ if (o_select_return_first_object(w_current)) {
+ o_redraw_cleanstates(w_current);
+ w_current->event_state = MCOPY;
+ o_copy_start(w_current, mouse_x, mouse_y);
+ w_current->event_state = ENDMCOPY;
+ w_current->inside_action = 1;
+ }
+}
+
+
+@ %def i_callback_edit_mcopy_hotkey
+
+
@section Function @code{i_callback_edit_move()}
@defun i_callback_edit_move data callback_action widget
@@ -1259,6 +1315,8 @@
s_current = w_current->page_current->selection2_head->next;
i_update_middle_button(w_current,
i_callback_edit_rotate_90_hotkey, _("Rotate"));
+ /* Allow o_rotate_90 to redraw the objects */
+ w_current->DONT_REDRAW = 0;
o_rotate_90(w_current, s_current, mouse_x, mouse_y);
}
@@ -4451,6 +4509,12 @@
exit_if_null(w_current);
+ if ( (w_current->inside_action) &&
+ (rotated_inside != 0)) {
+ o_undo_callback(w_current, UNDO_ACTION);
+ rotated_inside = 0;
+ }
+
/* leave this on for now... but it might have to change */
/* this is problematic since we don't know what the right mode */
/* (when you cancel inside an action) should be */
1.21 +5 -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.20
retrieving revision 1.21
diff -u -b -r1.20 -r1.21
--- i_vars.nw 25 Feb 2006 15:00:58 -0000 1.20
+++ i_vars.nw 17 May 2006 14:20:48 -0000 1.21
@@ -145,6 +145,8 @@
int default_auto_save_interval = 120;
+int default_drag_can_move = TRUE;
+
int default_width = 800; /* these variables are used in x_window.c */
int default_height = 600;
@@ -153,7 +155,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 default_auto_save_interval
+@ %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 default_drag_can_move
@section Function @code{i_vars_set()}
@@ -268,6 +270,8 @@
w_current->print_vector_threshold = default_print_vector_threshold;
w_current->add_attribute_offset = default_add_attribute_offset;
+ w_current->drag_can_move = default_drag_can_move;
+
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,
1.17 +8 -3 eda/geda/devel/gschem/noweb/o_basic.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_basic.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_basic.nw,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- o_basic.nw 14 May 2006 10:43:22 -0000 1.16
+++ o_basic.nw 17 May 2006 14:20:48 -0000 1.17
@@ -131,9 +131,11 @@
o_erase_selected(w_current);
/* continue */
case(ENDCOPY):
+ case(ENDMCOPY):
o_drawbounding(w_current, NULL,
w_current->page_current->selection2_head->next,
x_get_darkcolor(w_current->bb_color), FALSE);
+
break;
case(DRAWCOMP):
@@ -859,6 +861,7 @@
switch (w_current->event_state) {
/* all states with something on the dc */
case(COPY):
+ case(MCOPY):
case(DRAWBUS):
case(DRAWCOMP):
case(DRAWNET):
@@ -868,6 +871,7 @@
case(ENDCIRCLE):
case(ENDCOMP):
case(ENDCOPY):
+ case(ENDMCOPY):
case(ENDLINE):
case(ENDMOVE):
case(ENDPASTE):
@@ -920,6 +924,7 @@
case(MOUSEPAN):
case(SBOX):
case(STARTCOPY):
+ case(STARTMCOPY):
case(STARTDRAWBUS):
case(STARTDRAWNET):
case(STARTMOVE):
1.20 +3 -1 eda/geda/devel/gschem/noweb/o_complex.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_complex.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_complex.nw,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -b -r1.19 -r1.20
--- o_complex.nw 22 Apr 2006 20:34:02 -0000 1.19
+++ o_complex.nw 17 May 2006 14:20:48 -0000 1.20
@@ -85,7 +85,9 @@
{
int left, right, top, bottom;
+ if (!w_current->DONT_REDRAW) {
o_redraw(w_current, o_current->complex->prim_objs);
+ }
get_complex_bounds(w_current, o_current->complex->prim_objs,
&left, &top, &right, &bottom);
1.13 +93 -35 eda/geda/devel/gschem/noweb/o_copy.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_copy.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_copy.nw,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -b -r1.12 -r1.13
--- o_copy.nw 24 Apr 2006 03:06:56 -0000 1.12
+++ o_copy.nw 17 May 2006 14:20:49 -0000 1.13
@@ -68,8 +68,13 @@
o_copy_start(TOPLEVEL *w_current, int x, int y)
{
if (w_current->page_current->selection2_head->next != NULL) {
+ /* Save the current state. When rotating the selection when copying,
+ we have to come back to here */
+ o_undo_savestate(w_current, UNDO_ALL);
+
w_current->last_drawb_mode = -1;
- w_current->event_state = COPY;
+ /* Shouldn't this set by the caller ? */
+ /* w_current->event_state = COPY; */
w_current->last_x = w_current->start_x = fix_x(w_current, x);
w_current->last_y = w_current->start_y = fix_y(w_current, y);
@@ -99,12 +104,14 @@
GList *connected_objects=NULL;
OBJECT *new_object = NULL;
OBJECT *complex_object = NULL;
+ OBJECT *new_objects_head = NULL;
OBJECT *object;
int diff_x, diff_y;
int screen_diff_x, screen_diff_y;
int lx, ly;
int sx, sy;
int color;
+ int redraw_state;
object = o_select_return_first_object(w_current);
@@ -135,6 +142,7 @@
/* skip over head node */
s_current = w_current->page_current->selection2_head->next;
temp_list = o_selection_new_head();
+ new_objects_head = s_basic_init_object("object_head");
while(s_current != NULL) {
@@ -153,8 +161,7 @@
/* connections till much later */
w_current->ADDING_SEL=1;
new_object = (OBJECT *) o_net_copy(w_current,
- w_current->page_current->
- object_tail,
+ return_tail(new_objects_head),
object);
w_current->ADDING_SEL=0;
@@ -163,9 +170,13 @@
screen_diff_x, screen_diff_y,
object);
}
+
+ w_current->ADDING_SEL=1;
o_net_translate_world(w_current,
diff_x, diff_y,
new_object);
+ w_current->ADDING_SEL=0;
+
o_selection_add(temp_list, new_object);
new_object->saved_color = object->saved_color;
@@ -183,8 +194,7 @@
/* connections till much later */
w_current->ADDING_SEL=1;
new_object = (OBJECT *) o_pin_copy(w_current,
- w_current->page_current->
- object_tail,
+ return_tail(new_objects_head),
object);
w_current->ADDING_SEL=0;
@@ -195,9 +205,11 @@
object);
}
+ w_current->ADDING_SEL=1;
o_pin_translate_world(w_current,
diff_x, diff_y,
new_object);
+ w_current->ADDING_SEL=0;
o_selection_add(temp_list, new_object);
new_object->saved_color = object->saved_color;
@@ -215,8 +227,7 @@
/* connections till much later */
w_current->ADDING_SEL=1;
new_object = (OBJECT *) o_bus_copy(w_current,
- w_current->page_current->
- object_tail,
+ return_tail(new_objects_head),
object);
w_current->ADDING_SEL=0;
@@ -226,9 +237,11 @@
object);
}
+ w_current->ADDING_SEL=1;
o_bus_translate_world(w_current,
diff_x, diff_y,
new_object);
+ w_current->ADDING_SEL=0;
o_selection_add(temp_list, new_object);
new_object->saved_color = object->saved_color;
@@ -248,13 +261,12 @@
new_object = (OBJECT *)
o_complex_copy_embedded(w_current,
- w_current->page_current->object_tail,
+ return_tail(new_objects_head),
object);
} else {
new_object = (OBJECT *) o_complex_copy(w_current,
- w_current->
- page_current->object_tail,
+ return_tail(new_objects_head),
object);
}
w_current->ADDING_SEL=0;
@@ -265,10 +277,13 @@
o_complex_draw_xor(w_current, screen_diff_x, screen_diff_y,
object->complex->prim_objs);
}
+
+ w_current->ADDING_SEL=1;
o_complex_world_translate_toplevel(w_current,
diff_x,
diff_y,
new_object);
+ w_current->ADDING_SEL=0;
o_selection_add(temp_list, new_object);
@@ -287,17 +302,20 @@
case(OBJ_LINE):
new_object = (OBJECT *) o_line_copy(w_current,
- w_current->page_current->
- object_tail,
+ return_tail(new_objects_head),
object);
if (w_current->actionfeedback_mode == OUTLINE) {
o_line_draw_xor(w_current,
screen_diff_x, screen_diff_y,
object);
}
+
+ w_current->ADDING_SEL=1;
o_line_translate_world(w_current,
diff_x, diff_y,
new_object);
+ w_current->ADDING_SEL=0;
+
o_selection_add(temp_list, new_object);
new_object->saved_color = object->saved_color;
o_line_draw(w_current, new_object);
@@ -305,8 +323,7 @@
case(OBJ_BOX):
new_object = (OBJECT *) o_box_copy(w_current,
- w_current->page_current->
- object_tail,
+ return_tail(new_objects_head),
object);
if (w_current->actionfeedback_mode == OUTLINE) {
o_box_draw_xor(w_current,
@@ -314,9 +331,12 @@
screen_diff_y,
object);
}
+
+ w_current->ADDING_SEL=1;
o_box_translate_world(w_current,
diff_x, diff_y,
new_object);
+ w_current->ADDING_SEL=0;
o_selection_add(temp_list, new_object);
new_object->saved_color = object->saved_color;
@@ -327,8 +347,7 @@
#ifndef HAS_GTK12
case(OBJ_PICTURE):
new_object = (OBJECT *) o_picture_copy(w_current,
- w_current->page_current->
- object_tail,
+ return_tail(new_objects_head),
object);
if (w_current->actionfeedback_mode == OUTLINE) {
o_picture_draw_xor(w_current,
@@ -336,9 +355,12 @@
screen_diff_y,
object);
}
+
+ w_current->ADDING_SEL=1;
o_picture_translate_world(w_current,
diff_x, diff_y,
new_object);
+ w_current->ADDING_SEL=0;
o_selection_add(temp_list, new_object);
new_object->saved_color = object->saved_color;
@@ -348,8 +370,7 @@
#endif
case(OBJ_CIRCLE):
new_object = (OBJECT *) o_circle_copy(w_current,
- w_current->page_current->
- object_tail,
+ return_tail(new_objects_head),
object);
if (w_current->actionfeedback_mode == OUTLINE) {
@@ -358,9 +379,12 @@
screen_diff_y,
object);
}
+
+ w_current->ADDING_SEL=1;
o_circle_translate_world(w_current,
diff_x, diff_y,
new_object);
+ w_current->ADDING_SEL=0;
o_selection_add(temp_list, new_object);
new_object->saved_color = object->saved_color;
@@ -369,8 +393,7 @@
case(OBJ_ARC):
new_object = (OBJECT *) o_arc_copy(w_current,
- w_current->page_current->
- object_tail,
+ return_tail(new_objects_head),
object);
if (w_current->actionfeedback_mode == OUTLINE) {
@@ -379,9 +402,12 @@
screen_diff_y,
object);
}
+
+ w_current->ADDING_SEL=1;
o_arc_translate_world(w_current,
diff_x, diff_y,
new_object);
+ w_current->ADDING_SEL=0;
o_selection_add(temp_list, new_object);
new_object->saved_color = object->saved_color;
@@ -409,24 +435,18 @@
switch(object->type) {
case(OBJ_TEXT):
+ w_current->ADDING_SEL=1;
new_object = (OBJECT *) o_text_copy(w_current,
- w_current->page_current->
- object_tail,
+ return_tail(new_objects_head),
object);
+ w_current->ADDING_SEL=0;
/* this is also okay NEWSEL new_obj is single */
if (object->attached_to) {
if (object->attached_to->copied_to) {
- o_attrib_attach(w_current, w_current-> page_current-> object_head,
+ o_attrib_attach(w_current, new_objects_head,
new_object, object->attached_to-> copied_to);
- if (scm_hook_empty_p(copy_component_hook) == SCM_BOOL_F) {
- scm_run_hook(copy_component_hook,
- scm_cons (g_make_attrib_smob_list(w_current,
- complex_object),
- SCM_EOL));
- }
-
/* TODO: I have no idea if this is
really needed.... ? */
#if 0
@@ -446,7 +466,10 @@
screen_diff_y,
object);
}
+
+ w_current->ADDING_SEL=1;
o_text_translate_world(w_current, diff_x, diff_y, new_object);
+ w_current->ADDING_SEL=0;
/* old object was attr */
if (!new_object->attribute &&
@@ -477,6 +500,42 @@
s_current = s_current->next;
}
+ /* Go back to the state before copying, to restore possible rotations
+ of the selection */
+ redraw_state = w_current->DONT_REDRAW;
+ w_current->DONT_REDRAW = 0;
+ o_undo_callback(w_current, UNDO_ACTION);
+ w_current->DONT_REDRAW = redraw_state;
+
+ /* Add the new objects */
+ w_current->page_current->object_tail = (OBJECT *)
+ return_tail(w_current->page_current->object_head);
+
+ s_basic_link_object(new_objects_head, w_current->page_current->object_tail);
+
+ /* Run the copy component hook */
+ object = new_objects_head->next;
+ while (object != NULL) {
+ if ((object->type == OBJ_COMPLEX) &&
+ (scm_hook_empty_p(copy_component_hook) == SCM_BOOL_F)) {
+ scm_run_hook(copy_component_hook,
+ scm_cons (g_make_attrib_smob_list(w_current, object),
+ SCM_EOL));
+ }
+ object = object->next;
+ }
+
+ /* And redraw them */
+ object = new_objects_head;
+ while (object) {
+ o_redraw_single(w_current, object);
+ object=object->next;
+ }
+
+ /* Delete the new object head */
+ /* new_objects_head->next = NULL;
+ s_delete_list_fromstart(w_current, new_objects_head); */
+
w_current->page_current->object_tail = (OBJECT *)
return_tail(w_current->page_current->object_head);
@@ -494,7 +553,6 @@
w_current->page_current->selection2_head = temp_list;
w_current->page_current->selection2_tail = o_selection_return_tail(
temp_list);
-
#if DEBUG
o_selection_print_all(w_current->page_current->selection2_head);
#endif
1.9 +24 -13 eda/geda/devel/gschem/noweb/o_find.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_find.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_find.nw,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -b -r1.8 -r1.9
--- o_find.nw 24 Apr 2006 03:06:56 -0000 1.8
+++ o_find.nw 17 May 2006 14:20:49 -0000 1.9
@@ -63,10 +63,12 @@
@end defun
<<o_find.c : o_find_object()>>=
-void
-o_find_object(TOPLEVEL *w_current, int screen_x, int screen_y )
+gboolean
+o_find_object(TOPLEVEL *w_current, int screen_x, int screen_y,
+ gboolean change_selection)
{
OBJECT *o_current=NULL;
+ gboolean object_found = FALSE;
if (w_current->page_current->object_lastplace == NULL) {
o_current = w_current->page_current->object_head;
@@ -84,13 +86,16 @@
(o_current->visibility == VISIBLE ||
(o_current->visibility == INVISIBLE &&
w_current->show_hidden_text))) {
+ if (change_selection) {
(*o_current->sel_func)(
w_current, o_current,
SINGLE, 0); /* 0 is count */
+ }
+ object_found = TRUE;
w_current->page_current-> object_lastplace =
o_current->next;
i_update_menus(w_current);
- return;
+ return object_found;
}
}
@@ -115,12 +120,15 @@
(o_current->visibility == VISIBLE ||
(o_current->visibility == INVISIBLE &&
w_current->show_hidden_text))) {
+ if (change_selection) {
/* 0 is count */
(*o_current->sel_func)(w_current, o_current, SINGLE, 0);
+ }
w_current->page_current->object_lastplace = o_current;
+ object_found = TRUE;
i_update_menus(w_current);
- return;
+ return object_found;
}
}
o_current = o_current->next;
@@ -129,8 +137,9 @@
/* didn't find anything.... reset lastplace */
w_current->page_current->object_lastplace = NULL;
- /* deselect everything only if shift key isn't pressed */
- if (!w_current->SHIFTKEY) {
+ /* deselect everything only if shift key isn't pressed and
+ the caller allows it */
+ if (change_selection && (!w_current->SHIFTKEY)) {
#if DEBUG
o_selection_print_all( w_current->page_current->selection2_head);
@@ -141,6 +150,8 @@
}
i_update_menus(w_current);
+
+ return (object_found);
}
1.44 +121 -68 eda/geda/devel/gschem/noweb/o_misc.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_misc.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_misc.nw,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -b -r1.43 -r1.44
--- o_misc.nw 9 Apr 2006 08:11:36 -0000 1.43
+++ o_misc.nw 17 May 2006 14:20:49 -0000 1.44
@@ -341,9 +341,11 @@
case(OBJ_NET):
+ if (!w_current->DONT_REDRAW) {
o_cue_undraw(w_current, object);
o_net_erase(w_current, object);
o_line_erase_grips(w_current, object);
+ }
/* save the other objects */
other_objects = s_conn_return_others(other_objects, object);
@@ -351,50 +353,62 @@
o_net_rotate(w_current, centerx, centery, 90, object);
s_conn_update_object(w_current, object);
+ if (!w_current->DONT_REDRAW) {
o_net_draw(w_current, object);
/* draw the other objects */
o_cue_undraw_list(w_current, other_objects);
o_cue_draw_list(w_current, other_objects);
+ }
/* get other connected objects and redraw */
connected_objects = s_conn_return_others(connected_objects, object);
+ if (!w_current->DONT_REDRAW) {
o_cue_undraw_list(w_current, connected_objects);
o_cue_draw_list(w_current, connected_objects);
/* finally redraw the cues on the current object */
o_cue_draw_single(w_current, object);
+ }
break;
case(OBJ_BUS):
+ if (!w_current->DONT_REDRAW) {
o_cue_undraw(w_current, object);
o_bus_erase(w_current, object);
o_line_erase_grips(w_current, object);
+ }
other_objects = s_conn_return_others(other_objects, object);
s_conn_remove(w_current, object);
o_bus_rotate(w_current, centerx, centery, 90, object);
s_conn_update_object(w_current, object);
+ if (!w_current->DONT_REDRAW) {
o_bus_draw(w_current, object);
/* draw the other objects */
o_cue_undraw_list(w_current, other_objects);
o_cue_draw_list(w_current, other_objects);
+ }
/* get other connected objects and redraw */
connected_objects = s_conn_return_others(connected_objects, object);
+ if (!w_current->DONT_REDRAW) {
o_cue_undraw_list(w_current, connected_objects);
o_cue_draw_list(w_current, connected_objects);
/* finally redraw the cues on the current object */
o_cue_draw_single(w_current, object);
+ }
break;
case(OBJ_PIN):
+ if (!w_current->DONT_REDRAW) {
o_cue_undraw(w_current, object);
o_pin_erase(w_current, object);
o_line_erase_grips(w_current, object);
+ }
other_objects = s_conn_return_others(other_objects, object);
s_conn_remove(w_current, object);
@@ -402,25 +416,31 @@
o_pin_rotate(w_current, centerx, centery,
90, object);
s_conn_update_object(w_current, object);
+ if (!w_current->DONT_REDRAW) {
o_pin_draw(w_current, object);
/* draw the other objects */
o_cue_undraw_list(w_current, other_objects);
o_cue_draw_list(w_current, other_objects);
+ }
/* get other connected objects and redraw */
connected_objects = s_conn_return_others(connected_objects, object);
+ if (!w_current->DONT_REDRAW) {
o_cue_undraw_list(w_current, connected_objects);
o_cue_draw_list(w_current, connected_objects);
/* finally redraw the cues on the current object */
o_cue_draw_single(w_current, object);
+ }
break;
case(OBJ_COMPLEX):
+ if (!w_current->DONT_REDRAW) {
o_cue_undraw_objects(w_current, object->complex->prim_objs);
/* erase the current selection */
o_complex_erase(w_current, object);
+ }
other_objects = s_conn_return_complex_others(other_objects, object);
@@ -438,64 +458,87 @@
new_angle, 90, object);
/*w_current->ADDING_SEL = 0; NEWSEL: needed? */
s_conn_update_complex(w_current, object->complex->prim_objs);
+ if (!w_current->DONT_REDRAW) {
o_complex_draw(w_current, object);
o_cue_undraw_list(w_current, other_objects);
o_cue_draw_list(w_current, other_objects);
+ }
/* now draw the newly connected objects */
connected_objects = s_conn_return_complex_others(connected_objects,
object);
+ if (!w_current->DONT_REDRAW) {
o_cue_undraw_list(w_current, connected_objects);
o_cue_draw_list(w_current, connected_objects);
+ }
break;
case(OBJ_LINE):
+ if (!w_current->DONT_REDRAW) {
o_line_erase_grips(w_current, object);
o_line_erase(w_current, object);
+ }
o_line_rotate(w_current, centerx, centery,
90, object);
+ if (!w_current->DONT_REDRAW) {
o_line_draw(w_current, object);
+ }
break;
case(OBJ_BOX):
/* erase the current selection */
+ if (!w_current->DONT_REDRAW) {
o_box_erase_grips(w_current, object);
o_box_erase(w_current, object);
+ }
o_box_rotate(w_current, centerx, centery,
90, object);
+ if (!w_current->DONT_REDRAW) {
o_box_draw(w_current, object);
+ }
break;
case(OBJ_PICTURE):
/* erase the current selection */
#ifndef HAS_GTK12
+
+ if (!w_current->DONT_REDRAW) {
o_picture_erase_grips(w_current, object);
o_picture_erase(w_current, object);
+ }
o_picture_rotate(w_current, centerx, centery,
90, object);
+ if (!w_current->DONT_REDRAW) {
o_picture_draw(w_current, object);
+ }
#endif
break;
case(OBJ_CIRCLE):
+ if (!w_current->DONT_REDRAW) {
o_circle_erase_grips(w_current, object);
o_circle_erase(w_current, object);
+ }
o_circle_rotate(w_current, centerx, centery,
90, object);
+ if (!w_current->DONT_REDRAW) {
o_circle_draw(w_current, object);
+ }
break;
case(OBJ_ARC):
+ if (!w_current->DONT_REDRAW) {
o_arc_erase(w_current, object);
+ }
#if 0 /* not needed anymore */
SCREENtoWORLD(w_current, centerx, centery,
@@ -504,18 +547,24 @@
#endif
o_arc_rotate(w_current, centerx, centery, 90, object);
+ if (!w_current->DONT_REDRAW) {
o_arc_draw(w_current, object);
+ }
break;
case(OBJ_TEXT):
/* erase the current selection */
+ if (!w_current->DONT_REDRAW) {
o_text_erase(w_current, object);
+ }
new_angle = (object->text->angle + 90) % 360;
o_text_rotate(w_current, centerx, centery,
new_angle, 90, object);
+ if (!w_current->DONT_REDRAW) {
o_text_draw(w_current, object);
+ }
break;
}
s_current = s_current->next;
@@ -546,7 +595,7 @@
break;
case (OBJ_COMPLEX):
- /* Run the rotate pin hook */
+ /* Run the rotate hook */
if (scm_hook_empty_p(rotate_component_object_hook) == SCM_BOOL_F &&
object != NULL) {
scm_run_hook(rotate_component_object_hook,
@@ -561,8 +610,12 @@
s_current = s_current->next;
}
+ /* Don't save the undo state if we are inside an action */
+ /* This is useful when rotating the selection while moving, for example */
w_current->page_current->CHANGED = 1;
+ if (!w_current->inside_action) {
o_undo_savestate(w_current, UNDO_ALL);
+ }
}
1.14 +6 -0 eda/geda/devel/gschem/noweb/o_move.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: o_move.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/o_move.nw,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -b -r1.13 -r1.14
--- o_move.nw 22 Apr 2006 20:34:02 -0000 1.13
+++ o_move.nw 17 May 2006 14:20:49 -0000 1.14
@@ -74,6 +74,9 @@
{
if (w_current->page_current->selection2_head->next != NULL) {
+ /* Save the current state. When rotating the selection when moving,
+ we have to come back to here */
+ o_undo_savestate(w_current, UNDO_ALL);
w_current->last_drawb_mode = -1;
w_current->event_state = MOVE;
@@ -323,6 +326,9 @@
s_current = s_current->next;
}
+ /* Remove the undo saved in o_move_start */
+ o_undo_remove_last_undo(w_current);
+
/* erase the bounding box */
if (w_current->actionfeedback_mode == BOUNDINGBOX) {
o_drawbounding(w_current, NULL,
1.16 +38 -3 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.15
retrieving revision 1.16
diff -u -b -r1.15 -r1.16
--- o_undo.nw 18 Nov 2005 20:31:48 -0000 1.15
+++ o_undo.nw 17 May 2006 14:20:49 -0000 1.16
@@ -19,6 +19,7 @@
<<o_undo.c : o_undo_find_prev_object_head()>>
<<o_undo.c : o_undo_callback()>>
<<o_undo.c : o_undo_cleanup()>>
+<<o_undo.c : o_undo_remove_last_undo()>>
@
@@ -371,6 +372,7 @@
int save_logging;
int diff_x;
int find_prev_data=FALSE;
+ int prev_status;
char *save_filename;
@@ -414,7 +416,6 @@
/* save filename */
save_filename = g_strdup (w_current->page_current->page_filename);
-
/* save structure so it's not nuked */
save_bottom = w_current->page_current->undo_bottom;
save_tos = w_current->page_current->undo_tos;
@@ -438,6 +439,7 @@
/* temporarily disable logging */
save_logging = do_logging;
+ prev_status = w_current->DONT_REDRAW;
w_current->DONT_REDRAW = 1;
do_logging = FALSE;
@@ -487,7 +489,10 @@
/* final redraw */
x_pagesel_update (w_current);
- w_current->DONT_REDRAW = 0;
+
+ /* Let the caller to decide if redraw or not */
+ /* w_current->DONT_REDRAW = 0; */
+ w_current->DONT_REDRAW = prev_status;
diff_x = GET_PAGE_WIDTH (w_current);
@@ -501,7 +506,9 @@
#endif
#endif
+ if (!w_current->DONT_REDRAW) {
o_redraw_all(w_current);
+ }
i_update_menus(w_current);
/* restore saved undo structures */
@@ -576,3 +583,31 @@
@ %def o_undo_cleanup
+
+
+@section Function @code{o_undo_remove_last_undo()}
+
+@defun o_undo_remove_last_undo w_current
+@end defun
+
+<<o_undo.c : o_undo_remove_last_undo()>>=
+void
+o_undo_remove_last_undo(TOPLEVEL *w_current)
+{
+ if (w_current->page_current->undo_current == NULL) {
+ return;
+ }
+
+ if (w_current->page_current->undo_current) {
+ w_current->page_current->undo_current =
+ w_current->page_current->undo_current->prev;
+ if (w_current->page_current->undo_current == NULL) {
+ w_current->page_current->undo_current =
+ w_current->page_current->undo_bottom;
+ }
+ }
+
+
+
+}
+@ %def o_undo_remove_last_undo
1.24 +162 -61 eda/geda/devel/gschem/noweb/x_event.nw
(In the diff below, changes in quantity of whitespace are not shown.)
Index: x_event.nw
===================================================================
RCS file: /home/cvspsrv/cvsroot/eda/geda/devel/gschem/noweb/x_event.nw,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -b -r1.23 -r1.24
--- x_event.nw 14 May 2006 10:43:22 -0000 1.23
+++ x_event.nw 17 May 2006 14:20:49 -0000 1.24
@@ -87,6 +87,9 @@
int start_pan_x, start_pan_y;
int throttle = 0;
+/* Number of times that the selection was rotated inside another command */
+int rotated_inside = 0;
+
@ %def mouse_x mouse_y current_center_x current_center_y start_pan_x start_pan_y throttle
@@ -134,6 +137,7 @@
case(ENDMOVE):
case(COPY):
case(ENDCOPY):
+ case(ENDMCOPY):
o_drawbounding(w_current, NULL,
w_current->page_current->selection2_head->next,
x_get_darkcolor(w_current->bb_color), FALSE);
@@ -204,17 +208,24 @@
x_event_button_pressed(GtkWidget *widget, GdkEventButton *event,
TOPLEVEL *w_current)
{
+ int prev_state;
+
exit_if_null(w_current);
global_window_current = w_current;
#if DEBUG
- printf("pressed! %d \n", event_state);
+ printf("pressed button %d! \n", event->button);
+ printf("event state: %d \n", event->state);
+ printf("w_current state: %d \n", w_current->event_state);
+ printf("Selection is:\n");
+ o_selection_print_all( w_current->page_current->selection2_head);
+ printf("\n");
#endif
if (event->type == GDK_2BUTTON_PRESS &&
(w_current->event_state == STARTSELECT ||
w_current->event_state == SELECT)) {
- o_find_object(w_current, (int) event->x, (int) event->y);
+ o_find_object(w_current, (int) event->x, (int) event->y, TRUE);
if (w_current->page_current->selection2_head->next) {
o_edit(w_current, w_current->page_current->selection2_head->next);
return(0);
@@ -247,6 +258,7 @@
case(STARTCOPY):
if (o_select_selected(w_current)) {
+ rotated_inside = 0;
o_copy_start(w_current,
(int) event->x, (int) event->y);
w_current->event_state = COPY;
@@ -254,8 +266,19 @@
}
break;
+ case(STARTMCOPY):
+ if (o_select_selected(w_current)) {
+ rotated_inside = 0;
+ o_copy_start(w_current,
+ (int) event->x, (int) event->y);
+ w_current->event_state = MCOPY;
+ w_current->inside_action = 1;
+ }
+ break;
+
case(STARTMOVE):
if (o_select_selected(w_current)) {
+ rotated_inside = 0;
o_move_start(w_current,
(int) event->x, (int) event->y);
w_current->event_state = MOVE;
@@ -467,10 +490,13 @@
break;
case(ENDROTATEP):
+ prev_state = w_current->DONT_REDRAW;
+ w_current->DONT_REDRAW = 0;
o_rotate_90(
w_current,
w_current->page_current->selection2_head->next,
(int) event->x, (int) event->y);
+ w_current->DONT_REDRAW = prev_state;
w_current->inside_action = 0;
i_set_state(w_current, SELECT);
@@ -525,7 +551,10 @@
/* try this out and see how it behaves */
if (w_current->inside_action) {
if (w_current->event_state == ENDCOMP ||
- w_current->event_state == ENDTEXT ) {
+ w_current->event_state == ENDTEXT ||
+ w_current->event_state == ENDMOVE ||
+ w_current->event_state == ENDCOPY ||
+ w_current->event_state == ENDMCOPY) {
return(0);
} else {
i_callback_cancel(w_current, 0, NULL);
@@ -546,7 +575,7 @@
if (!w_current->SHIFTKEY) {
o_find_object(w_current,
(int) event->x,
- (int) event->y);
+ (int) event->y, TRUE);
}
} else {
o_select_unselect_all(w_current);
@@ -555,7 +584,7 @@
if (!w_current->SHIFTKEY) {
o_find_object(w_current,
(int) event->x,
- (int) event->y);
+ (int) event->y, TRUE);
}
}
@@ -696,11 +725,14 @@
x_event_button_released(GtkWidget *widget, GdkEventButton *event,
TOPLEVEL *w_current)
{
+ int prev_state;
+ int redraw_state;
+
exit_if_null(w_current);
global_window_current = w_current;
#if DEBUG
- printf("released! %d \n", event_state);
+ printf("released! %d \n", w_current->event_state);
#endif
w_current->SHIFTKEY = (event->state & GDK_SHIFT_MASK ) ? 1 : 0;
@@ -721,6 +753,10 @@
w_current->event_state = ENDCOPY;
break;
+ case(MCOPY):
+ w_current->event_state = ENDMCOPY;
+ break;
+
case(GRIPS):
o_grips_end(w_current),
w_current->inside_action = 0;
@@ -744,6 +780,18 @@
i_update_toolbar(w_current);
break;
+ case(ENDMCOPY):
+ o_copy_end(w_current);
+ /* having this stay in copy was driving me nuts*/
+ w_current->inside_action = 1;
+ /* Keep the state and the inside_action, as the copy has not finished. */
+ w_current->last_x = w_current->start_x = fix_x(w_current, mouse_x);
+ w_current->last_y = w_current->start_y = fix_y(w_current, mouse_y);
+ i_set_state(w_current, ENDMCOPY);
+ i_update_toolbar(w_current);
+ o_undo_savestate(w_current, UNDO_ALL);
+ break;
+
case(SBOX):
/* fix_x,y was removed to allow more flex */
w_current->last_x = (int) event->x;
@@ -779,7 +827,7 @@
/* now go looking for objects to select */
o_find_object(w_current,
(int) event->x,
- (int) event->y);
+ (int) event->y, TRUE);
w_current->event_state = SELECT;
w_current->inside_action = 0;
} else {
@@ -827,6 +875,36 @@
return(0);
}
+ else if ((w_current->event_state == ENDMOVE) ||
+ (w_current->event_state == ENDCOPY) ||
+ (w_current->event_state == ENDMCOPY) ) {
+ g_assert (w_current->page_current->selection2_head != NULL);
+ prev_state = w_current->event_state;
+
+ o_drawbounding(w_current, NULL,
+ w_current->page_current->selection2_head->next,
+ x_get_darkcolor(w_current->bb_color), TRUE);
+
+ /* Don't allow o_rotate_90 to erase the selection, neither to
+ redraw the objects after rotating */
+ /* skip over head node */
+ redraw_state = w_current->DONT_REDRAW;
+ w_current->DONT_REDRAW = 1;
+
+ o_rotate_90(w_current, w_current->page_current->selection2_head->next,
+ fix_x(w_current, w_current->start_x),
+ fix_y(w_current, w_current->start_y));
+ w_current->DONT_REDRAW = redraw_state;
+ rotated_inside ++;
+ w_current->event_state = prev_state;
+
+ o_drawbounding(w_current, NULL,
+ w_current->page_current->selection2_head->next,
+ x_get_darkcolor(w_current->bb_color), TRUE);
+
+ return(0);
+ }
+
}
switch(w_current->middle_button) {
@@ -993,6 +1071,52 @@
o_grips_motion(w_current, (int) event->x, (int) event->y);
break;
+ case(STARTSELECT):
+ if ( (!w_current->drag_can_move) ||
+ (w_current->drag_can_move &&
+ (! o_find_object(w_current,
+ w_current->start_x, w_current->start_y, FALSE)))) {
+ temp_x = fix_x(w_current, (int) event->x);
+ temp_y = fix_y(w_current, (int) event->y);
+ /* is eight enough of a threshold? */
+ /* make this configurable anyways */
+ diff_x = fabs(w_current->page_current->right -
+ w_current->page_current->left);
+
+#ifdef HAS_RINT
+ zoom_scale = (int) rint(w_current->init_right / diff_x);
+#else
+ zoom_scale = (int) w_current->init_right / diff_x;
+#endif
+
+ if (zoom_scale < 10) {
+ zoom_scale = 10;
+ }
+
+ if ( (abs(temp_x - w_current->start_x) > zoom_scale) ||
+ (abs(temp_y - w_current->start_y) > zoom_scale) ) {
+ w_current->event_state = SBOX;
+ /* NEW SELECTION code */
+ o_select_box_start(w_current,
+ (int) event->x,
+ (int) event->y);
+ w_current->inside_action = 1;
+ }
+ break;
+ }
+ else {
+ /* Start the object movement */
+ rotated_inside = 0;
+ o_move_start(w_current,
+ (int) event->x, (int) event->y);
+ w_current->event_state = ENDMOVE;
+ w_current->inside_action = 1;
+
+ /* Continue to the MOVE actions */
+ /* Important!! keep the MOVE and ENDMOVE cases below this
+ without the break statement!! */
+ }
+
case(ENDMOVE):
case(MOVE):
if (w_current->inside_action) {
@@ -1021,6 +1145,8 @@
case(ENDCOPY):
case(COPY):
+ case(ENDMCOPY):
+ case(MCOPY):
if (w_current->inside_action) {
o_drawbounding(
w_current, NULL,
@@ -1146,35 +1272,6 @@
o_text_rubberattrib(w_current);
break;
- case(STARTSELECT):
- temp_x = fix_x(w_current, (int) event->x);
- temp_y = fix_y(w_current, (int) event->y);
- /* is eight enough of a threshold? */
- /* make this configurable anyways */
- diff_x = fabs(w_current->page_current->right -
- w_current->page_current->left);
-
-#ifdef HAS_RINT
- zoom_scale = (int) rint(w_current->init_right / diff_x);
-#else
- zoom_scale = (int) w_current->init_right / diff_x;
-#endif
-
- if (zoom_scale < 10) {
- zoom_scale = 10;
- }
-
- if ( (abs(temp_x - w_current->start_x) > zoom_scale) ||
- (abs(temp_y - w_current->start_y) > zoom_scale) ) {
- w_current->event_state = SBOX;
- /* NEW SELECTION code */
- o_select_box_start(w_current,
- (int) event->x,
- (int) event->y);
- w_current->inside_action = 1;
- }
- break;
-
case(SBOX):
if (w_current->inside_action)
/* NEW SELECTION code */
@@ -1358,7 +1455,7 @@
w_current->win_height = w_current->drawing_area->allocation.height;
#if DEBUG
- printf("manual: %d %d\n", win_width, win_height);
+ printf("manual: %d %d\n", w_current->win_width, w_current->win_height);
#endif
w_current->width = w_current->win_width;
@@ -1372,11 +1469,11 @@
w_current->page_current->bottom);
#if DEBUG
- printf("Coord aspect: %f Window aspect: %f\n",
- coord_aspectratio,
- (float) win_width / (float) win_height);
- printf("w: %d h: %d\n", width, height);
- printf("aw: %d ah: %d\n", win_width, win_height);
+ printf("Window aspect: %f\n",
+ (float) w_current->win_width / (float) w_current->win_height);
+ /* No longer used?
+ printf("w: %d h: %d\n", width, height); */
+ printf("aw: %d ah: %d\n", w_current->win_width, w_current->win_height);
#endif
/* I'm assuming that the backingstore pixmap is of the right
@@ -1465,7 +1562,8 @@
#if DEBUG
printf("vrange %f %f\n", vadjustment->lower, vadjustment->upper);
printf("vvalue %f\n", vadjustment->value);
- printf("actual: %d %d\n", top, bottom);
+ printf("actual: %d %d\n", w_current->page_current->top,
+ w_current->page_current->bottom);
#endif
if (!w_current->DONT_REDRAW) {
@@ -1512,6 +1610,9 @@
set_window_current_key(w_current);
if (event) {
+#if DEBUG
+ printf("x_event_key_pressed: Pressed key %i.\n", event->keyval);
+#endif
g_keys_execute(event->state, event->keyval);
}