예제 #1
0
파일: wdisplay.cpp 프로젝트: suyoghc/mixxx
void WDisplay::paintEvent(QPaintEvent* ) {
    QStyleOption option;
    option.initFrom(this);
    QStylePainter p(this);
    p.drawPrimitive(QStyle::PE_Widget, option);

    if (m_pPixmapBack) {
        m_pPixmapBack->draw(0, 0, &p);
    }

    // If we are disabled, use the disabled pixmaps. If not, use the regular
    // pixmaps.
    const QVector<PaintablePointer>& pixmaps = (isDisabled() && m_bDisabledLoaded) ?
            m_disabledPixmaps : m_pixmaps;

    if (pixmaps.empty()) {
        return;
    }

    int idx = getActivePixmapIndex();

    // Clamp active pixmap index to valid ranges.
    if (idx < 0) {
        idx = 0;
    } else if (idx >= pixmaps.size()) {
        idx = pixmaps.size() - 1;
    }

    PaintablePointer pPixmap = pixmaps[idx];
    if (pPixmap) {
        pPixmap->draw(0, 0, &p);
    }
}
예제 #2
0
  void Geometry::enable () 
  {
    if (parent->isStatic()) {
      process_error(RTC_INVALID_OPERATION,"static geometries cannot get enabled");
      return;
    }

    if (isDisabled()) {
      atomic_add(&parent->numIntersectionFilters4,(intersectionFilter4 != NULL) + (occlusionFilter4 != NULL));
      atomic_add(&parent->numIntersectionFilters8,(intersectionFilter8 != NULL) + (occlusionFilter8 != NULL));
      atomic_add(&parent->numIntersectionFilters16,(intersectionFilter16 != NULL) + (occlusionFilter16 != NULL));
    }

    switch (state) {
    case ENABLING:
      break;
    case ENABLED:
      break;
    case MODIFIED:
      break;
    case DISABLING: 
      state = MODIFIED;
      enabling();
      break;
    case DISABLED: 
      state = ENABLING;
      enabling();
      break;
    case ERASING:
      break;
    }
  }
