Index: trunk/src/insert.c =================================================================== --- trunk/src/insert.c (revision 30932) +++ trunk/src/insert.c (revision 30933) @@ -4,6 +4,7 @@ * pcb-rnd, interactive printed circuit board design * (this file is based on PCB, interactive printed circuit board design) * Copyright (C) 1994,1995,1996 Thomas Nau + * Copyright (C) 2020 Tibor 'Igor2' Palinkas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -36,6 +37,7 @@ #include "data.h" #include "select.h" #include "undo.h" +#include "brave.h" #include "obj_line_op.h" #include "obj_arc_op.h" @@ -85,6 +87,12 @@ rnd_coord_t x, y, m1, m2; pcb_line_t *line = (pcb_line_t *) pcb_crosshair.AttachedObject.Ptr2; + if (!(pcb_brave & PCB_BRAVE_OLDINSERT)) { + InsertedPoint.X = pcb_crosshair.X; + InsertedPoint.Y = pcb_crosshair.Y; + return &InsertedPoint; + } + if (pcb_crosshair.AttachedObject.State == PCB_CH_STATE_FIRST) return NULL; pcb_crosshair.AttachedObject.Ptr3 = &InsertedPoint; Index: trunk/src/obj_line.c =================================================================== --- trunk/src/obj_line.c (revision 30932) +++ trunk/src/obj_line.c (revision 30933) @@ -34,6 +34,7 @@ #include "undo.h" #include "board.h" +#include "brave.h" #include "data.h" #include "move.h" #include "search.h" @@ -1079,7 +1080,13 @@ /* we must create after playing with Line since creation may * invalidate the line pointer */ - if ((line = pcb_line_new_merge(Layer, ctx->insert.x, ctx->insert.y, X, Y, Line->Thickness, Line->Clearance, Line->Flags))) { + + if (pcb_brave & PCB_BRAVE_OLDINSERT) + line = pcb_line_new_merge(Layer, ctx->insert.x, ctx->insert.y, X, Y, Line->Thickness, Line->Clearance, Line->Flags); + else + line = pcb_line_new(Layer, ctx->insert.x, ctx->insert.y, X, Y, Line->Thickness, Line->Clearance, Line->Flags); + + if (line) { pcb_line_copy_meta(line, Line); pcb_undo_add_obj_to_create(PCB_OBJ_LINE, Layer, line, line); pcb_line_invalidate_draw(Layer, line); Index: trunk/src_plugins/tool_std/tool_insert.c =================================================================== --- trunk/src_plugins/tool_std/tool_insert.c (revision 30932) +++ trunk/src_plugins/tool_std/tool_insert.c (revision 30933) @@ -4,7 +4,7 @@ * pcb-rnd, interactive printed circuit board design * Copyright (C) 1994,1995,1996 Thomas Nau * Copyright (C) 1997, 1998, 1999, 2000, 2001 Harry Eaton - * Copyright (C) 2017,2019 Tibor 'Igor2' Palinkas + * Copyright (C) 2017,2019,2020 Tibor 'Igor2' Palinkas * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -39,6 +39,7 @@ #include "insert.h" #include "polygon.h" #include "search.h" +#include "brave.h" #include @@ -87,8 +88,27 @@ pcb_crosshair.AttachedObject.Ptr2 = &fake.line; } - pcb_crosshair.AttachedObject.State = PCB_CH_STATE_SECOND; - InsertedPoint = *pcb_adjust_insert_point(); + if (!(pcb_brave & PCB_BRAVE_OLDINSERT)) { + InsertedPoint = *pcb_adjust_insert_point(); + pcb_crosshair_set_local_ref(InsertedPoint.X, InsertedPoint.Y, pcb_true); + if (pcb_crosshair.AttachedObject.Type == PCB_OBJ_POLY) + pcb_insert_point_in_object(PCB_OBJ_POLY, + pcb_crosshair.AttachedObject.Ptr1, fake.poly, + &polyIndex, InsertedPoint.X, InsertedPoint.Y, pcb_false, pcb_false); + else + pcb_insert_point_in_object(pcb_crosshair.AttachedObject.Type, + pcb_crosshair.AttachedObject.Ptr1, + pcb_crosshair.AttachedObject.Ptr2, &polyIndex, InsertedPoint.X, InsertedPoint.Y, pcb_false, pcb_false); + pcb_board_set_changed_flag(pcb_true); + + pcb_crosshair.AttachedObject.Type = PCB_OBJ_VOID; + pcb_crosshair.AttachedObject.State = PCB_CH_STATE_FIRST; + pcb_crosshair.extobj_edit = NULL; + } + else { + pcb_crosshair.AttachedObject.State = PCB_CH_STATE_SECOND; + InsertedPoint = *pcb_adjust_insert_point(); + } } } break;