Author Topic: Idea  (Read 11430 times)

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Idea
« on: September 21, 2005, 05:56:58 am »
I thought of this tonight after writing out a big source file full of functions I would need to declare in a header. I've always wanted this but never thought of the idea to actually have it has a feature. What if you could right click in the editor window and choose an option to grab the function names from that file into some kind of a buffer in the program, so you could then paste them somewhere else.
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Idea
« Reply #1 on: September 21, 2005, 07:40:41 am »
Um, mind posting a more complete example? Maybe we can improve that idea...

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Idea
« Reply #2 on: September 21, 2005, 08:57:15 am »
Try this: right-click in the editor and select "Insert->Class method declaration/implementation"
Be patient!
This bug will be fixed soon...

Offline fiammy

  • Multiple posting newcomer
  • *
  • Posts: 46
    • Nebulagame
Re: Idea
« Reply #3 on: September 21, 2005, 09:59:52 am »
I think Vampyre_Dark means it the other way. You write the source file, and in a way you 'generate' the header file from your already written source. Correct me if I'm wrong

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: Idea
« Reply #4 on: September 21, 2005, 11:07:56 am »
Sorry. I'm stupid that way sometimes. I'm bad at getting my ideas across most of the time. :) Basically, say I just wrote a CPP file full of functions to deal with direct input. Now I need to declare these functions in my main header (or any header, whatever) I have to start copying and pasting function names and remembering to put the ';' at the end. It's easy, and a no brainer, but when I have a bunch of functions, I find it very boring and tedious.

So what if I could right click, and use the context menu to grab all the function names? Like this out of my input.cpp

Code: [Select]
//Input.cpp
void    InputAcquire(void);
bool    InputInit(HWND hWnd);
void    InputShutdown(void);
void    InputPoll(BYTE Keys[], int nSize, DIMOUSESTATE2 &Mouse);
vector3 CursorToVector(DIMOUSESTATE2 &Mouse);


Store it in a buffer, and then I can paste it where I need it.
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline grv575

  • Official tester
  • Regular
  • ***
  • Posts: 381
Re: Idea
« Reply #5 on: September 21, 2005, 04:26:52 pm »
If you're going to parse function definitions, could we also get some way to list all the functions in the current file to one of the output windows and make that clickable so that it jumps to a specific function (like the compiler errors/warnings window).  Ultraedit has a view->functions toolbar which is similar.  Make it easier to jump to function definitions (I guess you could just fold everything using the editor, but this might be better).

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Idea
« Reply #6 on: September 21, 2005, 06:21:37 pm »
If you're going to parse function definitions, could we also get some way to list all the functions in the current file to one of the output windows and make that clickable so that it jumps to a specific function (like the compiler errors/warnings window).  Ultraedit has a view->functions toolbar which is similar.  Make it easier to jump to function definitions (I guess you could just fold everything using the editor, but this might be better).


Have you tried "Search->Go to function" (Ctrl-Alt-G) ?
Be patient!
This bug will be fixed soon...

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: Idea
« Reply #7 on: September 21, 2005, 06:51:37 pm »
Have you tried "Search->Go to function" (Ctrl-Alt-G) ?

That's not the same. And it's no different than using page up / page down. The idea is to grab them all in one command, at the same time. If you have goto function, then this shouldn't be a problem?

do
{
    FunctionFind(NEXT_WHATEVER);
    FunctionAddToBuffer();
}while whatever
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Idea
« Reply #8 on: September 21, 2005, 06:56:52 pm »
Have you tried "Search->Go to function" (Ctrl-Alt-G) ?

That's not the same. And it's no different than using page up / page down. The idea is to grab them all in one command, at the same time. If you have goto function, then this shouldn't be a problem?

do
{
 FunctionFind(NEXT_WHATEVER);
 FunctionAddToBuffer();
}while whatever

I was replying to grv575, as seen from the quote I used...
Be patient!
This bug will be fixed soon...

Offline Vampyre_Dark

  • Regular
  • ***
  • Posts: 255
  • Hello!
    • Somewhere Over The Rainbow...
Re: Idea
« Reply #9 on: September 21, 2005, 07:32:47 pm »
I was replying to grv575, as seen from the quote I used...
   :oops: Can I hold the talking stick now?
C::B Wishlist
~BOYCOTT THE EVIL YELLOW BOXES~

Offline phlox81

  • Multiple posting newcomer
  • *
  • Posts: 53
    • phlox81.de
Re: Idea
« Reply #10 on: September 21, 2005, 08:08:28 pm »
Once you start which such a feature, you never find an end  :lol:
For a similiar problem i startet to write my own Code Generator a few years ago,
first only planned to add set/get functions, to day its almost
a complete Classwizard (C++, java and php4).

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Idea
« Reply #11 on: September 21, 2005, 08:21:57 pm »
Once you start which such a feature, you never find an end :lol:
For a similiar problem i startet to write my own Code Generator a few years ago,
first only planned to add set/get functions, to day its almost
a complete Classwizard (C++, java and php4).

This sounds as a nice base for a plugin ;)
Be patient!
This bug will be fixed soon...

Offline orefa

  • Multiple posting newcomer
  • *
  • Posts: 102
Re: Idea
« Reply #12 on: September 21, 2005, 08:40:25 pm »
Usually I copy the implementation file and then delete the function bodies to produce the header. The task is similar to folding the body of the code for each function, only it deletes it completely. I don't know how folding is implemented or if it would lend itself to an adaptation of this kind.

A pattern-matching approach could be to search for a '{' and its matching '}' to delete all that and replace it with a semi-colon. It leaves a bit of redundant data to clean up, but a good part of the work is done.

And yes, this looks like a plug-in candidate.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4291
    • Code::Blocks IDE
Re: Idea
« Reply #13 on: September 21, 2005, 09:01:50 pm »
The code to get a list of functions in the current file, is already there (Ctrl-Alt-G uses it). It's just a matter of making it an option...
Please submit a feature request for it, or I 'll probably forget it. We 're currently busy preparing RC2.
Be patient!
This bug will be fixed soon...

Offline phlox81

  • Multiple posting newcomer
  • *
  • Posts: 53
    • phlox81.de
Re: Idea
« Reply #14 on: September 21, 2005, 09:14:18 pm »
Once you start which such a feature, you never find an end :lol:
For a similiar problem i startet to write my own Code Generator a few years ago,
first only planned to add set/get functions, to day its almost
a complete Classwizard (C++, java and php4).

This sounds as a nice base for a plugin ;)

If I had the time for it %)