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
441efc9f
Commit
441efc9f
authored
Dec 31, 2008
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bugs and problems solved in fields edition (some are windows only)
parent
23748be6
Changes
26
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
288 additions
and
660 deletions
+288
-660
CHANGELOG.txt
CHANGELOG.txt
+3
-1
class_libentry.cpp
eeschema/class_libentry.cpp
+47
-12
class_libentry.h
eeschema/class_libentry.h
+3
-1
class_libentry_fields.cpp
eeschema/class_libentry_fields.cpp
+39
-8
class_libentry_fields.h
eeschema/class_libentry_fields.h
+14
-13
class_sch_cmp_field.cpp
eeschema/class_sch_cmp_field.cpp
+28
-3
class_sch_cmp_field.h
eeschema/class_sch_cmp_field.h
+8
-1
component_class.cpp
eeschema/component_class.cpp
+0
-29
dialog_edit_component_in_lib.cpp
eeschema/dialog_edit_component_in_lib.cpp
+9
-13
dialog_edit_component_in_lib.h
eeschema/dialog_edit_component_in_lib.h
+5
-31
dialog_edit_component_in_lib.rc
eeschema/dialog_edit_component_in_lib.rc
+0
-1
dialog_edit_component_in_schematic.cpp
eeschema/dialog_edit_component_in_schematic.cpp
+30
-14
dialog_edit_component_in_schematic.h
eeschema/dialog_edit_component_in_schematic.h
+16
-0
dialog_edit_libentry_fields_in_lib.cpp
eeschema/dialog_edit_libentry_fields_in_lib.cpp
+58
-91
edit_component_in_lib.cpp
eeschema/edit_component_in_lib.cpp
+8
-396
eelibs_draw_components.cpp
eeschema/eelibs_draw_components.cpp
+1
-1
eelibs_read_libraryfiles.cpp
eeschema/eelibs_read_libraryfiles.cpp
+1
-3
getpart.cpp
eeschema/getpart.cpp
+7
-26
libedit_onleftclick.cpp
eeschema/libedit_onleftclick.cpp
+1
-3
libfield.cpp
eeschema/libfield.cpp
+1
-1
libframe.cpp
eeschema/libframe.cpp
+1
-1
savelib.cpp
eeschema/savelib.cpp
+3
-6
symbedit.cpp
eeschema/symbedit.cpp
+1
-1
tool_lib.cpp
eeschema/tool_lib.cpp
+1
-1
wxEeschemaStruct.h
include/wxEeschemaStruct.h
+1
-1
class_board.h
pcbnew/class_board.h
+2
-2
No files found.
CHANGELOG.txt
View file @
441efc9f
...
@@ -11,7 +11,9 @@ email address.
...
@@ -11,7 +11,9 @@ email address.
++Eeschema:
++Eeschema:
Note: this is a work in progress!
Note: this is a work in progress!
Files modification.
Files modification.
More about italic andf bold in fileds in libraries
More about italic and bold fields in libraries
Use DLIST to handle fields in lib entries
Bugs and problems solved in fields edition (some are windows only).
2008-Dec-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
2008-Dec-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
...
...
eeschema/class_libentry.cpp
View file @
441efc9f
...
@@ -3,7 +3,6 @@
...
@@ -3,7 +3,6 @@
/**********************************************************/
/**********************************************************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "common.h"
#include "program.h"
#include "program.h"
...
@@ -87,8 +86,6 @@ EDA_LibComponentStruct:: EDA_LibComponentStruct( const wxChar* CmpName ) :
...
@@ -87,8 +86,6 @@ EDA_LibComponentStruct:: EDA_LibComponentStruct( const wxChar* CmpName ) :
m_Options
=
ENTRY_NORMAL
;
m_Options
=
ENTRY_NORMAL
;
m_UnitSelectionLocked
=
FALSE
;
m_UnitSelectionLocked
=
FALSE
;
m_DrawPinNum
=
m_DrawPinName
=
1
;
m_DrawPinNum
=
m_DrawPinName
=
1
;
Fields
=
NULL
;
m_Prefix
.
m_FieldId
=
REFERENCE
;
m_Prefix
.
m_FieldId
=
REFERENCE
;
}
}
...
@@ -98,15 +95,6 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
...
@@ -98,15 +95,6 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
/******************************************************/
/******************************************************/
{
{
LibEDA_BaseStruct
*
DrawItem
,
*
NextDrawItem
;
LibEDA_BaseStruct
*
DrawItem
,
*
NextDrawItem
;
LibDrawField
*
TempField
,
*
field
;
field
=
Fields
;
Fields
=
NULL
;
while
(
field
)
{
TempField
=
field
;
field
=
field
->
Next
();
SAFE_DELETE
(
TempField
);
}
/* suppression des elements dependants */
/* suppression des elements dependants */
DrawItem
=
m_Drawings
;
m_Drawings
=
NULL
;
DrawItem
=
m_Drawings
;
m_Drawings
=
NULL
;
...
@@ -279,3 +267,50 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
...
@@ -279,3 +267,50 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
return
BoundaryBox
;
return
BoundaryBox
;
}
}
/** Function SetFields
* initialize fields from a vector of fields
* @param aFields a std::vector <LibDrawField> to import.
*/
void
EDA_LibComponentStruct
::
SetFields
(
const
std
::
vector
<
LibDrawField
>
aFields
)
{
// Init basic fields (Value = name in lib, and reference):
aFields
[
VALUE
].
Copy
(
&
m_Name
);
aFields
[
REFERENCE
].
Copy
(
&
m_Prefix
);
// Remove others fields:
CurrentLibEntry
->
m_Fields
.
DeleteAll
();
for
(
unsigned
ii
=
FOOTPRINT
;
ii
<
aFields
.
size
();
ii
++
)
{
bool
create
=
FALSE
;
if
(
!
aFields
[
ii
].
m_Text
.
IsEmpty
()
)
create
=
TRUE
;
if
(
!
aFields
[
ii
].
m_Name
.
IsEmpty
()
&&
(
aFields
[
ii
].
m_Name
!=
ReturnDefaultFieldName
(
ii
)
)
)
create
=
TRUE
;
if
(
create
)
{
LibDrawField
*
Field
=
new
LibDrawField
(
ii
);
aFields
[
ii
].
Copy
(
Field
);
CurrentLibEntry
->
m_Fields
.
PushBack
(
Field
);
}
}
/* for a user field (FieldId >= FIELD1), if a field value is void,
* fill it with "~" because for a library component a void field is not a very good idea
* (we do not see anything...) and in schematic this text is like a void text
* and for non editable names, remove the name (set to the default name)
*/
for
(
LibDrawField
*
Field
=
CurrentLibEntry
->
m_Fields
;
Field
;
Field
=
Field
->
Next
()
)
{
if
(
Field
->
m_FieldId
>=
FIELD1
)
{
if
(
Field
->
m_Text
.
IsEmpty
()
)
Field
->
m_Text
=
wxT
(
"~"
);
}
else
Field
->
m_Name
.
Empty
();
}
}
eeschema/class_libentry.h
View file @
441efc9f
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
#ifndef CLASS_LIBENTRY_H
#ifndef CLASS_LIBENTRY_H
#define CLASS_LIBENTRY_H
#define CLASS_LIBENTRY_H
#include "dlist.h"
#include "classes_body_items.h"
#include "classes_body_items.h"
#include "class_libentry_fields.h"
#include "class_libentry_fields.h"
...
@@ -71,7 +73,7 @@ public:
...
@@ -71,7 +73,7 @@ public:
* with a distance of m_TextInside in mils */
* with a distance of m_TextInside in mils */
bool
m_DrawPinNum
;
bool
m_DrawPinNum
;
bool
m_DrawPinName
;
bool
m_DrawPinName
;
LibDrawField
*
Fields
;
/* Auxiliairy Field list (id = 2 a 11
) */
DLIST
<
LibDrawField
>
m_Fields
;
/* Auxiliairy Field list (id >= 2
) */
LibEDA_BaseStruct
*
m_Drawings
;
/* How to draw this part */
LibEDA_BaseStruct
*
m_Drawings
;
/* How to draw this part */
long
m_LastDate
;
// Last change Date
long
m_LastDate
;
// Last change Date
...
...
eeschema/class_libentry_fields.cpp
View file @
441efc9f
...
@@ -27,11 +27,12 @@
...
@@ -27,11 +27,12 @@
*/
*/
LibDrawField
::
LibDrawField
(
int
idfield
)
:
LibEDA_BaseStruct
(
COMPONENT_FIELD_DRAW_TYPE
)
LibDrawField
::
LibDrawField
(
int
idfield
)
:
LibEDA_BaseStruct
(
COMPONENT_FIELD_DRAW_TYPE
)
{
{
m_FieldId
=
idfield
;
/* 0 a 11, 0 = REFERENCE, 1 = VALUE*/
m_FieldId
=
idfield
;
/* 0 = REFERENCE
if
(
m_FieldId
<
0
)
* 1 = VALUE
m_FieldId
=
0
;
* 3 = FOOTPRINT (default Footprint)
if
(
m_FieldId
>=
NUMBER_OF_FIELDS
)
* 4 = DOCUMENTATION (user doc link)
m_FieldId
=
NUMBER_OF_FIELDS
-
1
;
* others = free fields
*/
m_Size
.
x
=
m_Size
.
y
=
DEFAULT_SIZE_TEXT
;
m_Size
.
x
=
m_Size
.
y
=
DEFAULT_SIZE_TEXT
;
}
}
...
@@ -98,7 +99,7 @@ bool LibDrawField::Save( FILE* ExportFile ) const
...
@@ -98,7 +99,7 @@ bool LibDrawField::Save( FILE* ExportFile ) const
(
m_Attributs
&
TEXT_NO_VISIBLE
)
?
'I'
:
'V'
,
(
m_Attributs
&
TEXT_NO_VISIBLE
)
?
'I'
:
'V'
,
hjustify
,
vjustify
,
hjustify
,
vjustify
,
m_Italic
?
'I'
:
'N'
,
m_Italic
?
'I'
:
'N'
,
m_Width
>
1
?
'B'
:
'N'
);
m_Width
>
1
?
'B'
:
'N'
);
// Save field name, if necessary
// Save field name, if necessary
if
(
m_FieldId
>=
FIELD1
&&
!
m_Name
.
IsEmpty
()
)
if
(
m_FieldId
>=
FIELD1
&&
!
m_Name
.
IsEmpty
()
)
...
@@ -108,3 +109,33 @@ bool LibDrawField::Save( FILE* ExportFile ) const
...
@@ -108,3 +109,33 @@ bool LibDrawField::Save( FILE* ExportFile ) const
return
true
;
return
true
;
}
}
/****************************************************************/
wxString
ReturnDefaultFieldName
(
int
aFieldNdx
)
/****************************************************************/
/** Function ReturnDefaultFieldName
* Return the default field name from its index (REFERENCE, VALUE ..)
* FieldDefaultNameList is not static, because we want the text translation for I18n
* @param aFieldNdx = Filed number (>= 0)
*/
{
// avoid unnecessarily copying wxStrings at runtime.
static
const
wxString
defaults
[]
=
{
_
(
"Reference"
),
// Reference of part, i.e. "IC21"
_
(
"Value"
),
// Value of part, i.e. "3.3K" and name in lib for lib entries
_
(
"Footprint"
),
// Footprint, used by cvpcb or pcbnew, i.e. "16DIP300"
_
(
"Datasheet"
),
// A link to an user document, if wanted
};
if
(
(
unsigned
)
aFieldNdx
<=
DATASHEET
)
return
defaults
[
aFieldNdx
];
else
{
wxString
ret
=
_
(
"Field"
);
ret
<<
(
aFieldNdx
-
FIELD1
+
1
);
return
ret
;
}
}
eeschema/class_libentry_fields.h
View file @
441efc9f
...
@@ -13,14 +13,15 @@
...
@@ -13,14 +13,15 @@
* Name (74LS00..) used to find the component in libraries, and give the default value in schematic
* Name (74LS00..) used to find the component in libraries, and give the default value in schematic
*/
*/
class
LibDrawField
:
public
LibEDA_BaseStruct
class
LibDrawField
:
public
LibEDA_BaseStruct
,
,
public
EDA_TextStruct
public
EDA_TextStruct
{
{
public
:
public
:
int
m_FieldId
;
/* 0 a 11
int
m_FieldId
;
/* 0 = REFERENCE
* 0 = Reference; 1 = Value
* 1 = VALUE
* 2 = Default footprint, 3 = subsheet (not used, reserved)
* 3 = FOOTPRINT (default Footprint)
* 4 .. 11 other fields
* 4 = DOCUMENTATION (user doc link)
* others = free fields
*/
*/
wxString
m_Name
;
/* Field Name (not the field text itself, that is .m_Text) */
wxString
m_Name
;
/* Field Name (not the field text itself, that is .m_Text) */
...
@@ -51,9 +52,9 @@ public:
...
@@ -51,9 +52,9 @@ public:
/** Function Copy
/** Function Copy
* copy parameters of this to Target. Pointers are not copied
* copy parameters of this to Target. Pointers are not copied
* @param Target = the LibDrawField to set with "this" values
* @param
a
Target = the LibDrawField to set with "this" values
*/
*/
void
Copy
(
LibDrawField
*
Target
)
const
;
void
Copy
(
LibDrawField
*
a
Target
)
const
;
void
SetFields
(
const
std
::
vector
<
LibDrawField
>
aFields
);
void
SetFields
(
const
std
::
vector
<
LibDrawField
>
aFields
);
...
...
eeschema/class_sch_cmp_field.cpp
View file @
441efc9f
/***********************************************************************/
/**************************************************************/
/* component_class.cpp : handle the class SCH_COMPONENT */
/* class_sch_cmp_field.cpp : handle the class SCH_CMP_FIELD */
/***********************************************************************/
/**************************************************************/
/* Fields are texts attached to a component, having a specuial meaning
* Fields 0 and 1 are very important: reference and value
* Field 2 is used as default footprint name.
* Field 3 is reserved (not currently used
* Fields 4 and more are user fields.
* They can be renamed and can appear in reports
*/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -36,6 +44,23 @@ SCH_CMP_FIELD::~SCH_CMP_FIELD()
...
@@ -36,6 +44,23 @@ SCH_CMP_FIELD::~SCH_CMP_FIELD()
{
{
}
}
/** Function ImportValues
* copy parameters from a source.
* Pointers and specific values (position, texts) are not copied
* used to init a field from the model read from a lib entry
* @param aSource = the LibDrawField to read
*/
void
SCH_CMP_FIELD
::
ImportValues
(
const
LibDrawField
&
aSource
)
{
m_Orient
=
aSource
.
m_Orient
;
m_Size
=
aSource
.
m_Size
;
m_HJustify
=
aSource
.
m_HJustify
;
m_VJustify
=
aSource
.
m_VJustify
;
m_Italic
=
aSource
.
m_Italic
;
m_Width
=
aSource
.
m_Width
;
m_Attributs
=
aSource
.
m_Attributs
;
m_Mirror
=
aSource
.
m_Mirror
;
}
/**************************************************************************/
/**************************************************************************/
void
SCH_CMP_FIELD
::
SwapData
(
SCH_CMP_FIELD
*
copyitem
)
void
SCH_CMP_FIELD
::
SwapData
(
SCH_CMP_FIELD
*
copyitem
)
...
...
eeschema/class_sch_cmp_field.h
View file @
441efc9f
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
* Fields 0 and 1 are very important: reference and value
* Fields 0 and 1 are very important: reference and value
* Field 2 is used as default footprint name.
* Field 2 is used as default footprint name.
* Field 3 is reserved (not currently used
* Field 3 is reserved (not currently used
* Fields 4
to 11
are user fields.
* Fields 4
and more
are user fields.
* They can be renamed and can appear in reports
* They can be renamed and can appear in reports
*/
*/
...
@@ -50,6 +50,13 @@ public:
...
@@ -50,6 +50,13 @@ public:
bool
IsVoid
();
bool
IsVoid
();
void
SwapData
(
SCH_CMP_FIELD
*
copyitem
);
void
SwapData
(
SCH_CMP_FIELD
*
copyitem
);
/** Function ImportValues
* copy parameters from a source.
* Pointers and specific values (position) are not copied
* @param aSource = the LibDrawField to read
*/
void
ImportValues
(
const
LibDrawField
&
aSource
);
/**
/**
* Function Draw
* Function Draw
*/
*/
...
...
eeschema/component_class.cpp
View file @
441efc9f
...
@@ -114,35 +114,6 @@ void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
...
@@ -114,35 +114,6 @@ void SCH_COMPONENT::AddHierarchicalReference( const wxString& aPath,
}
}
/****************************************************************/
wxString
ReturnDefaultFieldName
(
int
aFieldNdx
)
/****************************************************************/
/* Return the default field name from its index (REFERENCE, VALUE ..)
* FieldDefaultNameList is not static, because we want the text translation
* for I18n
*/
{
// avoid unnecessarily copying wxStrings at runtime.
static
const
wxString
defaults
[]
=
{
_
(
"Ref"
),
// Reference of part, i.e. "IC21"
_
(
"Value"
),
// Value of part, i.e. "3.3K"
_
(
"Footprint"
),
// Footprint, used by cvpcb or pcbnew, i.e. "16DIP300"
_
(
"Datasheet"
),
};
if
(
(
unsigned
)
aFieldNdx
<=
DATASHEET
)
return
defaults
[
aFieldNdx
];
else
{
wxString
ret
=
_
(
"Field"
);
ret
<<
(
aFieldNdx
-
FIELD1
+
1
);
return
ret
;
}
}
/****************************************************************/
/****************************************************************/
wxString
SCH_COMPONENT
::
ReturnFieldName
(
int
aFieldNdx
)
const
wxString
SCH_COMPONENT
::
ReturnFieldName
(
int
aFieldNdx
)
const
/****************************************************************/
/****************************************************************/
...
...
eeschema/dialog_edit_component_in_lib.cpp
View file @
441efc9f
...
@@ -42,7 +42,6 @@ BEGIN_EVENT_TABLE( WinEDA_PartPropertiesFrame, wxDialog )
...
@@ -42,7 +42,6 @@ BEGIN_EVENT_TABLE( WinEDA_PartPropertiesFrame, wxDialog )
EVT_BUTTON
(
wxID_OK
,
WinEDA_PartPropertiesFrame
::
OnOkClick
)
EVT_BUTTON
(
wxID_OK
,
WinEDA_PartPropertiesFrame
::
OnOkClick
)
////@end WinEDA_PartPropertiesFrame event table entries
////@end WinEDA_PartPropertiesFrame event table entries
EVT_RADIOBOX
(
ID_ON_SELECT_FIELD
,
WinEDA_PartPropertiesFrame
::
SelectNewField
)
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
)
...
@@ -64,7 +63,6 @@ WinEDA_PartPropertiesFrame::WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame* par
...
@@ -64,7 +63,6 @@ WinEDA_PartPropertiesFrame::WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame* par
m_Parent
=
parent
;
m_Parent
=
parent
;
m_RecreateToolbar
=
FALSE
;
m_RecreateToolbar
=
FALSE
;
m_AliasLocation
=
-
1
;
m_AliasLocation
=
-
1
;
m_CurrentFieldId
=
0
;
InitBuffers
();
InitBuffers
();
...
@@ -79,7 +77,6 @@ WinEDA_PartPropertiesFrame::WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame* par
...
@@ -79,7 +77,6 @@ WinEDA_PartPropertiesFrame::WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame* par
bool
WinEDA_PartPropertiesFrame
::
Create
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
caption
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
bool
WinEDA_PartPropertiesFrame
::
Create
(
wxWindow
*
parent
,
wxWindowID
id
,
const
wxString
&
caption
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
long
style
)
{
{
m_FieldNameCtrl
=
NULL
;
////@begin WinEDA_PartPropertiesFrame member initialisation
////@begin WinEDA_PartPropertiesFrame member initialisation
m_GeneralBoxSizer
=
NULL
;
m_GeneralBoxSizer
=
NULL
;
m_NoteBook
=
NULL
;
m_NoteBook
=
NULL
;
...
@@ -228,7 +225,6 @@ void WinEDA_PartPropertiesFrame::CreateControls()
...
@@ -228,7 +225,6 @@ void WinEDA_PartPropertiesFrame::CreateControls()
BuildPanelBasic
();
BuildPanelBasic
();
BuildPanelDoc
();
BuildPanelDoc
();
BuildPanelAlias
();
BuildPanelAlias
();
BuildPanelEditField
();
// Add panel Field edition
BuildPanelFootprintFilter
();
BuildPanelFootprintFilter
();
}
}
...
...
eeschema/dialog_edit_component_in_lib.h
View file @
441efc9f
...
@@ -122,7 +122,6 @@ public:
...
@@ -122,7 +122,6 @@ public:
void
BuildPanelBasic
();
void
BuildPanelBasic
();
void
BuildPanelDoc
();
void
BuildPanelDoc
();
void
BuildPanelAlias
();
void
BuildPanelAlias
();
void
BuildPanelEditField
();
void
PartPropertiesAccept
(
wxCommandEvent
&
event
);
void
PartPropertiesAccept
(
wxCommandEvent
&
event
);
void
OnQuit
(
wxCommandEvent
&
event
);
void
OnQuit
(
wxCommandEvent
&
event
);
void
DeleteAllAliasOfPart
(
wxCommandEvent
&
event
);
void
DeleteAllAliasOfPart
(
wxCommandEvent
&
event
);
...
@@ -132,11 +131,6 @@ public:
...
@@ -132,11 +131,6 @@ public:
bool
SetUnsetConvert
();
bool
SetUnsetConvert
();
void
CopyDocToAlias
(
wxCommandEvent
&
event
);
void
CopyDocToAlias
(
wxCommandEvent
&
event
);
void
BrowseAndSelectDocFile
(
wxCommandEvent
&
event
);
void
BrowseAndSelectDocFile
(
wxCommandEvent
&
event
);
void
SelectNewField
(
wxCommandEvent
&
event
);
void
CopyFieldDataToBuffer
(
LibDrawField
*
Field
);
void
CopyBufferToFieldData
(
LibDrawField
*
Field
);
void
CopyDataToPanelField
();
void
CopyPanelFieldToData
();
void
BuildPanelFootprintFilter
();
void
BuildPanelFootprintFilter
();
void
DeleteAllFootprintFilter
(
wxCommandEvent
&
event
);
void
DeleteAllFootprintFilter
(
wxCommandEvent
&
event
);
...
@@ -164,10 +158,8 @@ public:
...
@@ -164,10 +158,8 @@ public:
////@end WinEDA_PartPropertiesFrame member variables
////@end WinEDA_PartPropertiesFrame member variables
WinEDA_LibeditFrame
*
m_Parent
;
WinEDA_LibeditFrame
*
m_Parent
;
int
m_CurrentFieldId
;
wxString
m_Title
;
wxString
m_Title
;
wxPanel
*
m_PanelField
;
wxPanel
*
m_PanelFootprintFilter
;
wxPanel
*
m_PanelFootprintFilter
;
wxButton
*
m_ButtonDeleteOneAlias
;
wxButton
*
m_ButtonDeleteOneAlias
;
wxButton
*
m_ButtonDeleteAllAlias
;
wxButton
*
m_ButtonDeleteAllAlias
;
...
@@ -181,24 +173,6 @@ public:
...
@@ -181,24 +173,6 @@ public:
wxListBox
*
m_PartAliasList
;
wxListBox
*
m_PartAliasList
;
wxListBox
*
m_FootprintFilterListBox
;
wxListBox
*
m_FootprintFilterListBox
;
wxRadioBox
*
m_FieldSelection
;
wxCheckBox
*
m_ShowFieldTextCtrl
;
wxCheckBox
*
m_VorientFieldTextCtrl
;
wxRadioBox
*
m_FieldHJustifyCtrl
;
wxRadioBox
*
m_FieldVJustifyCtrl
;
WinEDA_GraphicTextCtrl
*
m_FieldTextCtrl
;
WinEDA_EnterText
*
m_FieldNameCtrl
;
WinEDA_PositionCtrl
*
m_FieldPositionCtrl
;
int
m_FieldFlags
[
NUMBER_OF_FIELDS
];
int
m_FieldOrient
[
NUMBER_OF_FIELDS
];
int
m_FieldHJustify
[
NUMBER_OF_FIELDS
];
int
m_FieldVJustify
[
NUMBER_OF_FIELDS
];
int
m_FieldSize
[
NUMBER_OF_FIELDS
];
wxString
m_FieldText
[
NUMBER_OF_FIELDS
];
wxString
m_FieldName
[
NUMBER_OF_FIELDS
];
wxPoint
m_FieldPosition
[
NUMBER_OF_FIELDS
];
bool
m_RecreateToolbar
;
bool
m_RecreateToolbar
;
int
m_AliasLocation
;
int
m_AliasLocation
;
...
...
eeschema/dialog_edit_component_in_lib.rc
deleted
100644 → 0
View file @
23748be6
#include "wx/msw/wx.rc"
eeschema/dialog_edit_component_in_schematic.cpp
View file @
441efc9f
...
@@ -85,6 +85,23 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow
...
@@ -85,6 +85,23 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow
}
}
/******************************************************************************/
void
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
::
reinitializeFieldsIdAndDefaultNames
(
)
/*****************************************************************************/
{
for
(
unsigned
new_id
=
FIELD1
;
new_id
<
m_FieldsBuf
.
size
();
new_id
++
)
{
unsigned
old_id
=
m_FieldsBuf
[
new_id
].
m_FieldId
;
if
(
old_id
!=
new_id
)
{
if
(
m_FieldsBuf
[
new_id
].
m_Name
==
ReturnDefaultFieldName
(
old_id
)
)
m_FieldsBuf
[
new_id
].
m_Name
=
ReturnDefaultFieldName
(
new_id
);
m_FieldsBuf
[
new_id
].
m_FieldId
=
new_id
;
}
}
}
void
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
::
OnListItemDeselected
(
wxListEvent
&
event
)
void
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
::
OnListItemDeselected
(
wxListEvent
&
event
)
{
{
D
(
printf
(
"OnListItemDeselected()
\n
"
);
)
D
(
printf
(
"OnListItemDeselected()
\n
"
);
)
...
@@ -251,10 +268,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::addFieldButtonHandler( wxCommandEvent&
...
@@ -251,10 +268,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::addFieldButtonHandler( wxCommandEvent&
blank
.
m_Orient
=
m_FieldsBuf
[
REFERENCE
].
m_Orient
;
blank
.
m_Orient
=
m_FieldsBuf
[
REFERENCE
].
m_Orient
;
m_FieldsBuf
.
push_back
(
blank
);
m_FieldsBuf
.
push_back
(
blank
);
m_FieldsBuf
[
fieldNdx
].
m_Name
=
ReturnDefaultFieldName
(
fieldNdx
);
m_skipCopyFromPanel
=
true
;
setRowItem
(
fieldNdx
,
m_FieldsBuf
[
fieldNdx
]
);
setRowItem
(
fieldNdx
,
m_FieldsBuf
[
fieldNdx
]
);
m_skipCopyFromPanel
=
true
;
setSelectedFieldNdx
(
fieldNdx
);
setSelectedFieldNdx
(
fieldNdx
);
m_skipCopyFromPanel
=
false
;
m_skipCopyFromPanel
=
false
;
}
}
...
@@ -273,13 +291,17 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::deleteFieldButtonHandler( wxCommandEven
...
@@ -273,13 +291,17 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::deleteFieldButtonHandler( wxCommandEven
return
;
return
;
}
}
m_skipCopyFromPanel
=
true
;
m_FieldsBuf
.
erase
(
m_FieldsBuf
.
begin
()
+
fieldNdx
);
m_FieldsBuf
.
erase
(
m_FieldsBuf
.
begin
()
+
fieldNdx
);
fieldListCtrl
->
DeleteItem
(
fieldNdx
);
fieldListCtrl
->
DeleteItem
(
fieldNdx
);
if
(
fieldNdx
>=
m_FieldsBuf
.
size
()
)
if
(
fieldNdx
>=
m_FieldsBuf
.
size
()
)
--
fieldNdx
;
--
fieldNdx
;
m_skipCopyFromPanel
=
true
;
// Reinitialize fields IDs and default names:
reinitializeFieldsIdAndDefaultNames
();
updateDisplay
(
);
setSelectedFieldNdx
(
fieldNdx
);
setSelectedFieldNdx
(
fieldNdx
);
m_skipCopyFromPanel
=
false
;
m_skipCopyFromPanel
=
false
;
}
}
...
@@ -314,6 +336,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC:: moveUpButtonHandler( wxCommandEvent& e
...
@@ -314,6 +336,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC:: moveUpButtonHandler( wxCommandEvent& e
m_FieldsBuf
[
fieldNdx
]
=
tmp
;
m_FieldsBuf
[
fieldNdx
]
=
tmp
;
setRowItem
(
fieldNdx
,
tmp
);
setRowItem
(
fieldNdx
,
tmp
);
// Reinitialize fields IDs and default names:
reinitializeFieldsIdAndDefaultNames
();
updateDisplay
(
);
m_skipCopyFromPanel
=
true
;
m_skipCopyFromPanel
=
true
;
setSelectedFieldNdx
(
fieldNdx
-
1
);
setSelectedFieldNdx
(
fieldNdx
-
1
);
m_skipCopyFromPanel
=
false
;
m_skipCopyFromPanel
=
false
;
...
@@ -645,20 +671,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
...
@@ -645,20 +671,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
/* Initialise fields values to default values found in library: */
/* Initialise fields values to default values found in library: */
m_Cmp
->
GetField
(
REFERENCE
)
->
m_Pos
=
entry
->
m_Prefix
.
m_Pos
+
m_Cmp
->
m_Pos
;
m_Cmp
->
GetField
(
REFERENCE
)
->
m_Pos
=
entry
->
m_Prefix
.
m_Pos
+
m_Cmp
->
m_Pos
;
m_Cmp
->
GetField
(
REFERENCE
)
->
m_Orient
=
entry
->
m_Prefix
.
m_Orient
;
m_Cmp
->
GetField
(
REFERENCE
)
->
ImportValues
(
entry
->
m_Prefix
);
m_Cmp
->
GetField
(
REFERENCE
)
->
m_Size
=
entry
->
m_Prefix
.
m_Size
;
m_Cmp
->
GetField
(
REFERENCE
)
->
m_HJustify
=
entry
->
m_Prefix
.
m_HJustify
;
m_Cmp
->
GetField
(
REFERENCE
)
->
m_VJustify
=
entry
->
m_Prefix
.
m_VJustify
;
m_Cmp
->
GetField
(
REFERENCE
)
->
m_Italic
=
entry
->
m_Prefix
.
m_Italic
;
m_Cmp
->
GetField
(
REFERENCE
)
->
m_Width
=
entry
->
m_Prefix
.
m_Width
;
m_Cmp
->
GetField
(
VALUE
)
->
m_Pos
=
entry
->
m_Name
.
m_Pos
+
m_Cmp
->
m_Pos
;
m_Cmp
->
GetField
(
VALUE
)
->
m_Pos
=
entry
->
m_Name
.
m_Pos
+
m_Cmp
->
m_Pos
;
m_Cmp
->
GetField
(
VALUE
)
->
m_Orient
=
entry
->
m_Name
.
m_Orient
;
m_Cmp
->
GetField
(
VALUE
)
->
ImportValues
(
entry
->
m_Name
);
m_Cmp
->
GetField
(
VALUE
)
->
m_Size
=
entry
->
m_Name
.
m_Size
;
m_Cmp
->
GetField
(
VALUE
)
->
m_HJustify
=
entry
->
m_Name
.
m_HJustify
;
m_Cmp
->
GetField
(
VALUE
)
->
m_VJustify
=
entry
->
m_Name
.
m_VJustify
;
m_Cmp
->
GetField
(
VALUE
)
->
m_Italic
=
entry
->
m_Name
.
m_Italic
;
m_Cmp
->
GetField
(
VALUE
)
->
m_Width
=
entry
->
m_Name
.
m_Width
;
m_Cmp
->
SetRotationMiroir
(
CMP_NORMAL
);
m_Cmp
->
SetRotationMiroir
(
CMP_NORMAL
);
...
...
eeschema/dialog_edit_component_in_schematic.h
View file @
441efc9f
...
@@ -73,6 +73,22 @@ public:
...
@@ -73,6 +73,22 @@ public:
*/
*/
void
InitBuffers
(
SCH_COMPONENT
*
aComponent
);
void
InitBuffers
(
SCH_COMPONENT
*
aComponent
);
private
:
/** Function updateDisplay
* update the listbox showing fields, according to the fields texts
* must be called after a text change in fields, if this change is not an edition
*/
void
updateDisplay
(
)
{
for
(
unsigned
ii
=
FIELD1
;
ii
<
m_FieldsBuf
.
size
();
ii
++
)
setRowItem
(
ii
,
m_FieldsBuf
[
ii
]
);
}
/** Function reinitializeFieldsIdAndDefaultNames
* Calculates the field id and default name, after deleting a field
* or moving a field
*/
void
reinitializeFieldsIdAndDefaultNames
();
};
};
#endif // __dialog_edit_component_in_schematic__
#endif // __dialog_edit_component_in_schematic__
eeschema/dialog_edit_libentry_fields_in_lib.cpp
View file @
441efc9f
...
@@ -18,86 +18,6 @@
...
@@ -18,86 +18,6 @@
// Local variables:
// Local variables:
static
int
s_SelectedRow
;
static
int
s_SelectedRow
;
/** @todo function to move in a file like class_libentry.cpp
*/
/** Function SetFields
* initialize fields from a vector of fields
* @param aFields a std::vector <LibDrawField> to import.
*/
void
EDA_LibComponentStruct
::
SetFields
(
const
std
::
vector
<
LibDrawField
>
aFields
)
{
// Init basic fields (Value = name in lib, and reference):
aFields
[
VALUE
].
Copy
(
&
m_Name
);
aFields
[
REFERENCE
].
Copy
(
&
m_Prefix
);
// Init others fields:
for
(
unsigned
ii
=
FOOTPRINT
;
ii
<
aFields
.
size
();
ii
++
)
{
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
LibDrawField
*
NextField
,
*
previousField
=
NULL
;
while
(
Field
)
{
NextField
=
Field
->
Next
();
if
(
Field
->
m_FieldId
==
(
int
)
ii
)
{
aFields
[
ii
].
Copy
(
Field
);
// An old field exists; delete it if void
if
(
Field
->
m_Text
.
IsEmpty
()
)
{
if
(
ii
<
FIELD1
||
Field
->
m_Name
.
IsEmpty
()
)
{
SAFE_DELETE
(
Field
);
if
(
previousField
)
previousField
->
SetNext
(
NextField
);
else
Fields
=
NextField
;
}
}
break
;
}
previousField
=
Field
;
Field
=
NextField
;
}
if
(
Field
==
NULL
)
// Do not exists: must be created if not void
{
bool
create
=
FALSE
;
if
(
!
aFields
[
ii
].
m_Text
.
IsEmpty
()
)
create
=
TRUE
;
if
(
!
aFields
[
ii
].
m_Name
.
IsEmpty
()
&&
(
aFields
[
ii
].
m_Name
!=
ReturnDefaultFieldName
(
ii
)
)
)
create
=
TRUE
;
if
(
create
)
{
Field
=
new
LibDrawField
(
ii
);
*
Field
=
aFields
[
ii
];
Field
->
SetNext
(
CurrentLibEntry
->
Fields
);
Fields
=
Field
;
}
}
}
/* for a user field (FieldId >= FIELD1), if a field value is void,
* fill it with "~" because for a library component a void field is not a very good idea
* (we do not see anything...) and in schematic this text is like a void text
* and for non editable names, remove the name (set to the default name)
*/
for
(
LibDrawField
*
Field
=
Fields
;
Field
;
Field
=
Field
->
Next
()
)
{
if
(
Field
->
m_FieldId
>=
FIELD1
)
{
if
(
Field
->
m_Text
.
IsEmpty
()
)
Field
->
m_Text
=
wxT
(
"~"
);
}
else
Field
->
m_Name
.
Empty
();
}
}
/*****************************************************************************************/
/*****************************************************************************************/
class
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB
:
public
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
class
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB
:
public
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
...
@@ -156,6 +76,22 @@ private:
...
@@ -156,6 +76,22 @@ private:
*/
*/
bool
copyPanelToSelectedField
();
bool
copyPanelToSelectedField
();
void
setRowItem
(
int
aFieldNdx
,
const
LibDrawField
&
aField
);
void
setRowItem
(
int
aFieldNdx
,
const
LibDrawField
&
aField
);
/** Function updateDisplay
* update the listbox showing fields, according to the fields texts
* must be called after a text change in fields, if this change is not an edition
*/
void
updateDisplay
(
)
{
for
(
unsigned
ii
=
FIELD1
;
ii
<
m_FieldsBuf
.
size
();
ii
++
)
setRowItem
(
ii
,
m_FieldsBuf
[
ii
]
);
}
/** Function reinitializeFieldsIdAndDefaultNames
* Calculates the field id and default name, after deleting a field
* or moving a field
*/
void
reinitializeFieldsIdAndDefaultNames
();
};
};
/*****************************************************************/
/*****************************************************************/
...
@@ -168,10 +104,15 @@ void WinEDA_LibeditFrame::InstallFieldsEditorDialog( void )
...
@@ -168,10 +104,15 @@ void WinEDA_LibeditFrame::InstallFieldsEditorDialog( void )
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB
*
frame
=
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB
*
frame
=
new
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB
(
this
,
CurrentLibEntry
);
new
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB
(
this
,
CurrentLibEntry
);
int
IsModified
=
frame
->
ShowModal
();
frame
->
Destroy
();
int
abort
=
frame
->
ShowModal
();
frame
->
Destroy
();
if
(
IsModified
)
if
(
!
abort
)
{
ReCreateHToolbar
();
Refresh
();
Refresh
();
}
DisplayLibInfos
();
}
}
...
@@ -180,10 +121,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(
...
@@ -180,10 +121,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(
WinEDA_LibeditFrame
*
aParent
,
WinEDA_LibeditFrame
*
aParent
,
EDA_LibComponentStruct
*
aLibEntry
)
:
EDA_LibComponentStruct
*
aLibEntry
)
:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
(
aParent
)
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
(
aParent
)
/***********************************************************************/
{
{
m_Parent
=
aParent
;
m_Parent
=
aParent
;
m_LibEntry
=
aLibEntry
;
m_LibEntry
=
aLibEntry
;
/***********************************************************************/
}
}
...
@@ -309,12 +250,27 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
...
@@ -309,12 +250,27 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
m_Parent
->
GetScreen
()
->
SetModify
();
m_Parent
->
GetScreen
()
->
SetModify
();
m_Parent
->
DrawPanel
->
Refresh
(
TRUE
);
EndModal
(
0
);
EndModal
(
0
);
}
}
/******************************************************************************/
void
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB
::
reinitializeFieldsIdAndDefaultNames
(
)
/*****************************************************************************/
{
for
(
unsigned
new_id
=
FIELD1
;
new_id
<
m_FieldsBuf
.
size
();
new_id
++
)
{
unsigned
old_id
=
m_FieldsBuf
[
new_id
].
m_FieldId
;
if
(
old_id
!=
new_id
)
{
if
(
m_FieldsBuf
[
new_id
].
m_Name
==
ReturnDefaultFieldName
(
old_id
)
)
m_FieldsBuf
[
new_id
].
m_Name
=
ReturnDefaultFieldName
(
new_id
);
m_FieldsBuf
[
new_id
].
m_FieldId
=
new_id
;
}
}
}
/**************************************************************************************/
/**************************************************************************************/
void
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB
::
addFieldButtonHandler
(
wxCommandEvent
&
event
)
void
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB
::
addFieldButtonHandler
(
wxCommandEvent
&
event
)
/**************************************************************************************/
/**************************************************************************************/
...
@@ -328,9 +284,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::addFieldButtonHandler( wxCommandEvent&
...
@@ -328,9 +284,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::addFieldButtonHandler( wxCommandEvent&
LibDrawField
blank
(
fieldNdx
);
LibDrawField
blank
(
fieldNdx
);
blank
.
m_Orient
=
m_FieldsBuf
[
REFERENCE
].
m_Orient
;
m_FieldsBuf
.
push_back
(
blank
);
m_FieldsBuf
.
push_back
(
blank
);
m_FieldsBuf
[
fieldNdx
].
m_Name
=
ReturnDefaultFieldName
(
fieldNdx
);
setRowItem
(
fieldNdx
,
m_FieldsBuf
[
fieldNdx
]
);
setRowItem
(
fieldNdx
,
m_FieldsBuf
[
fieldNdx
]
);
...
@@ -355,13 +310,18 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::deleteFieldButtonHandler( wxCommandEven
...
@@ -355,13 +310,18 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::deleteFieldButtonHandler( wxCommandEven
return
;
return
;
}
}
m_skipCopyFromPanel
=
true
;
m_FieldsBuf
.
erase
(
m_FieldsBuf
.
begin
()
+
fieldNdx
);
m_FieldsBuf
.
erase
(
m_FieldsBuf
.
begin
()
+
fieldNdx
);
fieldListCtrl
->
DeleteItem
(
fieldNdx
);
fieldListCtrl
->
DeleteItem
(
fieldNdx
);
if
(
fieldNdx
>=
m_FieldsBuf
.
size
()
)
if
(
fieldNdx
>=
m_FieldsBuf
.
size
()
)
--
fieldNdx
;
--
fieldNdx
;
m_skipCopyFromPanel
=
true
;
// Reinitialize fields IDs and default names:
reinitializeFieldsIdAndDefaultNames
();
updateDisplay
(
);
setRowItem
(
fieldNdx
,
m_FieldsBuf
[
fieldNdx
]
);
setSelectedFieldNdx
(
fieldNdx
);
setSelectedFieldNdx
(
fieldNdx
);
m_skipCopyFromPanel
=
false
;
m_skipCopyFromPanel
=
false
;
}
}
...
@@ -395,6 +355,10 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB:: moveUpButtonHandler( wxCommandEvent& e
...
@@ -395,6 +355,10 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB:: moveUpButtonHandler( wxCommandEvent& e
m_FieldsBuf
[
fieldNdx
]
=
tmp
;
m_FieldsBuf
[
fieldNdx
]
=
tmp
;
setRowItem
(
fieldNdx
,
tmp
);
setRowItem
(
fieldNdx
,
tmp
);
// Reinitialize fields IDs and default names:
reinitializeFieldsIdAndDefaultNames
();
updateDisplay
(
);
m_skipCopyFromPanel
=
true
;
m_skipCopyFromPanel
=
true
;
setSelectedFieldNdx
(
fieldNdx
-
1
);
setSelectedFieldNdx
(
fieldNdx
-
1
);
m_skipCopyFromPanel
=
false
;
m_skipCopyFromPanel
=
false
;
...
@@ -443,7 +407,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers( void )
...
@@ -443,7 +407,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers( void )
m_FieldsBuf
.
push_back
(
m_LibEntry
->
m_Prefix
);
m_FieldsBuf
.
push_back
(
m_LibEntry
->
m_Prefix
);
m_FieldsBuf
.
push_back
(
m_LibEntry
->
m_Name
);
m_FieldsBuf
.
push_back
(
m_LibEntry
->
m_Name
);
for
(
LibDrawField
*
field
=
m_LibEntry
->
Fields
;
field
!=
NULL
;
field
=
field
->
Next
()
)
// Creates a working copy of fields
for
(
LibDrawField
*
field
=
m_LibEntry
->
m_Fields
;
field
!=
NULL
;
field
=
field
->
Next
()
)
m_FieldsBuf
.
push_back
(
*
field
);
m_FieldsBuf
.
push_back
(
*
field
);
// Display 12 fields (or more), and add missing fields
// Display 12 fields (or more), and add missing fields
...
@@ -483,6 +448,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers( void )
...
@@ -483,6 +448,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers( void )
fieldListCtrl
->
SetFocus
();
fieldListCtrl
->
SetFocus
();
// resume editing at the last row edited, last time dialog was up.
// resume editing at the last row edited, last time dialog was up.
if
(
s_SelectedRow
<
(
int
)
m_FieldsBuf
.
size
()
)
s_SelectedRow
=
0
;
setSelectedFieldNdx
(
s_SelectedRow
);
setSelectedFieldNdx
(
s_SelectedRow
);
}
}
...
@@ -544,7 +511,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
...
@@ -544,7 +511,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
fieldNameTextCtrl
->
SetValue
(
field
.
m_Name
);
fieldNameTextCtrl
->
SetValue
(
field
.
m_Name
);
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable editing
// if fieldNdx == REFERENCE, VALUE, FOOTPRINT, or DATASHEET, then disable
filed name
editing
fieldNameTextCtrl
->
Enable
(
fieldNdx
>=
FIELD1
);
fieldNameTextCtrl
->
Enable
(
fieldNdx
>=
FIELD1
);
fieldNameTextCtrl
->
SetEditable
(
fieldNdx
>=
FIELD1
);
fieldNameTextCtrl
->
SetEditable
(
fieldNdx
>=
FIELD1
);
...
@@ -629,7 +596,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
...
@@ -629,7 +596,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
rotateCheckBox
->
SetValue
(
field
.
m_Orient
==
TEXT_ORIENT_VERT
);
rotateCheckBox
->
SetValue
(
field
.
m_Orient
==
TEXT_ORIENT_VERT
);
/* Void fields for REFERENCE and VALUE are not allowed
/* Void fields for REFERENCE and VALUE are not allowed
* ch
na
ge therm only for a new non void value
* ch
an
ge therm only for a new non void value
*/
*/
if
(
!
fieldValueTextCtrl
->
GetValue
().
IsEmpty
()
)
if
(
!
fieldValueTextCtrl
->
GetValue
().
IsEmpty
()
)
field
.
m_Text
=
fieldValueTextCtrl
->
GetValue
();
field
.
m_Text
=
fieldValueTextCtrl
->
GetValue
();
...
...
eeschema/edit_component_in_lib.cpp
View file @
441efc9f
This diff is collapsed.
Click to expand it.
eeschema/eelibs_draw_components.cpp
View file @
441efc9f
...
@@ -153,7 +153,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -153,7 +153,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
if
(
(
LibEntry
->
m_Name
.
m_Flags
&
IS_MOVED
)
==
0
)
if
(
(
LibEntry
->
m_Name
.
m_Flags
&
IS_MOVED
)
==
0
)
LibEntry
->
m_Name
.
Draw
(
panel
,
DC
,
aOffset
,
color
,
DrawMode
,
NULL
,
TransMat
);
LibEntry
->
m_Name
.
Draw
(
panel
,
DC
,
aOffset
,
color
,
DrawMode
,
NULL
,
TransMat
);
for
(
Field
=
LibEntry
->
Fields
;
Field
!=
NULL
;
Field
=
Field
->
Next
()
)
for
(
Field
=
LibEntry
->
m_
Fields
;
Field
!=
NULL
;
Field
=
Field
->
Next
()
)
{
{
if
(
Field
->
m_Text
.
IsEmpty
()
)
if
(
Field
->
m_Text
.
IsEmpty
()
)
return
;
return
;
...
...
eeschema/eelibs_read_libraryfiles.cpp
View file @
441efc9f
...
@@ -957,9 +957,7 @@ static bool GetLibEntryField (EDA_LibComponentStruct* LibEntry,
...
@@ -957,9 +957,7 @@ static bool GetLibEntryField (EDA_LibComponentStruct* LibEntry,
break
;
break
;
Field
=
new
LibDrawField
(
NumOfField
);
Field
=
new
LibDrawField
(
NumOfField
);
LibEntry
->
m_Fields
.
PushBack
(
Field
);
Field
->
SetNext
(
LibEntry
->
Fields
);
LibEntry
->
Fields
=
Field
;
break
;
break
;
}
}
...
...
eeschema/getpart.cpp
View file @
441efc9f
...
@@ -185,43 +185,30 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
...
@@ -185,43 +185,30 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
/* Init champ Valeur */
/* Init champ Valeur */
DrawLibItem
->
GetField
(
VALUE
)
->
m_Pos
=
Entry
->
m_Name
.
m_Pos
+
DrawLibItem
->
m_Pos
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_Pos
=
Entry
->
m_Name
.
m_Pos
+
DrawLibItem
->
m_Pos
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_Orient
=
Entry
->
m_Name
.
m_Orient
;
DrawLibItem
->
GetField
(
VALUE
)
->
ImportValues
(
Entry
->
m_Name
);
DrawLibItem
->
GetField
(
VALUE
)
->
m_Size
=
Entry
->
m_Name
.
m_Size
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
=
DrawLibItem
->
m_ChipName
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_Text
=
DrawLibItem
->
m_ChipName
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_Attributs
=
Entry
->
m_Name
.
m_Attributs
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_HJustify
=
Entry
->
m_Name
.
m_HJustify
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_VJustify
=
Entry
->
m_Name
.
m_VJustify
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_Italic
=
Entry
->
m_Name
.
m_Italic
;
DrawLibItem
->
GetField
(
VALUE
)
->
m_Width
=
Entry
->
m_Name
.
m_Width
;
msg
=
Entry
->
m_Prefix
.
m_Text
;
msg
=
Entry
->
m_Prefix
.
m_Text
;
if
(
msg
.
IsEmpty
()
)
if
(
msg
.
IsEmpty
()
)
msg
=
wxT
(
"U"
);
msg
=
wxT
(
"U"
);
msg
+=
wxT
(
"?"
);
msg
+=
wxT
(
"?"
);
//update the reference -- just the prefix for now.
//
update the reference -- just the prefix for now.
DrawLibItem
->
SetRef
(
GetSheet
(),
msg
);
DrawLibItem
->
SetRef
(
GetSheet
(),
msg
);
/* Init champ Reference */
/* Init champ Reference */
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Pos
=
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Pos
=
Entry
->
m_Prefix
.
m_Pos
+
DrawLibItem
->
m_Pos
;
Entry
->
m_Prefix
.
m_Pos
+
DrawLibItem
->
m_Pos
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
ImportValues
(
Entry
->
m_Prefix
);
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Orient
=
Entry
->
m_Prefix
.
m_Orient
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Size
=
Entry
->
m_Prefix
.
m_Size
;
DrawLibItem
->
m_PrefixString
=
Entry
->
m_Prefix
.
m_Text
;
DrawLibItem
->
m_PrefixString
=
Entry
->
m_Prefix
.
m_Text
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Attributs
=
Entry
->
m_Prefix
.
m_Attributs
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_HJustify
=
Entry
->
m_Prefix
.
m_HJustify
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_VJustify
=
Entry
->
m_Prefix
.
m_VJustify
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Italic
=
Entry
->
m_Prefix
.
m_Italic
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Width
=
Entry
->
m_Prefix
.
m_Width
;
/* Init des autres champs si predefinis dans la librairie */
/* Init des autres champs si predefinis dans la librairie */
for
(
Field
=
Entry
->
Fields
;
Field
!=
NULL
;
Field
=
Field
->
Next
()
)
for
(
Field
=
Entry
->
m_
Fields
;
Field
!=
NULL
;
Field
=
Field
->
Next
()
)
{
{
if
(
Field
->
m_Text
.
IsEmpty
()
&&
Field
->
m_Name
.
IsEmpty
()
)
if
(
Field
->
m_Text
.
IsEmpty
()
&&
Field
->
m_Name
.
IsEmpty
()
)
continue
;
continue
;
ii
=
Field
->
m_FieldId
;
ii
=
Field
->
m_FieldId
;
if
(
ii
<
2
)
if
(
ii
<
2
)
// Reference or value, already done
continue
;
continue
;
if
(
ii
>=
DrawLibItem
->
GetFieldCount
()
)
if
(
ii
>=
DrawLibItem
->
GetFieldCount
()
)
...
@@ -230,15 +217,9 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
...
@@ -230,15 +217,9 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
SCH_CMP_FIELD
*
f
=
DrawLibItem
->
GetField
(
ii
);
SCH_CMP_FIELD
*
f
=
DrawLibItem
->
GetField
(
ii
);
f
->
m_Pos
+=
Field
->
m_Pos
;
f
->
m_Pos
+=
Field
->
m_Pos
;
f
->
m_Size
=
Field
->
m_Size
;
f
->
ImportValues
(
*
Field
);
f
->
m_Attributs
=
Field
->
m_Attributs
;
f
->
m_Orient
=
Field
->
m_Orient
;
f
->
m_Text
=
Field
->
m_Text
;
f
->
m_Text
=
Field
->
m_Text
;
f
->
m_Name
=
Field
->
m_Name
;
f
->
m_Name
=
Field
->
m_Name
;
f
->
m_HJustify
=
Field
->
m_HJustify
;
f
->
m_VJustify
=
Field
->
m_VJustify
;
f
->
m_Italic
=
Field
->
m_Italic
;
f
->
m_Width
=
Field
->
m_Width
;
}
}
DrawStructsInGhost
(
DrawPanel
,
DC
,
DrawLibItem
,
0
,
0
);
DrawStructsInGhost
(
DrawPanel
,
DC
,
DrawLibItem
,
0
,
0
);
...
...
eeschema/libedit_onleftclick.cpp
View file @
441efc9f
...
@@ -220,9 +220,7 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -220,9 +220,7 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
}
}
if
(
DrawEntry
==
NULL
)
if
(
DrawEntry
==
NULL
)
{
{
wxPoint
mpos
;
InstallLibeditFrame
(
);
wxGetMousePosition
(
&
mpos
.
x
,
&
mpos
.
y
);
InstallLibeditFrame
(
mpos
);
}
}
}
}
...
...
eeschema/libfield.cpp
View file @
441efc9f
...
@@ -327,7 +327,7 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry
...
@@ -327,7 +327,7 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry
return
&
LibEntry
->
m_Prefix
;
return
&
LibEntry
->
m_Prefix
;
/* Localisation des autres fields */
/* Localisation des autres fields */
for
(
LibDrawField
*
field
=
LibEntry
->
Fields
;
field
;
field
=
field
->
Next
()
)
for
(
LibDrawField
*
field
=
LibEntry
->
m_
Fields
;
field
;
field
=
field
->
Next
()
)
{
{
if
(
field
->
m_Text
.
IsEmpty
()
)
if
(
field
->
m_Text
.
IsEmpty
()
)
continue
;
continue
;
...
...
eeschema/libframe.cpp
View file @
441efc9f
...
@@ -378,7 +378,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -378,7 +378,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
break
;
case
ID_LIBEDIT_GET_FRAME_EDIT_PART
:
case
ID_LIBEDIT_GET_FRAME_EDIT_PART
:
InstallLibeditFrame
(
pos
);
InstallLibeditFrame
(
);
break
;
break
;
case
ID_LIBEDIT_GET_FRAME_EDIT_FIELDS
:
case
ID_LIBEDIT_GET_FRAME_EDIT_FIELDS
:
...
...
eeschema/savelib.cpp
View file @
441efc9f
...
@@ -278,12 +278,10 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStr
...
@@ -278,12 +278,10 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStr
NewStruct
->
m_DocFile
=
OldEntry
->
m_DocFile
;
NewStruct
->
m_DocFile
=
OldEntry
->
m_DocFile
;
/* Copie des champs */
/* Copie des champs */
for
(
OldField
=
OldEntry
->
Fields
;
OldField
!=
NULL
;
for
(
OldField
=
OldEntry
->
m_Fields
;
OldField
!=
NULL
;
OldField
=
OldField
->
Next
()
)
OldField
=
(
LibDrawField
*
)
OldField
->
Next
()
)
{
{
NewField
=
OldField
->
GenCopy
();
NewField
=
OldField
->
GenCopy
();
NewField
->
SetNext
(
NewStruct
->
Fields
);
NewStruct
->
m_Fields
.
PushBack
(
NewField
);
NewStruct
->
Fields
=
NewField
;
}
}
/* Copie des elements type Drawing */
/* Copie des elements type Drawing */
...
@@ -363,8 +361,7 @@ bool EDA_LibComponentStruct::Save( FILE* aFile )
...
@@ -363,8 +361,7 @@ bool EDA_LibComponentStruct::Save( FILE* aFile )
m_Prefix
.
Save
(
aFile
);
m_Prefix
.
Save
(
aFile
);
m_Name
.
Save
(
aFile
);
m_Name
.
Save
(
aFile
);
for
(
Field
=
Fields
;
Field
!=
NULL
;
for
(
Field
=
m_Fields
;
Field
!=
NULL
;
Field
=
Field
->
Next
()
)
Field
=
(
LibDrawField
*
)
Field
->
Next
()
)
{
{
if
(
Field
->
m_Text
.
IsEmpty
()
&&
Field
->
m_Name
.
IsEmpty
()
)
if
(
Field
->
m_Text
.
IsEmpty
()
&&
Field
->
m_Name
.
IsEmpty
()
)
continue
;
continue
;
...
...
eeschema/symbedit.cpp
View file @
441efc9f
...
@@ -394,7 +394,7 @@ void WinEDA_LibeditFrame::PlaceAncre()
...
@@ -394,7 +394,7 @@ void WinEDA_LibeditFrame::PlaceAncre()
LibEntry
->
m_Name
.
m_Pos
+=
offset
;
LibEntry
->
m_Name
.
m_Pos
+=
offset
;
LibEntry
->
m_Prefix
.
m_Pos
+=
offset
;
LibEntry
->
m_Prefix
.
m_Pos
+=
offset
;
for
(
LibDrawField
*
field
=
LibEntry
->
Fields
;
field
;
field
=
field
->
Next
()
)
for
(
LibDrawField
*
field
=
LibEntry
->
m_
Fields
;
field
;
field
=
field
->
Next
()
)
{
{
field
->
m_Pos
+=
offset
;
field
->
m_Pos
+=
offset
;
}
}
...
...
eeschema/tool_lib.cpp
View file @
441efc9f
...
@@ -160,7 +160,7 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
...
@@ -160,7 +160,7 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
wxNullBitmap
,
wxNullBitmap
,
FALSE
,
FALSE
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
_
(
"Add, remove
,
edit fields properties"
)
);
_
(
"Add, remove
fields and
edit fields properties"
)
);
m_HToolBar
->
AddSeparator
();
m_HToolBar
->
AddSeparator
();
m_HToolBar
->
AddTool
(
ID_LIBEDIT_CHECK_PART
,
BITMAP
(
erc_xpm
),
m_HToolBar
->
AddTool
(
ID_LIBEDIT_CHECK_PART
,
BITMAP
(
erc_xpm
),
...
...
include/wxEeschemaStruct.h
View file @
441efc9f
...
@@ -403,7 +403,7 @@ private:
...
@@ -403,7 +403,7 @@ private:
LibraryStruct
*
Library
,
int
noMsg
=
0
);
LibraryStruct
*
Library
,
int
noMsg
=
0
);
void
DisplayCmpDoc
(
const
wxString
&
Name
);
void
DisplayCmpDoc
(
const
wxString
&
Name
);
void
InstallLibeditFrame
(
const
wxPoint
&
pos
);
void
InstallLibeditFrame
(
);
// General editing
// General editing
public
:
public
:
...
...
pcbnew/class_board.h
View file @
441efc9f
...
@@ -85,8 +85,8 @@ public:
...
@@ -85,8 +85,8 @@ public:
int
m_Status_Pcb
;
// Flags used in ratsnet calculation and update
int
m_Status_Pcb
;
// Flags used in ratsnet calculation and update
EDA_BoardDesignSettings
*
m_BoardSettings
;
// Link to current design settings
EDA_BoardDesignSettings
*
m_BoardSettings
;
// Link to current design settings
int
m_NbNodes
;
// Active pads (pads attached to a net ) count
int
m_NbNodes
;
// Active pads (pads attached to a net ) count
int
m_NbLinks
;
// Ratsnet count
int
m_NbLinks
;
// Ratsne
s
t count
int
m_NbLoclinks
;
// Ra
stests to she
w while creating a track
int
m_NbLoclinks
;
// Ra
tsests to sho
w while creating a track
int
m_NbNoconnect
;
// Active ratsnet count (rastnest not alraedy connected by tracks
int
m_NbNoconnect
;
// Active ratsnet count (rastnest not alraedy connected by tracks
DLIST
<
BOARD_ITEM
>
m_Drawings
;
// linked list of lines & texts
DLIST
<
BOARD_ITEM
>
m_Drawings
;
// linked list of lines & texts
...
...
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