← Back to team overview

kicad-developers team mailing list archive

Re: [PATCH] fix "opening view menu changes canvas" bug

 

Merged. Good catch, thank you.

On Fri, Feb 10, 2017 at 08:43:54PM +0100, Julius Schmidt wrote:
> The attached patch fixes a minor bug where opening the 'View' menu
> will sometimes revert the canvas to the default canvas.  The problem is
> that wxMenuItem::Check will cause a menu event when the status is changed
> even if the checkmark is being *unset*.  The workaround is to only call
> Check with a true argument.  This works because the menu items are radio
> buttons.
> 
> aiju
> 
> ---
>  pcbnew/basepcbframe.cpp | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/pcbnew/basepcbframe.cpp b/pcbnew/basepcbframe.cpp
> index 569c03f..a27d9f3 100644
> --- a/pcbnew/basepcbframe.cpp
> +++ b/pcbnew/basepcbframe.cpp
> @@ -1048,6 +1048,7 @@ void PCB_BASE_FRAME::OnUpdateSwitchCanvas( wxUpdateUIEvent& aEvent )
>      for( auto ii: menuList )
>      {
>          wxMenuItem* item = menuBar->FindItem( ii.menuId );
> -        item->Check( ii.galType == canvasType );
> +        if( ii.galType == canvasType )
> +            item->Check( true );
>      }
>  }
> -- 
> 2.1.4
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp


References