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
 Refactoring (moving, coyping, deleting)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Dans
Senior Member

Ukraine
45 Posts

Posted - Apr 18 2008 :  10:54:01 AM  Show Profile  Reply with Quote
Hi,

I saw that someone ask for moving class, copy class to other files.
It's a good thing and I need this too, but in proposed way it needs many interactive manipulations: select file, type file name, etc. It seems terrible for developers that do not like create UI

I proposed to do these operations through clipboard.

Let's imagine: you put caret in header of class, press for example short-cut Ctrl+Alt+C. I this case VA analyses class declaration, and implementation, and copies this information into clipboard. It can be simple text format with specific tags

Class to copy:
---- some.h

class Some  < cursor caret in this line
{
   void member1();
   void member2()
   {
     // do something 2
   }
}

---- some.cpp

void Some::member1()
{
   // do something 1
}

Class in clipboard:
//#VAssistX_Clipboard:entity=class
//#VAssistX_source:source=some.h
class Some
{
   void member1();
   void member2()
   {
     // do something
   }
}
//#VAssistX_source:source=some.cpp
void Some::member1()
{
   // do something 1
}
Then when you want to paste this class into other file, just put caret in needful place, press Ctlr+Alt+V and class with members is populated in new file. Also you can check if there appropriate CPP file if no prompt to enter CPP file name or put implementation in header file. There are many variations: class can be paste into other class declaration, etc.

Also with this mechanism you can copy just members in similar format:
//#VAssistX_Clipboard:entity=member
//#VAssistX_source:source=some.h
class VATemplate
   void member1();
   void member2()
   {
     // do something 2
   }
....
For sure clipboard format is just for sample

When you will have mechanism to copy and paste classes, members, functions into other files/classes/namespaces, you can create another refactoring thing:

2. Delete class, member, etc (IOW entity). Very useful thing. When I refactor code many members become obsolete so I need to
delete them permanently and usually in two files (search, search, Alt+G do not work, damn it).

3. Cut entity - cut class, member(s). ItG??s a combination of Copy entity and Delete entity. This is the way to provide MOVE class/member/etc mechanism.

What do you think? It really works and needs minimal interactive input. Any exceptions (name collisions, missed files, etc) can be deeply discussed.

Best regards,
Dans

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - Apr 18 2008 :  11:49:18 AM  Show Profile  Reply with Quote
Simply looking at the ability to delete a class member, we are considering adding this as a refactoring command:

case=1101

The broader idea here, I am not quite sure what I think about it to be honest. This is a very appealing solution to moving a class from one file to another. The first question is simply how often does this need to happen? In my personal experience it is something I very rarely do.

I do sometimes copy a class, and use it as a template for a new class, but when doing this I normally only want the header file content, since I will be making new function implementations.

VA Outline helps, since you can quickly and easily select and copy things from the outline. Of course this only copies from a single file at a time.

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

Dans
Senior Member

Ukraine
45 Posts

Posted - Apr 21 2008 :  05:39:44 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline

Simply looking at the ability to delete a class member, we are considering adding this as a refactoring command:

case=1101


Member or whole class, depends on cursor position.
And for deleting method, please get scope based method's body. It's annoying to aim to member name when this is not mandatory.

quote:

The broader idea here, I am not quite sure what I think about it to be honest. This is a very appealing solution to moving a class from one file to another. The first question is simply how often does this need to happen? In my personal experience it is something I very rarely do.

I do sometimes copy a class, and use it as a template for a new class, but when doing this I normally only want the header file content, since I will be making new function implementations.

VA Outline helps, since you can quickly and easily select and copy things from the outline. Of course this only copies from a single file at a time.



Very often, especially when refactoring somebody else's code. Usually it's moving method(s) from one clas to another (cut and paste from one file(s) to another). You can save a lot of our time.
VA Outline is mouse dependent feature and is good for understanding code and is not a panacea . I'm looking for something based on short-cuts. It will be VERY appreciated.
Another benefit of supporting text clipboard format - you can introduce sophisticated class templates that can be created from real classes.
BTW, add class is not working correctly when intellisense disabled (DLL removed).
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - May 14 2008 :  1:51:48 PM  Show Profile  Reply with Quote
Apologies for the delay in getting back to you about this, I have been busy with other things.

I have asked internally about this. There is a lot to like here, I am just not quite sure about some of the implications for modifying multiple files in one go.

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

xMRi
Tomato Guru

Germany
315 Posts

Posted - May 21 2008 :  05:31:16 AM  Show Profile  Reply with Quote
Deleting member functions and data members wouldbe very helpful!

Martin Richter [rMVP] WWJD http://blog.m-ri.de
"A well-written program is its own heaven; a poorly written
program is its own hell!" The Tao of Programming
Go to Top of Page

Dans
Senior Member

Ukraine
45 Posts

Posted - May 22 2008 :  08:39:46 AM  Show Profile  Reply with Quote
quote:
Originally posted by feline


