texteditor.gadget Reference

Comprehensive function reference for texteditor.gadget, synthesised from the AmigaOS NDK 3.2 Release 4 (Autodocs/texteditor).

This page documents 38 functions of texteditor.gadget. Each function entry follows the canonical autodoc format. struct Name, union Name, enum Name are clickable links to the type definition in the types reference.

Function index


GA_TEXTEDITOR_AreaMarked()

GA_TEXTEDITOR_AreaMarked -- [..G], BOOL

Function

    This tag will be set to TRUE when text is marked. And back to
    FALSE when nothing is marked.
    You can create a notifyevent with this tag and let your cut/copy
    buttons become ghosted when nothing is marked.

GA_TEXTEDITOR_ColorMap()

**GA_TEXTEDITOR_ColorMap -- [IS.], LONG ***

Function

    This is a map of allocated colors, which corresponds to the pen
    number you set with GA_TEXTEDITOR_Pen.
    By default the map looks like this:

       0 = Normal (user configured text/highlight color)
       1 = Shine
       2 = Halfshine
       3 = Background
       4 = Halfshadow
       5 = Shadow
       6 = Text
       7 = Fill
       8 = Mark
       9 = Screen pen 0
      10 = Screen pen 1
      11 = Screen pen 3
      .. = ...
     255 = Screen pen 246

    If you supply your own colormap, then pen value 0 will still be
    "Normal", i.e. the first entry in your colormap has pen value 1.
    This may seem a bit illogical, suggest an alternative if you want!

    You are allowed to dynamically change the colormap. However if you
    change an entry which is on-screen, then it won't have any immediate
    effect. The idea is that you should e.g. supply a colormap with 16
    unused LONGs, allow the user to select a custom color, allocate that
    color and store the screen pen value into the colormap. Now you can
    use that entry as argument to GA_TEXTEDITOR_Pen.

    Have in mind that your application may change screen, so the best
    place to allocate/free colors is when you show and hide the
    texteditor.

See also

    GA_TEXTEDITOR_Pen

GA_TEXTEDITOR_Contents()

GA_TEXTEDITOR_Contents -- [IS.], APTR

Function

    Set the contents of this gadget. This should normally be a pointer to
    a text buffer, but if you have supplied your own importhook, then you
    can set this to anything you like, e.g. a filehandle.

See also

    GA_TEXTEDITOR_ImportHook, GM_TEXTEDITOR_InsertText

GA_TEXTEDITOR_CursorX()

GA_TEXTEDITOR_CursorX -- [ISG], ULONG

Function

    You can get or set the cursor's x position with this tag.
    The first character on a paragraph has position 0.
    The position is not affected by the gadgets `autowrap' feature.
    If you set a value higher than the length of the current paragraph, t

hen it will automatically be truncated.

See also

    GA_TEXTEDITOR_CursorY

GA_TEXTEDITOR_CursorY()

GA_TEXTEDITOR_CursorY -- [ISG], ULONG

Function

    You can get or set the cursor's y position with this tag.
    The first paragraph has position 0.
    The position is not affected by the gadgets `autowrap' feature.
    If you set a value higher than the number of paragraphs, then it will
    automatically be truncated.

See also

    GA_TEXTEDITOR_CursorX

GA_TEXTEDITOR_DoubleClickHook()

**GA_TEXTEDITOR_DoubleClickHook -- [IS.], struct Hook ***

Function

    If you use the gadget in ReadOnly mode then you may want a special
    action to take place when the user doubleclick certain words.
    For example a mail or news client, using this gadget to show mails,
    may want the user to be able to click on URL's to lookup the link.

    The hook will be called with A1 pointing to a ClickMessage, and A0
    will point to the hook itself.
    Your hook should return TRUE if it wants to stop the editor from
    blocking.

EXAMPLE
    // This hook will test if the user doubleclicked an http address

    BOOL URLHookCode (register __a1 struct ClickMessage *clickmsg)
    {
       UWORD pos = clickmsg->ClickPosition;

       while(pos && *(clickmsg->LineContents+pos-1) != ' ' &&
       *(clickmsg->LineContents+pos-1) != '<')
       {
          pos--;
       }

       if(strncmp(clickmsg->LineContents+pos, "http:", 5))
       {
          return(FALSE);
       }
       LookupURL(clickmsg->LineContents+pos);
       return(TRUE);
    }

See also

    GA_TEXTEDITOR_ReadOnly, mui/TextEditor_mcc.h

GA_TEXTEDITOR_ExportHook()

**GA_TEXTEDITOR_ExportHook -- [IS.], struct Hook *

SPECIAL INPUTS
    GV_TEXTEDITOR_ExportHook_EMail
    GV_TEXTEDITOR_ExportHook_Plain (default)**

Function

    The EMail export hook will convert a bold word to *bold*, italic
    words to /italic/ and underlined words to _underline_.
    It also export separators such as <sb> or <tsb>.

    See GA_TEXTEDITOR_ImportHook for more documentation.

See also

    GA_TEXTEDITOR_ExportWrap, GA_TEXTEDITOR_ImportHook
    GM_TEXTEDITOR_ExportText

GA_TEXTEDITOR_ExportWrap()

GA_TEXTEDITOR_ExportWrap -- [ISG], ULONG

Function

    This attribute allows the builtin export hooks to perform wordwrap.
    Zero means no wrap (default).

See also

    GA_TEXTEDITOR_ExportHook, GA_TEXTEDITOR_WrapBorder

GA_TEXTEDITOR_FixedFont()

GA_TEXTEDITOR_FixedFont -- [I.G], BOOL

Function

    Use this to set a fixed font.

GA_TEXTEDITOR_Flow()

**GA_TEXTEDITOR_Flow -- [.SG], UWORD

SPECIAL INPUTS
    GV_TEXTEDITOR_Flow_Left
    GV_TEXTEDITOR_Flow_Right
    GV_TEXTEDITOR_Flow_Center
    GV_TEXTEDITOR_Flow_Justified (not yet implemented)**

Function

    Set/get the current paragraphs alignment.
    If an area is marked while you set this attribute, then the new
    alignment will be set for the complete area.

GA_TEXTEDITOR_HasChanged()

GA_TEXTEDITOR_HasChanged -- [ISG], BOOL

Function

    This tag will show if the contents of the gadget has changed.
    You can take notify on this tag, so that you can connect it with a
    checkmark or textobject.
    You should set this tag to FALSE whenever you export the contents of
    the gadget (in the sense of saving).

    The tag is not affected by:
     GM_TEXTEDITOR_Export (as you may only be copying and not saving)

GA_TEXTEDITOR_HighlighterHook()

**GA_TEXTEDITOR_HighlighterHook -- [ISG], struct Hook ***

Function

    The supplied hook will be called for every line in the document
    both after load and when the user edits the document

    When calling the hook the object is a value that needs to be passed
    back in when calling HightLightSetFormat(), HighlightSetState()

GA_TEXTEDITOR_ImportHook()

**GA_TEXTEDITOR_ImportHook -- [IS.], struct Hook *

SPECIAL INPUTS
    GV_TEXTEDITOR_ImportHook_EMail
    GV_TEXTEDITOR_ImportHook_MIME
    GV_TEXTEDITOR_ImportHook_MIMEQuoted
    GV_TEXTEDITOR_ImportHook_Plain (default)**

Function

    Since this gadget allows different text styles, you can supply an
    importhook to parse the text correctly.

    The default importhook understands the following escape sequences:

     <ESC> + u      Set the soft style to underline.
     <ESC> + b      Set the soft style to bold.
     <ESC> + i      Set the soft style to italic.
     <ESC> + n      Set the soft style back to normal.
     <ESC> + h      Highlight the current line.
     <ESC> + p[x]   Change to color x, where x is taken from the
                    colormap. 0 means normal. The color is reset for each
                    new line.

    The following sequences are only valid at the beginning of a line.

     <ESC> + l      Left justify current and following lines.
     <ESC> + r      Right justify current and following lines.
     <ESC> + c      Center current and following lines.
     <ESC> + [s:x]  Create a separator. x is a bit combination of flags:
                     Placement (mutually exclusive):
                       1 = Top
                       2 = Middle
                       4 = Bottom
                     Cosmetical:
                       8 = StrikeThru   - Draw separator ontop of text.
                      16 = Thick        - Make separator extra thick.


      GV_TEXTEDITOR_ImportHook_MIME:

    This builtin hook will convert quoted-printables (e.g. "=E5") to the
    ASCII representation, and merge lines ending with a "=", it will
    wordwrap the text (using the value set with
    GA_TEXTEDITOR_ImportWrap), it will highlight all lines which start
    with ">" it will make real *bold*, /italic/, _underline_ and
    #colored#, and it will replace <sb> or <tsb> with a real separator
    bar. It stops parsing when it reaches a NULL byte.

    The color used for #colored# text is colormap entry 6, which defaults
    to MPEN_FILL. To override it, just supply a colormap with entry 6 set
    to whatever color you would like.


      GV_TEXTEDITOR_ImportHook_MIMEQuoted:

    Like the MIME importhook, but each line gets quoted and highlighted.


      GV_TEXTEDITOR_ImportHook_EMail:

    Like the MIME importhook, but it doesn't convert quoted printables.


    You can of course create your own importhook, there is an external
    file which describes the procedure.

NOTE
    Don't use custom hooks yet.
    Although the above hooks import style correctly, the style informatio

n will be garbaged it the user edits the text.

See also

    GA_TEXTEDITOR_ColorMap, GA_TEXTEDITOR_ExportHook
    GA_TEXTEDITOR_ImportWrap

GA_TEXTEDITOR_ImportWrap()

GA_TEXTEDITOR_ImportWrap -- [ISG], ULONG

Function

    This is here to allow the builtin import hooks to perform wordwrap.
    The builtin hooks accepts a value between 4 and 1024. Defaults to
    1023.

See also

    GA_TEXTEDITOR_ImportHook, GA_TEXTEDITOR_WrapBorder

GA_TEXTEDITOR_IndentWidth()

GA_TEXTEDITOR_IndentWidth -- [IS], ULONG

Function

    When changing indentation this is the number of spaces each level is.
    A value of 0 wil use tab characters to indent

GA_TEXTEDITOR_InsertMode()

GA_TEXTEDITOR_InsertMode -- [ISG], BOOL

Function

    Not yet implemented...

GA_TEXTEDITOR_LeftBarHook()

**GA_TEXTEDITOR_LeftBarHook -- [IS], struct Hook ***

Function

    When set You will get a left sidebar where the hook will be asked to
    render.
    The supplied hook will be called for every line in the document
    when rendering the document

    It should not draw line numbers. Use GA_TEXTEDITOR_ShowLineNumbers
    to get line numbers. You can have both linenumbers and a hook.
    Different messages must be handled correctly.
    Unless otherwise specified you should return NULL for all.

    It will be called with struct LeftBarRenderMessage for each line
    The object in the call is for now NULL
    The implementation can paint using the RastPort which for now isn't c

lipped but will be in the future so keep your painting within. Font is set and position points to topleft of area. You have 20 pixels x TxHeight to render within.

    It will be called with struct LeftBarInputMessage if the user clicks

in the area. It is called on the input.device context so be careful. Returning TRUE to this message will cause a repaint.


GA_TEXTEDITOR_LineEndingExport()

GA_TEXTEDITOR_LineEndingExport -- [SG], BOOL

