added concrete implementations of putc(), getc(), getchar() and gets()
[tangerine.git] / workbench / classes / gadgets / texteditor / mcp / CreatePrefsGroup.c
blob192a9f427c943ee5f427188f20c7f9022e47a523
1 /***************************************************************************
3 TextEditor.mcc - Textediting MUI Custom Class
4 Copyright (C) 1997-2000 Allan Odgaard
5 Copyright (C) 2005 by 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>
26 #include <libraries/asl.h>
27 #include <libraries/gadtools.h>
28 #include <libraries/mui.h>
29 #include <mui/BetterString_mcc.h>
30 #include <mui/HotkeyString_mcc.h>
31 #include <proto/exec.h>
32 #include <proto/intuition.h>
33 #include <proto/muimaster.h>
35 #include "private.h"
36 #include "locale.h"
37 #ifndef __AROS__
38 #include "muiextra.h"
39 #endif
40 #include "TextEditor_mcc.h"
41 #include "rev.h"
43 #include "SDI_hook.h"
45 #ifdef __AROS__
46 AROS_HOOKPROTONH(ListDisplayFunc, void, char **, array, struct te_key *, entry)
47 #else
48 HOOKPROTONH(ListDisplayFunc, void, char **array, struct te_key *entry)
49 #endif
51 HOOK_INIT
53 static char buffer[118];
54 struct KeyAction ka;
56 ENTER();
58 if(entry)
60 ka.key = entry->code;
62 if(ka.key >= 500)
64 ka.vanilla = TRUE;
65 ka.key -= 500;
67 else
68 ka.vanilla = FALSE;
70 ka.qualifier = entry->qual;
71 KeyToString(buffer, &ka);
73 *array++ = buffer;
74 *array++ = "=";
75 *array = FunctionName(entry->act);
77 else
79 *array++ = GetStr(MSG_LVLabel_Key);
80 *array++ = "";
81 *array = GetStr(MSG_LVLabel_Action);
84 LEAVE();
86 HOOK_EXIT
88 MakeStaticHook(ListDisplayHook, ListDisplayFunc);
90 #ifdef __AROS__
91 AROS_HOOKPROTONH(ListConstructFunc, APTR, APTR, pool, struct te_key *, entry)
92 #else
93 HOOKPROTONH(ListConstructFunc, APTR, APTR pool, struct te_key *entry)
94 #endif
96 HOOK_INIT
98 struct te_key *newplace;
99 ENTER();
101 newplace = AllocPooled(pool, sizeof(struct te_key));
102 if(newplace)
104 CopyMem(entry, newplace, sizeof(struct te_key));
107 RETURN(newplace);
108 return(newplace);
110 HOOK_EXIT
112 MakeStaticHook(ListConstructHook, ListConstructFunc);
114 #ifdef __AROS__
115 AROS_HOOKPROTONH(ListDestructFunc, void, APTR, pool, struct te_key *, entry)
116 #else
117 HOOKPROTONH(ListDestructFunc, void, APTR pool, struct te_key *entry)
118 #endif
120 HOOK_INIT
122 ENTER();
123 FreePooled(pool, entry, sizeof(struct te_key));
124 LEAVE();
126 HOOK_EXIT
128 MakeStaticHook(ListDestructHook, ListDestructFunc);
130 #ifdef __AROS__
131 AROS_HOOKPROTONH(Popstring_WindowCode, void, Object *, pop, Object *, win)
132 #else
133 HOOKPROTONH(Popstring_WindowCode, void, Object *pop, Object *win)
134 #endif
136 HOOK_INIT
138 ENTER();
139 set(win, MUIA_Window_DefaultObject, pop);
140 LEAVE();
142 HOOK_EXIT
144 MakeStaticHook(Popstring_WindowHook, Popstring_WindowCode);
146 #ifdef __AROS__
147 AROS_HOOKPROTONH(Popstring_OpenCode, BOOL, Object *, pop, Object *, text)
148 #else
149 HOOKPROTONH(Popstring_OpenCode, BOOL, Object *pop, Object *text)
150 #endif
152 HOOK_INIT
154 LONG active;
155 ENTER();
157 get(text, MUIA_UserData, &active);
158 set(pop, MUIA_List_Active, active);
160 RETURN(TRUE);
161 return(TRUE);
163 HOOK_EXIT
165 MakeStaticHook(Popstring_OpenHook, Popstring_OpenCode);
167 #ifdef __AROS__
168 AROS_HOOKPROTONH(Popstring_CloseCode, void, Object *, pop, Object *, text)
169 #else
170 HOOKPROTONH(Popstring_CloseCode, void, Object *pop, Object *text)
171 #endif
173 HOOK_INIT
175 LONG active;
176 ENTER();
178 get(pop, MUIA_List_Active, &active);
179 set(text, MUIA_UserData, active);
181 LEAVE();
183 HOOK_EXIT
185 MakeStaticHook(Popstring_CloseHook, Popstring_CloseCode);
187 #ifdef __AROS__
188 AROS_HOOKPROTONHNO(InsertCode, void, APTR **, array)
189 #else
190 HOOKPROTONHNO(InsertCode, void, APTR **array)
191 #endif
193 HOOK_INIT
195 static const struct te_key constentry = {76, 0, 0};
196 Object *keylist = (Object *)*array++;
197 ULONG entry;
199 ENTER();
201 get(keylist, MUIA_List_Active, &entry);
203 if((LONG)entry != MUIV_List_Active_Off)
204 nnset(keylist, MUIA_List_Active, MUIV_List_Active_Off);
205 else
206 entry = 0;
208 DoMethod(keylist, MUIM_List_InsertSingle, &constentry, entry);
209 set(keylist, MUIA_List_Active, entry);
211 LEAVE();
213 HOOK_EXIT
215 MakeStaticHook(InsertHook, InsertCode);
217 #ifdef __AROS__
218 AROS_HOOKPROTONHNO(SelectCode, void, APTR **, array)
219 #else
220 HOOKPROTONHNO(SelectCode, void, APTR **array)
221 #endif
223 HOOK_INIT
225 struct InstData_MCP *data = (struct InstData_MCP *)*array++;
226 Object *keylist = (Object *)*array++;
227 struct te_key *entry;
229 ENTER();
231 DoMethod(keylist, MUIM_List_GetEntry, MUIV_List_GetEntry_Active, &entry);
233 if(entry)
235 char buffer[100];
236 struct KeyAction ka;
237 ULONG result;
239 get(data->keyfunctions, MUIA_Popstring_String, &result);
240 nnset((Object *)result, MUIA_UserData, entry->act);
242 ka.key = entry->code;
244 if(ka.key >= 500)
246 ka.vanilla = TRUE;
247 ka.key -= 500;
249 else
250 ka.vanilla = FALSE;
252 ka.qualifier = entry->qual;
253 KeyToString(buffer, &ka);
254 nnset(data->hotkey, MUIA_String_Contents, buffer);
257 LEAVE();
259 HOOK_EXIT
261 MakeStaticHook(SelectHook, SelectCode);
263 #ifdef __AROS__
264 AROS_HOOKPROTONHNO(UpdateCode, void, APTR **, array)
265 #else
266 HOOKPROTONHNO(UpdateCode, void, APTR **array)
267 #endif
269 HOOK_INIT
271 struct InstData_MCP *data = (struct InstData_MCP *)*array++;
272 Object *keylist = (Object *)*array++;
273 struct te_key entry;
274 ULONG result;
275 ULONG active;
277 ENTER();
279 get(keylist, MUIA_List_Active, &active);
281 if((LONG)active != MUIV_List_Active_Off)
283 SetAttrs(keylist, MUIA_List_Quiet, TRUE,
284 MUIA_List_Active, MUIV_List_Active_Off,
285 MUIA_NoNotify, TRUE,
286 TAG_DONE);
287 DoMethod(keylist, MUIM_List_Remove, active);
289 get(data->keyfunctions, MUIA_Popstring_String, &result);
290 get((Object *)result, MUIA_UserData, &result);
292 entry.act = result;
294 get(data->hotkey, MUIA_String_Contents, &result);
296 if(result)
298 struct KeyAction keyaction;
300 ConvertKeyString((STRPTR)result, entry.act, &keyaction);
301 entry.code = keyaction.key;
302 if(keyaction.vanilla)
304 entry.code += 500;
306 entry.qual = keyaction.qualifier;
309 DoMethod(keylist, MUIM_List_InsertSingle, &entry, active);
310 SetAttrs(keylist, MUIA_List_Active, active,
311 MUIA_List_Quiet, FALSE,
312 MUIA_NoNotify, TRUE,
313 TAG_DONE);
316 LEAVE();
318 HOOK_EXIT
320 MakeStaticHook(UpdateHook, UpdateCode);
322 static APTR TxtLabel (STRPTR text, ULONG weight)
324 /* APTR result = TextEditorObject,
325 MUIA_Background, MUII_GroupBack,
326 MUIA_TextEditor_ReadOnly, TRUE,
327 MUIA_TextEditor_Contents, text,
328 MUIA_Weight, weight,
329 End;
331 APTR result = TextObject,
332 MUIA_FramePhantomHoriz, TRUE,
333 MUIA_Frame, MUIV_Frame_ImageButton,
334 MUIA_Text_PreParse, "\33r",
335 MUIA_Text_SetVMax, FALSE,
336 MUIA_Text_Contents, text,
337 MUIA_Weight, weight,
338 End;
340 // APTR result = MUI_MakeObject(MUIO_Label, text, 0);
342 return(result);
345 Object *CreatePrefsGroup(struct InstData_MCP *data)
347 Object *slider, *slider2, *readview, *button, *group,
348 *editor, *keylist, *defaultkeys, *functionname,
349 *plist, *popbutton;
351 struct NewMenu *nm, editpopupdata[] =
353 { NM_TITLE, MSG_MenuTitle_Edit, 0, 0, 0, (APTR)0 },
354 { NM_ITEM, MSG_MenuItem_Cut, NULL, NM_COMMANDSTRING, 0, (APTR)1 },
355 { NM_ITEM, MSG_MenuItem_Copy, NULL, NM_COMMANDSTRING, 0, (APTR)2 },
356 { NM_ITEM, MSG_MenuItem_Paste, NULL, NM_COMMANDSTRING, 0, (APTR)3 },
357 { NM_ITEM, MSG_MenuItem_Delete, NULL, NM_COMMANDSTRING, 0, (APTR)4 },
358 { NM_ITEM, NM_BARLABEL, 0, 0, 0, (APTR)0 },
359 { NM_ITEM, MSG_MenuItem_Undo, NULL, NM_COMMANDSTRING, 0, (APTR)5 },
360 { NM_ITEM, MSG_MenuItem_Redo, NULL, NM_COMMANDSTRING, 0, (APTR)6 },
361 { NM_ITEM, NM_BARLABEL, 0, 0, 0, (APTR)0 },
362 { NM_ITEM, MSG_MenuItem_Bold, NULL, NM_COMMANDSTRING | CHECKIT|MENUTOGGLE, 0, (APTR)7 },
363 { NM_ITEM, MSG_MenuItem_Italic, NULL, NM_COMMANDSTRING | CHECKIT|MENUTOGGLE, 0, (APTR)8 },
364 { NM_ITEM, MSG_MenuItem_Underline, NULL, NM_COMMANDSTRING | CHECKIT|MENUTOGGLE, 0, (APTR)9 },
365 { NM_ITEM, NM_BARLABEL, 0, 0, 0, (APTR)0 },
366 { NM_ITEM, MSG_MenuSubTitle_Alignment, 0, 0, 0, (APTR)0 },
367 { NM_SUB, MSG_MenuItem_Left, NULL, NM_COMMANDSTRING | CHECKIT|CHECKED, ~1, (APTR)10 },
368 { NM_SUB, MSG_MenuItem_Center, NULL, NM_COMMANDSTRING | CHECKIT, ~2, (APTR)11 },
369 { NM_SUB, MSG_MenuItem_Right, NULL, NM_COMMANDSTRING | CHECKIT, ~4, (APTR)12 },
371 { NM_ITEM, MSG_MenuSubTitle_Color, 0, 0, 0, (APTR)0 },
372 { NM_SUB, MSG_MenuItem_Normal, NULL, NM_COMMANDSTRING | CHECKIT|CHECKED, ~1, (APTR)13 },
373 { NM_SUB, MSG_MenuItem_Shine, NULL, NM_COMMANDSTRING | CHECKIT, ~2, (APTR)14 },
374 { NM_SUB, MSG_MenuItem_Halfshine, NULL, NM_COMMANDSTRING | CHECKIT, ~4, (APTR)15 },
375 { NM_SUB, MSG_MenuItem_Background, NULL, NM_COMMANDSTRING | CHECKIT, ~8, (APTR)16 },
376 { NM_SUB, MSG_MenuItem_Halfshadow, NULL, NM_COMMANDSTRING | CHECKIT, ~16, (APTR)17 },
377 { NM_SUB, MSG_MenuItem_Shadow, NULL, NM_COMMANDSTRING | CHECKIT, ~32, (APTR)18 },
378 { NM_SUB, MSG_MenuItem_Text, NULL, NM_COMMANDSTRING | CHECKIT, ~64, (APTR)19 },
379 { NM_SUB, MSG_MenuItem_Fill, NULL, NM_COMMANDSTRING | CHECKIT, ~128, (APTR)20 },
380 { NM_SUB, MSG_MenuItem_Mark, NULL, NM_COMMANDSTRING | CHECKIT, ~256, (APTR)21 },
382 { NM_END, NULL, 0, 0, 0, (APTR)0 }
385 ENTER();
387 nm = editpopupdata;
388 do {
389 if (nm->nm_Label != NM_BARLABEL)
390 nm->nm_Label = GetStr(nm->nm_Label);
391 } while (++nm,nm->nm_Type != NM_END);
393 data->editpopup = MUI_MakeObject(MUIO_MenustripNM, editpopupdata, NULL);
395 group = VGroup,
396 Child, RegisterGroup(data->gTitles),
397 MUIA_CycleChain, TRUE,
398 MUIA_Background, MUII_RegisterBack,
399 Child, HGroup,
400 Child, VGroup,
401 Child, VGroup,
402 MUIA_VertWeight, 0,
403 MUIA_Background, MUII_GroupBack,
404 MUIA_Frame, MUIV_Frame_Group,
405 MUIA_FrameTitle, GetStr(MSG_GroupTitle_Control),
406 Child, RectangleObject,
407 End,
408 Child, ColGroup(2),
409 Child, TxtLabel(GetStr(MSG_Label_UndoLevel), 0),
410 Child, data->undosize = SliderObject,
411 MUIA_ShortHelp, GetStr(HelpBubble_UndoLevel),
412 MUIA_Numeric_Min, 20,
413 MUIA_Numeric_Max, 2000,
414 MUIA_Numeric_Format, "%ld (± 5)",
415 End,
416 Child, TxtLabel(GetStr(MSG_Label_TabSize), 0),
417 Child, data->tabsize = SliderObject,
418 MUIA_Numeric_Min, 2,
419 MUIA_Numeric_Max, 12,
420 MUIA_Numeric_Format, GetStr(MSG_SliderText_TabSize),
421 End,
422 Child, TxtLabel(GetStr(MSG_Label_Smooth), 0),
423 Child, HGroup,
424 MUIA_ShortHelp, GetStr(HelpBubble_Smooth),
425 Child, data->smooth = MUI_MakeObject(MUIO_Checkmark, NULL),
426 Child, RectangleObject,
427 End,
428 End,
429 End,
430 Child, RectangleObject,
431 End,
432 End,
434 Child, ColGroup(4),
435 // MUIA_VertWeight, 0,
436 MUIA_Group_SameHeight, FALSE,
437 MUIA_Background, MUII_GroupBack,
438 MUIA_Frame, MUIV_Frame_Group,
439 MUIA_FrameTitle, GetStr(MSG_GroupTitle_Design),
441 Child, TxtLabel(GetStr(MSG_Label_Frame), 0),
442 Child, data->frame = MUI_NewObject("Popframe.mui",
443 MUIA_Window_Title, GetStr(MSG_PopWinTitle_Frame),
444 End,
445 Child, TxtLabel(GetStr(MSG_Label_Background), 0),
446 Child, data->background = MUI_NewObject("Popimage.mui",
447 MUIA_Window_Title, GetStr(MSG_PopWinTitle_Background),
448 MUIA_Imageadjust_Type, 2,
449 End,
450 Child, TxtLabel(GetStr(MSG_Label_Text), 0),
451 Child, data->textcolor = PoppenObject,
452 MUIA_Window_Title, GetStr(MSG_PopWinTitle_Text),
453 End,
454 Child, TxtLabel(GetStr(MSG_Label_Highlight), 0),
455 Child, data->highlightcolor = PoppenObject,
456 MUIA_Window_Title, GetStr(MSG_PopWinTitle_Highlight),
457 End,
458 End,
460 Child, HGroup,
461 MUIA_VertWeight, 60,
462 MUIA_Background, MUII_GroupBack,
463 MUIA_Frame, MUIV_Frame_Group,
464 MUIA_FrameTitle, GetStr(MSG_GroupTitle_Separator),
465 Child, TxtLabel(GetStr(MSG_Label_SeparatorShine), 0),
466 Child, data->separatorshine = PoppenObject,
467 MUIA_Window_Title, GetStr(MSG_PopWinTitle_SeparatorShine),
468 End,
469 Child, TxtLabel(GetStr(MSG_Label_SeparatorShadow), 0),
470 Child, data->separatorshadow = PoppenObject,
471 MUIA_Window_Title, GetStr(MSG_PopWinTitle_SeparatorShadow),
472 End,
473 End,
474 End,
476 Child, VGroup,
477 Child, VGroup,
478 // MUIA_VertWeight, 0,
479 MUIA_Background, MUII_GroupBack,
480 MUIA_Frame, MUIV_Frame_Group,
481 MUIA_FrameTitle, GetStr(MSG_GroupTitle_Fonts),
482 Child, RectangleObject,
483 End,
484 Child, ColGroup(2),
485 Child, TxtLabel(GetStr(MSG_Label_Normal), 0),
486 Child, PopaslObject,
487 MUIA_Popstring_String, data->normalfont = BetterStringObject, StringFrame, End,
488 MUIA_Popstring_Button, MUI_MakeObject(MUIO_PopButton, MUII_PopUp),
489 MUIA_Popasl_Type, ASL_FontRequest,
490 End,
491 Child, TxtLabel(GetStr(MSG_Label_Fixed), 0),
492 Child, PopaslObject,
493 MUIA_Popstring_String, data->fixedfont = BetterStringObject, StringFrame, End,
494 MUIA_Popstring_Button, MUI_MakeObject(MUIO_PopButton, MUII_PopUp),
495 MUIA_Popasl_Type, ASL_FontRequest,
496 ASLFO_Flags, FOF_FIXEDWIDTHONLY,
497 End,
498 End,
499 Child, RectangleObject,
500 End,
501 End,
503 Child, VGroup,
504 // MUIA_VertWeight, 0,
505 MUIA_Background, MUII_GroupBack,
506 MUIA_Frame, MUIV_Frame_Group,
507 MUIA_FrameTitle, GetStr(MSG_GroupTitle_Cursor),
508 MUIA_Group_Columns, 2,
509 Child, TxtLabel(GetStr(MSG_Label_Cursor), 0),
510 Child, data->cursorcolor = PoppenObject,
511 MUIA_Window_Title, GetStr(MSG_PopWinTitle_Cursor),
512 End,
513 Child, TxtLabel(GetStr(MSG_Label_Selected), 0),
514 Child, data->markedcolor = PoppenObject,
515 MUIA_Window_Title, GetStr(MSG_PopWinTitle_Selected),
516 End,
517 Child, TxtLabel(GetStr(MSG_Label_Width), 0),
518 Child, data->cursorwidth = NewObject(widthslider_mcc->mcc_Class, NULL,
519 MUIA_Numeric_Min, 1,
520 MUIA_Numeric_Max, 6,
521 MUIA_Numeric_Format, GetStr(MSG_SliderText_StdWidth),
522 TAG_DONE),
523 Child, TxtLabel(GetStr(MSG_Label_BlinkSpeed), 0),
524 Child, data->blinkspeed = NewObject(speedslider_mcc->mcc_Class, NULL,
525 MUIA_Numeric_Min, 0,
526 MUIA_Numeric_Max, 20,
527 MUIA_Numeric_Format, GetStr(MSG_SliderText_StdSpeed),
528 TAG_DONE),
529 End,
531 End,
533 End,
535 Child, VGroup,
536 Child, HGroup,
537 Child, defaultkeys = SimpleButton(GetStr(MSG_Button_DefaultKeys)),
538 Child, TxtLabel(GetStr(MSG_Label_BlkQual), 1000),
539 Child, data->blockqual = MUI_MakeObject(MUIO_Cycle, NULL, data->cycleentries),
540 End,
541 Child, data->keybindings = ListviewObject,
542 MUIA_CycleChain, TRUE,
543 MUIA_Listview_DragType, MUIV_Listview_DragType_Immediate,
544 MUIA_Listview_List, keylist = ListObject,
545 MUIA_Frame, MUIV_Frame_InputList,
546 MUIA_Background, MUII_ListBack,
547 MUIA_List_Title, TRUE,
548 MUIA_List_ConstructHook, &ListConstructHook,
549 MUIA_List_DestructHook, &ListDestructHook,
550 MUIA_List_DisplayHook, &ListDisplayHook,
551 MUIA_List_DragSortable, TRUE,
552 MUIA_List_Format, "P=\33r W=100 0, P=\33c 1, 2",
553 // MUIA_List_Format, "P=\33r W=100 0, P=\33c NoTB NoBar 1, 2",
554 // MUIA_List_SourceArray, keybindings,
555 // MUIA_List_TitleClick, TRUE,
556 // MUIA_List_DragType, MUIV_List_DragType_Default,
557 End,
558 End,
559 Child, VGroup,
560 Child, HGroup,
561 Child, data->hotkey = HotkeyStringObject,
562 MUIA_CycleChain, TRUE,
563 MUIA_Frame, MUIV_Frame_String,
564 MUIA_HotkeyString_Snoop, FALSE,
565 MUIA_Weight, 500,
566 End,
567 Child, button = TextObject, ButtonFrame,
568 MUIA_CycleChain, TRUE,
569 MUIA_Background, MUII_ButtonBack,
570 MUIA_Text_Contents, GetStr(MSG_Button_Snoop),
571 MUIA_Text_SetMax, TRUE,
572 MUIA_InputMode, MUIV_InputMode_Toggle,
573 End,
575 Child, BalanceObject, End,
577 Child, MUI_MakeObject(MUIO_Label, "=", MUIO_Label_Centered),
578 // Child, MUI_MakeObject(MUIO_Cycle, NULL, data->functions),
579 Child, data->keyfunctions = PopobjectObject,
580 MUIA_Weight, 400,
581 MUIA_Popstring_String, functionname = NewObject(text_mcc->mcc_Class, NULL, TextFrame, MUIA_Background, MUII_TextBack, TAG_DONE),
582 MUIA_Popstring_Button, popbutton = MUI_MakeObject(MUIO_PopButton, MUII_PopUp),
583 MUIA_Popobject_StrObjHook, &Popstring_OpenHook,
584 MUIA_Popobject_ObjStrHook, &Popstring_CloseHook,
585 MUIA_Popobject_WindowHook, &Popstring_WindowHook,
587 MUIA_Popobject_Object, plist = ListviewObject,
588 MUIA_CycleChain, TRUE,
589 MUIA_Listview_List, ListObject,
590 InputListFrame,
591 MUIA_List_AutoVisible, TRUE,
592 MUIA_List_SourceArray, data->functions,
593 End,
594 End,
596 // MUIA_Poplist_Array, data->functions,
597 End,
599 End,
600 Child, HGroup,
601 Child, data->insertkey = SimpleButton(GetStr(MSG_Button_Insert)),
602 Child, data->deletekey = SimpleButton(GetStr(MSG_Button_Delete)),
603 End,
604 End,
605 End,
607 Child, VGroup,
609 Child, HGroup,
610 GroupSpacing(0),
611 Child, readview = TextEditorObject,
612 ReadListFrame,
613 MUIA_CycleChain, TRUE,
614 MUIA_TextEditor_ReadOnly, TRUE,
615 MUIA_TextEditor_Contents, GetStr(MSG_HelpTxt_SpellChecker),
616 End,
617 Child, slider2 = ScrollbarObject,
618 End,
619 End,
621 Child, BalanceObject, End,
623 Child, ColGroup(3),
624 Child, TxtLabel(GetStr(MSG_Label_LookupCmd), 0),
625 Child, data->LookupExeType = CycleObject,
626 MUIA_Cycle_Entries, data->execution,
627 MUIA_Weight, 0,
628 End,
629 Child, data->lookupcmd = BetterStringObject, StringFrame, End,
630 Child, TxtLabel(GetStr(MSG_Label_SuggestCmd), 0),
631 Child, data->SuggestExeType = CycleObject,
632 MUIA_Cycle_Entries, data->execution,
633 MUIA_Weight, 0,
634 End,
635 Child, data->suggestcmd = BetterStringObject, StringFrame, MUIA_String_AdvanceOnCR, TRUE, End,
636 End,
637 Child, ColGroup(2),
638 Child, TxtLabel(GetStr(MSG_Label_SpellNType), 1000),
639 Child, data->typenspell = MUI_MakeObject(MUIO_Checkmark, NULL),
640 Child, TxtLabel(GetStr(MSG_Label_LookupWords), 1000),
641 Child, data->CheckWord = MUI_MakeObject(MUIO_Checkmark, NULL),
642 MUIA_Weight, 0,
643 End,
645 Child, RectangleObject,
646 MUIA_Weight, 25,
647 End,
649 End,
651 Child, HGroup,
652 GroupSpacing(0),
653 Child, editor = TextEditorObject,
654 MUIA_CycleChain, TRUE,
655 MUIA_ContextMenu, data->editpopup,
656 MUIA_TextEditor_Contents,
657 "\033r\033b" LIB_DATE "\033n\n"
658 "\n\33cTextEditor.mcp " LIB_REV_STRING CPU " (" LIB_DATE ")\n"
659 "Copyright (C) 1997-2000 Allan Odgaard\n"
660 LIB_COPYRIGHT
661 "\n\033[s:9]\n"
662 "For the latest version, try: \33u\33p[7]http://www.sourceforge.net/projects/texteditor-mcc/\33p[0]\33n\n"
663 "\n"
664 "This gadget is \33ifree software\33n. You can redistribute it and/or modify it under the terms of "
665 "the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 "
666 "of the License, or (at your option) any later version.\n"
667 "\n"
668 "\33[s:2]\33c\33u\33b Usage: \33n\n"
669 "\33l\n"
670 "Besides the many keys you can configure on the \33iKeybindings\33n page, there is also the following you should know:\n"
671 "\n"
672 "- You can double-click a word to select it. If you hold LMB after a double-click, then it will only mark \33bcomplete\33n words. Triple-clicking has the same effect, but for entire lines.\n"
673 "\n"
674 "- 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"
675 "\n"
676 "- While you drag to scroll, the farther away from the gadget your mouse pointer is, the faster the contents will scroll.\n"
677 "\n"
678 "\33[s:2]\33c\33u\33b ARexx: \33n\n"
679 "\33l\n"
680 "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"
681 "\n"
682 "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"
683 "\n"
684 "Please refer to the TextEditor.mcc documentation for an explanation on how to use these commands.\n"
685 "\n\33[s:10]\n\33cThis instance has a context sensitive menu, from where you can play with text styles, colors, alignments etc.",
686 End,
687 Child, slider = ScrollbarObject,
688 End,
689 End,
690 End,
691 End;
693 if(group)
695 set(readview, MUIA_TextEditor_Slider, slider2);
696 set(editor, MUIA_TextEditor_Slider, slider);
698 set(data->blockqual, MUIA_ShortHelp, GetStr(HelpBubble_BlockQual));
699 set(data->typenspell, MUIA_ShortHelp, GetStr(HelpBubble_TypeNSpell));
700 set(data->CheckWord, MUIA_ShortHelp, GetStr(HelpBubble_CheckWord));
702 set(data->hotkey, MUIA_String_AttachedList, data->keybindings);
703 set(popbutton, MUIA_CycleChain, TRUE);
705 DoMethod(data->lookupcmd, MUIM_Notify, MUIA_String_Acknowledge, MUIV_EveryTime, MUIV_Notify_Window, 3, MUIM_Set, MUIA_Window_ActiveObject, data->suggestcmd);
707 DoMethod(button, MUIM_Notify, MUIA_Selected, TRUE, MUIV_Notify_Window, 3, MUIM_Set, MUIA_Window_ActiveObject, data->hotkey);
708 // DoMethod(button, MUIM_Notify, MUIA_Selected, FALSE, data->hotkey, 3, MUIM_Set, MUIA_String_Acknowledge, TRUE);
709 DoMethod(button, MUIM_Notify, MUIA_Selected, MUIV_EveryTime, data->hotkey, 3, MUIM_Set, MUIA_HotkeyString_Snoop, MUIV_TriggerValue);
710 DoMethod(data->hotkey, MUIM_Notify, MUIA_String_Contents, MUIV_EveryTime, button, 3, MUIM_Set, MUIA_Selected, FALSE);
712 DoMethod(plist, MUIM_Notify, MUIA_Listview_DoubleClick, TRUE, data->keyfunctions, 2, MUIM_Popstring_Close, TRUE);
714 DoMethod(defaultkeys, MUIM_Notify,
715 MUIA_Pressed, FALSE,
716 keylist, 1, MUIM_List_Clear);
717 DoMethod(defaultkeys, MUIM_Notify,
718 MUIA_Pressed, FALSE,
719 keylist, 4, MUIM_List_Insert, keybindings, -1, MUIV_List_Insert_Bottom);
721 DoMethod(data->insertkey, MUIM_Notify,
722 MUIA_Pressed, FALSE,
723 MUIV_Notify_Self, 3, MUIM_CallHook, &InsertHook, keylist);
725 DoMethod(keylist, MUIM_Notify,
726 MUIA_List_Active, MUIV_EveryTime,
727 MUIV_Notify_Self, 8, MUIM_MultiSet, MUIA_Disabled, FALSE,
728 data->hotkey, button, data->keyfunctions, data->deletekey, NULL);
729 DoMethod(keylist, MUIM_Notify,
730 MUIA_List_Active, MUIV_List_Active_Off,
731 MUIV_Notify_Self, 8, MUIM_MultiSet, MUIA_Disabled, TRUE,
732 data->hotkey, button, data->keyfunctions, data->deletekey, NULL);
734 DoMethod(keylist, MUIM_Notify,
735 MUIA_List_Active, MUIV_EveryTime,
736 MUIV_Notify_Self, 4, MUIM_CallHook, &SelectHook, data, keylist);
738 DoMethod(functionname, MUIM_Notify,
739 MUIA_UserData, MUIV_EveryTime,
740 MUIV_Notify_Self, 4, MUIM_CallHook, &UpdateHook, data, keylist);
742 DoMethod(data->hotkey, MUIM_Notify,
743 MUIA_String_Acknowledge, MUIV_EveryTime,
744 MUIV_Notify_Self, 4, MUIM_CallHook, &UpdateHook, data, keylist);
746 DoMethod(data->deletekey, MUIM_Notify,
747 MUIA_Pressed, FALSE,
748 keylist, 2, MUIM_List_Remove, MUIV_List_Remove_Active);
751 DoMethod(data->hotkey, MUIM_MultiSet,
752 MUIA_Disabled, TRUE,
753 data->hotkey, button, data->keyfunctions, data->deletekey, NULL);
755 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,1), MUIM_Notify,
756 MUIA_Menuitem_Trigger, MUIV_EveryTime,
757 editor, 2, MUIM_TextEditor_ARexxCmd, "Cut");
758 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,2), MUIM_Notify,
759 MUIA_Menuitem_Trigger, MUIV_EveryTime,
760 editor, 2, MUIM_TextEditor_ARexxCmd, "Copy");
761 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,3), MUIM_Notify,
762 MUIA_Menuitem_Trigger, MUIV_EveryTime,
763 editor, 2, MUIM_TextEditor_ARexxCmd, "Paste");
764 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,4), MUIM_Notify,
765 MUIA_Menuitem_Trigger, MUIV_EveryTime,
766 editor, 2, MUIM_TextEditor_ARexxCmd, "Erase");
767 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,5), MUIM_Notify,
768 MUIA_Menuitem_Trigger, MUIV_EveryTime,
769 editor, 2, MUIM_TextEditor_ARexxCmd, "Undo");
770 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,6), MUIM_Notify,
771 MUIA_Menuitem_Trigger, MUIV_EveryTime,
772 editor, 2, MUIM_TextEditor_ARexxCmd, "Redo");
774 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,7), MUIM_Notify,
775 MUIA_Menuitem_Checked, MUIV_EveryTime,
776 editor, 3, MUIM_Set, MUIA_TextEditor_StyleBold, MUIV_TriggerValue);
777 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,8), MUIM_Notify,
778 MUIA_Menuitem_Checked, MUIV_EveryTime,
779 editor, 3, MUIM_Set, MUIA_TextEditor_StyleItalic, MUIV_TriggerValue);
780 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,9), MUIM_Notify,
781 MUIA_Menuitem_Checked, MUIV_EveryTime,
782 editor, 3, MUIM_Set, MUIA_TextEditor_StyleUnderline, MUIV_TriggerValue);
784 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,10), MUIM_Notify,
785 MUIA_Menuitem_Checked, TRUE,
786 editor, 3, MUIM_Set, MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Left);
787 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,11), MUIM_Notify,
788 MUIA_Menuitem_Checked, TRUE,
789 editor, 3, MUIM_Set, MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Center);
790 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,12), MUIM_Notify,
791 MUIA_Menuitem_Checked, TRUE,
792 editor, 3, MUIM_Set, MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Right);
794 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,13), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 0);
795 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,14), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 1);
796 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,15), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 2);
797 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,16), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 3);
798 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,17), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 4);
799 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,18), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 5);
800 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,19), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 6);
801 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,20), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 7);
802 DoMethod((Object *)DoMethod(data->editpopup,MUIM_FindUData,21), MUIM_Notify, MUIA_Menuitem_Checked, TRUE, editor, 3, MUIM_Set, MUIA_TextEditor_Pen, 8);
804 DoMethod(editor, MUIM_Notify,
805 MUIA_TextEditor_StyleBold, MUIV_EveryTime,
806 (Object *)DoMethod(data->editpopup,MUIM_FindUData,7), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
807 DoMethod(editor, MUIM_Notify,
808 MUIA_TextEditor_StyleItalic, MUIV_EveryTime,
809 (Object *)DoMethod(data->editpopup,MUIM_FindUData,8), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
810 DoMethod(editor, MUIM_Notify,
811 MUIA_TextEditor_StyleUnderline, MUIV_EveryTime,
812 (Object *)DoMethod(data->editpopup,MUIM_FindUData,9), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
814 DoMethod(editor, MUIM_Notify,
815 MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Left,
816 (Object *)DoMethod(data->editpopup,MUIM_FindUData,10), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
817 DoMethod(editor, MUIM_Notify,
818 MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Center,
819 (Object *)DoMethod(data->editpopup,MUIM_FindUData,11), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
820 DoMethod(editor, MUIM_Notify,
821 MUIA_TextEditor_Flow, MUIV_TextEditor_Flow_Right,
822 (Object *)DoMethod(data->editpopup,MUIM_FindUData,12), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
824 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 0, (Object *)DoMethod(data->editpopup,MUIM_FindUData,13), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
825 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 1, (Object *)DoMethod(data->editpopup,MUIM_FindUData,14), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
826 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 2, (Object *)DoMethod(data->editpopup,MUIM_FindUData,15), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
827 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 3, (Object *)DoMethod(data->editpopup,MUIM_FindUData,16), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
828 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 4, (Object *)DoMethod(data->editpopup,MUIM_FindUData,17), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
829 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 5, (Object *)DoMethod(data->editpopup,MUIM_FindUData,18), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
830 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 6, (Object *)DoMethod(data->editpopup,MUIM_FindUData,19), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
831 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 7, (Object *)DoMethod(data->editpopup,MUIM_FindUData,20), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
832 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_Pen, 8, (Object *)DoMethod(data->editpopup,MUIM_FindUData,21), 3, MUIM_Set, MUIA_Menuitem_Checked, MUIV_TriggerValue);
834 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);
836 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_UndoAvailable, MUIV_EveryTime, (Object *)DoMethod(data->editpopup,MUIM_FindUData, 5), 3, MUIM_Set, MUIA_Menuitem_Enabled, MUIV_TriggerValue);
837 DoMethod(editor, MUIM_Notify, MUIA_TextEditor_RedoAvailable, MUIV_EveryTime, (Object *)DoMethod(data->editpopup,MUIM_FindUData, 6), 3, MUIM_Set, MUIA_Menuitem_Enabled, MUIV_TriggerValue);
840 RETURN(group);
841 return(group);