APSF,0,,-1,+1;+1;+1;-1;-1;+00;-00;-0;-;-;+1.5.8;-;;+BrightStar.apcat|Bright Star Catalogue;-|;-|;+;+ ' ' Print finder charts ' ' By Michael Portuesi (mportuesi@yahoo.com). ' Based on an example script by Paul Rodman. ' ' Home page: ' http://www.jotabout.com/portuesi/astro/apfindercharts.html ' ' $Id: print_finder_charts.vb 64 2007-08-07 03:10:09Z portuesi $ ' '------------------------------------------------------------------ ' Globals ' ' Version dim scriptVersion as String scriptVersion = "1.3.1" ' Telescope info dim scope as TelescopeResource dim scopeMag as double dim scopeLimMag as double ' Finderscope info dim finder as TelescopeResource dim finderLimMag as double dim finderFOV as double dim finderFlipH as boolean dim finderFlipV as boolean dim contextFOV as double ' Eyepiece info dim selectedEyepiece as EyepieceResource dim eyepieceName as string dim eyepieceFOV as double dim eyepieceFlipH as boolean dim eyepieceFlipV as boolean ' Visual Aid info dim selectedVisualAid as VisualAidResource '------------------------------------------------------------------ ' Print page header ' sub PageNumbering(c as Canvas, page as integer, i as integer) dim s as string dim x as integer dim thisSite as SiteResource thisSite = CurrentSite() x = 0 ' Object being charted c.TextBold = true c.TextItalic = false c.ForeColor(0, 0, 0) s = Obj(i).ID + " " + Obj(i).Name if ( c.textWidth(s) > (c.Width) / 2) then ' omit object name if it is too long to fit comfortably s = Obj(i).ID end if c.DrawText(s, x, c.TextHeight) x = x + c.TextWidth(s) ' Date, time, site, scope c.TextBold = false c.TextItalic = false s = " " + DoubleToDate(PlanLocalDateTime) + " " + DoubleToTime(PlanLocalDateTime) if ( thisSite <> nil ) then s = s + " " + thisSite.Name end if s = s + ", " + scope.Name c.DrawText(s, x, c.TextHeight) x = x + c.TextWidth(s) ' Page number c.TextBold = false c.TextItalic = true s = " Page " + str(page) ' avoid drawing page number if it overlaps with the object description if (x + c.TextWidth(s) < c.Width) then c.DrawText(s, c.Width-c.TextWidth(s), c.TextHeight) end if c.TextBold = false c.TextItalic = false c.ForeColor(0, 0, 0) end sub '------------------------------------------------------------------ ' Print Constellation FOV (Naked-eye view) ' sub PrintConstellationFOV( c as Canvas, x as integer, y as integer, size as integer,_ i as integer, nextFOV as double, reticleIdx as integer, _ labelDensity as double, blackOnWhite as boolean, altaz as boolean ) dim d as double dim s as string ' choose field of view d = c.Target(Obj(i).Constellation,Obj(i).RA,Obj(i).Dec) d = 40.0 ' format legend string s = "Naked Eye: " + AngleFormatted(d) ' set view parameters and draw view c.Target(Obj(i)) c.FOVSize(d) c.FOVRectangle(AngleFormatted(nextFOV), nextFOV, nextFOV, 0, Obj(i).RA, Obj(i).Dec) c.FOVCatalog("", false, false) c.FOVCatalog("Bright", true, true) c.FOVMagnitudeLimits(6, 6 * labelDensity, 0, 0) c.FOVStarLimits(0.0, 6.0) c.FOVAperture = false select case reticleIdx case 0 ' Telrad c.FOVOption("Telrad reticle", true) c.FOVOption("Rigel QF reticle", false) case 1 ' Rigel c.FOVOption("Telrad reticle", false) c.FOVOption("Rigel QF reticle", true) case 2 ' Red Dot c.FOVOption("Telrad reticle", false) c.FOVOption("Rigel QF reticle", false) ' simulated red-dot (actually a half-degree circle) c.FOVCircle("", 0.5, Obj(i).RA, Obj(i).Dec) end select c.FOVOption("Constellations", true) c.FOVOption("Flip Horizontal", false) c.FOVOption("Flip Vertical", false) c.FOVOption("Multiple Stars", false) c.FOVOption("Variable Stars", false) c.FOVOption("Fixed Mag. Scale", false) c.FOVOption("Alt/Az Rotation", altaz) c.DrawFOV(x, y, size, blackOnWhite, s) end sub '------------------------------------------------------------------ ' Print Finder Context FOV ' ' global: finderLimMag, finderFlipH, finderFlipV ' sub PrintFinderContextFOV( c as Canvas, x as integer, y as integer, size as integer, i as integer,_ contextFOV as double, FOV as double, nextFOV as double, catalog as string,_ labelDensity as double, blackOnWhite as boolean, altaz as boolean ) dim ctitle, s as string ' format legend string ctitle = "Finder: "+ AngleFormatted(contextFOV) s = ctitle if finderFlipH then ctitle = s + ", flip H" s = ctitle end if if finderFlipV then ctitle = s + ", flip V " end if s = ctitle ctitle = s + " (" + AngleFormatted(FOV) + ", " + finder.name + ")" ' set view parameters and draw view c.Target(Obj(i)) c.FOVSize(contextFOV) c.FOVCircle(AngleFormatted(FOV), FOV) c.FOVRectangle(AngleFormatted(nextFOV), nextFOV, nextFOV, 0, Obj(i).RA, Obj(i).Dec) c.FOVCatalog("", false, false) c.FOVCatalog(catalog, true, true) c.FOVMagnitudeLimits(finderLimMag, finderLimMag * labelDensity, finderLimMag, finderLimMag) c.FOVStarLimits(0.0, finderLimMag) c.FOVAperture = false c.FOVOption("Telrad reticle", false) c.FOVOption("Rigel QF reticle", false) c.FOVOption("Constellations", true) c.FOVOption("Flip Horizontal", finderFlipH) c.FOVOption("Flip Vertical", finderFlipV) c.FOVOption("Multiple Stars", false) c.FOVOption("Variable Stars", false) c.FOVOption("Fixed Mag. Scale", false) c.FOVOption("Alt/Az Rotation", altaz) c.DrawFOV(x, y, size, blackOnWhite, ctitle) end sub '------------------------------------------------------------------ ' Print Eyepiece FOV ' ' global: scopeLimMag, eyepieceFlipH, eyepieceFlipV, selectedVisualAid ' sub PrintEyepieceFOV( c as Canvas, x as integer, y as integer, size as integer,_ i as integer, FOV as double, catalog as string, labelDensity as double, _ blackOnWhite as boolean, altaz as boolean ) dim ctitle, s as string ' format legend string ctitle = "Eyepiece: " + AngleFormatted(FOV) +_ " (" + format(scopeMag,"0") + "x, " + eyepieceName s = ctitle if ( selectedVisualAid <> nil ) then ctitle = s + " w/" + selectedVisualAid.Name s = ctitle end if ctitle = s + ")" s = ctitle if eyepieceFlipH then ctitle = s + ", flip H" s = ctitle end if if eyepieceFlipV then ctitle = s + ", flip V " end if ' set view parameters and draw view c.Target(Obj(i)) c.FOVSize(FOV) c.FOVCircle(AngleFormatted(FOV), FOV) c.FOVCatalog("", false, false) c.FOVCatalog(catalog, true, true) c.FOVMagnitudeLimits(scopeLimMag, scopeLimMag * labelDensity, scopeLimMag, scopeLimMag) c.FOVStarLimits(0.0, scopeLimMag) c.FOVAperture = false c.FOVOption("Telrad reticle", false) c.FOVOption("Rigel QF reticle", false) c.FOVOption("Constellations", false) c.FOVOption("Flip Horizontal", eyepieceFlipH) c.FOVOption("Flip Vertical", eyepieceFlipV) c.FOVOption("Multiple Stars", true) c.FOVOption("Variable Stars", true) c.FOVOption("Fixed Mag. Scale", false) c.FOVOption("Alt/Az Rotation", altaz) c.DrawFOV(x, y, size, blackOnWhite, ctitle) end sub '------------------------------------------------------------------ ' DSS images function PrintDssImages(c as Canvas, x as integer, y as integer, blackOnWhite as boolean) as Integer dim size, gap, j, n, nimages as integer dim height as integer ' calculate dimensions and number of images that will fit. ' (only one image is actually displayed, to make space for info display) size = c.width - x height = (c.Height - y) n = height \ (size + 0.01 * height) nimages = c.ImageCount ' check for space for one image, one image available if ( nimages > 0 and n > 0 ) then gap = (height - n * size) \ (n - 1) if ( gap > 20 ) then gap = 20 ' draw first image on object's image list c.DrawImage(1, x, y, size, blackOnWhite, blackOnWhite, true) ' add space for following info display y = y + size + gap end if return y end function '------------------------------------------------------------------ ' Print some additional information about each object. ' sub PrintInformationTable( c as Canvas, x as integer, y as integer, width as integer, height as integer ) dim t as Table dim idx as Integer t = new Table(1, 2) idx = 1 ' fill in data t.Cell(idx, 1) = "Const:" t.Cell(idx, 2) = Obj(i).Constellation idx = idx + 1 t.AddRow() t.Cell(idx, 1) = "RA:" t.Cell(idx, 2) = Obj(i).RAFormatted idx = idx + 1 t.AddRow() t.Cell(idx, 1) = "Dec:" t.Cell(idx, 2) = Obj(i).DecFormatted idx = idx + 1 t.AddRow() t.Cell(idx, 1) = "Type:" t.Cell(idx, 2) = Obj(i).Type idx = idx + 1 t.AddRow() t.Cell(idx, 1) = "Rise:" t.Cell(idx, 2) = DoubleToTime(Obj(i).Rise) idx = idx + 1 t.AddRow() t.Cell(idx, 1) = "Transit:" t.Cell(idx, 2) = DoubleToTime(Obj(i).Transit) idx = idx + 1 t.AddRow() t.Cell(idx, 1) = "Set:" t.Cell(idx, 2) = DoubleToTime(Obj(i).Set) idx = idx + 1 t.AddRow() t.Cell(idx, 1) = "Pri Mag:" t.Cell(idx, 2) = str(Obj(i).Magnitude) idx = idx + 1 if ( Obj(i).Magnitude2 < 999 ) then t.AddRow() t.Cell(idx, 1) = "Sec Mag:" t.Cell(idx, 2) = str(Obj(i).Magnitude2) idx = idx + 1 end if if ( (Obj(i).Size1 > 0) or (Obj(i).Size2 > 0) ) then t.AddRow() t.Cell(idx, 1) = "Size:" t.Cell(idx, 2) = str(Obj(i).Size1) + "x" + str(Obj(i).Size2) idx = idx + 1 end if if ( Obj(i).SurfaceBrightness > 0 ) then t.AddRow() t.Cell(idx, 1) = "SB:" t.Cell(idx, 2) = str(Obj(i).SurfaceBrightness) idx = idx + 1 end if if ( Obj(i).Separation > 0 ) then t.AddRow() t.Cell(idx, 1) = "Sep:" t.Cell(idx, 2) = str(Obj(i).Separation) idx = idx + 1 end if if ( Obj(i).PosAngle > 0 ) then t.AddRow() t.Cell(idx, 1) = "Pos Ang:" t.Cell(idx, 2) = str(Obj(i).PosAngle) idx = idx + 1 end if if ( Obj(i).ODM > 0 ) then t.AddRow() t.Cell(idx, 1) = "ODM:" t.Cell(idx, 2) = str(Obj(i).ODM) idx = idx + 1 end if if ( Obj(i).DifficultyIndex > 0 ) then t.AddRow() t.Cell(idx, 1) = "Diff Idx:" t.Cell(idx, 2) = str(Obj(i).DifficultyIndex) idx = idx + 1 end if t.AddRow() t.Cell(idx, 1) = "Chart #:" t.Cell(idx, 2) = Obj(i).Chart idx = idx + 1 ' set text styles for table columns t.ColumnJustify(1) = justify_Left for idx = 1 to t.RowCount() t.CellStyle(idx, 1) = style_Bold next idx y = c.DrawTable(t, x, y, width, height, grid_None) ' create a separate table to display the catalog notes t = new Table(1, 1) t.RowHeight(1) = -1 ' notes field fills the column vertically t.Cell(1, 1) = Obj(i).Notes height = c.Height - y y = c.DrawTable(t, x, y, width, height, grid_None) end sub '------------------------------------------------------------------ ' Print finder chart page. ' sub PrintCharts(c as Canvas, page as integer, i as integer, finderCatalog as string,_ eyepieceCatalog as string, reticleIdx as integer, labelDensity as double,_ blackOnWhite as boolean, altaz as boolean) dim x, y, size, x1, x2 as integer dim width, height as integer ' Page header/numbering PageNumbering(c, page, i) y=1.5*c.Textheight ' Select object in list Obj(i).Selected = true c.Target(Obj(i)) size = c.Width \ 2 - 15 y = y + c.TextHeight x1 = 0 x2 = c.Width-size ' Draw top row of charts PrintConstellationFOV( c, x1, y, size, i, contextFOV, reticleIdx, labelDensity, blackOnWhite, altaz ) PrintEyepieceFOV( c, x2, y, size, i, eyepieceFOV, eyepieceCatalog, labelDensity, blackOnWhite, altaz ) ' Draw bottom row of charts y = y + size + 1.5 * c.TextHeight size = c.Height - y PrintFinderContextFOV( c, x1, y, size, i, contextFOV, finderFOV, eyepieceFOV, finderCatalog, labelDensity, blackOnWhite, altaz ) ' Draw DSS images, if present for object x = x1 + size + 20 y = PrintDssImages( c, x, y, blackOnWhite ) ' Draw object information table width = c.Width - x height = c.Height - y PrintInformationTable( c, x, y, width, height ) end sub '------------------------------------------------------------------ ' Returns index of the default telescope. ' function GetDefaultTelescopeIndex() as integer dim i as integer dim scope as TelescopeResource dim planScope as TelescopeResource planScope = CurrentTelescope() for i = 1 to nTelescopes scope = Telescope(i) ' Use the scope currently selected in the plan document, otherwise ' the default scope from resources pane as a fallback. if ( planScope <> nil ) then if (scope.name = planScope.name) then return i end if else if scope.Default then return i end if end if next ' none marked default, just return the first one return 1 end function '------------------------------------------------------------------ ' Returns index of the default eyepiece. ' function GetDefaultEyepieceIndex() as integer dim i as integer dim ep as EyepieceResource for i = 1 to nEyepieces ep = Eyepiece(i) ' Use the default eyepiece selected in the resources pane ' (Plan documents do not have a default eyepiece) if ep.Default then return i end if next ' none marked default, just return the first one return 1 end function '------------------------------------------------------------------ ' Returns index of the default visual aid (Barlow, etc). ' The index is actually offset by one, to accomodate an artificial ' first entry ("No Visual Aids"). ' function GetDefaultVisualAidIndex() as integer dim i as integer dim va as VisualAidResource for i = 1 to nVisualAids va = VisualAid(i) ' Use the default visual aid selected in the resources pane ' (Plan documents do not have a default visual aid) if va.Default then return i + 1 end if next ' none marked default, just return the first one return 1 end function '------------------------------------------------------------------ ' Returns an array of visual aid names. ' The list contains an artificial first entry ("No Visual Aids"). ' function GetVisualAidLabels() as String() dim i as integer dim va as VisualAidResource dim vaList(-1) as String vaList.append("No Visual Aids") for i = 1 to nVisualAids va = VisualAid(i) vaList.append(va.Name) next i return vaList end function '------------------------------------------------------------------ ' Get a list of stellar catalogs. ' All stellar catalogs are displayed to the user, even ones not ' suitable for finderscope and eyepiece views. ' function GetStellarCatalogs() as APCatalog() dim i as integer dim c as APCatalog dim catlist(-1) as APCatalog ' Make sure the ASCC Lite catalog appears at the beginning of the list. ' This provides a useful default to the user. c = GetCatalog("ASCCLite") if ( c <> nil) then catlist.Append(c) end if ' Add remainder of the star catalogs. for i = 1 to nCatalogs c = GetCatalog(i) if (c.GetTypes.IndexOf("Star") >= 0) then if (c.shortName <> "ASCC Lite") then catlist.Append(c) end if end if next return catlist end function '------------------------------------------------------------------ ' Sets field sizes from telescope and eyepiece selection. ' sub SetFOVSizes( scope as TelescopeResource, finder as TelescopeResource, _ ep as EyepieceResource, va as VisualAidResource, _ contextZoom as double ) if (scope <> nil) and (ep <> nil) then if scope.IsTelescope then if ( va <> nil ) then eyepieceFOV = ActualFOV( scope, ep, va ) scopeMag = Magnification( scope, ep, va ) else eyepieceFOV = ActualFOV( scope, ep ) scopeMag = Magnification( scope, ep ) end if eyepieceName = ep.Name finderFOV = finder.FinderFOV finderLimMag = finder.MagnitudeLimit scopeLimMag = scope.MagnitudeLimit else ' the main scope is a pair of binoculars - ' finder chart and eyepiece fields are all the same as the main scope FOV finderFOV = scope.FOV finderLimMag = scope.MagnitudeLimit eyepieceFOV = scope.FOV scopeMag = scope.Magnification scopeLimMag = scope.MagnitudeLimit eyepieceName = "" end if end if ' finder context view contextFOV = finderFOV * contextZoom end sub '------------------------------------------------------------------ ' Checks pre-conditions for valid operation. ' function validate( ) as Boolean ' check application version if (VersionNumeric < 158) then Print("This script requires AstroPlanner 1.5.8 (or later versions) in order to run.") return FALSE end if ' make sure user defined at least one telescope and eyepiece if ( (nTelescopes = 0) or (nEyepieces = 0) ) then Print("Please define at least one telescope and eyepiece using Edit > Resources...") return FALSE end if ' make sure there's at least one observing site if ( nSites = 0 ) then Print("Please define at least observing site using Edit > Resources...") return FALSE end if ' The Bright Star catalog is required for naked eye chart views. if (GetCatalog("Bright") = nil) then Print("Please install the Bright Star Catalogue using File > Catalogue Manager...") return FALSE end if ' ASCC Lite star catalog is strongly recommended for finderscope chart views. if (GetCatalog("ASCCLite") = nil) then Print("Please install the ASCC Lite Catalogue using File > Catalogue Manager...") return FALSE end if ' good to go return TRUE end function '------------------------------------------------------------------ ' Returns TRUE if there is at least one astronomical object selected to print. ' function somethingToPrint( whatToPrint as Integer ) as Boolean select case whatToPrint case 0 ' all objects if ( nObjects > 0 ) then return TRUE end if case 1 ' highlighted objects if ( nHighlighted > 0) then return TRUE end if case 2 ' selected objects if ( SelectedObject > 0 ) then return TRUE end if end select return FALSE end function '------------------------------------------------------------------ ' Restore saved parameters from plan document, defaulting the first time ' sub RestoreParameters( ) scopeIdx=RestoreIntegerValue("scopeIdx", scopeIdx) if ( scopeIdx > nTelescopes ) then scopeIdx = nTelescopes end if finderIdx=RestoreIntegerValue("finderIdx", finderIdx) if ( finderIdx > nTelescopes ) then finderIdx = nTelescopes end if eyepieceIdx=RestoreIntegerValue("eyepieceIdx", eyepieceIdx) if ( eyepieceIdx > nEyepieces ) then eyepieceIdx = nEyepieces end if visualAidIdx=RestoreIntegerValue("visualAidIdx", visualAidIdx) if ( visualAidIdx > (nVisualAids + 1) ) then visualAidIdx = (nVisualAids + 1) end if finderCatalogIdx=RestoreIntegerValue("finderCatalogIdx", finderCatalogIdx) if ( finderCatalogIdx > UBound(catalogList) ) then finderCatalogIdx = UBound(catalogList) end if eyepieceCatalogIdx=RestoreIntegerValue("eyepieceCatalogIdx", eyepieceCatalogIdx) if ( eyepieceCatalogIdx > UBound(catalogList) ) then eyepieceCatalogIdx = UBound(catalogList) end if reticleIdx=RestoreIntegerValue("reticleIdx", reticleIdx) eyepieceFlipH=RestoreBooleanValue("eyepieceFlipH", false) eyepieceFlipV=RestoreBooleanValue("eyepieceFlipV", false) finderFlipH=RestoreBooleanValue("finderFlipH", false) finderFlipV=RestoreBooleanValue("finderFlipV", false) blackOnWhite=RestoreBooleanValue("blackOnWhite", true) altAz=RestoreBooleanValue("altAz", true) what=RestoreIntegerValue("what", 2) isPreview=RestoreBooleanValue("isPreview", false) showPageSetup=RestoreBooleanValue("showPageSetup", false) contextZoom=RestoreDoubleValue( "contextZoom", 3.0 ) labelDensity=RestoreDoubleValue( "labelDensity", 0.55 ) end sub '------------------------------------------------------------------ ' Save parameters to plan document ' sub SaveParameters() SaveIntegerValue("scopeIdx", scopeIdx) SaveIntegerValue("finderIdx", finderIdx) SaveIntegerValue("eyepieceIdx", eyepieceIdx) SaveIntegerValue("visualAidIdx", visualAidIdx) SaveIntegerValue("reticleIdx", reticleIdx) SaveIntegerValue("finderCatalogIdx", finderCatalogIdx) SaveIntegerValue("eyepieceCatalogIdx", eyepieceCatalogIdx) SaveBooleanValue("eyepieceFlipH", eyepieceFlipH) SaveBooleanValue("eyepieceFlipV", eyepieceFlipV) SaveBooleanValue("finderFlipH", finderFlipH) SaveBooleanValue("finderFlipV", finderFlipV) SaveIntegerValue("what", what) SaveBooleanValue("isPreview", isPreview) SaveBooleanValue("showPageSetup", showPageSetup) SaveBooleanValue("blackOnWhite", blackOnWhite) SaveBooleanValue("altAz", altaz) SaveDoubleValue("contextZoom", contextZoom) SaveDoubleValue("labelDensity", labelDensity) end sub '------------------------------------------------------------------ ' Main program. ' try dim c as Canvas dim i, what, page, w, h as integer dim wtitle as string dim doit, isPreview, showPageSetup, blackOnWhite, altaz as Boolean dim finderCatalog, eyepieceCatalog as String dim finderCatalogIdx, eyepieceCatalogIdx as integer dim catalogList(-1) as APCatalog dim catalogLabels(-1) as String dim contextZoom as double dim labelDensity as double dim screenWidth, screenHeight, screenLeft, screenTop as Integer dim year, month, day as integer year = YearOfDate( PlanLocalDateTime ) month = MonthOfDate( PlanLocalDateTime ) day = DayOfDate( PlanLocalDateTime ) ' default values for preview mode. Width is nearly width of screen, ' height is scaled to match portrait aspect of a sheet of paper. ' change w and h to suit your screen size and taste wtitle="Finder Chart" ScreenSize( screenWidth, screenHeight, screenLeft, screenTop ) w = screenWidth * 0.95 h = screenWidth * 1.3 ' Other defaults, usually set when choosing scope/eyepiece from dialog finderFOV = 5.0 eyepieceFOV = 1.0 eyepieceFlipH = FALSE eyepieceFlipV = FALSE finderFlipH = FALSE finderFlipV = FALSE ' Pre-flight check if not validate() then return end if ' Get list of telescopes and finder scopes to present to user dim scopeIdx as integer dim finderIdx as integer scopeIdx = GetDefaultTelescopeIndex() finderIdx = GetDefaultTelescopeIndex() dim scopeList(-1) as string dim scope as TelescopeResource for i = 1 to nTelescopes scope = Telescope(i) scopeList.append( scope.Name ) next ' Get list of eyepieces to present to user dim eyepieceIdx as integer eyepieceIdx = GetDefaultEyepieceIndex() dim epList(-1) as string dim ep as EyepieceResource for i = 1 to nEyepieces ep = Eyepiece(i) epList.append( ep.Name ) next ' Get list of visual aids to present to user dim visualAidIdx as integer visualAidIdx = GetDefaultVisualAidIndex() dim visualAidLabels(-1) as String visualAidLabels = GetVisualAidLabels() selectedVisualAid = nil ' Get list of unit power reticles to present to user dim reticleIdx as integer reticleIdx = 0 dim reticleList(-1) as String reticleList.append("Telrad") reticleList.append("Rigel QuikFinder") reticleList.append("Red Dot") ' Get list of stellar catalogs to present to user catalogList = GetStellarCatalogs() finderCatalogIdx = 0 eyepieceCatalogIdx = 0 for i = 0 to UBound(catalogList) catalogLabels.append( catalogList(i).Name ) next ' Restore saved parameters from AP settings, defaulting the first time SaveRestoreGlobal(true) RestoreParameters() ' Set up dialog with saved choices from last run (or defaults) SetCaptionParameter("General Options", 1, false, true, false, false, false) if Platform <> platform_MacOSX then ' Mac OS X provides its own print preview services. ' So don't lead user into a usability trap. SetBooleanParameter(true, "Preview", isPreview) end if SetChoiceParameter("Print/display charts for:", what, _ "All " + str(nObj) + " objects", _ "Highlighted objects (" + str(nHighlighted) +") only", _ "Selected object only") SetBooleanParameter(true, "Show Page Setup before printing", showPageSetup) SetCaptionParameter("Equipment Options", 1, false, true, false, false, false) SetPopupParameter("Telescope:", scopeIdx - 1, scopeList) SetPopupParameter(true, "Eyepiece:", eyepieceIdx - 1, epList) SetPopupParameter("Finder scope:", finderIdx - 1, scopeList) SetBooleanParameter("Finder flips horizontally", finderFlipH) SetBooleanParameter(true, "Eyepiece flips horizontally", eyepieceFlipH) SetBooleanParameter("Finder flips vertically", finderFlipV) SetBooleanParameter(true, "Eyepiece flips vertically", eyepieceFlipV) SetPopupParameter("Unit power reticle:", reticleIdx, reticleList) SetPopupParameter(true, "Visual Aid:", visualAidIdx - 1, visualAidLabels) SetCaptionParameter("Star Catalog Options", 1, false, true, false, false, false) SetPopupParameter("Finder star catalog:", finderCatalogIdx, catalogLabels) SetPopupParameter(true, "Eyepiece star catalog:", eyepieceCatalogIdx, catalogLabels) SetCaptionParameter("Chart Options", 1, false, true, false, false, false) SetSliderParameter("Finder context zoom:", contextZoom, 1.0, 4.0, 0.1) SetBooleanParameter(true, "Rotate chart for alt-az scopes", altaz) SetSliderParameter("Star label density:", labelDensity, 0.0, 1.0, 0.01) SetBooleanParameter(true, "Black stars on white background", blackOnWhite) If EditParameters("Print Finder Charts (v " + scriptVersion + ")" ) then ' Get user choices from dialog if Platform <> platform_MacOSX then isPreview = GetBooleanParameter("Preview") else isPreview = false end if showPageSetup = GetBooleanParameter("Show Page Setup before printing") what = GetChoiceParameter("Print/display charts for:") scopeIdx = GetPopupParameter("Telescope:") + 1 finderIdx = GetPopupParameter("Finder scope:") + 1 eyepieceIdx = GetPopupParameter("Eyepiece:") + 1 visualAidIdx = GetPopupParameter("Visual Aid:") + 1 reticleIdx = GetPopupParameter("Unit power reticle:") eyepieceFlipH = GetBooleanParameter("Eyepiece flips horizontally") eyepieceFlipV = GetBooleanParameter("Eyepiece flips vertically") finderFlipH = GetBooleanParameter("Finder flips horizontally") finderFlipV = GetBooleanParameter("Finder flips vertically") finderCatalogIdx = GetPopupParameter("Finder star catalog:") eyepieceCatalogIdx = GetPopupParameter("Eyepiece star catalog:") blackOnWhite = GetBooleanParameter("Black stars on white background") altaz = GetBooleanParameter("Rotate chart for alt-az scopes") contextZoom=GetSliderParameter("Finder context zoom:") labelDensity=GetSliderParameter("Star label density:") ' Save user choices back to AP settings SaveParameters() ' Make sure there is something to print on the charts if ( not somethingToPrint(what) ) then Print "Please select or highlight at least one astronomical object to print." return end if ' Set chart fields based on telescope/finder/eyepiece/visual aid selection scope = Telescope(scopeIdx) selectedEyepiece = Eyepiece(eyepieceIdx) selectedVisualAid = VisualAid( VisualAidLabels(visualAidIdx - 1) ) finder = Telescope(finderIdx) SetFOVSizes( scope, finder, selectedEyepiece, selectedVisualAid, contextZoom ) ' Choose catalogs for finder and eyepiece views finderCatalog = catalogList(finderCatalogIdx).ShortName eyepieceCatalog = catalogList(eyepieceCatalogIdx).ShortName ' Open a new printer document (or display window) if isPreview then c=new Canvas(w,h,wtitle) else c=new Canvas(showPageSetup) end if ' Loop and print charts/forms for selected objects if not c.Cancelled then ' For each object in the list page = 0 for i = 1 to nObj select case what case 0 ' All objects doit = true case 1 ' Highlighted objects doit = Obj(i).IsHighlighted case 2 ' Selected doit = Obj(i).Selected end select if doit then ' Object selected to be processed page = page + 1 if page > 1 then c.NewPage PrintCharts(c, page, i, finderCatalog, eyepieceCatalog, _ reticleIdx, labelDensity, blackOnWhite, altaz) end if if UserAbort then exit next c.Close end if end if ' EditParameters catch Print "Print Finder Charts encountered an unexpected error while processing." end try