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
0a055c04
Commit
0a055c04
authored
Nov 18, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kicad: cleaned code
parent
1a139a7f
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
3433 additions
and
3956 deletions
+3433
-3956
kicad.mo
internat/fr/kicad.mo
+0
-0
kicad.po
internat/fr/kicad.po
+3180
-3183
CMakeLists.txt
kicad/CMakeLists.txt
+1
-0
buildmnu.cpp
kicad/buildmnu.cpp
+0
-4
commandframe.cpp
kicad/commandframe.cpp
+52
-27
kicad.cpp
kicad/kicad.cpp
+1
-318
kicad.h
kicad/kicad.h
+128
-142
mainframe.cpp
kicad/mainframe.cpp
+68
-126
treeprj_frame.cpp
kicad/treeprj_frame.cpp
+3
-5
zones_convert_brd_items_to_polygons.cpp
pcbnew/zones_convert_brd_items_to_polygons.cpp
+0
-151
No files found.
internat/fr/kicad.mo
View file @
0a055c04
No preview for this file type
internat/fr/kicad.po
View file @
0a055c04
This diff is collapsed.
Click to expand it.
kicad/CMakeLists.txt
View file @
0a055c04
...
...
@@ -9,6 +9,7 @@ set(KICAD_SRCS
commandframe.cpp
files-io.cpp
kicad.cpp
kicad-python.cpp
mainframe.cpp
preferences.cpp
prjconfig.cpp
...
...
kicad/buildmnu.cpp
View file @
0a055c04
...
...
@@ -19,12 +19,8 @@ BEGIN_EVENT_TABLE( WinEDA_MainFrame, WinEDA_BasicFrame )
/* Window events */
EVT_SIZE
(
WinEDA_MainFrame
::
OnSize
)
EVT_CLOSE
(
WinEDA_MainFrame
::
OnCloseWindow
)
#if !defined(KICAD_AUIMANAGER)
/* Sash drag events */
EVT_SASH_DRAGGED
(
ID_LEFT_FRAME
,
WinEDA_MainFrame
::
OnSashDrag
)
EVT_SASH_DRAGGED
(
ID_BOTTOM_FRAME
,
WinEDA_MainFrame
::
OnSashDrag
)
EVT_SASH_DRAGGED
(
ID_MAIN_COMMAND
,
WinEDA_MainFrame
::
OnSashDrag
)
#endif
/* Toolbar events */
EVT_TOOL
(
ID_NEW_PROJECT
,
WinEDA_MainFrame
::
OnLoadProject
)
EVT_TOOL
(
ID_LOAD_PROJECT
,
WinEDA_MainFrame
::
OnLoadProject
)
...
...
kicad/commandframe.cpp
View file @
0a055c04
...
...
@@ -9,29 +9,55 @@
#include "kicad.h"
RIGHT_KM_FRAME
::
RIGHT_KM_FRAME
(
WinEDA_MainFrame
*
parent
)
:
wxSashLayoutWindow
(
parent
,
wxID_ANY
)
{
m_Parent
=
parent
;
m_DialogWin
=
NULL
;
m_ButtPanel
=
new
wxPanel
(
this
,
wxID_ANY
);
m_ButtonSeparation
=
10
;
// control of command buttons position
m_ButtonLastPosition
.
x
=
20
;
// control of command buttons position
m_ButtonLastPosition
.
y
=
20
;
// control of command buttons position
m_ButtonsPanelHeight
=
(
m_ButtonLastPosition
.
y
*
2
)
+
32
;
CreateCommandToolbar
();
m_DialogWin
=
new
wxTextCtrl
(
this
,
wxID_ANY
,
wxEmptyString
,
wxDefaultPosition
,
wxDefaultSize
,
wxTE_MULTILINE
|
wxSUNKEN_BORDER
|
wxTE_READONLY
);
/************************************************************************************/
WinEDA_CommandFrame
::
WinEDA_CommandFrame
(
wxWindow
*
parent
,
int
id
,
wxPoint
pos
,
wxSize
size
,
long
style
)
:
wxSashLayoutWindow
(
parent
,
id
,
pos
,
size
,
style
)
/************************************************************************************/
};
/** WinEDA_CommandFrame constructor
* create the window which the buttons to call eeschema and others...
*/
void
RIGHT_KM_FRAME
::
OnSize
(
wxSizeEvent
&
event
)
{
SetDefaultSize
(
wxSize
(
size
.
x
,
100
)
);
SetOrientation
(
wxLAYOUT_HORIZONTAL
);
SetAlignment
(
wxLAYOUT_TOP
);
SetSashVisible
(
wxSASH_BOTTOM
,
TRUE
);
SetSashVisible
(
wxSASH_LEFT
,
TRUE
);
SetExtraBorderSize
(
2
);
CreateCommandToolbar
();
#define EXTRA_MARGE 4
wxSize
wsize
=
GetClientSize
();
wsize
.
x
-=
EXTRA_MARGE
;
wsize
.
y
-=
m_ButtonsPanelHeight
+
EXTRA_MARGE
;
wxPoint
wpos
;
wpos
.
x
=
EXTRA_MARGE
/
2
;
wpos
.
y
=
m_ButtonsPanelHeight
+
(
EXTRA_MARGE
/
2
);
if
(
m_DialogWin
)
{
m_DialogWin
->
SetSize
(
wsize
);
m_DialogWin
->
SetPosition
(
wpos
);
}
wpos
.
y
=
EXTRA_MARGE
/
2
;
m_ButtPanel
->
SetPosition
(
wpos
);
wsize
.
y
-=
m_ButtonsPanelHeight
-
EXTRA_MARGE
;
m_ButtPanel
->
SetSize
(
wsize
);
m_ButtPanel
->
Refresh
();
event
.
Skip
();
}
BEGIN_EVENT_TABLE
(
RIGHT_KM_FRAME
,
wxSashLayoutWindow
)
EVT_SIZE
(
RIGHT_KM_FRAME
::
OnSize
)
END_EVENT_TABLE
()
/*************************************************/
void
WinEDA_CommandFrame
::
CreateCommandToolbar
(
void
)
void
RIGHT_KM_FRAME
::
CreateCommandToolbar
(
void
)
/*************************************************/
/** Function CreateCommandToolbar
...
...
@@ -40,30 +66,28 @@ void WinEDA_CommandFrame::CreateCommandToolbar( void )
{
wxBitmapButton
*
btn
;
m_ButtonSeparation
=
10
;
m_ButtonLastPosition
.
x
=
20
;
m_ButtonLastPosition
.
y
=
20
;
wxWindow
*
parent
=
m_ButtPanel
;
btn
=
new
wxBitmapButton
(
this
,
ID_TO_EESCHEMA
,
wxBitmap
(
icon_eeschema_xpm
)
);
btn
=
new
wxBitmapButton
(
parent
,
ID_TO_EESCHEMA
,
wxBitmap
(
icon_eeschema_xpm
)
);
btn
->
SetToolTip
(
_
(
"EESchema (Schematic editor)"
)
);
AddFastLaunch
(
btn
);
btn
=
new
wxBitmapButton
(
this
,
ID_TO_CVPCB
,
wxBitmap
(
icon_cvpcb_xpm
)
);
btn
=
new
wxBitmapButton
(
parent
,
ID_TO_CVPCB
,
wxBitmap
(
icon_cvpcb_xpm
)
);
btn
->
SetToolTip
(
_
(
"CVpcb (Components to modules)"
)
);
AddFastLaunch
(
btn
);
btn
=
new
wxBitmapButton
(
this
,
ID_TO_PCB
,
wxBitmap
(
a_icon_pcbnew_xpm
)
);
btn
=
new
wxBitmapButton
(
parent
,
ID_TO_PCB
,
wxBitmap
(
a_icon_pcbnew_xpm
)
);
btn
->
SetToolTip
(
_
(
"PCBnew (PCB editor)"
)
);
AddFastLaunch
(
btn
);
btn
=
new
wxBitmapButton
(
this
,
ID_TO_GERBVIEW
,
wxBitmap
(
icon_gerbview_xpm
)
);
btn
=
new
wxBitmapButton
(
parent
,
ID_TO_GERBVIEW
,
wxBitmap
(
icon_gerbview_xpm
)
);
btn
->
SetToolTip
(
_
(
"GerbView (Gerber viewer)"
)
);
AddFastLaunch
(
btn
);
// Set up toolbar
#ifdef KICAD_PYTHON
btn
=
new
wxBitmapButton
(
this
,
ID_RUN_PYTHON
,
wxBitmap
(
icon_python_xpm
)
);
btn
=
new
wxBitmapButton
(
parent
,
ID_RUN_PYTHON
,
wxBitmap
(
icon_python_xpm
)
);
btn
->
SetToolTip
(
_
(
"Run Python Script"
)
);
AddFastLaunch
(
btn
);
#endif
...
...
@@ -71,11 +95,12 @@ void WinEDA_CommandFrame::CreateCommandToolbar( void )
/****************************************************************/
void
WinEDA_CommandFrame
::
AddFastLaunch
(
wxBitmapButton
*
button
)
void
RIGHT_KM_FRAME
::
AddFastLaunch
(
wxBitmapButton
*
button
)
/****************************************************************/
/** Function AddFastLaunch
* add a Bitmap Button (fast launch button) to the window
* @param button = wxBitmapButton to add to the window
* add a Bitmap Button (fast launch button) to the window
* @param button = wxBitmapButton to add to the window
*/
{
button
->
Move
(
m_ButtonLastPosition
);
...
...
kicad/kicad.cpp
View file @
0a055c04
...
...
@@ -28,6 +28,7 @@
#ifdef KICAD_PYTHON
#include <pyhandler.h>
using
namespace
boost
::
python
;
#endif
...
...
@@ -45,324 +46,6 @@ void ShowLogo( char* FonteFileName );
IMPLEMENT_APP
(
WinEDA_App
)
#ifdef KICAD_PYTHON
using
namespace
boost
::
python
;
/*****************************************************************************/
// Global functions:
/*****************************************************************************/
static
WinEDA_MainFrame
&
GetMainFrame
()
{
return
*
(
wxGetApp
().
m_MainFrame
);
}
static
void
WinEDAPrint
(
str
msg
)
{
GetMainFrame
().
PrintMsg
(
PyHandler
::
MakeStr
(
msg
)
+
wxT
(
"
\n
"
)
);
}
static
void
WinEDAClear
()
{
GetMainFrame
().
ClearMsg
();
}
static
object
GetTypeExt
(
enum
TreeFileType
type
)
{
return
PyHandler
::
Convert
(
WinEDA_PrjFrame
::
GetFileExt
(
type
)
);
}
/*****************************************************************************/
// WinEDA_MainFrame Special binding functions:
// (one line functions are simple wrappers)
/*****************************************************************************/
object
WinEDA_MainFrame
::
GetPrjName
()
const
{
return
PyHandler
::
Convert
(
m_PrjFileName
);
}
object
WinEDA_MainFrame
::
ToWx
()
{
return
object
(
handle
<>
(
borrowed
(
wxPyMake_wxObject
(
this
,
false
)
)
)
);
}
WinEDA_PrjFrame
*
WinEDA_MainFrame
::
GetTree
()
const
{
return
m_LeftWin
;
}
/**
* @brief TODO
*/
/*****************************************************************************/
void
WinEDA_MainFrame
::
AddFastLaunchPy
(
object
&
button
)
/*****************************************************************************/
{
wxBitmapButton
*
btn
;
bool
success
=
wxPyConvertSwigPtr
(
button
.
ptr
(),
(
void
**
)
&
btn
,
_T
(
"wxBitmapButton"
)
);
if
(
!
success
)
return
;
Py_INCREF
(
button
.
ptr
()
);
btn
->
Reparent
(
m_CommandWin
);
m_CommandWin
->
AddFastLaunch
(
btn
);
}
/*****************************************************************************/
// WinEDA_PrjFrame Special binding functions:
// (one line functions are simple wrappers)
/*****************************************************************************/
// TODO To WxWidgets ?
object
WinEDA_PrjFrame
::
ToWx
()
{
return
object
(
handle
<>
(
borrowed
(
wxPyMake_wxObject
(
this
,
false
)
)
)
);
}
// TODO Get ?
object
WinEDA_PrjFrame
::
GetFtExPy
(
enum
TreeFileType
type
)
const
{
return
PyHandler
::
Convert
(
GetFileExt
(
type
)
);
}
// Get python menu
object
WinEDA_PrjFrame
::
GetMenuPy
(
enum
TreeFileType
type
)
{
return
object
(
handle
<>
(
borrowed
(
wxPyMake_wxObject
(
GetContextMenu
(
(
int
)
type
),
false
)
)
)
);
}
// Get tree control
object
WinEDA_PrjFrame
::
GetTreeCtrl
()
{
return
object
(
handle
<>
(
borrowed
(
wxPyMake_wxObject
(
m_TreeProject
,
false
)
)
)
);
}
// Get current menu
object
WinEDA_PrjFrame
::
GetCurrentMenu
()
{
return
object
(
handle
<>
(
borrowed
(
wxPyMake_wxObject
(
m_PopupMenu
,
false
)
)
)
);
}
/**
* @brief TODO
*/
/*****************************************************************************/
void
WinEDA_PrjFrame
::
NewFilePy
(
const
str
&
name
,
enum
TreeFileType
type
,
object
&
id
)
/*****************************************************************************/
{
wxTreeItemId
root
;
if
(
!
wxPyConvertSwigPtr
(
id
.
ptr
(),
(
void
**
)
&
root
,
_T
(
"wxTreeItemId"
)
)
)
return
;
NewFile
(
PyHandler
::
MakeStr
(
name
),
type
,
root
);
}
/**
* @brief Add a file to the tree under root, or m_root if conversion is wrong
*/
/*****************************************************************************/
void
WinEDA_PrjFrame
::
AddFilePy
(
const
str
&
file
,
object
&
root
)
/*****************************************************************************/
{
wxTreeItemId
*
theroot
=
&
m_root
;
if
(
!
wxPyConvertSwigPtr
(
root
.
ptr
(),
(
void
**
)
&
root
,
_T
(
"wxTreeItemId"
)
)
)
{
theroot
=
&
m_root
;
}
AddFile
(
PyHandler
::
MakeStr
(
file
),
*
theroot
);
}
/**
* @brief convert wxTreeItem into TreePrjItemData
*/
/*****************************************************************************/
TreePrjItemData
*
WinEDA_PrjFrame
::
GetItemData
(
const
object
&
item
)
/*****************************************************************************/
{
wxTreeItemId
*
id
=
NULL
;
if
(
!
wxPyConvertSwigPtr
(
item
.
ptr
(),
(
void
**
)
&
id
,
_T
(
"wxTreeItemId"
)
)
)
{
return
NULL
;
}
return
dynamic_cast
<
TreePrjItemData
*>
(
m_TreeProject
->
GetItemData
(
*
id
)
);
}
/*****************************************************************************/
// TreePrjItemData Special binding functions
// (one line functions are simple wrappers)
/*****************************************************************************/
// Python rename
bool
TreePrjItemData
::
RenamePy
(
const
str
&
newname
,
bool
check
)
{
return
Rename
(
PyHandler
::
MakeStr
(
newname
),
check
);
}
// Get python directory
object
TreePrjItemData
::
GetDirPy
()
const
{
return
PyHandler
::
Convert
(
GetDir
()
);
}
// Get python filename
object
TreePrjItemData
::
GetFileNamePy
()
const
{
return
PyHandler
::
Convert
(
GetFileName
()
);
}
// Get python menu
object
TreePrjItemData
::
GetMenuPy
()
{
return
object
(
handle
<>
(
borrowed
(
wxPyMake_wxObject
(
&
m_fileMenu
,
false
)
)
)
);
}
/**
* @brief KiCad python module init, \n
* This function is called from PyHandler to init the kicad module
*/
/*****************************************************************************/
static
void
py_kicad_init
()
/*****************************************************************************/
{
def
(
"GetMainFrame"
,
&
GetMainFrame
,
return_value_policy
<
reference_existing_object
>
()
);
def
(
"GetTypeExtension"
,
&
GetTypeExt
);
class_
<
TreePrjItemData
>
(
"PrjItem"
)
// Internal data:
.
def
(
"GetFileName"
,
&
TreePrjItemData
::
GetFileNamePy
)
.
def
(
"GetDir"
,
&
TreePrjItemData
::
GetDirPy
)
.
def
(
"GetType"
,
&
TreePrjItemData
::
GetType
)
.
def
(
"GetId"
,
&
TreePrjItemData
::
GetIdPy
)
.
def
(
"GetMenu"
,
&
TreePrjItemData
::
GetMenuPy
)
// Item control
.
def
(
"SetState"
,
&
TreePrjItemData
::
SetState
)
.
def
(
"Rename"
,
&
TreePrjItemData
::
RenamePy
)
.
def
(
"Move"
,
&
TreePrjItemData
::
Move
)
.
def
(
"Delete"
,
&
TreePrjItemData
::
Delete
)
.
def
(
"Activate"
,
&
TreePrjItemData
::
Activate
)
;
enum_
<
TreeFileType
>
(
"FileType"
)
.
value
(
"PROJECT"
,
TREE_PROJECT
)
.
value
(
"SCHEMA"
,
TREE_SCHEMA
)
.
value
(
"BOARD"
,
TREE_PCB
)
.
value
(
"PYSCRIPT"
,
TREE_PY
)
.
value
(
"GERBER"
,
TREE_GERBER
)
.
value
(
"PDF"
,
TREE_PDF
)
.
value
(
"TXT"
,
TREE_TXT
)
.
value
(
"NETLIST"
,
TREE_NET
)
.
value
(
"UNKNOWN"
,
TREE_UNKNOWN
)
.
value
(
"DIRECTORY"
,
TREE_DIRECTORY
)
.
value
(
"MAX"
,
TREE_MAX
);
class_
<
WinEDA_PrjFrame
>
(
"TreeWindow"
)
// wx Interface
.
def
(
"ToWx"
,
&
WinEDA_PrjFrame
::
ToWx
)
// common features
.
def
(
"GetContextMenu"
,
&
WinEDA_PrjFrame
::
GetMenuPy
)
.
def
(
"GetFileExtension"
,
&
WinEDA_PrjFrame
::
GetFtExPy
)
// file filters control
.
def
(
"AddFilter"
,
&
WinEDA_PrjFrame
::
AddFilter
)
.
def
(
"ClearFilters"
,
&
WinEDA_PrjFrame
::
ClearFilters
)
.
def
(
"RemoveFilter"
,
&
WinEDA_PrjFrame
::
RemoveFilterPy
)
.
def
(
"GetFilters"
,
&
WinEDA_PrjFrame
::
GetFilters
,
return_value_policy
<
copy_const_reference
>
()
)
.
def
(
"GetCurrentMenu"
,
&
WinEDA_PrjFrame
::
GetCurrentMenu
)
/** Project tree control **/
// AddState
.
def
(
"AddState"
,
&
WinEDA_PrjFrame
::
AddStatePy
)
// GetTreeCtrl
.
def
(
"GetTreeCtrl"
,
&
WinEDA_PrjFrame
::
GetTreeCtrl
)
// GetItemData
.
def
(
"GetItemData"
,
&
WinEDA_PrjFrame
::
GetItemData
,
return_value_policy
<
reference_existing_object
>
()
)
// FindItemData
.
def
(
"FindItemData"
,
&
WinEDA_PrjFrame
::
FindItemData
,
return_value_policy
<
reference_existing_object
>
()
)
// NewFile
.
def
(
"NewFile"
,
&
WinEDA_PrjFrame
::
NewFilePy
)
// AddFile
.
def
(
"AddFile"
,
&
WinEDA_PrjFrame
::
AddFilePy
)
;
/* ENDOF class_<WinEDA_PrjFrame>( "TreeWindow" ) */
class_
<
WinEDA_MainFrame
>
(
"MainFrame"
)
// Wx interface
.
def
(
"ToWx"
,
&
WinEDA_MainFrame
::
ToWx
)
// Common controls
.
def
(
"AddFastLaunch"
,
&
WinEDA_MainFrame
::
AddFastLaunchPy
)
.
def
(
"Refresh"
,
&
WinEDA_MainFrame
::
OnRefreshPy
)
.
def
(
"GetProjectName"
,
&
WinEDA_MainFrame
::
GetPrjName
)
.
def
(
"GetProjectWindow"
,
&
WinEDA_MainFrame
::
GetTree
,
return_value_policy
<
reference_existing_object
>
()
);
}
/**
* @brief Common python module init
*/
/*****************************************************************************/
static
void
py_common_init
()
/*****************************************************************************/
{
def
(
"Print"
,
&
WinEDAPrint
);
def
(
"Clear"
,
&
WinEDAClear
);
}
#endif
/*****************************************************************************/
bool
WinEDA_App
::
OnInit
()
/*****************************************************************************/
...
...
kicad/kicad.h
View file @
0a055c04
This diff is collapsed.
Click to expand it.
kicad/mainframe.cpp
View file @
0a055c04
This diff is collapsed.
Click to expand it.
kicad/treeprj_frame.cpp
View file @
0a055c04
...
...
@@ -69,13 +69,11 @@ const wxString TextFileWildcard( wxT( "Text files (*.txt)|*.txt" ) );
* @brief TODO
*/
/******************************************************************/
WinEDA_PrjFrame
::
WinEDA_PrjFrame
(
WinEDA_MainFrame
*
parent
,
const
wxPoint
&
pos
,
const
wxSize
&
size
)
:
WinEDA_PrjFrame
::
WinEDA_PrjFrame
(
WinEDA_MainFrame
*
parent
)
:
wxSashLayoutWindow
(
parent
,
ID_LEFT_FRAME
,
pos
,
s
ize
,
wxDefaultPosition
,
wxDefaultS
ize
,
wxNO_BORDER
|
wxSW_3D
)
/******************************************************************/
{
...
...
pcbnew/zones_convert_brd_items_to_polygons.cpp
View file @
0a055c04
...
...
@@ -33,13 +33,8 @@
#include "PolyLine.h"
// Kbool 1.9 and before had sometimes problemes when calculating thermal shapes as polygons (this is the best solution)
// So as a workaround we can use stubs (small tracks segments) to create thermal shape
// Define USE_STUBS_FOR_THERMAL to work on this workaround
// Currently only for tests: DO NOT USE
// because the code is not really tested, pcbnew can do not work properly when used
// Kbool 2.0 has solved some problems, but not all
// Kbool 2.1 has solved some others problems, but not all
//define USE_STUBS_FOR_THERMAL
// Used to create data files to debug Kbool
#include "debug_kbool_key_file_fct.h"
...
...
@@ -67,14 +62,6 @@ void CreateThermalReliefPadPolygon( std::vector<CPolyPt>& aCornerBuffer,
// Local Functions:
#ifdef USE_STUBS_FOR_THERMAL
#warning \
USE_STUBS_FOR_THERMAL is defined: for test version only do not use for working pcbnew version
void
CreateStubsForThermalShapes
(
BOARD
*
aPcb
,
ZONE_CONTAINER
*
aZone_container
,
int
aThermalGap
,
int
aCopperThickness
,
int
aMinThicknessValue
);
#endif
void
AddTrackWithClearancePolygon
(
Bool_Engine
*
aBooleng
,
TRACK
&
aTrack
,
int
aClearanceValue
);
void
AddPadWithClearancePolygon
(
Bool_Engine
*
aBooleng
,
D_PAD
&
aPad
,
int
aClearanceValue
);
...
...
@@ -251,15 +238,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
}
int
gap
=
zone_clearance
;
#ifdef USE_STUBS_FOR_THERMAL
gap
=
MAX
(
zone_clearance
,
m_ThermalReliefGapValue
);
#else
if
(
(
m_PadOption
==
PAD_NOT_IN_ZONE
)
||
(
GetNet
()
==
0
)
||
pad
->
m_PadShape
==
PAD_TRAPEZOID
)
// PAD_TRAPEZOID shapes are not in zones because they are used in microwave apps
// and i think it is good that shapes are not changed by thermal pads or others
#endif
{
item_boundingbox
=
pad
->
GetBoundingBox
();
if
(
item_boundingbox
.
Intersects
(
zone_boundingbox
)
)
...
...
@@ -375,28 +358,6 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
CopyPolygonsFromBoolengineToFilledPolysList
(
booleng
);
}
delete
booleng
;
#ifdef USE_STUBS_FOR_THERMAL
// remove thermal gaps if required:
if
(
m_PadOption
!=
THERMAL_PAD
||
aPcb
->
m_Modules
==
NULL
)
{
Test_For_Copper_Island_And_Remove_Insulated_Islands
(
aPcb
);
return
;
}
#ifdef CREATE_KBOOL_KEY_FILES
CreateKeyFileKeyFile
();
OpenKeyFileEntity
(
"Layer"
);
CopyPolygonsFromFilledPolysListToKeyFile
(
this
,
0
);
#endif
CreateStubsForThermalShapes
(
aPcb
,
this
,
m_ThermalReliefGapValue
,
m_ThermalReliefCopperBridgeValue
,
m_ZoneMinThickness
);
Test_For_Copper_Island_And_Remove_Insulated_Islands
(
aPcb
);
#ifdef CREATE_KBOOL_KEY_FILES
CloseKeyFileEntity
();
CloseKeyFile
();
#endif
#else
// Remove insulated islands:
if
(
GetNet
()
>
0
)
...
...
@@ -619,7 +580,6 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
delete
booleng
;
#endif // REMOVE_UNUSED_THERMAL_STUBS
#endif // USE_STUBS_FOR_THERMAL
}
...
...
@@ -654,117 +614,6 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
}
/** function CreateStubsForThermalShapes()
* Only for testing the thermal shapes by stubs purposes
* Do not use for working pcbnew versions
* This is just for kbool test only
*/
void
CreateStubsForThermalShapes
(
BOARD
*
aPcb
,
ZONE_CONTAINER
*
aZone_container
,
int
aThermalGap
,
int
aCopperThickness
,
int
aMinThicknessValue
)
{
EDA_Rect
zone_boundingbox
=
aZone_container
->
GetBoundingBox
();
bool
have_poly_to_add
=
false
;
Bool_Engine
*
booleng
=
new
Bool_Engine
();
ArmBoolEng
(
booleng
,
true
);
TRACK
dummy_track
(
aPcb
);
if
(
aCopperThickness
<=
aMinThicknessValue
)
return
;
for
(
MODULE
*
module
=
aPcb
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
for
(
D_PAD
*
pad
=
module
->
m_Pads
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
{
// check
if
(
!
pad
->
IsOnLayer
(
aZone_container
->
GetLayer
()
)
)
continue
;
if
(
pad
->
GetNet
()
!=
aZone_container
->
GetNet
()
)
continue
;
EDA_Rect
item_boundingbox
=
pad
->
GetBoundingBox
();
item_boundingbox
.
Inflate
(
aThermalGap
,
aThermalGap
);
if
(
!
(
item_boundingbox
.
Intersects
(
zone_boundingbox
)
)
)
continue
;
// test point
int
dx
=
(
pad
->
m_Size
.
x
/
2
)
+
aThermalGap
;
int
dy
=
(
pad
->
m_Size
.
y
/
2
)
+
aThermalGap
;
// This is CIRCLE pad tweak (for circle pads the thermal stubs are at 45 deg)
int
fAngle
=
pad
->
m_Orient
;
if
(
pad
->
m_PadShape
==
PAD_CIRCLE
)
{
dx
=
(
int
)
(
dx
*
s_Correction
);
dy
=
dx
;
fAngle
=
450
;
}
// compute north, south, west and east points for zone connection.
// Add a small value to ensure point is inside (or outside) zone, not on an edge
wxPoint
ptTest
[
4
];
ptTest
[
0
]
=
wxPoint
(
0
,
3
+
dy
+
aMinThicknessValue
/
2
);
ptTest
[
1
]
=
wxPoint
(
0
,
-
(
3
+
dy
+
aMinThicknessValue
/
2
)
);
ptTest
[
2
]
=
wxPoint
(
3
+
dx
+
aMinThicknessValue
/
2
,
0
);
ptTest
[
3
]
=
wxPoint
(
-
(
3
+
dx
+
aMinThicknessValue
/
2
),
0
);
// Test all sides
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
// rotate point
RotatePoint
(
&
ptTest
[
i
],
fAngle
);
// translate point
ptTest
[
i
]
+=
pad
->
ReturnShapePos
();
bool
inside
=
aZone_container
->
HitTestFilledArea
(
ptTest
[
i
]
);
if
(
inside
)
{
dummy_track
.
m_Start
=
pad
->
ReturnShapePos
();
dummy_track
.
m_End
=
ptTest
[
i
];
dummy_track
.
SetNet
(
aZone_container
->
GetNet
()
);
dummy_track
.
SetLayer
(
aZone_container
->
GetLayer
()
);
dummy_track
.
m_Width
=
aCopperThickness
;
dummy_track
.
SetState
(
BEGIN_ONPAD
,
ON
);
dummy_track
.
start
=
pad
;
// add stub
WinEDA_PcbFrame
*
pcbFrame
=
(
WinEDA_PcbFrame
*
)
aPcb
->
m_PcbFrame
;
if
(
pcbFrame
->
GetDrcController
()
->
Drc
(
&
dummy_track
,
aPcb
->
m_Track
)
==
OK_DRC
)
{
have_poly_to_add
=
true
;
// because stubs outlines are drawn with a pen size = aMinThicknessValue,
// the width of the stub is aCopperThickness - aMinThicknessValue
int
thickness
=
dummy_track
.
m_Width
-
aMinThicknessValue
;
AddRoundedEndsSegmentPolygon
(
booleng
,
dummy_track
.
m_Start
,
dummy_track
.
m_End
,
thickness
);
}
}
}
}
}
if
(
have_poly_to_add
)
{
/* Add the main corrected polygon (i.e. the filled area using only one outline)
* in GroupA in Bool_Engine
*/
aZone_container
->
CopyPolygonsFromFilledPolysListToBoolengine
(
booleng
,
GROUP_A
);
/* remove thermal areas (non copper areas) */
booleng
->
Do_Operation
(
BOOL_OR
);
/* put these areas in m_FilledPolysList */
aZone_container
->
m_FilledPolysList
.
clear
();
aZone_container
->
CopyPolygonsFromBoolengineToFilledPolysList
(
booleng
);
}
delete
booleng
;
}
/** function AddThermalReliefPadPolygon
* Add holes around a pad to create a thermal relief
...
...
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