← Back to team overview

kicad-developers team mailing list archive

Re: Why double LoadSettings?

 

Le 16/04/2015 11:32, Mário Luzeiro a écrit :
> Hello all,
> I found this type of implementation for settings in multiple parts in KiCad project.
> Would some one like to explain this mechanism?
> 
> 
> void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg )
> {
>     EDA_BASE_FRAME::LoadSettings( aCfg );
> ...
> 
> 
> Thanks,
> Regards,
> Mario Luzeiro

LoadSettings is a virtual method (like some other methods), from the
base class EDA_BASE_FRAME  (it is defined as virtual in this class).

in the base class, LoadSettings read some previously saved window
parameters (position and size).

The other versions of LoadSettings (in derived classes) do not have code
to load these parameters (to avoid duplicate code).
They contain code to load saved parameters only specific to the derived
class.

therefore in:
void EDA_3D_FRAME::LoadSettings( wxConfigBase* aCfg )
{
   EDA_BASE_FRAME::LoadSettings( aCfg );

   < code to load saved parameters only specific to EDA_3D_FRAME class >
}

the code to load the window position and size is called by
EDA_BASE_FRAME::LoadSettings( aCfg );

which executes the virtual method LoadSettings() of the base class
EDA_BASE_FRAME (which is not the same code as
EDA_3D_FRAME::LoadSettings() ).


-- 
Jean-Pierre CHARRAS


References