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
 Reorder (tidy) header files
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

pete99
New Member

United Kingdom
3 Posts

Posted - Sep 19 2018 :  1:44:31 PM  Show Profile  Reply with Quote
I would like Visual Assist to be able to reorganise my (C++) header files so that there is only one 'public', 'protected' and 'private' section.

Typically when using the Visual IDE (MFC, events or member variables from visual dialog editor) I end up with multiple 'public', 'protected' and 'private' sections in my .h (header) file.

Reorganising manually is a pain. It would be great if something like 'Reorganise' could appear on a right click menu for this type of file (or perhaps from the root of VA Outline?).

Love Visual Assist already!

Pete

Peter Boulton,
Powerprogrammer.co.uk
Creator of the Software Update Wizard
Visit PowerProgrammer on the web....at... https://www.PowerProgrammer.co.uk

accord
Whole Tomato Software

United Kingdom
3287 Posts

Posted - Sep 19 2018 :  10:54:02 PM  Show Profile  Reply with Quote
Thank you for the kind words about Visual Assist, we appreciate your love

Regarding your idea, first of all, are you aware that you can easily reorganize the file using drag-and-drop in VA Outline? I think it's pretty quick to make it tidy, and you have the freedom to use a method you like. I mean, an algorithm would have certain limitation and may not do it in a way you fancy. I have a feeling that we would need a large amount of settings to implement it properly. Like if you want variables or methods first in a section, etc.
Go to Top of Page

pete99
New Member

United Kingdom
3 Posts

Posted - Sep 20 2018 :  04:39:38 AM  Show Profile  Reply with Quote
Thanks for the reply!

Yes, I understand how I can drag and drop in VA Outline and that's great functionality.

However, having just used this option to tidy up a relatively small header file (70 lines) it took quite a lot of drag and drop operations. Then I had to delete the duplicate 'public', 'protected' and 'private' lines. I have over 400 .h files in my main product's solution. There is no way I can justify or spare the time to repeat this operation 399 more times, especially where many of the .h files are considerably longer.

Therefore I still think the suggestion will be very beneficial to many users (but am happy to accept disagreements from others if I'm mistaken!)

Finally, I 100% take your point about preferences for the reorder - i.e. variables or methods first in a section etc.. However, I can't see that there are that many permutations, which could easily be handled by a few checkboxes on a prompt dialog (which would persist between uses).

I hope this reply may provoke a reconsideration, or support/opposition from your other users!

Thanks again for taking the time to reply so promptly.

Pete

Peter Boulton,
Powerprogrammer.co.uk
Creator of the Software Update Wizard
Visit PowerProgrammer on the web....at... https://www.PowerProgrammer.co.uk
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Sep 20 2018 :  4:46:11 PM  Show Profile  Reply with Quote
Grouping like this sounds simple, but at an old job we had a rule that you had to have another public, protected or private block every 30 lines in long header files, so you could work out which visibility any given method had without having to go searching to much. So I have the horrible feeling that there will be more rules and cases than we would expect.

The bigger concern here is that this gets very close to the "make the header and cpp file have the same ordering" request that comes up every now and then. This sounds quite reasonable and simple at first, but as you start looking, it quickly gets horribly complex, and I am wary of getting back into that mess.

Turning back to how you did this in your file, how did you go about reorganizing the file? If it took this long, it sounds like you did it all one item at a time. VA Outline supports multiple selection, both via Shift to get blocks of items, and Ctrl to get separate items. Consider this simple test case:

class testUsingInterface
{
public:		// interface 1
	virtual void method1();
	virtual void method2();

public:		/* interface 2 */
	virtual void method3();
	virtual void method4();

public:		// interface 3
	virtual void method5();
	virtual void method6();
};

VA Outline shows 3 public blocks. But I can very quickly and simply select the 4 items in the second and third public blocks all at once, and then drag and drop them into the first block. A few mouse clicks and one drag, and it is sorted. I can now delete the extra public lines straight from VA Outline, select both of them and press Del once.

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

pete99
New Member

United Kingdom
3 Posts

Posted - Sep 21 2018 :  07:49:18 AM  Show Profile  Reply with Quote
Hi,
Thanks for explaining, and I didn't realise I could multi-select the duplicate 'public:' items in VA Outline and delete them.

I wasn't requesting "make the header and cpp file have the same ordering". For me, the header file is the quickest way to quickly get a picture of a class and so it's that which needs to be properly organised, and which VS2017 etc. wizards make a mess of.

It's obviously your product and your prerogative to reject suggestions but nothing in your replies has discouraged me from thinking this feature is either undesirable or unreasonably difficult to deliver.

I will probably write my own 'quick and dirty' utility to reorganise my header files - probably allowing multiple file selection, preferences on ordering etc.. Can't see it would be too difficult.

Thanks for taking the time to consider and respond.

Pete

Peter Boulton,
Powerprogrammer.co.uk
Creator of the Software Update Wizard
Visit PowerProgrammer on the web....at... https://www.PowerProgrammer.co.uk

Edited by - pete99 on Sep 21 2018 07:49:47 AM
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18750 Posts

Posted - Sep 21 2018 :  08:25:39 AM  Show Profile  Reply with Quote
Generally speaking, when people ask about re-ordering or re-organising either a header or a cpp file, they also ask for the same changes to be made to the other, matching file. I appreciate that here you have not asked about this, but since they are normally paired, I am prone to considering them as a pair.

If all of your files follow a common "pattern" then it should not be to difficult, no. Our problem is that anything we do has to cover a rather wide range of cases. Once you see some of the edge cases that come up, you see why all of this can get a bit hairy

Personally, being keyboard focused, I would use multiple select, cut and copy in VA Outline. Combined with collapsing sections I had sorted, I would expect to be able to sort most files quickly and easily like this. The slow and hard part is grouping logically related items together, so you can make some sense of the API the class is offering. At least this has been my experience.

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