Пример #1
0
void ChildAlias::mouseDrag (const MouseEvent& e)
{
if (e.mods.isLeftButtonDown()){
   if (e.eventComponent == resizer)
   {
   }
   else
   {
      if (!e.mouseWasClicked ())
      {
		 constrainer->setMinimumOnscreenAmounts(getHeight(), getWidth(), getHeight(), getWidth());
         dragger.dragComponent (this,e, constrainer);
         applyToTarget ("");
		 if(type.containsIgnoreCase("juce::GroupComponent")||
					type.containsIgnoreCase("CabbageImage"))
			toBack();
      }
   }
   if(type.containsIgnoreCase("juce::GroupComponent")||
	   type.containsIgnoreCase("CabbageImage"))
	   toBack();
   else 
	   toFront(true);
}//end of left click check
}
Пример #2
0
void ChildAlias::mouseUp (const MouseEvent& e)
{ 
 ((CabbageMainPanel*)(getTarget()->getParentComponent()))->setMouseState("up");
   if (e.eventComponent == resizer)
   {
   }
   else
   {
      //add this to reset MainComponent to have keyboard focus so that keyboard shortcuts (eg. lock/unlock) still work / intercept the messages
      getTopLevelComponent()->getChildComponent(0)->grabKeyboardFocus(); 
   }
   if (userAdjusting) userStoppedChangingBounds ();
   userAdjusting = false;   
   
   int offX = getProperties().getWithDefault(var::identifier("plantX"), 0);
   int offY = getProperties().getWithDefault(var::identifier("plantY"), 0);
   //update dimensions
   ((CabbageMainPanel*)(getTarget()->getParentComponent()))->currentBounds.setBounds(getPosition().getX()-offX,
																					 getPosition().getY()-offY,
																					 getWidth(),
																					 getHeight());

   applyToTarget("");

   ((CabbageMainPanel*)(getTarget()->getParentComponent()))->sendActionMessage("Message sent from CabbageMainPanel:Up");

   if(type.containsIgnoreCase("CabbageGroupbox")||
	   type.containsIgnoreCase("CabbageImage"))
	   toBack();
   else 
	   toFront(true);


}
Пример #3
0
int main(){
    char str[] = "1-(3+2)*3+4/5";
    int result = 0;
    toBack(str);
    result = toResult();
    printf("%d\n", result);
    return 0;
}
std::shared_ptr<const OsmAnd::ResolvedMapStyle> OsmAnd::MapStylesCollection_P::getResolvedStyleByName(const QString& name) const
{
    QMutexLocker scopedLocker(&_resolvedStylesLock);

    const auto styleName = getFullyQualifiedStyleName(name);

    // Check if such style was already resolved
    auto& resolvedStyle = _resolvedStyles[styleName];
    if (resolvedStyle)
        return resolvedStyle;

    // Get style inheritance chain
    QList< std::shared_ptr<UnresolvedMapStyle> > stylesChain;
    {
        QReadLocker scopedLocker(&_stylesLock);

        auto style = getEditableStyleByName_noSync(name);
        while (style)
        {
            stylesChain.push_back(style);

            // In case this is root-style, do nothing
            if (style->isStandalone())
                break;

            // Otherwise, obtain next parent
            const auto parentStyle = getEditableStyleByName_noSync(style->parentName);
            if (!parentStyle)
            {
                LogPrintf(LogSeverityLevel::Error,
                    "Failed to resolve style '%s': parent-in-chain '%s' was not found",
                    qPrintable(name),
                    qPrintable(style->parentName));
                return nullptr;
            }
            style = parentStyle;
        }
    }

    // From top-most parent to style, load it
    auto itStyle = iteratorOf(stylesChain);
    itStyle.toBack();
    while (itStyle.hasPrevious())
    {
        const auto& style = itStyle.previous();

        if (!style->load())
        {
            LogPrintf(LogSeverityLevel::Error,
                "Failed to resolve style '%s': parent-in-chain '%s' failed to load",
                qPrintable(name),
                qPrintable(style->name));
            return nullptr;
        }
    }

    return ResolvedMapStyle::resolveMapStylesChain(copyAs< QList< std::shared_ptr<const UnresolvedMapStyle> > >(stylesChain));;
}
int MNullBreakIterator::next()
{
    Q_D(MNullBreakIterator);
    int next = d->current + 1;
    if (next >= d->string.length()) {
        next = -1;
        toBack();
    } else {
        d->current = next;
    }
    return next;
}
//! returns the next boundary after the given index. Returns the boundary or -1
//! if none exists. Updates the current index to the resulting value.
int MIcuBreakIterator::next(int index)
{
    Q_D(MIcuBreakIterator);

    int result = d->icuIterator->following(index);

    if (result == BreakIterator::DONE) {
        result = -1;
        toBack();
    }

    return result;
}
Пример #7
0
bool OsmAnd::ResolvedMapStyle_P::collectConstants()
{
    // Process styles chain in reverse order, top-most parent is the last element
    auto citUnresolvedMapStyle = iteratorOf(owner->unresolvedMapStylesChain);
    citUnresolvedMapStyle.toBack();
    while (citUnresolvedMapStyle.hasPrevious())
    {
        const auto& unresolvedMapStyle = citUnresolvedMapStyle.previous();

        for (const auto& constantEntry : rangeOf(constOf(unresolvedMapStyle->constants)))
            _constants[constantEntry.key()] = constantEntry.value();
    }

    return true;
}
//! returns the next boundary index after the current index or -1 if none exists.
//! current index is updated to the resulting value.
int MIcuBreakIterator::next()
{
    Q_D(MIcuBreakIterator);

    int next = d->icuIterator->following(d->current);

    if (next == BreakIterator::DONE) {
        next = -1;
        toBack();
    } else {
        d->current = next;
    }

    return next;
}