GEMLIB  0.44.0
Macros | Typedefs | Functions
MagiC extension: Edit Library

AES extended edit functions. More...

Macros

#define edit_create()   mt_edit_create(aes_global)
 
#define edit_open(a, b)   mt_edit_open(a,b,aes_global)
 
#define edit_close(a, b)   mt_edit_close(a,b,aes_global)
 
#define edit_delete(a)   mt_edit_delete(a,aes_global)
 
#define edit_cursor(a, b, c, d)   mt_edit_cursor(a,b,c,d,aes_global)
 
#define edit_evnt(a, b, c, d, e)   mt_edit_evnt(a,b,c,d,e,aes_global)
 
#define edit_get_buf(a, b, c, d, e)   mt_edit_get_buf(a,b,c,d,e,aes_global)
 
#define edit_set_buf(a, b, c, d)   mt_edit_set_buf(a,b,c,d,aes_global)
 
#define edit_set_format(a, b, c, d)   mt_edit_set_format(a,b,c,d,aes_global)
 
#define edit_get_format(a, b, c, d)   mt_edit_get_format(a,b,c,d,aes_global)
 
#define edit_set_font(a, b, c, d, e, f)   mt_edit_set_font(a,b,c,d,e,f,aes_global)
 
#define edit_get_font(a, b, c, d, e, f)   mt_edit_get_font(a,b,c,d,e,f,aes_global)
 
#define edit_set_colour(a, b, c, d)   mt_edit_set_colour(a,b,c,d,aes_global)
 
#define edit_resized(a, b, c, d)   mt_edit_resized(a,b,c,d,aes_global)
 
#define edit_get_dirty(a, b)   mt_edit_get_dirty(a,b,aes_global)
 
#define edit_set_dirty(a, b, c)   mt_edit_set_dirty(a,b,c,aes_global)
 
#define edit_get_sel(a, b, c, d)   mt_edit_get_sel(a,b,c,d,aes_global)
 
#define edit_get_pos(a, b, c, d, e, f, g, h)   mt_edit_get_pos(a,b,c,d,e,f,g,h,aes_global)
 
#define edit_set_pos(a, b, c, d, e, f, g, h)   mt_edit_set_pos(a,b,c,d,e,f,g,h,aes_global)
 
#define edit_get_scrollinfo(a, b, c, d, e, f, g, h, i)   mt_edit_get_scrollinfo(a,b,c,d,e,f,g,h,i,aes_global)
 
#define edit_scroll(a, b, c, d, e)   mt_edit_scroll(a,b,c,d,e,aes_global)
 
#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().

Macro Definition Documentation

#define edit_close (   a,
 
)    mt_edit_close(a,b,aes_global)

single-thread version of mt_edit_close()

#define edit_create ( )    mt_edit_create(aes_global)

single-thread version of mt_edit_create()

#define edit_cursor (   a,
  b,
  c,
 
)    mt_edit_cursor(a,b,c,d,aes_global)

single-thread version of mt_edit_cursor()

#define edit_delete (   a)    mt_edit_delete(a,aes_global)

single-thread version of mt_edit_delete()

#define edit_evnt (   a,
  b,
  c,
  d,
 
)    mt_edit_evnt(a,b,c,d,e,aes_global)

single-thread version of mt_edit_evnt()

#define edit_get_buf (   a,
  b,
  c,
  d,
 
)    mt_edit_get_buf(a,b,c,d,e,aes_global)

single-thread version of mt_edit_get_buf()

#define edit_get_dirty (   a,
 
)    mt_edit_get_dirty(a,b,aes_global)

single-thread version of mt_edit_get_dirty()

#define edit_get_font (   a,
  b,
  c,
  d,
  e,
 
)    mt_edit_get_font(a,b,c,d,e,f,aes_global)

single-thread version of mt_edit_get_font()

#define edit_get_format (   a,
  b,
  c,
 
)    mt_edit_get_format(a,b,c,d,aes_global)

single-thread version of mt_edit_get_format()

#define edit_get_pos (   a,
  b,
  c,
  d,
  e,
  f,
  g,
 
)    mt_edit_get_pos(a,b,c,d,e,f,g,h,aes_global)

single-thread version of mt_edit_get_pos()

#define edit_get_scrollinfo (   a,
  b,
  c,
  d,
  e,
  f,
  g,
  h,
 
)    mt_edit_get_scrollinfo(a,b,c,d,e,f,g,h,i,aes_global)

single-thread version of mt_edit_get_scrollinfo()

#define edit_get_sel (   a,
  b,
  c,
 
)    mt_edit_get_sel(a,b,c,d,aes_global)

single-thread version of mt_edit_get_sel()

#define edit_open (   a,
 
)    mt_edit_open(a,b,aes_global)

single-thread version of mt_edit_open()

#define edit_resized (   a,
  b,
  c,
 
)    mt_edit_resized(a,b,c,d,aes_global)

single-thread version of mt_edit_resized()

#define edit_scroll (   a,
  b,
  c,
  d,
 
)    mt_edit_scroll(a,b,c,d,e,aes_global)

single-thread version of mt_edit_scroll()

#define edit_set_buf (   a,
  b,
  c,
 
)    mt_edit_set_buf(a,b,c,d,aes_global)

single-thread version of mt_edit_set_buf()

#define edit_set_colour (   a,
  b,
  c,
 
)    mt_edit_set_colour(a,b,c,d,aes_global)

single-thread version of mt_edit_set_colour()

#define edit_set_dirty (   a,
  b,
 
)    mt_edit_set_dirty(a,b,c,aes_global)

single-thread version of mt_edit_set_dirty()

#define edit_set_font (   a,
  b,
  c,
  d,
  e,
 
)    mt_edit_set_font(a,b,c,d,e,f,aes_global)

single-thread version of mt_edit_set_font()

#define edit_set_format (   a,
  b,
  c,
 
)    mt_edit_set_format(a,b,c,d,aes_global)

single-thread version of mt_edit_set_format()

#define edit_set_pos (   a,
  b,
  c,
  d,
  e,
  f,
  g,
 
)    mt_edit_set_pos(a,b,c,d,e,f,g,h,aes_global)

single-thread version of mt_edit_set_pos()

#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
treeRSC-tree of object
objObject number
global_aesglobal 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_aesglobal 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
treeRSC-tree of object
objObject number
whdlWindow handle or -1
shownew cursor state or -1
global_aesglobal 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
xiPointer to a XEDITINFO structure returned by mt_edit_create()
global_aesglobal 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
treeRSC-tree of object
objObject number
whdlWindow handle or -1
evEVENT structure as for mt_wdlg_evnt(), mt_fnts_evnt(). The events are serviced by the dialog if they are intended for the associated window.
errcError code (-200 = text buffer full)
[option CHECK_NULLPTR] errc may be NULL
global_aesglobal 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
treeRSC-tree of object
objObject number
bufthis pointer will be filled with the address of buffer
[option CHECK_NULLPTR] buf may be NULL
buflenthis pointer will be filled with the buffer length
[option CHECK_NULLPTR] buflen may be NULL
txtlenthis pointer will be filled with the current text length without EOS
[option CHECK_NULLPTR] txtlen may be NULL
global_aesglobal 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
treeRSC-tree of object
objObject number
tcolourwill be filled with the Text colour
[option CHECK_NULLPTR] tcolour may be NULL
bcolourwill be filled with the Background colour
[option CHECK_NULLPTR] bcolour may be NULL
global_aesglobal 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
treeRSC-tree of object
objObject number
cursorposwill be filled with the Cursor position in text [option CHECK_NULLPTR] cursorpos may be NULL
global_aesglobal 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
treeRSC-tree of object
objObject number
global_aesglobal 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
treeRSC-tree of object
objObject number
font_idwill be filled with the Font-ID
[option CHECK_NULLPTR] font_id may be NULL
font_hwill be filled with the Height for vst_point()
[option CHECK_NULLPTR] font_h may be NULL
monowill be filled with the Flag for equidistant font
[option CHECK_NULLPTR] mono may be NULL
font_pixwill be filled with:
  • 0=points,
  • 1=pixels (from 3.5.98 on)
[option CHECK_NULLPTR] font_pix may be NULL
global_aesglobal 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
treeRSC-tree of object
objObject number
tabwidthwill be filled by the tabulator width.
[option CHECK_NULLPTR] tabwidth may be NULL
autowrapwill 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_aesglobal 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
treeRSC-tree of object
objObject 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_aesglobal 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
treeRSC-tree of object
objObject number
nlineswill be filled with the Number of lines in text
[option CHECK_NULLPTR] nlines may be NULL
yscrollwill be filled with the First visible line
[option CHECK_NULLPTR] yscroll may be NULL
yviswill be filled with the Number of max. visible lines
[option CHECK_NULLPTR] yvis may be NULL
yvalwill be filled with the Number of currently visible lines
[option CHECK_NULLPTR] yval may be NULL
ncolswill be filled with the Number of columns, or -1 (unknown)
[option CHECK_NULLPTR] ncols may be NULL
xscrollwill be filled with the Horiz. scroll offset in pixels
[option CHECK_NULLPTR] xscroll may be NULL
xviswill be filled with the Number of visible columns (in pixels)
[option CHECK_NULLPTR] xvis may be NULL
global_aesglobal 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
treeRSC-tree of object
objObject number
bselwill 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
eselwill be filled with a pointer to the character after the end of the selected region
[option CHECK_NULLPTR] esel may be NULL
global_aesglobal 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
treeRSC-tree of object
objObject number
global_aesglobal 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
treeRSC-tree of object
objObject number
oldrhOld net height of object
[option CHECK_NULLPTR] oldrh may be NULL
newrhNew net height of object
[option CHECK_NULLPTR] newrh may be NULL
global_aesglobal 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
treeRSC-tree of object
objObject number
whdlWindow handle or -1
yscrollVertical scroll offset in lines
xscrollHorizontal scroll offset in pixels
global_aesglobal 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
treeRSC-tree of object
objObject number
bufspecifies the Length of text buffer inclusive of closing Nullbyte.
buflenis 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_aesglobal 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
treeRSC-tree of object
objObject number
tcolour-1 or text colour
bcolour-1 or background colour
global_aesglobal 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
treeRSC-tree of object
objObject number
cursorposspecifies the new Absolute cursor position
global_aesglobal 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
treeRSC-tree of object
objObject number
dirtyspecifies the new dirty flag (0 or 1)
global_aesglobal 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
treeRSC-tree of object
objObject number
font_idspecifies the Font-ID
font_hspecifies the Character height in "points"
font_pixspecifies the font size unit (0=points, 1=pixels) (available from 3.5.98 on)
monospecifies the "Equidistant" flag
global_aesglobal 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
treeRSC-tree of object
objObject number
tabwidthspecifies the tabulator width in pixels, or -1.
autowrapspecifies 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_aesglobal 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
treeRSC-tree of object
objObject number
xscroll
yscroll
cyscroll
cursorpos
cx
cy
global_aesglobal 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().