Example #1
0
static void set86s(void) {
    setControlValue('86io', 0, ((~snd86) & 1)+1);
    static short paranum[4] = {0, 1, 3, 2};
    setControlValue('86in', 0, paranum[(snd86 >> 2) & 3]+1);
    setControlValue('86id', 0, (((~snd86) >> 5) & 7)+1);
    setControlValue('86it', 0, (snd86 & 0x10)?1:0);
    setControlValue('86rm', 0, (snd86 & 0x02)?1:0);
}
Example #2
0
void LLButton::setToggleState(BOOL b)
{
	if( b != mToggleState )
	{
		setControlValue(b); // will fire LLControlVariable callbacks (if any)
		mToggleState = b; // may or may not be redundant
	}
}
Example #3
0
void LLSpinCtrl::onCommit()
{
	setTentative(FALSE);

	setControlValue(mValue);

	LLUICtrl::onCommit();
}
Example #4
0
void LLMultiSlider::setSliderValue(const std::string& name, F32 value, BOOL from_event)
{
	// exit if not there
	if(!mValue.has(name)) {
		return;
	}

	value = llclamp( value, mMinValue, mMaxValue );

	// Round to nearest increment (bias towards rounding down)
	value -= mMinValue;
	value += mIncrement/2.0001f;
	value -= fmod(value, mIncrement);
	F32 newValue = mMinValue + value;

	// now, make sure no overlap
	// if we want that
	if(!mAllowOverlap) {
		bool hit = false;

		// look at the current spot
		// and see if anything is there
		LLSD::map_iterator mIt = mValue.beginMap();
		for(;mIt != mValue.endMap(); mIt++) {
			
			F32 testVal = (F32)mIt->second.asReal() - newValue;
			if(testVal > -FLOAT_THRESHOLD && testVal < FLOAT_THRESHOLD &&
				mIt->first != name) {
				hit = true;
				break;
			}
		}

		// if none found, stop
		if(hit) {
			return;
		}
	}
	

	// now set it in the map
	mValue[name] = newValue;

	// set the control if it's the current slider and not from an event
	if (!from_event && name == mCurSlider)
	{
		setControlValue(mValue);
	}
	
	F32 t = (newValue - mMinValue) / (mMaxValue - mMinValue);

	S32 left_edge = mThumbWidth/2;
	S32 right_edge = getRect().getWidth() - (mThumbWidth/2);

	S32 x = left_edge + S32( t * (right_edge - left_edge) );
	mThumbRects[name].mLeft = x - (mThumbWidth/2);
	mThumbRects[name].mRight = x + (mThumbWidth/2);
}
Example #5
0
void LLCheckBoxCtrl::onCommit()
{
	if( getEnabled() )
	{
		setTentative(FALSE);
		setControlValue(getValue());
		LLUICtrl::onCommit();
	}
}
Example #6
0
static void initSoundWindow(void) {
	PicHandle   pict;
	ControlRef  disp;
    BYTE		data[5];
    short		i;
    for (i=0;i<5;i++) {
        data[i] = *(cfg[i]);
    }
    initMixer(data);
    init14(np2cfg.vol14);
    
    snd26 = np2cfg.snd26opt;
    uncheckAllPopupMenuItems('26io', 2, soundWin);
    uncheckAllPopupMenuItems('26in', 4, soundWin);
    uncheckAllPopupMenuItems('26rm', 5, soundWin);
    set26s(snd26, '26io', '26in', '26rm');
	disp = getControlRefByID('BMP ', 0, soundWin);
	setbmp(dipswbmp_getsnd26(snd26), &pict);
	SetControlData(disp, kControlNoPart, kControlPictureHandleTag, sizeof(PicHandle), &pict);

    snd86 = np2cfg.snd86opt;
    uncheckAllPopupMenuItems('86io', 2, soundWin);
    uncheckAllPopupMenuItems('86in', 4, soundWin);
    uncheckAllPopupMenuItems('86id', 8, soundWin);
    set86s();
	disp = getControlRefByID('BMP ', 1, soundWin);
	setbmp(dipswbmp_getsnd86(snd86), &pict);
	SetControlData(disp, kControlNoPart, kControlPictureHandleTag, sizeof(PicHandle), &pict);

    spb = np2cfg.spbopt;
    spbvrc = np2cfg.spb_vrc;								// ver0.30
    uncheckAllPopupMenuItems('spio', 2, soundWin);
    uncheckAllPopupMenuItems('spin', 4, soundWin);
    uncheckAllPopupMenuItems('sprm', 5, soundWin);
    setSPB();
    setControlValue('splv', 0, np2cfg.spb_vrl);
    setControlValue('sprv', 0, np2cfg.spb_x);
	disp = getControlRefByID('BMP ', 2, soundWin);
	setbmp(dipswbmp_getsndspb(spb, spbvrc), &pict);
	SetControlData(disp, kControlNoPart, kControlPictureHandleTag, sizeof(PicHandle), &pict);

    initJoyPad();
}
Example #7
0
void LLButton::setToggleState(BOOL b)
{
	if( b != getToggleState() )
	{
		setControlValue(b); // will fire LLControlVariable callbacks (if any)
		setValue(b);        // may or may not be redundant
		// Unselected label assignments
		autoResize();
	}
}
Example #8
0
static void set26s(BYTE chip, OSType io, OSType inturrupt, OSType rom) {
    BYTE para;
    static short paranum[4] = {0, 3, 1, 2};
    setControlValue(io, 0, ((chip >> 4) & 1)+1);
    setControlValue(inturrupt, 0, paranum[(chip >> 6) & 3]+1);
    para = chip & 7;
    if (para > 4) {
        para = 4;
    }
    setControlValue(rom, 0, para+1);
}
void LLButton::setToggleState(BOOL b)
{
	if( b != getToggleState() )
	{
		setControlValue(b); // will fire LLControlVariable callbacks (if any)
		setValue(b);        // may or may not be redundant
		setFlashing(false);	// stop flash state whenever the selected/unselected state if reset
		// Unselected label assignments
		autoResize();
	}
}
Example #10
0
void LLComboBox::onCommit()
{
	if (mAllowTextEntry && getCurrentIndex() != -1)
	{
		// we have selected an existing item, blitz the manual text entry with
		// the properly capitalized item
		mTextEntry->setValue(getSimple());
		mTextEntry->setTentative(FALSE);
	}
	setControlValue(getValue());
	LLUICtrl::onCommit();
}
void LLMultiSliderCtrl::onCommit()
{
	setTentative(FALSE);

	if( mEditor )
	{
		mEditor->setTentative(FALSE);
	}

	setControlValue(getValueF32());
	LLF32UICtrl::onCommit();
}
Example #12
0
void LLColorSwatchCtrl::set(const LLColor4& color, BOOL update_picker, BOOL from_event)
{
	mColor = color; 
	LLFloaterColorPicker* pickerp = (LLFloaterColorPicker*)mPickerHandle.get();
	if (pickerp && update_picker)
	{
		pickerp->setCurRgb(mColor.mV[VRED], mColor.mV[VGREEN], mColor.mV[VBLUE]);
	}
	if (!from_event)
	{
		setControlValue(mColor.getValue());
	}
}
Example #13
0
BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event)
{
	if (index < 0 || index >= (S32)mRadioButtons.size())
	{
		return FALSE;
	}

	mSelectedIndex = index;

	if (!from_event)
	{
		setControlValue(getSelectedIndex());
	}

	return TRUE;
}
Example #14
0
void LLSearchComboBox::onSelectionCommit()
{
	std::string search_query = getSimple();
	LLStringUtil::trim(search_query);

	// Order of add() and mTextEntry->setText does matter because add() will select first item 
	// in drop down list and its label will be copied to text box rewriting mTextEntry->setText() call
	if(!search_query.empty())
	{
		remove(search_query);
		add(search_query, ADD_TOP);
	}

	mTextEntry->setText(search_query);
	setControlValue(search_query);
}
Example #15
0
void LLSlider::setValue(F32 value, BOOL from_event)
{
	value = llclamp( value, mMinValue, mMaxValue );

	// Round to nearest increment (bias towards rounding down)
	value -= mMinValue;
	value += mIncrement/2.0001f;
	value -= fmod(value, mIncrement);
	value += mMinValue;

	if (!from_event && mValue != value)
	{
		setControlValue(value);
	}

	mValue = value;
	updateThumbRect();
}
BOOL LLRadioGroup::setSelectedIndex(S32 index, BOOL from_event)
{
	if ((S32)mRadioButtons.size() <= index )
	{
		return FALSE;
	}

	if (mSelectedIndex >= 0)
	{
		LLRadioCtrl* old_radio_item = mRadioButtons[mSelectedIndex];
		old_radio_item->setTabStop(false);
		old_radio_item->setValue( FALSE );
	}
	else
	{
		mRadioButtons[0]->setTabStop(false);
	}

	mSelectedIndex = index;

	if (mSelectedIndex >= 0)
	{
		LLRadioCtrl* radio_item = mRadioButtons[mSelectedIndex];
		radio_item->setTabStop(true);
		radio_item->setValue( TRUE );

		if (hasFocus())
		{
			radio_item->focusFirstItem(FALSE, FALSE);
		}
	}

	if (!from_event)
	{
		setControlValue(getValue());
	}

	return TRUE;
}
Example #17
0
 void Knob::valueChanged()
 {
     setControlValue(float(getValue()));
 }
