Exemplo n.º 1
0
void CommandPanel::setBackgroundColor(QColor color)
{
   if(color==backgroundBrush_.color()) return;
   backgroundBrush_.setColor(color);
   disabledTextColor_ = blendColor(color, textColor_);
   repaint(rect());
}
Exemplo n.º 2
0
IndigoDropZone::IndigoDropZone(QWidget *parent) :
   QWidget(parent)
{

    setMouseTracking(true);
    setAutoFillBackground( true );

    colorNormal = QColor( 153, 153, 153 );
    colorHighlight = QColor( 0, 179, 255 );
    transparency = 0.1; // 10%
    colorHighlightAlpha = blendColor(colorNormal,colorHighlight, transparency);


    palette.setColor( QPalette::Background, colorNormal );
    setPalette( palette );


    padding = 6;
    borderHighlight = 3;
    isHighlight = false;

    m_splitter = new QSplitter();
    m_splitter->setHandleWidth(padding);
    m_splitter->setOrientation(Qt::Vertical);
    m_splitter->setStretchFactor(1, 1);
    m_splitter->move(this->pos());

    m_layout = new QVBoxLayout;
    m_layout->setMargin(padding);
    setLayout(m_layout);

    m_placeholder = new QWidget(this);


}
    //________________________________________________________
    bool Configuration::operator == (const Configuration& other ) const
    {

        return
            titleAlignment() == other.titleAlignment() &&
            centerTitleOnFullWidth() == other.centerTitleOnFullWidth() &&
            buttonSize() == other.buttonSize() &&
            frameBorder() == other.frameBorder() &&
            blendColor() == other.blendColor() &&
            sizeGripMode() == other.sizeGripMode() &&
            backgroundOpacity() == other.backgroundOpacity()&&
            separatorMode() == other.separatorMode() &&
            drawTitleOutline() == other.drawTitleOutline() &&
            hideTitleBar() == other.hideTitleBar() &&
            useDropShadows() == other.useDropShadows() &&
            useOxygenShadows() == other.useOxygenShadows() &&
            closeFromMenuButton() == other.closeFromMenuButton() &&
            transparencyEnabled() == other.transparencyEnabled() &&
            useNarrowButtonSpacing() == other.useNarrowButtonSpacing() &&
            useExtendedWindowBorder() == other.useExtendedWindowBorder() &&
            opacityFromStyle() == other.opacityFromStyle() &&
            backgroundOpacity() == other.backgroundOpacity() &&
            animationsEnabled() == other.animationsEnabled() &&
            buttonAnimationsEnabled() == other.buttonAnimationsEnabled() &&
            titleAnimationsEnabled() == other.titleAnimationsEnabled() &&
            shadowAnimationsEnabled() == other.shadowAnimationsEnabled() &&
            tabAnimationsEnabled() == other.tabAnimationsEnabled() &&
            buttonAnimationsDuration() == other.buttonAnimationsDuration() &&
            titleAnimationsDuration() == other.titleAnimationsDuration() &&
            shadowAnimationsDuration() == other.shadowAnimationsDuration() &&
            tabAnimationsDuration() == other.tabAnimationsDuration();

    }
