RPL Global User-defined Functions -- 4-15-2009 http://cadswes2.colorado.edu/~philw/2009/GlobalRplFunctions/ Global Functions (User-Defined Functions in Global RplSets) are now available in the RPL Palette for other RplSets. ----------------------- QtRpl/RplPaletteDlg.cpp ----------------------- (1) RplPaletteDlg::updateUserFunctions(), now uses the new RplSet:: getUtilityGroups method which optionally includes in the returned list (a) Global Groups available to the RplSet, and (b) Predefined Groups in the RplSet. (2) RplPaletteDlg::FunctionViewItem::update(): Added the RplObj (Function) Icon to the Function Name column. This distinguishes Global Functions from Local Functions. ===== -------------- Rpl/RplObj.hpp Rpl/RplObj.cpp -------------- More nuanced (and correct) determination of a RplObj being global: Predefined Groups and Functions are never global (even if they are instantiated within a Global RplSet. New public RplObj method (non-virtual): bool RplObj::rplObjIsGlobal() const { return (!isPredefined() && rplSetIsGlobal()); } ------------------ QtRpl/RplIcons.cpp QtRpl/RplIcons.hpp ------------------ Change of "global" variants of the RplObj icons. Instead of having distinct basic icons for the global variants, dynamically compose (AND CACHE) global variants from two basic icons: the RplObj icon and the Globe icon. (This looks like two distinct icons, but can be handled in the Qt GUI code as a single icon). Added 2nd method: static const QPixmap& getObjIcon (const RplObj*); static const QPixmap& getGlobalObjIconIfGlobal (const RplObj*); <<< NEW Private data structure: // An ownership container of QPixmaps dynamically constructed from a // standard (rectangular) RplObj Icon and the Global Icon Symbol. The // map is indexed by QPixmap::cacheKey() of the standard RplObj Icon. QMap _globalCompositeIconMap; ------------------------ QtRpl/RplBlockDlg.cpp QtRpl/RplFunctionDlg.cpp QtRpl/RplGroupDlg.cpp QtRpl/RplListView.cpp QtRpl/RplPaletteDlg.cpp QtRpl/RplSetDlg.cpp ------------------------ (1) In Rpl Editors, move the setting of the _rplObjTypeIconLabel from the initWidgets() method to the update() method. This is needed because the "Global State" icon (a globe) is now composited with the RplObj type icon. (2) Unconditionally hide the _globalIconLabel (in preparation for removal), as it is now redundant with the _rplObjTypeIconLabel. (3) Where applicable, use the new RplObj::rplObjIsGlobal() method instead of the RplObj::rplSetIsGlobal() method. This correctly refrains from decorating the Predefined Function instances within Global RplSets as being Global. (4) In general, use the new RplIcon::getGlobalObjIconIfGlobal (const RplObj*) method instead of RplIcon::getObjIcon (const RplObj*). These methods have the same result if the RplObj is not global. But if the RplObj IS global, then the composited RplObj icon (including the globe icon) is returned. ---