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
9b77f2a4
Commit
9b77f2a4
authored
Nov 13, 2010
by
jean-pierre charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Formatting, code cleaning and fix erroneous or inconsistent comments in block functions
parent
bc9d5217
Changes
12
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
450 additions
and
442 deletions
+450
-442
drawframe.cpp
common/drawframe.cpp
+2
-2
block.cpp
eeschema/block.cpp
+36
-34
block_libedit.cpp
eeschema/block_libedit.cpp
+6
-6
libeditframe.h
eeschema/libeditframe.h
+78
-76
block.cpp
gerbview/block.cpp
+25
-21
wxGerberFrame.h
gerbview/wxGerberFrame.h
+2
-2
wxEeschemaStruct.h
include/wxEeschemaStruct.h
+31
-3
wxPcbStruct.h
include/wxPcbStruct.h
+30
-3
wxstruct.h
include/wxstruct.h
+32
-5
block.cpp
pcbnew/block.cpp
+158
-245
block_module_editor.cpp
pcbnew/block_module_editor.cpp
+48
-43
module_editor_frame.h
pcbnew/module_editor_frame.h
+2
-2
No files found.
common/drawframe.cpp
View file @
9b77f2a4
...
...
@@ -462,9 +462,9 @@ void WinEDA_DrawFrame::HandleBlockPlace( wxDC* DC )
}
int
WinEDA_DrawFrame
::
HandleBlockEnd
(
wxDC
*
DC
)
bool
WinEDA_DrawFrame
::
HandleBlockEnd
(
wxDC
*
DC
)
{
return
0
;
return
false
;
}
...
...
eeschema/block.cpp
View file @
9b77f2a4
...
...
@@ -101,19 +101,19 @@ void WinEDA_SchematicFrame::InitBlockPasteInfos()
*/
void
WinEDA_SchematicFrame
::
HandleBlockPlace
(
wxDC
*
DC
)
{
bool
err
=
FALSE
;
bool
err
=
false
;
BLOCK_SELECTOR
*
block
=
&
GetScreen
()
->
m_BlockLocate
;
if
(
DrawPanel
->
ManageCurseur
==
NULL
)
{
err
=
TRUE
;
err
=
true
;
DisplayError
(
this
,
wxT
(
"HandleBlockPLace() : ManageCurseur = NULL"
)
);
}
if
(
block
->
GetCount
()
==
0
)
{
wxString
msg
;
err
=
TRUE
;
err
=
true
;
msg
.
Printf
(
wxT
(
"HandleBlockPLace() error : no items to place (cmd %d, state %d)"
),
block
->
m_Command
,
block
->
m_State
);
DisplayError
(
this
,
msg
);
...
...
@@ -124,7 +124,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
switch
(
block
->
m_Command
)
{
case
BLOCK_IDLE
:
err
=
TRUE
;
err
=
true
;
break
;
case
BLOCK_ROTATE
:
...
...
@@ -133,7 +133,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
case
BLOCK_DRAG
:
/* Drag */
case
BLOCK_MOVE
:
/* Move */
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
SaveCopyInUndoList
(
block
->
m_ItemsSelection
,
UR_MOVED
,
block
->
m_MoveVector
);
MoveItemsInList
(
block
->
m_ItemsSelection
,
block
->
m_MoveVector
);
...
...
@@ -143,7 +143,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
case
BLOCK_COPY
:
/* Copy */
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
DuplicateItemsInList
(
GetScreen
(),
block
->
m_ItemsSelection
,
block
->
m_MoveVector
);
...
...
@@ -155,7 +155,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
case
BLOCK_PASTE
:
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
PasteListOfItems
(
DC
);
block
->
ClearItemsList
();
break
;
...
...
@@ -194,16 +194,20 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
}
/* Manage end block command
* Returns:
* 0 if no features selected
* 1 otherwise
* -1 If control ended and components selection (block delete, block save)
/**
* Function HandleBlockEnd( )
* Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed
* or parameters are initialized to prepare a call to HandleBlockPlace
* in GetScreen()->m_BlockLocate
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later
*/
int
WinEDA_SchematicFrame
::
HandleBlockEnd
(
wxDC
*
DC
)
bool
WinEDA_SchematicFrame
::
HandleBlockEnd
(
wxDC
*
DC
)
{
int
ii
=
0
;
bool
zoom_command
=
FALSE
;
bool
nextcmd
=
false
;
bool
zoom_command
=
false
;
BLOCK_SELECTOR
*
block
=
&
GetScreen
()
->
m_BlockLocate
;
if
(
block
->
GetCount
()
)
...
...
@@ -241,16 +245,16 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
if
(
block
->
GetCount
()
)
{
ii
=
1
;
nextcmd
=
true
;
CollectStructsToDrag
(
GetScreen
()
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
block
->
m_State
=
STATE_BLOCK_MOVE
;
}
else
{
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
}
...
...
@@ -258,10 +262,9 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_DELETE
:
/* Delete */
PickItemsInBlock
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
false
);
if
(
block
->
GetCount
()
)
{
ii
=
-
1
;
DeleteItemsInList
(
DrawPanel
,
block
->
m_ItemsSelection
);
OnModify
();
}
...
...
@@ -272,14 +275,13 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_SAVE
:
/* Save */
PickItemsInBlock
(
GetScreen
()
->
m_BlockLocate
,
GetScreen
()
);
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
FALSE
);
DrawAndSizingBlockOutlines
(
DrawPanel
,
DC
,
false
);
if
(
block
->
GetCount
()
)
{
wxPoint
move_vector
=
-
GetScreen
()
->
m_BlockLocate
.
m_BlockLastCursorPosition
;
SaveStructListForPaste
(
block
->
m_ItemsSelection
);
MoveItemsInList
(
g_BlockSaveDataList
.
m_ItemsSelection
,
move_vector
);
ii
=
-
1
;
}
}
block
->
ClearItemsList
();
break
;
...
...
@@ -292,7 +294,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_ZOOM
:
/* Window Zoom */
zoom_command
=
TRUE
;
zoom_command
=
true
;
break
;
case
BLOCK_SELECT_ITEMS_ONLY
:
/* Not used */
...
...
@@ -305,7 +307,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
GetScreen
()
->
ClearDrawingState
();
}
if
(
ii
<=
0
)
if
(
!
nextcmd
)
{
block
->
m_Flags
=
0
;
block
->
m_State
=
STATE_NO_BLOCK
;
...
...
@@ -319,7 +321,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
if
(
zoom_command
)
Window_Zoom
(
GetScreen
()
->
m_BlockLocate
);
return
ii
;
return
nextcmd
;
}
...
...
@@ -359,7 +361,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
case
BLOCK_DRAG
:
/* move to Drag */
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
// Clear list of items to move, and rebuild it with items to drag:
block
->
ClearItemsList
();
...
...
@@ -371,14 +373,14 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
blockCmdFinished
=
false
;
CollectStructsToDrag
(
(
SCH_SCREEN
*
)
GetScreen
()
);
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
block
->
m_State
=
STATE_BLOCK_MOVE
;
}
break
;
case
BLOCK_DELETE
:
/* move to Delete */
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
if
(
block
->
GetCount
()
)
{
DeleteItemsInList
(
DrawPanel
,
block
->
m_ItemsSelection
);
...
...
@@ -390,7 +392,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
case
BLOCK_SAVE
:
/* Save list in paste buffer*/
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
if
(
block
->
GetCount
()
)
{
wxPoint
move_vector
=
-
GetScreen
()
->
m_BlockLocate
.
m_BlockLastCursorPosition
;
...
...
@@ -408,7 +410,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
case
BLOCK_ROTATE
:
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
if
(
block
->
GetCount
()
)
{
// blockCmdFinished = true;
...
...
@@ -427,7 +429,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
case
BLOCK_MIRROR_X
:
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
if
(
block
->
GetCount
()
)
{
// blockCmdFinished = true;
...
...
@@ -446,7 +448,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
case
BLOCK_MIRROR_Y
:
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
if
(
block
->
GetCount
()
)
{
// blockCmdFinished = true;
...
...
eeschema/block_libedit.cpp
View file @
9b77f2a4
...
...
@@ -69,10 +69,10 @@ int WinEDA_LibeditFrame::ReturnBlockCommand( int key )
* 1 if HandleBlockPlace must follow (items found, and a block place
* command must follow)
*/
int
WinEDA_LibeditFrame
::
HandleBlockEnd
(
wxDC
*
DC
)
bool
WinEDA_LibeditFrame
::
HandleBlockEnd
(
wxDC
*
DC
)
{
int
ItemCount
=
0
;
int
MustDoPlace
=
0
;
int
nextCmd
=
false
;
wxPoint
pt
;
if
(
GetScreen
()
->
m_BlockLocate
.
GetCount
()
)
...
...
@@ -104,7 +104,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
g_EditPinByPinIsOn
);
if
(
ItemCount
)
{
MustDoPlace
=
1
;
nextCmd
=
true
;
if
(
DrawPanel
->
ManageCurseur
!=
NULL
)
{
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
...
...
@@ -117,7 +117,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
break
;
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
MustDoPlace
=
1
;
nextCmd
=
true
;
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
GetScreen
()
->
m_BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
break
;
...
...
@@ -165,7 +165,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
break
;
}
if
(
MustDoPlace
<=
0
)
if
(
!
nextCmd
)
{
if
(
GetScreen
()
->
m_BlockLocate
.
m_Command
!=
BLOCK_SELECT_ITEMS_ONLY
)
if
(
m_component
)
...
...
@@ -182,7 +182,7 @@ int WinEDA_LibeditFrame::HandleBlockEnd( wxDC* DC )
}
return
MustDoPlace
;
return
nextCmd
;
}
...
...
eeschema/libeditframe.h
View file @
9b77f2a4
This diff is collapsed.
Click to expand it.
gerbview/block.cpp
View file @
9b77f2a4
...
...
@@ -88,11 +88,11 @@ int WinEDA_GerberFrame::ReturnBlockCommand( int key )
/* Routine to handle the BLOCK PLACE command */
void
WinEDA_GerberFrame
::
HandleBlockPlace
(
wxDC
*
DC
)
{
bool
err
=
FALSE
;
bool
err
=
false
;
if
(
DrawPanel
->
ManageCurseur
==
NULL
)
{
err
=
TRUE
;
err
=
true
;
DisplayError
(
this
,
wxT
(
"Error in HandleBlockPLace : ManageCurseur = NULL"
)
);
}
...
...
@@ -101,21 +101,21 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
switch
(
GetScreen
()
->
m_BlockLocate
.
m_Command
)
{
case
BLOCK_IDLE
:
err
=
TRUE
;
err
=
true
;
break
;
case
BLOCK_DRAG
:
/* Drag */
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
Block_Move
(
DC
);
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
();
break
;
case
BLOCK_COPY
:
/* Copy */
if
(
DrawPanel
->
ManageCurseur
)
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
Block_Duplicate
(
DC
);
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
();
break
;
...
...
@@ -152,16 +152,20 @@ void WinEDA_GerberFrame::HandleBlockPlace( wxDC* DC )
}
/* Routine management command END BLOCK
* Returns:
* 0 if no and selects compounds
* 1 otherwise
* -1 If order is completed and components found (block delete, block save)
/**
* Function HandleBlockEnd( )
* Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed
* or parameters are initialized to prepare a call to HandleBlockPlace
* in GetScreen()->m_BlockLocate
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later
*/
int
WinEDA_GerberFrame
::
HandleBlockEnd
(
wxDC
*
DC
)
bool
WinEDA_GerberFrame
::
HandleBlockEnd
(
wxDC
*
DC
)
{
int
endcommande
=
TRUE
;
bool
zoom_command
=
FALSE
;
bool
nextcmd
=
false
;
bool
zoom_command
=
false
;
if
(
DrawPanel
->
ManageCurseur
)
...
...
@@ -177,15 +181,15 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_COPY
:
/* Copy */
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list */
GetScreen
()
->
m_BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
endcommande
=
FALSE
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
nextcmd
=
true
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
break
;
case
BLOCK_DELETE
:
/* Delete */
GetScreen
()
->
m_BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
false
);
Block_Delete
(
DC
);
break
;
...
...
@@ -197,7 +201,7 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
break
;
case
BLOCK_ZOOM
:
/* Window Zoom */
zoom_command
=
TRUE
;
zoom_command
=
true
;
break
;
case
BLOCK_ABORT
:
...
...
@@ -206,7 +210,7 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
break
;
}
if
(
endcommande
==
TRUE
)
if
(
!
nextcmd
)
{
GetScreen
()
->
m_BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
m_BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
...
...
@@ -220,7 +224,7 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
if
(
zoom_command
)
Window_Zoom
(
GetScreen
()
->
m_BlockLocate
);
return
endcommande
;
return
nextcmd
;
}
...
...
@@ -325,7 +329,7 @@ void WinEDA_GerberFrame::Block_Move( wxDC* DC )
gerb_item
->
MoveAB
(
delta
);
}
DrawPanel
->
Refresh
(
TRUE
);
DrawPanel
->
Refresh
(
true
);
}
...
...
gerbview/wxGerberFrame.h
View file @
9b77f2a4
...
...
@@ -248,9 +248,9 @@ public:
void
InstallPcbGlobalDeleteFrame
(
const
wxPoint
&
pos
);
/* handlers for block commands */
int
ReturnBlockCommand
(
int
key
);
virtual
int
ReturnBlockCommand
(
int
key
);
virtual
void
HandleBlockPlace
(
wxDC
*
DC
);
virtual
int
HandleBlockEnd
(
wxDC
*
DC
);
virtual
bool
HandleBlockEnd
(
wxDC
*
DC
);
/* Block operations: */
/**
...
...
include/wxEeschemaStruct.h
View file @
9b77f2a4
...
...
@@ -581,12 +581,40 @@ public:
void
Key
(
wxDC
*
DC
,
int
hotkey
,
EDA_BaseStruct
*
DrawStruct
);
/* Block operations. */
int
ReturnBlockCommand
(
int
key
);
void
InitBlockPasteInfos
();
void
HandleBlockPlace
(
wxDC
*
DC
);
int
HandleBlockEnd
(
wxDC
*
DC
);
void
HandleBlockEndByPopUp
(
int
Command
,
wxDC
*
DC
);
/**
* Function ReturnBlockCommand
* Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...)
* corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when
* block command is started by dragging the mouse.
* @param aKey = the key modifiers (Alt, Shift ...)
* @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
*/
virtual
int
ReturnBlockCommand
(
int
key
);
/**
* Function HandleBlockPlace( )
* Called after HandleBlockEnd, when a block command needs to be
* executed after the block is moved to its new place
* (bloc move, drag, copy .. )
* Parameters must be initialized in GetScreen()->m_BlockLocate
*/
virtual
void
HandleBlockPlace
(
wxDC
*
DC
);
/**
* Function HandleBlockEnd( )
* Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed
* or parameters are initialized to prepare a call to HandleBlockPlace
* in GetScreen()->m_BlockLocate
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later
*/
virtual
bool
HandleBlockEnd
(
wxDC
*
DC
);
void
RepeatDrawItem
(
wxDC
*
DC
);
void
TestDanglingEnds
(
SCH_ITEM
*
DrawList
,
wxDC
*
DC
);
...
...
include/wxPcbStruct.h
View file @
9b77f2a4
...
...
@@ -473,9 +473,36 @@ public:
/* Block operations: */
int
ReturnBlockCommand
(
int
key
);
void
HandleBlockPlace
(
wxDC
*
DC
);
int
HandleBlockEnd
(
wxDC
*
DC
);
/**
* Function ReturnBlockCommand
* Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...)
* corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when
* block command is started by dragging the mouse.
* @param aKey = the key modifiers (Alt, Shift ...)
* @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
*/
virtual
int
ReturnBlockCommand
(
int
key
);
/**
* Function HandleBlockPlace( )
* Called after HandleBlockEnd, when a block command needs to be
* executed after the block is moved to its new place
* (bloc move, drag, copy .. )
* Parameters must be initialized in GetScreen()->m_BlockLocate
*/
virtual
void
HandleBlockPlace
(
wxDC
*
DC
);
/**
* Function HandleBlockEnd( )
* Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed
* or parameters are initialized to prepare a call to HandleBlockPlace
* in GetScreen()->m_BlockLocate
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later
*/
virtual
bool
HandleBlockEnd
(
wxDC
*
DC
);
/**
* Function Block_SelectItems
...
...
include/wxstruct.h
View file @
9b77f2a4
...
...
@@ -445,12 +445,39 @@ public:
void
DisplayUnitsMsg
();
/* Handlers for block commands */
virtual
int
ReturnBlockCommand
(
int
key
);
virtual
void
InitBlockPasteInfos
();
virtual
bool
HandleBlockBegin
(
wxDC
*
DC
,
int
cmd_type
,
const
wxPoint
&
startpos
);
virtual
void
HandleBlockPlace
(
wxDC
*
DC
);
virtual
int
HandleBlockEnd
(
wxDC
*
DC
);
virtual
bool
HandleBlockBegin
(
wxDC
*
DC
,
int
cmd_type
,
const
wxPoint
&
startpos
);
/**
* Function ReturnBlockCommand
* Returns the block command internat code (BLOCK_MOVE, BLOCK_COPY...)
* corresponding to the keys pressed (ALT, SHIFT, SHIFT ALT ..) when
* block command is started by dragging the mouse.
* @param aKey = the key modifiers (Alt, Shift ...)
* @return the block command id (BLOCK_MOVE, BLOCK_COPY...)
*/
virtual
int
ReturnBlockCommand
(
int
key
);
/**
* Function HandleBlockPlace( )
* Called after HandleBlockEnd, when a block command needs to be
* executed after the block is moved to its new place
* (bloc move, drag, copy .. )
* Parameters must be initialized in GetScreen()->m_BlockLocate
*/
virtual
void
HandleBlockPlace
(
wxDC
*
DC
);
/**
* Function HandleBlockEnd( )
* Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed
* or parameters are initialized to prepare a call to HandleBlockPlace
* in GetScreen()->m_BlockLocate
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later
*/
virtual
bool
HandleBlockEnd
(
wxDC
*
DC
);
void
CopyToClipboard
(
wxCommandEvent
&
event
);
...
...
pcbnew/block.cpp
View file @
9b77f2a4
This diff is collapsed.
Click to expand it.
pcbnew/block_module_editor.cpp
View file @
9b77f2a4
...
...
@@ -86,16 +86,21 @@ int WinEDA_ModuleEditFrame::ReturnBlockCommand( int key )
}
/* Command BLOCK END (end of block sizing)
* return :
* 0 if command finished (zoom, delete ...)
* 1 if HandleBlockPlace must follow (items found, and a block place command
* must follow)
/**
* Function HandleBlockEnd( )
* Handle the "end" of a block command,
* i.e. is called at the end of the definition of the area of a block.
* depending on the current block command, this command is executed
* or parameters are initialized to prepare a call to HandleBlockPlace
* in GetScreen()->m_BlockLocate
* @return false if no item selected, or command finished,
* true if some items found and HandleBlockPlace must be called later
*/
int
WinEDA_ModuleEditFrame
::
HandleBlockEnd
(
wxDC
*
DC
)
bool
WinEDA_ModuleEditFrame
::
HandleBlockEnd
(
wxDC
*
DC
)
{
int
ItemsCount
=
0
,
MustDoPlace
=
0
;
MODULE
*
Currentmodule
=
GetBoard
()
->
m_Modules
;
int
itemsCount
=
0
;
bool
nextcmd
=
false
;
MODULE
*
currentModule
=
GetBoard
()
->
m_Modules
;
if
(
GetScreen
()
->
m_BlockLocate
.
GetCount
()
)
{
...
...
@@ -120,11 +125,11 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_DRAG
:
/* Drag */
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_COPY
:
/* Copy */
ItemsCount
=
MarkItemsInBloc
(
Currentm
odule
,
itemsCount
=
MarkItemsInBloc
(
currentM
odule
,
GetScreen
()
->
m_BlockLocate
);
if
(
I
temsCount
)
if
(
i
temsCount
)
{
MustDoPlace
=
1
;
nextcmd
=
true
;
if
(
DrawPanel
->
ManageCurseur
!=
NULL
)
{
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
...
...
@@ -137,16 +142,16 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
break
;
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
MustDoPlace
=
1
;
nextcmd
=
true
;
DrawPanel
->
ManageCurseur
=
DrawMovingBlockOutlines
;
GetScreen
()
->
m_BlockLocate
.
m_State
=
STATE_BLOCK_MOVE
;
break
;
case
BLOCK_DELETE
:
/* Delete */
ItemsCount
=
MarkItemsInBloc
(
Currentm
odule
,
GetScreen
()
->
m_BlockLocate
);
if
(
I
temsCount
)
SaveCopyInUndoList
(
Currentm
odule
,
UR_MODEDIT
);
DeleteMarkedItems
(
Currentm
odule
);
itemsCount
=
MarkItemsInBloc
(
currentM
odule
,
GetScreen
()
->
m_BlockLocate
);
if
(
i
temsCount
)
SaveCopyInUndoList
(
currentM
odule
,
UR_MODEDIT
);
DeleteMarkedItems
(
currentM
odule
);
break
;
case
BLOCK_SAVE
:
/* Save */
...
...
@@ -154,20 +159,20 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
break
;
case
BLOCK_ROTATE
:
ItemsCount
=
MarkItemsInBloc
(
Currentm
odule
,
GetScreen
()
->
m_BlockLocate
);
if
(
I
temsCount
)
SaveCopyInUndoList
(
Currentm
odule
,
UR_MODEDIT
);
RotateMarkedItems
(
Currentm
odule
,
GetScreen
()
->
m_BlockLocate
.
Centre
()
);
itemsCount
=
MarkItemsInBloc
(
currentM
odule
,
GetScreen
()
->
m_BlockLocate
);
if
(
i
temsCount
)
SaveCopyInUndoList
(
currentM
odule
,
UR_MODEDIT
);
RotateMarkedItems
(
currentM
odule
,
GetScreen
()
->
m_BlockLocate
.
Centre
()
);
break
;
case
BLOCK_MIRROR_X
:
case
BLOCK_MIRROR_Y
:
case
BLOCK_FLIP
:
/* mirror */
ItemsCount
=
MarkItemsInBloc
(
Currentm
odule
,
GetScreen
()
->
m_BlockLocate
);
if
(
I
temsCount
)
SaveCopyInUndoList
(
Currentm
odule
,
UR_MODEDIT
);
MirrorMarkedItems
(
Currentm
odule
,
GetScreen
()
->
m_BlockLocate
.
Centre
()
);
itemsCount
=
MarkItemsInBloc
(
currentM
odule
,
GetScreen
()
->
m_BlockLocate
);
if
(
i
temsCount
)
SaveCopyInUndoList
(
currentM
odule
,
UR_MODEDIT
);
MirrorMarkedItems
(
currentM
odule
,
GetScreen
()
->
m_BlockLocate
.
Centre
()
);
break
;
case
BLOCK_ZOOM
:
/* Window Zoom */
...
...
@@ -181,11 +186,11 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
break
;
}
if
(
MustDoPlace
<=
0
)
if
(
!
nextcmd
)
{
if
(
GetScreen
()
->
m_BlockLocate
.
m_Command
!=
BLOCK_SELECT_ITEMS_ONLY
)
{
ClearMarkItems
(
Currentm
odule
);
ClearMarkItems
(
currentM
odule
);
}
GetScreen
()
->
m_BlockLocate
.
m_Flags
=
0
;
GetScreen
()
->
m_BlockLocate
.
m_State
=
STATE_NO_BLOCK
;
...
...
@@ -199,7 +204,7 @@ int WinEDA_ModuleEditFrame::HandleBlockEnd( wxDC* DC )
}
return
MustDoPlace
;
return
nextcmd
;
}
...
...
@@ -214,7 +219,7 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
*/
{
bool
err
=
FALSE
;
MODULE
*
Currentm
odule
=
GetBoard
()
->
m_Modules
;
MODULE
*
currentM
odule
=
GetBoard
()
->
m_Modules
;
if
(
DrawPanel
->
ManageCurseur
==
NULL
)
{
...
...
@@ -234,15 +239,15 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
case
BLOCK_MOVE
:
/* Move */
case
BLOCK_PRESELECT_MOVE
:
/* Move with preselection list*/
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
();
SaveCopyInUndoList
(
Currentm
odule
,
UR_MODEDIT
);
MoveMarkedItems
(
Currentm
odule
,
GetScreen
()
->
m_BlockLocate
.
m_MoveVector
);
SaveCopyInUndoList
(
currentM
odule
,
UR_MODEDIT
);
MoveMarkedItems
(
currentM
odule
,
GetScreen
()
->
m_BlockLocate
.
m_MoveVector
);
DrawPanel
->
Refresh
(
TRUE
);
break
;
case
BLOCK_COPY
:
/* Copy */
GetScreen
()
->
m_BlockLocate
.
ClearItemsList
();
SaveCopyInUndoList
(
Currentm
odule
,
UR_MODEDIT
);
CopyMarkedItems
(
Currentm
odule
,
GetScreen
()
->
m_BlockLocate
.
m_MoveVector
);
SaveCopyInUndoList
(
currentM
odule
,
UR_MODEDIT
);
CopyMarkedItems
(
currentM
odule
,
GetScreen
()
->
m_BlockLocate
.
m_MoveVector
);
break
;
case
BLOCK_PASTE
:
/* Paste */
...
...
@@ -252,13 +257,13 @@ void WinEDA_ModuleEditFrame::HandleBlockPlace( wxDC* DC )
case
BLOCK_MIRROR_X
:
case
BLOCK_MIRROR_Y
:
case
BLOCK_FLIP
:
/* Mirror by popup menu, from block move */
SaveCopyInUndoList
(
Currentm
odule
,
UR_MODEDIT
);
MirrorMarkedItems
(
Currentm
odule
,
GetScreen
()
->
m_BlockLocate
.
Centre
()
);
SaveCopyInUndoList
(
currentM
odule
,
UR_MODEDIT
);
MirrorMarkedItems
(
currentM
odule
,
GetScreen
()
->
m_BlockLocate
.
Centre
()
);
break
;
case
BLOCK_ROTATE
:
SaveCopyInUndoList
(
Currentm
odule
,
UR_MODEDIT
);
RotateMarkedItems
(
Currentm
odule
,
GetScreen
()
->
m_BlockLocate
.
Centre
()
);
SaveCopyInUndoList
(
currentM
odule
,
UR_MODEDIT
);
RotateMarkedItems
(
currentM
odule
,
GetScreen
()
->
m_BlockLocate
.
Centre
()
);
break
;
case
BLOCK_ZOOM
:
// Handled by HandleBlockEnd
...
...
@@ -295,7 +300,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
BASE_SCREEN
*
screen
=
panel
->
GetScreen
();
BOARD_ITEM
*
item
;
wxPoint
move_offset
;
MODULE
*
Currentm
odule
=
MODULE
*
currentM
odule
=
(
(
WinEDA_BasePcbFrame
*
)
wxGetApp
().
GetTopWindow
()
)
->
m_ModuleEditFrame
->
GetBoard
()
->
m_Modules
;
PtBlock
=
&
screen
->
m_BlockLocate
;
...
...
@@ -306,11 +311,11 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
PtBlock
->
Draw
(
panel
,
DC
,
PtBlock
->
m_MoveVector
,
g_XorMode
,
PtBlock
->
m_Color
);
if
(
Currentm
odule
)
if
(
currentM
odule
)
{
move_offset
.
x
=
-
PtBlock
->
m_MoveVector
.
x
;
move_offset
.
y
=
-
PtBlock
->
m_MoveVector
.
y
;
item
=
Currentm
odule
->
m_Drawings
;
item
=
currentM
odule
->
m_Drawings
;
for
(
;
item
!=
NULL
;
item
=
item
->
Next
()
)
{
if
(
item
->
m_Selected
==
0
)
...
...
@@ -328,7 +333,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
}
}
D_PAD
*
pad
=
Currentm
odule
->
m_Pads
;
D_PAD
*
pad
=
currentM
odule
->
m_Pads
;
for
(
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
{
if
(
pad
->
m_Selected
==
0
)
...
...
@@ -346,9 +351,9 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
PtBlock
->
m_Color
);
if
(
Currentm
odule
)
if
(
currentM
odule
)
{
item
=
Currentm
odule
->
m_Drawings
;
item
=
currentM
odule
->
m_Drawings
;
move_offset
=
-
PtBlock
->
m_MoveVector
;
for
(
;
item
!=
NULL
;
item
=
item
->
Next
()
)
{
...
...
@@ -367,7 +372,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
}
}
D_PAD
*
pad
=
Currentm
odule
->
m_Pads
;
D_PAD
*
pad
=
currentM
odule
->
m_Pads
;
for
(
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
{
if
(
pad
->
m_Selected
==
0
)
...
...
pcbnew/module_editor_frame.h
View file @
9b77f2a4
...
...
@@ -93,9 +93,9 @@ public:
bool
Clear_Pcb
(
bool
aQuery
);
/* handlers for block commands */
int
ReturnBlockCommand
(
int
key
);
virtual
int
ReturnBlockCommand
(
int
key
);
virtual
void
HandleBlockPlace
(
wxDC
*
DC
);
virtual
int
HandleBlockEnd
(
wxDC
*
DC
);
virtual
bool
HandleBlockEnd
(
wxDC
*
DC
);
BOARD_ITEM
*
ModeditLocateAndDisplay
(
int
aHotKeyCode
=
0
);
...
...
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