Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

MagiC extension: Edit Library
[AES Function Reference]

AES extended edit functions. More...

Defines

#define mt_edit_get_color   mt_edit_get_colour
#define mt_edit_set_color   mt_edit_set_colour

Typedefs

typedef void XEDITINFO

Functions

XEDITINFOmt_edit_create (short *global)
void mt_edit_delete (XEDITINFO *xi, short *global)
short mt_edit_open (OBJECT *tree, short obj, short *global)
void mt_edit_close (OBJECT *tree, short obj, short *global)
short mt_edit_cursor (OBJECT *tree, short obj, short whdl, short show, short *global)
short mt_edit_evnt (OBJECT *tree, short obj, short whdl, EVNT *ev, long *errc, short *global)
short mt_edit_get_buf (OBJECT *tree, short obj, char **buf, long *buflen, long *txtlen, short *global)
short mt_edit_get_format (OBJECT *tree, short obj, short *tabwidth, short *autowrap, short *global)
short mt_edit_get_colour (OBJECT *tree, short obj, short *tcolour, short *bcolour, short *global)
short mt_edit_get_cursor (OBJECT *tree, short obj, char **cursorpos, short *global)
short mt_edit_get_font (OBJECT *tree, short obj, short *fontID, short *fontH, short *fontPix, short *mono, short *global)
void mt_edit_set_buf (OBJECT *tree, short obj, char *buf, long buflen, short *global)
void mt_edit_set_format (OBJECT *tree, short obj, short tabwidth, short autowrap, short *global)
void mt_edit_set_font (OBJECT *tree, short obj, short fontID, short fontH, short fontPix, short mono, short *global)
void mt_edit_set_colour (OBJECT *tree, short obj, short tcolour, short bcolour, short *global)
void mt_edit_set_cursor (OBJECT *tree, short obj, char *cursorpos, short *global)
short mt_edit_resized (OBJECT *tree, short obj, short *oldrh, short *newrh, short *global)
short mt_edit_get_dirty (OBJECT *tree, short obj, short *global)
void mt_edit_set_dirty (OBJECT *tree, short obj, short dirty, short *global)
void mt_edit_get_sel (OBJECT *tree, short obj, char **bsel, char **esel, short *global)
void mt_edit_get_pos (OBJECT *tree, short obj, short *xscroll, long *yscroll, char **cyscroll, char **cursorpos, short *cx, short *cy, short *global)
void mt_edit_set_pos (OBJECT *tree, short obj, short xscroll, long yscroll, char *cyscroll, char *cursorpos, short cx, short cy, short *global)
short mt_edit_scroll (OBJECT *tree, short obj, short whdl, long yscroll, short xscroll, short *global)
void mt_edit_get_scrollinfo (OBJECT *tree, short obj, long *nlines, long *yscroll, short *yvis, short *yval, short *ncols, short *xscroll, short *xvis, short *global)

Detailed Description

AES extended edit functions.

This Edit Library is available from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:

Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

Define Documentation

#define mt_edit_get_color   mt_edit_get_colour
 

another name, with "color" instead of "colour" to be consistent with AES/VDI function naming rules

#define mt_edit_set_color   mt_edit_set_colour
 

another name, with "color" instead of "colour" to be consistent with AES/VDI function naming rules


Typedef Documentation

typedef void XEDITINFO
 

opaque data structure use by mt_edit_create() and mt_edit_delete()


Function Documentation

void mt_edit_close OBJECT tree,
short  obj,
short global_aes
 

Parameters:
tree RSC-tree of object
obj Object number
global_aes global AES array
The object-size-dependent management structures are closed and the memory used is released. The descriptor itself, though, is preserved. Text management is now no longer possible.

Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

XEDITINFO* mt_edit_create short global_aes  ) 
 

Create editable object

Parameters:
global_aes global AES array
Returns:
a descriptor for any further actions, or NULL if an error has occurred (not enough memory). The descriptor must be entered as ob_spec into the object.
The corresponding descriptor is created (memory is reserved), but the editor has not been opened yet. One can now alter several settings with mt_edit_set(). The default settings are:
  • System font, 10 pt
  • Black on white
  • No line wrap
  • Tabulator width 64 pixels

Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

short mt_edit_cursor OBJECT tree,
short  obj,
short  whdl,
short  show,
short global_aes
 

Cursor on/off

