Author Topic: Adding a comment block  (Read 13960 times)

royalbox

  • Guest
Adding a comment block
« on: December 13, 2005, 02:36:20 pm »
Has anyone made a plugin that will add a comment block?
I keep checking the forums for this but I don't see any mention of one. It would be really useful if it were able to list the parameters of a function for example, so you could just add what the parameters are for. Is anyone working on something like this?

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Adding a comment block
« Reply #1 on: December 13, 2005, 04:11:15 pm »
Adding a macro like CB to the autotext feature will do this. :) You could also do something like CB for comment block, and FCB for function comment block if you like to use a different style with your function declarations. :)
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Adding a comment block
« Reply #2 on: December 13, 2005, 05:27:34 pm »
Has anyone made a plugin that will add a comment block?
There is basic comment block functionality using Ctrl-Shift-C/X built-in, but unluckily there is no such thing as filling in a function name or parameters. Writing such a plugin should not be too complicated though, so if you need that functionality, you can just go ahead. Yell out if you need information.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

royalbox

  • Guest
Re: Adding a comment block
« Reply #3 on: December 14, 2005, 01:52:31 pm »
@280Z28
I've been using code::blocks for a few months, yet I've not seen an autotext feature. Where is this please?

@thomas
Creating a plugin is beyond me at the moment I think. I downloaded the plugin sdk, took a quick look, and left it at that.

Thanks for your help.

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Adding a comment block
« Reply #4 on: December 14, 2005, 02:57:22 pm »
@280Z28
I've been using code::blocks for a few months, yet I've not seen an autotext feature. Where is this please?

Thanks for your help.

Settings -> Editor -> Auto-complete

Customize it, then learn to use it often and well; it is your good friend. I love it.
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Adding a comment block
« Reply #5 on: December 14, 2005, 04:14:55 pm »
I've been using code::blocks for a few months, yet I've not seen an autotext feature. Where is this please?
I think this doesn't do what you wanted.

Creating a plugin is beyond me at the moment I think. I downloaded the plugin sdk, took a quick look, and left it at that.
Well, if you have done that then you already have 75% :)
Note that you must always use the same libraries that were used to build Code::Blocks for plugins. So if you use RC2, the SDK is fine, but if you build your own Code::Blocks, use the libraries from there!

If you do not absolutely want fancy gimmicks, then you can probably do a basic version of what you want in less than 2 hours.
Use the plugin wizard, leave the type set to "tool", fill in your desired filenames etc. and hit "OK".
Then set your compiler and linker paths so the compiler/linker can find the headers and libaries. Try to compile.
If that goes well, open the source file and edit the function Execute().
Then you want to do:
Code
cbStyledTextCtrl* control = Manager::Get()->GetEditorManager()->GetBuiltinActiveEditor()->GetControl();
wxString text = control->GetSelectedText();
if(text.IsEmpty())
   return 0;

// do your string replacement magic here...

You will have to select that plugin from the plugins menu to run it, and it has no configuration or other fancy stuff, but hey, you have a start. You can always add better features later.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

royalbox

  • Guest
Re: Adding a comment block
« Reply #6 on: December 14, 2005, 06:33:19 pm »
@280Z28
Thanks a lot, I'll have a look into that it looks useful.

@thomas
Thanks very much for your help. I'm going to have a look into this a bit more -- maybe see if there's a plugin tutorial on the forum. I'm pretty new at c++ and I'm spending a lot of time reading and learning at the moment.

Thanks again.

Offline mandrav

  • Project Leader
  • Administrator
  • Lives here!
  • *****
  • Posts: 4315
    • Code::Blocks IDE
Re: Adding a comment block
« Reply #7 on: December 14, 2005, 06:47:52 pm »
Thanks very much for your help. I'm going to have a look into this a bit more -- maybe see if there's a plugin tutorial on the forum. I'm pretty new at c++ and I'm spending a lot of time reading and learning at the moment.

"Hello world" plugin tutorial
Be patient!
This bug will be fixed soon...

Offline rickg22

  • Lives here!
  • ****
  • Posts: 2283
Re: Adding a comment block
« Reply #8 on: December 14, 2005, 07:09:28 pm »
I'm starting to get the idea that the wiki should be restructured into something usable (having the articles split between "tutorials" and "articles" is confusing, we need to change that), and integrated with the webpage. i.e. linking the specific articles from the webpage to the wiki.

Offline 280Z28

  • Regular
  • ***
  • Posts: 397
  • *insert unicode here*
Re: Adding a comment block
« Reply #9 on: December 14, 2005, 07:21:09 pm »
I'm starting to get the idea that the wiki should be restructured into something usable (having the articles split between "tutorials" and "articles" is confusing, we need to change that), and integrated with the webpage. i.e. linking the specific articles from the webpage to the wiki.

I think that's a great idea. I feel that the normal routine of providing links to different sections of the wiki in a paragraph is very hard to use. For example, on this wiki, it's hard to figure out where you're supposed to go. If you want to get a list of people who have wrapped the API for languages other than C, you have to click general API reference on the home page and then notice and click "a separate page" in the first paragraph of that page. The layout of the API reference page makes that hard because visually your eyes tell you the start of the page is the table of contents, not the little section of text above it.

On my wiki pages here and here I tried to follow the text section with a clear list of links so it's easy to figure out which one you need to click to go where you want to go.

The wiki here is pretty good about that. The only thing that's hard is the links at the bottom don't have titles that make it clear what you will get if you click them. Instead of "Tutorials" it might be better to have "Building Code::Blocks from SVN" and other more specific entries.
« Last Edit: December 14, 2005, 07:23:24 pm by 280Z28 »
78 280Z, "a few bolt-ons" - 12.71@109.04
99 Trans Am, "Daily Driver" - 525rwhp/475rwtq
 Check out The Sam Zone :cool:

Offline Michael

  • Lives here!
  • ****
  • Posts: 1608
Re: Adding a comment block
« Reply #10 on: December 14, 2005, 07:37:07 pm »
I'm starting to get the idea that the wiki should be restructured into something usable (having the articles split between "tutorials" and "articles" is confusing, we need to change that), and integrated with the webpage. i.e. linking the specific articles from the webpage to the wiki.

What can help, would be to add the possibility for a user to expand/collapse the nodes of the "Table of contents". For example:

At the beginning I see:

Quote
Node A
Node B
Node C

To know what is inside Node A (e.g., Articles), I chose to expand the node in order to get the title of the available articles. For example as following:

Quote
Node A
  Node A1
  Node A2
  Node A3
Node B
Node C

This approach is similar to the one used by IE to handle XML. You can expand/collapse XML nodes, by pressing the small -/+ just before the node's name.

Michael