Example #18
0
//-----init
static void initMixer(BYTE *data) {
    short j;
    for (j=0;j<5;j++) {
        setControlValue('vMix', j, *(data+j));
    }
}
Example #19
0
static pascal OSStatus spbproc(EventHandlerCallRef myHandler, EventRef event, void* userData) {
    OSStatus	err = eventNotHandledErr;
	HIPoint		pos;
	Point		p;
	BYTE		bit, b;
	Rect		ctrlbounds, winbounds;
	PicHandle   pict;
	BOOL		redraw = FALSE;

    if (GetEventClass(event)==kEventClassControl && GetEventKind(event)==kEventControlClick ) {
		err = noErr;
        GetEventParameter(event, kEventParamMouseLocation, typeHIPoint, NULL, sizeof(HIPoint), NULL, &pos);
		GetControlBounds((ControlRef)userData, &ctrlbounds);
		GetWindowBounds(soundWin, kWindowContentRgn, &winbounds);
		p.h = (short)pos.x;
		p.v = (short)pos.y;
		p.h -= (ctrlbounds.left + winbounds.left);
		p.h /= 9;
		p.v -= (ctrlbounds.top + winbounds.top);
		p.v /= 9;
		if ((p.v < 1) || (p.v >= 3)) {
			return(err);
		}
		if ((p.h >= 2) && (p.h < 5)) {
			b = spb;
			bit = 0x40 << (2 - p.v);
			switch(p.h) {
				case 2:
					b |= bit;
					break;

				case 3:
					b ^= bit;
					break;

				case 4:
					b &= ~bit;
					break;
			}
			if (spb != b) {
				spb = b;
				set26s(b, 'spio', 'spin', 'sprm');
				redraw = TRUE;
			}
		}
		else if (p.h == 7) {
			spb ^= 0x20;
			redraw = TRUE;
		}
		else if ((p.h >= 10) && (p.h < 12)) {
			b = (BYTE)((p.h - 10) << 4);
			if ((spb ^ b) & 0x10) {
				spb &= ~0x10;
				spb |= b;
				set26s(b, 'spio', 'spin', 'sprm');
				redraw = TRUE;
			}
		}
		else if ((p.h >= 14) && (p.h < 19)) {
			b = (BYTE)(p.h - 14);
			if ((spb ^ b) & 7) {
				spb &= ~0x07;
				spb |= b;
				set26s(b, 'spio', 'spin', 'sprm');
				redraw = TRUE;
			}
		}
		else if ((p.h >= 21) && (p.h < 24)) {
			spbvrc ^= (BYTE)(3 - p.v);
			setControlValue('spvl', 0, (spbvrc & 1)?1:0);
			setControlValue('spvr', 0, (spbvrc & 2)?1:0);
			redraw = TRUE;
		}
		if (redraw) {
			setbmp(dipswbmp_getsndspb(spb, spbvrc), &pict);
			SetControlData((ControlRef)userData, kControlNoPart, kControlPictureHandleTag, sizeof(PicHandle), &pict);
			Draw1Control((ControlRef)userData);
		}
	}

	(void)myHandler;
	(void)userData;
    return err;
}
Example #20
0
static void init14(BYTE *data) {
    short i;
    for (i=0;i<6;i++) {
        setControlValue('vMix', i+10, *(data+i));
    }
}
Example #21
0
static void setSPB(void) {
    set26s(spb, 'spio', 'spin', 'sprm');
    setControlValue('spvl', 0, (spbvrc & 1)?1:0);
    setControlValue('spvr', 0, (spbvrc & 2)?1:0);
}
void LLSpinCtrl::onCommit()
{
	setTentative(FALSE);
	setControlValue(getValueF32());
	LLF32UICtrl::onCommit();
}
Example #23
0
 void Combo::comboBoxChanged(juce::ComboBox*)
 {
     setControlValue(getNormalizedValue(float(getSelectedItemIndex())));
 }