Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: noisy on June 04, 2007, 10:17:42 am

Title: Make member function
Post by: noisy on June 04, 2007, 10:17:42 am
Hi!

I just switched to CodeBlocks from KDevelop and I have to say looks really great by now  :)
But there is function I miss, don't know wheter I just didn't find it, or it isn't included.

In KDevelop I just select the declaration of a function, press F2 and then the member in the source file is auto-generated.
Pressing F2 when selected in the header:
Code
void testFunc (char *test);
creates in the source file:
Code
void testFunc (char *test)
{
}

So could you please tell me, whether I just didn't find this really useful function, or is it not supported by CodeBlocks.
If so it would make me very happy, if someone could add this feature   :D
Title: Re: Make member function
Post by: David Perfors on June 04, 2007, 10:34:48 am
This is not supported by Code::Blocks, though it would be very usefull and I think it is possible to implement this in a simple plugin.
Title: Re: Make member function
Post by: Pecan on June 04, 2007, 02:39:34 pm
You can write a plugin to do that, or use KeyMacs (see the wiki index) with the following key macro definition


define Ctrl-F2 in  KeyMacs as:
{home}+{end}^C{F11}^{end}^v{enter}{{}{enter}{}}{enter}

Place the cursor on the header declaration of the function and hit Ctrl-F2.

This Macro does the following
{home} - go to beginning of line
+{end} - mark selection to end of line
^C - copy marked     
{F11} - switch to source definitions
^{end} - go to bottom of file
^v - paste previously copied declaration
{enter} - next line
{{} - enter a {
{enter} - next line
{}} - enter a }
{enter} - next line


Title: Re: Make member function
Post by: David Perfors on June 04, 2007, 02:44:07 pm
wow, that is even easier :) But I must admit that I didn't read good enough. I though: 1 click and all the methods of a class are created :)
Title: Re: Make member function
Post by: wxLearner on June 04, 2007, 05:55:59 pm
I though: 1 click and all the methods of a class are created :)
It's already possible, but actually it needs more than 1 click: right click, select "Insert => All class methods without implementation...".
Title: Re: Make member function
Post by: David Perfors on June 04, 2007, 07:49:33 pm
 :shock: how could I miss that option? incredible!
Title: Re: Make member function
Post by: killerbot on June 04, 2007, 07:55:01 pm
:shock: how could I miss that option? incredible!

cool, didn't know that one either
Title: Re: Make member function
Post by: MortenMacFly on June 12, 2007, 11:09:19 am
:shock: how could I miss that option? incredible!
cool, didn't know that one either
Me not, too... have to check SVN blame who actually was that hero... ;-) :lol:

Edit: I knew it... ;-)

[attachment deleted by admin]