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
0687921f
Commit
0687921f
authored
Oct 05, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gerbview: display now an error report after loading a gerber file.
parent
0f64b352
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
59 additions
and
61 deletions
+59
-61
dialog_load_error.cpp
common/dialog_load_error.cpp
+19
-3
gr_basic.cpp
common/gr_basic.cpp
+3
-1
class_GERBER.cpp
gerbview/class_GERBER.cpp
+2
-0
files.cpp
gerbview/files.cpp
+4
-12
gerberframe.cpp
gerbview/gerberframe.cpp
+0
-5
menubar.cpp
gerbview/menubar.cpp
+3
-15
readgerb.cpp
gerbview/readgerb.cpp
+13
-16
rs274d.cpp
gerbview/rs274d.cpp
+1
-1
rs274x.cpp
gerbview/rs274x.cpp
+4
-4
toolbars_gerber.cpp
gerbview/toolbars_gerber.cpp
+3
-4
dialog_load_error.h
include/dialog_load_error.h
+7
-0
No files found.
common/dialog_load_error.cpp
View file @
0687921f
...
...
@@ -23,13 +23,13 @@ void DIALOG_LOAD_ERROR::ListClear(void)
/** Function ListSet
* Add a list of items.
* @param
l
ist = a string containing items. Items are separated by '\n'
* @param
aL
ist = a string containing items. Items are separated by '\n'
*/
void
DIALOG_LOAD_ERROR
::
ListSet
(
const
wxString
&
l
ist
)
void
DIALOG_LOAD_ERROR
::
ListSet
(
const
wxString
&
aL
ist
)
{
wxArrayString
*
wxStringSplit
(
wxString
txt
,
wxChar
splitter
);
wxArrayString
*
strings_list
=
wxStringSplit
(
l
ist
,
wxChar
(
'\n'
)
);
wxArrayString
*
strings_list
=
wxStringSplit
(
aL
ist
,
wxChar
(
'\n'
)
);
m_htmlWindow
->
AppendToPage
(
wxT
(
"<ul>"
)
);
for
(
unsigned
ii
=
0
;
ii
<
strings_list
->
GetCount
();
ii
++
)
{
...
...
@@ -42,6 +42,22 @@ void DIALOG_LOAD_ERROR::ListSet(const wxString &list)
delete
strings_list
;
}
/** Function ListSet
* Add a list of items.
* @param aList = a wxArrayString containing items
*/
void
DIALOG_LOAD_ERROR
::
ListSet
(
const
wxArrayString
&
aList
)
{
m_htmlWindow
->
AppendToPage
(
wxT
(
"<ul>"
)
);
for
(
unsigned
ii
=
0
;
ii
<
aList
.
GetCount
();
ii
++
)
{
m_htmlWindow
->
AppendToPage
(
wxT
(
"<li>"
)
);
m_htmlWindow
->
AppendToPage
(
aList
.
Item
(
ii
)
);
m_htmlWindow
->
AppendToPage
(
wxT
(
"</li>"
)
);
}
m_htmlWindow
->
AppendToPage
(
wxT
(
"</ul>"
)
);
}
/** Function MessageSet
* Add a message (in bold) to message list.
* @param message = the message
...
...
common/gr_basic.cpp
View file @
0687921f
...
...
@@ -39,7 +39,7 @@
/* Definitions for enabling and disabling debugging features in gr_basic.cpp.
* Please remember to set these back to 0 before making
SVN
commits.
* Please remember to set these back to 0 before making
LAUNCHPAD
commits.
*/
#define DEBUG_DUMP_CLIP_ERROR_COORDS 0 // Set to 1 to dump clip algorithm errors.
#define DEBUG_DUMP_CLIP_COORDS 0 // Set to 1 to dump clipped coordinates.
...
...
@@ -834,6 +834,8 @@ void GRMixedLine( EDA_Rect* ClipBox,
/*
* Draw a mixed line, in screen (Pixels) space.
* Currently, draw a line (not a mixed line)
* Perhaps this function is not very useful.
*/
void
GRSMixedLine
(
EDA_Rect
*
ClipBox
,
wxDC
*
DC
,
...
...
gerbview/class_GERBER.cpp
View file @
0687921f
...
...
@@ -182,6 +182,8 @@ void GERBER::InitToolTable()
m_Aperture_List
[
count
]
->
m_Num_Dcode
=
count
+
FIRST_DCODE
;
m_Aperture_List
[
count
]
->
Clear_D_CODE_Data
();
}
m_aperture_macros
.
clear
();
}
/** function ReportMessage
...
...
gerbview/files.cpp
View file @
0687921f
...
...
@@ -17,6 +17,9 @@ static void LoadDCodeFile( WinEDA_GerberFrame* frame,
const
wxString
&
FullFileName
);
/* Load agerber file selected from history list on current layer
* Previous data is deleted
*/
void
WinEDA_GerberFrame
::
OnFileHistory
(
wxCommandEvent
&
event
)
{
wxString
fn
;
...
...
@@ -53,6 +56,7 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
if
(
origLayer
<
NB_LAYERS
)
{
setActiveLayer
(
origLayer
+
1
);
Erase_Current_Layer
(
false
);
if
(
!
LoadOneGerberFile
(
wxEmptyString
)
)
setActiveLayer
(
origLayer
);
...
...
@@ -69,10 +73,6 @@ delete an existing layer to load any new layers." ), NB_LAYERS );
}
break
;
case
ID_APPEND_FILE
:
LoadOneGerberFile
(
wxEmptyString
);
break
;
case
ID_NEW_BOARD
:
Clear_Pcb
(
true
);
Zoom_Automatique
(
false
);
...
...
@@ -87,14 +87,6 @@ delete an existing layer to load any new layers." ), NB_LAYERS );
LoadDCodeFile
(
this
,
wxEmptyString
);
break
;
case
ID_SAVE_BOARD
:
SaveGerberFile
(
GetScreen
()
->
m_FileName
);
break
;
case
ID_SAVE_BOARD_AS
:
SaveGerberFile
(
wxEmptyString
);
break
;
default
:
DisplayError
(
this
,
wxT
(
"File_io Internal Error"
)
);
break
;
...
...
gerbview/gerberframe.cpp
View file @
0687921f
...
...
@@ -32,20 +32,15 @@ BEGIN_EVENT_TABLE( WinEDA_GerberFrame, WinEDA_BasePcbFrame )
EVT_TOOL_RANGE
(
ID_ZOOM_IN
,
ID_ZOOM_PAGE
,
WinEDA_GerberFrame
::
OnZoom
)
EVT_TOOL
(
wxID_FILE
,
WinEDA_GerberFrame
::
Files_io
)
EVT_TOOL
(
ID_APPEND_FILE
,
WinEDA_GerberFrame
::
Files_io
)
EVT_TOOL
(
ID_INC_LAYER_AND_APPEND_FILE
,
WinEDA_GerberFrame
::
Files_io
)
EVT_TOOL
(
ID_GERBVIEW_LOAD_DRILL_FILE
,
WinEDA_GerberFrame
::
Files_io
)
EVT_TOOL
(
ID_GERBVIEW_LOAD_DCODE_FILE
,
WinEDA_GerberFrame
::
Files_io
)
EVT_TOOL
(
ID_NEW_BOARD
,
WinEDA_GerberFrame
::
Files_io
)
EVT_TOOL
(
ID_SAVE_BOARD
,
WinEDA_GerberFrame
::
Files_io
)
// Menu Files:
EVT_MENU
(
wxID_FILE
,
WinEDA_GerberFrame
::
Files_io
)
EVT_MENU
(
ID_APPEND_FILE
,
WinEDA_GerberFrame
::
Files_io
)
EVT_MENU
(
ID_MENU_INC_LAYER_AND_APPEND_FILE
,
WinEDA_GerberFrame
::
Files_io
)
EVT_MENU
(
ID_NEW_BOARD
,
WinEDA_GerberFrame
::
Files_io
)
EVT_MENU
(
ID_SAVE_BOARD
,
WinEDA_GerberFrame
::
Files_io
)
EVT_MENU
(
ID_SAVE_BOARD_AS
,
WinEDA_GerberFrame
::
Files_io
)
EVT_MENU
(
ID_GEN_PLOT
,
WinEDA_GerberFrame
::
ToPlotter
)
EVT_MENU
(
ID_GERBVIEW_EXPORT_TO_PCBNEW
,
WinEDA_GerberFrame
::
ExportDataInPcbnewFormat
)
...
...
gerbview/menubar.cpp
View file @
0687921f
...
...
@@ -31,11 +31,7 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
wxMenu
*
filesMenu
=
new
wxMenu
;
filesMenu
->
Append
(
wxID_FILE
,
_
(
"Load Gerber File"
),
_
(
"Load a new Gerber file on the current layer"
),
FALSE
);
filesMenu
->
Append
(
ID_APPEND_FILE
,
_
(
"Append Gerber File to Current Layer"
),
_
(
"Append a new Gerber file to the current layer"
),
_
(
"Load a new Gerber file on the current layer. Previous data will be deleted"
),
FALSE
);
filesMenu
->
Append
(
ID_MENU_INC_LAYER_AND_APPEND_FILE
,
...
...
@@ -45,26 +41,18 @@ void WinEDA_GerberFrame::ReCreateMenuBar( void )
filesMenu
->
Append
(
ID_GERBVIEW_LOAD_DCODE_FILE
,
_
(
"Load DCodes"
),
_
(
"Load D-Codes File"
),
FALSE
);
#if 0
#if 0
// TODO
filesMenu->Append( ID_GERBVIEW_LOAD_DRILL_FILE, _( "Load EXCELLON Drill File" ),
_( "Load excellon drill file" ), FALSE );
#endif
filesMenu
->
Append
(
ID_NEW_BOARD
,
_
(
"&Clear All"
),
_
(
"Clear all layers"
),
FALSE
);
_
(
"Clear all layers
. All data will be deleted
"
),
FALSE
);
filesMenu
->
AppendSeparator
();
filesMenu
->
Append
(
ID_GERBVIEW_EXPORT_TO_PCBNEW
,
_
(
"&Export to Pcbnew"
),
_
(
"Export data in pcbnew format"
),
FALSE
);
#if 0
filesMenu->AppendSeparator();
filesMenu->Append( ID_SAVE_BOARD, _( "&Save Layers" ),
_( "Save current layers (GERBER format)" ), FALSE );
filesMenu->Append( ID_SAVE_BOARD_AS, _( "Save Layers As..." ),
_( "Save current layers as.." ), FALSE );
#endif
filesMenu
->
AppendSeparator
();
...
...
gerbview/readgerb.cpp
View file @
0687921f
...
...
@@ -11,6 +11,7 @@
#include "pcbplot.h"
#include "protos.h"
#include "dialog_load_error.h"
/* Read a gerber file, RS274D or RS274X format.
*/
...
...
@@ -27,7 +28,6 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName,
char
*
text
;
int
layer
;
/* current layer used in gerbview */
GERBER
*
gerber
;
int
error
=
0
;
layer
=
GetScreen
()
->
m_Active_Layer
;
...
...
@@ -57,7 +57,6 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName,
if
(
path
!=
wxEmptyString
)
wxSetWorkingDirectory
(
path
);
wxBusyCursor
show_wait
;
SetLocaleTo_C_standard
();
while
(
TRUE
)
...
...
@@ -130,15 +129,11 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName,
if
(
gerber
->
m_CommandState
!=
ENTER_RS274X_CMD
)
{
gerber
->
m_CommandState
=
ENTER_RS274X_CMD
;
if
(
!
gerber
->
ReadRS274XCommand
(
this
,
line
,
text
)
)
{
error
++
;
}
gerber
->
ReadRS274XCommand
(
this
,
line
,
text
);
}
else
//Error
{
error
++
;
ReportMessage
(
wxT
(
"Expected RS274X Command"
)
)
;
gerber
->
m_CommandState
=
CMD_IDLE
;
text
++
;
}
...
...
@@ -146,25 +141,27 @@ bool WinEDA_GerberFrame::Read_GERBER_File( const wxString& GERBER_FullFileName,
default
:
text
++
;
error
++
;
msg
.
Printf
(
wxT
(
"Unexpected symbol <%c>"
),
*
text
);
ReportMessage
(
msg
);
break
;
}
}
}
fclose
(
gerber
->
m_Current_File
);
if
(
error
)
// Display errors list
if
(
m_Messages
.
size
()
>
0
)
{
msg
.
Printf
(
_
(
"%d errors while reading Gerber file [%s]"
),
error
,
GetChars
(
GERBER_FullFileName
)
);
DisplayError
(
this
,
msg
);
DIALOG_LOAD_ERROR
dlg
(
this
);
dlg
.
ListSet
(
m_Messages
);
dlg
.
ShowModal
(
);
}
fclose
(
gerber
->
m_Current_File
);
SetLocaleTo_Default
();
/* Init DCodes list and perhaps read a DCODES file,
* if the gerber file is only a RS274D file
(without any aperture
* information)
* if the gerber file is only a RS274D file
*
(i.e. without any aperture
information)
*/
if
(
!
gerber
->
m_Has_DCode
)
{
...
...
gerbview/rs274d.cpp
View file @
0687921f
...
...
@@ -975,7 +975,7 @@ bool GERBER::Execute_DCODE_Command( WinEDA_GerberFrame* frame, char*& text, int
break
;
default
:
msg
.
Printf
(
wxT
(
"
Execute_DCODE_
Command: interpol error (type %X)"
),
msg
.
Printf
(
wxT
(
"
RS274D: DCODE
Command: interpol error (type %X)"
),
m_Iterpolation
);
ReportMessage
(
msg
);
break
;
...
...
gerbview/rs274x.cpp
View file @
0687921f
...
...
@@ -296,7 +296,7 @@ bool GERBER::ExecuteRS274XCommand( int command,
case
STEP_AND_REPEAT
:
case
ROTATE
:
{
msg
.
Printf
(
_
(
"
Command <%c%c>
ignored by Gerbview"
),
msg
.
Printf
(
_
(
"
RS274X: Command
\"
%c%c
\"
ignored by Gerbview"
),
(
command
>>
8
)
&
0xFF
,
command
&
0xFF
);
ReportMessage
(
msg
);
}
...
...
@@ -531,7 +531,7 @@ bool GERBER::ExecuteRS274XCommand( int command,
APERTURE_MACRO
*
pam
=
FindApertureMacro
(
am_lookup
);
if
(
!
pam
)
{
msg
.
Printf
(
wxT
(
"aperture macro %s not found
\n
"
),
msg
.
Printf
(
wxT
(
"
RS274X:
aperture macro %s not found
\n
"
),
CONV_TO_UTF8
(
am_lookup
.
name
)
);
ReportMessage
(
msg
);
ok
=
false
;
...
...
@@ -676,7 +676,7 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ],
default
:
// @todo, there needs to be a way of reporting the line number
msg
.
Printf
(
wxT
(
"Invalid primitive id code %d
\n
"
),
prim
.
primitive_id
);
msg
.
Printf
(
wxT
(
"
RS274X:
Invalid primitive id code %d
\n
"
),
prim
.
primitive_id
);
ReportMessage
(
msg
);
return
false
;
}
...
...
@@ -702,7 +702,7 @@ bool GERBER::ReadApertureMacro( char buff[GERBER_BUFZ],
if
(
i
<
paramCount
)
{
// maybe some day we can throw an exception and track a line number
msg
.
Printf
(
wxT
(
"read macro descr type %d: read %d parameters, insufficient parameters
\n
"
),
msg
.
Printf
(
wxT
(
"
RS274X:
read macro descr type %d: read %d parameters, insufficient parameters
\n
"
),
prim
.
primitive_id
,
i
);
ReportMessage
(
msg
);
}
...
...
gerbview/toolbars_gerber.cpp
View file @
0687921f
...
...
@@ -42,16 +42,15 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
// Set up toolbar
m_HToolBar
->
AddTool
(
ID_NEW_BOARD
,
wxEmptyString
,
wxBitmap
(
new_xpm
),
_
(
"
New world
"
)
);
_
(
"
Erase all layers
"
)
);
m_HToolBar
->
AddTool
(
wxID_FILE
,
wxEmptyString
,
wxBitmap
(
open_xpm
),
_
(
"
Open existing Layer
"
)
);
_
(
"
Load a new Gerber file on the current layer. Previous data will be deleted
"
)
);
m_HToolBar
->
AddSeparator
();
m_HToolBar
->
AddTool
(
wxID_UNDO
,
wxEmptyString
,
wxBitmap
(
undelete_xpm
),
_
(
"Undelete"
)
);
...
...
@@ -59,7 +58,7 @@ void WinEDA_GerberFrame::ReCreateHToolbar( void )
m_HToolBar
->
AddSeparator
();
m_HToolBar
->
AddTool
(
wxID_PRINT
,
wxEmptyString
,
wxBitmap
(
print_button
),
_
(
"Print
world
"
)
);
_
(
"Print
layers
"
)
);
m_HToolBar
->
AddSeparator
();
msg
=
AddHotkeyName
(
_
(
"Zoom in"
),
s_Gerbview_Hokeys_Descr
,
HK_ZOOM_IN
);
...
...
include/dialog_load_error.h
View file @
0687921f
...
...
@@ -18,11 +18,18 @@ protected:
public
:
/** Constructor */
DIALOG_LOAD_ERROR
(
wxWindow
*
parent
);
/** Function ListSet
* Add a list of items.
* @param list = a string containing items. Items are separated by '\n'
*/
void
ListSet
(
const
wxString
&
list
);
/** Function ListSet
* Add a list of items.
* @param list = a wxArrayString containing items.
*/
void
ListSet
(
const
wxArrayString
&
list
);
void
ListClear
();
/** Function MessageSet
* Add a message (in bold) to message list.
...
...
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