Ejemplo n.º 1
0
//-----------------------------------------------------------------------------
// Function: RegisterGraphItem::RegisterGraphItem()
//-----------------------------------------------------------------------------
RegisterGraphItem::RegisterGraphItem(QSharedPointer<Register> reg,
    QSharedPointer<ExpressionParser> expressionParser, QGraphicsItem* parent):
MemoryVisualizationItem(parent),
register_(reg),
dimensionIndex_(0),
expressionParser_(expressionParser)
{
	Q_ASSERT(register_);

    QBrush brush(KactusColors::REGISTER_COLOR);
	setDefaultBrush(brush);

    updateDisplay();
}
Ejemplo n.º 2
0
//-----------------------------------------------------------------------------
// Function: FieldGraphItem::FieldGraphItem()
//-----------------------------------------------------------------------------
FieldGraphItem::FieldGraphItem( QSharedPointer<Field> field, QSharedPointer<ExpressionParser> expressionParser,
    QGraphicsItem* parent):
MemoryVisualizationItem(parent),
    field_(field),
    expressionParser_(expressionParser)
{
	Q_ASSERT(field_);

    setFlag(QGraphicsItem::ItemIgnoresParentOpacity);

	QBrush brush(KactusColors::FIELD_COLOR);
	setDefaultBrush(brush);

	setNamePosition(VisualizerItem::NAME_CENTERED, VisualizerItem::NAME_BOTTOM);

	setShowExpandableItem(false);
	setExpansionRectVisible(false);

    updateDisplay();
}
Ejemplo n.º 3
0
//-----------------------------------------------------------------------------
// Function: AddressSpaceGapItem()
//-----------------------------------------------------------------------------
AddressSpaceGapItem::AddressSpaceGapItem(AddressSpaceGapItem::AddressPosition addrPos,
                                         QString const& addressSpaceWidth,
                                         QSharedPointer<ExpressionParser> expressionParser,
										 QGraphicsItem* parent):
AddressSpaceVisualizationItem(addressSpaceWidth, expressionParser, parent),
start_(0),
end_(0),
addrPosition_(addrPos) 
{
    setDefaultBrush(QBrush(Qt::white));
    if (addrPos == AddressSpaceGapItem::ALIGN_LEFT)
    {
        setNamePosition(VisualizerItem::NAME_LEFT_ALIGN, VisualizerItem::NAME_MIDDLE);
    }
    else //if (addrPos == AddressSpaceGapItem::ALIGN_RIGHT)
    {
        setNamePosition(VisualizerItem::NAME_RIGHT_ALIGN, VisualizerItem::NAME_MIDDLE);
    }
	setName("...");
    setToolTip("This memory block is unassigned.");
}
Ejemplo n.º 4
0
/*****************************************************
**
**   DcPainter   ---   setBrush
**
******************************************************/
void DcPainter::setBrush( const MBrush &brush )
{
	//printf( "DcPainter::setBrush ok %d style %d color %s stipple file '%s'\n",
		//brush.IsOk(), brush.style, str2char( brush.color.GetAsString()), str2char( brush.filename ));
	if ( ! brush.IsOk() )
	{
		wxLogError( wxT( "DcPainter::setBrush: brush not okay, using default brush" ));
		setDefaultBrush();
	}
	else
	{
  switch ( brush.style )
  {
		case wxTRANSPARENT:
			dc->SetBrush( *wxTRANSPARENT_BRUSH );
			break;
		case wxSTIPPLE:
			{
			/*
			* This section works around a problem in wx version 3 with gtk2 (not gtk3).
			* Backgounds from cache are only painted correctly once, then bg appears black.
			* But reloading the bitmap each time is okay.
			*/
#if ( defined __WXGTK__ && ! defined __WXGTK3__ && wxMAJOR_VERSION == 3 )
				wxBitmap bmp = ImageProvider::get()->getFileBasedBitmap( brush.filename, brush.rotateHue, true );
				if ( bmp.IsOk() )
				{
					dc->SetBrush( bmp );
				}
				else
				{
					wxLogError( wxT( "DcPainter::setBrush: bitmap for brush not okay, using red background instead" ));
					dc->SetBrush( wxBrush( *wxRED ));
				}
				/*
				wxBitmap bmp = ImageProvider::get()->getFileBasedBitmapConservative( brush.filename, brush.rotateHue );
				if ( bmp.IsOk() )
				{
					dc->SetBrush( bmp );
				}
				else
				{
					wxLogError( wxT( "DcPainter::setBrush: bitmap for brush not okay, using red background instead" ));
					dc->SetBrush( wxBrush( *wxRED ));
				}
*/
#else
				wxBitmap *bmp = ImageProvider::get()->getFileBasedBitmapRef( brush.filename, brush.rotateHue );
				if ( bmp->IsOk() )
				{
					dc->SetBrush( wxBrush( *bmp ));
				}
				else
				{
					wxLogError( wxT( "DcPainter::setBrush: bitmap for brush not okay, using red background instead" ));
					dc->SetBrush( wxBrush( *wxRED ));
				}
#endif
			}
			break;
		case wxSOLID:
		case wxBDIAGONAL_HATCH:
		case wxCROSSDIAG_HATCH:
		case wxFDIAGONAL_HATCH:
		case wxCROSS_HATCH:
		case wxHORIZONTAL_HATCH:
		case wxVERTICAL_HATCH:
				if ( brush.color.IsOk())
				{
					dc->SetBrush( wxBrush( brush.color, brush.style ));
				}
				else
				{
					if ( config->colors )
					{
						dc->SetBrush( wxBrush( config->colors->bgColor, brush.style ));
					}
					else
					{
						wxLogError( wxT( "DcPainter::setBrush: cannot set fallback background color, config is NULL, using white instead" ));
						dc->SetBrush( wxBrush( *wxWHITE ));
					}
				}
			break;
		default:
			//wxLogError( wxT( "DcPainter::setBrush: unknown brush style %s" ), brush.toString().c_str() );
			wxLogError( wxT( "DcPainter::setBrush: unknown brush style %s" ), brush.style );
			dc->SetBrush( wxBrush( *wxBLUE ));
			break;
		}
	}
}
Ejemplo n.º 5
0
/*****************************************************
**
**   DcPainter   ---   setDefaults
**
******************************************************/
void DcPainter::setDefaults()
{
	setDefaultPen();
	setDefaultBrush();
	setTextColor( getDefaultTextColor());
}