Changes between Version 3 and Version 6 of Ticket #4097


Ignore:
Timestamp:
Aug 31, 2021, 1:17:43 PM (3 years ago)
Author:
Langbart
Comment:

It would be easy if only the summary numbers would need to be adjusted. One could simply use the abbreviateLargeNumbers function from gui/common/tooltips.js, but that would break the charts since the format is not supported via source/gui/ObjectTypes/CChart.cpp.

CSize2D CChart::AddFormattedValue(const CStrW& format, const float value, const CStrW& font, const float buffer_zone)
{
	// TODO: we need to catch cases with equal formatted values.
	CGUIString gui_str;
	if (format == L"DECIMAL2")
	{
		wchar_t buffer[64];
		swprintf(buffer, 64, L"%.2f", value);
		gui_str.SetValue(buffer);
	}
	else if (format == L"INTEGER")
	{
		wchar_t buffer[64];
		swprintf(buffer, 64, L"%d", std::lround(value));
		gui_str.SetValue(buffer);
	}
	else if (format == L"DURATION_SHORT")
	{
		const int seconds = value;
		wchar_t buffer[64];
		swprintf(buffer, 64, L"%d:%02d", seconds / 60, seconds % 60);
		gui_str.SetValue(buffer);
	}
	else if (format == L"PERCENTAGE")
	{
		wchar_t buffer[64];
		swprintf(buffer, 64, L"%d%%", std::lround(value));
		gui_str.SetValue(buffer);
	}
	else
	{
		LOGERROR("Unsupported chart format: " + format.EscapeToPrintableASCII());
		return CSize2D();
	}

	return AddText(gui_str, font, 0, buffer_zone).GetSize();
}

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #4097

    • Property Keywords simple removed
    • Property Milestone BacklogAlpha 26
    • Property Severitysimple
  • Ticket #4097 – Description

    v3 v6  
    11When a high number of resources gathered / used needs to be displayed,
    22there is not enough place in the summary screen for this to be displayed, as can be seen in the attached screenshot.
     3[[Image(ticket:4097:screenshot0001.png, 800px, center)]]