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
3e2e11fb
Commit
3e2e11fb
authored
Jan 31, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Undo/redo buffer fixed once again..
parent
24ba75ba
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
15 deletions
+25
-15
tool_event.h
include/tool/tool_event.h
+1
-1
board_undo_redo.cpp
pcbnew/board_undo_redo.cpp
+10
-10
router_tool.cpp
pcbnew/router/router_tool.cpp
+11
-4
router_tool.h
pcbnew/router/router_tool.h
+3
-0
No files found.
include/tool/tool_event.h
View file @
3e2e11fb
...
...
@@ -89,7 +89,7 @@ enum TOOL_ACTIONS
// closed it without selecting anything.
TA_CONTEXT_MENU_CHOICE
=
0x10000
,
// This event is sent *
after* undo/redo command is finish
ed.
// This event is sent *
before* undo/redo command is perform
ed.
TA_UNDO_REDO
=
0x20000
,
// Tool action (allows to control tools)
...
...
pcbnew/board_undo_redo.cpp
View file @
3e2e11fb
...
...
@@ -523,8 +523,8 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
{
MODULE
*
oldModule
=
static_cast
<
MODULE
*>
(
item
);
oldModule
->
RunOnChildren
(
std
::
bind1st
(
std
::
mem_fun
(
&
KIGFX
::
VIEW
::
Remove
),
view
)
);
oldModule
->
RunOnChildren
(
std
::
bind1st
(
std
::
mem_fun
(
&
RN_DATA
::
Remove
),
ratsnest
)
);
}
ratsnest
->
Remove
(
item
);
item
->
SwapData
(
image
);
...
...
@@ -534,8 +534,8 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
{
MODULE
*
newModule
=
static_cast
<
MODULE
*>
(
item
);
newModule
->
RunOnChildren
(
std
::
bind1st
(
std
::
mem_fun
(
&
KIGFX
::
VIEW
::
Add
),
view
)
);
newModule
->
RunOnChildren
(
std
::
bind1st
(
std
::
mem_fun
(
&
RN_DATA
::
Add
),
ratsnest
)
);
}
ratsnest
->
Add
(
item
);
item
->
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
LAYERS
);
}
...
...
@@ -626,6 +626,10 @@ void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& aEvent )
if
(
GetScreen
()
->
GetUndoCommandCount
()
<=
0
)
return
;
// Inform tools that undo command was issued
TOOL_EVENT
event
(
TC_MESSAGE
,
TA_UNDO_REDO
,
AS_GLOBAL
);
m_toolManager
->
ProcessEvent
(
event
);
/* Get the old list */
PICKED_ITEMS_LIST
*
List
=
GetScreen
()
->
PopCommandFromUndoList
();
/* Undo the command */
...
...
@@ -635,10 +639,6 @@ void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& aEvent )
List
->
ReversePickersListOrder
();
GetScreen
()
->
PushCommandToRedoList
(
List
);
// Inform tools that undo has just occurred
TOOL_EVENT
event
(
TC_MESSAGE
,
TA_UNDO_REDO
,
AS_GLOBAL
);
m_toolManager
->
ProcessEvent
(
event
);
OnModify
();
m_canvas
->
Refresh
();
}
...
...
@@ -649,6 +649,10 @@ void PCB_EDIT_FRAME::GetBoardFromRedoList( wxCommandEvent& aEvent )
if
(
GetScreen
()
->
GetRedoCommandCount
()
==
0
)
return
;
// Inform tools that redo command was issued
TOOL_EVENT
event
(
TC_MESSAGE
,
TA_UNDO_REDO
,
AS_GLOBAL
);
m_toolManager
->
ProcessEvent
(
event
);
/* Get the old list */
PICKED_ITEMS_LIST
*
List
=
GetScreen
()
->
PopCommandFromRedoList
();
...
...
@@ -659,10 +663,6 @@ void PCB_EDIT_FRAME::GetBoardFromRedoList( wxCommandEvent& aEvent )
List
->
ReversePickersListOrder
();
GetScreen
()
->
PushCommandToUndoList
(
List
);
// Inform tools that redo has just occurred
TOOL_EVENT
event
(
TC_MESSAGE
,
TA_UNDO_REDO
,
AS_GLOBAL
);
m_toolManager
->
ProcessEvent
(
event
);
OnModify
();
m_canvas
->
Refresh
();
}
...
...
pcbnew/router/router_tool.cpp
View file @
3e2e11fb
...
...
@@ -31,7 +31,6 @@
#include <pcb_painter.h>
#include <tool/context_menu.h>
#include <tool/tool_action.h>
#include "router_tool.h"
#include "pns_segment.h"
...
...
@@ -82,6 +81,7 @@ void ROUTER_TOOL::Reset( RESET_REASON aReason )
m_router
->
ClearWorld
();
m_router
->
SetBoard
(
getModel
<
BOARD
>
(
PCB_T
)
);
m_router
->
SyncWorld
();
m_needsSync
=
false
;
if
(
getView
()
)
m_router
->
SetView
(
getView
()
);
...
...
@@ -380,13 +380,14 @@ void ROUTER_TOOL::startRouting()
if
(
saveUndoBuffer
)
{
// Save the recent changes in the undo buffer
getEditFrame
<
PCB_EDIT_FRAME
>
()
->
SaveCopyInUndoList
(
m_router
->
GetLastChanges
(),
UR_UNSPECIFIED
);
getEditFrame
<
PCB_EDIT_FRAME
>
()
->
SaveCopyInUndoList
(
m_router
->
GetLastChanges
(),
UR_UNSPECIFIED
);
getEditFrame
<
PCB_EDIT_FRAME
>
()
->
OnModify
();
}
else
{
// It was interrupted by TA_UNDO_REDO event, so we have to sync the world now
m_
router
->
SyncWorld
()
;
m_
needsSync
=
true
;
}
ctls
->
SetAutoPan
(
false
);
...
...
@@ -408,10 +409,16 @@ int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
// Main loop: keep receiving events
while
(
OPT_TOOL_EVENT
evt
=
Wait
()
)
{
if
(
m_needsSync
)
{
m_router
->
SyncWorld
();
m_needsSync
=
false
;
}
if
(
evt
->
IsCancel
()
)
break
;
// Finish
else
if
(
evt
->
Action
()
==
TA_UNDO_REDO
)
m_
router
->
SyncWorld
()
;
m_
needsSync
=
true
;
else
if
(
evt
->
IsMotion
()
)
updateStartItem
(
*
evt
);
else
if
(
evt
->
IsClick
(
BUT_LEFT
)
)
...
...
pcbnew/router/router_tool.h
View file @
3e2e11fb
...
...
@@ -72,6 +72,9 @@ private:
PNS_ITEM
*
m_endItem
;
VECTOR2I
m_endSnapPoint
;
///> Flag marking that the router's world needs syncing.
bool
m_needsSync
;
/*boost::shared_ptr<CONTEXT_MENU> m_menu;*/
CONTEXT_MENU
*
m_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