RPL Global User-defined Functions -- 4-24-2009 http://cadswes2.colorado.edu/~philw/2009/GlobalRplFunctions/ (1) A new RplApplication (RplApplication::GLOBAL) was created for Global RplSets, Global RplGroups and Global RplFunctions. (2) A new RplSetMgr singleton subclass now manages all of the Global RplSets. NOTE: This, and the GLOBAL RplApplication now make the RplSet _isGlobal flag redundant. The _isGlobal flag and its accessors should be removed. (3) Global RplSets are now accessible across the different RplApplications. This is not just desirable, but now necessary because Global RplSets now have their own specific RplApplication ("GLOBAL"). (4) Enhancement of the Workspace Policy menu to support Global RplSets as a third type of openable (but not loadable) RplSet managed by a RplSet Manager, and supporting a distinct history of recently accessed RplSet files. ---------------------- Rpl/RplApplication.cpp Rpl/RplApplication.hpp ---------------------- Added to the RplApplication::Type enum: RplApplication::GLOBAL ----------------- Rpl/RplSetMgr.cpp Rpl/RplSetMgr.hpp Rpl/GlobalRplSetMgr.cpp (recently added) Rpl/GlobalRplSetMgr.hpp (recently added) ----------------- New private method called when a RplSet is added to the manager: private: // Overridden in GlobalRplSetMgr subclass. // Base class implementation clears the _isGlobal flag. virtual void setAdded_updateGlobalFlag (RplSet*); void RplSetMgr::allOpenSets (Rpl::SetList& sets) ... void RplSetMgr::getAllGlobalGroups (cwSlist& retList, ..) ... added support for the RplSets managed by the GlobalRplSetMgr. -------------- Rpl/RplObj.hpp -------------- Added new public inlined method: inline bool RplObj::appIsGlobal() const { return getApplicationType() == RplApplication::GLOBAL; } -------------- Rpl/RplSet.cpp Rpl/RplSet.hpp -------------- Revised parameters for this first method, and added the second method: void getUtilityGroups (cwSlist& retList, bool inclUtilityGroups, bool inclExternalGlobalGroups, bool inclPredefinedGroups) const; void getGroups (cwSlist& retList, bool inclPolicyGroups, bool inclUtilityGroups, bool inclExternalGlobalGroups, bool inclPredefinedGroups) const; Added optional boolean parameter to these two public methods. These methods now use getGroups() (see prior item) instead of iterating explicitly over the RplSet's policy and utility groups. RplGroup* findGroup (const RWCString& groupName, bool searchAlsoExternalGlobalSets = false); RplFunction* findFunction (const RWCString& functionName, bool searchAlsoExternalGlobalSets = false); Change to RplSet::populateNameSpace(): Use the static RplSetMgr::getAllGlobalGroups() method instead of the instance method: RplSetMgr::getGlobalGroups() on the RplSetMgr associated with 'this' RplSet. This now causes Global RplSets to be visible across the different RplApplications. ------------------- QtRpl/RplDlgMgr.cpp QtRpl/RplDlgMgr.hpp ------------------- Added feature flags uses in various Rpl Dialogs during this development. *** SEE extensive descriptions in the header file: #define SHOW_RPL_GROUP_TYPE_ICON_BUTTON false #define SHOW_DYNAMIC_GLOBAL_TOGGLE false #define RPLSET_SHOWS_EXTERNAL_RPLOBJS true // temporary Support for the new Global RplSet Manager: bool newGlobalFunctionSet (); bool openGlobalFunctionSet (); bool openGlobalFunctionSet (const char* file); bool openGlobalFunctionSet (const rwFile& fileObj, cwfpointer& fp, RWCString& error); ------------------------- QtRpl/RplSetDlg.cpp QtRpl/RplGroupDlg.cpp QtRpl/RplBlockDlg.cpp QtRpl/RplFunctionDlg.cpp QtRpl/RplListView.cpp ------------------------- Changes to support the design changes, and the hiding of the Load button in editor dialogs for Global RplSets. See these methods: initWidgets() update() initForApplication() RplListView::addRplSetItem() ------------------ QtRpl/RplFrame.cpp ------------------ In void RplFrame::contentsMouseDoubleClickEvent (QMouseEvent*), also search in the accessible Global RplSets: RplFunction *function = _rplSet->findFunction (funcName, true); // searchAlsoExternalGlobalSets ------------------------ QtRpl/RplPaletteDlg.cpp QtRpl/RplBaseDlg.cpp ------------------------ Minor enhancements, e.g. better assertion messages, and adjustments for parameters added to a RplSet method. ------------------- Q3GUI/Workspace.cpp Q3GUI/Workspace.hpp ------------------- Enhancement of the Workspace Policy menu to support Global RplSets as a third type of openable (but not loadable) RplSet managed by a RplSet Manager, and supporting a distinct history of recently accessed RplSet files. // ... // Global Function Set // Show >> ... // Reopen >> ... // ------------- // New... // Open... New data members: bool _defaultDirAlreadyApplied_GblSets; QAction *_newGlobalSetAction; QAction *_openGlobalSetAction; QMenu* _gblSetMenu; QMenu* _reopenGblSetMenu; QMenu* _showGblSetMenu; New methods: void aboutToShow_GblSetMenu(); void aboutToShow_ReopenGblSetMenu(); void aboutToShow_ShowGblSetMenu(); void openNewGlobalSet(); void openGlobalSet(); --------------------- Q3GUI/LoadSaveMgr.cpp Q3GUI/LoadSaveMgr.hpp --------------------- Support for Global RplSets as a distinct RplApplication managed by a distinct RplSetMgr type and instance. New menuCommand: LoadSaveMgr::OPEN_GBLSET New local definitions (in .cpp file): static const char* Env_DefaultDir_GblSet ("RIVERWARE_DFLT_GBLSET_DIR"); static const char* KEYBASE_GBLSET ("GlobalSet"); static const char* FILTER_STR_GBLSET_FILES ("Global Function Set Files (*.gbl *.gbl.gz);;" "RuleSet Files (*.rls *.rls.gz);;" "Optimization Policy Set Files (*.opt *.opt.gz);;" "gzip Files (*.gz);;" "All (*)"); New data members: std::list _recentGblSetFilePaths_Accessed; std::list _recentGblSetDirs_Accessed; New methods: static const char* defaultGblSetDirSymbol(); // Env_DefaultDir_GblSet static QString defaultGblSetDir(); // "" if environment var not defined QString recentGblSetPath() const; void doOpenGblSet (int cmd, const QString* inPath=NULL); void loadRecentGblSetFilePaths(); void loadRecentGblSetDirs(); void saveRecentGblSetFilePaths() const; void saveRecentGblSetDirs() const; void recordGblSetPath (const QString& path, bool saveOp); // or loadOp? void getRecentGblSetPaths (std::list& fileList, std::list& dirList, bool alreadyOpen) const; void appendRecentGblSetDirs (std::list& dirList) const; void appendRecentGblSetDirs (QStringList& dirList) const; ---