76 |
window->clear(); |
window->clear(); |
77 |
const int h = 20; |
const int h = 20; |
78 |
const int w = 800; |
const int w = 800; |
|
const int w1 = 100; |
|
79 |
int y = 0; |
int y = 0; |
80 |
int bitpos = 0; |
double maxwidth = 0; |
81 |
for (int i = 0 ; i < region->Dimensions ; i++) { |
for (int i = 0 ; i < region->Dimensions ; i++) { |
82 |
|
|
83 |
int nbZones = region->pDimensionDefinitions[i].zones; |
int nbZones = region->pDimensionDefinitions[i].zones; |
128 |
layout->set_text(dstr); |
layout->set_text(dstr); |
129 |
|
|
130 |
Pango::Rectangle rectangle = layout->get_logical_extents(); |
Pango::Rectangle rectangle = layout->get_logical_extents(); |
131 |
|
double text_w = double(rectangle.get_width()) / Pango::SCALE; |
132 |
|
if (text_w > maxwidth) maxwidth = text_w; |
133 |
double text_h = double(rectangle.get_height()) / Pango::SCALE; |
double text_h = double(rectangle.get_height()) / Pango::SCALE; |
134 |
Glib::RefPtr<const Gdk::GC> fg = get_style()->get_fg_gc(get_state()); |
Glib::RefPtr<const Gdk::GC> fg = get_style()->get_fg_gc(get_state()); |
135 |
window->draw_layout(fg, 4, int(y + (h - text_h) / 2 + 0.5), layout); |
window->draw_layout(fg, 4, int(y + (h - text_h) / 2 + 0.5), layout); |
136 |
|
|
137 |
|
} |
138 |
|
y += h; |
139 |
|
} |
140 |
|
y = 0; |
141 |
|
int bitpos = 0; |
142 |
|
label_width = int(maxwidth + 10); |
143 |
|
for (int i = 0 ; i < region->Dimensions ; i++) { |
144 |
|
int nbZones = region->pDimensionDefinitions[i].zones; |
145 |
|
if (nbZones) { |
146 |
|
|
147 |
if (has_focus() && focus_line == i) { |
if (has_focus() && focus_line == i) { |
148 |
Gdk::Rectangle farea(0, y, 50, 20); |
Gdk::Rectangle farea(0, y, 150, 20); |
149 |
get_style()->paint_focus(window, get_state(), farea, *this, "hejsan", 0, y, 50, 20); |
get_style()->paint_focus(window, get_state(), farea, *this, "", 0, y, label_width, 20); |
150 |
} |
} |
151 |
|
|
152 |
Glib::RefPtr<const Gdk::GC> black = get_style()->get_black_gc(); |
Glib::RefPtr<const Gdk::GC> black = get_style()->get_black_gc(); |
153 |
window->draw_line(black, w1, y, w - 1, y); |
window->draw_line(black, label_width, y, w - 1, y); |
154 |
window->draw_line(black, w - 1, y + h - 1, w1, y + h - 1); |
window->draw_line(black, w - 1, y + h - 1, label_width, y + h - 1); |
155 |
window->draw_rectangle(get_style()->get_white_gc(), true, w1 + 1, y + 1, (w - w1 - 2), h - 2); |
window->draw_rectangle(get_style()->get_white_gc(), true, label_width + 1, y + 1, (w - label_width - 2), h - 2); |
156 |
|
|
157 |
int c = 0; |
int c = 0; |
158 |
if (dimregno >= 0) { |
if (dimregno >= 0) { |
166 |
region->pDimensionRegions[c]->VelocityUpperLimit)); |
region->pDimensionRegions[c]->VelocityUpperLimit)); |
167 |
|
|
168 |
if (customsplits) { |
if (customsplits) { |
169 |
window->draw_line(black, w1, y + 1, w1, y + h - 2); |
window->draw_line(black, label_width, y + 1, label_width, y + h - 2); |
170 |
for (int j = 0 ; j < nbZones ; j++) { |
for (int j = 0 ; j < nbZones ; j++) { |
171 |
gig::DimensionRegion *d = region->pDimensionRegions[c + (j << bitpos)]; |
gig::DimensionRegion *d = region->pDimensionRegions[c + (j << bitpos)]; |
172 |
int upperLimit = d->DimensionUpperLimits[i]; |
int upperLimit = d->DimensionUpperLimits[i]; |
173 |
if (!upperLimit) upperLimit = d->VelocityUpperLimit; |
if (!upperLimit) upperLimit = d->VelocityUpperLimit; |
174 |
int v = upperLimit + 1; |
int v = upperLimit + 1; |
175 |
int x = int((w - w1 - 1) * v / 128.0 + 0.5); |
int x = int((w - label_width - 1) * v / 128.0 + 0.5); |
176 |
window->draw_line(black, w1 + x, y + 1, w1 + x, y + h - 2); |
window->draw_line(black, label_width + x, y + 1, label_width + x, y + h - 2); |
177 |
} |
} |
178 |
} else { |
} else { |
179 |
for (int j = 0 ; j <= nbZones ; j++) { |
for (int j = 0 ; j <= nbZones ; j++) { |
180 |
int x = int((w - w1 - 1) * j / double(nbZones) + 0.5); |
int x = int((w - label_width - 1) * j / double(nbZones) + 0.5); |
181 |
window->draw_line(black, w1 + x, y + 1, w1 + x, y + h - 2); |
window->draw_line(black, label_width + x, y + 1, label_width + x, y + h - 2); |
182 |
} |
} |
183 |
} |
} |
184 |
|
|
192 |
int upperLimit = d->DimensionUpperLimits[i]; |
int upperLimit = d->DimensionUpperLimits[i]; |
193 |
if (!upperLimit) upperLimit = d->VelocityUpperLimit; |
if (!upperLimit) upperLimit = d->VelocityUpperLimit; |
194 |
int v = upperLimit + 1; |
int v = upperLimit + 1; |
195 |
int x2 = int((w - w1 - 1) * v / 128.0 + 0.5); |
int x2 = int((w - label_width - 1) * v / 128.0 + 0.5); |
196 |
if (j == dr && x1 < x2) { |
if (j == dr && x1 < x2) { |
197 |
window->draw_rectangle(gc, true, w1 + x1 + 1, y + 1, (x2 - x1) - 1, h - 2); |
window->draw_rectangle(gc, true, label_width + x1 + 1, y + 1, (x2 - x1) - 1, h - 2); |
198 |
break; |
break; |
199 |
} |
} |
200 |
x1 = x2; |
x1 = x2; |
201 |
} |
} |
202 |
} else { |
} else { |
203 |
if (dr < nbZones) { |
if (dr < nbZones) { |
204 |
int x1 = int((w - w1 - 1) * dr / double(nbZones) + 0.5); |
int x1 = int((w - label_width - 1) * dr / double(nbZones) + 0.5); |
205 |
int x2 = int((w - w1 - 1) * (dr + 1) / double(nbZones) + 0.5); |
int x2 = int((w - label_width - 1) * (dr + 1) / double(nbZones) + 0.5); |
206 |
window->draw_rectangle(gc, true, w1 + x1 + 1, y + 1, (x2 - x1) - 1, h - 2); |
window->draw_rectangle(gc, true, label_width + x1 + 1, y + 1, (x2 - x1) - 1, h - 2); |
207 |
} |
} |
208 |
} |
} |
209 |
} |
} |
273 |
{ |
{ |
274 |
const int h = 20; |
const int h = 20; |
275 |
const int w = 800; |
const int w = 800; |
|
const int w1 = 100; |
|
276 |
|
|
277 |
if (region) { |
if (region) { |
278 |
if (event->y < region->Dimensions * h && |
if (event->y < region->Dimensions * h && |
279 |
event->x >= w1 && event->x < w) { |
event->x >= label_width && event->x < w) { |
280 |
|
|
281 |
int dim = int(event->y / h); |
int dim = int(event->y / h); |
282 |
int nbZones = region->pDimensionDefinitions[dim].zones; |
int nbZones = region->pDimensionDefinitions[dim].zones; |
298 |
(region->pDimensionDefinitions[i].dimension == gig::dimension_velocity && |
(region->pDimensionDefinitions[i].dimension == gig::dimension_velocity && |
299 |
region->pDimensionRegions[c]->VelocityUpperLimit)); |
region->pDimensionRegions[c]->VelocityUpperLimit)); |
300 |
if (customsplits) { |
if (customsplits) { |
301 |
int val = int((event->x - w1) * 128 / (w - w1 - 1)); |
int val = int((event->x - label_width) * 128 / (w - label_width - 1)); |
302 |
|
|
303 |
if (region->pDimensionRegions[c]->DimensionUpperLimits[i]) { |
if (region->pDimensionRegions[c]->DimensionUpperLimits[i]) { |
304 |
for (z = 0 ; z < nbZones ; z++) { |
for (z = 0 ; z < nbZones ; z++) { |
312 |
} |
} |
313 |
} |
} |
314 |
} else { |
} else { |
315 |
z = int((event->x - w1) * nbZones / (w - w1 - 1)); |
z = int((event->x - label_width) * nbZones / (w - label_width - 1)); |
316 |
} |
} |
317 |
|
|
318 |
printf("dim=%d z=%d dimensionsource=%d split_type=%d zones=%d zone_size=%f\n", dim, z, |
printf("dim=%d z=%d dimensionsource=%d split_type=%d zones=%d zone_size=%f\n", dim, z, |