arch/cpu.resource: remove dead code
[AROS.git] / workbench / classes / zune / texteditor / mcp / private.h
blob5e0ff3a3a4ec8ca38371eb7f2795f0e06938d0ea
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
19 $Id$
21 ***************************************************************************/
23 #ifndef TEXTEDITOR_MCP_PRIV_H
24 #define TEXTEDITOR_MCP_PRIV_H
26 #include <mui/TextEditor_mcc.h>
28 #include "TextEditor_mcp.h"
30 #include <mcc_common.h>
32 #include "Debug.h"
34 // special flagging macros
35 #define setFlag(mask, flag) (mask) |= (flag) // set the flag "flag" in "mask"
36 #define clearFlag(mask, flag) (mask) &= ~(flag) // clear the flag "flag" in "mask"
37 #define maskFlag(mask, flag) (mask) &= (flag) // mask the variable "mask" with flags "flag" bitwise
38 #define isAnyFlagSet(mask, flag) (((mask) & (flag)) != 0) // return TRUE if at least one of the flags is set
39 #define isFlagSet(mask, flag) (((mask) & (flag)) == (flag)) // return TRUE if the flag is set
40 #define isFlagClear(mask, flag) (((mask) & (flag)) == 0) // return TRUE if the flag is NOT set
42 #if defined(__amigaos4__)
43 #define AllocVecShared(size, flags) AllocVecTags((size), AVT_Type, MEMF_SHARED, AVT_Lock, FALSE, ((flags)&MEMF_CLEAR) ? AVT_ClearWithValue : TAG_IGNORE, 0, TAG_DONE)
44 #else
45 #define AllocVecShared(size, flags) AllocVec((size), (flags))
46 #endif
48 #define VERSION_IS_AT_LEAST(ver, rev, minver, minrev) (((ver) > (minver)) || ((ver) == (minver) && (rev) == (minrev)) || ((ver) == (minver) && (rev) > (minrev)))
49 #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)
51 // if something in our configuration setup (keybindings, etc)
52 // has changed we can increase the config version so that TextEditor
53 // will popup a warning about and obsolete configuration.
54 #define CONFIG_VERSION 4
56 #define MCPMAXRAWBUF 64
58 #define IEQUALIFIER_SHIFT 0x0200
59 #define IEQUALIFIER_ALT 0x0400
60 #define IEQUALIFIER_COMMAND 0x0800
62 // proper RAWKEY_ defines were first introduced in OS4 and MorphOS
63 // and unfortunately they are also a bit different, so lets
64 // prepare an alternate table for it
65 #if defined(__amigaos4__)
66 #include <proto/keymap.h>
68 #define RAWKEY_NUMLOCK 0x79
70 #elif defined(__MORPHOS__)
71 #include <devices/rawkeycodes.h>
73 #define RAWKEY_CRSRUP RAWKEY_UP
74 #define RAWKEY_CRSRDOWN RAWKEY_DOWN
75 #define RAWKEY_CRSRRIGHT RAWKEY_RIGHT
76 #define RAWKEY_CRSRLEFT RAWKEY_LEFT
77 #define RAWKEY_PRINTSCR RAWKEY_PRTSCREEN
78 #define RAWKEY_BREAK RAWKEY_PAUSE
80 #define RAWKEY_AUD_STOP RAWKEY_CDTV_STOP
81 #define RAWKEY_AUD_PLAY_PAUSE RAWKEY_CDTV_PLAY
82 #define RAWKEY_AUD_PREV_TRACK RAWKEY_CDTV_PREV
83 #define RAWKEY_AUD_NEXT_TRACK RAWKEY_CDTV_NEXT
84 #define RAWKEY_AUD_SHUFFLE RAWKEY_CDTV_REW
85 #define RAWKEY_AUD_REPEAT RAWKEY_CDTV_FF
87 #else
89 #define RAWKEY_INSERT 0x47 /* Not on classic keyboards */
90 #define RAWKEY_PAGEUP 0x48 /* Not on classic keyboards */
91 #define RAWKEY_PAGEDOWN 0x49 /* Not on classic keyboards */
92 #define RAWKEY_F11 0x4B /* Not on classic keyboards */
93 #define RAWKEY_CRSRUP 0x4C
94 #define RAWKEY_CRSRDOWN 0x4D
95 #define RAWKEY_CRSRRIGHT 0x4E
96 #define RAWKEY_CRSRLEFT 0x4F
97 #define RAWKEY_F1 0x50
98 #define RAWKEY_F2 0x51
99 #define RAWKEY_F3 0x52
100 #define RAWKEY_F4 0x53
101 #define RAWKEY_F5 0x54
102 #define RAWKEY_F6 0x55
103 #define RAWKEY_F7 0x56
104 #define RAWKEY_F8 0x57
105 #define RAWKEY_F9 0x58
106 #define RAWKEY_F10 0x59
107 #define RAWKEY_HELP 0x5F
108 #define RAWKEY_SCRLOCK 0x6B /* Not on classic keyboards */
109 #define RAWKEY_PRINTSCR 0x6D /* Not on classic keyboards */
110 #define RAWKEY_BREAK 0x6E /* Not on classic keyboards */
111 #define RAWKEY_F12 0x6F /* Not on classic keyboards */
112 #define RAWKEY_HOME 0x70 /* Not on classic keyboards */
113 #define RAWKEY_END 0x71 /* Not on classic keyboards */
115 #define RAWKEY_AUD_STOP 0x72
116 #define RAWKEY_AUD_PLAY_PAUSE 0x73
117 #define RAWKEY_AUD_PREV_TRACK 0x74
118 #define RAWKEY_AUD_NEXT_TRACK 0x75
119 #define RAWKEY_AUD_SHUFFLE 0x76
120 #define RAWKEY_AUD_REPEAT 0x77
122 #define RAWKEY_NUMLOCK 0x79
124 #endif
126 struct InstData_MCP
128 Object *editpopup;
129 Object *obj;
130 Object *hotkey;
131 Object *keyfunctions;
132 Object *keyfunctions_txt;
133 Object *insertkey;
134 Object *deletekey;
135 Object *cursorwidth;
136 Object *blinkspeed;
137 Object *background;
138 Object *frame;
139 Object *textcolor;
140 Object *highlightcolor;
141 Object *cursorcolor;
142 Object *markedcolor;
143 Object *inactiveColor;
144 Object *blockqual;
145 Object *smooth;
146 Object *tabsize;
147 Object *normalfont;
148 Object *fixedfont;
149 Object *undosize;
150 Object *typenspell;
151 Object *lookupcmd;
152 Object *suggestcmd;
153 Object *keybindings;
154 Object *SuggestExeType;
155 Object *LookupExeType;
156 Object *CheckWord;
157 Object *separatorshine;
158 Object *separatorshadow;
159 Object *CfgObj;
160 Object *inactiveCursor;
161 Object *selectPointer;
163 const char *gTitles[5];
164 const char *functions[41];
165 const char *execution[3];
166 const char *cycleentries[5];
168 struct Catalog *catalog;
171 struct KeyAction
173 BOOL vanilla;
174 unsigned int key;
175 ULONG qualifier;
176 UWORD action;
179 #include "amiga-align.h"
181 struct te_key
183 UWORD code;
184 ULONG qual;
185 UWORD act;
188 #include "default-align.h"
190 extern struct MUI_CustomClass *widthslider_mcc;
191 extern struct MUI_CustomClass *speedslider_mcc;
192 extern struct MUI_CustomClass *text_mcc;
194 extern const struct te_key default_keybindings[];
196 Object *CreatePrefsGroup(struct InstData_MCP *data);
197 void ImportKeys(struct InstData_MCP *data, void *);
198 void ExportKeys(struct InstData_MCP *data, void *);
199 void AddKeyBinding (STRPTR keystring, UWORD action, struct KeyAction *storage);
200 void ConvertKeyString (STRPTR keystring, UWORD action, struct KeyAction *storage);
201 void KeyToString(STRPTR buffer, ULONG buffer_len, struct KeyAction *ka);
202 const char *FunctionName(UWORD func);
203 BOOL CreateSubClasses(void);
204 void DeleteSubClasses(void);
206 // main class methods
207 IPTR New(REG(a0, struct IClass *cl), REG(a2, Object *obj), REG(a1, struct opSet *msg));
208 IPTR Dispose(REG(a0, struct IClass *cl), REG(a2, Object *obj), REG(a1, Msg msg));
209 IPTR GadgetsToConfig(REG(a0, struct IClass *cl), REG(a2, Object *obj), REG(a1, struct MUIP_Settingsgroup_GadgetsToConfig *msg));
210 IPTR ConfigToGadgets(REG(a0, struct IClass *cl), REG(a2, Object *obj), REG(a1, struct MUIP_Settingsgroup_ConfigToGadgets *msg));
212 /// xget()
213 // Gets an attribute value from a MUI object
214 IPTR xget(Object *obj, const IPTR attr);
215 #if defined(__GNUC__)
216 // please note that we do not evaluate the return value of GetAttr()
217 // as some attributes (e.g. MUIA_Selected) always return FALSE, even
218 // when they are supported by the object. But setting b=0 right before
219 // the GetAttr() should catch the case when attr doesn't exist at all
220 #define xget(OBJ, ATTR) ({IPTR b=0; GetAttr(ATTR, OBJ, &b); b;})
221 #endif
224 #if !defined(__amigaos4__) && !defined(__MORPHOS__) && !defined(__AROS__)
225 // GetHead.c
226 struct Node *GetHead(struct List *);
227 // GetPred.c
228 struct Node *GetPred(struct Node *);
229 // GetSucc.c
230 struct Node *GetSucc(struct Node *);
231 // GetTail.c
232 struct Node *GetTail(struct List *);
233 #endif
235 #endif /* MUI_NLISTVIEWS_priv_MCP_H */