APSF //################################################################################################################################## // Name : AP_Library // Purpose : Library to support AP scripts. // The use of this library (particularly the constants) is intended to improve the readability of AP scripts. // For example, instead of: // if ObjectIndex = -1 then ... // you could write // if ObjectIndex = cNoSelectedObject then ... // Requires: AP v1.5.1b3 or later // Author : Robin Lauryssen-Mitchell // Date : 27th August 2006 // Version : 0.4 // Status : Beta // History : 08Aug06 - 0.1 - Initial beta release // 21Aug06 - 0.2 - Changed name from AP_Constants to AP_Declarations // 22Aug06 - 0.3 - Added prefixes to declarations // 27Aug06 - 0.4 - Changed name to AP_Library - and changed it back again when the routines stopped working!!! // Notes : - Must get approval from Paul before posting this. Might be thought of as an 'official' part of AP due to the filename // Perhaps get some of these (constants) included in the APCallable module // - References to the Scripting Manual are correct as of v1.5.1b3 (I hope) // - Some of the constant name prefixes are a little clumsy (e.g. APTF for APTextFile), however, they are added in an // attempt to avoid conflicting with another script writers declarations. Occasionally it got too much, even for me. // For example, what should have been the prefix cAPAAVSO got abbreviated to cAPA. The whole Prefix question, // including the leading 'c' is up for debate, censure, veto, whatever. BTW, the leading 'c' is a left-over from a // Microsoft program documentation standard - not sure if even they still use it!!! // - Prefixes // Format = AP?? where AP=AstroPlanner and ??=1 or a 2-letter section designator // Section Title Prefix Notes // ------- --------------------------- ------ ------------------------------------ // 2.2 General Properties APGP // 2.3 General Methods APGM Constellation constants not prefixed // 2.3.24 EditParameters APEP // 2.4 APPlanObject APO // 2.5 APObservation APOB // 2.6 APAAVSO APA // 2.7 APCatalogObject APCO // 2.8 APCatalog APC // 2.9 APTextFile APTF // 2.10 APSearch APS // 2.11 Canvas APCV // 2.11.4 CanvasFOV APCF // 2.11.5 Creating and drawing tables APCT // 2.12 Table APT // 2.13 Resources APR // 2.13.2 SiteResource APSR // 2.13.3 TelescopeResource APTR // 2.13.4 EyepieceResource APER // 2.13.5 VisualAidResource APVR // 2.14 Serial port support APSP // - Still not convinced that the Prefixes are a good idea - feels a little clumsy to me // - Have abandoned, for the time being, the idea of including 'standard' variable declarations in this library. // For the time being this file will only contain Constants and a few routines. //################################################################################################################################## //================================================================================================================================== // Declarations //================================================================================================================================== //---------------------------------------------------------------------------------------------------------------------------------- // Scripting constants //---------------------------------------------------------------------------------------------------------------------------------- //.................................................................................................................................. // 2.2 General Properties (APGP) //.................................................................................................................................. //General purpose const cAPGP_CancelledYes = true //User clicked a 'Cancel' button const cAPGP_CancelledNo = false //User did not click a 'Cancel' button //Object const cAPGP_NoSelectedObject = -1 //Plan does not contain a selected object const cAPGP_NoObject = 0 //Plan contains no objects const cAPGP_MinObject = 1 //Base object ID //Plan const cAPGP_MissingPlan = -1 //No plan (usually with given name) was loadable const cAPGP_NoPlan = 0 //No plan (usually with given name) is loaded const cAPGP_MinPlan = 1 //Base plan ID const cAPGP_PlanFileExt = ".apd" //AP plan file extension //Catalogue const cAPGP_MinCatalog = 1 //Base catalogue ID //Telescope const cAPGP_CurrentRAOffline = -999 //RA value returned if scope is offline const cAPGP_CurrentDecOffline = -999 //Dec value returned if scope is offline const cAPGP_ScopeIsOffline = false //Value return by IsOnline if scope is offline const cAPGP_ScopeIsOnline = true //Value return by IsOnline if scope is online //User Heading const cAPGP_UserColumn1 = 1 //Index for User column 1 const cAPGP_UserColumn2 = 2 //Index for User column 2 const cAPGP_UserColumn3 = 3 //Index for User column 3 const cAPGP_UserColumn4 = 4 //Index for User column 4 //User Abort const cAPGP_AbortNo = false //Operation was not cancelled by user const cAPGP_AbortYes = true //Operation was cancelled by user //PlanLocalDateTime const cAPGP_UseComputerTime = 0 //Set the local date/time to the computer date/time //Plan Dates const cAPGP_MinPlanTime = 0.0 //Minimum GMT/GMTST/LST time const cAPGP_MaxPlanTime = 23.999999 //Maximum GMT/GMTST/LST time //.................................................................................................................................. // 2.3 General Methods (APGM) //.................................................................................................................................. //List const cAPGM_MinList = 1 //Base list ID const cAPGM_MinListRow = 1 //Base list row ID const cAPGM_MinListCol = 1 //Base list column ID const cAPGM_ListHeadingDef = 0 //Heading justification is Default const cAPGM_ListHeadingLeft = 1 //Heading justification is Left const cAPGM_ListHeadingCentre = 2 //Heading justification is Centre const cAPGM_ListHeadingRight = 3 //Heading justification is Right //SlewTo const cAPGM_SlewToNotConnected = -1 //Telescope is not connected or not GoTo capable const cAPGM_SlewToOK = 0 //Slew successful const cAPGM_SlewToBelowHorizon = 1 //Below horizon const cAPGM_SlewToOutsideLimits = 2 //Outside slewing limits const cAPGM_SlewToBlocked = 3 //Blocked by user-defined horizon //CatalogFindID const cAPGM_CatalogNotFound = 0 //Catalogue search was not successful const cAPGM_MinCatalogFound = 1 //Minimum catalogue find ID //GetCatalog const cAPGM_GetCatalogFailed = nil //Catalogue ID or Name could not be found //2.3.9 Choice const cAPGM_MinChoice = 1 //Base Choice ID const cAPGM_ChoiceCancelled = -1 //User clicked 'Cancel' //2.3.10 Options const cAPGM_MinOption = 1 //Base Option ID const cAPGM_OptionCancelled = -1 //User clicked 'Cancel' //TextFile const cAPGM_TextFileFailed = nil //Operation failed or user clicked 'Cancel' const cAPGM_ScriptFileExt = ".txt" //Script filename extension //Launch const cAPGM_AppForeground = true //Try to put the application in the foreground when launched //Shell const cAPGM_ShellMinTimeout = 0 //When would this ever be used!? const cAPGM_ShellDefTimeout = 2000 //Default timeout - 2000ms or 2 seconds //FindObject const cAPGM_FindObjectFailed = nil //FindObject search failed //EditParameters (see section 2.3.24 below) //UserColumnNumeric const cAPGM_UserDecPlaces0 = 0 //Display 0 decimal places const cAPGM_UserDecPlaces1 = 1 //Display 1 decimal place const cAPGM_UserDecPlaces2 = 2 //Display 2 decimal places const cAPGM_UserDecPlaces3 = 3 //Display 3 decimal places const cAPGM_UserDecPlaces4 = 4 //Display 4 decimal places const cAPGM_UserDecPlacesAuto = -1 //Automatically select number of decimal places //[Get|Set]ExternalCoords const cAPGM_ExternalCoordsOK = true //External application returned a set of coordinates const cAPGM_ExternalCoordsFailed = false //External application could not return coordinates for some reason //GetURL const cAPGM_URLTimeoutNever = 0 //Sets the function to never timeout const cAPGM_URLTimeoutDef = 30 //Default timeout const cAPGM_URLEmpty = "" //Returned if error occurrs //SortObservingList const cAPGM_AscendingOrder = true //Sort into ascending order const cAPGM_DescendingOrder = false //Sort into descending order //GetPlanName, PlanChanged, SavePlan, ClosePlan const cAPGM_CurrentlySelectedPlan = -1 //Get the currently selected plan name //GetPlanNumber const cAPGM_PlanNumberNotFound = 0 //The named plan is not currently loaded //PlanChanged const cAPGM_PlanHasChanged = true //Plan has been changed since last save const cAPGM_PlanNotChanged = false //Plan has not been changed since last save //ClosePlan const cAPGM_PlanSilentCloseOff = true //Avoid the user alert if the plan is 'dirty' const cAPGM_PlanSilentCloseOn = false //Raise the user alert if the plan is 'dirty' //NewPlan const cAPGM_NewPlanOverwriteAlertOff = true //Do not raise a file overwrite alert const cAPGM_NewPlanOverwriteAlertOn = false //Raise a file overwrite alert if needed const cAPGM_NewPlanUniqueOn = true //Auto-generate unique file name suffix if needed const cAPGM_NewPlanUniqueOff = false //Do not generate a unique file name suffix if file name already exists const cAPGM_NewPlanCancelled = 0 //User cancelled the operation const cAPGM_NewPlanBadFileName = -1 //Specified path does not make sense for some reason const cAPGM_NewPlanPathIsFolder = -2 //Specified path is a folder const cAPGM_NewPlanProtectedFile = -3 //Plan file could not be deleted const cAPGM_NewPlanFileIsOpen = -4 //Plan with same name is already open const cAPGM_NewPlanCreationFailed = -5 //Plan could not be created //OpenPlan const cAPGM_OpenPlanFailed = -1 //Plan file could not be opened for some reason (usually a bad path specification) //StartProgress const cAPGM_StartProgressCancelOn = true //Display a cancel button const cAPGM_StartProgressCancelOff = false //Do not display a cancel button //UpdateProgress const cAPGM_UpdateProgressCancelled = true //Cancel button was clicked const cAPGM_UpdateProgressRunning = false //Cancel button not clicked //Format[RA|Dec] const cAPGM_FormatExtendedOn = true //Enable decimal second representation const cAPGM_FormatExtendedOff = false //Disable decimal second representation //FormatRA const cAPGM_RAMin = 0.0 //Minimum RA value const cAPGM_RAMax = 23.9999 //Maximum RA value const cAPGM_RADefault = "hms:" //The default RA format const cAPGM_RALong = "hmsa" //The longest RA format available const cAPGM_RAShort = "hms" //The shortest RA format available const cAPGM_RADecimal = "h" //Express the RA value as a decimal //FormatDec const cAPGM_DecMin = -90.0 //Minimum Dec value const cAPGM_DecMax = 90.0 //Maximum Dec value const cAPGM_DecDefault = "+dmsx" //The default Dec format const cAPGM_DecLong = "+dmsa" //Longest format (could have been '+dmsx', but I chose this version to match the long RA format) const cAPGM_DecShort = "dms" //Shortest Dec format available const cAPGM_DecDecimal = "d" //Express the Dec value as a decimal //OKCancel const cAPGM_DefaultOKButton = true //OK button is the default const cAPGM_DefaultCancelButton = false //Cancel button is the default const cAPGM_OKButtonClicked = true //The OK button was clicked const cAPGM_CancelButtonClicked = false //The Cancel button was clicked //YesNo const cAPGM_DefaultYesButton = true //Yes button is the default const cAPGM_DefaultNoButton = false //No button is the default const cAPGM_YesButtonClicked = true //Yes button was clicked const cAPGM_NoButtonClicked = false //No button was clicked //Confirmation const cAPGM_DefaultButton1 = true //Button 1 is the default const cAPGM_DefaultButton2 = false //Button 2 is the default const cAPGM_Button1Clicked = true //Button 1 was clicked const cAPGM_Button2Clicked = false //Button 2 was clicked //Constellations const cAnd = 0 const cAnt = 1 const cAps = 2 const cAql = 3 const cAqr = 4 const cAra = 5 const cAri = 6 const cAur = 7 const cBoo = 8 const cCae = 9 const cCam = 10 const cCap = 11 const cCar = 12 const cCas = 13 const cCen = 14 const cCep = 15 const cCet = 16 const cCha = 17 const cCir = 18 const cCMa = 19 const cCMi = 20 const cCnc = 21 const cCol = 22 const cCom = 23 const cCrA = 24 const cCrB = 25 const cCrt = 26 const cCru = 27 const cCrv = 28 const cCVn = 29 const cCyg = 30 const cDel = 31 const cDor = 32 const cDra = 33 const cEqu = 34 const cEri = 35 const cFor = 36 const cGem = 37 const cGru = 38 const cHer = 39 const cHor = 40 const cHya = 41 const cHyi = 42 const cInd = 43 const cLac = 44 const cLeo = 45 const cLep = 46 const cLib = 47 const cLMi = 48 const cLup = 49 const cLyn = 50 const cLyr = 51 const cMen = 52 const cMic = 53 const cMon = 54 const cMus = 55 const cNor = 56 const cOct = 57 const cOph = 58 const cOri = 59 const cPav = 60 const cPeg = 61 const cPer = 62 const cPhe = 63 const cPic = 64 const cPsA = 65 const cPsc = 66 const cPup = 67 const cPyx = 68 const cRet = 69 const cScl = 70 const cSco = 71 const cSct = 72 const cSer = 73 const cSex = 74 const cSge = 75 const cSgr = 76 const cTau = 77 const cTel = 78 const cTrA = 79 const cTri = 80 const cTuc = 81 const cUMa = 82 const cUMi = 83 const cVel = 84 const cVir = 85 const cVol = 86 const cVul = 87 const cAndromeda = 0 const cAntlia = 1 const cApus = 2 const cAquila = 3 const cAquarius = 4 const cAra = 5 const cAries = 6 const cAuriga = 7 const cBootes = 8 const cCaelum = 9 const cCamelopardis = 10 const cCapricornus = 11 const cCarina = 12 const cCassiopeia = 13 const cCentaurus = 14 const cCepheus = 15 const cCetus = 16 const cChamaeleon = 17 const cCircinus = 18 const cCanisMajor = 19 const cCanisMinor = 20 const cCancer = 21 const cColumba = 22 const cComaBerenices = 23 const cCoronaAustralis = 24 const cCoronaBorealis = 25 const cCrater = 26 const cCrux = 27 const cCorvus = 28 const cCanesVenatici = 29 const cCygnus = 30 const cDelphinus = 31 const cDorado = 32 const cDraco = 33 const cEquuleus = 34 const cEridanus = 35 const cFornax = 36 const cGemini = 37 const cGrus = 38 const cHercules = 39 const cHorologium = 40 const cHydra = 41 const cHydrus = 42 const cIndus = 43 const cLacerta = 44 const cLeo = 45 const cLepus = 46 const cLibra = 47 const cLeoMinor = 48 const cLupus = 49 const cLynx = 50 const cLyra = 51 const cMensa = 52 const cMicroscopium = 53 const cMonoceros = 54 const cMusca = 55 const cNorma = 56 const cOctans = 57 const cOphiuchus = 58 const cOrion = 59 const cPavo = 60 const cPegasus = 61 const cPerseus = 62 const cPhoenix = 63 const cPictor = 64 const cPiscesAustrinus = 65 const cPisces = 66 const cPuppis = 67 const cPyxis = 68 const cReticulum = 69 const cSculptor = 70 const cScorpius = 71 const cScutum = 72 const cSerpens = 73 const cSextans = 74 const cSagitta = 75 const cSagittarius = 76 const cTaurus = 77 const cTelescopium = 78 const cTriangulumAustrale = 79 const cTriangulum = 80 const cTucana = 81 const cUrsaMajor = 82 const cUrsaMinor = 83 const cVela = 84 const cVirgo = 85 const cVolans = 86 const cVulpecula = 87 const cConstellationNone = -1 const cConstellationMin = 0 const cConstellationMax = 87 //Additional non-ScriptingManual declarations const cConstellationSep = " - " const cConstellationShortName = 1 const cConstellationLongName = 2 //.................................................................................................................................. // 2.3.24 EditParameters (APEP) //.................................................................................................................................. const cAPEP_UserCancelled = -1 //User cancel flag value (should replace this - darn! can't remember why!!!) const cAPEP_ShowFieldIndices = true //Reveal the field ID and Tab numbers const cAPEP_HideFieldIndices = false //Hide the field ID and Tab numbers // [Get|Set]XXXParameter //General const cAPEP_FieldAppendOn = true //Put field in next column to right const cAPEP_FieldAppendOff = false //Put field in next row down const cAPEP_FieldIndexSep = "." //Field label format Index separator const cAPEP_FieldTabSep = ":" //Field label format Tab separator //String const cAPEP_StringMultilineOn = true const cAPEP_StringMultilineOff = false //Choice const cAPEP_ChoiceDisablePrefix = "!" //PopUp, ListChoice const cAPEP_ListSortedOff = false //Display list in 'loaded' order const cAPEP_ListSortedOn = true //Display list in alpha sorted order const cAPEP_ListMaxVisibleDef = 6 //Default number of list entries visible //CheckList const cAPEP_CheckListBoxOn = 1 const cAPEP_CheckListBoxOff = 0 //Caption const cAPEP_CaptionGreyOff = false const cAPEP_CaptionGreyOn = true const cAPEP_CaptionBoldOff = false const cAPEP_CaptionBoldOn = true const cAPEP_CaptionItalicOff = false const cAPEP_CaptionItalicOn = true const cAPEP_CaptionSmallOff = false const cAPEP_CaptionSmallOn = true const cAPEP_CaptionFullWidthOff = false const cAPEP_CaptionFullWidthOn = true const cAPEP_CaptionLineDefault = 1 // 2.3.68 Object Type Methods // There are no declarations for these methods as the values returned may change in future releases of AP. //.................................................................................................................................. // 2.4 APPlanObject (APO) //.................................................................................................................................. //Altitude (in degrees) const cAPO_MinAltitude = 0.0 const cAPO_MaxAltitude = 90.0 //Apparent Magnitude const cAPO_ApparentMagnitudeError = 99.0 //Object is below the horizon //Azimuth (in degrees) const cAPO_MinAzimuth = 0.0 const cAPO_MaxAzimuth = 360.0 //Dec (in degrees) const cAPO_MinDec = -90.0 const cAPO_MaxDec = 90.0 //Difficulty Index const cAPO_MinDifficultyIndex = 0.0 const cAPO_MaxDifficultyIndex = 100.0 //Extinction const cAPO_ExtinctionError = 99.0 //ForceHighlight const cAPO_ObjectHighlightOn = true const cAPO_ObjectHighlightOff = false //HourAngle const cAPO_MinHourAngle = -12.0 const cAPO_MaxHourAngle = 12.0 //IsHighlighted const cAPO_ObjectHighlightedOn = true const cAPO_ObjectHighlightedOff = false //IsVisible const cAPO_ObjectVisibleOn = true const cAPO_ObjectVisibleOff = false //Magnitude const cAPO_MinMagnitude = -30.0 const cAPO_MaxMagnitude = 30.0 const cAPO_DefMagnitude = 9.0 //Default object magnitude (I like this value - so there) const cAPO_MagnitudeError = 99.0 //or greater indicate a possible error condition //nObservations, nObs const cAPO_MinObservations = 1 const cAPO_MinGlobalObservations = 1 //PosAngle const cAPO_MinPosAngle = 0 const cAPO_MaxPosAngle = 360 //RA const cAPO_MinRA = 0.0 const cAPO_MaxRA = 23.99999 //Rise const cAPO_MinRise = 0.0 const cAPO_MaxRise = 23.9999 const cAPO_CircumpolarRise = -1 const cAPO_NeverRise = -2 //Selected const cAPO_ObjectSelectedOn = true //Object selected const cAPO_ObjectSelectedOff = false //Object not selected //Set const cAPO_MinSet = 0.0 const cAPO_MaxSet = 23.9999 const cAPO_CircumpolarSet = -1 const cAPO_NeverSet = -2 //Transit const cAPO_MinTransit = 0.0 const cAPO_MaxTransit = 23.9999 //NewObservation const cAPO_NoDateTime = 0.0 //.................................................................................................................................. // 2.5 APObservation (APOB) //.................................................................................................................................. //DateTime const cAPOB_NoDateTime = 0.0 //Same as NewObservation? (see 2.4) //IsAAVSO const cAPOB_IsAAVSOOn = true const cAPOB_IsAAVSOOff = false //.................................................................................................................................. // 2.6 APAAVSO (APA) //.................................................................................................................................. //MagDecPt const cAPA_MagDecPt1 = 1 const cAPA_MagDecPt2 = 2 const cAPA_MagDecPt3 = 3 //FainterThen const cAPA_FainterThanOn = true const cAPA_FainterThanOff = false //Uncertain const cAPA_UncertainOn = true const cAPA_UncertainOff = false //StepMagnitude const cAPA_StepMagnitudeOn = true const cAPA_StepMagnitudeOff = false //DoAirMass const cAPA_DoAirMassOn = true const cAPA_DoAirMassOff = false //ComputeAirMass const cAPA_ComputeAirMassOn = true const cAPA_ComputeAirMassOff = false //DoError const cAPA_DoErrorOn = true const cAPA_DoErrorOff = false //.................................................................................................................................. // 2.7 APCatalogObject (APCO) //.................................................................................................................................. //ID const cAPCO_MinID = 1 const cAPCO_NoID = "" //GetTypes //Need to play around with this to see if there is anything worth adding //.................................................................................................................................. // 2.8 APCatalog (APC) //.................................................................................................................................. //GetObject const cAPC_GetObjectMin = 1 const cAPC_GetObjectNone = nil //.................................................................................................................................. // 2.9 APTextFile (APTF) //.................................................................................................................................. //EOF const cAPTF_EOFYes = true //File is at EOF const cAPTF_EOFNo = false //File is not at EOF //ReadLine, ReadAll const cAPTF_ReadError = "" //Returned if ReadLine failed for some reason (e.g. File is not open) //.................................................................................................................................. // 2.10 APSearch (APS) //.................................................................................................................................. //See section 2.10.1 for an extenisive list of constants //MaxResults const cAPS_MaxResultsDef = 100 //Default maximum results //.................................................................................................................................. // 2.11 Canvas (APCV) //.................................................................................................................................. //Canvas Constructor const cAPCV_PageSetupOn = true //Call the page setup dialogue const cAPCV_PageSetupOff = false //Do not call the page setup dialogue //.................................................................................................................................. // 2.11.4 CanvasFOV (APCF) //.................................................................................................................................. //DrawFOV const cAPCF_BlackOnWhite = true //Do blank on white display const cAPCF_WhiteOnBlack = false //Do white on black display //FOVsize const cAPCF_FOVSizeMin = 0.1 const cAPCF_FOVSizeMax = 60.0 //FOVOption const cAPCF_FOVOptionOn = true const cAPCF_FOVOptionOff = false const cAPCF_FOVOptionAltAzRotation = "Alt/Az Rotation" const cAPCF_FOVOptionCustomReticles = "Custom Reticles" const cAPCF_FOVOptionConstellations = "Constellations" const cAPCF_FOVOptionExtMagRange = "Extended Magnitude Range" const cAPCF_FOVOptionFlipHorizontal = "Flip Horizontal" const cAPCF_FOVOptionFlipVertical = "Flip Vertical" //FOVCatalogue const cAPCF_NoCatalog = "" //Perform operation on all catalogues const cAPCF_CatalogOn = true //Select catalogue const cAPCF_CatalogOff = false //Deselect catalogue const cAPCF_CatalogLabelOn = true //Select catalogue labels const cAPCF_CatalogLabelOff = false //Deselect catalogue labels //FOVStarLimits const cAPCF_StarLimitMin = 0.0 //Minimum magnitude limit const cAPCF_StarLimitMax = 12.0 //Maximum magnitude limit const cAPCF_StarLimitExt = 30.0 //Extended magnitude limit //FOVApeture const cAPCF_FOVApetureOn = true //Draw the FOV circle and crosshair const cAPCF_FOVApetureOff = false //Do not draw the FOV circle and crosshair //SkyOption const cAPCF_OptionStateOn = true //Select the required option const cAPCF_OptionStateOff = false //Deselect the required option //Text constants for the options have not been added. //These options may change in future versions of AP. //I might just add these if I really feel the need!!! //DrawImage const cAPCF_TitleOn = true const cAPCF_TitleOff = false const cAPCF_InvertedOn = true const cAPCF_InvertedOff = false const cAPCF_GreyScaleOn = true const cAPCF_GreyScaleOff = false const cAPCF_ScaledOn = true const cAPCF_ScaledOff = false //IsUserImage const cAPCF_UserImage = true const cAPCF_DSSImage = false //.................................................................................................................................. // 2.11.5 Creating and drawing tables (APCT) //.................................................................................................................................. //DrawTable (These constants already exist, without the prefix of course) const cAPCT_GridNone = 0 const cAPCT_GridThin = 1 const cAPCT_GridThick = 2 //.................................................................................................................................. // 2.12 Table (APT) //.................................................................................................................................. //LoadFromText //const cAPT_DelimeterDef = chr(9) //REALbasic does not allow this - darn it!!! const cAPT_DelimiterDef = 9 //Default delimiter is Tab const cAPT_HasTitlesYes = true const cAPT_HasTitlesNo = false // 2.12.14 Formatting a table // This section details a bunch of formatting constants. // Not much point replicating them here. //.................................................................................................................................. // 2.13 Resources (APR) //.................................................................................................................................. const cAPR_SiteResourceMin = 1 const cAPR_SiteResourceNone = nil const cAPR_TelescopeResourceMin = 1 const cAPR_TelescopeResourceNone = nil const cAPR_EyepieceResourceMin = 1 const cAPR_EyepieceResourceNone = nil const cAPR_VisualAidResourceMin = 1 const cAPR_VisualAidResourceNone = nil //SiteResource, TelescopeResource, EyepieceResource //These can be used as general replacements for the equivalent declarations given below const cAPR_DefaultResourceYes = true const cAPR_DefaultResourceNo = false //.................................................................................................................................. // 2.13.2 SiteResource (APSR) //.................................................................................................................................. const cAPSR_DefaultSiteYes = true const cAPSR_DefaultSiteNo = false const cAPSR_USDSTYes = true const cAPSR_USDSTNo = false const cAPSR_EUDSTYes = true const cAPSR_EUDSTNo = false //.................................................................................................................................. // 2.13.3 TelescopeResource (APTR) //.................................................................................................................................. const cAPTR_DefaultTelescopeYes = true const cAPTR_DefaultTelescopeNo = false const cAPTR_IsTelescopeYes = true const cAPTR_IsTelescopeNo = false const cAPTR_IsBinocularYes = true const cAPTR_IsBinocularNo = false const cAPTR_FlipFinderHorizontalYes = true const cAPTR_FlipFinderHorizontalNo = false const cAPTR_FlipFinderVerticalYes = true const cAPTR_FlipFinderVerticalNo = false //.................................................................................................................................. // 2.13.4 EyepieceResource (APER) //.................................................................................................................................. const cAPER_DefaultEyepieceYes = true const cAPER_DefaultEyepieceNo = false //.................................................................................................................................. // 2.13.5 VisualAidResource (APVR) //.................................................................................................................................. const cAPVR_InvertsHorizontallyYes = true const cAPVR_InvertsHorizontallyNo = false const cAPVR_InvertsVerticallyYes = true const cAPVR_InvertsVerticallyNo = false //.................................................................................................................................. // 2.14 Serial port support (APSP) //.................................................................................................................................. const cAPSP_SerialPort1 = 1 const cAPSP_SerialPort2 = 2 const cAPSP_SerialPort3 = 3 const cAPSP_SerialPort4 = 4 //APSerialPort const cAPSP_BitRateDefault = 9600 const cAPSP_DataBitsDefault = 8 const cAPSP_StopBitsDefault = 1 const cAPSP_ParityEven = "Even" const cAPSP_ParityOdd = "Odd" const cAPSP_ParityNone = "None" const cAPSP_ParityDefault = "None" const cAPSP_FlowControlReset = "" const cAPSP_FlowControlXON = "XON" const cAPSP_FlowControlCTS = "CTS" const cAPSP_FlowControlDTS = "DTS" const cAPSP_FlowControlDefault = "" const cAPSP_ReceiveDefault = "" const cAPSP_ReceiveTimeoutDefault = 5 //================================================================================================================================== // Sub and functions //================================================================================================================================== //---------------------------------------------------------------------------------------------------------------------------------- // Constellation functions //---------------------------------------------------------------------------------------------------------------------------------- //.................................................................................................................................. // Name : ConstellationToInt // Purpose : Return the index of the matched Constellation abbreviation or full-name // Requires: Name - Constellation abbreviation or full-name to be matched // NameType - 1 = The Name given is a Constellation abbreviation // 2 = The Name given is a Constellation full-name // Returns : cMinConstellation...cMaxConstellation if a match of the appropriate type is found // cNoConstellation if no match is found // Notes : - Could be modified to check both constellation name types together, thus eliminating the need for the NameType // argument. There would be a small(ish) speed penalty, however, the array is only 88 elements so the penalty would // not be great. Mod would add and OR statement to the IF...THEN array element matching statement: // if (Name = Names(Index).NthField(cConstellationSep, cConstellationShortName)) or_ // (Name = Names(Index).NthField(cConstellationSep, cConstellationLongName)) then // This rather clumsy comparasion operation would be much simplified in ConstellationNames() and // ConstellationAbbreviations() existed. Then one or other of these could be assigned to Names and the 'if Name=' // comparasion would be much simpler. I haven't checked the RB manual to look for an array element matching function. //.................................................................................................................................. function ConstellationToInt (Name as string, NameType as integer) as integer const cIndexInc = 1 dim Found as boolean = false dim Index as integer = cConstellationMin dim Names(-1) as string Names() = Constellations() do until (Index = cConstellationMax+1) or Found if Name = Names(Index).NthField(cConstellationSep, NameType) then Found = true else Index = Index + cIndexInc end if loop if not(Found) then Index = cConstellationNone end if return Index end function //.................................................................................................................................. // Name : ConstellationAbbreviationToInt // Purpose : Return the index of the matched Constellation abbreviation // Requires: Name - Constellation abbreviation to be matched // Returns : cMinConstellation...cMaxConstellation if a match of the appropriate type is found // cNoConstellation if no match is found //.................................................................................................................................. function ConstellationAbbreviationToInt (Name as string) as integer return ConstellationToInt(Name, cConstellationShortName) end function //.................................................................................................................................. // Name : ConstellationNameToInt // Purpose : Return the index of the matched Constellation full-name // Requires: Name - Constellation full-name to be matched // Returns : cMinConstellation...cMaxConstellation if a match of the appropriate type is found // cNoConstellation if no match is found //.................................................................................................................................. function ConstellationNameToInt (Name as string) as integer return ConstellationToInt(Name, cConstellationLongName) end function