Always create grid menu so units are up-to-date.

Fixes: lp:1777519
* https://bugs.launchpad.net/kicad/+bug/1777519
This commit is contained in:
Jeff Young 2018-06-19 10:51:24 +01:00
parent 81a5c0e3bf
commit 3c7b91b96a
3 changed files with 11 additions and 2 deletions

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2015 CERN * Copyright (C) 2015 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* Copyright (C) 2015-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2018 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -51,6 +51,13 @@ GRID_MENU::GRID_MENU( EDA_DRAW_FRAME* aParent ) : m_parent( aParent )
} }
CONTEXT_MENU* GRID_MENU::Clone() const
{
// Just return a fresh menu. This keeps the units up-to-date.
return create();
}
OPT_TOOL_EVENT GRID_MENU::eventHandler( const wxMenuEvent& aEvent ) OPT_TOOL_EVENT GRID_MENU::eventHandler( const wxMenuEvent& aEvent )
{ {
OPT_TOOL_EVENT event( ACTIONS::gridPreset.MakeEvent() ); OPT_TOOL_EVENT event( ACTIONS::gridPreset.MakeEvent() );

View File

@ -142,7 +142,7 @@ public:
/** /**
* Creates a deep, recursive copy of this CONTEXT_MENU. * Creates a deep, recursive copy of this CONTEXT_MENU.
*/ */
CONTEXT_MENU* Clone() const; virtual CONTEXT_MENU* Clone() const;
protected: protected:
///> Returns an instance of this class. It has to be overridden in inheriting classes. ///> Returns an instance of this class. It has to be overridden in inheriting classes.

View File

@ -34,6 +34,8 @@ class GRID_MENU : public CONTEXT_MENU
public: public:
GRID_MENU( EDA_DRAW_FRAME* aParent ); GRID_MENU( EDA_DRAW_FRAME* aParent );
CONTEXT_MENU* Clone() const override;
private: private:
CONTEXT_MENU* create() const override CONTEXT_MENU* create() const override
{ {