From: Daniel Gonzalez Date: Fri, 28 Jun 2013 12:48:34 +0000 (+0200) Subject: Feature #2058 File drag and drop X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=b7e481b5969501d55054998e3115cddd2d6ed918;p=bbtkGEditor.git Feature #2058 File drag and drop The file drag and drop works with single and multiple file dnd's on Fedora 17. --- diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx index a10d7bc..030e52a 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxGEditorTabPanel.cxx @@ -130,8 +130,12 @@ namespace bbtk * For a drag and drop tutorial read: * http://zetcode.com/gui/wxwidgets/dragdrop/ */ + + //wxMessageBox(data); + std::string stdData = crea::wx2std(data); - //std::cout << "Text drop: " << stdData << std::endl; + + //std::cout << "Text drop: '" << stdData << "'" << std::endl; if(stdData.substr(0,4) == "box:") { @@ -140,7 +144,7 @@ namespace bbtk posT = stdData.find_first_not_of(':', posT); std::string boxType = stdData.substr(posT); - std::cout << "box: Package='" << packageName << "' BoxType='" << boxType << "'" <_panelsManager->GetParentGUIEditorGraphicBBS()->OpenBBS(filepath, filename); + } + else if(filetype == "bbg") + { + std::cout << "Opening bbg file." << std::endl; + this->_panelsManager->GetParentGUIEditorGraphicBBS()->OpenDiagram(filepath, filename); + } + else + { + std::cout << "Unknown file type: Can't open this kind of file: " << filetype << std::endl; + } + } + else + { + std::cout << "File Doesn't Exists. The given path is invalid: " << filePath << std::endl; + } + std::getline(ss, stdData, (char)13); + } } return true; diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx index 4cf8c38..12f9bb6 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.cxx @@ -82,6 +82,12 @@ namespace bbtk { } + //========================================================================= + wxGUIEditorGraphicBBS* wxTabPanelsManager::GetParentGUIEditorGraphicBBS() const + { + return this->_parent; + } + //========================================================================= void wxTabPanelsManager::addNewTab(wxString tabName) { diff --git a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h index 51be892..976201a 100644 --- a/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h +++ b/lib/EditorGraphicBBS/bbsWxGUIEditorGraphic/wxTabPanelsManager.h @@ -98,6 +98,8 @@ namespace bbtk wxTabPanelsManager(wxGUIEditorGraphicBBS *parent); ~wxTabPanelsManager(); + wxGUIEditorGraphicBBS* GetParentGUIEditorGraphicBBS() const; + void addNewTab(wxString tabName=_T("new_tab")); wxAuiNotebook* getAuiNotebook(); wxGEditorTabPanel* getActualTabPanel();