Ensure LIB_ALIAS elements are always drawn

We add LIB_ALIAS to the VIEW rtree when choosing a new symbol or
browsing.  The actual display element may change based on the unit or
demorgan representation but there will only ever be a single one drawn.
This will set the view bbox to maximum to ensure it is always checked
for drawing.

 Related to lp:1796960
 https://bugs.launchpad.net/kicad/+bug/1796960

(cherry picked from commit d25d62295a)
This commit is contained in:
Seth Hillbrand 2019-03-10 20:13:38 -07:00
parent 5424223949
commit 5855f2d909
2 changed files with 23 additions and 2 deletions

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2004-2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -152,10 +152,21 @@ const EDA_RECT LIB_ALIAS::GetBoundingBox() const
// a LIB_ALIAS does not really have a bounding box.
// return a 0 size rect.
EDA_RECT dummy;
return dummy;
};
const BOX2I LIB_ALIAS::ViewBBox() const
{
// LIB_ALIAS may be displayed in preview windows, so ensure that it is always
// selected for drawing.
BOX2I bbox;
bbox.SetMaximum();
return bbox;
}
wxString LIB_ALIAS::GetSearchText()
{
// Matches are scored by offset from front of string, so inclusion of this spacer

View File

@ -3,7 +3,7 @@
*
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2004-2018 KiCad Developers, see change_log.txt for contributors.
* Copyright (C) 2004-2019 KiCad Developers, see change_log.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -106,6 +106,16 @@ public:
// to avoid useless messages in debug mode
const EDA_RECT GetBoundingBox() const override;
/**
* Returns a default bounding box for the alias. This will be set to the full
* bounding size, ensuring that the alias is always drawn when it is used on screen.
*
* N.B. This is acceptable only because there is typically only a single LIB_ALIAS
* element being drawn (e.g. in the symbol browser)
* @return a maximum size view bounding box
*/
virtual const BOX2I ViewBBox() const override;
/**
* Get the shared LIB_PART.
*