EncyclopediaDetailPanel question

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

Moderator: Committer

Message
Author
User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

EncyclopediaDetailPanel question

#1 Post by vincele »

Hello,
I'm trying to understand how the opening of a new EncyclopediaDetailPanel (f.e. the prodwnd or researchwnd ones) can alter what is shown in another (the mapwnd one).
I'm starting to think it's coming from a chain of signals, because I can't find anything in the code that does this directly. Maybe I'm not looking hard enough, can someone help ?
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

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

Re: EncyclopediaDetailPanel question

#2 Post by Geoff the Medio »

There is probably a mix of different things happening.

MapWnd::ShowProduction() explicitly calls m_pedia_panel->SetIndex() and ShowResearch calls m_pedia_panel->SetText("ENC_TECH", false), neither of which are necessary, I think.

BuildDesignatorWnd::BuildSelector::BuildItemLeftClicked emits DisplayBuildingTypeSignal which is connected to EncyclopediaDetailPanel::SetItem, which changes the production pedia panel, without changing the map pedia panel.

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: EncyclopediaDetailPanel question

#3 Post by vincele »

Geoff the Medio wrote:MapWnd::ShowProduction() explicitly calls m_pedia_panel->SetIndex() and ShowResearch calls m_pedia_panel->SetText("ENC_TECH", false), neither of which are necessary, I think.
D'oh, this was it, I was already in these code path for the other patches, and did not see what was right in front of me... Thanks...
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: EncyclopediaDetailPanel question

#4 Post by vincele »

Geoff the Medio wrote:MapWnd::ShowProduction() explicitly calls m_pedia_panel->SetIndex() and ShowResearch calls m_pedia_panel->SetText("ENC_TECH", false), neither of which are necessary, I think.
I'd even say they are wrong, there's no need to change the mapwnd's EncyclopediaDetailPanel in those methods, and if that EDP is to stay opened, it better has to stay where the user wants it.
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

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

Re: EncyclopediaDetailPanel question

#5 Post by Geoff the Medio »


User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: EncyclopediaDetailPanel question

#6 Post by vincele »

Thanks, I was testing with the calls removed and found it more pleasant. Especially when the pedia toggling does not get you out of prodwnd, for example.
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: EncyclopediaDetailPanel question

#7 Post by vincele »

Hello,

in the same vein, I stumbled upon something that looks strange, all the MapWnd::ShowXXX() methods start with a call to ClearProjectedFleetMovementLines(); but not ShowEmpires(). I didn't look further into it, but that made me wonder if it was just forgotten, or if there is something else I don't understand about that...
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

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

Re: EncyclopediaDetailPanel question

#8 Post by Geoff the Medio »

vincele wrote:all the MapWnd::ShowXXX() methods start with a call to ClearProjectedFleetMovementLines(); but not ShowEmpires(). I didn't look further into it, but that made me wonder if it was just forgotten...
Probably. I'm not really sure what the ClearProjectedFleetMovementLines() call actually accomplishes anyway, but presumably there was a reason?

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: EncyclopediaDetailPanel question

#9 Post by vincele »

Another thing I saw: the encyclopedia in designwnd has an "X"-close button that is not working, whereas prodwnd or researchwnd don't have that button. I searched for differences in code that can explain the presence/absence of the button but found nothing... Where is it hidden ?
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

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

Re: EncyclopediaDetailPanel question

#10 Post by Geoff the Medio »


User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: EncyclopediaDetailPanel question

#11 Post by vincele »

Thanks, and sorry, I should have searched before asking...
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: EncyclopediaDetailPanel question

#12 Post by vincele »

I tried another approach, adding a CUIWnd mutator to set the closable flag, and this is working for me, would the constructor modification be prefered ?
See the attached patch...

[The extension diff has been deactivated and can no longer be displayed.]

What do you think ?
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

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

Re: EncyclopediaDetailPanel question

#13 Post by Geoff the Medio »

Having a mutator isn't necessary because it's unlikely one would need to change whether a Wnd is closable after it has been created. The CLOSABLE flag already lets one specify this.

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: EncyclopediaDetailPanel question

#14 Post by vincele »

OK, I'll redo it the other way then
All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

User avatar
vincele
Space Dragon
Posts: 341
Joined: Sun Mar 23, 2014 6:10 pm

Re: EncyclopediaDetailPanel question

#15 Post by vincele »

What about this one ?

[The extension diff has been deactivated and can no longer be displayed.]

All the patches I'll provide for freeorion will be released under the GPL v2 or later license.
Let's unleash the dyson forest powa!

Post Reply