| Window Primitives | |
| Macros | |
| change_window | Selects a new window. |
| change_window_pos | Modify window coordinates/size. |
| close_window | Close specified the window. |
| create_edge | Create an edge, splitting the window. |
| create_menu_window | Create the menu window. |
| create_tiled_window | Creates a tiled window. |
| create_window | Create a popup window. |
| delete_edge | Delete an edge, combining a split window. |
| delete_window | Delete a window. |
| distance_to_indent | Calculate distance to next indent. |
| distance_to_tab | Calculate distance to next tab. |
| inq_char_map | Retrieve the character-map. |
| inq_ctrl_state | Retrieve the state of a window control. |
| inq_mode | Returns the overstrike mode. |
| inq_top_left | Retrieve window view port coordinates. |
| inq_views | Determine window count. |
| inq_window | Retrieve the current window. |
| inq_window_buf | Retrieve the associated buffer. |
| inq_window_flags | Retrieve window flags. |
| inq_window_info | Retrieve the current window information. |
| inq_window_infox | Retrieve information about a window. |
| insert | Insert string into current buffer. |
| insert_buffer | Insert format text into a buffer. |
| insert_mode | Set the buffer insert/overstrike mode. |
| insertf | Insert a formatted string. |
| move_edge | Modify a window. |
| next_window | Obtain the next window identifier. |
| right | Move position right one character. |
| self_insert | Insert a character as if it was typed. |
| set_buffer_cmap | Set a buffers character-map. |
| set_ctrl_state | Set the state of a window control. |
| set_feature | Config an editor feature. |
| set_font | Set the current window fonts. |
| set_top_left | Manages window view port coordinates. |
| set_window | Set the active window. |
| set_window_cmap | Set a windows character-map. |
| set_window_flags | Set window flags. |
| set_wm_name | Set the window and/or icon name. |
| translate_pos | Convert window coordinates. |
| up | Move position up one line. |
void change_window( [int direction], [string message] )
Selects a new window.
The change_window() primitive selects an adjoining window as the current located in the specified direction identified as follows,
| 0 | Above/up. |
| 1 | Right. |
| 2 | Below/down. |
| 3 | Left. |
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
| direction | Optional integer direction stating the edge on which the change operation occurs resizing the associated window (as above), if omitted the user is prompted. |
| message | Optional message string to be used as the prompt, if omitted the default of “Change direction” is used. |
The change_window() primitive returns 1 on success, 0 if the edge does exist, otherwise -1 if the user aborted.
n/a
int change_window_pos( [int topx], [int topy], [int width], [int height], [int winnum] )
Modify window coordinates/size.
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.
| topx | Optional integer, if stated sets the x coordinate of the top left corner of the window, otherwise the current coordinate is taken. |
| topy | Optional integer, if stated sets the y coordinate of the top left corner of the window, otherwise the current coordinate is taken. |
| width | Optional 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. |
| height | Optional integer, if stated sets the new advised height in lines. |
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
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.
The winnum is a GriefEdit extension.
void close_window( [int winum] )
Close specified the window.
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.
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
none
Not implemented.
int create_edge( [int direction] )
Create an edge, splitting the window.
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,
| 0 | Above/up. |
| 1 | Right. |
| 2 | Below/down. |
| 3 | Left. |
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.
| direction | Optional integer direction stating the edge on which the split operation occurs creating the new window (as above), if omitted the user is prompted. |
The create_edge() primitive returns 1 on success, 0 if the window was too small too split, otherwise -1 if the user aborted.
n/a
int create_menu_window( [int create] )
Create the menu window.
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.
| create | Optional integer flag, if specified as non-zero and the menu resource has as yet to be created, it shall be built. |
Returns the unique identifier of the menu window resource, otherwise -1 if the menu has yet to be created.
A GriefEdit extension.
int create_tiled_window( int lx, int by, int rx, int ty, [int bufnum] )
Creates a tiled window.
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.
| lx | Coordinate of the left edge. |
| by | Coordinate of the bottom edge. |
| rx | Coordinate of the right edge. |
| ty | Coordinate of the top edge. |
| bufnum | Optional buffer identifier to be attached to the newly create window, see attach_buffer. |
Returns the unique identifier of the new window.
n/a
int create_window( int lx, int by, int rx, int ty, [string message] )
Create a popup window.
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.
| lx | Coordinate of the left edge. |
| by | Coordinate of the bottom edge. |
| rx | Coordinate of the right edge. |
| ty | Coordinate of the top edge. |
| message | Optional string containing the message which shall be displayed on the bottom frame. |
Returns the unique identifier of the new window.
Unlike BRIEF the number of windows which may be active at any one time is only limit by system resources.
attach_buffer, create_edge, create_tiled_window, create_menu_window, delete_window, inq_screen_size
int delete_edge( [int direction] )
Delete an edge, combining a split window.
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,
| 0 | Above/up. |
| 1 | Right. |
| 2 | Below/down. |
| 3 | Left. |
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.
| direction | Optional integer direction stating the edge on which the join operation occurs deleting the associated windows (as above), if omitted the user is prompted. |
The delete_edge() primitive returns 1 on success, 0 if the edge does exist, otherwise -1 if the user aborted.
n/a
int distance_to_indent( [int column] )
Calculate distance to next indent.
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:
| column | Optional column if omitted the current buffer position is referenced. |
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.
A GriefEdit extension.
int distance_to_tab( [int column] )
Calculate distance to next tab.
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.
| column | Optional column if omitted the current buffer position is referenced. |
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.
n/a
int inq_char_map( [int winnum], [string &name] )
Retrieve the character-map.
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.
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
| name | Optional string referenced, if specified shall be populated with the assigned character-map name. |
The inq_char_map() primitive returns the associated character-mapid otherwise -1 if one is not assigned.
The name parameter is a GRIEF extension.
int inq_ctrl_state( int ctrl, [int winnum] )
Retrieve the state of a window control.
The inq_ctrl_state() primitive retrieves the state of a window control of the specific window, if omitted the current window.
| ctrl | Control identifier; see set_ctrl_state for details. |
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
The return value depends on the specified control.
| 0 | Disabled. |
| 1 | Enabled. |
| -1 | Hidden globally. |
| -2 | Hidden explicitly for this window. |
| -3 | Hidden globally and explicitly. |
| -1 | Disabled. |
| n | The position (percentage) of the thumb on the scroll bar, with a value 0 thru to 100. |
n/a
int inq_mode( [int bufnum], [int &localised] )
Returns the overstrike mode.
The inq_mode() primitive retrieves the current insert/overstrike (also known as overtype) mode.
| bufnum | Optional buffer number, if omitted the current buffer shall be referenced. |
| localised | Optional 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. |
The inq_mode() primitive retrieves the non-zero if in insert mode, otherwise zero if in overstrike mode.
The localised status is a GriefEdit extension.
int inq_top_left( [int &top], [int &indent], [int winnum], [int &line], [int &col], [int &bufnum] )
Retrieve window view port coordinates.
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.
| line | Optional integer, if specified is populated with the line at the top of the window. |
| column | Optional integer, retrieves the column at the top left corner of the window. |
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
| csrline | Optional integer, if specified is populated with the buffer cursor line position. |
| csrcolumn | Optional integer, retrieves the buffer cursor column position. |
| bufnum | Optional integer, if specified is populated with the associated buffer identifier. |
The associated window identifier, otherwise -1 on error.
n/a
int inq_views( [int bufnum] )
Determine window count.
The inq_views() primitive determines the number of windows that are viewing the specified buffer bufnum.
| bufnum | Optional buffer number, if omitted the current buffer shall be referenced. |
The inq_views() primitive returns the number of windows attached to the specified buffer, otherwise 0 on error.
n/a
int inq_window()
Retrieve the current window.
The inq_window() primitive retrieves the window identifier of the current window.
none
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.
n/a
int inq_window_buf( [int winnum] )
Retrieve the associated buffer.
The inq_window_buf() primitive retrieves the associated buffer identifier of the specified window, if omitted the current window.
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
The associated buffer identifier, otherwise -1 on error.
n/a
int inq_window_flags( [int winnum], [string flags] )
Retrieve window flags.
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. |
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
| flags | Optional comma separated list of window flag names, if given the value of the specific flags are returned, otherwise the full flags is returned. |
Returns the associated window flags.
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.
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.
The inq_window_info() primitive retrieves information associated with the current windowd.
| winnum | An integer variable which shall be populated with the window identifier, otherwise -1 if no buffer is attached. |
| bufnum | An 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. |
| lx | An integer variable which shall be populated with the left x coordinate of the specified window. |
| by | An integer variable which shall be populated with the bottom x coordinate of the specified window. |
| rx | An integer variable which shall be populated with the right x coordinate of the specified window. |
| ty | An integer variable which shall be populated with the top y coordinate of the specified window. |
| title | A string variable, which shall be assigned the specified window title value. |
| message | A string variable, which shall be assigned the specified window message value. |
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.
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.
inq_window, create_window, create_tiled_window, create_menu_window
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.
The inq_window_infox() primitive retrieves information associated with the specified window winnum or the current window if no window is specified.
| winnum | Optional integer window identifier, if omitted the current window is referenced. |
| bufnum | An 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. |
| lx | An integer variable which shall be populated with the left x coordinate of the specified window. |
| by | An integer variable which shall be populated with the bottom x coordinate of the specified window. |
| rx | An integer variable which shall be populated with the right x coordinate of the specified window. |
| ty | An integer variable which shall be populated with the top y coordinate of the specified window. |
| title | A string variable, which shall be assigned the specified window title value. |
| message | A string variable, which shall be assigned the specified window message value. |
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.
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.
inq_window, create_window, create_tiled_window, create_menu_window
int insert( string|int val, [int num = 1] )
Insert string into current buffer.
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.
| val | String or integer character value to be inserted. |
| num | Option integer number stating the repeat count, if specified then the string is inserted the given number of times. If omitted, it defaults to 1. |
The insert() primitive returns the number of characters inserted.
The standard function has a void declaration and returns nothing.
int insert_buffer( int bufnum, string format, ... )
Insert format text into a buffer.
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).
| bufnum | Buffer number. |
| format | String 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. |
The insert_buffer() primitive returns the number of characters written to the referenced buffer, otherwise -1 on error.
The CRiSPEdit™ version has a void declaration and returns nothing.
int insert_mode( [int value], [int bufnum] )
Set the buffer insert/overstrike mode.
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.
| value | Optional 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. |
| bufnum | Optional buffer number when stated the buffer specific insert mode shall be modified, if omitted the global insert mode is modified. |
The insert_mode() primitive returns the previous insert mode.
n/a
int insertf( string format, ... )
Insert a formatted string.
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).
| format | String 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. |
The insertf() primitive returns the number of characters written to the referenced buffer, otherwise -1 on error.
A GriefEdit extension.
int move_edge( [int direction], [int amount] )
Modify a window.
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.
Moves the lower edge of the current window up four lines.
move_edge(2, -4);
| direction | Optional integer direction stating the edge on which the move operation occurs resizing the associated windows (as above), if omitted the user is prompted. |
| amount | Optional 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. |
The move_edge() primitive returns non-zero if cursor moved, otherwise 0 if cursor did not move.
n/a
int next_window( int winnum )
Obtain the next window identifier.
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.
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
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.
Iterate though all windows
int curwin, win;
curwin = inq_window();
if ((win = curwin) != -1) {
do {
// ... process
} while ((win = next_window(win)) != curwin);
}
n/a
int right( [int columns = 1], [int wrap = TRUE] )
Move position right one character.
The right() primitive moves the cursor right one column retaining the current line.
| columns | Optional number of columns to move the cursor; negative in which case the cursor movement is reversed behaving like left. |
| wrap | Optional boolean value controlling whether the cursor wraps when positioned at the beginning of line. If FALSE line wrapping shall be disabled, see left. |
The right() primitive returns non-zero on success denoting that the cursor moved, otherwise zero if the cursor remained unchanged.
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.
void self_insert( [int character] )
Insert a character as if it was typed.
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.
| tab | Cursor is moved the next tab stop, and space backfilled if at the end of the line. |
| newlines | Cursor 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.
| character | Optional integer character code to be inserted. If omitted, the value of the last key typed is inserted into the buffer. |
nothing
n/a
int set_buffer_cmap( [int mapid|string name], [int bufnum] )
Set a buffers character-map.
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.
| mapid, name | Character-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. |
| bufnum | Optional buffer number, if omitted the current buffer shall be referenced. |
The set_buffer_cmap() primitive returns the identifier of the resolved character-map otherwise -1 if the specified character map does not exist.
n/a
void set_ctrl_state( int ctrl, int state, [int winnum] )
Set the state of a window control.
The set_ctrl_state() primitive sets the state of a window control of the specific window, if omitted the current window.
| ctrl | Control identifier. |
| WCTRLO_CLOSE_BTN | Close button. |
| WCTRLO_ZOOM_BTN | Zoom button. |
| WCTRLO_VERT_SCROLL | Vertical scroll. |
| WCTRLO_HORZ_SCROLL | Horizontal scroll. |
| WCTRLO_VERT_THUMB | Vertical thumb. |
| WCTRLO_HORZ_THUMB | Horizontal thumb. |
| WCTRLS_ENABLE | Enable the control all windows. |
| WCTRLS_DISABLE | Disable the control all windows. |
| WCTRLS_HIDE | Used to temporarily hide object for either the specified window or all windows, if window is omitted. |
| WCTRLS_SHOW | Restore 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_ZOOMED | Display the zoomed button. |
nothing
n/a
int set_feature( [int|string feature], [string value] )
Config an editor feature.
The set_feature() primitive sets the status of the specific feature feature.
The set_feature() primitive is an experimental interface and may change without notice.
| feature | Name of the feature. |
| value | Configuration value. |
The set_feature() primitive returns non-zero on success, otherwise zero on error.
Macro Portability; A GriefEdit extension.
int set_font( [string normalfont], [string italicfont] )
Set the current window fonts.
The set_font() primitive configures the active normal and/or italic font of the current running GriefEdit image.
Only available when running under a suitable windowing system, otherwise this primitive is a no-op.
| normalfont | Optional string containing the normal text font. |
| italicfont | Optional italic font. |
The set_font() primitive returns zero or greater on success, otherwise -1 on error.
GriefEdit extended.
int set_top_left( [int line], [int column], [int winnum], [int csrline], [int csrcolumn], [int bufnum] )
Manages window view port coordinates.
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.
| line | Optional integer, specifies the line within the buffer which should be at the top of the window. |
| column | Optional integer, specifies the column within the buffer which should be at the top of the window |
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
| csrline | Optional integer states the cursor position, if stated specifies the line within the buffer on which the cursor shall be positioned. |
| csrcolumn | Optional integer states the cursor position, if stated specifies the column within the buffer on which the cursor shall be positioned. |
| bufnum | Optional 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. |
The effected window identifier, otherwise -1 on error.
n/a
int set_window( int winnum )
Set the active window.
The set_window() primitive set the current window to the specified window identifier.
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
Returns non-zero if the window was changed, otherwise zero if specified window was already the current and no change occurred.
Unlike BRIEF the current buffer is not affected, which changed the buffer to the one associated with the specified window.
int set_window_cmap( [int mapid|string name], [int winnum] )
Set a windows character-map.
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.
| mapid, name | Character-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. |
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
The set_window_cmap() primitive returns the identifier of the resolved character-map otherwise -1 if the specified character map does not exist.
n/a
void set_window_flags( [int winnum], [string set|int or_mask], [string clear|int and_mask] )
Set window flags.
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. |
| winnum | Optional window identifier, if omitted the current window shall be referenced. |
| set_mask | Optional 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_mask | Optional 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. |
nothing
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.
void set_wm_name( [string wname], [string iname] )
Set the window and/or icon name.
The set_wm_name() primitive configures the window and/or the minimised icon name of the current running GriefEdit image.
Only available when running under a suitable windowing system, otherwise this primitive is a no-op.
| wname | Optional string containing the window name. |
| iname | Optional icon name. |
The set_wm_name() primitive returns zero or greater on success, otherwise -1 on error.
GriefEdit extended.
int translate_pos( int x, int y, [int &winnum], [int &line], [int &col] )
Convert window coordinates.
The translate_pos() primitive translates the physical screen position (x, y) into a window and logical line/col position.
| x, y | Screen coordinates to be translate. |
| winnum | Optional 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, col | Optional integer variables which shall be populated with the translated window coordinates, otherwise -1 if no window was mapped. |
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. |
n/a
int up( [int lines = 1] )
Move position up one line.
The up() primitive moves the cursor up one line to the same column on the previous line.
| lines | Optional number of lines to move the cursor; may be negative in which case the cursor moves forward behaving like down. |
The up() primitive returns non-zero on success denoting that the cursor moved, otherwise zero if the cursor remained unchanged.
n/a
$Id: $
To send feedback on this topic email: griefedit@gmail.com
Copyright © Adam Young All Rights Reserved.
Selects a new window.
void change_window( [int direction], [string message] )
Modify window coordinates/size.
int change_window_pos( [int topx], [int topy], [int width], [int height], [int winnum] )
Close specified the window.
void close_window( [int winum] )
Create an edge, splitting the window.
int create_edge( [int direction] )
Create the menu window.
int create_menu_window( [int create] )
Creates a tiled window.
int create_tiled_window( int lx, int by, int rx, int ty, [int bufnum] )
Create a popup window.
int create_window( int lx, int by, int rx, int ty, [string message] )
Delete an edge, combining a split window.
int delete_edge( [int direction] )
Delete a window.
void delete_window( [int winum] )
Calculate distance to next indent.
int distance_to_indent( [int column] )
Calculate distance to next tab.
int distance_to_tab( [int column] )
Retrieve the character-map.
int inq_char_map( [int winnum], [string &name] )
Retrieve the state of a window control.
int inq_ctrl_state( int ctrl, [int winnum] )
Returns the overstrike mode.
int inq_mode( [int bufnum], [int &localised] )
Retrieve window view port coordinates.
int inq_top_left( [int &top], [int &indent], [int winnum], [int &line], [int &col], [int &bufnum] )
Determine window count.
int inq_views( [int bufnum] )
Retrieve the current window.
int inq_window()
Retrieve the associated buffer.
int inq_window_buf( [int winnum] )
Retrieve window flags.
int inq_window_flags( [int winnum], [string flags] )
Retrieve the current window information.
int inq_window_info( [int &winnum], [int &bufnum], [int &lx], [int &by], [int &rx], [int &ty], [string &title = NULL], [string &message = NULL] )
Retrieve information about a window.
int inq_window_infox( [int winnum], [int &bufnum], [int &lx], [int &by], [int &rx], [int &ty], [string &title = NULL], [string &message = NULL] )
Insert string into current buffer.
int insert( string|int val, [int num = 1] )
Insert format text into a buffer.
int insert_buffer( int bufnum, string format, ... )
Set the buffer insert/overstrike mode.
int insert_mode( [int value], [int bufnum] )
Insert a formatted string.
int insertf( string format, ... )
Modify a window.
int move_edge( [int direction], [int amount] )
Obtain the next window identifier.
int next_window( int winnum )
Move position right one character.
int right( [int columns = 1], [int wrap = TRUE] )
Insert a character as if it was typed.
void self_insert( [int character] )
Set a buffers character-map.
int set_buffer_cmap( [int mapid|string name], [int bufnum] )
Set the state of a window control.
void set_ctrl_state( int ctrl, int state, [int winnum] )
Config an editor feature.
int set_feature( [int|string feature], [string value] )
Set the current window fonts.
int set_font( [string normalfont], [string italicfont] )
Manages window view port coordinates.
int set_top_left( [int line], [int column], [int winnum], [int csrline], [int csrcolumn], [int bufnum] )
Set the active window.
int set_window( int winnum )
Set a windows character-map.
int set_window_cmap( [int mapid|string name], [int winnum] )
Set window flags.
void set_window_flags( [int winnum], [string set|int or_mask], [string clear|int and_mask] )
Set the window and/or icon name.
void set_wm_name( [string wname], [string iname] )
Convert window coordinates.
int translate_pos( int x, int y, [int &winnum], [int &line], [int &col] )
Move position up one line.
int up( [int lines = 1] )
Set window border status.
int borders( [int borders] )
Control window display.
int display_windows( [int mode] )
Attach a buffer to a window.
void attach_buffer( int bufnum )
Determine screen dimensions.
int inq_screen_size( [int &rows], [int &cols], [int &colors] )
Set the window display priority.
int set_window_priority( int priority, [int winnum] )
Configure the buffer ruler.
int set_ruler( [int bufnum], [list|string|int ...] )
Set the buffers default indentation.
int set_indent( [int indent], [int bufnum] )
Set buffer tab stops.
int tabs( [string tabs | list tabs | int tab, ...] )
Create a display character-map.
int create_char_map( [int mapid|string name], [int start = 0], [list chars], [list flags], [string name] )
Retrieve current buffer position.
int inq_position( [int &line], [int &col] )
Bitwise complement.
~expr
Send string to a attached process.
int insert_process( string|int val, [int num = 1] )
Move position left one charcter.
int left( [int columns = 1], [int wrap = TRUE] )
Move position down one line.
int down( [int lines = 1] )
Assign command to key or key sequence.
int assign_to_key( [string key], [string macro] )
Assign self_insert to all typeable keys.
int keyboard_typeables()
Retrieve an editor feature.
int|list inq_feature( [int|string feature], [string value] )
Inquire the current window fonts.
int inq_font( string & normalfont, [string &italicfont] )
Retrieve last mouse action.
void get_mouse_pos( [int &x], [int &y], [int &winnum], [int &line], [int &col], [int &where], [int ®ion], [int &event] )
Process mouse event.
void process_mouse( [int b1], [int b2], [int b3], int x, int y )