Lugaru's Epsilon
Programmer's
Editor

Context:
Epsilon User's Manual and Reference
   Primitives and EEL Subroutines
      Buffer Primitives
         Changing Buffer Contents
         Moving Text Between Buffers
         Getting Text from a Buffer
         . . .
         Listing Buffers
      Display Primitives
         Creating & Destroying Windows
         Window Resizing Primitives
         Preserving Window Arrangements
         . . .
      File Primitives
         File Reading Primitives
         File Writing Primitives
         Line Translation Primitives
         . . .
         Tagging Internals
      . . .

Previous   Up    Next
Listing Buffers  Primitives and EEL Subroutines   Window Resizing Primitives


Epsilon User's Manual and Reference > Primitives and EEL Subroutines > Display Primitives >

Creating & Destroying Windows

window_kill()
window_one()

The window_kill( ) primitive removes the current window if possible, in the same way as the kill-window command does. The window_one( ) primitive eliminates all but the current window, as the command one-window does.

remove_window(int win)

The remove_window( ) primitive deletes a window by handle or number. If you delete a tiled window, Epsilon expands other windows as needed to fill its space. You cannot delete the last remaining tiled window.

int give_window_space(int dir)
#define BLEFT   0   /* direction codes */
#define BTOP    1
#define BRIGHT  2
#define BBOTTOM 3

The give_window_space( ) primitive deletes the current window. It expands adjacent windows in the specified direction into the newly available space, returning 0. If there are no windows in the specified direction, it does nothing and returns 1.

window_split(int orientation)
#define HORIZONTAL      (0)
#define VERTICAL        (1)

The window_split( ) primitive makes two windows from the current window, like the commands split-window and split-window-vertically do. The argument to window_split( ) tells whether to make the new windows appear one on top of the other (with argument HORIZONTAL) or side-by-side (with argument VERTICAL). The standard EEL header file, eel.h, defines the macros HORIZONTAL and VERTICAL. The primitive returns zero if it could not split the window, otherwise nonzero. When you split the window, Epsilon automatically remembers to call the prepare_windows( ) and build_mode( ) subroutines during the next redisplay.

user short window_handle;
user short window_number;
next_user_window(int dir)

You may refer to a window in two ways: by its window handle or by its window number.

Epsilon assigns a unique window handle to a window when it creates the window. This window handle stays with the window for the duration of that window's lifetime. To get the window handle of the current window, use the window_handle primitive.

The window number, on the other hand, denotes the window's current position in the window order. You can think of the window order as the position of a window in a list of windows. Initially the list has only one window. When you split a window, the two child windows replace it in the list. The top or left window comes before the bottom or right window. When you delete a window, that window leaves the list. The window in the upper left has window number 0. Pop-up windows always come after tiled windows in this order, with the most recently created (and therefore topmost) pop-up window last. The window_number primitive gives the window number of the current window.

Epsilon treats windows in a dialog much like pop-up windows, assigning each a window number and window handle. The stacking order of dialogs is independent of their window handles, however. Deleting all the windows on a dialog makes Epsilon remove the dialog. (Epsilon doesn't count windows with the system_window flag set when determining if you've deleted the last window.)

To change to a different window, you can set either the window_handle or window_number variables. Epsilon then makes the indicated window become the current window. Epsilon interprets window_number modulo the number of windows, so window number -1 refers to the last window.

Many primitives that require you to specify a window will accept either its handle or its number. Use window_handle to remember a particular window, since its number can change as you add or delete windows.

You can increment or decrement the window_number variable to cycle through the list of available windows. But it's usually better to use the next_user_window( ) subroutine, passing it 1 to go to the next window or -1 to go to the previous one. This will skip over system windows.

int number_of_windows()
int number_of_popups()
int number_of_user_windows()
int is_window(int win)
#define ISTILED         1
#define ISPOPUP         2

The number_of_windows( ) primitive returns the total number of windows, and the number_of_popups( ) primitive returns the number of pop-up windows. The number_of_user_windows( ) subroutine returns the total number of windows, excluding system windows.

The is_window( ) primitive accepts a window handle. It returns ISTILED if the value refers to a conventional tiled window, ISPOPUP if the value refers to a pop-up window or a window in a dialog, or 0 if the value does not refer to a window. Unlike most window functions, it accepts only a window handle, not a window number.



Previous   Up    Next
Listing Buffers  Primitives and EEL Subroutines   Window Resizing Primitives


Lugaru Copyright (C) 1984, 2012 Lugaru Software Ltd. All Rights Reserved.