Function

    Instruct the texteditor to export in this format

    LINEENDING_LF     Amiga/unix/OSX
    LINEENDING_CR     MacOS pre OSX
    LINEENDING_CRLF   Dos and Windows
    LINEENDING_ASIMPORT  Same as was imported (see GA_TEXTEDITOR_LineEndi

ngImported)

See also

    GA_TEXTEDITOR_LineEndingImported

GA_TEXTEDITOR_LineEndingImported()

GA_TEXTEDITOR_LineEndingImported -- [G], BOOL

Function

    Tells what lineendings the latest import had

    LINEENDING_LF     Amiga/unix/OSX
    LINEENDING_CR     MacOS pre OSX
    LINEENDING_CRLF   Dos and Windows

GA_TEXTEDITOR_Pen()

GA_TEXTEDITOR_Pen -- [.SG], UBYTE (do you need UWORD or ULONG?)

Function

    The value of this tag reflects the current render pen.

    Not yet implemented...

See also

    GA_TEXTEDITOR_ColorMap

GA_TEXTEDITOR_Prop_DeltaFactor()

GA_TEXTEDITOR_Prop_DeltaFactor -- [..G], ULONG (OBSOLETE)

Function

    This tag can tell you how high a line is. This is useful when you set
    the increment value of a slider, as GA_TEXTEDITOR_Prop_Entries holds
    the lines in pixels.

See also

    GA_TEXTEDITOR_Prop_Visible
    GA_TEXTEDITOR_Prop_First, GA_TEXTEDITOR_Prop_Entries

GA_TEXTEDITOR_Prop_Entries()

GA_TEXTEDITOR_Prop_Entries -- [..G], ULONG

Function

    This value is the total number of lines in the editor.
    If you want a slider attached to the gadget you should create a
    notify on this attribute.

See also

    GA_TEXTEDITOR_Prop_Visible
    GA_TEXTEDITOR_Prop_First, GA_TEXTEDITOR_Prop_DeltaFactor

GA_TEXTEDITOR_Prop_First()

GA_TEXTEDITOR_Prop_First -- [.SG], ULONG

Function

    Get or set the first displayed line.
    The purpose of this attribute is to allow connection between the
    editorgadget and a scrollbar.

See also

    GA_TEXTEDITOR_Prop_Visible
    GA_TEXTEDITOR_Prop_Entries, GA_TEXTEDITOR_Prop_DeltaFactor

GA_TEXTEDITOR_Prop_Visible()

GA_TEXTEDITOR_Prop_Visible -- [..G], ULONG

Function

    This value is the number of lines that currently fits in the window.
    If you want a slider attached to the gadget you should create a
    notify on this attribute.

See also

    GA_TEXTEDITOR_Prop_Entries
    GA_TEXTEDITOR_Prop_First, GA_TEXTEDITOR_Prop_DeltaFactor

GA_TEXTEDITOR_Quiet()

GA_TEXTEDITOR_Quiet -- [ISG], BOOL

Function

    If you need to insert a lot of text "line by line" you should
    set this tag to TRUE before starting, and then back to FALSE when you
    are done adding text.

See also

    GM_TEXTEDITOR_InsertText

GA_TEXTEDITOR_ReadOnly()

GA_TEXTEDITOR_ReadOnly -- [ISG], BOOL

Function

    This tag is not supported in the ReAction version. Use GA_ReadOnly
    instead.

    In ReadOnly-mode there will be:
    No cursor (but a normal TAB-frame).
    TAB will activate the next gadget (instead of alt TAB).
    The frame will be set to a ReadListFrame. (may change).
    There is no ARexx support, except "Copy".

    The GA_TEXTEDITOR_StyleXXX tags are still useable.

GA_TEXTEDITOR_RectangularSelections()

GA_TEXTEDITOR_RectangularSelections -- [ISG], BOOL

Function

    When set the editor has rectangular selections

GA_TEXTEDITOR_RedoAvailable()

GA_TEXTEDITOR_RedoAvailable -- [..G], BOOL

Function

    This tag is set to TRUE when the user is able to redo his action(s)
    (normally after an undo).
    You can create a notify on this tag and let your redo button be
    ghosted when there is nothing to redo.

See also

    GA_TEXTEDITOR_UndoAvailable

GA_TEXTEDITOR_Separator()

**GA_TEXTEDITOR_Separator -- [.SG], UWORD ***

Function

    Each line can act as a separator.

    A separator can be either thick or thin. It can be rendered over the
    lines contents, or only on both sides of the contents. The placement
    can be either top, middle or bottom.

    This tag reflects the current line. See gadgets/texteditor.h for
    definitions.

GA_TEXTEDITOR_ShowLineNumbers()

GA_TEXTEDITOR_ShowLineNumbers -- [ISG], BOOL

Function

    If TRUE you will get a a left sidebar where linenumbers is shown

GA_TEXTEDITOR_SpacesPerTAB()

GA_TEXTEDITOR_SpacesPerTAB -- [IS], ULONG

Function

    A tab corresponds to this many spaces.

GA_TEXTEDITOR_StyleBold()

GA_TEXTEDITOR_StyleBold -- [.SG], BOOL

Function

    This tag shows whether the cursor or selection is over bolded text or
    not. You can set this tag to TRUE or FALSE if you want the style
    changed.

    Not yet implemented...

See also

    GA_TEXTEDITOR_StyleItalic, GA_TEXTEDITOR_StyleUnderline

GA_TEXTEDITOR_StyleItalic()

GA_TEXTEDITOR_StyleItalic -- [.SG], BOOL

Function

    This tag shows whether the cursor or selection is over text in italic

s or not. You can set this tag to TRUE or FALSE if you want the style changed.

EXAMPLE
    see GA_TEXTEDITOR_StyleBold

    Not yet implemented...

See also

    GA_TEXTEDITOR_StyleBold, GA_TEXTEDITOR_StyleUnderline

GA_TEXTEDITOR_StyleUnderline()

GA_TEXTEDITOR_StyleUnderline -- [.SG], BOOL

Function

    This tag shows whether the cursor or selection is over underlined tex

t or not. You can set this tag to TRUE or FALSE if you want the style changed.

    Not yet implemented...

EXAMPLE
    see GA_TEXTEDITOR_StyleBold

See also

    GA_TEXTEDITOR_StyleBold, GA_TEXTEDITOR_StyleItalic

GA_TEXTEDITOR_TabKeyPolicy()

GA_TEXTEDITOR_TabKeyPolicy -- [IS], ULONG

Function

    When pressing the tab key and the cursor is past the leading whitespa

ce of the block then one of these things can happen:

    GV_TEXTEDITOR_TabKey_IndentsLine      The line is indented
    GV_TEXTEDITOR_TabKey_IndentsAfter    Indents text after the cursor

GA_TEXTEDITOR_TypeAndSpell()

GA_TEXTEDITOR_TypeAndSpell -- [.SG], BOOL (NOT in V47)

Function

    This is a shortcut to the Type'n'spell switch that the user can set
    in the .mcp module.
    Never integrate this into the settings of your preferences.

GA_TEXTEDITOR_UndoAvailable()

GA_TEXTEDITOR_UndoAvailable -- [..G], BOOL

Function

    This tag is set to TRUE when the user is able to undo his action(s)
    You can create a notify on this tag and let your undo button be
    ghosted when there is nothing to undo.

See also

    GA_TEXTEDITOR_RedoAvailable

GA_TEXTEDITOR_WrapBorder()

GA_TEXTEDITOR_WrapBorder -- [ISG], ULONG

Function

    The gadget will insert a linebreak infront of the current word, if
    the cursor comes beyond the column given here.

    Please remember that the gadget can do nondesctructive dynamic wordwr

ap which is much better! This tag is for special cases!!!

See also

    GA_TEXTEDITOR_ExportWrap, GA_TEXTEDITOR_ImportWrap