Esempio n. 1
0
void CIMXML_Parser::handle_character_data(const char* s, int len)
{
    if (_top() == TAG_VALUE || _top() == TAG_KEYVALUE)
    {
        _char_data.append(s, len);
    }
}
Esempio n. 2
0
IPTR Register__MUIM_Layout(struct IClass *cl, Object *obj, struct MUIP_Layout *msg)
{
    struct Register_DATA *data = INST_DATA(cl, obj);
    ULONG retval = 1;
    IPTR active;

    get(obj, MUIA_Group_ActivePage, &active);

    if (active != data->active)
    {
        data->oldactive = data->active;
        data->active = active;
    }
    SetHardCoord(obj,data);
    DoMethod(obj, MUIM_UpdateInnerSizes);

    DoSuperMethodA(cl, obj, (Msg)msg);

    data->left        = _left(obj);
    data->top         = _top(obj);
    data->framewidth  = _width(obj);
    data->frameheight = _height(obj) - data->tab_height;

    LayoutTabItems(obj,data);

    /*      D(bug("Register_Layout : left=%d, top=%d / framewidth=%d, frameheight=%d\n", */
    /*   	  data->left, data->top, data->framewidth, data->frameheight)); */

    return retval;
}
Esempio n. 3
0
IPTR Register__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg)
{
    struct Register_DATA *data = INST_DATA(cl, obj);

    /* Before all the current page is drawn erase the part of the area covered
     * by tabs which is not erased (between _left(obj) and _mleft(obj) and so on */
    if (data->oldactive != data->active && (msg->flags & MADF_DRAWUPDATE) && (data->active/data->columns != data->oldactive/data->columns))
    {
        int left,top,width,height;

        left = _mright(obj)+1;
        top = _mtop(obj);
        width = _right(obj) - left; /* +1 - 1*/
        height = _mheight(obj);

        DoMethod(obj, MUIM_DrawBackground, left, top, width, height, left, top, 0);

        left = _left(obj)+1; /* +1 because the register frame shouldn't be ereased */
        width = _mleft(obj) - left; /* + 1 - 1 */

        DoMethod(obj, MUIM_DrawBackground, left, top, width, height, left, top, 0);

        top = _top(obj) + data->tab_height;
        height = _mtop(obj) - top; /* + 1 - 1 */
        width = _width(obj)-2;

        if (height > 0 && width > 0)
            DoMethod(obj, MUIM_DrawBackground, left, top, width, height, left, top, 0);

        top = _mbottom(obj);
        height = _bottom(obj) - top; /* + 1 - 1 */

        if (height > 0 && width > 0)
            DoMethod(obj, MUIM_DrawBackground, left, top, width, height, left, top, 0);
    }

    DoSuperMethodA(cl,obj,(Msg)msg);

    /*      D(bug("Register_Draw : flags = %d\n", msg->flags)); */
    if (!(msg->flags & (MADF_DRAWOBJECT | MADF_DRAWUPDATE)))
        return(0);

    RenderRegisterTab(cl, obj, msg->flags);

    data->oldactive = data->active;
    return TRUE;
}
Esempio n. 4
0
    /*
    ** Layout function. Here, we have to call MUI_Layout() for each
    ** our children. MUI wants us to place them in a rectangle
    ** defined by (0,0,lm->lm_Layout.Width-1,lm->lm_Layout.Height-1)
    ** You are free to put the children anywhere in this rectangle.
    */
