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
bd99012a
Commit
bd99012a
authored
Mar 02, 2011
by
Wayne Stambaugh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix load gerber file path bug, fixes lp:712104.
parent
85b8fc66
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
151 additions
and
106 deletions
+151
-106
files.cpp
gerbview/files.cpp
+29
-15
gerberframe.cpp
gerbview/gerberframe.cpp
+21
-0
wxGerberFrame.h
gerbview/wxGerberFrame.h
+101
-91
No files found.
gerbview/files.cpp
View file @
bd99012a
...
@@ -39,19 +39,19 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
...
@@ -39,19 +39,19 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
switch
(
id
)
switch
(
id
)
{
{
case
wxID_FILE
:
case
wxID_FILE
:
{
Erase_Current_Layer
(
false
);
Erase_Current_Layer
(
false
);
LoadGerberFiles
(
wxEmptyString
);
LoadGerberFiles
(
wxEmptyString
);
break
;
break
;
}
case
ID_MENU_INC_LAYER_AND_APPEND_FILE
:
case
ID_MENU_INC_LAYER_AND_APPEND_FILE
:
case
ID_INC_LAYER_AND_APPEND_FILE
:
case
ID_INC_LAYER_AND_APPEND_FILE
:
{
{
int
origLayer
=
getActiveLayer
();
int
origLayer
=
getNextAvailableLayer
();
if
(
origLayer
<
NB_LAYERS
)
if
(
origLayer
!=
NO_AVAILABLE_LAYERS
)
{
{
setActiveLayer
(
origLayer
+
1
);
setActiveLayer
(
origLayer
);
Erase_Current_Layer
(
false
);
Erase_Current_Layer
(
false
);
if
(
!
LoadGerberFiles
(
wxEmptyString
)
)
if
(
!
LoadGerberFiles
(
wxEmptyString
)
)
...
@@ -61,7 +61,7 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
...
@@ -61,7 +61,7 @@ void WinEDA_GerberFrame::Files_io( wxCommandEvent& event )
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
_
(
"GerbView only supports a maximum of %d layers. You must first \
msg
.
Printf
(
_
(
"GerbView only supports a maximum of %d layers. You must first \
delete
an existing layer to load any new layers."
),
NB_LAYERS
);
clear
an existing layer to load any new layers."
),
NB_LAYERS
);
wxMessageBox
(
msg
);
wxMessageBox
(
msg
);
}
}
}
}
...
@@ -96,7 +96,7 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
...
@@ -96,7 +96,7 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
wxFileName
filename
=
aFullFileName
;
wxFileName
filename
=
aFullFileName
;
wxString
currentPath
;
wxString
currentPath
;
if
(
!
filename
.
IsOk
()
)
if
(
!
filename
.
IsOk
()
)
{
{
/* Standard gerber filetypes
/* Standard gerber filetypes
* (See http://en.wikipedia.org/wiki/Gerber_File)
* (See http://en.wikipedia.org/wiki/Gerber_File)
...
@@ -144,7 +144,7 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
...
@@ -144,7 +144,7 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
if
(
dlg
.
ShowModal
()
==
wxID_CANCEL
)
if
(
dlg
.
ShowModal
()
==
wxID_CANCEL
)
return
false
;
return
false
;
dlg
.
Get
Filename
s
(
filenamesList
);
dlg
.
Get
Path
s
(
filenamesList
);
currentPath
=
wxGetCwd
();
currentPath
=
wxGetCwd
();
}
}
else
else
...
@@ -160,18 +160,32 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
...
@@ -160,18 +160,32 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
for
(
unsigned
ii
=
0
;
ii
<
filenamesList
.
GetCount
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
filenamesList
.
GetCount
();
ii
++
)
{
{
wxFileName
filename
=
filenamesList
[
ii
];
wxFileName
filename
=
filenamesList
[
ii
];
filename
.
SetPath
(
currentPath
);
if
(
!
filename
.
IsAbsolute
()
)
filename
.
SetPath
(
currentPath
);
if
(
!
filename
.
HasExt
()
)
filename
.
SetExt
(
g_PenFilenameExt
);
GetScreen
()
->
SetFileName
(
filename
.
GetFullPath
()
);
GetScreen
()
->
SetFileName
(
filename
.
GetFullPath
()
);
filename
.
SetExt
(
g_PenFilenameExt
);
setActiveLayer
(
layer
,
false
);
setActiveLayer
(
layer
,
false
);
if
(
Read_GERBER_File
(
GetScreen
()
->
GetFileName
(),
filename
.
GetFullPath
()
)
)
if
(
Read_GERBER_File
(
filename
.
GetFullPath
(),
filename
.
GetFullPath
()
)
)
{
{
SetLastProject
(
GetScreen
()
->
GetFileName
()
);
SetLastProject
(
GetScreen
()
->
GetFileName
()
);
layer
++
;
if
(
layer
>=
NB_LAYERS
)
layer
=
getNextAvailableLayer
(
layer
);
layer
=
0
;
if
(
layer
==
NO_AVAILABLE_LAYERS
)
{
wxString
msg
=
wxT
(
"No more empty layers are available. The remaining gerber "
);
msg
+=
wxT
(
"files will not be loaded."
);
wxMessageBox
(
msg
);
break
;
}
setActiveLayer
(
layer
,
false
);
}
}
}
}
...
@@ -179,7 +193,7 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
...
@@ -179,7 +193,7 @@ bool WinEDA_GerberFrame::LoadGerberFiles( const wxString& aFullFileName )
g_SaveTime
=
time
(
NULL
);
g_SaveTime
=
time
(
NULL
);
// Synchronize layers tools with actual active layer:
// Synchronize layers tools with actual active layer:
setActiveLayer
(
getActiveLayer
()
);
setActiveLayer
(
getActiveLayer
()
);
syncLayerBox
();
syncLayerBox
();
return
true
;
return
true
;
...
...
gerbview/gerberframe.cpp
View file @
bd99012a
...
@@ -404,6 +404,27 @@ void WinEDA_GerberFrame::SetElementVisibility( int aGERBER_VISIBLE, bool aNewSta
...
@@ -404,6 +404,27 @@ void WinEDA_GerberFrame::SetElementVisibility( int aGERBER_VISIBLE, bool aNewSta
}
}
int
WinEDA_GerberFrame
::
getNextAvailableLayer
(
int
aLayer
)
const
{
int
layer
=
aLayer
;
for
(
int
i
=
0
;
i
<
NB_LAYERS
;
i
++
)
{
GERBER_IMAGE
*
gerber
=
g_GERBER_List
[
layer
];
if
(
gerber
==
NULL
||
gerber
->
m_FileName
.
IsEmpty
()
)
return
layer
;
layer
++
;
if
(
layer
>=
NB_LAYERS
)
layer
=
0
;
}
return
NO_AVAILABLE_LAYERS
;
}
void
WinEDA_GerberFrame
::
syncLayerWidget
()
void
WinEDA_GerberFrame
::
syncLayerWidget
()
{
{
m_LayersManager
->
SelectLayer
(
getActiveLayer
()
);
m_LayersManager
->
SelectLayer
(
getActiveLayer
()
);
...
...
gerbview/wxGerberFrame.h
View file @
bd99012a
This diff is collapsed.
Click to expand it.
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