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
fbeb4116
Commit
fbeb4116
authored
Jan 20, 2011
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Eeschema: Fix incorrect behavior of block drag and wire drag commands.
Other minor fixes
parent
ed8c021f
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
96 additions
and
72 deletions
+96
-72
block.cpp
eeschema/block.cpp
+8
-7
cleanup.cpp
eeschema/cleanup.cpp
+3
-5
operations_on_items_lists.cpp
eeschema/operations_on_items_lists.cpp
+29
-1
protos.h
eeschema/protos.h
+0
-6
sch_line.cpp
eeschema/sch_line.cpp
+4
-3
sch_no_connect.cpp
eeschema/sch_no_connect.cpp
+4
-0
sch_no_connect.h
eeschema/sch_no_connect.h
+1
-0
sch_screen.cpp
eeschema/sch_screen.cpp
+38
-35
schedit.cpp
eeschema/schedit.cpp
+5
-15
netlist.cpp
pcbnew/netlist.cpp
+4
-0
No files found.
eeschema/block.cpp
View file @
fbeb4116
...
@@ -28,12 +28,13 @@
...
@@ -28,12 +28,13 @@
// Imported functions:
// Imported functions:
void
MoveItemsInList
(
PICKED_ITEMS_LIST
&
aItemsList
,
const
wxPoint
aMoveVector
);
extern
void
SetSchItemParent
(
SCH_ITEM
*
Struct
,
SCH_SCREEN
*
Screen
);
void
RotateListOfItems
(
PICKED_ITEMS_LIST
&
aItemsList
,
wxPoint
&
Center
);
extern
void
MoveItemsInList
(
PICKED_ITEMS_LIST
&
aItemsList
,
const
wxPoint
aMoveVector
);
void
Mirror_X_ListOfItems
(
PICKED_ITEMS_LIST
&
aItemsList
,
wxPoint
&
aMirrorPoint
);
extern
void
RotateListOfItems
(
PICKED_ITEMS_LIST
&
aItemsList
,
wxPoint
&
Center
);
void
MirrorListOfItems
(
PICKED_ITEMS_LIST
&
aItemsList
,
wxPoint
&
Center
);
extern
void
Mirror_X_ListOfItems
(
PICKED_ITEMS_LIST
&
aItemsList
,
wxPoint
&
aMirrorPoint
);
void
DeleteItemsInList
(
WinEDA_DrawPanel
*
panel
,
PICKED_ITEMS_LIST
&
aItemsList
);
extern
void
MirrorListOfItems
(
PICKED_ITEMS_LIST
&
aItemsList
,
wxPoint
&
Center
);
void
DuplicateItemsInList
(
SCH_SCREEN
*
screen
,
extern
void
DeleteItemsInList
(
WinEDA_DrawPanel
*
panel
,
PICKED_ITEMS_LIST
&
aItemsList
);
extern
void
DuplicateItemsInList
(
SCH_SCREEN
*
screen
,
PICKED_ITEMS_LIST
&
aItemsList
,
PICKED_ITEMS_LIST
&
aItemsList
,
const
wxPoint
aMoveVector
);
const
wxPoint
aMoveVector
);
...
@@ -581,7 +582,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
...
@@ -581,7 +582,7 @@ void SCH_EDIT_FRAME::PasteListOfItems( wxDC* DC )
(
(
SCH_COMPONENT
*
)
Struct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
Struct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
Struct
)
->
ClearAnnotation
(
NULL
);
(
(
SCH_COMPONENT
*
)
Struct
)
->
ClearAnnotation
(
NULL
);
}
}
Set
a
Parent
(
Struct
,
GetScreen
()
);
Set
SchItem
Parent
(
Struct
,
GetScreen
()
);
Struct
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_DEFAULT_DRAWMODE
);
Struct
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_DEFAULT_DRAWMODE
);
Struct
->
SetNext
(
GetScreen
()
->
GetDrawItems
()
);
Struct
->
SetNext
(
GetScreen
()
->
GetDrawItems
()
);
GetScreen
()
->
SetDrawItems
(
Struct
);
GetScreen
()
->
SetDrawItems
(
Struct
);
...
...
eeschema/cleanup.cpp
View file @
fbeb4116
...
@@ -89,14 +89,12 @@ void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint )
...
@@ -89,14 +89,12 @@ void BreakSegment( SCH_SCREEN* aScreen, wxPoint aBreakpoint )
if
(
!
TestSegmentHit
(
aBreakpoint
,
segment
->
m_Start
,
segment
->
m_End
,
0
)
)
if
(
!
TestSegmentHit
(
aBreakpoint
,
segment
->
m_Start
,
segment
->
m_End
,
0
)
)
continue
;
continue
;
/* ???
/* A segment is found
* Segment connecte: doit etre coupe en 2 si px,py
* It will be cut if aBreakpoint is not a segment end */
* n'est
* pas une extremite */
if
(
(
segment
->
m_Start
==
aBreakpoint
)
||
(
segment
->
m_End
==
aBreakpoint
)
)
if
(
(
segment
->
m_Start
==
aBreakpoint
)
||
(
segment
->
m_End
==
aBreakpoint
)
)
continue
;
continue
;
/* Here we must cut the segment
into 2
. */
/* Here we must cut the segment
and create a new segment
. */
NewSegment
=
new
SCH_LINE
(
*
segment
);
NewSegment
=
new
SCH_LINE
(
*
segment
);
NewSegment
->
m_Start
=
aBreakpoint
;
NewSegment
->
m_Start
=
aBreakpoint
;
segment
->
m_End
=
NewSegment
->
m_Start
;
segment
->
m_End
=
NewSegment
->
m_Start
;
...
...
eeschema/operations_on_items_lists.cpp
View file @
fbeb4116
...
@@ -23,6 +23,34 @@
...
@@ -23,6 +23,34 @@
#include "sch_junction.h"
#include "sch_junction.h"
void
SetSchItemParent
(
SCH_ITEM
*
Struct
,
SCH_SCREEN
*
Screen
)
{
switch
(
Struct
->
Type
()
)
{
case
SCH_POLYLINE_T
:
case
SCH_JUNCTION_T
:
case
SCH_TEXT_T
:
case
SCH_LABEL_T
:
case
SCH_GLOBAL_LABEL_T
:
case
SCH_HIERARCHICAL_LABEL_T
:
case
SCH_COMPONENT_T
:
case
SCH_LINE_T
:
case
SCH_BUS_ENTRY_T
:
case
SCH_SHEET_T
:
case
SCH_MARKER_T
:
case
SCH_NO_CONNECT_T
:
Struct
->
SetParent
(
Screen
);
break
;
case
SCH_SHEET_LABEL_T
:
break
;
default:
break
;
}
}
void
RotateListOfItems
(
PICKED_ITEMS_LIST
&
aItemsList
,
wxPoint
&
rotationPoint
)
void
RotateListOfItems
(
PICKED_ITEMS_LIST
&
aItemsList
,
wxPoint
&
rotationPoint
)
{
{
for
(
unsigned
ii
=
0
;
ii
<
aItemsList
.
GetCount
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
aItemsList
.
GetCount
();
ii
++
)
...
@@ -198,7 +226,7 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
...
@@ -198,7 +226,7 @@ void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
break
;
break
;
}
}
Set
a
Parent
(
newitem
,
screen
);
Set
SchItem
Parent
(
newitem
,
screen
);
newitem
->
SetNext
(
screen
->
GetDrawItems
()
);
newitem
->
SetNext
(
screen
->
GetDrawItems
()
);
screen
->
SetDrawItems
(
newitem
);
screen
->
SetDrawItems
(
newitem
);
}
}
...
...
eeschema/protos.h
View file @
fbeb4116
...
@@ -232,12 +232,6 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen );
...
@@ -232,12 +232,6 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen );
*/
*/
void
BreakSegment
(
SCH_SCREEN
*
aScreen
,
wxPoint
aBreakpoint
);
void
BreakSegment
(
SCH_SCREEN
*
aScreen
,
wxPoint
aBreakpoint
);
/**************/
/* EECLASS.CPP */
/**************/
void
SetaParent
(
SCH_ITEM
*
Struct
,
SCH_SCREEN
*
Screen
);
/***************/
/***************/
/* OPTIONS.CPP */
/* OPTIONS.CPP */
/***************/
/***************/
...
...
eeschema/sch_line.cpp
View file @
fbeb4116
...
@@ -212,13 +212,13 @@ void SCH_LINE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
...
@@ -212,13 +212,13 @@ void SCH_LINE::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
if
(
m_Layer
==
LAYER_NOTES
)
if
(
m_Layer
==
LAYER_NOTES
)
GRDashedLine
(
&
panel
->
m_ClipBox
,
DC
,
start
.
x
,
start
.
y
,
end
.
x
,
end
.
y
,
width
,
color
);
GRDashedLine
(
&
panel
->
m_ClipBox
,
DC
,
start
.
x
,
start
.
y
,
end
.
x
,
end
.
y
,
width
,
color
);
else
else
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
start
.
x
,
start
.
y
,
end
.
x
,
end
.
y
,
width
,
color
);
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
start
,
end
,
width
,
color
);
if
(
m_StartIsDangling
)
if
(
m_StartIsDangling
)
DrawDanglingSymbol
(
panel
,
DC
,
m_Start
+
offse
t
,
color
);
DrawDanglingSymbol
(
panel
,
DC
,
star
t
,
color
);
if
(
m_EndIsDangling
)
if
(
m_EndIsDangling
)
DrawDanglingSymbol
(
panel
,
DC
,
m_End
+
offset
,
color
);
DrawDanglingSymbol
(
panel
,
DC
,
end
,
color
);
}
}
...
@@ -374,6 +374,7 @@ bool SCH_LINE::IsSelectStateChanged( const wxRect& aRect )
...
@@ -374,6 +374,7 @@ bool SCH_LINE::IsSelectStateChanged( const wxRect& aRect )
if
(
aRect
.
Contains
(
m_Start
)
&&
aRect
.
Contains
(
m_End
)
)
if
(
aRect
.
Contains
(
m_Start
)
&&
aRect
.
Contains
(
m_End
)
)
{
{
m_Flags
|=
SELECTED
;
m_Flags
|=
SELECTED
;
m_Flags
&=
~
(
STARTPOINT
|
ENDPOINT
);
}
}
else
if
(
aRect
.
Contains
(
m_Start
)
)
else
if
(
aRect
.
Contains
(
m_Start
)
)
{
{
...
...
eeschema/sch_no_connect.cpp
View file @
fbeb4116
...
@@ -152,6 +152,10 @@ void SCH_NO_CONNECT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
...
@@ -152,6 +152,10 @@ void SCH_NO_CONNECT::GetConnectionPoints( vector< wxPoint >& aPoints ) const
aPoints
.
push_back
(
m_Pos
);
aPoints
.
push_back
(
m_Pos
);
}
}
bool
SCH_NO_CONNECT
::
doIsConnected
(
const
wxPoint
&
aPosition
)
const
{
return
m_Pos
==
aPosition
;
}
bool
SCH_NO_CONNECT
::
doHitTest
(
const
wxPoint
&
aPoint
,
int
aAccuracy
,
SCH_FILTER_T
aFilter
)
const
bool
SCH_NO_CONNECT
::
doHitTest
(
const
wxPoint
&
aPoint
,
int
aAccuracy
,
SCH_FILTER_T
aFilter
)
const
{
{
...
...
eeschema/sch_no_connect.h
View file @
fbeb4116
...
@@ -95,6 +95,7 @@ public:
...
@@ -95,6 +95,7 @@ public:
virtual
void
GetConnectionPoints
(
vector
<
wxPoint
>&
aPoints
)
const
;
virtual
void
GetConnectionPoints
(
vector
<
wxPoint
>&
aPoints
)
const
;
private
:
private
:
virtual
bool
doIsConnected
(
const
wxPoint
&
aPosition
)
const
;
virtual
bool
doHitTest
(
const
wxPoint
&
aPoint
,
int
aAccuracy
,
SCH_FILTER_T
aFilter
)
const
;
virtual
bool
doHitTest
(
const
wxPoint
&
aPoint
,
int
aAccuracy
,
SCH_FILTER_T
aFilter
)
const
;
virtual
bool
doHitTest
(
const
EDA_Rect
&
aRect
,
bool
aContained
,
int
aAccuracy
)
const
;
virtual
bool
doHitTest
(
const
EDA_Rect
&
aRect
,
bool
aContained
,
int
aAccuracy
)
const
;
virtual
EDA_ITEM
*
doClone
()
const
;
virtual
EDA_ITEM
*
doClone
()
const
;
...
...
eeschema/sch_screen.cpp
View file @
fbeb4116
...
@@ -25,34 +25,6 @@
...
@@ -25,34 +25,6 @@
#include <boost/foreach.hpp>
#include <boost/foreach.hpp>
void
SetaParent
(
SCH_ITEM
*
Struct
,
SCH_SCREEN
*
Screen
)
{
switch
(
Struct
->
Type
()
)
{
case
SCH_POLYLINE_T
:
case
SCH_JUNCTION_T
:
case
SCH_TEXT_T
:
case
SCH_LABEL_T
:
case
SCH_GLOBAL_LABEL_T
:
case
SCH_HIERARCHICAL_LABEL_T
:
case
SCH_COMPONENT_T
:
case
SCH_LINE_T
:
case
SCH_BUS_ENTRY_T
:
case
SCH_SHEET_T
:
case
SCH_MARKER_T
:
case
SCH_NO_CONNECT_T
:
Struct
->
SetParent
(
Screen
);
break
;
case
SCH_SHEET_LABEL_T
:
break
;
default:
break
;
}
}
/* Default EESchema zoom values. Limited to 17 values to keep a decent size
/* Default EESchema zoom values. Limited to 17 values to keep a decent size
* to menus
* to menus
*/
*/
...
@@ -573,13 +545,29 @@ void SCH_SCREEN::SelectBlockItems()
...
@@ -573,13 +545,29 @@ void SCH_SCREEN::SelectBlockItems()
return
;
return
;
// Select all the items in the screen connected to the items in the block.
// Select all the items in the screen connected to the items in the block.
for
(
unsigned
ii
=
0
;
ii
<
pickedlist
->
GetCount
();
ii
++
)
// be sure end lines that are on the block limits are seen inside this block
m_BlockLocate
.
Inflate
(
1
);
unsigned
last_select_id
=
pickedlist
->
GetCount
();
unsigned
ii
=
0
;
for
(
;
ii
<
last_select_id
;
ii
++
)
{
{
item
=
(
SCH_ITEM
*
)
pickedlist
->
GetPickedItem
(
ii
);
item
=
(
SCH_ITEM
*
)
pickedlist
->
GetPickedItem
(
ii
);
if
(
item
->
Type
()
==
SCH_LINE_T
)
if
(
item
->
Type
()
==
SCH_LINE_T
)
{
{
item
->
IsSelectStateChanged
(
m_BlockLocate
);
item
->
IsSelectStateChanged
(
m_BlockLocate
);
if
(
(
item
->
m_Flags
&
SELECTED
)
==
0
)
{
// This is a special case:
// this selected wire has no ends in block.
// But it was selected (because it intersects the selecting area),
// so we must keep it selected and select items connected to it
// Note: an other option could be: remove it from drag list
item
->
m_Flags
|=
SELECTED
|
SKIP_STRUCT
;
std
::
vector
<
wxPoint
>
connections
;
item
->
GetConnectionPoints
(
connections
);
for
(
size_t
i
=
0
;
i
<
connections
.
size
();
i
++
)
addConnectedItemsToBlock
(
connections
[
i
]
);
}
pickedlist
->
SetPickerFlags
(
item
->
m_Flags
,
ii
);
pickedlist
->
SetPickerFlags
(
item
->
m_Flags
,
ii
);
}
}
else
if
(
item
->
IsConnectable
()
)
else
if
(
item
->
IsConnectable
()
)
...
@@ -592,6 +580,8 @@ void SCH_SCREEN::SelectBlockItems()
...
@@ -592,6 +580,8 @@ void SCH_SCREEN::SelectBlockItems()
addConnectedItemsToBlock
(
connections
[
i
]
);
addConnectedItemsToBlock
(
connections
[
i
]
);
}
}
}
}
m_BlockLocate
.
Inflate
(
-
1
);
}
}
...
@@ -599,30 +589,43 @@ void SCH_SCREEN::addConnectedItemsToBlock( const wxPoint& position )
...
@@ -599,30 +589,43 @@ void SCH_SCREEN::addConnectedItemsToBlock( const wxPoint& position )
{
{
SCH_ITEM
*
item
;
SCH_ITEM
*
item
;
ITEM_PICKER
picker
;
ITEM_PICKER
picker
;
bool
addinlist
=
true
;
for
(
item
=
GetDrawItems
();
item
!=
NULL
;
item
=
item
->
Next
()
)
for
(
item
=
GetDrawItems
();
item
!=
NULL
;
item
=
item
->
Next
()
)
{
{
picker
.
m_PickedItem
=
item
;
picker
.
m_PickedItem
=
item
;
picker
.
m_PickedItemType
=
item
->
Type
();
picker
.
m_PickedItemType
=
item
->
Type
();
if
(
item
->
IsSelected
()
||
!
item
->
IsConnectable
()
||
!
item
->
IsConnected
(
position
)
)
if
(
!
item
->
IsConnectable
()
||
!
item
->
IsConnected
(
position
)
||
(
item
->
m_Flags
&
SKIP_STRUCT
)
)
continue
;
continue
;
item
->
m_Flags
=
SELECTED
;
if
(
item
->
IsSelected
()
&&
item
->
Type
()
!=
SCH_LINE_T
)
continue
;
// A line having 2 ends, it can be tested twice: one time per end
if
(
item
->
Type
()
==
SCH_LINE_T
)
if
(
item
->
Type
()
==
SCH_LINE_T
)
{
{
if
(
!
item
->
IsSelected
()
)
// First time this line is tested
item
->
m_Flags
=
SELECTED
|
STARTPOINT
|
ENDPOINT
;
else
// second time (or more) this line is tested
addinlist
=
false
;
SCH_LINE
*
line
=
(
SCH_LINE
*
)
item
;
SCH_LINE
*
line
=
(
SCH_LINE
*
)
item
;
if
(
line
->
m_Start
==
position
)
if
(
line
->
m_Start
==
position
)
item
->
m_Flags
|=
END
POINT
;
item
->
m_Flags
&=
~
START
POINT
;
else
if
(
line
->
m_End
==
position
)
else
if
(
line
->
m_End
==
position
)
item
->
m_Flags
|=
START
POINT
;
item
->
m_Flags
&=
~
END
POINT
;
}
}
else
item
->
m_Flags
=
SELECTED
;
if
(
addinlist
)
{
picker
.
m_PickerFlags
=
item
->
m_Flags
;
picker
.
m_PickerFlags
=
item
->
m_Flags
;
m_BlockLocate
.
m_ItemsSelection
.
PushItem
(
picker
);
m_BlockLocate
.
m_ItemsSelection
.
PushItem
(
picker
);
}
}
}
}
}
...
...
eeschema/schedit.cpp
View file @
fbeb4116
...
@@ -464,21 +464,11 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -464,21 +464,11 @@ void SCH_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break
;
break
;
// Ensure the block selection contains the segment, or one end of
// Ensure the block selection contains the segment, or one end of
// the segment. The initial rect is only one point (w = h = 0)
// the segment. The initial rect is only one point (w = h = 2)
// The rect must contains one or 2 ends.
// The rect contains one or 0 ends.
// If only one end is selected, this is a drag Node
// If one end is selected, this is a drag Node
// if no ends selected, we adjust the rect area to contain the
// if no ends selected the current segment is dragged
// whole segment. This works fine only for H and V segments and
screen
->
m_BlockLocate
.
Inflate
(
1
);
// only if they do not cross a component
// TODO: a better way to drag only wires
SCH_LINE
*
segm
=
(
SCH_LINE
*
)
screen
->
GetCurItem
();
if
(
!
screen
->
m_BlockLocate
.
Contains
(
segm
->
m_Start
)
&&
!
screen
->
m_BlockLocate
.
Contains
(
segm
->
m_End
)
)
{
screen
->
m_BlockLocate
.
SetOrigin
(
segm
->
m_Start
);
screen
->
m_BlockLocate
.
SetEnd
(
segm
->
m_End
);
}
HandleBlockEnd
(
&
dc
);
HandleBlockEnd
(
&
dc
);
}
}
break
;
break
;
...
...
pcbnew/netlist.cpp
View file @
fbeb4116
...
@@ -189,7 +189,11 @@ bool WinEDA_PcbFrame::ReadPcbNetlist( const wxString& aNetlistFullFilename,
...
@@ -189,7 +189,11 @@ bool WinEDA_PcbFrame::ReadPcbNetlist( const wxString& aNetlistFullFilename,
GetScreen
()
->
ClearUndoRedoList
();
GetScreen
()
->
ClearUndoRedoList
();
OnModify
();
OnModify
();
// Clear flags and pointeurs to avoid inconsistencies
GetBoard
()
->
m_Status_Pcb
=
0
;
GetBoard
()
->
m_Status_Pcb
=
0
;
SetCurItem
(
NULL
);
State
=
0
;
State
=
0
;
Comment
=
0
;
Comment
=
0
;
s_NbNewModules
=
0
;
s_NbNewModules
=
0
;
...
...
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