1 /***************************************************************************
3 BetterString.mcc - A better String gadget MUI Custom Class
4 Copyright (C) 1997-2000 Allan Odgaard
5 Copyright (C) 2005-2013 by BetterString.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 BetterString class Support Site: http://www.sf.net/projects/bstring-mcc/
21 ***************************************************************************/
23 #include <proto/intuition.h>
24 #include <proto/muimaster.h>
25 #include <exec/libraries.h>
26 #include <libraries/asl.h>
27 #include <libraries/mui.h>
29 #include <mui/BetterString_mcc.h>
36 const char *Key4
[] = { "Amiga + z", "Undo ralast deletion" };
37 const char *Key5
[] = { "Amiga + Z", "Redo last deletion" };
38 const char *Key6
[] = { "Amiga + q", "Toggle between original and modified buffer" };
39 const char *Key7
[] = { "Amiga + g", "Toggle case on char" };
40 const char *Key8
[] = { "Amiga + G", "Toggle case on word" };
41 const char *Key9
[] = { "Amiga + i", "Increase number" };
42 const char *Key10
[] = { "Amiga + d", "Decrease number" };
43 const char *Key11
[] = { "Amiga + #", "Hex to decimal" };
44 const char *Key12
[] = { "Amiga + $", "Decimal to hex" };
45 const char *Key13
[] = { "Amiga + Tab", "Filenamecompletion (use shift to cycle back)" };
47 const char *Key14
[] = { "Ctrl + crsr", "Mark" };
48 const char *Key15
[] = { "Ctrl + bs/del", "Delete to start/end of line" };
49 const char *Key16
[] = { "Shift + crsr", "Go to start/end of line" };
50 const char *Key17
[] = { "Shift + bs/del", "Delete to start/end of line" };
51 const char *Key18
[] = { "Alt + crsr", "Go to prev/next word" };
52 const char *Key19
[] = { "Alt + bs/del", "Delete prev/next word" };
54 Object
*TxtLabel(const char *text
)
56 return TextObject
, ImageButtonFrame
,
57 MUIA_FramePhantomHoriz
, TRUE
,
58 MUIA_Text_PreParse
, "\33r",
59 MUIA_Text_SetVMax
, FALSE
,
60 MUIA_Text_Contents
, text
,
65 Object
*TxtLLabel(const char *text
)
67 return TextObject
, ImageButtonFrame
,
68 MUIA_FramePhantomHoriz
, TRUE
,
69 MUIA_Text_SetVMax
, FALSE
,
70 MUIA_Text_Contents
, text
,
75 HOOKPROTONH(DisplayCode
, VOID
, STRPTR
* place
, STRPTR
*item
)
78 *place
++ = (STRPTR
)"=";
81 MakeStaticHook(DisplayHook
, DisplayCode
);
83 Object
*CreatePrefsGroup(struct InstData_MCP
*data
)
85 Object
**objs
= data
->Objects
;
87 static const char *key01
[2];
88 static const char *key02
[2];
89 static const char *key03
[2];
90 static const char *key04
[2];
91 static const char *key05
[2];
92 static const char *key06
[2];
93 static const char *key07
[2];
94 static const char *key08
[2];
95 static const char *key09
[2];
96 static const char *key10
[2];
97 static const char *key11
[2];
98 static const char *key12
[2];
99 static const char *key13
[2];
100 static const char *key14
[2];
101 static const char *key15
[2];
102 static const char *key16
[2];
103 static const char *key17
[2];
104 static const char *key18
[2];
106 static const char infotext1
[] = "\033bBetterString.mcp " LIB_REV_STRING
"\033n (" LIB_DATE
")\n"
107 "Copyright (C) 1997-2000 Allan Odgaard\n"
109 static const char infotext2
[] = "\n"
110 "Distributed under the terms of the LGPL2.\n"
112 "For the latest version, check out:\n"
113 "http://www.sf.net/projects/bstring-mcc/\n"
116 static const char **keyinfo
[] =
118 key01
, key02
, key03
, key04
, key05
, key06
, key07
, key08
, key09
, key10
,
119 key11
, key12
, key13
, key14
, key15
, key16
, key17
, key18
,
123 key01
[0] = GetStr(MSG_Help_Copy_Shortcut
); key01
[1] = GetStr(MSG_Help_Copy
);
124 key02
[0] = GetStr(MSG_Help_Cut_Shortcut
); key02
[1] = GetStr(MSG_Help_Cut
);
125 key03
[0] = GetStr(MSG_Help_Paste_Shortcut
); key03
[1] = GetStr(MSG_Help_Paste
);
126 key04
[0] = GetStr(MSG_Help_Undo_Shortcut
); key04
[1] = GetStr(MSG_Help_Undo
);
127 key05
[0] = GetStr(MSG_Help_Redo_Shortcut
); key05
[1] = GetStr(MSG_Help_Redo
);
128 key06
[0] = GetStr(MSG_Help_ToggleBuffer_Shortcut
); key06
[1] = GetStr(MSG_Help_ToggleBuffer
);
129 key07
[0] = GetStr(MSG_Help_ToggleCaseChar_Shortcut
); key07
[1] = GetStr(MSG_Help_ToggleCaseChar
);
130 key08
[0] = GetStr(MSG_Help_ToggleCaseWord_Shortcut
); key08
[1] = GetStr(MSG_Help_ToggleCaseWord
);
131 key09
[0] = GetStr(MSG_Help_IncreaseNumber_Shortcut
); key09
[1] = GetStr(MSG_Help_IncreaseNumber
);
132 key10
[0] = GetStr(MSG_Help_DecreaseNumber_Shortcut
); key10
[1] = GetStr(MSG_Help_DecreaseNumber
);
133 key11
[0] = GetStr(MSG_Help_HexToDecimal_Shortcut
); key11
[1] = GetStr(MSG_Help_HexToDecimal
);
134 key12
[0] = GetStr(MSG_Help_DecimalToHex_Shortcut
); key12
[1] = GetStr(MSG_Help_DecimalToHex
);
135 key13
[0] = GetStr(MSG_Help_FilenameCompletition_Shortcut
); key13
[1] = GetStr(MSG_Help_FilenameCompletition
);
136 key14
[0] = GetStr(MSG_Help_Mark_Shortcut
); key14
[1] = GetStr(MSG_Help_Mark
);
137 key15
[0] = GetStr(MSG_Help_GotoToStartEndOfLine_Shortcut
); key15
[1] = GetStr(MSG_Help_GotoToStartEndOfLine
);
138 key16
[0] = GetStr(MSG_Help_DeleteToStartEndOfLine_Shortcut
); key16
[1] = GetStr(MSG_Help_DeleteToStartEndOfLine
);
139 key17
[0] = GetStr(MSG_Help_GotoToPrevNextWord_Shortcut
); key17
[1] = GetStr(MSG_Help_GotoToPrevNextWord
);
140 key18
[0] = GetStr(MSG_Help_DeleteToPrevNextWord_Shortcut
); key18
[1] = GetStr(MSG_Help_DeleteToPrevNextWord
);
144 Child
, PopobjectObject
,
145 MUIA_Popstring_String
, BetterStringObject
, StringFrame
,
146 MUIA_String_Contents
, GetStr(MSG_String_TestString
),
147 MUIA_String_Format
, MUIV_String_Format_Center
,
148 MUIA_CycleChain
, TRUE
,
150 MUIA_Popstring_Button
, PopButton(MUII_PopUp
),
151 MUIA_Popobject_Object
, ListviewObject
,
152 MUIA_Listview_Input
, FALSE
,
153 MUIA_Listview_List
, ListObject
, ReadListFrame
,
154 MUIA_List_DisplayHook
, &DisplayHook
,
155 MUIA_List_Format
, ",,",
156 MUIA_List_SourceArray
, keyinfo
,
166 MUIA_Group_SameWidth
, TRUE
,
168 MUIA_Font
, MUIV_Font_Tiny
,
169 MUIA_Text_Contents
, GetStr(MSG_Label_Background
),
170 MUIA_Text_PreParse
, "\33c",
173 MUIA_Font
, MUIV_Font_Tiny
,
174 MUIA_Text_Contents
, GetStr(MSG_Label_Text
),
175 MUIA_Text_PreParse
, "\33c",
179 Child
, TxtLabel(GetStr(MSG_Label_Inactive
)),
181 Child
, objs
[InactiveBack
] = PopimageObject
,
182 MUIA_Imageadjust_Type
, 2,
183 MUIA_CycleChain
, TRUE
,
186 Child
, objs
[InactiveText
] = PoppenObject
,
187 MUIA_CycleChain
, TRUE
,
192 Child
, TxtLabel(GetStr(MSG_Label_Active
)),
194 Child
, objs
[ActiveBack
] = PopimageObject
,
195 MUIA_Imageadjust_Type
, 2,
196 MUIA_CycleChain
, TRUE
,
199 Child
, objs
[ActiveText
] = PoppenObject
,
200 MUIA_CycleChain
, TRUE
,
206 Child
, RectangleObject
,
207 MUIA_Rectangle_HBar
, TRUE
,
211 Child
, TxtLabel(GetStr(MSG_Label_Cursor
)),
212 Child
, objs
[Cursor
] = PoppenObject
,
213 MUIA_CycleChain
, TRUE
,
217 Child
, TxtLabel(GetStr(MSG_Label_Marked
)),
219 Child
, objs
[MarkedBack
] = PoppenObject
,
220 MUIA_CycleChain
, TRUE
,
223 Child
, objs
[MarkedText
] = PoppenObject
,
224 MUIA_CycleChain
, TRUE
,
230 Child
, RectangleObject
,
231 MUIA_Rectangle_HBar
, TRUE
,
238 Child
, objs
[SelectOnActive
] = MUI_MakeObject(MUIO_Checkmark
, NULL
),
239 Child
, TxtLLabel(GetStr(MSG_SelectOnActive
)),
246 Child
, objs
[SelectPointer
] = MUI_MakeObject(MUIO_Checkmark
, NULL
),
247 Child
, TxtLLabel(GetStr(MSG_SelectPointer
)),
253 Child
, CrawlingObject
,
255 MUIA_FixHeightTxt
, infotext1
,
256 MUIA_Background
, "m1",
259 MUIA_Text_Copy
, FALSE
,
260 MUIA_Text_PreParse
, "\033c",
261 MUIA_Text_Contents
, infotext1
,
265 MUIA_Text_Copy
, FALSE
,
266 MUIA_Text_PreParse
, "\033c",
267 MUIA_Text_Contents
, infotext2
,
271 MUIA_Text_Copy
, FALSE
,
272 MUIA_Text_PreParse
, "\033c",
273 MUIA_Text_Contents
, infotext1
,
279 // the inactive background will be the same as for String.mui on MUI4
280 if(objs
[InactiveBack
] != NULL
)
281 set(objs
[InactiveBack
], MUIA_Disabled
, data
->mui4x
);
283 // the active background will be the same as for String.mui on MUI4
284 if(objs
[ActiveBack
] != NULL
)
285 set(objs
[ActiveBack
], MUIA_Disabled
, data
->mui4x
);
287 if(objs
[SelectOnActive
] != NULL
)
288 set(objs
[SelectOnActive
], MUIA_ShortHelp
, GetStr(MSG_HELP_SelectOnActive
));
290 if(objs
[SelectPointer
] != NULL
)
291 set(objs
[SelectPointer
], MUIA_ShortHelp
, GetStr(MSG_HELP_SelectPointer
));