Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: MrDoomMaster on May 01, 2008, 10:36:12 pm

Title: A couple of features I'm missing...
Post by: MrDoomMaster on May 01, 2008, 10:36:12 pm
Hi,

First of all note that I'm using Windows Vista x86 and Code::Blocks version 8.02. There's two features I'm particularly looking for that I don't seem to be finding:

1) Multiple selections. In the management window, I'm able to drag/drop only a single file at a time to other virtual folders, which is annoying. Is it possible to have multiple selections so that I can manage more than one file at a time? This would also be useful in regards to setting build properties of multiple projects/files at the same time.
2) Greater Drag/Drop support. Right now I'm unable to drag files from Windows Explorer and drop them into a virtual folder in my Management Window. I find this to be the most ideal way for me to add files to my project, however I can't seem to do this. I do not like adding files to my project and having a bunch of weird folders being created and putting my files under that. I like to have explicit control over how the virtual folder hierarchy in my project is generated, I do not like Code::Blocks creating folders for me when I add files.

Help is greatly appreciated.
Title: Re: A couple of features I'm missing...
Post by: MortenMacFly on May 04, 2008, 08:10:20 pm
First you could try:
- Right-click on a project in the management panel.
- Project tree -> Switch on/off (just as you need it): "Categories by file types" , "Show folders as on disk"

Probably this already resolves what you are looking for.
For the rest... let#s see... ;-)
Title: Re: A couple of features I'm missing...
Post by: MrDoomMaster on May 04, 2008, 09:07:56 pm
Thanks for your response.

I imagine this is only to solve the issue of files automatically being added to sub-folders? This is definitely a start. However, the main 2 issues (Multiple selections & better drag/drop support) still exist. I'm hoping they would be relatively easy to implement. I look forward to potentially seeing these features in a near soon release.
Title: Re: A couple of features I'm missing...
Post by: MrDoomMaster on September 21, 2008, 05:25:55 pm
Following up on this. Have these two feature requests been discussed at all since I originally posted? Have they been considered? Just looking for a status update.

Thanks!
Title: Re: A couple of features I'm missing...
Post by: rhf on September 21, 2008, 06:00:27 pm
I am unsure if this is exactly what you want regarding "Greater Drag/Drop support."  However, if you are compiling CodeBlocks, you might find patch ID 002162 by olipfei to be very useful. You can drag/drop a file, say a header, into the Management pane; this opens the file in the Editor. The patch provides a context menu command to add the file to the project.  I have been using this patch on Windows XP for quite a while and find it invaluable. Hopefully this feature will be officially incorporated into CodeBlocks.
Title: Re: A couple of features I'm missing...
Post by: MrDoomMaster on September 21, 2008, 07:42:00 pm
I am unsure if this is exactly what you want regarding "Greater Drag/Drop support."  However, if you are compiling CodeBlocks, you might find patch ID 002162 by olipfei to be very useful. You can drag/drop a file, say a header, into the Management pane; this opens the file in the Editor. The patch provides a context menu command to add the file to the project.  I have been using this patch on Windows XP for quite a while and find it invaluable. Hopefully this feature will be officially incorporated into CodeBlocks.

I wanted the Visual Studio behavior. You drag/drop a file into the project folders and it is automatically added to that project (NOT opened). Also, multiple selections are available in Visual Studio which are also a very valuable feature, because I can organize my project hierarchy a lot quicker when I can move multiple files around at once.
Title: Re: A couple of features I'm missing...
Post by: rhf on September 21, 2008, 08:06:49 pm
I agree and wish CodeBlocks had those features. At least olipfei's patch is a step in that direction, and it is very handy when you "Open #include file:" in the editor and then decide to add the file to the project.
Title: Re: A couple of features I'm missing...
Post by: dmoore on September 21, 2008, 09:13:30 pm
You drag/drop a file into the project folders and it is automatically added to that project (NOT opened).

that looks easy to implement: http://docs.wxwidgets.org/stable/wx_wxdndoverview.html#wxdndoverview

esp. see wxFileDropTarget. This is in the spirit of stuff I've been working on, so I'll be happy to add a patch in coming weeks if noone else does.

Quote
Also, multiple selections are available in Visual Studio which are also a very valuable feature, because I can organize my project hierarchy a lot quicker when I can move multiple files around at once.

not sure how feasible this is. I don't think anyone planned on people reorganizing the folder structure from the project view.
Title: Re: A couple of features I'm missing...
Post by: MrDoomMaster on September 22, 2008, 12:54:04 am
not sure how feasible this is. I don't think anyone planned on people reorganizing the folder structure from the project view.

How did they intend on this happening, then?
Title: Re: A couple of features I'm missing...
Post by: pmeehan on December 28, 2008, 05:31:17 am
Just wanted to bump this thread - the lack of these features, in particular the ability to do a multiple select/drag in the project tree - were some of the very first things I noticed.  Finding time to implement these features would *really* help polish the experience of maintaining a large project with C::B - having to bring files in at the root level and then move them one by one to virtual folders is onerous to say the least.  In addition, C::B does not remember the previous folder files were added from, so I have to crawl through the entire directory hierachy every time I add anything.

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.

In any event, I'm impressed and delighted by C::B.  I am really hoping this will be the answer for a more comfortable IDE to use on the Mac (I'm not a big Xcode fan) and perhaps serve as an eventual replacement for Visual Studio on the PC as well.  I know the C::B team probably has bigger fish to fry, but finding time to do a little polish will really make a world of difference, at least for me.
Title: Re: A couple of features I'm missing...
Post by: Jenna on December 28, 2008, 10:33:52 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.

You can change that behaviour in "Settings -> Editor.. -> General settings" in the left bottom of the dialog.
Title: Re: A couple of features I'm missing...
Post by: pmeehan on December 28, 2008, 11:38:33 pm
Awesome!  Thanks, Jens.  :D  I had been looking under Environment -> Notebooks Appearance.
Title: Re: A couple of features I'm missing...
Post by: dmoore on December 29, 2008, 08:46:00 pm
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));

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

[attachment deleted by admin]