User forums > Using Code::Blocks

A couple of features I'm missing...

<< < (3/3)

Jenna:

--- Quote from: pmeehan on December 28, 2008, 05:31:17 am ---My only other comment (right off the bat) is the decision to display the whole path of each file on the tab in the editor.  When I'm looking at the editor tabs, I care a lot less about the path than about just the file name.  Showing the whole path means fewer tabs may be visible at once.

--- End quote ---

You can change that behaviour in "Settings -> Editor.. -> General settings" in the left bottom of the dialog.

pmeehan:
Awesome!  Thanks, Jens.  :D  I had been looking under Environment -> Notebooks Appearance.

dmoore:
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...


--- Code: ---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));

--- End code ---

it's probably even possible to implement this as a plugin instead of changing CB internals

[attachment deleted by admin]

Navigation

[0] Message Index

[*] Previous page

Go to full version