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
da678809
Commit
da678809
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DXF files import is supported by module editor.
parent
b2a60175
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
94 additions
and
4 deletions
+94
-4
edit.cpp
pcbnew/edit.cpp
+1
-1
dialog_dxf_import.cpp
pcbnew/import_dxf/dialog_dxf_import.cpp
+68
-2
invoke_pcb_dialog.h
pcbnew/invoke_pcb_dialog.h
+11
-1
menubar_modedit.cpp
pcbnew/menubar_modedit.cpp
+7
-0
modedit.cpp
pcbnew/modedit.cpp
+6
-0
moduleframe.cpp
pcbnew/moduleframe.cpp
+1
-0
No files found.
pcbnew/edit.cpp
View file @
da678809
...
@@ -1213,7 +1213,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -1213,7 +1213,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break
;
break
;
case
ID_GEN_IMPORT_DXF_FILE
:
case
ID_GEN_IMPORT_DXF_FILE
:
InvokeDXFDialogImport
(
this
);
InvokeDXFDialog
Board
Import
(
this
);
m_canvas
->
Refresh
();
m_canvas
->
Refresh
();
break
;
break
;
...
...
pcbnew/import_dxf/dialog_dxf_import.cpp
View file @
da678809
...
@@ -35,7 +35,12 @@
...
@@ -35,7 +35,12 @@
#include <dialog_dxf_import_base.h>
#include <dialog_dxf_import_base.h>
#include <class_pcb_layer_box_selector.h>
#include <class_pcb_layer_box_selector.h>
#include <class_draw_panel_gal.h>
#include <class_draw_panel_gal.h>
#include <class_board.h>
#include <class_board.h>
#include <class_module.h>
#include <class_edge_mod.h>
#include <class_text_mod.h>
#include <class_pcb_text.h>
// Keys to store setup in config
// Keys to store setup in config
...
@@ -197,7 +202,7 @@ void DIALOG_DXF_IMPORT::OnOKClick( wxCommandEvent& event )
...
@@ -197,7 +202,7 @@ void DIALOG_DXF_IMPORT::OnOKClick( wxCommandEvent& event )
}
}
bool
InvokeDXFDialogImport
(
PCB_BASE_FRAME
*
aCaller
)
bool
InvokeDXFDialog
Board
Import
(
PCB_BASE_FRAME
*
aCaller
)
{
{
DIALOG_DXF_IMPORT
dlg
(
aCaller
);
DIALOG_DXF_IMPORT
dlg
(
aCaller
);
bool
success
=
(
dlg
.
ShowModal
()
==
wxID_OK
);
bool
success
=
(
dlg
.
ShowModal
()
==
wxID_OK
);
...
@@ -216,7 +221,6 @@ bool InvokeDXFDialogImport( PCB_BASE_FRAME* aCaller )
...
@@ -216,7 +221,6 @@ bool InvokeDXFDialogImport( PCB_BASE_FRAME* aCaller )
for
(
it
=
list
.
begin
(),
itEnd
=
list
.
end
();
it
!=
itEnd
;
++
it
)
for
(
it
=
list
.
begin
(),
itEnd
=
list
.
end
();
it
!=
itEnd
;
++
it
)
{
{
BOARD_ITEM
*
item
=
*
it
;
BOARD_ITEM
*
item
=
*
it
;
board
->
Add
(
item
);
board
->
Add
(
item
);
ITEM_PICKER
itemWrapper
(
item
,
UR_NEW
);
ITEM_PICKER
itemWrapper
(
item
,
UR_NEW
);
...
@@ -232,3 +236,65 @@ bool InvokeDXFDialogImport( PCB_BASE_FRAME* aCaller )
...
@@ -232,3 +236,65 @@ bool InvokeDXFDialogImport( PCB_BASE_FRAME* aCaller )
return
success
;
return
success
;
}
}
bool
InvokeDXFDialogModuleImport
(
PCB_BASE_FRAME
*
aCaller
,
MODULE
*
aModule
)
{
DIALOG_DXF_IMPORT
dlg
(
aCaller
);
bool
success
=
(
dlg
.
ShowModal
()
==
wxID_OK
);
if
(
success
)
{
// Prepare the undo list
const
std
::
list
<
BOARD_ITEM
*>&
list
=
dlg
.
GetImportedItems
();
PICKED_ITEMS_LIST
picklist
;
MODULE
*
module
=
aCaller
->
GetBoard
()
->
m_Modules
;
KIGFX
::
VIEW
*
view
=
aCaller
->
GetGalCanvas
()
->
GetView
();
aCaller
->
SaveCopyInUndoList
(
module
,
UR_MODEDIT
);
aCaller
->
OnModify
();
// Build the undo list & add items to the current view
std
::
list
<
BOARD_ITEM
*>::
const_iterator
it
,
itEnd
;
for
(
it
=
list
.
begin
(),
itEnd
=
list
.
end
();
it
!=
itEnd
;
++
it
)
{
BOARD_ITEM
*
item
=
*
it
;
BOARD_ITEM
*
converted
=
NULL
;
// Modules use different types for the same things,
// so we need to convert imported items to appropriate classes.
switch
(
item
->
Type
()
)
{
case
PCB_LINE_T
:
{
converted
=
new
EDGE_MODULE
(
module
);
*
static_cast
<
DRAWSEGMENT
*>
(
converted
)
=
*
static_cast
<
DRAWSEGMENT
*>
(
item
);
module
->
Add
(
converted
);
static_cast
<
EDGE_MODULE
*>
(
converted
)
->
SetLocalCoord
();
delete
item
;
break
;
}
case
PCB_TEXT_T
:
{
converted
=
new
TEXTE_MODULE
(
module
);
*
static_cast
<
TEXTE_PCB
*>
(
converted
)
=
*
static_cast
<
TEXTE_PCB
*>
(
item
);
module
->
Add
(
module
);
static_cast
<
TEXTE_MODULE
*>
(
converted
)
->
SetLocalCoord
();
delete
item
;
break
;
}
default
:
assert
(
false
);
// there is a type that is currently not handled here
break
;
}
if
(
aCaller
->
IsGalCanvasActive
()
)
view
->
Add
(
converted
);
}
}
return
success
;
}
pcbnew/invoke_pcb_dialog.h
View file @
da678809
...
@@ -50,6 +50,7 @@ class wxSize;
...
@@ -50,6 +50,7 @@ class wxSize;
class
wxString
;
class
wxString
;
class
BOARD
;
class
BOARD
;
class
MODULE
;
// Often this is not used in the prototypes, since wxFrame is good enough and would
// Often this is not used in the prototypes, since wxFrame is good enough and would
// represent maximum information hiding.
// represent maximum information hiding.
...
@@ -88,7 +89,16 @@ void InvokePluginOptionsEditor( wxTopLevelWindow* aCaller, const wxString& aNick
...
@@ -88,7 +89,16 @@ void InvokePluginOptionsEditor( wxTopLevelWindow* aCaller, const wxString& aNick
* @param aCaller is the wxTopLevelWindow which is invoking the dialog.
* @param aCaller is the wxTopLevelWindow which is invoking the dialog.
* @return true if the import was made.
* @return true if the import was made.
*/
*/
bool
InvokeDXFDialogImport
(
PCB_BASE_FRAME
*
aCaller
);
bool
InvokeDXFDialogBoardImport
(
PCB_BASE_FRAME
*
aCaller
);
/**
* Function InvokeDXFDialogModuleImport
* shows the modal DIALOG_DXF_IMPORT for importing a DXF file.to a module.
*
* @param aCaller is the wxTopLevelWindow which is invoking the dialog.
* @return true if the import was made.
*/
bool
InvokeDXFDialogModuleImport
(
PCB_BASE_FRAME
*
aCaller
,
MODULE
*
aModule
);
/**
/**
* Function InvokeLayerSetup
* Function InvokeLayerSetup
...
...
pcbnew/menubar_modedit.cpp
View file @
da678809
...
@@ -125,6 +125,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
...
@@ -125,6 +125,13 @@ void FOOTPRINT_EDIT_FRAME::ReCreateMenuBar()
_
(
"&Export Module"
),
_
(
"&Export Module"
),
_
(
"Save current loaded module into file"
),
_
(
"Save current loaded module into file"
),
KiBitmap
(
export_module_xpm
)
);
KiBitmap
(
export_module_xpm
)
);
// Import DXF File
AddMenuItem
(
fileMenu
,
ID_GEN_IMPORT_DXF_FILE
,
_
(
"&Import DXF File"
),
_
(
"Import a 2D Drawing DXF file to Pcbnew on the Drawings layer"
),
KiBitmap
(
import_xpm
)
);
fileMenu
->
AppendSeparator
();
fileMenu
->
AppendSeparator
();
// Print
// Print
...
...
pcbnew/modedit.cpp
View file @
da678809
...
@@ -39,6 +39,7 @@
...
@@ -39,6 +39,7 @@
#include <kicad_device_context.h>
#include <kicad_device_context.h>
#include <macros.h>
#include <macros.h>
#include <pcbcommon.h>
#include <pcbcommon.h>
#include <invoke_pcb_dialog.h>
#include <class_board.h>
#include <class_board.h>
#include <class_module.h>
#include <class_module.h>
...
@@ -777,6 +778,11 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
...
@@ -777,6 +778,11 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
HandleBlockEnd
(
&
dc
);
HandleBlockEnd
(
&
dc
);
break
;
break
;
case
ID_GEN_IMPORT_DXF_FILE
:
InvokeDXFDialogModuleImport
(
this
,
GetBoard
()
->
m_Modules
);
m_canvas
->
Refresh
();
break
;
default
:
default
:
DisplayError
(
this
,
DisplayError
(
this
,
wxT
(
"FOOTPRINT_EDIT_FRAME::Process_Special_Functions error"
)
);
wxT
(
"FOOTPRINT_EDIT_FRAME::Process_Special_Functions error"
)
);
...
...
pcbnew/moduleframe.cpp
View file @
da678809
...
@@ -92,6 +92,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
...
@@ -92,6 +92,7 @@ BEGIN_EVENT_TABLE( FOOTPRINT_EDIT_FRAME, PCB_BASE_FRAME )
EVT_TOOL
(
ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART
,
EVT_TOOL
(
ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART
,
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_SHEET_SET
,
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_SHEET_SET
,
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
ID_GEN_IMPORT_DXF_FILE
,
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_PRINT
,
FOOTPRINT_EDIT_FRAME
::
ToPrinter
)
EVT_TOOL
(
wxID_PRINT
,
FOOTPRINT_EDIT_FRAME
::
ToPrinter
)
EVT_TOOL
(
ID_MODEDIT_LOAD_MODULE
,
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_LOAD_MODULE
,
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_CHECK
,
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_CHECK
,
FOOTPRINT_EDIT_FRAME
::
Process_Special_Functions
)
...
...
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