Author Topic: Make member function  (Read 5117 times)

noisy

  • Guest
Make member function
« 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

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: Make member function
« Reply #1 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.
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline Pecan

  • Plugin developer
  • Lives here!
  • ****
  • Posts: 2778
Re: Make member function
« Reply #2 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


« Last Edit: June 04, 2007, 02:52:45 pm by Pecan »

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: Make member function
« Reply #3 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 :)
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

wxLearner

  • Guest
Re: Make member function
« Reply #4 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...".

Offline David Perfors

  • Developer
  • Lives here!
  • *****
  • Posts: 560
Re: Make member function
« Reply #5 on: June 04, 2007, 07:49:33 pm »
 :shock: how could I miss that option? incredible!
OS: winXP
Compiler: mingw
IDE: Code::Blocks SVN WX: 2.8.4 Wish list: faster code completion, easier debugging, refactoring

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5493
Re: Make member function
« Reply #6 on: June 04, 2007, 07:55:01 pm »
:shock: how could I miss that option? incredible!

cool, didn't know that one either

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9694
Re: Make member function
« Reply #7 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]
« Last Edit: June 12, 2007, 11:31:33 am by MortenMacFly »
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