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
664a1f72
Commit
664a1f72
authored
Sep 20, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
see my 2007-Sep-20 change_log.txt
parent
33939aeb
Changes
20
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
5692 additions
and
4976 deletions
+5692
-4976
change_log.txt
change_log.txt
+20
-12
base_screen.cpp
common/base_screen.cpp
+26
-0
base_struct.cpp
common/base_struct.cpp
+3
-0
annotate.cpp
eeschema/annotate.cpp
+690
-634
class_screen.h
eeschema/class_screen.h
+1
-1
cleanup.cpp
eeschema/cleanup.cpp
+223
-212
cmpclass.cpp
eeschema/cmpclass.cpp
+39
-0
component_class.cpp
eeschema/component_class.cpp
+590
-490
component_class.h
eeschema/component_class.h
+38
-7
edit_component_in_lib.cpp
eeschema/edit_component_in_lib.cpp
+1034
-913
erc.cpp
eeschema/erc.cpp
+742
-685
libedpart.cpp
eeschema/libedpart.cpp
+1094
-985
load_one_schematic_file.cpp
eeschema/load_one_schematic_file.cpp
+5
-2
netlist.cpp
eeschema/netlist.cpp
+1047
-934
netlist.h
eeschema/netlist.h
+70
-69
program.h
eeschema/program.h
+35
-11
protos.h
eeschema/protos.h
+1
-1
drawpanel_wxstruct.h
include/drawpanel_wxstruct.h
+15
-8
controle.cpp
pcbnew/controle.cpp
+2
-2
onrightclick.cpp
pcbnew/onrightclick.cpp
+17
-10
No files found.
change_log.txt
View file @
664a1f72
...
@@ -4,12 +4,20 @@ Started 2007-June-11
...
@@ -4,12 +4,20 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.
2007-Sep-20 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ eeschema
* beautify, add debug Show() functions, changed ReturnFieldName()
to return "const wxString&" for speed, added GetFieldValue().
* tracking down questionable behavior (a bug?) in erc regarding pwr_flag, still looking
2007-sept-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
2007-sept-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
================================================================================
+ all
+ all
* hotkeys handling finished
* hotkeys handling finished
+ pcbnew
+ pcbnew
* bug fix: a subtle bug in place via : partial drc only was made.
* bug fix: a subtle bug in place via : partial drc only was made.
2007-Sep-14 UPDATE Dick Hollenbeck <dick@softplc.com>
2007-Sep-14 UPDATE Dick Hollenbeck <dick@softplc.com>
...
@@ -42,11 +50,11 @@ email address.
...
@@ -42,11 +50,11 @@ email address.
2007-sept-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
2007-sept-13 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
================================================================================
+ all
+ all
* EDA_BaseStruct.SetType() removed.
* EDA_BaseStruct.SetType() removed.
The m_StructType member of class EDA_BaseStruct is no more modified in kicad.
The m_StructType member of class EDA_BaseStruct is no more modified in kicad.
Now Virtual functions can be widely used.
Now Virtual functions can be widely used.
* The old EDA_BaseStruct.ReturnClassName() was removed.
* The old EDA_BaseStruct.ReturnClassName() was removed.
the virtual EDA_BaseStruct.GetClass() is used instead.
the virtual EDA_BaseStruct.GetClass() is used instead.
+ gerbview: hotkeys Ok.
+ gerbview: hotkeys Ok.
...
@@ -106,10 +114,10 @@ email address.
...
@@ -106,10 +114,10 @@ email address.
================================================================================
================================================================================
+ eeschema & pcbnew
+ eeschema & pcbnew
Programmable hotkeys update.
Programmable hotkeys update.
some features are still subject to change (mainly path for config files: see 2007-aug-30 UPDATE))
some features are still subject to change (mainly path for config files: see 2007-aug-30 UPDATE))
The preference menu has a command to create and reread config hotkey files.
The preference menu has a command to create and reread config hotkey files.
the hotkey ? lists the current hotkeys.
the hotkey ? lists the current hotkeys.
2007-Sep-4 UPDATE Dick Hollenbeck <dick@softplc.com>
2007-Sep-4 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
...
@@ -125,7 +133,7 @@ email address.
...
@@ -125,7 +133,7 @@ email address.
2007-sept-04 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
2007-sept-04 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
================================================================================
+ pcbnew
+ pcbnew
better comments in editrack-part2 (the todo remark solved)
better comments in editrack-part2 (the todo remark solved)
+ todo.txt: note about editrack-part2 modified (problem solved)
+ todo.txt: note about editrack-part2 modified (problem solved)
...
...
common/base_screen.cpp
View file @
664a1f72
...
@@ -555,3 +555,29 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList()
...
@@ -555,3 +555,29 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList()
return
item
;
return
item
;
}
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
BASE_SCREEN
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
EDA_BaseStruct
*
item
=
EEDrawList
;
// for now, make it look like XML, expand on this later.
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
for
(
;
item
;
item
=
item
->
Next
()
)
{
item
->
Show
(
nestLevel
+
1
,
os
);
}
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
}
#endif
\ No newline at end of file
common/base_struct.cpp
View file @
664a1f72
...
@@ -188,11 +188,14 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
...
@@ -188,11 +188,14 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
// for now, make it look like XML:
// for now, make it look like XML:
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
/*
EDA_BaseStruct* kid = m_Son;
EDA_BaseStruct* kid = m_Son;
for( ; kid; kid = kid->Pnext )
for( ; kid; kid = kid->Pnext )
{
{
kid->Show( nestLevel+1, os );
kid->Show( nestLevel+1, os );
}
}
*/
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"Need ::Show() override, shown class is using EDA_BaseStruct::Show()
\n
"
;
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
}
}
...
...
eeschema/annotate.cpp
View file @
664a1f72
/**************************************/
/**************************************/
/* annotate.cpp: component annotation */
/* annotate.cpp: component annotation */
/**************************************/
/**************************************/
#include "annotate_dialog.cpp"
#include "annotate_dialog.cpp"
...
@@ -8,723 +8,779 @@
...
@@ -8,723 +8,779 @@
#include "protos.h"
#include "protos.h"
/* fonctions exportees */
/* fonctions exportees */
int
ListeComposants
(
CmpListStruct
*
BaseListeCmp
,
SCH_SCREEN
*
screen
,
int
NumSheet
);
int
ListeComposants
(
CmpListStruct
*
BaseListeCmp
,
SCH_SCREEN
*
screen
,
int
NumSheet
);
int
AnnotTriComposant
(
CmpListStruct
*
Objet1
,
CmpListStruct
*
Objet2
);
int
AnnotTriComposant
(
CmpListStruct
*
Objet1
,
CmpListStruct
*
Objet2
);
void
BreakReference
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
);
void
BreakReference
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
);
/* fonctions locales */
/* fonctions locales */
static
void
ReAnnotateComponents
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
);
static
void
ReAnnotateComponents
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
);
static
void
ComputeReferenceNumber
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
);
static
void
ComputeReferenceNumber
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
);
static
int
GetLastReferenceNumber
(
CmpListStruct
*
Objet
,
CmpListStruct
*
BaseListeCmp
,
static
int
GetLastReferenceNumber
(
CmpListStruct
*
Objet
,
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
);
int
NbOfCmp
);
static
int
ExistUnit
(
CmpListStruct
*
Objet
,
int
Unit
,
static
int
ExistUnit
(
CmpListStruct
*
Objet
,
int
Unit
,
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
);
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
);
/* Variable locales */
/* Variable locales */
static
bool
AnnotProject
=
TRUE
;
static
bool
AnnotProject
=
TRUE
;
static
bool
SortByPosition
=
TRUE
;
static
bool
SortByPosition
=
TRUE
;
/**************************************/
/**************************************/
void
ReAnnotatePowerSymbolsOnly
()
void
ReAnnotatePowerSymbolsOnly
()
/**************************************/
/**************************************/
/* Used to reannotate the power symbols, before testing erc or computing netlist
when a true component reannotation is not necessary
In order to avoid conflicts the ref number start with a 0:
/* Used to reannotate the power symbols, before testing erc or computing netlist
PWR with id 12 is named PWR12 in global annotation and PWR012 by the Power annotation
* when a true component reannotation is not necessary
*/
*
* In order to avoid conflicts the ref number start with a 0:
* PWR with id 12 is named PWR12 in global annotation and PWR012 by the Power annotation
*/
{
{
/* Build the screen list */
/* Build the screen list */
EDA_ScreenList
ScreenList
(
NULL
);
EDA_ScreenList
ScreenList
(
NULL
);
/* Update the sheet number, sheet count and date */
/* Update the sheet number, sheet count and date */
ScreenList
.
UpdateSheetNumberAndDate
();
ScreenList
.
UpdateSheetNumberAndDate
();
SCH_SCREEN
*
screen
;
SCH_SCREEN
*
screen
;
int
CmpNumber
=
1
;
int
CmpNumber
=
1
;
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
{
{
EDA_BaseStruct
*
DrawList
=
screen
->
EEDrawList
;
EDA_BaseStruct
*
DrawList
=
screen
->
EEDrawList
;
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
{
{
if
(
DrawList
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
if
(
DrawList
->
Type
()
!=
DRAW_LIB_ITEM_STRUCT_TYPE
)
continue
;
continue
;
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
EDA_LibComponentStruct
*
Entry
=
EDA_LibComponentStruct
*
Entry
=
FindLibPart
(
DrawLibItem
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
FindLibPart
(
DrawLibItem
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
if
(
(
Entry
==
NULL
)
||
(
Entry
->
m_Options
!=
ENTRY_POWER
)
)
if
(
(
Entry
==
NULL
)
||
(
Entry
->
m_Options
!=
ENTRY_POWER
)
)
continue
;
continue
;
DrawLibItem
->
ClearAnnotation
();
DrawLibItem
->
ClearAnnotation
();
DrawLibItem
->
m_RefIdNumber
=
CmpNumber
;
DrawLibItem
->
m_RefIdNumber
=
CmpNumber
;
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
.
RemoveLast
();
// Remove the '?'
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
.
RemoveLast
();
// Remove the '?'
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
<<
wxT
(
"0"
)
<<
CmpNumber
;
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
<<
wxT
(
"0"
)
<<
CmpNumber
;
CmpNumber
++
;
CmpNumber
++
;
}
}
}
}
}
}
/******************************************************************/
/******************************************************************/
void
InstallAnnotateFrame
(
WinEDA_SchematicFrame
*
parent
,
wxPoint
&
pos
)
void
InstallAnnotateFrame
(
WinEDA_SchematicFrame
*
parent
,
wxPoint
&
pos
)
/******************************************************************/
/******************************************************************/
{
{
WinEDA_AnnotateFrame
*
frame
=
new
WinEDA_AnnotateFrame
(
parent
);
WinEDA_AnnotateFrame
*
frame
=
new
WinEDA_AnnotateFrame
(
parent
);
frame
->
ShowModal
();
frame
->
Destroy
();
frame
->
ShowModal
();
frame
->
Destroy
();
}
}
/******************************************************************/
/******************************************************************/
void
WinEDA_AnnotateFrame
::
AnnotateComponents
(
wxCommandEvent
&
event
)
void
WinEDA_AnnotateFrame
::
AnnotateComponents
(
wxCommandEvent
&
event
)
/******************************************************************/
/******************************************************************/
/*
/*
Compute the annotation of the components for the whole projeect, or the current sheet only.
*
Compute the annotation of the components for the whole projeect, or the current sheet only.
All the components or the new ones only will be annotated.
*
All the components or the new ones only will be annotated.
*/
*/
{
{
int
NbSheet
,
ii
,
NbOfCmp
;
int
NbSheet
,
ii
,
NbOfCmp
;
SCH_SCREEN
*
screen
;
SCH_SCREEN
*
screen
;
CmpListStruct
*
BaseListeCmp
;
CmpListStruct
*
BaseListeCmp
;
wxBusyCursor
dummy
;
wxBusyCursor
dummy
;
AnnotProject
=
(
m_AnnotProjetCtrl
->
GetSelection
()
==
0
)
?
TRUE
:
FALSE
;
AnnotProject
=
(
m_AnnotProjetCtrl
->
GetSelection
()
==
0
)
?
TRUE
:
FALSE
;
SortByPosition
=
(
m_AnnotSortCmpCtrl
->
GetSelection
()
==
0
)
?
TRUE
:
FALSE
;
SortByPosition
=
(
m_AnnotSortCmpCtrl
->
GetSelection
()
==
0
)
?
TRUE
:
FALSE
;
/* If it is an annotation for all the components, reset previous annotation: */
/* If it is an annotation for all the components, reset previous annotation: */
if
(
m_AnnotNewCmpCtrl
->
GetSelection
()
==
0
)
DeleteAnnotation
(
event
);
if
(
m_AnnotNewCmpCtrl
->
GetSelection
()
==
0
)
if
(
m_Abort
)
return
;
DeleteAnnotation
(
event
);
if
(
m_Abort
)
return
;
/* Build the screen list */
EDA_ScreenList
ScreenList
(
NULL
);
NbSheet
=
ScreenList
.
GetCount
();
/* Build the screen list */
EDA_ScreenList
ScreenList
(
NULL
);
/* Update the sheet number, sheet count and date */
ScreenSch
->
SetModify
();
NbSheet
=
ScreenList
.
GetCount
();
ScreenList
.
UpdateSheetNumberAndDate
();
/* Update the sheet number, sheet count and date */
/* First pass: Component counting */
ScreenSch
->
SetModify
();
screen
=
(
SCH_SCREEN
*
)
m_Parent
->
m_CurrentScreen
;
ScreenList
.
UpdateSheetNumberAndDate
();
if
(
AnnotProject
==
TRUE
)
{
/* First pass: Component counting */
NbOfCmp
=
0
;
screen
=
(
SCH_SCREEN
*
)
m_Parent
->
m_CurrentScreen
;
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
if
(
AnnotProject
==
TRUE
)
{
{
NbOfCmp
+=
ListeComposants
(
NULL
,
screen
,
screen
->
m_SheetNumber
);
NbOfCmp
=
0
;
}
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
}
{
else
NbOfCmp
=
ListeComposants
(
NULL
,
screen
,
screen
->
m_SheetNumber
);
NbOfCmp
+=
ListeComposants
(
NULL
,
screen
,
screen
->
m_SheetNumber
);
}
if
(
NbOfCmp
==
0
)
}
return
;
else
NbOfCmp
=
ListeComposants
(
NULL
,
screen
,
screen
->
m_SheetNumber
);
ii
=
sizeof
(
CmpListStruct
)
*
NbOfCmp
;
BaseListeCmp
=
(
CmpListStruct
*
)
MyZMalloc
(
ii
);
if
(
NbOfCmp
==
0
)
return
;
/* Second pass : Int data tables */
screen
=
(
SCH_SCREEN
*
)
m_Parent
->
m_CurrentScreen
;
ii
=
sizeof
(
CmpListStruct
)
*
NbOfCmp
;
if
(
AnnotProject
==
TRUE
)
BaseListeCmp
=
(
CmpListStruct
*
)
MyZMalloc
(
ii
);
{
ii
=
0
;
/* Second pass : Int data tables */
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
screen
=
(
SCH_SCREEN
*
)
m_Parent
->
m_CurrentScreen
;
{
if
(
AnnotProject
==
TRUE
)
ii
+=
ListeComposants
(
BaseListeCmp
+
ii
,
{
screen
,
screen
->
m_SheetNumber
);
ii
=
0
;
}
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
}
{
else
ii
=
ListeComposants
(
BaseListeCmp
,
screen
,
screen
->
m_SheetNumber
);
ii
+=
ListeComposants
(
BaseListeCmp
+
ii
,
screen
,
screen
->
m_SheetNumber
);
if
(
ii
!=
NbOfCmp
)
}
DisplayError
(
this
,
wxT
(
"Internal error in AnnotateComponents()"
));
}
else
/* Separation des Numeros de la reference: IC1 -> IC, et 1 dans .m_NumRef */
ii
=
ListeComposants
(
BaseListeCmp
,
screen
,
screen
->
m_SheetNumber
);
BreakReference
(
BaseListeCmp
,
NbOfCmp
);
if
(
ii
!=
NbOfCmp
)
qsort
(
BaseListeCmp
,
NbOfCmp
,
sizeof
(
CmpListStruct
),
DisplayError
(
this
,
wxT
(
"Internal error in AnnotateComponents()"
)
);
(
int
(
*
)(
const
void
*
,
const
void
*
))
AnnotTriComposant
);
/* Separation des Numeros de la reference: IC1 -> IC, et 1 dans .m_NumRef */
/* Recalcul des numeros de reference */
BreakReference
(
BaseListeCmp
,
NbOfCmp
);
ComputeReferenceNumber
(
BaseListeCmp
,
NbOfCmp
);
ReAnnotateComponents
(
BaseListeCmp
,
NbOfCmp
);
qsort
(
BaseListeCmp
,
NbOfCmp
,
sizeof
(
CmpListStruct
),
(
int
(
*
)
(
const
void
*
,
const
void
*
)
)
AnnotTriComposant
);
MyFree
(
BaseListeCmp
);
BaseListeCmp
=
NULL
;
/* Recalcul des numeros de reference */
/* Final control */
ComputeReferenceNumber
(
BaseListeCmp
,
NbOfCmp
);
CheckAnnotate
(
m_Parent
,
AnnotProject
?
FALSE
:
TRUE
);
ReAnnotateComponents
(
BaseListeCmp
,
NbOfCmp
);
m_Parent
->
DrawPanel
->
Refresh
(
TRUE
);
/* Refresh screen */
MyFree
(
BaseListeCmp
);
BaseListeCmp
=
NULL
;
Close
();
/* Final control */
CheckAnnotate
(
m_Parent
,
AnnotProject
?
FALSE
:
TRUE
);
m_Parent
->
DrawPanel
->
Refresh
(
TRUE
);
/* Refresh screen */
Close
();
}
}
/********************************************************************/
/********************************************************************/
void
WinEDA_AnnotateFrame
::
DeleteAnnotation
(
wxCommandEvent
&
event
)
void
WinEDA_AnnotateFrame
::
DeleteAnnotation
(
wxCommandEvent
&
event
)
/********************************************************************/
/********************************************************************/
/* Clear the current annotation for the whole project or only for the current sheet
/* Clear the current annotation for the whole project or only for the current sheet
Update sheet number and number of sheets
*
Update sheet number and number of sheets
*/
*/
{
{
int
NbSheet
;
int
NbSheet
;
SCH_SCREEN
*
screen
;
SCH_SCREEN
*
screen
;
EDA_SchComponentStruct
*
DrawLibItem
;
EDA_SchComponentStruct
*
DrawLibItem
;
if
(
!
IsOK
(
this
,
_
(
"Previous Annotation will be deleted. Continue ?"
)
)
)
if
(
!
IsOK
(
this
,
_
(
"Previous Annotation will be deleted. Continue ?"
)
)
)
{
{
m_Abort
=
TRUE
;
return
;
m_Abort
=
TRUE
;
return
;
}
}
AnnotProject
=
(
m_AnnotProjetCtrl
->
GetSelection
()
==
0
)
?
TRUE
:
FALSE
;
AnnotProject
=
(
m_AnnotProjetCtrl
->
GetSelection
()
==
0
)
?
TRUE
:
FALSE
;
m_Abort
=
FALSE
;
m_Abort
=
FALSE
;
/* Build the screen list */
/* Build the screen list */
EDA_ScreenList
ScreenList
(
NULL
);
EDA_ScreenList
ScreenList
(
NULL
);
NbSheet
=
ScreenList
.
GetCount
();
NbSheet
=
ScreenList
.
GetCount
();
/* Update the sheet number, sheet count and date */
ScreenList
.
UpdateSheetNumberAndDate
();
/* Update the sheet number, sheet count and date */
ScreenList
.
UpdateSheetNumberAndDate
();
ScreenSch
->
SetModify
();
ScreenSch
->
SetModify
();
if
(
AnnotProject
==
TRUE
)
screen
=
ScreenList
.
GetFirst
();
else
screen
=
(
SCH_SCREEN
*
)
m_Parent
->
m_CurrentScreen
;
if
(
AnnotProject
==
TRUE
)
screen
=
ScreenList
.
GetFirst
();
for
(
;
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
else
{
screen
=
(
SCH_SCREEN
*
)
m_Parent
->
m_CurrentScreen
;
EDA_BaseStruct
*
DrawList
=
screen
->
EEDrawList
;
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
for
(
;
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
{
{
if
(
DrawList
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
EDA_BaseStruct
*
DrawList
=
screen
->
EEDrawList
;
{
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
{
DrawLibItem
->
ClearAnnotation
();
if
(
DrawList
->
Type
()
==
DRAW_LIB_ITEM_STRUCT_TYPE
)
}
{
}
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
if
(
!
AnnotProject
)
break
;
DrawLibItem
->
ClearAnnotation
();
}
}
}
m_Parent
->
DrawPanel
->
Refresh
(
TRUE
);
Close
();
if
(
!
AnnotProject
)
break
;
}
m_Parent
->
DrawPanel
->
Refresh
(
TRUE
);
Close
();
}
}
/************************************************************************************/
/************************************************************************************/
int
ListeComposants
(
CmpListStruct
*
BaseListeCmp
,
SCH_SCREEN
*
screen
,
int
NumSheet
)
int
ListeComposants
(
CmpListStruct
*
BaseListeCmp
,
SCH_SCREEN
*
screen
,
int
NumSheet
)
/***********************************************************************************/
/***********************************************************************************/
/* if BaseListeCmp == NULL : Components counting
/* if BaseListeCmp == NULL : Components counting
else update data table BaseListeCmp
*
else update data table BaseListeCmp
*/
*/
{
{
int
NbrCmp
=
0
;
int
NbrCmp
=
0
;
EDA_BaseStruct
*
DrawList
=
screen
->
EEDrawList
;
EDA_BaseStruct
*
DrawList
=
screen
->
EEDrawList
;
EDA_SchComponentStruct
*
DrawLibItem
;
EDA_SchComponentStruct
*
DrawLibItem
;
EDA_LibComponentStruct
*
Entry
;
EDA_LibComponentStruct
*
Entry
;
DrawList
=
screen
->
EEDrawList
;
DrawList
=
screen
->
EEDrawList
;
while
(
DrawList
)
while
(
DrawList
)
{
{
switch
(
DrawList
->
Type
()
)
switch
(
DrawList
->
Type
()
)
{
{
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
break
;
break
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
Entry
=
FindLibPart
(
DrawLibItem
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
Entry
=
FindLibPart
(
DrawLibItem
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
if
(
Entry
==
NULL
)
break
;
if
(
Entry
==
NULL
)
if
(
BaseListeCmp
==
NULL
)
/* Items counting only */
break
;
{
if
(
BaseListeCmp
==
NULL
)
/* Items counting only */
NbrCmp
++
;
break
;
{
}
NbrCmp
++
;
break
;
BaseListeCmp
[
NbrCmp
].
m_Cmp
=
DrawLibItem
;
}
BaseListeCmp
[
NbrCmp
].
m_NbParts
=
Entry
->
m_UnitCount
;
BaseListeCmp
[
NbrCmp
].
m_Cmp
=
DrawLibItem
;
BaseListeCmp
[
NbrCmp
].
m_Unit
=
DrawLibItem
->
m_Multi
;
BaseListeCmp
[
NbrCmp
].
m_NbParts
=
Entry
->
m_UnitCount
;
BaseListeCmp
[
NbrCmp
].
m_PartsLocked
=
Entry
->
m_UnitSelectionLocked
;
BaseListeCmp
[
NbrCmp
].
m_Unit
=
DrawLibItem
->
m_Multi
;
BaseListeCmp
[
NbrCmp
].
m_Sheet
=
NumSheet
;
BaseListeCmp
[
NbrCmp
].
m_PartsLocked
=
Entry
->
m_UnitSelectionLocked
;
BaseListeCmp
[
NbrCmp
].
m_IsNew
=
FALSE
;
BaseListeCmp
[
NbrCmp
].
m_Sheet
=
NumSheet
;
BaseListeCmp
[
NbrCmp
].
m_Pos
=
DrawLibItem
->
m_Pos
;
BaseListeCmp
[
NbrCmp
].
m_IsNew
=
FALSE
;
BaseListeCmp
[
NbrCmp
].
m_TimeStamp
=
DrawLibItem
->
m_TimeStamp
;
BaseListeCmp
[
NbrCmp
].
m_Pos
=
DrawLibItem
->
m_Pos
;
if
(
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
.
IsEmpty
()
)
BaseListeCmp
[
NbrCmp
].
m_TimeStamp
=
DrawLibItem
->
m_TimeStamp
;
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
=
wxT
(
"DefRef?"
);
if
(
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
.
IsEmpty
()
)
strncpy
(
BaseListeCmp
[
NbrCmp
].
m_TextRef
,
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
=
wxT
(
"DefRef?"
);
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
),
32
);
strncpy
(
BaseListeCmp
[
NbrCmp
].
m_TextRef
,
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
),
32
);
BaseListeCmp
[
NbrCmp
].
m_NumRef
=
-
1
;
BaseListeCmp
[
NbrCmp
].
m_NumRef
=
-
1
;
if
(
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
.
IsEmpty
()
)
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
=
wxT
(
"~"
);
if
(
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
.
IsEmpty
()
)
strncpy
(
BaseListeCmp
[
NbrCmp
].
m_TextValue
,
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
=
wxT
(
"~"
);
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
),
32
);
strncpy
(
BaseListeCmp
[
NbrCmp
].
m_TextValue
,
NbrCmp
++
;
CONV_TO_UTF8
(
DrawLibItem
->
m_Field
[
VALUE
].
m_Text
),
32
);
break
;
NbrCmp
++
;
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_SHEET_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
case
DRAW_SHEET_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
case
DRAW_NOCONNECT_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
break
;
case
DRAW_NOCONNECT_STRUCT_TYPE
:
break
;
default
:
break
;
default
:
}
break
;
}
DrawList
=
DrawList
->
Pnext
;
}
DrawList
=
DrawList
->
Pnext
;
}
return
(
NbrCmp
);
return
NbrCmp
;
}
}
/*****************************************************************/
/*****************************************************************/
int
AnnotTriComposant
(
CmpListStruct
*
Objet1
,
CmpListStruct
*
Objet2
)
int
AnnotTriComposant
(
CmpListStruct
*
Objet1
,
CmpListStruct
*
Objet2
)
/****************************************************************/
/****************************************************************/
/* function used par qsort() for sorting the list
/* function used par qsort() for sorting the list
Composants are sorted
*
Composants are sorted
by reference
*
by reference
if same reference: by value
*
if same reference: by value
if same value: by unit number
*
if same value: by unit number
if same unit number, by sheet
*
if same unit number, by sheet
if same sheet, by time stamp
*
if same sheet, by time stamp
**/
**/
{
{
int
ii
;
int
ii
;
ii
=
strnicmp
(
Objet1
->
m_TextRef
,
Objet2
->
m_TextRef
,
32
);
ii
=
strnicmp
(
Objet1
->
m_TextRef
,
Objet2
->
m_TextRef
,
32
);
if
(
SortByPosition
==
TRUE
)
{
if
(
SortByPosition
==
TRUE
)
if
(
ii
==
0
)
ii
=
Objet1
->
m_Sheet
-
Objet2
->
m_Sheet
;
{
if
(
ii
==
0
)
ii
=
Objet1
->
m_Unit
-
Objet2
->
m_Unit
;
if
(
ii
==
0
)
if
(
ii
==
0
)
ii
=
Objet1
->
m_Pos
.
x
-
Objet2
->
m_Pos
.
x
;
ii
=
Objet1
->
m_Sheet
-
Objet2
->
m_Sheet
;
if
(
ii
==
0
)
ii
=
Objet1
->
m_Pos
.
y
-
Objet2
->
m_Pos
.
y
;
if
(
ii
==
0
)
}
else
{
ii
=
Objet1
->
m_Unit
-
Objet2
->
m_Unit
;
if
(
ii
==
0
)
ii
=
strnicmp
(
Objet1
->
m_TextValue
,
Objet2
->
m_TextValue
,
32
);
if
(
ii
==
0
)
if
(
ii
==
0
)
ii
=
Objet1
->
m_Unit
-
Objet2
->
m_Unit
;
ii
=
Objet1
->
m_Pos
.
x
-
Objet2
->
m_Pos
.
x
;
if
(
ii
==
0
)
ii
=
Objet1
->
m_Sheet
-
Objet2
->
m_Sheet
;
if
(
ii
==
0
)
}
ii
=
Objet1
->
m_Pos
.
y
-
Objet2
->
m_Pos
.
y
;
}
if
(
ii
==
0
)
ii
=
Objet1
->
m_TimeStamp
-
Objet2
->
m_TimeStamp
;
else
{
return
(
ii
);
if
(
ii
==
0
)
ii
=
strnicmp
(
Objet1
->
m_TextValue
,
Objet2
->
m_TextValue
,
32
);
if
(
ii
==
0
)
ii
=
Objet1
->
m_Unit
-
Objet2
->
m_Unit
;
if
(
ii
==
0
)
ii
=
Objet1
->
m_Sheet
-
Objet2
->
m_Sheet
;
}
if
(
ii
==
0
)
ii
=
Objet1
->
m_TimeStamp
-
Objet2
->
m_TimeStamp
;
return
ii
;
}
}
/********************************************************************/
/********************************************************************/
static
void
ReAnnotateComponents
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
)
static
void
ReAnnotateComponents
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
)
/********************************************************************/
/********************************************************************/
/* Update the reference component for the schematic project (or the current sheet)
/* Update the reference component for the schematic project (or the current sheet)
*/
*/
{
{
int
ii
;
int
ii
;
char
*
Text
;
char
*
Text
;
EDA_SchComponentStruct
*
DrawLibItem
;
EDA_SchComponentStruct
*
DrawLibItem
;
/* Reattribution des numeros */
/* Reattribution des numeros */
for
(
ii
=
0
;
ii
<
NbOfCmp
;
ii
++
)
for
(
ii
=
0
;
ii
<
NbOfCmp
;
ii
++
)
{
{
Text
=
BaseListeCmp
[
ii
].
m_TextRef
;
Text
=
BaseListeCmp
[
ii
].
m_TextRef
;
DrawLibItem
=
BaseListeCmp
[
ii
].
m_Cmp
;
DrawLibItem
=
BaseListeCmp
[
ii
].
m_Cmp
;
if
(
BaseListeCmp
[
ii
].
m_NumRef
<
0
)
strcat
(
Text
,
"?"
);
if
(
BaseListeCmp
[
ii
].
m_NumRef
<
0
)
else
sprintf
(
Text
+
strlen
(
Text
),
"%d"
,
BaseListeCmp
[
ii
].
m_NumRef
);
strcat
(
Text
,
"?"
);
else
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
=
CONV_FROM_UTF8
(
Text
);
sprintf
(
Text
+
strlen
(
Text
),
"%d"
,
BaseListeCmp
[
ii
].
m_NumRef
);
DrawLibItem
->
m_Multi
=
BaseListeCmp
[
ii
].
m_Unit
;
DrawLibItem
->
m_RefIdNumber
=
BaseListeCmp
[
ii
].
m_NumRef
;
DrawLibItem
->
m_Field
[
REFERENCE
].
m_Text
=
CONV_FROM_UTF8
(
Text
);
if
(
DrawLibItem
->
m_RefIdNumber
<
0
)
DrawLibItem
->
m_RefIdNumber
=
0
;
DrawLibItem
->
m_Multi
=
BaseListeCmp
[
ii
].
m_Unit
;
}
DrawLibItem
->
m_RefIdNumber
=
BaseListeCmp
[
ii
].
m_NumRef
;
if
(
DrawLibItem
->
m_RefIdNumber
<
0
)
DrawLibItem
->
m_RefIdNumber
=
0
;
}
}
}
/**************************************************************/
/**************************************************************/
void
BreakReference
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
)
void
BreakReference
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
)
/**************************************************************/
/**************************************************************/
/* Modifie dans BaseListeCmp la reference des composants en supprimant la
/* Modifie dans BaseListeCmp la reference des composants en supprimant la
partie nombre de la partie texte.
*
partie nombre de la partie texte.
Place le nombre dans .m_NumRef
*
Place le nombre dans .m_NumRef
Pour les composants multiples non encore annotes, met .m_Unit a sa valeur max
*
Pour les composants multiples non encore annotes, met .m_Unit a sa valeur max
Utilise:
*
Utilise:
BaseListeCmp
*
BaseListeCmp
NbOfCmp
*
NbOfCmp
*/
*/
{
{
int
ii
,
ll
;
int
ii
,
ll
;
char
*
Text
;
char
*
Text
;
/* Separation des Numeros de la reference: IC1 -> IC, et 1 dans .m_NumRef */
/* Separation des Numeros de la reference: IC1 -> IC, et 1 dans .m_NumRef */
for
(
ii
=
0
;
ii
<
NbOfCmp
;
ii
++
)
for
(
ii
=
0
;
ii
<
NbOfCmp
;
ii
++
)
{
{
BaseListeCmp
[
ii
].
m_NumRef
=
-
1
;
BaseListeCmp
[
ii
].
m_NumRef
=
-
1
;
Text
=
BaseListeCmp
[
ii
].
m_TextRef
;
Text
=
BaseListeCmp
[
ii
].
m_TextRef
;
ll
=
strlen
(
Text
)
-
1
;
ll
=
strlen
(
Text
)
-
1
;
if
(
Text
[
ll
]
==
'?'
)
if
(
Text
[
ll
]
==
'?'
)
{
{
BaseListeCmp
[
ii
].
m_IsNew
=
TRUE
;
BaseListeCmp
[
ii
].
m_IsNew
=
TRUE
;
if
(
!
BaseListeCmp
[
ii
].
m_PartsLocked
)
if
(
!
BaseListeCmp
[
ii
].
m_PartsLocked
)
BaseListeCmp
[
ii
].
m_Unit
=
0x7FFFFFFF
;
BaseListeCmp
[
ii
].
m_Unit
=
0x7FFFFFFF
;
Text
[
ll
]
=
0
;
continue
;
Text
[
ll
]
=
0
;
continue
;
}
}
if
(
isdigit
(
Text
[
ll
]
)
==
0
)
if
(
isdigit
(
Text
[
ll
]
)
==
0
)
{
{
BaseListeCmp
[
ii
].
m_IsNew
=
TRUE
;
BaseListeCmp
[
ii
].
m_IsNew
=
TRUE
;
if
(
!
BaseListeCmp
[
ii
].
m_PartsLocked
)
if
(
!
BaseListeCmp
[
ii
].
m_PartsLocked
)
BaseListeCmp
[
ii
].
m_Unit
=
0x7FFFFFFF
;
BaseListeCmp
[
ii
].
m_Unit
=
0x7FFFFFFF
;
continue
;
continue
;
}
}
while
(
ll
>=
0
)
while
(
ll
>=
0
)
{
{
if
(
(
Text
[
ll
]
<=
' '
)
||
isdigit
(
Text
[
ll
]
)
)
if
(
(
Text
[
ll
]
<=
' '
)
||
isdigit
(
Text
[
ll
]
)
)
ll
--
;
ll
--
;
else
else
{
{
if
(
isdigit
(
Text
[
ll
+
1
]
)
)
if
(
isdigit
(
Text
[
ll
+
1
]
)
)
BaseListeCmp
[
ii
].
m_NumRef
=
atoi
(
&
Text
[
ll
+
1
]
);
BaseListeCmp
[
ii
].
m_NumRef
=
atoi
(
&
Text
[
ll
+
1
]
);
Text
[
ll
+
1
]
=
0
;
Text
[
ll
+
1
]
=
0
;
break
;
break
;
}
}
}
}
}
}
}
}
/*****************************************************************************/
/*****************************************************************************/
static
void
ComputeReferenceNumber
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
)
static
void
ComputeReferenceNumber
(
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
)
/*****************************************************************************/
/*****************************************************************************/
/* Compute the reference number for components without reference number
/* Compute the reference number for components without reference number
Compute .m_NumRef member
*
Compute .m_NumRef member
*/
*/
{
{
int
ii
,
jj
,
LastReferenceNumber
,
NumberOfUnits
,
Unit
;
int
ii
,
jj
,
LastReferenceNumber
,
NumberOfUnits
,
Unit
;
char
*
Text
,
*
RefText
,
*
ValText
;
char
*
Text
,
*
RefText
,
*
ValText
;
CmpListStruct
*
ObjRef
,
*
ObjToTest
;
CmpListStruct
*
ObjRef
,
*
ObjToTest
;
/* Components with an invisible reference (power...) always are re-annotated*/
/* Components with an invisible reference (power...) always are re-annotated*/
for
(
ii
=
0
;
ii
<
NbOfCmp
;
ii
++
)
for
(
ii
=
0
;
ii
<
NbOfCmp
;
ii
++
)
{
{
Text
=
BaseListeCmp
[
ii
].
m_TextRef
;
Text
=
BaseListeCmp
[
ii
].
m_TextRef
;
if
(
*
Text
==
'#'
)
if
(
*
Text
==
'#'
)
{
{
BaseListeCmp
[
ii
].
m_IsNew
=
TRUE
;
BaseListeCmp
[
ii
].
m_IsNew
=
TRUE
;
BaseListeCmp
[
ii
].
m_NumRef
=
0
;
BaseListeCmp
[
ii
].
m_NumRef
=
0
;
}
}
}
}
ValText
=
RefText
=
""
;
LastReferenceNumber
=
1
;
ValText
=
RefText
=
""
;
LastReferenceNumber
=
1
;
for
(
ii
=
0
;
ii
<
NbOfCmp
;
ii
++
)
for
(
ii
=
0
;
ii
<
NbOfCmp
;
ii
++
)
{
{
ObjRef
=
&
BaseListeCmp
[
ii
];
ObjRef
=
&
BaseListeCmp
[
ii
];
if
(
BaseListeCmp
[
ii
].
m_Flag
)
continue
;
if
(
BaseListeCmp
[
ii
].
m_Flag
)
continue
;
Text
=
BaseListeCmp
[
ii
].
m_TextRef
;
if
(
strnicmp
(
RefText
,
Text
,
32
)
!=
0
)
/* Nouveau Identificateur */
Text
=
BaseListeCmp
[
ii
].
m_TextRef
;
{
if
(
strnicmp
(
RefText
,
Text
,
32
)
!=
0
)
/* Nouveau Identificateur */
RefText
=
BaseListeCmp
[
ii
].
m_TextRef
;
{
LastReferenceNumber
=
GetLastReferenceNumber
(
BaseListeCmp
+
ii
,
BaseListeCmp
,
NbOfCmp
);
RefText
=
BaseListeCmp
[
ii
].
m_TextRef
;
}
LastReferenceNumber
=
GetLastReferenceNumber
(
BaseListeCmp
+
ii
,
BaseListeCmp
,
NbOfCmp
);
}
/* Annotation of mono-part components ( 1 part per package ) (trivial case)*/
if
(
BaseListeCmp
[
ii
].
m_NbParts
<=
1
)
/* Annotation of mono-part components ( 1 part per package ) (trivial case)*/
{
if
(
BaseListeCmp
[
ii
].
m_NbParts
<=
1
)
if
(
BaseListeCmp
[
ii
].
m_IsNew
)
{
{
if
(
BaseListeCmp
[
ii
].
m_IsNew
)
LastReferenceNumber
++
;
{
BaseListeCmp
[
ii
].
m_NumRef
=
LastReferenceNumber
;
LastReferenceNumber
++
;
}
BaseListeCmp
[
ii
].
m_NumRef
=
LastReferenceNumber
;
BaseListeCmp
[
ii
].
m_Unit
=
1
;
}
BaseListeCmp
[
ii
].
m_Flag
=
1
;
BaseListeCmp
[
ii
].
m_Unit
=
1
;
BaseListeCmp
[
ii
].
m_IsNew
=
FALSE
;
BaseListeCmp
[
ii
].
m_Flag
=
1
;
continue
;
BaseListeCmp
[
ii
].
m_IsNew
=
FALSE
;
}
continue
;
}
/* Annotation of multi-part components ( n parts per package ) (complex case) */
ValText
=
BaseListeCmp
[
ii
].
m_TextValue
;
/* Annotation of multi-part components ( n parts per package ) (complex case) */
NumberOfUnits
=
BaseListeCmp
[
ii
].
m_NbParts
;
ValText
=
BaseListeCmp
[
ii
].
m_TextValue
;
NumberOfUnits
=
BaseListeCmp
[
ii
].
m_NbParts
;
if
(
BaseListeCmp
[
ii
].
m_IsNew
)
{
if
(
BaseListeCmp
[
ii
].
m_IsNew
)
LastReferenceNumber
++
;
BaseListeCmp
[
ii
].
m_NumRef
=
LastReferenceNumber
;
{
if
(
!
BaseListeCmp
[
ii
].
m_PartsLocked
)
LastReferenceNumber
++
;
BaseListeCmp
[
ii
].
m_NumRef
=
LastReferenceNumber
;
BaseListeCmp
[
ii
].
m_Unit
=
1
;
if
(
!
BaseListeCmp
[
ii
].
m_PartsLocked
)
BaseListeCmp
[
ii
].
m_Flag
=
1
;
BaseListeCmp
[
ii
].
m_Unit
=
1
;
}
BaseListeCmp
[
ii
].
m_Flag
=
1
;
}
for
(
Unit
=
1
;
Unit
<=
NumberOfUnits
;
Unit
++
)
{
for
(
Unit
=
1
;
Unit
<=
NumberOfUnits
;
Unit
++
)
if
(
BaseListeCmp
[
ii
].
m_Unit
==
Unit
)
continue
;
{
jj
=
ExistUnit
(
BaseListeCmp
+
ii
,
Unit
,
BaseListeCmp
,
NbOfCmp
);
if
(
BaseListeCmp
[
ii
].
m_Unit
==
Unit
)
if
(
jj
>=
0
)
continue
;
/* Unit exists for this reference */
continue
;
jj
=
ExistUnit
(
BaseListeCmp
+
ii
,
Unit
,
BaseListeCmp
,
NbOfCmp
);
/* Search a component to annotate ( same prefix, same value) */
if
(
jj
>=
0
)
for
(
jj
=
ii
+
1
;
jj
<
NbOfCmp
;
jj
++
)
continue
;
/* Unit exists for this reference */
{
ObjToTest
=
&
BaseListeCmp
[
jj
];
/* Search a component to annotate ( same prefix, same value) */
if
(
BaseListeCmp
[
jj
].
m_Flag
)
continue
;
for
(
jj
=
ii
+
1
;
jj
<
NbOfCmp
;
jj
++
)
Text
=
BaseListeCmp
[
jj
].
m_TextRef
;
{
if
(
strnicmp
(
RefText
,
Text
,
32
)
!=
0
)
break
;
// references are different
ObjToTest
=
&
BaseListeCmp
[
jj
];
Text
=
BaseListeCmp
[
jj
].
m_TextValue
;
if
(
BaseListeCmp
[
jj
].
m_Flag
)
if
(
strnicmp
(
ValText
,
Text
,
32
)
!=
0
)
break
;
// values are different
continue
;
if
(
!
BaseListeCmp
[
jj
].
m_IsNew
)
Text
=
BaseListeCmp
[
jj
].
m_TextRef
;
{
if
(
strnicmp
(
RefText
,
Text
,
32
)
!=
0
)
//BaseListeCmp[jj].m_Flag = 1;
break
;
// references are different
continue
;
Text
=
BaseListeCmp
[
jj
].
m_TextValue
;
}
if
(
strnicmp
(
ValText
,
Text
,
32
)
!=
0
)
/* Component without reference number found, annotate it if possible */
break
;
// values are different
if
(
!
BaseListeCmp
[
jj
].
m_PartsLocked
||
(
BaseListeCmp
[
jj
].
m_Unit
==
Unit
)
)
if
(
!
BaseListeCmp
[
jj
].
m_IsNew
)
{
{
BaseListeCmp
[
jj
].
m_NumRef
=
BaseListeCmp
[
ii
].
m_NumRef
;
//BaseListeCmp[jj].m_Flag = 1;
BaseListeCmp
[
jj
].
m_Unit
=
Unit
;
continue
;
BaseListeCmp
[
jj
].
m_Flag
=
1
;
}
BaseListeCmp
[
jj
].
m_IsNew
=
FALSE
;
/* Component without reference number found, annotate it if possible */
break
;
if
(
!
BaseListeCmp
[
jj
].
m_PartsLocked
||
(
BaseListeCmp
[
jj
].
m_Unit
==
Unit
)
)
}
{
}
BaseListeCmp
[
jj
].
m_NumRef
=
BaseListeCmp
[
ii
].
m_NumRef
;
}
BaseListeCmp
[
jj
].
m_Unit
=
Unit
;
}
BaseListeCmp
[
jj
].
m_Flag
=
1
;
BaseListeCmp
[
jj
].
m_IsNew
=
FALSE
;
break
;
}
}
}
}
}
}
/*************************************************************************************************/
/*************************************************************************************************/
static
int
GetLastReferenceNumber
(
CmpListStruct
*
Objet
,
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
)
static
int
GetLastReferenceNumber
(
CmpListStruct
*
Objet
,
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
)
/*************************************************************************************************/
/*************************************************************************************************/
/* Recherche le plus grand numero de reference dans les composants
/* Recherche le plus grand numero de reference dans les composants
de meme prefixe de reference que celui pointe par Objet
*
de meme prefixe de reference que celui pointe par Objet
la liste des composants est supposee triee
*
la liste des composants est supposee triee
*/
*/
{
{
CmpListStruct
*
LastObjet
=
BaseListeCmp
+
NbOfCmp
;
CmpListStruct
*
LastObjet
=
BaseListeCmp
+
NbOfCmp
;
int
LastNumber
=
0
;
int
LastNumber
=
0
;
const
char
*
RefText
;
const
char
*
RefText
;
RefText
=
Objet
->
m_TextRef
;
RefText
=
Objet
->
m_TextRef
;
for
(
;
Objet
<
LastObjet
;
Objet
++
)
for
(
;
Objet
<
LastObjet
;
Objet
++
)
{
{
if
(
strnicmp
(
RefText
,
Objet
->
m_TextRef
,
32
)
!=
0
)
/* Nouveau Identificateur */
if
(
strnicmp
(
RefText
,
Objet
->
m_TextRef
,
32
)
!=
0
)
/* Nouveau Identificateur */
break
;
break
;
if
(
LastNumber
<
Objet
->
m_NumRef
)
LastNumber
=
Objet
->
m_NumRef
;
if
(
LastNumber
<
Objet
->
m_NumRef
)
}
LastNumber
=
Objet
->
m_NumRef
;
return
(
LastNumber
);
}
return
LastNumber
;
}
}
/*****************************************************************/
/*****************************************************************/
static
int
ExistUnit
(
CmpListStruct
*
Objet
,
int
Unit
,
static
int
ExistUnit
(
CmpListStruct
*
Objet
,
int
Unit
,
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
)
CmpListStruct
*
BaseListeCmp
,
int
NbOfCmp
)
/****************************************************************/
/****************************************************************/
/* Recherche dans la liste triee des composants, pour les composants
/* Recherche dans la liste triee des composants, pour les composants
multiples s'il existe pour le composant de reference Objet,
*
multiples s'il existe pour le composant de reference Objet,
une unite de numero Unit
*
une unite de numero Unit
Retourne index dans BaseListeCmp si oui
*
Retourne index dans BaseListeCmp si oui
retourne -1 si non
*
retourne -1 si non
*/
*/
{
{
CmpListStruct
*
EndList
=
BaseListeCmp
+
NbOfCmp
;
CmpListStruct
*
EndList
=
BaseListeCmp
+
NbOfCmp
;
char
*
RefText
,
*
ValText
;
char
*
RefText
,
*
ValText
;
int
NumRef
,
ii
;
int
NumRef
,
ii
;
CmpListStruct
*
ItemToTest
;
CmpListStruct
*
ItemToTest
;
RefText
=
Objet
->
m_TextRef
;
RefText
=
Objet
->
m_TextRef
;
ValText
=
Objet
->
m_TextValue
;
ValText
=
Objet
->
m_TextValue
;
NumRef
=
Objet
->
m_NumRef
;
NumRef
=
Objet
->
m_NumRef
;
for
(
ItemToTest
=
BaseListeCmp
,
ii
=
0
;
ItemToTest
<
EndList
;
ItemToTest
++
,
ii
++
)
for
(
ItemToTest
=
BaseListeCmp
,
ii
=
0
;
ItemToTest
<
EndList
;
ItemToTest
++
,
ii
++
)
{
{
if
(
Objet
==
ItemToTest
)
continue
;
if
(
Objet
==
ItemToTest
)
if
(
ItemToTest
->
m_IsNew
)
continue
;
/* non affecte */
continue
;
if
(
ItemToTest
->
m_NumRef
!=
NumRef
)
continue
;
if
(
ItemToTest
->
m_IsNew
)
if
(
strnicmp
(
RefText
,
ItemToTest
->
m_TextRef
,
32
)
!=
0
)
/* Nouveau Identificateur */
continue
;
/* non affecte */
continue
;
if
(
ItemToTest
->
m_NumRef
!=
NumRef
)
if
(
ItemToTest
->
m_Unit
==
Unit
)
continue
;
{
if
(
strnicmp
(
RefText
,
ItemToTest
->
m_TextRef
,
32
)
!=
0
)
/* Nouveau Identificateur */
return
(
ii
);
continue
;
}
if
(
ItemToTest
->
m_Unit
==
Unit
)
}
{
return
(
-
1
);
return
ii
;
}
}
return
-
1
;
}
}
/******************************************************************/
/******************************************************************/
int
CheckAnnotate
(
WinEDA_SchematicFrame
*
frame
,
bool
OneSheetOnly
)
int
CheckAnnotate
(
WinEDA_SchematicFrame
*
frame
,
bool
OneSheetOnly
)
/******************************************************************/
/******************************************************************/
/* Retourne le nombre de composants non annots ou de meme rfrence (doubls)
/* Retourne le nombre de composants non annots ou de meme rfrence (doubls)
Si OneSheetOnly : recherche sur le schema courant
*
Si OneSheetOnly : recherche sur le schema courant
sinon: recherche sur toute la hierarchie
*
sinon: recherche sur toute la hierarchie
*/
*/
{
{
int
NbSheet
,
ii
,
NumSheet
=
1
,
error
,
NbOfCmp
;
int
NbSheet
,
ii
,
NumSheet
=
1
,
error
,
NbOfCmp
;
SCH_SCREEN
*
screen
;
SCH_SCREEN
*
screen
;
CmpListStruct
*
ListeCmp
=
NULL
;
CmpListStruct
*
ListeCmp
=
NULL
;
wxString
Buff
;
wxString
Buff
;
wxString
msg
,
cmpref
;
wxString
msg
,
cmpref
;
/* build tje screen list */
/* build tje screen list */
EDA_ScreenList
ScreenList
(
NULL
);
EDA_ScreenList
ScreenList
(
NULL
);
NbSheet
=
ScreenList
.
GetCount
();
NbSheet
=
ScreenList
.
GetCount
();
/* Update the sheet number, sheet count and date */
ScreenSch
->
SetModify
();
/* Update the sheet number, sheet count and date */
ScreenList
.
UpdateSheetNumberAndDate
();
ScreenSch
->
SetModify
();
ScreenList
.
UpdateSheetNumberAndDate
();
/* 1ere passe : Comptage du nombre de composants */
screen
=
(
SCH_SCREEN
*
)
frame
->
m_CurrentScreen
;
/* 1ere passe : Comptage du nombre de composants */
if
(
!
OneSheetOnly
)
screen
=
(
SCH_SCREEN
*
)
frame
->
m_CurrentScreen
;
{
if
(
!
OneSheetOnly
)
NbOfCmp
=
0
;
{
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
NbOfCmp
=
0
;
{
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
NbOfCmp
+=
ListeComposants
(
NULL
,
screen
,
NumSheet
);
{
}
NbOfCmp
+=
ListeComposants
(
NULL
,
screen
,
NumSheet
);
}
}
else
NbOfCmp
=
ListeComposants
(
NULL
,
screen
,
NumSheet
);
}
else
if
(
NbOfCmp
==
0
)
NbOfCmp
=
ListeComposants
(
NULL
,
screen
,
NumSheet
);
{
wxBell
();
if
(
NbOfCmp
==
0
)
return
(
0
);
{
}
wxBell
();
return
0
;
ii
=
sizeof
(
CmpListStruct
)
*
NbOfCmp
;
}
ListeCmp
=
(
CmpListStruct
*
)
MyZMalloc
(
ii
);
ii
=
sizeof
(
CmpListStruct
)
*
NbOfCmp
;
/* 2eme passe : Remplissage du tableau des caracteristiques */
ListeCmp
=
(
CmpListStruct
*
)
MyZMalloc
(
ii
);
if
(
OneSheetOnly
==
0
)
{
/* 2eme passe : Remplissage du tableau des caracteristiques */
ii
=
0
;
screen
=
ScreenSch
;
if
(
OneSheetOnly
==
0
)
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
{
{
ii
=
0
;
screen
=
ScreenSch
;
ii
+=
ListeComposants
(
ListeCmp
+
ii
,
screen
,
NumSheet
);
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
}
{
}
ii
+=
ListeComposants
(
ListeCmp
+
ii
,
screen
,
NumSheet
);
else
}
{
}
screen
=
(
SCH_SCREEN
*
)
frame
->
m_CurrentScreen
;
else
ListeComposants
(
ListeCmp
,
screen
,
NumSheet
);
{
}
screen
=
(
SCH_SCREEN
*
)
frame
->
m_CurrentScreen
;
ListeComposants
(
ListeCmp
,
screen
,
NumSheet
);
qsort
(
ListeCmp
,
NbOfCmp
,
sizeof
(
CmpListStruct
),
}
(
int
(
*
)(
const
void
*
,
const
void
*
))
AnnotTriComposant
);
qsort
(
ListeCmp
,
NbOfCmp
,
sizeof
(
CmpListStruct
),
(
int
(
*
)
(
const
void
*
,
const
void
*
)
)
AnnotTriComposant
);
/* Separation des Numeros de la reference: IC1 -> IC, et 1 dans .m_NumRef */
BreakReference
(
ListeCmp
,
NbOfCmp
);
/* Separation des Numeros de la reference: IC1 -> IC, et 1 dans .m_NumRef */
/* comptage des elements non annotes */
BreakReference
(
ListeCmp
,
NbOfCmp
);
error
=
0
;
for
(
ii
=
0
;
ii
<
NbOfCmp
-
1
;
ii
++
)
/* comptage des elements non annotes */
{
error
=
0
;
msg
.
Empty
();
Buff
.
Empty
();
for
(
ii
=
0
;
ii
<
NbOfCmp
-
1
;
ii
++
)
if
(
ListeCmp
[
ii
].
m_IsNew
)
{
{
msg
.
Empty
();
Buff
.
Empty
();
if
(
ListeCmp
[
ii
].
m_NumRef
>=
0
)
Buff
<<
ListeCmp
[
ii
].
m_NumRef
;
if
(
ListeCmp
[
ii
].
m_IsNew
)
else
Buff
=
wxT
(
"?"
);
{
cmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextRef
);
if
(
ListeCmp
[
ii
].
m_NumRef
>=
0
)
msg
.
Printf
(
_
(
"item not annotated: %s%s"
),
cmpref
.
GetData
(),
Buff
.
GetData
());
Buff
<<
ListeCmp
[
ii
].
m_NumRef
;
else
if
(
(
ListeCmp
[
ii
].
m_Unit
>
0
)
&&
(
ListeCmp
[
ii
].
m_Unit
<
0x7FFFFFFF
)
)
Buff
=
wxT
(
"?"
);
{
cmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextRef
);
Buff
.
Printf
(
_
(
"( unit %d)"
),
ListeCmp
[
ii
].
m_Unit
);
msg
.
Printf
(
_
(
"item not annotated: %s%s"
),
cmpref
.
GetData
(),
Buff
.
GetData
()
);
msg
<<
Buff
;
}
if
(
(
ListeCmp
[
ii
].
m_Unit
>
0
)
&&
(
ListeCmp
[
ii
].
m_Unit
<
0x7FFFFFFF
)
)
DisplayError
(
NULL
,
msg
);
{
error
++
;
break
;
Buff
.
Printf
(
_
(
"( unit %d)"
),
ListeCmp
[
ii
].
m_Unit
);
}
msg
<<
Buff
;
}
if
(
MAX
(
ListeCmp
[
ii
].
m_NbParts
,
1
)
<
ListeCmp
[
ii
].
m_Unit
)
// Annotate error
DisplayError
(
NULL
,
msg
);
{
error
++
;
break
;
if
(
ListeCmp
[
ii
].
m_NumRef
>=
0
)
Buff
<<
ListeCmp
[
ii
].
m_NumRef
;
}
else
Buff
=
wxT
(
"?"
);
if
(
MAX
(
ListeCmp
[
ii
].
m_NbParts
,
1
)
<
ListeCmp
[
ii
].
m_Unit
)
// Annotate error
cmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextRef
);
{
msg
.
Printf
(
_
(
"Error item %s%s"
),
cmpref
.
GetData
(),
Buff
.
GetData
());
if
(
ListeCmp
[
ii
].
m_NumRef
>=
0
)
Buff
<<
ListeCmp
[
ii
].
m_NumRef
;
Buff
.
Printf
(
_
(
" unit %d and no more than %d parts"
),
else
ListeCmp
[
ii
].
m_Unit
,
ListeCmp
[
ii
].
m_NbParts
);
Buff
=
wxT
(
"?"
);
msg
<<
Buff
;
DisplayError
(
frame
,
msg
);
cmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextRef
);
error
++
;
break
;
msg
.
Printf
(
_
(
"Error item %s%s"
),
cmpref
.
GetData
(),
Buff
.
GetData
()
);
}
}
Buff
.
Printf
(
_
(
" unit %d and no more than %d parts"
),
ListeCmp
[
ii
].
m_Unit
,
ListeCmp
[
ii
].
m_NbParts
);
if
(
error
)
return
error
;
msg
<<
Buff
;
DisplayError
(
frame
,
msg
);
/* comptage des elements doubls (si tous sont annots) */
error
++
;
break
;
for
(
ii
=
0
;
(
ii
<
NbOfCmp
-
1
)
&&
(
error
<
4
);
ii
++
)
}
{
}
msg
.
Empty
();
Buff
.
Empty
();
if
(
(
stricmp
(
ListeCmp
[
ii
].
m_TextRef
,
ListeCmp
[
ii
+
1
].
m_TextRef
)
!=
0
)
||
if
(
error
)
(
ListeCmp
[
ii
].
m_NumRef
!=
ListeCmp
[
ii
+
1
].
m_NumRef
)
)
return
error
;
continue
;
/* Meme reference trouve */
/* comptage des elements doubls (si tous sont annots) */
for
(
ii
=
0
;
(
ii
<
NbOfCmp
-
1
)
&&
(
error
<
4
);
ii
++
)
/* Il y a erreur si meme unite */
{
if
(
ListeCmp
[
ii
].
m_Unit
==
ListeCmp
[
ii
+
1
].
m_Unit
)
msg
.
Empty
();
Buff
.
Empty
();
{
if
(
(
stricmp
(
ListeCmp
[
ii
].
m_TextRef
,
ListeCmp
[
ii
+
1
].
m_TextRef
)
!=
0
)
||
(
ListeCmp
[
ii
].
m_NumRef
!=
ListeCmp
[
ii
+
1
].
m_NumRef
)
)
if
(
ListeCmp
[
ii
].
m_NumRef
>=
0
)
Buff
<<
ListeCmp
[
ii
].
m_NumRef
;
continue
;
else
Buff
=
wxT
(
"?"
);
/* Meme reference trouve */
cmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextRef
);
/* Il y a erreur si meme unite */
msg
.
Printf
(
_
(
"Multiple item %s%s"
),
if
(
ListeCmp
[
ii
].
m_Unit
==
ListeCmp
[
ii
+
1
].
m_Unit
)
cmpref
.
GetData
(),
Buff
.
GetData
());
{
if
(
ListeCmp
[
ii
].
m_NumRef
>=
0
)
if
(
(
ListeCmp
[
ii
].
m_Unit
>
0
)
&&
(
ListeCmp
[
ii
].
m_Unit
<
0x7FFFFFFF
)
)
Buff
<<
ListeCmp
[
ii
].
m_NumRef
;
{
else
Buff
.
Printf
(
_
(
" (unit %d)"
),
ListeCmp
[
ii
].
m_Unit
);
Buff
=
wxT
(
"?"
);
msg
<<
Buff
;
}
cmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextRef
);
DisplayError
(
frame
,
msg
);
msg
.
Printf
(
_
(
"Multiple item %s%s"
),
error
++
;
continue
;
cmpref
.
GetData
(),
Buff
.
GetData
()
);
}
if
(
(
ListeCmp
[
ii
].
m_Unit
>
0
)
&&
(
ListeCmp
[
ii
].
m_Unit
<
0x7FFFFFFF
)
)
/* Il y a erreur si unites differentes mais nombre de parts differentes
{
par boitier (ex U3 ( 1 part) et U3B sont incompatibles) */
Buff
.
Printf
(
_
(
" (unit %d)"
),
ListeCmp
[
ii
].
m_Unit
);
if
(
ListeCmp
[
ii
].
m_NbParts
!=
ListeCmp
[
ii
+
1
].
m_NbParts
)
msg
<<
Buff
;
{
}
DisplayError
(
frame
,
msg
);
if
(
ListeCmp
[
ii
].
m_NumRef
>=
0
)
Buff
<<
ListeCmp
[
ii
].
m_NumRef
;
error
++
;
continue
;
else
Buff
=
wxT
(
"?"
);
}
cmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextRef
);
/* Il y a erreur si unites differentes mais nombre de parts differentes
msg
.
Printf
(
_
(
"Multiple item %s%s"
),
cmpref
.
GetData
(),
Buff
.
GetData
());
* par boitier (ex U3 ( 1 part) et U3B sont incompatibles) */
if
(
ListeCmp
[
ii
].
m_NbParts
!=
ListeCmp
[
ii
+
1
].
m_NbParts
)
if
(
(
ListeCmp
[
ii
].
m_Unit
>
0
)
&&
(
ListeCmp
[
ii
].
m_Unit
<
0x7FFFFFFF
)
)
{
{
if
(
ListeCmp
[
ii
].
m_NumRef
>=
0
)
Buff
.
Printf
(
_
(
" (unit %d)"
),
ListeCmp
[
ii
].
m_Unit
);
Buff
<<
ListeCmp
[
ii
].
m_NumRef
;
msg
<<
Buff
;
else
}
Buff
=
wxT
(
"?"
);
DisplayError
(
frame
,
msg
);
cmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextRef
);
error
++
;
msg
.
Printf
(
_
(
"Multiple item %s%s"
),
cmpref
.
GetData
(),
Buff
.
GetData
()
);
}
if
(
(
ListeCmp
[
ii
].
m_Unit
>
0
)
&&
(
ListeCmp
[
ii
].
m_Unit
<
0x7FFFFFFF
)
)
/* Il y a erreur si unites differentes ET valeurs diffrentes */
{
if
(
stricmp
(
ListeCmp
[
ii
].
m_TextValue
,
ListeCmp
[
ii
+
1
].
m_TextValue
)
!=
0
)
Buff
.
Printf
(
_
(
" (unit %d)"
),
ListeCmp
[
ii
].
m_Unit
);
{
msg
<<
Buff
;
wxString
nextcmpref
,
cmpvalue
,
nextcmpvalue
;
}
cmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextRef
);
nextcmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
+
1
].
m_TextRef
);
DisplayError
(
frame
,
msg
);
cmpvalue
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextValue
);
error
++
;
nextcmpvalue
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
+
1
].
m_TextValue
);
}
msg
.
Printf
(
_
(
"Diff values for %s%d%c (%s) and %s%d%c (%s)"
),
cmpref
.
GetData
(),
ListeCmp
[
ii
].
m_NumRef
,
ListeCmp
[
ii
].
m_Unit
+
'A'
-
1
,
/* Il y a erreur si unites differentes ET valeurs diffrentes */
cmpvalue
.
GetData
(),
if
(
stricmp
(
ListeCmp
[
ii
].
m_TextValue
,
ListeCmp
[
ii
+
1
].
m_TextValue
)
!=
0
)
nextcmpref
.
GetData
(),
ListeCmp
[
ii
+
1
].
m_NumRef
,
ListeCmp
[
ii
+
1
].
m_Unit
+
'A'
-
1
,
{
nextcmpvalue
.
GetData
());
wxString
nextcmpref
,
cmpvalue
,
nextcmpvalue
;
cmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextRef
);
DisplayError
(
frame
,
msg
);
nextcmpref
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
+
1
].
m_TextRef
);
error
++
;
cmpvalue
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
].
m_TextValue
);
}
nextcmpvalue
=
CONV_FROM_UTF8
(
ListeCmp
[
ii
+
1
].
m_TextValue
);
}
msg
.
Printf
(
_
(
"Diff values for %s%d%c (%s) and %s%d%c (%s)"
),
cmpref
.
GetData
(),
ListeCmp
[
ii
].
m_NumRef
,
ListeCmp
[
ii
].
m_Unit
+
'A'
-
1
,
MyFree
(
ListeCmp
);
cmpvalue
.
GetData
(),
return
(
error
);
nextcmpref
.
GetData
(
),
ListeCmp
[
ii
+
1
].
m_NumRef
,
ListeCmp
[
ii
+
1
].
m_Unit
+
'A'
-
1
,
nextcmpvalue
.
GetData
()
);
DisplayError
(
frame
,
msg
);
error
++
;
}
}
MyFree
(
ListeCmp
);
return
error
;
}
}
eeschema/class_screen.h
View file @
664a1f72
...
@@ -90,11 +90,11 @@ class SCH_SCREEN : public BASE_SCREEN
...
@@ -90,11 +90,11 @@ class SCH_SCREEN : public BASE_SCREEN
public
:
public
:
SCH_SCREEN
(
int
idtype
,
KICAD_T
aType
=
SCREEN_STRUCT_TYPE
);
SCH_SCREEN
(
int
idtype
,
KICAD_T
aType
=
SCREEN_STRUCT_TYPE
);
~
SCH_SCREEN
();
~
SCH_SCREEN
();
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"SCH_SCREEN"
);
return
wxT
(
"SCH_SCREEN"
);
}
}
void
FreeDrawList
();
// Free EESchema drawing list (does not delete the sub hierarchies)
void
FreeDrawList
();
// Free EESchema drawing list (does not delete the sub hierarchies)
...
...
eeschema/cleanup.cpp
View file @
664a1f72
/*********************************/
/*********************************/
/* Module de nettoyage du schema */
/* Module de nettoyage du schema */
/*********************************/
/*********************************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -15,243 +15,254 @@
...
@@ -15,243 +15,254 @@
/* Routines locales */
/* Routines locales */
static
int
TstAlignSegment
(
EDA_DrawLineStruct
*
RefSegm
,
EDA_DrawLineStruct
*
TstSegm
);
static
int
TstAlignSegment
(
EDA_DrawLineStruct
*
RefSegm
,
EDA_DrawLineStruct
*
TstSegm
);
/* Variable locales */
/* Variable locales */
/*******************************************/
/*******************************************/
bool
SCH_SCREEN
::
SchematicCleanUp
(
wxDC
*
DC
)
bool
SCH_SCREEN
::
SchematicCleanUp
(
wxDC
*
DC
)
/*******************************************/
/*******************************************/
/* Routine de nettoyage:
/* Routine de nettoyage:
- regroupe les segments de fils (ou de bus) alignes en 1 seul segment
*
- regroupe les segments de fils (ou de bus) alignes en 1 seul segment
- Detecte les objets identiques superposes
*
- Detecte les objets identiques superposes
*/
*/
{
{
EDA_BaseStruct
*
DrawList
,
*
TstDrawList
;
EDA_BaseStruct
*
DrawList
,
*
TstDrawList
;
int
flag
;
int
flag
;
bool
Modify
=
FALSE
;
bool
Modify
=
FALSE
;
DrawList
=
EEDrawList
;
DrawList
=
EEDrawList
;
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Pnext
)
{
{
if
(
DrawList
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
if
(
DrawList
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
{
{
TstDrawList
=
DrawList
->
Pnext
;
TstDrawList
=
DrawList
->
Pnext
;
while
(
TstDrawList
)
while
(
TstDrawList
)
{
{
if
(
TstDrawList
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
if
(
TstDrawList
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
{
{
flag
=
TstAlignSegment
(
(
EDA_DrawLineStruct
*
)
DrawList
,
flag
=
TstAlignSegment
(
(
EDA_DrawLineStruct
*
)
DrawList
,
(
EDA_DrawLineStruct
*
)
TstDrawList
);
(
EDA_DrawLineStruct
*
)
TstDrawList
);
if
(
flag
)
/* Suppression de TstSegm */
if
(
flag
)
/* Suppression de TstSegm */
{
{
/* keep the bits set in .m_Flags, because the deleted segment can be flagged */
/* keep the bits set in .m_Flags, because the deleted segment can be flagged */
DrawList
->
m_Flags
|=
TstDrawList
->
m_Flags
;
DrawList
->
m_Flags
|=
TstDrawList
->
m_Flags
;
EraseStruct
(
TstDrawList
,
this
);
EraseStruct
(
TstDrawList
,
this
);
SetRefreshReq
();
SetRefreshReq
();
TstDrawList
=
EEDrawList
;
TstDrawList
=
EEDrawList
;
Modify
=
TRUE
;
Modify
=
TRUE
;
}
}
else
TstDrawList
=
TstDrawList
->
Pnext
;
else
}
TstDrawList
=
TstDrawList
->
Pnext
;
else
TstDrawList
=
TstDrawList
->
Pnext
;
}
}
else
}
TstDrawList
=
TstDrawList
->
Pnext
;
}
}
EDA_Appl
->
SchematicFrame
->
TestDanglingEnds
(
EEDrawList
,
DC
);
}
return
Modify
;
}
EDA_Appl
->
SchematicFrame
->
TestDanglingEnds
(
EEDrawList
,
DC
);
return
Modify
;
}
}
/***********************************************/
/***********************************************/
void
BreakSegmentOnJunction
(
SCH_SCREEN
*
Screen
)
void
BreakSegmentOnJunction
(
SCH_SCREEN
*
Screen
)
/************************************************/
/************************************************/
/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions
/* Routine creant des debuts / fin de segment (BUS ou WIRES) sur les jonctions
et les raccords
*
et les raccords
*/
*/
{
{
EDA_BaseStruct
*
DrawList
;
EDA_BaseStruct
*
DrawList
;
if
(
Screen
==
NULL
)
if
(
Screen
==
NULL
)
{
{
DisplayError
(
NULL
,
wxT
(
"BreakSegmentOnJunction() error: NULL screen"
)
);
DisplayError
(
NULL
,
wxT
(
"BreakSegmentOnJunction() error: NULL screen"
)
);
return
;
return
;
}
}
DrawList
=
Screen
->
EEDrawList
;
DrawList
=
Screen
->
EEDrawList
;
while
(
DrawList
)
while
(
DrawList
)
{
{
switch
(
DrawList
->
Type
()
)
switch
(
DrawList
->
Type
()
)
{
{
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_JUNCTION_STRUCT_TYPE
:
#undef STRUCT
#undef STRUCT
#define STRUCT ((DrawJunctionStruct*)DrawList
)
#define STRUCT ( (DrawJunctionStruct*) DrawList
)
BreakSegment
(
Screen
,
STRUCT
->
m_Pos
);
BreakSegment
(
Screen
,
STRUCT
->
m_Pos
);
break
;
break
;
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
#undef STRUCT
#undef STRUCT
#define STRUCT ((DrawBusEntryStruct*)DrawList
)
#define STRUCT ( (DrawBusEntryStruct*) DrawList
)
BreakSegment
(
Screen
,
STRUCT
->
m_Pos
);
BreakSegment
(
Screen
,
STRUCT
->
m_Pos
);
BreakSegment
(
Screen
,
STRUCT
->
m_End
()
);
BreakSegment
(
Screen
,
STRUCT
->
m_End
()
);
break
;
break
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_NOCONNECT_STRUCT_TYPE
:
case
DRAW_NOCONNECT_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_TEXT_STRUCT_TYPE
:
case
DRAW_SHEET_STRUCT_TYPE
:
case
DRAW_SHEET_STRUCT_TYPE
:
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
break
;
break
;
default
:
default
:
break
;
break
;
}
}
DrawList
=
DrawList
->
Pnext
;
DrawList
=
DrawList
->
Pnext
;
}
}
}
}
/*********************************************************/
/*********************************************************/
DrawPickedStruct
*
BreakSegment
(
SCH_SCREEN
*
screen
,
DrawPickedStruct
*
BreakSegment
(
SCH_SCREEN
*
screen
,
wxPoint
breakpoint
,
bool
PutInUndoList
)
wxPoint
breakpoint
,
bool
PutInUndoList
)
/*********************************************************/
/*********************************************************/
/* Coupe un segment ( BUS, WIRE ) en 2 au point breakpoint,
/* Coupe un segment ( BUS, WIRE ) en 2 au point breakpoint,
- si ce point est sur le segment
*
- si ce point est sur le segment
- extremites non comprises
*
- extremites non comprises
If PutInUndoList == TRUE, create a list of modifictions, for undo command
*
If PutInUndoList == TRUE, create a list of modifictions, for undo command
*/
*/
{
{
EDA_BaseStruct
*
DrawList
;
EDA_BaseStruct
*
DrawList
;
EDA_DrawLineStruct
*
segment
,
*
NewSegment
;
EDA_DrawLineStruct
*
segment
,
*
NewSegment
;
int
ox
,
oy
,
fx
,
fy
;
int
ox
,
oy
,
fx
,
fy
;
DrawPickedStruct
*
List
=
NULL
;
DrawPickedStruct
*
List
=
NULL
;
DrawList
=
screen
->
EEDrawList
;
DrawList
=
screen
->
EEDrawList
;
while
(
DrawList
)
while
(
DrawList
)
{
{
switch
(
DrawList
->
Type
()
)
switch
(
DrawList
->
Type
()
)
{
{
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_SEGMENT_STRUCT_TYPE
:
segment
=
(
EDA_DrawLineStruct
*
)
DrawList
;
segment
=
(
EDA_DrawLineStruct
*
)
DrawList
;
ox
=
segment
->
m_Start
.
x
;
oy
=
segment
->
m_Start
.
y
;
ox
=
segment
->
m_Start
.
x
;
oy
=
segment
->
m_Start
.
y
;
fx
=
segment
->
m_End
.
x
;
fy
=
segment
->
m_End
.
y
;
fx
=
segment
->
m_End
.
x
;
fy
=
segment
->
m_End
.
y
;
if
(
distance
(
fx
-
ox
,
fy
-
oy
,
breakpoint
.
x
-
ox
,
breakpoint
.
y
-
oy
,
0
)
==
0
)
if
(
distance
(
fx
-
ox
,
fy
-
oy
,
breakpoint
.
x
-
ox
,
breakpoint
.
y
-
oy
,
0
)
==
0
)
break
;
break
;
/* Segment connecte: doit etre coupe en 2 si px,py n'est
pas une extremite */
if
(
(
ox
==
breakpoint
.
x
)
&&
(
oy
==
breakpoint
.
y
)
)
break
;
if
(
(
fx
==
breakpoint
.
x
)
&&
(
fy
==
breakpoint
.
y
)
)
break
;
/* Ici il faut couper le segment en 2 */
if
(
PutInUndoList
)
// First: put copy of the old segment in undo list
{
DrawPickedStruct
*
wrapper
=
new
DrawPickedStruct
();
wrapper
->
m_Flags
=
IS_CHANGED
;
wrapper
->
m_PickedStruct
=
segment
->
GenCopy
();
wrapper
->
m_Image
=
segment
;
wrapper
->
m_PickedStruct
->
m_Image
=
segment
;
wrapper
->
Pnext
=
List
;
List
=
wrapper
;
}
NewSegment
=
segment
->
GenCopy
();
NewSegment
->
m_Start
=
breakpoint
;
segment
->
m_End
=
NewSegment
->
m_Start
;
NewSegment
->
Pnext
=
segment
->
Pnext
;
segment
->
Pnext
=
NewSegment
;
DrawList
=
NewSegment
;
if
(
PutInUndoList
)
{
DrawPickedStruct
*
wrapper
=
new
DrawPickedStruct
();
wrapper
->
m_Flags
=
IS_NEW
;
wrapper
->
m_Image
=
NewSegment
;
wrapper
->
Pnext
=
List
;
List
=
wrapper
;
}
break
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
break
;
default
:
break
;
}
DrawList
=
DrawList
->
Pnext
;
}
return
List
;
}
/* Segment connecte: doit etre coupe en 2 si px,py n'est
* pas une extremite */
if
(
(
ox
==
breakpoint
.
x
)
&&
(
oy
==
breakpoint
.
y
)
)
break
;
if
(
(
fx
==
breakpoint
.
x
)
&&
(
fy
==
breakpoint
.
y
)
)
break
;
/* Ici il faut couper le segment en 2 */
if
(
PutInUndoList
)
// First: put copy of the old segment in undo list
{
DrawPickedStruct
*
wrapper
=
new
DrawPickedStruct
();
wrapper
->
m_Flags
=
IS_CHANGED
;
wrapper
->
m_PickedStruct
=
segment
->
GenCopy
();
wrapper
->
m_Image
=
segment
;
wrapper
->
m_PickedStruct
->
m_Image
=
segment
;
wrapper
->
Pnext
=
List
;
List
=
wrapper
;
}
NewSegment
=
segment
->
GenCopy
();
NewSegment
->
m_Start
=
breakpoint
;
segment
->
m_End
=
NewSegment
->
m_Start
;
NewSegment
->
Pnext
=
segment
->
Pnext
;
segment
->
Pnext
=
NewSegment
;
DrawList
=
NewSegment
;
if
(
PutInUndoList
)
{
DrawPickedStruct
*
wrapper
=
new
DrawPickedStruct
();
wrapper
->
m_Flags
=
IS_NEW
;
wrapper
->
m_Image
=
NewSegment
;
wrapper
->
Pnext
=
List
;
List
=
wrapper
;
}
break
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
DRAW_POLYLINE_STRUCT_TYPE
:
break
;
default
:
break
;
}
DrawList
=
DrawList
->
Pnext
;
}
return
List
;
}
/***********************************************************/
/***********************************************************/
static
int
TstAlignSegment
(
EDA_DrawLineStruct
*
RefSegm
,
static
int
TstAlignSegment
(
EDA_DrawLineStruct
*
RefSegm
,
EDA_DrawLineStruct
*
TstSegm
)
EDA_DrawLineStruct
*
TstSegm
)
/***********************************************************/
/***********************************************************/
/* Search if the 2 segments RefSegm and TstSegm are on a line.
/* Search if the 2 segments RefSegm and TstSegm are on a line.
Retourn 0 if no
*
Retourn 0 if no
1 if yes, and RefSegm is modified to be the equivalent segment
*
1 if yes, and RefSegm is modified to be the equivalent segment
*/
*/
{
{
if
(
RefSegm
==
TstSegm
)
return
(
0
);
if
(
RefSegm
==
TstSegm
)
if
(
RefSegm
->
m_Layer
!=
TstSegm
->
m_Layer
)
return
(
0
);
return
0
;
if
(
RefSegm
->
m_Layer
!=
TstSegm
->
m_Layer
)
// search for a common end, and modify coordinates to ensure RefSegm->m_End == TstSegm->m_Start
return
0
;
if
(
RefSegm
->
m_Start
==
TstSegm
->
m_Start
)
{
// search for a common end, and modify coordinates to ensure RefSegm->m_End == TstSegm->m_Start
if
(
RefSegm
->
m_End
==
TstSegm
->
m_End
)
// trivial case: RefSegm and TstSegm are identical
if
(
RefSegm
->
m_Start
==
TstSegm
->
m_Start
)
return
1
;
{
EXCHG
(
RefSegm
->
m_Start
,
RefSegm
->
m_End
);
// at this point, RefSegm->m_End == TstSegm->m_Start
if
(
RefSegm
->
m_End
==
TstSegm
->
m_End
)
// trivial case: RefSegm and TstSegm are identical
}
return
1
;
else
if
(
RefSegm
->
m_Start
==
TstSegm
->
m_End
)
EXCHG
(
RefSegm
->
m_Start
,
RefSegm
->
m_End
);
// at this point, RefSegm->m_End == TstSegm->m_Start
{
}
EXCHG
(
RefSegm
->
m_Start
,
RefSegm
->
m_End
);
else
if
(
RefSegm
->
m_Start
==
TstSegm
->
m_End
)
EXCHG
(
TstSegm
->
m_Start
,
TstSegm
->
m_End
);
// at this point, RefSegm->m_End == TstSegm->m_Start
{
}
EXCHG
(
RefSegm
->
m_Start
,
RefSegm
->
m_End
);
else
if
(
RefSegm
->
m_End
==
TstSegm
->
m_End
)
EXCHG
(
TstSegm
->
m_Start
,
TstSegm
->
m_End
);
// at this point, RefSegm->m_End == TstSegm->m_Start
{
}
EXCHG
(
TstSegm
->
m_Start
,
TstSegm
->
m_End
);
// at this point, RefSegm->m_End == TstSegm->m_Start
else
if
(
RefSegm
->
m_End
==
TstSegm
->
m_End
)
}
{
else
if
(
RefSegm
->
m_End
!=
TstSegm
->
m_Start
)
// No common end point, segments cannot be merged
EXCHG
(
TstSegm
->
m_Start
,
TstSegm
->
m_End
);
// at this point, RefSegm->m_End == TstSegm->m_Start
return
0
;
}
else
if
(
RefSegm
->
m_End
!=
TstSegm
->
m_Start
)
// No common end point, segments cannot be merged
/* Test alignment: */
return
0
;
if
(
RefSegm
->
m_Start
.
y
==
RefSegm
->
m_End
.
y
)
// Horizontal segment
{
if
(
TstSegm
->
m_Start
.
y
==
TstSegm
->
m_End
.
y
)
{
RefSegm
->
m_End
=
TstSegm
->
m_End
;
return
1
;
}
}
else
if
(
RefSegm
->
m_Start
.
x
==
RefSegm
->
m_End
.
x
)
// Vertical segment
{
if
(
TstSegm
->
m_Start
.
x
==
TstSegm
->
m_End
.
x
)
{
RefSegm
->
m_End
=
TstSegm
->
m_End
;
return
1
;
}
}
else
{
if
(
atan2
(
RefSegm
->
m_Start
.
x
-
RefSegm
->
m_End
.
x
,
RefSegm
->
m_Start
.
y
-
RefSegm
->
m_End
.
y
)
==
atan2
(
TstSegm
->
m_Start
.
x
-
TstSegm
->
m_End
.
x
,
TstSegm
->
m_Start
.
y
-
TstSegm
->
m_End
.
y
)
)
{
RefSegm
->
m_End
=
TstSegm
->
m_End
;
return
1
;
}
}
return
(
0
);
}
/* Test alignment: */
if
(
RefSegm
->
m_Start
.
y
==
RefSegm
->
m_End
.
y
)
// Horizontal segment
{
if
(
TstSegm
->
m_Start
.
y
==
TstSegm
->
m_End
.
y
)
{
RefSegm
->
m_End
=
TstSegm
->
m_End
;
return
1
;
}
}
else
if
(
RefSegm
->
m_Start
.
x
==
RefSegm
->
m_End
.
x
)
// Vertical segment
{
if
(
TstSegm
->
m_Start
.
x
==
TstSegm
->
m_End
.
x
)
{
RefSegm
->
m_End
=
TstSegm
->
m_End
;
return
1
;
}
}
else
{
if
(
atan2
(
RefSegm
->
m_Start
.
x
-
RefSegm
->
m_End
.
x
,
RefSegm
->
m_Start
.
y
-
RefSegm
->
m_End
.
y
)
==
atan2
(
TstSegm
->
m_Start
.
x
-
TstSegm
->
m_End
.
x
,
TstSegm
->
m_Start
.
y
-
TstSegm
->
m_End
.
y
)
)
{
RefSegm
->
m_End
=
TstSegm
->
m_End
;
return
1
;
}
}
return
0
;
}
eeschema/cmpclass.cpp
View file @
664a1f72
...
@@ -143,6 +143,23 @@ wxString DrawMarkerStruct::GetComment()
...
@@ -143,6 +143,23 @@ wxString DrawMarkerStruct::GetComment()
}
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
DrawMarkerStruct
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
// for now, make it look like XML:
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
m_Pos
<<
"/>
\n
"
;
}
#endif
/***************************/
/***************************/
/* Class EDA_DrawLineStruct */
/* Class EDA_DrawLineStruct */
/***************************/
/***************************/
...
@@ -201,6 +218,28 @@ bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos )
...
@@ -201,6 +218,28 @@ bool EDA_DrawLineStruct::IsOneEndPointAt( const wxPoint& pos )
}
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
EDA_DrawLineStruct
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
" layer=
\"
"
<<
m_Layer
<<
'"'
<<
" width=
\"
"
<<
m_Width
<<
'"'
<<
" startIsDangling=
\"
"
<<
m_StartIsDangling
<<
'"'
<<
" endIsDangling=
\"
"
<<
m_EndIsDangling
<<
'"'
<<
">"
<<
" <start"
<<
m_Start
<<
"/>"
<<
" <end"
<<
m_End
<<
"/>"
<<
"</"
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
}
#endif
/****************************/
/****************************/
/* Class DrawPolylineStruct */
/* Class DrawPolylineStruct */
/****************************/
/****************************/
...
...
eeschema/component_class.cpp
View file @
664a1f72
...
@@ -17,94 +17,121 @@
...
@@ -17,94 +17,121 @@
#include "macros.h"
#include "macros.h"
/***************************/
/***************************/
/* class DrawPartStruct */
/* class DrawPartStruct */
/* class EDA_SchComponentStruct */
/* class EDA_SchComponentStruct */
/***************************/
/***************************/
/***********************************************************************************/
/***********************************************************************************/
DrawPartStruct
::
DrawPartStruct
(
KICAD_T
struct_type
,
const
wxPoint
&
pos
)
:
DrawPartStruct
::
DrawPartStruct
(
KICAD_T
struct_type
,
const
wxPoint
&
pos
)
:
EDA_BaseStruct
(
struct_type
)
EDA_BaseStruct
(
struct_type
)
/***********************************************************************************/
/***********************************************************************************/
{
{
m_Pos
=
pos
;
m_Layer
=
0
;
m_TimeStamp
=
0
;
m_Pos
=
pos
;
m_TimeStamp
=
0
;
}
}
/************************************/
/************************************/
DrawPartStruct
::~
DrawPartStruct
()
DrawPartStruct
::~
DrawPartStruct
()
/************************************/
/************************************/
{
{
}
}
/****************************************************************/
/****************************************************************/
wxString
ReturnDefaultFieldName
(
int
FieldNumber
)
const
wxString
&
ReturnDefaultFieldName
(
int
aFieldNdx
)
/****************************************************************/
/****************************************************************/
/* Return the defult ield name from its number (REFERENCE, VALUE ..)
FieldDefaultNameList is not static, because we want the text translation
/* Return the default field name from its index (REFERENCE, VALUE ..)
for I18n
* FieldDefaultNameList is not static, because we want the text translation
*/
* for I18n
*/
{
{
wxString
FieldDefaultNameList
[]
=
{
// avoid unnecessarily copying wxStrings.
_
(
"Ref"
),
/* Reference of part, i.e. "IC21" */
static
const
wxString
FieldDefaultNameList
[]
=
{
_
(
"Value"
),
/* Value of part, i.e. "3.3K" */
_
(
"Ref"
),
/* Reference of part, i.e. "IC21" */
_
(
"Footprint"
),
/* Footprint, used by cvpcb or pcbnew, i.e. "16DIP300" */
_
(
"Value"
),
/* Value of part, i.e. "3.3K" */
_
(
"Sheet"
),
/* for components which are a schematic file, schematic file name, i.e. "cnt16.sch" */
_
(
"Footprint"
),
/* Footprint, used by cvpcb or pcbnew, i.e. "16DIP300" */
_
(
"Field"
)
/* User fields (1 to n) have an editable name*/
_
(
"Sheet"
),
/* for components which are a schematic file, schematic file name, i.e. "cnt16.sch" */
};
_
(
"Field1"
),
/* User fields (1 to n) have an editable name*/
int
ii
=
FieldNumber
;
_
(
"Field2"
),
if
(
ii
>
FIELD1
)
ii
=
FIELD1
;
_
(
"Field3"
),
wxString
FieldName
=
FieldDefaultNameList
[
ii
];
_
(
"Field4"
),
_
(
"Field5"
),
if
(
FieldNumber
>=
FIELD1
)
FieldName
<<
(
FieldNumber
-
FIELD1
+
1
);
_
(
"Field6"
),
return
FieldName
;
_
(
"Field7"
),
_
(
"Field8"
),
wxT
(
"badFieldNdx!"
)
// error, and "sentinel" value
};
if
(
(
unsigned
)
aFieldNdx
>
FIELD8
)
// catches < 0 also
aFieldNdx
=
FIELD8
+
1
;
// return the sentinel text
return
FieldDefaultNameList
[
aFieldNdx
];
}
}
/****************************************************************/
/****************************************************************/
wxString
EDA_SchComponentStruct
::
ReturnFieldName
(
int
FieldNumber
)
const
wxString
&
EDA_SchComponentStruct
::
ReturnFieldName
(
int
aFieldNdx
)
const
/****************************************************************/
/****************************************************************/
/* Return the Field name from its number (REFERENCE, VALUE ..)
*/
/* Return the Field name from its index (REFERENCE, VALUE ..)
*/
{
{
wxString
FieldName
=
m_Field
[
FieldNumber
].
m_Name
;
// avoid unnecessarily copying wxStrings.
if
(
(
FieldNumber
<
FIELD1
)
||
FieldName
.
IsEmpty
()
)
if
(
aFieldNdx
<
FIELD1
||
m_Field
[
aFieldNdx
].
m_Name
.
IsEmpty
()
)
FieldName
=
ReturnDefaultFieldName
(
FieldNumber
);
return
ReturnDefaultFieldName
(
aFieldNdx
);
return
FieldName
;
return
m_Field
[
aFieldNdx
].
m_Name
;
}
const
wxString
&
EDA_SchComponentStruct
::
GetFieldValue
(
int
aFieldNdx
)
const
{
// avoid unnecessarily copying wxStrings.
static
const
wxString
myEmpty
=
wxEmptyString
;
if
(
(
unsigned
)
aFieldNdx
>
FIELD8
||
m_Field
[
aFieldNdx
].
m_Text
.
IsEmpty
()
)
return
myEmpty
;
return
m_Field
[
aFieldNdx
].
m_Text
;
}
}
/*******************************************************************/
/*******************************************************************/
EDA_SchComponentStruct
::
EDA_SchComponentStruct
(
const
wxPoint
&
pos
)
:
EDA_SchComponentStruct
::
EDA_SchComponentStruct
(
const
wxPoint
&
pos
)
:
DrawPartStruct
(
DRAW_LIB_ITEM_STRUCT_TYPE
,
pos
)
DrawPartStruct
(
DRAW_LIB_ITEM_STRUCT_TYPE
,
pos
)
/*******************************************************************/
/*******************************************************************/
{
{
int
ii
;
int
ii
;
m_Multi
=
0
;
/* In multi unit chip - which unit to draw. */
m_RefIdNumber
=
0
;
m_Multi
=
0
;
/* In multi unit chip - which unit to draw. */
m_FlagControlMulti
=
0
;
m_RefIdNumber
=
0
;
m_Convert
=
0
;
/* Gestion des mutiples representations (conversion De Morgan) */
m_FlagControlMulti
=
0
;
/* The rotation/mirror transformation matrix. pos normal*/
m_Convert
=
0
;
/* Gestion des mutiples representations (conversion De Morgan) */
m_Transform
[
0
][
0
]
=
1
;
m_Transform
[
0
][
1
]
=
0
;
/* The rotation/mirror transformation matrix. pos normal*/
m_Transform
[
1
][
0
]
=
0
;
m_Transform
[
0
][
0
]
=
1
;
m_Transform
[
1
][
1
]
=
-
1
;
m_Transform
[
0
][
1
]
=
0
;
m_Transform
[
1
][
0
]
=
0
;
/* initialisation des Fields */
m_Transform
[
1
][
1
]
=
-
1
;
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
/* initialisation des Fields */
m_Field
[
ii
].
m_Pos
=
m_Pos
;
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
m_Field
[
ii
].
m_Layer
=
LAYER_FIELDS
;
{
m_Field
[
ii
].
m_FieldId
=
REFERENCE
+
ii
;
m_Field
[
ii
].
m_Pos
=
m_Pos
;
m_Field
[
ii
].
m_Parent
=
this
;
m_Field
[
ii
].
m_Layer
=
LAYER_FIELDS
;
}
m_Field
[
ii
].
m_FieldId
=
REFERENCE
+
ii
;
m_Field
[
ii
].
m_Parent
=
this
;
m_Field
[
VALUE
].
m_Layer
=
LAYER_VALUEPART
;
}
m_Field
[
REFERENCE
].
m_Layer
=
LAYER_REFERENCEPART
;
m_Field
[
VALUE
].
m_Layer
=
LAYER_VALUEPART
;
m_PinIsDangling
=
NULL
;
m_Field
[
REFERENCE
].
m_Layer
=
LAYER_REFERENCEPART
;
m_PinIsDangling
=
NULL
;
}
}
...
@@ -112,301 +139,317 @@ int ii;
...
@@ -112,301 +139,317 @@ int ii;
EDA_Rect
EDA_SchComponentStruct
::
GetBoundaryBox
()
EDA_Rect
EDA_SchComponentStruct
::
GetBoundaryBox
()
/**********************************************************************/
/**********************************************************************/
{
{
EDA_LibComponentStruct
*
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
EDA_LibComponentStruct
*
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
EDA_Rect
BoundaryBox
;
EDA_Rect
BoundaryBox
;
int
x0
,
xm
,
y0
,
ym
;
int
x0
,
xm
,
y0
,
ym
;
/* Get the basic Boundary box */
if
(
Entry
)
/* Get the basic Boundary box */
{
if
(
Entry
)
BoundaryBox
=
Entry
->
GetBoundaryBox
(
m_Multi
,
m_Convert
);
{
x0
=
BoundaryBox
.
GetX
();
xm
=
BoundaryBox
.
GetRight
();
BoundaryBox
=
Entry
->
GetBoundaryBox
(
m_Multi
,
m_Convert
);
// We must reverse Y values, because matrix orientation
x0
=
BoundaryBox
.
GetX
();
xm
=
BoundaryBox
.
GetRight
();
// suppose Y axis normal for the library items coordinates,
// m_Transform reverse Y values, but BoundaryBox ais already reversed!
// We must reverse Y values, because matrix orientation
y0
=
-
BoundaryBox
.
GetY
();
// suppose Y axis normal for the library items coordinates,
ym
=
-
BoundaryBox
.
GetBottom
();
// m_Transform reverse Y values, but BoundaryBox ais already reversed!
}
y0
=
-
BoundaryBox
.
GetY
();
else
/* if lib Entry not found, give a reasonable size */
ym
=
-
BoundaryBox
.
GetBottom
();
{
}
x0
=
y0
=
-
50
;
else
/* if lib Entry not found, give a reasonable size */
xm
=
ym
=
50
;
{
}
x0
=
y0
=
-
50
;
xm
=
ym
=
50
;
/* Compute the real Boundary box (rotated, mirrored ...)*/
}
int
x1
=
m_Transform
[
0
][
0
]
*
x0
+
m_Transform
[
0
][
1
]
*
y0
;
/* Compute the real Boundary box (rotated, mirrored ...)*/
int
y1
=
m_Transform
[
1
][
0
]
*
x0
+
m_Transform
[
1
][
1
]
*
y0
;
int
x1
=
m_Transform
[
0
][
0
]
*
x0
+
m_Transform
[
0
][
1
]
*
y0
;
int
x2
=
m_Transform
[
0
][
0
]
*
xm
+
m_Transform
[
0
][
1
]
*
ym
;
int
y1
=
m_Transform
[
1
][
0
]
*
x0
+
m_Transform
[
1
][
1
]
*
y0
;
int
y2
=
m_Transform
[
1
][
0
]
*
xm
+
m_Transform
[
1
][
1
]
*
ym
;
int
x2
=
m_Transform
[
0
][
0
]
*
xm
+
m_Transform
[
0
][
1
]
*
ym
;
// H and W must be > 0 for wxRect:
int
y2
=
m_Transform
[
1
][
0
]
*
xm
+
m_Transform
[
1
][
1
]
*
ym
;
if
(
x2
<
x1
)
EXCHG
(
x2
,
x1
);
if
(
y2
<
y1
)
EXCHG
(
y2
,
y1
);
// H and W must be > 0 for wxRect:
BoundaryBox
.
SetX
(
x1
);
BoundaryBox
.
SetY
(
y1
);
if
(
x2
<
x1
)
BoundaryBox
.
SetWidth
(
x2
-
x1
);
EXCHG
(
x2
,
x1
);
BoundaryBox
.
SetHeight
(
y2
-
y1
);
if
(
y2
<
y1
)
EXCHG
(
y2
,
y1
);
BoundaryBox
.
Offset
(
m_Pos
);
return
BoundaryBox
;
BoundaryBox
.
SetX
(
x1
);
BoundaryBox
.
SetY
(
y1
);
BoundaryBox
.
SetWidth
(
x2
-
x1
);
BoundaryBox
.
SetHeight
(
y2
-
y1
);
BoundaryBox
.
Offset
(
m_Pos
);
return
BoundaryBox
;
}
}
/**************************************************************************/
/**************************************************************************/
void
PartTextStruct
::
SwapData
(
PartTextStruct
*
copyitem
)
void
PartTextStruct
::
SwapData
(
PartTextStruct
*
copyitem
)
/**************************************************************************/
/**************************************************************************/
/* Used if undo / redo command:
/* Used if undo / redo command:
swap data between this and copyitem
*
swap data between this and copyitem
*/
*/
{
{
EXCHG
(
m_Text
,
copyitem
->
m_Text
);
EXCHG
(
m_Text
,
copyitem
->
m_Text
);
EXCHG
(
m_Layer
,
copyitem
->
m_Layer
);
EXCHG
(
m_Layer
,
copyitem
->
m_Layer
);
EXCHG
(
m_Pos
,
copyitem
->
m_Pos
);
EXCHG
(
m_Pos
,
copyitem
->
m_Pos
);
EXCHG
(
m_Size
,
copyitem
->
m_Size
);
EXCHG
(
m_Size
,
copyitem
->
m_Size
);
EXCHG
(
m_Width
,
copyitem
->
m_Width
);
EXCHG
(
m_Width
,
copyitem
->
m_Width
);
EXCHG
(
m_Orient
,
copyitem
->
m_Orient
);
EXCHG
(
m_Orient
,
copyitem
->
m_Orient
);
EXCHG
(
m_Miroir
,
copyitem
->
m_Miroir
);
EXCHG
(
m_Miroir
,
copyitem
->
m_Miroir
);
EXCHG
(
m_Attributs
,
copyitem
->
m_Attributs
);
EXCHG
(
m_Attributs
,
copyitem
->
m_Attributs
);
EXCHG
(
m_CharType
,
copyitem
->
m_CharType
);
EXCHG
(
m_CharType
,
copyitem
->
m_CharType
);
EXCHG
(
m_HJustify
,
copyitem
->
m_HJustify
);
EXCHG
(
m_HJustify
,
copyitem
->
m_HJustify
);
EXCHG
(
m_VJustify
,
copyitem
->
m_VJustify
);
EXCHG
(
m_VJustify
,
copyitem
->
m_VJustify
);
EXCHG
(
m_ZoomLevelDrawable
,
copyitem
->
m_ZoomLevelDrawable
);
EXCHG
(
m_ZoomLevelDrawable
,
copyitem
->
m_ZoomLevelDrawable
);
EXCHG
(
m_TextDrawings
,
copyitem
->
m_TextDrawings
);
EXCHG
(
m_TextDrawings
,
copyitem
->
m_TextDrawings
);
EXCHG
(
m_TextDrawingsSize
,
copyitem
->
m_TextDrawingsSize
);
EXCHG
(
m_TextDrawingsSize
,
copyitem
->
m_TextDrawingsSize
);
}
}
/**************************************************************************/
/**************************************************************************/
void
EDA_SchComponentStruct
::
SwapData
(
EDA_SchComponentStruct
*
copyitem
)
void
EDA_SchComponentStruct
::
SwapData
(
EDA_SchComponentStruct
*
copyitem
)
/**************************************************************************/
/**************************************************************************/
/* Used if undo / redo command:
/* Used if undo / redo command:
swap data between this and copyitem
*
swap data between this and copyitem
*/
*/
{
{
EXCHG
(
m_Pos
,
copyitem
->
m_Pos
);
EXCHG
(
m_Pos
,
copyitem
->
m_Pos
);
EXCHG
(
m_Multi
,
copyitem
->
m_Multi
);
EXCHG
(
m_Multi
,
copyitem
->
m_Multi
);
EXCHG
(
m_Convert
,
copyitem
->
m_Convert
);
EXCHG
(
m_Convert
,
copyitem
->
m_Convert
);
EXCHG
(
m_Transform
[
0
][
0
],
copyitem
->
m_Transform
[
0
][
0
]
);
EXCHG
(
m_Transform
[
0
][
0
],
copyitem
->
m_Transform
[
0
][
0
]
);
EXCHG
(
m_Transform
[
0
][
1
],
copyitem
->
m_Transform
[
0
][
1
]
);
EXCHG
(
m_Transform
[
0
][
1
],
copyitem
->
m_Transform
[
0
][
1
]
);
EXCHG
(
m_Transform
[
1
][
0
],
copyitem
->
m_Transform
[
1
][
0
]
);
EXCHG
(
m_Transform
[
1
][
0
],
copyitem
->
m_Transform
[
1
][
0
]
);
EXCHG
(
m_Transform
[
1
][
1
],
copyitem
->
m_Transform
[
1
][
1
]
);
EXCHG
(
m_Transform
[
1
][
1
],
copyitem
->
m_Transform
[
1
][
1
]
);
for
(
int
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
for
(
int
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
{
m_Field
[
ii
].
SwapData
(
&
copyitem
->
m_Field
[
ii
]
);
m_Field
[
ii
].
SwapData
(
&
copyitem
->
m_Field
[
ii
]
);
}
}
}
}
/***********************************************************************/
/***********************************************************************/
void
EDA_SchComponentStruct
::
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
)
void
EDA_SchComponentStruct
::
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
)
/***********************************************************************/
/***********************************************************************/
{
{
/* save old text in undo list */
/* save old text in undo list */
if
(
g_ItemToUndoCopy
&&
if
(
g_ItemToUndoCopy
(
g_ItemToUndoCopy
->
Type
()
==
Type
())
&&
&&
(
g_ItemToUndoCopy
->
Type
()
==
Type
()
)
((
m_Flags
&
IS_NEW
)
==
0
)
)
&&
(
(
m_Flags
&
IS_NEW
)
==
0
)
)
{
{
/* restore old values and save new ones */
/* restore old values and save new ones */
SwapData
(
(
EDA_SchComponentStruct
*
)
g_ItemToUndoCopy
);
SwapData
(
(
EDA_SchComponentStruct
*
)
g_ItemToUndoCopy
);
/* save in undo list */
((
WinEDA_SchematicFrame
*
)
frame
)
->
SaveCopyInUndoList
(
this
,
IS_CHANGED
);
/* save in undo list */
/* restore new values */
(
(
WinEDA_SchematicFrame
*
)
frame
)
->
SaveCopyInUndoList
(
this
,
IS_CHANGED
);
SwapData
(
(
EDA_SchComponentStruct
*
)
g_ItemToUndoCopy
);
delete
g_ItemToUndoCopy
;
/* restore new values */
g_ItemToUndoCopy
=
NULL
;
SwapData
(
(
EDA_SchComponentStruct
*
)
g_ItemToUndoCopy
);
}
delete
g_ItemToUndoCopy
;
EDA_BaseStruct
::
Place
(
frame
,
DC
);
g_ItemToUndoCopy
=
NULL
;
}
EDA_BaseStruct
::
Place
(
frame
,
DC
);
}
}
/***************************************************/
/***************************************************/
void
EDA_SchComponentStruct
::
ClearAnnotation
()
void
EDA_SchComponentStruct
::
ClearAnnotation
()
/***************************************************/
/***************************************************/
/* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
/* Suppress annotation ( i.i IC23 changed to IC? and part reset to 1)
*/
*/
{
{
m_RefIdNumber
=
0
;
m_RefIdNumber
=
0
;
while
(
isdigit
(
m_Field
[
REFERENCE
].
m_Text
.
Last
()
)
)
m_Field
[
REFERENCE
].
m_Text
.
RemoveLast
();
while
(
isdigit
(
m_Field
[
REFERENCE
].
m_Text
.
Last
()
)
)
if
(
m_Field
[
REFERENCE
].
m_Text
.
Last
()
!=
'?'
)
m_Field
[
REFERENCE
].
m_Text
.
RemoveLast
();
m_Field
[
REFERENCE
].
m_Text
.
Append
(
'?'
);
if
(
m_Field
[
REFERENCE
].
m_Text
.
Last
()
!=
'?'
)
m_Field
[
REFERENCE
].
m_Text
.
Append
(
'?'
);
EDA_LibComponentStruct
*
Entry
;
EDA_LibComponentStruct
*
Entry
;
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
Entry
=
FindLibPart
(
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
if
(
!
Entry
||
!
Entry
->
m_UnitSelectionLocked
)
if
(
!
Entry
||
!
Entry
->
m_UnitSelectionLocked
)
m_Multi
=
1
;
m_Multi
=
1
;
}
}
/**************************************************************/
/**************************************************************/
EDA_SchComponentStruct
*
EDA_SchComponentStruct
::
GenCopy
()
EDA_SchComponentStruct
*
EDA_SchComponentStruct
::
GenCopy
()
/**************************************************************/
/**************************************************************/
{
{
EDA_SchComponentStruct
*
new_item
=
new
EDA_SchComponentStruct
(
m_Pos
);
EDA_SchComponentStruct
*
new_item
=
new
EDA_SchComponentStruct
(
m_Pos
);
int
ii
;
int
ii
;
new_item
->
m_Multi
=
m_Multi
;
new_item
->
m_ChipName
=
m_ChipName
;
new_item
->
m_Multi
=
m_Multi
;
new_item
->
m_FlagControlMulti
=
m_FlagControlMulti
;
new_item
->
m_ChipName
=
m_ChipName
;
new_item
->
m_Convert
=
m_Convert
;
new_item
->
m_FlagControlMulti
=
m_FlagControlMulti
;
new_item
->
m_Transform
[
0
][
0
]
=
m_Transform
[
0
][
0
];
new_item
->
m_Convert
=
m_Convert
;
new_item
->
m_Transform
[
0
][
1
]
=
m_Transform
[
0
][
1
];
new_item
->
m_Transform
[
0
][
0
]
=
m_Transform
[
0
][
0
];
new_item
->
m_Transform
[
1
][
0
]
=
m_Transform
[
1
][
0
];
new_item
->
m_Transform
[
0
][
1
]
=
m_Transform
[
0
][
1
];
new_item
->
m_Transform
[
1
][
1
]
=
m_Transform
[
1
][
1
];
new_item
->
m_Transform
[
1
][
0
]
=
m_Transform
[
1
][
0
];
new_item
->
m_TimeStamp
=
m_TimeStamp
;
new_item
->
m_Transform
[
1
][
1
]
=
m_Transform
[
1
][
1
];
new_item
->
m_TimeStamp
=
m_TimeStamp
;
/* initialisation des Fields */
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
/* initialisation des Fields */
{
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
m_Field
[
ii
].
PartTextCopy
(
&
new_item
->
m_Field
[
ii
]);
{
}
m_Field
[
ii
].
PartTextCopy
(
&
new_item
->
m_Field
[
ii
]
);
}
return
new_item
;
return
new_item
;
}
}
/*****************************************************************/
/*****************************************************************/
void
EDA_SchComponentStruct
::
SetRotationMiroir
(
int
type_rotate
)
void
EDA_SchComponentStruct
::
SetRotationMiroir
(
int
type_rotate
)
/******************************************************************/
/******************************************************************/
/* Compute the new matrix transform for a schematic component
/* Compute the new matrix transform for a schematic component
in order to have the requested transform (type_rotate = rot, mirror..)
*
in order to have the requested transform (type_rotate = rot, mirror..)
which is applied to the initial transform.
*
which is applied to the initial transform.
*/
*/
{
{
int
TempMat
[
2
][
2
];
int
TempMat
[
2
][
2
];
bool
Transform
=
FALSE
;
bool
Transform
=
FALSE
;
switch
(
type_rotate
)
switch
(
type_rotate
)
{
{
case
CMP_ORIENT_0
:
case
CMP_ORIENT_0
:
case
CMP_NORMAL
:
/* Position Initiale */
case
CMP_NORMAL
:
/* Position Initiale */
m_Transform
[
0
][
0
]
=
1
;
m_Transform
[
0
][
0
]
=
1
;
m_Transform
[
1
][
1
]
=
-
1
;
m_Transform
[
1
][
1
]
=
-
1
;
m_Transform
[
1
][
0
]
=
m_Transform
[
0
][
1
]
=
0
;
m_Transform
[
1
][
0
]
=
m_Transform
[
0
][
1
]
=
0
;
break
;
break
;
case
CMP_ROTATE_CLOCKWISE
:
/* Rotate + */
case
CMP_ROTATE_CLOCKWISE
:
/* Rotate + */
TempMat
[
0
][
0
]
=
TempMat
[
1
][
1
]
=
0
;
TempMat
[
0
][
0
]
=
TempMat
[
1
][
1
]
=
0
;
TempMat
[
0
][
1
]
=
1
;
TempMat
[
0
][
1
]
=
1
;
TempMat
[
1
][
0
]
=
-
1
;
TempMat
[
1
][
0
]
=
-
1
;
Transform
=
TRUE
;
Transform
=
TRUE
;
break
;
break
;
case
CMP_ROTATE_COUNTERCLOCKWISE
:
/* Rotate - */
case
CMP_ROTATE_COUNTERCLOCKWISE
:
/* Rotate - */
TempMat
[
0
][
0
]
=
TempMat
[
1
][
1
]
=
0
;
TempMat
[
0
][
0
]
=
TempMat
[
1
][
1
]
=
0
;
TempMat
[
0
][
1
]
=
-
1
;
TempMat
[
0
][
1
]
=
-
1
;
TempMat
[
1
][
0
]
=
1
;
TempMat
[
1
][
0
]
=
1
;
Transform
=
TRUE
;
Transform
=
TRUE
;
break
;
break
;
case
CMP_MIROIR_Y
:
/* MirrorY */
case
CMP_MIROIR_Y
:
/* MirrorY */
TempMat
[
0
][
0
]
=
-
1
;
TempMat
[
0
][
0
]
=
-
1
;
TempMat
[
1
][
1
]
=
1
;
TempMat
[
1
][
1
]
=
1
;
TempMat
[
0
][
1
]
=
TempMat
[
1
][
0
]
=
0
;
TempMat
[
0
][
1
]
=
TempMat
[
1
][
0
]
=
0
;
Transform
=
TRUE
;
Transform
=
TRUE
;
break
;
break
;
case
CMP_MIROIR_X
:
/* MirrorX */
case
CMP_MIROIR_X
:
/* MirrorX */
TempMat
[
0
][
0
]
=
1
;
TempMat
[
0
][
0
]
=
1
;
TempMat
[
1
][
1
]
=
-
1
;
TempMat
[
1
][
1
]
=
-
1
;
TempMat
[
0
][
1
]
=
TempMat
[
1
][
0
]
=
0
;
TempMat
[
0
][
1
]
=
TempMat
[
1
][
0
]
=
0
;
Transform
=
TRUE
;
Transform
=
TRUE
;
break
;
break
;
case
CMP_ORIENT_90
:
case
CMP_ORIENT_90
:
SetRotationMiroir
(
CMP_ORIENT_0
);
SetRotationMiroir
(
CMP_ORIENT_0
);
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
break
;
break
;
case
CMP_ORIENT_180
:
case
CMP_ORIENT_180
:
SetRotationMiroir
(
CMP_ORIENT_0
);
SetRotationMiroir
(
CMP_ORIENT_0
);
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
break
;
break
;
case
CMP_ORIENT_270
:
case
CMP_ORIENT_270
:
SetRotationMiroir
(
CMP_ORIENT_0
);
SetRotationMiroir
(
CMP_ORIENT_0
);
SetRotationMiroir
(
CMP_ROTATE_CLOCKWISE
);
SetRotationMiroir
(
CMP_ROTATE_CLOCKWISE
);
break
;
break
;
case
(
CMP_ORIENT_0
+
CMP_MIROIR_X
):
case
(
CMP_ORIENT_0
+
CMP_MIROIR_X
):
SetRotationMiroir
(
CMP_ORIENT_0
);
SetRotationMiroir
(
CMP_ORIENT_0
);
SetRotationMiroir
(
CMP_MIROIR_X
);
SetRotationMiroir
(
CMP_MIROIR_X
);
break
;
break
;
case
(
CMP_ORIENT_0
+
CMP_MIROIR_Y
):
case
(
CMP_ORIENT_0
+
CMP_MIROIR_Y
):
SetRotationMiroir
(
CMP_ORIENT_0
);
SetRotationMiroir
(
CMP_ORIENT_0
);
SetRotationMiroir
(
CMP_MIROIR_Y
);
SetRotationMiroir
(
CMP_MIROIR_Y
);
break
;
break
;
case
(
CMP_ORIENT_90
+
CMP_MIROIR_X
):
case
(
CMP_ORIENT_90
+
CMP_MIROIR_X
):
SetRotationMiroir
(
CMP_ORIENT_90
);
SetRotationMiroir
(
CMP_ORIENT_90
);
SetRotationMiroir
(
CMP_MIROIR_X
);
SetRotationMiroir
(
CMP_MIROIR_X
);
break
;
break
;
case
(
CMP_ORIENT_90
+
CMP_MIROIR_Y
):
case
(
CMP_ORIENT_90
+
CMP_MIROIR_Y
):
SetRotationMiroir
(
CMP_ORIENT_90
);
SetRotationMiroir
(
CMP_ORIENT_90
);
SetRotationMiroir
(
CMP_MIROIR_Y
);
SetRotationMiroir
(
CMP_MIROIR_Y
);
break
;
break
;
case
(
CMP_ORIENT_180
+
CMP_MIROIR_X
):
case
(
CMP_ORIENT_180
+
CMP_MIROIR_X
):
SetRotationMiroir
(
CMP_ORIENT_180
);
SetRotationMiroir
(
CMP_ORIENT_180
);
SetRotationMiroir
(
CMP_MIROIR_X
);
SetRotationMiroir
(
CMP_MIROIR_X
);
break
;
break
;
case
(
CMP_ORIENT_180
+
CMP_MIROIR_Y
):
case
(
CMP_ORIENT_180
+
CMP_MIROIR_Y
):
SetRotationMiroir
(
CMP_ORIENT_180
);
SetRotationMiroir
(
CMP_ORIENT_180
);
SetRotationMiroir
(
CMP_MIROIR_Y
);
SetRotationMiroir
(
CMP_MIROIR_Y
);
break
;
break
;
case
(
CMP_ORIENT_270
+
CMP_MIROIR_X
):
case
(
CMP_ORIENT_270
+
CMP_MIROIR_X
):
SetRotationMiroir
(
CMP_ORIENT_270
);
SetRotationMiroir
(
CMP_ORIENT_270
);
SetRotationMiroir
(
CMP_MIROIR_X
);
SetRotationMiroir
(
CMP_MIROIR_X
);
break
;
break
;
case
(
CMP_ORIENT_270
+
CMP_MIROIR_Y
):
case
(
CMP_ORIENT_270
+
CMP_MIROIR_Y
):
SetRotationMiroir
(
CMP_ORIENT_270
);
SetRotationMiroir
(
CMP_ORIENT_270
);
SetRotationMiroir
(
CMP_MIROIR_Y
);
SetRotationMiroir
(
CMP_MIROIR_Y
);
break
;
break
;
default
:
default
:
Transform
=
FALSE
;
Transform
=
FALSE
;
DisplayError
(
NULL
,
wxT
(
"SetRotateMiroir() error: ill value"
)
);
DisplayError
(
NULL
,
wxT
(
"SetRotateMiroir() error: ill value"
)
);
break
;
break
;
}
}
if
(
Transform
)
if
(
Transform
)
{
/* The new matrix transform is the old matrix transform modified by the
{
/* The new matrix transform is the old matrix transform modified by the
requested transformation, which is the TempMat transform (rot, mirror ..)
*
requested transformation, which is the TempMat transform (rot, mirror ..)
in order to have (in term of matrix transform):
*
in order to have (in term of matrix transform):
transform coord = new_m_Transform * coord
*
transform coord = new_m_Transform * coord
where transform coord is the coord modified by new_m_Transform from the initial
*
where transform coord is the coord modified by new_m_Transform from the initial
value coord.
*
value coord.
new_m_Transform is computed (from old_m_Transform and TempMat) to have:
*
new_m_Transform is computed (from old_m_Transform and TempMat) to have:
transform coord = old_m_Transform * coord * TempMat
*
transform coord = old_m_Transform * coord * TempMat
*/
*/
int
NewMatrix
[
2
][
2
];
int
NewMatrix
[
2
][
2
];
NewMatrix
[
0
][
0
]
=
m_Transform
[
0
][
0
]
*
TempMat
[
0
][
0
]
+
NewMatrix
[
0
][
0
]
=
m_Transform
[
0
][
0
]
*
TempMat
[
0
][
0
]
+
m_Transform
[
1
][
0
]
*
TempMat
[
0
][
1
];
m_Transform
[
1
][
0
]
*
TempMat
[
0
][
1
];
NewMatrix
[
0
][
1
]
=
m_Transform
[
0
][
1
]
*
TempMat
[
0
][
0
]
+
NewMatrix
[
0
][
1
]
=
m_Transform
[
0
][
1
]
*
TempMat
[
0
][
0
]
+
m_Transform
[
1
][
1
]
*
TempMat
[
0
][
1
];
m_Transform
[
1
][
1
]
*
TempMat
[
0
][
1
];
NewMatrix
[
1
][
0
]
=
m_Transform
[
0
][
0
]
*
TempMat
[
1
][
0
]
+
NewMatrix
[
1
][
0
]
=
m_Transform
[
0
][
0
]
*
TempMat
[
1
][
0
]
+
m_Transform
[
1
][
0
]
*
TempMat
[
1
][
1
];
m_Transform
[
1
][
0
]
*
TempMat
[
1
][
1
];
NewMatrix
[
1
][
1
]
=
m_Transform
[
0
][
1
]
*
TempMat
[
1
][
0
]
+
NewMatrix
[
1
][
1
]
=
m_Transform
[
0
][
1
]
*
TempMat
[
1
][
0
]
+
m_Transform
[
1
][
1
]
*
TempMat
[
1
][
1
];
m_Transform
[
1
][
1
]
*
TempMat
[
1
][
1
];
m_Transform
[
0
][
0
]
=
NewMatrix
[
0
][
0
];
m_Transform
[
0
][
0
]
=
NewMatrix
[
0
][
0
];
m_Transform
[
0
][
1
]
=
NewMatrix
[
0
][
1
];
m_Transform
[
0
][
1
]
=
NewMatrix
[
0
][
1
];
m_Transform
[
1
][
0
]
=
NewMatrix
[
1
][
0
];
m_Transform
[
1
][
0
]
=
NewMatrix
[
1
][
0
];
m_Transform
[
1
][
1
]
=
NewMatrix
[
1
][
1
];
m_Transform
[
1
][
1
]
=
NewMatrix
[
1
][
1
];
}
}
}
}
...
@@ -414,220 +457,277 @@ bool Transform = FALSE;
...
@@ -414,220 +457,277 @@ bool Transform = FALSE;
int
EDA_SchComponentStruct
::
GetRotationMiroir
()
int
EDA_SchComponentStruct
::
GetRotationMiroir
()
/****************************************************/
/****************************************************/
{
{
int
type_rotate
=
CMP_ORIENT_0
;
int
type_rotate
=
CMP_ORIENT_0
;
int
TempMat
[
2
][
2
],
MatNormal
[
2
][
2
];
int
TempMat
[
2
][
2
],
MatNormal
[
2
][
2
];
int
ii
;
int
ii
;
bool
found
=
FALSE
;
bool
found
=
FALSE
;
memcpy
(
TempMat
,
m_Transform
,
sizeof
(
TempMat
)
);
memcpy
(
TempMat
,
m_Transform
,
sizeof
(
TempMat
)
);
SetRotationMiroir
(
CMP_ORIENT_0
);
SetRotationMiroir
(
CMP_ORIENT_0
);
memcpy
(
MatNormal
,
m_Transform
,
sizeof
(
MatNormal
)
);
memcpy
(
MatNormal
,
m_Transform
,
sizeof
(
MatNormal
)
);
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
{
{
if
(
memcmp
(
TempMat
,
m_Transform
,
sizeof
(
MatNormal
))
==
0
)
if
(
memcmp
(
TempMat
,
m_Transform
,
sizeof
(
MatNormal
)
)
==
0
)
{
{
found
=
TRUE
;
break
;
found
=
TRUE
;
break
;
}
}
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
}
}
if
(
!
found
)
if
(
!
found
)
{
{
type_rotate
=
CMP_MIROIR_X
+
CMP_ORIENT_0
;
type_rotate
=
CMP_MIROIR_X
+
CMP_ORIENT_0
;
SetRotationMiroir
(
CMP_NORMAL
);
SetRotationMiroir
(
CMP_NORMAL
);
SetRotationMiroir
(
CMP_MIROIR_X
);
SetRotationMiroir
(
CMP_MIROIR_X
);
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
{
{
if
(
memcmp
(
TempMat
,
m_Transform
,
sizeof
(
MatNormal
))
==
0
)
if
(
memcmp
(
TempMat
,
m_Transform
,
sizeof
(
MatNormal
)
)
==
0
)
{
{
found
=
TRUE
;
break
;
found
=
TRUE
;
break
;
}
}
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
}
}
}
}
if
(
!
found
)
if
(
!
found
)
{
{
type_rotate
=
CMP_MIROIR_Y
+
CMP_ORIENT_0
;
type_rotate
=
CMP_MIROIR_Y
+
CMP_ORIENT_0
;
SetRotationMiroir
(
CMP_NORMAL
);
SetRotationMiroir
(
CMP_NORMAL
);
SetRotationMiroir
(
CMP_MIROIR_Y
);
SetRotationMiroir
(
CMP_MIROIR_Y
);
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
for
(
ii
=
0
;
ii
<
4
;
ii
++
)
{
{
if
(
memcmp
(
TempMat
,
m_Transform
,
sizeof
(
MatNormal
))
==
0
)
if
(
memcmp
(
TempMat
,
m_Transform
,
sizeof
(
MatNormal
)
)
==
0
)
{
{
found
=
TRUE
;
break
;
found
=
TRUE
;
break
;
}
}
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
SetRotationMiroir
(
CMP_ROTATE_COUNTERCLOCKWISE
);
}
}
}
}
memcpy
(
m_Transform
,
TempMat
,
sizeof
(
m_Transform
)
);
memcpy
(
m_Transform
,
TempMat
,
sizeof
(
m_Transform
)
);
if
(
found
)
if
(
found
)
{
{
return
(
type_rotate
+
ii
)
;
return
type_rotate
+
ii
;
}
}
else
else
{
{
wxBell
();
return
CMP_NORMAL
;
wxBell
();
return
CMP_NORMAL
;
}
}
}
}
/***********************************************************************/
/***********************************************************************/
wxPoint
EDA_SchComponentStruct
::
GetScreenCoord
(
const
wxPoint
&
coord
)
wxPoint
EDA_SchComponentStruct
::
GetScreenCoord
(
const
wxPoint
&
coord
)
/***********************************************************************/
/***********************************************************************/
/* Renvoie la coordonne du point coord, en fonction de l'orientation
/* Renvoie la coordonne du point coord, en fonction de l'orientation
du composant (rotation, miroir).
* du composant (rotation, miroir).
Les coord sont toujours relatives l'ancre (coord 0,0) du composant
* Les coord sont toujours relatives l'ancre (coord 0,0) du composant
*/
*/
{
wxPoint
screenpos
;
screenpos
.
x
=
m_Transform
[
0
][
0
]
*
coord
.
x
+
m_Transform
[
0
][
1
]
*
coord
.
y
;
screenpos
.
y
=
m_Transform
[
1
][
0
]
*
coord
.
x
+
m_Transform
[
1
][
1
]
*
coord
.
y
;
return
screenpos
;
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* 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
)
{
{
wxPoint
screenpos
;
// for now, make it look like XML:
screenpos
.
x
=
m_Transform
[
0
][
0
]
*
coord
.
x
+
m_Transform
[
0
][
1
]
*
coord
.
y
;
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
GetClass
().
Lower
().
mb_str
()
<<
screenpos
.
y
=
m_Transform
[
1
][
0
]
*
coord
.
x
+
m_Transform
[
1
][
1
]
*
coord
.
y
;
" ref=
\"
"
<<
GetReference
().
mb_str
()
<<
'"'
<<
return
screenpos
;
" chipName=
\"
"
<<
m_ChipName
.
mb_str
()
<<
'"'
<<
m_Pos
<<
" layer=
\"
"
<<
m_Layer
<<
'"'
<<
"/>
\n
"
;
// skip the reference, it's been output already.
for
(
int
i
=
1
;
i
<
NUMBER_OF_FIELDS
;
++
i
)
{
wxString
value
=
GetFieldValue
(
i
);
if
(
!
value
.
IsEmpty
()
)
{
NestedSpace
(
nestLevel
+
1
,
os
)
<<
"<field"
<<
" name=
\"
"
<<
ReturnFieldName
(
i
).
mb_str
()
<<
'"'
<<
" value=
\"
"
<<
value
.
mb_str
()
<<
"
\"
/>
\n
"
;
}
}
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
GetClass
().
Lower
().
mb_str
()
<<
">
\n
"
;
}
}
#endif
/***************************************************************************/
/***************************************************************************/
PartTextStruct
::
PartTextStruct
(
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
PartTextStruct
::
PartTextStruct
(
const
wxPoint
&
pos
,
const
wxString
&
text
)
:
EDA_BaseStruct
(
DRAW_PART_TEXT_STRUCT_TYPE
),
EDA_BaseStruct
(
DRAW_PART_TEXT_STRUCT_TYPE
),
EDA_TextStruct
(
text
)
EDA_TextStruct
(
text
)
/***************************************************************************/
/***************************************************************************/
{
{
m_Pos
=
pos
;
m_Pos
=
pos
;
m_FieldId
=
0
;
m_FieldId
=
0
;
}
}
/************************************/
/************************************/
PartTextStruct
::~
PartTextStruct
()
PartTextStruct
::~
PartTextStruct
()
/************************************/
/************************************/
{
{
}
}
/***********************************************************/
/***********************************************************/
void
PartTextStruct
::
PartTextCopy
(
PartTextStruct
*
target
)
void
PartTextStruct
::
PartTextCopy
(
PartTextStruct
*
target
)
/***********************************************************/
/***********************************************************/
{
{
target
->
m_Text
=
m_Text
;
target
->
m_Text
=
m_Text
;
if
(
m_FieldId
>=
FIELD1
)
target
->
m_Name
=
m_Name
;
if
(
m_FieldId
>=
FIELD1
)
target
->
m_Layer
=
m_Layer
;
target
->
m_Name
=
m_Name
;
target
->
m_Pos
=
m_Pos
;
target
->
m_Layer
=
m_Layer
;
target
->
m_Size
=
m_Size
;
target
->
m_Pos
=
m_Pos
;
target
->
m_Attributs
=
m_Attributs
;
target
->
m_Size
=
m_Size
;
target
->
m_FieldId
=
m_FieldId
;
target
->
m_Attributs
=
m_Attributs
;
target
->
m_Orient
=
m_Orient
;
target
->
m_FieldId
=
m_FieldId
;
target
->
m_HJustify
=
m_HJustify
;
target
->
m_Orient
=
m_Orient
;
target
->
m_VJustify
=
m_VJustify
;
target
->
m_HJustify
=
m_HJustify
;
target
->
m_Flags
=
m_Flags
;
target
->
m_VJustify
=
m_VJustify
;
target
->
m_Flags
=
m_Flags
;
}
}
/*********************************/
/*********************************/
bool
PartTextStruct
::
IsVoid
()
bool
PartTextStruct
::
IsVoid
()
/*********************************/
/*********************************/
/* return True if The field is void, i.e.:
/* return True if The field is void, i.e.:
contains wxEmptyString or "~"
*
contains wxEmptyString or "~"
*/
*/
{
{
if
(
m_Text
.
IsEmpty
()
||
m_Text
==
wxT
(
"~"
)
)
return
TRUE
;
if
(
m_Text
.
IsEmpty
()
||
m_Text
==
wxT
(
"~"
)
)
return
FALSE
;
return
TRUE
;
return
FALSE
;
}
}
/********************************************/
/********************************************/
EDA_Rect
PartTextStruct
::
GetBoundaryBox
()
EDA_Rect
PartTextStruct
::
GetBoundaryBox
()
/********************************************/
/********************************************/
/* return
EDA_Rect contains the real (user coordinates) boundary box for a text field,
according to the component position, rotation, mirror ...
*/
/* return
* EDA_Rect contains the real (user coordinates) boundary box for a text field,
* according to the component position, rotation, mirror ...
*
*/
{
{
EDA_Rect
BoundaryBox
;
EDA_Rect
BoundaryBox
;
int
hjustify
,
vjustify
;
int
hjustify
,
vjustify
;
int
textlen
;
int
textlen
;
int
orient
;
int
orient
;
int
dx
,
dy
,
x1
,
y1
,
x2
,
y2
;
int
dx
,
dy
,
x1
,
y1
,
x2
,
y2
;
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
m_Parent
;
EDA_SchComponentStruct
*
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
m_Parent
;
orient
=
m_Orient
;
orient
=
m_Orient
;
wxPoint
pos
=
DrawLibItem
->
m_Pos
;
wxPoint
pos
=
DrawLibItem
->
m_Pos
;
x1
=
m_Pos
.
x
-
pos
.
x
;
x1
=
m_Pos
.
x
-
pos
.
x
;
y1
=
m_Pos
.
y
-
pos
.
y
;
y1
=
m_Pos
.
y
-
pos
.
y
;
textlen
=
GetLength
();
textlen
=
GetLength
();
if
(
m_FieldId
==
REFERENCE
)
// Real Text can be U1 or U1A
if
(
m_FieldId
==
REFERENCE
)
// Real Text can be U1 or U1A
{
{
EDA_LibComponentStruct
*
Entry
=
EDA_LibComponentStruct
*
Entry
=
FindLibPart
(
DrawLibItem
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
FindLibPart
(
DrawLibItem
->
m_ChipName
.
GetData
(),
wxEmptyString
,
FIND_ROOT
);
if
(
Entry
&&
(
Entry
->
m_UnitCount
>
1
)
)
if
(
Entry
&&
(
Entry
->
m_UnitCount
>
1
)
)
textlen
++
;
// because U1 is show as U1A or U1B ...
textlen
++
;
// because U1 is show as U1A or U1B ...
}
}
dx
=
m_Size
.
x
*
textlen
;
dx
=
m_Size
.
x
*
textlen
;
// Real X Size is 10/9 char size because space between 2 chars is 1/10 X Size
// Real X Size is 10/9 char size because space between 2 chars is 1/10 X Size
dx
=
(
dx
*
10
)
/
9
;
dx
=
(
dx
*
10
)
/
9
;
dy
=
m_Size
.
y
;
dy
=
m_Size
.
y
;
hjustify
=
m_HJustify
;
hjustify
=
m_HJustify
;
vjustify
=
m_VJustify
;
vjustify
=
m_VJustify
;
x2
=
pos
.
x
+
(
DrawLibItem
->
m_Transform
[
0
][
0
]
*
x1
)
x2
=
pos
.
x
+
(
DrawLibItem
->
m_Transform
[
0
][
0
]
*
x1
)
+
(
DrawLibItem
->
m_Transform
[
0
][
1
]
*
y1
);
+
(
DrawLibItem
->
m_Transform
[
0
][
1
]
*
y1
);
y2
=
pos
.
y
+
(
DrawLibItem
->
m_Transform
[
1
][
0
]
*
x1
)
y2
=
pos
.
y
+
(
DrawLibItem
->
m_Transform
[
1
][
0
]
*
x1
)
+
(
DrawLibItem
->
m_Transform
[
1
][
1
]
*
y1
);
+
(
DrawLibItem
->
m_Transform
[
1
][
1
]
*
y1
);
/* If the component orientation is +/- 90 deg, the text orienation must be changed */
/* If the component orientation is +/- 90 deg, the text orienation must be changed */
if
(
DrawLibItem
->
m_Transform
[
0
][
1
])
if
(
DrawLibItem
->
m_Transform
[
0
][
1
]
)
{
{
if
(
orient
==
TEXT_ORIENT_HORIZ
)
orient
=
TEXT_ORIENT_VERT
;
if
(
orient
==
TEXT_ORIENT_HORIZ
)
else
orient
=
TEXT_ORIENT_HORIZ
;
orient
=
TEXT_ORIENT_VERT
;
/* is it mirrored (for text justify)*/
else
EXCHG
(
hjustify
,
vjustify
);
orient
=
TEXT_ORIENT_HORIZ
;
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
<
0
)
vjustify
=
-
vjustify
;
/* is it mirrored (for text justify)*/
if
(
DrawLibItem
->
m_Transform
[
0
][
1
]
>
0
)
hjustify
=
-
hjustify
;
EXCHG
(
hjustify
,
vjustify
);
}
if
(
DrawLibItem
->
m_Transform
[
1
][
0
]
<
0
)
else
/* component horizontal: is it mirrored (for text justify)*/
vjustify
=
-
vjustify
;
{
if
(
DrawLibItem
->
m_Transform
[
0
][
1
]
>
0
)
if
(
DrawLibItem
->
m_Transform
[
0
][
0
]
<
0
)
hjustify
=
-
hjustify
;
hjustify
=
-
hjustify
;
}
if
(
DrawLibItem
->
m_Transform
[
1
][
1
]
>
0
)
else
/* component horizontal: is it mirrored (for text justify)*/
vjustify
=
-
vjustify
;
{
}
if
(
DrawLibItem
->
m_Transform
[
0
][
0
]
<
0
)
hjustify
=
-
hjustify
;
if
(
orient
==
TEXT_ORIENT_VERT
)
EXCHG
(
dx
,
dy
);
if
(
DrawLibItem
->
m_Transform
[
1
][
1
]
>
0
)
vjustify
=
-
vjustify
;
switch
(
hjustify
)
}
{
case
GR_TEXT_HJUSTIFY_CENTER
:
if
(
orient
==
TEXT_ORIENT_VERT
)
x1
=
x2
-
(
dx
/
2
);
EXCHG
(
dx
,
dy
);
break
;
case
GR_TEXT_HJUSTIFY_RIGHT
:
switch
(
hjustify
)
x1
=
x2
-
dx
;
{
break
;
case
GR_TEXT_HJUSTIFY_CENTER
:
default
:
x1
=
x2
-
(
dx
/
2
);
x1
=
x2
;
break
;
break
;
}
case
GR_TEXT_HJUSTIFY_RIGHT
:
switch
(
vjustify
)
x1
=
x2
-
dx
;
{
break
;
case
GR_TEXT_VJUSTIFY_CENTER
:
y1
=
y2
-
(
dy
/
2
);
default
:
break
;
x1
=
x2
;
case
GR_TEXT_VJUSTIFY_BOTTOM
:
break
;
y1
=
y2
-
dy
;
}
break
;
default
:
switch
(
vjustify
)
y1
=
y2
;
{
break
;
case
GR_TEXT_VJUSTIFY_CENTER
:
}
y1
=
y2
-
(
dy
/
2
);
break
;
BoundaryBox
.
SetX
(
x1
);
BoundaryBox
.
SetY
(
y1
);
case
GR_TEXT_VJUSTIFY_BOTTOM
:
BoundaryBox
.
SetWidth
(
dx
);
y1
=
y2
-
dy
;
BoundaryBox
.
SetHeight
(
dy
);
break
;
return
BoundaryBox
;
default
:
y1
=
y2
;
break
;
}
BoundaryBox
.
SetX
(
x1
);
BoundaryBox
.
SetY
(
y1
);
BoundaryBox
.
SetWidth
(
dx
);
BoundaryBox
.
SetHeight
(
dy
);
return
BoundaryBox
;
}
}
eeschema/component_class.h
View file @
664a1f72
...
@@ -15,7 +15,7 @@
...
@@ -15,7 +15,7 @@
/* Definition de la representation du composant */
/* Definition de la representation du composant */
#define NUMBER_OF_FIELDS 12
/* Nombre de champs de texte affectes au composant */
#define NUMBER_OF_FIELDS 12
/* Nombre de champs de texte affectes au composant */
typedef
enum
{
enum
NumFieldType
{
REFERENCE
=
0
,
/* Champ Reference of part, i.e. "IC21" */
REFERENCE
=
0
,
/* Champ Reference of part, i.e. "IC21" */
VALUE
,
/* Champ Value of part, i.e. "3.3K" */
VALUE
,
/* Champ Value of part, i.e. "3.3K" */
FOOTPRINT
,
/* Champ Name Module PCB, i.e. "16DIP300" */
FOOTPRINT
,
/* Champ Name Module PCB, i.e. "16DIP300" */
...
@@ -28,7 +28,7 @@ typedef enum {
...
@@ -28,7 +28,7 @@ typedef enum {
FIELD6
,
FIELD6
,
FIELD7
,
FIELD7
,
FIELD8
FIELD8
}
NumFieldType
;
};
/* Class to manage component fields.
/* Class to manage component fields.
...
@@ -46,9 +46,10 @@ public:
...
@@ -46,9 +46,10 @@ public:
public
:
public
:
PartTextStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
PartTextStruct
(
const
wxPoint
&
pos
=
wxPoint
(
0
,
0
),
const
wxString
&
text
=
wxEmptyString
);
~
PartTextStruct
();
~
PartTextStruct
();
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"PartText
Struct
"
);
return
wxT
(
"PartText"
);
}
}
...
@@ -77,10 +78,18 @@ public:
...
@@ -77,10 +78,18 @@ public:
public
:
public
:
DrawPartStruct
(
KICAD_T
struct_type
,
const
wxPoint
&
pos
);
DrawPartStruct
(
KICAD_T
struct_type
,
const
wxPoint
&
pos
);
~
DrawPartStruct
();
~
DrawPartStruct
();
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawPart
Struct
"
);
return
wxT
(
"DrawPart"
);
}
}
/**
* Function GetReference
* returns a reference to the Reference
*/
const
wxString
&
GetReference
()
{
return
m_Field
[
REFERENCE
].
m_Text
;
}
};
};
...
@@ -101,19 +110,30 @@ public:
...
@@ -101,19 +110,30 @@ public:
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"EDA_SchComponent
Struct
"
);
return
wxT
(
"EDA_SchComponent"
);
}
}
EDA_SchComponentStruct
*
GenCopy
(
void
);
EDA_SchComponentStruct
*
GenCopy
();
void
SetRotationMiroir
(
int
type
);
void
SetRotationMiroir
(
int
type
);
int
GetRotationMiroir
();
int
GetRotationMiroir
();
wxPoint
GetScreenCoord
(
const
wxPoint
&
coord
);
wxPoint
GetScreenCoord
(
const
wxPoint
&
coord
);
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
void
ClearAnnotation
();
void
ClearAnnotation
();
EDA_Rect
GetBoundaryBox
();
EDA_Rect
GetBoundaryBox
();
wxString
ReturnFieldName
(
int
FieldNumber
);
const
wxString
&
ReturnFieldName
(
int
aFieldNdx
)
const
;
/**
* Function GetFieldValue
* returns a reference to the field value.
* @param aFieldNdx An index into the array of fields, 0 - FIELD8
* @return const wxString& - the field value or wxEmptyString
*/
const
wxString
&
GetFieldValue
(
int
aFieldNdx
)
const
;
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
const
wxPoint
&
offset
,
...
@@ -122,6 +142,17 @@ public:
...
@@ -122,6 +142,17 @@ public:
void
SwapData
(
EDA_SchComponentStruct
*
copyitem
);
void
SwapData
(
EDA_SchComponentStruct
*
copyitem
);
virtual
void
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
);
virtual
void
Place
(
WinEDA_DrawFrame
*
frame
,
wxDC
*
DC
);
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
};
...
...
eeschema/edit_component_in_lib.cpp
View file @
664a1f72
...
@@ -13,18 +13,17 @@
...
@@ -13,18 +13,17 @@
#include "protos.h"
#include "protos.h"
enum
id_libedit
{
enum
id_libedit
{
ID_PANEL_ALIAS
,
ID_PANEL_ALIAS
,
ID_PANEL_FIELD
,
ID_PANEL_FIELD
,
ID_COPY_DOC_TO_ALIAS
,
ID_COPY_DOC_TO_ALIAS
,
ID_BROWSE_DOC_FILES
,
ID_BROWSE_DOC_FILES
,
ID_ADD_ALIAS
,
ID_ADD_ALIAS
,
ID_DELETE_ONE_ALIAS
,
ID_DELETE_ONE_ALIAS
,
ID_DELETE_ALL_ALIAS
,
ID_DELETE_ALL_ALIAS
,
ID_ON_SELECT_FIELD
ID_ON_SELECT_FIELD
};
};
/* Routines locales */
/* Routines locales */
/* Variables locales */
/* Variables locales */
...
@@ -33,1071 +32,1193 @@ extern int CurrentUnit;
...
@@ -33,1071 +32,1193 @@ extern int CurrentUnit;
/* Classe de la frame des proprits d'un composant en librairie */
/* Classe de la frame des proprits d'un composant en librairie */
/* Cette classe genere une fenetre type NoteBook, pour l'edition des proprits
/* Cette classe genere une fenetre type NoteBook, pour l'edition des proprits
d'un composant le librairie.
*
d'un composant le librairie.
On peut diter:
*
On peut diter:
Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
*
Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
Documentation et mots clefs
*
Documentation et mots clefs
Nombre de part par boitier
*
Nombre de part par boitier
et autres proprirs gnrales
*
et autres proprirs gnrales
*/
*/
#include "dialog_edit_component_in_lib.cpp"
#include "dialog_edit_component_in_lib.cpp"
/*****************************************************************/
/*****************************************************************/
void
WinEDA_LibeditFrame
::
InstallLibeditFrame
(
const
wxPoint
&
pos
)
void
WinEDA_LibeditFrame
::
InstallLibeditFrame
(
const
wxPoint
&
pos
)
/*****************************************************************/
/*****************************************************************/
{
{
wxPoint
fpos
=
pos
;
wxPoint
fpos
=
pos
;
WinEDA_PartPropertiesFrame
*
frame
=
new
WinEDA_PartPropertiesFrame
(
this
);
WinEDA_PartPropertiesFrame
*
frame
=
int
IsModified
=
frame
->
ShowModal
();
frame
->
Destroy
();
new
WinEDA_PartPropertiesFrame
(
this
);
int
IsModified
=
frame
->
ShowModal
();
frame
->
Destroy
();
if
(
IsModified
)
Refresh
();
if
(
IsModified
)
Refresh
();
}
}
/***************************************************************************/
/***************************************************************************/
void
WinEDA_PartPropertiesFrame
::
CopyFieldDataToBuffer
(
LibDrawField
*
Field
)
void
WinEDA_PartPropertiesFrame
::
CopyFieldDataToBuffer
(
LibDrawField
*
Field
)
/***************************************************************************/
/***************************************************************************/
/* copy the field data (name, attributes, size, position... to corresponding buffers
/* copy the field data (name, attributes, size, position... to corresponding buffers
for editing
*
for editing
*/
*/
{
{
int
id
=
Field
->
m_FieldId
;
int
id
=
Field
->
m_FieldId
;
m_FieldFlags
[
id
]
=
(
Field
->
m_Attributs
&
TEXT_NO_VISIBLE
)
?
0
:
1
;
m_FieldFlags
[
id
]
=
(
Field
->
m_Attributs
&
TEXT_NO_VISIBLE
)
?
0
:
1
;
m_FieldOrient
[
id
]
=
Field
->
m_Orient
;
m_FieldOrient
[
id
]
=
Field
->
m_Orient
;
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
m_FieldHJustify
[
id
]
=
0
;
m_FieldHJustify
[
id
]
=
0
;
else
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
else
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
m_FieldHJustify
[
id
]
=
2
;
m_FieldHJustify
[
id
]
=
2
;
else
else
m_FieldHJustify
[
id
]
=
1
;
m_FieldHJustify
[
id
]
=
1
;
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
m_FieldVJustify
[
id
]
=
0
;
m_FieldVJustify
[
id
]
=
0
;
else
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
else
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
m_FieldVJustify
[
id
]
=
2
;
m_FieldVJustify
[
id
]
=
2
;
else
m_FieldVJustify
[
id
]
=
1
;
else
m_FieldVJustify
[
id
]
=
1
;
m_FieldText
[
id
]
=
Field
->
m_Text
;
if
(
id
>=
FIELD1
)
m_FieldName
[
id
]
=
Field
->
m_Name
;
m_FieldText
[
id
]
=
Field
->
m_Text
;
m_FieldPosition
[
id
]
=
Field
->
m_Pos
;
if
(
id
>=
FIELD1
)
// Note: the Y axis for components in lib is from bottom to top
m_FieldName
[
id
]
=
Field
->
m_Name
;
// and the screen axis is top to bottom: we must change the y coord sign for editing
m_FieldPosition
[
id
]
=
Field
->
m_Pos
;
m_FieldPosition
[
id
].
y
=
-
m_FieldPosition
[
id
].
y
;
m_FieldSize
[
id
]
=
Field
->
m_Size
.
x
;
// Note: the Y axis for components in lib is from bottom to top
// and the screen axis is top to bottom: we must change the y coord sign for editing
m_FieldPosition
[
id
].
y
=
-
m_FieldPosition
[
id
].
y
;
m_FieldSize
[
id
]
=
Field
->
m_Size
.
x
;
}
}
/***************************************************************************/
/***************************************************************************/
void
WinEDA_PartPropertiesFrame
::
CopyBufferToFieldData
(
LibDrawField
*
Field
)
void
WinEDA_PartPropertiesFrame
::
CopyBufferToFieldData
(
LibDrawField
*
Field
)
/***************************************************************************/
/***************************************************************************/
/* Copy data from buffers(name, attributes, size, position... )to the
/* Copy data from buffers(name, attributes, size, position... )to the
field "Field"
*
field "Field"
*/
*/
{
{
int
hjustify
[
3
]
=
{
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_HJUSTIFY_CENTER
,
int
hjustify
[
3
]
=
{
GR_TEXT_HJUSTIFY_RIGHT
};
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_HJUSTIFY_CENTER
,
int
vjustify
[
3
]
=
{
GR_TEXT_VJUSTIFY_BOTTOM
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_RIGHT
GR_TEXT_VJUSTIFY_TOP
};
};
int
ii
=
Field
->
m_FieldId
;
int
vjustify
[
3
]
=
{
GR_TEXT_VJUSTIFY_BOTTOM
,
GR_TEXT_VJUSTIFY_CENTER
,
Field
->
m_Text
=
m_FieldText
[
ii
];
GR_TEXT_VJUSTIFY_TOP
};
if
(
ii
>=
FIELD1
&&
m_FieldName
[
ii
]
!=
ReturnDefaultFieldName
(
ii
)
)
int
ii
=
Field
->
m_FieldId
;
Field
->
m_Name
=
m_FieldName
[
ii
];
else
Field
->
m_Name
.
Empty
();
Field
->
m_Text
=
m_FieldText
[
ii
];
Field
->
m_Size
.
x
=
Field
->
m_Size
.
y
=
m_FieldSize
[
ii
];
if
(
ii
>=
FIELD1
&&
m_FieldName
[
ii
]
!=
ReturnDefaultFieldName
(
ii
)
)
Field
->
m_HJustify
=
hjustify
[
m_FieldHJustify
[
ii
]];
Field
->
m_Name
=
m_FieldName
[
ii
];
Field
->
m_VJustify
=
vjustify
[
m_FieldVJustify
[
ii
]];
else
if
(
m_FieldFlags
[
ii
]
)
Field
->
m_Name
.
Empty
();
Field
->
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
else
Field
->
m_Size
.
x
=
Field
->
m_Size
.
y
=
m_FieldSize
[
ii
];
Field
->
m_Attributs
|=
TEXT_NO_VISIBLE
;
Field
->
m_HJustify
=
hjustify
[
m_FieldHJustify
[
ii
]];
Field
->
m_Orient
=
m_FieldOrient
[
ii
]
?
1
:
0
;
Field
->
m_VJustify
=
vjustify
[
m_FieldVJustify
[
ii
]];
Field
->
m_Pos
=
m_FieldPosition
[
ii
];
if
(
m_FieldFlags
[
ii
]
)
// Note: the Y axis for components in lib is from bottom to top
Field
->
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
// and the screen axis is top to bottom: we must change the y coord sign after editing
else
Field
->
m_Pos
.
y
=
-
Field
->
m_Pos
.
y
;
Field
->
m_Attributs
|=
TEXT_NO_VISIBLE
;
Field
->
m_Orient
=
m_FieldOrient
[
ii
]
?
1
:
0
;
Field
->
m_Pos
=
m_FieldPosition
[
ii
];
// Note: the Y axis for components in lib is from bottom to top
// and the screen axis is top to bottom: we must change the y coord sign after editing
Field
->
m_Pos
.
y
=
-
Field
->
m_Pos
.
y
;
}
}
/*****************************************************/
/*****************************************************/
void
WinEDA_PartPropertiesFrame
::
InitBuffers
()
void
WinEDA_PartPropertiesFrame
::
InitBuffers
()
/*****************************************************/
/*****************************************************/
/* Init the buffers to a default value,
/* Init the buffers to a default value,
or to values from CurrentLibEntry if CurrentLibEntry != NULL
*
or to values from CurrentLibEntry if CurrentLibEntry != NULL
*/
*/
{
{
int
ii
;
int
ii
;
m_CurrentFieldId
=
REFERENCE
;
m_CurrentFieldId
=
REFERENCE
;
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
{
if
(
ii
<
FIELD1
)
if
(
ii
<
FIELD1
)
m_FieldName
[
ii
]
=
ReturnDefaultFieldName
(
ii
);
m_FieldName
[
ii
]
=
ReturnDefaultFieldName
(
ii
);
m_FieldFlags
[
ii
]
=
1
;
m_FieldFlags
[
ii
]
=
1
;
m_FieldOrient
[
ii
]
=
0
;
m_FieldOrient
[
ii
]
=
0
;
m_FieldSize
[
ii
]
=
DEFAULT_TEXT_SIZE
;
m_FieldSize
[
ii
]
=
DEFAULT_TEXT_SIZE
;
m_FieldHJustify
[
ii
]
=
1
;
m_FieldHJustify
[
ii
]
=
1
;
m_FieldVJustify
[
ii
]
=
1
;
m_FieldVJustify
[
ii
]
=
1
;
}
}
m_AliasLocation
=
-
1
;
m_AliasLocation
=
-
1
;
if
(
CurrentLibEntry
==
NULL
)
if
(
CurrentLibEntry
==
NULL
)
{
{
m_Title
=
_
(
"Lib Component Properties"
);
m_Title
=
_
(
"Lib Component Properties"
);
return
;
return
;
}
}
wxString
msg_text
=
_
(
"Properties for "
);
wxString
msg_text
=
_
(
"Properties for "
);
if
(
!
CurrentAliasName
.
IsEmpty
()
)
if
(
!
CurrentAliasName
.
IsEmpty
()
)
{
{
m_AliasLocation
=
LocateAlias
(
CurrentLibEntry
->
m_AliasList
,
CurrentAliasName
);
m_AliasLocation
=
LocateAlias
(
CurrentLibEntry
->
m_AliasList
,
CurrentAliasName
);
m_Title
=
msg_text
+
CurrentAliasName
+
m_Title
=
msg_text
+
CurrentAliasName
+
_
(
"(alias of "
)
+
_
(
"(alias of "
)
+
wxString
(
CurrentLibEntry
->
m_Name
.
m_Text
)
wxString
(
CurrentLibEntry
->
m_Name
.
m_Text
)
+
wxT
(
")"
);
+
wxT
(
")"
);
}
}
else
else
{
{
m_Title
=
msg_text
+
CurrentLibEntry
->
m_Name
.
m_Text
;
m_Title
=
msg_text
+
CurrentLibEntry
->
m_Name
.
m_Text
;
CurrentAliasName
.
Empty
();
CurrentAliasName
.
Empty
();
}
}
CopyFieldDataToBuffer
(
&
CurrentLibEntry
->
m_Prefix
);
CopyFieldDataToBuffer
(
&
CurrentLibEntry
->
m_Prefix
);
CopyFieldDataToBuffer
(
&
CurrentLibEntry
->
m_Name
);
CopyFieldDataToBuffer
(
&
CurrentLibEntry
->
m_Name
);
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
while
(
Field
)
while
(
Field
)
{
{
CopyFieldDataToBuffer
(
Field
);
CopyFieldDataToBuffer
(
Field
);
Field
=
(
LibDrawField
*
)
Field
->
Pnext
;
Field
=
(
LibDrawField
*
)
Field
->
Pnext
;
}
}
}
}
/*****************************************************/
/*****************************************************/
void
WinEDA_PartPropertiesFrame
::
BuildPanelAlias
()
void
WinEDA_PartPropertiesFrame
::
BuildPanelAlias
()
/*****************************************************/
/*****************************************************/
/* create the panel for component alias list editing
/* create the panel for component alias list editing
*/
*/
{
{
wxButton
*
Button
;
wxButton
*
Button
;
m_PanelAlias
->
SetFont
(
*
g_DialogFont
);
m_PanelAlias
->
SetFont
(
*
g_DialogFont
);
wxBoxSizer
*
PanelAliasBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
wxBoxSizer
*
PanelAliasBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_PanelAlias
->
SetSizer
(
PanelAliasBoxSizer
);
wxBoxSizer
*
LeftBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
m_PanelAlias
->
SetSizer
(
PanelAliasBoxSizer
);
PanelAliasBoxSizer
->
Add
(
LeftBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
wxBoxSizer
*
LeftBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
wxStaticText
*
Msg
=
new
wxStaticText
(
m_PanelAlias
,
-
1
,
_
(
"Alias"
));
PanelAliasBoxSizer
->
Add
(
LeftBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
Msg
->
SetForegroundColour
(
wxColour
(
200
,
0
,
0
)
);
LeftBoxSizer
->
Add
(
Msg
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
wxStaticText
*
Msg
=
new
wxStaticText
(
m_PanelAlias
,
-
1
,
_
(
"Alias"
)
);
m_PartAliasList
=
new
wxListBox
(
m_PanelAlias
,
Msg
->
SetForegroundColour
(
wxColour
(
200
,
0
,
0
)
);
-
1
,
LeftBoxSizer
->
Add
(
Msg
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
wxDefaultPosition
,
wxSize
(
200
,
250
),
0
,
NULL
,
m_PartAliasList
=
new
wxListBox
(
m_PanelAlias
,
wxLB_ALWAYS_SB
|
wxLB_SINGLE
);
-
1
,
LeftBoxSizer
->
Add
(
m_PartAliasList
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
wxDefaultPosition
,
wxSize
(
200
,
250
),
0
,
NULL
,
wxBoxSizer
*
RightBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
wxLB_ALWAYS_SB
|
wxLB_SINGLE
);
PanelAliasBoxSizer
->
Add
(
RightBoxSizer
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
LeftBoxSizer
->
Add
(
m_PartAliasList
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
Button
=
new
wxButton
(
m_PanelAlias
,
ID_ADD_ALIAS
,
_
(
"Add"
));
Button
->
SetForegroundColour
(
*
wxBLUE
);
wxBoxSizer
*
RightBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
RightBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
PanelAliasBoxSizer
->
Add
(
RightBoxSizer
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
m_ButtonDeleteOneAlias
=
new
wxButton
(
m_PanelAlias
,
ID_DELETE_ONE_ALIAS
,
_
(
"Delete"
));
Button
=
new
wxButton
(
m_PanelAlias
,
ID_ADD_ALIAS
,
_
(
"Add"
)
);
m_ButtonDeleteOneAlias
->
SetForegroundColour
(
*
wxRED
);
RightBoxSizer
->
Add
(
m_ButtonDeleteOneAlias
,
0
,
wxGROW
|
wxALL
,
5
);
Button
->
SetForegroundColour
(
*
wxBLUE
);
RightBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
m_ButtonDeleteAllAlias
=
new
wxButton
(
m_PanelAlias
,
ID_DELETE_ALL_ALIAS
,
_
(
"Delete All"
));
m_ButtonDeleteOneAlias
=
new
wxButton
(
m_PanelAlias
,
ID_DELETE_ONE_ALIAS
,
m_ButtonDeleteAllAlias
->
SetForegroundColour
(
*
wxRED
);
_
(
"Delete"
)
);
if
(
!
CurrentAliasName
.
IsEmpty
()
)
m_ButtonDeleteAllAlias
->
Enable
(
FALSE
);
RightBoxSizer
->
Add
(
m_ButtonDeleteAllAlias
,
0
,
wxGROW
|
wxALL
,
5
);
m_ButtonDeleteOneAlias
->
SetForegroundColour
(
*
wxRED
);
RightBoxSizer
->
Add
(
m_ButtonDeleteOneAlias
,
0
,
wxGROW
|
wxALL
,
5
);
/* lecture des noms des alias */
m_ButtonDeleteAllAlias
=
new
wxButton
(
m_PanelAlias
,
ID_DELETE_ALL_ALIAS
,
if
(
CurrentLibEntry
)
_
(
"Delete All"
)
);
{
for
(
unsigned
ii
=
0
;
ii
<
CurrentLibEntry
->
m_AliasList
.
GetCount
();
ii
+=
ALIAS_NEXT
)
m_ButtonDeleteAllAlias
->
SetForegroundColour
(
*
wxRED
);
m_PartAliasList
->
Append
(
CurrentLibEntry
->
m_AliasList
[
ii
+
ALIAS_NAME
]);
if
(
!
CurrentAliasName
.
IsEmpty
()
)
}
m_ButtonDeleteAllAlias
->
Enable
(
FALSE
);
RightBoxSizer
->
Add
(
m_ButtonDeleteAllAlias
,
0
,
wxGROW
|
wxALL
,
5
);
if
(
(
CurrentLibEntry
==
NULL
)
||
(
CurrentLibEntry
->
m_AliasList
.
GetCount
()
==
0
)
)
{
m_ButtonDeleteAllAlias
->
Enable
(
FALSE
);
/* lecture des noms des alias */
m_ButtonDeleteOneAlias
->
Enable
(
FALSE
);
if
(
CurrentLibEntry
)
}
{
for
(
unsigned
ii
=
0
;
ii
<
CurrentLibEntry
->
m_AliasList
.
GetCount
();
ii
+=
ALIAS_NEXT
)
m_PartAliasList
->
Append
(
CurrentLibEntry
->
m_AliasList
[
ii
+
ALIAS_NAME
]
);
}
if
(
(
CurrentLibEntry
==
NULL
)
||
(
CurrentLibEntry
->
m_AliasList
.
GetCount
()
==
0
)
)
{
m_ButtonDeleteAllAlias
->
Enable
(
FALSE
);
m_ButtonDeleteOneAlias
->
Enable
(
FALSE
);
}
}
}
/*****************************************************************/
/*****************************************************************/
void
WinEDA_PartPropertiesFrame
::
BuildPanelFootprintFilter
()
void
WinEDA_PartPropertiesFrame
::
BuildPanelFootprintFilter
()
/*****************************************************************/
/*****************************************************************/
/* create the panel for footprint filtering in cvpcb list
/* create the panel for footprint filtering in cvpcb list
*/
*/
{
{
m_PanelFootprintFilter
=
new
wxPanel
(
m_NoteBook
,
-
1
,
wxDefaultPosition
,
wxDefaultSize
,
wxSUNKEN_BORDER
|
wxTAB_TRAVERSAL
);
m_PanelFootprintFilter
=
new
wxPanel
(
m_NoteBook
,
-
1
,
wxDefaultPosition
,
wxDefaultSize
,
wxSUNKEN_BORDER
|
wxTAB_TRAVERSAL
);
m_NoteBook
->
AddPage
(
m_PanelFootprintFilter
,
_
(
"Footprint Filter"
)
);
m_NoteBook
->
AddPage
(
m_PanelFootprintFilter
,
_
(
"Footprint Filter"
));
m_PanelFootprintFilter
->
SetFont
(
*
g_DialogFont
);
m_PanelFootprintFilter
->
SetFont
(
*
g_DialogFont
);
wxBoxSizer
*
PanelFpFilterBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_PanelFootprintFilter
->
SetSizer
(
PanelFpFilterBoxSizer
);
wxBoxSizer
*
LeftBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
PanelFpFilterBoxSizer
->
Add
(
LeftBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
wxStaticText
*
Msg
=
new
wxStaticText
(
m_PanelFootprintFilter
,
-
1
,
_
(
"Footprints"
));
Msg
->
SetForegroundColour
(
wxColour
(
200
,
0
,
0
)
);
LeftBoxSizer
->
Add
(
Msg
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
m_FootprintFilterListBox
=
new
wxListBox
(
m_PanelFootprintFilter
,
-
1
,
wxDefaultPosition
,
wxSize
(
200
,
250
),
0
,
NULL
,
wxLB_ALWAYS_SB
|
wxLB_SINGLE
);
LeftBoxSizer
->
Add
(
m_FootprintFilterListBox
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
wxBoxSizer
*
RightBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
PanelFpFilterBoxSizer
->
Add
(
RightBoxSizer
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
wxButton
*
Button
=
new
wxButton
(
m_PanelFootprintFilter
,
ID_ADD_FOOTPRINT_FILTER
,
_
(
"Add"
));
Button
->
SetForegroundColour
(
*
wxBLUE
);
RightBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
m_ButtonDeleteOneFootprintFilter
=
new
wxButton
(
m_PanelFootprintFilter
,
ID_DELETE_ONE_FOOTPRINT_FILTER
,
_
(
"Delete"
));
m_ButtonDeleteOneFootprintFilter
->
SetForegroundColour
(
*
wxRED
);
RightBoxSizer
->
Add
(
m_ButtonDeleteOneFootprintFilter
,
0
,
wxGROW
|
wxALL
,
5
);
m_ButtonDeleteAllFootprintFilter
=
new
wxButton
(
m_PanelFootprintFilter
,
ID_DELETE_ALL_FOOTPRINT_FILTER
,
_
(
"Delete All"
));
m_ButtonDeleteAllFootprintFilter
->
SetForegroundColour
(
*
wxRED
);
RightBoxSizer
->
Add
(
m_ButtonDeleteAllFootprintFilter
,
0
,
wxGROW
|
wxALL
,
5
);
/* Read the Footprint Filter list */
if
(
CurrentLibEntry
)
{
for
(
unsigned
ii
=
0
;
ii
<
CurrentLibEntry
->
m_FootprintList
.
GetCount
();
ii
++
)
m_FootprintFilterListBox
->
Append
(
CurrentLibEntry
->
m_FootprintList
[
ii
]);
}
if
(
(
CurrentLibEntry
==
NULL
)
||
(
CurrentLibEntry
->
m_FootprintList
.
GetCount
()
==
0
)
)
{
m_ButtonDeleteAllFootprintFilter
->
Enable
(
FALSE
);
m_ButtonDeleteOneFootprintFilter
->
Enable
(
FALSE
);
}
}
wxBoxSizer
*
PanelFpFilterBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_PanelFootprintFilter
->
SetSizer
(
PanelFpFilterBoxSizer
);
wxBoxSizer
*
LeftBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
PanelFpFilterBoxSizer
->
Add
(
LeftBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
wxStaticText
*
Msg
=
new
wxStaticText
(
m_PanelFootprintFilter
,
-
1
,
_
(
"Footprints"
)
);
Msg
->
SetForegroundColour
(
wxColour
(
200
,
0
,
0
)
);
LeftBoxSizer
->
Add
(
Msg
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxTOP
,
5
);
m_FootprintFilterListBox
=
new
wxListBox
(
m_PanelFootprintFilter
,
-
1
,
wxDefaultPosition
,
wxSize
(
200
,
250
),
0
,
NULL
,
wxLB_ALWAYS_SB
|
wxLB_SINGLE
);
LeftBoxSizer
->
Add
(
m_FootprintFilterListBox
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
wxBoxSizer
*
RightBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
PanelFpFilterBoxSizer
->
Add
(
RightBoxSizer
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
wxButton
*
Button
=
new
wxButton
(
m_PanelFootprintFilter
,
ID_ADD_FOOTPRINT_FILTER
,
_
(
"Add"
)
);
Button
->
SetForegroundColour
(
*
wxBLUE
);
RightBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
m_ButtonDeleteOneFootprintFilter
=
new
wxButton
(
m_PanelFootprintFilter
,
ID_DELETE_ONE_FOOTPRINT_FILTER
,
_
(
"Delete"
)
);
m_ButtonDeleteOneFootprintFilter
->
SetForegroundColour
(
*
wxRED
);
RightBoxSizer
->
Add
(
m_ButtonDeleteOneFootprintFilter
,
0
,
wxGROW
|
wxALL
,
5
);
m_ButtonDeleteAllFootprintFilter
=
new
wxButton
(
m_PanelFootprintFilter
,
ID_DELETE_ALL_FOOTPRINT_FILTER
,
_
(
"Delete All"
)
);
m_ButtonDeleteAllFootprintFilter
->
SetForegroundColour
(
*
wxRED
);
RightBoxSizer
->
Add
(
m_ButtonDeleteAllFootprintFilter
,
0
,
wxGROW
|
wxALL
,
5
);
/* Read the Footprint Filter list */
if
(
CurrentLibEntry
)
{
for
(
unsigned
ii
=
0
;
ii
<
CurrentLibEntry
->
m_FootprintList
.
GetCount
();
ii
++
)
m_FootprintFilterListBox
->
Append
(
CurrentLibEntry
->
m_FootprintList
[
ii
]
);
}
if
(
(
CurrentLibEntry
==
NULL
)
||
(
CurrentLibEntry
->
m_FootprintList
.
GetCount
()
==
0
)
)
{
m_ButtonDeleteAllFootprintFilter
->
Enable
(
FALSE
);
m_ButtonDeleteOneFootprintFilter
->
Enable
(
FALSE
);
}
}
/*****************************************************/
/*****************************************************/
void
WinEDA_PartPropertiesFrame
::
BuildPanelDoc
()
void
WinEDA_PartPropertiesFrame
::
BuildPanelDoc
()
/*****************************************************/
/*****************************************************/
/* create the panel for component doc editing
/* create the panel for component doc editing
*/
*/
{
{
wxString
msg_text
;
wxString
msg_text
;
if
(
m_AliasLocation
>=
0
)
if
(
m_AliasLocation
>=
0
)
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC
];
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC
];
else
else
{
{
if
(
CurrentLibEntry
&&
CurrentLibEntry
->
m_Doc
)
if
(
CurrentLibEntry
&&
CurrentLibEntry
->
m_Doc
)
msg_text
=
CurrentLibEntry
->
m_Doc
;
msg_text
=
CurrentLibEntry
->
m_Doc
;
}
}
m_Doc
->
SetValue
(
msg_text
);
m_Doc
->
SetValue
(
msg_text
);
msg_text
.
Empty
();
msg_text
.
Empty
();
if
(
m_AliasLocation
>=
0
)
if
(
m_AliasLocation
>=
0
)
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_KEYWORD
];
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_KEYWORD
];
else
else
{
{
if
(
CurrentLibEntry
)
msg_text
=
CurrentLibEntry
->
m_KeyWord
;
if
(
CurrentLibEntry
)
}
msg_text
=
CurrentLibEntry
->
m_KeyWord
;
m_Keywords
->
SetValue
(
msg_text
);
}
m_Keywords
->
SetValue
(
msg_text
);
msg_text
.
Empty
();
if
(
m_AliasLocation
>=
0
)
msg_text
.
Empty
();
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC_FILENAME
];
if
(
m_AliasLocation
>=
0
)
else
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC_FILENAME
];
{
else
if
(
CurrentLibEntry
)
msg_text
=
CurrentLibEntry
->
m_DocFile
;
{
}
if
(
CurrentLibEntry
)
m_Docfile
->
SetValue
(
msg_text
);
msg_text
=
CurrentLibEntry
->
m_DocFile
;
}
if
(
m_AliasLocation
<
0
)
m_ButtonCopyDoc
->
Enable
(
FALSE
);
m_Docfile
->
SetValue
(
msg_text
);
if
(
m_AliasLocation
<
0
)
m_ButtonCopyDoc
->
Enable
(
FALSE
);
}
}
/*****************************************************/
/*****************************************************/
void
WinEDA_PartPropertiesFrame
::
BuildPanelBasic
()
void
WinEDA_PartPropertiesFrame
::
BuildPanelBasic
()
/*****************************************************/
/*****************************************************/
/* create the basic panel for component properties editing
/* create the basic panel for component properties editing
*/
*/
{
{
m_PanelBasic
->
SetFont
(
*
g_DialogFont
);
m_PanelBasic
->
SetFont
(
*
g_DialogFont
);
AsConvertButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"As Convert"
));
AsConvertButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"As Convert"
)
);
if
(
g_AsDeMorgan
)
AsConvertButt
->
SetValue
(
TRUE
);
m_OptionsBoxSizer
->
Add
(
AsConvertButt
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
if
(
g_AsDeMorgan
)
AsConvertButt
->
SetValue
(
TRUE
);
ShowPinNumButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Show Pin Num"
));
m_OptionsBoxSizer
->
Add
(
AsConvertButt
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
if
(
CurrentLibEntry
)
{
ShowPinNumButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Show Pin Num"
)
);
if
(
CurrentLibEntry
->
m_DrawPinNum
)
ShowPinNumButt
->
SetValue
(
TRUE
);
}
if
(
CurrentLibEntry
)
else
ShowPinNumButt
->
SetValue
(
TRUE
);
{
m_OptionsBoxSizer
->
Add
(
ShowPinNumButt
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
if
(
CurrentLibEntry
->
m_DrawPinNum
)
ShowPinNumButt
->
SetValue
(
TRUE
);
ShowPinNameButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Show Pin Name"
));
}
if
(
CurrentLibEntry
)
else
{
ShowPinNumButt
->
SetValue
(
TRUE
);
if
(
CurrentLibEntry
->
m_DrawPinName
)
ShowPinNameButt
->
SetValue
(
TRUE
);
m_OptionsBoxSizer
->
Add
(
ShowPinNumButt
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
}
else
ShowPinNameButt
->
SetValue
(
TRUE
);
ShowPinNameButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Show Pin Name"
)
);
m_OptionsBoxSizer
->
Add
(
ShowPinNameButt
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
if
(
CurrentLibEntry
)
m_PinsNameInsideButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Pin Name Inside"
));
{
if
(
CurrentLibEntry
)
if
(
CurrentLibEntry
->
m_DrawPinName
)
{
ShowPinNameButt
->
SetValue
(
TRUE
);
if
(
CurrentLibEntry
->
m_TextInside
)
m_PinsNameInsideButt
->
SetValue
(
TRUE
);
}
}
else
else
m_PinsNameInsideButt
->
SetValue
(
TRUE
);
ShowPinNameButt
->
SetValue
(
TRUE
);
m_OptionsBoxSizer
->
Add
(
m_PinsNameInsideButt
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
m_OptionsBoxSizer
->
Add
(
ShowPinNameButt
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
int
number
,
number_of_units
;
m_PinsNameInsideButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Pin Name Inside"
)
);
if
(
CurrentLibEntry
)
number_of_units
=
CurrentLibEntry
->
m_UnitCount
;
else
number_of_units
=
1
;
if
(
CurrentLibEntry
)
SelNumberOfUnits
->
SetValue
(
number_of_units
);
{
if
(
CurrentLibEntry
->
m_TextInside
)
if
(
CurrentLibEntry
&&
CurrentLibEntry
->
m_TextInside
)
m_PinsNameInsideButt
->
SetValue
(
TRUE
);
number
=
CurrentLibEntry
->
m_TextInside
;
}
else
number
=
40
;
else
m_SetSkew
->
SetValue
(
number
);
m_PinsNameInsideButt
->
SetValue
(
TRUE
);
m_OptionsBoxSizer
->
Add
(
m_PinsNameInsideButt
,
0
,
wxGROW
|
wxLEFT
|
wxRIGHT
|
wxBOTTOM
,
5
);
if
(
CurrentLibEntry
)
{
int
number
,
number_of_units
;
if
(
CurrentLibEntry
->
m_Options
==
ENTRY_POWER
)
if
(
CurrentLibEntry
)
m_OptionPower
->
SetValue
(
TRUE
);
number_of_units
=
CurrentLibEntry
->
m_UnitCount
;
}
else
number_of_units
=
1
;
if
(
CurrentLibEntry
)
SelNumberOfUnits
->
SetValue
(
number_of_units
);
{
if
(
CurrentLibEntry
->
m_UnitSelectionLocked
)
if
(
CurrentLibEntry
&&
CurrentLibEntry
->
m_TextInside
)
m_OptionPartsLocked
->
SetValue
(
TRUE
);
number
=
CurrentLibEntry
->
m_TextInside
;
}
else
number
=
40
;
m_SetSkew
->
SetValue
(
number
);
if
(
CurrentLibEntry
)
{
if
(
CurrentLibEntry
->
m_Options
==
ENTRY_POWER
)
m_OptionPower
->
SetValue
(
TRUE
);
}
if
(
CurrentLibEntry
)
{
if
(
CurrentLibEntry
->
m_UnitSelectionLocked
)
m_OptionPartsLocked
->
SetValue
(
TRUE
);
}
}
}
/*********************************************************/
/*********************************************************/
void
WinEDA_PartPropertiesFrame
::
BuildPanelEditField
()
void
WinEDA_PartPropertiesFrame
::
BuildPanelEditField
()
/**********************************************************/
/**********************************************************/
/* Create and build the panel managing the fields (REF, VALUE ...)
/* Create and build the panel managing the fields (REF, VALUE ...)
of the component
*
of the component
*/
*/
{
{
wxString
Hjustify_list
[]
=
wxString
Hjustify_list
[]
=
{
_
(
"Left justify"
),
_
(
"Center"
),
_
(
"Right justify"
)};
{
_
(
"Left justify"
),
_
(
"Center"
),
_
(
"Right justify"
)
};
wxString
Vjustify_list
[]
=
wxString
Vjustify_list
[]
=
{
_
(
"Bottom justify"
),
_
(
"Center"
),
_
(
"Top justify"
)};
{
_
(
"Bottom justify"
),
_
(
"Center"
),
_
(
"Top justify"
)
};
int
FieldId
=
m_CurrentFieldId
;
int
FieldId
=
m_CurrentFieldId
;
m_PanelField
=
new
wxPanel
(
m_NoteBook
,
ID_PANEL_FIELD
);
m_PanelField
->
SetFont
(
*
g_DialogFont
);
m_NoteBook
->
AddPage
(
m_PanelField
,
_
(
"Fields"
),
FALSE
);
wxBoxSizer
*
PanelFieldBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
m_PanelField
->
SetSizer
(
PanelFieldBoxSizer
);
wxBoxSizer
*
LeftBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
PanelFieldBoxSizer
->
Add
(
LeftBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
wxBoxSizer
*
MiddleBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
PanelFieldBoxSizer
->
Add
(
MiddleBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
m_ShowFieldTextCtrl
=
new
wxCheckBox
(
m_PanelField
,
-
1
,
_
(
"Show Text"
)
);
LeftBoxSizer
->
Add
(
m_ShowFieldTextCtrl
,
0
,
wxGROW
|
wxALL
,
5
);
m_VorientFieldTextCtrl
=
new
wxCheckBox
(
m_PanelField
,
-
1
,
_
(
"Vertical"
));
LeftBoxSizer
->
Add
(
m_VorientFieldTextCtrl
,
0
,
wxGROW
|
wxALL
,
5
);
// Create the box for field name display or edition
m_FieldNameCtrl
=
new
WinEDA_EnterText
(
m_PanelField
,
_
(
"Field Name:"
),
m_FieldName
[
FieldId
],
LeftBoxSizer
,
wxSize
(
200
,
-
1
)
);
if
(
FieldId
<
FIELD1
)
m_FieldNameCtrl
->
Enable
(
FALSE
);
else
m_FieldNameCtrl
->
Enable
(
TRUE
);
// Create the box for text editing (text, size)
m_FieldTextCtrl
=
new
WinEDA_GraphicTextCtrl
(
m_PanelField
,
_
(
"Value:"
),
m_FieldText
[
FieldId
],
m_FieldSize
[
FieldId
],
g_UnitMetric
,
LeftBoxSizer
,
200
);
// Create the box for text editing (position)
m_FieldPositionCtrl
=
new
WinEDA_PositionCtrl
(
m_PanelField
,
_
(
"Pos"
),
m_FieldPosition
[
FieldId
],
g_UnitMetric
,
LeftBoxSizer
);
m_FieldHJustifyCtrl
=
new
wxRadioBox
(
m_PanelField
,
-
1
,
_
(
"Hor Justify"
),
wxDefaultPosition
,
wxDefaultSize
,
3
,
Hjustify_list
,
1
,
wxRA_SPECIFY_COLS
);
m_FieldHJustifyCtrl
->
SetSelection
(
1
);
MiddleBoxSizer
->
Add
(
m_FieldHJustifyCtrl
,
0
,
wxGROW
|
wxALL
,
5
);
m_FieldVJustifyCtrl
=
new
wxRadioBox
(
m_PanelField
,
-
1
,
_
(
"Vert Justify"
),
wxDefaultPosition
,
wxDefaultSize
,
3
,
Vjustify_list
,
1
,
wxRA_SPECIFY_COLS
);
m_FieldVJustifyCtrl
->
SetSelection
(
1
);
MiddleBoxSizer
->
Add
(
m_FieldVJustifyCtrl
,
0
,
wxGROW
|
wxALL
,
5
);
// Create the field list
wxString
fieldnamelist
[
NUMBER_OF_FIELDS
];
for
(
int
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
if
(
m_FieldName
[
ii
].
IsEmpty
()
)
fieldnamelist
[
ii
]
=
ReturnDefaultFieldName
(
ii
);
else
fieldnamelist
[
ii
]
=
m_FieldName
[
ii
];
}
m_FieldSelection
=
new
wxRadioBox
(
m_PanelField
,
ID_ON_SELECT_FIELD
,
_
(
"Field to edit"
),
wxDefaultPosition
,
wxDefaultSize
,
NUMBER_OF_FIELDS
,
fieldnamelist
,
2
,
wxRA_SPECIFY_COLS
);
PanelFieldBoxSizer
->
Add
(
m_FieldSelection
,
0
,
wxGROW
|
wxALL
,
5
);
CopyDataToPanelField
();
}
m_PanelField
=
new
wxPanel
(
m_NoteBook
,
ID_PANEL_FIELD
);
/****************************************************************/
m_PanelField
->
SetFont
(
*
g_DialogFont
);
void
WinEDA_PartPropertiesFrame
::
CopyDataToPanelField
()
m_NoteBook
->
AddPage
(
m_PanelField
,
_
(
"Fields"
),
FALSE
);
/****************************************************************/
/* Set the values displayed on the panel field according to
the current field number
*/
{
int
FieldId
=
m_CurrentFieldId
;
for
(
int
ii
=
FIELD1
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
wxBoxSizer
*
PanelFieldBoxSizer
=
new
wxBoxSizer
(
wxHORIZONTAL
);
{
if
(
!
m_FieldName
[
ii
].
IsEmpty
()
)
m_FieldSelection
->
SetString
(
ii
,
m_FieldName
[
ii
]);
else
m_FieldSelection
->
SetString
(
ii
,
ReturnDefaultFieldName
(
ii
));
}
if
(
m_FieldFlags
[
FieldId
]
)
m_PanelField
->
SetSizer
(
PanelFieldBoxSizer
);
m_ShowFieldTextCtrl
->
SetValue
(
TRUE
);
wxBoxSizer
*
LeftBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
else
m_ShowFieldTextCtrl
->
SetValue
(
FALSE
);
if
(
m_FieldOrient
[
FieldId
]
)
m_VorientFieldTextCtrl
->
SetValue
(
TRUE
);
PanelFieldBoxSizer
->
Add
(
LeftBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
else
m_VorientFieldTextCtrl
->
SetValue
(
FALSE
);
wxBoxSizer
*
MiddleBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
m_FieldHJustifyCtrl
->
SetSelection
(
m_FieldHJustify
[
FieldId
]
);
PanelFieldBoxSizer
->
Add
(
MiddleBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
m_FieldVJustifyCtrl
->
SetSelection
(
m_FieldVJustify
[
FieldId
]);
m_ShowFieldTextCtrl
=
new
wxCheckBox
(
m_PanelField
,
-
1
,
_
(
"Show Text"
)
);
m_FieldPositionCtrl
->
SetValue
(
m_FieldPosition
[
FieldId
].
x
,
m_FieldPosition
[
FieldId
].
y
);
LeftBoxSizer
->
Add
(
m_ShowFieldTextCtrl
,
0
,
wxGROW
|
wxALL
,
5
);
m_FieldNameCtrl
->
SetValue
(
m_FieldName
[
FieldId
]);
m_VorientFieldTextCtrl
=
new
wxCheckBox
(
m_PanelField
,
-
1
,
if
(
FieldId
<
FIELD1
)
m_FieldNameCtrl
->
Enable
(
FALSE
);
_
(
"Vertical"
)
);
else
m_FieldNameCtrl
->
Enable
(
TRUE
);
m_FieldTextCtrl
->
SetValue
(
m_FieldText
[
FieldId
]);
// display new text field
m_FieldTextCtrl
->
SetValue
(
m_FieldSize
[
FieldId
]);
// display new size field
LeftBoxSizer
->
Add
(
m_VorientFieldTextCtrl
,
0
,
wxGROW
|
wxALL
,
5
);
// Create the box for field name display or edition
m_FieldNameCtrl
=
new
WinEDA_EnterText
(
m_PanelField
,
_
(
"Field Name:"
),
m_FieldName
[
FieldId
],
LeftBoxSizer
,
wxSize
(
200
,
-
1
)
);
if
(
FieldId
<
FIELD1
)
m_FieldNameCtrl
->
Enable
(
FALSE
);
else
m_FieldNameCtrl
->
Enable
(
TRUE
);
// Create the box for text editing (text, size)
m_FieldTextCtrl
=
new
WinEDA_GraphicTextCtrl
(
m_PanelField
,
_
(
"Value:"
),
m_FieldText
[
FieldId
],
m_FieldSize
[
FieldId
],
g_UnitMetric
,
LeftBoxSizer
,
200
);
// Create the box for text editing (position)
m_FieldPositionCtrl
=
new
WinEDA_PositionCtrl
(
m_PanelField
,
_
(
"Pos"
),
m_FieldPosition
[
FieldId
],
g_UnitMetric
,
LeftBoxSizer
);
m_FieldHJustifyCtrl
=
new
wxRadioBox
(
m_PanelField
,
-
1
,
_
(
"Hor Justify"
),
wxDefaultPosition
,
wxDefaultSize
,
3
,
Hjustify_list
,
1
,
wxRA_SPECIFY_COLS
);
m_FieldHJustifyCtrl
->
SetSelection
(
1
);
MiddleBoxSizer
->
Add
(
m_FieldHJustifyCtrl
,
0
,
wxGROW
|
wxALL
,
5
);
m_FieldVJustifyCtrl
=
new
wxRadioBox
(
m_PanelField
,
-
1
,
_
(
"Vert Justify"
),
wxDefaultPosition
,
wxDefaultSize
,
3
,
Vjustify_list
,
1
,
wxRA_SPECIFY_COLS
);
m_FieldVJustifyCtrl
->
SetSelection
(
1
);
MiddleBoxSizer
->
Add
(
m_FieldVJustifyCtrl
,
0
,
wxGROW
|
wxALL
,
5
);
// Create the field list
wxString
fieldnamelist
[
NUMBER_OF_FIELDS
];
for
(
int
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
if
(
m_FieldName
[
ii
].
IsEmpty
()
)
fieldnamelist
[
ii
]
=
ReturnDefaultFieldName
(
ii
);
else
fieldnamelist
[
ii
]
=
m_FieldName
[
ii
];
}
m_FieldSelection
=
new
wxRadioBox
(
m_PanelField
,
ID_ON_SELECT_FIELD
,
_
(
"Field to edit"
),
wxDefaultPosition
,
wxDefaultSize
,
NUMBER_OF_FIELDS
,
fieldnamelist
,
2
,
wxRA_SPECIFY_COLS
);
PanelFieldBoxSizer
->
Add
(
m_FieldSelection
,
0
,
wxGROW
|
wxALL
,
5
);
CopyDataToPanelField
();
}
}
/****************************************************************/
void
WinEDA_PartPropertiesFrame
::
CopyDataToPanelField
()
/****************************************************************/
/* Set the values displayed on the panel field according to
* the current field number
*/
{
int
FieldId
=
m_CurrentFieldId
;
for
(
int
ii
=
FIELD1
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
if
(
!
m_FieldName
[
ii
].
IsEmpty
()
)
m_FieldSelection
->
SetString
(
ii
,
m_FieldName
[
ii
]
);
else
m_FieldSelection
->
SetString
(
ii
,
ReturnDefaultFieldName
(
ii
)
);
}
if
(
m_FieldFlags
[
FieldId
]
)
m_ShowFieldTextCtrl
->
SetValue
(
TRUE
);
else
m_ShowFieldTextCtrl
->
SetValue
(
FALSE
);
if
(
m_FieldOrient
[
FieldId
]
)
m_VorientFieldTextCtrl
->
SetValue
(
TRUE
);
else
m_VorientFieldTextCtrl
->
SetValue
(
FALSE
);
m_FieldHJustifyCtrl
->
SetSelection
(
m_FieldHJustify
[
FieldId
]
);
m_FieldVJustifyCtrl
->
SetSelection
(
m_FieldVJustify
[
FieldId
]
);
m_FieldPositionCtrl
->
SetValue
(
m_FieldPosition
[
FieldId
].
x
,
m_FieldPosition
[
FieldId
].
y
);
m_FieldNameCtrl
->
SetValue
(
m_FieldName
[
FieldId
]
);
if
(
FieldId
<
FIELD1
)
m_FieldNameCtrl
->
Enable
(
FALSE
);
else
m_FieldNameCtrl
->
Enable
(
TRUE
);
m_FieldTextCtrl
->
SetValue
(
m_FieldText
[
FieldId
]
);
// display new text field
m_FieldTextCtrl
->
SetValue
(
m_FieldSize
[
FieldId
]
);
// display new size field
}
/****************************************************************/
/****************************************************************/
void
WinEDA_PartPropertiesFrame
::
CopyPanelFieldToData
()
void
WinEDA_PartPropertiesFrame
::
CopyPanelFieldToData
()
/****************************************************************/
/****************************************************************/
/* Copy the values displayed on the panel field to the buffers according to
/* Copy the values displayed on the panel field to the buffers according to
the current field number
*
the current field number
*/
*/
{
{
int
id
=
m_CurrentFieldId
;
int
id
=
m_CurrentFieldId
;
m_FieldFlags
[
id
]
=
m_ShowFieldTextCtrl
->
GetValue
();
m_FieldFlags
[
id
]
=
m_ShowFieldTextCtrl
->
GetValue
();
m_FieldOrient
[
id
]
=
m_VorientFieldTextCtrl
->
GetValue
();
m_FieldOrient
[
id
]
=
m_VorientFieldTextCtrl
->
GetValue
();
m_FieldHJustify
[
id
]
=
m_FieldHJustifyCtrl
->
GetSelection
();
m_FieldHJustify
[
id
]
=
m_FieldHJustifyCtrl
->
GetSelection
();
m_FieldVJustify
[
id
]
=
m_FieldVJustifyCtrl
->
GetSelection
();
m_FieldVJustify
[
id
]
=
m_FieldVJustifyCtrl
->
GetSelection
();
m_FieldText
[
id
]
=
m_FieldTextCtrl
->
GetText
();
m_FieldText
[
id
]
=
m_FieldTextCtrl
->
GetText
();
m_FieldName
[
id
]
=
m_FieldNameCtrl
->
GetValue
();
m_FieldName
[
id
]
=
m_FieldNameCtrl
->
GetValue
();
m_FieldPosition
[
id
]
=
m_FieldPositionCtrl
->
GetValue
();
m_FieldPosition
[
id
]
=
m_FieldPositionCtrl
->
GetValue
();
m_FieldSize
[
id
]
=
m_FieldTextCtrl
->
GetTextSize
();
m_FieldSize
[
id
]
=
m_FieldTextCtrl
->
GetTextSize
();
}
}
/********************************************************************/
/********************************************************************/
void
WinEDA_PartPropertiesFrame
::
SelectNewField
(
wxCommandEvent
&
event
)
void
WinEDA_PartPropertiesFrame
::
SelectNewField
(
wxCommandEvent
&
event
)
/********************************************************************/
/********************************************************************/
/* called when changing the current field selected
/* called when changing the current field selected
Save the current field settings in buffer and display the new one
*
Save the current field settings in buffer and display the new one
*/
*/
{
{
CopyPanelFieldToData
();
CopyPanelFieldToData
();
m_CurrentFieldId
=
m_FieldSelection
->
GetSelection
();
m_CurrentFieldId
=
m_FieldSelection
->
GetSelection
();
CopyDataToPanelField
();
CopyDataToPanelField
();
}
}
/**************************************************************************/
/**************************************************************************/
void
WinEDA_PartPropertiesFrame
::
PartPropertiesAccept
(
wxCommandEvent
&
event
)
void
WinEDA_PartPropertiesFrame
::
PartPropertiesAccept
(
wxCommandEvent
&
event
)
/**************************************************************************/
/**************************************************************************/
/* Updaye the current component parameters
/* Updaye the current component parameters
*/
*/
{
{
int
ii
,
jj
;
int
ii
,
jj
;
if
(
CurrentLibEntry
==
NULL
)
if
(
CurrentLibEntry
==
NULL
)
{
{
Close
();
return
;
Close
();
return
;
}
}
m_Parent
->
m_CurrentScreen
->
SetModify
();
m_Parent
->
m_CurrentScreen
->
SetModify
();
m_Parent
->
SaveCopyInUndoList
(
CurrentLibEntry
);
m_Parent
->
SaveCopyInUndoList
(
CurrentLibEntry
);
CopyPanelFieldToData
();
CopyPanelFieldToData
();
/* A new name could be entered in VALUE field.
/* A new name could be entered in VALUE field.
Must not be an existing alias name in alias list box */
* Must not be an existing alias name in alias list box */
jj
=
m_PartAliasList
->
GetCount
();
jj
=
m_PartAliasList
->
GetCount
();
wxString
newvalue
=
m_FieldText
[
VALUE
];
wxString
newvalue
=
m_FieldText
[
VALUE
];
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
{
{
if
(
newvalue
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
).
GetData
())
==
0
)
if
(
newvalue
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
).
GetData
()
)
==
0
)
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
wxT
(
"Alias %s exists!"
),
newvalue
.
GetData
());
msg
.
Printf
(
wxT
(
"Alias %s exists!"
),
newvalue
.
GetData
()
);
DisplayError
(
this
,
msg
);
DisplayError
(
this
,
msg
);
return
;
return
;
}
}
}
}
/* Update the doc, keyword and doc filename strings */
/* Update the doc, keyword and doc filename strings */
if
(
m_AliasLocation
<
0
)
if
(
m_AliasLocation
<
0
)
{
{
CurrentLibEntry
->
m_Doc
=
m_Doc
->
GetValue
();
CurrentLibEntry
->
m_Doc
=
m_Doc
->
GetValue
();
CurrentLibEntry
->
m_KeyWord
=
m_Keywords
->
GetValue
();
CurrentLibEntry
->
m_KeyWord
=
m_Keywords
->
GetValue
();
CurrentLibEntry
->
m_DocFile
=
m_Docfile
->
GetValue
();
CurrentLibEntry
->
m_DocFile
=
m_Docfile
->
GetValue
();
}
}
else
else
{
{
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC
]
=
m_Doc
->
GetValue
();
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC
]
=
m_Doc
->
GetValue
();
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_KEYWORD
]
=
m_Keywords
->
GetValue
();
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_KEYWORD
]
=
m_Keywords
->
GetValue
();
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC_FILENAME
]
=
m_Docfile
->
GetValue
();
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC_FILENAME
]
=
m_Docfile
->
GetValue
();
}
}
/* Update the alias list */
/* Update the alias list */
/* 1 - Add names: test for a not existing name in old alias list: */
/* 1 - Add names: test for a not existing name in old alias list: */
jj
=
m_PartAliasList
->
GetCount
();
jj
=
m_PartAliasList
->
GetCount
();
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
{
{
if
(
LocateAlias
(
CurrentLibEntry
->
m_AliasList
,
m_PartAliasList
->
GetString
(
ii
)
)
<
0
)
if
(
LocateAlias
(
CurrentLibEntry
->
m_AliasList
,
m_PartAliasList
->
GetString
(
ii
))
<
0
)
{
// new alias must be created
{
// new alias must be created
CurrentLibEntry
->
m_AliasList
.
Add
(
m_PartAliasList
->
GetString
(
ii
)
);
CurrentLibEntry
->
m_AliasList
.
Add
(
m_PartAliasList
->
GetString
(
ii
));
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void doc string
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void doc string
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void keyword list string
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void keyword list string
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void doc filename string
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void doc filename string
}
}
}
}
/* 2 - Remove delete names: test for an non existing name in new alias list: */
/* 2 - Remove delete names: test for an non existing name in new alias list: */
int
kk
,
kkmax
=
CurrentLibEntry
->
m_AliasList
.
GetCount
();
int
kk
,
kkmax
=
CurrentLibEntry
->
m_AliasList
.
GetCount
();
for
(
kk
=
0
;
kk
<
kkmax
;
)
for
(
kk
=
0
;
kk
<
kkmax
;
)
{
{
jj
=
m_PartAliasList
->
GetCount
();
jj
=
m_PartAliasList
->
GetCount
();
wxString
aliasname
=
CurrentLibEntry
->
m_AliasList
[
kk
];
wxString
aliasname
=
CurrentLibEntry
->
m_AliasList
[
kk
];
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
{
{
if
(
aliasname
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
).
GetData
()
)
==
0
)
if
(
aliasname
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
).
GetData
())
==
0
)
{
{
kk
+=
ALIAS_NEXT
;
// Alias exist in new list. keep it and test next old name
kk
+=
ALIAS_NEXT
;
// Alias exist in new list. keep it and test next old name
break
;
break
;
}
}
}
}
if
(
ii
==
jj
)
// Alias not found in new list, remove it (4 strings in kk position)
if
(
ii
==
jj
)
// Alias not found in new list, remove it (4 strings in kk position)
{
{
for
(
ii
=
0
;
ii
<
ALIAS_NEXT
;
ii
++
)
for
(
ii
=
0
;
ii
<
ALIAS_NEXT
;
ii
++
)
CurrentLibEntry
->
m_AliasList
.
RemoveAt
(
kk
);
CurrentLibEntry
->
m_AliasList
.
RemoveAt
(
kk
);
kkmax
=
CurrentLibEntry
->
m_AliasList
.
GetCount
();
}
kkmax
=
CurrentLibEntry
->
m_AliasList
.
GetCount
();
}
}
}
// Void fields for REFERENCE and VALUE are not allowed
// Void fields for REFERENCE and VALUE are not allowed
if
(
m_FieldText
[
REFERENCE
].
IsEmpty
()
)
if
(
m_FieldText
[
REFERENCE
].
IsEmpty
()
)
{
{
m_FieldText
[
REFERENCE
]
=
CurrentLibEntry
->
m_Prefix
.
m_Text
;
m_FieldText
[
REFERENCE
]
=
CurrentLibEntry
->
m_Prefix
.
m_Text
;
}
}
if
(
m_FieldText
[
VALUE
].
IsEmpty
()
)
if
(
m_FieldText
[
VALUE
].
IsEmpty
()
)
{
{
m_FieldText
[
VALUE
]
=
CurrentLibEntry
->
m_Name
.
m_Text
;
m_FieldText
[
VALUE
]
=
CurrentLibEntry
->
m_Name
.
m_Text
;
}
}
else
else
{
{
if
(
CurrentLibEntry
->
m_Name
.
m_Text
!=
m_FieldText
[
VALUE
]
)
if
(
CurrentLibEntry
->
m_Name
.
m_Text
!=
m_FieldText
[
VALUE
]
)
m_RecreateToolbar
=
TRUE
;
m_RecreateToolbar
=
TRUE
;
}
}
CopyBufferToFieldData
(
&
CurrentLibEntry
->
m_Prefix
);
CopyBufferToFieldData
(
&
CurrentLibEntry
->
m_Prefix
);
CopyBufferToFieldData
(
&
CurrentLibEntry
->
m_Name
);
CopyBufferToFieldData
(
&
CurrentLibEntry
->
m_Name
);
for
(
ii
=
FOOTPRINT
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
for
(
ii
=
FOOTPRINT
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
{
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
LibDrawField
*
NextField
,
*
previousField
=
NULL
;
LibDrawField
*
NextField
,
*
previousField
=
NULL
;
while
(
Field
)
while
(
Field
)
{
{
NextField
=
(
LibDrawField
*
)
Field
->
Pnext
;
NextField
=
(
LibDrawField
*
)
Field
->
Pnext
;
if
(
Field
->
m_FieldId
==
ii
)
if
(
Field
->
m_FieldId
==
ii
)
{
{
CopyBufferToFieldData
(
Field
);
CopyBufferToFieldData
(
Field
);
// An old field exists; delete it if void
// An old field exists; delete it if void
if
(
Field
->
m_Text
.
IsEmpty
()
)
if
(
Field
->
m_Text
.
IsEmpty
()
)
{
{
if
(
ii
<
FIELD1
||
Field
->
m_Name
.
IsEmpty
()
)
if
(
ii
<
FIELD1
||
Field
->
m_Name
.
IsEmpty
()
)
{
{
delete
Field
;
delete
Field
;
if
(
previousField
)
previousField
->
Pnext
=
NextField
;
if
(
previousField
)
else
CurrentLibEntry
->
Fields
=
NextField
;
previousField
->
Pnext
=
NextField
;
}
else
}
CurrentLibEntry
->
Fields
=
NextField
;
break
;
}
}
}
break
;
previousField
=
Field
;
}
Field
=
NextField
;
}
previousField
=
Field
;
Field
=
NextField
;
if
(
Field
==
NULL
)
// Do not exists: must be created if not void
}
{
bool
create
=
FALSE
;
if
(
Field
==
NULL
)
// Do not exists: must be created if not void
if
(
!
m_FieldText
[
ii
].
IsEmpty
()
)
create
=
TRUE
;
{
if
(
!
m_FieldName
[
ii
].
IsEmpty
()
&&
(
m_FieldName
[
ii
]
!=
ReturnDefaultFieldName
(
ii
))
)
bool
create
=
FALSE
;
create
=
TRUE
;
if
(
!
m_FieldText
[
ii
].
IsEmpty
()
)
if
(
create
)
create
=
TRUE
;
{
if
(
!
m_FieldName
[
ii
].
IsEmpty
()
&&
(
m_FieldName
[
ii
]
!=
ReturnDefaultFieldName
(
ii
)
)
)
Field
=
new
LibDrawField
(
ii
);
create
=
TRUE
;
CopyBufferToFieldData
(
Field
);
if
(
create
)
Field
->
Pnext
=
CurrentLibEntry
->
Fields
;
{
CurrentLibEntry
->
Fields
=
Field
;
Field
=
new
LibDrawField
(
ii
);
}
}
CopyBufferToFieldData
(
Field
);
}
Field
->
Pnext
=
CurrentLibEntry
->
Fields
;
CurrentLibEntry
->
Fields
=
Field
;
/* for a user field (FieldId >= FIELD1), if a field value is void,
}
fill it with "~" because for a library componenta void field is not a very good idea
}
(we do not see anything...) and in schematic this text is like a void text */
}
{
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
/* for a user field (FieldId >= FIELD1), if a field value is void,
while
(
Field
)
* fill it with "~" because for a library componenta void field is not a very good idea
{
* (we do not see anything...) and in schematic this text is like a void text */
if
(
Field
->
m_FieldId
>=
FIELD1
)
{
if
(
Field
->
m_Text
.
IsEmpty
()
)
Field
->
m_Text
=
wxT
(
"~"
);
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
Field
=
(
LibDrawField
*
)
Field
->
Pnext
;
while
(
Field
)
}
{
}
if
(
Field
->
m_FieldId
>=
FIELD1
)
if
(
Field
->
m_Text
.
IsEmpty
()
)
ii
=
SelNumberOfUnits
->
GetValue
();
Field
->
m_Text
=
wxT
(
"~"
);
if
(
ChangeNbUnitsPerPackage
(
ii
)
)
Field
=
(
LibDrawField
*
)
Field
->
Pnext
;
m_RecreateToolbar
=
TRUE
;
}
}
if
(
AsConvertButt
->
GetValue
()
)
{
ii
=
SelNumberOfUnits
->
GetValue
();
if
(
!
g_AsDeMorgan
)
if
(
ChangeNbUnitsPerPackage
(
ii
)
)
{
m_RecreateToolbar
=
TRUE
;
g_AsDeMorgan
=
1
;
if
(
SetUnsetConvert
()
)
m_RecreateToolbar
=
TRUE
;
if
(
AsConvertButt
->
GetValue
()
)
}
{
}
if
(
!
g_AsDeMorgan
)
else
{
{
g_AsDeMorgan
=
1
;
if
(
g_AsDeMorgan
)
if
(
SetUnsetConvert
()
)
{
m_RecreateToolbar
=
TRUE
;
g_AsDeMorgan
=
0
;
}
if
(
SetUnsetConvert
()
)
m_RecreateToolbar
=
TRUE
;
}
}
else
}
{
if
(
g_AsDeMorgan
)
CurrentLibEntry
->
m_DrawPinNum
=
ShowPinNumButt
->
GetValue
()
?
1
:
0
;
{
CurrentLibEntry
->
m_DrawPinName
=
ShowPinNameButt
->
GetValue
()
?
1
:
0
;
g_AsDeMorgan
=
0
;
if
(
SetUnsetConvert
()
)
if
(
m_PinsNameInsideButt
->
GetValue
()
==
FALSE
)
m_RecreateToolbar
=
TRUE
;
CurrentLibEntry
->
m_TextInside
=
0
;
}
else
}
CurrentLibEntry
->
m_TextInside
=
m_SetSkew
->
GetValue
();
CurrentLibEntry
->
m_DrawPinNum
=
ShowPinNumButt
->
GetValue
()
?
1
:
0
;
if
(
m_OptionPower
->
GetValue
()
==
TRUE
)
CurrentLibEntry
->
m_DrawPinName
=
ShowPinNameButt
->
GetValue
()
?
1
:
0
;
CurrentLibEntry
->
m_Options
=
ENTRY_POWER
;
else
if
(
m_PinsNameInsideButt
->
GetValue
()
==
FALSE
)
CurrentLibEntry
->
m_Options
=
ENTRY_NORMAL
;
CurrentLibEntry
->
m_TextInside
=
0
;
else
/* Set the option "Units locked".
CurrentLibEntry
->
m_TextInside
=
m_SetSkew
->
GetValue
();
Obviously, cannot be TRUE if there is only one part */
CurrentLibEntry
->
m_UnitSelectionLocked
=
m_OptionPartsLocked
->
GetValue
();
if
(
m_OptionPower
->
GetValue
()
==
TRUE
)
if
(
CurrentLibEntry
->
m_UnitCount
<=
1
)
CurrentLibEntry
->
m_Options
=
ENTRY_POWER
;
CurrentLibEntry
->
m_UnitSelectionLocked
=
FALSE
;
else
CurrentLibEntry
->
m_Options
=
ENTRY_NORMAL
;
if
(
m_RecreateToolbar
)
m_Parent
->
ReCreateHToolbar
();
/* Set the option "Units locked".
m_Parent
->
DisplayLibInfos
();
* Obviously, cannot be TRUE if there is only one part */
CurrentLibEntry
->
m_UnitSelectionLocked
=
m_OptionPartsLocked
->
GetValue
();
/* Update the footprint filter list */
if
(
CurrentLibEntry
->
m_UnitCount
<=
1
)
CurrentLibEntry
->
m_FootprintList
.
Clear
();
CurrentLibEntry
->
m_UnitSelectionLocked
=
FALSE
;
jj
=
m_FootprintFilterListBox
->
GetCount
();
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
if
(
m_RecreateToolbar
)
CurrentLibEntry
->
m_FootprintList
.
Add
(
m_FootprintFilterListBox
->
GetString
(
ii
));
m_Parent
->
ReCreateHToolbar
();
EndModal
(
1
);
m_Parent
->
DisplayLibInfos
();
/* Update the footprint filter list */
CurrentLibEntry
->
m_FootprintList
.
Clear
();
jj
=
m_FootprintFilterListBox
->
GetCount
();
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
CurrentLibEntry
->
m_FootprintList
.
Add
(
m_FootprintFilterListBox
->
GetString
(
ii
)
);
EndModal
(
1
);
}
}
/*******************************************************************************/
/*******************************************************************************/
void
WinEDA_PartPropertiesFrame
::
CopyDocToAlias
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
void
WinEDA_PartPropertiesFrame
::
CopyDocToAlias
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
/******************************************************************************/
/******************************************************************************/
{
{
if
(
CurrentLibEntry
==
NULL
)
return
;
if
(
CurrentLibEntry
==
NULL
)
if
(
CurrentAliasName
.
IsEmpty
()
)
return
;
return
;
if
(
CurrentAliasName
.
IsEmpty
()
)
m_Doc
->
SetValue
(
CurrentLibEntry
->
m_Doc
);
return
;
m_Docfile
->
SetValue
(
CurrentLibEntry
->
m_DocFile
);
m_Keywords
->
SetValue
(
CurrentLibEntry
->
m_KeyWord
);
m_Doc
->
SetValue
(
CurrentLibEntry
->
m_Doc
);
m_Docfile
->
SetValue
(
CurrentLibEntry
->
m_DocFile
);
m_Keywords
->
SetValue
(
CurrentLibEntry
->
m_KeyWord
);
}
}
/**********************************************************/
/**********************************************************/
void
WinEDA_PartPropertiesFrame
::
DeleteAllAliasOfPart
(
void
WinEDA_PartPropertiesFrame
::
DeleteAllAliasOfPart
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
wxCommandEvent
&
WXUNUSED
(
event
)
)
/**********************************************************/
/**********************************************************/
{
{
CurrentAliasName
.
Empty
();
CurrentAliasName
.
Empty
();
if
(
CurrentLibEntry
)
if
(
CurrentLibEntry
)
{
{
if
(
IsOK
(
this
,
_
(
"Ok to Delete Alias LIST"
)
)
)
if
(
IsOK
(
this
,
_
(
"Ok to Delete Alias LIST"
)
)
)
{
{
m_PartAliasList
->
Clear
();
m_PartAliasList
->
Clear
();
m_RecreateToolbar
=
TRUE
;
m_RecreateToolbar
=
TRUE
;
m_ButtonDeleteAllAlias
->
Enable
(
FALSE
);
m_ButtonDeleteAllAlias
->
Enable
(
FALSE
);
m_ButtonDeleteOneAlias
->
Enable
(
FALSE
);
m_ButtonDeleteOneAlias
->
Enable
(
FALSE
);
}
}
}
}
}
}
/*******************************************************************************/
/*******************************************************************************/
void
WinEDA_PartPropertiesFrame
::
AddAliasOfPart
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
void
WinEDA_PartPropertiesFrame
::
AddAliasOfPart
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
/*******************************************************************************/
/*******************************************************************************/
/* Add a new name to the alias list box
/* Add a new name to the alias list box
New name cannot be the root name, and must not exists
*
New name cannot be the root name, and must not exists
*/
*/
{
{
wxString
Line
;
wxString
Line
;
wxString
aliasname
;
wxString
aliasname
;
if
(
CurrentLibEntry
==
NULL
)
return
;
if
(
CurrentLibEntry
==
NULL
)
return
;
if
(
Get_Message
(
_
(
"New alias:"
),
Line
,
this
)
!=
0
)
return
;
if
(
Get_Message
(
_
(
"New alias:"
),
Line
,
this
)
!=
0
)
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
return
;
aliasname
=
Line
;
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
if
(
CurrentLibEntry
->
m_Name
.
m_Text
.
CmpNoCase
(
Line
)
==
0
)
aliasname
=
Line
;
{
DisplayError
(
this
,
_
(
"This is the Root Part"
),
10
);
return
;
if
(
CurrentLibEntry
->
m_Name
.
m_Text
.
CmpNoCase
(
Line
)
==
0
)
}
{
DisplayError
(
this
,
_
(
"This is the Root Part"
),
10
);
return
;
/* test for an existing name: */
}
int
ii
,
jj
=
m_PartAliasList
->
GetCount
();
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
/* test for an existing name: */
{
int
ii
,
jj
=
m_PartAliasList
->
GetCount
();
if
(
aliasname
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
))
==
0
)
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
{
{
DisplayError
(
this
,
_
(
"Already in use"
),
10
);
if
(
aliasname
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
)
)
==
0
)
return
;
{
}
DisplayError
(
this
,
_
(
"Already in use"
),
10
);
}
return
;
}
m_PartAliasList
->
Append
(
aliasname
);
}
if
(
CurrentAliasName
.
IsEmpty
()
)
m_ButtonDeleteAllAlias
->
Enable
(
TRUE
);
m_ButtonDeleteOneAlias
->
Enable
(
TRUE
);
m_PartAliasList
->
Append
(
aliasname
);
if
(
CurrentAliasName
.
IsEmpty
()
)
m_RecreateToolbar
=
TRUE
;
m_ButtonDeleteAllAlias
->
Enable
(
TRUE
);
m_ButtonDeleteOneAlias
->
Enable
(
TRUE
);
m_RecreateToolbar
=
TRUE
;
}
}
/********************************************************/
/********************************************************/
void
WinEDA_PartPropertiesFrame
::
DeleteAliasOfPart
(
void
WinEDA_PartPropertiesFrame
::
DeleteAliasOfPart
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
wxCommandEvent
&
WXUNUSED
(
event
)
)
/********************************************************/
/********************************************************/
{
{
wxString
aliasname
=
m_PartAliasList
->
GetStringSelection
();
wxString
aliasname
=
m_PartAliasList
->
GetStringSelection
();
if
(
aliasname
.
IsEmpty
()
)
return
;
if
(
aliasname
.
IsEmpty
()
)
if
(
aliasname
==
CurrentAliasName
)
return
;
{
if
(
aliasname
==
CurrentAliasName
)
wxString
msg
=
CurrentAliasName
+
_
(
" is Current Selected Alias!"
);
{
DisplayError
(
this
,
msg
);
wxString
msg
=
CurrentAliasName
+
_
(
" is Current Selected Alias!"
);
return
;
DisplayError
(
this
,
msg
);
}
return
;
}
int
ii
=
m_PartAliasList
->
GetSelection
();
m_PartAliasList
->
Delete
(
ii
);
int
ii
=
m_PartAliasList
->
GetSelection
();
m_PartAliasList
->
Delete
(
ii
);
if
(
!
CurrentLibEntry
||
(
CurrentLibEntry
->
m_AliasList
.
GetCount
()
==
0
)
)
{
if
(
!
CurrentLibEntry
||
(
CurrentLibEntry
->
m_AliasList
.
GetCount
()
==
0
)
)
m_ButtonDeleteAllAlias
->
Enable
(
FALSE
);
{
m_ButtonDeleteOneAlias
->
Enable
(
FALSE
);
m_ButtonDeleteAllAlias
->
Enable
(
FALSE
);
}
m_ButtonDeleteOneAlias
->
Enable
(
FALSE
);
m_RecreateToolbar
=
TRUE
;
}
m_RecreateToolbar
=
TRUE
;
}
}
/********************************************************************/
/********************************************************************/
bool
WinEDA_PartPropertiesFrame
::
ChangeNbUnitsPerPackage
(
int
MaxUnit
)
bool
WinEDA_PartPropertiesFrame
::
ChangeNbUnitsPerPackage
(
int
MaxUnit
)
/********************************************************************/
/********************************************************************/
/* Routine de modification du nombre d'unites par package pour le
/* Routine de modification du nombre d'unites par package pour le
composant courant;
*
composant courant;
*/
*/
{
{
int
OldNumUnits
,
ii
,
FlagDel
=
-
1
;
int
OldNumUnits
,
ii
,
FlagDel
=
-
1
;
LibEDA_BaseStruct
*
DrawItem
,
*
NextDrawItem
;
LibEDA_BaseStruct
*
DrawItem
,
*
NextDrawItem
;
if
(
CurrentLibEntry
==
NULL
)
return
FALSE
;
if
(
CurrentLibEntry
==
NULL
)
return
FALSE
;
/* Si pas de changement: termine */
if
(
CurrentLibEntry
->
m_UnitCount
==
MaxUnit
)
return
FALSE
;
/* Si pas de changement: termine */
if
(
CurrentLibEntry
->
m_UnitCount
==
MaxUnit
)
OldNumUnits
=
CurrentLibEntry
->
m_UnitCount
;
return
FALSE
;
if
(
OldNumUnits
<
1
)
OldNumUnits
=
1
;
OldNumUnits
=
CurrentLibEntry
->
m_UnitCount
;
CurrentLibEntry
->
m_UnitCount
=
MaxUnit
;
if
(
OldNumUnits
<
1
)
OldNumUnits
=
1
;
/* Traitement des unites enlevees ou rajoutees */
CurrentLibEntry
->
m_UnitCount
=
MaxUnit
;
if
(
OldNumUnits
>
CurrentLibEntry
->
m_UnitCount
)
{
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
/* Traitement des unites enlevees ou rajoutees */
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
NextDrawItem
)
if
(
OldNumUnits
>
CurrentLibEntry
->
m_UnitCount
)
{
{
NextDrawItem
=
DrawItem
->
Next
();
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
if
(
DrawItem
->
m_Unit
>
MaxUnit
)
/* Item a effacer */
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
NextDrawItem
)
{
{
if
(
FlagDel
<
0
)
NextDrawItem
=
DrawItem
->
Next
();
{
if
(
DrawItem
->
m_Unit
>
MaxUnit
)
/* Item a effacer */
if
(
IsOK
(
this
,
_
(
"Delete units"
)
)
)
{
{
if
(
FlagDel
<
0
)
/* Si part selectee n'existe plus: selection 1ere unit */
{
if
(
CurrentUnit
>
MaxUnit
)
CurrentUnit
=
1
;
if
(
IsOK
(
this
,
_
(
"Delete units"
)
)
)
FlagDel
=
1
;
{
}
/* Si part selectee n'existe plus: selection 1ere unit */
else
if
(
CurrentUnit
>
MaxUnit
)
{
CurrentUnit
=
1
;
FlagDel
=
0
;
FlagDel
=
1
;
MaxUnit
=
OldNumUnits
;
}
CurrentLibEntry
->
m_UnitCount
=
MaxUnit
;
else
return
FALSE
;
{
}
FlagDel
=
0
;
}
MaxUnit
=
OldNumUnits
;
DeleteOneLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
NULL
,
CurrentLibEntry
,
CurrentLibEntry
->
m_UnitCount
=
MaxUnit
;
DrawItem
,
0
);
return
FALSE
;
}
}
}
}
return
TRUE
;
DeleteOneLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
NULL
,
CurrentLibEntry
,
}
DrawItem
,
0
);
}
if
(
OldNumUnits
<
CurrentLibEntry
->
m_UnitCount
)
}
{
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
return
TRUE
;
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Next
()
)
}
{
/* Duplication des items pour autres elements */
if
(
OldNumUnits
<
CurrentLibEntry
->
m_UnitCount
)
if
(
DrawItem
->
m_Unit
==
1
)
{
{
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
for
(
ii
=
OldNumUnits
+
1
;
ii
<=
MaxUnit
;
ii
++
)
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Next
()
)
{
{
NextDrawItem
=
CopyDrawEntryStruct
(
this
,
DrawItem
);
/* Duplication des items pour autres elements */
NextDrawItem
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
if
(
DrawItem
->
m_Unit
==
1
)
CurrentLibEntry
->
m_Drawings
=
NextDrawItem
;
{
NextDrawItem
->
m_Unit
=
ii
;
for
(
ii
=
OldNumUnits
+
1
;
ii
<=
MaxUnit
;
ii
++
)
}
{
}
NextDrawItem
=
CopyDrawEntryStruct
(
this
,
DrawItem
);
}
NextDrawItem
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
}
CurrentLibEntry
->
m_Drawings
=
NextDrawItem
;
return
TRUE
;
NextDrawItem
->
m_Unit
=
ii
;
}
}
}
}
return
TRUE
;
}
}
/*****************************************************/
/*****************************************************/
bool
WinEDA_PartPropertiesFrame
::
SetUnsetConvert
()
bool
WinEDA_PartPropertiesFrame
::
SetUnsetConvert
()
/*****************************************************/
/*****************************************************/
/* cre ou efface (selon option AsConvert) les lments
/* cre ou efface (selon option AsConvert) les lments
de la reprsentation convertie d'un composant
*
de la reprsentation convertie d'un composant
*/
*/
{
{
int
FlagDel
=
0
;
int
FlagDel
=
0
;
LibEDA_BaseStruct
*
DrawItem
=
NULL
,
*
NextDrawItem
;
LibEDA_BaseStruct
*
DrawItem
=
NULL
,
*
NextDrawItem
;
if
(
g_AsDeMorgan
)
/* Representation convertie a creer */
if
(
g_AsDeMorgan
)
/* Representation convertie a creer */
{
{
/* Traitement des elements a ajouter ( pins seulement ) */
/* Traitement des elements a ajouter ( pins seulement ) */
if
(
CurrentLibEntry
)
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
if
(
CurrentLibEntry
)
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Next
()
)
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
{
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Next
()
)
/* Duplication des items pour autres elements */
{
if
(
DrawItem
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
continue
;
/* Duplication des items pour autres elements */
if
(
DrawItem
->
m_Convert
==
1
)
if
(
DrawItem
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
{
continue
;
if
(
FlagDel
==
0
)
if
(
DrawItem
->
m_Convert
==
1
)
{
{
if
(
IsOK
(
this
,
_
(
"Create pins for Convert items"
))
)
if
(
FlagDel
==
0
)
FlagDel
=
1
;
{
else
if
(
IsOK
(
this
,
_
(
"Create pins for Convert items"
)
)
)
{
FlagDel
=
1
;
if
(
IsOK
(
this
,
_
(
"Part as
\"
De Morgan
\"
anymore"
))
)
else
return
TRUE
;
{
if
(
IsOK
(
this
,
_
(
"Part as
\"
De Morgan
\"
anymore"
)
)
)
g_AsDeMorgan
=
0
;
return
FALSE
;
return
TRUE
;
}
}
g_AsDeMorgan
=
0
;
return
FALSE
;
NextDrawItem
=
CopyDrawEntryStruct
(
this
,
DrawItem
);
}
NextDrawItem
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
}
CurrentLibEntry
->
m_Drawings
=
NextDrawItem
;
NextDrawItem
=
CopyDrawEntryStruct
(
this
,
DrawItem
);
NextDrawItem
->
m_Convert
=
2
;
NextDrawItem
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
}
CurrentLibEntry
->
m_Drawings
=
NextDrawItem
;
}
NextDrawItem
->
m_Convert
=
2
;
}
}
}
else
/* Representation convertie a supprimer */
}
{
else
/* Representation convertie a supprimer */
/* Traitement des elements supprimer */
{
if
(
CurrentLibEntry
)
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
/* Traitement des elements supprimer */
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
NextDrawItem
)
if
(
CurrentLibEntry
)
{
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
NextDrawItem
=
DrawItem
->
Next
();
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
NextDrawItem
)
if
(
DrawItem
->
m_Convert
>
1
)
/* Item a effacer */
{
{
NextDrawItem
=
DrawItem
->
Next
();
if
(
FlagDel
==
0
)
if
(
DrawItem
->
m_Convert
>
1
)
/* Item a effacer */
{
{
if
(
IsOK
(
this
,
_
(
"Delete Convert items"
)
)
)
if
(
FlagDel
==
0
)
{
{
CurrentConvert
=
1
;
if
(
IsOK
(
this
,
_
(
"Delete Convert items"
)
)
)
FlagDel
=
1
;
{
}
CurrentConvert
=
1
;
else
FlagDel
=
1
;
{
}
g_AsDeMorgan
=
1
;
else
return
FALSE
;
{
}
g_AsDeMorgan
=
1
;
}
return
FALSE
;
m_Parent
->
GetScreen
()
->
SetModify
();
}
DeleteOneLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
NULL
,
CurrentLibEntry
,
DrawItem
,
0
);
}
}
m_Parent
->
GetScreen
()
->
SetModify
();
}
DeleteOneLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
}
NULL
,
return
TRUE
;
CurrentLibEntry
,
DrawItem
,
0
);
}
}
}
return
TRUE
;
}
}
/****************************************************************************/
/****************************************************************************/
void
WinEDA_PartPropertiesFrame
::
BrowseAndSelectDocFile
(
wxCommandEvent
&
event
)
void
WinEDA_PartPropertiesFrame
::
BrowseAndSelectDocFile
(
wxCommandEvent
&
event
)
/****************************************************************************/
/****************************************************************************/
{
{
wxString
FullFileName
,
mask
;
wxString
FullFileName
,
mask
;
wxString
docpath
(
g_RealLibDirBuffer
),
filename
;
wxString
docpath
(
g_RealLibDirBuffer
),
filename
;
docpath
+=
wxT
(
"doc"
);
docpath
+=
STRING_DIR_SEP
;
docpath
+=
wxT
(
"doc"
);
mask
=
wxT
(
"*"
);
docpath
+=
STRING_DIR_SEP
;
FullFileName
=
EDA_FileSelector
(
_
(
"Doc Files"
),
mask
=
wxT
(
"*"
);
docpath
,
/* Chemin par defaut */
FullFileName
=
EDA_FileSelector
(
_
(
"Doc Files"
),
wxEmptyString
,
/* nom fichier par defaut */
docpath
,
/* Chemin par defaut */
wxEmptyString
,
/* extension par defaut */
wxEmptyString
,
/* nom fichier par defaut */
mask
,
/* Masque d'affichage */
wxEmptyString
,
/* extension par defaut */
this
,
mask
,
/* Masque d'affichage */
wxFD_OPEN
,
this
,
TRUE
wxFD_OPEN
,
);
TRUE
if
(
FullFileName
.
IsEmpty
()
)
return
;
);
if
(
FullFileName
.
IsEmpty
()
)
// Suppression du chemin par defaut pour le fichier de doc:
return
;
filename
=
MakeReducedFileName
(
FullFileName
,
docpath
,
wxEmptyString
);
m_Docfile
->
SetValue
(
filename
);
// Suppression du chemin par defaut pour le fichier de doc:
filename
=
MakeReducedFileName
(
FullFileName
,
docpath
,
wxEmptyString
);
m_Docfile
->
SetValue
(
filename
);
}
}
/**********************************************************/
/**********************************************************/
void
WinEDA_PartPropertiesFrame
::
DeleteAllFootprintFilter
(
void
WinEDA_PartPropertiesFrame
::
DeleteAllFootprintFilter
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
wxCommandEvent
&
WXUNUSED
(
event
)
)
/**********************************************************/
/**********************************************************/
{
{
if
(
IsOK
(
this
,
_
(
"Ok to Delete FootprintFilter LIST"
)
)
)
if
(
IsOK
(
this
,
_
(
"Ok to Delete FootprintFilter LIST"
)
)
)
{
{
m_FootprintFilterListBox
->
Clear
();
m_FootprintFilterListBox
->
Clear
();
m_ButtonDeleteAllFootprintFilter
->
Enable
(
FALSE
);
m_ButtonDeleteAllFootprintFilter
->
Enable
(
FALSE
);
m_ButtonDeleteOneFootprintFilter
->
Enable
(
FALSE
);
m_ButtonDeleteOneFootprintFilter
->
Enable
(
FALSE
);
}
}
}
}
/*******************************************************************************/
/*******************************************************************************/
void
WinEDA_PartPropertiesFrame
::
AddFootprintFilter
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
void
WinEDA_PartPropertiesFrame
::
AddFootprintFilter
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
/*******************************************************************************/
/*******************************************************************************/
/* Add a new name to the alias list box
/* Add a new name to the alias list box
New name cannot be the root name, and must not exists
*
New name cannot be the root name, and must not exists
*/
*/
{
{
wxString
Line
;
wxString
Line
;
if
(
CurrentLibEntry
==
NULL
)
return
;
if
(
CurrentLibEntry
==
NULL
)
return
;
if
(
Get_Message
(
_
(
"New FootprintFilter:"
),
Line
,
this
)
!=
0
)
return
;
if
(
Get_Message
(
_
(
"New FootprintFilter:"
),
Line
,
this
)
!=
0
)
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
return
;
/* test for an existing name: */
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
int
ii
,
jj
=
m_FootprintFilterListBox
->
GetCount
();
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
/* test for an existing name: */
{
int
ii
,
jj
=
m_FootprintFilterListBox
->
GetCount
();
if
(
Line
.
CmpNoCase
(
m_FootprintFilterListBox
->
GetString
(
ii
))
==
0
)
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
{
{
DisplayError
(
this
,
_
(
"Already in use"
),
10
);
if
(
Line
.
CmpNoCase
(
m_FootprintFilterListBox
->
GetString
(
ii
)
)
==
0
)
return
;
{
}
DisplayError
(
this
,
_
(
"Already in use"
),
10
);
}
return
;
}
m_FootprintFilterListBox
->
Append
(
Line
);
}
m_ButtonDeleteAllFootprintFilter
->
Enable
(
TRUE
);
m_ButtonDeleteOneFootprintFilter
->
Enable
(
TRUE
);
m_FootprintFilterListBox
->
Append
(
Line
);
m_ButtonDeleteAllFootprintFilter
->
Enable
(
TRUE
);
m_ButtonDeleteOneFootprintFilter
->
Enable
(
TRUE
);
}
}
/********************************************************/
/********************************************************/
void
WinEDA_PartPropertiesFrame
::
DeleteOneFootprintFilter
(
void
WinEDA_PartPropertiesFrame
::
DeleteOneFootprintFilter
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
wxCommandEvent
&
WXUNUSED
(
event
)
)
/********************************************************/
/********************************************************/
{
{
int
ii
=
m_FootprintFilterListBox
->
GetSelection
();
int
ii
=
m_FootprintFilterListBox
->
GetSelection
();
m_FootprintFilterListBox
->
Delete
(
ii
);
if
(
!
CurrentLibEntry
||
(
m_FootprintFilterListBox
->
GetCount
()
==
0
)
)
{
m_ButtonDeleteAllFootprintFilter
->
Enable
(
FALSE
);
m_ButtonDeleteOneFootprintFilter
->
Enable
(
FALSE
);
}
}
m_FootprintFilterListBox
->
Delete
(
ii
);
if
(
!
CurrentLibEntry
||
(
m_FootprintFilterListBox
->
GetCount
()
==
0
)
)
{
m_ButtonDeleteAllFootprintFilter
->
Enable
(
FALSE
);
m_ButtonDeleteOneFootprintFilter
->
Enable
(
FALSE
);
}
}
eeschema/erc.cpp
View file @
664a1f72
/**************************************************/
/**************************************************/
/* Module de tst "ERC" ( Electrical Rules Check ) */
/* Module de tst "ERC" ( Electrical Rules Check ) */
/**************************************************/
/**************************************************/
#include "fctsys.h"
#include "fctsys.h"
...
@@ -20,9 +20,9 @@
...
@@ -20,9 +20,9 @@
#include "dialog_erc.h"
#include "dialog_erc.h"
/* On teste
/* On teste
1 - conflits entre pins connectees ( ex: 2 sorties connectees )
*
1 - conflits entre pins connectees ( ex: 2 sorties connectees )
2 - les imperatifs minimaux ( 1 entree doit etre connectee a une sortie )
*
2 - les imperatifs minimaux ( 1 entree doit etre connectee a une sortie )
*/
*/
/* fonctions exportees */
/* fonctions exportees */
...
@@ -30,778 +30,835 @@
...
@@ -30,778 +30,835 @@
/* fonctions importees */
/* fonctions importees */
/* fonctions locales */
/* fonctions locales */
static
bool
WriteDiagnosticERC
(
const
wxString
&
FullFileName
);
static
bool
WriteDiagnosticERC
(
const
wxString
&
FullFileName
);
static
void
Diagnose
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
static
void
Diagnose
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
NetItemTst
,
int
MinConnexion
,
int
Diag
);
ObjetNetListStruct
*
NetItemTst
,
int
MinConnexion
,
int
Diag
);
static
void
TestOthersItems
(
WinEDA_DrawPanel
*
panel
,
static
void
TestOthersItems
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
ObjetNetListStruct
*
NetItemRef
,
wxDC
*
DC
,
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
NetStart
,
ObjetNetListStruct
*
NetStart
,
int
*
NetNbItems
,
int
*
MinConnexion
);
int
*
NetNbItems
,
int
*
MinConnexion
);
static
void
TestLabel
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
static
void
TestLabel
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
StartNet
);
ObjetNetListStruct
*
StartNet
);
/* Variable locales */
/* Variable locales */
int
WriteFichierERC
=
FALSE
;
int
WriteFichierERC
=
FALSE
;
/* Tableau des types de conflit :
/* Tableau des types de conflit :
PIN_INPUT, PIN_OUTPUT, PIN_BIDI, PIN_TRISTATE, PIN_PASSIVE,
*
PIN_INPUT, PIN_OUTPUT, PIN_BIDI, PIN_TRISTATE, PIN_PASSIVE,
PIN_UNSPECIFIED, PIN_POWER_IN, PIN_POWER_OUT, PIN_OPENCOLLECTOR,
*
PIN_UNSPECIFIED, PIN_POWER_IN, PIN_POWER_OUT, PIN_OPENCOLLECTOR,
PIN_OPENEMITTER, PIN_NC
*
PIN_OPENEMITTER, PIN_NC
*/
*/
#define OK 0
#define OK
0
#define WAR 1
// utilis aussi dans eeredraw
#define WAR 1
// utilis aussi dans eeredraw
#define ERR 2
#define ERR 2
#define UNC 3
#define UNC 3
static
wxChar
*
CommentERC_H
[]
=
static
const
wxChar
*
CommentERC_H
[]
=
{
{
wxT
(
"Input Pin...."
),
wxT
(
"Input Pin...."
),
wxT
(
"Output Pin..."
),
wxT
(
"Output Pin..."
),
wxT
(
"BiDi Pin....."
),
wxT
(
"BiDi Pin....."
),
wxT
(
"3 State Pin.."
),
wxT
(
"3 State Pin.."
),
wxT
(
"Passive Pin.."
),
wxT
(
"Passive Pin.."
),
wxT
(
"Unspec Pin..."
),
wxT
(
"Unspec Pin..."
),
wxT
(
"Power IN Pin."
),
wxT
(
"Power IN Pin."
),
wxT
(
"PowerOUT Pin."
),
wxT
(
"PowerOUT Pin."
),
wxT
(
"Open Coll...."
),
wxT
(
"Open Coll...."
),
wxT
(
"Open Emit...."
),
wxT
(
"Open Emit...."
),
wxT
(
"No Conn......"
),
wxT
(
"No Conn......"
),
NULL
NULL
};
};
static
wxChar
*
CommentERC_V
[]
=
static
const
wxChar
*
CommentERC_V
[]
=
{
{
wxT
(
"Input Pin"
),
wxT
(
"Input Pin"
),
wxT
(
"Output Pin"
),
wxT
(
"Output Pin"
),
wxT
(
"BiDi Pin"
),
wxT
(
"BiDi Pin"
),
wxT
(
"3 State Pin"
),
wxT
(
"3 State Pin"
),
wxT
(
"Passive Pin"
),
wxT
(
"Passive Pin"
),
wxT
(
"Unspec Pin"
),
wxT
(
"Unspec Pin"
),
wxT
(
"Power IN Pin"
),
wxT
(
"Power IN Pin"
),
wxT
(
"PowerOUT Pin"
),
wxT
(
"PowerOUT Pin"
),
wxT
(
"Open Coll"
),
wxT
(
"Open Coll"
),
wxT
(
"Open Emit"
),
wxT
(
"Open Emit"
),
wxT
(
"No Conn"
),
wxT
(
"No Conn"
),
NULL
NULL
};
};
/* Look up table which gives the diag for a pair of connected pins
/* Look up table which gives the diag for a pair of connected pins
Can be modified by ERC options.
*
Can be modified by ERC options.
at start up: must be loaded by DefaultDiagErc
*
at start up: must be loaded by DefaultDiagErc
*/
*/
static
int
DiagErc
[
PIN_NMAX
][
PIN_NMAX
];
static
int
DiagErc
[
PIN_NMAX
][
PIN_NMAX
];
bool
DiagErcTableInit
;
// go to TRUE after DiagErc init
bool
DiagErcTableInit
;
// go to TRUE after DiagErc init
/* Default Look up table which gives the diag for a pair of connected pins
/* Default Look up table which gives the diag for a pair of connected pins
Same as DiagErc, but cannot be modified
*
Same as DiagErc, but cannot be modified
Used to init or reset DiagErc
*
Used to init or reset DiagErc
*/
*/
static
int
DefaultDiagErc
[
PIN_NMAX
][
PIN_NMAX
]
=
static
int
DefaultDiagErc
[
PIN_NMAX
][
PIN_NMAX
]
=
{
/* I, O, Bi, 3S, Pas, UnS,PwrI,PwrO, OC, OE, NC */
{
/* I, O, Bi, 3S, Pas, UnS,PwrI,PwrO, OC, OE, NC */
/* I */
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
WAR
},
/* I */
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
WAR
},
/* O */
{
OK
,
ERR
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
ERR
,
ERR
,
WAR
},
/* O */
{
OK
,
ERR
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
ERR
,
ERR
,
WAR
},
/* Bi*/
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
WAR
,
WAR
},
/* Bi*/
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
WAR
,
WAR
},
/* 3S*/
{
OK
,
WAR
,
OK
,
OK
,
OK
,
WAR
,
WAR
,
ERR
,
WAR
,
WAR
,
WAR
},
/* 3S*/
{
OK
,
WAR
,
OK
,
OK
,
OK
,
WAR
,
WAR
,
ERR
,
WAR
,
WAR
,
WAR
},
/*Pas*/
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
WAR
},
/*Pas*/
{
OK
,
OK
,
OK
,
OK
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
WAR
},
/*UnS */
{
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
},
/*UnS */
{
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
},
/*PwrI*/
{
OK
,
OK
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
ERR
},
/*PwrI*/
{
OK
,
OK
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
OK
,
OK
,
OK
,
ERR
},
/*PwrO*/
{
OK
,
ERR
,
WAR
,
ERR
,
OK
,
WAR
,
OK
,
ERR
,
ERR
,
ERR
,
WAR
},
/*PwrO*/
{
OK
,
ERR
,
WAR
,
ERR
,
OK
,
WAR
,
OK
,
ERR
,
ERR
,
ERR
,
WAR
},
/* OC */
{
OK
,
ERR
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
OK
,
OK
,
WAR
},
/* OC */
{
OK
,
ERR
,
OK
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
OK
,
OK
,
WAR
},
/* OE */
{
OK
,
ERR
,
WAR
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
OK
,
OK
,
WAR
},
/* OE */
{
OK
,
ERR
,
WAR
,
WAR
,
OK
,
WAR
,
OK
,
ERR
,
OK
,
OK
,
WAR
},
/* NC */
{
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
}
/* NC */
{
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
,
WAR
}
}
;
};
/* Minimal connection table */
/* Minimal connection table */
#define DRV
3
/* Net driven by a signal (a pin output for instance) */
#define DRV
3
/* Net driven by a signal (a pin output for instance) */
#define NET_NC 2
/* Net "connected" to a "NoConnect symbol" */
#define NET_NC 2
/* Net "connected" to a "NoConnect symbol" */
#define NOD
1
/* Net not driven ( Such as 2 or more connected inputs )*/
#define NOD
1
/* Net not driven ( Such as 2 or more connected inputs )*/
#define NOC
0
/* Pin isolee, non connectee */
#define NOC
0
/* Pin isolee, non connectee */
/* Look up table which gives the minimal drive for a pair of connected pins on a net
/* Look up table which gives the minimal drive for a pair of connected pins on a net
Initial state of a net is NOC (No Connection)
*
Initial state of a net is NOC (No Connection)
Can be updated to NET_NC, or NOD (Not Driven) or DRV (DRIven)
*
Can be updated to NET_NC, or NOD (Not Driven) or DRV (DRIven)
*
Can be updated to NET_NC only if the previous state is NOC
*
Can be updated to NET_NC only if the previous state is NOC
*
Nets are OK when their final state is NET_NC or DRV
*
Nets are OK when their final state is NET_NC or DRV
Nets with the state NOD have no source signal
*
Nets with the state NOD have no source signal
*/
*/
static
int
MinimalReq
[
PIN_NMAX
][
PIN_NMAX
]
=
static
int
MinimalReq
[
PIN_NMAX
][
PIN_NMAX
]
=
{
/* In, Out, Bi, 3S, Pas, UnS,PwrI,PwrO, OC, OE, NC */
{
/* In, Out, Bi, 3S, Pas, UnS,PwrI,PwrO, OC, OE, NC */
/* In*/
{
NOD
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* In*/
{
NOD
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*Out*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOC
},
/*Out*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOC
},
/* Bi*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* Bi*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* 3S*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* 3S*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*Pas*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*Pas*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*UnS*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*UnS*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/*PwrI*/
{
NOD
,
DRV
,
NOD
,
NOD
,
NOD
,
NOD
,
NOD
,
DRV
,
NOD
,
NOD
,
NOC
},
/*PwrI*/
{
NOD
,
DRV
,
NOD
,
NOD
,
NOD
,
NOD
,
NOD
,
DRV
,
NOD
,
NOD
,
NOC
},
/*PwrO*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOC
},
/*PwrO*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOC
},
/* OC*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* OC*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* OE*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* OE*/
{
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
DRV
,
NOD
,
DRV
,
DRV
,
DRV
,
NOC
},
/* NC*/
{
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
}
/* NC*/
{
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
,
NOC
}
}
;
};
/*************************************************************/
/*************************************************************/
void
InstallErcFrame
(
WinEDA_SchematicFrame
*
parent
,
wxPoint
&
pos
)
void
InstallErcFrame
(
WinEDA_SchematicFrame
*
parent
,
wxPoint
&
pos
)
/*************************************************************/
/*************************************************************/
/* Install function for the ERC dialog frame
/* Install function for the ERC dialog frame
*/
*/
{
{
WinEDA_ErcFrame
*
frame
=
new
WinEDA_ErcFrame
(
parent
);
WinEDA_ErcFrame
*
frame
=
new
WinEDA_ErcFrame
(
parent
);
frame
->
ShowModal
();
frame
->
Destroy
();
frame
->
ShowModal
();
frame
->
Destroy
();
}
}
/*********************************************/
/*********************************************/
void
WinEDA_ErcFrame
::
ReBuildMatrixPanel
()
void
WinEDA_ErcFrame
::
ReBuildMatrixPanel
()
/*********************************************/
/*********************************************/
/* Build or rebuild the panel showing the ERC matrix
/* Build or rebuild the panel showing the ERC matrix
*/
*/
{
{
int
ii
,
jj
,
event_id
,
text_height
;
int
ii
,
jj
,
event_id
,
text_height
;
wxPoint
pos
,
BoxMatrixPosition
;
wxPoint
pos
,
BoxMatrixPosition
;
#define BITMAP_SIZE 19
#define BITMAP_SIZE 19
int
bitmap_size
=
BITMAP_SIZE
;
int
bitmap_size
=
BITMAP_SIZE
;
wxStaticText
*
text
;
wxStaticText
*
text
;
int
x
,
y
;
int
x
,
y
;
wxSize
BoxMatrixMinSize
;
wxSize
BoxMatrixMinSize
;
if
(
!
DiagErcTableInit
)
if
(
!
DiagErcTableInit
)
{
{
memcpy
(
DiagErc
,
DefaultDiagErc
,
sizeof
(
DefaultDiagErc
));
memcpy
(
DiagErc
,
DefaultDiagErc
,
sizeof
(
DefaultDiagErc
)
);
DiagErcTableInit
=
TRUE
;
DiagErcTableInit
=
TRUE
;
}
}
// Get the current text size :
// Get the current text size :
text
=
new
wxStaticText
(
m_PanelERCOptions
,
-
1
,
wxT
(
"W"
),
pos
);
// this is a dummy text
text
=
new
wxStaticText
(
m_PanelERCOptions
,
-
1
,
wxT
(
"W"
),
pos
);
// this is a dummy text
text_height
=
text
->
GetRect
().
GetHeight
();
bitmap_size
=
MAX
(
bitmap_size
,
text_height
);
text_height
=
text
->
GetRect
().
GetHeight
();
delete
text
;
bitmap_size
=
MAX
(
bitmap_size
,
text_height
);
// compute the Y pos interval:
delete
text
;
BoxMatrixMinSize
.
y
=
(
bitmap_size
*
(
PIN_NMAX
+
1
))
+
5
;
GetSizer
()
->
Fit
(
this
);
// compute the Y pos interval:
GetSizer
()
->
SetSizeHints
(
this
);
BoxMatrixMinSize
.
y
=
(
bitmap_size
*
(
PIN_NMAX
+
1
)
)
+
5
;
pos
=
m_MatrixSizer
->
GetPosition
();
GetSizer
()
->
Fit
(
this
);
// Size computation is not made in constructor, in some wxWidgets version,
GetSizer
()
->
SetSizeHints
(
this
);
// and m_BoxSizerForERC_Opt position is always 0,0. and we can't use it
pos
=
m_MatrixSizer
->
GetPosition
();
pos
.
x
=
MAX
(
pos
.
x
,
5
);
pos
.
y
=
MAX
(
pos
.
y
,
m_ResetOptButton
->
GetRect
().
GetHeight
()
+
30
);
// Size computation is not made in constructor, in some wxWidgets version,
// and m_BoxSizerForERC_Opt position is always 0,0. and we can't use it
BoxMatrixPosition
=
pos
;
pos
.
x
=
MAX
(
pos
.
x
,
5
);
pos
.
y
=
MAX
(
pos
.
y
,
m_ResetOptButton
->
GetRect
().
GetHeight
()
+
30
);
pos
.
y
+=
text_height
;
BoxMatrixPosition
=
pos
;
if
(
m_Initialized
==
FALSE
)
{
pos
.
y
+=
text_height
;
for
(
ii
=
0
;
ii
<
PIN_NMAX
;
ii
++
)
{
if
(
m_Initialized
==
FALSE
)
y
=
pos
.
y
+
(
ii
*
bitmap_size
);
{
text
=
new
wxStaticText
(
m_PanelERCOptions
,
-
1
,
CommentERC_H
[
ii
],
wxPoint
(
5
,
y
));
for
(
ii
=
0
;
ii
<
PIN_NMAX
;
ii
++
)
x
=
text
->
GetRect
().
GetRight
();
{
pos
.
x
=
MAX
(
pos
.
x
,
x
);
y
=
pos
.
y
+
(
ii
*
bitmap_size
);
}
text
=
new
wxStaticText
(
m_PanelERCOptions
,
-
1
,
CommentERC_H
[
ii
],
wxPoint
(
5
,
y
)
);
pos
.
x
+=
5
;
}
x
=
text
->
GetRect
().
GetRight
();
else
pos
=
m_ButtonList
[
0
][
0
]
->
GetPosition
();
pos
.
x
=
MAX
(
pos
.
x
,
x
);
}
for
(
ii
=
0
;
ii
<
PIN_NMAX
;
ii
++
)
{
pos
.
x
+=
5
;
y
=
pos
.
y
+
(
ii
*
bitmap_size
);
}
for
(
jj
=
0
;
jj
<=
ii
;
jj
++
)
else
{
pos
=
m_ButtonList
[
0
][
0
]
->
GetPosition
();
int
diag
=
DiagErc
[
ii
][
jj
];
x
=
pos
.
x
+
(
jj
*
bitmap_size
);
for
(
ii
=
0
;
ii
<
PIN_NMAX
;
ii
++
)
if
(
(
ii
==
jj
)
&&
!
m_Initialized
)
{
{
y
=
pos
.
y
+
(
ii
*
bitmap_size
);
wxPoint
txtpos
;
for
(
jj
=
0
;
jj
<=
ii
;
jj
++
)
txtpos
.
x
=
x
+
4
;
txtpos
.
y
=
y
-
bitmap_size
;
{
text
=
new
wxStaticText
(
m_PanelERCOptions
,
-
1
,
CommentERC_V
[
ii
],
txtpos
);
int
diag
=
DiagErc
[
ii
][
jj
];
BoxMatrixMinSize
.
x
=
MAX
(
BoxMatrixMinSize
.
x
,
text
->
GetRect
().
GetRight
());
x
=
pos
.
x
+
(
jj
*
bitmap_size
);
}
if
(
(
ii
==
jj
)
&&
!
m_Initialized
)
event_id
=
ID_MATRIX_0
+
ii
+
(
jj
*
PIN_NMAX
);
{
delete
m_ButtonList
[
ii
][
jj
];
wxPoint
txtpos
;
switch
(
diag
)
txtpos
.
x
=
x
+
4
;
txtpos
.
y
=
y
-
bitmap_size
;
{
text
=
new
wxStaticText
(
m_PanelERCOptions
,
-
1
,
CommentERC_V
[
ii
],
txtpos
);
case
OK
:
m_ButtonList
[
ii
][
jj
]
=
new
wxBitmapButton
(
m_PanelERCOptions
,
BoxMatrixMinSize
.
x
=
MAX
(
BoxMatrixMinSize
.
x
,
text
->
GetRect
().
GetRight
()
);
event_id
,
}
wxBitmap
(
green_xpm
),
event_id
=
ID_MATRIX_0
+
ii
+
(
jj
*
PIN_NMAX
);
wxPoint
(
x
,
y
)
);
delete
m_ButtonList
[
ii
][
jj
];
break
;
switch
(
diag
)
case
WAR
:
{
m_ButtonList
[
ii
][
jj
]
=
new
wxBitmapButton
(
m_PanelERCOptions
,
case
OK
:
event_id
,
m_ButtonList
[
ii
][
jj
]
=
new
wxBitmapButton
(
m_PanelERCOptions
,
wxBitmap
(
warning_xpm
),
event_id
,
wxPoint
(
x
,
y
)
);
wxBitmap
(
green_xpm
),
break
;
wxPoint
(
x
,
y
)
);
case
ERR
:
break
;
m_ButtonList
[
ii
][
jj
]
=
new
wxBitmapButton
(
m_PanelERCOptions
,
event_id
,
case
WAR
:
wxBitmap
(
error_xpm
),
m_ButtonList
[
ii
][
jj
]
=
new
wxBitmapButton
(
m_PanelERCOptions
,
wxPoint
(
x
,
y
)
);
event_id
,
break
;
wxBitmap
(
warning_xpm
),
}
wxPoint
(
x
,
y
)
);
}
}
break
;
if
(
!
m_Initialized
)
case
ERR
:
{
m_ButtonList
[
ii
][
jj
]
=
new
wxBitmapButton
(
m_PanelERCOptions
,
BoxMatrixMinSize
.
x
+=
5
;
event_id
,
m_MatrixSizer
->
SetMinSize
(
BoxMatrixMinSize
);
wxBitmap
(
error_xpm
),
BoxMatrixMinSize
.
y
+=
BoxMatrixPosition
.
y
;
wxPoint
(
x
,
y
)
);
m_PanelMatrixSizer
->
SetMinSize
(
BoxMatrixMinSize
);
}
break
;
m_Initialized
=
TRUE
;
}
}
}
if
(
!
m_Initialized
)
{
BoxMatrixMinSize
.
x
+=
5
;
m_MatrixSizer
->
SetMinSize
(
BoxMatrixMinSize
);
BoxMatrixMinSize
.
y
+=
BoxMatrixPosition
.
y
;
m_PanelMatrixSizer
->
SetMinSize
(
BoxMatrixMinSize
);
}
m_Initialized
=
TRUE
;
}
}
/**************************************************/
/**************************************************/
void
WinEDA_ErcFrame
::
TestErc
(
wxCommandEvent
&
event
)
void
WinEDA_ErcFrame
::
TestErc
(
wxCommandEvent
&
event
)
/**************************************************/
/**************************************************/
{
{
ObjetNetListStruct
*
NetItemRef
,
*
OldItem
,
*
StartNet
,
*
Lim
;
ObjetNetListStruct
*
NetItemRef
;
int
NetNbItems
,
MinConn
;
ObjetNetListStruct
*
OldItem
;
ObjetNetListStruct
*
StartNet
;
if
(
!
DiagErcTableInit
)
ObjetNetListStruct
*
Lim
;
{
memcpy
(
DiagErc
,
DefaultDiagErc
,
sizeof
(
DefaultDiagErc
));
int
NetNbItems
,
MinConn
;
DiagErcTableInit
=
TRUE
;
}
if
(
!
DiagErcTableInit
)
{
WriteFichierERC
=
m_WriteResultOpt
->
GetValue
();
memcpy
(
DiagErc
,
DefaultDiagErc
,
sizeof
(
DefaultDiagErc
)
);
DiagErcTableInit
=
TRUE
;
ReAnnotatePowerSymbolsOnly
();
}
if
(
CheckAnnotate
(
m_Parent
,
0
)
)
{
WriteFichierERC
=
m_WriteResultOpt
->
GetValue
();
DisplayError
(
this
,
_
(
"Annotation Required!"
)
);
return
;
ReAnnotatePowerSymbolsOnly
();
}
if
(
CheckAnnotate
(
m_Parent
,
0
)
)
{
/* Effacement des anciens marqueurs DRC */
DisplayError
(
this
,
_
(
"Annotation Required!"
)
);
DelERCMarkers
(
event
);
return
;
}
wxClientDC
dc
(
m_Parent
->
DrawPanel
);
/* Effacement des anciens marqueurs DRC */
m_Parent
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
DelERCMarkers
(
event
);
g_EESchemaVar
.
NbErrorErc
=
0
;
wxClientDC
dc
(
m_Parent
->
DrawPanel
);
g_EESchemaVar
.
NbWarningErc
=
0
;
m_Parent
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
/* Cleanup the entire hierarchy */
EDA_ScreenList
ScreenList
(
NULL
);
g_EESchemaVar
.
NbErrorErc
=
0
;
for
(
SCH_SCREEN
*
Screen
=
ScreenList
.
GetFirst
();
Screen
!=
NULL
;
Screen
=
ScreenList
.
GetNext
()
)
g_EESchemaVar
.
NbWarningErc
=
0
;
{
bool
ModifyWires
;
/* Cleanup the entire hierarchy */
ModifyWires
=
Screen
->
SchematicCleanUp
(
NULL
);
EDA_ScreenList
ScreenList
(
NULL
);
/* if wire list has changed, delete Udo Redo list to avoid
pointers on deleted data problems */
for
(
SCH_SCREEN
*
Screen
=
ScreenList
.
GetFirst
();
Screen
!=
NULL
;
Screen
=
ScreenList
.
GetNext
()
)
if
(
ModifyWires
)
{
Screen
->
ClearUndoRedoList
();
bool
ModifyWires
;
}
ModifyWires
=
Screen
->
SchematicCleanUp
(
NULL
);
m_Parent
->
BuildNetListBase
();
/* if wire list has changed, delete Udo Redo list to avoid
* pointers on deleted data problems */
/* Analyse de la table des connexions : */
if
(
ModifyWires
)
Lim
=
g_TabObjNet
+
g_NbrObjNet
;
Screen
->
ClearUndoRedoList
();
}
/* Reset du flag m_FlagOfConnection, utilise par la suite */
for
(
NetItemRef
=
g_TabObjNet
;
NetItemRef
<
Lim
;
NetItemRef
++
)
m_Parent
->
BuildNetListBase
();
NetItemRef
->
m_FlagOfConnection
=
(
IsConnectType
)
0
;
/* Analyse de la table des connexions : */
NetNbItems
=
0
;
MinConn
=
NOC
;
Lim
=
g_TabObjNet
+
g_NbrObjNet
;
StartNet
=
OldItem
=
NetItemRef
=
g_TabObjNet
;
for
(
;
NetItemRef
<
Lim
;
NetItemRef
++
)
/* Reset du flag m_FlagOfConnection, utilise par la suite */
{
for
(
NetItemRef
=
g_TabObjNet
;
NetItemRef
<
Lim
;
NetItemRef
++
)
/* Tst changement de net */
NetItemRef
->
m_FlagOfConnection
=
(
IsConnectType
)
0
;
if
(
OldItem
->
m_NetCode
!=
NetItemRef
->
m_NetCode
)
{
NetNbItems
=
0
;
MinConn
=
NOC
;
NetNbItems
=
0
;
StartNet
=
NetItemRef
;
MinConn
=
NOC
;
}
StartNet
=
OldItem
=
NetItemRef
=
g_TabObjNet
;
switch
(
NetItemRef
->
m_Type
)
{
for
(
;
NetItemRef
<
Lim
;
NetItemRef
++
)
case
NET_SEGMENT
:
{
case
NET_BUS
:
/* Tst changement de net */
case
NET_JONCTION
:
if
(
OldItem
->
m_NetCode
!=
NetItemRef
->
m_NetCode
)
case
NET_LABEL
:
{
case
NET_BUSLABELMEMBER
:
MinConn
=
NOC
;
case
NET_PINLABEL
:
NetNbItems
=
0
;
break
;
StartNet
=
NetItemRef
;
}
case
NET_GLOBLABEL
:
case
NET_GLOBBUSLABELMEMBER
:
switch
(
NetItemRef
->
m_Type
)
case
NET_SHEETLABEL
:
{
case
NET_SHEETBUSLABELMEMBER
:
case
NET_SEGMENT
:
TestLabel
(
m_Parent
->
DrawPanel
,
&
dc
,
NetItemRef
,
StartNet
);
case
NET_BUS
:
break
;
case
NET_JONCTION
:
case
NET_LABEL
:
case
NET_NOCONNECT
:
case
NET_BUSLABELMEMBER
:
MinConn
=
NET_NC
;
case
NET_PINLABEL
:
if
(
NetNbItems
!=
0
)
break
;
Diagnose
(
m_Parent
->
DrawPanel
,
&
dc
,
NetItemRef
,
NULL
,
MinConn
,
UNC
);
break
;
case
NET_GLOBLABEL
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_PIN
:
case
NET_SHEETLABEL
:
TestOthersItems
(
m_Parent
->
DrawPanel
,
&
dc
,
case
NET_SHEETBUSLABELMEMBER
:
NetItemRef
,
StartNet
,
&
NetNbItems
,
&
MinConn
);
TestLabel
(
m_Parent
->
DrawPanel
,
&
dc
,
NetItemRef
,
StartNet
);
break
;
break
;
}
OldItem
=
NetItemRef
;
case
NET_NOCONNECT
:
}
MinConn
=
NET_NC
;
if
(
NetNbItems
!=
0
)
FreeTabNetList
(
g_TabObjNet
,
g_NbrObjNet
);
Diagnose
(
m_Parent
->
DrawPanel
,
&
dc
,
NetItemRef
,
NULL
,
MinConn
,
UNC
);
break
;
wxString
num
;
num
.
Printf
(
wxT
(
"%d"
),
g_EESchemaVar
.
NbErrorErc
);
case
NET_PIN
:
m_TotalErrCount
->
SetLabel
(
num
);
TestOthersItems
(
m_Parent
->
DrawPanel
,
&
dc
,
NetItemRef
,
StartNet
,
&
NetNbItems
,
&
MinConn
);
num
.
Printf
(
wxT
(
"%d"
),
g_EESchemaVar
.
NbErrorErc
-
g_EESchemaVar
.
NbWarningErc
);
break
;
m_LastErrCount
->
SetLabel
(
num
);
}
num
.
Printf
(
wxT
(
"%d"
),
g_EESchemaVar
.
NbWarningErc
);
OldItem
=
NetItemRef
;
m_LastWarningCount
->
SetLabel
(
num
);
}
/* Generation ouverture fichier diag */
FreeTabNetList
(
g_TabObjNet
,
g_NbrObjNet
);
if
(
WriteFichierERC
==
TRUE
)
{
wxString
num
;
wxString
ErcFullFileName
;
num
.
Printf
(
wxT
(
"%d"
),
g_EESchemaVar
.
NbErrorErc
);
ErcFullFileName
=
ScreenSch
->
m_FileName
;
m_TotalErrCount
->
SetLabel
(
num
);
ChangeFileNameExt
(
ErcFullFileName
,
wxT
(
".erc"
));
ErcFullFileName
=
EDA_FileSelector
(
_
(
"ERC file:"
),
num
.
Printf
(
wxT
(
"%d"
),
g_EESchemaVar
.
NbErrorErc
-
g_EESchemaVar
.
NbWarningErc
);
wxEmptyString
,
/* Chemin par defaut */
m_LastErrCount
->
SetLabel
(
num
);
ErcFullFileName
,
/* nom fichier par defaut */
wxT
(
".erc"
),
/* extension par defaut */
num
.
Printf
(
wxT
(
"%d"
),
g_EESchemaVar
.
NbWarningErc
);
wxT
(
"*.erc"
),
/* Masque d'affichage */
m_LastWarningCount
->
SetLabel
(
num
);
this
,
wxFD_SAVE
,
/* Generation ouverture fichier diag */
TRUE
if
(
WriteFichierERC
==
TRUE
)
);
{
if
(
ErcFullFileName
.
IsEmpty
())
return
;
wxString
ErcFullFileName
;
ErcFullFileName
=
ScreenSch
->
m_FileName
;
if
(
WriteDiagnosticERC
(
ErcFullFileName
)
)
ChangeFileNameExt
(
ErcFullFileName
,
wxT
(
".erc"
)
);
{
ErcFullFileName
=
EDA_FileSelector
(
_
(
"ERC file:"
),
Close
(
TRUE
);
wxEmptyString
,
/* Chemin par defaut */
wxString
editorname
=
GetEditorName
();
ErcFullFileName
,
/* nom fichier par defaut */
AddDelimiterString
(
ErcFullFileName
);
wxT
(
".erc"
),
/* extension par defaut */
ExecuteFile
(
this
,
editorname
,
ErcFullFileName
);
wxT
(
"*.erc"
),
/* Masque d'affichage */
}
this
,
}
wxFD_SAVE
,
TRUE
);
if
(
ErcFullFileName
.
IsEmpty
()
)
return
;
if
(
WriteDiagnosticERC
(
ErcFullFileName
)
)
{
Close
(
TRUE
);
wxString
editorname
=
GetEditorName
();
AddDelimiterString
(
ErcFullFileName
);
ExecuteFile
(
this
,
editorname
,
ErcFullFileName
);
}
}
}
}
/***********************************************************/
/***********************************************************/
void
WinEDA_ErcFrame
::
DelERCMarkers
(
wxCommandEvent
&
event
)
void
WinEDA_ErcFrame
::
DelERCMarkers
(
wxCommandEvent
&
event
)
/***********************************************************/
/***********************************************************/
/* Delete the old ERC markers, over the whole hierarchy
/* Delete the old ERC markers, over the whole hierarchy
*/
*/
{
{
EDA_BaseStruct
*
DrawStruct
;
EDA_BaseStruct
*
DrawStruct
;
DrawMarkerStruct
*
Marker
;
DrawMarkerStruct
*
Marker
;
wxClientDC
dc
(
m_Parent
->
DrawPanel
);
wxClientDC
dc
(
m_Parent
->
DrawPanel
);
m_Parent
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
m_Parent
->
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
// Delete markers for the current screen
DrawStruct
=
m_Parent
->
GetScreen
()
->
EEDrawList
;
// Delete markers for the current screen
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Pnext
)
DrawStruct
=
m_Parent
->
GetScreen
()
->
EEDrawList
;
{
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Pnext
)
if
(
DrawStruct
->
Type
()
!=
DRAW_MARKER_STRUCT_TYPE
)
continue
;
{
/* Marqueur trouve */
if
(
DrawStruct
->
Type
()
!=
DRAW_MARKER_STRUCT_TYPE
)
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
continue
;
if
(
Marker
->
m_Type
==
MARQ_ERC
)
/* Marqueur trouve */
RedrawOneStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
Marker
,
g_XorMode
);
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
}
if
(
Marker
->
m_Type
==
MARQ_ERC
)
/* Suppression en memoire des marqueurs ERC */
RedrawOneStruct
(
m_Parent
->
DrawPanel
,
&
dc
,
Marker
,
g_XorMode
);
DeleteAllMarkers
(
MARQ_ERC
);
}
/* Suppression en memoire des marqueurs ERC */
DeleteAllMarkers
(
MARQ_ERC
);
}
}
/**************************************************************/
/**************************************************************/
void
WinEDA_ErcFrame
::
ResetDefaultERCDiag
(
wxCommandEvent
&
event
)
void
WinEDA_ErcFrame
::
ResetDefaultERCDiag
(
wxCommandEvent
&
event
)
/**************************************************************/
/**************************************************************/
/* Remet aux valeurs par defaut la matrice de diagnostic
/* Remet aux valeurs par defaut la matrice de diagnostic
*/
*/
{
{
memcpy
(
DiagErc
,
DefaultDiagErc
,
sizeof
(
DiagErc
)
);
memcpy
(
DiagErc
,
DefaultDiagErc
,
sizeof
(
DiagErc
)
);
ReBuildMatrixPanel
();
ReBuildMatrixPanel
();
}
}
/************************************************************/
/************************************************************/
void
WinEDA_ErcFrame
::
ChangeErrorLevel
(
wxCommandEvent
&
event
)
void
WinEDA_ErcFrame
::
ChangeErrorLevel
(
wxCommandEvent
&
event
)
/************************************************************/
/************************************************************/
/* Change the error level for the pressed button, on the matrix table
/* Change the error level for the pressed button, on the matrix table
*/
*/
{
{
int
id
,
level
,
ii
,
x
,
y
;
int
id
,
level
,
ii
,
x
,
y
;
wxBitmapButton
*
Butt
;
wxBitmapButton
*
Butt
;
char
**
new_bitmap_xpm
=
NULL
;
char
**
new_bitmap_xpm
=
NULL
;
wxPoint
pos
;
wxPoint
pos
;
id
=
event
.
GetId
();
id
=
event
.
GetId
();
ii
=
id
-
ID_MATRIX_0
;
ii
=
id
-
ID_MATRIX_0
;
Butt
=
(
wxBitmapButton
*
)
event
.
GetEventObject
();
Butt
=
(
wxBitmapButton
*
)
event
.
GetEventObject
();
pos
=
Butt
->
GetPosition
();
pos
=
Butt
->
GetPosition
();
x
=
ii
/
PIN_NMAX
;
y
=
ii
%
PIN_NMAX
;
x
=
ii
/
PIN_NMAX
;
y
=
ii
%
PIN_NMAX
;
level
=
DiagErc
[
y
][
x
];
level
=
DiagErc
[
y
][
x
];
switch
(
level
)
{
switch
(
level
)
case
OK
:
{
level
=
WAR
;
case
OK
:
new_bitmap_xpm
=
warning_xpm
;
level
=
WAR
;
break
;
new_bitmap_xpm
=
warning_xpm
;
break
;
case
WAR
:
level
=
ERR
;
case
WAR
:
new_bitmap_xpm
=
error_xpm
;
level
=
ERR
;
break
;
new_bitmap_xpm
=
error_xpm
;
break
;
case
ERR
:
level
=
OK
;
case
ERR
:
new_bitmap_xpm
=
green_xpm
;
level
=
OK
;
break
;
new_bitmap_xpm
=
green_xpm
;
break
;
}
}
if
(
new_bitmap_xpm
)
if
(
new_bitmap_xpm
)
{
{
delete
Butt
;
delete
Butt
;
Butt
=
new
wxBitmapButton
(
m_PanelERCOptions
,
id
,
Butt
=
new
wxBitmapButton
(
m_PanelERCOptions
,
id
,
wxBitmap
(
new_bitmap_xpm
),
pos
);
wxBitmap
(
new_bitmap_xpm
),
pos
);
m_ButtonList
[
y
][
x
]
=
Butt
;
DiagErc
[
y
][
x
]
=
DiagErc
[
x
][
y
]
=
level
;
m_ButtonList
[
y
][
x
]
=
Butt
;
}
DiagErc
[
y
][
x
]
=
DiagErc
[
x
][
y
]
=
level
;
}
}
}
/********************************************************/
/********************************************************/
static
void
Diagnose
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
static
void
Diagnose
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
NetItemTst
,
ObjetNetListStruct
*
NetItemTst
,
int
MinConn
,
int
Diag
)
int
MinConn
,
int
Diag
)
/********************************************************/
/********************************************************/
/* Routine de creation du marqueur ERC correspondant au conflit electrique
/* Routine de creation du marqueur ERC correspondant au conflit electrique
entre NetItemRef et NetItemTst
*
entre NetItemRef et NetItemTst
si MinConn < 0: Traitement des erreurs sur labels
*
si MinConn < 0: Traitement des erreurs sur labels
*/
*/
{
{
DrawMarkerStruct
*
Marker
=
NULL
;
DrawMarkerStruct
*
Marker
=
NULL
;
wxString
DiagLevel
;
wxString
DiagLevel
;
SCH_SCREEN
*
screen
;
SCH_SCREEN
*
screen
;
int
ii
,
jj
;
int
ii
,
jj
;
if
(
Diag
==
OK
)
return
;
if
(
Diag
==
OK
)
return
;
/* Creation du nouveau marqueur type Erreur ERC */
Marker
=
new
DrawMarkerStruct
(
NetItemRef
->
m_Start
,
wxEmptyString
);
/* Creation du nouveau marqueur type Erreur ERC */
Marker
->
m_Type
=
MARQ_ERC
;
Marker
=
new
DrawMarkerStruct
(
NetItemRef
->
m_Start
,
wxEmptyString
);
Marker
->
m_MarkFlags
=
WAR
;
screen
=
NetItemRef
->
m_Screen
;
Marker
->
m_Type
=
MARQ_ERC
;
Marker
->
Pnext
=
screen
->
EEDrawList
;
Marker
->
m_MarkFlags
=
WAR
;
screen
->
EEDrawList
=
Marker
;
screen
=
NetItemRef
->
m_Screen
;
g_EESchemaVar
.
NbErrorErc
++
;
Marker
->
Pnext
=
screen
->
EEDrawList
;
g_EESchemaVar
.
NbWarningErc
++
;
screen
->
EEDrawList
=
Marker
;
g_EESchemaVar
.
NbErrorErc
++
;
if
(
MinConn
<
0
)
// Traitement des erreurs sur labels
g_EESchemaVar
.
NbWarningErc
++
;
{
if
(
(
NetItemRef
->
m_Type
==
NET_GLOBLABEL
)
||
if
(
MinConn
<
0
)
// Traitement des erreurs sur labels
(
NetItemRef
->
m_Type
==
NET_GLOBBUSLABELMEMBER
)
)
{
{
if
(
(
NetItemRef
->
m_Type
==
NET_GLOBLABEL
)
Marker
->
m_Comment
.
Printf
(
_
(
"Warning GLabel %s not connected to SheetLabel"
),
||
(
NetItemRef
->
m_Type
==
NET_GLOBBUSLABELMEMBER
)
)
NetItemRef
->
m_Label
->
GetData
());
{
}
Marker
->
m_Comment
.
Printf
(
_
(
"Warning GLabel %s not connected to SheetLabel"
),
else
Marker
->
m_Comment
.
Printf
(
_
(
"Warning SheetLabel %s not connected to GLabel"
),
NetItemRef
->
m_Label
->
GetData
()
);
NetItemRef
->
m_Label
->
GetData
());
}
else
if
(
screen
==
panel
->
GetScreen
()
)
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
Marker
->
m_Comment
.
Printf
(
_
(
"Warning SheetLabel %s not connected to GLabel"
),
return
;
NetItemRef
->
m_Label
->
GetData
()
);
}
if
(
screen
==
panel
->
GetScreen
()
)
ii
=
NetItemRef
->
m_ElectricalType
;
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
return
;
if
(
NetItemTst
==
NULL
)
}
{
if
(
MinConn
==
NOC
)
/* 1 seul element dans le net */
ii
=
NetItemRef
->
m_ElectricalType
;
{
Marker
->
m_Comment
.
Printf
(
_
(
"Warning Pin %s Unconnected"
),
MsgPinElectricType
[
ii
]);
if
(
NetItemTst
==
NULL
)
if
(
screen
==
panel
->
GetScreen
()
)
{
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
if
(
MinConn
==
NOC
)
/* 1 seul element dans le net */
return
;
{
}
Marker
->
m_Comment
.
Printf
(
_
(
"Warning Pin %s Unconnected"
),
MsgPinElectricType
[
ii
]
);
if
(
screen
==
panel
->
GetScreen
()
)
if
(
MinConn
==
NOD
)
/* pas de pilotage du net */
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
{
return
;
Marker
->
m_Comment
.
Printf
(
}
_
(
"Warning Pin %s not driven (Net %d)"
),
MsgPinElectricType
[
ii
],
NetItemRef
->
m_NetCode
);
if
(
MinConn
==
NOD
)
/* pas de pilotage du net */
if
(
screen
==
panel
->
GetScreen
()
)
{
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
Marker
->
m_Comment
.
Printf
(
return
;
_
(
"Warning Pin %s not driven (Net %d)"
),
}
MsgPinElectricType
[
ii
],
NetItemRef
->
m_NetCode
);
if
(
screen
==
panel
->
GetScreen
()
)
if
(
Diag
==
UNC
)
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
{
return
;
Marker
->
m_Comment
.
Printf
(
}
_
(
"Warning More than 1 Pin connected to UnConnect symbol"
)
);
if
(
screen
==
panel
->
GetScreen
()
)
if
(
Diag
==
UNC
)
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
{
return
;
Marker
->
m_Comment
.
Printf
(
}
_
(
"Warning More than 1 Pin connected to UnConnect symbol"
)
);
if
(
screen
==
panel
->
GetScreen
()
)
}
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
return
;
if
(
NetItemTst
)
/* Erreur entre 2 pins */
}
{
}
jj
=
NetItemTst
->
m_ElectricalType
;
DiagLevel
=
_
(
"Warning"
);
if
(
NetItemTst
)
/* Erreur entre 2 pins */
if
(
Diag
==
ERR
)
{
{
jj
=
NetItemTst
->
m_ElectricalType
;
DiagLevel
=
_
(
"Error"
);
DiagLevel
=
_
(
"Warning"
);
Marker
->
m_MarkFlags
=
ERR
;
if
(
Diag
==
ERR
)
g_EESchemaVar
.
NbWarningErc
--
;
{
}
DiagLevel
=
_
(
"Error"
);
Marker
->
m_MarkFlags
=
ERR
;
g_EESchemaVar
.
NbWarningErc
--
;
Marker
->
m_Comment
.
Printf
(
_
(
"%s: Pin %s connected to Pin %s (net %d)"
),
DiagLevel
.
GetData
(),
}
MsgPinElectricType
[
ii
],
MsgPinElectricType
[
jj
],
NetItemRef
->
m_NetCode
);
Marker
->
m_Comment
.
Printf
(
_
(
"%s: Pin %s connected to Pin %s (net %d)"
),
if
(
screen
==
panel
->
GetScreen
()
)
DiagLevel
.
GetData
(),
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
MsgPinElectricType
[
ii
],
}
MsgPinElectricType
[
jj
],
NetItemRef
->
m_NetCode
);
if
(
screen
==
panel
->
GetScreen
()
)
RedrawOneStruct
(
panel
,
DC
,
Marker
,
GR_COPY
);
}
}
}
/********************************************************************/
/********************************************************************/
static
void
TestOthersItems
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
static
void
TestOthersItems
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
netstart
,
ObjetNetListStruct
*
netstart
,
int
*
NetNbItems
,
int
*
MinConnexion
)
int
*
NetNbItems
,
int
*
MinConnexion
)
/********************************************************************/
/********************************************************************/
/* Routine testant les conflits electriques entre
/* Routine testant les conflits electriques entre
NetItemRef
*
NetItemRef
et les autres items du meme net
*
et les autres items du meme net
*/
*/
{
{
ObjetNetListStruct
*
NetItemTst
,
*
Lim
;
ObjetNetListStruct
*
NetItemTst
;
int
ref_elect_type
,
jj
,
erc
=
OK
,
local_minconn
;
ObjetNetListStruct
*
Lim
;
/* Analyse de la table des connexions : */
int
ref_elect_type
,
jj
,
erc
=
OK
,
local_minconn
;
Lim
=
g_TabObjNet
+
g_NbrObjNet
;
// pointe la fin de la liste
ref_elect_type
=
NetItemRef
->
m_ElectricalType
;
/* Analyse de la table des connexions : */
Lim
=
g_TabObjNet
+
g_NbrObjNet
;
// pointe la fin de la liste
NetItemTst
=
netstart
;
local_minconn
=
NOC
;
ref_elect_type
=
NetItemRef
->
m_ElectricalType
;
/* Examen de la liste des Pins connectees a NetItemRef */
NetItemTst
=
netstart
;
for
(
;
;
NetItemTst
++
)
local_minconn
=
NOC
;
{
if
(
NetItemRef
==
NetItemTst
)
continue
;
/* Examen de la liste des Pins connectees a NetItemRef */
for
(
;
;
NetItemTst
++
)
/* Est - on toujours dans le meme net ? */
{
if
(
(
NetItemTst
>=
Lim
)
||
// fin de liste (donc fin de net)
if
(
NetItemRef
==
NetItemTst
)
(
NetItemRef
->
m_NetCode
!=
NetItemTst
->
m_NetCode
)
)
// fin de net
continue
;
{
/* Fin de netcode trouve: Tst connexion minimum */
if
(
(
*
MinConnexion
<
NET_NC
)
&&
/* Est - on toujours dans le meme net ? */
(
local_minconn
<
NET_NC
)
)
/* pin non connecte ou non pilotee */
if
(
(
NetItemTst
>=
Lim
)
// fin de liste (donc fin de net)
{
||
(
NetItemRef
->
m_NetCode
!=
NetItemTst
->
m_NetCode
)
)
// fin de net
Diagnose
(
panel
,
DC
,
NetItemRef
,
NULL
,
local_minconn
,
WAR
);
{
/* Fin de netcode trouve: Tst connexion minimum */
*
MinConnexion
=
DRV
;
// inhibition autres messages de ce type pour ce net
if
(
(
*
MinConnexion
<
NET_NC
)
}
&&
(
local_minconn
<
NET_NC
)
)
/* pin non connecte ou non pilotee */
return
;
{
}
Diagnose
(
panel
,
DC
,
NetItemRef
,
NULL
,
local_minconn
,
WAR
);
*
MinConnexion
=
DRV
;
// inhibition autres messages de ce type pour ce net
switch
(
NetItemTst
->
m_Type
)
}
{
return
;
case
NET_SEGMENT
:
}
case
NET_BUS
:
case
NET_JONCTION
:
switch
(
NetItemTst
->
m_Type
)
case
NET_LABEL
:
{
case
NET_GLOBLABEL
:
case
NET_SEGMENT
:
case
NET_BUSLABELMEMBER
:
case
NET_BUS
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_JONCTION
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_LABEL
:
case
NET_SHEETLABEL
:
case
NET_GLOBLABEL
:
case
NET_PINLABEL
:
case
NET_BUSLABELMEMBER
:
break
;
case
NET_GLOBBUSLABELMEMBER
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_NOCONNECT
:
case
NET_SHEETLABEL
:
local_minconn
=
MAX
(
NET_NC
,
local_minconn
);
case
NET_PINLABEL
:
break
;
break
;
case
NET_PIN
:
case
NET_NOCONNECT
:
jj
=
NetItemTst
->
m_ElectricalType
;
local_minconn
=
MAX
(
NET_NC
,
local_minconn
);
local_minconn
=
MAX
(
MinimalReq
[
ref_elect_type
][
jj
],
local_minconn
);
break
;
if
(
NetItemTst
<=
NetItemRef
)
break
;
case
NET_PIN
:
*
NetNbItems
+=
1
;
jj
=
NetItemTst
->
m_ElectricalType
;
if
(
erc
==
OK
)
// 1 marqueur par pin maxi
local_minconn
=
MAX
(
MinimalReq
[
ref_elect_type
][
jj
],
local_minconn
);
{
erc
=
DiagErc
[
ref_elect_type
][
jj
];
if
(
NetItemTst
<=
NetItemRef
)
if
(
erc
!=
OK
)
break
;
{
if
(
NetItemTst
->
m_FlagOfConnection
==
0
)
*
NetNbItems
+=
1
;
{
if
(
erc
==
OK
)
// 1 marqueur par pin maxi
Diagnose
(
panel
,
DC
,
NetItemRef
,
NetItemTst
,
0
,
erc
);
{
NetItemTst
->
m_FlagOfConnection
=
(
IsConnectType
)
1
;
erc
=
DiagErc
[
ref_elect_type
][
jj
];
}
if
(
erc
!=
OK
)
}
{
}
if
(
NetItemTst
->
m_FlagOfConnection
==
0
)
break
;
{
}
Diagnose
(
panel
,
DC
,
NetItemRef
,
NetItemTst
,
0
,
erc
);
}
NetItemTst
->
m_FlagOfConnection
=
(
IsConnectType
)
1
;
}
}
}
break
;
}
}
}
}
/********************************************************/
/********************************************************/
static
bool
WriteDiagnosticERC
(
const
wxString
&
FullFileName
)
static
bool
WriteDiagnosticERC
(
const
wxString
&
FullFileName
)
/*********************************************************/
/*********************************************************/
/* Create the Diagnostic file (<xxx>.erc file)
/* Create the Diagnostic file (<xxx>.erc file)
*/
*/
{
{
EDA_BaseStruct
*
DrawStruct
;
EDA_BaseStruct
*
DrawStruct
;
DrawMarkerStruct
*
Marker
;
DrawMarkerStruct
*
Marker
;
char
Line
[
256
];
char
Line
[
256
];
static
FILE
*
OutErc
;
static
FILE
*
OutErc
;
DrawSheetStruct
*
Sheet
;
DrawSheetStruct
*
Sheet
;
wxString
msg
;
wxString
msg
;
if
(
(
OutErc
=
wxFopen
(
FullFileName
,
wxT
(
"wt"
)))
==
NULL
)
return
FALSE
;
if
(
(
OutErc
=
wxFopen
(
FullFileName
,
wxT
(
"wt"
)
)
)
==
NULL
)
return
FALSE
;
DateAndTime
(
Line
);
msg
=
_
(
"ERC control"
);
DateAndTime
(
Line
);
fprintf
(
OutErc
,
"%s (%s)
\n
"
,
CONV_TO_UTF8
(
msg
),
Line
);
msg
=
_
(
"ERC control"
);
EDA_ScreenList
ScreenList
(
NULL
);
fprintf
(
OutErc
,
"%s (%s)
\n
"
,
CONV_TO_UTF8
(
msg
),
Line
);
for
(
SCH_SCREEN
*
Screen
=
ScreenList
.
GetFirst
();
Screen
!=
NULL
;
Screen
=
ScreenList
.
GetNext
()
)
{
EDA_ScreenList
ScreenList
(
NULL
);
Sheet
=
(
DrawSheetStruct
*
)
Screen
;
msg
.
Printf
(
_
(
"
\n
***** Sheet %d (%s)
\n
"
),
for
(
SCH_SCREEN
*
Screen
=
ScreenList
.
GetFirst
();
Screen
!=
NULL
;
Screen
=
ScreenList
.
GetNext
()
)
Sheet
->
m_SheetNumber
,
{
Screen
==
ScreenSch
?
_
(
"Root"
)
:
Sheet
->
m_SheetName
.
GetData
());
Sheet
=
(
DrawSheetStruct
*
)
Screen
;
fprintf
(
OutErc
,
"%s"
,
CONV_TO_UTF8
(
msg
));
msg
.
Printf
(
_
(
"
\n
***** Sheet %d (%s)
\n
"
),
DrawStruct
=
Screen
->
EEDrawList
;
Sheet
->
m_SheetNumber
,
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Pnext
)
Screen
==
ScreenSch
?
_
(
"Root"
)
:
Sheet
->
m_SheetName
.
GetData
()
);
{
if
(
DrawStruct
->
Type
()
!=
DRAW_MARKER_STRUCT_TYPE
)
fprintf
(
OutErc
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
continue
;
DrawStruct
=
Screen
->
EEDrawList
;
/* Marqueur trouve */
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Pnext
)
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
{
if
(
Marker
->
m_Type
!=
MARQ_ERC
)
continue
;
if
(
DrawStruct
->
Type
()
!=
DRAW_MARKER_STRUCT_TYPE
)
/* Write diag marqueur */
continue
;
msg
.
Printf
(
_
(
"ERC: %s (X= %2.3f inches, Y= %2.3f inches
\n
"
),
Marker
->
GetComment
().
GetData
(),
/* Marqueur trouve */
(
float
)
Marker
->
m_Pos
.
x
/
1000
,
Marker
=
(
DrawMarkerStruct
*
)
DrawStruct
;
(
float
)
Marker
->
m_Pos
.
y
/
1000
);
if
(
Marker
->
m_Type
!=
MARQ_ERC
)
fprintf
(
OutErc
,
"%s"
,
CONV_TO_UTF8
(
msg
));
continue
;
}
}
/* Write diag marqueur */
msg
.
Printf
(
_
(
"
\n
>> Errors ERC: %d
\n
"
),
g_EESchemaVar
.
NbErrorErc
);
msg
.
Printf
(
_
(
"ERC: %s (X= %2.3f inches, Y= %2.3f inches
\n
"
),
fprintf
(
OutErc
,
"%s"
,
CONV_TO_UTF8
(
msg
));
Marker
->
GetComment
().
GetData
(),
fclose
(
OutErc
);
(
float
)
Marker
->
m_Pos
.
x
/
1000
,
(
float
)
Marker
->
m_Pos
.
y
/
1000
);
return
TRUE
;
fprintf
(
OutErc
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
}
}
msg
.
Printf
(
_
(
"
\n
>> Errors ERC: %d
\n
"
),
g_EESchemaVar
.
NbErrorErc
);
fprintf
(
OutErc
,
"%s"
,
CONV_TO_UTF8
(
msg
)
);
fclose
(
OutErc
);
return
TRUE
;
}
}
/***********************************************************************/
/***********************************************************************/
void
TestLabel
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
TestLabel
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
StartNet
)
ObjetNetListStruct
*
NetItemRef
,
ObjetNetListStruct
*
StartNet
)
/***********************************************************************/
/***********************************************************************/
/* Routine controlant qu'un sheetLabel est bien connecte a un Glabel de la
/* Routine controlant qu'un sheetLabel est bien connecte a un Glabel de la
sous-feuille correspondante
*
sous-feuille correspondante
*/
*/
{
{
ObjetNetListStruct
*
NetItemTst
,
*
Lim
;
ObjetNetListStruct
*
NetItemTst
,
*
Lim
;
int
erc
=
1
;
int
erc
=
1
;
/* Analyse de la table des connexions : */
/* Analyse de la table des connexions : */
Lim
=
g_TabObjNet
+
g_NbrObjNet
;
Lim
=
g_TabObjNet
+
g_NbrObjNet
;
NetItemTst
=
StartNet
;
NetItemTst
=
StartNet
;
/* Examen de la liste des Labels connectees a NetItemRef */
/* Examen de la liste des Labels connectees a NetItemRef */
for
(
;
;
NetItemTst
++
)
for
(
;
;
NetItemTst
++
)
{
{
if
(
NetItemTst
==
NetItemRef
)
continue
;
if
(
NetItemTst
==
NetItemRef
)
continue
;
/* Est - on toujours dans le meme net ? */
if
(
(
NetItemTst
==
Lim
)
||
/* Est - on toujours dans le meme net ? */
(
NetItemRef
->
m_NetCode
!=
NetItemTst
->
m_NetCode
)
)
if
(
(
NetItemTst
==
Lim
)
{
/* Fin de netcode trouve */
||
(
NetItemRef
->
m_NetCode
!=
NetItemTst
->
m_NetCode
)
)
if
(
erc
)
{
{
/* GLabel ou SheetLabel orphelin */
/* Fin de netcode trouve */
Diagnose
(
panel
,
DC
,
NetItemRef
,
NULL
,
-
1
,
WAR
);
if
(
erc
)
}
{
return
;
/* GLabel ou SheetLabel orphelin */
}
Diagnose
(
panel
,
DC
,
NetItemRef
,
NULL
,
-
1
,
WAR
);
}
if
(
(
NetItemRef
->
m_Type
==
NET_GLOBLABEL
)
||
return
;
(
NetItemRef
->
m_Type
==
NET_GLOBBUSLABELMEMBER
)
)
}
{
switch
(
NetItemTst
->
m_Type
)
if
(
(
NetItemRef
->
m_Type
==
NET_GLOBLABEL
)
{
||
(
NetItemRef
->
m_Type
==
NET_GLOBBUSLABELMEMBER
)
)
case
NET_SEGMENT
:
{
case
NET_BUS
:
switch
(
NetItemTst
->
m_Type
)
case
NET_JONCTION
:
{
case
NET_LABEL
:
case
NET_SEGMENT
:
case
NET_GLOBLABEL
:
case
NET_BUS
:
case
NET_BUSLABELMEMBER
:
case
NET_JONCTION
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_LABEL
:
case
NET_PINLABEL
:
case
NET_GLOBLABEL
:
case
NET_NOCONNECT
:
case
NET_BUSLABELMEMBER
:
case
NET_PIN
:
case
NET_GLOBBUSLABELMEMBER
:
break
;
case
NET_PINLABEL
:
case
NET_NOCONNECT
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_PIN
:
case
NET_SHEETLABEL
:
break
;
/* Tst si le GLabel est bien dans la bonne sousfeuille */
if
(
NetItemRef
->
m_SheetNumber
==
NetItemTst
->
m_NumInclude
)
case
NET_SHEETBUSLABELMEMBER
:
{
case
NET_SHEETLABEL
:
erc
=
0
;
/* Tst si le GLabel est bien dans la bonne sousfeuille */
}
if
(
NetItemRef
->
m_SheetNumber
==
NetItemTst
->
m_NumInclude
)
break
;
{
}
erc
=
0
;
}
}
break
;
else
}
{
}
switch
(
NetItemTst
->
m_Type
)
else
{
{
case
NET_SEGMENT
:
switch
(
NetItemTst
->
m_Type
)
case
NET_BUS
:
{
case
NET_JONCTION
:
case
NET_SEGMENT
:
case
NET_LABEL
:
case
NET_BUS
:
case
NET_BUSLABELMEMBER
:
case
NET_JONCTION
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_LABEL
:
case
NET_SHEETLABEL
:
case
NET_BUSLABELMEMBER
:
case
NET_PINLABEL
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_NOCONNECT
:
case
NET_SHEETLABEL
:
case
NET_PIN
:
case
NET_PINLABEL
:
break
;
case
NET_NOCONNECT
:
case
NET_PIN
:
case
NET_GLOBLABEL
:
break
;
case
NET_GLOBBUSLABELMEMBER
:
/* Tst si le GLabel est bien dans la bonne sous-feuille */
case
NET_GLOBLABEL
:
if
(
NetItemTst
->
m_SheetNumber
==
NetItemRef
->
m_NumInclude
)
case
NET_GLOBBUSLABELMEMBER
:
{
/* Tst si le GLabel est bien dans la bonne sous-feuille */
erc
=
0
;
if
(
NetItemTst
->
m_SheetNumber
==
NetItemRef
->
m_NumInclude
)
}
{
break
;
erc
=
0
;
}
}
}
break
;
}
}
}
}
}
}
eeschema/libedpart.cpp
View file @
664a1f72
...
@@ -24,1105 +24,1214 @@ extern int CurrentUnit;
...
@@ -24,1105 +24,1214 @@ extern int CurrentUnit;
/* Classe de la frame des proprits d'un composant en librairie */
/* Classe de la frame des proprits d'un composant en librairie */
enum
id_libedit
{
enum
id_libedit
{
ID_LIBEDIT_NOTEBOOK
=
3200
,
ID_LIBEDIT_NOTEBOOK
=
3200
,
ID_PANEL_BASIC
,
ID_PANEL_BASIC
,
ID_PANEL_ALIAS
,
ID_PANEL_ALIAS
,
ID_PANEL_REFERENCE
,
ID_PANEL_REFERENCE
,
ID_PANEL_VALUE
,
ID_PANEL_VALUE
,
ID_PANEL_FOOTPRINT
,
ID_PANEL_FOOTPRINT
,
ID_PANEL_SUBSCHEMATIC
,
ID_PANEL_SUBSCHEMATIC
,
ID_PANEL_FIELD1
,
ID_PANEL_FIELD1
,
ID_PANEL_FIELD2
,
ID_PANEL_FIELD2
,
ID_PANEL_FIELD3
,
ID_PANEL_FIELD3
,
ID_PANEL_FIELD4
,
ID_PANEL_FIELD4
,
ID_PANEL_FIELD5
,
ID_PANEL_FIELD5
,
ID_PANEL_FIELD6
,
ID_PANEL_FIELD6
,
ID_PANEL_FIELD7
,
ID_PANEL_FIELD7
,
ID_PANEL_FIELD8
,
ID_PANEL_FIELD8
,
ID_CLOSE_PART_PROPERTIES
,
ID_CLOSE_PART_PROPERTIES
,
ID_ACCEPT_PART_PROPERTIES
,
ID_ACCEPT_PART_PROPERTIES
,
ID_COPY_DOC_TO_ALIAS
,
ID_COPY_DOC_TO_ALIAS
,
ID_BROWSE_DOC_FILES
,
ID_BROWSE_DOC_FILES
,
ID_ADD_ALIAS
,
ID_ADD_ALIAS
,
ID_DELETE_ONE_ALIAS
,
ID_DELETE_ONE_ALIAS
,
ID_DELETE_ALL_ALIAS
ID_DELETE_ALL_ALIAS
};
};
/************************************************/
/************************************************/
class
WinEDA_PartPropertiesFrame
:
public
wxDialog
class
WinEDA_PartPropertiesFrame
:
public
wxDialog
/************************************************/
/************************************************/
/* Cette classe genere une fenetre type NoteBook, pour l'edition des proprits
/* Cette classe genere une fenetre type NoteBook, pour l'edition des proprits
d'un composant le librairie.
*
d'un composant le librairie.
On peut diter:
*
On peut diter:
Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
*
Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
Documentation et mots clefs
*
Documentation et mots clefs
Nombre de part par boitier
*
Nombre de part par boitier
et autres proprirs gnrales
*
et autres proprirs gnrales
*/
*/
{
{
private
:
private
:
WinEDA_LibeditFrame
*
m_Parent
;
WinEDA_LibeditFrame
*
m_Parent
;
wxNotebook
*
m_NoteBook
;
wxNotebook
*
m_NoteBook
;
wxListBox
*
m_PartAliasList
;
wxListBox
*
m_PartAliasList
;
wxPanel
*
m_PanelBasic
;
wxPanel
*
m_PanelBasic
;
wxPanel
*
m_PanelAlias
;
wxPanel
*
m_PanelAlias
;
wxPanel
*
m_PanelDoc
;
wxPanel
*
m_PanelDoc
;
wxPanel
*
PanelField
[
NUMBER_OF_FIELDS
];
wxPanel
*
PanelField
[
NUMBER_OF_FIELDS
];
wxCheckBox
*
AsConvertButt
;
wxCheckBox
*
AsConvertButt
;
wxCheckBox
*
ShowFieldText
[
NUMBER_OF_FIELDS
];
wxCheckBox
*
ShowFieldText
[
NUMBER_OF_FIELDS
];
wxCheckBox
*
VorientFieldText
[
NUMBER_OF_FIELDS
];
wxCheckBox
*
VorientFieldText
[
NUMBER_OF_FIELDS
];
wxCheckBox
*
ShowPinNumButt
;
wxCheckBox
*
ShowPinNumButt
;
wxCheckBox
*
ShowPinNameButt
;
wxCheckBox
*
ShowPinNameButt
;
wxCheckBox
*
m_PinsNameInsideButt
;
wxCheckBox
*
m_PinsNameInsideButt
;
wxSpinCtrl
*
SelNumberOfUnits
;
wxSpinCtrl
*
SelNumberOfUnits
;
wxSpinCtrl
*
m_SetSkew
;
wxSpinCtrl
*
m_SetSkew
;
wxCheckBox
*
m_OptionPower
;
wxCheckBox
*
m_OptionPower
;
wxCheckBox
*
m_OptionPartsLocked
;
wxCheckBox
*
m_OptionPartsLocked
;
WinEDA_GraphicTextCtrl
*
FieldTextCtrl
[
NUMBER_OF_FIELDS
];
WinEDA_GraphicTextCtrl
*
FieldTextCtrl
[
NUMBER_OF_FIELDS
];
WinEDA_PositionCtrl
*
FieldPosition
[
NUMBER_OF_FIELDS
];
WinEDA_PositionCtrl
*
FieldPosition
[
NUMBER_OF_FIELDS
];
int
FieldFlags
[
NUMBER_OF_FIELDS
];
int
FieldFlags
[
NUMBER_OF_FIELDS
];
int
FieldOrient
[
NUMBER_OF_FIELDS
];
int
FieldOrient
[
NUMBER_OF_FIELDS
];
wxRadioBox
*
FieldHJustify
[
NUMBER_OF_FIELDS
];
wxRadioBox
*
FieldHJustify
[
NUMBER_OF_FIELDS
];
wxRadioBox
*
FieldVJustify
[
NUMBER_OF_FIELDS
];
wxRadioBox
*
FieldVJustify
[
NUMBER_OF_FIELDS
];
WinEDA_EnterText
*
m_Doc
;
WinEDA_EnterText
*
m_Doc
;
WinEDA_EnterText
*
m_Docfile
;
WinEDA_EnterText
*
m_Docfile
;
WinEDA_EnterText
*
m_Keywords
;
WinEDA_EnterText
*
m_Keywords
;
bool
m_RecreateToolbar
;
bool
m_RecreateToolbar
;
int
m_AliasLocation
;
int
m_AliasLocation
;
public
:
public
:
// Constructor and destructor
WinEDA_PartPropertiesFrame
(
WinEDA_LibeditFrame
*
parent
,
wxPoint
&
pos
);
// Constructor and destructor
~
WinEDA_PartPropertiesFrame
()
WinEDA_PartPropertiesFrame
(
WinEDA_LibeditFrame
*
parent
,
wxPoint
&
pos
);
{
~
WinEDA_PartPropertiesFrame
()
};
{
};
private
:
private
:
void
BuildPanelBasic
();
void
BuildPanelBasic
();
void
BuildPanelDoc
();
void
BuildPanelDoc
();
void
BuildPanelAlias
();
void
BuildPanelAlias
();
void
BuildPanelEditField
(
int
fieldId
);
void
BuildPanelEditField
(
int
fieldId
);
void
PartPropertiesAccept
(
wxCommandEvent
&
event
);
void
PartPropertiesAccept
(
wxCommandEvent
&
event
);
void
OnQuit
(
wxCommandEvent
&
event
);
void
OnQuit
(
wxCommandEvent
&
event
);
void
DeleteAllAliasOfPart
(
wxCommandEvent
&
event
);
void
DeleteAllAliasOfPart
(
wxCommandEvent
&
event
);
void
DeleteAliasOfPart
(
wxCommandEvent
&
event
);
void
DeleteAliasOfPart
(
wxCommandEvent
&
event
);
void
AddAliasOfPart
(
wxCommandEvent
&
event
);
void
AddAliasOfPart
(
wxCommandEvent
&
event
);
bool
ChangeNbUnitsPerPackage
(
int
newUnit
);
bool
ChangeNbUnitsPerPackage
(
int
newUnit
);
bool
SetUnsetConvert
();
bool
SetUnsetConvert
();
void
CopyDocToAlias
(
wxCommandEvent
&
event
);
void
CopyDocToAlias
(
wxCommandEvent
&
event
);
void
BrowseAndSelectDocFile
(
wxCommandEvent
&
event
);
void
BrowseAndSelectDocFile
(
wxCommandEvent
&
event
);
DECLARE_EVENT_TABLE
()
DECLARE_EVENT_TABLE
()
};
};
BEGIN_EVENT_TABLE
(
WinEDA_PartPropertiesFrame
,
wxDialog
)
BEGIN_EVENT_TABLE
(
WinEDA_PartPropertiesFrame
,
wxDialog
)
EVT_BUTTON
(
ID_ACCEPT_PART_PROPERTIES
,
WinEDA_PartPropertiesFrame
::
PartPropertiesAccept
)
EVT_BUTTON
(
ID_ACCEPT_PART_PROPERTIES
,
WinEDA_PartPropertiesFrame
::
PartPropertiesAccept
)
EVT_BUTTON
(
ID_CLOSE_PART_PROPERTIES
,
WinEDA_PartPropertiesFrame
::
OnQuit
)
EVT_BUTTON
(
ID_CLOSE_PART_PROPERTIES
,
WinEDA_PartPropertiesFrame
::
OnQuit
)
EVT_BUTTON
(
ID_ADD_ALIAS
,
WinEDA_PartPropertiesFrame
::
AddAliasOfPart
)
EVT_BUTTON
(
ID_ADD_ALIAS
,
WinEDA_PartPropertiesFrame
::
AddAliasOfPart
)
EVT_BUTTON
(
ID_DELETE_ONE_ALIAS
,
WinEDA_PartPropertiesFrame
::
DeleteAliasOfPart
)
EVT_BUTTON
(
ID_DELETE_ONE_ALIAS
,
WinEDA_PartPropertiesFrame
::
DeleteAliasOfPart
)
EVT_BUTTON
(
ID_DELETE_ALL_ALIAS
,
WinEDA_PartPropertiesFrame
::
DeleteAllAliasOfPart
)
EVT_BUTTON
(
ID_DELETE_ALL_ALIAS
,
WinEDA_PartPropertiesFrame
::
DeleteAllAliasOfPart
)
EVT_BUTTON
(
ID_COPY_DOC_TO_ALIAS
,
WinEDA_PartPropertiesFrame
::
CopyDocToAlias
)
EVT_BUTTON
(
ID_COPY_DOC_TO_ALIAS
,
WinEDA_PartPropertiesFrame
::
CopyDocToAlias
)
EVT_BUTTON
(
ID_BROWSE_DOC_FILES
,
WinEDA_PartPropertiesFrame
::
BrowseAndSelectDocFile
)
EVT_BUTTON
(
ID_BROWSE_DOC_FILES
,
WinEDA_PartPropertiesFrame
::
BrowseAndSelectDocFile
)
END_EVENT_TABLE
()
END_EVENT_TABLE
()
/*****************************************************************/
/*****************************************************************/
void
WinEDA_LibeditFrame
::
InstallLibeditFrame
(
const
wxPoint
&
pos
)
void
WinEDA_LibeditFrame
::
InstallLibeditFrame
(
const
wxPoint
&
pos
)
/*****************************************************************/
/*****************************************************************/
{
{
wxPoint
fpos
=
pos
;
wxPoint
fpos
=
pos
;
WinEDA_PartPropertiesFrame
*
frame
=
new
WinEDA_PartPropertiesFrame
(
this
,
fpos
);
WinEDA_PartPropertiesFrame
*
frame
=
frame
->
ShowModal
();
frame
->
Destroy
();
new
WinEDA_PartPropertiesFrame
(
this
,
fpos
);
frame
->
ShowModal
();
frame
->
Destroy
();
}
}
#define XSIZE 370
#define XSIZE 370
#define YSIZE 385
#define YSIZE 385
/**********************************************************************************/
/**********************************************************************************/
WinEDA_PartPropertiesFrame
::
WinEDA_PartPropertiesFrame
(
WinEDA_LibeditFrame
*
parent
,
WinEDA_PartPropertiesFrame
::
WinEDA_PartPropertiesFrame
(
WinEDA_LibeditFrame
*
parent
,
wxPoint
&
framepos
)
:
wxPoint
&
framepos
)
:
wxDialog
(
parent
,
-
1
,
wxEmptyString
,
framepos
,
wxSize
(
XSIZE
,
YSIZE
),
wxDialog
(
parent
,
-
1
,
wxEmptyString
,
framepos
,
wxSize
(
XSIZE
,
YSIZE
),
DIALOG_STYLE
)
DIALOG_STYLE
)
/**********************************************************************************/
/**********************************************************************************/
{
{
wxPoint
pos
;
wxPoint
pos
;
wxLayoutConstraints
*
c
;
wxLayoutConstraints
*
c
;
wxString
msg_text
;
wxString
msg_text
;
wxButton
*
Button
;
wxButton
*
Button
;
int
ii
;
int
ii
;
m_Parent
=
parent
;
m_Parent
=
parent
;
m_RecreateToolbar
=
FALSE
;
m_RecreateToolbar
=
FALSE
;
SetFont
(
*
g_DialogFont
);
SetFont
(
*
g_DialogFont
);
SetAutoLayout
(
TRUE
);
SetAutoLayout
(
TRUE
);
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
FieldFlags
[
ii
]
=
0
;
FieldFlags
[
ii
]
=
0
;
m_AliasLocation
=
-
1
;
m_AliasLocation
=
-
1
;
if
(
CurrentLibEntry
)
if
(
CurrentLibEntry
)
{
{
msg_text
=
_
(
"Properties for "
);
msg_text
=
_
(
"Properties for "
);
if
(
!
CurrentAliasName
.
IsEmpty
()
)
if
(
!
CurrentAliasName
.
IsEmpty
()
)
{
{
m_AliasLocation
=
LocateAlias
(
CurrentLibEntry
->
m_AliasList
,
CurrentAliasName
);
m_AliasLocation
=
LocateAlias
(
CurrentLibEntry
->
m_AliasList
,
CurrentAliasName
);
SetTitle
(
msg_text
+
CurrentAliasName
+
SetTitle
(
msg_text
+
CurrentAliasName
+
_
(
"(alias of "
)
+
_
(
"(alias of "
)
+
wxString
(
CurrentLibEntry
->
m_Name
.
m_Text
)
wxString
(
CurrentLibEntry
->
m_Name
.
m_Text
)
+
wxT
(
")"
)
);
+
wxT
(
")"
)
);
}
}
else
else
{
{
SetTitle
(
msg_text
+
CurrentLibEntry
->
m_Name
.
m_Text
);
SetTitle
(
msg_text
+
CurrentLibEntry
->
m_Name
.
m_Text
);
CurrentAliasName
.
Empty
();
CurrentAliasName
.
Empty
();
}
}
FieldFlags
[
REFERENCE
]
=
CurrentLibEntry
->
m_Prefix
.
m_Attributs
;
FieldFlags
[
REFERENCE
]
=
CurrentLibEntry
->
m_Prefix
.
m_Attributs
;
FieldOrient
[
REFERENCE
]
=
CurrentLibEntry
->
m_Prefix
.
m_Orient
;
FieldOrient
[
REFERENCE
]
=
CurrentLibEntry
->
m_Prefix
.
m_Orient
;
FieldFlags
[
VALUE
]
=
CurrentLibEntry
->
m_Name
.
m_Attributs
;
FieldFlags
[
VALUE
]
=
CurrentLibEntry
->
m_Name
.
m_Attributs
;
FieldOrient
[
VALUE
]
=
CurrentLibEntry
->
m_Name
.
m_Orient
;
FieldOrient
[
VALUE
]
=
CurrentLibEntry
->
m_Name
.
m_Orient
;
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
while
(
Field
)
while
(
Field
)
{
{
FieldFlags
[
Field
->
m_FieldId
]
=
Field
->
m_Attributs
;
FieldFlags
[
Field
->
m_FieldId
]
=
Field
->
m_Attributs
;
FieldOrient
[
Field
->
m_FieldId
]
=
Field
->
m_Orient
;
FieldOrient
[
Field
->
m_FieldId
]
=
Field
->
m_Orient
;
Field
=
(
LibDrawField
*
)
Field
->
Pnext
;
Field
=
(
LibDrawField
*
)
Field
->
Pnext
;
}
}
}
}
else
else
SetTitle
(
_
(
"Lib Component Properties"
));
SetTitle
(
_
(
"Lib Component Properties"
)
);
m_NoteBook
=
new
wxNotebook
(
this
,
ID_LIBEDIT_NOTEBOOK
,
m_NoteBook
=
new
wxNotebook
(
this
,
ID_LIBEDIT_NOTEBOOK
,
wxDefaultPosition
,
wxSize
(
XSIZE
-
6
,
YSIZE
-
70
)
);
wxDefaultPosition
,
wxSize
(
XSIZE
-
6
,
YSIZE
-
70
)
);
SetFont
(
*
g_DialogFont
);
m_NoteBook
->
SetAutoLayout
(
TRUE
);
SetFont
(
*
g_DialogFont
);
c
=
new
wxLayoutConstraints
;
m_NoteBook
->
SetAutoLayout
(
TRUE
);
c
->
left
.
SameAs
(
this
,
wxLeft
,
4
);
c
=
new
wxLayoutConstraints
;
c
->
right
.
SameAs
(
this
,
wxRight
,
4
);
c
->
left
.
SameAs
(
this
,
wxLeft
,
4
);
c
->
top
.
SameAs
(
this
,
wxTop
,
4
);
c
->
right
.
SameAs
(
this
,
wxRight
,
4
);
c
->
bottom
.
SameAs
(
this
,
wxBottom
,
40
);
c
->
top
.
SameAs
(
this
,
wxTop
,
4
);
m_NoteBook
->
SetConstraints
(
c
);
c
->
bottom
.
SameAs
(
this
,
wxBottom
,
40
);
m_NoteBook
->
SetConstraints
(
c
);
/* Creation des boutons de commande */
pos
.
x
=
50
;
pos
.
y
=
YSIZE
-
60
;
/* Creation des boutons de commande */
Button
=
new
wxButton
(
this
,
ID_CLOSE_PART_PROPERTIES
,
pos
.
x
=
50
;
pos
.
y
=
YSIZE
-
60
;
_
(
"Cancel"
),
pos
);
Button
=
new
wxButton
(
this
,
ID_CLOSE_PART_PROPERTIES
,
Button
->
SetForegroundColour
(
*
wxBLUE
);
_
(
"Cancel"
),
pos
);
c
=
new
wxLayoutConstraints
;
c
->
left
.
SameAs
(
this
,
wxLeft
,
20
);
Button
->
SetForegroundColour
(
*
wxBLUE
);
c
->
height
.
AsIs
();
c
=
new
wxLayoutConstraints
;
c
->
width
.
AsIs
();
c
->
left
.
SameAs
(
this
,
wxLeft
,
20
);
c
->
bottom
.
SameAs
(
this
,
wxBottom
,
5
);
c
->
height
.
AsIs
();
Button
->
SetConstraints
(
c
);
c
->
width
.
AsIs
();
c
->
bottom
.
SameAs
(
this
,
wxBottom
,
5
);
pos
.
x
+=
Button
->
GetDefaultSize
().
x
+
70
;
Button
->
SetConstraints
(
c
);
Button
=
new
wxButton
(
this
,
ID_ACCEPT_PART_PROPERTIES
,
_
(
"Ok"
),
pos
);
pos
.
x
+=
Button
->
GetDefaultSize
().
x
+
70
;
Button
->
SetForegroundColour
(
*
wxRED
);
Button
=
new
wxButton
(
this
,
ID_ACCEPT_PART_PROPERTIES
,
c
=
new
wxLayoutConstraints
;
_
(
"Ok"
),
pos
);
c
->
right
.
SameAs
(
this
,
wxRight
,
20
);
c
->
height
.
AsIs
();
Button
->
SetForegroundColour
(
*
wxRED
);
c
->
width
.
AsIs
();
c
=
new
wxLayoutConstraints
;
c
->
bottom
.
SameAs
(
this
,
wxBottom
,
5
);
c
->
right
.
SameAs
(
this
,
wxRight
,
20
);
Button
->
SetConstraints
(
c
);
c
->
height
.
AsIs
();
c
->
width
.
AsIs
();
// Add panel Basic
c
->
bottom
.
SameAs
(
this
,
wxBottom
,
5
);
BuildPanelBasic
();
Button
->
SetConstraints
(
c
);
m_NoteBook
->
AddPage
(
m_PanelBasic
,
_
(
"Options"
),
TRUE
);
// Add panel Basic
BuildPanelBasic
();
// Add Panel Documentation
m_NoteBook
->
AddPage
(
m_PanelBasic
,
_
(
"Options"
),
TRUE
);
BuildPanelDoc
();
m_NoteBook
->
AddPage
(
m_PanelDoc
,
_
(
"Doc"
),
FALSE
);
// Add Panel Documentation
// Add Panel Alias List
BuildPanelDoc
();
BuildPanelAlias
();
m_NoteBook
->
AddPage
(
m_PanelDoc
,
_
(
"Doc"
),
FALSE
);
m_NoteBook
->
AddPage
(
m_PanelAlias
,
_
(
"Alias"
),
FALSE
);
// Add Panel Alias List
// Add panel Fields
BuildPanelAlias
();
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
BuildPanelEditField
(
ii
);
m_NoteBook
->
AddPage
(
m_PanelAlias
,
_
(
"Alias"
),
FALSE
);
// Add panel Fields
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
BuildPanelEditField
(
ii
);
}
}
/*****************************************************/
/*****************************************************/
void
WinEDA_PartPropertiesFrame
::
BuildPanelAlias
()
void
WinEDA_PartPropertiesFrame
::
BuildPanelAlias
()
/*****************************************************/
/*****************************************************/
/* create the panel for component alias list editing
/* create the panel for component alias list editing
*/
*/
{
{
wxPoint
pos
;
wxPoint
pos
;
wxButton
*
Button
;
wxButton
*
Button
;
m_PanelAlias
=
new
wxPanel
(
m_NoteBook
,
-
1
);
m_PanelAlias
=
new
wxPanel
(
m_NoteBook
,
-
1
);
m_PanelAlias
->
SetFont
(
*
g_DialogFont
);
wxLayoutConstraints
*
c
=
new
wxLayoutConstraints
;
m_PanelAlias
->
SetFont
(
*
g_DialogFont
);
c
->
left
.
SameAs
(
m_NoteBook
,
wxLeft
);
wxLayoutConstraints
*
c
=
new
wxLayoutConstraints
;
c
->
right
.
SameAs
(
m_NoteBook
,
wxRight
);
c
->
left
.
SameAs
(
m_NoteBook
,
wxLeft
);
c
->
bottom
.
SameAs
(
m_NoteBook
,
wxBottom
);
c
->
right
.
SameAs
(
m_NoteBook
,
wxRight
);
m_PanelAlias
->
SetConstraints
(
c
);
c
->
bottom
.
SameAs
(
m_NoteBook
,
wxBottom
);
m_PanelAlias
->
SetConstraints
(
c
);
pos
.
x
=
200
;
pos
.
y
=
70
;
Button
=
new
wxButton
(
m_PanelAlias
,
ID_ADD_ALIAS
,
_
(
"Add"
),
pos
);
pos
.
x
=
200
;
pos
.
y
=
70
;
Button
->
SetForegroundColour
(
*
wxBLUE
);
Button
=
new
wxButton
(
m_PanelAlias
,
ID_ADD_ALIAS
,
_
(
"Add"
),
pos
);
pos
.
y
+=
Button
->
GetSize
().
y
+
10
;
Button
->
SetForegroundColour
(
*
wxBLUE
);
Button
=
new
wxButton
(
m_PanelAlias
,
ID_DELETE_ONE_ALIAS
,
_
(
"Delete"
),
pos
);
pos
.
y
+=
Button
->
GetSize
().
y
+
10
;
Button
->
SetForegroundColour
(
*
wxRED
);
Button
=
new
wxButton
(
m_PanelAlias
,
ID_DELETE_ONE_ALIAS
,
_
(
"Delete"
),
pos
);
pos
.
y
+=
Button
->
GetSize
().
y
+
10
;
Button
=
new
wxButton
(
m_PanelAlias
,
ID_DELETE_ALL_ALIAS
,
Button
->
SetForegroundColour
(
*
wxRED
);
_
(
"Delete All"
),
pos
);
Button
->
SetForegroundColour
(
*
wxRED
);
pos
.
y
+=
Button
->
GetSize
().
y
+
10
;
if
(
!
CurrentAliasName
.
IsEmpty
()
)
Button
->
Enable
(
FALSE
);
Button
=
new
wxButton
(
m_PanelAlias
,
ID_DELETE_ALL_ALIAS
,
_
(
"Delete All"
),
pos
);
pos
.
x
=
5
;
pos
.
y
=
30
;
m_PartAliasList
=
new
wxListBox
(
m_PanelAlias
,
Button
->
SetForegroundColour
(
*
wxRED
);
-
1
,
if
(
!
CurrentAliasName
.
IsEmpty
()
)
pos
,
wxSize
(
160
,
170
),
Button
->
Enable
(
FALSE
);
0
,
NULL
,
wxLB_ALWAYS_SB
|
wxLB_SINGLE
);
pos
.
x
=
5
;
pos
.
y
=
30
;
wxStaticText
*
Msg
=
new
wxStaticText
(
m_PanelAlias
,
-
1
,
_
(
"Alias"
),
m_PartAliasList
=
new
wxListBox
(
m_PanelAlias
,
wxPoint
(
pos
.
x
,
pos
.
y
-
20
)
);
-
1
,
Msg
->
SetForegroundColour
(
wxColour
(
200
,
0
,
0
)
);
pos
,
wxSize
(
160
,
170
),
0
,
NULL
,
/* lecture des noms des alias */
wxLB_ALWAYS_SB
|
wxLB_SINGLE
);
if
(
CurrentLibEntry
)
{
wxStaticText
*
Msg
=
new
wxStaticText
(
m_PanelAlias
,
-
1
,
_
(
"Alias"
),
for
(
unsigned
ii
=
0
;
ii
<
CurrentLibEntry
->
m_AliasList
.
GetCount
();
ii
+=
ALIAS_NEXT
)
wxPoint
(
pos
.
x
,
pos
.
y
-
20
)
);
m_PartAliasList
->
Append
(
CurrentLibEntry
->
m_AliasList
[
ii
+
ALIAS_NAME
]);
}
Msg
->
SetForegroundColour
(
wxColour
(
200
,
0
,
0
)
);
/* lecture des noms des alias */
if
(
CurrentLibEntry
)
{
for
(
unsigned
ii
=
0
;
ii
<
CurrentLibEntry
->
m_AliasList
.
GetCount
();
ii
+=
ALIAS_NEXT
)
m_PartAliasList
->
Append
(
CurrentLibEntry
->
m_AliasList
[
ii
+
ALIAS_NAME
]
);
}
}
}
/*****************************************************/
/*****************************************************/
void
WinEDA_PartPropertiesFrame
::
BuildPanelDoc
()
void
WinEDA_PartPropertiesFrame
::
BuildPanelDoc
()
/*****************************************************/
/*****************************************************/
/* create the panel for component doc editing
/* create the panel for component doc editing
*/
*/
{
{
wxPoint
pos
;
wxPoint
pos
;
wxButton
*
Button
;
wxButton
*
Button
;
wxString
msg_text
;
wxString
msg_text
;
m_PanelDoc
=
new
wxPanel
(
m_NoteBook
,
-
1
);
m_PanelDoc
=
new
wxPanel
(
m_NoteBook
,
-
1
);
m_PanelDoc
->
SetFont
(
*
g_DialogFont
);
wxLayoutConstraints
*
c
=
new
wxLayoutConstraints
;
m_PanelDoc
->
SetFont
(
*
g_DialogFont
);
c
->
left
.
SameAs
(
m_NoteBook
,
wxLeft
);
wxLayoutConstraints
*
c
=
new
wxLayoutConstraints
;
c
->
right
.
SameAs
(
m_NoteBook
,
wxRight
);
c
->
left
.
SameAs
(
m_NoteBook
,
wxLeft
);
c
->
bottom
.
SameAs
(
m_NoteBook
,
wxBottom
);
c
->
right
.
SameAs
(
m_NoteBook
,
wxRight
);
m_PanelDoc
->
SetConstraints
(
c
);
c
->
bottom
.
SameAs
(
m_NoteBook
,
wxBottom
);
m_PanelDoc
->
SetConstraints
(
c
);
pos
.
x
=
5
;
pos
.
y
=
15
;
pos
.
x
=
5
;
pos
.
y
=
15
;
if
(
CurrentLibEntry
)
{
if
(
CurrentLibEntry
)
msg_text
=
_
(
"Properties for "
);
{
if
(
!
CurrentAliasName
.
IsEmpty
()
)
msg_text
=
_
(
"Properties for "
);
{
if
(
!
CurrentAliasName
.
IsEmpty
()
)
msg_text
+=
_
(
"alias "
);
{
msg_text
+=
CurrentAliasName
;
msg_text
+=
_
(
"alias "
);
}
msg_text
+=
CurrentAliasName
;
else
}
{
else
msg_text
+=
CurrentLibEntry
->
m_Name
.
m_Text
;
{
}
msg_text
+=
CurrentLibEntry
->
m_Name
.
m_Text
;
wxStaticText
*
text
=
new
wxStaticText
(
m_PanelDoc
,
-
1
,
msg_text
,
pos
);
}
text
->
SetForegroundColour
(
*
wxBLUE
);
wxStaticText
*
text
=
new
wxStaticText
(
m_PanelDoc
,
-
1
,
msg_text
,
pos
);
}
text
->
SetForegroundColour
(
*
wxBLUE
);
pos
.
y
+=
30
;
}
if
(
m_AliasLocation
>=
0
)
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC
];
pos
.
y
+=
30
;
else
if
(
m_AliasLocation
>=
0
)
{
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC
];
if
(
CurrentLibEntry
&&
CurrentLibEntry
->
m_Doc
)
else
msg_text
=
CurrentLibEntry
->
m_Doc
;
{
}
if
(
CurrentLibEntry
&&
CurrentLibEntry
->
m_Doc
)
m_Doc
=
new
WinEDA_EnterText
(
m_PanelDoc
,
msg_text
=
CurrentLibEntry
->
m_Doc
;
_
(
"Doc:"
),
msg_text
,
}
pos
,
wxSize
(
285
,
-
1
)
);
m_Doc
=
new
WinEDA_EnterText
(
m_PanelDoc
,
_
(
"Doc:"
),
msg_text
,
pos
.
y
+=
40
;
pos
,
wxSize
(
285
,
-
1
)
);
msg_text
.
Empty
();
if
(
m_AliasLocation
>=
0
)
pos
.
y
+=
40
;
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_KEYWORD
];
msg_text
.
Empty
();
else
if
(
m_AliasLocation
>=
0
)
{
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_KEYWORD
];
if
(
CurrentLibEntry
)
msg_text
=
CurrentLibEntry
->
m_KeyWord
;
else
}
{
m_Keywords
=
new
WinEDA_EnterText
(
m_PanelDoc
,
if
(
CurrentLibEntry
)
_
(
"Keywords:"
),
msg_text
,
msg_text
=
CurrentLibEntry
->
m_KeyWord
;
pos
,
wxSize
(
285
,
-
1
)
);
}
pos
.
y
+=
40
;
m_Keywords
=
new
WinEDA_EnterText
(
m_PanelDoc
,
msg_text
.
Empty
();
_
(
"Keywords:"
),
msg_text
,
if
(
m_AliasLocation
>=
0
)
pos
,
wxSize
(
285
,
-
1
)
);
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC_FILENAME
];
else
pos
.
y
+=
40
;
{
msg_text
.
Empty
();
if
(
CurrentLibEntry
)
msg_text
=
CurrentLibEntry
->
m_DocFile
;
if
(
m_AliasLocation
>=
0
)
}
msg_text
=
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC_FILENAME
];
m_Docfile
=
new
WinEDA_EnterText
(
m_PanelDoc
,
else
_
(
"DocFileName:"
),
msg_text
,
{
pos
,
wxSize
(
285
,
-
1
)
);
if
(
CurrentLibEntry
)
msg_text
=
CurrentLibEntry
->
m_DocFile
;
pos
.
y
+=
40
;
}
Button
=
new
wxButton
(
m_PanelDoc
,
ID_COPY_DOC_TO_ALIAS
,
m_Docfile
=
new
WinEDA_EnterText
(
m_PanelDoc
,
_
(
"Copy Doc"
),
pos
);
_
(
"DocFileName:"
),
msg_text
,
Button
->
SetForegroundColour
(
*
wxRED
);
pos
,
wxSize
(
285
,
-
1
)
);
if
(
m_AliasLocation
<
0
)
Button
->
Enable
(
FALSE
);
pos
.
y
+=
40
;
Button
=
new
wxButton
(
m_PanelDoc
,
ID_BROWSE_DOC_FILES
,
Button
=
new
wxButton
(
m_PanelDoc
,
ID_COPY_DOC_TO_ALIAS
,
_
(
"Browse DocFiles"
),
wxPoint
(
pos
.
x
+
140
,
pos
.
y
)
);
_
(
"Copy Doc"
),
pos
);
Button
->
SetForegroundColour
(
*
wxBLUE
);
Button
->
SetForegroundColour
(
*
wxRED
);
if
(
m_AliasLocation
<
0
)
Button
->
Enable
(
FALSE
);
Button
=
new
wxButton
(
m_PanelDoc
,
ID_BROWSE_DOC_FILES
,
_
(
"Browse DocFiles"
),
wxPoint
(
pos
.
x
+
140
,
pos
.
y
)
);
Button
->
SetForegroundColour
(
*
wxBLUE
);
}
}
/*****************************************************/
/*****************************************************/
void
WinEDA_PartPropertiesFrame
::
BuildPanelBasic
()
void
WinEDA_PartPropertiesFrame
::
BuildPanelBasic
()
/*****************************************************/
/*****************************************************/
/* create the basic panel for component properties editing
/* create the basic panel for component properties editing
*/
*/
{
{
wxPoint
pos
;
wxPoint
pos
;
m_PanelBasic
=
new
wxPanel
(
m_NoteBook
,
ID_PANEL_BASIC
);
m_PanelBasic
=
new
wxPanel
(
m_NoteBook
,
ID_PANEL_BASIC
);
m_PanelBasic
->
SetFont
(
*
g_DialogFont
);
wxLayoutConstraints
*
c
=
new
wxLayoutConstraints
;
m_PanelBasic
->
SetFont
(
*
g_DialogFont
);
c
->
left
.
SameAs
(
m_NoteBook
,
wxLeft
);
wxLayoutConstraints
*
c
=
new
wxLayoutConstraints
;
c
->
right
.
SameAs
(
m_NoteBook
,
wxRight
);
c
->
left
.
SameAs
(
m_NoteBook
,
wxLeft
);
c
->
bottom
.
SameAs
(
m_NoteBook
,
wxBottom
);
c
->
right
.
SameAs
(
m_NoteBook
,
wxRight
);
m_PanelBasic
->
SetConstraints
(
c
);
c
->
bottom
.
SameAs
(
m_NoteBook
,
wxBottom
);
m_PanelBasic
->
SetConstraints
(
c
);
pos
.
x
=
5
;
pos
.
y
=
25
;
new
wxStaticBox
(
m_PanelBasic
,
-
1
,
_
(
"General :"
),
pos
,
wxSize
(
250
,
120
));
pos
.
x
=
5
;
pos
.
y
=
25
;
new
wxStaticBox
(
m_PanelBasic
,
-
1
,
_
(
"General :"
),
pos
,
wxSize
(
250
,
120
)
);
pos
.
x
=
10
;
pos
.
y
+=
22
;
AsConvertButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"As Convert"
),
pos
);
pos
.
x
=
10
;
pos
.
y
+=
22
;
if
(
g_AsDeMorgan
)
AsConvertButt
->
SetValue
(
TRUE
);
AsConvertButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"As Convert"
),
pos
);
pos
.
y
+=
20
;
if
(
g_AsDeMorgan
)
ShowPinNumButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Show Pin Num"
),
pos
);
AsConvertButt
->
SetValue
(
TRUE
);
if
(
CurrentLibEntry
)
{
pos
.
y
+=
20
;
if
(
CurrentLibEntry
->
m_DrawPinNum
)
ShowPinNumButt
->
SetValue
(
TRUE
);
ShowPinNumButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Show Pin Num"
),
pos
);
}
else
ShowPinNumButt
->
SetValue
(
TRUE
);
if
(
CurrentLibEntry
)
{
pos
.
y
+=
20
;
if
(
CurrentLibEntry
->
m_DrawPinNum
)
ShowPinNameButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Show Pin Name"
),
pos
);
ShowPinNumButt
->
SetValue
(
TRUE
);
if
(
CurrentLibEntry
)
}
{
else
if
(
CurrentLibEntry
->
m_DrawPinName
)
ShowPinNameButt
->
SetValue
(
TRUE
);
ShowPinNumButt
->
SetValue
(
TRUE
);
}
else
ShowPinNameButt
->
SetValue
(
TRUE
);
pos
.
y
+=
20
;
ShowPinNameButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Show Pin Name"
),
pos
);
pos
.
y
+=
20
;
m_PinsNameInsideButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Pin Name Inside"
),
pos
);
if
(
CurrentLibEntry
)
if
(
CurrentLibEntry
)
{
{
if
(
CurrentLibEntry
->
m_DrawPinName
)
if
(
CurrentLibEntry
->
m_TextInside
)
m_PinsNameInsideButt
->
SetValue
(
TRUE
);
ShowPinNameButt
->
SetValue
(
TRUE
);
}
}
else
m_PinsNameInsideButt
->
SetValue
(
TRUE
);
else
ShowPinNameButt
->
SetValue
(
TRUE
);
pos
.
y
+=
40
;
new
wxStaticText
(
m_PanelBasic
,
-
1
,
_
(
"Number of Units:"
),
pos
);
pos
.
y
+=
20
;
pos
.
y
+=
15
;
m_PinsNameInsideButt
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Pin Name Inside"
),
pos
);
wxString
number
;
if
(
CurrentLibEntry
)
number
.
Printf
(
wxT
(
"%d"
),
CurrentLibEntry
->
m_UnitCount
);
if
(
CurrentLibEntry
)
else
number
=
wxT
(
"1"
);
{
SelNumberOfUnits
=
new
wxSpinCtrl
(
m_PanelBasic
,
-
1
,
number
,
pos
,
if
(
CurrentLibEntry
->
m_TextInside
)
wxDefaultSize
,
wxSP_ARROW_KEYS
|
wxSP_WRAP
,
m_PinsNameInsideButt
->
SetValue
(
TRUE
);
1
,
16
);
}
else
pos
.
y
-=
15
;
pos
.
x
+=
180
;
m_PinsNameInsideButt
->
SetValue
(
TRUE
);
new
wxStaticText
(
m_PanelBasic
,
-
1
,
_
(
"Skew:"
),
pos
);
pos
.
y
+=
15
;
pos
.
y
+=
40
;
if
(
CurrentLibEntry
&&
CurrentLibEntry
->
m_TextInside
)
new
wxStaticText
(
m_PanelBasic
,
-
1
,
_
(
"Number of Units:"
),
pos
);
number
.
Printf
(
wxT
(
"%d"
),
CurrentLibEntry
->
m_TextInside
);
else
number
=
wxT
(
"40"
);
pos
.
y
+=
15
;
m_SetSkew
=
new
wxSpinCtrl
(
m_PanelBasic
,
-
1
,
number
,
pos
,
wxString
number
;
wxDefaultSize
,
wxSP_ARROW_KEYS
|
wxSP_WRAP
,
if
(
CurrentLibEntry
)
1
,
100
);
number
.
Printf
(
wxT
(
"%d"
),
CurrentLibEntry
->
m_UnitCount
);
else
pos
.
x
=
5
;
pos
.
y
+=
40
;
number
=
wxT
(
"1"
);
m_OptionPower
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Power Symbol"
),
pos
);
SelNumberOfUnits
=
new
wxSpinCtrl
(
m_PanelBasic
,
-
1
,
number
,
pos
,
if
(
CurrentLibEntry
)
wxDefaultSize
,
wxSP_ARROW_KEYS
|
wxSP_WRAP
,
{
1
,
16
);
if
(
CurrentLibEntry
->
m_Options
==
ENTRY_POWER
)
m_OptionPower
->
SetValue
(
TRUE
);
pos
.
y
-=
15
;
pos
.
x
+=
180
;
}
new
wxStaticText
(
m_PanelBasic
,
-
1
,
_
(
"Skew:"
),
pos
);
pos
.
y
=
m_OptionPower
->
GetRect
().
GetBottom
()
+
10
;
pos
.
y
+=
15
;
m_OptionPartsLocked
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Parts are locked"
),
pos
);
if
(
CurrentLibEntry
&&
CurrentLibEntry
->
m_TextInside
)
if
(
CurrentLibEntry
)
number
.
Printf
(
wxT
(
"%d"
),
CurrentLibEntry
->
m_TextInside
);
{
else
if
(
CurrentLibEntry
->
m_UnitSelectionLocked
)
number
=
wxT
(
"40"
);
m_OptionPartsLocked
->
SetValue
(
TRUE
);
m_SetSkew
=
new
wxSpinCtrl
(
m_PanelBasic
,
-
1
,
number
,
pos
,
}
wxDefaultSize
,
wxSP_ARROW_KEYS
|
wxSP_WRAP
,
if
(
number
==
wxT
(
"1"
)
)
m_OptionPartsLocked
->
Enable
(
FALSE
);
1
,
100
);
pos
.
x
=
5
;
pos
.
y
+=
40
;
m_OptionPower
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Power Symbol"
),
pos
);
if
(
CurrentLibEntry
)
{
if
(
CurrentLibEntry
->
m_Options
==
ENTRY_POWER
)
m_OptionPower
->
SetValue
(
TRUE
);
}
pos
.
y
=
m_OptionPower
->
GetRect
().
GetBottom
()
+
10
;
m_OptionPartsLocked
=
new
wxCheckBox
(
m_PanelBasic
,
-
1
,
_
(
"Parts are locked"
),
pos
);
if
(
CurrentLibEntry
)
{
if
(
CurrentLibEntry
->
m_UnitSelectionLocked
)
m_OptionPartsLocked
->
SetValue
(
TRUE
);
}
if
(
number
==
wxT
(
"1"
)
)
m_OptionPartsLocked
->
Enable
(
FALSE
);
}
}
/****************************************************************/
/****************************************************************/
void
WinEDA_PartPropertiesFrame
::
BuildPanelEditField
(
int
fieldId
)
void
WinEDA_PartPropertiesFrame
::
BuildPanelEditField
(
int
fieldId
)
/****************************************************************/
/****************************************************************/
{
{
wxPoint
pos
;
wxPoint
pos
;
int
xx
,
yy
;
int
xx
,
yy
;
LibDrawField
*
Field
;
LibDrawField
*
Field
;
wxString
Hjustify_list
[]
=
wxString
Hjustify_list
[]
=
{
_
(
"Left justify"
),
_
(
"Center"
),
_
(
"Right justify"
)};
{
_
(
"Left justify"
),
_
(
"Center"
),
_
(
"Right justify"
)
};
wxString
Vjustify_list
[]
=
wxString
Vjustify_list
[]
=
{
_
(
"Bottom justify"
),
_
(
"Center"
),
_
(
"Top justify"
)};
{
_
(
"Bottom justify"
),
_
(
"Center"
),
_
(
"Top justify"
)
};
int
ii
=
fieldId
;
int
ii
=
fieldId
;
PanelField
[
ii
]
=
new
wxPanel
(
m_NoteBook
,
ID_PANEL_REFERENCE
+
ii
);
PanelField
[
ii
]
=
new
wxPanel
(
m_NoteBook
,
ID_PANEL_REFERENCE
+
ii
);
PanelField
[
ii
]
->
SetFont
(
*
g_DialogFont
);
wxLayoutConstraints
*
c
=
new
wxLayoutConstraints
;
PanelField
[
ii
]
->
SetFont
(
*
g_DialogFont
);
c
->
left
.
SameAs
(
m_NoteBook
,
wxLeft
);
wxLayoutConstraints
*
c
=
new
wxLayoutConstraints
;
c
->
right
.
SameAs
(
m_NoteBook
,
wxRight
);
c
->
left
.
SameAs
(
m_NoteBook
,
wxLeft
);
c
->
bottom
.
SameAs
(
m_NoteBook
,
wxBottom
);
c
->
right
.
SameAs
(
m_NoteBook
,
wxRight
);
PanelField
[
ii
]
->
SetConstraints
(
c
);
c
->
bottom
.
SameAs
(
m_NoteBook
,
wxBottom
);
m_NoteBook
->
AddPage
(
PanelField
[
ii
],
DrawPartStruct
::
ReturnFieldName
(
ii
),
FALSE
);
PanelField
[
ii
]
->
SetConstraints
(
c
);
m_NoteBook
->
AddPage
(
PanelField
[
ii
],
DrawPartStruct
::
ReturnFieldName
(
ii
),
FALSE
);
pos
.
x
=
10
;
pos
.
y
=
10
;
ShowFieldText
[
ii
]
=
new
wxCheckBox
(
PanelField
[
ii
],
-
1
,
pos
.
x
=
10
;
pos
.
y
=
10
;
_
(
"Show Text"
),
pos
);
ShowFieldText
[
ii
]
=
new
wxCheckBox
(
PanelField
[
ii
],
-
1
,
if
(
(
FieldFlags
[
ii
]
&
TEXT_NO_VISIBLE
)
==
0
)
_
(
"Show Text"
),
pos
);
ShowFieldText
[
ii
]
->
SetValue
(
TRUE
);
if
(
(
FieldFlags
[
ii
]
&
TEXT_NO_VISIBLE
)
==
0
)
ShowFieldText
[
ii
]
->
GetSize
(
&
xx
,
&
yy
);
ShowFieldText
[
ii
]
->
SetValue
(
TRUE
);
pos
.
y
+=
yy
+
5
;
VorientFieldText
[
ii
]
=
new
wxCheckBox
(
PanelField
[
ii
],
-
1
,
ShowFieldText
[
ii
]
->
GetSize
(
&
xx
,
&
yy
);
_
(
"Vertical"
),
pos
);
pos
.
y
+=
yy
+
5
;
if
(
FieldOrient
[
ii
]
)
VorientFieldText
[
ii
]
->
SetValue
(
TRUE
);
VorientFieldText
[
ii
]
=
new
wxCheckBox
(
PanelField
[
ii
],
-
1
,
_
(
"Vertical"
),
pos
);
pos
.
x
=
150
;
pos
.
y
=
5
;
FieldHJustify
[
ii
]
=
new
wxRadioBox
(
PanelField
[
ii
],
-
1
,
if
(
FieldOrient
[
ii
]
)
_
(
"Hor Justify"
),
pos
,
wxDefaultSize
,
VorientFieldText
[
ii
]
->
SetValue
(
TRUE
);
3
,
Hjustify_list
,
1
,
wxRA_SPECIFY_COLS
);
FieldHJustify
[
ii
]
->
GetSize
(
&
xx
,
&
yy
);
pos
.
x
=
150
;
pos
.
y
=
5
;
FieldHJustify
[
ii
]
->
SetSelection
(
1
);
FieldHJustify
[
ii
]
=
new
wxRadioBox
(
PanelField
[
ii
],
-
1
,
_
(
"Hor Justify"
),
pos
,
wxDefaultSize
,
pos
.
y
+=
yy
+
5
;
3
,
Hjustify_list
,
1
,
wxRA_SPECIFY_COLS
);
FieldVJustify
[
ii
]
=
new
wxRadioBox
(
PanelField
[
ii
],
-
1
,
_
(
"Vert Justify"
),
pos
,
wxDefaultSize
,
FieldHJustify
[
ii
]
->
GetSize
(
&
xx
,
&
yy
);
3
,
Vjustify_list
,
1
,
wxRA_SPECIFY_COLS
);
FieldHJustify
[
ii
]
->
SetSelection
(
1
);
FieldVJustify
[
ii
]
->
SetSelection
(
1
);
pos
.
y
+=
yy
+
5
;
wxPoint
txtpos
;
FieldVJustify
[
ii
]
=
new
wxRadioBox
(
PanelField
[
ii
],
-
1
,
pos
.
x
=
10
;
pos
.
y
=
70
;
_
(
"Vert Justify"
),
pos
,
wxDefaultSize
,
3
,
Vjustify_list
,
1
,
wxRA_SPECIFY_COLS
);
FieldVJustify
[
ii
]
->
SetSelection
(
1
);
wxPoint
txtpos
;
pos
.
x
=
10
;
pos
.
y
=
70
;
#define POSY_OFFSET 70
#define POSY_OFFSET 70
switch
(
ii
)
{
switch
(
ii
)
case
REFERENCE
:
{
if
(
CurrentLibEntry
)
case
REFERENCE
:
{
if
(
CurrentLibEntry
)
Field
=
&
CurrentLibEntry
->
m_Prefix
;
{
txtpos
=
Field
->
m_Pos
;
Field
=
&
CurrentLibEntry
->
m_Prefix
;
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
txtpos
=
Field
->
m_Pos
;
FieldHJustify
[
ii
]
->
SetSelection
(
0
);
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
else
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
FieldHJustify
[
ii
]
->
SetSelection
(
0
);
FieldHJustify
[
ii
]
->
SetSelection
(
2
);
else
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
FieldHJustify
[
ii
]
->
SetSelection
(
2
);
FieldVJustify
[
ii
]
->
SetSelection
(
0
);
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
else
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
FieldVJustify
[
ii
]
->
SetSelection
(
0
);
FieldVJustify
[
ii
]
->
SetSelection
(
2
);
else
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
}
FieldVJustify
[
ii
]
->
SetSelection
(
2
);
else
txtpos
=
wxPoint
(
0
,
0
);
}
FieldPosition
[
ii
]
=
new
WinEDA_PositionCtrl
(
PanelField
[
ii
],
else
_
(
"Pos"
),
txtpos
,
txtpos
=
wxPoint
(
0
,
0
);
g_UnitMetric
,
pos
);
FieldPosition
[
ii
]
=
new
WinEDA_PositionCtrl
(
PanelField
[
ii
],
FieldTextCtrl
[
ii
]
=
new
WinEDA_GraphicTextCtrl
(
PanelField
[
ii
],
_
(
"Pos"
),
txtpos
,
DrawPartStruct
::
ReturnFieldName
(
ii
),
g_UnitMetric
,
pos
);
CurrentLibEntry
?
CurrentLibEntry
->
m_Prefix
.
m_Text
.
GetData
()
:
wxT
(
"U"
),
FieldTextCtrl
[
ii
]
=
new
WinEDA_GraphicTextCtrl
(
CurrentLibEntry
?
CurrentLibEntry
->
m_Prefix
.
m_Size
.
x
:
DEFAULT_TEXT_SIZE
,
PanelField
[
ii
],
g_UnitMetric
,
DrawPartStruct
::
ReturnFieldName
(
ii
),
wxPoint
(
pos
.
x
,
pos
.
y
+
FieldPosition
[
ii
]
->
GetDimension
().
y
+
POSY_OFFSET
),
CurrentLibEntry
?
200
,
TRUE
);
CurrentLibEntry
->
m_Prefix
.
m_Text
.
GetData
()
break
;
:
wxT
(
"U"
),
case
VALUE
:
CurrentLibEntry
?
CurrentLibEntry
->
if
(
CurrentLibEntry
)
m_Prefix
.
m_Size
.
x
:
DEFAULT_TEXT_SIZE
,
{
g_UnitMetric
,
Field
=
&
CurrentLibEntry
->
m_Name
;
wxPoint
(
pos
.
x
,
pos
.
y
+
txtpos
=
Field
->
m_Pos
;
FieldPosition
[
ii
]
->
GetDimension
().
y
+
POSY_OFFSET
),
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
200
,
FieldHJustify
[
ii
]
->
SetSelection
(
0
);
TRUE
);
else
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
FieldHJustify
[
ii
]
->
SetSelection
(
2
);
break
;
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
FieldVJustify
[
ii
]
->
SetSelection
(
0
);
case
VALUE
:
else
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
if
(
CurrentLibEntry
)
FieldVJustify
[
ii
]
->
SetSelection
(
2
);
{
}
Field
=
&
CurrentLibEntry
->
m_Name
;
else
txtpos
=
wxPoint
(
0
,
0
);
txtpos
=
Field
->
m_Pos
;
FieldPosition
[
ii
]
=
new
WinEDA_PositionCtrl
(
PanelField
[
ii
],
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
_
(
"Pos"
),
txtpos
,
FieldHJustify
[
ii
]
->
SetSelection
(
0
);
g_UnitMetric
,
pos
);
else
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
FieldTextCtrl
[
ii
]
=
new
WinEDA_GraphicTextCtrl
(
PanelField
[
ii
],
FieldHJustify
[
ii
]
->
SetSelection
(
2
);
DrawPartStruct
::
ReturnFieldName
(
ii
),
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
CurrentLibEntry
?
CurrentLibEntry
->
m_Name
.
m_Text
.
GetData
()
:
NULL
,
FieldVJustify
[
ii
]
->
SetSelection
(
0
);
CurrentLibEntry
?
CurrentLibEntry
->
m_Name
.
m_Size
.
x
:
DEFAULT_TEXT_SIZE
,
else
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
g_UnitMetric
,
FieldVJustify
[
ii
]
->
SetSelection
(
2
);
wxPoint
(
pos
.
x
,
pos
.
y
+
FieldPosition
[
ii
]
->
GetDimension
().
y
+
POSY_OFFSET
),
}
200
,
TRUE
);
else
break
;
txtpos
=
wxPoint
(
0
,
0
);
FieldPosition
[
ii
]
=
new
WinEDA_PositionCtrl
(
PanelField
[
ii
],
default
:
_
(
"Pos"
),
txtpos
,
int
fsize
;
g_UnitMetric
,
pos
);
wxString
ftext
;
wxPoint
fpos
;
FieldTextCtrl
[
ii
]
=
new
WinEDA_GraphicTextCtrl
(
fsize
=
DEFAULT_TEXT_SIZE
;;
PanelField
[
ii
],
Field
=
NULL
;
DrawPartStruct
::
ReturnFieldName
(
ii
),
fpos
=
wxPoint
(
0
,
0
);
CurrentLibEntry
?
CurrentLibEntry
->
m_Name
.
//recherche du Field de FieldId correspondant, s'il existe
m_Text
.
GetData
()
:
NULL
,
if
(
CurrentLibEntry
)
CurrentLibEntry
?
CurrentLibEntry
->
m_Name
.
{
m_Size
.
x
:
DEFAULT_TEXT_SIZE
,
Field
=
CurrentLibEntry
->
Fields
;
g_UnitMetric
,
while
(
Field
)
wxPoint
(
pos
.
x
,
pos
.
y
+
{
FieldPosition
[
ii
]
->
GetDimension
().
y
+
POSY_OFFSET
),
if
(
Field
->
m_FieldId
==
ii
)
200
,
{
TRUE
);
fsize
=
Field
->
m_Size
.
x
;
ftext
=
Field
->
m_Text
;
break
;
fpos
=
Field
->
m_Pos
;
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
default
:
FieldHJustify
[
ii
]
->
SetSelection
(
0
);
int
fsize
;
else
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
wxString
ftext
;
FieldHJustify
[
ii
]
->
SetSelection
(
2
);
wxPoint
fpos
;
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
fsize
=
DEFAULT_TEXT_SIZE
;;
FieldVJustify
[
ii
]
->
SetSelection
(
0
);
Field
=
NULL
;
else
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
fpos
=
wxPoint
(
0
,
0
);
FieldVJustify
[
ii
]
->
SetSelection
(
2
);
break
;
//recherche du Field de FieldId correspondant, s'il existe
}
if
(
CurrentLibEntry
)
Field
=
(
LibDrawField
*
)
Field
->
Pnext
;
{
}
Field
=
CurrentLibEntry
->
Fields
;
}
while
(
Field
)
{
FieldPosition
[
ii
]
=
new
WinEDA_PositionCtrl
(
PanelField
[
ii
],
if
(
Field
->
m_FieldId
==
ii
)
_
(
"Pos"
),
fpos
,
{
g_UnitMetric
,
pos
);
fsize
=
Field
->
m_Size
.
x
;
FieldTextCtrl
[
ii
]
=
new
WinEDA_GraphicTextCtrl
(
PanelField
[
ii
],
ftext
=
Field
->
m_Text
;
DrawPartStruct
::
ReturnFieldName
(
ii
),
fpos
=
Field
->
m_Pos
;
ftext
,
fsize
,
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
g_UnitMetric
,
FieldHJustify
[
ii
]
->
SetSelection
(
0
);
wxPoint
(
pos
.
x
,
pos
.
y
+
FieldPosition
[
ii
]
->
GetDimension
().
y
+
POSY_OFFSET
),
else
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
200
,
TRUE
);
FieldHJustify
[
ii
]
->
SetSelection
(
2
);
break
;
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
}
FieldVJustify
[
ii
]
->
SetSelection
(
0
);
else
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
FieldVJustify
[
ii
]
->
SetSelection
(
2
);
break
;
}
Field
=
(
LibDrawField
*
)
Field
->
Pnext
;
}
}
FieldPosition
[
ii
]
=
new
WinEDA_PositionCtrl
(
PanelField
[
ii
],
_
(
"Pos"
),
fpos
,
g_UnitMetric
,
pos
);
FieldTextCtrl
[
ii
]
=
new
WinEDA_GraphicTextCtrl
(
PanelField
[
ii
],
DrawPartStruct
::
ReturnFieldName
(
ii
),
ftext
,
fsize
,
g_UnitMetric
,
wxPoint
(
pos
.
x
,
pos
.
y
+
FieldPosition
[
ii
]
->
GetDimension
().
y
+
POSY_OFFSET
),
200
,
TRUE
);
break
;
}
}
}
/************************************************************************/
/************************************************************************/
void
WinEDA_PartPropertiesFrame
::
OnQuit
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
void
WinEDA_PartPropertiesFrame
::
OnQuit
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
/************************************************************************/
/************************************************************************/
{
{
// true is to force the frame to close
// true is to force the frame to close
Close
(
true
);
Close
(
true
);
}
}
/**************************************************************************/
/**************************************************************************/
void
WinEDA_PartPropertiesFrame
::
PartPropertiesAccept
(
wxCommandEvent
&
event
)
void
WinEDA_PartPropertiesFrame
::
PartPropertiesAccept
(
wxCommandEvent
&
event
)
/**************************************************************************/
/**************************************************************************/
/* Met a jour les differents parametres pour le composant en cours d'dition
/* Met a jour les differents parametres pour le composant en cours d'dition
*/
*/
{
{
int
ii
,
jj
;
int
ii
,
jj
;
int
hjustify
[
3
]
=
{
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_HJUSTIFY_CENTER
,
int
hjustify
[
3
]
=
{
GR_TEXT_HJUSTIFY_RIGHT
};
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_HJUSTIFY_CENTER
,
int
vjustify
[
3
]
=
{
GR_TEXT_VJUSTIFY_BOTTOM
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_RIGHT
GR_TEXT_VJUSTIFY_TOP
};
};
int
vjustify
[
3
]
=
{
if
(
CurrentLibEntry
==
NULL
)
GR_TEXT_VJUSTIFY_BOTTOM
,
GR_TEXT_VJUSTIFY_CENTER
,
{
GR_TEXT_VJUSTIFY_TOP
Close
();
return
;
};
}
if
(
CurrentLibEntry
==
NULL
)
m_Parent
->
m_CurrentScreen
->
SetModify
();
{
m_Parent
->
m_CurrentScreen
->
SetRefreshReq
();
Close
();
return
;
m_Parent
->
SaveCopyInUndoList
();
}
/* A new name could be entered in VALUE field.
m_Parent
->
m_CurrentScreen
->
SetModify
();
Must not be an existing alias name in alias list box */
m_Parent
->
m_CurrentScreen
->
SetRefreshReq
();
jj
=
m_PartAliasList
->
GetCount
();
m_Parent
->
SaveCopyInUndoList
();
wxString
newvalue
=
FieldTextCtrl
[
VALUE
]
->
GetText
();
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
/* A new name could be entered in VALUE field.
{
* Must not be an existing alias name in alias list box */
if
(
newvalue
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
).
GetData
())
==
0
)
jj
=
m_PartAliasList
->
GetCount
();
{
wxString
newvalue
=
FieldTextCtrl
[
VALUE
]
->
GetText
();
wxString
msg
;
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
msg
.
Printf
(
wxT
(
"Alias %s exists!"
),
newvalue
.
GetData
());
{
DisplayError
(
this
,
msg
);
if
(
newvalue
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
).
GetData
()
)
==
0
)
return
;
{
}
wxString
msg
;
}
msg
.
Printf
(
wxT
(
"Alias %s exists!"
),
newvalue
.
GetData
()
);
DisplayError
(
this
,
msg
);
/* Update the doc, keyword and doc filename strings */
return
;
if
(
m_AliasLocation
<
0
)
}
{
}
CurrentLibEntry
->
m_Doc
=
m_Doc
->
GetValue
();
CurrentLibEntry
->
m_KeyWord
=
m_Keywords
->
GetValue
();
/* Update the doc, keyword and doc filename strings */
CurrentLibEntry
->
m_DocFile
=
m_Docfile
->
GetValue
();
if
(
m_AliasLocation
<
0
)
}
{
CurrentLibEntry
->
m_Doc
=
m_Doc
->
GetValue
();
else
CurrentLibEntry
->
m_KeyWord
=
m_Keywords
->
GetValue
();
{
CurrentLibEntry
->
m_DocFile
=
m_Docfile
->
GetValue
();
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC
]
=
m_Doc
->
GetValue
();
}
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_KEYWORD
]
=
m_Keywords
->
GetValue
();
else
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC_FILENAME
]
=
m_Docfile
->
GetValue
();
{
}
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC
]
=
m_Doc
->
GetValue
();
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_KEYWORD
]
=
m_Keywords
->
GetValue
();
/* Update the alias list */
CurrentLibEntry
->
m_AliasList
[
m_AliasLocation
+
ALIAS_DOC_FILENAME
]
=
m_Docfile
->
GetValue
();
/* 1 - Add names: test for a not existing name in old alias list: */
}
jj
=
m_PartAliasList
->
GetCount
();
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
/* Update the alias list */
{
/* 1 - Add names: test for a not existing name in old alias list: */
if
(
LocateAlias
(
CurrentLibEntry
->
m_AliasList
,
m_PartAliasList
->
GetString
(
ii
))
<
0
)
jj
=
m_PartAliasList
->
GetCount
();
{
// new alias must be created
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
CurrentLibEntry
->
m_AliasList
.
Add
(
m_PartAliasList
->
GetString
(
ii
));
{
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void doc string
if
(
LocateAlias
(
CurrentLibEntry
->
m_AliasList
,
m_PartAliasList
->
GetString
(
ii
)
)
<
0
)
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void keyword list string
{
// new alias must be created
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void doc filename string
CurrentLibEntry
->
m_AliasList
.
Add
(
m_PartAliasList
->
GetString
(
ii
)
);
}
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void doc string
}
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void keyword list string
CurrentLibEntry
->
m_AliasList
.
Add
(
wxEmptyString
);
// Add a void doc filename string
/* 2 - Remove delete names: test for an non existing name in new alias list: */
}
int
kk
,
kkmax
=
CurrentLibEntry
->
m_AliasList
.
GetCount
();
}
for
(
kk
=
0
;
kk
<
kkmax
;
)
{
/* 2 - Remove delete names: test for an non existing name in new alias list: */
jj
=
m_PartAliasList
->
GetCount
();
int
kk
,
kkmax
=
CurrentLibEntry
->
m_AliasList
.
GetCount
();
wxString
aliasname
=
CurrentLibEntry
->
m_AliasList
[
kk
];
for
(
kk
=
0
;
kk
<
kkmax
;
)
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
{
{
jj
=
m_PartAliasList
->
GetCount
();
if
(
aliasname
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
).
GetData
())
==
0
)
wxString
aliasname
=
CurrentLibEntry
->
m_AliasList
[
kk
];
{
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
kk
+=
ALIAS_NEXT
;
// Alias exist in new list. keep it and test next old name
{
break
;
if
(
aliasname
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
).
GetData
()
)
==
0
)
}
{
}
kk
+=
ALIAS_NEXT
;
// Alias exist in new list. keep it and test next old name
break
;
if
(
ii
==
jj
)
// Alias not found in new list, remove it (4 strings in kk position)
}
{
}
for
(
ii
=
0
;
ii
<
ALIAS_NEXT
;
ii
++
)
CurrentLibEntry
->
m_AliasList
.
RemoveAt
(
kk
);
kkmax
=
CurrentLibEntry
->
m_AliasList
.
GetCount
();
if
(
ii
==
jj
)
// Alias not found in new list, remove it (4 strings in kk position)
}
{
for
(
ii
=
0
;
ii
<
ALIAS_NEXT
;
ii
++
)
}
CurrentLibEntry
->
m_AliasList
.
RemoveAt
(
kk
);
kkmax
=
CurrentLibEntry
->
m_AliasList
.
GetCount
();
if
(
!
FieldTextCtrl
[
REFERENCE
]
->
GetText
().
IsEmpty
()
)
}
{
}
CurrentLibEntry
->
m_Prefix
.
m_Text
=
FieldTextCtrl
[
REFERENCE
]
->
GetText
();
}
if
(
!
FieldTextCtrl
[
REFERENCE
]
->
GetText
().
IsEmpty
()
)
{
if
(
!
FieldTextCtrl
[
VALUE
]
->
GetText
().
IsEmpty
()
)
CurrentLibEntry
->
m_Prefix
.
m_Text
=
FieldTextCtrl
[
REFERENCE
]
->
GetText
();
{
}
if
(
CurrentLibEntry
->
m_Name
.
m_Text
!=
FieldTextCtrl
[
VALUE
]
->
GetText
()
)
{
if
(
!
FieldTextCtrl
[
VALUE
]
->
GetText
().
IsEmpty
()
)
m_RecreateToolbar
=
TRUE
;
{
CurrentLibEntry
->
m_Name
.
m_Text
=
FieldTextCtrl
[
VALUE
]
->
GetText
();
if
(
CurrentLibEntry
->
m_Name
.
m_Text
!=
FieldTextCtrl
[
VALUE
]
->
GetText
()
)
}
{
}
m_RecreateToolbar
=
TRUE
;
CurrentLibEntry
->
m_Name
.
m_Text
=
FieldTextCtrl
[
VALUE
]
->
GetText
();
CurrentLibEntry
->
m_Prefix
.
m_Size
.
x
=
}
CurrentLibEntry
->
m_Prefix
.
m_Size
.
y
=
FieldTextCtrl
[
REFERENCE
]
->
GetTextSize
();
}
CurrentLibEntry
->
m_Name
.
m_Size
.
x
=
CurrentLibEntry
->
m_Name
.
m_Size
.
y
=
FieldTextCtrl
[
VALUE
]
->
GetTextSize
();
CurrentLibEntry
->
m_Prefix
.
m_Size
.
x
=
CurrentLibEntry
->
m_Prefix
.
m_Size
.
y
=
FieldTextCtrl
[
REFERENCE
]
->
GetTextSize
();
CurrentLibEntry
->
m_Prefix
.
m_Pos
=
FieldPosition
[
REFERENCE
]
->
GetValue
();
CurrentLibEntry
->
m_Name
.
m_Size
.
x
=
CurrentLibEntry
->
m_Name
.
m_Pos
=
FieldPosition
[
VALUE
]
->
GetValue
();
CurrentLibEntry
->
m_Name
.
m_Size
.
y
=
FieldTextCtrl
[
VALUE
]
->
GetTextSize
();
CurrentLibEntry
->
m_Prefix
.
m_Orient
=
VorientFieldText
[
REFERENCE
]
->
GetValue
()
?
1
:
0
;
CurrentLibEntry
->
m_Prefix
.
m_Pos
=
FieldPosition
[
REFERENCE
]
->
GetValue
();
CurrentLibEntry
->
m_Name
.
m_Orient
=
VorientFieldText
[
VALUE
]
->
GetValue
()
?
1
:
0
;
CurrentLibEntry
->
m_Name
.
m_Pos
=
FieldPosition
[
VALUE
]
->
GetValue
();
CurrentLibEntry
->
m_Prefix
.
m_HJustify
=
CurrentLibEntry
->
m_Prefix
.
m_Orient
=
VorientFieldText
[
REFERENCE
]
->
GetValue
()
?
1
:
0
;
hjustify
[
FieldHJustify
[
REFERENCE
]
->
GetSelection
()];
CurrentLibEntry
->
m_Name
.
m_Orient
=
VorientFieldText
[
VALUE
]
->
GetValue
()
?
1
:
0
;
CurrentLibEntry
->
m_Prefix
.
m_VJustify
=
vjustify
[
FieldVJustify
[
REFERENCE
]
->
GetSelection
()];
CurrentLibEntry
->
m_Prefix
.
m_HJustify
=
CurrentLibEntry
->
m_Name
.
m_HJustify
=
hjustify
[
FieldHJustify
[
REFERENCE
]
->
GetSelection
()];
hjustify
[
FieldHJustify
[
VALUE
]
->
GetSelection
()];
CurrentLibEntry
->
m_Prefix
.
m_VJustify
=
CurrentLibEntry
->
m_Name
.
m_VJustify
=
vjustify
[
FieldVJustify
[
REFERENCE
]
->
GetSelection
()];
vjustify
[
FieldVJustify
[
VALUE
]
->
GetSelection
()];
CurrentLibEntry
->
m_Name
.
m_HJustify
=
hjustify
[
FieldHJustify
[
VALUE
]
->
GetSelection
()];
if
(
ShowFieldText
[
REFERENCE
]
->
GetValue
()
)
CurrentLibEntry
->
m_Name
.
m_VJustify
=
CurrentLibEntry
->
m_Prefix
.
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
vjustify
[
FieldVJustify
[
VALUE
]
->
GetSelection
()];
else
CurrentLibEntry
->
m_Prefix
.
m_Attributs
|=
TEXT_NO_VISIBLE
;
if
(
ShowFieldText
[
REFERENCE
]
->
GetValue
()
)
CurrentLibEntry
->
m_Prefix
.
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
if
(
ShowFieldText
[
VALUE
]
->
GetValue
()
)
else
CurrentLibEntry
->
m_Name
.
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
CurrentLibEntry
->
m_Prefix
.
m_Attributs
|=
TEXT_NO_VISIBLE
;
else
CurrentLibEntry
->
m_Name
.
m_Attributs
|=
TEXT_NO_VISIBLE
;
if
(
ShowFieldText
[
VALUE
]
->
GetValue
()
)
CurrentLibEntry
->
m_Name
.
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
for
(
ii
=
FOOTPRINT
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
else
{
CurrentLibEntry
->
m_Name
.
m_Attributs
|=
TEXT_NO_VISIBLE
;
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
LibDrawField
*
NextField
,
*
previousField
=
NULL
;
for
(
ii
=
FOOTPRINT
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
while
(
Field
)
{
{
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
NextField
=
(
LibDrawField
*
)
Field
->
Pnext
;
LibDrawField
*
NextField
,
*
previousField
=
NULL
;
if
(
Field
->
m_FieldId
==
ii
)
while
(
Field
)
{
{
Field
->
m_Text
=
FieldTextCtrl
[
ii
]
->
GetText
();
NextField
=
(
LibDrawField
*
)
Field
->
Pnext
;
Field
->
m_Size
.
x
=
Field
->
m_Size
.
y
=
FieldTextCtrl
[
ii
]
->
GetTextSize
();
if
(
Field
->
m_FieldId
==
ii
)
Field
->
m_HJustify
=
FieldHJustify
[
ii
]
->
GetSelection
();
{
Field
->
m_VJustify
=
FieldVJustify
[
ii
]
->
GetSelection
();
Field
->
m_Text
=
FieldTextCtrl
[
ii
]
->
GetText
();
if
(
ShowFieldText
[
ii
]
->
GetValue
()
)
Field
->
m_Size
.
x
=
Field
->
m_Size
.
y
=
FieldTextCtrl
[
ii
]
->
GetTextSize
();
Field
->
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
Field
->
m_HJustify
=
FieldHJustify
[
ii
]
->
GetSelection
();
else
Field
->
m_VJustify
=
FieldVJustify
[
ii
]
->
GetSelection
();
Field
->
m_Attributs
|=
TEXT_NO_VISIBLE
;
if
(
ShowFieldText
[
ii
]
->
GetValue
()
)
Field
->
m_Orient
=
VorientFieldText
[
ii
]
->
GetValue
()
?
1
:
0
;
Field
->
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
Field
->
m_Pos
=
FieldPosition
[
ii
]
->
GetValue
();
else
if
(
Field
->
m_Text
.
IsEmpty
()
)
// An old field exists; new is void, delete it
Field
->
m_Attributs
|=
TEXT_NO_VISIBLE
;
{
Field
->
m_Orient
=
VorientFieldText
[
ii
]
->
GetValue
()
?
1
:
0
;
delete
Field
;
Field
->
m_Pos
=
FieldPosition
[
ii
]
->
GetValue
();
if
(
previousField
)
previousField
->
Pnext
=
NextField
;
if
(
Field
->
m_Text
.
IsEmpty
()
)
// An old field exists; new is void, delete it
else
CurrentLibEntry
->
Fields
=
NextField
;
{
}
delete
Field
;
break
;
if
(
previousField
)
}
previousField
->
Pnext
=
NextField
;
else
previousField
=
Field
;
CurrentLibEntry
->
Fields
=
NextField
;
Field
=
NextField
;
}
}
break
;
}
if
(
(
Field
==
NULL
)
&&
(
!
FieldTextCtrl
[
ii
]
->
GetText
().
IsEmpty
()
)
)
{
// Do not exists: must be created
previousField
=
Field
;
Field
=
new
LibDrawField
(
ii
);
Field
=
NextField
;
Field
->
m_Text
=
FieldTextCtrl
[
ii
]
->
GetText
();
}
Field
->
m_Size
.
x
=
Field
->
m_Size
.
y
=
FieldTextCtrl
[
ii
]
->
GetTextSize
();
if
(
ShowFieldText
[
Field
->
m_FieldId
]
->
GetValue
()
)
if
(
(
Field
==
NULL
)
&&
(
!
FieldTextCtrl
[
ii
]
->
GetText
().
IsEmpty
()
)
)
Field
->
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
{
// Do not exists: must be created
else
Field
=
new
LibDrawField
(
ii
);
Field
->
m_Attributs
|=
TEXT_NO_VISIBLE
;
Field
->
m_Orient
=
VorientFieldText
[
Field
->
m_FieldId
]
->
GetValue
()
?
1
:
0
;
Field
->
m_Text
=
FieldTextCtrl
[
ii
]
->
GetText
();
Field
->
m_Pos
=
FieldPosition
[
Field
->
m_FieldId
]
->
GetValue
();
Field
->
m_Size
.
x
=
Field
->
m_Size
.
y
=
FieldTextCtrl
[
ii
]
->
GetTextSize
();
Field
->
m_HJustify
=
hjustify
[
FieldHJustify
[
Field
->
m_FieldId
]
->
GetSelection
()];
if
(
ShowFieldText
[
Field
->
m_FieldId
]
->
GetValue
()
)
Field
->
m_VJustify
=
vjustify
[
FieldVJustify
[
Field
->
m_FieldId
]
->
GetSelection
()];
Field
->
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
Field
->
Pnext
=
CurrentLibEntry
->
Fields
;
else
CurrentLibEntry
->
Fields
=
Field
;
Field
->
m_Attributs
|=
TEXT_NO_VISIBLE
;
}
Field
->
m_Orient
=
VorientFieldText
[
Field
->
m_FieldId
]
->
GetValue
()
?
1
:
0
;
}
Field
->
m_Pos
=
FieldPosition
[
Field
->
m_FieldId
]
->
GetValue
();
Field
->
m_HJustify
=
hjustify
[
FieldHJustify
[
Field
->
m_FieldId
]
->
GetSelection
()];
ii
=
SelNumberOfUnits
->
GetValue
();
Field
->
m_VJustify
=
vjustify
[
FieldVJustify
[
Field
->
m_FieldId
]
->
GetSelection
()];
if
(
ChangeNbUnitsPerPackage
(
ii
)
)
Field
->
Pnext
=
CurrentLibEntry
->
Fields
;
m_RecreateToolbar
=
TRUE
;
CurrentLibEntry
->
Fields
=
Field
;
}
if
(
AsConvertButt
->
GetValue
()
)
}
{
if
(
!
g_AsDeMorgan
)
ii
=
SelNumberOfUnits
->
GetValue
();
{
if
(
ChangeNbUnitsPerPackage
(
ii
)
)
g_AsDeMorgan
=
1
;
m_RecreateToolbar
=
TRUE
;
if
(
SetUnsetConvert
()
)
m_RecreateToolbar
=
TRUE
;
}
if
(
AsConvertButt
->
GetValue
()
)
}
{
else
if
(
!
g_AsDeMorgan
)
{
{
if
(
g_AsDeMorgan
)
g_AsDeMorgan
=
1
;
{
if
(
SetUnsetConvert
()
)
g_AsDeMorgan
=
0
;
m_RecreateToolbar
=
TRUE
;
if
(
SetUnsetConvert
()
)
m_RecreateToolbar
=
TRUE
;
}
}
}
}
else
{
CurrentLibEntry
->
m_DrawPinNum
=
ShowPinNumButt
->
GetValue
()
?
1
:
0
;
if
(
g_AsDeMorgan
)
CurrentLibEntry
->
m_DrawPinName
=
ShowPinNameButt
->
GetValue
()
?
1
:
0
;
{
g_AsDeMorgan
=
0
;
if
(
m_PinsNameInsideButt
->
GetValue
()
==
FALSE
)
if
(
SetUnsetConvert
()
)
CurrentLibEntry
->
m_TextInside
=
0
;
m_RecreateToolbar
=
TRUE
;
else
}
CurrentLibEntry
->
m_TextInside
=
m_SetSkew
->
GetValue
();
}
if
(
m_OptionPower
->
GetValue
()
==
TRUE
)
CurrentLibEntry
->
m_DrawPinNum
=
ShowPinNumButt
->
GetValue
()
?
1
:
0
;
CurrentLibEntry
->
m_Options
=
ENTRY_POWER
;
CurrentLibEntry
->
m_DrawPinName
=
ShowPinNameButt
->
GetValue
()
?
1
:
0
;
else
CurrentLibEntry
->
m_Options
=
ENTRY_NORMAL
;
if
(
m_PinsNameInsideButt
->
GetValue
()
==
FALSE
)
CurrentLibEntry
->
m_TextInside
=
0
;
/* Set the option "Units locked".
else
Obviously, cannot be TRUE if there is only one part */
CurrentLibEntry
->
m_TextInside
=
m_SetSkew
->
GetValue
();
CurrentLibEntry
->
m_UnitSelectionLocked
=
m_OptionPartsLocked
->
GetValue
();
if
(
CurrentLibEntry
->
m_UnitCount
<=
1
)
if
(
m_OptionPower
->
GetValue
()
==
TRUE
)
CurrentLibEntry
->
m_UnitSelectionLocked
=
FALSE
;
CurrentLibEntry
->
m_Options
=
ENTRY_POWER
;
else
if
(
m_RecreateToolbar
)
m_Parent
->
ReCreateHToolbar
();
CurrentLibEntry
->
m_Options
=
ENTRY_NORMAL
;
m_Parent
->
DisplayLibInfos
();
/* Set the option "Units locked".
* Obviously, cannot be TRUE if there is only one part */
Close
();
CurrentLibEntry
->
m_UnitSelectionLocked
=
m_OptionPartsLocked
->
GetValue
();
if
(
CurrentLibEntry
->
m_UnitCount
<=
1
)
CurrentLibEntry
->
m_UnitSelectionLocked
=
FALSE
;
if
(
m_RecreateToolbar
)
m_Parent
->
ReCreateHToolbar
();
m_Parent
->
DisplayLibInfos
();
Close
();
}
}
/*******************************************************************************/
/*******************************************************************************/
void
WinEDA_PartPropertiesFrame
::
CopyDocToAlias
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
void
WinEDA_PartPropertiesFrame
::
CopyDocToAlias
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
/******************************************************************************/
/******************************************************************************/
{
{
if
(
CurrentLibEntry
==
NULL
)
return
;
if
(
CurrentLibEntry
==
NULL
)
if
(
CurrentAliasName
.
IsEmpty
()
)
return
;
return
;
if
(
CurrentAliasName
.
IsEmpty
()
)
m_Doc
->
SetValue
(
CurrentLibEntry
->
m_Doc
);
return
;
m_Docfile
->
SetValue
(
CurrentLibEntry
->
m_DocFile
);
m_Keywords
->
SetValue
(
CurrentLibEntry
->
m_KeyWord
);
m_Doc
->
SetValue
(
CurrentLibEntry
->
m_Doc
);
m_Docfile
->
SetValue
(
CurrentLibEntry
->
m_DocFile
);
m_Keywords
->
SetValue
(
CurrentLibEntry
->
m_KeyWord
);
}
}
/**********************************************************/
/**********************************************************/
void
WinEDA_PartPropertiesFrame
::
DeleteAllAliasOfPart
(
void
WinEDA_PartPropertiesFrame
::
DeleteAllAliasOfPart
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
wxCommandEvent
&
WXUNUSED
(
event
)
)
/**********************************************************/
/**********************************************************/
{
{
CurrentAliasName
.
Empty
();
CurrentAliasName
.
Empty
();
if
(
CurrentLibEntry
)
if
(
CurrentLibEntry
)
{
{
if
(
IsOK
(
this
,
_
(
"Ok to Delete Alias LIST"
)
)
)
if
(
IsOK
(
this
,
_
(
"Ok to Delete Alias LIST"
)
)
)
{
{
m_PartAliasList
->
Clear
();
m_PartAliasList
->
Clear
();
m_RecreateToolbar
=
TRUE
;
m_RecreateToolbar
=
TRUE
;
}
}
}
}
}
}
/*******************************************************************************/
/*******************************************************************************/
void
WinEDA_PartPropertiesFrame
::
AddAliasOfPart
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
void
WinEDA_PartPropertiesFrame
::
AddAliasOfPart
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
/*******************************************************************************/
/*******************************************************************************/
/* Add a new name to the alias list box
/* Add a new name to the alias list box
New name cannot be the root name, and must not exists
*
New name cannot be the root name, and must not exists
*/
*/
{
{
wxString
Line
;
wxString
Line
;
wxString
aliasname
;
wxString
aliasname
;
if
(
CurrentLibEntry
==
NULL
)
return
;
if
(
CurrentLibEntry
==
NULL
)
return
;
if
(
Get_Message
(
_
(
"New alias:"
),
Line
,
this
)
!=
0
)
return
;
if
(
Get_Message
(
_
(
"New alias:"
),
Line
,
this
)
!=
0
)
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
return
;
aliasname
=
Line
;
Line
.
Replace
(
wxT
(
" "
),
wxT
(
"_"
)
);
if
(
CurrentLibEntry
->
m_Name
.
m_Text
.
CmpNoCase
(
Line
)
==
0
)
aliasname
=
Line
;
{
DisplayError
(
this
,
_
(
"This is the Root Part"
),
10
);
return
;
if
(
CurrentLibEntry
->
m_Name
.
m_Text
.
CmpNoCase
(
Line
)
==
0
)
}
{
DisplayError
(
this
,
_
(
"This is the Root Part"
),
10
);
return
;
/* test for an existing name: */
}
int
ii
,
jj
=
m_PartAliasList
->
GetCount
();
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
/* test for an existing name: */
{
int
ii
,
jj
=
m_PartAliasList
->
GetCount
();
if
(
aliasname
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
))
==
0
)
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
{
{
DisplayError
(
this
,
_
(
"Already in use"
),
10
);
if
(
aliasname
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
)
)
==
0
)
return
;
{
}
DisplayError
(
this
,
_
(
"Already in use"
),
10
);
}
return
;
}
m_PartAliasList
->
Append
(
aliasname
);
}
m_RecreateToolbar
=
TRUE
;
m_PartAliasList
->
Append
(
aliasname
);
m_RecreateToolbar
=
TRUE
;
}
}
/********************************************************/
/********************************************************/
void
WinEDA_PartPropertiesFrame
::
DeleteAliasOfPart
(
void
WinEDA_PartPropertiesFrame
::
DeleteAliasOfPart
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
wxCommandEvent
&
WXUNUSED
(
event
)
)
/********************************************************/
/********************************************************/
{
{
wxString
aliasname
=
m_PartAliasList
->
GetStringSelection
();
wxString
aliasname
=
m_PartAliasList
->
GetStringSelection
();
if
(
aliasname
.
IsEmpty
()
)
return
;
if
(
aliasname
==
CurrentAliasName
)
{
wxString
msg
=
CurrentAliasName
+
_
(
" is Current Selected Alias!"
);
DisplayError
(
this
,
msg
);
return
;
}
int
ii
=
m_PartAliasList
->
GetSelection
();
m_PartAliasList
->
Delete
(
ii
);
m_RecreateToolbar
=
TRUE
;
}
if
(
aliasname
.
IsEmpty
()
)
return
;
if
(
aliasname
==
CurrentAliasName
)
{
wxString
msg
=
CurrentAliasName
+
_
(
" is Current Selected Alias!"
);
DisplayError
(
this
,
msg
);
return
;
}
int
ii
=
m_PartAliasList
->
GetSelection
();
m_PartAliasList
->
Delete
(
ii
);
m_RecreateToolbar
=
TRUE
;
}
/********************************************************************/
/********************************************************************/
bool
WinEDA_PartPropertiesFrame
::
ChangeNbUnitsPerPackage
(
int
MaxUnit
)
bool
WinEDA_PartPropertiesFrame
::
ChangeNbUnitsPerPackage
(
int
MaxUnit
)
/********************************************************************/
/********************************************************************/
/* Routine de modification du nombre d'unites par package pour le
/* Routine de modification du nombre d'unites par package pour le
composant courant;
*
composant courant;
*/
*/
{
{
int
OldNumUnits
,
ii
,
FlagDel
=
-
1
;
int
OldNumUnits
,
ii
,
FlagDel
=
-
1
;
LibEDA_BaseStruct
*
DrawItem
,
*
NextDrawItem
;
LibEDA_BaseStruct
*
DrawItem
,
*
NextDrawItem
;
if
(
CurrentLibEntry
==
NULL
)
return
FALSE
;
if
(
CurrentLibEntry
==
NULL
)
return
FALSE
;
/* Si pas de changement: termine */
if
(
CurrentLibEntry
->
m_UnitCount
==
MaxUnit
)
return
FALSE
;
/* Si pas de changement: termine */
if
(
CurrentLibEntry
->
m_UnitCount
==
MaxUnit
)
OldNumUnits
=
CurrentLibEntry
->
m_UnitCount
;
return
FALSE
;
if
(
OldNumUnits
<
1
)
OldNumUnits
=
1
;
OldNumUnits
=
CurrentLibEntry
->
m_UnitCount
;
CurrentLibEntry
->
m_UnitCount
=
MaxUnit
;
if
(
OldNumUnits
<
1
)
OldNumUnits
=
1
;
/* Traitement des unites enlevees ou rajoutees */
CurrentLibEntry
->
m_UnitCount
=
MaxUnit
;
if
(
OldNumUnits
>
CurrentLibEntry
->
m_UnitCount
)
{
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
/* Traitement des unites enlevees ou rajoutees */
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
NextDrawItem
)
if
(
OldNumUnits
>
CurrentLibEntry
->
m_UnitCount
)
{
{
NextDrawItem
=
DrawItem
->
Next
();
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
if
(
DrawItem
->
m_Unit
>
MaxUnit
)
/* Item a effacer */
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
NextDrawItem
)
{
{
if
(
FlagDel
<
0
)
NextDrawItem
=
DrawItem
->
Next
();
{
if
(
DrawItem
->
m_Unit
>
MaxUnit
)
/* Item a effacer */
if
(
IsOK
(
this
,
_
(
"Delete units"
)
)
)
{
{
if
(
FlagDel
<
0
)
/* Si part selectee n'existe plus: selection 1ere unit */
{
if
(
CurrentUnit
>
MaxUnit
)
CurrentUnit
=
1
;
if
(
IsOK
(
this
,
_
(
"Delete units"
)
)
)
FlagDel
=
1
;
{
}
/* Si part selectee n'existe plus: selection 1ere unit */
else
if
(
CurrentUnit
>
MaxUnit
)
{
CurrentUnit
=
1
;
FlagDel
=
0
;
FlagDel
=
1
;
MaxUnit
=
OldNumUnits
;
}
CurrentLibEntry
->
m_UnitCount
=
MaxUnit
;
else
return
FALSE
;
{
}
FlagDel
=
0
;
}
MaxUnit
=
OldNumUnits
;
DeleteOneLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
NULL
,
CurrentLibEntry
,
CurrentLibEntry
->
m_UnitCount
=
MaxUnit
;
DrawItem
,
0
);
return
FALSE
;
}
}
}
}
return
TRUE
;
DeleteOneLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
NULL
,
CurrentLibEntry
,
}
DrawItem
,
0
);
}
if
(
OldNumUnits
<
CurrentLibEntry
->
m_UnitCount
)
}
{
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
return
TRUE
;
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Next
()
)
}
{
/* Duplication des items pour autres elements */
if
(
OldNumUnits
<
CurrentLibEntry
->
m_UnitCount
)
if
(
DrawItem
->
m_Unit
==
1
)
{
{
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
for
(
ii
=
OldNumUnits
+
1
;
ii
<=
MaxUnit
;
ii
++
)
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Next
()
)
{
{
NextDrawItem
=
CopyDrawEntryStruct
(
this
,
DrawItem
);
/* Duplication des items pour autres elements */
NextDrawItem
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
if
(
DrawItem
->
m_Unit
==
1
)
CurrentLibEntry
->
m_Drawings
=
NextDrawItem
;
{
NextDrawItem
->
m_Unit
=
ii
;
for
(
ii
=
OldNumUnits
+
1
;
ii
<=
MaxUnit
;
ii
++
)
}
{
}
NextDrawItem
=
CopyDrawEntryStruct
(
this
,
DrawItem
);
}
NextDrawItem
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
}
CurrentLibEntry
->
m_Drawings
=
NextDrawItem
;
return
TRUE
;
NextDrawItem
->
m_Unit
=
ii
;
}
}
}
}
return
TRUE
;
}
}
/*****************************************************/
/*****************************************************/
bool
WinEDA_PartPropertiesFrame
::
SetUnsetConvert
()
bool
WinEDA_PartPropertiesFrame
::
SetUnsetConvert
()
/*****************************************************/
/*****************************************************/
/* cre ou efface (selon option AsConvert) les lments
/* cre ou efface (selon option AsConvert) les lments
de la reprsentation convertie d'un composant
*
de la reprsentation convertie d'un composant
*/
*/
{
{
int
FlagDel
=
0
;
int
FlagDel
=
0
;
LibEDA_BaseStruct
*
DrawItem
=
NULL
,
*
NextDrawItem
;
LibEDA_BaseStruct
*
DrawItem
=
NULL
,
*
NextDrawItem
;
if
(
g_AsDeMorgan
)
/* Representation convertie a creer */
if
(
g_AsDeMorgan
)
/* Representation convertie a creer */
{
{
/* Traitement des elements a ajouter ( pins seulement ) */
/* Traitement des elements a ajouter ( pins seulement ) */
if
(
CurrentLibEntry
)
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
if
(
CurrentLibEntry
)
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Next
()
)
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
{
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
DrawItem
->
Next
()
)
/* Duplication des items pour autres elements */
{
if
(
DrawItem
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
continue
;
/* Duplication des items pour autres elements */
if
(
DrawItem
->
m_Convert
==
1
)
if
(
DrawItem
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
{
continue
;
if
(
FlagDel
==
0
)
if
(
DrawItem
->
m_Convert
==
1
)
{
{
if
(
IsOK
(
this
,
_
(
"Create pins for Convert items"
))
)
if
(
FlagDel
==
0
)
FlagDel
=
1
;
{
else
if
(
IsOK
(
this
,
_
(
"Create pins for Convert items"
)
)
)
{
FlagDel
=
1
;
if
(
IsOK
(
this
,
_
(
"Part as
\"
De Morgan
\"
anymore"
))
)
else
return
TRUE
;
{
if
(
IsOK
(
this
,
_
(
"Part as
\"
De Morgan
\"
anymore"
)
)
)
g_AsDeMorgan
=
0
;
return
FALSE
;
return
TRUE
;
}
}
g_AsDeMorgan
=
0
;
return
FALSE
;
NextDrawItem
=
CopyDrawEntryStruct
(
this
,
DrawItem
);
}
NextDrawItem
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
}
CurrentLibEntry
->
m_Drawings
=
NextDrawItem
;
NextDrawItem
=
CopyDrawEntryStruct
(
this
,
DrawItem
);
NextDrawItem
->
m_Convert
=
2
;
NextDrawItem
->
Pnext
=
CurrentLibEntry
->
m_Drawings
;
}
CurrentLibEntry
->
m_Drawings
=
NextDrawItem
;
}
NextDrawItem
->
m_Convert
=
2
;
}
}
}
else
/* Representation convertie a supprimer */
}
{
else
/* Representation convertie a supprimer */
/* Traitement des elements supprimer */
{
if
(
CurrentLibEntry
)
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
/* Traitement des elements supprimer */
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
NextDrawItem
)
if
(
CurrentLibEntry
)
{
DrawItem
=
CurrentLibEntry
->
m_Drawings
;
NextDrawItem
=
DrawItem
->
Next
();
for
(
;
DrawItem
!=
NULL
;
DrawItem
=
NextDrawItem
)
if
(
DrawItem
->
m_Convert
>
1
)
/* Item a effacer */
{
{
NextDrawItem
=
DrawItem
->
Next
();
if
(
FlagDel
==
0
)
if
(
DrawItem
->
m_Convert
>
1
)
/* Item a effacer */
{
{
if
(
IsOK
(
this
,
_
(
"Delete Convert items"
)
)
)
if
(
FlagDel
==
0
)
{
{
CurrentConvert
=
1
;
if
(
IsOK
(
this
,
_
(
"Delete Convert items"
)
)
)
FlagDel
=
1
;
{
}
CurrentConvert
=
1
;
else
FlagDel
=
1
;
{
}
g_AsDeMorgan
=
1
;
else
return
FALSE
;
{
}
g_AsDeMorgan
=
1
;
}
return
FALSE
;
m_Parent
->
GetScreen
()
->
SetModify
();
}
DeleteOneLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
NULL
,
CurrentLibEntry
,
DrawItem
,
0
);
}
}
m_Parent
->
GetScreen
()
->
SetModify
();
}
DeleteOneLibraryDrawStruct
(
m_Parent
->
DrawPanel
,
}
NULL
,
return
TRUE
;
CurrentLibEntry
,
DrawItem
,
0
);
}
}
}
return
TRUE
;
}
}
/****************************************************************************/
/****************************************************************************/
void
WinEDA_PartPropertiesFrame
::
BrowseAndSelectDocFile
(
wxCommandEvent
&
event
)
void
WinEDA_PartPropertiesFrame
::
BrowseAndSelectDocFile
(
wxCommandEvent
&
event
)
/****************************************************************************/
/****************************************************************************/
{
{
wxString
FullFileName
;
wxString
FullFileName
;
wxString
docpath
(
g_RealLibDirBuffer
),
filename
;
wxString
docpath
(
g_RealLibDirBuffer
),
filename
;
docpath
+=
wxT
(
"doc"
);
docpath
+=
STRING_DIR_SEP
;
docpath
+=
wxT
(
"doc"
);
FullFileName
=
EDA_FileSelector
(
_
(
"Doc Files"
),
docpath
+=
STRING_DIR_SEP
;
docpath
,
/* Chemin par defaut */
FullFileName
=
EDA_FileSelector
(
_
(
"Doc Files"
),
wxEmptyString
,
/* nom fichier par defaut */
docpath
,
/* Chemin par defaut */
wxEmptyString
,
/* extension par defaut */
wxEmptyString
,
/* nom fichier par defaut */
wxEmptyString
,
/* Masque d'affichage */
wxEmptyString
,
/* extension par defaut */
this
,
wxEmptyString
,
/* Masque d'affichage */
wxFD_OPEN
,
this
,
TRUE
wxFD_OPEN
,
);
TRUE
if
(
FullFileName
.
IsEmpty
()
)
return
;
);
if
(
FullFileName
.
IsEmpty
()
)
// Suppression du chemin par defaut pour le fichier de doc:
return
;
filename
=
MakeReducedFileName
(
FullFileName
,
docpath
,
wxEmptyString
);
m_Docfile
->
SetValue
(
filename
);
// Suppression du chemin par defaut pour le fichier de doc:
}
filename
=
MakeReducedFileName
(
FullFileName
,
docpath
,
wxEmptyString
);
m_Docfile
->
SetValue
(
filename
);
}
eeschema/load_one_schematic_file.cpp
View file @
664a1f72
...
@@ -272,8 +272,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -272,8 +272,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if
(
!
Failed
)
if
(
!
Failed
)
{
{
PolylineStruct
->
Pnext
=
screen
->
EEDrawList
;
PolylineStruct
->
Pnext
=
screen
->
EEDrawList
;
screen
->
EEDrawList
=
(
EDA_BaseStruct
*
)
screen
->
EEDrawList
=
(
EDA_BaseStruct
*
)
PolylineStruct
;
PolylineStruct
;
}
}
break
;
break
;
...
@@ -441,6 +440,10 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
...
@@ -441,6 +440,10 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
screen
->
EEDrawList
=
Phead
;
screen
->
EEDrawList
=
Phead
;
#if defined(DEBUG)
screen
->
Show
(
0
,
std
::
cout
);
#endif
fclose
(
f
);
fclose
(
f
);
TestDanglingEnds
(
screen
->
EEDrawList
,
NULL
);
TestDanglingEnds
(
screen
->
EEDrawList
,
NULL
);
...
...
eeschema/netlist.cpp
View file @
664a1f72
/***********************************/
/***********************************/
/* Module de calcul de la Netliste */
/* Module de calcul de la Netliste */
/***********************************/
/***********************************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -9,25 +9,26 @@
...
@@ -9,25 +9,26 @@
#include "libcmp.h"
#include "libcmp.h"
#include "general.h"
#include "general.h"
#include "netlist.h"
/* Definitions generales liees au calcul de netliste */
#include "netlist.h"
/* Definitions generales liees au calcul de netliste */
#include "protos.h"
#include "protos.h"
/* Routines locales */
/* Routines locales */
static
void
PropageNetCode
(
int
OldNetCode
,
int
NewNetCode
,
int
IsBus
);
static
void
PropageNetCode
(
int
OldNetCode
,
int
NewNetCode
,
int
IsBus
);
static
void
SheetLabelConnection
(
ObjetNetListStruct
*
SheetLabel
);
static
void
SheetLabelConnection
(
ObjetNetListStruct
*
SheetLabel
);
static
int
ListeObjetConnection
(
WinEDA_SchematicFrame
*
frame
,
SCH_SCREEN
*
screen
,
ObjetNetListStruct
*
ObjNet
);
static
int
ListeObjetConnection
(
WinEDA_SchematicFrame
*
frame
,
static
int
ConvertBusToMembers
(
ObjetNetListStruct
*
ObjNet
);
SCH_SCREEN
*
screen
,
static
void
PointToPointConnect
(
ObjetNetListStruct
*
RefObj
,
int
IsBus
,
ObjetNetListStruct
*
ObjNet
);
int
start
);
static
int
ConvertBusToMembers
(
ObjetNetListStruct
*
ObjNet
);
static
void
SegmentToPointConnect
(
ObjetNetListStruct
*
Jonction
,
int
IsBus
,
static
void
PointToPointConnect
(
ObjetNetListStruct
*
RefObj
,
int
IsBus
,
int
start
);
int
start
);
static
void
LabelConnection
(
ObjetNetListStruct
*
Label
);
static
void
SegmentToPointConnect
(
ObjetNetListStruct
*
Jonction
,
int
IsBus
,
static
int
TriNetCode
(
ObjetNetListStruct
*
Objet1
,
ObjetNetListStruct
*
Objet2
);
int
start
);
static
void
ConnectBusLabels
(
ObjetNetListStruct
*
Label
,
int
NbItems
);
static
void
LabelConnection
(
ObjetNetListStruct
*
Label
);
static
void
SetUnconnectedFlag
(
ObjetNetListStruct
*
ObjNet
,
int
NbItems
);
static
int
TriNetCode
(
const
void
*
o1
,
const
void
*
o2
);
static
int
TriBySheet
(
ObjetNetListStruct
*
Objet1
,
ObjetNetListStruct
*
Objet2
);
static
void
ConnectBusLabels
(
ObjetNetListStruct
*
Label
,
int
NbItems
);
static
void
SetUnconnectedFlag
(
ObjetNetListStruct
*
ObjNet
,
int
NbItems
);
static
int
TriBySheet
(
const
void
*
o1
,
const
void
*
o2
);
/* Variable locales */
/* Variable locales */
static
int
FirstNumWireBus
,
LastNumWireBus
,
RootBusNameLength
;
static
int
FirstNumWireBus
,
LastNumWireBus
,
RootBusNameLength
;
...
@@ -35,1010 +36,1122 @@ static int LastNetCode, LastBusNetCode;
...
@@ -35,1010 +36,1122 @@ static int LastNetCode, LastBusNetCode;
static
int
s_PassNumber
;
static
int
s_PassNumber
;
/***********************************************************************/
/***********************************************************************/
void
FreeTabNetList
(
ObjetNetListStruct
*
TabNetItems
,
int
NbrNetItems
)
void
FreeTabNetList
(
ObjetNetListStruct
*
TabNetItems
,
int
NbrNetItems
)
/***********************************************************************/
/***********************************************************************/
/*
/*
Routine de liberation memoire des tableaux utilises pour le calcul
*
Routine de liberation memoire des tableaux utilises pour le calcul
de la netliste
*
de la netliste
TabNetItems = pointeur sur le tableau principal (liste des items )
*
TabNetItems = pointeur sur le tableau principal (liste des items )
NbrNetItems = nombre d'elements
*
NbrNetItems = nombre d'elements
*/
*/
{
{
int
i
;
int
i
;
/* Liberation memoire des strings du champ Label reserve par ConvertBusToMembers */
/* Liberation memoire des strings du champ Label reserve par ConvertBusToMembers */
for
(
i
=
0
;
i
<
NbrNetItems
;
i
++
)
for
(
i
=
0
;
i
<
NbrNetItems
;
i
++
)
{
{
switch
(
TabNetItems
[
i
].
m_Type
)
switch
(
TabNetItems
[
i
].
m_Type
)
{
{
case
NET_PIN
:
case
NET_PIN
:
case
NET_SHEETLABEL
:
case
NET_SHEETLABEL
:
case
NET_SEGMENT
:
case
NET_SEGMENT
:
case
NET_JONCTION
:
case
NET_JONCTION
:
case
NET_BUS
:
case
NET_BUS
:
case
NET_LABEL
:
case
NET_LABEL
:
case
NET_GLOBLABEL
:
case
NET_GLOBLABEL
:
case
NET_PINLABEL
:
case
NET_PINLABEL
:
case
NET_NOCONNECT
:
case
NET_NOCONNECT
:
break
;
break
;
case
NET_GLOBBUSLABELMEMBER
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_BUSLABELMEMBER
:
case
NET_SHEETBUSLABELMEMBER
:
delete
TabNetItems
[
i
].
m_Label
;
case
NET_BUSLABELMEMBER
:
break
;
delete
TabNetItems
[
i
].
m_Label
;
}
break
;
}
}
}
MyFree
(
TabNetItems
);
MyFree
(
TabNetItems
);
}
}
/*****************************************************/
/*****************************************************/
void
*
WinEDA_SchematicFrame
::
BuildNetListBase
()
void
*
WinEDA_SchematicFrame
::
BuildNetListBase
()
/*****************************************************/
/*****************************************************/
/* Routine qui construit le tableau des elements connectes du projet
/* Routine qui construit le tableau des elements connectes du projet
met a jour:
*
met a jour:
g_TabObjNet
*
g_TabObjNet
g_NbrObjNet
*
g_NbrObjNet
*/
*/
{
{
int
NetNumber
,
SheetNumber
;
int
NetNumber
,
SheetNumber
;
int
i
,
istart
,
NetCode
;
int
i
,
istart
,
NetCode
;
SCH_SCREEN
*
screen
;
SCH_SCREEN
*
screen
;
ObjetNetListStruct
*
BaseTabObjNet
;
wxString
msg
;
wxString
msg
;
wxBusyCursor
Busy
;
wxBusyCursor
Busy
;
NetNumber
=
1
;
NetNumber
=
1
;
s_PassNumber
=
0
;
s_PassNumber
=
0
;
MsgPanel
->
EraseMsgBox
();
MsgPanel
->
EraseMsgBox
();
Affiche_1_Parametre
(
this
,
1
,
_
(
"List"
),
wxEmptyString
,
LIGHTRED
);
Affiche_1_Parametre
(
this
,
1
,
_
(
"List"
),
wxEmptyString
,
LIGHTRED
);
/* Build the screen list */
/* Build the screen list */
EDA_ScreenList
ScreenList
(
NULL
);
EDA_ScreenList
ScreenList
(
NULL
);
/* 1ere passe : Comptage du nombre d'objet de Net */
/* 1ere passe : Comptage du nombre d'objet de Net */
g_NbrObjNet
=
0
;
g_NbrObjNet
=
0
;
g_TabObjNet
=
NULL
;
/* Init pour le 1er passage dans ListeObjetConnection */
g_TabObjNet
=
NULL
;
/* Init pour le 1er passage dans ListeObjetConnection */
/* Update the sheet number, sheet count and date and count nelist items */
/* Update the sheet number, sheet count and date and count nelist items */
ScreenSch
->
SetModify
();
ScreenSch
->
SetModify
();
int
kk
=
1
;
int
kk
=
1
;
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
{
{
screen
->
m_SheetNumber
=
kk
++
;
screen
->
m_SheetNumber
=
kk
++
;
screen
->
m_NumberOfSheet
=
ScreenList
.
GetCount
();
screen
->
m_NumberOfSheet
=
ScreenList
.
GetCount
();
screen
->
m_Date
=
GenDate
();
screen
->
m_Date
=
GenDate
();
g_NbrObjNet
+=
ListeObjetConnection
(
this
,
screen
,
NULL
);
g_NbrObjNet
+=
ListeObjetConnection
(
this
,
screen
,
NULL
);
}
}
if
(
g_NbrObjNet
==
0
)
if
(
g_NbrObjNet
==
0
)
{
{
DisplayError
(
this
,
_
(
"No component"
),
20
);
DisplayError
(
this
,
_
(
"No component"
),
20
);
return
(
NULL
);
return
NULL
;
}
}
i
=
sizeof
(
ObjetNetListStruct
)
*
g_NbrObjNet
;
i
=
sizeof
(
ObjetNetListStruct
)
*
g_NbrObjNet
;
BaseTabObjNet
=
g_TabObjNet
=
(
ObjetNetListStruct
*
)
MyZMalloc
(
i
);
g_TabObjNet
=
(
ObjetNetListStruct
*
)
MyZMalloc
(
i
);
if
(
BaseTabObjNet
==
NULL
)
return
(
NULL
);
if
(
g_TabObjNet
==
NULL
)
return
NULL
;
/* 2eme passe : Remplissage des champs des structures des objets de Net */
/* 2eme passe : Remplissage des champs des structures des objets de Net */
s_PassNumber
++
;
Affiche_1_Parametre
(
this
,
1
,
_
(
"List"
),
wxEmptyString
,
RED
);
s_PassNumber
++
;
for
(
screen
=
ScreenList
.
GetFirst
();
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
Affiche_1_Parametre
(
this
,
1
,
_
(
"List"
),
wxEmptyString
,
RED
);
{
g_TabObjNet
+=
ListeObjetConnection
(
this
,
screen
,
g_TabObjNet
);
screen
=
ScreenList
.
GetFirst
();
}
for
(
ObjetNetListStruct
*
baseTabObjNet
=
g_TabObjNet
;
screen
!=
NULL
;
screen
=
ScreenList
.
GetNext
()
)
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
RED
);
{
baseTabObjNet
+=
ListeObjetConnection
(
this
,
screen
,
baseTabObjNet
);
msg
.
Printf
(
wxT
(
"%d"
),
g_NbrObjNet
);
}
Affiche_1_Parametre
(
this
,
8
,
_
(
"NbItems"
),
msg
,
GREEN
);
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
RED
);
/* Recherche des connections pour les Segments et les Pins */
/* Tri du Tableau des objets de Net par Sheet */
msg
.
Printf
(
wxT
(
"%d"
),
g_NbrObjNet
);
Affiche_1_Parametre
(
this
,
8
,
_
(
"NbItems"
),
msg
,
GREEN
);
qsort
(
BaseTabObjNet
,
g_NbrObjNet
,
sizeof
(
ObjetNetListStruct
),
(
int
(
*
)(
const
void
*
,
const
void
*
))
TriBySheet
);
/* Recherche des connections pour les Segments et les Pins */
/* Tri du Tableau des objets de Net par Sheet */
Affiche_1_Parametre
(
this
,
18
,
_
(
"Conn"
),
wxEmptyString
,
CYAN
);
qsort
(
g_TabObjNet
,
g_NbrObjNet
,
sizeof
(
ObjetNetListStruct
),
TriBySheet
);
g_TabObjNet
=
BaseTabObjNet
;
SheetNumber
=
g_TabObjNet
[
0
].
m_SheetNumber
;
Affiche_1_Parametre
(
this
,
18
,
_
(
"Conn"
),
wxEmptyString
,
CYAN
);
LastNetCode
=
LastBusNetCode
=
1
;
for
(
i
=
istart
=
0
;
i
<
g_NbrObjNet
;
i
++
)
SheetNumber
=
g_TabObjNet
[
0
].
m_SheetNumber
;
{
LastNetCode
=
LastBusNetCode
=
1
;
if
(
g_TabObjNet
[
i
].
m_SheetNumber
!=
SheetNumber
)
{
for
(
i
=
istart
=
0
;
i
<
g_NbrObjNet
;
i
++
)
SheetNumber
=
g_TabObjNet
[
i
].
m_SheetNumber
;
istart
=
i
;
{
}
if
(
g_TabObjNet
[
i
].
m_SheetNumber
!=
SheetNumber
)
{
switch
(
g_TabObjNet
[
i
].
m_Type
)
SheetNumber
=
g_TabObjNet
[
i
].
m_SheetNumber
;
istart
=
i
;
{
}
case
NET_PIN
:
case
NET_PINLABEL
:
switch
(
g_TabObjNet
[
i
].
m_Type
)
case
NET_SHEETLABEL
:
{
case
NET_NOCONNECT
:
case
NET_PIN
:
if
(
g_TabObjNet
[
i
].
m_NetCode
!=
0
)
break
;
/* Deja connecte */
case
NET_PINLABEL
:
case
NET_SEGMENT
:
case
NET_SHEETLABEL
:
/* Controle des connexions type point a point ( Sans BUS ) */
case
NET_NOCONNECT
:
if
(
g_TabObjNet
[
i
].
m_NetCode
==
0
)
if
(
g_TabObjNet
[
i
].
m_NetCode
!=
0
)
{
break
;
/* Deja connecte */
g_TabObjNet
[
i
].
m_NetCode
=
LastNetCode
;
LastNetCode
++
;
case
NET_SEGMENT
:
}
/* Controle des connexions type point a point ( Sans BUS ) */
PointToPointConnect
(
g_TabObjNet
+
i
,
0
,
istart
);
if
(
g_TabObjNet
[
i
].
m_NetCode
==
0
)
break
;
{
g_TabObjNet
[
i
].
m_NetCode
=
LastNetCode
;
case
NET_JONCTION
:
LastNetCode
++
;
/* Controle des jonction , hors BUS */
}
if
(
g_TabObjNet
[
i
].
m_NetCode
==
0
)
PointToPointConnect
(
g_TabObjNet
+
i
,
0
,
istart
);
{
break
;
g_TabObjNet
[
i
].
m_NetCode
=
LastNetCode
;
LastNetCode
++
;
case
NET_JONCTION
:
}
/* Controle des jonction , hors BUS */
SegmentToPointConnect
(
g_TabObjNet
+
i
,
0
,
istart
);
if
(
g_TabObjNet
[
i
].
m_NetCode
==
0
)
{
/* Controle des jonction , sur BUS */
g_TabObjNet
[
i
].
m_NetCode
=
LastNetCode
;
if
(
g_TabObjNet
[
i
].
m_BusNetCode
==
0
)
LastNetCode
++
;
{
}
g_TabObjNet
[
i
].
m_BusNetCode
=
LastBusNetCode
;
SegmentToPointConnect
(
g_TabObjNet
+
i
,
0
,
istart
);
LastBusNetCode
++
;
}
/* Controle des jonction , sur BUS */
SegmentToPointConnect
(
g_TabObjNet
+
i
,
ISBUS
,
istart
);
if
(
g_TabObjNet
[
i
].
m_BusNetCode
==
0
)
break
;
{
g_TabObjNet
[
i
].
m_BusNetCode
=
LastBusNetCode
;
case
NET_LABEL
:
LastBusNetCode
++
;
case
NET_GLOBLABEL
:
}
/* Controle des connexions type jonction ( Sans BUS ) */
SegmentToPointConnect
(
g_TabObjNet
+
i
,
ISBUS
,
istart
);
if
(
g_TabObjNet
[
i
].
m_NetCode
==
0
)
break
;
{
g_TabObjNet
[
i
].
m_NetCode
=
LastNetCode
;
case
NET_LABEL
:
LastNetCode
++
;
case
NET_GLOBLABEL
:
}
/* Controle des connexions type jonction ( Sans BUS ) */
SegmentToPointConnect
(
g_TabObjNet
+
i
,
0
,
istart
);
if
(
g_TabObjNet
[
i
].
m_NetCode
==
0
)
break
;
{
g_TabObjNet
[
i
].
m_NetCode
=
LastNetCode
;
case
NET_SHEETBUSLABELMEMBER
:
LastNetCode
++
;
if
(
g_TabObjNet
[
i
].
m_BusNetCode
!=
0
)
break
;
/* Deja connecte */
}
case
NET_BUS
:
SegmentToPointConnect
(
g_TabObjNet
+
i
,
0
,
istart
);
/* Controle des connexions type point a point mode BUS */
break
;
if
(
g_TabObjNet
[
i
].
m_BusNetCode
==
0
)
{
case
NET_SHEETBUSLABELMEMBER
:
g_TabObjNet
[
i
].
m_BusNetCode
=
LastBusNetCode
;
if
(
g_TabObjNet
[
i
].
m_BusNetCode
!=
0
)
LastBusNetCode
++
;
break
;
/* Deja connecte */
}
PointToPointConnect
(
g_TabObjNet
+
i
,
ISBUS
,
istart
);
case
NET_BUS
:
break
;
/* Controle des connexions type point a point mode BUS */
if
(
g_TabObjNet
[
i
].
m_BusNetCode
==
0
)
case
NET_BUSLABELMEMBER
:
{
case
NET_GLOBBUSLABELMEMBER
:
g_TabObjNet
[
i
].
m_BusNetCode
=
LastBusNetCode
;
/* Controle des connexions semblables a des sur BUS */
LastBusNetCode
++
;
if
(
g_TabObjNet
[
i
].
m_NetCode
==
0
)
}
{
PointToPointConnect
(
g_TabObjNet
+
i
,
ISBUS
,
istart
);
g_TabObjNet
[
i
].
m_BusNetCode
=
LastBusNetCode
;
break
;
LastBusNetCode
++
;
}
case
NET_BUSLABELMEMBER
:
SegmentToPointConnect
(
g_TabObjNet
+
i
,
ISBUS
,
istart
);
case
NET_GLOBBUSLABELMEMBER
:
break
;
/* Controle des connexions semblables a des sur BUS */
if
(
g_TabObjNet
[
i
].
m_NetCode
==
0
)
}
{
}
g_TabObjNet
[
i
].
m_BusNetCode
=
LastBusNetCode
;
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
CYAN
);
LastBusNetCode
++
;
}
/* Mise a jour des NetCodes des Bus Labels connectes par les Bus */
SegmentToPointConnect
(
g_TabObjNet
+
i
,
ISBUS
,
istart
);
ConnectBusLabels
(
g_TabObjNet
,
g_NbrObjNet
);
break
;
}
Affiche_1_Parametre
(
this
,
26
,
_
(
"Labels"
),
wxEmptyString
,
CYAN
);
}
/* Connections des groupes d'objets par labels identiques */
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
CYAN
);
for
(
i
=
0
;
i
<
g_NbrObjNet
;
i
++
)
{
/* Mise a jour des NetCodes des Bus Labels connectes par les Bus */
switch
(
g_TabObjNet
[
i
].
m_Type
)
ConnectBusLabels
(
g_TabObjNet
,
g_NbrObjNet
);
{
case
NET_PIN
:
Affiche_1_Parametre
(
this
,
26
,
_
(
"Labels"
),
wxEmptyString
,
CYAN
);
case
NET_SHEETLABEL
:
case
NET_SEGMENT
:
/* Connections des groupes d'objets par labels identiques */
case
NET_JONCTION
:
for
(
i
=
0
;
i
<
g_NbrObjNet
;
i
++
)
case
NET_BUS
:
{
case
NET_NOCONNECT
:
switch
(
g_TabObjNet
[
i
].
m_Type
)
break
;
{
case
NET_PIN
:
case
NET_LABEL
:
case
NET_SHEETLABEL
:
case
NET_GLOBLABEL
:
case
NET_SEGMENT
:
case
NET_PINLABEL
:
case
NET_JONCTION
:
case
NET_BUSLABELMEMBER
:
case
NET_BUS
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_NOCONNECT
:
LabelConnection
(
g_TabObjNet
+
i
);
break
;
break
;
case
NET_SHEETBUSLABELMEMBER
:
case
NET_LABEL
:
break
;
case
NET_GLOBLABEL
:
}
case
NET_PINLABEL
:
}
case
NET_BUSLABELMEMBER
:
case
NET_GLOBBUSLABELMEMBER
:
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
CYAN
);
LabelConnection
(
g_TabObjNet
+
i
);
break
;
/* Connexion des hierarchies */
case
NET_SHEETBUSLABELMEMBER
:
Affiche_1_Parametre
(
this
,
36
,
_
(
"Hierar."
),
wxEmptyString
,
LIGHTRED
);
break
;
}
for
(
i
=
0
;
i
<
g_NbrObjNet
;
i
++
)
}
{
if
(
(
g_TabObjNet
[
i
].
m_Type
==
NET_SHEETLABEL
)
||
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
CYAN
);
(
g_TabObjNet
[
i
].
m_Type
==
NET_SHEETBUSLABELMEMBER
)
)
SheetLabelConnection
(
g_TabObjNet
+
i
);
}
/* Connexion des hierarchies */
Affiche_1_Parametre
(
this
,
36
,
_
(
"Hierar."
),
wxEmptyString
,
LIGHTRED
);
/* Tri du Tableau des objets de Net par NetCode */
qsort
(
g_TabObjNet
,
g_NbrObjNet
,
sizeof
(
ObjetNetListStruct
),
for
(
i
=
0
;
i
<
g_NbrObjNet
;
i
++
)
(
int
(
*
)(
const
void
*
,
const
void
*
))
TriNetCode
);
{
if
(
(
g_TabObjNet
[
i
].
m_Type
==
NET_SHEETLABEL
)
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
RED
);
||
(
g_TabObjNet
[
i
].
m_Type
==
NET_SHEETBUSLABELMEMBER
)
)
SheetLabelConnection
(
g_TabObjNet
+
i
);
/* Compression des numeros de NetCode a des valeurs consecutives */
}
Affiche_1_Parametre
(
this
,
46
,
_
(
"Sorting"
),
wxEmptyString
,
GREEN
);
LastNetCode
=
NetCode
=
0
;
/* Tri du Tableau des objets de Net par NetCode */
for
(
i
=
0
;
i
<
g_NbrObjNet
;
i
++
)
qsort
(
g_TabObjNet
,
g_NbrObjNet
,
sizeof
(
ObjetNetListStruct
),
TriNetCode
);
{
if
(
g_TabObjNet
[
i
].
m_NetCode
!=
LastNetCode
)
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
RED
);
{
NetCode
++
;
LastNetCode
=
g_TabObjNet
[
i
].
m_NetCode
;
/* Compression des numeros de NetCode a des valeurs consecutives */
}
Affiche_1_Parametre
(
this
,
46
,
_
(
"Sorting"
),
wxEmptyString
,
GREEN
);
g_TabObjNet
[
i
].
m_NetCode
=
NetCode
;
LastNetCode
=
NetCode
=
0
;
}
for
(
i
=
0
;
i
<
g_NbrObjNet
;
i
++
)
{
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
GREEN
);
if
(
g_TabObjNet
[
i
].
m_NetCode
!=
LastNetCode
)
{
/* Affectation du m_FlagOfConnection en fonction de connection ou non */
NetCode
++
;
LastNetCode
=
g_TabObjNet
[
i
].
m_NetCode
;
SetUnconnectedFlag
(
BaseTabObjNet
,
g_NbrObjNet
);
}
g_TabObjNet
[
i
].
m_NetCode
=
NetCode
;
return
(
(
void
*
)
BaseTabObjNet
);
}
Affiche_1_Parametre
(
this
,
-
1
,
wxEmptyString
,
_
(
"Done"
),
GREEN
);
/* Affectation du m_FlagOfConnection en fonction de connection ou non */
SetUnconnectedFlag
(
g_TabObjNet
,
g_NbrObjNet
);
return
(
void
*
)
g_TabObjNet
;
}
}
/*************************************************************
/*************************************************************
* Routine qui connecte les sous feuilles par les sheetLabels *
* Routine qui connecte les sous feuilles par les sheetLabels *
**************************************************************/
**************************************************************/
static
void
SheetLabelConnection
(
ObjetNetListStruct
*
SheetLabel
)
static
void
SheetLabelConnection
(
ObjetNetListStruct
*
SheetLabel
)
{
{
int
i
;
int
i
;
ObjetNetListStruct
*
ObjetNet
;
ObjetNetListStruct
*
ObjetNet
;
if
(
SheetLabel
->
m_NetCode
==
0
)
return
;
if
(
SheetLabel
->
m_NetCode
==
0
)
return
;
/* Calcul du numero de sous feuille correspondante au sheetlabel */
/* Calcul du numero de sous feuille correspondante au sheetlabel */
/* Comparaison du SheetLabel avec les GLABELS de la sous feuille
pour regroupement des NetCodes */
/* Comparaison du SheetLabel avec les GLABELS de la sous feuille
for
(
i
=
0
,
ObjetNet
=
g_TabObjNet
;
i
<
g_NbrObjNet
;
i
++
)
* pour regroupement des NetCodes */
{
for
(
i
=
0
,
ObjetNet
=
g_TabObjNet
;
i
<
g_NbrObjNet
;
i
++
)
if
(
ObjetNet
[
i
].
m_SheetNumber
!=
SheetLabel
->
m_NumInclude
)
continue
;
{
if
(
(
ObjetNet
[
i
].
m_Type
!=
NET_GLOBLABEL
)
&&
if
(
ObjetNet
[
i
].
m_SheetNumber
!=
SheetLabel
->
m_NumInclude
)
(
ObjetNet
[
i
].
m_Type
!=
NET_GLOBBUSLABELMEMBER
)
)
continue
;
continue
;
if
(
ObjetNet
[
i
].
m_NetCode
==
SheetLabel
->
m_NetCode
)
continue
;
if
(
(
ObjetNet
[
i
].
m_Type
!=
NET_GLOBLABEL
)
if
(
ObjetNet
[
i
].
m_Label
->
CmpNoCase
(
*
SheetLabel
->
m_Label
)
!=
0
)
continue
;
&&
(
ObjetNet
[
i
].
m_Type
!=
NET_GLOBBUSLABELMEMBER
)
)
continue
;
/* Propagation du Netcode a tous les Objets de meme NetCode */
if
(
ObjetNet
[
i
].
m_NetCode
)
if
(
ObjetNet
[
i
].
m_NetCode
==
SheetLabel
->
m_NetCode
)
PropageNetCode
(
ObjetNet
[
i
].
m_NetCode
,
SheetLabel
->
m_NetCode
,
0
);
continue
;
else
ObjetNet
[
i
].
m_NetCode
=
SheetLabel
->
m_NetCode
;
}
if
(
ObjetNet
[
i
].
m_Label
->
CmpNoCase
(
*
SheetLabel
->
m_Label
)
!=
0
)
continue
;
/* Propagation du Netcode a tous les Objets de meme NetCode */
if
(
ObjetNet
[
i
].
m_NetCode
)
PropageNetCode
(
ObjetNet
[
i
].
m_NetCode
,
SheetLabel
->
m_NetCode
,
0
);
else
ObjetNet
[
i
].
m_NetCode
=
SheetLabel
->
m_NetCode
;
}
}
}
/*****************************************************************************/
/*****************************************************************************/
static
int
ListeObjetConnection
(
WinEDA_SchematicFrame
*
frame
,
SCH_SCREEN
*
screen
,
static
int
ListeObjetConnection
(
WinEDA_SchematicFrame
*
frame
,
SCH_SCREEN
*
screen
,
ObjetNetListStruct
*
ObjNet
)
ObjetNetListStruct
*
ObjNet
)
/*****************************************************************************/
/*****************************************************************************/
/* Routine generant la liste des objets relatifs aux connection
/* Routine generant la liste des objets relatifs aux connection
entree:
*
entree:
screen: pointeur sur l'ecran a traiter
*
screen: pointeur sur l'ecran a traiter
ObjNet:
*
ObjNet:
si NULL: la routine compte seulement le nombre des objets
*
si NULL: la routine compte seulement le nombre des objets
sinon: pointe le tableau a remplir
*
sinon: pointe le tableau a remplir
*/
*/
{
{
int
ii
,
NbrItem
=
0
,
NumSheet
;
int
ii
,
NbrItem
=
0
,
NumSheet
;
EDA_BaseStruct
*
DrawList
;
EDA_BaseStruct
*
DrawList
;
EDA_SchComponentStruct
*
DrawLibItem
;
EDA_SchComponentStruct
*
DrawLibItem
;
int
TransMat
[
2
][
2
],
PartX
,
PartY
,
x2
,
y2
;
int
TransMat
[
2
][
2
],
PartX
,
PartY
,
x2
,
y2
;
EDA_LibComponentStruct
*
Entry
;
EDA_LibComponentStruct
*
Entry
;
LibEDA_BaseStruct
*
DEntry
;
LibEDA_BaseStruct
*
DEntry
;
DrawSheetLabelStruct
*
SheetLabel
;
DrawSheetLabelStruct
*
SheetLabel
;
int
NumInclude
;
int
NumInclude
;
NumSheet
=
screen
->
m_SheetNumber
;
NumSheet
=
screen
->
m_SheetNumber
;
DrawList
=
screen
->
EEDrawList
;
DrawList
=
screen
->
EEDrawList
;
while
(
DrawList
)
for
(
;
DrawList
;
DrawList
=
DrawList
->
Pnext
)
{
{
switch
(
DrawList
->
Type
()
)
switch
(
DrawList
->
Type
()
)
{
{
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_SEGMENT_STRUCT_TYPE
:
#undef STRUCT
#undef STRUCT
#define STRUCT ((EDA_DrawLineStruct *) DrawList)
#define STRUCT ( (EDA_DrawLineStruct*) DrawList )
if
(
ObjNet
)
if
(
ObjNet
)
{
{
if
(
(
STRUCT
->
m_Layer
!=
LAYER_BUS
)
&&
if
(
(
STRUCT
->
m_Layer
!=
LAYER_BUS
)
(
STRUCT
->
m_Layer
!=
LAYER_WIRE
)
)
&&
(
STRUCT
->
m_Layer
!=
LAYER_WIRE
)
)
break
;
break
;
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Start
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Start
;
ObjNet
[
NbrItem
].
m_End
=
STRUCT
->
m_End
;
ObjNet
[
NbrItem
].
m_End
=
STRUCT
->
m_End
;
if
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
{
if
(
STRUCT
->
m_Layer
==
LAYER_BUS
)
ObjNet
[
NbrItem
].
m_Type
=
NET_BUS
;
{
}
ObjNet
[
NbrItem
].
m_Type
=
NET_BUS
;
else
/* Cas des WIRE */
}
{
else
/* Cas des WIRE */
ObjNet
[
NbrItem
].
m_Type
=
NET_SEGMENT
;
{
}
ObjNet
[
NbrItem
].
m_Type
=
NET_SEGMENT
;
}
}
NbrItem
++
;
}
break
;
NbrItem
++
;
break
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
#undef STRUCT
case
DRAW_JUNCTION_STRUCT_TYPE
:
#define STRUCT ((DrawJunctionStruct *) DrawList)
#undef STRUCT
if
(
ObjNet
)
#define STRUCT ( (DrawJunctionStruct*) DrawList )
{
if
(
ObjNet
)
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
{
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
ObjNet
[
NbrItem
].
m_Type
=
NET_JONCTION
;
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_Type
=
NET_JONCTION
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Pos
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Pos
;
}
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
NbrItem
++
;
}
break
;
NbrItem
++
;
break
;
case
DRAW_NOCONNECT_STRUCT_TYPE
:
#undef STRUCT
case
DRAW_NOCONNECT_STRUCT_TYPE
:
#define STRUCT ((DrawNoConnectStruct *) DrawList)
#undef STRUCT
if
(
ObjNet
)
#define STRUCT ( (DrawNoConnectStruct*) DrawList )
{
if
(
ObjNet
)
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
{
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
ObjNet
[
NbrItem
].
m_Type
=
NET_NOCONNECT
;
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_Type
=
NET_NOCONNECT
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Pos
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Pos
;
}
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
NbrItem
++
;
}
break
;
NbrItem
++
;
break
;
case
DRAW_LABEL_STRUCT_TYPE
:
#undef STRUCT
case
DRAW_LABEL_STRUCT_TYPE
:
#define STRUCT ((DrawLabelStruct *) DrawList)
#undef STRUCT
ii
=
IsBusLabel
(
STRUCT
->
m_Text
);
#define STRUCT ( (DrawLabelStruct*) DrawList )
if
(
ObjNet
)
ii
=
IsBusLabel
(
STRUCT
->
m_Text
);
{
if
(
ObjNet
)
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
{
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
ObjNet
[
NbrItem
].
m_Type
=
NET_LABEL
;
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
if
(
STRUCT
->
m_Layer
==
LAYER_GLOBLABEL
)
ObjNet
[
NbrItem
].
m_Type
=
NET_LABEL
;
ObjNet
[
NbrItem
].
m_Type
=
NET_GLOBLABEL
;
ObjNet
[
NbrItem
].
m_Label
=
&
STRUCT
->
m_Text
;
if
(
STRUCT
->
m_Layer
==
LAYER_GLOBLABEL
)
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_Type
=
NET_GLOBLABEL
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Pos
;
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
ObjNet
[
NbrItem
].
m_Label
=
&
STRUCT
->
m_Text
;
/* Si c'est un Bus, eclatement en Label */
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
if
(
ii
)
ConvertBusToMembers
(
ObjNet
+
NbrItem
);
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Pos
;
}
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
NbrItem
+=
ii
+
1
;
break
;
/* Si c'est un Bus, eclatement en Label */
if
(
ii
)
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
ConvertBusToMembers
(
ObjNet
+
NbrItem
);
#undef STRUCT
}
#define STRUCT ((DrawGlobalLabelStruct *) DrawList)
NbrItem
+=
ii
+
1
;
ii
=
IsBusLabel
(
STRUCT
->
m_Text
);
break
;
if
(
ObjNet
)
{
case
DRAW_GLOBAL_LABEL_STRUCT_TYPE
:
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
#undef STRUCT
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
#define STRUCT ( (DrawGlobalLabelStruct*) DrawList )
ObjNet
[
NbrItem
].
m_Type
=
NET_LABEL
;
ii
=
IsBusLabel
(
STRUCT
->
m_Text
);
if
(
STRUCT
->
m_Layer
==
LAYER_GLOBLABEL
)
if
(
ObjNet
)
ObjNet
[
NbrItem
].
m_Type
=
NET_GLOBLABEL
;
{
ObjNet
[
NbrItem
].
m_Label
=
&
STRUCT
->
m_Text
;
ObjNet
[
NbrItem
].
m_Comp
=
STRUCT
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Pos
;
ObjNet
[
NbrItem
].
m_Type
=
NET_LABEL
;
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
/* Si c'est un Bus, eclatement en Label */
if
(
STRUCT
->
m_Layer
==
LAYER_GLOBLABEL
)
if
(
ii
)
ConvertBusToMembers
(
ObjNet
+
NbrItem
);
ObjNet
[
NbrItem
].
m_Type
=
NET_GLOBLABEL
;
}
NbrItem
+=
ii
+
1
;
ObjNet
[
NbrItem
].
m_Label
=
&
STRUCT
->
m_Text
;
break
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_Start
=
STRUCT
->
m_Pos
;
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
memcpy
(
TransMat
,
DrawLibItem
->
m_Transform
,
sizeof
(
TransMat
));
/* Si c'est un Bus, eclatement en Label */
PartX
=
DrawLibItem
->
m_Pos
.
x
;
PartY
=
DrawLibItem
->
m_Pos
.
y
;
if
(
ii
)
Entry
=
FindLibPart
(
DrawLibItem
->
m_ChipName
,
wxEmptyString
,
FIND_ROOT
);
ConvertBusToMembers
(
ObjNet
+
NbrItem
);
}
if
(
Entry
==
NULL
)
break
;
NbrItem
+=
ii
+
1
;
if
(
Entry
->
m_Drawings
==
NULL
)
break
;
break
;
DEntry
=
Entry
->
m_Drawings
;
for
(
;
DEntry
!=
NULL
;
DEntry
=
DEntry
->
Next
())
case
DRAW_LIB_ITEM_STRUCT_TYPE
:
{
DrawLibItem
=
(
EDA_SchComponentStruct
*
)
DrawList
;
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DEntry
;
if
(
DEntry
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
continue
;
memcpy
(
TransMat
,
DrawLibItem
->
m_Transform
,
sizeof
(
TransMat
)
);
if
(
DEntry
->
m_Unit
&&
(
DEntry
->
m_Unit
!=
DrawLibItem
->
m_Multi
)
)
continue
;
PartX
=
DrawLibItem
->
m_Pos
.
x
;
if
(
DEntry
->
m_Convert
&&
PartY
=
DrawLibItem
->
m_Pos
.
y
;
(
DEntry
->
m_Convert
!=
DrawLibItem
->
m_Convert
))
continue
;
Entry
=
FindLibPart
(
DrawLibItem
->
m_ChipName
,
wxEmptyString
,
FIND_ROOT
);
x2
=
PartX
+
TransMat
[
0
][
0
]
*
Pin
->
m_Pos
.
x
+
TransMat
[
0
][
1
]
*
Pin
->
m_Pos
.
y
;
if
(
Entry
==
NULL
)
y2
=
PartY
+
TransMat
[
1
][
0
]
*
Pin
->
m_Pos
.
x
break
;
+
TransMat
[
1
][
1
]
*
Pin
->
m_Pos
.
y
;
if
(
Entry
->
m_Drawings
==
NULL
)
if
(
ObjNet
)
break
;
{
ObjNet
[
NbrItem
].
m_Comp
=
DEntry
;
DEntry
=
Entry
->
m_Drawings
;
ObjNet
[
NbrItem
].
m_Type
=
NET_PIN
;
ObjNet
[
NbrItem
].
m_Link
=
DrawLibItem
;
for
(
;
DEntry
!=
NULL
;
DEntry
=
DEntry
->
Next
()
)
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
{
ObjNet
[
NbrItem
].
m_ElectricalType
=
Pin
->
m_PinType
;
LibDrawPin
*
Pin
=
(
LibDrawPin
*
)
DEntry
;
ObjNet
[
NbrItem
].
m_PinNum
=
Pin
->
m_PinNum
;
if
(
DEntry
->
Type
()
!=
COMPONENT_PIN_DRAW_TYPE
)
ObjNet
[
NbrItem
].
m_Label
=
&
Pin
->
m_PinName
;
continue
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_Start
.
x
=
x2
;
if
(
DEntry
->
m_Unit
ObjNet
[
NbrItem
].
m_Start
.
y
=
y2
;
&&
(
DEntry
->
m_Unit
!=
DrawLibItem
->
m_Multi
)
)
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
continue
;
}
NbrItem
++
;
if
(
DEntry
->
m_Convert
&&
(
DEntry
->
m_Convert
!=
DrawLibItem
->
m_Convert
)
)
if
(
(
(
int
)
Pin
->
m_PinType
==
(
int
)
PIN_POWER_IN
)
&&
continue
;
(
Pin
->
m_Attributs
&
PINNOTDRAW
)
)
{
/* Il y a un PIN_LABEL Associe */
x2
=
PartX
+
TransMat
[
0
][
0
]
*
Pin
->
m_Pos
.
x
if
(
ObjNet
)
+
TransMat
[
0
][
1
]
*
Pin
->
m_Pos
.
y
;
{
ObjNet
[
NbrItem
].
m_Comp
=
NULL
;
y2
=
PartY
+
TransMat
[
1
][
0
]
*
Pin
->
m_Pos
.
x
ObjNet
[
NbrItem
].
m_Type
=
NET_PINLABEL
;
+
TransMat
[
1
][
1
]
*
Pin
->
m_Pos
.
y
;
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
if
(
ObjNet
)
ObjNet
[
NbrItem
].
m_Label
=
&
Pin
->
m_PinName
;
{
ObjNet
[
NbrItem
].
m_Start
.
x
=
x2
;
ObjNet
[
NbrItem
].
m_Comp
=
DEntry
;
ObjNet
[
NbrItem
].
m_Start
.
y
=
y2
;
ObjNet
[
NbrItem
].
m_Type
=
NET_PIN
;
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
ObjNet
[
NbrItem
].
m_Link
=
DrawLibItem
;
}
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
NbrItem
++
;
ObjNet
[
NbrItem
].
m_ElectricalType
=
Pin
->
m_PinType
;
}
ObjNet
[
NbrItem
].
m_PinNum
=
Pin
->
m_PinNum
;
}
ObjNet
[
NbrItem
].
m_Label
=
&
Pin
->
m_PinName
;
break
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_Start
.
x
=
x2
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
ObjNet
[
NbrItem
].
m_Start
.
y
=
y2
;
case
DRAW_POLYLINE_STRUCT_TYPE
:
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
case
DRAW_BUSENTRY_STRUCT_TYPE
:
}
case
DRAW_MARKER_STRUCT_TYPE
:
NbrItem
++
;
case
DRAW_TEXT_STRUCT_TYPE
:
break
;
if
(
(
(
int
)
Pin
->
m_PinType
==
(
int
)
PIN_POWER_IN
)
&&
(
Pin
->
m_Attributs
&
PINNOTDRAW
)
)
case
DRAW_SHEET_STRUCT_TYPE
:
{
#undef STRUCT
/* Il y a un PIN_LABEL Associe */
#define STRUCT ((DrawSheetStruct *) DrawList)
if
(
ObjNet
)
NumInclude
=
STRUCT
->
m_SheetNumber
;
{
ObjNet
[
NbrItem
].
m_Comp
=
NULL
;
SheetLabel
=
STRUCT
->
m_Label
;
ObjNet
[
NbrItem
].
m_Type
=
NET_PINLABEL
;
for
(
;
SheetLabel
!=
NULL
;
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
SheetLabel
=
(
DrawSheetLabelStruct
*
)
SheetLabel
->
Pnext
)
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
{
ObjNet
[
NbrItem
].
m_Label
=
&
Pin
->
m_PinName
;
ii
=
IsBusLabel
(
SheetLabel
->
m_Text
);
ObjNet
[
NbrItem
].
m_Start
.
x
=
x2
;
if
(
ObjNet
)
ObjNet
[
NbrItem
].
m_Start
.
y
=
y2
;
{
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
ObjNet
[
NbrItem
].
m_Comp
=
SheetLabel
;
}
ObjNet
[
NbrItem
].
m_Link
=
DrawList
;
NbrItem
++
;
ObjNet
[
NbrItem
].
m_Type
=
NET_SHEETLABEL
;
}
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
}
ObjNet
[
NbrItem
].
m_ElectricalType
=
SheetLabel
->
m_Shape
;
ObjNet
[
NbrItem
].
m_Label
=
&
SheetLabel
->
m_Text
;
break
;
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_NumInclude
=
NumInclude
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
ObjNet
[
NbrItem
].
m_Start
=
SheetLabel
->
m_Pos
;
case
DRAW_POLYLINE_STRUCT_TYPE
:
ObjNet
[
NbrItem
].
m_End
=
ObjNet
[
NbrItem
].
m_Start
;
case
DRAW_BUSENTRY_STRUCT_TYPE
:
/* Si c'est un Bus, eclatement en Label */
case
DRAW_MARKER_STRUCT_TYPE
:
if
(
ii
)
ConvertBusToMembers
(
ObjNet
+
NbrItem
);
case
DRAW_TEXT_STRUCT_TYPE
:
}
break
;
NbrItem
+=
ii
+
1
;
}
case
DRAW_SHEET_STRUCT_TYPE
:
break
;
#undef STRUCT
#define STRUCT ( (DrawSheetStruct*) DrawList )
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
NumInclude
=
STRUCT
->
m_SheetNumber
;
DisplayError
(
frame
,
wxT
(
"Netlist: Type DRAW_SHEETLABEL inattendu"
));
break
;
SheetLabel
=
STRUCT
->
m_Label
;
for
(
;
SheetLabel
!=
NULL
;
default
:
SheetLabel
=
(
DrawSheetLabelStruct
*
)
SheetLabel
->
Pnext
)
{
{
wxString
msg
;
ii
=
IsBusLabel
(
SheetLabel
->
m_Text
);
msg
.
Printf
(
wxT
(
"Netlist: unexpected type struct %d"
),
if
(
ObjNet
)
DrawList
->
Type
());
{
DisplayError
(
frame
,
msg
);
ObjNet
[
NbrItem
].
m_Comp
=
SheetLabel
;
break
;
ObjNet
[
NbrItem
].
m_Link
=
DrawList
;
}
ObjNet
[
NbrItem
].
m_Type
=
NET_SHEETLABEL
;
}
ObjNet
[
NbrItem
].
m_Screen
=
screen
;
ObjNet
[
NbrItem
].
m_ElectricalType
=
SheetLabel
->
m_Shape
;
DrawList
=
DrawList
->
Pnext
;
ObjNet
[
NbrItem
].
m_Label
=
&
SheetLabel
->
m_Text
;
}
ObjNet
[
NbrItem
].
m_SheetNumber
=
NumSheet
;
ObjNet
[
NbrItem
].
m_NumInclude
=
NumInclude
;
return
(
NbrItem
);
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
);
}
NbrItem
+=
ii
+
1
;
}
break
;
case
DRAW_SHEETLABEL_STRUCT_TYPE
:
DisplayError
(
frame
,
wxT
(
"Netlist: Type DRAW_SHEETLABEL inattendu"
)
);
break
;
default
:
{
wxString
msg
;
msg
.
Printf
(
wxT
(
"Netlist: unexpected type struct %d"
),
DrawList
->
Type
()
);
DisplayError
(
frame
,
msg
);
break
;
}
}
}
return
NbrItem
;
}
}
/************************************************************************/
/************************************************************************/
static
void
ConnectBusLabels
(
ObjetNetListStruct
*
Label
,
int
NbItems
)
static
void
ConnectBusLabels
(
ObjetNetListStruct
*
Label
,
int
NbItems
)
/************************************************************************/
/************************************************************************/
/* Routine qui analyse les labels type xxBUSLABELMEMBER
/* Routine qui analyse les labels type xxBUSLABELMEMBER
Propage les Netcodes entre labels correspondants ( c'est a dire lorsque
*
Propage les Netcodes entre labels correspondants ( c'est a dire lorsque
leur numero de membre est identique) lorsqu'ils sont connectes
*
leur numero de membre est identique) lorsqu'ils sont connectes
globalement par leur BusNetCode
*
globalement par leur BusNetCode
Utilise et met a jour la variable LastNetCode
*
Utilise et met a jour la variable LastNetCode
*/
*/
{
{
ObjetNetListStruct
*
LabelInTst
,
*
Lim
;
ObjetNetListStruct
*
LabelInTst
,
*
Lim
;
Lim
=
Label
+
NbItems
;
Lim
=
Label
+
NbItems
;
for
(
;
Label
<
Lim
;
Label
++
)
for
(
;
Label
<
Lim
;
Label
++
)
{
{
if
(
(
Label
->
m_Type
==
NET_SHEETBUSLABELMEMBER
)
||
if
(
(
Label
->
m_Type
==
NET_SHEETBUSLABELMEMBER
)
(
Label
->
m_Type
==
NET_BUSLABELMEMBER
)
||
||
(
Label
->
m_Type
==
NET_BUSLABELMEMBER
)
(
Label
->
m_Type
==
NET_GLOBBUSLABELMEMBER
)
)
||
(
Label
->
m_Type
==
NET_GLOBBUSLABELMEMBER
)
)
{
{
if
(
Label
->
m_NetCode
==
0
)
if
(
Label
->
m_NetCode
==
0
)
{
{
Label
->
m_NetCode
=
LastNetCode
;
LastNetCode
++
;
Label
->
m_NetCode
=
LastNetCode
;
}
LastNetCode
++
;
for
(
LabelInTst
=
Label
+
1
;
LabelInTst
<
Lim
;
LabelInTst
++
)
}
{
if
(
(
LabelInTst
->
m_Type
==
NET_SHEETBUSLABELMEMBER
)
||
for
(
LabelInTst
=
Label
+
1
;
LabelInTst
<
Lim
;
LabelInTst
++
)
(
LabelInTst
->
m_Type
==
NET_BUSLABELMEMBER
)
||
{
(
LabelInTst
->
m_Type
==
NET_GLOBBUSLABELMEMBER
)
)
if
(
(
LabelInTst
->
m_Type
==
NET_SHEETBUSLABELMEMBER
)
{
||
(
LabelInTst
->
m_Type
==
NET_BUSLABELMEMBER
)
if
(
LabelInTst
->
m_BusNetCode
!=
Label
->
m_BusNetCode
)
continue
;
||
(
LabelInTst
->
m_Type
==
NET_GLOBBUSLABELMEMBER
)
)
if
(
LabelInTst
->
m_Member
!=
Label
->
m_Member
)
continue
;
{
if
(
LabelInTst
->
m_NetCode
==
0
)
if
(
LabelInTst
->
m_BusNetCode
!=
Label
->
m_BusNetCode
)
LabelInTst
->
m_NetCode
=
Label
->
m_NetCode
;
continue
;
else
PropageNetCode
(
LabelInTst
->
m_NetCode
,
Label
->
m_NetCode
,
0
);
if
(
LabelInTst
->
m_Member
!=
Label
->
m_Member
)
}
continue
;
}
}
if
(
LabelInTst
->
m_NetCode
==
0
)
}
LabelInTst
->
m_NetCode
=
Label
->
m_NetCode
;
else
PropageNetCode
(
LabelInTst
->
m_NetCode
,
Label
->
m_NetCode
,
0
);
}
}
}
}
}
}
/**************************************************/
/**************************************************/
int
IsBusLabel
(
const
wxString
&
LabelDrawList
)
int
IsBusLabel
(
const
wxString
&
LabelDrawList
)
/**************************************************/
/**************************************************/
/* Routine qui verifie si le Label a une notation de type Bus
/* Routine qui verifie si le Label a une notation de type Bus
Retourne 0 si non
*
Retourne 0 si non
nombre de membres si oui
*
nombre de membres si oui
met a jour FirstNumWireBus, LastNumWireBus et RootBusNameLength
*
met a jour FirstNumWireBus, LastNumWireBus et RootBusNameLength
*/
*/
{
{
unsigned
Num
;
unsigned
Num
;
int
ii
;
int
ii
;
wxString
BufLine
;
wxString
BufLine
;
long
tmp
;
long
tmp
;
bool
error
=
FALSE
;
bool
error
=
FALSE
;
/* Search for '[' because a bus label is like "busname[nn..mm]" */
/* Search for '[' because a bus label is like "busname[nn..mm]" */
ii
=
LabelDrawList
.
Find
(
'['
);
ii
=
LabelDrawList
.
Find
(
'['
);
if
(
ii
<
0
)
return
(
0
);
if
(
ii
<
0
)
Num
=
(
unsigned
)
ii
;
return
0
;
FirstNumWireBus
=
LastNumWireBus
=
9
;
Num
=
(
unsigned
)
ii
;
RootBusNameLength
=
Num
;
Num
++
;
FirstNumWireBus
=
LastNumWireBus
=
9
;
while
(
LabelDrawList
[
Num
]
!=
'.'
&&
Num
<
LabelDrawList
.
Len
())
RootBusNameLength
=
Num
;
{
Num
++
;
BufLine
.
Append
(
LabelDrawList
[
Num
]);
while
(
LabelDrawList
[
Num
]
!=
'.'
&&
Num
<
LabelDrawList
.
Len
()
)
Num
++
;
{
}
BufLine
.
Append
(
LabelDrawList
[
Num
]
);
Num
++
;
if
(
!
BufLine
.
ToLong
(
&
tmp
)
)
error
=
TRUE
;;
}
FirstNumWireBus
=
tmp
;
while
(
LabelDrawList
[
Num
]
==
'.'
&&
Num
<
LabelDrawList
.
Len
()
)
if
(
!
BufLine
.
ToLong
(
&
tmp
)
)
Num
++
;
error
=
TRUE
;
BufLine
.
Empty
();
while
(
LabelDrawList
[
Num
]
!=
']'
&&
Num
<
LabelDrawList
.
Len
())
FirstNumWireBus
=
tmp
;
{
while
(
LabelDrawList
[
Num
]
==
'.'
&&
Num
<
LabelDrawList
.
Len
()
)
BufLine
.
Append
(
LabelDrawList
[
Num
]);
Num
++
;
Num
++
;
}
BufLine
.
Empty
();
if
(
!
BufLine
.
ToLong
(
&
tmp
)
)
error
=
TRUE
;;
while
(
LabelDrawList
[
Num
]
!=
']'
&&
Num
<
LabelDrawList
.
Len
()
)
LastNumWireBus
=
tmp
;
{
BufLine
.
Append
(
LabelDrawList
[
Num
]
);
if
(
FirstNumWireBus
<
0
)
FirstNumWireBus
=
0
;
Num
++
;
if
(
LastNumWireBus
<
0
)
LastNumWireBus
=
0
;
}
if
(
FirstNumWireBus
>
LastNumWireBus
)
{
if
(
!
BufLine
.
ToLong
(
&
tmp
)
)
EXCHG
(
FirstNumWireBus
,
LastNumWireBus
);
error
=
TRUE
;;
}
LastNumWireBus
=
tmp
;
if
(
error
&&
(
s_PassNumber
==
0
)
)
if
(
FirstNumWireBus
<
0
)
{
FirstNumWireBus
=
0
;
wxString
msg
=
_
(
"Bad Bus Label: "
)
+
LabelDrawList
;
if
(
LastNumWireBus
<
0
)
DisplayError
(
NULL
,
msg
);
LastNumWireBus
=
0
;
}
if
(
FirstNumWireBus
>
LastNumWireBus
)
return
(
LastNumWireBus
-
FirstNumWireBus
+
1
);
{
EXCHG
(
FirstNumWireBus
,
LastNumWireBus
);
}
if
(
error
&&
(
s_PassNumber
==
0
)
)
{
wxString
msg
=
_
(
"Bad Bus Label: "
)
+
LabelDrawList
;
DisplayError
(
NULL
,
msg
);
}
return
LastNumWireBus
-
FirstNumWireBus
+
1
;
}
}
/***************************************************************/
/***************************************************************/
static
int
ConvertBusToMembers
(
ObjetNetListStruct
*
BusLabel
)
static
int
ConvertBusToMembers
(
ObjetNetListStruct
*
BusLabel
)
/***************************************************************/
/***************************************************************/
/* Routine qui eclate un label type Bus en autant de Label qu'il contient de membres,
/* Routine qui eclate un label type Bus en autant de Label qu'il contient de membres,
et qui cree les structures avec le type NET_GLOBBUSLABELMEMBER, NET_BUSLABELMEMBER
*
et qui cree les structures avec le type NET_GLOBBUSLABELMEMBER, NET_BUSLABELMEMBER
ou NET_SHEETBUSLABELMEMBER
*
ou NET_SHEETBUSLABELMEMBER
entree = pointeur sur l'ObjetNetListStruct initialise corresp au buslabel
*
entree = pointeur sur l'ObjetNetListStruct initialise corresp au buslabel
suppose que FirstNumWireBus, LastNumWireBus et RootBusNameLength sont a jour
*
suppose que FirstNumWireBus, LastNumWireBus et RootBusNameLength sont a jour
modifie l'ObjetNetListStruct de base et remplit les suivants
*
modifie l'ObjetNetListStruct de base et remplit les suivants
m_Label is a pointer to a new wxString
*
m_Label is a pointer to a new wxString
m_Label must be deallocated by the user (only for a NET_GLOBBUSLABELMEMBER,
*
m_Label must be deallocated by the user (only for a NET_GLOBBUSLABELMEMBER,
NET_BUSLABELMEMBER or a NET_SHEETBUSLABELMEMBER object type)
*
NET_BUSLABELMEMBER or a NET_SHEETBUSLABELMEMBER object type)
*/
*/
{
{
int
NumItem
,
BusMember
;
int
NumItem
,
BusMember
;
wxString
BufLine
;
wxString
BufLine
;
if
(
BusLabel
->
m_Type
==
NET_GLOBLABEL
)
if
(
BusLabel
->
m_Type
==
NET_GLOBLABEL
)
BusLabel
->
m_Type
=
NET_GLOBBUSLABELMEMBER
;
BusLabel
->
m_Type
=
NET_GLOBBUSLABELMEMBER
;
else
if
(
BusLabel
->
m_Type
==
NET_SHEETLABEL
)
else
if
(
BusLabel
->
m_Type
==
NET_SHEETLABEL
)
BusLabel
->
m_Type
=
NET_SHEETBUSLABELMEMBER
;
BusLabel
->
m_Type
=
NET_SHEETBUSLABELMEMBER
;
else
BusLabel
->
m_Type
=
NET_BUSLABELMEMBER
;
else
BusLabel
->
m_Type
=
NET_BUSLABELMEMBER
;
/* Convertion du BusLabel en la racine du Label + le numero du fil */
BufLine
=
BusLabel
->
m_Label
->
Left
(
RootBusNameLength
);
/* Convertion du BusLabel en la racine du Label + le numero du fil */
BusMember
=
FirstNumWireBus
;
BufLine
=
BusLabel
->
m_Label
->
Left
(
RootBusNameLength
);
BufLine
<<
BusMember
;
BusMember
=
FirstNumWireBus
;
BusLabel
->
m_Label
=
new
wxString
(
BufLine
);
BufLine
<<
BusMember
;
BusLabel
->
m_Member
=
BusMember
;
BusLabel
->
m_Label
=
new
wxString
(
BufLine
);
NumItem
=
1
;
BusLabel
->
m_Member
=
BusMember
;
for
(
BusMember
++
;
BusMember
<=
LastNumWireBus
;
BusMember
++
)
NumItem
=
1
;
{
*
(
BusLabel
+
1
)
=
*
BusLabel
;
BusLabel
++
;
NumItem
++
;
for
(
BusMember
++
;
BusMember
<=
LastNumWireBus
;
BusMember
++
)
/* Convertion du BusLabel en la racine du Label + le numero du fil */
{
BufLine
=
BusLabel
->
m_Label
->
Left
(
RootBusNameLength
);
*
(
BusLabel
+
1
)
=
*
BusLabel
;
BusLabel
++
;
NumItem
++
;
BufLine
<<
BusMember
;
BusLabel
->
m_Label
=
new
wxString
(
BufLine
);
/* Convertion du BusLabel en la racine du Label + le numero du fil */
BusLabel
->
m_Member
=
BusMember
;
BufLine
=
BusLabel
->
m_Label
->
Left
(
RootBusNameLength
);
}
BufLine
<<
BusMember
;
return
(
NumItem
);
BusLabel
->
m_Label
=
new
wxString
(
BufLine
);
BusLabel
->
m_Member
=
BusMember
;
}
return
NumItem
;
}
}
/**********************************************************************/
/**********************************************************************/
static
void
PropageNetCode
(
int
OldNetCode
,
int
NewNetCode
,
int
IsBus
)
static
void
PropageNetCode
(
int
OldNetCode
,
int
NewNetCode
,
int
IsBus
)
/**********************************************************************/
/**********************************************************************/
/* PropageNetCode propage le netcode NewNetCode sur tous les elements
/* PropageNetCode propage le netcode NewNetCode sur tous les elements
appartenant a l'ancien netcode OldNetCode
*
appartenant a l'ancien netcode OldNetCode
Si IsBus == 0; c'est le membre NetCode qui est propage
*
Si IsBus == 0; c'est le membre NetCode qui est propage
Si IsBus != 0; c'est le membre BusNetCode qui est propage
*
Si IsBus != 0; c'est le membre BusNetCode qui est propage
*/
*/
{
{
int
jj
;
int
jj
;
ObjetNetListStruct
*
Objet
=
g_TabObjNet
;
ObjetNetListStruct
*
Objet
=
g_TabObjNet
;
if
(
OldNetCode
==
NewNetCode
)
return
;
if
(
OldNetCode
==
NewNetCode
)
return
;
if
(
IsBus
==
0
)
/* Propagation du NetCode */
{
if
(
IsBus
==
0
)
/* Propagation du NetCode */
for
(
jj
=
0
;
jj
<
g_NbrObjNet
;
jj
++
,
Objet
++
)
{
{
for
(
jj
=
0
;
jj
<
g_NbrObjNet
;
jj
++
,
Objet
++
)
if
(
Objet
->
m_NetCode
==
OldNetCode
)
{
{
if
(
Objet
->
m_NetCode
==
OldNetCode
)
Objet
->
m_NetCode
=
NewNetCode
;
{
}
Objet
->
m_NetCode
=
NewNetCode
;
}
}
}
}
}
else
/* Propagation du BusNetCode */
else
/* Propagation du BusNetCode */
{
{
for
(
jj
=
0
;
jj
<
g_NbrObjNet
;
jj
++
,
Objet
++
)
for
(
jj
=
0
;
jj
<
g_NbrObjNet
;
jj
++
,
Objet
++
)
{
{
if
(
Objet
->
m_BusNetCode
==
OldNetCode
)
if
(
Objet
->
m_BusNetCode
==
OldNetCode
)
{
{
Objet
->
m_BusNetCode
=
NewNetCode
;
Objet
->
m_BusNetCode
=
NewNetCode
;
}
}
}
}
}
}
}
}
/***************************************************************************/
/***************************************************************************/
static
void
PointToPointConnect
(
ObjetNetListStruct
*
Ref
,
int
IsBus
,
int
start
)
static
void
PointToPointConnect
(
ObjetNetListStruct
*
Ref
,
int
IsBus
,
int
start
)
/***************************************************************************/
/***************************************************************************/
/* Routine qui verifie si l'element *Ref est connecte a
/* Routine qui verifie si l'element *Ref est connecte a
d'autres elements de la liste des objets du schema, selon le mode Point
*
d'autres elements de la liste des objets du schema, selon le mode Point
a point ( Extremites superposees )
*
a point ( Extremites superposees )
*
si IsBus:
*
si IsBus:
la connexion ne met en jeu que des elements type bus
*
la connexion ne met en jeu que des elements type bus
( BUS ou BUSLABEL ou JONCTION )
*
( BUS ou BUSLABEL ou JONCTION )
sinon
*
sinon
la connexion ne met en jeu que des elements type non bus
*
la connexion ne met en jeu que des elements type non bus
( autres que BUS ou BUSLABEL )
*
( autres que BUS ou BUSLABEL )
*
L'objet Ref doit avoir un NetCode valide.
*
L'objet Ref doit avoir un NetCode valide.
*
La liste des objets est supposee classe par NumSheet Croissants,
*
La liste des objets est supposee classe par NumSheet Croissants,
et la recherche se fait a partir de l'element start, 1er element
*
et la recherche se fait a partir de l'element start, 1er element
de la feuille de schema
*
de la feuille de schema
( il ne peut y avoir connexion physique entre elements de differentes sheets)
*
( il ne peut y avoir connexion physique entre elements de differentes sheets)
*/
*/
{
{
int
i
,
NetCode
;
int
i
,
NetCode
;
ObjetNetListStruct
*
Point
=
g_TabObjNet
;
ObjetNetListStruct
*
Point
=
g_TabObjNet
;
if
(
IsBus
==
0
)
/* Objets autres que BUS et BUSLABELS */
if
(
IsBus
==
0
)
/* Objets autres que BUS et BUSLABELS */
{
{
NetCode
=
Ref
->
m_NetCode
;
NetCode
=
Ref
->
m_NetCode
;
for
(
i
=
start
;
i
<
g_NbrObjNet
;
i
++
)
for
(
i
=
start
;
i
<
g_NbrObjNet
;
i
++
)
{
{
if
(
Point
[
i
].
m_SheetNumber
>
Ref
->
m_SheetNumber
)
break
;
if
(
Point
[
i
].
m_SheetNumber
>
Ref
->
m_SheetNumber
)
break
;
switch
(
Point
[
i
].
m_Type
)
{
switch
(
Point
[
i
].
m_Type
)
case
NET_SEGMENT
:
{
case
NET_PIN
:
case
NET_SEGMENT
:
case
NET_LABEL
:
case
NET_PIN
:
case
NET_GLOBLABEL
:
case
NET_LABEL
:
case
NET_SHEETLABEL
:
case
NET_GLOBLABEL
:
case
NET_PINLABEL
:
case
NET_SHEETLABEL
:
case
NET_JONCTION
:
case
NET_PINLABEL
:
case
NET_NOCONNECT
:
case
NET_JONCTION
:
if
(
(((
Ref
->
m_Start
.
x
==
Point
[
i
].
m_Start
.
x
)
&&
(
Ref
->
m_Start
.
y
==
Point
[
i
].
m_Start
.
y
)))
||
case
NET_NOCONNECT
:
(((
Ref
->
m_Start
.
x
==
Point
[
i
].
m_End
.
x
)
&&
(
Ref
->
m_Start
.
y
==
Point
[
i
].
m_End
.
y
)))
||
if
(
(
(
(
Ref
->
m_Start
.
x
==
Point
[
i
].
m_Start
.
x
)
&&
(((
Ref
->
m_End
.
x
==
Point
[
i
].
m_Start
.
x
)
&&
(
Ref
->
m_End
.
y
==
Point
[
i
].
m_Start
.
y
)))
||
(
Ref
->
m_Start
.
y
==
Point
[
i
].
m_Start
.
y
)
)
)
(((
Ref
->
m_End
.
x
==
Point
[
i
].
m_End
.
x
)
&&
(
Ref
->
m_End
.
y
==
Point
[
i
].
m_End
.
y
)))
)
||
(
(
(
Ref
->
m_Start
.
x
==
Point
[
i
].
m_End
.
x
)
&&
{
(
Ref
->
m_Start
.
y
==
Point
[
i
].
m_End
.
y
)
)
)
if
(
Point
[
i
].
m_NetCode
==
0
)
Point
[
i
].
m_NetCode
=
NetCode
;
||
(
(
(
Ref
->
m_End
.
x
==
Point
[
i
].
m_Start
.
x
)
&&
else
PropageNetCode
(
Point
[
i
].
m_NetCode
,
NetCode
,
0
);
(
Ref
->
m_End
.
y
==
Point
[
i
].
m_Start
.
y
)
)
)
}
||
(
(
(
Ref
->
m_End
.
x
==
Point
[
i
].
m_End
.
x
)
&&
(
Ref
->
m_End
.
y
==
Point
[
i
].
m_End
.
y
)
)
)
)
break
;
{
case
NET_BUS
:
if
(
Point
[
i
].
m_NetCode
==
0
)
case
NET_BUSLABELMEMBER
:
Point
[
i
].
m_NetCode
=
NetCode
;
case
NET_SHEETBUSLABELMEMBER
:
else
case
NET_GLOBBUSLABELMEMBER
:
PropageNetCode
(
Point
[
i
].
m_NetCode
,
NetCode
,
0
);
break
;
}
}
break
;
}
}
case
NET_BUS
:
else
/* Objets type BUS et BUSLABELS ( et JONCTIONS )*/
case
NET_BUSLABELMEMBER
:
{
case
NET_SHEETBUSLABELMEMBER
:
NetCode
=
Ref
->
m_BusNetCode
;
case
NET_GLOBBUSLABELMEMBER
:
for
(
i
=
start
;
i
<
g_NbrObjNet
;
i
++
)
break
;
{
}
if
(
Point
[
i
].
m_SheetNumber
>
Ref
->
m_SheetNumber
)
break
;
}
}
switch
(
Point
[
i
].
m_Type
)
else
/* Objets type BUS et BUSLABELS ( et JONCTIONS )*/
{
{
case
NET_SEGMENT
:
NetCode
=
Ref
->
m_BusNetCode
;
case
NET_PIN
:
for
(
i
=
start
;
i
<
g_NbrObjNet
;
i
++
)
case
NET_LABEL
:
{
case
NET_GLOBLABEL
:
if
(
Point
[
i
].
m_SheetNumber
>
Ref
->
m_SheetNumber
)
case
NET_SHEETLABEL
:
break
;
case
NET_PINLABEL
:
case
NET_NOCONNECT
:
switch
(
Point
[
i
].
m_Type
)
break
;
{
case
NET_SEGMENT
:
case
NET_BUS
:
case
NET_PIN
:
case
NET_BUSLABELMEMBER
:
case
NET_LABEL
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_GLOBLABEL
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_SHEETLABEL
:
case
NET_JONCTION
:
case
NET_PINLABEL
:
if
(
(((
Ref
->
m_Start
.
x
==
Point
[
i
].
m_Start
.
x
)
&&
(
Ref
->
m_Start
.
y
==
Point
[
i
].
m_Start
.
y
)))
||
case
NET_NOCONNECT
:
(((
Ref
->
m_Start
.
x
==
Point
[
i
].
m_End
.
x
)
&&
(
Ref
->
m_Start
.
y
==
Point
[
i
].
m_End
.
y
)))
||
break
;
(((
Ref
->
m_End
.
x
==
Point
[
i
].
m_Start
.
x
)
&&
(
Ref
->
m_End
.
y
==
Point
[
i
].
m_Start
.
y
)))
||
(((
Ref
->
m_End
.
x
==
Point
[
i
].
m_End
.
x
)
&&
(
Ref
->
m_End
.
y
==
Point
[
i
].
m_End
.
y
)))
)
case
NET_BUS
:
{
case
NET_BUSLABELMEMBER
:
if
(
Point
[
i
].
m_BusNetCode
==
0
)
case
NET_SHEETBUSLABELMEMBER
:
Point
[
i
].
m_BusNetCode
=
NetCode
;
case
NET_GLOBBUSLABELMEMBER
:
else
PropageNetCode
(
Point
[
i
].
m_BusNetCode
,
NetCode
,
1
);
case
NET_JONCTION
:
}
if
(
(
(
(
Ref
->
m_Start
.
x
==
Point
[
i
].
m_Start
.
x
)
&&
break
;
(
Ref
->
m_Start
.
y
==
Point
[
i
].
m_Start
.
y
)
)
)
}
||
(
(
(
Ref
->
m_Start
.
x
==
Point
[
i
].
m_End
.
x
)
&&
}
(
Ref
->
m_Start
.
y
==
Point
[
i
].
m_End
.
y
)
)
)
}
||
(
(
(
Ref
->
m_End
.
x
==
Point
[
i
].
m_Start
.
x
)
&&
(
Ref
->
m_End
.
y
==
Point
[
i
].
m_Start
.
y
)
)
)
||
(
(
(
Ref
->
m_End
.
x
==
Point
[
i
].
m_End
.
x
)
&&
(
Ref
->
m_End
.
y
==
Point
[
i
].
m_End
.
y
)
)
)
)
{
if
(
Point
[
i
].
m_BusNetCode
==
0
)
Point
[
i
].
m_BusNetCode
=
NetCode
;
else
PropageNetCode
(
Point
[
i
].
m_BusNetCode
,
NetCode
,
1
);
}
break
;
}
}
}
}
}
/**************************************************************/
/**************************************************************/
static
void
SegmentToPointConnect
(
ObjetNetListStruct
*
Jonction
,
static
void
SegmentToPointConnect
(
ObjetNetListStruct
*
Jonction
,
int
IsBus
,
int
start
)
int
IsBus
,
int
start
)
/***************************************************************/
/***************************************************************/
/*
/*
Routine qui recherche si un point (jonction) est connecte a des segments,
*
Routine qui recherche si un point (jonction) est connecte a des segments,
et regroupe les NetCodes des objets connectes a la jonction.
*
et regroupe les NetCodes des objets connectes a la jonction.
Le point de jonction doit avoir un netcode valide
*
Le point de jonction doit avoir un netcode valide
La liste des objets est supposee classe par NumSheet Croissants,
*
La liste des objets est supposee classe par NumSheet Croissants,
et la recherche se fait a partir de l'element start, 1er element
*
et la recherche se fait a partir de l'element start, 1er element
de la feuille de schema
*
de la feuille de schema
( il ne peut y avoir connexion physique entre elements de differentes sheets)
*
( il ne peut y avoir connexion physique entre elements de differentes sheets)
*/
*/
{
{
int
i
;
int
i
;
ObjetNetListStruct
*
Segment
=
g_TabObjNet
;
ObjetNetListStruct
*
Segment
=
g_TabObjNet
;
for
(
i
=
start
;
i
<
g_NbrObjNet
;
i
++
)
for
(
i
=
start
;
i
<
g_NbrObjNet
;
i
++
)
{
{
if
(
Segment
[
i
].
m_SheetNumber
>
Jonction
->
m_SheetNumber
)
break
;
if
(
Segment
[
i
].
m_SheetNumber
>
Jonction
->
m_SheetNumber
)
break
;
if
(
IsBus
==
0
)
{
if
(
IsBus
==
0
)
if
(
Segment
[
i
].
m_Type
!=
NET_SEGMENT
)
continue
;
{
}
if
(
Segment
[
i
].
m_Type
!=
NET_SEGMENT
)
else
continue
;
{
}
if
(
Segment
[
i
].
m_Type
!=
NET_BUS
)
continue
;
else
}
{
if
(
Segment
[
i
].
m_Type
!=
NET_BUS
)
if
(
SegmentIntersect
(
Segment
[
i
].
m_Start
.
x
,
Segment
[
i
].
m_Start
.
y
,
continue
;
Segment
[
i
].
m_End
.
x
,
Segment
[
i
].
m_End
.
y
,
}
Jonction
->
m_Start
.
x
,
Jonction
->
m_Start
.
y
)
)
{
if
(
SegmentIntersect
(
Segment
[
i
].
m_Start
.
x
,
Segment
[
i
].
m_Start
.
y
,
/* Propagation du Netcode a tous les Objets de meme NetCode */
Segment
[
i
].
m_End
.
x
,
Segment
[
i
].
m_End
.
y
,
if
(
IsBus
==
0
)
Jonction
->
m_Start
.
x
,
Jonction
->
m_Start
.
y
)
)
{
{
if
(
Segment
[
i
].
m_NetCode
)
/* Propagation du Netcode a tous les Objets de meme NetCode */
PropageNetCode
(
Segment
[
i
].
m_NetCode
,
if
(
IsBus
==
0
)
Jonction
->
m_NetCode
,
IsBus
);
{
else
Segment
[
i
].
m_NetCode
=
Jonction
->
m_NetCode
;
if
(
Segment
[
i
].
m_NetCode
)
}
PropageNetCode
(
Segment
[
i
].
m_NetCode
,
else
Jonction
->
m_NetCode
,
IsBus
);
{
else
if
(
Segment
[
i
].
m_BusNetCode
)
Segment
[
i
].
m_NetCode
=
Jonction
->
m_NetCode
;
PropageNetCode
(
Segment
[
i
].
m_BusNetCode
,
}
Jonction
->
m_BusNetCode
,
IsBus
);
else
else
Segment
[
i
].
m_BusNetCode
=
Jonction
->
m_BusNetCode
;
{
}
if
(
Segment
[
i
].
m_BusNetCode
)
}
PropageNetCode
(
Segment
[
i
].
m_BusNetCode
,
}
Jonction
->
m_BusNetCode
,
IsBus
);
else
Segment
[
i
].
m_BusNetCode
=
Jonction
->
m_BusNetCode
;
}
}
}
}
}
/*****************************************************************
/*****************************************************************
* Routine qui connecte les groupes d'objets si labels identiques *
* Routine qui connecte les groupes d'objets si labels identiques *
*******************************************************************/
*******************************************************************/
static
void
LabelConnection
(
ObjetNetListStruct
*
LabelRef
)
static
void
LabelConnection
(
ObjetNetListStruct
*
LabelRef
)
{
{
int
i
,
NetCode
;
int
i
,
NetCode
;
ObjetNetListStruct
*
ObjetNet
;
ObjetNetListStruct
*
ObjetNet
;
if
(
LabelRef
->
m_NetCode
==
0
)
return
;
if
(
LabelRef
->
m_NetCode
==
0
)
return
;
ObjetNet
=
g_TabObjNet
;
ObjetNet
=
g_TabObjNet
;
for
(
i
=
0
;
i
<
g_NbrObjNet
;
i
++
)
{
for
(
i
=
0
;
i
<
g_NbrObjNet
;
i
++
)
NetCode
=
ObjetNet
[
i
].
m_NetCode
;
{
if
(
NetCode
==
LabelRef
->
m_NetCode
)
continue
;
NetCode
=
ObjetNet
[
i
].
m_NetCode
;
if
(
NetCode
==
LabelRef
->
m_NetCode
)
if
(
ObjetNet
[
i
].
m_SheetNumber
!=
LabelRef
->
m_SheetNumber
)
continue
;
{
if
(
ObjetNet
[
i
].
m_Type
!=
NET_PINLABEL
)
continue
;
if
(
ObjetNet
[
i
].
m_SheetNumber
!=
LabelRef
->
m_SheetNumber
)
}
{
if
(
ObjetNet
[
i
].
m_Type
!=
NET_PINLABEL
)
if
(
(
ObjetNet
[
i
].
m_Type
==
NET_LABEL
)
||
continue
;
(
ObjetNet
[
i
].
m_Type
==
NET_GLOBLABEL
)
||
}
(
ObjetNet
[
i
].
m_Type
==
NET_BUSLABELMEMBER
)
||
(
ObjetNet
[
i
].
m_Type
==
NET_GLOBBUSLABELMEMBER
)
||
if
(
(
ObjetNet
[
i
].
m_Type
==
NET_LABEL
)
(
ObjetNet
[
i
].
m_Type
==
NET_PINLABEL
)
)
||
(
ObjetNet
[
i
].
m_Type
==
NET_GLOBLABEL
)
{
||
(
ObjetNet
[
i
].
m_Type
==
NET_BUSLABELMEMBER
)
if
(
ObjetNet
[
i
].
m_Label
->
CmpNoCase
(
*
LabelRef
->
m_Label
)
!=
0
)
continue
;
||
(
ObjetNet
[
i
].
m_Type
==
NET_GLOBBUSLABELMEMBER
)
||
(
ObjetNet
[
i
].
m_Type
==
NET_PINLABEL
)
)
/* Ici 2 labels identiques */
{
if
(
ObjetNet
[
i
].
m_Label
->
CmpNoCase
(
*
LabelRef
->
m_Label
)
!=
0
)
/* Propagation du Netcode a tous les Objets de meme NetCode */
continue
;
if
(
ObjetNet
[
i
].
m_NetCode
)
PropageNetCode
(
ObjetNet
[
i
].
m_NetCode
,
LabelRef
->
m_NetCode
,
0
);
/* Ici 2 labels identiques */
else
ObjetNet
[
i
].
m_NetCode
=
LabelRef
->
m_NetCode
;
}
/* Propagation du Netcode a tous les Objets de meme NetCode */
}
if
(
ObjetNet
[
i
].
m_NetCode
)
PropageNetCode
(
ObjetNet
[
i
].
m_NetCode
,
LabelRef
->
m_NetCode
,
0
);
else
ObjetNet
[
i
].
m_NetCode
=
LabelRef
->
m_NetCode
;
}
}
}
}
/****************************************************************************/
/****************************************************************************/
static
int
TriNetCode
(
ObjetNetListStruct
*
Objet1
,
ObjetNetListStruct
*
Objet2
)
static
int
TriNetCode
(
const
void
*
o1
,
const
void
*
o2
)
/****************************************************************************/
/****************************************************************************/
/* Routine de comparaison pour le tri par NetCode croissant
/* Routine de comparaison pour le tri par NetCode croissant
du tableau des elements connectes ( TabPinSort ) par qsort()
*
du tableau des elements connectes ( TabPinSort ) par qsort()
*/
*/
{
{
return
(
Objet1
->
m_NetCode
-
Objet2
->
m_NetCode
);
ObjetNetListStruct
*
Objet1
=
(
ObjetNetListStruct
*
)
o1
;
ObjetNetListStruct
*
Objet2
=
(
ObjetNetListStruct
*
)
o2
;
return
Objet1
->
m_NetCode
-
Objet2
->
m_NetCode
;
}
}
/*****************************************************************************/
/*****************************************************************************/
static
int
TriBySheet
(
ObjetNetListStruct
*
Objet1
,
ObjetNetListStruct
*
Objet2
)
static
int
TriBySheet
(
const
void
*
o1
,
const
void
*
o2
)
/*****************************************************************************/
/*****************************************************************************/
/* Routine de comparaison pour le tri par NumSheet
/* Routine de comparaison pour le tri par NumSheet
du tableau des elements connectes ( TabPinSort ) par qsort() */
*
du tableau des elements connectes ( TabPinSort ) par qsort() */
{
{
return
(
Objet1
->
m_SheetNumber
-
Objet2
->
m_SheetNumber
);
ObjetNetListStruct
*
Objet1
=
(
ObjetNetListStruct
*
)
o1
;
ObjetNetListStruct
*
Objet2
=
(
ObjetNetListStruct
*
)
o2
;
return
Objet1
->
m_SheetNumber
-
Objet2
->
m_SheetNumber
;
}
}
/**********************************************************************/
/**********************************************************************/
static
void
SetUnconnectedFlag
(
ObjetNetListStruct
*
ListObj
,
int
NbItems
)
static
void
SetUnconnectedFlag
(
ObjetNetListStruct
*
ListObj
,
int
NbItems
)
/**********************************************************************/
/**********************************************************************/
/* Routine positionnant le membre .FlagNoConnect des elements de
/* Routine positionnant le membre .FlagNoConnect des elements de
la liste des objets netliste, tries par ordre de NetCode
*
la liste des objets netliste, tries par ordre de NetCode
*/
*/
{
{
ObjetNetListStruct
*
NetItemRef
,
*
NetItemTst
,
*
ItemPtr
;
ObjetNetListStruct
*
NetItemRef
,
*
NetItemTst
,
*
ItemPtr
;
ObjetNetListStruct
*
NetStart
,
*
NetEnd
,
*
Lim
;
ObjetNetListStruct
*
NetStart
,
*
NetEnd
,
*
Lim
;
int
Nb
;
int
Nb
;
IsConnectType
StateFlag
;
IsConnectType
StateFlag
;
NetStart
=
NetEnd
=
ListObj
;
NetStart
=
NetEnd
=
ListObj
;
Lim
=
ListObj
+
NbItems
;
NetItemRef
=
NetStart
;
NetItemRef
=
NetStart
;
Nb
=
0
;
Nb
=
0
;
StateFlag
=
UNCONNECT
;
StateFlag
=
UNCONNECT
;
for
(
;
NetItemRef
<
Lim
;
NetItemRef
++
)
Lim
=
ListObj
+
NbItems
;
{
for
(
;
NetItemRef
<
Lim
;
NetItemRef
++
)
if
(
NetItemRef
->
m_Type
==
NET_NOCONNECT
)
{
if
(
StateFlag
!=
CONNECT
)
StateFlag
=
NOCONNECT
;
if
(
NetItemRef
->
m_Type
==
NET_NOCONNECT
)
if
(
StateFlag
!=
CONNECT
)
/* Analyse du net en cours */
StateFlag
=
NOCONNECT
;
NetItemTst
=
NetItemRef
+
1
;
/* Analyse du net en cours */
if
(
(
NetItemTst
>=
Lim
)
||
NetItemTst
=
NetItemRef
+
1
;
(
NetItemRef
->
m_NetCode
!=
NetItemTst
->
m_NetCode
)
)
{
/* Net analyse: mise a jour de m_FlagOfConnection */
if
(
(
NetItemTst
>=
Lim
)
NetEnd
=
NetItemTst
;
||
(
NetItemRef
->
m_NetCode
!=
NetItemTst
->
m_NetCode
)
)
{
for
(
ItemPtr
=
NetStart
;
ItemPtr
<
NetEnd
;
ItemPtr
++
)
/* Net analyse: mise a jour de m_FlagOfConnection */
{
NetEnd
=
NetItemTst
;
ItemPtr
->
m_FlagOfConnection
=
StateFlag
;
}
for
(
ItemPtr
=
NetStart
;
ItemPtr
<
NetEnd
;
ItemPtr
++
)
if
(
NetItemTst
>=
Lim
)
return
;
{
ItemPtr
->
m_FlagOfConnection
=
StateFlag
;
/* Start Analyse Nouveau Net */
}
StateFlag
=
UNCONNECT
;
NetStart
=
NetItemTst
;
if
(
NetItemTst
>=
Lim
)
continue
;
return
;
}
/* Start Analyse Nouveau Net */
for
(
;
;
NetItemTst
++
)
StateFlag
=
UNCONNECT
;
{
NetStart
=
NetItemTst
;
if
(
(
NetItemTst
>=
Lim
)
||
continue
;
(
NetItemRef
->
m_NetCode
!=
NetItemTst
->
m_NetCode
)
)
}
break
;
for
(
;
;
NetItemTst
++
)
switch
(
NetItemTst
->
m_Type
)
{
{
if
(
(
NetItemTst
>=
Lim
)
case
NET_SEGMENT
:
||
(
NetItemRef
->
m_NetCode
!=
NetItemTst
->
m_NetCode
)
)
case
NET_LABEL
:
break
;
case
NET_GLOBLABEL
:
case
NET_SHEETLABEL
:
switch
(
NetItemTst
->
m_Type
)
case
NET_PINLABEL
:
{
case
NET_BUS
:
case
NET_SEGMENT
:
case
NET_BUSLABELMEMBER
:
case
NET_LABEL
:
case
NET_SHEETBUSLABELMEMBER
:
case
NET_GLOBLABEL
:
case
NET_GLOBBUSLABELMEMBER
:
case
NET_SHEETLABEL
:
case
NET_JONCTION
:
case
NET_PINLABEL
:
break
;
case
NET_BUS
:
case
NET_BUSLABELMEMBER
:
case
NET_PIN
:
case
NET_SHEETBUSLABELMEMBER
:
if
(
NetItemRef
->
m_Type
==
NET_PIN
)
case
NET_GLOBBUSLABELMEMBER
:
StateFlag
=
CONNECT
;
case
NET_JONCTION
:
break
;
break
;
case
NET_NOCONNECT
:
case
NET_PIN
:
if
(
StateFlag
!=
CONNECT
)
StateFlag
=
NOCONNECT
;
if
(
NetItemRef
->
m_Type
==
NET_PIN
)
break
;
StateFlag
=
CONNECT
;
}
break
;
}
}
case
NET_NOCONNECT
:
if
(
StateFlag
!=
CONNECT
)
StateFlag
=
NOCONNECT
;
break
;
}
}
}
}
}
eeschema/netlist.h
View file @
664a1f72
/**********************************************/
/**********************************************/
/* Module de calcul de la Netliste: netlist.h */
/* Module de calcul de la Netliste: netlist.h */
/**********************************************/
/**********************************************/
#ifndef _NETLIST_H_
#ifndef _NETLIST_H_
#define _NETLIST_H_
#define _NETLIST_H_
...
@@ -15,98 +15,99 @@
...
@@ -15,98 +15,99 @@
/* Indicateurs de type de netliste generee */
/* Indicateurs de type de netliste generee */
typedef
enum
typedef
enum
{
{
NET_TYPE_NOT_INIT
=
0
,
NET_TYPE_NOT_INIT
=
0
,
NET_TYPE_PCBNEW
,
NET_TYPE_PCBNEW
,
NET_TYPE_ORCADPCB2
,
NET_TYPE_ORCADPCB2
,
NET_TYPE_CADSTAR
,
NET_TYPE_CADSTAR
,
NET_TYPE_SPICE
,
NET_TYPE_SPICE
,
NET_TYPE_CUSTOM1
,
NET_TYPE_CUSTOM1
,
NET_TYPE_CUSTOM2
,
NET_TYPE_CUSTOM2
,
NET_TYPE_CUSTOM3
,
NET_TYPE_CUSTOM3
,
NET_TYPE_CUSTOM4
,
NET_TYPE_CUSTOM4
,
NET_TYPE_CUSTOM5
,
NET_TYPE_CUSTOM5
,
NET_TYPE_CUSTOM6
,
NET_TYPE_CUSTOM6
,
NET_TYPE_CUSTOM7
,
NET_TYPE_CUSTOM7
,
NET_TYPE_CUSTOM8
,
NET_TYPE_CUSTOM8
,
NET_TYPE_MAX
NET_TYPE_MAX
}
TypeNetForm
;
}
TypeNetForm
;
/* Max pin number per component and footprint */
/* Max pin number per component and footprint */
#define MAXPIN 5000
#define MAXPIN 5000
typedef
enum
{
/* Type des objets de Net */
typedef
enum
{
/* Type des objets de Net */
NET_SEGMENT
,
NET_SEGMENT
,
NET_BUS
,
NET_BUS
,
NET_JONCTION
,
NET_JONCTION
,
NET_LABEL
,
NET_LABEL
,
NET_GLOBLABEL
,
NET_GLOBLABEL
,
NET_BUSLABELMEMBER
,
NET_BUSLABELMEMBER
,
NET_GLOBBUSLABELMEMBER
,
NET_GLOBBUSLABELMEMBER
,
NET_SHEETBUSLABELMEMBER
,
NET_SHEETBUSLABELMEMBER
,
NET_SHEETLABEL
,
NET_SHEETLABEL
,
NET_PINLABEL
,
NET_PINLABEL
,
NET_PIN
,
NET_PIN
,
NET_NOCONNECT
NET_NOCONNECT
}
NetObjetType
;
}
NetObjetType
;
typedef
enum
{
/* Valeur du Flag de connection */
typedef
enum
{
/* Valeur du Flag de connection */
UNCONNECT
,
/* Pin ou Label non connecte */
UNCONNECT
,
/* Pin ou Label non connecte */
NOCONNECT
,
/* Pin volontairement non connectee (Symb. NoConnect utilise) */
NOCONNECT
,
/* Pin volontairement non connectee (Symb. NoConnect utilise) */
CONNECT
/* connexion normale */
CONNECT
/* connexion normale */
}
IsConnectType
;
}
IsConnectType
;
/* Structure decrivant 1 element de connexion (pour netlist ) */
/* Structure decrivant 1 element de connexion (pour netlist ) */
class
ObjetNetListStruct
class
ObjetNetListStruct
{
{
public
:
public
:
void
*
m_Comp
;
/* Pointeur sur la definition de l'objet */
void
*
m_Comp
;
/* Pointeur sur la definition de l'objet */
void
*
m_Link
;
/* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
void
*
m_Link
;
/* Pour SheetLabelStruct: Pointeur sur la feuille de hierarchie
Pour les Pins: pointeur sur le composant */
*
Pour les Pins: pointeur sur le composant */
int
m_Flag
;
/* flag pour calculs internes */
int
m_Flag
;
/* flag pour calculs internes */
SCH_SCREEN
*
m_Screen
;
/* Ecran d'appartenance */
SCH_SCREEN
*
m_Screen
;
/* Ecran d'appartenance */
NetObjetType
m_Type
;
NetObjetType
m_Type
;
int
m_ElectricalType
;
/* Pour Pins et sheet labels: type electrique */
int
m_ElectricalType
;
/* Pour Pins et sheet labels: type electrique */
int
m_NetCode
;
/* pour elements simples */
int
m_NetCode
;
/* pour elements simples */
int
m_BusNetCode
;
/* pour connexions type bus */
int
m_BusNetCode
;
/* pour connexions type bus */
int
m_Member
;
/* pour les labels type BUSWIRE ( labels de bus eclate )
int
m_Member
;
/* pour les labels type BUSWIRE ( labels de bus eclate )
numero de membre */
*
numero de membre */
IsConnectType
m_FlagOfConnection
;
IsConnectType
m_FlagOfConnection
;
int
m_SheetNumber
;
/* Sheet number for this item */
int
m_SheetNumber
;
/* Sheet number for this item */
int
m_NumInclude
;
/* Numero de sous schema correpondant a la sheet (Gestion des GLabels et Pin Sheet)*/
int
m_NumInclude
;
/* Numero de sous schema correpondant a la sheet (Gestion des GLabels et Pin Sheet)*/
long
m_PinNum
;
/* numero de pin( 4 octets -> 4 codes ascii) */
long
m_PinNum
;
/* numero de pin( 4 octets -> 4 codes ascii) */
const
wxString
*
m_Label
;
/* Tous types Labels:pointeur sur la wxString definissant le label */
const
wxString
*
m_Label
;
/* Tous types Labels:pointeur sur la wxString definissant le label */
wxPoint
m_Start
,
m_End
;
wxPoint
m_Start
,
m_End
;
};
};
/* Structure decrivant 1 composant de la schematique (pour annotation ) */
/* Structure decrivant 1 composant de la schematique (pour annotation ) */
struct
CmpListStruct
struct
CmpListStruct
{
{
public
:
public
:
EDA_SchComponentStruct
*
m_Cmp
;
/* Pointeur sur le composant */
EDA_SchComponentStruct
*
m_Cmp
;
/* Pointeur sur le composant */
int
m_NbParts
;
/* Nombre de parts par boitier */
int
m_NbParts
;
/* Nombre de parts par boitier */
bool
m_PartsLocked
;
// For multi part components: True if the part cannot be changed
bool
m_PartsLocked
;
// For multi part components: True if the part cannot be changed
int
m_Unit
;
/* Numero de part */
int
m_Unit
;
/* Numero de part */
int
m_Sheet
;
/* Numero de hierarchie */
int
m_Sheet
;
/* Numero de hierarchie */
unsigned
long
m_TimeStamp
;
/* Signature temporelle */
unsigned
long
m_TimeStamp
;
/* Signature temporelle */
int
m_IsNew
;
/* != 0 pour composants non annotes */
int
m_IsNew
;
/* != 0 pour composants non annotes */
char
m_TextValue
[
32
];
/* Valeur */
char
m_TextValue
[
32
];
/* Valeur */
char
m_TextRef
[
32
];
/* Reference ( hors numero ) */
char
m_TextRef
[
32
];
/* Reference ( hors numero ) */
int
m_NumRef
;
/* Numero de reference */
int
m_NumRef
;
/* Numero de reference */
int
m_Flag
;
/* flag pour calculs internes */
int
m_Flag
;
/* flag pour calculs internes */
wxPoint
m_Pos
;
/* position components */
wxPoint
m_Pos
;
/* position components */
};
};
/* Global Variables */
/* Global Variables */
eda_global
int
g_NbrObjNet
;
eda_global
int
g_NbrObjNet
;
eda_global
ObjetNetListStruct
*
g_TabObjNet
;
eda_global
ObjetNetListStruct
*
g_TabObjNet
;
/* Prototypes: */
/* Prototypes: */
void
WriteNetList
(
WinEDA_SchematicFrame
*
frame
,
const
wxString
&
FileNameNL
,
bool
use_netnames
);
void
WriteNetList
(
WinEDA_SchematicFrame
*
frame
,
const
wxString
&
FileNameNL
,
bool
use_netnames
);
void
FreeTabNetList
(
ObjetNetListStruct
*
TabNetItems
,
int
NbrNetItems
);
void
FreeTabNetList
(
ObjetNetListStruct
*
TabNetItems
,
int
NbrNetItems
);
#endif
#endif
eeschema/program.h
View file @
664a1f72
...
@@ -75,9 +75,10 @@ public:
...
@@ -75,9 +75,10 @@ public:
public
:
public
:
EDA_DrawLineStruct
(
const
wxPoint
&
pos
,
int
layer
);
EDA_DrawLineStruct
(
const
wxPoint
&
pos
,
int
layer
);
~
EDA_DrawLineStruct
()
{
}
~
EDA_DrawLineStruct
()
{
}
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"EDA_DrawLine
Struct
"
);
return
wxT
(
"EDA_DrawLine"
);
}
}
...
@@ -92,6 +93,17 @@ public:
...
@@ -92,6 +93,17 @@ public:
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
int
Color
=
-
1
);
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
};
...
@@ -108,7 +120,7 @@ public:
...
@@ -108,7 +120,7 @@ public:
~
DrawMarkerStruct
();
~
DrawMarkerStruct
();
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawMarker
Struct
"
);
return
wxT
(
"DrawMarker"
);
}
}
...
@@ -116,6 +128,16 @@ public:
...
@@ -116,6 +128,16 @@ public:
wxString
GetComment
();
wxString
GetComment
();
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
virtual
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
,
int
Color
=
-
1
);
int
draw_mode
,
int
Color
=
-
1
);
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
};
...
@@ -129,7 +151,7 @@ public:
...
@@ -129,7 +151,7 @@ public:
~
DrawNoConnectStruct
()
{
}
~
DrawNoConnectStruct
()
{
}
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawNoConnect
Struct
"
);
return
wxT
(
"DrawNoConnect"
);
}
}
...
@@ -154,9 +176,10 @@ public:
...
@@ -154,9 +176,10 @@ public:
public
:
public
:
DrawBusEntryStruct
(
const
wxPoint
&
pos
,
int
shape
,
int
id
);
DrawBusEntryStruct
(
const
wxPoint
&
pos
,
int
shape
,
int
id
);
~
DrawBusEntryStruct
()
{
}
~
DrawBusEntryStruct
()
{
}
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawBusEntry
Struct
"
);
return
wxT
(
"DrawBusEntry"
);
}
}
...
@@ -177,9 +200,10 @@ public:
...
@@ -177,9 +200,10 @@ public:
public
:
public
:
DrawPolylineStruct
(
int
layer
);
DrawPolylineStruct
(
int
layer
);
~
DrawPolylineStruct
();
~
DrawPolylineStruct
();
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawPolyline
Struct
"
);
return
wxT
(
"DrawPolyline"
);
}
}
...
@@ -197,9 +221,10 @@ public:
...
@@ -197,9 +221,10 @@ public:
public
:
public
:
DrawJunctionStruct
(
const
wxPoint
&
pos
);
DrawJunctionStruct
(
const
wxPoint
&
pos
);
~
DrawJunctionStruct
()
{
}
~
DrawJunctionStruct
()
{
}
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawJunction
Struct
"
);
return
wxT
(
"DrawJunction"
);
}
}
...
@@ -209,8 +234,7 @@ public:
...
@@ -209,8 +234,7 @@ public:
};
};
class
DrawTextStruct
:
public
EDA_BaseStruct
class
DrawTextStruct
:
public
EDA_BaseStruct
,
public
EDA_TextStruct
,
public
EDA_TextStruct
{
{
public
:
public
:
int
m_Layer
;
int
m_Layer
;
...
@@ -224,7 +248,7 @@ public:
...
@@ -224,7 +248,7 @@ public:
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawText
Struct
"
);
return
wxT
(
"DrawText"
);
}
}
...
@@ -248,7 +272,7 @@ public:
...
@@ -248,7 +272,7 @@ public:
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawLabel
Struct
"
);
return
wxT
(
"DrawLabel"
);
}
}
};
};
...
@@ -264,7 +288,7 @@ public:
...
@@ -264,7 +288,7 @@ public:
virtual
wxString
GetClass
()
const
virtual
wxString
GetClass
()
const
{
{
return
wxT
(
"DrawGlobalLabel
Struct
"
);
return
wxT
(
"DrawGlobalLabel"
);
}
}
};
};
...
...
eeschema/protos.h
View file @
664a1f72
...
@@ -8,7 +8,7 @@ LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos,
...
@@ -8,7 +8,7 @@ LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos,
int
Unit
,
int
Convert
,
EDA_SchComponentStruct
*
DrawItem
=
NULL
);
int
Unit
,
int
Convert
,
EDA_SchComponentStruct
*
DrawItem
=
NULL
);
/* Routine de localisation d'une PIN de la PartLib pointee par Entry */
/* Routine de localisation d'une PIN de la PartLib pointee par Entry */
wxString
ReturnDefaultFieldName
(
int
FieldNumber
);
const
wxString
&
ReturnDefaultFieldName
(
int
aFieldNdx
);
/***************/
/***************/
...
...
include/drawpanel_wxstruct.h
View file @
664a1f72
...
@@ -215,7 +215,7 @@ private:
...
@@ -215,7 +215,7 @@ private:
char
m_FlagRefreshReq
;
/* indique que l'ecran doit redessine */
char
m_FlagRefreshReq
;
/* indique que l'ecran doit redessine */
char
m_FlagModified
;
// indique modif du PCB,utilise pour eviter une sortie sans sauvegarde
char
m_FlagModified
;
// indique modif du PCB,utilise pour eviter une sortie sans sauvegarde
char
m_FlagSave
;
// indique sauvegarde auto faite
char
m_FlagSave
;
// indique sauvegarde auto faite
EDA_BaseStruct
*
m_CurrentItem
;
///< Current selected object
EDA_BaseStruct
*
m_CurrentItem
;
///< Current
ly
selected object
/* Valeurs du pas de grille et du zoom */
/* Valeurs du pas de grille et du zoom */
public
:
public
:
...
@@ -260,16 +260,11 @@ public:
...
@@ -260,16 +260,11 @@ public:
/**
/**
* Function SetCurItem
* Function SetCurItem
* sets the currently selected object, m_CurrentItem.
* sets the currently selected object, m_CurrentItem.
* This is intentionally not inlined so we can set breakpoints on the
* activity easier in base_screen.cpp.
* @param current Any object derived from EDA_BaseStruct
* @param current Any object derived from EDA_BaseStruct
*/
*/
void
SetCurItem
(
EDA_BaseStruct
*
current
)
void
SetCurItem
(
EDA_BaseStruct
*
current
)
{
m_CurrentItem
=
current
;
}
{
m_CurrentItem
=
current
;
}
EDA_BaseStruct
*
GetCurItem
()
const
{
return
m_CurrentItem
;
}
EDA_BaseStruct
*
GetCurItem
()
const
{
return
m_CurrentItem
;
}
/* fonctions relatives au zoom */
/* fonctions relatives au zoom */
int
GetZoom
();
/* retourne le coeff de zoom */
int
GetZoom
();
/* retourne le coeff de zoom */
...
@@ -313,6 +308,18 @@ public:
...
@@ -313,6 +308,18 @@ public:
{
{
return
wxT
(
"BASE_SCREEN"
);
return
wxT
(
"BASE_SCREEN"
);
}
}
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
};
...
...
pcbnew/controle.cpp
View file @
664a1f72
...
@@ -441,10 +441,10 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
...
@@ -441,10 +441,10 @@ BOARD_ITEM* WinEDA_BasePcbFrame::PcbGeneralLocateAndDisplay()
{
{
wxMenu
itemMenu
;
wxMenu
itemMenu
;
int
limit
=
MIN
(
MAX_ITEMS_IN_PICKER
,
m_Collector
->
GetCount
()
);
itemMenu
.
SetTitle
(
_
(
"Selection Clarification"
)
);
// does this work? not under Linux!
itemMenu
.
SetTitle
(
_
(
"Selection Clarification"
)
);
// does this work? not under Linux!
int
limit
=
MIN
(
MAX_ITEMS_IN_PICKER
,
m_Collector
->
GetCount
()
);
for
(
int
i
=
0
;
i
<
limit
;
++
i
)
for
(
int
i
=
0
;
i
<
limit
;
++
i
)
{
{
wxString
text
;
wxString
text
;
...
...
pcbnew/onrightclick.cpp
View file @
664a1f72
...
@@ -63,8 +63,8 @@ static wxMenu* Append_Track_Width_List()
...
@@ -63,8 +63,8 @@ static wxMenu* Append_Track_Width_List()
* @return a pointeur to the menu
* @return a pointeur to the menu
*/
*/
{
{
#define TRACK_HISTORY_NUMBER_MAX 6
#define TRACK_HISTORY_NUMBER_MAX 6
#define VIA_HISTORY_NUMBER_MAX 4
#define VIA_HISTORY_NUMBER_MAX 4
int
ii
;
int
ii
;
wxString
msg
;
wxString
msg
;
wxMenu
*
trackwidth_menu
;
wxMenu
*
trackwidth_menu
;
...
@@ -124,6 +124,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
...
@@ -124,6 +124,7 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
DrawPanel
->
CursorOff
(
&
dc
);
DrawPanel
->
CursorOff
(
&
dc
);
DrawPanel
->
m_CanStartBlock
=
-
1
;
// Avoid to start a block coomand when clicking on menu
DrawPanel
->
m_CanStartBlock
=
-
1
;
// Avoid to start a block coomand when clicking on menu
// If command in progress: Put the Cancel command (if needed) and End command
// If command in progress: Put the Cancel command (if needed) and End command
if
(
m_ID_current_state
)
if
(
m_ID_current_state
)
{
{
...
@@ -160,14 +161,12 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
...
@@ -160,14 +161,12 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
return
;
return
;
}
}
/* Select a proper item */
/* Select a proper item */
if
(
(
item
==
NULL
)
||
(
item
->
m_Flags
==
0
)
)
if
(
!
item
||
!
item
->
m_Flags
)
{
{
item
=
PcbGeneralLocateAndDisplay
();
item
=
PcbGeneralLocateAndDisplay
();
SetCurItem
(
item
);
}
}
item
=
GetCurItem
();
if
(
item
)
if
(
item
)
flags
=
item
->
m_Flags
;
flags
=
item
->
m_Flags
;
else
else
...
@@ -183,10 +182,18 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
...
@@ -183,10 +182,18 @@ void WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
if
(
m_HTOOL_current_state
==
ID_TOOLBARH_PCB_AUTOPLACE
)
if
(
m_HTOOL_current_state
==
ID_TOOLBARH_PCB_AUTOPLACE
)
{
{
aPopMenu
->
AppendSeparator
();
aPopMenu
->
AppendSeparator
();
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE
,
_
(
"Lock Module"
),
Locked_xpm
);
if
(
!
((
MODULE
*
)
item
)
->
IsLocked
()
)
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_AUTOPLACE_FREE_MODULE
,
_
(
"Unlock Module"
),
{
Unlocked_xpm
);
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_AUTOPLACE_FIXE_MODULE
,
_
(
"Lock Module"
),
Locked_xpm
);
}
else
{
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_AUTOPLACE_FREE_MODULE
,
_
(
"Unlock Module"
),
Unlocked_xpm
);
}
if
(
!
flags
)
if
(
!
flags
)
aPopMenu
->
Append
(
ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE
,
aPopMenu
->
Append
(
ID_POPUP_PCB_AUTOPLACE_CURRENT_MODULE
,
_
(
"Auto place Module"
)
);
_
(
"Auto place Module"
)
);
...
...
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