Removed/commented out debug output.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@30678 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -43,7 +43,6 @@ BigtimeChartAxisLegendSource::GetAxisLegends(const ChartDataRange& range,
|
|||||||
// interpret range as time range
|
// interpret range as time range
|
||||||
bigtime_t startTime = (bigtime_t)range.min;
|
bigtime_t startTime = (bigtime_t)range.min;
|
||||||
bigtime_t endTime = (bigtime_t)range.max;
|
bigtime_t endTime = (bigtime_t)range.max;
|
||||||
printf("BigtimeChartAxisLegendSource::GetAxisLegends(): range: %lld - %lld\n", startTime, endTime);
|
|
||||||
// TODO: Handle sub-microsecs ranges!
|
// TODO: Handle sub-microsecs ranges!
|
||||||
if (startTime >= endTime)
|
if (startTime >= endTime)
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ bool
|
|||||||
Chart::AddDataSource(ChartDataSource* dataSource, int32 index,
|
Chart::AddDataSource(ChartDataSource* dataSource, int32 index,
|
||||||
ChartRendererDataSourceConfig* config)
|
ChartRendererDataSourceConfig* config)
|
||||||
{
|
{
|
||||||
printf("Chart::AddDataSource(%p)\n", dataSource);
|
|
||||||
if (dataSource == NULL)
|
if (dataSource == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -130,7 +129,6 @@ Chart::RemoveDataSource(ChartDataSource* dataSource)
|
|||||||
ChartDataSource*
|
ChartDataSource*
|
||||||
Chart::RemoveDataSource(int32 index)
|
Chart::RemoveDataSource(int32 index)
|
||||||
{
|
{
|
||||||
printf("Chart::RemoveDataSource(%ld)\n", index);
|
|
||||||
if (index < 0 || index >= fDataSources.CountItems())
|
if (index < 0 || index >= fDataSources.CountItems())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -149,7 +147,6 @@ printf("Chart::RemoveDataSource(%ld)\n", index);
|
|||||||
void
|
void
|
||||||
Chart::RemoveAllDataSources()
|
Chart::RemoveAllDataSources()
|
||||||
{
|
{
|
||||||
printf("Chart::RemoveAllDataSources()\n");
|
|
||||||
int32 count = fDataSources.CountItems();
|
int32 count = fDataSources.CountItems();
|
||||||
for (int32 i = count - 1; i >= 0; i--)
|
for (int32 i = count - 1; i >= 0; i--)
|
||||||
fRenderer->RemoveDataSource(fDataSources.ItemAt(i));
|
fRenderer->RemoveDataSource(fDataSources.ItemAt(i));
|
||||||
@@ -371,7 +368,7 @@ Chart::MouseMoved(BPoint where, uint32 code, const BMessage* dragMessage)
|
|||||||
void
|
void
|
||||||
Chart::Draw(BRect updateRect)
|
Chart::Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
printf("Chart::Draw((%f, %f) - (%f, %f))\n", updateRect.left, updateRect.top, updateRect.right, updateRect.bottom);
|
//printf("Chart::Draw((%f, %f) - (%f, %f))\n", updateRect.left, updateRect.top, updateRect.right, updateRect.bottom);
|
||||||
rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR);
|
rgb_color background = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||||
rgb_color color;
|
rgb_color color;
|
||||||
|
|
||||||
@@ -447,7 +444,7 @@ Chart::DoLayout()
|
|||||||
{
|
{
|
||||||
// get size in pixels
|
// get size in pixels
|
||||||
BSize size = Bounds().Size();
|
BSize size = Bounds().Size();
|
||||||
printf("Chart::DoLayout(%f, %f)\n", size.width, size.height);
|
//printf("Chart::DoLayout(%f, %f)\n", size.width, size.height);
|
||||||
int32 width = size.IntegerWidth() + 1;
|
int32 width = size.IntegerWidth() + 1;
|
||||||
int32 height = size.IntegerHeight() + 1;
|
int32 height = size.IntegerHeight() + 1;
|
||||||
|
|
||||||
@@ -470,7 +467,7 @@ printf("Chart::DoLayout(%f, %f)\n", size.width, size.height);
|
|||||||
|
|
||||||
fChartFrame = BRect(left, top, width - right - 1, height - bottom - 1);
|
fChartFrame = BRect(left, top, width - right - 1, height - bottom - 1);
|
||||||
fRenderer->SetFrame(fChartFrame.InsetByCopy(1, 1));
|
fRenderer->SetFrame(fChartFrame.InsetByCopy(1, 1));
|
||||||
printf(" fChartFrame: (%f, %f) - (%f, %f)\n", fChartFrame.left, fChartFrame.top, fChartFrame.right, fChartFrame.bottom);
|
//printf(" fChartFrame: (%f, %f) - (%f, %f)\n", fChartFrame.left, fChartFrame.top, fChartFrame.right, fChartFrame.bottom);
|
||||||
|
|
||||||
fLeftAxis.SetFrame(0, fChartFrame.top + 1, fChartFrame.left - 1,
|
fLeftAxis.SetFrame(0, fChartFrame.top + 1, fChartFrame.left - 1,
|
||||||
fChartFrame.bottom - 1);
|
fChartFrame.bottom - 1);
|
||||||
|
|||||||
@@ -64,7 +64,6 @@ void
|
|||||||
LegendChartAxis::_FilterLegends(int32 totalSize, int32 spacing,
|
LegendChartAxis::_FilterLegends(int32 totalSize, int32 spacing,
|
||||||
float BSize::* sizeField)
|
float BSize::* sizeField)
|
||||||
{
|
{
|
||||||
printf("LegendChartAxis::_FilterLegends(%ld, %ld)\n", totalSize, spacing);
|
|
||||||
// compute the min/max legend levels
|
// compute the min/max legend levels
|
||||||
int32 legendCount = fLegends.CountItems();
|
int32 legendCount = fLegends.CountItems();
|
||||||
int32 minLevel = INT_MAX;
|
int32 minLevel = INT_MAX;
|
||||||
@@ -91,7 +90,6 @@ printf("LegendChartAxis::_FilterLegends(%ld, %ld)\n", totalSize, spacing);
|
|||||||
// preceeding same-level legends. We iterate backwards from the lower to
|
// preceeding same-level legends. We iterate backwards from the lower to
|
||||||
// the higher levels
|
// the higher levels
|
||||||
for (int32 level = std::max(minLevel, 0L); level <= maxLevel;) {
|
for (int32 level = std::max(minLevel, 0L); level <= maxLevel;) {
|
||||||
printf(" level: %ld\n", level);
|
|
||||||
legendCount = fLegends.CountItems();
|
legendCount = fLegends.CountItems();
|
||||||
|
|
||||||
// get the first legend position/end
|
// get the first legend position/end
|
||||||
@@ -101,12 +99,10 @@ printf(" level: %ld\n", level);
|
|||||||
|
|
||||||
int32 previousEnd = (int32)ceilf(position + info->size.*sizeField);
|
int32 previousEnd = (int32)ceilf(position + info->size.*sizeField);
|
||||||
int32 previousLevel = info->legend->Level();
|
int32 previousLevel = info->legend->Level();
|
||||||
printf(" first legend: pos: %f, size: %f\n", position, info->size.*sizeField);
|
|
||||||
|
|
||||||
for (int32 i = 1; (info = fLegends.ItemAt(i)) != NULL; i++) {
|
for (int32 i = 1; (info = fLegends.ItemAt(i)) != NULL; i++) {
|
||||||
float position = _LegendPosition(info->value, info->size.*sizeField,
|
float position = _LegendPosition(info->value, info->size.*sizeField,
|
||||||
(float)totalSize, scale);;
|
(float)totalSize, scale);;
|
||||||
printf(" legend %ld: pos: %f, size: %f\n", i, position, info->size.*sizeField);
|
|
||||||
|
|
||||||
if (position - spacing < previousEnd
|
if (position - spacing < previousEnd
|
||||||
&& (previousLevel <= level
|
&& (previousLevel <= level
|
||||||
@@ -183,7 +179,6 @@ LegendChartAxis::SetRange(const ChartDataRange& range)
|
|||||||
void
|
void
|
||||||
LegendChartAxis::SetFrame(BRect frame)
|
LegendChartAxis::SetFrame(BRect frame)
|
||||||
{
|
{
|
||||||
printf("LegendChartAxis::SetFrame((%f, %f) - (%f, %f))\n", frame.left, frame.top, frame.right, frame.bottom);
|
|
||||||
if (frame != fFrame) {
|
if (frame != fFrame) {
|
||||||
fFrame = frame;
|
fFrame = frame;
|
||||||
_InvalidateLayout();
|
_InvalidateLayout();
|
||||||
@@ -245,7 +240,6 @@ LegendChartAxis::PreferredSize(BView* view, BSize maxSize)
|
|||||||
void
|
void
|
||||||
LegendChartAxis::Render(BView* view, BRect updateRect)
|
LegendChartAxis::Render(BView* view, BRect updateRect)
|
||||||
{
|
{
|
||||||
printf("LegendChartAxis::Render()\n");
|
|
||||||
if (!_ValidateLayout(view))
|
if (!_ValidateLayout(view))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -279,7 +273,6 @@ printf("LegendChartAxis::Render()\n");
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf(" rendering...\n");
|
|
||||||
float totalSize = floorf(fFrame.Size().*sizeField) + 1;
|
float totalSize = floorf(fFrame.Size().*sizeField) + 1;
|
||||||
double rangeSize = fRange.max - fRange.min;
|
double rangeSize = fRange.max - fRange.min;
|
||||||
if (rangeSize == 0)
|
if (rangeSize == 0)
|
||||||
@@ -293,7 +286,6 @@ printf(" rendering...\n");
|
|||||||
: fFrame.RightBottom().*otherPointField - kChartRulerDistance;
|
: fFrame.RightBottom().*otherPointField - kChartRulerDistance;
|
||||||
float rulerEnd = fFrame.RightTop().*pointField;
|
float rulerEnd = fFrame.RightTop().*pointField;
|
||||||
float rulerChartDistant = rulerChartClosest + rulerDirection * kRulerSize;
|
float rulerChartDistant = rulerChartClosest + rulerDirection * kRulerSize;
|
||||||
printf(" ruler: (%f, %f) - (%f, %f)\n", rulerStart, rulerChartClosest, rulerEnd, rulerChartDistant);
|
|
||||||
|
|
||||||
rgb_color black = { 0, 0, 0, 255 };
|
rgb_color black = { 0, 0, 0, 255 };
|
||||||
view->BeginLineArray(3 + fLegends.CountItems());
|
view->BeginLineArray(3 + fLegends.CountItems());
|
||||||
@@ -319,7 +311,6 @@ printf(" ruler: (%f, %f) - (%f, %f)\n", rulerStart, rulerChartClosest, rulerEnd
|
|||||||
second.*pointField = position;
|
second.*pointField = position;
|
||||||
second.*otherPointField = rulerChartDistant
|
second.*otherPointField = rulerChartDistant
|
||||||
+ rulerDirection * kRulerMarkSize;
|
+ rulerDirection * kRulerMarkSize;
|
||||||
printf(" drawing mark at (%f, %f)\n", first.x, first.y);
|
|
||||||
view->AddLine(first, second, black);
|
view->AddLine(first, second, black);
|
||||||
}
|
}
|
||||||
view->EndLineArray();
|
view->EndLineArray();
|
||||||
@@ -338,7 +329,6 @@ printf(" drawing mark at (%f, %f)\n", first.x, first.y);
|
|||||||
first.*otherPointField = rulerDirection == 1
|
first.*otherPointField = rulerDirection == 1
|
||||||
? legendRulerClosest
|
? legendRulerClosest
|
||||||
: legendRulerClosest - info->size.*otherSizeField;
|
: legendRulerClosest - info->size.*otherSizeField;
|
||||||
printf(" legend %ld: position: (%f, %f), size: (%f, %f)\n", i, first.x, first.y, info->size.width, info->size.height);
|
|
||||||
|
|
||||||
fLegendRenderer->RenderLegend(info->legend, view, first);
|
fLegendRenderer->RenderLegend(info->legend, view, first);
|
||||||
}
|
}
|
||||||
@@ -357,24 +347,18 @@ LegendChartAxis::_ValidateLayout(BView* view)
|
|||||||
{
|
{
|
||||||
if (fLayoutValid)
|
if (fLayoutValid)
|
||||||
return true;
|
return true;
|
||||||
printf("LegendChartAxis::_ValidateLayout()\n");
|
|
||||||
|
|
||||||
fLegends.MakeEmpty();
|
fLegends.MakeEmpty();
|
||||||
|
|
||||||
int32 width = fFrame.IntegerWidth() + 1;
|
int32 width = fFrame.IntegerWidth() + 1;
|
||||||
int32 height = fFrame.IntegerHeight() + 1;
|
int32 height = fFrame.IntegerHeight() + 1;
|
||||||
printf(" width: %ld, height: %ld\n", width, height);
|
|
||||||
|
|
||||||
// estimate the maximum legend count we might need
|
// estimate the maximum legend count we might need
|
||||||
int32 maxLegends = _EstimateMaxLegendCount(view, fFrame.Size(),
|
int32 maxLegends = _EstimateMaxLegendCount(view, fFrame.Size(),
|
||||||
&fHorizontalSpacing, &fVerticalSpacing);
|
&fHorizontalSpacing, &fVerticalSpacing);
|
||||||
|
|
||||||
printf(" max %ld legends\n", maxLegends);
|
|
||||||
if (maxLegends == 0)
|
if (maxLegends == 0)
|
||||||
{
|
|
||||||
printf(" too small for any legends!\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// get the legends
|
// get the legends
|
||||||
ChartLegend* legends[maxLegends];
|
ChartLegend* legends[maxLegends];
|
||||||
@@ -382,27 +366,20 @@ printf(" too small for any legends!\n");
|
|||||||
|
|
||||||
int32 legendCount = fLegendSource->GetAxisLegends(fRange, legends, values,
|
int32 legendCount = fLegendSource->GetAxisLegends(fRange, legends, values,
|
||||||
maxLegends);
|
maxLegends);
|
||||||
printf(" got %ld legends\n", legendCount);
|
|
||||||
if (legendCount == 0)
|
if (legendCount == 0)
|
||||||
{
|
|
||||||
printf(" got no legends from source!\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
printf(" range: %f - %f\n", fRange.min, fRange.max);
|
|
||||||
// create legend infos
|
// create legend infos
|
||||||
for (int32 i = 0; i < legendCount; i++) {
|
for (int32 i = 0; i < legendCount; i++) {
|
||||||
ChartLegend* legend = legends[i];
|
ChartLegend* legend = legends[i];
|
||||||
BSize size = fLegendRenderer->LegendSize(legend, view);
|
BSize size = fLegendRenderer->LegendSize(legend, view);
|
||||||
LegendInfo* info = new(std::nothrow) LegendInfo(legend, values[i],
|
LegendInfo* info = new(std::nothrow) LegendInfo(legend, values[i],
|
||||||
size);
|
size);
|
||||||
printf(" legend %ld: size: (%f, %f), value: %f\n", i, size.width, size.height, info->value);
|
|
||||||
if (info == NULL || !fLegends.AddItem(info)) {
|
if (info == NULL || !fLegends.AddItem(info)) {
|
||||||
// TODO: Report error!
|
// TODO: Report error!
|
||||||
delete info;
|
delete info;
|
||||||
for (int32 k = i; k < legendCount; k++)
|
for (int32 k = i; k < legendCount; k++)
|
||||||
delete legends[k];
|
delete legends[k];
|
||||||
printf(" failed to create legend info!\n");
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -192,7 +192,6 @@ LineChartRenderer::Render(BView* view, BRect updateRect)
|
|||||||
// draw
|
// draw
|
||||||
view->SetLineMode(B_ROUND_CAP, B_ROUND_JOIN);
|
view->SetLineMode(B_ROUND_CAP, B_ROUND_JOIN);
|
||||||
for (int32 i = 0; DataSourceInfo* info = fDataSources.ItemAt(i); i++) {
|
for (int32 i = 0; DataSourceInfo* info = fDataSources.ItemAt(i); i++) {
|
||||||
printf("LineChartRenderer::Render(): %p\n", info);
|
|
||||||
|
|
||||||
float bottom = fFrame.bottom;
|
float bottom = fFrame.bottom;
|
||||||
BShape shape;
|
BShape shape;
|
||||||
@@ -202,7 +201,6 @@ printf("LineChartRenderer::Render(): %p\n", info);
|
|||||||
for (int32 i = first; i <= last; i++) {
|
for (int32 i = first; i <= last; i++) {
|
||||||
shape.LineTo(BPoint(float(left + i),
|
shape.LineTo(BPoint(float(left + i),
|
||||||
float(bottom - ((info->samples[i] - minRange) * scale))));
|
float(bottom - ((info->samples[i] - minRange) * scale))));
|
||||||
//printf(" %f: %f (%f)\n", info->samples[i] - minRange, float(bottom - ((info->samples[i] - minRange) * scale)), bottom);
|
|
||||||
}
|
}
|
||||||
view->SetHighColor(info->config.Color());
|
view->SetHighColor(info->config.Color());
|
||||||
view->MovePenTo(B_ORIGIN);
|
view->MovePenTo(B_ORIGIN);
|
||||||
|
|||||||
Reference in New Issue
Block a user