Parameters:
tree RSC-tree of object
obj Object number
whdl Window handle or -1
show new cursor state or -1
global_aes global AES array
Returns:
the cursor-off counter.
The cursor is switched on (show == 1), switched off (show == 0) or examined (show == -1). The call can be nested.

Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

void mt_edit_delete XEDITINFO xi,
short global_aes
 

Remove editable object

Parameters:
xi Pointer to a XEDITINFO structure returned by mt_edit_create()
global_aes global AES array
The descriptor is released. If the object is to be used further then the object type has to be placed back on G_BOX.

Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

short mt_edit_evnt OBJECT tree,
short  obj,
short  whdl,
EVNT ev,
long *  errc,
short global_aes
 

Service editable object

Parameters:
tree RSC-tree of object
obj Object number
whdl Window handle or -1
ev EVENT structure as for mt_wdlg_evnt(), mt_fnts_evnt(). The events are serviced by the dialog if they are intended for the associated window.
errc Error code (-200 = text buffer full)
[option CHECK_NULLPTR] errc may be NULL
global_aes global AES array
Returns:
0 if the passed events were not all serviced, say because the text buffer was full or an error arose.
Events, i.e. mouse clicks and key presses, are forwarded to the editable object and serviced by it if appropriate. When an event has been serviced, the corresponding bit in the EVENT structure is cleared. The error code errc is present only from version 7 of the SLB onwards; the binding in this library ensures that old SLB versions always return Nulls.

Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

short mt_edit_get_buf OBJECT tree,
short  obj,
char **  buf,
long *  buflen,
long *  txtlen,
short global_aes
 

Examine settings: Text buffer

Parameters:
tree RSC-tree of object
obj Object number
buf this pointer will be filled with the address of buffer
[option CHECK_NULLPTR] buf may be NULL
buflen this pointer will be filled with the buffer length
[option CHECK_NULLPTR] buflen may be NULL
txtlen this pointer will be filled with the current text length without EOS
[option CHECK_NULLPTR] txtlen may be NULL
global_aes global AES array
Returns:
0 for error, else 1
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

short mt_edit_get_colour OBJECT tree,
short  obj,
short tcolour,
short bcolour,
short global_aes
 

Examine settings: Colours

Parameters:
tree RSC-tree of object
obj Object number
tcolour will be filled with the Text colour
[option CHECK_NULLPTR] tcolour may be NULL
bcolour will be filled with the Background colour
[option CHECK_NULLPTR] bcolour may be NULL
global_aes global AES array
Returns:
0 for error, else 1
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

short mt_edit_get_cursor OBJECT tree,
short  obj,
char **  cursorpos,
short global_aes
 

Examine settings: Absolute cursor position

Parameters:
tree RSC-tree of object
obj Object number
cursorpos will be filled with the Cursor position in text [option CHECK_NULLPTR] cursorpos may be NULL
global_aes global AES array
Returns:
0 (error) or 1 (OK)
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

short mt_edit_get_dirty OBJECT tree,
short  obj,
short global_aes
 

Examine settings: Dirty flag

Parameters:
tree RSC-tree of object
obj Object number
global_aes global AES array
Returns:
the dirty flag (0 or 1)
With this one can ascertain whether the text was altered in the meantime. The flag can be cleared again with mt_edit_set_dirty() or mt_edit_set_buf().

Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

short mt_edit_get_font OBJECT tree,
short  obj,
short font_id,
short font_h,
short font_pix,
short mono,
short global_aes
 

Examine settings: Font

Parameters:
tree RSC-tree of object
obj Object number
font_id will be filled with the Font-ID
[option CHECK_NULLPTR] font_id may be NULL
font_h will be filled with the Height for vst_point()
[option CHECK_NULLPTR] font_h may be NULL
mono will be filled with the Flag for equidistant font
[option CHECK_NULLPTR] mono may be NULL
font_pix will be filled with:
  • 0=points,
  • 1=pixels (from 3.5.98 on)
[option CHECK_NULLPTR] font_pix may be NULL
global_aes global AES array
Returns:
0 for error, else 1
font_pix is only available from version 8 of the SLB. This library ensures that old SLB versionen always return a Null.

Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

short mt_edit_get_format OBJECT tree,
short  obj,
short tabwidth,
short autowrap,
short global_aes
 

Examine settings: Formating

Parameters:
tree RSC-tree of object
obj Object number
tabwidth will be filled by the tabulator width.
[option CHECK_NULLPTR] tabwidth may be NULL
autowrap will be filled by the autowrap information:
  • autowrap > 0: Pixel width for auto line wrap (generally == object width)
  • autowrap = 0: No wrapping, but horiz. scrolling
[option CHECK_NULLPTR] autowrap may be NULL
global_aes global AES array
Returns:
0 for error, else 1
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

void mt_edit_get_pos OBJECT tree,
short  obj,
short xscroll,
long *  yscroll,
char **  cyscroll,
char **  cursorpos,
short cx,
short cy,
short global_aes
 

Parameters:
tree RSC-tree of object
obj Object number
xscroll 
[option CHECK_NULLPTR] xscroll may be NULL
yscroll 
[option CHECK_NULLPTR] yscroll may be NULL
cyscroll 
[option CHECK_NULLPTR] cyscroll may be NULL
cursorpos 
[option CHECK_NULLPTR] cursorpos may be NULL
cx 
[option CHECK_NULLPTR] cx may be NULL
cy 
[option CHECK_NULLPTR] cy may be NULL
global_aes global AES array
Returns:
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

void mt_edit_get_scrollinfo OBJECT tree,
short  obj,
long *  nlines,
long *  yscroll,
short yvis,
short yval,
short ncols,
short xscroll,
short xvis,
short global_aes
 

Examine settings: Scroll information

Parameters:
tree RSC-tree of object
obj Object number
nlines will be filled with the Number of lines in text
[option CHECK_NULLPTR] nlines may be NULL
yscroll will be filled with the First visible line
[option CHECK_NULLPTR] yscroll may be NULL
yvis will be filled with the Number of max. visible lines
[option CHECK_NULLPTR] yvis may be NULL
yval will be filled with the Number of currently visible lines
[option CHECK_NULLPTR] yval may be NULL
ncols will be filled with the Number of columns, or -1 (unknown)
[option CHECK_NULLPTR] ncols may be NULL
xscroll will be filled with the Horiz. scroll offset in pixels
[option CHECK_NULLPTR] xscroll may be NULL
xvis will be filled with the Number of visible columns (in pixels)
[option CHECK_NULLPTR] xvis may be NULL
global_aes global AES array
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().
This information is required in order to set the horizontal and vertical scroll bars. As the editable object would have to make a vq_extend() for each individual line, actually at each alteration of a line, the number of columns is currently not defined and the call returns -1. MGEDIT here simply assumes a fixed width, in the same way as other programs e.g. VIEW.PRG and PC.PRG do as well. yval is always smaller or equal to yvis. If the text has fewer lines that yvis, then yval is always smaller.

void mt_edit_get_sel OBJECT tree,
short  obj,
char **  bsel,
char **  esel,
short global_aes
 

Examine settings: Selected region

Parameters:
tree RSC-tree of object
obj Object number
bsel will be filled with a pointer to the start of selected region, or NULL if no region is selected.
[option CHECK_NULLPTR] bsel may be NULL
esel will be filled with a pointer to the character after the end of the selected region
[option CHECK_NULLPTR] esel may be NULL
global_aes global AES array
Returns:
Unknown
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

short mt_edit_open OBJECT tree,
short  obj,
short global_aes
 

Open editable object

Parameters:
tree RSC-tree of object
obj Object number
global_aes global AES array
Returns:
1, if OK
The number of lines and columns of text visible for the object size is calculated, and corresponding pointers are created. Memory is then requested for it.

Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

short mt_edit_resized OBJECT tree,
short  obj,
short oldrh,
short newrh,
short global_aes
 

Alter settings: Object size

Parameters:
tree RSC-tree of object
obj Object number
oldrh Old net height of object
[option CHECK_NULLPTR] oldrh may be NULL
newrh New net height of object
[option CHECK_NULLPTR] newrh may be NULL
global_aes global AES array
Returns:
1 (OK) or 0 (error)
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().
For changes of the object size the editable object must release and reserve memory. Thus it is possible that in extreme circumstances the operation fails due to a shortage of memory. In that case the return value is 0. So that the calling program can execute a correct redraw, the previous and new actual height is returned. In fact it means here the number of visible lines multiplied by the line height, i.e. the object height without the unused bottom white border

short mt_edit_scroll OBJECT tree,
short  obj,
short  whdl,
long  yscroll,
short  xscroll,
short global_aes
 

Alter settings: Scroll positions

Parameters:
tree RSC-tree of object
obj Object number
whdl Window handle or -1
yscroll Vertical scroll offset in lines
xscroll Horizontal scroll offset in pixels
global_aes global AES array
Returns:
1 (OK) or 0 (Error)
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().
With this one scrolls horizontally and vertically absolutely. This call is required when a scroll bar or arrow has been clicked on. The window handle is required so that the rectangle list is taken into consideration during scrolling. An error code will be returned if the number of lines has been exceeded.

void mt_edit_set_buf OBJECT tree,
short  obj,
char *  buf,
long  buflen,
short global_aes
 

Allocate text buffer

Parameters:
tree RSC-tree of object
obj Object number
buf specifies the Length of text buffer inclusive of closing Nullbyte.
buflen is a pointer to the Text buffer. The text is present in DOS format with CR/LF as line-end identifier and is terminated by a Nullbyte.
global_aes global AES array
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().
The buffer is allocated to the text object, the number of lines are determined. The cursor is set to the start of the text. This call clears the Dirty flag.

void mt_edit_set_colour OBJECT tree,
short  obj,
short  tcolour,
short  bcolour,
short global_aes
 

Alter settings: Colours

Parameters:
tree RSC-tree of object
obj Object number
tcolour -1 or text colour
bcolour -1 or background colour
global_aes global AES array
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().
If one of the two attributes is to remain unchanged then -1 can be passed. If the editable object was opened previously, then one should generally trigger a redraw when changing one of the attributes.

void mt_edit_set_cursor OBJECT tree,
short  obj,
char *  cursorpos,
short global_aes
 

Alter settings: Absolute positioning of cursor

Parameters:
tree RSC-tree of object
obj Object number
cursorpos specifies the new Absolute cursor position
global_aes global AES array
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().

void mt_edit_set_dirty OBJECT tree,
short  obj,
short  dirty,
short global_aes
 

Alter settings: Dirty flag

Parameters:
tree RSC-tree of object
obj Object number
dirty specifies the new dirty flag (0 or 1)
global_aes global AES array
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().
With this one can clear the Dirty flag when the text has been saved.

void mt_edit_set_font OBJECT tree,
short  obj,
short  font_id,
short  font_h,
short  font_pix,
short  mono,
short global_aes
 

Alter settings: Font

Parameters:
tree RSC-tree of object
obj Object number
font_id specifies the Font-ID
font_h specifies the Character height in "points"
font_pix specifies the font size unit (0=points, 1=pixels) (available from 3.5.98 on)
mono specifies the "Equidistant" flag
global_aes global AES array
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().
If the editable object was opened previously, then one should generally trigger a redraw when changing the font. The " \p mono " flag is required to give the editable object the possibility to handle equidistant fonts (mono == 1) appreciably faster that proportional fonts (mono == 0). font_pix is only available from version 8 of the SLB onwards. Older versions always assume font_pix=0, i.e. exclusiely use vst_point() for setting the character height.

void mt_edit_set_format OBJECT tree,
short  obj,
short  tabwidth,
short  autowrap,
short global_aes
 

Alter settings: Formating

Parameters:
tree RSC-tree of object
obj Object number
tabwidth specifies the tabulator width in pixels, or -1.
autowrap specifies the auto wrapping feature as follow:
  • -1: Do not change
  • >0: Pixel width for auto line wrap (generally == object width)
  • =0: No wrapping, but horiz. scrolling
global_aes global AES array
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().
If one of the two attributes is to remain unchanged then -1 can be passed. If the editable object was opened previously then one should generally trigger a redraw when changing one of the attributes. From version 9 of the SLB the number of lines is recalculated when the autowrap setting is altered. In older versions this only happens with mt_edit_set_buf().

void mt_edit_set_pos OBJECT tree,
short  obj,
short  xscroll,
long  yscroll,
char *  cyscroll,
char *  cursorpos,
short  cx,
short  cy,
short global_aes
 

Parameters:
tree RSC-tree of object
obj Object number
xscroll 
yscroll 
cyscroll 
cursorpos 
cx 
cy 
global_aes global AES array
Since:
from MagiC 5.20 onwards. As it is implemented as part of the shared library (SLB or SharedLib), one only needs to open the library with:
Slbopen("EDITOBJC.SLB", NULL, 0L, &slb, &slbexec);
The library installs a new AES object-type G_EDIT (37) as well as the AES functions mt_edit_xx().


Generated on Wed Nov 3 22:42:21 2004 for GEMLIB by  doxygen 1.3.9.1