• Aucun résultat trouvé

DISPLAY MANAGEMENT

Dans le document 0 () 0 0 (Page 110-122)

O active. commands

CHAPTER 4 TEXT OPERATIONS

5.4 DISPLAY MANAGEMENT

Once a window exists as an.Editor object, you can cause i t to become visible on the screen. You can also remove a window from the screen without destroying the window object, and you can redisplay that window at any time. Each window object contains information concerning its size and the screen position it occupies when it is displayed.

However, the Editor's display manager retains control over display-related decisions. The Editor guarantees, for instance, the display area is always filled, and that anchored windows do obscure eac~· other's text content. The display manager reposition, resize, and even remove some windows from the screen order to meet these requirements.

manyO that

not will in

Within the constraints set by the display manager, you have considerable .freedom to determine the total appearance of the screen:

Q

the size of the display area, the number of windows displayed, and the size and screen positions of some individual windows.

This section introduces the following sets of techniques, each in conjunction with the constraints set by the Editor's automatic display management:

Operations on the display area --area and the prompting window

including the information

Window types and their behavior visibility, size, screen position as they relate to a window's display type

•·Displaying windows and removing windows from the display

5.4.1 The Display Area

and

The Editor's display area is the total space available on your display device for showing Editor windows and the information area. On VT100-and VT200-series terminals, the display area is, by default, the full terminal screen. Both these terminal screens are 24 rows in height, and both permit screen widths of 80 or 132 columns.*.

0

0

0

0

0

0

0

WINDOW AND DISPLAY OPERATIONS

The AI VAXstation permits an Editor dispiay area of up to 66 rows by 167 columns. The Editor display area provided by default on the AI VAXstation is 50 rows by 80 columns.

You can think of the display area as an x-y coordinate system. You u~e these coordinates to specify the screen positions at which windows are displayed. Both the columns (x coordinate) and the rows (y coordinate) are numbered from the upper left corner beginning with 1

(see Figure 5-1).

....

.c a,

E :::, c:

;:

0 ....

II >

{ x=1 y=1

y=24

x=column number

Figure 5-1: Display Area Coordinates

x=BO } or x=132

ML0-253-86

You have some latitude to alter the dimensions of the Editor's display area, and thus the total screen area available for Editor-related displays. Within this total area, the Editor always reserves some space for the information area and for the prompting window. The space that remains in the display area after the prompting window and the information area are accounted for is the total space available for displaying other windows.·

This section introduces the following concepts and techniques:

• Display area dimensions - retrieving and altering the height and width of the display area

• The reserved display area - operating on the information area and the prompting window

• The available display area - displaying and removing other Editor windows

/

5.4.1.1 Display Area Dimensions - The functions SCREEN-HEIGHT and

Q

SCREEN-WIDTH return integers that are the number of rows and columns, respectively, in the display area. The dimensions returned are not necessarily those of the screen. By default, the display area occupies the full screen on DIGITAL terminals, but you can use SETF with SCREEN-HEIGHT and SCREEN-WIDTH to alter either dimension:

(SETF (SCREEN-HEIGHT) 20) (SETF (SCREEN-WIDTH) 60)

If you execute these two forms, the display area is reduced to the dimensions shown in Figure 5-2:

Jx=1 ly=1

ML0-254-86

Figure 5-2: Altered Display Area Dimensions

The coordinate numbering does not change when you change the dimensions of the display area. The rows and columns that become unavailable are those at the bottom and on the right. The upper left corner of the display area still corresponds to the upper left corner of the screen, and the upper left position is still designated as 1,1.

You cannot make the display area supply a value in either of the the maximum screen dimension, the the maximum screen dimension.

larger than the screen. If you above SETF forms that is larger than display area dimension is altered to

0

0

0

*

For screen sizes of foreign- (non-DIGITAL) terminals supported by the

Q

VAX LISP Editor, consult your terminal manual.

WINDOW AND DISPLAY OPERATIONS

This form resets VT100- and VT200-series 132 columns; at the same time, it makes as the display area. The 12 right-most blank.

terminals to "wide" width 120 of those columns available specified. Performing such operations on a VT100- or VT200-series terminal before the Editor is started produces no effect.

