.CtrlLib: TreeCtrl - added setter for Item::margin attribute

.Geom: hrr bug fix (Draw::GetPageSize -> GetPaintRect), minor optimizations (Pointf -> const Pointf&)
.TCore: CalcContext::Global constructor made outline to simplify debugging

git-svn-id: svn://ultimatepp.org/upp/trunk@2911 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
rylek 2010-12-16 09:55:38 +00:00
parent b6be3bc437
commit 1abacfff26
9 changed files with 1475 additions and 1470 deletions

File diff suppressed because it is too large Load diff

View file

@ -982,7 +982,7 @@ void TreeCtrl::Paint(Draw& w)
if(i == 0) if(i == 0)
dri.top++; dri.top++;
} }
if(w.IsPainting(0, y, sz.cx, msz.cy)) { if(w.IsPainting(0, y, sz.cx, msz.cy) && msz.cy > 0) {
w.DrawRect(op.x, op.y, levelcx2, 1, SColorShadow); w.DrawRect(op.x, op.y, levelcx2, 1, SColorShadow);
if(m.canopen || m.child.GetCount()) { if(m.canopen || m.child.GetCount()) {
Image im = m.isopen ? CtrlImg::treeminus() : CtrlImg::treeplus(); Image im = m.isopen ? CtrlImg::treeminus() : CtrlImg::treeplus();

View file

@ -39,6 +39,7 @@ public:
bool canselect; bool canselect;
Node& SetImage(const Image& img) { image = img; return *this; } Node& SetImage(const Image& img) { image = img; return *this; }
Node& SetMargin(int m) { margin = m; return *this; }
Node& Set(const Value& v) { key = value = v; return *this; } Node& Set(const Value& v) { key = value = v; return *this; }
Node& Set(const Value& v, const Value& t) { key = v; value = t; return *this; } Node& Set(const Value& v, const Value& t) { key = v; value = t; return *this; }
Node& SetDisplay(const Display& d) { display = &d; return *this; } Node& SetDisplay(const Display& d) { display = &d; return *this; }

View file

@ -1409,7 +1409,7 @@ void HRR::Paint(Draw& draw, const Matrixf& trg_pix, GisTransform transform,
<< ", is_bw = " << is_bw << ", out_pixel = " << out_pixel << ", out_alpha = " << out_alpha); << ", is_bw = " << is_bw << ", out_pixel = " << out_pixel << ", out_alpha = " << out_alpha);
Matrixf pix_trg = MatrixfInverse(trg_pix); Matrixf pix_trg = MatrixfInverse(trg_pix);
Rect clip = draw.GetPageSize(); //draw.GetClip(); Rect clip = draw.GetPaintRect(); //draw.GetClip();
Rectf csrc = info.log_rect & transform.SourceExtent(Rectf(clip) * pix_trg); Rectf csrc = info.log_rect & transform.SourceExtent(Rectf(clip) * pix_trg);
// Pointf scale = Sizef(1, -1) * Sizef(dest.Size()) / Sizef(src.Size()); // Pointf scale = Sizef(1, -1) * Sizef(dest.Size()) / Sizef(src.Size());
// Pointf delta = Pointf(dest.TopLeft()) - src.BottomLeft() * scale; // Pointf delta = Pointf(dest.TopLeft()) - src.BottomLeft() * scale;

View file

@ -471,11 +471,11 @@ public:
bool Nothing() { count = 0; return false; } bool Nothing() { count = 0; return false; }
void Remove(int index); void Remove(int index);
bool LL(Pointf P1, Pointf Q1, Pointf P2, Pointf Q2); bool LL(const Pointf& P1, const Pointf& Q1, const Pointf& P2, const Pointf& Q2);
bool LC(Pointf P1, Pointf Q1, Pointf C2, double r2); bool LC(const Pointf& P1, const Pointf& Q1, const Pointf& C2, double r2);
bool LA(Pointf P1, Pointf Q1, const VecArcInfo& a2); bool LA(const Pointf& P1, const Pointf& Q1, const VecArcInfo& a2);
bool CC(Pointf C1, double r1, Pointf C2, double r2); bool CC(const Pointf& C1, double r1, const Pointf& C2, double r2);
bool CA(Pointf C1, double r1, const VecArcInfo& a2); bool CA(const Pointf& C1, double r1, const VecArcInfo& a2);
bool AA(const VecArcInfo& a1, const VecArcInfo& a2); bool AA(const VecArcInfo& a1, const VecArcInfo& a2);
bool IsEmpty() const { return count == 0; } bool IsEmpty() const { return count == 0; }

View file

@ -133,7 +133,7 @@ static Rectf SplitPoly(const Array<Pointf>& polygon, const Vector<int>& polyend,
int ContainsPoints(const Array<Pointf>& polygon, const Vector<int>& polyend, const Array<Pointf>& points) int ContainsPoints(const Array<Pointf>& polygon, const Vector<int>& polyend, const Array<Pointf>& points)
{ {
if(points.IsEmpty() || polygon.GetCount() <= 1) if(points.IsEmpty() || polygon.GetCount() <= 1)
return false; return CMP_OUT;
Array<PolyPart> parts; Array<PolyPart> parts;
Rectf prect = SplitPoly(polygon, polyend, true, parts); Rectf prect = SplitPoly(polygon, polyend, true, parts);
bool is_in = false, is_out = false; bool is_in = false, is_out = false;
@ -178,7 +178,7 @@ int ContainsPoints(const Array<Pointf>& polygon, const Vector<int>& polyend, con
int ContainsPoints(const Array<Pointf>& polygon, const Array<Pointf>& points) int ContainsPoints(const Array<Pointf>& polygon, const Array<Pointf>& points)
{ {
if(points.IsEmpty() || polygon.GetCount() <= 1) if(points.IsEmpty() || polygon.GetCount() <= 1)
return false; return CMP_OUT;
Vector<int> polyend; Vector<int> polyend;
polyend.SetCount(1); polyend.SetCount(1);
polyend[0] = polygon.GetCount(); polyend[0] = polygon.GetCount();

View file

@ -1613,7 +1613,7 @@ void VecIntersection::CheckBearing(double *hints, const VecArcInfo &a)
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// LL: line vs line. // LL: line vs line.
bool VecIntersection::LL(Pointf P1, Pointf Q1, Pointf P2, Pointf Q2) bool VecIntersection::LL(const Pointf& P1, const Pointf& Q1, const Pointf& P2, const Pointf& Q2)
{ {
if(min(P2.x, Q2.x) - max(P1.x, Q1.x) > Vec_tolerance if(min(P2.x, Q2.x) - max(P1.x, Q1.x) > Vec_tolerance
|| min(P2.y, Q2.y) - max(P1.y, Q1.y) > Vec_tolerance || min(P2.y, Q2.y) - max(P1.y, Q1.y) > Vec_tolerance
@ -1656,7 +1656,7 @@ bool VecIntersection::LL(Pointf P1, Pointf Q1, Pointf P2, Pointf Q2)
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// LC: line vs circle. // LC: line vs circle.
bool VecIntersection::LC(Pointf P1, Pointf Q1, Pointf C2, double r2) bool VecIntersection::LC(const Pointf& P1, const Pointf& Q1, const Pointf& C2, double r2)
{ {
Pointf PQ = Q1 - P1; Pointf PQ = Q1 - P1;
Pointf CP = P1 - C2; Pointf CP = P1 - C2;
@ -1710,7 +1710,7 @@ bool VecIntersection::LC(Pointf P1, Pointf Q1, Pointf C2, double r2)
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// LA: line vs arc. // LA: line vs arc.
bool VecIntersection::LA(Pointf P1, Pointf Q1, const VecArcInfo &a2) bool VecIntersection::LA(const Pointf& P1, const Pointf& Q1, const VecArcInfo &a2)
{ {
if(!a2.IsCurved()) if(!a2.IsCurved())
return LL(P1, Q1, a2.A, a2.B); return LL(P1, Q1, a2.A, a2.B);
@ -1723,7 +1723,7 @@ bool VecIntersection::LA(Pointf P1, Pointf Q1, const VecArcInfo &a2)
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// CC: circle vs circle. // CC: circle vs circle.
bool VecIntersection::CC(Pointf C1, double r1, Pointf C2, double r2) bool VecIntersection::CC(const Pointf& C1, double r1, const Pointf& C2, double r2)
{ {
if(fabs(r1) <= Vec_tolerance || fabs(r2) <= Vec_tolerance if(fabs(r1) <= Vec_tolerance || fabs(r2) <= Vec_tolerance
|| (C1 | C2) >= r1 + r2 + Vec_tolerance) || (C1 | C2) >= r1 + r2 + Vec_tolerance)
@ -1763,7 +1763,7 @@ bool VecIntersection::CC(Pointf C1, double r1, Pointf C2, double r2)
////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////
// CA: circle vs arc. // CA: circle vs arc.
bool VecIntersection::CA(Pointf C1, double r1, const VecArcInfo &a2) bool VecIntersection::CA(const Pointf& C1, double r1, const VecArcInfo &a2)
{ {
if(!a2.IsCurved()) if(!a2.IsCurved())
{ {

View file

@ -550,6 +550,11 @@ void CalcSymbols::Remove(String name)
} }
} }
CalcContext::Global::Global(const String& name, CalcProc proc)
{
GetGlobals().Add(name, proc);
}
CalcContext::CalcContext() CalcContext::CalcContext()
: nesting(0) : nesting(0)
, opt_const(false) , opt_const(false)

View file

@ -333,10 +333,9 @@ public:
CalcContext& context; CalcContext& context;
}; };
class Global class Global {
{
public: public:
Global(const String& name, CalcProc proc) { GetGlobals().Add(name, proc); } Global(const String& name, CalcProc proc);
}; };
CalcContext(); CalcContext();