Author Topic: File explorer window  (Read 13315 times)

Klokan

  • Guest
File explorer window
« on: June 15, 2007, 11:06:10 am »
Hi,

I'm new to Code::Blocks editor.
I found it very good.

But what I'm really missing is an integrated File Explorer window.
I don't want to use a project because my sources are really huge and I quite often change a "view" on these sources (older versions, versions on different branches -> some elements vanishes, some are added).
It means that I would have to always update the project if I change the "view" on the sources.

For that an integrated File Explorer would become really handy.

Is the integrated File Explorer planned?

mariocup

  • Guest
Re: File explorer window
« Reply #1 on: June 15, 2007, 12:08:44 pm »
Hi,

I have not tested the plugin until now. But just have look at

http://forums.codeblocks.org/index.php?topic=6143.new;topicseen#new

Bye,

Mario

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: File explorer window
« Reply #2 on: June 15, 2007, 01:23:56 pm »
if you are running win32 you can test on a pre-built CB with the plugin installed here:

http://developer.berlios.de/project/showfiles.php?group_id=7745&release_id=12949

I still have quite a few features to add. Comments/suggestions very welcome. (if you want to keep menu pollution to a minimum - you might want to disable the python plugin (plugins->manage plugins)

EDIT: a few notes

1. The file explorer is integrated with the interpreter actions menu, so if you right click on a file that matches the wildcard spec of the interpreter you will be offered its actions. (interpreter can mean anything you want here: interpreters, shell commands, svn commands etc)
2. The top combo box controls the root path of the file explorer tree view, the second one is a semi-colon wild card filter (accepts the usual * and ? wildcards) -- these things are stored persistently across sessions
3. lots of right click context menu options (not all of them work and some might crash/lock up codeblocks -- this happened to me with the "Make root" menu option on win32, but not on linux)
4. the File Explorer allows multiple selects but none of the commands respond to multiple selections at the moment.
« Last Edit: June 15, 2007, 01:54:33 pm by dmoore »

Klokan

  • Guest
Re: File explorer window
« Reply #3 on: June 15, 2007, 02:25:44 pm »
Hi dmoore,

I have just tried it, it looks good.

I have few suggestions on the File Explorer:
- possibility to open up a system menu on the file/directory -> I use it very often to checkout/checkin file/directory in my ClearCase versioning system
- possibility to synchronize the File Explorer with the current opened file.
- possibility to change the sorting: directories first, then files
- possibility to change the sorting: file names or extensions or date,....
- possibility to refresh the File Explorer
- somehow mark read-only files (some small lock icon maybe?)


Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: File explorer window
« Reply #4 on: June 15, 2007, 02:37:45 pm »
- somehow mark read-only files (some small lock icon maybe?)
This is implemented in the C::B core, already?!
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Klokan

  • Guest
Re: File explorer window
« Reply #5 on: June 15, 2007, 03:19:13 pm »
Hm, I see text "Read only" at the bottom status bar, but no graphical mark in the file tab.
Also there is no mark in the File Explorer.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: File explorer window
« Reply #6 on: June 15, 2007, 04:23:45 pm »
Hi dmoore,

I have just tried it, it looks good.

glad you like

Quote
I have few suggestions on the File Explorer:
- possibility to open up a system menu on the file/directory -> I use it very often to checkout/checkin file/directory in my ClearCase versioning system

not sure what you mean by system menu... "environment->settings->interpreted languages" lets you add actions for files that will populate the right click context menu (for files only at this point, working on directory implementation as well). actions can be things like spawning Nautilus/Windows explorer, running interpreters, image viewers etc

Quote
- possibility to synchronize the File Explorer with the current opened file.

good idea. will do very soon.

Quote
- possibility to change the sorting: directories first, then files

isn't that what it is now?

Quote
- possibility to change the sorting: file names or extensions or date,....

yes, I'll add that option eventually

Quote
- possibility to refresh the File Explorer

forgot to put that command in the menu... next revision. I'm debating whether to force refresh after running the Interpreter Actions.

Quote
- somehow mark read-only files (some small lock icon maybe?)

will do.

« Last Edit: June 15, 2007, 04:25:32 pm by dmoore »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: File explorer window
« Reply #7 on: June 15, 2007, 11:11:12 pm »
- possibility to change the sorting: directories first, then files

looks like wxtreectrl is a bit iffy on win32. I'm having trouble getting oncompareitems to overload properly... (i've tried to copy from the wxwidgets treectrl sample, whose overload is supposed to work)

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: File explorer window
« Reply #8 on: June 15, 2007, 11:21:12 pm »
- possibility to change the sorting: directories first, then files

