setwindow.red 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. Procedure OneWindow();
  2. % Dispatch to this routine to enter one-window mode.
  3. if MajorWindowCount neq 1 then % If not already one-window
  4. <<
  5. % Setup windows for one window mode.
  6. Setup_Windows
  7. list(
  8. % Window one looks into current buffer, other arguments are
  9. % location of upper left corner, and the size (0 indexed).
  10. WindowDescriptor(1, CurrentBufferName,
  11. ScreenBase, % Upper left corner
  12. % Size uses entire width, leaves room for
  13. % three one line windows at the bottom
  14. Coords(Column ScreenDelta,
  15. Row(ScreenDelta) - 3)),
  16. % Window 1001 looks into the "mode line" buffer.
  17. WindowDescriptor(1001, 'MODE_LINE,
  18. % Base is two lines above bottom
  19. Coords(Column ScreenBase,
  20. Row ScreenBase + Row ScreenDelta - 2),
  21. % a single line (so delta row = 0)
  22. Coords(Column ScreenDelta, 0)),
  23. % Window 1002 looks into the "prompt line" buffer.
  24. WindowDescriptor(1002, 'PROMPT_BUFFER,
  25. % Base is one line above bottom
  26. Coords(Column ScreenBase,
  27. Row ScreenBase + Row ScreenDelta - 1),
  28. % a single line (so delta row = 0)
  29. Coords(Column ScreenDelta, 0)),
  30. % Window 1003 looks into the "message buffer", used for error
  31. % messages and general stuff.
  32. WindowDescriptor(1003, 'MESSAGE_BUFFER,
  33. % Base is at bottom
  34. Coords(Column ScreenBase,
  35. Row ScreenBase + Row ScreenDelta),
  36. % a single line (so delta row = 0)
  37. Coords(Column ScreenDelta, 0))
  38. );
  39. % Wierd, the code seems to usually work without the following call.
  40. % Needs to be rethought.
  41. SelectWindow 1;
  42. FullRefresh(); % A kludge, sigh.
  43. MajorWindowCount := 1;
  44. >>;
  45. FLUID '(Fraction2);
  46. Symbolic Procedure TwoWindows();
  47. % Dispatch to this routine to enter two-window mode.
  48. if MajorWindowCount neq 2 then
  49. begin scalar MidPoint,frac1,lines;
  50. % Use roughly half (later to be a variable) the screen, allow for a
  51. % dividing line of dashes and 3 one line windows at the bottom.
  52. % MidPoint is location of dividing line of dashes, wrt ScreenBase.
  53. frac1:=Fraction2;
  54. if not(FloatP frac1 and frac1<0.9 and frac1 >0.1) then frac1:=0.5;
  55. lines:=(Row ScreenDelta - 3);
  56. MidPoint := Fix (frac1 * lines);
  57. if Midpoint <= 2 then Midpoint:=2;
  58. Setup_Windows
  59. list(
  60. % Window one looks into current buffer
  61. WindowDescriptor(1, CurrentBufferName,
  62. ScreenBase,
  63. Coords(Column ScreenDelta,
  64. MidPoint - 1)),
  65. % Window 1000 looks into the dividing line of dashes
  66. WindowDescriptor(1000, 'DASHES,
  67. Coords(Column ScreenBase, MidPoint),
  68. Coords(Column ScreenDelta, 0)),
  69. % Window 2 always looks into the 'ALTERNATE_WINDOW buffer,
  70. % until we can figure out a better way of handling the
  71. % situation.
  72. WindowDescriptor(2, 'ALTERNATE_WINDOW,
  73. Coords(Column ScreenBase, MidPoint + 1),
  74. % Run down to the bottom, minus 3 one line
  75. % windows.
  76. Coords(Column ScreenDelta,
  77. Row ScreenDelta - MidPoint - 4)),
  78. % Window 1001 looks into the "mode line" buffer.
  79. WindowDescriptor(1001, 'MODE_LINE,
  80. % Base is two lines above bottom
  81. Coords(Column ScreenBase,
  82. Row ScreenBase + Row ScreenDelta - 2),
  83. % a single line (so delta row = 0)
  84. Coords(Column ScreenDelta, 0)),
  85. % Window 1002 looks into the "prompt line" buffer.
  86. WindowDescriptor(1002, 'PROMPT_BUFFER,
  87. % Base is one line above bottom
  88. Coords(Column ScreenBase,
  89. Row ScreenBase + Row ScreenDelta - 1),
  90. % a single line (so delta row = 0)
  91. Coords(Column ScreenDelta, 0)),
  92. % Window 1003 looks into the "message buffer", used for error
  93. % messages and general stuff.
  94. WindowDescriptor(1003, 'MESSAGE_BUFFER,
  95. % Base is at bottom
  96. Coords(Column ScreenBase,
  97. Row ScreenBase + Row ScreenDelta),
  98. % a single line (so delta row = 0)
  99. Coords(Column ScreenDelta, 0))
  100. );
  101. % Wierd, the code seems to usually work without the following call.
  102. % Needs to be rethought.
  103. SelectWindow 1;
  104. FullRefresh(); % A kludge, sigh.
  105. MajorWindowCount := 2;
  106. end;
  107. Fraction2 :=0.5;
  108. procedure ResetEmode(rows,cols,f);
  109. if cols >=10 and cols<=79
  110. and rows>=6 and rows <=60 then
  111. <<ScreenDelta:= Cols . Rows;
  112. If FloatP F and F>=0.1 and F <=0.9 then Fraction2:=F;
  113. if MajorWindowCount =1 then <<MajorWindowCount:=0;
  114. OneWindow()>>
  115. else
  116. if MajorWindowCount = 2 then <<MajorWindowCount:=0;
  117. TwoWindows()>>
  118. >>;
  119. procedure resetrows(r);
  120. resetScreen(car ScreenDelta,r);
  121. procedure SetEmode(rows,cols,f);
  122. Begin Scalar !*EMODE;
  123. if cols >=10 and cols<=79
  124. and rows>=6 and rows <=60 then
  125. ScreenDelta:= Cols . Rows;
  126. If FloatP F and f>=0.1 and f<=0.9 then Fraction2:=f;
  127. !*EMODE:=T;
  128. FreshEmode();
  129. End;