The function INFORMATION-AREA-HEIGHT returns the height (in screen rows) of the information area. Using SETF, you can increase the height to more than 1 row, but you cannot decrease it to O rows.

To direct output to the information area, you can use the LISP global variable *INFORMATION-AREA-OUTPUT-STREAM*. This va~iable is bound to an output stream that is directed to the information area. You can

use the variable as the stream argument to any of the LISP functions that take a stream, such as WRITE-STRING, FORMAT, or PRINC. For example:

(WRITE-STRING "Operation completed. "

*INFORMATION-AREA-OUTPUT-STREAM*)

Some other functions that operate on the information area are CLEAR-INFORMATION-AREA, which removes any current text, and EDITOR-ERROR, which directs error messages to the information area.

EDITOR-ERROR is discussed in Chapter 2 of this manual. previous section. (The screen affected by operations on the altered by resetting the Editor variables "Prompt

"Prompt Rendition Complement" (see Part III).

window to reverse are displayed can be Rendition Set" and

You can also alter the dimensions of the prompting window, in the same way that you resize other windows. See Section 5.4.2.2 for the techniques of resizing windows.

The screen space -- number of rows -- that you have allotted to the

()

()

()

WINDOW AND DISPLAY OPERATIONS

5.4.1.3 The Available.Display Area - Whatever space is not reserved for the information area and the prompting window is the "available"

display area. This is the area you use to display Editor windows, and its dimensions constrain your decisions on sizing and positioning windows if you do not want them to overlap one another or overflow the screen.

In the following sections on displaying, sizing, and positioning windows, the term display area should be taken to mean the available display area.

5.4.2 Window Types and Their Be_havior

There are two types of Editor windows: anchored and floating. The Editor normally provides anchored windows for ordinary text editing.

Floating windows are used for displaying information or for other special purposes. For instance, the windows onto the "Help" and

"General Prompting" buffers are floating windows.

The content and appearance of a window are not ~ffected by the display

-type of that window. The distinction between the two types lies in how they are treated in display management. This section outlines the effect of window type on three aspects of display management behavior:

• Whether a window overlaps or i_s overlapped by other windows e Sizing or resizing a visible window

• Positioning or repositioning a window in the display area

You can access or change the type of a specified window. The function WINDOW-TYPE takes a window and returns a keyword, which can be either ( ) :ANCHORED or :FLOATING. Using SETF, you can change the window's type:

()

(SETF {WINDOW-TYPE WINDOW) :FLOATING)

The Editor variable "Default Window Type", which specifies the default type of newly created windows, can be set to either of these keywords.

In the Editor as provided, the default window type is :ANCHORED.

In the examples that follow, the variable ANCHORED-WINDOW is assumed to be bound to an anchored window, and FLOATING-WINDOW is assumed to be bound to a floating window.

5.4.2.1 Display Behavior By Window Type - The between anchored and floating windows lies in overlap, or be overlapped, by other windows:

major difference whether they can

A floating window can overlap or completely obscure any other

Q

window in the available display area, either anchored or floating.

• An anchored window never obscures the text area of another window, either anchored or floating.

When a floating window is displayed, it appears in the size and at the screen position contained in the window object. Any other windows that occupy any part of that space are overlapped.

If more than one anchored window is displayed at once, the display manager moves and resizes them as necessary so that no text is obscured. The size and screen position contained in the window object are ignored.

The Editor's display rules concerning window size and screen position follow from this basic rule concerning window overlaps. Thus, automatic display management relates to anchored windows only;

floating windows, which need not avoid overlaps, are under the user's control and not subject to automatic resizing and repositioning.

5.4.2.2 Window Size And Display Behavior - Each window object has height (number of rows) and width (number of columns). You can retrieve and alter these features in any window, but it is only in floating windows that the features have significance.

You can access window dimensions with the functions WINDOW-HEIGHT and WINDOW-WIDTH, and you can use SETF to alter these dimensions:

(SETF (WINDOW-HEIGHT FLOATING-WINDOW) 12) (SETF (WINDOW-WIDTH FLOATING-WINDOW) 40)

These forms alter the specified floating window to be 12 rows height and 40 columns wide. The dimensions of a window refer to text area only; if the window has borders, the borders occupy additional rows and 2 additional columns outside the text area.

in the 2

The minimum size for a floating window is 1 row by 2 columns. If you attempt to alter either dimension to less than the m1n1mum, an error is signaled. If you make either dimension larger than the available display area, the window will overflow the display area to the right or to the bottom.

0

0

0

For anchored windows, the dimensions contained in a window object are ignored by the Editor's display manager. An anchored window always

occupies the full width of the display area. The window's height

Q

depends- on how many anchored windows are visible at once.

0

0

0

0

0

WINDOW AND DISPLAY OPERATIONS

If an anchored window is the only anchored window displayed, its text bordered). If the integer argument to ALTER-WINDOW-HEIGHT violates these rules, then the Editor adjusts the argument window only as much the functions WINDOW-DISPLAY-COLUMN and WINDOW-DISPLAY-ROW. (The argument window need not be currently visible.)

