! EVE$MOUSE.TPU 31-DEC-1992 11:48 Page 1 module eve$mouse ident "V03-021" ! ! COPYRIGHT © 1988,1992 BY ! DIGITAL EQUIPMENT CORPORATION, MAYNARD, MASSACHUSETTS ! ALL RIGHTS RESERVED ! ! THIS SOFTWARE IS FURNISHED UNDER A LICENSE AND MAY BE USED AND COPIED ! ONLY IN ACCORDANCE WITH THE TERMS OF SUCH LICENSE AND WITH THE ! INCLUSION OF THE ABOVE COPYRIGHT NOTICE. THIS SOFTWARE OR ANY OTHER ! COPIES THEREOF MAY NOT BE PROVIDED OR OTHERWISE MADE AVAILABLE TO ANY ! OTHER PERSON. NO TITLE TO AND OWNERSHIP OF THE SOFTWARE IS HEREBY ! TRANSFERRED. ! ! THE INFORMATION IN THIS SOFTWARE IS SUBJECT TO CHANGE WITHOUT NOTICE ! AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT ! CORPORATION. ! ! DIGITAL ASSUMES NO RESPONSIBILITY FOR THE USE OR RELIABILITY OF ITS ! SOFTWARE ON EQUIPMENT WHICH IS NOT SUPPLIED BY DIGITAL. ! !++ ! FACILITY: ! DECTPU - Text Processing Utility ! EVE - Extensible Versatile Editor ! ! ABSTRACT: ! This is the source program for the EVE mouse operations. ! ! ENVIRONMENT: ! OpenVMS VAX, OpenVMS AXP, RISC/ULTRIX ! ! AUTHOR: Jim Burrows ! ! CREATION DATE: 11-Feb-1988 ! ! MODIFIED BY: !-- ! EVE$MOUSE.TPU Page 2 !++ ! Table of Contents ! ! EVE$MOUSE.TPU ! 31-DEC-1992 11:48 ! ! Procedure name Page Description ! -------------- ---- ------------ ! ! eve$$shift_m1down 3 Extend a selection ! eve$$cancel_m1_action 4 Cancel an M1 operation ! eve$$m3down 5 [CTRL | ALT] M3 down (MOTIF M2) ! eve$$m3drag 6 Drag with [CTRL/]M3 down (Motif M2) ! eve$$m3up 7 [CTRL/]M3UP or [CTRL/]M3CLICK (MOTIF M2) ! eve$$m2down 8 Display a popup menu (MOTIF M3) ! eve$$choose_by_mouse 9 MB1 up in the Choices window ! eve$$current_choice 10 Current item in choices ! eve$define_indicator 11 Define a status line indicator ! eve$lookup_indicator 12 Get indicator information ! eve$undefine_indicator 13 Make a indicator inactive ! eve$$indicator_dispatch 14 Dispatch a indicator program ! eve$current_indicator 15 Get status indicator under mouse ! eve$$test_indicator 16 Is a indicator active? ! eve$key_to_ignore 17 keyname if no up-stroke for mouse ! eve$null 18 Nop ! eve$position_mouse 19 Position cursor to mouse location ! eve$learned_mouse 20 Learn code for mouse keys ! eve$upstroke_null 21 Return true if up-stroke of mouse key is a null ! eve$undefined_mouse_key 22 Undefined mouse key ! eve$$not_chorded_mouse 27 Handle a chorded mouse operation ! eve$$save_mouse_down_context 28 Remember pre-mouse status ! eve$$position_to_mouse_down 29 move to mouse location ! eve$$not_mouse_in_progress 30 Test if a mouse is in progress ! eve$$not_special_mouse_down 31 Handle special windows ! eve$$not_special_mouse_drag 32 Handle special windows ! eve$$not_special_mouse_up 33 Handle special window ups/clicks ! eve$$not_special_mouse_clickn 34 Handle special windows ! eve$$not_user_mouse 35 Handle user mouse definition ! eve$$default_mouse_down 36 Default mouse down definition ! eve$$default_mouse_drag 37 Default mouse drag definition ! eve$$default_mouse_up 38 Default mouse up/click definition ! eve$$default_mouse_clickn 39 Default mouse clickn definition ! eve$create_secondary_select 40 Create secondary selection ! eve$clear_secondary_select 41 Cancel secondary selection ! eve$$client_message 42 Respond to client messages ! eve$save_primary_selection 43 Save the select range ! eve$restore_primary_selection 44 Restore the select range ! eve$write_global_select 45 Someone wants our global selection ! eve$stuff_global_selection 47 STUFF to EVE ! eve$global_select_grab 49 TPU auto-grabbed the global selection ! eve$global_select_ungrab 49 We lost a global selection ! eve$input_focus_grab 50 Got input focus ! eve$input_focus_ungrab 50 Lost input focus ! eve$set_position_lost 50 Position changed without input focus ! eve$quick_transfer 51 Do a quick copy/cut ! eve_set_selection_grab_focus 52 Primary selection follows focus ! eve_set_selection_grab_selectio* 52 Primary selection follows selects ! eve$$remove_copyright 53 Remove copyright title at 1st key/button !-- ! EVE$MOUSE.TPU Page 3 procedure eve$$shift_m1down ! Extend a selection local the_selection, temp_range; on_error [OTHERWISE]: endon_error; %if eve$x_option_decwindows %then if eve$x_decwindows_active then if locate_mouse (eve$$x_mouse_window, eve$$x_mouse_column, eve$$x_mouse_row) then if not eve$$not_chorded_mouse (last_key) then return (FALSE); endif; ! reject special windows: status line, scroll bars, choices, ! ruler, prompt, bufed if (eve$$x_mouse_row <> 0) and (eve$$x_mouse_column <> 0) and (eve$$x_mouse_window <> eve$choice_window) and (eve$$x_mouse_window <> eve$prompt_window) and (eve$$x_mouse_window <> eve$$x_ruler_window) then if not eve$declare_intention (eve$k_action_m1down) then return (FALSE); endif; ! save context eve$$save_mouse_down_context (last_key); ! prevent scroll margins from scrolling text under mouse eve$set_all_windows (SCROLLING, 0, 0); eve$$position_to_mouse_down; eve$x_mb1_in_progress := TRUE; position (TEXT); ! execute user key if exists if not eve$$not_user_mouse ("DOWN", last_key) then ! false = handled or error, true = not user key return (FALSE); endif; the_selection := eve$selection (TRUE, FALSE, FALSE, TRUE); if the_selection <> 0 then ! ignore mouse if not in range's buffer if get_info (the_selection, "buffer") <> current_buffer then eve$$restore_position (eve$$x_pre_mb1_window, eve$$x_pre_mb1_mark); eve$$cancel_m1_action; return (FALSE); endif; temp_range := create_range (beginning_of (the_selection), mark (NONE), NONE); if get_info (mark (NONE), "within_range", the_selection) then ! Mouse is within select range, make range smaller by moving ! end that's closer to mouse to the new mouse position. if length (temp_range) > (length (the_selection) / 2) then eve$$x_mb1_down_bound := beginning_of (the_selection); eve$select_a_range (temp_range); else eve$$x_mb1_down_bound := end_of (the_selection); eve$select_a_range (eve$$x_mb1_down_bound, mark (NONE)); endif; else ! Mouse is outside select range, make range larger by moving ! end that's closer to mouse to the new mouse position. if get_info (end_of (the_selection), "within_range", temp_range) then eve$$x_mb1_down_bound := beginning_of (the_selection); eve$select_a_range (temp_range); else eve$$x_mb1_down_bound := end_of (the_selection); eve$select_a_range (eve$$x_mb1_down_bound, mark (NONE)); endif; endif; return (TRUE); else eve$$restore_position (eve$$x_pre_mb1_window, eve$$x_pre_mb1_mark); eve$$cancel_m1_action; endif; endif; endif; else ! DECwindows not available return (eve$undefined_mouse_key (last_key)); endif; return (FALSE); %else return (eve$undefined_mouse_key (last_key)); ! cct mice %endif endprocedure; ! eve$$shift_m1down ! EVE$MOUSE.TPU Page 4 procedure eve$$cancel_m1_action ! Cancel an M1 operation eve$x_mb1_in_progress := FALSE; eve$$x_pre_mb1_mark := 0; eve$$x_pre_mb1_window := 0; eve$$x_mouse_down_modifiers := ""; endprocedure; ! eve$$cancel_m1_action ! EVE$MOUSE.TPU Page 5 procedure eve$$m3down ! [CTRL | ALT] M3 down (MOTIF M2) ! Note: XUI used M3, Motif uses M2 on_error [OTHERWISE]: eve$$restore_position (eve$$x_pre_mb1_window, eve$$x_pre_mb1_mark); endon_error; %if eve$x_option_decwindows %then if eve$x_decwindows_active then if locate_mouse (eve$$x_mouse_window, eve$$x_mouse_column, eve$$x_mouse_row) then ! cancel an in_progress mouse action if not eve$$not_chorded_mouse (last_key) then return (FALSE); endif; ! reject special windows: status line, scroll bars, ruler, prompt if (eve$$x_mouse_row <> 0) and (eve$$x_mouse_column <> 0) and (eve$$x_mouse_window <> eve$prompt_window) and (eve$$x_mouse_window <> eve$$x_ruler_window) then if not eve$declare_intention (eve$k_action_m3down) then return (FALSE); endif; ! save context eve$$save_mouse_down_context (last_key); ! prevent scroll margins from scrolling text under mouse eve$set_all_windows (SCROLLING, 0, 0); eve$$position_to_mouse_down; ! execute user key if exists if not eve$$not_user_mouse ("DOWN", last_key) then ! false = halandled or error, true = not user key return (FALSE); endif; ! EVE's M3down eve$x_mb3_in_progress := TRUE; ! remember if we're to delete the selection if ((last_key = key_name (M2DOWN, ALT_MODIFIED)) or (last_key = key_name (M2DOWN, ALT_MODIFIED, SHIFT_MODIFIED))) then ! alt(motif) = delete selection, a cut eve$$x_delete_selection := TRUE; else ! otherwise, a copy eve$$x_delete_selection := FALSE; endif; position (MOUSE); eve$$x_mb3_down_free := mark (FREE_CURSOR); position (TEXT); eve$$x_mb3_down_bound := mark (NONE); ! Stay where we were or, we'd possibly move out of a mouse select ! range when the user tried to stuff the mouse selection to self, ! thus, canceling the mouse selection. eve$$restore_position (eve$$x_pre_mb1_window, eve$$x_pre_mb1_mark); return (TRUE); endif; endif; else ! DECwindows not available return (eve$undefined_mouse_key (last_key)); endif; return (FALSE); %else return (eve$undefined_mouse_key (last_key)); ! cct mice %endif endprocedure; ! eve$$m3down ! EVE$MOUSE.TPU Page 6 procedure eve$$m3drag ! Drag with [CTRL/]M3 down (Motif M2) ! Note: XUI used M3, Motif uses M2 local temp; on_error [OTHERWISE]: endon_error; %if eve$x_option_decwindows %then if eve$x_decwindows_active then if locate_mouse (eve$$x_mouse_window, eve$$x_mouse_column, eve$$x_mouse_row) = 0 then return (FALSE); endif; ! reject special windows: status line, scroll bars, ruler, prompt if (eve$$x_mouse_row <> 0) and (eve$$x_mouse_column <> 0) and (eve$$x_mouse_window <> eve$prompt_window) and (eve$$x_mouse_window <> eve$$x_ruler_window) then if not eve$declare_intention (eve$k_action_m3drag) then return (FALSE); endif; position (MOUSE); ! If nothing in-progress, see if user changed modifiers to ! accidently call us, and if so, execute the drag button ! as originally modified (enforce sticky mouse modifiers) ! and ignore this button. if not eve$x_mb3_in_progress then eve$undefined_mouse_key (last_key); return (FALSE); endif; ! execute user key if exists if not eve$$not_user_mouse ("DRAG", last_key) then ! false = handled or error, true = not user key return (FALSE); endif; ! EVE's M3drag position (MOUSE); temp := mark (FREE_CURSOR); ! if not in original M3down buffer, do not create another secondary ! select range and leave cursor where text will be inserted if eve$$x_mouse_down_buffer <> get_info (temp, "buffer") then eve$$restore_position (eve$$x_pre_mb1_window, eve$$x_pre_mb1_mark); return (FALSE); endif; ! make a new range position (TEXT); eve$create_secondary_select (eve$$x_mb3_down_bound, mark (NONE)); ! stay free-cursored in the underlined buffer if (not eve$x_bound_cursor) and (not get_info (temp, "bound")) then position (temp); endif; ! put cursor back to show where the text will be inserted eve$$restore_position (eve$$x_pre_mb1_window, eve$$x_pre_mb1_mark); return (TRUE); endif; else ! DECwindows not available return (eve$undefined_mouse_key (last_key)); endif; return (FALSE); %else return (eve$undefined_mouse_key (last_key)); ! cct mice %endif endprocedure; ! eve$$m3drag ! EVE$MOUSE.TPU Page 7 procedure eve$$m3up ! [CTRL/]M3UP or [CTRL/]M3CLICK (MOTIF M2) (the_key) ! mouse button ! Note: XUI used M3, Motif uses M2 local motion, the_range; on_error [OTHERWISE]: eve$clear_secondary_select; endon_error; %if eve$x_option_decwindows %then if eve$x_decwindows_active then if locate_mouse (eve$$x_mouse_window, eve$$x_mouse_column, eve$$x_mouse_row) then ! reject special windows: status line, ruler, prompt if (eve$$x_mouse_window <> eve$prompt_window) and (eve$$x_mouse_window <> eve$$x_ruler_window) then ! If nothing in-progress, see if user changed modifiers to ! accidently call us, and if so, execute the up/click button ! as originally modified (enforce sticky mouse modifiers) ! and ignore this button. if not eve$x_mb3_in_progress then eve$undefined_mouse_key (the_key); return (FALSE); endif; ! execute user key if exists if eve$is_mouse_motion ("UP", the_key) then motion := "UP"; else motion := "CLICK"; endif; ! This may extend the primary selection to the mouse position, ! and cause the extended selection to be cut to be pending deleted ! instead of simply cutting the original selection to the mouse. position (MOUSE); if not eve$$not_user_mouse (motion, the_key) then ! false = handled or error, true = not user key eve$x_mb3_in_progress := FALSE; eve$$x_pre_mb1_mark := 0; eve$$x_pre_mb1_window := 0; eve$set_all_windows (SCROLLING, eve$x_scroll_top, eve$x_scroll_bottom); return (FALSE); endif; ! EVE's m3up if eve$x_secondary_select_rng <> 0 then return (eve$quick_transfer (TRUE)); else ! M3 up/click with or without focus = copy ! primary selection to the mouse pointer if not eve$declare_intention (eve$k_action_paste) then eve$clear_secondary_select; eve$set_all_windows (SCROLLING, eve$x_scroll_top, eve$x_scroll_bottom); return (FALSE); endif; if not eve$stuff_global_selection then ! No primary select range copied, stay at M3down position (eve$$x_mouse_window); if eve$x_bound_cursor then position (eve$$x_mb3_down_bound); else position (eve$$x_mb3_down_free); endif; ! prevent reposition by eve$clear_secondary_select eve$$x_pre_mb1_mark := 0; eve$$x_pre_mb1_window := 0; endif; eve$clear_secondary_select; eve$set_all_windows (SCROLLING, eve$x_scroll_top, eve$x_scroll_bottom); return (TRUE); endif; endif; endif; eve$clear_secondary_select; else ! DECwindows not available return (eve$undefined_mouse_key (the_key)); endif; return (FALSE); %else return (eve$undefined_mouse_key (the_key)); ! cct mice %endif endprocedure; ! eve$$m3up ! EVE$MOUSE.TPU Page 8 procedure eve$$m2down ! Display a popup menu (MOTIF M3) local status, the_window, the_widget, temp_array; on_error [TPU$_CONTROLC]: eve$$restore_position (eve$$x_pre_mb1_window, eve$$x_pre_mb1_mark); eve$learn_abort; abort; [OTHERWISE]: eve$$restore_position (eve$$x_pre_mb1_window, eve$$x_pre_mb1_mark); endon_error; %if eve$x_option_decwindows %then if eve$x_decwindows_active then if locate_mouse (eve$$x_mouse_window, eve$$x_mouse_column, eve$$x_mouse_row) = 0 then return (FALSE); endif; ! cancel an in_progress mouse action if not eve$$not_chorded_mouse (last_key) then return (FALSE); endif; ! Ignore M2 in status line & scroll bars if (eve$$x_mouse_column = 0) or (eve$$x_mouse_row = 0) then return (FALSE); else ! save context eve$$save_mouse_down_context (last_key); ! prevent scroll margins from scrolling text under mouse eve$set_all_windows (SCROLLING, 0, 0); eve$$position_to_mouse_down; ! execute user key if exists if not eve$$not_user_mouse ("DOWN", last_key) then ! false = handled or error, true = not user key eve$set_all_windows (SCROLLING, eve$x_scroll_top, eve$x_scroll_bottom); return (FALSE); endif; ! EVE's m2down if get_info (eve$x_select_popup, "type") <> WIDGET then eve$create_popups; endif; if (eve$x_select_position <> 0) or ! A selection exists (eve$x_box_array <> 0) or ! A box selection exists (eve$x_found_range <> 0) ! A found range exists then manage_widget (eve$x_select_popup); else manage_widget (eve$x_no_select_popup); endif; eve$$restore_position (eve$$x_pre_mb1_window, eve$$x_pre_mb1_mark); eve$set_all_windows (SCROLLING, eve$x_scroll_top, eve$x_scroll_bottom); return (TRUE); endif; else ! DECwindows not available return (eve$undefined_mouse_key (last_key)); endif; return (FALSE); %else return (eve$undefined_mouse_key (last_key)); ! cct mice %endif endprocedure; ! eve$$m2down ! EVE$MOUSE.TPU Page 9 procedure eve$$choose_by_mouse ! MB1 up in the Choices window local saved_mark, saved_window, choice_column; on_error [TPU$_CONTROLC]: eve$$restore_position (saved_window, saved_mark); eve$learn_abort; abort; [OTHERWISE]: eve$$restore_position (saved_window, saved_mark); endon_error; if get_info (eve$$x_choice_range, "type") = RANGE then if get_info (eve$$x_chosen_range, "type") = RANGE then saved_mark := mark (FREE_CURSOR); saved_window := current_window; position (eve$$x_choice_range); set (RECORD_ATTRIBUTE, mark (NONE), MODIFIABLE, ON); erase (eve$$x_choice_range); eve$$x_choice_range := copy_text (eve$$x_chosen_range); position (saved_window); position (saved_mark); else eve$message (EVE$_NOCHOICE); endif; else eve$message (EVE$_NOOLDCHOICE); endif; endprocedure; ! eve$$choose_by_mouse ! EVE$MOUSE.TPU Page 10 procedure eve$$current_choice ! Current item in choices (choice_column, ! In= mouse column, out=choice start column choice_range) ! Range of choice (or 0 if mouse is not on one) local saved_mark, saved_window, choice_string, start_mark; on_error [TPU$_CONTROLC]: eve$$restore_position (saved_window, saved_mark); eve$learn_abort; abort; [OTHERWISE]: eve$$restore_position (saved_window, saved_mark); endon_error; saved_mark := mark (FREE_CURSOR); saved_window := current_window; position (MOUSE); choice_column := (((eve$$x_mouse_column - 2) / eve$$x_choices_column_width) * eve$$x_choices_column_width) + 2; choice_string := substr (current_line, choice_column, eve$$x_choices_column_width - 1); edit (choice_string, TRIM); if choice_string = "" then choice_range := 0; position (saved_window); position (saved_mark); return FALSE; else position (LINE_BEGIN); move_horizontal (choice_column - 1); start_mark := mark (NONE); move_horizontal (length (choice_string) - 1); choice_range := create_range (start_mark, mark (NONE), eve$x_choice_highlighting); endif; position (saved_window); position (saved_mark); return (TRUE); endprocedure; ! eve$$current_choice ! EVE$MOUSE.TPU Page 11 procedure eve$define_indicator ! Define a status line indicator (program_arg, ! Program field_arg, ! Test for status line indicator comment_arg) ! Comment describing indicator local the_program, the_field; if get_info (eve$$x_indicators, "type") = UNSPECIFIED then eve$$x_indicators := create_array; endif; if get_info (eve$$x_indicator_comments, "type") = UNSPECIFIED then eve$$x_indicator_comments := create_array; endif; case get_info (program_arg, "type") [STRING, BUFFER, RANGE]: the_program := compile (program_arg); [OTHERWISE]: the_program := program_arg; endcase; the_field := field_arg; edit (the_field, TRIM, LOWER); eve$$x_indicators {the_field} := the_program; eve$$x_indicator_comments {the_field} := comment_arg; return (TRUE); endprocedure; ! eve$define_indicator ! EVE$MOUSE.TPU Page 12 procedure eve$lookup_indicator ! Get indicator information (indicator_arg, ! String in indicator what) ! Keyword for desired attribute (PROGRAM, COMMENT) local the_value, ptr, the_indicator; ptr := index (indicator_arg, ":"); if ptr <> 0 then the_indicator := substr (indicator_arg, 1, ptr - 1); else the_indicator := indicator_arg; endif; case what [PROGRAM]: the_value := eve$$x_indicators {the_indicator}; [COMMENT]: the_value := eve$$x_indicator_comments {the_indicator}; [OTHERWISE]: return FALSE; endcase; if the_value = tpu$k_unspecified then return FALSE; else return the_value; endif; endprocedure; ! eve$lookup_indicator ! EVE$MOUSE.TPU Page 13 procedure eve$undefine_indicator ! Make a indicator inactive (field_arg) ! String of indicator being undefined local the_field; the_field := field_arg; edit (the_field, TRIM, LOWER); if eve$$x_indicators {the_field} = tpu$k_unspecified then eve$message (EVE$_NOINDICATOR, 0, the_field); return (FALSE); else eve$$x_indicators {the_field} := tpu$k_unspecified; eve$$x_indicator_comments {the_field} := tpu$k_unspecified; return (TRUE); endif; endprocedure; ! eve$undefine_indicator ! EVE$MOUSE.TPU Page 14 procedure eve$$indicator_dispatch ! Dispatch a indicator program local status_field, the_window, status_field_program; status_field := eve$current_indicator (the_window); if status_field = 0 then return (FALSE); endif; status_field_program := eve$lookup_indicator (status_field, PROGRAM); if status_field_program <> 0 then position (the_window); execute (status_field_program); ! return to original window (in case help or choices window is up) position (eve$$x_pre_mb1_window); return (TRUE); else eve$message (EVE$_NOINDICATOR, 0, status_field); return (FALSE); endif; endprocedure; ! eve$$indicator_dispatch ! EVE$MOUSE.TPU Page 15 procedure eve$current_indicator ! Get status indicator under mouse (; the_window, indicator_column, the_width) local pointer_found, the_column, the_status_line, next_bar, the_field; ! (row,col)=(0,0) = intersection of horizontal and vertical scroll bars if (eve$$x_mouse_row <> 0) or ((eve$$x_mouse_row = 0) and (eve$$x_mouse_column = 0)) then return (0); endif; the_window := eve$$x_mouse_window; the_column := eve$$x_mouse_column; the_status_line := get_info (the_window, "status_line") + "|"; indicator_column := 1; loop if the_status_line = "" then return (FALSE); endif; next_bar := index (the_status_line, "|"); if next_bar = 0 then return (FALSE); endif; if (next_bar >= the_column) then the_field := substr (the_status_line, 1, next_bar - 1); the_width := length (the_field); edit (the_field, TRIM, LOWER, OFF); return (the_field); endif; the_status_line := substr (the_status_line, next_bar + 1, length (the_status_line) - next_bar); indicator_column := indicator_column + next_bar; the_column := the_column - next_bar; endloop; return (FALSE); endprocedure; ! eve$current_indicator ! EVE$MOUSE.TPU Page 16 procedure eve$$test_indicator ! Is a indicator active? (the_field) return (eve$$x_indicators {the_field} <> tpu$k_unspecified); endprocedure; ! eve$$test_indicator ! EVE$MOUSE.TPU Page 17 procedure eve$key_to_ignore ! keyname if no up-stroke for mouse (this_key) ! keyname of key to test !++ ! Description ! Procedure that returns false if the input key is not a mouse DOWN key. ! Otherwise, look at the comment of its UP key: ! If the comment = "unknown" ! then return the keyword for the mouse UP key ! else return false. ! Return value ! 1. Mouse up key keyname if (a) the key was a mouse down key, and (b) its ! up-stroke is null ! 2. False, if either the key was not a mouse down key, or if it was a mouse ! down key but its up-stroke is not null ! Side Effects !-- local upstroke; on_error [OTHERWISE]: endon_error; case this_key [M1DOWN]: upstroke := M1UP; [M2DOWN]: upstroke := M2UP; [M3DOWN]: upstroke := M3UP; [M4DOWN]: upstroke := M4UP; [OTHERWISE]: return (FALSE); endcase; if eve$$lookup_comment (upstroke, "") = message_text (EVE$_UNKNOWN, 1) then return (upstroke); endif; return (FALSE); endprocedure; ! eve$key_to_ignore ! EVE$MOUSE.TPU Page 18 procedure eve$null ! Nop ! Null procedure needed for null mouse keys endprocedure; ! eve$null ! EVE$MOUSE.TPU Page 19 ! Routine to position mouse procedure eve$position_mouse ! Position cursor to mouse location position (MOUSE); endprocedure; ! eve$position_mouse ! EVE$MOUSE.TPU Page 20 procedure eve$learned_mouse ! Learn code for mouse keys (the_sequence) ! the learn sequence to execute after positioning !++ ! Description ! Routine bound to a mouse button if the user tries to LEARN to a ! mouse button. Allows user to remember a null learn sequence so ! that the mouse keys can be used to simply do the POSITION(MOUSE). ! Side Effects ! 1. Does a position(mouse) before executing the learn sequence. !-- local the_type; on_error [OTHERWISE]: endon_error; position (MOUSE); the_type := get_info (the_sequence, "type"); if (the_type = LEARN) or (the_type = PROGRAM) then return (execute (the_sequence)); endif; return (FALSE); endprocedure; ! eve$learned_mouse ! EVE$MOUSE.TPU Page 21 procedure eve$upstroke_null ! Return true if up-stroke of mouse key is a null (this_key) ! the key_name of the down-stroke !++ ! Description ! Procedure that returns false if the input key is not a mouse DOWN key. ! Otherwise, return true if its up-stroke is null ("null" means that ! the key comment = "unknown") ! NOTE: The UP key won't necessarily be ! in the same keymap as the DOWN key. ! Return value ! true, if mouse down key was pressed and its up-stroke is null ! false, if either the key was not a mouse down key, or if it was a mouse ! down key but its up-stroke is not null !-- on_error [OTHERWISE]: endon_error; if this_key = M1DOWN then return eve$$lookup_comment (M1UP, "") = message_text (EVE$_UNKNOWN, 1); else if this_key = M2DOWN then return eve$$lookup_comment (M2UP, "") = message_text (EVE$_UNKNOWN, 1); else if this_key = M3DOWN then return eve$$lookup_comment (M3UP, "") = message_text (EVE$_UNKNOWN, 1); else if this_key = M4DOWN then return eve$$lookup_comment (M4UP, "") = message_text (EVE$_UNKNOWN, 1); endif; endif; endif; endif; return (FALSE); endprocedure; ! eve$upstroke_null ! EVE$MOUSE.TPU Page 22 procedure eve$undefined_mouse_key ! Undefined mouse key (the_button) ! the mouse button ! TPU calls this procedure when a mouse button event occurs that has no ! definition in eve$x_mouse_list key_map_list reserved solely for EVE use. ! Since user mouse definitions (by any means) are put into eve$x_key_map_list, ! all user mouse buttons hit this procedure. Unknown mouse events default ! to do what M1 does (down/up=position to mouse, down/drag/up= create select ! range, down/click= selection hierarchy). ! This procedure also handles EVE's M1 definitions. ! ! EVE has a "sticky" modifier policy: the modifiers the user presses with ! the down button are what the user wants to use to modify subsequent drags/ups. ! This procedure, and all EVE procedures bound to buttons enforce this. local new_button, the_key, the_modifiers, mouse_motion, motion_name, status, mouse_name; on_error [OTHERWISE]: endon_error; the_key := the_button; ! Where's the mouse? if not locate_mouse (eve$$x_mouse_window, eve$$x_mouse_column, eve$$x_mouse_row) then return (FALSE); endif; if (eve$$x_mouse_row = 0) and (eve$$x_mouse_column = 0) then ! avoid scroll bar intersection return (FALSE); endif; ! Which motion was it (down, up, drag, clickn)? if eve$is_mouse_down (the_key) then mouse_motion := 1; ! down motion_name := "DOWN"; else if eve$is_mouse_drag (the_key) then mouse_motion := 2; ! drag motion_name := "DRAG"; else if eve$is_mouse_up (the_key) then mouse_motion := 3; ! up motion_name := "UP"; else if eve$is_mouse_click (the_key) then mouse_name := get_info (the_key, "name"); case mouse_name ["M1CLICK", "M2CLICK", "M3CLICK", "M4CLICK", "M5CLICK"]: mouse_motion := 3; ! click --> up motion_name := "CLICK"; [OTHERWISE]: ! modified buttons if index (mouse_name, "CLICK,") <> 0 then mouse_motion := 3; ! click --> up motion_name := "CLICK"; else mouse_motion := 4; ! clickn if index (mouse_name, "CLICK2") <> 0 then motion_name := "CLICK2"; else if index (mouse_name, "CLICK3") <> 0 then motion_name := "CLICK3"; else if index (mouse_name, "CLICK4") <> 0 then motion_name := "CLICK4"; else if index (mouse_name, "CLICK5") <> 0 then motion_name := "CLICK5"; endif; endif; endif; endif; endif; endcase; endif; endif; endif; endif; ! EVE$MOUSE.TPU Page 23 case mouse_motion [1]: ! DOWN ! Stop in-progress mouse operation (EVE default) if not eve$$not_chorded_mouse (the_key) then ! false = chorded operation handled (or error) return (FALSE); ! true = not chorded operation, continue endif; ! prevent scroll margins from scrolling text under mouse eve$set_all_windows (SCROLLING, 0, 0); eve$$save_mouse_down_context (the_key); ! handle special mouse locations if not eve$$not_special_mouse_down (the_key) then ! false = handled special window (or error) return (FALSE); ! true = not in special window endif; eve$$position_to_mouse_down; ! execute user key if exists if not eve$$not_user_mouse (motion_name, the_key) then ! false = handled or error, true = not user key return (FALSE); endif; ! execute default down action return (eve$$default_mouse_down (the_key)); ! EVE$MOUSE.TPU Page 24 [2]: ! DRAG ! Ignore drag if nothing in-progress if eve$$not_mouse_in_progress (the_key) then return (FALSE); endif; ! don't position to the mouse here or drags in status lines will ! position to the associated window. ! same modifiers as down? if not eve$$not_mixed_mouse_modifiers (the_key, motion_name) then return (FALSE); endif; ! handle special mouse locations if not eve$$not_special_mouse_drag then ! false = handled special window (or error) return (FALSE); ! true = not in special window endif; ! execute user key if exists if not eve$$not_user_mouse (motion_name, the_key) then ! false = handled or error, true = not user key return (FALSE); endif; ! execute default drag action return (eve$$default_mouse_drag); ! EVE$MOUSE.TPU Page 25 [3]: ! UP (+ CLICK) ! Ignore up if nothing in-progress if eve$$not_mouse_in_progress (the_key) then ! false = mouse in progress (or error) eve$set_all_windows (SCROLLING, eve$x_scroll_top, eve$x_scroll_bottom); return (FALSE); ! true = nothing in progress, continue endif; ! same modifiers as down? if not eve$$not_mixed_mouse_modifiers (the_key, motion_name) then eve$set_all_windows (SCROLLING, eve$x_scroll_top, eve$x_scroll_bottom); return (FALSE); endif; ! handle special mouse locations if not eve$$not_special_mouse_up then ! false = handled special window (or error) eve$set_all_windows (SCROLLING, eve$x_scroll_top, eve$x_scroll_bottom); return (FALSE); ! true = not in special window endif; ! execute user key if exists if not eve$$not_user_mouse (motion_name, the_key) then ! false = handled or error, true = not user key eve$set_all_windows (SCROLLING, eve$x_scroll_top, eve$x_scroll_bottom); return (FALSE); endif; ! tell the user no user definition was found if EVE's ! "real" m1downs didn't start it if (eve$$x_mouse_down_button <> M1DOWN) and (eve$$x_mouse_down_button <> key_name (M1DOWN, SHIFT_MODIFIED)) then eve$message (EVE$_NOUSERMOUSEUP); endif; ! execute default up action status := eve$$default_mouse_up; eve$set_all_windows (SCROLLING, eve$x_scroll_top, eve$x_scroll_bottom); return (status); ! EVE$MOUSE.TPU Page 26 [4]: ! CLICKN (N=2-5) ! do not test for in_progress here. ! same modifiers as down? if not eve$$not_mixed_mouse_modifiers (the_key, motion_name) then return (FALSE); endif; ! handle special mouse locations if not eve$$not_special_mouse_clickn (the_key) then ! false = handled special window (or error) return (FALSE); ! true = not in special window endif; ! Hierarchical mouse clicks should all occur in the same buffer ! in order to implement a progressive selection hierarchy. ! Reject clicks not in M1down's buffer, for example, when multiple ! clicks occur in the choice window: M1UP/M1CLICK selects a choice ! and M1CLICK2 executes the chosen command, which unmaps the choice ! window so that subsequent clicks would not occur in the choices ! buffer. if not (get_info (eve$$x_mouse_window, "buffer") = eve$$x_mouse_down_buffer) then return (FALSE); endif; ! execute user key if exists ! CLICKn's must operate on same point (adjust for scroll margins moving ! the text from under the mouse after the UP stroke). position (eve$$x_mb1_down_free); if not eve$$not_user_mouse (motion_name, the_key) then ! false = handled or error, true = not user key return (FALSE); endif; ! execute default clickn action and tell the user no user definition ! was found if EVE's "real" m1downs didn't start it if (eve$$x_mouse_down_button <> M1DOWN) and (eve$$x_mouse_down_button <> key_name (M1DOWN, SHIFT_MODIFIED)) then eve$message (EVE$_NOUSERCLICKN); endif; status := eve$$default_mouse_clickn (the_key); return (status); endcase; return (FALSE); endprocedure; ! eve$undefined_mouse_key ! EVE$MOUSE.TPU Page 27 procedure eve$$not_chorded_mouse ! Handle a chorded mouse operation (the_key) ! mouse button ! Returns true if not a "chorded" mouse operation (chorded = mouse down while ! an in_progress flag is set for another mouse button number). on_error [OTHERWISE]: endon_error; if eve$is_mouse_down (the_key) then ! Is M2 active if (eve$$mouse_button_number (the_key) <> 2) and eve$x_mb3_in_progress then ! Not an M2 button, cancel secondary selection eve$clear_secondary_select; return (FALSE); endif; ! Is another mouse active? if eve$x_mb1_in_progress then ! Prevent problem if down was missed (eaten by READ_KEY, or pressed ! outside TPU's terminal window. if get_info (eve$$x_mouse_down_button, "type") = KEYWORD then if eve$$mouse_button_number (the_key) <> eve$$mouse_button_number (eve$$x_mouse_down_button) then ! Not the same button number, cancel primary "static" mouse ! selection created by default mouse action (like M1's) eve$clear_select_position; eve$$restore_position (eve$$x_pre_mb1_window, eve$$x_pre_mb1_mark); eve$$cancel_m1_action; return (FALSE); endif; endif; endif; endif; return (TRUE); ! it's not a chorded mouse button endprocedure; ! eve$$not_chorded_mouse ! EVE$MOUSE.TPU Page 28 procedure eve$$save_mouse_down_context ! Remember pre-mouse status (the_key) ! the mouse button ! Saves the current position. Returns false if not a down button. on_error [OTHERWISE]: endon_error; if eve$is_mouse_down (the_key) then ! The default action for down buttons that are not [CTRL/]M3DOWN is to ! prepare for a reposition/select operation similar to an M1 down. eve$$x_pre_mb1_mark := mark (FREE_CURSOR); eve$$x_pre_mb1_window := current_window; eve$$x_mouse_down_button := the_key; ! to save modifiers eve$$x_mouse_down_modifiers := eve$$strip_modifiers (the_key); eve$$x_mouse_down_window := eve$$x_mouse_window; eve$$x_mouse_down_buffer := get_info (eve$$x_mouse_window, "buffer"); eve$$x_mouse_down_row := eve$$x_mouse_row; return (TRUE); endif; return (FALSE); endprocedure; ! eve$$save_mouse_down_context ! EVE$MOUSE.TPU Page 29 procedure eve$$position_to_mouse_down ! move to mouse location ! remember where the mouse went down (assumes scroll margins are disabled) position (MOUSE); eve$$x_mb1_down_free := mark (FREE_CURSOR); position (TEXT); eve$$x_mb1_down_bound := mark (NONE); position (eve$$x_mb1_down_free); endprocedure; ! eve$$position_to_mouse_down ! EVE$MOUSE.TPU Page 30 procedure eve$$not_mouse_in_progress ! Test if a mouse is in progress (the_key) ! mouse button keyname ! Returns true if the_key is not the same button number as the last down button, ! returns true if nothing is in progress, otherwise returns false. on_error [OTHERWISE]: endon_error; ! Prevent problem if down was missed (eaten by READ_KEY, or pressed ! outside TPU's terminal window. ! Note: M2 in Motif set eve$x_mb3_in_progress if get_info (eve$$x_mouse_down_button, "type") = KEYWORD then if eve$$mouse_button_number (the_key) = eve$$mouse_button_number (eve$$x_mouse_down_button) then ! the button number between downs must match the last down button number ! and only one action is in progress at a time return (not (eve$x_mb1_in_progress or eve$x_mb3_in_progress)) endif; endif; return (TRUE); ! nothing in progress endprocedure; ! eve$$not_mouse_in_progress ! EVE$MOUSE.TPU Page 31 procedure eve$$not_special_mouse_down ! Handle special windows (the_key) ! the mouse button ! Returns true if not any mouse down button in a window that requires special ! handling. Otherwise, do the special handling and return false. local status, the_width; on_error [OTHERWISE]: endon_error; status := TRUE; ! status line? if eve$$x_mouse_row = 0 then if eve$$x_mouse_column <> 0 ! avoid scroll bar intersection then if eve$current_indicator (eve$$x_mouse_window, eve$$x_mouse_column, the_width) <> 0 then %if eve$x_option_decwindows %then ! prevent dragging until mouse moves out of indicator field if eve$x_decwindows_active then set (ACTIVE_AREA, eve$$x_mouse_window, eve$$x_mouse_column, 0, the_width, 1); endif; %endif endif; endif; status := FALSE; else ! choices window? if eve$$x_mouse_window = eve$choice_window then ! position to the mouse in choices buffer eve$$position_to_mouse_down; if eve$$current_choice (eve$$x_mouse_column, eve$$x_chosen_range) then %if eve$x_option_decwindows %then if eve$x_decwindows_active then set (ACTIVE_AREA, eve$$x_mouse_window, eve$$x_mouse_column, eve$$x_mouse_row, eve$$x_choices_column_width, 1); endif; %endif endif; status := FALSE; else ! ruler window? if eve$$x_mouse_window = eve$$x_ruler_window then return (FALSE); else if eve$$x_mouse_window = eve$command_window then ! position to window to not change previous buffer position position (eve$$x_mouse_window); ! if at end of cmd buffer, prompt for a command if mark (FREE_CURSOR) = end_of (current_buffer) then ! prevent eve$$enter_cmd_window from being entered from ! cmd_window (would save top window as pre_cmd_window) position (eve$$x_pre_mb1_window); eve$$enter_command_window; endif; eve$$position_to_mouse_down; status := FALSE; endif; endif; endif; endif; if not status then eve$x_mb1_in_progress := TRUE; endif; return (status); endprocedure; ! eve$$not_special_mouse_down ! EVE$MOUSE.TPU Page 32 procedure eve$$not_special_mouse_drag ! Handle special windows ! Returns true if nothing in progress or not a special ! mouse drag, i.e., not a mouse drag in ! a window that requires special handling. Otherwise, do the special ! handling and return false. Also returns false if not in same buffer ! as the last down button. local the_width; on_error [OTHERWISE]: endon_error; if not eve$x_mb1_in_progress then return (TRUE); endif; ! ignore releases in vertical scroll bar if eve$$x_mouse_column = 0 then return (FALSE); endif; ! status line? if eve$$x_mouse_row = 0 then if (eve$$x_mouse_down_row = 0) ! down was in a status line and ! and it was this status line (eve$$x_mouse_down_window = eve$$x_mouse_window) then if eve$current_indicator (eve$$x_mouse_window, eve$$x_mouse_column, the_width) <> 0 then %if eve$x_option_decwindows %then ! prevent dragging until mouse moves out of indicator field if eve$x_decwindows_active then set (ACTIVE_AREA, eve$$x_mouse_window, eve$$x_mouse_column, 0, the_width, 1); endif; endif; %endif endif; return (FALSE); else ! choices window? if eve$$x_mouse_window = eve$choice_window then if eve$$x_mouse_down_window = eve$choice_window then if eve$$current_choice (eve$$x_mouse_column, eve$$x_chosen_range) then %if eve$x_option_decwindows %then if eve$x_decwindows_active then set (ACTIVE_AREA, eve$$x_mouse_window, eve$$x_mouse_column, eve$$x_mouse_row, eve$$x_choices_column_width, 1); endif; %endif endif; endif; return (FALSE); else ! ruler window? if eve$$x_mouse_window = eve$$x_ruler_window then return (FALSE); else ! command window? if eve$$x_mouse_window = eve$command_window then ! ignore mouse if M1down wasn't in cmd window if eve$$x_mouse_down_window <> eve$command_window then return (FALSE); endif; if not eve$declare_intention (eve$k_action_m1drag) then eve$$cancel_m1_action; return (FALSE); endif; position (MOUSE); position (TEXT); eve$select_a_range (eve$$x_mb1_down_bound, mark (NONE)); return (FALSE); endif; endif; endif; endif; return (TRUE); ! not a special window endprocedure; ! eve$$not_special_mouse_drag ! EVE$MOUSE.TPU Page 33 procedure eve$$not_special_mouse_up ! Handle special window ups/clicks ! Returns true if not a special mouse up, i.e., not a mouse up in ! special window that does not perform the default mouse up action. ! Otherwise, do the special handling and return false. local status, the_width; on_error [OTHERWISE]: endon_error; if not eve$x_mb1_in_progress then return (TRUE); endif; status := TRUE; ! ignore releases in vertical scroll bar if eve$$x_mouse_column = 0 then return (FALSE); endif; ! status line? if eve$$x_mouse_row = 0 then if eve$$x_mouse_down_row = 0 ! down was also in row 0 then if eve$$x_mouse_down_window = eve$$x_mouse_window then ! don't allow dragging AND indicator dispatching eve$$indicator_dispatch; endif; endif; status := FALSE; else if eve$$x_mouse_window = eve$choice_window then ! don't allow dragging AND choosing by mouse if eve$$x_mouse_down_window = eve$choice_window then if get_info (eve$x_select_position, "type") <> RANGE then eve$$choose_by_mouse; endif; endif; status := FALSE; else if eve$$x_mouse_window = eve$command_window then ! ignore mouse if M1down wasn't in cmd window if eve$$x_mouse_down_window <> eve$command_window then return (FALSE); endif; if get_info (eve$x_select_position, "type") = RANGE then ! ignore mouse if M1down wasn't in cmd window if not eve$declare_intention (eve$k_action_m1up_selection) then eve$$cancel_m1_action; else ! eve$x_select_remove_flag = true allows creating ! a select range of character under cursor if (eve$$x_mb1_down_bound = mark (NONE)) and (not eve$x_select_remove_flag) then eve$clear_select_position; else position (MOUSE); position (TEXT); eve$select_a_range (eve$$x_mb1_down_bound, mark (NONE)); endif; endif; else if eve$x_bound_cursor then position (MOUSE); position (TEXT); ! keep cursor out of command prompt eve$$command_post_filter; endif; endif; status := FALSE; else if (eve$$x_mouse_window = eve$$x_ruler_window) or (eve$$x_mouse_down_buffer = eve$x_bufed_buffer) then status := FALSE; endif; endif; endif; endif; if not status then eve$$cancel_m1_action; endif; return (status); endprocedure; ! eve$$not_special_mouse_up ! EVE$MOUSE.TPU Page 34 procedure eve$$not_special_mouse_clickn ! Handle special windows (the_key) ! mouse button ! Returns true if not a special mouse clickn, i.e., not a mouse clickn in ! special window that does not perform the default mouse clickn action. ! Otherwise, handle the special window. local the_width; on_error [OTHERWISE]: endon_error; ! Hierarchical mouse clicks should all occur in the same buffer ! in order to implement a progressive selection hierarchy. ! The undefined mouse key procedure rejects clicks not in M1down's buffer. if eve$$x_mouse_down_buffer = eve$x_bufed_buffer then if index (get_info (the_key, "name"), "CLICK2") <> 0 then ! position to the mouse in bufed_buffer eve$$position_to_mouse_down; ! cancel the select range in bufed_buffer eve$clear_select_position; eve$$bufed_select; endif; return (FALSE); ! consume all clickn in bufed buffer endif; ! status line or scroll bar? if (eve$$x_mouse_row = 0) or (eve$$x_mouse_column = 0) then return (FALSE); ! do nothing else ! choices window? Allow CLICK2, but not CLICK3-5 (CLICK is handled by ! the UP procedure) if eve$$x_mouse_window = eve$choice_window then if eve$$x_mouse_down_window = eve$choice_window then if index (get_info (the_key, "name"), "CLICK2") <> 0 then if eve$$current_choice (eve$$x_mouse_column, eve$$x_chosen_range) then if (get_info (eve$prompt_window, "buffer") <> eve$help_prompt_buffer) then position (eve$command_window); eve$$exit_command_window; else ! Force help to process the choice position (eve$prompt_window); eve$help_undefined_key (RET_KEY); endif; endif; endif; endif; return (FALSE); else ! ruler window? if eve$$x_mouse_window = eve$$x_ruler_window then return (FALSE); ! reject endif; endif; endif; return (TRUE); ! not a special location endprocedure; ! eve$$not_special_mouse_click ! EVE$MOUSE.TPU Page 35 procedure eve$$not_user_mouse ! Handle user mouse definition (the_motion, ! string for mouse motion ("DOWN", "UP",...) the_key) ! the mouse button ! Returns true if (1) the_key is not of type the_motion, (2) a user mouse ! definition does not exist for the_key, or (3) the_motion is "DOWN" and ! the_key is M1DOWN (if a user M1DOWN definition ! exists, then an error message is also output before returning true - this ! lets EVE$UNDEFINED_MOUSE_KEY then execute the default mouse down action). ! Otherwise, returns false if edit handler for eve$k_action_user_mouse fails, ! or executes the user mouse definition and returns false. ! ! Assumes we're positioned to the buffer under the mouse. local local_button, the_key_map_list, the_modifiers, new_motion_name, new_button; on_error [OTHERWISE]: endon_error; local_button := the_key; if eve$is_mouse_motion (the_motion, local_button) then the_key_map_list := eve$current_key_map_list; if lookup_key (local_button, PROGRAM, the_key_map_list) = 0 then return (TRUE); ! nothing defined endif; ! a user button is defined if local_button <> M1DOWN ! prevent user M1DOWN then if not eve$declare_intention (eve$k_action_user_mouse) then return (FALSE); ! don't execute user action endif; ! plant the starting markers if eve$is_mouse_down (local_button) then eve$$position_to_mouse_down; ! start it else position (MOUSE); endif; execute (local_button, the_key_map_list); if (eve$is_mouse_up (local_button)) or (eve$is_mouse_click (local_button)) then eve$x_mb1_in_progress := FALSE; if eve$x_bound_cursor then position (TEXT); endif; else if not eve$x_mb3_in_progress !M2 for Motif then eve$x_mb1_in_progress := TRUE; endif; endif; return (FALSE); else ! reject user's M1DOWN definition eve$message (EVE$_IGNUSERM1DOWN); return (TRUE); endif; endif; return (TRUE); ! not same motion as last down button endprocedure; ! eve$$not_user_mouse ! EVE$MOUSE.TPU Page 36 procedure eve$$default_mouse_down ! Default mouse down definition (the_key) ! mouse button ! Execute the default mouse down action. Even if the user presses ! a (modified) non-M1 down button, behave like M1DOWN in preparing ! for a subsequent drag or release action. Also handles M1DOWN. on_error [OTHERWISE]: endon_error; if not eve$declare_intention (eve$k_action_m1down) then eve$$cancel_m1_action; return (FALSE); endif; eve$clear_select_position; eve$clear_message; position (eve$$x_mb1_down_free); eve$x_mb1_in_progress := TRUE; ! prevent EVE$INPUT_FOCUS_GRAB from changing position eve$$x_position_lost := FALSE; return (TRUE); endprocedure; ! eve$$default_mouse_down ! EVE$MOUSE.TPU Page 37 procedure eve$$default_mouse_drag ! Default mouse drag definition ! Execute the default mouse drag action. Even if the user presses ! a (modified) non-M1 drag button, behave like M1DRAG. Also handles ! M1DRAG. local temp; on_error [OTHERWISE]: endon_error; ! kick out if nothing going if not eve$x_mb1_in_progress then return (FALSE); endif; if not eve$declare_intention (eve$k_action_m1drag) then eve$$cancel_m1_action; return (FALSE); endif; ! ignore mouse if M1down markers haven't been set yet if get_info (eve$$x_mb1_down_bound, "type") <> MARKER then return (FALSE); endif; ! ignore mouse if M1down wasn't in mouse's current buffer if not (get_info (eve$$x_mouse_window, "buffer") = eve$$x_mouse_down_buffer) then eve$$restore_position (eve$$x_mouse_down_window, eve$$x_mouse_down_buffer); return (FALSE); endif; ! ignore mouse if M1down was in the status line if eve$$x_mouse_down_row = 0 then return (FALSE); endif; position (MOUSE); temp := mark (FREE_CURSOR); position (TEXT); eve$select_a_range (eve$$x_mb1_down_bound, mark (NONE)); if (not eve$x_bound_cursor) and (not get_info (temp, "bound")) then ! position to middle of tab position (temp); endif; return (TRUE); endprocedure; ! eve$$default_mouse_drag ! EVE$MOUSE.TPU Page 38 procedure eve$$default_mouse_up ! Default mouse up/click definition ! Execute the default mouse up/click action. Even if the user presses ! a (modified) non-M1 up/click button, behave like M1UP/CLICK. Also ! handles M1UP/M1CLICK. local temp; on_error [OTHERWISE]: endon_error; ! kick out if nothing going if not eve$x_mb1_in_progress then eve$$cancel_m1_action; return (FALSE); endif; ! ignore mouse if M1down markers haven't been set yet if get_info (eve$$x_mb1_down_bound, "type") <> MARKER then return (FALSE); endif; ! ignore mouse if M1down wasn't in mouse's current buffer if not (get_info (eve$$x_mouse_window, "buffer") = eve$$x_mouse_down_buffer) then eve$$restore_position (eve$$x_mouse_down_window, eve$$x_mouse_down_buffer); return (FALSE); endif; position (MOUSE); temp := mark (FREE_CURSOR); if get_info (eve$x_select_position, "type") = RANGE then if not eve$declare_intention (eve$k_action_m1up_selection) then eve$$cancel_m1_action; return (FALSE); endif; position (TEXT); ! eve$x_select_remove_flag = true allows creating ! a select range of character under cursor if (eve$$x_mb1_down_bound = mark (NONE)) and (not eve$x_select_remove_flag) then eve$clear_select_position; else eve$select_a_range (eve$$x_mb1_down_bound, mark (NONE)); endif; if (not eve$x_bound_cursor) and (not get_info (temp, "bound")) then ! position to middle of tab position (temp); endif; else if eve$x_bound_cursor then position (TEXT); endif; endif; eve$$cancel_m1_action; return (TRUE); endprocedure; ! eve$$default_mouse_up ! EVE$MOUSE.TPU Page 39 procedure eve$$default_mouse_clickn ! Default mouse clickn definition (the_key) ! mouse button ! Execute the default mouse clickn action. Even if the user presses ! a (modified) non-M1 clickn button, behave like M1CLICKN. Also handles ! M1CLICKn. local saved_mark, temp, click_index, the_name, start_mark, end_mark; on_error [OTHERWISE]: endon_error; ! Hierarchical mouse clicks should all occur in the same buffer ! in order to implement a progressive selection hierarchy. ! The undefined mouse key procedure rejects clicks not in M1down's buffer. ! ignore mouse if M1down markers haven't been set yet if get_info (eve$$x_mb1_down_bound, "type") <> MARKER then return (FALSE); endif; if not eve$declare_intention (eve$k_action_m1click_selection) then eve$$cancel_m1_action; return (FALSE); endif; ! we should already be positioned at the DOWN free marker if eve$x_bound_cursor then position (TEXT); endif; saved_mark := mark (FREE_CURSOR); %if eve$x_option_decwindows %then if eve$x_decwindows_active then the_name := get_info (the_key, "name"); click_index := index (the_name, "CLICK"); if click_index = 0 then position (saved_mark); ! not a clickn key return (FALSE); endif; the_name := substr (the_name, click_index, length ("CLICKn")); case the_name ["CLICK2"]: eve$select_a_range (eve$current_word); ["CLICK3"]: position (LINE_BEGIN); start_mark := mark (NONE); position (LINE_END); eve$select_a_range (start_mark, mark (NONE)); ["CLICK4"]: temp := search_quietly (eve$pattern_empty_line, REVERSE, EXACT); if temp <> 0 then start_mark := end_of (temp); else start_mark := beginning_of (current_buffer); endif; temp := search_quietly (eve$pattern_empty_line, FORWARD, EXACT); if temp <> 0 then end_mark := beginning_of (temp); else end_mark := end_of (current_buffer); endif; eve$select_a_range (start_mark, end_mark); ["CLICK5"]: eve$clear_select_position; eve_select_all; endcase; endif; %endif position (saved_mark); return (TRUE); endprocedure; ! eve$$default_mouse_clickn ! EVE$MOUSE.TPU Page 40 procedure eve$create_secondary_select ! Create secondary selection (mark1, ! start of range mark2; ! end of range no_mouse) ! 1 = don't use mouse, 0 or UNSPECIFIED = use mouse ! Create secondary selection in EVE$X_SECONDARY_SELECT_RNG similar ! to primary selection in EVE$X_SELECT_POSITION. local saved_mark, start_mark, end_mark; on_error [TPU$_CONTROLC]: eve$$restore_position (saved_mark); eve$learn_abort; abort; [OTHERWISE]: eve$$restore_position (saved_mark); eve$learn_abort; endon_error; saved_mark := mark (FREE_CURSOR); if get_info (mark1, "type") <> MARKER then eve$message (TPU$_INVPARAM, 0, 1, "", str (get_info (mark1, "type")), "", "MARKER"); return (FALSE); endif; if get_info (mark2, "type") <> MARKER then eve$message (TPU$_INVPARAM, 0, 2, "", str (get_info (mark2, "type")), "", "MARKER"); return (FALSE); endif; ! insure range is bound to text on both ends if not get_info (mark1, "bound") then position (mark1); start_mark := mark (NONE); else start_mark := mark1; endif; if not get_info (mark2, "bound") then position (mark2); end_mark := mark (NONE); else end_mark := mark2; endif; ! create/modify the secondary select range if get_info (eve$x_secondary_select_rng, "type") = RANGE then modify_range (eve$x_secondary_select_rng, start_mark, end_mark); else ! new range eve$x_secondary_select_rng := create_range (start_mark, end_mark, eve$x_quick_copy_highlighting); endif; ! If use_mouse: ! Move cursor 1 char past the last character in forward ! direction, and include that last character in the select ! range (this differs from with no movement then ! and not at eob if eve$x_select_remove_flag then ! extend the null range to be the current character the_data := current_character; else if get_info (SCREEN, "input_focus") then the_data := "" ! null selection else the_data := NONE; ! nothing available endif; endif; else if the_data = 0 !