Exemplo n.º 4
0
void CommandPanel::drawPanel(QPainter& painter, const QRect& clipRect)
{
   QColor textColor = palette().color(QPalette::Text);
   QColor backgroundColor = palette().color(QPalette::Background);
   QColor disabledTextColor = blendColor(textColor, backgroundColor);
   //
   painter.setRenderHint(QPainter::TextAntialiasing);
   //
   painter.setPen(Qt::NoPen);
   painter.setBrush(backgroundColor);
   painter.drawRect(clipRect);
   //
   painter.setFont(font());
   painter.setPen(textColor);
   painter.setBackgroundMode(Qt::OpaqueMode);
   painter.setBackground(backgroundColor);
   //
   std::list<CommandOption>::const_iterator it = options_.items().begin(), itEnd = options_.items().end();
   for(int i=0;it!=itEnd;++it, ++i)
   {
      assert(i<(int)rects_.size());
      //
      QRect rect(rects_[i]);
      QRect textRect(rect);
      textRect.setBottom(textRect.bottom()-cUnderlineHeight);
      //
      if(!rect.intersects(clipRect)) continue;
      //
      if(i==pressedIndex_)
      {
         painter.setPen(backgroundColor);
         painter.setBackground(textColor);
         painter.drawText(textRect, Qt::AlignHCenter, it->text());
      }
      else if(enabled_[i])
      {
         painter.setPen(textColor);
         //
         QRect underlineRect(rect.left(), rect.bottom()-cUnderlineHeight,
                             rect.width()-1, cUnderlineHeight);
         if(i==highlightedIndex_ && showHighlight_)
         {
            painter.setBrush(textColor);
            painter.drawRect(underlineRect);
         }
         //
         painter.drawText(textRect, Qt::AlignCenter, it->text());
      }
      else
      {
         painter.setPen(disabledTextColor);
         painter.drawText(textRect, Qt::AlignCenter, it->text());
      }
   }
}
Exemplo n.º 5
0
    //-----------------------------------------------------------------------
    Image *MapBlender::blend (Image *AImage, Image *BImage)
    {
        uchar *DataA = AImage->getData();
        uchar *DataB = BImage->getData();
        mwidth = static_cast <uint> (AImage->getWidth ());
        mheight = static_cast <uint> (AImage->getHeight ()); 
        mBpp = PixelUtil::getNumElemBytes (AImage->getFormat ());

        if ((PixelUtil::getNumElemBytes (BImage->getFormat ()) !=  
             PixelUtil::getNumElemBytes (AImage->getFormat ())) ||
            mwidth != BImage->getWidth () ||
            mheight != BImage->getHeight ())
        {
            String err = "Error: Invalid parameters, No way to Blend";
            OGRE_EXCEPT( Exception::ERR_INVALIDPARAMS, err, "MapBlender::blend" );
        }
        uchar *FinalData = new uchar[mwidth * mheight * mBpp];
        uint row_count = 0;
        const uint image_width_size = mwidth * mBpp;
        const uint bpp = static_cast <uint> (mBpp);
        for (uint y = 0; y < mheight; y++)	
        {
            uint col_count = row_count;
            for (uint x = 0; x < mwidth; x++)
            {
                blendColor (&FinalData[col_count], 
                            &DataA[col_count], 0.5f,
                            &DataB[col_count], 0.5f);
                col_count += bpp;  
            }
            row_count += image_width_size;
        }
        Image *FinalImage = new Image();
        PixelFormat pxlfmt;
        switch  (mBpp)
        {
            case 1:
                pxlfmt = PF_A8;
                break;
            case 3:
                pxlfmt = PF_BYTE_RGB;
                break;
            case 4:
                pxlfmt = PF_BYTE_RGBA;
                break;
        }    
        FinalImage->loadDynamicImage  (FinalData, static_cast <ushort>(mwidth), 
            static_cast <ushort>(mheight), 1, pxlfmt, true); 
        return FinalImage;
    }
