Loading common/tool/tool_manager.cpp +36 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ #include <boost/range/adaptor/map.hpp> #include <wx/event.h> #include <wx/clipbrd.h> #include <view/view.h> Loading Loading @@ -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; Loading include/tool/tool_manager.h +13 −0 Original line number Diff line number Diff line Loading @@ -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. Loading Loading
common/tool/tool_manager.cpp +36 −0 Original line number Diff line number Diff line Loading @@ -34,6 +34,7 @@ #include <boost/range/adaptor/map.hpp> #include <wx/event.h> #include <wx/clipbrd.h> #include <view/view.h> Loading Loading @@ -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; Loading
include/tool/tool_manager.h +13 −0 Original line number Diff line number Diff line Loading @@ -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. Loading