Esempio n. 1
0
void wxTextEntry::DoSetValue(const wxString& value, int flags)
{
    if (value != DoGetValue())
    {
        // Use Remove() rather than SelectAll() to avoid unnecessary clipboard
        // operations, and prevent triggering an apparent bug in GTK which
        // causes the subsequent WriteText() to append rather than overwrite.
        {
            EventsSuppressor noevents(this);
            Remove(0, -1);
        }
        EventsSuppressor noeventsIf(this, !(flags & SetValue_SendEvent));
        WriteText(value);
    }
    else if (flags & SetValue_SendEvent)
        SendTextUpdatedEvent(GetEditableWindow());

    SetInsertionPoint(0);
}
Esempio n. 2
0
GError GProperty::Value(GKeyValue& OutputValue, GTimeInterval& ValidInterval, const GTimeValue TimePos,
						const GValueMethod GetMethod) const {

	GTimeInterval myRange, easeValid, localValid;
	GOORType usedOOR;
	GTimeValue tmpTime, cycledTime;
	GInt32 nCycles;
	GError err;

	//! \todo Implement relative value getting.
	if (GetMethod == G_RELATIVE_VALUE)
		return G_MISSED_FEATURE;

	// if there aren't keys (and the property is keybased), return default/cached value
	if (IsKeyBased() && DoGetKeysCount() <= 0) {
		//ValidInterval = G_FOREVER_TIMEINTERVAL;
		OutputValue = gCachedValue;
		OutputValue.SetTimePosition(TimePos);
		return G_NO_ERROR;
	}

	// set validity intervals to 'forvever'
	localValid = G_FOREVER_TIMEINTERVAL;
	easeValid = G_FOREVER_TIMEINTERVAL;
	myRange = Domain();
	tmpTime = TimePos;

	// apply ease (time curve)
	if (gApplyEase && gEaseProperty) {
		
		GKeyValue easeValue;

		// if ease property is keybased, it must contain at least one key
		if (gEaseProperty->IsKeyBased() && gEaseProperty->KeysCount() > 0) {
			err = gEaseProperty->Value(easeValue, easeValid, tmpTime, G_ABSOLUTE_VALUE);
			if (err != G_NO_ERROR)
				return err;
			tmpTime = easeValue.RealValue();
		}
		// if the ease property is procedural (not keybased) we have to get its value
		else {
			err = gEaseProperty->Value(easeValue, easeValid, tmpTime, G_ABSOLUTE_VALUE);
			if (err != G_NO_ERROR)
				return err;
			tmpTime = easeValue.RealValue();
		}
	}

	err = G_NO_ERROR;
	if (myRange.IsEmpty() || myRange.IsInInterval(tmpTime))
		// in this case we haven't to use OOR
		err = DoGetValue(OutputValue, localValid, tmpTime, GetMethod);
	else {
		// lets see if time is in time range, and get the correct OOR
		if (tmpTime <= myRange.Start())
			usedOOR = OORBefore();
		else
			usedOOR = OORAfter();

		switch (usedOOR) {

			case G_CONSTANT_OOR:
				if (tmpTime < myRange.Start()) {
					err = DoGetValue(OutputValue, localValid, myRange.Start(), GetMethod);
					localValid.Set(G_MIN_REAL, myRange.Start());
				}
				else {
					err = DoGetValue(OutputValue, localValid, myRange.End(), GetMethod);
					localValid.Set(myRange.End(), G_MAX_REAL);
				}
				break;

			case G_LOOP_OOR:
				err = DoGetValue(OutputValue, localValid, myRange.CycleValue(tmpTime), GetMethod);
				break;

			case G_PINGPONG_OOR:
				nCycles = myRange.CyclesCount(tmpTime);
				cycledTime = myRange.CycleValue(tmpTime);
				if (nCycles & 1)
					cycledTime = myRange.End() - (cycledTime - myRange.Start());
				err = DoGetValue(OutputValue, localValid, cycledTime, GetMethod);
				break;
		}
	}

	ValidInterval &= localValid;
	ValidInterval &= easeValid;
	if (ValidInterval.IsEmpty())
		ValidInterval.Set(TimePos, TimePos);

	return err;
}