enhancing the production screen

Programmers discuss here anything related to FreeOrion programming. Primarily for the developers to discuss.

Moderator: Committer

Message
Author
User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

enhancing the production screen

#1 Post by The Silent One »

I'm trying to make it possible to close/hide the "pedia panel" (enc_detail_panel) of the production screen.
What I've done so far to get the pedia closed:
- added CLOSABLE parameter to m_enc_detail_panel window constructor and
- connected m_enc_detail_panel->ClosingSignal to BuildDesignatorWnd::HidePedia():

Code: Select all

GG::Connect(m_enc_detail_panel->ClosingSignal, boost::bind(&BuildDesignatorWnd::HidePedia, this));     // Wnd is manually closed by user
( BuildDesignatorWnd::HidePedia() calls m_enc_detail_panel->Hide(); )

Result: pedia panel has an "X" and closes when X is clicked.

Problem: The area of the invisible pedia panel doesn't let mouse clicks through. I initially had thought I would need to remove the GG:INTERACTIVE flag from the window, but looking over GG::Wnd.cpp that doesn't seem to be possible or intended? Also other windows (the "map pedia" or sitrep) do not still receive clicks after ->Hide() has been called?

What I've done so far to show the pedia again:
My plan is to add a "show pedia" entry to the right-click menues of the production queue and the production selector items (if the pedia is invisible). Adding the entries is no problem. Next I created a signal "DisplayEncyclopediaDetailPanelSignal" which is (supposed to be) evoked if "show pedia" is clicked:

Code: Select all

mutable boost::signals2::signal<void (bool)>                    DisplayEncyclopediaDetailPanelSignal;
and connected it with EncyclopediaDetailPanel::Show():

Code: Select all

GG::Connect(m_build_selector->DisplayEncyclopediaDetailPanelSignal, &EncyclopediaDetailPanel::Show, this);
However, I don't really know what I'm doing / have no proper idea how exactly I have to declare and connect the signal, so this isn't working yet.
I'd be grateful for any help.
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: enhancing the production screen

#2 Post by Geoff the Medio »

The Silent One wrote:Problem: The area of the invisible pedia panel doesn't let mouse clicks through.
Probably because

Code: Select all

bool BuildDesignatorWnd::InWindow(const GG::Pt& pt) const
{ return m_enc_detail_panel->InWindow(pt) || m_build_selector->InWindow(pt) || m_side_panel->InWindow(pt); }
If you want to made the pedia window hidable, there should probably be a button to toggle it visible/hide it. Requiring people to hunt for somewhere to right click to get an option to make it come back doesn't sound good to me.

User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Re: enhancing the production screen

#3 Post by The Silent One »

Geoff the Medio wrote:Probably because

Code: Select all

bool BuildDesignatorWnd::InWindow(const GG::Pt& pt) const
{ return m_enc_detail_panel->InWindow(pt) || m_build_selector->InWindow(pt) || m_side_panel->InWindow(pt); }
Yes, thanks, that did the trick:

Code: Select all

bool BuildDesignatorWnd::InWindow(const GG::Pt& pt) const
{ return (m_enc_detail_panel->InWindow(pt) && m_enc_detail_panel->Visible()) || m_build_selector->InWindow(pt) || m_side_panel->InWindow(pt); }
Geoff the Medio wrote:If you want to made the pedia window hidable, there should probably be a button to toggle it visible/hide it. Requiring people to hunt for somewhere to right click to get an option to make it come back doesn't sound good to me.
I see your point, but I'm not sure where I would place the button. I'll think it over and make a suggestion in the next couple of days.
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: enhancing the production screen

#4 Post by Geoff the Medio »

I'd actually like to move towards not having a separate pedia window for the research and productions screens, and just use the main map one, so were that the case, you could use the main pedia toggle at the top right.

Actually implementing that might be a bit complicated, though... the production UI code is a bit of a mess overall... and not easily reorganized.

User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Re: enhancing the production screen

#5 Post by The Silent One »

Geoff the Medio wrote:[...], you could use the main pedia toggle at the top right.
To use the main pedia button sounds like a good idea, and it was actually pretty simple to implement.
Geoff the Medio wrote:Actually implementing [a global pedia window] might be a bit complicated, though...
I don't think it's something I would be able to take on; also I'm not sure if it would be a significant improvement, or worth the effort?

Closing/opening the pedia is almost done (the last remaining problem is that opening the production screen will make the pedia reappear, but I think I have an idea how to fix that).
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Re: enhancing the production screen

#6 Post by The Silent One »

Pull request is up: https://github.com/freeorion/freeorion/pull/454

