had a little spare time today, so I started playing with Drag n Drop support. With this patch (attached), you can drag files from explorer/nautilus/<your file browser of choice> to any "project" in the project tree and you will be prompted to add the files to the project. Probably a bunch of corner cases that still need to be dealt with (what if you drag a project/workspace file to the project? what if someone wants to drop files into a virtual folder?) but this is a start...
Index: src/sdk/projectmanager.cpp
===================================================================
--- src/sdk/projectmanager.cpp (revision 5367)
+++ src/sdk/projectmanager.cpp (working copy)
@@ -49,6 +49,31 @@
#include "confirmreplacedlg.h"
#include "projectfileoptionsdlg.h"
+
+class wxProjFileDropTarget:public wxFileDropTarget
+{
+ bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& files)
+ {
+ wxTreeCtrl *projtree=Manager::Get()->GetProjectManager()->GetTree();
+ int flags;
+ wxTreeItemId id=projtree->HitTest(wxPoint(x,y),flags);
+ if(!id.IsOk())
+ return false;
+ FileTreeData* ftd = (FileTreeData*)projtree->GetItemData(id);
+ if(!ftd)
+ return false;
+ if (ftd->GetKind() != FileTreeData::ftdkProject)
+ return false;
+ if(!(flags&(wxTREE_HITTEST_ONITEMICON|wxTREE_HITTEST_ONITEMLABEL)))
+ return false;
+ wxArrayInt prompt;
+ Manager::Get()->GetProjectManager()->AddMultipleFilesToProject(files, ftd->GetProject(), prompt);
+ Manager::Get()->GetProjectManager()->RebuildTree();
+ return true;
+ }
+};
+
+
template<> ProjectManager* Mgr<ProjectManager>::instance = 0;
template<> bool Mgr<ProjectManager>::isShutdown = false;
@@ -239,6 +266,7 @@
m_TreeUseFolders = cfg->ReadBool(_T("/use_folders"), true);
RebuildTree();
+ m_pTree->SetDropTarget(new wxProjFileDropTarget);
// register event sinks
Manager::Get()->RegisterEventSink(cbEVT_APP_STARTUP_DONE, new cbEventFunctor<ProjectManager, CodeBlocksEvent>(this, &ProjectManager::OnAppDoneStartup));
it's probably even possible to implement this as a plugin instead of changing CB internals
[attachment deleted by admin]