(WINDOW-DISPLAY-COLUMN WINDOW) (WINDOW-DISPLAY-ROW WINDOW)

If these forms return ·10 and 5, respectively, then the upper left

Q

corner of the window's text area is displayed at column 10, row 5 of the display area (see Figure 5-3). If the window is bordered, the borders lie outside this position.

J x=l 1 y=l

... BORDER -x=9 t

y=41

a: w

c a:

0 co

,

_

J x=10 l y=5

Figure 5-3: A Window Display Position

WINDOW

ML0-255-86

As with window size, the values that indicate window display position are significant only for fl.eating windows. Anchored windows are always displayed beginning in column 1. The display row position of an anchored window is determined by the display manager.

0

0

You can alter the display position of a floating window by means· of the function MOVE-WINDOW. MOVE-WINDOW takes a window and a row and

Q

column to which to move the upper left corner of that window's text area:

(MOVE-WINDOW FLOATING-WINDOW 8 25)

This form alt"e·rs the floating window's values for display row and display column to those specified. If the window is displayed, it moves to that position; if the window is not displayed, it appears at that position when it is next displayed.

An example using MOVE-WINDOW is a function MY-MOVE-WINDOW·-VERTICALLY.

This function moves

a

window's display row by the number of rows specified, or by fewer rows if the specified offset value would result in spilling the window (or its border) off the display area. Its code

is:

0

0

0

0

0

WINDOW AND DISPLAY OPERATIONS

(DEFUN MY-MOVE-WINDOW-VERTICALLY (WINDOW OFFSET)

;; Compute the new display row.

( LET ( ( NEW-ROW

(+ (WINDOW-DISPLAY-ROW WINDOW) OFFSET)))

;; Move the window to the display row, or as far as possible

;; without overflowing. Retain the window's display column.

(MOVE-WINDOW WINDOW

(MIN (MAX NEW-ROW 1)

(- (SCREEN-HEIGHT) (WINDOW-HEIGHT WINDOW) (IF (WINDOW-LABEL WINDOW)

1 0 ) ) )

(WINDOW-DISPLAY-COLUMN WINDOW)))) use this functiorr in an Editor command, you could write:

(DEFINE-COMMAND (MY-MOVE-WINDOW-UP-COMMAND

:DISPLAY-NAME "My Move Window Up") (PREFIX)

" Moves the current window up one or more rows, without spilling it off the screen. Cannot be used with

anchored windows."

(IF (EQ (WINDOW-TYPE (CURRENT-WINDOW) :FLOATING)) (MY-MOVE-WINDOW-VERTICALLY (.CURRENT-WINDOW)

(- (OR PREFIX 1))) (ATTENTION)))

You could write a similar function to move a window horizontally, and similar commands to move a window down, right, and left.

5.4.2.4 Window Borders And Display Behavior - The Editor's display rules concerning the overlapping of window text areas do not apply to window borders. A bordered window can sometimes be sized or positioned in a way that obscures one or more of its borders.

For anchored windows, the top and side borders are always· nonvisible.

If an anchored window with a border is the only anchored window displayed, its text area fills the available display area, leaving 1 row for its bottom border. Its top and side borders overflow the display area. For this reason, you should always place the labels of anchored windows on their bottom borders.

If two or more anchored windows with borders are displayed at once, the bottom border of one window obscures the top border of the window displayed below it. The bottom border of an anchored window never overflows the display area, and it cannot be obscured by another anchored window. It can, however, be obscured by a floating window.

WINDOW AND DISPLAY OPERATIONS

