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
1a139a7f
Commit
1a139a7f
authored
Nov 18, 2009
by
stambaughw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More comment translation and capitalization fixes.
parent
0acb404f
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
2014 additions
and
2104 deletions
+2014
-2104
menubarmodedit.cpp
pcbnew/menubarmodedit.cpp
+71
-77
menubarpcb.cpp
pcbnew/menubarpcb.cpp
+18
-24
mirepcb.cpp
pcbnew/mirepcb.cpp
+54
-62
modedit.cpp
pcbnew/modedit.cpp
+72
-90
modedit_onclick.cpp
pcbnew/modedit_onclick.cpp
+53
-48
modeditoptions.cpp
pcbnew/modeditoptions.cpp
+66
-74
moduleframe.cpp
pcbnew/moduleframe.cpp
+175
-173
modules.cpp
pcbnew/modules.cpp
+114
-145
move-drag_pads.cpp
pcbnew/move-drag_pads.cpp
+46
-71
move_or_drag_track.cpp
pcbnew/move_or_drag_track.cpp
+226
-188
muonde.cpp
pcbnew/muonde.cpp
+270
-299
muwave_command.cpp
pcbnew/muwave_command.cpp
+86
-91
netlist.cpp
pcbnew/netlist.cpp
+193
-183
pcbframe.cpp
pcbnew/pcbframe.cpp
+206
-211
pcbnew_config.cpp
pcbnew/pcbnew_config.cpp
+7
-18
pcbnew_config.h
pcbnew/pcbnew_config.h
+303
-302
pcbplot.cpp
pcbnew/pcbplot.cpp
+54
-48
No files found.
pcbnew/menubarmodedit.cpp
View file @
1a139a7f
/************************************************
***********************
/
/************************************************/
/* menubarmodedit.cpp -
creation du menu general de l'editeur de module
*/
/* menubarmodedit.cpp -
Module editor menu bar.
*/
/************************************************
***********************
/
/************************************************/
#include "fctsys.h"
#include "fctsys.h"
#include "common.h"
#include "common.h"
...
@@ -13,80 +13,74 @@
...
@@ -13,80 +13,74 @@
#include "pcbnew_id.h"
#include "pcbnew_id.h"
/***********************************************/
void
WinEDA_ModuleEditFrame
::
ReCreateMenuBar
()
void
WinEDA_ModuleEditFrame
::
ReCreateMenuBar
()
/***********************************************/
/* Cree ou reinitialise le menu du haut d'ecran
*/
{
{
wxMenuBar
*
menuBar
=
GetMenuBar
();
wxMenuBar
*
menuBar
=
GetMenuBar
();
wxMenuItem
*
item
;
wxMenuItem
*
item
;
if
(
!
menuBar
)
if
(
!
menuBar
)
{
{
menuBar
=
new
wxMenuBar
();
menuBar
=
new
wxMenuBar
();
/////////////////////////////
wxMenu
*
sizes_menu
=
new
wxMenu
;
// Ajustage de dimensions: //
/////////////////////////////
wxMenu
*
sizes_menu
=
new
wxMenu
;
item
=
new
wxMenuItem
(
sizes_menu
,
ID_PCB_DRAWINGS_WIDTHS_SETUP
,
item
=
new
wxMenuItem
(
sizes_menu
,
ID_PCB_DRAWINGS_WIDTHS_SETUP
,
_
(
"Sizes and Widths"
),
_
(
"Sizes and Widths"
),
_
(
"Adjust width for texts and drawings"
)
);
_
(
"Adjust width for texts and drawings"
)
);
item
->
SetBitmap
(
options_text_xpm
);
item
->
SetBitmap
(
options_text_xpm
);
sizes_menu
->
Append
(
item
);
sizes_menu
->
Append
(
item
);
item
=
new
wxMenuItem
(
sizes_menu
,
ID_PCB_PAD_SETUP
,
_
(
"Pad Settings"
),
item
=
new
wxMenuItem
(
sizes_menu
,
ID_PCB_PAD_SETUP
,
_
(
"Pad Settings"
),
_
(
"Adjust size,shape,layers... for Pads"
)
);
_
(
"Adjust size, shape, layers... for pads"
)
);
item
->
SetBitmap
(
pad_xpm
);
item
->
SetBitmap
(
pad_xpm
);
sizes_menu
->
Append
(
item
);
sizes_menu
->
Append
(
item
);
item
=
new
wxMenuItem
(
sizes_menu
,
ID_PCB_USER_GRID_SETUP
,
_
(
"User Grid Size"
),
item
=
_
(
"Adjust User Grid"
));
new
wxMenuItem
(
sizes_menu
,
ID_PCB_USER_GRID_SETUP
,
item
->
SetBitmap
(
grid_xpm
);
_
(
"User Grid Size"
),
sizes_menu
->
Append
(
item
);
_
(
"Adjust user grid"
)
);
item
->
SetBitmap
(
grid_xpm
);
sizes_menu
->
Append
(
item
);
////////////////
////////////////
// Menu Help: //
// Menu Help: //
////////////////
////////////////
wxMenu
*
helpMenu
=
new
wxMenu
;
wxMenu
*
helpMenu
=
new
wxMenu
;
// Contents
// Contents
item
=
new
wxMenuItem
(
helpMenu
,
item
=
new
wxMenuItem
(
helpMenu
,
ID_GENERAL_HELP
,
ID_GENERAL_HELP
,
_
(
"&Contents"
),
// Menu entry name
_
(
"&Contents"
),
_
(
"Open the pcbnew manual"
));
// Statusbar message
_
(
"Open the pcbnew manual"
)
);
item
->
SetBitmap
(
help_xpm
);
item
->
SetBitmap
(
help_xpm
);
helpMenu
->
Append
(
item
);
helpMenu
->
Append
(
item
);
// About pcbnew
// About pcbnew
item
=
new
wxMenuItem
(
helpMenu
,
item
=
new
wxMenuItem
(
helpMenu
,
ID_KICAD_ABOUT
,
ID_KICAD_ABOUT
,
_
(
"&About pcbnew"
),
// Menu entry name
_
(
"&About pcbnew"
),
_
(
"About pcbnew PCB designer"
));
// Statusbar message
_
(
"About pcbnew PCB designer"
)
);
item
->
SetBitmap
(
info_xpm
);
item
->
SetBitmap
(
info_xpm
);
helpMenu
->
Append
(
item
);
helpMenu
->
Append
(
item
);
//////////////////////
//////////////////////
// Menu Display 3D: //
// Menu Display 3D: //
//////////////////////
//////////////////////
wxMenu
*
Display3DMenu
=
new
wxMenu
;
wxMenu
*
Display3DMenu
=
new
wxMenu
;
item
=
new
wxMenuItem
(
Display3DMenu
,
ID_MENU_PCB_SHOW_3D_FRAME
,
_
(
"3D Display"
),
_
(
"Show board in 3D viewer"
));
item
=
new
wxMenuItem
(
Display3DMenu
,
item
->
SetBitmap
(
show_3d_xpm
);
ID_MENU_PCB_SHOW_3D_FRAME
,
Display3DMenu
->
Append
(
item
);
_
(
"3D Display"
),
_
(
"Show board in 3D viewer"
)
);
menuBar
->
Append
(
sizes_menu
,
_
(
"&Dimensions"
));
item
->
SetBitmap
(
show_3d_xpm
);
menuBar
->
Append
(
Display3DMenu
,
_
(
"&3D Display"
));
Display3DMenu
->
Append
(
item
);
menuBar
->
Append
(
helpMenu
,
_
(
"&Help"
));
menuBar
->
Append
(
sizes_menu
,
_
(
"&Dimensions"
)
);
menuBar
->
Append
(
Display3DMenu
,
_
(
"&3D Display"
)
);
menuBar
->
Append
(
helpMenu
,
_
(
"&Help"
)
);
// Associate the menu bar with the frame
// Associate the menu bar with the frame
SetMenuBar
(
menuBar
);
SetMenuBar
(
menuBar
);
}
}
}
}
pcbnew/menubarpcb.cpp
View file @
1a139a7f
/*****************************************
*************************
/
/*****************************************/
/* menubarpcb.cpp -
creation du menu general de l'editeur de board
*/
/* menubarpcb.cpp -
PCB editor menu bar.
*/
/*****************************************
*************************
/
/*****************************************/
#include "fctsys.h"
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "appl_wxstruct.h"
#include "common.h"
#include "common.h"
...
@@ -11,12 +11,8 @@
...
@@ -11,12 +11,8 @@
#include "hotkeys.h"
#include "hotkeys.h"
#include "pcbnew_id.h"
#include "pcbnew_id.h"
/***********************************************/
void
WinEDA_PcbFrame
::
ReCreateMenuBar
()
/***********************************************/
/* Cree ou reinitialise le menu du haut d'ecran
void
WinEDA_PcbFrame
::
ReCreateMenuBar
()
*/
{
{
wxMenuItem
*
item
;
wxMenuItem
*
item
;
wxMenuBar
*
menuBar
=
GetMenuBar
();
wxMenuBar
*
menuBar
=
GetMenuBar
();
...
@@ -62,7 +58,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
...
@@ -62,7 +58,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
// Add save menu
// Add save menu
filesMenu
->
AppendSeparator
();
filesMenu
->
AppendSeparator
();
item
=
new
wxMenuItem
(
filesMenu
,
ID_SAVE_BOARD
,
item
=
new
wxMenuItem
(
filesMenu
,
ID_SAVE_BOARD
,
_
(
"&Save Board
\t
Ctrl-S"
),
_
(
"Save current board"
)
);
_
(
"&Save Board
\t
Ctrl-S"
),
_
(
"Save current board"
)
);
item
->
SetBitmap
(
save_xpm
);
item
->
SetBitmap
(
save_xpm
);
filesMenu
->
Append
(
item
);
filesMenu
->
Append
(
item
);
...
@@ -125,7 +122,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
...
@@ -125,7 +122,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item
->
SetBitmap
(
import_xpm
);
// @todo need better bitmap
item
->
SetBitmap
(
import_xpm
);
// @todo need better bitmap
submenuImport
->
Append
(
item
);
submenuImport
->
Append
(
item
);
/* would be implemented in WinEDA_PcbFrame::ImportSpecctraDesign() in specctra_import.cpp
/* would be implemented in WinEDA_PcbFrame::ImportSpecctraDesign() in
* specctra_import.cpp
* item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN,
* item = new wxMenuItem(submenuImport, ID_GEN_IMPORT_SPECCTRA_DESIGN,
* _("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
* _("&Specctra Design"), _("Import a \"Specctra Design\" (*.dsn) file") );
* item->SetBitmap(export_xpm); // @todo need better bitmap
* item->SetBitmap(export_xpm); // @todo need better bitmap
...
@@ -167,7 +165,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
...
@@ -167,7 +165,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
wxGetApp
().
m_fileHistory
.
AddFilesToMenu
(
filesMenu
);
wxGetApp
().
m_fileHistory
.
AddFilesToMenu
(
filesMenu
);
///////////////////////////////////
///////////////////////////////////
// Preferences an configuration //
// Preferences an
d
configuration //
///////////////////////////////////
///////////////////////////////////
wxMenu
*
configmenu
=
new
wxMenu
;
wxMenu
*
configmenu
=
new
wxMenu
;
item
=
new
wxMenuItem
(
configmenu
,
ID_CONFIG_REQ
,
_
(
"&Library"
),
item
=
new
wxMenuItem
(
configmenu
,
ID_CONFIG_REQ
,
_
(
"&Library"
),
...
@@ -175,8 +173,9 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
...
@@ -175,8 +173,9 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item
->
SetBitmap
(
library_xpm
);
item
->
SetBitmap
(
library_xpm
);
configmenu
->
Append
(
item
);
configmenu
->
Append
(
item
);
item
=
new
wxMenuItem
(
configmenu
,
ID_COLORS_SETUP
,
_
(
"&Colors and Visibility"
),
item
=
new
wxMenuItem
(
configmenu
,
ID_COLORS_SETUP
,
_
(
"Select colors and visibilty of layers and some items"
)
);
_
(
"&Colors and Visibility"
),
_
(
"Select colors and visibility of layers and some items"
)
);
item
->
SetBitmap
(
palette_xpm
);
item
->
SetBitmap
(
palette_xpm
);
configmenu
->
Append
(
item
);
configmenu
->
Append
(
item
);
...
@@ -185,7 +184,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
...
@@ -185,7 +184,8 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item
->
SetBitmap
(
preference_xpm
);
item
->
SetBitmap
(
preference_xpm
);
configmenu
->
Append
(
item
);
configmenu
->
Append
(
item
);
item
=
new
wxMenuItem
(
configmenu
,
ID_PCB_DISPLAY_OPTIONS_SETUP
,
_
(
"&Display"
),
item
=
new
wxMenuItem
(
configmenu
,
ID_PCB_DISPLAY_OPTIONS_SETUP
,
_
(
"&Display"
),
_
(
"Select how items (pads, tracks texts ... ) are displayed"
)
);
_
(
"Select how items (pads, tracks texts ... ) are displayed"
)
);
item
->
SetBitmap
(
display_options_xpm
);
item
->
SetBitmap
(
display_options_xpm
);
configmenu
->
Append
(
item
);
configmenu
->
Append
(
item
);
...
@@ -206,13 +206,13 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
...
@@ -206,13 +206,13 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
configmenu
->
Append
(
item
);
configmenu
->
Append
(
item
);
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
// Add access to the Design Rules Dialog and layers setup //
// Add access to the Design Rules Dialog and layers setup //
////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////
wxMenu
*
designRulesMenu
=
new
wxMenu
;
wxMenu
*
designRulesMenu
=
new
wxMenu
;
item
=
new
wxMenuItem
(
designRulesMenu
,
ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG
,
item
=
new
wxMenuItem
(
designRulesMenu
,
ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG
,
_
(
"Design Rules"
),
_
(
"Open the design rules dialog editor"
)
);
_
(
"Design Rules"
),
_
(
"Open the design rules dialog editor"
)
);
item
->
SetBitmap
(
hammer_xpm
);
item
->
SetBitmap
(
hammer_xpm
);
designRulesMenu
->
Append
(
item
);
designRulesMenu
->
Append
(
item
);
...
@@ -255,9 +255,6 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
...
@@ -255,9 +255,6 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item
->
SetBitmap
(
save_xpm
);
item
->
SetBitmap
(
save_xpm
);
sizes_menu
->
Append
(
item
);
sizes_menu
->
Append
(
item
);
//////////////////////////////////////////////////////////////////
// Menu postprocess ( generation fichiers percage, placement... //
//////////////////////////////////////////////////////////////////
wxMenu
*
postprocess_menu
=
new
wxMenu
;
wxMenu
*
postprocess_menu
=
new
wxMenu
;
item
=
new
wxMenuItem
(
postprocess_menu
,
ID_PCB_GEN_POS_MODULES_FILE
,
item
=
new
wxMenuItem
(
postprocess_menu
,
ID_PCB_GEN_POS_MODULES_FILE
,
_
(
"Generate &Modules Position"
),
_
(
"Generate &Modules Position"
),
...
@@ -283,9 +280,6 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
...
@@ -283,9 +280,6 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
item
->
SetBitmap
(
tools_xpm
);
item
->
SetBitmap
(
tools_xpm
);
postprocess_menu
->
Append
(
item
);
postprocess_menu
->
Append
(
item
);
//////////////////////////
// Menu d'outils divers //
//////////////////////////
wxMenu
*
miscellaneous_menu
=
new
wxMenu
;
wxMenu
*
miscellaneous_menu
=
new
wxMenu
;
item
=
new
wxMenuItem
(
miscellaneous_menu
,
ID_PCB_GLOBAL_DELETE
,
item
=
new
wxMenuItem
(
miscellaneous_menu
,
ID_PCB_GLOBAL_DELETE
,
_
(
"Global &Deletions"
),
_
(
"Global &Deletions"
),
...
...
pcbnew/mirepcb.cpp
View file @
1a139a7f
/********************************************
*
/
/********************************************/
/* Functions to edit
e
targets (class MIRE) */
/* Functions to edit targets (class MIRE) */
/********************************************
*
/
/********************************************/
#include "fctsys.h"
#include "fctsys.h"
#include "common.h"
#include "common.h"
...
@@ -15,12 +15,16 @@
...
@@ -15,12 +15,16 @@
/* Routines Locales */
/* Routines Locales */
static
void
AbortMoveAndEditTarget
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
void
AbortMoveAndEditTarget
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
void
ShowTargetShapeWhileMovingMouse
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
ShowTargetShapeWhileMovingMouse
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
/* Local variables : */
/* Local variables : */
static
int
MireDefaultSize
=
5000
;
static
int
MireDefaultSize
=
5000
;
static
MIREPCB
s_TargetCopy
(
NULL
);
/* Used to store "old" values of the current item
static
MIREPCB
s_TargetCopy
(
NULL
);
/* Used to store "old" values of the
* parameters before edition (used in undo/redo or cancel operations)
* current item parameters before
* edition (used in undo/redo or
* cancel operations)
*/
*/
/************************************/
/************************************/
...
@@ -38,11 +42,10 @@ private:
...
@@ -38,11 +42,10 @@ private:
WinEDA_ValueCtrl
*
m_MireSizeCtrl
;
WinEDA_ValueCtrl
*
m_MireSizeCtrl
;
wxRadioBox
*
m_MireShape
;
wxRadioBox
*
m_MireShape
;
public
:
public
:
WinEDA_MirePropertiesFrame
(
WinEDA_PcbFrame
*
parent
,
MIREPCB
*
Mire
,
// Constructor and destructor
wxDC
*
DC
,
WinEDA_MirePropertiesFrame
(
WinEDA_PcbFrame
*
parent
,
const
wxPoint
&
pos
);
MIREPCB
*
Mire
,
wxDC
*
DC
,
const
wxPoint
&
pos
);
~
WinEDA_MirePropertiesFrame
()
{
}
~
WinEDA_MirePropertiesFrame
()
{
}
private
:
private
:
...
@@ -53,25 +56,24 @@ private:
...
@@ -53,25 +56,24 @@ private:
};
};
BEGIN_EVENT_TABLE
(
WinEDA_MirePropertiesFrame
,
wxDialog
)
BEGIN_EVENT_TABLE
(
WinEDA_MirePropertiesFrame
,
wxDialog
)
EVT_BUTTON
(
wxID_OK
,
WinEDA_MirePropertiesFrame
::
OnOkClick
)
EVT_BUTTON
(
wxID_OK
,
WinEDA_MirePropertiesFrame
::
OnOkClick
)
EVT_BUTTON
(
wxID_CANCEL
,
WinEDA_MirePropertiesFrame
::
OnCancelClick
)
EVT_BUTTON
(
wxID_CANCEL
,
WinEDA_MirePropertiesFrame
::
OnCancelClick
)
END_EVENT_TABLE
()
END_EVENT_TABLE
()
/***************************************************************/
void
WinEDA_PcbFrame
::
InstallMireOptionsFrame
(
MIREPCB
*
MirePcb
,
void
WinEDA_PcbFrame
::
InstallMireOptionsFrame
(
MIREPCB
*
MirePcb
,
wxDC
*
DC
,
const
wxPoint
&
pos
)
wxDC
*
DC
,
const
wxPoint
&
pos
)
/***************************************************************/
{
{
WinEDA_MirePropertiesFrame
*
frame
=
new
WinEDA_MirePropertiesFrame
(
this
,
WinEDA_MirePropertiesFrame
*
frame
=
MirePcb
,
DC
,
pos
);
new
WinEDA_MirePropertiesFrame
(
this
,
MirePcb
,
DC
,
pos
);
frame
->
ShowModal
();
frame
->
ShowModal
();
frame
->
Destroy
();
frame
->
Destroy
();
}
}
WinEDA_MirePropertiesFrame
::
WinEDA_MirePropertiesFrame
(
WinEDA_PcbFrame
*
parent
,
WinEDA_MirePropertiesFrame
::
WinEDA_MirePropertiesFrame
(
WinEDA_PcbFrame
*
parent
,
MIREPCB
*
Mire
,
wxDC
*
DC
,
MIREPCB
*
Mire
,
wxDC
*
DC
,
const
wxPoint
&
framepos
)
:
const
wxPoint
&
framepos
)
:
wxDialog
(
parent
,
-
1
,
_
(
"Target Properties"
),
framepos
,
wxSize
(
270
,
210
),
wxDialog
(
parent
,
-
1
,
_
(
"Target Properties"
),
framepos
,
wxSize
(
270
,
210
),
...
@@ -93,7 +95,7 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
...
@@ -93,7 +95,7 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
MainBoxSizer
->
Add
(
LeftBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
MainBoxSizer
->
Add
(
LeftBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
MainBoxSizer
->
Add
(
RightBoxSizer
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
MainBoxSizer
->
Add
(
RightBoxSizer
,
0
,
wxALIGN_CENTER_VERTICAL
|
wxALL
,
5
);
/* Creat
ion des boutons de commande
*/
/* Creat
e of the command buttons.
*/
Button
=
new
wxButton
(
this
,
wxID_OK
,
_
(
"OK"
)
);
Button
=
new
wxButton
(
this
,
wxID_OK
,
_
(
"OK"
)
);
RightBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
RightBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
...
@@ -103,12 +105,14 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
...
@@ -103,12 +105,14 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
// Size:
// Size:
m_MireSizeCtrl
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Size"
),
m_MireSizeCtrl
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Size"
),
m_MirePcb
->
m_Size
,
m_MirePcb
->
m_Size
,
g_UnitMetric
,
LeftBoxSizer
,
m_Parent
->
m_InternalUnits
);
g_UnitMetric
,
LeftBoxSizer
,
m_Parent
->
m_InternalUnits
);
// Width:
// Width:
m_MireWidthCtrl
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Width"
),
m_MireWidthCtrl
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Width"
),
m_MirePcb
->
m_Width
,
m_MirePcb
->
m_Width
,
g_UnitMetric
,
LeftBoxSizer
,
m_Parent
->
m_InternalUnits
);
g_UnitMetric
,
LeftBoxSizer
,
m_Parent
->
m_InternalUnits
);
// Shape
// Shape
wxString
shape_list
[
2
]
=
{
_
(
"shape +"
),
_
(
"shape X"
)
};
wxString
shape_list
[
2
]
=
{
_
(
"shape +"
),
_
(
"shape X"
)
};
...
@@ -124,44 +128,42 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
...
@@ -124,44 +128,42 @@ WinEDA_MirePropertiesFrame::WinEDA_MirePropertiesFrame( WinEDA_PcbFrame* parent,
}
}
/**********************************************************************/
void
WinEDA_MirePropertiesFrame
::
OnCancelClick
(
wxCommandEvent
&
WXUNUSED
(
void
WinEDA_MirePropertiesFrame
::
OnCancelClick
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
event
)
)
/**********************************************************************/
{
{
EndModal
(
-
1
);
EndModal
(
-
1
);
}
}
/**************************************************************************/
/* Updates the different parameters for the component being edited
void
WinEDA_MirePropertiesFrame
::
OnOkClick
(
wxCommandEvent
&
event
)
/**************************************************************************/
/* Met a jour les differents parametres pour le composant en cours d'dition
*/
*/
void
WinEDA_MirePropertiesFrame
::
OnOkClick
(
wxCommandEvent
&
event
)
{
{
m_MirePcb
->
Draw
(
m_Parent
->
DrawPanel
,
m_DC
,
GR_XOR
);
m_MirePcb
->
Draw
(
m_Parent
->
DrawPanel
,
m_DC
,
GR_XOR
);
// Save old item in undo list, if is is not curently edited (will be later if so)
// Save old item in undo list, if is is not currently edited (will be later
// if so)
if
(
m_MirePcb
->
m_Flags
==
0
)
if
(
m_MirePcb
->
m_Flags
==
0
)
m_Parent
->
SaveCopyInUndoList
(
m_MirePcb
,
UR_CHANGED
);
m_Parent
->
SaveCopyInUndoList
(
m_MirePcb
,
UR_CHANGED
);
if
(
m_MirePcb
->
m_Flags
!=
0
)
// other edition in progress (MOVE, NEW ..)
if
(
m_MirePcb
->
m_Flags
!=
0
)
// other edition in progress (MOVE,
m_MirePcb
->
m_Flags
|=
IN_EDIT
;
// set flag in edit to force undo/redo/abort proper operation
// NEW ..)
m_MirePcb
->
m_Flags
|=
IN_EDIT
;
// set flag in edit to force
// undo/redo/abort proper operation
m_MirePcb
->
m_Width
=
m_MireWidthCtrl
->
GetValue
();
m_MirePcb
->
m_Width
=
m_MireWidthCtrl
->
GetValue
();
MireDefaultSize
=
m_MirePcb
->
m_Size
=
m_MireSizeCtrl
->
GetValue
();
MireDefaultSize
=
m_MirePcb
->
m_Size
=
m_MireSizeCtrl
->
GetValue
();
m_MirePcb
->
m_Shape
=
m_MireShape
->
GetSelection
()
?
1
:
0
;
m_MirePcb
->
m_Shape
=
m_MireShape
->
GetSelection
()
?
1
:
0
;
m_MirePcb
->
Draw
(
m_Parent
->
DrawPanel
,
m_DC
,
(
m_MirePcb
->
m_Flags
&
IS_MOVED
)
?
GR_XOR
:
GR_OR
);
m_MirePcb
->
Draw
(
m_Parent
->
DrawPanel
,
m_DC
,
(
m_MirePcb
->
m_Flags
&
IS_MOVED
)
?
GR_XOR
:
GR_OR
);
m_Parent
->
GetScreen
()
->
SetModify
();
m_Parent
->
GetScreen
()
->
SetModify
();
EndModal
(
1
);
EndModal
(
1
);
}
}
/**************************************************************/
void
WinEDA_PcbFrame
::
Delete_Mire
(
MIREPCB
*
MirePcb
,
wxDC
*
DC
)
void
WinEDA_PcbFrame
::
Delete_Mire
(
MIREPCB
*
MirePcb
,
wxDC
*
DC
)
/**************************************************************/
{
{
if
(
MirePcb
==
NULL
)
if
(
MirePcb
==
NULL
)
return
;
return
;
...
@@ -172,16 +174,14 @@ void WinEDA_PcbFrame::Delete_Mire( MIREPCB* MirePcb, wxDC* DC )
...
@@ -172,16 +174,14 @@ void WinEDA_PcbFrame::Delete_Mire( MIREPCB* MirePcb, wxDC* DC )
}
}
/**********************************************************/
static
void
AbortMoveAndEditTarget
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
static
void
AbortMoveAndEditTarget
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/**********************************************************/
{
{
BASE_SCREEN
*
screen
=
Panel
->
GetScreen
();
BASE_SCREEN
*
screen
=
Panel
->
GetScreen
();
MIREPCB
*
MirePcb
=
(
MIREPCB
*
)
screen
->
GetCurItem
();
MIREPCB
*
MirePcb
=
(
MIREPCB
*
)
screen
->
GetCurItem
();
Panel
->
ManageCurseur
=
NULL
;
Panel
->
ManageCurseur
=
NULL
;
Panel
->
ForceCloseManageCurseur
=
NULL
;
Panel
->
ForceCloseManageCurseur
=
NULL
;
(
(
WinEDA_PcbFrame
*
)
Panel
->
m_Parent
)
->
SetCurItem
(
NULL
);
(
(
WinEDA_PcbFrame
*
)
Panel
->
m_Parent
)
->
SetCurItem
(
NULL
);
if
(
MirePcb
==
NULL
)
if
(
MirePcb
==
NULL
)
return
;
return
;
...
@@ -196,7 +196,7 @@ static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -196,7 +196,7 @@ static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
}
}
else
/* it is an existing item: retrieve initial values of parameters */
else
/* it is an existing item: retrieve initial values of parameters */
{
{
if
(
(
MirePcb
->
m_Flags
&
(
IN_EDIT
|
IS_MOVED
)
)
)
if
(
(
MirePcb
->
m_Flags
&
(
IN_EDIT
|
IS_MOVED
)
)
)
{
{
MirePcb
->
m_Pos
=
s_TargetCopy
.
m_Pos
;
MirePcb
->
m_Pos
=
s_TargetCopy
.
m_Pos
;
MirePcb
->
m_Width
=
s_TargetCopy
.
m_Width
;
MirePcb
->
m_Width
=
s_TargetCopy
.
m_Width
;
...
@@ -209,12 +209,9 @@ static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -209,12 +209,9 @@ static void AbortMoveAndEditTarget( WinEDA_DrawPanel* Panel, wxDC* DC )
}
}
/*****************************************************/
/* Draw Symbol PCB type MIRE.
MIREPCB
*
WinEDA_PcbFrame
::
Create_Mire
(
wxDC
*
DC
)
/*****************************************************/
/* Routine de creation d'un Draw Symbole Pcb type MIRE
*/
*/
MIREPCB
*
WinEDA_PcbFrame
::
Create_Mire
(
wxDC
*
DC
)
{
{
MIREPCB
*
MirePcb
=
new
MIREPCB
(
GetBoard
()
);
MIREPCB
*
MirePcb
=
new
MIREPCB
(
GetBoard
()
);
...
@@ -232,12 +229,9 @@ MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
...
@@ -232,12 +229,9 @@ MIREPCB* WinEDA_PcbFrame::Create_Mire( wxDC* DC )
}
}
/**********************************************************************/
/* Routine to initialize the displacement of a focal
void
WinEDA_PcbFrame
::
StartMove_Mire
(
MIREPCB
*
MirePcb
,
wxDC
*
DC
)
/**********************************************************************/
/* Routine d'initialisation du deplacement d'une mire
*/
*/
void
WinEDA_PcbFrame
::
StartMove_Mire
(
MIREPCB
*
MirePcb
,
wxDC
*
DC
)
{
{
if
(
MirePcb
==
NULL
)
if
(
MirePcb
==
NULL
)
return
;
return
;
...
@@ -250,9 +244,7 @@ void WinEDA_PcbFrame::StartMove_Mire( MIREPCB* MirePcb, wxDC* DC )
...
@@ -250,9 +244,7 @@ void WinEDA_PcbFrame::StartMove_Mire( MIREPCB* MirePcb, wxDC* DC )
}
}
/**************************************************************/
void
WinEDA_PcbFrame
::
Place_Mire
(
MIREPCB
*
MirePcb
,
wxDC
*
DC
)
void
WinEDA_PcbFrame
::
Place_Mire
(
MIREPCB
*
MirePcb
,
wxDC
*
DC
)
/**************************************************************/
{
{
if
(
MirePcb
==
NULL
)
if
(
MirePcb
==
NULL
)
return
;
return
;
...
@@ -273,7 +265,9 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
...
@@ -273,7 +265,9 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
if
(
MirePcb
->
m_Flags
==
IS_MOVED
)
if
(
MirePcb
->
m_Flags
==
IS_MOVED
)
{
{
SaveCopyInUndoList
(
MirePcb
,
UR_MOVED
,
MirePcb
->
m_Pos
-
s_TargetCopy
.
m_Pos
);
SaveCopyInUndoList
(
MirePcb
,
UR_MOVED
,
MirePcb
->
m_Pos
-
s_TargetCopy
.
m_Pos
);
MirePcb
->
m_Flags
=
0
;
MirePcb
->
m_Flags
=
0
;
return
;
return
;
}
}
...
@@ -288,10 +282,10 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
...
@@ -288,10 +282,10 @@ void WinEDA_PcbFrame::Place_Mire( MIREPCB* MirePcb, wxDC* DC )
}
}
/*
****************************************************************************
*/
/*
Redraw the contour of the track while moving the mouse
*/
static
void
ShowTargetShapeWhileMovingMouse
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
static
void
ShowTargetShapeWhileMovingMouse
(
WinEDA_DrawPanel
*
panel
,
/*********************************************************************************/
wxDC
*
DC
,
/* redessin du contour de la piste lors des deplacements de la souris */
bool
erase
)
{
{
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
MIREPCB
*
MirePcb
=
(
MIREPCB
*
)
screen
->
GetCurItem
();
MIREPCB
*
MirePcb
=
(
MIREPCB
*
)
screen
->
GetCurItem
();
...
@@ -299,12 +293,10 @@ static void ShowTargetShapeWhileMovingMouse( WinEDA_DrawPanel* panel, wxDC* DC,
...
@@ -299,12 +293,10 @@ static void ShowTargetShapeWhileMovingMouse( WinEDA_DrawPanel* panel, wxDC* DC,
if
(
MirePcb
==
NULL
)
if
(
MirePcb
==
NULL
)
return
;
return
;
/* efface ancienne position */
if
(
erase
)
if
(
erase
)
MirePcb
->
Draw
(
panel
,
DC
,
GR_XOR
);
MirePcb
->
Draw
(
panel
,
DC
,
GR_XOR
);
MirePcb
->
m_Pos
=
screen
->
m_Curseur
;
MirePcb
->
m_Pos
=
screen
->
m_Curseur
;
// Reaffichage
MirePcb
->
Draw
(
panel
,
DC
,
GR_XOR
);
MirePcb
->
Draw
(
panel
,
DC
,
GR_XOR
);
}
}
pcbnew/modedit.cpp
View file @
1a139a7f
...
@@ -21,9 +21,8 @@
...
@@ -21,9 +21,8 @@
#include "collectors.h"
#include "collectors.h"
/****************************************************************************/
BOARD_ITEM
*
WinEDA_ModuleEditFrame
::
ModeditLocateAndDisplay
(
int
aHotKeyCode
)
BOARD_ITEM
*
WinEDA_ModuleEditFrame
::
ModeditLocateAndDisplay
(
int
aHotKeyCode
)
/****************************************************************************/
{
{
BOARD_ITEM
*
item
=
GetCurItem
();
BOARD_ITEM
*
item
=
GetCurItem
();
...
@@ -38,15 +37,16 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
...
@@ -38,15 +37,16 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
if
(
aHotKeyCode
)
if
(
aHotKeyCode
)
{
{
// @todo: add switch here and add calls to PcbGeneralLocateAndDisplay(
int aHotKeyCode )
// @todo: add switch here and add calls to PcbGeneralLocateAndDisplay(
// when searching is needed from a hotkey handler
//
int aHotKeyCode )
when searching is needed from a hotkey handler
}
}
else
else
{
{
scanList
=
GENERAL_COLLECTOR
::
ModulesAndTheirItems
;
scanList
=
GENERAL_COLLECTOR
::
ModulesAndTheirItems
;
}
}
m_Collector
->
Collect
(
GetBoard
(),
scanList
,
GetScreen
()
->
RefPos
(
true
),
guide
);
m_Collector
->
Collect
(
GetBoard
(),
scanList
,
GetScreen
()
->
RefPos
(
true
),
guide
);
/* Remove redundancies: when an item is found, we can remove the
/* Remove redundancies: when an item is found, we can remove the
* module from list
* module from list
...
@@ -68,12 +68,15 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
...
@@ -68,12 +68,15 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
item
=
(
*
m_Collector
)[
0
];
item
=
(
*
m_Collector
)[
0
];
SetCurItem
(
item
);
SetCurItem
(
item
);
}
}
else
// we can't figure out which item user wants, do popup menu so user can choose
else
// we can't figure out which item user wants, do popup menu so user
// can choose
{
{
wxMenu
itemMenu
;
wxMenu
itemMenu
;
/* Give a title to the selection menu. This is also a cancel menu item */
/* Give a title to the selection menu. This is also a cancel
wxMenuItem
*
item_title
=
new
wxMenuItem
(
&
itemMenu
,
-
1
,
_
(
"Selection Clarification"
)
);
* menu item **/
wxMenuItem
*
item_title
=
new
wxMenuItem
(
&
itemMenu
,
-
1
,
_
(
"Selection Clarification"
)
);
#ifdef __WINDOWS__
#ifdef __WINDOWS__
wxFont
bold_font
(
*
wxNORMAL_FONT
);
wxFont
bold_font
(
*
wxNORMAL_FONT
);
bold_font
.
SetWeight
(
wxFONTWEIGHT_BOLD
);
bold_font
.
SetWeight
(
wxFONTWEIGHT_BOLD
);
...
@@ -95,19 +98,26 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
...
@@ -95,19 +98,26 @@ BOARD_ITEM* WinEDA_ModuleEditFrame::ModeditLocateAndDisplay( int aHotKeyCode )
text
=
item
->
MenuText
(
GetBoard
()
);
text
=
item
->
MenuText
(
GetBoard
()
);
xpm
=
item
->
MenuIcon
();
xpm
=
item
->
MenuIcon
();
ADD_MENUITEM
(
&
itemMenu
,
ID_POPUP_PCB_ITEM_SELECTION_START
+
ii
,
text
,
xpm
);
ADD_MENUITEM
(
&
itemMenu
,
ID_POPUP_PCB_ITEM_SELECTION_START
+
ii
,
text
,
xpm
);
}
}
// this menu's handler is void WinEDA_BasePcbFrame::ProcessItemSelection()
// this menu's handler is void
// and it calls SetCurItem() which in turn calls DisplayInfo() on the item.
// WinEDA_BasePcbFrame::ProcessItemSelection()
// and it calls SetCurItem() which in turn calls DisplayInfo() on the
// item.
DrawPanel
->
m_AbortRequest
=
true
;
// changed in false if an item
DrawPanel
->
m_AbortRequest
=
true
;
// changed in false if an item
PopupMenu
(
&
itemMenu
);
// m_AbortRequest = false if an item is selected
PopupMenu
(
&
itemMenu
);
// m_AbortRequest = false if an
// item is selected
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
m_IgnoreMouseEvents
=
FALSE
;
DrawPanel
->
m_IgnoreMouseEvents
=
FALSE
;
// The function ProcessItemSelection() has set the current item, return it.
// The function ProcessItemSelection() has set the current item, return
// it.
item
=
GetCurItem
();
item
=
GetCurItem
();
}
}
...
@@ -131,25 +141,20 @@ void WinEDA_ModuleEditFrame::LoadModuleFromBoard( wxCommandEvent& event )
...
@@ -131,25 +141,20 @@ void WinEDA_ModuleEditFrame::LoadModuleFromBoard( wxCommandEvent& event )
}
}
/****************************************************************************/
void
WinEDA_ModuleEditFrame
::
Process_Special_Functions
(
wxCommandEvent
&
event
)
void
WinEDA_ModuleEditFrame
::
Process_Special_Functions
(
wxCommandEvent
&
event
)
/****************************************************************************/
/* Traite les selections d'outils et les commandes appelees du menu POPUP
*/
#define SET_DC wxClientDC dc( DrawPanel ); DrawPanel->PrepareGraphicContext( &dc );
{
{
int
id
=
event
.
GetId
();
int
id
=
event
.
GetId
();
wxPoint
pos
;
wxPoint
pos
;
bool
redraw
=
false
;
bool
redraw
=
false
;
wxClientDC
dc
(
DrawPanel
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
wxGetMousePosition
(
&
pos
.
x
,
&
pos
.
y
);
wxGetMousePosition
(
&
pos
.
x
,
&
pos
.
y
);
pos
.
y
+=
20
;
pos
.
y
+=
20
;
switch
(
id
)
// Arret eventuel de la commande de d�placement en cours
switch
(
id
)
{
{
case
wxID_CUT
:
case
wxID_CUT
:
case
wxID_COPY
:
case
wxID_COPY
:
...
@@ -185,7 +190,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -185,7 +190,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if
(
DrawPanel
->
ManageCurseur
&&
DrawPanel
->
ForceCloseManageCurseur
)
if
(
DrawPanel
->
ManageCurseur
&&
DrawPanel
->
ForceCloseManageCurseur
)
{
{
// for all other commands: stop the move in progress
// for all other commands: stop the move in progress
SET_DC
;
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
&
dc
);
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
&
dc
);
}
}
if
(
id
!=
ID_POPUP_CANCEL_CURRENT_COMMAND
)
if
(
id
!=
ID_POPUP_CANCEL_CURRENT_COMMAND
)
...
@@ -193,7 +197,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -193,7 +197,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
break
;
}
}
switch
(
id
)
// Traitement des commandes
switch
(
id
)
{
{
case
ID_EXIT
:
case
ID_EXIT
:
Close
(
true
);
Close
(
true
);
...
@@ -223,8 +227,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -223,8 +227,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
MODULE
*
module
=
Create_1_Module
(
NULL
,
wxEmptyString
);
MODULE
*
module
=
Create_1_Module
(
NULL
,
wxEmptyString
);
if
(
module
)
// i.e. if create module command not aborted
if
(
module
)
// i.e. if create module command not aborted
{
{
// Initialize data relative to nets and netclasses (for a new
module
// Initialize data relative to nets and netclasses (for a new
// the defaults are used)
//
module
the defaults are used)
// This is mandatory to handle and draw pads
// This is mandatory to handle and draw pads
GetBoard
()
->
m_NetInfo
->
BuildListOfNets
();
GetBoard
()
->
m_NetInfo
->
BuildListOfNets
();
redraw
=
true
;
redraw
=
true
;
...
@@ -262,13 +266,16 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -262,13 +266,16 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if
(
module_in_edit
->
m_Link
)
// this is not a new module ...
if
(
module_in_edit
->
m_Link
)
// this is not a new module ...
{
{
source_module
=
mainpcb
->
m_Modules
;
source_module
=
mainpcb
->
m_Modules
;
for
(
;
source_module
!=
NULL
;
source_module
=
(
MODULE
*
)
source_module
->
Next
()
)
for
(
;
source_module
!=
NULL
;
source_module
=
(
MODULE
*
)
source_module
->
Next
()
)
{
{
if
(
module_in_edit
->
m_Link
==
source_module
->
m_TimeStamp
)
if
(
module_in_edit
->
m_Link
==
source_module
->
m_TimeStamp
)
break
;
break
;
}
}
}
}
if
(
(
source_module
==
NULL
)
&&
id
==
(
ID_MODEDIT_UPDATE_MODULE_IN_BOARD
)
)
// source not found
if
(
(
source_module
==
NULL
)
&&
(
id
==
ID_MODEDIT_UPDATE_MODULE_IN_BOARD
)
)
// source not found
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
_
(
"Unable to find the footprint source on the main board"
)
);
msg
.
Printf
(
_
(
"Unable to find the footprint source on the main board"
)
);
...
@@ -277,7 +284,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -277,7 +284,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
break
;
}
}
if
(
(
source_module
!=
NULL
)
&&
id
==
(
ID_MODEDIT_INSERT_MODULE_IN_BOARD
)
)
// source not found
if
(
(
source_module
!=
NULL
)
&&
(
id
==
ID_MODEDIT_INSERT_MODULE_IN_BOARD
)
)
// source not found
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
_
(
"A footprint source was found on the main board"
)
);
msg
.
Printf
(
_
(
"A footprint source was found on the main board"
)
);
...
@@ -297,7 +305,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -297,7 +305,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if
(
source_module
)
// this is an update command
if
(
source_module
)
// this is an update command
{
{
// In the main board,
// In the main board,
// the new module replace the old module (pos, orient, ref, value and connexions are kept)
// the new module replace the old module (pos, orient, ref, value
// and connexions are kept)
// and the source_module (old module) is deleted
// and the source_module (old module) is deleted
PICKED_ITEMS_LIST
pickList
;
PICKED_ITEMS_LIST
pickList
;
pcbframe
->
Exchange_Module
(
source_module
,
newmodule
,
&
pickList
);
pcbframe
->
Exchange_Module
(
source_module
,
newmodule
,
&
pickList
);
...
@@ -403,7 +412,9 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -403,7 +412,9 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if
(
GetBoard
()
->
m_Modules
)
if
(
GetBoard
()
->
m_Modules
)
{
{
SetCurItem
(
GetBoard
()
->
m_Modules
);
SetCurItem
(
GetBoard
()
->
m_Modules
);
DIALOG_MODULE_MODULE_EDITOR
dialog
(
this
,
(
MODULE
*
)
GetScreen
()
->
GetCurItem
()
);
DIALOG_MODULE_MODULE_EDITOR
dialog
(
this
,
(
MODULE
*
)
GetScreen
()
->
GetCurItem
()
);
int
ret
=
dialog
.
ShowModal
();
int
ret
=
dialog
.
ShowModal
();
GetScreen
()
->
GetCurItem
()
->
m_Flags
=
0
;
GetScreen
()
->
GetCurItem
()
->
m_Flags
=
0
;
if
(
ret
>
0
)
if
(
ret
>
0
)
...
@@ -461,7 +472,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -461,7 +472,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_EDIT_MODULE
:
case
ID_POPUP_PCB_EDIT_MODULE
:
{
{
DIALOG_MODULE_MODULE_EDITOR
dialog
(
this
,
(
MODULE
*
)
GetScreen
()
->
GetCurItem
()
);
DIALOG_MODULE_MODULE_EDITOR
dialog
(
this
,
(
MODULE
*
)
GetScreen
()
->
GetCurItem
()
);
int
ret
=
dialog
.
ShowModal
();
int
ret
=
dialog
.
ShowModal
();
GetScreen
()
->
GetCurItem
()
->
m_Flags
=
0
;
GetScreen
()
->
GetCurItem
()
->
m_Flags
=
0
;
GetScreen
()
->
GetCurItem
()
->
m_Flags
=
0
;
GetScreen
()
->
GetCurItem
()
->
m_Flags
=
0
;
...
@@ -473,7 +485,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -473,7 +485,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_MOVE_PAD_REQUEST
:
case
ID_POPUP_PCB_MOVE_PAD_REQUEST
:
{
{
SET_DC
;
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
StartMovePad
(
(
D_PAD
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
StartMovePad
(
(
D_PAD
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
}
}
...
@@ -481,7 +492,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -481,7 +492,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_EDIT_PAD
:
case
ID_POPUP_PCB_EDIT_PAD
:
{
{
SET_DC
;
InstallPadOptionsFrame
(
(
D_PAD
*
)
GetScreen
()
->
GetCurItem
(),
InstallPadOptionsFrame
(
(
D_PAD
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
,
pos
);
&
dc
,
pos
);
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
...
@@ -514,15 +524,14 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -514,15 +524,14 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_EDIT_TEXTMODULE
:
case
ID_POPUP_PCB_EDIT_TEXTMODULE
:
{
{
SET_DC
;
InstallTextModOptionsFrame
(
InstallTextModOptionsFrame
(
(
TEXTE_MODULE
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
(
TEXTE_MODULE
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
}
}
break
;
break
;
case
ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST
:
case
ID_POPUP_PCB_MOVE_TEXTMODULE_REQUEST
:
{
{
SET_DC
;
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
StartMoveTexteModule
(
(
TEXTE_MODULE
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
StartMoveTexteModule
(
(
TEXTE_MODULE
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
}
}
...
@@ -530,7 +539,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -530,7 +539,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_ROTATE_TEXTMODULE
:
case
ID_POPUP_PCB_ROTATE_TEXTMODULE
:
{
{
SET_DC
;
RotateTextModule
(
(
TEXTE_MODULE
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
RotateTextModule
(
(
TEXTE_MODULE
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
}
}
...
@@ -545,7 +553,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -545,7 +553,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_MOVE_EDGE
:
case
ID_POPUP_PCB_MOVE_EDGE
:
{
{
SET_DC
;
Start_Move_EdgeMod
(
(
EDGE_MODULE
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
Start_Move_EdgeMod
(
(
EDGE_MODULE
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
}
}
...
@@ -555,7 +562,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -555,7 +562,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
if
(
(
GetScreen
()
->
GetCurItem
()
->
m_Flags
&
IS_NEW
)
)
if
(
(
GetScreen
()
->
GetCurItem
()
->
m_Flags
&
IS_NEW
)
)
{
{
SET_DC
;
End_Edge_Module
(
(
EDGE_MODULE
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
End_Edge_Module
(
(
EDGE_MODULE
*
)
GetScreen
()
->
GetCurItem
(),
&
dc
);
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
}
}
...
@@ -565,12 +571,11 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -565,12 +571,11 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
{
{
EDGE_MODULE
*
edge
=
NULL
;
EDGE_MODULE
*
edge
=
NULL
;
if
(
GetScreen
()
->
GetCurItem
()
if
(
GetScreen
()
->
GetCurItem
()
&&
(
GetScreen
()
->
GetCurItem
()
->
m_Flags
&
IS_NEW
)
&&
(
GetScreen
()
->
GetCurItem
()
->
m_Flags
&
IS_NEW
)
&&
(
GetScreen
()
->
GetCurItem
()
->
Type
()
==
TYPE_EDGE_MODULE
)
)
&&
(
GetScreen
()
->
GetCurItem
()
->
Type
()
==
TYPE_EDGE_MODULE
)
)
{
{
edge
=
(
EDGE_MODULE
*
)
GetScreen
()
->
GetCurItem
();
edge
=
(
EDGE_MODULE
*
)
GetScreen
()
->
GetCurItem
();
}
}
SET_DC
;
Enter_Edge_Width
(
edge
,
&
dc
);
Enter_Edge_Width
(
edge
,
&
dc
);
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
}
}
...
@@ -622,7 +627,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -622,7 +627,6 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
if
(
item
->
Type
()
!=
TYPE_PAD
)
if
(
item
->
Type
()
!=
TYPE_PAD
)
item
=
NULL
;
item
=
NULL
;
}
}
SET_DC
;
InstallPadOptionsFrame
(
(
D_PAD
*
)
item
,
&
dc
,
pos
);
InstallPadOptionsFrame
(
(
D_PAD
*
)
item
,
&
dc
,
pos
);
}
}
break
;
break
;
...
@@ -634,56 +638,38 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -634,56 +638,38 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PLACE_BLOCK
:
case
ID_POPUP_PLACE_BLOCK
:
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_MOVE
;
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_MOVE
;
DrawPanel
->
m_AutoPAN_Request
=
FALSE
;
DrawPanel
->
m_AutoPAN_Request
=
FALSE
;
{
SET_DC
;
HandleBlockPlace
(
&
dc
);
HandleBlockPlace
(
&
dc
);
}
break
;
break
;
case
ID_POPUP_COPY_BLOCK
:
case
ID_POPUP_COPY_BLOCK
:
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_COPY
;
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_COPY
;
GetScreen
()
->
m_BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_BlockLocate
.
SetMessageBlock
(
this
);
DrawPanel
->
m_AutoPAN_Request
=
FALSE
;
DrawPanel
->
m_AutoPAN_Request
=
FALSE
;
{
SET_DC
;
HandleBlockPlace
(
&
dc
);
HandleBlockPlace
(
&
dc
);
}
break
;
break
;
case
ID_POPUP_ZOOM_BLOCK
:
case
ID_POPUP_ZOOM_BLOCK
:
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_ZOOM
;
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_ZOOM
;
GetScreen
()
->
m_BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_BlockLocate
.
SetMessageBlock
(
this
);
{
SET_DC
;
HandleBlockEnd
(
&
dc
);
HandleBlockEnd
(
&
dc
);
}
break
;
break
;
case
ID_POPUP_DELETE_BLOCK
:
case
ID_POPUP_DELETE_BLOCK
:
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_DELETE
;
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_DELETE
;
GetScreen
()
->
m_BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_BlockLocate
.
SetMessageBlock
(
this
);
{
SET_DC
;
HandleBlockEnd
(
&
dc
);
HandleBlockEnd
(
&
dc
);
}
break
;
break
;
case
ID_POPUP_ROTATE_BLOCK
:
case
ID_POPUP_ROTATE_BLOCK
:
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_ROTATE
;
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_ROTATE
;
GetScreen
()
->
m_BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_BlockLocate
.
SetMessageBlock
(
this
);
{
SET_DC
;
HandleBlockEnd
(
&
dc
);
HandleBlockEnd
(
&
dc
);
}
break
;
break
;
case
ID_POPUP_MIRROR_X_BLOCK
:
case
ID_POPUP_MIRROR_X_BLOCK
:
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_MIRROR_X
;
GetScreen
()
->
m_BlockLocate
.
m_Command
=
BLOCK_MIRROR_X
;
GetScreen
()
->
m_BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_BlockLocate
.
SetMessageBlock
(
this
);
{
SET_DC
;
HandleBlockEnd
(
&
dc
);
HandleBlockEnd
(
&
dc
);
}
break
;
break
;
default
:
default
:
...
@@ -698,21 +684,19 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -698,21 +684,19 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
}
}
/******************************************************************************/
void
WinEDA_ModuleEditFrame
::
Transform
(
MODULE
*
module
,
int
transform
)
/******************************************************************************/
/* Execute a geometric transform on the current footprint.
/* Execute a geometric transform on the current footprint.
* The footprint, after transform is always in reference position and orientation:
* The footprint, after transform is always in reference position and
* orientation:
* position 0,0
* position 0,0
* orientation 0, component side.
* orientation 0, component side.
*/
*/
void
WinEDA_ModuleEditFrame
::
Transform
(
MODULE
*
module
,
int
transform
)
{
{
D_PAD
*
pad
=
module
->
m_Pads
;
D_PAD
*
pad
=
module
->
m_Pads
;
EDA_BaseStruct
*
PtStruct
=
module
->
m_Drawings
;
EDA_BaseStruct
*
PtStruct
=
module
->
m_Drawings
;
TEXTE_MODULE
*
textmod
;
TEXTE_MODULE
*
textmod
;
EDGE_MODULE
*
edgemod
;
EDGE_MODULE
*
edgemod
;
int
angle
=
900
;
// N
ECESSAIREMENT +- 900 (+- 90 degr
es) )
int
angle
=
900
;
// N
ecessary +- 900 (+- 90 degre
es) )
switch
(
transform
)
switch
(
transform
)
{
{
...
@@ -737,7 +721,6 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
...
@@ -737,7 +721,6 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
if
(
module
->
m_Value
->
m_Orient
>=
1800
)
if
(
module
->
m_Value
->
m_Orient
>=
1800
)
module
->
m_Value
->
m_Orient
-=
1800
;
module
->
m_Value
->
m_Orient
-=
1800
;
/* Rectification des contours et textes de l'empreinte : */
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
{
{
if
(
PtStruct
->
Type
()
==
TYPE_EDGE_MODULE
)
if
(
PtStruct
->
Type
()
==
TYPE_EDGE_MODULE
)
...
@@ -748,7 +731,6 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
...
@@ -748,7 +731,6 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
}
}
if
(
PtStruct
->
Type
()
==
TYPE_TEXTE_MODULE
)
if
(
PtStruct
->
Type
()
==
TYPE_TEXTE_MODULE
)
{
{
/* deplacement des inscriptions : */
textmod
=
(
TEXTE_MODULE
*
)
PtStruct
;
textmod
=
(
TEXTE_MODULE
*
)
PtStruct
;
textmod
->
m_Pos0
=
textmod
->
m_Pos
;
textmod
->
m_Pos0
=
textmod
->
m_Pos
;
}
}
...
@@ -768,21 +750,21 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
...
@@ -768,21 +750,21 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
pad
->
m_Orient
=
3600
-
pad
->
m_Orient
;
pad
->
m_Orient
=
3600
-
pad
->
m_Orient
;
}
}
/*
Inversion miroir de la Reference
*/
/*
Reverse mirror of reference.
*/
textmod
=
module
->
m_Reference
;
textmod
=
module
->
m_Reference
;
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
if
(
textmod
->
m_Orient
)
if
(
textmod
->
m_Orient
)
textmod
->
m_Orient
=
3600
-
textmod
->
m_Orient
;
textmod
->
m_Orient
=
3600
-
textmod
->
m_Orient
;
/*
Inversion miroir de la Valeur
*/
/*
Reverse mirror of value.
*/
textmod
=
module
->
m_Value
;
textmod
=
module
->
m_Value
;
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
if
(
textmod
->
m_Orient
)
if
(
textmod
->
m_Orient
)
textmod
->
m_Orient
=
3600
-
textmod
->
m_Orient
;
textmod
->
m_Orient
=
3600
-
textmod
->
m_Orient
;
/*
Inversion miroir des dessins de l'empreinte :
*/
/*
Reverse mirror of footprints.
*/
PtStruct
=
module
->
m_Drawings
;
PtStruct
=
module
->
m_Drawings
;
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
for
(
;
PtStruct
!=
NULL
;
PtStruct
=
PtStruct
->
Next
()
)
{
{
...
@@ -792,13 +774,13 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
...
@@ -792,13 +774,13 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
edgemod
=
(
EDGE_MODULE
*
)
PtStruct
;
edgemod
=
(
EDGE_MODULE
*
)
PtStruct
;
NEGATE
(
edgemod
->
m_Start
.
y
);
NEGATE
(
edgemod
->
m_Start
.
y
);
NEGATE
(
edgemod
->
m_End
.
y
);
NEGATE
(
edgemod
->
m_End
.
y
);
/*
inversion des coords local
es */
/*
Invert local coordinat
es */
NEGATE
(
edgemod
->
m_Start0
.
y
);
NEGATE
(
edgemod
->
m_Start0
.
y
);
NEGATE
(
edgemod
->
m_End0
.
y
);
NEGATE
(
edgemod
->
m_End0
.
y
);
break
;
break
;
case
TYPE_TEXTE_MODULE
:
case
TYPE_TEXTE_MODULE
:
/*
Inversion miroir de la position et mise en miroir :
*/
/*
Reverse mirror position and mirror.
*/
textmod
=
(
TEXTE_MODULE
*
)
PtStruct
;
textmod
=
(
TEXTE_MODULE
*
)
PtStruct
;
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
NEGATE
(
textmod
->
m_Pos0
.
y
);
...
@@ -807,7 +789,7 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
...
@@ -807,7 +789,7 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
break
;
break
;
default
:
default
:
DisplayError
(
this
,
wxT
(
"
Type Draw Indefini
"
)
);
DisplayError
(
this
,
wxT
(
"
Draw type undefined
"
)
);
break
;
break
;
}
}
}
}
...
@@ -815,7 +797,7 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
...
@@ -815,7 +797,7 @@ void WinEDA_ModuleEditFrame::Transform( MODULE* module, int transform )
break
;
break
;
default
:
default
:
DisplayInfoMessage
(
this
,
wxT
(
"Not avail
l
able"
)
);
DisplayInfoMessage
(
this
,
wxT
(
"Not available"
)
);
break
;
break
;
}
}
...
...
pcbnew/modedit_onclick.cpp
View file @
1a139a7f
...
@@ -16,12 +16,10 @@
...
@@ -16,12 +16,10 @@
#include "protos.h"
#include "protos.h"
#include "pcbnew_id.h"
#include "pcbnew_id.h"
/*************************************************************************/
void
WinEDA_ModuleEditFrame
::
OnLeftClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
)
/*************************************************************************/
/* Handle the left click in footprint editor
/* Handle the left click in footprint editor
*/
*/
void
WinEDA_ModuleEditFrame
::
OnLeftClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
)
{
{
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
...
@@ -48,10 +46,10 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -48,10 +46,10 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
default
:
default
:
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
msg
.
Printf
(
wxT
(
"WinEDA_ModEditFrame::OnLeftClick err: \
wxT
(
m_Flags != 0
\n
Struct @%p, type %d m_Flag %X"
),
"WinEDA_ModEditFrame::OnLeftClick err: m_Flags != 0
\n
Struct @%p, type %d m_Flag %X"
),
DrawStruct
,
DrawStruct
->
Type
(
),
DrawStruct
,
DrawStruct
->
Type
(),
DrawStruct
->
m_Flags
);
DrawStruct
->
m_Flags
);
DisplayError
(
this
,
msg
);
DisplayError
(
this
,
msg
);
DrawStruct
->
m_Flags
=
0
;
DrawStruct
->
m_Flags
=
0
;
break
;
break
;
...
@@ -109,18 +107,22 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -109,18 +107,22 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
Begin_Edge_Module
(
(
EDGE_MODULE
*
)
DrawStruct
,
DC
,
0
)
);
Begin_Edge_Module
(
(
EDGE_MODULE
*
)
DrawStruct
,
DC
,
0
)
);
}
}
else
else
DisplayError
(
this
,
wxT
(
"ProcessCommand error: DrawStruct/ flags error"
)
);
DisplayError
(
this
,
wxT
(
"ProcessCommand error: DrawStruct flags error"
)
);
}
}
break
;
break
;
case
ID_MODEDIT_DELETE_ITEM_BUTT
:
case
ID_MODEDIT_DELETE_ITEM_BUTT
:
if
(
DrawStruct
&&
(
DrawStruct
->
m_Flags
!=
0
)
)
// Item in edit, cannot delete it
// Item in edit, cannot delete it
if
(
DrawStruct
&&
(
DrawStruct
->
m_Flags
!=
0
)
)
break
;
break
;
DrawStruct
=
ModeditLocateAndDisplay
();
DrawStruct
=
ModeditLocateAndDisplay
();
if
(
DrawStruct
==
NULL
||
(
DrawStruct
->
m_Flags
!=
0
)
)
if
(
DrawStruct
==
NULL
||
(
DrawStruct
->
m_Flags
!=
0
)
)
break
;
break
;
if
(
DrawStruct
->
Type
()
!=
TYPE_MODULE
)
//GetBoard()->m_Modules )
// Cannot delete the module itself
if
(
DrawStruct
->
Type
()
!=
TYPE_MODULE
)
//GetBoard()->m_Modules )
{
{
// Cannot delete the module itself
SaveCopyInUndoList
(
GetBoard
()
->
m_Modules
,
UR_MODEDIT
);
SaveCopyInUndoList
(
GetBoard
()
->
m_Modules
,
UR_MODEDIT
);
RemoveStruct
(
DrawStruct
);
RemoveStruct
(
DrawStruct
);
DrawStruct
=
NULL
;
DrawStruct
=
NULL
;
...
@@ -133,11 +135,13 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -133,11 +135,13 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
MODULE
*
module
=
GetBoard
()
->
m_Modules
;
MODULE
*
module
=
GetBoard
()
->
m_Modules
;
module
->
m_Flags
=
0
;
module
->
m_Flags
=
0
;
SaveCopyInUndoList
(
module
,
UR_MODEDIT
);
SaveCopyInUndoList
(
module
,
UR_MODEDIT
);
Place_Ancre
(
module
);
// set the new relatives internal coordinates of items
Place_Ancre
(
module
);
// set the new relatives internal
// coordinates of items
GetScreen
()
->
m_Curseur
=
wxPoint
(
0
,
0
);
GetScreen
()
->
m_Curseur
=
wxPoint
(
0
,
0
);
Recadre_Trace
(
TRUE
);
Recadre_Trace
(
TRUE
);
// Replace the module in position 0, to recalculate absolutes coordinates of items
// Replace the module in position 0, to recalculate absolutes
// coordinates of items
module
->
SetPosition
(
wxPoint
(
0
,
0
)
);
module
->
SetPosition
(
wxPoint
(
0
,
0
)
);
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
...
@@ -160,7 +164,8 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -160,7 +164,8 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
default
:
default
:
DrawPanel
->
SetCursor
(
wxCURSOR_ARROW
);
DrawPanel
->
SetCursor
(
wxCURSOR_ARROW
);
DisplayError
(
this
,
wxT
(
"WinEDA_ModuleEditFrame::ProcessCommand error"
)
);
DisplayError
(
this
,
wxT
(
"WinEDA_ModuleEditFrame::ProcessCommand error"
)
);
m_ID_current_state
=
0
;
m_ID_current_state
=
0
;
break
;
break
;
}
}
...
@@ -169,28 +174,26 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -169,28 +174,26 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
}
}
/*********************************************************************/
bool
WinEDA_ModuleEditFrame
::
OnRightClick
(
const
wxPoint
&
MousePos
,
wxMenu
*
PopMenu
)
/*********************************************************************/
/* Handle the right click in the footprint editor:
/* Handle the right click in the footprint editor:
* Create the pull up menu
* Create the pull up menu
* After this menu is built, the standar
t
ZOOM menu is added
* After this menu is built, the standar
d
ZOOM menu is added
*/
*/
bool
WinEDA_ModuleEditFrame
::
OnRightClick
(
const
wxPoint
&
MousePos
,
wxMenu
*
PopMenu
)
{
{
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
wxString
msg
;
wxString
msg
;
bool
append_set_width
=
FALSE
;
bool
append_set_width
=
FALSE
;
bool
BlockActive
=
(
GetScreen
()
->
m_BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
bool
BlockActive
=
(
GetScreen
()
->
m_BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
// Simple loca
lisation des elements si possible
// Simple loca
tion of elements where possible.
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
m_Flags
==
0
)
)
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
m_Flags
==
0
)
)
{
{
SetCurItem
(
DrawStruct
=
ModeditLocateAndDisplay
()
);
SetCurItem
(
DrawStruct
=
ModeditLocateAndDisplay
()
);
}
}
//
Si commande en cours: affichage fin de commande
//
End command in progress.
if
(
m_ID_current_state
)
if
(
m_ID_current_state
)
{
{
if
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
if
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
...
@@ -207,23 +210,28 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -207,23 +210,28 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
{
{
if
(
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
||
BlockActive
)
if
(
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
||
BlockActive
)
{
{
if
(
BlockActive
)
// Put block comm
n
ands in list
if
(
BlockActive
)
// Put block commands in list
{
{
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_CANCEL_CURRENT_COMMAND
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_CANCEL_CURRENT_COMMAND
,
_
(
"Cancel Block"
),
cancel_xpm
);
_
(
"Cancel Block"
),
cancel_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_ZOOM_BLOCK
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_ZOOM_BLOCK
,
_
(
"Zoom Block (drag middle mouse)"
),
zoom_selected_xpm
);
_
(
"Zoom Block (drag middle mouse)"
),
zoom_selected_xpm
);
PopMenu
->
AppendSeparator
();
PopMenu
->
AppendSeparator
();
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PLACE_BLOCK
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PLACE_BLOCK
,
_
(
"Place Block"
),
apply_xpm
);
_
(
"Place Block"
),
apply_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_COPY_BLOCK
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_COPY_BLOCK
,
_
(
"Copy Block (shift + drag mouse)"
),
copyblock_xpm
);
_
(
"Copy Block (shift + drag mouse)"
),
copyblock_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_MIRROR_X_BLOCK
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_MIRROR_X_BLOCK
,
_
(
"Mirror Block (alt + drag mouse)"
),
mirror_H_xpm
);
_
(
"Mirror Block (alt + drag mouse)"
),
mirror_H_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_ROTATE_BLOCK
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_ROTATE_BLOCK
,
_
(
"Rotate Block (ctrl + drag mouse)"
),
rotate_pos_xpm
);
_
(
"Rotate Block (ctrl + drag mouse)"
),
rotate_pos_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_DELETE_BLOCK
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_DELETE_BLOCK
,
_
(
"Delete Block (shift+ctrl + drag mouse)"
),
delete_xpm
);
_
(
"Delete Block (shift+ctrl + drag mouse)"
),
delete_xpm
);
}
}
else
else
{
{
...
@@ -262,7 +270,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -262,7 +270,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_MOVE_PAD_REQUEST
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_MOVE_PAD_REQUEST
,
_
(
"Move Pad"
),
move_pad_xpm
);
_
(
"Move Pad"
),
move_pad_xpm
);
}
}
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EDIT_PAD
,
_
(
"Edit Pad"
),
options_pad_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EDIT_PAD
,
_
(
"Edit Pad"
),
options_pad_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_IMPORT_PAD_SETTINGS
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_IMPORT_PAD_SETTINGS
,
_
(
"New Pad Settings"
),
options_new_pad_xpm
);
_
(
"New Pad Settings"
),
options_new_pad_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EXPORT_PAD_SETTINGS
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EXPORT_PAD_SETTINGS
,
...
@@ -308,7 +317,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -308,7 +317,8 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
_
(
"Place edge"
),
apply_xpm
);
_
(
"Place edge"
),
apply_xpm
);
wxMenu
*
edit_mnu
=
new
wxMenu
;
wxMenu
*
edit_mnu
=
new
wxMenu
;
ADD_MENUITEM_WITH_SUBMENU
(
PopMenu
,
edit_mnu
,
ADD_MENUITEM_WITH_SUBMENU
(
PopMenu
,
edit_mnu
,
ID_POPUP_PCB_EDIT_EDGE
,
_
(
"Edit"
),
edit_xpm
);
ID_POPUP_PCB_EDIT_EDGE
,
_
(
"Edit"
),
edit_xpm
);
ADD_MENUITEM
(
edit_mnu
,
ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE
,
ADD_MENUITEM
(
edit_mnu
,
ID_POPUP_PCB_EDIT_WIDTH_CURRENT_EDGE
,
_
(
"Edit Width (Current)"
),
width_segment_xpm
);
_
(
"Edit Width (Current)"
),
width_segment_xpm
);
ADD_MENUITEM
(
edit_mnu
,
ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE
,
ADD_MENUITEM
(
edit_mnu
,
ID_POPUP_PCB_EDIT_WIDTH_ALL_EDGE
,
...
@@ -336,15 +346,13 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -336,15 +346,13 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
case
TYPE_SCREEN
:
case
TYPE_SCREEN
:
case
TYPE_NOT_INIT
:
case
TYPE_NOT_INIT
:
case
TYPE_PCB
:
case
TYPE_PCB
:
msg
.
Printf
(
msg
.
Printf
(
wxT
(
"WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d"
),
wxT
(
"WinEDA_ModuleEditFrame::OnRightClick Error: illegal DrawType %d"
),
DrawStruct
->
Type
()
);
DrawStruct
->
Type
()
);
DisplayError
(
this
,
msg
);
DisplayError
(
this
,
msg
);
break
;
break
;
default
:
default
:
msg
.
Printf
(
msg
.
Printf
(
wxT
(
"WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d"
),
wxT
(
"WinEDA_ModuleEditFrame::OnRightClick Error: unknown DrawType %d"
),
DrawStruct
->
Type
()
);
DrawStruct
->
Type
()
);
DisplayError
(
this
,
msg
);
DisplayError
(
this
,
msg
);
break
;
break
;
...
@@ -353,9 +361,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -353,9 +361,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
PopMenu
->
AppendSeparator
();
PopMenu
->
AppendSeparator
();
if
(
append_set_width
if
(
append_set_width
||
(
m_ID_current_state
&&
(
(
m_ID_current_state
==
ID_PCB_ADD_LINE_BUTT
)
||
(
m_ID_current_state
||
(
m_ID_current_state
==
ID_PCB_CIRCLE_BUTT
)
&&
(
(
m_ID_current_state
==
ID_PCB_ADD_LINE_BUTT
)
||
(
m_ID_current_state
==
ID_PCB_ARC_BUTT
)
)
)
)
||
(
m_ID_current_state
==
ID_PCB_CIRCLE_BUTT
)
||
(
m_ID_current_state
==
ID_PCB_ARC_BUTT
)
)
)
)
{
{
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_ENTER_EDGE_WIDTH
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_ENTER_EDGE_WIDTH
,
_
(
"Set Width"
),
width_segment_xpm
);
_
(
"Set Width"
),
width_segment_xpm
);
...
@@ -366,13 +375,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -366,13 +375,10 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
}
}
/****************************************************************************/
/* Handle the double click in the footprint editor:
void
WinEDA_ModuleEditFrame
::
OnLeftDClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
)
/****************************************************************************/
/* Handle the double click in the footprin editor:
* If the double clicked item is editable: call the corresponding editor.
* If the double clicked item is editable: call the corresponding editor.
*/
*/
void
WinEDA_ModuleEditFrame
::
OnLeftDClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
)
{
{
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
wxPoint
pos
=
GetPosition
();
wxPoint
pos
=
GetPosition
();
...
@@ -383,12 +389,12 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -383,12 +389,12 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
switch
(
m_ID_current_state
)
switch
(
m_ID_current_state
)
{
{
case
0
:
case
0
:
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
m_Flags
==
0
)
)
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
m_Flags
==
0
)
)
{
{
DrawStruct
=
ModeditLocateAndDisplay
();
DrawStruct
=
ModeditLocateAndDisplay
();
}
}
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
m_Flags
!=
0
)
)
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
m_Flags
!=
0
)
)
break
;
break
;
// Item found
// Item found
...
@@ -397,8 +403,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -397,8 +403,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
switch
(
DrawStruct
->
Type
()
)
switch
(
DrawStruct
->
Type
()
)
{
{
case
TYPE_PAD
:
case
TYPE_PAD
:
InstallPadOptionsFrame
(
InstallPadOptionsFrame
(
(
D_PAD
*
)
DrawStruct
,
&
dc
,
pos
);
(
D_PAD
*
)
DrawStruct
,
&
dc
,
pos
);
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
break
;
break
;
...
@@ -427,7 +432,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -427,7 +432,7 @@ void WinEDA_ModuleEditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case
ID_PCB_ADD_LINE_BUTT
:
case
ID_PCB_ADD_LINE_BUTT
:
{
{
if
(
DrawStruct
&&
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
if
(
DrawStruct
&&
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
{
{
End_Edge_Module
(
(
EDGE_MODULE
*
)
DrawStruct
,
DC
);
End_Edge_Module
(
(
EDGE_MODULE
*
)
DrawStruct
,
DC
);
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
...
...
pcbnew/modeditoptions.cpp
View file @
1a139a7f
/*******************************************************/
/***********************************************/
/* PCBNEW - Gestion des Options et Reglages de modeedit*/
/* PCBNEW - Footprint (module) editor options. */
/*******************************************************/
/***********************************************/
/* Fichier modeditoptions.cpp */
/*
Affichage et modifications des parametres de travail de Modedit
*/
#include "fctsys.h"
#include "fctsys.h"
#include "common.h"
#include "common.h"
...
@@ -21,70 +15,68 @@
...
@@ -21,70 +15,68 @@
#include "protos.h"
#include "protos.h"
void
WinEDA_ModuleEditFrame
::
OnSelectOptionToolbar
(
wxCommandEvent
&
event
)
/***********************************************************************/
void
WinEDA_ModuleEditFrame
::
OnSelectOptionToolbar
(
wxCommandEvent
&
event
)
/***********************************************************************/
{
{
int
id
=
event
.
GetId
();
int
id
=
event
.
GetId
();
wxClientDC
dc
(
DrawPanel
);
wxClientDC
dc
(
DrawPanel
);
DrawPanel
->
CursorOff
(
&
dc
);
DrawPanel
->
CursorOff
(
&
dc
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
switch
(
id
)
switch
(
id
)
{
{
case
ID_TB_OPTIONS_SHOW_GRID
:
case
ID_TB_OPTIONS_SHOW_GRID
:
m_Draw_Grid
=
m_OptionsToolBar
->
GetToolState
(
id
);
m_Draw_Grid
=
m_OptionsToolBar
->
GetToolState
(
id
);
DrawPanel
->
ReDraw
(
&
dc
,
TRUE
);
DrawPanel
->
ReDraw
(
&
dc
,
TRUE
);
break
;
break
;
case
ID_TB_OPTIONS_SELECT_UNIT_MM
:
case
ID_TB_OPTIONS_SELECT_UNIT_MM
:
g_UnitMetric
=
MILLIMETRE
;
g_UnitMetric
=
MILLIMETRE
;
case
ID_TB_OPTIONS_SELECT_UNIT_INCH
:
case
ID_TB_OPTIONS_SELECT_UNIT_INCH
:
if
(
id
==
ID_TB_OPTIONS_SELECT_UNIT_INCH
)
if
(
id
==
ID_TB_OPTIONS_SELECT_UNIT_INCH
)
g_UnitMetric
=
INCHES
;
g_UnitMetric
=
INCHES
;
UpdateStatusBar
();
/* Reaffichage des coord curseur */
UpdateStatusBar
();
ReCreateAuxiliaryToolbar
();
ReCreateAuxiliaryToolbar
();
break
;
break
;
case
ID_TB_OPTIONS_SHOW_POLAR_COORD
:
case
ID_TB_OPTIONS_SHOW_POLAR_COORD
:
Affiche_Message
(
wxEmptyString
);
Affiche_Message
(
wxEmptyString
);
DisplayOpt
.
DisplayPolarCood
=
m_OptionsToolBar
->
GetToolState
(
id
);
DisplayOpt
.
DisplayPolarCood
=
m_OptionsToolBar
->
GetToolState
(
id
);
UpdateStatusBar
();
/* Reaffichage des coord curseur */
UpdateStatusBar
();
break
;
break
;
case
ID_TB_OPTIONS_SELECT_CURSOR
:
case
ID_TB_OPTIONS_SELECT_CURSOR
:
m_CursorShape
=
m_OptionsToolBar
->
GetToolState
(
id
);
m_CursorShape
=
m_OptionsToolBar
->
GetToolState
(
id
);
break
;
break
;
case
ID_TB_OPTIONS_SHOW_PADS_SKETCH
:
case
ID_TB_OPTIONS_SHOW_PADS_SKETCH
:
m_DisplayPadFill
=
!
m_OptionsToolBar
->
GetToolState
(
id
);
m_DisplayPadFill
=
!
m_OptionsToolBar
->
GetToolState
(
id
);
DrawPanel
->
ReDraw
(
&
dc
,
TRUE
);
DrawPanel
->
ReDraw
(
&
dc
,
TRUE
);
break
;
break
;
case
ID_TB_OPTIONS_SHOW_VIAS_SKETCH
:
case
ID_TB_OPTIONS_SHOW_VIAS_SKETCH
:
m_DisplayViaFill
=
!
m_OptionsToolBar
->
GetToolState
(
id
);
m_DisplayViaFill
=
!
m_OptionsToolBar
->
GetToolState
(
id
);
DrawPanel
->
ReDraw
(
&
dc
,
TRUE
);
DrawPanel
->
ReDraw
(
&
dc
,
TRUE
);
break
;
break
;
case
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH
:
case
ID_TB_OPTIONS_SHOW_MODULE_TEXT_SKETCH
:
m_DisplayModText
=
m_DisplayModText
=
m_OptionsToolBar
->
GetToolState
(
id
)
?
SKETCH
:
FILLED
;
m_OptionsToolBar
->
GetToolState
(
id
)
?
SKETCH
:
FILLED
;
DrawPanel
->
ReDraw
(
&
dc
,
TRUE
);
DrawPanel
->
ReDraw
(
&
dc
,
TRUE
);
break
;
break
;
case
ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH
:
case
ID_TB_OPTIONS_SHOW_MODULE_EDGE_SKETCH
:
m_DisplayModEdge
=
m_DisplayModEdge
=
m_OptionsToolBar
->
GetToolState
(
id
)
?
SKETCH
:
FILLED
;
m_OptionsToolBar
->
GetToolState
(
id
)
?
SKETCH
:
FILLED
;
DrawPanel
->
ReDraw
(
&
dc
,
TRUE
);
DrawPanel
->
ReDraw
(
&
dc
,
TRUE
);
break
;
break
;
default
:
default
:
DisplayError
(
this
,
wxT
(
"WinEDA_ModuleEditFrame::OnSelectOptionToolbar error"
)
);
DisplayError
(
this
,
wxT
(
"WinEDA_ModuleEditFrame::OnSelectOptionToolbar error"
)
);
break
;
break
;
}
}
SetToolbars
();
SetToolbars
();
DrawPanel
->
CursorOn
(
&
dc
);
DrawPanel
->
CursorOn
(
&
dc
);
}
}
pcbnew/moduleframe.cpp
View file @
1a139a7f
/************************************************************
***************
/
/************************************************************/
/* moduleframe.cpp -
fonctions de base de la classe WinEDA_ModuleEditFrame
*/
/* moduleframe.cpp -
Footprint (module) editor main window.
*/
/************************************************************
***************
/
/************************************************************/
#ifdef __GNUG__
#ifdef __GNUG__
#pragma implementation
#pragma implementation
...
@@ -20,132 +20,129 @@
...
@@ -20,132 +20,129 @@
#include "3d_viewer.h"
#include "3d_viewer.h"
// local variables:
static
PCB_SCREEN
*
s_screenModule
=
NULL
;
// the PCB_SCREEN used by the
static
PCB_SCREEN
*
s_screenModule
=
NULL
;
// the PCB_SCREEN used by the
footprint editor
//
footprint editor
/********************************/
/********************************/
/* class WinEDA_ModuleEditFrame */
/* class WinEDA_ModuleEditFrame */
/********************************/
/********************************/
BEGIN_EVENT_TABLE
(
WinEDA_ModuleEditFrame
,
WinEDA_BasePcbFrame
)
BEGIN_EVENT_TABLE
(
WinEDA_ModuleEditFrame
,
WinEDA_BasePcbFrame
)
EVT_MENU_RANGE
(
ID_POPUP_PCB_ITEM_SELECTION_START
,
EVT_MENU_RANGE
(
ID_POPUP_PCB_ITEM_SELECTION_START
,
ID_POPUP_PCB_ITEM_SELECTION_END
,
ID_POPUP_PCB_ITEM_SELECTION_END
,
WinEDA_BasePcbFrame
::
ProcessItemSelection
)
WinEDA_BasePcbFrame
::
ProcessItemSelection
)
EVT_CLOSE
(
WinEDA_ModuleEditFrame
::
OnCloseWindow
)
EVT_CLOSE
(
WinEDA_ModuleEditFrame
::
OnCloseWindow
)
EVT_SIZE
(
WinEDA_ModuleEditFrame
::
OnSize
)
EVT_SIZE
(
WinEDA_ModuleEditFrame
::
OnSize
)
EVT_KICAD_CHOICEBOX
(
ID_ON_ZOOM_SELECT
,
WinEDA_ModuleEditFrame
::
OnSelectZoom
)
EVT_KICAD_CHOICEBOX
(
ID_ON_ZOOM_SELECT
,
EVT_KICAD_CHOICEBOX
(
ID_ON_GRID_SELECT
,
WinEDA_ModuleEditFrame
::
OnSelectGrid
)
WinEDA_ModuleEditFrame
::
OnSelectZoom
)
EVT_KICAD_CHOICEBOX
(
ID_ON_GRID_SELECT
,
WinEDA_ModuleEditFrame
::
OnSelectGrid
)
EVT_TOOL_RANGE
(
ID_ZOOM_IN
,
ID_ZOOM_PAGE
,
WinEDA_ModuleEditFrame
::
OnZoom
)
EVT_TOOL_RANGE
(
ID_ZOOM_IN
,
ID_ZOOM_PAGE
,
WinEDA_ModuleEditFrame
::
OnZoom
)
EVT_TOOL
(
ID_MODEDIT_SELECT_CURRENT_LIB
,
EVT_TOOL
(
ID_MODEDIT_SELECT_CURRENT_LIB
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_SAVE_LIBMODULE
,
EVT_TOOL
(
ID_MODEDIT_SAVE_LIBMODULE
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_DELETE_PART
,
EVT_TOOL
(
ID_MODEDIT_DELETE_PART
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_NEW_MODULE
,
EVT_TOOL
(
ID_MODEDIT_NEW_MODULE
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_LOAD_MODULE
,
EVT_TOOL
(
ID_MODEDIT_LOAD_MODULE
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_IMPORT_PART
,
EVT_TOOL
(
ID_MODEDIT_IMPORT_PART
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_EXPORT_PART
,
EVT_TOOL
(
ID_MODEDIT_EXPORT_PART
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART
,
EVT_TOOL
(
ID_MODEDIT_CREATE_NEW_LIB_AND_SAVE_CURRENT_PART
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_SHEET_SET
,
EVT_TOOL
(
ID_MODEDIT_SHEET_SET
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_GEN_PRINT
,
WinEDA_ModuleEditFrame
::
ToPrinter
)
EVT_TOOL
(
ID_GEN_PRINT
,
WinEDA_ModuleEditFrame
::
ToPrinter
)
EVT_TOOL
(
ID_MODEDIT_LOAD_MODULE
,
EVT_TOOL
(
ID_MODEDIT_LOAD_MODULE
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_CHECK
,
EVT_TOOL
(
ID_MODEDIT_CHECK
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_PAD_SETTINGS
,
EVT_TOOL
(
ID_MODEDIT_PAD_SETTINGS
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_LOAD_MODULE_FROM_BOARD
,
EVT_TOOL
(
ID_MODEDIT_LOAD_MODULE_FROM_BOARD
,
WinEDA_ModuleEditFrame
::
LoadModuleFromBoard
)
WinEDA_ModuleEditFrame
::
LoadModuleFromBoard
)
EVT_TOOL
(
ID_MODEDIT_INSERT_MODULE_IN_BOARD
,
EVT_TOOL
(
ID_MODEDIT_INSERT_MODULE_IN_BOARD
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_UPDATE_MODULE_IN_BOARD
,
EVT_TOOL
(
ID_MODEDIT_UPDATE_MODULE_IN_BOARD
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_EDIT_MODULE_PROPERTIES
,
EVT_TOOL
(
ID_MODEDIT_EDIT_MODULE_PROPERTIES
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_UNDO
,
EVT_TOOL
(
ID_MODEDIT_UNDO
,
WinEDA_ModuleEditFrame
::
GetComponentFromUndoList
)
WinEDA_ModuleEditFrame
::
GetComponentFromUndoList
)
EVT_TOOL
(
ID_MODEDIT_REDO
,
EVT_TOOL
(
ID_MODEDIT_REDO
,
WinEDA_ModuleEditFrame
::
GetComponentFromRedoList
)
WinEDA_ModuleEditFrame
::
GetComponentFromRedoList
)
// Vertical toolbar (left click):
// Vertical toolbar (left click):
EVT_TOOL
(
ID_NO_SELECT_BUTT
,
EVT_TOOL
(
ID_NO_SELECT_BUTT
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_ADD_PAD
,
EVT_TOOL
(
ID_MODEDIT_ADD_PAD
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_ARC_BUTT
,
EVT_TOOL
(
ID_PCB_ARC_BUTT
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_CIRCLE_BUTT
,
EVT_TOOL
(
ID_PCB_CIRCLE_BUTT
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_ADD_TEXT_BUTT
,
EVT_TOOL
(
ID_PCB_ADD_TEXT_BUTT
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_ADD_LINE_BUTT
,
EVT_TOOL
(
ID_PCB_ADD_LINE_BUTT
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_DELETE_ITEM_BUTT
,
EVT_TOOL
(
ID_MODEDIT_DELETE_ITEM_BUTT
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_MODEDIT_PLACE_ANCHOR
,
EVT_TOOL
(
ID_MODEDIT_PLACE_ANCHOR
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
// Vertical toolbar (right click):
// Vertical toolbar (right click):
EVT_TOOL_RCLICKED
(
ID_MODEDIT_ADD_PAD
,
EVT_TOOL_RCLICKED
(
ID_MODEDIT_ADD_PAD
,
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_TRACK_BUTT
,
EVT_TOOL_RCLICKED
(
ID_TRACK_BUTT
,
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_CIRCLE_BUTT
,
EVT_TOOL_RCLICKED
(
ID_PCB_CIRCLE_BUTT
,
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_ARC_BUTT
,
EVT_TOOL_RCLICKED
(
ID_PCB_ARC_BUTT
,
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_ADD_TEXT_BUTT
,
EVT_TOOL_RCLICKED
(
ID_PCB_ADD_TEXT_BUTT
,
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_ADD_LINE_BUTT
,
EVT_TOOL_RCLICKED
(
ID_PCB_ADD_LINE_BUTT
,
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_COTATION_BUTT
,
EVT_TOOL_RCLICKED
(
ID_PCB_COTATION_BUTT
,
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
WinEDA_ModuleEditFrame
::
ToolOnRightClick
)
// Options Toolbar
// Options Toolbar
EVT_TOOL_RANGE
(
ID_TB_OPTIONS_START
,
ID_TB_OPTIONS_END
,
EVT_TOOL_RANGE
(
ID_TB_OPTIONS_START
,
ID_TB_OPTIONS_END
,
WinEDA_ModuleEditFrame
::
OnSelectOptionToolbar
)
WinEDA_ModuleEditFrame
::
OnSelectOptionToolbar
)
// popup commands
// popup commands
EVT_MENU_RANGE
(
ID_POPUP_PCB_START_RANGE
,
ID_POPUP_PCB_END_RANGE
,
EVT_MENU_RANGE
(
ID_POPUP_PCB_START_RANGE
,
ID_POPUP_PCB_END_RANGE
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_MENU_RANGE
(
ID_POPUP_GENERAL_START_RANGE
,
ID_POPUP_GENERAL_END_RANGE
,
EVT_MENU_RANGE
(
ID_POPUP_GENERAL_START_RANGE
,
ID_POPUP_GENERAL_END_RANGE
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
// Transformations du module
// Module transformations
EVT_MENU
(
ID_MODEDIT_MODULE_ROTATE
,
EVT_MENU
(
ID_MODEDIT_MODULE_ROTATE
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_MODEDIT_MODULE_MIRROR
,
EVT_MENU
(
ID_MODEDIT_MODULE_MIRROR
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_PCB_DRAWINGS_WIDTHS_SETUP
,
EVT_MENU
(
ID_PCB_DRAWINGS_WIDTHS_SETUP
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_PCB_PAD_SETUP
,
EVT_MENU
(
ID_PCB_PAD_SETUP
,
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
WinEDA_ModuleEditFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_PCB_USER_GRID_SETUP
,
EVT_MENU
(
ID_PCB_USER_GRID_SETUP
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
// Menu 3D Frame
// Menu 3D Frame
EVT_MENU
(
ID_MENU_PCB_SHOW_3D_FRAME
,
WinEDA_ModuleEditFrame
::
Show3D_Frame
)
EVT_MENU
(
ID_MENU_PCB_SHOW_3D_FRAME
,
WinEDA_ModuleEditFrame
::
Show3D_Frame
)
// PopUp Menu Zoom trait�s dans drawpanel.cpp
END_EVENT_TABLE
()
END_EVENT_TABLE
()
/****************/
/* Constructeur */
/****************/
WinEDA_ModuleEditFrame
::
WinEDA_ModuleEditFrame
(
wxWindow
*
father
,
WinEDA_ModuleEditFrame
::
WinEDA_ModuleEditFrame
(
wxWindow
*
father
,
const
wxString
&
title
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxPoint
&
pos
,
...
@@ -189,54 +186,56 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
...
@@ -189,54 +186,56 @@ WinEDA_ModuleEditFrame::WinEDA_ModuleEditFrame( wxWindow* father,
if
(
DrawPanel
)
if
(
DrawPanel
)
DrawPanel
->
m_Block_Enable
=
TRUE
;
DrawPanel
->
m_Block_Enable
=
TRUE
;
#if defined(KICAD_AUIMANAGER)
#if defined(KICAD_AUIMANAGER)
m_auimgr
.
SetManagedWindow
(
this
);
m_auimgr
.
SetManagedWindow
(
this
);
wxAuiPaneInfo
horiz
;
wxAuiPaneInfo
horiz
;
horiz
.
Gripper
(
false
);
horiz
.
Gripper
(
false
);
horiz
.
DockFixed
(
true
);
horiz
.
DockFixed
(
true
);
horiz
.
Movable
(
false
);
horiz
.
Movable
(
false
);
horiz
.
Floatable
(
false
);
horiz
.
Floatable
(
false
);
horiz
.
CloseButton
(
false
);
horiz
.
CloseButton
(
false
);
horiz
.
CaptionVisible
(
false
);
horiz
.
CaptionVisible
(
false
);
wxAuiPaneInfo
vert
(
horiz
);
wxAuiPaneInfo
vert
(
horiz
);
vert
.
TopDockable
(
false
).
BottomDockable
(
false
);
vert
.
TopDockable
(
false
).
BottomDockable
(
false
);
horiz
.
LeftDockable
(
false
).
RightDockable
(
false
);
horiz
.
LeftDockable
(
false
).
RightDockable
(
false
);
m_auimgr
.
AddPane
(
m_HToolBar
,
m_auimgr
.
AddPane
(
m_HToolBar
,
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_HToolBar"
)).
Top
().
Row
(
0
));
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_HToolBar"
)
).
Top
().
Row
(
0
)
);
m_auimgr
.
AddPane
(
m_AuxiliaryToolBar
,
m_auimgr
.
AddPane
(
m_AuxiliaryToolBar
,
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_AuxiliaryToolBar"
)).
Top
().
Row
(
1
));
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_AuxiliaryToolBar"
)
).
Top
().
Row
(
1
)
);
m_auimgr
.
AddPane
(
m_VToolBar
,
m_auimgr
.
AddPane
(
m_VToolBar
,
wxAuiPaneInfo
(
vert
).
Name
(
wxT
(
"m_VToolBar"
)).
Right
()
);
wxAuiPaneInfo
(
vert
).
Name
(
wxT
(
"m_VToolBar"
)
).
Right
()
);
m_auimgr
.
AddPane
(
m_OptionsToolBar
,
m_auimgr
.
AddPane
(
m_OptionsToolBar
,
wxAuiPaneInfo
(
vert
).
Name
(
wxT
(
"m_OptionsToolBar"
)).
Left
());
wxAuiPaneInfo
(
vert
).
Name
(
wxT
(
"m_OptionsToolBar"
)
).
Left
()
);
m_auimgr
.
AddPane
(
DrawPanel
,
m_auimgr
.
AddPane
(
DrawPanel
,
wxAuiPaneInfo
().
Name
(
wxT
(
"DrawFrame"
)).
CentrePane
()
);
wxAuiPaneInfo
().
Name
(
wxT
(
"DrawFrame"
)
).
CentrePane
()
);
m_auimgr
.
AddPane
(
MsgPanel
,
m_auimgr
.
AddPane
(
MsgPanel
,
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"MsgPanel"
)).
Bottom
()
);
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"MsgPanel"
)
).
Bottom
()
);
m_auimgr
.
Update
();
m_auimgr
.
Update
();
#endif
#endif
}
}
/****************************************************/
WinEDA_ModuleEditFrame
::~
WinEDA_ModuleEditFrame
()
WinEDA_ModuleEditFrame
::~
WinEDA_ModuleEditFrame
()
/****************************************************/
{
{
/* g_ModuleEditor_Pcb and its correspondinf PCB_SCREEN are not deleted here,
/* g_ModuleEditor_Pcb and its corresponding PCB_SCREEN are not deleted
* because if we reopen the Footprint editor, we expect to find the last edited item
* here, because if we reopen the Footprint editor, we expect to find
* the last edited item
*/
*/
SetBaseScreen
(
NULL
);
/* Do not delete (by the destructor of WinEDA_DrawFrame)
SetBaseScreen
(
NULL
);
/* Do not delete (by the destructor of
* the PCB_SCREEN handling g_ModuleEditor_Pcb
* WinEDA_DrawFrame) the PCB_SCREEN handling
* g_ModuleEditor_Pcb
*/
*/
WinEDA_BasePcbFrame
*
frame
=
(
WinEDA_BasePcbFrame
*
)
GetParent
();
WinEDA_BasePcbFrame
*
frame
=
(
WinEDA_BasePcbFrame
*
)
GetParent
();
...
@@ -245,9 +244,7 @@ WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
...
@@ -245,9 +244,7 @@ WinEDA_ModuleEditFrame::~WinEDA_ModuleEditFrame()
}
}
/**************************************************************/
void
WinEDA_ModuleEditFrame
::
OnCloseWindow
(
wxCloseEvent
&
Event
)
void
WinEDA_ModuleEditFrame
::
OnCloseWindow
(
wxCloseEvent
&
Event
)
/**************************************************************/
{
{
if
(
GetScreen
()
->
IsModify
()
)
if
(
GetScreen
()
->
IsModify
()
)
{
{
...
@@ -286,7 +283,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
...
@@ -286,7 +283,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
active
);
active
);
m_HToolBar
->
EnableTool
(
ID_MODEDIT_SAVE_LIBMODULE
,
active
&&
islib
);
m_HToolBar
->
EnableTool
(
ID_MODEDIT_SAVE_LIBMODULE
,
active
&&
islib
);
MODULE
*
module_in_edit
=
GetBoard
()
->
m_Modules
;
MODULE
*
module_in_edit
=
GetBoard
()
->
m_Modules
;
if
(
module_in_edit
&&
module_in_edit
->
m_Link
)
// this is not a new module ...
if
(
module_in_edit
&&
module_in_edit
->
m_Link
)
// this is not a new module
// ...
{
{
BOARD
*
mainpcb
=
frame
->
GetBoard
();
BOARD
*
mainpcb
=
frame
->
GetBoard
();
MODULE
*
source_module
=
mainpcb
->
m_Modules
;
MODULE
*
source_module
=
mainpcb
->
m_Modules
;
...
@@ -303,7 +301,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
...
@@ -303,7 +301,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
m_HToolBar
->
EnableTool
(
ID_MODEDIT_INSERT_MODULE_IN_BOARD
,
false
);
m_HToolBar
->
EnableTool
(
ID_MODEDIT_INSERT_MODULE_IN_BOARD
,
false
);
m_HToolBar
->
EnableTool
(
ID_MODEDIT_UPDATE_MODULE_IN_BOARD
,
true
);
m_HToolBar
->
EnableTool
(
ID_MODEDIT_UPDATE_MODULE_IN_BOARD
,
true
);
}
}
else
// The source was deleted, therefore we can insert but not update the module
else
// The source was deleted, therefore we can insert but not
// update the module
{
{
m_HToolBar
->
EnableTool
(
ID_MODEDIT_INSERT_MODULE_IN_BOARD
,
true
);
m_HToolBar
->
EnableTool
(
ID_MODEDIT_INSERT_MODULE_IN_BOARD
,
true
);
m_HToolBar
->
EnableTool
(
ID_MODEDIT_UPDATE_MODULE_IN_BOARD
,
false
);
m_HToolBar
->
EnableTool
(
ID_MODEDIT_UPDATE_MODULE_IN_BOARD
,
false
);
...
@@ -317,8 +316,10 @@ void WinEDA_ModuleEditFrame::SetToolbars()
...
@@ -317,8 +316,10 @@ void WinEDA_ModuleEditFrame::SetToolbars()
if
(
GetScreen
()
)
if
(
GetScreen
()
)
{
{
m_HToolBar
->
EnableTool
(
ID_MODEDIT_UNDO
,
GetScreen
()
->
GetUndoCommandCount
()
>
0
&&
active
);
m_HToolBar
->
EnableTool
(
ID_MODEDIT_UNDO
,
m_HToolBar
->
EnableTool
(
ID_MODEDIT_REDO
,
GetScreen
()
->
GetRedoCommandCount
()
>
0
&&
active
);
GetScreen
()
->
GetUndoCommandCount
()
>
0
&&
active
);
m_HToolBar
->
EnableTool
(
ID_MODEDIT_REDO
,
GetScreen
()
->
GetRedoCommandCount
()
>
0
&&
active
);
}
}
if
(
frame
->
GetBoard
()
->
m_Modules
)
if
(
frame
->
GetBoard
()
->
m_Modules
)
...
@@ -344,8 +345,10 @@ void WinEDA_ModuleEditFrame::SetToolbars()
...
@@ -344,8 +345,10 @@ void WinEDA_ModuleEditFrame::SetToolbars()
if
(
m_OptionsToolBar
)
if
(
m_OptionsToolBar
)
{
{
m_OptionsToolBar
->
ToggleTool
(
ID_TB_OPTIONS_SELECT_UNIT_MM
,
m_OptionsToolBar
->
ToggleTool
(
g_UnitMetric
==
MILLIMETRE
?
TRUE
:
false
);
ID_TB_OPTIONS_SELECT_UNIT_MM
,
g_UnitMetric
==
MILLIMETRE
?
TRUE
:
false
);
m_OptionsToolBar
->
ToggleTool
(
ID_TB_OPTIONS_SELECT_UNIT_INCH
,
m_OptionsToolBar
->
ToggleTool
(
ID_TB_OPTIONS_SELECT_UNIT_INCH
,
g_UnitMetric
==
INCHES
?
TRUE
:
false
);
g_UnitMetric
==
INCHES
?
TRUE
:
false
);
...
@@ -353,13 +356,15 @@ void WinEDA_ModuleEditFrame::SetToolbars()
...
@@ -353,13 +356,15 @@ void WinEDA_ModuleEditFrame::SetToolbars()
DisplayOpt
.
DisplayPolarCood
);
DisplayOpt
.
DisplayPolarCood
);
m_OptionsToolBar
->
SetToolShortHelp
(
ID_TB_OPTIONS_SHOW_POLAR_COORD
,
m_OptionsToolBar
->
SetToolShortHelp
(
ID_TB_OPTIONS_SHOW_POLAR_COORD
,
DisplayOpt
.
DisplayPolarCood
?
DisplayOpt
.
DisplayPolarCood
?
_
(
"Polar Coords not show
"
)
:
_
(
"Display rectangular coordinates
"
)
:
_
(
"Display Polar Coord
s"
)
);
_
(
"Display polar coordinate
s"
)
);
m_OptionsToolBar
->
ToggleTool
(
ID_TB_OPTIONS_SHOW_GRID
,
m_OptionsToolBar
->
ToggleTool
(
ID_TB_OPTIONS_SHOW_GRID
,
m_Draw_Grid
);
m_Draw_Grid
);
m_OptionsToolBar
->
SetToolShortHelp
(
ID_TB_OPTIONS_SHOW_GRID
,
m_OptionsToolBar
->
SetToolShortHelp
(
ID_TB_OPTIONS_SHOW_GRID
,
m_Draw_Grid
?
_
(
"Grid not show"
)
:
_
(
"Show Grid"
)
);
m_Draw_Grid
?
_
(
"Hide grid"
)
:
_
(
"Show grid"
)
);
m_OptionsToolBar
->
ToggleTool
(
ID_TB_OPTIONS_SELECT_CURSOR
,
m_OptionsToolBar
->
ToggleTool
(
ID_TB_OPTIONS_SELECT_CURSOR
,
...
@@ -371,8 +376,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
...
@@ -371,8 +376,8 @@ void WinEDA_ModuleEditFrame::SetToolbars()
m_OptionsToolBar
->
SetToolShortHelp
(
ID_TB_OPTIONS_SHOW_PADS_SKETCH
,
m_OptionsToolBar
->
SetToolShortHelp
(
ID_TB_OPTIONS_SHOW_PADS_SKETCH
,
m_DisplayPadFill
?
m_DisplayPadFill
?
_
(
"Show Pads S
ketch mode"
)
:
_
(
"Show pads in s
ketch mode"
)
:
_
(
"Show pads
filled mode"
)
);
_
(
"Show pads in
filled mode"
)
);
}
}
if
(
m_AuxiliaryToolBar
)
if
(
m_AuxiliaryToolBar
)
...
@@ -401,7 +406,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
...
@@ -401,7 +406,7 @@ void WinEDA_ModuleEditFrame::SetToolbars()
DisplayUnitsMsg
();
DisplayUnitsMsg
();
#if defined(KICAD_AUIMANAGER)
#if defined(KICAD_AUIMANAGER)
if
(
m_auimgr
.
GetManagedWindow
()
)
if
(
m_auimgr
.
GetManagedWindow
()
)
m_auimgr
.
Update
();
m_auimgr
.
Update
();
#endif
#endif
}
}
...
@@ -456,25 +461,25 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
...
@@ -456,25 +461,25 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
switch
(
g_KeyPressed
)
switch
(
g_KeyPressed
)
{
{
case
WXK_NUMPAD8
:
/* Deplacement curseur vers le haut */
case
WXK_NUMPAD8
:
case
WXK_UP
:
case
WXK_UP
:
Mouse
.
y
-=
wxRound
(
delta
.
y
);
Mouse
.
y
-=
wxRound
(
delta
.
y
);
DrawPanel
->
MouseTo
(
Mouse
);
DrawPanel
->
MouseTo
(
Mouse
);
break
;
break
;
case
WXK_NUMPAD2
:
/* Deplacement curseur vers le bas */
case
WXK_NUMPAD2
:
case
WXK_DOWN
:
case
WXK_DOWN
:
Mouse
.
y
+=
wxRound
(
delta
.
y
);
Mouse
.
y
+=
wxRound
(
delta
.
y
);
DrawPanel
->
MouseTo
(
Mouse
);
DrawPanel
->
MouseTo
(
Mouse
);
break
;
break
;
case
WXK_NUMPAD4
:
/* Deplacement curseur vers la gauche */
case
WXK_NUMPAD4
:
case
WXK_LEFT
:
case
WXK_LEFT
:
Mouse
.
x
-=
wxRound
(
delta
.
x
);
Mouse
.
x
-=
wxRound
(
delta
.
x
);
DrawPanel
->
MouseTo
(
Mouse
);
DrawPanel
->
MouseTo
(
Mouse
);
break
;
break
;
case
WXK_NUMPAD6
:
/* Deplacement curseur vers la droite */
case
WXK_NUMPAD6
:
case
WXK_RIGHT
:
case
WXK_RIGHT
:
Mouse
.
x
+=
wxRound
(
delta
.
x
);
Mouse
.
x
+=
wxRound
(
delta
.
x
);
DrawPanel
->
MouseTo
(
Mouse
);
DrawPanel
->
MouseTo
(
Mouse
);
...
@@ -485,10 +490,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
...
@@ -485,10 +490,7 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
break
;
break
;
}
}
/* Recalcul de la position du curseur schema */
GetScreen
()
->
m_Curseur
=
curpos
;
GetScreen
()
->
m_Curseur
=
curpos
;
/* Placement sur la grille generale */
PutOnGrid
(
&
GetScreen
()
->
m_Curseur
);
PutOnGrid
(
&
GetScreen
()
->
m_Curseur
);
if
(
oldpos
!=
GetScreen
()
->
m_Curseur
)
if
(
oldpos
!=
GetScreen
()
->
m_Curseur
)
...
@@ -517,5 +519,5 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
...
@@ -517,5 +519,5 @@ void WinEDA_ModuleEditFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
}
}
SetToolbars
();
SetToolbars
();
UpdateStatusBar
();
/* Affichage des coord curseur */
UpdateStatusBar
();
}
}
pcbnew/modules.cpp
View file @
1a139a7f
/********************************************************/
/***************/
/* Modification de la place, orient, nombre des MODULES */
/* modules.cpp */
/********************************************************/
/***************/
/* Fichier MODULES.Cpp */
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -18,24 +16,20 @@
...
@@ -18,24 +16,20 @@
#include "drag.h"
#include "drag.h"
/* fonctions externes */
/* Fonctions locales */
static
void
Abort_MoveOrCopyModule
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
void
Abort_MoveOrCopyModule
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
/* Variables locales : */
static
MODULE
*
s_ModuleInitialCopy
=
NULL
;
// Copy of module for abort/undo command
static
PICKED_ITEMS_LIST
s_PickedList
;
// a picked list to save initial module and dragged tracks
static
MODULE
*
s_ModuleInitialCopy
=
NULL
;
// Copy of module for
// abort/undo command
static
PICKED_ITEMS_LIST
s_PickedList
;
// a picked list to
// save initial module
// and dragged tracks
/*************************************************************************/
void
Show_Pads_On_Off
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
MODULE
*
module
)
/**************************************************************************/
/* Fonction appelee lors de l'activation/desactivation de la visualisation
/* Show or hide module pads.
* des Pads du module en deplacement
* Effacement ou visu des Pads selon conditions initiales
*/
*/
void
Show_Pads_On_Off
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
MODULE
*
module
)
{
{
D_PAD
*
pt_pad
;
D_PAD
*
pt_pad
;
bool
pad_fill_tmp
;
bool
pad_fill_tmp
;
...
@@ -55,11 +49,8 @@ void Show_Pads_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
...
@@ -55,11 +49,8 @@ void Show_Pads_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
}
}
/***************************************************************************/
/* Show or hide ratsnest
/* Fonction appelee lors de l'activation/desactivation de la visualisation */
*/
/* du rastnest du module en deplacement */
/* Effacement ou visu du rastnest selon conditions initiales */
/***************************************************************************/
void
Rastnest_On_Off
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
MODULE
*
module
)
void
Rastnest_On_Off
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
MODULE
*
module
)
{
{
WinEDA_BasePcbFrame
*
frame
=
(
WinEDA_BasePcbFrame
*
)
panel
->
m_Parent
;
WinEDA_BasePcbFrame
*
frame
=
(
WinEDA_BasePcbFrame
*
)
panel
->
m_Parent
;
...
@@ -69,17 +60,14 @@ void Rastnest_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
...
@@ -69,17 +60,14 @@ void Rastnest_On_Off( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
}
}
/***************************************************/
MODULE
*
WinEDA_BasePcbFrame
::
GetModuleByName
()
/***************************************************/
/* Get a module name from user and return a pointer to the corresponding module
/* Get a module name from user and return a pointer to the corresponding module
*/
*/
MODULE
*
WinEDA_BasePcbFrame
::
GetModuleByName
()
{
{
wxString
modulename
;
wxString
modulename
;
MODULE
*
module
=
NULL
;
MODULE
*
module
=
NULL
;
Get_Message
(
_
(
"Name:"
),
_
(
"Search footprint"
),
modulename
,
this
);
Get_Message
(
_
(
"Name:"
),
_
(
"Search footprint"
),
modulename
,
this
);
if
(
!
modulename
.
IsEmpty
()
)
if
(
!
modulename
.
IsEmpty
()
)
{
{
module
=
GetBoard
()
->
m_Modules
;
module
=
GetBoard
()
->
m_Modules
;
...
@@ -94,11 +82,8 @@ MODULE* WinEDA_BasePcbFrame::GetModuleByName()
...
@@ -94,11 +82,8 @@ MODULE* WinEDA_BasePcbFrame::GetModuleByName()
}
}
/**********************************************************************/
void
WinEDA_PcbFrame
::
StartMove_Module
(
MODULE
*
module
,
wxDC
*
DC
)
void
WinEDA_PcbFrame
::
StartMove_Module
(
MODULE
*
module
,
wxDC
*
DC
)
/**********************************************************************/
{
{
if
(
module
==
NULL
)
if
(
module
==
NULL
)
return
;
return
;
...
@@ -106,8 +91,8 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
...
@@ -106,8 +91,8 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
delete
s_ModuleInitialCopy
;
delete
s_ModuleInitialCopy
;
s_PickedList
.
ClearItemsList
();
// Should be empty, but...
s_PickedList
.
ClearItemsList
();
// Should be empty, but...
// Creates a copy of the cu
tt
ent module, for abort and undo commands
// Creates a copy of the cu
rr
ent module, for abort and undo commands
s_ModuleInitialCopy
=
new
MODULE
(
GetBoard
());
s_ModuleInitialCopy
=
new
MODULE
(
GetBoard
()
);
s_ModuleInitialCopy
->
Copy
(
module
);
s_ModuleInitialCopy
->
Copy
(
module
);
s_ModuleInitialCopy
->
m_Flags
=
0
;
s_ModuleInitialCopy
->
m_Flags
=
0
;
...
@@ -118,7 +103,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
...
@@ -118,7 +103,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
GetScreen
()
->
m_Curseur
=
module
->
m_Pos
;
GetScreen
()
->
m_Curseur
=
module
->
m_Pos
;
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
/*
Effacement chevelu general si necessaire
*/
/*
Show ratsnest.
*/
if
(
g_Show_Ratsnest
)
if
(
g_Show_Ratsnest
)
DrawGeneralRatsnest
(
DC
);
DrawGeneralRatsnest
(
DC
);
...
@@ -130,14 +115,16 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
...
@@ -130,14 +115,16 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
if
(
g_Drag_Pistes_On
)
if
(
g_Drag_Pistes_On
)
{
{
Build_Drag_Liste
(
DrawPanel
,
DC
,
module
);
Build_Drag_Liste
(
DrawPanel
,
DC
,
module
);
ITEM_PICKER
itemWrapper
(
NULL
,
UR_CHANGED
);
ITEM_PICKER
itemWrapper
(
NULL
,
UR_CHANGED
);
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
TRACK
*
segm
=
pt_drag
->
m_Segm
;
TRACK
*
segm
=
pt_drag
->
m_Segm
;
itemWrapper
.
m_PickedItem
=
segm
;
itemWrapper
.
m_PickedItem
=
segm
;
itemWrapper
.
m_Link
=
segm
->
Copy
();
itemWrapper
.
m_Link
=
segm
->
Copy
();
itemWrapper
.
m_Link
->
SetState
(
EDIT
,
OFF
);
itemWrapper
.
m_Link
->
SetState
(
EDIT
,
OFF
);
s_PickedList
.
PushItem
(
itemWrapper
);
s_PickedList
.
PushItem
(
itemWrapper
);
}
}
}
}
...
@@ -146,7 +133,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
...
@@ -146,7 +133,7 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
DrawPanel
->
ForceCloseManageCurseur
=
Abort_MoveOrCopyModule
;
DrawPanel
->
ForceCloseManageCurseur
=
Abort_MoveOrCopyModule
;
DrawPanel
->
m_AutoPAN_Request
=
TRUE
;
DrawPanel
->
m_AutoPAN_Request
=
TRUE
;
//
effacement module a l'ecran:
//
Erase the module.
if
(
DC
)
if
(
DC
)
{
{
int
tmp
=
module
->
m_Flags
;
int
tmp
=
module
->
m_Flags
;
...
@@ -155,17 +142,13 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
...
@@ -155,17 +142,13 @@ void WinEDA_PcbFrame::StartMove_Module( MODULE* module, wxDC* DC )
module
->
m_Flags
=
tmp
;
module
->
m_Flags
=
tmp
;
}
}
// Reaffichage
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
}
}
/**************************************************************/
void
Abort_MoveOrCopyModule
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/****************************************************************/
/* Called on a move or copy module command abort
/* Called on a move or copy module command abort
*/
*/
void
Abort_MoveOrCopyModule
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
{
{
DRAG_SEGM
*
pt_drag
;
DRAG_SEGM
*
pt_drag
;
TRACK
*
pt_segm
;
TRACK
*
pt_segm
;
...
@@ -218,11 +201,14 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -218,11 +201,14 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
}
}
}
}
/* Re
affichage du module a l'ecran
*/
/* Re
draw the module.
*/
if
(
module
&&
s_ModuleInitialCopy
)
if
(
module
&&
s_ModuleInitialCopy
)
{
{
if
(
s_ModuleInitialCopy
->
m_Orient
!=
module
->
m_Orient
)
if
(
s_ModuleInitialCopy
->
m_Orient
!=
module
->
m_Orient
)
pcbframe
->
Rotate_Module
(
NULL
,
module
,
s_ModuleInitialCopy
->
m_Orient
,
FALSE
);
pcbframe
->
Rotate_Module
(
NULL
,
module
,
s_ModuleInitialCopy
->
m_Orient
,
FALSE
);
if
(
s_ModuleInitialCopy
->
GetLayer
()
!=
module
->
GetLayer
()
)
if
(
s_ModuleInitialCopy
->
GetLayer
()
!=
module
->
GetLayer
()
)
pcbframe
->
Change_Side_Module
(
module
,
NULL
);
pcbframe
->
Change_Side_Module
(
module
,
NULL
);
module
->
Draw
(
Panel
,
DC
,
GR_OR
);
module
->
Draw
(
Panel
,
DC
,
GR_OR
);
...
@@ -236,22 +222,20 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -236,22 +222,20 @@ void Abort_MoveOrCopyModule( WinEDA_DrawPanel* Panel, wxDC* DC )
s_ModuleInitialCopy
=
NULL
;
s_ModuleInitialCopy
=
NULL
;
s_PickedList
.
ClearListAndDeleteItems
();
s_PickedList
.
ClearListAndDeleteItems
();
pcbframe
->
GetBoard
()
->
m_Status_Pcb
&=
~
DO_NOT_SHOW_GENERAL_RASTNEST
;
// Display ratsnest is allowed
// Display ratsnest is allowed
pcbframe
->
GetBoard
()
->
m_Status_Pcb
&=
~
DO_NOT_SHOW_GENERAL_RASTNEST
;
if
(
g_Show_Ratsnest
)
if
(
g_Show_Ratsnest
)
pcbframe
->
DrawGeneralRatsnest
(
DC
);
pcbframe
->
DrawGeneralRatsnest
(
DC
);
}
}
/**********************************************************/
MODULE
*
WinEDA_BasePcbFrame
::
Copie_Module
(
MODULE
*
module
)
/**********************************************************/
/**
/**
* Function Copie_Module
* Function Copie_Module
*
Copy an existing footprint. The ne
footprint is added in module list
*
Copy an existing footprint. The new
footprint is added in module list
* @param module = footprint to copy
* @param module = footprint to copy
* @return a pointer on the new footprint (the copy of the existing footprint)
* @return a pointer on the new footprint (the copy of the existing footprint)
*/
*/
MODULE
*
WinEDA_BasePcbFrame
::
Copie_Module
(
MODULE
*
module
)
{
{
MODULE
*
newmodule
;
MODULE
*
newmodule
;
...
@@ -260,7 +244,7 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
...
@@ -260,7 +244,7 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
/* Duplicat
ion du
module */
/* Duplicat
e
module */
GetBoard
()
->
m_Status_Pcb
=
0
;
GetBoard
()
->
m_Status_Pcb
=
0
;
newmodule
=
new
MODULE
(
GetBoard
()
);
newmodule
=
new
MODULE
(
GetBoard
()
);
newmodule
->
Copy
(
module
);
newmodule
->
Copy
(
module
);
...
@@ -277,25 +261,22 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
...
@@ -277,25 +261,22 @@ MODULE* WinEDA_BasePcbFrame::Copie_Module( MODULE* module )
}
}
/**********************************************************************************/
/* Redraw the footprint when moving the mouse.
void
Montre_Position_Empreinte
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
/**********************************************************************************/
/* redessin du contour de l'empreinte lors des deplacements de la souris
*/
*/
void
Montre_Position_Empreinte
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
{
{
MODULE
*
module
=
(
MODULE
*
)
panel
->
GetScreen
()
->
GetCurItem
();
MODULE
*
module
=
(
MODULE
*
)
panel
->
GetScreen
()
->
GetCurItem
();
if
(
module
==
NULL
)
if
(
module
==
NULL
)
return
;
return
;
/*
efface ancienne position
*/
/*
Erase current footprint.
*/
if
(
erase
)
if
(
erase
)
{
{
DrawModuleOutlines
(
panel
,
DC
,
module
);
DrawModuleOutlines
(
panel
,
DC
,
module
);
}
}
/* Red
essine le module a la nouvelle place
*/
/* Red
raw the module at the new position.
*/
g_Offset_Module
=
module
->
m_Pos
-
panel
->
GetScreen
()
->
m_Curseur
;
g_Offset_Module
=
module
->
m_Pos
-
panel
->
GetScreen
()
->
m_Curseur
;
DrawModuleOutlines
(
panel
,
DC
,
module
);
DrawModuleOutlines
(
panel
,
DC
,
module
);
...
@@ -303,28 +284,27 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -303,28 +284,27 @@ void Montre_Position_Empreinte( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
}
}
/*****************************************************************************************/
bool
WinEDA_PcbFrame
::
Delete_Module
(
MODULE
*
module
,
wxDC
*
DC
,
bool
aAskBeforeDeleting
)
/******************************************************************************************/
/**
/**
* Function Delete Module
* Function Delete Module
* Remove a footprint from m_Modules linked list and put it in undelete buffer
* Remove a footprint from m_Modules linked list and put it in undelete buffer
*
The rastnest and pad list are recalcual
ed
*
The ratsnest and pad list are recalculat
ed
* @param module = footprint to delete
* @param module = footprint to delete
* @param DC = currentDevice Context. if NULL: do not redraw new ratsnets and dirty rectange
* @param DC = currentDevice Context. if NULL: do not redraw new ratsnest and
* dirty rectangle
* @param aPromptBeforeDeleting : if true: ask for confirmation before deleting
* @param aPromptBeforeDeleting : if true: ask for confirmation before deleting
*/
*/
bool
WinEDA_PcbFrame
::
Delete_Module
(
MODULE
*
module
,
wxDC
*
DC
,
bool
aAskBeforeDeleting
)
{
{
wxString
msg
;
wxString
msg
;
/* Si l'empreinte est selectee , on ne peut pas l'effacer ! */
if
(
module
==
NULL
)
if
(
module
==
NULL
)
return
FALSE
;
return
FALSE
;
/* Confirmation de l'effacement */
module
->
DisplayInfo
(
this
);
module
->
DisplayInfo
(
this
);
/* Confirm module delete. */
if
(
aAskBeforeDeleting
)
if
(
aAskBeforeDeleting
)
{
{
msg
<<
_
(
"Delete Module"
)
<<
wxT
(
" "
)
<<
module
->
m_Reference
->
m_Text
msg
<<
_
(
"Delete Module"
)
<<
wxT
(
" "
)
<<
module
->
m_Reference
->
m_Text
...
@@ -338,8 +318,9 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
...
@@ -338,8 +318,9 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
/* Erase rastnest if needed
/* Erase ratsnest if needed
* Dirty rectangle is not used here because usually using a XOR draw mode gives good results (very few artefacts) for ratsnest
* Dirty rectangle is not used here because usually using a XOR draw mode
* gives good results (very few artifacts) for ratsnest
*/
*/
if
(
g_Show_Ratsnest
)
if
(
g_Show_Ratsnest
)
DrawGeneralRatsnest
(
DC
);
DrawGeneralRatsnest
(
DC
);
...
@@ -354,36 +335,34 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
...
@@ -354,36 +335,34 @@ bool WinEDA_PcbFrame::Delete_Module( MODULE* module, wxDC* DC, bool aAskBeforeDe
// redraw the area where the module was
// redraw the area where the module was
if
(
DC
)
if
(
DC
)
DrawPanel
->
PostDirtyRect
(
module
->
GetBoundingBox
()
);
DrawPanel
->
PostDirtyRect
(
module
->
GetBoundingBox
()
);
RedrawActiveWindow
(
DC
,
TRUE
);
RedrawActiveWindow
(
DC
,
TRUE
);
return
TRUE
;
return
TRUE
;
}
}
/****************************************************************************/
void
WinEDA_PcbFrame
::
Change_Side_Module
(
MODULE
*
Module
,
wxDC
*
DC
)
/****************************************************************************/
/**
/**
* Function Change_Side_Module
* Function Change_Side_Module
* F
il
p a footprint (switch layer from component or component to copper)
* F
li
p a footprint (switch layer from component or component to copper)
* The mirroring is made from X axis
* The mirroring is made from X axis
* if a footprint is not on copper or component layer it is not flipped
* if a footprint is not on copper or component layer it is not flipped
* (it could be on an adhesive layer, not supported at this time)
* (it could be on an adhesive layer, not supported at this time)
* @param Module the footprint to flip
* @param Module the footprint to flip
* @param DC Current Device Context. if NULL, no redraw
* @param DC Current Device Context. if NULL, no redraw
*/
*/
void
WinEDA_PcbFrame
::
Change_Side_Module
(
MODULE
*
Module
,
wxDC
*
DC
)
{
{
if
(
Module
==
NULL
)
if
(
Module
==
NULL
)
return
;
return
;
if
(
(
Module
->
GetLayer
()
!=
CMP_N
)
&&
(
Module
->
GetLayer
()
!=
COPPER_LAYER_N
)
)
if
(
(
Module
->
GetLayer
()
!=
CMP_N
)
&&
(
Module
->
GetLayer
()
!=
COPPER_LAYER_N
)
)
return
;
return
;
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
if
(
!
(
Module
->
m_Flags
&
IS_MOVED
)
)
/* This is a simple flip, no other edition in progress */
if
(
!
(
Module
->
m_Flags
&
IS_MOVED
)
)
/* This is a simple flip, no other
*edition in progress */
{
{
GetBoard
()
->
m_Status_Pcb
&=
~
(
LISTE_RATSNEST_ITEM_OK
|
CONNEXION_OK
);
GetBoard
()
->
m_Status_Pcb
&=
~
(
LISTE_RATSNEST_ITEM_OK
|
CONNEXION_OK
);
if
(
DC
)
if
(
DC
)
{
{
int
tmp
=
Module
->
m_Flags
;
int
tmp
=
Module
->
m_Flags
;
...
@@ -392,17 +371,16 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
...
@@ -392,17 +371,16 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
Module
->
m_Flags
=
tmp
;
Module
->
m_Flags
=
tmp
;
}
}
/*
Effacement chevelu general si necessaire
*/
/*
Show ratsnest if necessary.
*/
if
(
DC
&&
g_Show_Ratsnest
)
if
(
DC
&&
g_Show_Ratsnest
)
DrawGeneralRatsnest
(
DC
);
DrawGeneralRatsnest
(
DC
);
/* Init des variables utilisees dans la routine Dessine_Drag_segment() */
g_Offset_Module
.
x
=
0
;
g_Offset_Module
.
x
=
0
;
g_Offset_Module
.
y
=
0
;
g_Offset_Module
.
y
=
0
;
}
}
else
// Module
en deplacement
else
// Module
is being moved.
{
{
/*
efface empreinte ( vue en contours) si elle a ete deja dessinee
*/
/*
Erase footprint and draw outline if it has been already drawn.
*/
if
(
DC
)
if
(
DC
)
{
{
DrawModuleOutlines
(
DrawPanel
,
DC
,
Module
);
DrawModuleOutlines
(
DrawPanel
,
DC
,
Module
);
...
@@ -415,13 +393,11 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
...
@@ -415,13 +393,11 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
Module
->
DisplayInfo
(
this
);
Module
->
DisplayInfo
(
this
);
if
(
!
(
Module
->
m_Flags
&
IS_MOVED
)
)
/* Inversion simple */
if
(
!
(
Module
->
m_Flags
&
IS_MOVED
)
)
/* Inversion simple */
{
{
if
(
DC
)
if
(
DC
)
{
{
Module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
Module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
/* affichage chevelu general si necessaire */
Compile_Ratsnest
(
DC
,
true
);
Compile_Ratsnest
(
DC
,
true
);
}
}
}
}
...
@@ -437,18 +413,14 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
...
@@ -437,18 +413,14 @@ void WinEDA_PcbFrame::Change_Side_Module( MODULE* Module, wxDC* DC )
}
}
/*****************************************************************/
/* Place module at cursor position.
void
WinEDA_BasePcbFrame
::
Place_Module
(
MODULE
*
module
,
wxDC
*
DC
,
bool
aDoNotRecreateRatsnest
)
*
/*****************************************************************/
* DC (if NULL: no display screen has the output.
* Update module coordinates with the new position.
/* Place a l'endroit pointe par la souris le module deja existant selectionne
* auparavant.
* Entree: module = num du module a replacer
* DC ( si NULL: pas d'affichage a l'ecran
* Sortie :
* mise a jour des nouvelles coord des differents elements du module
* affichage a l'ecran du module
*/
*/
void
WinEDA_BasePcbFrame
::
Place_Module
(
MODULE
*
module
,
wxDC
*
DC
,
bool
aDoNotRecreateRatsnest
)
{
{
TRACK
*
pt_segm
;
TRACK
*
pt_segm
;
wxPoint
newpos
;
wxPoint
newpos
;
...
@@ -459,41 +431,45 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
...
@@ -459,41 +431,45 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
GetBoard
()
->
m_Status_Pcb
&=
~
(
LISTE_RATSNEST_ITEM_OK
|
CONNEXION_OK
);
GetBoard
()
->
m_Status_Pcb
&=
~
(
LISTE_RATSNEST_ITEM_OK
|
CONNEXION_OK
);
if
(
(
module
->
m_Flags
&
IS_NEW
)
)
if
(
module
->
m_Flags
&
IS_NEW
)
{
{
SaveCopyInUndoList
(
module
,
UR_NEW
);
SaveCopyInUndoList
(
module
,
UR_NEW
);
}
}
else
if
(
(
module
->
m_Flags
&
IS_MOVED
)
)
else
if
(
(
module
->
m_Flags
&
IS_MOVED
)
)
{
{
ITEM_PICKER
picker
(
module
,
UR_CHANGED
);
ITEM_PICKER
picker
(
module
,
UR_CHANGED
);
picker
.
m_Link
=
s_ModuleInitialCopy
;
picker
.
m_Link
=
s_ModuleInitialCopy
;
s_PickedList
.
PushItem
(
picker
);
s_PickedList
.
PushItem
(
picker
);
s_ModuleInitialCopy
=
NULL
;
// the picker is now owner of s_ModuleInitialCopy.
s_ModuleInitialCopy
=
NULL
;
// the picker is now owner of
// s_ModuleInitialCopy.
}
}
if
(
s_PickedList
.
GetCount
()
)
if
(
s_PickedList
.
GetCount
()
)
{
{
SaveCopyInUndoList
(
s_PickedList
,
UR_UNSPECIFIED
);
SaveCopyInUndoList
(
s_PickedList
,
UR_UNSPECIFIED
);
// Clear list, but DO NOT delete items,
// Clear list, but DO NOT delete items,
// because they are owned by the saved undo list and they therefore in use
// because they are owned by the saved undo list and they therefore in
// use
s_PickedList
.
ClearItemsList
();
s_PickedList
.
ClearItemsList
();
}
}
if
(
g_Show_Module_Ratsnest
&&
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_PAD_OK
)
&&
DC
)
if
(
g_Show_Module_Ratsnest
&&
(
GetBoard
()
->
m_Status_Pcb
&
LISTE_PAD_OK
)
&&
DC
)
trace_ratsnest_module
(
DC
);
trace_ratsnest_module
(
DC
);
newpos
=
GetScreen
()
->
m_Curseur
;
newpos
=
GetScreen
()
->
m_Curseur
;
module
->
SetPosition
(
newpos
);
module
->
SetPosition
(
newpos
);
if
(
DC
)
if
(
DC
)
module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
if
(
g_DragSegmentList
)
if
(
g_DragSegmentList
)
{
{
/* Redraw dragged track segments */
/* Redraw dragged track segments */
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
pt_segm
=
pt_drag
->
m_Segm
;
pt_segm
=
pt_drag
->
m_Segm
;
pt_segm
->
SetState
(
EDIT
,
OFF
);
pt_segm
->
SetState
(
EDIT
,
OFF
);
...
@@ -508,7 +484,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
...
@@ -508,7 +484,7 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
Compile_Ratsnest
(
DC
,
true
);
Compile_Ratsnest
(
DC
,
true
);
if
(
DC
)
if
(
DC
)
RedrawActiveWindow
(
DC
,
TRUE
);
RedrawActiveWindow
(
DC
,
TRUE
);
module
->
DisplayInfo
(
this
);
module
->
DisplayInfo
(
this
);
...
@@ -522,25 +498,23 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
...
@@ -522,25 +498,23 @@ void WinEDA_BasePcbFrame::Place_Module( MODULE* module, wxDC* DC, bool aDoNotRec
}
}
/***********************************************************************/
void
WinEDA_BasePcbFrame
::
Rotate_Module
(
wxDC
*
DC
,
MODULE
*
module
,
int
angle
,
bool
incremental
)
/***********************************************************************/
/*
/*
*
Fait tourner l'empreinte de angle degres, dans le sens
< 0.
*
Rotate the footprint angle degrees in the direction
< 0.
*
Si incremental == TRUE, la rotation est faite a partir de la derniere
orientation,
*
If incremental == TRUE, the rotation is made from the last
orientation,
*
sinon le module est mis dans l'orientation absolue
angle.
*
If the module is placed in the absolute orientation
angle.
*
Si DC == NULL, le composant n'est pas redessine
.
*
If DC == NULL, the component does not redraw
.
*
Sinon, il est efface, tourne et redessine
*
Otherwise, it erases and redraws turns
*/
*/
void
WinEDA_BasePcbFrame
::
Rotate_Module
(
wxDC
*
DC
,
MODULE
*
module
,
int
angle
,
bool
incremental
)
{
{
if
(
module
==
NULL
)
if
(
module
==
NULL
)
return
;
return
;
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
if
(
!
(
module
->
m_Flags
&
IS_MOVED
)
)
/* This is a simple rotation, no other edition in progress */
if
(
!
(
module
->
m_Flags
&
IS_MOVED
)
)
/* This is a simple rotation, no other
* edition in progress */
{
{
if
(
DC
)
// Erase footprint to screen
if
(
DC
)
// Erase footprint to screen
{
{
...
@@ -549,14 +523,12 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
...
@@ -549,14 +523,12 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
DrawPanel
->
PostDirtyRect
(
module
->
GetBoundingBox
()
);
DrawPanel
->
PostDirtyRect
(
module
->
GetBoundingBox
()
);
module
->
m_Flags
=
tmp
;
module
->
m_Flags
=
tmp
;
/* Reaffichage chevelu general si necessaire */
if
(
g_Show_Ratsnest
)
if
(
g_Show_Ratsnest
)
DrawGeneralRatsnest
(
DC
);
DrawGeneralRatsnest
(
DC
);
}
}
}
}
else
else
{
{
/* reaffiche module en mouvement */
if
(
DC
)
if
(
DC
)
{
{
DrawModuleOutlines
(
DrawPanel
,
DC
,
module
);
DrawModuleOutlines
(
DrawPanel
,
DC
,
module
);
...
@@ -564,7 +536,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
...
@@ -564,7 +536,7 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
}
}
}
}
GetBoard
()
->
m_Status_Pcb
&=
~
(
LISTE_RATSNEST_ITEM_OK
|
CONNEXION_OK
);
GetBoard
()
->
m_Status_Pcb
&=
~
(
LISTE_RATSNEST_ITEM_OK
|
CONNEXION_OK
);
if
(
incremental
)
if
(
incremental
)
module
->
SetOrientation
(
module
->
m_Orient
+
angle
);
module
->
SetOrientation
(
module
->
m_Orient
+
angle
);
...
@@ -575,28 +547,25 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
...
@@ -575,28 +547,25 @@ void WinEDA_BasePcbFrame::Rotate_Module( wxDC* DC, MODULE* module,
if
(
DC
)
if
(
DC
)
{
{
if
(
!
(
module
->
m_Flags
&
IS_MOVED
)
)
/* Rotation simple */
if
(
!
(
module
->
m_Flags
&
IS_MOVED
)
)
/* Rotation simple */
{
{
module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
/* Reaffichage chevelu general si necessaire */
Compile_Ratsnest
(
DC
,
true
);
Compile_Ratsnest
(
DC
,
true
);
}
}
else
else
{
{
/* reaffiche module en mouvement */
DrawModuleOutlines
(
DrawPanel
,
DC
,
module
);
DrawModuleOutlines
(
DrawPanel
,
DC
,
module
);
Dessine_Segments_Dragges
(
DrawPanel
,
DC
);
Dessine_Segments_Dragges
(
DrawPanel
,
DC
);
}
}
RedrawActiveWindow
(
DC
,
TRUE
);
RedrawActiveWindow
(
DC
,
TRUE
);
}
}
}
}
/*************************************************/
/*************************************************/
/* Red
essine en mode XOR la silouhette du module
*/
/* Red
raw mode XOR the silhouette of the module.
*/
/*************************************************/
/*************************************************/
void
DrawModuleOutlines
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
MODULE
*
module
)
void
DrawModuleOutlines
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
MODULE
*
module
)
{
{
int
pad_fill_tmp
;
int
pad_fill_tmp
;
...
@@ -610,7 +579,7 @@ void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
...
@@ -610,7 +579,7 @@ void DrawModuleOutlines( WinEDA_DrawPanel* panel, wxDC* DC, MODULE* module )
{
{
pad_fill_tmp
=
DisplayOpt
.
DisplayPadFill
;
pad_fill_tmp
=
DisplayOpt
.
DisplayPadFill
;
#ifndef __WXMAC__
#ifndef __WXMAC__
DisplayOpt
.
DisplayPadFill
=
true
;
/* Trace en SKETCH en deplacement */
DisplayOpt
.
DisplayPadFill
=
true
;
#else
#else
DisplayOpt
.
DisplayPadFill
=
false
;
DisplayOpt
.
DisplayPadFill
=
false
;
#endif
#endif
...
...
pcbnew/move-drag_pads.cpp
View file @
1a139a7f
/************************
*
/
/************************/
/* Edit
ion des Pastilles
*/
/* Edit
footprint pads.
*/
/************************
*
/
/************************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -15,21 +15,14 @@
...
@@ -15,21 +15,14 @@
#include "protos.h"
#include "protos.h"
/* Routines Locales */
/* Variables locales */
static
D_PAD
*
s_CurrentSelectedPad
;
static
D_PAD
*
s_CurrentSelectedPad
;
/* pointeur sur le pad selecte pour edition */
static
wxPoint
Pad_OldPos
;
static
wxPoint
Pad_OldPos
;
/************************************************************/
/* Cancel move pad command.
static
void
Exit_Move_Pad
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/************************************************************/
/* Routine de sortie du menu EDIT PADS.
* Sortie simple si pad de pad en mouvement
* Remise en etat des conditions initiales avant move si move en cours
*/
*/
static
void
Exit_Move_Pad
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
{
{
D_PAD
*
pad
=
s_CurrentSelectedPad
;
D_PAD
*
pad
=
s_CurrentSelectedPad
;
...
@@ -42,10 +35,10 @@ static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -42,10 +35,10 @@ static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
pad
->
m_Flags
=
0
;
pad
->
m_Flags
=
0
;
pad
->
m_Pos
=
Pad_OldPos
;
pad
->
m_Pos
=
Pad_OldPos
;
pad
->
Draw
(
Panel
,
DC
,
GR_XOR
);
pad
->
Draw
(
Panel
,
DC
,
GR_XOR
);
/* Pad Move en cours : remise a l'etat d'origine */
/* Pad move in progress: the restore origin. */
if
(
g_Drag_Pistes_On
)
if
(
g_Drag_Pistes_On
)
{
{
/* Effacement des segments dragges */
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
...
@@ -63,10 +56,9 @@ static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -63,10 +56,9 @@ static void Exit_Move_Pad( WinEDA_DrawPanel* Panel, wxDC* DC )
}
}
/*************************************************************************/
/* Draw in drag mode when moving a pad.
*/
static
void
Show_Pad_Move
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
static
void
Show_Pad_Move
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
/*************************************************************************/
/* Affiche le pad et les pistes en mode drag lors des deplacements du pad */
{
{
TRACK
*
Track
;
TRACK
*
Track
;
DRAG_SEGM
*
pt_drag
;
DRAG_SEGM
*
pt_drag
;
...
@@ -82,7 +74,6 @@ static void Show_Pad_Move( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -82,7 +74,6 @@ static void Show_Pad_Move( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if
(
!
g_Drag_Pistes_On
)
if
(
!
g_Drag_Pistes_On
)
return
;
return
;
/* Tracage des segments dragges */
pt_drag
=
g_DragSegmentList
;
pt_drag
=
g_DragSegmentList
;
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
...
@@ -102,12 +93,9 @@ static void Show_Pad_Move( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -102,12 +93,9 @@ static void Show_Pad_Move( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
}
}
/*************************************************************/
/* Load list of features for default pad selection.
void
WinEDA_BasePcbFrame
::
Export_Pad_Settings
(
D_PAD
*
pt_pad
)
/*************************************************************/
/* Charge en liste des caracteristiques par defaut celles du pad selecte
*/
*/
void
WinEDA_BasePcbFrame
::
Export_Pad_Settings
(
D_PAD
*
pt_pad
)
{
{
MODULE
*
Module
;
MODULE
*
Module
;
...
@@ -133,15 +121,12 @@ void WinEDA_BasePcbFrame::Export_Pad_Settings( D_PAD* pt_pad )
...
@@ -133,15 +121,12 @@ void WinEDA_BasePcbFrame::Export_Pad_Settings( D_PAD* pt_pad )
}
}
/***********************************************************************/
/* Imports the new values of dimensions of the pad edge by pt_pad
void
WinEDA_BasePcbFrame
::
Import_Pad_Settings
(
D_PAD
*
aPad
,
bool
aDraw
)
* - Source: selected values of general characteristics
/***********************************************************************/
* - Measurements are modified
* - The position, names, and keys are not.
/* Met a jour les nouvelles valeurs de dimensions du pad pointe par pt_pad
* - Source : valeurs choisies des caracteristiques generales
* - les dimensions sont modifiees
* - la position et les noms ne sont pas touches
*/
*/
void
WinEDA_BasePcbFrame
::
Import_Pad_Settings
(
D_PAD
*
aPad
,
bool
aDraw
)
{
{
if
(
aDraw
)
if
(
aDraw
)
{
{
...
@@ -161,7 +146,6 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
...
@@ -161,7 +146,6 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
aPad
->
m_Drill
=
g_Pad_Master
.
m_Drill
;
aPad
->
m_Drill
=
g_Pad_Master
.
m_Drill
;
aPad
->
m_DrillShape
=
g_Pad_Master
.
m_DrillShape
;
aPad
->
m_DrillShape
=
g_Pad_Master
.
m_DrillShape
;
/* Traitement des cas particuliers : */
switch
(
g_Pad_Master
.
m_PadShape
)
switch
(
g_Pad_Master
.
m_PadShape
)
{
{
case
PAD_TRAPEZOID
:
case
PAD_TRAPEZOID
:
...
@@ -186,14 +170,14 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
...
@@ -186,14 +170,14 @@ void WinEDA_BasePcbFrame::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
if
(
aDraw
)
if
(
aDraw
)
DrawPanel
->
PostDirtyRect
(
aPad
->
GetBoundingBox
()
);
DrawPanel
->
PostDirtyRect
(
aPad
->
GetBoundingBox
()
);
(
(
MODULE
*
)
aPad
->
GetParent
()
)
->
m_LastEdit_Time
=
time
(
NULL
);
(
(
MODULE
*
)
aPad
->
GetParent
()
)
->
m_LastEdit_Time
=
time
(
NULL
);
}
}
/***********************************************************/
/* Add a pad on the selected module.
*/
void
WinEDA_BasePcbFrame
::
AddPad
(
MODULE
*
Module
,
bool
draw
)
void
WinEDA_BasePcbFrame
::
AddPad
(
MODULE
*
Module
,
bool
draw
)
/***********************************************************/
/* Routine d'ajout d'un pad sur l'module selectionnee */
{
{
D_PAD
*
Pad
;
D_PAD
*
Pad
;
int
rX
,
rY
;
int
rX
,
rY
;
...
@@ -203,10 +187,10 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
...
@@ -203,10 +187,10 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
Pad
=
new
D_PAD
(
Module
);
Pad
=
new
D_PAD
(
Module
);
/*
Chainage de la structure en fin de liste des pads :
*/
/*
Add the new pad to end of the module pad list.
*/
Module
->
m_Pads
.
PushBack
(
Pad
);
Module
->
m_Pads
.
PushBack
(
Pad
);
/*
Mise a jour des caract de la pastille :
*/
/*
Update the pad properties.
*/
Import_Pad_Settings
(
Pad
,
false
);
Import_Pad_Settings
(
Pad
,
false
);
Pad
->
SetNetname
(
wxEmptyString
);
Pad
->
SetNetname
(
wxEmptyString
);
...
@@ -220,12 +204,14 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
...
@@ -220,12 +204,14 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
Pad
->
m_Pos0
.
x
=
rX
;
Pad
->
m_Pos0
.
x
=
rX
;
Pad
->
m_Pos0
.
y
=
rY
;
Pad
->
m_Pos0
.
y
=
rY
;
/* Increment automatique de la reference courante Current_PadName */
/* Automatically increment the current pad number and name. */
long
num
=
0
;
int
ponder
=
1
;
long
num
=
0
;
int
ponder
=
1
;
while
(
g_Current_PadName
.
Len
()
&&
g_Current_PadName
.
Last
()
>=
'0'
while
(
g_Current_PadName
.
Len
()
&&
g_Current_PadName
.
Last
()
>=
'0'
&&
g_Current_PadName
.
Last
()
<=
'9'
)
&&
g_Current_PadName
.
Last
()
<=
'9'
)
{
{
num
+=
(
g_Current_PadName
.
Last
()
-
'0'
)
*
ponder
;
num
+=
(
g_Current_PadName
.
Last
()
-
'0'
)
*
ponder
;
g_Current_PadName
.
RemoveLast
();
g_Current_PadName
.
RemoveLast
();
ponder
*=
10
;
ponder
*=
10
;
}
}
...
@@ -234,7 +220,6 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
...
@@ -234,7 +220,6 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
g_Current_PadName
<<
num
;
g_Current_PadName
<<
num
;
Pad
->
SetPadName
(
g_Current_PadName
);
Pad
->
SetPadName
(
g_Current_PadName
);
/* Redessin du module */
Module
->
Set_Rectangle_Encadrement
();
Module
->
Set_Rectangle_Encadrement
();
Pad
->
DisplayInfo
(
this
);
Pad
->
DisplayInfo
(
this
);
if
(
draw
)
if
(
draw
)
...
@@ -242,10 +227,8 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
...
@@ -242,10 +227,8 @@ void WinEDA_BasePcbFrame::AddPad( MODULE* Module, bool draw )
}
}
/*
*******************************************************
*/
/*
Function to delete the pad.
*/
void
WinEDA_BasePcbFrame
::
DeletePad
(
D_PAD
*
Pad
)
void
WinEDA_BasePcbFrame
::
DeletePad
(
D_PAD
*
Pad
)
/*********************************************************/
/* Function to delete the pad "pad" */
{
{
MODULE
*
Module
;
MODULE
*
Module
;
wxString
line
;
wxString
line
;
...
@@ -274,10 +257,8 @@ void WinEDA_BasePcbFrame::DeletePad( D_PAD* Pad )
...
@@ -274,10 +257,8 @@ void WinEDA_BasePcbFrame::DeletePad( D_PAD* Pad )
}
}
/*
***********************************************************
*/
/*
Function to initialize the "move pad" command
*/
void
WinEDA_BasePcbFrame
::
StartMovePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
void
WinEDA_BasePcbFrame
::
StartMovePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
/*************************************************************/
/* Function to initialise the "move pad" command */
{
{
MODULE
*
Module
;
MODULE
*
Module
;
...
@@ -305,10 +286,8 @@ void WinEDA_BasePcbFrame::StartMovePad( D_PAD* Pad, wxDC* DC )
...
@@ -305,10 +286,8 @@ void WinEDA_BasePcbFrame::StartMovePad( D_PAD* Pad, wxDC* DC )
}
}
/*
*******************************************************
*/
/*
Routine to place a moved pad.
*/
void
WinEDA_BasePcbFrame
::
PlacePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
void
WinEDA_BasePcbFrame
::
PlacePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
/*********************************************************/
/* Routine to Place a moved pad */
{
{
int
dX
,
dY
;
int
dX
,
dY
;
TRACK
*
Track
;
TRACK
*
Track
;
...
@@ -323,7 +302,9 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
...
@@ -323,7 +302,9 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
PICKED_ITEMS_LIST
pickList
;
PICKED_ITEMS_LIST
pickList
;
/* Save dragged track segments in undo list */
/* Save dragged track segments in undo list */
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
pt_drag
;
pt_drag
=
pt_drag
->
Pnext
)
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
pt_drag
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
Track
=
pt_drag
->
m_Segm
;
Track
=
pt_drag
->
m_Segm
;
...
@@ -355,13 +336,13 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
...
@@ -355,13 +336,13 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
if
(
g_DragSegmentList
)
if
(
g_DragSegmentList
)
SaveCopyInUndoList
(
pickList
,
UR_CHANGED
);
SaveCopyInUndoList
(
pickList
,
UR_CHANGED
);
/* Placement du pad */
Pad
->
m_Pos
=
pad_curr_position
;
Pad
->
m_Pos
=
pad_curr_position
;
Pad
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
Pad
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
/* Redraw dragged track segments */
/* Redraw dragged track segments */
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
pt_drag
;
pt_drag
=
pt_drag
->
Pnext
)
for
(
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
pt_drag
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
Track
=
pt_drag
->
m_Segm
;
Track
=
pt_drag
->
m_Segm
;
...
@@ -376,7 +357,8 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
...
@@ -376,7 +357,8 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
Track
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
Track
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
}
}
/* Compute local coordinates (i.e refer to Module position and for Module orient = 0)*/
/* Compute local coordinates (i.e refer to Module position and for Module
* orient = 0) */
dX
=
Pad
->
m_Pos
.
x
-
Pad_OldPos
.
x
;
dX
=
Pad
->
m_Pos
.
x
-
Pad_OldPos
.
x
;
dY
=
Pad
->
m_Pos
.
y
-
Pad_OldPos
.
y
;
dY
=
Pad
->
m_Pos
.
y
-
Pad_OldPos
.
y
;
RotatePoint
(
&
dX
,
&
dY
,
-
Module
->
m_Orient
);
RotatePoint
(
&
dX
,
&
dY
,
-
Module
->
m_Orient
);
...
@@ -392,23 +374,18 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
...
@@ -392,23 +374,18 @@ void WinEDA_BasePcbFrame::PlacePad( D_PAD* Pad, wxDC* DC )
Module
->
Set_Rectangle_Encadrement
();
Module
->
Set_Rectangle_Encadrement
();
Module
->
m_LastEdit_Time
=
time
(
NULL
);
Module
->
m_LastEdit_Time
=
time
(
NULL
);
EraseDragListe
();
EraseDragListe
();
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
m_Pcb
->
m_Status_Pcb
&=
~
(
LISTE_RATSNEST_ITEM_OK
|
CONNEXION_OK
);
m_Pcb
->
m_Status_Pcb
&=
~
(
LISTE_RATSNEST_ITEM_OK
|
CONNEXION_OK
);
}
}
/**********************************************************/
/* Rotate selected pad 90 degrees.
void
WinEDA_BasePcbFrame
::
RotatePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
/**********************************************************/
/* Tourne de 90 degres le pad selectionne :
* c.a.d intervertit dim X et Y et offsets
*/
*/
void
WinEDA_BasePcbFrame
::
RotatePad
(
D_PAD
*
Pad
,
wxDC
*
DC
)
{
{
MODULE
*
Module
;
MODULE
*
Module
;
...
@@ -429,12 +406,10 @@ void WinEDA_BasePcbFrame::RotatePad( D_PAD* Pad, wxDC* DC )
...
@@ -429,12 +406,10 @@ void WinEDA_BasePcbFrame::RotatePad( D_PAD* Pad, wxDC* DC )
Pad
->
m_Offset
.
y
=
-
Pad
->
m_Offset
.
y
;
Pad
->
m_Offset
.
y
=
-
Pad
->
m_Offset
.
y
;
EXCHG
(
Pad
->
m_DeltaSize
.
x
,
Pad
->
m_DeltaSize
.
y
);
EXCHG
(
Pad
->
m_DeltaSize
.
x
,
Pad
->
m_DeltaSize
.
y
);
Pad
->
m_DeltaSize
.
x
=
-
Pad
->
m_DeltaSize
.
x
;
/* ceci est la variation
Pad
->
m_DeltaSize
.
x
=
-
Pad
->
m_DeltaSize
.
x
;
* de la dim Y sur l'axe X */
Module
->
Set_Rectangle_Encadrement
();
Module
->
Set_Rectangle_Encadrement
();
Pad
->
DisplayInfo
(
this
);
Pad
->
DisplayInfo
(
this
);
if
(
DC
)
if
(
DC
)
Module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
Module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
}
}
pcbnew/move_or_drag_track.cpp
View file @
1a139a7f
...
@@ -18,34 +18,36 @@
...
@@ -18,34 +18,36 @@
#include "protos.h"
#include "protos.h"
/* local functions */
static
void
Show_MoveNode
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
Show_MoveNode
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
Show_Drag_Track_Segment_With_Cte_Slope
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
Show_Drag_Track_Segment_With_Cte_Slope
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
Abort_MoveTrack
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
void
Abort_MoveTrack
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
bool
InitialiseDragParameters
();
static
bool
InitialiseDragParameters
();
/* variables locales */
static
wxPoint
PosInit
,
s_LastPos
;
static
wxPoint
PosInit
,
s_LastPos
;
static
TRACK
*
NewTrack
;
/* N
ouvelle piste creee ou piste deplacee
*/
static
TRACK
*
NewTrack
;
/* N
ew track or track being moved.
*/
static
int
NbPtNewTrack
;
static
int
NbPtNewTrack
;
static
int
Old_HightLigth_NetCode
;
static
int
Old_HightLigth_NetCode
;
static
bool
Old_HightLigt_Status
;
static
bool
Old_HightLigt_Status
;
static
double
s_StartSegmentSlope
,
s_EndSegmentSlope
,
s_MovingSegmentSlope
,
static
double
s_StartSegmentSlope
,
s_EndSegmentSlope
,
s_MovingSegmentSlope
,
s_StartSegment_Yorg
,
s_EndSegment_Yorg
,
s_StartSegment_Yorg
,
s_EndSegment_Yorg
,
s_MovingSegment_Yorg
;
//slope and intercept parameters of lines
s_MovingSegment_Yorg
;
//slope and intercept parameters of lines
bool
s_StartPointVertical
,
s_EndPointVertical
,
bool
s_StartPointVertical
,
s_EndPointVertical
,
s_MovingSegmentVertical
,
s_MovingSegmentHorizontal
,
s_MovingSegmentVertical
,
s_MovingSegmentHorizontal
,
s_StartPointHorizontal
,
s_EndPointHorizontal
;
// vertical or horizontal line indicators
s_StartPointHorizontal
,
s_EndPointHorizontal
;
// vertical or
// horizontal line
// indicators
bool
s_StartSegmentPresent
,
s_EndSegmentPresent
;
bool
s_StartSegmentPresent
,
s_EndSegmentPresent
;
static
PICKED_ITEMS_LIST
s_ItemsListPicker
;
static
PICKED_ITEMS_LIST
s_ItemsListPicker
;
/**************************************************************/
static
void
Abort_MoveTrack
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/***************************************************************/
/** Abort function for command
es drag, copy ou
move track
/** Abort function for command
s drag, copy or
move track
*/
*/
static
void
Abort_MoveTrack
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
{
{
TRACK
*
NextS
;
TRACK
*
NextS
;
int
ii
;
int
ii
;
...
@@ -60,7 +62,8 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -60,7 +62,8 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel
->
GetScreen
()
->
m_Curseur
=
oldpos
;
Panel
->
GetScreen
()
->
m_Curseur
=
oldpos
;
g_HightLigt_Status
=
FALSE
;
g_HightLigt_Status
=
FALSE
;
(
(
WinEDA_PcbFrame
*
)
Panel
->
m_Parent
)
->
GetBoard
()
->
DrawHighLight
(
Panel
,
(
(
WinEDA_PcbFrame
*
)
Panel
->
m_Parent
)
->
GetBoard
()
->
DrawHighLight
(
Panel
,
DC
,
DC
,
g_HightLigth_NetCode
);
g_HightLigth_NetCode
);
...
@@ -77,7 +80,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -77,7 +80,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
delete
NewTrack
;
delete
NewTrack
;
}
}
}
}
else
/* Move
: remise en ancienne position
*/
else
/* Move
existing trace.
*/
{
{
TRACK
*
Track
=
NewTrack
;
TRACK
*
Track
=
NewTrack
;
int
dx
=
s_LastPos
.
x
-
PosInit
.
x
;
int
dx
=
s_LastPos
.
x
-
PosInit
.
x
;
...
@@ -106,7 +109,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -106,7 +109,7 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel
->
ForceCloseManageCurseur
=
NULL
;
Panel
->
ForceCloseManageCurseur
=
NULL
;
(
(
WinEDA_PcbFrame
*
)
Panel
->
m_Parent
)
->
SetCurItem
(
NULL
);
(
(
WinEDA_PcbFrame
*
)
Panel
->
m_Parent
)
->
SetCurItem
(
NULL
);
/*
Annulation deplacement et Redessin des segments dragges
*/
/*
Undo move and redraw trace segments.
*/
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
DRAG_SEGM
*
pt_drag
=
g_DragSegmentList
;
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
for
(
;
pt_drag
!=
NULL
;
pt_drag
=
pt_drag
->
Pnext
)
{
{
...
@@ -123,7 +126,8 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -123,7 +126,8 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
g_HightLigth_NetCode
=
Old_HightLigth_NetCode
;
g_HightLigth_NetCode
=
Old_HightLigth_NetCode
;
g_HightLigt_Status
=
Old_HightLigt_Status
;
g_HightLigt_Status
=
Old_HightLigt_Status
;
if
(
g_HightLigt_Status
)
if
(
g_HightLigt_Status
)
(
(
WinEDA_PcbFrame
*
)
Panel
->
m_Parent
)
->
GetBoard
()
->
DrawHighLight
(
Panel
,
(
(
WinEDA_PcbFrame
*
)
Panel
->
m_Parent
)
->
GetBoard
()
->
DrawHighLight
(
Panel
,
DC
,
DC
,
g_HightLigth_NetCode
);
g_HightLigth_NetCode
);
...
@@ -131,10 +135,8 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -131,10 +135,8 @@ static void Abort_MoveTrack( WinEDA_DrawPanel* Panel, wxDC* DC )
}
}
/*************************************************************************/
static
void
Show_MoveNode
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
/*************************************************************************/
/* Redraw the moved node according to the mouse cursor position */
/* Redraw the moved node according to the mouse cursor position */
static
void
Show_MoveNode
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
{
{
int
ii
;
int
ii
;
wxPoint
moveVector
;
wxPoint
moveVector
;
...
@@ -190,21 +192,19 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -190,21 +192,19 @@ static void Show_MoveNode( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
}
}
DisplayOpt
.
DisplayPcbTrackFill
=
track_fill_copy
;
DisplayOpt
.
DisplayPcbTrackFill
=
track_fill_copy
;
// Display track length
// Display track length
WinEDA_BasePcbFrame
*
frame
=
(
WinEDA_BasePcbFrame
*
)
panel
->
m_Parent
;
WinEDA_BasePcbFrame
*
frame
=
(
WinEDA_BasePcbFrame
*
)
panel
->
m_Parent
;
Track
->
DisplayInfo
(
frame
);
Track
->
DisplayInfo
(
frame
);
}
}
/*************************************************************************/
static
void
Show_Drag_Track_Segment_With_Cte_Slope
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
/*************************************************************************/
/* drawing the track segment movement
/* drawing the track segment movement
* > s_MovingSegmentSlope slope = moving track segment slope
* > s_MovingSegmentSlope slope = moving track segment slope
* > s_StartSegmentSlope slope = slope of the segment connected to the start point of the moving segment
* > s_StartSegmentSlope slope = slope of the segment connected to the start
* > s_EndSegmentSlope slope = slope of the segment connected to the end point of the moving segment
* point of the moving segment
* > s_EndSegmentSlope slope = slope of the segment connected to the end point
* of the moving segment
*
*
* moved segment function :
* moved segment function :
* yt=s_MovingSegmentSlope * x + s_MovingSegment_Yorg
* yt=s_MovingSegmentSlope * x + s_MovingSegment_Yorg
...
@@ -217,12 +217,14 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
...
@@ -217,12 +217,14 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
*
*
* first intersection point will be located at
* first intersection point will be located at
* y1=yt ->
* y1=yt ->
*
* xi1=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_StartSegmentSlope-s_MovingSegmentSlope)
* xi1=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_StartSegmentSlope-s_MovingSegmentSlope)
* yi1=s_MovingSegmentSlope*xi1+s_MovingSegment_Yorg
* yi1=s_MovingSegmentSlope*xi1+s_MovingSegment_Yorg
* or yi1=s_StartSegmentSlope*xi1+s_MovingSegment_Yorg
* or yi1=s_StartSegmentSlope*xi1+s_MovingSegment_Yorg
*
*
* second intersection point
* second intersection point
* y2=yt ->
* y2=yt ->
*
* xi2=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_MovingSegmentSlope-s_MovingSegmentSlope)
* xi2=(s_MovingSegment_Yorg-s_StartSegment_Yorg)/(s_MovingSegmentSlope-s_MovingSegmentSlope)
* yi2=s_MovingSegmentSlope*xi2+s_MovingSegment_Yorg
* yi2=s_MovingSegmentSlope*xi2+s_MovingSegment_Yorg
* or yi1=s_EndSegmentSlope*xi2+s_MovingSegment_Yorg
* or yi1=s_EndSegmentSlope*xi2+s_MovingSegment_Yorg
...
@@ -233,13 +235,17 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
...
@@ -233,13 +235,17 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
* !!!!! segment intersecting it
* !!!!! segment intersecting it
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
*
*
* Slope parametres are computed once, because they can become undetermined when moving segments
* Slope parameters are computed once, because they can become undetermined
* (i.e. when a segment lenght is 0) and we want keep them constant
* when moving segments
* (i.e. when a segment length is 0) and we want keep them constant
*/
*/
static
void
Show_Drag_Track_Segment_With_Cte_Slope
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
{
{
double
xi1
=
0
,
yi1
=
0
,
xi2
=
0
,
yi2
=
0
;
// calculated intersection points
double
xi1
=
0
,
yi1
=
0
,
xi2
=
0
,
yi2
=
0
;
// calculated
double
tx1
,
tx2
,
ty1
,
ty2
;
// temporary storage of points
// intersection points
double
tx1
,
tx2
,
ty1
,
ty2
;
// temporary storage of
// points
int
dx
,
dy
;
int
dx
,
dy
;
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
bool
update
=
true
;
bool
update
=
true
;
...
@@ -259,13 +265,17 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
...
@@ -259,13 +265,17 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
{
{
if
(
s_EndSegmentPresent
)
if
(
s_EndSegmentPresent
)
{
{
tSegmentToEnd
=
TrackSegWrapper
->
m_Segm
;
// Get the segment connected to the end point
tSegmentToEnd
=
TrackSegWrapper
->
m_Segm
;
// Get the segment
// connected to the end
// point
TrackSegWrapper
=
TrackSegWrapper
->
Pnext
;
TrackSegWrapper
=
TrackSegWrapper
->
Pnext
;
}
}
if
(
s_StartSegmentPresent
)
if
(
s_StartSegmentPresent
)
{
{
if
(
TrackSegWrapper
)
if
(
TrackSegWrapper
)
tSegmentToStart
=
TrackSegWrapper
->
m_Segm
;
// Get the segment connected to the start point
tSegmentToStart
=
TrackSegWrapper
->
m_Segm
;
// Get the segment
// connected to the
// start point
}
}
}
}
...
@@ -299,13 +309,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
...
@@ -299,13 +309,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
// because we are moving parallel with is initial state
// because we are moving parallel with is initial state
if
(
!
s_MovingSegmentVertical
)
if
(
!
s_MovingSegmentVertical
)
{
{
s_MovingSegment_Yorg
=
ty1
-
(
s_MovingSegmentSlope
*
tx1
);
s_MovingSegment_Yorg
=
ty1
-
(
s_MovingSegmentSlope
*
tx1
);
}
}
if
(
(
!
s_EndPointVertical
)
&&
(
!
s_MovingSegmentVertical
)
)
if
(
(
!
s_EndPointVertical
)
&&
(
!
s_MovingSegmentVertical
)
)
{
{
xi2
=
(
s_MovingSegment_Yorg
-
xi2
=
(
s_MovingSegment_Yorg
-
s_EndSegment_Yorg
)
s_EndSegment_Yorg
)
/
(
s_EndSegmentSlope
-
s_MovingSegmentSlope
);
/
(
s_EndSegmentSlope
-
s_MovingSegmentSlope
);
}
}
else
else
{
{
...
@@ -329,13 +339,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
...
@@ -329,13 +339,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
if
(
!
s_MovingSegmentVertical
)
if
(
!
s_MovingSegmentVertical
)
{
{
yi2
=
s_MovingSegmentSlope
*
(
xi2
)
+
s_MovingSegment_Yorg
;
yi2
=
s_MovingSegmentSlope
*
(
xi2
)
+
s_MovingSegment_Yorg
;
}
}
else
else
{
{
if
(
!
s_EndPointVertical
)
if
(
!
s_EndPointVertical
)
{
{
yi2
=
s_EndSegmentSlope
*
(
xi2
)
+
s_EndSegment_Yorg
;
yi2
=
s_EndSegmentSlope
*
(
xi2
)
+
s_EndSegment_Yorg
;
}
}
else
else
{
{
...
@@ -345,15 +355,15 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
...
@@ -345,15 +355,15 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
}
}
else
else
{
{
yi2
=
s_MovingSegmentSlope
*
(
xi2
)
+
s_MovingSegment_Yorg
;
yi2
=
s_MovingSegmentSlope
*
(
xi2
)
+
s_MovingSegment_Yorg
;
}
}
}
}
}
}
if
(
(
!
s_StartPointVertical
)
&&
(
!
s_MovingSegmentVertical
)
)
if
(
(
!
s_StartPointVertical
)
&&
(
!
s_MovingSegmentVertical
)
)
{
{
xi1
=
(
s_MovingSegment_Yorg
-
xi1
=
(
s_MovingSegment_Yorg
-
s_StartSegment_Yorg
)
s_StartSegment_Yorg
)
/
(
s_StartSegmentSlope
-
s_MovingSegmentSlope
);
/
(
s_StartSegmentSlope
-
s_MovingSegmentSlope
);
}
}
else
else
{
{
...
@@ -380,13 +390,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
...
@@ -380,13 +390,13 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
if
(
!
s_MovingSegmentVertical
)
if
(
!
s_MovingSegmentVertical
)
{
{
yi1
=
s_MovingSegmentSlope
*
(
xi1
)
+
s_MovingSegment_Yorg
;
yi1
=
s_MovingSegmentSlope
*
(
xi1
)
+
s_MovingSegment_Yorg
;
}
}
else
else
{
{
if
(
!
s_StartPointVertical
)
if
(
!
s_StartPointVertical
)
{
{
yi1
=
s_StartSegmentSlope
*
(
xi1
)
+
s_StartSegment_Yorg
;
yi1
=
s_StartSegmentSlope
*
(
xi1
)
+
s_StartSegment_Yorg
;
}
}
else
else
{
{
...
@@ -396,7 +406,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
...
@@ -396,7 +406,7 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
}
}
else
else
{
{
yi2
=
s_MovingSegmentSlope
*
(
xi1
)
+
s_MovingSegment_Yorg
;
yi2
=
s_MovingSegmentSlope
*
(
xi1
)
+
s_MovingSegment_Yorg
;
}
}
}
}
}
}
...
@@ -442,20 +452,19 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
...
@@ -442,20 +452,19 @@ static void Show_Drag_Track_Segment_With_Cte_Slope( WinEDA_DrawPanel* panel,
tSegmentToStart
->
Draw
(
panel
,
DC
,
draw_mode
);
tSegmentToStart
->
Draw
(
panel
,
DC
,
draw_mode
);
if
(
tSegmentToEnd
)
if
(
tSegmentToEnd
)
tSegmentToEnd
->
Draw
(
panel
,
DC
,
draw_mode
);
tSegmentToEnd
->
Draw
(
panel
,
DC
,
draw_mode
);
// Display track length
// Display track length
WinEDA_BasePcbFrame
*
frame
=
(
WinEDA_BasePcbFrame
*
)
panel
->
m_Parent
;
WinEDA_BasePcbFrame
*
frame
=
(
WinEDA_BasePcbFrame
*
)
panel
->
m_Parent
;
Track
->
DisplayInfo
(
frame
);
Track
->
DisplayInfo
(
frame
);
}
}
/**********************************/
/* Init variables (slope, Y intersect point, flags) for
bool
InitialiseDragParameters
()
* Show_Drag_Track_Segment_With_Cte_Slope()
/**********************************/
/* Init variables (slope, Y intersect point, flags) for Show_Drag_Track_Segment_With_Cte_Slope()
* return true if Ok, FALSE if dragging is not possible
* return true if Ok, FALSE if dragging is not possible
* (2 colinear segments)
* (2 colinear segments)
*/
*/
bool
InitialiseDragParameters
()
{
{
double
tx1
,
tx2
,
ty1
,
ty2
;
// temporary storage of points
double
tx1
,
tx2
,
ty1
,
ty2
;
// temporary storage of points
TRACK
*
Track
;
TRACK
*
Track
;
...
@@ -473,18 +482,23 @@ bool InitialiseDragParameters()
...
@@ -473,18 +482,23 @@ bool InitialiseDragParameters()
{
{
if
(
s_EndSegmentPresent
)
if
(
s_EndSegmentPresent
)
{
{
tSegmentToEnd
=
TrackSegWrapper
->
m_Segm
;
// Get the segment connected to the end point
tSegmentToEnd
=
TrackSegWrapper
->
m_Segm
;
// Get the segment
// connected to the end
// point
TrackSegWrapper
=
TrackSegWrapper
->
Pnext
;
TrackSegWrapper
=
TrackSegWrapper
->
Pnext
;
}
}
if
(
s_StartSegmentPresent
)
if
(
s_StartSegmentPresent
)
{
{
if
(
TrackSegWrapper
)
if
(
TrackSegWrapper
)
tSegmentToStart
=
TrackSegWrapper
->
m_Segm
;
// Get the segment connected to the start point
tSegmentToStart
=
TrackSegWrapper
->
m_Segm
;
// Get the segment
// connected to the
// start point
}
}
}
}
//would be nice to eliminate collinear segments here, so we don't
//would be nice to eliminate collinear segments here, so we don't
//have to deal with that annoying "Unable to drag this segment: two collinear segments"
//have to deal with that annoying "Unable to drag this segment: two
// collinear segments"
s_StartPointVertical
=
false
;
s_StartPointVertical
=
false
;
s_EndPointVertical
=
false
;
s_EndPointVertical
=
false
;
...
@@ -493,7 +507,6 @@ bool InitialiseDragParameters()
...
@@ -493,7 +507,6 @@ bool InitialiseDragParameters()
s_EndPointHorizontal
=
false
;
s_EndPointHorizontal
=
false
;
s_MovingSegmentHorizontal
=
false
;
s_MovingSegmentHorizontal
=
false
;
// Init parameters for the starting point of the moved segment
// Init parameters for the starting point of the moved segment
if
(
tSegmentToStart
)
if
(
tSegmentToStart
)
{
{
...
@@ -512,7 +525,8 @@ bool InitialiseDragParameters()
...
@@ -512,7 +525,8 @@ bool InitialiseDragParameters()
ty2
=
(
double
)
tSegmentToStart
->
m_Start
.
y
;
ty2
=
(
double
)
tSegmentToStart
->
m_Start
.
y
;
}
}
}
}
else
// move the start point on a line starting at Track->m_Start, and perpendicular to Track
else
// move the start point on a line starting at Track->m_Start, and
// perpendicular to Track
{
{
tx1
=
(
double
)
Track
->
m_Start
.
x
;
tx1
=
(
double
)
Track
->
m_Start
.
x
;
ty1
=
(
double
)
Track
->
m_Start
.
y
;
ty1
=
(
double
)
Track
->
m_Start
.
y
;
...
@@ -520,16 +534,16 @@ bool InitialiseDragParameters()
...
@@ -520,16 +534,16 @@ bool InitialiseDragParameters()
ty2
=
(
double
)
Track
->
m_End
.
y
;
ty2
=
(
double
)
Track
->
m_End
.
y
;
RotatePoint
(
&
tx2
,
&
ty2
,
tx1
,
ty1
,
900
);
RotatePoint
(
&
tx2
,
&
ty2
,
tx1
,
ty1
,
900
);
}
}
if
(
tx1
!=
tx2
)
if
(
tx1
!=
tx2
)
{
{
s_StartSegmentSlope
=
(
ty2
-
ty1
)
/
(
tx2
-
tx1
);
s_StartSegmentSlope
=
(
ty2
-
ty1
)
/
(
tx2
-
tx1
);
s_StartSegment_Yorg
=
ty1
-
(
ty2
-
ty1
)
*
tx1
/
(
tx2
-
tx1
);
s_StartSegment_Yorg
=
ty1
-
(
ty2
-
ty1
)
*
tx1
/
(
tx2
-
tx1
);
}
}
else
else
{
{
s_StartPointVertical
=
true
;
//signal first segment vertical
s_StartPointVertical
=
true
;
//signal first segment vertical
}
}
if
(
ty1
==
ty2
)
if
(
ty1
==
ty2
)
{
{
s_StartPointHorizontal
=
true
;
s_StartPointHorizontal
=
true
;
}
}
...
@@ -554,7 +568,8 @@ bool InitialiseDragParameters()
...
@@ -554,7 +568,8 @@ bool InitialiseDragParameters()
ty2
=
(
double
)
tSegmentToEnd
->
m_Start
.
y
;
ty2
=
(
double
)
tSegmentToEnd
->
m_Start
.
y
;
}
}
}
}
else
// move the start point on a line starting at Track->m_End, and perpendicular to Track
else
// move the start point on a line starting at Track->m_End, and
// perpendicular to Track
{
{
tx1
=
(
double
)
Track
->
m_End
.
x
;
tx1
=
(
double
)
Track
->
m_End
.
x
;
ty1
=
(
double
)
Track
->
m_End
.
y
;
ty1
=
(
double
)
Track
->
m_End
.
y
;
...
@@ -563,36 +578,35 @@ bool InitialiseDragParameters()
...
@@ -563,36 +578,35 @@ bool InitialiseDragParameters()
RotatePoint
(
&
tx2
,
&
ty2
,
tx1
,
ty1
,
-
900
);
RotatePoint
(
&
tx2
,
&
ty2
,
tx1
,
ty1
,
-
900
);
}
}
if
(
tx2
!=
tx1
)
if
(
tx2
!=
tx1
)
{
{
s_EndSegmentSlope
=
(
ty2
-
ty1
)
/
(
tx2
-
tx1
);
s_EndSegmentSlope
=
(
ty2
-
ty1
)
/
(
tx2
-
tx1
);
s_EndSegment_Yorg
=
ty1
-
(
ty2
-
ty1
)
*
tx1
/
(
tx2
-
tx1
);
s_EndSegment_Yorg
=
ty1
-
(
ty2
-
ty1
)
*
tx1
/
(
tx2
-
tx1
);
}
}
else
else
{
{
s_EndPointVertical
=
true
;
//signal second segment vertical
s_EndPointVertical
=
true
;
//signal second segment vertical
}
}
if
(
ty1
==
ty2
)
if
(
ty1
==
ty2
)
{
{
s_EndPointHorizontal
=
true
;
s_EndPointHorizontal
=
true
;
}
}
// Init parameters for the moved segment
// Init parameters for the moved segment
tx1
=
(
double
)
Track
->
m_Start
.
x
;
tx1
=
(
double
)
Track
->
m_Start
.
x
;
ty1
=
(
double
)
Track
->
m_Start
.
y
;
ty1
=
(
double
)
Track
->
m_Start
.
y
;
tx2
=
(
double
)
Track
->
m_End
.
x
;
tx2
=
(
double
)
Track
->
m_End
.
x
;
ty2
=
(
double
)
Track
->
m_End
.
y
;
ty2
=
(
double
)
Track
->
m_End
.
y
;
if
(
tx2
!=
tx1
)
if
(
tx2
!=
tx1
)
{
{
s_MovingSegmentSlope
=
(
ty2
-
ty1
)
/
(
tx2
-
tx1
);
s_MovingSegmentSlope
=
(
ty2
-
ty1
)
/
(
tx2
-
tx1
);
}
}
else
else
{
{
s_MovingSegmentVertical
=
true
;
//signal vertical line
s_MovingSegmentVertical
=
true
;
//signal vertical line
}
}
if
(
ty1
==
ty2
)
if
(
ty1
==
ty2
)
{
{
s_MovingSegmentHorizontal
=
true
;
s_MovingSegmentHorizontal
=
true
;
}
}
...
@@ -605,9 +619,11 @@ bool InitialiseDragParameters()
...
@@ -605,9 +619,11 @@ bool InitialiseDragParameters()
}
}
else
else
{
{
if
(
!
s_EndPointVertical
&&
(
s_MovingSegmentSlope
==
s_EndSegmentSlope
)
)
if
(
!
s_EndPointVertical
&&
(
s_MovingSegmentSlope
==
s_EndSegmentSlope
)
)
return
false
;
return
false
;
if
(
!
s_StartPointVertical
&&
(
s_MovingSegmentSlope
==
s_StartSegmentSlope
)
)
if
(
!
s_StartPointVertical
&&
(
s_MovingSegmentSlope
==
s_StartSegmentSlope
)
)
return
false
;
return
false
;
}
}
...
@@ -615,14 +631,13 @@ bool InitialiseDragParameters()
...
@@ -615,14 +631,13 @@ bool InitialiseDragParameters()
}
}
/*************************************************************************************/
/* Init parameters to move one node:
void
WinEDA_PcbFrame
::
Start_MoveOneNodeOrSegment
(
TRACK
*
track
,
wxDC
*
DC
,
int
command
)
/*************************************************************************************/
/* Init parametres to move one node:
* a via or/and a terminal point of a track segment
* a via or/and a terminal point of a track segment
* The terminal point of other connected segments (if any) are moved too.
* The terminal point of other connected segments (if any) are moved too.
*/
*/
void
WinEDA_PcbFrame
::
Start_MoveOneNodeOrSegment
(
TRACK
*
track
,
wxDC
*
DC
,
int
command
)
{
{
if
(
!
track
)
if
(
!
track
)
return
;
return
;
...
@@ -631,7 +646,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
...
@@ -631,7 +646,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
NbPtNewTrack
=
0
;
NbPtNewTrack
=
0
;
EraseDragListe
();
EraseDragListe
();
/* Change highlighted net: the new one will be high
t
lighted */
/* Change highlighted net: the new one will be highlighted */
Old_HightLigt_Status
=
g_HightLigt_Status
;
Old_HightLigt_Status
=
g_HightLigt_Status
;
Old_HightLigth_NetCode
=
g_HightLigth_NetCode
;
Old_HightLigth_NetCode
=
g_HightLigth_NetCode
;
if
(
g_HightLigt_Status
)
if
(
g_HightLigt_Status
)
...
@@ -644,7 +659,8 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
...
@@ -644,7 +659,8 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
if
(
command
!=
ID_POPUP_PCB_MOVE_TRACK_SEGMENT
)
if
(
command
!=
ID_POPUP_PCB_MOVE_TRACK_SEGMENT
)
{
{
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
track
->
m_Start
,
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
track
->
m_Start
,
track
->
ReturnMaskLayer
(),
track
->
GetNet
()
);
track
->
ReturnMaskLayer
(),
track
->
GetNet
()
);
}
}
NewTrack
=
track
;
NewTrack
=
track
;
NbPtNewTrack
=
1
;
NbPtNewTrack
=
1
;
...
@@ -665,23 +681,27 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
...
@@ -665,23 +681,27 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
case
ID_POPUP_PCB_DRAG_TRACK_SEGMENT
:
case
ID_POPUP_PCB_DRAG_TRACK_SEGMENT
:
pos
=
track
->
m_Start
;
pos
=
track
->
m_Start
;
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
pos
,
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
pos
,
track
->
ReturnMaskLayer
(),
track
->
GetNet
()
);
track
->
ReturnMaskLayer
(),
track
->
GetNet
()
);
pos
=
track
->
m_End
;
pos
=
track
->
m_End
;
track
->
m_Flags
|=
IS_DRAGGED
|
ENDPOINT
|
STARTPOINT
;
track
->
m_Flags
|=
IS_DRAGGED
|
ENDPOINT
|
STARTPOINT
;
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
pos
,
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
pos
,
track
->
ReturnMaskLayer
(),
track
->
GetNet
()
);
track
->
ReturnMaskLayer
(),
track
->
GetNet
()
);
break
;
break
;
case
ID_POPUP_PCB_MOVE_TRACK_NODE
:
case
ID_POPUP_PCB_MOVE_TRACK_NODE
:
pos
=
(
diag
&
STARTPOINT
)
?
track
->
m_Start
:
track
->
m_End
;
pos
=
(
diag
&
STARTPOINT
)
?
track
->
m_Start
:
track
->
m_End
;
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
pos
,
Collect_TrackSegmentsToDrag
(
DrawPanel
,
DC
,
pos
,
track
->
ReturnMaskLayer
(),
track
->
GetNet
()
);
track
->
ReturnMaskLayer
(),
track
->
GetNet
()
);
PosInit
=
pos
;
PosInit
=
pos
;
break
;
break
;
}
}
track
->
m_Flags
|=
IS_DRAGGED
;
track
->
m_Flags
|=
IS_DRAGGED
;
}
}
// Prepare the Undo command
// Prepare the Undo command
ITEM_PICKER
picker
(
track
,
UR_CHANGED
);
ITEM_PICKER
picker
(
track
,
UR_CHANGED
);
picker
.
m_Link
=
track
->
Copy
();
picker
.
m_Link
=
track
->
Copy
();
...
@@ -693,7 +713,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
...
@@ -693,7 +713,7 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
picker
.
m_PickedItem
=
draggedtrack
;
picker
.
m_PickedItem
=
draggedtrack
;
picker
.
m_Link
=
draggedtrack
->
Copy
();
picker
.
m_Link
=
draggedtrack
->
Copy
();
s_ItemsListPicker
.
PushItem
(
picker
);
s_ItemsListPicker
.
PushItem
(
picker
);
draggedtrack
=
(
TRACK
*
)
picker
.
m_Link
;
draggedtrack
=
(
TRACK
*
)
picker
.
m_Link
;
draggedtrack
->
SetStatus
(
0
);
draggedtrack
->
SetStatus
(
0
);
draggedtrack
->
m_Flags
=
0
;
draggedtrack
->
m_Flags
=
0
;
}
}
...
@@ -707,12 +727,13 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
...
@@ -707,12 +727,13 @@ void WinEDA_PcbFrame::Start_MoveOneNodeOrSegment( TRACK* track, wxDC* DC, int co
GetBoard
()
->
DrawHighLight
(
DrawPanel
,
DC
,
g_HightLigth_NetCode
);
GetBoard
()
->
DrawHighLight
(
DrawPanel
,
DC
,
g_HightLigth_NetCode
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
true
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
true
);
}
}
#if 0
#if 0
// @todo: This function is broken: does not handle pointers to pads for start and end and flags relative to these pointers
// @todo: This function is broken: does not handle pointers to pads for start
// and end and flags relative to these pointers
void SortTrackEndPoints( TRACK* track )
void SortTrackEndPoints( TRACK* track )
{
{
//sort the track endpoints -- should not matter in terms of drawing
//sort the track endpoints -- should not matter in terms of drawing
...
@@ -723,30 +744,32 @@ void SortTrackEndPoints( TRACK* track )
...
@@ -723,30 +744,32 @@ void SortTrackEndPoints( TRACK* track )
{
{
if( track->m_Start.x > track->m_End.x )
if( track->m_Start.x > track->m_End.x )
{
{
EXCHG(
track->m_Start, track->m_End
);
EXCHG(
track->m_Start, track->m_End
);
}
}
}
}
else
else
{
{
if( track->m_Start.y > track->m_End.y )
if( track->m_Start.y > track->m_End.y )
{
{
EXCHG(
track->m_Start, track->m_End
);
EXCHG(
track->m_Start, track->m_End
);
}
}
}
}
}
}
/***********************************************************************************/
bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
/***********************************************************************************/
/**
/**
* @todo: this function is broken, because it merge segments having different width or without any connectivity test.
* @todo: this function is broken, because it merge segments having different
* 2 collinear segments can be merged only in no other segment or via is connected to the common point
* width or without any connectivity test.
* 2 collinear segments can be merged only in no other segment or via is
* connected to the common point
* and if they have the same width. See cleanup.cpp for merge functions,
* and if they have the same width. See cleanup.cpp for merge functions,
* and consider Marque_Une_Piste() to locate segments that can be merged
* and consider Marque_Une_Piste() to locate segments that can be merged
*/
*/
bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
testtrack = (TRACK*) Locate_Piste_Connectee( track, GetBoard()->m_Track, NULL, end );
{
testtrack = (TRACK*) Locate_Piste_Connectee( track,
GetBoard()->m_Track, NULL,
end );
if( testtrack )
if( testtrack )
{
{
SortTrackEndPoints( track );
SortTrackEndPoints( track );
...
@@ -756,11 +779,14 @@ bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
...
@@ -756,11 +779,14 @@ bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
int tdx = testtrack->m_End.x - testtrack->m_Start.x;
int tdx = testtrack->m_End.x - testtrack->m_Start.x;
int tdy = testtrack->m_End.y - testtrack->m_Start.y;
int tdy = testtrack->m_End.y - testtrack->m_Start.y;
if( (dy * tdx == dx * tdy && dy != 0 && dx != 0 && tdy != 0 && tdx != 0) /*angle, same slope*/
if( ( dy * tdx == dx * tdy && dy != 0 && dx != 0 && tdy != 0 && tdx !=
|| (dy == 0 && tdy == 0 && dx * tdx ) /*horizontal*/
0 ) /* angle, same slope */
|| (dx == 0 && tdx == 0 && dy * tdy ) /*vertical*/ )
|| ( dy == 0 && tdy == 0 && dx * tdx ) /*horizontal */
|| ( dx == 0 && tdx == 0 && dy * tdy ) /*vertical */
)
{
{
if( track->m_Start == testtrack->m_Start || track->m_End == testtrack->m_Start )
if( track->m_Start == testtrack->m_Start || track->m_End ==
testtrack->m_Start )
{
{
if( ( dx * tdx && testtrack->m_End.x > track->m_End.x )
if( ( dx * tdx && testtrack->m_End.x > track->m_End.x )
||( dy * tdy && testtrack->m_End.y > track->m_End.y ) )
||( dy * tdy && testtrack->m_End.y > track->m_End.y ) )
...
@@ -771,7 +797,8 @@ bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
...
@@ -771,7 +797,8 @@ bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
return true;
return true;
}
}
}
}
if( track->m_Start == testtrack->m_End || track->m_End == testtrack->m_End )
if( track->m_Start == testtrack->m_End || track->m_End ==
testtrack->m_End )
{
{
if( ( dx * tdx && testtrack->m_Start.x < track->m_Start.x )
if( ( dx * tdx && testtrack->m_Start.x < track->m_Start.x )
||( dy * tdy && testtrack->m_Start.y < track->m_Start.y ) )
||( dy * tdy && testtrack->m_Start.y < track->m_Start.y ) )
...
@@ -784,13 +811,16 @@ bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
...
@@ -784,13 +811,16 @@ bool WinEDA_PcbFrame::MergeCollinearTracks( TRACK* track, wxDC* DC, int end )
}
}
}
}
}
}
return false;
return false;
}
}
#endif
#endif
/***********************************************************************************/
void
WinEDA_PcbFrame
::
Start_DragTrackSegmentAndKeepSlope
(
TRACK
*
track
,
wxDC
*
DC
)
void
WinEDA_PcbFrame
::
Start_DragTrackSegmentAndKeepSlope
(
TRACK
*
track
,
/***********************************************************************************/
wxDC
*
DC
)
{
{
TRACK
*
TrackToStartPoint
=
NULL
;
TRACK
*
TrackToStartPoint
=
NULL
;
TRACK
*
TrackToEndPoint
=
NULL
;
TRACK
*
TrackToEndPoint
=
NULL
;
...
@@ -801,57 +831,66 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
...
@@ -801,57 +831,66 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
#if 0
#if 0
// Broken functions: see comments
// Broken functions: see comments
while( MergeCollinearTracks( track, DC, START ) )
while( MergeCollinearTracks( track, DC, START ) )
{
{
};
}
;
while( MergeCollinearTracks( track, DC, END ) )
while( MergeCollinearTracks( track, DC, END ) )
{
{
};
}
;
#endif
#endif
s_StartSegmentPresent
=
s_EndSegmentPresent
=
true
;
s_StartSegmentPresent
=
s_EndSegmentPresent
=
true
;
if
(
(
track
->
start
==
NULL
)
||
(
track
->
start
->
Type
()
==
TYPE_TRACK
)
)
if
(
(
track
->
start
==
NULL
)
||
(
track
->
start
->
Type
()
==
TYPE_TRACK
)
)
TrackToStartPoint
=
Locate_Piste_Connectee
(
track
,
TrackToStartPoint
=
Locate_Piste_Connectee
(
track
,
GetBoard
()
->
m_Track
,
NULL
,
START
);
GetBoard
()
->
m_Track
,
NULL
,
START
);
// Test if more than one segment is connected to this point
// Test if more than one segment is connected to this point
if
(
TrackToStartPoint
)
if
(
TrackToStartPoint
)
{
{
TrackToStartPoint
->
SetState
(
BUSY
,
ON
);
TrackToStartPoint
->
SetState
(
BUSY
,
ON
);
if
(
(
TrackToStartPoint
->
Type
()
==
TYPE_VIA
)
||
if
(
(
TrackToStartPoint
->
Type
()
==
TYPE_VIA
)
Locate_Piste_Connectee
(
track
,
GetBoard
()
->
m_Track
,
NULL
,
START
)
)
||
Locate_Piste_Connectee
(
track
,
GetBoard
()
->
m_Track
,
NULL
,
START
)
)
error
=
true
;
error
=
true
;
TrackToStartPoint
->
SetState
(
BUSY
,
OFF
);
TrackToStartPoint
->
SetState
(
BUSY
,
OFF
);
}
}
if
(
(
track
->
end
==
NULL
)
||
(
track
->
end
->
Type
()
==
TYPE_TRACK
)
)
if
(
(
track
->
end
==
NULL
)
||
(
track
->
end
->
Type
()
==
TYPE_TRACK
)
)
TrackToEndPoint
=
Locate_Piste_Connectee
(
track
,
GetBoard
()
->
m_Track
,
NULL
,
END
);
TrackToEndPoint
=
Locate_Piste_Connectee
(
track
,
GetBoard
()
->
m_Track
,
NULL
,
END
);
// Test if more than one segment is connected to this point
// Test if more than one segment is connected to this point
if
(
TrackToEndPoint
)
if
(
TrackToEndPoint
)
{
{
TrackToEndPoint
->
SetState
(
BUSY
,
ON
);
TrackToEndPoint
->
SetState
(
BUSY
,
ON
);
if
(
(
TrackToEndPoint
->
Type
()
==
TYPE_VIA
)
||
if
(
(
TrackToEndPoint
->
Type
()
==
TYPE_VIA
)
Locate_Piste_Connectee
(
track
,
GetBoard
()
->
m_Track
,
NULL
,
END
)
)
||
Locate_Piste_Connectee
(
track
,
GetBoard
()
->
m_Track
,
NULL
,
END
)
)
error
=
true
;
error
=
true
;
TrackToEndPoint
->
SetState
(
BUSY
,
OFF
);
TrackToEndPoint
->
SetState
(
BUSY
,
OFF
);
}
}
if
(
error
)
if
(
error
)
{
{
DisplayError
(
this
,
_
(
"Unable to drag this segment: too many segments connected"
)
);
DisplayError
(
this
,
_
(
"Unable to drag this segment: too many segments connected"
)
);
return
;
return
;
}
}
if
(
!
TrackToStartPoint
||
(
TrackToStartPoint
->
Type
()
!=
TYPE_TRACK
)
)
if
(
!
TrackToStartPoint
||
(
TrackToStartPoint
->
Type
()
!=
TYPE_TRACK
)
)
s_StartSegmentPresent
=
FALSE
;
s_StartSegmentPresent
=
FALSE
;
if
(
!
TrackToEndPoint
||
(
TrackToEndPoint
->
Type
()
!=
TYPE_TRACK
)
)
if
(
!
TrackToEndPoint
||
(
TrackToEndPoint
->
Type
()
!=
TYPE_TRACK
)
)
s_EndSegmentPresent
=
FALSE
;
s_EndSegmentPresent
=
FALSE
;
/* Change high
t light net: the new one will be hight
lighted */
/* Change high
light net: the new one will be high
lighted */
Old_HightLigt_Status
=
g_HightLigt_Status
;
Old_HightLigt_Status
=
g_HightLigt_Status
;
Old_HightLigth_NetCode
=
g_HightLigth_NetCode
;
Old_HightLigth_NetCode
=
g_HightLigth_NetCode
;
if
(
g_HightLigt_Status
)
if
(
g_HightLigt_Status
)
...
@@ -902,14 +941,15 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
...
@@ -902,14 +941,15 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
picker
.
m_PickedItem
=
draggedtrack
;
picker
.
m_PickedItem
=
draggedtrack
;
picker
.
m_Link
=
draggedtrack
->
Copy
();
picker
.
m_Link
=
draggedtrack
->
Copy
();
s_ItemsListPicker
.
PushItem
(
picker
);
s_ItemsListPicker
.
PushItem
(
picker
);
draggedtrack
=
(
TRACK
*
)
picker
.
m_Link
;
draggedtrack
=
(
TRACK
*
)
picker
.
m_Link
;
draggedtrack
->
SetStatus
(
0
);
draggedtrack
->
SetStatus
(
0
);
draggedtrack
->
m_Flags
=
0
;
draggedtrack
->
m_Flags
=
0
;
}
}
if
(
!
InitialiseDragParameters
()
)
if
(
!
InitialiseDragParameters
()
)
{
{
DisplayError
(
this
,
_
(
"Unable to drag this segment: two collinear segments"
)
);
DisplayError
(
this
,
_
(
"Unable to drag this segment: two collinear segments"
)
);
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ManageCurseur
=
NULL
;
Abort_MoveTrack
(
DrawPanel
,
DC
);
Abort_MoveTrack
(
DrawPanel
,
DC
);
return
;
return
;
...
@@ -917,10 +957,8 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
...
@@ -917,10 +957,8 @@ void WinEDA_PcbFrame::Start_DragTrackSegmentAndKeepSlope( TRACK* track, wxDC* DC
}
}
/**********************************************************************/
bool
WinEDA_PcbFrame
::
PlaceDraggedOrMovedTrackSegment
(
TRACK
*
Track
,
wxDC
*
DC
)
/**********************************************************************/
/* Place a dragged (or moved) track segment or via */
/* Place a dragged (or moved) track segment or via */
bool
WinEDA_PcbFrame
::
PlaceDraggedOrMovedTrackSegment
(
TRACK
*
Track
,
wxDC
*
DC
)
{
{
int
errdrc
;
int
errdrc
;
DRAG_SEGM
*
pt_drag
;
DRAG_SEGM
*
pt_drag
;
...
@@ -963,16 +1001,20 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
...
@@ -963,16 +1001,20 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
Track
->
Draw
(
DrawPanel
,
DC
,
draw_mode
);
Track
->
Draw
(
DrawPanel
,
DC
,
draw_mode
);
/* Test the connections modified by the move
/* Test the connections modified by the move
* (only pad connection must be tested, track connection will be tested by test_1_net_connexion() ) */
* (only pad connection must be tested, track connection will be
* tested by test_1_net_connexion() ) */
int
masque_layer
=
g_TabOneLayerMask
[
Track
->
GetLayer
()];
int
masque_layer
=
g_TabOneLayerMask
[
Track
->
GetLayer
()];
Track
->
start
=
Fast_Locate_Pad_Connecte
(
GetBoard
(),
Track
->
m_Start
,
masque_layer
);
Track
->
start
=
Fast_Locate_Pad_Connecte
(
Track
->
end
=
Fast_Locate_Pad_Connecte
(
GetBoard
(),
Track
->
m_End
,
masque_layer
);
GetBoard
(),
Track
->
m_Start
,
masque_layer
);
Track
->
end
=
Fast_Locate_Pad_Connecte
(
GetBoard
(),
Track
->
m_End
,
masque_layer
);
}
}
EraseDragListe
();
EraseDragListe
();
SaveCopyInUndoList
(
s_ItemsListPicker
,
UR_UNSPECIFIED
);
SaveCopyInUndoList
(
s_ItemsListPicker
,
UR_UNSPECIFIED
);
s_ItemsListPicker
.
ClearItemsList
();
// s_ItemsListPicker is no more owner of picked items
s_ItemsListPicker
.
ClearItemsList
();
// s_ItemsListPicker is no more owner
// of picked items
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ManageCurseur
=
NULL
;
...
@@ -985,20 +1027,17 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
...
@@ -985,20 +1027,17 @@ bool WinEDA_PcbFrame::PlaceDraggedOrMovedTrackSegment( TRACK* Track, wxDC* DC )
}
}
/************************************************************************/
/* Find the point "attachment" of the end of a trace.
BOARD_ITEM
*
LocateLockPoint
(
BOARD
*
Pcb
,
wxPoint
pos
,
int
LayerMask
)
* This may be a TBP or another segment of the trace
/************************************************************************/
* Returns:
* - Pointer to the PAD or:
/* Routine trouvant le point "d'accrochage" d'une extremite de piste.
* - Pointer to the segment or:
* Ce point peut etre un PAD ou un autre segment de piste
* Retourne:
* - pointeur sur ce PAD ou:
* - pointeur sur le segment ou:
* - NULL
* - NULL
*
Parametres d'appel
:
*
Parameters
:
*
coord pX, pY du point t
st
*
- position to te
st
*
masque des couches a tester
*
- mask layers to be tested
*/
*/
BOARD_ITEM
*
LocateLockPoint
(
BOARD
*
Pcb
,
wxPoint
pos
,
int
LayerMask
)
{
{
for
(
MODULE
*
module
=
Pcb
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
for
(
MODULE
*
module
=
Pcb
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
{
...
@@ -1007,8 +1046,7 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
...
@@ -1007,8 +1046,7 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
return
pad
;
return
pad
;
}
}
/* ici aucun pad n'a ete localise: detection d'un segment de piste */
/* No pad has been located so check for a segment of the trace. */
TRACK
*
ptsegm
=
Fast_Locate_Piste
(
Pcb
->
m_Track
,
NULL
,
pos
,
LayerMask
);
TRACK
*
ptsegm
=
Fast_Locate_Piste
(
Pcb
->
m_Track
,
NULL
,
pos
,
LayerMask
);
if
(
ptsegm
==
NULL
)
if
(
ptsegm
==
NULL
)
ptsegm
=
Locate_Pistes
(
Pcb
->
m_Track
,
pos
,
LayerMask
);
ptsegm
=
Locate_Pistes
(
Pcb
->
m_Track
,
pos
,
LayerMask
);
...
@@ -1017,25 +1055,26 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
...
@@ -1017,25 +1055,26 @@ BOARD_ITEM* LocateLockPoint( BOARD* Pcb, wxPoint pos, int LayerMask )
}
}
/******************************************************************************/
/* Create an intermediate point on a segment
TRACK
*
CreateLockPoint
(
wxPoint
&
aRefPoint
,
TRACK
*
aSegm
,
TRACK
*
aRefSegm
,
PICKED_ITEMS_LIST
*
aItemsListPicker
)
* ASegm segment is broken into 2 segments connecting point pX, pY
/******************************************************************************/
* Returns:
* NULL if no new point (ie if aRefPoint already corresponded
/* Routine de creation d'un point intermediaire sur un segment
* At one end where:
* le segment aSegm est casse en 2 segments se raccordant au point pX, pY
* Pointer to the segment created
* retourne:
* Created and the point is the intersection of 2 lines segments aSegm and
* NULL si pas de nouveau point ( c.a.d si aRefPoint correspondait deja
* refsegm
* a une extremite ou:
* Returns the exact value of aRefPoint
* pointeur sur le segment cree
* If aSegm points to a via:
* et le point cree est l'intersection des 2 axes des segments aSegm et refsegm
* Returns the exact value of aRefPoint and ptsegm,
* retourne la valeur exacte de aRefPoint
* But does not create extra point
* Si aSegm pointe sur une via:
* retourne la valeur exacte de aRefPoint et ptsegm,
* mais ne cree pas de point supplementaire
*/
*/
TRACK
*
CreateLockPoint
(
wxPoint
&
aRefPoint
,
TRACK
*
aSegm
,
TRACK
*
aRefSegm
,
PICKED_ITEMS_LIST
*
aItemsListPicker
)
{
{
int
cX
,
cY
;
int
cX
,
cY
;
int
dx
,
dy
;
/* Coord de l'extremite du segm ptsegm / origine */
int
dx
,
dy
;
if
(
aSegm
->
m_Start
==
aRefPoint
||
aSegm
->
m_End
==
aRefPoint
)
if
(
aSegm
->
m_Start
==
aRefPoint
||
aSegm
->
m_End
==
aRefPoint
)
return
NULL
;
return
NULL
;
...
@@ -1047,18 +1086,18 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
...
@@ -1047,18 +1086,18 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
return
aSegm
;
return
aSegm
;
}
}
/*
calcul des coord vraies du point intermediaire dans le repere d'origine
/*
Calculation coordinate of intermediate point in the coordinate origin
*
= origine de
ptsegm
*
= Original
ptsegm
*/
*/
cX
=
aRefPoint
.
x
-
aSegm
->
m_Start
.
x
;
cX
=
aRefPoint
.
x
-
aSegm
->
m_Start
.
x
;
cY
=
aRefPoint
.
y
-
aSegm
->
m_Start
.
y
;
cY
=
aRefPoint
.
y
-
aSegm
->
m_Start
.
y
;
dx
=
aSegm
->
m_End
.
x
-
aSegm
->
m_Start
.
x
;
dx
=
aSegm
->
m_End
.
x
-
aSegm
->
m_Start
.
x
;
dy
=
aSegm
->
m_End
.
y
-
aSegm
->
m_Start
.
y
;
dy
=
aSegm
->
m_End
.
y
-
aSegm
->
m_Start
.
y
;
// Not yet used:
// Not yet used:
#if 0
#if 0
int ox, oy, fx, fy; /* coord de refsegm / origine de prsegm */
int ox, oy, fx, fy;
if( aRefSegm )
if( aRefSegm )
{
{
ox = aRefSegm->m_Start.x - aSegm->m_Start.x;
ox = aRefSegm->m_Start.x - aSegm->m_Start.x;
...
@@ -1068,16 +1107,15 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
...
@@ -1068,16 +1107,15 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
}
}
#endif
#endif
/*
pour que le point soit sur l
e segment ptsegm: cY/cX = dy/dx */
/*
that the item be on th
e segment ptsegm: cY/cX = dy/dx */
if
(
dx
==
0
)
if
(
dx
==
0
)
cX
=
0
;
/* segm horizontal */
cX
=
0
;
/* segm horizontal */
else
else
cY
=
(
cX
*
dy
)
/
dx
;
cY
=
(
cX
*
dy
)
/
dx
;
/*
creation du point intermediaire ( c'est a dire creation d'un nouveau
/*
Create the intermediate point (that is to say creation of a new
* segment,
debutant au point intermediaire
* segment,
beginning at the intermediate point.
*/
*/
cX
+=
aSegm
->
m_Start
.
x
;
cX
+=
aSegm
->
m_Start
.
x
;
cY
+=
aSegm
->
m_Start
.
y
;
cY
+=
aSegm
->
m_Start
.
y
;
...
@@ -1085,7 +1123,7 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
...
@@ -1085,7 +1123,7 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
if
(
aItemsListPicker
)
if
(
aItemsListPicker
)
{
{
ITEM_PICKER
picker
(
newTrack
,
UR_NEW
);
ITEM_PICKER
picker
(
newTrack
,
UR_NEW
);
aItemsListPicker
->
PushItem
(
picker
);
aItemsListPicker
->
PushItem
(
picker
);
}
}
...
@@ -1093,22 +1131,22 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
...
@@ -1093,22 +1131,22 @@ TRACK* CreateLockPoint( wxPoint & aRefPoint, TRACK* aSegm, TRACK* aRefSegm, PICK
wxASSERT
(
list
);
wxASSERT
(
list
);
list
->
Insert
(
newTrack
,
aSegm
->
Next
()
);
list
->
Insert
(
newTrack
,
aSegm
->
Next
()
);
/*
correction du pointeur de fin du nouveau segment
*/
/*
Correct pointer at the end of the new segment.
*/
newTrack
->
end
=
aSegm
->
end
;
newTrack
->
end
=
aSegm
->
end
;
/*
le segment primitif finit au nouveau point :
*/
/*
Segment ends at new point.
*/
if
(
aItemsListPicker
)
if
(
aItemsListPicker
)
{
{
ITEM_PICKER
picker
(
aSegm
,
UR_CHANGED
);
ITEM_PICKER
picker
(
aSegm
,
UR_CHANGED
);
picker
.
m_Link
=
aSegm
->
Copy
();
picker
.
m_Link
=
aSegm
->
Copy
();
aItemsListPicker
->
PushItem
(
picker
);
aItemsListPicker
->
PushItem
(
picker
);
}
}
aSegm
->
m_End
.
x
=
cX
;
aSegm
->
m_End
.
x
=
cX
;
aSegm
->
m_End
.
y
=
cY
;
aSegm
->
m_End
.
y
=
cY
;
aSegm
->
SetState
(
END_ONPAD
,
OFF
);
aSegm
->
SetState
(
END_ONPAD
,
OFF
);
/*
le nouveau segment debute au nouveau point :
*/
/*
The next segment begins at the new point.
*/
aSegm
=
newTrack
;;
aSegm
=
newTrack
;;
aSegm
->
m_Start
.
x
=
cX
;
aSegm
->
m_Start
.
x
=
cX
;
aSegm
->
m_Start
.
y
=
cY
;
aSegm
->
m_Start
.
y
=
cY
;
...
...
pcbnew/muonde.cpp
View file @
1a139a7f
/****************************************************/
/*******************************************/
/* Gestion des composants specifiques aux microndes */
/* mounde.cpp - Microwave pcb layout code. */
/****************************************************/
/*******************************************/
/* File MUONDE.CPP */
#include "fctsys.h"
#include "fctsys.h"
#include "common.h"
#include "common.h"
...
@@ -16,11 +14,7 @@
...
@@ -16,11 +14,7 @@
#include "class_board_design_settings.h"
#include "class_board_design_settings.h"
#include "protos.h"
#include "protos.h"
/* Fonctions locales */
//static void Exit_Muonde(WinEDA_DrawFrame * frame, wxDC *DC);
/* Variables locales : */
#define COEFF_COUNT 6
#define COEFF_COUNT 6
static
double
*
PolyEdges
;
static
double
*
PolyEdges
;
static
int
PolyEdgesCount
;
static
int
PolyEdgesCount
;
...
@@ -28,58 +22,59 @@ static double ShapeScaleX, ShapeScaleY;
...
@@ -28,58 +22,59 @@ static double ShapeScaleX, ShapeScaleY;
static
wxSize
ShapeSize
;
static
wxSize
ShapeSize
;
static
int
PolyShapeType
;
static
int
PolyShapeType
;
/* Fonctions locales */
static
void
Exit_Self
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
void
Exit_Self
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
EDGE_MODULE
*
gen_arc
(
MODULE
*
aModule
,
EDGE_MODULE
*
PtSegm
,
int
cX
,
int
cY
,
int
angle
);
static
EDGE_MODULE
*
gen_arc
(
MODULE
*
aModule
,
static
void
ShowCadreSelf
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
EDGE_MODULE
*
PtSegm
,
int
cX
,
int
cY
,
int
angle
);
static
void
ShowCadreSelf
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
/* structures locales */
class
SELFPCB
class
SELFPCB
// Definition d'une self constituee par une piste
{
{
public
:
public
:
int
forme
;
// S
erpentin, spirale
..
int
forme
;
// S
hape: coil, spiral, etc
..
int
orient
;
// 0..3600
int
orient
;
// 0..3600
int
valeur
;
// Val
eur de la self
int
valeur
;
// Val
ue.
wxPoint
m_Start
;
wxPoint
m_Start
;
wxPoint
m_End
;
// Coord du point de depart et d'arrivee
wxPoint
m_End
;
wxSize
m_Size
;
wxSize
m_Size
;
D_PAD
*
pt_pad_start
,
*
pt_pad_end
;
// Pointeurs sur les pads d'extremite
D_PAD
*
pt_pad_start
,
*
pt_pad_end
;
int
lng
;
//
Longueur de la piste constituant la self
int
lng
;
//
Trace length.
int
m_Width
;
// m_Size.xur de la piste
int
m_Width
;
int
nbrin
;
//
Parametres de calcul: nombre de brins
int
nbrin
;
//
Number of segments.
int
lbrin
;
//
longueur du brin
int
lbrin
;
//
Length of segments.
int
rayon
;
// Ra
yon des raccords entre brins
int
rayon
;
// Ra
dius between segments.
int
delta
;
// distance
aux
pads
int
delta
;
// distance
between
pads
};
};
/* Variables locales */
static
SELFPCB
Mself
;
static
SELFPCB
Mself
;
static
int
Self_On
;
static
int
Self_On
;
static
int
Bl_X0
,
Bl_Y0
,
Bl_Xf
,
Bl_Yf
;
// Coord du cadre insrcivant la self
static
int
Bl_X0
,
Bl_Y0
,
Bl_Xf
,
Bl_Yf
;
/*
***********************************************************************
*/
/*
??? Routine d'affichage a l'ecran du cadre de la self
*/
static
void
ShowCadreSelf
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
static
void
ShowCadreSelf
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
/*************************************************************************/
/* Routine d'affichage a l'ecran du cadre de la self */
{
{
int
deltaX
,
deltaY
;
int
deltaX
,
deltaY
;
/* Calcul
de l'orientation et de la taille de la fenetre
:
/* Calcul
ate the orientation and size of the window
:
*
- orient = vert ou Horiz ( dimension max
)
*
- Orient = vertical or horizontal (maximum dimensions
)
* - Size.x = Size.y / 2
* - Size.x = Size.y / 2
*/
*/
GRSetDrawMode
(
DC
,
GR_XOR
);
GRSetDrawMode
(
DC
,
GR_XOR
);
if
(
erase
)
/* effacement du cadre */
if
(
erase
)
{
{
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
Bl_X0
,
Bl_Y0
,
Bl_Xf
,
Bl_Yf
,
YELLOW
);
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
Bl_X0
,
Bl_Y0
,
Bl_Xf
,
Bl_Yf
,
YELLOW
);
}
}
deltaX
=
(
panel
->
GetScreen
()
->
m_Curseur
.
x
-
Mself
.
m_Start
.
x
)
/
4
;
deltaX
=
(
panel
->
GetScreen
()
->
m_Curseur
.
x
-
Mself
.
m_Start
.
x
)
/
4
;
deltaY
=
(
panel
->
GetScreen
()
->
m_Curseur
.
y
-
Mself
.
m_Start
.
y
)
/
4
;
deltaY
=
(
panel
->
GetScreen
()
->
m_Curseur
.
y
-
Mself
.
m_Start
.
y
)
/
4
;
Mself
.
orient
=
900
;
Mself
.
orient
=
900
;
if
(
abs
(
deltaX
)
>
abs
(
deltaY
)
)
if
(
abs
(
deltaX
)
>
abs
(
deltaY
)
)
...
@@ -103,24 +98,19 @@ static void ShowCadreSelf( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
...
@@ -103,24 +98,19 @@ static void ShowCadreSelf( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
}
}
/*************************************************/
void
Exit_Self
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
void
Exit_Self
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/*************************************************/
/* Routine de fermeture de l'application : ferme les commandes en cours */
{
{
if
(
Self_On
)
if
(
Self_On
)
{
{
Self_On
=
0
;
Self_On
=
0
;
Panel
->
ManageCurseur
(
Panel
,
DC
,
0
);
/* efface cadre */
Panel
->
ManageCurseur
(
Panel
,
DC
,
0
);
Panel
->
ManageCurseur
=
NULL
;
Panel
->
ManageCurseur
=
NULL
;
Panel
->
ForceCloseManageCurseur
=
NULL
;
Panel
->
ForceCloseManageCurseur
=
NULL
;
}
}
}
}
/*******************************************/
void
WinEDA_PcbFrame
::
Begin_Self
(
wxDC
*
DC
)
void
WinEDA_PcbFrame
::
Begin_Self
(
wxDC
*
DC
)
/*******************************************/
{
{
if
(
Self_On
)
if
(
Self_On
)
{
{
...
@@ -132,7 +122,7 @@ void WinEDA_PcbFrame::Begin_Self( wxDC* DC )
...
@@ -132,7 +122,7 @@ void WinEDA_PcbFrame::Begin_Self( wxDC* DC )
Self_On
=
1
;
Self_On
=
1
;
/*
Mise a jour de l'origine des coord relatives
*/
/*
Update the initial coordinates.
*/
GetScreen
()
->
m_O_Curseur
=
GetScreen
()
->
m_Curseur
;
GetScreen
()
->
m_O_Curseur
=
GetScreen
()
->
m_Curseur
;
UpdateStatusBar
();
UpdateStatusBar
();
...
@@ -144,50 +134,47 @@ void WinEDA_PcbFrame::Begin_Self( wxDC* DC )
...
@@ -144,50 +134,47 @@ void WinEDA_PcbFrame::Begin_Self( wxDC* DC )
DrawPanel
->
ManageCurseur
=
ShowCadreSelf
;
DrawPanel
->
ManageCurseur
=
ShowCadreSelf
;
DrawPanel
->
ForceCloseManageCurseur
=
Exit_Self
;
DrawPanel
->
ForceCloseManageCurseur
=
Exit_Self
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
0
);
/* Affiche cadre */
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
0
);
}
}
/**********************************************/
/* Create a self-shaped coil
MODULE
*
WinEDA_PcbFrame
::
Genere_Self
(
wxDC
*
DC
)
* - Length Mself.lng
/**********************************************/
* - Extremities Mself.m_Start and Mself.m_End
* - Constraint: m_Start.x = m_End.x (self Vertical)
/* Genere une self en forme de serpentin
* Or m_Start.y = m_End.y (self Horizontal)
* - longueur Mself.lng
* - Extremites Mself.m_Start et Mself.m_End
* - Contrainte: m_Start.x = m_End.x ( self verticale )
* ou m_Start.y = m_End.y ( self horizontale )
*
*
*
On doit determiner
:
*
We must determine
:
*
Mself.nbrin = nombre de segments perpendiculaires a la
direction
*
Mself.nbrin = number of segments perpendicular to the
direction
*
( le serpention aura nbrin + 1 demicercles + 2 1/4 de ce
rcle)
*
(The coil nbrin will demicercles + 1 + 2 1 / 4 ci
rcle)
*
Mself.lbrin = longueur d'un brin
*
Mself.lbrin = length of a strand
*
Mself.rayon = rayon des parties arrondies du serpentin
*
Mself.rayon = radius of rounded parts of the coil
*
Mself.delta = segments raccord entre extremites et le serpention lui meme
*
Mself.delta = segments extremities connection between him and the coil even
*
*
*
Les equations sont
*
The equations are
*
Mself.m_Size.x = 2*
Mself.rayon + Mself.lbrin
*
Mself.m_Size.x = 2 *
Mself.rayon + Mself.lbrin
*
Mself.m_Size.y = 2*Mself.delta + 2*Mself.nbrin*
Mself.rayon
*
Mself.m_Size.y * Mself.delta = 2 + 2 * Mself.nbrin *
Mself.rayon
*
Mself.lng = 2*Mself.delta // Raccords au serpentin
*
Mself.lng = 2 * Mself.delta / / connections to the coil
+ (Mself.nbrin-2) * Mself.lbrin /
/longueur des brins sauf 1er et dernier
+ (Mself.nbrin-2) * Mself.lbrin /
/ length of the strands except 1st and last
+ (Mself.nbrin
+1) * ( PI * Mself.rayon) // longueur des arrondis
+ (Mself.nbrin
1) * (PI * Mself.rayon) / / length of rounded
+ Mself.lbrin/2 - Melf.rayon*2) // longueur du 1er et dernier brin
* Mself.lbrin + / 2 - Melf.rayon * 2) / / length of 1st and last bit
*
*
*
Les contraintes sont
:
*
The constraints are
:
*
n
brin >= 2
*
N
brin >= 2
* Mself.rayon < Mself.m_Size.x
* Mself.rayon < Mself.m_Size.x
*
Mself.m_Size.y = Mself.rayon*4 + 2*
Mself.raccord
*
Mself.m_Size.y = Mself.rayon * 4 + 2 *
Mself.raccord
*
Mself.lbrin > Mself.rayon *
2
*
Mself.lbrin> Mself.rayon *
2
*
*
*
Le calcul est conduit de la facon suivante
:
*
The calculation is conducted in the following way
:
*
Initialement
:
*
Initially
:
*
n
brin = 2
*
N
brin = 2
*
rayon = 4 * m_Size.x (valeur fixe arbitrair
e)
*
Radius = 4 * m_Size.x (arbitrarily fixed valu
e)
*
puis
:
*
Then
:
*
on augmente le nombre de brins jusqu'a la longueur desiree
*
Increasing the number of segments to the desired length
*
( le rayon est diminue si necessaire
)
*
(Radius decreases if necessary
)
*
*
*/
*/
MODULE
*
WinEDA_PcbFrame
::
Genere_Self
(
wxDC
*
DC
)
{
{
EDGE_MODULE
*
PtSegm
,
*
LastSegm
,
*
FirstSegm
,
*
newedge
;
EDGE_MODULE
*
PtSegm
,
*
LastSegm
,
*
FirstSegm
,
*
newedge
;
MODULE
*
Module
;
MODULE
*
Module
;
...
@@ -197,7 +184,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -197,7 +184,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
bool
abort
=
FALSE
;
bool
abort
=
FALSE
;
wxString
msg
;
wxString
msg
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
/* efface cadre */
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
...
@@ -211,10 +198,9 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -211,10 +198,9 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
Mself
.
m_End
=
GetScreen
()
->
m_Curseur
;
Mself
.
m_End
=
GetScreen
()
->
m_Curseur
;
/* Agencement des parametres pour simplifier le calcul : */
/* Fitting of parameters to simplify the calculation:
/* le point de depart doit avoir la coord depart < celle du point de fin */
* The starting point must be coord departure from the end point */
if
(
Mself
.
orient
==
0
)
// Horizontal
if
(
Mself
.
orient
==
0
)
// Self horizontale
{
{
Mself
.
m_End
.
y
=
Mself
.
m_Start
.
y
;
Mself
.
m_End
.
y
=
Mself
.
m_Start
.
y
;
if
(
Mself
.
m_Start
.
x
>
Mself
.
m_End
.
x
)
if
(
Mself
.
m_Start
.
x
>
Mself
.
m_End
.
x
)
...
@@ -222,7 +208,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -222,7 +208,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
Mself
.
m_Size
.
y
=
Mself
.
m_End
.
x
-
Mself
.
m_Start
.
x
;
Mself
.
m_Size
.
y
=
Mself
.
m_End
.
x
-
Mself
.
m_Start
.
x
;
Mself
.
lng
=
Mself
.
m_Size
.
y
;
Mself
.
lng
=
Mself
.
m_Size
.
y
;
}
}
else
// Self verticale
else
// Vertical
{
{
Mself
.
m_End
.
x
=
Mself
.
m_Start
.
x
;
Mself
.
m_End
.
x
=
Mself
.
m_Start
.
x
;
if
(
Mself
.
m_Start
.
y
>
Mself
.
m_End
.
y
)
if
(
Mself
.
m_Start
.
y
>
Mself
.
m_End
.
y
)
...
@@ -231,18 +217,18 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -231,18 +217,18 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
Mself
.
lng
=
Mself
.
m_Size
.
y
;
Mself
.
lng
=
Mself
.
m_Size
.
y
;
}
}
/* Ent
ree de la vraie longueur desiree
*/
/* Ent
er the desired length.
*/
if
(
!
g_UnitMetric
)
if
(
!
g_UnitMetric
)
{
{
fcoeff
=
10000.0
;
fcoeff
=
10000.0
;
msg
.
Printf
(
wxT
(
"%1.4f"
),
Mself
.
lng
/
fcoeff
);
msg
.
Printf
(
wxT
(
"%1.4f"
),
Mself
.
lng
/
fcoeff
);
abort
=
Get_Message
(
_
(
"Length(inch):"
),
_
(
"Length"
),
msg
,
this
);
abort
=
Get_Message
(
_
(
"Length(inch):"
),
_
(
"Length"
),
msg
,
this
);
}
}
else
else
{
{
fcoeff
=
10000.0
/
25.4
;
fcoeff
=
10000.0
/
25.4
;
msg
.
Printf
(
wxT
(
"%2.3f"
),
Mself
.
lng
/
fcoeff
);
msg
.
Printf
(
wxT
(
"%2.3f"
),
Mself
.
lng
/
fcoeff
);
abort
=
Get_Message
(
_
(
"Length(mm):"
),
_
(
"Length"
),
msg
,
this
);
abort
=
Get_Message
(
_
(
"Length(mm):"
),
_
(
"Length"
),
msg
,
this
);
}
}
if
(
abort
)
if
(
abort
)
return
NULL
;
return
NULL
;
...
@@ -255,42 +241,44 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -255,42 +241,44 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
}
}
Mself
.
lng
=
wxRound
(
fval
*
fcoeff
);
Mself
.
lng
=
wxRound
(
fval
*
fcoeff
);
/* Control
e des valeurs ( ii = valeur minimale de la longueur
*/
/* Control
values (ii = minimum length)
*/
if
(
Mself
.
lng
<
Mself
.
m_Size
.
y
)
if
(
Mself
.
lng
<
Mself
.
m_Size
.
y
)
{
{
DisplayError
(
this
,
_
(
"Requested length < minimum length"
)
);
DisplayError
(
this
,
_
(
"Requested length < minimum length"
)
);
return
NULL
;
return
NULL
;
}
}
/*
Generation du composant: calcul des elements de la self
*/
/*
Calculate the elements.
*/
Mself
.
m_Width
=
GetBoard
()
->
GetCurrentTrackWidth
();
Mself
.
m_Width
=
GetBoard
()
->
GetCurrentTrackWidth
();
Mself
.
m_Size
.
x
=
Mself
.
m_Size
.
y
/
2
;
Mself
.
m_Size
.
x
=
Mself
.
m_Size
.
y
/
2
;
// Cho
ix d'une Valeur de depart raisonnable pour le rayon des arcs de cercle
// Cho
ose a reasonable starting value for the radius of the arcs.
Mself
.
rayon
=
MIN
(
Mself
.
m_Width
*
5
,
Mself
.
m_Size
.
x
/
4
);
Mself
.
rayon
=
MIN
(
Mself
.
m_Width
*
5
,
Mself
.
m_Size
.
x
/
4
);
/* Calcul des parametres */
for
(
Mself
.
nbrin
=
2
;
;
Mself
.
nbrin
++
)
for
(
Mself
.
nbrin
=
2
;
;
Mself
.
nbrin
++
)
{
{
Mself
.
delta
=
(
Mself
.
m_Size
.
y
-
(
Mself
.
rayon
*
2
*
Mself
.
nbrin
)
)
/
2
;
Mself
.
delta
=
if
(
Mself
.
delta
<
Mself
.
m_Size
.
y
/
10
)
// C.a.d. si m_Size.yeur self > m_Size.yeur specifiee
(
Mself
.
m_Size
.
y
-
(
Mself
.
rayon
*
2
*
Mself
.
nbrin
)
)
/
2
;
{
// Reduction du rayon des arrondis
if
(
Mself
.
delta
<
Mself
.
m_Size
.
y
/
10
)
// Reduce radius.
{
Mself
.
delta
=
Mself
.
m_Size
.
y
/
10
;
Mself
.
delta
=
Mself
.
m_Size
.
y
/
10
;
Mself
.
rayon
=
(
Mself
.
m_Size
.
y
-
2
*
Mself
.
delta
)
/
(
2
*
Mself
.
nbrin
);
Mself
.
rayon
=
if
(
Mself
.
rayon
<
Mself
.
m_Width
)
(
Mself
.
m_Size
.
y
-
2
*
Mself
.
delta
)
/
(
2
*
Mself
.
nbrin
);
{
// Rayon vraiment trop petit...
if
(
Mself
.
rayon
<
Mself
.
m_Width
)
// Radius too small.
{
Affiche_Message
(
_
(
"Unable to create line: Requested length is too big"
)
);
Affiche_Message
(
_
(
"Unable to create line: Requested length is too big"
)
);
return
NULL
;
return
NULL
;
}
}
}
}
Mself
.
lbrin
=
Mself
.
m_Size
.
x
-
(
Mself
.
rayon
*
2
);
Mself
.
lbrin
=
Mself
.
m_Size
.
x
-
(
Mself
.
rayon
*
2
);
lextbrin
=
(
Mself
.
lbrin
/
2
)
-
Mself
.
rayon
;
lextbrin
=
(
Mself
.
lbrin
/
2
)
-
Mself
.
rayon
;
ll
=
2
*
lextbrin
;
// Longueur du 1er et dernier brin
ll
=
2
*
lextbrin
;
// Length of first and last
ll
+=
2
*
Mself
.
delta
;
// Longueur des raccord au serpentin
// segment.
ll
+=
Mself
.
nbrin
*
(
Mself
.
lbrin
-
2
);
// longueur des autres brins
ll
+=
2
*
Mself
.
delta
;
// Length of coil connections.
ll
+=
(
(
Mself
.
nbrin
+
1
)
*
314
*
Mself
.
rayon
)
/
100
;
ll
+=
Mself
.
nbrin
*
(
Mself
.
lbrin
-
2
);
// Length of other segments.
ll
+=
(
(
Mself
.
nbrin
+
1
)
*
314
*
Mself
.
rayon
)
/
100
;
msg
.
Printf
(
_
(
"Segm count = %d, Length = "
),
Mself
.
nbrin
);
msg
.
Printf
(
_
(
"Segment count = %d, length = "
),
Mself
.
nbrin
);
wxString
stlen
;
wxString
stlen
;
valeur_param
(
ll
,
stlen
);
valeur_param
(
ll
,
stlen
);
msg
+=
stlen
;
msg
+=
stlen
;
...
@@ -299,21 +287,19 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -299,21 +287,19 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
break
;
break
;
}
}
/* Generat
ion du composant : le calcul est fait self Verticale
*/
/* Generat
e module.
*/
Module
=
Create_1_Module
(
DC
,
wxEmptyString
);
Module
=
Create_1_Module
(
DC
,
wxEmptyString
);
if
(
Module
==
NULL
)
if
(
Module
==
NULL
)
return
NULL
;
return
NULL
;
// here the Module is already in the BOARD, Create_1_Module() does that.
// here the Module is already in the BOARD, Create_1_Module() does that.
Module
->
m_LibRef
=
wxT
(
"MuSelf"
);
Module
->
m_LibRef
=
wxT
(
"MuSelf"
);
Module
->
m_Attributs
=
MOD_VIRTUAL
|
MOD_CMS
;
Module
->
m_Attributs
=
MOD_VIRTUAL
|
MOD_CMS
;
Module
->
m_Flags
=
0
;
Module
->
m_Flags
=
0
;
Module
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
Module
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
/* Generation des elements speciaux: drawsegments */
/* Generate special features. */
FirstSegm
=
PtSegm
=
new
EDGE_MODULE
(
Module
);
FirstSegm
=
PtSegm
=
new
EDGE_MODULE
(
Module
);
Module
->
m_Drawings
.
PushBack
(
PtSegm
);
Module
->
m_Drawings
.
PushBack
(
PtSegm
);
...
@@ -332,7 +318,11 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -332,7 +318,11 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
PtSegm
=
newedge
;
PtSegm
=
newedge
;
PtSegm
->
m_Start
=
PtSegm
->
m_End
;
PtSegm
->
m_Start
=
PtSegm
->
m_End
;
PtSegm
=
gen_arc
(
Module
,
PtSegm
,
PtSegm
->
m_End
.
x
-
Mself
.
rayon
,
PtSegm
->
m_End
.
y
,
-
900
);
PtSegm
=
gen_arc
(
Module
,
PtSegm
,
PtSegm
->
m_End
.
x
-
Mself
.
rayon
,
PtSegm
->
m_End
.
y
,
-
900
);
if
(
lextbrin
)
if
(
lextbrin
)
{
{
...
@@ -346,7 +336,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -346,7 +336,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
PtSegm
->
m_End
.
x
-=
lextbrin
;
PtSegm
->
m_End
.
x
-=
lextbrin
;
}
}
/*
Trace du serpentin
*/
/*
Create coil.
*/
for
(
ii
=
1
;
ii
<
Mself
.
nbrin
;
ii
++
)
for
(
ii
=
1
;
ii
<
Mself
.
nbrin
;
ii
++
)
{
{
int
arc_angle
;
int
arc_angle
;
...
@@ -358,7 +348,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -358,7 +348,7 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
PtSegm
=
newedge
;
PtSegm
=
newedge
;
PtSegm
->
m_Start
=
PtSegm
->
m_End
;
PtSegm
->
m_Start
=
PtSegm
->
m_End
;
if
(
ii
&
1
)
/*
brin d'ordre impair : cercles de sens >
0 */
if
(
ii
&
1
)
/*
odd order arcs are greater than
0 */
arc_angle
=
1800
;
arc_angle
=
1800
;
else
else
arc_angle
=
-
1800
;
arc_angle
=
-
1800
;
...
@@ -382,9 +372,8 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -382,9 +372,8 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
}
}
}
}
/* Trace du point final */
/* Create last segment. */
if
(
ii
&
1
)
if
(
ii
&
1
)
/* brin final de sens > 0 */
{
{
if
(
lextbrin
)
if
(
lextbrin
)
{
{
...
@@ -403,8 +392,13 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -403,8 +392,13 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
Module
->
m_Drawings
.
PushBack
(
newedge
);
Module
->
m_Drawings
.
PushBack
(
newedge
);
PtSegm
=
newedge
;
PtSegm
=
newedge
;
PtSegm
->
m_Start
.
x
=
PtSegm
->
m_End
.
x
;
PtSegm
->
m_Start
.
y
=
PtSegm
->
m_End
.
y
;
PtSegm
->
m_Start
.
x
=
PtSegm
->
m_End
.
x
;
PtSegm
->
m_Start
.
y
=
PtSegm
=
gen_arc
(
Module
,
PtSegm
,
PtSegm
->
m_End
.
x
,
PtSegm
->
m_End
.
y
+
Mself
.
rayon
,
900
);
PtSegm
->
m_End
.
y
;
PtSegm
=
gen_arc
(
Module
,
PtSegm
,
PtSegm
->
m_End
.
x
,
PtSegm
->
m_End
.
y
+
Mself
.
rayon
,
900
);
}
}
else
else
{
{
...
@@ -425,7 +419,11 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -425,7 +419,11 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
Module
->
m_Drawings
.
PushBack
(
newedge
);
Module
->
m_Drawings
.
PushBack
(
newedge
);
PtSegm
=
newedge
;
PtSegm
=
newedge
;
PtSegm
->
m_Start
=
PtSegm
->
m_End
;
PtSegm
->
m_Start
=
PtSegm
->
m_End
;
PtSegm
=
gen_arc
(
Module
,
PtSegm
,
PtSegm
->
m_End
.
x
,
PtSegm
->
m_End
.
y
+
Mself
.
rayon
,
-
900
);
PtSegm
=
gen_arc
(
Module
,
PtSegm
,
PtSegm
->
m_End
.
x
,
PtSegm
->
m_End
.
y
+
Mself
.
rayon
,
-
900
);
}
}
newedge
=
new
EDGE_MODULE
(
Module
);
newedge
=
new
EDGE_MODULE
(
Module
);
...
@@ -436,11 +434,13 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -436,11 +434,13 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
PtSegm
->
m_Start
=
PtSegm
->
m_End
;
PtSegm
->
m_Start
=
PtSegm
->
m_End
;
PtSegm
->
m_End
=
Mself
.
m_End
;
PtSegm
->
m_End
=
Mself
.
m_End
;
/* Rotat
ion de la self si le trace doit etre horizontal :
*/
/* Rotat
e the coil if it has a horizontal orientation.
*/
LastSegm
=
PtSegm
;
LastSegm
=
PtSegm
;
if
(
Mself
.
orient
==
0
)
if
(
Mself
.
orient
==
0
)
{
{
for
(
PtSegm
=
FirstSegm
;
PtSegm
!=
NULL
;
PtSegm
=
(
EDGE_MODULE
*
)
PtSegm
->
Next
()
)
for
(
PtSegm
=
FirstSegm
;
PtSegm
!=
NULL
;
PtSegm
=
(
EDGE_MODULE
*
)
PtSegm
->
Next
()
)
{
{
RotatePoint
(
&
PtSegm
->
m_Start
.
x
,
&
PtSegm
->
m_Start
.
y
,
RotatePoint
(
&
PtSegm
->
m_Start
.
x
,
&
PtSegm
->
m_Start
.
y
,
FirstSegm
->
m_Start
.
x
,
FirstSegm
->
m_Start
.
y
,
900
);
FirstSegm
->
m_Start
.
x
,
FirstSegm
->
m_Start
.
y
,
900
);
...
@@ -450,20 +450,16 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -450,20 +450,16 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
}
}
}
}
/* Modif position ancre */
Module
->
m_Pos
=
LastSegm
->
m_End
;
Module
->
m_Pos
=
LastSegm
->
m_End
;
/* Place
ment des 2 pads sur extremite
*/
/* Place
pad on each end of coil.
*/
PtPad
=
new
D_PAD
(
Module
);
PtPad
=
new
D_PAD
(
Module
);
Module
->
m_Pads
.
PushFront
(
PtPad
);
Module
->
m_Pads
.
PushFront
(
PtPad
);
PtPad
->
SetPadName
(
wxT
(
"1"
)
);
PtPad
->
SetPadName
(
wxT
(
"1"
)
);
PtPad
->
m_Pos
=
LastSegm
->
m_End
;
PtPad
->
m_Pos
=
LastSegm
->
m_End
;
PtPad
->
m_Pos0
=
PtPad
->
m_Pos
-
Module
->
m_Pos
;
PtPad
->
m_Pos0
=
PtPad
->
m_Pos
-
Module
->
m_Pos
;
PtPad
->
m_Size
.
x
=
PtPad
->
m_Size
.
y
=
LastSegm
->
m_Width
;
PtPad
->
m_Size
.
x
=
PtPad
->
m_Size
.
y
=
LastSegm
->
m_Width
;
PtPad
->
m_Masque_Layer
=
g_TabOneLayerMask
[
LastSegm
->
GetLayer
()];
PtPad
->
m_Masque_Layer
=
g_TabOneLayerMask
[
LastSegm
->
GetLayer
()];
PtPad
->
m_Attribut
=
PAD_SMD
;
PtPad
->
m_Attribut
=
PAD_SMD
;
...
@@ -477,53 +473,46 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
...
@@ -477,53 +473,46 @@ MODULE* WinEDA_PcbFrame::Genere_Self( wxDC* DC )
PtPad
=
newpad
;
PtPad
=
newpad
;
PtPad
->
SetPadName
(
wxT
(
"2"
)
);
PtPad
->
SetPadName
(
wxT
(
"2"
)
);
PtPad
->
m_Pos
=
FirstSegm
->
m_Start
;
PtPad
->
m_Pos
=
FirstSegm
->
m_Start
;
PtPad
->
m_Pos0
=
PtPad
->
m_Pos
-
Module
->
m_Pos
;
PtPad
->
m_Pos0
=
PtPad
->
m_Pos
-
Module
->
m_Pos
;
/* Modif
des positions textes
*/
/* Modif
y text positions.
*/
Module
->
DisplayInfo
(
this
);
Module
->
DisplayInfo
(
this
);
Module
->
m_Value
->
m_Pos
.
x
=
Module
->
m_Reference
->
m_Pos
.
x
=
(
FirstSegm
->
m_Start
.
x
+
Module
->
m_Value
->
m_Pos
.
x
=
Module
->
m_Reference
->
m_Pos
.
x
=
LastSegm
->
m_End
.
x
)
/
2
;
(
FirstSegm
->
m_Start
.
x
+
LastSegm
->
m_End
.
x
)
/
2
;
Module
->
m_Value
->
m_Pos
.
y
=
Module
->
m_Reference
->
m_Pos
.
y
=
(
FirstSegm
->
m_Start
.
y
+
Module
->
m_Value
->
m_Pos
.
y
=
Module
->
m_Reference
->
m_Pos
.
y
=
LastSegm
->
m_End
.
y
)
/
2
;
(
FirstSegm
->
m_Start
.
y
+
LastSegm
->
m_End
.
y
)
/
2
;
Module
->
m_Reference
->
m_Pos
.
y
-=
Module
->
m_Reference
->
m_Size
.
y
;
Module
->
m_Reference
->
m_Pos
.
y
-=
Module
->
m_Reference
->
m_Size
.
y
;
Module
->
m_Value
->
m_Pos
.
y
+=
Module
->
m_Value
->
m_Size
.
y
;
Module
->
m_Value
->
m_Pos
.
y
+=
Module
->
m_Value
->
m_Size
.
y
;
Module
->
m_Reference
->
m_Pos0
=
Module
->
m_Reference
->
m_Pos
-
Module
->
m_Pos
;
Module
->
m_Reference
->
m_Pos0
=
Module
->
m_Reference
->
m_Pos
-
Module
->
m_Pos
;
Module
->
m_Value
->
m_Pos0
=
Module
->
m_Value
->
m_Pos
-
Module
->
m_Pos
;
Module
->
m_Value
->
m_Pos0
=
Module
->
m_Value
->
m_Pos
-
Module
->
m_Pos
;
/* Init
des Coord locales des segments
*/
/* Init
ial segment coordinates.
*/
for
(
PtSegm
=
FirstSegm
;
PtSegm
;
PtSegm
=
PtSegm
->
Next
()
)
for
(
PtSegm
=
FirstSegm
;
PtSegm
;
PtSegm
=
PtSegm
->
Next
()
)
{
{
PtSegm
->
m_Start0
=
PtSegm
->
m_Start
-
Module
->
m_Pos
;
PtSegm
->
m_Start0
=
PtSegm
->
m_Start
-
Module
->
m_Pos
;
PtSegm
->
m_End0
=
PtSegm
->
m_End
-
Module
->
m_Pos
;
PtSegm
->
m_End0
=
PtSegm
->
m_End
-
Module
->
m_Pos
;
}
}
Module
->
Set_Rectangle_Encadrement
();
Module
->
Set_Rectangle_Encadrement
();
Module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
Module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
return
Module
;
return
Module
;
}
}
/**************************************************************************/
/* Generate an arc EDGE_MODULE:
static
EDGE_MODULE
*
gen_arc
(
MODULE
*
aModule
,
EDGE_MODULE
*
PtSegm
,
int
cX
,
int
cY
,
int
angle
)
* Center cX, cY
/**************************************************************************/
* Angle "angle"
* Starting point gives the structure pointed to by PtSegm, which must
/* Genere un arc de EDGE_MODULE :
* Returns a pointer to the structure EDGE_MODULE generated.
* de centre cX,cY
* d'angle "angle"
* de point de depart donne dans la structure pointee par PtSegm, qui doit
* entre a jour (type,net..)
* Retourne un pointeur sur la derniere structure EDGE_MODULE generee
*/
*/
static
EDGE_MODULE
*
gen_arc
(
MODULE
*
aModule
,
EDGE_MODULE
*
PtSegm
,
int
cX
,
int
cY
,
int
angle
)
{
{
int
ii
,
nb_seg
;
int
ii
,
nb_seg
;
double
alpha
,
beta
,
fsin
,
fcos
;
double
alpha
,
beta
,
fsin
,
fcos
;
...
@@ -534,7 +523,9 @@ static EDGE_MODULE* gen_arc( MODULE* aModule, EDGE_MODULE* PtSegm, int cX, int c
...
@@ -534,7 +523,9 @@ static EDGE_MODULE* gen_arc( MODULE* aModule, EDGE_MODULE* PtSegm, int cX, int c
y0
=
PtSegm
->
m_Start
.
x
-
cX
;
y0
=
PtSegm
->
m_Start
.
x
-
cX
;
x0
=
PtSegm
->
m_Start
.
y
-
cY
;
x0
=
PtSegm
->
m_Start
.
y
-
cY
;
nb_seg
=
(
abs
(
angle
)
)
/
225
;
if
(
nb_seg
==
0
)
nb_seg
=
(
abs
(
angle
)
)
/
225
;
if
(
nb_seg
==
0
)
nb_seg
=
1
;
nb_seg
=
1
;
alpha
=
(
(
double
)
angle
*
3.14159
/
1800
)
/
nb_seg
;
alpha
=
(
(
double
)
angle
*
3.14159
/
1800
)
/
nb_seg
;
...
@@ -554,11 +545,11 @@ static EDGE_MODULE* gen_arc( MODULE* aModule, EDGE_MODULE* PtSegm, int cX, int c
...
@@ -554,11 +545,11 @@ static EDGE_MODULE* gen_arc( MODULE* aModule, EDGE_MODULE* PtSegm, int cX, int c
PtSegm
->
m_Start
=
PtSegm
->
m_End
;
PtSegm
->
m_Start
=
PtSegm
->
m_End
;
}
}
beta
=
(
alpha
*
ii
);
beta
=
(
alpha
*
ii
);
fcos
=
cos
(
beta
);
fsin
=
sin
(
beta
);
fcos
=
cos
(
beta
);
fsin
=
sin
(
beta
);
xr0
=
(
int
)
(
x0
*
fcos
+
y0
*
fsin
);
xr0
=
(
int
)
(
x0
*
fcos
+
y0
*
fsin
);
yr0
=
(
int
)
(
y0
*
fcos
-
x0
*
fsin
);
yr0
=
(
int
)
(
y0
*
fcos
-
x0
*
fsin
);
PtSegm
->
m_End
.
x
=
cX
+
yr0
;
PtSegm
->
m_End
.
x
=
cX
+
yr0
;
PtSegm
->
m_End
.
y
=
cY
+
xr0
;
PtSegm
->
m_End
.
y
=
cY
+
xr0
;
...
@@ -568,14 +559,12 @@ static EDGE_MODULE* gen_arc( MODULE* aModule, EDGE_MODULE* PtSegm, int cX, int c
...
@@ -568,14 +559,12 @@ static EDGE_MODULE* gen_arc( MODULE* aModule, EDGE_MODULE* PtSegm, int cX, int c
}
}
/***************************************************************************/
MODULE
*
WinEDA_PcbFrame
::
Create_MuWaveBasicShape
(
const
wxString
&
name
,
int
pad_count
)
/***************************************************************************/
/* Create a footprint with pad_count pads for micro wave applications
/* Create a footprint with pad_count pads for micro wave applications
* This footprint has pad_count pads:
* This footprint has pad_count pads:
* PAD_SMD, rectangular, H size = V size = current track width.
* PAD_SMD, rectangular, H size = V size = current track width.
*/
*/
MODULE
*
WinEDA_PcbFrame
::
Create_MuWaveBasicShape
(
const
wxString
&
name
,
int
pad_count
)
{
{
MODULE
*
Module
;
MODULE
*
Module
;
int
pad_num
=
1
;
int
pad_num
=
1
;
...
@@ -593,10 +582,10 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( const wxString& name, int pad_
...
@@ -593,10 +582,10 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( const wxString& name, int pad_
Module
->
m_Reference
->
m_Pos0
.
y
=
30
;
Module
->
m_Reference
->
m_Pos0
.
y
=
30
;
Module
->
m_Reference
->
m_Pos
.
y
+=
Module
->
m_Reference
->
m_Pos0
.
y
;
Module
->
m_Reference
->
m_Pos
.
y
+=
Module
->
m_Reference
->
m_Pos0
.
y
;
/* Creat
ion des pastilles formant le gap
*/
/* Creat
e dots forming the gap.
*/
while
(
pad_count
--
)
while
(
pad_count
--
)
{
{
D_PAD
*
pad
=
new
D_PAD
(
Module
);
D_PAD
*
pad
=
new
D_PAD
(
Module
);
Module
->
m_Pads
.
PushFront
(
pad
);
Module
->
m_Pads
.
PushFront
(
pad
);
...
@@ -609,14 +598,13 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( const wxString& name, int pad_
...
@@ -609,14 +598,13 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveBasicShape( const wxString& name, int pad_
pad
->
SetPadName
(
Line
);
pad
->
SetPadName
(
Line
);
pad_num
++
;
pad_num
++
;
}
}
return
Module
;
return
Module
;
}
}
#if 0
#if 0
/**********************************************************/
static void Exit_Muonde( WinEDA_DrawFrame* frame, wxDC* DC )
static void Exit_Muonde( WinEDA_DrawFrame* frame, wxDC* DC )
/**********************************************************/
{
{
MODULE* Module = (MODULE*) frame->GetScreen()->GetCurItem();
MODULE* Module = (MODULE*) frame->GetScreen()->GetCurItem();
...
@@ -625,7 +613,7 @@ static void Exit_Muonde( WinEDA_DrawFrame* frame, wxDC* DC )
...
@@ -625,7 +613,7 @@ static void Exit_Muonde( WinEDA_DrawFrame* frame, wxDC* DC )
if( Module->m_Flags & IS_NEW )
if( Module->m_Flags & IS_NEW )
{
{
Module->Draw( frame->DrawPanel, DC, GR_XOR );
Module->Draw( frame->DrawPanel, DC, GR_XOR );
Module
->DeleteStructure();
Module->DeleteStructure();
}
}
else
else
{
{
...
@@ -642,16 +630,13 @@ static void Exit_Muonde( WinEDA_DrawFrame* frame, wxDC* DC )
...
@@ -642,16 +630,13 @@ static void Exit_Muonde( WinEDA_DrawFrame* frame, wxDC* DC )
#endif
#endif
/***************************************************************************/
MODULE
*
WinEDA_PcbFrame
::
Create_MuWaveComponent
(
int
shape_type
)
/***************************************************************************/
/* Create a module "GAP" or "STUB"
/* Create a module "GAP" or "STUB"
* This a "gap" or "stub" used in micro wave designs
* This a "gap" or "stub" used in micro wave designs
* This modue has 2 pads:
* This modu
l
e has 2 pads:
* PAD_SMD, rectangular, H size = V size = current track width.
* PAD_SMD, rectangular, H size = V size = current track width.
* the "gap" is isolation created between this 2 pads
* the "gap" is isolation created between this 2 pads
*/
*/
MODULE
*
WinEDA_PcbFrame
::
Create_MuWaveComponent
(
int
shape_type
)
{
{
int
oX
;
int
oX
;
float
fcoeff
;
float
fcoeff
;
...
@@ -663,7 +648,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
...
@@ -663,7 +648,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
bool
abort
;
bool
abort
;
/* Enter the size of the gap or stub*/
/* Enter the size of the gap or stub*/
int
gap_size
=
GetBoard
()
->
GetCurrentTrackWidth
();
// Valeur raisonnable
int
gap_size
=
GetBoard
()
->
GetCurrentTrackWidth
();
switch
(
shape_type
)
switch
(
shape_type
)
{
{
...
@@ -702,7 +687,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
...
@@ -702,7 +687,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
value
.
Printf
(
wxT
(
"%2.3f"
),
gap_size
/
fcoeff
);
value
.
Printf
(
wxT
(
"%2.3f"
),
gap_size
/
fcoeff
);
msg
+=
_
(
" (inch):"
);
msg
+=
_
(
" (inch):"
);
}
}
abort
=
Get_Message
(
msg
,
_
(
"Create microwave module"
),
value
,
this
);
abort
=
Get_Message
(
msg
,
_
(
"Create microwave module"
),
value
,
this
);
double
fval
;
double
fval
;
if
(
!
value
.
ToDouble
(
&
fval
)
)
if
(
!
value
.
ToDouble
(
&
fval
)
)
...
@@ -712,12 +697,12 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
...
@@ -712,12 +697,12 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
}
}
gap_size
=
ABS
(
wxRound
(
fval
*
fcoeff
)
);
gap_size
=
ABS
(
wxRound
(
fval
*
fcoeff
)
);
if
(
!
abort
&&
(
shape_type
==
2
)
)
if
(
!
abort
&&
(
shape_type
==
2
)
)
{
{
fcoeff
=
10.0
;
fcoeff
=
10.0
;
value
.
Printf
(
wxT
(
"%3.1f"
),
angle
/
fcoeff
);
value
.
Printf
(
wxT
(
"%3.1f"
),
angle
/
fcoeff
);
msg
=
_
(
"Angle (0.1deg):"
);
msg
=
_
(
"Angle (0.1deg):"
);
abort
=
Get_Message
(
msg
,
_
(
"Create microwave module"
),
value
,
this
);
abort
=
Get_Message
(
msg
,
_
(
"Create microwave module"
),
value
,
this
);
if
(
!
value
.
ToDouble
(
&
fval
)
)
if
(
!
value
.
ToDouble
(
&
fval
)
)
{
{
DisplayError
(
this
,
_
(
"Incorrect number, abort"
)
);
DisplayError
(
this
,
_
(
"Incorrect number, abort"
)
);
...
@@ -740,9 +725,8 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
...
@@ -740,9 +725,8 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
switch
(
shape_type
)
switch
(
shape_type
)
{
{
case
0
:
//Gap :
case
0
:
//Gap :
oX
=
pad
->
m_Pos0
.
x
=
-
(
gap_size
+
pad
->
m_Size
.
x
)
/
2
;
oX
=
pad
->
m_Pos0
.
x
=
-
(
gap_size
+
pad
->
m_Size
.
x
)
/
2
;
pad
->
m_Pos
.
x
+=
pad
->
m_Pos0
.
x
;
pad
->
m_Pos
.
x
+=
pad
->
m_Pos0
.
x
;
pad
=
pad
->
Next
();
pad
=
pad
->
Next
();
pad
->
m_Pos0
.
x
=
oX
+
gap_size
+
pad
->
m_Size
.
x
;
pad
->
m_Pos0
.
x
=
oX
+
gap_size
+
pad
->
m_Size
.
x
;
pad
->
m_Pos
.
x
+=
pad
->
m_Pos0
.
x
;
pad
->
m_Pos
.
x
+=
pad
->
m_Pos0
.
x
;
...
@@ -751,7 +735,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
...
@@ -751,7 +735,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
case
1
:
//Stub :
case
1
:
//Stub :
pad
->
SetPadName
(
wxT
(
"1"
)
);
pad
->
SetPadName
(
wxT
(
"1"
)
);
pad
=
pad
->
Next
();
pad
=
pad
->
Next
();
pad
->
m_Pos0
.
y
=
-
(
gap_size
+
pad
->
m_Size
.
y
)
/
2
;
pad
->
m_Pos0
.
y
=
-
(
gap_size
+
pad
->
m_Size
.
y
)
/
2
;
pad
->
m_Size
.
y
=
gap_size
;
pad
->
m_Size
.
y
=
gap_size
;
pad
->
m_Pos
.
y
+=
pad
->
m_Pos0
.
y
;
pad
->
m_Pos
.
y
+=
pad
->
m_Pos0
.
y
;
break
;
break
;
...
@@ -764,17 +748,17 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
...
@@ -764,17 +748,17 @@ MODULE* WinEDA_PcbFrame::Create_MuWaveComponent( int shape_type )
edge
->
m_Shape
=
S_POLYGON
;
edge
->
m_Shape
=
S_POLYGON
;
edge
->
SetLayer
(
LAYER_CMP_N
);
edge
->
SetLayer
(
LAYER_CMP_N
);
int
numPoints
=
angle
/
50
+
3
;
// Note
: angles are in 0.1 degrees
int
numPoints
=
angle
/
50
+
3
;
// Note
: angles are in 0.1 degrees
edge
->
m_PolyPoints
.
reserve
(
numPoints
);
edge
->
m_PolyPoints
.
reserve
(
numPoints
);
edge
->
m_Start0
.
y
=
-
pad
->
m_Size
.
y
/
2
;
edge
->
m_Start0
.
y
=
-
pad
->
m_Size
.
y
/
2
;
edge
->
m_PolyPoints
.
push_back
(
wxPoint
(
0
,
0
)
);
edge
->
m_PolyPoints
.
push_back
(
wxPoint
(
0
,
0
)
);
int
theta
=
-
angle
/
2
;
int
theta
=
-
angle
/
2
;
for
(
int
ii
=
1
;
ii
<
numPoints
-
1
;
ii
++
)
for
(
int
ii
=
1
;
ii
<
numPoints
-
1
;
ii
++
)
{
{
wxPoint
pt
(
0
,
-
gap_size
);
wxPoint
pt
(
0
,
-
gap_size
);
RotatePoint
(
&
pt
.
x
,
&
pt
.
y
,
theta
);
RotatePoint
(
&
pt
.
x
,
&
pt
.
y
,
theta
);
...
@@ -807,22 +791,17 @@ enum id_mw_cmd {
...
@@ -807,22 +791,17 @@ enum id_mw_cmd {
ID_READ_SHAPE_FILE
=
1000
ID_READ_SHAPE_FILE
=
1000
};
};
/*************************************************/
class
WinEDA_SetParamShapeFrame
:
public
wxDialog
/*************************************************/
/*
Reglages des parametres des forme polynomiale
s
/*
Setting polynomial form parameter
s
*/
*/
class
WinEDA_SetParamShapeFrame
:
public
wxDialog
{
{
private
:
private
:
WinEDA_PcbFrame
*
m_Parent
;
WinEDA_PcbFrame
*
m_Parent
;
wxRadioBox
*
m_ShapeOptionCtrl
;
wxRadioBox
*
m_ShapeOptionCtrl
;
WinEDA_SizeCtrl
*
m_SizeCtrl
;
WinEDA_SizeCtrl
*
m_SizeCtrl
;
public
:
public
:
WinEDA_SetParamShapeFrame
(
WinEDA_PcbFrame
*
parent
,
const
wxPoint
&
pos
);
// Constructor and destructor
WinEDA_SetParamShapeFrame
(
WinEDA_PcbFrame
*
parent
,
const
wxPoint
&
pos
);
~
WinEDA_SetParamShapeFrame
()
{
};
~
WinEDA_SetParamShapeFrame
()
{
};
private
:
private
:
...
@@ -833,17 +812,14 @@ private:
...
@@ -833,17 +812,14 @@ private:
DECLARE_EVENT_TABLE
()
DECLARE_EVENT_TABLE
()
};
};
/* Construction de la table des evenements pour WinEDA_SetParamShapeFrame */
BEGIN_EVENT_TABLE
(
WinEDA_SetParamShapeFrame
,
wxDialog
)
EVT_BUTTON
(
wxID_OK
,
WinEDA_SetParamShapeFrame
::
OnOkClick
)
EVT_BUTTON
(
wxID_CANCEL
,
WinEDA_SetParamShapeFrame
::
OnCancelClick
)
EVT_BUTTON
(
ID_READ_SHAPE_FILE
,
WinEDA_SetParamShapeFrame
::
ReadDataShapeDescr
)
END_EVENT_TABLE
()
/*************************************************/
BEGIN_EVENT_TABLE
(
WinEDA_SetParamShapeFrame
,
wxDialog
)
/* Constructeur de WinEDA_SetParamShapeFrame */
EVT_BUTTON
(
wxID_OK
,
WinEDA_SetParamShapeFrame
::
OnOkClick
)
/************************************************/
EVT_BUTTON
(
wxID_CANCEL
,
WinEDA_SetParamShapeFrame
::
OnCancelClick
)
EVT_BUTTON
(
ID_READ_SHAPE_FILE
,
WinEDA_SetParamShapeFrame
::
ReadDataShapeDescr
)
END_EVENT_TABLE
()
WinEDA_SetParamShapeFrame
::
WinEDA_SetParamShapeFrame
(
WinEDA_PcbFrame
*
parent
,
WinEDA_SetParamShapeFrame
::
WinEDA_SetParamShapeFrame
(
WinEDA_PcbFrame
*
parent
,
const
wxPoint
&
framepos
)
:
const
wxPoint
&
framepos
)
:
...
@@ -870,28 +846,29 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( WinEDA_PcbFrame* parent,
...
@@ -870,28 +846,29 @@ WinEDA_SetParamShapeFrame::WinEDA_SetParamShapeFrame( WinEDA_PcbFrame* parent,
Button
=
new
wxButton
(
this
,
wxID_CANCEL
,
_
(
"Cancel"
)
);
Button
=
new
wxButton
(
this
,
wxID_CANCEL
,
_
(
"Cancel"
)
);
RightBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
RightBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
Button
=
new
wxButton
(
this
,
ID_READ_SHAPE_FILE
,
_
(
"Read Shape Descr File..."
)
);
Button
=
new
wxButton
(
this
,
ID_READ_SHAPE_FILE
,
_
(
"Read Shape Description File..."
)
);
RightBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
RightBoxSizer
->
Add
(
Button
,
0
,
wxGROW
|
wxALL
,
5
);
wxString
shapelist
[
3
]
=
{
_
(
"Normal"
),
_
(
"Symmetrical"
),
_
(
"Mirrored"
)
};
wxString
shapelist
[
3
]
=
{
_
(
"Normal"
),
_
(
"Symmetrical"
),
m_ShapeOptionCtrl
=
new
wxRadioBox
(
this
,
-
1
,
_
(
_
(
"Mirrored"
)
};
"Shape Option"
),
m_ShapeOptionCtrl
=
new
wxRadioBox
(
this
,
-
1
,
_
(
"Shape Option"
),
wxDefaultPosition
,
wxDefaultSize
,
3
,
shapelist
,
1
,
wxDefaultPosition
,
wxDefaultSize
,
3
,
shapelist
,
1
,
wxRA_SPECIFY_COLS
);
wxRA_SPECIFY_COLS
);
LeftBoxSizer
->
Add
(
m_ShapeOptionCtrl
,
0
,
wxGROW
|
wxALL
,
5
);
LeftBoxSizer
->
Add
(
m_ShapeOptionCtrl
,
0
,
wxGROW
|
wxALL
,
5
);
m_SizeCtrl
=
new
WinEDA_SizeCtrl
(
this
,
_
(
"Size"
),
m_SizeCtrl
=
new
WinEDA_SizeCtrl
(
this
,
_
(
"Size"
),
ShapeSize
,
ShapeSize
,
g_UnitMetric
,
LeftBoxSizer
,
g_UnitMetric
,
LeftBoxSizer
,
PCB_INTERNAL_UNIT
);
PCB_INTERNAL_UNIT
);
GetSizer
()
->
Fit
(
this
);
GetSizer
()
->
Fit
(
this
);
GetSizer
()
->
SetSizeHints
(
this
);
GetSizer
()
->
SetSizeHints
(
this
);
}
}
/**********************************************************************/
void
WinEDA_SetParamShapeFrame
::
OnCancelClick
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
void
WinEDA_SetParamShapeFrame
::
OnCancelClick
(
wxCommandEvent
&
WXUNUSED
(
event
)
)
/**********************************************************************/
{
{
if
(
PolyEdges
)
if
(
PolyEdges
)
free
(
PolyEdges
);
free
(
PolyEdges
);
...
@@ -901,9 +878,7 @@ void WinEDA_SetParamShapeFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event)
...
@@ -901,9 +878,7 @@ void WinEDA_SetParamShapeFrame::OnCancelClick( wxCommandEvent& WXUNUSED (event)
}
}
/*******************************************************************/
void
WinEDA_SetParamShapeFrame
::
OnOkClick
(
wxCommandEvent
&
event
)
void
WinEDA_SetParamShapeFrame
::
OnOkClick
(
wxCommandEvent
&
event
)
/*******************************************************************/
{
{
ShapeSize
=
m_SizeCtrl
->
GetValue
();
ShapeSize
=
m_SizeCtrl
->
GetValue
();
PolyShapeType
=
m_ShapeOptionCtrl
->
GetSelection
();
PolyShapeType
=
m_ShapeOptionCtrl
->
GetSelection
();
...
@@ -911,10 +886,6 @@ void WinEDA_SetParamShapeFrame::OnOkClick( wxCommandEvent& event )
...
@@ -911,10 +886,6 @@ void WinEDA_SetParamShapeFrame::OnOkClick( wxCommandEvent& event )
}
}
/************************************************************************/
void
WinEDA_SetParamShapeFrame
::
ReadDataShapeDescr
(
wxCommandEvent
&
event
)
/************************************************************************/
/* Read a description shape file
/* Read a description shape file
* File format is
* File format is
* Unit=MM
* Unit=MM
...
@@ -927,8 +898,9 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
...
@@ -927,8 +898,9 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
* ....
* ....
* $ENDCOORD
* $ENDCOORD
*
*
* Each line is the X Y coord (normali
s
ed units from 0 to 1)
* Each line is the X Y coord (normali
z
ed units from 0 to 1)
*/
*/
void
WinEDA_SetParamShapeFrame
::
ReadDataShapeDescr
(
wxCommandEvent
&
event
)
{
{
wxString
FullFileName
;
wxString
FullFileName
;
wxString
ext
,
mask
;
wxString
ext
,
mask
;
...
@@ -942,14 +914,13 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
...
@@ -942,14 +914,13 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
ext
=
wxT
(
".txt"
);
ext
=
wxT
(
".txt"
);
mask
=
wxT
(
"*"
)
+
ext
;
mask
=
wxT
(
"*"
)
+
ext
;
FullFileName
=
EDA_FileSelector
(
_
(
"Read descr shape file"
),
FullFileName
=
EDA_FileSelector
(
_
(
"Read descr shape file"
),
wxEmptyString
,
/* Chemin par defaut */
wxEmptyString
,
FullFileName
,
/* nom fichier par defaut */
FullFileName
,
ext
,
/* extension par defaut */
ext
,
mask
,
/* Masque d'affichage */
mask
,
this
,
this
,
wxFD_OPEN
,
wxFD_OPEN
,
TRUE
/* ne change pas de repertoire courant */
TRUE
);
);
if
(
FullFileName
.
IsEmpty
()
)
if
(
FullFileName
.
IsEmpty
()
)
return
;
return
;
...
@@ -965,7 +936,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
...
@@ -965,7 +936,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
bufsize
=
100
;
bufsize
=
100
;
ptbuf
=
PolyEdges
=
(
double
*
)
MyZMalloc
(
bufsize
*
2
*
sizeof
(
double
)
);
ptbuf
=
PolyEdges
=
(
double
*
)
MyZMalloc
(
bufsize
*
2
*
sizeof
(
double
)
);
SetLocaleTo_C_standard
(
);
SetLocaleTo_C_standard
();
int
LineNum
=
0
;
int
LineNum
=
0
;
while
(
GetLine
(
File
,
Line
,
&
LineNum
,
sizeof
(
Line
)
-
1
)
!=
NULL
)
while
(
GetLine
(
File
,
Line
,
&
LineNum
,
sizeof
(
Line
)
-
1
)
!=
NULL
)
{
{
...
@@ -993,7 +964,8 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
...
@@ -993,7 +964,8 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
{
{
int
index
=
ptbuf
-
PolyEdges
;
int
index
=
ptbuf
-
PolyEdges
;
bufsize
*=
2
;
bufsize
*=
2
;
ptbuf
=
PolyEdges
=
(
double
*
)
realloc
(
PolyEdges
,
bufsize
*
2
*
ptbuf
=
PolyEdges
=
(
double
*
)
realloc
(
PolyEdges
,
bufsize
*
2
*
sizeof
(
double
)
);
sizeof
(
double
)
);
ptbuf
+=
index
;
ptbuf
+=
index
;
}
}
...
@@ -1020,7 +992,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
...
@@ -1020,7 +992,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
PolyEdges
=
NULL
;
PolyEdges
=
NULL
;
}
}
fclose
(
File
);
fclose
(
File
);
SetLocaleTo_Default
(
);
// revert to the current
locale
SetLocaleTo_Default
(
);
// revert to the current
locale
ShapeScaleX
*=
unitconv
;
ShapeScaleX
*=
unitconv
;
ShapeScaleY
*=
unitconv
;
ShapeScaleY
*=
unitconv
;
...
@@ -1029,9 +1001,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
...
@@ -1029,9 +1001,7 @@ void WinEDA_SetParamShapeFrame::ReadDataShapeDescr( wxCommandEvent& event )
}
}
/*************************************************************/
MODULE
*
WinEDA_PcbFrame
::
Create_MuWavePolygonShape
()
MODULE
*
WinEDA_PcbFrame
::
Create_MuWavePolygonShape
(
)
/*************************************************************/
{
{
D_PAD
*
pad1
,
*
pad2
;
D_PAD
*
pad1
,
*
pad2
;
MODULE
*
Module
;
MODULE
*
Module
;
...
@@ -1040,9 +1010,11 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
...
@@ -1040,9 +1010,11 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
EDGE_MODULE
*
edge
;
EDGE_MODULE
*
edge
;
int
ii
,
npoints
;
int
ii
,
npoints
;
WinEDA_SetParamShapeFrame
*
frame
=
new
WinEDA_SetParamShapeFrame
(
this
,
wxPoint
(
-
1
,
-
1
)
);
WinEDA_SetParamShapeFrame
*
frame
=
new
WinEDA_SetParamShapeFrame
(
this
,
wxPoint
(
-
1
,
-
1
)
);
int
ok
=
frame
->
ShowModal
();
int
ok
=
frame
->
ShowModal
();
frame
->
Destroy
();
frame
->
Destroy
();
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
...
@@ -1062,7 +1034,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
...
@@ -1062,7 +1034,7 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
ShapeSize
.
x
=
wxRound
(
ShapeScaleX
);
ShapeSize
.
x
=
wxRound
(
ShapeScaleX
);
ShapeSize
.
y
=
wxRound
(
ShapeScaleY
);
ShapeSize
.
y
=
wxRound
(
ShapeScaleY
);
if
(
(
ShapeSize
.
x
)
==
0
||
(
ShapeSize
.
y
==
0
)
)
if
(
(
ShapeSize
.
x
)
==
0
||
(
ShapeSize
.
y
==
0
)
)
{
{
DisplayError
(
this
,
_
(
"Shape has a null size!"
)
);
DisplayError
(
this
,
_
(
"Shape has a null size!"
)
);
return
NULL
;
return
NULL
;
...
@@ -1093,17 +1065,17 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
...
@@ -1093,17 +1065,17 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
edge
->
SetLayer
(
LAYER_CMP_N
);
edge
->
SetLayer
(
LAYER_CMP_N
);
npoints
=
PolyEdgesCount
;
npoints
=
PolyEdgesCount
;
edge
->
m_PolyPoints
.
reserve
(
2
*
PolyEdgesCount
+
2
);
edge
->
m_PolyPoints
.
reserve
(
2
*
PolyEdgesCount
+
2
);
// Init start point coord:
// Init start point coord:
edge
->
m_PolyPoints
.
push_back
(
wxPoint
(
pad1
->
m_Pos0
.
x
,
0
)
);
edge
->
m_PolyPoints
.
push_back
(
wxPoint
(
pad1
->
m_Pos0
.
x
,
0
)
);
double
*
dptr
=
PolyEdges
;
double
*
dptr
=
PolyEdges
;
wxPoint
first_coordinate
,
last_coordinate
;
wxPoint
first_coordinate
,
last_coordinate
;
for
(
ii
=
0
;
ii
<
npoints
;
ii
++
)
// Copy points
for
(
ii
=
0
;
ii
<
npoints
;
ii
++
)
// Copy points
{
{
last_coordinate
.
x
=
wxRound
(
*
dptr
++
*
ShapeScaleX
)
+
pad1
->
m_Pos0
.
x
;
last_coordinate
.
x
=
wxRound
(
*
dptr
++
*
ShapeScaleX
)
+
pad1
->
m_Pos0
.
x
;
last_coordinate
.
y
=
-
wxRound
(
*
dptr
++
*
ShapeScaleY
);
last_coordinate
.
y
=
-
wxRound
(
*
dptr
++
*
ShapeScaleY
);
edge
->
m_PolyPoints
.
push_back
(
last_coordinate
);
edge
->
m_PolyPoints
.
push_back
(
last_coordinate
);
}
}
...
@@ -1125,8 +1097,8 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
...
@@ -1125,8 +1097,8 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
pad2
->
m_Pos
.
y
=
pad2
->
m_Pos0
.
y
+
Module
->
m_Pos
.
y
;
pad2
->
m_Pos
.
y
=
pad2
->
m_Pos0
.
y
+
Module
->
m_Pos
.
y
;
break
;
break
;
case
1
:
// Symetric
case
1
:
// Sym
m
etric
for
(
int
ndx
=
edge
->
m_PolyPoints
.
size
()
-
1
;
ndx
>=
0
;
--
ndx
)
for
(
int
ndx
=
edge
->
m_PolyPoints
.
size
()
-
1
;
ndx
>=
0
;
--
ndx
)
{
{
wxPoint
pt
=
edge
->
m_PolyPoints
[
ndx
];
wxPoint
pt
=
edge
->
m_PolyPoints
[
ndx
];
...
@@ -1151,14 +1123,11 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
...
@@ -1151,14 +1123,11 @@ MODULE* WinEDA_PcbFrame::Create_MuWavePolygonShape( )
}
}
/***************************************************************/
void
WinEDA_PcbFrame
::
Edit_Gap
(
wxDC
*
DC
,
MODULE
*
Module
)
/***************************************************************/
/*
/*
*
Edit le module GAP, c'est a dire modifie la position et la taill
e
*
Edit the GAP module, if it has changed the position and/or siz
e
*
des pastilles formant le gap pour obtenir une nouvelle valeur du gap
*
Pads that form the gap to get a new value of the gap.
*/
*/
void
WinEDA_PcbFrame
::
Edit_Gap
(
wxDC
*
DC
,
MODULE
*
Module
)
{
{
int
gap_size
,
oX
;
int
gap_size
,
oX
;
float
fcoeff
;
float
fcoeff
;
...
@@ -1166,9 +1135,9 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module )
...
@@ -1166,9 +1135,9 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module )
wxString
msg
;
wxString
msg
;
if
(
Module
==
NULL
)
if
(
Module
==
NULL
)
return
;
/* Module non trouve */
return
;
/* Test
si module = gap ( nom commence par GAP, et 2 pastilles)
*/
/* Test
if module is a gap type (name begins with GAP, and has 2 pads).
*/
msg
=
Module
->
m_Reference
->
m_Text
.
Left
(
3
);
msg
=
Module
->
m_Reference
->
m_Text
.
Left
(
3
);
if
(
msg
!=
wxT
(
"GAP"
)
)
if
(
msg
!=
wxT
(
"GAP"
)
)
return
;
return
;
...
@@ -1176,32 +1145,34 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module )
...
@@ -1176,32 +1145,34 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module )
pad
=
Module
->
m_Pads
;
pad
=
Module
->
m_Pads
;
if
(
pad
==
NULL
)
if
(
pad
==
NULL
)
{
{
DisplayError
(
this
,
_
(
"No pad for this module"
)
);
return
;
DisplayError
(
this
,
_
(
"No pad for this module"
)
);
return
;
}
}
next_pad
=
(
D_PAD
*
)
pad
->
Next
();
next_pad
=
(
D_PAD
*
)
pad
->
Next
();
if
(
next_pad
==
NULL
)
if
(
next_pad
==
NULL
)
{
{
DisplayError
(
this
,
_
(
"Only one pad for this module"
)
);
return
;
DisplayError
(
this
,
_
(
"Only one pad for this module"
)
);
return
;
}
}
/* Effacement du module: */
Module
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
Module
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
/* Calcul
de la dimension actuelle
*/
/* Calcul
ate the current dimension.
*/
gap_size
=
next_pad
->
m_Pos0
.
x
-
pad
->
m_Pos0
.
x
-
pad
->
m_Size
.
x
;
gap_size
=
next_pad
->
m_Pos0
.
x
-
pad
->
m_Pos0
.
x
-
pad
->
m_Size
.
x
;
/* Entr
ee de la longueur desiree du gap
*/
/* Entr
ance to the desired length of the gap.
*/
if
(
g_UnitMetric
)
if
(
g_UnitMetric
)
{
{
fcoeff
=
10000.0
f
/
25.4
f
;
fcoeff
=
10000.0
f
/
25.4
f
;
msg
.
Printf
(
wxT
(
"%2.3f"
),
gap_size
/
fcoeff
);
msg
.
Printf
(
wxT
(
"%2.3f"
),
gap_size
/
fcoeff
);
Get_Message
(
_
(
"Gap (mm):"
),
_
(
"Create Microwave Gap"
),
msg
,
this
);
Get_Message
(
_
(
"Gap (mm):"
),
_
(
"Create Microwave Gap"
),
msg
,
this
);
}
}
else
else
{
{
fcoeff
=
10000.0
;
fcoeff
=
10000.0
;
msg
.
Printf
(
wxT
(
"%2.4f"
),
gap_size
/
fcoeff
);
msg
.
Printf
(
wxT
(
"%2.4f"
),
gap_size
/
fcoeff
);
Get_Message
(
_
(
"Gap (inch):"
),
_
(
"Create Microwave Gap"
),
msg
,
this
);
Get_Message
(
_
(
"Gap (inch):"
),
_
(
"Create Microwave Gap"
),
msg
,
this
);
}
}
if
(
!
msg
.
IsEmpty
()
)
if
(
!
msg
.
IsEmpty
()
)
...
@@ -1211,13 +1182,13 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module )
...
@@ -1211,13 +1182,13 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module )
gap_size
=
(
int
)
(
fval
*
fcoeff
);
gap_size
=
(
int
)
(
fval
*
fcoeff
);
}
}
/*
Mise a jour des tailles des pastilles formant le gap
*/
/*
Updating sizes of pads forming the gap.
*/
pad
->
m_Size
.
x
=
pad
->
m_Size
.
y
=
GetBoard
()
->
GetCurrentTrackWidth
();
pad
->
m_Size
.
x
=
pad
->
m_Size
.
y
=
GetBoard
()
->
GetCurrentTrackWidth
();
pad
->
m_Pos0
.
y
=
0
;
pad
->
m_Pos0
.
y
=
0
;
oX
=
pad
->
m_Pos0
.
x
=
-
(
(
gap_size
+
pad
->
m_Size
.
x
)
/
2
);
oX
=
pad
->
m_Pos0
.
x
=
-
(
(
gap_size
+
pad
->
m_Size
.
x
)
/
2
);
pad
->
m_Pos
.
x
=
pad
->
m_Pos0
.
x
+
Module
->
m_Pos
.
x
;
pad
->
m_Pos
.
x
=
pad
->
m_Pos0
.
x
+
Module
->
m_Pos
.
x
;
pad
->
m_Pos
.
y
=
pad
->
m_Pos0
.
y
+
Module
->
m_Pos
.
y
;
pad
->
m_Pos
.
y
=
pad
->
m_Pos0
.
y
+
Module
->
m_Pos
.
y
;
RotatePoint
(
&
(
pad
->
m_Pos
.
x
),
&
(
pad
->
m_Pos
.
y
)
,
RotatePoint
(
&
pad
->
m_Pos
.
x
,
&
pad
->
m_Pos
.
y
,
Module
->
m_Pos
.
x
,
Module
->
m_Pos
.
y
,
Module
->
m_Orient
);
Module
->
m_Pos
.
x
,
Module
->
m_Pos
.
y
,
Module
->
m_Orient
);
next_pad
->
m_Size
.
x
=
next_pad
->
m_Size
.
y
=
GetBoard
()
->
GetCurrentTrackWidth
();
next_pad
->
m_Size
.
x
=
next_pad
->
m_Size
.
y
=
GetBoard
()
->
GetCurrentTrackWidth
();
...
@@ -1225,7 +1196,7 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module )
...
@@ -1225,7 +1196,7 @@ void WinEDA_PcbFrame::Edit_Gap( wxDC* DC, MODULE* Module )
next_pad
->
m_Pos0
.
x
=
oX
+
gap_size
+
next_pad
->
m_Size
.
x
;
next_pad
->
m_Pos0
.
x
=
oX
+
gap_size
+
next_pad
->
m_Size
.
x
;
next_pad
->
m_Pos
.
x
=
next_pad
->
m_Pos0
.
x
+
Module
->
m_Pos
.
x
;
next_pad
->
m_Pos
.
x
=
next_pad
->
m_Pos0
.
x
+
Module
->
m_Pos
.
x
;
next_pad
->
m_Pos
.
y
=
next_pad
->
m_Pos0
.
y
+
Module
->
m_Pos
.
y
;
next_pad
->
m_Pos
.
y
=
next_pad
->
m_Pos0
.
y
+
Module
->
m_Pos
.
y
;
RotatePoint
(
&
(
next_pad
->
m_Pos
.
x
),
&
(
next_pad
->
m_Pos
.
y
)
,
RotatePoint
(
&
next_pad
->
m_Pos
.
x
,
&
next_pad
->
m_Pos
.
y
,
Module
->
m_Pos
.
x
,
Module
->
m_Pos
.
y
,
Module
->
m_Orient
);
Module
->
m_Pos
.
x
,
Module
->
m_Pos
.
y
,
Module
->
m_Orient
);
Module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
Module
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
...
...
pcbnew/muwave_command.cpp
View file @
1a139a7f
/*****************************************************/
/*****************************************************/
/* muwave_command.cpp: micro wave functions commands */
/* muwave_command.cpp: micro wave functions commands */
/*****************************************************/
/*****************************************************/
#include "fctsys.h"
#include "fctsys.h"
#include "common.h"
#include "common.h"
...
@@ -14,62 +14,60 @@
...
@@ -14,62 +14,60 @@
#include "protos.h"
#include "protos.h"
/*********************************************************************/
/* Handle microwave commands.
void
WinEDA_PcbFrame
::
ProcessMuWaveFunctions
(
wxCommandEvent
&
event
)
*/
/*********************************************************************/
void
WinEDA_PcbFrame
::
ProcessMuWaveFunctions
(
wxCommandEvent
&
event
)
/* Traite les selections d'outils et les commandes appelees du menu POPUP
*/
{
{
int
id
=
event
.
GetId
();
int
id
=
event
.
GetId
();
wxPoint
pos
;
wxPoint
pos
;
wxClientDC
dc
(
DrawPanel
);
wxClientDC
dc
(
DrawPanel
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
wxGetMousePosition
(
&
pos
.
x
,
&
pos
.
y
);
wxGetMousePosition
(
&
pos
.
x
,
&
pos
.
y
);
pos
.
y
+=
20
;
pos
.
y
+=
20
;
switch
(
id
)
// Arret eventuel de la commande de dplacement en cours
switch
(
id
)
// End any command in progress.
{
{
case
ID_POPUP_COPY_BLOCK
:
case
ID_POPUP_COPY_BLOCK
:
break
;
break
;
default
:
// Arret de la commande de dplacement en cours
default
:
// End block command in progress.
if
(
DrawPanel
->
ManageCurseur
&&
if
(
DrawPanel
->
ManageCurseur
DrawPanel
->
ForceCloseManageCurseur
)
&&
DrawPanel
->
ForceCloseManageCurseur
)
{
{
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
&
dc
);
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
&
dc
);
}
}
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
break
;
break
;
}
}
switch
(
id
)
// Traitement des commandes
switch
(
id
)
{
{
case
ID_PCB_MUWAVE_TOOL_SELF_CMD
:
case
ID_PCB_MUWAVE_TOOL_SELF_CMD
:
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Line"
)
);
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Line"
)
);
break
;
break
;
case
ID_PCB_MUWAVE_TOOL_GAP_CMD
:
case
ID_PCB_MUWAVE_TOOL_GAP_CMD
:
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Gap"
)
);
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Gap"
)
);
break
;
break
;
case
ID_PCB_MUWAVE_TOOL_STUB_CMD
:
case
ID_PCB_MUWAVE_TOOL_STUB_CMD
:
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Stub"
)
);
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Stub"
)
);
break
;
break
;
case
ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD
:
case
ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD
:
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Arc Stub"
)
);
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Arc Stub"
)
);
break
;
break
;
case
ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD
:
case
ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD
:
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Polynomial Shape"
)
);
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Polynomial Shape"
)
);
break
;
break
;
default
:
default
:
DisplayError
(
this
,
wxT
(
"WinEDA_PcbFrame::ProcessMuWaveFunctions() id error"
));
DisplayError
(
this
,
wxT
(
"WinEDA_PcbFrame::ProcessMuWaveFunctions() id error"
)
);
break
;
break
;
}
}
...
@@ -77,45 +75,42 @@ wxClientDC dc(DrawPanel);
...
@@ -77,45 +75,42 @@ wxClientDC dc(DrawPanel);
}
}
void
WinEDA_PcbFrame
::
MuWaveCommand
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
)
/***************************************************************************/
void
WinEDA_PcbFrame
::
MuWaveCommand
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
)
/***************************************************************************/
{
{
MODULE
*
module
=
NULL
;
MODULE
*
module
=
NULL
;
switch
(
m_ID_current_state
)
switch
(
m_ID_current_state
)
{
{
case
ID_PCB_MUWAVE_TOOL_SELF_CMD
:
case
ID_PCB_MUWAVE_TOOL_SELF_CMD
:
Begin_Self
(
DC
);
Begin_Self
(
DC
);
break
;
break
;
case
ID_PCB_MUWAVE_TOOL_GAP_CMD
:
case
ID_PCB_MUWAVE_TOOL_GAP_CMD
:
module
=
Create_MuWaveComponent
(
0
);
module
=
Create_MuWaveComponent
(
0
);
break
;
break
;
case
ID_PCB_MUWAVE_TOOL_STUB_CMD
:
case
ID_PCB_MUWAVE_TOOL_STUB_CMD
:
module
=
Create_MuWaveComponent
(
1
);
module
=
Create_MuWaveComponent
(
1
);
break
;
break
;
case
ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD
:
case
ID_PCB_MUWAVE_TOOL_STUB_ARC_CMD
:
module
=
Create_MuWaveComponent
(
2
);
module
=
Create_MuWaveComponent
(
2
);
break
;
break
;
case
ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD
:
case
ID_PCB_MUWAVE_TOOL_FUNCTION_SHAPE_CMD
:
module
=
Create_MuWavePolygonShape
();
module
=
Create_MuWavePolygonShape
();
break
;
break
;
default
:
default
:
DrawPanel
->
SetCursor
(
wxCURSOR_ARROW
);
DrawPanel
->
SetCursor
(
wxCURSOR_ARROW
);
DisplayError
(
this
,
wxT
(
"WinEDA_PcbFrame::MuWaveCommand() id error"
)
);
DisplayError
(
this
,
wxT
(
"WinEDA_PcbFrame::MuWaveCommand() id error"
)
);
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
break
;
break
;
}
}
if
(
module
)
if
(
module
)
{
{
StartMove_Module
(
module
,
DC
);
StartMove_Module
(
module
,
DC
);
}
}
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
}
}
pcbnew/netlist.cpp
View file @
1a139a7f
...
@@ -3,24 +3,29 @@
...
@@ -3,24 +3,29 @@
/***********************/
/***********************/
/*
/*
* Function to read a netlist. Wh
ele readint a netlis
:
* Function to read a netlist. Wh
ile reading a netlist
:
* - Load new footprints
* - Load new footprints
* - Initiali
s
e net info
* - Initiali
z
e net info
* - Test for missing or extra footprints
* - Test for missing or extra footprints
* - Recalculate ratsnest
* - Recalculate ratsnest
*
*
* Important remark:
* Important remark:
* When reading a netlist Pcbnew must identify existing footprints (link between existing footprints an components in netlist)
* When reading a netlist Pcbnew must identify existing footprints (link
* between existing footprints an components in netlist)
* This identification can be from 2 fields:
* This identification can be from 2 fields:
* - The reference (U2, R5 ..): this is the normal mode
* - The reference (U2, R5 ..): this is the normal mode
* - The Time Stamp (Signature Temporelle), useful after a full schematic reannotation
* - The Time Stamp (Signature Temporelle), useful after a full schematic
* reannotation
* because references can be changed for the same schematic.
* because references can be changed for the same schematic.
* So when reading a netlist this identification ReadPcbNetlist() has aselection of the way to identify footprints.
* So when reading a netlist this identification ReadPcbNetlist() has
* selection of the way to identify footprints.
* If we want to fully reannotate a schematic this sequence must be used
* If we want to fully reannotate a schematic this sequence must be used
* SAVE your board !!!
* SAVE your board !!!
* Create and read the netlist (to ensure all info is correct, mainly references and time stamp)
* Create and read the netlist (to ensure all info is correct, mainly
* references and time stamp)
* Reannotate the schematic (references will be changed, but not time stamp)
* Reannotate the schematic (references will be changed, but not time stamp)
* Recreate and read the new netlist using the Time Stamp identification (that reinit the new references)
* Recreate and read the new netlist using the Time Stamp identification
* (that reinit the new references)
*/
*/
#include "fctsys.h"
#include "fctsys.h"
#include "common.h"
#include "common.h"
...
@@ -39,7 +44,7 @@
...
@@ -39,7 +44,7 @@
#define TESTONLY 1
#define TESTONLY 1
#define READMODULE 0
#define READMODULE 0
/* Structures locales */
class
MODULEtoLOAD
class
MODULEtoLOAD
{
{
public
:
public
:
...
@@ -48,8 +53,7 @@ public:
...
@@ -48,8 +53,7 @@ public:
wxString
m_TimeStampPath
;
wxString
m_TimeStampPath
;
MODULEtoLOAD
*
m_Next
;
MODULEtoLOAD
*
m_Next
;
public
:
public
:
MODULEtoLOAD
(
const
wxString
&
libname
,
MODULEtoLOAD
(
const
wxString
&
libname
,
const
wxString
&
cmpname
,
const
wxString
&
cmpname
,
const
wxString
&
timestamp_path
)
const
wxString
&
timestamp_path
)
{
{
...
@@ -66,9 +70,10 @@ public:
...
@@ -66,9 +70,10 @@ public:
void
SetNext
(
MODULEtoLOAD
*
next
)
{
m_Next
=
next
;
}
void
SetNext
(
MODULEtoLOAD
*
next
)
{
m_Next
=
next
;
}
};
};
/* Fonctions locales : */
static
void
SortListModulesToLoadByLibname
(
int
NbModules
);
static
void
SortListModulesToLoadByLibname
(
int
NbModules
);
static
int
BuildFootprintsListFromNetlistFile
(
const
wxString
&
aNetlistFullFilename
,
static
int
BuildFootprintsListFromNetlistFile
(
const
wxString
&
aNetlistFullFilename
,
wxArrayString
&
aBufName
);
wxArrayString
&
aBufName
);
static
bool
OpenNetlistFile
(
const
wxString
&
aFullFileName
);
static
bool
OpenNetlistFile
(
const
wxString
&
aFullFileName
);
static
void
AddToList
(
const
wxString
&
NameLibCmp
,
static
void
AddToList
(
const
wxString
&
NameLibCmp
,
...
@@ -93,19 +98,15 @@ static MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
...
@@ -93,19 +98,15 @@ static MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
static
void
LoadListeModules
(
WinEDA_PcbFrame
*
aPcbFrame
);
static
void
LoadListeModules
(
WinEDA_PcbFrame
*
aPcbFrame
);
/* Variables locales */
static
int
s_NbNewModules
;
static
int
s_NbNewModules
;
static
MODULEtoLOAD
*
s_ModuleToLoad_List
;
static
MODULEtoLOAD
*
s_ModuleToLoad_List
;
FILE
*
source
;
FILE
*
source
;
/************************************************************************/
bool
OpenNetlistFile
(
const
wxString
&
aFullFileName
)
/************************************************************************/
/** function OpenNetlistFile
/** function OpenNetlistFile
* used to open a netlist file
* used to open a netlist file
*/
*/
bool
OpenNetlistFile
(
const
wxString
&
aFullFileName
)
{
{
if
(
aFullFileName
.
IsEmpty
()
)
if
(
aFullFileName
.
IsEmpty
()
)
return
FALSE
;
/* No filename: exit */
return
FALSE
;
/* No filename: exit */
...
@@ -114,7 +115,8 @@ bool OpenNetlistFile( const wxString& aFullFileName )
...
@@ -114,7 +115,8 @@ bool OpenNetlistFile( const wxString& aFullFileName )
if
(
source
==
0
)
if
(
source
==
0
)
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
_
(
"Netlist file %s not found"
),
GetChars
(
aFullFileName
)
);
msg
.
Printf
(
_
(
"Netlist file %s not found"
),
GetChars
(
aFullFileName
)
);
DisplayError
(
NULL
,
msg
);
DisplayError
(
NULL
,
msg
);
return
FALSE
;
return
FALSE
;
}
}
...
@@ -123,23 +125,14 @@ bool OpenNetlistFile( const wxString& aFullFileName )
...
@@ -123,23 +125,14 @@ bool OpenNetlistFile( const wxString& aFullFileName )
}
}
/*******************************************************************************/
void
ReadPcbNetlist
(
WinEDA_PcbFrame
*
aFrame
,
const
wxString
&
aNetlistFullFilename
,
const
wxString
&
aCmpFullFileName
,
wxTextCtrl
*
aMessageWindow
,
bool
aChangeFootprint
,
bool
aDeleteBadTracks
,
bool
aDeleteExtraFootprints
,
bool
aSelect_By_Timestamp
)
/********************************************************************************/
/** Function ReadPcbNetlist
/** Function ReadPcbNetlist
* Update footprints (load missing footprints and delete on request extra footprints)
* Update footprints (load missing footprints and delete on request extra
* footprints)
* Update connectivity info ( Net Name list )
* Update connectivity info ( Net Name list )
* Update Reference, value and "TIME STAMP"
* Update Reference, value and "TIME STAMP"
* @param aNetlistFullFilename = netlist file name (*.net)
* @param aNetlistFullFilename = netlist file name (*.net)
* @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found, only the netmist will be used
* @param aCmpFullFileName = cmp/footprint list file name (*.cmp) if not found,
* only the netlist will be used
*
*
* the format of the netlist is something like:
* the format of the netlist is something like:
# EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22
# EESchema Netlist Version 1.0 generee le 18/5/2005-12:30:22
...
@@ -155,6 +148,14 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
...
@@ -155,6 +148,14 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
* }
* }
* #End
* #End
*/
*/
void
ReadPcbNetlist
(
WinEDA_PcbFrame
*
aFrame
,
const
wxString
&
aNetlistFullFilename
,
const
wxString
&
aCmpFullFileName
,
wxTextCtrl
*
aMessageWindow
,
bool
aChangeFootprint
,
bool
aDeleteBadTracks
,
bool
aDeleteExtraFootprints
,
bool
aSelect_By_Timestamp
)
{
{
int
LineNum
,
State
,
Comment
;
int
LineNum
,
State
,
Comment
;
MODULE
*
Module
=
NULL
;
MODULE
*
Module
=
NULL
;
...
@@ -169,7 +170,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
...
@@ -169,7 +170,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
if
(
aMessageWindow
)
if
(
aMessageWindow
)
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
_
(
"Reading Netlist
\"
%s
\"
"
),
GetChars
(
aNetlistFullFilename
)
);
msg
.
Printf
(
_
(
"Reading Netlist
\"
%s
\"
"
),
GetChars
(
aNetlistFullFilename
)
);
aMessageWindow
->
AppendText
(
msg
+
wxT
(
"
\n
"
)
);
aMessageWindow
->
AppendText
(
msg
+
wxT
(
"
\n
"
)
);
}
}
...
@@ -183,7 +185,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
...
@@ -183,7 +185,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
wxBusyCursor
dummy
;
// Shows an hourglass while calculating
wxBusyCursor
dummy
;
// Shows an hourglass while calculating
/* First, read the netlist: Build the list of footprints to load (new footprints)
/* First, read the netlist: Build the list of footprints to load (new
* footprints)
*/
*/
while
(
GetLine
(
source
,
Line
,
&
LineNum
)
)
while
(
GetLine
(
source
,
Line
,
&
LineNum
)
)
{
{
...
@@ -221,7 +224,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
...
@@ -221,7 +224,7 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
continue
;
continue
;
}
}
if
(
State
>=
3
)
/*
la ligne de description d'un pad est ici non analysee
*/
if
(
State
>=
3
)
/*
Do not analyzed pad description here.
*/
{
{
State
--
;
State
--
;
}
}
...
@@ -243,15 +246,18 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
...
@@ -243,15 +246,18 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
s_ModuleToLoad_List
=
NULL
;
s_ModuleToLoad_List
=
NULL
;
}
}
/* Second read , All footprints are on board, one must update the schematic info (pad netnames) */
/* Second read , All footprints are on board, one must update the schematic
* info (pad netnames) */
fseek
(
source
,
0
,
SEEK_SET
);
LineNum
=
0
;
fseek
(
source
,
0
,
SEEK_SET
);
LineNum
=
0
;
while
(
GetLine
(
source
,
Line
,
&
LineNum
)
)
while
(
GetLine
(
source
,
Line
,
&
LineNum
)
)
{
{
Text
=
StrPurge
(
Line
);
Text
=
StrPurge
(
Line
);
if
(
Comment
)
/* we are reading a commment */
if
(
Comment
)
/* we are reading a
* comment */
{
{
if
(
(
Text
=
strchr
(
Text
,
'}'
)
)
==
NULL
)
/* this is the end of a comment */
if
(
(
Text
=
strchr
(
Text
,
'}'
)
)
==
NULL
)
/* this is the end
* of a comment */
continue
;
continue
;
Comment
=
0
;
Comment
=
0
;
}
}
...
@@ -277,7 +283,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
...
@@ -277,7 +283,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
READMODULE
,
READMODULE
,
aSelect_By_Timestamp
,
aSelect_By_Timestamp
,
aChangeFootprint
);
aChangeFootprint
);
if
(
Module
==
NULL
)
// the module could not be created (perhaps footprint not found in library)
if
(
Module
==
NULL
)
// the module could not be created (perhaps
// footprint not found in library)
{
{
continue
;
continue
;
}
}
...
@@ -309,8 +316,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
...
@@ -309,8 +316,8 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
{
{
wxArrayString
ModuleListFromNetlist
;
wxArrayString
ModuleListFromNetlist
;
/* Build list of modules in the netlist */
/* Build list of modules in the netlist */
int
NbModulesNetListe
=
BuildFootprintsListFromNetlistFile
(
int
NbModulesNetListe
=
aNetlistFullFilename
,
BuildFootprintsListFromNetlistFile
(
aNetlistFullFilename
,
ModuleListFromNetlist
);
ModuleListFromNetlist
);
if
(
NbModulesNetListe
)
if
(
NbModulesNetListe
)
{
{
...
@@ -321,23 +328,25 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
...
@@ -321,23 +328,25 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
{
{
int
ii
;
int
ii
;
NextModule
=
Module
->
Next
();
NextModule
=
Module
->
Next
();
if
(
(
Module
->
m_ModuleStatus
&
MODULE_is_LOCKED
)
)
if
(
Module
->
m_ModuleStatus
&
MODULE_is_LOCKED
)
continue
;
continue
;
for
(
ii
=
0
;
ii
<
NbModulesNetListe
;
ii
++
)
for
(
ii
=
0
;
ii
<
NbModulesNetListe
;
ii
++
)
{
{
if
(
Module
->
m_Reference
->
m_Text
.
CmpNoCase
(
if
(
Module
->
m_Reference
->
m_Text
.
CmpNoCase
(
ModuleListFromNetlist
[
ii
]
)
==
0
)
ModuleListFromNetlist
[
ii
]
)
==
0
)
{
{
break
;
/* Module
trouve en netliste
*/
break
;
/* Module
is already in net list.
*/
}
}
}
}
if
(
ii
==
NbModulesNetListe
)
/* Module not found in netlist */
if
(
ii
==
NbModulesNetListe
)
/* Module not found in
* net list. */
{
{
if
(
ask_for_confirmation
)
if
(
ask_for_confirmation
)
{
{
ask_for_confirmation
=
false
;
ask_for_confirmation
=
false
;
if
(
!
IsOK
(
NULL
,
_
(
"Ok to delete footprints not in netlist ?"
)
)
)
if
(
!
IsOK
(
NULL
,
_
(
"Ok to delete footprints not in netlist?"
)
)
)
break
;
break
;
}
}
Module
->
DeleteStructure
();
Module
->
DeleteStructure
();
...
@@ -363,7 +372,22 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
...
@@ -363,7 +372,22 @@ void ReadPcbNetlist( WinEDA_PcbFrame* aFrame,
}
}
/****************************************************************************/
/* Load the description of a footprint, net list type Pcbnew
* and update the corresponding module.
*
* If TstOnly == 0 if the module does not exist, it is responsible
* If TstOnly! = 0 if the module does not exist, it is added to the list
* Load modules has
* Text contains the first line of description
* UseFichCmp is a flag
* If! = 0, file components. CMP will be used
* Is reset to 0 if the file does not exist
*
* Analyze lines like:
* ($ 40C08647 noname R20 4.7 K Lib = (R)
* (1 VCC)
* (2 MODB_1)
*/
MODULE
*
ReadNetModule
(
WinEDA_PcbFrame
*
aFrame
,
MODULE
*
ReadNetModule
(
WinEDA_PcbFrame
*
aFrame
,
wxTextCtrl
*
aMessageWindow
,
wxTextCtrl
*
aMessageWindow
,
const
wxString
&
aCmpFullFileName
,
const
wxString
&
aCmpFullFileName
,
...
@@ -372,24 +396,6 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
...
@@ -372,24 +396,6 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
int
TstOnly
,
int
TstOnly
,
bool
aSelect_By_Timestamp
,
bool
aSelect_By_Timestamp
,
bool
aChangeFootprint
)
bool
aChangeFootprint
)
/****************************************************************************/
/* charge la description d'une empreinte, netliste type PCBNEW
* et met a jour le module correspondant
*
* Si TstOnly == 0 si le module n'existe pas, il est charge
* Si TstOnly != 0 si le module n'existe pas, il est ajoute a la liste des
* modules a charger
* Text contient la premiere ligne de la description
* UseFichCmp est un flag
* si != 0, le fichier des composants .CMP sera utilise
* est remis a 0 si le fichier n'existe pas
*
* Analyse les lignes type:
* ( 40C08647 $noname R20 4,7K {Lib=R}
* ( 1 VCC )
* ( 2 MODB_1 )
*/
{
{
MODULE
*
Module
;
MODULE
*
Module
;
char
*
text
;
char
*
text
;
...
@@ -429,7 +435,7 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
...
@@ -429,7 +435,7 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
if
(
Error
>
0
)
if
(
Error
>
0
)
return
NULL
;
return
NULL
;
/* T
st si composant deja charge
*/
/* T
est if module is already loaded.
*/
Module
=
aFrame
->
GetBoard
()
->
m_Modules
;
Module
=
aFrame
->
GetBoard
()
->
m_Modules
;
MODULE
*
NextModule
;
MODULE
*
NextModule
;
...
@@ -446,7 +452,8 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
...
@@ -446,7 +452,8 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
if
(
TextCmpName
.
CmpNoCase
(
Module
->
m_Reference
->
m_Text
)
==
0
)
if
(
TextCmpName
.
CmpNoCase
(
Module
->
m_Reference
->
m_Text
)
==
0
)
Found
=
true
;
Found
=
true
;
}
}
if
(
Found
)
// test footprint matching for existing modules: current m_LibRef and module name in netlist must match
if
(
Found
)
// test footprint matching for existing modules: current
// m_LibRef and module name in netlist must match
{
{
if
(
TstOnly
!=
TESTONLY
)
if
(
TstOnly
!=
TESTONLY
)
{
{
...
@@ -468,13 +475,20 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
...
@@ -468,13 +475,20 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
NameLibCmp
);
NameLibCmp
);
}
}
}
}
if
(
Module
->
m_LibRef
.
CmpNoCase
(
NameLibCmp
)
!=
0
)
// Module Mismatch: Current module and module specified in netlist are different.
/* Module mismatch: current module and module specified in
* net list are different.
*/
if
(
Module
->
m_LibRef
.
CmpNoCase
(
NameLibCmp
)
!=
0
)
{
{
if
(
aChangeFootprint
)
// footprint exchange allowed:
if
(
aChangeFootprint
)
// footprint exchange allowed.
{
{
MODULE
*
NewModule
=
MODULE
*
NewModule
=
aFrame
->
Get_Librairie_Module
(
wxEmptyString
,
NameLibCmp
,
true
);
aFrame
->
Get_Librairie_Module
(
wxEmptyString
,
if
(
NewModule
)
/* Change old module to the new module (and delete the old one)*/
NameLibCmp
,
true
);
if
(
NewModule
)
/* Change old module to the new module
* (and delete the old one) */
{
{
aFrame
->
Exchange_Module
(
Module
,
NewModule
,
NULL
);
aFrame
->
Exchange_Module
(
Module
,
NewModule
,
NULL
);
Module
=
NewModule
;
Module
=
NewModule
;
...
@@ -483,9 +497,8 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
...
@@ -483,9 +497,8 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
else
else
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
msg
.
Printf
(
_
(
"Component
\"
%s
\"
: Mismatch! module \
_
(
is [%s] and netlist said [%s]
\n
"
),
"Component
\"
%s
\"
: Mismatch! module is [%s] and netlist said [%s]
\n
"
),
GetChars
(
TextCmpName
),
GetChars
(
TextCmpName
),
GetChars
(
Module
->
m_LibRef
),
GetChars
(
Module
->
m_LibRef
),
GetChars
(
NameLibCmp
)
);
GetChars
(
NameLibCmp
)
);
...
@@ -495,6 +508,7 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
...
@@ -495,6 +508,7 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
}
}
}
}
}
}
break
;
break
;
}
}
}
}
...
@@ -505,11 +519,17 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
...
@@ -505,11 +519,17 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
{
{
if
(
aSelect_By_Timestamp
==
1
)
if
(
aSelect_By_Timestamp
==
1
)
{
{
*
UseFichCmp
=
ReadListeModules
(
aCmpFullFileName
,
NULL
,
&
TimeStampPath
,
NameLibCmp
);
*
UseFichCmp
=
ReadListeModules
(
aCmpFullFileName
,
NULL
,
&
TimeStampPath
,
NameLibCmp
);
}
}
else
else
{
{
*
UseFichCmp
=
ReadListeModules
(
aCmpFullFileName
,
&
TextCmpName
,
NULL
,
NameLibCmp
);
*
UseFichCmp
=
ReadListeModules
(
aCmpFullFileName
,
&
TextCmpName
,
NULL
,
NameLibCmp
);
}
}
}
}
...
@@ -521,11 +541,12 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
...
@@ -521,11 +541,12 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
if
(
aMessageWindow
)
if
(
aMessageWindow
)
{
{
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
_
(
"Component [%s] not found"
),
GetChars
(
TextCmpName
)
);
msg
.
Printf
(
_
(
"Component [%s] not found"
),
GetChars
(
TextCmpName
)
);
aMessageWindow
->
AppendText
(
msg
+
wxT
(
"
\n
"
)
);
aMessageWindow
->
AppendText
(
msg
+
wxT
(
"
\n
"
)
);
}
}
}
}
return
NULL
;
/*
Le module n'avait pas pu etre charge
*/
return
NULL
;
/*
The module could not be loaded.
*/
}
}
/* Fields update ( reference, value and "Time Stamp") */
/* Fields update ( reference, value and "Time Stamp") */
...
@@ -533,20 +554,21 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
...
@@ -533,20 +554,21 @@ MODULE* ReadNetModule( WinEDA_PcbFrame* aFrame,
Module
->
m_Value
->
m_Text
=
TextValeur
;
Module
->
m_Value
->
m_Text
=
TextValeur
;
Module
->
m_Path
=
TimeStampPath
;
Module
->
m_Path
=
TimeStampPath
;
return
Module
;
/* composant trouve */
return
Module
;
}
}
/*******************************************************************************************/
int
SetPadNetName
(
wxWindow
*
frame
,
char
*
Text
,
MODULE
*
Module
,
wxTextCtrl
*
aMessageWindow
)
/*******************************************************************************************/
/** Function SetPadNetName
/** Function SetPadNetName
* Update a pad netname in a given footprint
* Update a pad netname in a given footprint
* @param Text = Text from netlist (format: (pad = net) )
* @param Text = Text from netlist (format: (pad = net) )
* @param Module = the given footprint
* @param Module = the given footprint
* @param aMessageWindow = a wxTextCtrl to print error and warning message (can be NULL)
* @param aMessageWindow = a wxTextCtrl to print error and warning message
* (can be NULL)
*/
*/
int
SetPadNetName
(
wxWindow
*
frame
,
char
*
Text
,
MODULE
*
Module
,
wxTextCtrl
*
aMessageWindow
)
{
{
D_PAD
*
pad
;
D_PAD
*
pad
;
char
*
TextPinName
,
*
TextNetName
;
char
*
TextPinName
,
*
TextNetName
;
...
@@ -567,11 +589,10 @@ int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module, wxTextCtrl* aMes
...
@@ -567,11 +589,10 @@ int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module, wxTextCtrl* aMes
if
(
Error
)
if
(
Error
)
return
0
;
return
0
;
/* recherche du pad */
pad
=
Module
->
m_Pads
;
trouve
=
FALSE
;
pad
=
Module
->
m_Pads
;
trouve
=
FALSE
;
for
(
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Next
()
)
for
(
;
pad
!=
NULL
;
pad
=
(
D_PAD
*
)
pad
->
Next
()
)
{
{
if
(
strnicmp
(
TextPinName
,
pad
->
m_Padname
,
4
)
==
0
)
/* trouve */
if
(
strnicmp
(
TextPinName
,
pad
->
m_Padname
,
4
)
==
0
)
{
{
trouve
=
true
;
trouve
=
true
;
if
(
*
TextNetName
!=
'?'
)
if
(
*
TextNetName
!=
'?'
)
...
@@ -597,15 +618,12 @@ int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module, wxTextCtrl* aMes
...
@@ -597,15 +618,12 @@ int SetPadNetName( wxWindow* frame, char* Text, MODULE* Module, wxTextCtrl* aMes
}
}
/*****************************************************/
MODULE
*
WinEDA_PcbFrame
::
ListAndSelectModuleName
(
void
)
/*****************************************************/
/**
/**
* build and shows a list of existing modules on board
* build and shows a list of existing modules on board
* The user can slect a module from this list
* The user can s
e
lect a module from this list
* @return a pointer to the selected module or NULL
* @return a pointer to the selected module or NULL
*/
*/
MODULE
*
WinEDA_PcbFrame
::
ListAndSelectModuleName
(
void
)
{
{
int
ii
,
jj
;
int
ii
,
jj
;
MODULE
*
Module
;
MODULE
*
Module
;
...
@@ -643,12 +661,6 @@ MODULE* WinEDA_PcbFrame::ListAndSelectModuleName( void )
...
@@ -643,12 +661,6 @@ MODULE* WinEDA_PcbFrame::ListAndSelectModuleName( void )
}
}
/*****************************************************************************************/
void
TestFor_Duplicate_Missing_And_Extra_Footprints
(
wxWindow
*
aFrame
,
const
wxString
&
aNetlistFullFilename
,
BOARD
*
aPcb
)
/******************************************************************************************/
/** Function TestFor_Duplicate_Missing_And_Extra_Footprints
/** Function TestFor_Duplicate_Missing_And_Extra_Footprints
* Build a list from the given board and netlist :
* Build a list from the given board and netlist :
* 1 - for duplicate footprints on board
* 1 - for duplicate footprints on board
...
@@ -658,6 +670,9 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
...
@@ -658,6 +670,9 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
* @param aNetlistFullFilename = the given netlist
* @param aNetlistFullFilename = the given netlist
* @param aPcb = the given board
* @param aPcb = the given board
*/
*/
void
TestFor_Duplicate_Missing_And_Extra_Footprints
(
wxWindow
*
aFrame
,
const
wxString
&
aNetlistFullFilename
,
BOARD
*
aPcb
)
#define MAX_LEN_TXT 32
#define MAX_LEN_TXT 32
{
{
int
ii
;
int
ii
;
...
@@ -668,32 +683,38 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
...
@@ -668,32 +683,38 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
if
(
aPcb
->
m_Modules
==
NULL
)
if
(
aPcb
->
m_Modules
==
NULL
)
{
{
DisplayInfoMessage
(
aFrame
,
_
(
"No modules"
),
10
);
return
;
DisplayInfoMessage
(
aFrame
,
_
(
"No modules"
),
10
);
return
;
}
}
/* Construction de la liste des references des modules de la netliste */
/* Build the list of references of the net list modules. */
NbModulesNetListe
=
BuildFootprintsListFromNetlistFile
(
aNetlistFullFilename
,
NbModulesNetListe
=
BuildFootprintsListFromNetlistFile
(
aNetlistFullFilename
,
ModuleListFromNetlist
);
ModuleListFromNetlist
);
if
(
NbModulesNetListe
<
0
)
if
(
NbModulesNetListe
<
0
)
return
;
/* File not found */
return
;
/* File not found */
if
(
NbModulesNetListe
==
0
)
if
(
NbModulesNetListe
==
0
)
{
{
DisplayError
(
aFrame
,
_
(
"No modules in NetList"
),
10
);
return
;
DisplayError
(
aFrame
,
_
(
"No modules in NetList"
),
10
);
return
;
}
}
List
=
new
WinEDA_TextFrame
(
aFrame
,
_
(
"Check Modules"
)
);
List
=
new
WinEDA_TextFrame
(
aFrame
,
_
(
"Check Modules"
)
);
/*
recherche des doubles
*/
/*
Search for duplicate footprints.
*/
List
->
Append
(
_
(
"Duplicates"
)
);
List
->
Append
(
_
(
"Duplicates"
)
);
Module
=
aPcb
->
m_Modules
;
Module
=
aPcb
->
m_Modules
;
for
(
;
Module
!=
NULL
;
Module
=
Module
->
Next
()
)
for
(
;
Module
!=
NULL
;
Module
=
Module
->
Next
()
)
{
{
pt_aux
=
Module
->
Next
();
pt_aux
=
Module
->
Next
();
for
(
;
pt_aux
!=
NULL
;
pt_aux
=
pt_aux
->
Next
()
)
for
(
;
pt_aux
!=
NULL
;
pt_aux
=
pt_aux
->
Next
()
)
{
{
if
(
Module
->
m_Reference
->
m_Text
.
CmpNoCase
(
pt_aux
->
m_Reference
->
m_Text
)
==
0
)
if
(
Module
->
m_Reference
->
m_Text
.
CmpNoCase
(
pt_aux
->
m_Reference
->
m_Text
)
==
0
)
{
{
List
->
Append
(
Module
->
m_Reference
->
m_Text
);
List
->
Append
(
Module
->
m_Reference
->
m_Text
);
nberr
++
;
nberr
++
;
...
@@ -702,7 +723,7 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
...
@@ -702,7 +723,7 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
}
}
}
}
/*
recherche des manquants par rapport a la netliste
*/
/*
Search for the missing module by the net list.
*/
List
->
Append
(
_
(
"Lack:"
)
);
List
->
Append
(
_
(
"Lack:"
)
);
for
(
ii
=
0
;
ii
<
NbModulesNetListe
;
ii
++
)
for
(
ii
=
0
;
ii
<
NbModulesNetListe
;
ii
++
)
...
@@ -724,7 +745,7 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
...
@@ -724,7 +745,7 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
}
}
}
}
/*
recherche des modules supplementaires (i.e. Non en Netliste)
*/
/*
Search for modules not in net list.
*/
List
->
Append
(
_
(
"Not in Netlist:"
)
);
List
->
Append
(
_
(
"Not in Netlist:"
)
);
Module
=
(
MODULE
*
)
aPcb
->
m_Modules
;
Module
=
(
MODULE
*
)
aPcb
->
m_Modules
;
...
@@ -735,7 +756,7 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
...
@@ -735,7 +756,7 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
if
(
Module
->
m_Reference
->
m_Text
.
CmpNoCase
(
if
(
Module
->
m_Reference
->
m_Text
.
CmpNoCase
(
ModuleListFromNetlist
[
ii
]
)
==
0
)
ModuleListFromNetlist
[
ii
]
)
==
0
)
{
{
break
;
/* Module
trouve en netliste
*/
break
;
/* Module
is in net list.
*/
}
}
}
}
...
@@ -750,17 +771,14 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
...
@@ -750,17 +771,14 @@ void TestFor_Duplicate_Missing_And_Extra_Footprints( wxWindow* aFrame,
}
}
/***************************************************************************************/
int
BuildFootprintsListFromNetlistFile
(
const
wxString
&
aNetlistFullFilename
,
wxArrayString
&
aBufName
)
/***************************************************************************************/
/** Function BuildFootprintsListFromNetlistFile
/** Function BuildFootprintsListFromNetlistFile
* Fill BufName with footprints names read from the netlist.
* Fill BufName with footprints names read from the netlist.
* @param aNetlistFullFilename = netlist file name
* @param aNetlistFullFilename = netlist file name
* @param BufName = wxArrayString to fill with footprint names
* @param BufName = wxArrayString to fill with footprint names
* @return Footprint count, or -1 if netlist file cannot opened
* @return Footprint count, or -1 if netlist file cannot opened
*/
*/
int
BuildFootprintsListFromNetlistFile
(
const
wxString
&
aNetlistFullFilename
,
wxArrayString
&
aBufName
)
{
{
int
textlen
;
int
textlen
;
int
nb_modules_lus
;
int
nb_modules_lus
;
...
@@ -777,13 +795,13 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
...
@@ -777,13 +795,13 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
while
(
GetLine
(
source
,
Line
,
&
LineNum
)
)
while
(
GetLine
(
source
,
Line
,
&
LineNum
)
)
{
{
Text
=
StrPurge
(
Line
);
Text
=
StrPurge
(
Line
);
if
(
Comment
)
/* Commentaires en cours */
if
(
Comment
)
{
{
if
(
(
Text
=
strchr
(
Text
,
'}'
)
)
==
NULL
)
if
(
(
Text
=
strchr
(
Text
,
'}'
)
)
==
NULL
)
continue
;
continue
;
Comment
=
0
;
Comment
=
0
;
}
}
if
(
*
Text
==
'{'
)
/* Comment
aires
*/
if
(
*
Text
==
'{'
)
/* Comment
s.
*/
{
{
Comment
=
1
;
Comment
=
1
;
if
(
(
Text
=
strchr
(
Text
,
'}'
)
)
==
NULL
)
if
(
(
Text
=
strchr
(
Text
,
'}'
)
)
==
NULL
)
...
@@ -801,8 +819,8 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
...
@@ -801,8 +819,8 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
if
(
strtok
(
Line
,
" ()
\t\n
"
)
==
NULL
)
if
(
strtok
(
Line
,
" ()
\t\n
"
)
==
NULL
)
Error
=
1
;
/* TimeStamp */
Error
=
1
;
/* TimeStamp */
if
(
(
LibModName
=
strtok
(
NULL
,
" ()
\t\n
"
)
)
==
NULL
)
if
(
(
LibModName
=
strtok
(
NULL
,
" ()
\t\n
"
)
)
==
NULL
)
Error
=
1
;
/* nom Lib */
Error
=
1
;
/* L
ecture du nom (reference) du composant:
*/
/* L
oad the name of the component.
*/
if
(
(
Text
=
strtok
(
NULL
,
" ()
\t\n
"
)
)
==
NULL
)
if
(
(
Text
=
strtok
(
NULL
,
" ()
\t\n
"
)
)
==
NULL
)
Error
=
1
;
Error
=
1
;
nb_modules_lus
++
;
nb_modules_lus
++
;
...
@@ -812,37 +830,32 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
...
@@ -812,37 +830,32 @@ int BuildFootprintsListFromNetlistFile( const wxString& aNetlistFullFilename,
if
(
State
>=
3
)
if
(
State
>=
3
)
{
{
State
--
;
/* Lecture 1 ligne relative au Pad */
State
--
;
}
}
}
}
fclose
(
source
);
fclose
(
source
);
return
nb_modules_lus
;
return
nb_modules_lus
;
}
}
/*****************************************************************************************/
int
ReadListeModules
(
const
wxString
&
CmpFullFileName
,
const
wxString
*
RefCmp
,
const
wxString
*
TimeStamp
,
wxString
&
NameModule
)
/*****************************************************************************************/
/*
/*
* Lit le fichier .CMP donnant l'equivalence Modules / Composants
* Get the file CMP giving the equivalence modules / components
* Retourne:
* Returns:
* Si ce fichier existe retourne :
* If this file exists returns:
* 1 et le nom module dans NameModule
* 1 and the module name in NameModule
* -1 si module non trouve en fichier
* -1 If not found in module file
* sinon 0;
* Otherwise 0;
*
* parametres d'appel:
* RefCmp (NULL si selection par TimeStamp)
* TimeStamp (signature temporelle si elle existe, NULL sinon)
* pointeur sur le buffer recevant le nom du module
*
*
* Exemple de fichier:
* Call settings:
* RefCmp (NULL if selection by TimeStamp)
* TimeStamp (time signature if it exists, NULL otherwise)
* Pointer to the buffer receiving the name of the module
*
*
*
Cmp-Mod V01 Genere par PcbNew le 29/10/2003-13:11:6
*
Example file:
*
*
* Cmp-Mod V01 Genere by Pcbnew 29/10/2003-13: 11:6 *
* BeginCmp
* BeginCmp
* TimeStamp = /322D3011;
* TimeStamp = /322D3011;
* Reference = BUS1;
* Reference = BUS1;
...
@@ -858,6 +871,8 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
...
@@ -858,6 +871,8 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
* EndCmp
* EndCmp
*
*
*/
*/
int
ReadListeModules
(
const
wxString
&
CmpFullFileName
,
const
wxString
*
RefCmp
,
const
wxString
*
TimeStamp
,
wxString
&
NameModule
)
{
{
wxString
refcurrcmp
,
timestamp
,
idmod
;
wxString
refcurrcmp
,
timestamp
,
idmod
;
char
ia
[
1024
];
char
ia
[
1024
];
...
@@ -882,7 +897,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
...
@@ -882,7 +897,7 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
if
(
strnicmp
(
ia
,
"BeginCmp"
,
8
)
!=
0
)
if
(
strnicmp
(
ia
,
"BeginCmp"
,
8
)
!=
0
)
continue
;
continue
;
/*
Ici une description de 1 composant commence
*/
/*
Begin component description.
*/
refcurrcmp
.
Empty
();
refcurrcmp
.
Empty
();
idmod
.
Empty
();
idmod
.
Empty
();
timestamp
.
Empty
();
timestamp
.
Empty
();
...
@@ -917,12 +932,10 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
...
@@ -917,12 +932,10 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
}
}
}
}
/* Fin lecture 1 descr composant */
/* Check if component read is valid. */
/* Test du Composant lu en fichier: est-il le bon */
if
(
RefCmp
)
if
(
RefCmp
)
{
{
if
(
RefCmp
->
CmpNoCase
(
refcurrcmp
)
==
0
)
//Found!
if
(
RefCmp
->
CmpNoCase
(
refcurrcmp
)
==
0
)
//
Found!
{
{
fclose
(
FichCmp
);
fclose
(
FichCmp
);
NameModule
=
idmod
;
NameModule
=
idmod
;
...
@@ -931,7 +944,8 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
...
@@ -931,7 +944,8 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
}
}
else
if
(
TimeStamp
)
else
if
(
TimeStamp
)
{
{
if
(
TimeStamp
->
CmpNoCase
(
timestamp
)
==
0
&&
!
timestamp
.
IsEmpty
()
)
//Found
if
(
TimeStamp
->
CmpNoCase
(
timestamp
)
==
0
&&
!
timestamp
.
IsEmpty
()
)
// Found
{
{
fclose
(
FichCmp
);
fclose
(
FichCmp
);
NameModule
=
idmod
;
NameModule
=
idmod
;
...
@@ -945,13 +959,12 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
...
@@ -945,13 +959,12 @@ int ReadListeModules( const wxString& CmpFullFileName, const wxString* RefCmp,
}
}
/***********************************************************************************/
/* ??? Fontion copiant en memoire de travail les caracteristiques
void
AddToList
(
const
wxString
&
NameLibCmp
,
const
wxString
&
CmpName
,
const
wxString
&
path
)
/************************************************************************************/
/* Fontion copiant en memoire de travail les caracteristiques
* des nouveaux modules
* des nouveaux modules
*/
*/
void
AddToList
(
const
wxString
&
NameLibCmp
,
const
wxString
&
CmpName
,
const
wxString
&
path
)
{
{
MODULEtoLOAD
*
NewMod
;
MODULEtoLOAD
*
NewMod
;
...
@@ -962,15 +975,11 @@ void AddToList( const wxString& NameLibCmp, const wxString& CmpName, const wxStr
...
@@ -962,15 +975,11 @@ void AddToList( const wxString& NameLibCmp, const wxString& CmpName, const wxStr
}
}
/***************************************************************/
/* Load new modules from library.
void
LoadListeModules
(
WinEDA_PcbFrame
*
aPcbFrame
)
* If a module is being loaded it is duplicated, which avoids reading
/***************************************************************/
* unnecessary library.
/* Routine de chargement des nouveaux modules en une seule lecture des
* librairies
* Si un module vient d'etre charge il est duplique, ce qui evite une lecture
* inutile de la librairie
*/
*/
void
LoadListeModules
(
WinEDA_PcbFrame
*
aPcbFrame
)
{
{
MODULEtoLOAD
*
ref
,
*
cmp
;
MODULEtoLOAD
*
ref
,
*
cmp
;
int
ii
;
int
ii
;
...
@@ -986,8 +995,10 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
...
@@ -986,8 +995,10 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
// Calculate the footprint "best" position:
// Calculate the footprint "best" position:
if
(
aPcbFrame
->
SetBoardBoundaryBoxFromEdgesOnly
()
)
if
(
aPcbFrame
->
SetBoardBoundaryBoxFromEdgesOnly
()
)
{
{
ModuleBestPosition
.
x
=
aPcbFrame
->
GetBoard
()
->
m_BoundaryBox
.
GetRight
()
+
5000
;
ModuleBestPosition
.
x
=
ModuleBestPosition
.
y
=
aPcbFrame
->
GetBoard
()
->
m_BoundaryBox
.
GetBottom
()
+
10000
;
aPcbFrame
->
GetBoard
()
->
m_BoundaryBox
.
GetRight
()
+
5000
;
ModuleBestPosition
.
y
=
aPcbFrame
->
GetBoard
()
->
m_BoundaryBox
.
GetBottom
()
+
10000
;
}
}
else
else
ModuleBestPosition
=
wxPoint
(
0
,
0
);
ModuleBestPosition
=
wxPoint
(
0
,
0
);
...
@@ -997,7 +1008,9 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
...
@@ -997,7 +1008,9 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
if
(
(
ii
==
0
)
||
(
ref
->
m_LibName
!=
cmp
->
m_LibName
)
)
if
(
(
ii
==
0
)
||
(
ref
->
m_LibName
!=
cmp
->
m_LibName
)
)
{
{
/* New footprint : must be loaded from a library */
/* New footprint : must be loaded from a library */
Module
=
aPcbFrame
->
Get_Librairie_Module
(
wxEmptyString
,
cmp
->
m_LibName
,
FALSE
);
Module
=
aPcbFrame
->
Get_Librairie_Module
(
wxEmptyString
,
cmp
->
m_LibName
,
FALSE
);
ref
=
cmp
;
ref
=
cmp
;
if
(
Module
==
NULL
)
if
(
Module
==
NULL
)
{
{
...
@@ -1010,17 +1023,19 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
...
@@ -1010,17 +1023,19 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
}
}
Module
->
SetPosition
(
ModuleBestPosition
);
Module
->
SetPosition
(
ModuleBestPosition
);
/* Update schematic links : reference "Time Stamp" and schematic hierarchical path */
/* Update schematic links : reference "Time Stamp" and schematic
*hierarchical path */
Module
->
m_Reference
->
m_Text
=
cmp
->
m_CmpName
;
Module
->
m_Reference
->
m_Text
=
cmp
->
m_CmpName
;
Module
->
m_TimeStamp
=
GetTimeStamp
();
Module
->
m_TimeStamp
=
GetTimeStamp
();
Module
->
m_Path
=
cmp
->
m_TimeStampPath
;
Module
->
m_Path
=
cmp
->
m_TimeStampPath
;
}
}
else
else
{
{
/* Footprint already loaded from a library, duplicate it (faster) */
/* Footprint already loaded from a library, duplicate it (faster)
*/
MODULE
*
newmodule
;
MODULE
*
newmodule
;
if
(
Module
==
NULL
)
if
(
Module
==
NULL
)
continue
;
/* module non existant en libr
*/
continue
;
/* Module does not exist in library.
*/
newmodule
=
new
MODULE
(
aPcbFrame
->
GetBoard
()
);
newmodule
=
new
MODULE
(
aPcbFrame
->
GetBoard
()
);
newmodule
->
Copy
(
Module
);
newmodule
->
Copy
(
Module
);
...
@@ -1036,8 +1051,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
...
@@ -1036,8 +1051,7 @@ void LoadListeModules( WinEDA_PcbFrame* aPcbFrame )
}
}
/* Routine utilisee par qsort pour le tri des modules a charger
/* Routines used by qsort to sort a load module. */
*/
static
int
SortByLibName
(
MODULEtoLOAD
**
ref
,
MODULEtoLOAD
**
cmp
)
static
int
SortByLibName
(
MODULEtoLOAD
**
ref
,
MODULEtoLOAD
**
cmp
)
{
{
int
ii
=
(
*
ref
)
->
m_LibName
.
CmpNoCase
(
(
*
cmp
)
->
m_LibName
);
int
ii
=
(
*
ref
)
->
m_LibName
.
CmpNoCase
(
(
*
cmp
)
->
m_LibName
);
...
@@ -1046,12 +1060,9 @@ static int SortByLibName( MODULEtoLOAD** ref, MODULEtoLOAD** cmp )
...
@@ -1046,12 +1060,9 @@ static int SortByLibName( MODULEtoLOAD** ref, MODULEtoLOAD** cmp )
}
}
/*************************************************/
/* Sort the module list in alphabetical order by module name.
void
SortListModulesToLoadByLibname
(
int
NbModules
)
/**************************************************/
/* Rearrage la liste des modules List par ordre alphabetique des noms lib des modules
*/
*/
void
SortListModulesToLoadByLibname
(
int
NbModules
)
{
{
MODULEtoLOAD
**
base_list
,
*
item
;
MODULEtoLOAD
**
base_list
,
*
item
;
int
ii
;
int
ii
;
...
@@ -1065,17 +1076,16 @@ void SortListModulesToLoadByLibname( int NbModules )
...
@@ -1065,17 +1076,16 @@ void SortListModulesToLoadByLibname( int NbModules )
}
}
qsort
(
base_list
,
NbModules
,
sizeof
(
MODULEtoLOAD
*
),
qsort
(
base_list
,
NbModules
,
sizeof
(
MODULEtoLOAD
*
),
(
int
(
*
)
(
const
void
*
,
const
void
*
)
)
SortByLibName
);
(
int
(
*
)
(
const
void
*
,
const
void
*
)
)
SortByLibName
);
// Reconstruction du chainage:
s_ModuleToLoad_List
=
*
base_list
;
s_ModuleToLoad_List
=
*
base_list
;
for
(
ii
=
0
;
ii
<
NbModules
-
1
;
ii
++
)
for
(
ii
=
0
;
ii
<
NbModules
-
1
;
ii
++
)
{
{
item
=
base_list
[
ii
];
item
=
base_list
[
ii
];
item
->
SetNext
(
base_list
[
ii
+
1
]
);
item
->
SetNext
(
base_list
[
ii
+
1
]
);
}
}
// Dernier item: Pnext = NULL:
item
=
base_list
[
ii
];
item
=
base_list
[
ii
];
item
->
SetNext
(
NULL
);
item
->
SetNext
(
NULL
);
...
...
pcbnew/pcbframe.cpp
View file @
1a139a7f
/******************************************
**********************
/
/******************************************/
/* pcbframe.cpp -
fonctions des classes du type WinEDA_PcbFrame
*/
/* pcbframe.cpp -
PCB editor main window.
*/
/******************************************
**********************
/
/******************************************/
#include "fctsys.h"
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "appl_wxstruct.h"
...
@@ -25,191 +25,188 @@
...
@@ -25,191 +25,188 @@
#define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" )
#define SHOW_MICROWAVE_TOOLS wxT( "ShowMicrowaveTools" )
/*******************************/
/* class WinEDA_PcbFrame */
/*******************************/
BEGIN_EVENT_TABLE
(
WinEDA_PcbFrame
,
WinEDA_BasePcbFrame
)
BEGIN_EVENT_TABLE
(
WinEDA_PcbFrame
,
WinEDA_BasePcbFrame
)
EVT_SOCKET
(
ID_EDA_SOCKET_EVENT_SERV
,
WinEDA_PcbFrame
::
OnSockRequestServer
)
EVT_SOCKET
(
ID_EDA_SOCKET_EVENT_SERV
,
WinEDA_PcbFrame
::
OnSockRequestServer
)
EVT_SOCKET
(
ID_EDA_SOCKET_EVENT
,
WinEDA_PcbFrame
::
OnSockRequest
)
EVT_SOCKET
(
ID_EDA_SOCKET_EVENT
,
WinEDA_PcbFrame
::
OnSockRequest
)
EVT_KICAD_CHOICEBOX
(
ID_ON_ZOOM_SELECT
,
WinEDA_PcbFrame
::
OnSelectZoom
)
EVT_KICAD_CHOICEBOX
(
ID_ON_ZOOM_SELECT
,
WinEDA_PcbFrame
::
OnSelectZoom
)
EVT_KICAD_CHOICEBOX
(
ID_ON_GRID_SELECT
,
WinEDA_PcbFrame
::
OnSelectGrid
)
EVT_KICAD_CHOICEBOX
(
ID_ON_GRID_SELECT
,
WinEDA_PcbFrame
::
OnSelectGrid
)
EVT_CLOSE
(
WinEDA_PcbFrame
::
OnCloseWindow
)
EVT_CLOSE
(
WinEDA_PcbFrame
::
OnCloseWindow
)
EVT_SIZE
(
WinEDA_PcbFrame
::
OnSize
)
EVT_SIZE
(
WinEDA_PcbFrame
::
OnSize
)
EVT_TOOL_RANGE
(
ID_ZOOM_IN
,
ID_ZOOM_PAGE
,
WinEDA_PcbFrame
::
OnZoom
)
EVT_TOOL_RANGE
(
ID_ZOOM_IN
,
ID_ZOOM_PAGE
,
WinEDA_PcbFrame
::
OnZoom
)
EVT_TOOL
(
ID_LOAD_FILE
,
WinEDA_PcbFrame
::
Files_io
)
EVT_TOOL
(
ID_LOAD_FILE
,
WinEDA_PcbFrame
::
Files_io
)
EVT_TOOL
(
ID_MENU_READ_LAST_SAVED_VERSION_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_TOOL
(
ID_MENU_READ_LAST_SAVED_VERSION_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_TOOL
(
ID_MENU_RECOVER_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_TOOL
(
ID_MENU_RECOVER_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_TOOL
(
ID_NEW_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_TOOL
(
ID_NEW_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_TOOL
(
ID_SAVE_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_TOOL
(
ID_SAVE_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_TOOL
(
ID_OPEN_MODULE_EDITOR
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_OPEN_MODULE_EDITOR
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
// Menu Files:
// Menu Files:
EVT_MENU
(
ID_MAIN_MENUBAR
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_MAIN_MENUBAR
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_LOAD_FILE
,
WinEDA_PcbFrame
::
Files_io
)
EVT_MENU
(
ID_LOAD_FILE
,
WinEDA_PcbFrame
::
Files_io
)
EVT_MENU
(
ID_NEW_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_MENU
(
ID_NEW_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_MENU
(
ID_SAVE_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_MENU
(
ID_SAVE_BOARD
,
WinEDA_PcbFrame
::
Files_io
)
EVT_MENU
(
ID_APPEND_FILE
,
WinEDA_PcbFrame
::
Files_io
)
EVT_MENU
(
ID_APPEND_FILE
,
WinEDA_PcbFrame
::
Files_io
)
EVT_MENU
(
ID_SAVE_BOARD_AS
,
WinEDA_PcbFrame
::
Files_io
)
EVT_MENU
(
ID_SAVE_BOARD_AS
,
WinEDA_PcbFrame
::
Files_io
)
EVT_MENU_RANGE
(
wxID_FILE1
,
wxID_FILE9
,
WinEDA_PcbFrame
::
OnFileHistory
)
EVT_MENU_RANGE
(
wxID_FILE1
,
wxID_FILE9
,
WinEDA_PcbFrame
::
OnFileHistory
)
EVT_MENU
(
ID_GEN_PLOT
,
WinEDA_PcbFrame
::
ToPlotter
)
EVT_MENU
(
ID_GEN_PLOT
,
WinEDA_PcbFrame
::
ToPlotter
)
EVT_MENU
(
ID_GEN_EXPORT_SPECCTRA
,
WinEDA_PcbFrame
::
ExportToSpecctra
)
EVT_MENU
(
ID_GEN_EXPORT_SPECCTRA
,
WinEDA_PcbFrame
::
ExportToSpecctra
)
EVT_MENU
(
ID_GEN_EXPORT_FILE_GENCADFORMAT
,
WinEDA_PcbFrame
::
ExportToGenCAD
)
EVT_MENU
(
ID_GEN_EXPORT_FILE_GENCADFORMAT
,
WinEDA_PcbFrame
::
ExportToGenCAD
)
EVT_MENU
(
ID_GEN_EXPORT_FILE_MODULE_REPORT
,
EVT_MENU
(
ID_GEN_EXPORT_FILE_MODULE_REPORT
,
WinEDA_PcbFrame
::
GenModuleReport
)
WinEDA_PcbFrame
::
GenModuleReport
)
EVT_MENU
(
ID_GEN_IMPORT_SPECCTRA_SESSION
,
EVT_MENU
(
ID_GEN_IMPORT_SPECCTRA_SESSION
,
WinEDA_PcbFrame
::
ImportSpecctraSession
)
WinEDA_PcbFrame
::
ImportSpecctraSession
)
EVT_MENU
(
ID_GEN_IMPORT_SPECCTRA_DESIGN
,
EVT_MENU
(
ID_GEN_IMPORT_SPECCTRA_DESIGN
,
WinEDA_PcbFrame
::
ImportSpecctraDesign
)
WinEDA_PcbFrame
::
ImportSpecctraDesign
)
EVT_MENU
(
ID_MENU_ARCHIVE_NEW_MODULES
,
EVT_MENU
(
ID_MENU_ARCHIVE_NEW_MODULES
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_MENU_ARCHIVE_ALL_MODULES
,
EVT_MENU
(
ID_MENU_ARCHIVE_ALL_MODULES
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_EXIT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_EXIT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
// menu Config
// menu Config
EVT_MENU_RANGE
(
ID_CONFIG_AND_PREFERENCES_START
,
EVT_MENU_RANGE
(
ID_CONFIG_AND_PREFERENCES_START
,
ID_CONFIG_AND_PREFERENCES_END
,
ID_CONFIG_AND_PREFERENCES_END
,
WinEDA_PcbFrame
::
Process_Config
)
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_COLORS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_COLORS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_OPTIONS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_OPTIONS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_LAYERS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_LAYERS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_MASK_CLEARANCE
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_MASK_CLEARANCE
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_DRAWINGS_WIDTHS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_DRAWINGS_WIDTHS_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_PAD_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_PAD_SETUP
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_CONFIG_SAVE
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_CONFIG_SAVE
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_CONFIG_READ
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_CONFIG_READ
,
WinEDA_PcbFrame
::
Process_Config
)
EVT_MENU
(
ID_PCB_DISPLAY_OPTIONS_SETUP
,
WinEDA_PcbFrame
::
InstallDisplayOptionsDialog
)
EVT_MENU
(
ID_PCB_DISPLAY_OPTIONS_SETUP
,
WinEDA_PcbFrame
::
InstallDisplayOptionsDialog
)
EVT_MENU
(
ID_PCB_USER_GRID_SETUP
,
EVT_MENU
(
ID_PCB_USER_GRID_SETUP
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU_RANGE
(
ID_LANGUAGE_CHOICE
,
ID_LANGUAGE_CHOICE_END
,
EVT_MENU_RANGE
(
ID_LANGUAGE_CHOICE
,
ID_LANGUAGE_CHOICE_END
,
WinEDA_DrawFrame
::
SetLanguage
)
WinEDA_DrawFrame
::
SetLanguage
)
// menu Postprocess
// menu Postprocess
EVT_MENU
(
ID_PCB_GEN_POS_MODULES_FILE
,
WinEDA_PcbFrame
::
GenModulesPosition
)
EVT_MENU
(
ID_PCB_GEN_POS_MODULES_FILE
,
WinEDA_PcbFrame
::
GenModulesPosition
)
EVT_MENU
(
ID_PCB_GEN_DRILL_FILE
,
WinEDA_PcbFrame
::
InstallDrillFrame
)
EVT_MENU
(
ID_PCB_GEN_DRILL_FILE
,
WinEDA_PcbFrame
::
InstallDrillFrame
)
EVT_MENU
(
ID_PCB_GEN_CMP_FILE
,
WinEDA_PcbFrame
::
RecreateCmpFileFromBoard
)
EVT_MENU
(
ID_PCB_GEN_CMP_FILE
,
WinEDA_PcbFrame
::
RecreateCmpFileFromBoard
)
EVT_MENU
(
ID_PCB_GEN_BOM_FILE_FROM_BOARD
,
WinEDA_PcbFrame
::
RecreateBOMFileFromBoard
)
EVT_MENU
(
ID_PCB_GEN_BOM_FILE_FROM_BOARD
,
WinEDA_PcbFrame
::
RecreateBOMFileFromBoard
)
// menu Miscellaneous
EVT_MENU
(
ID_MENU_LIST_NETS
,
WinEDA_PcbFrame
::
ListNetsAndSelect
)
// menu Miscellaneous
EVT_MENU
(
ID_PCB_GLOBAL_DELETE
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_MENU_LIST_NETS
,
WinEDA_PcbFrame
::
ListNetsAndSelect
)
EVT_MENU
(
ID_MENU_PCB_CLEAN
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_PCB_GLOBAL_DELETE
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_MENU_PCB_SWAP_LAYERS
,
EVT_MENU
(
ID_MENU_PCB_CLEAN
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_MENU_PCB_SWAP_LAYERS
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
// Menu Help
// Menu Help
EVT_MENU
(
ID_GENERAL_HELP
,
WinEDA_DrawFrame
::
GetKicadHelp
)
EVT_MENU
(
ID_GENERAL_HELP
,
WinEDA_DrawFrame
::
GetKicadHelp
)
EVT_MENU
(
ID_KICAD_ABOUT
,
WinEDA_BasicFrame
::
GetKicadAbout
)
EVT_MENU
(
ID_KICAD_ABOUT
,
WinEDA_BasicFrame
::
GetKicadAbout
)
// Menu 3D Frame
// Menu 3D Frame
EVT_MENU
(
ID_MENU_PCB_SHOW_3D_FRAME
,
WinEDA_PcbFrame
::
Show3D_Frame
)
EVT_MENU
(
ID_MENU_PCB_SHOW_3D_FRAME
,
WinEDA_PcbFrame
::
Show3D_Frame
)
// Menu Get Design Rules Editor
// Menu Get Design Rules Editor
EVT_MENU
(
ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG
,
WinEDA_PcbFrame
::
ShowDesignRulesEditor
)
EVT_MENU
(
ID_MENU_PCB_SHOW_DESIGN_RULES_DIALOG
,
WinEDA_PcbFrame
::
ShowDesignRulesEditor
)
// Horizontal toolbar
EVT_TOOL
(
ID_TO_LIBRARY
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
// Horizontal toolbar
EVT_TOOL
(
ID_SHEET_SET
,
WinEDA_DrawFrame
::
Process_PageSettings
)
EVT_TOOL
(
ID_TO_LIBRARY
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_CUT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_SHEET_SET
,
WinEDA_DrawFrame
::
Process_PageSettings
)
EVT_TOOL
(
wxID_COPY
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_CUT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_PASTE
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
wxID_COPY
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_UNDO_BUTT
,
WinEDA_PcbFrame
::
GetBoardFromUndoList
)
EVT_TOOL
(
wxID_PASTE
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_REDO_BUTT
,
WinEDA_PcbFrame
::
GetBoardFromRedoList
)
EVT_TOOL
(
ID_UNDO_BUTT
,
WinEDA_PcbFrame
::
GetBoardFromUndoList
)
EVT_TOOL
(
ID_GEN_PRINT
,
WinEDA_DrawFrame
::
ToPrinter
)
EVT_TOOL
(
ID_REDO_BUTT
,
WinEDA_PcbFrame
::
GetBoardFromRedoList
)
EVT_TOOL
(
ID_GEN_PLOT_SVG
,
WinEDA_DrawFrame
::
SVG_Print
)
EVT_TOOL
(
ID_GEN_PRINT
,
WinEDA_DrawFrame
::
ToPrinter
)
EVT_TOOL
(
ID_GEN_PLOT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_GEN_PLOT_SVG
,
WinEDA_DrawFrame
::
SVG_Print
)
EVT_TOOL
(
ID_FIND_ITEMS
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_GEN_PLOT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_GET_NETLIST
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_FIND_ITEMS
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_DRC_CONTROL
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_GET_NETLIST
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR
,
EVT_TOOL
(
ID_DRC_CONTROL
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH
,
EVT_TOOL
(
ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH
,
WinEDA_PcbFrame
::
Tracks_and_Vias_Size_Event
)
WinEDA_PcbFrame
::
Tracks_and_Vias_Size_Event
)
EVT_KICAD_CHOICEBOX
(
ID_TOOLBARH_PCB_SELECT_LAYER
,
EVT_KICAD_CHOICEBOX
(
ID_TOOLBARH_PCB_SELECT_LAYER
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_KICAD_CHOICEBOX
(
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH
,
EVT_KICAD_CHOICEBOX
(
ID_AUX_TOOLBAR_PCB_TRACK_WIDTH
,
WinEDA_PcbFrame
::
Tracks_and_Vias_Size_Event
)
WinEDA_PcbFrame
::
Tracks_and_Vias_Size_Event
)
EVT_KICAD_CHOICEBOX
(
ID_AUX_TOOLBAR_PCB_VIA_SIZE
,
EVT_KICAD_CHOICEBOX
(
ID_AUX_TOOLBAR_PCB_VIA_SIZE
,
WinEDA_PcbFrame
::
Tracks_and_Vias_Size_Event
)
WinEDA_PcbFrame
::
Tracks_and_Vias_Size_Event
)
EVT_TOOL
(
ID_TOOLBARH_PCB_AUTOPLACE
,
WinEDA_PcbFrame
::
AutoPlace
)
EVT_TOOL
(
ID_TOOLBARH_PCB_AUTOPLACE
,
WinEDA_PcbFrame
::
AutoPlace
)
EVT_TOOL
(
ID_TOOLBARH_PCB_AUTOROUTE
,
WinEDA_PcbFrame
::
AutoPlace
)
EVT_TOOL
(
ID_TOOLBARH_PCB_AUTOROUTE
,
WinEDA_PcbFrame
::
AutoPlace
)
EVT_TOOL
(
ID_TOOLBARH_PCB_FREEROUTE_ACCESS
,
EVT_TOOL
(
ID_TOOLBARH_PCB_FREEROUTE_ACCESS
,
WinEDA_PcbFrame
::
Access_to_External_Tool
)
WinEDA_PcbFrame
::
Access_to_External_Tool
)
// Option toolbar
// Option toolbar
EVT_TOOL_RANGE
(
ID_TB_OPTIONS_START
,
ID_TB_OPTIONS_END
,
EVT_TOOL_RANGE
(
ID_TB_OPTIONS_START
,
ID_TB_OPTIONS_END
,
WinEDA_PcbFrame
::
OnSelectOptionToolbar
)
WinEDA_PcbFrame
::
OnSelectOptionToolbar
)
// Vertical toolbar:
// Vertical toolbar:
EVT_TOOL
(
ID_NO_SELECT_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_NO_SELECT_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_HIGHLIGHT_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_HIGHLIGHT_BUTT
,
EVT_TOOL
(
ID_COMPONENT_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_TRACK_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_ZONES_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_MIRE_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_ARC_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_CIRCLE_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_ADD_TEXT_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_ADD_LINE_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_COTATION_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_DELETE_ITEM_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_SHOW_1_RATSNEST_BUTT
,
EVT_TOOL
(
ID_COMPONENT_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_TRACK_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_ZONES_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_MIRE_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_ARC_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_CIRCLE_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_ADD_TEXT_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_ADD_LINE_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_COTATION_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_DELETE_ITEM_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_PLACE_OFFSET_COORD_BUTT
,
EVT_TOOL
(
ID_PCB_SHOW_1_RATSNEST_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL
(
ID_PCB_PLACE_OFFSET_COORD_BUTT
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_TOOL_RANGE
(
ID_PCB_MUWAVE_START_CMD
,
ID_PCB_MUWAVE_END_CMD
,
EVT_TOOL_RANGE
(
ID_PCB_MUWAVE_START_CMD
,
ID_PCB_MUWAVE_END_CMD
,
WinEDA_PcbFrame
::
ProcessMuWaveFunctions
)
WinEDA_PcbFrame
::
ProcessMuWaveFunctions
)
EVT_TOOL_RCLICKED
(
ID_TRACK_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_TRACK_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_CIRCLE_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_CIRCLE_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_ARC_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_ARC_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_ADD_TEXT_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_ADD_TEXT_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_ADD_LINE_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_ADD_LINE_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_COTATION_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_TOOL_RCLICKED
(
ID_PCB_COTATION_BUTT
,
WinEDA_PcbFrame
::
ToolOnRightClick
)
EVT_MENU_RANGE
(
ID_POPUP_PCB_AUTOPLACE_START_RANGE
,
EVT_MENU_RANGE
(
ID_POPUP_PCB_AUTOPLACE_START_RANGE
,
ID_POPUP_PCB_AUTOPLACE_END_RANGE
,
ID_POPUP_PCB_AUTOPLACE_END_RANGE
,
WinEDA_PcbFrame
::
AutoPlace
)
WinEDA_PcbFrame
::
AutoPlace
)
EVT_MENU_RANGE
(
ID_POPUP_PCB_START_RANGE
,
ID_POPUP_PCB_END_RANGE
,
EVT_MENU_RANGE
(
ID_POPUP_PCB_START_RANGE
,
ID_POPUP_PCB_END_RANGE
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
// Tracks and vias sizes general options
// Tracks and vias sizes general options
EVT_MENU_RANGE
(
ID_POPUP_PCB_SELECT_WIDTH_START_RANGE
,
ID_POPUP_PCB_SELECT_WIDTH_END_RANGE
,
EVT_MENU_RANGE
(
ID_POPUP_PCB_SELECT_WIDTH_START_RANGE
,
ID_POPUP_PCB_SELECT_WIDTH_END_RANGE
,
WinEDA_PcbFrame
::
Tracks_and_Vias_Size_Event
)
WinEDA_PcbFrame
::
Tracks_and_Vias_Size_Event
)
// popup menus
// popup menus
EVT_MENU
(
ID_POPUP_PCB_DELETE_TRACKSEG
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU
(
ID_POPUP_PCB_DELETE_TRACKSEG
,
EVT_MENU_RANGE
(
ID_POPUP_GENERAL_START_RANGE
,
ID_POPUP_GENERAL_END_RANGE
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
EVT_MENU_RANGE
(
ID_POPUP_GENERAL_START_RANGE
,
ID_POPUP_GENERAL_END_RANGE
,
WinEDA_PcbFrame
::
Process_Special_Functions
)
WinEDA_PcbFrame
::
Process_Special_Functions
)
// PopUp Menus pour Zooms traites dans drawpanel.cpp
END_EVENT_TABLE
()
END_EVENT_TABLE
()
///////****************************///////////:
///////****************************///////////:
/****************/
/* Constructeur */
/****************/
WinEDA_PcbFrame
::
WinEDA_PcbFrame
(
wxWindow
*
father
,
WinEDA_PcbFrame
::
WinEDA_PcbFrame
(
wxWindow
*
father
,
const
wxString
&
title
,
const
wxString
&
title
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
const
wxPoint
&
pos
,
const
wxSize
&
size
,
...
@@ -261,50 +258,49 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
...
@@ -261,50 +258,49 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father,
ReCreateAuxVToolbar
();
ReCreateAuxVToolbar
();
#if defined(KICAD_AUIMANAGER)
#if defined(KICAD_AUIMANAGER)
m_auimgr
.
SetManagedWindow
(
this
);
m_auimgr
.
SetManagedWindow
(
this
);
wxAuiPaneInfo
horiz
;
wxAuiPaneInfo
horiz
;
horiz
.
Gripper
(
false
);
horiz
.
Gripper
(
false
);
horiz
.
DockFixed
(
true
);
horiz
.
DockFixed
(
true
);
horiz
.
Movable
(
false
);
horiz
.
Movable
(
false
);
horiz
.
Floatable
(
false
);
horiz
.
Floatable
(
false
);
horiz
.
CloseButton
(
false
);
horiz
.
CloseButton
(
false
);
horiz
.
CaptionVisible
(
false
);
horiz
.
CaptionVisible
(
false
);
wxAuiPaneInfo
vert
(
horiz
);
wxAuiPaneInfo
vert
(
horiz
);
vert
.
TopDockable
(
false
).
BottomDockable
(
false
);
vert
.
TopDockable
(
false
).
BottomDockable
(
false
);
horiz
.
LeftDockable
(
false
).
RightDockable
(
false
);
horiz
.
LeftDockable
(
false
).
RightDockable
(
false
);
m_auimgr
.
AddPane
(
m_HToolBar
,
m_auimgr
.
AddPane
(
m_HToolBar
,
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_HToolBar"
)).
Top
().
Row
(
0
));
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_HToolBar"
)
).
Top
().
Row
(
0
)
);
m_auimgr
.
AddPane
(
m_AuxiliaryToolBar
,
m_auimgr
.
AddPane
(
m_AuxiliaryToolBar
,
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_AuxiliaryToolBar"
)).
Top
().
Row
(
1
)
);
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"m_AuxiliaryToolBar"
)
).
Top
().
Row
(
1
)
);
m_auimgr
.
AddPane
(
m_AuxVToolBar
,
m_auimgr
.
AddPane
(
m_AuxVToolBar
,
wxAuiPaneInfo
(
vert
).
Name
(
wxT
(
"m_AuxVToolBar"
)).
Right
().
Row
(
1
).
Hide
()
);
wxAuiPaneInfo
(
vert
).
Name
(
wxT
(
"m_AuxVToolBar"
)
).
Right
().
Row
(
1
).
Hide
()
);
m_auimgr
.
AddPane
(
m_VToolBar
,
m_auimgr
.
AddPane
(
m_VToolBar
,
wxAuiPaneInfo
(
vert
).
Name
(
wxT
(
"m_VToolBar"
)).
Right
()
);
wxAuiPaneInfo
(
vert
).
Name
(
wxT
(
"m_VToolBar"
)
).
Right
()
);
m_auimgr
.
AddPane
(
m_OptionsToolBar
,
m_auimgr
.
AddPane
(
m_OptionsToolBar
,
wxAuiPaneInfo
(
vert
).
Name
(
wxT
(
"m_OptionsToolBar"
)).
Left
()
);
wxAuiPaneInfo
(
vert
).
Name
(
wxT
(
"m_OptionsToolBar"
)
).
Left
()
);
m_auimgr
.
AddPane
(
DrawPanel
,
m_auimgr
.
AddPane
(
DrawPanel
,
wxAuiPaneInfo
().
Name
(
wxT
(
"DrawFrame"
)).
CentrePane
()
);
wxAuiPaneInfo
().
Name
(
wxT
(
"DrawFrame"
)
).
CentrePane
()
);
m_auimgr
.
AddPane
(
MsgPanel
,
m_auimgr
.
AddPane
(
MsgPanel
,
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"MsgPanel"
)).
Bottom
()
);
wxAuiPaneInfo
(
horiz
).
Name
(
wxT
(
"MsgPanel"
)
).
Bottom
()
);
m_auimgr
.
Update
();
m_auimgr
.
Update
();
#endif
#endif
}
}
/************************************/
WinEDA_PcbFrame
::~
WinEDA_PcbFrame
()
WinEDA_PcbFrame
::~
WinEDA_PcbFrame
()
/************************************/
{
{
extern
PARAM_CFG_BASE
*
ParamCfgList
[];
extern
PARAM_CFG_BASE
*
ParamCfgList
[];
...
@@ -313,9 +309,7 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
...
@@ -313,9 +309,7 @@ WinEDA_PcbFrame::~WinEDA_PcbFrame()
}
}
/********************************************************/
void
WinEDA_PcbFrame
::
OnCloseWindow
(
wxCloseEvent
&
Event
)
void
WinEDA_PcbFrame
::
OnCloseWindow
(
wxCloseEvent
&
Event
)
/********************************************************/
{
{
DrawPanel
->
m_AbortRequest
=
true
;
DrawPanel
->
m_AbortRequest
=
true
;
...
@@ -347,7 +341,8 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
...
@@ -347,7 +341,8 @@ void WinEDA_PcbFrame::OnCloseWindow( wxCloseEvent& Event )
SaveSettings
();
SaveSettings
();
// do not show the window because ScreenPcb will be deleted and we do not want any paint event
// do not show the window because ScreenPcb will be deleted and we do not
// want any paint event
Show
(
false
);
Show
(
false
);
ActiveScreen
=
ScreenPcb
;
ActiveScreen
=
ScreenPcb
;
Destroy
();
Destroy
();
...
...
pcbnew/pcbnew_config.cpp
View file @
1a139a7f
/***********************************/
/****************************************/
/** pcbcfg() : configuration **/
/** pcbnew_config.cpp : configuration **/
/***********************************/
/****************************************/
/* lit ou met a jour la configuration de PCBNEW */
#include "fctsys.h"
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "appl_wxstruct.h"
...
@@ -24,12 +22,10 @@
...
@@ -24,12 +22,10 @@
#include "dialog_general_options.h"
#include "dialog_general_options.h"
#define HOTKEY_FILENAME wxT( "pcbnew" )
#define HOTKEY_FILENAME wxT( "pcbnew" )
/***********************************************************/
void
WinEDA_PcbFrame
::
Process_Config
(
wxCommandEvent
&
event
)
void
WinEDA_PcbFrame
::
Process_Config
(
wxCommandEvent
&
event
)
/***********************************************************/
{
{
int
id
=
event
.
GetId
();
int
id
=
event
.
GetId
();
wxPoint
pos
;
wxPoint
pos
;
...
@@ -54,7 +50,7 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
...
@@ -54,7 +50,7 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
DisplayDialogLayerSetup
(
this
);
DisplayDialogLayerSetup
(
this
);
break
;
break
;
case
ID_CONFIG_REQ
:
// Creation de la fenetre de configuration
case
ID_CONFIG_REQ
:
InstallConfigFrame
(
pos
);
InstallConfigFrame
(
pos
);
break
;
break
;
...
@@ -147,13 +143,10 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
...
@@ -147,13 +143,10 @@ void WinEDA_PcbFrame::Process_Config( wxCommandEvent& event )
}
}
/***************************************************************/
bool
Read_Hotkey_Config
(
WinEDA_DrawFrame
*
frame
,
bool
verbose
)
/***************************************************************/
/*
/*
* Read the hotkey files config for pcbnew and module_edit
* Read the hotkey files config for pcbnew and module_edit
*/
*/
bool
Read_Hotkey_Config
(
WinEDA_DrawFrame
*
frame
,
bool
verbose
)
{
{
wxString
FullFileName
=
ReturnHotkeyConfigFilePath
(
wxString
FullFileName
=
ReturnHotkeyConfigFilePath
(
g_ConfigFileLocationChoice
);
g_ConfigFileLocationChoice
);
...
@@ -183,7 +176,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
...
@@ -183,7 +176,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
wxGetApp
().
RemoveLibraryPath
(
g_UserLibDirBuffer
);
wxGetApp
().
RemoveLibraryPath
(
g_UserLibDirBuffer
);
/* Init
des valeurs par defaut
*/
/* Init
ialize default values.
*/
g_LibName_List
.
Clear
();
g_LibName_List
.
Clear
();
wxGetApp
().
ReadProjectConfig
(
fn
.
GetFullPath
(),
wxGetApp
().
ReadProjectConfig
(
fn
.
GetFullPath
(),
...
@@ -217,10 +210,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
...
@@ -217,10 +210,7 @@ bool WinEDA_PcbFrame::Read_Config( const wxString& projectFileName )
}
}
/**********************************************************/
void
WinEDA_PcbFrame
::
Update_config
(
wxWindow
*
displayframe
)
void
WinEDA_PcbFrame
::
Update_config
(
wxWindow
*
displayframe
)
/***********************************************************/
/* enregistrement de la config */
{
{
wxFileName
fn
;
wxFileName
fn
;
...
@@ -234,7 +224,6 @@ void WinEDA_PcbFrame::Update_config( wxWindow* displayframe )
...
@@ -234,7 +224,6 @@ void WinEDA_PcbFrame::Update_config( wxWindow* displayframe )
if
(
dlg
.
ShowModal
()
==
wxID_CANCEL
)
if
(
dlg
.
ShowModal
()
==
wxID_CANCEL
)
return
;
return
;
/* ecriture de la configuration */
wxGetApp
().
WriteProjectConfig
(
fn
.
GetFullPath
(),
wxT
(
"/pcbnew"
),
wxGetApp
().
WriteProjectConfig
(
fn
.
GetFullPath
(),
wxT
(
"/pcbnew"
),
ParamCfgList
);
ParamCfgList
);
}
}
pcbnew/pcbnew_config.h
View file @
1a139a7f
/*****************************************************
*****
/
/*****************************************************/
/** pcbcfg.h : configuration
: definition des structures
**/
/** pcbcfg.h : configuration
parameters for PCBNew
**/
/*****************************************************
*****
/
/*****************************************************/
#include "param_config.h"
#include "param_config.h"
...
@@ -11,712 +11,713 @@
...
@@ -11,712 +11,713 @@
// Flag for member .m_Setup
// Flag for member .m_Setup
// .m_Setup = TRUE: write info in user config
// .m_Setup = TRUE: write info in user config
// (i.e. for all project, in registry base or equivalent)
// (i.e. for all project, in registry base or equivalent)
// .m_Setup = FALSE: write info in project config (i.e. only for this project, in .pro file)
// .m_Setup = FALSE: write info in project config (i.e. only for this
// project, in .pro file)
#define INSETUP TRUE
#define INSETUP TRUE
/*
Liste des parametres
*/
/*
Configuration parameters.
*/
static
PARAM_CFG_WXSTRING
UserLibDirBufCfg
static
PARAM_CFG_WXSTRING
UserLibDirBufCfg
(
(
wxT
(
"LibDir"
),
/* Keyword */
wxT
(
"LibDir"
),
&
g_UserLibDirBuffer
,
/* Parameter address */
&
g_UserLibDirBuffer
,
GROUPLIB
GROUPLIB
);
);
static
PARAM_CFG_LIBNAME_LIST
LibNameBufCfg
static
PARAM_CFG_LIBNAME_LIST
LibNameBufCfg
(
(
wxT
(
"LibName"
),
/* Keyword */
wxT
(
"LibName"
),
&
g_LibName_List
,
/* Parameter address */
&
g_LibName_List
,
GROUPLIB
GROUPLIB
);
);
static
PARAM_CFG_INT
PadDrillCfg
static
PARAM_CFG_INT
PadDrillCfg
(
(
wxT
(
"PadDrlX"
),
/* Keyword */
wxT
(
"PadDrlX"
),
&
g_Pad_Master
.
m_Drill
.
x
,
/* Parameter address */
&
g_Pad_Master
.
m_Drill
.
x
,
320
,
/* Default value */
320
,
0
,
0x7FFF
/* Min and max values*/
0
,
0x7FFF
);
);
static
PARAM_CFG_INT
PadDimHCfg
//Pad Diameter / H Size
static
PARAM_CFG_INT
PadDimHCfg
//Pad Diameter / H Size
(
(
wxT
(
"PadDimH"
),
/* Keyword */
wxT
(
"PadDimH"
),
&
g_Pad_Master
.
m_Size
.
x
,
/* Parameter address */
&
g_Pad_Master
.
m_Size
.
x
,
550
,
/* Default value */
550
,
0
,
0x7FFF
/* Min and max values*/
0
,
0x7FFF
);
);
static
PARAM_CFG_INT
PadDimVCfg
static
PARAM_CFG_INT
PadDimVCfg
(
(
wxT
(
"PadDimV"
),
/* Keyword */
wxT
(
"PadDimV"
),
&
g_Pad_Master
.
m_Size
.
y
,
/* Parameter address */
&
g_Pad_Master
.
m_Size
.
y
,
550
,
/* Default value */
550
,
0
,
0x7FFF
/* Min and max values*/
0
,
0x7FFF
);
);
static
PARAM_CFG_INT
LayerThicknessCfg
static
PARAM_CFG_INT
LayerThicknessCfg
(
(
wxT
(
"LayerThickness"
),
/* Keyword */
wxT
(
"LayerThickness"
),
&
g_DesignSettings
.
m_LayerThickness
,
/* Parameter address */
&
g_DesignSettings
.
m_LayerThickness
,
630
,
/* Default value */
630
,
0
,
0xFFFF
/* Min and max values*/
0
,
0xFFFF
);
);
static
PARAM_CFG_INT
ViaShowHoleCfg
static
PARAM_CFG_INT
ViaShowHoleCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ViaSHole"
),
/* Keyword */
wxT
(
"ViaSHole"
),
&
DisplayOpt
.
m_DisplayViaMode
,
/* Parameter address */
&
DisplayOpt
.
m_DisplayViaMode
,
VIA_SPECIAL_HOLE_SHOW
,
/* Default value */
VIA_SPECIAL_HOLE_SHOW
,
VIA_HOLE_NOT_SHOW
,
/* Min and max values*/
VIA_HOLE_NOT_SHOW
,
OPT_VIA_HOLE_END
-
1
/* Min and max values*/
OPT_VIA_HOLE_END
-
1
);
);
static
PARAM_CFG_INT
ShowNetNamesModeCfg
static
PARAM_CFG_INT
ShowNetNamesModeCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ShowNetNamesMode"
),
/* Keyword */
wxT
(
"ShowNetNamesMode"
),
&
DisplayOpt
.
DisplayNetNamesMode
,
/* Parameter address */
&
DisplayOpt
.
DisplayNetNamesMode
,
3
,
/* Default value */
3
,
0
,
/* Min and max values*/
0
,
3
/* Min and max values*/
3
);
);
static
PARAM_CFG_INT
RouteLayTopCfg
// First current working layer
static
PARAM_CFG_INT
RouteLayTopCfg
// First current working layer
(
(
wxT
(
"RouteTo"
),
/* Keyword */
wxT
(
"RouteTo"
),
&
Route_Layer_TOP
,
/* Parameter address */
&
Route_Layer_TOP
,
15
,
/* Default value */
15
,
0
,
15
/* Min and max values*/
0
,
15
);
);
static
PARAM_CFG_INT
RouteLayBotCfg
// second current working layer
static
PARAM_CFG_INT
RouteLayBotCfg
// second current working layer
(
(
wxT
(
"RouteBo"
),
/* Keyword */
wxT
(
"RouteBo"
),
&
Route_Layer_BOTTOM
,
/* Parameter address */
&
Route_Layer_BOTTOM
,
0
,
/* Default value */
0
,
0
,
15
/* Min and max values*/
0
,
15
);
);
static
PARAM_CFG_BOOL
Segm45Cfg
//
Segm Pistes a 0, 45, 90 degres uniquement
static
PARAM_CFG_BOOL
Segm45Cfg
//
0, 90, and 45 degrees are the only
(
(
// valid segment orientations.
wxT
(
"Segm45"
),
/* Keyword */
wxT
(
"Segm45"
),
&
Track_45_Only
,
/* Parameter address */
&
Track_45_Only
,
TRUE
/* Default value */
TRUE
);
);
static
PARAM_CFG_BOOL
Raccord45Cfg
// Generat
ion automatique des Raccords a 45 degr
es
static
PARAM_CFG_BOOL
Raccord45Cfg
// Generat
e connections at 45 degre
es
(
(
// only.
wxT
(
"Racc45"
),
/* Keyword */
wxT
(
"Racc45"
),
&
g_Raccord_45_Auto
,
/* Parameter address */
&
g_Raccord_45_Auto
,
TRUE
/* Default value */
TRUE
);
);
static
PARAM_CFG_INT
UnitCfg
// Units: 0 inch, 1 mm
static
PARAM_CFG_INT
UnitCfg
// Units: 0 inch, 1 mm
(
(
INSETUP
,
INSETUP
,
wxT
(
"Unite"
),
/* Keyword */
wxT
(
"Unite"
),
&
g_UnitMetric
,
/* Parameter address */
&
g_UnitMetric
,
FALSE
/* Default value */
FALSE
);
);
static
PARAM_CFG_BOOL
SegmFillCfg
static
PARAM_CFG_BOOL
SegmFillCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"SegFill"
),
/* Keyword */
wxT
(
"SegFill"
),
&
DisplayOpt
.
DisplayPcbTrackFill
,
/* Parameter address */
&
DisplayOpt
.
DisplayPcbTrackFill
,
TRUE
/* Default value */
TRUE
);
);
static
PARAM_CFG_INT
TrackDisplayClearanceCfg
static
PARAM_CFG_INT
TrackDisplayClearanceCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"TrackDisplayClearance"
),
/* Keyword */
wxT
(
"TrackDisplayClearance"
),
&
DisplayOpt
.
ShowTrackClearanceMode
,
/* Parameter address */
&
DisplayOpt
.
ShowTrackClearanceMode
,
SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS
/* Default value */
SHOW_CLEARANCE_NEW_TRACKS_AND_VIA_AREAS
);
);
static
PARAM_CFG_BOOL
PadFillCfg
static
PARAM_CFG_BOOL
PadFillCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"PadFill"
),
/* Keyword */
wxT
(
"PadFill"
),
&
DisplayOpt
.
DisplayPadFill
,
/* Parameter address */
&
DisplayOpt
.
DisplayPadFill
,
TRUE
/* Default value */
TRUE
);
);
static
PARAM_CFG_BOOL
ViaFillCfg
static
PARAM_CFG_BOOL
ViaFillCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ViaFill"
),
/* Keyword */
wxT
(
"ViaFill"
),
&
DisplayOpt
.
DisplayViaFill
,
/* Parameter address */
&
DisplayOpt
.
DisplayViaFill
,
TRUE
/* Default value */
TRUE
);
);
static
PARAM_CFG_BOOL
PadAfficheGardeCfg
static
PARAM_CFG_BOOL
PadAfficheGardeCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"PadAffG"
),
/* Keyword */
wxT
(
"PadAffG"
),
&
DisplayOpt
.
DisplayPadIsol
,
/* Parameter address */
&
DisplayOpt
.
DisplayPadIsol
,
TRUE
/* Default value */
TRUE
);
);
static
PARAM_CFG_BOOL
PadShowNumCfg
static
PARAM_CFG_BOOL
PadShowNumCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"PadSNum"
),
/* Keyword */
wxT
(
"PadSNum"
),
&
DisplayOpt
.
DisplayPadNum
,
/* Parameter address */
&
DisplayOpt
.
DisplayPadNum
,
TRUE
/* Default value */
TRUE
);
);
static
PARAM_CFG_INT
AfficheContourModuleCfg
// Module Edges: fill/line/sketch
static
PARAM_CFG_INT
AfficheContourModuleCfg
// Module Edges: fill/line/sketch
(
(
INSETUP
,
INSETUP
,
wxT
(
"ModAffC"
),
/* Keyword */
wxT
(
"ModAffC"
),
&
DisplayOpt
.
DisplayModEdge
,
/* Parameter address */
&
DisplayOpt
.
DisplayModEdge
,
FILLED
,
/* Default value */
FILLED
,
0
,
2
/* Min and max values*/
0
,
2
);
);
static
PARAM_CFG_INT
AfficheTexteModuleCfg
// Module Texts: fill/line/sketch
static
PARAM_CFG_INT
AfficheTexteModuleCfg
// Module Texts: fill/line/sketch
(
(
INSETUP
,
INSETUP
,
wxT
(
"ModAffT"
),
/* Keyword */
wxT
(
"ModAffT"
),
&
DisplayOpt
.
DisplayModText
,
/* Parameter address */
&
DisplayOpt
.
DisplayModText
,
FILLED
,
/* Default value */
FILLED
,
0
,
2
/* Min and max values*/
0
,
2
);
);
static
PARAM_CFG_INT
AffichePcbTextCfg
// PCB Texts: fill/line/sketch
static
PARAM_CFG_INT
AffichePcbTextCfg
// PCB Texts: fill/line/sketch
(
(
INSETUP
,
INSETUP
,
wxT
(
"PcbAffT"
),
/* Keyword */
wxT
(
"PcbAffT"
),
&
DisplayOpt
.
DisplayDrawItems
,
/* Parameter address */
&
DisplayOpt
.
DisplayDrawItems
,
FILLED
,
/* Default value */
FILLED
,
0
,
2
/* Min and max values*/
0
,
2
);
);
static
PARAM_CFG_BOOL
SegmPcb45Cfg
// Force 45 degrees for segments
static
PARAM_CFG_BOOL
SegmPcb45Cfg
// Force 45 degrees for segments
(
(
wxT
(
"SgPcb45"
),
/* Keyword */
wxT
(
"SgPcb45"
),
&
Segments_45_Only
,
/* Parameter address */
&
Segments_45_Only
,
TRUE
/* Default value */
TRUE
);
);
static
PARAM_CFG_INT
PcbTextDimVCfg
static
PARAM_CFG_INT
PcbTextDimVCfg
(
(
wxT
(
"TxtPcbV"
),
/* Keyword */
wxT
(
"TxtPcbV"
),
&
g_DesignSettings
.
m_PcbTextSize
.
y
,
/* Parameter address */
&
g_DesignSettings
.
m_PcbTextSize
.
y
,
600
,
/* Default value */
600
,
TEXTS_MIN_SIZE
,
TEXTS_MAX_SIZE
/* Min and max values*/
TEXTS_MIN_SIZE
,
TEXTS_MAX_SIZE
);
);
static
PARAM_CFG_INT
PcbTextDimHCfg
static
PARAM_CFG_INT
PcbTextDimHCfg
(
(
wxT
(
"TxtPcbH"
),
/* Keyword */
wxT
(
"TxtPcbH"
),
&
g_DesignSettings
.
m_PcbTextSize
.
x
,
/* Parameter address */
&
g_DesignSettings
.
m_PcbTextSize
.
x
,
600
,
/* Default value */
600
,
TEXTS_MIN_SIZE
,
TEXTS_MAX_SIZE
/* Min and max values*/
TEXTS_MIN_SIZE
,
TEXTS_MAX_SIZE
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer0Cfg
// CU Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer0Cfg
// CU Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLay0"
),
/* Keyword */
wxT
(
"ColLay0"
),
&
g_DesignSettings
.
m_LayerColor
[
0
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
0
],
GREEN
/* Default value */
GREEN
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer1Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer1Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLay1"
),
/* Keyword */
wxT
(
"ColLay1"
),
&
g_DesignSettings
.
m_LayerColor
[
1
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
1
],
BLUE
/* Default value */
BLUE
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer2Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer2Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLay2"
),
/* Keyword */
wxT
(
"ColLay2"
),
&
g_DesignSettings
.
m_LayerColor
[
2
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
2
],
LIGHTGRAY
/* Default value */
LIGHTGRAY
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer3Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer3Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLay3"
),
/* Keyword */
wxT
(
"ColLay3"
),
&
g_DesignSettings
.
m_LayerColor
[
3
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
3
],
5
/* Default value */
5
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer4Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer4Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLay4"
),
/* Keyword */
wxT
(
"ColLay4"
),
&
g_DesignSettings
.
m_LayerColor
[
4
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
4
],
4
/* Default value */
4
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer5Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer5Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLay5"
),
/* Keyword */
wxT
(
"ColLay5"
),
&
g_DesignSettings
.
m_LayerColor
[
5
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
5
],
5
/* Default value */
5
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer6Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer6Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLay6"
),
/* Keyword */
wxT
(
"ColLay6"
),
&
g_DesignSettings
.
m_LayerColor
[
6
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
6
],
6
/* Default value */
6
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer7Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer7Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLay7"
),
/* Keyword */
wxT
(
"ColLay7"
),
&
g_DesignSettings
.
m_LayerColor
[
7
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
7
],
5
/* Default value */
5
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer8Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer8Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLay8"
),
/* Keyword */
wxT
(
"ColLay8"
),
&
g_DesignSettings
.
m_LayerColor
[
8
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
8
],
7
/* Default value */
7
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer9Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer9Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLay9"
),
/* Keyword */
wxT
(
"ColLay9"
),
&
g_DesignSettings
.
m_LayerColor
[
9
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
9
],
1
/* Default value */
1
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer10Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer10Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayA"
),
/* Keyword */
wxT
(
"ColLayA"
),
&
g_DesignSettings
.
m_LayerColor
[
10
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
10
],
2
/* Default value */
2
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer11Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer11Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayB"
),
/* Keyword */
wxT
(
"ColLayB"
),
&
g_DesignSettings
.
m_LayerColor
[
11
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
11
],
3
/* Default value */
3
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer12Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer12Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayC"
),
/* Keyword */
wxT
(
"ColLayC"
),
&
g_DesignSettings
.
m_LayerColor
[
12
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
12
],
12
/* Default value */
12
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer13Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer13Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayD"
),
/* Keyword */
wxT
(
"ColLayD"
),
&
g_DesignSettings
.
m_LayerColor
[
13
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
13
],
13
/* Default value */
13
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer14Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer14Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayE"
),
/* Keyword */
wxT
(
"ColLayE"
),
&
g_DesignSettings
.
m_LayerColor
[
14
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
14
],
14
/* Default value */
14
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer15Cfg
// CMP Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer15Cfg
// CMP Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayF"
),
/* Keyword */
wxT
(
"ColLayF"
),
&
g_DesignSettings
.
m_LayerColor
[
15
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
15
],
RED
/* Default value */
RED
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer16Cfg
// Adhesive CU Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer16Cfg
// Adhesive CU Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayG"
),
/* Keyword */
wxT
(
"ColLayG"
),
&
g_DesignSettings
.
m_LayerColor
[
16
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
16
],
1
/* Default value */
1
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer17Cfg
// Adhesive CMP Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer17Cfg
// Adhesive CMP Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayH"
),
/* Keyword */
wxT
(
"ColLayH"
),
&
g_DesignSettings
.
m_LayerColor
[
17
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
17
],
5
/* Default value */
5
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer18Cfg
// Solder Mask CU Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer18Cfg
// Solder Mask CU Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayI"
),
/* Keyword */
wxT
(
"ColLayI"
),
&
g_DesignSettings
.
m_LayerColor
[
18
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
18
],
11
/* Default value */
11
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer19Cfg
// Solder Mask CMP Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer19Cfg
// Solder Mask CMP Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayJ"
),
/* Keyword */
wxT
(
"ColLayJ"
),
&
g_DesignSettings
.
m_LayerColor
[
19
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
19
],
4
/* Default value */
4
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer20Cfg
// Silk Screen CU Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer20Cfg
// Silk Screen CU Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayK"
),
/* Keyword */
wxT
(
"ColLayK"
),
&
g_DesignSettings
.
m_LayerColor
[
20
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
20
],
5
/* Default value */
5
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer21Cfg
// Silk Screen CMP Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer21Cfg
// Silk Screen CMP Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayL"
),
/* Keyword */
wxT
(
"ColLayL"
),
&
g_DesignSettings
.
m_LayerColor
[
21
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
21
],
3
/* Default value */
3
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer22Cfg
// Mask CU Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer22Cfg
// Mask CU Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayM"
),
/* Keyword */
wxT
(
"ColLayM"
),
&
g_DesignSettings
.
m_LayerColor
[
22
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
22
],
6
/* Default value */
6
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer23Cfg
// Mask CMP Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer23Cfg
// Mask CMP Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayN"
),
/* Keyword */
wxT
(
"ColLayN"
),
&
g_DesignSettings
.
m_LayerColor
[
23
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
23
],
5
/* Default value */
5
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer24Cfg
// DRAW Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer24Cfg
// DRAW Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayO"
),
/* Keyword */
wxT
(
"ColLayO"
),
&
g_DesignSettings
.
m_LayerColor
[
24
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
24
],
LIGHTGRAY
/* Default value */
LIGHTGRAY
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer25Cfg
// Comment Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer25Cfg
// Comment Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayP"
),
/* Keyword */
wxT
(
"ColLayP"
),
&
g_DesignSettings
.
m_LayerColor
[
25
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
25
],
1
/* Default value */
1
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer26Cfg
// ECO1 Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer26Cfg
// ECO1 Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayQ"
),
/* Keyword */
wxT
(
"ColLayQ"
),
&
g_DesignSettings
.
m_LayerColor
[
26
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
26
],
2
/* Default value */
2
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer27Cfg
//ECO2 Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer27Cfg
//ECO2 Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayR"
),
/* Keyword */
wxT
(
"ColLayR"
),
&
g_DesignSettings
.
m_LayerColor
[
27
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
27
],
14
/* Default value */
14
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer28Cfg
// EDGES Layer Color
static
PARAM_CFG_SETCOLOR
ColorLayer28Cfg
// EDGES Layer Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayS"
),
/* Keyword */
wxT
(
"ColLayS"
),
&
g_DesignSettings
.
m_LayerColor
[
28
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
28
],
YELLOW
/* Default value */
YELLOW
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer29Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer29Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayT"
),
/* Keyword */
wxT
(
"ColLayT"
),
&
g_DesignSettings
.
m_LayerColor
[
29
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
29
],
13
/* Default value */
13
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer30Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer30Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayU"
),
/* Keyword */
wxT
(
"ColLayU"
),
&
g_DesignSettings
.
m_LayerColor
[
30
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
30
],
14
/* Default value */
14
);
);
static
PARAM_CFG_SETCOLOR
ColorLayer31Cfg
static
PARAM_CFG_SETCOLOR
ColorLayer31Cfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ColLayV"
),
/* Keyword */
wxT
(
"ColLayV"
),
&
g_DesignSettings
.
m_LayerColor
[
31
],
/* Parameter address */
&
g_DesignSettings
.
m_LayerColor
[
31
],
7
/* Default value */
7
);
);
static
PARAM_CFG_SETCOLOR
ColorTxtModCmpCfg
static
PARAM_CFG_SETCOLOR
ColorTxtModCmpCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"CTxtMoC"
),
/* Keyword */
wxT
(
"CTxtMoC"
),
&
g_ModuleTextCMPColor
,
/* Parameter address */
&
g_ModuleTextCMPColor
,
LIGHTGRAY
/* Default value */
LIGHTGRAY
);
);
static
PARAM_CFG_SETCOLOR
ColorTxtModCuCfg
static
PARAM_CFG_SETCOLOR
ColorTxtModCuCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"CTxtMoS"
),
/* Keyword */
wxT
(
"CTxtMoS"
),
&
g_ModuleTextCUColor
,
/* Parameter address */
&
g_ModuleTextCUColor
,
1
/* Default value */
1
);
);
static
PARAM_CFG_SETCOLOR
VisibleTxtModCfg
static
PARAM_CFG_SETCOLOR
VisibleTxtModCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"CTxtVis"
),
/* Keyword */
wxT
(
"CTxtVis"
),
&
g_ModuleTextNOVColor
,
/* Parameter address */
&
g_ModuleTextNOVColor
,
DARKGRAY
/* Default value */
DARKGRAY
);
);
static
PARAM_CFG_INT
TexteModDimVCfg
static
PARAM_CFG_INT
TexteModDimVCfg
(
(
wxT
(
"TxtModV"
),
/* Keyword */
wxT
(
"TxtModV"
),
&
ModuleTextSize
.
y
,
/* Parameter address */
&
ModuleTextSize
.
y
,
500
,
/* Default value */
500
,
TEXTS_MIN_SIZE
,
TEXTS_MAX_SIZE
/* Min and max values*/
TEXTS_MIN_SIZE
,
TEXTS_MAX_SIZE
);
);
static
PARAM_CFG_INT
TexteModDimHCfg
static
PARAM_CFG_INT
TexteModDimHCfg
(
(
wxT
(
"TxtModH"
),
/* Keyword */
wxT
(
"TxtModH"
),
&
ModuleTextSize
.
x
,
/* Parameter address */
&
ModuleTextSize
.
x
,
500
,
/* Default value */
500
,
TEXTS_MIN_SIZE
,
TEXTS_MAX_SIZE
/* Min and max values*/
TEXTS_MIN_SIZE
,
TEXTS_MAX_SIZE
);
);
static
PARAM_CFG_INT
TexteModWidthCfg
static
PARAM_CFG_INT
TexteModWidthCfg
(
(
wxT
(
"TxtModW"
),
/* Keyword */
wxT
(
"TxtModW"
),
&
ModuleTextWidth
,
/* Parameter address */
&
ModuleTextWidth
,
100
,
/* Default value */
100
,
1
,
TEXTS_MAX_WIDTH
/* Min and max values*/
1
,
TEXTS_MAX_WIDTH
);
);
static
PARAM_CFG_SETCOLOR
ColorAncreModCfg
static
PARAM_CFG_SETCOLOR
ColorAncreModCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"CAncreM"
),
/* Keyword */
wxT
(
"CAncreM"
),
&
g_AnchorColor
,
/* Parameter address */
&
g_AnchorColor
,
BLUE
/* Default value */
BLUE
);
);
static
PARAM_CFG_SETCOLOR
ColorPadCuCfg
static
PARAM_CFG_SETCOLOR
ColorPadCuCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"CoPadCu"
),
/* Keyword */
wxT
(
"CoPadCu"
),
&
g_PadCUColor
,
/* Parameter address */
&
g_PadCUColor
,
GREEN
/* Default value */
GREEN
);
);
static
PARAM_CFG_SETCOLOR
ColorPadCmpCfg
static
PARAM_CFG_SETCOLOR
ColorPadCmpCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"CoPadCm"
),
/* Keyword */
wxT
(
"CoPadCm"
),
&
g_PadCMPColor
,
/* Parameter address */
&
g_PadCMPColor
,
RED
/* Default value */
RED
);
);
static
PARAM_CFG_SETCOLOR
ColorViaThroughCfg
static
PARAM_CFG_SETCOLOR
ColorViaThroughCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"CoViaTh"
),
/* Keyword */
wxT
(
"CoViaTh"
),
&
g_DesignSettings
.
m_ViaColor
[
VIA_THROUGH
],
/* Parameter address */
&
g_DesignSettings
.
m_ViaColor
[
VIA_THROUGH
],
LIGHTGRAY
/* Default value */
LIGHTGRAY
);
);
static
PARAM_CFG_SETCOLOR
ColorViaBlindBuriedCfg
static
PARAM_CFG_SETCOLOR
ColorViaBlindBuriedCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"CoViaBu"
),
/* Keyword */
wxT
(
"CoViaBu"
),
&
g_DesignSettings
.
m_ViaColor
[
VIA_BLIND_BURIED
],
/* Parameter address */
&
g_DesignSettings
.
m_ViaColor
[
VIA_BLIND_BURIED
],
BROWN
/* Default value */
BROWN
);
);
static
PARAM_CFG_SETCOLOR
ColorViaMicroViaCfg
// Buried Via Color
static
PARAM_CFG_SETCOLOR
ColorViaMicroViaCfg
// Buried Via Color
(
(
INSETUP
,
INSETUP
,
wxT
(
"CoViaMi"
),
/* Keyword */
wxT
(
"CoViaMi"
),
&
g_DesignSettings
.
m_ViaColor
[
VIA_MICROVIA
],
/* Parameter address */
&
g_DesignSettings
.
m_ViaColor
[
VIA_MICROVIA
],
CYAN
/* Default value */
CYAN
);
);
static
PARAM_CFG_SETCOLOR
ColorpcbGrilleCfg
static
PARAM_CFG_SETCOLOR
ColorpcbGrilleCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"CoPcbGr"
),
/* Keyword */
wxT
(
"CoPcbGr"
),
&
g_GridColor
,
/* Parameter address */
&
g_GridColor
,
DARKGRAY
/* Default value */
DARKGRAY
);
);
static
PARAM_CFG_SETCOLOR
ColorCheveluCfg
static
PARAM_CFG_SETCOLOR
ColorCheveluCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"CoRatsN"
),
/* Keyword */
wxT
(
"CoRatsN"
),
&
g_DesignSettings
.
m_RatsnestColor
,
/* Parameter address */
&
g_DesignSettings
.
m_RatsnestColor
,
WHITE
/* Default value */
WHITE
);
);
static
PARAM_CFG_INT
HPGLpenNumCfg
static
PARAM_CFG_INT
HPGLpenNumCfg
(
(
wxT
(
"HPGLnum"
),
/* Keyword */
wxT
(
"HPGLnum"
),
&
g_pcb_plot_options
.
HPGL_Pen_Num
,
/* Parameter address */
&
g_pcb_plot_options
.
HPGL_Pen_Num
,
1
,
/* Default value */
1
,
1
,
16
/* Min and max values*/
1
,
16
);
);
static
PARAM_CFG_INT
HPGLdiamCfg
// HPGL pen size (mils)
static
PARAM_CFG_INT
HPGLdiamCfg
// HPGL pen size (mils)
(
(
wxT
(
"HPGdiam"
),
/* Keyword */
wxT
(
"HPGdiam"
),
&
g_pcb_plot_options
.
HPGL_Pen_Diam
,
/* Parameter address */
&
g_pcb_plot_options
.
HPGL_Pen_Diam
,
15
,
/* Default value */
15
,
0
,
100
/* Min and max values*/
0
,
100
);
);
static
PARAM_CFG_INT
HPGLspeedCfg
//HPGL pen speed (cm/s)
static
PARAM_CFG_INT
HPGLspeedCfg
//HPGL pen speed (cm/s)
(
(
wxT
(
"HPGLSpd"
),
/* Keyword */
wxT
(
"HPGLSpd"
),
&
g_pcb_plot_options
.
HPGL_Pen_Speed
,
/* Parameter address */
&
g_pcb_plot_options
.
HPGL_Pen_Speed
,
20
,
/* Default value */
20
,
0
,
1000
/* Min and max values*/
0
,
1000
);
);
static
PARAM_CFG_INT
HPGLrecouvrementCfg
static
PARAM_CFG_INT
HPGLrecouvrementCfg
(
(
wxT
(
"HPGLrec"
),
/* Keyword */
wxT
(
"HPGLrec"
),
&
g_pcb_plot_options
.
HPGL_Pen_Recouvrement
,
/* Parameter address */
&
g_pcb_plot_options
.
HPGL_Pen_Recouvrement
,
2
,
/* Default value */
2
,
0
,
0x100
/* Min and max values*/
0
,
0x100
);
);
static
PARAM_CFG_INT
VernisEpargneGardeCfg
static
PARAM_CFG_INT
VernisEpargneGardeCfg
(
(
wxT
(
"VEgarde"
),
/* Keyword */
wxT
(
"VEgarde"
),
&
g_DesignSettings
.
m_SolderMaskMargin
,
/* Parameter address */
&
g_DesignSettings
.
m_SolderMaskMargin
,
100
,
/* Default value */
100
,
0
,
10000
/* Min and max values*/
0
,
10000
);
);
static
PARAM_CFG_INT
DrawSegmLargeurCfg
static
PARAM_CFG_INT
DrawSegmLargeurCfg
(
(
wxT
(
"DrawLar"
),
/* Keyword */
wxT
(
"DrawLar"
),
&
g_DesignSettings
.
m_DrawSegmentWidth
,
/* Parameter address */
&
g_DesignSettings
.
m_DrawSegmentWidth
,
120
,
/* Default value */
120
,
0
,
0xFFFF
/* Min and max values*/
0
,
0xFFFF
);
);
static
PARAM_CFG_INT
EdgeSegmLargeurCfg
static
PARAM_CFG_INT
EdgeSegmLargeurCfg
(
(
wxT
(
"EdgeLar"
),
/* Keyword */
wxT
(
"EdgeLar"
),
&
g_DesignSettings
.
m_EdgeSegmentWidth
,
/* Parameter address */
&
g_DesignSettings
.
m_EdgeSegmentWidth
,
120
,
/* Default value */
120
,
0
,
0xFFFF
/* Min and max values*/
0
,
0xFFFF
);
);
static
PARAM_CFG_INT
TexteSegmLargeurCfg
static
PARAM_CFG_INT
TexteSegmLargeurCfg
(
(
wxT
(
"TxtLar"
),
/* Keyword */
wxT
(
"TxtLar"
),
&
g_DesignSettings
.
m_PcbTextWidth
,
/* Parameter address */
&
g_DesignSettings
.
m_PcbTextWidth
,
120
,
/* Default value */
120
,
0
,
0xFFFF
/* Min and max values*/
0
,
0xFFFF
);
);
static
PARAM_CFG_INT
ModuleSegmWidthCfg
static
PARAM_CFG_INT
ModuleSegmWidthCfg
(
(
wxT
(
"MSegLar"
),
/* Keyword */
wxT
(
"MSegLar"
),
&
ModuleSegmentWidth
,
/* Parameter address */
&
ModuleSegmentWidth
,
120
,
/* Default value */
120
,
0
,
0xFFFF
/* Min and max values*/
0
,
0xFFFF
);
);
static
PARAM_CFG_INT
WTraitSerigraphiePlotCfg
static
PARAM_CFG_INT
WTraitSerigraphiePlotCfg
(
(
wxT
(
"WpenSer"
),
/* Keyword */
wxT
(
"WpenSer"
),
&
g_pcb_plot_options
.
PlotLine_Width
,
/* Parameter address */
&
g_pcb_plot_options
.
PlotLine_Width
,
10
,
/* Default value */
10
,
1
,
10000
/* Min and max values*/
1
,
10000
);
);
static
PARAM_CFG_INT
TimeOutCfg
//
Duree entre Sauvegardes auto en secondes
static
PARAM_CFG_INT
TimeOutCfg
//
Automatic backup duration time in
(
(
// seconds.
INSETUP
,
INSETUP
,
wxT
(
"TimeOut"
),
/* Keyword */
wxT
(
"TimeOut"
),
&
g_TimeOut
,
/* Parameter address */
&
g_TimeOut
,
600
,
/* Default value */
600
,
0
,
60000
/* Min and max values*/
0
,
60000
);
);
static
PARAM_CFG_BOOL
DisplPolairCfg
static
PARAM_CFG_BOOL
DisplPolairCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"DPolair"
),
/* Keyword */
wxT
(
"DPolair"
),
&
DisplayOpt
.
DisplayPolarCood
,
/* Parameter address */
&
DisplayOpt
.
DisplayPolarCood
,
FALSE
/* Default value */
FALSE
);
);
static
PARAM_CFG_INT
PrmMaxLinksShowed
static
PARAM_CFG_INT
PrmMaxLinksShowed
(
(
INSETUP
,
INSETUP
,
wxT
(
"MaxLnkS"
),
/* Keyword */
wxT
(
"MaxLnkS"
),
&
g_MaxLinksShowed
,
/* Parameter address */
&
g_MaxLinksShowed
,
3
,
/* Default value */
3
,
0
,
15
/* Min and max values*/
0
,
15
);
);
static
PARAM_CFG_BOOL
ShowRatsnestCfg
static
PARAM_CFG_BOOL
ShowRatsnestCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ShowRat"
),
/* Keyword */
wxT
(
"ShowRat"
),
&
g_Show_Ratsnest
,
/* Parameter address */
&
g_Show_Ratsnest
,
FALSE
/* Default value */
FALSE
);
);
static
PARAM_CFG_BOOL
ShowModuleRatsnestCfg
static
PARAM_CFG_BOOL
ShowModuleRatsnestCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"ShowMRa"
),
/* Keyword */
wxT
(
"ShowMRa"
),
&
g_Show_Module_Ratsnest
,
/* Parameter address */
&
g_Show_Module_Ratsnest
,
TRUE
/* Default value */
TRUE
);
);
static
PARAM_CFG_BOOL
TwoSegmentTrackBuildCfg
static
PARAM_CFG_BOOL
TwoSegmentTrackBuildCfg
(
(
INSETUP
,
INSETUP
,
wxT
(
"TwoSegT"
),
/* Keyword */
wxT
(
"TwoSegT"
),
&
g_TwoSegmentTrackBuild
,
/* Parameter address */
&
g_TwoSegmentTrackBuild
,
TRUE
/* Default value */
TRUE
);
);
...
...
pcbnew/pcbplot.cpp
View file @
1a139a7f
/***************
********
/
/***************/
/*
fichier
pcbplot.cpp */
/* pcbplot.cpp */
/***************
********
/
/***************/
#include "fctsys.h"
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "appl_wxstruct.h"
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
#define OPTKEY_ALWAYS_PRINT_PADS wxT( "PlotAlwaysPads" )
#define OPTKEY_ALWAYS_PRINT_PADS wxT( "PlotAlwaysPads" )
#define OPTKEY_OUTPUT_FORMAT wxT( "PlotOutputFormat" )
#define OPTKEY_OUTPUT_FORMAT wxT( "PlotOutputFormat" )
// Define min
et max reason
nable values for print scale
// Define min
and max reaso
nable values for print scale
#define MIN_SCALE 0.01
#define MIN_SCALE 0.01
#define MAX_SCALE 100.0
#define MAX_SCALE 100.0
...
@@ -231,25 +231,24 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
...
@@ -231,25 +231,24 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
if
(
config
)
if
(
config
)
{
{
config
->
Read
(
OPTKEY_OUTPUT_FORMAT
,
&
g_pcb_plot_options
.
PlotFormat
);
config
->
Read
(
OPTKEY_OUTPUT_FORMAT
,
&
g_pcb_plot_options
.
PlotFormat
);
config
->
Read
(
OPTKEY_PLOT_LINEWIDTH_VALUE
,
&
g_pcb_plot_options
.
PlotLine_Width
);
config
->
Read
(
OPTKEY_PLOT_LINEWIDTH_VALUE
,
&
g_pcb_plot_options
.
PlotLine_Width
);
}
}
m_PlotFormatOpt
->
SetSelection
(
g_pcb_plot_options
.
PlotFormat
);
m_PlotFormatOpt
->
SetSelection
(
g_pcb_plot_options
.
PlotFormat
);
// Creation des menus d'option du format HPGL
m_HPGL_OptionsBox
=
new
wxStaticBox
(
this
,
wxID_ANY
,
_
(
"HPGL Options:"
)
);
m_HPGL_OptionsBox
=
new
wxStaticBox
(
this
,
wxID_ANY
,
_
(
"HPGL Options:"
)
);
wxStaticBoxSizer
*
HPGL_OptionsBoxSizer
=
wxStaticBoxSizer
*
HPGL_OptionsBoxSizer
=
new
wxStaticBoxSizer
(
m_HPGL_OptionsBox
,
wxVERTICAL
);
new
wxStaticBoxSizer
(
m_HPGL_OptionsBox
,
wxVERTICAL
);
MidRightBoxSizer
->
Add
(
HPGL_OptionsBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
MidRightBoxSizer
->
Add
(
HPGL_OptionsBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
m_HPGLPenSizeOpt
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Pen
S
ize"
),
m_HPGLPenSizeOpt
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Pen
s
ize"
),
g_pcb_plot_options
.
HPGL_Pen_Diam
,
g_pcb_plot_options
.
HPGL_Pen_Diam
,
g_UnitMetric
,
g_UnitMetric
,
HPGL_OptionsBoxSizer
,
HPGL_OptionsBoxSizer
,
UNITS_MILS
);
UNITS_MILS
);
//
unites standards = cm pour vitesse plume en HPGL
//
Set units to cm for standard HPGL pen speed.
m_HPGLPenSpeedOpt
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Pen Speed (cm/s)"
),
m_HPGLPenSpeedOpt
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Pen Speed (cm/s)"
),
g_pcb_plot_options
.
HPGL_Pen_Speed
,
CENTIMETRE
,
g_pcb_plot_options
.
HPGL_Pen_Speed
,
CENTIMETRE
,
HPGL_OptionsBoxSizer
,
1
);
HPGL_OptionsBoxSizer
,
1
);
...
@@ -264,7 +263,7 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
...
@@ -264,7 +263,7 @@ void WinEDA_PlotFrame::OnInitDialog( wxInitDialogEvent& event )
m_HPGLPenOverlayOpt
->
SetToolTip
(
_
(
"Set plot overlay for filling"
)
);
m_HPGLPenOverlayOpt
->
SetToolTip
(
_
(
"Set plot overlay for filling"
)
);
m_LinesWidth
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Line
s W
idth"
),
m_LinesWidth
=
new
WinEDA_ValueCtrl
(
this
,
_
(
"Line
w
idth"
),
g_pcb_plot_options
.
PlotLine_Width
,
g_pcb_plot_options
.
PlotLine_Width
,
g_UnitMetric
,
g_UnitMetric
,
MidRightBoxSizer
,
MidRightBoxSizer
,
...
@@ -300,7 +299,7 @@ mode and plot pads outlines on silk screen layers" ) );
...
@@ -300,7 +299,7 @@ mode and plot pads outlines on silk screen layers" ) );
config
->
Read
(
OPTKEY_YFINESCALE_ADJ
,
&
m_YScaleAdjust
);
config
->
Read
(
OPTKEY_YFINESCALE_ADJ
,
&
m_YScaleAdjust
);
}
}
// Test for a reason
n
able scale value. Set to 1 if problem
// Test for a reasonable scale value. Set to 1 if problem
if
(
m_XScaleAdjust
<
MIN_SCALE
||
m_YScaleAdjust
<
MIN_SCALE
if
(
m_XScaleAdjust
<
MIN_SCALE
||
m_YScaleAdjust
<
MIN_SCALE
||
m_XScaleAdjust
>
MAX_SCALE
||
m_YScaleAdjust
>
MAX_SCALE
)
||
m_XScaleAdjust
>
MAX_SCALE
||
m_YScaleAdjust
>
MAX_SCALE
)
m_XScaleAdjust
=
m_YScaleAdjust
=
1.0
;
m_XScaleAdjust
=
m_YScaleAdjust
=
1.0
;
...
@@ -338,7 +337,7 @@ scale plotting" ) );
...
@@ -338,7 +337,7 @@ scale plotting" ) );
button
=
new
wxButton
(
this
,
wxID_CANCEL
,
_
(
"Close"
)
);
button
=
new
wxButton
(
this
,
wxID_CANCEL
,
_
(
"Close"
)
);
RightBoxSizer
->
Add
(
button
,
0
,
wxGROW
|
wxALL
,
5
);
RightBoxSizer
->
Add
(
button
,
0
,
wxGROW
|
wxALL
,
5
);
// Creat
ion de la liste des layers
// Creat
e layer list.
wxBoxSizer
*
OneColumnLayerBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
wxBoxSizer
*
OneColumnLayerBoxSizer
=
new
wxBoxSizer
(
wxVERTICAL
);
LayersBoxSizer
->
Add
(
OneColumnLayerBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
LayersBoxSizer
->
Add
(
OneColumnLayerBoxSizer
,
0
,
wxGROW
|
wxALL
,
5
);
...
@@ -381,18 +380,18 @@ scale plotting" ) );
...
@@ -381,18 +380,18 @@ scale plotting" ) );
m_Exclude_Edges_Pcb
=
new
wxCheckBox
(
this
,
m_Exclude_Edges_Pcb
=
new
wxCheckBox
(
this
,
ID_EXCLUDE_EDGES_PCB
,
ID_EXCLUDE_EDGES_PCB
,
_
(
"Exclude
Edges_Pcb
layer"
)
);
_
(
"Exclude
pcb edge
layer"
)
);
m_Exclude_Edges_Pcb
->
SetValue
(
g_pcb_plot_options
.
Exclude_Edges_Pcb
);
m_Exclude_Edges_Pcb
->
SetValue
(
g_pcb_plot_options
.
Exclude_Edges_Pcb
);
m_Exclude_Edges_Pcb
->
SetToolTip
(
m_Exclude_Edges_Pcb
->
SetToolTip
(
_
(
"Exclude contents of
Edges_Pcb
layer from all other layers"
)
);
_
(
"Exclude contents of
the pcb edge
layer from all other layers"
)
);
LeftBoxSizer
->
Add
(
m_Exclude_Edges_Pcb
,
0
,
wxGROW
|
wxALL
,
1
);
LeftBoxSizer
->
Add
(
m_Exclude_Edges_Pcb
,
0
,
wxGROW
|
wxALL
,
1
);
// Option to plot page references:
// Option to plot page references:
if
(
m_Parent
->
m_Print_Sheet_Ref
)
if
(
m_Parent
->
m_Print_Sheet_Ref
)
{
{
m_Plot_Sheet_Ref
=
new
wxCheckBox
(
this
,
ID_PRINT_REF
,
m_Plot_Sheet_Ref
=
new
wxCheckBox
(
this
,
ID_PRINT_REF
,
_
(
"Print sheet ref"
)
);
_
(
"Print sheet ref
erence
"
)
);
m_Plot_Sheet_Ref
->
SetValue
(
g_pcb_plot_options
.
Plot_Frame_Ref
);
m_Plot_Sheet_Ref
->
SetValue
(
g_pcb_plot_options
.
Plot_Frame_Ref
);
LeftBoxSizer
->
Add
(
m_Plot_Sheet_Ref
,
0
,
wxGROW
|
wxALL
,
1
);
LeftBoxSizer
->
Add
(
m_Plot_Sheet_Ref
,
0
,
wxGROW
|
wxALL
,
1
);
...
@@ -406,7 +405,8 @@ scale plotting" ) );
...
@@ -406,7 +405,8 @@ scale plotting" ) );
_
(
"Print pads on silkscreen"
)
);
_
(
"Print pads on silkscreen"
)
);
if
(
config
)
if
(
config
)
config
->
Read
(
OPTKEY_PADS_ON_SILKSCREEN
,
&
g_pcb_plot_options
.
PlotPadsOnSilkLayer
);
config
->
Read
(
OPTKEY_PADS_ON_SILKSCREEN
,
&
g_pcb_plot_options
.
PlotPadsOnSilkLayer
);
m_Plot_Pads_on_Silkscreen
->
SetValue
(
&
g_pcb_plot_options
.
PlotPadsOnSilkLayer
);
m_Plot_Pads_on_Silkscreen
->
SetValue
(
&
g_pcb_plot_options
.
PlotPadsOnSilkLayer
);
m_Plot_Pads_on_Silkscreen
->
SetToolTip
(
m_Plot_Pads_on_Silkscreen
->
SetToolTip
(
...
@@ -416,7 +416,8 @@ scale plotting" ) );
...
@@ -416,7 +416,8 @@ scale plotting" ) );
m_Force_Plot_Pads
=
new
wxCheckBox
(
this
,
ID_FORCE_PRINT_PAD
,
m_Force_Plot_Pads
=
new
wxCheckBox
(
this
,
ID_FORCE_PRINT_PAD
,
_
(
"Always print pads"
)
);
_
(
"Always print pads"
)
);
if
(
config
)
if
(
config
)
config
->
Read
(
OPTKEY_ALWAYS_PRINT_PADS
,
&
g_pcb_plot_options
.
Plot_Pads_All_Layers
);
config
->
Read
(
OPTKEY_ALWAYS_PRINT_PADS
,
&
g_pcb_plot_options
.
Plot_Pads_All_Layers
);
m_Force_Plot_Pads
->
SetValue
(
g_pcb_plot_options
.
Plot_Pads_All_Layers
);
m_Force_Plot_Pads
->
SetValue
(
g_pcb_plot_options
.
Plot_Pads_All_Layers
);
m_Force_Plot_Pads
->
SetToolTip
(
_
(
"Force print/plot pads on ALL layers"
)
);
m_Force_Plot_Pads
->
SetToolTip
(
_
(
"Force print/plot pads on ALL layers"
)
);
...
@@ -488,8 +489,8 @@ scale plotting" ) );
...
@@ -488,8 +489,8 @@ scale plotting" ) );
m_Scale_Opt
->
SetSelection
(
g_pcb_plot_options
.
PlotScaleOpt
);
m_Scale_Opt
->
SetSelection
(
g_pcb_plot_options
.
PlotScaleOpt
);
MidLeftBoxSizer
->
Add
(
m_Scale_Opt
,
0
,
wxGROW
|
wxALL
,
5
);
MidLeftBoxSizer
->
Add
(
m_Scale_Opt
,
0
,
wxGROW
|
wxALL
,
5
);
static
const
wxString
list_opt3
[
3
]
=
{
_
(
"Line"
),
_
(
"Filled"
),
_
(
static
const
wxString
list_opt3
[
3
]
=
{
_
(
"Line"
),
_
(
"Filled"
),
"Sketch"
)
};
_
(
"Sketch"
)
};
m_PlotModeOpt
=
new
wxRadioBox
(
this
,
ID_PLOT_MODE_OPT
,
_
(
"Plot Mode"
),
m_PlotModeOpt
=
new
wxRadioBox
(
this
,
ID_PLOT_MODE_OPT
,
_
(
"Plot Mode"
),
wxDefaultPosition
,
wxDefaultSize
,
wxDefaultPosition
,
wxDefaultSize
,
...
@@ -545,10 +546,11 @@ void WinEDA_PlotFrame::CreateDrillFile( wxCommandEvent& event )
...
@@ -545,10 +546,11 @@ void WinEDA_PlotFrame::CreateDrillFile( wxCommandEvent& event )
void
WinEDA_PlotFrame
::
OnSetScaleOpt
(
wxCommandEvent
&
event
)
void
WinEDA_PlotFrame
::
OnSetScaleOpt
(
wxCommandEvent
&
event
)
{
{
/* Disable sheet reference for scale != 1:1 */
/* Disable sheet reference for scale != 1:1 */
bool
scale1
=
(
m_Scale_Opt
->
GetSelection
()
==
1
);
bool
scale1
=
(
m_Scale_Opt
->
GetSelection
()
==
1
);
m_Plot_Sheet_Ref
->
Enable
(
scale1
);
m_Plot_Sheet_Ref
->
Enable
(
scale1
);
if
(
!
scale1
)
m_Plot_Sheet_Ref
->
SetValue
(
false
);
if
(
!
scale1
)
m_Plot_Sheet_Ref
->
SetValue
(
false
);
}
}
void
WinEDA_PlotFrame
::
SetCommands
(
wxCommandEvent
&
event
)
void
WinEDA_PlotFrame
::
SetCommands
(
wxCommandEvent
&
event
)
...
@@ -661,7 +663,8 @@ void WinEDA_PlotFrame::SaveOptPlot( wxCommandEvent& event )
...
@@ -661,7 +663,8 @@ void WinEDA_PlotFrame::SaveOptPlot( wxCommandEvent& event )
g_pcb_plot_options
.
Sel_Texte_Invisible
=
m_Plot_Invisible_Text
->
GetValue
();
g_pcb_plot_options
.
Sel_Texte_Invisible
=
m_Plot_Invisible_Text
->
GetValue
();
g_pcb_plot_options
.
PlotScaleOpt
=
m_Scale_Opt
->
GetSelection
();
g_pcb_plot_options
.
PlotScaleOpt
=
m_Scale_Opt
->
GetSelection
();
g_pcb_plot_options
.
DrillShapeOpt
=
(
PCB_Plot_Options
::
DrillShapeOptT
)
m_Drill_Shape_Opt
->
GetSelection
();
g_pcb_plot_options
.
DrillShapeOpt
=
(
PCB_Plot_Options
::
DrillShapeOptT
)
m_Drill_Shape_Opt
->
GetSelection
();
g_pcb_plot_options
.
Plot_Set_MIROIR
=
m_PlotMirorOpt
->
GetValue
();
g_pcb_plot_options
.
Plot_Set_MIROIR
=
m_PlotMirorOpt
->
GetValue
();
if
(
g_pcb_plot_options
.
Plot_Set_MIROIR
)
if
(
g_pcb_plot_options
.
Plot_Set_MIROIR
)
g_pcb_plot_options
.
PlotOrient
=
PLOT_MIROIR
;
g_pcb_plot_options
.
PlotOrient
=
PLOT_MIROIR
;
...
@@ -682,16 +685,19 @@ void WinEDA_PlotFrame::SaveOptPlot( wxCommandEvent& event )
...
@@ -682,16 +685,19 @@ void WinEDA_PlotFrame::SaveOptPlot( wxCommandEvent& event )
if
(
config
)
if
(
config
)
{
{
config
->
Write
(
OPTKEY_EDGELAYER_GERBER
,
g_pcb_plot_options
.
Exclude_Edges_Pcb
);
config
->
Write
(
OPTKEY_EDGELAYER_GERBER
,
g_pcb_plot_options
.
Exclude_Edges_Pcb
);
config
->
Write
(
OPTKEY_XFINESCALE_ADJ
,
m_XScaleAdjust
);
config
->
Write
(
OPTKEY_XFINESCALE_ADJ
,
m_XScaleAdjust
);
config
->
Write
(
OPTKEY_YFINESCALE_ADJ
,
m_YScaleAdjust
);
config
->
Write
(
OPTKEY_YFINESCALE_ADJ
,
m_YScaleAdjust
);
config
->
Write
(
OPTKEY_PADS_ON_SILKSCREEN
,
g_pcb_plot_options
.
PlotPadsOnSilkLayer
);
config
->
Write
(
OPTKEY_PADS_ON_SILKSCREEN
,
config
->
Write
(
OPTKEY_ALWAYS_PRINT_PADS
,
g_pcb_plot_options
.
Plot_Pads_All_Layers
);
g_pcb_plot_options
.
PlotPadsOnSilkLayer
);
config
->
Write
(
OPTKEY_ALWAYS_PRINT_PADS
,
g_pcb_plot_options
.
Plot_Pads_All_Layers
);
int
formatNdx
=
m_PlotFormatOpt
->
GetSelection
();
int
formatNdx
=
m_PlotFormatOpt
->
GetSelection
();
config
->
Write
(
OPTKEY_OUTPUT_FORMAT
,
formatNdx
);
config
->
Write
(
OPTKEY_OUTPUT_FORMAT
,
formatNdx
);
config
->
Write
(
OPTKEY_PLOT_LINEWIDTH_VALUE
,
config
->
Write
(
OPTKEY_PLOT_LINEWIDTH_VALUE
,
g_pcb_plot_options
.
PlotLine_Width
);
g_pcb_plot_options
.
PlotLine_Width
);
wxString
layerKey
;
wxString
layerKey
;
for
(
int
layer
=
0
;
layer
<
NB_LAYERS
;
++
layer
)
for
(
int
layer
=
0
;
layer
<
NB_LAYERS
;
++
layer
)
...
@@ -774,7 +780,7 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
...
@@ -774,7 +780,7 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
break
;
break
;
}
}
// Test for a reason
n
able scale value
// Test for a reasonable scale value
if
(
g_pcb_plot_options
.
Scale
<
MIN_SCALE
)
if
(
g_pcb_plot_options
.
Scale
<
MIN_SCALE
)
DisplayInfoMessage
(
this
,
DisplayInfoMessage
(
this
,
_
(
"Warning: Scale option set to a very small value"
)
);
_
(
"Warning: Scale option set to a very small value"
)
);
...
@@ -795,7 +801,7 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
...
@@ -795,7 +801,7 @@ void WinEDA_PlotFrame::Plot( wxCommandEvent& event )
fn
=
m_Parent
->
GetScreen
()
->
m_FileName
;
fn
=
m_Parent
->
GetScreen
()
->
m_FileName
;
// C
alcul du nom du fichier
// C
reate file name.
fn
.
SetName
(
fn
.
GetName
()
+
wxT
(
"-"
)
+
fn
.
SetName
(
fn
.
GetName
()
+
wxT
(
"-"
)
+
board
->
GetLayerName
(
layer_to_plot
)
);
board
->
GetLayerName
(
layer_to_plot
)
);
fn
.
SetExt
(
ext
);
fn
.
SetExt
(
ext
);
...
...
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