/3.0 (Extension.1 Name: "Chart Viewer" Dependencies: "$AVBIN/chartview.dll\n" FirstRootClassName: "List" Roots: 2 Roots: 3 Roots: 12 Roots: 13 Roots: 14 Roots: 15 Roots: 16 Version: 30 About: "Extends ArcView to support NOAA Nautical Chart Images in BSB format. Developed by the NOAA Coastal Services Center, in cooperation with ESRI and Maptech, Inc." LoadScript: 17 CanUnloadScript: 18 UnloadScript: 19 InstallScript: 20 UninstallScript: 21 ProjectSaveScript: 22 ExtVersion: 3 ) (List.2 ) (List.3 Child: 4 ) (List.4 Child: 5 Child: 9 Child: 11 ) (List.5 Child: 6 Child: 7 Child: 8 ) (AVStr.6 S: "View" ) (AVStr.7 S: "ButtonBar" ) (AVStr.8 S: "BSB.GetProjInfo" ) (Butn.9 Help: "Add a Nautical Chart//Use this button to add a Nautical Chart (Shift-Click: for more help)" Icon: 10 Click: "BSB.GetProjInfo" ) (AVIcon.10 Name: "chart.bmp" Data: 4e442049 6d616765 00010014 00110000 Data: 03fcefde d6efded6 ffffffff ffffffff Data: ffffffff efded6ef ded6efde d6efded6 Data: ffffffff ffffffff ffffffff efded6ff Data: ffffffff ffefded6 efded6ef ded6ffff Data: ffffffff ffffffff ffffffff ffefded6 Data: 949494ef ded6efde d6efded6 ffffffff Data: ffffffff ffefded6 efded6ff ffffefde Data: d6efded6 efded6ef ded6ffff ff000000 Data: efded6ef ded6efde d6efded6 000000ef Data: ded6efde d6efded6 efded6ff ffffffff Data: ffffffff ffffffef ded6efde d6efded6 Data: efded6ef ded6efde d6949494 efded6ef Data: ded6efde d6efded6 efded6ef ded6efde Data: d6ffffff ffffffff ffffffff ffffffff Data: 000000ef ded6efde d6efded6 efded6ef Data: ded6a5de efa5deef a5deef00 0000a5de Data: efa5deef 000000ef ded6efde d6ffffff Data: ffffffff ffffffff ffffffff ffffffff Data: ffffefde d6efded6 efded6ef ded6a5de Data: efa5deef a5deefa5 deefa5de efa5deef Data: efded6ef ded6efde d6ffffff ffffffff Data: ffffffff ffffffff 94949400 0000efde Data: d6949494 efded6ef ded6a5de efa5deef Data: a5deefa5 deefa5de efa5deef a5deef00 Data: 0000ffff ffffffff ffffffff ffffffff Data: ffefded6 efded6ce ded6cede d6ceded6 Data: ceded6ef ded6a5de efa5deef a5deefa5 Data: deefa5de efa5deef a5deefc6 eff7ffff Data: ffffffff ffffffff ffffffff ffefded6 Data: ceded6ce ded60000 00ceded6 efded6ef Data: ded6a5de efa5deef a5deefa5 deefa5de Data: efa5deef 00000000 00009494 94ffffff Data: ffffffff ffffefde d6ceded6 ceded6ce Data: ded6cede d6efded6 efded6ff ffffa5de Data: efa5deef a5deefa5 deefa5de efa5deef Data: a5deefc6 eff7ffff ffffffff ffffff00 Data: 0000efde d6ceded6 ceded6ef ded6ffff Data: ffffffff ffffffff ffffa5de efa5deef Data: a5deefa5 deefa5de efa5deef a5deefc6 Data: eff7ffff ffffffff ffffffff ffff9494 Data: 94ceded6 000000ff ffffffff ffffffff Data: ffffffff ffffa5de efa5deef a5deefa5 Data: deefa5de efa5deef a5deefc6 eff7ffff Data: ffffffff 000000ff ffffffff ff000000 Data: ffffffff ffffffff ffffffff ffffffef Data: ded6a5de efa5deef a5deefa5 deefa5de Data: efa5deef a5deefc6 eff7ffff ffffffff Data: ffffff00 0000ffff ffffffff ffffffff Data: ffffefde d6efded6 efded6ef ded6a5de Data: ef000000 a5deefa5 deefa5de efa5deef Data: a5deefc6 eff7ffff ffffffff 949494ff Data: ffffffff ffffffff ffffffef ded6efde Data: d6efded6 ceded600 0000a5de efa5deef Data: a5deefa5 deefa5de efa5deef a5deef00 Data: 0000ffff ffffffff ffffffff ffffffff Data: ffffffff efded6ef ded6efde d6efded6 Data: c6eff7c6 eff7a5de efa5deef a5deefa5 Data: deefa5de efa5deef a5deefc6 eff7ffff Data: ffffffff 000000ff ffff0000 00ffffff Data: efded6ef ded6ffff ff000000 c6eff7c6 Data: eff70000 00a5deef a5deefa5 deefa5de Data: ef000000 a5deefc6 eff70000 00ffffff Data: ffffff00 0000ffff ff000000 efded600 Data: 0000efde d6ffffff c6eff7c6 eff70000 Data: 00000001 00180007 00200001 0002 ) (Numb.11 N: 23.00000000000000 ) (List.12 ) (List.13 ) (Script.14 Name: "BSB.ReturnString" SourceCode: "s = Self.Get(0)\nkey = Self.Get(1)\ni = s.indexof(key)\npos = s.count - i - key.count\nst = s.right(pos)\nreturn st" ) (Script.15 Name: "BSB.GetProjInfo" SourceCode: "'This script should be run after a BSB chart has been added to a View.\n'It reads the header of the active BSB chart to determine projection parameters\n'and then allows the user if they want to apply these parameters to the\n'current View.\n'Script only handles charts that in Mercator, Universal Transverse Mercator, or\n'Lambert projections.\n'Original coding by Jeff Cowen, Technology Planning and Management Corporation contractor at the NOAA Coastal Services\n'Center, 9/22/97\n'Last edit 3/30/98\n\nif (System.ISShi ftKeyDown) then\n message = \"Tips for Using the ChartView Extension:\"+NL+NL+\n \"PLEASE NOTE: these charts are not intended for Navigational use!\"+NL+\n \"The developers of this extension can not be held liable if the results of using this extension are used for \"+\n \"navigational purposes. Please label all output with 'NOT FOR NAVIGATIONAL USE.'\"+NL+NL+\n \"The extension of the file (kap), must be lower case.\"+NL+NL+ \n \"Skewed Images:\"+NL+\n \"Please Note that skewed images take longer to display than non-sk ewed images and that this process is memory \"+\n \"intensive. The user will be notified if the chart is skewed. \"+\n NL+NL+\n \"Overlaying Vector Data:\"+NL+\r\n \"Vector data can be overlaid in either of two ways. 1) If the vector data is in the same projection as the chart \"+ \r\n \"(see note below regarding Mercator), simply add the data and display. 2) If the vector data are in \"+\r\n \"Decimal Degrees, the 'View Properties' must be set to the projection of the chart. To aid this process, the \"+ \r\n \"'chart' b utton provides the option of setting the correct 'View Properties'. Once the correct 'View \"+ \r\n \"Properties' have been set the Decimal Degree data can be added to the View. \"+\r\n \"Note that there is no third option. If the vector data is in another projection (i.e. State Plane), there is no \"+ \r\n \"way to combine it with the charts. In this case, either the raster (chart) or the vector will have be \"+ \r\n \"reprojected to a common projection. A method for reprojecting these charts is under developmen t. \"+\r\n NL+NL+\r\n \"Projection Specific Information:\"+NL+NL+\r\n \"Mercator:\"+NL+\n \"To allow multiple Mercator projected charts to display in the same View, the user is asked to specify a \"+ \r\n \"latitude of true scale. Once the latitude of true scale has been set for a View, subsequent charts will \"+\n \"be displayed using the set latitude of true scale. While this does not warp the images it does \"+ \r\n \"change the scaling. Therefore, distances measured in ArcView will not match the distances measured on \"+ \r\n \"the paper chart. *Please see the discussion of latitude of true scale at the end of this message. \"+\r\n NL+NL+\r\n \"Lambert Conformal Conic:\"+NL+\n \"These charts typically cannot be combined with other charts in the same View. \"+ \r\n \"To combine charts, they need to be in the same projection and the projection parameters appear to be \"+ \r\n \"unique for each chart.\"+\r\n NL+NL+\n \"Universal Transverse Mercator:\"+NL+\n \"Although the charts are labeled as Universal Transverse Mercator, they are \"+ \r\n \"Transverse Mercator and each has its own set of projection parameters. The comments for the Lambert \"+ \r\n \"Conformal Conic apply.\"+\r\n NL+NL+\r\n \"Polyconic:\"+NL+\n \"ArcView doesn't support this projection. Therefore only vector data that is in exactly the same \"+ \r\n \"projection as the chart will overlay. Each chart has its own projection parameters, so multiple charts cannot \"+ \r\n \"be combined in the same view.\"+\r\n NL+NL+\r\n \"Other Notes:\"+NL+\r\n \"Please be aware that these charts are NOT intended to be used for navigational purposes. \"+\r\n \"Hotlinking to image charts is not supported. \"+\n NL+NL+\n \"*Latitude of True Scale: \"+NL+\n \"For any projection there is some degree of distortion. The type and degree of \"+\n \"distortion is dependent upon the projection. For the Mercator projection, there is a \"+\n \"latitude along which the distortion is zero. The greater the distance from that \"+\n \"latitude, the greater the distortion. This means that distances measured near the \"+\n \"latitude of true scale in a Mercator projection are representative of what is measured \"+\n \"on the earth. Distances measured far from the latitude of true scale will be incorrect. \"+\n \"Hence, if distance measurements will be important, it is a good idea to use a latitude \"+\n \"of true scale appropriate to the data. \"+\n NL+NL+\n \"Caveats and Discussion of Mercator and ChartView Extension: \"+\n \"In the effort to aid functionality to this extension, the ability to change the latitude of \"+\n \"true scale on a Mercator chart has been added. This adds both desirable qualities and \"+\n \"potential problems. In general, the digital charts have their own latitude of true scale, \"+\n \"typically through the center of the chart. This means that two charts cannot be \"+\n \"displayed in the same view correctly because they are in different projections. By \"+\n \"modifying the information obtained from the chart, in particular the upper left corner \"+\n \"coordinates and the pixel size, it is possible to display the chart wit h a different \"+\n \"latitude of true scale.\"+\n NL+NL+\n \"To accommodate the need for low distortion measurements, the ability for the user to \"+\n \"specify the latitude of true scale was added. An understanding of how this is done in \"+\n \"ArcView is essential for disaster recovery. If the latitude of true scale has not been set \"+\n \"for a View, the avenue script activated by the 'chart' button will prompt for the latitude \"+\n \"of true scale. The input latitude is then used to set an environment v ariable \"+\n \"(MERCSTDLAT). This environment variable is read by the C code part of the \"+\n \"extension and used to determine the upper left corner and the pixel size and report it \"+\n \"back to ArcView. If the latitude of true scale has been set for a View, subsequent charts, \"+\n \"added to that View will be displayed using the current latitude of true scale. ArcView only \"+\n \"accepts this information from a theme once for a given view. If the view properties are \"+\n \"changed, simply deleting the chart and reloading it will not work. The chart must be deleted, \"+\n \"the project closed and reopened, and the chart reloaded using the 'chart' button. Although the \"+\n \"chart may be added to new View. \"\n msgBox.Report(message,\"Help For ChartView Extension\")\nelse\n\n\ntheComments = \"\"\nrows = 0\ncols = 0\ntheFile = FileDialog.Show(\"*.kap\",\"BSB Chart\",\"Select Chart to Open\")\nif (theFile = NIL) then\n system.Beep\n exit\nend\n\n'Read the header information from the BSB Chart and store information.\ntheLF = TextFi le.Make(theFile,#FILE_PERM_READ)\ntheLF.GoToBeg\nkeepon = true\ntheName = \"\"\ncurline = \"\"\ntheC = \"\"\nDoPrj = True\nWhile(keepon)\n theElt = theC\n notdone=true\n While (theC <> NL)\n theC = theLF.ReadElt\n theElt = theElt+theC\n end\n theElt = theElt.substitute(CR,\"\")\n theElt = theElt.substitute(NL,\"\")\n while(notdone)\n theC = theLF.ReadElt\n if(theC = \" \") then\n theElt = theElt + \",\"\n While (theC <> NL)\n theC = theLF.ReadElt\n theElt = theElt+theC\n end\n theElt = theElt .substitute(CR,\"\")\n theElt = theElt.substitute(NL,\"\")\n else\n notdone=false\n end\n end\n \n 'Store the Name of the chart into variable (theName) \n if (theElt.Contains(\"BSB/NA=\"))then\n cnt = 0\n theTokes = theElt.AsTokens(\",\")\n for each t in theTokes\n if (t.Contains(\"BSB/NA=\")) then\n 'theName = t.Substitute(\"BSB/NA=\",\"\")\n theName = av.Run(\"BSB.ReturnString\",{t,\"NA=\"})\n end 'Found Name\n if (t.Contains(\"RA=\")) then\n rows = t.Substitute(\"RA=\",\"\")\n if (thetokes.Count > (cnt + 1)) then\n cols = theTokes.Get(cnt + 1) \n end\n mem = (rows.AsNumber * cols.AsNumber) / 1000000\n end \n cnt = cnt + 1\n end\n end\n 'Store the Scale of the chart into variable (theScale)\n if (theElt.Contains(\"KNP/\")) then\n theTokes = theElt.AsTokens(\",\")\n for each t in theTokes\n if (t.Contains(\"SC=\")) then\n theScale = av.Run(\"BSB.ReturnString\",{t,\"SC=\"})\n end\n 'Store the Skew of the chart into variable ( theSkew)\n if (t.Contains(\"SK=\")) then\n theSkew = av.Run(\"BSB.ReturnString\",{t,\"SK=\"})\n if ((theSkew.AsNumber > 0) and (mem > 0)) then\n skewit = MsgBox.YesNo(\"This BSB chart has a Skew of\"++theSkew++\", this will take approximately\"++mem.AsString++\"MB of memory and will require additional processing time. Do you want to continue?\",\"Chart Skew\",true)\n if (skewit = false) then\n system.Beep\n Exit\n end\n end\n end\n 'Store the Proje ction of the chart into variable (theProjection)\n if (t.Contains(\"PR=\")) then\n theProjection = av.Run(\"BSB.ReturnString\",{t,\"PR=\"})\n 'theProjection = t.Substitute(\"PR=\",\"\")\n end ' found PR\n if (t.Contains(\"PP=\")) then\n pp = av.Run(\"BSB.ReturnString\",{t,\"PP=\"}) \n 'pp = t.Substitute(\"PP=\",\"\")\n end 'found PP\n end 'searching KNP\n keepon = false\n end 'contains KNP\n if (theElt.Contains(\"ARC/\")) then 'We got a Chart that has been through the Reprojector\n DoPrj = False\n MsgBox.Info(\"This chart has been reprojected. View Properties will not be set.\",\"Reprojected Chart\")\n end\nend\n\ntheView = av.GetActiveDoc\n'Display the information from the header in a Message Box to the user.\n\n'Test for Mercator projection.\nprevMerc = NIL\nif (doPrj = True) then\n if (theProjection = \"mercator\") then\n if (theView.GetProjection.AsString = \"mercator\") then\n prevMerc = theView.GetProjection.ReturnLatitudeOfTrueScale\n DoPrj = False\n end\n \n if (prevMerc = NIL) then\n theMsg = \"Chart Latitude of True Scale: \"+pp++\"(Shift-Click the 'chart' button for help).\"\n newMerc = MsgBox.Input(theMsg,\"Enter Latitude of True Scale\",pp.AsString)\n if (newMerc = NIL) then\n msgbox.Error(\"Latitude of True Scale must be set! Shift-Click the 'chart' button for help.\",\"\")\n exit \n end \n while (newMerc.IsNumber = False)\n msgBox.Warning(\"Latitude of True Scale must be numeric\",\"Latitude of True Scale\")\n newMerc = MsgBox.Input(the Msg,\"Enter Latitude of True Scale\",pp.AsString)\n if (newMerc = NIL) then\n msgbox.Error(\"Latitude of True Scale must be set! Shift-Click the 'chart' button for help.\",\"\")\n exit \n end\n end \n else\n theMsg = \"The View's projection properties have already been set. Using Latitude of True Scale:\"++prevMerc.AsString\n 'msgBox.Info(theMsg,\"Latitude of True Scale\")\n newMerc = prevMerc.AsString\n end\n if (newMerc <> NIL) then\n theProc = DLLProc.Mak e(Dll.Make(\"$AVBIN/chartview.dll\".AsFileName),\"BSB_set_LTS\",#DLLPROC_TYPE_VOID,{#DLLPROC_TYPE_FLOAT})\n theProc.Call({newMerc.AsNumber})\n System.SetEnvVar(\"MERCSTDLAT\",newMerc)\n else\n system.Beep\n exit\n end\n theComments = \"DO NOT use for Navigation!\"+NL+NL+\n \"Chart Name:\"++theName+NL+\n \"Chart Scale: 1 :\"++theScale+NL+\n \"Input Projection:\"++theProjection+NL+\n \"Latitude of True Scale set to: \"+newMerc+NL+\n \"Chart Skew:\"++theSkew++\"Degrees\"\n msgbox.Report(\"Projection Information for:\"++theLF.GetFilename.AsString+NL+NL+\n theComments+NL+NL+ \n \"*************************\"+NL+\n \"In order to overlay vector data in Decimal Degrees, the 'View Properties' must reflect the above information. If the 'View Properties' are not currently set, you will have the opportunity to have these set automatically. Note that charts with different projection para meters should not be displayed in the same View.\",\"Projection Parameters\")\n if (doPrj = True) then\n doPrj = MsgBox.YesNoCancel(\"The current view projection is:\"++theView.GetProjection.GetClass.ReturnPrjName+\". Do you want to apply new Projection Parameters?\",\"Apply Projection\",true)\n if (doPrj = NIL) then\n system.Beep\n exit\n end \n if (doPrj = True) then\n theView = av.GetActiveDoc\n aRect = Rect.MakeXY(-180,-85,180,85)\n thePrj = Mercator.M ake(aRect)\n thePrj.SetCentralMeridian(0)\n thePrj.SetLatitudeofTrueScale(newMerc.AsNumber)\n theView.SetProjection(thePrj)\n end\n end\n end\n 'Test for Universal Transverse Mercator projection.\n if ((theProjection = \"universal transverse mercator\") or (theProjection = \"transverse mercator\")) then\n theComments = \"DO NOT use for Navigation!\"+NL+NL+\n \"Chart Name:\"++theName+NL+\n \"Chart Scale: 1 :\"++theScale+NL+\n \"Input Projection :\"++\"Transverse Mercator\"+NL+\n \"Central Meridian:\"++pp+NL+\n \"Spheroid: WGS84\"+NL+\n \"Chart Skew:\"++theSkew++\"Degrees\"\n msgbox.Report(\"Projection Information for:\"++theLF.GetFilename.AsString+NL+NL+\n theComments+NL+NL+\n \"*************************\"+NL+\n \"In order to overlay vector data in Decimal Degrees, the 'View Properties' must reflect the above information. You will have the opportunity to have these set au tomatically. Note that charts with different projection parameters should not be displayed in the same View.\",\"Projection Parameters\")\n if (doPrj = True) then\n doPrj = MsgBox.YesNoCancel(\"The current view projection is:\"++theView.GetProjection.GetClass.ReturnPrjName+\". Do you want to apply the Projection Parameters?\",\"Apply Projection\",true)\n if (doPrj = NIL) then\n system.Beep\n exit\n end \n if (doPrj = True) then\n theView = av.GetActiveDoc\n aRect = Rect .MakeXY(-180,-85,180,85)\n thePrj = TransverseMercator.Make(aRect)\n pp = pp.Substitute(\" \",\"\")\n thePrj.SetCentralMeridian(pp.AsNumber)\n thePrj.SetFalseEasting(0)\n thePrj.SetFalseNorthing(0)\n thePrj.SetReferenceLatitude(0)\n thePrj.SetScale(0.99960)\n thePrj.SetSpheroid(#SPHEROID_WGS84)\n theView.SetProjection(thePrj)\n end\n end\n end\n 'Test for Lambert projection.\n if (theProjection.Contains(\"lambert\")) then\n theComments = \"DO NOT use for Navigation!\"+NL+NL+\n \"Chart Name:\"++theName+NL+\n \"Input Projection:\"++theProjection+NL+\n \"Chart Scale: 1 :\"++theScale+NL+\n \"Central Meridian:\"++pp+NL+\n \"Spheroid: WGS84\"+NL+\n \"Chart Skew:\"++theSkew++\"Degrees\" \n msgbox.Report(\"Projection Information for:\"++theLF.GetFilename.AsString+NL+NL+\n theComments+NL+NL+\n \"*************************\"+NL+\n \"In order to overlay vector data in Decimal Degrees, the 'View Properties' must reflect the above information. You will have the opportunity to have these set automatically. Note that charts with different projection parameters should not be displayed in the same View.\",\"Projection Parameters\")\n if (doPrj = True) then\n doPrj = MsgBox.YesNoCancel(\"The current view projection is:\"++theView.GetProjection.GetClass.ReturnPrjName+\". Do you want to apply the Projection Parameters?\",\"Apply Projection\",true)\n i f (doPrj = NIL) then\n system.Beep\n exit\n end \n if (doPrj = True) then\n theView = av.GetActiveDoc\n aRect = Rect.MakeXY(-180,-85,180,85)\n thePrj = Lambert.Make(aRect)\n pp = pp.Substitute(\" \",\"\")\n thePrj.SetCentralMeridian(pp.AsNumber)\n thePrj.SetFalseEasting(0)\n thePrj.SetFalseNorthing(0)\n thePrj.SetReferenceLatitude(0)\n thePrj.SetLowerStandardParallel(47.03333)\n thePrj.SetUpperStandardParallel(48.05)\n thePrj.SetSpheroid(#SPHEROID_WGS84)\n theView.SetProjection(thePrj)\n end\n end\n end\nend 'checking for DoPrj\n\n'Create Image Theme\nSN = SrcName.Make(theFile.AsString)\nimgSN = ImgSrc.Make(SN)\ntheITheme = ITheme.Make(imgSN)\ntheITheme.SetComments(theComments)\ntheView.AddTheme(theITheme)\ntheITheme.SetActive(true)\nif (doPrj) then\n av.Run(\"View.ZoomToThemes\",{})\nend\n\n'Add \"Not For Navigational Use\" to the View\ntheCent = theITheme.ReturnExtent.ReturnCenter\naTxtSym = Symbol.Make(#SYMBOL_TEXT)\naT xtSym.SetColor(Color.GetRed)\ntheGT = GraphicText.Make(\"Not For Navigational Use\",theCent)\ntheGT.SetSymbol(aTxtSym)\ntheViewGL = theView.GetGraphics\ntheThemeGL = theITheme.GetGraphics\ntheThemeGL.Add(theGT)\nfor each g in theThemeGL\n theViewGL.Add(g)\nend\n\nend 'If for IsShiftKeyDown" ) (Script.16 Name: "BSB.ObjectsPresent" SourceCode: "'''''''''''''''''''''''\n' BSB.ObjectsPresent '\n'''''''''''''''''''''''\ntheProject = av.GetProject\nif (theProject = nil) then\n return FALSE\nend\n\ntheDocs = av.GetProject.GetDocs\nfor each aDoc in theDocs\n if (aDoc.Is(View)) then\n for each aTheme in aDoc.GetThemes\n if (aTheme.Is(ITheme)) then\n theImgSrc = aTheme.GetImgSrc\n theSrcName = theImgSrc.GetSrcName\n if (ImgCat.IsValidFileName(theSrcName.GetFileName)) then\n theImgCat = ImgCat.Make(theSrcName)\n if (theImgCa t.ContainType(ISrc.ReturnTypeFromFileExt(\"kap\"))) then\n return TRUE\n end\n else\n theISrc = ISrc.Make(theSrcName)\n if (theISrc.ReturnType = ISrc.ReturnTypeFromFileExt(\"kap\")) then\n return TRUE\n break\n end\n end\n end\n end\n end\nend\n\nreturn FALSE\n\n" ) (Script.17 Name: "BSB.Install" SourceCode: "MsgBox.Report(\"A 'chart' button will be added to the View GUI. Use this button to add a Nautical Chart. For help, click the 'chart' button while holding down the 'Shift Key.' Please label all output with 'NOT FOR NAVIGATIONAL USE.'\",\"ChartView Tip\")\n\n' Add . to the ISrc extension list\nextn_list = ISrc.ReturnExtensions\nextn_list = extn_list.Add(\"kap\".AsString)\nISrc.SetExtensions(extn_list)\n\n" ) (Script.18 Name: "BSB.CanUnload" SourceCode: "''' Run script CADRG.ObjectsPresent to see if there is any \n'''ImgSrc in any View with a .??? extension.\n' Return result to boolean variable.\n\nobjectsPresent = av.Run(\"BSB.ObjectsPresent\", NIL)\n\n' If objectsPresent is TRUE the dll should not be unloaded\nreturn objectsPresent.Not\n\n\n" ) (Script.19 Name: "BSB.Unload" SourceCode: " \n" ) (Script.20 Name: "My Extension Install" SourceCode: "'DO NOT EDIT!!!\n\nif (av.getproject=nil) then return(nil) end\n\n\ntheDocs = SELF.get(0)\ntheControlList = SELF.get(1)\ntheMenuList = SELF.get(2)\ntheToolMenuList=SELF.Get(3)\ntheProject=Av.getproject\n\n\n'Add the Docs\n'\nfor each adoc in theDocs\n theProject.addDoc(adoc)\nend\n\n'Add the Controls\n'\nfor each totalControl in theControlList\n 'The Control list\n acontrol=totalControl.get(0)\n \n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This finds the control set \n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\")\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex )\nend\n\n\n'Add the menus\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0)\n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n\n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the c urrent project.\",\"Script Eror\")\n return(nil)\n end\n \n theMbar=av.getproject.findGUI(mDoc).GetMenuBar\n themenu=theMbar.findbylabel(mMenu)\n if (themenu=NiL) then\n themenu=menu.make\n themenu.setlabel(mMenu)\n theMbar.add(themenu,999)\n end\n \n themenu.add(thecontrol, theCindex)\nend\n \n \n'Add the Tool Menus\n\nfor each totalControl in theToolMenuList\n 'The Control list\n acontrol=totalControl.get(0)\n \n 'The physical control\n theControl = totalControl.get(1)\n \n 'The con trol Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This finds the control set \n thecommand=\"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=av.getproject.findGUI(aControl.get(0)).GetToolBa r\n \n 'Add the control to the control set\n theControlSet.Add(theControl,theCindex)\nend\n\n\nav.getproject.setmodified(true)\n\n\n'And the scripts add themselves\n" ) (Script.21 Name: "My Extension Uninstall" SourceCode: "'DO NOT EDIT!!!\n\n'The SELF is the Extension\n\ntheDocs = SELF.get(0)\ntheControlList = SELF.get(1)\ntheMenuList = SELF.get(2)\ntheToolMenuList=SELF.get(3)\ntheProject=Av.getproject\n\n\n'Add the Docs\n'\nfor each adoc in theDocs\n If (theProject.finddoc(adoc.getname)<>NIL) then \n theAnswer=msgbox.yesno(\"Remove the Document \"+adoc.getname+\"?\",\"Remove Document?\",TRUE)\n if (theAnswer=TRUE) then theProject.RemoveDoc(adoc) end\n end\nend\n\n'Removethe Controls\n'\nfor each totalControl in theControlList\n 'Get the control list from the Ext\n acontrol=totalControl.get(0)\n \n 'Get the physical Control\n theControl = totalControl.get(1)\n \n 'Get the Controls Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI for the Control\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This sequence finds the appropiate control set\n thecommand= \"av.getproject.findGUI(\"\"\"+aControl.get(0)+\"\"\").Get\"+acontrol.get(1)\n thescript1=Script.Make(thecommand)\n thecontrolset=thescript1.doit(\"\")\n\n 'See if the control is in the set , if so remove it\n if (theControlSet.GetControls.find(theControl)<>NIL) then\n theControlSet.remove(theControl)\n if (thecontrol = \"ToolBar\") then\n theControlSet.selectdefault\n end\n end\nend\n\n\n'Remove the Menus\n'\nfor each totalcontrol in theMenuList\n \n 'The Control list\n acontrol=totalControl.get(0 )\n mDoc=acontrol.get(0)\n mMenu=acontrol.get(1)\n mMenuItem=acontrol.get(2)\n\n 'The physical control\n theControl = totalControl.get(1)\n \n 'The control Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n theMbar=av.getproject.findGUI(mDoc).GetMenuBar\n themenu=theMbar.findbylabel(mMenu)\n if (themenu=NiL) then\n MsgBox.Warning(\"The menu named \"+mMenu+\" is not here.\",\"Script Eror\")\n 'return(nil)\n else\n \n thething=themenu.getcontrols.find(thecontrol)\n if (thething<>NIL) then \n themenu.remove(thecontrol) \n end\n 'msgbox.info(themenu.GetControls.count.asstring,\"\")\n if (themenu.GetControls.count<1) then\n theMbar.remove(themenu)\n end\n end\nend\n \nfor each totalControl in theToolMenuList\n 'Get the control list from the Ext\n acontrol=totalControl.get(0)\n \n 'Get the physical Control\n theControl = totalControl.get(1)\n \n 'Get the Controls Index\n theCindex=totalControl.get(2)\n\n 'Find the DocGUI for the Control\n theControlDoc=av.getproject.findGUI(aControl.get(0))\n if (theControlDoc=NIL) then \n MsgBox.Warning(\"The GUI \"+aControl.get(0)+\" cannot be found in the current project.\",\"Script Eror\")\n return(nil)\n end\n \n 'This sequence finds the appropiate control set\n thecontrolset=av.getp roject.findGUI(aControl.get(0)).GetToolBar\n\n \n 'See if the control is in the set , if so remove it\n if (theControlSet.GetControls.find(theControl)<>NIL) then\n \n theControlSet.remove(theControl)\n theControlSet.selectdefault\n end\n\nend\n \n\n'And the scripts delete themselves\n\n\nav.getproject.setmodified(true)\n" ) (Script.22 Name: "BSB.ProjectSave" SourceCode: "\n\n" )