Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 16503) +++ trunk/src/crosshair.c (revision 16504) @@ -1107,83 +1107,9 @@ pcb_message(PCB_MSG_ERROR, "hace: underflow of restore mode\n"); return; } - pcb_crosshair_set_mode(mode_stack[--mode_position]); + pcb_tool_select_by_id(mode_stack[--mode_position]); } - -/* set a new mode and update X cursor */ -void pcb_crosshair_set_mode(int Mode) -{ - char sMode[32]; - static pcb_bool recursing = pcb_false; - /* protect the cursor while changing the mode - * perform some additional stuff depending on the new mode - * reset 'state' of attached objects - */ - if (recursing) - return; - recursing = pcb_true; - pcb_notify_crosshair_change(pcb_false); - pcb_added_lines = 0; - pcb_route_reset(&pcb_crosshair.Route); - pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; - pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; - pcb_crosshair.AttachedPolygon.PointN = 0; - if (PCB->RatDraw) { - if (Mode == PCB_MODE_ARC || Mode == PCB_MODE_RECTANGLE || - Mode == PCB_MODE_VIA || Mode == PCB_MODE_POLYGON || - Mode == PCB_MODE_POLYGON_HOLE || Mode == PCB_MODE_TEXT || Mode == PCB_MODE_THERMAL) { - pcb_message(PCB_MSG_WARNING, _("That mode is NOT allowed when drawing ratlines!\n")); - Mode = PCB_MODE_NO; - } - } - if (conf_core.editor.mode == PCB_MODE_LINE && Mode == PCB_MODE_ARC && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) { - pcb_crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; - pcb_crosshair.AttachedBox.State = PCB_CH_STATE_SECOND; - pcb_crosshair.AttachedBox.Point1.X = pcb_crosshair.AttachedBox.Point2.X = pcb_crosshair.AttachedLine.Point1.X; - pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair.AttachedBox.Point2.Y = pcb_crosshair.AttachedLine.Point1.Y; - pcb_adjust_attached_objects(); - } - else if (conf_core.editor.mode == PCB_MODE_ARC && Mode == PCB_MODE_LINE && pcb_crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) { - pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; - pcb_crosshair.AttachedLine.State = PCB_CH_STATE_SECOND; - pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X = pcb_crosshair.AttachedBox.Point1.X; - pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y = pcb_crosshair.AttachedBox.Point1.Y; - sprintf(sMode, "%d", Mode); - conf_set(CFR_DESIGN, "editor/mode", -1, sMode, POL_OVERWRITE); - pcb_adjust_attached_objects(); - } - else { - if (conf_core.editor.mode == PCB_MODE_ARC || conf_core.editor.mode == PCB_MODE_LINE) - pcb_crosshair_set_local_ref(0, 0, pcb_false); - pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; - pcb_crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; - if (Mode == PCB_MODE_LINE && conf_core.editor.auto_drc) { - if (pcb_reset_conns(pcb_true)) { - pcb_undo_inc_serial(); - pcb_draw(); - } - } - } - - sprintf(sMode, "%d", Mode); - conf_set(CFR_DESIGN, "editor/mode", -1, sMode, POL_OVERWRITE); - - if (Mode == PCB_MODE_PASTE_BUFFER) - /* do an update on the crosshair range */ - pcb_crosshair_range_to_buffer(); - else - pcb_crosshair_set_range(0, 0, PCB->MaxWidth, PCB->MaxHeight); - - recursing = pcb_false; - - /* force a crosshair grid update because the valid range - * may have changed - */ - pcb_crosshair_move_relative(0, 0); - pcb_notify_crosshair_change(pcb_true); -} - void pcb_crosshair_set_local_ref(pcb_coord_t X, pcb_coord_t Y, pcb_bool Showing) { static pcb_mark_t old; Index: trunk/src/crosshair.h =================================================================== --- trunk/src/crosshair.h (revision 16503) +++ trunk/src/crosshair.h (revision 16504) @@ -120,7 +120,6 @@ void pcb_crosshair_range_to_buffer(void); void pcb_crosshair_save_mode(void); void pcb_crosshair_restore_mode(void); -void pcb_crosshair_set_mode(int Mode); void pcb_crosshair_set_local_ref(pcb_coord_t X, pcb_coord_t Y, pcb_bool Showing); Index: trunk/src/file_act.c =================================================================== --- trunk/src/file_act.c (revision 16503) +++ trunk/src/file_act.c (revision 16504) @@ -131,7 +131,7 @@ if (pcb_strcasecmp(function, "ElementToBuffer") == 0) { pcb_notify_crosshair_change(pcb_false); if (pcb_buffer_load_footprint(PCB_PASTEBUFFER, name, format)) - pcb_crosshair_set_mode(PCB_MODE_PASTE_BUFFER); + pcb_tool_select_by_id(PCB_MODE_PASTE_BUFFER); pcb_notify_crosshair_change(pcb_true); } @@ -138,7 +138,7 @@ else if (pcb_strcasecmp(function, "LayoutToBuffer") == 0) { pcb_notify_crosshair_change(pcb_false); if (pcb_buffer_load_layout(PCB, PCB_PASTEBUFFER, name, format)) - pcb_crosshair_set_mode(PCB_MODE_PASTE_BUFFER); + pcb_tool_select_by_id(PCB_MODE_PASTE_BUFFER); pcb_notify_crosshair_change(pcb_true); } Index: trunk/src/gui_act.c =================================================================== --- trunk/src/gui_act.c (revision 16503) +++ trunk/src/gui_act.c (revision 16504) @@ -565,34 +565,34 @@ pcb_notify_crosshair_change(pcb_false); switch (pcb_funchash_get(function, NULL)) { case F_Arc: - pcb_crosshair_set_mode(PCB_MODE_ARC); + pcb_tool_select_by_id(PCB_MODE_ARC); break; case F_Arrow: - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); break; case F_Copy: - pcb_crosshair_set_mode(PCB_MODE_COPY); + pcb_tool_select_by_id(PCB_MODE_COPY); break; case F_InsertPoint: - pcb_crosshair_set_mode(PCB_MODE_INSERT_POINT); + pcb_tool_select_by_id(PCB_MODE_INSERT_POINT); break; case F_Line: - pcb_crosshair_set_mode(PCB_MODE_LINE); + pcb_tool_select_by_id(PCB_MODE_LINE); break; case F_Lock: - pcb_crosshair_set_mode(PCB_MODE_LOCK); + pcb_tool_select_by_id(PCB_MODE_LOCK); break; case F_Move: - pcb_crosshair_set_mode(PCB_MODE_MOVE); + pcb_tool_select_by_id(PCB_MODE_MOVE); break; case F_None: - pcb_crosshair_set_mode(PCB_MODE_NO); + pcb_tool_select_by_id(PCB_MODE_NO); break; case F_Cancel: { int saved_mode = conf_core.editor.mode; - pcb_crosshair_set_mode(PCB_MODE_NO); - pcb_crosshair_set_mode(saved_mode); + pcb_tool_select_by_id(PCB_MODE_NO); + pcb_tool_select_by_id(saved_mode); } break; case F_Escape: @@ -609,53 +609,53 @@ case PCB_MODE_RUBBERBAND_MOVE: case PCB_MODE_THERMAL: case PCB_MODE_LOCK: - pcb_crosshair_set_mode(PCB_MODE_NO); - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_NO); + pcb_tool_select_by_id(PCB_MODE_ARROW); pcb_tool_note.Hit = pcb_tool_note.Click = 0; /* if the mouse button is still pressed, don't start selecting a box */ break; case PCB_MODE_LINE: if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); else { - pcb_crosshair_set_mode(PCB_MODE_NO); - pcb_crosshair_set_mode(PCB_MODE_LINE); + pcb_tool_select_by_id(PCB_MODE_NO); + pcb_tool_select_by_id(PCB_MODE_LINE); } break; case PCB_MODE_RECTANGLE: if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_FIRST) - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); else { - pcb_crosshair_set_mode(PCB_MODE_NO); - pcb_crosshair_set_mode(PCB_MODE_RECTANGLE); + pcb_tool_select_by_id(PCB_MODE_NO); + pcb_tool_select_by_id(PCB_MODE_RECTANGLE); } break; case PCB_MODE_POLYGON: if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); else { - pcb_crosshair_set_mode(PCB_MODE_NO); - pcb_crosshair_set_mode(PCB_MODE_POLYGON); + pcb_tool_select_by_id(PCB_MODE_NO); + pcb_tool_select_by_id(PCB_MODE_POLYGON); } break; case PCB_MODE_POLYGON_HOLE: if (pcb_crosshair.AttachedLine.State == PCB_CH_STATE_FIRST) - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); else { - pcb_crosshair_set_mode(PCB_MODE_NO); - pcb_crosshair_set_mode(PCB_MODE_POLYGON_HOLE); + pcb_tool_select_by_id(PCB_MODE_NO); + pcb_tool_select_by_id(PCB_MODE_POLYGON_HOLE); } break; case PCB_MODE_ARC: if (pcb_crosshair.AttachedBox.State == PCB_CH_STATE_FIRST) - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); else { - pcb_crosshair_set_mode(PCB_MODE_NO); - pcb_crosshair_set_mode(PCB_MODE_ARC); + pcb_tool_select_by_id(PCB_MODE_NO); + pcb_tool_select_by_id(PCB_MODE_ARC); } break; @@ -672,13 +672,13 @@ pcb_notify_mode(); break; case F_PasteBuffer: - pcb_crosshair_set_mode(PCB_MODE_PASTE_BUFFER); + pcb_tool_select_by_id(PCB_MODE_PASTE_BUFFER); break; case F_Polygon: - pcb_crosshair_set_mode(PCB_MODE_POLYGON); + pcb_tool_select_by_id(PCB_MODE_POLYGON); break; case F_PolygonHole: - pcb_crosshair_set_mode(PCB_MODE_POLYGON_HOLE); + pcb_tool_select_by_id(PCB_MODE_POLYGON_HOLE); break; case F_Release: if ((pcb_mid_stroke) && (conf_core.editor.enable_stroke)) @@ -687,13 +687,13 @@ pcb_release_mode(); break; case F_Remove: - pcb_crosshair_set_mode(PCB_MODE_REMOVE); + pcb_tool_select_by_id(PCB_MODE_REMOVE); break; case F_Rectangle: - pcb_crosshair_set_mode(PCB_MODE_RECTANGLE); + pcb_tool_select_by_id(PCB_MODE_RECTANGLE); break; case F_Rotate: - pcb_crosshair_set_mode(PCB_MODE_ROTATE); + pcb_tool_select_by_id(PCB_MODE_ROTATE); break; case F_Stroke: if (conf_core.editor.enable_stroke) { @@ -704,29 +704,29 @@ | a drawing mode, middle mouse button will select objects. */ if (conf_core.editor.mode == PCB_MODE_LINE && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) { - pcb_crosshair_set_mode(PCB_MODE_LINE); + pcb_tool_select_by_id(PCB_MODE_LINE); } else if (conf_core.editor.mode == PCB_MODE_ARC && pcb_crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) - pcb_crosshair_set_mode(PCB_MODE_ARC); + pcb_tool_select_by_id(PCB_MODE_ARC); else if (conf_core.editor.mode == PCB_MODE_RECTANGLE && pcb_crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) - pcb_crosshair_set_mode(PCB_MODE_RECTANGLE); + pcb_tool_select_by_id(PCB_MODE_RECTANGLE); else if (conf_core.editor.mode == PCB_MODE_POLYGON && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) - pcb_crosshair_set_mode(PCB_MODE_POLYGON); + pcb_tool_select_by_id(PCB_MODE_POLYGON); else { pcb_crosshair_save_mode(); pcb_tool_is_saved = pcb_true; - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); pcb_notify_mode(); } break; case F_Text: - pcb_crosshair_set_mode(PCB_MODE_TEXT); + pcb_tool_select_by_id(PCB_MODE_TEXT); break; case F_Thermal: - pcb_crosshair_set_mode(PCB_MODE_THERMAL); + pcb_tool_select_by_id(PCB_MODE_THERMAL); break; case F_Via: - pcb_crosshair_set_mode(PCB_MODE_VIA); + pcb_tool_select_by_id(PCB_MODE_VIA); break; case F_Restore: /* restore the last saved mode */ @@ -1074,7 +1074,7 @@ set_same_(((pcb_line_t *) ptr2)->Thickness, -1, -1, ((pcb_line_t *) ptr2)->Clearance / 2, NULL); layer = (pcb_layer_t *) ptr1; if (conf_core.editor.mode != PCB_MODE_LINE) - pcb_crosshair_set_mode(PCB_MODE_LINE); + pcb_tool_select_by_id(PCB_MODE_LINE); pcb_notify_crosshair_change(pcb_true); pcb_event(PCB_EVENT_ROUTE_STYLES_CHANGED, NULL); break; @@ -1084,7 +1084,7 @@ set_same_(((pcb_arc_t *) ptr2)->Thickness, -1, -1, ((pcb_arc_t *) ptr2)->Clearance / 2, NULL); layer = (pcb_layer_t *) ptr1; if (conf_core.editor.mode != PCB_MODE_ARC) - pcb_crosshair_set_mode(PCB_MODE_ARC); + pcb_tool_select_by_id(PCB_MODE_ARC); pcb_notify_crosshair_change(pcb_true); pcb_event(PCB_EVENT_ROUTE_STYLES_CHANGED, NULL); break; Index: trunk/src/main.c =================================================================== --- trunk/src/main.c (revision 16503) +++ trunk/src/main.c (revision 16504) @@ -597,7 +597,7 @@ InitHandler(); pcb_init_buffers(PCB); - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); if (command_line_pcb) { /* keep filename even if initial load command failed; @@ -656,7 +656,7 @@ pcb_gui->parse_arguments(&hid_argc, &hid_argv); if (pcb_gui->gui) pcb_crosshair_init(); - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); pcb_event(PCB_EVENT_LIBRARY_CHANGED, NULL); } } while(pcb_gui != NULL); Index: trunk/src/remove_act.c =================================================================== --- trunk/src/remove_act.c (revision 16503) +++ trunk/src/remove_act.c (revision 16504) @@ -63,7 +63,7 @@ case F_Object: pcb_gui->get_coords("Click on object to delete", &pcb_tool_note.X, &pcb_tool_note.Y); pcb_crosshair_save_mode(); - pcb_crosshair_set_mode(PCB_MODE_REMOVE); + pcb_tool_select_by_id(PCB_MODE_REMOVE); pcb_notify_mode(); pcb_crosshair_restore_mode(); break; Index: trunk/src/tool.c =================================================================== --- trunk/src/tool.c (revision 16503) +++ trunk/src/tool.c (revision 16504) @@ -30,13 +30,13 @@ #include "board.h" #include "conf_core.h" +#include "crosshair.h" +#include "compat_nls.h" #include "data.h" #include "error.h" #include "event.h" #include "grid.h" -#warning tool TODO: remove this when pcb_crosshair_set_mode() got moved here -#include "crosshair.h" static void default_tool_reg(void); static void default_tool_unreg(void); @@ -95,15 +95,83 @@ pcb_toolid_t id = pcb_tool_lookup(name); if (id == PCB_TOOLID_INVALID) return -1; - pcb_crosshair_set_mode(id); - return 0; + return pcb_tool_select_by_id(id); } int pcb_tool_select_by_id(pcb_toolid_t id) { + char id_s[32]; + static pcb_bool recursing = pcb_false; + if ((id < 0) || (id > vtp0_len(&pcb_tools))) return -1; - pcb_crosshair_set_mode(id); + + /* protect the cursor while changing the mode + * perform some additional stuff depending on the new mode + * reset 'state' of attached objects + */ + if (recursing) + return -1; + recursing = pcb_true; + pcb_notify_crosshair_change(pcb_false); + pcb_added_lines = 0; + pcb_route_reset(&pcb_crosshair.Route); + pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; + pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedPolygon.PointN = 0; + if (PCB->RatDraw) { + if (id == PCB_MODE_ARC || id == PCB_MODE_RECTANGLE || + id == PCB_MODE_VIA || id == PCB_MODE_POLYGON || + id == PCB_MODE_POLYGON_HOLE || id == PCB_MODE_TEXT || id == PCB_MODE_THERMAL) { + pcb_message(PCB_MSG_WARNING, _("That mode is NOT allowed when drawing ratlines!\n")); + id = PCB_MODE_NO; + } + } + if (conf_core.editor.mode == PCB_MODE_LINE && id == PCB_MODE_ARC && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST) { + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedBox.Point1.X = pcb_crosshair.AttachedBox.Point2.X = pcb_crosshair.AttachedLine.Point1.X; + pcb_crosshair.AttachedBox.Point1.Y = pcb_crosshair.AttachedBox.Point2.Y = pcb_crosshair.AttachedLine.Point1.Y; + pcb_adjust_attached_objects(); + } + else if (conf_core.editor.mode == PCB_MODE_ARC && id == PCB_MODE_LINE && pcb_crosshair.AttachedBox.State != PCB_CH_STATE_FIRST) { + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_SECOND; + pcb_crosshair.AttachedLine.Point1.X = pcb_crosshair.AttachedLine.Point2.X = pcb_crosshair.AttachedBox.Point1.X; + pcb_crosshair.AttachedLine.Point1.Y = pcb_crosshair.AttachedLine.Point2.Y = pcb_crosshair.AttachedBox.Point1.Y; + sprintf(id_s, "%d", id); + conf_set(CFR_DESIGN, "editor/mode", -1, id_s, POL_OVERWRITE); + pcb_adjust_attached_objects(); + } + else { + if (conf_core.editor.mode == PCB_MODE_ARC || conf_core.editor.mode == PCB_MODE_LINE) + pcb_crosshair_set_local_ref(0, 0, pcb_false); + pcb_crosshair.AttachedBox.State = PCB_CH_STATE_FIRST; + pcb_crosshair.AttachedLine.State = PCB_CH_STATE_FIRST; + if (id == PCB_MODE_LINE && conf_core.editor.auto_drc) { + if (pcb_reset_conns(pcb_true)) { + pcb_undo_inc_serial(); + pcb_draw(); + } + } + } + + sprintf(id_s, "%d", id); + conf_set(CFR_DESIGN, "editor/mode", -1, id_s, POL_OVERWRITE); + + if (id == PCB_MODE_PASTE_BUFFER) + /* do an update on the crosshair range */ + pcb_crosshair_range_to_buffer(); + else + pcb_crosshair_set_range(0, 0, PCB->MaxWidth, PCB->MaxHeight); + + recursing = pcb_false; + + /* force a crosshair grid update because the valid range + * may have changed + */ + pcb_crosshair_move_relative(0, 0); + pcb_notify_crosshair_change(pcb_true); return 0; } @@ -120,8 +188,7 @@ } if (bestn == PCB_TOOLID_INVALID) return -1; - pcb_crosshair_set_mode(bestn); - return 0; + return pcb_tool_select_by_id(bestn); } /**** current tool function wrappers ****/ @@ -278,7 +345,6 @@ return pcb_false; } - #warning tool TODO: move this out to a tool plugin #include "tool_arc.h" Index: trunk/src/tool_arrow.c =================================================================== --- trunk/src/tool_arrow.c (revision 16503) +++ trunk/src/tool_arrow.c (revision 16504) @@ -65,7 +65,7 @@ pcb_remove_selected(); pcb_crosshair_save_mode(); pcb_tool_is_saved = pcb_true; - pcb_crosshair_set_mode(PCB_MODE_PASTE_BUFFER); + pcb_tool_select_by_id(PCB_MODE_PASTE_BUFFER); } else if (pcb_tool_note.Hit && !pcb_gui->shift_is_pressed()) { pcb_box_t box; @@ -72,7 +72,7 @@ pcb_crosshair_save_mode(); pcb_tool_is_saved = pcb_true; - pcb_crosshair_set_mode(pcb_gui->control_is_pressed()? PCB_MODE_COPY : PCB_MODE_MOVE); + pcb_tool_select_by_id(pcb_gui->control_is_pressed()? PCB_MODE_COPY : PCB_MODE_MOVE); pcb_crosshair.AttachedObject.Ptr1 = pcb_tool_note.ptr1; pcb_crosshair.AttachedObject.Ptr2 = pcb_tool_note.ptr2; pcb_crosshair.AttachedObject.Ptr3 = pcb_tool_note.ptr3; Index: trunk/src/tool_line.c =================================================================== --- trunk/src/tool_line.c (revision 16503) +++ trunk/src/tool_line.c (revision 16504) @@ -114,7 +114,7 @@ * the file after saving. */ if (pcb_crosshair.X == pcb_crosshair.AttachedLine.Point1.X && pcb_crosshair.Y == pcb_crosshair.AttachedLine.Point1.Y) { - pcb_crosshair_set_mode(PCB_MODE_LINE); + pcb_tool_select_by_id(PCB_MODE_LINE); return; } Index: trunk/src_plugins/hid_lesstif/library.c =================================================================== --- trunk/src_plugins/hid_lesstif/library.c (revision 16503) +++ trunk/src_plugins/hid_lesstif/library.c (revision 16504) @@ -66,7 +66,7 @@ pcb_fplibrary_t *e = picks.array[last_pick]; e = &e->data.dir.children.array[cbs->item_position - 1]; if (pcb_buffer_load_footprint(PCB_PASTEBUFFER, e->data.fp.loc_info, NULL)) - pcb_crosshair_set_mode(PCB_MODE_PASTE_BUFFER); + pcb_tool_select_by_id(PCB_MODE_PASTE_BUFFER); } static int build_library_dialog() Index: trunk/src_plugins/lib_gtk_common/bu_mode_btn.c =================================================================== --- trunk/src_plugins/lib_gtk_common/bu_mode_btn.c (revision 16503) +++ trunk/src_plugins/lib_gtk_common/bu_mode_btn.c (revision 16504) @@ -75,7 +75,7 @@ static void do_set_mode(pcb_gtk_mode_btn_t *mbb, int mode) { - pcb_crosshair_set_mode(mode); + pcb_tool_select_by_id(mode); mbb->com->mode_cursor_main(mode); mbb->settings_mode = mode; } Index: trunk/src_plugins/lib_gtk_common/dlg_library.c =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_library.c (revision 16503) +++ trunk/src_plugins/lib_gtk_common/dlg_library.c (revision 16504) @@ -258,9 +258,9 @@ return; fullp = entry->data.fp.loc_info; } - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); if (pcb_buffer_load_footprint(PCB_PASTEBUFFER, name == NULL ? fullp : name, NULL)) - pcb_crosshair_set_mode(PCB_MODE_PASTE_BUFFER); + pcb_tool_select_by_id(PCB_MODE_PASTE_BUFFER); /* update the preview with new symbol data */ if (PCB_PASTEBUFFER->Data != NULL) { Index: trunk/src_plugins/lib_gtk_common/dlg_topwin.c =================================================================== --- trunk/src_plugins/lib_gtk_common/dlg_topwin.c (revision 16503) +++ trunk/src_plugins/lib_gtk_common/dlg_topwin.c (revision 16504) @@ -123,7 +123,7 @@ { pcb_gtk_topwin_t *tw = topwin; if (conf_core.editor.mode == PCB_MODE_NO) - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); tw->com->mode_cursor_main(conf_core.editor.mode); if (tw->mode_btn.settings_mode != conf_core.editor.mode) { ghid_mode_buttons_update(); @@ -566,7 +566,7 @@ ghid_update_toggle_flags(tw, NULL); pcb_gtk_icons_init(GTK_WINDOW(tw->com->top_window)); - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); ghid_mode_buttons_update(); } Index: trunk/src_plugins/shand_cmd/command.c =================================================================== --- trunk/src_plugins/shand_cmd/command.c (revision 16503) +++ trunk/src_plugins/shand_cmd/command.c (revision 16504) @@ -156,7 +156,7 @@ case 1: /* filename is passed in commandline */ filename = argv[0]; if (filename && pcb_buffer_load_footprint(PCB_PASTEBUFFER, filename, NULL)) - pcb_crosshair_set_mode(PCB_MODE_PASTE_BUFFER); + pcb_tool_select_by_id(PCB_MODE_PASTE_BUFFER); break; default: /* usage */ @@ -192,7 +192,7 @@ case 1: /* filename is passed in commandline */ filename = argv[0]; if (filename && pcb_buffer_load_layout(PCB, PCB_PASTEBUFFER, filename, format)) - pcb_crosshair_set_mode(PCB_MODE_PASTE_BUFFER); + pcb_tool_select_by_id(PCB_MODE_PASTE_BUFFER); break; default: /* usage */ Index: trunk/src_plugins/shape/shape.c =================================================================== --- trunk/src_plugins/shape/shape.c (revision 16503) +++ trunk/src_plugins/shape/shape.c (revision 16504) @@ -196,7 +196,7 @@ pcb_r_delete_entry(CURRENT->polygon_tree, (pcb_box_t *)p); pcb_poly_free_fields(p); pcb_poly_free(p); - pcb_crosshair_set_mode(PCB_MODE_PASTE_BUFFER); + pcb_tool_select_by_id(PCB_MODE_PASTE_BUFFER); } return p; } @@ -244,7 +244,7 @@ pcb_copy_obj_to_buffer(PCB, data, PCB->Data, PCB_OBJ_LINE, CURRENT, l, l); pcb_r_delete_entry(CURRENT->line_tree, (pcb_box_t *)l); pcb_line_free(l); - pcb_crosshair_set_mode(PCB_MODE_PASTE_BUFFER); + pcb_tool_select_by_id(PCB_MODE_PASTE_BUFFER); } } return l; Index: trunk/src_plugins/stroke/stroke.c =================================================================== --- trunk/src_plugins/stroke/stroke.c (revision 16503) +++ trunk/src_plugins/stroke/stroke.c (revision 16504) @@ -67,7 +67,7 @@ switch (num) { case 456: if (conf_core.editor.mode == PCB_MODE_LINE) { - pcb_crosshair_set_mode(PCB_MODE_LINE); + pcb_tool_select_by_id(PCB_MODE_LINE); } break; case 9874123: @@ -84,10 +84,10 @@ pcb_screen_obj_rotate90(StrokeBox.X1, StrokeBox.Y1, conf_core.editor.show_solder_side ? 3 : 1); break; case 258: - pcb_crosshair_set_mode(PCB_MODE_LINE); + pcb_tool_select_by_id(PCB_MODE_LINE); break; case 852: - pcb_crosshair_set_mode(PCB_MODE_ARROW); + pcb_tool_select_by_id(PCB_MODE_ARROW); break; case 1478963: pcb_act_Undo(0, NULL, 0, 0); @@ -101,7 +101,7 @@ case 147863: case 147853: case 145863: - pcb_crosshair_set_mode(PCB_MODE_VIA); + pcb_tool_select_by_id(PCB_MODE_VIA); break; case 951: case 9651: