Window Primitives

Summary
Window Primitives
Macros
change_windowSelects a new window.
change_window_posModify window coordinates/size.
close_windowClose specified the window.
create_edgeCreate an edge, splitting the window.
create_menu_windowCreate the menu window.
create_tiled_windowCreates a tiled window.
create_windowCreate a popup window.
delete_edgeDelete an edge, combining a split window.
delete_windowDelete a window.
distance_to_indentCalculate distance to next indent.
distance_to_tabCalculate distance to next tab.
inq_char_mapRetrieve the character-map.
inq_ctrl_stateRetrieve the state of a window control.
inq_modeReturns the overstrike mode.
inq_top_leftRetrieve window view port coordinates.
inq_viewsDetermine window count.
inq_windowRetrieve the current window.
inq_window_bufRetrieve the associated buffer.
inq_window_flagsRetrieve window flags.
inq_window_infoRetrieve the current window information.
inq_window_infoxRetrieve information about a window.
insertInsert string into current buffer.
insert_bufferInsert format text into a buffer.
insert_modeSet the buffer insert/overstrike mode.
insertfInsert a formatted string.
move_edgeModify a window.
next_windowObtain the next window identifier.
rightMove position right one character.
self_insertInsert a character as if it was typed.
set_buffer_cmapSet a buffers character-map.
set_ctrl_stateSet the state of a window control.
set_featureConfig an editor feature.
set_fontSet the current window fonts.
set_top_leftManages window view port coordinates.
set_windowSet the active window.
set_window_cmapSet a windows character-map.
set_window_flagsSet window flags.
set_wm_nameSet the window and/or icon name.
translate_posConvert window coordinates.
upMove position up one line.

Macros

change_window

void change_window([int direction],
[string message])

Selects a new window.

Description

The change_window() primitive selects an adjoining window as the current located in the specified direction identified as follows,

0Above/up.
1Right.
2Below/down.
3Left.

If direction is omitted the user is prompted; the user indicates the change direction by use of the arrow keys.

Change direction [<^V>]

If the selected edge has no other window associated, then the user is informed as follows:

No window available

Parameters

directionOptional integer direction stating the edge on which the change operation occurs resizing the associated window (as above), if omitted the user is prompted.
messageOptional message string to be used as the prompt, if omitted the default of “Change direction” is used.

Returns

The change_window() primitive returns 1 on success, 0 if the edge does exist, otherwise -1 if the user aborted.

Portability

n/a

See Also

set_window, next_window

change_window_pos

int change_window_pos([int topx],
[int topy],
 [int width],
[int height],
[int winnum])

Modify window coordinates/size.

Description

The change_window_pos() primitive modifies the coordinates and/or the size of the specified window, if omitted the current window.

Note, care must be taken not position a window outside the physical window otherwise unexpected results including application crashes may result.

Parameters

topxOptional integer, if stated sets the x coordinate of the top left corner of the window, otherwise the current coordinate is taken.
topyOptional integer, if stated sets the y coordinate of the top left corner of the window, otherwise the current coordinate is taken.
widthOptional integer, if stated sets the new advised width in columns; the resulting width shall not be permitted to be smaller then the required width to display the current window title and/or message content.
heightOptional integer, if stated sets the new advised height in lines.
winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

Returns non-zero if the windows coordinates were modified, otherwise zero if an error occurred.

To determine the resulting window coordinates and size the inq_window_info primitive should be used, since boundary logic may have resized the window in order to obey the limits of the physical display.

Portability

The winnum is a GriefEdit extension.

See Also

inq_window_info, create_window

close_window

void close_window([int winum])

Close specified the window.

Description

The close_window() primitive is reserved for future BRIEF compatibility.

The close_window() primitive closes the specified window winum.  The adjoining windows are enlarged to take up the space along the best fit border.

The best fit border is the one that has a set of windows exactly matching the border of the window being closed.  If there is more than one, the left is eliminated first, then right, bottom and top.  The top left window becomes current.

Parameters

winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

none

Portability

Not implemented.

See Also

delete_window

create_edge

int create_edge([int direction])

Create an edge, splitting the window.

Description

The create_edge() primitive creates a new edge, splitting the current window in half resulting in a new window.

The window local in the specified direction is split identified as follows,

0Above/up.
1Right.
2Below/down.
3Left.

If direction is omitted the user is prompted for the split direction; the user indicates the split direction by use of the arrow keys.

Select new side [<^v>]

The selected window edge should have suitable screen space to permit the split operation otherwise the request is ignored and the user is informed as follows:

Window would be too small.

Parameters

directionOptional integer direction stating the edge on which the split operation occurs creating the new window (as above), if omitted the user is prompted.

Returns

The create_edge() primitive returns 1 on success, 0 if the window was too small too split, otherwise -1 if the user aborted.

Portability

n/a

See Also

delete_edge, move_edge

create_menu_window

int create_menu_window([int create])

Create the menu window.

Description

The create_menu_window() primitive retrieves and optionally creates the menu if not already created.  The menu resource is a singleton being the top line of display.

Parameters

createOptional integer flag, if specified as non-zero and the menu resource has as yet to be created, it shall be built.

Returns

Returns the unique identifier of the menu window resource, otherwise -1 if the menu has yet to be created.

Portability

A GriefEdit extension.

See Also

create_window, create_tiled_window

create_tiled_window

int create_tiled_window(int lx,
int by,
int rx,
int ty,
 [int bufnum])

Creates a tiled window.

Description

The create_tiled_window() primitive creates a tiled window.  The stated coordinates (lx, by, rx and ty) represent the total window arena irrespective of the borders status, with (0, 0) being the top left hand corner of the screen.

Care should be taken not to overlay tiled windows and that all of the visible display has been assigned to window.

Generally tiled windows are created by the end user splitting the editor windows.  This primitive in primary utilised during state restoration to recover the state of the previous edit session.

The created window shall not be visible until the display has been enabled using display_windows.

Parameters

lxCoordinate of the left edge.
byCoordinate of the bottom edge.
rxCoordinate of the right edge.
tyCoordinate of the top edge.
bufnumOptional buffer identifier to be attached to the newly create window, see attach_buffer.

Returns

Returns the unique identifier of the new window.

Portability

n/a

See Also

create_window, display_windows, inq_screen_size

create_window

int create_window(int lx,
int by,
 int rx,
int ty,
 [string message])

Create a popup window.

Description

The create_window() primitive creates a popup window resource which shall become the current window.  The window should be suitability sized based on the current screen size, which can be determined using inq_screen_size.

Popup windows stack upon any underlying tiled or other popup which are located in the same position, the order may be controlled using set_window_priority,

On completion at buffer needs to be associated with the newly created window using attach_buffer.

Parameters

lxCoordinate of the left edge.
byCoordinate of the bottom edge.
rxCoordinate of the right edge.
tyCoordinate of the top edge.
messageOptional string containing the message which shall be displayed on the bottom frame.

Returns

Returns the unique identifier of the new window.

Portability

Unlike BRIEF the number of windows which may be active at any one time is only limit by system resources.

See Also

attach_buffer, create_edge, create_tiled_window, create_menu_window, delete_window, inq_screen_size

delete_edge

int delete_edge([int direction])

Delete an edge, combining a split window.

Description

The delete_edge() primitive deletes an edge, combined two windows sharing an adjoining edge into a single window.

The windows located in the specified direction are joined as follows,

0Above/up.
1Right.
2Below/down.
3Left.

If direction is omitted the user is prompted for the split direction; the user indicates the split direction by use of the arrow keys.

Select edge to delete [<^v>]

Once a window is deleted with delete_edge, its window identifier become invalid.

Parameters

directionOptional integer direction stating the edge on which the join operation occurs deleting the associated windows (as above), if omitted the user is prompted.

Returns

The delete_edge() primitive returns 1 on success, 0 if the edge does exist, otherwise -1 if the user aborted.

Portability

n/a

See Also

create_edge, move_edge

delete_window

void delete_window([int winum])

Delete a window.

Description

The delete_window() primitive deletes the specified window.

Parameters

winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

none

Portability

Unlike BRIEF any window may be deleted.

See Also

create_window, delete_edge

distance_to_indent

int distance_to_indent([int column])

Calculate distance to next indent.

Description

The distance_to_indent() primitive calculates the distance in characters to the next active indentation from either the specified column otherwise if omitted the current cursor position.

The active indentation information is sourced from the first available specification in order from the following:

Parameters

columnOptional column if omitted the current buffer position is referenced.

Returns

Returns the number of columns/characters between the referenced column and the next indentation.  If the referenced column is on a tab stop, then the number of characters to the next tab stop shall be returned.

Portability

A GriefEdit extension.

See Also

distance_to_tab, set_ruler, set_indent, tabs

distance_to_tab

int distance_to_tab([int column])

Calculate distance to next tab.

Description

The distance_to_tab() primitive calculates the distance in characters to the next tab from either the specified column otherwise if omitted the current cursor position.

Parameters

columnOptional column if omitted the current buffer position is referenced.

Returns

Returns the number of columns/characters between the referenced column and the next tab stop.  If the referenced column is on a tab stop, then the number of characters to the next tab stop shall be returned.

Portability

n/a

See Also

tabs, distance_to_indent

inq_char_map

int inq_char_map([int winnum],
[string &name])

Retrieve the character-map.

Description

The inq_char_map() primitive retrieves the current character-map identifier of the underlying buffer, otherwise if none is associated with the specified window.  If the window identifier is omitted, the current window shall be queried.

Parameters

winnumOptional window identifier, if omitted the current window shall be referenced.
nameOptional string referenced, if specified shall be populated with the assigned character-map name.

Returns

The inq_char_map() primitive returns the associated character-mapid otherwise -1 if one is not assigned.

Portability

The name parameter is a GRIEF extension.

See Also

create_char_map, set_window_cmap, set_buffer_cmap

inq_ctrl_state

int inq_ctrl_state(int ctrl,
 [int winnum])

Retrieve the state of a window control.

Description

The inq_ctrl_state() primitive retrieves the state of a window control of the specific window, if omitted the current window.

Parameters

ctrlControl identifier; see set_ctrl_state for details.
winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

The return value depends on the specified control.

  • CLOSE_BTN, ZOOM_BTN, VERT_SCROLL, and HORZ_SCROLL
  • 0Disabled.
    1Enabled.
    -1Hidden globally.
    -2Hidden explicitly for this window.
    -3Hidden globally and explicitly.
  • VERT_THUMB and HORZ_THUMB,
  • -1Disabled.
    nThe position (percentage) of the thumb on the scroll bar, with a value 0 thru to 100.

Portability

n/a

See Also

set_ctrl_state

inq_mode

int inq_mode([int bufnum],
[int &localised])

Returns the overstrike mode.

Description

The inq_mode() primitive retrieves the current insert/overstrike (also known as overtype) mode.

Parameters

bufnumOptional buffer number, if omitted the current buffer shall be referenced.
localisedOptional integer reference, if specified is populated with the localisation status.  If true then the mode is specific to the referenced buffer, otherwise the global mode is active.

Returns

The inq_mode() primitive retrieves the non-zero if in insert mode, otherwise zero if in overstrike mode.

Portability

The localised status is a GriefEdit extension.

See Also

insert_mode, insert

inq_top_left

int inq_top_left([int &top],
[int &indent],
[int winnum],
 [int &line],
[int &col],
[int &bufnum])

Retrieve window view port coordinates.

Description

The inq_top_left() primitive retrieves the view port coordinates of the specified window into their associated buffer, if omitted the current window is referenced.

The variables line and column retrieves the buffer coordinates displayed at the top left corner of the window.  csrline and csrcolumn retrieve the buffers cursor position.

Parameters

lineOptional integer, if specified is populated with the line at the top of the window.
columnOptional integer, retrieves the column at the top left corner of the window.
winnumOptional window identifier, if omitted the current window shall be referenced.
csrlineOptional integer, if specified is populated with the buffer cursor line position.
csrcolumnOptional integer, retrieves the buffer cursor column position.
bufnumOptional integer, if specified is populated with the associated buffer identifier.

Returns

The associated window identifier, otherwise -1 on error.

Portability

n/a

See Also

set_top_left, inq_position

inq_views

int inq_views([int bufnum])

Determine window count.

Description

The inq_views() primitive determines the number of windows that are viewing the specified buffer bufnum.

Parameters

bufnumOptional buffer number, if omitted the current buffer shall be referenced.

Returns

The inq_views() primitive returns the number of windows attached to the specified buffer, otherwise 0 on error.

Portability

n/a

See Also

set_window

inq_window

int inq_window()

Retrieve the current window.

Description

The inq_window() primitive retrieves the window identifier of the current window.

Parameters

none

Returns

The inq_window() primitive returns the current window identifier otherwise -1 if there is no window.  This identifier can be used to save and restore the active window.

Portability

n/a

See Also

change_window, create_window

inq_window_buf

int inq_window_buf([int winnum])

Retrieve the associated buffer.

Description

The inq_window_buf() primitive retrieves the associated buffer identifier of the specified window, if omitted the current window.

Parameters

winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

The associated buffer identifier, otherwise -1 on error.

Portability

n/a

See Also

attach_buffer, inq_window

inq_window_flags

int inq_window_flags([int winnum],
[string flags])

Retrieve window flags.

Description

The inq_window_flags() primitive retrieves the window flags of the specified window winnum otherwise if omitted the current window.

Window Flags

Available window flags.

Constant
Name
Description
WF_HIDDEN
hidden
Hide the window from view, used to hide nested popup’s/boss mode etc.
WF_NO_SHADOW
no_shadow
Turn off the popup window shadows.
WF_NO_BORDER
no_border
Turn off borders, regardless of the borders() setting.
WF_SYSTEM
system
Window is a system window (e.g. menu).
WF_SHOWANCHOR
showanchor
Show anchor regardless of selection status.
WF_SELECTED
selected
Highlight the title regardless of selection status.
WF_LAZYUPDATE
lazyupdate
Delay any updates until next refresh().
WF_LINE_NUMBERS
line_numbers
Line numbers.
WF_LINE_STATUS
line_status
Line status.
WF_EOF_DISPLAY
eof_display
Show <EOF> marker.
WF_TILDE_DISPLAY
tilde_display
Show ~ marker as EOF marker.
WF_HIMODIFIED
himodified
Highlight modified lines.
WF_HIADDITIONAL
hiadditional
Highlight additional lines.
WF_HICHANGES
hichanges
Highlight in-line changes.
WF_EOL_HILITE
eol_hilite
Limit highlight to EOL.
WF_EOL_CURSOR
eol_cursor
Limit cursor to EOL.

Parameters

winnumOptional window identifier, if omitted the current window shall be referenced.
flagsOptional comma separated list of window flag names, if given the value of the specific flags are returned, otherwise the full flags is returned.

Returns

Returns the associated window flags.

Portability

The feature set exposed differs from CRiSP ™.  It is therefore advised that the symbolic constants are using within #ifdef constructs.

The flag argument is a GriefEdit extension.

See Also

set_window_flags

inq_window_info

int inq_window_info([int &winnum],
[int &bufnum],
 [int &lx],
[int &by],
[int &rx],
[int &ty],
 [string &title = NULL],
[string &message = NULL])

Retrieve the current window information.

Description

The inq_window_info() primitive retrieves information associated with the current windowd.

Parameters

winnumAn integer variable which shall be populated with the window identifier, otherwise -1 if no buffer is attached.
bufnumAn integer variable which shall be populated with the buffer identifier of the buffer attached to the specified window, otherwise -1 if no buffer is attached.
lxAn integer variable which shall be populated with the left x coordinate of the specified window.
byAn integer variable which shall be populated with the bottom x coordinate of the specified window.
rxAn integer variable which shall be populated with the right x coordinate of the specified window.
tyAn integer variable which shall be populated with the top y coordinate of the specified window.
titleA string variable, which shall be assigned the specified window title value.
messageA string variable, which shall be assigned the specified window message value.

Returns

The inq_window_info() primitive returns zero if the specified window is tiled, one if the window is an popup/overlapping window and two if the menu window.

Portability

This primitive differs from the BRIEF implementation, in that it only returns information associated with the current window and update the first argument to reflect the windows identifier, also see inq_window_infox.

The title and message parameters are extensions.

See Also

inq_window, create_window, create_tiled_window, create_menu_window

inq_window_infox

int inq_window_infox([int winnum],
[int &bufnum],
 [int &lx],
[int &by],
[int &rx],
[int &ty],
 [string &title = NULL],
[string &message = NULL])

Retrieve information about a window.

Description

The inq_window_infox() primitive retrieves information associated with the specified window winnum or the current window if no window is specified.

Parameters

winnumOptional integer window identifier, if omitted the current window is referenced.
bufnumAn integer variable which shall be populated with the buffer identifier of the buffer attached to the specified window, otherwise -1 if no buffer is attached.
lxAn integer variable which shall be populated with the left x coordinate of the specified window.
byAn integer variable which shall be populated with the bottom x coordinate of the specified window.
rxAn integer variable which shall be populated with the right x coordinate of the specified window.
tyAn integer variable which shall be populated with the top y coordinate of the specified window.
titleA string variable, which shall be assigned the specified window title value.
messageA string variable, which shall be assigned the specified window message value.

Returns

The inq_window_info() primitive returns zero if the specified window is tiled, one if the window is an popup/overlapping window and two if the menu window.

Portability

This primitive mirrors the original BRIEF interface presented by inq_window_info, permitted either the current or an explicit window to be referenced.

The title and message parameters are extensions.

See Also

inq_window, create_window, create_tiled_window, create_menu_window

insert

int insert(string|int val,
 [int num = 1])

Insert string into current buffer.

Description

The insert_process() primitive inserts the specified string or integer character value val into the current buffer.  The value shall be inserted num times, which if omitted defaults to 1.

Parameters

valString or integer character value to be inserted.
numOption integer number stating the repeat count, if specified then the string is inserted the given number of times.  If omitted, it defaults to 1.

Returns

The insert() primitive returns the number of characters inserted.

Portability

The standard function has a void declaration and returns nothing.

See Also

insertf, insert_buffer, insert_process

insert_buffer

int insert_buffer(int bufnum,
string format,
 ...)

Insert format text into a buffer.

Description

The insert_buffer() primitive behaves like the C printf() function.  It inserts the string format into the specified buffer and applies the printf style formatting commands as specified in format, and using the argument list.

When more than one argument is specified then format is treated as a printf-style format specification.  (ie.  % sequences are interpreted, otherwise % characters are inserted literally).

Parameters

bufnumBuffer number.
formatString that contains the text to be written.  It can optionally contain an embedded <Format Specification> that are replaced by the values specified in subsequent additional arguments and formatted as requested.
...Optional format specific arguments, depending on the format string, the primitive may expect a sequence of additional arguments, each containing a value to be used to replace a format specifier in the format string.
There should be at least as many of these arguments as the number of values specified in the format specifiers.  Additional arguments are ignored by the primitive.

Returns

The insert_buffer() primitive returns the number of characters written to the referenced buffer, otherwise -1 on error.

Portability

The CRiSPEdit™ version has a void declaration and returns nothing.

See Also

insert, insertf

insert_mode

int insert_mode([int value],
[int bufnum])

Set the buffer insert/overstrike mode.

Description

The insert_mode() primitive sets the insert/over-strike mode to value otherwise toggles if omitted.

The applied mode shall either be localised to the specified buffer bufname, otherwise if omitted the global (default) mode that applies to all buffers within a localised setting.

Parameters

valueOptional integer stating the insert mode being zero for over-strike and non-zero for insert.  For localised modes -1 clears the active localisation, restoring use of the global (default) mode.  If omitted the current mode is toggled.
bufnumOptional buffer number when stated the buffer specific insert mode shall be modified, if omitted the global insert mode is modified.

Returns

The insert_mode() primitive returns the previous insert mode.

Portability

n/a

See Also

inq_mode

insertf

int insertf(string format,
 ...)

Insert a formatted string.

Description

The insertf() primitive behaves like the C printf() function.  It inserts the string format into the current buffer and applies the printf style formatting commands as specified in fmt, and using the argument list.

When more than one argument is specified then expr is treated as a printf-style format specification.  (ie.  % sequences are interpreted, otherwise % characters are inserted literally).

Parameters

formatString that contains the text to be written.  It can optionally contain an embedded <Format Specification> that are replaced by the values specified in subsequent additional arguments and formatted as requested.
...Optional format specific arguments, depending on the format string, the primitive may expect a sequence of additional arguments, each containing a value to be used to replace a format specifier in the format string.
There should be at least as many of these arguments as the number of values specified in the format specifiers.  Additional arguments are ignored by the primitive.

Returns

The insertf() primitive returns the number of characters written to the referenced buffer, otherwise -1 on error.

Portability

A GriefEdit extension.

See Also

insert, insert_buffer

move_edge

int move_edge([int direction],
[int amount])

Modify a window.

Description

The move_edge() primitive modifies the edges of tiled window, whereas for popup’s allow the user to increase or decrease the size, and also move the window around the screen.

Example

Moves the lower edge of the current window up four lines.

move_edge(2, -4);

Parameters

directionOptional integer direction stating the edge on which the move operation occurs resizing the associated windows (as above), if omitted the user is prompted.
amountOptional integer expression stating the number or characters or lines to move the window.  The number is relative to the top left of the screen, so positive numbers move away from the origin (0, 0) and negative numbers towards the origin.  If not specified, the user will be prompted to move the edge with the arrow keys.

Returns

The move_edge() primitive returns non-zero if cursor moved, otherwise 0 if cursor did not move.

Portability

n/a

See Also

create_edge, delete_edge

next_window

int next_window(int winnum)

Obtain the next window identifier.

Description

The next_window() primitive retrieves the window identifier of the next window from the internal window list relative to the specified window, if omitted the current window shall be referenced.

Parameters

winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

The next_window() primitive returns the window identifier of the next tiled window from the window list.

If there is only a single window, then the same identifier as the specified shall be returned.

Example

Iterate though all windows

int curwin, win;

curwin = inq_window();
if ((win = curwin) != -1) {
do {

// ... process

} while ((win = next_window(win)) != curwin);
}

Portability

n/a

See Also

inq_window, set_window

right

int right([int columns = 1],
[int wrap = TRUE])

Move position right one character.

Description

The right() primitive moves the cursor right one column retaining the current line.

Parameters

columnsOptional number of columns to move the cursor; negative in which case the cursor movement is reversed behaving like left.
wrapOptional boolean value controlling whether the cursor wraps when positioned at the beginning of line.  If FALSE line wrapping shall be disabled, see left.

Returns

The right() primitive returns non-zero on success denoting that the cursor moved, otherwise zero if the cursor remained unchanged.

Portability

Unlike BRIEF, if the cursor is moved past the beginning of the current line, then the cursor wraps around to the end of the previous line.

wrap is a GriefEdit extension.

See Also

left, up, down

self_insert

void self_insert([int character])

Insert a character as if it was typed.

Description

The self_insert() primitive insert a character into the current buffer.  If character is specified, then the character whose ASCII value is character is inserted into the current buffer instead of the last character typed.

The majority of characters are directly inserted yet the following infer special processing.

tabCursor is moved the next tab stop, and space backfilled if at the end of the line.
newlinesCursor is repositioned on the next line.

This primitive is normally used in conjunction with assign_to_key to unassign an ASCII key by making it a normal, typeable character.

Parameters

characterOptional integer character code to be inserted.  If omitted, the value of the last key typed is inserted into the buffer.

Returns

nothing

Portability

n/a

See Also

insert, insertf, assign_to_key, keyboard_typeables

set_buffer_cmap

int set_buffer_cmap([int mapid|string name],
[int bufnum])

Set a buffers character-map.

Description

The set_buffer_cmap() primitive attachs the specified character-map to a given buffer.  A single character-map can be attached to any number of buffers.

Note that this association shall have precedence over the windows view of a buffer set_window_cmap.

Parameters

mapid, nameCharacter-map reference, being either an integer map identifier or the associated map name as a string.  If omitted the default character-map shall be attached.
bufnumOptional buffer number, if omitted the current buffer shall be referenced.

Returns

The set_buffer_cmap() primitive returns the identifier of the resolved character-map otherwise -1 if the specified character map does not exist.

Portability

n/a

See Also

create_char_map, set_window_cmap, inq_char_map

set_ctrl_state

void set_ctrl_state(int ctrl,
int state,
 [int winnum])

Set the state of a window control.

Description

The set_ctrl_state() primitive sets the state of a window control of the specific window, if omitted the current window.

Parameters

ctrlControl identifier.
WCTRLO_CLOSE_BTNClose button.
WCTRLO_ZOOM_BTNZoom button.
WCTRLO_VERT_SCROLLVertical scroll.
WCTRLO_HORZ_SCROLLHorizontal scroll.
WCTRLO_VERT_THUMBVertical thumb.
WCTRLO_HORZ_THUMBHorizontal thumb.
stateAn integer specifying the desired state.
WCTRLS_ENABLEEnable the control all windows.
WCTRLS_DISABLEDisable the control all windows.
WCTRLS_HIDEUsed to temporarily hide object for either the specified window or all windows, if window is omitted.
WCTRLS_SHOWRestore the show status of a hidden control.  HIDE/SHOW calls nests, hence for a hidden object to be displayed the number of HIDE operations must be matched by the same number of SHOW operations.
WCTRLS_ZOOMEDDisplay the zoomed button.
winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

nothing

Portability

n/a

See Also

inq_ctrl_state

set_feature

int set_feature([int|string feature],
[string value])

Config an editor feature.

Description

The set_feature() primitive sets the status of the specific feature feature.

Warning:

The set_feature() primitive is an experimental interface and may change without notice.

Parameters

featureName of the feature.
valueConfiguration value.

Return

The set_feature() primitive returns non-zero on success, otherwise zero on error.

Macro Portability; A GriefEdit extension.

See Also

inq_feature

set_font

int set_font([string normalfont],
[string italicfont])

Set the current window fonts.

Description

The set_font() primitive configures the active normal and/or italic font of the current running GriefEdit image.

Note:

Only available when running under a suitable windowing system, otherwise this primitive is a no-op.

Parameters

normalfontOptional string containing the normal text font.
italicfontOptional italic font.

Returns

The set_font() primitive returns zero or greater on success, otherwise -1 on error.

Portability

GriefEdit extended.

See Also

inq_font, set_wm_name

set_top_left

int set_top_left([int line],
[int column],
 [int winnum],
[int csrline],
[int csrcolumn],
[int bufnum])

Manages window view port coordinates.

Description

The set_top_left() primitive manages the view port coordinates, setting up the window and buffer positional relationship.

The window effected can be referenced by one of three means.  Directly, winnum if specifies states the window identifier used.  Indirectly, if winnum is omitted the window referenced shall be the one attached to the specified buffer identifier bufnum.  If neither are specified then the current window is assumed.

The arguments line and column set the buffer coordinates displayed at the top left corner of the window.

csrline and csrcolumn set the buffers cursor position.

Parameters

lineOptional integer, specifies the line within the buffer which should be at the top of the window.
columnOptional integer, specifies the column within the buffer which should be at the top of the window
winnumOptional window identifier, if omitted the current window shall be referenced.
csrlineOptional integer states the cursor position, if stated specifies the line within the buffer on which the cursor shall be positioned.
csrcolumnOptional integer states the cursor position, if stated specifies the column within the buffer on which the cursor shall be positioned.
bufnumOptional buffer identifier can be used to define a window indirectly, if winnum is omitted the window referenced shall be the one attached to the specified buffer identifier.

Returns

The effected window identifier, otherwise -1 on error.

Portability

n/a

See Also

inq_top_left

set_window

int set_window(int winnum)

Set the active window.

Description

The set_window() primitive set the current window to the specified window identifier.

Parameters

winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

Returns non-zero if the window was changed, otherwise zero if specified window was already the current and no change occurred.

Portability

Unlike BRIEF the current buffer is not affected, which changed the buffer to the one associated with the specified window.

See Also

inq_window, next_window, change_window

set_window_cmap

int set_window_cmap([int mapid|string name],
[int winnum])

Set a windows character-map.

Description

The set_window_cmap() primitive attachs the specified character-map to a given window.  A single character-map can be attached to any number of windows.

By default two system predefined character-map’s are available known by the names “normal” and “binary”, these are in addition to the number managed by the view’s package.

Note that any buffer level association set_buffer_cmap shall have precedence over the windows view of a buffer.

Parameters

mapid, nameCharacter-map reference, being either an integer map identifier or the associated map name as a string.  If omitted the default character-map shall be attached.
winnumOptional window identifier, if omitted the current window shall be referenced.

Returns

The set_window_cmap() primitive returns the identifier of the resolved character-map otherwise -1 if the specified character map does not exist.

Portability

n/a

See Also

create_char_map, set_buffer_cmap, inq_char_map

set_window_flags

void set_window_flags([int winnum],
 [string set|int or_mask],
[string clear|int and_mask])

Set window flags.

Description

The set_window_flags() primitive modifies the window flags of the specified window winnum otherwise if omitted the current window.

If specified one or more flags shall be cleared using the and_mask, in additional one or more flags are set using the or_mask.

Note that and_mask (clear) is applied prior to the application of the or_mask (set).

Window Flags

Available window flags.

Constant
Name
Description
WF_HIDDEN
hidden
Hide the window from view, used to hide nested popup’s/boss mode etc.
WF_NO_SHADOW
no_shadow
Turn off the popup window shadows’
WF_NO_BORDER
no_border
Turn off borders, regardless of the borders() setting.
WF_SYSTEM
system
Window is a system window (e.g. menu).
WF_SHOWANCHOR
showanchor
Show anchor regardless of selection status.
WF_SELECTED
selected
Highlight the title regardless of selection status.
WF_LAZYUPDATE
lazyupdate
Delay any updates until next refresh().
WF_LINE_NUMBERS
line_numbers
Line numbers.
WF_LINE_STATUS
line_status
Line status.
WF_EOF_DISPLAY
eof_display
Show <EOF> marker.
WF_TILDE_DISPLAY
tilde_display
Show ~ marker as EOF marker.
WF_HIMODIFIED
himodified
Highlight modified lines.
WF_HIADDITIONAL
hiadditional
Highlight additional lines.
WF_HICHANGES
hichanges
Highlight in-line changes.
WF_EOL_HILITE
eol_hilite
Limit highlight to EOL.
WF_EOL_CURSOR
eol_cursor
Limit cursor to EOL.

Parameters

winnumOptional window identifier, if omitted the current window shall be referenced.
set_maskOptional mask of flags to set.  May either be an integer of AND’ed together flag constants, or alternatively a string of comma separated flag names.
clear_maskOptional mask of flags to clear.  May either be an integer of AND’ed together flag constants, or alternatively a string of comma separated flag names.

Returns

nothing

Portability

The feature set exposed differs from CRiSP ™.  It is therefore advised that the symbolic constants are using within a #ifdef construct.

String flag forms are GriefEdit extensions.

See Also

inq_window_flags

set_wm_name

void set_wm_name([string wname],
[string iname])

Set the window and/or icon name.

Description

The set_wm_name() primitive configures the window and/or the minimised icon name of the current running GriefEdit image.

Note:

Only available when running under a suitable windowing system, otherwise this primitive is a no-op.

Parameterss

wnameOptional string containing the window name.
inameOptional icon name.

Returns

The set_wm_name() primitive returns zero or greater on success, otherwise -1 on error.

Portability

GriefEdit extended.

See Also

set_font

translate_pos

int translate_pos(int x,
int y,
  [int &winnum],
 [int &line],
 [int &col])

Convert window coordinates.

Description

The translate_pos() primitive translates the physical screen position (x, y) into a window and logical line/col position.

Parameters

x, yScreen coordinates to be translate.
winnumOptional an integer variable which shall be populated with the window identifier within which the (x, y) position falls, otherwise -1 if no window was mapped.
line, colOptional integer variables which shall be populated with the translated window coordinates, otherwise -1 if no window was mapped.

Returns

The translate_pos() primitive returns where the mouse cursor is located.

Value
Definition
MOBJ_NOWHERE
Not in any window.
MOBJ_LEFT_EDGE
Left bar of window.
MOBJ_RIGHT_EDGE
Right bar of window.
MOBJ_TOP_EDGE
Top line of window.
MOBJ_BOTTOM_EDGE
Bottom line of window.
MOBJ_INSIDE
Mouse inside window.
MOBJ_TITLE
On title.
MOBJ_VSCROLL
Vertical scroll area.
MOBJ_VTHUMB
Vertical scroll area.
MOBJ_HSCROLL
Horz scroll area.
MOBJ_HTHUMB
Horz scroll area.
MOBJ_ZOOM
Zoom button,
MOBJ_CLOSE
Close.
MOBJ_SYSMENU
System Menu.

Portability

n/a

See Also

get_mouse_pos, process_mouse

up

int up([int lines = 1])

Move position up one line.

Description

The up() primitive moves the cursor up one line to the same column on the previous line.

Parameters

linesOptional number of lines to move the cursor; may be negative in which case the cursor moves forward behaving like down.

Returns

The up() primitive returns non-zero on success denoting that the cursor moved, otherwise zero if the cursor remained unchanged.

Portability

n/a

See Also

down, left, right

$Id: $

To send feedback on this topic email: grie.nosp@m.fedit@gmai.nosp@m.l.com

Copyright © Adam Young All Rights Reserved.

