Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: eranon on September 04, 2012, 01:07:26 pm

Title: Header/source swap about wxWidgets
Post by: eranon on September 04, 2012, 01:07:26 pm
Is there a way to do that the "swap header/source" feature works globally (ie. not for a specific project but whatever be the loaded project) when I want to take a look at the wxWidgets code. What to add in the global C::B settings ?
Title: Re: Header/source swap about wxWidgets
Post by: oBFusCATed on September 04, 2012, 07:48:43 pm
Hm, pretty uninformative question. But swap header/source works globally if the header and source are in the same directory, for wx they aren't so this feature is always broken.
Title: Re: Header/source swap about wxWidgets
Post by: eranon on September 04, 2012, 08:45:37 pm
From the point you know the wxWidgets tree structure, I effectively asked my question a little bit implicitely ; we could say the obfuscated way ;D But, you're right, oBFusCATed, the explicit question is well :

How to do that the header/source swapping feature works against wxWidgets source code, considering that its interface and implementation files are in differents locations ?
Title: Re: Header/source swap about wxWidgets
Post by: oBFusCATed on September 04, 2012, 09:05:38 pm
By improving the feature, simple as this :)
Title: Re: Header/source swap about wxWidgets
Post by: ollydbg on September 05, 2012, 02:07:16 am
Check the option "Use one parser for all workspace", so that all your data/tokens were stored in a single database.

swap header/source works globally if the header and source are in the same directory
They will work if the cpp and h files were in different directory, but have the same short/base name like:
c:/aaa/bbb/ccc/xyz.cpp
d:/eee/fff/xyz.h


Title: Re: Header/source swap about wxWidgets
Post by: oBFusCATed on September 05, 2012, 02:12:57 am
ollydbg: no it doesn't work, tested many times at least on linux.
Title: Re: Header/source swap about wxWidgets
Post by: ollydbg on September 05, 2012, 02:15:21 am
ollydbg: no it doesn't work, tested many times at least on linux.
OK, I will check it.
Title: Re: Header/source swap about wxWidgets
Post by: ollydbg on September 05, 2012, 05:21:54 am
ollydbg: no it doesn't work, tested many times at least on linux.
OK, I will check it.
Hi, oBF, you are right, I look at the source code, it was in:
Code
bool EditorManager::SwapActiveHeaderSource()
But I see a lot of hacks here.

I think the correct way was:
Using the CodeCompletion-plugin, we have
Code
TokenFilenamesMap m_FilenamesMap;
This contains all the file names parsed by CC, but the name is recorded in fullname style. Then we can do a search by the "base short name".
Title: Re: Header/source swap about wxWidgets
Post by: Jenna on September 05, 2012, 06:27:39 am
This would also be a hack, because it will not work, of there are fseveral fles with the same name.

And it would rely on cc, and I don't think a core-comoponent can safely rely on a plugin.
Title: Re: Header/source swap about wxWidgets
Post by: oBFusCATed on September 05, 2012, 09:18:46 am
Probably we can make it use it as an additional source. But first we need public interface to the CC.
Title: Re: Header/source swap about wxWidgets
Post by: eranon on September 05, 2012, 03:26:45 pm
Yeah, brains are active here 8)

Maybe a stupidity, but why not let the C::B user to indicate the base directory for headers and the one for implementations. For example, in wxWidgets, it could be :

Code
"[wxWidgets-base]\include" for .h
"[wxWidgets-base]\src" for .cpp

Then search recursively from the appropriated base and show dialog-box (for the user to choose) if there're several files with same filename. Of course, recursive search can be long, but only for big trees (so, big projects and/or libs).

-
EDIT : also, this recursive searching would be engaged only if .h and .cpp are not in the same directory (this to not slow down current behavior).