BOOL MUI_Layout (Object *obj, LONG left, LONG top, LONG width, LONG height,
		 ULONG flags)
{
    static ULONG method = MUIM_Layout;
    Object *parent = _parent(obj);

/*
 * Called only by groups, never by windows
 */
    g_assert(parent != NULL);

    _left(obj) = left + _mleft(parent);
    _top(obj) = top + _mtop(parent);
    _width(obj) = width;
    _height(obj) = height;

    DoMethodA(obj, (Msg)&method);

    return TRUE;
}
Esempio n. 5
0
/**************************************************************************
   Render tab bar
**************************************************************************/
static void RenderRegisterTab(struct IClass *cl, Object *obj, ULONG flags)
{
    struct Register_DATA *data = INST_DATA(cl, obj);
    WORD tabx;

    /*
     * Erase / prepare for drawing
     */
    if (flags & MADF_DRAWOBJECT)
    {
        DoMethod(obj, MUIM_DrawParentBackground, data->left, data->top,
                 data->framewidth, data->tab_height - 1, data->left, data->top, 0);
    }
    else
    {
        /* draw parent bg over oldactive */
        IPTR method;
        WORD old_left, old_top, old_width, old_height;
        struct RegisterTabItem *ri = &data->items[data->oldactive];
        if (data->oldactive >= data->columns) method = MUIM_DrawBackground;
        else method = MUIM_DrawParentBackground;

        old_left = _left(obj) + ri->x1 - 2;
        old_top = _top(obj) + ri->y1;
        old_width = ri->x2 - ri->x1 + 5;
        old_height = data->tab_height - 1;
        DoMethod(obj, method, old_left, old_top,
                 old_width, old_height, old_left, old_top, 0);
        SetDrMd(_rp(obj), JAM1);
        SetAPen(_rp(obj), _pens(obj)[MPEN_SHINE]);
        RectFill(_rp(obj), old_left, old_top + old_height, old_left + old_width, old_top + old_height);
    }

    SetDrMd(_rp(obj), JAM1);
    SetAPen(_rp(obj), _pens(obj)[MPEN_SHINE]);
    SetFont(_rp(obj), _font(obj));
    SetSoftStyle(_rp(obj), FS_NORMAL, AskSoftStyle(_rp(obj)));


    /*
     * Draw new graphics
     */
    /* register frame */
    if (flags & MADF_DRAWOBJECT || (data->active / data->columns != data->oldactive / data->columns))
    {
        int i,y,tabs_on_bottom = 0;

        SetAPen(_rp(obj), _pens(obj)[MPEN_SHINE]);

        RectFill(_rp(obj), data->left,
                 data->top + data->tab_height - 1,
                 data->left,
                 data->top + data->tab_height + data->frameheight - 1);

        y = data->top + data->tab_height - 1;

        for (i=0; i<data->rows; i++)
        {
            if (!tabs_on_bottom && (i > data->active/data->columns))
            {
                y = _bottom(obj) - muiAreaData(obj)->mad_InnerBottom + data->tab_height;
                tabs_on_bottom = 1;
            }

            RectFill(_rp(obj), data->left + 1, y, data->left + data->framewidth - 2, y);
            y += data->tab_height;
        }

        SetAPen(_rp(obj), _pens(obj)[MPEN_SHADOW]);

        RectFill(_rp(obj), data->left + data->framewidth - 1,
                 data->top + data->tab_height - 1,
                 data->left + data->framewidth - 1,
                 data->top + data->tab_height + data->frameheight - 1);

        RectFill(_rp(obj), data->left + 1,
                 data->top + data->tab_height + data->frameheight - 1,
                 data->left + data->framewidth - 2,
                 data->top + data->tab_height + data->frameheight - 1);
        for(i = 0, tabx = 0; i < data->numitems; i++)
        {
            RenderRegisterTabItem(cl, obj, i);
        }
    }
    else
    {
        /* If active register has been changed and is on same row we simply draw both registers only */
        RenderRegisterTabItem(cl, obj, data->active);
        RenderRegisterTabItem(cl, obj, data->oldactive);
    }

}
Esempio n. 6
0
/**************************************************************************
   Render one item
**************************************************************************/
static void RenderRegisterTabItem(struct IClass *cl, Object *obj,  WORD item)
{
    struct Register_DATA *data = INST_DATA(cl, obj);
    struct RegisterTabItem *ri = &data->items[item];
    struct TextExtent extent;
    WORD fitlen;  /* text len fitting in alloted space */
    WORD fitpix;  /* text pixels fitting in alloted space */
    WORD x, y;
    WORD top_item_bar_y;
    WORD bottom_item_bar_y;
    WORD left_item_bar_x;
    WORD right_item_bar_x;
    WORD item_bar_width;
    WORD text_y;
    WORD item_bg_height;
    WORD fitwidth;

    if ((item < 0) || (item >= data->numitems)) return;

    y = data->top + ri->y1;

    if (data->active == item)
    {
        top_item_bar_y = _top(obj) + ri->y1;
        bottom_item_bar_y = _top(obj) + ri->y2 - 2;
        left_item_bar_x = _left(obj) + ri->x1 - 1;
        right_item_bar_x = _left(obj) + ri->x2 + 1;
        item_bg_height = data->tab_height;
        text_y = y + data->ty;
        item_bar_width = right_item_bar_x - left_item_bar_x + 1;
        /* fill tab with register background */
        DoMethod(obj,MUIM_DrawBackground, left_item_bar_x, top_item_bar_y + 4,
                 item_bar_width, item_bg_height - 4,
                 left_item_bar_x, top_item_bar_y + 4, 0);
        DoMethod(obj,MUIM_DrawBackground, left_item_bar_x + 2, top_item_bar_y + 2,
                 item_bar_width - (2 * 2), 2,
                 left_item_bar_x + 2, top_item_bar_y + 2, 0);
        DoMethod(obj,MUIM_DrawBackground, left_item_bar_x + 4, top_item_bar_y + 1,
                 item_bar_width - (2 * 4), 1,
                 left_item_bar_x + 4, top_item_bar_y + 1, 0);
    }
    else
    {
        top_item_bar_y = _top(obj) + ri->y1 + 2;
        bottom_item_bar_y = _top(obj) + ri->y2 - 1;
        left_item_bar_x = _left(obj) + ri->x1;
        right_item_bar_x = _left(obj) + ri->x2;
        item_bg_height = data->tab_height - 3;
        text_y = y + data->ty + 1;
        item_bar_width = right_item_bar_x - left_item_bar_x + 1;
        SetAPen(_rp(obj), _pens(obj)[MPEN_BACKGROUND]);
        RectFill(_rp(obj), left_item_bar_x, top_item_bar_y + 4,
                 right_item_bar_x, bottom_item_bar_y);
        RectFill(_rp(obj), left_item_bar_x + 2, top_item_bar_y + 2,
                 right_item_bar_x - 2, top_item_bar_y + 3);
        RectFill(_rp(obj), left_item_bar_x + 4, top_item_bar_y + 1,
                 right_item_bar_x - 4, top_item_bar_y + 1);
    }

    /* top horiz bar */
    SetAPen(_rp(obj), _pens(obj)[MPEN_SHINE]);
    RectFill(_rp(obj), left_item_bar_x + 4, top_item_bar_y, right_item_bar_x - 4, top_item_bar_y);
    /* left vert bar */
    RectFill(_rp(obj), left_item_bar_x, top_item_bar_y + 4, left_item_bar_x, bottom_item_bar_y);
    WritePixel(_rp(obj), left_item_bar_x + 1, top_item_bar_y + 3);
    WritePixel(_rp(obj), left_item_bar_x + 1, top_item_bar_y + 2);
    WritePixel(_rp(obj), left_item_bar_x + 2, top_item_bar_y + 1);
    WritePixel(_rp(obj), left_item_bar_x + 3, top_item_bar_y + 1);
    SetAPen(_rp(obj), _pens(obj)[MPEN_HALFSHINE]);
    WritePixel(_rp(obj), left_item_bar_x + 3, top_item_bar_y);
    WritePixel(_rp(obj), left_item_bar_x + 4, top_item_bar_y + 1);
    WritePixel(_rp(obj), left_item_bar_x + 2, top_item_bar_y + 2);
    WritePixel(_rp(obj), left_item_bar_x + 3, top_item_bar_y + 2);
    WritePixel(_rp(obj), left_item_bar_x + 2, top_item_bar_y + 3);
    WritePixel(_rp(obj), left_item_bar_x, top_item_bar_y + 3);
    WritePixel(_rp(obj), left_item_bar_x + 1, top_item_bar_y + 4);

    if (data->active == item)
    {
        /* bottom horiz bar */
        SetAPen(_rp(obj), _pens(obj)[MPEN_SHINE]);
        WritePixel(_rp(obj), left_item_bar_x - 1, bottom_item_bar_y + 1);
        SetAPen(_rp(obj), _pens(obj)[MPEN_SHADOW]);
        WritePixel(_rp(obj), right_item_bar_x + 1, bottom_item_bar_y + 1);
        DoMethod(obj,MUIM_DrawBackground, left_item_bar_x - 1, bottom_item_bar_y + 2,
                 item_bar_width + (2 * 1), 1,
                 left_item_bar_x - 1, bottom_item_bar_y + 2, 0);

    }
    /* right vert bar */
    SetAPen(_rp(obj), _pens(obj)[MPEN_SHADOW]);
    WritePixel(_rp(obj), right_item_bar_x - 1, top_item_bar_y + 2);
    RectFill(_rp(obj), right_item_bar_x, top_item_bar_y + 4, right_item_bar_x, bottom_item_bar_y);
    SetAPen(_rp(obj), _pens(obj)[MPEN_HALFSHADOW]);
    WritePixel(_rp(obj), right_item_bar_x - 2, top_item_bar_y + 1);
    WritePixel(_rp(obj), right_item_bar_x - 1, top_item_bar_y + 3);
    WritePixel(_rp(obj), right_item_bar_x, top_item_bar_y + 3);
    SetAPen(_rp(obj), _pens(obj)[MPEN_BACKGROUND]);
    WritePixel(_rp(obj), right_item_bar_x - 3, top_item_bar_y + 1);

    /* text */
    fitwidth = item_bar_width - TEXTSPACING;
    fitlen = TextFit(_rp(obj), ri->text, ri->textlen, &extent, NULL, 1, fitwidth, data->tab_height);
    fitpix = extent.te_Width;
    /*      D(bug("extent for %s (len=%d) in %d pix = %d chars, %d pix [%x,%x,%x]\n", */
    /*  	  ri->text, ri->textlen, fitwidth, fitlen, fitpix, _rp(obj), _rp(obj)->Font, _font(obj))); */
    x = left_item_bar_x + (item_bar_width - fitpix) / 2;
    SetDrMd(_rp(obj), JAM1);
    SetAPen(_rp(obj), _pens(obj)[MPEN_TEXT]);
    Move(_rp(obj), x, text_y);
    Text(_rp(obj), ri->text, fitlen);
}
Esempio n. 7
0
/**************************************************************************
 MUIM_HandleEvent
**************************************************************************/
IPTR Numericbutton__MUIM_HandleEvent(struct IClass *cl, Object *obj, struct MUIP_HandleEvent *msg)
{
    struct Numericbutton_DATA *data = INST_DATA(cl, obj);

    if (!msg->imsg)
    {
        return 0;
    }

    switch(msg->imsg->Class)
    {
    case IDCMP_MOUSEBUTTONS:
        switch(msg->imsg->Code)
        {
        case SELECTDOWN:
            if (_between(_left(obj), msg->imsg->MouseX, _right(obj)) &&
                    _between(_top(obj), msg->imsg->MouseY, _bottom(obj)) &&
                    (muiAreaData(obj)->mad_Flags & MADF_CANDRAW) &&
                    !data->popwin)
            {
                data->knob_clickoffset_x = msg->imsg->MouseX - _mleft(obj);

                if (MakePopupWin(obj, data))
                {
                    DoMethod(_win(obj), MUIM_Window_RemEventHandler, (IPTR)&data->ehn);
                    data->ehn.ehn_Events |= IDCMP_MOUSEMOVE;
                    DoMethod(_win(obj), MUIM_Window_AddEventHandler, (IPTR)&data->ehn);

                    return 0;
                }
            }
            break;

        case SELECTUP:
        case MENUUP:
        case MIDDLEUP:
        default:
            if (data->popwin)
            {
                KillPopupWin(obj, data);
                if ((msg->imsg->Code == SELECTUP))
                {
                    set(obj, MUIA_Numeric_Value, data->knob_val);
                }
                return 0;
            }
            break;


        } /* switch(msg->imsg->Code) */
        break;

    case IDCMP_MOUSEMOVE:
        if (data->popwin)
        {
            DrawKnob(obj, data, FALSE);

            return 0;
        }
        break;

    } /* switch(msg->imsg->Class) */

    return 0;
}