There's one part of the code where I'm not sure if I should handle it differently. In MapWnd::ShowProduction() I check (from the options database) if the player has manually hidden the production window's pedia (PWP), and if he has, I just hide it again after it has been shown by m_production_wnd->Show(). A more elegant solution might be to overwrite BuildDesignatorWnd::Show() and check there from the database if the PWP should be shown or not.

Code: Select all

// hide pedia again if it is supposed to be hidden persistently
    if (GetOptionsDB().Get<bool>("UI.windows.production.pedia.persistently-hidden"))
        m_production_wnd->TogglePedia();
On a different matter: my last commit was a little messy (grooming...), does someone know how to crush commits with SmartGit?
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Vezzra
Release Manager, Design
Posts: 6095
Joined: Wed Nov 16, 2011 12:56 pm
Location: Sol III

Re: enhancing the production screen

#7 Post by Vezzra »

The Silent One wrote:On a different matter: my last commit was a little messy (grooming...), does someone know how to crush commits with SmartGit?
I assume you're referring to squashing commits - just looked, SmartGit apparently doesn't provide any means to do that via it's interface.

That's why I use SourceTree together with SmartGit (what I can't do with one, I often can do with the other and vice versa). SourceTree lets you do an "interactive rebase" in its GUI, which allows you to squash commits.

User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Re: enhancing the production screen

#8 Post by The Silent One »

Yes, that's what I meant, thanks for the tip.
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Re: enhancing the production screen

#9 Post by The Silent One »

Me wrote:Yes, that's what I meant, thanks for the tip.
Ehrm, I meant thanks for the hint ;) ... hehe great English speak me ...

So, why I actually write this post: I'd like to change the tooltip of the production screen selection window so that it shows some of the pedia's information (as I've proposed here viewtopic.php?f=10&t=9531). So far, the tooltips have shown the build conditions for ships or buildings, which I think is useful if a player is trying to find out why he can't build something. While I don't think this information is often required, I'm not sure I would completely remove it - maybe the tooltip should just show the conditions that aren't met?

Pull request: https://github.com/freeorion/freeorion/pull/455
Here's how the tooltips look so far:
Attachments
tooltip.jpg
tooltip.jpg (163.34 KiB) Viewed 2157 times
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: enhancing the production screen

#10 Post by Geoff the Medio »

Can you format the parts list like in the pedia?

Code: Select all

Parts: Crystal Armor Plating, Extra Fuel Tank x2, Plasma Cannons x3

User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Re: enhancing the production screen

#11 Post by The Silent One »

Geoff the Medio wrote:Can you format the parts list like in the pedia?

Code: Select all

Parts: Crystal Armor Plating, Extra Fuel Tank x2, Plasma Cannons x3
Sounds reasonable, have updated the pull request respectively.
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: enhancing the production screen

#12 Post by Geoff the Medio »

There also does still need to be an indication of the location conditions somewhere, at least for the unmet ones.

User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Re: enhancing the production screen

#13 Post by The Silent One »

It seem that usually not more than two, maybe at most three conditions aren't met, so I think it would be okay to place them at the bottom of the tooltip. However, I have trouble understanding how the condition code works. Do you have some advice for me how to check for / filter unmet conditions?
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

User avatar
Geoff the Medio
Programming, Design, Admin
Posts: 13587
Joined: Wed Oct 08, 2003 1:33 am
Location: Munich

Re: enhancing the production screen

#14 Post by Geoff the Medio »

The Silent One wrote:Do you have some advice for me how to check for / filter unmet conditions?
ProductionItemRowBrowseWnd is a function in BuildDesignatorWnd.cpp that creates the tooltip for a production item. It calls LocationConditionDescription which returns a string, in which it assembles text representations of the various conditions that need to be met for something to be producible at a location. It does this by making a vector of pointers to the Condition objects, then calling the ConditionDescription function with the relevant source and target objects for the production location. I suppose you could try to modify that to have an extra parameter to only include conditions that are not met in the output... but it's really intended to describe the whole set that must be met, as it has "ALL OF" and built into it. A similar function could be implemented to do what you want, instead.

User avatar
The Silent One
Graphics
Posts: 1129
Joined: Tue Jul 01, 2003 8:27 pm

Re: enhancing the production screen

#15 Post by The Silent One »

Okay. I will be updating the pull request shortly.
Attachments
tooltip.png
tooltip.png (175.17 KiB) Viewed 2099 times
If I provided any images, code, scripts or other content here, it's released under GPL 2.0 and CC-BY-SA 3.0.

Post Reply