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
f28062ac
Commit
f28062ac
authored
May 02, 2009
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Matt Wright 20090502_gerbview_mirror_block.patch
parent
7258d23b
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
2 deletions
+105
-2
block.cpp
gerbview/block.cpp
+66
-1
edit.cpp
gerbview/edit.cpp
+7
-0
onrightclick.cpp
gerbview/onrightclick.cpp
+1
-0
wxPcbStruct.h
include/wxPcbStruct.h
+31
-1
No files found.
gerbview/block.cpp
View file @
f28062ac
...
...
@@ -174,6 +174,12 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
Block_Delete
(
DC
);
break
;
case
BLOCK_MIRROR_X
:
/* Mirror*/
GetScreen
()
->
BlockLocate
.
m_State
=
STATE_BLOCK_STOP
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
FALSE
);
Block_Mirror_X
(
DC
);
break
;
case
BLOCK_ROTATE
:
/* Unused */
break
;
...
...
@@ -192,7 +198,6 @@ int WinEDA_GerberFrame::HandleBlockEnd( wxDC* DC )
case
BLOCK_ABORT
:
case
BLOCK_SELECT_ITEMS_ONLY
:
case
BLOCK_MIRROR_X
:
case
BLOCK_MIRROR_Y
:
break
;
}
...
...
@@ -366,6 +371,66 @@ void WinEDA_BasePcbFrame::Block_Move( wxDC* DC )
}
/************************************************/
void
WinEDA_BasePcbFrame
::
Block_Mirror_X
(
wxDC
*
DC
)
/************************************************/
/*
* Function to mirror items in the current selected block
*/
{
int
xoffset
=
0
;
wxPoint
oldpos
;
oldpos
=
GetScreen
()
->
m_Curseur
;
DrawPanel
->
ManageCurseur
=
NULL
;
GetScreen
()
->
m_Curseur
=
oldpos
;
DrawPanel
->
MouseToCursorSchema
();
GetScreen
()
->
SetModify
();
GetScreen
()
->
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
;
/* Move the Track segments in block */
for
(
TRACK
*
track
=
m_Pcb
->
m_Track
;
track
;
track
=
track
->
Next
()
)
{
if
(
IsSegmentInBox
(
GetScreen
()
->
BlockLocate
,
track
)
)
{
m_Pcb
->
m_Status_Pcb
=
0
;
track
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
// erase the display
track
->
m_Start
.
x
=
xoffset
-
track
->
m_Start
.
x
;
track
->
m_End
.
x
=
xoffset
-
track
->
m_End
.
x
;
// the two parameters are used in gerbview to store centre coordinates for arcs.
// move this centre
track
->
m_Param
=
xoffset
-
track
->
m_Param
;
track
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
// redraw the moved track
}
}
/* Move the Zone segments in block */
for
(
SEGZONE
*
zsegment
=
m_Pcb
->
m_Zone
;
zsegment
;
zsegment
=
zsegment
->
Next
()
)
{
if
(
IsSegmentInBox
(
GetScreen
()
->
BlockLocate
,
zsegment
)
)
{
zsegment
->
Draw
(
DrawPanel
,
DC
,
GR_XOR
);
// erase the display
zsegment
->
m_Start
.
x
=
xoffset
-
zsegment
->
m_Start
.
x
;
zsegment
->
m_End
.
x
=
xoffset
-
zsegment
->
m_End
.
x
;
// the two parameters are used in gerbview to store centre coordinates for arcs.
// move this centre
zsegment
->
m_Param
=
xoffset
-
zsegment
->
m_Param
;
zsegment
->
Draw
(
DrawPanel
,
DC
,
GR_OR
);
// redraw the moved zone zegment
}
}
DrawPanel
->
Refresh
(
TRUE
);
}
/**************************************************/
void
WinEDA_BasePcbFrame
::
Block_Duplicate
(
wxDC
*
DC
)
/**************************************************/
...
...
gerbview/edit.cpp
View file @
f28062ac
...
...
@@ -100,6 +100,7 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
{
case
wxID_CUT
:
case
wxID_COPY
:
case
ID_POPUP_MIRROR_X_BLOCK
:
case
ID_POPUP_DELETE_BLOCK
:
case
ID_POPUP_PLACE_BLOCK
:
case
ID_POPUP_ZOOM_BLOCK
:
...
...
@@ -287,6 +288,12 @@ void WinEDA_GerberFrame::Process_Special_Functions( wxCommandEvent& event )
HandleBlockEnd
(
&
dc
);
break
;
case
ID_POPUP_MIRROR_X_BLOCK
:
GetScreen
()
->
BlockLocate
.
m_Command
=
BLOCK_MIRROR_X
;
GetScreen
()
->
BlockLocate
.
SetMessageBlock
(
this
);
HandleBlockEnd
(
&
dc
);
break
;
case
ID_GERBVIEW_POPUP_DELETE_DCODE_ITEMS
:
if
(
gerber_layer
)
Delete_DCode_Items
(
&
dc
,
gerber_layer
->
m_Selected_Tool
,
((
PCB_SCREEN
*
)
GetScreen
())
->
m_Active_Layer
);
...
...
gerbview/onrightclick.cpp
View file @
f28062ac
...
...
@@ -53,6 +53,7 @@ bool WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
PopMenu
->
Append
(
ID_POPUP_PLACE_BLOCK
,
_
(
"Place Block"
)
);
PopMenu
->
Append
(
ID_POPUP_COPY_BLOCK
,
_
(
"Copy Block (shift mouse)"
)
);
PopMenu
->
Append
(
ID_POPUP_DELETE_BLOCK
,
_
(
"Delete Block (ctrl + drag mouse)"
)
);
PopMenu
->
Append
(
ID_POPUP_MIRROR_X_BLOCK
,
_
(
"Mirror Block"
)
);
}
else
PopMenu
->
Append
(
ID_POPUP_CANCEL_CURRENT_COMMAND
,
_
(
"Cancel"
)
);
...
...
include/wxPcbStruct.h
View file @
f28062ac
...
...
@@ -316,10 +316,40 @@ public:
int
garde
,
int
tracevia
,
int
modetrace
);
/* Block operations: */
/**
* Function Block_Delete
* deletes all tracks and segments within the selected block.
* Defined separately in pcbnew and gerbview
*
* @param DC A device context to draw on.
*/
void
Block_Delete
(
wxDC
*
DC
);
void
Block_Rotate
(
wxDC
*
DC
);
void
Block_Invert
(
wxDC
*
DC
);
/**
* Function Block_Move
* moves all tracks and segments within the selected block.
* New location is determined by the current offset from the selected block's original location.
* Defined separately in pcbnew and gerbview
*
* @param DC A device context to draw on.
*/
void
Block_Move
(
wxDC
*
DC
);
/**
* Function Block_Mirror_X
* mirrors all tracks and segments within the currently selected block in the X axis.
*
* @param DC A device context to draw on.
*/
void
Block_Mirror_X
(
wxDC
*
DC
);
/**
* Function Block_Duplicate
* copies-and-moves all tracks and segments within the selected block.
* New location is determined by the current offset from the selected block's original location.
* Defined separately in pcbnew and gerbview
*
* @param DC A device context to draw on.
*/
void
Block_Duplicate
(
wxDC
*
DC
);
...
...
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