FreeOrion

Forums for the FreeOrion project
It is currently Tue Oct 24, 2017 12:33 am

All times are UTC




Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next
Author Message
PostPosted: Thu Jan 21, 2016 12:11 pm 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 701
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:
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:
mutable boost::signals2::signal<void (bool)>                    DisplayEncyclopediaDetailPanelSignal;
and connected it with EncyclopediaDetailPanel::Show():

Code:
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.


Top
 Profile  
 
PostPosted: Thu Jan 21, 2016 2:09 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12007
Location: Munich
The Silent One wrote:
Problem: The area of the invisible pedia panel doesn't let mouse clicks through.
Probably because
Code:
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.


Top
 Profile  
 
PostPosted: Thu Jan 21, 2016 8:02 pm 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 701
Geoff the Medio wrote:
Probably because
Code:
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:
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.


Top
 Profile  
 
PostPosted: Thu Jan 21, 2016 8:17 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12007
Location: Munich
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.


Top
 Profile  
 
PostPosted: Fri Jan 22, 2016 7:20 pm 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 701
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.


Top
 Profile  
 
PostPosted: Sat Jan 23, 2016 12:33 pm 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 701
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:
// 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.


Top
 Profile  
 
PostPosted: Sat Jan 23, 2016 4:58 pm 
Offline
Release Manager, Design
User avatar

Joined: Wed Nov 16, 2011 12:56 pm
Posts: 4228
Location: Sol III
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.


Top
 Profile  
 
PostPosted: Sat Jan 23, 2016 5:14 pm 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 701
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.


Top
 Profile  
 
PostPosted: Wed Jan 27, 2016 7:56 pm 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 701
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 http://www.freeorion.org/forum/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 817 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.
Top
 Profile  
 
PostPosted: Wed Jan 27, 2016 9:21 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12007
Location: Munich
Can you format the parts list like in the pedia?
Code:
Parts: Crystal Armor Plating, Extra Fuel Tank x2, Plasma Cannons x3


Top
 Profile  
 
PostPosted: Thu Jan 28, 2016 9:09 am 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 701
Geoff the Medio wrote:
Can you format the parts list like in the pedia?
Code:
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.


Top
 Profile  
 
PostPosted: Thu Jan 28, 2016 10:22 am 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12007
Location: Munich
There also does still need to be an indication of the location conditions somewhere, at least for the unmet ones.


Top
 Profile  
 
PostPosted: Thu Jan 28, 2016 12:42 pm 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 701
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.


Top
 Profile  
 
PostPosted: Thu Jan 28, 2016 1:48 pm 
Offline
Programming, Design, Admin
User avatar

Joined: Wed Oct 08, 2003 1:33 am
Posts: 12007
Location: Munich
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.


Top
 Profile  
 
PostPosted: Fri Jan 29, 2016 11:07 am 
Offline
Graphics
User avatar

Joined: Tue Jul 01, 2003 8:27 pm
Posts: 701
Okay. I will be updating the pull request shortly.


Attachments:
tooltip.png
tooltip.png [ 175.17 KiB | Viewed 759 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.
Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 17 posts ]  Go to page 1, 2  Next

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group