From d361388f180f23e5f58eb64cf833404b74ec88e8 Mon Sep 17 00:00:00 2001 From: neil Date: Fri, 7 Mar 2014 01:50:21 +0000 Subject: [PATCH] - Made MUIA_List_Title settable. - A valid column was reported by the TestPos method even if the mouse position was to the left of the list. Fixed. - Some tidying/optimisation. git-svn-id: https://svn.aros.org/svn/aros/trunk/AROS@48830 fb15a70f-31f2-0310-bbcc-cdcc74a49acc --- workbench/libs/muimaster/classes/aboutmui.c | 4 +-- workbench/libs/muimaster/classes/list.c | 46 +++++++++++++++-------------- 2 files changed, 26 insertions(+), 24 deletions(-) diff --git a/workbench/libs/muimaster/classes/aboutmui.c b/workbench/libs/muimaster/classes/aboutmui.c index c5da28af30..e4c03240f5 100644 --- a/workbench/libs/muimaster/classes/aboutmui.c +++ b/workbench/libs/muimaster/classes/aboutmui.c @@ -1,5 +1,5 @@ /* - Copyright © 2002-2013, The AROS Development Team. All rights reserved. + Copyright © 2002-2014, The AROS Development Team. All rights reserved. $Id$ */ @@ -905,7 +905,7 @@ IPTR Aboutmui__OM_NEW(struct IClass *cl, Object *obj, struct opSet *msg) struct TagItem *tag, *tags; static const char about_text[] = "Zune, a MUI clone\n" "\nCompiled on " __DATE__ - "\nCopyright (C) 2002-2013, The AROS Development Team."; + "\nCopyright (C) 2002-2014, The AROS Development Team."; obj = (Object *) DoSuperNewTags ( diff --git a/workbench/libs/muimaster/classes/list.c b/workbench/libs/muimaster/classes/list.c index 7faaa0c623..f9ad145ea1 100644 --- a/workbench/libs/muimaster/classes/list.c +++ b/workbench/libs/muimaster/classes/list.c @@ -1,5 +1,5 @@ /* - Copyright © 2002-2013, The AROS Development Team. All rights reserved. + Copyright © 2002-2014, The AROS Development Team. All rights reserved. $Id$ */ @@ -134,7 +134,8 @@ struct MUI_ListData /* Titlestuff */ int title_height; /* The complete height of the title */ - STRPTR title; /* On single comlums this is the title, otherwise 1 */ + STRPTR title; /* On single column lists this is the title, + * otherwise 1. NULL for no title(s) */ /* Cursor images */ struct MUI_ImageSpec_intern *list_cursor; @@ -257,9 +258,9 @@ static void FreeListEntry(struct MUI_ListData *data, } /************************************************************************** - Ensures that we there can be at least the given amount of entries within + Ensures that there can be at least the given amount of entries within the list. Returns 0 if not. It also allocates the space for the title. - It can be accesses with data->entries[ENTRY_TITLE] + It can be accessed with data->entries[ENTRY_TITLE] **************************************************************************/ static int SetListSize(struct MUI_ListData *data, LONG size) { @@ -894,6 +895,11 @@ IPTR List__OM_SET(struct IClass *cl, Object *obj, struct opSet *msg) } break; + case MUIA_List_Title: + data->title = (STRPTR) tag->ti_Data; + DoMethod(obj, MUIM_List_Redraw, MUIV_List_Redraw_All); + break; + case MUIA_List_VertProp_First: data->vertprop_first = tag->ti_Data; if (data->entries_first != tag->ti_Data) @@ -1091,7 +1097,7 @@ IPTR List__OM_GET(struct IClass *cl, Object *obj, struct opGet *msg) STORE = data->insert_position; return 1; case MUIA_List_Title: - STORE = (unsigned long)data->title; + STORE = (IPTR) data->title; return 1; case MUIA_List_VertProp_Entries: STORE = data->vertprop_entries; @@ -1143,15 +1149,6 @@ IPTR List__MUIM_Setup(struct IClass *cl, Object *obj, CalcWidths(cl, obj); - if (data->title) - { - data->title_height = data->entries[ENTRY_TITLE]->height + 2; - } - else - { - data->title_height = 0; - } - data->list_cursor = zune_imspec_setup(MUII_ListCursor, muiRenderInfo(obj)); data->list_select = @@ -1372,15 +1369,21 @@ IPTR List__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg) DoSuperMethodA(cl, obj, (Msg) msg); - if (msg->flags & MADF_DRAWUPDATE) + /* Calculate the title height */ + if (data->title) { - if (data->update == 1) - DoMethod(obj, MUIM_DrawBackground, _mleft(obj), _mtop(obj), - _mwidth(obj), _mheight(obj), - 0, data->entries_first * data->entry_maxheight, 0); + data->title_height = data->entries[ENTRY_TITLE]->height + 2; } else { + data->title_height = 0; + } + + /* Calc the numbers of entries visible */ + CalcVertVisible(cl, obj); + + if ((msg->flags & MADF_DRAWUPDATE) == 0 || data->update == 1) + { DoMethod(obj, MUIM_DrawBackground, _mleft(obj), _mtop(obj), _mwidth(obj), _mheight(obj), 0, data->entries_first * data->entry_maxheight, 0); @@ -1389,8 +1392,7 @@ IPTR List__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg) clip = MUI_AddClipping(muiRenderInfo(obj), _mleft(obj), _mtop(obj), _mwidth(obj), _mheight(obj)); - if (!(msg->flags & MADF_DRAWUPDATE) - || ((msg->flags & MADF_DRAWUPDATE) && data->update == 1)) + if ((msg->flags & MADF_DRAWUPDATE) == 0 || data->update == 1) { y = _mtop(obj); /* Draw Title @@ -2584,7 +2586,7 @@ IPTR List__MUIM_TestPos(struct IClass *cl, Object *obj, if (mx < 0) flags |= MUI_LPR_LEFT; - if (mx >= _width(obj)) + else if (mx >= _width(obj)) flags |= MUI_LPR_RIGHT; else { -- 2.11.4.GIT