arch/cpu.resource: remove dead code
[AROS.git] / workbench / classes / zune / texteditor / mcp / CreatePrefsGroup.c
blobcc722db1941e5c5389666723078e4407a943785e
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 <stdio.h>
25 #include <clib/alib_protos.h>
27 #ifndef NO_INLINE_STDARG
28 #define NO_INLINE_STDARG
29 #endif
31 #include <libraries/asl.h>
32 #include <libraries/gadtools.h>
33 #include <libraries/mui.h>
34 #include <mui/BetterString_mcc.h>
35 #include <mui/HotkeyString_mcc.h>
36 #include <mui/TextEditor_mcc.h>
37 #include <proto/exec.h>
38 #include <proto/intuition.h>
39 #include <proto/muimaster.h>
41 #include "private.h"
42 #include "locale.h"
43 #include "muiextra.h"
44 #include "version.h"
46 #include "SDI_hook.h"
48 #include "Debug.h"
50 HOOKPROTONH(ListDisplayFunc, void, char **array, struct te_key *entry)
52 static char buffer[256];
53 struct KeyAction ka;
55 ENTER();
57 if(entry)
59 ka.key = entry->code;
61 if(ka.key >= 500)
63 ka.vanilla = TRUE;
64 ka.key -= 500;
66 else
67 ka.vanilla = FALSE;
69 ka.qualifier = entry->qual;
70 KeyToString(buffer, sizeof(buffer), &ka);
72 *array++ = buffer;
73 *array++ = (STRPTR)"=";
74 *array = (STRPTR)FunctionName(entry->act);
76 else
78 *array++ = (STRPTR)tr(MSG_LVLabel_Key);
79 *array++ = (STRPTR)"";
80 *array = (STRPTR)tr(MSG_LVLabel_Action);
83 LEAVE();
85 MakeStaticHook(ListDisplayHook, ListDisplayFunc);
87 HOOKPROTONH(ListConstructFunc, APTR, APTR pool, struct te_key *entry)
89 struct te_key *newplace;
90 ENTER();
92 newplace = AllocPooled(pool, sizeof(struct te_key));
93 if(newplace)
95 CopyMem(entry, newplace, sizeof(struct te_key));
98 RETURN(newplace);
99 return(newplace);
101 MakeStaticHook(ListConstructHook, ListConstructFunc);
103 HOOKPROTONH(ListDestructFunc, void, APTR pool, struct te_key *entry)
105 ENTER();
106 FreePooled(pool, entry, sizeof(struct te_key));
107 LEAVE();
109 MakeStaticHook(ListDestructHook, ListDestructFunc);
111 HOOKPROTONH(Popstring_WindowCode, void, Object *pop, Object *win)
113 ENTER();
114 set(win, MUIA_Window_DefaultObject, pop);
115 LEAVE();
117 MakeStaticHook(Popstring_WindowHook, Popstring_WindowCode);
119 HOOKPROTONH(Popstring_OpenCode, BOOL, Object *pop, Object *text)
121 LONG active;
122 ENTER();
124 active = xget(text, MUIA_UserData);
125 set(pop, MUIA_List_Active, active);
127 RETURN(TRUE);
128 return(TRUE);
130 MakeStaticHook(Popstring_OpenHook, Popstring_OpenCode);
132 HOOKPROTONH(Popstring_CloseCode, void, Object *pop, Object *text)
134 LONG active;
135 ENTER();
137 active = xget(pop, MUIA_List_Active);
138 set(text, MUIA_UserData, active);
140 LEAVE();
142 MakeStaticHook(Popstring_CloseHook, Popstring_CloseCode);
144 HOOKPROTONHNO(SetDefaultKeysCode, void, APTR **array)
146 Object *keylist = (Object *)*array;
147 struct te_key *key = (struct te_key *)default_keybindings;
150 ENTER();
152 DoMethod(keylist, MUIM_List_Clear);
154 set(keylist, MUIA_List_Quiet, TRUE);
156 while((WORD)key->code != -1)
158 DoMethod(keylist, MUIM_List_InsertSingle, key, MUIV_List_Insert_Bottom);
160 key++;
163 set(keylist, MUIA_List_Quiet, FALSE);
165 LEAVE();
167 MakeStaticHook(SetDefaultKeysHook, SetDefaultKeysCode);
169 HOOKPROTONHNO(InsertCode, void, APTR **array)
171 static const struct te_key constentry = {76, 0, 0};
172 Object *keylist = (Object *)*array++;
173 ULONG entry;
175 ENTER();
177 entry = xget(keylist, MUIA_List_Active);
179 if((LONG)entry != MUIV_List_Active_Off)
180 nnset(keylist, MUIA_List_Active, MUIV_List_Active_Off);
181 else
182 entry = 0;
184 DoMethod(keylist, MUIM_List_InsertSingle, &constentry, entry);
185 set(keylist, MUIA_List_Active, entry);
187 LEAVE();
189 MakeStaticHook(InsertHook, InsertCode);
191 HOOKPROTONHNO(SelectCode, void, APTR **array)
193 struct InstData_MCP *data = (struct InstData_MCP *)*array++;
194 Object *keylist = (Object *)*array++;
195 struct te_key *entry;
197 ENTER();
199 DoMethod(keylist, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &entry);
201 if(entry)
203 char buffer[256];
204 struct KeyAction ka;
205 IPTR result;
207 result = xget(data->keyfunctions, MUIA_Popstring_String);
208 nnset((Object *)result, MUIA_UserData, entry->act);
210 ka.key = entry->code;
212 if(ka.key >= 500)
214 ka.vanilla = TRUE;
215 ka.key -= 500;
217 else
218 ka.vanilla = FALSE;
220 ka.qualifier = entry->qual;
221 KeyToString(buffer, sizeof(buffer), &ka);
222 nnset(data->hotkey, MUIA_String_Contents, buffer);
225 LEAVE();
227 MakeStaticHook(SelectHook, SelectCode);
229 HOOKPROTONHNO(UpdateCode, void, APTR **array)
231 struct InstData_MCP *data = (struct InstData_MCP *)*array++;
232 Object *keylist = (Object *)*array++;
233 struct te_key entry;
234 IPTR result;
235 ULONG active;
237 ENTER();
239 active = xget(keylist, MUIA_List_Active);
241 if((LONG)active != MUIV_List_Active_Off)
243 SetAttrs(keylist, MUIA_List_Quiet, TRUE,
244 MUIA_List_Active, MUIV_List_Active_Off,
245 MUIA_NoNotify, TRUE,
246 TAG_DONE);
247 DoMethod(keylist, MUIM_List_Remove, active);
249 result = xget(data->keyfunctions, MUIA_Popstring_String);
250 result = xget((Object *)result, MUIA_UserData);
252 entry.act = result;
254 result = xget(data->hotkey, MUIA_String_Contents);
256 if(result)
258 struct KeyAction keyaction;
260 ConvertKeyString((STRPTR)result, entry.act, &keyaction);
261 entry.code = keyaction.key;
262 if(keyaction.vanilla)
264 entry.code += 500;
266 entry.qual = keyaction.qualifier;
269 DoMethod(keylist, MUIM_List_InsertSingle, &entry, active);
270 SetAttrs(keylist, MUIA_List_Active, active,
271 MUIA_List_Quiet, FALSE,
272 MUIA_NoNotify, TRUE,
273 TAG_DONE);
276 LEAVE();
278 MakeStaticHook(UpdateHook, UpdateCode);
280 static Object *TxtLabel(const char *text, ULONG weight)
282 Object *obj = TextObject,
283 MUIA_FramePhantomHoriz, TRUE,
284 MUIA_Frame, MUIV_Frame_ImageButton,
285 MUIA_Text_PreParse, "\33r",
286 MUIA_Text_SetVMax, FALSE,
287 MUIA_Text_Contents, text,
288 MUIA_Weight, weight,
289 End;
291 return(obj);
294 Object *CreatePrefsGroup(struct InstData_MCP *data)
296 BOOL mui39;
297 BOOL hotkeystringOk = FALSE;
298 Object *slider, *button, *group,
299 *editor, *keylist, *defaultkeys, *functionname,
300 *plist, *popbutton, *popNormalFontButton, *popFixedFontButton;
302 struct NewMenu editpopupdata[] =
304 { NM_TITLE, (STRPTR)tr(MSG_MenuTitle_Edit), 0, 0, 0, (APTR)0 },
305 { NM_ITEM, (STRPTR)tr(MSG_MenuItem_Cut), NULL, NM_COMMANDSTRING, 0, (APTR)1 },
306 { NM_ITEM, (STRPTR)tr(MSG_MenuItem_Copy), NULL, NM_COMMANDSTRING, 0, (APTR)2 },
307 { NM_ITEM, (STRPTR)tr(MSG_MenuItem_Paste), NULL, NM_COMMANDSTRING, 0, (APTR)3 },
308 { NM_ITEM, (STRPTR)tr(MSG_MenuItem_Delete), NULL, NM_COMMANDSTRING, 0, (APTR)4 },
309 { NM_ITEM, NM_BARLABEL, 0, 0, 0, (APTR)0 },
310 { NM_ITEM, (STRPTR)tr(MSG_MenuItem_Undo), NULL, NM_COMMANDSTRING, 0, (APTR)5 },
311 { NM_ITEM, (STRPTR)tr(MSG_MenuItem_Redo), NULL, NM_COMMANDSTRING, 0, (APTR)6 },
312 { NM_ITEM, NM_BARLABEL, 0, 0, 0, (APTR)0 },
313 { NM_ITEM, (STRPTR)tr(MSG_MenuItem_Bold), NULL, NM_COMMANDSTRING | CHECKIT|MENUTOGGLE, 0, (APTR)7 },
314 { NM_ITEM, (STRPTR)tr(MSG_MenuItem_Italic), NULL, NM_COMMANDSTRING | CHECKIT|MENUTOGGLE, 0, (APTR)8 },
315 { NM_ITEM, (STRPTR)tr(MSG_MenuItem_Underline), NULL, NM_COMMANDSTRING | CHECKIT|MENUTOGGLE, 0, (APTR)9 },
316 { NM_ITEM, NM_BARLABEL, 0, 0, 0, (APTR)0 },
317 { NM_ITEM, (STRPTR)tr(MSG_MenuSubTitle_Alignment), 0, 0, 0, (APTR)0 },
318 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Left), NULL, NM_COMMANDSTRING | CHECKIT|CHECKED, ~1, (APTR)10 },
319 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Center), NULL, NM_COMMANDSTRING | CHECKIT, ~2, (APTR)11 },
320 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Right), NULL, NM_COMMANDSTRING | CHECKIT, ~4, (APTR)12 },
322 { NM_ITEM, (STRPTR)tr(MSG_MenuSubTitle_Color), 0, 0, 0, (APTR)0 },
323 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Normal), NULL, NM_COMMANDSTRING | CHECKIT|CHECKED, ~1, (APTR)13 },
324 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Shine), NULL, NM_COMMANDSTRING | CHECKIT, ~2, (APTR)14 },
325 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Halfshine), NULL, NM_COMMANDSTRING | CHECKIT, ~4, (APTR)15 },
326 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Background), NULL, NM_COMMANDSTRING | CHECKIT, ~8, (APTR)16 },
327 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Halfshadow), NULL, NM_COMMANDSTRING | CHECKIT, ~16, (APTR)17 },
328 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Shadow), NULL, NM_COMMANDSTRING | CHECKIT, ~32, (APTR)18 },
329 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Text), NULL, NM_COMMANDSTRING | CHECKIT, ~64, (APTR)19 },
330 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Fill), NULL, NM_COMMANDSTRING | CHECKIT, ~128, (APTR)20 },
331 { NM_SUB, (STRPTR)tr(MSG_MenuItem_Mark), NULL, NM_COMMANDSTRING | CHECKIT, ~256, (APTR)21 },
333 { NM_END, NULL, 0, 0, 0, (APTR)0 }
336 static const char infotext1[] = "\033bTextEditor.mcp " LIB_REV_STRING "\033n (" LIB_DATE ")\n"
337 "Copyright (C) 1997-2000 Allan Odgaard\n"
338 LIB_COPYRIGHT;
339 static const char infotext2[] = "\n"
340 "Distributed under the terms of the LGPL2.\n"
341 "\n"
342 "For the latest version, check out:\n"
343 "http://www.sf.net/projects/texteditor-mcc/\n"
344 "\n";
346 ENTER();
348 // check that HotkeyString.mcc exists and is
349 // uptodate
350 data->hotkey = HotkeyStringObject,
351 MUIA_CycleChain, TRUE,
352 MUIA_Frame, MUIV_Frame_String,
353 MUIA_HotkeyString_Snoop, FALSE,
354 MUIA_Weight, 500,
355 End;
357 // request a specific minimum version. Here 12.5 because other versions
358 // may contain known bugs.
359 if(data->hotkey != NULL)
361 ULONG version, revision;
363 version = xget(data->hotkey, MUIA_Version);
364 revision = xget(data->hotkey, MUIA_Revision);
365 D(DBF_STARTUP, "found HotkeyString.mcc V%ld.%ld", version, revision);
367 if(version > 12 || (version == 12 && revision >= 5))
369 // everything is fine
370 hotkeystringOk = TRUE;
372 else
374 // get rid of the too old object
375 MUI_DisposeObject(data->hotkey);
376 data->hotkey = NULL;
380 if(hotkeystringOk == FALSE)
382 MUI_Request(NULL, NULL, 0L, tr(MSG_WarnHotkeyString_Title), tr(MSG_Ok), tr(MSG_WarnHotkeyString));
384 RETURN(NULL);
385 return NULL;
388 mui39 = LIB_VERSION_IS_AT_LEAST(MUIMasterBase, 20, 0);
390 data->editpopup = MUI_MakeObject(MUIO_MenustripNM, editpopupdata, NULL);
392 group = VGroup,
393 Child, RegisterGroup(data->gTitles),
394 MUIA_CycleChain, TRUE,
395 MUIA_Background, MUII_RegisterBack,
396 Child, HGroup,
397 Child, VGroup,
398 Child, VGroup,
399 MUIA_VertWeight, 0,
400 MUIA_Background, MUII_GroupBack,
401 MUIA_Frame, MUIV_Frame_Group,
402 MUIA_FrameTitle, tr(MSG_GroupTitle_Control),
403 Child, VSpace(0),
404 Child, ColGroup(2),
405 Child, TxtLabel(tr(MSG_Label_UndoLevel), 0),
406 Child, data->undosize = SliderObject,
407 MUIA_ShortHelp, tr(MSG_HelpBubble_UndoLevel),
408 MUIA_Numeric_Min, 0,
409 MUIA_Numeric_Max, 2000,
410 MUIA_CycleChain, TRUE,
411 End,
412 Child, TxtLabel(tr(MSG_Label_TabSize), 0),
413 Child, data->tabsize = SliderObject,
414 MUIA_ShortHelp, tr(MSG_HELP_TABSIZE),
415 MUIA_Numeric_Min, 2,
416 MUIA_Numeric_Max, 12,
417 MUIA_Numeric_Format, tr(MSG_SliderText_TabSize),
418 MUIA_CycleChain, TRUE,
419 End,
420 Child, TxtLabel(tr(MSG_Label_Smooth), 0),
421 Child, HGroup,
422 MUIA_ShortHelp, tr(MSG_HelpBubble_Smooth),
423 Child, data->smooth = MUI_MakeObject(MUIO_Checkmark, NULL),
424 Child, HSpace(0),
425 End,
426 Child, TxtLabel(tr(MSG_Label_SelectPointer), 0),
427 Child, HGroup,
428 MUIA_ShortHelp, tr(MSG_HELP_SelectPointer),
429 Child, data->selectPointer = MUI_MakeObject(MUIO_Checkmark, NULL),
430 Child, HSpace(0),
431 End,
432 End,
433 Child, VSpace(0),
434 End,
436 Child, ColGroup(4),
437 // MUIA_VertWeight, 0,
438 MUIA_Group_SameHeight, FALSE,
439 MUIA_Background, MUII_GroupBack,
440 MUIA_Frame, MUIV_Frame_Group,
441 MUIA_FrameTitle, tr(MSG_GroupTitle_Design),
443 Child, TxtLabel(tr(MSG_Label_Frame), 0),
444 Child, data->frame = MUI_NewObject("Popframe.mui",
445 MUIA_Window_Title, tr(MSG_PopWinTitle_Frame),
446 MUIA_ShortHelp, tr(MSG_HELP_DESIGN_FRAME),
447 MUIA_CycleChain, TRUE,
448 End,
449 Child, TxtLabel(tr(MSG_Label_Background), 0),
450 Child, data->background = MUI_NewObject("Popimage.mui",
451 MUIA_Window_Title, tr(MSG_PopWinTitle_Background),
452 MUIA_ShortHelp, tr(MSG_HELP_DESIGN_BACKGROUND),
453 MUIA_Imageadjust_Type, 2,
454 MUIA_CycleChain, TRUE,
455 End,
456 Child, TxtLabel(tr(MSG_Label_Text), 0),
457 Child, data->textcolor = PoppenObject,
458 MUIA_Window_Title, tr(MSG_PopWinTitle_Text),
459 MUIA_ShortHelp, tr(MSG_HELP_DESIGN_TEXT),
460 MUIA_CycleChain, TRUE,
461 End,
462 Child, TxtLabel(tr(MSG_Label_Highlight), 0),
463 Child, data->highlightcolor = PoppenObject,
464 MUIA_Window_Title, tr(MSG_PopWinTitle_Highlight),
465 MUIA_ShortHelp, tr(MSG_HELP_DESIGN_HIGHLIGHT),
466 MUIA_CycleChain, TRUE,
467 End,
468 End,
470 Child, HGroup,
471 MUIA_VertWeight, 60,
472 MUIA_Background, MUII_GroupBack,
473 MUIA_Frame, MUIV_Frame_Group,
474 MUIA_FrameTitle, tr(MSG_GroupTitle_Separator),
475 Child, TxtLabel(tr(MSG_Label_SeparatorShine), 0),
476 Child, data->separatorshine = PoppenObject,
477 MUIA_Window_Title, tr(MSG_PopWinTitle_SeparatorShine),
478 MUIA_ShortHelp, tr(MSG_HELP_SEPARATOR_SHINE),
479 MUIA_CycleChain, TRUE,
480 End,
481 Child, TxtLabel(tr(MSG_Label_SeparatorShadow), 0),
482 Child, data->separatorshadow = PoppenObject,
483 MUIA_Window_Title, tr(MSG_PopWinTitle_SeparatorShadow),
484 MUIA_ShortHelp, tr(MSG_HELP_SEPARATOR_SHADOW),
485 MUIA_CycleChain, TRUE,
486 End,
487 End,
488 End,
490 Child, VGroup,
491 Child, VGroup,
492 // MUIA_VertWeight, 0,
493 MUIA_Background, MUII_GroupBack,
494 MUIA_Frame, MUIV_Frame_Group,
495 MUIA_FrameTitle, tr(MSG_GroupTitle_Fonts),
496 Child, ColGroup(2),
497 Child, TxtLabel(tr(MSG_Label_Normal), 0),
498 Child, PopaslObject,
499 MUIA_Popstring_String, data->normalfont = BetterStringObject,
500 StringFrame,
501 MUIA_CycleChain, TRUE,
502 End,
503 MUIA_Popstring_Button, popNormalFontButton = MUI_MakeObject(MUIO_PopButton, mui39 == TRUE ? MUII_PopFont : MUII_PopUp),
504 MUIA_Popasl_Type, ASL_FontRequest,
505 MUIA_ShortHelp, tr(MSG_HELP_FONTS_NORMAL),
506 End,
507 Child, TxtLabel(tr(MSG_Label_Fixed), 0),
508 Child, PopaslObject,
509 MUIA_Popstring_String, data->fixedfont = BetterStringObject,
510 StringFrame,
511 MUIA_CycleChain, TRUE,
512 End,
513 MUIA_Popstring_Button, popFixedFontButton = MUI_MakeObject(MUIO_PopButton, mui39 == TRUE ? MUII_PopFont : MUII_PopUp),
514 MUIA_Popasl_Type, ASL_FontRequest,
515 ASLFO_Flags, FOF_FIXEDWIDTHONLY,
516 MUIA_ShortHelp, tr(MSG_HELP_FONTS_FIXED),
517 End,
518 End,
519 End,
521 Child, VGroup,
522 // MUIA_VertWeight, 0,
523 MUIA_Background, MUII_GroupBack,
524 MUIA_Frame, MUIV_Frame_Group,
525 MUIA_FrameTitle, tr(MSG_GroupTitle_Cursor),
526 MUIA_Group_Columns, 2,
527 Child, TxtLabel(tr(MSG_Label_Cursor), 0),
528 Child, data->cursorcolor = PoppenObject,
529 MUIA_Window_Title, tr(MSG_PopWinTitle_Cursor),
530 MUIA_ShortHelp, tr(MSG_HELP_CURSOR_NORMAL),
531 MUIA_CycleChain, TRUE,
532 End,
533 Child, TxtLabel(tr(MSG_Label_Selected), 0),
534 Child, data->markedcolor = PoppenObject,
535 MUIA_Window_Title, tr(MSG_PopWinTitle_Selected),
536 MUIA_ShortHelp, tr(MSG_HELP_CURSOR_SELECTED),
537 MUIA_CycleChain, TRUE,
538 End,
539 Child, TxtLabel(tr(MSG_Label_InactiveColor), 0),
540 Child, data->inactiveColor = PoppenObject,
541 MUIA_Window_Title, tr(MSG_PopWinTitle_InactiveColor),
542 MUIA_ShortHelp, tr(MSG_HELP_CURSOR_INACTIVE),
543 MUIA_CycleChain, TRUE,
544 End,
545 Child, TxtLabel(tr(MSG_Label_Width), 0),
546 Child, data->cursorwidth = NewObject(widthslider_mcc->mcc_Class, NULL,
547 MUIA_Numeric_Min, 1,
548 MUIA_Numeric_Max, 6,
549 MUIA_Numeric_Format, tr(MSG_SliderText_StdWidth),
550 MUIA_ShortHelp, tr(MSG_HELP_CURSOR_WIDTH),
551 MUIA_CycleChain, TRUE,
552 End,
553 Child, TxtLabel(tr(MSG_Label_BlinkSpeed), 0),
554 Child, data->blinkspeed = NewObject(speedslider_mcc->mcc_Class, NULL,
555 MUIA_Numeric_Min, 0,
556 MUIA_Numeric_Max, 20,
557 MUIA_Numeric_Format, tr(MSG_SliderText_StdSpeed),
558 MUIA_ShortHelp, tr(MSG_HELP_CURSOR_BLINKSPEED),
559 MUIA_CycleChain, TRUE,
560 End,
561 Child, TxtLabel(tr(MSG_Label_InactiveCursor), 0),
562 Child, HGroup,
563 MUIA_VertWeight, 0,
564 MUIA_ShortHelp, tr(MSG_HELP_InactiveCursor),
565 Child, data->inactiveCursor = MUI_MakeObject(MUIO_Checkmark, NULL),
566 Child, HSpace(0),
567 End,
568 End,
570 End,
572 End,
574 Child, VGroup,
575 Child, HGroup,
576 Child, defaultkeys = SimpleButton(tr(MSG_Button_DefaultKeys)),
577 Child, TxtLabel(tr(MSG_Label_BlkQual), 1000),
578 Child, data->blockqual = MUI_MakeObject(MUIO_Cycle, NULL, data->cycleentries),
579 End,
580 Child, data->keybindings = ListviewObject,
581 MUIA_CycleChain, TRUE,
582 MUIA_Listview_DragType, MUIV_Listview_DragType_Immediate,
583 MUIA_Listview_List, keylist = ListObject,
584 MUIA_Frame, MUIV_Frame_InputList,
585 MUIA_Background, MUII_ListBack,
586 MUIA_List_Title, TRUE,
587 MUIA_List_ConstructHook, &ListConstructHook,
588 MUIA_List_DestructHook, &ListDestructHook,
589 MUIA_List_DisplayHook, &ListDisplayHook,
590 MUIA_List_DragSortable, TRUE,
591 MUIA_List_Format, "P=\33r W=100 0, P=\33c 1, 2",
592 // MUIA_List_Format, "P=\33r W=100 0, P=\33c NoTB NoBar 1, 2",
593 // MUIA_List_SourceArray, keybindings,
594 // MUIA_List_TitleClick, TRUE,
595 // MUIA_List_DragType, MUIV_List_DragType_Default,
596 End,
597 End,
598 Child, VGroup,
599 Child, HGroup,
600 Child, data->hotkey,
601 Child, button = TextObject, ButtonFrame,
602 MUIA_ShortHelp, tr(MSG_HELP_BUTTON_SNOOP),
603 MUIA_CycleChain, TRUE,
604 MUIA_Background, MUII_ButtonBack,
605 MUIA_Text_Contents, tr(MSG_Button_Snoop),
606 MUIA_Text_SetMax, TRUE,
607 MUIA_InputMode, MUIV_InputMode_Toggle,
608 End,
610 Child, BalanceObject, End,
612 Child, MUI_MakeObject(MUIO_Label, "=", MUIO_Label_Centered),
613 // Child, MUI_MakeObject(MUIO_Cycle, NULL, data->functions),
614 Child, data->keyfunctions = PopobjectObject,
615 MUIA_Weight, 400,
616 MUIA_Popstring_String, functionname = NewObject(text_mcc->mcc_Class, NULL, TextFrame, MUIA_Background, MUII_TextBack, End,
617 MUIA_Popstring_Button, popbutton = MUI_MakeObject(MUIO_PopButton, MUII_PopUp),
618 MUIA_Popobject_StrObjHook, &Popstring_OpenHook,
619 MUIA_Popobject_ObjStrHook, &Popstring_CloseHook,
620 MUIA_Popobject_WindowHook, &Popstring_WindowHook,
622 MUIA_Popobject_Object, plist = ListviewObject,
623 MUIA_CycleChain, TRUE,
624 MUIA_Listview_List, ListObject,
625 InputListFrame,
626 MUIA_List_AutoVisible, TRUE,
627 MUIA_List_SourceArray, data->functions,
628 End,
629 End,
631 // MUIA_Poplist_Array, data->functions,
632 End,
634 End,
635 Child, HGroup,
636 Child, data->insertkey = SimpleButton(tr(MSG_Button_Insert)),
637 Child, data->deletekey = SimpleButton(tr(MSG_Button_Delete)),
638 End,
639 End,
640 End,
642 Child, VGroup,
644 Child, HGroup,
645 GroupSpacing(0),
646 Child, ListviewObject,
647 MUIA_CycleChain, TRUE,
648 MUIA_Listview_Input, FALSE,
649 MUIA_Listview_List, FloattextObject,
650 MUIA_Frame, MUIV_Frame_ReadList,
651 MUIA_Background, MUII_ReadListBack,
652 MUIA_Floattext_Text, tr(MSG_HelpTxt_SpellChecker),
653 MUIA_Floattext_Justify, FALSE,
654 End,
655 End,
656 End,
658 Child, BalanceObject, End,
660 Child, ColGroup(3),
661 Child, TxtLabel(tr(MSG_Label_LookupCmd), 0),
662 Child, data->LookupExeType = CycleObject,
663 MUIA_Cycle_Entries, data->execution,
664 MUIA_Weight, 0,
665 MUIA_CycleChain, TRUE,
666 End,
667 Child, data->lookupcmd = BetterStringObject, StringFrame,
668 MUIA_ShortHelp, tr(MSG_HELP_SPELLCHECKER_LOOKUP_CMD),
669 MUIA_CycleChain, TRUE,
670 End,
671 Child, TxtLabel(tr(MSG_Label_SuggestCmd), 0),
672 Child, data->SuggestExeType = CycleObject,
673 MUIA_Cycle_Entries, data->execution,
674 MUIA_Weight, 0,
675 MUIA_CycleChain, TRUE,
676 End,
677 Child, data->suggestcmd = BetterStringObject, StringFrame,
678 MUIA_String_AdvanceOnCR, TRUE,
679 MUIA_ShortHelp, tr(MSG_HELP_SPELLCHECKER_SUGGEST_CMD),
680 MUIA_CycleChain, TRUE,
681 End,
682 End,
683 Child, ColGroup(2),
684 Child, TxtLabel(tr(MSG_Label_SpellNType), 1000),
685 Child, data->typenspell = MUI_MakeObject(MUIO_Checkmark, NULL),
686 Child, TxtLabel(tr(MSG_Label_LookupWords), 1000),
687 Child, data->CheckWord = MUI_MakeObject(MUIO_Checkmark, NULL),
688 MUIA_Weight, 0,
689 End,
691 Child, RectangleObject,
692 MUIA_Weight, 25,
693 End,
695 End,
697 Child, HGroup,
698 GroupSpacing(0),
699 Child, editor = TextEditorObject,
700 MUIA_CycleChain, TRUE,
701 MUIA_ContextMenu, data->editpopup,
702 MUIA_TextEditor_Contents,
703 "\033r\033b" LIB_DATE "\033n\n"
704 "\n\33cTextEditor.mcp " LIB_REV_STRING " [" SYSTEMSHORT "/" CPU "] (" LIB_DATE ")\n"
705 "Copyright (C) 1997-2000 Allan Odgaard\n"
706 LIB_COPYRIGHT
707 "\n\033[s:9]\n"
708 "For the latest version, try: \33u\33p[7]http://www.sourceforge.net/projects/texteditor-mcc/\33p[0]\33n\n"
709 "\n"
710 "This gadget is \33ifree software\33n. You can redistribute it and/or modify it under the terms of "
711 "the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 "
712 "of the License, or (at your option) any later version.\n"
713 "\n"
714 "\33[s:2]\33c\33u\33b Usage: \33n\n"
715 "\33l\n"
716 "Besides the many keys you can configure on the \33iKeybindings\33n page, there is also the following you should know:\n"
717 "\n"
718 "- You can double-click a word to select it. Triple-clicking has the same effect, but for entire lines.\n"
719 "\n"
720 "- In the default configuration you can extend your block by holding down any <Shift> key while you press LMB and drag the mouse until you reach the point where you want the block to end.\n"
721 "\n"
722 "- While you drag to scroll, the farther away from the gadget your mouse pointer is, the faster the contents will scroll.\n"
723 "\n"
724 "\33[s:2]\33c\33u\33b ARexx: \33n\n"
725 "\33l\n"
726 "The gadget offers the application using it the chance to extend its ARexx port to also cover this editor gadget. If this is done, you will have the following additional commands available:\n"
727 "\n"
728 "CLEAR, CUT, COPY, PASTE, ERASE, GOTOLINE (\"/N/A\"), GOTOCOLUMN (\"/N/A\"), CURSOR (\"Up/S,Down/S,Left/S,Right/S\"), LINE (\"/N/A\"), COLUMN (\"/N/A\"), NEXT (\"Word/S,Sentence/S,Paragraph/S,Page/S\"), PREVIOUS (\"Word/S,Sentence/S,Paragraph/S,Page/S\"), POSITION (\"SOF/S,EOF/S,SOL/S,EOL/S,SOW/S,EOW/S,SOV/S,EOV/S\"), SETBOOKMARK (\"/N/A\"), GOTOBOOKMARK (\"/N/A\"), TEXT (\"/F\"), UNDO, REDO, GETLINE, GETCURSOR (\"Line/S,Column/S\"), MARK(\"On/S,Off/S\"), DELETE, BACKSPACE, KILLLINE, TOUPPER, TOLOWER.\n"
729 "\n"
730 "Please refer to the TextEditor.mcc documentation for an explanation on how to use these commands.\n"
731 "\n\33[s:10]\n\33cThis instance has a context sensitive menu, from where you can play with text styles, colors, alignments etc.",
732 End,
733 Child, slider = ScrollbarObject,
734 End,
735 End,
736 End,
738 Child, CrawlingObject,
739 TextFrame,
740 MUIA_FixHeightTxt, infotext1,
741 MUIA_Background, "m1",
743 Child, TextObject,
744 MUIA_Text_Copy, FALSE,
745 MUIA_Text_PreParse, "\033c",
746 MUIA_Text_Contents, infotext1,
747 End,
749 Child, TextObject,
750 MUIA_Text_Copy, FALSE,
751 MUIA_Text_PreParse, "\033c",
752 MUIA_Text_Contents, infotext2,
753 End,
755 Child, TextObject,
756 MUIA_Text_Copy, FALSE,
757 MUIA_Text_PreParse, "\033c",
758 MUIA_Text_Contents, infotext1,
759 End,
760 End,
762 End;
764 if(group && data->editpopup)
767 set(readview, MUIA_TextEditor_Slider, slider2);
769 set(editor, MUIA_TextEditor_Slider, slider);
771 set(data->blockqual, MUIA_ShortHelp, tr(MSG_HelpBubble_BlockQual));
772 set(data->typenspell, MUIA_ShortHelp, tr(MSG_HelpBubble_TypeNSpell));
773 set(data->CheckWord, MUIA_ShortHelp, tr(MSG_HelpBubble_CheckWord));
774 set(defaultkeys, MUIA_ShortHelp, tr(MSG_HELP_BUTTON_DEFAULTKEYS));
775 set(defaultkeys, MUIA_CycleChain, TRUE);
776 set(data->hotkey, MUIA_ShortHelp, tr(MSG_HELP_BUTTON_SNOOP));
777 set(data->insertkey, MUIA_ShortHelp, tr(MSG_HELP_BUTTON_INSERT));
778 set(data->deletekey, MUIA_ShortHelp, tr(MSG_HELP_BUTTON_DELETE));
780 set(data->hotkey, MUIA_String_AttachedList, data->keybindings);
781 set(popbutton, MUIA_CycleChain, TRUE);
782 set(popNormalFontButton, MUIA_CycleChain, TRUE);
783 set(popFixedFontButton, MUIA_CycleChain, TRUE);
785 DoMethod(data->lookupcmd, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime, MUIV_Notify_Window, 3, MUIM_Set, MUIA_Window_ActiveObject, data->suggestcmd);
787 DoMethod(button, MUIM_Notify, MUIA_Selected, TRUE, MUIV_Notify_Window, 3, MUIM_Set, MUIA_Window_ActiveObject, data->hotkey);
788 DoMethod(button, MUIM_Notify, MUIA_Selected, FALSE, data->hotkey, 3, MUIM_Set, MUIA_String_Acknowledge, TRUE);
789 DoMethod(button, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, data->hotkey, 3, MUIM_Set, MUIA_HotkeyString_Snoop, MUIV_TriggerValue);
790 // DoMethod(data->hotkey, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime, button, 3, MUIM_Set, MUIA_Selected, FALSE);
792 DoMethod(plist, MUIM_Notify, MUIA_Listview_DoubleClick, TRUE, data->keyfunctions, 2, MUIM_Popstring_Close, TRUE);
794 DoMethod(defaultkeys, MUIM_Notify,
795 MUIA_Pressed, FALSE,
796 MUIV_Notify_Self, 3, MUIM_CallHook, &SetDefaultKeysHook, keylist);
798 DoMethod(data->insertkey, MUIM_Notify,
799 MUIA_Pressed, FALSE,
800 MUIV_Notify_Self, 3, MUIM_CallHook, &InsertHook, keylist);
802 DoMethod(keylist, MUIM_Notify,
803 MUIA_List_Active, MUIV_EveryTime,
804 MUIV_Notify_Self, 8, MUIM_MultiSet, MUIA_Disabled, FALSE,
805 data->hotkey, button, data->keyfunctions, data->deletekey, NULL);
806 DoMethod(keylist, MUIM_Notify,
807 MUIA_List_Active, MUIV_List_Active_Off,
808 MUIV_Notify_Self, 8, MUIM_MultiSet, MUIA_Disabled, TRUE,
809 data->hotkey, button, data->keyfunctions, data->deletekey, NULL);
811 DoMethod(keylist, MUIM_Notify,
812 MUIA_List_Active, MUIV_EveryTime,
813 MUIV_Notify_Self, 4, MUIM_CallHook, &SelectHook, data, keylist);
815 DoMethod(functionname, MUIM_Notify,
816 MUIA_UserData, MUIV_EveryTime,
817 MUIV_Notify_Self, 4, MUIM_CallHook, &UpdateHook, data, keylist);
819 DoMethod(data->hotkey, MUIM_Notify,
820 MUIA_String_Acknowledge, MUIV_EveryTime,
821 MUIV_Notify_Self, 4, MUIM_CallHook, &UpdateHook, data, keylist);
823 DoMethod(data->deletekey, MUIM_Notify,
824 MUIA_Pressed, FALSE,
825 keylist, 2, MUIM_List_Remove, MUIV_List_Remove_Active);
828 DoMethod(data->hotkey, MUIM_MultiSet,
829 MUIA_Disabled, TRUE,
830 data->hotkey, button, data->keyfunctions, data->deletekey, NULL);
832 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,1), MUIM_Notify,
833 MUIA_Menuitem_Trigger, MUIV_EveryTime,
834 editor, 2, MUIM_TextEditor_ARexxCmd, "Cut");
835 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,2), MUIM_Notify,
836 MUIA_Menuitem_Trigger, MUIV_EveryTime,
837 editor, 2, MUIM_TextEditor_ARexxCmd, "Copy");
838 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,3), MUIM_Notify,
839 MUIA_Menuitem_Trigger, MUIV_EveryTime,
840 editor, 2, MUIM_TextEditor_ARexxCmd, "Paste");
841 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,4), MUIM_Notify,
842 MUIA_Menuitem_Trigger, MUIV_EveryTime,
843 editor, 2, MUIM_TextEditor_ARexxCmd, "Erase");
844 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,5), MUIM_Notify,
845 MUIA_Menuitem_Trigger, MUIV_EveryTime,
846 editor, 2, MUIM_TextEditor_ARexxCmd, "Undo");
847 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,6), MUIM_Notify,
848 MUIA_Menuitem_Trigger, MUIV_EveryTime,
849 editor, 2, MUIM_TextEditor_ARexxCmd, "Redo");
851 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,7), MUIM_Notify,
852 MUIA_Menuitem_Checked, MUIV_EveryTime,
853 editor, 3, MUIM_Set, MUIA_TextEditor_StyleBold, MUIV_TriggerValue);
854 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,8), MUIM_Notify,
855 MUIA_Menuitem_Checked, MUIV_EveryTime,
856 editor, 3, MUIM_Set, MUIA_TextEditor_StyleItalic, MUIV_TriggerValue);
857 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,9), MUIM_Notify,
858 MUIA_Menuitem_Checked, MUIV_EveryTime,
859 editor, 3, MUIM_Set, MUIA_TextEditor_StyleUnderline, MUIV_TriggerValue);
861 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,10), MUIM_Notify,
862 MUIA_Menuitem_Checked, TRUE,
863 editor, 3, MUIM_Set, MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Left);
864 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,11), MUIM_Notify,
865 MUIA_Menuitem_Checked, TRUE,
866 editor, 3, MUIM_Set, MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Center);
867 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,12), MUIM_Notify,
868 MUIA_Menuitem_Checked, TRUE,
869 editor, 3, MUIM_Set, MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Right);
871 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,13), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 0);
872 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,14), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 1);
873 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,15), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 2);
874 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,16), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 3);
875 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,17), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 4);
876 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,18), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 5);
877 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,19), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 6);
878 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,20), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 7);
879 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,21), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 8);
881 DoMethod(editor, MUIM_Notify,
882 MUIA_TextEditor_StyleBold, MUIV_EveryTime,
883 (Object *)DoMethod(data->editpopup,MUIM_FindUData,7), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
884 DoMethod(editor, MUIM_Notify,
885 MUIA_TextEditor_StyleItalic, MUIV_EveryTime,
886 (Object *)DoMethod(data->editpopup,MUIM_FindUData,8), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
887 DoMethod(editor, MUIM_Notify,
888 MUIA_TextEditor_StyleUnderline, MUIV_EveryTime,
889 (Object *)DoMethod(data->editpopup,MUIM_FindUData,9), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
891 DoMethod(editor, MUIM_Notify,
892 MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Left,
893 (Object *)DoMethod(data->editpopup,MUIM_FindUData,10), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
894 DoMethod(editor, MUIM_Notify,
895 MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Center,
896 (Object *)DoMethod(data->editpopup,MUIM_FindUData,11), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
897 DoMethod(editor, MUIM_Notify,
898 MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Right,
899 (Object *)DoMethod(data->editpopup,MUIM_FindUData,12), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
901 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 0, (Object *)DoMethod(data->editpopup,MUIM_FindUData,13), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
902 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 1, (Object *)DoMethod(data->editpopup,MUIM_FindUData,14), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
903 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 2, (Object *)DoMethod(data->editpopup,MUIM_FindUData,15), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
904 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 3, (Object *)DoMethod(data->editpopup,MUIM_FindUData,16), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
905 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 4, (Object *)DoMethod(data->editpopup,MUIM_FindUData,17), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
906 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 5, (Object *)DoMethod(data->editpopup,MUIM_FindUData,18), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
907 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 6, (Object *)DoMethod(data->editpopup,MUIM_FindUData,19), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
908 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 7, (Object *)DoMethod(data->editpopup,MUIM_FindUData,20), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
909 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 8, (Object *)DoMethod(data->editpopup,MUIM_FindUData,21), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
911 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_AreaMarked, MUIV_EveryTime, MUIV_Notify_Self, 7, MUIM_MultiSet, MUIA_Menuitem_Enabled, MUIV_TriggerValue, (Object *)DoMethod(data->editpopup,MUIM_FindUData,1), (Object *)DoMethod(data->editpopup,MUIM_FindUData,2), (Object *)DoMethod(data->editpopup,MUIM_FindUData,4), NULL);
913 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_UndoAvailable, MUIV_EveryTime, (Object *)DoMethod(data->editpopup,MUIM_FindUData, 5), 3, MUIM_Set, MUIA_Menuitem_Enabled, MUIV_TriggerValue);
914 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_RedoAvailable, MUIV_EveryTime, (Object *)DoMethod(data->editpopup,MUIM_FindUData, 6), 3, MUIM_Set, MUIA_Menuitem_Enabled, MUIV_TriggerValue);
917 RETURN(group);
918 return(group);