void SVGAnimateColorElement::applyAnimatedValueToElement() { if (isAdditive()) setTargetAttributeAnimatedValue(ColorDistance::addColorsAndClamp(m_baseColor, m_animatedColor).name()); else setTargetAttributeAnimatedValue(m_animatedColor.name()); }
// // addMessage // // Add a message to the dialog using filters in the filterlist // Note: Filters are inclusive. If no match on any filter, then the message // will not be added // Filters can be additive or subtractive. If there is a match on an // additive filter the msg is added, match on subtractive it is not // added. Filters are processed in order as added therefore any filter // can override a previous filters affect on a message. // void MsgDialog::addMessage(QString &string) { #ifdef DEBUGMSG qDebug("addMessage() '%s'", string.ascii() ); #endif bool bAdd = !isAdditive(); // iterate through filters QStringList::Iterator filterIt; for(filterIt = m_filterList.begin(); filterIt != m_filterList.end(); filterIt++) { QRegExp re(*filterIt); // if additive and we ahve a match add it if ( -1 != re.match(string) ) bAdd = isAdditive(); } // end for all filters if (bAdd & !m_bScrollLock) { m_nShown++; // delete the filter string if we are not showing it if (!m_bShowType) { int index = string.find(':'); if (index) { QString temp(string.right(string.length() - (index + 1))); appendWithWrap(temp); // appendWithWrap(QString(string.right(string.length() - index))); } } else appendWithWrap(string); } } // end addMessage()
bool SVGAnimateMotionElement::calculateFromAndByValues(const String& fromString, const String& byString) { m_hasToPointAtEndOfDuration = false; if (animationMode() == ByAnimation && !isAdditive()) return false; parsePoint(fromString, m_fromPoint); FloatPoint byPoint; parsePoint(byString, byPoint); m_toPoint = FloatPoint(m_fromPoint.x() + byPoint.x(), m_fromPoint.y() + byPoint.y()); return true; }
bool SVGAnimateElement::calculateFromAndByValues(const String& fromString, const String& byString) { SVGElement* targetElement = this->targetElement(); if (!targetElement) return false; if (animationMode() == ByAnimation && !isAdditive()) return false; ASSERT(!hasTagName(SVGNames::setTag)); determinePropertyValueTypes(fromString, byString); ensureAnimator()->calculateFromAndByValues(m_fromType, m_toType, fromString, byString); ASSERT(m_animatedPropertyType == m_animator->type()); return true; }
void SVGAnimateTransformElement::calculateAnimatedValue(float percentage, unsigned repeat, SVGSMILElement* resultElement) { if (!hasValidTarget()) return; SVGElement* targetElement = resultElement->targetElement(); RefPtr<SVGTransformList> transformList = transformListFor(targetElement); ASSERT(transformList); ExceptionCode ec; if (!isAdditive()) transformList->clear(ec); if (isAccumulated() && repeat) { SVGTransform accumulatedTransform = SVGTransformDistance(m_fromTransform, m_toTransform).scaledDistance(repeat).addToSVGTransform(SVGTransform()); transformList->appendItem(accumulatedTransform, ec); } SVGTransform transform = SVGTransformDistance(m_fromTransform, m_toTransform).scaledDistance(percentage).addToSVGTransform(m_fromTransform); transformList->appendItem(transform, ec); }
bool SVGAnimateElement::calculateFromAndByValues(const String& fromString, const String& byString) { SVGElement* targetElement = this->targetElement(); if (!targetElement) return false; if (animationMode() == ByAnimation && !isAdditive()) return false; // from-by animation may only be used with attributes that support addition (e.g. most numeric attributes). if (animationMode() == FromByAnimation && !animatedPropertyTypeSupportsAddition()) return false; ASSERT(!isSVGSetElement(*this)); determinePropertyValueTypes(fromString, byString); ensureAnimator()->calculateFromAndByValues(m_fromProperty, m_toProperty, fromString, byString); return true; }
// // refresh() // // Apply active filters to messages in editline // void MsgDialog::refresh(void) { #ifdef DEBUGMSG qDebug("refresh()"); #endif if (!m_pEdit) return; m_pEdit->clear(); m_nShown = 0; // add the strings from the current array if (m_pStringList) { QStringList::Iterator strIt; m_nIndex = 0; for (strIt = m_pStringList->begin(); strIt != m_pStringList->end();++strIt ) { m_nIndex++; addMessage(*strIt); } } // end if m_pStringList // update the status bar QString temp(""); temp.sprintf("%d", m_nShown); m_pStatusBarMsgcount->setText(temp); if (isAdditive()) temp = " + "; else temp = " - "; QStringList::Iterator filterIt; for(filterIt = m_filterList.begin(); filterIt != m_filterList.end(); filterIt++) { temp += ", "; temp += *filterIt; } m_pStatusBarFilter->setText(temp); } // end refresh()
PassRefPtr<CSSTransformNonInterpolableValue> composite( const CSSTransformNonInterpolableValue& other, double otherProgress) { DCHECK(!isAdditive()); if (other.m_isSingle) { DCHECK_EQ(otherProgress, 0); DCHECK(other.isAdditive()); TransformOperations result; result.operations() = concat(transform(), other.transform()); return create(std::move(result)); } DCHECK(other.m_isStartAdditive || other.m_isEndAdditive); TransformOperations start; start.operations() = other.m_isStartAdditive ? concat(transform(), other.m_start) : other.m_start.operations(); TransformOperations end; end.operations() = other.m_isEndAdditive ? concat(transform(), other.m_end) : other.m_end.operations(); return create(end.blend(start, otherProgress)); }
void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned, SVGSMILElement*) { SVGElement* targetElement = this->targetElement(); if (!targetElement) return; AffineTransform* transform = targetElement->supplementalTransform(); if (!transform) return; if (RenderObject* targetRenderer = targetElement->renderer()) targetRenderer->setNeedsTransformUpdate(); if (!isAdditive()) transform->makeIdentity(); // FIXME: Implement accumulate. if (animationMode() == PathAnimation) { ASSERT(!animationPath().isEmpty()); Path path = animationPath(); float positionOnPath = path.length() * percentage; bool ok; FloatPoint position = path.pointAtLength(positionOnPath, ok); if (ok) { transform->translate(position.x(), position.y()); RotateMode rotateMode = this->rotateMode(); if (rotateMode == RotateAuto || rotateMode == RotateAutoReverse) { float angle = path.normalAngleAtLength(positionOnPath, ok); if (rotateMode == RotateAutoReverse) angle += 180; transform->rotate(angle); } } return; } FloatSize diff = m_toPoint - m_fromPoint; transform->translate(diff.width() * percentage + m_fromPoint.x(), diff.height() * percentage + m_fromPoint.y()); }
void SVGAnimateMotionElement::calculateAnimatedValue(float percentage, unsigned repeatCount, SVGSMILElement*) { SVGElement* targetElement = this->targetElement(); if (!targetElement) return; AffineTransform* transform = targetElement->supplementalTransform(); if (!transform) return; if (RenderObject* targetRenderer = targetElement->renderer()) targetRenderer->setNeedsTransformUpdate(); if (!isAdditive()) transform->makeIdentity(); if (animationMode() != PathAnimation) { FloatPoint toPointAtEndOfDuration = m_toPoint; if (isAccumulated() && repeatCount && m_hasToPointAtEndOfDuration) toPointAtEndOfDuration = m_toPointAtEndOfDuration; float animatedX = 0; animateAdditiveNumber(percentage, repeatCount, m_fromPoint.x(), m_toPoint.x(), toPointAtEndOfDuration.x(), animatedX); float animatedY = 0; animateAdditiveNumber(percentage, repeatCount, m_fromPoint.y(), m_toPoint.y(), toPointAtEndOfDuration.y(), animatedY); transform->translate(animatedX, animatedY); return; } buildTransformForProgress(transform, percentage); // Handle accumulate="sum". if (isAccumulated() && repeatCount) { for (unsigned i = 0; i < repeatCount; ++i) buildTransformForProgress(transform, 1); } }
// // Constructor // MsgDialog::MsgDialog(QWidget *parent, const char *name, const QString& prefName, QStringList &list) : SEQWindow(prefName, name, parent, name) { #ifdef DEBUGMSG qDebug("MsgDialog() '%s' List passed by ref with %d elements", name, list.count()); #endif m_bScrollLock = FALSE; m_nButtons = 0; m_nIndent = 5; // num of spaces to indent wrapped lines m_nLockIndex = 0; m_nIndex = 0; m_bUseIndexing = FALSE; m_bShowType = TRUE; m_nShown = 0; m_nEditItem = -1; m_nDeleteItem = -1; m_bAdditiveFilter = FALSE; m_pButtonOver = NULL; m_buttonList.setAutoDelete(false); // use the shared list given to us m_pStringList = &list; // install event filter to catch right clicks to add buttons installEventFilter(this); // top-level layout; a vertical box to contain all widgets and sublayouts QBoxLayout *topLayout = new QVBoxLayout(this); // Make an hbox that will hold the textbox and the row of filterbuttons QBoxLayout *middleLayout = new QHBoxLayout(topLayout); // add the edit m_pEdit = new MyEdit(this, "edit"); m_pEdit->setFrameStyle(QFrame::Panel | QFrame::Sunken); m_pEdit->setReadOnly(TRUE); m_pEdit->setWordWrap(QMultiLineEdit::WidgetWidth); m_pEdit->setWrapPolicy(QMultiLineEdit::AtWhiteSpace); middleLayout->addWidget(m_pEdit); // add a vertical box to hold the button layout and the stretch QBoxLayout *rightLayout = new QVBoxLayout(middleLayout); // add a vertical box to hold the filter buttons m_pButtonsPanel = new QWidget(this, "buttonPanel"); rightLayout->addWidget(m_pButtonsPanel); m_pButtonsLayout = new QVBoxLayout(m_pButtonsPanel); // Make an hbox that will hold the tools QBoxLayout *tools = new QHBoxLayout(m_pButtonsLayout); // Make an bbox that will hold the right tools QBoxLayout *righttools = new QVBoxLayout(tools); // Add an 'additive' vs 'subtractive checkbox m_pAdditiveCheckBox = new QCheckBox("Additive", m_pButtonsPanel); m_pAdditiveCheckBox->setChecked(isAdditive()); connect(m_pAdditiveCheckBox, SIGNAL (toggled(bool)), this, SLOT (setAdditive(bool))); righttools->addWidget(m_pAdditiveCheckBox); // Add a 'scroll-lock' checkbox QCheckBox *pScrollLockCheckBox= new QCheckBox("Lock", m_pButtonsPanel); pScrollLockCheckBox->setChecked(FALSE); connect(pScrollLockCheckBox, SIGNAL (toggled(bool)), this, SLOT (scrollLock(bool))); righttools->addWidget(pScrollLockCheckBox); // Add a 'msg type' checkbox m_pMsgTypeCheckBox = new QCheckBox("Msg Type", m_pButtonsPanel); m_pMsgTypeCheckBox->setChecked(m_bShowType); connect(m_pMsgTypeCheckBox, SIGNAL (toggled(bool)), this, SLOT (showMsgType(bool))); righttools->addWidget(m_pMsgTypeCheckBox); // Add a decrorative frame seperator QFrame *frame = new QFrame(m_pButtonsPanel, "seperator"); frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); frame->setFixedHeight(2); m_pButtonsLayout->addWidget(frame); // // Status Bar // // create a label to look like a status bar QBoxLayout *statusLayout = new QHBoxLayout(topLayout); m_pStatusBarFilter = new QLabel(this); m_pStatusBarFilter->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarFilter, 4); m_pStatusBarMsgcount = new QLabel(this); m_pStatusBarMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarMsgcount, 1); m_pStatusBarTotMsgcount = new QLabel(this); m_pStatusBarTotMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarTotMsgcount, 1); m_pStatusBarLock = new QLabel(this); m_pStatusBarLock->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarLock, 1); // Add an empty widget to fill the space and stretch when resized rightLayout->addStretch(10); // Add popup menu m_pMenu = new QPopupMenu(this, "popup"); m_pMenu->insertItem("&Add Button", this, SLOT(addButton())); m_pMenu->insertSeparator(); m_pMenu->insertItem("&Toggle Controls", this, SLOT(toggleControls())); connect(m_pMenu, SIGNAL (aboutToShow(void)), this, SLOT (menuAboutToShow(void))); // load the preferences load(); // refresh the messages refresh(); } // end constructor
// // Constructor // MsgDialog::MsgDialog(QWidget *parent, const char *name, QStringList &list) // : QDialog(parent, name) : QWidget(parent, name) { #ifdef DEBUGMSG qDebug("MsgDialog() '%s' List passed by ref with %d elements", name, list.count()); #endif m_bScrollLock = FALSE; m_nButtons = 0; m_nIndent = 5; // num of spaces to indent wrapped lines m_nLockIndex = 0; m_nIndex = 0; m_bUseIndexing = FALSE; m_bShowType = TRUE; m_nShown = 0; m_nEditItem = -1; m_bAdditiveFilter = FALSE; #if 0 m_pMsgTypeCheckBox = 0; m_pButtonsPanel = 0; m_pEdit = 0; m_pStatusBar = 0; m_pStatusBarLock = 0; m_pStatusBarMsgcount = 0; m_pStatusBarTotMsgcount = 0; m_pStatusBarFilter = 0; m_pButtonsLayout = 0; m_pMenu = 0; m_pStringList = 0; #endif // Anyone want to explain to me why ShowEQ segfaults upon exit when I // uncomment out the following line. This baffles me.... it acts like // it causes something to get destroyed when it's not supposed to be // - Maerlyn // m_pButtonOver = 0; // use the shared list given to us m_pStringList = &list; // set Title setCaption(QString(name)); // install event filter to catch right clicks to add buttons installEventFilter(this); // top-level layout; a vertical box to contain all widgets and sublayouts QBoxLayout *topLayout = new QVBoxLayout(this); // Make an hbox that will hold the textbox and the row of filterbuttons QBoxLayout *middleLayout = new QHBoxLayout(topLayout); // add the edit // m_pEdit = new QMultiLineEdit(this, "edit"); m_pEdit = new MyEdit(this, "edit"); m_pEdit->setFrameStyle(QFrame::Panel | QFrame::Sunken); m_pEdit->setReadOnly(TRUE); m_pEdit->setFont(QFont("Helvetica", 10)); middleLayout->addWidget(m_pEdit); // add a vertical box to hold the button layout and the stretch QBoxLayout *rightLayout = new QVBoxLayout(middleLayout); // add a vertical box to hold the filter buttons m_pButtonsPanel = new QWidget(this, "buttonPanel"); rightLayout->addWidget(m_pButtonsPanel); m_pButtonsLayout = new QVBoxLayout(m_pButtonsPanel); // Make an hbox that will hold the tools QBoxLayout *tools = new QHBoxLayout(m_pButtonsLayout); // Make an bbox that will hold the right tools QBoxLayout *righttools = new QVBoxLayout(tools); // Add an 'additive' vs 'subtractive checkbox m_pAdditiveCheckBox = new QCheckBox("Additive", m_pButtonsPanel); m_pAdditiveCheckBox->setChecked(isAdditive()); connect(m_pAdditiveCheckBox, SIGNAL (toggled(bool)), this, SLOT (setAdditive(bool))); righttools->addWidget(m_pAdditiveCheckBox); // Add a 'scroll-lock' checkbox QCheckBox *pScrollLockCheckBox= new QCheckBox("Lock", m_pButtonsPanel); pScrollLockCheckBox->setChecked(FALSE); connect(pScrollLockCheckBox, SIGNAL (toggled(bool)), this, SLOT (scrollLock(bool))); righttools->addWidget(pScrollLockCheckBox); // Add a 'msg type' checkbox m_pMsgTypeCheckBox = new QCheckBox("Msg Type", m_pButtonsPanel); m_pMsgTypeCheckBox->setChecked(m_bShowType); connect(m_pMsgTypeCheckBox, SIGNAL (toggled(bool)), this, SLOT (showMsgType(bool))); righttools->addWidget(m_pMsgTypeCheckBox); // Add a decrorative frame seperator QFrame *frame = new QFrame(m_pButtonsPanel, "seperator"); frame->setFrameStyle(QFrame::Panel | QFrame::Sunken); frame->setFixedHeight(2); m_pButtonsLayout->addWidget(frame); // // Status Bar // // create a label to look like a status bar QBoxLayout *statusLayout = new QHBoxLayout(topLayout); m_pStatusBarFilter = new QLabel(this); m_pStatusBarFilter->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarFilter, 4); m_pStatusBarMsgcount = new QLabel(this); m_pStatusBarMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarMsgcount, 1); m_pStatusBarTotMsgcount = new QLabel(this); m_pStatusBarTotMsgcount->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarTotMsgcount, 1); m_pStatusBarLock = new QLabel(this); m_pStatusBarLock->setFrameStyle(QFrame::Panel | QFrame::Sunken); statusLayout->addWidget(m_pStatusBarLock, 1); #if 0 // Add some default filter buttons MyButton *but; for (int i = 0; i < 5; i++) { char temp[15]; sprintf(temp, "Empty%d", i); QString name(temp); QString filter(temp); QString color("Black"); newButton(name, filter, color, FALSE); } #endif // Add an empty widget to fill the space and stretch when resized rightLayout->addStretch(10); // Add popup menu m_pMenu = new QPopupMenu(this, "popup"); m_pMenu->insertItem("&Add Button", this, SLOT(addButton())); m_pMenu->insertSeparator(); m_pMenu->insertItem("&Toggle Controls", this, SLOT(toggleControls())); connect(m_pMenu, SIGNAL (aboutToShow(void)), this, SLOT (menuAboutToShow(void))); // refresh the messages refresh(); } // end constructor