ultimatepp/uppsrc/Geom/Ctrl/CoordCtrl.cpp
cxl 8ebdcbb0d5 uppsrc: NAMESPACE_UPP / END_UPP_NAMESPACE removed
git-svn-id: svn://ultimatepp.org/upp/trunk@10186 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2016-08-26 17:15:30 +00:00

47 lines
753 B
C++

#include "GeomCtrl.h"
namespace Upp {
EditDegree::EditDegree()
{
AddFrame(spin);
spin.inc.WhenRepeat = spin.inc.WhenPush = THISBACK(OnInc);
spin.dec.WhenRepeat = spin.dec.WhenPush = THISBACK(OnDec);
}
void EditDegree::OnInc()
{
double a = GetData();
a = floor(Nvl(a) + 1.5);
if(a >= Nvl(GetMax(), +360.0))
a = Nvl(GetMin(), -360.0);
SetData(a);
Action();
}
void EditDegree::OnDec()
{
double a = GetData();
a = ceil(Nvl(a) - 1.5);
if(a <= Nvl(GetMin(), -360.0))
a = Nvl(GetMax(), +360.0);
SetData(a);
Action();
}
bool EditDegree::Key(dword key, int repcnt)
{
if(key == K_ALT_UP)
{
OnInc();
return true;
}
if(key == K_ALT_DOWN)
{
OnDec();
return true;
}
return EditValue<double, ConvertDegree>::Key(key, repcnt);
}
}