Index: trunk/src/crosshair.c =================================================================== --- trunk/src/crosshair.c (revision 28091) +++ trunk/src/crosshair.c (revision 28092) @@ -1001,7 +1001,7 @@ } if (pcbhl_conf.editor.mode == PCB_MODE_LINE && pcb_crosshair.AttachedLine.State != PCB_CH_STATE_FIRST && conf_core.editor.auto_drc) - pcb_line_enforce_drc(); + pcb_line_enforce_drc(PCB); pcb_gui->set_crosshair(pcb_gui, pcb_crosshair.X, pcb_crosshair.Y, HID_SC_DO_NOTHING); } Index: trunk/src/obj_line.h =================================================================== --- trunk/src/obj_line.h (revision 28091) +++ trunk/src/obj_line.h (revision 28092) @@ -97,7 +97,7 @@ /* makes the attached line fit into a 45 degree direction */ void pcb_line_45(pcb_attached_line_t *); -void pcb_line_enforce_drc(void); +void pcb_line_enforce_drc(pcb_board_t *pcb); /* Calculate a pair of refractioned (ortho-45) lines between 'start' and 'end'. If 'mid_out' is not NULL, load it with the coords of the middle point. @@ -114,7 +114,7 @@ the fields of 'end' needed to find the closest point to the original target that still won't hit any object. Returns the straigh-line distance between start and the new end. */ -double pcb_drc_lines(const pcb_point_t *start, pcb_point_t *end, pcb_point_t *mid_out, pcb_bool way, pcb_bool optimize); +double pcb_drc_lines(pcb_board_t *pcb, const pcb_point_t *start, pcb_point_t *end, pcb_point_t *mid_out, pcb_bool way, pcb_bool optimize); /* Rather than mode the line bounding box, we set it so the point bounding Index: trunk/src/obj_line_drcenf.c =================================================================== --- trunk/src/obj_line_drcenf.c (revision 28091) +++ trunk/src/obj_line_drcenf.c (revision 28092) @@ -226,7 +226,7 @@ return PCB_R_DIR_FOUND_CONTINUE; } -double pcb_drc_lines(const pcb_point_t *start, pcb_point_t *end, pcb_point_t *mid_out, pcb_bool way, pcb_bool optimize) +double pcb_drc_lines(pcb_board_t *pcb, const pcb_point_t *start, pcb_point_t *end, pcb_point_t *mid_out, pcb_bool way, pcb_bool optimize) { double f, s, f2, s2, len, best; pcb_coord_t dx, dy, temp, last, length; @@ -261,7 +261,7 @@ length = coord_abs(dy); } - group = pcb_layer_get_group(PCB, INDEXOFCURRENT); + group = pcb_layer_get_group(PCB, PCB_CURRLID(pcb)); comp = PCB->LayerGroups.len + 10; /* this out-of-range group might save a call */ if (pcb_layergrp_flags(PCB, group) & PCB_LYT_BOTTOM) @@ -426,7 +426,7 @@ line.Point2 = aline.Point2; /* prepare for the intersection search */ - group = pcb_layer_get_group(PCB, INDEXOFCURRENT); + group = pcb_layer_get_group(PCB, PCB_CURRLID(pcb)); comp = PCB->LayerGroups.len + 10; /* this out-of-range group might save a call */ if (pcb_layergrp_flags(PCB, group) & PCB_LYT_BOTTOM) info.solder = pcb_true; @@ -459,7 +459,7 @@ end->Y = last_good.Y; } -void pcb_line_enforce_drc(void) +void pcb_line_enforce_drc(pcb_board_t *pcb) { pcb_point_t r45, rs, start; pcb_bool shift; @@ -466,7 +466,7 @@ double r1, r2; /* Silence a bogus compiler warning by storing this in a variable */ - pcb_layer_id_t layer_idx = INDEXOFCURRENT; + pcb_layer_id_t layer_idx = PCB_CURRLID(pcb); if (pcb_gui->mod1_is_pressed(pcb_gui) || pcb_gui->control_is_pressed(pcb_gui) || PCB->RatDraw) return; @@ -481,9 +481,9 @@ if (conf_core.editor.line_refraction != 0) { /* first try starting straight */ - r1 = pcb_drc_lines(&start, &rs, NULL, pcb_false, pcb_true); + r1 = pcb_drc_lines(pcb, &start, &rs, NULL, pcb_false, pcb_true); /* then try starting at 45 */ - r2 = pcb_drc_lines(&start, &r45, NULL, pcb_true, pcb_true); + r2 = pcb_drc_lines(pcb, &start, &r45, NULL, pcb_true, pcb_true); } else { drc_line(&rs); Index: trunk/src/object_act.c =================================================================== --- trunk/src/object_act.c (revision 28091) +++ trunk/src/object_act.c (revision 28092) @@ -801,17 +801,18 @@ { const char *a0, *a1; int old_index, new_index; + pcb_board_t *pcb = PCB_ACT_BOARD; PCB_ACT_CONVARG(1, FGW_STR, MoveLayer, a0 = argv[1].val.str); PCB_ACT_CONVARG(2, FGW_STR, MoveLayer, a1 = argv[2].val.str); if (strcmp(a0, "c") == 0) - old_index = INDEXOFCURRENT; + old_index = PCB_CURRLID(pcb); else old_index = atoi(a0); if (strcmp(a1, "c") == 0) { - new_index = INDEXOFCURRENT; + new_index = PCB_CURRLID(pcb); if (new_index < 0) new_index = 0; } @@ -831,7 +832,7 @@ return 0; } else if (strcmp(a1, "up") == 0) { - new_index = INDEXOFCURRENT - 1; + new_index = PCB_CURRLID(pcb) - 1; if (new_index < 0) { PCB_ACT_IRES(1); return 0; @@ -838,7 +839,7 @@ } } else if (strcmp(a1, "down") == 0) { - new_index = INDEXOFCURRENT + 1; + new_index = PCB_CURRLID(pcb) + 1; if (new_index >= pcb_max_layer) { PCB_ACT_IRES(1); return 0;