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>
26 #include <utility/tagitem.h>
27 #include <libraries/mui.h>
28 #include <proto/intuition.h>
29 #include <proto/utility.h>
30 #include <proto/muimaster.h>
35 #include "SDI_compiler.h"
38 // the main mcp dispatcher
39 DISPATCHER(_DispatcherP
)
43 case OM_NEW
: return(New(cl
, obj
, (APTR
)msg
));
44 case OM_DISPOSE
: return(Dispose(cl
, obj
, (APTR
)msg
));
45 case MUIM_Settingsgroup_ConfigToGadgets
: return(ConfigToGadgets(cl
, obj
, (APTR
)msg
));
46 case MUIM_Settingsgroup_GadgetsToConfig
: return(GadgetsToConfig(cl
, obj
, (APTR
)msg
));
49 return(DoSuperMethodA(cl
, obj
, msg
));
52 DISPATCHER(Text_Dispatcher
)
58 struct opSet
*set_msg
= (struct opSet
*)msg
;
61 if((tag
= FindTagItem(MUIA_UserData
, set_msg
->ops_AttrList
)))
62 set(obj
, MUIA_Text_Contents
, FunctionName(tag
->ti_Data
));
67 return(DoSuperMethodA(cl
, obj
, msg
));
70 DISPATCHER(WidthSlider_Dispatcher
)
72 if(msg
->MethodID
== MUIM_Numeric_Stringify
)
74 struct MUIP_Numeric_Stringify
*smsg
= (struct MUIP_Numeric_Stringify
*)msg
;
77 return (IPTR
)tr(MSG_SliderText_MinWidth
);
80 return (IPTR
)tr(MSG_SliderText_MaxWidth
);
83 return(DoSuperMethodA(cl
, obj
, msg
));
86 DISPATCHER(SpeedSlider_Dispatcher
)
88 if(msg
->MethodID
== MUIM_Numeric_Stringify
)
90 struct MUIP_Numeric_Stringify
*smsg
= (struct MUIP_Numeric_Stringify
*)msg
;
93 return (IPTR
)tr(MSG_SliderText_MinSpeed
);
98 snprintf(buf
, sizeof(buf
), "%d ms", (int)smsg
->value
*25);
104 return(DoSuperMethodA(cl
, obj
, msg
));
107 struct MUI_CustomClass
*widthslider_mcc
= NULL
;
108 struct MUI_CustomClass
*speedslider_mcc
= NULL
;
109 struct MUI_CustomClass
*text_mcc
= NULL
;
111 BOOL
CreateSubClasses(void)
113 if((widthslider_mcc
= MUI_CreateCustomClass(NULL
, "Slider.mui", NULL
, 0, ENTRY(WidthSlider_Dispatcher
))))
115 if((speedslider_mcc
= MUI_CreateCustomClass(NULL
, "Slider.mui", NULL
, 0, ENTRY(SpeedSlider_Dispatcher
))))
117 if((text_mcc
= MUI_CreateCustomClass(NULL
, "Text.mui", NULL
, 0, ENTRY(Text_Dispatcher
))))
127 void DeleteSubClasses(void)
131 MUI_DeleteCustomClass(text_mcc
);
137 MUI_DeleteCustomClass(speedslider_mcc
);
138 speedslider_mcc
= NULL
;
143 MUI_DeleteCustomClass(widthslider_mcc
);
144 widthslider_mcc
= NULL
;