Topic: keystroke macros for switching windows (1 of 2), Read 37 times
Conf: VEDIT Macro Library
From: Bernd Richert
Date: Sunday, January 09, 2005 09:20 AM

I would like to introduce some keystroke macros, which might be of interest for others too.

Problem case 1:
Although it might be useful to have many files open in an edit session, there are times, when you concentrate on maybe two or three of them only, and a quick method of switching among these focus files is desirable.
If you don't have such a quick window switch, you would probably do {Window, Switch}, look up the desired window id, enter that id, and finally press Return. - This is quite expensive compared to a single key press.

Problem case 2:
There are times, where you have many files open and you want to tile horizontally/vertically only very few of them.
If you don't have keystroke macros to support that, you would probably visit all files that you are not interested in, just for iconizing them, before you can finally do {Window, Tile Horizontally/Vertically}. - This is very tedious.

The approach to solve problems like these, is to provide keystroke macros that let you manage a circle of window id's. These id's can then be used for quickly switching inside the circle and for arranging windows.
The following macros where written for this purpose:

Ctrl-W A: Add the current window to the circle.
Ctrl-W R: Remove the current window from the circle.
Ctrl-W C: Clear the circle.

Ctrl-PgDn: If there are two or more windows in the circle, switch to the next one of them. If outside the circle, switch back into it. If there is no circle or just one window inside, just do {Window, Next window}
Ctrl-PgUp: If there are two or more windows in the circle, switch to the previous one of them. If outside the circle, switch back into it. If there is no circle or just one window inside, just do {Window, Previous window}
Ctrl-W H: If there are circle windows, tile them horizontally. If there are none, just do {Window, Tile Horizontally}
Ctrl-W V: If there are circle windows, tile them vertically. If there are none, just do {Window, Tile Vertically}
Ctrl-W F: (to complete the window related keystroke sequences) Establish non-zoomed, but full sized state for all windows.

One numeric variable is used, to hold up to four window id's. This is currently #14.

If you are interested, please find the macros below.

Regards
Bernd




----------------------------------------
Ctrl-W A [VISUAL EXIT]for(#103=0;#103!=4;#103++){#104=#14&0x7F;if(#104==0|#104==wn)break};#14=#14>>8|#104<<24}if(#104==0){#14=#14|wn}else{alert}rs(104,'Windows: ');repeat(4){#104=#14&0x7F;if(#104!=0){itoa(#104,103,LEFT)if(rsize(104)!=9){rs(104,',',APPEND)};rs(104,@103,APPEND)}#14=#14>>8|#104<<24}statm(@104)v

Ctrl-W C [VISUAL EXIT]#14=0;statm('Window circle cleared');v

Ctrl-W F [VISUAL EXIT]if(iszoomed){wz(CLEAR)}dov('\ME\VL');v

Ctrl-W H [VISUAL EXIT]if(#14==0){dov('\ME\WH')}else{#103=0;repeat(4){#104=#14&0x7F;#14=#14>>8|#104<<24;#103+=(#104!=0)}
if(iszoomed){wz(CLEAR)}dov('\ME\VL');#105=winh;#103=#105/#103;#106=0;repeat(4){#104=#14&0x7F;#14=#14>>8|#104<<24;if(#104!=0){winmove(#104,0,#106,winw,#103);#106+=#103;if(#106+2*#103>#105){#103=#105-#106}}}}v

Ctrl-W R [VISUAL EXIT]repeat(4){#104=#14&0x7F;if(#104==wn){#14=#14>>8;break}else{#14=#14>>8|#104<<24}}if(#14==0)
{statm('Window circle cleared')}else{repeat(4){#104=#14&0x7F;if(#104!=0){break}else{#14=#14>>8|#104<<24}}rs(104,'Windows: ');repeat(4){#104=#14&0x7F;if(#104!=0){itoa(#104,103,LEFT)if(rsize(104)!=9){rs(104,',',APPEND)};rs(104,@103,APPEND)}#14=#14>>8|#104<<24}statm(@104)}v

Ctrl-W V [VISUAL EXIT]if(#14==0){dov('\ME\WV')}else{#103=0;repeat(4){#104=#14&0x7F;#14=#14>>8|#104<<24;#103+=(#104!=0)}
if(iszoomed){wz(CLEAR)}dov('\ME\VL');#105=winw;#103=#105/#103;#106=0;repeat(4)#104=#14&0x7F;#14=#14>>8|#104<<24;if(#104!=0)
{winmove(#104,#106,0,#103,winh);#106+=#103;if(#106+2*#103>#105){#103=#105-#106}}}}v

Ctrl-PgUp [VISUAL EXIT]if((#14&0x7FFFFF00)==0){dov('\ME\WP')}else{for(#103=0;#103!=4;#103++){#104=#14&0x7F;#105=#14>>24;#14=#14<<8|#105;if(#104==wn){break}}while(#105==0){#105=#14>>24;#14=#14<<8|#105}ws(#105,ATTACH)}v

Ctrl-PgDn [VISUAL EXIT]if((#14&0x7FFFFF00)==0){dov('\ME\WN')}else{for(#103=0;#103!=4;#103++){#104=#14&0x7F;#14=#14>>8|#104<<24;if(#104==wn){break}}#104=#14&0x7F;while(#104==0){#14=#14>>8|#104<<24;#104=#14&0x7F}ws(#104,ATTACH)}v

 


Topic: keystroke macros for switching windows (2 of 2), Read 34 times, 1 File Attachment
Conf: VEDIT Macro Library
From: Christian Ziemski
Date: Tuesday, January 18, 2005 07:57 AM

On 1/9/2005 9:20:25 AM, Bernd Richert wrote:

>I would like to introduce some keystroke macros, which might be of interest for others too.
>[...] that let you manage a circle of window
>id's. These id's can then be used for quickly switching
>inside the circle and for arranging windows.
>
>Ctrl-W A: Add the current window to the circle.
>Ctrl-W R: Remove the current window from the circle.
>[...]


Bernd:

Those macros seem to be a good idea!
Today I would have needed such a feature and tried your macros.

Unfortunately they don't work. There are some typos in it (mainly missing curly braces).

I tried(!) to fix them (result are attached) and now it's a little better.
But Ctrl-PgUp still gives an error: INVALID REGISTER ws(#105,ATTACH)

And the tiled windows are not visible in the foreground (what I hoped).


I don't have the time to "disassemble" your macros to understand their inner workings.

Can you eventually publish the "long" (aka readable) version of those macros, perhaps including some comments?


And additionally it should be noted:

If your macros are added to the end of the VEDIT.KEY file
the following standard key assignments
Ctrl-W , Ctrl-PgUp, Ctrl-PgDn
have to be deleted from the VEDIT.KEY.


Christian

 
WIN-CIRC1.TXT (2KB)