예제 #3
0
BcmPortGroup::LaneMode BcmPortGroup::calculateDesiredLaneMode(
    const std::vector<Port*>& ports, LaneSpeeds laneSpeeds) {
  auto desiredMode = LaneMode::QUAD;
  for (int lane = 0; lane < ports.size(); ++lane) {
    auto port = ports[lane];
    if (!port->isDisabled()) {
      auto neededMode = neededLaneModeForSpeed(port->getSpeed(), laneSpeeds);
      if (neededMode < desiredMode) {
        desiredMode = neededMode;
      }

      // Check that the lane is expected for SINGLE/DUAL modes
      if (desiredMode == LaneMode::SINGLE) {
        if (lane != 0) {
          throw FbossError("Only lane 0 can be enabled in SINGLE mode");
        }
      } else if (desiredMode == LaneMode::DUAL) {
        if (lane != 0 && lane != 2) {
          throw FbossError("Only lanes 0 or 2 can be enabled in DUAL mode");
        }
      }

      VLOG(3) << "Port " << port->getID() << " enabled with speed " <<
        static_cast<int>(port->getSpeed());
    }
  }
  return desiredMode;
}
예제 #4
0
void CModListView::selectMod(int index)
{
	if (index < 0)
	{
		disableModInfo();
	}
	else
	{
		enableModInfo();

		auto mod = modModel->getMod(modModel->modIndexToName(index));

		ui->textBrowser->setHtml(genModInfoText(mod));

		bool hasInvalidDeps = !findInvalidDependencies(modModel->modIndexToName(index)).empty();
		bool hasBlockingMods = !findBlockingMods(modModel->modIndexToName(index)).empty();
		bool hasDependentMods = !findDependentMods(modModel->modIndexToName(index), true).empty();

		ui->disableButton->setVisible(mod.isEnabled());
		ui->enableButton->setVisible(mod.isDisabled());
		ui->installButton->setVisible(mod.isAvailable());
		ui->uninstallButton->setVisible(mod.isInstalled());
		ui->updateButton->setVisible(mod.isUpdateable());

		// Block buttons if action is not allowed at this time
		// TODO: automate handling of some of these cases instead of forcing player
		// to resolve all conflicts manually.
		ui->disableButton->setEnabled(!hasDependentMods);
		ui->enableButton->setEnabled(!hasBlockingMods && !hasInvalidDeps);
		ui->installButton->setEnabled(!hasInvalidDeps);
		ui->uninstallButton->setEnabled(!hasDependentMods);
		ui->updateButton->setEnabled(!hasInvalidDeps && !hasDependentMods);
	}
}
void DateTimeSymbolicFieldElement::setEmptyValue(EventBehavior eventBehavior)
{
    if (isDisabled())
        return;
    m_selectedIndex = invalidIndex;
    updateVisibleValue(eventBehavior);
}
예제 #6
0
void TimelineToolButton::paint(QPainter *painter, const QStyleOptionGraphicsItem *, QWidget *)
{
    painter->save();

    if (m_state == Normal)
        setOpacity(0.8);
    else if (m_state == Pressed)
        setOpacity(0.3);
    else
        setOpacity(1.0);

    if (!isEnabled())
        setOpacity(0.5);

    if (isCheckable()) {
        if (isChecked() || isDisabled())
            m_action->icon().paint(painter,
                                   rect().toRect(),
                                   Qt::AlignCenter,
                                   QIcon::Normal,
                                   QIcon::On);
        else
            m_action->icon().paint(painter,
                                   rect().toRect(),
                                   Qt::AlignCenter,
                                   QIcon::Normal,
                                   QIcon::Off);
    } else
        m_action->icon().paint(painter, rect().toRect());

    painter->restore();
}
예제 #7
0
void ControlBase::onPress(int x, int y, int button){
	if(isDisabled())return;
	controlState = CONTROL_STATE_PRESS;
	bPressed = true;
	ControlEventArgs e(this);
	ofNotifyEvent(press, e);
}
예제 #8
0
파일: button.cpp 프로젝트: DeejStar/xoreos
void WidgetButton::mouseUp(uint8 state, float x, float y) {
	if (isDisabled())
		return;

	playSound("gui_actuse", Sound::kSoundTypeSFX);
	setActive(true);
}
예제 #9
0
CEGUI::Size ColouredListItem::getPixelSize() const
{
	if (isDisabled()) {
		return CEGUI::Size(0, 0);
	}
	return CEGUI::ListboxTextItem::getPixelSize();
}
예제 #10
0
void
Item::paintCell( QPainter * p, const QColorGroup & cg, int column, int width, int align )
{
    bool dirty = false;
    QStringList &cs_m_dirs = CollectionSetup::instance()->m_dirs;

    // Figure out if a child folder is activated
    for ( QStringList::const_iterator iter = cs_m_dirs.begin(); iter != cs_m_dirs.end();
            ++iter )
        if ( ( *iter ).startsWith( m_url.path(1) ) )
            if ( *iter != "/" ) // "/" should not match as a child of "/"
                dirty = true;

    // Use a different color if this folder has an activated child folder
    const QFont f = p->font();
    QColorGroup _cg = cg;
    if ( dirty )
    {
        _cg.setColor( QColorGroup::Text, listView()->colorGroup().link() );
        QFont font = p->font();
        font.setBold( !font.bold() );
        p->setFont( font );
    }

    QCheckListItem::paintCell( p, isDisabled() ? listView()->palette().disabled() : _cg, column, width, align );
    p->setFont( f );
}
예제 #11
0
    void FalagardStaticImage::populateRenderCache()
    {
		d_renderCache.clearCachedImagery();
		StaticImage::populateRenderCache();

        const StateImagery* imagery;
        // get WidgetLookFeel for the assigned look.
        const WidgetLookFeel& wlf = WidgetLookManager::getSingleton().getWidgetLook(d_lookName);

		bool is_enabled = !isDisabled();

        // render frame section
        if (d_frameEnabled)
        {
            imagery = &wlf.getStateImagery(is_enabled ? "EnabledFrame" : "DisabledFrame");
            // peform the rendering operation.
            imagery->render(*this);
        }

        // render background section
        if (d_backgroundEnabled)
        {
            imagery = &wlf.getStateImagery(is_enabled ? "EnabledBackground" : "DisabledBackground");
            // peform the rendering operation.
            imagery->render(*this);
        }

        // render basic imagery
        imagery = &wlf.getStateImagery(is_enabled ? "Enabled" : "Disabled");
        // peform the rendering operation.
        imagery->render(*this);

        // call base class
    }
