home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-05-29 | 34.4 KB | 1,151 lines |
- {*******************************MULTI-EDIT MACRO******************************
- Name: MEHELP
-
- Description: The Multi-Edit Help system
-
- Parameters:
- /X=n X coordinate
- /Y=n Y coordinate
- /W=n Width
- /L=n Length
- /T=str Title
- /F=n Filename
- /LK=n Index
- /CX=1 Enables file/extension context sensitivity.
- /TO=n Top offset (number of lines from top of chapter to start
- displaying).
-
- (C) Copyright 1989-1990 by American Cybernetics, Inc.
- ******************************************************************************}
- $macro mehelp FROM ALL;
- def_str( tstr[100], tstr2[100], cur_file[80], event_str[20], help_path[80] );
- def_str( extfil[100], extlnk[80], fname[80], hstr[100]); { ldh }
- def_int( old_sb, jx, jy, jz, x, y, w, l, tbc, tx, ty, h_v_color,
- trefresh, done, event_count, cl, need_new_bar, scroll_bar,
- trepeat, need_event_draw, old_x, old_y, min_y, max_y,
- tfkey_row, tstatus_row, file_help_mode, need_search_display,
- hlc_time
- );
-
- IF help_open THEN
- rm('MEERROR^MessageBox /B=1/T=UNABLE TO ACCESS HELP/M=Help system already in use.');
- goto total_exit;
- end;
- Set_Global_Int('MENU_LEVEL', Global_Int('MENU_LEVEL') + 1);
- trefresh := refresh;
- refresh := false;
- event_count := 0;
-
- file_help_mode := parse_int('/CX=', mparm_str );
- IF file_help_mode <> 0 THEN
-
- {<<<Added 03-22-90 ldh *************************************************ldh2*}
- Return_Str := Global_Str('@HELP_WORD@');
- RM('Get_Context');
- hstr := CAPS(Return_Str);
- {******************************************************************* Added>>>}
-
- fname := truncate_extension( File_name ) + '.HLP'; { ldh }
- RM('Find_Ext /EXT=.' + get_extension(file_name)); { ldh }
- extfil := Parse_Str('HLP=', Global_Str(Return_Str)); { ldh }
- jx := xpos('^', extfil, 1); { ldh }
- if jx <> 0 then { ldh }
- extlnk := str_del( extfil, 1, jx); { ldh }
- extfil := copy( extfil, 1, jx - 1 ); { ldh }
- end; { ldh }
- END;
-
- {Setup the help path}
- help_path := global_str('@HELP_PATH@');
- IF help_path = '' THEN
- IF (file_attr(me_path + 'HELP') and $10) <> 0 THEN
- help_path := me_path + 'HELP' + ';' + me_path;
- ELSE
- help_path := me_path;
- END;
- END;
- IF xpos('<', help_path, 1) THEN
- return_str := help_path;
- RM('XLATECMDLINE');
- help_path := return_str;
- END;
- set_global_str('@HELP_PATH@', help_path);
- tx := wherex;
- ty := wherey;
- trepeat := mou_repeat;
- tfkey_row := fkey_row;
- tstatus_row := status_row;
- mou_repeat := TRUE;
- need_search_display := FALSE;
-
- x := Parse_Int('/X=', mparm_str);
- y := Parse_Int('/Y=', mparm_str);
- w := Parse_Int('/W=', mparm_str);
- l := Parse_Int('/L=', mparm_str);
-
- event_str := '@EV' + Str(Global_Int( 'MENU_LEVEL' )) + '#';
-
- min_y := 1 + (status_row = 1);
- max_y := screen_length - (status_row = screen_length);
- fkey_row := screen_length - (status_row = screen_length);
-
- IF x = 0 THEN
- x := 1;
- END;
- IF y = 0 THEN
- y := min_y;
- END;
- IF w = 0 THEN
- w := Screen_width - x;
- END;
- IF l = 0 THEN
- l := max_y - y - 1;
- END;
- IF (y + l) > (max_y - 2) THEN
- y := max_y - l - 1;
- END;
- IF (x + w) > (screen_width) THEN
- x := screen_width - w - 2;
- END;
-
- {Experimental mods to get max lines: very quick and dirty
- l := L + 3;
- --Y;
- FKey_row := 0;
- Status_row := 0;
- }
- h_v_color := ((h_b_color and $07) shl 4) + (h_b_color shr 4);
- tbc := box_count;
- tstr := parse_str('/T=', mparm_str);
- IF tstr = '' THEN
- tstr := 'HELP';
- END;
-
- {Experimental mods to get max lines
- put_box( x,y,x + w,y + l, 0, h_b_color, tstr , false );
- Write('─', x + 31,y,0, h_b_color);
- }
-
- put_box( x,y,x + w + 2,y + l + 1, 0, h_b_color, tstr , true );
-
- push_labels;
- flabel( 'Contns',2, - 1);
- flabel( 'Index',3, - 1);
- flabel( 'Paste',4, -1);
- flabel( 'Search',6, - 1);
- flabel( 'LdFile',7, - 1); { ldh }
-
- IF file_help_mode THEN
- flabel( 'FilHlp',8, - 1); { ldh }
- flabel( 'ExtHlp',9, - 1); { ldh }
- END;
- flabel( 'MEHlp ',10, - 1); { ldh }
- flabel( 'NxtSrc',26, - 1);
- flabel( 'SrcFil',36, - 1);
-
- help_start;
- help_size_window( x, y, x + w, y + l );
-
- tstr := parse_str('/LK=', mparm_str);
- if xpos('^', tstr, 1) = 0 then
- tstr2 := parse_str('/F=', mparm_str);
- if (file_help_mode) and (tstr2 = '') and (tstr = '') then { ldh }
- call file_hlp; { ldh }
- goto Do_Help; { ldh }
- else { ldh }
- call open_file2;
- IF error_level <> 0 THEN
- RM( 'MEERROR' );
- goto exit;
- END;
- end; { ldh }
- end;
- if tstr = '' then
- tstr := '*';
- end;
- call select_link2;
- help_current_offset := parse_int('/TO=', mparm_str );
-
- Do_Help:
-
- done := false;
- Set_Global_Str(event_str + '1',
- '/T=Done/KC=<ESC>/W=9/K1=27/K2=1/R=0');
- Set_Global_Str(event_str + '2',
- '/T=Back-track/KC=<BackSpace>/W=21/K1=08/K2=14/R=1');
- event_count := 2;
- RM('CheckEvents /M=4/G=' + event_str + '/#=' + str(event_count) +
- '/X=' + str( x ) + '/Y=' + str( y + l ) + '/W=' + str( w ));
-
- Need_Event_Draw := TRUE;
-
- loop:
- Set_Virtual_Display;
- IF need_search_display THEN
- need_search_display := FALSE;
- help_display_search;
- ELSE
- help_update;
- help_hi_link;
- END;
- if need_event_draw THEN
- call draw_events;
- end;
- call vertical_scroll_bar;
- Update_Virtual_Display;
- Reset_Virtual_Display;
- IF error_level <> 0 THEN
- jx := error_level;
- run_macro('MEERROR');
- error_level := 0;
- if jx = 8001 then
- call help_pop_pos;
- IF error_level <> 0 THEN
- RM('MEERROR');
- done := TRUE;
- goto exit;
- END;
- help_update;
- help_hi_link;
- end;
- END;
- update_status_line;
- while check_key = 0 DO
- old_x := mou_last_x;
- old_y := mou_last_y;
- Mou_Check_Status;
- IF ((old_x <> mou_last_x) or (old_y <> mou_last_y)) THEN
- call check_links;
- END;
- end;
-
- help_lo_link;
- IF key1 = 0 THEN
- IF key2 = 72 THEN
- help_up;
- ELSIF key2 = 80 THEN
- help_down;
- ELSIF key2 = 77 THEN
- help_right;
- ELSIF key2 = 75 THEN
- help_left;
- ELSIF key2 = 71 THEN
- help_home;
- ELSIF key2 = 79 THEN
- help_end;
- ELSIF key2 = 116 THEN
- help_scroll_right;
- ELSIF key2 = 115 THEN
- help_scroll_left;
- ELSIF key2 = 141 THEN
- help_scroll_up;
- ELSIF key2 = 145 THEN
- help_scroll_down;
- ELSIF key2 = 81 THEN
- help_pgdn;
- ELSIF key2 = 73 THEN
- help_pgup;
- ELSIF key2 = 73 THEN
- help_pgup;
- ELSIF key2 = 59 THEN
- call help_push_pos; { ldh }
- tstr := 'ACI_HYPE^*';
- call select_link2;
- ELSIF key2 = 60 THEN
- call help_push_pos; { ldh }
- tstr := '*';
- call select_link2;
- help_update;
- if error_level <> 0 THEN
- call help_pop_pos;
- tstr := 'ME^*';
- call select_link2;
- END;
- ELSIF key2 = 61 THEN
- call help_push_pos; { ldh }
- tstr := 'INDEX';
- call select_link2;
- help_update;
- if error_level <> 0 THEN
- call help_pop_pos;
- tstr := 'ME^INDEX';
- call select_link2;
- END;
- ELSIF key2 = 62 THEN {paste}
- write( ' MARKING ', working_col, status_row, 0, working_color );
- RM('ScreenMrk');
- update_status_line;
- ELSIF key2 = 64 THEN
- jx := 0;
- call prompt_and_search;
- ELSIF key2 = 65 THEN { ldh }
- tstr := parse_str('/#=', global_str('FILE_HISTORY')); { ldh }
- if tstr = '' then { ldh }
- tstr := cur_file; { ldh }
- else { ldh }
- tstr := global_str('FILE_HISTORY' + tstr); { ldh }
- end; { ldh }
- QAgain: { ldh }
- return_str := tstr; { ldh }
- Run_Macro('userin^QUERYBOX /HISTORY=FILE_HISTORY/C=3/W=60' + { ldh }
- '/ML=80/T=HELP FILENAME TO LOAD/F2=Dir /L=2'); { ldh }
- if Return_Int = -1 then { ldh }
- if (caps(return_str) = '?NO-FILE?') or { ldh }
- (return_str = tstr) then { ldh }
- return_str := '*.hl?'; { ldh }
- elsif copy(return_str,length(return_str),1) <> '*' then { ldh }
- return_str := return_str + '*'; { ldh }
- end; { ldh }
- Run_Macro('DIRSHELL /S=2/X=3/Y=' + str(2) + { ldh }
- '/W=62/L=100/D=' + return_str); { ldh }
- If Return_Str <> '' THEN { ldh }
- Tstr := Return_Str; { ldh }
- end; { ldh }
- Goto QAgain; { ldh }
- end; { ldh }
- if return_int then { ldh }
- tstr := Caps(Return_Str); { ldh }
- if get_extension(tstr) = '' then { ldh }
- tstr := tstr + '.HLP^*'; { ldh }
- else { ldh }
- tstr := tstr + '^*'; { ldh }
- end; { ldh }
- call help_push_pos; { ldh }
- call select_link2; { ldh }
- end; { ldh }
- ELSIF key2 = 66 THEN { ldh }
- IF file_help_mode THEN
- call help_push_pos; { ldh }
- call file_hlp; { ldh }
- END;
- ELSIF key2 = 67 THEN { ldh }
- IF file_help_mode THEN
- call help_push_pos; { ldh }
- call file_ext_help; { ldh }
- END;
- ELSIF key2 = 68 THEN { ldh }
- call help_push_pos; { ldh }
- tstr := 'ME^*'; { ldh }
- call select_link2; { ldh }
- ELSIF key2 = 99 THEN
- help_repeat_search;
- need_new_bar := TRUE;
- IF error_level = 0 THEN
- need_search_display := TRUE;
- ELSE
- RM('MEERROR^MessageBox /M=No more occurrences found.');
- error_level := 0;
- END;
- ELSIF key2 = 109 THEN
- jx := 1;
- call prompt_and_search;
- ELSIF key2 = 250 THEN
- call check_mouse_pos;
- END;
- ELSIF key1 = 08 THEN
- call help_pop_pos;
- ELSIF key1 = 27 THEN
- done := TRUE;
- ELSIF key1 = 13 THEN
- call select_link;
- ELSE
- jx := help_current_link;
- help_find_index( caps(char(key1)) );
- IF error_level = 8012 THEN
- error_level := 0;
- ELSE
- if help_current_link = jx THEN
- call select_link;
- end;
- END;
- END;
- IF done THEN
- goto exit;
- END;
-
- IF error_level <> 0 THEN
- run_macro('MEERROR');
- error_level := 0;
- END;
-
- goto loop;
-
- file_hlp: { ldh }
- tstr2 := fname; { ldh }
- call open_file2; { ldh }
- if error_level <> 0 then { ldh }
- error_level := 0; { ldh }
- call file_ext_help; { ldh }
- else { ldh }
- tstr := hstr; { ldh }
- call select_link2; { ldh }
- help_update; { ldh }
- if error_level <> 0 then { ldh }
- error_level := 0; { ldh }
- tstr := '*'; { ldh }
- call select_link2; { ldh }
- help_update; { ldh }
- if error_level <> 0 then { ldh }
- error_level := 0; { ldh }
- call file_ext_help; { ldh }
- end; { ldh }
- end; { ldh }
- end; { ldh }
- ret; { ldh }
-
- file_ext_help: { ldh }
- if extfil = '' then { ldh }
- tstr := 'ME^*'; { ldh }
- else { ldh }
- tstr2 := extfil; { ldh }
- call open_file2; { ldh }
- if error_level <> 0 then { ldh }
- error_level := 0; { ldh }
- tstr := 'ME^*'; { ldh }
- else { ldh }
- tstr := extlnk + hstr; { ldh }
- end; { ldh }
- end; { ldh }
- call select_link2; { ldh }
- help_update; { ldh }
- if error_level <> 0 then { ldh }
- error_level := 0; { ldh }
- tstr := '*'; { ldh }
- call select_link2; { ldh }
- help_update; { ldh }
- if error_level <> 0 then { ldh }
- error_level := 0; { ldh }
- call help_pop_pos; { ldh }
- tstr := 'ME^*'; { ldh }
- call select_link2; { ldh }
- end; { ldh }
- end; { ldh }
- ret; { ldh }
-
- prompt_and_search:
- return_str := '';
- RM('USERIN^USERSTR /W=60/BL=INPUT SEARCH STR/B=1');
- IF return_int THEN
- jy := help_current_link;
- working;
- help_search(return_str, jx);
- need_new_bar := TRUE;
- IF error_level = 0 THEN
- need_search_display := TRUE;
- ELSE
- RM('MEERROR^MessageBox /M=Search string"' + return_str + '" not found.');
- help_current_link := jy;
- error_level := 0;
- END;
- END;
- RET;
-
- select_link:
- IF help_link_count > 0 THEN
- working;
- call help_push_pos;
- tstr := help_link( help_current_link );
- select_link2:
- jx := xpos('^', tstr, 1);
- IF jx <> 0 THEN
- tstr2 := copy( tstr, 1, jx - 1 );
- tstr := str_del( tstr, 1, jx );
- call open_file2;
- IF error_level <> 0 THEN
- run_macro('MEERROR');
- error_level := 0;
- call help_pop_pos;
- ret;
- END;
- END;
- IF str_char(tstr,1) = '<' THEN
- tstr := str_del( tstr, 1, 1 );
- save_box( 1, 1, screen_width, screen_length );
- shell_to_dos( tstr, true );
- restore_box;
- ELSIF str_char( tstr, 1 ) = '>' THEN
- tstr := str_del( tstr, 1, 1 );
- RM( tstr );
- ELSE
- jx := xpos( '%', tstr, 1 );
- IF jx <> 0 THEN
- if JX > 1 THEN
- help_select( copy(tstr,1,jx - 1) );
- END;
- IF error_level = 0 THEN
- help_search( copy(tstr,jx + 1, 255 ), 0);
- IF error_level = 0 THEN
- need_search_display := TRUE;
- ELSE
- RM('MEERROR^MessageBox /B=1/M=Search string "' + copy(tstr,jx + 1, 255 ) + '" not found.');
- error_level := 0;
- END;
- END;
- ELSE
- help_select( tstr );
- END;
- END;
- need_new_bar := TRUE;
- end;
- ret;
-
- help_pop_pos:
- jx := global_int('@HSTACK' );
- IF jx > 0 THEN
- working;
- tstr2 := parse_str('/F=',global_str('@HSTACK' + str(jx) ));
- if tstr2 <> cur_file THEN
- call open_file2;
- END;
- tstr := global_str('@HSTACK' + str(jx) );
- help_select( parse_str('/C=', tstr ));
- help_current_offset := parse_int('/O=', tstr );
- help_current_link := parse_int('/L=', tstr );
-
- set_global_str('@HSTACK' + str(jx), '' );
- --jx;
- set_global_int('@HSTACK', jx );
- need_new_bar := TRUE;
- else { ldh1 }
- tstr2 := 'ME.HLP'; { ldh2 }
- call open_file2; { ldh2 }
- IF error_level <> 0 THEN { ldh2 }
- RM( 'MEERROR' ); { ldh2 }
- goto exit; { ldh2 }
- END; { ldh2 }
- tstr := '*'; { ldh2 }
- call select_link2; { ldh1 }
- END;
- ret;
-
- set_pos:
- return_str := help_current_chapter;
- call double_slash;
- return_str := '/F=' + cur_file +
- '/O=' + str(help_current_offset) +
- '/C=' + return_str +
- '/L=' + str(help_current_link);
- ret;
-
- help_push_pos:
- jx := global_int('@HSTACK' );
- call set_pos;
-
- IF return_str <> Global_Str( '@HSTACK' + str(jx))THEN
- IF jx > 20 THEN
- return_int := 1;
- RM('USERIN^DELETEITEM /G=@HSTACK/#=' + str( jx ));
- ELSE
- ++jx;
- END;
- Set_Global_Str('@HSTACK' + str(jx), return_str);
- set_global_int('@HSTACK', jx );
- END;
- ret;
-
- open_file:
- call help_push_pos;
- open_file2:
- working;
- need_new_bar := TRUE;
- cur_file := tstr2;
- if cur_file = '' THEN
- cur_file := 'ME.HLP';
- END;
-
- {Check for compressed file}
- tstr2 := get_extension( cur_file );
- cur_file := truncate_extension( cur_file );
-
-
- IF (tstr2 = 'HLP') OR (tstr2 = '') THEN
- Return_Str := Get_Path(cur_file); { ldh1 }
- if Return_Str = '' then { ldh1 }
- return_str := help_path;
- { end; { ldh3} }
- RM('PATHSEARCH /F=' + Truncate_Path(cur_file) + '.HL?'); { ldh1 }
- elsif file_exists(cur_file + '.HL?') then { ldh3 }
- Return_Int := TRUE; { ldh3 }
- Return_Str := fexpand(cur_file + '.HL?'); { ldh3 }
- else; { ldh3 }
- Return_Int := FALSE; { ldh3 }
- end; { ldh3 }
- IF return_int THEN
- cur_file := truncate_extension( return_str );
- { IF (first_file( cur_file + '.HLC' ) = 0) THEN
- hlc_time := Last_File_Time;
- tstr2 := 'HLC';
- IF (first_file( cur_file + '.HLP' ) = 0) THEN
- IF last_file_time > hlc_time THEN
- tstr2 := 'HLP';
- END;
- END;
- cur_file := fexpand( cur_file + '.' + tstr2 );
- goto hlc_found; }
- IF (first_file( cur_file + '.HLX' ) = 0) THEN
- hlc_time := Last_File_Time;
- tstr2 := 'HLX';
- IF (first_file( cur_file + '.HLP' ) = 0) THEN
- IF last_file_time > hlc_time THEN
- tstr2 := 'HLP';
- END;
- END;
- cur_file := fexpand( cur_file + '.' + tstr2 );
- goto hlc_found;
- ELSE
- IF file_exists( cur_file + '.HLP' ) THEN
- cur_file := cur_file + '.HLP';
- goto hlc_found;
- END;
- END;
- END;
- error_level := 8002; { ldh1 }
- ret;
- END;
-
- cur_file := truncate_extension( cur_file ) + '.' + tstr2;
- Return_Str := Get_Path(cur_file); { ldh1 }
- if Return_Str = '' then { ldh1 }
- return_str := help_path;
- end; { ldh1 }
- RM('PATHSEARCH /F=' + Truncate_Path(cur_file)); { ldh1 }
- IF return_int THEN
- cur_file := return_str;
- goto do_open;
- END;
- error_level := 8002; { ldh1 }
- ret;
-
- hlc_found:
-
- do_open:
- help_open_file( cur_file );
- call draw_top_name;
- ret;
-
- check_mouse_pos:
- IF (Mou_Last_Y = Fkey_Row) THEN
- RM( 'MOUSE^MouseFkey' );
- ELSE
- IF (Mou_Last_X < x) OR (Mou_Last_Y < y) OR (Mou_Last_X > (x + w)) OR
- (Mou_Last_Y > (y + l)) THEN
- ret;
- END;
- IF (Mou_Last_X = (x + w)) THEN
- IF (scroll_bar) THEN
- IF (Mou_Last_Y = (y + 1)) THEN
- help_scroll_up;
- ELSIF (Mou_Last_Y = (y + l - 1)) THEN
- help_scroll_down;
- { ELSIF (Mou_Last_Y > (y + 1 )) AND (Mou_Last_Y < (y + l - 1)) THEN
- IF (Mou_Last_Y = (y + l - 2)) THEN
- jx := help_chapter_length - (l - 1);
- ELSE
- jx := ((((help_chapter_length - (l - 1)) * 1000) / (l - 3)) * (Mou_Last_Y - Y - 2)) / 1000;
- END;
- IF (help_current_offset + (l - 1)) > help_chapter_length THEN
- jx := help_chapter_length - (l - 1);
- END;
- help_select( help_current_chapter );
- help_current_offset := jx;
- END;
- }
- ELSIF (Mou_Last_Y > ( y + 2 + old_sb)) THEN
- help_pgdn;
- ELSIF (Mou_Last_Y < ( y + 2 + old_sb)) THEN
- help_pgup;
- ELSIF (Mou_Last_Y = ( y + 2 + old_sb)) THEN
- Mou_Set_Limits(x + w,y + 2,x + w, y + l - 2);
- old_y := mou_last_y;
- du3:
- Mou_Check_Status;
- IF ((Mou_Last_Status AND 1) <> 0) THEN
- IF old_y <> mou_last_y THEN
- old_y := mou_last_y;
- IF (y + 2 + old_sb) <> mou_last_y THEN
- IF (Mou_Last_Y = (y + l - 2)) THEN
- jx := help_chapter_length - (l - 1);
- ELSE
- jx := ((((help_chapter_length - (l - 1)) * 1000) / (l - 3)) * (Mou_Last_Y - Y - 2)) / 1000;
- END;
- IF (help_current_offset + (l - 1)) > help_chapter_length THEN
- jx := help_chapter_length - (l - 1);
- END;
- help_select( help_current_chapter );
- help_current_offset := jx;
- help_update;
- call vertical_scroll_bar;
- END;
- END;
- goto du3;
- END;
- Mou_Set_Limits(1,1,screen_width, screen_length);
-
- END;
- END;
- ELSE
- call check_links;
- if return_int then
- call select_link;
- end;
- RM('CheckEvents /M=1/G=' + event_str + '/#=' + str(event_count));
- IF return_int <> 0 THEN
- return_int := parse_int('/R=', return_str );
- IF return_int = 0 THEN
- done := TRUE;
- ELSIF return_int = 1 THEN
- call help_pop_pos;
- END;
- need_event_draw := TRUE;
- END;
- END;
- END;
- ret;
-
- {see if the mouse cursor is on a link}
- check_links:
- return_int := 0;
- jx := 0;
- while jx < help_link_count do
- ++jx;
- jy := help_link_x(jx);
- IF (Mou_Last_Y = help_link_y(jx)) AND
- (Mou_Last_X >= jy) AND
- (Mou_Last_X < (jy + help_link_w(jx))) THEN
- IF jx <> help_current_link THEN
- help_lo_link;
- help_current_link := jx;
- end;
- help_hi_link;
- return_int := 1;
- jx := help_link_count;
- END;
- end;
- ret;
-
- def_int( dt1 );
- draw_top_name:
- tstr2 := cur_file;
- dt1 := (( w / 2 ) - (svl(tstr2) / 2));
- IF dt1 < 0 THEN
- tstr2 := truncate_path(tstr2);
- dt1 := (( w / 2 ) - (svl(tstr2) / 2));
- END;
- IF dt1 > 0 THEN
- draw_char( 196, x + 1, y, h_b_color, dt1 );
- END;
- write( tstr2, x + dt1 + 1, y, 0, h_b_color );
- IF dt1 > 1 THEN
- draw_char( 196, x + dt1 + svl(tstr2) + 1, y, h_b_color, dt1 - 1 );
- END;
- ret;
-
- draw_events:
- RM('WMENU^CheckEvents /M=2/G=' + event_str + '/#=' + str(event_count));
- need_event_draw := FALSE;
- ret;
-
-
- Vertical_Scroll_Bar:
- IF need_new_bar then
- call set_scroll_bar;
- END;
- IF scroll_bar THEN
- jz := l - 3;
-
- jx := ((help_current_offset + 1) / jy);
-
- jy := help_chapter_length - (l - 1);
- IF jy < 1 THEN
- jy := 1;
- END;
- cl := help_current_offset;
-
- jx := ((((jz * 1000) / jy) * (cl + 1)) / 1000);
-
- IF (cl = 0) THEN
- jx := 0;
- END;
- IF (jx = 0) AND (cl > 0) THEN
- ++jx;
- END;
- IF jx > (jz - 1) THEN
- jx := jz - 1;
- END;
- IF (jx = (jz - 1)) AND (cl < jy) THEN
- --jx;
- END;
- IF jx <> old_sb THEN
- IF (old_sb >= 0) THEN
- draw_char( 176, x + w, y + 2 + old_sb, h_b_color, 1 );
- END;
- draw_char( 178, x + w, y + 2 + jx, h_b_color, 1 );
- old_sb := jx;
- END;
- END;
- ret;
-
- set_scroll_bar:
- jy := 0;
- need_new_bar := 0;
- IF help_chapter_length < l THEN
- scroll_bar := false;
- While jy < (l - 1) DO
- ++jy;
- draw_char( 186, x + w, y + jy, h_b_color, 1 );
- END;
- ELSE
- scroll_bar := true;
- WHILE jy < (l - 2) DO
- ++jy;
- draw_char( 176, x + w, y + 1 + jy, h_b_color, 1 );
- END;
- draw_char( 24, x + w, y + 1, h_v_color, 1 );
- draw_char( 25, x + w, (y + l) - 1, h_v_color, 1 );
- old_sb := -1;
- END;
- ret;
-
- def_int( djx );
- double_slash:
- djx := 1;
- while djx > 0 DO
- djx := xpos( '/', return_str, djx );
- IF djx <> 0 THEN
- return_str := str_ins( '/', return_str, djx );
- ++djx;
- ++djx;
- END;
- END;
- ret;
-
-
- exit:
- call help_push_pos;
- IF help_open THEN
- help_done;
- END;
-
-
- WHILE box_count > tbc DO
- kill_box;
- END;
- pop_labels;
- gotoxy( tx, ty );
- mou_repeat := trepeat;
- fkey_row := tfkey_row;
- status_row := tstatus_row;
- refresh := trefresh;
- Set_Global_Int('MENU_LEVEL', Global_Int('MENU_LEVEL') - 1);
- RM('CheckEvents /M=3/G=' + event_str + '/#=' + str(event_count));
- total_exit:
- END_MACRO;
-
-
- {*******************************MULTI-EDIT MACRO******************************
-
- Name: ScreenMrk
-
- Description: Allows any part of the screen to be marked, and have
- that section of the screen copied to a buffer.
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
- $MACRO ScreenMrk;
- def_int( need_hi, oldx,oldy,x1, y1, xi, yi, xl, jx, yl, mouse_down, tmou_repeat );
- def_int( temp_fkey_row, temp_status_row, tr );
- oldx := wherex;
- oldy := wherey;
- tr := refresh;
- refresh := false;
- temp_fkey_row := fkey_row;
- fkey_row := 0;
- push_labels;
- temp_status_row := status_row;
- status_row := 0;
- need_hi := false;
- mouse_down := FALSE;
- tmou_repeat := mou_repeat;
- mou_repeat := FALSE;
- loop1:
- read_key;
- IF key1 = 0 THEN
- IF key2 = 250 THEN
- mouse_down := TRUE;
- gotoxy( mou_last_x, mou_last_y );
- goto start2;
- ELSE
- call arrow_keys;
- END;
- ELSIF key1 = 13 THEN
- goto start2;
- ELSIF key1 = 27 THEN
- goto exit;
- END;
- goto loop1;
-
- start2:
- x1 := wherex;
- y1 := wherey;
- save_box( 1, 1, screen_width, screen_length );
- call draw_highlight;
- loop2:
- IF check_key THEN
- IF key1 = 0 THEN
- IF key2 = 250 THEN
- gotoxy( mou_last_x, mou_last_y );
- call draw_highlight;
- goto accept;
- ELSE
- CALL arrow_keys;
- END;
- ELSIF key1 = 13 THEN
- goto accept;
- ELSIF key1 = 27 THEN
- goto exit2;
- END;
- ELSIF mouse_down THEN
- Mou_Check_Status;
- IF (Mou_Last_Status and 1) THEN
- IF (mou_last_x <> wherex) OR (mou_last_y <> wherey) THEN
- gotoxy( mou_last_x, mou_last_y);
- need_hi := TRUE;
- ELSE
- END;
- ELSE
- goto accept;
- END;
- END;
- if need_hi THEN
- call DRAW_HIGHLIGHT;
- END;
- goto loop2;
-
- accept:
- call DRAW_HIGHLIGHT;
- RM('USERIN^XMENU /L=Screen Paste/T=1/B=1/X' + str(xi) +
- '/Y=' + str(yi) +
- '/M=Copy text to buffer, erasing old contents()Append text to end of buffer()');
- IF (return_int < 1) THEN
- goto exit2;
- ELSE
- RM('ScreenCut /X1=' + str( xi ) + '/X2=' + str( xi + xl - 1) +
- '/Y1=' + str(yi) + '/Y2=' + str(yl) + '/M=' + str( return_int = 2 ) );
- END;
-
- EXIT2:
- kill_box;
- GOTO EXIT;
-
- ARROW_KEYS:
- IF key2 = 72 THEN {up}
- IF wherey > 1 THEN
- gotoxy(wherex, wherey - 1);
- need_hi := TRUE;
- END;
- ELSIF key2 = 80 THEN {down}
- IF wherey < screen_length THEN
- gotoxy(wherex, wherey + 1);
- need_hi := TRUE;
- END;
- ELSIF key2 = 77 THEN {right}
- IF wherex < screen_width THEN
- gotoxy(wherex + 1, wherey);
- need_hi := TRUE;
- END;
- ELSIF key2 = 75 THEN {left}
- IF wherex > 1 THEN
- gotoxy(wherex - 1, wherey);
- need_hi := TRUE;
- END;
- END;
- RET;
-
- DRAW_HIGHLIGHT:
- need_hi := false;
- RESTORE_BOX;
- IF x1 > wherex THEN
- xi := wherex;
- xl := x1 - wherex + 1;
- ELSE
- xi := x1;
- xl := wherex - x1 + 1;
- END;
- IF y1 > wherey THEN
- yi := wherey;
- yl := y1;
- ELSE
- yi := y1;
- yl := wherey;
- END;
- jx := yi;
- WHILE jx <= yl DO
- draw_attr( xi, jx, m_h_color, xl );
- ++jx;
- END;
- RET;
-
-
- EXIT:
- status_row := temp_status_row;
- fkey_row := temp_fkey_row;
- pop_labels;
- gotoxy(oldx, oldy);
- mou_repeat := tmou_repeat;
- refresh := tr;
- END_MACRO;
-
- $MACRO ScreenCut;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: ScreenCut
-
- Description:
-
- Parameters:
- /X1= the upper left hand column
- /Y1= the upper left hand row
- /X2= the lower right hand column
- /Y2= the lower right hand row
- /M=nn mode
- 0 = Copy block to buffer, overwriting old contents
- 1 = Append block to buffer
-
- (C) Copyright 1989 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int(tr, Active_Page, ox,x1,y1,x2,y2, old_win, tu);
- Def_Str(TStr, buf_name);
-
- tr := refresh;
- refresh := FALSE;
- tu := undo_stat;
- undo_stat := FALSE;
- old_win := window_id;
- buf_name := me_path + '!BUF' + User_Id + '.' + Str(0);
- if switch_file(buf_name) = 0 then
- switch_window(window_count);
- create_window;
- if error_level <> 0 then
- goto exit;
- end;
- window_attr := $81;
- file_name := buf_name;
- else
- window_attr := $81;
- IF parse_int('/M=', mparm_str) = 0 THEN
- Erase_Window;
- END;
- file_name := buf_name;
- eof;
- Goto_Col(1);
- IF NOT(at_Eof) THEN
- down;
- END;
- end;
-
- x1 := parse_int('/X1=', mparm_str);
- y1 := parse_int('/Y1=', mparm_str);
- x2 := parse_int('/X2=', mparm_str);
- y2 := parse_int('/Y2=', mparm_str);
-
- R_AX := $0F00;
- Intr($10);
- Active_Page := R_BX;
- ox := x1;
- WHILE (y1 <= y2) DO
- tstr := '';
- {Get the screen a line at a time}
- x1 := ox;
- WHILE (x1 <= x2) DO
- {Get the character at the cursor}
- GotoXY(x1,y1);
- R_AX := $0800;
- R_BX := Active_Page;
- Intr($10);
- TStr := TStr + Char(R_AX and $FF);
- ++x1;
- END;
- ++y1;
-
- put_line( tstr );
- down;
- END;
- tof;
- block_begin;
- eof;
- block_end;
- exit:
- switch_win_id( old_win );
- undo_stat := TU;
- refresh := TR;
- END_MACRO;
-
- $Macro Get_Context;
- {******************************************************************************
- Multi-Edit Macro
- 03-05-90 10:11am
-
- Macro : Get_Context
- Function: Return the word under the cursor defined by the passed Regular
- Expresson or the word marked by a column or stream block. The
- marked word will only be used if the cursor is on the same line
- as the marked word.
- Syntax : RM('Get_Context');
- Entry : Return_Str = Regular Expression defining context word.
- Default Regular Expression = '[A-Za-z0-9._]'.
- Exit : Return_Str = Context word under the cursor or marked block.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ***********************************************************************(ldh)**}
-
- Def_Str(tstr[100], tstr2[100]);
- Def_Int(org_refresh, org_reg, col);
-
- {Set up our context}
- org_refresh := REFRESH;
- REFRESH := FALSE; {No flashing of windows}
- org_reg := Reg_Exp_Stat;
- Reg_Exp_Stat := TRUE; {Regular expression search}
-
- Mark_Pos; {Save current column position}
-
- tstr := Return_Str; {Get Word Definition}
- if tstr = '' then
- tstr := '[A-Za-z0-9._]';
- end;
- tstr2 := Str_Ins('~', tstr, 2);
-
- if Marking then
- Block_End;
- end;
- if (Block_Stat > 1) And (Block_Line1 = C_Line) And (Block_Line2 = C_Line) Then
- Goto_Col(Block_Col1);
- col := Block_Col2 + 1;
- else
- Search_Bwd(tstr, 1);
- if Search_Bwd(tstr2, 1) = 0 then
- Goto_Col(1);
- end;
- Search_Fwd(tstr, 1);
- Mark_Pos;
- if Search_Fwd(tstr2, 1) = 0 then
- EOL;
- end;
- col := C_Col;
- Goto_Mark;
- end;
-
- {Grab the characters that make up this word}
- Return_Str := '';
- while (C_Col < col) do
- Return_Str := Return_Str + Cur_Char;
- right;
- end;
-
- {Restore original cursor position}
- Goto_Mark;
-
- REFRESH := org_refresh;
- Reg_Exp_Stat := org_reg;
-
- End_Macro; {Get_Context}