- Set up the real-mode IDT.
[AROS.git] / workbench / prefs / input / stringify.c
blobe6f7e4a0fece65ac731db823511f46342d9322b8
1 /*
2 Copyright © 2010-2011, The AROS Development Team. All rights reserved.
3 $Id$
4 */
6 #include <libraries/mui.h>
7 #include <zune/customclasses.h>
9 #include <proto/alib.h>
10 #include <proto/intuition.h>
11 #include <proto/utility.h>
12 #include <proto/muimaster.h>
14 #include <stdio.h>
16 #include "stringify.h"
18 struct MUI_CustomClass *StringifyClass;
20 struct Stringify_DATA
22 UWORD Type;
23 char buf[16];
27 static IPTR Stringify__OM_NEW(Class * cl, Object * obj, struct opSet * msg)
29 obj = (Object*) DoSuperMethodA(cl, obj, (Msg)msg);
30 if (obj != NULL)
32 struct Stringify_DATA *data = INST_DATA(cl,obj);
33 data->Type = (UWORD) GetTagData(MUIA_MyStringifyType, 0, msg->ops_AttrList);
35 return (IPTR) obj;
39 static IPTR Stringify__MUIM_Numeric_Stringify(Class * cl, Object * obj, Msg msg)
41 struct Stringify_DATA *data = INST_DATA(cl,obj);
43 struct MUIP_Numeric_Stringify *m = (APTR)msg;
45 if (data->Type == STRINGIFY_RepeatRate)
47 sprintf((char *)data->buf,"%3.2fs", 0.02 * (12 - m->value));
49 else if (data->Type == STRINGIFY_RepeatDelay)
51 sprintf((char *)data->buf,"%ldms", 20 + 20 * (long)m->value);
53 else if (data->Type == STRINGIFY_DoubleClickDelay)
55 sprintf((char *)data->buf,"%3.2fs", 0.02 + 0.02 * m->value);
57 return (IPTR) data->buf;
61 ZUNE_CUSTOMCLASS_2
63 Stringify, NULL, MUIC_Slider, NULL,
64 OM_NEW, struct opSet *,
65 MUIM_Numeric_Stringify, Msg