Author Topic: Header/source swap about wxWidgets  (Read 5778 times)

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Header/source swap about wxWidgets
« 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 ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Header/source swap about wxWidgets
« Reply #1 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: Header/source swap about wxWidgets
« Reply #2 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 ?
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Header/source swap about wxWidgets
« Reply #3 on: September 04, 2012, 09:05:38 pm »
By improving the feature, simple as this :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Header/source swap about wxWidgets
« Reply #4 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


« Last Edit: September 05, 2012, 02:36:10 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Header/source swap about wxWidgets
« Reply #5 on: September 05, 2012, 02:12:57 am »
ollydbg: no it doesn't work, tested many times at least on linux.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Header/source swap about wxWidgets
« Reply #6 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.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5915
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Header/source swap about wxWidgets
« Reply #7 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".
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7255
Re: Header/source swap about wxWidgets
« Reply #8 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.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: Header/source swap about wxWidgets
« Reply #9 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.
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline eranon

  • Almost regular
  • **
  • Posts: 180
Re: Header/source swap about wxWidgets
« Reply #10 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).
« Last Edit: September 05, 2012, 03:30:00 pm by eanon »
[Independent dev. - wxWidgets 3.0.0 under "Win 7 Pro 64-bit, C::B SVN 9435 & wxSmith, TDM64-GCC 4.7 & MSVC9" + "OS X 10.8, FSF GCC 4.7 & C::B SVN 8909"]