Exemplo n.º 6
0
/*!
  \internal
  \fn void SelectedItem::drawBackground(QPainter *painter)
  The background image is created on demand, within this method.
*/
void SelectedItem::drawBackground(QPainter *painter)
{
    QRect rectangle = rect().toRect();

    if ( !background ) {
        // Create on demand.
        QImage bgImage(backgroundFileName);

        blendColor(bgImage,QApplication::palette().color(QPalette::Highlight));
        background = new QPixmap(QPixmap::fromImage(
                    bgImage.scaled(rectangle.width(),rectangle.height(),
                        Qt::IgnoreAspectRatio, Qt::SmoothTransformation)));
    }

    painter->drawPixmap(rectangle.x(),rectangle.y(),*background);
}
Exemplo n.º 7
0
/*!
  \internal
  \fn void SelectedItem::draw(QPainter *painter,const QPixmap &pixmap,int x,int y) const
  Draws the given pixmap in the centre of an area where \a x and \a y indicate the
  top left-hand corner of the area. If this SelectedItem is 'active', draws the pixmap
  with a different appearance.
*/
void SelectedItem::draw(QPainter *painter,const QPixmap &pixmap,int x,int y) const
{
    if ( !pixmap.isNull() ) {
        // Position the image in the centre of this item.
        x += (static_cast<int>(rect().width()) - pixmap.width())/2;
        y += (static_cast<int>(rect().height()) - pixmap.height())/2;

        // The 'active' image has a different appearance.
        if ( active ) {
            QImage img = pixmap.toImage();
            blendColor(img,QApplication::palette().color(QPalette::Highlight));
            painter->drawPixmap(x,y,QPixmap::fromImage(img));
        } else {
            painter->drawPixmap(x,y,pixmap);
        }
    }
}
Exemplo n.º 8
0
CommandPanel::CommandPanel(QWidget *parent) :
   QWidget(parent),
   backgroundBrush_(cDefaultBackgroundColor),
   textColor_(Qt::black),
   disabledTextColor_(blendColor(cDefaultBackgroundColor, Qt::black)),
   highlightedIndex_(-1),
   pressedIndex_(-1),
   useHotkeys_(false),
   showHighlight_(false),
   staticMode_(false)
{
   setMinimumSize(256, 12);
   setMaximumSize(2048, 512);
   //
   rects_.reserve(16);
   selectable_.reserve(16);
   enabled_.reserve(16);
}
    //__________________________________________________
    void Configuration::write( KConfigGroup& group ) const
    {

        Configuration defaultConfiguration;

        if( titleAlignment() != defaultConfiguration.titleAlignment() ) group.writeEntry( OxygenConfig::TITLE_ALIGNMENT, titleAlignmentName( false ) );
        if( centerTitleOnFullWidth() != defaultConfiguration.centerTitleOnFullWidth() ) group.writeEntry( OxygenConfig::CENTER_TITLE_ON_FULL_WIDTH, centerTitleOnFullWidth() );
        if( buttonSize() != defaultConfiguration.buttonSize() ) group.writeEntry( OxygenConfig::BUTTON_SIZE, buttonSizeName( false ) );
        if( blendColor() != defaultConfiguration.blendColor() ) group.writeEntry( OxygenConfig::BLEND_COLOR, blendColorName( false ) );
        if( frameBorder() != defaultConfiguration.frameBorder() ) group.writeEntry( OxygenConfig::FRAME_BORDER, frameBorderName( false ) );
        if( sizeGripMode() != defaultConfiguration.sizeGripMode() ) group.writeEntry( OxygenConfig::SIZE_GRIP_MODE, sizeGripModeName( false ) );

        if( backgroundOpacity() != defaultConfiguration.backgroundOpacity() ) group.writeEntry( OxygenConfig::BACKGROUND_OPACITY, backgroundOpacity() );
        if( opacityFromStyle() != defaultConfiguration.opacityFromStyle() ) group.writeEntry( OxygenConfig::OPACITY_FROM_STYLE, opacityFromStyle() );

        if( separatorMode() != defaultConfiguration.separatorMode() )
        {
            group.writeEntry( OxygenConfig::DRAW_SEPARATOR, separatorMode() != SeparatorNever );
            group.writeEntry( OxygenConfig::SEPARATOR_ACTIVE_ONLY, separatorMode() == SeparatorActive );
        }

        if( drawTitleOutline() != defaultConfiguration.drawTitleOutline() ) group.writeEntry( OxygenConfig::DRAW_TITLE_OUTLINE, drawTitleOutline() );
        if( hideTitleBar() != defaultConfiguration.hideTitleBar() ) group.writeEntry( OxygenConfig::HIDE_TITLEBAR, hideTitleBar() );
        if( useDropShadows() != defaultConfiguration.useDropShadows() ) group.writeEntry( OxygenConfig::USE_DROP_SHADOWS, useDropShadows() );
        if( useOxygenShadows() != defaultConfiguration.useOxygenShadows() ) group.writeEntry( OxygenConfig::USE_OXYGEN_SHADOWS, useOxygenShadows() );
        if( closeFromMenuButton() != defaultConfiguration.closeFromMenuButton() ) group.writeEntry( OxygenConfig::CLOSE_FROM_MENU_BUTTON, closeFromMenuButton() );
        if( useNarrowButtonSpacing() != defaultConfiguration.useNarrowButtonSpacing() ) group.writeEntry( OxygenConfig::NARROW_BUTTON_SPACING, useNarrowButtonSpacing() );
        if( useExtendedWindowBorder() != defaultConfiguration.useExtendedWindowBorder() ) group.writeEntry( OxygenConfig::EXTENDED_WINDOW_BORDERS, useExtendedWindowBorder() );

        // animations
        if( animationsEnabled() != defaultConfiguration.animationsEnabled() ) group.writeEntry( OxygenConfig::ANIMATIONS_ENABLED, animationsEnabled() );
        if( buttonAnimationsEnabled() != defaultConfiguration.buttonAnimationsEnabled() ) group.writeEntry( OxygenConfig::BUTTON_ANIMATIONS_ENABLED, buttonAnimationsEnabled() );
        if( titleAnimationsEnabled() != defaultConfiguration.titleAnimationsEnabled() ) group.writeEntry( OxygenConfig::TITLE_ANIMATIONS_ENABLED, titleAnimationsEnabled() );
        if( shadowAnimationsEnabled() != defaultConfiguration.shadowAnimationsEnabled() ) group.writeEntry( OxygenConfig::SHADOW_ANIMATIONS_ENABLED, shadowAnimationsEnabled() );
        if( tabAnimationsEnabled() != defaultConfiguration.tabAnimationsEnabled() ) group.writeEntry( OxygenConfig::TAB_ANIMATIONS_ENABLED, tabAnimationsEnabled() );

        // animations duration
        if( buttonAnimationsDuration() != defaultConfiguration.buttonAnimationsDuration() ) group.writeEntry( OxygenConfig::BUTTON_ANIMATIONS_DURATION, buttonAnimationsDuration() );
        if( titleAnimationsDuration() != defaultConfiguration.titleAnimationsDuration() ) group.writeEntry( OxygenConfig::TITLE_ANIMATIONS_DURATION, titleAnimationsDuration() );
        if( shadowAnimationsDuration() != defaultConfiguration.shadowAnimationsDuration() ) group.writeEntry( OxygenConfig::SHADOW_ANIMATIONS_DURATION, shadowAnimationsDuration() );
        if( tabAnimationsDuration() != defaultConfiguration.tabAnimationsDuration() ) group.writeEntry( OxygenConfig::TAB_ANIMATIONS_DURATION, tabAnimationsDuration() );

    }
