tldm-universe/Ardent/UV/BP/MTF.FIXSCR.B

153 lines
4.3 KiB
Plaintext
Raw Permalink Normal View History

2024-09-09 21:51:08 +00:00
Subroutine MTF.FIXSCR.B(x.orig, y.orig, width, depth)
******************************************************************************
*
* Fix up screen after clearing a sub-menu
*
* Module %M% Version %I% Date %H%
*
* (c) Copyright 1998 Ardent Software Inc. - All Rights Reserved
* This is unpublished proprietary source code of Ardent Software Inc.
* The copyright notice above does not evidence any actual or intended
* publication of such source code.
*
*******************************************************************************
*
* Maintenence log - insert most recent change descriptions at top
*
* Date.... GTAR# WHO Description.........................................
* 10/14/98 23801 SAP Change copyrights.
* 05/13/91 8345 DTM Changed print to tprint
* 06/28/90 7236 JWT New MOTIF like new capability
*
*******************************************************************************
* This subroutine repaints MOTIF menu objects on the terminal screen
* that have been partially obscured by a submenu after the
* submenu has been erased.
*
* Arguments to the function are:
*
* x.orig - the x (horizontal) anchor point of the area to fix
*
* y.orig - the y (vertical) anchor point of the area to fix
*
* width - the width (horizontal) size of the area to fix
*
* depth - the depth (vertical size of the area to fix
*
* The routine looks at all the stacked menus and marks those that overlap
* the screen area specified by the arguments. Then the marked
* menu objects are repainted in sequence to restore the screen.
* This is obviously a naive approach to the problem, but we are
* operating under the assumption that a well designed menu
* application will not have a large number of submenus that need
* repainting. The variable fix.flag is used to mark the menu
* items for repainting.
id = "%W%"
$include UNIVERSE.INCLUDE MTF.INCL.H
* Initialize the repaint flags
dim fix.flag(stk.top)
mat fix.flag = 0
10: * look for over lapping menu objects, note that the loop starts at the
* second stack item, since the first item, the menubar, never need to
* be redrawn.
for i = 2 to stk.top
* Only check menu object if it has not been marked.
if not(fix.flag(i))
then
* If the x anchor point is to the right of the left boundary
* of the submenu box, this submenu can be ignored.
if x.orig <= stk.x.orig(i) + stk.width(i) - 1
then
* If the right boundary of the refresh area is to the
* left of the left boundary of the submenu box, this
* submenu can be ignored.
if x.orig + width -1 >= stk.x.orig(i)
then
* If the y anchor point is below the lower
* boundary of the submenu box, this submenu
* can be ignored.
if y.orig <= stk.y.orig(i) + stk.choices(i) + 1
then
* If the lower boundary of the fresh
* area is above the upper boundary of
* the submenu box, this submenu can
* be ignored.
if y.orig + depth + 1 >= stk.y.orig(i)
then
* When we get here we know that
* the current menu must overlap
* the repaint region because it
* has't been eliminated by any
* of the restrictions above.
fix.flag(i) = 1
end
end
end
end
end
next i
* If we found any menu object to repaint, check for any object that may require
* repainting as a result of repainting the one we already found.
for i = 2 to stk.top
if fix.flag(i) = 1
then
* The fix flag is changed from 1 to two so that we know we
* have already processed the menu object next time we come
* through this loop.
fix.flag(i) = 2
* move the repaint region to be this menu's boundary area.
x.orig = stk.x.orig(i)
y.orig = stk.y.orig(i)
width = stk.width(i)
depth = stk.choices(i)
* go and process this menu area
goto 10:
end
next i
* now redraw all marked menu objects
for i = 2 to stk.top
if fix.flag(i)
then
call *MTF.PAINT.B(VERTICAL, stk.x.orig(i),
stk.y.orig(i), stk.width(i), stk.choices(i),
stk.items(i))
* don't forget to replace the cursor selection marker
if stk.cursor(i)
then
tprint @(stk.x.orig(i) + 1, stk.y.orig(i) + stk.cursor(i)):'<':
tprint @(stk.x.orig(i) + stk.width(i) - 2, stk.y.orig(i) + stk.cursor(i)):'>':
end
end
next i
return
end