diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index a2a15efe4e..0a96f849db 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * 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 diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index 60df422b93..dcca4e029b 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008 Wayne Stambaugh - * 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. *