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
32c54e49
Commit
32c54e49
authored
Aug 11, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More about undo/redo in pcbnew
parent
a6fc1329
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
44 deletions
+52
-44
edtxtmod.cpp
pcbnew/edtxtmod.cpp
+18
-14
modedit_onclick.cpp
pcbnew/modedit_onclick.cpp
+27
-24
onrightclick.cpp
pcbnew/onrightclick.cpp
+7
-6
No files found.
pcbnew/edtxtmod.cpp
View file @
32c54e49
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
/* Routines Locales */
/* Routines Locales */
static
void
Show_MoveTexte_Module
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
Show_MoveTexte_Module
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
Exit
TextModule
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
void
AbortMove
TextModule
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
/* local variables */
/* local variables */
wxPoint
MoveVector
;
// Move vector for move edge, exported to dialog_edit mod_text.cpp
wxPoint
MoveVector
;
// Move vector for move edge, exported to dialog_edit mod_text.cpp
...
@@ -129,9 +129,8 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text )
...
@@ -129,9 +129,8 @@ void WinEDA_BasePcbFrame::DeleteTextModule( TEXTE_MODULE* Text )
/*************************************************************/
/*************************************************************/
static
void
Exit
TextModule
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
static
void
AbortMove
TextModule
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/*************************************************************/
/*************************************************************/
/*
/*
* Routine de sortie du menu edit texte module
* Routine de sortie du menu edit texte module
* Si un texte est selectionne, ses coord initiales sont regenerees
* Si un texte est selectionne, ses coord initiales sont regenerees
...
@@ -151,8 +150,12 @@ static void ExitTextModule( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -151,8 +150,12 @@ static void ExitTextModule( WinEDA_DrawPanel* Panel, wxDC* DC )
Text
->
Draw
(
Panel
,
DC
,
GR_XOR
,
MoveVector
);
Text
->
Draw
(
Panel
,
DC
,
GR_XOR
,
MoveVector
);
/* Redessin du Texte */
// If the text was moved (the move does not change internal data)
// Text->Draw( Panel, DC, GR_OR );
// it could be rotated while moving. So set old value for orientation
if
(
(
Text
->
m_Flags
&
IS_MOVED
)
)
Text
->
m_Orient
=
TextInitialOrientation
;
/* Redraw the text */
Panel
->
PostDirtyRect
(
Text
->
GetBoundingBox
()
);
Panel
->
PostDirtyRect
(
Text
->
GetBoundingBox
()
);
// leave it at (0,0) so we can use it Rotate when not moving.
// leave it at (0,0) so we can use it Rotate when not moving.
...
@@ -191,7 +194,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
...
@@ -191,7 +194,7 @@ void WinEDA_BasePcbFrame::StartMoveTexteModule( TEXTE_MODULE* Text, wxDC* DC )
SetCurItem
(
Text
);
SetCurItem
(
Text
);
DrawPanel
->
ManageCurseur
=
Show_MoveTexte_Module
;
DrawPanel
->
ManageCurseur
=
Show_MoveTexte_Module
;
DrawPanel
->
ForceCloseManageCurseur
=
Exit
TextModule
;
DrawPanel
->
ForceCloseManageCurseur
=
AbortMove
TextModule
;
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
TRUE
);
DrawPanel
->
ManageCurseur
(
DrawPanel
,
DC
,
TRUE
);
}
}
...
@@ -209,20 +212,19 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
...
@@ -209,20 +212,19 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
{
{
DrawPanel
->
PostDirtyRect
(
Text
->
GetBoundingBox
()
);
DrawPanel
->
PostDirtyRect
(
Text
->
GetBoundingBox
()
);
Text
->
m_Pos
=
GetScreen
()
->
m_Curseur
;
/* mise a jour des coordonnes relatives a l'ancre */
/* mise a jour des coordonnes relatives a l'ancre */
MODULE
*
Module
=
(
MODULE
*
)
Text
->
GetParent
();
MODULE
*
Module
=
(
MODULE
*
)
Text
->
GetParent
();
if
(
Module
)
if
(
Module
)
{
{
// Prepare undo command for Board Editor:
// Prepare undo command (a rotation can be made while moving)
if
(
m_Ident
==
PCB_FRAME
)
{
EXCHG
(
Text
->
m_Pos
,
TextInitialPosition
);
EXCHG
(
Text
->
m_Orient
,
TextInitialOrientation
);
EXCHG
(
Text
->
m_Orient
,
TextInitialOrientation
);
if
(
m_Ident
==
PCB_FRAME
)
SaveCopyInUndoList
(
Module
,
UR_CHANGED
);
SaveCopyInUndoList
(
Module
,
UR_CHANGED
);
EXCHG
(
Text
->
m_Pos
,
TextInitialPosition
);
else
SaveCopyInUndoList
(
Module
,
UR_MODEDIT
);
EXCHG
(
Text
->
m_Orient
,
TextInitialOrientation
);
EXCHG
(
Text
->
m_Orient
,
TextInitialOrientation
);
}
Text
->
m_Pos
=
GetScreen
()
->
m_Curseur
;
// Set the new position for text
wxPoint
textRelPos
=
Text
->
m_Pos
-
Module
->
m_Pos
;
wxPoint
textRelPos
=
Text
->
m_Pos
-
Module
->
m_Pos
;
RotatePoint
(
&
textRelPos
,
-
Module
->
m_Orient
);
RotatePoint
(
&
textRelPos
,
-
Module
->
m_Orient
);
Text
->
m_Pos0
=
textRelPos
;
Text
->
m_Pos0
=
textRelPos
;
...
@@ -234,6 +236,8 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
...
@@ -234,6 +236,8 @@ void WinEDA_BasePcbFrame::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
/* Redessin du Texte */
/* Redessin du Texte */
DrawPanel
->
PostDirtyRect
(
Text
->
GetBoundingBox
()
);
DrawPanel
->
PostDirtyRect
(
Text
->
GetBoundingBox
()
);
}
}
else
Text
->
m_Pos
=
GetScreen
()
->
m_Curseur
;
}
}
// leave it at (0,0) so we can use it Rotate when not moving.
// leave it at (0,0) so we can use it Rotate when not moving.
...
...
pcbnew/modedit_onclick.cpp
View file @
32c54e49
...
@@ -33,7 +33,6 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -33,7 +33,6 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
switch
(
DrawStruct
->
Type
()
)
switch
(
DrawStruct
->
Type
()
)
{
{
case
TYPE_TEXTE_MODULE
:
case
TYPE_TEXTE_MODULE
:
SaveCopyInUndoList
(
GetBoard
()
->
m_Modules
,
UR_MODEDIT
);
PlaceTexteModule
(
(
TEXTE_MODULE
*
)
DrawStruct
,
DC
);
PlaceTexteModule
(
(
TEXTE_MODULE
*
)
DrawStruct
,
DC
);
break
;
break
;
...
@@ -64,8 +63,8 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -64,8 +63,8 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct
=
GetCurItem
();
DrawStruct
=
GetCurItem
();
if
(
!
DrawStruct
||
(
DrawStruct
->
m_Flags
==
0
)
)
if
(
!
DrawStruct
||
(
DrawStruct
->
m_Flags
==
0
)
)
{
{
if
(
!
wxGetKeyState
(
WXK_SHIFT
)
&&
!
wxGetKeyState
(
WXK_ALT
)
&&
if
(
!
wxGetKeyState
(
WXK_SHIFT
)
&&
!
wxGetKeyState
(
WXK_ALT
)
!
wxGetKeyState
(
WXK_CONTROL
)
)
&&
!
wxGetKeyState
(
WXK_CONTROL
)
)
DrawStruct
=
ModeditLocateAndDisplay
();
DrawStruct
=
ModeditLocateAndDisplay
();
SetCurItem
(
DrawStruct
);
SetCurItem
(
DrawStruct
);
}
}
...
@@ -120,7 +119,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -120,7 +119,7 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct
=
ModeditLocateAndDisplay
();
DrawStruct
=
ModeditLocateAndDisplay
();
if
(
DrawStruct
==
NULL
||
(
DrawStruct
->
m_Flags
!=
0
)
)
if
(
DrawStruct
==
NULL
||
(
DrawStruct
->
m_Flags
!=
0
)
)
break
;
break
;
if
(
DrawStruct
->
Type
()
!=
TYPE_MODULE
)
//GetBoard()->m_Modules ) // Cannot delete the module itself
if
(
DrawStruct
->
Type
()
!=
TYPE_MODULE
)
//GetBoard()->m_Modules ) // Cannot delete the module itself
{
{
SaveCopyInUndoList
(
GetBoard
()
->
m_Modules
,
UR_MODEDIT
);
SaveCopyInUndoList
(
GetBoard
()
->
m_Modules
,
UR_MODEDIT
);
RemoveStruct
(
DrawStruct
);
RemoveStruct
(
DrawStruct
);
...
@@ -131,14 +130,15 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -131,14 +130,15 @@ void WinEDA_ModuleEditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case
ID_MODEDIT_PLACE_ANCHOR
:
case
ID_MODEDIT_PLACE_ANCHOR
:
{
{
MODULE
*
module
=
GetBoard
()
->
m_Modules
;
MODULE
*
module
=
GetBoard
()
->
m_Modules
;
module
->
m_Flags
=
0
;
module
->
m_Flags
=
0
;
SaveCopyInUndoList
(
module
,
UR_MODEDIT
);
SaveCopyInUndoList
(
module
,
UR_MODEDIT
);
Place_Ancre
(
module
);
// set the new relatives internal coordinates of items
Place_Ancre
(
module
);
// set the new relatives internal coordinates of items
GetScreen
()
->
m_Curseur
=
wxPoint
(
0
,
0
);
GetScreen
()
->
m_Curseur
=
wxPoint
(
0
,
0
);
Recadre_Trace
(
TRUE
);
Recadre_Trace
(
TRUE
);
// Replace the module in position 0, to recalculate absolutes coordinates of items
// Replace the module in position 0, to recalculate absolutes coordinates of items
module
->
SetPosition
(
wxPoint
(
0
,
0
)
);
module
->
SetPosition
(
wxPoint
(
0
,
0
)
);
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
SetToolID
(
0
,
wxCURSOR_ARROW
,
wxEmptyString
);
SetCurItem
(
NULL
);
SetCurItem
(
NULL
);
DrawPanel
->
Refresh
();
DrawPanel
->
Refresh
();
...
@@ -290,11 +290,14 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
...
@@ -290,11 +290,14 @@ bool WinEDA_ModuleEditFrame::OnRightClick( const wxPoint& MousePos,
}
}
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_ROTATE_TEXTMODULE
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_ROTATE_TEXTMODULE
,
_
(
"Rotate Text Mod."
),
rotate_field_xpm
);
_
(
"Rotate Text Mod."
),
rotate_field_xpm
);
if
(
!
flags
)
{
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EDIT_TEXTMODULE
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_EDIT_TEXTMODULE
,
_
(
"Edit Text Mod."
),
edit_text_xpm
);
_
(
"Edit Text Mod."
),
edit_text_xpm
);
if
(
(
(
TEXTE_MODULE
*
)
DrawStruct
)
->
m_Type
==
TEXT_is_DIVERS
)
if
(
(
(
TEXTE_MODULE
*
)
DrawStruct
)
->
m_Type
==
TEXT_is_DIVERS
)
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_DELETE_TEXTMODULE
,
ADD_MENUITEM
(
PopMenu
,
ID_POPUP_PCB_DELETE_TEXTMODULE
,
_
(
"Delete Text Mod."
),
delete_text_xpm
);
_
(
"Delete Text Mod."
),
delete_text_xpm
);
}
break
;
break
;
case
TYPE_EDGE_MODULE
:
case
TYPE_EDGE_MODULE
:
...
...
pcbnew/onrightclick.cpp
View file @
32c54e49
...
@@ -176,7 +176,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
...
@@ -176,7 +176,8 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_MOVE_DRAWING_REQUEST
,
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_MOVE_DRAWING_REQUEST
,
_
(
"Move Drawing"
),
move_xpm
);
_
(
"Move Drawing"
),
move_xpm
);
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_EDIT_DRAWING
,
_
(
"Edit Drawing"
),
edit_xpm
);
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_EDIT_DRAWING
,
_
(
"Edit Drawing"
),
edit_xpm
);
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_DELETE_DRAWING
,
_
(
"Delete Drawing"
),
delete_xpm
);
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_DELETE_DRAWING
,
_
(
"Delete Drawing"
),
delete_xpm
);
if
(
item
->
GetLayer
()
>
LAST_COPPER_LAYER
)
if
(
item
->
GetLayer
()
>
LAST_COPPER_LAYER
)
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_DELETE_DRAWING_LAYER
,
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_DELETE_DRAWING_LAYER
,
_
(
"Delete All Drawing on Layer"
),
delete_body_xpm
);
_
(
"Delete All Drawing on Layer"
),
delete_body_xpm
);
...
@@ -707,6 +708,7 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m
...
@@ -707,6 +708,7 @@ void WinEDA_PcbFrame::createPopUpMenuForFpTexts( TEXTE_MODULE* FpText, wxMenu* m
ADD_MENUITEM
(
sub_menu_Fp_text
,
ID_POPUP_PCB_ROTATE_TEXTMODULE
,
ADD_MENUITEM
(
sub_menu_Fp_text
,
ID_POPUP_PCB_ROTATE_TEXTMODULE
,
_
(
"Rotate"
),
rotate_field_xpm
);
_
(
"Rotate"
),
rotate_field_xpm
);
if
(
!
flags
)
ADD_MENUITEM
(
sub_menu_Fp_text
,
ID_POPUP_PCB_EDIT_TEXTMODULE
,
ADD_MENUITEM
(
sub_menu_Fp_text
,
ID_POPUP_PCB_EDIT_TEXTMODULE
,
_
(
"Edit"
),
edit_text_xpm
);
_
(
"Edit"
),
edit_text_xpm
);
...
@@ -891,4 +893,3 @@ static wxMenu* Append_Track_Width_List()
...
@@ -891,4 +893,3 @@ static wxMenu* Append_Track_Width_List()
return
trackwidth_menu
;
return
trackwidth_menu
;
}
}
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