Whole Tomato Software Forums
Whole Tomato Software Forums
Main Site | Profile | Register | Active Topics | Members | Search | FAQ
User name:
Password:
Save Password
Forgot your password?

 All Forums
 Visual Assist
 Feature Requests
 Conflate .h and .cpp files to one "code-file"
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Assemblerguru
Starting Member

Germany
1 Posts

Posted - May 15 2007 :  02:42:14 AM  Show Profile  Reply with Quote
Hi !

Well prob always is the top document tab. The .h and .cpp files of the same class are always spread over the tab. E.G. a files .h and .cpp files (calls "CMyClass.h" and "CMyClass.cpp") are not ordered side by side. So its difficult to locate them for fast class switching...

It would be nice, if I can click on one tab per .h and .cpp file (e.g. called "CMyClass") and switch between them in an new tab (on the bottom or right side). So you have bound header and code files together.

This is similar to the borland c++ builder ide.

What do you say ?

br,
Andr+?

sl@sh
Tomato Guru

Switzerland
204 Posts

Posted - May 15 2007 :  04:10:29 AM  Show Profile  Reply with Quote
<ALT>-O switches between associated .h and .c/.cpp files (provided the base names are identical).

With respect to ordering opened files, you can drag opened editor windows by the tab label and put them next to their respective headers/implementation files.

The only thing that maybe VA could do to improve this, is modify <Alt>-O to move a newly opened file next to the original one. Don't be surprised however, if someone turns up and complains about that kind of behaviour - for instance I often use several tab rows at once, switching between files all the time, and when I want to switch to a file I know I have opened just a minute ago, I would look for it at the right end of the tab row...

HTH,
Stefan
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - May 15 2007 :  07:56:41 AM  Show Profile  Reply with Quote
If you want to swap tabs with the mouse use the VA toolbar button "Open Corresponding .h or .cpp", which is the button for the ALT-O keyboard shortcut.

zen is the art of being at one with the two'ness
Go to Top of Page

mmb
Senior Member

42 Posts

Posted - May 21 2007 :  05:39:53 AM  Show Profile  Reply with Quote
At least for VC6 you can get this functionality by using the (registered version of the) WndTabs plugin. See www.wndtabs.com.
Go to Top of Page

graham.reeds
Ketchup Master

United Kingdom
51 Posts

Posted - Jun 12 2007 :  03:55:12 AM  Show Profile  Reply with Quote
That's one feature I miss in VC2005 and that is the option to automatically open the corresponding file (no intervention necessary). It would be a nice option in VAX.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jun 12 2007 :  08:04:38 AM  Show Profile  Reply with Quote
Under what conditions would the corresponding file open?

My initial reaction is to wonder how this helps, since you still need to swap / jump to this file. VA's alt-o will open the file if it is not open, allowing you to do both the open and the swap in one step.

In VS2005 I long ago gave up trying to keep the cpp and header files next to each other on the tab bar. It is nice, but when working it never seems to last long for most file pairs.

zen is the art of being at one with the two'ness
Go to Top of Page

graham.reeds
Ketchup Master

United Kingdom
51 Posts

Posted - Jun 12 2007 :  08:20:45 AM  Show Profile  Reply with Quote
In VC6+WndTabs opening one would automatically open the other. I suppose I can ween myself off it via Alt+O but it's reassuring to see it there:-)
Go to Top of Page

Krakken
Ketchup Master

Australia
63 Posts

Posted - Jun 18 2007 :  11:12:39 PM  Show Profile  Reply with Quote
The thing is, ALT+O, as far as I know, only switches when you have the source/header you wish to work on already open.

This feature would be useful to me when changing from file to file where I would only have to look for the name I want and then click the appropriate .h/.cpp button next to it. It's also handy for keeping the clutter away.

Sure I could use SHIFT+ALT+O but who wants to type the filename when it's up at the top for you ready.