Exemplo n.º 10
0
void updateParticle(struct SPRITE *s)
{

    /* update particles, regardless of whether onscreen or not */
    struct PARTICLE *data = (struct PARTICLE *)s->data;
    data->colorTrans = data->colorTrans + data->rate;
    if (data->colorTrans > 1) {
        data->colorTrans = 0;
        ++data->stage;
    }
    if (data->stage == 3) {
        s->__internal__alive = false;
        return;
    }
    data->size = data->size + data->scaleFactor;
    s->SetScaleX(s, data->size);
    s->SetScaleY(s, data->size);
    s->SetAngle(s, s->GetAngle(s) + data->angle);
    s->__internal_tint = blendColor(data->c[data->stage], data->c[data->stage + 1], data->colorTrans);
    updateSprite(s);

}
    virtual void onDraw(SkCanvas* canvas) {
        if (!fInitialized) {
            this->make_bitmap();
            fInitialized = true;
        }
        canvas->clear(0x00000000);
        {
            SkAutoTUnref<SkImageFilter> bitmapSource(new SkBitmapSource(fBitmap));
            SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED,
                                                         SkXfermode::kSrcIn_Mode));
            SkAutoTUnref<SkImageFilter> blur(new SkBlurImageFilter(4.0f, 4.0f, bitmapSource));
            SkAutoTUnref<SkImageFilter> erode(new SkErodeImageFilter(4, 4, blur));
            SkAutoTUnref<SkImageFilter> color(SkColorFilterImageFilter::Create(cf, erode));
            SkAutoTUnref<SkImageFilter> merge(new SkMergeImageFilter(blur, color));

            SkPaint paint;
            paint.setImageFilter(merge);
            canvas->drawPaint(paint);
        }
        {
            SkAutoTUnref<SkImageFilter> morph(new SkDilateImageFilter(5, 5));

            SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0,
                                    0, SK_Scalar1, 0, 0, 0,
                                    0, 0, SK_Scalar1, 0, 0,
                                    0, 0, 0, SkFloatToScalar(0.5f), 0 };

            SkAutoTUnref<SkColorFilter> matrixFilter(new SkColorMatrixFilter(matrix));
            SkAutoTUnref<SkImageFilter> colorMorph(SkColorFilterImageFilter::Create(matrixFilter, morph));
            SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcOver_Mode));
            SkAutoTUnref<SkImageFilter> blendColor(new SkXfermodeImageFilter(mode, colorMorph));

            SkPaint paint;
            paint.setImageFilter(blendColor);
            canvas->drawBitmap(fBitmap, 100, 0, &paint);
        }
    }
