Lines 102-109
Link Here
|
102 |
*/ |
102 |
*/ |
103 |
public void paint(GC gc, Object value) { |
103 |
public void paint(GC gc, Object value) { |
104 |
Rectangle bounds = getBounds(); |
104 |
Rectangle bounds = getBounds(); |
105 |
//SWT does not appear to render custom line styles on carbon, so we use solid lines instead |
|
|
106 |
boolean isCarbon = SWT.getPlatform().equals("carbon"); |
107 |
|
105 |
|
108 |
int xLeft = bounds.x; |
106 |
int xLeft = bounds.x; |
109 |
int yTop = bounds.y - 1; |
107 |
int yTop = bounds.y - 1; |
Lines 124-157
Link Here
|
124 |
|
122 |
|
125 |
int dy = bounds.y % 2; |
123 |
int dy = bounds.y % 2; |
126 |
|
124 |
|
127 |
if (!isCarbon) { |
125 |
// Set line style to dotted |
128 |
// Set line style to dotted |
126 |
gc.setLineDash(LINE_STYLE); |
129 |
gc.setLineDash(LINE_STYLE); |
127 |
|
130 |
|
128 |
// Adjust line positions by a few pixels to create correct effect |
131 |
// Adjust line positions by a few pixels to create correct effect |
129 |
yToggleTop --; |
132 |
yToggleTop --; |
130 |
yTop ++; |
133 |
yTop ++; |
131 |
yToggleBottom ++; |
134 |
yToggleBottom ++; |
132 |
|
135 |
|
133 |
// Adjust full height |
136 |
// Adjust full height |
134 |
// If height is even, we shorten to an odd number of pixels, and start at the original y offset |
137 |
// If height is even, we shorten to an odd number of pixels, and start at the original y offset |
135 |
if (bounds.height % 2 == 0) { |
138 |
if (bounds.height % 2 == 0) { |
136 |
yBottom -= 1; |
139 |
yBottom -= 1; |
137 |
} |
140 |
} |
138 |
// If height is odd, we alternate based on the row offset |
141 |
// If height is odd, we alternate based on the row offset |
139 |
else { |
142 |
else { |
140 |
yTop += dy; |
143 |
yTop += dy; |
141 |
yBottom -= dy; |
144 |
yBottom -= dy; |
142 |
} |
145 |
} |
|
|
146 |
|
143 |
|
147 |
// Adjust ascender and descender |
144 |
// Adjust ascender and descender |
148 |
yToggleBottom += dy; |
145 |
yToggleBottom += dy; |
149 |
|
146 |
|
150 |
if ((yToggleTop - yTop + 1) % 2 == 0) |
147 |
if ((yToggleTop - yTop + 1) % 2 == 0) |
151 |
yToggleTop -= 1; |
148 |
yToggleTop -= 1; |
152 |
if ((yToggleBottom - yBottom + 1) % 2 == 0) |
149 |
if ((yToggleBottom - yBottom + 1) % 2 == 0) |
153 |
yToggleBottom += dy == 1 ? -1 : 1; |
150 |
yToggleBottom += dy == 1 ? -1 : 1; |
154 |
} |
|
|
155 |
|
151 |
|
156 |
for (int i = 0; i < branches.length; i++) { |
152 |
for (int i = 0; i < branches.length; i++) { |
157 |
// Calculate offsets for this branch |
153 |
// Calculate offsets for this branch |
Lines 161-179
Link Here
|
161 |
int xToggleRight = xLeft + toggleBounds.width; |
157 |
int xToggleRight = xLeft + toggleBounds.width; |
162 |
|
158 |
|
163 |
int dx = 0; |
159 |
int dx = 0; |
164 |
if (!isCarbon) { |
160 |
xRight --; |
165 |
xRight --; |
161 |
xMiddleBranch += 2; |
166 |
xMiddleBranch += 2; |
162 |
xToggleRight --; |
167 |
xToggleRight --; |
163 |
|
168 |
|
164 |
if (indent % 2 == 0) { |
169 |
if (indent % 2 == 0) { |
165 |
xRight -= 1; |
170 |
xRight -= 1; |
166 |
} |
171 |
} |
167 |
else { |
172 |
else { |
168 |
dx = xLeft % 2; |
173 |
dx = xLeft % 2; |
169 |
xLeft += dx; |
174 |
xLeft += dx; |
170 |
xRight -= dx; |
175 |
xRight -= dx; |
|
|
176 |
} |
177 |
} |
171 |
} |
178 |
|
172 |
|
179 |
// Render line segments |
173 |
// Render line segments |