PROPTYPE_ANGLE_SCROLL mixed

This commit is contained in:
Andrew 2016-06-02 16:31:12 +03:00
parent a624db90b4
commit e6eb607cc8
2 changed files with 27 additions and 8 deletions

View file

@ -2677,19 +2677,18 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
Shifter.VSplitRight(10.0f, &Shifter, &Inc); Shifter.VSplitRight(10.0f, &Shifter, &Inc);
Shifter.VSplitLeft(10.0f, &Dec, &Shifter); Shifter.VSplitLeft(10.0f, &Dec, &Shifter);
str_format(aBuf, sizeof(aBuf),"%d", pProps[i].m_Value); str_format(aBuf, sizeof(aBuf),"%d", pProps[i].m_Value);
int NewValue = UiDoValueSelector((char *) &pIDs[i], &Shifter, "", pProps[i].m_Value, pProps[i].m_Min, pProps[i].m_Max, 1, 1.0f, "Use left mouse button to drag and change the value. Hold shift to be more precise. Rightclick to edit as text.", false, false, 0);
int NewValue = UiDoValueSelector(&pIDs[i] + 2, &Shifter, "", pProps[i].m_Value, pProps[i].m_Min, pProps[i].m_Max, 1, 1.0f, "Use left mouse button to drag and change the value. Hold shift to be more precise. Rightclick to edit as text.", false, false, 0);
if (NewValue != pProps[i].m_Value) if (NewValue != pProps[i].m_Value)
{ {
*pNewVal = NewValue; *pNewVal = NewValue;
Change = i; Change = i;
} }
if(DoButton_ButtonDec(&pIDs[i], 0, 0, &Dec, 0, "Decrease")) if(DoButton_ButtonDec((char *) &pIDs[i] +1, 0, 0, &Dec, 0, "Decrease"))
{ {
*pNewVal = pProps[i].m_Value-1; *pNewVal = pProps[i].m_Value-1;
Change = i; Change = i;
} }
if(DoButton_ButtonInc(((char *)&pIDs[i])+1, 0, 0, &Inc, 0, "Increase")) if(DoButton_ButtonInc(((char *)&pIDs[i])+2, 0, 0, &Inc, 0, "Increase"))
{ {
*pNewVal = pProps[i].m_Value+1; *pNewVal = pProps[i].m_Value+1;
Change = i; Change = i;
@ -2721,16 +2720,36 @@ int CEditor::DoProperties(CUIRect *pToolBox, CProperty *pProps, int *pIDs, int *
} }
else if(pProps[i].m_Type == PROPTYPE_ANGLE_SCROLL) else if(pProps[i].m_Type == PROPTYPE_ANGLE_SCROLL)
{ {
CUIRect Inc, Dec;
Shifter.VSplitRight(10.0f, &Shifter, &Inc);
Shifter.VSplitLeft(10.0f, &Dec, &Shifter);
bool Shift = Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT); bool Shift = Input()->KeyIsPressed(KEY_LSHIFT) || Input()->KeyIsPressed(KEY_RSHIFT);
int Value = pProps[i].m_Value; int Value = pProps[i].m_Value;
if (!Shift && UI()->MouseButton(0) && UI()->ActiveItem() == &pIDs[i]) const void *activeItem = UI()->ActiveItem();
if (!Shift && UI()->MouseButton(0) && (activeItem == &pIDs[i] || activeItem == &pIDs[i]+1 || activeItem == &pIDs[i]+2))
Value = (Value / 45) * 45; Value = (Value / 45) * 45;
int NewValue = UiDoValueSelector(&pIDs[i], &Shifter, "", Value, pProps[i].m_Min, Shift ? pProps[i].m_Max : 315, Shift ? 1 : 45, Shift ? 1.0f : 10.0f, "Use left mouse button to drag and change the value. Hold shift to be more precise. Rightclick to edit as text."); int NewValue = UiDoValueSelector(&pIDs[i], &Shifter, "", Value, pProps[i].m_Min, Shift ? pProps[i].m_Max : 315, Shift ? 1 : 45, Shift ? 1.0f : 10.0f, "Use left mouse button to drag and change the value. Hold shift to be more precise. Rightclick to edit as text.",false,false,0);
if(NewValue != pProps[i].m_Value) if(NewValue != pProps[i].m_Value)
{ {
*pNewVal = NewValue; *pNewVal = NewValue;
Change = i; Change = i;
} }
if (DoButton_ButtonDec(&pIDs[i]+1, 0, 0, &Dec, 0, "Decrease"))
{
if (!Shift)
*pNewVal = pProps[i].m_Value - 45;
else
*pNewVal = pProps[i].m_Value - 1;
Change = i;
}
if (DoButton_ButtonInc(&pIDs[i]+ 2, 0, 0, &Inc, 0, "Increase"))
{
if (!Shift)
*pNewVal = pProps[i].m_Value + 45;
else
*pNewVal = pProps[i].m_Value + 1;
Change = i;
}
} }
else if(pProps[i].m_Type == PROPTYPE_COLOR) else if(pProps[i].m_Type == PROPTYPE_COLOR)
{ {

View file

@ -1443,8 +1443,8 @@ int CEditor::PopupSpeedup(CEditor *pEditor, CUIRect View)
}; };
CProperty aProps[] = { CProperty aProps[] = {
{"Force", pEditor->m_SpeedupForce, PROPTYPE_INT_SCROLL, 0, 255}, {"Force", pEditor->m_SpeedupForce, PROPTYPE_INT_STEP, 0, 255},
{"Max Speed", pEditor->m_SpeedupMaxSpeed, PROPTYPE_INT_SCROLL, 0, 255}, {"Max Speed", pEditor->m_SpeedupMaxSpeed, PROPTYPE_INT_STEP, 0, 255},
{"Angle", pEditor->m_SpeedupAngle, PROPTYPE_ANGLE_SCROLL, 0, 359}, {"Angle", pEditor->m_SpeedupAngle, PROPTYPE_ANGLE_SCROLL, 0, 359},
{0}, {0},
}; };