Beispiel #1
0
IPTR Colorfield__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg)
{
    struct Colorfield_DATA *data = INST_DATA(cl,obj);

    DoSuperMethodA(cl,obj,(Msg)msg);
    
    if (!(msg->flags & (MADF_DRAWOBJECT | MADF_DRAWUPDATE)))
        return FALSE;

    if (data->flags & FLAG_NO_PEN)
    {
    	static UWORD pat[] = {0x1111,0x2222,0x4444,0x8888};
	
    	SetAfPt(_rp(obj), pat, 2);
	SetABPenDrMd(_rp(obj), _pens(obj)[MPEN_SHADOW], _pens(obj)[MPEN_BACKGROUND],JAM2);

    }
    else
    {
	SetABPenDrMd(_rp(obj), data->pen, 0,JAM1);
    }
    
    RectFill(_rp(obj), _mleft(obj), _mtop(obj), _mright(obj), _mbottom(obj));
    
    SetAfPt(_rp(obj), NULL, 0);
    
    return 0;
}
Beispiel #2
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;
}
Beispiel #3
0
IPTR Pendisplay__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg)
{
    struct Pendisplay_DATA *data = INST_DATA(cl,obj);
    LONG    	    	       color;
    
    DoSuperMethodA(cl,obj,(Msg)msg);
    
    if (!(msg->flags & (MADF_DRAWOBJECT | MADF_DRAWUPDATE)))
        return FALSE;

    if (data->refobj)
    {
    	IPTR val;
	
	get(data->refobj, MUIA_Pendisplay_Pen, &val);	
    	color = (LONG)val;
    }
    else
    {
    	color = data->pen;
    }
    
    if (color == -1)
    {
    	static UWORD pat[] = {0x1111,0x2222,0x4444,0x8888};
	
    	SetAfPt(_rp(obj), pat, 2);
	SetABPenDrMd(_rp(obj), _pens(obj)[MPEN_SHADOW], _pens(obj)[MPEN_BACKGROUND],JAM2);

    }
    else
    {
	SetABPenDrMd(_rp(obj), MUIPEN(color), 0,JAM1);
    }
    
    RectFill(_rp(obj), _mleft(obj), _mtop(obj), _mright(obj), _mbottom(obj));
    
    SetAfPt(_rp(obj), NULL, 0);
    
    return 0;
}
Beispiel #4
0
/**************************************************************************
 MUIM_Draw
**************************************************************************/
IPTR Levelmeter__MUIM_Draw(struct IClass *cl, Object *obj, struct MUIP_Draw *msg)
{
    struct Levelmeter_DATA *data = INST_DATA(cl, obj);
    struct RastPort *rp;
    WORD x1, y1, x2, y2;

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

    if (!(msg->flags & (MADF_DRAWOBJECT | MADF_DRAWUPDATE)))
        return FALSE;

    x1 = _mleft(obj);
    y1 = _mtop(obj);
    x2 = _mright(obj);
    y2 = _mbottom(obj);

    rp = _rp(obj);

    if (msg->flags & MADF_DRAWOBJECT)
    {
        /* Transparent edges */

        DoMethod(obj, MUIM_DrawParentBackground, x1, y1, 2, 1, x1, y1, 0);
        DoMethod(obj, MUIM_DrawParentBackground, x1, y1 + 1, 1, 1, x1, y1 + 1, 0);

        DoMethod(obj, MUIM_DrawParentBackground, x2 - 1, y1, 2, 1, x2 - 1, y1, 0);
        DoMethod(obj, MUIM_DrawParentBackground, x2, y1 + 1, 1, 1, x2, y1 + 1, 0);

        DoMethod(obj, MUIM_DrawParentBackground, x1, y2, 2, 1, x1, y2, 0);
        DoMethod(obj, MUIM_DrawParentBackground, x1, y2 - 1, 1, 1, x1, y2 - 1, 0);

        DoMethod(obj, MUIM_DrawParentBackground, x2 - 1, y2, 2, 1, x2 - 1, y2, 0);
        DoMethod(obj, MUIM_DrawParentBackground, x2, y2 - 1, 1, 1, x2, y2 - 1, 0);

        /* Outer frame */

        SetABPenDrMd(rp, _pens(obj)[MPEN_SHINE], 0, JAM1);
        Move(rp, x1 + 1, y2 - 1);
        Draw(rp, x1, y2 - 2);
        Draw(rp, x1, y1 + 2);
        Draw(rp, x1 + 2, y1);
        Draw(rp, x2 - 2, y1);
        Draw(rp, x2 - 1, y1 + 1);

        SetAPen(rp, _pens(obj)[MPEN_SHADOW]);
        Move(rp, x2, y1 + 2);
        Draw(rp, x2, y2 - 2);
        Draw(rp, x2 - 2, y2);
        Draw(rp, x1 + 2, y2);

        SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]);
        Move(rp, x1 + 1, y2 - 2);
        Draw(rp, x1 + 1, y1 + 2);
        Draw(rp, x1 + 2, y1 + 1);
        Draw(rp, x2 - 2, y1 + 1);

        SetAPen(rp, _pens(obj)[MPEN_HALFSHADOW]);
        Move(rp, x2 - 1, y1 + 2);
        Draw(rp, x2 - 1, y2 - 2);
        Draw(rp, x2 - 2, y2 - 1);
        Draw(rp, x1 + 2, y2 - 1);

        /* Border */

        x1 += OUTERFRAME_X;
        x2 -= OUTERFRAME_X;
        y1 += OUTERFRAME_X;
        y2 -= OUTERFRAME_Y;

        SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]);
        RectFill(rp, x1, y1, x2, y1 + BORDERSIZE_Y - 1);
        RectFill(rp, x1, y1 + BORDERSIZE_Y, x1 + BORDERSIZE_X - 1, y2);
        RectFill(rp, x1 + BORDERSIZE_X - 1, y2 - BORDERSIZE_Y + 1, x2, y2);
        RectFill(rp, x2 - BORDERSIZE_X + 1, y1 + BORDERSIZE_Y, x2, y2 - BORDERSIZE_Y);

        /* Inner Frame */

        x1 += BORDERSIZE_X;
        x2 -= BORDERSIZE_X;
        y1 += BORDERSIZE_Y;
        y2 = y1 + LEVEL_HEIGHT + INNERFRAME_H - 1;

        Move(rp, x1, y1);
        Draw(rp, x1 + 2, y1);
        Draw(rp, x1, y1 + 2);
        Draw(rp, x1, y1 + 1);

        Move(rp, x2, y1);
        Draw(rp, x2 - 2, y1);
        Draw(rp, x2, y1 + 2);
        Draw(rp, x2, y1 + 1);

        Move(rp, x1, y2);
        Draw(rp, x1 + 2, y2);
        Draw(rp, x1, y2 - 2);
        Draw(rp, x1, y2 - 1);

        Move(rp, x2, y2);
        Draw(rp, x2 - 2, y2);
        Draw(rp, x2, y2 - 2);
        Draw(rp, x2, y2 - 1);

        SetAPen(rp, _pens(obj)[MPEN_HALFSHADOW]);
        Move(rp, x1 + 2, y2 - 1);
        Draw(rp, x1, y2 - 3);
        Draw(rp, x1, y1 + 3);
        Draw(rp, x1 + 3, y1);
        Draw(rp, x2 - 3, y1);
        Draw(rp, x2 - 1, y1 + 2);

        SetAPen(rp, _pens(obj)[MPEN_SHINE]);
        Move(rp, x2, y1 + 3);
        Draw(rp, x2, y2 - 3);
        Draw(rp, x2 - 3, y2);
        Draw(rp, x1 + 3, y2);

        SetAPen(rp, _pens(obj)[MPEN_SHADOW]);
        Move(rp, x1 + 3, y1 + 1);
        Draw(rp, x2 - 3, y1 + 1);
        Move(rp, x1 + 1, y1 + 3);
        Draw(rp, x1 + 1, y2 - 3);
        Move(rp, x1 + 3, y2 - 1);
        Draw(rp, x2 - 3, y2 - 1);
        Move(rp, x2 - 1, y1 + 3),
             Draw(rp, x2 - 1, y2 - 3);

        /* Levelmeter bg */

        x1 += INNERFRAME_X;
        x2 -= INNERFRAME_X;
        y1 += INNERFRAME_Y;
        y2 -= INNERFRAME_Y;

        SetAPen(rp, data->levelbgpen);
        RectFill(rp, x1 + 1, y1, x2 - 1, y1);
        RectFill(rp, x1, y1 + 1, x2, y2 - 1);
        RectFill(rp, x1 + 1, y2, x2 - 1, y2);

        SetAPen(rp, _pens(obj)[MPEN_SHADOW]);
        WritePixel(rp, x1, y1);
        WritePixel(rp, x2, y1);
        WritePixel(rp, x1, y2);
        WritePixel(rp, x2, y2);

        /* Levelmeter scale */

        DrawScale(rp, x1, y1, x2, y2, _pens(obj)[MPEN_SHINE]);

        /* Level-Label spacing */

        x1 -= INNERFRAME_X;
        x2 += INNERFRAME_X;
        y1 = y2 + INNERFRAME_Y + 1;

        SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]);
        RectFill(rp, x1, y1, x2, y1 + LEVEL_LABEL_SPACING - 1);

        /* Label Frame */

        y1 += LEVEL_LABEL_SPACING;
        y2 = _mbottom(obj) - OUTERFRAME_Y - BORDERSIZE_Y;

        SetAPen(rp, _pens(obj)[MPEN_HALFSHINE]);
        Move(rp, x1, y1);
        Draw(rp, x1 + 1, y1);
        Draw(rp, x1, y1 + 1);
        Move(rp, x2, y1);
        Draw(rp, x2 - 1, y1);
        Draw(rp, x2, y1 + 1);
        Move(rp, x1, y2);
        Draw(rp, x1 + 1, y2);
        Draw(rp, x1, y2 - 1);
        Move(rp, x2, y2);
        Draw(rp, x2 - 1, y2);
        Draw(rp, x2, y2 - 1);

        SetAPen(rp, _pens(obj)[MPEN_HALFSHADOW]);
        Move(rp, x1 + 1, y2 - 1);
        Draw(rp, x1, y2 - 2);
        Draw(rp, x1, y1 + 2);
        Draw(rp, x1 + 2, y1);
        Draw(rp, x2 - 2, y1);
        Draw(rp, x2 - 1, y1 + 1);

        SetAPen(rp, _pens(obj)[MPEN_SHINE]);
        Move(rp, x2, y1 + 2);
        Draw(rp, x2, y2 - 2);
        Draw(rp, x2 - 2, y2);
        Draw(rp, x1 + 2, y2);

        SetAPen(rp, _pens(obj)[MPEN_SHADOW]);
        RectFill(rp, x1 + 1, y1 + 2, x1 + 1, y2 - 2);
        RectFill(rp, x2 - 1, y1 + 2, x2 - 1, y2 - 2);
        RectFill(rp, x1 + 2, y1 + 1, x2 - 2, y1 + 1);
        RectFill(rp, x1 + 2, y2 - 1, x2 - 2, y2 - 1);

        /* Label Bg */

        RectFill(rp, x1 + 2, y1 +2, x2 - 2, y2 - 2);

    }

    x1 = _mleft(obj) + OUTERFRAME_X + BORDERSIZE_X + INNERFRAME_X;
    x2 = _mright(obj) - OUTERFRAME_X - BORDERSIZE_X - INNERFRAME_X;
    y1 = _mtop(obj) + OUTERFRAME_Y + BORDERSIZE_Y + INNERFRAME_Y;
    y2 = y1 + LEVEL_HEIGHT - 1;

    if (msg->flags & MADF_DRAWUPDATE)
    {
        DrawNeedle(rp, x1, y1, x2, y2, data->prevangle, data->levelbgpen);
    }

    data->prevangle = (double)DoMethod(obj, MUIM_Numeric_ValueToScale, 0, 180);

    DrawNeedle(rp, x1, y1, x2, y2, data->prevangle, _pens(obj)[MPEN_SHINE]);

    return TRUE;
}
Beispiel #5
0
static VOID DrawButtons(struct Toolbar_Data *data, Object *obj, BOOL complete)
{
  struct MUIP_Toolbar_Description *desc = data->Desc;

  Object *par;
  ULONG back;

  get(obj, MUIA_Parent, (ULONG)&par);
  if (par) {
    get(par, MUIA_Background, &back);
    set(obj, MUIA_Background, back);
  }

  if(data->SingleGone) // Just a single button which is going to disappear
  {
    struct TB_Element *tool = data->SingleGone;
    // Should the seperator-lines before and after be deleted?
    UBYTE before = 0;
    UBYTE after = 0;
    WORD x,y;

    if(data->ToolSpace < 0)
    {
      struct MinNode *node = (struct MinNode *)tool;
      struct MinNode *pred = node->mln_Pred;
      struct MinNode *succ = node->mln_Succ;

      if(data->ToolList.mlh_Head != node) // Not the first
        before =     (((struct TB_Element *)pred)->Type == TDT_SPACE && data->GroupSpace != -1)
              ||  (desc[((struct TB_Element *)pred)->Number].Flags & TDF_GONE)     ? 0 : 1;

      after = before + ( (((struct TB_Element *)succ)->Type == TDT_SPACE && data->GroupSpace != -1)
              ||     (desc[((struct TB_Element *)succ)->Number].Flags & TDF_GONE  )    ? 0 : 1);
    }

    x = tool->DstX;
    y = tool->DstY;

    if(data->Horizontal)
      DoMethod(obj, MUIM_DrawBackground, x + before, y, data->ButtonWidth-after, data->ButtonHeight, x+before, y, 0);
    else
      DoMethod(obj, MUIM_DrawBackground, x, y + before, data->ButtonWidth, data->ButtonHeight-after, x, y+before, 0);

    data->SingleGone = NULL;
  }
  else
  {
    UWORD drawback_begin = _mleft(obj);
    UWORD drawback_end = 0;

    struct MinList *list = (struct MinList *)&data->ToolList;
    struct MinNode *node;

    for(node = list->mlh_Head; node->mln_Succ; node = *(struct MinNode **)node)
    {
      struct TB_Element *elem = (struct TB_Element *)node;
      if(complete || elem->Redraw)
      {
        elem->Redraw = FALSE;
        if(elem->Type == TDT_BUTTON)
        {
          struct TB_Element *tool = (struct TB_Element *)elem;
          struct MUIP_Toolbar_Description tdesc = desc[tool->Number];

          if(tdesc.Flags & TDF_GONE)
          {
            drawback_end = tool->DstOffset + 1 + data->ButtonSize;
          }
          else
          {
            BOOL selected;

            if(drawback_begin<drawback_end)
            {
              if(data->Horizontal)
                DoMethod(obj, MUIM_DrawBackground, drawback_begin, _mtop(obj), drawback_end-drawback_begin, data->ButtonHeight, drawback_begin, _mtop(obj), 0);
              else
                DoMethod(obj, MUIM_DrawBackground, _mleft(obj), drawback_begin, data->ButtonWidth, drawback_end-drawback_begin, _mleft(obj), drawback_begin, 0);
            }

            drawback_begin = tool->DstOffset + data->ButtonSize;

            if(data->ToolSpace > 0)
              drawback_end = drawback_begin + data->ToolSpace;

            selected = tdesc.Flags & TDF_SELECTED ? TRUE : FALSE;

            if(tdesc.Flags & TDF_GHOSTED)
                DrawGhosted(tool, data, obj, selected);
            else  DrawButton(tool, data, obj, selected, NOT_THREE_D);
          }
        }
        else // TDT_SPACE
        {
          struct TB_Element *space = (struct TB_Element *)elem;
          if(data->GroupSpace > 0)
            drawback_end = space->DstOffset + space->Size;
        }
      }
    }

    // In case of 'trailing' spaces...
    if(complete)
    {
      if(drawback_begin < (data->Horizontal ? _mright(obj) : _mbottom(obj)))
      {
        if(data->Horizontal)
          DoMethod(obj,MUIM_DrawBackground, drawback_begin, _mtop(obj), _mright(obj)-drawback_begin, data->ButtonHeight, drawback_begin, _mtop(obj), 0);
        else
          DoMethod(obj,MUIM_DrawBackground, _mleft(obj), drawback_begin, data->ButtonWidth, _mbottom(obj)-drawback_begin, _mleft(obj), drawback_begin, 0);
      }
    }
  }
}