News:

Congratulations!
 You've won the News Item Lottery! Your prize? Reading this news item! :)

[patch] Monthly Finance window button

Started by blove, October 30, 2009, 03:25:01 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

blove

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

skreyola

This is awesome. I've been wanting it for a while. I hope it is soon in the main trunk. :)
--Skreyola
You can also help translate for your language with SimuTranslator.

z9999+

Unfortunately, that top space is used by senario.

gerw

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);
}

z9999+

#4
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.

prissi

I would also rather suggest ot connect the switching with the switching to the stastics. Lets see.

blove

@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

blove

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

skreyola

Quote from: prissi on October 30, 2009, 12:40:52 PM
I would also rather suggest ot connect the switching with the switching to the stastics. Lets see.
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.
--Skreyola
You can also help translate for your language with SimuTranslator.

blove

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

z9999+

Thank you. "Next month" seems to be good.

Quote from: blove on October 31, 2009, 03:27:46 AM

  • 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.

It is simple to understand.

prissi