// Edit enumerated object link attributes /* Edit enumerated object link attributes - cannot edit multivalue attributes Pekka Mäkinen / SoftQA Oy 2013-07-09 Copyright (c) 2013 SoftQA Oy Creative Commons license: Attribution 3.0 Unported (CC BY 3.0) http://creativecommons.org/licenses/by/3.0/ */ ////////////////////////////////////////////// // Pragmas pragma runLim,0 ////////////////////////////////////////////// // Constants // Version number for the script const string scriptVersion = "1.00" // Maximum number of modules for the name arrays const int MAX_MODULES = 200 // Maximum number of attributes for the name arrays const int MAX_ATTR = 50 ////////////////////////////////////////////// // Variables // Modules Module LinkMod = null string srcMod = "" string trgMod = "" Module currMod = null // Object variables Object o = null Object currObj = null // Integer for storing Absolute Number int absNo = 0 // Link variables Link l = null Link currLink = null // ModuleNames is used to store linked modules to selected module int NumModules = 0 string ModuleNames[MAX_MODULES] // AttrNames is used to store link attributes and their values int NumAttr = 0 string AttrNames[MAX_ATTR] // A skip list for link information Skip LinkList = null // A skip list for link attribute information Skip AttrList = null ////////////////////////////////////////////// // Dialog boxes DB MainDB = null DBE ModuleListDBE = null DBE editBtn = null DBE cancelBtn = null DBE nextBtn = null DBE previousBtn = null DBE MainDBLabel = null DBE EditListDBE = null /////////////////////////////////////////////////////////// // Subroutines /******************************************************************************* * doCancelDB * Cancel */ void doCancelDB(DB mBox) { hide mBox destroy (mBox) mBox = null Module m = null // Close open modules for m in database do { if (isRead(m) && (m != currMod)) { close(m) } } } /******************************************************************************* * doCancelMain * Cancel */ void doCancelMain(DBE mBox) { hide MainDB destroy (MainDB) MainDB = null Module m = null // Close open modules for m in database do { if (isEdit(m) && (m != currMod)) { save (m) close(m) } } if (!null LinkList) { delete LinkList LinkList = null } if (!null AttrList) { delete AttrList AttrList = null } } /******************************************************************************* * RefreshListDBE * Update linked module names to an array */ void RefreshListDBE(Object o, bool Refresh) { int i = 0 string SrcModName = "" ModName_ SrcModRef = null Module TempModule = null if (Refresh) { empty(ModuleListDBE) } // Clear the array of all previous information for (i=0;i "*" do { LinkMod = module l trgMod = target l absNo = targetAbsNo l ModuleNames[NumModules] = name(LinkMod) " -> " trgMod " -> " absNo"" if (Refresh) { insert(ModuleListDBE, NumModules, ModuleNames[NumModules]) } put(LinkList, NumModules, l) NumModules++ } for SrcModRef in o <- "*" do { SrcModName = fullName SrcModRef if ((!null SrcModRef ) && (!open module SrcModName)) { TempModule = edit(SrcModName, false) if (null TempModule) { ack "Module " name(SrcModRef) " can not be edited - can not edit link attributes" } } } for l in o <- "*" do { LinkMod = module l srcMod = source l absNo = sourceAbsNo l ModuleNames[NumModules] = name(LinkMod) " <- " srcMod " <- " absNo"" if (Refresh) { insert(ModuleListDBE, NumModules, ModuleNames[NumModules]) } put(LinkList, NumModules, l) NumModules++ } } /******************************************************************************* * RefreshLinkAttr * List again enumerated link attributes (not multi-valued) for the defined link */ void RefreshLinkAttr (Link l, bool Refresh) { int i = 0 AttrDef ad = null AttrType at = null string tempString = "" if (Refresh) { empty(EditListDBE) } // Clear the array of all previous information for (i=0;i