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
21 ***************************************************************************/
25 #include <clib/alib_protos.h>
27 #ifndef NO_INLINE_STDARG
28 #define NO_INLINE_STDARG
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>
50 HOOKPROTONH(ListDisplayFunc
, void, char **array
, struct te_key
*entry
)
52 static char buffer
[256];
69 ka
.qualifier
= entry
->qual
;
70 KeyToString(buffer
, sizeof(buffer
), &ka
);
73 *array
++ = (STRPTR
)"=";
74 *array
= (STRPTR
)FunctionName(entry
->act
);
78 *array
++ = (STRPTR
)tr(MSG_LVLabel_Key
);
79 *array
++ = (STRPTR
)"";
80 *array
= (STRPTR
)tr(MSG_LVLabel_Action
);
85 MakeStaticHook(ListDisplayHook
, ListDisplayFunc
);
87 HOOKPROTONH(ListConstructFunc
, APTR
, APTR pool
, struct te_key
*entry
)
89 struct te_key
*newplace
;
92 newplace
= AllocPooled(pool
, sizeof(struct te_key
));
95 CopyMem(entry
, newplace
, sizeof(struct te_key
));
101 MakeStaticHook(ListConstructHook
, ListConstructFunc
);
103 HOOKPROTONH(ListDestructFunc
, void, APTR pool
, struct te_key
*entry
)
106 FreePooled(pool
, entry
, sizeof(struct te_key
));
109 MakeStaticHook(ListDestructHook
, ListDestructFunc
);
111 HOOKPROTONH(Popstring_WindowCode
, void, Object
*pop
, Object
*win
)
114 set(win
, MUIA_Window_DefaultObject
, pop
);
117 MakeStaticHook(Popstring_WindowHook
, Popstring_WindowCode
);
119 HOOKPROTONH(Popstring_OpenCode
, BOOL
, Object
*pop
, Object
*text
)
124 active
= xget(text
, MUIA_UserData
);
125 set(pop
, MUIA_List_Active
, active
);
130 MakeStaticHook(Popstring_OpenHook
, Popstring_OpenCode
);
132 HOOKPROTONH(Popstring_CloseCode
, void, Object
*pop
, Object
*text
)
137 active
= xget(pop
, MUIA_List_Active
);
138 set(text
, MUIA_UserData
, active
);
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
;
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
);
163 set(keylist
, MUIA_List_Quiet
, FALSE
);
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
++;
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
);
184 DoMethod(keylist
, MUIM_List_InsertSingle
, &constentry
, entry
);
185 set(keylist
, MUIA_List_Active
, entry
);
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
;
199 DoMethod(keylist
, MUIM_List_GetEntry
, MUIV_List_GetEntry_Active
, &entry
);
207 result
= xget(data
->keyfunctions
, MUIA_Popstring_String
);
208 nnset((Object
*)result
, MUIA_UserData
, entry
->act
);
210 ka
.key
= entry
->code
;
220 ka
.qualifier
= entry
->qual
;
221 KeyToString(buffer
, sizeof(buffer
), &ka
);
222 nnset(data
->hotkey
, MUIA_String_Contents
, buffer
);
227 MakeStaticHook(SelectHook
, SelectCode
);
229 HOOKPROTONHNO(UpdateCode
, void, APTR
**array
)
231 struct InstData_MCP
*data
= (struct InstData_MCP
*)*array
++;
232 Object
*keylist
= (Object
*)*array
++;
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
,
247 DoMethod(keylist
, MUIM_List_Remove
, active
);
249 result
= xget(data
->keyfunctions
, MUIA_Popstring_String
);
250 result
= xget((Object
*)result
, MUIA_UserData
);
254 result
= xget(data
->hotkey
, MUIA_String_Contents
);
258 struct KeyAction keyaction
;
260 ConvertKeyString((STRPTR
)result
, entry
.act
, &keyaction
);
261 entry
.code
= keyaction
.key
;
262 if(keyaction
.vanilla
)
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
,
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
,
294 Object
*CreatePrefsGroup(struct InstData_MCP
*data
)
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"
339 static const char infotext2
[] = "\n"
340 "Distributed under the terms of the LGPL2.\n"
342 "For the latest version, check out:\n"
343 "http://www.sf.net/projects/texteditor-mcc/\n"
348 // check that HotkeyString.mcc exists and is
350 data
->hotkey
= HotkeyStringObject
,
351 MUIA_CycleChain
, TRUE
,
352 MUIA_Frame
, MUIV_Frame_String
,
353 MUIA_HotkeyString_Snoop
, FALSE
,
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
;
374 // get rid of the too old object
375 MUI_DisposeObject(data
->hotkey
);
380 if(hotkeystringOk
== FALSE
)
382 MUI_Request(NULL
, NULL
, 0L, tr(MSG_WarnHotkeyString_Title
), tr(MSG_Ok
), tr(MSG_WarnHotkeyString
));
388 mui39
= LIB_VERSION_IS_AT_LEAST(MUIMasterBase
, 20, 0);
390 data
->editpopup
= MUI_MakeObject(MUIO_MenustripNM
, editpopupdata
, NULL
);
393 Child
, RegisterGroup(data
->gTitles
),
394 MUIA_CycleChain
, TRUE
,
395 MUIA_Background
, MUII_RegisterBack
,
400 MUIA_Background
, MUII_GroupBack
,
401 MUIA_Frame
, MUIV_Frame_Group
,
402 MUIA_FrameTitle
, tr(MSG_GroupTitle_Control
),
405 Child
, TxtLabel(tr(MSG_Label_UndoLevel
), 0),
406 Child
, data
->undosize
= SliderObject
,
407 MUIA_ShortHelp
, tr(MSG_HelpBubble_UndoLevel
),
409 MUIA_Numeric_Max
, 2000,
410 MUIA_CycleChain
, TRUE
,
412 Child
, TxtLabel(tr(MSG_Label_TabSize
), 0),
413 Child
, data
->tabsize
= SliderObject
,
414 MUIA_ShortHelp
, tr(MSG_HELP_TABSIZE
),
416 MUIA_Numeric_Max
, 12,
417 MUIA_Numeric_Format
, tr(MSG_SliderText_TabSize
),
418 MUIA_CycleChain
, TRUE
,
420 Child
, TxtLabel(tr(MSG_Label_Smooth
), 0),
422 MUIA_ShortHelp
, tr(MSG_HelpBubble_Smooth
),
423 Child
, data
->smooth
= MUI_MakeObject(MUIO_Checkmark
, NULL
),
426 Child
, TxtLabel(tr(MSG_Label_SelectPointer
), 0),
428 MUIA_ShortHelp
, tr(MSG_HELP_SelectPointer
),
429 Child
, data
->selectPointer
= MUI_MakeObject(MUIO_Checkmark
, NULL
),
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
,
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
,
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
,
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
,
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
,
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
,
492 // MUIA_VertWeight, 0,
493 MUIA_Background
, MUII_GroupBack
,
494 MUIA_Frame
, MUIV_Frame_Group
,
495 MUIA_FrameTitle
, tr(MSG_GroupTitle_Fonts
),
497 Child
, TxtLabel(tr(MSG_Label_Normal
), 0),
499 MUIA_Popstring_String
, data
->normalfont
= BetterStringObject
,
501 MUIA_CycleChain
, TRUE
,
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
),
507 Child
, TxtLabel(tr(MSG_Label_Fixed
), 0),
509 MUIA_Popstring_String
, data
->fixedfont
= BetterStringObject
,
511 MUIA_CycleChain
, TRUE
,
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
),
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
,
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
,
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
,
545 Child
, TxtLabel(tr(MSG_Label_Width
), 0),
546 Child
, data
->cursorwidth
= NewObject(widthslider_mcc
->mcc_Class
, NULL
,
549 MUIA_Numeric_Format
, tr(MSG_SliderText_StdWidth
),
550 MUIA_ShortHelp
, tr(MSG_HELP_CURSOR_WIDTH
),
551 MUIA_CycleChain
, TRUE
,
553 Child
, TxtLabel(tr(MSG_Label_BlinkSpeed
), 0),
554 Child
, data
->blinkspeed
= NewObject(speedslider_mcc
->mcc_Class
, NULL
,
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
,
561 Child
, TxtLabel(tr(MSG_Label_InactiveCursor
), 0),
564 MUIA_ShortHelp
, tr(MSG_HELP_InactiveCursor
),
565 Child
, data
->inactiveCursor
= MUI_MakeObject(MUIO_Checkmark
, NULL
),
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
),
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,
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
,
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
,
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
,
626 MUIA_List_AutoVisible
, TRUE
,
627 MUIA_List_SourceArray
, data
->functions
,
631 // MUIA_Poplist_Array, data->functions,
636 Child
, data
->insertkey
= SimpleButton(tr(MSG_Button_Insert
)),
637 Child
, data
->deletekey
= SimpleButton(tr(MSG_Button_Delete
)),
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
,
658 Child
, BalanceObject
, End
,
661 Child
, TxtLabel(tr(MSG_Label_LookupCmd
), 0),
662 Child
, data
->LookupExeType
= CycleObject
,
663 MUIA_Cycle_Entries
, data
->execution
,
665 MUIA_CycleChain
, TRUE
,
667 Child
, data
->lookupcmd
= BetterStringObject
, StringFrame
,
668 MUIA_ShortHelp
, tr(MSG_HELP_SPELLCHECKER_LOOKUP_CMD
),
669 MUIA_CycleChain
, TRUE
,
671 Child
, TxtLabel(tr(MSG_Label_SuggestCmd
), 0),
672 Child
, data
->SuggestExeType
= CycleObject
,
673 MUIA_Cycle_Entries
, data
->execution
,
675 MUIA_CycleChain
, TRUE
,
677 Child
, data
->suggestcmd
= BetterStringObject
, StringFrame
,
678 MUIA_String_AdvanceOnCR
, TRUE
,
679 MUIA_ShortHelp
, tr(MSG_HELP_SPELLCHECKER_SUGGEST_CMD
),
680 MUIA_CycleChain
, TRUE
,
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
),
691 Child
, RectangleObject
,
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"
708 "For the latest version, try: \33u\33p[7]http://www.sourceforge.net/projects/texteditor-mcc/\33p[0]\33n\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"
714 "\33[s:2]\33c\33u\33b Usage: \33n\n"
716 "Besides the many keys you can configure on the \33iKeybindings\33n page, there is also the following you should know:\n"
718 "- You can double-click a word to select it. Triple-clicking has the same effect, but for entire lines.\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"
722 "- While you drag to scroll, the farther away from the gadget your mouse pointer is, the faster the contents will scroll.\n"
724 "\33[s:2]\33c\33u\33b ARexx: \33n\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"
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"
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.",
733 Child
, slider
= ScrollbarObject
,
738 Child
, CrawlingObject
,
740 MUIA_FixHeightTxt
, infotext1
,
741 MUIA_Background
, "m1",
744 MUIA_Text_Copy
, FALSE
,
745 MUIA_Text_PreParse
, "\033c",
746 MUIA_Text_Contents
, infotext1
,
750 MUIA_Text_Copy
, FALSE
,
751 MUIA_Text_PreParse
, "\033c",
752 MUIA_Text_Contents
, infotext2
,
756 MUIA_Text_Copy
, FALSE
,
757 MUIA_Text_PreParse
, "\033c",
758 MUIA_Text_Contents
, infotext1
,
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
,
796 MUIV_Notify_Self
, 3, MUIM_CallHook
, &SetDefaultKeysHook
, keylist
);
798 DoMethod(data
->insertkey
, MUIM_Notify
,
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
,
825 keylist
, 2, MUIM_List_Remove
, MUIV_List_Remove_Active
);
828 DoMethod(data
->hotkey
, MUIM_MultiSet
,
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
);