2 #include <devices/rawkeycodes.h>
3 #include <proto/alib.h>
4 #include <proto/intuition.h>
5 #include <proto/keymap.h>
6 #include <proto/muimaster.h>
7 #include <private/vapor/vapor.h>
8 #include <proto/utility.h>
11 #include <clib/arossupport_protos.h>
14 #include "annotation_class.h"
15 #include "pageview_class.h"
21 struct MUI_EventHandlerNode ehnode
;
30 char *contents
= GetTagData(MUIA_Annotation_Contents
, "", INITTAGS
);
32 obj
= DoSuperNew(cl
, obj
,
33 MUIA_Group_Horiz
, FALSE
,
35 #if defined(MUIA_Floating)
41 MUIA_Frame
, MUIV_Frame_String
,
42 #if defined(MUIA_Textinput_Multiline)
44 MUIA_Textinput_Multiline
, 5,
46 MUIA_String_Contents
, contents
,
54 data
->x
= GetTagData(MUIA_Annotation_PosX
, 0, INITTAGS
);
55 data
->y
= GetTagData(MUIA_Annotation_PosY
, 0, INITTAGS
);
56 data
->refobj
= GetTagData(MUIA_Annotation_RefObject
, NULL
, INITTAGS
);
58 data
->contents
= contents
;
73 int width
= xget(_parent(obj
), MUIA_Width
);
74 int height
= xget(_parent(obj
), MUIA_Height
);
77 int prvwidth
, prvheight
;
78 int imgwidth
, imgheight
;
80 x0
= _mleft(data
->refobj
);
81 y0
= _mtop(data
->refobj
);
82 prvwidth
= xget(data
->refobj
, MUIA_PageView_RenderWidth
);
83 prvheight
= xget(data
->refobj
, MUIA_PageView_RenderHeight
);
85 imgwidth
= xget(data
->refobj
, MUIA_PageView_Width
);
86 imgheight
= xget(data
->refobj
, MUIA_PageView_Height
);
88 /* calculate placement */
90 if (imgheight
< prvheight
)
91 y0
+= (prvheight
- imgheight
) / 2;
93 if (imgwidth
< prvwidth
)
94 x0
+= (prvwidth
- imgwidth
) / 2;
97 kprintf("[Annotation::Layout] not implemented\n");
100 msg
->left
= data
->x
+ x0
;
101 msg
->top
= data
->y
+ y0
;
103 if (msg
->height
> 50)
106 if (msg
->width
> 200)
119 case MUIA_Annotation_PosX
:
120 data
->x
= tag
->ti_Data
;
123 case MUIA_Annotation_PosY
:
124 data
->y
= tag
->ti_Data
;
132 DEFMMETHOD(Annotation_Toggle
)
136 data
->visible
= 1 - data
->visible
;
137 set(obj
, MUIA_ShowMe
, data
->visible
);
147 DECMMETHOD(Annotation_Toggle
)
150 DECSUBCLASS_NC(MUIC_Group
, AnnotationClass
)