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