Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
daceb2e0
Commit
daceb2e0
authored
Jul 25, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework on undo/redo and block functions
parent
8ec8cf3f
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
114 additions
and
496 deletions
+114
-496
CMakeLists.txt
common/CMakeLists.txt
+0
-1
block_commande.cpp
common/block_commande.cpp
+0
-1
class_drawpickedstruct.cpp
common/class_drawpickedstruct.cpp
+0
-81
CMakeLists.txt
eeschema/CMakeLists.txt
+1
-1
block.cpp
eeschema/block.cpp
+6
-61
class_sch_screen.cpp
eeschema/class_sch_screen.cpp
+0
-1
cleanup.cpp
eeschema/cleanup.cpp
+33
-65
delete.cpp
eeschema/delete.cpp
+21
-54
eeredraw.cpp
eeschema/eeredraw.cpp
+6
-21
locate.cpp
eeschema/locate.cpp
+2
-11
netlist.cpp
eeschema/netlist.cpp
+0
-1
onleftclick.cpp
eeschema/onleftclick.cpp
+0
-1
plot.cpp
eeschema/plot.cpp
+0
-3
protos.h
eeschema/protos.h
+13
-9
schedit.cpp
eeschema/schedit.cpp
+6
-7
schematic_undo_redo.cpp
eeschema/schematic_undo_redo.cpp
+25
-103
base_struct.h
include/base_struct.h
+0
-1
class_drawpickedstruct.h
include/class_drawpickedstruct.h
+0
-73
wxEeschemaStruct.h
include/wxEeschemaStruct.h
+1
-1
No files found.
common/CMakeLists.txt
View file @
daceb2e0
...
@@ -12,7 +12,6 @@ set(COMMON_SRCS
...
@@ -12,7 +12,6 @@ set(COMMON_SRCS
basicframe.cpp
basicframe.cpp
bezier_curves.cpp
bezier_curves.cpp
block_commande.cpp
block_commande.cpp
class_drawpickedstruct.cpp
class_marker_base.cpp
class_marker_base.cpp
class_undoredo_container.cpp
class_undoredo_container.cpp
common.cpp
common.cpp
...
...
common/block_commande.cpp
View file @
daceb2e0
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
#include "common.h"
#include "common.h"
#include "macros.h"
#include "macros.h"
#include "base_struct.h"
#include "base_struct.h"
#include "class_drawpickedstruct.h"
#include "class_base_screen.h"
#include "class_base_screen.h"
#include "class_drawpanel.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "confirm.h"
...
...
common/class_drawpickedstruct.cpp
deleted
100644 → 0
View file @
8ec8cf3f
/****************************************************/
/* class_drawpickedstruct.cpp */
/****************************************************/
#include "fctsys.h"
#include "common.h"
#include "class_drawpickedstruct.h"
/* This class has only one useful member: .m_PickedStruct, used as a link.
* It does not describe really an item.
* It is used to create a linked list of selected items (in block selection).
* Each DrawPickedStruct item has is member: .m_PickedStruct pointing the
* real selected item
*/
/*******************************************************************/
DrawPickedStruct
::
DrawPickedStruct
(
EDA_BaseStruct
*
pickedstruct
)
:
EDA_BaseStruct
(
NULL
,
DRAW_PICK_ITEM_STRUCT_TYPE
)
/*******************************************************************/
{
m_PickedStruct
=
pickedstruct
;
}
DrawPickedStruct
::~
DrawPickedStruct
()
{
}
#if defined(DEBUG)
void
DrawPickedStruct
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
"/>
\n
"
;
}
#endif
EDA_Rect
DrawPickedStruct
::
GetBoundingBox
()
{
if
(
m_PickedStruct
)
return
m_PickedStruct
->
GetBoundingBox
();
else
{
return
EDA_Rect
();
// empty rectangle
}
}
EDA_Rect
DrawPickedStruct
::
GetBoundingBoxUnion
()
{
EDA_Rect
ret
;
EDA_BaseStruct
*
item
;
DrawPickedStruct
*
cur
=
this
;
while
(
cur
&&
(
item
=
cur
->
m_PickedStruct
)
!=
NULL
)
{
ret
.
Merge
(
item
->
GetBoundingBox
()
);
cur
=
cur
->
Next
();
}
return
ret
;
}
/*********************************************/
void
DrawPickedStruct
::
DeleteWrapperList
()
/*********************************************/
/* Delete this item all the items of the linked list
* Free the wrapper, but DOES NOT delete the picked items linked by .m_PickedStruct
*/
{
DrawPickedStruct
*
wrapp_struct
,
*
next_struct
;
for
(
wrapp_struct
=
Next
();
wrapp_struct
!=
NULL
;
wrapp_struct
=
next_struct
)
{
next_struct
=
wrapp_struct
->
Next
();
delete
wrapp_struct
;
}
}
eeschema/CMakeLists.txt
View file @
daceb2e0
...
@@ -27,7 +27,7 @@ set(EESCHEMA_SRCS
...
@@ -27,7 +27,7 @@ set(EESCHEMA_SRCS
class_pin.cpp
class_pin.cpp
class_sch_cmp_field.cpp
class_sch_cmp_field.cpp
class_schematic_items.cpp
class_schematic_items.cpp
class_screen.cpp
class_sc
h_sc
reen.cpp
class_text-label.cpp
class_text-label.cpp
classes_body_items.cpp
classes_body_items.cpp
cleanup.cpp
cleanup.cpp
...
...
eeschema/block.cpp
View file @
daceb2e0
...
@@ -10,7 +10,6 @@
...
@@ -10,7 +10,6 @@
#include "class_drawpanel.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "confirm.h"
#include "block_commande.h"
#include "block_commande.h"
#include "class_drawpickedstruct.h"
#include "program.h"
#include "program.h"
#include "libcmp.h"
#include "libcmp.h"
...
@@ -22,10 +21,10 @@
...
@@ -22,10 +21,10 @@
/* Variables Locales */
/* Variables Locales */
/* Fonctions exportees */
/* Fonctions exportees */
void
DeleteItemsInList
(
WinEDA_DrawPanel
*
panel
,
PICKED_ITEMS_LIST
&
aItemsList
);
/* Fonctions Locales */
/* Fonctions Locales */
static
void
DeleteItemsInList
(
WinEDA_DrawPanel
*
panel
,
PICKED_ITEMS_LIST
&
aItemsList
);
static
void
PlaceItemsInList
(
SCH_SCREEN
*
aScreen
,
PICKED_ITEMS_LIST
&
aItemsList
);
static
void
PlaceItemsInList
(
SCH_SCREEN
*
aScreen
,
PICKED_ITEMS_LIST
&
aItemsList
);
static
void
MoveListOfItems
(
SCH_SCREEN
*
aScreen
,
PICKED_ITEMS_LIST
&
aItemsList
);
static
void
MoveListOfItems
(
SCH_SCREEN
*
aScreen
,
PICKED_ITEMS_LIST
&
aItemsList
);
static
void
CopyItemsInList
(
SCH_SCREEN
*
screen
,
PICKED_ITEMS_LIST
&
aItemsList
);
static
void
CopyItemsInList
(
SCH_SCREEN
*
screen
,
PICKED_ITEMS_LIST
&
aItemsList
);
...
@@ -247,7 +246,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
...
@@ -247,7 +246,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_COPY
:
/* Copy */
case
BLOCK_COPY
:
/* Copy */
Pick
Struct
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
Pick
ItemsInBlock
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
if
(
block
->
GetCount
()
)
if
(
block
->
GetCount
()
)
...
@@ -268,7 +267,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
...
@@ -268,7 +267,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
break
;
break
;
case
BLOCK_DELETE
:
/* Delete */
case
BLOCK_DELETE
:
/* Delete */
Pick
Struct
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
Pick
ItemsInBlock
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
if
(
block
->
GetCount
()
)
if
(
block
->
GetCount
()
)
{
{
...
@@ -282,7 +281,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
...
@@ -282,7 +281,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
break
;
break
;
case
BLOCK_SAVE
:
/* Save */
case
BLOCK_SAVE
:
/* Save */
Pick
Struct
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
Pick
ItemsInBlock
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
if
(
block
->
GetCount
()
)
if
(
block
->
GetCount
()
)
{
{
...
@@ -380,7 +379,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
...
@@ -380,7 +379,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
BreakSegmentOnJunction
(
GetScreen
()
);
BreakSegmentOnJunction
(
GetScreen
()
);
Pick
Struct
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
Pick
ItemsInBlock
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
if
(
block
->
GetCount
()
)
if
(
block
->
GetCount
()
)
{
{
ii
=
1
;
ii
=
1
;
...
@@ -677,9 +676,6 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
...
@@ -677,9 +676,6 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
MirrorYPoint
(
DrawSheetLabel
->
m_Pos
,
Center
);
MirrorYPoint
(
DrawSheetLabel
->
m_Pos
,
Center
);
break
;
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
default
:
default
:
break
;
break
;
}
}
...
@@ -730,7 +726,6 @@ void CopyItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList )
...
@@ -730,7 +726,6 @@ void CopyItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList )
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_NOCONNECT_STRUCT_TYPE
:
case
DRAW_NOCONNECT_STRUCT_TYPE
:
default
:
default
:
...
@@ -786,25 +781,6 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
...
@@ -786,25 +781,6 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
return
;
return
;
}
}
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
// Unlink all picked structs from current EEDrawList
for
(
DrawPickedStruct
*
cur
=
(
DrawPickedStruct
*
)
DrawStruct
;
cur
;
cur
=
cur
->
Next
()
)
{
SCH_ITEM
*
item
=
(
SCH_ITEM
*
)
cur
->
m_PickedStruct
;
screen
->
RemoveFromDrawList
(
item
);
panel
->
PostDirtyRect
(
item
->
GetBoundingBox
()
);
item
->
SetNext
(
0
);
item
->
SetBack
(
0
);
item
->
m_Flags
=
IS_DELETED
;
}
// Removed items are put onto the Undo list
frame
->
SaveCopyInUndoList
(
DrawStruct
,
IS_DELETED
);
}
else
/* structure classique */
else
/* structure classique */
{
{
screen
->
RemoveFromDrawList
(
DrawStruct
);
screen
->
RemoveFromDrawList
(
DrawStruct
);
...
@@ -1065,9 +1041,6 @@ void MoveOneStruct( SCH_ITEM* DrawStruct, const wxPoint& move_vector )
...
@@ -1065,9 +1041,6 @@ void MoveOneStruct( SCH_ITEM* DrawStruct, const wxPoint& move_vector )
DrawSheetLabel
->
m_Pos
+=
move_vector
;
DrawSheetLabel
->
m_Pos
+=
move_vector
;
break
;
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
default
:
default
:
break
;
break
;
}
}
...
@@ -1140,27 +1113,6 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
...
@@ -1140,27 +1113,6 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
NewDrawStruct
=
(
(
DrawSheetStruct
*
)
DrawStruct
)
->
GenCopy
();
NewDrawStruct
=
(
(
DrawSheetStruct
*
)
DrawStruct
)
->
GenCopy
();
break
;
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
{
DrawPickedStruct
*
NewPickedItem
,
*
PickedList
=
NULL
,
*
LastPickedItem
=
NULL
;
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
while
(
PickedList
)
{
NewPickedItem
=
new
DrawPickedStruct
();
if
(
NewDrawStruct
==
NULL
)
NewDrawStruct
=
(
SCH_ITEM
*
)
NewPickedItem
;
if
(
LastPickedItem
)
LastPickedItem
->
SetNext
(
NewPickedItem
);
LastPickedItem
=
NewPickedItem
;
NewPickedItem
->
m_PickedStruct
=
DuplicateStruct
(
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
);
PickedList
=
PickedList
->
Next
();
}
break
;
}
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
case
DRAW_PART_TEXT_STRUCT_TYPE
:
case
DRAW_PART_TEXT_STRUCT_TYPE
:
case
SCREEN_STRUCT_TYPE
:
case
SCREEN_STRUCT_TYPE
:
...
@@ -1417,17 +1369,10 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
...
@@ -1417,17 +1369,10 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break
;
break
;
case
TYPE_SCH_COMPONENT
:
case
TYPE_SCH_COMPONENT
:
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
case
DRAW_SHEET_STRUCT_TYPE
:
break
;
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
break
;
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
#undef STRUCT
#undef STRUCT
#define STRUCT ( (MARKER_SCH*) Struct )
#define STRUCT ( (MARKER_SCH*) Struct )
...
...
eeschema/class_screen.cpp
→
eeschema/class_sc
h_sc
reen.cpp
View file @
daceb2e0
...
@@ -32,7 +32,6 @@ void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
...
@@ -32,7 +32,6 @@ void SetaParent( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
break
;
break
;
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
break
;
default:
default:
...
...
eeschema/cleanup.cpp
View file @
daceb2e0
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
#include "common.h"
#include "common.h"
#include "trigo.h"
#include "trigo.h"
#include "confirm.h"
#include "confirm.h"
#include "class_drawpickedstruct.h"
#include "program.h"
#include "program.h"
#include "libcmp.h"
#include "libcmp.h"
#include "general.h"
#include "general.h"
...
@@ -115,7 +114,6 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
...
@@ -115,7 +114,6 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_COMPONENT
:
case
TYPE_SCH_COMPONENT
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_TEXT
:
...
@@ -131,78 +129,48 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
...
@@ -131,78 +129,48 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
}
}
/*********************************************************/
/* Break a segment ( BUS, WIRE ) int 2 segments at location aBreakpoint,
DrawPickedStruct
*
BreakSegment
(
SCH_SCREEN
*
screen
,
* if aBreakpoint in on segment segment
wxPoint
breakpoint
,
bool
PutInUndoList
)
* ( excluding ends)
/*********************************************************/
* fill aPicklist with modified items if non null
/* Coupe un segment ( BUS, WIRE ) en 2 au point breakpoint,
* - si ce point est sur le segment
* - extremites non comprises
* If PutInUndoList == TRUE, create a list of modifictions, for undo command
*/
*/
void
BreakSegment
(
SCH_SCREEN
*
aScreen
,
wxPoint
aBreakpoint
,
PICKED_ITEMS_LIST
*
aPicklist
)
{
{
EDA_BaseStruct
*
DrawList
;
EDA_DrawLineStruct
*
segment
,
*
NewSegment
;
EDA_DrawLineStruct
*
segment
,
*
NewSegment
;
DrawPickedStruct
*
List
=
NULL
;
for
(
SCH_ITEM
*
DrawList
=
aScreen
->
EEDrawList
;
DrawList
;
DrawList
=
DrawList
->
Next
()
)
DrawList
=
screen
->
EEDrawList
;
while
(
DrawList
)
{
{
switch
(
DrawList
->
Type
()
)
if
(
DrawList
->
Type
()
!=
DRAW_SEGMENT_STRUCT_TYPE
)
{
continue
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
segment
=
(
EDA_DrawLineStruct
*
)
DrawList
;
if
(
!
TestSegmentHit
(
breakpoint
,
segment
->
m_Start
,
segment
->
m_End
,
0
)
)
break
;
/* Segment connecte: doit etre coupe en 2 si px,py n'est
segment
=
(
EDA_DrawLineStruct
*
)
DrawList
;
* pas une extremite */
if
(
(
segment
->
m_Start
==
breakpoint
)
||
(
segment
->
m_End
==
breakpoint
)
)
break
;
/* Ici il faut couper le segment en 2 */
if
(
PutInUndoList
)
// First: put copy of the old segment in undo list
{
DrawPickedStruct
*
wrapper
=
new
DrawPickedStruct
();
wrapper
->
m_Flags
=
IS_CHANGED
;
wrapper
->
m_PickedStruct
=
segment
->
GenCopy
();
wrapper
->
m_Image
=
segment
;
wrapper
->
m_PickedStruct
->
m_Image
=
segment
;
wrapper
->
SetNext
(
List
);
List
=
wrapper
;
}
NewSegment
=
segment
->
GenCopy
();
NewSegment
->
m_Start
=
breakpoint
;
segment
->
m_End
=
NewSegment
->
m_Start
;
NewSegment
->
SetNext
(
segment
->
Next
()
);
segment
->
SetNext
(
NewSegment
);
DrawList
=
NewSegment
;
if
(
PutInUndoList
)
{
DrawPickedStruct
*
wrapper
=
new
DrawPickedStruct
();
wrapper
->
m_Flags
=
IS_NEW
;
wrapper
->
m_Image
=
NewSegment
;
wrapper
->
SetNext
(
List
);
List
=
wrapper
;
}
break
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
if
(
!
TestSegmentHit
(
aBreakpoint
,
segment
->
m_Start
,
segment
->
m_End
,
0
)
)
case
DRAW_BUSENTRY_STRUCT_TYPE
:
continue
;
case
DRAW_POLYLINE_STRUCT_TYPE
:
break
;
default
:
/* Segment connecte: doit etre coupe en 2 si px,py n'est
break
;
* pas une extremite */
if
(
(
segment
->
m_Start
==
aBreakpoint
)
||
(
segment
->
m_End
==
aBreakpoint
)
)
continue
;
/* Ici il faut couper le segment en 2 */
if
(
aPicklist
)
// First: put copy of the old segment in undo list
{
ITEM_PICKER
picker
((
SCH_ITEM
*
)
segment
->
GenCopy
(),
IS_CHANGED
);
picker
.
m_Link
=
segment
;
aPicklist
->
PushItem
(
picker
);
}
NewSegment
=
segment
->
GenCopy
();
NewSegment
->
m_Start
=
aBreakpoint
;
segment
->
m_End
=
NewSegment
->
m_Start
;
NewSegment
->
SetNext
(
segment
->
Next
()
);
segment
->
SetNext
(
NewSegment
);
DrawList
=
NewSegment
;
if
(
aPicklist
)
{
ITEM_PICKER
picker
(
NewSegment
,
IS_NEW
);
aPicklist
->
PushItem
(
picker
);
}
}
DrawList
=
DrawList
->
Next
();
}
}
return
List
;
}
}
...
...
eeschema/delete.cpp
View file @
daceb2e0
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
#include "common.h"
#include "common.h"
#include "class_drawpickedstruct.h"
#include "program.h"
#include "program.h"
#include "libcmp.h"
#include "libcmp.h"
...
@@ -13,6 +12,10 @@
...
@@ -13,6 +12,10 @@
#include "protos.h"
#include "protos.h"
#include "class_marker_sch.h"
#include "class_marker_sch.h"
// Imported function:
void
DeleteItemsInList
(
WinEDA_DrawPanel
*
panel
,
PICKED_ITEMS_LIST
&
aItemsList
);
/********************************************************************************/
/********************************************************************************/
static
int
CountConnectedItems
(
WinEDA_SchematicFrame
*
frame
,
static
int
CountConnectedItems
(
WinEDA_SchematicFrame
*
frame
,
...
@@ -115,7 +118,7 @@ static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct,
...
@@ -115,7 +118,7 @@ static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct,
/********************************************************************************/
/********************************************************************************/
void
WinEDA_SchematicFrame
::
DeleteConnection
(
wxDC
*
DC
,
bool
DeleteFullConnection
)
void
WinEDA_SchematicFrame
::
DeleteConnection
(
bool
DeleteFullConnection
)
/********************************************************************************/
/********************************************************************************/
/* Delete a connection, i.e wires or bus connected
/* Delete a connection, i.e wires or bus connected
...
@@ -124,20 +127,21 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
...
@@ -124,20 +127,21 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
{
{
wxPoint
refpos
=
GetScreen
()
->
m_Curseur
;
wxPoint
refpos
=
GetScreen
()
->
m_Curseur
;
SCH_ITEM
*
DelStruct
;
SCH_ITEM
*
DelStruct
;
DrawPickedStruct
*
PickedItem
,
*
PickedList
=
NULL
;
PICKED_ITEMS_LIST
pickList
;
/* Clear .m_Flags member for all items */
/* Clear .m_Flags member for all items */
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Next
()
)
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Next
()
)
DelStruct
->
m_Flags
=
0
;
DelStruct
->
m_Flags
=
0
;
BreakSegmentOnJunction
(
(
SCH_SCREEN
*
)
GetScreen
()
);
BreakSegmentOnJunction
(
(
SCH_SCREEN
*
)
GetScreen
()
);
DelStruct
=
GetScreen
()
->
EEDrawList
;
/* Locate all the wires, bus or junction under the mouse cursor, and put them in a list
/* Locate all the wires, bus or junction under the mouse cursor, and put them in a list
* of items to delete
* of items to delete
*/
*/
ITEM_PICKER
picker
(
NULL
,
IS_DELETED
);
SCH_SCREEN
*
screen
=
(
SCH_SCREEN
*
)
GetScreen
();
SCH_SCREEN
*
screen
=
(
SCH_SCREEN
*
)
GetScreen
();
SCH_ITEM
*
savedEEDrawList
=
screen
->
EEDrawList
;
SCH_ITEM
*
savedEEDrawList
=
screen
->
EEDrawList
;
// Save the list entry point of this screen
DelStruct
=
GetScreen
()
->
EEDrawList
;
while
(
DelStruct
while
(
DelStruct
&&
(
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
&&
(
DelStruct
=
PickStruct
(
screen
->
m_Curseur
,
screen
,
JUNCTIONITEM
|
WIREITEM
|
BUSITEM
)
)
!=
NULL
)
screen
,
JUNCTIONITEM
|
WIREITEM
|
BUSITEM
)
)
!=
NULL
)
...
@@ -145,10 +149,9 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
...
@@ -145,10 +149,9 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
DelStruct
->
m_Flags
=
SELECTEDNODE
|
STRUCT_DELETED
;
DelStruct
->
m_Flags
=
SELECTEDNODE
|
STRUCT_DELETED
;
/* Put this structure in the picked list: */
/* Put this structure in the picked list: */
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
picker
.
m_Item
=
DelStruct
;
pickList
.
PushItem
(
picker
);
PickedItem
->
SetNext
(
PickedList
);
PickedList
=
PickedItem
;
DelStruct
=
DelStruct
->
Next
();
DelStruct
=
DelStruct
->
Next
();
screen
->
EEDrawList
=
DelStruct
;
screen
->
EEDrawList
=
DelStruct
;
}
}
...
@@ -234,10 +237,9 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
...
@@ -234,10 +237,9 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
{
{
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
/* Put this structure in the picked list: */
/* Put this structure in the picked list: */
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
picker
.
m_Item
=
DelStruct
;
pickList
.
PushItem
(
picker
);
PickedItem
->
SetNext
(
PickedList
);
PickedList
=
PickedItem
;
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
=
GetScreen
()
->
EEDrawList
;
}
}
#undef SEGM
#undef SEGM
...
@@ -262,10 +264,8 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
...
@@ -262,10 +264,8 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
/* Put this structure in the picked list: */
/* Put this structure in the picked list: */
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
picker
.
m_Item
=
DelStruct
;
pickList
.
PushItem
(
picker
);
PickedItem
->
SetNext
(
PickedList
);
PickedList
=
PickedItem
;
}
}
#undef JUNCTION
#undef JUNCTION
}
}
...
@@ -290,10 +290,8 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
...
@@ -290,10 +290,8 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
DelStruct
->
m_Flags
|=
STRUCT_DELETED
;
/* Put this structure in the picked list: */
/* Put this structure in the picked list: */
PickedItem
=
new
DrawPickedStruct
(
DelStruct
);
picker
.
m_Item
=
DelStruct
;
pickList
.
PushItem
(
picker
);
PickedItem
->
SetNext
(
PickedList
);
PickedList
=
PickedItem
;
}
}
}
}
...
@@ -303,9 +301,9 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
...
@@ -303,9 +301,9 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Next
()
)
for
(
DelStruct
=
GetScreen
()
->
EEDrawList
;
DelStruct
!=
NULL
;
DelStruct
=
DelStruct
->
Next
()
)
DelStruct
->
m_Flags
=
0
;
DelStruct
->
m_Flags
=
0
;
if
(
PickedList
)
if
(
pickList
.
GetCount
()
)
{
{
Delete
Struct
(
DrawPanel
,
DC
,
(
SCH_ITEM
*
)
Picked
List
);
Delete
ItemsInList
(
DrawPanel
,
pick
List
);
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
}
}
}
}
...
@@ -381,7 +379,6 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
...
@@ -381,7 +379,6 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
*/
*/
{
{
EDA_BaseStruct
*
DrawList
;
EDA_BaseStruct
*
DrawList
;
DrawPickedStruct
*
PickedList
=
NULL
;
Hierarchical_PIN_Sheet_Struct
*
SheetLabel
,
*
NextLabel
;
Hierarchical_PIN_Sheet_Struct
*
SheetLabel
,
*
NextLabel
;
if
(
DrawStruct
==
NULL
)
if
(
DrawStruct
==
NULL
)
...
@@ -394,16 +391,14 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
...
@@ -394,16 +391,14 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
if
(
DrawStruct
->
Type
()
==
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
)
if
(
DrawStruct
->
Type
()
==
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
)
{
{
/* Cette stucture est rattachee a une feuille, et n'est pas
//this structure is attached to a sheet , which we must find.
* accessible par la liste globale directement */
//this structure has a sheet attached, which we must find.
DrawList
=
Screen
->
EEDrawList
;
DrawList
=
Screen
->
EEDrawList
;
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Next
()
)
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Next
()
)
{
{
if
(
DrawList
->
Type
()
!=
DRAW_SHEET_STRUCT_TYPE
)
if
(
DrawList
->
Type
()
!=
DRAW_SHEET_STRUCT_TYPE
)
continue
;
continue
;
/*
Examen de la
Sheet */
/*
See if our item is in this
Sheet */
SheetLabel
=
(
(
DrawSheetStruct
*
)
DrawList
)
->
m_Label
;
SheetLabel
=
(
(
DrawSheetStruct
*
)
DrawList
)
->
m_Label
;
if
(
SheetLabel
==
NULL
)
if
(
SheetLabel
==
NULL
)
continue
;
continue
;
...
@@ -431,37 +426,9 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
...
@@ -431,37 +426,9 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
}
}
}
}
}
}
return
;
return
;
}
}
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
while
(
PickedList
)
{
if
(
PickedList
->
m_PickedStruct
==
Screen
->
EEDrawList
)
{
Screen
->
EEDrawList
=
Screen
->
EEDrawList
->
Next
();
SAFE_DELETE
(
DrawStruct
);
}
else
{
DrawList
=
Screen
->
EEDrawList
;
while
(
DrawList
&&
DrawList
->
Next
()
)
{
if
(
DrawList
->
Next
()
==
PickedList
->
m_PickedStruct
)
{
DrawList
->
SetNext
(
DrawList
->
Next
()
->
Next
()
);
SAFE_DELETE
(
DrawStruct
);
return
;
}
DrawList
=
DrawList
->
Next
();
}
}
PickedList
=
(
DrawPickedStruct
*
)
PickedList
->
Next
();
}
}
else
// structure usuelle */
else
// structure usuelle */
{
{
if
(
DrawStruct
==
Screen
->
EEDrawList
)
if
(
DrawStruct
==
Screen
->
EEDrawList
)
...
...
eeschema/eeredraw.cpp
View file @
daceb2e0
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
#include "gr_basic.h"
#include "gr_basic.h"
#include "common.h"
#include "common.h"
#include "class_drawpanel.h"
#include "class_drawpanel.h"
#include "class_drawpickedstruct.h"
#include "appl_wxstruct.h"
#include "appl_wxstruct.h"
#include "program.h"
#include "program.h"
...
@@ -127,32 +126,18 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref,
...
@@ -127,32 +126,18 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref,
* If the list is of DrawPickStruct types then the picked item are drawn. *
* If the list is of DrawPickStruct types then the picked item are drawn. *
*****************************************************************************/
*****************************************************************************/
void
RedrawStructList
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
RedrawStructList
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
SCH_ITEM
*
Struct
s
,
int
DrawMode
,
int
Color
)
SCH_ITEM
*
Struct
list
,
int
DrawMode
,
int
Color
)
{
{
while
(
Struct
s
)
while
(
Struct
list
)
{
{
if
(
Structs
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
if
(
!
(
Structlist
->
m_Flags
&
IS_MOVED
)
)
{
{
SCH_ITEM
*
item
=
(
SCH_ITEM
*
)
(
(
DrawPickedStruct
*
)
Structs
)
->
m_PickedStruct
;
// uncomment line below when there is a virtual EDA_BaseStruct::GetBoundingBox()
// if( panel->m_ClipBox.Intersects( item->GetBoundingBox() ) )
{
RedrawOneStruct
(
panel
,
DC
,
item
,
DrawMode
,
Color
);
}
}
else
{
if
(
!
(
Structs
->
m_Flags
&
IS_MOVED
)
)
{
// uncomment line below when there is a virtual EDA_BaseStruct::GetBoundingBox()
// uncomment line below when there is a virtual EDA_BaseStruct::GetBoundingBox()
// if( panel->m_ClipBox.Intersects( Structs->GetBoundingBox() ) )
// if( panel->m_ClipBox.Intersects( Structs->GetBoundingBox() ) )
RedrawOneStruct
(
panel
,
DC
,
Structs
,
DrawMode
,
Color
);
RedrawOneStruct
(
panel
,
DC
,
Structlist
,
DrawMode
,
Color
);
}
}
}
Struct
s
=
Structs
->
Next
();
Struct
list
=
Structlist
->
Next
();
}
}
}
}
...
...
eeschema/locate.cpp
View file @
daceb2e0
...
@@ -11,7 +11,6 @@
...
@@ -11,7 +11,6 @@
#include "general.h"
#include "general.h"
#include "trigo.h"
#include "trigo.h"
#include "macros.h"
#include "macros.h"
#include "class_drawpickedstruct.h"
#include "class_marker_sch.h"
#include "class_marker_sch.h"
#include "protos.h"
#include "protos.h"
...
@@ -118,9 +117,6 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
...
@@ -118,9 +117,6 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
}
}
/***********************************************************************/
int
PickStruct
(
BLOCK_SELECTOR
&
aBlock
,
BASE_SCREEN
*
aScreen
)
/************************************************************************/
/** Function PickStruct
/** Function PickStruct
* Search items in a block
* Search items in a block
...
@@ -128,6 +124,7 @@ int PickStruct( BLOCK_SELECTOR& aBlock, BASE_SCREEN* aScreen )
...
@@ -128,6 +124,7 @@ int PickStruct( BLOCK_SELECTOR& aBlock, BASE_SCREEN* aScreen )
* @param aBlock a BLOCK_SELECTOR that gives the search area boundary
* @param aBlock a BLOCK_SELECTOR that gives the search area boundary
* list of items is stored in aBlock
* list of items is stored in aBlock
*/
*/
int
PickItemsInBlock
(
BLOCK_SELECTOR
&
aBlock
,
BASE_SCREEN
*
aScreen
)
{
{
int
x
,
y
,
OrigX
,
OrigY
;
int
x
,
y
,
OrigX
,
OrigY
;
int
itemcount
=
0
;
int
itemcount
=
0
;
...
@@ -355,13 +352,10 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
...
@@ -355,13 +352,10 @@ bool SnapPoint2( const wxPoint& aPosRef, int SearchMask,
}
}
break
;
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
default
:
default
:
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
wxT
(
"SnapPoint2() error: unexpected strct type %d ("
),
DrawList
->
Type
()
);
msg
.
Printf
(
wxT
(
"SnapPoint2() error: unexpected str
u
ct type %d ("
),
DrawList
->
Type
()
);
msg
<<
DrawList
->
GetClass
()
<<
wxT
(
")"
);
msg
<<
DrawList
->
GetClass
()
<<
wxT
(
")"
);
DisplayError
(
NULL
,
msg
);
DisplayError
(
NULL
,
msg
);
break
;
break
;
...
@@ -540,9 +534,6 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
...
@@ -540,9 +534,6 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2, SCH_ITEM* DrawStruct )
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
break
;
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
default
:
default
:
msg
.
Printf
(
msg
.
Printf
(
wxT
(
"DrawStructInBox() Err: unexpected StructType %d ("
),
wxT
(
"DrawStructInBox() Err: unexpected StructType %d ("
),
...
...
eeschema/netlist.cpp
View file @
daceb2e0
...
@@ -533,7 +533,6 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
...
@@ -533,7 +533,6 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
break
;
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
...
...
eeschema/onleftclick.cpp
View file @
daceb2e0
...
@@ -55,7 +55,6 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -55,7 +55,6 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
return
;
return
;
case
SCREEN_STRUCT_TYPE
:
case
SCREEN_STRUCT_TYPE
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
DisplayError
(
this
,
DisplayError
(
this
,
wxT
(
"OnLeftClick err: unexpected type for Place"
)
);
wxT
(
"OnLeftClick err: unexpected type for Place"
)
);
DrawStruct
->
m_Flags
=
0
;
DrawStruct
->
m_Flags
=
0
;
...
...
eeschema/plot.cpp
View file @
daceb2e0
...
@@ -750,9 +750,6 @@ void PlotDrawlist( Plotter* plotter, SCH_ITEM* aDrawlist )
...
@@ -750,9 +750,6 @@ void PlotDrawlist( Plotter* plotter, SCH_ITEM* aDrawlist )
PlotLibPart
(
plotter
,
DrawLibItem
);
PlotLibPart
(
plotter
,
DrawLibItem
);
break
;
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
break
;
break
;
...
...
eeschema/protos.h
View file @
daceb2e0
...
@@ -109,10 +109,10 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
...
@@ -109,10 +109,10 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
SCH_COMPONENT
*
LocateSmallestComponent
(
SCH_SCREEN
*
Screen
);
SCH_COMPONENT
*
LocateSmallestComponent
(
SCH_SCREEN
*
Screen
);
/* Recherche du plus petit (en surface) composant pointe par la souris */
/* Recherche du plus petit (en surface) composant pointe par la souris */
int
Pick
Struct
(
BLOCK_SELECTOR
&
aBlock
,
BASE_SCREEN
*
screen
);
int
Pick
ItemsInBlock
(
BLOCK_SELECTOR
&
aBlock
,
BASE_SCREEN
*
screen
);
SCH_ITEM
*
PickStruct
(
const
wxPoint
&
refpos
,
BASE_SCREEN
*
screen
,
int
SearchMask
);
/*
2 functions
PickStruct:
/*
function
PickStruct:
Search
in block, or Search
at location pos
Search at location pos
SearchMask = (bitwise OR):
SearchMask = (bitwise OR):
LIBITEM
LIBITEM
...
@@ -145,6 +145,7 @@ SCH_ITEM * PickStruct(const wxPoint & refpos, BASE_SCREEN* screen, int SearchMas
...
@@ -145,6 +145,7 @@ SCH_ITEM * PickStruct(const wxPoint & refpos, BASE_SCREEN* screen, int SearchMas
Positon search:
Positon search:
pointeur sur la structure.
pointeur sur la structure.
Si pas de structures selectionnees: retourne NULL */
Si pas de structures selectionnees: retourne NULL */
SCH_ITEM
*
PickStruct
(
const
wxPoint
&
refpos
,
BASE_SCREEN
*
screen
,
int
SearchMask
);
...
@@ -325,11 +326,14 @@ void SchematicCleanUp(SCH_SCREEN * screen, wxDC * DC);
...
@@ -325,11 +326,14 @@ void SchematicCleanUp(SCH_SCREEN * screen, wxDC * DC);
void
BreakSegmentOnJunction
(
SCH_SCREEN
*
Screen
);
void
BreakSegmentOnJunction
(
SCH_SCREEN
*
Screen
);
/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions
/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions
et les raccords */
et les raccords */
DrawPickedStruct
*
BreakSegment
(
SCH_SCREEN
*
screen
,
wxPoint
breakpoint
,
bool
PutInUndoList
=
FALSE
);
/* Break a segment ( BUS, WIRE ) int 2 segments at location aBreakpoint,
/* Coupe un segment ( BUS, WIRE ) en 2 au point breakpoint,
* if aBreakpoint in on segment segment
- si ce point est sur le segment
* ( excluding ends)
- extremites non comprises */
* fill aPicklist with modified items if non null
*/
void
BreakSegment
(
SCH_SCREEN
*
aScreen
,
wxPoint
aBreakpoint
,
PICKED_ITEMS_LIST
*
aPicklist
=
NULL
);
/**************/
/**************/
/* EECLASS.CPP */
/* EECLASS.CPP */
...
...
eeschema/schedit.cpp
View file @
daceb2e0
...
@@ -9,7 +9,6 @@
...
@@ -9,7 +9,6 @@
#include "class_drawpanel.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "confirm.h"
#include "eda_doc.h"
#include "eda_doc.h"
#include "class_drawpickedstruct.h"
#include "class_marker_sch.h"
#include "class_marker_sch.h"
#include "program.h"
#include "program.h"
...
@@ -329,20 +328,20 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -329,20 +328,20 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_SCH_DELETE_NODE
:
case
ID_POPUP_SCH_DELETE_NODE
:
case
ID_POPUP_SCH_DELETE_CONNECTION
:
case
ID_POPUP_SCH_DELETE_CONNECTION
:
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
DeleteConnection
(
&
dc
,
DeleteConnection
(
id
==
ID_POPUP_SCH_DELETE_CONNECTION
?
TRUE
:
FALSE
);
id
==
ID_POPUP_SCH_DELETE_CONNECTION
?
TRUE
:
FALSE
);
screen
->
SetCurItem
(
NULL
);
screen
->
SetCurItem
(
NULL
);
g_ItemToRepeat
=
NULL
;
g_ItemToRepeat
=
NULL
;
TestDanglingEnds
(
screen
->
EEDrawList
,
&
dc
);
TestDanglingEnds
(
screen
->
EEDrawList
,
&
dc
);
DrawPanel
->
Refresh
();
break
;
break
;
case
ID_POPUP_SCH_BREAK_WIRE
:
case
ID_POPUP_SCH_BREAK_WIRE
:
{
{
DrawPickedStruct
*
ListForUndo
;
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
ListForUndo
=
BreakSegment
(
screen
,
screen
->
m_Curseur
,
TRUE
);
PICKED_ITEMS_LIST
picklistForUndo
;
if
(
ListForUndo
)
BreakSegment
(
screen
,
screen
->
m_Curseur
,
&
picklistForUndo
);
SaveCopyInUndoList
(
(
SCH_ITEM
*
)
ListForUndo
,
IS_NEW
|
IS_CHANGED
);
if
(
picklistForUndo
.
GetCount
()
)
SaveCopyInUndoList
(
picklistForUndo
,
IS_NEW
|
IS_CHANGED
);
TestDanglingEnds
(
screen
->
EEDrawList
,
&
dc
);
TestDanglingEnds
(
screen
->
EEDrawList
,
&
dc
);
}
}
break
;
break
;
...
...
eeschema/schematic_undo_redo.cpp
View file @
daceb2e0
...
@@ -5,7 +5,6 @@
...
@@ -5,7 +5,6 @@
#include "fctsys.h"
#include "fctsys.h"
#include "common.h"
#include "common.h"
#include "confirm.h"
#include "confirm.h"
#include "class_drawpickedstruct.h"
#include "program.h"
#include "program.h"
#include "libcmp.h"
#include "libcmp.h"
...
@@ -173,8 +172,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
...
@@ -173,8 +172,8 @@ void SwapData( EDA_BaseStruct* aItem, EDA_BaseStruct* aImage )
/***********************************************************************/
/***********************************************************************/
void
WinEDA_SchematicFrame
::
SaveCopyInUndoList
(
SCH_ITEM
*
ItemToCopy
,
void
WinEDA_SchematicFrame
::
SaveCopyInUndoList
(
SCH_ITEM
*
a
ItemToCopy
,
int
flag_type_command
)
int
aCommandType
)
/***********************************************************************/
/***********************************************************************/
/** function SaveCopyInUndoList
/** function SaveCopyInUndoList
...
@@ -201,110 +200,33 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
...
@@ -201,110 +200,33 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
SCH_ITEM
*
CopyOfItem
;
SCH_ITEM
*
CopyOfItem
;
PICKED_ITEMS_LIST
*
commandToUndo
=
new
PICKED_ITEMS_LIST
();
PICKED_ITEMS_LIST
*
commandToUndo
=
new
PICKED_ITEMS_LIST
();
commandToUndo
->
m_UndoRedoType
=
flag_type_command
;
commandToUndo
->
m_UndoRedoType
=
aCommandType
;
ITEM_PICKER
itemWrapper
(
ItemToCopy
,
flag_type_command
);
ITEM_PICKER
itemWrapper
(
aItemToCopy
,
aCommandType
);
if
(
ItemToCopy
)
switch
(
aCommandType
)
{
{
switch
(
flag_type_command
)
case
IS_CHANGED
:
/* Create a copy of schematic */
{
CopyOfItem
=
DuplicateStruct
(
aItemToCopy
);
case
IS_CHANGED
:
/* Create a copy of schematic */
itemWrapper
.
m_Item
=
CopyOfItem
;
if
(
ItemToCopy
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
itemWrapper
.
m_Link
=
aItemToCopy
;
{
commandToUndo
->
PushItem
(
itemWrapper
);
DrawPickedStruct
*
PickedList
=
(
DrawPickedStruct
*
)
ItemToCopy
;
break
;
while
(
PickedList
)
{
CopyOfItem
=
DuplicateStruct
(
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
);
CopyOfItem
->
m_Flags
=
flag_type_command
;
itemWrapper
.
m_Item
=
CopyOfItem
;
itemWrapper
.
m_Link
=
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
;
commandToUndo
->
PushItem
(
itemWrapper
);
PickedList
=
PickedList
->
Next
();
}
}
else
{
CopyOfItem
=
DuplicateStruct
(
ItemToCopy
);
itemWrapper
.
m_Item
=
CopyOfItem
;
itemWrapper
.
m_Link
=
ItemToCopy
;
commandToUndo
->
PushItem
(
itemWrapper
);
}
break
;
case
IS_NEW
:
if
(
ItemToCopy
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
DrawPickedStruct
*
PickedList
=
(
DrawPickedStruct
*
)
ItemToCopy
;
while
(
PickedList
)
{
CopyOfItem
=
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
;
PickedList
->
m_PickedStruct
=
NULL
;
PickedList
->
m_Flags
=
flag_type_command
;
PickedList
=
PickedList
->
Next
();
itemWrapper
.
m_Item
=
CopyOfItem
;
commandToUndo
->
PushItem
(
itemWrapper
);
}
}
else
{
commandToUndo
->
PushItem
(
itemWrapper
);
}
break
;
case
IS_NEW
|
IS_CHANGED
:
// when more than one item, some are new, some are changed
if
(
ItemToCopy
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
DrawPickedStruct
*
PickedList
=
(
DrawPickedStruct
*
)
ItemToCopy
;
while
(
PickedList
)
{
CopyOfItem
=
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
;
PickedList
->
m_PickedStruct
=
NULL
;
PickedList
=
PickedList
->
Next
();
itemWrapper
.
m_Item
=
CopyOfItem
;
itemWrapper
.
m_UndoRedoStatus
=
PickedList
->
m_Flags
;
commandToUndo
->
PushItem
(
itemWrapper
);
}
}
else
{
commandToUndo
->
PushItem
(
itemWrapper
);
}
break
;
case
IS_WIRE_IMAGE
:
commandToUndo
->
PushItem
(
itemWrapper
);
break
;
case
IS_DELETED
:
ItemToCopy
->
m_Flags
=
flag_type_command
;
if
(
ItemToCopy
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
DrawPickedStruct
*
PickedList
=
(
DrawPickedStruct
*
)
ItemToCopy
;
while
(
PickedList
)
{
CopyOfItem
=
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
;
CopyOfItem
->
m_Flags
=
flag_type_command
;
PickedList
->
m_Flags
=
flag_type_command
;
PickedList
=
PickedList
->
Next
();
itemWrapper
.
m_Item
=
CopyOfItem
;
commandToUndo
->
PushItem
(
itemWrapper
);
}
}
else
{
commandToUndo
->
PushItem
(
itemWrapper
);
}
break
;
default
:
case
IS_NEW
:
{
case
IS_WIRE_IMAGE
:
wxString
msg
;
case
IS_DELETED
:
msg
.
Printf
(
wxT
(
"SaveCopyInUndoList() error (unknown code %X)"
),
flag_type_command
);
commandToUndo
->
PushItem
(
itemWrapper
);
DisplayError
(
this
,
msg
);
}
break
;
break
;
}
default
:
{
wxString
msg
;
msg
.
Printf
(
wxT
(
"SaveCopyInUndoList() error (unknown code %X)"
),
aCommandType
);
DisplayError
(
this
,
msg
);
}
break
;
}
}
/* Save the copy in undo list */
/* Save the copy in undo list */
GetScreen
()
->
PushCommandToUndoList
(
commandToUndo
);
GetScreen
()
->
PushCommandToUndoList
(
commandToUndo
);
...
@@ -418,7 +340,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
...
@@ -418,7 +340,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
{
{
ITEM_PICKER
itemWrapper
=
aList
->
GetItemWrapper
(
ii
);
ITEM_PICKER
itemWrapper
=
aList
->
GetItemWrapper
(
ii
);
item
=
(
SCH_ITEM
*
)
itemWrapper
.
m_Item
;
item
=
(
SCH_ITEM
*
)
itemWrapper
.
m_Item
;
wxASSERT
(
item
);
wxASSERT
(
item
);
SCH_ITEM
*
image
=
(
SCH_ITEM
*
)
itemWrapper
.
m_Link
;
SCH_ITEM
*
image
=
(
SCH_ITEM
*
)
itemWrapper
.
m_Link
;
switch
(
itemWrapper
.
m_UndoRedoStatus
)
switch
(
itemWrapper
.
m_UndoRedoStatus
)
{
{
...
...
include/base_struct.h
View file @
daceb2e0
...
@@ -54,7 +54,6 @@ enum KICAD_T {
...
@@ -54,7 +54,6 @@ enum KICAD_T {
TYPE_SCH_GLOBALLABEL
,
TYPE_SCH_GLOBALLABEL
,
TYPE_SCH_HIERLABEL
,
TYPE_SCH_HIERLABEL
,
TYPE_SCH_COMPONENT
,
TYPE_SCH_COMPONENT
,
DRAW_PICK_ITEM_STRUCT_TYPE
,
DRAW_SEGMENT_STRUCT_TYPE
,
DRAW_SEGMENT_STRUCT_TYPE
,
DRAW_BUSENTRY_STRUCT_TYPE
,
DRAW_BUSENTRY_STRUCT_TYPE
,
DRAW_SHEET_STRUCT_TYPE
,
DRAW_SHEET_STRUCT_TYPE
,
...
...
include/class_drawpickedstruct.h
deleted
100644 → 0
View file @
8ec8cf3f
/*****************************************************************************/
/* sch_item_struct.h : Basic classes for most eeschema items descriptions */
/*****************************************************************************/
#ifndef __CLASS_DRAWPICKEDSTRUCT_H__
#define __CLASS_DRAWPICKEDSTRUCT_H__
#include "base_struct.h"
/**
* Class DrawPickedStruct
* holds structures picked by pick events (like block selection).
* This class has only one useful member: .m_PickedStruct, used as a link.
* It is used to create a linked list of selected items (in block selection).
* Each DrawPickedStruct item has is member: .m_PickedStruct pointing the
* real selected item.
*/
class
DrawPickedStruct
:
public
EDA_BaseStruct
{
public
:
EDA_BaseStruct
*
m_PickedStruct
;
public
:
DrawPickedStruct
(
EDA_BaseStruct
*
pickedstruct
=
NULL
);
~
DrawPickedStruct
();
void
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
)
{
};
void
DeleteWrapperList
();
DrawPickedStruct
*
Next
()
{
return
(
DrawPickedStruct
*
)
Pnext
;
}
EDA_Rect
GetBoundingBox
();
/**
* Function GetBoundingBoxUnion
* returns the union of all the BoundingBox rectangles of all held items
* in the picklist whose list head is this DrawPickedStruct.
* @return EDA_Rect - The combined, composite, bounding box.
*/
EDA_Rect
GetBoundingBoxUnion
();
wxString
GetClass
()
const
{
return
wxT
(
"DrawPickedStruct"
);
}
/**
* Function Draw
* Do nothing, needed for SCH_ITEM compat.
*/
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
)
{
}
/**
* Function Save
* Do nothing, needed for SCH_ITEM compat.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
bool
Save
(
FILE
*
aFile
)
const
{
return
false
;
}
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
#endif
/* __CLASS_DRAWPICKEDSTRUCT_H__ */
include/wxEeschemaStruct.h
View file @
daceb2e0
...
@@ -300,7 +300,7 @@ private:
...
@@ -300,7 +300,7 @@ private:
void
BeginSegment
(
wxDC
*
DC
,
int
type
);
void
BeginSegment
(
wxDC
*
DC
,
int
type
);
void
EndSegment
(
wxDC
*
DC
);
void
EndSegment
(
wxDC
*
DC
);
void
DeleteCurrentSegment
(
wxDC
*
DC
);
void
DeleteCurrentSegment
(
wxDC
*
DC
);
void
DeleteConnection
(
wxDC
*
DC
,
bool
DeleteFullConnection
);
void
DeleteConnection
(
bool
DeleteFullConnection
);
// graphic lines
// graphic lines
void
Delete_Segment_Edge
(
DRAWSEGMENT
*
Segment
,
wxDC
*
DC
);
void
Delete_Segment_Edge
(
DRAWSEGMENT
*
Segment
,
wxDC
*
DC
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment