1 #ifndef TEXTEDITOR_MCC_H
2 #define TEXTEDITOR_MCC_H
4 /***************************************************************************
6 TextEditor.mcc - Textediting MUI Custom Class
7 Copyright (C) 1997-2000 Allan Odgaard
8 Copyright (C) 2005-2009 by TextEditor.mcc Open Source Team
10 This library is free software; you can redistribute it and/or
11 modify it under the terms of the GNU Lesser General Public
12 License as published by the Free Software Foundation; either
13 version 2.1 of the License, or (at your option) any later version.
15 This library is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 TextEditor class Support Site: http://www.sf.net/projects/texteditor-mcc
24 ***************************************************************************/
27 #include <exec/types.h>
34 #if !defined(__AROS__) && defined(__PPC__)
37 #elif defined(__VBCC__)
42 /***********************************************************************/
44 // STACKED ensures proper alignment on AROS 64 bit systems
45 #if !defined(__AROS__) && !defined(STACKED)
49 /***********************************************************************/
51 #define MUIC_TextEditor "TextEditor.mcc"
53 #if defined(__AROS__) && !defined(NO_INLINE_STDARG)
54 #define TextEditorObject MUIOBJMACRO_START(MUIC_TextEditor)
56 #define TextEditorObject MUI_NewObject(MUIC_TextEditor
59 #define TextEditor_Dummy (0xad000000UL)
61 #define MUIA_TextEditor_AreaMarked (TextEditor_Dummy + 0x14)
62 #define MUIA_TextEditor_ColorMap (TextEditor_Dummy + 0x2f)
63 #define MUIA_TextEditor_Contents (TextEditor_Dummy + 0x02)
64 #define MUIA_TextEditor_CursorX (TextEditor_Dummy + 0x04)
65 #define MUIA_TextEditor_CursorY (TextEditor_Dummy + 0x05)
66 #define MUIA_TextEditor_DoubleClickHook (TextEditor_Dummy + 0x06)
67 #define MUIA_TextEditor_ExportHook (TextEditor_Dummy + 0x08)
68 #define MUIA_TextEditor_ExportWrap (TextEditor_Dummy + 0x09)
69 #define MUIA_TextEditor_FixedFont (TextEditor_Dummy + 0x0a)
70 #define MUIA_TextEditor_Flow (TextEditor_Dummy + 0x0b)
71 #define MUIA_TextEditor_HasChanged (TextEditor_Dummy + 0x0c)
72 #define MUIA_TextEditor_ImportHook (TextEditor_Dummy + 0x0e)
73 #define MUIA_TextEditor_ImportWrap (TextEditor_Dummy + 0x10)
74 #define MUIA_TextEditor_InsertMode (TextEditor_Dummy + 0x0f)
75 #define MUIA_TextEditor_InVirtualGroup (TextEditor_Dummy + 0x1b)
76 #define MUIA_TextEditor_KeyBindings (TextEditor_Dummy + 0x11)
77 #define MUIA_TextEditor_MultiColorQuoting (TextEditor_Dummy + 0x31)
78 #define MUIA_TextEditor_NumLock (TextEditor_Dummy + 0x18)
79 #define MUIA_TextEditor_Pen (TextEditor_Dummy + 0x2e)
80 #define MUIA_TextEditor_Prop_DeltaFactor (TextEditor_Dummy + 0x0d)
81 #define MUIA_TextEditor_Prop_Entries (TextEditor_Dummy + 0x15)
82 #define MUIA_TextEditor_Prop_First (TextEditor_Dummy + 0x20)
83 #define MUIA_TextEditor_Prop_Visible (TextEditor_Dummy + 0x16)
84 #define MUIA_TextEditor_Quiet (TextEditor_Dummy + 0x17)
85 #define MUIA_TextEditor_ReadOnly (TextEditor_Dummy + 0x19)
86 #define MUIA_TextEditor_RedoAvailable (TextEditor_Dummy + 0x13)
87 #define MUIA_TextEditor_Separator (TextEditor_Dummy + 0x2c)
88 #define MUIA_TextEditor_Slider (TextEditor_Dummy + 0x1a)
89 #define MUIA_TextEditor_StyleBold (TextEditor_Dummy + 0x1c)
90 #define MUIA_TextEditor_StyleItalic (TextEditor_Dummy + 0x1d)
91 #define MUIA_TextEditor_StyleUnderline (TextEditor_Dummy + 0x1e)
92 #define MUIA_TextEditor_TypeAndSpell (TextEditor_Dummy + 0x07)
93 #define MUIA_TextEditor_UndoAvailable (TextEditor_Dummy + 0x12)
94 #define MUIA_TextEditor_WrapBorder (TextEditor_Dummy + 0x21)
95 #define MUIA_TextEditor_Rows (TextEditor_Dummy + 0x32)
96 #define MUIA_TextEditor_Columns (TextEditor_Dummy + 0x33)
97 #define MUIA_TextEditor_AutoClip (TextEditor_Dummy + 0x34)
98 #define MUIA_TextEditor_CursorPosition (TextEditor_Dummy + 0x35)
99 #define MUIA_TextEditor_KeyUpFocus (TextEditor_Dummy + 0x36)
100 #define MUIA_TextEditor_UndoLevels (TextEditor_Dummy + 0x38)
101 #define MUIA_TextEditor_WrapMode (TextEditor_Dummy + 0x39)
102 #define MUIA_TextEditor_ActiveObjectOnClick (TextEditor_Dummy + 0x3a)
104 #define MUIM_TextEditor_AddKeyBindings (TextEditor_Dummy + 0x22)
105 #define MUIM_TextEditor_ARexxCmd (TextEditor_Dummy + 0x23)
106 #define MUIM_TextEditor_BlockInfo (TextEditor_Dummy + 0x30)
107 #define MUIM_TextEditor_ClearText (TextEditor_Dummy + 0x24)
108 #define MUIM_TextEditor_ExportBlock (TextEditor_Dummy + 0x37)
109 #define MUIM_TextEditor_ExportText (TextEditor_Dummy + 0x25)
110 #define MUIM_TextEditor_HandleError (TextEditor_Dummy + 0x1f)
111 #define MUIM_TextEditor_InsertText (TextEditor_Dummy + 0x26)
112 #define MUIM_TextEditor_MacroBegin (TextEditor_Dummy + 0x27)
113 #define MUIM_TextEditor_MacroEnd (TextEditor_Dummy + 0x28)
114 #define MUIM_TextEditor_MacroExecute (TextEditor_Dummy + 0x29)
115 #define MUIM_TextEditor_Replace (TextEditor_Dummy + 0x2a)
116 #define MUIM_TextEditor_Search (TextEditor_Dummy + 0x2b)
117 #define MUIM_TextEditor_MarkText (TextEditor_Dummy + 0x2c)
118 #define MUIM_TextEditor_QueryKeyAction (TextEditor_Dummy + 0x2d)
119 #define MUIM_TextEditor_SetBlock (TextEditor_Dummy + 0x2e)
121 struct MUIP_TextEditor_ARexxCmd
{ STACKED ULONG MethodID
; STACKED STRPTR command
; };
122 struct MUIP_TextEditor_BlockInfo
{ STACKED ULONG MethodID
; STACKED ULONG
*startx
; STACKED ULONG
*starty
; STACKED ULONG
*stopx
; STACKED ULONG
*stopy
; };
123 struct MUIP_TextEditor_ClearText
{ STACKED ULONG MethodID
; };
124 struct MUIP_TextEditor_ExportBlock
{ STACKED ULONG MethodID
; STACKED ULONG flags
; STACKED ULONG startx
; STACKED ULONG starty
; STACKED ULONG stopx
; STACKED ULONG stopy
; };
125 struct MUIP_TextEditor_ExportText
{ STACKED ULONG MethodID
; };
126 struct MUIP_TextEditor_HandleError
{ STACKED ULONG MethodID
; STACKED ULONG errorcode
; }; /* See below for error codes */
127 struct MUIP_TextEditor_InsertText
{ STACKED ULONG MethodID
; STACKED STRPTR text
; STACKED LONG pos
; }; /* See below for positions */
128 struct MUIP_TextEditor_Replace
{ STACKED ULONG MethodID
; STACKED STRPTR NewString
; STACKED ULONG Flags
; };
129 struct MUIP_TextEditor_Search
{ STACKED ULONG MethodID
; STACKED STRPTR SearchString
; STACKED ULONG Flags
; };
130 struct MUIP_TextEditor_MarkText
{ STACKED ULONG MethodID
; STACKED ULONG start_crsr_x
; STACKED ULONG start_crsr_y
; STACKED ULONG stop_crsr_x
; STACKED ULONG stop_crsr_y
; };
131 struct MUIP_TextEditor_QueryKeyAction
{ STACKED ULONG MethodID
; STACKED ULONG keyAction
; };
132 struct MUIP_TextEditor_SetBlock
{ STACKED ULONG MethodID
; STACKED ULONG startx
; STACKED ULONG starty
; STACKED ULONG stopx
; STACKED ULONG stopy
; STACKED ULONG operation
; STACKED ULONG value
; };
134 #define MUIV_TextEditor_ExportHook_Plain 0x00000000UL
135 #define MUIV_TextEditor_ExportHook_EMail 0x00000001UL
136 #define MUIV_TextEditor_ExportHook_NoStyle 0x00000002UL
138 #define MUIV_TextEditor_Flow_Left 0x00000000UL
139 #define MUIV_TextEditor_Flow_Center 0x00000001UL
140 #define MUIV_TextEditor_Flow_Right 0x00000002UL
141 #define MUIV_TextEditor_Flow_Justified 0x00000003UL
143 #define MUIV_TextEditor_ImportHook_Plain 0x00000000UL
144 #define MUIV_TextEditor_ImportHook_EMail 0x00000002UL
145 #define MUIV_TextEditor_ImportHook_MIME 0x00000003UL
146 #define MUIV_TextEditor_ImportHook_MIMEQuoted 0x00000004UL
148 #define MUIV_TextEditor_InsertText_Cursor 0x00000000UL
149 #define MUIV_TextEditor_InsertText_Top 0x00000001UL
150 #define MUIV_TextEditor_InsertText_Bottom 0x00000002UL
152 /* Values for MUIA_TextEditor_WrapMode */
153 #define MUIV_TextEditor_WrapMode_NoWrap 0x00000000UL
154 #define MUIV_TextEditor_WrapMode_SoftWrap 0x00000001UL
155 #define MUIV_TextEditor_WrapMode_HardWrap 0x00000002UL
157 /* Values for MUIM_TextEditor_MarkText */
158 #define MUIV_TextEditor_MarkText_All -1
159 #define MUIV_TextEditor_MarkText_None -1
161 /* Flags for MUIM_TextEditor_Search */
162 #define MUIF_TextEditor_Search_FromTop (1 << 0)
163 #define MUIF_TextEditor_Search_Next (1 << 1)
164 #define MUIF_TextEditor_Search_CaseSensitive (1 << 2)
165 #define MUIF_TextEditor_Search_DOSPattern (1 << 3)
166 #define MUIF_TextEditor_Search_Backwards (1 << 4)
168 /* Flags for MUIM_TextEditor_ExportBlock */
169 #define MUIF_TextEditor_ExportBlock_FullLines (1 << 0)
170 #define MUIF_TextEditor_ExportBlock_TakeBlock (1 << 1)
172 /* Flags for MUIM_TextEditor_SetBlock */
173 #define MUIF_TextEditor_SetBlock_Color (1 << 0)
174 #define MUIF_TextEditor_SetBlock_StyleBold (1 << 1)
175 #define MUIF_TextEditor_SetBlock_StyleItalic (1 << 2)
176 #define MUIF_TextEditor_SetBlock_StyleUnderline (1 << 3)
177 #define MUIF_TextEditor_SetBlock_Flow (1 << 4)
179 /* Error codes given as argument to MUIM_TextEditor_HandleError */
180 #define Error_ClipboardIsEmpty 0x01
181 #define Error_ClipboardIsNotFTXT 0x02
182 #define Error_MacroBufferIsFull 0x03
183 #define Error_MemoryAllocationFailed 0x04
184 #define Error_NoAreaMarked 0x05
185 #define Error_NoMacroDefined 0x06
186 #define Error_NothingToRedo 0x07
187 #define Error_NothingToUndo 0x08
188 #define Error_NotEnoughUndoMem 0x09 /* This will cause all the stored undos to be freed */
189 #define Error_StringNotFound 0x0a
190 #define Error_NoBookmarkInstalled 0x0b
191 #define Error_BookmarkHasBeenLost 0x0c
195 STACKED STRPTR LineContents
; /* This field is ReadOnly!!! */
196 STACKED ULONG ClickPosition
;
197 STACKED ULONG Qualifier
; /* V15.26+, a possible qualifier that was pressed during the double click */
200 /* Definitions for Separator type */
201 #define LNSB_Top 0 /* Mutual exclude: */
202 #define LNSB_Middle 1 /* Placement of */
203 #define LNSB_Bottom 2 /* the separator */
204 #define LNSB_StrikeThru 3 /* Let separator go thru the textfont */
205 #define LNSB_Thick 4 /* Extra thick separator */
207 #define LNSF_Top (1<<LNSB_Top)
208 #define LNSF_Middle (1<<LNSB_Middle)
209 #define LNSF_Bottom (1<<LNSB_Bottom)
210 #define LNSF_StrikeThru (1<<LNSB_StrikeThru)
211 #define LNSF_Thick (1<<LNSB_Thick)
213 /* Keyaction definitions */
214 #define MUIV_TextEditor_KeyAction_Up 0x00
215 #define MUIV_TextEditor_KeyAction_Down 0x01
216 #define MUIV_TextEditor_KeyAction_Left 0x02
217 #define MUIV_TextEditor_KeyAction_Right 0x03
218 #define MUIV_TextEditor_KeyAction_PageUp 0x04
219 #define MUIV_TextEditor_KeyAction_PageDown 0x05
220 #define MUIV_TextEditor_KeyAction_StartOfLine 0x06
221 #define MUIV_TextEditor_KeyAction_EndOfLine 0x07
222 #define MUIV_TextEditor_KeyAction_Top 0x08
223 #define MUIV_TextEditor_KeyAction_Bottom 0x09
224 #define MUIV_TextEditor_KeyAction_PrevWord 0x0a
225 #define MUIV_TextEditor_KeyAction_NextWord 0x0b
226 #define MUIV_TextEditor_KeyAction_PrevLine 0x0c
227 #define MUIV_TextEditor_KeyAction_NextLine 0x0d
228 #define MUIV_TextEditor_KeyAction_PrevSentence 0x0e
229 #define MUIV_TextEditor_KeyAction_NextSentence 0x0f
230 #define MUIV_TextEditor_KeyAction_SuggestWord 0x10
231 #define MUIV_TextEditor_KeyAction_Backspace 0x11
232 #define MUIV_TextEditor_KeyAction_Delete 0x12
233 #define MUIV_TextEditor_KeyAction_Return 0x13
234 #define MUIV_TextEditor_KeyAction_Tab 0x14
235 #define MUIV_TextEditor_KeyAction_Cut 0x15
236 #define MUIV_TextEditor_KeyAction_Copy 0x16
237 #define MUIV_TextEditor_KeyAction_Paste 0x17
238 #define MUIV_TextEditor_KeyAction_Undo 0x18
239 #define MUIV_TextEditor_KeyAction_Redo 0x19
240 #define MUIV_TextEditor_KeyAction_DelBOL 0x1a
241 #define MUIV_TextEditor_KeyAction_DelEOL 0x1b
242 #define MUIV_TextEditor_KeyAction_DelBOW 0x1c
243 #define MUIV_TextEditor_KeyAction_DelEOW 0x1d
244 #define MUIV_TextEditor_KeyAction_NextGadget 0x1e
245 #define MUIV_TextEditor_KeyAction_GotoBookmark1 0x1f
246 #define MUIV_TextEditor_KeyAction_GotoBookmark2 0x20
247 #define MUIV_TextEditor_KeyAction_GotoBookmark3 0x21
248 #define MUIV_TextEditor_KeyAction_SetBookmark1 0x22
249 #define MUIV_TextEditor_KeyAction_SetBookmark2 0x23
250 #define MUIV_TextEditor_KeyAction_SetBookmark3 0x24
251 #define MUIV_TextEditor_KeyAction_DelLine 0x25
252 #define MUIV_TextEditor_KeyAction_SelectAll 0x26
253 #define MUIV_TextEditor_KeyAction_SelectNone 0x27
255 /* result structure for MUIM_TextEditor_QueryKeyAction */
256 struct MUIP_TextEditor_Keybinding
258 STACKED
const UWORD code
; // the RAWKEY code read only
259 STACKED
const ULONG qualifier
; // the Qualifier flags read only
260 STACKED
const UWORD action
; // the keyaction read only
263 #if !defined(__AROS__) && defined(__PPC__)
264 #if defined(__GNUC__)
266 #elif defined(__VBCC__)
267 #pragma default-align
275 #endif /* TEXTEDITOR_MCC_H */