SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Slick-C® Macro Programming => Topic started by: inventec on October 26, 2006, 02:44:57 am

Title: How to expand/collapse function with hotkey ?
Post by: inventec on October 26, 2006, 02:44:57 am
In c files, used by function heading/show all which in view menu, we can view or edit program simply .

Sometimes, I always double click the heading icon(+/-)  for processing one function only, because I don't know what is hotkey .

It's so trouble .

Somebody who knows it tell me how to do it, please !

Thank you !

Title: Re: How to expand/collapse function with hotkey ?
Post by: hs2 on October 26, 2006, 07:40:05 am
Bind a key to 'plusminus'.

HS2
Title: Re: How to expand/collapse function with hotkey ?
Post by: at5dapa1 on October 26, 2006, 09:27:04 am
Thanks HS2, indeed very useful to know this!
By the way, do you know if is possible to instruct SE, to open by default any file in "Selective Display" mode?
Title: Re: How to expand/collapse function with hotkey ?
Post by: Graeme on October 26, 2006, 10:11:45 am
Bind a key to 'plusminus'.

HS2

Wow.  You're a master of SlickEdit HS2!  :)

I hope the SE doc team is reading this thread coz plusminus doesn't appear in the help anywhere!

Graeme
Title: Re: How to expand/collapse function with hotkey ?
Post by: Wanderer on October 26, 2006, 01:05:58 pm
Thanks HS2, indeed very useful to know this!
By the way, do you know if is possible to instruct SE, to open by default any file in "Selective Display" mode?

I think you would have to write a hook macro (I think it would be in the form _buffer_add_xxxx, but I can't remember), and then call one of these functions:

all
allnot
hide_all_comments
hide_code_block
hide_selection
preprocess
selective_display  // probably don't want this one - it activates the GUI dialog
show_all
show_braces
show_col1
show_current_proc
show_indent
show_paragraphs
show_procs
show_selection
Title: Re: How to expand/collapse function with hotkey ?
Post by: alex on October 26, 2006, 01:13:19 pm
If you want to know more about writing hook functions, check out http://community.slickedit.com/index.php?topic=84.0

You might find, e.g.,  the _buffer_add hook useful.
Title: Re: How to expand/collapse function with hotkey ?
Post by: hs2 on October 26, 2006, 03:50:13 pm
Just a simple example to make life easier...
Code: [Select]
_switchbuf_selective_display(...)
{
   _str ext = get_extension(p_buf_name, false);
   switch ( ext )
   {
      case 'cpp':
      case 'c':
         show_procs ( );
         break;

      case 'h':
         hide_all_comments ( );
         break;

      default:
         break;
   }
}

Didn't check if _buffer_add_(selective_display) is also doing well.

HS2
Title: Re: How to expand/collapse function with hotkey ?
Post by: Graeme on October 26, 2006, 10:45:04 pm
Thanks HS2, indeed very useful to know this!
By the way, do you know if is possible to instruct SE, to open by default any file in "Selective Display" mode?


In case you didn't know, in Tools -> options -> general, if you enable the auto restore option of "selective display", slick will open a file with selective display active if that's what it had when it was closed.

Graeme
Title: Re: How to expand/collapse function with hotkey ?
Post by: inventec on October 27, 2006, 01:03:36 am
HS2,

So useful, thanks very much !



Title: Re: How to expand/collapse function with hotkey ?
Post by: cmb99 on January 18, 2007, 05:07:56 pm
I can't think of another editor where you have to double-click the plus sign to expand. Also, I am very new to slickedit. How do you put the slick-c macro into the hook for default folding?
Title: Re: How to expand/collapse function with hotkey ?
Post by: hs2 on January 18, 2007, 06:07:35 pm
If you just want to single click to expand/collapse... see the attached config screenshot.

HS2
Title: Re: How to expand/collapse function with hotkey ?
Post by: cappy2112 on January 18, 2007, 08:00:01 pm
Bind a key to 'plusminus'.

HS2

Ive tried calling plusminus from the slick cmd line- it doesn't toggle the + or - signs
What am I doing wrong?
Title: Re: How to expand/collapse function with hotkey ?
Post by: hs2 on January 18, 2007, 08:12:56 pm
1. 'Selective display' has to be activated first -> (+) and/or (-) signs visible on the left gutter
2. cursor sits on a line which is 'marked' with (+) or (-)

HS2
Title: Re: How to expand/collapse function with hotkey ?
Post by: cappy2112 on January 19, 2007, 01:52:49 am
1. 'Selective display' has to be activated first -> (+) and/or (-) signs visible on the left gutter
2. cursor sits on a line which is 'marked' with (+) or (-)

HS2

I've already applied Selective Display to a file, and was wondering if there is a way to fold/unfold all, as opposed to one at a time.
Title: Re: How to expand/collapse function with hotkey ?
Post by: hs2 on January 19, 2007, 12:26:16 pm
'show-all' on cmdline or 'View->Show All' ends selective display.

HS2
Title: Re: How to expand/collapse function with hotkey ?
Post by: Lee on January 19, 2007, 03:29:05 pm
Additionally from the command-line, there is a 'collapse-all' & 'expand-all' commands which collapse/expand all of the Selective Display marks for the file.