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
Hide 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.
++Eeschema:
Note: this is a work in progress!
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>
...
...
eeschema/class_libentry.cpp
View file @
441efc9f
...
...
@@ -3,7 +3,6 @@
/**********************************************************/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "program.h"
...
...
@@ -87,8 +86,6 @@ EDA_LibComponentStruct:: EDA_LibComponentStruct( const wxChar* CmpName ) :
m_Options
=
ENTRY_NORMAL
;
m_UnitSelectionLocked
=
FALSE
;
m_DrawPinNum
=
m_DrawPinName
=
1
;
Fields
=
NULL
;
m_Prefix
.
m_FieldId
=
REFERENCE
;
}
...
...
@@ -98,15 +95,6 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
/******************************************************/
{
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 */
DrawItem
=
m_Drawings
;
m_Drawings
=
NULL
;
...
...
@@ -279,3 +267,50 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
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 @@
#ifndef CLASS_LIBENTRY_H
#define CLASS_LIBENTRY_H
#include "dlist.h"
#include "classes_body_items.h"
#include "class_libentry_fields.h"
...
...
@@ -71,7 +73,7 @@ public:
* with a distance of m_TextInside in mils */
bool
m_DrawPinNum
;
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 */
long
m_LastDate
;
// Last change Date
...
...
eeschema/class_libentry_fields.cpp
View file @
441efc9f
...
...
@@ -27,12 +27,13 @@
*/
LibDrawField
::
LibDrawField
(
int
idfield
)
:
LibEDA_BaseStruct
(
COMPONENT_FIELD_DRAW_TYPE
)
{
m_FieldId
=
idfield
;
/* 0 a 11, 0 = REFERENCE, 1 = VALUE*/
if
(
m_FieldId
<
0
)
m_FieldId
=
0
;
if
(
m_FieldId
>=
NUMBER_OF_FIELDS
)
m_FieldId
=
NUMBER_OF_FIELDS
-
1
;
m_Size
.
x
=
m_Size
.
y
=
DEFAULT_SIZE_TEXT
;
m_FieldId
=
idfield
;
/* 0 = REFERENCE
* 1 = VALUE
* 3 = FOOTPRINT (default Footprint)
* 4 = DOCUMENTATION (user doc link)
* others = free fields
*/
m_Size
.
x
=
m_Size
.
y
=
DEFAULT_SIZE_TEXT
;
}
...
...
@@ -97,8 +98,8 @@ bool LibDrawField::Save( FILE* ExportFile ) const
m_Orient
==
0
?
'H'
:
'V'
,
(
m_Attributs
&
TEXT_NO_VISIBLE
)
?
'I'
:
'V'
,
hjustify
,
vjustify
,
m_Italic
?
'I'
:
'N'
,
m_Width
>
1
?
'B'
:
'N'
);
m_Italic
?
'I'
:
'N'
,
m_Width
>
1
?
'B'
:
'N'
);
// Save field name, if necessary
if
(
m_FieldId
>=
FIELD1
&&
!
m_Name
.
IsEmpty
()
)
...
...
@@ -108,3 +109,33 @@ bool LibDrawField::Save( FILE* ExportFile ) const
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,15 +13,16 @@
* Name (74LS00..) used to find the component in libraries, and give the default value in schematic
*/
class
LibDrawField
:
public
LibEDA_BaseStruct
,
public
EDA_TextStruct
class
LibDrawField
:
public
LibEDA_BaseStruct
,
public
EDA_TextStruct
{
public
:
int
m_FieldId
;
/* 0 a 11
* 0 = Reference; 1 = Value
* 2 = Default footprint, 3 = subsheet (not used, reserved)
* 4 .. 11 other fields
*/
int
m_FieldId
;
/* 0 = REFERENCE
* 1 = VALUE
* 3 = FOOTPRINT (default Footprint)
* 4 = DOCUMENTATION (user doc link)
* others = free fields
*/
wxString
m_Name
;
/* Field Name (not the field text itself, that is .m_Text) */
public
:
...
...
@@ -44,18 +45,18 @@ public:
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual
bool
Save
(
FILE
*
aFile
)
const
;
virtual
bool
Save
(
FILE
*
aFile
)
const
;
LibDrawField
*
GenCopy
();
LibDrawField
*
GenCopy
();
/** Function Copy
* 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
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aColor
,
int
aDrawMode
,
void
*
aData
,
int
aTransformMatrix
[
2
][
2
]
);
...
...
@@ -66,7 +67,7 @@ public:
* @param refPos A wxPoint to test, in Field coordinate system
* @return bool - true if a hit, else false
*/
bool
HitTest
(
const
wxPoint
&
refPos
);
bool
HitTest
(
const
wxPoint
&
refPos
);
};
#endif // CLASS_LIBENTRY_FIELDS_H
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 "gr_basic.h"
...
...
@@ -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
)
...
...
eeschema/class_sch_cmp_field.h
View file @
441efc9f
...
...
@@ -9,7 +9,7 @@
* 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
to 11
are user fields.
* Fields 4
and more
are user fields.
* They can be renamed and can appear in reports
*/
...
...
@@ -50,6 +50,13 @@ public:
bool
IsVoid
();
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
*/
...
...
eeschema/component_class.cpp
View file @
441efc9f
...
...
@@ -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
/****************************************************************/
...
...
eeschema/dialog_edit_component_in_lib.cpp
View file @
441efc9f
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_component_in_lib.cpp
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 02/03/2006 08:51:09
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 02/03/2006 08:51:09
...
...
@@ -42,7 +42,6 @@ BEGIN_EVENT_TABLE( WinEDA_PartPropertiesFrame, wxDialog )
EVT_BUTTON
(
wxID_OK
,
WinEDA_PartPropertiesFrame
::
OnOkClick
)
////@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_DELETE_ONE_ALIAS
,
WinEDA_PartPropertiesFrame
::
DeleteAliasOfPart
)
EVT_BUTTON
(
ID_DELETE_ALL_ALIAS
,
WinEDA_PartPropertiesFrame
::
DeleteAllAliasOfPart
)
...
...
@@ -64,12 +63,11 @@ WinEDA_PartPropertiesFrame::WinEDA_PartPropertiesFrame( WinEDA_LibeditFrame* par
m_Parent
=
parent
;
m_RecreateToolbar
=
FALSE
;
m_AliasLocation
=
-
1
;
m_CurrentFieldId
=
0
;
InitBuffers
();
Create
(
parent
,
id
,
caption
,
pos
,
size
,
style
);
SetTitle
(
m_Title
);
}
...
...
@@ -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
)
{
m_FieldNameCtrl
=
NULL
;
////@begin WinEDA_PartPropertiesFrame member initialisation
m_GeneralBoxSizer
=
NULL
;
m_NoteBook
=
NULL
;
...
...
@@ -119,9 +116,9 @@ bool WinEDA_PartPropertiesFrame::Create( wxWindow* parent, wxWindowID id, const
*/
void
WinEDA_PartPropertiesFrame
::
CreateControls
()
{
{
SetFont
(
*
g_DialogFont
);
////@begin WinEDA_PartPropertiesFrame content construction
// Generated by DialogBlocks, 29/04/2008 21:32:37 (unregistered)
...
...
@@ -228,7 +225,6 @@ void WinEDA_PartPropertiesFrame::CreateControls()
BuildPanelBasic
();
BuildPanelDoc
();
BuildPanelAlias
();
BuildPanelEditField
();
// Add panel Field edition
BuildPanelFootprintFilter
();
}
...
...
eeschema/dialog_edit_component_in_lib.h
View file @
441efc9f
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_component_in_lib.h
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 02/03/2006 08:51:09
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 02/03/2006 08:51:09
...
...
@@ -75,7 +75,7 @@ class wxSpinCtrl;
*/
class
WinEDA_PartPropertiesFrame
:
public
wxDialog
{
{
DECLARE_DYNAMIC_CLASS
(
WinEDA_PartPropertiesFrame
)
DECLARE_EVENT_TABLE
()
...
...
@@ -122,7 +122,6 @@ public:
void
BuildPanelBasic
();
void
BuildPanelDoc
();
void
BuildPanelAlias
();
void
BuildPanelEditField
();
void
PartPropertiesAccept
(
wxCommandEvent
&
event
);
void
OnQuit
(
wxCommandEvent
&
event
);
void
DeleteAllAliasOfPart
(
wxCommandEvent
&
event
);
...
...
@@ -132,11 +131,6 @@ public:
bool
SetUnsetConvert
();
void
CopyDocToAlias
(
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
DeleteAllFootprintFilter
(
wxCommandEvent
&
event
);
...
...
@@ -164,10 +158,8 @@ public:
////@end WinEDA_PartPropertiesFrame member variables
WinEDA_LibeditFrame
*
m_Parent
;
int
m_CurrentFieldId
;
wxString
m_Title
;
wxPanel
*
m_PanelField
;
wxPanel
*
m_PanelFootprintFilter
;
wxButton
*
m_ButtonDeleteOneAlias
;
wxButton
*
m_ButtonDeleteAllAlias
;
...
...
@@ -181,24 +173,6 @@ public:
wxListBox
*
m_PartAliasList
;
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
;
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
}
/******************************************************************************/
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
)
{
D
(
printf
(
"OnListItemDeselected()
\n
"
);
)
...
...
@@ -251,10 +268,11 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::addFieldButtonHandler( wxCommandEvent&
blank
.
m_Orient
=
m_FieldsBuf
[
REFERENCE
].
m_Orient
;
m_FieldsBuf
.
push_back
(
blank
);
m_FieldsBuf
[
fieldNdx
].
m_Name
=
ReturnDefaultFieldName
(
fieldNdx
);
m_skipCopyFromPanel
=
true
;
setRowItem
(
fieldNdx
,
m_FieldsBuf
[
fieldNdx
]
);
m_skipCopyFromPanel
=
true
;
setSelectedFieldNdx
(
fieldNdx
);
m_skipCopyFromPanel
=
false
;
}
...
...
@@ -273,13 +291,17 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::deleteFieldButtonHandler( wxCommandEven
return
;
}
m_skipCopyFromPanel
=
true
;
m_FieldsBuf
.
erase
(
m_FieldsBuf
.
begin
()
+
fieldNdx
);
fieldListCtrl
->
DeleteItem
(
fieldNdx
);
if
(
fieldNdx
>=
m_FieldsBuf
.
size
()
)
--
fieldNdx
;
m_skipCopyFromPanel
=
true
;
// Reinitialize fields IDs and default names:
reinitializeFieldsIdAndDefaultNames
();
updateDisplay
(
);
setSelectedFieldNdx
(
fieldNdx
);
m_skipCopyFromPanel
=
false
;
}
...
...
@@ -314,6 +336,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC:: moveUpButtonHandler( wxCommandEvent& e
m_FieldsBuf
[
fieldNdx
]
=
tmp
;
setRowItem
(
fieldNdx
,
tmp
);
// Reinitialize fields IDs and default names:
reinitializeFieldsIdAndDefaultNames
();
updateDisplay
(
);
m_skipCopyFromPanel
=
true
;
setSelectedFieldNdx
(
fieldNdx
-
1
);
m_skipCopyFromPanel
=
false
;
...
...
@@ -645,20 +671,10 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
/* 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_Orient
=
entry
->
m_Prefix
.
m_Orient
;
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
(
REFERENCE
)
->
ImportValues
(
entry
->
m_Prefix
);
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
)
->
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
->
GetField
(
VALUE
)
->
ImportValues
(
entry
->
m_Name
);
m_Cmp
->
SetRotationMiroir
(
CMP_NORMAL
);
...
...
eeschema/dialog_edit_component_in_schematic.h
View file @
441efc9f
...
...
@@ -73,6 +73,22 @@ public:
*/
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__
eeschema/dialog_edit_libentry_fields_in_lib.cpp
View file @
441efc9f
...
...
@@ -18,86 +18,6 @@
// Local variables:
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
...
...
@@ -156,6 +76,22 @@ private:
*/
bool
copyPanelToSelectedField
();
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 )
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB
*
frame
=
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
();
}
DisplayLibInfos
();
}
...
...
@@ -180,10 +121,10 @@ DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB(
WinEDA_LibeditFrame
*
aParent
,
EDA_LibComponentStruct
*
aLibEntry
)
:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB_BASE
(
aParent
)
/***********************************************************************/
{
m_Parent
=
aParent
;
m_LibEntry
=
aLibEntry
;
/***********************************************************************/
}
...
...
@@ -309,12 +250,27 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::OnOKButtonClick( wxCommandEvent& event
m_Parent
->
GetScreen
()
->
SetModify
();
m_Parent
->
DrawPanel
->
Refresh
(
TRUE
);
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
)
/**************************************************************************************/
...
...
@@ -328,9 +284,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::addFieldButtonHandler( wxCommandEvent&
LibDrawField
blank
(
fieldNdx
);
blank
.
m_Orient
=
m_FieldsBuf
[
REFERENCE
].
m_Orient
;
m_FieldsBuf
.
push_back
(
blank
);
m_FieldsBuf
[
fieldNdx
].
m_Name
=
ReturnDefaultFieldName
(
fieldNdx
);
setRowItem
(
fieldNdx
,
m_FieldsBuf
[
fieldNdx
]
);
...
...
@@ -355,13 +310,18 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::deleteFieldButtonHandler( wxCommandEven
return
;
}
m_skipCopyFromPanel
=
true
;
m_FieldsBuf
.
erase
(
m_FieldsBuf
.
begin
()
+
fieldNdx
);
fieldListCtrl
->
DeleteItem
(
fieldNdx
);
if
(
fieldNdx
>=
m_FieldsBuf
.
size
()
)
--
fieldNdx
;
m_skipCopyFromPanel
=
true
;
// Reinitialize fields IDs and default names:
reinitializeFieldsIdAndDefaultNames
();
updateDisplay
(
);
setRowItem
(
fieldNdx
,
m_FieldsBuf
[
fieldNdx
]
);
setSelectedFieldNdx
(
fieldNdx
);
m_skipCopyFromPanel
=
false
;
}
...
...
@@ -395,6 +355,10 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB:: moveUpButtonHandler( wxCommandEvent& e
m_FieldsBuf
[
fieldNdx
]
=
tmp
;
setRowItem
(
fieldNdx
,
tmp
);
// Reinitialize fields IDs and default names:
reinitializeFieldsIdAndDefaultNames
();
updateDisplay
(
);
m_skipCopyFromPanel
=
true
;
setSelectedFieldNdx
(
fieldNdx
-
1
);
m_skipCopyFromPanel
=
false
;
...
...
@@ -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_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
);
// Display 12 fields (or more), and add missing fields
...
...
@@ -483,6 +448,8 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers( void )
fieldListCtrl
->
SetFocus
();
// 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
);
}
...
...
@@ -544,7 +511,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
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
->
SetEditable
(
fieldNdx
>=
FIELD1
);
...
...
@@ -629,7 +596,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
rotateCheckBox
->
SetValue
(
field
.
m_Orient
==
TEXT_ORIENT_VERT
);
/* 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
()
)
field
.
m_Text
=
fieldValueTextCtrl
->
GetValue
();
...
...
eeschema/edit_component_in_lib.cpp
View file @
441efc9f
...
...
@@ -14,7 +14,6 @@
enum
id_libedit
{
ID_PANEL_ALIAS
,
ID_PANEL_FIELD
,
ID_COPY_DOC_TO_ALIAS
,
ID_BROWSE_DOC_FILES
,
ID_ADD_ALIAS
,
...
...
@@ -24,31 +23,25 @@ enum id_libedit {
};
/* Routines locales */
/* Variables locales */
extern
int
CurrentUnit
;
/*
Classe de la frame des propri�t�s d'un composant en librairie
*/
/*
Dialog box to edit a libentry (a component in library) properties
*/
/* Cette classe genere une fenetre type NoteBook, pour l'edition des propri�t�s
* d'un composant le librairie.
* On peut �diter:
* Texte dimensions et justification de tous les champs (Ref, Val, et autres champs)
* Documentation et mots clefs
* Nombre de part par boitier
* et autres propri�r�s g�n�rales
/* Creates a NoteBook dialog
* Edition:
* Doc and keys words
* Parts per package
* General properties
* Fileds are NOT edited here. There is a specific dialog box to do that
*/
#include "dialog_edit_component_in_lib.cpp"
/*****************************************************************/
void
WinEDA_LibeditFrame
::
InstallLibeditFrame
(
const
wxPoint
&
pos
)
void
WinEDA_LibeditFrame
::
InstallLibeditFrame
(
void
)
/*****************************************************************/
{
wxPoint
fpos
=
pos
;
WinEDA_PartPropertiesFrame
*
frame
=
new
WinEDA_PartPropertiesFrame
(
this
);
...
...
@@ -59,86 +52,6 @@ void WinEDA_LibeditFrame::InstallLibeditFrame( const wxPoint& pos )
}
/***************************************************************************/
void
WinEDA_PartPropertiesFrame
::
CopyFieldDataToBuffer
(
LibDrawField
*
Field
)
/***************************************************************************/
/* copy the field data (name, attributes, size, position... to corresponding buffers
* for editing
*/
{
int
id
=
Field
->
m_FieldId
;
m_FieldFlags
[
id
]
=
(
Field
->
m_Attributs
&
TEXT_NO_VISIBLE
)
?
0
:
1
;
m_FieldOrient
[
id
]
=
Field
->
m_Orient
;
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_LEFT
)
m_FieldHJustify
[
id
]
=
0
;
else
if
(
Field
->
m_HJustify
==
GR_TEXT_HJUSTIFY_RIGHT
)
m_FieldHJustify
[
id
]
=
2
;
else
m_FieldHJustify
[
id
]
=
1
;
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_BOTTOM
)
m_FieldVJustify
[
id
]
=
0
;
else
if
(
Field
->
m_VJustify
==
GR_TEXT_VJUSTIFY_TOP
)
m_FieldVJustify
[
id
]
=
2
;
else
m_FieldVJustify
[
id
]
=
1
;
m_FieldText
[
id
]
=
Field
->
m_Text
;
if
(
id
>=
FIELD1
)
m_FieldName
[
id
]
=
Field
->
m_Name
;
m_FieldPosition
[
id
]
=
Field
->
m_Pos
;
// 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
)
/***************************************************************************/
/* Copy data from buffers(name, attributes, size, position... )to the
* field "Field"
*/
{
GRTextHorizJustifyType
hjustify
[
3
]
=
{
GR_TEXT_HJUSTIFY_LEFT
,
GR_TEXT_HJUSTIFY_CENTER
,
GR_TEXT_HJUSTIFY_RIGHT
};
GRTextVertJustifyType
vjustify
[
3
]
=
{
GR_TEXT_VJUSTIFY_BOTTOM
,
GR_TEXT_VJUSTIFY_CENTER
,
GR_TEXT_VJUSTIFY_TOP
};
int
ii
=
Field
->
m_FieldId
;
Field
->
m_Text
=
m_FieldText
[
ii
];
if
(
ii
>=
FIELD1
&&
m_FieldName
[
ii
]
!=
ReturnDefaultFieldName
(
ii
)
)
Field
->
m_Name
=
m_FieldName
[
ii
];
else
Field
->
m_Name
.
Empty
();
Field
->
m_Size
.
x
=
Field
->
m_Size
.
y
=
m_FieldSize
[
ii
];
Field
->
m_HJustify
=
hjustify
[
m_FieldHJustify
[
ii
]];
Field
->
m_VJustify
=
vjustify
[
m_FieldVJustify
[
ii
]];
if
(
m_FieldFlags
[
ii
]
)
Field
->
m_Attributs
&=
~
TEXT_NO_VISIBLE
;
else
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
()
/*****************************************************/
...
...
@@ -147,21 +60,6 @@ void WinEDA_PartPropertiesFrame::InitBuffers()
* or to values from CurrentLibEntry if CurrentLibEntry != NULL
*/
{
int
ii
;
m_CurrentFieldId
=
REFERENCE
;
for
(
ii
=
0
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
if
(
ii
<
FIELD1
)
m_FieldName
[
ii
]
=
ReturnDefaultFieldName
(
ii
);
m_FieldFlags
[
ii
]
=
1
;
m_FieldOrient
[
ii
]
=
0
;
m_FieldSize
[
ii
]
=
DEFAULT_TEXT_SIZE
;
m_FieldHJustify
[
ii
]
=
1
;
m_FieldVJustify
[
ii
]
=
1
;
}
m_AliasLocation
=
-
1
;
if
(
CurrentLibEntry
==
NULL
)
{
...
...
@@ -183,16 +81,6 @@ void WinEDA_PartPropertiesFrame::InitBuffers()
m_Title
=
msg_text
+
CurrentLibEntry
->
m_Name
.
m_Text
;
CurrentAliasName
.
Empty
();
}
CopyFieldDataToBuffer
(
&
CurrentLibEntry
->
m_Prefix
);
CopyFieldDataToBuffer
(
&
CurrentLibEntry
->
m_Name
);
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
while
(
Field
)
{
CopyFieldDataToBuffer
(
Field
);
Field
=
Field
->
Next
();
}
}
...
...
@@ -464,183 +352,6 @@ void WinEDA_PartPropertiesFrame::BuildPanelBasic()
}
/*********************************************************/
void
WinEDA_PartPropertiesFrame
::
BuildPanelEditField
()
/*********************************************************/
/* Create and build the panel managing the fields (REF, VALUE ...)
* of the component
*/
{
static
const
wxString
Hjustify_list
[]
=
{
_
(
"Align left"
),
_
(
"Align center"
),
_
(
"Align right"
)
};
static
const
wxString
Vjustify_list
[]
=
{
_
(
"Align bottom"
),
_
(
"Align center"
),
_
(
"Align top"
)
};
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
,
_
(
"Field Text:"
),
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
];
}
fieldnamelist
[
VALUE
]
<<
wxT
(
"/"
)
<<
_
(
"Chip Name"
);
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
()
/****************************************************************/
/* Copy the values displayed on the panel field to the buffers according to
* the current field number
*/
{
int
id
=
m_CurrentFieldId
;
m_FieldFlags
[
id
]
=
m_ShowFieldTextCtrl
->
GetValue
();
m_FieldOrient
[
id
]
=
m_VorientFieldTextCtrl
->
GetValue
();
m_FieldHJustify
[
id
]
=
m_FieldHJustifyCtrl
->
GetSelection
();
m_FieldVJustify
[
id
]
=
m_FieldVJustifyCtrl
->
GetSelection
();
m_FieldText
[
id
]
=
m_FieldTextCtrl
->
GetText
();
m_FieldName
[
id
]
=
m_FieldNameCtrl
->
GetValue
();
m_FieldPosition
[
id
]
=
m_FieldPositionCtrl
->
GetValue
();
m_FieldSize
[
id
]
=
m_FieldTextCtrl
->
GetTextSize
();
}
/********************************************************************/
void
WinEDA_PartPropertiesFrame
::
SelectNewField
(
wxCommandEvent
&
event
)
/********************************************************************/
/* called when changing the current field selected
* Save the current field settings in buffer and display the new one
*/
{
CopyPanelFieldToData
();
m_CurrentFieldId
=
m_FieldSelection
->
GetSelection
();
CopyDataToPanelField
();
}
/**************************************************************************/
void
WinEDA_PartPropertiesFrame
::
PartPropertiesAccept
(
wxCommandEvent
&
event
)
/**************************************************************************/
...
...
@@ -658,23 +369,6 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
m_Parent
->
GetScreen
()
->
SetModify
();
m_Parent
->
SaveCopyInUndoList
(
CurrentLibEntry
);
CopyPanelFieldToData
();
/* A new name could be entered in VALUE field.
* Must not be an existing alias name in alias list box */
jj
=
m_PartAliasList
->
GetCount
();
wxString
newvalue
=
m_FieldText
[
VALUE
];
for
(
ii
=
0
;
ii
<
jj
;
ii
++
)
{
if
(
newvalue
.
CmpNoCase
(
m_PartAliasList
->
GetString
(
ii
).
GetData
()
)
==
0
)
{
wxString
msg
;
msg
.
Printf
(
wxT
(
"Alias %s exists!"
),
newvalue
.
GetData
()
);
DisplayError
(
this
,
msg
);
return
;
}
}
/* Update the doc, keyword and doc filename strings */
if
(
m_AliasLocation
<
0
)
{
...
...
@@ -727,88 +421,6 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
}
}
// Void fields for REFERENCE and VALUE are not allowed
if
(
m_FieldText
[
REFERENCE
].
IsEmpty
()
)
{
m_FieldText
[
REFERENCE
]
=
CurrentLibEntry
->
m_Prefix
.
m_Text
;
}
if
(
m_FieldText
[
VALUE
].
IsEmpty
()
)
{
m_FieldText
[
VALUE
]
=
CurrentLibEntry
->
m_Name
.
m_Text
;
}
else
{
if
(
CurrentLibEntry
->
m_Name
.
m_Text
!=
m_FieldText
[
VALUE
]
)
m_RecreateToolbar
=
TRUE
;
}
CopyBufferToFieldData
(
&
CurrentLibEntry
->
m_Prefix
);
CopyBufferToFieldData
(
&
CurrentLibEntry
->
m_Name
);
for
(
ii
=
FOOTPRINT
;
ii
<
NUMBER_OF_FIELDS
;
ii
++
)
{
LibDrawField
*
Field
=
CurrentLibEntry
->
Fields
;
LibDrawField
*
NextField
,
*
previousField
=
NULL
;
while
(
Field
)
{
NextField
=
Field
->
Next
();
if
(
Field
->
m_FieldId
==
ii
)
{
CopyBufferToFieldData
(
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
CurrentLibEntry
->
Fields
=
NextField
;
}
}
break
;
}
previousField
=
Field
;
Field
=
NextField
;
}
if
(
Field
==
NULL
)
// Do not exists: must be created if not void
{
bool
create
=
FALSE
;
if
(
!
m_FieldText
[
ii
].
IsEmpty
()
)
create
=
TRUE
;
if
(
!
m_FieldName
[
ii
].
IsEmpty
()
&&
(
m_FieldName
[
ii
]
!=
ReturnDefaultFieldName
(
ii
)
)
)
create
=
TRUE
;
if
(
create
)
{
Field
=
new
LibDrawField
(
ii
);
CopyBufferToFieldData
(
Field
);
Field
->
SetNext
(
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
;
while
(
Field
)
{
if
(
Field
->
m_FieldId
>=
FIELD1
)
if
(
Field
->
m_Text
.
IsEmpty
()
)
Field
->
m_Text
=
wxT
(
"~"
);
Field
=
Field
->
Next
();
}
}
ii
=
SelNumberOfUnits
->
GetValue
();
if
(
ChangeNbUnitsPerPackage
(
ii
)
)
m_RecreateToolbar
=
TRUE
;
...
...
eeschema/eelibs_draw_components.cpp
View file @
441efc9f
...
...
@@ -153,7 +153,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
if
(
(
LibEntry
->
m_Name
.
m_Flags
&
IS_MOVED
)
==
0
)
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
()
)
return
;
...
...
eeschema/eelibs_read_libraryfiles.cpp
View file @
441efc9f
...
...
@@ -957,9 +957,7 @@ static bool GetLibEntryField (EDA_LibComponentStruct* LibEntry,
break
;
Field
=
new
LibDrawField
(
NumOfField
);
Field
->
SetNext
(
LibEntry
->
Fields
);
LibEntry
->
Fields
=
Field
;
LibEntry
->
m_Fields
.
PushBack
(
Field
);
break
;
}
...
...
eeschema/getpart.cpp
View file @
441efc9f
...
...
@@ -185,43 +185,30 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
/* Init champ Valeur */
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
)
->
m_Size
=
Entry
->
m_Name
.
m_Size
;
DrawLibItem
->
GetField
(
VALUE
)
->
ImportValues
(
Entry
->
m_Name
);
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
;
if
(
msg
.
IsEmpty
()
)
msg
=
wxT
(
"U"
);
msg
+=
wxT
(
"?"
);
//update the reference -- just the prefix for now.
//
update the reference -- just the prefix for now.
DrawLibItem
->
SetRef
(
GetSheet
(),
msg
);
/* Init champ Reference */
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Pos
=
Entry
->
m_Prefix
.
m_Pos
+
DrawLibItem
->
m_Pos
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Orient
=
Entry
->
m_Prefix
.
m_Orient
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Size
=
Entry
->
m_Prefix
.
m_Size
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
m_Pos
=
Entry
->
m_Prefix
.
m_Pos
+
DrawLibItem
->
m_Pos
;
DrawLibItem
->
GetField
(
REFERENCE
)
->
ImportValues
(
Entry
->
m_Prefix
);
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 */
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
()
)
continue
;
ii
=
Field
->
m_FieldId
;
if
(
ii
<
2
)
if
(
ii
<
2
)
// Reference or value, already done
continue
;
if
(
ii
>=
DrawLibItem
->
GetFieldCount
()
)
...
...
@@ -230,15 +217,9 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
SCH_CMP_FIELD
*
f
=
DrawLibItem
->
GetField
(
ii
);
f
->
m_Pos
+=
Field
->
m_Pos
;
f
->
m_Size
=
Field
->
m_Size
;
f
->
m_Attributs
=
Field
->
m_Attributs
;
f
->
m_Orient
=
Field
->
m_Orient
;
f
->
ImportValues
(
*
Field
);
f
->
m_Text
=
Field
->
m_Text
;
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
);
...
...
eeschema/libedit_onleftclick.cpp
View file @
441efc9f
...
...
@@ -220,9 +220,7 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
}
if
(
DrawEntry
==
NULL
)
{
wxPoint
mpos
;
wxGetMousePosition
(
&
mpos
.
x
,
&
mpos
.
y
);
InstallLibeditFrame
(
mpos
);
InstallLibeditFrame
(
);
}
}
...
...
eeschema/libfield.cpp
View file @
441efc9f
...
...
@@ -327,7 +327,7 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( EDA_LibComponentStruct* LibEntry
return
&
LibEntry
->
m_Prefix
;
/* 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
()
)
continue
;
...
...
eeschema/libframe.cpp
View file @
441efc9f
...
...
@@ -378,7 +378,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_LIBEDIT_GET_FRAME_EDIT_PART
:
InstallLibeditFrame
(
pos
);
InstallLibeditFrame
(
);
break
;
case
ID_LIBEDIT_GET_FRAME_EDIT_FIELDS
:
...
...
eeschema/savelib.cpp
View file @
441efc9f
...
...
@@ -278,12 +278,10 @@ EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStr
NewStruct
->
m_DocFile
=
OldEntry
->
m_DocFile
;
/* Copie des champs */
for
(
OldField
=
OldEntry
->
Fields
;
OldField
!=
NULL
;
OldField
=
(
LibDrawField
*
)
OldField
->
Next
()
)
for
(
OldField
=
OldEntry
->
m_Fields
;
OldField
!=
NULL
;
OldField
=
OldField
->
Next
()
)
{
NewField
=
OldField
->
GenCopy
();
NewField
->
SetNext
(
NewStruct
->
Fields
);
NewStruct
->
Fields
=
NewField
;
NewStruct
->
m_Fields
.
PushBack
(
NewField
);
}
/* Copie des elements type Drawing */
...
...
@@ -363,8 +361,7 @@ bool EDA_LibComponentStruct::Save( FILE* aFile )
m_Prefix
.
Save
(
aFile
);
m_Name
.
Save
(
aFile
);
for
(
Field
=
Fields
;
Field
!=
NULL
;
Field
=
(
LibDrawField
*
)
Field
->
Next
()
)
for
(
Field
=
m_Fields
;
Field
!=
NULL
;
Field
=
Field
->
Next
()
)
{
if
(
Field
->
m_Text
.
IsEmpty
()
&&
Field
->
m_Name
.
IsEmpty
()
)
continue
;
...
...
eeschema/symbedit.cpp
View file @
441efc9f
...
...
@@ -394,7 +394,7 @@ void WinEDA_LibeditFrame::PlaceAncre()
LibEntry
->
m_Name
.
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
;
}
...
...
eeschema/tool_lib.cpp
View file @
441efc9f
...
...
@@ -160,7 +160,7 @@ void WinEDA_LibeditFrame::ReCreateHToolbar()
wxNullBitmap
,
FALSE
,
-
1
,
-
1
,
(
wxObject
*
)
NULL
,
_
(
"Add, remove
,
edit fields properties"
)
);
_
(
"Add, remove
fields and
edit fields properties"
)
);
m_HToolBar
->
AddSeparator
();
m_HToolBar
->
AddTool
(
ID_LIBEDIT_CHECK_PART
,
BITMAP
(
erc_xpm
),
...
...
include/wxEeschemaStruct.h
View file @
441efc9f
...
...
@@ -403,7 +403,7 @@ private:
LibraryStruct
*
Library
,
int
noMsg
=
0
);
void
DisplayCmpDoc
(
const
wxString
&
Name
);
void
InstallLibeditFrame
(
const
wxPoint
&
pos
);
void
InstallLibeditFrame
(
);
// General editing
public
:
...
...
pcbnew/class_board.h
View file @
441efc9f
...
...
@@ -85,8 +85,8 @@ public:
int
m_Status_Pcb
;
// Flags used in ratsnet calculation and update
EDA_BoardDesignSettings
*
m_BoardSettings
;
// Link to current design settings
int
m_NbNodes
;
// Active pads (pads attached to a net ) count
int
m_NbLinks
;
// Ratsnet count
int
m_NbLoclinks
;
// Ra
stests to she
w while creating a track
int
m_NbLinks
;
// Ratsne
s
t count
int
m_NbLoclinks
;
// Ra
tsests to sho
w while creating a track
int
m_NbNoconnect
;
// Active ratsnet count (rastnest not alraedy connected by tracks
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