I got bored and put in the math functions from Imprudence.

We need something to show the list - Preferably a bit better than the popup that they use, I'm thinking maybe an expanding sidebar on the build menu?

Oh, minor changes - Texture repeats go up to 1000 now because it has numbers, and I tweaked the primitive params section so it doesn't fall off the window.

Signed-off-by: Beeks <HgDelirium@gmail.com>
This commit is contained in:
Beeks
2010-09-16 22:08:33 -04:00
parent 7f0af74e00
commit d49c92b6fe
9 changed files with 350 additions and 218 deletions

View File

@@ -123,7 +123,7 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::
mEditor = new LLLineEditor( std::string("SpinCtrl Editor"), editor_rect, LLStringUtil::null, font,
MAX_STRING_LENGTH,
&LLSpinCtrl::onEditorCommit, NULL, NULL, this,
&LLLineEditor::prevalidateFloat );
&LLLineEditor::prevalidateASCII );
mEditor->setFollowsLeft();
mEditor->setFollowsBottom();
mEditor->setFocusReceivedCallback( &LLSpinCtrl::onEditorGainFocus, this );
@@ -132,6 +132,7 @@ LLSpinCtrl::LLSpinCtrl( const std::string& name, const LLRect& rect, const std::
// it's easier to understand
//mEditor->setSelectAllonFocusReceived(TRUE);
mEditor->setIgnoreTab(TRUE);
mEditor->setSelectAllonCommit(FALSE);
addChild(mEditor);
updateEditor();
@@ -292,9 +293,10 @@ void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
LLSpinCtrl* self = (LLSpinCtrl*) userdata;
llassert( caller == self->mEditor );
std::string text = self->mEditor->getText();
if( LLLineEditor::postvalidateFloat( text ) )
if( self->mEditor->evaluateFloat() )
{
std::string text = self->mEditor->getText();
LLLocale locale(LLLocale::USER_LOCALE);
F32 val = (F32) atof(text.c_str());
@@ -322,9 +324,17 @@ void LLSpinCtrl::onEditorCommit( LLUICtrl* caller, void *userdata )
success = TRUE;
}
}
self->updateEditor();
else
{
// We want to update the editor in case it fails while blanking -- MC
success = TRUE;
}
if( !success )
if( success )
{
self->updateEditor();
}
else
{
self->reportInvalidData();
}
@@ -396,6 +406,18 @@ void LLSpinCtrl::setLabel(const LLStringExplicit& label)
}
}
BOOL LLSpinCtrl::setLabelArg( const std::string& key, const LLStringExplicit& text )
{
if (mLabelBox)
{
BOOL res = mLabelBox->setTextArg(key, text);
reshape(getRect().getWidth(), getRect().getHeight(), FALSE);
return res;
}
return FALSE;
}
void LLSpinCtrl::setAllowEdit(BOOL allow_edit)
{
mEditor->setEnabled(allow_edit);
@@ -463,6 +485,11 @@ BOOL LLSpinCtrl::handleKeyHere(KEY key, MASK mask)
LLSpinCtrl::onDownBtn(this);
return TRUE;
}
if(key == KEY_RETURN)
{
forceEditorCommit();
return TRUE;
}
}
return FALSE;
}