revert between 56095 -> 55830 in arch
[AROS.git] / workbench / classes / zune / texteditor / mcp / ObjectCreator.c
blobcafc5247aea31205c022867ac39b17d7c23d5a39
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 #include <string.h>
25 #include <clib/alib_protos.h>
26 #include <devices/inputevent.h>
27 #include <libraries/asl.h>
28 #include <libraries/mui.h>
29 #include <proto/exec.h>
30 #include <proto/intuition.h>
31 #include <proto/muimaster.h>
33 #include <mui/TextEditor_mcc.h>
35 #include "locale.h"
36 #include "private.h"
37 #include "muiextra.h"
39 const char *FunctionName (UWORD func)
41 const char *name;
43 switch(func)
45 case MUIV_TextEditor_KeyAction_Up:
46 name = tr(MSG_Function_Up);
47 break;
49 case MUIV_TextEditor_KeyAction_Down:
50 name = tr(MSG_Function_Down);
51 break;
53 case MUIV_TextEditor_KeyAction_Left:
54 name = tr(MSG_Function_Left);
55 break;
57 case MUIV_TextEditor_KeyAction_Right:
58 name = tr(MSG_Function_Right);
59 break;
61 case MUIV_TextEditor_KeyAction_PageUp:
62 name = tr(MSG_Function_PrvPage);
63 break;
65 case MUIV_TextEditor_KeyAction_PageDown:
66 name = tr(MSG_Function_NxtPage);
67 break;
69 case MUIV_TextEditor_KeyAction_StartOfLine:
70 name = tr(MSG_Function_BOL);
71 break;
73 case MUIV_TextEditor_KeyAction_EndOfLine:
74 name = tr(MSG_Function_EOL);
75 break;
77 case MUIV_TextEditor_KeyAction_Top:
78 name = tr(MSG_Function_Top);
79 break;
81 case MUIV_TextEditor_KeyAction_Bottom:
82 name = tr(MSG_Function_Bottom);
83 break;
85 case MUIV_TextEditor_KeyAction_PrevWord:
86 name = tr(MSG_Function_PrvWord);
87 break;
89 case MUIV_TextEditor_KeyAction_NextWord:
90 name = tr(MSG_Function_NxtWord);
91 break;
93 case MUIV_TextEditor_KeyAction_PrevLine:
94 name = tr(MSG_Function_PrvPara);
95 break;
97 case MUIV_TextEditor_KeyAction_NextLine:
98 name = tr(MSG_Function_NxtPara);
99 break;
101 case MUIV_TextEditor_KeyAction_PrevSentence:
102 name = tr(MSG_Function_PrvSent);
103 break;
105 case MUIV_TextEditor_KeyAction_NextSentence:
106 name = tr(MSG_Function_NxtSent);
107 break;
109 case MUIV_TextEditor_KeyAction_SuggestWord:
110 name = tr(MSG_Function_SuggestSpelling);
111 break;
113 case MUIV_TextEditor_KeyAction_Backspace:
114 name = tr(MSG_Function_Backspace);
115 break;
117 case MUIV_TextEditor_KeyAction_Delete:
118 name = tr(MSG_Function_Delete);
119 break;
121 case MUIV_TextEditor_KeyAction_Return:
122 name = tr(MSG_Function_Return);
123 break;
125 case MUIV_TextEditor_KeyAction_Tab:
126 name = tr(MSG_Function_Tab);
127 break;
129 case MUIV_TextEditor_KeyAction_Cut:
130 name = tr(MSG_Function_Cut);
131 break;
133 case MUIV_TextEditor_KeyAction_Copy:
134 name = tr(MSG_Function_Copy);
135 break;
137 case MUIV_TextEditor_KeyAction_Paste:
138 name = tr(MSG_Function_Paste);
139 break;
141 case MUIV_TextEditor_KeyAction_Undo:
142 name = tr(MSG_Function_Undo);
143 break;
145 case MUIV_TextEditor_KeyAction_Redo:
146 name = tr(MSG_Function_Redo);
147 break;
149 case MUIV_TextEditor_KeyAction_DelEOL:
150 name = tr(MSG_Function_DelEOL);
151 break;
153 case MUIV_TextEditor_KeyAction_DelBOL:
154 name = tr(MSG_Function_DelBOL);
155 break;
157 case MUIV_TextEditor_KeyAction_DelEOW:
158 name = tr(MSG_Function_DelEOW);
159 break;
161 case MUIV_TextEditor_KeyAction_DelBOW:
162 name = tr(MSG_Function_DelBOW);
163 break;
165 case MUIV_TextEditor_KeyAction_DelLine:
166 name = tr(MSG_Function_DelLine);
167 break;
169 case MUIV_TextEditor_KeyAction_NextGadget:
170 name = tr(MSG_Function_NextGadget);
171 break;
173 case MUIV_TextEditor_KeyAction_GotoBookmark1:
174 name = tr(MSG_Function_GotoBookmark1);
175 break;
177 case MUIV_TextEditor_KeyAction_GotoBookmark2:
178 name = tr(MSG_Function_GotoBookmark2);
179 break;
181 case MUIV_TextEditor_KeyAction_GotoBookmark3:
182 name = tr(MSG_Function_GotoBookmark3);
183 break;
185 case MUIV_TextEditor_KeyAction_SetBookmark1:
186 name = tr(MSG_Function_SetBookmark1);
187 break;
189 case MUIV_TextEditor_KeyAction_SetBookmark2:
190 name = tr(MSG_Function_SetBookmark2);
191 break;
193 case MUIV_TextEditor_KeyAction_SetBookmark3:
194 name = tr(MSG_Function_SetBookmark3);
195 break;
197 case MUIV_TextEditor_KeyAction_SelectAll:
198 name = tr(MSG_Function_SelectAll);
199 break;
201 case MUIV_TextEditor_KeyAction_SelectNone:
202 name = tr(MSG_Function_SelectNone);
203 break;
205 default:
206 name = "";
209 return(name);
212 #define ARRAY_SIZE(X) (sizeof(X)/sizeof(X[0]))
214 static Object *PrefsObject(struct InstData_MCP *data)
216 static const void *titles[] = {
217 MSG_Page_Settings,
218 MSG_Page_Keybindings,
219 MSG_Page_SpellChecker,
220 MSG_Page_Sample
222 static const void *functions[] = {
223 MSG_Function_Up,
224 MSG_Function_Down,
225 MSG_Function_Left,
226 MSG_Function_Right,
227 MSG_Function_PrvPage,
228 MSG_Function_NxtPage,
229 MSG_Function_BOL,
230 MSG_Function_EOL,
231 MSG_Function_Top,
232 MSG_Function_Bottom,
233 MSG_Function_PrvWord,
234 MSG_Function_NxtWord,
235 MSG_Function_PrvPara,
236 MSG_Function_NxtPara,
237 MSG_Function_PrvSent,
238 MSG_Function_NxtSent,
239 MSG_Function_SuggestSpelling,
240 MSG_Function_Backspace,
241 MSG_Function_Delete,
242 MSG_Function_Return,
243 MSG_Function_Tab,
244 MSG_Function_Cut,
245 MSG_Function_Copy,
246 MSG_Function_Paste,
247 MSG_Function_Undo,
248 MSG_Function_Redo,
249 MSG_Function_DelBOL,
250 MSG_Function_DelEOL,
251 MSG_Function_DelBOW,
252 MSG_Function_DelEOW,
253 MSG_Function_NextGadget,
254 MSG_Function_GotoBookmark1,
255 MSG_Function_GotoBookmark2,
256 MSG_Function_GotoBookmark3,
257 MSG_Function_SetBookmark1,
258 MSG_Function_SetBookmark2,
259 MSG_Function_SetBookmark3,
260 MSG_Function_DelLine,
261 MSG_Function_SelectAll,
262 MSG_Function_SelectNone
264 static const void *cycleentries[] = {
265 MSG_CycleItem_Shift,
266 MSG_CycleItem_Ctrl,
267 MSG_CycleItem_Alt,
268 MSG_CycleItem_Mouse
270 unsigned int i;
272 ASSERT( ARRAY_SIZE(data->gTitles) == (ARRAY_SIZE(titles)+1) );
273 for(i=0; i<ARRAY_SIZE(titles); i++)
274 data->gTitles[i] = tr(titles[i]);
275 data->gTitles[ARRAY_SIZE(titles)] = NULL;
277 ASSERT( ARRAY_SIZE(data->functions) == (ARRAY_SIZE(functions)+1) );
278 for(i=0; i<ARRAY_SIZE(functions); i++)
279 data->functions[i] = tr(functions[i]);
280 data->functions[ARRAY_SIZE(functions)] = NULL;
282 ASSERT( ARRAY_SIZE(data->execution) == 3 );
283 data->execution[0] = tr(MSG_Execution_CLI);
284 data->execution[1] = tr(MSG_Execution_ARexx);
285 data->execution[2] = NULL;
287 ASSERT( ARRAY_SIZE(data->cycleentries) == (ARRAY_SIZE(cycleentries)+1) );
288 for(i=0; i<ARRAY_SIZE(cycleentries); i++)
289 data->cycleentries[i] = tr(cycleentries[i]);
290 data->cycleentries[ARRAY_SIZE(cycleentries)] = NULL;
292 data->obj = CreatePrefsGroup(data);
293 if(data->obj)
295 set(data->normalfont, MUIA_String_AdvanceOnCR, TRUE);
296 set(data->fixedfont, MUIA_String_AdvanceOnCR, TRUE);
298 DoMethod(data->blockqual, MUIM_MultiSet, MUIA_CycleChain, TRUE,
299 data->blockqual, data->tabsize, data->smooth,
300 data->normalfont, data->fixedfont, data->textcolor, data->frame,
301 data->highlightcolor, data->background, data->cursorcolor,
302 data->markedcolor, data->cursorwidth, data->deletekey,
303 data->blinkspeed, data->suggestcmd, data->lookupcmd,
304 data->typenspell, data->undosize, data->LookupExeType,
305 data->SuggestExeType, data->CheckWord, data->insertkey,
306 data->separatorshadow, data->separatorshine, data->inactiveCursor,
307 data->selectPointer, data->inactiveColor, NULL);
310 return(data->obj);
313 IPTR New(REG(a0, struct IClass *cl), REG(a2, Object *obj), REG(a1, struct opSet *msg))
315 if((obj = (Object *)DoSuperMethodA(cl, obj, (Msg)msg)))
317 struct InstData_MCP *data = INST_DATA(cl, obj);
319 // create the main prefs object
320 Object *prefsobject = PrefsObject(data);
322 if((data->CfgObj = prefsobject))
324 DoMethod(obj, OM_ADDMEMBER, prefsobject);
326 if(MUIMasterBase->lib_Version >= 20)
328 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->LookupExeType, MUICFG_TextEditor_LookupCmd, 2, tr(MSG_Label_LookupCmd), MUIA_Cycle_Active);
329 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->lookupcmd, MUICFG_TextEditor_LookupCmd, 2, tr(MSG_Label_LookupCmd), MUIA_String_Contents);
330 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->SuggestExeType, MUICFG_TextEditor_SuggestCmd, 2, tr(MSG_Label_SuggestCmd), MUIA_Cycle_Active);
331 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->suggestcmd, MUICFG_TextEditor_SuggestCmd, 2, tr(MSG_Label_SuggestCmd), MUIA_String_Contents);
332 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->keybindings, MUICFG_TextEditor_Keybindings, 1, tr(MSG_Page_Keybindings) );
333 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->frame, MUICFG_TextEditor_Frame, 2, tr(MSG_Label_Frame), MUIA_Framedisplay_Spec);
334 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->background, MUICFG_TextEditor_Background, 2, tr(MSG_Label_Background), MUIA_Imagedisplay_Spec);
335 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->blinkspeed, MUICFG_TextEditor_BlinkSpeed, 2, tr(MSG_Label_BlinkSpeed), MUIA_Numeric_Value);
336 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->blockqual, MUICFG_TextEditor_BlockQual, 2, tr(MSG_Label_BlkQual), MUIA_Cycle_Active);
337 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->cursorcolor, MUICFG_TextEditor_CursorColor, 2, tr(MSG_Label_Cursor), MUIA_Pendisplay_Spec);
338 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->cursorwidth, MUICFG_TextEditor_CursorWidth, 2, tr(MSG_Label_Width), MUIA_Numeric_Value);
339 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->fixedfont, MUICFG_TextEditor_FixedFont, 2, tr(MSG_Label_Fixed), MUIA_String_Contents);
340 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->highlightcolor, MUICFG_TextEditor_HighlightColor, 2, tr(MSG_Label_Highlight), MUIA_Pendisplay_Spec);
341 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->markedcolor, MUICFG_TextEditor_MarkedColor, 2, tr(MSG_Label_Selected), MUIA_Pendisplay_Spec);
342 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->inactiveColor, MUICFG_TextEditor_InactiveColor, 2, tr(MSG_Label_InactiveColor), MUIA_Pendisplay_Spec);
343 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->normalfont, MUICFG_TextEditor_NormalFont, 2, tr(MSG_Label_Normal), MUIA_String_Contents);
344 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->smooth, MUICFG_TextEditor_Smooth, 2, tr(MSG_Label_Smooth), MUIA_Selected);
345 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->selectPointer, MUICFG_TextEditor_SelectPointer, 2, tr(MSG_Label_SelectPointer), MUIA_Selected);
346 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->typenspell, MUICFG_TextEditor_TypeNSpell, 2, tr(MSG_ConfigMenu_TypeNSpell), MUIA_Selected);
347 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->CheckWord, MUICFG_TextEditor_CheckWord, 2, tr(MSG_ConfigMenu_CheckWord), MUIA_Selected);
348 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->tabsize, MUICFG_TextEditor_TabSize, 2, tr(MSG_Label_TabSize), MUIA_Numeric_Value);
349 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->textcolor, MUICFG_TextEditor_TextColor, 2, tr(MSG_Label_Text), MUIA_Pendisplay_Spec);
350 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->separatorshine, MUICFG_TextEditor_SeparatorShine, 2, tr(MSG_Label_SeparatorShine), MUIA_Pendisplay_Spec);
351 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->separatorshadow, MUICFG_TextEditor_SeparatorShadow, 2, tr(MSG_Label_SeparatorShadow), MUIA_Pendisplay_Spec);
352 DoMethod(obj, MUIM_Mccprefs_RegisterGadget, data->inactiveCursor, MUICFG_TextEditor_InactiveCursor, 2, tr(MSG_Label_InactiveCursor), MUIA_Pendisplay_Spec);
354 else
355 set(data->frame, MUIA_Disabled, TRUE);
357 return((IPTR)obj);
360 CoerceMethod(cl, obj, OM_DISPOSE);
362 return(FALSE);
365 IPTR Dispose(REG(a0, struct IClass *cl), REG(a2, Object *obj), REG(a1, Msg msg))
367 struct InstData_MCP *data = INST_DATA(cl, obj);
368 Object *editpopup = data->editpopup;
370 if(data->CfgObj)
372 DoMethod(obj, OM_REMMEMBER, data->CfgObj);
373 MUI_DisposeObject(data->CfgObj);
376 if(editpopup)
377 MUI_DisposeObject(editpopup);
379 return(DoSuperMethodA(cl, obj, msg));
382 IPTR GadgetsToConfig(REG(a0, struct IClass *cl), REG(a2, Object *obj), REG(a1, struct MUIP_Settingsgroup_GadgetsToConfig *msg))
384 struct InstData_MCP *data = INST_DATA(cl, obj);
385 IPTR cfg_data;
387 ENTER();
389 // first save the config version
390 cfg_data = CONFIG_VERSION;
391 DoMethod(msg->configdata, MUIM_Dataspace_Add, &cfg_data, sizeof(cfg_data), MUICFG_TextEditor_ConfigVersion);
393 ExportKeys(data, msg->configdata);
395 cfg_data = xget(data->frame, MUIA_Framedisplay_Spec);
396 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_Frame);
398 cfg_data = xget(data->background, MUIA_Imagedisplay_Spec);
399 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_Background);
401 cfg_data = xget(data->blinkspeed, MUIA_Numeric_Value);
402 DoMethod(msg->configdata, MUIM_Dataspace_Add, &cfg_data, sizeof(cfg_data), MUICFG_TextEditor_BlinkSpeed);
404 cfg_data = xget(data->blockqual, MUIA_Cycle_Active);
405 DoMethod(msg->configdata, MUIM_Dataspace_Add, &cfg_data, sizeof(cfg_data), MUICFG_TextEditor_BlockQual);
407 cfg_data = xget(data->cursorcolor, MUIA_Pendisplay_Spec);
408 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_CursorColor);
410 cfg_data = xget(data->cursorwidth, MUIA_Numeric_Value);
411 DoMethod(msg->configdata, MUIM_Dataspace_Add, &cfg_data, sizeof(cfg_data), MUICFG_TextEditor_CursorWidth);
413 cfg_data = xget(data->fixedfont, MUIA_String_Contents);
414 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_FixedFont);
416 cfg_data = xget(data->frame, MUIA_Framedisplay_Spec);
417 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_Frame);
419 cfg_data = xget(data->highlightcolor, MUIA_Pendisplay_Spec);
420 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_HighlightColor);
422 cfg_data = xget(data->markedcolor, MUIA_Pendisplay_Spec);
423 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_MarkedColor);
425 cfg_data = xget(data->inactiveColor, MUIA_Pendisplay_Spec);
426 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_InactiveColor);
428 cfg_data = xget(data->normalfont, MUIA_String_Contents);
429 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_NormalFont);
432 ULONG buffer[260/4];
434 get(data->LookupExeType, MUIA_Cycle_Active, buffer);
435 cfg_data = xget(data->lookupcmd, MUIA_String_Contents);
436 CopyMem((APTR)cfg_data, &buffer[1], 256);
437 DoMethod(msg->configdata, MUIM_Dataspace_Add, buffer, strlen((char *)cfg_data)+5, MUICFG_TextEditor_LookupCmd);
439 get(data->SuggestExeType, MUIA_Cycle_Active, buffer);
440 cfg_data = xget(data->suggestcmd, MUIA_String_Contents);
441 CopyMem((APTR)cfg_data, &buffer[1], 256);
442 DoMethod(msg->configdata, MUIM_Dataspace_Add, buffer, strlen((char *)cfg_data)+5, MUICFG_TextEditor_SuggestCmd);
445 cfg_data = xget(data->smooth, MUIA_Selected);
446 DoMethod(msg->configdata, MUIM_Dataspace_Add, &cfg_data, sizeof(cfg_data), MUICFG_TextEditor_Smooth);
448 cfg_data = xget(data->selectPointer, MUIA_Selected);
449 DoMethod(msg->configdata, MUIM_Dataspace_Add, &cfg_data, sizeof(cfg_data), MUICFG_TextEditor_SelectPointer);
451 cfg_data = xget(data->typenspell, MUIA_Selected);
452 DoMethod(msg->configdata, MUIM_Dataspace_Add, &cfg_data, sizeof(cfg_data), MUICFG_TextEditor_TypeNSpell);
454 cfg_data = xget(data->CheckWord, MUIA_Selected);
455 DoMethod(msg->configdata, MUIM_Dataspace_Add, &cfg_data, sizeof(cfg_data), MUICFG_TextEditor_CheckWord);
457 cfg_data = xget(data->tabsize, MUIA_Numeric_Value);
458 DoMethod(msg->configdata, MUIM_Dataspace_Add, &cfg_data, sizeof(cfg_data), MUICFG_TextEditor_TabSize);
460 cfg_data = xget(data->undosize, MUIA_Numeric_Value);
461 DoMethod(msg->configdata, MUIM_Dataspace_Add, &cfg_data, sizeof(cfg_data), MUICFG_TextEditor_UndoSize);
463 cfg_data = xget(data->textcolor, MUIA_Pendisplay_Spec);
464 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_TextColor);
466 cfg_data = xget(data->separatorshine, MUIA_Pendisplay_Spec);
467 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_SeparatorShine);
469 cfg_data = xget(data->separatorshadow, MUIA_Pendisplay_Spec);
470 DoMethod(msg->configdata, MUIM_Dataspace_Add, cfg_data, strlen((char *)cfg_data)+1, MUICFG_TextEditor_SeparatorShadow);
472 cfg_data = xget(data->inactiveCursor, MUIA_Selected);
473 DoMethod(msg->configdata, MUIM_Dataspace_Add, &cfg_data, sizeof(cfg_data), MUICFG_TextEditor_InactiveCursor);
475 RETURN(0);
476 return(0);
479 IPTR ConfigToGadgets(REG(a0, struct IClass *cl), REG(a2, Object *obj), REG(a1, struct MUIP_Settingsgroup_ConfigToGadgets *msg))
481 struct InstData_MCP *data = INST_DATA(cl, obj);
482 APTR cfg_data;
483 BOOL importKeys = TRUE;
485 if((cfg_data = (APTR)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_ConfigVersion)))
487 if(*((ULONG *)cfg_data) != CONFIG_VERSION)
489 if(MUI_Request(NULL, NULL, 0L, tr(MSG_WarnConfigVersion_Title), tr(MSG_ResetAbort), tr(MSG_WarnConfigVersion)) == 1)
491 // reset the keybindings to their default values.
492 ImportKeys(data, NULL);
493 importKeys = FALSE;
498 if(importKeys == TRUE)
499 ImportKeys(data, msg->configdata);
501 if((cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_LookupCmd)))
503 nnset(data->LookupExeType, MUIA_Cycle_Active, *(ULONG *)cfg_data);
504 nnset(data->lookupcmd, MUIA_String_Contents, (ULONG *)cfg_data+1);
506 else
508 nnset(data->LookupExeType, MUIA_Cycle_Active, 0);
509 nnset(data->lookupcmd, MUIA_String_Contents, "");
512 if((cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_SuggestCmd)))
514 nnset(data->SuggestExeType, MUIA_Cycle_Active, *(ULONG *)cfg_data);
515 nnset(data->suggestcmd, MUIA_String_Contents, (ULONG *)cfg_data+1);
517 else
519 nnset(data->SuggestExeType, MUIA_Cycle_Active, 1);
520 nnset(data->suggestcmd, MUIA_String_Contents, "\"Open('f', 'T:Matches', 'W');WriteLn('f', '%s');Close('f')");
523 nnset(data->frame, MUIA_Framedisplay_Spec, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_Frame)) ? cfg_data : "302200");
524 nnset(data->background, MUIA_Imagedisplay_Spec, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_Background)) ? cfg_data : "2:m2");
525 nnset(data->blinkspeed, MUIA_Numeric_Value, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_BlinkSpeed)) ? *(ULONG *)cfg_data : 0);
526 nnset(data->blockqual, MUIA_Cycle_Active, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_BlockQual)) ? *(ULONG *)cfg_data : 0);
527 nnset(data->cursorcolor, MUIA_Pendisplay_Spec, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_CursorColor)) ? cfg_data : "m0");
528 nnset(data->cursorwidth, MUIA_Numeric_Value, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_CursorWidth)) ? *(ULONG *)cfg_data : 6);
529 nnset(data->fixedfont, MUIA_String_Contents, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_FixedFont)) ? cfg_data : "");
530 nnset(data->highlightcolor, MUIA_Pendisplay_Spec, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_HighlightColor)) ? cfg_data : "m0");
531 nnset(data->markedcolor, MUIA_Pendisplay_Spec, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_MarkedColor)) ? cfg_data : "m6");
532 nnset(data->inactiveColor, MUIA_Pendisplay_Spec, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_InactiveColor)) ? cfg_data : "m3");
533 nnset(data->normalfont, MUIA_String_Contents, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_NormalFont)) ? cfg_data : "");
534 nnset(data->smooth, MUIA_Selected, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_Smooth)) ? *(ULONG *)cfg_data : TRUE);
535 nnset(data->selectPointer, MUIA_Selected, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_SelectPointer)) ? *(ULONG *)cfg_data : TRUE);
536 nnset(data->typenspell, MUIA_Selected, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_TypeNSpell)) ? *(ULONG *)cfg_data : FALSE);
537 nnset(data->CheckWord, MUIA_Selected, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_CheckWord)) ? *(ULONG *)cfg_data : FALSE);
538 nnset(data->tabsize, MUIA_Numeric_Value, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_TabSize)) ? *(ULONG *)cfg_data : 4);
539 nnset(data->undosize, MUIA_Numeric_Value, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_UndoSize)) ? *(ULONG *)cfg_data : 500);
540 nnset(data->textcolor, MUIA_Pendisplay_Spec, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_TextColor)) ? cfg_data : "m5");
541 nnset(data->separatorshine, MUIA_Pendisplay_Spec, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_SeparatorShine)) ? cfg_data : "m1");
542 nnset(data->separatorshadow, MUIA_Pendisplay_Spec, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_SeparatorShadow)) ? cfg_data : "m3");
543 nnset(data->inactiveCursor, MUIA_Selected, (cfg_data = (void *)DoMethod(msg->configdata, MUIM_Dataspace_Find, MUICFG_TextEditor_InactiveCursor)) ? *(ULONG *)cfg_data : TRUE);
545 return(0);