It would be nice to have a new custom tab-bar integrated in. There are a lot of potential features that could be added. (IE http://forum.wholetomato.com/forum/topic.asp?TOPIC_ID=6400)
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jun 19 2007 :  07:06:11 AM  Show Profile  Reply with Quote
alt-o will open the matching file if it is not already open. So just use either the keyboard shortcut, or the toolbar button, and you will be placed in the matching file without having to do anything else.

The only time VA will ask you is if there is more than one matching file, and it does not know which one you want to jump to.

zen is the art of being at one with the two'ness
Go to Top of Page

Arnt
Junior Member

20 Posts

Posted - Jun 19 2007 :  08:13:04 AM  Show Profile  Reply with Quote
For visual studio 2003, this functionality is possible through vstabs, see http://www.zero-one-zero.com/vs/ . Note that you have to download a fixed dll from the forum and overwrite the installed one, to fix the close button not working. However, the forum appears to be down right now.
Go to Top of Page

Krakken
Ketchup Master

Australia
63 Posts

Posted - Jun 19 2007 :  08:37:36 AM  Show Profile  Reply with Quote
feline: I think you may have missed my point.
Arnt: Unfortunately I am using VS2005.
Go to Top of Page

Krakken
Ketchup Master

Australia
63 Posts

Posted - Jun 19 2007 :  08:39:24 AM  Show Profile  Reply with Quote
Just to clear it up, by "This feature" I am referring to the thread not ALT+O.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jun 19 2007 :  11:53:00 AM  Show Profile  Reply with Quote
If you want to use the mouse to swap files the easiest way to do this is to use the VA toolbar button for alt-o, "Open Corresponding .h or .cpp"

I understand that grouping the files together into a single tab in the bar keeps them together and reduces clutter, but what about the problem cases? What happens when someone has 3 tabs open pointing at the cpp file and 4 tabs open pointing at the header file?

What happens when there are 3 or 4 files? "foo.h", "foo.cpp", "foo.inl"

Two pairs of files, with the same name, in different directories?
C:\\src\\library\\foo.h
C:\\src\\library\\foo.cpp

C:\\src\\app\\foo.h
C:\\src\\app\\foo.cpp

This idea opens up a whole new area and I am not sure what people will want from something like this, or if it is something we should be trying to do.

zen is the art of being at one with the two'ness
Go to Top of Page

Arnt
Junior Member

20 Posts

Posted - Jun 19 2007 :  12:05:57 PM  Show Profile  Reply with Quote
I find that this (vstabs for vc2003) helps with reducing the number of tabs, thus allowing me a better overview of my open files and quicker navigation between different files. I still miss WndTabs' multiple rows of tabs. (vstabs does have its problems, e.g. 2 main.cpp files will also join tabs. WndTabs was better there too.)

I would love something like this in Visual Assist. (Those who don't like it can always turn it off.) In the case of confusion like you describe, I would go for either closest in 'directory levels' or simply not combine them. In fact, the problems with the 2 pairs of files will be exactly the same if you open one of them and then do alt-o no? So I would say: join together cpp and h in whatever manner alt-o would do it...
Go to Top of Page

Krakken
Ketchup Master

Australia
63 Posts

Posted - Jun 19 2007 :  8:13:13 PM  Show Profile  Reply with Quote
@feline

I understand that grouping the files together into a single tab in the bar keeps them together and reduces clutter, but what about the problem cases? What happens when someone has 3 tabs open pointing at the cpp file and 4 tabs open pointing at the header file?

Well to solve this problem, I would only group .h and .cpp files with identical names in an identical directory into one tab.

What happens when there are 3 or 4 files? "foo.h", "foo.cpp", "foo.inl"

.inl and the such would not be included in on this and would open in their own tab.

Two pairs of files, with the same name, in different directories?

This is the simplest to answer. All you need to do is to take a look at how this situation is currently handled in VS. It just opens 4 tabs, 2 foo.cpp and 2 foo.h so there is no real disadvantage here to what is currently implemented. The truth of the matter is that the good majority of coders structure file names after their classes/namespaces or functions anyway - none of which can be identical in C or one of its derivatives. This situation would be rare at best and would probably still be an improvment over the current system.
Go to Top of Page

Arnt
Junior Member

20 Posts

Posted - Jun 20 2007 :  04:30:59 AM  Show Profile  Reply with Quote
> Well to solve this problem, I would only group .h and .cpp files with identical names in an identical directory into one tab.

We don't keep those files in the same directory here, so that would be a too much of a limitation for me. As I said before, this already works fine for alt-o so use whatever alt-o uses now.

> [..] structure file names after their classes/namespaces or functions anyway - none of which can be identical in C or one of its derivatives.

Not completely true when you add namespaces to the mix (many people name the file after there class, independent of the namespace it's in, I think), but probably close enough for a first implementation. And again, if it does the same than alt-o, it'll be as good or bad as that currently is.
Go to Top of Page

sl@sh
Tomato Guru

Switzerland
204 Posts

Posted - Jun 21 2007 :  11:13:22 AM  Show Profile  Reply with Quote
Like 'Arnt' said, seperate C or C++ objects can indeed have identical names, even if they are not in different namespaces. I know it for a fact, because there's at least one class in the global namespace of the project I'm working on, that is also at the same time being used as a class name within an old library we're also using (including the source - can you say 'legacy'?)

This does not cause any conflict, because files using either class reside in different directories and use other include paths.

Also I wouldn't consider it a 'rare' case when headers are not being stored alongside the corresponding implementation files. As a matter of fact, I have often seen it done otherwise, especially in software that has a history going back for some years. The only thing that leads me to believe that headers might be stored alongside implementations in a majority of at least newer projects is the fact that this is the standard behavior of VS.

Edited by - sl@sh on Jun 21 2007 11:18:33 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
19021 Posts

Posted - Jun 22 2007 :  08:22:37 AM  Show Profile  Reply with Quote
From the details and comments people post here having cpp and header files in different directories is very common, if not actually standard practice most places. True alt-o knows how to pair up files most of the time, but alt-o sometimes produces a menu asking you where you want to go.

Duplicate file names in different directories, either due to two classes in different namespaces with the same name, or VSS shared files are also quite common.

I have asked internally to get a second opinion on this. I see the appeal, but I also see some of the problems with doing this properly from within VAX.

zen is the art of being at one with the two'ness
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
© 2023 Whole Tomato Software, LLC Go To Top Of Page
Snitz Forums 2000