|
|
1.1 root 1: #include <afxwin.h>
2: #include <afxdlgs.h>
3: #include <afxcoll.h>
4: #include <string.h>
5:
6: #include "types.h"
7: #include "ranges.h"
8: #include "dispobj.h"
9:
10:
11: void DISPOBJ::PaintTree(CDC * cdc, BOOL fZoom, RANGESTRUCT * prs, RECT rtPaint)
12: {
13: DISPOBJ * p = pChild;
14: CRect rt;
15: CRect rt1;
16: BOOL fLines;
17: BOOL fChildren;
18:
19:
20: if (fOpen && (p != NULL)) {
21: fChildren = rt.IntersectRect( &rtChildren, &rtPaint);
22: rt1.UnionRect( &rtChildren, &rtArea);
23: fLines = rt.IntersectRect(&rt1, &rtPaint);
24: while ( p != NULL) {
25: if (!p->fPrune) {
26: if (fLines) {
27: cdc->MoveTo( ptRight );
28: cdc->LineTo( p->ptLeft );
29: }
30: if (fChildren) {
31: p->PaintTree(cdc, fZoom, prs, rtPaint);
32: }
33: }
34: p = p->pSib;
35: }
36: }
37:
38: if (rt.IntersectRect(&rtArea, &rtPaint)) {
39: DoForeground(cdc, fZoom, prs);
40: }
41:
42: return;
43: }
44:
45:
46: void DISPOBJ::DoSetLocation(BOOL fZoom, BOOL fPrep)
47: {
48: CRect rt;
49:
50: if (fPrep) {
51: rtChildren.SetRectEmpty();
52: rtArea.SetRectEmpty();
53: rtTotal.SetRectEmpty();
54: if (fPrune) {
55: return;
56: }
57:
58: if (iLevel >= rgLoc.GetUpperBound()) {
59: AAA aaa = {0, 0, 0};
60: rgLoc.SetAtGrow(iLevel, aaa);
61: }
62:
63: if (rgLoc[iLevel].width < Width(fZoom)) {
64: rgLoc[iLevel].width = Width(fZoom);
65: }
66:
67: return;
68: } else {
69: if (fPrune || ((pParent != NULL) && !pParent->fOpen)) {
70: return;
71: }
72:
73: rtArea.top = rgLoc[iLevel].y + spaceVertical;
74: rtArea.left = rgLoc[iLevel].left;
75: rtArea.right = rgLoc[iLevel].left + rgLoc[iLevel].width;
76: rtArea.bottom = rtArea.top + Height(fZoom);
77:
78: rgLoc[iLevel].y = rtArea.bottom;
79:
80: ptRight.x = rtArea.right;
81: ptLeft.x = rtArea.left;
82: ptLeft.y = ptRight.y = (rtArea.bottom - rtArea.top) / 2 + rtArea.top;
83:
84: rtTotal = rtArea;
85:
86: if (fOpen && pChild) {
87: DISPOBJ * p = pChild;
88: CRect rt1;
89:
90: while (p != NULL) {
91: rt1 = p->rtTotal;
92: if (!rt1.IsRectEmpty()) {
93: if (rtChildren.IsRectEmpty()) {
94: rtChildren = rt1;
95: } else {
96: rtChildren |= rt1;
97: }
98: }
99: p = p->pSib;
100: }
101:
102: if (!rtChildren.IsRectEmpty()) {
103: rtTotal |= rtChildren;
104: }
105: }
106: }
107:
108: return;
109: } /* DISPOBJ::DoSetLocation() */
110:
111: void DISPOBJ::SetPropOnOne(int flags, RANGESTRUCT * prs, CDC * pcdc,
112: BOOL fZoom, TIMETYPE progTime)
113: {
114: if (flags & SET_PERCENT) {
115: DoSetPercents(progTime);
116: }
117:
118: if (flags & SET_COLORS) {
119: DoSetColors(prs);
120: }
121:
122: if (flags & SET_STRING) {
123: DoSetString();
124: }
125:
126: if (flags & SET_SIZE) {
127: DoAssignSize(pcdc);
128: }
129:
130: if (flags & SET_LOCATIONPREP) {
131: DoSetLocation(fZoom, TRUE);
132: }
133:
134: if (flags & SET_LOCATION) {
135: DoSetLocation(fZoom, FALSE);
136: }
137:
138: return;
139: }
140:
141:
142: void DISPOBJ::SetProperties(int flags, RANGESTRUCT * prs, CDC * pcdc,
143: BOOL fZoom, TIMETYPE progTime)
144: {
145: if (pChild != NULL) {
146: pChild->SetProperties(flags, prs, pcdc, fZoom, progTime);
147: }
148:
149: SetPropOnOne(flags, prs, pcdc, fZoom, progTime);
150:
151: if (pSib != NULL) {
152: pSib->SetProperties(flags, prs, pcdc, fZoom, progTime);
153: }
154:
155: return;
156: } /* DISPOBJ::SetProperties() */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.