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
a73e3865
Commit
a73e3865
authored
Jan 30, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a new tool event: TA_UNDO_REDO, sent after undo/redo operation is issued.
parent
57bfaca1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
15 deletions
+23
-15
tool_event.cpp
common/tool/tool_event.cpp
+1
-0
tool_event.h
include/tool/tool_event.h
+4
-1
wxPcbStruct.h
include/wxPcbStruct.h
+2
-2
board_undo_redo.cpp
pcbnew/board_undo_redo.cpp
+10
-12
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+6
-0
No files found.
common/tool/tool_event.cpp
View file @
a73e3865
...
@@ -91,6 +91,7 @@ const std::string TOOL_EVENT::Format() const
...
@@ -91,6 +91,7 @@ const std::string TOOL_EVENT::Format() const
{
TA_CANCEL_TOOL
,
"cancel-tool"
},
{
TA_CANCEL_TOOL
,
"cancel-tool"
},
{
TA_CONTEXT_MENU_UPDATE
,
"context-menu-update"
},
{
TA_CONTEXT_MENU_UPDATE
,
"context-menu-update"
},
{
TA_CONTEXT_MENU_CHOICE
,
"context-menu-choice"
},
{
TA_CONTEXT_MENU_CHOICE
,
"context-menu-choice"
},
{
TA_UNDO_REDO
,
"undo-redo"
},
{
TA_ACTION
,
"action"
},
{
TA_ACTION
,
"action"
},
{
0
,
""
}
{
0
,
""
}
};
};
...
...
include/tool/tool_event.h
View file @
a73e3865
...
@@ -89,8 +89,11 @@ enum TOOL_ACTIONS
...
@@ -89,8 +89,11 @@ enum TOOL_ACTIONS
// closed it without selecting anything.
// closed it without selecting anything.
TA_CONTEXT_MENU_CHOICE
=
0x10000
,
TA_CONTEXT_MENU_CHOICE
=
0x10000
,
// This event is sent *after* undo/redo command is finished.
TA_UNDO_REDO
=
0x20000
,
// Tool action (allows to control tools)
// Tool action (allows to control tools)
TA_ACTION
=
0x
2
0000
,
TA_ACTION
=
0x
4
0000
,
TA_ANY
=
0xffffffff
TA_ANY
=
0xffffffff
};
};
...
...
include/wxPcbStruct.h
View file @
a73e3865
...
@@ -704,7 +704,7 @@ public:
...
@@ -704,7 +704,7 @@ public:
* - Get an old version of the board from Redo list
* - Get an old version of the board from Redo list
* @return none
* @return none
*/
*/
void
GetBoardFromRedoList
(
wxCommandEvent
&
e
vent
);
void
GetBoardFromRedoList
(
wxCommandEvent
&
aE
vent
);
/**
/**
* Function GetBoardFromUndoList
* Function GetBoardFromUndoList
...
@@ -713,7 +713,7 @@ public:
...
@@ -713,7 +713,7 @@ public:
* - Get an old version of the board from Undo list
* - Get an old version of the board from Undo list
* @return none
* @return none
*/
*/
void
GetBoardFromUndoList
(
wxCommandEvent
&
e
vent
);
void
GetBoardFromUndoList
(
wxCommandEvent
&
aE
vent
);
/* Block operations: */
/* Block operations: */
...
...
pcbnew/board_undo_redo.cpp
View file @
a73e3865
...
@@ -621,16 +621,11 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
...
@@ -621,16 +621,11 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
}
}
void
PCB_EDIT_FRAME
::
GetBoardFromUndoList
(
wxCommandEvent
&
e
vent
)
void
PCB_EDIT_FRAME
::
GetBoardFromUndoList
(
wxCommandEvent
&
aE
vent
)
{
{
if
(
GetScreen
()
->
GetUndoCommandCount
()
<=
0
)
if
(
GetScreen
()
->
GetUndoCommandCount
()
<=
0
)
return
;
return
;
// Clear the selection, as it may be altered with undone items
SELECTION_TOOL
*
selectionTool
=
static_cast
<
SELECTION_TOOL
*>
(
m_toolManager
->
FindTool
(
"pcbnew.InteractiveSelection"
)
);
selectionTool
->
ClearSelection
();
/* Get the old list */
/* Get the old list */
PICKED_ITEMS_LIST
*
List
=
GetScreen
()
->
PopCommandFromUndoList
();
PICKED_ITEMS_LIST
*
List
=
GetScreen
()
->
PopCommandFromUndoList
();
/* Undo the command */
/* Undo the command */
...
@@ -640,21 +635,20 @@ void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& event )
...
@@ -640,21 +635,20 @@ void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& event )
List
->
ReversePickersListOrder
();
List
->
ReversePickersListOrder
();
GetScreen
()
->
PushCommandToRedoList
(
List
);
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
();
OnModify
();
m_canvas
->
Refresh
();
m_canvas
->
Refresh
();
}
}
void
PCB_EDIT_FRAME
::
GetBoardFromRedoList
(
wxCommandEvent
&
e
vent
)
void
PCB_EDIT_FRAME
::
GetBoardFromRedoList
(
wxCommandEvent
&
aE
vent
)
{
{
if
(
GetScreen
()
->
GetRedoCommandCount
()
==
0
)
if
(
GetScreen
()
->
GetRedoCommandCount
()
==
0
)
return
;
return
;
// Clear the selection, as it may be altered with redone items
SELECTION_TOOL
*
selectionTool
=
static_cast
<
SELECTION_TOOL
*>
(
m_toolManager
->
FindTool
(
"pcbnew.InteractiveSelection"
)
);
selectionTool
->
ClearSelection
();
/* Get the old list */
/* Get the old list */
PICKED_ITEMS_LIST
*
List
=
GetScreen
()
->
PopCommandFromRedoList
();
PICKED_ITEMS_LIST
*
List
=
GetScreen
()
->
PopCommandFromRedoList
();
...
@@ -665,6 +659,10 @@ void PCB_EDIT_FRAME::GetBoardFromRedoList( wxCommandEvent& event )
...
@@ -665,6 +659,10 @@ void PCB_EDIT_FRAME::GetBoardFromRedoList( wxCommandEvent& event )
List
->
ReversePickersListOrder
();
List
->
ReversePickersListOrder
();
GetScreen
()
->
PushCommandToUndoList
(
List
);
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
();
OnModify
();
m_canvas
->
Refresh
();
m_canvas
->
Refresh
();
}
}
...
...
pcbnew/tools/selection_tool.cpp
View file @
a73e3865
...
@@ -100,6 +100,12 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
...
@@ -100,6 +100,12 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
// This tool never exits
// This tool never exits
}
}
else
if
(
evt
->
Action
()
==
TA_UNDO_REDO
)
{
// Clear the selection, as it may be altered with undone items
ClearSelection
();
}
// single click? Select single object
// single click? Select single object
else
if
(
evt
->
IsClick
(
BUT_LEFT
)
)
else
if
(
evt
->
IsClick
(
BUT_LEFT
)
)
{
{
...
...
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