예제 #12
0
bool ExecutionTracker::BeforeBarrierWait(thrID myself, void * ret_addr,
        pthread_barrier_t * barrier) {
    glock();
    log->BeforeBarrierWait(myself);
    checkBarrierValidity(barrier);
    int target_count = bt->getBarrierCount(barrier);
    int threads_on_barrier = bt->getNumberThreadsWaitingOnBarrier(barrier);
    if (threads_on_barrier + 1 >= target_count) {
        vector<thrID> my_thr = bt->getThreadsWaitingOnBarrier(barrier);
        safe_assert(((unsigned) (my_thr.size() + 1)) 
                == (bt->getBarrierCount(barrier)));
        vector<thrID>::iterator itr;
        for (itr = my_thr.begin(); itr != my_thr.end(); itr++) {
            safe_assert(isDisabled((*itr)));
            enableThread((*itr));
        }
        enableThread(myself);
        bt->clearThreadsWaitingOnBarrier(barrier);
    } else {
        bt->threadWaitingOnBarrier(myself, barrier);
        disableThread(myself);
    }
    SchedPointInfo tmp(ret_addr, "Before Barrier Wait", myself,
            enable_map, IS_NOT_YIELD, barrier);
    schedule(&tmp);
    gunlock();
    pauseThread(myself);
    return false;
}
예제 #13
0
void DateTimeNumericFieldElement::handleKeyboardEvent(KeyboardEvent* keyboardEvent)
{
    ASSERT(!isDisabled());
    if (keyboardEvent->type() != EventTypeNames::keypress)
        return;

    UChar charCode = static_cast<UChar>(keyboardEvent->charCode());
    String number = localeForOwner().convertFromLocalizedNumber(String(&charCode, 1));
    const int digit = number[0] - '0';
    if (digit < 0 || digit > 9)
        return;

    DOMTimeStamp delta = keyboardEvent->timeStamp() - m_lastDigitCharTime;
    m_lastDigitCharTime = keyboardEvent->timeStamp();

    if (delta > typeAheadTimeout)
        m_typeAheadBuffer.clear();
    m_typeAheadBuffer.append(number);

    int newValue = typeAheadValue();
    if (newValue >= m_hardLimits.minimum)
        setValueAsInteger(newValue, DispatchEvent);
    else {
        m_hasValue = false;
        updateVisibleValue(DispatchEvent);
    }

    if (m_typeAheadBuffer.length() >= DateTimeNumericFieldElement::formatValue(m_range.maximum).length() || newValue * 10 > m_range.maximum)
        focusOnNextField();

    keyboardEvent->setDefaultHandled();
}
예제 #14
0
파일: close.cpp 프로젝트: Hellzed/xoreos
void WidgetClose::mouseUp(uint8 state, float x, float y) {
	if (isDisabled())
		return;

	_model->setState("");
	setActive(true);
}
예제 #15
0
	void	FalagardAnimate::drawSelf(float z)
	{
		if( d_needsRedraw )
		{
			d_renderCache.clearCachedImagery();
			d_needsRedraw = false;
			// normal 状态是作为永远显示模式出现的
			drawNormal( z );
			if (isDisabled(true) )
			{
				drawDisabled(z);
			}
			else
			{
				//If pushed or checked draw "Pushed" Layer
				if (isPushed() ) 
				{
					drawPushed(z);
				}
				//Draw "Hover" Layer
				if (isHovering() )
				{
					drawHover(z);
				}
			}
		}
		Window::drawSelf(z);
	}
