Showing posts with label hidden lines. Show all posts
Showing posts with label hidden lines. Show all posts

arg_show_lines (...)

, , , , , , , , , Sunday, February 22, 2009 0 comments

// command arg_show_lines(...)

// In a selective display, show a range of lines by line number
// The main goal here is to open a range of hidden lines to view.
// If the range contains already-displayed lines, they'll be
// displayed along with the newly displayed hidden lines
//
// Usage: arg_show_lines 352 396
//
// Note: if a line with a "minus bitmap" is displayed before
// executing this macro, the minus bitmap will be removed; this
// makes some sense because the macro is meant to remove all
// minus and plusbitmap lines as it unhides all lines in the
// selected range
//
_command void arg_show_lines(...) name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
parse arg(1) with first_line last_line // get line numbers from the
p_line=first_line; // command-line arguments
up();
if (p_line<=1) { // check the lineflags in the p_line=0; // range, get seldisp level new_level=0; } else { new_level=_lineflags()&LEVEL_LF; if (!up()) { new_level=_lineflags()&LEVEL_LF; down(); } } for (;;) { // go through all lines in the if (p_line>last_line) break; // specified range and bust
level=(_lineflags() & LEVEL_LF); // them out of hidden state
_lineflags(new_level,HIDDEN_LF|LEVEL_LF|PLUSBITMAP_LF|MINUSBITMAP_LF);
status=down();
if (status) {
break;
}
if (p_line>last_line) {
break;
}
}
p_line=last_line;
}

dh_Fileinfo

, , , , , , , , , , , , , , , , Monday, December 1, 2008 0 comments

The dh_fileinfo macro displays an informational dialog box with
various
details about the file currently being edited. I cobbled the macro
together from code available on the Slickedit Web site and elsewhere.
I've since forgotten where everything came from. This macro can be
greatly improved. You might notice, for example, that the value of some
of the variables, such as 'cc' (character count) are not yet included in the
message box.

I invite your improvements and suggestions, including ideas on stats to
add to the existing dialog.


The dh_fileinfo dialog lists:
  • fully qualified filename and path
  • file's current date and time
  • file size in bytes
  • file attributes
  • total number of lines in file
  • current margin setting
  • file's mode (e.g., Slick-C, HTML, C, etc.)
  • number of windows open in the editor
  • number of buffers open
  • number of the current View id
  • decimal and hex values of character under the cursor
// detailed fileinfo message box
_command dh_fileinfo() name_info(FILE_ARG'*,'READ_ONLY_ARG2)
{
_str filename=arg(1)
if (filename=='') {
filename=p_buf_name;
}
filename=absolute(filename);
_str filedate=file_date(filename);
_str filetime=file_time(filename);
_str fileattr=file_list_field(filename,DIR_ATTR_COL,DIR_ATTR_WIDTH);
int filelen=p_Noflines;
int bufcou=_Nofbuffers();
int wincou=Nofwindows();
get_view_id view_id
parse p_margins with left_ma right_ma new_para_ma;

// info on current character
get_line(line);
char=substr(line,p_col,1);
chr_num=_asc(get_text());

cc = 0; /* chars */
wc = 0; /* words */
lc = 0; /* lines */
dc = 0; /* displayed lines */
hc = 0; /* hidden lines */

int item = 0;
save_pos(p);
top_of_buffer();
for (;;) {
get_line line;
lc++;
for (i = 1; i < length(line); i++) {
cc++;
if (isalnum(substr(line,i,1))) {
item = 1;
} else if (item && !isalnum(substr(line,i,1))) {
wc++;
item = 0;
}
}
status=down();
bytesize = fsize();
dc = (p_Noflines - p_NofSelDispBitmaps);
hc = p_Nofhidden;
sc = p_NofSelDispBitmaps;
pc = ( filelen intdiv 55 );
_message_box(filename \r filedate' 'filetime \r bytesize ' bytes; ' fileattr \r\
'Lines: 'filelen' '\r\
'Margins: 'left_ma' 'right_ma' 'new_para_ma \r\
'Mode: 'p_mode_name \r 'Windows: 'wincou', Buffers: 'bufcou \r\
'Viewid 'view_id \r\
'Ascii char "'char'" dec='chr_num', hex='dec2hex(chr_num),' ':+
'FileInfo: '
p_buf_name, MB_ICONINFORMATION);

restore_pos(p);
break;
}
}

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