3 #define AROS_ALMOST_COMPATIBLE
4 #include <proto/muimaster.h>
5 #include <libraries/mui.h>
7 #include <libraries/asl.h>
8 #include <workbench/workbench.h>
10 #include <proto/exec.h>
11 #include <intuition/intuition.h>
12 #include <graphics/gfx.h>
13 #include <exec/libraries.h>
14 #include <proto/graphics.h>
15 #include <proto/intuition.h>
16 #include <proto/icon.h>
18 #include <proto/dos.h>
25 #include <proto/alib.h>
26 #include <proto/utility.h>
28 #include <proto/datatypes.h>
29 #include <proto/dtclass.h>
30 #include <datatypes/pictureclass.h>
31 #include <devices/rawkeycodes.h>
33 #include <libraries/gadtools.h>
35 #if defined(__MORPHOS__)
36 #include <emul/emulregs.h>
37 #include <emul/emulinterface.h>
41 #include <private/vapor/vapor.h>
42 #include <mui/Listtree_mcc.h>
46 #include "pageview_class.h"
47 #include "outlineview_class.h"
52 struct MinList
*outlineitems
;
55 static void buildlist(Object
*obj
, struct MinList
*outlineitems
, APTR parentnode
)
58 ITERATELIST(n
, outlineitems
)
60 APTR newparentnode
= (APTR
)DoMethod(obj
, MUIM_Listtree_Insert
,
64 MUIV_Listtree_Insert_PrevNode_Tail
,
65 outlineHasChildren(n
) ? TNF_LIST
: 0
68 if (outlineHasChildren(n
))
69 buildlist(obj
, outlineGetChildren(n
), newparentnode
);
73 MUI_HOOK(outline_displayfunc
, STRPTR
*array
, struct MUIS_Listtree_TreeNode
*tn
)
77 struct MinNode
*td
= (struct MinNode
*)tn
->tn_User
;
78 char *name
= outlineGetTitle(td
);
80 array
[ 0 ] = name
!= NULL
? name
: "---";
82 if ((ULONG
)array
[ -1 ] % 2)
83 array
[-9] = (STRPTR
)10;
95 obj
= DoSuperNew(cl
, obj
,
96 MUIA_Listtree_DisplayHook
, &outline_displayfunc_hook
,
97 MUIA_Frame
, MUIV_Frame_InputList
,
104 memset(data
, 0, sizeof(struct Data
));
105 data
->doc
= (void*)GetTagData(MUIA_OutlineView_Document
, NULL
, INITTAGS
);
107 if (data
->doc
!= NULL
)
109 data
->outlineitems
= pdfGetOutlines(data
->doc
);
110 buildlist(obj
, data
->outlineitems
, MUIV_Listtree_Insert_ListNode_Root
);
118 DoMethod(obj
, MUIM_Notify
, MUIA_Listtree_Active
, MUIV_EveryTime
, obj
, 2, MUIM_OutlineView_NewEntrySelected
, MUIV_TriggerValue
);
130 METHOD
outlineviewNewEntrySelected(struct IClass
*cl
, Object
*obj
, struct MUIP_OutlineView_NewEntrySelected
*msg
)
134 struct MUIS_Listtree_TreeNode
*tn
= msg
->entry
;
135 struct MinNode
*td
= (struct MinNode
*)tn
->tn_User
;
136 int page
= msg
->entry
> 0 ? outlineGetPage(td
) : 0;
139 set(obj
, MUIA_OutlineView_Page
, page
);
148 switch (msg
->opg_AttrID
)
150 case MUIA_OutlineView_Page
:
153 case MUIA_OutlineView_IsEmpty
:
154 *(ULONG
*)msg
->opg_Storage
= data
->outlineitems
== NULL
|| ISLISTEMPTY(data
->outlineitems
);
166 case MUIM_OutlineView_NewEntrySelected
: return outlineviewNewEntrySelected(cl
,obj
,(APTR
)msg
);
169 DECSUBCLASS_NC(MUIC_Listtree
, OutlineViewClass
)