perfly - show tree, see name

New Message Reply Date view Thread view Subject view Author view

David Cooper (cooper++at++svl.meitca.com)
Wed, 20 Nov 1996 12:00:38 -0800


Ever been frustrated by the fact that the nodes on the "show tree"
option in perfly can only show 8 characters and of those 8 usually about
6 are used by the type specification, leaving only 2 characters for name
information ?

Here is a very minor change which makes the option a bit more useful.
Nodes become color coded by type and if a name has been defined for a
node it is placed on the node. Using color to indicate type frees up
about 6 characters which can make identifying a node of interest much
easier.

You need to modify the source for libpfutil

        cd /usr/share/Performer/lib/libpfutil

edit gui.c and replace the function drawNode() with the code segment
below.

Recompile and copy the library libpfutil_<GL version>.so into /usr/lib/

You should not have to recompile perfly for it to pick up the new
version.

---->

typedef struct { int col; char name[256]; } colTable;
#define COL_ENTRIES 4
static colTable boxColors[COL_ENTRIES] =
{
    0xff705311, "Group",
    0xff00ff00, "Switch",
    0xffcde130, "DCS",
    0xffffff00, "SCS",
};

static void
drawNode(pfNode *node, float x, float y, int ishlight)
{
    const char *typeName;
    char str[512];
    int found = 0, i;

    typeName = pfGetTypeName((pfObject*) node);

    if (strncmp(typeName, "pf", 2) == 0)
        typeName +=2;

    if (pfGetNodeName(node) != NULL)
        strcpy(str, pfGetNodeName(node));
    else
        strcpy(str,typeName);

    /* indicate number of geosets referenced by geode */
    if (pfIsOfType(node, pfGetGeodeClassType()))
        {
            char children[32];
            sprintf(children, " :%d", pfGetNumGSets((pfGeode *)node));
            strcat(str, children);
        }

    for (i = 0; i < COL_ENTRIES; i++)
        {
            if (!strcmp(typeName,boxColors[i].name))
                {
                    found = 1;
                    drawBevelBox(x, y, XS-1, YS-1, boxColors[i].col,
str);
                }
        }

    if (!found)
        drawBevelBox(x, y, XS-1, YS-1, 0xff808080, str);

}

-- 
David Cooper                         Mitsubishi Electric  ITA 
Senior Member of Tech Staff	     Sunnyvale Lab
email:cooper++at++svl.meitca.com          1060 East Arques Avenue
tel:408 523 6805                     Sunnyvale CA 94086
=======================================================================
List Archives, FAQ, FTP:  http://www.sgi.com/Technology/Performer/
            Submissions:  info-performer++at++sgi.com
        Admin. requests:  info-performer-request++at++sgi.com

New Message Reply Date view Thread view Subject view Author view

This archive was generated by hypermail 2.0b2 on Mon Aug 10 1998 - 17:53:59 PDT

This message has been cleansed for anti-spam protection. Replace '++at++' in any mail addresses with the '@' symbol.