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
c406eed1
Commit
c406eed1
authored
Mar 20, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
class name changes, XOR artifacts
parent
bd77c9f2
Changes
52
Hide whitespace changes
Inline
Side-by-side
Showing
52 changed files
with
2798 additions
and
2726 deletions
+2798
-2726
change_log.txt
change_log.txt
+21
-0
base_struct.cpp
common/base_struct.cpp
+39
-3
affiche.cpp
eeschema/affiche.cpp
+2
-2
annotate.cpp
eeschema/annotate.cpp
+7
-7
block.cpp
eeschema/block.cpp
+105
-107
bus-wire-junction.cpp
eeschema/bus-wire-junction.cpp
+26
-26
class_drawsheet.cpp
eeschema/class_drawsheet.cpp
+75
-75
class_screen.cpp
eeschema/class_screen.cpp
+5
-5
class_text-label.cpp
eeschema/class_text-label.cpp
+36
-36
class_text-label.h
eeschema/class_text-label.h
+22
-22
cleanup.cpp
eeschema/cleanup.cpp
+5
-5
cmpclass.cpp
eeschema/cmpclass.cpp
+1
-1
component_class.cpp
eeschema/component_class.cpp
+26
-43
component_class.h
eeschema/component_class.h
+15
-29
controle.cpp
eeschema/controle.cpp
+7
-7
cross-probing.cpp
eeschema/cross-probing.cpp
+3
-3
dangling_ends.cpp
eeschema/dangling_ends.cpp
+16
-16
delete.cpp
eeschema/delete.cpp
+2
-2
dialog_build_BOM.cpp
eeschema/dialog_build_BOM.cpp
+25
-25
dialog_build_BOM.h
eeschema/dialog_build_BOM.h
+20
-20
dialog_edit_component_in_schematic.cpp
eeschema/dialog_edit_component_in_schematic.cpp
+23
-23
dialog_edit_component_in_schematic.h
eeschema/dialog_edit_component_in_schematic.h
+30
-30
dialog_edit_label.cpp
eeschema/dialog_edit_label.cpp
+41
-41
dialog_edit_label.h
eeschema/dialog_edit_label.h
+11
-11
edit_component_in_schematic.cpp
eeschema/edit_component_in_schematic.cpp
+65
-65
edit_label.cpp
eeschema/edit_label.cpp
+52
-52
eecreate.cpp
eeschema/eecreate.cpp
+10
-10
eelibs_draw_components.cpp
eeschema/eelibs_draw_components.cpp
+20
-20
eeredraw.cpp
eeschema/eeredraw.cpp
+11
-11
files-io.cpp
eeschema/files-io.cpp
+159
-159
find.cpp
eeschema/find.cpp
+16
-16
getpart.cpp
eeschema/getpart.cpp
+13
-11
hotkeys.cpp
eeschema/hotkeys.cpp
+86
-86
load_one_schematic_file.cpp
eeschema/load_one_schematic_file.cpp
+102
-102
locate.cpp
eeschema/locate.cpp
+51
-51
netform.cpp
eeschema/netform.cpp
+112
-112
netlist.cpp
eeschema/netlist.cpp
+137
-137
netlist.h
eeschema/netlist.h
+13
-13
onleftclick.cpp
eeschema/onleftclick.cpp
+12
-12
onrightclick.cpp
eeschema/onrightclick.cpp
+41
-41
plot.cpp
eeschema/plot.cpp
+41
-41
plothpgl.cpp
eeschema/plothpgl.cpp
+262
-262
plotps.cpp
eeschema/plotps.cpp
+203
-203
protos.h
eeschema/protos.h
+193
-193
save_schemas.cpp
eeschema/save_schemas.cpp
+486
-486
schedit.cpp
eeschema/schedit.cpp
+38
-38
schematic_undo_redo.cpp
eeschema/schematic_undo_redo.cpp
+9
-9
schframe.h
eeschema/schframe.h
+18
-18
sheetlab.cpp
eeschema/sheetlab.cpp
+5
-5
base_struct.h
include/base_struct.h
+68
-22
wxstruct.h
include/wxstruct.h
+11
-11
specctra.h
pcbnew/specctra.h
+1
-1
No files found.
change_log.txt
View file @
c406eed1
...
...
@@ -5,6 +5,27 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Mar-19 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+eeschema
Renamed some classes and their corresponding KICAD_T types so they are both
simpler, shorter and more closely match each other: the type and the classname.
Wedged a class SCH_ITEM underneath most eeschema drawable items, and this
class came from DrawPartStruct which was largely disfunctional. Eeschema
now more closely matches what we have in pcbnew with the BOARD_ITEM base class.
The corresponding class in eeschema is now SCH_ITEM. Put in some of Jonas'
patch for the dragging of a block. Needs testing, especially dragging
text since there is no GetBoundingBox() for that yet. As an interrim solution
we could make SCH_ITEM::GetBoundingBox() return a HUGE rectangle so that any class
not implementing GetBoundingBox() in eeschema will get properly re-drawn,
in theory.
We are currently using XORing for dragging a single object and using full
redraws for dragging a block. I suppose this can be an experiment for a
week or so. I would not expect that dragging a block of labels with no
other object to work currently.
2008-Mar-19 UPDATE Igor Plyatov <plyatov@mail.ru>
================================================================================
* Support for Gnome/KDE menu added.
...
...
common/base_struct.cpp
View file @
c406eed1
...
...
@@ -805,8 +805,9 @@ EDA_Rect& EDA_Rect::Inflate( wxCoord dx, wxCoord dy )
}
/** Function Merge
* Modify Position and Size of this in order to contain the given rect
/**
* Function Merge
* modifies Position and Size of this in order to contain the given rect
* mainly used to calculate bounding boxes
* @param aRect = given rect to merge with this
*/
...
...
@@ -840,7 +841,7 @@ void EDA_Rect::Merge( const EDA_Rect& aRect )
/*******************************************************************/
DrawPickedStruct
::
DrawPickedStruct
(
EDA_BaseStruct
*
pickedstruct
)
:
EDA_BaseStruct
(
DRAW_PICK_ITEM_STRUCT_TYPE
)
SCH_ITEM
(
NULL
,
DRAW_PICK_ITEM_STRUCT_TYPE
)
/*******************************************************************/
{
m_PickedStruct
=
pickedstruct
;
...
...
@@ -851,6 +852,41 @@ 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
;
DrawPickedStruct
*
cur
=
this
;
EDA_BaseStruct
*
item
;
while
(
cur
&&
(
item
=
cur
->
m_PickedStruct
)
!=
NULL
)
{
ret
.
Merge
(
item
->
GetBoundingBox
()
);
cur
=
cur
->
Next
();
}
return
ret
;
}
/*********************************************/
void
DrawPickedStruct
::
DeleteWrapperList
()
...
...
eeschema/affiche.cpp
View file @
c406eed1
...
...
@@ -27,7 +27,7 @@ void DrawSheetStruct::Display_Infos( WinEDA_DrawFrame* frame )
/***************************************************************/
void
EDA_SchComponentStruct
::
Display_Infos
(
WinEDA_DrawFrame
*
frame
)
void
SCH_COMPONENT
::
Display_Infos
(
WinEDA_DrawFrame
*
frame
)
/***************************************************************/
{
EDA_LibComponentStruct
*
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);;
...
...
@@ -37,7 +37,7 @@ void EDA_SchComponentStruct::Display_Infos( WinEDA_DrawFrame* frame )
frame
->
MsgPanel
->
EraseMsgBox
();
Affiche_1_Parametre
(
frame
,
1
,
_
(
"Ref"
),
GetRef
(((
WinEDA_SchematicFrame
*
)
frame
)
->
GetSheet
()),
DARKCYAN
);
GetRef
(((
WinEDA_SchematicFrame
*
)
frame
)
->
GetSheet
()),
DARKCYAN
);
if
(
Entry
&&
Entry
->
m_Options
==
ENTRY_POWER
)
msg
=
_
(
"Pwr Symb"
);
...
...
eeschema/annotate.cpp
View file @
c406eed1
...
...
@@ -90,10 +90,10 @@ void ReAnnotatePowerSymbolsOnly( void )
EDA_BaseStruct
*
DrawList
=
sheet
->
LastDrawList
();
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
{
if
(
DrawList
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
DrawList
->
Type
()
!=
TYPE_SCH_COMPONENT
)
continue
;
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
EDA_LibComponentStruct
*
Entry
=
FindLibPart
(
DrawLibItem
->
m_ChipName
.
GetData
(),
wxEmptyString
,
...
...
@@ -303,14 +303,14 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet )
{
int
NbrCmp
=
0
;
EDA_BaseStruct
*
DrawList
=
sheet
->
LastDrawList
();
EDA_SchComponentStruct
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
EDA_LibComponentStruct
*
Entry
;
for
(
;
DrawList
;
DrawList
=
DrawList
->
Pnext
)
{
if
(
DrawList
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
DrawList
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
Entry
=
FindLibPart
(
DrawLibItem
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
...
...
@@ -361,7 +361,7 @@ static void ReAnnotateComponents( CmpListStruct* BaseListeCmp, int NbOfCmp )
{
int
ii
;
char
*
Text
;
EDA_SchComponentStruct
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
/* Reattribution des numeros */
for
(
ii
=
0
;
ii
<
NbOfCmp
;
ii
++
)
...
...
eeschema/block.cpp
View file @
c406eed1
...
...
@@ -24,7 +24,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_
EDA_BaseStruct
*
DrawStruct
);
static
void
CollectStructsToDrag
(
SCH_SCREEN
*
screen
);
static
void
AddPickedItem
(
SCH_SCREEN
*
screen
,
wxPoint
position
);
static
LibEDA_BaseStruct
*
GetNextPinPosition
(
EDA_SchComponentStruct
*
DrawLibItem
,
static
LibEDA_BaseStruct
*
GetNextPinPosition
(
SCH_COMPONENT
*
DrawLibItem
,
wxPoint
&
position
);
static
void
DrawMovingBlockOutlines
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
EDA_BaseStruct
*
SaveStructListForPaste
(
EDA_BaseStruct
*
DrawStruct
);
...
...
@@ -555,27 +555,28 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
*****************************************************************************/
bool
MoveStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_BaseStruct
*
DrawStruct
)
{
DrawPickedStruct
*
PickedList
=
NULL
;
if
(
!
DrawStruct
)
return
FALSE
;
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
DrawPickedStruct
*
pickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
if
(
DC
)
RedrawStructList
(
panel
,
DC
,
DrawStruct
,
g_XorMode
);
PlaceStruct
(
panel
->
GetScreen
(),
DrawStruct
);
/* Place it in its new position. */
panel
->
PostDirtyRect
(
pickedList
->
GetBoundingBoxUnion
()
);
PlaceStruct
(
panel
->
GetScreen
(),
pickedList
);
// Place it in its new position.
if
(
DC
)
RedrawStructList
(
panel
,
DC
,
DrawStruc
t
,
GR_DEFAULT_DRAWMODE
);
RedrawStructList
(
panel
,
DC
,
pickedLis
t
,
GR_DEFAULT_DRAWMODE
);
/* Free the wrapper DrawPickedStruct chain: */
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
PickedList
->
DeleteWrapperList
();
// Free the wrapper DrawPickedStruct chain
pickedList
->
DeleteWrapperList
();
}
else
{
if
(
DC
)
RedrawOneStruct
(
panel
,
DC
,
DrawStruct
,
g_XorMode
);
panel
->
PostDirtyRect
(
DrawStruct
->
GetBoundingBox
()
);
PlaceStruct
(
panel
->
GetScreen
(),
DrawStruct
);
/* Place it in its new position. */
if
(
DC
)
RedrawOneStruct
(
panel
,
DC
,
DrawStruct
,
GR_DEFAULT_DRAWMODE
);
...
...
@@ -604,12 +605,12 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
DrawJunctionStruct
*
DrawConnect
;
EDA_DrawLineStruct
*
DrawSegment
;
DrawBusEntryStruct
*
DrawRaccord
;
EDA_SchComponentStruct
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
DrawSheetStruct
*
DrawSheet
;
DrawSheetLabelStruct
*
DrawSheetLabel
;
DrawMarkerStruct
*
DrawMarker
;
DrawNoConnectStruct
*
DrawNoConnect
;
DrawTextStruct
*
DrawText
;
SCH_TEXT
*
DrawText
;
wxPoint
px
;
if
(
!
DrawStruct
)
...
...
@@ -665,13 +666,13 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
MirrorYPoint
(
DrawNoConnect
->
m_Pos
,
Center
);
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_LABEL
:
// Text is not really mirrored; it is moved to a suitable position
// which is the closest position for a true mirrored text
// The center position is mirrored and the text is moved for half horizontal len
DrawText
=
(
DrawTextStruct
*
)
DrawStruct
;
DrawText
=
(
SCH_TEXT
*
)
DrawStruct
;
px
=
DrawText
->
m_Pos
;
if
(
DrawText
->
m_Orient
==
0
)
/* horizontal text */
dx
=
DrawText
->
Len_Size
()
/
2
;
...
...
@@ -687,11 +688,11 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
DrawText
->
m_Pos
.
x
=
px
.
x
;
break
;
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_GLOBALLABEL
:
// Text is not really mirrored: Orientation is changed
DrawText
=
(
DrawLabelStruct
*
)
DrawStruct
;
DrawText
=
(
SCH_LABEL
*
)
DrawStruct
;
if
(
DrawText
->
m_Orient
==
0
)
/* horizontal text */
DrawText
->
m_Orient
=
2
;
else
if
(
DrawText
->
m_Orient
==
2
)
/* invert horizontal text*/
...
...
@@ -703,8 +704,8 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
DrawText
->
m_Pos
.
x
=
px
.
x
;
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawStruct
;
case
TYPE_SCH_COMPONENT
:
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawStruct
;
dx
=
DrawLibItem
->
m_Pos
.
x
;
g_EDA_Appl
->
m_SchematicFrame
->
CmpRotationMiroir
(
DrawLibItem
,
NULL
,
CMP_MIROIR_Y
);
...
...
@@ -753,43 +754,42 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
*****************************************************************************/
bool
MirrorStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_BaseStruct
*
DrawStruct
,
wxPoint
&
Center
)
{
DrawPickedStruct
*
PickedList
=
NULL
;
DrawPickedStruct
*
DrawStructs
;
if
(
!
DrawStruct
)
return
FALSE
;
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
DrawPickedStruct
*
pickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
if
(
DC
)
RedrawStructList
(
panel
,
DC
,
DrawStruct
,
g_XorMode
);
DrawStructs
=
(
DrawPickedStruct
*
)
DrawStruct
;
while
(
DrawStructs
)
panel
->
PostDirtyRect
(
pickedList
->
GetBoundingBoxUnion
()
);
for
(
DrawPickedStruct
*
cur
=
pickedList
;
cur
;
cur
=
cur
->
Next
()
)
{
MirrorOneStruct
(
DrawStructs
->
m_PickedStruct
,
Center
);
DrawStructs
->
m_PickedStruct
->
m_Flags
=
0
;
DrawStructs
=
(
DrawPickedStruct
*
)
DrawStructs
->
Pnext
;
MirrorOneStruct
(
cur
->
m_PickedStruct
,
Center
);
cur
->
m_PickedStruct
->
m_Flags
=
0
;
}
if
(
DC
)
RedrawStructList
(
panel
,
DC
,
DrawStruc
t
,
GR_DEFAULT_DRAWMODE
);
RedrawStructList
(
panel
,
DC
,
pickedLis
t
,
GR_DEFAULT_DRAWMODE
);
/* Free the wrapper DrawPickedStruct chain: */
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
PickedList
->
DeleteWrapperList
();
// Free the wrapper DrawPickedStruct chain
pickedList
->
DeleteWrapperList
();
}
else
{
if
(
DC
)
RedrawOneStruct
(
panel
,
DC
,
DrawStruct
,
g_XorMode
);
MirrorOneStruct
(
DrawStruct
,
Center
);
/* Place it in its new position. */
panel
->
PostDirtyRect
(
DrawStruct
->
GetBoundingBox
()
);
MirrorOneStruct
(
DrawStruct
,
Center
);
// Place it in its new position.
if
(
DC
)
RedrawOneStruct
(
panel
,
DC
,
DrawStruct
,
GR_DEFAULT_DRAWMODE
);
DrawStruct
->
m_Flags
=
0
;
}
return
TRUE
;
return
true
;
}
...
...
@@ -825,10 +825,10 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
switch
(
Struct
->
Type
()
)
{
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
{
(
(
EDA_SchComponentStruct
*
)
Struct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
EDA_SchComponentStruct
*
)
Struct
)
->
ClearAnnotation
();
(
(
SCH_COMPONENT
*
)
Struct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
Struct
)
->
ClearAnnotation
();
}
break
;
...
...
@@ -872,10 +872,10 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
...
...
@@ -891,9 +891,9 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
break
;
}
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
(
(
EDA_SchComponentStruct
*
)
NewDrawStruct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
EDA_SchComponentStruct
*
)
NewDrawStruct
)
->
ClearAnnotation
();
case
TYPE_SCH_COMPONENT
:
(
(
SCH_COMPONENT
*
)
NewDrawStruct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
NewDrawStruct
)
->
ClearAnnotation
();
break
;
}
...
...
@@ -924,13 +924,11 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
*/
{
SCH_SCREEN
*
screen
=
(
SCH_SCREEN
*
)
panel
->
GetScreen
();
DrawPickedStruct
*
PickedList
=
NULL
;
WinEDA_SchematicFrame
*
frame
=
(
WinEDA_SchematicFrame
*
)
panel
->
m_Parent
;
if
(
!
DrawStruct
)
return
;
if
(
DrawStruct
->
Type
()
==
DRAW_SHEETLABEL_STRUCT_TYPE
)
{
/* Cette stucture est rattachee a une feuille, et n'est pas
...
...
@@ -942,34 +940,34 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
/
* Unlink all picked structs from current EEDrawList */
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
while
(
PickedList
)
/
/ Unlink all picked structs from current EEDrawList
for
(
DrawPickedStruct
*
cur
=
(
DrawPickedStruct
*
)
DrawStruct
;
cur
;
cur
=
cur
->
Next
()
)
{
screen
->
RemoveFromDrawList
(
PickedList
->
m_PickedStruct
)
;
PickedList
->
m_PickedStruct
->
Pnext
=
PickedList
->
m_PickedStruct
->
Pback
=
NULL
;
PickedList
->
m_PickedStruct
->
m_Flags
=
IS_DELETED
;
PickedList
=
PickedList
->
Next
()
;
EDA_BaseStruct
*
item
=
cur
->
m_PickedStruct
;
screen
->
RemoveFromDrawList
(
item
);
panel
->
PostDirtyRect
(
item
->
GetBoundingBox
()
)
;
item
->
Pnext
=
item
->
Pback
=
NULL
;
item
->
m_Flags
=
IS_DELETED
;
}
RedrawStructList
(
panel
,
DC
,
DrawStruct
,
g_XorMode
);
/* Removed items are put to the Undo list */
// Removed items are put onto the Undo list
frame
->
SaveCopyInUndoList
(
DrawStruct
,
IS_DELETED
);
}
else
/* structure classique */
{
screen
->
RemoveFromDrawList
(
DrawStruct
);
if
(
(
DrawStruct
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
||
(
DrawStruct
->
Type
()
==
DRAW_JUNCTION_STRUCT_TYPE
)
||
(
DrawStruct
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
)
switch
(
DrawStruct
->
Type
()
)
{
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
panel
->
PostDirtyRect
(
DrawStruct
->
GetBoundingBox
()
);
}
else
{
break
;
// other classes do not yet have GetBoundingBox() implementations
default
:
D
(
DrawStruct
->
Show
(
0
,
std
::
cout
);
)
// tell me which classes still need GetBoundingBox support
RedrawOneStruct
(
panel
,
DC
,
DrawStruct
,
g_XorMode
);
}
...
...
@@ -1062,10 +1060,10 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
for
(
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
PickedList
!=
NULL
;
)
// Clear annotation for new components
{
EDA_BaseStruct
*
Struct
=
PickedList
->
m_PickedStruct
;
if
(
Struct
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
Struct
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
(
(
EDA_SchComponentStruct
*
)
Struct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
EDA_SchComponentStruct
*
)
Struct
)
->
ClearAnnotation
();
(
(
SCH_COMPONENT
*
)
Struct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
Struct
)
->
ClearAnnotation
();
SetStructFather
(
Struct
,
GetScreen
()
);
}
PickedList
=
(
DrawPickedStruct
*
)
PickedList
->
Pnext
;
...
...
@@ -1086,10 +1084,10 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
}
else
{
if
(
DrawStruct
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
DrawStruct
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
(
(
EDA_SchComponentStruct
*
)
DrawStruct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
EDA_SchComponentStruct
*
)
DrawStruct
)
->
ClearAnnotation
();
(
(
SCH_COMPONENT
*
)
DrawStruct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
DrawStruct
)
->
ClearAnnotation
();
}
SetStructFather
(
DrawStruct
,
GetScreen
()
);
RedrawOneStruct
(
DrawPanel
,
DC
,
DrawStruct
,
GR_DEFAULT_DRAWMODE
);
...
...
@@ -1135,11 +1133,11 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct )
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_COMPONENT
:
case
DRAW_SHEET_STRUCT_TYPE
:
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
...
...
@@ -1174,7 +1172,7 @@ void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector )
DrawJunctionStruct
*
DrawConnect
;
EDA_DrawLineStruct
*
DrawSegment
;
DrawBusEntryStruct
*
DrawRaccord
;
EDA_SchComponentStruct
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
DrawSheetStruct
*
DrawSheet
;
DrawSheetLabelStruct
*
DrawSheetLabel
;
DrawMarkerStruct
*
DrawMarker
;
...
...
@@ -1231,24 +1229,24 @@ void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector )
DrawNoConnect
->
m_Pos
+=
move_vector
;
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
#define DrawText ( (
DrawTextStruct
*) DrawStruct )
case
TYPE_SCH_TEXT
:
#define DrawText ( (
SCH_TEXT
*) DrawStruct )
DrawText
->
m_Pos
+=
move_vector
;
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
#define DrawLabel ( (
DrawLabelStruct
*) DrawStruct )
case
TYPE_SCH_LABEL
:
#define DrawLabel ( (
SCH_LABEL
*) DrawStruct )
DrawLabel
->
m_Pos
+=
move_vector
;
break
;
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
#define DrawGHLabel ( (
DrawLabelStruct
*) DrawStruct )
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_GLOBALLABEL
:
#define DrawGHLabel ( (
SCH_LABEL
*) DrawStruct )
DrawGHLabel
->
m_Pos
+=
move_vector
;
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawStruct
;
case
TYPE_SCH_COMPONENT
:
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawStruct
;
DrawLibItem
->
m_Pos
+=
move_vector
;
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
...
...
@@ -1325,24 +1323,24 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct )
NewDrawStruct
=
(
(
DrawNoConnectStruct
*
)
DrawStruct
)
->
GenCopy
();
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
NewDrawStruct
=
(
(
DrawTextStruct
*
)
DrawStruct
)
->
GenCopy
();
case
TYPE_SCH_TEXT
:
NewDrawStruct
=
(
(
SCH_TEXT
*
)
DrawStruct
)
->
GenCopy
();
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
NewDrawStruct
=
(
(
DrawLabelStruct
*
)
DrawStruct
)
->
GenCopy
();
case
TYPE_SCH_LABEL
:
NewDrawStruct
=
(
(
SCH_LABEL
*
)
DrawStruct
)
->
GenCopy
();
break
;
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
NewDrawStruct
=
(
(
DrawHierLabelStruct
*
)
DrawStruct
)
->
GenCopy
();
case
TYPE_SCH_HIERLABEL
:
NewDrawStruct
=
(
(
SCH_HIERLABEL
*
)
DrawStruct
)
->
GenCopy
();
break
;
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
NewDrawStruct
=
(
(
DrawGlobalLabelStruct
*
)
DrawStruct
)
->
GenCopy
();
case
TYPE_SCH_GLOBALLABEL
:
NewDrawStruct
=
(
(
SCH_GLOBALLABEL
*
)
DrawStruct
)
->
GenCopy
();
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
NewDrawStruct
=
(
(
EDA_SchComponentStruct
*
)
DrawStruct
)
->
GenCopy
();
case
TYPE_SCH_COMPONENT
:
NewDrawStruct
=
(
(
SCH_COMPONENT
*
)
DrawStruct
)
->
GenCopy
();
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
...
...
@@ -1465,11 +1463,11 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
{
Struct
=
DrawStructs
->
m_PickedStruct
;
DrawStructs
=
(
DrawPickedStruct
*
)
DrawStructs
->
Pnext
;
if
(
Struct
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
Struct
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
LibEDA_BaseStruct
*
DrawItem
;
wxPoint
pos
;
DrawItem
=
GetNextPinPosition
(
(
EDA_SchComponentStruct
*
)
Struct
,
pos
);
DrawItem
=
GetNextPinPosition
(
(
SCH_COMPONENT
*
)
Struct
,
pos
);
while
(
DrawItem
)
{
if
(
(
pos
.
x
<
ox
)
||
(
pos
.
x
>
fx
)
||
(
pos
.
y
<
oy
)
||
(
pos
.
y
>
fy
)
)
...
...
@@ -1587,12 +1585,12 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
case
DRAW_BUSENTRY_STRUCT_TYPE
:
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
#undef STRUCT
#define STRUCT ( (
DrawLabelStruct
*) Struct )
#define STRUCT ( (
SCH_LABEL
*) Struct )
if
(
Struct
->
m_Flags
&
SELECTED
)
break
;
/* Already in list */
if
(
STRUCT
->
m_Pos
!=
position
)
...
...
@@ -1604,10 +1602,10 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
Struct
->
m_Flags
|=
SELECTED
;
break
;
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_GLOBALLABEL
:
#undef STRUCT
#define STRUCT ( (
DrawLabelStruct
*) Struct )
#define STRUCT ( (
SCH_LABEL
*) Struct )
if
(
Struct
->
m_Flags
&
SELECTED
)
break
;
/* Already in list */
if
(
STRUCT
->
m_Pos
!=
position
)
...
...
@@ -1619,7 +1617,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
Struct
->
m_Flags
|=
SELECTED
;
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
...
...
@@ -1668,7 +1666,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/*********************************************************************************/
static
LibEDA_BaseStruct
*
GetNextPinPosition
(
EDA_SchComponentStruct
*
DrawLibItem
,
static
LibEDA_BaseStruct
*
GetNextPinPosition
(
SCH_COMPONENT
*
DrawLibItem
,
wxPoint
&
position
)
/*********************************************************************************/
{
...
...
eeschema/bus-wire-junction.cpp
View file @
c406eed1
...
...
@@ -36,7 +36,7 @@ EDA_BaseStruct* SCH_SCREEN::ExtractWires( bool CreateCopy )
* If an abord command is made, old wires must be put in EEDrawList, and copies must be deleted
* This is because previously stored undo commands can handle pointers on wires or bus,
* and we do not delete wires or bus, we must put they in undo list.
*
*
* Because cleanup delete and/or modify bus and wires, the more easy is to put all wires in undo list
* and use a new copy of wires for cleanup
*/
...
...
@@ -142,8 +142,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
if
(
!
newsegment
)
/* first point : Create first wire ou bus */
{
s_ConnexionStartPoint
=
cursorpos
;
s_OldWiresList
=
((
SCH_SCREEN
*
)
GetScreen
())
->
ExtractWires
(
TRUE
);
((
SCH_SCREEN
*
)
GetScreen
())
->
SchematicCleanUp
(
NULL
);
s_OldWiresList
=
((
SCH_SCREEN
*
)
GetScreen
())
->
ExtractWires
(
TRUE
);
((
SCH_SCREEN
*
)
GetScreen
())
->
SchematicCleanUp
(
NULL
);
switch
(
type
)
{
...
...
@@ -194,7 +194,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
/* Creation du segment suivant ou fin de trac� si point sur pin, jonction ...*/
if
(
IsTerminalPoint
(
(
SCH_SCREEN
*
)
GetScreen
(),
cursorpos
,
oldsegment
->
m_Layer
)
)
if
(
IsTerminalPoint
(
(
SCH_SCREEN
*
)
GetScreen
(),
cursorpos
,
oldsegment
->
m_Layer
)
)
{
EndSegment
(
DC
);
return
;
}
...
...
@@ -301,7 +301,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
alt_end_point
=
lastsegment
->
m_Start
;
}
((
SCH_SCREEN
*
)
GetScreen
())
->
SchematicCleanUp
(
NULL
);
((
SCH_SCREEN
*
)
GetScreen
())
->
SchematicCleanUp
(
NULL
);
/* clear flags and find last segment entered, for repeat function */
segment
=
(
EDA_DrawLineStruct
*
)
GetScreen
()
->
EEDrawList
;
...
...
@@ -521,7 +521,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
Segment_in_Ghost
(
DrawPanel
,
DC
,
FALSE
);
/* Effacement du trace en cours */
}
EraseStruct
(
GetScreen
()
->
GetCurItem
(),
(
SCH_SCREEN
*
)
GetScreen
()
);
EraseStruct
(
GetScreen
()
->
GetCurItem
(),
(
SCH_SCREEN
*
)
GetScreen
()
);
DrawPanel
->
ManageCurseur
=
NULL
;
GetScreen
()
->
SetCurItem
(
NULL
);
}
...
...
@@ -642,9 +642,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
new_pos
=
STRUCT
->
m_Pos
;
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
#undef STRUCT
#define STRUCT ( (
DrawTextStruct
*) g_ItemToRepeat )
#define STRUCT ( (
SCH_TEXT
*) g_ItemToRepeat )
g_ItemToRepeat
=
STRUCT
->
GenCopy
();
STRUCT
->
m_Pos
+=
g_RepeatStep
;
new_pos
=
STRUCT
->
m_Pos
;
...
...
@@ -653,9 +653,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
#undef STRUCT
#define STRUCT ( (
DrawLabelStruct
*) g_ItemToRepeat )
#define STRUCT ( (
SCH_LABEL
*) g_ItemToRepeat )
g_ItemToRepeat
=
STRUCT
->
GenCopy
();
STRUCT
->
m_Pos
+=
g_RepeatStep
;
new_pos
=
STRUCT
->
m_Pos
;
...
...
@@ -664,19 +664,19 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
break
;
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ( (
DrawHierLabelStruct
*) g_ItemToRepeat )
case
TYPE_SCH_HIERLABEL
:
#undef STRUCT
#define STRUCT ( (
SCH_HIERLABEL
*) g_ItemToRepeat )
g_ItemToRepeat
=
STRUCT
->
GenCopy
();
STRUCT
->
m_Pos
+=
g_RepeatStep
;
new_pos
=
STRUCT
->
m_Pos
;
/*** Increment du numero de label ***/
IncrementLabelMember
(
STRUCT
->
m_Text
);
break
;
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_GLOBALLABEL
:
#undef STRUCT
#define STRUCT ( (
DrawGlobalLabelStruct
*) g_ItemToRepeat )
#define STRUCT ( (
SCH_GLOBALLABEL
*) g_ItemToRepeat )
g_ItemToRepeat
=
STRUCT
->
GenCopy
();
STRUCT
->
m_Pos
+=
g_RepeatStep
;
new_pos
=
STRUCT
->
m_Pos
;
...
...
@@ -701,17 +701,17 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
new_pos
=
STRUCT
->
m_Pos
;
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
// In repeat command the new component is put in move mode
case
TYPE_SCH_COMPONENT
:
// In repeat command the new component is put in move mode
#undef STRUCT
#define STRUCT ( (
EDA_SchComponentStruct
*) g_ItemToRepeat )
#define STRUCT ( (
SCH_COMPONENT
*) g_ItemToRepeat )
// Create the duplicate component, position = mouse cursor
g_ItemToRepeat
=
STRUCT
->
GenCopy
();
new_pos
.
x
=
GetScreen
()
->
m_Curseur
.
x
-
STRUCT
->
m_Pos
.
x
;
new_pos
.
y
=
GetScreen
()
->
m_Curseur
.
y
-
STRUCT
->
m_Pos
.
y
;
STRUCT
->
m_Pos
=
GetScreen
()
->
m_Curseur
;
new_pos
.
y
=
GetScreen
()
->
m_Curseur
.
y
-
STRUCT
->
m_Pos
.
y
;
STRUCT
->
m_Pos
=
GetScreen
()
->
m_Curseur
;
STRUCT
->
m_Flags
=
IS_NEW
;
STRUCT
->
m_TimeStamp
=
GetTimeStamp
();
STRUCT
->
m_TimeStamp
=
GetTimeStamp
();
for
(
int
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
STRUCT
->
m_Field
[
ii
].
m_Pos
+=
new_pos
;
...
...
@@ -783,14 +783,14 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
* - une jonction
* - ou une pin
* - ou une extr�mit� unique de fil
*
*
* - type BUS, si il y a
* - ou une extr�mit� unique de BUS
*/
{
EDA_BaseStruct
*
item
;
LibDrawPin
*
pin
;
EDA_SchComponentStruct
*
LibItem
=
NULL
;
SCH_COMPONENT
*
LibItem
=
NULL
;
DrawSheetLabelStruct
*
pinsheet
;
wxPoint
itempos
;
...
...
@@ -837,9 +837,9 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
return
TRUE
;
item
=
PickStruct
(
pos
,
screen
,
LABELITEM
);
if
(
item
&&
(
item
->
Type
()
!=
DRAW_TEXT_STRUCT_TYPE
)
&&
(
(
(
DrawGlobalLabelStruct
*
)
item
)
->
m_Pos
.
x
==
pos
.
x
)
&&
(
(
(
DrawGlobalLabelStruct
*
)
item
)
->
m_Pos
.
y
==
pos
.
y
)
)
if
(
item
&&
(
item
->
Type
()
!=
TYPE_SCH_TEXT
)
&&
(
(
(
SCH_GLOBALLABEL
*
)
item
)
->
m_Pos
.
x
==
pos
.
x
)
&&
(
(
(
SCH_GLOBALLABEL
*
)
item
)
->
m_Pos
.
y
==
pos
.
y
)
)
return
TRUE
;
pinsheet
=
LocateAnyPinSheet
(
pos
,
screen
);
...
...
eeschema/class_drawsheet.cpp
View file @
c406eed1
...
...
@@ -184,12 +184,12 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC )
/* Search Hlabel corresponding to this Pinsheet */
EDA_BaseStruct
*
DrawStruct
=
m_AssociatedScreen
->
EEDrawList
;
DrawHierLabelStruct
*
HLabel
=
NULL
;
SCH_HIERLABEL
*
HLabel
=
NULL
;
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Pnext
)
{
if
(
DrawStruct
->
Type
()
!=
DRAW_HIER_LABEL_STRUCT_TYPE
)
if
(
DrawStruct
->
Type
()
!=
TYPE_SCH_HIERLABEL
)
continue
;
HLabel
=
(
DrawHierLabelStruct
*
)
DrawStruct
;
HLabel
=
(
SCH_HIERLABEL
*
)
DrawStruct
;
if
(
Pinsheet
->
m_Text
.
CmpNoCase
(
HLabel
->
m_Text
)
==
0
)
break
;
// Found!
HLabel
=
NULL
;
...
...
@@ -282,9 +282,9 @@ void DrawSheetStruct::DeleteAnnotation( bool recurse )
EDA_BaseStruct
*
comp
=
m_AssociatedScreen
->
EEDrawList
;
for
(
;
comp
;
comp
=
comp
->
Pnext
)
{
if
(
comp
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
comp
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
(
(
EDA_SchComponentStruct
*
)
comp
)
->
ClearAnnotation
();
(
(
SCH_COMPONENT
*
)
comp
)
->
ClearAnnotation
();
}
}
}
...
...
@@ -305,9 +305,9 @@ int DrawSheetStruct::ComponentCount()
EDA_BaseStruct
*
bs
;
for
(
bs
=
m_AssociatedScreen
->
EEDrawList
;
bs
!=
NULL
;
bs
=
bs
->
Pnext
)
{
if
(
bs
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
bs
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
DrawPartStruct
*
Cmp
=
(
DrawPartStruct
*
)
bs
;
SCH_COMPONENT
*
Cmp
=
(
SCH_COMPONENT
*
)
bs
;
if
(
Cmp
->
m_Field
[
VALUE
].
m_Text
.
GetChar
(
0
)
!=
'#'
)
n
++
;
}
...
...
@@ -475,84 +475,84 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame * aFrame, const wxSt
if
(
(
GetFileName
()
==
aFileName
)
&&
m_AssociatedScreen
)
return
true
;
SCH_SCREEN
*
Screen_to_use
=
NULL
;
wxString
msg
;
bool
LoadFromFile
=
false
;
SCH_SCREEN
*
Screen_to_use
=
NULL
;
wxString
msg
;
bool
LoadFromFile
=
false
;
if
(
g_RootSheet
->
SearchHierarchy
(
aFileName
,
&
Screen_to_use
)
)
//do we reload the data from the existing hierarchy
{
msg
.
Printf
(
_
(
"A Sub Hierarchy named %s exists, Use it (The data in this sheet will be replaced)?"
),
aFileName
.
GetData
()
);
if
(
!
IsOK
(
NULL
,
msg
)
)
{
DisplayInfo
(
NULL
,
_
(
"Sheet Filename Renaming Aborted"
));
return
false
;
}
}
if
(
!
IsOK
(
NULL
,
msg
)
)
{
DisplayInfo
(
NULL
,
_
(
"Sheet Filename Renaming Aborted"
));
return
false
;
}
}
else
if
(
wxFileExists
(
aFileName
)
)
//do we reload the data from an existing file
{
msg
.
Printf
(
_
(
"A file named %s exists, load it (otherwise keep current sheet data if possible)?"
),
aFileName
.
GetData
()
);
if
(
IsOK
(
NULL
,
msg
)
)
{
LoadFromFile
=
true
;
m_AssociatedScreen
->
m_RefCount
--
;
//be careful with these
if
(
m_AssociatedScreen
->
m_RefCount
==
0
)
SAFE_DELETE
(
m_AssociatedScreen
);
m_AssociatedScreen
=
NULL
;
//will be created later
}
}
// if an associated screen exists, shared between this sheet and others sheets, what we do ?
if
(
m_AssociatedScreen
&&
(
m_AssociatedScreen
->
m_RefCount
>
1
))
{
msg
=
_
(
"This sheet uses shared data in a complex hierarchy"
)
;
msg
<<
wxT
(
"
\n
"
);
msg
<<
_
(
"Do we convert it in a simple hierarchical sheet (otherwise delete current sheet data)"
);
if
(
IsOK
(
NULL
,
msg
)
)
{
LoadFromFile
=
true
;
wxString
oldfilename
=
m_AssociatedScreen
->
m_FileName
;
m_AssociatedScreen
->
m_FileName
=
aFileName
;
aFrame
->
SaveEEFile
(
m_AssociatedScreen
,
FILE_SAVE_AS
);
m_AssociatedScreen
->
m_FileName
=
oldfilename
;
}
m_AssociatedScreen
->
m_RefCount
--
;
//be careful with these
m_AssociatedScreen
=
NULL
;
//will be created later
}
SetFileName
(
aFileName
);
// if we use new data (from file or from internal hierarchy), delete the current sheet data
if
(
m_AssociatedScreen
&&
(
LoadFromFile
||
Screen_to_use
)
)
{
m_AssociatedScreen
->
m_RefCount
--
;
if
(
m_AssociatedScreen
->
m_RefCount
==
0
)
SAFE_DELETE
(
m_AssociatedScreen
);
m_AssociatedScreen
=
NULL
;
//so that we reload..
}
if
(
LoadFromFile
)
Load
(
aFrame
);
else
if
(
Screen_to_use
)
{
m_AssociatedScreen
=
Screen_to_use
;
m_AssociatedScreen
->
m_RefCount
++
;
}
//just make a new screen if needed.
if
(
!
m_AssociatedScreen
)
{
m_AssociatedScreen
=
new
SCH_SCREEN
(
SCHEMATIC_FRAME
);
m_AssociatedScreen
->
m_RefCount
++
;
//be careful with these
}
m_AssociatedScreen
->
m_FileName
=
aFileName
;
if
(
IsOK
(
NULL
,
msg
)
)
{
LoadFromFile
=
true
;
m_AssociatedScreen
->
m_RefCount
--
;
//be careful with these
if
(
m_AssociatedScreen
->
m_RefCount
==
0
)
SAFE_DELETE
(
m_AssociatedScreen
);
m_AssociatedScreen
=
NULL
;
//will be created later
}
}
// if an associated screen exists, shared between this sheet and others sheets, what we do ?
if
(
m_AssociatedScreen
&&
(
m_AssociatedScreen
->
m_RefCount
>
1
))
{
msg
=
_
(
"This sheet uses shared data in a complex hierarchy"
)
;
msg
<<
wxT
(
"
\n
"
);
msg
<<
_
(
"Do we convert it in a simple hierarchical sheet (otherwise delete current sheet data)"
);
if
(
IsOK
(
NULL
,
msg
)
)
{
LoadFromFile
=
true
;
wxString
oldfilename
=
m_AssociatedScreen
->
m_FileName
;
m_AssociatedScreen
->
m_FileName
=
aFileName
;
aFrame
->
SaveEEFile
(
m_AssociatedScreen
,
FILE_SAVE_AS
);
m_AssociatedScreen
->
m_FileName
=
oldfilename
;
}
m_AssociatedScreen
->
m_RefCount
--
;
//be careful with these
m_AssociatedScreen
=
NULL
;
//will be created later
}
SetFileName
(
aFileName
);
// if we use new data (from file or from internal hierarchy), delete the current sheet data
if
(
m_AssociatedScreen
&&
(
LoadFromFile
||
Screen_to_use
)
)
{
m_AssociatedScreen
->
m_RefCount
--
;
if
(
m_AssociatedScreen
->
m_RefCount
==
0
)
SAFE_DELETE
(
m_AssociatedScreen
);
m_AssociatedScreen
=
NULL
;
//so that we reload..
}
if
(
LoadFromFile
)
Load
(
aFrame
);
else
if
(
Screen_to_use
)
{
m_AssociatedScreen
=
Screen_to_use
;
m_AssociatedScreen
->
m_RefCount
++
;
}
//just make a new screen if needed.
if
(
!
m_AssociatedScreen
)
{
m_AssociatedScreen
=
new
SCH_SCREEN
(
SCHEMATIC_FRAME
);
m_AssociatedScreen
->
m_RefCount
++
;
//be careful with these
}
m_AssociatedScreen
->
m_FileName
=
aFileName
;
return
true
;
}
...
...
@@ -803,9 +803,9 @@ void DrawSheetPath::UpdateAllScreenReferences()
while
(
t
)
{
if
(
t
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
t
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
EDA_SchComponentStruct
*
d
=
(
EDA_SchComponentStruct
*
)
t
;
SCH_COMPONENT
*
d
=
(
SCH_COMPONENT
*
)
t
;
d
->
m_Field
[
REFERENCE
].
m_Text
=
d
->
GetRef
(
this
);
}
t
=
t
->
Pnext
;
...
...
eeschema/class_screen.cpp
View file @
c406eed1
...
...
@@ -19,11 +19,11 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
{
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_COMPONENT
:
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_SHEET_STRUCT_TYPE
:
...
...
eeschema/class_text-label.cpp
View file @
c406eed1
...
...
@@ -18,15 +18,15 @@
/************************/
/* class
DrawTextStruct
*/
/* class
DrawLabelStruct
*/
/* class
DrawGlobalLabelStruct
*/
/* class
DrawHierLabelStruct
*/
/* class
SCH_TEXT
*/
/* class
SCH_LABEL
*/
/* class
SCH_GLOBALLABEL
*/
/* class
SCH_HIERLABEL
*/
/************************/
/**************************************************************************/
DrawTextStruct
::
DrawTextStruct
(
const
wxPoint
&
pos
,
const
wxString
&
text
,
KICAD_T
aType
)
:
EDA_BaseStruct
(
aType
)
SCH_TEXT
::
SCH_TEXT
(
const
wxPoint
&
pos
,
const
wxString
&
text
,
KICAD_T
aType
)
:
SCH_ITEM
(
NULL
,
aType
)
,
EDA_TextStruct
(
text
)
/**************************************************************************/
{
...
...
@@ -38,28 +38,28 @@ DrawTextStruct::DrawTextStruct( const wxPoint& pos, const wxString& text, KICAD_
/*********************************************/
DrawTextStruct
*
DrawTextStruct
::
GenCopy
()
SCH_TEXT
*
SCH_TEXT
::
GenCopy
()
/*********************************************/
{
DrawTextStruct
*
newitem
;
SCH_TEXT
*
newitem
;
switch
(
Type
()
)
{
default
:
case
DRAW_TEXT_STRUCT_TYPE
:
newitem
=
new
DrawTextStruct
(
m_Pos
,
m_Text
);
case
TYPE_SCH_TEXT
:
newitem
=
new
SCH_TEXT
(
m_Pos
,
m_Text
);
break
;
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
newitem
=
new
DrawGlobalLabelStruct
(
m_Pos
,
m_Text
);
case
TYPE_SCH_GLOBALLABEL
:
newitem
=
new
SCH_GLOBALLABEL
(
m_Pos
,
m_Text
);
break
;
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
newitem
=
new
DrawHierLabelStruct
(
m_Pos
,
m_Text
);
case
TYPE_SCH_HIERLABEL
:
newitem
=
new
SCH_HIERLABEL
(
m_Pos
,
m_Text
);
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
newitem
=
new
DrawLabelStruct
(
m_Pos
,
m_Text
);
case
TYPE_SCH_LABEL
:
newitem
=
new
SCH_LABEL
(
m_Pos
,
m_Text
);
break
;
}
...
...
@@ -77,7 +77,7 @@ DrawTextStruct* DrawTextStruct::GenCopy()
/********************************************************/
void
DrawTextStruct
::
SwapData
(
DrawTextStruct
*
copyitem
)
void
SCH_TEXT
::
SwapData
(
SCH_TEXT
*
copyitem
)
/********************************************************/
{
EXCHG
(
m_Text
,
copyitem
->
m_Text
);
...
...
@@ -95,20 +95,20 @@ void DrawTextStruct::SwapData( DrawTextStruct* copyitem )
/***************************************************************/
void
DrawTextStruct
::
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
)
void
SCH_TEXT
::
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
)
/***************************************************************/
{
/* save old text in undo list */
if
(
g_ItemToUndoCopy
&&
(
(
m_Flags
&
IS_NEW
)
==
0
)
)
{
/* restore old values and save new ones */
SwapData
(
(
DrawTextStruct
*
)
g_ItemToUndoCopy
);
SwapData
(
(
SCH_TEXT
*
)
g_ItemToUndoCopy
);
/* save in undo list */
(
(
WinEDA_SchematicFrame
*
)
frame
)
->
SaveCopyInUndoList
(
this
,
IS_CHANGED
);
/* restore new values */
SwapData
(
(
DrawTextStruct
*
)
g_ItemToUndoCopy
);
SwapData
(
(
SCH_TEXT
*
)
g_ItemToUndoCopy
);
SAFE_DELETE
(
g_ItemToUndoCopy
);
}
...
...
@@ -118,8 +118,8 @@ void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/****************************************************************************/
DrawLabelStruct
::
DrawLabelStruct
(
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
DrawTextStruct
(
pos
,
text
,
DRAW_LABEL_STRUCT_TYPE
)
SCH_LABEL
::
SCH_LABEL
(
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
SCH_TEXT
(
pos
,
text
,
TYPE_SCH_LABEL
)
/****************************************************************************/
{
m_Layer
=
LAYER_LOCLABEL
;
...
...
@@ -129,8 +129,8 @@ DrawLabelStruct::DrawLabelStruct( const wxPoint& pos, const wxString& text ) :
/***********************************************************************************/
DrawGlobalLabelStruct
::
DrawGlobalLabelStruct
(
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
DrawTextStruct
(
pos
,
text
,
DRAW_GLOBAL_LABEL_STRUCT_TYPE
)
SCH_GLOBALLABEL
::
SCH_GLOBALLABEL
(
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
SCH_TEXT
(
pos
,
text
,
TYPE_SCH_GLOBALLABEL
)
/***********************************************************************************/
{
m_Layer
=
LAYER_GLOBLABEL
;
...
...
@@ -140,8 +140,8 @@ DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString
/***********************************************************************************/
DrawHierLabelStruct
::
DrawHierLabelStruct
(
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
DrawTextStruct
(
pos
,
text
,
DRAW_HIER_LABEL_STRUCT_TYPE
)
SCH_HIERLABEL
::
SCH_HIERLABEL
(
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
SCH_TEXT
(
pos
,
text
,
TYPE_SCH_HIERLABEL
)
/***********************************************************************************/
{
m_Layer
=
LAYER_HIERLABEL
;
...
...
@@ -151,7 +151,7 @@ DrawHierLabelStruct::DrawHierLabelStruct( const wxPoint& pos, const wxString& te
/*******************************************************************************************/
void
DrawTextStruct
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
void
SCH_TEXT
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
DrawMode
,
int
Color
)
/*******************************************************************************************/
...
...
@@ -211,16 +211,16 @@ void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off
/*********************************************************************************************/
void
DrawLabelStruct
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
void
SCH_LABEL
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
DrawMode
,
int
Color
)
/*********************************************************************************************/
{
DrawTextStruct
::
Draw
(
panel
,
DC
,
offset
,
DrawMode
,
Color
);
SCH_TEXT
::
Draw
(
panel
,
DC
,
offset
,
DrawMode
,
Color
);
}
/*******************************************************************************************/
void
DrawHierLabelStruct
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
void
SCH_HIERLABEL
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
DrawMode
,
int
Color
)
/******************************************************************************************/
...
...
@@ -288,7 +288,7 @@ void DrawHierLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint
* format list is
* corner_count, x0, y0, ... xn, yn
*/
void
DrawHierLabelStruct
::
CreateGraphicShape
(
int
*
corner_list
,
const
wxPoint
&
Pos
)
void
SCH_HIERLABEL
::
CreateGraphicShape
(
int
*
corner_list
,
const
wxPoint
&
Pos
)
{
int
*
Template
=
TemplateShape
[
m_Shape
][
m_Orient
];
int
HalfSize
=
m_Size
.
x
/
2
;
...
...
@@ -307,7 +307,7 @@ void DrawHierLabelStruct::CreateGraphicShape( int* corner_list, const wxPoint& P
/*******************************************************************************************/
void
DrawGlobalLabelStruct
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
draw_offset
,
void
SCH_GLOBALLABEL
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
draw_offset
,
int
DrawMode
,
int
Color
)
/******************************************************************************************/
...
...
@@ -338,9 +338,9 @@ void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoi
offset
+=
HalfSize
;
break
;
case
NET_OUTPUT
:
offset
+=
TXTMARGE
;
break
;
case
NET_OUTPUT
:
offset
+=
TXTMARGE
;
break
;
default
:
break
;
...
...
@@ -392,7 +392,7 @@ void DrawGlobalLabelStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoi
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/
void
DrawGlobalLabelStruct
::
CreateGraphicShape
(
int
*
corner_list
,
const
wxPoint
&
Pos
)
void
SCH_GLOBALLABEL
::
CreateGraphicShape
(
int
*
corner_list
,
const
wxPoint
&
Pos
)
{
int
HalfSize
=
m_Size
.
x
/
2
;
int
width
=
MAX
(
m_Width
,
g_DrawMinimunLineWidth
);
...
...
eeschema/class_text-label.h
View file @
c406eed1
...
...
@@ -76,7 +76,7 @@ int* TemplateShape[5][4] =
extern
int
*
TemplateShape
[
5
][
4
];
#endif
class
DrawTextStruct
:
public
EDA_BaseStruct
class
SCH_TEXT
:
public
SCH_ITEM
,
public
EDA_TextStruct
{
public
:
...
...
@@ -85,31 +85,31 @@ public:
bool
m_IsDangling
;
// TRUE si non connect�
public
:
DrawTextStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
,
KICAD_T
aType
=
DRAW_TEXT_STRUCT_TYPE
);
~
DrawTextStruct
()
{
}
SCH_TEXT
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
,
KICAD_T
aType
=
TYPE_SCH_TEXT
);
~
SCH_TEXT
()
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"
DrawText
"
);
return
wxT
(
"
SCH_TEXT
"
);
}
DrawTextStruct
*
GenCopy
();
SCH_TEXT
*
GenCopy
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
void
SwapData
(
DrawTextStruct
*
copyitem
);
void
SwapData
(
SCH_TEXT
*
copyitem
);
virtual
void
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
);
};
class
DrawLabelStruct
:
public
DrawTextStruct
class
SCH_LABEL
:
public
SCH_TEXT
{
public
:
DrawLabelStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
~
DrawLabelStruct
()
{
}
SCH_LABEL
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
~
SCH_LABEL
()
{
}
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
...
...
@@ -120,12 +120,12 @@ public:
};
class
DrawGlobalLabelStruct
:
public
DrawTextStruct
class
SCH_GLOBALLABEL
:
public
SCH_TEXT
{
public
:
DrawGlobalLabelStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
SCH_GLOBALLABEL
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
~
DrawGlobalLabelStruct
()
{
}
~
SCH_GLOBALLABEL
()
{
}
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
...
...
@@ -138,21 +138,21 @@ public:
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size > 20)
* @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
* @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/
void
CreateGraphicShape
(
int
*
corner_list
,
const
wxPoint
&
Pos
);
};
class
DrawHierLabelStruct
:
public
DrawTextStruct
class
SCH_HIERLABEL
:
public
SCH_TEXT
{
public
:
DrawHierLabelStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
SCH_HIERLABEL
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
~
DrawHierLabelStruct
()
{
}
~
SCH_HIERLABEL
()
{
}
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
...
...
@@ -165,9 +165,9 @@ public:
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param corner_list = coordinates list fill with polygon corners ooordinates (size >= 14)
* @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
* @param Pos = Postion of the shape
* format list is
* <corner_count>, x0, y0, ... xn, yn
*/
void
CreateGraphicShape
(
int
*
corner_list
,
const
wxPoint
&
Pos
);
};
...
...
eeschema/cleanup.cpp
View file @
c406eed1
...
...
@@ -105,14 +105,14 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_NOCONNECT_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_COMPONENT
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
case
DRAW_SHEET_STRUCT_TYPE
:
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
break
;
...
...
eeschema/cmpclass.cpp
View file @
c406eed1
...
...
@@ -269,7 +269,7 @@ EDA_Rect DrawJunctionStruct::GetBoundingBox()
};
EDA_Rect
EDA_SchComponentStruct
::
GetBoundingBox
()
EDA_Rect
SCH_COMPONENT
::
GetBoundingBox
()
{
const
int
PADDING
=
40
;
...
...
eeschema/component_class.cpp
View file @
c406eed1
...
...
@@ -22,28 +22,9 @@
WX_DEFINE_OBJARRAY
(
ArrayOfSheetLists
);
/***************************/
/* class DrawPartStruct */
/* class EDA_SchComponentStruct */
/* class SCH_COMPONENT */
/***************************/
/***********************************************************************************/
DrawPartStruct
::
DrawPartStruct
(
KICAD_T
struct_type
,
const
wxPoint
&
pos
)
:
EDA_BaseStruct
(
struct_type
)
/***********************************************************************************/
{
m_Layer
=
0
;
m_Pos
=
pos
;
m_TimeStamp
=
0
;
}
/************************************/
DrawPartStruct
::~
DrawPartStruct
()
/************************************/
{
}
/****************************************************************/
const
wxString
&
ReturnDefaultFieldName
(
int
aFieldNdx
)
/****************************************************************/
...
...
@@ -78,7 +59,7 @@ const wxString& ReturnDefaultFieldName( int aFieldNdx )
/****************************************************************/
const
wxString
&
EDA_SchComponentStruct
::
ReturnFieldName
(
int
aFieldNdx
)
const
const
wxString
&
SCH_COMPONENT
::
ReturnFieldName
(
int
aFieldNdx
)
const
/****************************************************************/
/* Return the Field name from its index (REFERENCE, VALUE ..)
...
...
@@ -94,7 +75,7 @@ const wxString& EDA_SchComponentStruct::ReturnFieldName( int aFieldNdx ) const
/****************************************************************/
wxString
EDA_SchComponentStruct
::
GetPath
(
DrawSheetPath
*
sheet
)
wxString
SCH_COMPONENT
::
GetPath
(
DrawSheetPath
*
sheet
)
/****************************************************************/
{
wxString
str
;
...
...
@@ -105,7 +86,7 @@ wxString EDA_SchComponentStruct::GetPath( DrawSheetPath* sheet )
/********************************************************************/
const
wxString
EDA_SchComponentStruct
::
GetRef
(
DrawSheetPath
*
sheet
)
const
wxString
SCH_COMPONENT
::
GetRef
(
DrawSheetPath
*
sheet
)
/********************************************************************/
{
wxString
path
=
GetPath
(
sheet
);
...
...
@@ -137,7 +118,7 @@ const wxString EDA_SchComponentStruct::GetRef( DrawSheetPath* sheet )
/***********************************************************************/
void
EDA_SchComponentStruct
::
SetRef
(
DrawSheetPath
*
sheet
,
wxString
ref
)
void
SCH_COMPONENT
::
SetRef
(
DrawSheetPath
*
sheet
,
wxString
ref
)
/***********************************************************************/
{
//check to see if it is already there before inserting it
...
...
@@ -176,7 +157,7 @@ void EDA_SchComponentStruct::SetRef( DrawSheetPath* sheet, wxString ref )
/**************************************/
void
EDA_SchComponentStruct
::
ClearRefs
()
void
SCH_COMPONENT
::
ClearRefs
()
/**************************************/
{
m_Paths
.
Empty
();
...
...
@@ -184,7 +165,7 @@ void EDA_SchComponentStruct::ClearRefs()
}
const
wxString
&
EDA_SchComponentStruct
::
GetFieldValue
(
int
aFieldNdx
)
const
const
wxString
&
SCH_COMPONENT
::
GetFieldValue
(
int
aFieldNdx
)
const
{
// avoid unnecessarily copying wxStrings.
static
const
wxString
myEmpty
=
wxEmptyString
;
...
...
@@ -197,14 +178,16 @@ const wxString& EDA_SchComponentStruct::GetFieldValue( int aFieldNdx ) const
/*******************************************************************/
EDA_SchComponentStruct
::
EDA_SchComponentStruct
(
const
wxPoint
&
p
os
)
:
DrawPartStruct
(
DRAW_LIB_ITEM_STRUCT_TYPE
,
pos
)
SCH_COMPONENT
::
SCH_COMPONENT
(
const
wxPoint
&
aP
os
)
:
SCH_ITEM
(
NULL
,
TYPE_SCH_COMPONENT
)
/*******************************************************************/
{
int
ii
;
m_Multi
=
0
;
/* In multi unit chip - which unit to draw. */
m_Pos
=
aPos
;
//m_FlagControlMulti = 0;
m_UsedOnSheets
.
Clear
();
m_Convert
=
0
;
/* Gestion des mutiples representations (conversion De Morgan) */
...
...
@@ -234,7 +217,7 @@ EDA_SchComponentStruct::EDA_SchComponentStruct( const wxPoint& pos ) :
/************************************************/
EDA_Rect
EDA_SchComponentStruct
::
GetBoundaryBox
()
const
EDA_Rect
SCH_COMPONENT
::
GetBoundaryBox
()
const
/************************************************/
{
EDA_LibComponentStruct
*
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
...
...
@@ -309,14 +292,14 @@ void PartTextStruct::SwapData( PartTextStruct* copyitem )
/**************************************************************************/
void
EDA_SchComponentStruct
::
SwapData
(
EDA_SchComponentStruct
*
copyitem
)
void
SCH_COMPONENT
::
SwapData
(
SCH_COMPONENT
*
copyitem
)
/**************************************************************************/
/* Used if undo / redo command:
* swap data between this and copyitem
*/
{
EXCHG
(
m_ChipName
,
copyitem
->
m_ChipName
);
EXCHG
(
m_ChipName
,
copyitem
->
m_ChipName
);
EXCHG
(
m_Pos
,
copyitem
->
m_Pos
);
EXCHG
(
m_Multi
,
copyitem
->
m_Multi
);
EXCHG
(
m_Convert
,
copyitem
->
m_Convert
);
...
...
@@ -332,7 +315,7 @@ void EDA_SchComponentStruct::SwapData( EDA_SchComponentStruct* copyitem )
/***********************************************************************/
void
EDA_SchComponentStruct
::
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
)
void
SCH_COMPONENT
::
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
)
/***********************************************************************/
{
/* save old text in undo list */
...
...
@@ -341,13 +324,13 @@ void EDA_SchComponentStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
&&
(
(
m_Flags
&
IS_NEW
)
==
0
)
)
{
/* restore old values and save new ones */
SwapData
(
(
EDA_SchComponentStruct
*
)
g_ItemToUndoCopy
);
SwapData
(
(
SCH_COMPONENT
*
)
g_ItemToUndoCopy
);
/* save in undo list */
(
(
WinEDA_SchematicFrame
*
)
frame
)
->
SaveCopyInUndoList
(
this
,
IS_CHANGED
);
/* restore new values */
SwapData
(
(
EDA_SchComponentStruct
*
)
g_ItemToUndoCopy
);
SwapData
(
(
SCH_COMPONENT
*
)
g_ItemToUndoCopy
);
SAFE_DELETE
(
g_ItemToUndoCopy
);
}
...
...
@@ -357,7 +340,7 @@ void EDA_SchComponentStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/***************************************************/
void
EDA_SchComponentStruct
::
ClearAnnotation
()
void
SCH_COMPONENT
::
ClearAnnotation
()
/***************************************************/
/* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
...
...
@@ -386,16 +369,16 @@ void EDA_SchComponentStruct::ClearAnnotation()
/**************************************************************/
EDA_SchComponentStruct
*
EDA_SchComponentStruct
::
GenCopy
()
SCH_COMPONENT
*
SCH_COMPONENT
::
GenCopy
()
/**************************************************************/
{
EDA_SchComponentStruct
*
new_item
=
new
EDA_SchComponentStruct
(
m_Pos
);
SCH_COMPONENT
*
new_item
=
new
SCH_COMPONENT
(
m_Pos
);
int
ii
;
new_item
->
m_Multi
=
m_Multi
;
new_item
->
m_ChipName
=
m_ChipName
;
new_item
->
m_PrefixString
=
m_PrefixString
;
new_item
->
m_PrefixString
=
m_PrefixString
;
//new_item->m_FlagControlMulti = m_FlagControlMulti;
new_item
->
m_UsedOnSheets
=
m_UsedOnSheets
;
...
...
@@ -418,7 +401,7 @@ EDA_SchComponentStruct* EDA_SchComponentStruct::GenCopy()
/*****************************************************************/
void
EDA_SchComponentStruct
::
SetRotationMiroir
(
int
type_rotate
)
void
SCH_COMPONENT
::
SetRotationMiroir
(
int
type_rotate
)
/******************************************************************/
/* Compute the new matrix transform for a schematic component
...
...
@@ -561,7 +544,7 @@ void EDA_SchComponentStruct::SetRotationMiroir( int type_rotate )
/****************************************************/
int
EDA_SchComponentStruct
::
GetRotationMiroir
()
int
SCH_COMPONENT
::
GetRotationMiroir
()
/****************************************************/
{
int
type_rotate
=
CMP_ORIENT_0
;
...
...
@@ -626,7 +609,7 @@ int EDA_SchComponentStruct::GetRotationMiroir()
/***********************************************************************/
wxPoint
EDA_SchComponentStruct
::
GetScreenCoord
(
const
wxPoint
&
coord
)
wxPoint
SCH_COMPONENT
::
GetScreenCoord
(
const
wxPoint
&
coord
)
/***********************************************************************/
/* Renvoie la coordonn�e du point coord, en fonction de l'orientation
...
...
@@ -651,7 +634,7 @@ wxPoint EDA_SchComponentStruct::GetScreenCoord( const wxPoint& coord )
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
EDA_SchComponentStruct
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
void
SCH_COMPONENT
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
// for now, make it look like XML:
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
...
...
@@ -748,7 +731,7 @@ EDA_Rect PartTextStruct::GetBoundaryBox() const
int
orient
;
int
dx
,
dy
,
x1
,
y1
,
x2
,
y2
;
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
m_Parent
;
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
m_Parent
;
orient
=
m_Orient
;
wxPoint
pos
=
DrawLibItem
->
m_Pos
;
...
...
eeschema/component_class.h
View file @
c406eed1
...
...
@@ -65,35 +65,21 @@ public:
};
/* the class DrawPartStruct describes a basic virtual component
* Not used directly:
* used classes are EDA_SchComponentStruct (the "classic" schematic component, below)
* and the Pseudo component DrawSheetStruct
WX_DECLARE_OBJARRAY
(
DrawSheetPath
,
ArrayOfSheetLists
);
/**
* Class SCH_COMPONENT
* describes a real schematic component
*/
class
DrawPartStruct
:
public
EDA_BaseStruct
class
SCH_COMPONENT
:
public
SCH_ITEM
{
public
:
int
m_Layer
;
wxString
m_ChipName
;
/* Key to look for in the library, i.e. "74LS00". */
PartTextStruct
m_Field
[
NUMBER_OF_FIELDS
];
wxPoint
m_Pos
;
/* Exact position of part. */
int
m_Multi
;
/* In multi unit chip - which unit to draw. */
public
:
DrawPartStruct
(
KICAD_T
struct_type
,
const
wxPoint
&
pos
);
~
DrawPartStruct
();
wxPoint
m_Pos
;
virtual
wxString
GetClass
()
const
{
return
wxT
(
"DrawPart"
);
}
};
WX_DECLARE_OBJARRAY
(
DrawSheetPath
,
ArrayOfSheetLists
);
/* the class EDA_SchComponentStruct describes a real component */
class
EDA_SchComponentStruct
:
public
DrawPartStruct
{
public
:
int
m_Multi
;
/* In multi unit chip - which unit to draw. */
wxString
m_ChipName
;
/* Key to look for in the library, i.e. "74LS00". */
PartTextStruct
m_Field
[
NUMBER_OF_FIELDS
];
//int m_FlagControlMulti;
ArrayOfSheetLists
m_UsedOnSheets
;
...
...
@@ -108,16 +94,16 @@ public:
* determined, upon file load, by the first non-digits in the reference fields. */
public
:
EDA_SchComponentStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
)
);
~
EDA_SchComponentStruct
(
void
)
{
}
SCH_COMPONENT
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
)
);
~
SCH_COMPONENT
(
)
{
}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"
EDA_SchComponent
"
);
return
wxT
(
"
SCH_COMPONENT
"
);
}
EDA_SchComponentStruct
*
GenCopy
();
SCH_COMPONENT
*
GenCopy
();
void
SetRotationMiroir
(
int
type
);
int
GetRotationMiroir
();
wxPoint
GetScreenCoord
(
const
wxPoint
&
coord
);
...
...
@@ -143,7 +129,7 @@ public:
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
void
SwapData
(
EDA_SchComponentStruct
*
copyitem
);
void
SwapData
(
SCH_COMPONENT
*
copyitem
);
virtual
void
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
);
...
...
eeschema/controle.cpp
View file @
c406eed1
...
...
@@ -42,7 +42,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
wxString
msg
;
wxPoint
mouse_position
=
GetScreen
()
->
m_MousePosition
;
LibDrawPin
*
Pin
=
NULL
;
EDA_SchComponentStruct
*
LibItem
=
NULL
;
SCH_COMPONENT
*
LibItem
=
NULL
;
DrawStruct
=
SchematicGeneralLocateAndDisplay
(
mouse_position
,
IncludePin
);
if
(
!
DrawStruct
&&
(
mouse_position
!=
GetScreen
()
->
m_Curseur
)
)
...
...
@@ -57,15 +57,15 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
{
case
DRAW_PART_TEXT_STRUCT_TYPE
:
case
COMPONENT_FIELD_DRAW_TYPE
:
LibItem
=
(
EDA_SchComponentStruct
*
)
DrawStruct
->
m_Parent
;
LibItem
=
(
SCH_COMPONENT
*
)
DrawStruct
->
m_Parent
;
SendMessageToPCBNEW
(
DrawStruct
,
LibItem
);
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
Pin
=
LocateAnyPin
(
GetScreen
()
->
EEDrawList
,
GetScreen
()
->
m_Curseur
,
&
LibItem
);
if
(
Pin
)
break
;
// Priority is probing a pin first
LibItem
=
(
EDA_SchComponentStruct
*
)
DrawStruct
;
LibItem
=
(
SCH_COMPONENT
*
)
DrawStruct
;
SendMessageToPCBNEW
(
DrawStruct
,
LibItem
);
break
;
...
...
@@ -118,7 +118,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
{
EDA_BaseStruct
*
DrawStruct
;
LibDrawPin
*
Pin
;
EDA_SchComponentStruct
*
LibItem
;
SCH_COMPONENT
*
LibItem
;
wxString
Text
;
wxString
msg
;
int
ii
;
...
...
@@ -175,7 +175,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
if
(
DrawStruct
)
{
PartTextStruct
*
Field
=
(
PartTextStruct
*
)
DrawStruct
;
LibItem
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
LibItem
=
(
SCH_COMPONENT
*
)
Field
->
m_Parent
;
LibItem
->
Display_Infos
(
this
);
return
DrawStruct
;
...
...
@@ -199,7 +199,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
if
(
DrawStruct
)
{
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
LibItem
=
(
EDA_SchComponentStruct
*
)
DrawStruct
;
LibItem
=
(
SCH_COMPONENT
*
)
DrawStruct
;
LibItem
->
Display_Infos
(
this
);
return
DrawStruct
;
}
...
...
eeschema/cross-probing.cpp
View file @
c406eed1
...
...
@@ -86,7 +86,7 @@ void RemoteCommand( const char* cmdline )
/*****************************************************************************/
void
WinEDA_SchematicFrame
::
SendMessageToPCBNEW
(
EDA_BaseStruct
*
objectToSync
,
EDA_SchComponentStruct
*
LibItem
)
SCH_COMPONENT
*
LibItem
)
/*****************************************************************************/
/** Send a remote command to eeschema via a socket,
...
...
@@ -116,8 +116,8 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectT
}
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
LibItem
=
(
EDA_SchComponentStruct
*
)
objectToSync
;
case
TYPE_SCH_COMPONENT
:
LibItem
=
(
SCH_COMPONENT
*
)
objectToSync
;
sprintf
(
Line
,
"$PART: %s"
,
CONV_TO_UTF8
(
LibItem
->
m_Field
[
REFERENCE
].
m_Text
)
);
SendCommand
(
MSG_TO_PCB
,
Line
);
break
;
...
...
eeschema/dangling_ends.cpp
View file @
c406eed1
...
...
@@ -47,7 +47,7 @@ DanglingEndHandle* ItemList;
static
void
TestWireForDangling
(
EDA_DrawLineStruct
*
DrawRef
,
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
);
void
TestLabelForDangling
(
DrawTextStruct
*
label
,
void
TestLabelForDangling
(
SCH_TEXT
*
label
,
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
);
DanglingEndHandle
*
RebuildEndList
(
EDA_BaseStruct
*
DrawList
);
...
...
@@ -111,11 +111,11 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
{
switch
(
DrawItem
->
Type
()
)
{
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_LABEL
:
#undef STRUCT
#define STRUCT ( (
DrawLabelStruct
*) DrawItem )
#define STRUCT ( (
SCH_LABEL
*) DrawItem )
TestLabelForDangling
(
STRUCT
,
this
,
DC
);
break
;
break
;
...
...
@@ -155,7 +155,7 @@ LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( EDA_BaseStruct* DrawList,
* NULL sinon
*/
{
EDA_SchComponentStruct
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
LibDrawPin
*
Pin
;
wxPoint
pinpos
;
...
...
@@ -223,7 +223,7 @@ void TestWireForDangling( EDA_DrawLineStruct* DrawRef,
/********************************************************/
void
TestLabelForDangling
(
DrawTextStruct
*
label
,
void
TestLabelForDangling
(
SCH_TEXT
*
label
,
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
)
/********************************************************/
{
...
...
@@ -281,7 +281,7 @@ void TestLabelForDangling( DrawTextStruct* label,
/****************************************************/
wxPoint
ReturnPinPhysicalPosition
(
LibDrawPin
*
Pin
,
EDA_SchComponentStruct
*
DrawLibItem
)
SCH_COMPONENT
*
DrawLibItem
)
/****************************************************/
/* Retourne la position physique de la pin, qui d�pend de l'orientation
...
...
@@ -316,13 +316,13 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
{
switch
(
DrawItem
->
Type
()
)
{
case
DRAW_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
break
;
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
#undef STRUCT
#define STRUCT ( (
DrawLabelStruct
*) DrawItem )
#define STRUCT ( (
SCH_LABEL
*) DrawItem )
item
=
new
DanglingEndHandle
(
LABEL_END
);
item
->
m_Item
=
DrawItem
;
...
...
@@ -395,15 +395,15 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
lastitem
=
item
;
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
{
#undef STRUCT
#define STRUCT ( (
EDA_SchComponentStruct
*) DrawItem )
#define STRUCT ( (
SCH_COMPONENT
*) DrawItem )
EDA_LibComponentStruct
*
Entry
;
Entry
=
FindLibPart
(
STRUCT
->
m_ChipName
,
wxEmptyString
,
FIND_ROOT
);
if
(
Entry
==
NULL
)
break
;
LibEDA_BaseStruct
*
DrawLibItem
=
Entry
->
m_Drawings
;
for
(
;
DrawLibItem
!=
NULL
;
DrawLibItem
=
DrawLibItem
->
Next
()
)
{
...
...
@@ -455,7 +455,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
break
;
}
default
:
;
}
...
...
eeschema/delete.cpp
View file @
c406eed1
...
...
@@ -280,10 +280,10 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
if
(
DelStruct
->
m_Flags
&
STRUCT_DELETED
)
continue
;
if
(
DelStruct
->
Type
()
!=
DRAW_LABEL_STRUCT_TYPE
)
if
(
DelStruct
->
Type
()
!=
TYPE_SCH_LABEL
)
continue
;
GetScreen
()
->
m_Curseur
=
(
(
DrawTextStruct
*
)
DelStruct
)
->
m_Pos
;
GetScreen
()
->
m_Curseur
=
(
(
SCH_TEXT
*
)
DelStruct
)
->
m_Pos
;
EDA_BaseStruct
*
TstStruct
=
PickStruct
(
GetScreen
()
->
m_Curseur
,
GetScreen
(),
WIREITEM
|
BUSITEM
);
...
...
eeschema/dialog_build_BOM.cpp
View file @
c406eed1
...
...
@@ -845,7 +845,7 @@ int GenListeCmp( ListComponent* List )
{
int
ItemCount
=
0
;
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
DrawSheetPath
*
sheet
;
/* Build the sheet (not screen) list */
...
...
@@ -858,9 +858,9 @@ int GenListeCmp( ListComponent* List )
{
switch
(
DrawList
->
Type
()
)
{
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
ItemCount
++
;
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
DrawLibItem
->
m_Parent
=
sheet
->
LastScreen
();
if
(
List
)
{
...
...
@@ -910,8 +910,8 @@ static int GenListeGLabels( ListLabel* List )
{
switch
(
DrawList
->
Type
()
)
{
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_GLOBALLABEL
:
ItemCount
++
;
if
(
List
)
{
...
...
@@ -1063,12 +1063,12 @@ static int ListTriGLabelByVal( ListLabel* Objet1, ListLabel* Objet2 )
if
(
Objet1
->
m_LabelType
==
DRAW_SHEETLABEL_STRUCT_TYPE
)
Text1
=
&
(
(
DrawSheetLabelStruct
*
)
Objet1
->
m_Label
)
->
m_Text
;
else
Text1
=
&
(
(
DrawTextStruct
*
)
Objet1
->
m_Label
)
->
m_Text
;
Text1
=
&
(
(
SCH_TEXT
*
)
Objet1
->
m_Label
)
->
m_Text
;
if
(
Objet2
->
m_LabelType
==
DRAW_SHEETLABEL_STRUCT_TYPE
)
Text2
=
&
(
(
DrawSheetLabelStruct
*
)
Objet2
->
m_Label
)
->
m_Text
;
else
Text2
=
&
(
(
DrawTextStruct
*
)
Objet2
->
m_Label
)
->
m_Text
;
Text2
=
&
(
(
SCH_TEXT
*
)
Objet2
->
m_Label
)
->
m_Text
;
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
...
...
@@ -1102,12 +1102,12 @@ static int ListTriGLabelBySheet( ListLabel* Objet1, ListLabel* Objet2 )
if
(
Objet1
->
m_LabelType
==
DRAW_SHEETLABEL_STRUCT_TYPE
)
Text1
=
&
(
(
DrawSheetLabelStruct
*
)
Objet1
->
m_Label
)
->
m_Text
;
else
Text1
=
&
(
(
DrawTextStruct
*
)
Objet1
->
m_Label
)
->
m_Text
;
Text1
=
&
(
(
SCH_TEXT
*
)
Objet1
->
m_Label
)
->
m_Text
;
if
(
Objet2
->
m_LabelType
==
DRAW_SHEETLABEL_STRUCT_TYPE
)
Text2
=
&
(
(
DrawSheetLabelStruct
*
)
Objet2
->
m_Label
)
->
m_Text
;
else
Text2
=
&
(
(
DrawTextStruct
*
)
Objet2
->
m_Label
)
->
m_Text
;
Text2
=
&
(
(
SCH_TEXT
*
)
Objet2
->
m_Label
)
->
m_Text
;
ii
=
Text1
->
CmpNoCase
(
*
Text2
);
}
...
...
@@ -1125,7 +1125,7 @@ static void DeleteSubCmp( ListComponent* List, int NbItems )
*/
{
int
ii
;
EDA_SchComponentStruct
*
LibItem
;
SCH_COMPONENT
*
LibItem
;
wxString
OldName
,
CurrName
;
for
(
ii
=
0
;
ii
<
NbItems
;
ii
++
)
...
...
@@ -1149,7 +1149,7 @@ static void DeleteSubCmp( ListComponent* List, int NbItems )
/*******************************************************************************************/
void
WinEDA_Build_BOM_Frame
::
PrintFieldData
(
FILE
*
f
,
EDA_SchComponentStruct
*
DrawLibItem
,
void
WinEDA_Build_BOM_Frame
::
PrintFieldData
(
FILE
*
f
,
SCH_COMPONENT
*
DrawLibItem
,
bool
CompactForm
)
/*******************************************************************************************/
{
...
...
@@ -1198,7 +1198,7 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE* f, ListComponent* List, in
{
int
ii
,
Multi
,
Unit
;
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
EDA_LibComponentStruct
*
Entry
;
char
NameCmp
[
80
];
wxString
msg
;
...
...
@@ -1254,10 +1254,10 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByRef( FILE* f, ListComponent* List, in
if
(
DrawList
==
NULL
)
continue
;
if
(
DrawList
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
DrawList
->
Type
()
!=
TYPE_SCH_COMPONENT
)
continue
;
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
if
(
List
[
ii
].
m_Ref
[
0
]
==
'#'
)
continue
;
...
...
@@ -1313,7 +1313,7 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE* f, ListComponent* List, in
int
ii
,
Multi
;
wxChar
Unit
;
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
EDA_LibComponentStruct
*
Entry
;
wxString
msg
;
...
...
@@ -1331,10 +1331,10 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE* f, ListComponent* List, in
if
(
DrawList
==
NULL
)
continue
;
if
(
DrawList
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
DrawList
->
Type
()
!=
TYPE_SCH_COMPONENT
)
continue
;
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
if
(
List
[
ii
].
m_Ref
[
0
]
==
'#'
)
continue
;
...
...
@@ -1354,10 +1354,10 @@ int WinEDA_Build_BOM_Frame::PrintListeCmpByVal( FILE* f, ListComponent* List, in
List
[
ii
].
m_Ref
,
Unit
);
// if( s_ListWithSubCmponents )
// print the sheet path
// print the sheet path
if
(
m_ListSubCmpItems
->
GetValue
()
)
{
msg
=
List
[
ii
].
m_SheetList
.
PathHumanReadable
();
msg
=
List
[
ii
].
m_SheetList
.
PathHumanReadable
();
fprintf
(
f
,
" (Sheet %s)"
,
CONV_TO_UTF8
(
msg
)
);
}
...
...
@@ -1377,7 +1377,7 @@ static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems )
/******************************************************************/
{
int
ii
,
jj
;
DrawLabelStruct
*
DrawTextItem
;
SCH_LABEL
*
DrawTextItem
;
DrawSheetLabelStruct
*
DrawSheetLabel
;
ListLabel
*
LabelItem
;
wxString
msg
,
sheetpath
;
...
...
@@ -1389,14 +1389,14 @@ static int PrintListeGLabel( FILE* f, ListLabel* List, int NbItems )
switch
(
LabelItem
->
m_LabelType
)
{
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
DrawTextItem
=
(
DrawLabelStruct
*
)
(
LabelItem
->
m_Label
);
if
(
LabelItem
->
m_LabelType
==
DRAW_HIER_LABEL_STRUCT_TYPE
)
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_GLOBALLABEL
:
DrawTextItem
=
(
SCH_LABEL
*
)
(
LabelItem
->
m_Label
);
if
(
LabelItem
->
m_LabelType
==
TYPE_SCH_HIERLABEL
)
labeltype
=
wxT
(
"Hierarchical"
);
else
labeltype
=
wxT
(
"Global "
);
sheetpath
=
CONV_FROM_UTF8
(
LabelItem
->
m_SheetPath
);
sheetpath
=
CONV_FROM_UTF8
(
LabelItem
->
m_SheetPath
);
msg
.
Printf
(
_
(
"> %-28.28s %s (Sheet %s) pos: %3.3f, %3.3f
\n
"
),
DrawTextItem
->
m_Text
.
GetData
(),
...
...
eeschema/dialog_build_BOM.h
View file @
c406eed1
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_build_BOM.h
// Purpose:
// Purpose:
// Author: jean-pieere Charras
// Modified by:
// Modified by:
// Created: 01/15/06 18:18:44
// RCS-ID:
// RCS-ID:
// Copyright: GNU license
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 01/15/06 18:18:44
...
...
@@ -80,7 +80,7 @@
*/
class
WinEDA_Build_BOM_Frame
:
public
wxDialog
{
{
DECLARE_DYNAMIC_CLASS
(
WinEDA_Build_BOM_Frame
)
DECLARE_EVENT_TABLE
()
...
...
@@ -88,11 +88,11 @@ public:
/// Constructors
WinEDA_Build_BOM_Frame
(
);
WinEDA_Build_BOM_Frame
(
WinEDA_DrawFrame
*
parent
,
wxWindowID
id
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME
,
const
wxString
&
caption
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE
,
const
wxPoint
&
pos
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION
,
const
wxSize
&
size
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE
,
long
style
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE
);
wxWindowID
id
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME
,
const
wxString
&
caption
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE
,
const
wxPoint
&
pos
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION
,
const
wxSize
&
size
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE
,
long
style
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE
);
/// Creation
bool
Create
(
wxWindow
*
parent
,
wxWindowID
id
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_IDNAME
,
const
wxString
&
caption
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_TITLE
,
const
wxPoint
&
pos
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_POSITION
,
const
wxSize
&
size
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_SIZE
,
long
style
=
SYMBOL_WINEDA_BUILD_BOM_FRAME_STYLE
);
...
...
@@ -119,7 +119,7 @@ public:
////@end WinEDA_Build_BOM_Frame event handler declarations
void
GenList
();
void
GenList
();
////@begin WinEDA_Build_BOM_Frame member function declarations
...
...
@@ -129,12 +129,12 @@ public:
/// Retrieves icon resources
wxIcon
GetIconResource
(
const
wxString
&
name
);
////@end WinEDA_Build_BOM_Frame member function declarations
void
GenereListeOfItems
(
const
wxString
&
FullFileName
);
void
CreateExportList
(
const
wxString
&
FullFileName
);
int
PrintListeCmpByRef
(
FILE
*
f
,
ListComponent
*
List
,
int
NbItems
,
bool
CompactForm
=
FALSE
);
int
PrintListeCmpByVal
(
FILE
*
f
,
ListComponent
*
List
,
int
NbItems
);
void
PrintFieldData
(
FILE
*
f
,
EDA_SchComponentStruct
*
DrawLibItem
,
bool
CompactForm
=
FALSE
);
void
SavePreferences
();
void
GenereListeOfItems
(
const
wxString
&
FullFileName
);
void
CreateExportList
(
const
wxString
&
FullFileName
);
int
PrintListeCmpByRef
(
FILE
*
f
,
ListComponent
*
List
,
int
NbItems
,
bool
CompactForm
=
FALSE
);
int
PrintListeCmpByVal
(
FILE
*
f
,
ListComponent
*
List
,
int
NbItems
);
void
PrintFieldData
(
FILE
*
f
,
SCH_COMPONENT
*
DrawLibItem
,
bool
CompactForm
=
FALSE
);
void
SavePreferences
();
/// Should we show tooltips?
...
...
@@ -161,9 +161,9 @@ public:
wxCheckBox
*
m_AddField8
;
////@end WinEDA_Build_BOM_Frame member variables
WinEDA_DrawFrame
*
m_Parent
;
wxString
m_LibArchiveFileName
;
wxString
m_ListFileName
;
WinEDA_DrawFrame
*
m_Parent
;
wxString
m_LibArchiveFileName
;
wxString
m_ListFileName
;
};
#endif
...
...
eeschema/dialog_edit_component_in_schematic.cpp
View file @
c406eed1
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_component_in_schematic.cpp
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 03/03/2006 15:02:54
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 03/03/2006 15:02:54
...
...
@@ -41,7 +41,7 @@ BEGIN_EVENT_TABLE( WinEDA_ComponentPropertiesFrame, wxDialog )
////@end WinEDA_ComponentPropertiesFrame event table entries
EVT_RADIOBOX
(
ID_ON_SELECT_FIELD
,
WinEDA_ComponentPropertiesFrame
::
SelectNewField
)
EVT_RADIOBOX
(
ID_ON_SELECT_FIELD
,
WinEDA_ComponentPropertiesFrame
::
SelectNewField
)
END_EVENT_TABLE
()
...
...
@@ -54,21 +54,21 @@ WinEDA_ComponentPropertiesFrame::WinEDA_ComponentPropertiesFrame( )
}
WinEDA_ComponentPropertiesFrame
::
WinEDA_ComponentPropertiesFrame
(
WinEDA_SchematicFrame
*
parent
,
EDA_SchComponentStruct
*
cmp
,
wxWindowID
id
,
const
wxString
&
caption
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
SCH_COMPONENT
*
cmp
,
wxWindowID
id
,
const
wxString
&
caption
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
{
m_Parent
=
parent
;
m_Cmp
=
cmp
;
m_LibEntry
=
FindLibPart
(
m_Cmp
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
m_Parent
=
parent
;
m_Cmp
=
cmp
;
m_LibEntry
=
FindLibPart
(
m_Cmp
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
InitBuffers
();
InitBuffers
();
Create
(
parent
,
id
,
caption
,
pos
,
size
,
style
);
if
(
m_LibEntry
==
NULL
)
{
SetTitle
(
_
(
"Component properties (Not found in lib)"
));
}
if
(
m_LibEntry
==
NULL
)
{
SetTitle
(
_
(
"Component properties (Not found in lib)"
));
}
}
/*!
...
...
@@ -77,7 +77,7 @@ WinEDA_ComponentPropertiesFrame::WinEDA_ComponentPropertiesFrame( WinEDA_Schemat
bool
WinEDA_ComponentPropertiesFrame
::
Create
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
caption
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
{
m_FieldNameCtrl
=
NULL
;
m_FieldNameCtrl
=
NULL
;
////@begin WinEDA_ComponentPropertiesFrame member initialisation
m_GeneralBoxSizer
=
NULL
;
m_NoteBook
=
NULL
;
...
...
@@ -114,9 +114,9 @@ bool WinEDA_ComponentPropertiesFrame::Create( wxWindow* parent, wxWindowID id, c
*/
void
WinEDA_ComponentPropertiesFrame
::
CreateControls
()
{
SetFont
(
*
g_DialogFont
);
{
SetFont
(
*
g_DialogFont
);
////@begin WinEDA_ComponentPropertiesFrame content construction
// Generated by DialogBlocks, 07/11/2007 08:28:00 (unregistered)
...
...
@@ -242,8 +242,8 @@ void WinEDA_ComponentPropertiesFrame::CreateControls()
itemBoxSizer23
->
Add
(
itemButton26
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
////@end WinEDA_ComponentPropertiesFrame content construction
BuildPanelBasic
();
BuildPanelFields
();
BuildPanelBasic
();
BuildPanelFields
();
}
/*!
...
...
@@ -295,7 +295,7 @@ void WinEDA_ComponentPropertiesFrame::OnCancelClick( wxCommandEvent& event )
void
WinEDA_ComponentPropertiesFrame
::
OnRestoreCmpDefaultsClick
(
wxCommandEvent
&
event
)
{
SetInitCmp
(
event
);
SetInitCmp
(
event
);
}
/*!
...
...
@@ -304,5 +304,5 @@ void WinEDA_ComponentPropertiesFrame::OnRestoreCmpDefaultsClick( wxCommandEvent&
void
WinEDA_ComponentPropertiesFrame
::
OnOkClick
(
wxCommandEvent
&
event
)
{
ComponentPropertiesAccept
(
event
);
ComponentPropertiesAccept
(
event
);
}
eeschema/dialog_edit_component_in_schematic.h
View file @
c406eed1
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_component_in_schematic.h
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 03/03/2006 15:02:54
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 03/03/2006 15:02:54
...
...
@@ -68,7 +68,7 @@ class wxNotebook;
*/
class
WinEDA_ComponentPropertiesFrame
:
public
wxDialog
{
{
DECLARE_DYNAMIC_CLASS
(
WinEDA_ComponentPropertiesFrame
)
DECLARE_EVENT_TABLE
()
...
...
@@ -76,8 +76,8 @@ public:
/// Constructors
WinEDA_ComponentPropertiesFrame
(
);
WinEDA_ComponentPropertiesFrame
(
WinEDA_SchematicFrame
*
parent
,
EDA_SchComponentStruct
*
cmp
,
wxWindowID
id
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_IDNAME
,
const
wxString
&
caption
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_TITLE
,
const
wxPoint
&
pos
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_POSITION
,
const
wxSize
&
size
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_SIZE
,
long
style
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_STYLE
);
SCH_COMPONENT
*
cmp
,
wxWindowID
id
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_IDNAME
,
const
wxString
&
caption
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_TITLE
,
const
wxPoint
&
pos
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_POSITION
,
const
wxSize
&
size
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_SIZE
,
long
style
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_STYLE
);
/// Creation
bool
Create
(
wxWindow
*
parent
,
wxWindowID
id
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_IDNAME
,
const
wxString
&
caption
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_TITLE
,
const
wxPoint
&
pos
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_POSITION
,
const
wxSize
&
size
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_SIZE
,
long
style
=
SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_STYLE
);
...
...
@@ -110,14 +110,14 @@ public:
/// Should we show tooltips?
static
bool
ShowToolTips
();
void
InitBuffers
();
void
BuildPanelBasic
();
void
BuildPanelFields
();
void
ComponentPropertiesAccept
(
wxCommandEvent
&
event
);
void
SetInitCmp
(
wxCommandEvent
&
event
);
void
CopyDataToPanelField
();
void
CopyPanelFieldToData
();
void
SelectNewField
(
wxCommandEvent
&
event
);
void
InitBuffers
();
void
BuildPanelBasic
();
void
BuildPanelFields
();
void
ComponentPropertiesAccept
(
wxCommandEvent
&
event
);
void
SetInitCmp
(
wxCommandEvent
&
event
);
void
CopyDataToPanelField
();
void
CopyPanelFieldToData
();
void
SelectNewField
(
wxCommandEvent
&
event
);
////@begin WinEDA_ComponentPropertiesFrame member variables
wxBoxSizer
*
m_GeneralBoxSizer
;
...
...
@@ -136,21 +136,21 @@ public:
wxBoxSizer
*
m_FieldSelectionBoxSizer
;
////@end WinEDA_ComponentPropertiesFrame member variables
WinEDA_SchematicFrame
*
m_Parent
;
EDA_SchComponentStruct
*
m_Cmp
;
EDA_LibComponentStruct
*
m_LibEntry
;
int
m_CurrentFieldId
;
wxRadioBox
*
m_FieldSelection
;
WinEDA_GraphicTextCtrl
*
m_FieldTextCtrl
;
WinEDA_EnterText
*
m_FieldNameCtrl
;
WinEDA_PositionCtrl
*
m_FieldPositionCtrl
;
wxString
m_FieldText
[
NUMBER_OF_FIELDS
];
wxString
m_FieldName
[
NUMBER_OF_FIELDS
];
wxPoint
m_FieldPosition
[
NUMBER_OF_FIELDS
];
int
m_FieldSize
[
NUMBER_OF_FIELDS
];
int
m_FieldFlags
[
NUMBER_OF_FIELDS
];
int
m_FieldOrient
[
NUMBER_OF_FIELDS
];
WinEDA_SchematicFrame
*
m_Parent
;
SCH_COMPONENT
*
m_Cmp
;
EDA_LibComponentStruct
*
m_LibEntry
;
int
m_CurrentFieldId
;
wxRadioBox
*
m_FieldSelection
;
WinEDA_GraphicTextCtrl
*
m_FieldTextCtrl
;
WinEDA_EnterText
*
m_FieldNameCtrl
;
WinEDA_PositionCtrl
*
m_FieldPositionCtrl
;
wxString
m_FieldText
[
NUMBER_OF_FIELDS
];
wxString
m_FieldName
[
NUMBER_OF_FIELDS
];
wxPoint
m_FieldPosition
[
NUMBER_OF_FIELDS
];
int
m_FieldSize
[
NUMBER_OF_FIELDS
];
int
m_FieldFlags
[
NUMBER_OF_FIELDS
];
int
m_FieldOrient
[
NUMBER_OF_FIELDS
];
};
#endif
...
...
eeschema/dialog_edit_label.cpp
View file @
c406eed1
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_label.cpp
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 19/02/2006 15:46:26
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 19/02/2006 15:46:26
...
...
@@ -51,42 +51,42 @@ WinEDA_LabelPropertiesFrame::WinEDA_LabelPropertiesFrame( )
}
WinEDA_LabelPropertiesFrame
::
WinEDA_LabelPropertiesFrame
(
WinEDA_SchematicFrame
*
parent
,
DrawTextStruct
*
CurrentText
,
const
wxPoint
&
pos
,
wxWindowID
id
,
const
wxString
&
caption
,
const
wxSize
&
size
,
long
style
)
SCH_TEXT
*
CurrentText
,
const
wxPoint
&
pos
,
wxWindowID
id
,
const
wxString
&
caption
,
const
wxSize
&
size
,
long
style
)
{
wxString
msg
;
m_Parent
=
parent
;
m_CurrentText
=
CurrentText
;
m_Parent
=
parent
;
m_CurrentText
=
CurrentText
;
Create
(
parent
,
id
,
caption
,
pos
,
size
,
style
);
m_TextLabel
->
SetValue
(
m_CurrentText
->
m_Text
);
m_TextLabel
->
SetFocus
();
switch
(
m_CurrentText
->
Type
()
)
{
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
SetTitle
(
_
(
"Global Label properties"
));
break
;
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
SetTitle
(
_
(
"Hierarchal Label properties"
));
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
SetTitle
(
_
(
"Label properties"
));
break
;
default
:
SetTitle
(
_
(
"Text properties"
));
break
;
}
msg
=
m_SizeTitle
->
GetLabel
()
+
ReturnUnitSymbol
();
m_SizeTitle
->
SetLabel
(
msg
);
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
m_CurrentText
->
m_Size
.
x
,
m_Parent
->
m_InternalUnits
);
m_TextSize
->
SetValue
(
msg
);
m_TextLabel
->
SetValue
(
m_CurrentText
->
m_Text
);
m_TextLabel
->
SetFocus
();
switch
(
m_CurrentText
->
Type
()
)
{
case
TYPE_SCH_GLOBALLABEL
:
SetTitle
(
_
(
"Global Label properties"
));
break
;
case
TYPE_SCH_HIERLABEL
:
SetTitle
(
_
(
"Hierarchal Label properties"
));
break
;
case
TYPE_SCH_LABEL
:
SetTitle
(
_
(
"Label properties"
));
break
;
default
:
SetTitle
(
_
(
"Text properties"
));
break
;
}
msg
=
m_SizeTitle
->
GetLabel
()
+
ReturnUnitSymbol
();
m_SizeTitle
->
SetLabel
(
msg
);
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
m_CurrentText
->
m_Size
.
x
,
m_Parent
->
m_InternalUnits
);
m_TextSize
->
SetValue
(
msg
);
}
/*!
...
...
@@ -120,8 +120,8 @@ bool WinEDA_LabelPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const
*/
void
WinEDA_LabelPropertiesFrame
::
CreateControls
()
{
SetFont
(
*
g_DialogFont
);
{
SetFont
(
*
g_DialogFont
);
////@begin WinEDA_LabelPropertiesFrame content construction
// Generated by DialogBlocks, 07/11/2007 12:37:47 (unregistered)
...
...
@@ -189,8 +189,8 @@ void WinEDA_LabelPropertiesFrame::CreateControls()
m_TextShape
->
SetValidator
(
wxGenericValidator
(
&
m_CurrentText
->
m_Shape
)
);
////@end WinEDA_LabelPropertiesFrame content construction
if
(
m_CurrentText
->
Type
()
==
DRAW_GLOBAL_LABEL_STRUCT_TYPE
||
m_CurrentText
->
Type
()
==
DRAW_HIER_LABEL_STRUCT_TYPE
)
if
(
m_CurrentText
->
Type
()
==
TYPE_SCH_GLOBALLABEL
||
m_CurrentText
->
Type
()
==
TYPE_SCH_HIERLABEL
)
m_TextShape
->
Show
(
true
);
}
...
...
eeschema/dialog_edit_label.h
View file @
c406eed1
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_label.h
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 19/02/2006 15:46:26
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 19/02/2006 15:46:26
...
...
@@ -60,7 +60,7 @@
*/
class
WinEDA_LabelPropertiesFrame
:
public
wxDialog
{
{
DECLARE_DYNAMIC_CLASS
(
WinEDA_LabelPropertiesFrame
)
DECLARE_EVENT_TABLE
()
...
...
@@ -68,9 +68,9 @@ public:
/// Constructors
WinEDA_LabelPropertiesFrame
(
);
WinEDA_LabelPropertiesFrame
(
WinEDA_SchematicFrame
*
parent
,
DrawTextStruct
*
CurrentText
,
const
wxPoint
&
pos
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION
,
wxWindowID
id
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME
,
const
wxString
&
caption
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE
,
const
wxSize
&
size
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE
,
long
style
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE
);
SCH_TEXT
*
CurrentText
,
const
wxPoint
&
pos
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION
,
wxWindowID
id
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME
,
const
wxString
&
caption
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE
,
const
wxSize
&
size
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE
,
long
style
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE
);
/// Creation
bool
Create
(
wxWindow
*
parent
,
wxWindowID
id
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_IDNAME
,
const
wxString
&
caption
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_TITLE
,
const
wxPoint
&
pos
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_POSITION
,
const
wxSize
&
size
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_SIZE
,
long
style
=
SYMBOL_WINEDA_LABELPROPERTIESFRAME_STYLE
);
...
...
@@ -99,8 +99,8 @@ public:
/// Should we show tooltips?
static
bool
ShowToolTips
();
void
TextPropertiesAccept
(
wxCommandEvent
&
event
);
void
TextPropertiesAccept
(
wxCommandEvent
&
event
);
////@begin WinEDA_LabelPropertiesFrame member variables
wxTextCtrl
*
m_TextLabel
;
wxRadioBox
*
m_TextOrient
;
...
...
@@ -110,7 +110,7 @@ public:
////@end WinEDA_LabelPropertiesFrame member variables
WinEDA_SchematicFrame
*
m_Parent
;
DrawTextStruct
*
m_CurrentText
;
SCH_TEXT
*
m_CurrentText
;
};
...
...
eeschema/edit_component_in_schematic.cpp
View file @
c406eed1
...
...
@@ -39,14 +39,14 @@ static wxPoint OldPos;
/**********************************************************************/
void
InstallCmpeditFrame
(
WinEDA_SchematicFrame
*
parent
,
wxPoint
&
pos
,
EDA_SchComponentStruct
*
cmp
)
SCH_COMPONENT
*
cmp
)
/*********************************************************************/
/* Create the dialog box for the current component edition
*/
{
parent
->
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
if
(
cmp
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
cmp
->
Type
()
!=
TYPE_SCH_COMPONENT
)
{
DisplayError
(
parent
,
wxT
(
"InstallCmpeditFrame() error: This struct is not a component"
)
);
...
...
@@ -55,7 +55,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
{
WinEDA_ComponentPropertiesFrame
*
frame
=
new
WinEDA_ComponentPropertiesFrame
(
parent
,
cmp
);
frame
->
ShowModal
();
frame
->
ShowModal
();
frame
->
Destroy
();
}
...
...
@@ -90,10 +90,10 @@ void WinEDA_ComponentPropertiesFrame::InitBuffers()
for
(
ii
=
REFERENCE
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
m_FieldName
[
ii
]
=
m_Cmp
->
ReturnFieldName
(
ii
);
if
(
ii
==
REFERENCE
)
m_FieldText
[
ii
]
=
m_Cmp
->
GetRef
(
m_Parent
->
GetSheet
());
else
m_FieldText
[
ii
]
=
m_Cmp
->
m_Field
[
ii
].
m_Text
;
if
(
ii
==
REFERENCE
)
m_FieldText
[
ii
]
=
m_Cmp
->
GetRef
(
m_Parent
->
GetSheet
());
else
m_FieldText
[
ii
]
=
m_Cmp
->
m_Field
[
ii
].
m_Text
;
m_FieldSize
[
ii
]
=
m_Cmp
->
m_Field
[
ii
].
m_Size
.
x
;
m_FieldFlags
[
ii
]
=
(
m_Cmp
->
m_Field
[
ii
].
m_Attributs
&
TEXT_NO_VISIBLE
)
?
0
:
1
;
...
...
@@ -122,7 +122,7 @@ void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField()
for
(
int
ii
=
FIELD1
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
){
m_FieldSelection
->
SetString
(
ii
,
m_FieldName
[
ii
]
);
}
}
if
(
fieldId
==
VALUE
&&
m_LibEntry
&&
m_LibEntry
->
m_Options
==
ENTRY_POWER
)
m_FieldTextCtrl
->
Enable
(
FALSE
);
...
...
@@ -394,7 +394,7 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
if
(
ii
==
REFERENCE
)
// la reference ne peut etre vide
{
if
(
!
m_FieldText
[
ii
].
IsEmpty
()
)
m_Cmp
->
SetRef
(
m_Parent
->
GetSheet
(),
m_FieldText
[
ii
]);
m_Cmp
->
SetRef
(
m_Parent
->
GetSheet
(),
m_FieldText
[
ii
]);
}
else
if
(
ii
==
VALUE
)
// la valeur ne peut etre vide et ne peut etre change sur un POWER
{
...
...
@@ -427,10 +427,10 @@ void WinEDA_ComponentPropertiesFrame::ComponentPropertiesAccept( wxCommandEvent&
m_Cmp
->
m_Field
[
ii
].
m_Pos
.
y
+=
cmp_pos
.
y
;
}
m_Parent
->
GetScreen
()
->
SetModify
();
m_Parent
->
GetScreen
()
->
SetModify
();
RedrawOneStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
m_Cmp
,
GR_DEFAULT_DRAWMODE
);
m_Parent
->
TestDanglingEnds
(
m_Parent
->
GetScreen
()
->
EEDrawList
,
&
dc
);
m_Parent
->
TestDanglingEnds
(
m_Parent
->
GetScreen
()
->
EEDrawList
,
&
dc
);
EndModal
(
0
);
}
...
...
@@ -458,9 +458,9 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC )
wxPoint
pos
,
newpos
;
int
x1
,
y1
;
EDA_SchComponentStruct
*
Cmp
=
(
EDA_SchComponentStruct
*
)
CurrentField
->
m_Parent
;
SCH_COMPONENT
*
Cmp
=
(
SCH_COMPONENT
*
)
CurrentField
->
m_Parent
;
SAFE_DELETE
(
g_ItemToUndoCopy
);
SAFE_DELETE
(
g_ItemToUndoCopy
);
g_ItemToUndoCopy
=
Cmp
->
GenCopy
();
pos
=
Cmp
->
m_Pos
;
...
...
@@ -482,7 +482,7 @@ void WinEDA_SchematicFrame::StartMoveCmpField( PartTextStruct* Field, wxDC* DC )
newpos
.
y
=
pos
.
y
+
Cmp
->
m_Transform
[
0
][
1
]
*
x1
+
Cmp
->
m_Transform
[
1
][
1
]
*
y1
;
DrawPanel
->
CursorOff
(
DC
);
GetScreen
()
->
m_Curseur
=
newpos
;
GetScreen
()
->
m_Curseur
=
newpos
;
DrawPanel
->
MouseToCursorSchema
();
OldPos
=
Field
->
m_Pos
;
...
...
@@ -519,7 +519,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
return
;
}
EDA_SchComponentStruct
*
Cmp
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
SCH_COMPONENT
*
Cmp
=
(
SCH_COMPONENT
*
)
Field
->
m_Parent
;
FieldNumber
=
Field
->
m_FieldId
;
if
(
FieldNumber
==
VALUE
)
...
...
@@ -567,9 +567,9 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
Field
->
m_Size
.
x
=
Field
->
m_Size
.
y
=
TextFieldSize
;
}
Field
->
m_Text
=
newtext
;
if
(
FieldNumber
==
REFERENCE
){
Cmp
->
SetRef
(
GetSheet
(),
newtext
);
}
if
(
FieldNumber
==
REFERENCE
){
Cmp
->
SetRef
(
GetSheet
(),
newtext
);
}
}
else
/* Nouveau texte NULL */
{
...
...
@@ -589,7 +589,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
DrawTextField
(
DrawPanel
,
DC
,
Field
,
flag
,
g_XorMode
);
Cmp
->
Display_Infos
(
this
);
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
}
...
...
@@ -608,14 +608,14 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if
(
CurrentField
==
NULL
)
return
;
EDA_SchComponentStruct
*
Cmp
=
(
EDA_SchComponentStruct
*
)
CurrentField
->
m_Parent
;
SCH_COMPONENT
*
Cmp
=
(
SCH_COMPONENT
*
)
CurrentField
->
m_Parent
;
FieldNumber
=
CurrentField
->
m_FieldId
;
/* Effacement: */
if
(
erase
)
DrawTextField
(
panel
,
DC
,
CurrentField
,
Multiflag
,
g_XorMode
);
pos
=
(
(
EDA_SchComponentStruct
*
)
CurrentField
->
m_Parent
)
->
m_Pos
;
pos
=
(
(
SCH_COMPONENT
*
)
CurrentField
->
m_Parent
)
->
m_Pos
;
/* Les positions sont caculees par la matrice TRANSPOSEE de la matrice
* de rotation-miroir */
...
...
@@ -642,7 +642,7 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC )
DrawTextField
(
Panel
,
DC
,
CurrentField
,
Multiflag
,
GR_DEFAULT_DRAWMODE
);
}
CurrentField
=
NULL
;
SAFE_DELETE
(
g_ItemToUndoCopy
);
SAFE_DELETE
(
g_ItemToUndoCopy
);
}
...
...
@@ -658,13 +658,13 @@ void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC )
if
(
Field
->
m_Text
==
wxEmptyString
)
return
;
EDA_SchComponentStruct
*
Cmp
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
SCH_COMPONENT
*
Cmp
=
(
SCH_COMPONENT
*
)
Field
->
m_Parent
;
FieldNumber
=
Field
->
m_FieldId
;
flag
=
0
;
if
(
FieldNumber
==
REFERENCE
)
{
Entry
=
FindLibPart
(
(
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
)
->
m_ChipName
.
GetData
(),
Entry
=
FindLibPart
(
(
(
SCH_COMPONENT
*
)
Field
->
m_Parent
)
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
if
(
Entry
!=
NULL
)
{
...
...
@@ -699,13 +699,13 @@ void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
frame
->
DrawPanel
->
ManageCurseur
=
NULL
;
frame
->
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
EDA_SchComponentStruct
*
Cmp
=
(
EDA_SchComponentStruct
*
)
m_Parent
;
SCH_COMPONENT
*
Cmp
=
(
SCH_COMPONENT
*
)
m_Parent
;
/* save old cmp in undo list */
if
(
g_ItemToUndoCopy
&&
(
g_ItemToUndoCopy
->
Type
()
==
Cmp
->
Type
())
)
{
Cmp
->
SwapData
(
(
EDA_SchComponentStruct
*
)
g_ItemToUndoCopy
);
Cmp
->
SwapData
(
(
SCH_COMPONENT
*
)
g_ItemToUndoCopy
);
(
(
WinEDA_SchematicFrame
*
)
frame
)
->
SaveCopyInUndoList
(
Cmp
,
IS_CHANGED
);
Cmp
->
SwapData
(
(
EDA_SchComponentStruct
*
)
g_ItemToUndoCopy
);
Cmp
->
SwapData
(
(
SCH_COMPONENT
*
)
g_ItemToUndoCopy
);
}
FieldNumber
=
m_FieldId
;
...
...
@@ -730,7 +730,7 @@ void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/**************************************************************************************************/
void
WinEDA_SchematicFrame
::
EditComponentReference
(
EDA_SchComponentStruct
*
Cmp
,
wxDC
*
DC
)
void
WinEDA_SchematicFrame
::
EditComponentReference
(
SCH_COMPONENT
*
Cmp
,
wxDC
*
DC
)
/**************************************************************************************************/
/* Edit the component text reference*/
{
...
...
@@ -747,7 +747,7 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp,
if
(
Entry
->
m_UnitCount
>
1
)
flag
=
1
;
wxString
ref
=
Cmp
->
GetRef
(
GetSheet
());
wxString
ref
=
Cmp
->
GetRef
(
GetSheet
());
Get_Message
(
_
(
"Reference"
),
ref
,
this
);
if
(
!
ref
.
IsEmpty
()
)
// New text entered
...
...
@@ -755,10 +755,10 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp,
/* save old cmp in undo list if not already in edit, or moving ... */
if
(
Cmp
->
m_Flags
==
0
)
SaveCopyInUndoList
(
Cmp
,
IS_CHANGED
);
Cmp
->
SetRef
(
GetSheet
(),
ref
);
Cmp
->
SetRef
(
GetSheet
(),
ref
);
DrawTextField
(
DrawPanel
,
DC
,
&
Cmp
->
m_Field
[
REFERENCE
],
flag
,
g_XorMode
);
Cmp
->
SetRef
(
GetSheet
(),
ref
);
Cmp
->
SetRef
(
GetSheet
(),
ref
);
DrawTextField
(
DrawPanel
,
DC
,
&
Cmp
->
m_Field
[
REFERENCE
],
flag
,
Cmp
->
m_Flags
?
g_XorMode
:
GR_DEFAULT_DRAWMODE
);
GetScreen
()
->
SetModify
();
...
...
@@ -768,7 +768,7 @@ void WinEDA_SchematicFrame::EditComponentReference( EDA_SchComponentStruct* Cmp,
/*****************************************************************************************/
void
WinEDA_SchematicFrame
::
EditComponentValue
(
EDA_SchComponentStruct
*
Cmp
,
wxDC
*
DC
)
void
WinEDA_SchematicFrame
::
EditComponentValue
(
SCH_COMPONENT
*
Cmp
,
wxDC
*
DC
)
/*****************************************************************************************/
/* Routine de changement du texte selectionne */
{
...
...
@@ -789,7 +789,7 @@ void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* Cmp, wxD
msg
=
TextField
->
m_Text
;
if
(
Get_Message
(
_
(
"Value"
),
msg
,
this
)
)
msg
.
Empty
();
//allow the user to remove the value.
msg
.
Empty
();
//allow the user to remove the value.
if
(
!
msg
.
IsEmpty
()
&&
!
msg
.
IsEmpty
())
{
...
...
@@ -801,20 +801,20 @@ void WinEDA_SchematicFrame::EditComponentValue( EDA_SchComponentStruct* Cmp, wxD
TextField
->
m_Text
=
msg
;
DrawTextField
(
DrawPanel
,
DC
,
&
Cmp
->
m_Field
[
VALUE
],
flag
,
Cmp
->
m_Flags
?
g_XorMode
:
GR_DEFAULT_DRAWMODE
);
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
}
Cmp
->
Display_Infos
(
this
);
}
/*****************************************************************************************/
void
WinEDA_SchematicFrame
::
EditComponentFootprint
(
EDA_SchComponentStruct
*
Cmp
,
wxDC
*
DC
)
void
WinEDA_SchematicFrame
::
EditComponentFootprint
(
SCH_COMPONENT
*
Cmp
,
wxDC
*
DC
)
/*****************************************************************************************/
{
wxString
msg
;
EDA_LibComponentStruct
*
Entry
;
int
flag
=
0
;
bool
wasEmpty
=
false
;
bool
wasEmpty
=
false
;
if
(
Cmp
==
NULL
)
return
;
...
...
@@ -828,35 +828,35 @@ void WinEDA_SchematicFrame::EditComponentFootprint( EDA_SchComponentStruct* Cmp,
PartTextStruct
*
TextField
=
&
Cmp
->
m_Field
[
FOOTPRINT
];
msg
=
TextField
->
m_Text
;
if
(
msg
.
IsEmpty
()
)
wasEmpty
=
true
;
if
(
msg
.
IsEmpty
()
)
wasEmpty
=
true
;
if
(
Get_Message
(
_
(
"Footprint"
),
msg
,
this
)
)
msg
.
Empty
();
//allow the user to remove the value.
/* save old cmp in undo list if not already in edit, or moving ... */
if
(
Cmp
->
m_Flags
==
0
)
SaveCopyInUndoList
(
Cmp
,
IS_CHANGED
);
DrawTextField
(
DrawPanel
,
DC
,
&
Cmp
->
m_Field
[
FOOTPRINT
],
flag
,
g_XorMode
);
//move the field if it was new.
if
(
wasEmpty
&&
!
msg
.
IsEmpty
())
{
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
=
Cmp
->
m_Field
[
REFERENCE
].
m_Pos
;
//add offset here - ? suitable heuristic below?
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
.
x
+=
(
Cmp
->
m_Field
[
REFERENCE
].
m_Pos
.
x
-
Cmp
->
m_Pos
.
x
)
>
0
?
(
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
x
)
:
(
-
1
*
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
x
);
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
.
y
+=
(
Cmp
->
m_Field
[
REFERENCE
].
m_Pos
.
y
-
Cmp
->
m_Pos
.
y
)
>
0
?
(
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
y
)
:
(
-
1
*
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
y
);
Cmp
->
m_Field
[
FOOTPRINT
].
m_Orient
=
Cmp
->
m_Field
[
REFERENCE
].
m_Orient
;
}
TextField
->
m_Text
=
msg
;
DrawTextField
(
DrawPanel
,
DC
,
&
Cmp
->
m_Field
[
FOOTPRINT
],
flag
,
Cmp
->
m_Flags
?
g_XorMode
:
GR_DEFAULT_DRAWMODE
);
GetScreen
()
->
SetModify
();
msg
.
Empty
();
//allow the user to remove the value.
/* save old cmp in undo list if not already in edit, or moving ... */
if
(
Cmp
->
m_Flags
==
0
)
SaveCopyInUndoList
(
Cmp
,
IS_CHANGED
);
DrawTextField
(
DrawPanel
,
DC
,
&
Cmp
->
m_Field
[
FOOTPRINT
],
flag
,
g_XorMode
);
//move the field if it was new.
if
(
wasEmpty
&&
!
msg
.
IsEmpty
())
{
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
=
Cmp
->
m_Field
[
REFERENCE
].
m_Pos
;
//add offset here - ? suitable heuristic below?
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
.
x
+=
(
Cmp
->
m_Field
[
REFERENCE
].
m_Pos
.
x
-
Cmp
->
m_Pos
.
x
)
>
0
?
(
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
x
)
:
(
-
1
*
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
x
);
Cmp
->
m_Field
[
FOOTPRINT
].
m_Pos
.
y
+=
(
Cmp
->
m_Field
[
REFERENCE
].
m_Pos
.
y
-
Cmp
->
m_Pos
.
y
)
>
0
?
(
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
y
)
:
(
-
1
*
Cmp
->
m_Field
[
REFERENCE
].
m_Size
.
y
);
Cmp
->
m_Field
[
FOOTPRINT
].
m_Orient
=
Cmp
->
m_Field
[
REFERENCE
].
m_Orient
;
}
TextField
->
m_Text
=
msg
;
DrawTextField
(
DrawPanel
,
DC
,
&
Cmp
->
m_Field
[
FOOTPRINT
],
flag
,
Cmp
->
m_Flags
?
g_XorMode
:
GR_DEFAULT_DRAWMODE
);
GetScreen
()
->
SetModify
();
Cmp
->
Display_Infos
(
this
);
}
/*****************************************************************************/
...
...
@@ -903,7 +903,7 @@ void WinEDA_ComponentPropertiesFrame::SetInitCmp( wxCommandEvent& event )
m_Cmp
->
SetRotationMiroir
(
CMP_NORMAL
);
m_Parent
->
GetScreen
()
->
SetModify
();
m_Parent
->
GetScreen
()
->
SetModify
();
RedrawOneStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
m_Cmp
,
GR_DEFAULT_DRAWMODE
);
EndModal
(
1
);
...
...
eeschema/edit_label.cpp
View file @
c406eed1
...
...
@@ -69,7 +69,7 @@ void WinEDA_LabelPropertiesFrame::TextPropertiesAccept( wxCommandEvent& event )
/********************************************************************************/
void
WinEDA_SchematicFrame
::
StartMoveTexte
(
DrawTextStruct
*
TextStruct
,
wxDC
*
DC
)
void
WinEDA_SchematicFrame
::
StartMoveTexte
(
SCH_TEXT
*
TextStruct
,
wxDC
*
DC
)
/********************************************************************************/
{
if
(
TextStruct
==
NULL
)
...
...
@@ -87,10 +87,10 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
switch
(
TextStruct
->
Type
()
)
{
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_TEXT
:
ItemInitialPosition
=
TextStruct
->
m_Pos
;
OldSize
=
TextStruct
->
m_Size
;
OldOrient
=
TextStruct
->
m_Orient
;
...
...
@@ -101,13 +101,13 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
}
DrawPanel
->
CursorOff
(
DC
);
GetScreen
()
->
m_Curseur
=
ItemInitialPosition
;
GetScreen
()
->
m_Curseur
=
ItemInitialPosition
;
DrawPanel
->
MouseToCursorSchema
();
GetScreen
()
->
SetModify
();
DrawPanel
->
ManageCurseur
=
ShowWhileMoving
;
DrawPanel
->
ForceCloseManageCurseur
=
ExitMoveTexte
;
GetScreen
()
->
SetCurItem
(
TextStruct
);
GetScreen
()
->
SetCurItem
(
TextStruct
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
TRUE
);
DrawPanel
->
CursorOn
(
DC
);
...
...
@@ -115,7 +115,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
/*************************************************************************/
void
WinEDA_SchematicFrame
::
EditSchematicText
(
DrawTextStruct
*
TextStruct
,
void
WinEDA_SchematicFrame
::
EditSchematicText
(
SCH_TEXT
*
TextStruct
,
wxDC
*
DC
)
/*************************************************************************/
...
...
@@ -140,11 +140,11 @@ void WinEDA_SchematicFrame::EditSchematicText( DrawTextStruct* TextStruct,
/***********************************************************************************/
void
WinEDA_SchematicFrame
::
ChangeTextOrient
(
DrawTextStruct
*
TextStruct
,
wxDC
*
DC
)
void
WinEDA_SchematicFrame
::
ChangeTextOrient
(
SCH_TEXT
*
TextStruct
,
wxDC
*
DC
)
/***********************************************************************************/
{
if
(
TextStruct
==
NULL
)
TextStruct
=
(
DrawTextStruct
*
)
PickStruct
(
GetScreen
()
->
m_Curseur
,
TextStruct
=
(
SCH_TEXT
*
)
PickStruct
(
GetScreen
()
->
m_Curseur
,
GetScreen
(),
TEXTITEM
|
LABELITEM
);
if
(
TextStruct
==
NULL
)
return
;
...
...
@@ -160,10 +160,10 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC*
/* Rotation du texte */
switch
(
TextStruct
->
Type
()
)
{
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_TEXT
:
TextStruct
->
m_Orient
++
;
TextStruct
->
m_Orient
&=
3
;
break
;
...
...
@@ -187,28 +187,28 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
/* Routine to create new text struct (GraphicText, label or Glabel).
*/
{
DrawTextStruct
*
NewText
=
NULL
;
SCH_TEXT
*
NewText
=
NULL
;
g_ItemToRepeat
=
NULL
;
switch
(
type
)
{
case
LAYER_NOTES
:
NewText
=
new
DrawTextStruct
(
GetScreen
()
->
m_Curseur
);
NewText
=
new
SCH_TEXT
(
GetScreen
()
->
m_Curseur
);
break
;
case
LAYER_LOCLABEL
:
NewText
=
new
DrawLabelStruct
(
GetScreen
()
->
m_Curseur
);
NewText
=
new
SCH_LABEL
(
GetScreen
()
->
m_Curseur
);
break
;
case
LAYER_HIERLABEL
:
NewText
=
new
DrawHierLabelStruct
(
GetScreen
()
->
m_Curseur
);
case
LAYER_HIERLABEL
:
NewText
=
new
SCH_HIERLABEL
(
GetScreen
()
->
m_Curseur
);
NewText
->
m_Shape
=
s_DefaultShapeGLabel
;
NewText
->
m_Orient
=
s_DefaultOrientGLabel
;
break
;
case
LAYER_GLOBLABEL
:
NewText
=
new
DrawGlobalLabelStruct
(
GetScreen
()
->
m_Curseur
);
NewText
=
new
SCH_GLOBALLABEL
(
GetScreen
()
->
m_Curseur
);
NewText
->
m_Shape
=
s_DefaultShapeGLabel
;
NewText
->
m_Orient
=
s_DefaultOrientGLabel
;
break
;
...
...
@@ -226,11 +226,11 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
if
(
NewText
->
m_Text
.
IsEmpty
()
)
{
SAFE_DELETE
(
NewText
);
SAFE_DELETE
(
NewText
);
return
NULL
;
}
if
(
type
==
LAYER_GLOBLABEL
||
type
==
LAYER_HIERLABEL
)
if
(
type
==
LAYER_GLOBLABEL
||
type
==
LAYER_HIERLABEL
)
{
s_DefaultShapeGLabel
=
NewText
->
m_Shape
;
s_DefaultOrientGLabel
=
NewText
->
m_Orient
;
...
...
@@ -240,7 +240,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
DrawPanel
->
ManageCurseur
=
ShowWhileMoving
;
DrawPanel
->
ForceCloseManageCurseur
=
ExitMoveTexte
;
GetScreen
()
->
SetCurItem
(
NewText
);
GetScreen
()
->
SetCurItem
(
NewText
);
return
NewText
;
}
...
...
@@ -260,11 +260,11 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/* redraw the text */
switch
(
TextStruct
->
Type
()
)
{
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
(
(
DrawTextStruct
*
)
TextStruct
)
->
m_Pos
=
panel
->
GetScreen
()
->
m_Curseur
;
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_TEXT
:
(
(
SCH_TEXT
*
)
TextStruct
)
->
m_Pos
=
panel
->
GetScreen
()
->
m_Curseur
;
break
;
default
:
...
...
@@ -297,19 +297,19 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
if
(
Struct
->
m_Flags
&
IS_NEW
)
{
SAFE_DELETE
(
Struct
);
SAFE_DELETE
(
Struct
);
screen
->
SetCurItem
(
NULL
);
}
else
/* this was a move command on an "old" text: restore its old settings. */
{
switch
(
Struct
->
Type
()
)
{
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_TEXT
:
{
DrawTextStruct
*
Text
=
(
DrawTextStruct
*
)
Struct
;
SCH_TEXT
*
Text
=
(
SCH_TEXT
*
)
Struct
;
Text
->
m_Pos
=
ItemInitialPosition
;
Text
->
m_Size
=
OldSize
;
Text
->
m_Orient
=
OldOrient
;
...
...
@@ -327,7 +327,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
/*****************************************************************************/
void
WinEDA_SchematicFrame
::
ConvertTextType
(
DrawTextStruct
*
Text
,
void
WinEDA_SchematicFrame
::
ConvertTextType
(
SCH_TEXT
*
Text
,
wxDC
*
DC
,
int
newtype
)
/*****************************************************************************/
...
...
@@ -339,22 +339,22 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
if
(
Text
==
NULL
)
return
;
DrawTextStruct
*
newtext
;
SCH_TEXT
*
newtext
;
switch
(
newtype
)
{
case
DRAW_LABEL_STRUCT_TYPE
:
newtext
=
new
DrawLabelStruct
(
Text
->
m_Pos
,
Text
->
m_Text
);
case
TYPE_SCH_LABEL
:
newtext
=
new
SCH_LABEL
(
Text
->
m_Pos
,
Text
->
m_Text
);
break
;
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
newtext
=
new
DrawGlobalLabelStruct
(
Text
->
m_Pos
,
Text
->
m_Text
);
case
TYPE_SCH_GLOBALLABEL
:
newtext
=
new
SCH_GLOBALLABEL
(
Text
->
m_Pos
,
Text
->
m_Text
);
break
;
case
TYPE_SCH_HIERLABEL
:
newtext
=
new
SCH_HIERLABEL
(
Text
->
m_Pos
,
Text
->
m_Text
);
break
;
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
newtext
=
new
DrawHierLabelStruct
(
Text
->
m_Pos
,
Text
->
m_Text
);
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
newtext
=
new
DrawTextStruct
(
Text
->
m_Pos
,
Text
->
m_Text
);
case
TYPE_SCH_TEXT
:
newtext
=
new
SCH_TEXT
(
Text
->
m_Pos
,
Text
->
m_Text
);
break
;
default
:
...
...
@@ -395,13 +395,13 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
{
Text
->
m_Flags
=
0
;
DeleteStruct
(
DrawPanel
,
DC
,
Text
);
// old text is really saved in undo list
GetScreen
()
->
SetCurItem
(
NULL
);
GetScreen
()
->
SetCurItem
(
NULL
);
g_ItemToRepeat
=
NULL
;
}
GetScreen
()
->
SetCurItem
(
NULL
);
SAFE_DELETE
(
g_ItemToUndoCopy
);
SAFE_DELETE
(
g_ItemToUndoCopy
);
DrawPanel
->
CursorOff
(
DC
);
// Erase schematic cursor
...
...
@@ -415,15 +415,15 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
SaveCopyInUndoList
(
newtext
,
IS_NEW
);
}
else
{
GetScreen
()
->
SetCurItem
(
newtext
);
{
GetScreen
()
->
SetCurItem
(
newtext
);
newtext
->
m_Flags
=
IS_NEW
;
}
}
if
(
(
flags
&
IS_MOVED
)
!=
0
)
{
GetScreen
()
->
SetCurItem
(
newtext
);
GetScreen
()
->
SetCurItem
(
newtext
);
StartMoveTexte
(
newtext
,
DC
);
}
...
...
eeschema/eecreate.cpp
View file @
c406eed1
...
...
@@ -376,9 +376,9 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
STRUCT
->
m_Pos
.
y
+=
g_RepeatStep
.
y
;
oy
=
STRUCT
->
m_Pos
.
y
;
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
#undef STRUCT
#define STRUCT ( (
DrawTextStruct
*) g_ItemToRepeat )
#define STRUCT ( (
SCH_TEXT
*) g_ItemToRepeat )
g_ItemToRepeat
=
STRUCT
->
GenCopy
();
STRUCT
->
m_Pos
.
x
+=
g_RepeatStep
.
x
;
ox
=
STRUCT
->
m_Pos
.
x
;
STRUCT
->
m_Pos
.
y
+=
g_RepeatStep
.
y
;
oy
=
STRUCT
->
m_Pos
.
y
;
...
...
@@ -389,11 +389,11 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
#undef STRUCT
#define STRUCT ( (
DrawLabelStruct
*) g_ItemToRepeat )
#define STRUCT ( (
SCH_LABEL
*) g_ItemToRepeat )
g_ItemToRepeat
=
STRUCT
->
GenCopy
();
STRUCT
->
m_Pos
.
x
+=
g_RepeatStep
.
x
;
ox
=
STRUCT
->
m_Pos
.
x
;
STRUCT
->
m_Pos
.
y
+=
g_RepeatStep
.
y
;
oy
=
STRUCT
->
m_Pos
.
y
;
...
...
@@ -474,7 +474,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
* - une jonction
* - ou une pin
* - ou une extr�mit� unique de fil
*
*
* - type BUS, si il y a
* - ou une extr�mit� unique de BUS
*/
...
...
@@ -528,9 +528,9 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
return
TRUE
;
item
=
PickStruct
(
screen
,
LABELITEM
);
if
(
item
&&
(
item
->
Type
()
!=
DRAW_TEXT_STRUCT_TYPE
)
&&
(
(
(
DrawGlobalLabelStruct
*
)
item
)
->
m_Pos
.
x
==
pos
.
x
)
&&
(
(
(
DrawGlobalLabelStruct
*
)
item
)
->
m_Pos
.
y
==
pos
.
y
)
)
if
(
item
&&
(
item
->
Type
()
!=
TYPE_SCH_TEXT
)
&&
(
(
(
SCH_GLOBALLABEL
*
)
item
)
->
m_Pos
.
x
==
pos
.
x
)
&&
(
(
(
SCH_GLOBALLABEL
*
)
item
)
->
m_Pos
.
y
==
pos
.
y
)
)
return
TRUE
;
pinsheet
=
LocateAnyPinSheet
(
pos
,
screen
->
EEDrawList
);
...
...
eeschema/eelibs_draw_components.cpp
View file @
c406eed1
...
...
@@ -40,7 +40,7 @@ static int s_ItemSelectColor = BROWN;
static
EDA_LibComponentStruct
*
DummyCmp
;
static
int
*
Buf_Poly_Drawings
,
Buf_Poly_Size
;
// Used fo polyline drawings
static
void
DrawLibPartAux
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_SchComponentStruct
*
Component
,
SCH_COMPONENT
*
Component
,
EDA_LibComponentStruct
*
Entry
,
const
wxPoint
&
Pos
,
int
TransMat
[
2
][
2
],
...
...
@@ -82,9 +82,9 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
* posX, posY = position du composant
* DrawMode = GrOR ..
* Color = 0 : dessin en vraies couleurs, sinon couleur = Color
*
*
* Une croix symbolise le point d'accrochage (ref position) du composant
*
*
* Le composant est toujours trace avec orientation 0
*/
{
...
...
@@ -204,7 +204,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
* Routine to draw the given part at given position, transformed/mirror as *
* specified, and in the given drawing mode. Only this one is visible... *
*****************************************************************************/
void
EDA_SchComponentStruct
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
SCH_COMPONENT
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
DrawMode
,
int
Color
)
{
EDA_LibComponentStruct
*
Entry
;
...
...
@@ -262,7 +262,7 @@ void DrawTextField( WinEDA_DrawPanel* panel, wxDC* DC,
{
int
orient
,
color
;
wxPoint
pos
;
/* Position des textes */
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
Field
->
m_Parent
;
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
Field
->
m_Parent
;
int
hjustify
,
vjustify
;
int
LineWidth
=
MAX
(
Field
->
m_Width
,
g_DrawMinimunLineWidth
);
...
...
@@ -357,30 +357,30 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name, const wxString& LibName
PQCompFunc
(
(
PQCompFuncType
)
LibraryEntryCompare
);
Entry
=
NULL
;
Entry
=
NULL
;
FindLibName
.
Empty
();
while
(
Lib
)
{
if
(
!
LibName
.
IsEmpty
()
)
{
if
(
Lib
->
m_Name
!=
LibName
)
{
Lib
=
Lib
->
m_Pnext
;
Lib
=
Lib
->
m_Pnext
;
continue
;
}
}
if
(
Lib
==
NULL
)
break
;
Entry
=
(
EDA_LibComponentStruct
*
)
PQFind
(
Lib
->
m_Entries
,
&
DummyEntry
);
if
(
Entry
!=
NULL
)
{
FindLibName
=
Lib
->
m_Name
;
break
;
}
Lib
=
Lib
->
m_Pnext
;
}
...
...
@@ -404,7 +404,7 @@ EDA_LibComponentStruct* FindLibPart( const wxChar* Name, const wxString& LibName
*****************************************************************************/
/* DrawMode = GrXOR, GrOR ..*/
void
DrawLibPartAux
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_SchComponentStruct
*
Component
,
SCH_COMPONENT
*
Component
,
EDA_LibComponentStruct
*
Entry
,
const
wxPoint
&
Pos
,
int
TransMat
[
2
][
2
],
...
...
@@ -431,13 +431,13 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
/* Elimination des elements non relatifs a l'unite */
if
(
Multi
&&
DEntry
->
m_Unit
&&
(
DEntry
->
m_Unit
!=
Multi
)
)
continue
;
if
(
convert
&&
DEntry
->
m_Convert
&&
(
DEntry
->
m_Convert
!=
convert
)
)
continue
;
if
(
DEntry
->
m_Flags
&
IS_MOVED
)
continue
;
// Element en deplacement non trace
SetHightColor
=
(
DEntry
->
m_Selected
&
IS_SELECTED
)
?
HIGHT_LIGHT_FLAG
:
0
;
LineWidth
=
MAX
(
DEntry
->
m_Width
,
g_DrawMinimunLineWidth
);
...
...
@@ -502,12 +502,12 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
{
LibDrawCircle
*
Circle
=
(
LibDrawCircle
*
)
DEntry
;
CharColor
=
GETCOLOR
(
LAYER_DEVICE
);
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Circle
->
m_Pos
.
x
+
TransMat
[
0
][
1
]
*
Circle
->
m_Pos
.
y
;
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Circle
->
m_Pos
.
x
+
TransMat
[
1
][
1
]
*
Circle
->
m_Pos
.
y
;
fill_option
=
Circle
->
m_Fill
&
(
~
g_PrintFillMask
);
if
(
Color
<
0
)
{
...
...
@@ -536,12 +536,12 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
/* The text orientation may need to be flipped if the
* transformation matrix cuases xy axes to be flipped. */
t1
=
(
TransMat
[
0
][
0
]
!=
0
)
^
(
Text
->
m_Horiz
!=
0
);
x1
=
Pos
.
x
+
TransMat
[
0
][
0
]
*
Text
->
m_Pos
.
x
+
TransMat
[
0
][
1
]
*
Text
->
m_Pos
.
y
;
y1
=
Pos
.
y
+
TransMat
[
1
][
0
]
*
Text
->
m_Pos
.
x
+
TransMat
[
1
][
1
]
*
Text
->
m_Pos
.
y
;
DrawGraphicText
(
panel
,
DC
,
wxPoint
(
x1
,
y1
),
CharColor
,
Text
->
m_Text
,
t1
?
TEXT_ORIENT_HORIZ
:
TEXT_ORIENT_VERT
,
Text
->
m_Size
,
...
...
@@ -591,7 +591,7 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
&&*/
!
g_ShowAllPins
)
break
;
}
/* Calcul de l'orientation reelle de la Pin */
orient
=
Pin
->
ReturnPinDrawOrient
(
TransMat
);
...
...
@@ -896,7 +896,7 @@ bool MapAngles( int* Angle1, int* Angle2, int TransMat[2][2] )
*****************************************************************************/
void
DrawingLibInGhost
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_LibComponentStruct
*
LibEntry
,
EDA_SchComponentStruct
*
DrawLibItem
,
int
PartX
,
int
PartY
,
SCH_COMPONENT
*
DrawLibItem
,
int
PartX
,
int
PartY
,
int
multi
,
int
convert
,
int
Color
,
bool
DrawPinText
)
{
int
DrawMode
=
g_XorMode
;
...
...
eeschema/eeredraw.cpp
View file @
c406eed1
...
...
@@ -459,22 +459,22 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
break
;
}
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
{
DrawTextStruct
*
Struct
;
Struct
=
(
DrawTextStruct
*
)
DrawStruct
;
SCH_TEXT
*
Struct
;
Struct
=
(
SCH_TEXT
*
)
DrawStruct
;
Struct
->
m_Pos
.
x
+=
dx
;
Struct
->
m_Pos
.
y
+=
dy
;
Struct
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
DrawMode
,
g_GhostColor
);
Struct
->
m_Pos
.
x
-=
dx
;
Struct
->
m_Pos
.
y
-=
dy
;
break
;
}
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
{
DrawLabelStruct
*
Struct
;
Struct
=
(
DrawLabelStruct
*
)
DrawStruct
;
SCH_LABEL
*
Struct
;
Struct
=
(
SCH_LABEL
*
)
DrawStruct
;
Struct
->
m_Pos
.
x
+=
dx
;
Struct
->
m_Pos
.
y
+=
dy
;
Struct
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
DrawMode
,
g_GhostColor
);
Struct
->
m_Pos
.
x
-=
dx
;
Struct
->
m_Pos
.
y
-=
dy
;
...
...
@@ -491,11 +491,11 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
break
;
}
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
{
EDA_LibComponentStruct
*
LibEntry
;
EDA_SchComponentStruct
*
Struct
;
Struct
=
(
EDA_SchComponentStruct
*
)
DrawStruct
;
SCH_COMPONENT
*
Struct
;
Struct
=
(
SCH_COMPONENT
*
)
DrawStruct
;
LibEntry
=
FindLibPart
(
Struct
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
if
(
LibEntry
==
NULL
)
break
;
...
...
eeschema/files-io.cpp
View file @
c406eed1
...
...
@@ -52,11 +52,11 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
//bool WinEDA_SchematicFrame::LoadOneSheet(DrawSheetStruct* sheet, const wxString& filename )
/******************************************************************************************/
//{
// return FALSE;
//when is this used? and why?
/*
//this must be called with a non-null pointer screen pointer, clearly.
//also note that this is for reading in a *root* file
// return FALSE;
//when is this used? and why?
/*
//this must be called with a non-null pointer screen pointer, clearly.
//also note that this is for reading in a *root* file
wxString FullFileName = filename;
if( FullFileName.IsEmpty() )
...
...
@@ -65,7 +65,7 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
mask = wxT( "*" ) + g_SchExtBuffer;
FullFileName = EDA_FileSelector( _( "Schematic files:" ),
wxEmptyString, //default path
sheet->m_AssociatedScreen->m_FileName,// default filename
sheet->m_AssociatedScreen->m_FileName,// default filename
g_SchExtBuffer, // extension par defaut
mask, // Masque d'affichage
this,
...
...
@@ -77,180 +77,180 @@ void WinEDA_SchematicFrame::Save_File( wxCommandEvent& event )
}
ClearProjectDrawList( screen, TRUE );
printf("in LoadOneScreen setting screen filename: %s \n", (const char*) FullFileName.mb_str() );
printf("in LoadOneScreen setting screen filename: %s \n", (const char*) FullFileName.mb_str() );
screen->m_FileName = FullFileName;
LoadDrawSheet( DrawSheetStruct * sheet, filename);
LoadDrawSheet( DrawSheetStruct * sheet, filename);
screen->SetModify();
if( GetScreen() == screen )
Refresh( TRUE );
return TRUE;
*/
*/
//}
/************************************************************************************/
int
WinEDA_SchematicFrame
::
LoadOneEEProject
(
const
wxString
&
FileName
,
bool
IsNew
)
/************************************************************************************/
{
/*
* Load an entire project
* ( schematic root file and its subhierarchies, the configuration and the libs
* which are not already loaded)
*/
SCH_SCREEN
*
screen
;
wxString
FullFileName
,
msg
;
bool
LibCacheExist
=
FALSE
;
EDA_ScreenList
ScreenList
;
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
{
if
(
screen
->
IsModify
()
)
break
;
}
if
(
screen
)
{
if
(
!
IsOK
(
this
,
_
(
"Clear Schematic Hierarchy (modified!)?"
)
)
)
return
FALSE
;
if
(
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
!=
g_DefaultSchematicFileName
)
SetLastProject
(
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
);
}
FullFileName
=
FileName
;
if
(
(
FullFileName
.
IsEmpty
()
)
&&
!
IsNew
)
{
wxString
mask
=
wxT
(
"*"
)
+
g_SchExtBuffer
;
FullFileName
=
EDA_FileSelector
(
_
(
"Schematic files:"
),
wxEmptyString
,
/* Chemin par defaut */
wxEmptyString
,
/* nom fichier par defaut */
g_SchExtBuffer
,
/* extension par defaut */
mask
,
/* Masque d'affichage */
this
,
wxFD_OPEN
,
TRUE
);
if
(
FullFileName
.
IsEmpty
()
)
return
FALSE
;
}
if
(
g_RootSheet
){
SAFE_DELETE
(
g_RootSheet
);
}
CreateScreens
();
screen
=
(
SCH_SCREEN
*
)
GetScreen
();
wxSetWorkingDirectory
(
wxPathOnly
(
FullFileName
)
);
GetScreen
()
->
m_FileName
=
FullFileName
;
g_RootSheet
->
SetFileName
(
FullFileName
);
Affiche_Message
(
wxEmptyString
);
MsgPanel
->
EraseMsgBox
();
memset
(
&
g_EESchemaVar
,
0
,
sizeof
(
g_EESchemaVar
)
);
GetScreen
()
->
ClrModify
();
//m_CurrentSheet->m_AssociatedScreen->Pnext = NULL; should be by default
if
(
IsNew
)
{
screen
->
m_CurrentSheetDesc
=
&
g_Sheet_A4
;
screen
->
SetZoom
(
32
);
screen
->
m_ScreenNumber
=
screen
->
m_NumberOfScreen
=
1
;
screen
->
m_Title
=
wxT
(
"noname.sch"
);
GetScreen
()
->
m_FileName
=
screen
->
m_Title
;
screen
->
m_Company
.
Empty
();
screen
->
m_Commentaire1
.
Empty
();
screen
->
m_Commentaire2
.
Empty
();
screen
->
m_Commentaire3
.
Empty
();
screen
->
m_Commentaire4
.
Empty
();
Read_Config
(
wxEmptyString
,
TRUE
);
Zoom_Automatique
(
TRUE
);
ReDrawPanel
();
return
1
;
}
/*
* Load an entire project
* ( schematic root file and its subhierarchies, the configuration and the libs
* which are not already loaded)
*/
SCH_SCREEN
*
screen
;
wxString
FullFileName
,
msg
;
bool
LibCacheExist
=
FALSE
;
EDA_ScreenList
ScreenList
;
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
{
if
(
screen
->
IsModify
()
)
break
;
}
if
(
screen
)
{
if
(
!
IsOK
(
this
,
_
(
"Clear Schematic Hierarchy (modified!)?"
)
)
)
return
FALSE
;
if
(
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
!=
g_DefaultSchematicFileName
)
SetLastProject
(
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
);
}
FullFileName
=
FileName
;
if
(
(
FullFileName
.
IsEmpty
()
)
&&
!
IsNew
)
{
wxString
mask
=
wxT
(
"*"
)
+
g_SchExtBuffer
;
FullFileName
=
EDA_FileSelector
(
_
(
"Schematic files:"
),
wxEmptyString
,
/* Chemin par defaut */
wxEmptyString
,
/* nom fichier par defaut */
g_SchExtBuffer
,
/* extension par defaut */
mask
,
/* Masque d'affichage */
this
,
wxFD_OPEN
,
TRUE
);
if
(
FullFileName
.
IsEmpty
()
)
return
FALSE
;
}
if
(
g_RootSheet
){
SAFE_DELETE
(
g_RootSheet
);
}
CreateScreens
();
screen
=
(
SCH_SCREEN
*
)
GetScreen
();
wxSetWorkingDirectory
(
wxPathOnly
(
FullFileName
)
);
GetScreen
()
->
m_FileName
=
FullFileName
;
g_RootSheet
->
SetFileName
(
FullFileName
);
Affiche_Message
(
wxEmptyString
);
MsgPanel
->
EraseMsgBox
();
memset
(
&
g_EESchemaVar
,
0
,
sizeof
(
g_EESchemaVar
)
);
GetScreen
()
->
ClrModify
();
//m_CurrentSheet->m_AssociatedScreen->Pnext = NULL; should be by default
if
(
IsNew
)
{
screen
->
m_CurrentSheetDesc
=
&
g_Sheet_A4
;
screen
->
SetZoom
(
32
);
screen
->
m_ScreenNumber
=
screen
->
m_NumberOfScreen
=
1
;
screen
->
m_Title
=
wxT
(
"noname.sch"
);
GetScreen
()
->
m_FileName
=
screen
->
m_Title
;
screen
->
m_Company
.
Empty
();
screen
->
m_Commentaire1
.
Empty
();
screen
->
m_Commentaire2
.
Empty
();
screen
->
m_Commentaire3
.
Empty
();
screen
->
m_Commentaire4
.
Empty
();
Read_Config
(
wxEmptyString
,
TRUE
);
Zoom_Automatique
(
TRUE
);
ReDrawPanel
();
return
1
;
}
// Rechargement de la configuration:
msg
=
_
(
"Ready
\n
Working dir:
\n
"
)
+
wxGetCwd
();
PrintMsg
(
msg
);
msg
=
_
(
"Ready
\n
Working dir:
\n
"
)
+
wxGetCwd
();
PrintMsg
(
msg
);
Read_Config
(
wxEmptyString
,
FALSE
);
Read_Config
(
wxEmptyString
,
FALSE
);
// Delete old caches.
LibraryStruct
*
nextlib
,
*
lib
=
g_LibraryList
;
for
(
;
lib
!=
NULL
;
lib
=
nextlib
)
{
nextlib
=
lib
->
m_Pnext
;
if
(
lib
->
m_IsLibCache
)
FreeCmpLibrary
(
this
,
lib
->
m_Name
);
}
if
(
IsNew
)
{
ReDrawPanel
();
return
1
;
}
LibraryStruct
*
nextlib
,
*
lib
=
g_LibraryList
;
for
(
;
lib
!=
NULL
;
lib
=
nextlib
)
{
nextlib
=
lib
->
m_Pnext
;
if
(
lib
->
m_IsLibCache
)
FreeCmpLibrary
(
this
,
lib
->
m_Name
);
}
if
(
IsNew
)
{
ReDrawPanel
();
return
1
;
}
// Loading the project library cache
wxString
FullLibName
;
wxString
shortfilename
;
wxSplitPath
(
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
,
NULL
,
&
shortfilename
,
NULL
);
FullLibName
<<
wxT
(
"."
)
<<
STRING_DIR_SEP
<<
shortfilename
<<
wxT
(
".cache"
)
<<
g_LibExtBuffer
;
if
(
wxFileExists
(
FullLibName
)
)
{
wxString
libname
;
libname
=
FullLibName
;
ChangeFileNameExt
(
libname
,
wxEmptyString
);
msg
=
wxT
(
"Load "
)
+
FullLibName
;
LibraryStruct
*
LibCache
=
LoadLibraryName
(
this
,
FullLibName
,
libname
);
if
(
LibCache
)
{
LibCache
->
m_IsLibCache
=
TRUE
;
msg
+=
wxT
(
" OK"
);
}
else
msg
+=
wxT
(
" ->Error"
);
PrintMsg
(
msg
);
LibCacheExist
=
TRUE
;
}
if
(
!
wxFileExists
(
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
)
&&
!
LibCacheExist
)
// Nouveau projet prpbablement
{
msg
.
Printf
(
_
(
"File %s not found (new project ?)"
),
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
.
GetData
()
);
DisplayInfo
(
this
,
msg
,
20
);
return
-
1
;
}
//load the project.
SAFE_DELETE
(
g_RootSheet
->
m_AssociatedScreen
);
bool
diag
=
g_RootSheet
->
Load
(
this
);
/* Reaffichage ecran de base (ROOT) si necessaire */
ActiveScreen
=
GetScreen
();
Zoom_Automatique
(
FALSE
);
DrawPanel
->
Refresh
(
TRUE
);
return
diag
;
wxString
FullLibName
;
wxString
shortfilename
;
wxSplitPath
(
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
,
NULL
,
&
shortfilename
,
NULL
);
FullLibName
<<
wxT
(
"."
)
<<
STRING_DIR_SEP
<<
shortfilename
<<
wxT
(
".cache"
)
<<
g_LibExtBuffer
;
if
(
wxFileExists
(
FullLibName
)
)
{
wxString
libname
;
libname
=
FullLibName
;
ChangeFileNameExt
(
libname
,
wxEmptyString
);
msg
=
wxT
(
"Load "
)
+
FullLibName
;
LibraryStruct
*
LibCache
=
LoadLibraryName
(
this
,
FullLibName
,
libname
);
if
(
LibCache
)
{
LibCache
->
m_IsLibCache
=
TRUE
;
msg
+=
wxT
(
" OK"
);
}
else
msg
+=
wxT
(
" ->Error"
);
PrintMsg
(
msg
);
LibCacheExist
=
TRUE
;
}
if
(
!
wxFileExists
(
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
)
&&
!
LibCacheExist
)
// Nouveau projet prpbablement
{
msg
.
Printf
(
_
(
"File %s not found (new project ?)"
),
g_RootSheet
->
m_AssociatedScreen
->
m_FileName
.
GetData
()
);
DisplayInfo
(
this
,
msg
,
20
);
return
-
1
;
}
//load the project.
SAFE_DELETE
(
g_RootSheet
->
m_AssociatedScreen
);
bool
diag
=
g_RootSheet
->
Load
(
this
);
/* Reaffichage ecran de base (ROOT) si necessaire */
ActiveScreen
=
GetScreen
();
Zoom_Automatique
(
FALSE
);
DrawPanel
->
Refresh
(
TRUE
);
return
diag
;
}
/**********************************************************/
SCH_SCREEN
*
WinEDA_SchematicFrame
::
CreateNewScreen
(
SCH_SCREEN
*
OldScreen
,
int
TimeStamp
)
SCH_SCREEN
*
OldScreen
,
int
TimeStamp
)
/**********************************************************/
/* Routine de creation ( par allocation memoire ) d'un nouvel ecran
cet ecran est en chainage arriere avec OldScreen
la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp
cet ecran est en chainage arriere avec OldScreen
la valeur TimeStamp est attribuee au parametre NewScreen->TimeStamp
*/
{
SCH_SCREEN
*
NewScreen
;
SCH_SCREEN
*
NewScreen
;
NewScreen
=
new
SCH_SCREEN
(
SCHEMATIC_FRAME
);
NewScreen
=
new
SCH_SCREEN
(
SCHEMATIC_FRAME
);
NewScreen
->
SetRefreshReq
();
if
(
OldScreen
)
NewScreen
->
m_Company
=
OldScreen
->
m_Company
;
NewScreen
->
m_TimeStamp
=
TimeStamp
;
NewScreen
->
SetRefreshReq
();
if
(
OldScreen
)
NewScreen
->
m_Company
=
OldScreen
->
m_Company
;
NewScreen
->
m_TimeStamp
=
TimeStamp
;
NewScreen
->
Pback
=
OldScreen
;
NewScreen
->
Pback
=
OldScreen
;
return
(
NewScreen
);
return
(
NewScreen
);
}
/****************************************************/
...
...
@@ -267,16 +267,16 @@ void WinEDA_SchematicFrame::SaveProject( )
EDA_ScreenList
ScreenList
;
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
screen
=
ScreenList
.
GetNext
()
)
{
printf
(
"SaveEEFile, %s
\n
"
,
CONV_TO_UTF8
(
screen
->
m_FileName
)
);
printf
(
"SaveEEFile, %s
\n
"
,
CONV_TO_UTF8
(
screen
->
m_FileName
)
);
SaveEEFile
(
screen
,
FILE_SAVE_AS
);
}
/* Creation du fichier d'archivage composants en repertoire courant */
LibArchiveFileName
=
MakeFileName
(
wxEmptyString
,
GetScreen
()
->
m_FileName
,
wxEmptyString
);
ChangeFileNameExt
(
LibArchiveFileName
,
wxEmptyString
);
/* mise a jour extension */
LibArchiveFileName
+=
wxT
(
".cache"
)
+
g_LibExtBuffer
;
LibArchive
(
this
,
LibArchiveFileName
);
...
...
@@ -290,20 +290,20 @@ int CountCmpNumber()
/* Routine retournant le nombre de composants dans le schema,
* powers non comprises */
{
return
g_RootSheet
->
ComponentCount
();
/*
return
g_RootSheet
->
ComponentCount
();
/*
BASE_SCREEN* Window;
EDA_BaseStruct* Phead;
int Nb = 0;
Window = ScreenSch;
while( Window )
{
for( Phead = Window->EEDrawList; Phead != NULL; Phead = Phead->Pnext )
{
if( Phead->Type() ==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if( Phead->Type() ==
TYPE_SCH_COMPONENT
)
{
DrawPartStruct* Cmp = (DrawPartStruct*) Phead;
if( Cmp->m_Field[VALUE].m_Text.GetChar( 0 ) != '#' )
...
...
@@ -315,5 +315,5 @@ int CountCmpNumber()
}
return Nb;
*/
*/
}
eeschema/find.cpp
View file @
c406eed1
...
...
@@ -72,7 +72,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
{
DrawSheetPath
*
sheet
,
*
SheetWithComponentFound
=
NULL
;
EDA_BaseStruct
*
DrawList
=
NULL
;
EDA_SchComponentStruct
*
Component
=
NULL
;
SCH_COMPONENT
*
Component
=
NULL
;
wxSize
DrawAreaSize
=
DrawPanel
->
GetClientSize
();
wxPoint
pos
,
curpos
;
bool
DoCenterAndRedraw
=
FALSE
;
...
...
@@ -91,10 +91,10 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
DrawList
=
sheet
->
LastDrawList
();
for
(
;
(
DrawList
!=
NULL
)
&&
(
NotFound
==
true
);
DrawList
=
DrawList
->
Pnext
)
{
if
(
DrawList
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
DrawList
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
EDA_SchComponentStruct
*
pSch
;
pSch
=
(
EDA_SchComponentStruct
*
)
DrawList
;
SCH_COMPONENT
*
pSch
;
pSch
=
(
SCH_COMPONENT
*
)
DrawList
;
if
(
component_reference
.
CmpNoCase
(
pSch
->
GetRef
(
sheet
)
)
==
0
)
{
Component
=
pSch
;
...
...
@@ -465,9 +465,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
{
switch
(
DrawList
->
Type
()
)
{
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
EDA_SchComponentStruct
*
pSch
;
pSch
=
(
EDA_SchComponentStruct
*
)
DrawList
;
case
TYPE_SCH_COMPONENT
:
SCH_COMPONENT
*
pSch
;
pSch
=
(
SCH_COMPONENT
*
)
DrawList
;
if
(
WildCompareString
(
WildText
,
pSch
->
GetRef
(
Sheet
),
FALSE
)
)
{
NotFound
=
FALSE
;
...
...
@@ -481,12 +481,12 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
}
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
DrawTextStruct
*
pDraw
;
pDraw
=
(
DrawTextStruct
*
)
DrawList
;
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_TEXT
:
SCH_TEXT
*
pDraw
;
pDraw
=
(
SCH_TEXT
*
)
DrawList
;
if
(
WildCompareString
(
WildText
,
pDraw
->
m_Text
,
FALSE
)
)
{
NotFound
=
FALSE
;
...
...
@@ -551,12 +551,12 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
DoCenterAndRedraw
=
TRUE
;
}
/* the struct is a
DRAW_LIB_ITEM_STRUCT_TYPE
type,
/* the struct is a
TYPE_SCH_COMPONENT
type,
* coordinates must be computed according to its orientation matrix
*/
if
(
Struct
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
Struct
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
EDA_SchComponentStruct
*
pSch
=
(
EDA_SchComponentStruct
*
)
Struct
;
SCH_COMPONENT
*
pSch
=
(
SCH_COMPONENT
*
)
Struct
;
pos
.
x
-=
pSch
->
m_Pos
.
x
;
pos
.
y
-=
pSch
->
m_Pos
.
y
;
...
...
eeschema/getpart.cpp
View file @
c406eed1
...
...
@@ -59,7 +59,7 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
/**************************************************************************/
EDA_SchComponentStruct
*
WinEDA_SchematicFrame
::
Load_Component
(
wxDC
*
DC
,
SCH_COMPONENT
*
WinEDA_SchematicFrame
::
Load_Component
(
wxDC
*
DC
,
const
wxString
&
libname
,
wxArrayString
&
HistoryList
,
bool
UseLibBrowser
)
...
...
@@ -73,7 +73,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
int
ii
,
CmpCount
=
0
;
LibDrawField
*
Field
;
EDA_LibComponentStruct
*
Entry
=
NULL
;
EDA_SchComponentStruct
*
DrawLibItem
=
NULL
;
SCH_COMPONENT
*
DrawLibItem
=
NULL
;
LibraryStruct
*
Library
=
NULL
;
wxString
Name
,
keys
,
msg
;
bool
AllowWildSeach
=
TRUE
;
...
...
@@ -180,7 +180,7 @@ EDA_SchComponentStruct* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawPanel
->
ManageCurseur
=
ShowWhileMoving
;
DrawPanel
->
ForceCloseManageCurseur
=
ExitPlaceCmp
;
DrawLibItem
=
new
EDA_SchComponentStruct
(
GetScreen
()
->
m_Curseur
);
DrawLibItem
=
new
SCH_COMPONENT
(
GetScreen
()
->
m_Curseur
);
DrawLibItem
->
m_Multi
=
1
;
/* Selection de l'unite 1 dans le boitier */
DrawLibItem
->
m_Convert
=
1
;
DrawLibItem
->
m_ChipName
=
Name
;
...
...
@@ -257,7 +257,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
wxPoint
move_vector
;
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
panel
->
m_Parent
->
GetScreen
()
->
GetCurItem
();
/* Effacement du composant */
...
...
@@ -276,7 +276,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
/**************************************************************************/
void
WinEDA_SchematicFrame
::
CmpRotationMiroir
(
EDA_SchComponentStruct
*
DrawComponent
,
wxDC
*
DC
,
int
type_rotate
)
SCH_COMPONENT
*
DrawComponent
,
wxDC
*
DC
,
int
type_rotate
)
/**************************************************************************/
/* Routine permettant les rotations et les miroirs d'un composant
...
...
@@ -293,7 +293,9 @@ void WinEDA_SchematicFrame::CmpRotationMiroir(
if
(
DrawComponent
->
m_Flags
)
DrawStructsInGhost
(
DrawPanel
,
DC
,
DrawComponent
,
0
,
0
);
else
DrawComponent
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
);
{
DrawPanel
->
PostDirtyRect
(
DrawComponent
->
GetBoundingBox
());
}
}
DrawComponent
->
SetRotationMiroir
(
type_rotate
);
...
...
@@ -320,7 +322,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
/* Routine de sortie de la fonction de placement de composant
*/
{
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
Panel
->
m_Parent
->
GetScreen
()
->
GetCurItem
();
if
(
DrawLibItem
->
m_Flags
&
IS_NEW
)
/* Nouveau Placement en cours, on l'efface */
...
...
@@ -352,7 +354,7 @@ static void ExitPlaceCmp( WinEDA_DrawPanel* Panel, wxDC* DC )
/************************************************************************/
void
WinEDA_SchematicFrame
::
SelPartUnit
(
EDA_SchComponentStruct
*
DrawComponent
,
void
WinEDA_SchematicFrame
::
SelPartUnit
(
SCH_COMPONENT
*
DrawComponent
,
int
unit
,
wxDC
*
DC
)
/************************************************************************/
/* Selection de l'unite dans les boitiers a multiples Parts */
...
...
@@ -400,7 +402,7 @@ void WinEDA_SchematicFrame::SelPartUnit( EDA_SchComponentStruct* DrawComponent,
/************************************************************************/
void
WinEDA_SchematicFrame
::
ConvertPart
(
EDA_SchComponentStruct
*
DrawComponent
,
void
WinEDA_SchematicFrame
::
ConvertPart
(
SCH_COMPONENT
*
DrawComponent
,
wxDC
*
DC
)
/************************************************************************/
{
...
...
@@ -469,13 +471,13 @@ int LookForConvertPart( EDA_LibComponentStruct* LibEntry )
/***********************************************************************************/
void
WinEDA_SchematicFrame
::
StartMovePart
(
EDA_SchComponentStruct
*
Component
,
void
WinEDA_SchematicFrame
::
StartMovePart
(
SCH_COMPONENT
*
Component
,
wxDC
*
DC
)
/***********************************************************************************/
{
if
(
Component
==
NULL
)
return
;
if
(
Component
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
Component
->
Type
()
!=
TYPE_SCH_COMPONENT
)
return
;
if
(
Component
->
m_Flags
==
0
)
...
...
eeschema/hotkeys.cpp
View file @
c406eed1
...
...
@@ -98,7 +98,7 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = {
&
HkDelete
,
&
HkInsert
,
&
HkMove2Drag
,
&
HkMoveComponent
,
&
HkDragComponent
,
&
HkAddComponent
,
&
HkRotateComponent
,
&
HkMirrorXComponent
,
&
HkMirrorYComponent
,
&
HkOrientNormalComponent
,
&
HkEditComponentValue
,
&
HkEditComponentFootprint
,
&
HkEditComponentValue
,
&
HkEditComponentFootprint
,
&
HkBeginWire
,
NULL
};
...
...
@@ -107,9 +107,9 @@ Ki_HotkeyInfo* s_Schematic_Hotkey_List[] = {
Ki_HotkeyInfo
*
s_LibEdit_Hotkey_List
[]
=
{
&
HkInsertPin
,
&
HkEditPin
,
&
HkMovePin
,
&
HkDeletePin
,
&
HkEditPin
,
&
HkMovePin
,
&
HkDeletePin
,
NULL
};
...
...
@@ -148,13 +148,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
*/
{
bool
ItemInEdit
=
GetScreen
()
->
GetCurItem
()
&&
GetScreen
()
->
GetCurItem
()
->
m_Flags
;
&&
GetScreen
()
->
GetCurItem
()
->
m_Flags
;
bool
RefreshToolBar
=
FALSE
;
// We must refresh tool bar when the undo/redo tool state is modified
if
(
hotkey
==
0
)
return
;
wxPoint
MousePos
=
GetScreen
()
->
m_MousePosition
;
wxPoint
MousePos
=
GetScreen
()
->
m_MousePosition
;
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
if
(
(
hotkey
&
GR_KB_CTRL
)
!=
0
)
...
...
@@ -169,7 +169,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
HK_Descr
=
GetDescriptorFromHotkey
(
hotkey
,
s_Schematic_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
return
;
switch
(
HK_Descr
->
m_Idcommand
)
switch
(
HK_Descr
->
m_Idcommand
)
{
default
:
case
HK_NOT_FOUND
:
...
...
@@ -181,7 +181,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break
;
case
HK_RESET_LOCAL_COORD
:
/* Reset the relative coord */
GetScreen
()
->
m_O_Curseur
=
GetScreen
()
->
m_Curseur
;
GetScreen
()
->
m_O_Curseur
=
GetScreen
()
->
m_Curseur
;
break
;
case
HK_ZOOM_IN
:
...
...
@@ -219,9 +219,9 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if
(
ItemInEdit
)
break
;
RefreshToolBar
=
LocateAndDeleteItem
(
this
,
DC
);
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetCurItem
(
NULL
);
TestDanglingEnds
(
GetScreen
()
->
EEDrawList
,
DC
);
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetCurItem
(
NULL
);
TestDanglingEnds
(
GetScreen
()
->
EEDrawList
,
DC
);
break
;
case
HK_REPEAT_LAST
:
...
...
@@ -281,7 +281,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
GetScreen
(),
LIBITEM
|
TEXTITEM
|
LABELITEM
);
if
(
DrawStruct
==
NULL
)
break
;
if
(
DrawStruct
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
DrawStruct
->
Type
()
==
TYPE_SCH_COMPONENT
)
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
DrawStruct
==
NULL
)
break
;
...
...
@@ -289,7 +289,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
switch
(
DrawStruct
->
Type
()
)
{
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
if
(
DrawStruct
->
m_Flags
==
0
)
{
SaveCopyInUndoList
(
DrawStruct
,
IS_CHANGED
);
...
...
@@ -297,19 +297,19 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
}
CmpRotationMiroir
(
(
EDA_SchComponentStruct
*
)
DrawStruct
,
DC
,
CMP_ROTATE_COUNTERCLOCKWISE
);
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
,
CMP_ROTATE_COUNTERCLOCKWISE
);
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
if
(
DrawStruct
->
m_Flags
==
0
)
{
SaveCopyInUndoList
(
DrawStruct
,
IS_CHANGED
);
RefreshToolBar
=
TRUE
;
}
ChangeTextOrient
(
(
DrawTextStruct
*
)
DrawStruct
,
DC
);
ChangeTextOrient
(
(
SCH_TEXT
*
)
DrawStruct
,
DC
);
break
;
default
:
...
...
@@ -320,7 +320,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case
HK_MIRROR_Y_COMPONENT
:
// Mirror Y (Component)
if
(
DrawStruct
==
NULL
)
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
DrawStruct
)
{
if
(
DrawStruct
->
m_Flags
==
0
)
...
...
@@ -329,13 +329,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
RefreshToolBar
=
TRUE
;
}
CmpRotationMiroir
(
(
EDA_SchComponentStruct
*
)
DrawStruct
,
DC
,
CMP_MIROIR_Y
);
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
,
CMP_MIROIR_Y
);
}
break
;
case
HK_MIRROR_X_COMPONENT
:
// Mirror X (Component)
if
(
DrawStruct
==
NULL
)
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
DrawStruct
)
{
if
(
DrawStruct
->
m_Flags
==
0
)
...
...
@@ -344,13 +344,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
RefreshToolBar
=
TRUE
;
}
CmpRotationMiroir
(
(
EDA_SchComponentStruct
*
)
DrawStruct
,
DC
,
CMP_MIROIR_X
);
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
,
CMP_MIROIR_X
);
}
break
;
case
HK_ORIENT_NORMAL_COMPONENT
:
// Orient 0, no mirror (Component)
if
(
DrawStruct
==
NULL
)
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
DrawStruct
)
{
if
(
DrawStruct
->
m_Flags
==
0
)
...
...
@@ -359,8 +359,8 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
RefreshToolBar
=
TRUE
;
}
CmpRotationMiroir
(
(
EDA_SchComponentStruct
*
)
DrawStruct
,
DC
,
CMP_NORMAL
);
TestDanglingEnds
(
(
SCH_SCREEN
*
)
GetScreen
()
->
EEDrawList
,
DC
);
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
,
CMP_NORMAL
);
TestDanglingEnds
(
(
SCH_SCREEN
*
)
GetScreen
()
->
EEDrawList
,
DC
);
}
break
;
...
...
@@ -369,37 +369,37 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if
(
ItemInEdit
)
break
;
if
(
DrawStruct
==
NULL
)
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
DrawStruct
&&
(
DrawStruct
->
m_Flags
==
0
)
)
{
((
SCH_SCREEN
*
)
GetScreen
())
->
SetCurItem
(
DrawStruct
);
wxCommandEvent
event
(
wxEVT_COMMAND_TOOL_CLICKED
,
HK_Descr
->
m_IdMenuEvent
);
((
SCH_SCREEN
*
)
GetScreen
())
->
SetCurItem
(
DrawStruct
);
wxCommandEvent
event
(
wxEVT_COMMAND_TOOL_CLICKED
,
HK_Descr
->
m_IdMenuEvent
);
wxPostEvent
(
this
,
event
);
wxPostEvent
(
this
,
event
);
}
break
;
case
HK_EDIT_COMPONENT_VALUE
:
if
(
ItemInEdit
)
case
HK_EDIT_COMPONENT_VALUE
:
if
(
ItemInEdit
)
break
;
if
(
DrawStruct
==
NULL
)
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
DrawStruct
)
{
EditComponentValue
(
(
EDA_SchComponentStruct
*
)
DrawStruct
,
DC
);
}
break
;
case
HK_EDIT_COMPONENT_FOOTPRINT
:
if
(
ItemInEdit
)
if
(
DrawStruct
==
NULL
)
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
DrawStruct
)
{
EditComponentValue
(
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
);
}
break
;
case
HK_EDIT_COMPONENT_FOOTPRINT
:
if
(
ItemInEdit
)
break
;
if
(
DrawStruct
==
NULL
)
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
DrawStruct
)
{
EditComponentFootprint
(
(
EDA_SchComponentStruct
*
)
DrawStruct
,
DC
);
}
if
(
DrawStruct
==
NULL
)
DrawStruct
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
DrawStruct
)
{
EditComponentFootprint
(
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
);
}
break
;
}
...
...
@@ -417,16 +417,16 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
* Commands are case insensitive
*/
{
bool
ItemInEdit
=
GetScreen
()
->
GetCurItem
()
&&
GetScreen
()
->
GetCurItem
()
->
m_Flags
;
bool
ItemInEdit
=
GetScreen
()
->
GetCurItem
()
&&
GetScreen
()
->
GetCurItem
()
->
m_Flags
;
bool
RefreshToolBar
=
FALSE
;
// We must refresh tool bar when the undo/redo tool state is modified
if
(
hotkey
==
0
)
return
;
wxPoint
MousePos
=
GetScreen
()
->
m_MousePosition
;
LibEDA_BaseStruct
*
DrawEntry
=
LocateItemUsingCursor
();
wxPoint
MousePos
=
GetScreen
()
->
m_MousePosition
;
LibEDA_BaseStruct
*
DrawEntry
=
LocateItemUsingCursor
();
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to handle...)
if
(
(
hotkey
&
GR_KB_CTRL
)
!=
0
)
...
...
@@ -451,7 +451,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
break
;
case
HK_RESET_LOCAL_COORD
:
/* Reset the relative coord */
GetScreen
()
->
m_O_Curseur
=
GetScreen
()
->
m_Curseur
;
GetScreen
()
->
m_O_Curseur
=
GetScreen
()
->
m_Curseur
;
break
;
case
HK_ZOOM_IN
:
...
...
@@ -490,36 +490,36 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
else
wxBell
();
break
;
case
HK_EDIT_PIN
:
if
(
DrawEntry
)
CurrentDrawItem
=
DrawEntry
;
if
(
CurrentDrawItem
)
{
if
(
CurrentDrawItem
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
)
InstallPineditFrame
(
this
,
DC
,
MousePos
);
}
break
;
case
HK_DELETE_PIN
:
if
(
DrawEntry
)
CurrentDrawItem
=
DrawEntry
;
if
(
CurrentDrawItem
)
{
wxCommandEvent
evt
;
evt
.
SetId
(
ID_POPUP_LIBEDIT_DELETE_ITEM
);
Process_Special_Functions
(
evt
);
}
break
;
case
HK_MOVE_PIN
:
if
(
DrawEntry
)
CurrentDrawItem
=
DrawEntry
;
if
(
CurrentDrawItem
)
{
wxCommandEvent
evt
;
evt
.
SetId
(
ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST
);
Process_Special_Functions
(
evt
);
}
break
;
}
case
HK_EDIT_PIN
:
if
(
DrawEntry
)
CurrentDrawItem
=
DrawEntry
;
if
(
CurrentDrawItem
)
{
if
(
CurrentDrawItem
->
Type
()
==
COMPONENT_PIN_DRAW_TYPE
)
InstallPineditFrame
(
this
,
DC
,
MousePos
);
}
break
;
case
HK_DELETE_PIN
:
if
(
DrawEntry
)
CurrentDrawItem
=
DrawEntry
;
if
(
CurrentDrawItem
)
{
wxCommandEvent
evt
;
evt
.
SetId
(
ID_POPUP_LIBEDIT_DELETE_ITEM
);
Process_Special_Functions
(
evt
);
}
break
;
case
HK_MOVE_PIN
:
if
(
DrawEntry
)
CurrentDrawItem
=
DrawEntry
;
if
(
CurrentDrawItem
)
{
wxCommandEvent
evt
;
evt
.
SetId
(
ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST
);
Process_Special_Functions
(
evt
);
}
break
;
}
if
(
RefreshToolBar
)
SetToolbars
();
}
eeschema/load_one_schematic_file.cpp
View file @
c406eed1
...
...
@@ -21,27 +21,27 @@
* EESchema Schematic File Version n
* - liste des librairies utilisees
* LIBS:lib1,lib2,...
*
*
* - description des elements:
* - ici Dimensions du schema, cartouche..:
* $Descr A3 xx yy (format A3 (A..A0 / A..E / "user") xx yy = dims internes )
* $EndDescr
*
*
* - ici: polyline
* P L 0 3
* 2208 1008
* 2208 1136
* 2128 1136
*
*
* - ici: Segment (wire, bus) ( 1; W = segment type Wire, 2: W = Wire B = Bus
* 3: L ou B = epaisseur ( L = ligne, B = bus)
* W W L (W B B si bus)
* 1856 1008 1856 1136 (debut X,Y fin X,Y)
*
*
* - ici: Raccord (wire, bus)
* R W L
* 1856 1008 1856 1136 (debut X,Y fin X,Y)
*
*
* - ici: Sheet ( Sous-feuille de hierarchie)
* $Sheet
* S 1856 1008 1856 1136 (debut X,Y fin X,Y)
...
...
@@ -49,7 +49,7 @@
* F1 "texte" X X posx posy ; filename
* Fn "label" type side posx posy size ; n lignes de label
* $EndSheet
*
*
* - ici: composant
* $Comp
* L CAPACITOR C1 H H -30863 -14794 1968 1184 nom, ref, dir et pos
...
...
@@ -98,7 +98,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
return
FALSE
;
screen
->
SetCurItem
(
NULL
);
screen
->
m_FileName
=
FullFileName
;
screen
->
m_FileName
=
FullFileName
;
LineCount
=
1
;
if
(
(
f
=
wxFopen
(
FullFileName
,
wxT
(
"rt"
)
)
)
==
NULL
)
...
...
@@ -108,7 +108,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
return
FALSE
;
}
MsgDiag
=
_
(
"Loading "
)
+
screen
->
m_FileName
;
MsgDiag
=
_
(
"Loading "
)
+
screen
->
m_FileName
;
PrintMsg
(
MsgDiag
);
if
(
fgets
(
Line
,
1024
-
1
,
f
)
==
NULL
...
...
@@ -120,8 +120,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
fclose
(
f
);
return
FALSE
;
}
//get the file version here.
char
version
=
Line
[
9
+
sizeof
(
SCHEMATIC_HEAD_STRING
)];
//get the file version here.
char
version
=
Line
[
9
+
sizeof
(
SCHEMATIC_HEAD_STRING
)];
LineCount
++
;
if
(
fgets
(
Line
,
1024
-
1
,
f
)
==
NULL
||
strncmp
(
Line
,
"LIBS:"
,
5
)
!=
0
)
{
...
...
@@ -188,7 +188,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT
(
"EESchema file Segment struct error at line %d, aborted"
),
LineCount
);
Failed
=
TRUE
;
SAFE_DELETE
(
SegmentStruct
)
;
SAFE_DELETE
(
SegmentStruct
)
;
break
;
}
...
...
@@ -224,7 +224,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT
(
"EESchema file Raccord struct error at line %d, aborted"
),
LineCount
);
Failed
=
TRUE
;
SAFE_DELETE
(
RaccordStruct
)
;
SAFE_DELETE
(
RaccordStruct
)
;
break
;
}
...
...
@@ -268,7 +268,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT
(
"EESchema file polyline struct error at line %d, aborted"
),
LineCount
);
Failed
=
TRUE
;
SAFE_DELETE
(
PolylineStruct
)
;
SAFE_DELETE
(
PolylineStruct
)
;
break
;
}
}
...
...
@@ -290,7 +290,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
wxT
(
"EESchema file connection struct error at line %d, aborted"
),
LineCount
);
Failed
=
TRUE
;
SAFE_DELETE
(
ConnectionStruct
)
;
SAFE_DELETE
(
ConnectionStruct
)
;
}
else
{
...
...
@@ -378,20 +378,20 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if
(
Name1
[
0
]
==
'L'
)
{
DrawLabelStruct
*
TextStruct
=
new
DrawLabelStruct
(
pos
,
CONV_FROM_UTF8
(
text
)
);
SCH_LABEL
*
TextStruct
=
new
SCH_LABEL
(
pos
,
CONV_FROM_UTF8
(
text
)
);
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Orient
=
orient
;
Struct
=
(
EDA_BaseStruct
*
)
TextStruct
;
}
else
if
(
Name1
[
0
]
==
'G'
&&
version
>
'1'
)
else
if
(
Name1
[
0
]
==
'G'
&&
version
>
'1'
)
{
DrawGlobalLabelStruct
*
TextStruct
=
new
DrawGlobalLabelStruct
(
pos
,
CONV_FROM_UTF8
(
text
)
);
SCH_GLOBALLABEL
*
TextStruct
=
new
SCH_GLOBALLABEL
(
pos
,
CONV_FROM_UTF8
(
text
)
);
Struct
=
(
EDA_BaseStruct
*
)
TextStruct
;
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Orient
=
orient
;
TextStruct
->
m_Shape
=
NET_INPUT
;
TextStruct
->
m_Shape
=
NET_INPUT
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_OUTPUT
]
)
==
0
)
TextStruct
->
m_Shape
=
NET_OUTPUT
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_BIDI
]
)
==
0
)
...
...
@@ -401,14 +401,14 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_UNSPECIFIED
]
)
==
0
)
TextStruct
->
m_Shape
=
NET_UNSPECIFIED
;
}
else
if
(
(
Name1
[
0
]
==
'H'
)
||
(
Name1
[
0
]
==
'G'
&&
version
==
'1'
))
{
//in schematic file version 1, glabels were actually hierarchal labels.
DrawHierLabelStruct
*
TextStruct
=
new
DrawHierLabelStruct
(
pos
,
CONV_FROM_UTF8
(
text
)
);
else
if
(
(
Name1
[
0
]
==
'H'
)
||
(
Name1
[
0
]
==
'G'
&&
version
==
'1'
))
{
//in schematic file version 1, glabels were actually hierarchal labels.
SCH_HIERLABEL
*
TextStruct
=
new
SCH_HIERLABEL
(
pos
,
CONV_FROM_UTF8
(
text
)
);
Struct
=
(
EDA_BaseStruct
*
)
TextStruct
;
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Orient
=
orient
;
TextStruct
->
m_Shape
=
NET_INPUT
;
TextStruct
->
m_Shape
=
NET_INPUT
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_OUTPUT
]
)
==
0
)
TextStruct
->
m_Shape
=
NET_OUTPUT
;
if
(
stricmp
(
Name2
,
SheetLabelType
[
NET_BIDI
]
)
==
0
)
...
...
@@ -420,8 +420,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
}
else
{
DrawTextStruct
*
TextStruct
=
new
DrawTextStruct
(
pos
,
CONV_FROM_UTF8
(
text
)
);
SCH_TEXT
*
TextStruct
=
new
SCH_TEXT
(
pos
,
CONV_FROM_UTF8
(
text
)
);
TextStruct
->
m_Size
.
x
=
TextStruct
->
m_Size
.
y
=
size
;
TextStruct
->
m_Orient
=
orient
;
Struct
=
(
EDA_BaseStruct
*
)
TextStruct
;
...
...
@@ -465,14 +465,14 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
#if 0 && defined(DEBUG)
screen->Show( 0, std::cout );
#endif
fclose
(
f
);
TestDanglingEnds
(
screen
->
EEDrawList
,
NULL
);
MsgDiag
=
_
(
"Done Loading "
)
+
screen
->
m_FileName
;
PrintMsg
(
MsgDiag
);
MsgDiag
=
_
(
"Done Loading "
)
+
screen
->
m_FileName
;
PrintMsg
(
MsgDiag
);
return
TRUE
;
/* Although it may be that file is only partially loaded. */
}
...
...
@@ -489,11 +489,11 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
int
ii
,
fieldref
;
char
Name1
[
256
],
Name2
[
256
],
Char1
[
256
],
Char2
[
256
],
Char3
[
256
];
EDA_SchComponentStruct
*
LibItemStruct
;
SCH_COMPONENT
*
LibItemStruct
;
int
Failed
=
0
,
newfmt
=
0
;
char
*
ptcar
;
LibItemStruct
=
new
EDA_SchComponentStruct
();
LibItemStruct
=
new
SCH_COMPONENT
();
LibItemStruct
->
m_Convert
=
1
;
if
(
Line
[
0
]
==
'$'
)
...
...
@@ -534,29 +534,29 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
if
(
strcmp
(
Name2
,
NULL_STRING
)
!=
0
)
{
bool
isDigit
=
false
;
bool
isDigit
=
false
;
for
(
ii
=
0
;
ii
<
(
int
)
strlen
(
Name2
);
ii
++
){
if
(
Name2
[
ii
]
==
'~'
)
Name2
[
ii
]
=
' '
;
//get RefBase from this, too. store in Name1.
if
(
Name2
[
ii
]
>=
'0'
&&
Name2
[
ii
]
<=
'9'
){
isDigit
=
true
;
Name1
[
ii
]
=
0
;
//null-terminate.
}
if
(
!
isDigit
){
Name1
[
ii
]
=
Name2
[
ii
];
}
}
Name1
[
ii
]
=
0
;
//just in case
int
jj
;
for
(
jj
=
0
;
jj
<
ii
&&
Name1
[
jj
]
==
' '
;
jj
++
);
if
(
jj
==
ii
){
//blank string.
LibItemStruct
->
m_PrefixString
=
wxT
(
"U"
);
}
else
{
LibItemStruct
->
m_PrefixString
=
CONV_FROM_UTF8
(
&
Name1
[
jj
]);
//printf("prefix: %s\n", CONV_TO_UTF8(LibItemStruct->m_PrefixString));
}
//get RefBase from this, too. store in Name1.
if
(
Name2
[
ii
]
>=
'0'
&&
Name2
[
ii
]
<=
'9'
){
isDigit
=
true
;
Name1
[
ii
]
=
0
;
//null-terminate.
}
if
(
!
isDigit
){
Name1
[
ii
]
=
Name2
[
ii
];
}
}
Name1
[
ii
]
=
0
;
//just in case
int
jj
;
for
(
jj
=
0
;
jj
<
ii
&&
Name1
[
jj
]
==
' '
;
jj
++
);
if
(
jj
==
ii
){
//blank string.
LibItemStruct
->
m_PrefixString
=
wxT
(
"U"
);
}
else
{
LibItemStruct
->
m_PrefixString
=
CONV_FROM_UTF8
(
&
Name1
[
jj
]);
//printf("prefix: %s\n", CONV_TO_UTF8(LibItemStruct->m_PrefixString));
}
if
(
!
newfmt
)
LibItemStruct
->
m_Field
[
REFERENCE
].
m_Text
=
CONV_FROM_UTF8
(
Name2
);
}
...
...
@@ -571,8 +571,8 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
* "P " = position
* "U " = Num Unit, et Conversion
* "Fn" = Champs ( n = 0.. = numero de champ )
* "Ar" = AlternateReference, in the case of multiple sheets
* referring to one schematic file.
* "Ar" = AlternateReference, in the case of multiple sheets
* referring to one schematic file.
*/
/* Lecture des champs */
...
...
@@ -583,7 +583,7 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
return
TRUE
;
if
(
(
Line
[
0
]
!=
'F'
)
&&
(
Line
[
0
]
!=
'P'
)
&&
(
Line
[
0
]
!=
'A'
)
&&
(
Line
[
0
]
!=
'A'
)
&&
(
Line
[
0
]
!=
'U'
)
)
break
;
...
...
@@ -599,32 +599,32 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
sscanf
(
Line
+
1
,
"%d %d"
,
&
LibItemStruct
->
m_Pos
.
x
,
&
LibItemStruct
->
m_Pos
.
y
);
}
if
(
Line
[
0
]
==
'A'
&&
Line
[
1
]
==
'R'
)
{
/*format:
AR Path="/9086AF6E/67452AA0" Ref="C99"
where 9086AF6E is the unique timestamp of the containing sheet
and 67452AA0 is the timestamp of this component.
C99 is the reference given this path.
*/
int
i
=
2
;
while
(
i
<
256
&&
Line
[
i
]
!=
'"'
){
i
++
;
}
i
++
;
//copy the path.
int
j
=
0
;
while
(
i
<
256
&&
Line
[
i
]
!=
'"'
){
Name1
[
j
]
=
Line
[
i
];
i
++
;
j
++
;}
i
++
;
Name1
[
j
]
=
0
;
wxString
path
=
CONV_FROM_UTF8
(
Name1
);
//i should be one after the closing quote, match the next opening quote
while
(
i
<
256
&&
Line
[
i
]
!=
'"'
){
i
++
;
}
i
++
;
j
=
0
;
while
(
i
<
256
&&
Line
[
i
]
!=
'"'
){
Name1
[
j
]
=
Line
[
i
];
i
++
;
j
++
;}
i
++
;
Name1
[
j
]
=
0
;
wxString
ref
=
CONV_FROM_UTF8
(
Name1
);
LibItemStruct
->
m_Paths
.
Add
(
path
);
LibItemStruct
->
m_References
.
Add
(
ref
);
LibItemStruct
->
m_Field
[
REFERENCE
].
m_Text
=
ref
;
}
if
(
Line
[
0
]
==
'A'
&&
Line
[
1
]
==
'R'
)
{
/*format:
AR Path="/9086AF6E/67452AA0" Ref="C99"
where 9086AF6E is the unique timestamp of the containing sheet
and 67452AA0 is the timestamp of this component.
C99 is the reference given this path.
*/
int
i
=
2
;
while
(
i
<
256
&&
Line
[
i
]
!=
'"'
){
i
++
;
}
i
++
;
//copy the path.
int
j
=
0
;
while
(
i
<
256
&&
Line
[
i
]
!=
'"'
){
Name1
[
j
]
=
Line
[
i
];
i
++
;
j
++
;}
i
++
;
Name1
[
j
]
=
0
;
wxString
path
=
CONV_FROM_UTF8
(
Name1
);
//i should be one after the closing quote, match the next opening quote
while
(
i
<
256
&&
Line
[
i
]
!=
'"'
){
i
++
;
}
i
++
;
j
=
0
;
while
(
i
<
256
&&
Line
[
i
]
!=
'"'
){
Name1
[
j
]
=
Line
[
i
];
i
++
;
j
++
;}
i
++
;
Name1
[
j
]
=
0
;
wxString
ref
=
CONV_FROM_UTF8
(
Name1
);
LibItemStruct
->
m_Paths
.
Add
(
path
);
LibItemStruct
->
m_References
.
Add
(
ref
);
LibItemStruct
->
m_Field
[
REFERENCE
].
m_Text
=
ref
;
}
if
(
Line
[
0
]
==
'F'
)
{
char
FieldUserName
[
1024
];
...
...
@@ -767,7 +767,7 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
{
LibItemStruct
->
Pnext
=
Window
->
EEDrawList
;
Window
->
EEDrawList
=
(
EDA_BaseStruct
*
)
LibItemStruct
;
LibItemStruct
->
m_Parent
=
Window
;
LibItemStruct
->
m_Parent
=
Window
;
}
return
Failed
;
/* Fin lecture 1 composant */
...
...
@@ -790,12 +790,12 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
char
*
ptcar
;
SheetStruct
=
new
DrawSheetStruct
();
SheetStruct
->
m_TimeStamp
=
GetTimeStamp
();
//sheets are added to the EEDrawList like other schematic components.
//however, in order to preserve the heirarchy (through m_Parent pointers),
//a duplicate of the sheet is added to m_SubSheet array.
//must be a duplicate, references just work for a two-layer structure.
//this is accomplished through the Sync() function.
SheetStruct
->
m_TimeStamp
=
GetTimeStamp
();
//sheets are added to the EEDrawList like other schematic components.
//however, in order to preserve the heirarchy (through m_Parent pointers),
//a duplicate of the sheet is added to m_SubSheet array.
//must be a duplicate, references just work for a two-layer structure.
//this is accomplished through the Sync() function.
if
(
Line
[
0
]
==
'$'
)
/* Ligne doit etre "$Sheet" */
{
...
...
@@ -826,12 +826,12 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
LineCount
++
;
if
(
fgets
(
Line
,
256
-
1
,
f
)
==
NULL
)
return
TRUE
;
if
(
Line
[
0
]
==
'U'
){
sscanf
(
Line
+
1
,
"%lX"
,
&
(
SheetStruct
->
m_TimeStamp
)
);
if
(
SheetStruct
->
m_TimeStamp
==
0
)
//zero is not unique!
SheetStruct
->
m_TimeStamp
=
GetTimeStamp
();
continue
;
}
if
(
Line
[
0
]
==
'U'
){
sscanf
(
Line
+
1
,
"%lX"
,
&
(
SheetStruct
->
m_TimeStamp
)
);
if
(
SheetStruct
->
m_TimeStamp
==
0
)
//zero is not unique!
SheetStruct
->
m_TimeStamp
=
GetTimeStamp
();
continue
;
}
if
(
Line
[
0
]
!=
'F'
)
break
;
sscanf
(
Line
+
1
,
"%d"
,
&
fieldref
);
...
...
@@ -887,7 +887,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
else
{
SheetStruct
->
SetFileName
(
CONV_FROM_UTF8
(
Name1
));
//printf("in ReadSheetDescr : SheetStruct->m_FileName = %s \n", Name1);
//printf("in ReadSheetDescr : SheetStruct->m_FileName = %s \n", Name1);
SheetStruct
->
m_FileNameSize
=
size
;
}
}
...
...
@@ -949,12 +949,12 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
LineCount
);
Failed
=
TRUE
;
}
if
(
!
Failed
)
{
SheetStruct
->
Pnext
=
Window
->
EEDrawList
;
Window
->
EEDrawList
=
(
EDA_BaseStruct
*
)
SheetStruct
;
SheetStruct
->
m_Parent
=
Window
;
}
if
(
!
Failed
)
{
SheetStruct
->
Pnext
=
Window
->
EEDrawList
;
Window
->
EEDrawList
=
(
EDA_BaseStruct
*
)
SheetStruct
;
SheetStruct
->
m_Parent
=
Window
;
}
return
Failed
;
/* Fin lecture 1 composant */
}
...
...
eeschema/locate.cpp
View file @
c406eed1
...
...
@@ -31,14 +31,14 @@ static bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
/*********************************************************************/
EDA_SchComponentStruct
*
LocateSmallestComponent
(
SCH_SCREEN
*
Screen
)
SCH_COMPONENT
*
LocateSmallestComponent
(
SCH_SCREEN
*
Screen
)
/*********************************************************************/
/* Search the smaller (considering its area) component under the mouse cursor or the pcb cursor
* If more than 1 component is found, a pointer to the smaller component is returned
*/
{
EDA_SchComponentStruct
*
DrawLibItem
=
NULL
,
*
LastDrawLibItem
=
NULL
;
SCH_COMPONENT
*
DrawLibItem
=
NULL
,
*
LastDrawLibItem
=
NULL
;
EDA_BaseStruct
*
DrawList
;
EDA_Rect
BoundaryBox
;
float
sizeref
=
0
,
sizecurr
;
...
...
@@ -54,7 +54,7 @@ EDA_SchComponentStruct* LocateSmallestComponent( SCH_SCREEN* Screen )
DrawList
,
NULL
,
Screen
->
GetZoom
()
)
)
==
FALSE
)
break
;
}
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
LastSnappedStruct
;
DrawLibItem
=
(
SCH_COMPONENT
*
)
LastSnappedStruct
;
DrawList
=
DrawLibItem
->
Pnext
;
if
(
LastDrawLibItem
==
NULL
)
// First time a component is located
{
...
...
@@ -93,23 +93,23 @@ EDA_SchComponentStruct* LocateSmallestComponent( SCH_SCREEN* Screen )
* SEARCH_PINITEM
* SHEETLABELITEM
* FIELDCMPITEM
*
*
* if EXCLUDE_WIRE_BUS_ENDPOINTS is set, in wire ou bus search and locate,
* start and end points are not included in search
* if WIRE_BUS_ENDPOINTS_ONLY is set, in wire ou bus search and locate,
* only start and end points are included in search
*
*
*
*
* Return:
* -Bloc search:
* pointeur sur liste de pointeurs de structures si Plusieurs
* structures selectionnees.
* pointeur sur la structure si 1 seule
*
*
* Positon serach:
* pointeur sur la structure.
* Si pas de structures selectionnees: retourne NULL
*
*
*/
/***********************************************************************/
EDA_BaseStruct
*
PickStruct
(
const
wxPoint
&
refpos
,
...
...
@@ -120,9 +120,9 @@ EDA_BaseStruct* PickStruct( const wxPoint& refpos,
*/
{
bool
Snapped
;
EDA_BaseStruct
*
DrawList
=
screen
->
EEDrawList
;
if
(
screen
==
NULL
||
DrawList
==
NULL
)
return
NULL
;
EDA_BaseStruct
*
DrawList
=
screen
->
EEDrawList
;
if
(
screen
==
NULL
||
DrawList
==
NULL
)
return
NULL
;
if
(
(
Snapped
=
SnapPoint2
(
refpos
,
SearchMask
,
DrawList
,
NULL
,
screen
->
GetZoom
()
)
)
!=
FALSE
)
...
...
@@ -154,11 +154,11 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
EXCHG
(
x
,
OrigX
);
if
(
y
<
OrigY
)
EXCHG
(
y
,
OrigY
);
EDA_BaseStruct
*
DrawList
=
screen
->
EEDrawList
;
if
(
screen
==
NULL
||
DrawList
==
NULL
)
return
NULL
;
EDA_BaseStruct
*
DrawList
=
screen
->
EEDrawList
;
if
(
screen
==
NULL
||
DrawList
==
NULL
)
return
NULL
;
for
(
DrawStruct
=
DrawList
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Pnext
)
{
if
(
DrawStructInBox
(
OrigX
,
OrigY
,
x
,
y
,
DrawStruct
)
)
...
...
@@ -176,7 +176,7 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
/* Only one item was picked - convert to scalar form (no list): */
PickedItem
=
PickedList
;
PickedList
=
(
DrawPickedStruct
*
)
PickedList
->
m_PickedStruct
;
SAFE_DELETE
(
PickedItem
)
;
SAFE_DELETE
(
PickedItem
)
;
}
if
(
PickedList
!=
NULL
)
...
...
@@ -225,7 +225,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
#define STRUCT ( (DrawPolylineStruct*) DrawList )
if
(
!
(
SearchMask
&
(
DRAWITEM
|
WIREITEM
|
BUSITEM
)
)
)
break
;
Points
=
STRUCT
->
m_Points
;
NumOfPoints2
=
STRUCT
->
m_NumOfPoints
*
2
;
for
(
i
=
0
;
i
<
NumOfPoints2
-
2
;
i
+=
2
)
...
...
@@ -341,10 +341,10 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
}
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_TEXT
:
#undef STRUCT
#define STRUCT ( (
DrawTextStruct
*) DrawList )
#define STRUCT ( (
SCH_TEXT
*) DrawList )
if
(
!
(
SearchMask
&
(
TEXTITEM
|
LABELITEM
)
)
)
break
;
dx
=
STRUCT
->
m_Size
.
x
*
STRUCT
->
GetLength
();
...
...
@@ -379,10 +379,10 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
break
;
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
#undef STRUCT
#define STRUCT ( (
DrawLabelStruct
*) DrawList )
#define STRUCT ( (
SCH_LABEL
*) DrawList )
if
(
!
(
SearchMask
&
LABELITEM
)
)
break
;
dx
=
STRUCT
->
m_Size
.
x
*
(
STRUCT
->
GetLength
()
+
1
);
/* longueur */
...
...
@@ -416,14 +416,14 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
}
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
if
(
!
(
SearchMask
&
(
LIBITEM
|
FIELDCMPITEM
)
)
)
break
;
if
(
SearchMask
&
FIELDCMPITEM
)
{
PartTextStruct
*
Field
;
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
SCH_COMPONENT
*
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
for
(
i
=
REFERENCE
;
i
<
NUMBER_OF_FIELDS
;
i
++
)
{
Field
=
&
DrawLibItem
->
m_Field
[
i
];
...
...
@@ -442,7 +442,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
else
{
#undef STRUCT
#define STRUCT ( (
EDA_SchComponentStruct
*) DrawList )
#define STRUCT ( (
SCH_COMPONENT
*) DrawList )
EDA_Rect
BoundaryBox
=
STRUCT
->
GetBoundaryBox
();
if
(
BoundaryBox
.
Inside
(
x
,
y
)
)
{
...
...
@@ -564,10 +564,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
return
TRUE
;
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_TEXT
:
#undef STRUCT
#define STRUCT ( (
DrawTextStruct
*) DrawStruct )
#define STRUCT ( (
SCH_TEXT
*) DrawStruct )
dx
=
STRUCT
->
m_Size
.
x
*
STRUCT
->
GetLength
();
dy
=
STRUCT
->
m_Size
.
y
;
xt1
=
xt2
=
STRUCT
->
m_Pos
.
x
;
...
...
@@ -596,10 +596,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
return
TRUE
;
break
;
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_GLOBALLABEL
:
#undef STRUCT
#define STRUCT ( (
DrawLabelStruct
*) DrawStruct )
#define STRUCT ( (
SCH_LABEL
*) DrawStruct )
dx
=
STRUCT
->
m_Size
.
x
*
(
STRUCT
->
GetLength
()
+
1
);
/* longueur totale */
dy
=
STRUCT
->
m_Size
.
y
/
2
;
/* Demi hauteur */
xt1
=
xt2
=
STRUCT
->
m_Pos
.
x
;
...
...
@@ -628,10 +628,10 @@ bool DrawStructInBox( int x1, int y1, int x2, int y2,
return
TRUE
;
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
{
#undef STRUCT
#define STRUCT ( (
EDA_SchComponentStruct
*) DrawStruct )
#define STRUCT ( (
SCH_COMPONENT
*) DrawStruct )
EDA_Rect
BoundaryBox
=
STRUCT
->
GetBoundaryBox
();
xt1
=
BoundaryBox
.
GetX
();
yt1
=
BoundaryBox
.
GetY
();
...
...
@@ -682,7 +682,7 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
/* Routine detectant que le rectangle 1 (Box1) et le rectangle 2 (Box2) se
* recouvrent.
* Retourne TRUE ou FALSE.
*
*
* On Considere ici qu'il y a recouvrement si l'un au moins des coins
* d'un 'Box' est compris dans l'autre
*/
...
...
@@ -744,7 +744,7 @@ static bool IsPointInBox( int pX, int pY,
/* Routine detectant que le point pX,pY est dans le rectangle (Box)
* Retourne TRUE ou FALSE.
*
*
*/
{
if
(
BoxX1
>
BoxX2
)
...
...
@@ -1043,7 +1043,7 @@ int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil )
/*******************************************************************/
LibDrawPin
*
LocatePinByNumber
(
const
wxString
&
ePin_Number
,
EDA_SchComponentStruct
*
eComponent
)
SCH_COMPONENT
*
eComponent
)
/*******************************************************************/
/** Find a PIN in a component
...
...
@@ -1053,11 +1053,11 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
*/
{
LibEDA_BaseStruct
*
DrawItem
;
EDA_LibComponentStruct
*
Entry
;
EDA_LibComponentStruct
*
Entry
;
LibDrawPin
*
Pin
;
int
Unit
,
Convert
;
int
Unit
,
Convert
;
Entry
=
FindLibPart
(
eComponent
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
Entry
=
FindLibPart
(
eComponent
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
if
(
Entry
==
NULL
)
return
NULL
;
...
...
@@ -1067,8 +1067,8 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
return
NULL
;
}
Unit
=
eComponent
->
m_Multi
;
Convert
=
eComponent
->
m_Convert
;
Unit
=
eComponent
->
m_Multi
;
Convert
=
eComponent
->
m_Convert
;
DrawItem
=
Entry
->
m_Drawings
;
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Next
()
)
...
...
@@ -1082,10 +1082,10 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
if
(
Convert
&&
DrawItem
->
m_Convert
&&
(
DrawItem
->
m_Convert
!=
Convert
)
)
continue
;
wxString
pNumber
;
Pin
->
ReturnPinStringNum
(
pNumber
);
wxString
pNumber
;
Pin
->
ReturnPinStringNum
(
pNumber
);
if
(
ePin_Number
==
pNumber
)
return
Pin
;
return
Pin
;
}
}
...
...
@@ -1096,7 +1096,7 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
/*******************************************************************/
LibEDA_BaseStruct
*
LocatePin
(
const
wxPoint
&
RefPos
,
EDA_LibComponentStruct
*
Entry
,
int
Unit
,
int
convert
,
EDA_SchComponentStruct
*
DrawLibItem
)
int
Unit
,
int
convert
,
SCH_COMPONENT
*
DrawLibItem
)
/*******************************************************************/
/* Routine de localisation d'une PIN de la PartLib pointee par Entry
...
...
@@ -1198,19 +1198,19 @@ DrawSheetLabelStruct* LocateSheetLabel( DrawSheetStruct* Sheet, const wxPoint& p
/**************************************************************************/
LibDrawPin
*
LocateAnyPin
(
EDA_BaseStruct
*
DrawList
,
const
wxPoint
&
RefPos
,
EDA_SchComponentStruct
**
libpart
)
SCH_COMPONENT
**
libpart
)
/**************************************************************************/
{
EDA_BaseStruct
*
DrawStruct
;
EDA_LibComponentStruct
*
Entry
;
EDA_SchComponentStruct
*
LibItem
=
NULL
;
SCH_COMPONENT
*
LibItem
=
NULL
;
LibDrawPin
*
Pin
=
NULL
;
for
(
DrawStruct
=
DrawList
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Pnext
)
{
if
(
DrawStruct
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
DrawStruct
->
Type
()
!=
TYPE_SCH_COMPONENT
)
continue
;
LibItem
=
(
EDA_SchComponentStruct
*
)
DrawStruct
;
LibItem
=
(
SCH_COMPONENT
*
)
DrawStruct
;
Entry
=
FindLibPart
(
LibItem
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
if
(
Entry
==
NULL
)
continue
;
...
...
eeschema/netform.cpp
View file @
c406eed1
...
...
@@ -24,10 +24,10 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet );
static
void
WriteNetListPspice
(
WinEDA_SchematicFrame
*
frame
,
FILE
*
f
,
bool
use_netnames
);
static
void
WriteGENERICListOfNets
(
FILE
*
f
,
ObjetNetListStruct
*
ObjNet
);
static
void
AddPinToComponentPinList
(
EDA_SchComponentStruct
*
Component
,
DrawSheetPath
*
sheet
,
static
void
AddPinToComponentPinList
(
SCH_COMPONENT
*
Component
,
DrawSheetPath
*
sheet
,
LibDrawPin
*
PinEntry
);
static
void
FindOthersUnits
(
EDA_SchComponentStruct
*
Component
,
DrawSheetPath
*
Sheet_in
);
static
void
FindOthersUnits
(
SCH_COMPONENT
*
Component
,
DrawSheetPath
*
Sheet_in
);
static
int
SortPinsByNum
(
ObjetNetListStruct
**
Pin1
,
ObjetNetListStruct
**
Pin2
);
static
void
EraseDuplicatePins
(
ObjetNetListStruct
**
TabPin
,
int
NbrPin
);
...
...
@@ -92,20 +92,20 @@ void WriteNetList( WinEDA_SchematicFrame* frame, const wxString& FileNameNL,
/****************************************************************************/
static
EDA_SchComponentStruct
*
FindNextComponentAndCreatPinList
(
EDA_BaseStruct
*
DrawList
,
DrawSheetPath
*
sheet
)
static
SCH_COMPONENT
*
FindNextComponentAndCreatPinList
(
EDA_BaseStruct
*
DrawList
,
DrawSheetPath
*
sheet
)
/****************************************************************************/
/* Find a "suitable" component from the DrawList
* build its pin list s_SortedComponentPinList.
* The list is sorted by pin num
* A suitable component is a "new" real component (power symbols are not considered)
*
*
* alloc memory for s_SortedComponentPinList if s_SortedComponentPinList == NULL
* Must be deallocated by the user
*/
{
EDA_SchComponentStruct
*
Component
=
NULL
;
SCH_COMPONENT
*
Component
=
NULL
;
EDA_LibComponentStruct
*
Entry
;
LibEDA_BaseStruct
*
DEntry
;
...
...
@@ -113,23 +113,23 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Next
()
)
{
if
(
DrawList
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
DrawList
->
Type
()
!=
TYPE_SCH_COMPONENT
)
continue
;
Component
=
(
EDA_SchComponentStruct
*
)
DrawList
;
Component
=
(
SCH_COMPONENT
*
)
DrawList
;
/* already tested ? : */
bool
found
=
false
;
for
(
unsigned
int
i
=
0
;
i
<
Component
->
m_UsedOnSheets
.
GetCount
();
i
++
){
if
(
Component
->
m_UsedOnSheets
.
Item
(
i
)
==
*
sheet
){
found
=
true
;
break
;
}
}
if
(
found
)
continue
;
bool
found
=
false
;
for
(
unsigned
int
i
=
0
;
i
<
Component
->
m_UsedOnSheets
.
GetCount
();
i
++
){
if
(
Component
->
m_UsedOnSheets
.
Item
(
i
)
==
*
sheet
){
found
=
true
;
break
;
}
}
if
(
found
)
continue
;
//if( Component->m_FlagControlMulti == 1 )
// continue; /* yes */
// removed because with multiple instances of one schematic
// (several sheets pointing to 1 screen), this will be erroneously be toggled.
// removed because with multiple instances of one schematic
// (several sheets pointing to 1 screen), this will be erroneously be toggled.
Entry
=
FindLibPart
(
Component
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
if
(
Entry
==
NULL
)
...
...
@@ -137,7 +137,7 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
/* Power symbol and other component which have the reference starting by
* "#" are not included in netlist (pseudo components) */
wxString
str
=
Component
->
GetRef
(
sheet
);
wxString
str
=
Component
->
GetRef
(
sheet
);
if
(
str
[
0
]
==
'#'
)
continue
;
...
...
@@ -164,8 +164,8 @@ static EDA_SchComponentStruct* FindNextComponentAndCreatPinList(
}
//Component->m_FlagControlMulti = 1;
Component
->
m_UsedOnSheets
.
Add
(
*
sheet
);
Component
->
m_UsedOnSheets
.
Add
(
*
sheet
);
if
(
Entry
->
m_UnitCount
>
1
)
FindOthersUnits
(
Component
,
sheet
);
...
...
@@ -211,7 +211,7 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
continue
;
if
(
(
g_TabObjNet
[
jj
].
m_Type
!=
NET_HIERLABEL
)
&&
(
g_TabObjNet
[
jj
].
m_Type
!=
NET_LABEL
)
&&
(
g_TabObjNet
[
jj
].
m_Type
!=
NET_PINLABEL
)
)
&&
(
g_TabObjNet
[
jj
].
m_Type
!=
NET_PINLABEL
)
)
continue
;
NetName
=
*
g_TabObjNet
[
jj
].
m_Label
;
...
...
@@ -221,9 +221,9 @@ static wxString ReturnPinNetName( ObjetNetListStruct* Pin,
if
(
!
NetName
.
IsEmpty
()
)
{
if
(
g_TabObjNet
[
jj
].
m_Type
!=
NET_PINLABEL
){
NetName
=
g_TabObjNet
[
jj
].
m_SheetList
.
PathHumanReadable
()
+
NetName
;
}
NetName
=
g_TabObjNet
[
jj
].
m_SheetList
.
PathHumanReadable
()
+
NetName
;
}
//NetName << wxT("_") << g_TabObjNet[jj].m_SheetList.PathHumanReadable();
}
else
...
...
@@ -241,13 +241,13 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
/* Create a generic netlist, and call an external netlister
* to change the netlist syntax and create the file
* -- does this still work?
* -- does this still work?
*/
{
wxString
Line
,
FootprintName
;
DrawSheetPath
*
sheet
;
DrawSheetPath
*
sheet
;
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
Component
;
SCH_COMPONENT
*
Component
;
wxString
netname
;
int
ii
;
FILE
*
tmpfile
;
...
...
@@ -267,14 +267,14 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
/* Create netlist module section */
fprintf
(
tmpfile
,
"$BeginComponentList
\n
"
);
EDA_SheetList
SheetList
(
NULL
);
EDA_SheetList
SheetList
(
NULL
);
for
(
sheet
=
SheetList
.
GetFirst
();
sheet
!=
NULL
;
sheet
=
SheetList
.
GetNext
()
)
{
for
(
DrawList
=
sheet
->
LastDrawList
();
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
{
for
(
sheet
=
SheetList
.
GetFirst
();
sheet
!=
NULL
;
sheet
=
SheetList
.
GetNext
()
)
{
for
(
DrawList
=
sheet
->
LastDrawList
();
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
{
DrawList
=
Component
=
FindNextComponentAndCreatPinList
(
DrawList
,
sheet
);
if
(
Component
==
NULL
)
break
;
// No component left
...
...
@@ -363,11 +363,11 @@ static void ClearUsedFlags( WinEDA_SchematicFrame* frame )
DrawList
=
screen
->
EEDrawList
;
while
(
DrawList
)
{
if
(
DrawList
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
DrawList
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
EDA_SchComponentStruct
*
Component
=
(
EDA_SchComponentStruct
*
)
DrawList
;
SCH_COMPONENT
*
Component
=
(
SCH_COMPONENT
*
)
DrawList
;
//Component->m_FlagControlMulti = 0;
Component
->
m_UsedOnSheets
.
Clear
();
Component
->
m_UsedOnSheets
.
Clear
();
}
DrawList
=
DrawList
->
Pnext
;
}
...
...
@@ -384,7 +384,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
* si use_netnames = TRUE
* les nodes sont identifies par le netname
* sinon les nodes sont identifies par le netnumber
*
*
* tous les textes graphiques commen�ant par [.-+]pspice ou [.-+]gnucap
* sont consid�r�s comme des commandes a placer dans la netliste
* [.-]pspice ou gnucap sont en debut
...
...
@@ -394,7 +394,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
char
Line
[
1024
];
DrawSheetPath
*
sheet
;
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
Component
;
SCH_COMPONENT
*
Component
;
int
ii
,
nbitems
;
wxString
text
;
wxArrayString
SpiceCommandAtBeginFile
,
SpiceCommandAtEndFile
;
...
...
@@ -416,9 +416,9 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
for
(
DrawList
=
sheet
->
LastDrawList
();
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
{
wxChar
ident
;
if
(
DrawList
->
Type
()
!=
DRAW_TEXT_STRUCT_TYPE
)
if
(
DrawList
->
Type
()
!=
TYPE_SCH_TEXT
)
continue
;
#define DRAWTEXT ( (
DrawTextStruct
*) DrawList )
#define DRAWTEXT ( (
SCH_TEXT
*) DrawList )
text
=
DRAWTEXT
->
m_Text
;
if
(
text
.
IsEmpty
()
)
continue
;
ident
=
text
.
GetChar
(
0
);
...
...
@@ -536,9 +536,9 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
char
Buf
[
256
];
DrawSheetPath
*
sheet
;
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
Component
;
SCH_COMPONENT
*
Component
;
int
ii
;
ListComponent
*
CmpList
=
NULL
;
ListComponent
*
CmpList
=
NULL
;
int
CmpListCount
=
0
,
CmpListSize
=
1000
;
DateAndTime
(
Buf
);
...
...
@@ -548,7 +548,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
fprintf
(
f
,
"( { %s created %s }
\n
"
,
NETLIST_HEAD_STRING
,
Buf
);
/* Create netlist module section */
/* Create netlist module section */
ClearUsedFlags
(
frame
);
/* Reset the flags FlagControlMulti in all schematic files*/
EDA_SheetList
SheetList
(
NULL
);
...
...
@@ -569,18 +569,18 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
if
(
Entry
->
m_FootprintList
.
GetCount
()
!=
0
)
/* Put in list */
{
if
(
CmpList
==
NULL
){
CmpList
=
(
ListComponent
*
)
MyZMalloc
(
sizeof
(
ListComponent
)
*
CmpListSize
);
}
CmpList
=
(
ListComponent
*
)
MyZMalloc
(
sizeof
(
ListComponent
)
*
CmpListSize
);
}
if
(
CmpListCount
>=
CmpListSize
)
{
CmpListSize
+=
1000
;
CmpList
=
(
ListComponent
*
)
realloc
(
CmpList
=
(
ListComponent
*
)
realloc
(
CmpList
,
sizeof
(
ListComponent
)
*
CmpListSize
);
sizeof
(
ListComponent
)
*
CmpListSize
);
}
CmpList
[
CmpListCount
].
m_Comp
=
Component
;
strcpy
(
CmpList
[
CmpListCount
].
m_Ref
,
Component
->
GetRef
(
sheet
).
mb_str
());
strcpy
(
CmpList
[
CmpListCount
].
m_Ref
,
Component
->
GetRef
(
sheet
).
mb_str
());
CmpListCount
++
;
}
}
...
...
@@ -593,7 +593,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
else
FootprintName
=
wxT
(
"$noname"
);
Line
=
Component
->
GetRef
(
sheet
);
Line
=
Component
->
GetRef
(
sheet
);
fprintf
(
f
,
" ( %s %s"
,
CONV_TO_UTF8
(
Component
->
GetPath
(
sheet
)),
CONV_TO_UTF8
(
FootprintName
)
);
...
...
@@ -642,13 +642,13 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
{
Component
=
CmpList
[
ii
].
m_Comp
;
Entry
=
FindLibPart
(
Component
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
//Line.Printf(_("%s"), CmpList[ii].m_Ref);
//Line.Printf(_("%s"), CmpList[ii].m_Ref);
//Line.Replace( wxT( " " ), wxT( "_" ) );
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
CmpList
[
ii
].
m_Ref
)
&&
CmpList
[
ii
].
m_Ref
[
i
];
i
++
){
if
(
CmpList
[
ii
].
m_Ref
[
i
]
==
' '
)
CmpList
[
ii
].
m_Ref
[
i
]
=
'_'
;
}
unsigned
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
CmpList
[
ii
].
m_Ref
)
&&
CmpList
[
ii
].
m_Ref
[
i
];
i
++
){
if
(
CmpList
[
ii
].
m_Ref
[
i
]
==
' '
)
CmpList
[
ii
].
m_Ref
[
i
]
=
'_'
;
}
fprintf
(
f
,
"$component %s
\n
"
,
CmpList
[
ii
].
m_Ref
);
/* Write the footprint list */
for
(
unsigned
int
jj
=
0
;
jj
<
Entry
->
m_FootprintList
.
GetCount
();
jj
++
)
...
...
@@ -675,8 +675,8 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
/*************************************************************************************/
static
void
AddPinToComponentPinList
(
EDA_SchComponentStruct
*
Component
,
DrawSheetPath
*
sheetlist
,
LibDrawPin
*
Pin
)
static
void
AddPinToComponentPinList
(
SCH_COMPONENT
*
Component
,
DrawSheetPath
*
sheetlist
,
LibDrawPin
*
Pin
)
/*************************************************************************************/
/* Add a new pin description in the pin list s_SortedComponentPinList
...
...
@@ -693,8 +693,8 @@ static void AddPinToComponentPinList( EDA_SchComponentStruct* Component,
continue
;
if
(
g_TabObjNet
[
ii
].
m_Link
!=
Component
)
continue
;
if
(
g_TabObjNet
[
ii
].
m_SheetList
!=
*
sheetlist
)
continue
;
if
(
g_TabObjNet
[
ii
].
m_SheetList
!=
*
sheetlist
)
continue
;
if
(
g_TabObjNet
[
ii
].
m_PinNum
!=
Pin
->
m_PinNum
)
continue
;
{
...
...
@@ -742,7 +742,7 @@ static void EraseDuplicatePins( ObjetNetListStruct** TabPin, int NbrPin )
/**********************************************************************/
static
void
FindOthersUnits
(
EDA_SchComponentStruct
*
Component_in
,
DrawSheetPath
*
Sheet_in
)
static
void
FindOthersUnits
(
SCH_COMPONENT
*
Component_in
,
DrawSheetPath
*
Sheet_in
)
/**********************************************************************/
/* Recherche les autres parts du boitier auquel appartient la part Component,
...
...
@@ -751,15 +751,15 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component_in, DrawSheetPath
*/
{
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
Component2
;
SCH_COMPONENT
*
Component2
;
EDA_LibComponentStruct
*
Entry
;
LibEDA_BaseStruct
*
DEntry
;
DrawSheetPath
*
sheet
;
wxString
str
;
wxString
str
;
EDA_SheetList
SheetList
(
NULL
);
unsigned
int
i
;
bool
found
;
unsigned
int
i
;
bool
found
;
for
(
sheet
=
SheetList
.
GetFirst
();
sheet
!=
NULL
;
sheet
=
SheetList
.
GetNext
()
)
{
DrawList
=
sheet
->
LastDrawList
();
...
...
@@ -767,26 +767,26 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component_in, DrawSheetPath
{
switch
(
DrawList
->
Type
()
)
{
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
Component2
=
(
EDA_SchComponentStruct
*
)
DrawList
;
found
=
false
;
for
(
i
=
0
;
i
<
Component2
->
m_UsedOnSheets
.
GetCount
();
i
++
){
if
(
Component2
->
m_UsedOnSheets
.
Item
(
i
)
==
*
Sheet_in
){
found
=
true
;
}
}
if
(
found
)
break
;
case
TYPE_SCH_COMPONENT
:
Component2
=
(
SCH_COMPONENT
*
)
DrawList
;
found
=
false
;
for
(
i
=
0
;
i
<
Component2
->
m_UsedOnSheets
.
GetCount
();
i
++
){
if
(
Component2
->
m_UsedOnSheets
.
Item
(
i
)
==
*
Sheet_in
){
found
=
true
;
}
}
if
(
found
)
break
;
//if( Component2->m_FlagControlMulti == 1 ) //has it been used? (on this sheet?)
// break;
str
=
Component2
->
GetRef
(
sheet
);
str
=
Component2
->
GetRef
(
sheet
);
if
(
str
.
CmpNoCase
(
Component_in
->
GetRef
(
Sheet_in
)
)
!=
0
)
break
;
Entry
=
FindLibPart
(
Component2
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
if
(
Entry
==
NULL
)
break
;
if
(
str
[
0
]
==
'#'
)
break
;
...
...
@@ -808,8 +808,8 @@ static void FindOthersUnits( EDA_SchComponentStruct* Component_in, DrawSheetPath
}
}
}
Component2
->
m_UsedOnSheets
.
Add
(
*
Sheet_in
);
//Component2->m_FlagControlMulti = 1; //mark it as used..
Component2
->
m_UsedOnSheets
.
Add
(
*
Sheet_in
);
//Component2->m_FlagControlMulti = 1; //mark it as used..
break
;
default
:
...
...
@@ -830,12 +830,12 @@ static int SortPinsByNum( ObjetNetListStruct** Pin1, ObjetNetListStruct** Pin2 )
* du tableau des pins s_SortedComponentPinList par qsort()
*/
{
ObjetNetListStruct
*
Obj1
,
*
Obj2
;
ObjetNetListStruct
*
Obj1
,
*
Obj2
;
int
Num1
,
Num2
;
char
Line
[
5
];
Obj1
=
*
Pin1
;
Obj2
=
*
Pin2
;
Num1
=
Obj1
->
m_PinNum
;
Num2
=
Obj2
->
m_PinNum
;
Obj1
=
*
Pin1
;
Obj2
=
*
Pin2
;
Num1
=
Obj1
->
m_PinNum
;
Num2
=
Obj2
->
m_PinNum
;
Line
[
4
]
=
0
;
memcpy
(
Line
,
&
Num1
,
4
);
Num1
=
atoi
(
Line
);
memcpy
(
Line
,
&
Num2
,
4
);
Num2
=
atoi
(
Line
);
return
Num1
-
Num2
;
...
...
@@ -853,7 +853,7 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
int
ii
,
jj
;
int
NetCode
,
LastNetCode
=
-
1
;
int
SameNetcodeCount
=
0
;
EDA_SchComponentStruct
*
Cmp
;
SCH_COMPONENT
*
Cmp
;
wxString
NetName
,
CmpRef
;
wxString
NetcodeName
;
char
FirstItemInNet
[
1024
];
...
...
@@ -881,13 +881,13 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
if
(
!
NetName
.
IsEmpty
()
)
{
NetcodeName
+=
NetName
;
if
(
g_TabObjNet
[
jj
].
m_Type
!=
NET_PINLABEL
){
// usual net name, add in the sheet path
NetcodeName
=
g_TabObjNet
[
jj
].
m_SheetList
.
PathHumanReadable
()
+
NetcodeName
;
//NetcodeName << wxT("_") <<
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
}
if
(
g_TabObjNet
[
jj
].
m_Type
!=
NET_PINLABEL
){
// usual net name, add in the sheet path
NetcodeName
=
g_TabObjNet
[
jj
].
m_SheetList
.
PathHumanReadable
()
+
NetcodeName
;
//NetcodeName << wxT("_") <<
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
}
}
NetcodeName
+=
wxT
(
"
\"
"
);
LastNetCode
=
NetCode
;
...
...
@@ -896,8 +896,8 @@ static void WriteGENERICListOfNets( FILE* f, ObjetNetListStruct* ObjNet )
if
(
ObjNet
[
ii
].
m_Type
!=
NET_PIN
)
continue
;
Cmp
=
(
EDA_SchComponentStruct
*
)
ObjNet
[
ii
].
m_Link
;
CmpRef
=
Cmp
->
GetRef
(
&
ObjNet
[
ii
].
m_SheetList
);
//is this correct?
Cmp
=
(
SCH_COMPONENT
*
)
ObjNet
[
ii
].
m_Link
;
CmpRef
=
Cmp
->
GetRef
(
&
ObjNet
[
ii
].
m_SheetList
);
//is this correct?
if
(
CmpRef
.
StartsWith
(
wxT
(
"#"
)
)
)
continue
;
// Pseudo component (Like Power symbol)
...
...
@@ -936,21 +936,21 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
* ..APP "Cadstar RINF Output - Version 6.0.2.3"
* ..UNI INCH 1000.0 in
* ..TYP FULL
*
*
* liste des composants:
* ..ADD_COM X1 "CNT D41612 (48PTS MC CONTOUR)"
* ..ADD_COM U2 "74HCT245D" "74HCT245D"
*
*
* Connexions:
* ..ADD_TER RR2 6 "$42"
* ..TER U1 100
* CA 6
*
*
* ..ADD_TER U2 6 "$59"
* ..TER U7 39
* U6 17
* U1 122
*
*
* ..ADD_TER P2 1 "$9"
* ..TER T3 1
* U1 14
...
...
@@ -962,7 +962,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
char
Line
[
1024
];
DrawSheetPath
*
sheet
;
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
Component
;
SCH_COMPONENT
*
Component
;
wxString
Title
=
g_Main_Title
+
wxT
(
" "
)
+
GetBuildVersion
();
fprintf
(
f
,
"%sHEA
\n
"
,
CONV_TO_UTF8
(
StartLine
)
);
...
...
@@ -1031,7 +1031,7 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
wxString
NetcodeName
,
InitNetDescLine
;
int
ii
,
jj
,
print_ter
=
0
;
int
NetCode
,
LastNetCode
=
-
1
;
EDA_SchComponentStruct
*
Cmp
;
SCH_COMPONENT
*
Cmp
;
wxString
NetName
;
for
(
ii
=
0
;
ii
<
g_NbrObjNet
;
ii
++
)
...
...
@@ -1060,11 +1060,11 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
{
NetcodeName
+=
NetName
;
if
(
g_TabObjNet
[
jj
].
m_Type
!=
NET_PINLABEL
){
NetcodeName
=
g_TabObjNet
[
jj
].
m_SheetList
.
PathHumanReadable
()
+
NetcodeName
;
//NetcodeName << wxT("_") <<
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
}
NetcodeName
=
g_TabObjNet
[
jj
].
m_SheetList
.
PathHumanReadable
()
+
NetcodeName
;
//NetcodeName << wxT("_") <<
// g_TabObjNet[jj].m_SheetList.PathHumanReadable();
}
}
else
// this net has no name: create a default name $<net number>
NetcodeName
<<
wxT
(
"$"
)
<<
NetCode
;
...
...
@@ -1080,8 +1080,8 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
if
(
ObjNet
[
ii
].
m_Flag
!=
0
)
continue
;
Cmp
=
(
EDA_SchComponentStruct
*
)
ObjNet
[
ii
].
m_Link
;
wxString
refstr
=
Cmp
->
GetRef
(
&
(
ObjNet
[
ii
].
m_SheetList
));
Cmp
=
(
SCH_COMPONENT
*
)
ObjNet
[
ii
].
m_Link
;
wxString
refstr
=
Cmp
->
GetRef
(
&
(
ObjNet
[
ii
].
m_SheetList
));
if
(
refstr
[
0
]
==
'#'
)
continue
;
// Pseudo composant (symboles d'alims)
...
...
@@ -1127,11 +1127,11 @@ static void WriteListOfNetsCADSTAR( FILE* f, ObjetNetListStruct* ObjNet )
break
;
if
(
ObjNet
[
jj
].
m_Type
!=
NET_PIN
)
continue
;
EDA_SchComponentStruct
*
tstcmp
=
(
EDA_SchComponentStruct
*
)
ObjNet
[
jj
].
m_Link
;
wxString
p
=
Cmp
->
GetPath
(
&
(
ObjNet
[
ii
].
m_SheetList
)
);
wxString
tstp
=
tstcmp
->
GetPath
(
&
(
ObjNet
[
jj
].
m_SheetList
)
);
if
(
p
.
Cmp
(
tstp
)
!=
0
)
SCH_COMPONENT
*
tstcmp
=
(
SCH_COMPONENT
*
)
ObjNet
[
jj
].
m_Link
;
wxString
p
=
Cmp
->
GetPath
(
&
(
ObjNet
[
ii
].
m_SheetList
)
);
wxString
tstp
=
tstcmp
->
GetPath
(
&
(
ObjNet
[
jj
].
m_SheetList
)
);
if
(
p
.
Cmp
(
tstp
)
!=
0
)
continue
;
if
(
ObjNet
[
jj
].
m_PinNum
==
ObjNet
[
ii
].
m_PinNum
)
...
...
eeschema/netlist.cpp
View file @
c406eed1
...
...
@@ -44,7 +44,7 @@ static int s_PassNumber;
const
char
*
ShowType
(
NetObjetType
aType
)
{
const
char
*
ret
;
switch
(
aType
)
{
case
NET_SEGMENT
:
ret
=
"segment"
;
break
;
...
...
@@ -52,10 +52,10 @@ const char* ShowType( NetObjetType aType )
case
NET_JONCTION
:
ret
=
"junction"
;
break
;
case
NET_LABEL
:
ret
=
"label"
;
break
;
case
NET_HIERLABEL
:
ret
=
"hierlabel"
;
break
;
case
NET_GLOBLABEL
:
ret
=
"glabel"
;
break
;
case
NET_GLOBLABEL
:
ret
=
"glabel"
;
break
;
case
NET_BUSLABELMEMBER
:
ret
=
"buslblmember"
;
break
;
case
NET_HIERBUSLABELMEMBER
:
ret
=
"hierbuslblmember"
;
break
;
case
NET_GLOBBUSLABELMEMBER
:
ret
=
"gbuslblmember"
;
break
;
case
NET_GLOBBUSLABELMEMBER
:
ret
=
"gbuslblmember"
;
break
;
case
NET_SHEETBUSLABELMEMBER
:
ret
=
"sbuslblmember"
;
break
;
case
NET_SHEETLABEL
:
ret
=
"sheetlabel"
;
break
;
case
NET_PINLABEL
:
ret
=
"pinlabel"
;
break
;
...
...
@@ -69,8 +69,8 @@ const char* ShowType( NetObjetType aType )
void
ObjetNetListStruct
::
Show
(
std
::
ostream
&
out
,
int
ndx
)
{
wxString
path
=
m_SheetList
.
PathHumanReadable
();
out
<<
"<netItem ndx=
\"
"
<<
ndx
<<
'"'
<<
wxString
path
=
m_SheetList
.
PathHumanReadable
();
out
<<
"<netItem ndx=
\"
"
<<
ndx
<<
'"'
<<
" type=
\"
"
<<
ShowType
(
m_Type
)
<<
'"'
<<
" netCode=
\"
"
<<
GetNet
()
<<
'"'
<<
" sheet=
\"
"
<<
CONV_TO_UTF8
(
path
)
<<
'"'
<<
...
...
@@ -80,12 +80,12 @@ void ObjetNetListStruct::Show( std::ostream& out, int ndx )
if
(
m_Label
)
out
<<
" <label>"
<<
m_Label
->
mb_str
()
<<
"</label>
\n
"
;
if
(
m_Comp
)
m_Comp
->
Show
(
1
,
out
);
else
out
<<
" m_Comp==NULL
\n
"
;
out
<<
"</netItem>
\n
"
;
}
...
...
@@ -124,17 +124,17 @@ void FreeTabNetList( ObjetNetListStruct* TabNetItems, int NbrNetItems )
case
NET_BUS
:
case
NET_LABEL
:
case
NET_HIERLABEL
:
case
NET_GLOBLABEL
:
case
NET_GLOBLABEL
:
case
NET_PINLABEL
:
case
NET_NOCONNECT
:
break
;
case
NET_HIERBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_BUSLABELMEMBER
:
SAFE_DELETE
(
TabNetItems
[
i
].
m_Label
);
//see the note in ConvertBustToMembers
SAFE_DELETE
(
TabNetItems
[
i
].
m_Label
);
//see the note in ConvertBustToMembers
break
;
}
}
...
...
@@ -154,19 +154,19 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
{
int
NetNumber
;
int
i
,
istart
,
NetCode
;
DrawSheetPath
*
sheet
;
DrawSheetPath
*
sheet
;
wxString
msg
;
wxBusyCursor
Busy
;
NetNumber
=
1
;
s_PassNumber
=
0
;
MsgPanel
->
EraseMsgBox
();
Affiche_1_Parametre
(
this
,
1
,
_
(
"List"
),
wxEmptyString
,
LIGHTRED
);
/* Build the sheet (not screen) list (flattened)*/
EDA_SheetList
SheetListList
(
NULL
);
i
=
0
;
i
=
0
;
/* 1ere passe : Comptage du nombre d'objet de Net */
g_NbrObjNet
=
0
;
g_TabObjNet
=
NULL
;
/* Init pour le 1er passage dans ListeObjetConnection */
...
...
@@ -191,13 +191,13 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
return
NULL
;
/* 2eme passe : Remplissage des champs des structures des objets de Net */
/* second pass: fill the fields of the structures in the Net */
/* second pass: fill the fields of the structures in the Net */
s_PassNumber
++
;
Affiche_1_Parametre
(
this
,
1
,
_
(
"List"
),
wxEmptyString
,
RED
);
sheet
=
SheetListList
.
GetFirst
();
for
(
ObjetNetListStruct
*
tabObjNet
=
g_TabObjNet
;
sheet
=
SheetListList
.
GetFirst
();
for
(
ObjetNetListStruct
*
tabObjNet
=
g_TabObjNet
;
sheet
!=
NULL
;
sheet
=
SheetListList
.
GetNext
()
)
{
tabObjNet
+=
ListeObjetConnection
(
this
,
sheet
,
tabObjNet
);
...
...
@@ -217,12 +217,12 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
sheet
=
&
(
g_TabObjNet
[
0
].
m_SheetList
);
LastNetCode
=
LastBusNetCode
=
1
;
for
(
i
=
istart
=
0
;
i
<
g_NbrObjNet
;
i
++
)
{
if
(
g_TabObjNet
[
i
].
m_SheetList
!=
*
sheet
)
if
(
g_TabObjNet
[
i
].
m_SheetList
!=
*
sheet
)
{
sheet
=
&
(
g_TabObjNet
[
i
].
m_SheetList
);
sheet
=
&
(
g_TabObjNet
[
i
].
m_SheetList
);
istart
=
i
;
}
...
...
@@ -265,7 +265,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
case
NET_LABEL
:
case
NET_HIERLABEL
:
case
NET_GLOBLABEL
:
case
NET_GLOBLABEL
:
/* Controle des connexions type jonction ( Sans BUS ) */
if
(
g_TabObjNet
[
i
].
GetNet
()
==
0
)
{
...
...
@@ -291,7 +291,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
case
NET_BUSLABELMEMBER
:
case
NET_HIERBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
/* Controle des connexions semblables a des sur BUS */
if
(
g_TabObjNet
[
i
].
GetNet
()
==
0
)
{
...
...
@@ -303,11 +303,11 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
}
}
#if defined(NETLIST_DEBUG) && defined(DEBUG)
std
::
cout
<<
"
\n\n
after sheet local
\n\n
"
;
dumpNetTable
();
#endif
#endif
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
CYAN
);
...
...
@@ -331,16 +331,16 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
break
;
case
NET_LABEL
:
case
NET_GLOBLABEL
:
case
NET_GLOBLABEL
:
case
NET_PINLABEL
:
case
NET_BUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
LabelConnect
(
g_TabObjNet
+
i
);
break
;
case
NET_SHEETBUSLABELMEMBER
:
case
NET_HIERLABEL
:
case
NET_HIERBUSLABELMEMBER
:
case
NET_HIERLABEL
:
case
NET_HIERBUSLABELMEMBER
:
break
;
}
}
...
...
@@ -348,8 +348,8 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
#if defined(NETLIST_DEBUG) && defined(DEBUG)
std
::
cout
<<
"
\n\n
after sheet global
\n\n
"
;
dumpNetTable
();
#endif
#endif
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
CYAN
);
/* Connexion des hierarchies */
...
...
@@ -361,16 +361,16 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
||
g_TabObjNet
[
i
].
m_Type
==
NET_SHEETBUSLABELMEMBER
)
SheetLabelConnect
(
g_TabObjNet
+
i
);
}
/* Tri du Tableau des objets de Net par NetCode */
qsort
(
g_TabObjNet
,
g_NbrObjNet
,
sizeof
(
ObjetNetListStruct
),
TriNetCode
);
#if defined(NETLIST_DEBUG) && defined(DEBUG)
std
::
cout
<<
"after qsort()
\n
"
;
dumpNetTable
();
#endif
#endif
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
RED
);
/* Compression des numeros de NetCode a des valeurs consecutives */
...
...
@@ -380,7 +380,7 @@ void* WinEDA_SchematicFrame::BuildNetListBase()
{
if
(
g_TabObjNet
[
i
].
GetNet
()
!=
LastNetCode
)
{
NetCode
++
;
NetCode
++
;
LastNetCode
=
g_TabObjNet
[
i
].
GetNet
();
}
g_TabObjNet
[
i
].
SetNet
(
NetCode
);
...
...
@@ -412,16 +412,16 @@ static void SheetLabelConnect( ObjetNetListStruct* SheetLabel )
* pour regroupement des NetCodes */
for
(
i
=
0
,
ObjetNet
=
g_TabObjNet
;
i
<
g_NbrObjNet
;
i
++
)
{
if
(
ObjetNet
[
i
].
m_SheetList
!=
SheetLabel
->
m_SheetListInclude
)
continue
;
//use SheetInclude, not the sheet!!
if
(
ObjetNet
[
i
].
m_SheetList
!=
SheetLabel
->
m_SheetListInclude
)
continue
;
//use SheetInclude, not the sheet!!
if
(
(
ObjetNet
[
i
].
m_Type
!=
NET_HIERLABEL
)
&&
(
ObjetNet
[
i
].
m_Type
!=
NET_HIERBUSLABELMEMBER
)
)
continue
;
if
(
ObjetNet
[
i
].
GetNet
()
==
SheetLabel
->
GetNet
()
)
continue
;
//already connected.
continue
;
//already connected.
if
(
ObjetNet
[
i
].
m_Label
->
CmpNoCase
(
*
SheetLabel
->
m_Label
)
!=
0
)
continue
;
//different names.
...
...
@@ -441,7 +441,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
/* Routine generant la liste des objets relatifs aux connection
* entree:
* sheetlist: pointer to a sheetlist.
* sheetlist: pointer to a sheetlist.
* ObjNet:
* si NULL: la routine compte seulement le nombre des objets
* sinon: pointe le tableau a remplir
...
...
@@ -449,21 +449,21 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
{
int
ii
,
NbrItem
=
0
;
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
int
TransMat
[
2
][
2
],
PartX
,
PartY
,
x2
,
y2
;
EDA_LibComponentStruct
*
Entry
;
LibEDA_BaseStruct
*
DEntry
;
DrawSheetLabelStruct
*
SheetLabel
;
DrawSheetPath
list
;
DrawSheetPath
list
;
DrawList
=
sheetlist
->
LastScreen
()
->
EEDrawList
;
for
(
;
DrawList
;
DrawList
=
DrawList
->
Pnext
)
{
if
(
ObjNet
){
ObjNet
[
NbrItem
].
m_SheetList
=
*
sheetlist
;
ObjNet
[
NbrItem
].
m_SheetListInclude
=
*
sheetlist
;
//used for DrawSheetLabels
}
if
(
ObjNet
){
ObjNet
[
NbrItem
].
m_SheetList
=
*
sheetlist
;
ObjNet
[
NbrItem
].
m_SheetListInclude
=
*
sheetlist
;
//used for DrawSheetLabels
}
switch
(
DrawList
->
Type
()
)
{
case
DRAW_SEGMENT_STRUCT_TYPE
:
...
...
@@ -478,7 +478,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Start
;
ObjNet
[
NbrItem
].
m_End
=
STRUCT
->
m_End
;
if
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
{
ObjNet
[
NbrItem
].
m_Type
=
NET_BUS
;
...
...
@@ -517,24 +517,24 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
NbrItem
++
;
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
#undef STRUCT
#define STRUCT ( (
DrawLabelStruct
*) DrawList )
#define STRUCT ( (
SCH_LABEL
*) DrawList )
ii
=
IsBusLabel
(
STRUCT
->
m_Text
);
if
(
ObjNet
)
{
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
ObjNet
[
NbrItem
].
m_Type
=
NET_LABEL
;
if
(
STRUCT
->
m_Layer
==
LAYER_GLOBLABEL
)
ObjNet
[
NbrItem
].
m_Type
=
NET_GLOBLABEL
;
if
(
STRUCT
->
m_Layer
==
LAYER_HIERLABEL
)
ObjNet
[
NbrItem
].
m_Type
=
NET_HIERLABEL
;
if
(
STRUCT
->
m_Layer
==
LAYER_HIERLABEL
)
ObjNet
[
NbrItem
].
m_Type
=
NET_HIERLABEL
;
ObjNet
[
NbrItem
].
m_Label
=
&
STRUCT
->
m_Text
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Pos
;
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
/* Si c'est un Bus, eclatement en Label */
if
(
ii
)
ConvertBusToMembers
(
ObjNet
+
NbrItem
);
...
...
@@ -542,25 +542,25 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
NbrItem
+=
ii
+
1
;
break
;
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
#undef STRUCT
#define STRUCT ( (
DrawLabelStruct
*) DrawList )
#define STRUCT ( (
SCH_LABEL
*) DrawList )
ii
=
IsBusLabel
(
STRUCT
->
m_Text
);
if
(
ObjNet
)
{
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
ObjNet
[
NbrItem
].
m_Type
=
NET_LABEL
;
if
(
STRUCT
->
m_Layer
==
LAYER_GLOBLABEL
)
//this is not the simplest way of doing it
ObjNet
[
NbrItem
].
m_Type
=
NET_GLOBLABEL
;
// (look at the case statement above).
if
(
STRUCT
->
m_Layer
==
LAYER_HIERLABEL
)
ObjNet
[
NbrItem
].
m_Type
=
NET_HIERLABEL
;
ObjNet
[
NbrItem
].
m_Type
=
NET_GLOBLABEL
;
// (look at the case statement above).
if
(
STRUCT
->
m_Layer
==
LAYER_HIERLABEL
)
ObjNet
[
NbrItem
].
m_Type
=
NET_HIERLABEL
;
ObjNet
[
NbrItem
].
m_Label
=
&
STRUCT
->
m_Text
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Pos
;
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
/* Si c'est un Bus, eclatement en Label */
if
(
ii
)
ConvertBusToMembers
(
ObjNet
+
NbrItem
);
...
...
@@ -568,48 +568,48 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
NbrItem
+=
ii
+
1
;
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
case
TYPE_SCH_COMPONENT
:
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
memcpy
(
TransMat
,
DrawLibItem
->
m_Transform
,
sizeof
(
TransMat
)
);
PartX
=
DrawLibItem
->
m_Pos
.
x
;
PartX
=
DrawLibItem
->
m_Pos
.
x
;
PartY
=
DrawLibItem
->
m_Pos
.
y
;
Entry
=
FindLibPart
(
DrawLibItem
->
m_ChipName
,
wxEmptyString
,
FIND_ROOT
);
if
(
Entry
==
NULL
)
break
;
if
(
Entry
->
m_Drawings
==
NULL
)
break
;
DEntry
=
Entry
->
m_Drawings
;
for
(
;
DEntry
;
DEntry
=
DEntry
->
Next
()
)
{
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DEntry
;
if
(
DEntry
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
continue
;
if
(
DEntry
->
m_Unit
&&
(
DEntry
->
m_Unit
!=
DrawLibItem
->
m_Multi
)
)
continue
;
if
(
DEntry
->
m_Convert
&&
(
DEntry
->
m_Convert
!=
DrawLibItem
->
m_Convert
)
)
continue
;
x2
=
PartX
+
TransMat
[
0
][
0
]
*
Pin
->
m_Pos
.
x
+
TransMat
[
0
][
1
]
*
Pin
->
m_Pos
.
y
;
y2
=
PartY
+
TransMat
[
1
][
0
]
*
Pin
->
m_Pos
.
x
+
TransMat
[
1
][
1
]
*
Pin
->
m_Pos
.
y
;
if
(
ObjNet
)
{
ObjNet
[
NbrItem
].
m_Comp
=
DEntry
;
ObjNet
[
NbrItem
].
m_SheetList
=
*
sheetlist
;
ObjNet
[
NbrItem
].
m_SheetList
=
*
sheetlist
;
ObjNet
[
NbrItem
].
m_Type
=
NET_PIN
;
ObjNet
[
NbrItem
].
m_Link
=
DrawLibItem
;
ObjNet
[
NbrItem
].
m_ElectricalType
=
Pin
->
m_PinType
;
...
...
@@ -623,12 +623,12 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
if
(
(
(
int
)
Pin
->
m_PinType
==
(
int
)
PIN_POWER_IN
)
&&
(
Pin
->
m_Attributs
&
PINNOTDRAW
)
)
{
{
/* Il y a un PIN_LABEL Associe */
if
(
ObjNet
)
{
ObjNet
[
NbrItem
].
m_Comp
=
NULL
;
ObjNet
[
NbrItem
].
m_SheetList
=
*
sheetlist
;
ObjNet
[
NbrItem
].
m_SheetList
=
*
sheetlist
;
ObjNet
[
NbrItem
].
m_Type
=
NET_PINLABEL
;
ObjNet
[
NbrItem
].
m_Label
=
&
Pin
->
m_PinName
;
ObjNet
[
NbrItem
].
m_Start
.
x
=
x2
;
...
...
@@ -645,14 +645,14 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ( (DrawSheetStruct*) DrawList )
list
=
*
sheetlist
;
list
.
Push
(
STRUCT
);
list
=
*
sheetlist
;
list
.
Push
(
STRUCT
);
SheetLabel
=
STRUCT
->
m_Label
;
for
(
;
SheetLabel
!=
NULL
;
SheetLabel
=
(
DrawSheetLabelStruct
*
)
SheetLabel
->
Pnext
)
...
...
@@ -661,7 +661,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
if
(
ObjNet
)
{
ObjNet
[
NbrItem
].
m_Comp
=
SheetLabel
;
ObjNet
[
NbrItem
].
m_SheetList
=
*
sheetlist
;
ObjNet
[
NbrItem
].
m_SheetList
=
*
sheetlist
;
ObjNet
[
NbrItem
].
m_Link
=
DrawList
;
ObjNet
[
NbrItem
].
m_Type
=
NET_SHEETLABEL
;
ObjNet
[
NbrItem
].
m_ElectricalType
=
SheetLabel
->
m_Shape
;
...
...
@@ -669,7 +669,7 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
ObjNet
[
NbrItem
].
m_SheetListInclude
=
list
;
ObjNet
[
NbrItem
].
m_Start
=
SheetLabel
->
m_Pos
;
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
/* Si c'est un Bus, eclatement en Label */
if
(
ii
)
ConvertBusToMembers
(
ObjNet
+
NbrItem
);
...
...
@@ -721,10 +721,10 @@ static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems )
{
if
(
Label
->
GetNet
()
==
0
)
{
Label
->
SetNet
(
LastNetCode
);
Label
->
SetNet
(
LastNetCode
);
LastNetCode
++
;
}
for
(
LabelInTst
=
Label
+
1
;
LabelInTst
<
Lim
;
LabelInTst
++
)
{
if
(
(
LabelInTst
->
m_Type
==
NET_SHEETBUSLABELMEMBER
)
...
...
@@ -733,10 +733,10 @@ static void ConnectBusLabels( ObjetNetListStruct* Label, int NbItems )
{
if
(
LabelInTst
->
m_BusNetCode
!=
Label
->
m_BusNetCode
)
continue
;
if
(
LabelInTst
->
m_Member
!=
Label
->
m_Member
)
continue
;
if
(
LabelInTst
->
GetNet
()
==
0
)
LabelInTst
->
SetNet
(
Label
->
GetNet
()
);
else
...
...
@@ -767,7 +767,7 @@ int IsBusLabel( const wxString& LabelDrawList )
ii
=
LabelDrawList
.
Find
(
'['
);
if
(
ii
<
0
)
return
0
;
Num
=
(
unsigned
)
ii
;
FirstNumWireBus
=
LastNumWireBus
=
9
;
...
...
@@ -781,7 +781,7 @@ int IsBusLabel( const wxString& LabelDrawList )
if
(
!
BufLine
.
ToLong
(
&
tmp
)
)
error
=
TRUE
;
FirstNumWireBus
=
tmp
;
while
(
LabelDrawList
[
Num
]
==
'.'
&&
Num
<
LabelDrawList
.
Len
()
)
Num
++
;
...
...
@@ -835,8 +835,8 @@ static int ConvertBusToMembers( ObjetNetListStruct* BusLabel )
if
(
BusLabel
->
m_Type
==
NET_HIERLABEL
)
BusLabel
->
m_Type
=
NET_HIERBUSLABELMEMBER
;
else
if
(
BusLabel
->
m_Type
==
NET_GLOBLABEL
)
BusLabel
->
m_Type
=
NET_GLOBBUSLABELMEMBER
;
else
if
(
BusLabel
->
m_Type
==
NET_GLOBLABEL
)
BusLabel
->
m_Type
=
NET_GLOBBUSLABELMEMBER
;
else
if
(
BusLabel
->
m_Type
==
NET_SHEETLABEL
)
BusLabel
->
m_Type
=
NET_SHEETBUSLABELMEMBER
;
else
...
...
@@ -844,7 +844,7 @@ static int ConvertBusToMembers( ObjetNetListStruct* BusLabel )
/* Convertion du BusLabel en la racine du Label + le numero du fil */
BufLine
=
BusLabel
->
m_Label
->
Left
(
RootBusNameLength
);
BusMember
=
FirstNumWireBus
;
BufLine
<<
BusMember
;
BusLabel
->
m_Label
=
new
wxString
(
BufLine
);
...
...
@@ -855,9 +855,9 @@ static int ConvertBusToMembers( ObjetNetListStruct* BusLabel )
for
(
BusMember
++
;
BusMember
<=
LastNumWireBus
;
BusMember
++
)
{
*
(
BusLabel
+
1
)
=
*
BusLabel
;
//copy constructor.
BusLabel
++
;
BusLabel
++
;
NumItem
++
;
/* Convertion du BusLabel en la racine du Label + le numero du fil */
BufLine
=
BusLabel
->
m_Label
->
Left
(
RootBusNameLength
);
BufLine
<<
BusMember
;
...
...
@@ -887,7 +887,7 @@ static void PropageNetCode( int OldNetCode, int NewNetCode, int IsBus )
if
(
OldNetCode
==
NewNetCode
)
return
;
#if defined(NETLIST_DEBUG) && defined(DEBUG)
printf
(
"replacing net %d with %d
\n
"
,
OldNetCode
,
NewNetCode
);
printf
(
"replacing net %d with %d
\n
"
,
OldNetCode
,
NewNetCode
);
#endif
if
(
IsBus
==
0
)
/* Propagation du NetCode */
...
...
@@ -920,16 +920,16 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
/* Routine qui verifie si l'element *Ref est connecte a
* d'autres elements de la liste des objets du schema, selon le mode Point
* a point ( Extremites superposees )
*
*
* si IsBus:
* la connexion ne met en jeu que des elements type bus
* ( BUS ou BUSLABEL ou JONCTION )
* sinon
* la connexion ne met en jeu que des elements type non bus
* ( autres que BUS ou BUSLABEL )
*
*
* L'objet Ref doit avoir un NetCode valide.
*
*
* La liste des objets est supposee classe par SheetPath Croissants,
* et la recherche se fait a partir de l'element start, 1er element
* de la feuille de schema
...
...
@@ -944,23 +944,23 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
netCode
=
Ref
->
GetNet
();
for
(
i
=
start
;
i
<
g_NbrObjNet
;
i
++
)
{
if
(
netTable
[
i
].
m_SheetList
!=
Ref
->
m_SheetList
)
//used to be > (why?)
if
(
netTable
[
i
].
m_SheetList
!=
Ref
->
m_SheetList
)
//used to be > (why?)
continue
;
switch
(
netTable
[
i
].
m_Type
)
{
case
NET_SEGMENT
:
case
NET_PIN
:
case
NET_LABEL
:
case
NET_HIERLABEL
:
case
NET_GLOBLABEL
:
case
NET_GLOBLABEL
:
case
NET_SHEETLABEL
:
case
NET_PINLABEL
:
case
NET_JONCTION
:
case
NET_NOCONNECT
:
if
(
Ref
->
m_Start
==
netTable
[
i
].
m_Start
||
Ref
->
m_Start
==
netTable
[
i
].
m_End
||
Ref
->
m_Start
==
netTable
[
i
].
m_End
||
Ref
->
m_End
==
netTable
[
i
].
m_Start
||
Ref
->
m_End
==
netTable
[
i
].
m_End
)
{
...
...
@@ -975,12 +975,12 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
case
NET_BUSLABELMEMBER
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_HIERBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
break
;
}
}
}
else
/* Objets type BUS et BUSLABELS ( et JONCTIONS )*/
{
netCode
=
Ref
->
m_BusNetCode
;
...
...
@@ -995,7 +995,7 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
case
NET_PIN
:
case
NET_LABEL
:
case
NET_HIERLABEL
:
case
NET_GLOBLABEL
:
case
NET_GLOBLABEL
:
case
NET_SHEETLABEL
:
case
NET_PINLABEL
:
case
NET_NOCONNECT
:
...
...
@@ -1005,10 +1005,10 @@ static void PointToPointConnect( ObjetNetListStruct* Ref, int IsBus, int start )
case
NET_BUSLABELMEMBER
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_HIERBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_JONCTION
:
if
(
Ref
->
m_Start
==
netTable
[
i
].
m_Start
||
Ref
->
m_Start
==
netTable
[
i
].
m_End
||
Ref
->
m_Start
==
netTable
[
i
].
m_End
||
Ref
->
m_End
==
netTable
[
i
].
m_Start
||
Ref
->
m_End
==
netTable
[
i
].
m_End
)
{
...
...
@@ -1098,33 +1098,33 @@ static void LabelConnect( ObjetNetListStruct* LabelRef )
{
if
(
netTable
[
i
].
GetNet
()
==
LabelRef
->
GetNet
()
)
continue
;
if
(
netTable
[
i
].
m_SheetList
!=
LabelRef
->
m_SheetList
)
if
(
netTable
[
i
].
m_SheetList
!=
LabelRef
->
m_SheetList
)
{
if
(
(
netTable
[
i
].
m_Type
!=
NET_PINLABEL
&&
netTable
[
i
].
m_Type
!=
NET_GLOBLABEL
&&
netTable
[
i
].
m_Type
!=
NET_GLOBBUSLABELMEMBER
)
)
if
(
(
netTable
[
i
].
m_Type
!=
NET_PINLABEL
&&
netTable
[
i
].
m_Type
!=
NET_GLOBLABEL
&&
netTable
[
i
].
m_Type
!=
NET_GLOBBUSLABELMEMBER
)
)
continue
;
if
(
(
netTable
[
i
].
m_Type
==
NET_GLOBLABEL
||
netTable
[
i
].
m_Type
==
NET_GLOBBUSLABELMEMBER
)
&&
netTable
[
i
].
m_Type
!=
LabelRef
->
m_Type
)
//global labels only connect other global labels.
continue
;
if
(
(
netTable
[
i
].
m_Type
==
NET_GLOBLABEL
||
netTable
[
i
].
m_Type
==
NET_GLOBBUSLABELMEMBER
)
&&
netTable
[
i
].
m_Type
!=
LabelRef
->
m_Type
)
//global labels only connect other global labels.
continue
;
}
//regular labels are sheet-local;
//NET_HIERLABEL are used to connect sheets.
//NET_LABEL is sheet-local (***)
//NET_GLOBLABEL is global.
if
(
netTable
[
i
].
m_Type
==
NET_LABEL
//regular labels are sheet-local;
//NET_HIERLABEL are used to connect sheets.
//NET_LABEL is sheet-local (***)
//NET_GLOBLABEL is global.
if
(
netTable
[
i
].
m_Type
==
NET_LABEL
||
netTable
[
i
].
m_Type
==
NET_GLOBLABEL
||
netTable
[
i
].
m_Type
==
NET_HIERLABEL
||
netTable
[
i
].
m_Type
==
NET_HIERLABEL
||
netTable
[
i
].
m_Type
==
NET_BUSLABELMEMBER
||
netTable
[
i
].
m_Type
==
NET_GLOBBUSLABELMEMBER
||
netTable
[
i
].
m_Type
==
NET_HIERBUSLABELMEMBER
||
netTable
[
i
].
m_Type
==
NET_HIERBUSLABELMEMBER
||
netTable
[
i
].
m_Type
==
NET_PINLABEL
)
{
if
(
netTable
[
i
].
m_Label
->
CmpNoCase
(
*
LabelRef
->
m_Label
)
!=
0
)
continue
;
// Propagation du Netcode a tous les Objets de meme NetCode
// Propagation du Netcode a tous les Objets de meme NetCode
if
(
netTable
[
i
].
GetNet
()
)
PropageNetCode
(
netTable
[
i
].
GetNet
(),
LabelRef
->
GetNet
(),
0
);
else
...
...
@@ -1143,7 +1143,7 @@ static int TriNetCode( const void* o1, const void* o2 )
{
ObjetNetListStruct
*
Objet1
=
(
ObjetNetListStruct
*
)
o1
;
ObjetNetListStruct
*
Objet2
=
(
ObjetNetListStruct
*
)
o2
;
return
Objet1
->
GetNet
()
-
Objet2
->
GetNet
();
}
...
...
@@ -1155,9 +1155,9 @@ static int TriBySheet( const void* o1, const void* o2 )
* du tableau des elements connectes ( TabPinSort ) par qsort() */
{
ObjetNetListStruct
*
Objet1
=
(
ObjetNetListStruct
*
)
o1
;
ObjetNetListStruct
*
Objet1
=
(
ObjetNetListStruct
*
)
o1
;
ObjetNetListStruct
*
Objet2
=
(
ObjetNetListStruct
*
)
o2
;
return
Objet1
->
m_SheetList
.
Cmp
(
Objet2
->
m_SheetList
);
return
Objet1
->
m_SheetList
.
Cmp
(
Objet2
->
m_SheetList
);
}
/**********************************************************************/
...
...
@@ -1176,7 +1176,7 @@ static void SetUnconnectedFlag( ObjetNetListStruct* ListObj, int NbItems )
NetStart
=
NetEnd
=
ListObj
;
NetItemRef
=
NetStart
;
Nb
=
0
;
Nb
=
0
;
StateFlag
=
UNCONNECT
;
Lim
=
ListObj
+
NbItems
;
...
...
@@ -1191,7 +1191,7 @@ static void SetUnconnectedFlag( ObjetNetListStruct* ListObj, int NbItems )
if
(
(
NetItemTst
>=
Lim
)
||
(
NetItemRef
->
GetNet
()
!=
NetItemTst
->
GetNet
())
)
{
{
/* Net analyse: mise a jour de m_FlagOfConnection */
NetEnd
=
NetItemTst
;
...
...
@@ -1220,14 +1220,14 @@ static void SetUnconnectedFlag( ObjetNetListStruct* ListObj, int NbItems )
case
NET_SEGMENT
:
case
NET_LABEL
:
case
NET_HIERLABEL
:
case
NET_GLOBLABEL
:
case
NET_GLOBLABEL
:
case
NET_SHEETLABEL
:
case
NET_PINLABEL
:
case
NET_BUS
:
case
NET_BUSLABELMEMBER
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_HIERBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_JONCTION
:
break
;
...
...
eeschema/netlist.h
View file @
c406eed1
...
...
@@ -26,7 +26,7 @@ typedef enum {
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
* is the last id for user netlist format
*/
NET_TYPE_CUSTOM_MAX
=
NET_TYPE_CUSTOM1
+
CUSTOMPANEL_COUNTMAX
-
1
NET_TYPE_CUSTOM_MAX
=
NET_TYPE_CUSTOM1
+
CUSTOMPANEL_COUNTMAX
-
1
}
TypeNetForm
;
...
...
@@ -39,11 +39,11 @@ enum NetObjetType { /* Type des objets de Net */
NET_JONCTION
,
NET_LABEL
,
NET_GLOBLABEL
,
NET_HIERLABEL
,
//on a screen to indicate connection to a higher-level sheet
NET_SHEETLABEL
,
//on a drawscreen element to indicate connection to a lower-level sheet.
NET_HIERLABEL
,
//on a screen to indicate connection to a higher-level sheet
NET_SHEETLABEL
,
//on a drawscreen element to indicate connection to a lower-level sheet.
NET_BUSLABELMEMBER
,
NET_GLOBBUSLABELMEMBER
,
NET_HIERBUSLABELMEMBER
,
NET_HIERBUSLABELMEMBER
,
NET_SHEETBUSLABELMEMBER
,
NET_PINLABEL
,
NET_PIN
,
...
...
@@ -93,23 +93,23 @@ public:
/* Structures pour memo et liste des elements */
typedef
struct
ListLabel
{
int
m_LabelType
;
void
*
m_Label
;
char
m_SheetPath
[
64
];
int
m_LabelType
;
void
*
m_Label
;
char
m_SheetPath
[
64
];
}
ListLabel
;
typedef
struct
ListComponent
{
EDA_SchComponentStruct
*
m_Comp
;
char
m_Ref
[
32
];
//have to store it here since the object refrerences will be duplicated.
DrawSheetPath
m_SheetList
;
//composed of UIDs
SCH_COMPONENT
*
m_Comp
;
char
m_Ref
[
32
];
//have to store it here since the object refrerences will be duplicated.
DrawSheetPath
m_SheetList
;
//composed of UIDs
}
ListComponent
;
/* Structure decrivant 1 composant de la schematique (pour *annotation* ) */
struct
CmpListStruct
{
public
:
EDA_SchComponentStruct
*
m_Cmp
;
/* Pointeur sur le composant */
SCH_COMPONENT
*
m_Cmp
;
/* Pointeur sur le composant */
int
m_NbParts
;
/* Nombre de parts par boitier */
bool
m_PartsLocked
;
// For multi part components: True if the part cannot be changed
int
m_Unit
;
/* Numero de part */
...
...
@@ -121,7 +121,7 @@ public:
int
m_NumRef
;
/* Numero de reference */
int
m_Flag
;
/* flag pour calculs internes */
wxPoint
m_Pos
;
/* position components */
char
m_Path
[
128
];
// the 'path' of the object in the sheet hierarchy.
char
m_Path
[
128
];
// the 'path' of the object in the sheet hierarchy.
};
...
...
eeschema/onleftclick.cpp
View file @
c406eed1
...
...
@@ -39,15 +39,15 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{
switch
(
DrawStruct
->
Type
()
)
{
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_TEXT
:
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
case
DRAW_SHEET_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
case
DRAW_PART_TEXT_STRUCT_TYPE
:
DrawStruct
->
Place
(
this
,
DC
);
GetScreen
()
->
SetCurItem
(
NULL
);
...
...
@@ -354,16 +354,16 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
InstallNextScreen
(
(
DrawSheetStruct
*
)
DrawStruct
);
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
InstallCmpeditFrame
(
this
,
pos
,
(
EDA_SchComponentStruct
*
)
DrawStruct
);
case
TYPE_SCH_COMPONENT
:
InstallCmpeditFrame
(
this
,
pos
,
(
SCH_COMPONENT
*
)
DrawStruct
);
DrawPanel
->
MouseToCursorSchema
();
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
EditSchematicText
(
(
DrawTextStruct
*
)
DrawStruct
,
DC
);
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
EditSchematicText
(
(
SCH_TEXT
*
)
DrawStruct
,
DC
);
break
;
case
DRAW_PART_TEXT_STRUCT_TYPE
:
...
...
eeschema/onrightclick.cpp
View file @
c406eed1
...
...
@@ -55,11 +55,11 @@ static void AddMenusForBus( wxMenu* PopMenu, EDA_DrawLineStruct* Bus,
WinEDA_SchematicFrame
*
frame
);
static
void
AddMenusForHierchicalSheet
(
wxMenu
*
PopMenu
,
DrawSheetStruct
*
Sheet
);
static
void
AddMenusForPinSheet
(
wxMenu
*
PopMenu
,
DrawSheetLabelStruct
*
PinSheet
);
static
void
AddMenusForText
(
wxMenu
*
PopMenu
,
DrawTextStruct
*
Text
);
static
void
AddMenusForLabel
(
wxMenu
*
PopMenu
,
DrawLabelStruct
*
Label
);
static
void
AddMenusForGLabel
(
wxMenu
*
PopMenu
,
DrawGlobalLabelStruct
*
GLabel
);
static
void
AddMenusForHLabel
(
wxMenu
*
PopMenu
,
DrawHierLabelStruct
*
GLabel
);
static
void
AddMenusForComponent
(
wxMenu
*
PopMenu
,
EDA_SchComponentStruct
*
Component
);
static
void
AddMenusForText
(
wxMenu
*
PopMenu
,
SCH_TEXT
*
Text
);
static
void
AddMenusForLabel
(
wxMenu
*
PopMenu
,
SCH_LABEL
*
Label
);
static
void
AddMenusForGLabel
(
wxMenu
*
PopMenu
,
SCH_GLOBALLABEL
*
GLabel
);
static
void
AddMenusForHLabel
(
wxMenu
*
PopMenu
,
SCH_HIERLABEL
*
GLabel
);
static
void
AddMenusForComponent
(
wxMenu
*
PopMenu
,
SCH_COMPONENT
*
Component
);
static
void
AddMenusForComponentField
(
wxMenu
*
PopMenu
,
PartTextStruct
*
Field
);
static
void
AddMenusForJunction
(
wxMenu
*
PopMenu
,
DrawJunctionStruct
*
Junction
,
WinEDA_SchematicFrame
*
frame
);
...
...
@@ -90,20 +90,20 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
* Ce menu est ensuite compl�t� par la liste des commandes de ZOOM
*/
{
EDA_BaseStruct
*
DrawStruct
=
GetScreen
()
->
GetCurItem
();
bool
BlockActive
=
(
GetScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
EDA_BaseStruct
*
DrawStruct
=
GetScreen
()
->
GetCurItem
();
bool
BlockActive
=
(
GetScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
DrawPanel
->
m_CanStartBlock
=
-
1
;
// Ne pas engager un debut de bloc sur validation menu
if
(
BlockActive
)
{
AddMenusForBlock
(
PopMenu
,
this
);
{
AddMenusForBlock
(
PopMenu
,
this
);
PopMenu
->
AppendSeparator
();
return
true
;
}
return
true
;
}
// Simple localisation des elements si possible
// Simple localisation des elements si possible
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
m_Flags
==
0
)
)
{
DrawStruct
=
SchematicGeneralLocateAndDisplay
(
FALSE
);
...
...
@@ -111,7 +111,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
{
DrawSheetLabelStruct
*
slabel
;
slabel
=
LocateSheetLabel
(
(
DrawSheetStruct
*
)
DrawStruct
,
GetScreen
()
->
m_Curseur
);
GetScreen
()
->
m_Curseur
);
if
(
slabel
)
DrawStruct
=
slabel
;
}
...
...
@@ -134,8 +134,8 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
{
if
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
{
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_CANCEL_CURRENT_COMMAND
,
_
(
"Cancel"
),
cancel_xpm
);
PopMenu
->
AppendSeparator
();
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_CANCEL_CURRENT_COMMAND
,
_
(
"Cancel"
),
cancel_xpm
);
PopMenu
->
AppendSeparator
();
}
}
...
...
@@ -149,7 +149,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
return
true
;
}
GetScreen
()
->
SetCurItem
(
DrawStruct
);
GetScreen
()
->
SetCurItem
(
DrawStruct
);
int
flags
=
DrawStruct
->
m_Flags
;
bool
is_new
=
(
flags
&
IS_NEW
)
?
TRUE
:
FALSE
;
...
...
@@ -182,20 +182,20 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_SCH_DELETE
,
_
(
"delete Marker"
),
delete_xpm
);
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
AddMenusForText
(
PopMenu
,
(
DrawTextStruct
*
)
DrawStruct
);
case
TYPE_SCH_TEXT
:
AddMenusForText
(
PopMenu
,
(
SCH_TEXT
*
)
DrawStruct
);
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
AddMenusForLabel
(
PopMenu
,
(
DrawLabelStruct
*
)
DrawStruct
);
case
TYPE_SCH_LABEL
:
AddMenusForLabel
(
PopMenu
,
(
SCH_LABEL
*
)
DrawStruct
);
break
;
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
AddMenusForGLabel
(
PopMenu
,
(
DrawGlobalLabelStruct
*
)
DrawStruct
);
case
TYPE_SCH_GLOBALLABEL
:
AddMenusForGLabel
(
PopMenu
,
(
SCH_GLOBALLABEL
*
)
DrawStruct
);
break
;
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
AddMenusForHLabel
(
PopMenu
,
(
DrawHierLabelStruct
*
)
DrawStruct
);
case
TYPE_SCH_HIERLABEL
:
AddMenusForHLabel
(
PopMenu
,
(
SCH_HIERLABEL
*
)
DrawStruct
);
break
;
case
DRAW_PART_TEXT_STRUCT_TYPE
:
...
...
@@ -205,17 +205,17 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
break
;
// Many fields are inside a component. If this is the case, add the component menu
EDA_SchComponentStruct
*
Component
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
SCH_COMPONENT
*
Component
=
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
Component
)
{
PopMenu
->
AppendSeparator
();
AddMenusForComponent
(
PopMenu
,
(
EDA_SchComponentStruct
*
)
DrawStruct
);
AddMenusForComponent
(
PopMenu
,
(
SCH_COMPONENT
*
)
DrawStruct
);
}
}
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
AddMenusForComponent
(
PopMenu
,
(
EDA_SchComponentStruct
*
)
DrawStruct
);
case
TYPE_SCH_COMPONENT
:
AddMenusForComponent
(
PopMenu
,
(
SCH_COMPONENT
*
)
DrawStruct
);
break
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
...
...
@@ -259,7 +259,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
}
PopMenu
->
AppendSeparator
();
return
true
;
return
true
;
}
...
...
@@ -278,7 +278,7 @@ void AddMenusForComponentField( wxMenu* PopMenu, PartTextStruct* Field )
/**************************************************************************/
void
AddMenusForComponent
(
wxMenu
*
PopMenu
,
EDA_SchComponentStruct
*
Component
)
void
AddMenusForComponent
(
wxMenu
*
PopMenu
,
SCH_COMPONENT
*
Component
)
/**************************************************************************/
/* Add menu commands for a component
...
...
@@ -321,13 +321,13 @@ void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component )
if
(
LibEntry
&&
LibEntry
->
m_Options
!=
ENTRY_POWER
)
{
msg
=
AddHotkeyName
(
_
(
"Value "
),
s_Schematic_Hokeys_Descr
,
HK_EDIT_COMPONENT_VALUE
);
ADD_MENUITEM
(
editmenu
,
ID_POPUP_SCH_EDIT_VALUE_CMP
,
msg
,
edit_comp_value_xpm
);
msg
=
AddHotkeyName
(
_
(
"Value "
),
s_Schematic_Hokeys_Descr
,
HK_EDIT_COMPONENT_VALUE
);
ADD_MENUITEM
(
editmenu
,
ID_POPUP_SCH_EDIT_VALUE_CMP
,
msg
,
edit_comp_value_xpm
);
ADD_MENUITEM
(
editmenu
,
ID_POPUP_SCH_EDIT_REF_CMP
,
_
(
"Reference"
),
edit_comp_ref_xpm
);
msg
=
AddHotkeyName
(
_
(
"Footprint "
),
s_Schematic_Hokeys_Descr
,
HK_EDIT_COMPONENT_FOOTPRINT
);
ADD_MENUITEM
(
editmenu
,
ID_POPUP_SCH_EDIT_FOOTPRINT_CMP
,
msg
,
edit_comp_footprint_xpm
);
msg
=
AddHotkeyName
(
_
(
"Footprint "
),
s_Schematic_Hokeys_Descr
,
HK_EDIT_COMPONENT_FOOTPRINT
);
ADD_MENUITEM
(
editmenu
,
ID_POPUP_SCH_EDIT_FOOTPRINT_CMP
,
msg
,
edit_comp_footprint_xpm
);
}
if
(
LibEntry
&&
(
LookForConvertPart
(
LibEntry
)
>=
2
)
)
editmenu
->
Append
(
ID_POPUP_SCH_EDIT_CONVERT_CMP
,
_
(
"Convert"
)
);
...
...
@@ -363,7 +363,7 @@ void AddMenusForComponent( wxMenu* PopMenu, EDA_SchComponentStruct* Component )
/*******************************************************************/
void
AddMenusForGLabel
(
wxMenu
*
PopMenu
,
DrawGlobalLabelStruct
*
GLabel
)
void
AddMenusForGLabel
(
wxMenu
*
PopMenu
,
SCH_GLOBALLABEL
*
GLabel
)
/*******************************************************************/
/* Add menu commands for a Global Label
...
...
@@ -388,7 +388,7 @@ void AddMenusForGLabel( wxMenu* PopMenu, DrawGlobalLabelStruct* GLabel )
ID_POPUP_SCH_CHANGE_TYPE_TEXT
,
_
(
"Change Type"
),
gl_change_xpm
);
}
/*******************************************************************/
void
AddMenusForHLabel
(
wxMenu
*
PopMenu
,
DrawHierLabelStruct
*
HLabel
)
void
AddMenusForHLabel
(
wxMenu
*
PopMenu
,
SCH_HIERLABEL
*
HLabel
)
/*******************************************************************/
/* Add menu commands for a hierarchal Label
*/
...
...
@@ -414,7 +414,7 @@ void AddMenusForHLabel( wxMenu* PopMenu, DrawHierLabelStruct* HLabel )
/*****************************************************************/
void
AddMenusForLabel
(
wxMenu
*
PopMenu
,
DrawLabelStruct
*
Label
)
void
AddMenusForLabel
(
wxMenu
*
PopMenu
,
SCH_LABEL
*
Label
)
/*****************************************************************/
/* Add menu commands for a Label
...
...
@@ -441,7 +441,7 @@ void AddMenusForLabel( wxMenu* PopMenu, DrawLabelStruct* Label )
/*****************************************************************/
void
AddMenusForText
(
wxMenu
*
PopMenu
,
DrawTextStruct
*
Text
)
void
AddMenusForText
(
wxMenu
*
PopMenu
,
SCH_TEXT
*
Text
)
/*****************************************************************/
/* Add menu commands for a Text (a comment)
...
...
eeschema/plot.cpp
View file @
c406eed1
...
...
@@ -16,7 +16,7 @@
/* Variables locales : */
static
void
PlotSheetLabelStruct
(
DrawSheetLabelStruct
*
Struct
);
static
void
PlotTextField
(
EDA_SchComponentStruct
*
DrawLibItem
,
static
void
PlotTextField
(
SCH_COMPONENT
*
DrawLibItem
,
int
FieldNumber
,
int
IsMulti
,
int
DrawMode
);
static
void
PlotPinSymbol
(
int
posX
,
int
posY
,
int
len
,
int
orient
,
int
Shape
);
...
...
@@ -164,7 +164,7 @@ void PlotNoConnectStruct( DrawNoConnectStruct* Struct )
/*************************************************/
void
PlotLibPart
(
EDA_SchComponentStruct
*
DrawLibItem
)
void
PlotLibPart
(
SCH_COMPONENT
*
DrawLibItem
)
/*************************************************/
/* Genere le trace d'un composant */
{
...
...
@@ -342,7 +342,7 @@ void PlotLibPart( EDA_SchComponentStruct* DrawLibItem )
/*************************************************************/
static
void
PlotTextField
(
EDA_SchComponentStruct
*
DrawLibItem
,
static
void
PlotTextField
(
SCH_COMPONENT
*
DrawLibItem
,
int
FieldNumber
,
int
IsMulti
,
int
DrawMode
)
/**************************************************************/
...
...
@@ -553,22 +553,22 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
switch
(
Struct
->
Type
()
)
{
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
Text
=
(
(
DrawTextStruct
*
)
Struct
)
->
m_Text
;
Size
=
(
(
DrawTextStruct
*
)
Struct
)
->
m_Size
;
Orient
=
(
(
DrawTextStruct
*
)
Struct
)
->
m_Orient
;
Shape
=
(
(
DrawTextStruct
*
)
Struct
)
->
m_Shape
;
pX
=
(
(
DrawTextStruct
*
)
Struct
)
->
m_Pos
.
x
;
pY
=
(
(
DrawTextStruct
*
)
Struct
)
->
m_Pos
.
y
;
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_TEXT
:
Text
=
(
(
SCH_TEXT
*
)
Struct
)
->
m_Text
;
Size
=
(
(
SCH_TEXT
*
)
Struct
)
->
m_Size
;
Orient
=
(
(
SCH_TEXT
*
)
Struct
)
->
m_Orient
;
Shape
=
(
(
SCH_TEXT
*
)
Struct
)
->
m_Shape
;
pX
=
(
(
SCH_TEXT
*
)
Struct
)
->
m_Pos
.
x
;
pY
=
(
(
SCH_TEXT
*
)
Struct
)
->
m_Pos
.
y
;
offset
=
TXTMARGE
;
if
(
Struct
->
Type
()
==
DRAW_GLOBAL_LABEL_STRUCT_TYPE
||
Struct
->
Type
()
==
DRAW_HIER_LABEL_STRUCT_TYPE
)
if
(
Struct
->
Type
()
==
TYPE_SCH_GLOBALLABEL
||
Struct
->
Type
()
==
TYPE_SCH_HIERLABEL
)
offset
+=
Size
.
x
;
// We must draw the Glabel graphic symbol
if
(
(
g_PlotFormat
==
PLOT_FORMAT_POST
)
&&
g_PlotPSColorOpt
)
color
=
ReturnLayerColor
(
(
(
DrawTextStruct
*
)
Struct
)
->
m_Layer
);
color
=
ReturnLayerColor
(
(
(
SCH_TEXT
*
)
Struct
)
->
m_Layer
);
break
;
default
:
...
...
@@ -580,31 +580,31 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
SetCurrentLineWidth
(
-
1
);
if
(
Struct
->
Type
()
==
DRAW_GLOBAL_LABEL_STRUCT_TYPE
)
{
offset
=
(
(
DrawGlobalLabelStruct
*
)
Struct
)
->
m_Width
;
switch
(
Shape
)
{
case
NET_INPUT
:
case
NET_BIDI
:
case
NET_TRISTATE
:
offset
+=
Size
.
x
/
2
;
break
;
if
(
Struct
->
Type
()
==
TYPE_SCH_GLOBALLABEL
)
{
offset
=
(
(
SCH_GLOBALLABEL
*
)
Struct
)
->
m_Width
;
switch
(
Shape
)
{
case
NET_INPUT
:
case
NET_BIDI
:
case
NET_TRISTATE
:
offset
+=
Size
.
x
/
2
;
break
;
case
NET_OUTPUT
:
offset
+=
TXTMARGE
;
break
;
case
NET_OUTPUT
:
offset
+=
TXTMARGE
;
break
;
default
:
break
;
}
}
default
:
break
;
}
}
switch
(
Orient
)
{
case
0
:
/* Orientation horiz normale */
if
(
Struct
->
Type
()
==
DRAW_GLOBAL_LABEL_STRUCT_TYPE
||
Struct
->
Type
()
==
DRAW_HIER_LABEL_STRUCT_TYPE
)
if
(
Struct
->
Type
()
==
TYPE_SCH_GLOBALLABEL
||
Struct
->
Type
()
==
TYPE_SCH_HIERLABEL
)
PlotGraphicText
(
g_PlotFormat
,
wxPoint
(
pX
-
offset
,
pY
),
color
,
Text
,
TEXT_ORIENT_HORIZ
,
Size
,
GR_TEXT_HJUSTIFY_RIGHT
,
GR_TEXT_VJUSTIFY_CENTER
);
...
...
@@ -615,7 +615,7 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
break
;
case
1
:
/* Orientation vert UP */
if
(
Struct
->
Type
()
==
DRAW_GLOBAL_LABEL_STRUCT_TYPE
||
Struct
->
Type
()
==
DRAW_HIER_LABEL_STRUCT_TYPE
)
if
(
Struct
->
Type
()
==
TYPE_SCH_GLOBALLABEL
||
Struct
->
Type
()
==
TYPE_SCH_HIERLABEL
)
PlotGraphicText
(
g_PlotFormat
,
wxPoint
(
pX
,
pY
+
offset
),
color
,
Text
,
TEXT_ORIENT_VERT
,
Size
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_TOP
);
...
...
@@ -626,7 +626,7 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
break
;
case
2
:
/* Horiz Orientation - Right justified */
if
(
Struct
->
Type
()
==
DRAW_GLOBAL_LABEL_STRUCT_TYPE
||
Struct
->
Type
()
==
DRAW_HIER_LABEL_STRUCT_TYPE
)
if
(
Struct
->
Type
()
==
TYPE_SCH_GLOBALLABEL
||
Struct
->
Type
()
==
TYPE_SCH_HIERLABEL
)
PlotGraphicText
(
g_PlotFormat
,
wxPoint
(
pX
+
offset
,
pY
),
color
,
Text
,
TEXT_ORIENT_HORIZ
,
Size
,
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_VJUSTIFY_CENTER
);
...
...
@@ -637,7 +637,7 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
break
;
case
3
:
/* Orientation vert BOTTOM */
if
(
Struct
->
Type
()
==
DRAW_GLOBAL_LABEL_STRUCT_TYPE
||
Struct
->
Type
()
==
DRAW_HIER_LABEL_STRUCT_TYPE
)
if
(
Struct
->
Type
()
==
TYPE_SCH_GLOBALLABEL
||
Struct
->
Type
()
==
TYPE_SCH_HIERLABEL
)
PlotGraphicText
(
g_PlotFormat
,
wxPoint
(
pX
,
pY
-
offset
),
color
,
Text
,
TEXT_ORIENT_VERT
,
Size
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_BOTTOM
);
...
...
@@ -649,14 +649,14 @@ void PlotTextStruct( EDA_BaseStruct* Struct )
}
/* Draw graphic symbol for global or hierachical labels */
if
(
Struct
->
Type
()
==
DRAW_GLOBAL_LABEL_STRUCT_TYPE
)
if
(
Struct
->
Type
()
==
TYPE_SCH_GLOBALLABEL
)
{
(
(
DrawGlobalLabelStruct
*
)
Struct
)
->
CreateGraphicShape
(
Poly
,
wxPoint
(
pX
,
pY
)
);
(
(
SCH_GLOBALLABEL
*
)
Struct
)
->
CreateGraphicShape
(
Poly
,
wxPoint
(
pX
,
pY
)
);
PlotPoly
(
Poly
[
0
],
Poly
+
1
,
NOFILL
);
}
if
(
Struct
->
Type
()
==
DRAW_HIER_LABEL_STRUCT_TYPE
)
if
(
Struct
->
Type
()
==
TYPE_SCH_HIERLABEL
)
{
(
(
DrawHierLabelStruct
*
)
Struct
)
->
CreateGraphicShape
(
Poly
,
wxPoint
(
pX
,
pY
)
);
(
(
SCH_HIERLABEL
*
)
Struct
)
->
CreateGraphicShape
(
Poly
,
wxPoint
(
pX
,
pY
)
);
PlotPoly
(
Poly
[
0
],
Poly
+
1
,
NOFILL
);
}
}
...
...
eeschema/plothpgl.cpp
View file @
c406eed1
/////////////////////////////////////////////////////////////////////////////
// Name: plothpgl.cpp
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 04/02/2006 16:54:19
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 04/02/2006 16:54:19
...
...
@@ -62,34 +62,34 @@ static double Scale_Y = 1;
int
HPGL_SizeSelect
;
enum
PageFormatReq
{
PAGE_DEFAULT
=
0
,
PAGE_SIZE_A4
,
PAGE_SIZE_A3
,
PAGE_SIZE_A2
,
PAGE_SIZE_A1
,
PAGE_SIZE_A0
,
PAGE_SIZE_A
,
PAGE_SIZE_B
,
PAGE_SIZE_C
,
PAGE_SIZE_D
,
PAGE_SIZE_E
PAGE_DEFAULT
=
0
,
PAGE_SIZE_A4
,
PAGE_SIZE_A3
,
PAGE_SIZE_A2
,
PAGE_SIZE_A1
,
PAGE_SIZE_A0
,
PAGE_SIZE_A
,
PAGE_SIZE_B
,
PAGE_SIZE_C
,
PAGE_SIZE_D
,
PAGE_SIZE_E
};
static
Ki_PageDescr
*
Plot_sheet_list
[]
=
{
NULL
,
&
g_Sheet_A4
,
&
g_Sheet_A3
,
&
g_Sheet_A2
,
&
g_Sheet_A1
,
&
g_Sheet_A0
,
&
g_Sheet_A
,
&
g_Sheet_B
,
&
g_Sheet_C
,
&
g_Sheet_D
,
&
g_Sheet_E
,
&
g_Sheet_GERBER
,
&
g_Sheet_user
NULL
,
&
g_Sheet_A4
,
&
g_Sheet_A3
,
&
g_Sheet_A2
,
&
g_Sheet_A1
,
&
g_Sheet_A0
,
&
g_Sheet_A
,
&
g_Sheet_B
,
&
g_Sheet_C
,
&
g_Sheet_D
,
&
g_Sheet_E
,
&
g_Sheet_GERBER
,
&
g_Sheet_user
};
/* Routines Locales */
...
...
@@ -101,9 +101,9 @@ static Ki_PageDescr * Plot_sheet_list[] =
void
WinEDA_SchematicFrame
::
ToPlot_HPGL
(
wxCommandEvent
&
event
)
/**************************************************************/
{
WinEDA_PlotHPGLFrame
*
HPGL_frame
=
new
WinEDA_PlotHPGLFrame
(
this
);
HPGL_frame
->
ShowModal
();
HPGL_frame
->
Destroy
();
WinEDA_PlotHPGLFrame
*
HPGL_frame
=
new
WinEDA_PlotHPGLFrame
(
this
);
HPGL_frame
->
ShowModal
();
HPGL_frame
->
Destroy
();
}
/*!
...
...
@@ -149,9 +149,9 @@ WinEDA_PlotHPGLFrame::WinEDA_PlotHPGLFrame( )
WinEDA_PlotHPGLFrame
::
WinEDA_PlotHPGLFrame
(
WinEDA_DrawFrame
*
parent
,
wxWindowID
id
,
const
wxString
&
caption
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
{
m_Parent
=
parent
;
m_Parent
=
parent
;
Create
(
parent
,
id
,
caption
,
pos
,
size
,
style
);
SetPageOffsetValue
();
SetPageOffsetValue
();
}
/*!
...
...
@@ -187,8 +187,8 @@ bool WinEDA_PlotHPGLFrame::Create( wxWindow* parent, wxWindowID id, const wxStri
*/
void
WinEDA_PlotHPGLFrame
::
CreateControls
()
{
SetFont
(
*
g_DialogFont
);
{
SetFont
(
*
g_DialogFont
);
////@begin WinEDA_PlotHPGLFrame content construction
// Generated by DialogBlocks, 04/02/2006 16:54:19 (unregistered)
...
...
@@ -303,7 +303,7 @@ void WinEDA_PlotHPGLFrame::CreateControls()
void
WinEDA_PlotHPGLFrame
::
OnPlotHpglCurrentExecuteClick
(
wxCommandEvent
&
event
)
{
HPGL_Plot
(
event
);
HPGL_Plot
(
event
);
}
/*!
...
...
@@ -312,7 +312,7 @@ void WinEDA_PlotHPGLFrame::OnPlotHpglCurrentExecuteClick( wxCommandEvent& event
void
WinEDA_PlotHPGLFrame
::
OnPlotHpglAllExecuteClick
(
wxCommandEvent
&
event
)
{
HPGL_Plot
(
event
);
HPGL_Plot
(
event
);
}
/*!
...
...
@@ -324,7 +324,7 @@ void WinEDA_PlotHPGLFrame::OnCancelClick( wxCommandEvent& event )
////@begin wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame.
// Before editing this code, remove the block markers.
event
.
Skip
();
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame.
////@end wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL in WinEDA_PlotHPGLFrame.
}
/*!
...
...
@@ -333,7 +333,7 @@ void WinEDA_PlotHPGLFrame::OnCancelClick( wxCommandEvent& event )
void
WinEDA_PlotHPGLFrame
::
OnPlotAcceptOffsetClick
(
wxCommandEvent
&
event
)
{
AcceptPlotOffset
(
event
);
AcceptPlotOffset
(
event
);
}
/*!
...
...
@@ -378,24 +378,24 @@ void WinEDA_PlotHPGLFrame::SetPageOffsetValue()
/***************************************************/
{
wxString
msg
;
if
(
HPGL_SizeSelect
!=
PAGE_DEFAULT
)
{
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
x
,
EESCHEMA_INTERNAL_UNIT
);
m_PlotOrgPosition_X
->
SetValue
(
msg
);
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
y
,
EESCHEMA_INTERNAL_UNIT
);
m_PlotOrgPosition_Y
->
SetValue
(
msg
);
m_PlotOrgPosition_X
->
Enable
(
TRUE
);
m_PlotOrgPosition_Y
->
Enable
(
TRUE
);
}
else
{
m_PlotOrgPosition_X
->
Enable
(
FALSE
);
m_PlotOrgPosition_Y
->
Enable
(
FALSE
);
}
if
(
HPGL_SizeSelect
!=
PAGE_DEFAULT
)
{
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
x
,
EESCHEMA_INTERNAL_UNIT
);
m_PlotOrgPosition_X
->
SetValue
(
msg
);
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
y
,
EESCHEMA_INTERNAL_UNIT
);
m_PlotOrgPosition_Y
->
SetValue
(
msg
);
m_PlotOrgPosition_X
->
Enable
(
TRUE
);
m_PlotOrgPosition_Y
->
Enable
(
TRUE
);
}
else
{
m_PlotOrgPosition_X
->
Enable
(
FALSE
);
m_PlotOrgPosition_Y
->
Enable
(
FALSE
);
}
}
/*****************************************************************/
...
...
@@ -404,18 +404,18 @@ void WinEDA_PlotHPGLFrame::AcceptPlotOffset(wxCommandEvent& event)
{
int
ii
=
m_SizeOption
->
GetSelection
();
if
(
ii
<=
0
)
HPGL_SizeSelect
=
0
;
else
HPGL_SizeSelect
=
ii
;
if
(
HPGL_SizeSelect
!=
PAGE_DEFAULT
)
{
wxString
msg
=
m_PlotOrgPosition_X
->
GetValue
();
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
x
=
ReturnValueFromString
(
g_UnitMetric
,
msg
,
EESCHEMA_INTERNAL_UNIT
);
msg
=
m_PlotOrgPosition_Y
->
GetValue
();
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
y
=
ReturnValueFromString
(
g_UnitMetric
,
msg
,
EESCHEMA_INTERNAL_UNIT
);
}
if
(
ii
<=
0
)
HPGL_SizeSelect
=
0
;
else
HPGL_SizeSelect
=
ii
;
if
(
HPGL_SizeSelect
!=
PAGE_DEFAULT
)
{
wxString
msg
=
m_PlotOrgPosition_X
->
GetValue
();
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
x
=
ReturnValueFromString
(
g_UnitMetric
,
msg
,
EESCHEMA_INTERNAL_UNIT
);
msg
=
m_PlotOrgPosition_Y
->
GetValue
();
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
y
=
ReturnValueFromString
(
g_UnitMetric
,
msg
,
EESCHEMA_INTERNAL_UNIT
);
}
}
...
...
@@ -423,9 +423,9 @@ int ii = m_SizeOption->GetSelection();
void
WinEDA_PlotHPGLFrame
::
SetPenWidth
(
wxSpinEvent
&
event
)
/************************************************************/
{
g_HPGL_Pen_Descr
.
m_Pen_Diam
=
m_ButtPenWidth
->
GetValue
();
if
(
g_HPGL_Pen_Descr
.
m_Pen_Diam
>
100
)
g_HPGL_Pen_Descr
.
m_Pen_Diam
=
100
;
if
(
g_HPGL_Pen_Descr
.
m_Pen_Diam
<
1
)
g_HPGL_Pen_Descr
.
m_Pen_Diam
=
1
;
g_HPGL_Pen_Descr
.
m_Pen_Diam
=
m_ButtPenWidth
->
GetValue
();
if
(
g_HPGL_Pen_Descr
.
m_Pen_Diam
>
100
)
g_HPGL_Pen_Descr
.
m_Pen_Diam
=
100
;
if
(
g_HPGL_Pen_Descr
.
m_Pen_Diam
<
1
)
g_HPGL_Pen_Descr
.
m_Pen_Diam
=
1
;
}
...
...
@@ -433,18 +433,18 @@ void WinEDA_PlotHPGLFrame::SetPenWidth(wxSpinEvent & event)
void
WinEDA_PlotHPGLFrame
::
SetPenSpeed
(
wxSpinEvent
&
event
)
/*********************************************************/
{
g_HPGL_Pen_Descr
.
m_Pen_Speed
=
m_ButtPenSpeed
->
GetValue
();
if
(
g_HPGL_Pen_Descr
.
m_Pen_Speed
>
40
)
g_HPGL_Pen_Descr
.
m_Pen_Speed
=
40
;
if
(
g_HPGL_Pen_Descr
.
m_Pen_Speed
<
1
)
g_HPGL_Pen_Descr
.
m_Pen_Speed
=
1
;
g_HPGL_Pen_Descr
.
m_Pen_Speed
=
m_ButtPenSpeed
->
GetValue
();
if
(
g_HPGL_Pen_Descr
.
m_Pen_Speed
>
40
)
g_HPGL_Pen_Descr
.
m_Pen_Speed
=
40
;
if
(
g_HPGL_Pen_Descr
.
m_Pen_Speed
<
1
)
g_HPGL_Pen_Descr
.
m_Pen_Speed
=
1
;
}
/*******************************************************/
void
WinEDA_PlotHPGLFrame
::
SetPenNum
(
wxSpinEvent
&
event
)
/*******************************************************/
{
g_HPGL_Pen_Descr
.
m_Pen_Num
=
m_ButtPenNum
->
GetValue
();
if
(
g_HPGL_Pen_Descr
.
m_Pen_Num
>
8
)
g_HPGL_Pen_Descr
.
m_Pen_Num
=
8
;
if
(
g_HPGL_Pen_Descr
.
m_Pen_Num
<
1
)
g_HPGL_Pen_Descr
.
m_Pen_Num
=
1
;
g_HPGL_Pen_Descr
.
m_Pen_Num
=
m_ButtPenNum
->
GetValue
();
if
(
g_HPGL_Pen_Descr
.
m_Pen_Num
>
8
)
g_HPGL_Pen_Descr
.
m_Pen_Num
=
8
;
if
(
g_HPGL_Pen_Descr
.
m_Pen_Num
<
1
)
g_HPGL_Pen_Descr
.
m_Pen_Num
=
1
;
}
...
...
@@ -454,37 +454,37 @@ void WinEDA_PlotHPGLFrame::HPGL_Plot(wxCommandEvent& event)
{
int
Select_PlotAll
=
FALSE
;
if
(
event
.
GetId
()
==
ID_PLOT_HPGL_ALL_EXECUTE
)
Select_PlotAll
=
TRUE
;
if
(
event
.
GetId
()
==
ID_PLOT_HPGL_ALL_EXECUTE
)
Select_PlotAll
=
TRUE
;
if
(
HPGL_SizeSelect
)
{
wxString
msg
=
m_PlotOrgPosition_X
->
GetValue
();
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
x
=
ReturnValueFromString
(
g_UnitMetric
,
msg
,
EESCHEMA_INTERNAL_UNIT
);
msg
=
m_PlotOrgPosition_Y
->
GetValue
();
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
y
=
ReturnValueFromString
(
g_UnitMetric
,
msg
,
EESCHEMA_INTERNAL_UNIT
);
}
if
(
HPGL_SizeSelect
)
{
wxString
msg
=
m_PlotOrgPosition_X
->
GetValue
();
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
x
=
ReturnValueFromString
(
g_UnitMetric
,
msg
,
EESCHEMA_INTERNAL_UNIT
);
msg
=
m_PlotOrgPosition_Y
->
GetValue
();
Plot_sheet_list
[
HPGL_SizeSelect
]
->
m_Offset
.
y
=
ReturnValueFromString
(
g_UnitMetric
,
msg
,
EESCHEMA_INTERNAL_UNIT
);
}
Plot_Schematic_HPGL
(
Select_PlotAll
,
HPGL_SizeSelect
);
Plot_Schematic_HPGL
(
Select_PlotAll
,
HPGL_SizeSelect
);
}
/*******************************************************************/
void
WinEDA_PlotHPGLFrame
::
ReturnSheetDims
(
BASE_SCREEN
*
screen
,
wxSize
&
SheetSize
,
wxPoint
&
SheetOffset
)
wxSize
&
SheetSize
,
wxPoint
&
SheetOffset
)
/*******************************************************************/
/* Fonction calculant les dims et offsets de trace de la feuille selectionnee
retourne:
retourne:
*/
{
Ki_PageDescr
*
PlotSheet
;
if
(
screen
==
NULL
)
screen
=
m_Parent
->
GetScreen
();
if
(
screen
==
NULL
)
screen
=
m_Parent
->
GetScreen
();
PlotSheet
=
screen
->
m_CurrentSheetDesc
;
PlotSheet
=
screen
->
m_CurrentSheetDesc
;
SheetSize
=
PlotSheet
->
m_Size
;
SheetOffset
=
PlotSheet
->
m_Offset
;
SheetSize
=
PlotSheet
->
m_Size
;
SheetOffset
=
PlotSheet
->
m_Offset
;
}
/***********************************************************************************/
...
...
@@ -498,182 +498,182 @@ wxSize SheetSize;
wxPoint
SheetOffset
,
PlotOffset
;
int
margin
;
g_PlotFormat
=
PLOT_FORMAT_HPGL
;
/* Build the screen list */
EDA_ScreenList
ScreenList
;
if
(
Select_PlotAll
==
TRUE
)
screen
=
ScreenList
.
GetFirst
();
else
screen
=
m_Parent
->
GetScreen
();
for
(
;
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
{
ReturnSheetDims
(
screen
,
SheetSize
,
SheetOffset
);
/* Calcul des echelles de conversion */
g_PlotScaleX
=
Scale_X
*
SCALE_HPGL
;
g_PlotScaleY
=
Scale_Y
*
SCALE_HPGL
;
margin
=
400
;
// Margin in mils
PlotSheet
=
screen
->
m_CurrentSheetDesc
;
g_PlotScaleX
=
g_PlotScaleX
*
(
SheetSize
.
x
-
2
*
margin
)
/
PlotSheet
->
m_Size
.
x
;
g_PlotScaleY
=
g_PlotScaleY
*
(
SheetSize
.
y
-
2
*
margin
)
/
PlotSheet
->
m_Size
.
y
;
/* calcul des offsets */
PlotOffset
.
x
=
-
(
int
)(
SheetOffset
.
x
*
SCALE_HPGL
);
PlotOffset
.
y
=
(
int
)(
(
SheetOffset
.
y
+
SheetSize
.
y
)
*
SCALE_HPGL
);
PlotOffset
.
x
-=
(
int
)(
margin
*
SCALE_HPGL
);
PlotOffset
.
y
+=
(
int
)(
margin
*
SCALE_HPGL
);
wxSplitPath
(
screen
->
m_FileName
.
GetData
(),
(
wxString
*
)
NULL
,
&
ShortFileName
,
(
wxString
*
)
NULL
);
wxString
dirbuf
=
wxGetCwd
()
+
STRING_DIR_SEP
;
if
(
!
ShortFileName
.
IsEmpty
()
)
PlotFileName
=
MakeFileName
(
dirbuf
,
ShortFileName
,
wxT
(
".plt"
));
else
PlotFileName
=
MakeFileName
(
dirbuf
,
g_DefaultSchematicFileName
,
wxT
(
".plt"
));
setlocale
(
LC_NUMERIC
,
"C"
);
InitPlotParametresHPGL
(
PlotOffset
,
g_PlotScaleX
,
g_PlotScaleY
);
Plot_1_Page_HPGL
(
PlotFileName
,
screen
);
setlocale
(
LC_NUMERIC
,
""
);
screen
=
(
BASE_SCREEN
*
)
screen
->
Pnext
;
if
(
Select_PlotAll
==
FALSE
)
break
;
}
m_MsgBox
->
AppendText
(
_
(
"** Plot End **
\n
"
));
g_PlotFormat
=
PLOT_FORMAT_HPGL
;
/* Build the screen list */
EDA_ScreenList
ScreenList
;
if
(
Select_PlotAll
==
TRUE
)
screen
=
ScreenList
.
GetFirst
();
else
screen
=
m_Parent
->
GetScreen
();
for
(
;
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
{
ReturnSheetDims
(
screen
,
SheetSize
,
SheetOffset
);
/* Calcul des echelles de conversion */
g_PlotScaleX
=
Scale_X
*
SCALE_HPGL
;
g_PlotScaleY
=
Scale_Y
*
SCALE_HPGL
;
margin
=
400
;
// Margin in mils
PlotSheet
=
screen
->
m_CurrentSheetDesc
;
g_PlotScaleX
=
g_PlotScaleX
*
(
SheetSize
.
x
-
2
*
margin
)
/
PlotSheet
->
m_Size
.
x
;
g_PlotScaleY
=
g_PlotScaleY
*
(
SheetSize
.
y
-
2
*
margin
)
/
PlotSheet
->
m_Size
.
y
;
/* calcul des offsets */
PlotOffset
.
x
=
-
(
int
)(
SheetOffset
.
x
*
SCALE_HPGL
);
PlotOffset
.
y
=
(
int
)(
(
SheetOffset
.
y
+
SheetSize
.
y
)
*
SCALE_HPGL
);
PlotOffset
.
x
-=
(
int
)(
margin
*
SCALE_HPGL
);
PlotOffset
.
y
+=
(
int
)(
margin
*
SCALE_HPGL
);
wxSplitPath
(
screen
->
m_FileName
.
GetData
(),
(
wxString
*
)
NULL
,
&
ShortFileName
,
(
wxString
*
)
NULL
);
wxString
dirbuf
=
wxGetCwd
()
+
STRING_DIR_SEP
;
if
(
!
ShortFileName
.
IsEmpty
()
)
PlotFileName
=
MakeFileName
(
dirbuf
,
ShortFileName
,
wxT
(
".plt"
));
else
PlotFileName
=
MakeFileName
(
dirbuf
,
g_DefaultSchematicFileName
,
wxT
(
".plt"
));
setlocale
(
LC_NUMERIC
,
"C"
);
InitPlotParametresHPGL
(
PlotOffset
,
g_PlotScaleX
,
g_PlotScaleY
);
Plot_1_Page_HPGL
(
PlotFileName
,
screen
);
setlocale
(
LC_NUMERIC
,
""
);
screen
=
(
BASE_SCREEN
*
)
screen
->
Pnext
;
if
(
Select_PlotAll
==
FALSE
)
break
;
}
m_MsgBox
->
AppendText
(
_
(
"** Plot End **
\n
"
));
}
/**************************************************************************/
void
WinEDA_PlotHPGLFrame
::
Plot_1_Page_HPGL
(
const
wxString
&
FullFileName
,
BASE_SCREEN
*
screen
)
BASE_SCREEN
*
screen
)
/**************************************************************************/
/* Trace en format HPGL. d'une feuille de dessin
1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) .
1 unite HPGL = 0.98 mils ( 1 mil = 1.02041 unite HPGL ) .
*/
{
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
int
x1
=
0
,
y1
=
0
,
x2
=
0
,
y2
=
0
,
layer
;
wxString
msg
;
PlotOutput
=
wxFopen
(
FullFileName
,
wxT
(
"wt"
));
if
(
PlotOutput
==
0
)
{
msg
=
_
(
"Unable to create "
)
+
FullFileName
;
DisplayError
(
this
,
msg
);
return
;
}
msg
=
_
(
"Plot "
)
+
FullFileName
+
wxT
(
"
\n
"
);
m_MsgBox
->
AppendText
(
msg
);
/* Init : */
PrintHeaderHPGL
(
PlotOutput
,
g_HPGL_Pen_Descr
.
m_Pen_Speed
,
g_HPGL_Pen_Descr
.
m_Pen_Num
);
PlotWorkSheet
(
PLOT_FORMAT_HPGL
,
screen
);
DrawList
=
screen
->
EEDrawList
;
while
(
DrawList
)
/* tracage */
{
Plume
(
'U'
);
layer
=
LAYER_NOTES
;
switch
(
DrawList
->
Type
()
)
{
case
DRAW_BUSENTRY_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawBusEntryStruct*)DrawList)
x1
=
STRUCT
->
m_Pos
.
x
;
y1
=
STRUCT
->
m_Pos
.
y
;
x2
=
STRUCT
->
m_End
().
x
;
y2
=
STRUCT
->
m_End
().
y
;
layer
=
STRUCT
->
m_Layer
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList)
if
(
DrawList
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
{
x1
=
STRUCT
->
m_Start
.
x
;
y1
=
STRUCT
->
m_Start
.
y
;
x2
=
STRUCT
->
m_End
.
x
;
y2
=
STRUCT
->
m_End
.
y
;
layer
=
STRUCT
->
m_Layer
;
}
switch
(
layer
)
{
case
LAYER_NOTES
:
/* Trace en pointilles */
Move_Plume
(
wxPoint
(
x1
,
y1
),
'U'
);
fprintf
(
PlotOutput
,
"LT 2;
\n
"
);
Move_Plume
(
wxPoint
(
x2
,
y2
),
'D'
);
fprintf
(
PlotOutput
,
"LT;
\n
"
);
break
;
case
LAYER_BUS
:
/* Trait large */
{
int
deltaX
=
0
,
deltaY
=
0
;
double
angle
;
if
(
(
x2
-
x1
)
==
0
)
deltaX
=
8
;
else
if
(
(
y2
-
y1
)
==
0
)
deltaY
=
8
;
else
{
angle
=
atan2
(
(
double
)(
x2
-
x1
),
(
double
)(
y1
-
y2
)
);
deltaX
=
(
int
)(
8
*
sin
(
angle
)
);
deltaY
=
(
int
)(
8
*
cos
(
angle
)
);
}
Move_Plume
(
wxPoint
(
x1
+
deltaX
,
y1
-
deltaY
),
'U'
);
Move_Plume
(
wxPoint
(
x1
-
deltaX
,
y1
+
deltaY
),
'D'
);
Move_Plume
(
wxPoint
(
x2
-
deltaX
,
y2
+
deltaY
),
'D'
);
Move_Plume
(
wxPoint
(
x2
+
deltaX
,
y2
-
deltaY
),
'D'
);
Move_Plume
(
wxPoint
(
x1
+
deltaX
,
y1
-
deltaY
),
'D'
);
}
break
;
default
:
Move_Plume
(
wxPoint
(
x1
,
y1
),
'U'
);
Move_Plume
(
wxPoint
(
x2
,
y2
),
'D'
);
break
;
}
break
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawJunctionStruct*)DrawList)
x1
=
STRUCT
->
m_Pos
.
x
;
y1
=
STRUCT
->
m_Pos
.
y
;
PlotCercle
(
wxPoint
(
x1
,
y1
),
DRAWJUNCTION_SIZE
*
2
);
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
PlotTextStruct
(
DrawList
);
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
PlotLibPart
(
DrawLibItem
);
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
case
DRAW_POLYLINE_STRUCT_TYPE
:
break
;
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
break
;
case
DRAW_MARKER_STRUCT_TYPE
:
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawSheetStruct*)DrawList)
PlotSheetStruct
(
STRUCT
);
break
;
case
DRAW_NOCONNECT_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawNoConnectStruct*)DrawList)
PlotNoConnectStruct
(
STRUCT
);
break
;
default
:
break
;
}
Plume
(
'U'
);
DrawList
=
DrawList
->
Pnext
;
}
/* fin */
CloseFileHPGL
(
PlotOutput
);
PlotOutput
=
wxFopen
(
FullFileName
,
wxT
(
"wt"
));
if
(
PlotOutput
==
0
)
{
msg
=
_
(
"Unable to create "
)
+
FullFileName
;
DisplayError
(
this
,
msg
);
return
;
}
msg
=
_
(
"Plot "
)
+
FullFileName
+
wxT
(
"
\n
"
);
m_MsgBox
->
AppendText
(
msg
);
/* Init : */
PrintHeaderHPGL
(
PlotOutput
,
g_HPGL_Pen_Descr
.
m_Pen_Speed
,
g_HPGL_Pen_Descr
.
m_Pen_Num
);
PlotWorkSheet
(
PLOT_FORMAT_HPGL
,
screen
);
DrawList
=
screen
->
EEDrawList
;
while
(
DrawList
)
/* tracage */
{
Plume
(
'U'
);
layer
=
LAYER_NOTES
;
switch
(
DrawList
->
Type
()
)
{
case
DRAW_BUSENTRY_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawBusEntryStruct*)DrawList)
x1
=
STRUCT
->
m_Pos
.
x
;
y1
=
STRUCT
->
m_Pos
.
y
;
x2
=
STRUCT
->
m_End
().
x
;
y2
=
STRUCT
->
m_End
().
y
;
layer
=
STRUCT
->
m_Layer
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList)
if
(
DrawList
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
{
x1
=
STRUCT
->
m_Start
.
x
;
y1
=
STRUCT
->
m_Start
.
y
;
x2
=
STRUCT
->
m_End
.
x
;
y2
=
STRUCT
->
m_End
.
y
;
layer
=
STRUCT
->
m_Layer
;
}
switch
(
layer
)
{
case
LAYER_NOTES
:
/* Trace en pointilles */
Move_Plume
(
wxPoint
(
x1
,
y1
),
'U'
);
fprintf
(
PlotOutput
,
"LT 2;
\n
"
);
Move_Plume
(
wxPoint
(
x2
,
y2
),
'D'
);
fprintf
(
PlotOutput
,
"LT;
\n
"
);
break
;
case
LAYER_BUS
:
/* Trait large */
{
int
deltaX
=
0
,
deltaY
=
0
;
double
angle
;
if
(
(
x2
-
x1
)
==
0
)
deltaX
=
8
;
else
if
(
(
y2
-
y1
)
==
0
)
deltaY
=
8
;
else
{
angle
=
atan2
(
(
double
)(
x2
-
x1
),
(
double
)(
y1
-
y2
)
);
deltaX
=
(
int
)(
8
*
sin
(
angle
)
);
deltaY
=
(
int
)(
8
*
cos
(
angle
)
);
}
Move_Plume
(
wxPoint
(
x1
+
deltaX
,
y1
-
deltaY
),
'U'
);
Move_Plume
(
wxPoint
(
x1
-
deltaX
,
y1
+
deltaY
),
'D'
);
Move_Plume
(
wxPoint
(
x2
-
deltaX
,
y2
+
deltaY
),
'D'
);
Move_Plume
(
wxPoint
(
x2
+
deltaX
,
y2
-
deltaY
),
'D'
);
Move_Plume
(
wxPoint
(
x1
+
deltaX
,
y1
-
deltaY
),
'D'
);
}
break
;
default
:
Move_Plume
(
wxPoint
(
x1
,
y1
),
'U'
);
Move_Plume
(
wxPoint
(
x2
,
y2
),
'D'
);
break
;
}
break
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawJunctionStruct*)DrawList)
x1
=
STRUCT
->
m_Pos
.
x
;
y1
=
STRUCT
->
m_Pos
.
y
;
PlotCercle
(
wxPoint
(
x1
,
y1
),
DRAWJUNCTION_SIZE
*
2
);
break
;
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
PlotTextStruct
(
DrawList
);
break
;
case
TYPE_SCH_COMPONENT
:
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
PlotLibPart
(
DrawLibItem
);
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
case
DRAW_POLYLINE_STRUCT_TYPE
:
break
;
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
break
;
case
DRAW_MARKER_STRUCT_TYPE
:
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawSheetStruct*)DrawList)
PlotSheetStruct
(
STRUCT
);
break
;
case
DRAW_NOCONNECT_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawNoConnectStruct*)DrawList)
PlotNoConnectStruct
(
STRUCT
);
break
;
default
:
break
;
}
Plume
(
'U'
);
DrawList
=
DrawList
->
Pnext
;
}
/* fin */
CloseFileHPGL
(
PlotOutput
);
}
/*!
...
...
@@ -682,8 +682,8 @@ wxString msg;
void
WinEDA_PlotHPGLFrame
::
OnRadioboxSelected
(
wxCommandEvent
&
event
)
{
HPGL_SizeSelect
=
m_SizeOption
->
GetSelection
();
SetPageOffsetValue
();
HPGL_SizeSelect
=
m_SizeOption
->
GetSelection
();
SetPageOffsetValue
();
}
...
...
@@ -695,7 +695,7 @@ void WinEDA_PlotHPGLFrame::OnRadioboxSelected( wxCommandEvent& event )
void
WinEDA_PlotHPGLFrame
::
OnPenWidthUpdatedUpdated
(
wxSpinEvent
&
event
)
{
SetPenWidth
(
event
);
SetPenWidth
(
event
);
}
/*!
...
...
@@ -704,7 +704,7 @@ void WinEDA_PlotHPGLFrame::OnPenWidthUpdatedUpdated( wxSpinEvent& event )
void
WinEDA_PlotHPGLFrame
::
OnPenSpeedUpdatedUpdated
(
wxSpinEvent
&
event
)
{
SetPenSpeed
(
event
);
SetPenSpeed
(
event
);
}
/*!
...
...
@@ -713,6 +713,6 @@ void WinEDA_PlotHPGLFrame::OnPenSpeedUpdatedUpdated( wxSpinEvent& event )
void
WinEDA_PlotHPGLFrame
::
OnPenNumberUpdatedUpdated
(
wxSpinEvent
&
event
)
{
SetPenNum
(
event
);
SetPenNum
(
event
);
}
eeschema/plotps.cpp
View file @
c406eed1
/////////////////////////////////////////////////////////////////////////////
// Name: plotps.cpp
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 01/02/2006 08:37:24
// RCS-ID:
// RCS-ID:
// Copyright: GNU License
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 01/02/2006 08:37:24
...
...
@@ -47,9 +47,9 @@ extern void Move_Plume( wxPoint pos, int plume );
extern
void
Plume
(
int
plume
);
enum
PageFormatReq
{
PAGE_SIZE_AUTO
,
PAGE_SIZE_A4
,
PAGE_SIZE_A
PAGE_SIZE_AUTO
,
PAGE_SIZE_A4
,
PAGE_SIZE_A
};
...
...
@@ -76,10 +76,10 @@ void WinEDA_SchematicFrame::ToPlot_PS(wxCommandEvent& event)
{
wxPoint
pos
;
pos
=
GetPosition
();
pos
.
x
+=
10
;
pos
.
y
+=
20
;
WinEDA_PlotPSFrame
*
Ps_frame
=
new
WinEDA_PlotPSFrame
(
this
);
Ps_frame
->
ShowModal
();
Ps_frame
->
Destroy
();
pos
=
GetPosition
();
pos
.
x
+=
10
;
pos
.
y
+=
20
;
WinEDA_PlotPSFrame
*
Ps_frame
=
new
WinEDA_PlotPSFrame
(
this
);
Ps_frame
->
ShowModal
();
Ps_frame
->
Destroy
();
}
...
...
@@ -153,9 +153,9 @@ bool WinEDA_PlotPSFrame::Create( wxWindow* parent, wxWindowID id, const wxString
*/
void
WinEDA_PlotPSFrame
::
CreateControls
()
{
SetFont
(
*
g_DialogFont
);
{
SetFont
(
*
g_DialogFont
);
////@begin WinEDA_PlotPSFrame content construction
// Generated by DialogBlocks, 22/01/2007 11:32:43 (unregistered)
...
...
@@ -226,8 +226,8 @@ void WinEDA_PlotPSFrame::CreateControls()
m_Plot_Sheet_Ref
->
SetValidator
(
wxGenericValidator
(
&
Plot_Sheet_Ref
)
);
////@end WinEDA_PlotPSFrame content construction
m_DefaultLineSizeCtrl
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Default Line Width"
),
g_PlotPSMinimunLineWidth
,
g_UnitMetric
,
m_DefaultLineSizeCtrlSizer
,
EESCHEMA_INTERNAL_UNIT
);
m_DefaultLineSizeCtrl
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Default Line Width"
),
g_PlotPSMinimunLineWidth
,
g_UnitMetric
,
m_DefaultLineSizeCtrlSizer
,
EESCHEMA_INTERNAL_UNIT
);
}
...
...
@@ -273,9 +273,9 @@ void WinEDA_PlotPSFrame::OnPlotPsCurrentExecuteClick( wxCommandEvent& event )
{
int
Select_PlotAll
=
FALSE
;
InitOptVars
();
CreatePSFile
(
Select_PlotAll
,
PS_SizeSelect
);
m_MsgBox
->
AppendText
(
wxT
(
"*****
\n
"
));
InitOptVars
();
CreatePSFile
(
Select_PlotAll
,
PS_SizeSelect
);
m_MsgBox
->
AppendText
(
wxT
(
"*****
\n
"
));
}
...
...
@@ -287,9 +287,9 @@ void WinEDA_PlotPSFrame::OnPlotPsAllExecuteClick( wxCommandEvent& event )
{
int
Select_PlotAll
=
TRUE
;
InitOptVars
();
CreatePSFile
(
Select_PlotAll
,
PS_SizeSelect
);
m_MsgBox
->
AppendText
(
wxT
(
"*****
\n
"
));
InitOptVars
();
CreatePSFile
(
Select_PlotAll
,
PS_SizeSelect
);
m_MsgBox
->
AppendText
(
wxT
(
"*****
\n
"
));
}
...
...
@@ -299,7 +299,7 @@ int Select_PlotAll = TRUE;
void
WinEDA_PlotPSFrame
::
OnCloseClick
(
wxCommandEvent
&
event
)
{
InitOptVars
();
InitOptVars
();
Close
(
TRUE
);
}
...
...
@@ -308,14 +308,14 @@ void WinEDA_PlotPSFrame::OnCloseClick( wxCommandEvent& event )
void
WinEDA_PlotPSFrame
::
InitOptVars
()
/*****************************************/
{
Plot_Sheet_Ref
=
m_Plot_Sheet_Ref
->
GetValue
();
g_PlotPSColorOpt
=
m_PlotPSColorOption
->
GetSelection
();
PS_SizeSelect
=
m_SizeOption
->
GetSelection
();
g_PlotPSMinimunLineWidth
=
m_DefaultLineSizeCtrl
->
GetValue
();
if
(
g_PlotPSMinimunLineWidth
<
1
)
g_PlotPSMinimunLineWidth
=
1
;
Plot_Sheet_Ref
=
m_Plot_Sheet_Ref
->
GetValue
();
g_PlotPSColorOpt
=
m_PlotPSColorOption
->
GetSelection
();
PS_SizeSelect
=
m_SizeOption
->
GetSelection
();
g_PlotPSMinimunLineWidth
=
m_DefaultLineSizeCtrl
->
GetValue
();
if
(
g_PlotPSMinimunLineWidth
<
1
)
g_PlotPSMinimunLineWidth
=
1
;
}
/*************************************************************/
void
WinEDA_PlotPSFrame
::
CreatePSFile
(
int
AllPages
,
int
pagesize
)
...
...
@@ -327,193 +327,193 @@ Ki_PageDescr * PlotSheet, * RealSheet;
int
BBox
[
4
];
wxPoint
plot_offset
;
g_PlotFormat
=
PLOT_FORMAT_POST
;
/* Build the screen list */
EDA_ScreenList
ScreenList
;
if
(
AllPages
==
TRUE
)
screen
=
ScreenList
.
GetFirst
();
else
screen
=
ActiveScreen
;
for
(
;
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
{
PlotSheet
=
screen
->
m_CurrentSheetDesc
;
RealSheet
=
&
g_Sheet_A4
;
if
(
pagesize
==
PAGE_SIZE_AUTO
)
RealSheet
=
PlotSheet
;
else
if
(
pagesize
==
PAGE_SIZE_A
)
RealSheet
=
&
g_Sheet_A
;
/* Calcul des limites de trace en 1/1000 pouce */
BBox
[
0
]
=
BBox
[
1
]
=
g_PlotMargin
;
// Plot margin in 1/1000 inch
BBox
[
2
]
=
RealSheet
->
m_Size
.
x
-
g_PlotMargin
;
BBox
[
3
]
=
RealSheet
->
m_Size
.
y
-
g_PlotMargin
;
/* Calcul des echelles de conversion */
g_PlotScaleX
=
SCALE_PS
*
(
float
)
(
BBox
[
2
]
-
BBox
[
0
])
/
PlotSheet
->
m_Size
.
x
;
g_PlotScaleY
=
SCALE_PS
*
(
float
)
(
BBox
[
3
]
-
BBox
[
1
])
/
PlotSheet
->
m_Size
.
y
;
plot_offset
.
x
=
0
;
plot_offset
.
y
=
PlotSheet
->
m_Size
.
y
;
wxSplitPath
(
screen
->
m_FileName
.
GetData
(),
(
wxString
*
)
NULL
,
&
ShortFileName
,
(
wxString
*
)
NULL
);
wxString
dirbuf
=
wxGetCwd
()
+
STRING_DIR_SEP
;
if
(
!
ShortFileName
.
IsEmpty
()
)
PlotFileName
=
MakeFileName
(
dirbuf
,
ShortFileName
,
wxT
(
".ps"
));
else
PlotFileName
=
MakeFileName
(
dirbuf
,
g_DefaultSchematicFileName
,
wxT
(
".ps"
));
PlotOneSheetPS
(
PlotFileName
,
screen
,
RealSheet
,
BBox
,
plot_offset
);
screen
=
(
BASE_SCREEN
*
)
screen
->
Pnext
;
if
(
AllPages
==
FALSE
)
break
;
}
g_PlotFormat
=
PLOT_FORMAT_POST
;
/* Build the screen list */
EDA_ScreenList
ScreenList
;
if
(
AllPages
==
TRUE
)
screen
=
ScreenList
.
GetFirst
();
else
screen
=
ActiveScreen
;
for
(
;
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
{
PlotSheet
=
screen
->
m_CurrentSheetDesc
;
RealSheet
=
&
g_Sheet_A4
;
if
(
pagesize
==
PAGE_SIZE_AUTO
)
RealSheet
=
PlotSheet
;
else
if
(
pagesize
==
PAGE_SIZE_A
)
RealSheet
=
&
g_Sheet_A
;
/* Calcul des limites de trace en 1/1000 pouce */
BBox
[
0
]
=
BBox
[
1
]
=
g_PlotMargin
;
// Plot margin in 1/1000 inch
BBox
[
2
]
=
RealSheet
->
m_Size
.
x
-
g_PlotMargin
;
BBox
[
3
]
=
RealSheet
->
m_Size
.
y
-
g_PlotMargin
;
/* Calcul des echelles de conversion */
g_PlotScaleX
=
SCALE_PS
*
(
float
)
(
BBox
[
2
]
-
BBox
[
0
])
/
PlotSheet
->
m_Size
.
x
;
g_PlotScaleY
=
SCALE_PS
*
(
float
)
(
BBox
[
3
]
-
BBox
[
1
])
/
PlotSheet
->
m_Size
.
y
;
plot_offset
.
x
=
0
;
plot_offset
.
y
=
PlotSheet
->
m_Size
.
y
;
wxSplitPath
(
screen
->
m_FileName
.
GetData
(),
(
wxString
*
)
NULL
,
&
ShortFileName
,
(
wxString
*
)
NULL
);
wxString
dirbuf
=
wxGetCwd
()
+
STRING_DIR_SEP
;
if
(
!
ShortFileName
.
IsEmpty
()
)
PlotFileName
=
MakeFileName
(
dirbuf
,
ShortFileName
,
wxT
(
".ps"
));
else
PlotFileName
=
MakeFileName
(
dirbuf
,
g_DefaultSchematicFileName
,
wxT
(
".ps"
));
PlotOneSheetPS
(
PlotFileName
,
screen
,
RealSheet
,
BBox
,
plot_offset
);
screen
=
(
BASE_SCREEN
*
)
screen
->
Pnext
;
if
(
AllPages
==
FALSE
)
break
;
}
}
/*****************************************************************************************/
void
WinEDA_PlotPSFrame
::
PlotOneSheetPS
(
const
wxString
&
FileName
,
BASE_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
int
BBox
[
4
],
wxPoint
plot_offset
)
BASE_SCREEN
*
screen
,
Ki_PageDescr
*
sheet
,
int
BBox
[
4
],
wxPoint
plot_offset
)
/*****************************************************************************************/
/* Trace en format PS. d'une feuille de dessin
*/
{
wxString
Line
;
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
DrawLibItem
;
SCH_COMPONENT
*
DrawLibItem
;
int
layer
;
wxPoint
StartPos
,
EndPos
;
PlotOutput
=
wxFopen
(
FileName
,
wxT
(
"wt"
));
if
(
PlotOutput
==
NULL
)
{
Line
=
wxT
(
"
\n
** "
);
Line
+=
_
(
"Unable to create "
)
+
FileName
+
wxT
(
" **
\n\n
"
);
m_MsgBox
->
AppendText
(
Line
);
wxBell
();
return
;
}
setlocale
(
LC_NUMERIC
,
"C"
);
Line
.
Printf
(
_
(
"Plot: %s
\n
"
),
FileName
.
GetData
())
;
m_MsgBox
->
AppendText
(
Line
);
InitPlotParametresPS
(
plot_offset
,
sheet
,
g_PlotScaleX
,
g_PlotScaleY
);
SetDefaultLineWidthPS
(
g_PlotPSMinimunLineWidth
);
/* Init : */
PrintHeaderPS
(
PlotOutput
,
wxT
(
"EESchema-PS"
),
FileName
,
1
,
BBox
,
wxLANDSCAPE
);
InitPlotParametresPS
(
plot_offset
,
sheet
,
1.0
,
1.0
);
if
(
m_Plot_Sheet_Ref
->
GetValue
()
)
{
if
(
(
g_PlotFormat
==
PLOT_FORMAT_POST
)
&&
g_PlotPSColorOpt
)
SetColorMapPS
(
BLACK
);
PlotWorkSheet
(
PLOT_FORMAT_POST
,
screen
);
}
DrawList
=
screen
->
EEDrawList
;
while
(
DrawList
)
/* tracage */
{
Plume
(
'U'
);
layer
=
LAYER_NOTES
;
switch
(
DrawList
->
Type
()
)
{
case
DRAW_BUSENTRY_STRUCT_TYPE
:
/* Struct Raccord et Segment sont identiques */
#undef STRUCT
#define STRUCT ((DrawBusEntryStruct*)DrawList)
StartPos
=
STRUCT
->
m_Pos
;
EndPos
=
STRUCT
->
m_End
();
layer
=
STRUCT
->
m_Layer
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList)
if
(
DrawList
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
{
StartPos
=
STRUCT
->
m_Start
;
EndPos
=
STRUCT
->
m_End
;
layer
=
STRUCT
->
m_Layer
;
}
if
(
g_PlotPSColorOpt
)
SetColorMapPS
(
ReturnLayerColor
(
layer
)
);
switch
(
layer
)
{
case
LAYER_NOTES
:
/* Trace en pointilles */
SetCurrentLineWidth
(
-
1
);
fprintf
(
PlotOutput
,
"[50 50] 0 setdash
\n
"
);
Move_Plume
(
StartPos
,
'U'
);
Move_Plume
(
EndPos
,
'D'
);
fprintf
(
PlotOutput
,
"[] 0 setdash
\n
"
);
break
;
case
LAYER_BUS
:
/* Trait large */
{
fprintf
(
PlotOutput
,
"%d setlinewidth
\n
"
,
g_PlotPSMinimunLineWidth
*
3
);
Move_Plume
(
StartPos
,
'U'
);
Move_Plume
(
EndPos
,
'D'
);
fprintf
(
PlotOutput
,
"%d setlinewidth
\n
"
,
g_PlotPSMinimunLineWidth
);
}
break
;
default
:
SetCurrentLineWidth
(
-
1
);
Move_Plume
(
StartPos
,
'U'
);
Move_Plume
(
EndPos
,
'D'
);
break
;
}
break
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawJunctionStruct*)DrawList)
if
(
g_PlotPSColorOpt
)
SetColorMapPS
(
ReturnLayerColor
(
STRUCT
->
m_Layer
)
);
PlotCercle
(
STRUCT
->
m_Pos
,
DRAWJUNCTION_SIZE
);
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
PlotTextStruct
(
DrawList
);
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
PlotLibPart
(
DrawLibItem
);
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
case
DRAW_POLYLINE_STRUCT_TYPE
:
break
;
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
break
;
case
DRAW_MARKER_STRUCT_TYPE
:
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawSheetStruct*)DrawList)
PlotSheetStruct
(
STRUCT
);
break
;
case
DRAW_NOCONNECT_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawNoConnectStruct*)DrawList)
if
(
g_PlotPSColorOpt
)
SetColorMapPS
(
ReturnLayerColor
(
LAYER_NOCONNECT
)
);
PlotNoConnectStruct
(
STRUCT
);
break
;
default
:
break
;
}
Plume
(
'U'
);
DrawList
=
DrawList
->
Pnext
;
}
/* fin */
CloseFilePS
(
PlotOutput
);
setlocale
(
LC_NUMERIC
,
""
);
m_MsgBox
->
AppendText
(
wxT
(
"Ok
\n
"
));
PlotOutput
=
wxFopen
(
FileName
,
wxT
(
"wt"
));
if
(
PlotOutput
==
NULL
)
{
Line
=
wxT
(
"
\n
** "
);
Line
+=
_
(
"Unable to create "
)
+
FileName
+
wxT
(
" **
\n\n
"
);
m_MsgBox
->
AppendText
(
Line
);
wxBell
();
return
;
}
setlocale
(
LC_NUMERIC
,
"C"
);
Line
.
Printf
(
_
(
"Plot: %s
\n
"
),
FileName
.
GetData
())
;
m_MsgBox
->
AppendText
(
Line
);
InitPlotParametresPS
(
plot_offset
,
sheet
,
g_PlotScaleX
,
g_PlotScaleY
);
SetDefaultLineWidthPS
(
g_PlotPSMinimunLineWidth
);
/* Init : */
PrintHeaderPS
(
PlotOutput
,
wxT
(
"EESchema-PS"
),
FileName
,
1
,
BBox
,
wxLANDSCAPE
);
InitPlotParametresPS
(
plot_offset
,
sheet
,
1.0
,
1.0
);
if
(
m_Plot_Sheet_Ref
->
GetValue
()
)
{
if
(
(
g_PlotFormat
==
PLOT_FORMAT_POST
)
&&
g_PlotPSColorOpt
)
SetColorMapPS
(
BLACK
);
PlotWorkSheet
(
PLOT_FORMAT_POST
,
screen
);
}
DrawList
=
screen
->
EEDrawList
;
while
(
DrawList
)
/* tracage */
{
Plume
(
'U'
);
layer
=
LAYER_NOTES
;
switch
(
DrawList
->
Type
()
)
{
case
DRAW_BUSENTRY_STRUCT_TYPE
:
/* Struct Raccord et Segment sont identiques */
#undef STRUCT
#define STRUCT ((DrawBusEntryStruct*)DrawList)
StartPos
=
STRUCT
->
m_Pos
;
EndPos
=
STRUCT
->
m_End
();
layer
=
STRUCT
->
m_Layer
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList)
if
(
DrawList
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
{
StartPos
=
STRUCT
->
m_Start
;
EndPos
=
STRUCT
->
m_End
;
layer
=
STRUCT
->
m_Layer
;
}
if
(
g_PlotPSColorOpt
)
SetColorMapPS
(
ReturnLayerColor
(
layer
)
);
switch
(
layer
)
{
case
LAYER_NOTES
:
/* Trace en pointilles */
SetCurrentLineWidth
(
-
1
);
fprintf
(
PlotOutput
,
"[50 50] 0 setdash
\n
"
);
Move_Plume
(
StartPos
,
'U'
);
Move_Plume
(
EndPos
,
'D'
);
fprintf
(
PlotOutput
,
"[] 0 setdash
\n
"
);
break
;
case
LAYER_BUS
:
/* Trait large */
{
fprintf
(
PlotOutput
,
"%d setlinewidth
\n
"
,
g_PlotPSMinimunLineWidth
*
3
);
Move_Plume
(
StartPos
,
'U'
);
Move_Plume
(
EndPos
,
'D'
);
fprintf
(
PlotOutput
,
"%d setlinewidth
\n
"
,
g_PlotPSMinimunLineWidth
);
}
break
;
default
:
SetCurrentLineWidth
(
-
1
);
Move_Plume
(
StartPos
,
'U'
);
Move_Plume
(
EndPos
,
'D'
);
break
;
}
break
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawJunctionStruct*)DrawList)
if
(
g_PlotPSColorOpt
)
SetColorMapPS
(
ReturnLayerColor
(
STRUCT
->
m_Layer
)
);
PlotCercle
(
STRUCT
->
m_Pos
,
DRAWJUNCTION_SIZE
);
break
;
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
PlotTextStruct
(
DrawList
);
break
;
case
TYPE_SCH_COMPONENT
:
DrawLibItem
=
(
SCH_COMPONENT
*
)
DrawList
;
PlotLibPart
(
DrawLibItem
);
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
case
DRAW_POLYLINE_STRUCT_TYPE
:
break
;
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
break
;
case
DRAW_MARKER_STRUCT_TYPE
:
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawSheetStruct*)DrawList)
PlotSheetStruct
(
STRUCT
);
break
;
case
DRAW_NOCONNECT_STRUCT_TYPE
:
#undef STRUCT
#define STRUCT ((DrawNoConnectStruct*)DrawList)
if
(
g_PlotPSColorOpt
)
SetColorMapPS
(
ReturnLayerColor
(
LAYER_NOCONNECT
)
);
PlotNoConnectStruct
(
STRUCT
);
break
;
default
:
break
;
}
Plume
(
'U'
);
DrawList
=
DrawList
->
Pnext
;
}
/* fin */
CloseFilePS
(
PlotOutput
);
setlocale
(
LC_NUMERIC
,
""
);
m_MsgBox
->
AppendText
(
wxT
(
"Ok
\n
"
));
}
eeschema/protos.h
View file @
c406eed1
...
...
@@ -4,9 +4,9 @@
void
FreeLibraryEntry
(
LibCmpEntry
*
Entry
);
LibEDA_BaseStruct
*
LocatePin
(
const
wxPoint
&
RefPos
,
EDA_LibComponentStruct
*
Entry
,
int
Unit
,
int
Convert
,
EDA_SchComponentStruct
*
DrawItem
=
NULL
);
/* Routine de localisation d'une PIN de la PartLib pointee par Entry */
EDA_LibComponentStruct
*
Entry
,
int
Unit
,
int
Convert
,
SCH_COMPONENT
*
DrawItem
=
NULL
);
/* Routine de localisation d'une PIN de la PartLib pointee par Entry */
const
wxString
&
ReturnDefaultFieldName
(
int
aFieldNdx
);
...
...
@@ -20,7 +20,7 @@ const wxString& ReturnDefaultFieldName( int aFieldNdx );
/****************/
void
DisplayCmpDoc
(
wxString
&
Name
);
bool
DataBaseGetName
(
WinEDA_DrawFrame
*
frame
,
wxString
&
Keys
,
wxString
&
BufName
);
wxString
&
Keys
,
wxString
&
BufName
);
/*********************/
/* DANGLING_ENDS.CPP */
...
...
@@ -36,12 +36,12 @@ void IncrementLabelMember(wxString & name);
/* EDITPART.CPP */
/****************/
void
InstallCmpeditFrame
(
WinEDA_SchematicFrame
*
parent
,
wxPoint
&
pos
,
EDA_SchComponentStruct
*
m_Cmp
);
SCH_COMPONENT
*
m_Cmp
);
/**************/
/* EELIBS2.CPP */
/**************/
/**************/
/* EELIBS2.CPP */
/**************/
/* Functions common to all EELibs?.c modules: */
int
LibraryEntryCompare
(
EDA_LibComponentStruct
*
LE1
,
EDA_LibComponentStruct
*
LE2
);
...
...
@@ -49,162 +49,162 @@ int NumOfLibraries();
EDA_LibComponentStruct
*
FindLibPart
(
const
wxChar
*
Name
,
const
wxString
&
LibName
,
int
Alias
);
void
DrawingLibInGhost
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_LibComponentStruct
*
LibEntry
,
EDA_SchComponentStruct
*
DrawLibItem
,
int
PartX
,
int
PartY
,
int
Multi
,
int
convert
,
int
Color
,
bool
DrawPinText
);
SCH_COMPONENT
*
DrawLibItem
,
int
PartX
,
int
PartY
,
int
Multi
,
int
convert
,
int
Color
,
bool
DrawPinText
);
void
DrawLibEntry
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_LibComponentStruct
*
LibEntry
,
int
posX
,
int
posY
,
int
Multi
,
int
convert
,
int
DrawMode
,
int
Color
=
-
1
);
EDA_LibComponentStruct
*
LibEntry
,
int
posX
,
int
posY
,
int
Multi
,
int
convert
,
int
DrawMode
,
int
Color
=
-
1
);
void
DrawLibraryDrawStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_LibComponentStruct
*
LibEntry
,
int
PartX
,
int
PartY
,
LibEDA_BaseStruct
*
DrawItem
,
int
Multi
,
int
DrawMode
,
int
Color
=
-
1
);
EDA_LibComponentStruct
*
LibEntry
,
int
PartX
,
int
PartY
,
LibEDA_BaseStruct
*
DrawItem
,
int
Multi
,
int
DrawMode
,
int
Color
=
-
1
);
bool
MapAngles
(
int
*
Angle1
,
int
*
Angle2
,
int
TransMat
[
2
][
2
]);
/**************/
/* EELIBS1.CPP */
/**************/
/**************/
/* EELIBS1.CPP */
/**************/
EDA_LibComponentStruct
*
Read_Component_Definition
(
WinEDA_DrawFrame
*
frame
,
char
*
Line
,
FILE
*
f
,
int
*
LineNum
);
FILE
*
f
,
int
*
LineNum
);
/* Routine to Read a DEF/ENDDEF part entry from given open file. */
LibraryStruct
*
FindLibrary
(
const
wxString
&
Name
);
int
LoadDocLib
(
WinEDA_DrawFrame
*
frame
,
const
wxString
&
FullDocLibName
,
const
wxString
&
Libname
);
PriorQue
*
LoadLibraryAux
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
library
,
FILE
*
f
,
int
*
NumOfParts
);
FILE
*
f
,
int
*
NumOfParts
);
LibraryStruct
*
LoadLibraryName
(
WinEDA_DrawFrame
*
frame
,
const
wxString
&
FullLibName
,
const
wxString
&
LibName
);
const
wxString
&
FullLibName
,
const
wxString
&
LibName
);
void
LoadLibraries
(
WinEDA_DrawFrame
*
frame
);
void
FreeCmpLibrary
(
wxWindow
*
frame
,
const
wxString
&
LibName
);
const
wxChar
**
GetLibNames
();
void
SnapLibItemPoint
(
int
OrigX
,
int
OrigY
,
int
*
ClosestX
,
int
*
ClosestY
,
EDA_SchComponentStruct
*
DrawLibItem
);
SCH_COMPONENT
*
DrawLibItem
);
bool
LibItemInBox
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
EDA_SchComponentStruct
*
DrawLibItem
);
SCH_COMPONENT
*
DrawLibItem
);
void
DrawTextField
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
PartTextStruct
*
Field
,
int
IsMulti
,
int
DrawMode
);
/* Routine de trace des textes type Field du composant.
entree:
Field: champ
IsMulti: flag Non Null si il y a plusieurs parts par boitier.
n'est utile que pour le champ reference pour ajouter a celui ci
l'identification de la part ( A, B ... )
DrawMode: mode de trace */
/* Routine de trace des textes type Field du composant.
entree:
Field: champ
IsMulti: flag Non Null si il y a plusieurs parts par boitier.
n'est utile que pour le champ reference pour ajouter a celui ci
l'identification de la part ( A, B ... )
DrawMode: mode de trace */
char
*
StrPurge
(
char
*
text
);
/* Supprime les caracteres Space en debut de la ligne text
retourne un pointeur sur le 1er caractere non Space de text */
/* Supprime les caracteres Space en debut de la ligne text
retourne un pointeur sur le 1er caractere non Space de text */
/************/
/* BLOCK.CPP */
/************/
/************/
/* BLOCK.CPP */
/************/
EDA_BaseStruct
*
DuplicateStruct
(
EDA_BaseStruct
*
DrawStruct
);
void
MoveOneStruct
(
EDA_BaseStruct
*
DrawStructs
,
const
wxPoint
&
move_vector
);
/* Given a structure move it by move_vector.x, move_vector.y. */
/* Given a structure move it by move_vector.x, move_vector.y. */
bool
PlaceStruct
(
BASE_SCREEN
*
screen
,
EDA_BaseStruct
*
DrawStruct
);
bool
MoveStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_BaseStruct
*
DrawStruct
);
void
DeleteStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_BaseStruct
*
DrawStruct
);
bool
DrawStructInBox
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
EDA_BaseStruct
*
DrawStruct
);
EDA_BaseStruct
*
DrawStruct
);
/*************/
/* LOCATE.CPP */
/*************/
/*************/
/* LOCATE.CPP */
/*************/
LibDrawPin
*
LocatePinByNumber
(
const
wxString
&
ePin_Number
,
EDA_SchComponentStruct
*
eComponent
);
SCH_COMPONENT
*
eComponent
);
EDA_SchComponentStruct
*
LocateSmallestComponent
(
SCH_SCREEN
*
Screen
);
SCH_COMPONENT
*
LocateSmallestComponent
(
SCH_SCREEN
*
Screen
);
/* Recherche du plus petit (en surface) composant pointe par la souris */
EDA_BaseStruct
*
PickStruct
(
EDA_Rect
&
block
,
BASE_SCREEN
*
screen
,
int
SearchMask
);
BASE_SCREEN
*
screen
,
int
SearchMask
);
EDA_BaseStruct
*
PickStruct
(
const
wxPoint
&
refpos
,
BASE_SCREEN
*
screen
,
int
SearchMask
);
BASE_SCREEN
*
screen
,
int
SearchMask
);
/* 2 functions EDA_BaseStruct * PickStruct:
Search in block, or Serach at location pos
SearchMask = (bitwise OR):
LIBITEM
WIREITEM
BUSITEM
RACCORDITEM
JUNCTIONITEM
DRAWITEM
TEXTITEM
LABELITEM
SHEETITEM
MARKERITEM
NOCONNECTITEM
SEARCH_PINITEM
SHEETLABELITEM
FIELDCMPITEM
if EXCLUDE_WIRE_BUS_ENDPOINTS is set, in wire ou bus search and locate,
start and end points are not included in search
if WIRE_BUS_ENDPOINTS_ONLY is set, in wire ou bus search and locate,
only start and end points are included in search
Return:
-Bloc searc:
pointeur sur liste de pointeurs de structures si Plusieurs
structures selectionnees.
pointeur sur la structure si 1 seule
Positon serach:
pointeur sur la structure.
Si pas de structures selectionnees: retourne NULL */
Search in block, or Serach at location pos
SearchMask = (bitwise OR):
LIBITEM
WIREITEM
BUSITEM
RACCORDITEM
JUNCTIONITEM
DRAWITEM
TEXTITEM
LABELITEM
SHEETITEM
MARKERITEM
NOCONNECTITEM
SEARCH_PINITEM
SHEETLABELITEM
FIELDCMPITEM
if EXCLUDE_WIRE_BUS_ENDPOINTS is set, in wire ou bus search and locate,
start and end points are not included in search
if WIRE_BUS_ENDPOINTS_ONLY is set, in wire ou bus search and locate,
only start and end points are included in search
Return:
-Bloc searc:
pointeur sur liste de pointeurs de structures si Plusieurs
structures selectionnees.
pointeur sur la structure si 1 seule
Positon serach:
pointeur sur la structure.
Si pas de structures selectionnees: retourne NULL */
LibEDA_BaseStruct
*
LocateDrawItem
(
SCH_SCREEN
*
Screen
,
const
wxPoint
&
refpoint
,
EDA_LibComponentStruct
*
LibEntry
,
int
Unit
,
int
Convert
,
int
masque
);
EDA_LibComponentStruct
*
LibEntry
,
int
Unit
,
int
Convert
,
int
masque
);
DrawSheetLabelStruct
*
LocateSheetLabel
(
DrawSheetStruct
*
Sheet
,
const
wxPoint
&
pos
);
LibDrawPin
*
LocateAnyPin
(
EDA_BaseStruct
*
DrawList
,
const
wxPoint
&
RefPos
,
EDA_SchComponentStruct
**
libpart
=
NULL
);
SCH_COMPONENT
**
libpart
=
NULL
);
DrawSheetLabelStruct
*
LocateAnyPinSheet
(
const
wxPoint
&
RefPos
,
EDA_BaseStruct
*
DrawList
);
EDA_BaseStruct
*
DrawList
);
int
distance
(
int
dx
,
int
dy
,
int
spot_cX
,
int
spot_cY
,
int
seuil
);
/* Calcul de la distance du point spot_cx,spot_cy a un segment de droite,
d'origine 0,0 et d'extremite dx, dy;
retourne:
0 si distance > seuil
1 si distance <= seuil
Variables utilisees ( sont ramenees au repere centre sur l'origine du segment)
dx, dy = coord de l'extremite segment.
spot_cX,spot_cY = coord du curseur souris
la recherche se fait selon 4 cas:
segment horizontal
segment vertical
segment quelconque */
/* Calcul de la distance du point spot_cx,spot_cy a un segment de droite,
d'origine 0,0 et d'extremite dx, dy;
retourne:
0 si distance > seuil
1 si distance <= seuil
Variables utilisees ( sont ramenees au repere centre sur l'origine du segment)
dx, dy = coord de l'extremite segment.
spot_cX,spot_cY = coord du curseur souris
la recherche se fait selon 4 cas:
segment horizontal
segment vertical
segment quelconque */
/***************/
/* EEREDRAW.CPP */
/***************/
void
DrawDanglingSymbol
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
pos
,
int
Color
);
const
wxPoint
&
pos
,
int
Color
);
void
Draw_Marqueur
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
wxPoint
pos
,
char
*
pt_bitmap
,
int
DrawMode
,
int
Color
);
wxPoint
pos
,
char
*
pt_bitmap
,
int
DrawMode
,
int
Color
);
void
DrawStructsInGhost
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_BaseStruct
*
DrawStruct
,
int
dx
,
int
dy
);
EDA_BaseStruct
*
DrawStruct
,
int
dx
,
int
dy
);
void
SetHighLightStruct
(
EDA_BaseStruct
*
HighLight
);
void
RedrawActiveWindow
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
);
void
RedrawStructList
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_BaseStruct
*
Structs
,
int
DrawMode
,
int
Color
=
-
1
);
int
Color
=
-
1
);
void
RedrawOneStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_BaseStruct
*
Struct
,
int
DrawMode
,
int
Color
=
-
1
);
int
Color
=
-
1
);
/**************/
/* EELAYER.CPP */
...
...
@@ -236,53 +236,53 @@ bool Read_Hotkey_Config( WinEDA_DrawFrame * frame, bool verbose );
/**************/
LibEDA_BaseStruct
*
CopyDrawEntryStruct
(
wxWindow
*
frame
,
LibEDA_BaseStruct
*
DrawItem
);
/* Routine de Duplication d'une structure DrawLibItem d'une partlib
Parametres d'entree:
DrawEntry = pointeur sur la structure a dupliquer
La structure nouvelle est creee, mais n'est pas inseree dans le
chainage
Retourne:
Pointeur sur la structure creee (ou NULL si impossible) */
/* Routine de Duplication d'une structure DrawLibItem d'une partlib
Parametres d'entree:
DrawEntry = pointeur sur la structure a dupliquer
La structure nouvelle est creee, mais n'est pas inseree dans le
chainage
Retourne:
Pointeur sur la structure creee (ou NULL si impossible) */
int
WriteOneLibEntry
(
wxWindow
*
frame
,
FILE
*
ExportFile
,
EDA_LibComponentStruct
*
LibEntry
);
/* Routine d'ecriture du composant pointe par LibEntry
dans le fichier ExportFile( qui doit etre deja ouvert)
return: FALSE si Ok, TRUE si err write */
/* Routine d'ecriture du composant pointe par LibEntry
dans le fichier ExportFile( qui doit etre deja ouvert)
return: FALSE si Ok, TRUE si err write */
EDA_LibComponentStruct
*
CopyLibEntryStruct
(
wxWindow
*
frame
,
EDA_LibComponentStruct
*
OldEntry
);
/* Routine de copie d'une partlib
Parametres d'entree: pointeur sur la structure de depart
Parametres de sortie: pointeur sur la structure creee */
/* Routine de copie d'une partlib
Parametres d'entree: pointeur sur la structure de depart
Parametres de sortie: pointeur sur la structure creee */
int
WriteOneDocLibEntry
(
FILE
*
ExportFile
,
EDA_LibComponentStruct
*
LibEntry
);
/* Routine d'ecriture de la doc du composant pointe par LibEntry
dans le fichier ExportFile( qui doit etre deja ouvert)
return: 0 si Ok
1 si err write */
/* Routine d'ecriture de la doc du composant pointe par LibEntry
dans le fichier ExportFile( qui doit etre deja ouvert)
return: 0 si Ok
1 si err write */
int
SaveOneLibrary
(
wxWindow
*
frame
,
const
wxString
&
FullFileName
,
LibraryStruct
*
Library
);
/* Sauvegarde en fichier la librairie pointee par Library, sous le nom
FullFileName.
2 fichiers sont crees
- La librarie
- le fichier de documentation
/* Sauvegarde en fichier la librairie pointee par Library, sous le nom
FullFileName.
2 fichiers sont crees
- La librarie
- le fichier de documentation
une sauvegarde .bak de l'ancien fichier librairie est cree
une sauvegarde .bck de l'ancien fichier documentation est cree
une sauvegarde .bak de l'ancien fichier librairie est cree
une sauvegarde .bck de l'ancien fichier documentation est cree
return:
0 si OK
1 si erreur */
return:
0 si OK
1 si erreur */
/***************/
/* SYMBEDIT.CPP */
/***************/
void
SuppressDuplicateDrawItem
(
EDA_LibComponentStruct
*
LibEntry
);
/* Routine de suppression des elements de trace dupliques, situation
frequente lorsque l'on charge des symboles predessines plusieurs fois
pour definir un composant */
/* Routine de suppression des elements de trace dupliques, situation
frequente lorsque l'on charge des symboles predessines plusieurs fois
pour definir un composant */
/***************/
/* SYMBTEXT.CPP */
...
...
@@ -300,9 +300,9 @@ int IsBusLabel(const wxString & LabelDrawList);
void
ReAnnotatePowerSymbolsOnly
();
int
CheckAnnotate
(
WinEDA_SchematicFrame
*
frame
,
bool
OneSheetOnly
);
/* Retourne le nombre de composants non annotes ou erron�s
Si OneSheetOnly : recherche sur le schema courant
else: recherche sur toute la hierarchie */
/* Retourne le nombre de composants non annotes ou erron�s
Si OneSheetOnly : recherche sur le schema courant
else: recherche sur toute la hierarchie */
/************/
...
...
@@ -315,10 +315,10 @@ void PlotCercle(wxPoint centre, int diametre, int width = -1);
void
PlotPoly
(
int
nb
,
int
*
coord
,
int
fill
,
int
width
=
-
1
);
void
PlotNoConnectStruct
(
DrawNoConnectStruct
*
Struct
);
void
PlotLibPart
(
EDA_SchComponentStruct
*
DrawLibItem
);
/* Genere le trace d'un composant */
void
PlotLibPart
(
SCH_COMPONENT
*
DrawLibItem
);
/* Genere le trace d'un composant */
void
PlotSheetStruct
(
DrawSheetStruct
*
Struct
);
/* Routine de dessin du bloc type hierarchie */
/* Routine de dessin du bloc type hierarchie */
void
PlotTextStruct
(
EDA_BaseStruct
*
Struct
);
/***************/
...
...
@@ -327,7 +327,7 @@ void PlotTextStruct(EDA_BaseStruct *Struct);
void
DeleteSubHierarchy
(
DrawSheetStruct
*
Sheet
,
bool
confirm_deletion
);
bool
ClearProjectDrawList
(
SCH_SCREEN
*
FirstWindow
,
bool
confirm_deletion
);
/* free the draw list screen->EEDrawList and the subhierarchies
clear the screen datas (filenames ..)
clear the screen datas (filenames ..)
*/
/*************/
...
...
@@ -337,19 +337,19 @@ bool ClearProjectDrawList(SCH_SCREEN * FirstWindow, bool confirm_deletion);
bool
LocateAndDeleteItem
(
WinEDA_SchematicFrame
*
frame
,
wxDC
*
DC
);
void
EraseStruct
(
EDA_BaseStruct
*
DrawStruct
,
SCH_SCREEN
*
Window
);
void
DeleteAllMarkers
(
int
type
);
/* Effacement des marqueurs du type "type" */
/* Effacement des marqueurs du type "type" */
void
DeleteOneLibraryDrawStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
EDA_LibComponentStruct
*
LibEntry
,
LibEDA_BaseStruct
*
DrawItem
,
int
Affiche
);
/* Routine d'effacement d'un "LibraryDrawStruct"
(d'un element de dessin d'un composant )
Parametres d'entree
Pointeur sur le composant comportant la structure
(Si NULL la structure a effacer est supposee non rattachee
a un composant)
Pointeur sur la structure a effacer
Affiche (si != 0 Efface le graphique correspondant de l'ecran) */
wxDC
*
DC
,
EDA_LibComponentStruct
*
LibEntry
,
LibEDA_BaseStruct
*
DrawItem
,
int
Affiche
);
/* Routine d'effacement d'un "LibraryDrawStruct"
(d'un element de dessin d'un composant )
Parametres d'entree
Pointeur sur le composant comportant la structure
(Si NULL la structure a effacer est supposee non rattachee
a un composant)
Pointeur sur la structure a effacer
Affiche (si != 0 Efface le graphique correspondant de l'ecran) */
/**************/
...
...
@@ -357,12 +357,12 @@ void DeleteOneLibraryDrawStruct(WinEDA_DrawPanel * panel,
/**************/
int
LookForConvertPart
(
EDA_LibComponentStruct
*
LibEntry
);
/* Retourne la plus grande valeur trouvee dans la liste des elements
"drawings" du composant LibEntry, pour le membre .Convert
Si il n'y a pas de representation type "convert", la valeur
retournee est 0 ou 1
Si il y a une representation type "convert",
la valeur retournee est > 1 (typiquement 2) */
/* Retourne la plus grande valeur trouvee dans la liste des elements
"drawings" du composant LibEntry, pour le membre .Convert
Si il n'y a pas de representation type "convert", la valeur
retournee est 0 ou 1
Si il y a une representation type "convert",
la valeur retournee est > 1 (typiquement 2) */
/**************/
...
...
@@ -376,66 +376,66 @@ void InstallPineditFrame(WinEDA_LibeditFrame * parent, wxDC * DC, const wxPoint
/**************/
int
DisplayComponentsNamesInLib
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
Library
,
wxString
&
Buffer
,
wxString
&
OldName
);
LibraryStruct
*
Library
,
wxString
&
Buffer
,
wxString
&
OldName
);
LibraryStruct
*
SelectLibraryFromList
(
WinEDA_DrawFrame
*
frame
);
/* Routine pour selectionner une librairie a partir d'une liste */
/* Routine pour selectionner une librairie a partir d'une liste */
int
GetNameOfPartToLoad
(
WinEDA_DrawFrame
*
frame
,
LibraryStruct
*
Lib
,
wxString
&
BufName
);
/* Routine de selection du nom d'un composant en librairie pour chargement,
dans la librairie Library.
Si Library == NULL, il y aura demande de selection d'une librairie
Retourne
1 si composant selectionne
0 si commande annulee
place le nom du composant a charger, selectionne a partir d'une liste dans
BufName */
/**************/
/* LIBARCH.CPP */
/**************/
wxString
&
BufName
);
/* Routine de selection du nom d'un composant en librairie pour chargement,
dans la librairie Library.
Si Library == NULL, il y aura demande de selection d'une librairie
Retourne
1 si composant selectionne
0 si commande annulee
place le nom du composant a charger, selectionne a partir d'une liste dans
BufName */
/**************/
/* LIBARCH.CPP */
/**************/
bool
LibArchive
(
wxWindow
*
frame
,
const
wxString
&
ArchFullFileName
);
/***************/
/* GENLISTE.CPP */
/***************/
struct
ListComponent
;
/***************/
/* GENLISTE.CPP */
/***************/
struct
ListComponent
;
int
GenListeCmp
(
ListComponent
*
List
);
/**************/
/* CLEANUP.CPP */
/**************/
/**************/
/* CLEANUP.CPP */
/**************/
void
SchematicCleanUp
(
SCH_SCREEN
*
screen
,
wxDC
*
DC
);
/* Routine de nettoyage:
- regroupe les segments de fils (ou de bus) alignes en 1 seul segment
- Detecte les objets identiques superposes
*/
/* Routine de nettoyage:
- regroupe les segments de fils (ou de bus) alignes en 1 seul segment
- Detecte les objets identiques superposes
*/
void
BreakSegmentOnJunction
(
SCH_SCREEN
*
Screen
);
/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions
et les raccords */
/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions
et les raccords */
DrawPickedStruct
*
BreakSegment
(
SCH_SCREEN
*
screen
,
wxPoint
breakpoint
,
bool
PutInUndoList
=
FALSE
);
/* Coupe un segment ( BUS, WIRE ) en 2 au point breakpoint,
- si ce point est sur le segment
- extremites non comprises */
bool
PutInUndoList
=
FALSE
);
/* Coupe un segment ( BUS, WIRE ) en 2 au point breakpoint,
- si ce point est sur le segment
- extremites non comprises */
/**************/
/* EECLASS.CPP */
/**************/
/**************/
/* EECLASS.CPP */
/**************/
void
SetStructFather
(
EDA_BaseStruct
*
Struct
,
BASE_SCREEN
*
Screen
);
/***************/
/* LIBALIAS.CPP */
/***************/
/***************/
/* LIBALIAS.CPP */
/***************/
bool
BuildAliasData
(
LibraryStruct
*
Lib
,
EDA_LibComponentStruct
*
component
);
/* Create the alias data for the lib component to edit */
/* Create the alias data for the lib component to edit */
int
LocateAlias
(
const
wxArrayString
&
AliasData
,
const
wxString
&
Name
);
/* Return an index in alias data list ( -1 if not found ) */
/* Return an index in alias data list ( -1 if not found ) */
/***************/
...
...
eeschema/save_schemas.cpp
View file @
c406eed1
/*********************************************/
/* eesave.cpp Module to Save EESchema files */
/*********************************************/
/*********************************************/
/* eesave.cpp Module to Save EESchema files */
/*********************************************/
#include "fctsys.h"
#include "gr_basic.h"
...
...
@@ -20,7 +20,7 @@
/* Fonctions externes */
/* Fonctions Locales */
static
int
SavePartDescr
(
FILE
*
f
,
EDA_SchComponentStruct
*
LibItemStruct
);
static
int
SavePartDescr
(
FILE
*
f
,
SCH_COMPONENT
*
LibItemStruct
);
static
int
SaveSheetDescr
(
FILE
*
f
,
DrawSheetStruct
*
SheetStruct
);
static
void
SaveLayers
(
FILE
*
f
);
...
...
@@ -33,510 +33,510 @@ static void SaveLayers(FILE *f);
*****************************************************************************/
bool
WinEDA_SchematicFrame
::
SaveEEFile
(
SCH_SCREEN
*
screen
,
int
FileSave
)
{
wxString
msg
;
wxString
Name
,
BakName
;
const
wxChar
**
LibNames
;
const
char
*
layer
,
*
width
;
int
ii
,
shape
;
bool
Failed
=
FALSE
;
EDA_BaseStruct
*
Phead
;
Ki_PageDescr
*
PlotSheet
;
FILE
*
f
;
wxString
dirbuf
;
if
(
screen
==
NULL
)
screen
=
(
SCH_SCREEN
*
)
GetScreen
();
/* If no name exists in the window yet - save as new. */
if
(
screen
->
m_FileName
.
IsEmpty
()
)
FileSave
=
FILE_SAVE_NEW
;
switch
(
FileSave
)
{
case
FILE_SAVE_AS
:
dirbuf
=
wxGetCwd
()
+
STRING_DIR_SEP
;
Name
=
MakeFileName
(
dirbuf
,
screen
->
m_FileName
,
g_SchExtBuffer
);
/* Rename the old file to a '.bak' one: */
BakName
=
Name
;
if
(
wxFileExists
(
Name
)
)
{
ChangeFileNameExt
(
BakName
,
wxT
(
".bak"
));
wxRemoveFile
(
BakName
);
/* delete Old .bak file */
if
(
!
wxRenameFile
(
Name
,
BakName
)
){
DisplayError
(
this
,
wxT
(
"Warning: unable to rename old file"
),
10
);
}
}
break
;
case
FILE_SAVE_NEW
:
{
wxString
mask
=
wxT
(
"*"
)
+
g_SchExtBuffer
;
Name
=
EDA_FileSelector
(
_
(
"Schematic files:"
),
wxEmptyString
,
/* Chemin par defaut */
screen
->
m_FileName
,
/* nom fichier par defaut, et resultat */
g_SchExtBuffer
,
/* extension par defaut */
mask
,
/* Masque d'affichage */
this
,
wxFD_SAVE
,
FALSE
);
if
(
Name
.
IsEmpty
()
)
return
FALSE
;
screen
->
m_FileName
=
Name
;
dirbuf
=
wxGetCwd
()
+
STRING_DIR_SEP
;
Name
=
MakeFileName
(
dirbuf
,
Name
,
g_SchExtBuffer
);
break
;
}
default
:
break
;
}
if
((
f
=
wxFopen
(
Name
,
wxT
(
"wt"
)))
==
NULL
)
{
msg
=
_
(
"Failed to create file "
)
+
Name
;
DisplayError
(
this
,
msg
);
return
FALSE
;
}
msg
=
_
(
"Save file "
)
+
Name
;
Affiche_Message
(
msg
);
LibNames
=
GetLibNames
();
BakName
.
Empty
();
// temporary buffer!
for
(
ii
=
0
;
LibNames
[
ii
]
!=
NULL
;
ii
++
)
{
if
(
ii
>
0
)
BakName
+=
wxT
(
","
);
BakName
+=
LibNames
[
ii
];
}
MyFree
(
LibNames
);
if
(
fprintf
(
f
,
"%s %s %d
\n
"
,
EESCHEMA_FILE_STAMP
,
SCHEMATIC_HEAD_STRING
,
EESCHEMA_VERSION
)
==
EOF
||
fprintf
(
f
,
"LIBS:%s
\n
"
,
CONV_TO_UTF8
(
BakName
))
==
EOF
)
{
DisplayError
(
this
,
_
(
"File write operation failed."
));
fclose
(
f
);
return
FALSE
;
}
screen
->
ClrModify
();
SaveLayers
(
f
);
/* Sauvegarde des dimensions du schema, des textes du cartouche.. */
PlotSheet
=
screen
->
m_CurrentSheetDesc
;
fprintf
(
f
,
"$Descr %s %d %d
\n
"
,
CONV_TO_UTF8
(
PlotSheet
->
m_Name
),
PlotSheet
->
m_Size
.
x
,
PlotSheet
->
m_Size
.
y
);
fprintf
(
f
,
"Sheet %d %d
\n
"
,
screen
->
m_ScreenNumber
,
screen
->
m_NumberOfScreen
);
fprintf
(
f
,
"Title
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Title
));
fprintf
(
f
,
"Date
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Date
));
fprintf
(
f
,
"Rev
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Revision
));
fprintf
(
f
,
"Comp
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Company
));
fprintf
(
f
,
"Comment1
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire1
));
fprintf
(
f
,
"Comment2
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire2
));
fprintf
(
f
,
"Comment3
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire3
));
fprintf
(
f
,
"Comment4
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire4
));
fprintf
(
f
,
"$EndDescr
\n
"
);
/* Sauvegarde des elements du dessin */
Phead
=
screen
->
EEDrawList
;
while
(
Phead
)
{
switch
(
Phead
->
Type
())
{
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
/* Its a library item. */
SavePartDescr
(
f
,
(
EDA_SchComponentStruct
*
)
Phead
);
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
/* Its a Sheet item. */
SaveSheetDescr
(
f
,
(
DrawSheetStruct
*
)
Phead
);
break
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
/* Its a Segment item. */
#undef STRUCT
#define STRUCT ((EDA_DrawLineStruct *) Phead)
layer
=
"Notes"
;
width
=
"Line"
;
if
(
STRUCT
->
m_Layer
==
LAYER_WIRE
)
layer
=
"Wire"
;
if
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
layer
=
"Bus"
;
if
(
STRUCT
->
m_Width
!=
GR_NORM_WIDTH
)
layer
=
"Bus"
;
if
(
fprintf
(
f
,
"Wire %s %s
\n
"
,
layer
,
width
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
if
(
fprintf
(
f
,
"
\t
%-4d %-4d %-4d %-4d
\n
"
,
STRUCT
->
m_Start
.
x
,
STRUCT
->
m_Start
.
y
,
STRUCT
->
m_End
.
x
,
STRUCT
->
m_End
.
y
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
break
;
case
DRAW_BUSENTRY_STRUCT_TYPE
:
/* Its a Raccord item. */
#undef STRUCT
#define STRUCT ((DrawBusEntryStruct *) Phead)
layer
=
"Wire"
;
width
=
"Line"
;
if
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
{
layer
=
"Bus"
;
width
=
"Bus"
;
}
if
(
fprintf
(
f
,
"Entry %s %s
\n
"
,
layer
,
width
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
if
(
fprintf
(
f
,
"
\t
%-4d %-4d %-4d %-4d
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
STRUCT
->
m_End
().
x
,
STRUCT
->
m_End
().
y
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
break
;
case
DRAW_POLYLINE_STRUCT_TYPE
:
/* Its a polyline item. */
#undef STRUCT
#define STRUCT ((DrawPolylineStruct *) Phead)
layer
=
"Notes"
;
width
=
"Line"
;
if
(
STRUCT
->
m_Layer
==
LAYER_WIRE
)
layer
=
"Wire"
;
if
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
layer
=
"Bus"
;
if
(
STRUCT
->
m_Width
!=
GR_NORM_WIDTH
)
width
=
"Bus"
;
if
(
fprintf
(
f
,
"Poly %s %s %d
\n
"
,
width
,
layer
,
STRUCT
->
m_NumOfPoints
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
for
(
ii
=
0
;
ii
<
STRUCT
->
m_NumOfPoints
;
ii
++
)
{
if
(
fprintf
(
f
,
"
\t
%-4d %-4d
\n
"
,
STRUCT
->
m_Points
[
ii
*
2
],
STRUCT
->
m_Points
[
ii
*
2
+
1
])
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
}
break
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
/* Its a connection item. */
#undef STRUCT
#define STRUCT ((DrawJunctionStruct *) Phead)
if
(
fprintf
(
f
,
"Connection ~ %-4d %-4d
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
)
==
EOF
)
{
Failed
=
TRUE
;
}
break
;
case
DRAW_NOCONNECT_STRUCT_TYPE
:
/* Its a NoConnection item. */
#undef STRUCT
#define STRUCT ((DrawNoConnectStruct *) Phead)
if
(
fprintf
(
f
,
"NoConn ~ %-4d %-4d
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
)
==
EOF
)
{
Failed
=
TRUE
;
}
break
;
case
DRAW_TEXT_STRUCT_TYPE
:
/* Its a text item. */
#undef STRUCT
#define STRUCT ((DrawTextStruct
*) Phead)
if
(
fprintf
(
f
,
"Text Notes %-4d %-4d %-4d %-4d ~
\n
%s
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
STRUCT
->
m_Orient
,
STRUCT
->
m_Size
.
x
,
CONV_TO_UTF8
(
STRUCT
->
m_Text
))
==
EOF
)
Failed
=
TRUE
;
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
/* Its a label item. */
#undef STRUCT
#define STRUCT ((DrawLabelStruct
*) Phead)
shape
=
'~'
;
if
(
fprintf
(
f
,
"Text Label %-4d %-4d %-4d %-4d %c
\n
%s
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
STRUCT
->
m_Orient
,
STRUCT
->
m_Size
.
x
,
shape
,
CONV_TO_UTF8
(
STRUCT
->
m_Text
))
==
EOF
)
Failed
=
TRUE
;
break
;
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
/* Its a Global label item. */
#undef STRUCT
#define STRUCT ((DrawGlobalLabelStruct
*) Phead)
shape
=
STRUCT
->
m_Shape
;
if
(
fprintf
(
f
,
"Text GLabel %-4d %-4d %-4d %-4d %s
\n
%s
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
STRUCT
->
m_Orient
,
STRUCT
->
m_Size
.
x
,
SheetLabelType
[
shape
],
CONV_TO_UTF8
(
STRUCT
->
m_Text
))
==
EOF
)
Failed
=
TRUE
;
break
;
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
/* Its a Hierarchical label item. */
#undef STRUCT
#define STRUCT ((DrawHierLabelStruct
*) Phead)
shape
=
STRUCT
->
m_Shape
;
if
(
fprintf
(
f
,
"Text HLabel %-4d %-4d %-4d %-4d %s
\n
%s
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
STRUCT
->
m_Orient
,
STRUCT
->
m_Size
.
x
,
SheetLabelType
[
shape
],
CONV_TO_UTF8
(
STRUCT
->
m_Text
))
==
EOF
)
Failed
=
TRUE
;
break
;
case
DRAW_MARKER_STRUCT_TYPE
:
/* Its a marker item. */
#undef STRUCT
#define STRUCT ((DrawMarkerStruct *) Phead)
if
(
STRUCT
->
GetComment
()
)
msg
=
STRUCT
->
GetComment
();
else
msg
.
Empty
();
if
(
fprintf
(
f
,
"Kmarq %c %-4d %-4d
\"
%s
\"
F=%X
\n
"
,
(
int
)
STRUCT
->
m_Type
+
'A'
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
CONV_TO_UTF8
(
msg
),
STRUCT
->
m_MarkFlags
)
==
EOF
)
{
Failed
=
TRUE
;
}
break
;
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
default
:
break
;
}
if
(
Failed
)
{
DisplayError
(
this
,
_
(
"File write operation failed."
));
break
;
}
Phead
=
Phead
->
Pnext
;
}
if
(
fprintf
(
f
,
"$EndSCHEMATC
\n
"
)
==
EOF
)
Failed
=
TRUE
;
fclose
(
f
);
if
(
FileSave
==
FILE_SAVE_NEW
)
screen
->
m_FileName
=
Name
;
return
!
Failed
;
wxString
msg
;
wxString
Name
,
BakName
;
const
wxChar
**
LibNames
;
const
char
*
layer
,
*
width
;
int
ii
,
shape
;
bool
Failed
=
FALSE
;
EDA_BaseStruct
*
Phead
;
Ki_PageDescr
*
PlotSheet
;
FILE
*
f
;
wxString
dirbuf
;
if
(
screen
==
NULL
)
screen
=
(
SCH_SCREEN
*
)
GetScreen
();
/* If no name exists in the window yet - save as new. */
if
(
screen
->
m_FileName
.
IsEmpty
()
)
FileSave
=
FILE_SAVE_NEW
;
switch
(
FileSave
)
{
case
FILE_SAVE_AS
:
dirbuf
=
wxGetCwd
()
+
STRING_DIR_SEP
;
Name
=
MakeFileName
(
dirbuf
,
screen
->
m_FileName
,
g_SchExtBuffer
);
/* Rename the old file to a '.bak' one: */
BakName
=
Name
;
if
(
wxFileExists
(
Name
)
)
{
ChangeFileNameExt
(
BakName
,
wxT
(
".bak"
));
wxRemoveFile
(
BakName
);
/* delete Old .bak file */
if
(
!
wxRenameFile
(
Name
,
BakName
)
){
DisplayError
(
this
,
wxT
(
"Warning: unable to rename old file"
),
10
);
}
}
break
;
case
FILE_SAVE_NEW
:
{
wxString
mask
=
wxT
(
"*"
)
+
g_SchExtBuffer
;
Name
=
EDA_FileSelector
(
_
(
"Schematic files:"
),
wxEmptyString
,
/* Chemin par defaut */
screen
->
m_FileName
,
/* nom fichier par defaut, et resultat */
g_SchExtBuffer
,
/* extension par defaut */
mask
,
/* Masque d'affichage */
this
,
wxFD_SAVE
,
FALSE
);
if
(
Name
.
IsEmpty
()
)
return
FALSE
;
screen
->
m_FileName
=
Name
;
dirbuf
=
wxGetCwd
()
+
STRING_DIR_SEP
;
Name
=
MakeFileName
(
dirbuf
,
Name
,
g_SchExtBuffer
);
break
;
}
default
:
break
;
}
if
((
f
=
wxFopen
(
Name
,
wxT
(
"wt"
)))
==
NULL
)
{
msg
=
_
(
"Failed to create file "
)
+
Name
;
DisplayError
(
this
,
msg
);
return
FALSE
;
}
msg
=
_
(
"Save file "
)
+
Name
;
Affiche_Message
(
msg
);
LibNames
=
GetLibNames
();
BakName
.
Empty
();
// temporary buffer!
for
(
ii
=
0
;
LibNames
[
ii
]
!=
NULL
;
ii
++
)
{
if
(
ii
>
0
)
BakName
+=
wxT
(
","
);
BakName
+=
LibNames
[
ii
];
}
MyFree
(
LibNames
);
if
(
fprintf
(
f
,
"%s %s %d
\n
"
,
EESCHEMA_FILE_STAMP
,
SCHEMATIC_HEAD_STRING
,
EESCHEMA_VERSION
)
==
EOF
||
fprintf
(
f
,
"LIBS:%s
\n
"
,
CONV_TO_UTF8
(
BakName
))
==
EOF
)
{
DisplayError
(
this
,
_
(
"File write operation failed."
));
fclose
(
f
);
return
FALSE
;
}
screen
->
ClrModify
();
SaveLayers
(
f
);
/* Sauvegarde des dimensions du schema, des textes du cartouche.. */
PlotSheet
=
screen
->
m_CurrentSheetDesc
;
fprintf
(
f
,
"$Descr %s %d %d
\n
"
,
CONV_TO_UTF8
(
PlotSheet
->
m_Name
),
PlotSheet
->
m_Size
.
x
,
PlotSheet
->
m_Size
.
y
);
fprintf
(
f
,
"Sheet %d %d
\n
"
,
screen
->
m_ScreenNumber
,
screen
->
m_NumberOfScreen
);
fprintf
(
f
,
"Title
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Title
));
fprintf
(
f
,
"Date
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Date
));
fprintf
(
f
,
"Rev
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Revision
));
fprintf
(
f
,
"Comp
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Company
));
fprintf
(
f
,
"Comment1
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire1
));
fprintf
(
f
,
"Comment2
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire2
));
fprintf
(
f
,
"Comment3
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire3
));
fprintf
(
f
,
"Comment4
\"
%s
\"\n
"
,
CONV_TO_UTF8
(
screen
->
m_Commentaire4
));
fprintf
(
f
,
"$EndDescr
\n
"
);
/* Sauvegarde des elements du dessin */
Phead
=
screen
->
EEDrawList
;
while
(
Phead
)
{
switch
(
Phead
->
Type
())
{
case
TYPE_SCH_COMPONENT
:
/* Its a library item. */
SavePartDescr
(
f
,
(
SCH_COMPONENT
*
)
Phead
);
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
/* Its a Sheet item. */
SaveSheetDescr
(
f
,
(
DrawSheetStruct
*
)
Phead
);
break
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
/* Its a Segment item. */
#undef STRUCT
#define STRUCT ((EDA_DrawLineStruct *) Phead)
layer
=
"Notes"
;
width
=
"Line"
;
if
(
STRUCT
->
m_Layer
==
LAYER_WIRE
)
layer
=
"Wire"
;
if
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
layer
=
"Bus"
;
if
(
STRUCT
->
m_Width
!=
GR_NORM_WIDTH
)
layer
=
"Bus"
;
if
(
fprintf
(
f
,
"Wire %s %s
\n
"
,
layer
,
width
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
if
(
fprintf
(
f
,
"
\t
%-4d %-4d %-4d %-4d
\n
"
,
STRUCT
->
m_Start
.
x
,
STRUCT
->
m_Start
.
y
,
STRUCT
->
m_End
.
x
,
STRUCT
->
m_End
.
y
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
break
;
case
DRAW_BUSENTRY_STRUCT_TYPE
:
/* Its a Raccord item. */
#undef STRUCT
#define STRUCT ((DrawBusEntryStruct *) Phead)
layer
=
"Wire"
;
width
=
"Line"
;
if
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
{
layer
=
"Bus"
;
width
=
"Bus"
;
}
if
(
fprintf
(
f
,
"Entry %s %s
\n
"
,
layer
,
width
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
if
(
fprintf
(
f
,
"
\t
%-4d %-4d %-4d %-4d
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
STRUCT
->
m_End
().
x
,
STRUCT
->
m_End
().
y
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
break
;
case
DRAW_POLYLINE_STRUCT_TYPE
:
/* Its a polyline item. */
#undef STRUCT
#define STRUCT ((DrawPolylineStruct *) Phead)
layer
=
"Notes"
;
width
=
"Line"
;
if
(
STRUCT
->
m_Layer
==
LAYER_WIRE
)
layer
=
"Wire"
;
if
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
layer
=
"Bus"
;
if
(
STRUCT
->
m_Width
!=
GR_NORM_WIDTH
)
width
=
"Bus"
;
if
(
fprintf
(
f
,
"Poly %s %s %d
\n
"
,
width
,
layer
,
STRUCT
->
m_NumOfPoints
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
for
(
ii
=
0
;
ii
<
STRUCT
->
m_NumOfPoints
;
ii
++
)
{
if
(
fprintf
(
f
,
"
\t
%-4d %-4d
\n
"
,
STRUCT
->
m_Points
[
ii
*
2
],
STRUCT
->
m_Points
[
ii
*
2
+
1
])
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
}
break
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
/* Its a connection item. */
#undef STRUCT
#define STRUCT ((DrawJunctionStruct *) Phead)
if
(
fprintf
(
f
,
"Connection ~ %-4d %-4d
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
)
==
EOF
)
{
Failed
=
TRUE
;
}
break
;
case
DRAW_NOCONNECT_STRUCT_TYPE
:
/* Its a NoConnection item. */
#undef STRUCT
#define STRUCT ((DrawNoConnectStruct *) Phead)
if
(
fprintf
(
f
,
"NoConn ~ %-4d %-4d
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
)
==
EOF
)
{
Failed
=
TRUE
;
}
break
;
case
TYPE_SCH_TEXT
:
/* Its a text item. */
#undef STRUCT
#define STRUCT ((SCH_TEXT
*) Phead)
if
(
fprintf
(
f
,
"Text Notes %-4d %-4d %-4d %-4d ~
\n
%s
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
STRUCT
->
m_Orient
,
STRUCT
->
m_Size
.
x
,
CONV_TO_UTF8
(
STRUCT
->
m_Text
))
==
EOF
)
Failed
=
TRUE
;
break
;
case
TYPE_SCH_LABEL
:
/* Its a label item. */
#undef STRUCT
#define STRUCT ((SCH_LABEL
*) Phead)
shape
=
'~'
;
if
(
fprintf
(
f
,
"Text Label %-4d %-4d %-4d %-4d %c
\n
%s
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
STRUCT
->
m_Orient
,
STRUCT
->
m_Size
.
x
,
shape
,
CONV_TO_UTF8
(
STRUCT
->
m_Text
))
==
EOF
)
Failed
=
TRUE
;
break
;
case
TYPE_SCH_GLOBALLABEL
:
/* Its a Global label item. */
#undef STRUCT
#define STRUCT ((SCH_GLOBALLABEL
*) Phead)
shape
=
STRUCT
->
m_Shape
;
if
(
fprintf
(
f
,
"Text GLabel %-4d %-4d %-4d %-4d %s
\n
%s
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
STRUCT
->
m_Orient
,
STRUCT
->
m_Size
.
x
,
SheetLabelType
[
shape
],
CONV_TO_UTF8
(
STRUCT
->
m_Text
))
==
EOF
)
Failed
=
TRUE
;
break
;
case
TYPE_SCH_HIERLABEL
:
/* Its a Hierarchical label item. */
#undef STRUCT
#define STRUCT ((SCH_HIERLABEL
*) Phead)
shape
=
STRUCT
->
m_Shape
;
if
(
fprintf
(
f
,
"Text HLabel %-4d %-4d %-4d %-4d %s
\n
%s
\n
"
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
STRUCT
->
m_Orient
,
STRUCT
->
m_Size
.
x
,
SheetLabelType
[
shape
],
CONV_TO_UTF8
(
STRUCT
->
m_Text
))
==
EOF
)
Failed
=
TRUE
;
break
;
case
DRAW_MARKER_STRUCT_TYPE
:
/* Its a marker item. */
#undef STRUCT
#define STRUCT ((DrawMarkerStruct *) Phead)
if
(
STRUCT
->
GetComment
()
)
msg
=
STRUCT
->
GetComment
();
else
msg
.
Empty
();
if
(
fprintf
(
f
,
"Kmarq %c %-4d %-4d
\"
%s
\"
F=%X
\n
"
,
(
int
)
STRUCT
->
m_Type
+
'A'
,
STRUCT
->
m_Pos
.
x
,
STRUCT
->
m_Pos
.
y
,
CONV_TO_UTF8
(
msg
),
STRUCT
->
m_MarkFlags
)
==
EOF
)
{
Failed
=
TRUE
;
}
break
;
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
break
;
default
:
break
;
}
if
(
Failed
)
{
DisplayError
(
this
,
_
(
"File write operation failed."
));
break
;
}
Phead
=
Phead
->
Pnext
;
}
if
(
fprintf
(
f
,
"$EndSCHEMATC
\n
"
)
==
EOF
)
Failed
=
TRUE
;
fclose
(
f
);
if
(
FileSave
==
FILE_SAVE_NEW
)
screen
->
m_FileName
=
Name
;
return
!
Failed
;
}
/*******************************************************************/
static
int
SavePartDescr
(
FILE
*
f
,
EDA_SchComponentStruct
*
LibItemStruct
)
static
int
SavePartDescr
(
FILE
*
f
,
SCH_COMPONENT
*
LibItemStruct
)
/*******************************************************************/
/* Routine utilisee dans la routine precedente.
Assure la sauvegarde de la structure LibItemStruct
Assure la sauvegarde de la structure LibItemStruct
*/
{
int
ii
,
Failed
=
FALSE
;
char
Name1
[
256
],
Name2
[
256
];
int
hjustify
,
vjustify
;
//this is redundant with the AR entries below, but it makes the
//files backwards-compatible.
if
(
LibItemStruct
->
m_References
.
GetCount
()
>
0
)
strncpy
(
Name1
,
CONV_TO_UTF8
(
LibItemStruct
->
m_References
[
0
]),
sizeof
(
Name1
));
else
{
if
(
LibItemStruct
->
m_Field
[
REFERENCE
].
m_Text
.
IsEmpty
())
strncpy
(
Name1
,
CONV_TO_UTF8
(
LibItemStruct
->
m_PrefixString
),
sizeof
(
Name1
));
else
strncpy
(
Name1
,
CONV_TO_UTF8
(
LibItemStruct
->
m_Field
[
REFERENCE
].
m_Text
),
sizeof
(
Name1
));
}
for
(
ii
=
0
;
ii
<
(
int
)
strlen
(
Name1
);
ii
++
){
if
(
Name1
[
ii
]
<=
' '
)
Name1
[
ii
]
=
'~'
;
}
if
(
!
LibItemStruct
->
m_ChipName
.
IsEmpty
()
)
{
strncpy
(
Name2
,
CONV_TO_UTF8
(
LibItemStruct
->
m_ChipName
),
sizeof
(
Name2
));
for
(
ii
=
0
;
ii
<
(
int
)
strlen
(
Name2
);
ii
++
)
if
(
Name2
[
ii
]
<=
' '
)
Name2
[
ii
]
=
'~'
;
}
else
strncpy
(
Name2
,
NULL_STRING
,
sizeof
(
Name2
));
fprintf
(
f
,
"$Comp
\n
"
);
if
(
fprintf
(
f
,
"L %s %s
\n
"
,
Name2
,
Name1
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
/* Generation de numero d'unit, convert et Time Stamp*/
if
(
fprintf
(
f
,
"U %d %d %8.8lX
\n
"
,
LibItemStruct
->
m_Multi
,
LibItemStruct
->
m_Convert
,
LibItemStruct
->
m_TimeStamp
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
/* Sortie de la position */
if
(
fprintf
(
f
,
"P %d %d
\n
"
,
LibItemStruct
->
m_Pos
.
x
,
LibItemStruct
->
m_Pos
.
y
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
unsigned
int
i
;
for
(
i
=
0
;
i
<
LibItemStruct
->
m_References
.
GetCount
();
i
++
){
/*format:
AR Path="/140/2" Ref="C99"
where 140 is the uid of the contianing sheet
and 2 is the timestamp of this component.
(timestamps are actually 8 hex chars)
Ref is the conventional component reference for this 'path'
*/
/*printf("AR Path=\"%s\" Ref=\"%s\" \n",
CONV_TO_UTF8( LibItemStruct->m_Paths[i]),
CONV_TO_UTF8( LibItemStruct->m_References[i] ) ); */
if
(
fprintf
(
f
,
"AR Path=
\"
%s
\"
Ref=
\"
%s
\"
\n
"
,
CONV_TO_UTF8
(
LibItemStruct
->
m_Paths
[
i
]),
CONV_TO_UTF8
(
LibItemStruct
->
m_References
[
i
]
)
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
}
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
PartTextStruct
*
field
=
&
LibItemStruct
->
m_Field
[
ii
];
if
(
field
->
m_Text
.
IsEmpty
()
)
continue
;
hjustify
=
'C'
;
if
(
field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
hjustify
=
'L'
;
else
if
(
field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
hjustify
=
'R'
;
vjustify
=
'C'
;
if
(
field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
vjustify
=
'B'
;
else
if
(
field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
vjustify
=
'T'
;
if
(
fprintf
(
f
,
"F %d
\"
%s
\"
%c %-3d %-3d %-3d %4.4X %c %c"
,
ii
,
CONV_TO_UTF8
(
field
->
m_Text
),
field
->
m_Orient
==
TEXT_ORIENT_HORIZ
?
'H'
:
'V'
,
field
->
m_Pos
.
x
,
field
->
m_Pos
.
y
,
field
->
m_Size
.
x
,
field
->
m_Attributs
,
hjustify
,
vjustify
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
// Save field name, if necessary
if
(
ii
>=
FIELD1
&&
!
field
->
m_Name
.
IsEmpty
()
)
{
wxString
fieldname
=
ReturnDefaultFieldName
(
ii
);
if
(
fieldname
!=
field
->
m_Name
)
if
(
fprintf
(
f
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
field
->
m_Name
)
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
}
if
(
fprintf
(
f
,
"
\n
"
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
}
if
(
Failed
)
return
(
Failed
);
/* Generation du num unit, position, box ( ancienne norme )*/
if
(
fprintf
(
f
,
"
\t
%-4d %-4d %-4d
\n
"
,
LibItemStruct
->
m_Multi
,
LibItemStruct
->
m_Pos
.
x
,
LibItemStruct
->
m_Pos
.
y
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
if
(
fprintf
(
f
,
"
\t
%-4d %-4d %-4d %-4d
\n
"
,
LibItemStruct
->
m_Transform
[
0
][
0
],
LibItemStruct
->
m_Transform
[
0
][
1
],
LibItemStruct
->
m_Transform
[
1
][
0
],
LibItemStruct
->
m_Transform
[
1
][
1
])
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
fprintf
(
f
,
"$EndComp
\n
"
);
return
(
Failed
);
//this is redundant with the AR entries below, but it makes the
//files backwards-compatible.
if
(
LibItemStruct
->
m_References
.
GetCount
()
>
0
)
strncpy
(
Name1
,
CONV_TO_UTF8
(
LibItemStruct
->
m_References
[
0
]),
sizeof
(
Name1
));
else
{
if
(
LibItemStruct
->
m_Field
[
REFERENCE
].
m_Text
.
IsEmpty
())
strncpy
(
Name1
,
CONV_TO_UTF8
(
LibItemStruct
->
m_PrefixString
),
sizeof
(
Name1
));
else
strncpy
(
Name1
,
CONV_TO_UTF8
(
LibItemStruct
->
m_Field
[
REFERENCE
].
m_Text
),
sizeof
(
Name1
));
}
for
(
ii
=
0
;
ii
<
(
int
)
strlen
(
Name1
);
ii
++
){
if
(
Name1
[
ii
]
<=
' '
)
Name1
[
ii
]
=
'~'
;
}
if
(
!
LibItemStruct
->
m_ChipName
.
IsEmpty
()
)
{
strncpy
(
Name2
,
CONV_TO_UTF8
(
LibItemStruct
->
m_ChipName
),
sizeof
(
Name2
));
for
(
ii
=
0
;
ii
<
(
int
)
strlen
(
Name2
);
ii
++
)
if
(
Name2
[
ii
]
<=
' '
)
Name2
[
ii
]
=
'~'
;
}
else
strncpy
(
Name2
,
NULL_STRING
,
sizeof
(
Name2
));
fprintf
(
f
,
"$Comp
\n
"
);
if
(
fprintf
(
f
,
"L %s %s
\n
"
,
Name2
,
Name1
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
/* Generation de numero d'unit, convert et Time Stamp*/
if
(
fprintf
(
f
,
"U %d %d %8.8lX
\n
"
,
LibItemStruct
->
m_Multi
,
LibItemStruct
->
m_Convert
,
LibItemStruct
->
m_TimeStamp
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
/* Sortie de la position */
if
(
fprintf
(
f
,
"P %d %d
\n
"
,
LibItemStruct
->
m_Pos
.
x
,
LibItemStruct
->
m_Pos
.
y
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
unsigned
int
i
;
for
(
i
=
0
;
i
<
LibItemStruct
->
m_References
.
GetCount
();
i
++
){
/*format:
AR Path="/140/2" Ref="C99"
where 140 is the uid of the contianing sheet
and 2 is the timestamp of this component.
(timestamps are actually 8 hex chars)
Ref is the conventional component reference for this 'path'
*/
/*printf("AR Path=\"%s\" Ref=\"%s\" \n",
CONV_TO_UTF8( LibItemStruct->m_Paths[i]),
CONV_TO_UTF8( LibItemStruct->m_References[i] ) ); */
if
(
fprintf
(
f
,
"AR Path=
\"
%s
\"
Ref=
\"
%s
\"
\n
"
,
CONV_TO_UTF8
(
LibItemStruct
->
m_Paths
[
i
]),
CONV_TO_UTF8
(
LibItemStruct
->
m_References
[
i
]
)
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
}
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
PartTextStruct
*
field
=
&
LibItemStruct
->
m_Field
[
ii
];
if
(
field
->
m_Text
.
IsEmpty
()
)
continue
;
hjustify
=
'C'
;
if
(
field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
hjustify
=
'L'
;
else
if
(
field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
hjustify
=
'R'
;
vjustify
=
'C'
;
if
(
field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
vjustify
=
'B'
;
else
if
(
field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
vjustify
=
'T'
;
if
(
fprintf
(
f
,
"F %d
\"
%s
\"
%c %-3d %-3d %-3d %4.4X %c %c"
,
ii
,
CONV_TO_UTF8
(
field
->
m_Text
),
field
->
m_Orient
==
TEXT_ORIENT_HORIZ
?
'H'
:
'V'
,
field
->
m_Pos
.
x
,
field
->
m_Pos
.
y
,
field
->
m_Size
.
x
,
field
->
m_Attributs
,
hjustify
,
vjustify
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
// Save field name, if necessary
if
(
ii
>=
FIELD1
&&
!
field
->
m_Name
.
IsEmpty
()
)
{
wxString
fieldname
=
ReturnDefaultFieldName
(
ii
);
if
(
fieldname
!=
field
->
m_Name
)
if
(
fprintf
(
f
,
"
\"
%s
\"
"
,
CONV_TO_UTF8
(
field
->
m_Name
)
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
}
if
(
fprintf
(
f
,
"
\n
"
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
}
if
(
Failed
)
return
(
Failed
);
/* Generation du num unit, position, box ( ancienne norme )*/
if
(
fprintf
(
f
,
"
\t
%-4d %-4d %-4d
\n
"
,
LibItemStruct
->
m_Multi
,
LibItemStruct
->
m_Pos
.
x
,
LibItemStruct
->
m_Pos
.
y
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
if
(
fprintf
(
f
,
"
\t
%-4d %-4d %-4d %-4d
\n
"
,
LibItemStruct
->
m_Transform
[
0
][
0
],
LibItemStruct
->
m_Transform
[
0
][
1
],
LibItemStruct
->
m_Transform
[
1
][
0
],
LibItemStruct
->
m_Transform
[
1
][
1
])
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
fprintf
(
f
,
"$EndComp
\n
"
);
return
(
Failed
);
}
/*******************************************************************/
static
int
SaveSheetDescr
(
FILE
*
f
,
DrawSheetStruct
*
SheetStruct
)
/*******************************************************************/
/* Routine utilisee dans la routine precedente.
Assure la sauvegarde de la structure LibItemStruct
Assure la sauvegarde de la structure LibItemStruct
*/
{
int
ii
;
int
Failed
=
FALSE
;
DrawSheetLabelStruct
*
SheetLabel
;
fprintf
(
f
,
"$Sheet
\n
"
);
if
(
fprintf
(
f
,
"S %-4d %-4d %-4d %-4d
\n
"
,
SheetStruct
->
m_Pos
.
x
,
SheetStruct
->
m_Pos
.
y
,
SheetStruct
->
m_Size
.
x
,
SheetStruct
->
m_Size
.
y
)
==
EOF
){
Failed
=
TRUE
;
return
(
Failed
);
}
//save the unique timestamp, like other shematic parts.
if
(
fprintf
(
f
,
"U %8.8lX
\n
"
,
SheetStruct
->
m_TimeStamp
)
==
EOF
){
Failed
=
TRUE
;
return
(
Failed
);
}
/* Generation de la liste des 2 textes (sheetname et filename) */
if
(
!
SheetStruct
->
m_SheetName
.
IsEmpty
())
{
if
(
fprintf
(
f
,
"F0
\"
%s
\"
%d
\n
"
,
CONV_TO_UTF8
(
SheetStruct
->
m_SheetName
),
SheetStruct
->
m_SheetNameSize
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
}
if
(
!
SheetStruct
->
GetFileName
().
IsEmpty
())
{
if
(
fprintf
(
f
,
"F1
\"
%s
\"
%d
\n
"
,
CONV_TO_UTF8
(
SheetStruct
->
GetFileName
()),
SheetStruct
->
m_FileNameSize
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
}
/* Generation de la liste des labels (entrees) de la sous feuille */
ii
=
2
;
SheetLabel
=
SheetStruct
->
m_Label
;
while
(
SheetLabel
!=
NULL
)
{
int
type
=
'U'
,
side
=
'L'
;
if
(
SheetLabel
->
m_Text
.
IsEmpty
()
)
continue
;
if
(
SheetLabel
->
m_Edge
)
side
=
'R'
;
switch
(
SheetLabel
->
m_Shape
)
{
case
NET_INPUT
:
type
=
'I'
;
break
;
case
NET_OUTPUT
:
type
=
'O'
;
break
;
case
NET_BIDI
:
type
=
'B'
;
break
;
case
NET_TRISTATE
:
type
=
'T'
;
break
;
case
NET_UNSPECIFIED
:
type
=
'U'
;
break
;
}
if
(
fprintf
(
f
,
"F%d
\"
%s
\"
%c %c %-3d %-3d %-3d
\n
"
,
ii
,
CONV_TO_UTF8
(
SheetLabel
->
m_Text
),
type
,
side
,
SheetLabel
->
m_Pos
.
x
,
SheetLabel
->
m_Pos
.
y
,
SheetLabel
->
m_Size
.
x
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
ii
++
;
SheetLabel
=
(
DrawSheetLabelStruct
*
)
SheetLabel
->
Pnext
;
}
fprintf
(
f
,
"$EndSheet
\n
"
);
return
(
Failed
);
fprintf
(
f
,
"$Sheet
\n
"
);
if
(
fprintf
(
f
,
"S %-4d %-4d %-4d %-4d
\n
"
,
SheetStruct
->
m_Pos
.
x
,
SheetStruct
->
m_Pos
.
y
,
SheetStruct
->
m_Size
.
x
,
SheetStruct
->
m_Size
.
y
)
==
EOF
){
Failed
=
TRUE
;
return
(
Failed
);
}
//save the unique timestamp, like other shematic parts.
if
(
fprintf
(
f
,
"U %8.8lX
\n
"
,
SheetStruct
->
m_TimeStamp
)
==
EOF
){
Failed
=
TRUE
;
return
(
Failed
);
}
/* Generation de la liste des 2 textes (sheetname et filename) */
if
(
!
SheetStruct
->
m_SheetName
.
IsEmpty
())
{
if
(
fprintf
(
f
,
"F0
\"
%s
\"
%d
\n
"
,
CONV_TO_UTF8
(
SheetStruct
->
m_SheetName
),
SheetStruct
->
m_SheetNameSize
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
}
if
(
!
SheetStruct
->
GetFileName
().
IsEmpty
())
{
if
(
fprintf
(
f
,
"F1
\"
%s
\"
%d
\n
"
,
CONV_TO_UTF8
(
SheetStruct
->
GetFileName
()),
SheetStruct
->
m_FileNameSize
)
==
EOF
)
{
Failed
=
TRUE
;
return
(
Failed
);
}
}
/* Generation de la liste des labels (entrees) de la sous feuille */
ii
=
2
;
SheetLabel
=
SheetStruct
->
m_Label
;
while
(
SheetLabel
!=
NULL
)
{
int
type
=
'U'
,
side
=
'L'
;
if
(
SheetLabel
->
m_Text
.
IsEmpty
()
)
continue
;
if
(
SheetLabel
->
m_Edge
)
side
=
'R'
;
switch
(
SheetLabel
->
m_Shape
)
{
case
NET_INPUT
:
type
=
'I'
;
break
;
case
NET_OUTPUT
:
type
=
'O'
;
break
;
case
NET_BIDI
:
type
=
'B'
;
break
;
case
NET_TRISTATE
:
type
=
'T'
;
break
;
case
NET_UNSPECIFIED
:
type
=
'U'
;
break
;
}
if
(
fprintf
(
f
,
"F%d
\"
%s
\"
%c %c %-3d %-3d %-3d
\n
"
,
ii
,
CONV_TO_UTF8
(
SheetLabel
->
m_Text
),
type
,
side
,
SheetLabel
->
m_Pos
.
x
,
SheetLabel
->
m_Pos
.
y
,
SheetLabel
->
m_Size
.
x
)
==
EOF
)
{
Failed
=
TRUE
;
break
;
}
ii
++
;
SheetLabel
=
(
DrawSheetLabelStruct
*
)
SheetLabel
->
Pnext
;
}
fprintf
(
f
,
"$EndSheet
\n
"
);
return
(
Failed
);
}
/****************************/
...
...
@@ -546,8 +546,8 @@ static void SaveLayers(FILE *f)
theses infos are not used in eeschema
*/
{
fprintf
(
f
,
"EELAYER %2d %2d
\n
"
,
g_LayerDescr
.
NumberOfLayers
,
g_LayerDescr
.
CurrentLayer
);
fprintf
(
f
,
"EELAYER END
\n
"
);
fprintf
(
f
,
"EELAYER %2d %2d
\n
"
,
g_LayerDescr
.
NumberOfLayers
,
g_LayerDescr
.
CurrentLayer
);
fprintf
(
f
,
"EELAYER END
\n
"
);
}
eeschema/schedit.cpp
View file @
c406eed1
...
...
@@ -273,36 +273,36 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_SCH_EDIT_TEXT
:
EditSchematicText
(
(
DrawTextStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
EditSchematicText
(
(
SCH_TEXT
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
break
;
case
ID_POPUP_SCH_ROTATE_TEXT
:
DrawPanel
->
MouseToCursorSchema
();
ChangeTextOrient
(
(
DrawTextStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
ChangeTextOrient
(
(
SCH_TEXT
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
break
;
case
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_LABEL
:
DrawPanel
->
MouseToCursorSchema
();
ConvertTextType
(
(
DrawTextStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
,
DRAW_LABEL_STRUCT_TYPE
);
ConvertTextType
(
(
SCH_TEXT
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
,
TYPE_SCH_LABEL
);
break
;
case
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_GLABEL
:
DrawPanel
->
MouseToCursorSchema
();
ConvertTextType
(
(
DrawTextStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
,
DRAW_GLOBAL_LABEL_STRUCT_TYPE
);
ConvertTextType
(
(
SCH_TEXT
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
,
TYPE_SCH_GLOBALLABEL
);
break
;
case
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_HLABEL
:
DrawPanel
->
MouseToCursorSchema
();
ConvertTextType
(
(
DrawTextStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
,
DRAW_HIER_LABEL_STRUCT_TYPE
);
ConvertTextType
(
(
SCH_TEXT
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
,
TYPE_SCH_HIERLABEL
);
break
;
case
ID_POPUP_SCH_CHANGE_TYPE_TEXT_TO_COMMENT
:
DrawPanel
->
MouseToCursorSchema
();
ConvertTextType
(
(
DrawTextStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
,
DRAW_TEXT_STRUCT_TYPE
);
ConvertTextType
(
(
SCH_TEXT
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
,
TYPE_SCH_TEXT
);
break
;
case
ID_POPUP_SCH_SET_SHAPE_TEXT
:
...
...
@@ -347,7 +347,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a
// component, like Field, text..)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
TYPE_SCH_COMPONENT
)
GetScreen
()
->
SetCurItem
(
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
)
);
...
...
@@ -403,7 +403,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a
// component, like Field, text..)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
TYPE_SCH_COMPONENT
)
GetScreen
()
->
SetCurItem
(
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
)
);
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
...
...
@@ -431,13 +431,13 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a
// component, like Field, text..)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
TYPE_SCH_COMPONENT
)
GetScreen
()
->
SetCurItem
(
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
)
);
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
break
;
InstallCmpeditFrame
(
this
,
pos
,
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
()
);
(
SCH_COMPONENT
*
)
GetScreen
()
->
GetCurItem
()
);
break
;
case
ID_POPUP_SCH_MIROR_X_CMP
:
...
...
@@ -448,7 +448,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a
// component, like Field, text..)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
TYPE_SCH_COMPONENT
)
GetScreen
()
->
SetCurItem
(
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
)
);
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
...
...
@@ -480,7 +480,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
SaveCopyInUndoList
(
GetScreen
()
->
GetCurItem
(),
IS_CHANGED
);
CmpRotationMiroir
(
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
(
SCH_COMPONENT
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
,
option
);
break
;
}
...
...
@@ -493,41 +493,41 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a
// component, like Field, text..)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
TYPE_SCH_COMPONENT
)
GetScreen
()
->
SetCurItem
(
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
)
);
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
break
;
EditComponentValue
(
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
(
SCH_COMPONENT
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
break
;
case
ID_POPUP_SCH_EDIT_REF_CMP
:
// Ensure the struct is a component (could be a struct of a
// component, like Field, text..)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
TYPE_SCH_COMPONENT
)
GetScreen
()
->
SetCurItem
(
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
)
);
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
break
;
EditComponentReference
(
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
(
SCH_COMPONENT
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
break
;
case
ID_POPUP_SCH_EDIT_FOOTPRINT_CMP
:
// Ensure the struct is a component (could be a struct of a
// component, like Field, text..)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
TYPE_SCH_COMPONENT
)
GetScreen
()
->
SetCurItem
(
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
)
);
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
break
;
EditComponentFootprint
(
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
(
SCH_COMPONENT
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
break
;
...
...
@@ -535,25 +535,25 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a
// component, like Field, text..)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
TYPE_SCH_COMPONENT
)
GetScreen
()
->
SetCurItem
(
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
)
);
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
break
;
DrawPanel
->
MouseToCursorSchema
();
ConvertPart
(
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
(
SCH_COMPONENT
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
break
;
case
ID_POPUP_SCH_COPY_COMPONENT_CMP
:
DrawPanel
->
MouseToCursorSchema
();
{
EDA_SchComponentStruct
*
olditem
,
*
newitem
;
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
SCH_COMPONENT
*
olditem
,
*
newitem
;
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
TYPE_SCH_COMPONENT
)
GetScreen
()
->
SetCurItem
(
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
)
);
olditem
=
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
();
olditem
=
(
SCH_COMPONENT
*
)
GetScreen
()
->
GetCurItem
();
if
(
olditem
==
NULL
)
break
;
newitem
=
olditem
->
GenCopy
();
...
...
@@ -597,14 +597,14 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a struct of a
// component, like Field, text..)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
TYPE_SCH_COMPONENT
)
GetScreen
()
->
SetCurItem
(
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
)
);
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
break
;
DrawPanel
->
MouseToCursorSchema
();
SelPartUnit
(
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
(),
(
SCH_COMPONENT
*
)
GetScreen
()
->
GetCurItem
(),
id
+
1
-
ID_POPUP_SCH_SELECT_UNIT1
,
&
dc
);
break
;
...
...
@@ -613,7 +613,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
// Ensure the struct is a component (could be a piece of a
// component, like Field, text..)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
GetScreen
()
->
GetCurItem
()
->
Type
()
!=
TYPE_SCH_COMPONENT
)
GetScreen
()
->
SetCurItem
(
LocateSmallestComponent
(
(
SCH_SCREEN
*
)
GetScreen
()
)
);
if
(
GetScreen
()
->
GetCurItem
()
==
NULL
)
...
...
@@ -621,7 +621,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
{
EDA_LibComponentStruct
*
LibEntry
;
LibEntry
=
FindLibPart
(
(
(
EDA_SchComponentStruct
*
)
GetScreen
()
->
GetCurItem
()
)
->
m_ChipName
,
(
(
SCH_COMPONENT
*
)
GetScreen
()
->
GetCurItem
()
)
->
m_ChipName
,
wxEmptyString
,
FIND_ALIAS
);
if
(
LibEntry
&&
LibEntry
->
m_DocFile
!=
wxEmptyString
)
...
...
@@ -755,15 +755,15 @@ void WinEDA_SchematicFrame::Process_Move_Item( EDA_BaseStruct* DrawStruct,
StartMoveBusEntry
(
(
DrawBusEntryStruct
*
)
DrawStruct
,
DC
);
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
StartMoveTexte
(
(
DrawTextStruct
*
)
DrawStruct
,
DC
);
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_TEXT
:
StartMoveTexte
(
(
SCH_TEXT
*
)
DrawStruct
,
DC
);
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
StartMovePart
(
(
EDA_SchComponentStruct
*
)
DrawStruct
,
DC
);
case
TYPE_SCH_COMPONENT
:
StartMovePart
(
(
SCH_COMPONENT
*
)
DrawStruct
,
DC
);
break
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
...
...
eeschema/schematic_undo_redo.cpp
View file @
c406eed1
...
...
@@ -90,22 +90,22 @@ void SwapData( EDA_BaseStruct* Item )
EXCHG
(
SOURCE
->
m_Pos
,
DEST
->
m_Pos
);
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_HIER_LABEL_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_TEXT
:
#undef SOURCE
#undef DEST
#define SOURCE ( (
DrawTextStruct
*) Item )
#define DEST ( (
DrawTextStruct
*) image )
#define SOURCE ( (
SCH_TEXT
*) Item )
#define DEST ( (
SCH_TEXT
*) image )
DEST
->
SwapData
(
SOURCE
);
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
TYPE_SCH_COMPONENT
:
#undef SOURCE
#undef DEST
#define SOURCE ( (
EDA_SchComponentStruct
*) Item )
#define DEST ( (
EDA_SchComponentStruct
*) image )
#define SOURCE ( (
SCH_COMPONENT
*) Item )
#define DEST ( (
SCH_COMPONENT
*) image )
DEST
->
SwapData
(
SOURCE
);
break
;
...
...
eeschema/schframe.h
View file @
c406eed1
...
...
@@ -71,7 +71,7 @@ public:
/* Cross probing with pcbnew */
void
SendMessageToPCBNEW
(
EDA_BaseStruct
*
objectToSync
,
EDA_SchComponentStruct
*
LibItem
);
SCH_COMPONENT
*
LibItem
);
/* netlist generation */
void
*
BuildNetListBase
();
...
...
@@ -144,10 +144,10 @@ private:
// Text ,label, glabel
EDA_BaseStruct
*
CreateNewText
(
wxDC
*
DC
,
int
type
);
void
EditSchematicText
(
DrawTextStruct
*
TextStruct
,
wxDC
*
DC
);
void
ChangeTextOrient
(
DrawTextStruct
*
TextStruct
,
wxDC
*
DC
);
void
StartMoveTexte
(
DrawTextStruct
*
TextStruct
,
wxDC
*
DC
);
void
ConvertTextType
(
DrawTextStruct
*
Text
,
wxDC
*
DC
,
int
newtype
);
void
EditSchematicText
(
SCH_TEXT
*
TextStruct
,
wxDC
*
DC
);
void
ChangeTextOrient
(
SCH_TEXT
*
TextStruct
,
wxDC
*
DC
);
void
StartMoveTexte
(
SCH_TEXT
*
TextStruct
,
wxDC
*
DC
);
void
ConvertTextType
(
SCH_TEXT
*
Text
,
wxDC
*
DC
,
int
newtype
);
// Wire, Bus
void
BeginSegment
(
wxDC
*
DC
,
int
type
);
...
...
@@ -168,10 +168,10 @@ private:
public
:
bool
EditSheet
(
DrawSheetStruct
*
Sheet
,
wxDC
*
DC
);
/** Function UpdateSheetNumberAndDate
* Set a sheet number, the sheet count for sheets in the whole schematic
* and update the date in all screens
*/
/** Function UpdateSheetNumberAndDate
* Set a sheet number, the sheet count for sheets in the whole schematic
* and update the date in all screens
*/
void
UpdateSheetNumberAndDate
();
private
:
...
...
@@ -188,25 +188,25 @@ public:
private
:
// Component
EDA_SchComponentStruct
*
Load_Component
(
wxDC
*
DC
,
SCH_COMPONENT
*
Load_Component
(
wxDC
*
DC
,
const
wxString
&
libname
,
wxArrayString
&
List
,
bool
UseLibBrowser
);
void
StartMovePart
(
EDA_SchComponentStruct
*
DrawLibItem
,
wxDC
*
DC
);
void
StartMovePart
(
SCH_COMPONENT
*
DrawLibItem
,
wxDC
*
DC
);
public
:
void
CmpRotationMiroir
(
EDA_SchComponentStruct
*
DrawComponent
,
void
CmpRotationMiroir
(
SCH_COMPONENT
*
DrawComponent
,
wxDC
*
DC
,
int
type_rotate
);
private
:
void
SelPartUnit
(
EDA_SchComponentStruct
*
DrawComponent
,
void
SelPartUnit
(
SCH_COMPONENT
*
DrawComponent
,
int
unit
,
wxDC
*
DC
);
void
ConvertPart
(
EDA_SchComponentStruct
*
DrawComponent
,
wxDC
*
DC
);
void
SetInitCmp
(
EDA_SchComponentStruct
*
DrawComponent
,
wxDC
*
DC
);
void
EditComponentReference
(
EDA_SchComponentStruct
*
DrawLibItem
,
void
ConvertPart
(
SCH_COMPONENT
*
DrawComponent
,
wxDC
*
DC
);
void
SetInitCmp
(
SCH_COMPONENT
*
DrawComponent
,
wxDC
*
DC
);
void
EditComponentReference
(
SCH_COMPONENT
*
DrawLibItem
,
wxDC
*
DC
);
void
EditComponentValue
(
EDA_SchComponentStruct
*
DrawLibItem
,
wxDC
*
DC
);
void
EditComponentFootprint
(
EDA_SchComponentStruct
*
DrawLibItem
,
void
EditComponentValue
(
SCH_COMPONENT
*
DrawLibItem
,
wxDC
*
DC
);
void
EditComponentFootprint
(
SCH_COMPONENT
*
DrawLibItem
,
wxDC
*
DC
);
void
StartMoveCmpField
(
PartTextStruct
*
Field
,
wxDC
*
DC
);
void
EditCmpFieldText
(
PartTextStruct
*
Field
,
wxDC
*
DC
);
...
...
eeschema/sheetlab.cpp
View file @
c406eed1
...
...
@@ -153,7 +153,7 @@ static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC )
if
(
SheetLabel
->
m_Flags
&
IS_NEW
)
{
/* Nouveau Placement en cours, on l'efface */
RedrawOneStruct
(
Panel
,
DC
,
SheetLabel
,
g_XorMode
);
SAFE_DELETE
(
SheetLabel
);
SAFE_DELETE
(
SheetLabel
);
}
else
{
...
...
@@ -359,16 +359,16 @@ DrawSheetLabelStruct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* S
{
EDA_BaseStruct
*
DrawStruct
;
DrawSheetLabelStruct
*
NewSheetLabel
,
*
SheetLabel
=
NULL
;
DrawHierLabelStruct
*
HLabel
=
NULL
;
SCH_HIERLABEL
*
HLabel
=
NULL
;
if
(
!
Sheet
->
m_AssociatedScreen
)
return
NULL
;
if
(
!
Sheet
->
m_AssociatedScreen
)
return
NULL
;
DrawStruct
=
Sheet
->
m_AssociatedScreen
->
EEDrawList
;
HLabel
=
NULL
;
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Pnext
)
{
if
(
DrawStruct
->
Type
()
!=
DRAW_HIER_LABEL_STRUCT_TYPE
)
if
(
DrawStruct
->
Type
()
!=
TYPE_SCH_HIERLABEL
)
continue
;
HLabel
=
(
DrawHierLabelStruct
*
)
DrawStruct
;
HLabel
=
(
SCH_HIERLABEL
*
)
DrawStruct
;
/* Ici un G-Label a ete trouve: y a t-il un SheetLabel correspondant */
SheetLabel
=
Sheet
->
m_Label
;
...
...
include/base_struct.h
View file @
c406eed1
...
...
@@ -47,11 +47,11 @@ enum KICAD_T {
// Draw Items in schematic
DRAW_POLYLINE_STRUCT_TYPE
,
DRAW_JUNCTION_STRUCT_TYPE
,
DRAW_TEXT_STRUCT_TYPE
,
DRAW_LABEL_STRUCT_TYPE
,
DRAW_GLOBAL_LABEL_STRUCT_TYPE
,
DRAW_HIER_LABEL_STRUCT_TYPE
,
DRAW_LIB_ITEM_STRUCT_TYPE
,
TYPE_SCH_TEXT
,
TYPE_SCH_LABEL
,
TYPE_SCH_GLOBALLABEL
,
TYPE_SCH_HIERLABEL
,
TYPE_SCH_COMPONENT
,
DRAW_PICK_ITEM_STRUCT_TYPE
,
DRAW_SEGMENT_STRUCT_TYPE
,
DRAW_BUSENTRY_STRUCT_TYPE
,
...
...
@@ -194,13 +194,13 @@ public:
operator
wxRect
()
const
{
return
wxRect
(
m_Pos
,
m_Size
);
}
EDA_Rect
&
Inflate
(
wxCoord
dx
,
wxCoord
dy
);
/** Function Merge
* Modify Position and Size of this in order to contain the given rect
* mainly used to calculate bounding boxes
* @param aRect = given rect to merge with this
*/
void
Merge
(
const
EDA_Rect
&
aRect
);
/** Function Merge
* Modify Position and Size of this in order to contain the given rect
* mainly used to calculate bounding boxes
* @param aRect = given rect to merge with this
*/
void
Merge
(
const
EDA_Rect
&
aRect
);
};
...
...
@@ -357,6 +357,10 @@ public:
*/
virtual
EDA_Rect
GetBoundingBox
()
{
#if defined (DEBUG)
printf
(
"Missing GetBoundingBox() -> no good! :-)
\n
"
);
Show
(
0
,
std
::
cout
);
// tell me which classes still need GetBoundingBox support
#endif
// return a zero-sized box per default. derived classes should override this
EDA_Rect
ret
(
wxPoint
(
0
,
0
),
wxSize
(
0
,
0
)
);
return
ret
;
...
...
@@ -668,18 +672,44 @@ public:
};
/**************************/
/* class DrawPickedStruct */
/**************************/
/**
* Class SCH_ITEM
* is a base class for any item which can be embedded within the SCHEMATIC
* container class, and therefore instances of derived classes should only be
* found in EESCHEMA or other programs that use class SCHEMATIC and its contents.
* The corresponding class in PCBNEW is BOARD_ITEM.
*/
class
SCH_ITEM
:
public
EDA_BaseStruct
{
protected
:
int
m_Layer
;
public
:
SCH_ITEM
(
EDA_BaseStruct
*
aParent
,
KICAD_T
aType
)
:
EDA_BaseStruct
(
aParent
,
aType
),
m_Layer
(
0
)
{
}
~
SCH_ITEM
(){}
virtual
wxString
GetClass
()
const
{
return
wxT
(
"SCH_ITEM"
);
}
};
/* Class to hold structures picked by pick events (like block selection)
* 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
/**
* 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
class
DrawPickedStruct
:
public
SCH_ITEM
{
public
:
EDA_BaseStruct
*
m_PickedStruct
;
...
...
@@ -691,6 +721,22 @@ public:
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"
);
}
#if defined(DEBUG)
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
#endif
/* BASE_STRUCT_H */
include/wxstruct.h
View file @
c406eed1
...
...
@@ -71,13 +71,13 @@ class EDA_LibComponentStruct;
class
LibEDA_BaseStruct
;
class
EDA_BaseStruct
;
class
DrawBusEntryStruct
;
class
DrawGlobalLabelStruct
;
class
DrawTextStruct
;
class
SCH_GLOBALLABEL
;
class
SCH_TEXT
;
class
EDA_DrawLineStruct
;
class
DrawSheetStruct
;
class
DrawSheetPath
;
class
DrawSheetLabelStruct
;
class
EDA_SchComponentStruct
;
class
SCH_COMPONENT
;
class
LibDrawField
;
class
PartTextStruct
;
class
LibDrawPin
;
...
...
@@ -158,7 +158,7 @@ public:
WinEDA_BasicFrame
(
wxWindow
*
father
,
int
idtype
,
WinEDA_App
*
parent
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
=
KICAD_DEFAULT_DRAWFRAME_STYLE
);
long
style
=
KICAD_DEFAULT_DRAWFRAME_STYLE
);
#ifdef KICAD_PYTHON
WinEDA_BasicFrame
(
const
WinEDA_BasicFrame
&
)
{
}
// Should throw!!
WinEDA_BasicFrame
()
{
}
// Should throw!!
...
...
@@ -230,12 +230,12 @@ public:
WinEDA_DrawFrame
(
wxWindow
*
father
,
int
idtype
,
WinEDA_App
*
parent
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
=
KICAD_DEFAULT_DRAWFRAME_STYLE
);
long
style
=
KICAD_DEFAULT_DRAWFRAME_STYLE
);
~
WinEDA_DrawFrame
();
virtual
BASE_SCREEN
*
GetScreen
()
{
return
m_CurrentScreen
;
}
virtual
wxString
GetScreenDesc
();
virtual
wxString
GetScreenDesc
();
void
OnMenuOpen
(
wxMenuEvent
&
event
);
void
OnMouseEvent
(
wxMouseEvent
&
event
);
...
...
@@ -279,7 +279,7 @@ public:
virtual
int
BestZoom
()
=
0
;
/* Return the current zoom level */
int
GetZoom
(
void
);
int
GetZoom
(
void
);
void
ToPrinter
(
wxCommandEvent
&
event
);
void
SVG_Print
(
wxCommandEvent
&
event
);
...
...
@@ -353,7 +353,7 @@ public:
WinEDA_LibeditFrame
(
wxWindow
*
father
,
WinEDA_App
*
parent
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
=
KICAD_DEFAULT_DRAWFRAME_STYLE
);
long
style
=
KICAD_DEFAULT_DRAWFRAME_STYLE
);
~
WinEDA_LibeditFrame
();
...
...
@@ -422,7 +422,7 @@ private:
void
RotateSymbolText
(
wxDC
*
DC
);
void
DeleteDrawPoly
(
wxDC
*
DC
);
LibDrawField
*
LocateField
(
EDA_LibComponentStruct
*
LibEntry
);
LibEDA_BaseStruct
*
LocateItemUsingCursor
();
LibEDA_BaseStruct
*
LocateItemUsingCursor
();
void
RotateField
(
wxDC
*
DC
,
LibDrawField
*
Field
);
void
PlaceField
(
wxDC
*
DC
,
LibDrawField
*
Field
);
void
EditField
(
wxDC
*
DC
,
LibDrawField
*
Field
);
...
...
@@ -540,10 +540,10 @@ struct MsgItem
class
WinEDA_MsgPanel
:
public
wxPanel
{
protected
:
std
::
vector
<
MsgItem
>
m_Items
;
std
::
vector
<
MsgItem
>
m_Items
;
void
showItem
(
wxDC
&
dc
,
const
MsgItem
&
aItem
);
public
:
WinEDA_DrawFrame
*
m_Parent
;
int
m_BgColor
;
// couleur de fond
...
...
pcbnew/specctra.h
View file @
c406eed1
...
...
@@ -934,7 +934,7 @@ typedef boost::ptr_vector<WINDOW> WINDOWS;
/**
* Class KEEPOUT
* is used for
<keepout_descriptor> and <plane_descriptor>
.
* is used for
<keepout_descriptor> and <plane_descriptor>
.
*/
class
KEEPOUT
:
public
ELEM
{
...
...
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