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
456eeaba
Commit
456eeaba
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Routines for handling clipboard with TOOL_MANAGER.
parent
d73ab976
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
49 additions
and
0 deletions
+49
-0
tool_manager.cpp
common/tool/tool_manager.cpp
+36
-0
tool_manager.h
include/tool/tool_manager.h
+13
-0
No files found.
common/tool/tool_manager.cpp
View file @
456eeaba
...
...
@@ -34,6 +34,7 @@
#include <boost/range/adaptor/map.hpp>
#include <wx/event.h>
#include <wx/clipbrd.h>
#include <view/view.h>
...
...
@@ -598,6 +599,41 @@ void TOOL_MANAGER::ScheduleContextMenu( TOOL_BASE* aTool, CONTEXT_MENU* aMenu,
}
bool
TOOL_MANAGER
::
SaveClipboard
(
const
std
::
string
&
aText
)
{
if
(
wxTheClipboard
->
Open
()
)
{
wxTheClipboard
->
SetData
(
new
wxTextDataObject
(
aText
)
);
wxTheClipboard
->
Close
();
return
true
;
}
return
false
;
}
std
::
string
TOOL_MANAGER
::
GetClipboard
()
const
{
std
::
string
result
;
if
(
wxTheClipboard
->
Open
()
)
{
if
(
wxTheClipboard
->
IsSupported
(
wxDF_TEXT
)
)
{
wxTextDataObject
data
;
wxTheClipboard
->
GetData
(
data
);
result
=
data
.
GetText
().
mb_str
();
}
wxTheClipboard
->
Close
();
}
return
result
;
}
TOOL_ID
TOOL_MANAGER
::
MakeToolId
(
const
std
::
string
&
aToolName
)
{
static
int
currentId
;
...
...
include/tool/tool_manager.h
View file @
456eeaba
...
...
@@ -257,6 +257,19 @@ public:
m_passEvent
=
true
;
}
/**
* Stores an information to the system clipboard.
* @param aText is the information to be stored.
* @return False if error occured.
*/
bool
SaveClipboard
(
const
std
::
string
&
aText
);
/**
* Returns the information currently stored in the system clipboard. If data stored in the
* clipboard is in non-text format, empty string is returned.
*/
std
::
string
GetClipboard
()
const
;
/**
* Returns list of TOOL_ACTIONs. TOOL_ACTIONs add themselves to the list upon their
* creation.
...
...
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