void DateTimeNumericFieldElement::handleKeyboardEvent(KeyboardEvent* keyboardEvent)
{
    ASSERT(!isDisabled());
    if (keyboardEvent->type() != EventTypeNames::keypress)
        return;

    UChar charCode = static_cast<UChar>(keyboardEvent->charCode());
    String number = localeForOwner().convertFromLocalizedNumber(String(&charCode, 1));
    const int digit = number[0] - '0';
    if (digit < 0 || digit > 9)
        return;

    unsigned maximumLength = DateTimeNumericFieldElement::formatValue(m_range.maximum).length();
    if (m_typeAheadBuffer.length() >= maximumLength) {
        String current = m_typeAheadBuffer.toString();
        m_typeAheadBuffer.clear();
        unsigned desiredLength = maximumLength - 1;
        m_typeAheadBuffer.append(current, current.length() - desiredLength, desiredLength);
    }
    m_typeAheadBuffer.append(number);
    int newValue = typeAheadValue();
    if (newValue >= m_hardLimits.minimum)
        setValueAsInteger(newValue, DispatchEvent);
    else {
        m_hasValue = false;
        updateVisibleValue(DispatchEvent);
    }

    if (m_typeAheadBuffer.length() >= maximumLength || newValue * 10 > m_range.maximum)
        focusOnNextField();

    keyboardEvent->setDefaultHandled();
}
예제 #17
0
/**
 * Reset (initialize) the underlying Probe SimTK::Measure.
 * Only can do this for integrate, minimum, minabs, maximum, 
 * maxabs SimTK::Measures. Else, do no resetting.
 */
void Probe::reset(SimTK::State& s)
{
    const double resetValue = 0.0;
    
    for (int i=0; i<getNumProbeInputs(); ++i) {
        if (!isDisabled()) {
            //cout << "Resetting probe " << getName() << ",  (" << i << " / " << getNumProbeInputs() << ")." << endl;
            //const Measure::Scale& scaleMeasure = Measure::Scale::getAs(afterOperationValues[i]);

            if (getOperation() == "integrate")
                SimTK::Measure::Integrate::getAs(afterOperationValues[i]).setValue(s, resetValue);

            else if (getOperation() == "minimum")
                SimTK::Measure::Minimum::getAs(afterOperationValues[i]).setValue(s, resetValue);

            else if (getOperation() == "minabs")
                SimTK::Measure::MinAbs::getAs(afterOperationValues[i]).setValue(s, resetValue);

            else if (getOperation() == "maximum")
                SimTK::Measure::Maximum::getAs(afterOperationValues[i]).setValue(s, resetValue);

            else if (getOperation() == "maxabs")
                SimTK::Measure::MaxAbs::getAs(afterOperationValues[i]).setValue(s, resetValue);
        }
    }
}
예제 #18
0
bool CGUIObject::StealsMouse(int x, int y)
{
	if (isDisabled())
		return false;
	else
		return InRect(x, y, GetScreenRect());
}
예제 #19
0
파일: checkbox.cpp 프로젝트: Hellzed/xoreos
void WidgetCheckBox::mouseUp(uint8 state, float x, float y) {
	if (isDisabled())
		return;

	if (!_groupMembers.empty()) {
		// Group members, we are a radio button

		bool oldState = _state;

		_down  = false;
		_state = true;
		updateModel(true);

		if (oldState != _state)
			setActive(true);

	} else {
		// No group members, we are a check box

		_state = !_state;
		_down  = false;
		updateModel(true);
		setActive(true);
	}

}
예제 #20
0
void BcmPortGroup::reconfigure(
  const std::shared_ptr<SwitchState>& state,
  LaneMode newLaneMode
) {
  // The logic for this follows the steps required for flex-port support
  // outlined in the sdk documentation.
  VLOG(1) << "Reconfiguring port " << controllingPort_->getBcmPortId()
          << " from " << laneMode_ << " active ports to " << newLaneMode
          << " active ports";

  // 1. disable all group members
  for (auto& bcmPort : allPorts_) {
    auto swPort = bcmPort->getSwitchStatePort(state);
    bcmPort->disable(swPort);
  }

  // 2. remove all ports from the counter DMA and linkscan bitmaps
  // This is done in BcmPort::disable()

  // 3. set the opennslPortControlLanes setting
  setActiveLanes(newLaneMode);

  // 4. enable ports
  for (auto& bcmPort : allPorts_) {
    auto swPort = bcmPort->getSwitchStatePort(state);
    if (!swPort->isDisabled()) {
      bcmPort->enable(swPort);
    }
  }

  // 5. add ports to the counter DMA + linkscan
  // This is done in BcmPort::enable()
}
예제 #21
0
void FilledSlider::paintEvent(QPaintEvent *e) {
	Painter p(this);
	PainterHighQualityEnabler hq(p);

	p.setPen(Qt::NoPen);

	auto masterOpacity = fadeOpacity();
	auto ms = getms();
	auto disabled = isDisabled();
	auto over = getCurrentOverFactor(ms);
	auto lineWidth = _st.lineWidth + ((_st.fullWidth - _st.lineWidth) * over);
	auto lineWidthRounded = qFloor(lineWidth);
	auto lineWidthPartial = lineWidth - lineWidthRounded;
	auto seekRect = getSeekRect();
	auto value = getCurrentValue(ms);
	auto from = seekRect.x(), mid = qRound(from + value * seekRect.width()), end = from + seekRect.width();
	if (mid > from) {
		p.setOpacity(masterOpacity);
		p.fillRect(from, height() - lineWidthRounded, (mid - from), lineWidthRounded, disabled ? _st.disabledFg : _st.activeFg);
		if (lineWidthPartial > 0.01) {
			p.setOpacity(masterOpacity * lineWidthPartial);
			p.fillRect(from, height() - lineWidthRounded - 1, (mid - from), 1, disabled ? _st.disabledFg : _st.activeFg);
		}
	}
	if (end > mid && over > 0) {
		p.setOpacity(masterOpacity * over);
		p.fillRect(mid, height() - lineWidthRounded, (end - mid), lineWidthRounded, _st.inactiveFg);
		if (lineWidthPartial > 0.01) {
			p.setOpacity(masterOpacity * over * lineWidthPartial);
			p.fillRect(mid, height() - lineWidthRounded - 1, (end - mid), 1, _st.inactiveFg);
		}
	}
}
예제 #22
0
void WidgetButton::mouseUp(uint8 UNUSED(state), float UNUSED(x), float UNUSED(y)) {
	if (isDisabled())
		return;

	playSound("gui_actuse", Sound::kSoundTypeSFX);
	setActive(true);
}
예제 #23
0
/**
 * Provide the probe values to be reported that correspond to the probe labels.
 */
