Circuitous Logic

, , , , , Thursday, March 12, 2009

// (1) Get and set your margin settings at desired increments.
// Assign this macro to a key combination.
// Stick your favorite margin presets into the macro code.
// I like to use 1 80 1, 1 128 1, 1 256 1, 1 512 1 and 1 1024 1.

// The same "cycling" method can be used on almost any setting.
// For example, you can easily modify this macro to take a text
// selection and cycle the text through all caps, initial caps,
// all lower case, and so on.

// Currently the macro will automatically increment to the next
// setting each time the key combo is pressed (including the
// first press). If the margins are currently 1 256 1, executing
// the command will increment the setting to 1 512 1. If 512
// is not the setting you want, just press the key combo again
// to set your desired value.
//

// (2) Cycle through display modes: hex, line hex, normal edit.
//


_command cycle_right_margin() name_info(','VSARG2_REQUIRES_EDITORCTL, VSARG2_READ_ONLY)
{
parse p_margins with left_ma right_ma new_para_ma;
// message("Current margin settings "left_ma' 'right_ma' 'new_para_ma);
switch (right_ma) {
case 80:
p_margins=left_ma' '128' 'new_para_ma;
message('Margins 'p_margins);
break;
case 128:
p_margins=left_ma' '256' 'new_para_ma;
message('Margins 'p_margins);
break;
case 256:
p_margins=left_ma' '512' 'new_para_ma;
message('Margins 'p_margins);
break;
case 512:
p_margins=left_ma' '1024' 'new_para_ma;
message('Margins 'p_margins);
break;
case 1024:
p_margins=left_ma' '80' 'new_para_ma;
message('Margins 'p_margins);
break;
default:
p_margins=left_ma' '80' 'new_para_ma;
message('Margins 'p_margins);
break;
}
}


// (2) Cycle through display modes: hex, line hex, normal edit.
// From Thom Little & Associates, www.tlanet.net


#define TLA_DISPLAY_EDIT 0
#define TLA_DISPLAY_HEX 1
#define TLA_DISPLAY_LINE_HEX 2

_command void tlaViewCycle( ) name_info( ',' VSARG2_ICON | VSARG2_REQUIRES_MDI_EDITORCTL )
{
switch ( p_hex_mode )
{
case TLA_DISPLAY_EDIT :
p_hex_mode = TLA_DISPLAY_HEX ;
break ;
case TLA_DISPLAY_HEX :
p_hex_mode = TLA_DISPLAY_LINE_HEX ;
break ;
case TLA_DISPLAY_LINE_HEX :
p_hex_mode = TLA_DISPLAY_EDIT ;
break ;
default :
tlaError( "tlaViewCycle", "Unknown view state" );
break ;
}
return ;
}

0 comments:

Post a Comment

GlossyBlue Blogger by Black Quanta. Theme & Icons by N.Design Studio
Entries RSS Comments RSS