ultimatepp/uppsrc/Geom/Ctrl/CoordCtrl.cpp
cxl 376c8fcd08 SqlCtrl: ValueMap SqlCtrls::Get, ArrayCtrl: map based Set/Add, fixed some warnings and obsolete pragmas removed
git-svn-id: svn://ultimatepp.org/upp/trunk@6316 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2013-09-05 12:14:09 +00:00

47 lines
767 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);
}
END_UPP_NAMESPACE