ultimatepp/uppsrc/Geom/Ctrl/CoordCtrl.cpp
mdelfede 263ff5f895 changed svn layout
git-svn-id: svn://ultimatepp.org/upp/trunk@281 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2008-06-07 22:31:27 +00:00

48 lines
783 B
C++

#include "GeomCtrl.h"
#pragma hdrstop
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