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
273244a1
Commit
273244a1
authored
Jan 21, 2013
by
Dick Hollenbeck
Browse files
Options
Browse Files
Download
Plain Diff
merge in branch fp-lib-table
parents
ac64da65
8fd0c322
Changes
13
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
647 additions
and
216 deletions
+647
-216
dsnlexer.cpp
common/dsnlexer.cpp
+4
-6
fp_lib_table.cpp
common/fp_lib_table.cpp
+102
-44
fp_lib_table.keywords
common/fp_lib_table.keywords
+3
-5
richio.cpp
common/richio.cpp
+41
-10
fp_lib_table.h
include/fp_lib_table.h
+61
-59
richio.h
include/richio.h
+2
-18
dialog_fp_lib_table.cpp
pcbnew/dialogs/dialog_fp_lib_table.cpp
+337
-36
dialog_fp_lib_table_base.cpp
pcbnew/dialogs/dialog_fp_lib_table_base.cpp
+21
-7
dialog_fp_lib_table_base.fbp
pcbnew/dialogs/dialog_fp_lib_table_base.fbp
+15
-15
dialog_fp_lib_table_base.h
pcbnew/dialogs/dialog_fp_lib_table_base.h
+6
-2
io_mgr.h
pcbnew/io_mgr.h
+1
-0
pcb_plot_params.h
pcbnew/pcb_plot_params.h
+3
-4
pcbnew_config.cpp
pcbnew/pcbnew_config.cpp
+51
-10
No files found.
common/dsnlexer.cpp
View file @
273244a1
...
...
@@ -304,9 +304,8 @@ void DSNLEXER::Unexpected( int aTok ) throw( IO_ERROR )
void
DSNLEXER
::
Duplicate
(
int
aTok
)
throw
(
IO_ERROR
)
{
wxString
errText
;
errText
.
Printf
(
_
(
"%s is a duplicate"
),
GetTokenString
(
aTok
).
GetData
()
);
wxString
errText
=
wxString
::
Format
(
_
(
"%s is a duplicate"
),
GetTokenString
(
aTok
).
GetData
()
);
THROW_PARSE_ERROR
(
errText
,
CurSource
(),
CurLine
(),
CurLineNumber
(),
CurOffset
()
);
}
...
...
@@ -358,9 +357,8 @@ int DSNLEXER::NeedNUMBER( const char* aExpectation ) throw( IO_ERROR )
int
tok
=
NextTok
();
if
(
tok
!=
DSN_NUMBER
)
{
wxString
errText
;
errText
.
Printf
(
_
(
"need a NUMBER for '%s'"
),
wxString
::
FromUTF8
(
aExpectation
).
GetData
()
);
wxString
errText
=
wxString
::
Format
(
_
(
"need a NUMBER for '%s'"
),
wxString
::
FromUTF8
(
aExpectation
).
GetData
()
);
THROW_PARSE_ERROR
(
errText
,
CurSource
(),
CurLine
(),
CurLineNumber
(),
CurOffset
()
);
}
return
tok
;
...
...
common/fp_lib_table.cpp
View file @
273244a1
...
...
@@ -24,6 +24,8 @@
*/
#include <wx/config.h> // wxExpandEnvVars()
#include <set>
#include <io_mgr.h>
...
...
@@ -45,11 +47,29 @@ FP_LIB_TABLE::FP_LIB_TABLE( FP_LIB_TABLE* aFallBackTable ) :
void
FP_LIB_TABLE
::
Parse
(
FP_LIB_TABLE_LEXER
*
in
)
throw
(
IO_ERROR
,
PARSE_ERROR
)
{
T
tok
;
/*
(fp_lib_table
(lib (name NICKNAME)(descr DESCRIPTION)(type TYPE)(full_uri FULL_URI)(options OPTIONS))
:
)
Elements after (name) are order independent.
*/
T
tok
;
// This table may be nested within a larger s-expression, or not.
// Allow for parser of that optional containing s-epression to have looked ahead.
if
(
in
->
CurTok
()
!=
T_fp_lib_table
)
{
in
->
NeedLEFT
();
if
(
(
tok
=
in
->
NextTok
()
)
!=
T_fp_lib_table
)
in
->
Expecting
(
T_fp_lib_table
);
}
while
(
(
tok
=
in
->
NextTok
()
)
!=
T_RIGHT
)
{
// (lib (name "LOGICAL")(type "TYPE")(full_uri "FULL_URI")(options "OPTIONS"))
ROW
row
;
// reconstructed for each row in input stream.
if
(
tok
==
T_EOF
)
in
->
Expecting
(
T_RIGHT
);
...
...
@@ -57,10 +77,14 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR
if
(
tok
!=
T_LEFT
)
in
->
Expecting
(
T_LEFT
);
if
(
(
tok
=
in
->
NextTok
()
)
!=
T_fp_lib
)
in
->
Expecting
(
T_fp_lib
);
// in case there is a "row integrity" error, tell where later.
int
lineNum
=
in
->
CurLineNumber
();
int
offset
=
in
->
CurOffset
();
if
(
(
tok
=
in
->
NextTok
()
)
!=
T_lib
)
in
->
Expecting
(
T_lib
);
// (name
"LOGICAL_NAME"
)
// (name
NICKNAME
)
in
->
NeedLEFT
();
if
(
(
tok
=
in
->
NextTok
()
)
!=
T_name
)
...
...
@@ -68,48 +92,74 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR
in
->
NeedSYMBOLorNUMBER
();
ROW
row
;
row
.
SetNickName
(
in
->
FromUTF8
()
);
in
->
NeedRIGHT
();
//
(uri "FULL_URI")
in
->
NeedLEFT
();
//
After (name), remaining (lib) elements are order independent, and in
// some cases optional.
if
(
(
tok
=
in
->
NextTok
()
)
!=
T_full_uri
)
in
->
Expecting
(
T_full_uri
);
bool
sawType
=
false
;
bool
sawOpts
=
false
;
bool
sawDesc
=
false
;
bool
sawUri
=
false
;
in
->
NeedSYMBOLorNUMBER
();
row
.
SetFullURI
(
in
->
FromUTF8
()
);
in
->
NeedRIGHT
();
// (type "TYPE")
in
->
NeedLEFT
();
while
(
(
tok
=
in
->
NextTok
()
)
!=
T_RIGHT
)
{
if
(
tok
==
T_EOF
)
in
->
Unexpected
(
T_EOF
);
if
(
tok
!=
T_LEFT
)
in
->
Expecting
(
T_LEFT
);
tok
=
in
->
NeedSYMBOLorNUMBER
();
switch
(
tok
)
{
case
T_uri
:
if
(
sawUri
)
in
->
Duplicate
(
tok
);
sawUri
=
true
;
in
->
NeedSYMBOLorNUMBER
();
row
.
SetFullURI
(
in
->
FromUTF8
()
);
break
;
case
T_type
:
if
(
sawType
)
in
->
Duplicate
(
tok
);
sawType
=
true
;
in
->
NeedSYMBOLorNUMBER
();
row
.
SetType
(
in
->
FromUTF8
()
);
break
;
case
T_options
:
if
(
sawOpts
)
in
->
Duplicate
(
tok
);
sawOpts
=
true
;
in
->
NeedSYMBOLorNUMBER
();
row
.
SetOptions
(
in
->
FromUTF8
()
);
break
;
case
T_descr
:
if
(
sawDesc
)
in
->
Duplicate
(
tok
);
sawDesc
=
true
;
in
->
NeedSYMBOLorNUMBER
();
row
.
SetDescr
(
in
->
FromUTF8
()
);
break
;
default
:
in
->
Unexpected
(
tok
);
}
in
->
NeedRIGHT
();
}
if
(
(
tok
=
in
->
NextTok
()
)
!=
T_t
ype
)
if
(
!
sawT
ype
)
in
->
Expecting
(
T_type
);
in
->
NeedSYMBOLorNUMBER
();
row
.
SetType
(
in
->
FromUTF8
()
);
in
->
NeedRIGHT
();
// (options "OPTIONS")
in
->
NeedLEFT
();
if
(
(
tok
=
in
->
NextTok
()
)
!=
T_options
)
in
->
Expecting
(
T_options
);
in
->
NeedSYMBOLorNUMBER
();
row
.
SetOptions
(
in
->
FromUTF8
()
);
in
->
NeedRIGHT
();
in
->
NeedRIGHT
();
// terminate the (lib..)
if
(
!
sawUri
)
in
->
Expecting
(
T_uri
);
// all nickNames within this table fragment must be unique, so we do not
// use doReplace in InsertRow(). (However a fallBack table can have a
...
...
@@ -119,9 +169,8 @@ void FP_LIB_TABLE::Parse( FP_LIB_TABLE_LEXER* in ) throw( IO_ERROR, PARSE_ERROR
{
wxString
msg
=
wxString
::
Format
(
_
(
"'%s' is a duplicate footprint library nickName"
),
GetChars
(
row
.
nickName
)
);
THROW_IO_ERROR
(
msg
);
GetChars
(
row
.
nickName
)
);
THROW_PARSE_ERROR
(
msg
,
in
->
CurSource
(),
in
->
CurLine
(),
lineNum
,
offset
);
}
}
}
...
...
@@ -142,11 +191,12 @@ void FP_LIB_TABLE::Format( OUTPUTFORMATTER* out, int nestLevel ) const
void
FP_LIB_TABLE
::
ROW
::
Format
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
const
throw
(
IO_ERROR
)
{
out
->
Print
(
nestLevel
,
"(lib (name %s)(
full_uri %s)(type %s)(options
%s))
\n
"
,
out
->
Print
(
nestLevel
,
"(lib (name %s)(
type %s)(uri %s)(options %s)(descr
%s))
\n
"
,
out
->
Quotew
(
GetNickName
()
).
c_str
(),
out
->
Quotew
(
GetFullURI
()
).
c_str
(),
out
->
Quotew
(
GetType
()
).
c_str
(),
out
->
Quotew
(
GetOptions
()
).
c_str
()
out
->
Quotew
(
GetFullURI
()
).
c_str
(),
out
->
Quotew
(
GetOptions
()
).
c_str
(),
out
->
Quotew
(
GetDescr
()
).
c_str
()
);
}
...
...
@@ -252,6 +302,14 @@ PLUGIN* FP_LIB_TABLE::PluginFind( const wxString& aLibraryNickName )
}
const
wxString
FP_LIB_TABLE
::
ExpandSubtitutions
(
const
wxString
aString
)
{
// We reserve the right to do this another way, by providing our own member
// function.
return
wxExpandEnvVars
(
aString
);
}
#if 0 // don't know that this is needed yet
MODULE* FP_LIB_TABLE::LookupFootprint( const FP_LIB_ID& aFootprintId )
throw( IO_ERROR )
...
...
common/fp_lib_table.keywords
View file @
273244a1
fp_lib_table
lib
name
type
kicad
legacy
eagle
full_uri
uri
options
fp_lib
descr
common/richio.cpp
View file @
273244a1
...
...
@@ -39,27 +39,58 @@
// "richio" after its author, Richard Hollenbeck, aka Dick Hollenbeck.
void
IO_ERROR
::
init
(
const
char
*
aThrowersFile
,
const
char
*
aThrowersLoc
,
const
wxString
&
aMsg
)
{
errorText
.
Printf
(
IO_FORMAT
,
aMsg
.
GetData
(),
wxString
::
FromUTF8
(
aThrowersFile
).
GetData
(),
wxString
::
FromUTF8
(
aThrowersLoc
).
GetData
()
);
}
void
PARSE_ERROR
::
init
(
const
char
*
aThrowersFile
,
const
char
*
aThrowersLoc
,
const
wxString
&
aMsg
,
const
wxString
&
aSource
,
const
char
*
aInputLine
,
int
aLineNumber
,
int
aByteIndex
)
{
// save inpuLine, lineNumber, and offset for UI (.e.g. Sweet text editor)
inputLine
=
aInputLine
;
lineNumber
=
aLineNumber
;
byteIndex
=
aByteIndex
;
errorText
.
Printf
(
PARSE_FORMAT
,
aMsg
.
GetData
(),
aSource
.
GetData
(),
aLineNumber
,
aByteIndex
,
wxString
::
FromUTF8
(
aThrowersFile
).
GetData
(),
wxString
::
FromUTF8
(
aThrowersLoc
).
GetData
()
);
}
//-----<LINE_READER>------------------------------------------------------
LINE_READER
::
LINE_READER
(
unsigned
aMaxLineLength
)
{
lineNum
=
0
;
if
(
aMaxLineLength
==
0
)
// caller is goofed up.
aMaxLineLength
=
LINE_READER_LINE_DEFAULT_MAX
;
if
(
aMaxLineLength
==
0
)
{
line
=
0
;
}
else
{
maxLineLength
=
aMaxLineLength
;
maxLineLength
=
aMaxLineLength
;
// start at the INITIAL size, expand as needed up to the MAX size in maxLineLength
capacity
=
LINE_READER_LINE_INITIAL_SIZE
;
// start at the INITIAL size, expand as needed up to the MAX size in maxLineLength
capacity
=
LINE_READER_LINE_INITIAL_SIZE
;
// but never go above user's aMaxLineLength, and leave space for trailing nul
if
(
capacity
>
aMaxLineLength
+
1
)
capacity
=
aMaxLineLength
+
1
;
// but never go above user's aMaxLineLength, and leave space for trailing nul
if
(
capacity
>
aMaxLineLength
+
1
)
capacity
=
aMaxLineLength
+
1
;
line
=
new
char
[
capacity
];
line
=
new
char
[
capacity
];
line
[
0
]
=
'\0'
;
}
line
[
0
]
=
'\0'
;
length
=
0
;
}
...
...
include/fp_lib_table.h
View file @
273244a1
...
...
@@ -41,7 +41,7 @@ class FP_LIB_TABLE_LEXER;
/**
* Class FP_LIB_TABLE
* holds FP_LIB_TABLE::ROW records
, and can be searched based on logical library n
ame.
* holds FP_LIB_TABLE::ROW records
(rows), and can be searched based on library nickN
ame.
* <p>
* This class owns the <b>footprint library table</b>, which is like fstab in concept and maps
* logical library name to the library URI, type, and options. It is heavily based on the SWEET
...
...
@@ -104,10 +104,12 @@ public:
{
}
ROW
(
const
wxString
&
aNick
,
const
wxString
&
aURI
,
const
wxString
&
aType
,
const
wxString
&
aOptions
)
:
ROW
(
const
wxString
&
aNick
,
const
wxString
&
aURI
,
const
wxString
&
aType
,
const
wxString
&
aOptions
,
const
wxString
&
aDescr
=
wxEmptyString
)
:
nickName
(
aNick
),
uri
(
aURI
),
options
(
aOptions
)
options
(
aOptions
),
description
(
aDescr
)
{
SetType
(
aType
);
}
...
...
@@ -119,90 +121,80 @@ public:
bool
operator
!=
(
const
ROW
&
r
)
const
{
return
!
(
*
this
==
r
);
}
//-----<accessors>------------------------------------------------------
/**
* Function GetNickName
* returns the short name of this library table row.
*/
const
wxString
&
GetNickName
()
const
{
return
nickName
;
}
const
wxString
&
GetNickName
()
const
{
return
nickName
;
}
/**
* Function SetNickName
* changes the logical name of this library, useful for an editor.
*/
void
SetNickName
(
const
wxString
&
aNickName
)
{
nickName
=
aNickName
;
}
/**
* Function GetType
* returns the type of LIB represented by this r
ecord
.
* returns the type of LIB represented by this r
ow
.
*/
const
wxString
GetType
()
const
{
return
IO_MGR
::
ShowType
(
type
);
}
const
wxString
GetType
()
const
{
return
IO_MGR
::
ShowType
(
type
);
}
/**
* Function SetType
* changes the type represented by this row.
*/
void
SetType
(
const
wxString
&
aType
)
{
type
=
IO_MGR
::
EnumFromStr
(
aType
);
}
/**
* Function GetFullURI
* returns the full location specifying URI for the LIB.
*/
const
wxString
&
GetFullURI
()
const
{
return
uri
;
}
const
wxString
&
GetFullURI
()
const
{
return
uri
;
}
/**
* Function SetFullURI
* changes the full URI for the library.
*/
void
SetFullURI
(
const
wxString
&
aFullURI
)
{
uri
=
aFullURI
;
}
/**
* Function GetOptions
* returns the options string, which may hold a password or anything else needed to
* instantiate the underlying LIB_SOURCE.
*/
const
wxString
&
GetOptions
()
const
{
return
options
;
}
const
wxString
&
GetOptions
()
const
{
return
options
;
}
/**
* Function Format
* serializes this object as utf8 text to an OUTPUTFORMATTER, and tries to
* make it look good using multiple lines and indentation.
* @param out is an #OUTPUTFORMATTER
* @param nestLevel is the indentation level to base all lines of the output.
* Actual indentation will be 2 spaces for each nestLevel.
* Function SetOptions
*/
void
Format
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
const
throw
(
IO_ERROR
);
void
SetOptions
(
const
wxString
&
aOptions
)
{
options
=
aOptions
;
}
/**
* Function
SetNickName
*
changes the logical name of this library, useful for an editor
.
* Function
GetDescr
*
returns the description of the library referenced by this row
.
*/
void
SetNickName
(
const
wxString
&
aNickName
)
{
nickName
=
aNickName
;
}
const
wxString
&
GetDescr
()
const
{
return
description
;
}
/**
* Function Set
Type
* changes the
type represented by this record
.
* Function Set
Descr
* changes the
description of the library referenced by this row
.
*/
void
SetType
(
const
wxString
&
aType
)
{
type
=
IO_MGR
::
EnumFromStr
(
aType
);
}
void
SetDescr
(
const
wxString
&
aDescr
)
{
description
=
aDescr
;
}
/**
* Function SetFullURI
* changes the full URI for the library, useful from a library table editor.
*/
void
SetFullURI
(
const
wxString
&
aFullURI
)
{
uri
=
aFullURI
;
}
//-----</accessors>-----------------------------------------------------
/**
* Function SetOptions
* changes the options string for this record, and is useful from
* the library table editor.
* Function Format
* serializes this object as utf8 text to an OUTPUTFORMATTER, and tries to
* make it look good using multiple lines and indentation.
* @param out is an #OUTPUTFORMATTER
* @param nestLevel is the indentation level to base all lines of the output.
* Actual indentation will be 2 spaces for each nestLevel.
*/
void
SetOptions
(
const
wxString
&
aOptions
)
{
options
=
aOptions
;
}
void
Format
(
OUTPUTFORMATTER
*
out
,
int
nestLevel
)
const
throw
(
IO_ERROR
);
private
:
...
...
@@ -210,6 +202,7 @@ public:
wxString
uri
;
LIB_T
type
;
wxString
options
;
wxString
description
;
};
...
...
@@ -219,7 +212,7 @@ public:
* @a aFallBackTable. Loading of this table fragment is done by using Parse().
*
* @param aFallBackTable is another FP_LIB_TABLE which is searched only when
* a r
ecord
is not found in this table. No ownership is
* a r
ow
is not found in this table. No ownership is
* taken of aFallBackTable.
*/
FP_LIB_TABLE
(
FP_LIB_TABLE
*
aFallBackTable
=
NULL
);
...
...
@@ -249,9 +242,9 @@ public:
*
* <pre>
* (fp_lib_table
* (lib (name LOGICAL)(
type TYPE)(uri FULL_URI
)(options OPTIONS))
* (lib (name LOGICAL)(
type TYPE)(uri FULL_URI
)(options OPTIONS))
* (lib (name LOGICAL)(
type TYPE)(uri FULL_URI
)(options OPTIONS))
* (lib (name LOGICAL)(
descr DESCRIPTION)(uri FULL_URI)(type TYPE
)(options OPTIONS))
* (lib (name LOGICAL)(
descr DESCRIPTION)(uri FULL_URI)(type TYPE
)(options OPTIONS))
* (lib (name LOGICAL)(
descr DESCRIPTION)(uri FULL_URI)(type TYPE
)(options OPTIONS))
* )
* </pre>
*
...
...
@@ -363,6 +356,15 @@ public:
const
ROW
*
FindRow
(
const
wxString
&
aNickName
)
throw
(
IO_ERROR
);
/**
* Function ExpandEnvSubsitutions
* replaces any environment variable references with their values and is
* here to fully embellish the ROW::uri in a platform independent way.
* This enables (fp_lib_table)s to have platform dependent environment
* variables in them, allowing for a uniform table across platforms.
*/
static
const
wxString
ExpandSubtitutions
(
const
wxString
aString
);
protected
:
/**
...
...
include/richio.h
View file @
273244a1
...
...
@@ -115,12 +115,7 @@ struct IO_ERROR // : std::exception
init
(
aThrowersFile
,
aThrowersLoc
,
wxString
(
aMsg
)
);
}
void
init
(
const
char
*
aThrowersFile
,
const
char
*
aThrowersLoc
,
const
wxString
&
aMsg
)
{
errorText
.
Printf
(
IO_FORMAT
,
aMsg
.
GetData
(),
wxString
::
FromUTF8
(
aThrowersFile
).
GetData
(),
wxString
::
FromUTF8
(
aThrowersLoc
).
GetData
()
);
}
void
init
(
const
char
*
aThrowersFile
,
const
char
*
aThrowersLoc
,
const
wxString
&
aMsg
);
IO_ERROR
()
{}
...
...
@@ -165,18 +160,7 @@ struct PARSE_ERROR : public IO_ERROR
void
init
(
const
char
*
aThrowersFile
,
const
char
*
aThrowersLoc
,
const
wxString
&
aMsg
,
const
wxString
&
aSource
,
const
char
*
aInputLine
,
int
aLineNumber
,
int
aByteIndex
)
{
// save inpuLine, lineNumber, and offset for UI (.e.g. Sweet text editor)
inputLine
=
aInputLine
;
lineNumber
=
aLineNumber
;
byteIndex
=
aByteIndex
;
errorText
.
Printf
(
PARSE_FORMAT
,
aMsg
.
GetData
(),
aSource
.
GetData
(),
aLineNumber
,
aByteIndex
,
wxString
::
FromUTF8
(
aThrowersFile
).
GetData
(),
wxString
::
FromUTF8
(
aThrowersLoc
).
GetData
()
);
}
int
aLineNumber
,
int
aByteIndex
);
~
PARSE_ERROR
()
throw
(
/*none*/
){}
};
...
...
pcbnew/dialogs/dialog_fp_lib_table.cpp
View file @
273244a1
This diff is collapsed.
Click to expand it.
pcbnew/dialogs/dialog_fp_lib_table_base.cpp
View file @
273244a1
...
...
@@ -34,7 +34,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
m_global_grid
=
new
wxGrid
(
m_global_panel
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
// Grid
m_global_grid
->
CreateGrid
(
1
,
4
);
m_global_grid
->
CreateGrid
(
1
,
5
);
m_global_grid
->
EnableEditing
(
true
);
m_global_grid
->
EnableGridLines
(
true
);
m_global_grid
->
EnableDragGridSize
(
true
);
...
...
@@ -70,7 +70,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
m_project_grid
=
new
wxGrid
(
m_project_panel
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
// Grid
m_project_grid
->
CreateGrid
(
1
,
4
);
m_project_grid
->
CreateGrid
(
1
,
5
);
m_project_grid
->
EnableEditing
(
true
);
m_project_grid
->
EnableGridLines
(
true
);
m_project_grid
->
EnableDragGridSize
(
true
);
...
...
@@ -142,7 +142,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
m_path_subs_grid
=
new
wxGrid
(
m_bottom
,
wxID_ANY
,
wxDefaultPosition
,
wxDefaultSize
,
0
);
// Grid
m_path_subs_grid
->
CreateGrid
(
2
,
2
);
m_path_subs_grid
->
CreateGrid
(
1
,
2
);
m_path_subs_grid
->
EnableEditing
(
true
);
m_path_subs_grid
->
EnableGridLines
(
true
);
m_path_subs_grid
->
EnableDragGridSize
(
false
);
...
...
@@ -155,15 +155,13 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
m_path_subs_grid
->
EnableDragColMove
(
false
);
m_path_subs_grid
->
EnableDragColSize
(
true
);
m_path_subs_grid
->
SetColLabelSize
(
30
);
m_path_subs_grid
->
SetColLabelValue
(
0
,
_
(
"
Category
"
)
);
m_path_subs_grid
->
SetColLabelValue
(
0
,
_
(
"
Environment Variable
"
)
);
m_path_subs_grid
->
SetColLabelValue
(
1
,
_
(
"Path Segment"
)
);
m_path_subs_grid
->
SetColLabelAlignment
(
wxALIGN_CENTRE
,
wxALIGN_CENTRE
);
// Rows
m_path_subs_grid
->
EnableDragRowSize
(
true
);
m_path_subs_grid
->
SetRowLabelSize
(
40
);
m_path_subs_grid
->
SetRowLabelValue
(
0
,
_
(
"%S"
)
);
m_path_subs_grid
->
SetRowLabelValue
(
1
,
_
(
"%P"
)
);
m_path_subs_grid
->
SetRowLabelAlignment
(
wxALIGN_CENTRE
,
wxALIGN_CENTRE
);
// Label Appearance
...
...
@@ -188,7 +186,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
m_bottom
->
SetSizer
(
m_bottom_sizer
);
m_bottom
->
Layout
();
m_bottom_sizer
->
Fit
(
m_bottom
);
m_splitter
->
SplitHorizontally
(
m_top
,
m_bottom
,
3
43
);
m_splitter
->
SplitHorizontally
(
m_top
,
m_bottom
,
3
98
);
bSizer1
->
Add
(
m_splitter
,
2
,
wxEXPAND
,
5
);
...
...
@@ -199,6 +197,14 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
// Connect Events
m_auinotebook
->
Connect
(
wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED
,
wxAuiNotebookEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
pageChangedHandler
),
NULL
,
this
);
m_global_grid
->
Connect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellLeftClick
),
NULL
,
this
);
m_global_grid
->
Connect
(
wxEVT_GRID_CELL_LEFT_DCLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellLeftDClick
),
NULL
,
this
);
m_global_grid
->
Connect
(
wxEVT_GRID_CELL_RIGHT_CLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellRightClick
),
NULL
,
this
);
m_global_grid
->
Connect
(
wxEVT_GRID_SELECT_CELL
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCmdSelectCell
),
NULL
,
this
);
m_project_grid
->
Connect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellLeftClick
),
NULL
,
this
);
m_project_grid
->
Connect
(
wxEVT_GRID_CELL_LEFT_DCLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellLeftDClick
),
NULL
,
this
);
m_project_grid
->
Connect
(
wxEVT_GRID_CELL_RIGHT_CLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellRightClick
),
NULL
,
this
);
m_project_grid
->
Connect
(
wxEVT_GRID_SELECT_CELL
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCmdSelectCell
),
NULL
,
this
);
m_append_button
->
Connect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
appendRowHandler
),
NULL
,
this
);
m_delete_button
->
Connect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
deleteRowHandler
),
NULL
,
this
);
m_move_up_button
->
Connect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
moveUpHandler
),
NULL
,
this
);
...
...
@@ -211,6 +217,14 @@ DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE()
{
// Disconnect Events
m_auinotebook
->
Disconnect
(
wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED
,
wxAuiNotebookEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
pageChangedHandler
),
NULL
,
this
);
m_global_grid
->
Disconnect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellLeftClick
),
NULL
,
this
);
m_global_grid
->
Disconnect
(
wxEVT_GRID_CELL_LEFT_DCLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellLeftDClick
),
NULL
,
this
);
m_global_grid
->
Disconnect
(
wxEVT_GRID_CELL_RIGHT_CLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellRightClick
),
NULL
,
this
);
m_global_grid
->
Disconnect
(
wxEVT_GRID_SELECT_CELL
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCmdSelectCell
),
NULL
,
this
);
m_project_grid
->
Disconnect
(
wxEVT_GRID_CELL_LEFT_CLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellLeftClick
),
NULL
,
this
);
m_project_grid
->
Disconnect
(
wxEVT_GRID_CELL_LEFT_DCLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellLeftDClick
),
NULL
,
this
);
m_project_grid
->
Disconnect
(
wxEVT_GRID_CELL_RIGHT_CLICK
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCellRightClick
),
NULL
,
this
);
m_project_grid
->
Disconnect
(
wxEVT_GRID_SELECT_CELL
,
wxGridEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
onGridCmdSelectCell
),
NULL
,
this
);
m_append_button
->
Disconnect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
appendRowHandler
),
NULL
,
this
);
m_delete_button
->
Disconnect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
deleteRowHandler
),
NULL
,
this
);
m_move_up_button
->
Disconnect
(
wxEVT_LEFT_DOWN
,
wxMouseEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
moveUpHandler
),
NULL
,
this
);
...
...
pcbnew/dialogs/dialog_fp_lib_table_base.fbp
View file @
273244a1
...
...
@@ -42,7 +42,7 @@
<property
name=
"minimum_size"
></property>
<property
name=
"name"
>
DIALOG_FP_LIB_TABLE_BASE
</property>
<property
name=
"pos"
></property>
<property
name=
"size"
>
864
,652
</property>
<property
name=
"size"
>
996
,652
</property>
<property
name=
"style"
>
wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER
</property>
<property
name=
"subclass"
>
DIALOG_SHIM; dialog_shim.h
</property>
<property
name=
"title"
>
PCB Library Tables
</property>
...
...
@@ -140,7 +140,7 @@
<property
name=
"pos"
></property>
<property
name=
"resize"
>
Resizable
</property>
<property
name=
"sashgravity"
>
0.0
</property>
<property
name=
"sashpos"
>
3
43
</property>
<property
name=
"sashpos"
>
3
98
</property>
<property
name=
"sashsize"
>
-1
</property>
<property
name=
"show"
>
1
</property>
<property
name=
"size"
></property>
...
...
@@ -464,7 +464,7 @@
<property
name=
"col_label_size"
>
30
</property>
<property
name=
"col_label_values"
></property>
<property
name=
"col_label_vert_alignment"
>
wxALIGN_CENTRE
</property>
<property
name=
"cols"
>
4
</property>
<property
name=
"cols"
>
5
</property>
<property
name=
"column_sizes"
></property>
<property
name=
"context_help"
></property>
<property
name=
"context_menu"
>
1
</property>
...
...
@@ -524,9 +524,9 @@
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
<event
name=
"OnGridCellChange"
></event>
<event
name=
"OnGridCellLeftClick"
></event>
<event
name=
"OnGridCellLeftDClick"
></event>
<event
name=
"OnGridCellRightClick"
></event>
<event
name=
"OnGridCellLeftClick"
>
onGridCellLeftClick
</event>
<event
name=
"OnGridCellLeftDClick"
>
onGridCellLeftDClick
</event>
<event
name=
"OnGridCellRightClick"
>
onGridCellRightClick
</event>
<event
name=
"OnGridCellRightDClick"
></event>
<event
name=
"OnGridCmdCellChange"
></event>
<event
name=
"OnGridCmdCellLeftClick"
></event>
...
...
@@ -543,7 +543,7 @@
<event
name=
"OnGridCmdLabelRightDClick"
></event>
<event
name=
"OnGridCmdRangeSelect"
></event>
<event
name=
"OnGridCmdRowSize"
></event>
<event
name=
"OnGridCmdSelectCell"
></event>
<event
name=
"OnGridCmdSelectCell"
>
onGridCmdSelectCell
</event>
<event
name=
"OnGridColSize"
></event>
<event
name=
"OnGridEditorCreated"
></event>
<event
name=
"OnGridEditorHidden"
></event>
...
...
@@ -693,7 +693,7 @@
<property
name=
"col_label_size"
>
30
</property>
<property
name=
"col_label_values"
></property>
<property
name=
"col_label_vert_alignment"
>
wxALIGN_CENTRE
</property>
<property
name=
"cols"
>
4
</property>
<property
name=
"cols"
>
5
</property>
<property
name=
"column_sizes"
></property>
<property
name=
"context_help"
></property>
<property
name=
"context_menu"
>
1
</property>
...
...
@@ -753,9 +753,9 @@
<event
name=
"OnEnterWindow"
></event>
<event
name=
"OnEraseBackground"
></event>
<event
name=
"OnGridCellChange"
></event>
<event
name=
"OnGridCellLeftClick"
></event>
<event
name=
"OnGridCellLeftDClick"
></event>
<event
name=
"OnGridCellRightClick"
></event>
<event
name=
"OnGridCellLeftClick"
>
onGridCellLeftClick
</event>
<event
name=
"OnGridCellLeftDClick"
>
onGridCellLeftDClick
</event>
<event
name=
"OnGridCellRightClick"
>
onGridCellRightClick
</event>
<event
name=
"OnGridCellRightDClick"
></event>
<event
name=
"OnGridCmdCellChange"
></event>
<event
name=
"OnGridCmdCellLeftClick"
></event>
...
...
@@ -772,7 +772,7 @@
<event
name=
"OnGridCmdLabelRightDClick"
></event>
<event
name=
"OnGridCmdRangeSelect"
></event>
<event
name=
"OnGridCmdRowSize"
></event>
<event
name=
"OnGridCmdSelectCell"
></event>
<event
name=
"OnGridCmdSelectCell"
>
onGridCmdSelectCell
</event>
<event
name=
"OnGridColSize"
></event>
<event
name=
"OnGridEditorCreated"
></event>
<event
name=
"OnGridEditorHidden"
></event>
...
...
@@ -1297,7 +1297,7 @@
<property
name=
"close_button"
>
1
</property>
<property
name=
"col_label_horiz_alignment"
>
wxALIGN_CENTRE
</property>
<property
name=
"col_label_size"
>
30
</property>
<property
name=
"col_label_values"
>
"
Category
"
"
Path Segment
"
</property>
<property
name=
"col_label_values"
>
"
Environment Variable
"
"
Path Segment
"
</property>
<property
name=
"col_label_vert_alignment"
>
wxALIGN_CENTRE
</property>
<property
name=
"cols"
>
2
</property>
<property
name=
"column_sizes"
>
150,500
</property>
...
...
@@ -1343,10 +1343,10 @@
<property
name=
"resize"
>
Resizable
</property>
<property
name=
"row_label_horiz_alignment"
>
wxALIGN_CENTRE
</property>
<property
name=
"row_label_size"
>
40
</property>
<property
name=
"row_label_values"
>
"
%S
"
"
%P
"
</property>
<property
name=
"row_label_values"
></property>
<property
name=
"row_label_vert_alignment"
>
wxALIGN_CENTRE
</property>
<property
name=
"row_sizes"
></property>
<property
name=
"rows"
>
2
</property>
<property
name=
"rows"
>
1
</property>
<property
name=
"show"
>
1
</property>
<property
name=
"size"
></property>
<property
name=
"subclass"
></property>
...
...
pcbnew/dialogs/dialog_fp_lib_table_base.h
View file @
273244a1
...
...
@@ -61,6 +61,10 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
// Virtual event handlers, overide them in your derived class
virtual
void
pageChangedHandler
(
wxAuiNotebookEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
onGridCellLeftClick
(
wxGridEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
onGridCellLeftDClick
(
wxGridEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
onGridCellRightClick
(
wxGridEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
onGridCmdSelectCell
(
wxGridEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
appendRowHandler
(
wxMouseEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
deleteRowHandler
(
wxMouseEvent
&
event
)
{
event
.
Skip
();
}
virtual
void
moveUpHandler
(
wxMouseEvent
&
event
)
{
event
.
Skip
();
}
...
...
@@ -71,12 +75,12 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
public
:
DIALOG_FP_LIB_TABLE_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"PCB Library Tables"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
864
,
652
),
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
DIALOG_FP_LIB_TABLE_BASE
(
wxWindow
*
parent
,
wxWindowID
id
=
wxID_ANY
,
const
wxString
&
title
=
_
(
"PCB Library Tables"
),
const
wxPoint
&
pos
=
wxDefaultPosition
,
const
wxSize
&
size
=
wxSize
(
996
,
652
),
long
style
=
wxDEFAULT_DIALOG_STYLE
|
wxRESIZE_BORDER
);
~
DIALOG_FP_LIB_TABLE_BASE
();
void
m_splitterOnIdle
(
wxIdleEvent
&
)
{
m_splitter
->
SetSashPosition
(
3
43
);
m_splitter
->
SetSashPosition
(
3
98
);
m_splitter
->
Disconnect
(
wxEVT_IDLE
,
wxIdleEventHandler
(
DIALOG_FP_LIB_TABLE_BASE
::
m_splitterOnIdle
),
NULL
,
this
);
}
...
...
pcbnew/io_mgr.h
View file @
273244a1
...
...
@@ -53,6 +53,7 @@ public:
EAGLE
,
PCAD
,
GEDA_PCB
,
//< Geda PCB file formats.
// add your type here.
// ALTIUM,
...
...
pcbnew/pcb_plot_params.h
View file @
273244a1
...
...
@@ -188,13 +188,13 @@ public:
bool
operator
==
(
const
PCB_PLOT_PARAMS
&
aPcbPlotParams
)
const
;
bool
operator
!=
(
const
PCB_PLOT_PARAMS
&
aPcbPlotParams
)
const
;
void
SetColor
(
EDA_COLOR_T
aVal
)
{
m_color
=
aVal
;
}
void
SetColor
(
EDA_COLOR_T
aVal
)
{
m_color
=
aVal
;
}
EDA_COLOR_T
GetColor
()
const
{
return
m_color
;
}
void
SetReferenceColor
(
EDA_COLOR_T
aVal
)
{
m_referenceColor
=
aVal
;
}
void
SetReferenceColor
(
EDA_COLOR_T
aVal
)
{
m_referenceColor
=
aVal
;
}
EDA_COLOR_T
GetReferenceColor
()
const
{
return
m_referenceColor
;
}
void
SetValueColor
(
EDA_COLOR_T
aVal
)
{
m_valueColor
=
aVal
;
}
void
SetValueColor
(
EDA_COLOR_T
aVal
)
{
m_valueColor
=
aVal
;
}
EDA_COLOR_T
GetValueColor
()
const
{
return
m_valueColor
;
}
void
SetTextMode
(
PlotTextMode
aVal
)
{
m_textMode
=
aVal
;
}
...
...
@@ -292,5 +292,4 @@ public:
*/
extern
int
g_DrawDefaultLineThickness
;
#endif // PCB_PLOT_PARAMS_H_
pcbnew/pcbnew_config.cpp
View file @
273244a1
...
...
@@ -45,6 +45,8 @@
#include <class_board.h>
#include <fp_lib_table.h>
#include <fp_lib_table_lexer.h>
#include <pcbplot.h>
#include <pcbnew.h>
#include <pcbnew_id.h>
...
...
@@ -88,27 +90,66 @@ void PCB_EDIT_FRAME::Process_Config( wxCommandEvent& event )
FP_LIB_TABLE
gbl
;
FP_LIB_TABLE
prj
;
gbl
.
InsertRow
(
FP_LIB_TABLE
::
ROW
(
wxT
(
"passives"
),
wxT
(
"%G/passives"
),
wxT
(
"KiCad"
),
wxT
(
"speed=fast,purpose=testing"
)
)
);
gbl
.
InsertRow
(
FP_LIB_TABLE
::
ROW
(
wxT
(
"micros"
),
wxT
(
"%P/micros"
),
wxT
(
"Legacy"
),
wxT
(
"speed=fast,purpose=testing"
)
)
);
prj
.
InsertRow
(
FP_LIB_TABLE
::
ROW
(
wxT
(
"micros"
),
wxT
(
"%P/potato_chips"
),
wxT
(
"Eagle"
),
wxT
(
"speed=fast,purpose=testing"
)
)
);
FP_LIB_TABLE_LEXER
glex
(
"(fp_lib_table
\n
"
" (lib (name passives)(descr
\"
R/C Lib
\"
)(type KiCad)(uri ${KISYSMODS}/passives.pretty))
\n
"
" (lib (name micros)(descr
\"
Small stuff
\"
)(type Legacy)(uri ${KISYSMODS}/passives.mod)(options
\"
op1=2
\"
))
\n
"
" (lib (name chips)(descr
\"
Potatoe chips
\"
)(type Eagle)(uri /opt/eagle-6.2.0/lbr/con-amp-micromatch.lbr))
\n
"
")"
,
wxT
(
"gbl"
)
);
FP_LIB_TABLE_LEXER
plex
(
"(fp_lib_table
\n
"
" (lib (name passives)(descr
\"
Demo Lib
\"
)(type KiCad)(uri ${KIUSRMODS}/passives.pretty))
\n
"
" (lib (name micros)(descr
\"
Small stuff
\"
)(type Legacy)(uri ${KIUSRMODS}/micros.mod)(options
\"
op1=2
\"
))
\n
"
" (lib (name chips)(descr
\"
Potatoe chips
\"
)(type Eagle)(uri /opt/eagle-6.2.0/lbr/con-amp-micromatch.lbr))
\n
"
")"
,
wxT
(
"prj"
)
);
try
{
gbl
.
Parse
(
&
glex
);
prj
.
Parse
(
&
plex
);
}
/* PARSE_ERROR is an IO_ERROR, handle them the same for now.
catch( PARSE_ERROR pe )
{
DisplayError( this, pe.errorText );
break;
}
*/
catch
(
IO_ERROR
ioe
)
{
DisplayError
(
this
,
ioe
.
errorText
);
break
;
}
int
r
=
InvokePcbLibTableEditor
(
this
,
&
gbl
,
&
prj
);
if
(
r
&
1
)
{
#if defined(DEBUG)
printf
(
"changed global:
\n
"
);
STRING_FORMATTER
sf
;
gbl
.
Format
(
&
sf
,
0
);
printf
(
"%s
\n
"
,
sf
.
GetString
().
c_str
()
);
#endif
// save global table to disk and apply it
D
(
printf
(
"global has changed
\n
"
);)
}
if
(
r
&
2
)
{
#if defined(DEBUG)
printf
(
"changed project:
\n
"
);
STRING_FORMATTER
sf
;
prj
.
Format
(
&
sf
,
0
);
printf
(
"%s
\n
"
,
sf
.
GetString
().
c_str
()
);
#endif
// save project table to disk and apply it
D
(
printf
(
"project has changed
\n
"
);)
}
}
break
;
...
...
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