The finance window currently displays details of "This Year" and "Last Year", but the only view into monthly is via the graph. This patch adds a button that toggles between "This Year"/"Last Year" and "This Month"/"Last Month". The graph is unaffected.
The patch is against r2832. It does not support the translator (mostly because I don't know how that works yet). Though from what I gather, the "This Year:"/"Last Year:" text does not support the translator either.
Ben
This is awesome. I've been wanting it for a while. I hope it is soon in the main trunk. :)
Unfortunately, that top space is used by senario.
Your patch already supports translation - the gui components translate the text automatically, it only has to be added to the translator:
gui/components/gui_label.cc:
void gui_label_t::set_text(const char *text)
{
this->text = translator::translate(text);
}
Yes, but it will translate only when finance window is opend.
So, it doesn't change translated text dynamically by clicking button.
[edit]
Oh, sorry, I was wrong. It can translate.
Currently "This Year" and "This Month" are used, they are not "This Year:" nor "This Month:".
But in that case, two different "This Month" will be available.
I would also rather suggest ot connect the switching with the switching to the stastics. Lets see.
@z9999+: I didn't know the scenario text used that space. My bad. Where would you suggest the button goes? I tried putting it next to the Build HQ button, but it looked awkward (to me). I thought perhaps just above Proceeds, but then it looks like it's a graph-related button?
As for the translation, thanks for letting me know about the gui components. I hadn't seen that. But, I could have sworn the text was already "This Year:" (with the colon) before I made the change. It can certainly be changed to without the colon for the translation.
@prissi: I don't understand what you mean by "switching to the statistics"?
One other thought I had last night. I forgot to comment the new sections, since I was too excited about getting it to work. It really does need some comments, especially since pointers-to-functions are not a common C++ idiom. I'll submit a new version with comments and the other fixes discussed this weekend.
Ben
I forgot to mention why the two "This Month:" numbers for Maintenance are different. The left This Month: is what is actually stored in the finance_history_month cost structure for month 0 maintenance. I believe the right This Month: is what will be charged for maintenance at the end of this month / beginning of next month. Perhaps we should change the right one to read "Next Month:" instead?
Ben
I thought of suggesting that, but then I realized some people might want to have the graph and the tables show either the same or the opposite things, so I didn't make my suggestion. I think is is probably better to put tabs over the table like they are over the graph, so you can flip between them in an intuitively similar way.
A checkbox could be add in an unused corner that links the table with the graph when checked.
Here is an updated version of the patch.
- It now has better comments around the new code sections.
- I removed the button and made the toggle based on the new active tab event. (Thanks skreyola for helping me figure out what prissi meant!)
- I changed the right "This Month" text for Maintenance to "Next Month", to make it clearer.
- I reverted the text labels back to the non-colon forms. It turns out that my current pak was confusing me.
If it is determined that the toggle button is better than the tab selection, I would suggest moving the upper scenario text down below the scenario progress text and leaving the button where I placed it.
Ben
Thank you. "Next month" seems to be good.
It is simple to understand.