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
820153c7
Commit
820153c7
authored
Jun 28, 2013
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gerbview: remove fully outdated code (about reading DCode files) and fix erroneous comments.
parent
ccbc4882
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
18 additions
and
219 deletions
+18
-219
dcode.cpp
gerbview/dcode.cpp
+0
-128
events_called_functions.cpp
gerbview/events_called_functions.cpp
+0
-1
files.cpp
gerbview/files.cpp
+0
-31
gerbview.cpp
gerbview/gerbview.cpp
+1
-2
gerbview_frame.h
gerbview/gerbview_frame.h
+11
-46
gerbview_id.h
gerbview/gerbview_id.h
+0
-1
menubar.cpp
gerbview/menubar.cpp
+0
-6
readgerb.cpp
gerbview/readgerb.cpp
+6
-4
No files found.
gerbview/dcode.cpp
View file @
820153c7
...
...
@@ -154,134 +154,6 @@ int D_CODE::GetShapeDim( GERBER_DRAW_ITEM* aParent )
}
int
GERBVIEW_FRAME
::
ReadDCodeDefinitionFile
(
const
wxString
&
D_Code_FullFileName
)
{
int
current_Dcode
,
ii
;
char
*
ptcar
;
int
dimH
,
dimV
,
drill
,
dummy
;
float
fdimH
,
fdimV
,
fdrill
;
char
c_type_outil
[
256
];
char
line
[
GERBER_BUFZ
];
wxString
msg
;
D_CODE
*
dcode
;
FILE
*
dest
;
LAYER_NUM
layer
=
getActiveLayer
();
int
type_outil
;
if
(
g_GERBER_List
[
layer
]
==
NULL
)
g_GERBER_List
[
layer
]
=
new
GERBER_IMAGE
(
this
,
layer
);
GERBER_IMAGE
*
gerber
=
g_GERBER_List
[
layer
];
/* Updating gerber scale: */
double
dcode_scale
=
IU_PER_MILS
;
// By uniting dCode = mil,
// internal unit = IU_PER_MILS
current_Dcode
=
0
;
if
(
D_Code_FullFileName
.
IsEmpty
()
)
return
0
;
dest
=
wxFopen
(
D_Code_FullFileName
,
wxT
(
"rt"
)
);
if
(
dest
==
0
)
{
msg
.
Printf
(
_
(
"File <%s> not found"
),
GetChars
(
D_Code_FullFileName
)
);
DisplayError
(
this
,
msg
,
10
);
return
-
1
;
}
gerber
->
InitToolTable
();
while
(
fgets
(
line
,
sizeof
(
line
)
-
1
,
dest
)
!=
NULL
)
{
if
(
*
line
==
';'
)
continue
;
if
(
strlen
(
line
)
<
10
)
continue
;
/* Skip blank line. */
dcode
=
NULL
;
current_Dcode
=
0
;
/* Determine of the type of file from D_Code. */
ptcar
=
line
;
ii
=
0
;
while
(
*
ptcar
)
if
(
*
(
ptcar
++
)
==
','
)
ii
++
;
if
(
ii
>=
6
)
/* value in mils */
{
sscanf
(
line
,
"%d,%d,%d,%d,%d,%d,%d"
,
&
ii
,
&
dimH
,
&
dimV
,
&
drill
,
&
dummy
,
&
dummy
,
&
type_outil
);
dimH
=
KiROUND
(
dimH
*
dcode_scale
);
dimV
=
KiROUND
(
dimV
*
dcode_scale
);
drill
=
KiROUND
(
drill
*
dcode_scale
);
if
(
ii
<
1
)
ii
=
1
;
current_Dcode
=
ii
-
1
+
FIRST_DCODE
;
}
else
/* Values in inches are converted to mils. */
{
fdrill
=
0
;
current_Dcode
=
0
;
sscanf
(
line
,
"%f,%f,%1s"
,
&
fdimV
,
&
fdimH
,
c_type_outil
);
ptcar
=
line
;
while
(
*
ptcar
)
{
if
(
*
ptcar
==
'D'
)
{
sscanf
(
ptcar
+
1
,
"%d,%f"
,
&
current_Dcode
,
&
fdrill
);
break
;
}
else
{
ptcar
++
;
}
}
dimH
=
KiROUND
(
fdimH
*
dcode_scale
*
1000
);
dimV
=
KiROUND
(
fdimV
*
dcode_scale
*
1000
);
drill
=
KiROUND
(
fdrill
*
dcode_scale
*
1000
);
if
(
strchr
(
"CLROP"
,
c_type_outil
[
0
]
)
)
{
type_outil
=
(
APERTURE_T
)
c_type_outil
[
0
];
}
else
{
fclose
(
dest
);
return
-
2
;
}
}
/* Update the list of d_codes if consistent. */
if
(
current_Dcode
<
FIRST_DCODE
)
continue
;
if
(
current_Dcode
>=
TOOLS_MAX_COUNT
)
continue
;
dcode
=
gerber
->
GetDCODE
(
current_Dcode
);
dcode
->
m_Size
.
x
=
dimH
;
dcode
->
m_Size
.
y
=
dimV
;
dcode
->
m_Shape
=
(
APERTURE_T
)
type_outil
;
dcode
->
m_Drill
.
x
=
dcode
->
m_Drill
.
y
=
drill
;
dcode
->
m_Defined
=
true
;
}
fclose
(
dest
);
return
1
;
}
void
GERBVIEW_FRAME
::
CopyDCodesSizeToItems
()
{
static
D_CODE
dummy
(
999
);
//Used if D_CODE not found in list
...
...
gerbview/events_called_functions.cpp
View file @
820153c7
...
...
@@ -29,7 +29,6 @@ BEGIN_EVENT_TABLE( GERBVIEW_FRAME, EDA_DRAW_FRAME )
EVT_TOOL
(
wxID_FILE
,
GERBVIEW_FRAME
::
Files_io
)
EVT_TOOL
(
ID_GERBVIEW_ERASE_ALL
,
GERBVIEW_FRAME
::
Files_io
)
EVT_TOOL
(
ID_GERBVIEW_LOAD_DRILL_FILE
,
GERBVIEW_FRAME
::
Files_io
)
EVT_TOOL
(
ID_GERBVIEW_LOAD_DCODE_FILE
,
GERBVIEW_FRAME
::
Files_io
)
EVT_TOOL
(
ID_NEW_BOARD
,
GERBVIEW_FRAME
::
Files_io
)
EVT_TOOL
(
ID_GERBVIEW_SET_PAGE_BORDER
,
GERBVIEW_FRAME
::
Process_Special_Functions
)
...
...
gerbview/files.cpp
View file @
820153c7
...
...
@@ -90,11 +90,6 @@ void GERBVIEW_FRAME::Files_io( wxCommandEvent& event )
m_canvas
->
Refresh
();
break
;
case
ID_GERBVIEW_LOAD_DCODE_FILE
:
LoadDCodeFile
(
wxEmptyString
);
m_canvas
->
Refresh
();
break
;
default
:
wxFAIL_MSG
(
wxT
(
"File_io: unexpected command id"
)
);
break
;
...
...
@@ -290,29 +285,3 @@ bool GERBVIEW_FRAME::LoadExcellonFiles( const wxString& aFullFileName )
return
true
;
}
bool
GERBVIEW_FRAME
::
LoadDCodeFile
(
const
wxString
&
aFullFileName
)
{
wxString
wildcard
;
wxFileName
fn
=
aFullFileName
;
if
(
!
fn
.
IsOk
()
)
{
wildcard
=
_
(
"Gerber DCODE files"
);
wildcard
+=
wxT
(
" "
)
+
AllFilesWildcard
;
fn
=
m_lastFileName
;
wxFileDialog
dlg
(
this
,
_
(
"Load GERBER DCODE File"
),
fn
.
GetPath
(),
fn
.
GetFullName
(),
wildcard
,
wxFD_OPEN
|
wxFD_FILE_MUST_EXIST
);
if
(
dlg
.
ShowModal
()
==
wxID_CANCEL
)
return
false
;
fn
=
dlg
.
GetPath
();
}
ReadDCodeDefinitionFile
(
fn
.
GetFullPath
()
);
CopyDCodesSizeToItems
();
return
true
;
}
gerbview/gerbview.cpp
View file @
820153c7
...
...
@@ -26,12 +26,11 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <fctsys.h>
#include <appl_wxstruct.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <gestfich.h>
//#include <gr_basic.h>
#include <gerbview.h>
#include <gerbview_id.h>
...
...
gerbview/gerbview_frame.h
View file @
820153c7
...
...
@@ -379,14 +379,14 @@ public:
/**
* Function ReFillLayerWidget
* changes out all the layers in m_Layers and may be called upon
* loading
a new BOARD
.
* loading
new gerber files
.
*/
void
ReFillLayerWidget
();
/**
* Function setActiveLayer
* will change the currently active layer to \a aLayer and also
* update the
PCB
_LAYER_WIDGET.
* update the
GERBER
_LAYER_WIDGET.
*/
void
setActiveLayer
(
LAYER_NUM
aLayer
,
bool
doLayerWidgetUpdate
=
true
);
...
...
@@ -412,7 +412,7 @@ public:
/**
* Function syncLayerWidget
* updates the currently "selected" layer within the
PCB
_LAYER_WIDGET.
* updates the currently "selected" layer within the
GERBER
_LAYER_WIDGET.
* The currently active layer is defined by the return value of getActiveLayer().
* <p>
* This function cannot be inline without including layer_widget.h in
...
...
@@ -453,10 +453,11 @@ public:
/**
* Load applications settings specific to the Pcbnew.
*
* This overrides the base class
PCB_BASE
_FRAME::LoadSettings() to
* This overrides the base class
EDA_DRAW
_FRAME::LoadSettings() to
* handle settings specific common to the PCB layout application. It
* calls down to the base class to load settings common to all PCB type
* drawing frames. Please put your application settings for Pcbnew here
* calls down to the base class to load settings common to all
* EDA_DRAW_FRAME type drawing frames.
* Please put your application settings for Pcbnew here
* to avoid having application settings loaded all over the place.
*/
virtual
void
LoadSettings
();
...
...
@@ -464,10 +465,10 @@ public:
/**
* Save applications settings common to PCB draw frame objects.
*
* This overrides the base class
PCB_BASE
_FRAME::SaveSettings() to
* save settings specific to the
PCB layout
application main window. It
* calls down to the base class to save settings common to all
PCB type
* drawing frames. Please put your application settings for
Pcbn
ew here
* This overrides the base class
EDA_DRAW
_FRAME::SaveSettings() to
* save settings specific to the
gerbview
application main window. It
* calls down to the base class to save settings common to all
* drawing frames. Please put your application settings for
Gerbvi
ew here
* to avoid having application settings saved all over the place.
*/
virtual
void
SaveSettings
();
...
...
@@ -638,42 +639,6 @@ public:
void
GeneralControl
(
wxDC
*
aDC
,
const
wxPoint
&
aPosition
,
int
aHotKey
=
0
);
/**
* Read a DCode file (not used with RX274X files , just with RS274D old files).
* Note: there is no standard for DCode file.
* Just read a file format created by early versions of Pcbnew.
* @return false if file not read (cancellation)
* true if OK
* @ aparm aFullFileName = name of file to load.
* if empty, or if the file does not exist, a file dialog is opened
*/
bool
LoadDCodeFile
(
const
wxString
&
aFullFileName
);
/**
* Function ReadDCodeDefinitionFile
* reads in a dcode file assuming ALSPCB file format with ';' indicating
* comments.
* <p>
* Format is like CSV but with optional ';' delineated comments:<br>
* tool, Horiz, Vert, drill, vitesse, acc. ,Type ; [DCODE (commentaire)]<br>
* ex: 1, 12, 12, 0, 0, 0, 3 ; D10
* <p>
* Format:<br>
* Ver, Hor, Type, Tool [,Drill]<br>
* example: 0.012, 0.012, L , D10<br>
*
* Load all found dcodes into a table of D_CODE instantiations.
* @param D_Code_FullFileName The name of the file to read from.
* @return int - <br>
* -1 = file not found<br>
* -2 = parsing problem<br>
* 0 = the \a D_Code_FullFileName is empty, no reading
* is done but an empty GERBER is put into
* g_GERBER_List[]<br>
* 1 = read OK<br>
*/
int
ReadDCodeDefinitionFile
(
const
wxString
&
D_Code_FullFileName
);
/**
* Set Size Items (Lines, Flashes) from DCodes List
*/
...
...
gerbview/gerbview_id.h
View file @
820153c7
...
...
@@ -17,7 +17,6 @@ enum gerbview_ids
ID_GERBVIEW_SHOW_LIST_DCODES
,
ID_GERBVIEW_LOAD_DRILL_FILE
,
ID_GERBVIEW_LOAD_DCODE_FILE
,
ID_GERBVIEW_ERASE_ALL
,
ID_TOOLBARH_GERBER_SELECT_ACTIVE_DCODE
,
ID_GERBVIEW_SHOW_SOURCE
,
...
...
gerbview/menubar.cpp
View file @
820153c7
...
...
@@ -71,12 +71,6 @@ void GERBVIEW_FRAME::ReCreateMenuBar( void )
_
(
"Load excellon drill file"
),
KiBitmap
(
gerbview_drill_file_xpm
)
);
// Dcodes
AddMenuItem
(
fileMenu
,
ID_GERBVIEW_LOAD_DCODE_FILE
,
_
(
"Load &DCodes"
),
_
(
"Load D-Codes definition file"
),
KiBitmap
(
gerber_open_dcode_file_xpm
)
);
// Recent gerber files
static
wxMenu
*
openRecentGbrMenu
;
...
...
gerbview/readgerb.cpp
View file @
820153c7
...
...
@@ -162,13 +162,15 @@ bool GERBVIEW_FRAME::Read_GERBER_File( const wxString& GERBER_FullFileName,
dlg
.
ShowModal
();
}
/* Init DCodes list and perhaps read a DCODES file,
* if the gerber file is only a RS274D file
* (i.e. without any aperture information)
/* if the gerber file is only a RS274D file
* (i.e. without any aperture information), wran the user:
*/
if
(
!
gerber
->
m_Has_DCode
)
{
return
LoadDCodeFile
(
D_Code_FullFileName
);
msg
=
_
(
"Warning: this file has no D-Code definition
\n
"
"It is perhaps an old RS274D file
\n
"
"Therefore the size of items is undefined"
);
wxMessageBox
(
msg
);
}
return
true
;
...
...
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