I have asked internally about this. There is a lot to like here, I am just not quite sure about some of the implications for modifying multiple files in one go.


Modification of multiply files is needful thing because it's the way how C++ programs are born.
You should create base but flexible mechanism, and all tweaking suggestions will come from community (i have a lot )

Offtopic:
Interesting which info you grab when parsing files, how it detailed. Answer for this question can help in discussions.

Thanks.
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - May 22 2008 :  10:02:07 AM  Show Profile  Reply with Quote
MartinRichter, simply looking at the ability to delete a class member, we are considering adding this as a refactoring command:

case=1101

Dans, modifying multiple files at once is "harder" in VC6, due to how the IDE and Undo work. This is one factor to consider. A second factor is modifying multiple files in one go makes any problems / mistakes by VA worse, and can break more code more quickly.

I am not saying it cannot or should not be done, but it needs to be done carefully

As for what we know when parsing files, considering all of the bug reports I see, we do not know enough

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

Dans
Senior Member

Ukraine
45 Posts

Posted - May 23 2008 :  07:33:26 AM  Show Profile  Reply with Quote
quote:

Dans, modifying multiple files at once is "harder" in VC6, due to how the IDE and Undo work. This is one factor to consider. A second factor is modifying multiple files in one go makes any problems / mistakes by VA worse, and can break more code more quickly.


You should not take care about this. There are many people that code in VC6 but much more that uses never versions of VS. This feature can be disabled in VC6 or users can be warned about consequences that operation can not be undone in single click. BTW, deleting member also needs modyfying two files

quote:

I am not saying it cannot or should not be done, but it needs to be done carefully


Sure
Go to Top of Page

feline
Whole Tomato Software

United Kingdom
18951 Posts

Posted - May 23 2008 :  4:01:34 PM  Show Profile  Reply with Quote
Obviously you do not use VC6. A lot of our users do use VC6, it is still a very popular IDE. I see regular queries about Microsoft Embedded C++ 4 as well, which is basically VC6 used for a different purpose.

If you want an IDE that no one uses then try VS2002, I don't remember the last time I saw anyone say they worked in that IDE. The more recent IDE's are not automatically better, or more useful. I know VS2005 can be terrible to work with if you have a large C++ solution, due to how slow it can be.

Eventually the day will come when we stop supporting VC6, but I have no idea when that will be, and currently it looks like it is still a long way off.

We do not have exactly the same features in VC6 as the other IDE's, but we try to keep the IDE's as close as possible, since this is an important selling point to us.

We do modify several files in one go with Rename and also Change Signature in VC6, so the option is there, it just needs doing carefully and properly.

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

hotzenplotz
Senior Member

Austria
34 Posts

Posted - Jun 10 2008 :  7:59:22 PM  Show Profile  Reply with Quote
I like the clipboard idea.
And i think it wouldn't even be necessary to use a special shortcut for pasting. Clipboard is multi-format, so VAX could use a special "VAX-text" type, and only fall back to plain text if the application can't deal with VAX' special type (like when pasting the clipboard in notepad).
Another way would be to include something like a special GUID in the "//#VAssistX_Clipboard" header - that should make it reasonable safe to just process anything that contains that GUID as a "special VAX paste".

OTOH using a special shortcut would enable the user to past the "serialized class code" into some file by using the normal paste shortcut. You could even mail that snippet to someone, or send it via ICQ or whatever. The other person could then just copy it from the email/instant messanger, and paste it in VS. Very nice :)

I'm not sure how helpful this feature would be in general, but I totally like the clipboard idea. It's so MacGyver :)

Use the source, Luke!
Go to Top of Page

Dans
Senior Member

Ukraine
45 Posts

Posted - Jun 11 2008 :  08:14:52 AM  Show Profile  Reply with Quote
quote:
Originally posted by hotzenplotz

I like the clipboard idea.
And i think it wouldn't even be necessary to use a special shortcut for pasting. Clipboard is multi-format, so VAX could use a special "VAX-text" type, and only fall back to plain text if the application can't deal with VAX' special type (like when pasting the clipboard in notepad).
Another way would be to include something like a special GUID in the "//#VAssistX_Clipboard" header - that should make it reasonable safe to just process anything that contains that GUID as a "special VAX paste".


In my mind it's overkill. I use clipboard monitoring program, and sometimes needs to correct clipboard content before pasting. Multiformat will broke this. Plain text is all that I need.

Ctrl+Alt+C - Copy entity
Ctrl+Alt+X - Cut entity
Ctrl+Alt+V - Paste entity
Ctrl+Shif+Del - Delete entity
quote:

I'm not sure how helpful this feature would be in general, but I totally like the clipboard idea. It's so MacGyver :)


I come to Visual C++ from Delphi that have powerfull expert ModelMaker Code Explorer (MMX). It contain this feature and it works like a charm. I'm missing this all time...
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