Exemplo n.º 12
0
void GrepOutputDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
{ 
    // there is no function in QString to left-trim. A call to remove this this regexp does the job
    static const QRegExp leftspaces("^\\s*", Qt::CaseSensitive, QRegExp::RegExp);
    
    // rich text component
    const GrepOutputModel *model = dynamic_cast<const GrepOutputModel *>(index.model());
    const GrepOutputItem  *item  = dynamic_cast<const GrepOutputItem *>(model->itemFromIndex(index));

    QStyleOptionViewItemV4 options = option;
    initStyleOption(&options, index);

    // building item representation
    QTextDocument doc;
    QTextCursor cur(&doc);
    
    QPalette::ColorGroup cg = options.state & QStyle::State_Enabled
                                ? QPalette::Normal : QPalette::Disabled;
    QPalette::ColorRole cr  = options.state & QStyle::State_Selected
                                ? QPalette::HighlightedText : QPalette::Text;
    QTextCharFormat fmt = cur.charFormat();
    fmt.setFont(options.font);

    if(item && item->isText())
    {
        // Use custom manual highlighting

        const KDevelop::SimpleRange rng = item->change()->m_range;

        // the line number appears grayed
        fmt.setForeground(options.palette.brush(QPalette::Disabled, cr));
        cur.insertText(i18n("Line %1: ",item->lineNumber()), fmt);
        
        // switch to normal color
        fmt.setForeground(options.palette.brush(cg, cr));
        cur.insertText(item->text().left(rng.start.column).remove(leftspaces), fmt);
        
        fmt.setFontWeight(QFont::Bold);
        // Blend the highlighted background color
        // For some reason, it is extremely slow to use alpha-blending directly here
        QColor bgHighlight = blendColor(option.palette.brush(QPalette::Highlight).color(), option.palette.brush(QPalette::Base).color(), 0.3);
        fmt.setBackground(bgHighlight);
        cur.insertText(item->text().mid(rng.start.column, rng.end.column - rng.start.column), fmt);
        fmt.clearBackground();
        
        fmt.setFontWeight(QFont::Normal);
        cur.insertText(item->text().right(item->text().length() - rng.end.column), fmt);
    }else{
        QString text;
        if(item)
            text = item->text();
        else
            text = index.data().toString();
        // Simply insert the text as html. We use this for the titles.
        doc.setHtml(text);
    }
    
    painter->save();
    options.text = QString();  // text will be drawn separately
    options.widget->style()->drawControl(QStyle::CE_ItemViewItem, &options, painter, options.widget);

    // set correct draw area
    QRect clip = options.widget->style()->subElementRect(QStyle::SE_ItemViewItemText, &options);
    QFontMetrics metrics(options.font);
    painter->translate(clip.topLeft() - QPoint(0, metrics.descent()));

    // We disable the clipping for now, as it leads to strange clipping errors
//     clip.setTopLeft(QPoint(0,0));
    
//     painter->setClipRect(clip);
    QAbstractTextDocumentLayout::PaintContext ctx;
//     ctx.clip = clip;
    painter->setBackground(Qt::transparent);
    doc.documentLayout()->draw(painter, ctx);

    painter->restore();
}
Exemplo n.º 13
0
void IndigoDropZone::setBackgroundColor(const QColor &bgColor){

    colorNormal = bgColor;
    colorHighlightAlpha = blendColor(colorNormal,colorHighlight, transparency);
}
    //__________________________________________________
    Configuration::Configuration( KConfigGroup group )
    {

        // used to set default values when entries are not found in kconfig
        Configuration defaultConfiguration;

        // title alignment
        setTitleAlignment( titleAlignment(
            group.readEntry( OxygenConfig::TITLE_ALIGNMENT,
            defaultConfiguration.titleAlignmentName( false ) ), false ) );

        // center title on full width
        setCenterTitleOnFullWidth( group.readEntry( OxygenConfig::CENTER_TITLE_ON_FULL_WIDTH,
            defaultConfiguration.centerTitleOnFullWidth() ) );

        // button size
        setButtonSize( buttonSize(
            group.readEntry( OxygenConfig::BUTTON_SIZE,
            defaultConfiguration.buttonSizeName( false ) ), false ) );

        // frame border
        setFrameBorder( frameBorder(
            group.readEntry( OxygenConfig::FRAME_BORDER,
            defaultConfiguration.frameBorderName( false ) ), false ) );

        // blend color
        setBlendColor( blendColor(
            group.readEntry( OxygenConfig::BLEND_COLOR,
            defaultConfiguration.blendColorName( false ) ), false ) );

        // size grip
        setSizeGripMode( sizeGripMode(
            group.readEntry( OxygenConfig::SIZE_GRIP_MODE,
            defaultConfiguration.sizeGripModeName( false ) ), false ) );

        // separator mode
        if( !group.readEntry( OxygenConfig::DRAW_SEPARATOR, defaultConfiguration.separatorMode() != SeparatorNever ) )
        {

            setSeparatorMode( SeparatorNever );

        } else if( group.readEntry( OxygenConfig::SEPARATOR_ACTIVE_ONLY, defaultConfiguration.separatorMode() == SeparatorActive ) ) {

            setSeparatorMode( SeparatorActive );

        } else setSeparatorMode( SeparatorAlways );

        // title outline
        setDrawTitleOutline( group.readEntry(
            OxygenConfig::DRAW_TITLE_OUTLINE,
            defaultConfiguration.drawTitleOutline() ) );

        // hide title bar
        setHideTitleBar( group.readEntry(
            OxygenConfig::HIDE_TITLEBAR,
            defaultConfiguration.hideTitleBar() ) );

        // drop shadows
        setUseDropShadows( group.readEntry(
            OxygenConfig::USE_DROP_SHADOWS,
            defaultConfiguration.useDropShadows() ) );

        // oxygen shadows
        setUseOxygenShadows( group.readEntry(
            OxygenConfig::USE_OXYGEN_SHADOWS,
            defaultConfiguration.useOxygenShadows() ) );

        // transparency
        setTransparencyEnabled( group.readEntry(
            OxygenConfig::TRANSPARENCY_ENABLED,
            defaultConfiguration.transparencyEnabled() ) );

        // close from menu button
        setCloseFromMenuButton( group.readEntry(
            OxygenConfig::CLOSE_FROM_MENU_BUTTON,
            defaultConfiguration.closeFromMenuButton() ) );

        // buttonSpacing
        setUseNarrowButtonSpacing( group.readEntry(
            OxygenConfig::NARROW_BUTTON_SPACING,
            defaultConfiguration.useNarrowButtonSpacing() ) );

        // background opacity
        /*
        this is the decoration specific value
        it is overwritten by the style ("common") opacity, if opacityFromStyle is set to true
        */
        setBackgroundOpacity(
            group.readEntry( OxygenConfig::BACKGROUND_OPACITY,
            defaultConfiguration.backgroundOpacity() ) );

        setOpacityFromStyle(
            group.readEntry( OxygenConfig::OPACITY_FROM_STYLE,
            defaultConfiguration.opacityFromStyle() ) );

        // extended window border
        setUseExtendedWindowBorder( group.readEntry(
            OxygenConfig::EXTENDED_WINDOW_BORDERS,
            defaultConfiguration.useExtendedWindowBorder() ) );

        // animations
        setAnimationsEnabled( group.readEntry(
            OxygenConfig::ANIMATIONS_ENABLED,
            defaultConfiguration.animationsEnabled() ) );

        setButtonAnimationsEnabled( group.readEntry(
            OxygenConfig::BUTTON_ANIMATIONS_ENABLED,
            defaultConfiguration.buttonAnimationsEnabled() ) );

        setTitleAnimationsEnabled( group.readEntry(
            OxygenConfig::TITLE_ANIMATIONS_ENABLED,
            defaultConfiguration.titleAnimationsEnabled() ) );

        setShadowAnimationsEnabled( group.readEntry(
            OxygenConfig::SHADOW_ANIMATIONS_ENABLED,
            defaultConfiguration.shadowAnimationsEnabled() ) );

        setTabAnimationsEnabled( group.readEntry(
            OxygenConfig::TAB_ANIMATIONS_ENABLED,
            defaultConfiguration.tabAnimationsEnabled() ) );

        // animations duration
        setButtonAnimationsDuration( group.readEntry(
            OxygenConfig::BUTTON_ANIMATIONS_DURATION,
            defaultConfiguration.buttonAnimationsDuration() ) );

        setTitleAnimationsDuration( group.readEntry(
            OxygenConfig::TITLE_ANIMATIONS_DURATION,
            defaultConfiguration.titleAnimationsDuration() ) );

        setShadowAnimationsDuration( group.readEntry(
            OxygenConfig::SHADOW_ANIMATIONS_DURATION,
            defaultConfiguration.shadowAnimationsDuration() ) );

        setTabAnimationsDuration( group.readEntry(
            OxygenConfig::TAB_ANIMATIONS_DURATION,
            defaultConfiguration.tabAnimationsDuration() ) );

    }