void change_window([int direction],
[string message])
Selects a new window.
int change_window_pos([int topx],
[int topy],
 [int width],
[int height],
[int winnum])
Modify window coordinates/size.
void close_window([int winum])
Close specified the window.
int create_edge([int direction])
Create an edge, splitting the window.
int create_menu_window([int create])
Create the menu window.
int create_tiled_window(int lx,
int by,
int rx,
int ty,
 [int bufnum])
Creates a tiled window.
int create_window(int lx,
int by,
 int rx,
int ty,
 [string message])
Create a popup window.
int delete_edge([int direction])
Delete an edge, combining a split window.
void delete_window([int winum])
Delete a window.
int distance_to_indent([int column])
Calculate distance to next indent.
int distance_to_tab([int column])
Calculate distance to next tab.
int inq_char_map([int winnum],
[string &name])
Retrieve the character-map.
int inq_ctrl_state(int ctrl,
 [int winnum])
Retrieve the state of a window control.
int inq_mode([int bufnum],
[int &localised])
Returns the overstrike mode.
int inq_top_left([int &top],
[int &indent],
[int winnum],
 [int &line],
[int &col],
[int &bufnum])
Retrieve window view port coordinates.
int inq_views([int bufnum])
Determine window count.
int inq_window()
Retrieve the current window.
int inq_window_buf([int winnum])
Retrieve the associated buffer.
int inq_window_flags([int winnum],
[string flags])
Retrieve window flags.
int inq_window_info([int &winnum],
[int &bufnum],
 [int &lx],
[int &by],
[int &rx],
[int &ty],
 [string &title = NULL],
[string &message = NULL])
Retrieve the current window information.
int inq_window_infox([int winnum],
[int &bufnum],
 [int &lx],
[int &by],
[int &rx],
[int &ty],
 [string &title = NULL],
[string &message = NULL])
Retrieve information about a window.
int insert(string|int val,
 [int num = 1])
Insert string into current buffer.
int insert_buffer(int bufnum,
string format,
 ...)
Insert format text into a buffer.
int insert_mode([int value],
[int bufnum])
Set the buffer insert/overstrike mode.
int insertf(string format,
 ...)
Insert a formatted string.
int move_edge([int direction],
[int amount])
Modify a window.
int next_window(int winnum)
Obtain the next window identifier.
int right([int columns = 1],
[int wrap = TRUE])
Move position right one character.
void self_insert([int character])
Insert a character as if it was typed.
int set_buffer_cmap([int mapid|string name],
[int bufnum])
Set a buffers character-map.
void set_ctrl_state(int ctrl,
int state,
 [int winnum])
Set the state of a window control.
int set_feature([int|string feature],
[string value])
Config an editor feature.
int set_font([string normalfont],
[string italicfont])
Set the current window fonts.
int set_top_left([int line],
[int column],
 [int winnum],
[int csrline],
[int csrcolumn],
[int bufnum])
Manages window view port coordinates.
int set_window(int winnum)
Set the active window.
int set_window_cmap([int mapid|string name],
[int winnum])
Set a windows character-map.
void set_window_flags([int winnum],
 [string set|int or_mask],
[string clear|int and_mask])
Set window flags.
void set_wm_name([string wname],
[string iname])
Set the window and/or icon name.
int translate_pos(int x,
int y,
  [int &winnum],
 [int &line],
 [int &col])
Convert window coordinates.
int up([int lines = 1])
Move position up one line.
int borders([int borders])
Set window border status.
int display_windows([int mode])
Control window display.
void attach_buffer(int bufnum)
Attach a buffer to a window.
int inq_screen_size([int &rows],
[int &cols],
[int &colors])
Determine screen dimensions.
int set_window_priority(int priority,
 [int winnum])
Set the window display priority.
int set_ruler([int bufnum],
[list|string|int ...])
Configure the buffer ruler.
int set_indent([int indent],
[int bufnum])
Set the buffers default indentation.
int tabs([string tabs | list tabs | int tab, ...])
Set buffer tab stops.
int create_char_map([int mapid|string name],
 [int start = 0],
[list chars],
 [list flags],
[string name])
Create a display character-map.
int inq_position([int &line],
[int &col])
Retrieve current buffer position.
~expr
Bitwise complement.
int insert_process(string|int val,
 [int num = 1])
Send string to a attached process.
int left([int columns = 1],
[int wrap = TRUE])
Move position left one charcter.
int down([int lines = 1])
Move position down one line.
int assign_to_key([string key],
[string macro])
Assign command to key or key sequence.
int keyboard_typeables()
Assign self_insert to all typeable keys.
int|list inq_feature([int|string feature],
[string value])
Retrieve an editor feature.
int inq_font(string &normalfont,
 [string &italicfont])
Inquire the current window fonts.
void get_mouse_pos(  [int &x],
[int &y],
[int &winnum],
 [int &line],
[int &col],
 [int &where],
[int &region],
[int &event])
Retrieve last mouse action.
void process_mouse(   [int b1],
 [int b2],
 [int b3],
int x,
int y)
Process mouse event.