840
by dickelbeck
beautify |
1 |
/************************************/
|
1938
by stambaughw
Begin translating comments to English and minor code clean up. |
2 |
/* delete.cpp */
|
840
by dickelbeck
beautify |
3 |
/************************************/
|
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
4 |
|
5 |
#include "fctsys.h" |
|
6 |
#include "gr_basic.h" |
|
7 |
#include "common.h" |
|
8 |
||
9 |
#include "program.h" |
|
10 |
#include "general.h" |
|
11 |
#include "protos.h" |
|
1735
by charras
work in progress about ERC and markers in eeschema |
12 |
#include "class_marker_sch.h" |
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
13 |
|
1763
by charras
Rework on undo/redo and block functions |
14 |
// Imported function:
|
1824
by stambaughw
Component library object improvements. |
15 |
void DeleteItemsInList( WinEDA_DrawPanel* panel, |
16 |
PICKED_ITEMS_LIST& aItemsList ); |
|
17 |
||
18 |
||
19 |
/*
|
|
20 |
* Count number of items connected to point pos :
|
|
21 |
* pins, end wire or bus, and junctions if TstJunction == TRUE
|
|
22 |
* Return this count
|
|
23 |
*
|
|
24 |
* Used by WinEDA_SchematicFrame::DeleteConnection()
|
|
25 |
*/
|
|
840
by dickelbeck
beautify |
26 |
static int CountConnectedItems( WinEDA_SchematicFrame* frame, |
1824
by stambaughw
Component library object improvements. |
27 |
SCH_ITEM* ListStruct, wxPoint pos, |
28 |
bool TstJunction ) |
|
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
29 |
{
|
933
by charras
eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization. |
30 |
SCH_ITEM* Struct; |
840
by dickelbeck
beautify |
31 |
int count = 0; |
32 |
||
33 |
if( frame->LocatePinEnd( ListStruct, pos ) ) |
|
34 |
count++; |
|
35 |
||
933
by charras
eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization. |
36 |
for( Struct = ListStruct; Struct != NULL; Struct = Struct->Next() ) |
840
by dickelbeck
beautify |
37 |
{
|
38 |
if( Struct->m_Flags & STRUCT_DELETED ) |
|
39 |
continue; |
|
40 |
if( Struct->m_Flags & SKIP_STRUCT ) |
|
41 |
continue; |
|
42 |
||
43 |
||
1938
by stambaughw
Begin translating comments to English and minor code clean up. |
44 |
if( TstJunction && ( Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) ) |
840
by dickelbeck
beautify |
45 |
{
|
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
46 |
#define JUNCTION ( (SCH_JUNCTION*) Struct )
|
1938
by stambaughw
Begin translating comments to English and minor code clean up. |
47 |
if( JUNCTION->m_Pos == pos ) |
840
by dickelbeck
beautify |
48 |
count++; |
49 |
#undef JUNCTION
|
|
50 |
}
|
|
51 |
||
52 |
if( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) |
|
53 |
continue; |
|
54 |
||
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
55 |
#define SEGM ( (SCH_LINE*) Struct )
|
840
by dickelbeck
beautify |
56 |
if( SEGM->IsOneEndPointAt( pos ) ) |
57 |
count++; |
|
58 |
#undef SEGM
|
|
59 |
}
|
|
60 |
||
61 |
return count; |
|
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
62 |
}
|
63 |
||
840
by dickelbeck
beautify |
64 |
|
1824
by stambaughw
Component library object improvements. |
65 |
|
66 |
/*
|
|
67 |
* Mark to "CANDIDATE" all wires or junction connected to "segment" in list
|
|
68 |
* "ListStruct"
|
|
69 |
* Search wire stop at an any pin
|
|
70 |
*
|
|
71 |
* Used by WinEDA_SchematicFrame::DeleteConnection()
|
|
72 |
*/
|
|
933
by charras
eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization. |
73 |
static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct, |
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
74 |
SCH_LINE* segment ) |
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
75 |
{
|
840
by dickelbeck
beautify |
76 |
EDA_BaseStruct* Struct; |
77 |
||
933
by charras
eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization. |
78 |
for( Struct = ListStruct; Struct != NULL; Struct = Struct->Next() ) |
840
by dickelbeck
beautify |
79 |
{
|
80 |
if( Struct->m_Flags ) |
|
81 |
continue; |
|
82 |
if( Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) |
|
83 |
{
|
|
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
84 |
#define JUNCTION ( (SCH_JUNCTION*) Struct )
|
840
by dickelbeck
beautify |
85 |
if( segment->IsOneEndPointAt( JUNCTION->m_Pos ) ) |
86 |
Struct->m_Flags |= CANDIDATE; |
|
87 |
continue; |
|
88 |
#undef JUNCTION
|
|
89 |
}
|
|
90 |
||
91 |
if( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) |
|
92 |
continue; |
|
93 |
||
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
94 |
#define SEGM ( (SCH_LINE*) Struct )
|
840
by dickelbeck
beautify |
95 |
if( segment->IsOneEndPointAt( SEGM->m_Start ) ) |
96 |
{
|
|
97 |
if( !frame->LocatePinEnd( ListStruct, SEGM->m_Start ) ) |
|
98 |
{
|
|
99 |
Struct->m_Flags |= CANDIDATE; |
|
100 |
MarkConnected( frame, ListStruct, SEGM ); |
|
101 |
}
|
|
102 |
}
|
|
103 |
if( segment->IsOneEndPointAt( SEGM->m_End ) ) |
|
104 |
{
|
|
105 |
if( !frame->LocatePinEnd( ListStruct, SEGM->m_End ) ) |
|
106 |
{
|
|
107 |
Struct->m_Flags |= CANDIDATE; |
|
108 |
MarkConnected( frame, ListStruct, SEGM ); |
|
109 |
}
|
|
110 |
}
|
|
111 |
#undef SEGM
|
|
112 |
}
|
|
113 |
||
114 |
return TRUE; |
|
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
115 |
}
|
116 |
||
840
by dickelbeck
beautify |
117 |
|
1824
by stambaughw
Component library object improvements. |
118 |
/*
|
119 |
* Delete a connection, i.e wires or bus connected
|
|
120 |
* stop on a node (more than 2 wires (bus) connected)
|
|
121 |
*/
|
|
1763
by charras
Rework on undo/redo and block functions |
122 |
void WinEDA_SchematicFrame::DeleteConnection( bool DeleteFullConnection ) |
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
123 |
{
|
840
by dickelbeck
beautify |
124 |
wxPoint refpos = GetScreen()->m_Curseur; |
933
by charras
eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization. |
125 |
SCH_ITEM* DelStruct; |
1763
by charras
Rework on undo/redo and block functions |
126 |
PICKED_ITEMS_LIST pickList; |
840
by dickelbeck
beautify |
127 |
|
128 |
/* Clear .m_Flags member for all items */
|
|
1824
by stambaughw
Component library object improvements. |
129 |
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; |
130 |
DelStruct = DelStruct->Next() ) |
|
840
by dickelbeck
beautify |
131 |
DelStruct->m_Flags = 0; |
132 |
||
133 |
BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() ); |
|
134 |
||
1824
by stambaughw
Component library object improvements. |
135 |
/* Locate all the wires, bus or junction under the mouse cursor, and put
|
136 |
* them in a list of items to delete
|
|
840
by dickelbeck
beautify |
137 |
*/
|
1764
by charras
Rework on undo/redo and block functions: more efficient code to undo/redo block move and mirror operations |
138 |
ITEM_PICKER picker(NULL, UR_DELETED); |
840
by dickelbeck
beautify |
139 |
SCH_SCREEN* screen = (SCH_SCREEN*) GetScreen(); |
1824
by stambaughw
Component library object improvements. |
140 |
// Save the list entry point of this screen
|
141 |
SCH_ITEM* savedEEDrawList = screen->EEDrawList; |
|
1763
by charras
Rework on undo/redo and block functions |
142 |
DelStruct = GetScreen()->EEDrawList; |
840
by dickelbeck
beautify |
143 |
while( DelStruct |
1824
by stambaughw
Component library object improvements. |
144 |
&& ( DelStruct = PickStruct( screen->m_Curseur, screen, |
145 |
JUNCTIONITEM | WIREITEM | BUSITEM ) ) != NULL ) |
|
840
by dickelbeck
beautify |
146 |
{
|
147 |
DelStruct->m_Flags = SELECTEDNODE | STRUCT_DELETED; |
|
148 |
||
149 |
/* Put this structure in the picked list: */
|
|
1770
by charras
pcbnew: work on undo/redo in progress Only delete commands are stored in undo/redo stack |
150 |
picker.m_PickedItem = DelStruct; |
151 |
picker.m_PickedItemType = DelStruct->Type(); |
|
1763
by charras
Rework on undo/redo and block functions |
152 |
pickList.PushItem(picker); |
840
by dickelbeck
beautify |
153 |
|
933
by charras
eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization. |
154 |
DelStruct = DelStruct->Next(); |
840
by dickelbeck
beautify |
155 |
screen->EEDrawList = DelStruct; |
156 |
}
|
|
157 |
||
158 |
GetScreen()->EEDrawList = savedEEDrawList; |
|
159 |
||
160 |
/* Mark all wires, junctions, .. connected to one of the item to delete
|
|
161 |
*/
|
|
162 |
if( DeleteFullConnection ) |
|
163 |
{
|
|
1824
by stambaughw
Component library object improvements. |
164 |
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; |
165 |
DelStruct = DelStruct->Next() ) |
|
840
by dickelbeck
beautify |
166 |
{
|
167 |
if( !(DelStruct->m_Flags & SELECTEDNODE) ) |
|
168 |
continue; |
|
169 |
||
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
170 |
#define SEGM ( (SCH_LINE*) DelStruct )
|
840
by dickelbeck
beautify |
171 |
if( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) |
172 |
continue; |
|
173 |
||
174 |
MarkConnected( this, GetScreen()->EEDrawList, SEGM ); |
|
175 |
#undef SEGM
|
|
176 |
}
|
|
177 |
||
178 |
// Search all removable wires (i.e wire with one new dangling end )
|
|
1824
by stambaughw
Component library object improvements. |
179 |
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; |
180 |
DelStruct = DelStruct->Next() ) |
|
840
by dickelbeck
beautify |
181 |
{
|
182 |
bool noconnect = FALSE; |
|
183 |
||
184 |
if( DelStruct->m_Flags & STRUCT_DELETED ) |
|
1824
by stambaughw
Component library object improvements. |
185 |
continue; // Already seen |
840
by dickelbeck
beautify |
186 |
|
187 |
if( !(DelStruct->m_Flags & CANDIDATE) ) |
|
1824
by stambaughw
Component library object improvements. |
188 |
continue; // Already seen |
840
by dickelbeck
beautify |
189 |
|
190 |
if( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) |
|
191 |
continue; |
|
192 |
||
193 |
DelStruct->m_Flags |= SKIP_STRUCT; |
|
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
194 |
#define SEGM ( (SCH_LINE*) DelStruct )
|
840
by dickelbeck
beautify |
195 |
|
1824
by stambaughw
Component library object improvements. |
196 |
/* Test the SEGM->m_Start point: if this point was connected to
|
197 |
* an STRUCT_DELETED wire, and now is not connected, the wire can
|
|
198 |
* be deleted */
|
|
840
by dickelbeck
beautify |
199 |
EDA_BaseStruct* removed_struct; |
200 |
for( removed_struct = GetScreen()->EEDrawList; |
|
201 |
removed_struct != NULL; |
|
1327
by dickelbeck
dlist cleanups, start of edit component in schematic rework |
202 |
removed_struct = removed_struct->Next() ) |
840
by dickelbeck
beautify |
203 |
{
|
1938
by stambaughw
Begin translating comments to English and minor code clean up. |
204 |
if( ( removed_struct->m_Flags & STRUCT_DELETED ) == 0 ) |
840
by dickelbeck
beautify |
205 |
continue; |
206 |
||
207 |
if( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) |
|
208 |
continue; |
|
209 |
||
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
210 |
#define WIRE ( (SCH_LINE*) removed_struct )
|
840
by dickelbeck
beautify |
211 |
if( WIRE->IsOneEndPointAt( SEGM->m_Start ) ) |
212 |
break; |
|
213 |
}
|
|
214 |
||
1824
by stambaughw
Component library object improvements. |
215 |
if( WIRE && !CountConnectedItems( this, GetScreen()->EEDrawList, |
216 |
SEGM->m_Start, TRUE ) ) |
|
840
by dickelbeck
beautify |
217 |
noconnect = TRUE; |
218 |
||
1824
by stambaughw
Component library object improvements. |
219 |
/* Test the SEGM->m_End point: if this point was connected to
|
220 |
* an STRUCT_DELETED wire, and now is not connected, the wire
|
|
221 |
* can be deleted */
|
|
840
by dickelbeck
beautify |
222 |
for( removed_struct = GetScreen()->EEDrawList; |
223 |
removed_struct != NULL; |
|
1327
by dickelbeck
dlist cleanups, start of edit component in schematic rework |
224 |
removed_struct = removed_struct->Next() ) |
840
by dickelbeck
beautify |
225 |
{
|
1938
by stambaughw
Begin translating comments to English and minor code clean up. |
226 |
if( ( removed_struct->m_Flags & STRUCT_DELETED ) == 0 ) |
840
by dickelbeck
beautify |
227 |
continue; |
228 |
if( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) |
|
229 |
continue; |
|
230 |
if( WIRE->IsOneEndPointAt( SEGM->m_End ) ) |
|
231 |
break; |
|
232 |
}
|
|
233 |
||
234 |
if( removed_struct && |
|
1824
by stambaughw
Component library object improvements. |
235 |
!CountConnectedItems( this, GetScreen()->EEDrawList, |
236 |
SEGM->m_End, TRUE ) ) |
|
840
by dickelbeck
beautify |
237 |
noconnect = TRUE; |
238 |
||
239 |
DelStruct->m_Flags &= ~SKIP_STRUCT; |
|
240 |
||
241 |
if( noconnect ) |
|
242 |
{
|
|
243 |
DelStruct->m_Flags |= STRUCT_DELETED; |
|
244 |
/* Put this structure in the picked list: */
|
|
1770
by charras
pcbnew: work on undo/redo in progress Only delete commands are stored in undo/redo stack |
245 |
picker.m_PickedItem = DelStruct; |
246 |
picker.m_PickedItemType = DelStruct->Type(); |
|
1763
by charras
Rework on undo/redo and block functions |
247 |
pickList.PushItem(picker); |
840
by dickelbeck
beautify |
248 |
|
249 |
DelStruct = GetScreen()->EEDrawList; |
|
250 |
}
|
|
251 |
#undef SEGM
|
|
252 |
}
|
|
253 |
||
1824
by stambaughw
Component library object improvements. |
254 |
// Delete redundant junctions (junctions which connect < 3 end wires
|
255 |
// and no pin are removed)
|
|
256 |
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; |
|
257 |
DelStruct = DelStruct->Next() ) |
|
840
by dickelbeck
beautify |
258 |
{
|
259 |
int count; |
|
260 |
if( DelStruct->m_Flags & STRUCT_DELETED ) |
|
261 |
continue; |
|
262 |
||
263 |
if( !(DelStruct->m_Flags & CANDIDATE) ) |
|
264 |
continue; |
|
265 |
||
266 |
if( DelStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE ) |
|
267 |
{
|
|
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
268 |
#define JUNCTION ( (SCH_JUNCTION*) DelStruct )
|
1824
by stambaughw
Component library object improvements. |
269 |
count = CountConnectedItems( this, GetScreen()->EEDrawList, |
270 |
JUNCTION->m_Pos, FALSE ); |
|
840
by dickelbeck
beautify |
271 |
if( count <= 2 ) |
272 |
{
|
|
273 |
DelStruct->m_Flags |= STRUCT_DELETED; |
|
274 |
||
275 |
/* Put this structure in the picked list: */
|
|
1770
by charras
pcbnew: work on undo/redo in progress Only delete commands are stored in undo/redo stack |
276 |
picker.m_PickedItem = DelStruct; |
277 |
picker.m_PickedItemType = DelStruct->Type(); |
|
1763
by charras
Rework on undo/redo and block functions |
278 |
pickList.PushItem(picker); |
840
by dickelbeck
beautify |
279 |
}
|
280 |
#undef JUNCTION
|
|
281 |
}
|
|
282 |
}
|
|
283 |
||
284 |
// Delete labels attached to wires
|
|
285 |
wxPoint pos = GetScreen()->m_Curseur; |
|
1824
by stambaughw
Component library object improvements. |
286 |
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; |
287 |
DelStruct = DelStruct->Next() ) |
|
840
by dickelbeck
beautify |
288 |
{
|
289 |
if( DelStruct->m_Flags & STRUCT_DELETED ) |
|
290 |
continue; |
|
291 |
||
871
by dickelbeck
class name changes, XOR artifacts |
292 |
if( DelStruct->Type() != TYPE_SCH_LABEL ) |
840
by dickelbeck
beautify |
293 |
continue; |
294 |
||
871
by dickelbeck
class name changes, XOR artifacts |
295 |
GetScreen()->m_Curseur = ( (SCH_TEXT*) DelStruct )->m_Pos; |
840
by dickelbeck
beautify |
296 |
EDA_BaseStruct* TstStruct = |
1824
by stambaughw
Component library object improvements. |
297 |
PickStruct( GetScreen()->m_Curseur, GetScreen(), |
298 |
WIREITEM | BUSITEM ); |
|
840
by dickelbeck
beautify |
299 |
|
300 |
if( TstStruct && TstStruct->m_Flags & STRUCT_DELETED ) |
|
301 |
{
|
|
302 |
DelStruct->m_Flags |= STRUCT_DELETED; |
|
303 |
||
304 |
/* Put this structure in the picked list: */
|
|
1770
by charras
pcbnew: work on undo/redo in progress Only delete commands are stored in undo/redo stack |
305 |
picker.m_PickedItem = DelStruct; |
306 |
picker.m_PickedItemType = DelStruct->Type(); |
|
1763
by charras
Rework on undo/redo and block functions |
307 |
pickList.PushItem(picker); |
840
by dickelbeck
beautify |
308 |
}
|
309 |
}
|
|
310 |
||
311 |
GetScreen()->m_Curseur = pos; |
|
312 |
}
|
|
313 |
||
1824
by stambaughw
Component library object improvements. |
314 |
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; |
315 |
DelStruct = DelStruct->Next() ) |
|
840
by dickelbeck
beautify |
316 |
DelStruct->m_Flags = 0; |
317 |
||
1763
by charras
Rework on undo/redo and block functions |
318 |
if( pickList.GetCount() ) |
840
by dickelbeck
beautify |
319 |
{
|
1763
by charras
Rework on undo/redo and block functions |
320 |
DeleteItemsInList( DrawPanel, pickList ); |
2209
by charras
Eeschema date in frame reference updated at each modification. |
321 |
OnModify( ); |
840
by dickelbeck
beautify |
322 |
}
|
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
323 |
}
|
324 |
||
325 |
||
1824
by stambaughw
Component library object improvements. |
326 |
/*
|
1938
by stambaughw
Begin translating comments to English and minor code clean up. |
327 |
* Locate and delete the item found under the mouse cursor
|
1824
by stambaughw
Component library object improvements. |
328 |
* If more than one item found: the priority order is:
|
329 |
* 1 : MARKER
|
|
330 |
* 2 : JUNCTION
|
|
331 |
* 2 : NOCONNECT
|
|
1938
by stambaughw
Begin translating comments to English and minor code clean up. |
332 |
* 3 : WIRE or BUS
|
1824
by stambaughw
Component library object improvements. |
333 |
* 4 : DRAWITEM
|
334 |
* 5 : TEXT
|
|
335 |
* 6 : COMPOSANT
|
|
336 |
* 7 : SHEET
|
|
337 |
*
|
|
338 |
* return TRUE if an item was deleted
|
|
339 |
*/
|
|
840
by dickelbeck
beautify |
340 |
bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC ) |
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
341 |
{
|
933
by charras
eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization. |
342 |
SCH_ITEM* DelStruct; |
840
by dickelbeck
beautify |
343 |
SCH_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() ); |
344 |
bool item_deleted = FALSE; |
|
345 |
||
346 |
DelStruct = PickStruct( screen->m_Curseur, screen, MARKERITEM ); |
|
347 |
if( DelStruct == NULL ) |
|
348 |
DelStruct = PickStruct( screen->m_Curseur, screen, JUNCTIONITEM ); |
|
349 |
if( DelStruct == NULL ) |
|
350 |
DelStruct = PickStruct( screen->m_Curseur, screen, NOCONNECTITEM ); |
|
351 |
if( DelStruct == NULL ) |
|
352 |
DelStruct = PickStruct( screen->m_Curseur, screen, RACCORDITEM ); |
|
353 |
if( DelStruct == NULL ) |
|
354 |
DelStruct = PickStruct( screen->m_Curseur, screen, WIREITEM | BUSITEM ); |
|
355 |
if( DelStruct == NULL ) |
|
356 |
DelStruct = PickStruct( screen->m_Curseur, screen, DRAWITEM ); |
|
357 |
if( DelStruct == NULL ) |
|
1824
by stambaughw
Component library object improvements. |
358 |
DelStruct = PickStruct( screen->m_Curseur, screen, |
359 |
TEXTITEM | LABELITEM ); |
|
840
by dickelbeck
beautify |
360 |
if( DelStruct == NULL ) |
361 |
DelStruct = PickStruct( screen->m_Curseur, screen, LIBITEM ); |
|
362 |
if( DelStruct == NULL ) |
|
363 |
DelStruct = PickStruct( screen->m_Curseur, screen, SHEETITEM ); |
|
364 |
||
365 |
if( DelStruct ) |
|
366 |
{
|
|
367 |
g_ItemToRepeat = NULL; |
|
368 |
DeleteStruct( frame->DrawPanel, DC, DelStruct ); |
|
369 |
frame->TestDanglingEnds( frame->GetScreen()->EEDrawList, DC ); |
|
2209
by charras
Eeschema date in frame reference updated at each modification. |
370 |
frame->OnModify( ); |
840
by dickelbeck
beautify |
371 |
item_deleted = TRUE; |
372 |
}
|
|
373 |
||
374 |
return item_deleted; |
|
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
375 |
}
|
376 |
||
377 |
||
1824
by stambaughw
Component library object improvements. |
378 |
/*
|
1938
by stambaughw
Begin translating comments to English and minor code clean up. |
379 |
* Remove definition of a structure in a linked list
|
380 |
* Elements of Drawing
|
|
381 |
* DrawStruct * = pointer to the structure
|
|
382 |
* Screen = pointer on the screen of belonging
|
|
1824
by stambaughw
Component library object improvements. |
383 |
*
|
1938
by stambaughw
Begin translating comments to English and minor code clean up. |
384 |
* Note:
|
385 |
* DRAW_SHEET_STRUCT_TYPE structures for the screen and structures
|
|
386 |
* Corresponding keys are not.
|
|
387 |
* They must be treated separately
|
|
1824
by stambaughw
Component library object improvements. |
388 |
*/
|
933
by charras
eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization. |
389 |
void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) |
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
390 |
{
|
840
by dickelbeck
beautify |
391 |
EDA_BaseStruct* DrawList; |
392 |
||
393 |
if( DrawStruct == NULL ) |
|
394 |
return; |
|
395 |
||
396 |
if( Screen == NULL ) |
|
397 |
return; |
|
398 |
||
399 |
Screen->SetModify(); |
|
400 |
||
934
by charras
see changelog |
401 |
if( DrawStruct->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE ) |
840
by dickelbeck
beautify |
402 |
{
|
2360.3.46
by Wayne Stambaugh
EESchema component library and hierarchical sheet label object improvements. |
403 |
// This structure is attached to a sheet, get the parent sheet object.
|
404 |
SCH_SHEET_PIN* sheetLabel = (SCH_SHEET_PIN*) DrawStruct; |
|
405 |
SCH_SHEET* sheet = sheetLabel->GetParent(); |
|
406 |
wxASSERT_MSG( sheet != NULL, |
|
407 |
wxT( "Sheet label parent not properly set, bad programmer!" ) ); |
|
408 |
sheet->RemoveLabel( sheetLabel ); |
|
840
by dickelbeck
beautify |
409 |
return; |
410 |
}
|
|
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
411 |
else
|
840
by dickelbeck
beautify |
412 |
{
|
413 |
if( DrawStruct == Screen->EEDrawList ) |
|
414 |
{
|
|
933
by charras
eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization. |
415 |
Screen->EEDrawList = DrawStruct->Next(); |
840
by dickelbeck
beautify |
416 |
SAFE_DELETE( DrawStruct ); |
417 |
}
|
|
418 |
else
|
|
419 |
{
|
|
420 |
DrawList = Screen->EEDrawList; |
|
1327
by dickelbeck
dlist cleanups, start of edit component in schematic rework |
421 |
while( DrawList && DrawList->Next() ) |
840
by dickelbeck
beautify |
422 |
{
|
1327
by dickelbeck
dlist cleanups, start of edit component in schematic rework |
423 |
if( DrawList->Next() == DrawStruct ) |
840
by dickelbeck
beautify |
424 |
{
|
1327
by dickelbeck
dlist cleanups, start of edit component in schematic rework |
425 |
DrawList->SetNext( DrawStruct->Next() ); |
840
by dickelbeck
beautify |
426 |
SAFE_DELETE( DrawStruct ); |
427 |
return; |
|
428 |
}
|
|
1327
by dickelbeck
dlist cleanups, start of edit component in schematic rework |
429 |
DrawList = DrawList->Next(); |
840
by dickelbeck
beautify |
430 |
}
|
431 |
}
|
|
432 |
}
|
|
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
433 |
}
|
434 |
||
435 |
||
840
by dickelbeck
beautify |
436 |
void DeleteAllMarkers( int type ) |
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
437 |
{
|
840
by dickelbeck
beautify |
438 |
SCH_SCREEN* screen; |
933
by charras
eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization. |
439 |
SCH_ITEM * DrawStruct, * NextStruct; |
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
440 |
SCH_MARKER* Marker; |
840
by dickelbeck
beautify |
441 |
|
442 |
EDA_ScreenList ScreenList; |
|
443 |
||
1824
by stambaughw
Component library object improvements. |
444 |
for( screen = ScreenList.GetFirst(); screen != NULL; |
445 |
screen = ScreenList.GetNext() ) |
|
840
by dickelbeck
beautify |
446 |
{
|
1824
by stambaughw
Component library object improvements. |
447 |
for( DrawStruct = screen->EEDrawList; DrawStruct != NULL; |
448 |
DrawStruct = NextStruct ) |
|
840
by dickelbeck
beautify |
449 |
{
|
933
by charras
eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization. |
450 |
NextStruct = DrawStruct->Next(); |
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
451 |
if( DrawStruct->Type() != TYPE_SCH_MARKER ) |
840
by dickelbeck
beautify |
452 |
continue; |
453 |
||
1993
by stambaughw
Compiler warning, object name, bug, and string fixes. |
454 |
Marker = (SCH_MARKER*) DrawStruct; |
1734
by charras
See changelog. work in progress about ERC and markers in eeschema |
455 |
if( Marker->GetMarkerType() != type ) |
840
by dickelbeck
beautify |
456 |
continue; |
457 |
||
1938
by stambaughw
Begin translating comments to English and minor code clean up. |
458 |
/* Remove marker */
|
840
by dickelbeck
beautify |
459 |
EraseStruct( DrawStruct, screen ); |
460 |
}
|
|
461 |
}
|
|
9
by raburton
add files not currently available in source (e.g. docs, modules, etc.) |
462 |
}
|