looks like wxtreectrl is a bit iffy on win32. I'm having trouble getting oncompareitems to overload properly... (i've tried to copy from the wxwidgets treectrl sample, whose overload is supposed to work)

Yep, I've had a hell of a time figuring that out too. But ArtoJ does it just fine.

Look at CodeSnippets. CodeSnippetsTreeCtrl::OnCompareItems.

ArtoJ has this criptic statement in the header:
Code
	private:
// Must use this so overridden OnCompareItems() works on MSW,
// see wxWidgets Samples -> TreeCtrl sample
//
// Yes, again, ugly way to solve wxWidgets' weirdness
DECLARE_DYNAMIC_CLASS(CodeSnippetsTreeCtrl)
}

and this in the cpp
Code

IMPLEMENT_DYNAMIC_CLASS(CodeSnippetsTreeCtrl, wxTreeCtrl)

« Last Edit: June 15, 2007, 11:39:09 pm by Pecan »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: File explorer window
« Reply #9 on: June 16, 2007, 12:41:21 am »
unfortunately I've added those lines Pecan and still not working. I must have something stupid in my code that's stopping the call from going through.

(if you want to check out my FileExplorer.cpp and FileExplorer.h from my cbilplugins SVN and take a look I'd be very appreciative)

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: File explorer window
« Reply #10 on: June 16, 2007, 12:43:08 am »
PS: I'll also take a look at your codesnippets code...

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: File explorer window
« Reply #11 on: June 16, 2007, 01:08:08 am »
here's the class spec (all public to keep things simple):

Code
class FileTreeCtrl: public wxTreeCtrl
{
public: //wxTR_HIDE_ROOT|/*wxTAB_TRAVERSAL|*//*|wxTR_HAS_BUTTONS*//*wxTR_MULTIPLE|*/
    FileTreeCtrl(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition,
        const wxSize& size = wxDefaultSize, long style = wxTR_DEFAULT_STYLE|wxTR_NO_LINES,
        const wxValidator& validator = wxDefaultValidator,
        const wxString& name = _T("treeCtrl"));
    FileTreeCtrl();
    FileTreeCtrl(wxWindow *parent);
    virtual ~FileTreeCtrl();
    void DoSortChildren(const wxTreeItemId& ti);
    int OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2);
    DECLARE_DYNAMIC_CLASS(FileTreeCtrl)
    DECLARE_EVENT_TABLE()
};

I've tried calling sortchildren from its owner or calling dosortchildren, which calls the wxTreeCtrl::SortChildren to no avail...


Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2750
Re: File explorer window
« Reply #12 on: June 16, 2007, 03:02:23 am »
I did a svn checkout of cbilplugin.

I compiled it with MSW wxWidgets-2.8.4 (had to cast two ints and add #include <wx/notebook.h> to define wxNB_TOP).

I added traps at:
Code
    asm("int3");
    m_Tree->SortChildren(ti);
    return true;

and

Code
int FileTreeCtrl::OnCompareItems(const wxTreeItemId& item1, const wxTreeItemId& item2)
{
    asm("int3");
    if(GetItemImage(item1)>GetItemImage(item2))
        return -1;
    if(GetItemImage(item1)<GetItemImage(item2))
        return 1;
    return (GetItemText(item1).Cmp(GetItemText(item2)));
}

and then ran CB under gdb.

Both traps occurred, and the second trap got a bazillion hits as the plugin initalized. So your code is being called just fine.
You just have to code the sort correctly.

See ArtoJ's code in CodeSnippets. CodeSnippetsTreeCtrl::OnCompareItems.
« Last Edit: June 16, 2007, 03:06:31 am by Pecan »

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: File explorer window
« Reply #13 on: June 16, 2007, 03:46:03 am »
thanks pecan!! I have been using wx2.6.3, but I doubt that is the problem. more likely the getitemimage calls are invalid under win32?

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: File explorer window
« Reply #14 on: June 16, 2007, 06:34:33 am »
nope I was wrong -- wx2.6.3 was the problem. the sort with 2.8.4 works fine.  8) (and a pox on those wx guys  :lol:)