home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0010 - 0019 / ibm0010-0019 / ibm0010.tar / ibm0010 / ME494-6.ZIP / WINDOW.SRC < prev   
Encoding:
Text File  |  1990-06-12  |  52.2 KB  |  2,058 lines

  1. $MACRO_FILE WINDOW;
  2. {******************************************************************************
  3.                                                 MULTI-EDIT MACRO FILE WINDOW.SRC
  4.  
  5. This file contains all of the window oriented macros.
  6.  
  7. WINMENU  - The general purpose window list (menu) routine
  8. FINDWIN  - If the current window is hidden, finds one that isn't
  9. NEXTWIN  - Switches to the next non hidden window.
  10. LASTWIN  - Switches to the preceding non hidden window.
  11. SWITWIN  - The SWITCH WINDOW menu.  Uses WINMENU.
  12. COPYBL     - Interwindow copy menu.  Uses WINMENU.
  13. MOVEBL     - Interwindow move menu.  Uses WINMENU.
  14. LINKWIN  - Link window menu.  Uses WINMENU.
  15. SETBTMS  - Determines whether or not a window should have a bottom boarder
  16. DELWIN     - Delete window with verify.
  17. MAKEWIN     - Creates a new window.
  18. MOD_WIN     - Uses MOVE_WIN to modify the current window size
  19. MOVE_WIN - Moves or resizes windows.
  20. ZOOM         - Replaces the ZOOM macro command.
  21. SPLITWIN - Creates a new window and splits it vertically  or horizontally
  22. WIN_OP     - Performs various window operations.
  23.  
  24.                                         Copyright 1989 by American Cybernetics, Inc.
  25. ******************************************************************************}
  26.  
  27. $MACRO WINMENU TRANS;
  28. {******************************************************************************
  29.                                                             MULTI-EDIT MACRO
  30.  
  31. Name: WINMENU
  32.  
  33. Description:    A general purpose window list (menu) routine
  34.  
  35. Parameters:
  36.  /WT=<String>   The title of the top of the box.
  37.  /WH=<String>   The "help" at the bottom of the box.
  38.  /HS=<String>   The help index for HELP FILE if F1 is pressed.
  39.  /HE=<Integer>  Enables user to hide windows, 0 or 1
  40.  /DB=<Integer>  Causes display of only windows with marked blocks, 0 or 1.
  41.  /DC=<Integer>  Causes display of the active window with the list, 0 or 1.
  42.  Global_Int('@WINDOW_LIST_MODE@') If <> 0, Causes display format to have the
  43.                                 window letter first so that the incremental search will key
  44.                                 off of that instead of the file name.
  45.  
  46.  Returns:
  47.                                 Return_Int = the number of the chosen window.
  48.  
  49.                     Copyright 1989 by American Cybernetics, Inc.
  50. ******************************************************************************}
  51.  
  52.     Def_Int(T_Refresh,
  53.                     Display_Current,Display_Blocked_Only,
  54.                     Active_Window,Menu_Window,
  55.                     Temp_Window,Start_Window,
  56.                     Menu_X,Menu_Y,
  57.                     Temp_Integer,Active_Line,Global_Hidden,
  58.                     Hide_Enable,Letter_First,
  59.                     Name_Col,Letter_Col,Attribute_Col,Path_Col,ID_Col,
  60.  
  61.                     Start_Window_Id,
  62.                     Old_Window_ID,
  63.                     Menu_Window_Id,
  64.                     Cur_Window_Id );
  65.  
  66.     Def_Str( Temp_String[128], attr_str[40] );
  67.  
  68.     Undo_Stat := False;
  69.  
  70.     Letter_First := (Global_Int('@WINDOW_LIST_MODE@') <> 0);
  71.     Messages := False;
  72.     Push_Labels;
  73.     T_Refresh := Refresh;
  74.     Refresh := False;
  75.     Hide_Enable := Parse_Int('/HE=',MParm_Str);
  76.     Display_Current := Parse_Int('/DC=',MParm_Str);
  77.     Display_Blocked_Only := Parse_Int('/DB=',MParm_Str);
  78.  
  79.     If (Hide_Enable) Then
  80.         Flabel('DelWin',2,$FF);
  81.         Flabel('Save',3,$FF);
  82.         Flabel('HideWn',4,$FF);
  83.         Flabel('HidAll',5,$FF);
  84.     End;
  85.     Flabel('View',6,$FF);
  86.     Menu_X := 1;
  87.     Menu_Y := 3;
  88.     Attribute_Col := 17;
  89.     Path_Col := 41;
  90.     Id_Col := 91;
  91.     IF (Letter_First) THEN
  92.         Letter_Col := 1;
  93.         Name_Col := 3;
  94.     ELSE
  95.         Letter_Col := 14;
  96.         Name_Col := 1;
  97.     END;
  98.     If (Global_Hidden <> 1) Then
  99.         Global_Hidden := False;
  100.     End;
  101.     Active_Window := Window_Id;
  102.     Start_Window_Id := Window_Id;
  103.     Cur_Window_Id := Window_Id;
  104.  
  105. START_OVER:
  106. {Find the numerically highest window}
  107.     Switch_Window(Window_Count);
  108.     Error_Level := 0;
  109.     Create_Window;
  110.     IF (Error_Level <> 0) THEN
  111.         Make_Message('Too many windows to run this macro!');
  112.         Error_Level := 0;
  113.         Goto ABORT;
  114.     END;
  115.     Menu_Window := Cur_Window;
  116.     Menu_Window_Id := Window_Id;
  117.     File_Name := 'MEMENU.TMP';
  118.     CALL NO_ERASE_LIST;
  119.  
  120. {If there are no windows to display, then....}
  121.     IF (C_Line < 2) THEN
  122.         Return_Int := 0;
  123.         Goto END_OF_MAC;
  124.     END;
  125.     CALL Find_Cur_Window_Id;
  126.     Ignore_Case := True;
  127.     Active_Line := C_Line;
  128.  
  129. DO_MENU:
  130.  
  131.     Temp_Integer := 2;
  132.     Set_Global_Str('@WL1','/T=Select/K1=13/K2=28/R=1/LL=1');
  133.     Set_Global_Str('@WL2','/T=Cancel/K1=27/K2=1/R=0/LL=1');
  134.  
  135.     IF (Hide_Enable) THEN
  136.         Temp_Integer := 7;
  137.         Set_Global_Str('@WL3','/T=Delete/K1=0/K2=60/R=2/FL=Delete');
  138.         Set_Global_Str('@WL4','/T=Save/K1=0/K2=61/R=3/FL=Save');
  139.         Set_Global_Str('@WL5','/T=Hide window/K1=0/K2=62/R=4/FL=HidWin');
  140.         Set_Global_Str('@WL6','/T=Hide all/K1=0/K2=63/R=5/FL=HidAll');
  141.         Set_Global_Str('@WL7','/T=Delete/K1=0/K2=83/R=2/LL=1');
  142.     END;
  143.     ++Temp_Integer;
  144.     Set_Global_Str('@WL' + Str(Temp_Integer),'/T=Preview/K1=0/K2=64/R=6/FL=PrView');
  145.  
  146.     RM('WMENU /DBL=1/X=' + Str(Menu_X) + '/Y=' + Str(Menu_Y) + '/S=' +
  147.         Str(Active_Line) + '/W=78/OR=5/SM=' + Str(Letter_First) + '/EV=@WL/EV#=' + Str(Temp_Integer) + '/T=' +
  148.         Parse_Str('/WT=',MParm_Str));
  149.         Active_Line := C_Line;
  150.  
  151.     IF (Return_Int < 2) THEN
  152.         Goto MENU_EXIT;
  153.     END;
  154.  
  155.     IF (Return_Int = 2) THEN
  156. {Delete window}
  157.         Call Get_Cur_Window_Id;
  158.         Old_Window_Id := Cur_Window_Id;
  159.         Mark_Pos;
  160.         Eof;
  161.         IF (C_Col = 1) THEN
  162.             Up;
  163.         END;
  164.         Return_Int := (C_Line > 1);
  165.         Goto_Mark;
  166.         IF (Return_Int) THEN
  167.             Switch_Win_Id( Cur_Window_Id );
  168.             RM( 'DELWIN');
  169.         END;
  170.         Switch_Win_Id( Menu_Window_Id );
  171.         Menu_Window := Cur_Window;
  172.  
  173.         IF (Return_Int <> 0) THEN
  174.             Active_Line := C_Line;
  175.             CALL Rebuild_LIST;
  176.             Goto_Line( Active_Line );
  177.             Goto_Col(1);
  178.             IF AT_EOF THEN
  179.                 Up;
  180.             END;
  181.             CALL Get_Cur_Window_Id;
  182.             Active_Line := C_Line;
  183.             IF old_Window_Id = Start_Window_Id THEN
  184.                 Start_Window_Id := Cur_Window_Id;
  185.             END;
  186.         END;
  187.  
  188.         Goto DO_MENU;
  189.     End;
  190.  
  191.     IF (Return_Int = 3) THEN
  192. {Save file in window}
  193.         Active_Line := C_Line;
  194.         CALL Get_Cur_Window_Id;
  195.         Switch_Win_Id( Cur_Window_Id );
  196.         RM( 'MEUTIL1^SAVEFILE /R=4/BC=' + str(box_count) );
  197.         Switch_Window(Menu_Window);
  198.         CALL Rebuild_List;
  199.         Goto_Line( Active_Line );
  200.         Goto DO_MENU;
  201.     End;
  202.  
  203.     If (Return_Int = 4) Then
  204. {Hide a window}
  205.         Active_Line := C_Line;
  206.         CALL Get_Cur_Window_Id;
  207.         Switch_Win_Id( Cur_Window_Id );
  208.         IF (Window_Attr and $01) THEN
  209.             Window_Attr := Window_Attr and $FE;
  210.         Else
  211.             Window_Attr := Window_Attr or $01;
  212.         END;
  213.         CALL Rebuild_List;
  214.         Goto_Line( Active_Line );
  215.         Goto DO_MENU;
  216.     End;
  217.  
  218.     IF (Return_Int = 5) THEN
  219.         Temp_Integer := 1;
  220.         WHILE Temp_Integer < Menu_Window DO
  221.             Switch_Window( temp_integer );
  222.             IF (Window_Attr AND $80) = 0 THEN
  223.                 IF (Global_Hidden) THEN
  224.                     Window_Attr := Window_Attr and $FE;
  225.                 ELSE
  226.                     Window_Attr := Window_Attr or $01;
  227.                 END;
  228.             END;
  229.             ++Temp_Integer;
  230.         END;
  231.         Global_Hidden := Not(Global_Hidden);
  232.         Switch_Window( Menu_Window );
  233.         Active_Line := C_Line;
  234.         CALL Rebuild_List;
  235.         Goto_Line( Active_Line );
  236.         GOTO Do_Menu;
  237.     END;
  238.  
  239.     IF (Return_Int = 6) THEN
  240.         Call PREVIEW;
  241.     END;
  242.  
  243.     Goto DO_MENU;
  244.  
  245. MENU_EXIT:
  246.     IF (Return_Int = 1) THEN
  247.         CALL Get_Cur_Window_Id;
  248.         Switch_Win_Id( Cur_Window_Id );
  249.         Active_Window := Cur_Window_Id;
  250.         Return_Int := Cur_Window;
  251.     ELSE
  252.         Active_Window := Start_Window_Id;
  253.     END;
  254.     Goto END_OF_MAC;
  255.  
  256. PREVIEW:
  257.     CALL Get_Cur_Window_Id;
  258.     Window_Attr := Window_Attr or $81;
  259.     Switch_Win_Id(Cur_Window_Id);
  260.     RM('PreviewWindow');
  261.     IF RETURN_INT THEN
  262.         Cur_Window_Id := Window_Id;
  263.     END;
  264.     Call Find_Cur_Window_Id;
  265.     Active_Line := C_Line;
  266.     RET;
  267.  
  268.  
  269. REBUILD_LIST:
  270.     Switch_Window( Menu_Window );
  271.     Erase_Window;
  272.  
  273. No_Erase_List:
  274.     Switch_Window(1);
  275.     Working;
  276.     While (Cur_Window < Menu_Window) Do
  277.         Temp_Window := Cur_Window;
  278.         If (((Display_Current = True) or (Window_Id <> Active_Window)) and
  279.                     ((Display_Blocked_Only = False) or (Block_Stat <> False)))
  280.                     AND ((window_attr AND $80) = 0) THEN
  281.             Temp_String := '                                                                                             ';
  282.             Temp_String := Str_Ins(Truncate_Path(File_Name),Temp_String,Name_Col);
  283.             Temp_String := Str_Ins(window_name,Temp_String,Letter_Col);
  284.             Attr_str := '';
  285.  
  286. { START OF ASV MODIFICATION NO 1 }
  287.       IF (global_int(Truncate_Extension(Truncate_Path(File_Name)) + '.' +
  288.                      global_str('autosave_ext'))) THEN
  289.         File_Changed := TRUE;
  290.       END;
  291. { END OF ASV MODIFICATION NO 1 }
  292.  
  293.             If Read_Only THEN
  294.                 Attr_str := 'ReadOnly ';
  295.             ELSIF (File_Changed) THEN
  296.                 attr_str := 'Modified ';
  297.             END;
  298.             IF (Link_Stat) THEN
  299.                  attr_str := attr_str + 'Linked ';
  300.             END;
  301.             IF (Window_Attr and $01) THEN
  302.                  attr_str := attr_str + 'Hidden ';
  303.             END;
  304.             Temp_String := Str_Ins( attr_str, Temp_String, Attribute_Col );
  305.             Temp_String := Str_Ins(Get_Path(File_Name),Temp_String,Path_Col);
  306.             Temp_String := Str_Ins( str( window_id ), Temp_String, Id_Col );
  307.  
  308.             Switch_Window(Menu_Window);
  309.             Put_Line( Shorten_Str(Temp_String) );
  310.             Down;
  311.         End;
  312.         Switch_Window(Temp_Window + 1);
  313.     End;
  314.  
  315.     Switch_Window(Menu_Window);
  316.     RET;
  317.  
  318.  
  319. GET_Cur_Window_Id:
  320.     Switch_Window( Menu_Window );
  321.     VAL( Cur_Window_Id, Shorten_Str(copy(get_line,Id_Col,4)) );
  322.     RET;
  323.  
  324. FIND_Cur_Window_Id:
  325.     Switch_Window( Menu_Window );
  326.     TOF;
  327. FCWN_LOOP:
  328.     VAL( temp_integer, Shorten_Str(copy(get_line,Id_Col,4)) );
  329.     IF (temp_integer <> Cur_Window_Id) AND NOT(AT_EOF) THEN
  330.         DOWN;
  331.         Goto FCWN_LOOP;
  332.     END;
  333.     RET;
  334.  
  335. END_OF_MAC:
  336.     Refresh := False;
  337.  
  338.     Switch_Win_Id( Menu_Window_Id );
  339.  
  340.   Delete_Window;
  341.  
  342. ABORT:
  343.     Switch_Win_Id(Start_Window_Id);
  344.     Refresh := T_Refresh;
  345.     Pop_Labels;
  346.     Messages := True;
  347.     Undo_Stat := True;
  348. exit:
  349. END_MACRO;
  350.  
  351.  
  352. {*******************************MULTI-EDIT MACRO******************************
  353.  
  354. Name:  PreviewWindow
  355.  
  356. Description:  Allows to preview windows before actually moving into them
  357.             to edit.  Called only by WINMENU
  358.  
  359.                (C) Copyright 1989 by American Cybernetics, Inc.
  360. ******************************************************************************}
  361. $MACRO PreviewWindow;
  362.     Refresh := True;
  363.     Redraw;
  364.     WHILE ((Key1 <> 27) and (Key1 <> 13 )) DO
  365.         Make_Message('|26=switch window  <PgUp> <PgDn> <CtrlHome> <CtrlEnd> to browse.  <Enter>=select');
  366.         Read_Key;
  367.         IF (Key1 = 0) THEN
  368.             IF (key2 = 250) THEN  {process mouse event}
  369.                 IF (Mou_Last_X = Win_X2) THEN
  370.                     RM('MOUSE^HandleScrollBar');
  371.                 ELSE
  372.                     RM('Mouse^MouseInWindow');
  373.                     IF return_int THEN
  374.                         RM('Mouse^MOUSE_MOVE /V=1/H=1');
  375.                     END;
  376.                 END;
  377.             ELSIF (Key2 = 251) THEN
  378.                 IF (Mou_Last_X = Win_X2) THEN
  379.                     RM('MOUSE^GotoScrollBar');
  380.                     return_int := screen_num;
  381.                 ELSE
  382.                     RM('Mouse^MouseInWindow');
  383.                     IF return_int THEN
  384.                         RM('Mouse^MOUSE_MOVE /V=1/H=1');
  385.                     END;
  386.                 END;
  387.             ELSIF (Key2 = 119) THEN
  388.                 Tof;
  389.             ELSIF (Key2 = 73) THEN
  390.                 Page_Up;
  391.             ELSIF (Key2 = 117) THEN
  392.                 Eof;
  393.             ELSIF (Key2 = 81) THEN
  394.                 Page_Down;
  395.             ELSIF (Key2 = 77) THEN
  396.                 RM('NEXTWIN');
  397.                 REDRAW;
  398.             ELSIF (Key2 = 75) THEN
  399.                 RM('LASTWIN');
  400.                 REDRAW;
  401.             END;
  402. PREVIEW_EXIT:
  403.         END;
  404.     END;
  405.  
  406.     RETURN_INT := (Key1 = 13);
  407.     Refresh := False;
  408.     Make_Message('');
  409.  
  410. END_MACRO;
  411.  
  412. $MACRO FINDWIN;
  413. {******************************************************************************
  414.                                                     MULTI-EDIT MACRO FINDWIN
  415. Name: FINDWIN
  416.  
  417. Description:    Finds the next non hidden window
  418.  
  419.                     Copyright 1989 by American Cybernetics, Inc.
  420. ******************************************************************************}
  421.  
  422.     Def_Int(JX);
  423.  
  424.     JX := Cur_Window;
  425.     While ((Window_Attr and $81) <> 0) DO
  426.         switch_window(cur_window + 1);
  427.         if jx = cur_window then
  428.             IF (window_attr and $80) = 0 THEN
  429.                 Window_Attr := Window_Attr and $FE;
  430.                 Redraw;
  431.             END;
  432.             goto exit;
  433.         end;
  434.     end;
  435.  
  436. EXIT:
  437.  
  438. END_MACRO;
  439.  
  440. $MACRO NEXTWIN FROM EDIT TRANS;
  441. {******************************************************************************
  442.                                                                 MULTI-EDIT MACRO
  443. Name: NEXTWIN
  444.  
  445. Description:    Switch to next window
  446.  
  447.                     Copyright 1989 by American Cybernetics, Inc.
  448. ******************************************************************************}
  449.     DEF_INT( tr, old_win, nw );
  450.     old_win := cur_window;
  451.     TR := REFRESH;
  452.     REFRESH := FALSE;
  453.     SWITCH_WINDOW(CUR_WINDOW + 1);
  454.     RM( 'FINDWIN' );
  455.     nw := cur_window;
  456.     switch_window(old_win);
  457.     REFRESH := TRUE;
  458.     switch_window(nw);
  459.     refresh := tr;
  460. END_MACRO;
  461.  
  462. $MACRO LASTWIN FROM EDIT TRANS;
  463. {******************************************************************************
  464.                                                             MULTI-EDIT MACRO
  465. Name: NEXTWIN
  466.  
  467. Description:    Switch to last window
  468.  
  469.                                     Copyright 1989 by American Cybernetics, Inc.
  470. ******************************************************************************}
  471.  
  472.     Def_Int(JX);
  473.  
  474.     DEF_INT( tr, nw, ow );
  475.     TR := REFRESH;
  476.     ow := cur_window;
  477.     nw := cur_window;
  478.     REFRESH := FALSE;
  479.     SWITCH_WINDOW(CUR_WINDOW - 1);
  480.     JX := Cur_Window;
  481.     While ((Window_Attr and $81) <> 0) DO
  482.         switch_window(cur_window - 1);
  483.         if jx = cur_window then
  484.             goto exit;
  485.         end;
  486.     end;
  487.     nw := cur_window;
  488. EXIT:
  489.     SWITCH_WINDOW( ow );
  490.     REFRESH := TRUE;
  491.     SWITCH_WINDOW( nw );
  492.     REFRESH := TR;
  493. END_MACRO;
  494.  
  495. $MACRO ADJACENT_WIN TRANS;
  496. {******************************************************************************
  497.                                                             MULTI-EDIT MACRO
  498. Name: ADJACENT_WIN
  499.  
  500. Description:    On a split window, prompts for and switches to an adjacent
  501.                             window.
  502.  
  503.                                     Copyright 1989 by American Cybernetics, Inc.
  504. ******************************************************************************}
  505.     Def_Int(Active_Window,New_Window,Active_Screen,Active_X1,Active_Y1,Active_X2,
  506.                     Active_Y2,T_Refresh,Common,T_Common,Ev_Count);
  507.  
  508.     T_Refresh := Refresh;
  509.     Refresh := False;
  510.     Active_Window := Window_Id;
  511.     Active_Screen := Screen_Num;
  512.     New_Window := Active_Window;
  513.     Active_X1 := Win_X1;
  514.     Active_Y1 := Win_Y1;
  515.     Active_X2 := Win_X2;
  516.     Active_Y2 := Win_Y2;
  517.     Common := 0;
  518.     T_Common := 0;
  519.  
  520.     RM('SCREEN_SHARE');
  521.  
  522.     Put_Box(26,2, 55, 11, 0, m_b_color, 'Switch to window', true);
  523.  
  524.     IF (Return_Int = 0) THEN
  525. {We stuck the checking of return_int from SCREEN_SHARE down here to minimize
  526. the delay between the PUT_BOX and this message}
  527.         RM('MEERROR^Beeps /C=1');
  528.         Write('No adjacent windows',30,5,0,m_b_color);
  529.         Write('to switch to!',33,6,0,m_b_color);
  530.         Write('PRESS ANY KEY' ,34,10,0,m_b_color);
  531.         Read_Key;
  532.         Kill_Box;
  533.         Goto EXIT;
  534.     END;
  535.  
  536.     Ev_Count := 0;
  537.     IF (Active_Y1 > Min_Window_Row) THEN
  538. {Enable up movement}
  539.         ++Ev_Count;
  540.         Draw_Char(24, 39, 5, m_t_color, 1 );
  541.         Set_Global_Str('@WSEV#' + Str(Ev_Count), '/T=/KC=<UP>/K1=0/K2=72/R=3/W=4/X=38/Y=4');
  542.     END;
  543.     IF (Active_Y2 < Max_Window_Row) THEN
  544. {Enable down movement}
  545.         ++Ev_Count;
  546.         Draw_Char(25, 39, 7, m_t_color, 1 );
  547.         Set_Global_Str('@WSEV#' + Str(Ev_Count), '/T=/KC=<DOWN>/K1=0/K2=80/R=4/W=6/X=37/Y=8');
  548.     END;
  549.     IF (Active_X1 > 1) THEN
  550. {Enable left movement}
  551.         ++Ev_Count;
  552.         Draw_Char(27, 36, 6, m_t_color, 1 );
  553.         Set_Global_Str('@WSEV#' + Str(Ev_Count), '/T=/KC=<LEFT>/K1=0/K2=75/R=2/W=6/X=29/Y=6');
  554.     END;
  555.     IF (Active_X2 < Screen_Width) THEN
  556. {Enable right movement}
  557.         ++Ev_Count;
  558.         Draw_Char(26, 42, 6, m_t_color, 1 );
  559.         Set_Global_Str('@WSEV#' + Str(Ev_Count), '/T=/KC=<RIGHT>/K1=0/K2=77/R=1/W=7/X=44/Y=6');
  560.     END;
  561.     ++Ev_Count;
  562.     Set_Global_Str('@WSEV#' + Str(Ev_Count), '/T=Cancel/KC=<ESC>/K1=27/K2=1/R=0/W=11/X=35/Y=10');
  563.     RM('CheckEvents /M=2/G=@WSEV#/#=' + Str(Ev_Count));
  564.     Read_Key;
  565.  
  566.     if (key1 = 0) AND (key2 = 250) THEN
  567.         RM('CheckEvents /G=@WSEV#/M=1/#=' + Str(Ev_Count));
  568.     else
  569.         RM('CheckEvents /G=@WSEV#/M=0/#=' + Str(Ev_Count));
  570.     end;
  571.     Kill_Box;
  572.     IF return_int <> 0 THEN
  573.         return_int := parse_int('/R=', return_str);
  574.     END;
  575.  
  576. SEEK_WINDOW:
  577.     Switch_Window(Cur_Window + 1);
  578.     IF (Window_Id <> Active_Window) THEN
  579.         IF (Screen_Num = Active_Screen) THEN
  580.  
  581.             IF (Return_Int = 1) THEN
  582. {Move to window to the right}
  583.                 IF (Win_X2 > Active_X2) THEN
  584. {Determine if this window is right of active window}
  585.                     IF (Win_X1 <= Active_X2) THEN
  586. {Determine if this window's left border is at or left of active window's right
  587. border.}
  588.                         Goto CHECK_COMMON_VERTIC;
  589.                     END;
  590.                 END;
  591.             END;
  592.             IF (Return_Int = 2) THEN
  593. {Move to window to the left}
  594.                 IF (Win_X1 < Active_X1) THEN
  595. {Determine if this window is left of active window}
  596.                     IF (Win_X2 >= Active_X1) THEN
  597. {Determine if this window's right border is at or right of active window's left
  598. border.}
  599.                         Goto CHECK_COMMON_VERTIC;
  600.                     END;
  601.                 END;
  602.             END;
  603.             IF (Return_Int = 3) THEN
  604. {Move to window above}
  605.                 IF (Win_Y1 < Active_Y1) THEN
  606. {Determine if this window is above active window}
  607.                     IF (Win_Y2 >= Active_Y1) THEN
  608. {Determine if this window's lower border is at or below active window's upper
  609. border.}
  610.                         Goto CHECK_COMMON_HORIZ;
  611.                     END;
  612.                 END;
  613.             END;
  614.             IF (Return_Int = 4) THEN
  615. {Move to window below}
  616.                 IF (Win_Y2 > Active_Y2) THEN
  617. {Determine if this window is below active window}
  618.                     IF (Win_Y1 <= Active_Y2) THEN
  619. {Determine if this window's upper border is at or above active window's lower
  620. border.}
  621.                         Goto CHECK_COMMON_HORIZ;
  622.                     END;
  623.                 END;
  624.             END;
  625.         END;
  626.         Goto SEEK_WINDOW;
  627.     END;
  628.     Goto EXIT;
  629.  
  630. CHECK_COMMON_HORIZ:
  631.     T_Common := Active_X2 - Active_X1;
  632.     IF (Win_X1 > Active_X1) THEN
  633.         T_Common := T_Common - (Win_X1 - Active_X1);
  634.     END;
  635.     IF (Win_X2 < Active_X2) THEN
  636.         T_Common := T_Common - (Active_X2 - Win_X2);
  637.     END;
  638.     Goto CHECK_COMMON;
  639.  
  640. CHECK_COMMON_VERTIC:
  641.     T_Common := Active_Y2 - Active_Y1;
  642.     IF (Win_Y1 > Active_Y1) THEN
  643.         T_Common := T_Common - (Win_Y1 - Active_Y1);
  644.     END;
  645.     IF (Win_Y2 < Active_Y2) THEN
  646.         T_Common := T_Common - (Active_Y2 - Win_Y2);
  647.     END;
  648.  
  649. CHECK_COMMON:
  650.     IF (T_Common > Common) THEN
  651. {See if this window has more common width with the active than any previously
  652. looked at window}
  653.         Common := T_Common;
  654.         New_Window := Window_Id;
  655.     END;
  656.     Goto SEEK_WINDOW;
  657.  
  658. EXIT:
  659.     IF (Switch_Win_Id(New_Window)) THEN
  660.     END;
  661.     Refresh := T_Refresh;
  662.     Redraw;
  663. END_MACRO;
  664.  
  665. $MACRO SCREEN_SHARE TRANS;
  666. {******************************************************************************
  667.                                                             MULTI-EDIT MACRO
  668. Name: SCREEN_SHARE
  669.  
  670. Description:    Determines if the current window's screen is shared by another
  671.                             window.
  672.  
  673. Returns:
  674.                             Return_Int := True if the screen is shared
  675.  
  676.                                     Copyright 1989 by American Cybernetics, Inc.
  677. ******************************************************************************}
  678.     Def_Int(Active_Window,Active_Screen,T_refresh);
  679.  
  680.     T_refresh := refresh;
  681.     refresh := false;
  682.     Return_Int := 0;
  683.     Active_Window := Window_Id;
  684.     Active_Screen := Screen_Num;
  685.  
  686.     IF (Screen_Num = 0) THEN
  687.         Goto EXIT;
  688.     END;
  689.  
  690. CHECK_SCREEN_SHARING:
  691.     Switch_Window(Cur_Window + 1);
  692.     IF (Window_Id <> Active_Window) THEN
  693.         IF (Screen_Num = Active_Screen) THEN
  694.             Return_Int := 1;
  695.             Goto EXIT;
  696.         END;
  697.         Goto CHECK_SCREEN_SHARING;
  698.     END;
  699.  
  700. EXIT:
  701.     Switch_Win_Id(Active_Window);
  702.     refresh := t_refresh;
  703. END_MACRO;
  704.  
  705. $MACRO SWITWIN TRANS;
  706. {******************************************************************************
  707.                                                             MULTI-EDIT MACRO
  708. Name: SWITWIN
  709.  
  710. Description:    Brings up a menu of all windows for the purpose of switching
  711.                             directly to a new window without toggling through those in
  712.                             between
  713.  
  714.                                 Copyright 1989 by American Cybernetics, Inc.
  715. ******************************************************************************}
  716.  
  717.     RM( 'WINMENU /WT=WINDOW LIST/WH=Press <ENTER> to select window, <ESC> to return to original window./HS=WINLIST/HE=1/DB=0/DC=1' + MParm_Str);
  718.     If (Return_Int <> 0) Then
  719.         Switch_Window(Return_Int);
  720.     End;
  721.     Window_Attr := Window_Attr and $FE;
  722.     redraw;
  723. END_MACRO;
  724.  
  725. $MACRO COPYBL TRANS;
  726. {******************************************************************************
  727.                                                             MULTI-EDIT MACRO
  728. Name: COPYBL
  729.  
  730. Description:    Brings up a menu of all windows who have a block defined for
  731.                             inter-window block copying
  732.  
  733.                                 Copyright 1989 by American Cybernetics, Inc.
  734. ******************************************************************************}
  735.  
  736.     RM( 'WINMENU /WT=INTER-WINDOW COPY/WH=Select window to copy from and press <ENTER>, or <ESC> to abort/HS=BLOCKWIN/HE=0/DB=1/DC=0' + MParm_Str);
  737.     Window_Attr := Window_Attr and $FE;
  738.     If (Return_Int <> 0) Then
  739.         Window_Copy(Return_Int);
  740.     End;
  741. END_MACRO;
  742.  
  743. $MACRO MOVEBL TRANS;
  744. {******************************************************************************
  745.                                                             MULTI-EDIT MACRO
  746. Name: MOVEBL
  747.  
  748. Description:    Brings up a menu of all windows who have a block defined for
  749.                             inter-window block moving
  750.  
  751.                                 Copyright 1989 by American Cybernetics, Inc.
  752. ******************************************************************************}
  753.  
  754.     RM( 'WINMENU /WT=INTER-WINDOW MOVE/WH=Select window to move from and press <ENTER>, or <ESC> to abort/HS=BLOCKWIN/HE=0/DB=1/DC=0' + MParm_Str);
  755.     Window_Attr := Window_Attr and $FE;
  756.     If (Return_Int <> 0) Then
  757.         Window_Move(Return_Int);
  758.     End;
  759. END_MACRO;
  760.  
  761. $MACRO LINKWIN TRANS;
  762. {******************************************************************************
  763.                                                             MULTI-EDIT MACRO
  764. Name: LINKWIN
  765.  
  766. Description:    Brings up a menu of all windows for linking
  767.  
  768. Parameters:
  769.                             /X=        X coordinate for the menu box
  770.                             /Y=        Y coordinate for the menu box
  771.                             /BC=    Number of boxes to kill upon exit
  772.  
  773.                                 Copyright 1989 by American Cybernetics, Inc.
  774. ******************************************************************************}
  775.  
  776.     Def_Int(jx, mr);
  777.  
  778.     MR := Parse_Int('/Y=',MParm_Str);
  779.     IF MR = 0 THEN
  780.         MR := 2;
  781.     END;
  782.     IF (File_Changed) and (link_stat = 0) THEN
  783.         RM('USERIN^CHECKFILE /H=WINLINK/Y=' + str(mr) + '/X=' +
  784.                 parse_str('/X=',mparm_str));
  785.         IF return_int <= 0 THEN
  786.             Return_Int := 0;
  787.             GOTO Exit;
  788.         END;
  789.     END;
  790.  
  791.     jx := Parse_Int('/BC=',mparm_str);
  792.     while box_count > jx do
  793.         kill_box;
  794.     end;
  795.  
  796.     RM( 'WINMENU /WT=LINK WINDOW/WH=Select window to link to and press <ENTER>, or <ESC> to abort/HS=WINLINK/HE=0/DB=0/DC=0' + MParm_Str);
  797.     If (Return_Int <> 0) Then
  798.         Link_Window(Return_Int);
  799.         Return_Int := 1;
  800.         RM('WINDOW^SetWindowNames');
  801.     End;
  802.     Window_Attr := Window_Attr and $FE;
  803.  
  804.     return_int := 100;
  805. EXIT:
  806.  
  807. END_MACRO;
  808.  
  809. $MACRO SETBTMS TRANS;
  810. {******************************************************************************
  811.                                                             MULTI-EDIT MACRO
  812. Name: SETBTMS
  813.  
  814. Description:    Determines if a window should have a bottom line or not.
  815.  
  816. Parameters:
  817.                             /SN=    Screen number(Screen_Num) of window to check
  818.  
  819.                                 Copyright 1989 by American Cybernetics, Inc.
  820. ******************************************************************************}
  821.     Def_Int(jx, ts, found_count, t_win);
  822.     def_int( mx1, mx2, my1, my2 );
  823.  
  824.     t_win := cur_window;
  825.     ts := parse_int('/SN=', mparm_str);
  826.     found_count := 0;
  827.     mx1 := win_x1; mx2 := win_x2; my1 := win_y1; my2 := win_y2;
  828.     if ts <> 0 then
  829.         jx := 0;
  830.         while jx < window_count do
  831.             ++jx;
  832.             switch_window(jx);
  833.             if (screen_num = ts) then
  834.                 IF (win_y1 = my2) THEN
  835.                     IF (win_x1 < mx2) AND (win_x2 > mx1) THEN
  836.                         ++found_count;
  837.                         goto found_exit;
  838.                     END;
  839.                 END;
  840.             END;
  841.         END;
  842.     END;
  843.  
  844. found_exit:
  845.     switch_window( t_win );
  846.     w_bottom_line := (found_count = 0);
  847. END_MACRO;
  848.  
  849. $MACRO DELWIN TRANS;
  850. {******************************************************************************
  851.                                                             MULTI-EDIT MACRO
  852. Name: DELWIN
  853.  
  854. Description:    Deletes a window after checking to see if file has been saved
  855.  
  856. Parameters:
  857.                             /X=        X coordinate for the menu box
  858.                             /Y=        Y coordinate for the menu box
  859.                             /BC=    Number of boxes leave upon exit
  860.                             /NODEL=1  Perform all operations as if the window was
  861.                                                 deleted (like resizing other windows) but do not
  862.                                                 actually delete the window.
  863.  
  864.                                 Copyright 1989 by American Cybernetics, Inc.
  865. ******************************************************************************}
  866.  
  867.     Def_Int(jx, mr, x1,y1, x2,y2, ts, new_win, new_ts, tr);
  868.     def_int( w_id, mx1, mx2, my1, my2, no_del );
  869.  
  870.     Return_Int := False;
  871.     tr := refresh;
  872.     MR := Parse_Int('/Y=',MParm_Str);
  873.     IF MR = 0 THEN
  874.         MR := 2;
  875.     END;
  876.     new_win := 0;
  877.     IF (File_Changed) and (link_stat =0) THEN
  878.         RM('USERIN^CHECKFILE /H=WINDELETE/Y=' + str(mr) +
  879.                     '/X=' + parse_str('/X=', mparm_str));
  880.         IF return_int <= 0 THEN
  881.             return_int := false;
  882.             GOTO Exit;
  883.         END;
  884.     END;
  885.     jx := Parse_Int('/BC=',mparm_str);
  886.     while box_count > jx do
  887.         kill_box;
  888.     end;
  889.     Return_Int := True;
  890.     WORKING;
  891.     IF global_str('!WINZOOM#' + str(window_id)) <> '' THEN
  892.         RM('ZOOM');
  893.     END;
  894.     x1 := win_x1;
  895.     y1 := win_y1;
  896.     x2 := win_x2;
  897.     y2 := win_y2;
  898.     mx1 := screen_width;
  899.     mx2 := 0;
  900.     my1 := screen_length;
  901.     my2 := 0;
  902.     ts := screen_num;
  903.     w_id := window_id;
  904.     Refresh := False;
  905.  
  906.     IF (Cur_Window = Window_Count) THEN
  907.         switch_window( cur_window - 1);
  908.         new_win := window_id;
  909.         switch_window( cur_window + 1);
  910.     ELSE
  911.         switch_window( cur_window + 1);
  912.         new_win := window_id;
  913.         switch_window( cur_window - 1);
  914.     END;
  915.     no_del := parse_int('/NODEL=', mparm_str);
  916.     IF no_del = 0 THEN
  917.         set_global_str('!WINZOOM#' + str(window_id), '');
  918.         DELETE_WINDOW;
  919.     END;
  920.     new_ts := screen_num;
  921.     jx := 0;
  922.     refresh := false;
  923.     if ts <> 0 then
  924.         jx := 0;
  925.         while jx < window_count do
  926.             ++jx;
  927.                 switch_window(jx);
  928.                 if (screen_num = ts) AND (window_id <> w_id) then
  929.                     if (y2 = win_y1) and (x1 <= win_x1) and (x2 >= win_x2) then
  930.                         new_win := window_id;
  931.                         size_window( win_x1, y1, win_x2, win_y2);
  932.                         if (x1 = win_x1) then
  933.                             x1 := win_x2;
  934.                         end;
  935.                         if x2 = win_x2 then
  936.                             x2 := win_x1;
  937.                         end;
  938.                         if x2 < x1 then
  939.                             x2 := 0;
  940.                             x1 := 0;
  941.                             y2 := y1;
  942.                         end;
  943.                     end;
  944.                     if (y1 = win_y2) and (x1 <= win_x1) and (x2 >= win_x2) then
  945.                         new_win := window_id;
  946.                         size_window( win_x1, win_y1, win_x2, y2);
  947.                         if (x1 = win_x1) then
  948.                             x1 := win_x2;
  949.                         end;
  950.                         if x2 = win_x2 then
  951.                             x2 := win_x1;
  952.                         end;
  953.                         if x2 < x1 then
  954.                             x2 := 0;
  955.                             x1 := 0;
  956.                             y1 := y2;
  957.                         end;
  958.                     end;
  959.                     if (x1 = win_x2) and (y1 <= win_y1) and (y2 >= win_y2) then
  960.                         new_win := window_id;
  961.                         size_window( win_x1, win_y1, x2, win_y2);
  962.                         if (y1 = win_y1) then
  963.                             y1 := win_y2;
  964.                         end;
  965.                         if y2 = win_y2 then
  966.                             y2 := win_y1;
  967.                         end;
  968.                         if y2 < y1 then
  969.                             y2 := 0;
  970.                             y1 := 0;
  971.                             x1 := x2;
  972.                         end;
  973.                     end;
  974.                     if (x2 = win_x1) and (y1 <= win_y1) and (y2 >= win_y2) then
  975.                         new_win := window_id;
  976.                         size_window( x1, win_y1, win_x2, win_y2);
  977.                         if (y1 = win_y1) then
  978.                             y1 := win_y2;
  979.                         end;
  980.                         if y2 = win_y2 then
  981.                             y2 := win_y1;
  982.                         end;
  983.                         if y2 < y1 then
  984.                             y2 := 0;
  985.                             y1 := 0;
  986.                             x2 := x1;
  987.                         end;
  988.                     end;
  989.                     if win_x1 < mx1 then
  990.                         mx1 := win_x1;
  991.                     end;
  992.                     if win_x2 > mx2 then
  993.                         mx2 := win_x2;
  994.                     end;
  995.                     if win_y1 < my1 then
  996.                         my1 := win_y1;
  997.                     end;
  998.                     if win_y2 > my2 then
  999.                         my2 := win_y2;
  1000.                     end;
  1001.                 end;
  1002.         end;
  1003.         jx := 0;
  1004.         while jx < window_count do
  1005.             ++jx;
  1006.             switch_window(jx);
  1007.             if (screen_num = ts) then
  1008.                  w_bottom_line := (win_y2 >= my2);
  1009.             end;
  1010.         end;
  1011.     end;
  1012.  
  1013. out:
  1014.     IF no_del THEN
  1015.         switch_win_id( w_id );
  1016.     ELSE
  1017.         if switch_win_id(new_win) then end;
  1018.         RM( 'FINDWIN' );
  1019.         IF (window_attr AND $80) <> 0 THEN
  1020.             RM('CREATEWINDOW');
  1021.             RM('EXTSETUP /PRE=1');
  1022.         END;
  1023.         RM( 'WINDOW^SetWindowNames');
  1024.     END;
  1025.     return_int := 100;
  1026.     refresh := TR;
  1027.     New_Screen;
  1028.     EXIT:
  1029. END_MACRO;
  1030.  
  1031. $MACRO MAKEWIN TRANS;
  1032. {******************************************************************************
  1033.                                                             MULTI-EDIT MACRO
  1034. Name: MAKEWIN
  1035.  
  1036. Description:    Creates a new window after checking to see if the window limit
  1037.                             has been reached
  1038.  
  1039. Parameters:
  1040.                             /NL=1        Will not load a file or attempt a link.  Use this if you
  1041.                                             just want to create a window with a window name and you'll
  1042.                                             take care of loading a file yourself.
  1043.  
  1044.                             /L=1        Will cause the new window to be linked to the
  1045.                                             original window if the file is already loaded AND
  1046.                                             the user has requested the file NOT be reloaded.
  1047.  
  1048.                             /NC=1        Will bypass the creation of the window, and just prompt for
  1049.                                             loading a file and taking care of linking if the file is already
  1050.                                             loaded.
  1051.  
  1052.                                 Copyright 1989 by American Cybernetics, Inc.
  1053. ******************************************************************************}
  1054.  
  1055.     def_int( tw1, tw2, jx,nc );
  1056.  
  1057.     If Window_Count >= 100 THEN
  1058.         Error_Level := 1001;
  1059.         Goto Exit;
  1060.     END;
  1061.     nc := parse_int('/NC=', mparm_str);
  1062.     refresh := FALSE;
  1063.     IF nc = 0 THEN
  1064.         tw2 := window_id;
  1065.         RM('CreateWindow');
  1066.         tw1 := cur_window;
  1067.         switch_win_id( tw2);
  1068.         refresh := true;
  1069.         switch_window( tw1 );
  1070.         tw1 := window_id;
  1071.         RM('EXTSETUP /PRE=1');
  1072.     ELSE
  1073.         tw1 := window_id;
  1074.     END;
  1075.     IF (Parse_Int('/NL=',MParm_Str)) THEN
  1076.         Goto NL_EXIT;
  1077.     END;
  1078. Bypass_Create:
  1079.     RM('MEUTIL1^LOADFILE /X=' + Str(win_x1) + '/Y=' + str(win_y1));
  1080.     tw2 := window_id;
  1081.     if tw2 <> tw1 then
  1082.         refresh := false;
  1083.         jx := cur_window;
  1084.         if switch_win_id( tw1 ) then
  1085.             if caps(file_name) = '?NO-FILE?' then
  1086.                 IF parse_int('/L=',mparm_str) THEN
  1087.                     link_window( jx );
  1088.                     make_message('Window linked.');
  1089.                 ELSIF nc = 0 THEN
  1090.                     delete_window;
  1091.                     new_screen;
  1092.                     if switch_win_id( tw2 ) then
  1093.                     end;
  1094.                 END;
  1095.             end;
  1096.         end;
  1097.     end;
  1098. NL_EXIT:
  1099.     RM('WINDOW^SetWindowNames');
  1100. Exit:
  1101. END_MACRO;
  1102.  
  1103. $MACRO MOD_WIN TRANS;
  1104. {******************************************************************************
  1105.                                                              MULTI-EDIT MACRO
  1106.  
  1107. NAME:  MOD_WIN
  1108.  
  1109. DESCRIPTION:  Replaces the MODIFY_WINDOW macro command.
  1110.  
  1111.                         /MS=        Enables mouse support
  1112.                         /MM=        If 0, resize window.  If 1, move window.
  1113.  
  1114.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1115. ******************************************************************************}
  1116.     def_int( x1, x2, y1, y2, jx, old_refresh, tw, ts );
  1117.     def_int( nx1, nx2, ny1, ny2, w_id, jx, mouse_move, mm );
  1118.  
  1119.     def_int( ux1, ux2, uy1, uy2, move_mode, screen_share_count );
  1120.     def_str( sx1[20], sx2[20], sy1[20], sy2[20] );
  1121.  
  1122.     ts := screen_num;
  1123.     old_refresh := refresh;
  1124.     refresh := false;
  1125.     tw := cur_window;
  1126.     x1 := win_x1;
  1127.     y1 := win_y1;
  1128.     x2 := win_x2;
  1129.     y2 := win_y2;
  1130.  
  1131.  
  1132.     ux1 := 0;
  1133.     ux2 := 0;
  1134.     uy1 := 0;
  1135.     uy2 := 0;
  1136.     sx1 := '';
  1137.     sx2 := '';
  1138.     sy1 := '';
  1139.     sy2 := '';
  1140.     mouse_move := Parse_Int('/MS=', mparm_str);
  1141.     move_mode := Parse_Int('/MM=', mparm_str);
  1142.  
  1143.     screen_share_count := 0;
  1144.     jx := 0;
  1145.     IF screen_num <> 0 THEN
  1146.         while jx < window_count do
  1147.             ++jx;
  1148.             switch_window(jx);
  1149.             if screen_num = ts then
  1150.                 ++screen_share_count;
  1151.                 if (win_x2 = x1) then
  1152.                     if (win_y1 < y2) and (win_y2 >  y1) then
  1153.                         if (win_y1 < y1) or (win_y2 > y2) then
  1154.                             ux1 := 1;
  1155.                         else
  1156.                             sx1 := sx1 + char(cur_window);
  1157.                         end;
  1158.                     end;
  1159.                 end;
  1160.                 if (win_x1 = x2) then
  1161.                     if (win_y1 < y2) and (win_y2 >  y1) then
  1162.                         if (win_y1 < y1) or (win_y2 > y2) then
  1163.                             ux2 := 1;
  1164.                         else
  1165.                             sx2 := sx2 + char(cur_window);
  1166.                         end;
  1167.                     end;
  1168.                 end;
  1169.                 if (win_y2 = y1) then
  1170.                     if (win_x1 < x2) and (win_x2 >  x1) then
  1171.                         if (win_x1 < x1) or (win_x2 > x2) then
  1172.                             uy1 := 1;
  1173.                         else
  1174.                             sy1 := sy1 + char(cur_window);
  1175.                         end;
  1176.                     end;
  1177.                 end;
  1178.                 if (win_y1 = y2) then
  1179.                     if (win_x1 < x2) and (win_x2 >  x1) then
  1180.                         if (win_x1 < x1) or (win_x2 > x2) then
  1181.                             uy2 := 1;
  1182.                         else
  1183.                             sy2 := sy2 + char(cur_window);
  1184.                         end;
  1185.                     end;
  1186.                 end;
  1187.             end;
  1188.         end;
  1189.     END;
  1190.  
  1191.     switch_window(tw);
  1192.  
  1193.     IF (sx1 <> '') OR (sx2 <> '') OR (Sy1 <> '') OR (sy2 <> '') THEN
  1194.         ux1 := (sx1 = '');
  1195.         ux2 := (sx2 = '');
  1196.         uy1 := (sy1 = '');
  1197.         uy2 := (sy2 = '');
  1198.     END;
  1199.   RM('MOVE_WIN /M=1/X1=' + str(win_x1)+'/Y1=' + Str(win_y1) + '/X2=' +
  1200.         Str(win_x2) + '/Y2=' + Str(win_y2) + '/MS=' + str(mouse_move) +
  1201.         '/MX1=' + str( (Window_Attr AND $40) <> 0)  + '/MY1=' + Str(Min_Window_Row) + '/MX2=' +
  1202.         Str(Screen_Width + ((Window_Attr AND $40) = 0)) + '/MY2=' + Str(Max_Window_Row) +
  1203.         '/MM=' + str(mouse_move) +
  1204.         '/UX1=' + str(ux1) +
  1205.         '/UX2=' + str(ux2) +
  1206.         '/UY1=' + str(uy1) +
  1207.         '/UY2=' + str(uy2) + '/K=' + str((move_mode = 0))
  1208.         );
  1209.         return_int := 1;
  1210.     refresh := false;
  1211.     Size_Window(Parse_Int('/X1=',Return_Str),Parse_Int('/Y1=',Return_Str),
  1212.         Parse_Int('/X2=',Return_Str),Parse_Int('/Y2=',Return_Str));
  1213.  
  1214.     while svl(sx1) > 0 do
  1215.         switch_window( ascii(copy(sx1,1,1)));
  1216.         sx1 := str_del(sx1,1,1);
  1217.         size_window(win_x1,win_y1,Parse_Int('/X1=', return_str), win_y2);
  1218.     end;
  1219.     while svl(sx2) > 0 do
  1220.         switch_window( ascii(copy(sx2,1,1)));
  1221.         sx2 := str_del(sx2,1,1);
  1222.         size_window(Parse_Int('/X2=', return_str),win_y1,win_x2, win_y2);
  1223.     end;
  1224.     while svl(sy1) > 0 do
  1225.         switch_window( ascii(copy(sy1,1,1)));
  1226.         sy1 := str_del(sy1,1,1);
  1227.         size_window(win_x1,win_y1,win_x2, Parse_Int('/Y1=',return_str));
  1228.     end;
  1229.     while svl(sy2) > 0 do
  1230.         switch_window( ascii(copy(sy2,1,1)));
  1231.         sy2 := str_del(sy2,1,1);
  1232.         size_window(win_x1,Parse_Int('/Y2=', return_str),win_x2, win_y2);
  1233.     end;
  1234.     RM('setbtms /SN=' + str(ts));
  1235.     switch_window(tw);
  1236.     refresh := true;
  1237.     IF NOT( virtual_display ) THEN
  1238.         New_Screen;
  1239.     END;
  1240. END_MACRO;
  1241.  
  1242. $MACRO MOVE_WIN FROM ALL TRANS;
  1243. {*******************************MULTI-EDIT MACRO******************************
  1244.  
  1245. Name: Move_Win
  1246.  
  1247. Description: Used for moving a window without changing it's shape.
  1248.  
  1249. Paramters:  /X1=        Current upper left column
  1250.                         /Y1=        Current upper left row
  1251.                         /X2=        Current lower right column
  1252.                         /Y2=        Current lower right row
  1253.                         /MX1=        Mininum upper left column
  1254.                         /MX2=        Maximum upper left column
  1255.                         /MY1=        Mininum lower right row
  1256.                         /MY2=        Maximum lower right row
  1257.                         /UX1=        If 1, inhibits movement of top window border
  1258.                         /UX2=        If 1, inhibits movement of bottom window border
  1259.                         /UY1=        If 1, inhibits movement of left window border
  1260.                         /UY2=        If 1, inhibits movement of right window border
  1261.                         /MM=        0 = Move whole window
  1262.                                                 1 = Move upper left corner
  1263.                                                 2 = Move upper right corner
  1264.                                                 3 = Move lower left corner
  1265.                                                 4 = Move lower right cornter
  1266.                         /M=1        Use virtual screen moves.  This is available ONLY when
  1267.                                         sizing a text window in EDIT MODE.
  1268.                         /K=1        Use keyboard mode
  1269.  
  1270.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1271. ******************************************************************************}
  1272.     def_int( x1, x2, y1, y2, min_x, max_x, min_y, max_y,
  1273.                     ox1, oy1, ox2, oy2, mx, my, o_bl,
  1274.                     w, h, t_int, old_attr, move_count, mmode, t_s_color, t_b_color, shift_stat );
  1275.     def_int( mou_orig_x, mou_orig_y, mou_orig_x2, mou_orig_y2, k1, k2,
  1276.                     mm, ux1, ux2, uy1, uy2, min_width, min_height, use_key );
  1277.  
  1278.     working;
  1279.  
  1280. {    set_global_int('MENU_LEVEL', global_int('MENU_LEVEL') + 1);}
  1281.  
  1282.     mmode := parse_int('/M=', mparm_str ) AND virtual_display AND (mode = EDIT);
  1283.     use_key := parse_int('/K=', mparm_str );
  1284.  
  1285.     Min_X := Parse_Int('/MX1=',MParm_Str);
  1286.     IF ((Min_X < 0) or (Min_X > (Screen_Width + 1))) THEN
  1287.         Min_X := 0;
  1288.     END;
  1289.     Min_Y := Parse_Int('/MY1=',MParm_Str);
  1290.     IF ((Min_Y < 0) or (Min_Y > (Screen_Length + 1))) THEN
  1291.         Min_Y := 0;
  1292.     END;
  1293.     Max_X := Parse_Int('/MX2=',MParm_Str);
  1294.     IF ((Max_X < 1) or (Max_X > (Screen_Width + 1))) THEN
  1295.         Max_X := Screen_Width + 1;
  1296.     END;
  1297.     Max_Y := Parse_Int('/MY2=',MParm_Str);
  1298.     IF ((Max_Y < 1) or (Max_Y > (Screen_Length + 1))) THEN
  1299.         Max_Y := Screen_Length + 1;
  1300.     END;
  1301.  
  1302.     X1 := Parse_Int('/X1=',MParm_Str);
  1303.     IF ((X1 < Min_X) or (X1 > (Max_X - 1))) THEN
  1304.         X1 := Min_X;
  1305.     END;
  1306.     Y1 := Parse_Int('/Y1=',MParm_Str);
  1307.     IF ((Y1 < Min_Y) or (Y1 > (Max_Y - 1))) THEN
  1308.         Y1 := Min_Y;
  1309.     END;
  1310.     X2 := Parse_Int('/X2=',MParm_Str);
  1311.     IF ((X2 < (Min_X + 1)) or (X2 > Max_X)) THEN
  1312.         X2 := Max_X;
  1313.     END;
  1314.     Y2 := Parse_Int('/Y2=',MParm_Str);
  1315.     IF ((Y2 < (Min_Y + 1)) or (Y2 > Max_Y)) THEN
  1316.         Y2 := Max_Y;
  1317.     END;
  1318.  
  1319.     MIN_HEIGHT := parse_int('/H=', mparm_str );
  1320.     IF min_height = 0 THEN
  1321.         min_height := 1;
  1322.     END;
  1323.     MIN_WIDTH := parse_int('/W=', mparm_str );
  1324.     IF min_width = 0 THEN
  1325.         min_width := 2;
  1326.     END;
  1327.  
  1328.     ox1 := x1;
  1329.     oy1 := y1;
  1330.     ox2 := x2;
  1331.     oy2 := y2;
  1332.  
  1333.     ux1 := Parse_Int( '/UX1=', mparm_str);
  1334.     ux2 := Parse_Int( '/UX2=', mparm_str);
  1335.     uy1 := Parse_Int( '/UY1=', mparm_str);
  1336.     uy2 := Parse_Int( '/UY2=', mparm_str);
  1337.  
  1338.  
  1339.     mm := Parse_Int('/MM=', mparm_str);
  1340.  
  1341.     w := x2 - x1;
  1342.     h := y2 - y1;
  1343.     IF NOT(use_key) THEN
  1344.         mou_orig_x := mou_last_x - x1;
  1345.         mou_orig_y := mou_last_y - y1;
  1346.         mou_orig_x2 := x2 - mou_last_x;
  1347.         mou_orig_y2 := y2 - mou_last_y;
  1348.         IF mm = 0 THEN
  1349.             Mou_Set_Limits(min_x + mou_orig_x,min_y,max_x - w + mou_orig_x, max_y - h);
  1350.         ELSIF mm = 1 THEN
  1351.             ux2 := 1;
  1352.             uy2 := 1;
  1353.         ELSIF mm = 2 THEN
  1354.             ux1 := 1;
  1355.             uy2 := 1;
  1356.         ELSIF mm = 3 THEN
  1357.             ux2 := 1;
  1358.             uy1 := 1;
  1359.         ELSIF mm = 4 THEN
  1360.             ux1 := 1;
  1361.             uy1 := 1;
  1362.         END;
  1363.     END;
  1364.     t_int := box_count;
  1365.  
  1366.     set_virtual_display;
  1367.     IF mmode THEN
  1368.         old_attr := window_attr;
  1369.         window_attr := 1;
  1370.         o_bl := w_bottom_line;
  1371.         w_bottom_line := true;
  1372.         refresh := true;
  1373.         new_screen;
  1374.         override_screen_seg;
  1375.         save_box( 1, 1, screen_width, screen_length );
  1376.         reset_screen_seg;
  1377.         Clear_Virtual_Display;
  1378.         t_b_color := b_color;
  1379.         t_s_color := s_color;
  1380.         s_color := error_color;
  1381.         b_color := error_color;
  1382.         redraw;
  1383.         window_attr := old_attr;
  1384.         update_virtual_display;
  1385.     ELSE
  1386.         update_status_line;
  1387.         save_box( 1, 1, screen_width, screen_length );
  1388.     END;
  1389.  
  1390.     IF use_key THEN
  1391.         goto key_loop;
  1392.     END;
  1393.  
  1394. move_loop:
  1395.     call resize;
  1396. move_loop2:
  1397.     mx := mou_last_x;
  1398.     my := mou_last_y;
  1399.     Mou_Check_Status;
  1400.     IF (Mou_Last_Status and 1) THEN
  1401.         IF (mou_last_x <> mx) OR (mou_last_y <> my) THEN
  1402.             IF (mm = 0) THEN
  1403.                 IF (((X1 + mou_orig_x) <> Mou_Last_X) or (Y1 <> Mou_Last_Y)) THEN
  1404.                     X1 := Mou_Last_X - mou_orig_x;
  1405.                     Y1 := Mou_Last_Y;
  1406.                     x2 := x1 + w;
  1407.                     y2 := y1 + h;
  1408.                     goto move_loop;
  1409.                 END;
  1410.             ELSIF (mm = 1) THEN
  1411.                 IF (((X1 + mou_orig_x) <> Mou_Last_X) or ((Y1 + mou_orig_y) <> Mou_Last_Y)) THEN
  1412.                     X1 := Mou_Last_X - mou_orig_x;
  1413.                     Y1 := Mou_Last_Y - mou_orig_y;
  1414.                     call clip_x1;
  1415.                     call clip_y1;
  1416.                     goto move_loop;
  1417.                 END;
  1418.             ELSIF (mm = 2) THEN
  1419.                 IF (((X2 - mou_orig_x2) <> Mou_Last_X) or ((Y1 + mou_orig_y) <> Mou_Last_Y)) THEN
  1420.                     X2 := Mou_Last_X + mou_orig_x2;
  1421.                     Y1 := Mou_Last_Y - mou_orig_y;
  1422.                     call clip_x2;
  1423.                     call clip_y1;
  1424.                     goto move_loop;
  1425.                 END;
  1426.             ELSIF (mm = 3) THEN
  1427.                 IF (((X1 + mou_orig_x) <> Mou_Last_X) or ((Y2 - mou_orig_y2) <> Mou_Last_Y)) THEN
  1428.                     X1 := Mou_Last_X - mou_orig_x;
  1429.                     Y2 := mou_orig_y2 + mou_last_y;
  1430.                     call clip_x1;
  1431.                     call clip_y2;
  1432.                     goto move_loop;
  1433.                 END;
  1434.             ELSIF (mm = 4) THEN
  1435.                 IF (((X2 - mou_orig_x2) <> Mou_Last_X) or ((Y2 - mou_orig_y2) <> Mou_Last_Y)) THEN
  1436.                     X2 := Mou_Last_X + mou_orig_x2;
  1437.                     Y2 := mou_orig_y2 + mou_last_y;
  1438.                     call clip_x2;
  1439.                     call clip_y2;
  1440.                     goto move_loop;
  1441.                 END;
  1442.             END;
  1443.         END;
  1444.         goto move_loop2;
  1445.     END;
  1446.     goto move_done;
  1447.  
  1448.  
  1449. key_loop:
  1450.     call resize;
  1451. key_loop2:
  1452. loopxxx:
  1453.     read_key;
  1454.     K1 := Key1;
  1455.     K2 := Key2;
  1456.  
  1457. {This is to take care of key type ahead filling up the buffer}
  1458.     IF (Check_Key) THEN
  1459.         IF (key1 = k1) AND (key2 = k2) THEN
  1460.             goto loopxxx;
  1461.         ELSE
  1462.             push_key(key1,key2);
  1463.         END;
  1464.     END;
  1465.     R_AX := $0200;
  1466.     INTR($16);
  1467.     Shift_Stat := ((R_AX and $0003) > 0);
  1468.  
  1469.     IF (k1 = 0) OR ((k1 > 48) AND (k1 < 58)) THEN
  1470.         IF (k1 > 48) AND (k1 < 58) THEN
  1471.             shift_stat := TRUE;
  1472.         END;
  1473.         IF (k2 = 75) THEN
  1474.             IF (Shift_Stat) THEN
  1475.                 --x2;
  1476.                 call clip_x2;
  1477.             ELSIF (x1 > min_x) THEN
  1478.                 --x1;
  1479.                 --x2;
  1480.             END;
  1481.         ELSIF (k2 = 77) AND (x2 < max_x) THEN
  1482.             IF (Shift_Stat) THEN
  1483.                 ++x2;
  1484.             ELSE
  1485.                 ++x1;
  1486.                 ++x2;
  1487.             END;
  1488.         ELSIF (k2 = 72) THEN
  1489.             IF (Shift_Stat) THEN
  1490.                 --y2;
  1491.                 call clip_y2;
  1492.             ELSIF (y1 > min_y) THEN
  1493.                 --y1;
  1494.                 --y2;
  1495.             END;
  1496.         ELSIF (k2 = 80) THEN
  1497.             IF (Shift_Stat) THEN
  1498.                 IF y2 < max_y THEN
  1499.                     ++y2;
  1500.                 END;
  1501.             ELSE
  1502.                 IF NOT(uy2) THEN
  1503.                     IF y2 < max_y THEN
  1504.                         ++y2;
  1505.                         ++y1;
  1506.                     END;
  1507.                 ELSE
  1508.                     ++y1;
  1509.                     call clip_y1;
  1510.                 END;
  1511.             END;
  1512.         ELSIF (k1 = 0) AND (k2 = 239) THEN
  1513.             goto key_move_done;
  1514.         ELSE
  1515.             goto key_loop2;
  1516.         END;
  1517.         goto key_loop;
  1518.     ELSIF (k1 = 27) OR (k1 = 13) THEN
  1519.         goto key_move_done;
  1520.     END;
  1521.     goto key_loop2;
  1522.  
  1523. key_move_done:
  1524.         {turn scrolllock off}
  1525.     poke( 0, $417, peek(0, $417) and $EF );
  1526.     goto move_done;
  1527.  
  1528. resize:
  1529.     Call Check_Width;
  1530.     Call Check_Height;
  1531.     IF mmode THEN
  1532.         size_window( x1, y1, x2, y2 );
  1533.         restore_box;
  1534.         redraw;
  1535.         Update_Virtual_Window( 1, 1, screen_width, screen_length );
  1536.     ELSE
  1537.         restore_box;
  1538.       draw_outline(x1,y1,x2,y2,Error_Color);
  1539.         update_virtual_window( 1, 1, screen_width, screen_length );
  1540.         clear_virtual_display;
  1541.     END;
  1542.     ret;
  1543.  
  1544. move_done:
  1545.     while box_count > t_int do
  1546.         kill_box;
  1547.     END;
  1548.     Mou_Set_Limits( 1, 1, Screen_Width, Screen_Length );
  1549.     Return_Str :=
  1550.         '/X1=' + str(x1) +
  1551.         '/X2=' + str(x2) +
  1552.         '/Y1=' + str(Y1) +
  1553.         '/Y2=' + str(Y2);
  1554.     RETURN_INT := 1;
  1555.     IF mmode THEN
  1556.         w_bottom_line := o_bl;
  1557.         b_color := t_b_color;
  1558.         s_color := t_s_color;
  1559.         redraw;
  1560.     END;
  1561.     UPDATE_STATUS_LINE;
  1562.     update_virtual_display;
  1563.     reset_virtual_display;
  1564.     goto exit;
  1565.  
  1566. check_width:
  1567.         IF ux1 THEN
  1568.             x1 := ox1;
  1569.         END;
  1570.         IF ux2 THEN
  1571.             x2 := ox2;
  1572.         END;
  1573.         w := x2 - x1;
  1574.         ret;
  1575.  
  1576. check_height:
  1577.         IF uy1 THEN
  1578.             y1 := oy1;
  1579.         END;
  1580.         IF uy2 THEN
  1581.             y2 := oy2;
  1582.         END;
  1583.         h := y2 - y1;
  1584.         ret;
  1585.  
  1586.  
  1587. clip_x1:
  1588.         IF (x1 > (x2 - min_width)) THEN
  1589.             x1 := x2 - min_width;
  1590.         END;
  1591.         IF (x1 < min_x) THEN
  1592.             x1 := min_x;
  1593.         END;
  1594.         ret;
  1595.  
  1596. clip_x2:
  1597.         IF (x2 < (x1 + min_width)) THEN
  1598.             x2 := x1 + min_width;
  1599.         END;
  1600.         IF (x2 > max_x) THEN
  1601.             x2 := max_x;
  1602.         END;
  1603.         ret;
  1604.  
  1605. clip_y1:
  1606.         IF (y1 > (y2 - min_height)) THEN
  1607.             y1 := y2 - min_height;
  1608.         END;
  1609.         IF (y1 < min_y) THEN
  1610.             y1 := min_y;
  1611.         END;
  1612.         ret;
  1613.  
  1614. clip_y2:
  1615.         IF (y2 < (y1 + min_height)) THEN
  1616.             y2 := y1 + min_height;
  1617.         END;
  1618.         IF (y2 > max_y) THEN
  1619.             y2 := max_y;
  1620.         END;
  1621.         ret;
  1622.  
  1623. exit:
  1624. {    set_global_int('MENU_LEVEL', global_int('MENU_LEVEL') - 1);}
  1625. END_MACRO;
  1626.  
  1627. $MACRO ZOOM TRANS;
  1628. {******************************************************************************
  1629.                                                              MULTI-EDIT MACRO
  1630.  
  1631. NAME:  ZOOM
  1632.  
  1633. DESCRIPTION:  Replaces the ZOOM macro command.
  1634.  
  1635.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1636. ******************************************************************************}
  1637.     def_int( old_refresh, osn, jx, owin, t_id, min, x, y );
  1638.     def_str(tstr[80]);
  1639.  
  1640.     old_refresh := refresh;
  1641.     refresh := false;
  1642.     min := Parse_Int('/MINIMIZE=', mparm_str );
  1643.     tstr := global_str('!WINZOOM#' + str(window_id));
  1644.  
  1645.     osn := screen_num;
  1646.     IF min THEN
  1647.         IF (window_attr AND $40) = 0 THEN
  1648.             x := parse_int('/OMX=', tstr );
  1649.             y := parse_int('/OMY=', tstr );
  1650.             IF (x = 0) OR (y = 0) THEN
  1651.                 x := win_x1;
  1652.                 y := win_y1;
  1653.             END;
  1654.             IF parse_str('/X1=', tstr) <> '' THEN
  1655.                 tstr := '/X1=' + parse_str('/X1=', tstr ) +
  1656.                             '/Y1=' + parse_str('/Y1=', tstr ) +
  1657.                             '/X2=' + parse_str('/X2=', tstr ) +
  1658.                             '/Y2=' + parse_str('/Y2=', tstr );
  1659.             ELSE
  1660.                 tstr := '';
  1661.             END;
  1662.             tstr := tstr +
  1663.                           '/MX1=' + str(win_x1) +
  1664.                             '/MX2=' + str(win_x2) +
  1665.                             '/MY1=' + str(win_y1) +
  1666.                             '/MY2=' + str(win_y2) +
  1667.                             '/MSN=' + str(screen_num) + '/MZC=' + zoom_char;
  1668.             t_id := window_id;
  1669.             window_attr := $41;
  1670.             RM('WINDOW^DelWin /NODEL=1');
  1671.             switch_win_id(t_id );
  1672.             window_attr := $40;
  1673.             size_window( x, y, x + 14, y + 1 );
  1674.             zoom_char := '|24';
  1675.             set_global_str('!WINZOOM#' + str(window_id), tstr + '/ZC=' + zoom_char );
  1676.         END;
  1677.     elsif (window_attr AND $40) <> 0 THEN
  1678.         zoom_char := parse_str('/MZC=', tstr );
  1679.         window_attr := window_attr AND $BF;
  1680.         screen_num := parse_int('/MSN=', tstr);
  1681.         x := win_x1;
  1682.         y := win_y1;
  1683.         size_window( Parse_Int('/MX1=', tstr),
  1684.                                 Parse_Int('/MY1=', tstr),
  1685.                                 Parse_Int('/MX2=', tstr),
  1686.                                 Parse_Int('/MY2=', tstr) );
  1687.         IF parse_str('/X1=', tstr) <> '' THEN
  1688.             tstr := '/X1=' + parse_str('/X1=', tstr ) +
  1689.                         '/Y1=' + parse_str('/Y1=', tstr ) +
  1690.                         '/X2=' + parse_str('/X2=', tstr ) +
  1691.                         '/Y2=' + parse_str('/Y2=', tstr );
  1692.         ELSE
  1693.             tstr := '';
  1694.         END;
  1695.         tstr := tstr + '/OMX=' + str(x) + '/OMY=' + str(y);
  1696.         set_global_str('!WINZOOM#' + str(window_id), tstr + '/ZC=' + zoom_char );
  1697.     elsif (parse_str('/X1=', tstr) <> '') then
  1698.         screen_num := parse_int('/SN=', tstr);
  1699.         size_window( Parse_Int('/X1=', tstr),
  1700.                                 Parse_Int('/Y1=', tstr),
  1701.                                 Parse_Int('/X2=', tstr),
  1702.                                 Parse_Int('/Y2=', tstr) );
  1703.         tstr := '/OMX=' + str(parse_int('/OMX=', tstr )) +
  1704.                         '/OMY=' + str(parse_int('/OMY=', tstr ));
  1705.         set_global_str('!WINZOOM#' + str(window_id), tstr + '/ZC=' + zoom_char);
  1706.     zoom_char := '|24';
  1707.     elsif (win_x1 <> min_window_col) or (win_y1 <> min_window_row) or
  1708.             (win_x2 <> max_window_col) or (win_y2 <> max_window_row) then
  1709.         IF parse_str('/OMX=', tstr) <> '' THEN
  1710.             tstr := '/OMX=' + parse_str('/OMX=', tstr ) +
  1711.                         '/OMY=' + parse_str('/OMY=', tstr );
  1712.         ELSE
  1713.             tstr := '';
  1714.         END;
  1715.         tstr := tstr + '/X1=' + str(win_x1) +
  1716.                         '/X2=' + str(win_x2) +
  1717.                         '/Y1=' + str(win_y1) +
  1718.                         '/Y2=' + str(win_y2) +
  1719.                         '/OMX=' + str(parse_int('/OMX=', tstr )) +
  1720.                         '/OMY=' + str(parse_int('/OMY=', tstr )) +
  1721.                         '/SN=' + str(screen_num);
  1722.         screen_num := global_int('@SCREEN_COUNT') + 1;
  1723.         if screen_num <= 1 then
  1724.             screen_num := 2;
  1725.         end;
  1726.         set_global_int('@SCREEN_COUNT', screen_num );
  1727.         window_attr := window_attr AND $BF;
  1728.         size_window(min_window_col, min_window_row, max_window_col, max_window_row );
  1729.        zoom_char := '|25';
  1730.         set_global_str('!WINZOOM#' + str(window_id), tstr + '/ZC=' + zoom_char );
  1731.     else
  1732.         goto exit;
  1733.     end;
  1734.  
  1735.     owin := cur_window;
  1736.     jx := 0;
  1737.     WHILE jx < window_count DO
  1738.         ++jx;
  1739.         switch_window( jx );
  1740.         IF ((window_attr AND $81) = 0) AND (screen_num = osn) THEN
  1741.             RM('SETBTMS');
  1742.         END;
  1743.     END;
  1744.     switch_window( owin );
  1745.     new_screen;
  1746. exit:
  1747.     refresh := old_refresh;
  1748. END_MACRO;
  1749.  
  1750.  
  1751. $MACRO SPLITWIN TRANS;
  1752. {*******************************MULTI-EDIT MACRO******************************
  1753.  
  1754. Name: SPLITWIN
  1755.  
  1756. Description: Splits a window horizontally or vertically.
  1757.  
  1758. Parameters:  Prompts the user if no parameters are passed.
  1759.  
  1760.                         /DIR=str    Direction (str is NOT case sensitive)
  1761.                                     str = Up
  1762.                                     str = Down
  1763.                                     str = Left
  1764.                                     str = Right
  1765.                         /LN#=n   Number of lines (or columns) in the new window.
  1766.                                      0 means use half of the original window.
  1767.  
  1768.                              (C) Copyright 1989 by American Cybernetics, Inc.
  1769. ******************************************************************************}
  1770.     Def_Int( Old_Refresh, x,y,j1, j2, ty1, ty2, newx1,newy1, newx2, newy2 );
  1771.         def_int( oldx1, oldx2, oldy1, oldy2, old_win, cur_screen,tw1,tw2 );
  1772.  
  1773.         def_int( w_id );
  1774.         def_int( num_lines, nl1, nl2, event_count );
  1775.         def_str( direction[10], event_str[20] );
  1776.  
  1777.         If Window_Count >= 100 THEN
  1778.             Error_Level := 1001;
  1779.             Goto Exit;
  1780.         END;
  1781.  
  1782.         direction := caps(parse_str('/DIR=', mparm_str));
  1783.         num_lines := parse_int('/LN#=', mparm_str);
  1784.  
  1785.         Old_Refresh := Refresh;
  1786.         Refresh := False;
  1787.  
  1788.         w_id := window_id;
  1789.  
  1790.         oldx1 := win_x1;
  1791.         oldx2 := win_x2;
  1792.         oldy1 := win_y1;
  1793.         oldy2 := win_y2;
  1794.  
  1795.         newx1 := oldx1;
  1796.         newx2 := oldx2;
  1797.         newy1 := oldy1;
  1798.         newy2 := oldy2;
  1799.         old_win := cur_window;
  1800.  
  1801.         if num_lines = 0 then
  1802.             nl1 := (newy2 - newy1) / 2;
  1803.             nl2 := (newx2 - newx1) / 2;
  1804.         else
  1805.             nl1 := num_lines;
  1806.             nl2 := num_lines;
  1807.         end;
  1808.  
  1809.         if direction <> '' then
  1810.             goto loopout;
  1811.         end;
  1812.     x := win_x1 + (((win_x2 - win_x1) / 2) - 15);
  1813.     IF x < 1 THEN
  1814.       x := 1;
  1815.     END;
  1816.     IF (x + 29) > screen_width THEN
  1817.       x := screen_width - 29;
  1818.     END;
  1819.     y := win_y1 + (((win_y2 - win_y1) / 2) - 5);
  1820.     IF (y < min_window_row) THEN
  1821.       y := min_window_row;
  1822.     END;
  1823.     IF (y < 2) THEN
  1824.       y := 2;
  1825.     END;
  1826.     IF (y + 9) > (max_window_row - 1) THEN
  1827.       y := (max_window_row - 10);
  1828.     END;
  1829.         event_count := 5;
  1830.     Set_Global_Str('@WSEV#1', '/T=/KC=<RIGHT>/K1=0/K2=77/R=1/W=7/X=' + str( x + 18){44} + '/Y=' + str(y + 4){6});
  1831.     Set_Global_Str('@WSEV#2', '/T=/KC=<LEFT>/K1=0/K2=75/R=2/W=6/X=' + str( x + 3) + '/Y=' + str(y + 4){/X=29/Y=6});
  1832.     Set_Global_Str('@WSEV#3', '/T=/KC=<UP>/K1=0/K2=72/R=3/W=4/X=' + str( x + 12) + '/Y=' + str(y + 2){/X=38/Y=4});
  1833.     Set_Global_Str('@WSEV#4', '/T=/KC=<DOWN>/K1=0/K2=80/R=4/W=6/X=' + str( x + 11) + '/Y=' + str(y + 6){/X=37/Y=8});
  1834.     Set_Global_Str('@WSEV#5', '/T=Cancel/KC=<ESC>/K1=27/K2=1/R=0/W=11/X=' + str( x + 9) + '/Y=' + str(y + 8){/X=35/Y=10});
  1835.     Put_Box(x,y, x + 29, y+9, 0, m_b_color, 'Indicate side to split', true);
  1836.     Draw_Char(24, x + 13, y + 3, m_t_color, 1 );
  1837.     Draw_Char(25, x + 13, y + 5, m_t_color, 1 );
  1838.     Draw_Char(27, x + 10, y + 4, m_t_color, 1 );
  1839.     Draw_Char(26, x + 16, y + 4, m_t_color, 1 );
  1840.         RM('CheckEvents /M=2/G=@WSEV#/#=5');
  1841. loop:
  1842.         read_key;
  1843.     return_int := 0;
  1844.     if (key1 = 0) AND (key2 = 250) THEN
  1845.         RM('CheckEvents /G=@WSEV#/#=5/M=1');
  1846.     else
  1847.         RM('CheckEvents /G=@WSEV#/#=5/M=0');
  1848.     end;
  1849.     IF return_int <> 0 THEN
  1850.         return_int := parse_int('/R=', return_str);
  1851.         set_global_int('s_direction',return_int);  {MODIFIED 10-3-89 BY SUE FOR USE WITH FILE COMPARISON MACRO}
  1852.         IF return_int = 0 then
  1853.             kill_box;
  1854.             goto exit;
  1855.         elsIF return_int = 3 then
  1856.             direction := 'UP';
  1857.         elsif return_int = 4 then
  1858.             direction := 'DOWN';
  1859.         elsif return_int = 1 then
  1860.             direction := 'RIGHT';
  1861.         elsif return_int = 2 then
  1862.             direction := 'LEFT';
  1863.         else
  1864.             goto loop;
  1865.         end;
  1866.         goto loopout;
  1867.     end;
  1868.     goto loop;
  1869.  
  1870. loopout:
  1871.         kill_box;
  1872.  
  1873.             if direction = 'UP' then
  1874.                 newy2 := newy1 + nl1;
  1875.                 oldy1 := newy2;
  1876.             else
  1877.                 if direction = 'DOWN' then
  1878.                     newy1 := newy2 - nl1;
  1879.                     oldy2 := newy1;
  1880.                 else
  1881.                     if direction = 'RIGHT' then
  1882.                         newx1 := newx2 - nl2;
  1883.                         oldx2 := newx1;
  1884.                     else
  1885.                         if direction = 'LEFT' then
  1886.                             newx2 := newx1 + nl2;
  1887.                             oldx1 := newx2;
  1888.                         else
  1889.                             goto exit;
  1890.                         end;
  1891.                     end;
  1892.                 end;
  1893.             end;
  1894.  
  1895.         Size_Window(oldx1,oldy1,oldx2,oldy2);
  1896.         IF direction = 'DOWN' THEN
  1897.             w_bottom_line := false;
  1898.         END;
  1899.         if screen_num = 0 then
  1900.             screen_num := global_int('@SCREEN_COUNT') + 1;
  1901.             if screen_num <= 1 then
  1902.                 screen_num := 2;
  1903.             end;
  1904.             set_global_int('@SCREEN_COUNT', screen_num );
  1905.         end;
  1906.         cur_screen := screen_num;
  1907.         refresh := true;
  1908.         redraw;
  1909.         refresh := false;
  1910.         switch_window( window_count );
  1911.         Create_Window;
  1912.         RM('EXTSETUP /PRE=1');
  1913.         Size_Window(newx1,newy1,newx2,newy2);
  1914.  
  1915.         screen_num := cur_screen;
  1916.  
  1917.         RM('setbtms /SN=' + str(cur_screen));
  1918.         j2 := cur_window;
  1919.  
  1920.         Refresh := true;
  1921.         Redraw;
  1922.         tw1 := window_id;
  1923.         RM('MEUTIL1^LOADFILE /X=' + str(win_x1) + '/Y=' + str(win_y1));
  1924.         if return_int = 0 then
  1925.             link_window(old_win);
  1926.             make_message( 'Window linked.');
  1927.         else
  1928.             tw2 := window_id;
  1929.             j1 := cur_window;
  1930.             if tw2 <> tw1 then
  1931.                 refresh := false;
  1932.                 if switch_win_id( tw1 ) then
  1933.                     if caps(file_name) = '?NO-FILE?' then
  1934.                         link_window( j1 );
  1935.                         make_message( 'Window linked.');
  1936.                     end;
  1937.                 end;
  1938.             end;
  1939.         end;
  1940.         RM('WINDOW^SetWindowNames');
  1941. Exit:
  1942.         RM('CheckEvents /G=@WSEV#/#=5/M=3');
  1943. END_MACRO;
  1944.  
  1945.  
  1946. {*******************************MULTI-EDIT MACRO******************************
  1947.  
  1948. Name: SetWindowNames
  1949.  
  1950. Description:  Goes through the entire set of windows currently loaded
  1951.         and assigns alphabetic WINDOW_NAMEs to them, skipping any with the
  1952.         INVISIBLE (Bit 7) attribute.
  1953.  
  1954.                (C) Copyright 1989 by American Cybernetics, Inc.
  1955. ******************************************************************************}
  1956. $MACRO SetWindowNames;
  1957.  
  1958.     DEF_INT( tw, jx, jy,jz, t_refresh );
  1959.  
  1960.     t_refresh := refresh;
  1961.     refresh := FALSE;
  1962.     tw := cur_window;
  1963.  
  1964.     jx := 0;
  1965.     jy := 0;
  1966.     jz := 0;
  1967.     WHILE jx < window_count DO
  1968.         ++jx;
  1969.         switch_window(jx);
  1970.         IF (window_attr AND $80) = 0 THEN
  1971.             ++jy;
  1972.             IF jy > 26 THEN
  1973.                 jy := 1;
  1974.                 ++jz;
  1975.             END;
  1976.             IF jz > 0 THEN
  1977.                 window_name := CHAR( jz + 48) + CHAR( jy + 64 );
  1978.             ELSE
  1979.                 window_name := CHAR( jy + 64 );
  1980.             END;
  1981.         END;
  1982.     END;
  1983.  
  1984.     switch_window( tw );
  1985.     refresh := t_refresh;
  1986.  
  1987. END_MACRO;
  1988.  
  1989.  
  1990. $MACRO WINOP TRANS;
  1991. {*******************************MULTI-EDIT MACRO******************************
  1992.  
  1993. Name: WINOP
  1994.  
  1995. Description:  Performs various window operations
  1996.  
  1997. Parameters:        /T=0    Create window
  1998.                             /T=1  Delete window
  1999.                             /T=2  Hide window
  2000.                             /T=3  Window list
  2001.                             /T=4  Split window
  2002.                             /T=5  Resize window
  2003.                             /T=6  Link window
  2004.                             /T=7  Unlink window
  2005.                             /T=8  Zoom window
  2006.  
  2007.                              (C) Copyright 1989 by American Cybernetics, Inc.
  2008. ******************************************************************************}
  2009.     def_int( tt );
  2010.     Def_Int(jx, mr);
  2011.  
  2012.     tt := Parse_Int('/T=', mparm_str);
  2013.  
  2014.     if tt = 0 then
  2015.         RM('MAKEWIN');
  2016.         goto exit;
  2017.     end;
  2018.  
  2019.     if tt = 1 then
  2020.         RM('DELWIN ' + mparm_str);
  2021.     end;
  2022.  
  2023.     if tt = 2 then
  2024.         Window_Attr := Window_Attr or $01;
  2025.         RM( 'FindWin' );
  2026.         New_Screen;
  2027.         goto exit;
  2028.     end;
  2029.  
  2030.     if tt = 3 then
  2031.         RM( 'SwitWin' );
  2032.         goto exit;
  2033.     end;
  2034.  
  2035.     if tt = 4 then
  2036.         RM( 'SPLITWIN' );
  2037.         goto exit;
  2038.     end;
  2039.  
  2040.     if tt = 5 then
  2041.         RM('MOD_WIN');
  2042.     end;
  2043.  
  2044.     if tt = 6 then
  2045.         RM('LINKWIN ' + mparm_str);
  2046.     end;
  2047.  
  2048.     if tt = 7 then
  2049.         unlink_window;
  2050.     end;
  2051.  
  2052.     if tt = 8 then
  2053.         RM('zoom');
  2054.     end;
  2055.  
  2056. Exit:
  2057. END_MACRO;
  2058.