Exemplo n.º 15
0
void MG_poseReader::draw( M3dView & view, const MDagPath & path, 
							 M3dView::DisplayStyle dispStyle,
							 M3dView::DisplayStatus status )
{ 
   
	
	MPlug sizeP (thisMObject(),size);
	double sizeV;
	sizeP.getValue(sizeV);

	MPlug poseMatrixP (thisMObject(),poseMatrix);
	MObject poseMatrixData;
	poseMatrixP.getValue(poseMatrixData);
	MFnMatrixData matrixFn(poseMatrixData);
	MMatrix poseMatrixV =matrixFn.matrix();

	MPlug readerMatrixP (thisMObject(),readerMatrix);
	MObject readerMatrixData;
	readerMatrixP.getValue(readerMatrixData);

	matrixFn.setObject(readerMatrixData);
	MMatrix readerMatrixV =matrixFn.matrix();

	MMatrix poseMatrixFix =poseMatrixV*readerMatrixV.inverse();

	MPlug aimAxisP  (thisMObject(),aimAxis);
	int aimAxisV;
	aimAxisP.getValue(aimAxisV);
	MVector aimBall;

	  
	MPlug readerOnOffP(thisMObject(),readerOnOff);
	MPlug axisOnOffP(thisMObject(),axisOnOff);
	MPlug poseOnOffP(thisMObject(),poseOnOff);

	double readerOnOffV;
	double axisOnOffV;
	double poseOnOffV;

	readerOnOffP.getValue(readerOnOffV);
	axisOnOffP.getValue(axisOnOffV);
	poseOnOffP.getValue(poseOnOffV);

	MPlug xPositiveP  (thisMObject(),xPositive);
	MPlug xNegativeP  (thisMObject(),xNegative);

	double xPositiveV;
	double xNegativeV;

	xPositiveP.getValue(xPositiveV);
	xNegativeP.getValue(xNegativeV);

	double xColor = xPositiveV;
	if (xPositiveV==0)
	{
		xColor=xNegativeV;

	}
	


	MPlug yPositiveP  (thisMObject(),yPositive);
	MPlug yNegativeP  (thisMObject(),yNegative);

	double yPositiveV;
	double yNegativeV;

	yPositiveP.getValue(yPositiveV);
	yNegativeP.getValue(yNegativeV);

	double yColor = yPositiveV;
	if (yPositiveV==0)
	{
		yColor=yNegativeV;

	}

	MPlug zPositiveP  (thisMObject(),zPositive);
	MPlug zNegativeP  (thisMObject(),zNegative);

	double zPositiveV;
	double zNegativeV;

	zPositiveP.getValue(zPositiveV);
	zNegativeP.getValue(zNegativeV);

	double zColor = zPositiveV;
	if (zPositiveV==0)
	{
		zColor=zNegativeV;

	}



		if (aimAxisV==0)
		{
			
			aimBall.x=poseMatrixFix[0][0];
			aimBall.y=poseMatrixFix[0][1];
			aimBall.z=poseMatrixFix[0][2];
		}
		else if (aimAxisV==1)
		{
			
			aimBall.x=poseMatrixFix[1][0];
			aimBall.y=poseMatrixFix[1][1];
			aimBall.z=poseMatrixFix[1][2];

		}else
		{
			
			aimBall.x=poseMatrixFix[2][0];
			aimBall.y=poseMatrixFix[2][1];
			aimBall.z=poseMatrixFix[2][2];
		}
	
      
	//*****************************************************************
	// Initialize opengl and draw
	//*****************************************************************
	view.beginGL();
	glPushAttrib( GL_ALL_ATTRIB_BITS );
	glEnable(GL_BLEND);
	glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
	glLineWidth(2);
	if(status == M3dView::kLead)
		glColor4f(0.0,1.0,0.0,0.3f);
	else
		glColor4f(1.0,1.0,0.0,0.3f);





	MVector baseV(0,0,0);
	MVector xp(1*sizeV,0,0);
	MVector xm(-1*sizeV,0,0);
	MVector yp(0,1*sizeV,0);
	MVector ym(0,-1*sizeV,0);
	MVector zp(0,0,1*sizeV);
	MVector zm(0,0,-1*sizeV);



	double * red;
	red = new double[4];
	red[0]=1;
	red[1]=0;
	red[2]=0;
	red[3]=1;

	double * green;
	green = new double[4];
	green[0]=0;
	green[1]=1;
	green[2]=0;
	green[3]=1;

	double * blue;
	blue = new double[4];
	blue[0]=0;
	blue[1]=0;
	blue[2]=1;
	blue[3]=1;

	double * yellow;
	yellow = new double[4];
	yellow[0]=1;
	yellow[1]=1;
	yellow[2]=0.2;
	yellow[3]=0.3;



	if (readerOnOffV==1)
	{
	drawSphere(sizeV,20,20,baseV,yellow);
	}
	
	
	if  (axisOnOffV==1)
	{
	drawSphere(sizeV/7,15,15,xp,red);
	drawSphere(sizeV/7,15,15,xm,red); 
	drawSphere(sizeV/7,15,15,yp,green);
	drawSphere(sizeV/7,15,15,ym,green);
	drawSphere(sizeV/7,15,15,zp,blue);
	drawSphere(sizeV/7,15,15,zm,blue);
	}
	if (poseOnOffV==1)
	{
	  

	
	double* color = blendColor(xColor,yColor,zColor,1);

	drawSphere(sizeV/7,15,15,aimBall*sizeV,color);
	}

	glDisable(GL_BLEND);
	glPopAttrib();



}