1 /***************************************************************************
3 TextEditor.mcc - Textediting MUI Custom Class
4 Copyright (C) 1997-2000 Allan Odgaard
5 Copyright (C) 2005-2014 TextEditor.mcc Open Source Team
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
17 TextEditor class Support Site: http://www.sf.net/projects/texteditor-mcc
21 ***************************************************************************/
23 #ifndef TEXTEDITOR_MCC_PRIV_H
24 #define TEXTEDITOR_MCC_PRIV_H
26 #include <graphics/rastport.h>
27 #include <libraries/iffparse.h>
28 #include <proto/exec.h>
29 #include <proto/intuition.h>
31 #include <libraries/mui.h>
34 #include <mcc_common.h>
36 #include <mui/TextEditor_mcc.h>
40 // if something in our configuration setup (keybindings, etc)
41 // has changed we can increase the config version so that TextEditor
42 // will popup a warning about and obsolete configuration.
43 #define CONFIG_VERSION 4
48 #define UNDERLINE 0x01
53 #if defined(__amigaos4__)
54 #define AllocVecShared(size, flags) AllocVecTags((size), AVT_Type, MEMF_SHARED, AVT_Lock, FALSE, ((flags)&MEMF_CLEAR) ? AVT_ClearWithValue : TAG_IGNORE, 0, TAG_DONE)
56 #define AllocVecShared(size, flags) AllocVec((size), (flags))
59 #define VERSION_IS_AT_LEAST(ver, rev, minver, minrev) (((ver) > (minver)) || ((ver) == (minver) && (rev) == (minrev)) || ((ver) == (minver) && (rev) > (minrev)))
60 #define LIB_VERSION_IS_AT_LEAST(lib, minver, minrev) VERSION_IS_AT_LEAST(((struct Library *)(lib))->lib_Version, ((struct Library *)(lib))->lib_Revision, minver, minrev)
62 #if defined(__MORPHOS__)
63 #include <proto/exec.h>
64 #define IS_MORPHOS2 LIB_VERSION_IS_AT_LEAST(SysBase, 51, 0)
67 // proper RAWKEY_ defines were first introduced in OS4 and MorphOS
68 // and unfortunately they are also a bit different, so lets
69 // prepare an alternate table for it
70 #if defined(__amigaos4__)
71 #include <proto/keymap.h>
73 #define RAWKEY_NUMLOCK 0x79
75 #elif defined(__MORPHOS__)
76 #include <devices/rawkeycodes.h>
78 #define RAWKEY_CRSRUP RAWKEY_UP
79 #define RAWKEY_CRSRDOWN RAWKEY_DOWN
80 #define RAWKEY_CRSRRIGHT RAWKEY_RIGHT
81 #define RAWKEY_CRSRLEFT RAWKEY_LEFT
82 #define RAWKEY_PRINTSCR RAWKEY_PRTSCREEN
83 #define RAWKEY_BREAK RAWKEY_PAUSE
85 #define RAWKEY_AUD_STOP RAWKEY_CDTV_STOP
86 #define RAWKEY_AUD_PLAY_PAUSE RAWKEY_CDTV_PLAY
87 #define RAWKEY_AUD_PREV_TRACK RAWKEY_CDTV_PREV
88 #define RAWKEY_AUD_NEXT_TRACK RAWKEY_CDTV_NEXT
89 #define RAWKEY_AUD_SHUFFLE RAWKEY_CDTV_REW
90 #define RAWKEY_AUD_REPEAT RAWKEY_CDTV_FF
94 #define RAWKEY_INSERT 0x47 /* Not on classic keyboards */
95 #define RAWKEY_PAGEUP 0x48 /* Not on classic keyboards */
96 #define RAWKEY_PAGEDOWN 0x49 /* Not on classic keyboards */
97 #define RAWKEY_F11 0x4B /* Not on classic keyboards */
98 #define RAWKEY_CRSRUP 0x4C
99 #define RAWKEY_CRSRDOWN 0x4D
100 #define RAWKEY_CRSRRIGHT 0x4E
101 #define RAWKEY_CRSRLEFT 0x4F
102 #define RAWKEY_F1 0x50
103 #define RAWKEY_F2 0x51
104 #define RAWKEY_F3 0x52
105 #define RAWKEY_F4 0x53
106 #define RAWKEY_F5 0x54
107 #define RAWKEY_F6 0x55
108 #define RAWKEY_F7 0x56
109 #define RAWKEY_F8 0x57
110 #define RAWKEY_F9 0x58
111 #define RAWKEY_F10 0x59
112 #define RAWKEY_HELP 0x5F
113 #define RAWKEY_SCRLOCK 0x6B /* Not on classic keyboards */
114 #define RAWKEY_PRINTSCR 0x6D /* Not on classic keyboards */
115 #define RAWKEY_BREAK 0x6E /* Not on classic keyboards */
116 #define RAWKEY_F12 0x6F /* Not on classic keyboards */
117 #define RAWKEY_HOME 0x70 /* Not on classic keyboards */
118 #define RAWKEY_END 0x71 /* Not on classic keyboards */
120 #define RAWKEY_AUD_STOP 0x72
121 #define RAWKEY_AUD_PLAY_PAUSE 0x73
122 #define RAWKEY_AUD_PREV_TRACK 0x74
123 #define RAWKEY_AUD_NEXT_TRACK 0x75
124 #define RAWKEY_AUD_SHUFFLE 0x76
125 #define RAWKEY_AUD_REPEAT 0x77
127 #define RAWKEY_NUMLOCK 0x79
131 // some own usefull MUI-style macros to check mouse positions in objects
132 #define _between(a,x,b) ((x)>=(a) && (x)<=(b))
133 #define _isinobject(o,x,y) (_between(_mleft(o),(x),_mright (o)) && _between(_mtop(o) ,(y),_mbottom(o)))
134 #define _isinwholeobject(o,x,y) (_between(_left(o),(x),_right (o)) && _between(_top(o) ,(y),_bottom(o)))
137 #define Enabled(data) ((data)->blockinfo.enabled == TRUE && \
138 ((data)->blockinfo.startx != (data)->blockinfo.stopx || \
139 (data)->blockinfo.startline != (data)->blockinfo.stopline || \
140 (data)->selectmode == 3))
143 // private/expermental attribute definitions
144 #define MUIA_TextEditor_HorizontalScroll (TextEditor_Dummy + 0x2d)
145 #define MUIA_TextEditor_Prop_Release (TextEditor_Dummy + 0x01)
146 #define MUIA_TextEditor_PopWindow_Open (TextEditor_Dummy + 0x03)
148 // special flagging macros
149 #define setFlag(mask, flag) (mask) |= (flag) // set the flag "flag" in "mask"
150 #define clearFlag(mask, flag) (mask) &= ~(flag) // clear the flag "flag" in "mask"
151 #define maskFlag(mask, flag) (mask) &= (flag) // mask the variable "mask" with flags "flag" bitwise
152 #define isAnyFlagSet(mask, flag) (((mask) & (flag)) != 0) // return TRUE if at least one of the flags is set
153 #define isFlagSet(mask, flag) (((mask) & (flag)) == (flag)) // return TRUE if the flag is set
154 #define isFlagClear(mask, flag) (((mask) & (flag)) == 0) // return TRUE if the flag is NOT set
157 #define MAX(a,b) (((a) > (b)) ? (a) : (b))
160 #define MIN(a,b) (((a) < (b)) ? (a) : (b))
163 #define MINMAX(min,x,max) (MAX((min),MIN((x),(max))))
176 ET_DELETEBLOCK_NOMOVE
,
207 STRPTR Contents
; // Set this to the linecontents (allocated via the poolhandle)
208 LONG Length
; // The length of the line (including the '\n')
209 LONG allocatedContents
;
210 struct LineStyle
*Styles
; // Set this to the styles used for this line (allocated via the poolhandle). The array is terminated by an (EOS,0) marker
211 struct LineColor
*Colors
; // The colors to use (allocated via the poolhandle). The array is terminated by an (EOC,0) marker
212 BOOL Highlight
; // Set this to TRUE if you want the line to be highlighted
213 UWORD Flow
; // Use the MUIV_TextEditor_Flow_xxx values...
214 UWORD Separator
; // See definitions below
215 BOOL clearFlow
; // if the flow definition should be cleared on the next line
220 struct MinNode node
; // standard Exec MinNode
222 struct LineNode line
;
224 LONG visual
; // How many lines are this line wrapped over
225 UWORD flags
; // Different flags...
230 struct line_node
*line
;
236 BOOL enabled
; // Boolean that indicates wether block is on/off
237 struct line_node
*startline
; // Line where blockings starts
238 LONG startx
; // X place of start
239 struct line_node
*stopline
; // Line where marking ends
240 LONG stopx
; // X place of stop
245 struct line_node
*line
; // Pointer to actual line
246 LONG lines
; // Lines down
248 LONG bytes
; // Lines in bytes
249 LONG extra
; // Lines+1 in bytes
258 UBYTE character
; // deletechar
265 STRPTR clip
; // deleteblock
269 LONG x
; // pasteblock
270 LONG y
; // pasteblock
279 APTR UserData
; // This is set to what your hook returns (NULL the first time)
280 STRPTR Contents
; // Pointer to the current line
281 ULONG Length
; // Length of Contents, including the '\n' character
282 ULONG SkipFront
; // amount of chars to skip at the front of the current line
283 ULONG SkipBack
; // amount of chars to skip at the back of the current line
284 struct LineStyle
*Styles
; // Pointer to array of words with style definition
285 struct LineColor
*Colors
; // pointer to array of words with color definitions
286 BOOL Highlight
; // is the current line highlighted?
287 UWORD Flow
; // Current lines textflow
288 UWORD Separator
; // Current line contains a separator bar? see below
289 LONG ExportWrap
; // For your use only (reflects MUIA_TextEditor_ExportWrap)
290 BOOL Last
; // Set to TRUE if this is the last line
291 APTR data
; // pointer to the instance data of TextEditor.mcc (PRIVATE)
292 BOOL failure
; // something went wrong during the export
297 const char *Data
; // The first time the hook is called, then this will be either the value of MUIA_TextEditor_Contents, or the argument given to MUIM_TextEditor_Insert.
298 struct LineNode
*linenode
; // Pointer to a linenode, which you should fill out
299 APTR PoolHandle
; // A poolhandle, all allocations done for styles or contents must be made from this pool, and the size of the allocation must be stored in the first LONG
300 LONG ImportWrap
; // For your use only (reflects MUIA_TextEditor_ImportWrap)
301 ULONG ConvertTabs
; // do not convert to spaces when importing tabs (\t)
302 LONG TabSize
; // if convert tabs to spaces we specify here how many spaces to use
318 LONG ypos
; // ypos of gadget
319 LONG fontheight
; // font height
321 LONG CPos_X
; // Cursor x pos.
322 struct line_node
*actualline
; // The actual line...
323 LONG pixel_x
; // Pixel x-pos of cursor. (for up/down movement)
324 UWORD style
; // Current style (bold-italic-underline)
328 LONG visual_y
; // The line nr of the top line
329 LONG totallines
; // Total number of lines
330 LONG maxlines
; // max visual lines in gadget
333 BOOL cursor_shown
; // visibility of the cursor
334 Object
*object
; // Pointer to the object itself
335 struct BitMap
*doublebuffer
; // Doublebuffer for line-printing
337 UWORD smooth_wait
; // Counter to see if smooth scroll is happening
338 BOOL scrollaction
; // If scrolling takes place
339 WORD scr_direction
; // Scroll direction
340 struct RastPort doublerp
; // Doublebuffer rastport
341 struct RastPort copyrp
;
342 struct RastPort tmprp
; // temporary rastport (for TextFit/TextLength checks)
343 struct marking blockinfo
;
344 struct Rectangle CursorPosition
;
345 struct RastPort
*rport
;
346 struct TextFont
*font
;
348 struct Locale
*mylocale
;
349 struct MinList linelist
;
353 struct IFFHandle
*iff
;
355 ULONG StartSecs
, StartMicros
;
362 LONG Rows
; // The value of the rows tag
363 LONG Columns
; // The value of the columns tag
365 struct te_key
*RawkeyBindings
;
369 ULONG backgroundcolor
;
370 ULONG highlightcolor
;
372 ULONG cursortextcolor
;
375 ULONG separatorshine
;
376 ULONG separatorshadow
;
382 struct TextFont
*normalfont
;
383 struct TextFont
*fixedfont
;
387 struct Hook
*DoubleClickHook
;
388 struct Hook
*ExportHook
;
389 struct Hook
*ImportHook
;
393 LONG TabSize
; // number of spaces to use when Tab2Spaces is active
394 LONG GlobalTabSize
; // number of spaces as configured in MUI prefs
395 LONG TabSizePixels
; // number of pixels a Tab2Spaces conversion will consume
396 BOOL ConvertTabs
; // convert to spaces when TAB key is used. Otherwise insert \t
399 BOOL WrapWords
; // wrap at words boundaries rather than hard wrapping at each char
400 struct UserAction
*undoSteps
; // pointer to memory for the undo actions
401 ULONG maxUndoSteps
; // how many steps can be put into the undoBuffer
402 ULONG usedUndoSteps
; // how many steps in the undoBuffer have been used so far
403 ULONG nextUndoStep
; // index of the next undo/redo step
404 BOOL userUndoBufferSize
;
408 BOOL activeSelectPointer
;
409 Object
* SuggestWindow
;
410 Object
* SuggestListview
;
413 char SuggestCmd
[256];
426 struct bookmark bookmarks
[4];
428 struct MUI_EventHandlerNode ehnode
;
429 struct MUI_InputHandlerNode ihnode
;
430 struct MUI_InputHandlerNode blinkhandler
;
434 enum CursorState currentCursorState
;
440 struct BitMap
* SAVEDS ASM
MUIG_AllocBitMap(REG(d0
, LONG
), REG(d1
, LONG
), REG(d2
, LONG
), REG(d3
, LONG flags
), REG(a0
, struct BitMap
*));
441 void SAVEDS ASM
MUIG_FreeBitMap(REG(a0
, struct BitMap
*));
444 void MarkAllBlock(struct InstData
*, struct marking
*);
445 STRPTR
GetBlock(struct InstData
*, struct marking
*);
446 void RedrawArea(struct InstData
*, LONG
, struct line_node
*, LONG
, struct line_node
*);
447 void NiceBlock(struct marking
*, struct marking
*);
448 LONG
CutBlock(struct InstData
*, ULONG
);
449 LONG
CutBlock2(struct InstData
*, ULONG
, struct marking
*);
450 void CheckBlock(struct InstData
*, struct line_node
*);
452 // flags for CutBlock() and CutBlock2()
453 #define CUTF_CLIPBOARD (1<<0)
454 #define CUTF_CUT (1<<1)
455 #define CUTF_UPDATE (1<<2)
458 void Key_ToUpper(struct InstData
*);
459 void Key_ToLower(struct InstData
*);
462 BOOL
StartClipboardServer(void);
463 void ShutdownClipboardServer(void);
464 IPTR
ClientStartSession(ULONG mode
);
465 void ClientEndSession(IPTR session
);
466 void ClientWriteChars(IPTR session
, struct line_node
*line
, LONG start
, LONG length
);
467 void ClientWriteLine(IPTR session
, struct line_node
*line
);
468 LONG
ClientReadLine(IPTR session
, struct line_node
**line
, ULONG
*cset
);
471 UWORD
GetColor(LONG
, struct line_node
*);
472 void AddColor(struct InstData
*, struct marking
*, UWORD
);
475 void ResetDisplay(struct InstData
*);
476 void RequestInput(struct InstData
*);
477 void RejectInput(struct InstData
*);
480 BOOL
PasteClip(struct InstData
*, LONG
, struct line_node
*);
481 BOOL
SplitLine(struct InstData
*, LONG
, struct line_node
*, BOOL
, struct UserAction
*);
482 BOOL
MergeLines(struct InstData
*, struct line_node
*);
483 BOOL
RemoveChars(struct InstData
*, LONG
, struct line_node
*, LONG
);
484 BOOL
PasteChars(struct InstData
*, LONG
, struct line_node
*, LONG
, const char *, struct UserAction
*);
487 IPTR
mExportBlock(struct IClass
*, Object
*, struct MUIP_TextEditor_ExportBlock
*);
490 IPTR
mExportText(struct IClass
*, Object
*, struct MUIP_TextEditor_ExportText
*);
493 IPTR
mGet(struct IClass
*, Object
*, struct opGet
*);
494 IPTR
mSet(struct IClass
*, Object
*, struct opSet
*);
497 void InitGrow(struct Grow
*grow
, APTR pool
, int itemSize
);
498 void FreeGrow(struct Grow
*grow
);
499 void AddToGrow(struct Grow
*grow
, void *newItem
);
500 void RemoveFromGrow(struct Grow
*grow
);
503 IPTR
mHandleARexx(struct IClass
*, Object
*, struct MUIP_TextEditor_ARexxCmd
*);
506 IPTR
mHandleInput(struct IClass
*, Object
*, struct MUIP_HandleEvent
*);
507 void Key_Backspace(struct InstData
*);
508 void Key_Delete(struct InstData
*);
509 void Key_Return(struct InstData
*);
510 void Key_Tab(struct InstData
*);
511 void Key_Clear(struct InstData
*);
512 void Key_Cut(struct InstData
*);
513 void Key_Copy(struct InstData
*);
514 void Key_Paste(struct InstData
*);
515 void Key_DelLine(struct InstData
*);
516 void ScrollIntoDisplay(struct InstData
*);
517 void MarkText(struct InstData
*, LONG
, struct line_node
*, LONG
, struct line_node
*);
520 BOOL
ImportText(struct InstData
*, const char *, struct Hook
*, LONG
, struct MinList
*);
521 BOOL
ReimportText(struct IClass
*, Object
*);
524 void InitConfig(struct IClass
*, Object
*);
525 void FreeConfig(struct IClass
*, Object
*);
528 IPTR
mMarkText(struct InstData
*, struct MUIP_TextEditor_MarkText
*);
529 IPTR
mBlockInfo(struct InstData
*, struct MUIP_TextEditor_BlockInfo
*);
530 IPTR
mQueryKeyAction(struct IClass
*, Object
*, struct MUIP_TextEditor_QueryKeyAction
*);
531 IPTR
mClearText(struct IClass
*, Object
*, Msg
);
532 IPTR
mToggleCursor(struct IClass
*, Object
*, Msg
);
533 IPTR
mInputTrigger(struct IClass
*, Object
*, Msg
);
534 ULONG
InsertText(struct InstData
*, STRPTR
, BOOL
);
537 void AddClipping(struct InstData
*);
538 void RemoveClipping(struct InstData
*);
539 void FreeTextMem(struct InstData
*, struct MinList
*);
540 BOOL
Init_LineNode(struct InstData
*, struct line_node
*, CONST_STRPTR
);
541 BOOL
ExpandLine(struct InstData
*, struct line_node
*, LONG
);
542 BOOL
CompressLine(struct InstData
*, struct line_node
*);
543 void InsertLines(struct MinList
*lines
, struct line_node
*after
);
544 LONG
LineCharsWidth(struct InstData
*, CONST_STRPTR
);
545 ULONG
VisualHeight(struct InstData
*, struct line_node
*);
546 void OffsetToLines(struct InstData
*, LONG
, struct line_node
*, struct pos_info
*);
547 LONG
LineNr(struct InstData
*, struct line_node
*);
548 struct line_node
*LineNode(struct InstData
*, LONG
);
549 void ScrollUpDown(struct InstData
*);
550 void SetCursor(struct InstData
*, LONG
, struct line_node
*, BOOL
);
551 void DumpText(struct InstData
*, LONG
, LONG
, LONG
, BOOL
);
552 void GetLine(struct InstData
*, LONG
, struct pos_info
*);
553 LONG
LineToVisual(struct InstData
*, struct line_node
*);
554 LONG
CountLines(struct InstData
*, struct MinList
*);
557 void SetBookmark(struct InstData
*, ULONG
);
558 void GotoBookmark(struct InstData
*, ULONG
);
559 void GoTop(struct InstData
*);
560 void GoPreviousPage (struct InstData
*);
561 void GoPreviousLine(struct InstData
*);
562 void GoUp(struct InstData
*);
563 void GoBottom(struct InstData
*);
564 void GoNextPage(struct InstData
*);
565 void GoNextLine(struct InstData
*);
566 void GoDown(struct InstData
*);
567 void GoNextWord(struct InstData
*);
568 void GoEndOfLine(struct InstData
*);
569 void GoNextSentence(struct InstData
*);
570 void GoRight(struct InstData
*);
571 void GoPreviousWord(struct InstData
*);
572 void GoStartOfLine(struct InstData
*);
573 void GoPreviousSentence(struct InstData
*);
574 void GoLeft(struct InstData
*);
575 BOOL
CheckSep(struct InstData
*, char);
576 BOOL
CheckSent(struct InstData
*, char);
577 void NextLine(struct InstData
*);
578 LONG
FlowSpace(struct InstData
*, UWORD
, STRPTR
);
579 void PosFromCursor(struct InstData
*, LONG
, LONG
);
582 void SetupSelectPointer(struct InstData
*data
);
583 void CleanupSelectPointer(struct InstData
*data
);
584 void ShowSelectPointer(struct InstData
*data
, Object
*obj
);
585 void HideSelectPointer(struct InstData
*data
, Object
*obj
);
587 // PrintLineWithStyles.c
588 ULONG
ConvertStyle(UWORD
);
589 LONG
PrintLine(struct InstData
*, LONG
, struct line_node
*, LONG
, BOOL
);
590 ULONG
ConvertPen(struct InstData
*, UWORD
, BOOL
);
591 void DrawSeparator(struct InstData
*, struct RastPort
*, LONG
, LONG
, LONG
, LONG
);
594 IPTR
mSearch(struct IClass
*, Object
*, struct MUIP_TextEditor_Search
*);
595 IPTR
mReplace(struct IClass
*, Object
*, struct MUIP_TextEditor_Replace
*);
598 IPTR
mSetBlock(struct InstData
*, struct MUIP_TextEditor_SetBlock
*msg
);
601 void SpellCheckWord(struct InstData
*);
602 void SuggestWord(struct InstData
*);
603 Object
*SuggestWindow(struct InstData
*);
604 void ParseKeywords(struct InstData
*data
, const char *keywords
);
605 void FreeKeywords(struct InstData
*data
);
606 void CheckSingleWordAgainstKeywords(struct InstData
*data
, const char *word
);
607 void KeywordCheck(struct InstData
*);
610 void UpdateStyles(struct InstData
*);
611 UWORD
GetStyle(LONG
, struct line_node
*);
612 void AddStyle(struct InstData
*, struct marking
*, UWORD
, BOOL
);
613 void AddStyleToLine(struct InstData
*, LONG
, struct line_node
*, LONG
, UWORD
);
616 BOOL
AddToUndoBuffer(struct InstData
*, enum EventType
, void *);
617 void ResetUndoBuffer(struct InstData
*);
618 void ResizeUndoBuffer(struct InstData
*, ULONG
);
619 void FreeUndoBuffer(struct InstData
*);
620 BOOL
Undo(struct InstData
*);
621 BOOL
Redo(struct InstData
*);
624 LONG
TextLengthNew(struct RastPort
*rp
, const char *string
, ULONG count
, LONG tabSizePixels
);
625 ULONG
TextFitNew(struct RastPort
*rp
, const char *string
, ULONG strLen
, struct TextExtent
*textExtent
, const struct TextExtent
*constrainingExtent
, LONG strDirection
, LONG constrainingBitWidth
, LONG constrainingBitHeight
, LONG tabSizePixels
);
626 void TextNew(struct RastPort
*rp
, const char *string
, ULONG count
, LONG tabSizePixels
);
628 #if !defined(__amigaos4__) && !defined(__MORPHOS__) && !defined(__AROS__)
630 APTR
AllocVecPooled(APTR
, ULONG
);
632 void FreeVecPooled(APTR
, APTR
);
635 #if !defined(GetHead)
637 struct Node
*GetHead(struct List
*);
639 #if !defined(GetPred)
641 struct Node
*GetPred(struct Node
*);
643 #if !defined(GetSucc)
645 struct Node
*GetSucc(struct Node
*);
647 #if !defined(GetTail)
649 struct Node
*GetTail(struct List
*);
651 #if !defined(MoveList)
653 void MoveList(struct List
*to
, struct List
*from
);
656 // define some convenience functions for accessing the list of lines
657 // to avoid constant type casting within the normal source
658 #define GetFirstLine(lines) (struct line_node *)(GetHead((struct List *)(lines)))
659 #define GetLastLine(lines) (struct line_node *)(GetTail((struct List *)(lines)))
660 #define GetNextLine(line) (struct line_node *)(GetSucc((struct Node *)(line)))
661 #define GetPrevLine(line) (struct line_node *)(GetPred((struct Node *)(line)))
662 #define HasNextLine(line) (GetSucc((struct Node *)(line)) != NULL)
663 #define HasPrevLine(line) (GetPred((struct Node *)(line)) != NULL)
664 #define AddLine(lines, line) AddTail((struct List *)(lines), (struct Node *)(line))
665 #define InsertLine(line, after) Insert(NULL, (struct Node *)(line), (struct Node *)(after))
666 #define RemLine(line) Remove((struct Node *)(line))
667 #define RemFirstLine(lines) (struct line_node *)RemHead((struct List *)(lines))
668 #define RemLastLine(lines) (struct line_node *)RemTail((struct List *)(lines))
669 #define MoveLines(to, from) MoveList((struct List *)(to), (struct List *)(from))
670 #define InitLines(lines) NewList((struct List *)(lines))
671 #define ContainsLines(lines) (IsListEmpty((lines)) == FALSE)
674 void DumpLine(struct line_node
*line
);
676 #define DumpLine(line) ((void)0)
679 extern struct Hook ImPlainHook
;
680 extern struct Hook ImEMailHook
;
681 extern struct Hook ImMIMEHook
;
682 extern struct Hook ImMIMEQuoteHook
;
684 extern struct Hook ExportHookPlain
;
685 extern struct Hook ExportHookEMail
;
686 extern struct Hook ExportHookNoStyle
;
688 #define IEQUALIFIER_SHIFT 0x0200
689 #define IEQUALIFIER_ALT 0x0400
690 #define IEQUALIFIER_COMMAND 0x0800
702 FLG_HScroll
= 1L << 0,
703 FLG_NumLock
= 1L << 1,
704 FLG_ReadOnly
= 1L << 2,
705 FLG_FastCursor
= 1L << 3,
706 FLG_CheckWords
= 1L << 4,
707 FLG_InsertMode
= 1L << 5,
709 FLG_PopWindow
= 1L << 7,
710 FLG_UndoLost
= 1L << 8,
712 FLG_InVGrp
= 1L << 10,
713 FLG_Ghosted
= 1L << 11,
714 FLG_OwnBackground
= 1L << 12,
715 FLG_FreezeCrsr
= 1L << 13,
716 FLG_Active
= 1L << 14,
717 FLG_OwnFrame
= 1L << 15,
718 FLG_ARexxMark
= 1L << 16,
719 FLG_FirstInit
= 1L << 17,
720 FLG_AutoClip
= 1L << 18,
721 FLG_Activated
= 1L << 19, // the gadget was activated by MUIM_GoActive()
722 FLG_ActiveOnClick
= 1L << 20, // should the gadget activated on click
723 FLG_PasteStyles
= 1L << 21, // respect styles when pasting text
724 FLG_PasteColors
= 1L << 22, // respect colors when pasting text
725 FLG_ForcedTabSize
= 1L << 23, // override the user defined TAB size
726 FLG_MUI4
= 1L << 31, // running under MUI4
731 #define MUIM_TextEditor_InputTrigger 0xad000101
732 #define MUIM_TextEditor_ToggleCursor 0xad000102
734 // for iffparse clipboard management
735 #define ID_FTXT MAKE_ID('F','T','X','T')
736 #define ID_CHRS MAKE_ID('C','H','R','S')
737 #define ID_FLOW MAKE_ID('F','L','O','W')
738 #define ID_HIGH MAKE_ID('H','I','G','H')
739 #define ID_SBAR MAKE_ID('S','B','A','R')
740 #define ID_COLS MAKE_ID('C','O','L','S')
741 #define ID_STYL MAKE_ID('S','T','Y','L')
742 #define ID_CSET MAKE_ID('C','S','E','T')
744 #include "amiga-align.h"
751 #include "default-align.h"
753 extern const struct te_key default_keybindings
[];
756 // Gets an attribute value from a MUI object
757 ULONG
xget(Object
*obj
, const IPTR attr
);
758 #if defined(__GNUC__)
759 // please note that we do not evaluate the return value of GetAttr()
760 // as some attributes (e.g. MUIA_Selected) always return FALSE, even
761 // when they are supported by the object. But setting b=0 right before
762 // the GetAttr() should catch the case when attr doesn't exist at all
763 #define xget(OBJ, ATTR) ({IPTR b=0; GetAttr(ATTR, OBJ, &b); b;})
767 #define ARRAY_SIZE(x) (sizeof(x[0]) ? sizeof(x)/sizeof(x[0]) : 0)
770 #define MUIKEY_CUT 22
774 #define MUIKEY_COPY 23
778 #define MUIKEY_PASTE 24
782 #define MUIKEY_UNDO 25
786 #define MUIKEY_REDO 26
789 #endif /* TEXTEDITOR_MCC_PRIV_H */