!+ ! eag_windows.tpu !- procedure eve_set_mapping ! Enable main keyboard digits as mapping keys on_error endon_error if eag$x_map_on = 1 then message ('Mapping is already enabled'); return; endif; eag$x_map_on := 1; eag_defined_shift := 0; if ( eveplus_g_shift_key = ctrl_y_key ) then eag_shift_key := pf1; eveplus_key ( "eve_find(eve$x_target)", pf1, "Gold", "eag_shift_key" ); eag_users_shift_key := EVEPLUS_SET_SHIFT_KEY ( pf1 ); eag_defined_shift := 1; endif; eveplus_key ( 'eve_show_map', key_name('0',shift_key),"Show Map Window", 'eag$x_show_map'); eveplus_key ( 'eve_map_buffer("1")',key_name('1',shift_key),"Show Buffer #1", 'eag$x_map1'); eveplus_key ( 'eve_map_buffer("2")',key_name('2',shift_key),"Show Buffer #2", 'eag$x_map2'); eveplus_key ( 'eve_map_buffer("3")',key_name('3',shift_key),"Show Buffer #3", 'eag$x_map3'); eveplus_key ( 'eve_map_buffer("4")',key_name('4',shift_key),"Show Buffer #4", 'eag$x_map4'); eveplus_key ( 'eve_map_buffer("5")',key_name('5',shift_key),"Show Buffer #5", 'eag$x_map5'); eveplus_key ( 'eve_map_buffer("6")',key_name('6',shift_key),"Show Buffer #6", 'eag$x_map6'); eveplus_key ( 'eve_map_buffer("7")',key_name('7',shift_key),"Show Buffer #7", 'eag$x_map7'); eveplus_key ( 'eve_map_buffer("8")',key_name('8',shift_key),"Show Buffer #8", 'eag$x_map8'); eveplus_key ( 'eve_map_buffer("9")',key_name('9',shift_key),"Show Buffer #9", 'eag$x_map9'); endprocedure ! eve_set_mapping procedure eve_set_nomapping ! Disable main keyboard digits as mapping keys on_error endon_error if eag$x_map_on = 0 then message ("Mapping keys are already disabled"); return; endif; eag$x_map_on := 0; if ( eag_defined_shift = 1 ) then eag_users_shift_key := EVEPLUS_SET_SHIFT_KEY ( ctrl_y_key ); eag_defined_shift := 0; endif; eveplus_restore_key ( 'eag$x_show_map'); eveplus_restore_key ( 'eag$x_map1'); eveplus_restore_key ( 'eag$x_map2'); eveplus_restore_key ( 'eag$x_map3'); eveplus_restore_key ( 'eag$x_map4'); eveplus_restore_key ( 'eag$x_map5'); eveplus_restore_key ( 'eag$x_map6'); eveplus_restore_key ( 'eag$x_map7'); eveplus_restore_key ( 'eag$x_map8'); eveplus_restore_key ( 'eag$x_map9'); eag_show_window ( 0 ); message ('Mapping keys disabled.'); endprocedure ! eve_set_nomap procedure eve_set_eag_window_keys ! Enable extra window keys on_error endon_error if eag$x_windows_on = 1 then message ('EAG window keys are already enabled'); return; endif; eag$x_windows_on := 1; if eag$x_map_on = 0 then eve_set_mapping; else eag_defined_shift := 0; if ( eveplus_g_shift_key = ctrl_y_key ) then eag_shift_key := pf1; eveplus_key ( "eve_find(eve$x_target)", pf1, "Gold", "eag_shift_key" ); eag_users_shift_key := EVEPLUS_SET_SHIFT_KEY ( pf1 ); eag_defined_shift := 1; endif; endif; ! File Access eveplus_key ( "eve_write_file('')", key_name (enter, shift_key), "Write File", "eag$x_write_file_key" ); eveplus_key ( "eve_write_file(read_line('Name?'))", key_name (comma, shift_key), "Write New file", "eag$x_write_new_key" ); eveplus_key ( "eag_get_file", enter, "Get file", "eag$x_get_file_key" ); if expand_name ( 'eve_destroy_buffer', procedures ) <> eve$x_null then eveplus_key ("eve_destroy_buffer(get_info(current_buffer,'name'))", key_name ( del_key, shift_key ), "Opps!", "eag$x_opps_key" ); endif; ! Window Manipulation eveplus_key ( "eve_toggle_number_of_windows", key_name (kp3, shift_key), "Toggle # windows", "eag$x_toggle_win_key" ); eveplus_key ( "eve_other_window", kp3, "Other window", "eag$x_other_win_key" ); ! Message Window Access eveplus_key ( "eve_mess_up", key_name(up,shift_key), "Message Window UP", "eag$x_mess_up_key" ); eveplus_key ( "eve_mess_down", key_name(down,shift_key), "Message Window Down", "eag$x_mess_down_key" ); ! Horizontal scrolling eveplus_key ( "eag_shift(eag_shift_amount)", key_name (right,shift_key), "Shift right", "eag$x_shift_right_key" ); eveplus_key ("eag_shift(-eag_shift_amount)", key_name (left,shift_key), "Shift left", "eag$x_shift_left_key" ); endprocedure ! eve_set_eag_window_keys procedure eve_set_noeag_window_keys ! Disable extra window keys on_error endon_error if eag$x_windows_on = 0 then message ("EAG window keys are already disabled"); return; endif; eag$x_windows_on := 0; message ('EAG window keys disabled.'); eveplus_restore_key ("eag$x_write_file_key" ); eveplus_restore_key ("eag$x_write_new_key" ); eveplus_restore_key ("eag$x_get_file_key" ); if expand_name ( 'eve_destroy_buffer', procedures ) <> eve$x_null then eveplus_restore_key ( "eag$x_opps_key" ); endif; eveplus_restore_key ("eag$x_toggle_win_key" ); eveplus_restore_key ("eag$x_other_win_key" ); eveplus_restore_key ("eag$x_mess_up_key" ); eveplus_restore_key ("eag$x_mess_down_key" ); eveplus_restore_key ("eag$x_shift_right_key"); eveplus_restore_key ("eag$x_shift_right_key"); endprocedure procedure eve_show_map ! Show/update the map window, toggle LOCKING it ON if current_buffer = eag_map_buffer then if eag_map_lock = 0 then eag_map_lock := 1; message( "Map window is now set ON" ); else eag_map_lock := 0; message( "Map window is now set OFF" ); position ( eve$x_this_window ); endif; endif; eag_show_map; if get_info ( eag_map_window, 'type') = window then position ( eag_map_window ); endif; endprocedure; ! eve_show_map procedure eag_get_file ! Get a file and update the window map if current_window = eag_map_window then position ( eve$x_this_window ); endif; eve_get_file (''); if eag_map_lock = 1 then eag_show_map; endif; endprocedure; procedure eve_mess_up ! Scroll the message window up scroll(message_window,-1); endprocedure; ! eve_mess_up procedure eve_mess_down ! Scroll the message window down scroll(message_window,1); endprocedure; ! eve_mess_down procedure eag_shift ( amt ) ! Shift a window to the left or right LOCAL lmar, rmar, rn; lmar := get_info (current_window, 'shift_amount' ); if lmar + amt < 0 then message ("You're already at the left border of this buffer"); else lmar := lmar + amt; rmar := lmar + get_info (current_window, 'width' ); lmar := lmar + 1; ln := str(lmar); rn := str(rmar); message ( ln+'<---------------------->'+rn); shift (current_window,amt); endif; endprocedure; ! eag_shift procedure eve_toggle_number_of_windows ! Toggle 1/2 windows, show map SET (SCREEN_UPDATE, OFF); ! For speed and to avoid confusion if eve$x_number_of_windows = 1 then eve_two_windows; else eve_one_window; endif; if eag_map_lock = 1 then eag_show_map; endif; SET (SCREEN_UPDATE, ON); ! For speed and to avoid confusion endprocedure; PROCEDURE eve_map_buffer( buffer_arg ) ! Map the numbered buffer to window ! This routine will convert its argument into an integer. It will then ! count through the non-system buffers till it finds the corresponding ! buffer and map that buffer to the current window. LOCAL buffer_var, ! Holds buffer variable buffer_number, ! Argument converted to a number buffer_save, ! Buffer on entry to this routine buffer_count; ! Index/counter for counting loop if current_window = eag_map_window then position ( eve$x_this_window ); endif; buffer_save := current_buffer; buffer_number := int ( buffer_arg ); if buffer_arg <> 0 then buffer_count := 0; buffer_var := GET_INFO(BUFFER, "FIRST"); LOOP exitif buffer_var = 0; if get_info (buffer_var, "system") = 0 then buffer_count := buffer_count + 1; endif; exitif buffer_count = buffer_number; buffer_var := GET_INFO(BUFFER, "NEXT"); ENDLOOP; if buffer_count = buffer_number then if buffer_var <> current_buffer then eve_buffer ( GET_INFO(buffer_var, "NAME" ) ); endif; else eve_get_file ( read_line ( 'name? ' )); endif; endif; if eag_map_lock = 0 then if buffer_save = eag_map_buffer then buffer_save := current_buffer; eag_show_window ( 0 ); position ( buffer_save ); endif; else buffer_save := current_buffer; eag_show_map; position ( buffer_save ); endif; ENDPROCEDURE PROCEDURE eag_show_map ! Builds a new map buffer based on available info ! This routine will erase and re-build the contents of the map buffer to ! reflect the current non-system buffers that exist. It will then call ! eag_show_window to insure that the buffers are properly displayed. LOCAL saved_position, ! Holds text position on entry prev_largest_string,! Holds the last value of largest buffer name string buffer_name, ! Holds string name of buffer buffer_var, ! Holds buffer variable buffer_number, ! Argument converted to a number buffer_count; ! Index/counter for counting loop on_error endon_error; saved_position := current_window; if (get_info ( eag_map_buffer, "type") = unspecified) or (eag_map_buffer = 0) then eag_map_buffer := eve$init_buffer ("Buffers", eve$x_null); endif; if get_info(eag_map_window,'buffer') <> eag_map_buffer then if (get_info ( eag_map_window, 'type') = window) AND (get_info ( eag_map_buffer, 'type') = buffer) then map (eag_map_window, eag_map_buffer); endif; endif; eag_map_width := get_info ( screen, "width" ); set ( width, current_window, eag_map_width ); LOOP ! Till we paint a map buffer that's accurate erase ( eag_map_buffer ); position ( beginning_of ( eag_map_buffer )); if (eag_min_prefered_string > eag_largest_string) then eag_curr_min_string := eag_largest_string; else eag_curr_min_string := eag_min_prefered_string; endif; prev_largest_string := eag_largest_string; eag_largest_string := 0; eag_buf_per_line := ( eag_map_width + 4 ) / ( eag_curr_min_string + 4 ); eag_map_lines := eag_buffer_count / eag_buf_per_line; if ( eag_buffer_count <> eag_map_lines * eag_buf_per_line ) then eag_map_lines := eag_map_lines +1; endif; eag_buf_per_line := eag_buffer_count / eag_map_lines; if (eag_buffer_count <> eag_buf_per_line * eag_map_lines) then eag_buf_per_line := eag_buf_per_line +1; endif; eag_slot_size := ( (eag_map_width + 4) / eag_buf_per_line ) - 4; buffer_var := GET_INFO(BUFFER, "FIRST"); buffer_count := 0; line_count := 1; buffer_line_index := 0; LOOP exitif buffer_var = 0; if get_info (buffer_var, "system") = 0 then buffer_count := buffer_count + 1; if buffer_line_index >= eag_buf_per_line then split_line; buffer_line_index := 1; line_count := line_count + 1; else buffer_line_index := buffer_line_index + 1; endif; if buffer_line_index <> 1 then copy_text ( ' ' ); endif; copy_text ( str(buffer_count) + ' '); buffer_name := GET_INFO( buffer_var, "NAME" ); if ( length ( buffer_name ) > ( eag_slot_size - 1 ) ) then copy_text( substr( buffer_name, 1, ( eag_slot_size -1 ))); else copy_text( substr( buffer_name, 1, length( buffer_name ))); copy_text( substr( eag_blank_string, 1, (eag_slot_size - 1 - (length( buffer_name ))))); endif; if ( length ( buffer_name )) > ( eag_largest_string ) then eag_largest_string := length ( buffer_name ); endif; endif; buffer_var := GET_INFO(BUFFER, "NEXT"); ENDLOOP; exitif (buffer_count = eag_buffer_count) AND (prev_largest_string >= eag_largest_string); eag_buffer_count := buffer_count; ENDLOOP; eag_show_window ( eag_map_lines ); if get_info ( saved_position, 'type') = window then position (saved_position); endif; ENDPROCEDURE procedure eag_show_window ( needed_lines ) ! Adjusts map window if needed. ! This procedure checks, and if necessary, creates/adjusts/deletes the ! map window so as to display the specified number of map_window lines. ! If the argument is 0, the map window will go away. If a size change ! is needed, this routine adjusts the size of the lower EVE window and ! the EVE main window to compensate for the size of the map_window, keeping ! track of the buffers kept in the EVE windows as well. LOCAL save_window, ! Temporary storage for current window buffer_var, ! Temporary storage for buffer variable adjustment; ! Needed adjustment to map window save_window := current_window; adjustment := eag_map_window_size - needed_lines; if (needed_lines) = 0 then ! Get rid of map window if (get_info (eag_map_window, "type") = window ) then unmap ( eag_map_window ); delete ( eag_map_window ); save_window := eve$x_this_window; endif; endif; if adjustment <> 0 then ! we must adjust the size of the mapping window SET (SCREEN_UPDATE, OFF); ! For speed and to avoid confusion if adjustment > 0 then ! Window is too big if (needed_lines) <> 0 then ! Window exists adjust_window ( eag_map_window, adjustment, 0); endif; endif; if eve$x_number_of_windows = 1 then position (eve$main_window); adjust_window ( eve$main_window, 0, adjustment); eve_two_windows; adjust_window ( eve$bottom_window, 0, adjustment); eve_one_window; else position (eve$bottom_window); buffer_var := current_buffer; adjust_window ( eve$bottom_window, 0, adjustment); position (eve$top_window); eve_one_window; adjust_window ( eve$main_window, 0, adjustment); eve_two_windows; position (eve$bottom_window); eve_buffer ( GET_INFO( buffer_var, "NAME" ) ); endif; if adjustment < 0 then ! window is too small (might not exist) if (get_info (eag_map_window, "type") = window ) then adjust_window ( eag_map_window, adjustment, 0); else eag_map_window := create_window ( ((screen_length - needed_lines) - 1), needed_lines, off); map (eag_map_window, eag_map_buffer); endif; endif; SET (SCREEN_UPDATE, ON); endif; position ( beginning_of ( eag_map_buffer)); eag_map_window_size := needed_lines; position (save_window); ENDPROCEDURE procedure eag$init ! Called from tpu$init - has on_error statement. on_error ! ON_ERROR statements are not permitted in an endon_error; ! eveplus tpu$init, so tpu$init calls eag$init. if expand_name ( 'eag$x_write_file_key', variables ) <> eve$x_null then eag$x_map_on := 1; ! Windows are enabled eag$x_windows_on := 1; ! Mapping is enabled as a result else eag$x_windows_on := 0; ! Window keys are not enabled but mapping? if expand_name ( 'eag$x_show_map', variables ) <> eve$x_null then eag$x_map_on := 1; else eag$x_map_on := 0; endif; endif; if eag_map_lock = 1 then eag_show_map; endif; endprocedure procedure tpu$local_init; eag$init; if (get_info ( eag_shift_amount, "type") = unspecified) then eag_shift_amount := 40; endif; if (get_info ( eag_map_lock, "type") = unspecified) then eag_map_lock := 0; endif; eag_buffer_count := 1; eag_largest_string := 99; eag_blank_string := ' '; eag_min_prefered_string := 16; eag_map_window_size := 0; endprocedure; tpu$local_init; ! Define VMS line editing keys for Eve/Evg