SimTK::Vector Probe::getProbeOutputs(const State& s) const 
{
    if (isDisabled()) {
        stringstream errorMessage;
        errorMessage << getConcreteClassName() 
            << ": Cannot get the output from Probe '" 
            << getName() << "' because it has been disabled." << endl;
        throw (Exception(errorMessage.str()));
    }


    // For now, this is scalarized, i.e. compile the result of the separate
    // Measure for each scalar element of the probe input into a SimTK::Vector
    // of outputs.
    SimTK::Vector output(getNumProbeInputs());
    for (int i=0; i<getNumProbeInputs(); ++i) {
        if (getOperation() == "integrate")
            output[i] = getGain() * (afterOperationValues[i].getValue(s) + getInitialConditions()(i));
        else
            output[i] = getGain() * afterOperationValues[i].getValue(s);
    }
    
    return output;

    //return afterOperationValueVector.getValue(s);         // save for when we can directly operate on Vector SimTK::Measures
}
예제 #24
0
void MediaSlider::paintEvent(QPaintEvent *e) {
	Painter p(this);
	PainterHighQualityEnabler hq(p);

	p.setPen(Qt::NoPen);
	p.setOpacity(fadeOpacity());

	auto horizontal = isHorizontal();
	auto ms = getms();
	auto radius = _st.width / 2;
	auto disabled = isDisabled();
	auto over = getCurrentOverFactor(ms);
	auto seekRect = getSeekRect();
	auto value = getCurrentValue(ms);

	// invert colors and value for vertical
	if (!horizontal) value = 1. - value;

	auto markerFrom = (horizontal ? seekRect.x() : seekRect.y());
	auto markerLength = (horizontal ? seekRect.width() : seekRect.height());
	auto from = _alwaysDisplayMarker ? 0 : markerFrom;
	auto length = _alwaysDisplayMarker ? (horizontal ? width() : height()) : markerLength;
	auto mid = qRound(from + value * length);
	auto end = from + length;
	auto activeFg = disabled ? _st.activeFgDisabled : anim::brush(_st.activeFg, _st.activeFgOver, over);
	auto inactiveFg = disabled ? _st.inactiveFgDisabled : anim::brush(_st.inactiveFg, _st.inactiveFgOver, over);
	if (mid > from) {
		auto fromClipRect = horizontal ? QRect(0, 0, mid, height()) : QRect(0, 0, width(), mid);
		auto fromRect = horizontal
			? QRect(from, (height() - _st.width) / 2, mid + radius - from, _st.width)
			: QRect((width() - _st.width) / 2, from, _st.width, mid + radius - from);
		p.setClipRect(fromClipRect);
		p.setBrush(horizontal ? activeFg : inactiveFg);
		p.drawRoundedRect(fromRect, radius, radius);
	}
	if (end > mid) {
		auto endClipRect = horizontal ? QRect(mid, 0, width() - mid, height()) : QRect(0, mid, width(), height() - mid);
		auto endRect = horizontal
			? QRect(mid - radius, (height() - _st.width) / 2, end - (mid - radius), _st.width)
			: QRect((width() - _st.width) / 2, mid - radius, _st.width, end - (mid - radius));
		p.setClipRect(endClipRect);
		p.setBrush(horizontal ? inactiveFg : activeFg);
		p.drawRoundedRect(endRect, radius, radius);
	}
	auto markerSizeRatio = disabled ? 0. : (_alwaysDisplayMarker ? 1. : over);
	if (markerSizeRatio > 0) {
		auto position = qRound(markerFrom + value * markerLength) - (horizontal ? seekRect.x() : seekRect.y());
		auto seekButton = horizontal
			? QRect(position, (height() - _st.seekSize.height()) / 2, _st.seekSize.width(), _st.seekSize.height())
			: QRect((width() - _st.seekSize.width()) / 2, position, _st.seekSize.width(), _st.seekSize.height());
		auto size = horizontal ? _st.seekSize.width() : _st.seekSize.height();
		auto remove = static_cast<int>(((1. - markerSizeRatio) * size) / 2.);
		if (remove * 2 < size) {
			p.setClipRect(rect());
			p.setBrush(activeFg);
			p.drawEllipse(seekButton.marginsRemoved(QMargins(remove, remove, remove, remove)));
		}
	}
}
예제 #25
0
void WidgetCheckBox::mouseUp(uint8 UNUSED(state), float UNUSED(x), float UNUSED(y)) {
	if (isDisabled())
		return;

	setState(!_state);
	playSound("gui_check", Sound::kSoundTypeSFX);
	setActive(true);
}
예제 #26
0
파일: button.cpp 프로젝트: ehalls/xoreos
void WidgetButton::setDisabled(bool disabled) {
	NWNWidget::setDisabled(disabled);

	if (isDisabled())
		_model->setState("disabled");
	else
		_model->setState("up");
}
예제 #27
0
void ColouredListItem::draw(CEGUI::GeometryBuffer& buffer, const CEGUI::Rect& targetRect, float alpha, const CEGUI::Rect* clipper) const
{
	if (isDisabled()) {
		return;
	}
	CEGUI::ListboxTextItem::draw(buffer, targetRect, alpha, clipper);

}
예제 #28
0
파일: close.cpp 프로젝트: Hellzed/xoreos
void WidgetClose::leave() {
	ModelWidget::leave();

	if (isDisabled())
		return;

	_model->setState("");
}
예제 #29
0
void OSToolBarEntry::render(Canvas *canvas, const RECT &ir, int hilited, int pushed) {
  if (hilited && !isDisabled()) {
    if (pushed) 
      canvas->drawSunkenRect(&ir, GetSysColor(COLOR_3DHILIGHT), GetSysColor(COLOR_3DSHADOW));
    else
      canvas->drawSunkenRect(&ir, GetSysColor(COLOR_3DSHADOW), GetSysColor(COLOR_3DHILIGHT));
  }
}
예제 #30
0
void Sensor::checkBroken() {
	if(!isDisabled()) { //se não está bloqueado
		if(isBroken()) { //se estiver avariado
			if(getBrokenFor() == 10) setBroken(false); //ao fim de 10 iterações, volta a estar activo
			else incrementBrokenFor(); //senão, incrementa por um as iterações de há quanto temp está bloquado
		}
	}
}