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
8ec8cf3f
Commit
8ec8cf3f
authored
Jul 25, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rework on undo/redo and block functions
parent
6d14766e
Changes
35
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
1233 additions
and
1408 deletions
+1233
-1408
CHANGELOG.txt
CHANGELOG.txt
+8
-0
block_commande.cpp
common/block_commande.cpp
+112
-96
class_undoredo_container.cpp
common/class_undoredo_container.cpp
+22
-0
copy_to_clipboard.cpp
common/copy_to_clipboard.cpp
+6
-6
drawframe.cpp
common/drawframe.cpp
+44
-10
drawpanel.cpp
common/drawpanel.cpp
+15
-15
block.cpp
eeschema/block.cpp
+303
-550
block_libedit.cpp
eeschema/block_libedit.cpp
+34
-39
eeschema.cpp
eeschema/eeschema.cpp
+1
-1
general.h
eeschema/general.h
+1
-1
hotkeys.cpp
eeschema/hotkeys.cpp
+2
-2
libedit_onrightclick.cpp
eeschema/libedit_onrightclick.cpp
+3
-3
libframe.cpp
eeschema/libframe.cpp
+5
-5
locate.cpp
eeschema/locate.cpp
+26
-57
onrightclick.cpp
eeschema/onrightclick.cpp
+3
-3
protos.h
eeschema/protos.h
+3
-5
schedit.cpp
eeschema/schedit.cpp
+8
-8
schematic_undo_redo.cpp
eeschema/schematic_undo_redo.cpp
+110
-52
schframe.cpp
eeschema/schframe.cpp
+3
-3
block.cpp
gerbview/block.cpp
+48
-54
edit.cpp
gerbview/edit.cpp
+14
-14
gerberframe.cpp
gerbview/gerberframe.cpp
+1
-1
onrightclick.cpp
gerbview/onrightclick.cpp
+1
-1
block_commande.h
include/block_commande.h
+96
-6
class_base_screen.h
include/class_base_screen.h
+66
-116
class_undoredo_container.h
include/class_undoredo_container.h
+16
-1
wxEeschemaStruct.h
include/wxEeschemaStruct.h
+3
-3
block.cpp
pcbnew/block.cpp
+81
-88
block_module_editor.cpp
pcbnew/block_module_editor.cpp
+38
-45
controle.cpp
pcbnew/controle.cpp
+3
-3
edit.cpp
pcbnew/edit.cpp
+143
-202
modedit.cpp
pcbnew/modedit.cpp
+11
-15
modedit_onclick.cpp
pcbnew/modedit_onclick.cpp
+1
-1
onrightclick.cpp
pcbnew/onrightclick.cpp
+1
-1
pcbframe.cpp
pcbnew/pcbframe.cpp
+1
-1
No files found.
CHANGELOG.txt
View file @
8ec8cf3f
...
...
@@ -4,6 +4,14 @@ KiCad ChangeLog 2009
Please add newer entries at the top, list the date and your name with
email address.
2009-july-25 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++all
Rework on undo/redo and block functions
Better and simpler coding of block and undo/redo functions
The goal is to have the same functions in eeschema and pcbnew.
and have a full undo/redo in pcbnew.
2009-july-18 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew
...
...
common/block_commande.cpp
View file @
8ec8cf3f
/****************************************************/
/* Routines de gestion des commandes sur blocks */
/* (section commune eeschema/pcbnew...
*/
/* (section commune eeschema/pcbnew...
*/
/****************************************************/
/* Fichier common.cpp */
...
...
@@ -19,31 +19,30 @@
/*******************/
/*
DrawBlockStruct
*/
/*
BLOCK_SELECTOR
*/
/*******************/
/****************************************************************************/
DrawBlockStruct
::
DrawBlockStruct
()
:
EDA_BaseStruct
(
BLOCK_LOCATE_STRUCT_TYPE
)
,
EDA_Rect
()
BLOCK_SELECTOR
::
BLOCK_SELECTOR
()
:
EDA_BaseStruct
(
BLOCK_LOCATE_STRUCT_TYPE
)
,
EDA_Rect
()
/****************************************************************************/
{
m_State
=
STATE_NO_BLOCK
;
/* Etat (enum BlockState) du block */
m_Command
=
BLOCK_IDLE
;
/* Type (enum CmdBlockType) d'operation */
m_BlockDrawStruct
=
NULL
;
/* pointeur sur la structure */
m_Color
=
BROWN
;
m_Color
=
BROWN
;
}
/****************************************/
DrawBlockStruct
::~
DrawBlockStruct
()
BLOCK_SELECTOR
::~
BLOCK_SELECTOR
()
/****************************************/
{
}
/***************************************************************/
void
DrawBlockStruct
::
SetMessageBlock
(
WinEDA_DrawFrame
*
frame
)
void
BLOCK_SELECTOR
::
SetMessageBlock
(
WinEDA_DrawFrame
*
frame
)
/***************************************************************/
/*
...
...
@@ -112,34 +111,82 @@ void DrawBlockStruct::SetMessageBlock( WinEDA_DrawFrame* frame )
/**************************************************************/
void
DrawBlockStruct
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
)
void
BLOCK_SELECTOR
::
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aDrawMode
,
int
aColor
)
/**************************************************************/
{
int
w
=
p
anel
->
GetScreen
()
->
Scale
(
GetWidth
()
);
int
h
=
p
anel
->
GetScreen
()
->
Scale
(
GetHeight
()
);
int
w
=
aP
anel
->
GetScreen
()
->
Scale
(
GetWidth
()
);
int
h
=
aP
anel
->
GetScreen
()
->
Scale
(
GetHeight
()
);
GRSetDrawMode
(
aDC
,
aDrawMode
);
if
(
w
==
0
||
h
==
0
)
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
GetX
(),
GetY
()
,
GetRight
()
,
GetBottom
(),
0
,
m_
Color
);
GRLine
(
&
aPanel
->
m_ClipBox
,
aDC
,
GetX
()
+
aOffset
.
x
,
GetY
()
+
aOffset
.
y
,
GetRight
()
+
aOffset
.
x
,
GetBottom
()
+
aOffset
.
y
,
0
,
a
Color
);
else
GRRect
(
&
panel
->
m_ClipBox
,
DC
,
GetX
(),
GetY
()
,
GetRight
()
,
GetBottom
(),
0
,
m_
Color
);
GRRect
(
&
aPanel
->
m_ClipBox
,
aDC
,
GetX
()
+
aOffset
.
x
,
GetY
()
+
aOffset
.
y
,
GetRight
()
+
aOffset
.
x
,
GetBottom
()
+
aOffset
.
y
,
0
,
a
Color
);
}
/*************************************************************************/
void
BLOCK_SELECTOR
::
InitData
(
WinEDA_DrawPanel
*
aPanel
,
const
wxPoint
&
startpos
)
/*************************************************************************/
/** function InitData
* Init the initial values of a BLOCK_SELECTOR, before starting a block command
*/
{
m_State
=
STATE_BLOCK_INIT
;
SetOrigin
(
startpos
);
SetSize
(
wxSize
(
0
,
0
)
);
m_ItemsSelection
.
ClearItemsList
();
aPanel
->
ManageCurseur
=
DrawAndSizingBlockOutlines
;
aPanel
->
ForceCloseManageCurseur
=
AbortBlockCurrentCommand
;
}
/** Function ClearItemsList
* delete only the list of EDA_BaseStruct * pointers, NOT the pointed data itself
*/
void
BLOCK_SELECTOR
::
ClearItemsList
()
{
m_ItemsSelection
.
ClearItemsList
();
}
/** Function ClearListAndDeleteItems
* delete only the list of EDA_BaseStruct * pointers, AND the data pinted by m_Item
*/
void
BLOCK_SELECTOR
::
ClearListAndDeleteItems
()
{
m_ItemsSelection
.
ClearListAndDeleteItems
();
}
/** Function PushItem
* Add aItem to the list of items
* @param aItem = an ITEM_PICKER to add to the list
*/
void
BLOCK_SELECTOR
::
PushItem
(
ITEM_PICKER
&
aItem
)
{
m_ItemsSelection
.
PushItem
(
aItem
);
}
/*************************************************************************/
bool
WinEDA_DrawFrame
::
HandleBlockBegin
(
wxDC
*
DC
,
int
key
,
const
wxPoint
&
startpos
)
/*************************************************************************/
/*
First command block function:
/*
First command block function:
* Init the Block infos: command type, initial position, and other variables..
*/
{
DrawBlockStruct
*
Block
=
&
GetBaseScreen
()
->
BlockLocate
;
BLOCK_SELECTOR
*
Block
=
&
GetBaseScreen
()
->
m_
BlockLocate
;
if
(
(
Block
->
m_Command
!=
BLOCK_IDLE
)
||
(
Block
->
m_State
!=
STATE_NO_BLOCK
)
)
||
(
Block
->
m_State
!=
STATE_NO_BLOCK
)
)
return
FALSE
;
Block
->
m_Flags
=
0
;
...
...
@@ -163,26 +210,26 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
case
BLOCK_MIRROR_X
:
case
BLOCK_MIRROR_Y
:
/* mirror */
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
InitBlockLocateDatas
(
DrawPanel
,
startpos
);
Block
->
InitData
(
DrawPanel
,
startpos
);
break
;
case
BLOCK_PASTE
:
InitBlockLocateDatas
(
DrawPanel
,
startpos
);
Block
->
InitData
(
DrawPanel
,
startpos
);
Block
->
m_BlockLastCursorPosition
.
x
=
0
;
Block
->
m_BlockLastCursorPosition
.
y
=
0
;
InitBlockPasteInfos
();
if
(
Block
->
m_
BlockDrawStruct
==
NULL
)
/* No data to paste */
if
(
Block
->
m_
ItemsSelection
.
GetCount
()
==
0
)
/* No data to paste */
{
DisplayError
(
this
,
wxT
(
"No Block to paste"
),
20
);
GetBaseScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetBaseScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
DrawPanel
->
ManageCurseur
=
NULL
;
return
TRUE
;
}
if
(
DrawPanel
->
ManageCurseur
==
NULL
)
{
Block
->
m_
BlockDrawStruct
=
NULL
;
Block
->
m_
ItemsSelection
.
ClearItemsList
()
;
DisplayError
(
this
,
wxT
(
"WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL"
)
);
wxT
(
"WinEDA_DrawFrame::HandleBlockBegin() Err: ManageCurseur NULL"
)
);
return
TRUE
;
}
Block
->
m_State
=
STATE_BLOCK_MOVE
;
...
...
@@ -196,102 +243,37 @@ bool WinEDA_DrawFrame::HandleBlockBegin( wxDC* DC, int key,
Block
->
m_Command
;
DisplayError
(
this
,
msg
);
}
break
;
break
;
}
Block
->
SetMessageBlock
(
this
);
return
TRUE
;
}
/******************************************************************/
void
AbortBlockCurrentCommand
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/******************************************************************/
/*
* Cancel Current block operation.
*/
{
BASE_SCREEN
*
screen
=
Panel
->
GetScreen
();
if
(
Panel
->
ManageCurseur
)
/* Erase current drawing on screen */
{
Panel
->
ManageCurseur
(
Panel
,
DC
,
FALSE
);
/* Efface dessin fantome */
Panel
->
ManageCurseur
=
NULL
;
Panel
->
ForceCloseManageCurseur
=
NULL
;
screen
->
SetCurItem
(
NULL
);
/* Delete the picked wrapper if this is a picked list. */
if
(
(
screen
->
BlockLocate
.
m_Command
!=
BLOCK_PASTE
)
&&
screen
->
BlockLocate
.
m_BlockDrawStruct
)
{
if
(
screen
->
BlockLocate
.
m_BlockDrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
DrawPickedStruct
*
PickedList
;
PickedList
=
(
DrawPickedStruct
*
)
screen
->
BlockLocate
.
m_BlockDrawStruct
;
PickedList
->
DeleteWrapperList
();
}
screen
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
}
}
screen
->
BlockLocate
.
m_Flags
=
0
;
screen
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
screen
->
BlockLocate
.
m_Command
=
BLOCK_ABORT
;
Panel
->
m_Parent
->
HandleBlockEnd
(
DC
);
screen
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
Panel
->
m_Parent
->
DisplayToolMsg
(
wxEmptyString
);
}
/*************************************************************************/
void
InitBlockLocateDatas
(
WinEDA_DrawPanel
*
Panel
,
const
wxPoint
&
startpos
)
/*************************************************************************/
/*
* Init the initial values of a BlockLocate, before starting a block command
*/
{
BASE_SCREEN
*
screen
=
Panel
->
GetScreen
();
screen
->
BlockLocate
.
m_State
=
STATE_BLOCK_INIT
;
screen
->
BlockLocate
.
SetOrigin
(
startpos
);
screen
->
BlockLocate
.
SetSize
(
wxSize
(
0
,
0
)
);
screen
->
BlockLocate
.
SetNext
(
NULL
);
screen
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
Panel
->
ManageCurseur
=
DrawAndSizingBlockOutlines
;
Panel
->
ForceCloseManageCurseur
=
AbortBlockCurrentCommand
;
}
/********************************************************************************/
void
DrawAndSizingBlockOutlines
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
)
/********************************************************************************/
/* Redraw the outlines of the block which shows the search area for block commands
* The first point of the rectangle showing the area is initialised
* by InitBlockLocateDatas().
* by Init
m_
BlockLocateDatas().
* The other point of the rectangle is the mouse cursor
*/
{
DrawBlockStruct
*
PtBlock
;
BLOCK_SELECTOR
*
PtBlock
;
PtBlock
=
&
panel
->
GetScreen
()
->
BlockLocate
;
PtBlock
=
&
panel
->
GetScreen
()
->
m_
BlockLocate
;
PtBlock
->
m_MoveVector
=
wxPoint
(
0
,
0
);
GRSetDrawMode
(
DC
,
g_XorMode
);
/* Effacement ancien cadre */
if
(
erase
)
PtBlock
->
Draw
(
panel
,
DC
);
PtBlock
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
,
PtBlock
->
m_Color
);
PtBlock
->
m_BlockLastCursorPosition
=
panel
->
GetScreen
()
->
m_Curseur
;
PtBlock
->
SetEnd
(
panel
->
GetScreen
()
->
m_Curseur
);
PtBlock
->
Draw
(
panel
,
DC
);
PtBlock
->
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
,
PtBlock
->
m_Color
);
if
(
PtBlock
->
m_State
==
STATE_BLOCK_INIT
)
{
...
...
@@ -300,3 +282,37 @@ void DrawAndSizingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
PtBlock
->
m_State
=
STATE_BLOCK_END
;
}
}
/******************************************************************/
void
AbortBlockCurrentCommand
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/******************************************************************/
/*
* Cancel Current block operation.
*/
{
BASE_SCREEN
*
screen
=
Panel
->
GetScreen
();
if
(
Panel
->
ManageCurseur
)
/* Erase current drawing on screen */
{
Panel
->
ManageCurseur
(
Panel
,
DC
,
FALSE
);
/* Efface dessin fantome */
Panel
->
ManageCurseur
=
NULL
;
Panel
->
ForceCloseManageCurseur
=
NULL
;
screen
->
SetCurItem
(
NULL
);
/* Delete the picked wrapper if this is a picked list. */
if
(
screen
->
m_BlockLocate
.
m_Command
!=
BLOCK_PASTE
)
screen
->
m_BlockLocate
.
ClearItemsList
();
}
screen
->
m_BlockLocate
.
m_Flags
=
0
;
screen
->
m_BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
screen
->
m_BlockLocate
.
m_Command
=
BLOCK_ABORT
;
Panel
->
m_Parent
->
HandleBlockEnd
(
DC
);
screen
->
m_BlockLocate
.
m_Command
=
BLOCK_IDLE
;
Panel
->
m_Parent
->
DisplayToolMsg
(
wxEmptyString
);
}
common/class_undoredo_container.cpp
View file @
8ec8cf3f
...
...
@@ -67,6 +67,14 @@ void PICKED_ITEMS_LIST::PICKED_ITEMS_LIST::ClearItemsList()
m_ItemsList
.
clear
();
}
void
PICKED_ITEMS_LIST
::
ClearListAndDeleteItems
()
{
for
(
unsigned
ii
=
0
;
ii
<
m_ItemsList
.
size
();
ii
++
)
delete
m_ItemsList
[
ii
].
m_Item
;
m_ItemsList
.
clear
();
}
ITEM_PICKER
PICKED_ITEMS_LIST
::
GetItemWrapper
(
unsigned
int
aIdx
)
{
ITEM_PICKER
picker
;
...
...
@@ -160,6 +168,20 @@ bool PICKED_ITEMS_LIST::RemoveItem( unsigned aIdx )
return
true
;
}
/** Function CopyList
* copy all data from aSource
* Items picked are not copied. just pointer on them are copied
*/
void
PICKED_ITEMS_LIST
::
CopyList
(
const
PICKED_ITEMS_LIST
&
aSource
)
{
ITEM_PICKER
picker
;
for
(
unsigned
ii
=
0
;
ii
<
aSource
.
GetCount
();
ii
++
)
{
picker
=
aSource
.
m_ItemsList
[
ii
];
PushItem
(
picker
);
}
}
/**********************************************/
/********** UNDO_REDO_CONTAINER ***************/
...
...
common/copy_to_clipboard.cpp
View file @
8ec8cf3f
...
...
@@ -35,7 +35,7 @@ void WinEDA_DrawFrame::CopyToClipboard( wxCommandEvent& event )
if
(
event
.
GetId
()
==
ID_GEN_COPY_BLOCK_TO_CLIPBOARD
)
{
if
(
GetBaseScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
if
(
GetBaseScreen
()
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
DrawPanel
->
SetCursor
(
wxCursor
(
DrawPanel
->
m_PanelCursor
=
DrawPanel
->
m_PanelDefaultCursor
)
);
...
...
@@ -74,13 +74,13 @@ bool DrawPage( WinEDA_DrawPanel* panel )
/* scale is the ratio resolution/internal units */
float
scale
=
82.0
/
panel
->
m_Parent
->
m_InternalUnits
;
if
(
ActiveScreen
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
if
(
ActiveScreen
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
{
DrawBlock
=
TRUE
;
DrawArea
.
SetX
(
(
int
)
(
ActiveScreen
->
BlockLocate
.
GetX
()
)
);
DrawArea
.
SetY
(
(
int
)
(
ActiveScreen
->
BlockLocate
.
GetY
()
)
);
DrawArea
.
SetWidth
(
(
int
)
(
ActiveScreen
->
BlockLocate
.
GetWidth
()
)
);
DrawArea
.
SetHeight
(
(
int
)
(
ActiveScreen
->
BlockLocate
.
GetHeight
()
)
);
DrawArea
.
SetX
(
ActiveScreen
->
m_BlockLocate
.
GetX
(
)
);
DrawArea
.
SetY
(
ActiveScreen
->
m_BlockLocate
.
GetY
(
)
);
DrawArea
.
SetWidth
(
ActiveScreen
->
m_BlockLocate
.
GetWidth
(
)
);
DrawArea
.
SetHeight
(
ActiveScreen
->
m_BlockLocate
.
GetHeight
(
)
);
}
/* modification des cadrages et reglages locaux */
...
...
common/drawframe.cpp
View file @
8ec8cf3f
...
...
@@ -488,7 +488,7 @@ int WinEDA_DrawFrame::ReturnBlockCommand( int key )
void
WinEDA_DrawFrame
::
InitBlockPasteInfos
()
{
GetBaseScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetBaseScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
DrawPanel
->
ManageCurseur
=
NULL
;
}
...
...
@@ -652,7 +652,31 @@ void WinEDA_DrawFrame::SetLanguage( wxCommandEvent& event )
}
}
/* used in UpdateStatusBar() when coordinates are in mm
* try to approximate a coordinate (in 0.001 mm) to an easy to read number
* ie round the unit value to 0 if unit is 1 or 2, or 8 or 9
*/
double
Round_To_0
(
double
x
)
{
long
long
ix
=
wxRound
(
x
*
1000
);
// ix is in 0.001 mm
if
(
x
<
0
)
NEGATE
(
ix
);
int
remainder
=
ix
%
10
;
// remainder is in 0.001 mm
if
(
remainder
<=
2
)
ix
-=
remainder
;
// truncate to the near number
else
if
(
remainder
>=
8
)
ix
+=
10
-
remainder
;
// round to near number
if
(
x
<
0
)
NEGATE
(
ix
);
return
(
double
)
ix
/
1000.0
;
}
/** Function UpdateStatusBar()
* Displays in the bottom of the main window a stust:
* - Absolute Cursor coordinates
* - Relative Cursor coordinates (relative to the last coordinate stored when actiavte the space bar)
* ( in this status is also displayed the zoom level, but this is not made by this function)
*/
void
WinEDA_DrawFrame
::
UpdateStatusBar
()
{
wxString
Line
;
...
...
@@ -670,20 +694,30 @@ void WinEDA_DrawFrame::UpdateStatusBar()
SetStatusText
(
Line
,
1
);
/* Display absolute coordinates: */
Line
.
Printf
(
g_UnitMetric
?
wxT
(
"X %.3f Y %.3f"
)
:
wxT
(
"X %.4f Y %.4f"
),
To_User_Unit
(
g_UnitMetric
,
screen
->
m_Curseur
.
x
,
m_InternalUnits
),
To_User_Unit
(
g_UnitMetric
,
screen
->
m_Curseur
.
y
,
m_InternalUnits
)
);
double
dXpos
=
To_User_Unit
(
g_UnitMetric
,
screen
->
m_Curseur
.
x
,
m_InternalUnits
);
double
dYpos
=
To_User_Unit
(
g_UnitMetric
,
screen
->
m_Curseur
.
y
,
m_InternalUnits
);
/* When using mm the conversion from 1/10000 inch to mm can give some non easy to read numbers,
* like 1.999 or 2.001 that be better if displayed 2.000, so small diffs are filtered here.
*/
if
(
g_UnitMetric
)
{
dXpos
=
Round_To_0
(
dXpos
);
dYpos
=
Round_To_0
(
dYpos
);
}
Line
.
Printf
(
g_UnitMetric
?
wxT
(
"X %.3f Y %.3f"
)
:
wxT
(
"X %.4f Y %.4f"
),
dXpos
,
dYpos
);
SetStatusText
(
Line
,
2
);
/* Display relative coordinates: */
dx
=
screen
->
m_Curseur
.
x
-
screen
->
m_O_Curseur
.
x
;
dy
=
screen
->
m_Curseur
.
y
-
screen
->
m_O_Curseur
.
y
;
Line
.
Printf
(
g_UnitMetric
?
wxT
(
"x %.3f y %.3f"
)
:
wxT
(
"x %.4f y %.4f"
),
To_User_Unit
(
g_UnitMetric
,
dx
,
m_InternalUnits
),
To_User_Unit
(
g_UnitMetric
,
dy
,
m_InternalUnits
)
);
dXpos
=
To_User_Unit
(
g_UnitMetric
,
dx
,
m_InternalUnits
);
dYpos
=
To_User_Unit
(
g_UnitMetric
,
dy
,
m_InternalUnits
);
if
(
g_UnitMetric
)
{
dXpos
=
Round_To_0
(
dXpos
);
dYpos
=
Round_To_0
(
dYpos
);
}
Line
.
Printf
(
g_UnitMetric
?
wxT
(
"x %.3f y %.3f"
)
:
wxT
(
"x %.4f y %.4f"
),
dXpos
,
dYpos
);
SetStatusText
(
Line
,
3
);
}
...
...
common/drawpanel.cpp
View file @
8ec8cf3f
...
...
@@ -1095,7 +1095,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
}
else
if
(
event
.
LeftUp
()
)
{
if
(
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
// A block command is in progress: a left up is the end of block
if
(
screen
->
m_
BlockLocate
.
m_State
==
STATE_NO_BLOCK
// A block command is in progress: a left up is the end of block
&&
!
s_IgnoreNextLeftButtonRelease
)
// This is the end of a double click, already seen
m_Parent
->
OnLeftClick
(
&
DC
,
screen
->
m_MousePositionInPixels
);
...
...
@@ -1111,7 +1111,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
s_IgnoreNextLeftButtonRelease
=
false
;
}
if
(
event
.
ButtonUp
(
2
)
&&
(
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
)
if
(
event
.
ButtonUp
(
2
)
&&
(
screen
->
m_
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
)
{
// The middle button has been released, with no block command:
// We use it for a zoom center at cursor position command
...
...
@@ -1158,14 +1158,14 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
if
(
m_Block_Enable
&&
!
(
localbutt
&
GR_M_DCLICK
)
)
{
if
(
(
screen
->
BlockLocate
.
m_Command
==
BLOCK_IDLE
)
||
(
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
)
if
(
(
screen
->
m_
BlockLocate
.
m_Command
==
BLOCK_IDLE
)
||
(
screen
->
m_
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
)
{
screen
->
BlockLocate
.
SetOrigin
(
m_CursorStartPos
);
screen
->
m_
BlockLocate
.
SetOrigin
(
m_CursorStartPos
);
}
if
(
event
.
LeftDown
()
||
event
.
MiddleDown
()
)
{
if
(
screen
->
BlockLocate
.
m_State
==
STATE_BLOCK_MOVE
)
if
(
screen
->
m_
BlockLocate
.
m_State
==
STATE_BLOCK_MOVE
)
{
m_AutoPAN_Request
=
FALSE
;
m_Parent
->
HandleBlockPlace
(
&
DC
);
...
...
@@ -1177,7 +1177,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
&&
ManageCurseur
==
NULL
&&
ForceCloseManageCurseur
==
NULL
)
{
// Mouse is dragging: if no block in progress: start a block command
if
(
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
if
(
screen
->
m_
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
{
// Start a block command
int
cmd_type
=
kbstat
;
...
...
@@ -1217,10 +1217,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
*/
#define BLOCK_MINSIZE_LIMIT 1
bool
BlockIsSmall
=
(
ABS
(
screen
->
Scale
(
screen
->
BlockLocate
.
GetWidth
()
)
)
<
BLOCK_MINSIZE_LIMIT
)
&&
(
ABS
(
screen
->
Scale
(
screen
->
BlockLocate
.
GetHeight
()
)
)
<
BLOCK_MINSIZE_LIMIT
);
(
ABS
(
screen
->
Scale
(
screen
->
m_
BlockLocate
.
GetWidth
()
)
)
<
BLOCK_MINSIZE_LIMIT
)
&&
(
ABS
(
screen
->
Scale
(
screen
->
m_
BlockLocate
.
GetHeight
()
)
)
<
BLOCK_MINSIZE_LIMIT
);
if
(
(
screen
->
BlockLocate
.
m_State
!=
STATE_NO_BLOCK
)
&&
BlockIsSmall
)
if
(
(
screen
->
m_
BlockLocate
.
m_State
!=
STATE_NO_BLOCK
)
&&
BlockIsSmall
)
{
if
(
ForceCloseManageCurseur
)
{
...
...
@@ -1229,12 +1229,12 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
}
SetCursor
(
m_PanelCursor
=
m_PanelDefaultCursor
);
}
else
if
(
screen
->
BlockLocate
.
m_State
==
STATE_BLOCK_END
)
else
if
(
screen
->
m_
BlockLocate
.
m_State
==
STATE_BLOCK_END
)
{
m_AutoPAN_Request
=
FALSE
;
m_Parent
->
HandleBlockEnd
(
&
DC
);
SetCursor
(
m_PanelCursor
=
m_PanelDefaultCursor
);
if
(
screen
->
BlockLocate
.
m_State
==
STATE_BLOCK_MOVE
)
if
(
screen
->
m_
BlockLocate
.
m_State
==
STATE_BLOCK_MOVE
)
{
m_AutoPAN_Request
=
TRUE
;
SetCursor
(
m_PanelCursor
=
wxCURSOR_HAND
);
...
...
@@ -1244,10 +1244,10 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
}
// End of block command on a double click
// To avoid an unwanted block move command if the mo
ve is moved while double click
// To avoid an unwanted block move command if the mo
use is moved while double clicking
if
(
localbutt
==
(
int
)
(
GR_M_LEFT_DOWN
|
GR_M_DCLICK
)
)
{
if
(
screen
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
if
(
screen
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
{
if
(
ForceCloseManageCurseur
)
{
...
...
@@ -1261,7 +1261,7 @@ void WinEDA_DrawPanel::OnMouseEvent( wxMouseEvent& event )
#if 0
wxString msg_debug;
msg_debug.Printf( " block state %d, cmd %d",
screen->
BlockLocate.m_State, screen->
BlockLocate.m_Command );
screen->
m_BlockLocate.m_State, screen->m_
BlockLocate.m_Command );
m_Parent->PrintMsg( msg_debug );
#endif
...
...
eeschema/block.cpp
View file @
8ec8cf3f
...
...
@@ -24,22 +24,23 @@
/* Fonctions exportees */
/* Fonctions Locales */
static
SCH_ITEM
*
CopyStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
BASE_SCREEN
*
screen
,
SCH_ITEM
*
DrawStruct
);
static
void
CollectStructsToDrag
(
SCH_SCREEN
*
screen
);
static
void
AddPickedItem
(
SCH_SCREEN
*
screen
,
wxPoint
aPosition
);
static
LibEDA_BaseStruct
*
GetNextPinPosition
(
SCH_COMPONENT
*
aDrawLibItem
,
wxPoint
&
aPosition
);
static
void
DrawMovingBlockOutlines
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
SCH_ITEM
*
SaveStructListForPaste
(
SCH_ITEM
*
DrawStruct
);
static
bool
MirrorStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
SCH_ITEM
*
DrawStruct
,
wxPoint
&
Center
);
static
void
MirrorOneStruct
(
SCH_ITEM
*
DrawStruct
,
wxPoint
&
Center
);
static
void
DeleteItemsInList
(
WinEDA_DrawPanel
*
panel
,
PICKED_ITEMS_LIST
&
aItemsList
);
static
void
PlaceItemsInList
(
SCH_SCREEN
*
aScreen
,
PICKED_ITEMS_LIST
&
aItemsList
);
static
void
MoveListOfItems
(
SCH_SCREEN
*
aScreen
,
PICKED_ITEMS_LIST
&
aItemsList
);
static
void
CopyItemsInList
(
SCH_SCREEN
*
screen
,
PICKED_ITEMS_LIST
&
aItemsList
);
static
void
CollectStructsToDrag
(
SCH_SCREEN
*
screen
);
static
void
AddPickedItem
(
SCH_SCREEN
*
screen
,
wxPoint
aPosition
);
static
LibEDA_BaseStruct
*
GetNextPinPosition
(
SCH_COMPONENT
*
aDrawLibItem
,
wxPoint
&
aPosition
);
static
void
DrawMovingBlockOutlines
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
SaveStructListForPaste
(
PICKED_ITEMS_LIST
&
aItemsList
);
static
void
MirrorListOfItems
(
PICKED_ITEMS_LIST
&
aItemsList
,
wxPoint
&
Center
);
static
void
MirrorOneStruct
(
SCH_ITEM
*
DrawStruct
,
wxPoint
&
Center
);
/*************************************************************************/
int
WinEDA_SchematicFrame
::
ReturnBlockCommand
(
int
key
)
...
...
@@ -90,9 +91,9 @@ void WinEDA_SchematicFrame::InitBlockPasteInfos()
/* Init the parameters used by the block paste command
*/
{
DrawBlockStruct
*
block
=
&
GetScreen
()
->
BlockLocate
;
BLOCK_SELECTOR
*
block
=
&
GetScreen
()
->
m_
BlockLocate
;
block
->
m_
BlockDrawStruct
=
g_BlockSaveDataList
;
block
->
m_
ItemsSelection
.
CopyList
(
g_BlockSaveDataList
.
m_ItemsSelection
)
;
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
}
...
...
@@ -107,10 +108,8 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
* - block copie & paste
*/
{
bool
err
=
FALSE
;
DrawBlockStruct
*
block
=
&
GetScreen
()
->
BlockLocate
;
SCH_ITEM
*
NewStruct
=
NULL
;
bool
err
=
FALSE
;
BLOCK_SELECTOR
*
block
=
&
GetScreen
()
->
m_BlockLocate
;
if
(
DrawPanel
->
ManageCurseur
==
NULL
)
{
...
...
@@ -118,11 +117,11 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
DisplayError
(
this
,
wxT
(
"HandleBlockPLace() : ManageCurseur = NULL"
)
);
}
if
(
block
->
m_BlockDrawStruct
==
NULL
)
if
(
block
->
GetCount
()
==
0
)
{
wxString
msg
;
err
=
TRUE
;
msg
.
Printf
(
wxT
(
"HandleBlockPLace()
: m_BlockDrawStruct = NULL
(cmd %d, state %d)"
),
msg
.
Printf
(
wxT
(
"HandleBlockPLace()
error : no items to place
(cmd %d, state %d)"
),
block
->
m_Command
,
block
->
m_State
);
DisplayError
(
this
,
msg
);
}
...
...
@@ -131,7 +130,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
switch
(
block
->
m_Command
)
{
case
BLOCK_IDLE
:
case
BLOCK_IDLE
:
err
=
TRUE
;
break
;
...
...
@@ -140,11 +139,10 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
SaveCopyInUndoList
(
(
SCH_ITEM
*
)
block
->
m_BlockDrawStruct
,
IS_CHANGED
);
SaveCopyInUndoList
(
block
->
m_ItemsSelection
,
IS_CHANGED
);
MoveStruct
(
DrawPanel
,
DC
,
(
SCH_ITEM
*
)
block
->
m_BlockDrawStruct
);
block
->
m_BlockDrawStruct
=
NULL
;
DrawPanel
->
Refresh
(
TRUE
);
MoveListOfItems
(
GetScreen
(),
block
->
m_ItemsSelection
);
block
->
ClearItemsList
();
break
;
case
BLOCK_COPY
:
/* Copy */
...
...
@@ -152,23 +150,19 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
NewStruct
=
CopyStruct
(
DrawPanel
,
DC
,
GetScreen
(),
(
SCH_ITEM
*
)
block
->
m_BlockDrawStruct
);
CopyItemsInList
(
GetScreen
(),
block
->
m_ItemsSelection
);
SaveCopyInUndoList
(
NewStruct
,
(
block
->
m_Command
==
BLOCK_PRESELECT_MOVE
)
?
IS_CHANGED
:
IS_NEW
);
SaveCopyInUndoList
(
block
->
m_ItemsSelection
,
(
block
->
m_Command
==
BLOCK_PRESELECT_MOVE
)
?
IS_CHANGED
:
IS_NEW
);
block
->
m_BlockDrawStruct
=
NULL
;
block
->
ClearItemsList
()
;
break
;
case
BLOCK_PASTE
:
/* Paste (recopie du dernier bloc sauve */
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
Paste
Struct
(
DC
);
block
->
m_BlockDrawStruct
=
NULL
;
Paste
ListOfItems
(
DC
);
block
->
ClearItemsList
()
;
break
;
case
BLOCK_ZOOM
:
// Handled by HandleBlockEnd()
...
...
@@ -199,15 +193,15 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
TestDanglingEnds
(
GetScreen
()
->
EEDrawList
,
DC
);
if
(
block
->
m_BlockDrawStruct
)
if
(
block
->
GetCount
()
)
{
DisplayError
(
this
,
wxT
(
"HandleBlockPLace() error: DrawStruct != Null"
)
);
block
->
m_BlockDrawStruct
=
NULL
;
DisplayError
(
this
,
wxT
(
"HandleBlockPLace() error: some items left in buffer"
)
);
block
->
ClearItemsList
();
}
SetToolID
(
m_ID_current_state
,
DrawPanel
->
m_PanelDefaultCursor
,
wxEmptyString
);
DrawPanel
->
Refresh
(
);
}
...
...
@@ -222,11 +216,11 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
* -1 si commande terminee et composants trouves (block delete, block save)
*/
{
int
ii
=
0
;
bool
zoom_command
=
FALSE
;
DrawBlockStruct
*
block
=
&
GetScreen
()
->
BlockLocate
;
int
ii
=
0
;
bool
zoom_command
=
FALSE
;
BLOCK_SELECTOR
*
block
=
&
GetScreen
()
->
m_
BlockLocate
;
if
(
block
->
m_BlockDrawStruct
)
if
(
block
->
GetCount
()
)
{
BlockState
state
=
block
->
m_State
;
CmdBlockType
command
=
block
->
m_Command
;
...
...
@@ -236,8 +230,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
block
->
m_Command
=
command
;
DrawPanel
->
ManageCurseur
=
DrawAndSizingBlockOutlines
;
DrawPanel
->
ForceCloseManageCurseur
=
AbortBlockCurrentCommand
;
GetScreen
()
->
m_Curseur
.
x
=
block
->
GetRight
();
GetScreen
()
->
m_Curseur
.
y
=
block
->
GetBottom
();
GetScreen
()
->
m_Curseur
=
block
->
GetEnd
();
if
(
block
->
m_Command
!=
BLOCK_ABORT
)
DrawPanel
->
MouseToCursorSchema
();
}
...
...
@@ -245,7 +238,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
if
(
DrawPanel
->
ManageCurseur
!=
NULL
)
switch
(
block
->
m_Command
)
{
case
BLOCK_IDLE
:
case
BLOCK_IDLE
:
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace()"
)
);
break
;
...
...
@@ -254,14 +247,13 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_COPY
:
/* Copy */
block
->
m_BlockDrawStruct
=
PickStruct
(
GetScreen
()
->
BlockLocate
,
GetScreen
(),
SEARCHALL
);
PickStruct
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
if
(
block
->
m_BlockDrawStruct
!=
NULL
)
if
(
block
->
GetCount
()
)
{
ii
=
1
;
CollectStructsToDrag
(
(
SCH_SCREEN
*
)
GetScreen
()
);
CollectStructsToDrag
(
GetScreen
()
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
...
...
@@ -276,39 +268,32 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
break
;
case
BLOCK_DELETE
:
/* Delete */
block
->
m_BlockDrawStruct
=
PickStruct
(
GetScreen
()
->
BlockLocate
,
GetScreen
(),
SEARCHALL
);
PickStruct
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
if
(
block
->
m_BlockDrawStruct
!=
NULL
)
if
(
block
->
GetCount
()
)
{
ii
=
-
1
;
DeleteStruct
(
DrawPanel
,
DC
,
(
SCH_ITEM
*
)
block
->
m_BlockDrawStruct
);
DeleteItemsInList
(
DrawPanel
,
block
->
m_ItemsSelection
);
GetScreen
()
->
SetModify
();
}
block
->
m_BlockDrawStruct
=
NULL
;
block
->
ClearItemsList
()
;
TestDanglingEnds
(
GetScreen
()
->
EEDrawList
,
DC
);
DrawPanel
->
Refresh
();
break
;
case
BLOCK_SAVE
:
/* Save */
block
->
m_BlockDrawStruct
=
PickStruct
(
GetScreen
()
->
BlockLocate
,
GetScreen
(),
SEARCHALL
);
PickStruct
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
if
(
block
->
m_BlockDrawStruct
!=
NULL
)
if
(
block
->
GetCount
()
)
{
wxPoint
oldpos
=
GetScreen
()
->
m_Curseur
;
wxPoint
oldpos
=
GetScreen
()
->
m_Curseur
;
GetScreen
()
->
m_Curseur
=
wxPoint
(
0
,
0
);
SCH_ITEM
*
DrawStructCopy
=
SaveStructListForPaste
(
(
SCH_ITEM
*
)
block
->
m_BlockDrawStruct
);
PlaceStruct
(
GetScreen
(),
DrawStructCopy
);
SaveStructListForPaste
(
block
->
m_ItemsSelection
);
PlaceItemsInList
(
GetScreen
(),
g_BlockSaveDataList
.
m_ItemsSelection
);
GetScreen
()
->
m_Curseur
=
oldpos
;
ii
=
-
1
;
}
block
->
m_BlockDrawStruct
=
NULL
;
block
->
ClearItemsList
()
;
break
;
case
BLOCK_PASTE
:
...
...
@@ -333,11 +318,10 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
}
if
(
block
->
m_Command
==
BLOCK_ABORT
)
{
/* clear struct.m_Flags */
{
/* clear struct.m_Flags */
EDA_BaseStruct
*
Struct
;
for
(
Struct
=
GetScreen
()
->
EEDrawList
;
Struct
!=
NULL
;
Struct
=
Struct
->
Next
()
)
for
(
Struct
=
GetScreen
()
->
EEDrawList
;
Struct
!=
NULL
;
Struct
=
Struct
->
Next
()
)
Struct
->
m_Flags
=
0
;
}
...
...
@@ -349,13 +333,11 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
GetScreen
()
->
SetCurItem
(
NULL
);
SetToolID
(
m_ID_current_state
,
DrawPanel
->
m_PanelDefaultCursor
,
wxEmptyString
);
SetToolID
(
m_ID_current_state
,
DrawPanel
->
m_PanelDefaultCursor
,
wxEmptyString
);
}
if
(
zoom_command
)
Window_Zoom
(
GetScreen
()
->
BlockLocate
);
Window_Zoom
(
GetScreen
()
->
m_
BlockLocate
);
return
ii
;
}
...
...
@@ -370,8 +352,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
* A partir de la commande bloc move, peut executer une commande autre que bloc move.
*/
{
int
ii
=
0
;
DrawBlockStruct
*
block
=
&
GetScreen
()
->
BlockLocate
;
int
ii
=
0
;
BLOCK_SELECTOR
*
block
=
&
GetScreen
()
->
m_
BlockLocate
;
if
(
block
->
m_Command
!=
BLOCK_MOVE
)
return
;
...
...
@@ -394,21 +376,12 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
* qui est devenue erronnee */
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
if
(
block
->
m_BlockDrawStruct
)
{
if
(
block
->
m_BlockDrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
/* Delete the picked wrapper if this is a picked list. */
DrawPickedStruct
*
PickedList
;
PickedList
=
(
DrawPickedStruct
*
)
block
->
m_BlockDrawStruct
;
PickedList
->
DeleteWrapperList
();
}
block
->
m_BlockDrawStruct
=
NULL
;
}
BreakSegmentOnJunction
(
(
SCH_SCREEN
*
)
GetScreen
()
);
block
->
m_BlockDrawStruct
=
PickStruct
(
GetScreen
()
->
BlockLocate
,
GetScreen
(),
SEARCHALL
);
if
(
block
->
m_BlockDrawStruct
!=
NULL
)
block
->
ClearItemsList
();
BreakSegmentOnJunction
(
GetScreen
()
);
PickStruct
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
if
(
block
->
GetCount
()
)
{
ii
=
1
;
CollectStructsToDrag
(
(
SCH_SCREEN
*
)
GetScreen
()
);
...
...
@@ -421,25 +394,26 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
case
BLOCK_DELETE
:
/* move to Delete */
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
if
(
block
->
m_BlockDrawStruct
!=
NULL
)
if
(
block
->
GetCount
()
)
{
ii
=
-
1
;
Delete
Struct
(
DrawPanel
,
DC
,
(
SCH_ITEM
*
)
block
->
m_BlockDrawStruct
);
Delete
ItemsInList
(
DrawPanel
,
block
->
m_ItemsSelection
);
GetScreen
()
->
SetModify
();
}
TestDanglingEnds
(
GetScreen
()
->
EEDrawList
,
DC
);
DrawPanel
->
Refresh
();
DrawPanel
->
Refresh
();
break
;
case
BLOCK_SAVE
:
/* Save */
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
if
(
block
->
m_BlockDrawStruct
!=
NULL
)
if
(
block
->
GetCount
()
)
{
wxPoint
oldpos
=
GetScreen
()
->
m_Curseur
;
wxPoint
oldpos
=
GetScreen
()
->
m_Curseur
;
GetScreen
()
->
m_Curseur
=
wxPoint
(
0
,
0
);
SCH_ITEM
*
DrawStructCopy
=
SaveStructListForPaste
(
(
SCH_ITEM
*
)
block
->
m_BlockDrawStruct
);
PlaceStruct
(
GetScreen
(),
DrawStructCopy
);
SaveStructListForPaste
(
block
->
m_ItemsSelection
);
PlaceItemsInList
(
GetScreen
(),
g_BlockSaveDataList
.
m_ItemsSelection
);
GetScreen
()
->
m_Curseur
=
oldpos
;
ii
=
-
1
;
}
...
...
@@ -449,7 +423,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
DC
);
DrawPanel
->
SetCursor
(
DrawPanel
->
m_PanelCursor
=
DrawPanel
->
m_PanelDefaultCursor
);
Window_Zoom
(
GetScreen
()
->
BlockLocate
);
Window_Zoom
(
GetScreen
()
->
m_
BlockLocate
);
break
;
...
...
@@ -460,22 +434,19 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
case
BLOCK_MIRROR_Y
:
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
if
(
block
->
m_BlockDrawStruct
!=
NULL
)
if
(
block
->
GetCount
()
)
{
SaveCopyInUndoList
(
(
SCH_ITEM
*
)
block
->
m_BlockDrawStruct
,
IS_CHANGED
);
SaveCopyInUndoList
(
block
->
m_ItemsSelection
,
IS_CHANGED
);
ii
=
-
1
;
/* Compute the mirror centre and put it on grid */
wxPoint
Center
=
block
->
Centre
();
PutOnGrid
(
&
Center
);
MirrorStruct
(
DrawPanel
,
DC
,
(
SCH_ITEM
*
)
block
->
m_BlockDrawStruct
,
Center
);
MirrorListOfItems
(
block
->
m_ItemsSelection
,
Center
);
GetScreen
()
->
SetModify
();
}
TestDanglingEnds
(
GetScreen
()
->
EEDrawList
,
DC
);
DrawPanel
->
Refresh
();
break
;
default
:
...
...
@@ -484,16 +455,14 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
if
(
ii
<=
0
)
{
block
->
m_BlockDrawStruct
=
NULL
;
block
->
ClearItemsList
()
;
block
->
m_Flags
=
0
;
block
->
m_State
=
STATE_NO_BLOCK
;
block
->
m_Command
=
BLOCK_IDLE
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
GetScreen
()
->
SetCurItem
(
NULL
);
SetToolID
(
m_ID_current_state
,
DrawPanel
->
m_PanelDefaultCursor
,
wxEmptyString
);
SetToolID
(
m_ID_current_state
,
DrawPanel
->
m_PanelDefaultCursor
,
wxEmptyString
);
}
}
...
...
@@ -507,121 +476,53 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
* L'ensemble du block suit le curseur
*/
{
DrawBlockStruct
*
PtBlock
;
DrawPickedStruct
*
PickedList
;
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
BLOCK_SELECTOR
*
block
=
&
panel
->
GetScreen
()
->
m_BlockLocate
;;
PtBlock
=
&
panel
->
GetScreen
()
->
BlockLocate
;
GRSetDrawMode
(
DC
,
g_XorMode
)
;
BASE_SCREEN
*
screen
=
panel
->
GetScreen
()
;
SCH_ITEM
*
schitem
;
/* Effacement ancien cadre */
if
(
erase
&&
PtBlock
->
m_BlockDrawStruct
)
if
(
erase
)
{
PtBlock
->
Offset
(
PtBlock
->
m_MoveVector
);
PtBlock
->
Draw
(
panel
,
DC
);
PtBlock
->
Offset
(
-
PtBlock
->
m_MoveVector
.
x
,
-
PtBlock
->
m_MoveVector
.
y
);
/* Effacement ancien affichage */
if
(
PtBlock
->
m_BlockDrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
block
->
Draw
(
panel
,
DC
,
block
->
m_MoveVector
,
g_XorMode
,
block
->
m_Color
);
for
(
unsigned
ii
=
0
;
ii
<
block
->
GetCount
();
ii
++
)
{
PickedList
=
(
DrawPickedStruct
*
)
PtBlock
->
m_BlockDrawStruct
;
while
(
PickedList
)
{
DrawStructsInGhost
(
panel
,
DC
,
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
,
PtBlock
->
m_MoveVector
.
x
,
PtBlock
->
m_MoveVector
.
y
);
PickedList
=
(
DrawPickedStruct
*
)
PickedList
->
Next
();
}
schitem
=
(
SCH_ITEM
*
)
block
->
m_ItemsSelection
.
GetItemData
(
ii
);
DrawStructsInGhost
(
panel
,
DC
,
schitem
,
block
->
m_MoveVector
.
x
,
block
->
m_MoveVector
.
y
);
}
else
DrawStructsInGhost
(
panel
,
DC
,
(
SCH_ITEM
*
)
PtBlock
->
m_BlockDrawStruct
,
PtBlock
->
m_MoveVector
.
x
,
PtBlock
->
m_MoveVector
.
y
);
}
/* Redessin nouvel affichage */
PtBlock
->
m_MoveVector
.
x
=
screen
->
m_Curseur
.
x
-
PtBlock
->
m_BlockLastCursorPosition
.
x
;
PtBlock
->
m_MoveVector
.
y
=
screen
->
m_Curseur
.
y
-
PtBlock
->
m_BlockLastCursorPosition
.
y
;
block
->
m_MoveVector
=
screen
->
m_Curseur
-
block
->
m_BlockLastCursorPosition
;
GRSetDrawMode
(
DC
,
g_XorMode
);
PtBlock
->
Offset
(
PtBlock
->
m_MoveVector
);
PtBlock
->
Draw
(
panel
,
DC
);
PtBlock
->
Offset
(
-
PtBlock
->
m_MoveVector
.
x
,
-
PtBlock
->
m_MoveVector
.
y
);
block
->
Draw
(
panel
,
DC
,
block
->
m_MoveVector
,
g_XorMode
,
block
->
m_Color
);
if
(
PtBlock
->
m_BlockDrawStruct
)
for
(
unsigned
ii
=
0
;
ii
<
block
->
GetCount
();
ii
++
)
{
if
(
PtBlock
->
m_BlockDrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
PickedList
=
(
DrawPickedStruct
*
)
PtBlock
->
m_BlockDrawStruct
;
while
(
PickedList
)
{
DrawStructsInGhost
(
panel
,
DC
,
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
,
PtBlock
->
m_MoveVector
.
x
,
PtBlock
->
m_MoveVector
.
y
);
PickedList
=
(
DrawPickedStruct
*
)
PickedList
->
Next
();
}
}
else
DrawStructsInGhost
(
panel
,
DC
,
(
SCH_ITEM
*
)
PtBlock
->
m_BlockDrawStruct
,
PtBlock
->
m_MoveVector
.
x
,
PtBlock
->
m_MoveVector
.
y
);
schitem
=
(
SCH_ITEM
*
)
block
->
m_ItemsSelection
.
GetItemData
(
ii
);
DrawStructsInGhost
(
panel
,
DC
,
schitem
,
block
->
m_MoveVector
.
x
,
block
->
m_MoveVector
.
y
);
}
}
/*****************************************************************************
* Routine to move an object(s) to a new position. *
* If DrawStruct is of type DrawPickedStruct, a list of objects picked is *
* assumed, otherwise exactly one structure is assumed been picked. *
* Routine to move objects to a new position. *
*****************************************************************************/
bool
MoveStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
SCH_ITEM
*
DrawStruc
t
)
void
MoveListOfItems
(
SCH_SCREEN
*
aScreen
,
PICKED_ITEMS_LIST
&
aItemsLis
t
)
{
if
(
!
DrawStruct
)
return
FALSE
;
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
DrawPickedStruct
*
pickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
if
(
DC
)
panel
->
PostDirtyRect
(
pickedList
->
GetBoundingBoxUnion
()
);
PlaceStruct
(
panel
->
GetScreen
(),
(
SCH_ITEM
*
)
pickedList
);
// Place it in its new position.
if
(
DC
)
RedrawStructList
(
panel
,
DC
,
(
SCH_ITEM
*
)
pickedList
,
GR_DEFAULT_DRAWMODE
);
// Free the wrapper DrawPickedStruct chain
pickedList
->
DeleteWrapperList
();
}
else
{
if
(
DC
)
panel
->
PostDirtyRect
(
DrawStruct
->
GetBoundingBox
()
);
PlaceStruct
(
panel
->
GetScreen
(),
DrawStruct
);
/* Place it in its new position. */
if
(
DC
)
RedrawOneStruct
(
panel
,
DC
,
DrawStruct
,
GR_DEFAULT_DRAWMODE
);
}
return
TRUE
;
PlaceItemsInList
(
aScreen
,
aItemsList
);
/* Place it in its new position. */
}
static
void
MirrorYPoint
(
wxPoint
&
point
,
wxPoint
&
Center
)
{
point
.
x
-=
Center
.
x
;
NEGATE
(
point
.
x
);
NEGATE
(
point
.
x
);
point
.
x
+=
Center
.
x
;
}
...
...
@@ -641,7 +542,7 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
SCH_COMPONENT
*
DrawLibItem
;
DrawSheetStruct
*
DrawSheet
;
Hierarchical_PIN_Sheet_Struct
*
DrawSheetLabel
;
MARKER_SCH
*
DrawMarker
;
MARKER_SCH
*
DrawMarker
;
DrawNoConnectStruct
*
DrawNoConnect
;
SCH_TEXT
*
DrawText
;
wxPoint
px
;
...
...
@@ -684,7 +585,7 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
case
DRAW_BUSENTRY_STRUCT_TYPE
:
DrawRaccord
=
(
DrawBusEntryStruct
*
)
DrawStruct
;
MirrorYPoint
(
DrawRaccord
->
m_Pos
,
Center
);
NEGATE
(
DrawRaccord
->
m_Size
.
x
);
NEGATE
(
DrawRaccord
->
m_Size
.
x
);
break
;
case
DRAW_JUNCTION_STRUCT_TYPE
:
...
...
@@ -711,9 +612,9 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
DrawText
=
(
SCH_TEXT
*
)
DrawStruct
;
px
=
DrawText
->
m_Pos
;
if
(
DrawText
->
m_Orient
==
0
)
/* horizontal text */
dx
=
DrawText
->
LenSize
(
DrawText
->
m_Text
)
/
2
;
dx
=
DrawText
->
LenSize
(
DrawText
->
m_Text
)
/
2
;
else
if
(
DrawText
->
m_Orient
==
2
)
/* invert horizontal text*/
dx
=
-
DrawText
->
LenSize
(
DrawText
->
m_Text
)
/
2
;
dx
=
-
DrawText
->
LenSize
(
DrawText
->
m_Text
)
/
2
;
else
dx
=
0
;
px
.
x
+=
dx
;
...
...
@@ -786,165 +687,76 @@ void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center )
/*****************************************************************************
* Routine to Mirror an object(s). *
* If DrawStruct is of type DrawPickedStruct, a list of objects picked is *
* assumed, otherwise exactly one structure is assumed been picked. *
* Routine to Mirror objects. *
*****************************************************************************/
bool
MirrorStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
SCH_ITEM
*
DrawStruct
,
wxPoint
&
Center
)
void
MirrorListOfItems
(
PICKED_ITEMS_LIST
&
aItemsList
,
wxPoint
&
Center
)
{
if
(
!
DrawStruct
)
return
FALSE
;
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
for
(
unsigned
ii
=
0
;
ii
<
aItemsList
.
GetCount
();
ii
++
)
{
DrawPickedStruct
*
pickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
if
(
DC
)
panel
->
PostDirtyRect
(
pickedList
->
GetBoundingBoxUnion
()
);
for
(
DrawPickedStruct
*
cur
=
pickedList
;
cur
;
cur
=
cur
->
Next
()
)
{
MirrorOneStruct
(
(
SCH_ITEM
*
)
cur
->
m_PickedStruct
,
Center
);
cur
->
m_PickedStruct
->
m_Flags
=
0
;
}
if
(
DC
)
RedrawStructList
(
panel
,
DC
,
(
SCH_ITEM
*
)
pickedList
,
GR_DEFAULT_DRAWMODE
);
// Free the wrapper DrawPickedStruct chain
pickedList
->
DeleteWrapperList
();
}
else
{
if
(
DC
)
panel
->
PostDirtyRect
(
DrawStruct
->
GetBoundingBox
()
);
MirrorOneStruct
(
DrawStruct
,
Center
);
// Place it in its new position.
if
(
DC
)
RedrawOneStruct
(
panel
,
DC
,
DrawStruct
,
GR_DEFAULT_DRAWMODE
);
DrawStruct
->
m_Flags
=
0
;
SCH_ITEM
*
item
=
(
SCH_ITEM
*
)
aItemsList
.
GetItemData
(
ii
);
MirrorOneStruct
(
item
,
Center
);
// Place it in its new position.
item
->
m_Flags
=
0
;
}
return
true
;
}
/*****************************************************************************/
static
SCH_ITEM
*
CopyStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
BASE_SCREEN
*
screen
,
SCH_ITEM
*
DrawStruct
)
void
CopyItemsInList
(
SCH_SCREEN
*
screen
,
PICKED_ITEMS_LIST
&
aItemsList
)
/*****************************************************************************/
/* Routine to copy a new entity of an object and reposition it.
* If DrawStruct is of type DrawPickedStruct, a list of objects picked is
* assumed, otherwise exactly one structure is assumed been picked.
* Return the new created struct
/* Routine to copy a new entity of an object for each object in list and reposition it.
* Return the new created object list in aItemsList
*/
{
SCH_ITEM
*
NewDrawStruct
;
DrawPickedStruct
*
PickedList
=
NULL
;
if
(
!
DrawStruct
)
return
FALSE
;
SCH_ITEM
*
newitem
;
NewDrawStruct
=
DuplicateStruct
(
DrawStruct
);
if
(
NewDrawStruct
==
NULL
)
return
NULL
;
if
(
aItemsList
.
GetCount
()
==
0
)
return
;
PlaceStruct
(
screen
,
NewDrawStruct
);
/* Draw the new structure and chain it in: */
if
(
NewDrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
for
(
unsigned
ii
=
0
;
ii
<
aItemsList
.
GetCount
();
ii
++
)
{
PickedList
=
(
DrawPickedStruct
*
)
NewDrawStruct
;
while
(
PickedList
)
// Clear annotation for new components
newitem
=
DuplicateStruct
(
(
SCH_ITEM
*
)
aItemsList
.
GetItemData
(
ii
)
);
aItemsList
.
SetItem
(
newitem
,
ii
);
aItemsList
.
SetItemStatus
(
IS_NEW
,
ii
);
{
EDA_BaseStruct
*
Struct
=
PickedList
->
m_PickedStruct
;
switch
(
Struct
->
Type
()
)
switch
(
newitem
->
Type
()
)
{
case
TYPE_SCH_COMPONENT
:
(
(
SCH_COMPONENT
*
)
Struct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
Struct
)
->
ClearAnnotation
(
NULL
);
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_NOCONNECT_STRUCT_TYPE
:
default
:
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
//DuplicateStruct calls GenCopy, which should handle
//m_AssociatedScreen, m_TimeStamp and m_sRefCount properly.
{
DrawSheetStruct
*
sheet
=
(
DrawSheetStruct
*
)
newitem
;
sheet
->
m_TimeStamp
=
GetTimeStamp
();
sheet
->
SetSon
(
NULL
);
break
;
default
:
;
}
SetaParent
(
Struct
,
screen
);
PickedList
=
(
DrawPickedStruct
*
)
PickedList
->
Next
();
}
RedrawStructList
(
panel
,
DC
,
NewDrawStruct
,
GR_DEFAULT_DRAWMODE
);
/* Chain the new items */
PickedList
=
(
DrawPickedStruct
*
)
NewDrawStruct
;
while
(
PickedList
)
{
PickedList
->
m_PickedStruct
->
SetNext
(
screen
->
EEDrawList
);
screen
->
EEDrawList
=
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
;
PickedList
=
PickedList
->
Next
();
}
}
else
{
switch
(
NewDrawStruct
->
Type
()
)
{
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_NOCONNECT_STRUCT_TYPE
:
default
:
break
;
case
DRAW_SHEET_STRUCT_TYPE
:
{
DrawSheetStruct
*
sheet
=
(
DrawSheetStruct
*
)
NewDrawStruct
;
sheet
->
m_TimeStamp
=
GetTimeStamp
();
sheet
->
SetSon
(
NULL
);
break
;
}
case
TYPE_SCH_COMPONENT
:
(
(
SCH_COMPONENT
*
)
newitem
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
newitem
)
->
ClearAnnotation
(
NULL
);
break
;
}
case
TYPE_SCH_COMPONENT
:
(
(
SCH_COMPONENT
*
)
NewDrawStruct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
NewDrawStruct
)
->
ClearAnnotation
(
NULL
);
break
;
SetaParent
(
newitem
,
screen
);
newitem
->
SetNext
(
screen
->
EEDrawList
);
screen
->
EEDrawList
=
newitem
;
}
RedrawOneStruct
(
panel
,
DC
,
NewDrawStruct
,
GR_DEFAULT_DRAWMODE
);
SetaParent
(
NewDrawStruct
,
screen
);
NewDrawStruct
->
SetNext
(
screen
->
EEDrawList
);
screen
->
EEDrawList
=
NewDrawStruct
;
}
/* Free the original DrawPickedStruct chain: */
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
PickedList
->
DeleteWrapperList
();
}
return
NewDrawStruct
;
PlaceItemsInList
(
screen
,
aItemsList
)
;
}
...
...
@@ -966,8 +778,8 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
{
/* Cette stucture est rattachee a une feuille, et n'est pas
* accessible par la liste globale directement */
frame
->
SaveCopyInUndoList
(
(
SCH_ITEM
*
)
(
(
Hierarchical_PIN_Sheet_Struct
*
)
DrawStruct
)
->
GetParent
(),
frame
->
SaveCopyInUndoList
(
(
SCH_ITEM
*
)(
(
Hierarchical_PIN_Sheet_Struct
*
)
DrawStruct
)
->
GetParent
(),
IS_CHANGED
);
frame
->
DeleteSheetLabel
(
DC
?
true
:
false
,
(
Hierarchical_PIN_Sheet_Struct
*
)
DrawStruct
);
...
...
@@ -982,7 +794,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
cur
;
cur
=
cur
->
Next
()
)
{
SCH_ITEM
*
item
=
(
SCH_ITEM
*
)
cur
->
m_PickedStruct
;
SCH_ITEM
*
item
=
(
SCH_ITEM
*
)
cur
->
m_PickedStruct
;
screen
->
RemoveFromDrawList
(
item
);
panel
->
PostDirtyRect
(
item
->
GetBoundingBox
()
);
item
->
SetNext
(
0
);
...
...
@@ -1003,18 +815,13 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
DrawStruct
->
SetNext
(
0
);
DrawStruct
->
SetBack
(
0
);
// Only one struct -> no link
if
(
DrawStruct
->
Type
()
==
DRAW_SHEET_STRUCT_TYPE
)
{
frame
->
SaveCopyInUndoList
(
DrawStruct
,
IS_DELETED
);
// Currently In TEST
}
else
frame
->
SaveCopyInUndoList
(
DrawStruct
,
IS_DELETED
);
frame
->
SaveCopyInUndoList
(
DrawStruct
,
IS_DELETED
);
}
}
/*****************************************************************/
SCH_ITEM
*
SaveStructListForPaste
(
SCH_ITEM
*
DrawStruc
t
)
void
SaveStructListForPaste
(
PICKED_ITEMS_LIST
&
aItemsLis
t
)
/*****************************************************************/
/* Routine to Save an object from global drawing object list.
...
...
@@ -1023,109 +830,64 @@ SCH_ITEM* SaveStructListForPaste( SCH_ITEM* DrawStruct )
* - List is saved in g_BlockSaveDataList
*/
{
DrawPickedStruct
*
PickedList
;
SCH_ITEM
*
DrawStructCopy
;
g_BlockSaveDataList
.
ClearListAndDeleteItems
();
// delete previous saved list, if exists
if
(
!
DrawStruct
)
return
NULL
;
/* Make a copy of the original picked item. */
DrawStructCopy
=
DuplicateStruct
(
DrawStruct
);
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
/* save the new list: */
ITEM_PICKER
item
;
for
(
unsigned
ii
=
0
;
ii
<
aItemsList
.
GetCount
();
ii
++
)
{
/* Delete the picked wrapper if this is a picked list. */
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
PickedList
->
DeleteWrapperList
();
}
/* And delete old list and save the new list: */
if
(
g_BlockSaveDataList
)
/* Delete last deleted item or item list */
{
EDA_BaseStruct
*
item
=
g_BlockSaveDataList
,
*
next_item
;
while
(
item
)
{
next_item
=
item
->
Next
();
delete
item
;
item
=
next_item
;
}
/* Make a copy of the original picked item. */
SCH_ITEM
*
DrawStructCopy
=
DuplicateStruct
(
(
SCH_ITEM
*
)
aItemsList
.
GetItemData
(
ii
)
);
DrawStructCopy
->
SetParent
(
NULL
);
item
.
m_Item
=
DrawStructCopy
;
g_BlockSaveDataList
.
PushItem
(
item
);
}
g_BlockSaveDataList
=
DrawStructCopy
;
DrawStructCopy
->
SetParent
(
NULL
);
return
DrawStructCopy
;
}
/*****************************************************************************
* Routine to paste a structure from the g_BlockSaveDataList stack.
*
* This routine is the same as undelete but original list is NOT removed.
*
* Routine to paste a structure from the g_BlockSaveDataList stack.
* This routine is the same as undelete but original list is NOT removed.
*****************************************************************************/
void
WinEDA_SchematicFrame
::
Paste
Struct
(
wxDC
*
DC
)
void
WinEDA_SchematicFrame
::
Paste
ListOfItems
(
wxDC
*
DC
)
{
SCH_ITEM
*
DrawStruct
;
DrawPickedStruct
*
PickedList
=
NULL
;
SCH_ITEM
*
Struct
;
if
(
g_BlockSaveDataList
==
NULL
)
if
(
g_BlockSaveDataList
.
GetCount
()
==
0
)
{
DisplayError
(
this
,
wxT
(
"No struct to paste"
)
);
return
;
}
DrawStruct
=
DuplicateStruct
(
g_BlockSaveDataList
);
PICKED_ITEMS_LIST
picklist
;
picklist
.
m_UndoRedoType
=
IS_NEW
;
PlaceStruct
(
GetScreen
(),
DrawStruct
);
RedrawStructList
(
DrawPanel
,
DC
,
DrawStruct
,
GR_DEFAULT_DRAWMODE
);
// Clear annotation and init new time stamp for the new components:
if
(
DrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
// Creates data, and push it as new data in undo item list buffer
ITEM_PICKER
picker
(
NULL
,
IS_NEW
);
for
(
unsigned
ii
=
0
;
ii
<
g_BlockSaveDataList
.
GetCount
();
ii
++
)
{
for
(
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
PickedList
!=
NULL
;
)
// Clear annotation for new components
{
EDA_BaseStruct
*
Struct
=
PickedList
->
m_PickedStruct
;
if
(
Struct
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
(
(
SCH_COMPONENT
*
)
Struct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
Struct
)
->
ClearAnnotation
(
NULL
);
SetaParent
(
Struct
,
GetScreen
()
);
}
PickedList
=
(
DrawPickedStruct
*
)
PickedList
->
Next
();
}
RedrawStructList
(
DrawPanel
,
DC
,
DrawStruct
,
GR_DEFAULT_DRAWMODE
);
for
(
PickedList
=
(
DrawPickedStruct
*
)
DrawStruct
;
PickedList
!=
NULL
;
)
{
SCH_ITEM
*
Struct
=
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
;
Struct
->
SetNext
(
GetScreen
()
->
EEDrawList
);
SetaParent
(
Struct
,
GetScreen
()
);
GetScreen
()
->
EEDrawList
=
Struct
;
PickedList
=
PickedList
->
Next
();
}
Struct
=
DuplicateStruct
(
(
SCH_ITEM
*
)
g_BlockSaveDataList
.
m_ItemsSelection
.
GetItemData
(
ii
)
);
picker
.
m_Item
=
Struct
;
picklist
.
PushItem
(
picker
);
/* Save wrapper list in undo stack */
SaveCopyInUndoList
(
DrawStruct
,
IS_NEW
);
}
else
{
if
(
DrawStruct
->
Type
()
==
TYPE_SCH_COMPONENT
)
// Clear annotation and init new time stamp for the new components:
if
(
Struct
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
(
(
SCH_COMPONENT
*
)
Draw
Struct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
Draw
Struct
)
->
ClearAnnotation
(
NULL
);
(
(
SCH_COMPONENT
*
)
Struct
)
->
m_TimeStamp
=
GetTimeStamp
();
(
(
SCH_COMPONENT
*
)
Struct
)
->
ClearAnnotation
(
NULL
);
}
SetaParent
(
DrawStruct
,
GetScreen
()
);
RedrawOneStruct
(
DrawPanel
,
DC
,
DrawStruct
,
GR_DEFAULT_DRAWMODE
);
DrawStruct
->
SetNext
(
GetScreen
()
->
EEDrawList
);
GetScreen
()
->
EEDrawList
=
DrawStruct
;
SaveCopyInUndoList
(
DrawStruct
,
IS_NEW
);
SetaParent
(
Struct
,
GetScreen
()
);
RedrawOneStruct
(
DrawPanel
,
DC
,
Struct
,
GR_DEFAULT_DRAWMODE
);
Struct
->
SetNext
(
GetScreen
()
->
EEDrawList
);
GetScreen
()
->
EEDrawList
=
Struct
;
}
SaveCopyInUndoList
(
picklist
,
IS_NEW
);
PlaceItemsInList
(
GetScreen
(),
picklist
);
/* clear .m_Flags member for all items */
SCH_ITEM
*
Struct
;
for
(
Struct
=
GetScreen
()
->
EEDrawList
;
Struct
!=
NULL
;
Struct
=
Struct
->
Next
()
)
for
(
Struct
=
GetScreen
()
->
EEDrawList
;
Struct
!=
NULL
;
Struct
=
Struct
->
Next
()
)
Struct
->
m_Flags
=
0
;
GetScreen
()
->
SetModify
();
...
...
@@ -1134,54 +896,63 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
}
/*****************************************************************************
* Routine to place a given object. *
*****************************************************************************/
bool
PlaceStruct
(
BASE_SCREEN
*
screen
,
SCH_ITEM
*
DrawStruct
)
/** function DeleteItemsInList
* delete schematic items in aItemsList
* deleted items are put in undo list
*/
void
DeleteItemsInList
(
WinEDA_DrawPanel
*
panel
,
PICKED_ITEMS_LIST
&
aItemsList
)
{
DrawPickedStruct
*
DrawStructs
;
wxPoint
move_vector
;
if
(
!
DrawStruct
)
return
FALSE
;
move_vector
=
screen
->
m_Curseur
-
screen
->
BlockLocate
.
m_BlockLastCursorPosition
;
SCH_SCREEN
*
screen
=
(
SCH_SCREEN
*
)
panel
->
GetScreen
();
WinEDA_SchematicFrame
*
frame
=
(
WinEDA_SchematicFrame
*
)
panel
->
m_Parent
;
PICKED_ITEMS_LIST
itemsList
;
ITEM_PICKER
itemWrapper
;
switch
(
DrawStruct
->
Type
()
)
for
(
unsigned
ii
=
0
;
ii
<
aItemsList
.
GetCount
();
ii
++
)
{
default
:
case
TYPE_NOT_INIT
:
return
FALSE
;
case
DRAW_POLYLINE_STRUCT_TYPE
:
case
DRAW_JUNCTION_STRUCT_TYPE
:
case
DRAW_SEGMENT_STRUCT_TYPE
:
case
DRAW_BUSENTRY_STRUCT_TYPE
:
case
TYPE_SCH_TEXT
:
case
TYPE_SCH_LABEL
:
case
TYPE_SCH_GLOBALLABEL
:
case
TYPE_SCH_HIERLABEL
:
case
TYPE_SCH_COMPONENT
:
case
DRAW_SHEET_STRUCT_TYPE
:
case
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
:
case
DRAW_MARKER_STRUCT_TYPE
:
case
DRAW_NOCONNECT_STRUCT_TYPE
:
MoveOneStruct
(
DrawStruct
,
move_vector
);
break
;
case
DRAW_PICK_ITEM_STRUCT_TYPE
:
DrawStructs
=
(
DrawPickedStruct
*
)
DrawStruct
;
while
(
DrawStructs
)
SCH_ITEM
*
item
=
(
SCH_ITEM
*
)
aItemsList
.
GetItemData
(
ii
);
itemWrapper
.
m_Item
=
item
;
itemWrapper
.
m_UndoRedoStatus
=
IS_DELETED
;
if
(
item
->
Type
()
==
DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE
)
{
MoveOneStruct
(
(
SCH_ITEM
*
)
DrawStructs
->
m_PickedStruct
,
move_vector
);
DrawStructs
=
DrawStructs
->
Next
();
/* this item is depending on a sheet, and is not in global list */
wxMessageBox
(
wxT
(
"DeleteItemsInList() err: unexpected DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE"
)
);
#if 0
Hierarchical_PIN_Sheet_Struct* pinlabel = (Hierarchical_PIN_Sheet_Struct*) item;
frame->DeleteSheetLabel( false, pinlabel->m_Parent );
itemWrapper.m_Item = pinlabel->m_Parent;
itemWrapper.m_UndoRedoStatus = IS_CHANGED;
itemsList.PushItem( itemWrapper );
#endif
}
else
{
screen
->
RemoveFromDrawList
(
item
);
break
;
/* Unlink the structure */
item
->
SetNext
(
0
);
item
->
SetBack
(
0
);
itemsList
.
PushItem
(
itemWrapper
);
}
}
return
TRUE
;
frame
->
SaveCopyInUndoList
(
itemsList
,
IS_DELETED
);
}
/*****************************************************************************
* Routine to place a given object. *
*****************************************************************************/
void
PlaceItemsInList
(
SCH_SCREEN
*
aScreen
,
PICKED_ITEMS_LIST
&
aItemsList
)
{
wxPoint
move_vector
;
move_vector
=
aScreen
->
m_Curseur
-
aScreen
->
m_BlockLocate
.
m_BlockLastCursorPosition
;
for
(
unsigned
ii
=
0
;
ii
<
aItemsList
.
GetCount
();
ii
++
)
{
SCH_ITEM
*
item
=
(
SCH_ITEM
*
)
aItemsList
.
GetItemData
(
ii
);
MoveOneStruct
(
item
,
move_vector
);
}
}
...
...
@@ -1199,7 +970,7 @@ void MoveOneStruct( SCH_ITEM* DrawStruct, const wxPoint& move_vector )
SCH_COMPONENT
*
DrawLibItem
;
DrawSheetStruct
*
DrawSheet
;
Hierarchical_PIN_Sheet_Struct
*
DrawSheetLabel
;
MARKER_SCH
*
DrawMarker
;
MARKER_SCH
*
DrawMarker
;
DrawNoConnectStruct
*
DrawNoConnect
;
if
(
!
DrawStruct
)
...
...
@@ -1400,7 +1171,7 @@ SCH_ITEM* DuplicateStruct( SCH_ITEM* DrawStruct )
DrawStruct
->
Type
()
<<
wxT
(
" "
)
<<
DrawStruct
->
GetClass
();
DisplayError
(
NULL
,
msg
);
}
break
;
break
;
}
NewDrawStruct
->
m_Image
=
DrawStruct
;
...
...
@@ -1413,71 +1184,61 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/****************************************************/
/* creates the list of items found when a drag block is initiated.
* items are those slected in window block an some items outside this area but connected
* items are those s
e
lected in window block an some items outside this area but connected
* to a selected item (connected wires to a component or an entry )
*/
{
DrawPickedStruct
*
DrawStructs
,
*
FirstPicked
;
SCH_ITEM
*
Struct
;
EDA_DrawLineStruct
*
SegmStruct
;
int
ox
,
oy
,
fx
,
fy
;
/* .m_Flags member is used to handle how a wire is exactly slected
PICKED_ITEMS_LIST
*
pickedlist
=
&
screen
->
m_BlockLocate
.
m_ItemsSelection
;
if
(
pickedlist
->
GetCount
()
==
0
)
return
;
/* .m_Flags member is used to handle how a wire is exactly selected
* (fully selected, or partially selected by an end point )
*/
for
(
Struct
=
screen
->
EEDrawList
;
Struct
!=
NULL
;
Struct
=
Struct
->
Next
()
)
Struct
->
m_Flags
=
0
;
// Sel .m_Flags to selected for a wire or buss in selected area if there is only one item:
if
(
screen
->
BlockLocate
.
m_BlockDrawStruct
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
screen
->
BlockLocate
.
m_BlockDrawStruct
->
m_Flags
=
SELECTED
;
// Sel .m_Flags to selected for a wire or buss in selected area for a list of items:
else
if
(
screen
->
BlockLocate
.
m_BlockDrawStruct
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
// Sel .m_Flags to selected for a wire or bus in selected area if there is only one item:
if
(
pickedlist
->
GetCount
()
==
1
)
{
Struct
=
(
SCH_ITEM
*
)
pickedlist
->
GetItemData
(
0
);
if
(
Struct
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
Struct
->
m_Flags
=
SELECTED
;
}
// Sel .m_Flags to selected for a wire or bus in selected area for a list of items:
else
{
DrawStructs
=
(
DrawPickedStruct
*
)
screen
->
BlockLocate
.
m_BlockDrawStruct
;
while
(
DrawStructs
)
for
(
unsigned
ii
=
0
;
ii
<
pickedlist
->
GetCount
();
ii
++
)
{
Struct
=
(
SCH_ITEM
*
)
DrawStructs
->
m_PickedStruct
;
DrawStructs
=
DrawStructs
->
Next
();
Struct
=
(
SCH_ITEM
*
)(
SCH_ITEM
*
)
pickedlist
->
GetItemData
(
ii
);
Struct
->
m_Flags
=
SELECTED
;
}
}
if
(
screen
->
BlockLocate
.
m_Command
!=
BLOCK_DRAG
)
if
(
screen
->
m_
BlockLocate
.
m_Command
!=
BLOCK_DRAG
)
return
;
ox
=
screen
->
BlockLocate
.
GetX
();
oy
=
screen
->
BlockLocate
.
GetY
();
fx
=
screen
->
BlockLocate
.
GetRight
();
fy
=
screen
->
BlockLocate
.
GetBottom
();
ox
=
screen
->
m_
BlockLocate
.
GetX
();
oy
=
screen
->
m_
BlockLocate
.
GetY
();
fx
=
screen
->
m_
BlockLocate
.
GetRight
();
fy
=
screen
->
m_
BlockLocate
.
GetBottom
();
if
(
fx
<
ox
)
EXCHG
(
fx
,
ox
);
if
(
fy
<
oy
)
EXCHG
(
fy
,
oy
);
/* For drag block only:
* If only one item, change for a list of one item
* in order to have always a list to handle.
*/
if
(
screen
->
BlockLocate
.
m_BlockDrawStruct
->
Type
()
!=
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
DrawStructs
=
new
DrawPickedStruct
(
(
SCH_ITEM
*
)
screen
->
BlockLocate
.
m_BlockDrawStruct
);
screen
->
BlockLocate
.
m_BlockDrawStruct
=
DrawStructs
;
}
/* Suppression du deplacement des extremites de segments hors cadre
* de selection */
DrawStructs
=
(
DrawPickedStruct
*
)
screen
->
BlockLocate
.
m_BlockDrawStruct
;
while
(
DrawStructs
)
for
(
unsigned
ii
=
0
;
ii
<
pickedlist
->
GetCount
();
ii
++
)
{
Struct
=
(
SCH_ITEM
*
)
DrawStructs
->
m_PickedStruct
;
DrawStructs
=
DrawStructs
->
Next
();
Struct
=
(
SCH_ITEM
*
)(
SCH_ITEM
*
)
pickedlist
->
GetItemData
(
ii
);
if
(
Struct
->
Type
()
==
DRAW_SEGMENT_STRUCT_TYPE
)
{
SegmStruct
=
(
EDA_DrawLineStruct
*
)
Struct
;
...
...
@@ -1494,21 +1255,20 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/* Search for other items to drag. They are end wires connected to selected items
*/
FirstPicked
=
DrawStructs
=
(
DrawPickedStruct
*
)
screen
->
BlockLocate
.
m_BlockDrawStruct
;
while
(
DrawStructs
)
for
(
unsigned
ii
=
0
;
ii
<
pickedlist
->
GetCount
();
ii
++
)
{
Struct
=
(
SCH_ITEM
*
)
DrawStructs
->
m_PickedStruct
;
DrawStructs
=
DrawStructs
->
Next
();
Struct
=
(
SCH_ITEM
*
)(
SCH_ITEM
*
)
pickedlist
->
GetItemData
(
ii
);
if
(
Struct
->
Type
()
==
TYPE_SCH_COMPONENT
)
{
// Add all pins of the selected component to list
{
// Add all pins of the selected component to list
LibEDA_BaseStruct
*
DrawItem
;
wxPoint
pos
;
DrawItem
=
GetNextPinPosition
(
(
SCH_COMPONENT
*
)
Struct
,
pos
);
while
(
DrawItem
)
{
if
(
(
pos
.
x
<
ox
)
||
(
pos
.
x
>
fx
)
||
(
pos
.
y
<
oy
)
||
(
pos
.
y
>
fy
)
)
{
// This pin is outside area,
{
// This pin is outside area,
// but because it it the pin of a selected component
// we must also select connected items to this pin
AddPickedItem
(
screen
,
pos
);
...
...
@@ -1519,7 +1279,8 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
}
if
(
Struct
->
Type
()
==
DRAW_SHEET_STRUCT_TYPE
)
{
// Add all pins sheets of a selected hierarchical sheet to the list
{
// Add all pins sheets of a selected hierarchical sheet to the list
Hierarchical_PIN_Sheet_Struct
*
SLabel
=
(
(
DrawSheetStruct
*
)
Struct
)
->
m_Label
;
while
(
SLabel
)
...
...
@@ -1543,16 +1304,21 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/******************************************************************/
static
void
AddPickedItem
(
SCH_SCREEN
*
screen
,
wxPoint
position
)
/******************************************************************/
/** AddPickedItem
* add to the picked list in screen->m_BlockLocate items found at location position
* @param screen = the screen to consider
* @param position = the wxPoint where items must be located to be select
*/
{
DrawPickedStruct
*
DrawStructs
;
SCH_ITEM
*
Struct
;
SCH_ITEM
*
Struct
;
/* Examen de la liste des elements deja selectionnes */
DrawStructs
=
(
DrawPickedStruct
*
)
screen
->
BlockLocate
.
m_BlockDrawStruct
;
while
(
DrawStructs
)
PICKED_ITEMS_LIST
*
pickedlist
=
&
screen
->
m_BlockLocate
.
m_ItemsSelection
;
for
(
unsigned
ii
=
0
;
ii
<
pickedlist
->
GetCount
();
ii
++
)
{
Struct
=
(
SCH_ITEM
*
)
DrawStructs
->
m_PickedStruct
;
DrawStructs
=
(
DrawPickedStruct
*
)
DrawStructs
->
Next
();
Struct
=
(
SCH_ITEM
*
)
pickedlist
->
GetItemData
(
ii
);
switch
(
Struct
->
Type
()
)
{
...
...
@@ -1573,6 +1339,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/* Examen de la liste des elements non selectionnes */
ITEM_PICKER
picker
;
Struct
=
screen
->
EEDrawList
;
while
(
Struct
)
{
...
...
@@ -1593,10 +1360,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break
;
/* Deja en liste */
if
(
STRUCT
->
m_Pos
!=
position
)
break
;
DrawStructs
=
new
DrawPickedStruct
(
Struct
);
DrawStructs
->
SetNext
(
screen
->
BlockLocate
.
m_BlockDrawStruct
);
screen
->
BlockLocate
.
m_BlockDrawStruct
=
(
EDA_BaseStruct
*
)
DrawStructs
;
picker
.
m_Item
=
Struct
;
pickedlist
->
PushItem
(
picker
);
break
;
case
DRAW_SEGMENT_STRUCT_TYPE
:
...
...
@@ -1606,21 +1371,17 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break
;
/* Deja en liste */
if
(
STRUCT
->
m_Start
==
position
)
{
DrawStructs
=
new
DrawPickedStruct
(
Struct
);
DrawStructs
->
SetNext
(
screen
->
BlockLocate
.
m_BlockDrawStruct
);
screen
->
BlockLocate
.
m_BlockDrawStruct
=
(
EDA_BaseStruct
*
)
DrawStructs
;
Struct
->
m_Flags
=
SELECTED
|
ENDPOINT
|
STARTPOINT
;
Struct
->
m_Flags
&=
~
STARTPOINT
;
picker
.
m_Item
=
Struct
;
pickedlist
->
PushItem
(
picker
);
}
else
if
(
STRUCT
->
m_End
==
position
)
{
DrawStructs
=
new
DrawPickedStruct
(
Struct
);
DrawStructs
->
SetNext
(
screen
->
BlockLocate
.
m_BlockDrawStruct
);
screen
->
BlockLocate
.
m_BlockDrawStruct
=
(
EDA_BaseStruct
*
)
DrawStructs
;
Struct
->
m_Flags
=
SELECTED
|
ENDPOINT
|
STARTPOINT
;
Struct
->
m_Flags
&=
~
ENDPOINT
;
picker
.
m_Item
=
Struct
;
pickedlist
->
PushItem
(
picker
);
}
break
;
...
...
@@ -1637,11 +1398,9 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break
;
/* Already in list */
if
(
STRUCT
->
m_Pos
!=
position
)
break
;
DrawStructs
=
new
DrawPickedStruct
(
Struct
);
DrawStructs
->
SetNext
(
screen
->
BlockLocate
.
m_BlockDrawStruct
);
screen
->
BlockLocate
.
m_BlockDrawStruct
=
(
EDA_BaseStruct
*
)
DrawStructs
;
Struct
->
m_Flags
|=
SELECTED
;
picker
.
m_Item
=
Struct
;
pickedlist
->
PushItem
(
picker
);
break
;
case
TYPE_SCH_HIERLABEL
:
...
...
@@ -1652,11 +1411,9 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break
;
/* Already in list */
if
(
STRUCT
->
m_Pos
!=
position
)
break
;
DrawStructs
=
new
DrawPickedStruct
(
Struct
);
DrawStructs
->
SetNext
(
screen
->
BlockLocate
.
m_BlockDrawStruct
);
screen
->
BlockLocate
.
m_BlockDrawStruct
=
(
EDA_BaseStruct
*
)
DrawStructs
;
Struct
->
m_Flags
|=
SELECTED
;
picker
.
m_Item
=
Struct
;
pickedlist
->
PushItem
(
picker
);
break
;
case
TYPE_SCH_COMPONENT
:
...
...
@@ -1678,11 +1435,9 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break
;
/* Already in list */
if
(
STRUCT
->
m_Pos
!=
position
)
break
;
DrawStructs
=
new
DrawPickedStruct
(
Struct
);
DrawStructs
->
SetNext
(
screen
->
BlockLocate
.
m_BlockDrawStruct
);
screen
->
BlockLocate
.
m_BlockDrawStruct
=
(
EDA_BaseStruct
*
)
DrawStructs
;
Struct
->
m_Flags
|=
SELECTED
;
picker
.
m_Item
=
Struct
;
pickedlist
->
PushItem
(
picker
);
break
;
case
DRAW_NOCONNECT_STRUCT_TYPE
:
...
...
@@ -1692,11 +1447,9 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
break
;
/* Already in list */
if
(
STRUCT
->
m_Pos
!=
position
)
break
;
DrawStructs
=
new
DrawPickedStruct
(
Struct
);
DrawStructs
->
SetNext
(
screen
->
BlockLocate
.
m_BlockDrawStruct
);
screen
->
BlockLocate
.
m_BlockDrawStruct
=
(
EDA_BaseStruct
*
)
DrawStructs
;
Struct
->
m_Flags
|=
SELECTED
;
picker
.
m_Item
=
Struct
;
pickedlist
->
PushItem
(
picker
);
break
;
default
:
...
...
eeschema/block_libedit.cpp
View file @
8ec8cf3f
...
...
@@ -255,21 +255,21 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
{
int
ItemsCount
=
0
,
MustDoPlace
=
0
;
if
(
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
)
if
(
GetScreen
()
->
m_BlockLocate
.
GetCount
()
)
{
BlockState
state
=
GetScreen
()
->
BlockLocate
.
m_State
;
CmdBlockType
command
=
GetScreen
()
->
BlockLocate
.
m_Command
;
BlockState
state
=
GetScreen
()
->
m_
BlockLocate
.
m_State
;
CmdBlockType
command
=
GetScreen
()
->
m_
BlockLocate
.
m_Command
;
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
DC
);
GetScreen
()
->
BlockLocate
.
m_State
=
state
;
GetScreen
()
->
BlockLocate
.
m_Command
=
command
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
state
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
command
;
DrawPanel
->
ManageCurseur
=
DrawAndSizingBlockOutlines
;
DrawPanel
->
ForceCloseManageCurseur
=
AbortBlockCurrentCommand
;
GetScreen
()
->
m_Curseur
.
x
=
GetScreen
()
->
BlockLocate
.
GetRight
();
GetScreen
()
->
m_Curseur
.
y
=
GetScreen
()
->
BlockLocate
.
GetBottom
();
GetScreen
()
->
m_Curseur
.
x
=
GetScreen
()
->
m_
BlockLocate
.
GetRight
();
GetScreen
()
->
m_Curseur
.
y
=
GetScreen
()
->
m_
BlockLocate
.
GetBottom
();
DrawPanel
->
MouseToCursorSchema
();
}
switch
(
GetScreen
()
->
BlockLocate
.
m_Command
)
switch
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
)
{
case
BLOCK_IDLE
:
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace"
)
);
...
...
@@ -278,7 +278,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_DRAG
:
/* Drag */
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_COPY
:
/* Copy */
ItemsCount
=
MarkItemsInBloc
(
CurrentLibEntry
,
GetScreen
()
->
BlockLocate
);
ItemsCount
=
MarkItemsInBloc
(
CurrentLibEntry
,
GetScreen
()
->
m_
BlockLocate
);
if
(
ItemsCount
)
{
MustDoPlace
=
1
;
...
...
@@ -288,7 +288,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
}
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
DrawPanel
->
Refresh
(
TRUE
);
}
break
;
...
...
@@ -296,11 +296,11 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
MustDoPlace
=
1
;
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
break
;
case
BLOCK_DELETE
:
/* Delete */
ItemsCount
=
MarkItemsInBloc
(
CurrentLibEntry
,
GetScreen
()
->
BlockLocate
);
ItemsCount
=
MarkItemsInBloc
(
CurrentLibEntry
,
GetScreen
()
->
m_
BlockLocate
);
if
(
ItemsCount
)
SaveCopyInUndoList
(
CurrentLibEntry
);
DeleteMarkedItems
(
CurrentLibEntry
);
...
...
@@ -315,14 +315,14 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_INVERT
:
ItemsCount
=
MarkItemsInBloc
(
CurrentLibEntry
,
GetScreen
()
->
BlockLocate
);
ItemsCount
=
MarkItemsInBloc
(
CurrentLibEntry
,
GetScreen
()
->
m_
BlockLocate
);
if
(
ItemsCount
)
SaveCopyInUndoList
(
CurrentLibEntry
);
MirrorMarkedItems
(
CurrentLibEntry
,
GetScreen
()
->
BlockLocate
.
Centre
()
);
MirrorMarkedItems
(
CurrentLibEntry
,
GetScreen
()
->
m_
BlockLocate
.
Centre
()
);
break
;
case
BLOCK_ZOOM
:
/* Window Zoom */
Window_Zoom
(
GetScreen
()
->
BlockLocate
);
Window_Zoom
(
GetScreen
()
->
m_
BlockLocate
);
break
;
case
BLOCK_ABORT
:
...
...
@@ -334,13 +334,13 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
if
(
MustDoPlace
<=
0
)
{
if
(
GetScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_SELECT_ITEMS_ONLY
)
if
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
!=
BLOCK_SELECT_ITEMS_ONLY
)
{
ClearMarkItems
(
CurrentLibEntry
);
}
GetScreen
()
->
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
m_
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
GetScreen
()
->
SetCurItem
(
NULL
);
...
...
@@ -371,9 +371,9 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
DisplayError
(
this
,
wxT
(
"HandleBlockPLace : ManageCurseur = NULL"
)
);
}
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
switch
(
GetScreen
()
->
BlockLocate
.
m_Command
)
switch
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
)
{
case
BLOCK_IDLE
:
err
=
TRUE
;
...
...
@@ -382,25 +382,25 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
case
BLOCK_DRAG
:
/* Drag */
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
SaveCopyInUndoList
(
CurrentLibEntry
);
MoveMarkedItems
(
CurrentLibEntry
,
GetScreen
()
->
BlockLocate
.
m_MoveVector
);
MoveMarkedItems
(
CurrentLibEntry
,
GetScreen
()
->
m_
BlockLocate
.
m_MoveVector
);
DrawPanel
->
Refresh
(
TRUE
);
break
;
case
BLOCK_COPY
:
/* Copy */
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
SaveCopyInUndoList
(
CurrentLibEntry
);
CopyMarkedItems
(
CurrentLibEntry
,
GetScreen
()
->
BlockLocate
.
m_MoveVector
);
CopyMarkedItems
(
CurrentLibEntry
,
GetScreen
()
->
m_
BlockLocate
.
m_MoveVector
);
break
;
case
BLOCK_PASTE
:
/* Paste (recopie du dernier bloc sauve */
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
break
;
case
BLOCK_INVERT
:
/* Invert by popup menu, from block move */
SaveCopyInUndoList
(
CurrentLibEntry
);
MirrorMarkedItems
(
CurrentLibEntry
,
GetScreen
()
->
BlockLocate
.
Centre
()
);
MirrorMarkedItems
(
CurrentLibEntry
,
GetScreen
()
->
m_
BlockLocate
.
Centre
()
);
break
;
case
BLOCK_ZOOM
:
// Handled by HandleBlockEnd
...
...
@@ -417,9 +417,9 @@ void WinEDA_LibeditFrame::HandleBlockPlace( wxDC* DC )
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
GetScreen
()
->
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
m_
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
SetCurItem
(
NULL
);
DrawPanel
->
Refresh
(
TRUE
);
...
...
@@ -436,20 +436,17 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
* L'ensemble du block suit le curseur
*/
{
DrawBlockStruct
*
PtBlock
;
BLOCK_SELECTOR
*
PtBlock
;
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
LibEDA_BaseStruct
*
item
;
wxPoint
move_offset
;
PtBlock
=
&
panel
->
GetScreen
()
->
BlockLocate
;
GRSetDrawMode
(
DC
,
g_XorMode
);
PtBlock
=
&
screen
->
m_BlockLocate
;
/* Effacement ancien cadre */
if
(
erase
)
{
PtBlock
->
Offset
(
PtBlock
->
m_MoveVector
);
PtBlock
->
Draw
(
panel
,
DC
);
PtBlock
->
Offset
(
-
PtBlock
->
m_MoveVector
.
x
,
-
PtBlock
->
m_MoveVector
.
y
);
PtBlock
->
Draw
(
panel
,
DC
,
PtBlock
->
m_MoveVector
,
g_XorMode
,
PtBlock
->
m_Color
);
if
(
CurrentLibEntry
)
{
...
...
@@ -474,9 +471,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
PtBlock
->
m_MoveVector
.
y
=
screen
->
m_Curseur
.
y
-
PtBlock
->
m_BlockLastCursorPosition
.
y
;
GRSetDrawMode
(
DC
,
g_XorMode
);
PtBlock
->
Offset
(
PtBlock
->
m_MoveVector
);
PtBlock
->
Draw
(
panel
,
DC
);
PtBlock
->
Offset
(
-
PtBlock
->
m_MoveVector
.
x
,
-
PtBlock
->
m_MoveVector
.
y
);
PtBlock
->
Draw
(
panel
,
DC
,
PtBlock
->
m_MoveVector
,
g_XorMode
,
PtBlock
->
m_Color
);
if
(
CurrentLibEntry
)
...
...
eeschema/eeschema.cpp
View file @
8ec8cf3f
...
...
@@ -40,7 +40,7 @@ bool g_LastSearchIsMarker; /* True if last seach is a marker serach
* Used for hotkey next search */
/* Block operation (copy, paste) */
SCH_ITEM
*
g_BlockSaveDataList
;
// List of items to paste (Created by Block Save)
BLOCK_SELECTOR
g_BlockSaveDataList
;
// List of items to paste (Created by Block Save)
// Gestion d'options
bool
g_HVLines
=
true
;
// Bool: force H or V directions (Wires, Bus ..)
...
...
eeschema/general.h
View file @
8ec8cf3f
...
...
@@ -112,7 +112,7 @@ extern bool g_LastSearchIsMarker; // True if last seach is a marker se
// Used for hotkey next search
/* Block operation (copy, paste) */
extern
SCH_ITEM
*
g_BlockSaveDataList
;
// List of items to paste (Created by Block Save)
extern
BLOCK_SELECTOR
g_BlockSaveDataList
;
// List of items to paste (Created by Block Save)
// Gestion d'options
extern
bool
g_HVLines
;
...
...
eeschema/hotkeys.cpp
View file @
8ec8cf3f
...
...
@@ -252,7 +252,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
break
;
case
HK_DELETE
:
if
(
!
ItemInEdit
&&
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
if
(
!
ItemInEdit
&&
screen
->
m_
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
{
RefreshToolBar
=
LocateAndDeleteItem
(
this
,
DC
);
GetScreen
()
->
SetModify
();
...
...
@@ -290,7 +290,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case
HK_BEGIN_WIRE
:
/* An item is selected. If edited and not a wire, a new command is not
* possible */
if
(
!
ItemInEdit
&&
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
if
(
!
ItemInEdit
&&
screen
->
m_
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
{
if
(
DrawStruct
&&
DrawStruct
->
m_Flags
)
{
...
...
eeschema/libedit_onrightclick.cpp
View file @
8ec8cf3f
...
...
@@ -29,7 +29,7 @@ bool WinEDA_LibeditFrame::OnRightClick(const wxPoint& MousePos, wxMenu * PopMenu
/********************************************************************************/
{
LibEDA_BaseStruct
*
DrawEntry
=
LocateItemUsingCursor
();
bool
BlockActive
=
(
GetScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
bool
BlockActive
=
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
if
(
CurrentLibEntry
==
NULL
)
return
true
;
...
...
@@ -232,14 +232,14 @@ void AddMenusForBlock(wxMenu * PopMenu, WinEDA_LibeditFrame * frame)
{
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_LIBEDIT_CANCEL_EDITING
,
_
(
"Cancel Block"
),
cancel_xpm
);
if
(
frame
->
GetScreen
()
->
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
if
(
frame
->
GetScreen
()
->
m_
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_ZOOM_BLOCK
,
_
(
"Zoom Block (drag middle mouse)"
),
zoom_selected_xpm
);
PopMenu
->
AppendSeparator
();
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PLACE_BLOCK
,
_
(
"Place Block"
),
apply_xpm
);
if
(
frame
->
GetScreen
()
->
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
if
(
frame
->
GetScreen
()
->
m_
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
{
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_SELECT_ITEMS_BLOCK
,
_
(
"Select Items"
),
green_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_COPY_BLOCK
,
...
...
eeschema/libframe.cpp
View file @
8ec8cf3f
...
...
@@ -730,34 +730,34 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_ZOOM_BLOCK
:
DrawPanel
->
m_AutoPAN_Request
=
false
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_ZOOM
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_ZOOM
;
HandleBlockEnd
(
&
dc
);
break
;
case
ID_POPUP_DELETE_BLOCK
:
DrawPanel
->
m_AutoPAN_Request
=
false
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_DELETE
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_DELETE
;
DrawPanel
->
MouseToCursorSchema
();
HandleBlockEnd
(
&
dc
);
break
;
case
ID_POPUP_COPY_BLOCK
:
DrawPanel
->
m_AutoPAN_Request
=
false
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_COPY
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_COPY
;
DrawPanel
->
MouseToCursorSchema
();
HandleBlockPlace
(
&
dc
);
break
;
case
ID_POPUP_SELECT_ITEMS_BLOCK
:
DrawPanel
->
m_AutoPAN_Request
=
false
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_SELECT_ITEMS_ONLY
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_SELECT_ITEMS_ONLY
;
DrawPanel
->
MouseToCursorSchema
();
HandleBlockEnd
(
&
dc
);
break
;
case
ID_POPUP_INVERT_BLOCK
:
DrawPanel
->
m_AutoPAN_Request
=
false
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_INVERT
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_INVERT
;
DrawPanel
->
MouseToCursorSchema
();
HandleBlockPlace
(
&
dc
);
break
;
...
...
eeschema/locate.cpp
View file @
8ec8cf3f
...
...
@@ -18,11 +18,10 @@
/* Routines Locales */
static
SCH_ITEM
*
LastSnappedStruct
=
NULL
;
static
int
PickedBoxMinX
,
PickedBoxMinY
,
PickedBoxMaxX
,
PickedBoxMaxY
;
static
bool
IsBox1InBox2
(
int
StartX1
,
int
StartY1
,
int
EndX1
,
int
EndY1
,
int
StartX2
,
int
StartY2
,
int
EndX2
,
int
EndY2
);
static
bool
SnapPoint2
(
const
wxPoint
&
aPosRef
,
int
SearchMask
,
SCH_ITEM
*
DrawList
,
DrawPickedStruct
*
DontSnapList
,
double
aScaleFactor
);
SCH_ITEM
*
DrawList
,
double
aScaleFactor
);
/*********************************************************************/
...
...
@@ -43,10 +42,10 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
while
(
DrawList
)
{
if
(
(
SnapPoint2
(
Screen
->
m_MousePosition
,
LIBITEM
,
DrawList
,
NULL
,
Screen
->
GetZoom
()
)
)
==
FALSE
)
DrawList
,
Screen
->
GetZoom
()
)
)
==
FALSE
)
{
if
(
(
SnapPoint2
(
Screen
->
m_Curseur
,
LIBITEM
,
DrawList
,
NULL
,
Screen
->
GetScalingFactor
()
)
)
==
FALSE
)
DrawList
,
Screen
->
GetScalingFactor
()
)
)
==
FALSE
)
break
;
}
component
=
(
SCH_COMPONENT
*
)
LastSnappedStruct
;
...
...
@@ -111,7 +110,7 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
return
NULL
;
if
(
(
Snapped
=
SnapPoint2
(
refpos
,
SearchMask
,
screen
->
EEDrawList
,
NULL
,
screen
->
GetScalingFactor
()
)
)
!=
FALSE
)
screen
->
EEDrawList
,
screen
->
GetScalingFactor
()
)
)
!=
FALSE
)
{
return
LastSnappedStruct
;
}
...
...
@@ -120,62 +119,45 @@ SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask
/***********************************************************************/
SCH_ITEM
*
PickStruct
(
EDA_Rect
&
block
,
BASE_SCREEN
*
screen
,
int
SearchMask
)
int
PickStruct
(
BLOCK_SELECTOR
&
aBlock
,
BASE_SCREEN
*
aScreen
)
/************************************************************************/
/* Search items in block
* Return:
* pointeur sur liste de pointeurs de structures si Plusieurs
* structures selectionnees.
* pointeur sur la structure si 1 seule
*
/** Function PickStruct
* Search items in a block
* @return items count
* @param aBlock a BLOCK_SELECTOR that gives the search area boundary
* list of items is stored in aBlock
*/
{
int
x
,
y
,
OrigX
,
OrigY
;
DrawPickedStruct
*
PickedList
=
NULL
,
*
PickedItem
;
SCH_ITEM
*
DrawStruct
;
int
itemcount
=
0
;
if
(
aScreen
==
NULL
)
return
itemcount
;
OrigX
=
b
lock
.
GetX
();
OrigY
=
b
lock
.
GetY
();
x
=
b
lock
.
GetRight
();
y
=
b
lock
.
GetBottom
();
OrigX
=
aB
lock
.
GetX
();
OrigY
=
aB
lock
.
GetY
();
x
=
aB
lock
.
GetRight
();
y
=
aB
lock
.
GetBottom
();
if
(
x
<
OrigX
)
EXCHG
(
x
,
OrigX
);
if
(
y
<
OrigY
)
EXCHG
(
y
,
OrigY
);
SCH_ITEM
*
DrawList
=
screen
->
EEDrawList
;
if
(
screen
==
NULL
||
DrawList
==
NULL
)
return
NULL
;
for
(
DrawStruct
=
DrawList
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Next
()
)
ITEM_PICKER
picker
;
SCH_ITEM
*
DrawStruct
=
aScreen
->
EEDrawList
;
for
(
;
DrawStruct
!=
NULL
;
DrawStruct
=
DrawStruct
->
Next
()
)
{
if
(
DrawStructInBox
(
OrigX
,
OrigY
,
x
,
y
,
DrawStruct
)
)
{
/* Put this structure in the picked list: */
PickedItem
=
new
DrawPickedStruct
(
DrawStruct
);
PickedItem
->
SetNext
(
PickedList
);
PickedList
=
PickedItem
;
picker
.
m_Item
=
DrawStruct
;
aBlock
.
PushItem
(
picker
);
itemcount
++
;
}
}
if
(
PickedList
&&
PickedList
->
Next
()
==
NULL
)
{
/* Only one item was picked - convert to scalar form (no list): */
PickedItem
=
PickedList
;
PickedList
=
(
DrawPickedStruct
*
)
PickedList
->
m_PickedStruct
;
SAFE_DELETE
(
PickedItem
);
}
if
(
PickedList
!=
NULL
)
{
PickedBoxMinX
=
OrigX
;
PickedBoxMinY
=
OrigY
;
PickedBoxMaxX
=
x
;
PickedBoxMaxY
=
y
;
}
return
(
SCH_ITEM
*
)
PickedList
;
return
itemcount
;
}
...
...
@@ -185,26 +167,13 @@ SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask )
* Note we use L1 norm as distance measure, as it is the fastest. *
* This routine updates LastSnappedStruct to the last object used in to snap *
* a point. This variable is global to this module only (see above). *
* If DontSnapList is not NULL, structes in this list are skipped. *
* The routine returns TRUE if point was snapped. *
*****************************************************************************/
bool
SnapPoint2
(
const
wxPoint
&
aPosRef
,
int
SearchMask
,
SCH_ITEM
*
DrawList
,
DrawPickedStruct
*
DontSnapList
,
double
aScaleFactor
)
SCH_ITEM
*
DrawList
,
double
aScaleFactor
)
{
DrawPickedStruct
*
DontSnap
;
for
(
;
DrawList
!=
NULL
;
DrawList
=
DrawList
->
Next
()
)
{
/* Make sure this structure is NOT in the dont snap list: */
DontSnap
=
DontSnapList
;
for
(
;
DontSnap
!=
NULL
;
DontSnap
=
DontSnap
->
Next
()
)
if
(
DontSnap
->
m_PickedStruct
==
DrawList
)
break
;
if
(
DontSnap
)
if
(
DontSnap
->
m_PickedStruct
==
DrawList
)
continue
;
int
hitminDist
=
MAX
(
g_DrawDefaultLineThickness
,
3
)
;
switch
(
DrawList
->
Type
()
)
{
...
...
eeschema/onrightclick.cpp
View file @
8ec8cf3f
...
...
@@ -54,7 +54,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
*/
{
SCH_ITEM
*
DrawStruct
=
(
SCH_ITEM
*
)
GetScreen
()
->
GetCurItem
();
bool
BlockActive
=
(
GetScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
bool
BlockActive
=
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
DrawPanel
->
m_CanStartBlock
=
-
1
;
// Ne pas engager un debut de bloc sur validation menu
...
...
@@ -608,13 +608,13 @@ void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame )
PopMenu
->
AppendSeparator
();
if
(
frame
->
GetScreen
()
->
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
if
(
frame
->
GetScreen
()
->
m_
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_ZOOM_BLOCK
,
_
(
"Window Zoom"
),
zoom_selected_xpm
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PLACE_BLOCK
,
_
(
"Place Block"
),
apply_xpm
);
if
(
frame
->
GetScreen
()
->
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
if
(
frame
->
GetScreen
()
->
m_
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
{
// After a block move (that is also a block selection) one can reselect a block function:
ADD_MENUITEM
(
PopMenu
,
wxID_COPY
,
_
(
"Save Block"
),
copy_button
);
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_COPY_BLOCK
,
...
...
eeschema/protos.h
View file @
8ec8cf3f
...
...
@@ -96,22 +96,20 @@ SCH_ITEM * DuplicateStruct(SCH_ITEM *DrawStruct);
void
MoveOneStruct
(
SCH_ITEM
*
DrawStructs
,
const
wxPoint
&
move_vector
);
/* Given a structure move it by move_vector. */
bool
PlaceStruct
(
BASE_SCREEN
*
screen
,
SCH_ITEM
*
DrawStruct
);
bool
MoveStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
SCH_ITEM
*
DrawStruct
);
void
DeleteStruct
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
SCH_ITEM
*
DrawStruct
);
bool
DrawStructInBox
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
SCH_ITEM
*
DrawStruct
);
/*************/
/* LOCATE.CPP */
/*************/
bool
DrawStructInBox
(
int
x1
,
int
y1
,
int
x2
,
int
y2
,
SCH_ITEM
*
DrawStruct
);
LibDrawPin
*
LocatePinByNumber
(
const
wxString
&
ePin_Number
,
SCH_COMPONENT
*
eComponent
);
SCH_COMPONENT
*
LocateSmallestComponent
(
SCH_SCREEN
*
Screen
);
/* Recherche du plus petit (en surface) composant pointe par la souris */
SCH_ITEM
*
PickStruct
(
EDA_Rect
&
block
,
BASE_SCREEN
*
screen
,
int
SearchMask
);
int
PickStruct
(
BLOCK_SELECTOR
&
aBlock
,
BASE_SCREEN
*
screen
);
SCH_ITEM
*
PickStruct
(
const
wxPoint
&
refpos
,
BASE_SCREEN
*
screen
,
int
SearchMask
);
/* 2 functions PickStruct:
Search in block, or Search at location pos
...
...
eeschema/schedit.cpp
View file @
8ec8cf3f
...
...
@@ -127,7 +127,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_CANCEL_CURRENT_COMMAND
:
if
(
screen
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
if
(
screen
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
DrawPanel
->
SetCursor
(
wxCursor
(
DrawPanel
->
m_PanelCursor
=
DrawPanel
->
m_PanelDefaultCursor
)
);
...
...
@@ -137,11 +137,11 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
&
dc
);
}
/* ne devrait pas etre execute, sauf bug: */
if
(
screen
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
if
(
screen
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
{
screen
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
screen
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
screen
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
screen
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
screen
->
m_
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
screen
->
m_BlockLocate
.
ClearItemsList
()
;
}
break
;
...
...
@@ -174,7 +174,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
wxID_CUT
:
if
(
screen
->
BlockLocate
.
m_Command
!=
BLOCK_MOVE
)
if
(
screen
->
m_
BlockLocate
.
m_Command
!=
BLOCK_MOVE
)
break
;
HandleBlockEndByPopUp
(
BLOCK_DELETE
,
&
dc
);
g_ItemToRepeat
=
NULL
;
...
...
@@ -389,7 +389,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_SCH_EDIT_SHEET
:
EditSheet
(
(
DrawSheetStruct
*
)
screen
->
GetCurItem
(),
&
dc
);
break
;
case
ID_POPUP_IMPORT_GLABEL
:
if
(
screen
->
GetCurItem
()
&&
screen
->
GetCurItem
()
->
Type
()
==
DRAW_SHEET_STRUCT_TYPE
)
GetScreen
()
->
SetCurItem
(
Import_PinSheet
(
(
DrawSheetStruct
*
)
screen
->
GetCurItem
(),
&
dc
)
);
...
...
@@ -426,7 +426,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
{
// The easiest way to handle a drag component is simulate a
// block drag command
if
(
screen
->
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
if
(
screen
->
m_
BlockLocate
.
m_State
==
STATE_NO_BLOCK
)
{
if
(
!
HandleBlockBegin
(
&
dc
,
BLOCK_DRAG
,
screen
->
m_Curseur
)
)
...
...
eeschema/schematic_undo_redo.cpp
View file @
8ec8cf3f
/********************************************/
/*
library editor: undo and redo functions
*/
/********************************************/
/********************************************
*****************
/
/*
eeschema: undo and redo functions for schematic editor
*/
/********************************************
*****************
/
#include "fctsys.h"
#include "gr_basic.h"
#include "common.h"
#include "confirm.h"
#include "class_drawpickedstruct.h"
...
...
@@ -11,18 +10,20 @@
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "id.h"
#include "protos.h"
#include "class_marker_sch.h"
/* Functions to undo and redo edit commands.
* commmands to undo are in CurrentScreen->m_UndoList
* commmands to redo are in CurrentScreen->m_RedoList
* commmands to undo are
stored
in CurrentScreen->m_UndoList
* commmands to redo are
stored
in CurrentScreen->m_RedoList
*
* m_UndoList and m_RedoList are a linked list of DrawPickedStruct.
* each DrawPickedStruct has its .m_Son member pointing to an item to undo or redo,
* or to a list of DrawPickedStruct which points (.m_PickedStruct membre)
* the items to undo or redo
* m_UndoList and m_RedoList handle a std::vector of PICKED_ITEMS_LIST
* Each PICKED_ITEMS_LIST handle a std::vector of pickers (class ITEM_PICKER),
* that store the list of schematic items that are concerned by the command to undo or redo
* and is created for each command to undo (handle also a command to redo).
* each picker has a pointer pointing to an item to undo or redo (in fact: deleted, added or modified),
* and has a pointer to a copy of this item, when this item has been modified
* (the old values of parameters are therefore saved)
*
* there are 3 cases:
* - delete item(s) command
...
...
@@ -31,45 +32,45 @@
*
* Undo command
* - delete item(s) command:
* deleted items are moved in undo list
*
=>
deleted items are moved in undo list
*
* - change item(s) command
* A copy of item(s) is made (a DrawPickedStruct list of wrappers)
* the .m_Image member of each wrapper points the modified item.
* => A copy of item(s) is made (a DrawPickedStruct list of wrappers)
* the .m_Link member of each wrapper points the modified item.
* the .m_Item member of each wrapper points the old copy of this item.
*
* - add item(s) command
* A list of item(s) is made
* the .m_Image member of each wrapper points the new item.
* =>A list of item(s) is made. The .m_Item member of each wrapper points the new item.
*
* Redo command
* - delete item(s) old command:
*
deleted items are moved in EEDrawList list
*
=> deleted items are moved in EEDrawList list, and in
*
* - change item(s) command
* the copy of item(s) is moved in Undo list
*
=>
the copy of item(s) is moved in Undo list
*
* - add item(s) command
* The list of item(s) is used to create a deleted list in undo list
* (same as a delete command)
* => The list of item(s) is used to create a deleted list in undo list(same as a delete command)
*
* A problem is the hierarchical sheet handling.
* the data associated (subhierarchy, uno/redo list) is deleted only
* when the sheet is really deleted (i.e. when deleted from undo or redo list)
*
and not when it is a copy
.
*
This is handled by its destructor
.
*/
/************************************/
/************************************
**************************
/
void
SwapData
(
EDA_BaseStruct
*
aItem
,
EDA_BaseStruct
*
aImage
)
/************************************/
/************************************
***************************
/
/* Used if undo / redo command:
* swap data between Item and its copy, pointed by its .m_Image member
* swapped data is data modified by edition, so not all values are swapped
*/
{
if
(
aItem
==
NULL
||
aImage
==
NULL
)
{
wxMessageBox
(
wxT
(
"SwapData error: NULL pointer"
)
);
wxMessageBox
(
wxT
(
"SwapData error: NULL pointer"
)
);
return
;
}
...
...
@@ -176,19 +177,15 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
int
flag_type_command
)
/***********************************************************************/
/* Create a copy of the current schematic draw list, and put it in the undo list.
* A DrawPickedStruct wrapper is created to handle the draw list.
* the .m_Son of this wrapper points the list of items
/** function SaveCopyInUndoList
* Create a copy of the current schematic item, and put it in the undo list.
*
* flag_type_command =
* 0 (unspecified)
* IS_CHANGED
* IS_NEW
* IS_DELETED
* IS_WIRE_IMAGE
*
* for 0: only a wrapper is created. The used must init the .Flags member of the
* wrapper, and add the item list to the wrapper
* If it is a delete command, items are put on list with the .Flags member set to IS_DELETED.
* When it will be really deleted, the EEDrawList and the subhierarchy will be deleted.
* If it is only a copy, the EEDrawList and the subhierarchy must NOT be deleted.
...
...
@@ -205,33 +202,30 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
PICKED_ITEMS_LIST
*
commandToUndo
=
new
PICKED_ITEMS_LIST
();
commandToUndo
->
m_UndoRedoType
=
flag_type_command
;
ITEM_PICKER
itemWrapper
(
ItemToCopy
,
flag_type_command
);
ITEM_PICKER
itemWrapper
(
ItemToCopy
,
flag_type_command
);
if
(
ItemToCopy
)
{
switch
(
flag_type_command
)
{
case
0
:
break
;
case
IS_CHANGED
:
/* Create a copy of schematic */
if
(
ItemToCopy
->
Type
()
==
DRAW_PICK_ITEM_STRUCT_TYPE
)
{
DrawPickedStruct
*
PickedList
=
(
DrawPickedStruct
*
)
ItemToCopy
;
while
(
PickedList
)
{
CopyOfItem
=
DuplicateStruct
(
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
);
CopyOfItem
=
DuplicateStruct
(
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
);
CopyOfItem
->
m_Flags
=
flag_type_command
;
itemWrapper
.
m_Item
=
CopyOfItem
;
itemWrapper
.
m_Link
=
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
;
itemWrapper
.
m_Link
=
(
SCH_ITEM
*
)
PickedList
->
m_PickedStruct
;
commandToUndo
->
PushItem
(
itemWrapper
);
PickedList
=
PickedList
->
Next
();
}
}
}
else
{
CopyOfItem
=
DuplicateStruct
(
ItemToCopy
);
itemWrapper
.
m_Item
=
CopyOfItem
;
CopyOfItem
=
DuplicateStruct
(
ItemToCopy
);
itemWrapper
.
m_Item
=
CopyOfItem
;
itemWrapper
.
m_Link
=
ItemToCopy
;
commandToUndo
->
PushItem
(
itemWrapper
);
}
...
...
@@ -305,12 +299,71 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
default
:
{
wxString
msg
;
msg
.
Printf
(
wxT
(
"SaveCopyInUndoList() error (unknown code %X)"
),
flag_type_command
);
DisplayError
(
this
,
msg
);
msg
.
Printf
(
wxT
(
"SaveCopyInUndoList() error (unknown code %X)"
),
flag_type_command
);
DisplayError
(
this
,
msg
);
}
break
;
}
}
/* Save the copy in undo list */
GetScreen
()
->
PushCommandToUndoList
(
commandToUndo
);
/* Clear redo list, because after new save there is no redo to do */
GetScreen
()
->
ClearUndoORRedoList
(
GetScreen
()
->
m_RedoList
);
}
/** function SaveCopyInUndoList
* @param aItemsList = a PICKED_ITEMS_LIST of items to save
* @param aTypeCommand = type of comand ( IS_CHANGED, IS_NEW, IS_DELETED ...
*/
void
WinEDA_SchematicFrame
::
SaveCopyInUndoList
(
PICKED_ITEMS_LIST
&
aItemsList
,
int
aTypeCommand
)
{
SCH_ITEM
*
CopyOfItem
;
PICKED_ITEMS_LIST
*
commandToUndo
=
new
PICKED_ITEMS_LIST
();
commandToUndo
->
m_UndoRedoType
=
aTypeCommand
;
ITEM_PICKER
itemWrapper
;
for
(
unsigned
ii
=
0
;
ii
<
aItemsList
.
GetCount
();
ii
++
)
{
SCH_ITEM
*
ItemToCopy
=
(
SCH_ITEM
*
)
aItemsList
.
GetItemData
(
ii
);
int
command
=
aItemsList
.
GetItemStatus
(
ii
);
if
(
command
==
0
)
{
command
=
aTypeCommand
;
}
itemWrapper
.
m_Item
=
ItemToCopy
;
itemWrapper
.
m_UndoRedoStatus
=
command
;
switch
(
command
)
{
case
IS_CHANGED
:
/* Create a copy of schematic */
CopyOfItem
=
DuplicateStruct
(
ItemToCopy
);
itemWrapper
.
m_Item
=
CopyOfItem
;
itemWrapper
.
m_Link
=
ItemToCopy
;
commandToUndo
->
PushItem
(
itemWrapper
);
break
;
case
IS_NEW
:
case
IS_NEW
|
IS_CHANGED
:
// when more than one item, some are new, some are changed
commandToUndo
->
PushItem
(
itemWrapper
);
break
;
case
IS_DELETED
:
ItemToCopy
->
m_Flags
=
IS_DELETED
;
commandToUndo
->
PushItem
(
itemWrapper
);
break
;
default
:
{
wxString
msg
;
msg
.
Printf
(
wxT
(
"SaveCopyInUndoList() error (unknown code %X)"
),
command
);
DisplayError
(
this
,
msg
);
}
break
;
}
}
/* Save the copy in undo list */
GetScreen
()
->
PushCommandToUndoList
(
commandToUndo
);
...
...
@@ -358,14 +411,15 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
* Put data pointed by List in the previous state, i.e. the state memorised by List
*/
{
SCH_ITEM
*
item
;
SCH_ITEM
*
alt_item
;
SCH_ITEM
*
item
;
SCH_ITEM
*
alt_item
;
for
(
unsigned
ii
=
0
;
ii
<
aList
->
GetCount
();
ii
++
)
{
ITEM_PICKER
itemWrapper
=
aList
->
GetItemWrapper
(
ii
);
item
=
(
SCH_ITEM
*
)
itemWrapper
.
m_Item
;
SCH_ITEM
*
image
=
(
SCH_ITEM
*
)
itemWrapper
.
m_Link
;
wxASSERT
(
item
);
SCH_ITEM
*
image
=
(
SCH_ITEM
*
)
itemWrapper
.
m_Link
;
switch
(
itemWrapper
.
m_UndoRedoStatus
)
{
case
IS_CHANGED
:
/* Exchange old and new data for each item */
...
...
@@ -399,15 +453,18 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( PICKED_ITEMS_LIST* aList )
item
->
m_Flags
=
0
;
item
=
nextitem
;
}
break
;
default
:
{
wxString
msg
;
msg
.
Printf
(
wxT
(
"PutDataInPreviousState() error (unknown code %X)"
),
itemWrapper
.
m_UndoRedoStatus
);
DisplayError
(
this
,
msg
);
msg
.
Printf
(
wxT
(
"PutDataInPreviousState() error (unknown code %X)"
),
itemWrapper
.
m_UndoRedoStatus
);
DisplayError
(
this
,
msg
);
}
break
;
break
;
}
}
}
...
...
@@ -458,7 +515,7 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
* So this function can be called to remove old commands
*/
{
int
CmdType
;
int
CmdType
;
if
(
aItemCount
==
0
)
return
;
...
...
@@ -468,17 +525,17 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
icnt
=
aItemCount
;
for
(
unsigned
ii
=
0
;
ii
<
icnt
;
ii
++
)
{
if
(
aList
.
m_CommandsList
.
size
()
==
0
)
if
(
aList
.
m_CommandsList
.
size
()
==
0
)
break
;
PICKED_ITEMS_LIST
*
curr_cmd
=
aList
.
m_CommandsList
[
0
];
aList
.
m_CommandsList
.
erase
(
aList
.
m_CommandsList
.
begin
()
);
CmdType
=
curr_cmd
->
m_UndoRedoType
;
// Delete items is they are not flagged IS_NEW
while
(
1
)
while
(
1
)
{
ITEM_PICKER
wrapper
=
curr_cmd
->
PopItem
();
EDA_BaseStruct
*
item
=
wrapper
.
m_Item
;
ITEM_PICKER
wrapper
=
curr_cmd
->
PopItem
();
EDA_BaseStruct
*
item
=
wrapper
.
m_Item
;
if
(
item
==
NULL
)
// No more item in list.
break
;
if
(
wrapper
.
m_UndoRedoStatus
==
IS_WIRE_IMAGE
)
...
...
@@ -498,6 +555,7 @@ void SCH_SCREEN::ClearUndoORRedoList( UNDO_REDO_CONTAINER& aList, int aItemCount
}
}
}
delete
curr_cmd
;
// Delete command
}
}
...
...
eeschema/schframe.cpp
View file @
8ec8cf3f
...
...
@@ -416,7 +416,7 @@ wxString WinEDA_SchematicFrame::GetUniqueFilenameForCurrentSheet( )
void
WinEDA_SchematicFrame
::
OnUpdateBlockSelected
(
wxUpdateUIEvent
&
event
)
{
bool
enable
=
(
GetScreen
()
&&
GetScreen
()
->
BlockLocate
.
m_Command
==
BLOCK_MOVE
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
==
BLOCK_MOVE
);
event
.
Enable
(
enable
);
m_HToolBar
->
EnableTool
(
wxID_CUT
,
enable
);
m_HToolBar
->
EnableTool
(
wxID_COPY
,
enable
);
...
...
@@ -424,8 +424,8 @@ void WinEDA_SchematicFrame::OnUpdateBlockSelected( wxUpdateUIEvent& event )
void
WinEDA_SchematicFrame
::
OnUpdatePaste
(
wxUpdateUIEvent
&
event
)
{
event
.
Enable
(
g_BlockSaveDataList
!=
NULL
);
m_HToolBar
->
EnableTool
(
wxID_PASTE
,
g_BlockSaveDataList
!=
NULL
);
event
.
Enable
(
g_BlockSaveDataList
.
GetCount
()
>
0
);
m_HToolBar
->
EnableTool
(
wxID_PASTE
,
g_BlockSaveDataList
.
GetCount
()
>
0
);
}
void
WinEDA_SchematicFrame
::
OnUpdateSchematicUndo
(
wxUpdateUIEvent
&
event
)
...
...
gerbview/block.cpp
View file @
8ec8cf3f
...
...
@@ -20,7 +20,7 @@
static
void
DrawMovingBlockOutlines
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
TRACK
*
IsSegmentInBox
(
DrawBlockStruct
&
blocklocate
,
TRACK
*
PtSegm
);
static
TRACK
*
IsSegmentInBox
(
BLOCK_SELECTOR
&
blocklocate
,
TRACK
*
PtSegm
);
/* Variables locales :*/
...
...
@@ -79,9 +79,9 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
err
=
TRUE
;
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace : ManageCurseur = NULL"
)
);
}
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
switch
(
GetScreen
()
->
BlockLocate
.
m_Command
)
switch
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
)
{
case
BLOCK_IDLE
:
err
=
TRUE
;
...
...
@@ -93,14 +93,14 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
Block_Move
(
DC
);
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
break
;
case
BLOCK_COPY
:
/* Copy */
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
Block_Duplicate
(
DC
);
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
break
;
case
BLOCK_PASTE
:
...
...
@@ -122,13 +122,13 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
GetScreen
()
->
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
if
(
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
)
GetScreen
()
->
m_
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
if
(
GetScreen
()
->
m_BlockLocate
.
GetCount
()
)
{
DisplayError
(
this
,
wxT
(
"
Error in HandleBlockPLace DrawStruct != NULL
"
)
);
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
DisplayError
(
this
,
wxT
(
"
HandleBlockPLace error: some items left
"
)
);
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
}
DisplayToolMsg
(
wxEmptyString
);
...
...
@@ -151,7 +151,7 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
if
(
DrawPanel
->
ManageCurseur
)
switch
(
GetScreen
()
->
BlockLocate
.
m_Command
)
switch
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
)
{
case
BLOCK_IDLE
:
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace"
)
);
...
...
@@ -161,7 +161,7 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_COPY
:
/* Copy */
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
endcommande
=
FALSE
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
...
...
@@ -169,13 +169,13 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
break
;
case
BLOCK_DELETE
:
/* Delete */
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
Block_Delete
(
DC
);
break
;
case
BLOCK_MIRROR_X
:
/* Mirror*/
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
Block_Mirror_X
(
DC
);
break
;
...
...
@@ -204,17 +204,17 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
if
(
endcommande
==
TRUE
)
{
GetScreen
()
->
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
DisplayToolMsg
(
wxEmptyString
);
}
if
(
zoom_command
)
Window_Zoom
(
GetScreen
()
->
BlockLocate
);
Window_Zoom
(
GetScreen
()
->
m_
BlockLocate
);
return
endcommande
;
}
...
...
@@ -230,34 +230,28 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
int
Color
;
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
Color
=
YELLOW
;
GRSetDrawMode
(
DC
,
g_XorMode
);
Color
=
YELLOW
;
/* Effacement ancien cadre */
if
(
erase
)
{
screen
->
BlockLocate
.
Draw
(
panel
,
DC
);
if
(
screen
->
BlockLocate
.
m_MoveVector
.
x
||
screen
->
BlockLocate
.
m_MoveVector
.
y
)
screen
->
m_BlockLocate
.
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
,
Color
);
if
(
screen
->
m_BlockLocate
.
m_MoveVector
.
x
||
screen
->
m_
BlockLocate
.
m_MoveVector
.
y
)
{
screen
->
BlockLocate
.
Offset
(
screen
->
BlockLocate
.
m_MoveVector
);
screen
->
BlockLocate
.
Draw
(
panel
,
DC
);
screen
->
BlockLocate
.
Offset
(
-
screen
->
BlockLocate
.
m_MoveVector
.
x
,
-
screen
->
BlockLocate
.
m_MoveVector
.
y
);
screen
->
m_BlockLocate
.
Draw
(
panel
,
DC
,
screen
->
m_BlockLocate
.
m_MoveVector
,
g_XorMode
,
Color
);
}
}
if
(
panel
->
GetScreen
()
->
BlockLocate
.
m_State
!=
STATE_BLOCK_STOP
)
if
(
panel
->
GetScreen
()
->
m_
BlockLocate
.
m_State
!=
STATE_BLOCK_STOP
)
{
screen
->
BlockLocate
.
m_MoveVector
.
x
=
screen
->
m_Curseur
.
x
-
screen
->
BlockLocate
.
GetRight
();
screen
->
BlockLocate
.
m_MoveVector
.
y
=
screen
->
m_Curseur
.
y
-
screen
->
BlockLocate
.
GetBottom
();
screen
->
m_BlockLocate
.
m_MoveVector
.
x
=
screen
->
m_Curseur
.
x
-
screen
->
m_
BlockLocate
.
GetRight
();
screen
->
m_BlockLocate
.
m_MoveVector
.
y
=
screen
->
m_Curseur
.
y
-
screen
->
m_
BlockLocate
.
GetBottom
();
}
screen
->
BlockLocate
.
Draw
(
panel
,
DC
);
if
(
screen
->
BlockLocate
.
m_MoveVector
.
x
||
screen
->
BlockLocate
.
m_MoveVector
.
y
)
screen
->
m_BlockLocate
.
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
,
Color
);
if
(
screen
->
m_BlockLocate
.
m_MoveVector
.
x
||
screen
->
m_
BlockLocate
.
m_MoveVector
.
y
)
{
screen
->
BlockLocate
.
Offset
(
screen
->
BlockLocate
.
m_MoveVector
);
screen
->
BlockLocate
.
Draw
(
panel
,
DC
);
screen
->
BlockLocate
.
Offset
(
-
screen
->
BlockLocate
.
m_MoveVector
.
x
,
-
screen
->
BlockLocate
.
m_MoveVector
.
y
);
screen
->
m_BlockLocate
.
Draw
(
panel
,
DC
,
screen
->
m_BlockLocate
.
m_MoveVector
,
g_XorMode
,
Color
);
}
}
...
...
@@ -274,7 +268,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
return
;
GetScreen
()
->
SetModify
();
GetScreen
()
->
BlockLocate
.
Normalize
();
GetScreen
()
->
m_
BlockLocate
.
Normalize
();
GetScreen
()
->
SetCurItem
(
NULL
);
/* Effacement des Pistes */
...
...
@@ -282,7 +276,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
for
(
pt_segm
=
m_Pcb
->
m_Track
;
pt_segm
!=
NULL
;
pt_segm
=
NextS
)
{
NextS
=
pt_segm
->
Next
();
if
(
IsSegmentInBox
(
GetScreen
()
->
BlockLocate
,
pt_segm
)
)
if
(
IsSegmentInBox
(
GetScreen
()
->
m_
BlockLocate
,
pt_segm
)
)
{
/* la piste est ici bonne a etre efface */
pt_segm
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
...
...
@@ -294,7 +288,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
for
(
pt_segm
=
m_Pcb
->
m_Zone
;
pt_segm
!=
NULL
;
pt_segm
=
NextS
)
{
NextS
=
pt_segm
->
Next
();
if
(
IsSegmentInBox
(
GetScreen
()
->
BlockLocate
,
pt_segm
)
)
if
(
IsSegmentInBox
(
GetScreen
()
->
m_
BlockLocate
,
pt_segm
)
)
{
/* la piste est ici bonne a etre efface */
pt_segm
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
...
...
@@ -324,16 +318,16 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
GetScreen
()
->
m_Curseur
=
oldpos
;
DrawPanel
->
MouseToCursorSchema
();
GetScreen
()
->
SetModify
();
GetScreen
()
->
BlockLocate
.
Normalize
();
GetScreen
()
->
m_
BlockLocate
.
Normalize
();
/* calcul du vecteur de deplacement pour les deplacements suivants */
delta
=
GetScreen
()
->
BlockLocate
.
m_MoveVector
;
delta
=
GetScreen
()
->
m_
BlockLocate
.
m_MoveVector
;
/* Move the Track segments in block */
TRACK
*
track
=
m_Pcb
->
m_Track
;
while
(
track
)
{
if
(
IsSegmentInBox
(
GetScreen
()
->
BlockLocate
,
track
)
)
if
(
IsSegmentInBox
(
GetScreen
()
->
m_
BlockLocate
,
track
)
)
{
m_Pcb
->
m_Status_Pcb
=
0
;
track
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
// erase the display
...
...
@@ -353,7 +347,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
SEGZONE
*
zsegment
=
m_Pcb
->
m_Zone
;
while
(
zsegment
)
{
if
(
IsSegmentInBox
(
GetScreen
()
->
BlockLocate
,
zsegment
)
)
if
(
IsSegmentInBox
(
GetScreen
()
->
m_
BlockLocate
,
zsegment
)
)
{
zsegment
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
// erase the display
zsegment
->
m_Start
+=
delta
;
...
...
@@ -388,16 +382,16 @@ void WinEDA_BasePcbFrame::Block_Mirror_X( wxDC* DC )
GetScreen
()
->
m_Curseur
=
oldpos
;
DrawPanel
->
MouseToCursorSchema
();
GetScreen
()
->
SetModify
();
GetScreen
()
->
BlockLocate
.
Normalize
();
GetScreen
()
->
m_
BlockLocate
.
Normalize
();
/* Calculate offset to mirror track points from block edges */
xoffset
=
GetScreen
()
->
BlockLocate
.
m_Pos
.
x
+
GetScreen
()
->
BlockLocate
.
m_Pos
.
x
+
GetScreen
()
->
BlockLocate
.
m_Size
.
x
;
xoffset
=
GetScreen
()
->
m_BlockLocate
.
m_Pos
.
x
+
GetScreen
()
->
m_
BlockLocate
.
m_Pos
.
x
+
GetScreen
()
->
m_
BlockLocate
.
m_Size
.
x
;
/* Move the Track segments in block */
for
(
TRACK
*
track
=
m_Pcb
->
m_Track
;
track
;
track
=
track
->
Next
()
)
{
if
(
IsSegmentInBox
(
GetScreen
()
->
BlockLocate
,
track
)
)
if
(
IsSegmentInBox
(
GetScreen
()
->
m_
BlockLocate
,
track
)
)
{
m_Pcb
->
m_Status_Pcb
=
0
;
track
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
// erase the display
...
...
@@ -414,7 +408,7 @@ void WinEDA_BasePcbFrame::Block_Mirror_X( wxDC* DC )
/* Move the Zone segments in block */
for
(
SEGZONE
*
zsegment
=
m_Pcb
->
m_Zone
;
zsegment
;
zsegment
=
zsegment
->
Next
()
)
{
if
(
IsSegmentInBox
(
GetScreen
()
->
BlockLocate
,
zsegment
)
)
if
(
IsSegmentInBox
(
GetScreen
()
->
m_
BlockLocate
,
zsegment
)
)
{
zsegment
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
// erase the display
zsegment
->
m_Start
.
x
=
xoffset
-
zsegment
->
m_Start
.
x
;
...
...
@@ -426,7 +420,7 @@ void WinEDA_BasePcbFrame::Block_Mirror_X( wxDC* DC )
zsegment
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
// redraw the moved zone zegment
}
}
DrawPanel
->
Refresh
(
TRUE
);
}
...
...
@@ -448,18 +442,18 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
GetScreen
()
->
m_Curseur
=
oldpos
;
DrawPanel
->
MouseToCursorSchema
();
GetScreen
()
->
SetModify
();
GetScreen
()
->
BlockLocate
.
Normalize
();
GetScreen
()
->
m_
BlockLocate
.
Normalize
();
/* calcul du vecteur de deplacement pour les deplacements suivants */
delta
=
GetScreen
()
->
BlockLocate
.
m_MoveVector
;
delta
=
GetScreen
()
->
m_
BlockLocate
.
m_MoveVector
;
/* Copy selected track segments and move the new track its new location */
TRACK
*
track
=
m_Pcb
->
m_Track
;
while
(
track
)
{
TRACK
*
next_track
=
track
->
Next
();
if
(
IsSegmentInBox
(
GetScreen
()
->
BlockLocate
,
track
)
)
if
(
IsSegmentInBox
(
GetScreen
()
->
m_
BlockLocate
,
track
)
)
{
/* this track segment must be duplicated */
m_Pcb
->
m_Status_Pcb
=
0
;
...
...
@@ -480,7 +474,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
while
(
zsegment
)
{
SEGZONE
*
next_zsegment
=
zsegment
->
Next
();
if
(
IsSegmentInBox
(
GetScreen
()
->
BlockLocate
,
zsegment
)
)
if
(
IsSegmentInBox
(
GetScreen
()
->
m_
BlockLocate
,
zsegment
)
)
{
/* this zone segment must be duplicated */
SEGZONE
*
new_zsegment
=
(
SEGZONE
*
)
zsegment
->
Copy
();
...
...
@@ -498,7 +492,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
/**************************************************************************/
static
TRACK
*
IsSegmentInBox
(
DrawBlockStruct
&
blocklocate
,
TRACK
*
PtSegm
)
static
TRACK
*
IsSegmentInBox
(
BLOCK_SELECTOR
&
blocklocate
,
TRACK
*
PtSegm
)
/**************************************************************************/
/* Teste si la structure PtStruct est inscrite dans le block selectionne
...
...
gerbview/edit.cpp
View file @
8ec8cf3f
...
...
@@ -108,11 +108,11 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
&
dc
);
}
/* ne devrait pas etre execute, sauf bug */
if
(
GetScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
if
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
{
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
}
if
(
m_ID_current_state
==
0
)
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
...
...
@@ -250,34 +250,34 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_PLACE_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_MOVE
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_MOVE
;
DrawPanel
->
m_AutoPAN_Request
=
FALSE
;
HandleBlockPlace
(
&
dc
);
break
;
case
ID_POPUP_COPY_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_COPY
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_COPY
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
DrawPanel
->
m_AutoPAN_Request
=
FALSE
;
HandleBlockEnd
(
&
dc
);
break
;
case
ID_POPUP_ZOOM_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_ZOOM
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_ZOOM
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
HandleBlockEnd
(
&
dc
);
break
;
case
ID_POPUP_DELETE_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_DELETE
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_DELETE
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
HandleBlockEnd
(
&
dc
);
break
;
case
ID_POPUP_MIRROR_X_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_MIRROR_X
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_MIRROR_X
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
HandleBlockEnd
(
&
dc
);
break
;
...
...
gerbview/gerberframe.cpp
View file @
8ec8cf3f
...
...
@@ -214,7 +214,7 @@ void WinEDA_GerberFrame::SetToolbars()
if
(
m_HToolBar
==
NULL
)
return
;
if
(
GetScreen
()
->
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
if
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
{
m_HToolBar
->
EnableTool
(
wxID_CUT
,
TRUE
);
m_HToolBar
->
EnableTool
(
wxID_COPY
,
TRUE
);
...
...
gerbview/onrightclick.cpp
View file @
8ec8cf3f
...
...
@@ -22,7 +22,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
{
BOARD_ITEM
*
DrawStruct
=
GetScreen
()
->
GetCurItem
();
wxString
msg
;
bool
BlockActive
=
(
GetScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
bool
BlockActive
=
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
DrawPanel
->
m_CanStartBlock
=
-
1
;
// Ne pas engager un debut de bloc sur validation menu
...
...
include/block_commande.h
View file @
8ec8cf3f
...
...
@@ -8,18 +8,108 @@
#define __INCLUDE__BLOCK_COMMANDE_H__ 1
void
AbortBlockCurrentCommand
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
#include "base_struct.h"
#include "class_undoredo_container.h"
/* Cancel Current block operation. */
void
InitBlockLocateDatas
(
WinEDA_DrawPanel
*
Panel
,
const
wxPoint
&
startpos
);
/* Init the initial values of a BlockLocate, before starting a block command */
void
DrawAndSizingBlockOutlines
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
// Forward declarations:
/**************************/
/* class BLOCK_SELECTOR */
/**************************/
/**
* class BLOCK_SELECTOR is used to handle block selection and commands
*/
typedef
enum
{
/* definition de l'etat du block */
STATE_NO_BLOCK
,
/* Block non initialise */
STATE_BLOCK_INIT
,
/* Block initialise: 1er point defini */
STATE_BLOCK_END
,
/* Block initialise: 2eme point defini */
STATE_BLOCK_MOVE
,
/* Block en deplacement */
STATE_BLOCK_STOP
/* Block fixe (fin de deplacement) */
}
BlockState
;
/* codes des differentes commandes sur block: */
typedef
enum
{
BLOCK_IDLE
,
BLOCK_MOVE
,
BLOCK_COPY
,
BLOCK_SAVE
,
BLOCK_DELETE
,
BLOCK_PASTE
,
BLOCK_DRAG
,
BLOCK_ROTATE
,
BLOCK_INVERT
,
BLOCK_ZOOM
,
BLOCK_ABORT
,
BLOCK_PRESELECT_MOVE
,
BLOCK_SELECT_ITEMS_ONLY
,
BLOCK_MIRROR_X
,
BLOCK_MIRROR_Y
}
CmdBlockType
;
class
BLOCK_SELECTOR
:
public
EDA_BaseStruct
,
public
EDA_Rect
{
public
:
BlockState
m_State
;
/* Stae (enum BlockState) of the block */
CmdBlockType
m_Command
;
/* Type (enum CmdBlockType) d'operation */
PICKED_ITEMS_LIST
m_ItemsSelection
;
/* list of items selected in this block */
int
m_Color
;
/* Block Color (for drawings) */
wxPoint
m_MoveVector
;
/* Move distance in move, drag, copy ... command */
wxPoint
m_BlockLastCursorPosition
;
/* Last Mouse position in block command
* = last cursor position in move commands
* = 0,0 in block paste */
public
:
BLOCK_SELECTOR
();
~
BLOCK_SELECTOR
();
/** function InitData
* Init the initial values of a BLOCK_SELECTOR, before starting a block command
*/
void
InitData
(
WinEDA_DrawPanel
*
Panel
,
const
wxPoint
&
startpos
);
/** Function SetMessageBlock
* Displays the type of block command in the status bar of the window
*/
void
SetMessageBlock
(
WinEDA_DrawFrame
*
frame
);
void
Draw
(
WinEDA_DrawPanel
*
aPanel
,
wxDC
*
aDC
,
const
wxPoint
&
aOffset
,
int
aDrawMode
,
int
aColor
);
/** Function PushItem
* Add aItem to the list of items
* @param aItem = an ITEM_PICKER to add to the list
*/
void
PushItem
(
ITEM_PICKER
&
aItem
);
/** Function ClearListAndDeleteItems
* delete only the list of EDA_BaseStruct * pointers, AND the data pinted by m_Item
*/
void
ClearListAndDeleteItems
();
void
ClearItemsList
();
unsigned
GetCount
()
{
return
m_ItemsSelection
.
GetCount
();
}
};
/* Cancel Current block operation.
*/
void
AbortBlockCurrentCommand
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
/* Redraw the outlines of the block which shows the search area for block commands
* The first point of the rectangle showing the area is initialised
* by InitBlockLocateDatas().
* The other point of the rectangle is the mouse cursor */
* The other point of the rectangle is the mouse cursor
*/
void
DrawAndSizingBlockOutlines
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
#endif
/* __INCLUDE__BLOCK_COMMANDE_H__ */
...
...
include/class_base_screen.h
View file @
8ec8cf3f
...
...
@@ -3,7 +3,6 @@
**********************/
/* define :
* class DrawBlockStruct used to handle block commands
* class BASE_SCREEN to handle how to draw a screen (a board, a schematic ...)
*/
...
...
@@ -12,6 +11,7 @@
#include "base_struct.h"
#include "class_undoredo_container.h"
#include "block_commande.h"
// Forward declarations:
...
...
@@ -19,65 +19,11 @@ class SCH_ITEM;
class
Ki_PageDescr
;
/**************************/
/* class DrawBlockStruct */
/**************************/
/* Definition d'un block pour les fonctions sur block (block move, ..) */
typedef
enum
{
/* definition de l'etat du block */
STATE_NO_BLOCK
,
/* Block non initialise */
STATE_BLOCK_INIT
,
/* Block initialise: 1er point defini */
STATE_BLOCK_END
,
/* Block initialise: 2eme point defini */
STATE_BLOCK_MOVE
,
/* Block en deplacement */
STATE_BLOCK_STOP
/* Block fixe (fin de deplacement) */
}
BlockState
;
/* codes des differentes commandes sur block: */
typedef
enum
{
BLOCK_IDLE
,
BLOCK_MOVE
,
BLOCK_COPY
,
BLOCK_SAVE
,
BLOCK_DELETE
,
BLOCK_PASTE
,
BLOCK_DRAG
,
BLOCK_ROTATE
,
BLOCK_INVERT
,
BLOCK_ZOOM
,
BLOCK_ABORT
,
BLOCK_PRESELECT_MOVE
,
BLOCK_SELECT_ITEMS_ONLY
,
BLOCK_MIRROR_X
,
BLOCK_MIRROR_Y
}
CmdBlockType
;
class
DrawBlockStruct
:
public
EDA_BaseStruct
,
public
EDA_Rect
{
public
:
BlockState
m_State
;
/* Etat (enum BlockState) du block */
CmdBlockType
m_Command
;
/* Type (enum CmdBlockType) d'operation */
EDA_BaseStruct
*
m_BlockDrawStruct
;
/* pointeur sur la structure
* selectionnee dans le bloc */
int
m_Color
;
/* Block Color */
wxPoint
m_MoveVector
;
/* Move distance in move, drag, copy ... command */
wxPoint
m_BlockLastCursorPosition
;
/* Last Mouse position in block command
* = last cursor position in move commands
* = 0,0 in block paste */
public
:
DrawBlockStruct
();
~
DrawBlockStruct
();
void
SetMessageBlock
(
WinEDA_DrawFrame
*
frame
);
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
);
};
/* Simple class for handling grid arrays. */
class
GRID_TYPE
{
public
:
int
m_Id
;
int
m_Id
;
wxRealPoint
m_Size
;
};
...
...
@@ -93,9 +39,9 @@ WX_DECLARE_OBJARRAY( GRID_TYPE, GridArray );
class
BASE_SCREEN
:
public
EDA_BaseStruct
{
public
:
wxPoint
m_DrawOrg
;
/* offsets pour tracer le circuit sur l'ecran */
wxPoint
m_Curseur
;
/* Screen cursor coordinate (on grid) in user units. */
wxPoint
m_MousePosition
;
/* Mouse cursor coordinate (off grid) in user units. */
wxPoint
m_DrawOrg
;
/* offsets pour tracer le circuit sur l'ecran */
wxPoint
m_Curseur
;
/* Screen cursor coordinate (on grid) in user units. */
wxPoint
m_MousePosition
;
/* Mouse cursor coordinate (off grid) in user units. */
wxPoint
m_MousePositionInPixels
;
wxPoint
m_O_Curseur
;
/* Relative Screen cursor coordinate (on grid) in user units.
* (coordinates from last reset position)*/
...
...
@@ -115,32 +61,32 @@ public:
* > 0 all but schematic
* FALSE: when coordinates can be only >= 0
* Schematic */
bool
m_FirstRedraw
;
bool
m_FirstRedraw
;
SCH_ITEM
*
EEDrawList
;
/* Object list (main data) for schematic */
SCH_ITEM
*
EEDrawList
;
/* Object list (main data) for schematic */
// Undo/redo list of commands
UNDO_REDO_CONTAINER
m_UndoList
;
/* Object
list for the undo command (old data) */
UNDO_REDO_CONTAINER
m_RedoList
;
/* Object
list for the redo command (old data) */
unsigned
m_UndoRedoCountMax
;
// undo/Redo command Max depth
UNDO_REDO_CONTAINER
m_UndoList
;
/* Objects
list for the undo command (old data) */
UNDO_REDO_CONTAINER
m_RedoList
;
/* Objects
list for the redo command (old data) */
unsigned
m_UndoRedoCountMax
;
// undo/Redo command Max depth
/* block control */
DrawBlockStruct
BlockLocate
;
/* B
ock description for block commands */
BLOCK_SELECTOR
m_BlockLocate
;
/* Bl
ock description for block commands */
/* Page description */
Ki_PageDescr
*
m_CurrentSheetDesc
;
int
m_ScreenNumber
;
int
m_NumberOfScreen
;
wxString
m_FileName
;
wxString
m_Title
;
/* titre de la feuille */
wxString
m_Date
;
/* date de mise a jour */
wxString
m_Revision
;
/* code de revision */
wxString
m_Company
;
/* nom du proprietaire */
wxString
m_Commentaire1
;
wxString
m_Commentaire2
;
wxString
m_Commentaire3
;
wxString
m_Commentaire4
;
Ki_PageDescr
*
m_CurrentSheetDesc
;
int
m_ScreenNumber
;
int
m_NumberOfScreen
;
wxString
m_FileName
;
wxString
m_Title
;
/* titre de la feuille */
wxString
m_Date
;
/* date de mise a jour */
wxString
m_Revision
;
/* code de revision */
wxString
m_Company
;
/* nom du proprietaire */
wxString
m_Commentaire1
;
wxString
m_Commentaire2
;
wxString
m_Commentaire3
;
wxString
m_Commentaire4
;
private
:
/* indicateurs divers */
...
...
@@ -151,14 +97,14 @@ private:
/* Valeurs du pas de grille et du zoom */
public
:
wxRealPoint
m_Grid
;
/* Current grid. */
GridArray
m_GridList
;
bool
m_UserGridIsON
;
wxRealPoint
m_Grid
;
/* Current grid. */
GridArray
m_GridList
;
bool
m_UserGridIsON
;
wxArrayInt
m_ZoomList
;
/* Array of standard zoom coefficients. */
int
m_Zoom
;
/* Current zoom coefficient. */
int
m_ZoomScalar
;
/* Allow zooming to non-integer increments. */
bool
m_IsPrinting
;
wxArrayInt
m_ZoomList
;
/* Array of standard zoom coefficients. */
int
m_Zoom
;
/* Current zoom coefficient. */
int
m_ZoomScalar
;
/* Allow zooming to non-integer increments. */
bool
m_IsPrinting
;
public
:
BASE_SCREEN
(
KICAD_T
aType
=
SCREEN_STRUCT_TYPE
);
...
...
@@ -176,32 +122,36 @@ public:
void
SetCurItem
(
EDA_BaseStruct
*
current
)
{
m_CurrentItem
=
current
;
}
EDA_BaseStruct
*
GetCurItem
()
const
{
return
m_CurrentItem
;
}
void
InitDatas
();
/* Inits completes des variables */
void
InitDatas
();
/* Inits completes des variables */
wxSize
ReturnPageSize
(
void
);
virtual
int
GetInternalUnits
(
void
);
wxSize
ReturnPageSize
(
void
);
virtual
int
GetInternalUnits
(
void
);
/** Function CursorRealPosition
* @return the position in user units of location ScreenPos
* @param ScreenPos = the screen (in pixel) position co convert
*/
wxPoint
CursorRealPosition
(
const
wxPoint
&
ScreenPos
);
wxPoint
CursorRealPosition
(
const
wxPoint
&
ScreenPos
);
/* general Undo/Redo command control */
virtual
void
ClearUndoRedoList
();
virtual
void
PushCommandToUndoList
(
PICKED_ITEMS_LIST
*
aItem
);
virtual
void
PushCommandToRedoList
(
PICKED_ITEMS_LIST
*
aItem
);
virtual
void
ClearUndoRedoList
();
virtual
void
PushCommandToUndoList
(
PICKED_ITEMS_LIST
*
aItem
);
virtual
void
PushCommandToRedoList
(
PICKED_ITEMS_LIST
*
aItem
);
virtual
PICKED_ITEMS_LIST
*
PopCommandFromUndoList
();
virtual
PICKED_ITEMS_LIST
*
PopCommandFromRedoList
();
int
GetUndoCommandCount
(
)
int
GetUndoCommandCount
()
{
return
m_UndoList
.
m_CommandsList
.
size
();
}
int
GetRedoCommandCount
(
)
int
GetRedoCommandCount
()
{
return
m_RedoList
.
m_CommandsList
.
size
();
}
/* Manipulation des flags */
void
SetRefreshReq
()
{
m_FlagRefreshReq
=
1
;
}
void
ClrRefreshReq
()
{
m_FlagRefreshReq
=
0
;
}
...
...
@@ -230,51 +180,51 @@ public:
* @param the the current scale used to draw items on screen
* draw coordinates are user coordinates * GetScalingFactor( )
*/
void
SetScalingFactor
(
double
aScale
);
void
SetScalingFactor
(
double
aScale
);
/** Function GetZoom
* @return the current zoom factor
* Note: the zoom factor is NOT the scaling factor
* the scaling factor is m_ZoomScalar * GetZoom()
*/
int
GetZoom
()
const
;
int
GetZoom
()
const
;
/**
* Function SetZoom
* adjusts the current zoom factor
*/
bool
SetZoom
(
int
coeff
);
bool
SetZoom
(
int
coeff
);
/**
* Function SetZoomList
* sets the list of zoom factors.
* @param aZoomList An array of zoom factors in ascending order, zero terminated
*/
void
SetZoomList
(
const
wxArrayInt
&
zoomlist
);
void
SetZoomList
(
const
wxArrayInt
&
zoomlist
);
int
Scale
(
int
coord
);
double
Scale
(
double
coord
);
void
Scale
(
wxPoint
&
pt
);
void
Scale
(
wxSize
&
sz
);
void
Scale
(
wxRealPoint
&
sz
);
int
Scale
(
int
coord
);
double
Scale
(
double
coord
);
void
Scale
(
wxPoint
&
pt
);
void
Scale
(
wxSize
&
sz
);
void
Scale
(
wxRealPoint
&
sz
);
int
Unscale
(
int
coord
);
void
Unscale
(
wxPoint
&
pt
);
void
Unscale
(
wxSize
&
sz
);
int
Unscale
(
int
coord
);
void
Unscale
(
wxPoint
&
pt
);
void
Unscale
(
wxSize
&
sz
);
bool
SetNextZoom
();
/* ajuste le prochain coeff de zoom */
bool
SetPreviousZoom
();
/* ajuste le precedent coeff de zoom */
bool
SetFirstZoom
();
/* ajuste le coeff de zoom a 1*/
bool
SetLastZoom
();
/* ajuste le coeff de zoom au max */
bool
SetNextZoom
();
/* ajuste le prochain coeff de zoom */
bool
SetPreviousZoom
();
/* ajuste le precedent coeff de zoom */
bool
SetFirstZoom
();
/* ajuste le coeff de zoom a 1*/
bool
SetLastZoom
();
/* ajuste le coeff de zoom au max */
//----<grid stuff>----------------------------------------------------------
wxRealPoint
GetGrid
();
/* retourne la grille */
void
SetGrid
(
const
wxRealPoint
&
size
);
void
SetGrid
(
int
);
void
SetGridList
(
GridArray
&
sizelist
);
void
AddGrid
(
const
GRID_TYPE
&
grid
);
void
AddGrid
(
const
wxRealPoint
&
size
,
int
id
);
void
AddGrid
(
const
wxRealPoint
&
size
,
int
units
,
int
id
);
void
SetGrid
(
const
wxRealPoint
&
size
);
void
SetGrid
(
int
);
void
SetGridList
(
GridArray
&
sizelist
);
void
AddGrid
(
const
GRID_TYPE
&
grid
);
void
AddGrid
(
const
wxRealPoint
&
size
,
int
id
);
void
AddGrid
(
const
wxRealPoint
&
size
,
int
units
,
int
id
);
/**
...
...
include/class_undoredo_container.h
View file @
8ec8cf3f
...
...
@@ -88,9 +88,18 @@ public:
~
PICKED_ITEMS_LIST
();
void
PushItem
(
ITEM_PICKER
&
aItem
);
ITEM_PICKER
PopItem
();
/** Function ClearItemsList
* delete only the list of EDA_BaseStruct * pointers, NOT the pointed data itself
*/
void
ClearItemsList
();
unsigned
GetCount
()
/** Function ClearListAndDeleteItems
* delete only the list of EDA_BaseStruct * pointers, AND the data pinted by m_Item
*/
void
ClearListAndDeleteItems
();
unsigned
GetCount
()
const
{
return
m_ItemsList
.
size
();
}
...
...
@@ -105,6 +114,12 @@ public:
bool
SetLink
(
EDA_BaseStruct
*
aItem
,
unsigned
aIdx
);
bool
SetItemStatus
(
int
aStatus
,
unsigned
aIdx
);
bool
RemoveItem
(
unsigned
aIdx
);
/** Function CopyList
* copy all data from aSource
* Items picked are not copied. just pointer on them are copied
*/
void
CopyList
(
const
PICKED_ITEMS_LIST
&
aSource
);
};
/**
...
...
include/wxEeschemaStruct.h
View file @
8ec8cf3f
...
...
@@ -364,12 +364,12 @@ private:
void
RotateCmpField
(
SCH_CMP_FIELD
*
Field
,
wxDC
*
DC
);
/* Operations sur bloc */
void
Paste
Struct
(
wxDC
*
DC
);
void
Paste
ListOfItems
(
wxDC
*
DC
);
/* Undo - redo */
public
:
void
SaveCopyInUndoList
(
SCH_ITEM
*
ItemToCopy
,
int
flag_type_command
=
0
);
void
SaveCopyInUndoList
(
SCH_ITEM
*
ItemToCopy
,
int
aTypeCommand
);
void
SaveCopyInUndoList
(
PICKED_ITEMS_LIST
&
aItemsList
,
int
aTypeCommand
);
private
:
void
PutDataInPreviousState
(
PICKED_ITEMS_LIST
*
aList
);
...
...
pcbnew/block.cpp
View file @
8ec8cf3f
...
...
@@ -247,9 +247,9 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
err
=
TRUE
;
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace : ManageCurseur = NULL"
)
);
}
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
switch
(
GetScreen
()
->
BlockLocate
.
m_Command
)
switch
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
)
{
case
BLOCK_IDLE
:
err
=
TRUE
;
...
...
@@ -261,14 +261,14 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
Block_Move
(
DC
);
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
break
;
case
BLOCK_COPY
:
/* Copy */
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
Block_Duplicate
(
DC
);
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
break
;
case
BLOCK_PASTE
:
...
...
@@ -283,13 +283,13 @@ void WinEDA_PcbFrame::HandleBlockPlace( wxDC* DC )
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
GetScreen
()
->
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
if
(
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
)
GetScreen
()
->
m_
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
if
(
GetScreen
()
->
m_BlockLocate
.
GetCount
()
)
{
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace
DrawStruct != NULL
"
)
);
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace
some items left in list
"
)
);
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
}
DisplayToolMsg
(
wxEmptyString
);
...
...
@@ -310,7 +310,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
int
endcommande
=
TRUE
;
if
(
DrawPanel
->
ManageCurseur
)
switch
(
GetScreen
()
->
BlockLocate
.
m_Command
)
switch
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
)
{
case
BLOCK_IDLE
:
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace"
)
);
...
...
@@ -320,7 +320,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_COPY
:
/* Copy */
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
endcommande
=
FALSE
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
...
...
@@ -331,7 +331,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
// Turn off the block rectangle now so it is not redisplayed
DrawPanel
->
ManageCurseur
=
NULL
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
Block_Delete
(
DC
);
break
;
...
...
@@ -340,7 +340,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
// Turn off the block rectangle now so it is not redisplayed
DrawPanel
->
ManageCurseur
=
NULL
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
Block_Rotate
(
DC
);
break
;
...
...
@@ -349,18 +349,18 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
// Turn off the block rectangle now so it is not redisplayed
DrawPanel
->
ManageCurseur
=
NULL
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
Block_Invert
(
DC
);
break
;
case
BLOCK_SAVE
:
/* Save (not used, for future enhancements)*/
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
if
(
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
!=
NULL
)
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
if
(
GetScreen
()
->
m_BlockLocate
.
GetCount
()
)
{
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
// SaveStruct(GetScreen()->BlockLocate.m_BlockDrawStruct);
// SaveStruct(GetScreen()->
m_
BlockLocate.m_BlockDrawStruct);
}
break
;
...
...
@@ -372,7 +372,7 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
//Turn off the redraw block routine now so it is not displayed
// with one corner at the new center of the screen
DrawPanel
->
ManageCurseur
=
NULL
;
Window_Zoom
(
GetScreen
()
->
BlockLocate
);
Window_Zoom
(
GetScreen
()
->
m_
BlockLocate
);
break
;
default
:
...
...
@@ -381,10 +381,10 @@ int WinEDA_PcbFrame::HandleBlockEnd( wxDC* DC )
if
(
endcommande
==
TRUE
)
{
GetScreen
()
->
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
DisplayToolMsg
(
wxEmptyString
);
...
...
@@ -405,34 +405,27 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool era
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
Color
=
YELLOW
;
GRSetDrawMode
(
DC
,
g_XorMode
);
/* Effacement ancien cadre */
if
(
erase
)
{
screen
->
BlockLocate
.
Draw
(
panel
,
DC
);
if
(
screen
->
BlockLocate
.
m_MoveVector
.
x
||
screen
->
BlockLocate
.
m_MoveVector
.
y
)
screen
->
m_BlockLocate
.
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
,
Color
);
if
(
screen
->
m_BlockLocate
.
m_MoveVector
.
x
||
screen
->
m_
BlockLocate
.
m_MoveVector
.
y
)
{
screen
->
BlockLocate
.
Offset
(
screen
->
BlockLocate
.
m_MoveVector
);
screen
->
BlockLocate
.
Draw
(
panel
,
DC
);
screen
->
BlockLocate
.
Offset
(
-
screen
->
BlockLocate
.
m_MoveVector
.
x
,
-
screen
->
BlockLocate
.
m_MoveVector
.
y
);
screen
->
m_BlockLocate
.
Draw
(
panel
,
DC
,
screen
->
m_BlockLocate
.
m_MoveVector
,
g_XorMode
,
Color
);
}
}
if
(
screen
->
BlockLocate
.
m_State
!=
STATE_BLOCK_STOP
)
if
(
screen
->
m_
BlockLocate
.
m_State
!=
STATE_BLOCK_STOP
)
{
screen
->
BlockLocate
.
m_MoveVector
.
x
=
screen
->
m_Curseur
.
x
-
screen
->
BlockLocate
.
GetRight
();
screen
->
BlockLocate
.
m_MoveVector
.
y
=
screen
->
m_Curseur
.
y
-
screen
->
BlockLocate
.
GetBottom
();
screen
->
m_BlockLocate
.
m_MoveVector
.
x
=
screen
->
m_Curseur
.
x
-
screen
->
m_
BlockLocate
.
GetRight
();
screen
->
m_BlockLocate
.
m_MoveVector
.
y
=
screen
->
m_Curseur
.
y
-
screen
->
m_
BlockLocate
.
GetBottom
();
}
screen
->
BlockLocate
.
Draw
(
panel
,
DC
);
if
(
screen
->
BlockLocate
.
m_MoveVector
.
x
||
screen
->
BlockLocate
.
m_MoveVector
.
y
)
screen
->
m_BlockLocate
.
Draw
(
panel
,
DC
,
wxPoint
(
0
,
0
),
g_XorMode
,
Color
);
if
(
screen
->
m_BlockLocate
.
m_MoveVector
.
x
||
screen
->
m_
BlockLocate
.
m_MoveVector
.
y
)
{
screen
->
BlockLocate
.
Offset
(
screen
->
BlockLocate
.
m_MoveVector
);
screen
->
BlockLocate
.
Draw
(
panel
,
DC
);
screen
->
BlockLocate
.
Offset
(
-
screen
->
BlockLocate
.
m_MoveVector
.
x
,
-
screen
->
BlockLocate
.
m_MoveVector
.
y
);
screen
->
m_BlockLocate
.
Draw
(
panel
,
DC
,
screen
->
m_BlockLocate
.
m_MoveVector
,
g_XorMode
,
Color
);
}
}
...
...
@@ -452,7 +445,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
return
;
GetScreen
()
->
SetModify
();
GetScreen
()
->
BlockLocate
.
Normalize
();
GetScreen
()
->
m_
BlockLocate
.
Normalize
();
SetCurItem
(
NULL
);
/* Effacement des modules */
...
...
@@ -463,7 +456,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
for
(
;
module
!=
NULL
;
module
=
(
MODULE
*
)
NextS
)
{
NextS
=
module
->
Next
();
if
(
module
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
module
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
module
->
m_Flags
=
0
;
module
->
DeleteStructure
();
...
...
@@ -480,7 +473,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
for
(
pt_segm
=
m_Pcb
->
m_Track
;
pt_segm
!=
NULL
;
pt_segm
=
(
TRACK
*
)
NextS
)
{
NextS
=
pt_segm
->
Next
();
if
(
pt_segm
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
pt_segm
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
/* la piste est ici bonne a etre efface */
pt_segm
->
DeleteStructure
();
...
...
@@ -506,7 +499,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
case
TYPE_DRAWSEGMENT
:
if
(
(
g_TabOneLayerMask
[
PtStruct
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre efface */
...
...
@@ -517,7 +510,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
case
TYPE_TEXTE
:
if
(
!
Block_Include_PcbTextes
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* le texte est ici bon a etre efface */
PtStruct
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
...
...
@@ -528,7 +521,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
case
TYPE_MIRE
:
if
(
(
g_TabOneLayerMask
[
PtStruct
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre efface */
PtStruct
->
DeleteStructure
();
...
...
@@ -537,7 +530,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
case
TYPE_COTATION
:
if
(
(
g_TabOneLayerMask
[
PtStruct
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
PtStruct
->
DeleteStructure
();
break
;
...
...
@@ -556,7 +549,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
for
(
pt_segm
=
m_Pcb
->
m_Zone
;
pt_segm
!=
NULL
;
pt_segm
=
NextSegZ
)
{
NextSegZ
=
pt_segm
->
Next
();
if
(
pt_segm
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
pt_segm
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
pt_segm
->
DeleteStructure
();
}
...
...
@@ -564,7 +557,7 @@ void WinEDA_BasePcbFrame::Block_Delete( wxDC* DC )
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
{
if
(
m_Pcb
->
GetArea
(
ii
)
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
m_Pcb
->
GetArea
(
ii
)
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
m_Pcb
->
Delete
(
m_Pcb
->
GetArea
(
ii
));
ii
--
;
// because the current data was removed, ii points actually the next data
...
...
@@ -597,9 +590,9 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
return
;
oldpos
=
GetScreen
()
->
m_Curseur
;
GetScreen
()
->
BlockLocate
.
Normalize
();
GetScreen
()
->
m_
BlockLocate
.
Normalize
();
centre
=
GetScreen
()
->
BlockLocate
.
Centre
();
// This is the rotation centre
centre
=
GetScreen
()
->
m_
BlockLocate
.
Centre
();
// This is the rotation centre
GetScreen
()
->
SetModify
();
...
...
@@ -611,7 +604,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
module
=
m_Pcb
->
m_Modules
;
for
(
;
module
!=
NULL
;
module
=
module
->
Next
()
)
{
if
(
!
module
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
module
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
continue
;
m_Pcb
->
m_Status_Pcb
=
0
;
module
->
m_Flags
=
0
;
...
...
@@ -635,7 +628,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
track
=
m_Pcb
->
m_Track
;
while
(
track
)
{
if
(
track
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
track
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
/* la piste est ici bonne a etre deplacee */
m_Pcb
->
m_Status_Pcb
=
0
;
RotatePoint
(
&
track
->
m_Start
,
centre
,
900
);
...
...
@@ -654,7 +647,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
track
=
(
TRACK
*
)
m_Pcb
->
m_Zone
;
while
(
track
)
{
if
(
track
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
track
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
RotatePoint
(
&
track
->
m_Start
,
centre
,
900
);
RotatePoint
(
&
track
->
m_End
,
centre
,
900
);
...
...
@@ -663,7 +656,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
}
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
{
if
(
m_Pcb
->
GetArea
(
ii
)
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
m_Pcb
->
GetArea
(
ii
)
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
m_Pcb
->
GetArea
(
ii
)
->
Rotate
(
centre
,
900
);
}
...
...
@@ -687,7 +680,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
RotatePoint
(
&
STRUCT
->
m_Start
,
centre
,
900
);
RotatePoint
(
&
STRUCT
->
m_End
,
centre
,
900
);
...
...
@@ -698,7 +691,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
#define STRUCT ( (TEXTE_PCB*) PtStruct )
if
(
!
Block_Include_PcbTextes
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
RotatePoint
(
&
STRUCT
->
m_Pos
,
centre
,
900
);
STRUCT
->
m_Orient
+=
900
;
...
...
@@ -711,7 +704,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
#define STRUCT ( (MIREPCB*) PtStruct )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre modifie */
RotatePoint
(
&
STRUCT
->
m_Pos
,
centre
,
900
);
...
...
@@ -722,7 +715,7 @@ void WinEDA_BasePcbFrame::Block_Rotate( wxDC* DC )
#define STRUCT ( (COTATION*) PtStruct )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
STRUCT
->
Rotate
(
centre
,
900
);
break
;
...
...
@@ -759,10 +752,10 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
return
;
memo
=
GetScreen
()
->
m_Curseur
;
GetScreen
()
->
BlockLocate
.
Normalize
();
GetScreen
()
->
m_
BlockLocate
.
Normalize
();
/* calcul du centre d'inversion */
centerY
=
GetScreen
()
->
BlockLocate
.
Centre
().
y
;
centerY
=
GetScreen
()
->
m_
BlockLocate
.
Centre
().
y
;
GetScreen
()
->
SetModify
();
...
...
@@ -773,7 +766,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
module
=
m_Pcb
->
m_Modules
;
for
(
;
module
!=
NULL
;
module
=
module
->
Next
()
)
{
if
(
!
module
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
module
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
continue
;
/* le module est ici bon a etre efface */
m_Pcb
->
m_Status_Pcb
=
0
;
...
...
@@ -804,7 +797,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
track
=
m_Pcb
->
m_Track
;
while
(
track
)
{
if
(
track
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
track
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
/* la piste est ici bonne a etre deplacee */
m_Pcb
->
m_Status_Pcb
=
0
;
INVERT
(
track
->
m_Start
.
y
);
...
...
@@ -826,7 +819,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
track
=
(
TRACK
*
)
m_Pcb
->
m_Zone
;
while
(
track
)
{
if
(
track
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
track
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
/* la piste est ici bonne a etre deplacee */
INVERT
(
track
->
m_Start
.
y
);
INVERT
(
track
->
m_End
.
y
);
...
...
@@ -836,7 +829,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
}
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
{
if
(
m_Pcb
->
GetArea
(
ii
)
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
m_Pcb
->
GetArea
(
ii
)
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
m_Pcb
->
GetArea
(
ii
)
->
Mirror
(
wxPoint
(
0
,
centerY
)
);
m_Pcb
->
GetArea
(
ii
)
->
SetLayer
(
ChangeSideNumLayer
(
m_Pcb
->
GetArea
(
ii
)
->
GetLayer
()
)
);
...
...
@@ -860,7 +853,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
#define STRUCT ( (DRAWSEGMENT*) PtStruct )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre selectionne */
if
(
STRUCT
->
m_Shape
==
S_ARC
)
...
...
@@ -877,7 +870,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
#define STRUCT ( (TEXTE_PCB*) PtStruct )
if
(
!
Block_Include_PcbTextes
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* le texte est ici bon a etre selectionne*/
INVERT
(
STRUCT
->
m_Pos
.
y
);
...
...
@@ -894,7 +887,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
#define STRUCT ( (MIREPCB*) PtStruct )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre modifie */
INVERT
(
STRUCT
->
m_Pos
.
y
);
...
...
@@ -906,7 +899,7 @@ void WinEDA_BasePcbFrame::Block_Invert( wxDC* DC )
#define STRUCT ( (COTATION*) PtStruct )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
PtStruct
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre modifie */
...
...
@@ -934,7 +927,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
{
int
masque_layer
;
wxPoint
oldpos
;
wxPoint
MoveVector
=
GetScreen
()
->
BlockLocate
.
m_MoveVector
;
wxPoint
MoveVector
=
GetScreen
()
->
m_
BlockLocate
.
m_MoveVector
;
oldpos
=
GetScreen
()
->
m_Curseur
;
DrawPanel
->
ManageCurseur
=
NULL
;
...
...
@@ -945,7 +938,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
GetScreen
()
->
m_Curseur
=
oldpos
;
DrawPanel
->
MouseToCursorSchema
();
GetScreen
()
->
SetModify
();
GetScreen
()
->
BlockLocate
.
Normalize
();
GetScreen
()
->
m_
BlockLocate
.
Normalize
();
/* Deplacement des modules */
if
(
Block_Include_Modules
)
...
...
@@ -955,7 +948,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
for
(
MODULE
*
module
=
m_Pcb
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
if
(
!
module
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
module
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
continue
;
/* le module est ici bon a etre deplace */
...
...
@@ -974,7 +967,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
{
for
(
TRACK
*
track
=
m_Pcb
->
m_Track
;
track
;
track
=
track
->
Next
()
)
{
if
(
track
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
track
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
/* la piste est ici bonne a etre deplacee */
m_Pcb
->
m_Status_Pcb
=
0
;
track
->
m_Start
+=
MoveVector
;
...
...
@@ -988,7 +981,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
{
for
(
TRACK
*
track
=
m_Pcb
->
m_Zone
;
track
;
track
=
track
->
Next
()
)
{
if
(
track
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
track
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
/* la piste est ici bonne a etre deplacee */
track
->
m_Start
+=
MoveVector
;
track
->
m_End
+=
MoveVector
;
...
...
@@ -996,7 +989,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
}
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
{
if
(
m_Pcb
->
GetArea
(
ii
)
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
m_Pcb
->
GetArea
(
ii
)
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
m_Pcb
->
GetArea
(
ii
)
->
Move
(
MoveVector
);
}
...
...
@@ -1018,7 +1011,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
#define STRUCT ( (DRAWSEGMENT*) item )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
item
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
item
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre efface */
STRUCT
->
m_Start
+=
MoveVector
;
...
...
@@ -1030,7 +1023,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
#define STRUCT ( (TEXTE_PCB*) item )
if
(
!
Block_Include_PcbTextes
)
break
;
if
(
!
item
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
item
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* le texte est ici bon a etre deplace */
/* Redessin du Texte */
...
...
@@ -1042,7 +1035,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
#define STRUCT ( (MIREPCB*) item )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
item
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
item
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre efface */
STRUCT
->
m_Pos
+=
MoveVector
;
...
...
@@ -1053,7 +1046,7 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
#define STRUCT ( (COTATION*) item )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
item
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
item
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre efface */
(
(
COTATION
*
)
item
)
->
Move
(
wxPoint
(
MoveVector
)
);
...
...
@@ -1079,7 +1072,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{
int
masque_layer
;
wxPoint
oldpos
;
wxPoint
MoveVector
=
GetScreen
()
->
BlockLocate
.
m_MoveVector
;
wxPoint
MoveVector
=
GetScreen
()
->
m_
BlockLocate
.
m_MoveVector
;
oldpos
=
GetScreen
()
->
m_Curseur
;
DrawPanel
->
ManageCurseur
=
NULL
;
...
...
@@ -1090,7 +1083,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
GetScreen
()
->
m_Curseur
=
oldpos
;
DrawPanel
->
MouseToCursorSchema
();
GetScreen
()
->
SetModify
();
GetScreen
()
->
BlockLocate
.
Normalize
();
GetScreen
()
->
m_
BlockLocate
.
Normalize
();
/* Module copy */
if
(
Block_Include_Modules
)
...
...
@@ -1102,7 +1095,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
for
(
MODULE
*
module
=
m_Pcb
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
MODULE
*
new_module
;
if
(
!
module
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
module
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
continue
;
/* le module est ici bon a etre deplace */
...
...
@@ -1130,7 +1123,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
while
(
track
)
{
next_track
=
track
->
Next
();
if
(
track
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
track
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
/* la piste est ici bonne a etre deplacee */
m_Pcb
->
m_Status_Pcb
=
0
;
...
...
@@ -1150,7 +1143,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
{
for
(
SEGZONE
*
segzone
=
m_Pcb
->
m_Zone
;
segzone
;
segzone
=
segzone
->
Next
()
)
{
if
(
segzone
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
segzone
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
SEGZONE
*
new_segzone
=
(
SEGZONE
*
)
segzone
->
Copy
();
...
...
@@ -1164,7 +1157,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
unsigned
imax
=
m_Pcb
->
GetAreaCount
();
for
(
unsigned
ii
=
0
;
ii
<
imax
;
ii
++
)
{
if
(
m_Pcb
->
GetArea
(
ii
)
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
m_Pcb
->
GetArea
(
ii
)
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
{
ZONE_CONTAINER
*
new_zone
=
new
ZONE_CONTAINER
(
m_Pcb
);
new_zone
->
Copy
(
m_Pcb
->
GetArea
(
ii
)
);
...
...
@@ -1191,7 +1184,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
#define STRUCT ( (DRAWSEGMENT*) item )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
item
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
item
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre copie */
...
...
@@ -1211,7 +1204,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
#define STRUCT ( (TEXTE_PCB*) item )
if
(
!
Block_Include_PcbTextes
)
break
;
if
(
!
item
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
item
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* le texte est ici bon a etre deplace */
TEXTE_PCB
*
new_pcbtext
=
new
TEXTE_PCB
(
m_Pcb
);
...
...
@@ -1230,7 +1223,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
#define STRUCT ( (MIREPCB*) item )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
item
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
item
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre efface */
MIREPCB
*
new_mire
=
new
MIREPCB
(
m_Pcb
);
...
...
@@ -1248,7 +1241,7 @@ void WinEDA_BasePcbFrame::Block_Duplicate( wxDC* DC )
#define STRUCT ( (COTATION*) item )
if
(
(
g_TabOneLayerMask
[
STRUCT
->
GetLayer
()]
&
masque_layer
)
==
0
)
break
;
if
(
!
item
->
HitTest
(
GetScreen
()
->
BlockLocate
)
)
if
(
!
item
->
HitTest
(
GetScreen
()
->
m_
BlockLocate
)
)
break
;
/* l'element est ici bon a etre copie */
COTATION
*
new_cotation
=
new
COTATION
(
m_Pcb
);
...
...
pcbnew/block_module_editor.cpp
View file @
8ec8cf3f
...
...
@@ -104,21 +104,21 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
int
ItemsCount
=
0
,
MustDoPlace
=
0
;
MODULE
*
Currentmodule
=
GetBoard
()
->
m_Modules
;
if
(
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
)
if
(
GetScreen
()
->
m_BlockLocate
.
GetCount
()
)
{
BlockState
state
=
GetScreen
()
->
BlockLocate
.
m_State
;
CmdBlockType
command
=
GetScreen
()
->
BlockLocate
.
m_Command
;
BlockState
state
=
GetScreen
()
->
m_
BlockLocate
.
m_State
;
CmdBlockType
command
=
GetScreen
()
->
m_
BlockLocate
.
m_Command
;
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
DC
);
GetScreen
()
->
BlockLocate
.
m_State
=
state
;
GetScreen
()
->
BlockLocate
.
m_Command
=
command
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
state
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
command
;
DrawPanel
->
ManageCurseur
=
DrawAndSizingBlockOutlines
;
DrawPanel
->
ForceCloseManageCurseur
=
AbortBlockCurrentCommand
;
GetScreen
()
->
m_Curseur
.
x
=
GetScreen
()
->
BlockLocate
.
GetRight
();
GetScreen
()
->
m_Curseur
.
y
=
GetScreen
()
->
BlockLocate
.
GetBottom
();
GetScreen
()
->
m_Curseur
.
x
=
GetScreen
()
->
m_
BlockLocate
.
GetRight
();
GetScreen
()
->
m_Curseur
.
y
=
GetScreen
()
->
m_
BlockLocate
.
GetBottom
();
DrawPanel
->
MouseToCursorSchema
();
}
switch
(
GetScreen
()
->
BlockLocate
.
m_Command
)
switch
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
)
{
case
BLOCK_IDLE
:
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace"
)
);
...
...
@@ -127,7 +127,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_DRAG
:
/* Drag */
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_COPY
:
/* Copy */
ItemsCount
=
MarkItemsInBloc
(
Currentmodule
,
GetScreen
()
->
BlockLocate
);
ItemsCount
=
MarkItemsInBloc
(
Currentmodule
,
GetScreen
()
->
m_
BlockLocate
);
if
(
ItemsCount
)
{
MustDoPlace
=
1
;
...
...
@@ -137,7 +137,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
}
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
DrawPanel
->
Refresh
(
TRUE
);
}
break
;
...
...
@@ -145,11 +145,11 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
MustDoPlace
=
1
;
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
break
;
case
BLOCK_DELETE
:
/* Delete */
ItemsCount
=
MarkItemsInBloc
(
Currentmodule
,
GetScreen
()
->
BlockLocate
);
ItemsCount
=
MarkItemsInBloc
(
Currentmodule
,
GetScreen
()
->
m_
BlockLocate
);
if
(
ItemsCount
)
SaveCopyInUndoList
(
Currentmodule
);
DeleteMarkedItems
(
Currentmodule
);
...
...
@@ -160,24 +160,24 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
break
;
case
BLOCK_ROTATE
:
ItemsCount
=
MarkItemsInBloc
(
Currentmodule
,
GetScreen
()
->
BlockLocate
);
ItemsCount
=
MarkItemsInBloc
(
Currentmodule
,
GetScreen
()
->
m_
BlockLocate
);
if
(
ItemsCount
)
SaveCopyInUndoList
(
Currentmodule
);
RotateMarkedItems
(
Currentmodule
,
GetScreen
()
->
BlockLocate
.
Centre
()
);
RotateMarkedItems
(
Currentmodule
,
GetScreen
()
->
m_
BlockLocate
.
Centre
()
);
break
;
case
BLOCK_MIRROR_X
:
case
BLOCK_MIRROR_Y
:
case
BLOCK_INVERT
:
/* mirror */
ItemsCount
=
MarkItemsInBloc
(
Currentmodule
,
GetScreen
()
->
BlockLocate
);
ItemsCount
=
MarkItemsInBloc
(
Currentmodule
,
GetScreen
()
->
m_
BlockLocate
);
if
(
ItemsCount
)
SaveCopyInUndoList
(
Currentmodule
);
MirrorMarkedItems
(
Currentmodule
,
GetScreen
()
->
BlockLocate
.
Centre
()
);
MirrorMarkedItems
(
Currentmodule
,
GetScreen
()
->
m_
BlockLocate
.
Centre
()
);
break
;
case
BLOCK_ZOOM
:
/* Window Zoom */
Window_Zoom
(
GetScreen
()
->
BlockLocate
);
Window_Zoom
(
GetScreen
()
->
m_
BlockLocate
);
break
;
case
BLOCK_ABORT
:
...
...
@@ -189,19 +189,17 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
if
(
MustDoPlace
<=
0
)
{
if
(
GetScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_SELECT_ITEMS_ONLY
)
if
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
!=
BLOCK_SELECT_ITEMS_ONLY
)
{
ClearMarkItems
(
Currentmodule
);
}
GetScreen
()
->
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
m_
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
SetCurItem
(
NULL
);
SetToolID
(
m_ID_current_state
,
DrawPanel
->
m_PanelDefaultCursor
,
wxEmptyString
);
SetToolID
(
m_ID_current_state
,
DrawPanel
->
m_PanelDefaultCursor
,
wxEmptyString
);
DrawPanel
->
Refresh
(
TRUE
);
}
...
...
@@ -229,9 +227,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
DisplayError
(
this
,
wxT
(
"HandleBlockPLace : ManageCurseur = NULL"
)
);
}
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
switch
(
GetScreen
()
->
BlockLocate
.
m_Command
)
switch
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
)
{
case
BLOCK_IDLE
:
err
=
TRUE
;
...
...
@@ -240,32 +238,32 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
case
BLOCK_DRAG
:
/* Drag */
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
SaveCopyInUndoList
(
Currentmodule
);
MoveMarkedItems
(
Currentmodule
,
GetScreen
()
->
BlockLocate
.
m_MoveVector
);
MoveMarkedItems
(
Currentmodule
,
GetScreen
()
->
m_
BlockLocate
.
m_MoveVector
);
DrawPanel
->
Refresh
(
TRUE
);
break
;
case
BLOCK_COPY
:
/* Copy */
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
SaveCopyInUndoList
(
Currentmodule
);
CopyMarkedItems
(
Currentmodule
,
GetScreen
()
->
BlockLocate
.
m_MoveVector
);
CopyMarkedItems
(
Currentmodule
,
GetScreen
()
->
m_
BlockLocate
.
m_MoveVector
);
break
;
case
BLOCK_PASTE
:
/* Paste (recopie du dernier bloc sauve */
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
break
;
case
BLOCK_MIRROR_X
:
case
BLOCK_MIRROR_Y
:
case
BLOCK_INVERT
:
/* Mirror by popup menu, from block move */
SaveCopyInUndoList
(
Currentmodule
);
MirrorMarkedItems
(
Currentmodule
,
GetScreen
()
->
BlockLocate
.
Centre
()
);
MirrorMarkedItems
(
Currentmodule
,
GetScreen
()
->
m_
BlockLocate
.
Centre
()
);
break
;
case
BLOCK_ROTATE
:
SaveCopyInUndoList
(
Currentmodule
);
RotateMarkedItems
(
Currentmodule
,
GetScreen
()
->
BlockLocate
.
Centre
()
);
RotateMarkedItems
(
Currentmodule
,
GetScreen
()
->
m_
BlockLocate
.
Centre
()
);
break
;
case
BLOCK_ZOOM
:
// Handled by HandleBlockEnd
...
...
@@ -280,9 +278,9 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
GetScreen
()
->
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
m_
BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
SetCurItem
(
NULL
);
DrawPanel
->
Refresh
(
TRUE
);
...
...
@@ -301,22 +299,20 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
* L'ensemble du block suit le curseur
*/
{
DrawBlockStruct
*
PtBlock
;
BLOCK_SELECTOR
*
PtBlock
;
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
BOARD_ITEM
*
item
;
wxPoint
move_offset
;
MODULE
*
Currentmodule
=
(
(
WinEDA_BasePcbFrame
*
)
wxGetApp
().
GetTopWindow
()
)
->
m_ModuleEditFrame
->
GetBoard
()
->
m_Modules
;
PtBlock
=
&
screen
->
BlockLocate
;
PtBlock
=
&
screen
->
m_
BlockLocate
;
GRSetDrawMode
(
DC
,
g_XorMode
);
/* Effacement ancien cadre */
if
(
erase
)
{
PtBlock
->
Offset
(
PtBlock
->
m_MoveVector
);
PtBlock
->
Draw
(
panel
,
DC
);
PtBlock
->
Offset
(
-
PtBlock
->
m_MoveVector
.
x
,
-
PtBlock
->
m_MoveVector
.
y
);
PtBlock
->
Draw
(
panel
,
DC
,
PtBlock
->
m_MoveVector
,
g_XorMode
,
PtBlock
->
m_Color
);
if
(
Currentmodule
)
{
...
...
@@ -356,10 +352,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
PtBlock
->
m_MoveVector
.
y
=
screen
->
m_Curseur
.
y
-
PtBlock
->
m_BlockLastCursorPosition
.
y
;
GRSetDrawMode
(
DC
,
g_XorMode
);
PtBlock
->
Offset
(
PtBlock
->
m_MoveVector
);
PtBlock
->
Draw
(
panel
,
DC
);
PtBlock
->
Offset
(
-
PtBlock
->
m_MoveVector
.
x
,
-
PtBlock
->
m_MoveVector
.
y
);
PtBlock
->
Draw
(
panel
,
DC
,
PtBlock
->
m_MoveVector
,
g_XorMode
,
PtBlock
->
m_Color
);
if
(
Currentmodule
)
...
...
pcbnew/controle.cpp
View file @
8ec8cf3f
...
...
@@ -500,10 +500,10 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
if
(
(
CurrentTime
-
g_SaveTime
)
>
g_TimeOut
)
{
wxString
tmpFileName
=
GetScreen
()
->
m_FileName
;
wx
String
filename
=
g_SaveFileName
+
PcbExtBuffer
;
wx
FileName
fn
=
wxFileName
(
wxEmptyString
,
g_SaveFileName
,
PcbExtBuffer
)
;
bool
flgmodify
=
GetScreen
()
->
IsModify
();
(
(
WinEDA_PcbFrame
*
)
this
)
->
SavePcbFile
(
filename
);
SavePcbFile
(
fn
.
GetFullPath
()
);
if
(
flgmodify
)
// Set the flags m_Modify cleared by SavePcbFile()
{
...
...
@@ -569,7 +569,7 @@ void WinEDA_PcbFrame::GeneralControle( wxDC* DC, wxPoint Mouse )
keep_on_grid
=
FALSE
;
/* Cursor is left off grid if no block in progress and no moving object */
if
(
GetScreen
()
->
BlockLocate
.
m_State
!=
STATE_NO_BLOCK
)
if
(
GetScreen
()
->
m_
BlockLocate
.
m_State
!=
STATE_NO_BLOCK
)
keep_on_grid
=
TRUE
;
EDA_BaseStruct
*
DrawStruct
=
GetScreen
()
->
GetCurItem
();
...
...
pcbnew/edit.cpp
View file @
8ec8cf3f
...
...
@@ -28,14 +28,14 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
/* Traite les selections d'outils et les commandes appelees du menu POPUP
*/
{
int
id
=
event
.
GetId
();
wxPoint
pos
;
int
id
=
event
.
GetId
();
wxPoint
pos
;
int
itmp
;
wxClientDC
dc
(
DrawPanel
);
int
itmp
;
wxClientDC
dc
(
DrawPanel
);
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
int
toggle
=
0
;
int
toggle
=
0
;
DrawPanel
->
CursorOff
(
&
dc
);
DrawPanel
->
PrepareGraphicContext
(
&
dc
);
...
...
@@ -151,26 +151,29 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
&
dc
);
}
/* Should not be executed, just in case */
if
(
GetScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
if
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
)
{
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
BlockLocate
.
m_BlockDrawStruct
=
NULL
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_IDLE
;
GetScreen
()
->
m_
BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
()
;
}
if
(
m_ID_current_state
==
0
)
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
else
SetCursor
(
DrawPanel
->
m_PanelCursor
=
DrawPanel
->
m_PanelDefaultCursor
);
break
;
case
ID_TOGGLE_PRESENT_COMMAND
:
/* if( DrawPanel->ManageCurseur
&& DrawPanel->ForceCloseManageCurseur )
{
DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
}
*/
/* if( DrawPanel->ManageCurseur
* && DrawPanel->ForceCloseManageCurseur )
* {
* DrawPanel->ForceCloseManageCurseur( DrawPanel, &dc );
* }
*/
break
;
default
:
// Finish (abort ) the command
if
(
DrawPanel
->
ManageCurseur
&&
DrawPanel
->
ForceCloseManageCurseur
)
...
...
@@ -178,168 +181,103 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel
->
ForceCloseManageCurseur
(
DrawPanel
,
&
dc
);
}
if
(
m_ID_current_state
!=
id
){
if
(
m_ID_last_state
!=
m_ID_current_state
)
m_ID_last_state
=
m_ID_current_state
;
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
if
(
m_ID_current_state
!=
id
)
{
if
(
m_ID_last_state
!=
m_ID_current_state
)
m_ID_last_state
=
m_ID_current_state
;
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
}
break
;
}
switch
(
id
)
// Execute command
{
case
0
:
break
;
case
0
:
break
;
case
ID_EXIT
:
Close
(
true
);
break
;
case
ID_TOGGLE_PRESENT_COMMAND
:
switch
(
m_ID_current_state
)
{
case
0
:
/* if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{
DrawStruct = PcbGeneralLocateAndDisplay();
}
if( (DrawStruct == NULL) || (DrawStruct->m_Flags != 0) )
break;
SendMessageToEESCHEMA( DrawStruct );
// An item is found
SetCurItem( DrawStruct );
switch( DrawStruct->Type() )
{
case TYPE_TRACK:
case TYPE_VIA:
if( DrawStruct->m_Flags & IS_NEW )
{
End_Route( (TRACK*) DrawStruct, DC );
DrawPanel->m_AutoPAN_Request = false;
}
else if( DrawStruct->m_Flags == 0 )
{
Edit_TrackSegm_Width( DC, (TRACK*) DrawStruct );
}
break;
case TYPE_TEXTE:
InstallTextPCBOptionsFrame( (TEXTE_PCB*) DrawStruct, DC );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_PAD:
InstallPadOptionsFrame( (D_PAD*) DrawStruct, &dc, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_MODULE:
InstallModuleOptionsFrame( (MODULE*) DrawStruct, &dc );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_MIRE:
InstallMireOptionsFrame( (MIREPCB*) DrawStruct, &dc, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_COTATION:
Install_Edit_Cotation( (COTATION*) DrawStruct, &dc, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_TEXTE_MODULE:
InstallTextModOptionsFrame( (TEXTE_MODULE*) DrawStruct, &dc, pos );
DrawPanel->MouseToCursorSchema();
break;
case TYPE_DRAWSEGMENT:
InstallGraphicItemPropertiesDialog((DRAWSEGMENT*)DrawStruct, &dc);
break;
case TYPE_ZONE_CONTAINER:
if( DrawStruct->m_Flags )
break;
Edit_Zone_Params( &dc, (ZONE_CONTAINER*) DrawStruct );
break;
default:
break;
}
break; // end case 0
*/
toggle
=
1
;
break
;
case
ID_TRACK_BUTT
:
if
(
DrawStruct
&&
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
{
End_Route
(
(
TRACK
*
)
DrawStruct
,
&
dc
);
DrawPanel
->
m_AutoPAN_Request
=
false
;
}
else
toggle
=
1
;
break
;
case
ID_PCB_ZONES_BUTT
:
if
(
End_Zone
(
&
dc
)
)
{
DrawPanel
->
m_AutoPAN_Request
=
false
;
SetCurItem
(
NULL
);
}
else
toggle
=
1
;
break
;
case
ID_LINE_COMMENT_BUTT
:
case
ID_PCB_ARC_BUTT
:
case
ID_PCB_CIRCLE_BUTT
:
if
(
DrawStruct
==
NULL
)
{}
else
if
(
DrawStruct
->
Type
()
!=
TYPE_DRAWSEGMENT
)
{
DisplayError
(
this
,
wxT
(
"DrawStruct Type error"
)
);
DrawPanel
->
m_AutoPAN_Request
=
false
;
}
else
if
(
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
{
End_Edge
(
(
DRAWSEGMENT
*
)
DrawStruct
,
&
dc
);
DrawPanel
->
m_AutoPAN_Request
=
false
;
SetCurItem
(
NULL
);
}
else
toggle
=
1
;
break
;
default
:
toggle
=
1
;
break
;
}
if
(
toggle
){
int
swap
=
m_ID_last_state
;
m_ID_last_state
=
m_ID_current_state
;
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
m_ID_current_state
=
swap
;
}
switch
(
m_ID_current_state
)
{
case
0
:
toggle
=
1
;
break
;
case
ID_TRACK_BUTT
:
if
(
DrawStruct
&&
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
{
End_Route
(
(
TRACK
*
)
DrawStruct
,
&
dc
);
DrawPanel
->
m_AutoPAN_Request
=
false
;
}
else
toggle
=
1
;
break
;
//SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
case
ID_PCB_ZONES_BUTT
:
if
(
End_Zone
(
&
dc
)
)
{
DrawPanel
->
m_AutoPAN_Request
=
false
;
SetCurItem
(
NULL
);
}
else
toggle
=
1
;
break
;
event
.
SetId
(
m_ID_current_state
);
Process_Special_Functions
(
event
);
case
ID_LINE_COMMENT_BUTT
:
case
ID_PCB_ARC_BUTT
:
case
ID_PCB_CIRCLE_BUTT
:
if
(
DrawStruct
==
NULL
)
{
}
else
if
(
DrawStruct
->
Type
()
!=
TYPE_DRAWSEGMENT
)
{
DisplayError
(
this
,
wxT
(
"DrawStruct Type error"
)
);
DrawPanel
->
m_AutoPAN_Request
=
false
;
}
else
if
(
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
{
End_Edge
(
(
DRAWSEGMENT
*
)
DrawStruct
,
&
dc
);
DrawPanel
->
m_AutoPAN_Request
=
false
;
SetCurItem
(
NULL
);
}
else
toggle
=
1
;
break
;
default
:
toggle
=
1
;
break
;
}
if
(
toggle
)
{
int
swap
=
m_ID_last_state
;
m_ID_last_state
=
m_ID_current_state
;
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
m_ID_current_state
=
swap
;
}
//SetCursor( DrawPanel->m_PanelCursor = DrawPanel->m_PanelDefaultCursor );
event
.
SetId
(
m_ID_current_state
);
Process_Special_Functions
(
event
);
break
;
case
ID_OPEN_MODULE_EDITOR
:
if
(
m_ModuleEditFrame
==
NULL
)
{
m_ModuleEditFrame
=
new
WinEDA_ModuleEditFrame
(
this
,
_
(
"Module Editor"
),
wxPoint
(
-
1
,
-
1
),
wxSize
(
600
,
400
)
);
_
(
"Module Editor"
),
wxPoint
(
-
1
,
-
1
),
wxSize
(
600
,
400
)
);
m_ModuleEditFrame
->
Show
(
true
);
m_ModuleEditFrame
->
Zoom_Automatique
(
true
);
}
...
...
@@ -357,40 +295,40 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_PLACE_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_MOVE
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_MOVE
;
DrawPanel
->
m_AutoPAN_Request
=
false
;
HandleBlockPlace
(
&
dc
);
break
;
case
ID_POPUP_COPY_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_COPY
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_COPY
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
DrawPanel
->
m_AutoPAN_Request
=
false
;
HandleBlockPlace
(
&
dc
);
break
;
case
ID_POPUP_ZOOM_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_ZOOM
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_ZOOM
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
HandleBlockEnd
(
&
dc
);
break
;
case
ID_POPUP_DELETE_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_DELETE
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_DELETE
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
HandleBlockEnd
(
&
dc
);
break
;
case
ID_POPUP_ROTATE_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_ROTATE
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_ROTATE
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
HandleBlockEnd
(
&
dc
);
break
;
case
ID_POPUP_INVERT_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_INVERT
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_INVERT
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
HandleBlockEnd
(
&
dc
);
break
;
...
...
@@ -617,13 +555,13 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
if
(
GetCurItem
()
==
NULL
)
break
;
{
SEGZONE
*
zsegm
=
(
SEGZONE
*
)
GetCurItem
();
int
netcode
=
zsegm
->
GetNet
();
Delete_Zone_Fill
(
&
dc
,
zsegm
);
SetCurItem
(
NULL
);
test_1_net_connexion
(
NULL
,
netcode
);
GetScreen
()
->
SetModify
();
GetBoard
()
->
DisplayInfo
(
this
);
SEGZONE
*
zsegm
=
(
SEGZONE
*
)
GetCurItem
();
int
netcode
=
zsegm
->
GetNet
();
Delete_Zone_Fill
(
&
dc
,
zsegm
);
SetCurItem
(
NULL
);
test_1_net_connexion
(
NULL
,
netcode
);
GetScreen
()
->
SetModify
();
GetBoard
()
->
DisplayInfo
(
this
);
}
break
;
...
...
@@ -648,11 +586,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_DELETE_ZONE_CUTOUT
:
DrawPanel
->
MouseToCursorSchema
();
{
int
netcode
=
((
ZONE_CONTAINER
*
)
GetCurItem
()
)
->
GetNet
();
Delete_Zone_Contour
(
&
dc
,
(
ZONE_CONTAINER
*
)
GetCurItem
()
);
SetCurItem
(
NULL
);
test_1_net_connexion
(
NULL
,
netcode
);
GetBoard
()
->
DisplayInfo
(
this
);
int
netcode
=
(
(
ZONE_CONTAINER
*
)
GetCurItem
()
)
->
GetNet
();
Delete_Zone_Contour
(
&
dc
,
(
ZONE_CONTAINER
*
)
GetCurItem
()
);
SetCurItem
(
NULL
);
test_1_net_connexion
(
NULL
,
netcode
);
GetBoard
()
->
DisplayInfo
(
this
);
}
break
;
...
...
@@ -730,7 +668,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_FILL_ALL_ZONES
:
DrawPanel
->
MouseToCursorSchema
();
Fill_All_Zones
();
GetBoard
()
->
DisplayInfo
(
this
);
GetBoard
()
->
DisplayInfo
(
this
);
break
;
case
ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE
:
...
...
@@ -740,24 +678,26 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
Delete_Zone_Fill
(
&
dc
,
NULL
,
zone_container
->
m_TimeStamp
);
test_1_net_connexion
(
NULL
,
zone_container
->
GetNet
()
);
GetScreen
()
->
SetModify
();
GetBoard
()
->
DisplayInfo
(
this
);
GetBoard
()
->
DisplayInfo
(
this
);
DrawPanel
->
Refresh
();
}
SetCurItem
(
NULL
);
break
;
case
ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_ALL_ZONES
:
// Remove all zones :
GetBoard
()
->
m_Zone
.
DeleteAll
();
// remove zone segments used to fill zones.
GetBoard
()
->
m_Zone
.
DeleteAll
();
// remove zone segments used to fill zones.
for
(
int
ii
=
0
;
ii
<
GetBoard
()
->
GetAreaCount
();
ii
++
)
{
// Remove filled aresa in zone
{
// Remove filled aresa in zone
ZONE_CONTAINER
*
zone_container
=
GetBoard
()
->
GetArea
(
ii
);
zone_container
->
m_FilledPolysList
.
clear
();;
}
SetCurItem
(
NULL
);
// CurItem might be deleted by this command, clear the pointer
SetCurItem
(
NULL
);
// CurItem might be deleted by this command, clear the pointer
test_connexions
(
NULL
);
Tst_Ratsnest
(
NULL
,
0
);
// Recalculate the active ratsnest, i.e. the unconnected links */
Tst_Ratsnest
(
NULL
,
0
);
// Recalculate the active ratsnest, i.e. the unconnected links */
GetScreen
()
->
SetModify
();
GetBoard
()
->
DisplayInfo
(
this
);
GetBoard
()
->
DisplayInfo
(
this
);
DrawPanel
->
Refresh
();
break
;
...
...
@@ -765,7 +705,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel
->
MouseToCursorSchema
();
Fill_Zone
(
NULL
,
(
ZONE_CONTAINER
*
)
GetCurItem
()
);
test_1_net_connexion
(
NULL
,
(
(
ZONE_CONTAINER
*
)
GetCurItem
()
)
->
GetNet
()
);
GetBoard
()
->
DisplayInfo
(
this
);
GetBoard
()
->
DisplayInfo
(
this
);
DrawPanel
->
Refresh
();
break
;
...
...
@@ -927,19 +867,19 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_SELECT_LAYER
:
itmp
=
SelectLayer
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
,
-
1
,
-
1
);
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
,
-
1
,
-
1
);
if
(
itmp
>=
0
)
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
=
itmp
;
DrawPanel
->
MouseToCursorSchema
();
break
;
case
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR
:
case
ID_AUX_TOOLBAR_PCB_SELECT_LAYER_PAIR
:
SelectLayerPair
();
break
;
case
ID_POPUP_PCB_SELECT_NO_CU_LAYER
:
itmp
=
SelectLayer
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
,
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
,
FIRST_NO_COPPER_LAYER
,
-
1
);
if
(
itmp
>=
0
)
...
...
@@ -949,7 +889,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_SELECT_CU_LAYER
:
itmp
=
SelectLayer
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
,
-
1
,
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
,
-
1
,
LAST_COPPER_LAYER
);
if
(
itmp
>=
0
)
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
=
itmp
;
...
...
@@ -1022,7 +962,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_GETINFO_MARKER
:
if
(
GetCurItem
()
&&
GetCurItem
()
->
Type
()
==
TYPE_MARKER
)
(
(
MARKER
*
)
GetCurItem
()
)
->
DisplayMarkerInfo
(
this
);
(
(
MARKER
*
)
GetCurItem
()
)
->
DisplayMarkerInfo
(
this
);
DrawPanel
->
MouseToCursorSchema
();
break
;
...
...
@@ -1033,7 +973,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_PCB_EDIT_DRAWING
:
InstallGraphicItemPropertiesDialog
(
(
DRAWSEGMENT
*
)
GetCurItem
(),
&
dc
);
InstallGraphicItemPropertiesDialog
(
(
DRAWSEGMENT
*
)
GetCurItem
(),
&
dc
);
DrawPanel
->
MouseToCursorSchema
();
break
;
...
...
@@ -1084,6 +1024,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
g_DesignSettings
.
m_UseConnectedTrackWidth
=
false
;
}
break
;
case
ID_AUX_TOOLBAR_PCB_CLR_WIDTH
:
{
int
ii
=
m_SelClrWidthBox
->
GetChoice
();
...
...
@@ -1091,7 +1032,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
g_DesignSettings
.
m_TrackClearenceHistory
[
ii
];
DisplayTrackSettings
();
m_SelTrackWidthBox_Changed
=
false
;
m_SelClrWidthBox_Changed
=
false
;
m_SelClrWidthBox_Changed
=
false
;
m_SelViaSizeBox_Changed
=
false
;
g_DesignSettings
.
m_UseConnectedTrackWidth
=
false
;
}
...
...
@@ -1225,7 +1166,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
default
:
wxString
msg
;
wxString
msg
;
msg
.
Printf
(
wxT
(
"WinEDA_PcbFrame::Process_Special_Functions() id %d error"
),
DrawStruct
->
Type
()
);
...
...
@@ -1252,7 +1193,7 @@ static void Process_Move_Item( WinEDA_PcbFrame* frame,
switch
(
DrawStruct
->
Type
()
)
{
case
TYPE_TEXTE
:
case
TYPE_TEXTE
:
frame
->
StartMoveTextePcb
(
(
TEXTE_PCB
*
)
DrawStruct
,
DC
);
break
;
...
...
@@ -1314,14 +1255,14 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
break
;
case
TYPE_ZONE_CONTAINER
:
{
{
SetCurItem
(
NULL
);
int
netcode
=
(
(
ZONE_CONTAINER
*
)
Item
)
->
GetNet
();
int
netcode
=
(
(
ZONE_CONTAINER
*
)
Item
)
->
GetNet
();
Delete_Zone_Contour
(
DC
,
(
ZONE_CONTAINER
*
)
Item
);
test_1_net_connexion
(
NULL
,
netcode
);
GetBoard
()
->
DisplayInfo
(
this
);
}
break
;
GetBoard
()
->
DisplayInfo
(
this
);
}
break
;
case
TYPE_MARKER
:
if
(
Item
==
GetCurItem
()
)
...
...
pcbnew/modedit.cpp
View file @
8ec8cf3f
...
...
@@ -2,10 +2,6 @@
/* modedit.cpp */
/****************/
#ifdef __GNUG__
#pragma implementation
#endif
#include "fctsys.h"
#include "appl_wxstruct.h"
#include "class_drawpanel.h"
...
...
@@ -637,7 +633,7 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_PLACE_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_MOVE
;
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_MOVE
;
DrawPanel
->
m_AutoPAN_Request
=
FALSE
;
{
SET_DC
;
...
...
@@ -646,8 +642,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_COPY_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_COPY
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_COPY
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
DrawPanel
->
m_AutoPAN_Request
=
FALSE
;
{
SET_DC
;
...
...
@@ -656,8 +652,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_ZOOM_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_ZOOM
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_ZOOM
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
{
SET_DC
;
HandleBlockEnd
(
&
dc
);
...
...
@@ -665,8 +661,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_DELETE_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_DELETE
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_DELETE
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
{
SET_DC
;
HandleBlockEnd
(
&
dc
);
...
...
@@ -674,8 +670,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_ROTATE_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_ROTATE
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_ROTATE
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
{
SET_DC
;
HandleBlockEnd
(
&
dc
);
...
...
@@ -685,8 +681,8 @@ void WinEDA_ModuleEditFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_MIRROR_X_BLOCK
:
case
ID_POPUP_MIRROR_Y_BLOCK
:
case
ID_POPUP_INVERT_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_INVERT
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
GetScreen
()
->
m_
BlockLocate
.
m_Command
=
BLOCK_INVERT
;
GetScreen
()
->
m_
BlockLocate
.
SetMessageBlock
(
this
);
{
SET_DC
;
HandleBlockEnd
(
&
dc
);
...
...
pcbnew/modedit_onclick.cpp
View file @
8ec8cf3f
...
...
@@ -177,7 +177,7 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
BOARD_ITEM
*
DrawStruct
=
GetCurItem
();
wxString
msg
;
bool
append_set_width
=
FALSE
;
bool
BlockActive
=
(
GetScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
bool
BlockActive
=
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
// Simple localisation des elements si possible
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
m_Flags
==
0
)
)
...
...
pcbnew/onrightclick.cpp
View file @
8ec8cf3f
...
...
@@ -97,7 +97,7 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
wxString
msg
;
int
flags
=
0
;
bool
locate_track
=
FALSE
;
bool
BlockActive
=
(
GetScreen
()
->
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
bool
BlockActive
=
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
!=
BLOCK_IDLE
);
wxClientDC
dc
(
DrawPanel
);
...
...
pcbnew/pcbframe.cpp
View file @
8ec8cf3f
...
...
@@ -384,7 +384,7 @@ void WinEDA_PcbFrame::SetToolbars()
m_HToolBar
->
EnableTool
(
ID_SAVE_BOARD
,
GetScreen
()
->
IsModify
()
);
if
(
GetScreen
()
->
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
if
(
GetScreen
()
->
m_
BlockLocate
.
m_Command
==
BLOCK_MOVE
)
{
m_HToolBar
->
EnableTool
(
wxID_CUT
,
TRUE
);
m_HToolBar
->
EnableTool
(
wxID_COPY
,
TRUE
);
...
...
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