For floating windows, the borders are more often visible since

float--ing windows can be sized and positioned well within the display

.Q

area. However, if a floating window equals or exceeds the size of the display area, then any or all of its borders can spill off. The

"Help" window, for instance, is the full width of the display area but shorter in height. Therefore, its top and bottom borders are visible, but its side borders are not visible. If .a floating window, regardless of its size, is positioned on the screen in such a way that it overflows the display area, then the border of the affected edge cannot be seen.

5.4.3 Displaying and Removing Windows Three functions enable you to display and screen. These functions are:

• SHOW-WINDOW

• PUSH-WINDOW

• REMOVE-WINDOW

remove windows from the

0

The behavior of these functions varies with the display type of the argument window and of other visible windows. This section introduces

Q

these behavior variations; you can find further information in the description of each function in Part III of this manual.

5.4.3.1 Using SHOW-WINDOW - SHOW-WINDOW takes a window and disp~ays it on the screen. Its format is:

SHOW-WINDOW window &OPTIONAL row column

If the window is a floating window, you can supply an optional row column at which its upper left character will appear. If you do specify a position, the window is placed at the position contained the window object.

and not in

A newly displayed floating window obscures any other window that is currently displayed in the same position. If the argument (floating) window is already displayed but is obscured by orie or more windows, SHOW-WINDOW redisplays it "on top of" the obscuring window(s).

If the argument window is determined by the display arguments, they are ignored.

an anchored manager. If

window, its position is you supply row and column

0

You can continue to add anchored windows to the screen with

Q

SHOW-WINDOW up to the number that is the value of the Editor variable

WINDOW AND DISPLAY OPERATIONS

"Anchored Window Show Limit". For instance, if the value is 2 (the

C

global default), then you can show 2 anchored windows on the screen at a given time. Adding a third anchored window with SHOW-WINDOW causes the least recently used anchored window to be removed.

A newly displayed anchored window appears at the bottom of the screen, and any other anchored windows that remain on the screen are moved up.

All the visible anchored windows are resized so that they are about equal in height. If a window is removed to accommodate the newly displayed window, the new window is made the same size as the window that was removed.

5.4.3.2 Using PUSH-WINDOW - PUSH-WINDOW is like SHOW-WINDOW, except that it does not automatically remove anchored windows when their

O

number exceeds the value of "Anchored Window Show Limit". Also, PUSH-WINDOW takes two optional arguments that enable you to override some features of the Editor's automatic treatment of anchored windows.

The format of PUSH-WINDOW is:

PUSH-WINDOW window &OPTIONAL companion insert-above If the argument window is floating, PUSH-WINDOW

O

SHOW-WINDOW, except that you cannot specify a window appears at the position contained in the

supply optional arguments, they are ignored.

has the same effect as display position. The window object. If you

If the argument window is anchored, PUSH-WINDOW adds it to the display without removing any previously displayed anchored windows. The Editor resizes all the visible anchored windows to make them about equal in height.

O

The optional arguments enable you to specify the position of a newly displayed anchored window in relation to a visible anchored window.

If you specify a companion argument -- a visible anchored window the newly displayed window appears just below the companion. If you supply both a companion argument and an insert-above argument of T, the new window appears just above the companion window.

5.4.3.3 display.

Using REMOVE-WINDOW - REMOVE~WINDOW removes a window from the Its format is:

REMOVE-WINDOW window &OPTIONAL new-current

If the argument window is floating, REMOVE-WINDOW has no effect on the

O

remaining visible windows. If the argument window is anchored, the Editor automatically resizes and repositions the remaining anchored windows so that they fill the available display area.

If the window being removed is the current window, you can supply a new-current argument to specify the window that is to become current.

Q

If you do not supply a new-current argument, then the Editor invokes NEXT-WINDOW (with argument T) to identify the window that becomes current.

By using REMOVE-WINDOW repeatedly, you can remove from the available display area all but one of the visible windows. You cannot empty the available display area completely, however; the one window that will remain opens onto the buffer bound to the variable

*EDITOR-DEFAULT-BUFFER*. If you have not bound a buffer to this variable, the Editor displays a window onto the "Basic Introduction"

buffer when.it has nothing else to show.

Dans le document 0 () 0 0 (Page 110-122)