mirror of
https://github.com/TorqueGameEngines/Torque3D.git
synced 2026-07-15 08:34:40 +00:00
Change to GuiTextEditSliderCtrl
Change dimension elements to a guiTextEditSliderCtrl add a button to copy all elements of the multi dimension class to the platform clipboard
This commit is contained in:
parent
0a7550eeba
commit
92920dbcd9
3 changed files with 53 additions and 12 deletions
|
|
@ -1726,22 +1726,38 @@ void GuiInspectorTypeSFXSourceName::consoleInit()
|
||||||
|
|
||||||
void GuiInspectorType2DValue::constructEditControlChildren(GuiControl* retCtrl, S32 width)
|
void GuiInspectorType2DValue::constructEditControlChildren(GuiControl* retCtrl, S32 width)
|
||||||
{
|
{
|
||||||
mCtrlX = new GuiTextEditCtrl();
|
mCtrlX = new GuiTextEditSliderCtrl();
|
||||||
GuiControl* mLabelX = new GuiControl();
|
GuiControl* mLabelX = new GuiControl();
|
||||||
|
|
||||||
mCtrlY = new GuiTextEditCtrl();
|
mCtrlY = new GuiTextEditSliderCtrl();
|
||||||
GuiControl* mLabelY = new GuiControl();
|
GuiControl* mLabelY = new GuiControl();
|
||||||
|
|
||||||
mScriptValue = new GuiTextCtrl();
|
mScriptValue = new GuiTextCtrl();
|
||||||
|
|
||||||
|
|
||||||
|
mCopyButton = new GuiBitmapButtonCtrl();
|
||||||
|
mCopyButton->setExtent(Point2I(15, 15));
|
||||||
|
mCopyButton->setBitmap(StringTable->insert("ToolsModule:copy_btn_n_image"));
|
||||||
|
mCopyButton->setDataField(StringTable->insert("Profile"), NULL, "GuiButtonProfile");
|
||||||
|
mCopyButton->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
|
||||||
|
mCopyButton->setDataField(StringTable->insert("hovertime"), NULL, "1000");
|
||||||
|
mCopyButton->setDataField(StringTable->insert("tooltip"), NULL, "Copy all values for script.");
|
||||||
|
mCopyButton->registerObject();
|
||||||
|
|
||||||
_registerEditControl(mCtrlX);
|
_registerEditControl(mCtrlX);
|
||||||
_registerEditControl(mCtrlY);
|
_registerEditControl(mCtrlY);
|
||||||
|
|
||||||
mCtrlX->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile");
|
mCtrlX->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile");
|
||||||
mCtrlX->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
|
mCtrlX->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
|
||||||
|
mCtrlX->setDataField(StringTable->insert("format"), NULL, "%.4f");
|
||||||
|
mCtrlX->setDataField(StringTable->insert("range"), NULL, "-1e+03 1e+03");
|
||||||
|
mCtrlX->setDataField(StringTable->insert("increment"), NULL, "0.0001");
|
||||||
|
|
||||||
mCtrlY->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile");
|
mCtrlY->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile");
|
||||||
mCtrlY->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
|
mCtrlY->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
|
||||||
|
mCtrlY->setDataField(StringTable->insert("format"), NULL, "%.4f");
|
||||||
|
mCtrlY->setDataField(StringTable->insert("range"), NULL, "-1e+03 1e+03");
|
||||||
|
mCtrlY->setDataField(StringTable->insert("increment"), NULL, "0.0001");
|
||||||
|
|
||||||
mLabelX->setDataField(StringTable->insert("profile"), NULL, "ToolsGuiXDimensionText");
|
mLabelX->setDataField(StringTable->insert("profile"), NULL, "ToolsGuiXDimensionText");
|
||||||
mLabelY->setDataField(StringTable->insert("profile"), NULL, "ToolsGuiYDimensionText");
|
mLabelY->setDataField(StringTable->insert("profile"), NULL, "ToolsGuiYDimensionText");
|
||||||
|
|
@ -1799,12 +1815,18 @@ void GuiInspectorType2DValue::updateValue()
|
||||||
|
|
||||||
if (elementCount > 0)
|
if (elementCount > 0)
|
||||||
{
|
{
|
||||||
mCtrlX->setText(StringUnit::getUnit(data, 0, " \t\n"));
|
F32 value = dAtof(StringUnit::getUnit(data, 0, " \t\n"));
|
||||||
|
char szBuffer[64];
|
||||||
|
dSprintf(szBuffer, 64, "%.4f", value);
|
||||||
|
mCtrlX->setText(szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elementCount > 1)
|
if (elementCount > 1)
|
||||||
{
|
{
|
||||||
mCtrlY->setText(StringUnit::getUnit(data, 1, " \t\n"));
|
F32 value = dAtof(StringUnit::getUnit(data, 1, " \t\n"));
|
||||||
|
char szBuffer[64];
|
||||||
|
dSprintf(szBuffer, 64, "%.4f", value);
|
||||||
|
mCtrlY->setText(szBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
mScriptValue->setText(data);
|
mScriptValue->setText(data);
|
||||||
|
|
@ -1846,6 +1868,8 @@ bool GuiInspectorType2DValue::updateRects()
|
||||||
mDimensionLabelX->resize(Point2I(fieldExtent.x - dividerPos - dimX, 0), Point2I(dimX, rowSize));
|
mDimensionLabelX->resize(Point2I(fieldExtent.x - dividerPos - dimX, 0), Point2I(dimX, rowSize));
|
||||||
mDimensionLabelY->resize(Point2I(fieldExtent.x - dividerPos - dimX, rowSize + 3), Point2I(dimX, rowSize));
|
mDimensionLabelY->resize(Point2I(fieldExtent.x - dividerPos - dimX, rowSize + 3), Point2I(dimX, rowSize));
|
||||||
|
|
||||||
|
mCopyButton->resize(Point2I(mProfile->mTextOffset.x, rowSize + 3), Point2I(15, 15));
|
||||||
|
|
||||||
mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent);
|
mEdit->resize(mEditCtrlRect.point, mEditCtrlRect.extent);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -1859,13 +1883,16 @@ void GuiInspectorType3DValue::constructEditControlChildren(GuiControl* retCtrl,
|
||||||
{
|
{
|
||||||
Parent::constructEditControlChildren(retCtrl, width);
|
Parent::constructEditControlChildren(retCtrl, width);
|
||||||
|
|
||||||
mCtrlZ = new GuiTextEditCtrl();
|
mCtrlZ = new GuiTextEditSliderCtrl();
|
||||||
GuiControl* mLabelZ = new GuiControl();
|
GuiControl* mLabelZ = new GuiControl();
|
||||||
|
|
||||||
_registerEditControl(mCtrlZ);
|
_registerEditControl(mCtrlZ);
|
||||||
|
|
||||||
mCtrlZ->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile");
|
mCtrlZ->setDataField(StringTable->insert("profile"), NULL, "GuiInspectorTextEditProfile");
|
||||||
mCtrlZ->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
|
mCtrlZ->setDataField(StringTable->insert("tooltipprofile"), NULL, "GuiToolTipProfile");
|
||||||
|
mCtrlZ->setDataField(StringTable->insert("format"), NULL, "%.4f");
|
||||||
|
mCtrlZ->setDataField(StringTable->insert("range"), NULL, "-1e+03 1e+03");
|
||||||
|
mCtrlZ->setDataField(StringTable->insert("increment"), NULL, "0.0001");
|
||||||
|
|
||||||
mLabelZ->setDataField(StringTable->insert("profile"), NULL, "ToolsGuiZDimensionText");
|
mLabelZ->setDataField(StringTable->insert("profile"), NULL, "ToolsGuiZDimensionText");
|
||||||
|
|
||||||
|
|
@ -1913,7 +1940,10 @@ void GuiInspectorType3DValue::updateValue()
|
||||||
|
|
||||||
if (elementCount > 2)
|
if (elementCount > 2)
|
||||||
{
|
{
|
||||||
mCtrlZ->setText(StringUnit::getUnit(data, 2, " \t\n"));
|
F32 value = dAtof(StringUnit::getUnit(data, 2, " \t\n"));
|
||||||
|
char szBuffer[64];
|
||||||
|
dSprintf(szBuffer, 64, "%.4f", value);
|
||||||
|
mCtrlZ->setText(szBuffer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2115,6 +2145,12 @@ GuiControl* GuiInspectorTypePoint3F::constructEditControl()
|
||||||
|
|
||||||
constructEditControlChildren(retCtrl, getWidth());
|
constructEditControlChildren(retCtrl, getWidth());
|
||||||
|
|
||||||
|
addObject(mCopyButton);
|
||||||
|
|
||||||
|
char szBuffer[512];
|
||||||
|
dSprintf(szBuffer, 512, "setClipboard(%d.getText() SPC %d.getText() SPC %d.getText());", mCtrlX->getId(), mCtrlY->getId(), mCtrlZ->getId());
|
||||||
|
mCopyButton->setField("Command", szBuffer);
|
||||||
|
|
||||||
mUseHeightOverride = true;
|
mUseHeightOverride = true;
|
||||||
mHeightOverride = retCtrl->getHeight();
|
mHeightOverride = retCtrl->getHeight();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,6 +42,10 @@
|
||||||
#include "gui/buttons/guiBitmapButtonCtrl.h"
|
#include "gui/buttons/guiBitmapButtonCtrl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _GUITEXTEDITSLIDERCTRL_H_
|
||||||
|
#include "gui/controls/guiTextEditSliderCtrl.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
class GuiPopUpMenuCtrl;
|
class GuiPopUpMenuCtrl;
|
||||||
|
|
||||||
/// A base class for other inspector field types which
|
/// A base class for other inspector field types which
|
||||||
|
|
@ -585,14 +589,15 @@ class GuiInspectorType2DValue : public GuiInspectorField
|
||||||
private:
|
private:
|
||||||
typedef GuiInspectorField Parent;
|
typedef GuiInspectorField Parent;
|
||||||
protected:
|
protected:
|
||||||
GuiTextEditCtrl* mCtrlX;
|
GuiTextEditSliderCtrl* mCtrlX;
|
||||||
GuiTextEditCtrl* mCtrlY;
|
GuiTextEditSliderCtrl* mCtrlY;
|
||||||
GuiTextCtrl* mScriptValue;
|
GuiTextCtrl* mScriptValue;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GuiTextCtrl* mCaptionLabel;
|
GuiTextCtrl* mCaptionLabel;
|
||||||
GuiTextCtrl* mDimensionLabelX;
|
GuiTextCtrl* mDimensionLabelX;
|
||||||
GuiTextCtrl* mDimensionLabelY;
|
GuiTextCtrl* mDimensionLabelY;
|
||||||
|
GuiBitmapButtonCtrl* mCopyButton;
|
||||||
|
|
||||||
virtual void constructEditControlChildren(GuiControl* retCtrl, S32 width);
|
virtual void constructEditControlChildren(GuiControl* retCtrl, S32 width);
|
||||||
virtual void updateValue();
|
virtual void updateValue();
|
||||||
|
|
@ -609,7 +614,7 @@ class GuiInspectorType3DValue : public GuiInspectorType2DValue
|
||||||
private:
|
private:
|
||||||
typedef GuiInspectorType2DValue Parent;
|
typedef GuiInspectorType2DValue Parent;
|
||||||
protected:
|
protected:
|
||||||
GuiTextEditCtrl* mCtrlZ;
|
GuiTextEditSliderCtrl* mCtrlZ;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GuiTextCtrl* mDimensionLabelZ;
|
GuiTextCtrl* mDimensionLabelZ;
|
||||||
|
|
|
||||||
|
|
@ -331,12 +331,12 @@ void GuiInspectorField::setData( const char* data, bool callbacks )
|
||||||
|| type == TypeColorF
|
|| type == TypeColorF
|
||||||
|| type == TypePoint2I
|
|| type == TypePoint2I
|
||||||
|| type == TypePoint2F
|
|| type == TypePoint2F
|
||||||
//|| type == TypePoint3F
|
|| type == TypePoint3F
|
||||||
|| type == TypePoint4F
|
|| type == TypePoint4F
|
||||||
|| type == TypeRectI
|
|| type == TypeRectI
|
||||||
|| type == TypeRectF
|
|| type == TypeRectF
|
||||||
//|| type == TypeMatrixPosition
|
|| type == TypeMatrixPosition
|
||||||
//|| type == TypeMatrixRotation
|
|| type == TypeMatrixRotation
|
||||||
|| type == TypeBox3F
|
|| type == TypeBox3F
|
||||||
|| type == TypeRectUV
|
|| type == TypeRectUV
|
||||||
|| type == TypeRotationF)
|
|| type == TypeRotationF)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue