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
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 DISPATCHERPROTO(_DispatcherP
)
45 case OM_NEW
: return(New(cl
, obj
, (APTR
)msg
));
46 case OM_DISPOSE
: return(Dispose(cl
, obj
, (APTR
)msg
));
47 case MUIM_Settingsgroup_ConfigToGadgets
: return(ConfigToGadgets(cl
, obj
, (APTR
)msg
));
48 case MUIM_Settingsgroup_GadgetsToConfig
: return(GadgetsToConfig(cl
, obj
, (APTR
)msg
));
51 return(DoSuperMethodA(cl
, obj
, msg
));
56 DISPATCHERPROTO(Text_Dispatcher
)
64 struct opSet
*set_msg
= (struct opSet
*)msg
;
67 if((tag
= FindTagItem(MUIA_UserData
, set_msg
->ops_AttrList
)))
68 set(obj
, MUIA_Text_Contents
, FunctionName(tag
->ti_Data
));
73 return(DoSuperMethodA(cl
, obj
, msg
));
78 DISPATCHERPROTO(WidthSlider_Dispatcher
)
82 if(msg
->MethodID
== MUIM_Numeric_Stringify
)
84 struct MUIP_Numeric_Stringify
*smsg
= (struct MUIP_Numeric_Stringify
*)msg
;
87 return (ULONG
)GetStr(MSG_SliderText_MinWidth
);
90 return (ULONG
)GetStr(MSG_SliderText_MaxWidth
);
93 return(DoSuperMethodA(cl
, obj
, msg
));
98 DISPATCHERPROTO(SpeedSlider_Dispatcher
)
102 if(msg
->MethodID
== MUIM_Numeric_Stringify
)
104 struct MUIP_Numeric_Stringify
*smsg
= (struct MUIP_Numeric_Stringify
*)msg
;
107 return (ULONG
)GetStr(MSG_SliderText_MinSpeed
);
112 sprintf(buf
, "%ld ms", smsg
->value
*25);
118 return(DoSuperMethodA(cl
, obj
, msg
));
123 struct MUI_CustomClass
*widthslider_mcc
= NULL
;
124 struct MUI_CustomClass
*speedslider_mcc
= NULL
;
125 struct MUI_CustomClass
*text_mcc
= NULL
;
128 BOOL
CreateSubClasses(void)
130 if((widthslider_mcc
= MUI_CreateCustomClass(NULL
, "Slider.mui", NULL
, 0, ENTRY(WidthSlider_Dispatcher
))))
132 if((speedslider_mcc
= MUI_CreateCustomClass(NULL
, "Slider.mui", NULL
, 0, ENTRY(SpeedSlider_Dispatcher
))))
134 if((text_mcc
= MUI_CreateCustomClass(NULL
, "Text.mui", NULL
, 0, ENTRY(Text_Dispatcher
))))
144 void DeleteSubClasses(void)
148 MUI_DeleteCustomClass(text_mcc
);
154 MUI_DeleteCustomClass(speedslider_mcc
);
155 speedslider_mcc
= NULL
;
160 MUI_DeleteCustomClass(widthslider_mcc
);
161 widthslider_mcc
= NULL
;