News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Collapsible Code Blocks

Started by basurapr, March 04, 2007, 06:54:45 PM

Previous topic - Next topic

basurapr

It will be a nice feature in the codeblocks editor to have collapsible blocks of code, like in visual studio or sharpdevelop.
For example:

#region Constructors and Destructors
//Code Here..
#endregion

#region Events
//Bunch of events..
#endregion

#region Layout
//Really long code..
#endregion

We will have a better organized code in terms of viewing, searching and editing. I don't know if the feature is already available, but I will like to help in it. if some one can point me to the right direction I will be glad of it.

MortenMacFly

Quote from: basurapr on March 04, 2007, 06:54:45 PM
#region Constructors and Destructors
//Code Here..
#endregion
You can do this pretty easy using #ifndefs like:

#ifndef REGION_LIVE_CYCLE
// Constructurs, Destructors...
#endif // REGION_LIVE_CYCLE

As long as you don't define "REGION_LIVE_CYCLE" (why would you?!) the code compiles fine but yu can collapse those regions easily.
For this purpose make sure you have enabled Settings->Editor->"Folding"->"Fold pre-processor commands".
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

eranif

Quote from: MortenMacFly on March 04, 2007, 09:59:10 PM
Quote from: basurapr on March 04, 2007, 06:54:45 PM
#region Constructors and Destructors
//Code Here..
#endregion
You can do this pretty easy using #ifndefs like:

#ifndef REGION_LIVE_CYCLE
// Constructurs, Destructors...
#endif // REGION_LIVE_CYCLE

As long as you don't define "REGION_LIVE_CYCLE" (why would you?!) the code compiles fine but yu can collapse those regions easily.
For this purpose make sure you have enabled Settings->Editor->"Folding"->"Fold pre-processor commands".
With regards, Morten.
Well, you could do it like Morten suggested, but there is a better way of doing it:

Scintilla (CodeBlocks editing component) offers users an easy way for inserting fold points in the code using the following symbols:
//{ -- as a block starter
//} -- as a block ender

HTH
Eran



jmccay

Quote from: eranif on March 04, 2007, 11:43:30 PM
Well, you could do it like Morten suggested, but there is a better way of doing it:

Scintilla (CodeBlocks editing component) offers users an easy way for inserting fold points in the code using the following symbols:
//{ -- as a block starter
//} -- as a block ender

HTH
Eran

   I took the liberty of adding this to the wiki documentation: Wiki->Documentation->User Documentation->Miscellaneous.  I thought it would be handy to know.

jmccay
OS: WinXP, Win98 SE, & sometimes Linux

a little light reading from the wxWidgets 2.6.2 readme: A detailed 2000-page reference manual is supplied in HTML, PDF and Windows Help form: see the docs hierarchy.

basurapr

Hurray!,

Thanks guys, now i have a more searchable source code. Is nice to know that scintilla facilitate this task. :D

thanks a lot  :)

MortenMacFly

Quote from: eranif on March 04, 2007, 11:43:30 PM
//{ -- as a block starter
//} -- as a block ender
Wow! That's fantastic (I honestly didn't know about that :oops:). Thanks Eranif!!! :D
With regards, Morten.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]