EncyclopediaDetailPanel question

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

Moderator: Committer

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

Re: EncyclopediaDetailPanel question

#16 Post by Geoff the Medio »

Is there a reason to add a separate constructor taking a parameter for the flags, rather than adding a parameter and using a default value equal to the old flags? Would avoid needed to add Init() as well...

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

Re: EncyclopediaDetailPanel question

#17 Post by vincele »

Because my C++ is *very* rusty... Here's a new 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!

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

Re: EncyclopediaDetailPanel question

#18 Post by vincele »

I also would like to propose another change to EDP, mainly removing the "static" from m_items & m_items_it, because I see no reason that one EDP change another one's state.
I prefer them to stay away from each other's toes, so that when closing design, prod or research window, the mapwnd's pedia is still on the page it was before toggling those full screen windows.

[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!

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

Re: EncyclopediaDetailPanel question

#19 Post by Geoff the Medio »

vincele wrote:Here's a new one...
You don't specify default parameters in the constructor declaration.

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

Re: EncyclopediaDetailPanel question

#20 Post by vincele »

You mean the .h does not need any modification ?
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

#21 Post by Geoff the Medio »

"don't" meant "didn't"

Your constructor declaration doesn't specify default parameters. The constructor is used elsewhere assuming 2 parameters, but needs 3, because there is no default for the new parameter.

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

Re: EncyclopediaDetailPanel question

#22 Post by vincele »

like this ?

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

If not, I clearly don't understand what you're speaking about, sorry...
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
adrian_broher
Programmer
Posts: 1156
Joined: Fri Mar 01, 2013 9:52 am
Location: Germany

Re: EncyclopediaDetailPanel question

#23 Post by adrian_broher »

vincele wrote:If not, I clearly don't understand what you're speaking about, sorry...
To specify default parameters the declaration needs to define the default parameters

TheClass.h

Code: Select all

#ifndef THECLASS_H
#define THECLASS_H
class TheClass {
public:
    TheClass(int param1, int param2 = 2); // param2 has now the default value 2
};
#endif
TheClass.cpp

Code: Select all

#include "TheClass.h"

TheClass::TheClass(int param1, int param2) // the definition doesn't contain the default parameter
{
}
TheClient.cpp

Code: Select all

#include "TheClass.h"

int main(int argc, char** argv)
{
    TheClass intstance1(5); // a instance with param2 = 2 is created;
    TheClass instance2(5, 3); // this instance has param2 with the value 3;
}
Resident code gremlin
Attached patches are released under GPL 2.0 or later.
Git author: Marcel Metz

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

Re: EncyclopediaDetailPanel question

#24 Post by Geoff the Medio »

That patch builds and runs, and hides the X on the design screen, but it didn't deal with the research and production screens with the same issue...

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

Re: EncyclopediaDetailPanel question

#25 Post by vincele »

Geoff the Medio wrote:That patch builds and runs, and hides the X on the design screen, but it didn't deal with the research and production screens with the same issue...
I know the code for prod & research didn't have anything but I don't see the X button on those EDPs so I didn't fix the non-problem, I did the minimal fix... Do you see an X button on those ? As I'm not seeing any close buttons on those I won't be able to test the additional changes...

Here is the updated patch...

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

Thanks Adrian for the perfect explanations.
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

#26 Post by Geoff the Medio »

Try dragging the research and production pedia panels around. For some reason the X doesn't appear until they're moved for me...

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

Re: EncyclopediaDetailPanel question

#27 Post by vincele »

Geoff the Medio wrote:Try dragging the research and production pedia panels around. For some reason the X doesn't appear until they're moved for me...
Indeed, the button appeared after wnd move, and the latest patch fixes that.

Any thoughts about the static-ectomy patch ?
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

#28 Post by Geoff the Medio »


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

Re: EncyclopediaDetailPanel question

#29 Post by vincele »

Thanks a lot for the mentoring.

Let me know what you think about the idea of removing the static, there's no rush though.
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