#Xguiphot User Interface

reset-server
appInitialize xguiphot Xguiphot {
!
! Applications Defaults for the xguiphot photometry program
!
Xguiphot*objects: \
	toplevel		Layout		imageLayout \
\
	imageLayout             Group           imbtn1Group \
        imbtn1Group             Layout          imbtn1Layout \
        imbtn1Layout            MenuButton      imagefilesButton \
        imbtn1Layout            MenuButton      imageviewButton \
        imbtn1Layout            MenuButton      imagefindButton \
        imbtn1Layout            MenuButton      imageobjectsButton \
        imbtn1Layout            MenuButton      imagephotButton \
        imbtn1Layout            MenuButton      imageresultsButton \
        imbtn1Layout            MenuButton      imageparametersButton \
        imbtn1Layout            Command         imagehelpButton \
        imbtn1Layout            Command         imagequitButton \
        imageLayout             Frame           imviewFrame \
        imviewFrame             Gterm           imagedisplayWindow \
\
	toplevel		TopLevelShell	xguiphot_help \
	xguiphot_help		Layout          helpLayout \
	helpLayout		Layout          helpMenuLayout \
	helpMenuLayout		Command         helpBack \
	helpMenuLayout		Command         helpForward \
	helpMenuLayout		Command         helpHome \
	helpMenuLayout		Command         helpToc \
	helpMenuLayout		Command         helpReset \
	helpMenuLayout		Command         helpHelp \
	helpMenuLayout		Command         helpClose \
	helpLayout		Frame           helpTextFrame\
	helpTextFrame		HTML            helpText \
\
	toplevel		TopLevelShell	xguiphot_tutorial \
	xguiphot_tutorial	Layout          tutLayout \
	tutLayout		Frame           tutTextFrame\
	tutTextFrame		HTML            tutText \
\
	toplevel        	TopLevelShell   xguiphot_files \
	xguiphot_files		Layout          filesLayout \
	filesLayout		Group		curdirGroup \
	curdirGroup		Layout		curdirLayout \
	curdirLayout		Label		curdirLabel \
	curdirLayout		Frame		curdirFrame \
	curdirFrame		AsciiText	curdirText \
	curdirLayout		Scrollbar2	dirlistScrollbar \
	curdirLayout		Frame		dirlistFrame \
	dirlistFrame		Porthole	dirlistPorthole \
	dirlistPorthole		MultiList	dirList \
	filesLayout		Group		imagesGroup \
	imagesGroup		Layout		imagesLayout \
	imagesLayout		Label		imdirLabel \
	imagesLayout		Frame		imdirFrame \
	imdirFrame		AsciiText	imdirText \
	imagesLayout		Label		imtemplateLabel \
	imagesLayout		Frame		imtemplateFrame \
	imtemplateFrame		AsciiText	imtemplateText \
	imagesLayout		Scrollbar2	imlistScrollbar \
	imagesLayout		Frame		imlistFrame \
	imlistFrame		Porthole	imlistPorthole \
	imlistPorthole		MultiList	imageList \
	filesLayout		Group		objectsGroup \
	objectsGroup		Layout		objectsLayout \
	objectsLayout		Label		ofdirLabel \
	objectsLayout		Frame		ofdirFrame \
	ofdirFrame		AsciiText	ofdirText \
	objectsLayout		Label		oftemplateLabel \
	objectsLayout		Frame		oftemplateFrame \
	oftemplateFrame		AsciiText	oftemplateText \
	objectsLayout		Scrollbar2	objectsScrollbar \
	objectsLayout		Frame		objectsFrame \
	objectsFrame		Porthole	objectsPorthole \
	objectsPorthole		MultiList	objectsList \
	filesLayout		Group		fresultsGroup \
	fresultsGroup		Layout		fresultsLayout \
	fresultsLayout          Label           rflogLabel \
	fresultsLayout          Command         rflogButton \
	fresultsLayout		Label		rfdirLabel \
	fresultsLayout		Frame		rfdirFrame \
	rfdirFrame		AsciiText	rfdirText \
	fresultsLayout		Label		gfdirLabel \
	fresultsLayout		Frame		gfdirFrame \
	gfdirFrame		AsciiText	gfdirText \
	fresultsLayout		Label		rftemplateLabel \
	fresultsLayout		Frame		rftemplateFrame \
	rftemplateFrame		AsciiText	rftemplateText \
	fresultsLayout		Label		gftemplateLabel \
	fresultsLayout		Frame		gftemplateFrame \
	gftemplateFrame		AsciiText	gftemplateText \
	fresultsLayout		Frame		fresultsFrame \
	fresultsFrame           AsciiText       fresultsText \
	fresultsLayout		Frame		frobjectsFrame \
	frobjectsFrame          AsciiText       frobjectsText \
	filesLayout		Layout		fbuttonsLayout \
	fbuttonsLayout		Command		filesApplyButton \
	fbuttonsLayout		Command		filesCancelButton \
	fbuttonsLayout		Command		filesDefaultsButton \
	fbuttonsLayout		Command		filesHelpButton \
	fbuttonsLayout		Command		filesCloseButton \
\
	toplevel                TopLevelShell   xguiphot_dispars \
        xguiphot_dispars	Layout          disparsLayout \
        disparsLayout		Group           dptitleGroup \
        dptitleGroup            Label           dpTitle \
        disparsLayout       	Group           dpparsGroup1 \
        dpparsGroup1            Layout          dpparsLayout1 \
        dpparsLayout1           Layout          dpparsLayout11 \
        dpparsLayout11          Label           deraseName \
        dpparsLayout11          Label           dfillName \
        dpparsLayout11          Label           dxviewportName \
        dpparsLayout11          Label           dyviewportName \
        dpparsLayout11          Label           dxmagName \
        dpparsLayout11          Label           dymagName \
        dpparsLayout1           Layout          dpparsLayout12 \
        dpparsLayout12          Frame           deraseFrame \
        deraseFrame             Command         deraseValue \
        dpparsLayout12          Frame           dfillFrame \
        dfillFrame              Command         dfillValue \
        dpparsLayout12          Frame           dxviewportFrame \
        dxviewportFrame         AsciiText       dxviewportValue \
        dpparsLayout12          Frame           dyviewportFrame \
        dyviewportFrame         AsciiText       dyviewportValue \
        dpparsLayout12          Frame           dxmagFrame \
        dxmagFrame              AsciiText       dxmagValue \
        dpparsLayout12          Frame           dymagFrame \
        dymagFrame              AsciiText       dymagValue \
        dpparsLayout1           Layout          dpparsLayout13 \
        dpparsLayout13          Label           deraseName2 \
        dpparsLayout13          Label           dfillName2 \
        dpparsLayout13          Label           dxviewportName2 \
        dpparsLayout13          Label           dyviewportName2 \
        dpparsLayout13          Label           dxmagName2 \
        dpparsLayout13          Label           dymagName2 \
        disparsLayout		Group           dpparsGroup2 \
        dpparsGroup2            Layout          dpparsLayout2 \
        dpparsLayout2           Layout          dpparsLayout21 \
        dpparsLayout21          Label           dztransformName \
        dpparsLayout21          Label           dzlimitsName \
        dpparsLayout21          Label           dzcontrastName \
        dpparsLayout21          Label           dznsampleName \
        dpparsLayout21          Label           dz1Name \
        dpparsLayout21          Label           dz2Name \
        dpparsLayout21          Label           dlutfileName \
        dpparsLayout21          Label           drepeatName \
        dpparsLayout2           Layout          dpparsLayout22 \
        dpparsLayout22          Frame           dztransformFrame \
        dztransformFrame        MenuButton      dztransformValue \
        dpparsLayout22          Frame           dzlimitsFrame \
        dzlimitsFrame           MenuButton      dzlimitsValue \
        dpparsLayout22          Frame           dzcontrastFrame \
	dzcontrastFrame         AsciiText       dzcontrastValue \
        dpparsLayout22          Frame           dznsampleFrame \
        dznsampleFrame          AsciiText       dznsampleValue \
        dpparsLayout22          Frame           dz1Frame \
        dz1Frame                AsciiText       dz1Value \
        dpparsLayout22          Frame           dz2Frame \
        dz2Frame                AsciiText       dz2Value \
        dpparsLayout22          Frame           dlutfileFrame \
        dlutfileFrame           AsciiText       dlutfileValue \
        dpparsLayout22          Frame           drepeatFrame \
        drepeatFrame            Command         drepeatValue \
        dpparsLayout2           Layout          dpparsLayout23 \
        dpparsLayout23          Label           dztransformName2 \
        dpparsLayout23          Label           dzlimitsName2 \
        dpparsLayout23          Label           dzcontrastName2 \
        dpparsLayout23          Label           dznsampleName2 \
        dpparsLayout23          Label           dz1Name2 \
        dpparsLayout23          Label           dz2Name2 \
        dpparsLayout23          Label           dlutfileName2 \
        dpparsLayout23          Label           drepeatName2 \
        disparsLayout		Group           dpparsGroup2 \
        disparsLayout		Group           dpbuttonsGroup \
        dpbuttonsGroup          Layout          dpbuttonsLayout \
        dpbuttonsLayout         Command         disparsUpdateButton \
        dpbuttonsLayout         Command         disparsRestoreButton \
        dpbuttonsLayout         Command         disparsDefaultsButton \
        dpbuttonsLayout         Command         disparsSaveButton \
        dpbuttonsLayout         Command         disparsDisplayButton \
        dpbuttonsLayout         Command         disparsHelpButton \
        dpbuttonsLayout         Command         disparsCloseButton \
\
	toplevel        	TopLevelShell   xguiphot_imheader \
	xguiphot_imheader 	Layout          imheaderLayout \
	imheaderLayout		Group		hdrtitleGroup \
	hdrtitleGroup		Label		hdrTitle \
	imheaderLayout		Group		hdrGroup \
	hdrGroup		Layout		headerLayout \
	headerLayout		Scrollbar2	hdrScrollbarv \
	headerLayout		Frame		hdrFrame \
	hdrFrame		Porthole	hdrPorthole \
	hdrPorthole		MultiList       hdrList \
	headerLayout		Scrollbar2	hdrScrollbarh \
	imheaderLayout		Group		hdrbuttonsGroup \
	hdrbuttonsGroup		Layout		hdrbuttonsLayout \
	hdrbuttonsLayout 	Command		imheadernextButton \
	hdrbuttonsLayout 	Command		imheaderprevButton \
	hdrbuttonsLayout 	Command		imheaderhelpButton \
	hdrbuttonsLayout	Command		imheadercloseButton \
\
        toplevel                TopLevelShell   xguiphot_objmodel \
	xguiphot_objmodel	Layout		objmodelLayout \
        objmodelLayout          Frame           objmodelFrame \
        objmodelFrame           Gterm           objmodelWindow \
	objmodelLayout		Group           objmodelGroup \
	objmodelGroup           Layout		objmodelbtnLayout \
	objmodelbtnLayout       Command	        objmodelactivateButton \
	objmodelbtnLayout       Command	        objmodelsetwidthButton \
	objmodelbtnLayout       Command	        objmodelrefitButton \
	objmodelbtnLayout       Command	        objmodelreplotButton \
	objmodelbtnLayout       Command	        objmodelresultsButton \
	objmodelbtnLayout       Command	        objmodelmomentsButton \
	objmodelbtnLayout       Command	        objmodelhelpButton \
	objmodelbtnLayout       Command	        objmodelcloseButton \
\
        toplevel                TopLevelShell   xguiphot_omarkpars \
        xguiphot_omarkpars      Layout          omarkparsLayout \
	omarkparsLayout		Group		objtitleGroup \
        objtitleGroup		Label           objTitle \
	omarkparsLayout		Group		omarkparsGroup1 \
	omarkparsGroup1		Layout		omarkparsLayout1 \
	omarkparsLayout1	Layout		omarkparsLayout11 \
	omarkparsLayout11	Label		objmarkName \
	omarkparsLayout11	Label		otoleranceName \
	omarkparsLayout11	Label		ocharmarkName \
	omarkparsLayout11	Label		onumberName \
	omarkparsLayout11	Label		opcolormarkName \
	omarkparsLayout11	Label		oscolormarkName \
	omarkparsLayout11	Label		osizemarkName \
	omarkparsLayout1	Layout		omarkparsLayout12 \
        omarkparsLayout12	Frame		objmarkFrame \
        objmarkFrame		Command		objmarkValue \
        omarkparsLayout12	Frame		otoleranceFrame \
        otoleranceFrame		AsciiText	otoleranceValue \
        omarkparsLayout12	Frame		ocharmarkFrame \
        ocharmarkFrame		MenuButton	ocharmarkValue \
        omarkparsLayout12	Frame		onumberFrame \
        onumberFrame		Command		onumberValue \
        omarkparsLayout12	Frame		opcolormarkFrame \
        opcolormarkFrame	MenuButton	opcolormarkValue \
        omarkparsLayout12	Frame		oscolormarkFrame \
        oscolormarkFrame	MenuButton	oscolormarkValue \
        omarkparsLayout12	Frame		osizemarkFrame \
        osizemarkFrame		AsciiText	osizemarkValue \
	omarkparsLayout1	Layout		omarkparsLayout13 \
	omarkparsLayout13	Label		objmarkName2 \
	omarkparsLayout13	Label		otoleranceName2 \
	omarkparsLayout13	Label		ocharmarkName2 \
	omarkparsLayout13	Label		onumberName2 \
	omarkparsLayout13	Label		opcolormarkName2 \
	omarkparsLayout13	Label		oscolormarkName2 \
	omarkparsLayout13	Label		osizemarkName2 \
	omarkparsLayout		Group		objbuttonsGroup \
	objbuttonsGroup		Layout		objbuttonsLayout \
        objbuttonsLayout	Command         omarkparsUpdateButton \
        objbuttonsLayout	Command         omarkparsRestoreButton \
        objbuttonsLayout	Command		omarkparsDefaultsButton \
        objbuttonsLayout	Command		omarkparsSaveButton \
        objbuttonsLayout	Command         omarkparsMarkButton \
        objbuttonsLayout	Command         omarkparsEraseButton \
        objbuttonsLayout	Command         omarkparsHelpButton \
        objbuttonsLayout	Command         omarkparsCloseButton \
\
        toplevel                TopLevelShell   xguiphot_objlist \
        xguiphot_objlist        Layout          objlistLayout \
        objlistLayout           Group           objlistinGroup \
        objlistinGroup          Layout          objlistinLayout \
        objlistinLayout         Label           objlistobjinLabel \
        objlistinLayout         Frame           objlistobjinFrame \
        objlistobjinFrame       AsciiText       objlistobjinText \
        objlistinLayout         Command         objlistrereadButton \
        objlistinLayout         Command         objlistnextlistButton \
        objlistinLayout         Command         objlistprevlistButton \
        objlistinLayout         Command         objlistobjinFind \
        objlistinLayout         Command         objlistobjinImpars \
        objlistinLayout         Command         objlistobjinFindpars \
        objlistinLayout         Command         objlistobjinDraw \
        objlistLayout           Group           objlistobjGroup \
        objlistobjGroup         Layout          objlistobjLayout \
        objlistobjLayout        Command         objlistrewindButton \
        objlistobjLayout        Command         objlistnextobjButton \
        objlistobjLayout        Command         objlistprevobjButton \
        objlistobjLayout        Command         objlistmarkerButton \
        objlistobjLayout        Command         objlistmarkButton \
        objlistobjLayout        Command         objlisteraseButton \
        objlistobjLayout        Command         objlistoeditButton \
        objlistobjLayout        Command         objlistinitButton \
        objlistobjLayout        Command         objlistdeleteButton \
        objlistobjLayout        Command         objlistundeleteButton \
        objlistobjLayout        Command         objlistaddButton \
        objlistobjLayout        Scrollbar2      objlistScrollbarv \
        objlistobjLayout        Frame           objlistFrame \
        objlistFrame            Porthole        objlistPorthole \
        objlistPorthole         MultiList       objlistList \
        objlistobjLayout        Scrollbar2      objlistScrollbarh \
        objlistobjLayout        Label           objlistenterLabel \
        objlistobjLayout        Frame           objlistenterFrame \
        objlistenterFrame       AsciiText       objlistenterText \
        objlistobjLayout        Command         objlistclearButton \
        objlistobjLayout        Command         objlistenterButton \
	objlistLayout		Group		objlistphotGroup \
	objlistphotGroup	Layout		objlistphotLayout \
	objlistphotLayout	Command		objcenparsButton \
	objlistphotLayout	Command		objskyparsButton \
	objlistphotLayout	Command		objphotparsButton \
	objlistphotLayout	Label		objlogLabel \
	objlistphotLayout	Command		objlogButton \
	objlistphotLayout	Command		objphotcurrentButton \
	objlistphotLayout	Command		objphotnextButton \
	objlistphotLayout	Command		objphotprevButton \
	objlistphotLayout	Command		objphotrestofButton \
	objlistphotLayout	Command		objphotallButton \
        objlistLayout           Group           objlistoutGroup \
        objlistoutGroup         Layout          objlistoutLayout \
        objlistoutLayout        Label           objlistobjdirLabel \
        objlistoutLayout        Frame           objlistobjdirFrame \
        objlistobjdirFrame      AsciiText       objlistobjdirText \
        objlistoutLayout        Label           objlistobjoutLabel \
        objlistoutLayout        Frame           objlistobjoutFrame \
        objlistobjoutFrame      AsciiText       objlistobjoutText \
        objlistoutLayout        Command         objlistsaveButton \
        objlistoutLayout        Command         objlisthelpButton \
        objlistoutLayout        Command         objlistcloseButton \
\
        toplevel                TopLevelShell   xguiphot_impars \
        xguiphot_impars      	Layout          imparsLayout \
	imparsLayout		Group		imptitleGroup \
        imptitleGroup		Label           impTitle \
	imparsLayout		Group		imparsGroup1 \
	imparsGroup1		Layout		imparsLayout1 \
	imparsLayout1		Layout		imparsLayout11 \
        imparsLayout11		Label           iscaleName \
        imparsLayout11		Label           ihwhmpsfName \
        imparsLayout11		Label           iemissionName \
        imparsLayout11		Label           iskysigmaName \
        imparsLayout11		Label           imindataName \
        imparsLayout11		Label           imaxdataName \
	imparsLayout1		Layout		imparsLayout12 \
        imparsLayout12		Frame		iscaleFrame \
        iscaleFrame		AsciiText	iscaleValue \
        imparsLayout12		Frame		ihwhmpsfFrame \
        ihwhmpsfFrame		AsciiText	ihwhmpsfValue \
        imparsLayout12		Frame		iemissionFrame \
        iemissionFrame		Command		iemissionValue \
        imparsLayout12		Frame		iskysigmaFrame \
        iskysigmaFrame		AsciiText       iskysigmaValue \
        imparsLayout12		Frame		imindataFrame \
        imindataFrame		AsciiText       imindataValue \
        imparsLayout12		Frame		imaxdataFrame \
        imaxdataFrame		AsciiText       imaxdataValue \
	imparsLayout1		Layout		imparsLayout13 \
        imparsLayout13		Label           iscaleName2 \
        imparsLayout13		Label           ihwhmpsfName2 \
        imparsLayout13		Label           iemissionName2 \
        imparsLayout13		Label           iskysigmaName2 \
        imparsLayout13		Label           imindataName2 \
        imparsLayout13		Label           imaxdataName2 \
	imparsLayout		Group		imparsGroup2 \
	imparsGroup2		Layout		imparsLayout2 \
	imparsLayout2		Layout		imparsLayout21 \
	imparsLayout21		Label		inoisemodelName \
	imparsLayout21		Label		ikreadnoiseName \
	imparsLayout21		Label		ikgainName \
	imparsLayout21		Label		ireadnoiseName \
	imparsLayout21		Label		igainName \
	imparsLayout2		Layout		imparsLayout22 \
	imparsLayout22		Frame		inoisemodelFrame \
	inoisemodelFrame	MenuButton	inoisemodelValue \
	imparsLayout22		Frame		ikreadnoiseFrame \
	ikreadnoiseFrame	AsciiText	ikreadnoiseValue \
	imparsLayout22		Frame		ikgainFrame \
	ikgainFrame		AsciiText	ikgainValue \
	imparsLayout22		Frame		ireadnoiseFrame \
	ireadnoiseFrame		AsciiText	ireadnoiseValue \
	imparsLayout22		Frame		igainFrame \
	igainFrame		AsciiText	igainValue \
	imparsLayout2		Layout		imparsLayout23 \
	imparsLayout23		Label		inoisemodelName2 \
	imparsLayout23		Label		ikreadnoiseName2 \
	imparsLayout23		Label		ikgainName2 \
	imparsLayout23		Label		ireadnoiseName2 \
	imparsLayout23		Label		igainName2 \
	imparsLayout		Group		imparsGroup3 \
	imparsGroup3		Layout		imparsLayout3 \
	imparsLayout3		Layout		imparsLayout31 \
	imparsLayout31		Label		ikexptimeName \
	imparsLayout31		Label		ikairmassName \
	imparsLayout31		Label		ikfilterName \
	imparsLayout31		Label		ikobstimeName \
	imparsLayout31		Label		ietimeName \
	imparsLayout31		Label		iairmassName \
	imparsLayout31		Label		ifilterName \
	imparsLayout31		Label		iotimeName \
	imparsLayout3		Layout		imparsLayout32 \
        imparsLayout32		Frame		ikexptimeFrame \
        ikexptimeFrame		AsciiText	ikexptimeValue \
        imparsLayout32		Frame		ikairmassFrame \
        ikairmassFrame		AsciiText	ikairmassValue \
        imparsLayout32		Frame		ikfilterFrame \
        ikfilterFrame		AsciiText	ikfilterValue \
        imparsLayout32		Frame		ikobstimeFrame \
        ikobstimeFrame		AsciiText	ikobstimeValue \
        imparsLayout32		Frame		ietimeFrame \
        ietimeFrame		AsciiText	ietimeValue \
        imparsLayout32		Frame		iairmassFrame \
        iairmassFrame		AsciiText	iairmassValue \
        imparsLayout32		Frame		ifilterFrame \
        ifilterFrame		AsciiText	ifilterValue \
        imparsLayout32		Frame		iotimeFrame \
        iotimeFrame		AsciiText	iotimeValue \
	imparsLayout3		Layout		imparsLayout33 \
	imparsLayout33		Label		ikexptimeName2 \
	imparsLayout33		Label		ikairmassName2 \
	imparsLayout33		Label		ikfilterName2 \
	imparsLayout33		Label		ikobstimeName2 \
	imparsLayout33		Label		ietimeName2 \
	imparsLayout33		Label		iairmassName2 \
	imparsLayout33		Label		ifilterName2 \
	imparsLayout33		Label		iotimeName2 \
	imparsLayout		Group		imparsGroup3 \
	imparsLayout		Group		impbuttonsGroup \
	impbuttonsGroup		Layout		impbuttonsLayout \
        impbuttonsLayout	Command         imparsUpdateButton \
        impbuttonsLayout	Command         imparsRestoreButton \
        impbuttonsLayout	Command		imparsDefaultsButton \
        impbuttonsLayout	Command		imparsSaveButton \
        impbuttonsLayout	Command         imparsHelpButton \
        impbuttonsLayout	Command         imparsCloseButton \
\
        toplevel                TopLevelShell   xguiphot_findpars \
        xguiphot_findpars      	Layout          findparsLayout \
	findparsLayout		Group		findtitleGroup \
        findtitleGroup		Label           findTitle \
	findparsLayout		Group		findparsGroup1 \
	findparsGroup1		Layout		findparsLayout1 \
	findparsLayout1		Layout		findparsLayout11 \
	findparsLayout11	Label		fthresholdName \
	findparsLayout11	Label		fradiusName \
	findparsLayout11	Label		fsepminName \
	findparsLayout11	Label		froundloName \
	findparsLayout11	Label		froundhiName \
	findparsLayout11	Label		fsharploName \
	findparsLayout11	Label		fsharphiName \
	findparsLayout1		Layout		findparsLayout12 \
        findparsLayout12	Frame		fthresholdFrame \
        fthresholdFrame		AsciiText	fthresholdValue \
        findparsLayout12	Frame		fradiusFrame \
        fradiusFrame		AsciiText	fradiusValue \
        findparsLayout12	Frame		fsepminFrame \
        fsepminFrame		AsciiText	fsepminValue \
        findparsLayout12	Frame		froundloFrame \
        froundloFrame		AsciiText	froundloValue \
        findparsLayout12	Frame		froundhiFrame \
        froundhiFrame		AsciiText	froundhiValue \
        findparsLayout12	Frame		fsharploFrame \
        fsharploFrame		AsciiText	fsharploValue \
        findparsLayout12	Frame		fsharphiFrame \
        fsharphiFrame		AsciiText	fsharphiValue \
	findparsLayout1		Layout		findparsLayout13 \
	findparsLayout13	Label		fthresholdName2 \
	findparsLayout13	Label		fradiusName2 \
	findparsLayout13	Label		fsepminName2 \
	findparsLayout13	Label		froundloName2 \
	findparsLayout13	Label		froundhiName2 \
	findparsLayout13	Label		fsharploName2 \
	findparsLayout13	Label		fsharphiName2 \
	findparsLayout		Group		findbuttonsGroup \
	findbuttonsGroup	Layout		findbuttonsLayout \
        findbuttonsLayout	Command         findparsUpdateButton \
        findbuttonsLayout	Command         findparsRestoreButton \
        findbuttonsLayout	Command		findparsDefaultsButton \
        findbuttonsLayout	Command		findparsSaveButton \
        findbuttonsLayout	Command         findparsFindButton \
        findbuttonsLayout	Command         findparsHelpButton \
        findbuttonsLayout	Command         findparsCloseButton \
\
        toplevel                TopLevelShell   xguiphot_cenpars \
        xguiphot_cenpars      	Layout          cenparsLayout \
	cenparsLayout		Group		cetitleGroup \
        cetitleGroup		Label           ceTitle \
	cenparsLayout		Group		ceparsGroup1 \
	ceparsGroup1		Layout		ceparsLayout1 \
	ceparsLayout1		Layout		ceparsLayout11 \
        ceparsLayout11		Label           calgorithmName \
        ceparsLayout11		Label           cradiusName \
        ceparsLayout11		Label           cthresholdName \
        ceparsLayout11		Label           cminsnratioName \
        ceparsLayout11		Label           cmaxiterName \
        ceparsLayout11		Label           cxyshiftName \
	ceparsLayout1		Layout		ceparsLayout12 \
        ceparsLayout12		Frame		calgorithmFrame \
        calgorithmFrame		MenuButton	calgorithmValue \
        ceparsLayout12		Frame		cradiusFrame \
        cradiusFrame		AsciiText	cradiusValue \
        ceparsLayout12		Frame		cthresholdFrame \
        cthresholdFrame		AsciiText       cthresholdValue \
        ceparsLayout12		Frame		cminsnratioFrame \
        cminsnratioFrame	AsciiText       cminsnratioValue \
        ceparsLayout12		Frame		cmaxiterFrame \
        cmaxiterFrame		AsciiText       cmaxiterValue \
        ceparsLayout12		Frame		cxyshiftFrame \
        cxyshiftFrame		AsciiText       cxyshiftValue \
	ceparsLayout1		Layout		ceparsLayout13 \
        ceparsLayout13		Label           calgorithmName2 \
        ceparsLayout13		Label           cradiusName2 \
        ceparsLayout13		Label           cthresholdName2 \
        ceparsLayout13		Label           cminsnratioName2 \
        ceparsLayout13		Label           cmaxiterName2 \
        ceparsLayout13		Label           cxyshiftName2 \
	cenparsLayout		Group		ceparsGroup2 \
	ceparsGroup2		Layout		ceparsLayout2 \
	ceparsLayout2		Layout		ceparsLayout21 \
	ceparsLayout21		Label		ctrmarkName \
	ceparsLayout21		Label		ccharmarkName \
	ceparsLayout21		Label		ccolormarkName \
	ceparsLayout21		Label		csizemarkName \
	ceparsLayout2		Layout		ceparsLayout22 \
        ceparsLayout22		Frame		ctrmarkFrame \
        ctrmarkFrame		Command		ctrmarkValue \
        ceparsLayout22		Frame		ccharmarkFrame \
        ccharmarkFrame		MenuButton	ccharmarkValue \
        ceparsLayout22		Frame		ccolormarkFrame \
        ccolormarkFrame		MenuButton	ccolormarkValue \
        ceparsLayout22		Frame		csizemarkFrame \
        csizemarkFrame		AsciiText	csizemarkValue \
	ceparsLayout2		Layout		ceparsLayout23 \
	ceparsLayout23		Label		ctrmarkName2 \
	ceparsLayout23		Label		ccharmarkName2 \
	ceparsLayout23		Label		ccolormarkName2 \
	ceparsLayout23		Label		csizemarkName2 \
	cenparsLayout		Group		cebuttonsGroup \
	cebuttonsGroup		Layout		cebuttonsLayout \
        cebuttonsLayout		Command         cenparsUpdateButton \
        cebuttonsLayout		Command         cenparsRestoreButton \
        cebuttonsLayout		Command		cenparsDefaultsButton \
        cebuttonsLayout		Command		cenparsSaveButton \
        cebuttonsLayout		Command         cenparsHelpButton \
        cebuttonsLayout		Command         cenparsCloseButton \
\
        toplevel                TopLevelShell   xguiphot_skypars \
        xguiphot_skypars      	Layout          skyparsLayout \
	skyparsLayout		Group		skytitleGroup \
        skytitleGroup		Label           skyTitle \
	skyparsLayout		Group		skyparsGroup1 \
	skyparsGroup1		Layout		skyparsLayout1 \
	skyparsLayout1		Layout		skyparsLayout11 \
	skyparsLayout11		Label		smodeName \
        skyparsLayout11		Label           sgeometryName \
        skyparsLayout11		Label           srannulusName \
        skyparsLayout11		Label           swannulusName \
        skyparsLayout11		Label           saxratioName \
        skyparsLayout11		Label           sposangleName \
	skyparsLayout1		Layout		skyparsLayout12 \
        skyparsLayout12		Frame		smodeFrame \
        smodeFrame		MenuButton	smodeValue \
        skyparsLayout12		Frame		sgeometryFrame \
        sgeometryFrame		MenuButton	sgeometryValue \
        skyparsLayout12		Frame		srannulusFrame \
        srannulusFrame		AsciiText	srannulusValue \
        skyparsLayout12		Frame		swannulusFrame \
        swannulusFrame		AsciiText	swannulusValue \
        skyparsLayout12		Frame		saxratioFrame \
        saxratioFrame		AsciiText       saxratioValue \
        skyparsLayout12		Frame		sposangleFrame \
        sposangleFrame		AsciiText       sposangleValue \
	skyparsLayout1		Layout		skyparsLayout13 \
	skyparsLayout13		Label		smodeName2 \
        skyparsLayout13		Label           sgeometryName2 \
        skyparsLayout13		Label           srannulusName2 \
        skyparsLayout13		Label           swannulusName2 \
        skyparsLayout13		Label           saxratioName2 \
        skyparsLayout13		Label           sposangleName2 \
	skyparsLayout		Group		skyparsGroup2 \
	skyparsGroup2		Layout		skyparsLayout2 \
	skyparsLayout2		Layout		skyparsLayout21 \
	skyparsLayout21		Label		salgorithmName \
	skyparsLayout21		Label		sconstantName \
	skyparsLayout21		Label		shwidthName \
	skyparsLayout21		Label		shbinsizeName \
	skyparsLayout21		Label		shsmoothName \
	skyparsLayout21		Label		smaxiterName \
	skyparsLayout21		Label		sloclipName \
	skyparsLayout21		Label		shiclipName \
	skyparsLayout21		Label		snrejectName \
	skyparsLayout21		Label		slorejectName \
	skyparsLayout21		Label		shirejectName \
	skyparsLayout21		Label		srgrowName \
	skyparsLayout2		Layout		skyparsLayout22 \
	skyparsLayout22		Frame		salgorithmFrame \
	salgorithmFrame		MenuButton	salgorithmValue \
	skyparsLayout22		Frame		sconstantFrame \
	sconstantFrame		AsciiText	sconstantValue \
	skyparsLayout22		Frame		shwidthFrame \
	shwidthFrame		AsciiText	shwidthValue \
	skyparsLayout22		Frame		shbinsizeFrame \
	shbinsizeFrame		AsciiText	shbinsizeValue \
	skyparsLayout22		Frame		shsmoothFrame \
	shsmoothFrame		Command		shsmoothValue \
	skyparsLayout22		Frame		smaxiterFrame \
	smaxiterFrame		AsciiText	smaxiterValue \
	skyparsLayout22		Frame		sloclipFrame \
	sloclipFrame		AsciiText	sloclipValue \
	skyparsLayout22		Frame		shiclipFrame \
	shiclipFrame		AsciiText	shiclipValue \
	skyparsLayout22		Frame		snrejectFrame \
	snrejectFrame		AsciiText	snrejectValue \
	skyparsLayout22		Frame		slorejectFrame \
	slorejectFrame		AsciiText	slorejectValue \
	skyparsLayout22		Frame		shirejectFrame \
	shirejectFrame		AsciiText	shirejectValue \
	skyparsLayout22		Frame		srgrowFrame \
	srgrowFrame		AsciiText	srgrowValue \
	skyparsLayout2		Layout		skyparsLayout23 \
	skyparsLayout23		Label		salgorithmName2 \
	skyparsLayout23		Label		sconstantName2 \
	skyparsLayout23		Label		shwidthName2 \
	skyparsLayout23		Label		shbinsizeName2 \
	skyparsLayout23		Label		shsmoothName2 \
	skyparsLayout23		Label		smaxiterName2 \
	skyparsLayout23		Label		sloclipName2 \
	skyparsLayout23		Label		shiclipName2 \
	skyparsLayout23		Label		snrejectName2 \
	skyparsLayout23		Label		slorejectName2 \
	skyparsLayout23		Label		shirejectName2 \
	skyparsLayout23		Label		srgrowName2 \
	skyparsLayout		Group		skyparsGroup3 \
	skyparsGroup3		Layout		skyparsLayout3 \
	skyparsLayout3		Layout		skyparsLayout31 \
	skyparsLayout31		Label		skymarkName \
	skyparsLayout31		Label		scolormarkName \
	skyparsLayout3		Layout		skyparsLayout32 \
        skyparsLayout32		Frame		skymarkFrame \
        skymarkFrame		Command		skymarkValue \
        skyparsLayout32		Frame		scolormarkFrame \
        scolormarkFrame		MenuButton	scolormarkValue \
	skyparsLayout3		Layout		skyparsLayout33 \
	skyparsLayout33		Label		skymarkName2 \
	skyparsLayout33		Label		scolormarkName2 \
	skyparsLayout		Group		skybuttonsGroup \
	skybuttonsGroup		Layout		skybuttonsLayout \
        skybuttonsLayout	Command         skyparsUpdateButton \
        skybuttonsLayout	Command         skyparsRestoreButton \
        skybuttonsLayout	Command		skyparsDefaultsButton \
        skybuttonsLayout	Command		skyparsSaveButton \
        skybuttonsLayout	Command         skyparsHelpButton \
        skybuttonsLayout	Command         skyparsCloseButton \
\
        toplevel                TopLevelShell   xguiphot_photpars \
        xguiphot_photpars      	Layout          photparsLayout \
	photparsLayout		Group		phtitleGroup \
        phtitleGroup		Label           phTitle \
	photparsLayout		Group		phparsGroup1 \
	phparsGroup1		Layout		phparsLayout1 \
	phparsLayout1		Layout		phparsLayout11 \
        phparsLayout11		Label           pgeometryName \
        phparsLayout11		Label           paperturesName \
        phparsLayout11		Label           paxratioName \
        phparsLayout11		Label           pposangleName \
        phparsLayout11		Label           pzmagName \
	phparsLayout1		Layout		phparsLayout12 \
        phparsLayout12		Frame		pgeometryFrame \
        pgeometryFrame		MenuButton	pgeometryValue \
        phparsLayout12		Frame		paperturesFrame \
        paperturesFrame		AsciiText	paperturesValue \
        phparsLayout12		Frame		paxratioFrame \
        paxratioFrame		AsciiText       paxratioValue \
        phparsLayout12		Frame		pposangleFrame \
        pposangleFrame		AsciiText       pposangleValue \
        phparsLayout12		Frame		pzmagFrame \
        pzmagFrame		AsciiText       pzmagValue \
	phparsLayout1		Layout		phparsLayout13 \
        phparsLayout13		Label           pgeometryName2 \
        phparsLayout13		Label           paperturesName2 \
        phparsLayout13		Label           paxratioName2 \
        phparsLayout13		Label           pposangleName2 \
        phparsLayout13		Label           pzmagName2 \
	photparsLayout		Group		phparsGroup2 \
	phparsGroup2		Layout		phparsLayout2 \
	phparsLayout2		Layout		phparsLayout21 \
	phparsLayout21		Label		photmarkName \
	phparsLayout21		Label		pcolormarkName \
	phparsLayout2		Layout		phparsLayout22 \
        phparsLayout22		Frame		photmarkFrame \
        photmarkFrame		Command		photmarkValue \
        phparsLayout22		Frame		pcolormarkFrame \
        pcolormarkFrame		MenuButton	pcolormarkValue \
	phparsLayout2		Layout		phparsLayout23 \
	phparsLayout23		Label		photmarkName2 \
	phparsLayout23		Label		pcolormarkName2 \
	photparsLayout		Group		phbuttonsGroup \
	phbuttonsGroup		Layout		phbuttonsLayout \
        phbuttonsLayout		Command         photparsUpdateButton \
        phbuttonsLayout		Command         photparsRestoreButton \
        phbuttonsLayout		Command		photparsDefaultsButton \
        phbuttonsLayout		Command		photparsSaveButton \
        phbuttonsLayout		Command         photparsHelpButton \
        phbuttonsLayout		Command         photparsCloseButton \
\
	toplevel        	TopLevelShell   xguiphot_results \
	xguiphot_results 	Layout          resultsLayout \
	resultsLayout		Group		restitleGroup \
	restitleGroup		Label		resTitle \
	resultsLayout		Group		resGroup \
	resGroup		Layout		resLayout \
	resLayout		Frame		resFrame \
	resFrame		AsciiText	resText \
	resultsLayout		Frame		objregFrame \
	objregFrame		Gterm		objregWindow \
	resultsLayout		Frame		objplotsFrame \
	objplotsFrame		Gterm		objplotsWindow \
	resultsLayout		Group		oplotbuttonsGroup \
	oplotbuttonsGroup       Layout		oplotbuttonsLayout \
	oplotbuttonsLayout	MenuButton	objregionButton \
	oplotbuttonsLayout	Command		objregactivateButton \
	oplotbuttonsLayout	MenuButton	objplotsButton \
	oplotbuttonsLayout	Command		objactivateButton \
	resultsLayout		Frame		skyregFrame \
	skyregFrame		Gterm		skyregWindow \
	resultsLayout		Frame		skyplotsFrame \
	skyplotsFrame		Gterm		skyplotsWindow \
	resultsLayout		Group		resbuttonsGroup \
	resbuttonsGroup		Layout		resbuttonsLayout \
	resbuttonsLayout	MenuButton	skyregionButton \
	resbuttonsLayout	Command		skyregactivateButton \
	resbuttonsLayout	MenuButton	skyplotsButton \
	resbuttonsLayout	Command		skyactivateButton \
	resbuttonsLayout	Label		plotslogLabel \
	resbuttonsLayout	Command		plotslogButton \
	resbuttonsLayout	Command		plotshelpButton \
	resbuttonsLayout	Command		plotscloseButton \
\
	toplevel        	TopLevelShell   xguiphot_ptable \
	xguiphot_ptable 	Layout          ptableLayout \
	ptableLayout		Group		ptbltitleGroup \
	ptbltitleGroup		Label		ptblTitle \
	ptableLayout		Group		ptblGroup \
	ptblGroup		Layout		ptblLayout \
	ptblLayout		Frame		ptblFrame \
	ptblFrame		AsciiText	ptblText \
	ptableLayout		Group		ptblbuttonsGroup \
	ptblbuttonsGroup	Layout		ptblbuttonsLayout \
	ptblbuttonsLayout 	Label		ptablelogLabel \
	ptblbuttonsLayout 	Command		ptablelogButton \
	ptblbuttonsLayout 	Command		ptableclearButton \
	ptblbuttonsLayout 	Command		ptablehelpButton \
	ptblbuttonsLayout	Command		ptablecloseButton \
\
        toplevel                TopLevelShell   xguiphot_eplotpars \
        xguiphot_eplotpars     	Layout          eplotparsLayout \
	eplotparsLayout		Frame		cntrtitleFrame \
        cntrtitleFrame		Label           cntrTitle \
	eplotparsLayout		Group		eplotparsGroup1 \
	eplotparsGroup1		Layout		eplotparsLayout1 \
	eplotparsLayout1	Layout		eplotparsLayout11 \
        eplotparsLayout11	Label           enxName \
        eplotparsLayout11	Label           enyName \
        eplotparsLayout11	Label           ez1Name \
        eplotparsLayout11	Label           ez2Name \
        eplotparsLayout11	Label           ez0Name \
        eplotparsLayout11	Label           edzName \
        eplotparsLayout11	Label           encontoursName \
	eplotparsLayout1	Layout		eplotparsLayout12 \
        eplotparsLayout12	Frame		enxFrame \
        enxFrame		AsciiText       enxValue \
        eplotparsLayout12	Frame		enyFrame \
        enyFrame		AsciiText       enyValue \
        eplotparsLayout12	Frame		ez1Frame \
        ez1Frame		AsciiText       ez1Value \
        eplotparsLayout12	Frame		ez2Frame \
        ez2Frame		AsciiText       ez2Value \
        eplotparsLayout12	Frame		ez0Frame \
        ez0Frame		AsciiText       ez0Value \
        eplotparsLayout12	Frame		edzFrame \
        edzFrame		AsciiText       edzValue \
        eplotparsLayout12	Frame		encontoursFrame \
        encontoursFrame		AsciiText       encontoursValue \
	eplotparsLayout1	Layout		eplotparsLayout13 \
        eplotparsLayout13	Label           enxName2 \
        eplotparsLayout13	Label           enyName2 \
        eplotparsLayout13	Label           ez1Name2 \
        eplotparsLayout13	Label           ez2Name2 \
        eplotparsLayout13	Label           ez0Name2 \
        eplotparsLayout13	Label           edzName2 \
        eplotparsLayout13	Label           encontoursName2 \
	eplotparsLayout		Group		eplotparsGroup2 \
	eplotparsGroup2		Layout		eplotparsLayout2 \
	eplotparsLayout2	Layout		eplotparsLayout21 \
	eplotparsLayout21	Label		ehilomarkName \
	eplotparsLayout21	Label		edashpatName \
	eplotparsLayout21	Label		elabelName \
	eplotparsLayout21	Label		eboxName \
	eplotparsLayout21	Label		eticklabelName \
	eplotparsLayout21	Label		exmajorName \
	eplotparsLayout21	Label		exminorName \
	eplotparsLayout21	Label		eymajorName \
	eplotparsLayout21	Label		eyminorName \
	eplotparsLayout21	Label		eroundName \
	eplotparsLayout21	Label		efillName \
	eplotparsLayout2	Layout		eplotparsLayout22 \
        eplotparsLayout22	Frame		ehilomarkFrame \
        ehilomarkFrame		MenuButton	ehilomarkValue \
        eplotparsLayout22	Frame		edashpatFrame \
        edashpatFrame		AsciiText	edashpatValue \
        eplotparsLayout22	Frame		elabelFrame \
        elabelFrame		Command		elabelValue \
        eplotparsLayout22	Frame		eboxFrame \
        eboxFrame		Command		eboxValue \
        eplotparsLayout22	Frame		eticklabelFrame \
        eticklabelFrame		Command		eticklabelValue \
        eplotparsLayout22	Frame		exmajorFrame \
        exmajorFrame		AsciiText	exmajorValue \
        eplotparsLayout22	Frame		exminorFrame \
        exminorFrame		AsciiText	exminorValue \
        eplotparsLayout22	Frame		eymajorFrame \
        eymajorFrame		AsciiText	eymajorValue \
        eplotparsLayout22	Frame		eyminorFrame \
        eyminorFrame		AsciiText	eyminorValue \
        eplotparsLayout22	Frame		eroundFrame \
        eroundFrame		Command		eroundValue \
        eplotparsLayout22	Frame		efillFrame \
        efillFrame		Command		efillValue \
	eplotparsLayout2	Layout		eplotparsLayout23 \
	eplotparsLayout23	Label		ehilomarkName2 \
	eplotparsLayout23	Label		edashpatName2 \
	eplotparsLayout23	Label		elabelName2 \
	eplotparsLayout23	Label		eboxName2 \
	eplotparsLayout23	Label		eticklabelName2 \
	eplotparsLayout23	Label		exmajorName2 \
	eplotparsLayout23	Label		exminorName2 \
	eplotparsLayout23	Label		eymajorName2 \
	eplotparsLayout23	Label		eyminorName2 \
	eplotparsLayout23	Label		eroundName2 \
	eplotparsLayout23	Label		efillName2 \
	eplotparsLayout		Frame		cntrbuttonsFrame \
	cntrbuttonsFrame	Layout		cntrbuttonsLayout \
        cntrbuttonsLayout	Command         eplotparsUpdateButton \
        cntrbuttonsLayout	Command         eplotparsRestoreButton \
        cntrbuttonsLayout	Command		eplotparsDefaultsButton \
        cntrbuttonsLayout	Command         eplotparsSaveButton \
        cntrbuttonsLayout	Command         eplotparsHelpButton \
        cntrbuttonsLayout	Command         eplotparsCloseButton \
\
        toplevel                TopLevelShell   xguiphot_aplotpars \
        xguiphot_aplotpars     	Layout          aplotparsLayout \
	aplotparsLayout		Frame		surftitleFrame \
        surftitleFrame		Label           surfTitle \
	aplotparsLayout		Group		aplotparsGroup1 \
	aplotparsGroup1		Layout		aplotparsLayout1 \
	aplotparsLayout1	Layout		aplotparsLayout11 \
        aplotparsLayout11	Label           anxName \
        aplotparsLayout11	Label           anyName \
        aplotparsLayout11	Label           az1Name \
        aplotparsLayout11	Label           az2Name \
	aplotparsLayout1	Layout		aplotparsLayout12 \
        aplotparsLayout12	Frame		anxFrame \
        anxFrame		AsciiText       anxValue \
        aplotparsLayout12	Frame		anyFrame \
        anyFrame		AsciiText       anyValue \
        aplotparsLayout12	Frame		az1Frame \
        az1Frame		AsciiText       az1Value \
        aplotparsLayout12	Frame		az2Frame \
        az2Frame		AsciiText       az2Value \
	aplotparsLayout1	Layout		aplotparsLayout13 \
        aplotparsLayout13	Label           anxName2 \
        aplotparsLayout13	Label           anyName2 \
        aplotparsLayout13	Label           az1Name2 \
        aplotparsLayout13	Label           az2Name2 \
	aplotparsLayout		Group		aplotparsGroup2 \
	aplotparsGroup2		Layout		aplotparsLayout2 \
	aplotparsLayout2	Layout		aplotparsLayout21 \
	aplotparsLayout21	Label		alabelName \
	aplotparsLayout21	Label		angvName \
	aplotparsLayout21	Label		anghName \
	aplotparsLayout2	Layout		aplotparsLayout22 \
        aplotparsLayout22	Frame		alabelFrame \
        alabelFrame		Command  	alabelValue \
        aplotparsLayout22	Frame		angvFrame \
        angvFrame		AsciiText	angvValue \
        aplotparsLayout22	Frame		anghFrame \
        anghFrame		AsciiText	anghValue \
	aplotparsLayout2	Layout		aplotparsLayout23 \
	aplotparsLayout23	Label		alabelName2 \
	aplotparsLayout23	Label		angvName2 \
	aplotparsLayout23	Label		anghName2 \
	aplotparsLayout		Frame		surfbuttonsFrame \
	surfbuttonsFrame	Layout		surfbuttonsLayout \
        surfbuttonsLayout	Command         aplotparsUpdateButton \
        surfbuttonsLayout	Command         aplotparsRestoreButton \
        surfbuttonsLayout	Command		aplotparsDefaultsButton \
        surfbuttonsLayout	Command         aplotparsSaveButton \
        surfbuttonsLayout	Command         aplotparsHelpButton \
        surfbuttonsLayout	Command         aplotparsCloseButton \
\
	toplevel		Parameter	xguiphot \
	xguiphot		Parameter	uinitialize \
	xguiphot		Parameter	ustartdir \
	xguiphot		Parameter	ucurdir \
	xguiphot		Parameter	udirliststr \
	xguiphot		Parameter	uimdir \
	xguiphot		Parameter	uimtemplatestr \
	xguiphot		Parameter       uimliststr \
	xguiphot		Parameter	uimno \
	xguiphot		Parameter	uofdir \
	xguiphot		Parameter	uoftemplatestr \
	xguiphot		Parameter       uolliststr \
	xguiphot		Parameter	uofno \
	xguiphot		Parameter	urfdir \
	xguiphot		Parameter	urftemplatestr \
	xguiphot		Parameter	urffile \
	xguiphot		Parameter	urfno \
	xguiphot		Parameter	ugfdir \
	xguiphot		Parameter	ugftemplatestr \
	xguiphot		Parameter	ugffile \
	xguiphot		Parameter	ugfno \
	xguiphot		Parameter	ufiles \
	xguiphot		Parameter	uhelp \
	xguiphot		Parameter	uhelplist \
	xguiphot		Parameter	ututor \
	xguiphot		Parameter	ututorlist \
	xguiphot		Parameter	uheader \
	xguiphot		Parameter	uhdrlist \
	xguiphot		Parameter	uimpars \
	xguiphot		Parameter	udispars \
	xguiphot		Parameter	uomarkpars \
	xguiphot		Parameter	ufindpars \
	xguiphot		Parameter	uobjects \
	xguiphot		Parameter	uobjlist \
	xguiphot		Parameter	uobjno \
	xguiphot		Parameter	uobjmarker \
	xguiphot		Parameter	ucenpars \
	xguiphot		Parameter	uskypars \
	xguiphot		Parameter	uphotpars \
	xguiphot		Parameter	ueplotpars \
	xguiphot		Parameter	uaplotpars \
	xguiphot		Parameter	umplots \
	xguiphot		Parameter	uplots \
	xguiphot		Parameter	ugterm \
	xguiphot		Parameter	ucursor \
	xguiphot		Parameter	umredraw \
	xguiphot		Parameter	uredisplay \
	xguiphot		Parameter	ulogresults \
	xguiphot                Parameter       uresults \
	xguiphot		Parameter	upbanner \
	xguiphot		Parameter	uptable \
	xguiphot		Parameter	upobject \
	xguiphot		Parameter	uppolygon \
	xguiphot		Parameter	us1polygon \
	xguiphot		Parameter	us2polygon \

*shapeStyle:					rectangle
*beNiceToColormap:				False

*xguiphot*MenuButton.highlightThickness:	2

*xguiphot*SimpleMenu.background:		gray81
*xguiphot*SimpleMenu.foreground:		black
*xguiphot*SimpleMenu.borderWidth:		1
*xguiphot*SimpleMenu.menuLabel.foreground:	black
*xguiphot*SimpleMenu.line1.foreground:		gray71
*xguiphot*SimpleMenu.line2.foreground:		gray91
*xguiphot*SimpleMenu.line3.foreground:		gray71
*xguiphot*SimpleMenu.line4.foreground:		gray91
*xguiphot*SimpleMenu.line5.foreground:		gray71
*xguiphot*SimpleMenu.line6.foreground:		gray91
*xguiphot*SimpleMenu.line7.foreground:		gray71
*xguiphot*SimpleMenu.line8.foreground:		gray91
*xguiphot*SimpleMenu.line9.foreground:		gray71
*xguiphot*SimpleMenu.line10.foreground:		gray91
*xguiphot*SimpleMenu.line11.foreground:		gray71
*xguiphot*SimpleMenu.line12.foreground:		gray91
*xguiphot*SimpleMenu.line13.foreground:		gray71
*xguiphot*SimpleMenu.line14.foreground:		gray91
*xguiphot*SimpleMenu.line15.foreground:		gray71
*xguiphot*SimpleMenu.line16.foreground:		gray91
*xguiphot*SimpleMenu.line17.foreground:		gray71
*xguiphot*SimpleMenu.line18.foreground:		gray91
*xguiphot*SimpleMenu.line19.foreground:		gray71
*xguiphot*SimpleMenu.line20.foreground:		gray91
*xguiphot*SimpleMenu.line21.foreground:		gray71
*xguiphot*SimpleMenu.line22.foreground:		gray91

*xguiphot*MenuButton.font:                      7x13bold
*xguiphot*Command.font:                         7x13bold
*xguiphot*Label.font:                           7x13bold
*xguiphot*MultiList*font:                       7x13bold
*xguiphot*Text*font:                            7x13bold
*xguiphot*Group.font:	                        7x13bold

*xguiphot*SimpleMenu*font:                      7x13bold
*xguiphot*SmeBSB*font:                          7x13bold
*xguiphot*SmeBSB*vertSpace:                     0

*xguiphot*allowShellResize:			True
*xguiphot*Label.shadowWidth:			0

!*xguiphot*basePixel:                            128
!*xguiphot*maxColors:                            100
!*xguiphot*cmapInitialize:                       True
*xguiphot*beNiceToColormap:                           True

!* RESOURCES FOR THE IMAGE DISPLAY TOPLEVEL SHELL

*imageLayout*borderWidth:                    0
*imageLayout*highlightThickness:             0
*imageLayout*background:                     gray81
*imageLayout*Group.outerOffset:              0
*imageLayout*Group.innerOffset:              0
*imageLayout*Group.shrinkToFit:              True
*imageLayout*Group.frameType:                chiseled
*imageLayout*Group.frameWidth:               2
*imageLayout*Frame*frameType:                chiseled
*imageLayout*Frame*background:               gray81
*imageLayout*Frame*frameWidth:               2
*imageLayout*Command.highlightThickness:     2
*imageLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        imbtn1Group < +inf -inf * > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        imviewFrame < +inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*imbtn1Group.label:
*imageLayout*imbtn1Layout*MenuButton.internalHeight: 3
*imageLayout*imbtn1Layout*MenuButton.internalWidth:  4
*imageLayout*imbtn1Layout*MenuButton.background:     gray81
*imageLayout*imbtn1Layout*Command.internalHeight:    3
*imageLayout*imbtn1Layout*Command.internalWidth:     4
*imageLayout*imbtn1Layout*Command.background:        gray81
*imbtn1Layout.layout: horizontal { \
    5 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        imagefilesButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        imageviewButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        imagefindButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        imageobjectsButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        imagephotButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        imageresultsButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        imageparametersButton < * > \
        4 < +0 -4 > \
    } \
    50 < +inf -inf > \
    vertical { \
        4 < +0 -4 > \
        imagehelpButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        imagequitButton < * > \
        4 < +0 -4 > \
    } \
    5 < +0 -0 > \
}

*imagefilesButton.label:                        Files
*imagefilesButton.menuName:                     filesMenu
*imageviewButton.label:                         Images
*imageviewButton.menuName:                      imviewMenu
*imagefindButton.label:                         Lists
*imagefindButton.menuName:                      imfindMenu
*imageobjectsButton.label:                      Edit
*imageobjectsButton.menuName:                   objectsMenu
*imagephotButton.label:                         Phot
*imagephotButton.menuName:                      photMenu
*imageresultsButton.label:                      Results
*imageresultsButton.menuName:                   resultsMenu
*imageparametersButton.label:                   Psets
*imageparametersButton.menuName:                parametersMenu
*imagehelpButton.label:                         Help
*imagequitButton.label:                         Quit

*imageLayout*imviewFrame.innerOffset:           5
*imagedisplayWindow.cmapName:                   image
*imagedisplayWindow.width:                      512
*imagedisplayWindow.height:                     512
*imagedisplayWindow.borderColor:                black
!*imagedisplayWindow.resizable:                  True
*imagedisplayWindow.copyOnResize:               False
*imagedisplayWindow.ginmodeCursor:              circle
*imagedisplayWindow.dialogBgColor:              cyan
*imagedisplayWindow.dialogFont1:                6x13
*imagedisplayWindow.dialogFont2:                6x13
*imagedisplayWindow.dialogFont3:                6x13
*imagedisplayWindow.dialogFont4:                6x13
*imagedisplayWindow.dialogFont5:                6x13
*imagedisplayWindow.dialogFont6:                6x13
*imagedisplayWindow.dialogFont7:                6x13
*imagedisplayWindow.dialogFont8:                6x13
*imagedisplayWindow.alphaFont1:                 6x13
*imagedisplayWindow.alphaFont2:                 6x13
*imagedisplayWindow.alphaFont3:                 6x13
*imagedisplayWindow.alphaFont4:                 6x13
*imagedisplayWindow.alphaFont5:                 6x13
*imagedisplayWindow.alphaFont6:                 6x13
*imagedisplayWindow.alphaFont7:                 6x13
*imagedisplayWindow.alphaFont8:                 6x13
*imagedisplayWindow.color2:                     red
*imagedisplayWindow.color3:                     green
*imagedisplayWindow.color4:                     blue
*imagedisplayWindow.color6:                     yellow
*imagedisplayWindow.dialogFgColor:              black
*imagedisplayWindow.crosshairCursorColor:       red
*imagedisplayWindow.translations: \
            <Btn1Down>:      popup(displayMenu)           \n\
              <Btn1Up>:      popdown(displayMenu)         \n\
      !Ctrl <Btn2Down>:      call(zoom,$x,$y,0)           \n\
     !Shift <Btn2Down>:      call(zoom,$x,$y,-1)          \n\
           !<Btn2Down>:      call(zoom,$x,$y,1)           \n\
          <Btn3Motion>:      call(windowColormap,$x,$y)   \n\
         <EnterWindow>:      enter-window()               \n\
         <LeaveWindow>:      leave-window()               \n\
  	       :<Key>i:      graphics-input() \
	                         call(resetAllmarkers)    \n\
  	       :<Key>Z:      call(kresetAllmarkers,Z)     \n\
  	       :<Key>P:      call(kresetAllmarkers,P)     \n\
  	       :<Key>X:      call(kresetAllmarkers,X)     \n\
  	       :<Key>Y:      call(kresetAllmarkers,Y)     \n\
  	       :<Key>R:      call(kresetAllmarkers,R)     \n\
  	       :<Key>0:      call(kresetAllmarkers,0)     \n\
  	       :<Key>1:      call(kresetAllmarkers,1)     \n\
  	       :<Key>2:      call(kresetAllmarkers,2)     \n\
  	       :<Key>3:      call(kresetAllmarkers,3)     \n\
  	       :<Key>4:      call(kresetAllmarkers,4)     \n\
  	       :<Key>5:      call(kresetAllmarkers,5)     \n\
  	       :<Key>6:      call(kresetAllmarkers,6)     \n\
  	       :<Key>7:      call(kresetAllmarkers,7)     \n\
  	       :<Key>8:      call(kresetAllmarkers,8)     \n\
  	       :<Key>9:      call(kresetAllmarkers,9)     \n\
  	       :<Key>M:      call(kresetAllmarkers,M)     \n\
  	       :<Key>E:      call(kresetAllmarkers,E)     \n\
  	      :<Key>\<:      call(kresetAllmarkers,<)     \n\
  	      :<Key>\>:      call(kresetAllmarkers,>)     \n\
            <KeyPress>:      graphics-input()             \n\
              <Motion>:      track-cursor() call(coordsUpdate,$x,$y)

!* XGUIPHOT_HELP PANEL RESOURCES

*helpLayout*borderWidth:                  	0
*helpLayout.background:                   	gray81
*helpLayout*Frame*frameType:              	sunken
*helpLayout*Frame*frameWidth:             	2
*helpLayout*Frame.background:             	gray81
*helpLayout*Layout.background:            	gray81
*helpLayout*ScrollbarBackground:          	#c0c0c0
*helpLayout*Scrollbar*background:         	#c0c0c0
*helpLayout*Scrollbar*width:              	17
*helpLayout*Scrollbar*height:             	17
*helpLayout*Scrollbar*shadowWidth:        	2
*helpLayout*Scrollbar*cursorName:         	top_left_arrow
*helpLayout*Scrollbar*pushThumb:          	true

*helpLayout.layout: vertical { \
    -1 \
    horizontal { \
        0 < +0 -0 > \
        helpMenuLayout < +inf -inf * > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        helpTextFrame < +inf -inf * +inf -inf > \
        0 \
    } \
    -1 \
}
*helptext*background:                       	white
*helptext*foreground:                       	black

*helpMenuLayout*background:                 	gray81
*helpMenuLayout*Command.highlightThickness: 	2
*helpMenuLayout*Command.internalHeight:     	2
*helpMenuLayout*Command.font:       -*-helvetica-bold-r-normal-*-12-*-*-*
*helpMenuLayout.layout: vertical { \
    5 \
    horizontal { \
        5 < +0 -5 > \
        helpBack \
        2 < +0 -2 > \
        helpForward \
        2 < +0 -2 > \
        helpHome \
        2 < +0 -2 > \
        helpToc \
        20 < +inf -20 > \
        helpReset \
        20 < +inf -20 > \
        helpHelp \
        2 < +0 -2 > \
        helpClose \
        5 < +0 -5 > \
    } \
    5 \
}
*helpBack.label:                            	Back
*helpBack.sensitive:                        	False
*helpForward.label:                         	Forward
*helpForward.sensitive:                     	False
*helpToc.label:                            	TOC
*helpHome.label:                            	Home
*helpReset.label:                            	Reset
*helpHelp.label:                            	Help
*helpClose.label:                           	Dismiss

*helpText.width:                                450
*helpText.height:                               500
*helpText.anchorUnderlines:                     1
*helpText.visitedAnchorUnderlines:              1
*helpText.verticalScrollOnRight:                true
*helpText.plainFont:                            6x13


!* XGUIPHOT_TUTORIAL PANEL RESOURCES

*tutLayout*borderWidth:                  	0
*tutLayout.background:                   	gray81
*tutLayout*Frame*frameType:              	sunken
*tutLayout*Frame*frameWidth:             	2
*tutLayout*Frame.background:             	gray81
*tutLayout*Layout.background:            	gray81
*tutLayout*ScrollbarBackground:          	#c0c0c0
*tutLayout*Scrollbar*background:         	#c0c0c0
*tutLayout*Scrollbar*width:              	17
*tutLayout*Scrollbar*height:             	17
*tutLayout*Scrollbar*shadowWidth:        	2
*tutLayout*Scrollbar*cursorName:         	top_left_arrow
*tutLayout*Scrollbar*pushThumb:          	true

*tutLayout.layout: vertical { \
    -1 \
    horizontal { \
        0 < +0 -0 > \
        tutTextFrame < +inf -inf * +inf -inf > \
        0 \
    } \
    -1 \
}
*tuttext*background:                       	white
*tuttext*foreground:                       	black

*tutText.width:                                450
*tutText.height:                               500
*tutText.anchorUnderlines:                     1
*tutText.visitedAnchorUnderlines:              1
*tutText.verticalScrollOnRight:                true
*tutText.plainFont:                            6x13


!* XGUIPHOT_FILES PANEL RESOURCES

*xguiphot_files.geometry:			420x600
*filesLayout*borderWidth:			0
*filesLayout*highlightThickness:		0
*filesLayout*background:			gray81
*filesLayout*Group.frameWidth:			2
*filesLayout*Group.outerOffset:			7
*filesLayout*Group.shrinkToFit:			True
*filesLayout*Group.frameType:			chiseled
*filesLayout*Frame*frameType:			sunken
*filesLayout*Frame*frameWidth:			2
*filesLayout*Text*background:			gray71
*filesLayout*Command.highlightThickness: 	2	
*filesLayout*Scrollbar2*background:		gray71
*filesLayout*scrollbarForeground:		gray81
*filesLayout*Scrollbar2*location:		0 0 20 10
*filesLayout*Scrollbar2*vertical:		True
*filesLayout*Scrollbar2*minsize:		20
*filesLayout*MultiList*background:		gray71
*filesLayout*MultiList*shadeSurplus:		False
*filesLayout*MultiList*highlightForeground:	gray71
*filesLayout*List*forceColumns:			True
*filesLayout*List*defaultColumns:		1

*filesLayout.layout: vertical { \
    7 < +0 -7 > \
    horizontal { \
	0 < +0 -0 > \
	curdirGroup < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	imagesGroup < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	objectsGroup < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	fresultsGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	fbuttonsLayout < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*curdirGroup.label:				Current Directory Listing
*curdirLayout.layout: vertical { \
    10 < +0 -10 > \
    horizontal { \
	5 < +0 -5 > \
	curdirLabel < * > \
	5 < +0 -5 > \
	curdirFrame < +inf -inf  * > \
	5 < +0 -5 > \
    } \
    10 < +0 -10 > \
    horizontal { \
	5 < +0 -5 > \
	    dirlistScrollbar < * +inf - inf > \
	3 < +0 -3 > \
	    dirlistFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    5 < +0 -5 > \
}
*curdirLabel.label:				\ Current dir:
*curdirText*editType:    			edit
*curdirText*string:			
*curdirText*displayCaret:			False
*curdirText*width:          			30
*dirList.width:					100
*dirList.height:				78

*imagesGroup.label:				Input Images
*imagesLayout.layout: vertical { \
    10 < +0 -10 > \
    horizontal { \
	5 < +0 -5 > \
	imdirLabel < * > \
	5 < +0 -5 > \
	imdirFrame < +inf -inf  * > \
	5 < +0 -5 > \
	imtemplateLabel < * > \
	5 < +0 -5 > \
	imtemplateFrame <+inf -inf  * > \
	5 < +0 -5 > \
    } \
    10 < +0 -10 > \
    horizontal { \
	5 < +0 -5 > \
	    imlistScrollbar < * +inf - inf > \
	3 < +0 -3 > \
	    imlistFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    5 < +0 -5 > \
}
*imdirLabel.label:				\ Dir:
*imdirText*editType:    			edit
*imdirText*string:			
*imdirText*displayCaret:			False
*imdirText*width:          			30
*imtemplateLabel.label:				Images:
*imtemplateText*editType:			edit
*imtemplateText*string:				*.fits
*imtemplateText*displayCaret:			False
*imageList.width:				100
*imageList.height:				78

*objectsGroup.label:				Input Objects Files
*objectsLayout.layout: vertical { \
    10 < +0 -10 > \
    horizontal { \
	5 < +0 -5 > \
	ofdirLabel < * > \
	5 < +0 -5 > \
	ofdirFrame <+inf -inf  * > \
	5 < +0 -5 > \
	oftemplateLabel < * > \
	5 < +0 -5 > \
	oftemplateFrame <+inf -inf  * > \
	5 < +0 -5 > \
    } \
    10 < +0 -10 > \
    horizontal { \
	5 < +0 -5 > \
	    objectsScrollbar < * +inf - inf > \
	3 < +0 -3 > \
	    objectsFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    5 < +0 -5 > \
}
*ofdirLabel.label:				\ Dir:
*ofdirText*editType:      			edit
*ofdirText*string:
*ofdirText*displayCaret:			False
*ofdirText*width:	         		30
*oftemplateLabel.label:				Objects:
*oftemplateText*editType:			edit
*oftemplateText*string:				default
*oftemplateText*displayCaret:			False
*objectsList.width:				100
*objectsList.height:				78

*fresultsGroup.label:				Output Results Files
*fresultsLayout.layout: vertical { \
    10 < +0 -10 > \
    horizontal { \
	5 < +0 -5 > \
	rflogLabel < +inf -inf * > \
	5 < +0 -5 > \
	rflogButton < * > \
	5 < +0 -5 > \
    } \
    10 < +0 -10 > \
    horizontal { \
	5 < +0 -5 > \
	rfdirLabel < * > \
	5 < +0 -5 > \
	rfdirFrame <+inf -inf  * > \
	5 < +0 -5 > \
	gfdirLabel < * > \
	5 < +0 -5 > \
	gfdirFrame <+inf -inf  * > \
	5 < +0 -5 > \
    } \
    10 < +0 -10 > \
    horizontal { \
	5 < +0 -5 > \
	rftemplateLabel < * > \
	5 < +0 -5 > \
	rftemplateFrame <+inf -inf  * > \
	5 < +0 -5 > \
	gftemplateLabel < * > \
	5 < +0 -5 > \
	gftemplateFrame <+inf -inf  * > \
	5 < +0 -5 > \
    } \
    10 < +0 -10 > \
    horizontal { \
	5 < +0 -5 > \
	fresultsFrame <+inf -inf * > \
	5 < +0 -5 > \
	frobjectsFrame <+inf -inf * > \
	5 < +0 -5 > \
    } \
    5 < +0 -5 > \
}

*rflogLabel.label:                              Log results:
*rflogLabel.justify:                            Right
*rflogButton.label:                             Yes
*rflogButton.justify:                           Left
*rfdirLabel.label:				\ Dir:
*rfdirText*editType:       			edit
*rfdirText*string:				
*rfdirText*displayCaret:			False
*rftemplateLabel.label:				\ Results:
*rftemplateText*editType:			edit
*rftemplateText*string:				default
*rftemplateText*displayCaret:			False
*gfdirLabel.label:				\ Dir:
*gfdirText*editType:     			edit
*gfdirText*string:			
*gfdirText*displayCaret:			False
*gftemplateLabel.label:				Robjects:
*gftemplateText*editType:			edit
*gftemplateText*string:				
*gftemplateText*displayCaret:			False
*fresultsText*editType:  			read
*fresultsText*string:				
*fresultsText*displayCaret:			False
*frobjectsText*editType:  			read
*frobjectsText*string:				
*frobjectsText*displayCaret:			False

*fbuttonsGroup.label:
*fbuttonsLayout.layout: horizontal { \
    7 < +0 -7 > \
    vertical { \
	0 < +0 -0 > \
	filesApplyButton < * > \
	7 < +0 -7 > \
    } \
    0 < +0 -0 > \
    vertical { \
	0 < +0 -0 > \
	filesCancelButton < * > \
	7 < +0 -7 > \
    } \
    0 < +0 -0 > \
    vertical { \
	0 < +0 -0 > \
	filesDefaultsButton < * > \
	7 < +0 -7 > \
    } \
    25 < +inf -25 > \
    vertical { \
	0 < +0 -0 > \
	filesHelpButton < * > \
	7 < +0 -7 > \
    } \
    0 < +0 -0 > \
    vertical { \
	0 < +0 -0 > \
	filesCloseButton < * > \
	7 < +0 -7 > \
    } \
    7 < +0 -7 > \
}
*filesApplyButton.label:			Apply
*filesCancelButton.label:			Cancel
*filesDefaultsButton.label:			Defaults
*filesHelpButton.sensitive:			True
*filesHelpButton.label:				Help
*filesCloseButton.label:			Dismiss


!* RESOURCES FOR THE DISPLAYPARS TOPLEVEL SHELL

*xguiphot_dispars.geometry:                 	530x510
*disparsLayout*borderWidth:               	0
*disparsLayout*highlightThickness:        	0
*disparsLayout*background:                	gray81
*disparsLayout*Group.outerOffset:         	0
*disparsLayout*Group.shrinkToFit:         	True
*disparsLayout*Group.frameType:           	chiseled
*disparsLayout*Group.frameWidth:          	2
*disparsLayout*Frame*frameType:           	sunken
*disparsLayout*Frame.frameWidth:          	1
*disparsLayout*Text*background:           	gray71
*disparsLayout*Text*editType:    	      	edit
*disparsLayout*Text*displayCaret:	      	False
*disparsLayout*Command.highlightThickness: 	2
*disparsLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        dptitleGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    14 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        dpparsGroup1 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        dpparsGroup2 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    7 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        dpbuttonsGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}
*dptitleGroup.label:
*disparsLayout*dptitleGroup.background:  	gray71
*disparsLayout*dptitleGroup.innerOffset:	0
*dpTitle.label:					Image Display Parameters
*disparsLayout*dpTitle.background:		gray71
*dpTitle.internalHeight:			10

*dpparsGroup1.label:				Geometry Parameters
*disparsLayout*dpparsGroup1.outerOffset:	7
*dpparsLayout1.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	dpparsLayout11 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	dpparsLayout12 <+inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	dpparsLayout13 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*dpparsLayout11.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	deraseName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dfillName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dxviewportName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dyviewportName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dxmagName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dymagName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*dpparsLayout12.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	deraseFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dfillFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dxviewportFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dyviewportFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dxmagFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dymagFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*dpparsLayout13.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	deraseName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dfillName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dxviewportName2 <  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dyviewportName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dxmagName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dymagName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}
*disparsLayout*dpparsLayout1*Command.background:	gray71
*disparsLayout*dpparsLayout1*Command.shadowWidth:	0
*disparsLayout*dpparsLayout1*Command.justify:   	left
*dpparsLayout11*Label.justify:				right
*dpparsLayout13*Label.justify:				left

*deraseName.label:             	 Erase previous frame:
*deraseValue.label:              yes
*deraseName2.label:              (derase)
*dfillName.label:                Scale image to fit window:
*dfillValue.label:               yes
*dfillName2.label:               (dfill)
*dxviewportName.label:           Horizontal size of image window:
*dxviewportValue*string:         1.0
*dxviewportName2.label:          (dxviewport)\ 
*dyviewportName.label:           Vertical size of image window:
*dyviewportValue*string:         1.0
*dyviewportName2.label:          (dyviewport)
*dxmagName.label:                Horizontal image magnification:
*dxmagValue*string:              1.0
*dxmagName2.label:               (dxmag)
*dymagName.label:                Vertical image magnification:
*dymagValue*string:              1.0
*dymagName2.label:               (dymag)

*dpparsGroup2.label:				Greylevel Parameters
*disparsLayout*dpparsGroup2.outerOffset:	7
*dpparsLayout2.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	dpparsLayout21 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	dpparsLayout22 <+inf -inf  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	dpparsLayout23 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*dpparsLayout21.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	dztransformName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dzlimitsName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dzcontrastName <+inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dznsampleName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dz1Name < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dz2Name < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dlutfileName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	drepeatName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*dpparsLayout22.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	dztransformFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dzlimitsFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dzcontrastFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dznsampleFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dz1Frame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dz2Frame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dlutfileFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	drepeatFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*dpparsLayout23.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	dztransformName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dzlimitsName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dzcontrastName2 <+inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dznsampleName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dz1Name2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dz2Name2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	dlutfileName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	drepeatName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*disparsLayout*dpparsLayout2*Command.background:		gray71
*disparsLayout*dpparsLayout2*Command.shadowWidth:		0
*disparsLayout*dpparsLayout2*Command.justify:		        left
*disparsLayout*dpparsLayout2*MenuButton.background:		gray71
*disparsLayout*dpparsLayout2*MenuButton.justify:		left
*disparsLayout*dpparsLayout2*MenuButton.shadowWidth:	        0
*dpparsLayout21*Label.justify:					right
*dpparsLayout23*Label.justify:					left

*dztransformName.label:		Image greylevel transformation:
*dztransformValue.menuName:	dztransformMenu
*dztransformValue.label:	linear
*dztransformValue.translations:				\
    <EnterWindow>:      	highlight()		\n\
    <LeaveWindow>:      	reset()			\n\
       <Btn1Down>:		popup(dztransformMenu)	\n\
         <Btn1Up>:		popdown(dztransformMenu)
*dztransformName2.label:	(dztransform)
*dzlimitsName.label:		Image greylevel limits:
*dzlimitsValue.menuName:	dzlimitsMenu
*dzlimitsValue.label:		median
*dzlimitsValue.translations:				\
    <EnterWindow>:      	highlight()		\n\
    <LeaveWindow>:      	reset()			\n\
       <Btn1Down>:		popup(dzlimitsMenu)	\n\
         <Btn1Up>:		popdown(dzlimitsMenu)
*dzlimitsName2.label:		(dzlimits)
*dzcontrastName.label:		Image constrast adjustment:
*dzcontrastValue*string:	0.25
*dzcontrastName2.label:		(dzcontrast)
*dznsampleName.label:		Number of image sample lines:
*dznsampleValue*string:		5
*dznsampleName2.label:		(dznsample)
*dz1Name.label:			Minimum image greylevel:
*dz1Value*string:		INDEF
*dz1Name2.label:		(dz1)
*dz2Name.label:			Maximum image greylevel:
*dz2Value*string:		INDEF
*dz2Name2.label:		(dz2)
*dlutfileName.label:		User lookup table:
*dlutfileValue*string:
*dlutfileName2.label:		(dlutfile)
*drepeatName.label:		Use previous display parameters:
*drepeatValue.label:		no
*drepeatName2.label:		(drepeat)

*dpbuttonsGroup.label:
*disparsLayout*dpbuttonsGroup.innerOffset: 			0
*disparsLayout*dpbuttonsLayout.background: 			gray71
*disparsLayout*dpbuttonsLayout*Command.internalHeight:	3
*disparsLayout*dpbuttonsLayout*Command.internalWidth:	4
*dpbuttonsLayout.layout: horizontal { \
    10 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	disparsUpdateButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	disparsRestoreButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	disparsDefaultsButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	disparsSaveButton < * > \
	6 < +0 -6 > \
    } \
    50 < +inf -50> \
    vertical { \
	6 < +0 -6 > \
	disparsDisplayButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	disparsHelpButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	disparsCloseButton < * > \
	6 < +0 -6 > \
    } \
    10 < +0 -0 > \
}

*disparsUpdateButton.label:		Apply
*disparsRestoreButton.label:		Cancel
*disparsDefaultsButton.label:		Unlearn
*disparsSaveButton.label:		Update
*disparsDisplayButton.label:		Display
*disparsHelpButton.label:		Help
*disparsHelpButton.sensitive:		True
*disparsCloseButton.label:		Dismiss


!* RESOURCES FOR THE IMAGE DISPLAY HEADER SHELL

*xguiphot_imheader.geometry:			600x300
*imheaderLayout*borderWidth:			0
*imheaderLayout*highlightThickness:		0
*imheaderLayout*background:			gray81
*imheaderLayout*Group.outerOffset:		0
*imheaderLayout*Group.innerOffset:		0
*imheaderLayout*Group.shrinkToFit:		True
*imheaderLayout*Group.frameType:		chiseled
*imheaderLayout*Group.frameWidth:		2
*imheaderLayout*Frame*frameType:		sunken
*imheaderLayout*Frame*frameWidth:		2
*imheaderLayout*Command.highlightThickness: 	2	

*imheaderLayout*scrollbarForeground:		gray81
*imheaderLayout*Scrollbar2*minsize:		20
*hdrScrollbarv.location:			0 0 20 10
*hdrScrollbarv.vertical:			True
*hdrScrollbarh.location:			0 0 100 20
*hdrScrollbarh.vertical:			False
*imheaderLayout*MultiList*background:		white
*imheaderLayout*MultiList*shadeSurplus:		False
*imheaderLayout*MultiList*maxSelectable:	0

*imheaderLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	hdrtitleGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	hdrGroup < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	hdrbuttonsGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}
*hdrtitleGroup.label:
*hdrTitle.label:                                   Header for Image:
*hdrTitle.internalHeight:                          10

*hdrGroup.label:
*headerLayout.layout: vertical { \
    15 < +0 -0 > \
    horizontal { \
	10 < +0 -0 > \
	    hdrScrollbarv < * +inf - inf > \
	5 < +0 -5 > \
	    hdrFrame < +inf -inf * +inf -inf > \
	15 < +0 -0 > \
    } \
    5 < +0 -5> \
    horizontal { \
	35 < +0 -0 > \
	    hdrScrollbarh < +inf - inf * > \
	15 < +0 -0 > \
    } \
    10 < +0 -0 > \
}
*hdrList*width:					100
*hdrList*height:				78

*hdrbuttonsGroup.label:
*imheaderLayout*hdrbuttonsLayout*Command.internalHeight:	3
*imheaderLayout*hdrbuttonsLayout*Command.internalWidth:		4
*imheaderLayout*hdrbuttonsLayout*Command.background:		gray81
*hdrbuttonsLayout.layout: horizontal { \
    50 < +inf -50 > \
    vertical { \
	4 < +0 -4 > \
	imheadernextButton < * > \
	4 < +0 -4 > \
    } \
    3 < +0 -3 > \
    vertical { \
	4 < +0 -4 > \
	imheaderprevButton < * > \
	4 < +0 -4 > \
    } \
    3 < +0 -3 > \
    vertical { \
	4 < +0 -4 > \
	imheaderhelpButton < * > \
	4 < +0 -4 > \
    } \
    3 < +0 -3 > \
    vertical { \
	4 < +0 -4 > \
	imheadercloseButton < * > \
	4 < +0 -4 > \
    } \
    15 < +0 -0 > \
}

*imheadernextButton.label:			Next
*imheaderprevButton.label:			Prev
*imheaderhelpButton.sensitive:			True
*imheaderhelpButton.label:			Help
*imheadercloseButton.label:			Dismiss

!* RESOURCES FOR THE IMAGE DISPLAY HEADER SHELL

*xguiphot_objmodel.geometry:			640x340
*objmodelLayout*borderWidth:                    0
*objmodelLayout*highlightThickness:             0
*objmodelLayout*background:                     gray81
*objmodelLayout*Group.outerOffset:              0
*objmodelLayout*Group.innerOffset:              0
*objmodelLayout*Group.shrinkToFit:              True
*objmodelLayout*Group.frameType:                chiseled
*objmodelLayout*Group.frameWidth:               2
*objmodelLayout*Frame*frameType:                chiseled
*objmodelLayout*Frame*background:               gray81
*objmodelLayout*Frame*frameWidth:               2
*objmodelLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        objmodelFrame < +inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        objmodelGroup < +inf -inf * > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*objmodelFrame.innerOffset:			   5

*objmodelWindow.width:                             620
*objmodelWindow.height:                            320
!*objmodelWindow.resizable:                         True
*objmodelWindow.color9:                            gray71
*objmodelWindow.color8:                            black
*objmodelWindow.copyOnResize:                      False
*objmodelWindow.sensitive:                         False
*objmodelWindow.ginmodeCursor:                     full_crosshair
*objmodelWindow.dialogBgColor:                     cyan

*objmodelGroup.label:
*objmodelLayout*objmodelbtnLayout*Command.internalHeight:    3
*objmodelLayout*objmodelbtnLayout*Command.internalWidth:     4
*objmodelLayout*objmodelbtnLayout*Command.background:        gray81
*objmodelbtnLayout.layout: horizontal { \
    5 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        objmodelactivateButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        objmodelsetwidthButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        objmodelrefitButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        objmodelreplotButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        objmodelresultsButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        objmodelmomentsButton < * > \
        4 < +0 -4 > \
    } \
    50 < +inf -inf > \
    vertical { \
        4 < +0 -4 > \
        objmodelhelpButton < * > \
        4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
        4 < +0 -4 > \
        objmodelcloseButton < * > \
        4 < +0 -4 > \
    } \
    5 < +0 -0 > \
}

*objmodelactivateButton.label:                     Activate
*objmodelsetwidthButton.label:                     Setwidth
*objmodelsetwidthButton.sensitive:                 False
*objmodelrefitButton.label:                        Refit
*objmodelrefitButton.sensitive:                    False
*objmodelreplotButton.label:                       Replot
*objmodelreplotButton.sensitive:                   False
*objmodelresultsButton.label:                      Results
*objmodelresultsButton.sensitive:                  False
*objmodelmomentsButton.label:                      Moments
*objmodelmomentsButton.sensitive:                  False

*objmodelhelpButton.label:                         Help
*objmodelhelpButton.sensitive:                     True
*objmodelcloseButton.label:                        Dismiss 

!* RESOURCES FOR THE OBJPARS TOPLEVEL SHELL

*xguiphot_omarkpars.geometry:                 	530x320
*omarkparsLayout*borderWidth:               	0
*omarkparsLayout*highlightThickness:        	0
*omarkparsLayout*background:                	gray81
*omarkparsLayout*Group.outerOffset:         	0
*omarkparsLayout*Group.shrinkToFit:         	True
*omarkparsLayout*Group.frameType:           	chiseled
*omarkparsLayout*Group.frameWidth:          	2
*omarkparsLayout*Frame*frameType:           	sunken
*omarkparsLayout*Frame.frameWidth:          	1
*omarkparsLayout*Text*background:           	gray71
*omarkparsLayout*Text*editType:	      		edit
*omarkparsLayout*Command.highlightThickness: 	2
*omarkparsLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        objtitleGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    14 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        omarkparsGroup1 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    7 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        objbuttonsGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}
*objtitleGroup.label:
*omarkparsLayout*objtitleGroup.background:	gray71
*omarkparsLayout*objtitleGroup.innerOffset:	0
*objTitle.label:				Object Marking Parameters
*omarkparsLayout*objTitle.background:		gray71
*objTitle.internalHeight:			10

*omarkparsGroup1.label:				
*omarkparsLayout*omarkparsGroup1.outerOffset:	7
*omarkparsLayout1.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	omarkparsLayout11 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	omarkparsLayout12 < +inf -inf  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	omarkparsLayout13 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*omarkparsLayout11.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	objmarkName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	otoleranceName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ocharmarkName <+inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	onumberName <+inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	opcolormarkName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	oscolormarkName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	osizemarkName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*omarkparsLayout12.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	objmarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	otoleranceFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ocharmarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	onumberFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	opcolormarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	oscolormarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	osizemarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*omarkparsLayout13.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	objmarkName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	otoleranceName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ocharmarkName2 <+inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	onumberName2 <+inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	opcolormarkName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	oscolormarkName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	osizemarkName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*omarkparsLayout*omarkparsLayout1*Command.background:	gray71
*omarkparsLayout*omarkparsLayout1*Command.shadowWidth:	0
*omarkparsLayout*omarkparsLayout1*Command.justify:		left
*omarkparsLayout*omarkparsLayout1*MenuButton.background:	gray71
*omarkparsLayout*omarkparsLayout1*MenuButton.justify:	left
*omarkparsLayout*omarkparsLayout1*MenuButton.shadowWidth: 	0
*omarkparsLayout11*Label.justify:				right
*omarkparsLayout13*Label.justify:				left

*objmarkName.label:		Mark the object positions:
*objmarkValue.label:		yes
*objmarkName2.label:		(objmark)
*otoleranceName.label:		The object matching tolerance:
*otoleranceValue*string:	5.0
*otoleranceName2.label:		(otolerance)
*ocharmarkName.label:           The object marker character:
*ocharmarkValue.menuName:	ocharmarkMenu
*ocharmarkValue.label:		plus
*ocharmarkValue.translations:				\
    <EnterWindow>:      	highlight()		\n\
    <LeaveWindow>:      	reset()			\n\
       <Btn1Down>:      	popup(ocharmarkMenu)	\n\
         <Btn1Up>:      	popdown(ocharmarkMenu)
*ocharmarkName2.label:          (ocharmark)
*onumberName.label:		Number the marked objects: 
*onumberValue.label:		no
*onumberName2.label:		(onumber)
*opcolormarkName.label:		The object marker color:
*opcolormarkValue.menuName:	opcolormarkMenu
*opcolormarkValue.label:	green
*opcolormarkValue.translations:				\
    <EnterWindow>:      	highlight()		\n\
    <LeaveWindow>:      	reset()			\n\
       <Btn1Down>:      	popup(opcolormarkMenu)	\n\
         <Btn1Up>:      	popdown(opcolormarkMenu)
*opcolormarkMenu.item1.foreground:			red
*opcolormarkMenu.item2.foreground:			blue
*opcolormarkMenu.item3.foreground:			green
*opcolormarkMenu.item4.foreground:			yellow
*opcolormarkName2.label:	(opcolormark)
*oscolormarkName.label:		The sky marker color:
*oscolormarkValue.menuName:	oscolormarkMenu
*oscolormarkValue.label:	blue
*oscolormarkValue.translations:				\
    <EnterWindow>:		highlight()		\n\
    <LeaveWindow>:      	reset()			\n\
       <Btn1Down>:      	popup(oscolormarkMenu)	\n\
         <Btn1Up>:      	popdown(oscolormarkMenu)
*oscolormarkMenu.item1.foreground:			red
*oscolormarkMenu.item2.foreground:			blue
*oscolormarkMenu.item3.foreground:			green
*oscolormarkMenu.item4.foreground:			yellow
*oscolormarkName2.label:	(oscolormark)
*osizemarkName.label:		The marker size:
*osizemarkValue*string:		5.0
*osizemarkName2.label:		(osizemark)

*objbuttonsGroup.label:
*omarkparsLayout*objbuttonsGroup.innerOffset: 		0
*omarkparsLayout*objbuttonsLayout.background: 		gray71
*omarkparsLayout*objbuttonsLayout*Command.internalHeight:	3
*omarkparsLayout*objbuttonsLayout*Command.internalWidth:	4
*objbuttonsLayout.layout: horizontal { \
    10 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	omarkparsUpdateButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	omarkparsRestoreButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	omarkparsDefaultsButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	omarkparsSaveButton < * > \
	6 < +0 -6 > \
    } \
    50 < +inf -50> \
    vertical { \
	6 < +0 -6 > \
	omarkparsMarkButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	omarkparsEraseButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	omarkparsHelpButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	omarkparsCloseButton < * > \
	6 < +0 -6 > \
    } \
    10 < +0 -0 > \
}

*omarkparsUpdateButton.label:		Apply
*omarkparsRestoreButton.label:		Cancel
*omarkparsDefaultsButton.label:		Unlearn
*omarkparsSaveButton.label:		Update
*omarkparsMarkButton.label:		Show
*omarkparsEraseButton.label:		Erase
*omarkparsHelpButton.label:		Help
*omarkparsHelpButton.sensitive:		True
*omarkparsCloseButton.label:		Dismiss


!* XGUIPHOT_IMPARS PANEL RESOURCES

*xguiphot_impars.geometry:                 	530x640
*imparsLayout*borderWidth:               	0
*imparsLayout*highlightThickness:        	0
*imparsLayout*background:                	gray81
*imparsLayout*Group.outerOffset:         	0
*imparsLayout*Group.shrinkToFit:         	True
*imparsLayout*Group.frameType:           	chiseled
*imparsLayout*Group.frameWidth:          	2
*imparsLayout*Frame*frameType:           	sunken
*imparsLayout*Frame.frameWidth:          	1
*imparsLayout*Text*background:           	gray71
*imparsLayout*Text*editType:	      		edit
*imparsLayout*Command.highlightThickness: 	2
*imparsLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        imptitleGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    14 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        imparsGroup1 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        imparsGroup2 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        imparsGroup3 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    7 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        impbuttonsGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}
*imptitleGroup.label:
*imparsLayout*imptitleGroup.background:		gray71
*imparsLayout*imptitleGroup.innerOffset:	0
*impTitle.label:				Data Dependent Parameters
*imparsLayout*impTitle.background:		gray71
*impTitle.internalHeight:			10

*imparsGroup1.label:				Image Parameters
*imparsLayout*imparsGroup1.outerOffset:		7
*imparsLayout1.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	imparsLayout11 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	imparsLayout12 <+inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	imparsLayout13 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*imparsLayout11.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	iscaleName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ihwhmpsfName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iemissionName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iskysigmaName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	imindataName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	imaxdataName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*imparsLayout12.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	iscaleFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ihwhmpsfFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iemissionFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iskysigmaFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	imindataFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	imaxdataFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*imparsLayout13.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	iscaleName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ihwhmpsfName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iemissionName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iskysigmaName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	imindataName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	imaxdataName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*imparsLayout*imparsLayout1*MenuButton.background:	gray71
*imparsLayout*imparsLayout1*MenuButton.justify:		left
*imparsLayout*imparsLayout1*MenuButton.shadowWidth:	0
*imparsLayout*imparsLayout1*Command.background:		gray71
*imparsLayout*imparsLayout1*Command.shadowWidth:	0
*imparsLayout*imparsLayout1*Command.justify:		left
*imparsLayout11*Label.justify:				right
*imparsLayout13*Label.justify:				left

*iscaleName.label:                         Image scale:
*iscaleValue*string:                       1.0
*iscaleName2.label:                        (iscale)
*ihwhmpsfName.label:                       Hwhm of the psf:
*ihwhmpsfValue*string:                     1.25
*ihwhmpsfName2.label:                      (ihwhmpsf)
*iemissionName.label:                      Positive features:
*iemissionValue.label:                     yes
*iemissionName2.label:                     (iemission)\ \ 
*iskysigmaName.label:                      \ Standard deviation of background:
*iskysigmaValue*string:                    INDEF
*iskysigmaName2.label:                     (iskysigma)
*imindataName.label:                       Minimum good data value:
*imindataValue*string:                     INDEF
*imindataName2.label:                      (imindata)
*imaxdataName.label:                       Maximum good data value:
*imaxdataValue*string:                     INDEF
*imaxdataName2.label:                      (imaxdata)

*imparsGroup2.label:			   Noise Model Parameters
*imparsLayout*imparsGroup2.outerOffset:    7
*imparsLayout2.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	imparsLayout21 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	imparsLayout22 <+inf -inf  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	imparsLayout23 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*imparsLayout21.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	inoisemodelName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikreadnoiseName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikgainName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ireadnoiseName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	igainName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*imparsLayout22.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	inoisemodelFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikreadnoiseFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikgainFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ireadnoiseFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	igainFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*imparsLayout23.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	inoisemodelName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikreadnoiseName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikgainName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ireadnoiseName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	igainName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*imparsLayout*imparsLayout2*Command.background:		gray71
*imparsLayout*imparsLayout2*Command.shadowWidth:	0
*imparsLayout*imparsLayout2*Command.justify:		left
*imparsLayout*imparsLayout2*MenuButton.background:	gray71
*imparsLayout*imparsLayout2*MenuButton.justify:		left
*imparsLayout*imparsLayout2*MenuButton.shadowWidth: 	0
*imparsLayout21*Label.justify:				right
*imparsLayout23*Label.justify:				left

*inoisemodelName.label:                     Noise model:
*inoisemodelValue.menuName:                 inoisemodelMenu
*inoisemodelValue.label:                    poisson
*inoisemodelValue.translations:                  \
         <EnterWindow>: highlight()              \n\
         <LeaveWindow>: reset()                  \n\
            <Btn1Down>: popup(inoisemodelMenu)   \n\
              <Btn1Up>: popdown(inoisemodelMenu)
*inoisemodelName2.label:                   (inoisemodel)
*ikreadnoiseName.label:                    \  CCD readout noise image keyword:
*ikreadnoiseValue*string:                  ""
*ikreadnoiseName2.label:                   (ikread)
*ikgainName.label:                         CCD gain image keyword:
*ikgainValue*string:                       ""
*ikgainName2.label:                        (ikgain)
*ireadnoiseName.label:                     Default CCD readout noise in e-:
*ireadnoiseValue*string:                   0.0
*ireadnoiseName2.label:                    (ireadnoise)
*igainName.label:                          Default CCD gain in e- per count:
*igainValue*string:                        1.0
*igainName2.label:                         (igain)

*imparsGroup3.label:				Observing Parameters
*imparsLayout*imparsGroup3.outerOffset:	7
*imparsLayout3.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	imparsLayout31 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	imparsLayout32 <+inf -inf  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	imparsLayout33 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*imparsLayout31.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	ikexptimeName < +inf - inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikairmassName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikfilterName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikobstimeName <  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ietimeName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iairmassName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ifilterName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iotimeName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*imparsLayout32.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	ikexptimeFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikairmassFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikfilterFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikobstimeFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ietimeFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iairmassFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ifilterFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iotimeFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*imparsLayout33.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	ikexptimeName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikairmassName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikfilterName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ikobstimeName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ietimeName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iairmassName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ifilterName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	iotimeName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*imparsLayout*imparsLayout3*Command.background:	        gray71
*imparsLayout*imparsLayout3*Command.shadowWidth:	0
*imparsLayout*imparsLayout3*Command.justify:		left
*imparsLayout*imparsLayout3*MenuButton.background:	gray71
*imparsLayout*imparsLayout3*MenuButton.justify:         left
*imparsLayout*imparsLayout3*MenuButton.shadowWidth: 	0
*imparsLayout31*Label.justify:				right
*imparsLayout33*Label.justify:				left

*ikexptimeName.label:                   Exposure time image keyword:
*ikexptimeValue*string:                 ""
*ikexptimeName2.label:                  (ikexptime)\ \ 
*ikairmassName.label:                   Airmass image keyword:
*ikairmassValue*string:                 ""
*ikairmassName2.label:                  (ikairmass)
*ikfilterName.label:                    Filter id image keyword:
*ikfilterValue*string:                  ""
*ikfilterName2.label:                   (ikfilter)
*ikobstimeName.label:                   Time of observation image keyword:
*ikobstimeValue*string:                 ""
*ikobstimeName2.label:                  (ikobstime)
*ietimeName.label:                      Default exposure time:
*ietimeValue*editType:                  edit
*ietimeValue*string:                    1.0
*ietimeName2.label:                     (ietime)
*iairmassName.label:                    Default airmass:
*iairmassValue*string:                  INDEF
*iairmassName2.label:                   (iairmass)
*ifilterName.label:                     Default filter id:
*ifilterValue*string:                   INDEF
*ifilterName2.label:                    (ifilter)
*iotimeName.label:                      Default time of observation:
*iotimeValue*string:                    INDEF
*iotimeName2.label:                     (iotime)

*impbuttonsGroup.label:
*imparsLayout*impbuttonsGroup.innerOffset: 		0
*imparsLayout*impbuttonsLayout.background: 		gray71
*imparsLayout*impbuttonsLayout*Command.internalHeight:	3
*imparsLayout*impbuttonsLayout*Command.internalWidth:	4
*impbuttonsLayout.layout: horizontal { \
    10 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	imparsUpdateButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	imparsRestoreButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	imparsDefaultsButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	imparsSaveButton < * > \
	6 < +0 -6 > \
    } \
    50 < +inf -50> \
    vertical { \
	6 < +0 -6 > \
	imparsHelpButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	imparsCloseButton < * > \
	6 < +0 -6 > \
    } \
    10 < +0 -0 > \
}

*imparsUpdateButton.label:		Apply
*imparsRestoreButton.label:		Cancel
*imparsDefaultsButton.label:		Unlearn
*imparsSaveButton.label:		Update
*imparsHelpButton.label:		Help
*imparsHelpButton.sensitive:		True
*imparsCloseButton.label:		Dismiss


!* RESOURCES FOR THE FINDPARS TOPLEVEL SHELL

*xguiphot_findpars.geometry:                 	530x320
*findparsLayout*borderWidth:               	0
*findparsLayout*highlightThickness:        	0
*findparsLayout*background:                	gray81
*findparsLayout*Group.outerOffset:         	0
*findparsLayout*Group.shrinkToFit:         	True
*findparsLayout*Group.frameType:           	chiseled
*findparsLayout*Group.frameWidth:          	2
*findparsLayout*Frame*frameType:           	sunken
*findparsLayout*Frame.frameWidth:          	1
*findparsLayout*Text*background:           	gray71
*findparsLayout*Text*editType:	      		edit
*findparsLayout*Command.highlightThickness: 	2
*findparsLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        findtitleGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    14 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        findparsGroup1 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    7 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        findbuttonsGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}
*findtitleGroup.label:
*findparsLayout*findtitleGroup.background:	gray71
*findparsLayout*findtitleGroup.innerOffset:	0
*findTitle.label:				Object Detection Parameters
*findparsLayout*findTitle.background:		gray71
*findTitle.internalHeight:			10

*findparsGroup1.label:				
*findparsLayout*findparsGroup1.outerOffset:	7
*findparsLayout1.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	findparsLayout11 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	findparsLayout12 < +inf -inf  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	findparsLayout13 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*findparsLayout11.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	fthresholdName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fradiusName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fsepminName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	froundloName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	froundhiName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fsharploName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fsharphiName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*findparsLayout12.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	fthresholdFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fradiusFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fsepminFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	froundloFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	froundhiFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fsharploFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fsharphiFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*findparsLayout13.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	fthresholdName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fradiusName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fsepminName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	froundloName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	froundhiName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fsharploName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	fsharphiName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*findparsLayout*findparsLayout1*Command.background:	gray71
*findparsLayout*findparsLayout1*Command.shadowWidth:	0
*findparsLayout*findparsLayout1*Command.justify:	left
*findparsLayout*findparsLayout1*MenuButton.background:	gray71
*findparsLayout*findparsLayout1*MenuButton.justify:	left
*findparsLayout*findparsLayout1*MenuButton.shadowWidth: 0
*findparsLayout11*Label.justify:			right
*findparsLayout13*Label.justify:			left

*fthresholdName.label:		Detection threshold in ADU:
*fthresholdValue*string:	100
*fthresholdName2.label:		(fthreshold)
*fradiusName.label:		Fitting radius in HWHM:
*fradiusValue*string:		2.5
*fradiusName2.label:		(fradius)
*fsepminName.label:		Minimum separation in HWHM:
*fsepminValue*string:		5.0
*fsepminName2.label:		(fsepmin)
*froundloName.label:		Lower ellipticity limit:
*froundloValue*string:		0.0
*froundloName2.label:		(froundlo)
*froundhiName.label:		Upper ellipticity limit:
*froundhiValue*string:		0.2
*froundhiName2.label:		(froundhi)
*fsharploName.label:		Lower sharpness limit:
*fsharploValue*string:		0.5
*fsharploName2.label:		(fsharplo)
*fsharphiName.label:		Upper sharpness limit:
*fsharphiValue*string:		2.0
*fsharphiName2.label:		(fsharphi)

*findbuttonsGroup.label:
*findparsLayout*findbuttonsGroup.innerOffset: 			0
*findparsLayout*findbuttonsLayout.background: 			gray71
*findparsLayout*findbuttonsLayout*Command.internalHeight:	3
*findparsLayout*findbuttonsLayout*Command.internalWidth:	4
*findbuttonsLayout.layout: horizontal { \
    10 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	findparsUpdateButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	findparsRestoreButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	findparsDefaultsButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	findparsSaveButton < * > \
	6 < +0 -6 > \
    } \
    50 < +inf -50> \
    vertical { \
	6 < +0 -6 > \
	findparsFindButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	findparsHelpButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	findparsCloseButton < * > \
	6 < +0 -6 > \
    } \
    10 < +0 -0 > \
}

*findparsUpdateButton.label:		Apply
*findparsRestoreButton.label:		Cancel
*findparsDefaultsButton.label:		Unlearn
*findparsSaveButton.label:		Update
*findparsFindButton.label:		Find
*findparsHelpButton.label:		Help
*findparsHelpButton.sensitive:		True
*findparsCloseButton.label:		Dismiss


!* RESOURCES FOR THE OBJECTS LIST PANEL

*xguiphot_objlist.geometry:                     720x450
*objlistLayout*borderWidth:                     0
*objlistLayout*highlightThickness:              0
*objlistLayout*background:                      gray81
*objlistLayout*Group.outerOffset:               7
*objlistLayout*Group.shrinkToFit:               True
*objlistLayout*Group.frameType:                 chiseled
*objlistLayout*Group.frameWidth:                2
*objlistLayout*Frame*frameType:                 sunken
*objlistLayout*Frame*frameWidth:                2
*objlistLayout*Text*background:                 gray71
*objlistLayout*Command.highlightThickness:      2
*objlistLayout*Scrollbar2*background:           gray71
*objlistLayout*scrollbarForeground:             gray81
*objlistLayout*Scrollbar2*minsize:              20
*objlistScrollbarv.location:                    0 0 20 10
*objlistScrollbarv.vertical:                    True
*objlistScrollbarh.location:                    0 0 100 20
*objlistScrollbarh.vertical:                    False
*objlistLayout*MultiList*background:            gray71
*objlistLayout*MultiList*shadeSurplus:          False

*objlistLayout.layout: vertical { \
    10 < +0 -10 > \
    horizontal { \
        0 < +0 -0 > \
        objlistinGroup < +inf -inf * > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        objlistobjGroup < +inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        objlistphotGroup < +inf -inf * > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        objlistoutGroup < +inf -inf * > \
        0 < +0 -0 > \
    } \
    7 < +0 -7 > \
}

*objlistinGroup.label:                          Create New List
*objlistinLayout.layout: vertical { \
    10 < +0 -10 > \
    horizontal { \
        7 < +0 -7 > \
        objlistobjinLabel < * > \
        5 < +0 -5 > \
        objlistobjinFrame < +inf -inf * > \
        5 < +0 -5 > \
        objlistrereadButton < * > \
        0 < +0 -0 > \
        objlistnextlistButton < * > \
        0 < +0 -0 > \
        objlistprevlistButton < * > \
        25 < +0 -5 > \
        objlistobjinFind < * > \
        0 < +0 -0 > \
        objlistobjinImpars < * > \
        0 < +0 -0 > \
        objlistobjinFindpars < * > \
        25 <+0 -5> \
        objlistobjinDraw < * > \
        7 < +0 -7 > \
    } \
    5 < +0 -5 > \
}
*objlistobjinLabel.label:                       \ Input Objects File:
*objlistobjinText*editType:                     edit
*objlistobjinText*string:                       default
*objlistobjinText*displayCaret:                 False
*objlistrereadButton.label:                     Reread
*objlistnextlistButton.label:                   Next
*objlistprevlistButton.label:                   Prev
*objlistobjinFind.label:                        Find
*objlistobjinImpars.label:                      Impars
*objlistobjinFindpars.label:                    Findpars
*objlistobjinDraw.label:                        Draw

*objlistobjGroup.label:                         View and Edit List
*objlistobjLayout.layout: vertical { \
    10 < +0 -10 > \
    horizontal { \
        7 < +0 -7 > \
        objlistrewindButton < * > \
        0 < +0 -0 > \
        objlistnextobjButton < * > \
        0 < +0 -0 > \
        objlistprevobjButton < * > \
        0 < +0 -0 > \
        objlistmarkerButton < * > \
        50 < +inf -inf > \
        objlistmarkButton < * > \
        0 < +0 -0 > \
        objlisteraseButton < * > \
        0 < +0 -0 > \
        objlistoeditButton < * > \
        50 < +inf -inf > \
        objlistinitButton < * > \
        0 < +0 -0 > \
        objlistdeleteButton < * > \
        0 < +0 -0 > \
        objlistundeleteButton < * > \
        0 < +0 -0 > \
        objlistaddButton < * > \
        7 < +0 -7 > \
    } \
    10 < +0 -10 > \
    horizontal { \
        10 < +0 -0 > \
            objlistScrollbarv < * +inf - inf > \
        5 < +0 -5 > \
            objlistFrame < +inf -inf * +inf -inf > \
        5 < +0 -0 > \
    } \
    5 < +0 -5> \
    horizontal { \
        35 < +0 -0 > \
            objlistScrollbarh < +inf - inf * > \
        5 < +0 -0 > \
    } \
    10 < +0 -10 > \
    horizontal { \
        10 < +0 -0 > \
            objlistenterLabel < * > \
        5 < +0 -5 > \
            objlistenterFrame < +inf -inf * > \
        5 < +0 -5 > \
            objlistclearButton < * > \
        0 < +0 -0 > \
            objlistenterButton < * > \
        7 < +0 -7 > \
    } \
    5 < +0 -5 > \
}
!*objlistLayout*hdrbuttonsLayout*Command.background:     gray81

*objlistList*width:                             100
*objlistList*height:                            78
*objlistrewindButton.label:                     Rewind
*objlistnextobjButton.label:                    Next
*objlistprevobjButton.label:                    Prev
*objlistmarkerButton.label:                     Show Marker
*objlistmarkButton.label:                       Show
*objlisteraseButton.label:                      Erase
*objlistoeditButton.label:                      Omarkpars
*objlistinitButton.label:                       Init
*objlistdeleteButton.label:                     Delete
*objlistundeleteButton.label:                   Undelete
*objlistaddButton.label:                        Draw
*objlistenterLabel.label:                       Enter object geometry:
*objlistenterText*editType:                     edit
*objlistenterText*string:
*objlistenterText*displayCaret:                 False
*objlistclearButton.label:                      Clear
*objlistenterButton.label:                      Enter

*objlistphotGroup.label:                        Measure List
*objlistphotLayout.layout: vertical { \
    10 < +0 -10 > \
    horizontal { \
        7 < +0 -7 > \
        objcenparsButton < * > \
        0 < +0 -0 > \
        objskyparsButton < * > \
        0 < +0 -0 > \
        objphotparsButton < * > \
        50 < +inf -inf > \
        objlogLabel < * > \
        0 < +0 -0 > \
        objlogButton < * > \
        0 < +0 -0 > \
        objphotcurrentButton < * > \
        0 < +0 -0 > \
        objphotnextButton < * > \
        0 < +0 -0 > \
        objphotprevButton < * > \
        0 < +0 -0 > \
        objphotrestofButton < * > \
        0 < +0 -0 > \
        objphotallButton < * > \
        7 < +0 -7 > \
    } \
    5 < +0 -5 > \
}

*objcenparsButton.label:			Cenpars
*objskyparsButton.label:			Skypars
*objphotparsButton.label:			Photpars
*objlogLabel.label:				Log results:
*objlogButton.label:				No
*objphotallButton.label:			All
*objphotnextButton.label:			Next
*objphotprevButton.label:			Prev
*objphotcurrentButton.label:			Current
*objphotrestofButton.label:			Restof

*objlistoutGroup.label:                         Save List
*objlistoutLayout.layout: vertical { \
    10 < +0 -10 > \
    horizontal { \
        7 < +0 -7 > \
        objlistobjdirLabel < * > \
        5 < +0 -5 > \
        objlistobjdirFrame < +inf -inf * > \
        5 < +0 -5 > \
        objlistobjoutLabel < * > \
        5 < +0 -5 > \
        objlistobjoutFrame < +inf -inf * > \
        5 < +0 -5 > \
        objlistsaveButton < * > \
        30 < +0 -30 > \
        objlisthelpButton < * > \
        0 < +0 -0 > \
        objlistcloseButton < * > \
        7 < +0 -7 > \
    } \
    5 < +0 -5 > \
}
*objlistobjdirLabel.label:                      Dir:
*objlistobjdirFrame.width:                      15
*objlistobjdirText*editType:                    edit
*objlistobjdirText*string:                       
*objlistobjdirText*displayCaret:                False
*objlistobjoutLabel.label:                      File:
*objlistobjoutText*editType:                    edit
*objlistobjoutText*string:                      default
*objlistobjoutText*displayCaret:                False
*objlistsaveButton.label:                       Save
!*objlisthelpButton.sensitive:                   False
*objlisthelpButton.label:                       Help
*objlistcloseButton.label:                      Dismiss

*objmarkerMenu.objoscolorMenu.item1.foreground:			red
*objmarkerMenu.objoscolorMenu.item2.foreground:			blue
*objmarkerMenu.objoscolorMenu.item3.foreground:			green
*objmarkerMenu.objoscolorMenu.item4.foreground:			yellow

*regmarkerMenu.regoscolorMenu.item1.foreground:			red
*regmarkerMenu.regoscolorMenu.item2.foreground:			blue
*regmarkerMenu.regoscolorMenu.item3.foreground:			green
*regmarkerMenu.regoscolorMenu.item4.foreground:			yellow

*objmarkerMenu.objopcolorMenu.item1.foreground:			red
*objmarkerMenu.objopcolorMenu.item2.foreground:			blue
*objmarkerMenu.objopcolorMenu.item3.foreground:			green
*objmarkerMenu.objopcolorMenu.item4.foreground:			yellow

*regmarkerMenu.regopcolorMenu.item1.foreground:			red
*regmarkerMenu.regopcolorMenu.item2.foreground:			blue
*regmarkerMenu.regopcolorMenu.item3.foreground:			green
*regmarkerMenu.regopcolorMenu.item4.foreground:			yellow


!* XGUIPHOT_CENTERPARS PANEL RESOURCES 

*xguiphot_cenpars.geometry:                 	530x420
*cenparsLayout*borderWidth:               	0
*cenparsLayout*highlightThickness:        	0
*cenparsLayout*background:                	gray81
*cenparsLayout*Group.outerOffset:         	0
*cenparsLayout*Group.shrinkToFit:         	True
*cenparsLayout*Group.frameType:           	chiseled
*cenparsLayout*Group.frameWidth:          	2
*cenparsLayout*Frame*frameType:           	sunken
*cenparsLayout*Frame.frameWidth:          	1
*cenparsLayout*Text*background:           	gray71
*cenparsLayout*Text*displayCaret:           	False
*cenparsLayout*Text*editType:	      		edit
*cenparsLayout*Command.highlightThickness: 	2
*cenparsLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        cetitleGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    14 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        ceparsGroup1 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        ceparsGroup2 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    7 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        cebuttonsGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}
*cetitleGroup.label:
*cenparsLayout*cetitleGroup.background:		gray71
*cenparsLayout*cetitleGroup.innerOffset:	0
*ceTitle.label:					Centering Parameters
*cenparsLayout*ceTitle.background:		gray71
*ceTitle.internalHeight:			10

*ceparsGroup1.label:				Algorithm Parameters
*cenparsLayout*ceparsGroup1.outerOffset:	7
*ceparsLayout1.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	ceparsLayout11 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	ceparsLayout12 <+inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	ceparsLayout13 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*ceparsLayout11.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	calgorithmName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cradiusName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cthresholdName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cminsnratioName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cmaxiterName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cxyshiftName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*ceparsLayout12.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	calgorithmFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cradiusFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cthresholdFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cminsnratioFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cmaxiterFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cxyshiftFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*ceparsLayout13.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	calgorithmName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cradiusName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cthresholdName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cminsnratioName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cmaxiterName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	cxyshiftName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*cenparsLayout*ceparsLayout1*MenuButton.background:	gray71
*cenparsLayout*ceparsLayout1*MenuButton.justify:	left
*cenparsLayout*ceparsLayout1*MenuButton.shadowWidth:	0
*cenparsLayout*ceparsLayout1*Command.background:	gray71
*cenparsLayout*ceparsLayout1*Command.shadowWidth:	0
*cenparsLayout*ceparsLayout1*Command.justify:		left
*ceparsLayout11*Label.justify:				right
*ceparsLayout13*Label.justify:				left

*calgorithmName.label:                         Centering algorithm menu:
*calgorithmValue.menuName:                     calgorithmMenu
*calgorithmValue.label:                        centroid
*calgorithmValue.translations:                 \
    <EnterWindow>:      highlight()            \n\
    <LeaveWindow>:      reset()                \n\
       <Btn1Down>:      popup(calgorithmMenu)  \n\
         <Btn1Up>:      popdown(calgorithmMenu)
*calgorithmName2.label:                        (calgorithm)
*cradiusName.label:                            Centering radius:
*cradiusValue*string:                          2.5
*cradiusName2.label:                           (cradius)
*cthresholdName.label:                         Threshold in sigma above sky:
*cthresholdValue*string:                       0.0
*cthresholdName2.label:                        (cthreshold)
*cminsnratioName.label:                        Minimum signal-to-noise ratio:
*cminsnratioValue*string:                      1.0
*cminsnratioName2.label:                       (cminsnratio)
*cmaxiterName.label:                           Maximum number of iterations:
*cmaxiterValue*string:                         10
*cmaxiterName2.label:                          (cmaxiter)
*cxyshiftName.label:                           Maximum x and y center shift:
*cxyshiftValue*string:                         5.0
*cxyshiftName2.label:                          (cxyshift)

*ceparsGroup2.label:				Marking Parameters
*cenparsLayout*ceparsGroup2.outerOffset:	7
*ceparsLayout2.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	ceparsLayout21 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	ceparsLayout22 <+inf -inf  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	ceparsLayout23 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*ceparsLayout21.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	ctrmarkName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ccharmarkName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ccolormarkName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	csizemarkName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*ceparsLayout22.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	ctrmarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ccharmarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ccolormarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	csizemarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*ceparsLayout23.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	ctrmarkName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ccharmarkName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ccolormarkName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	csizemarkName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}


*cenparsLayout*ceparsLayout2*Command.background:	gray71
*cenparsLayout*ceparsLayout2*Command.shadowWidth:	0
*cenparsLayout*ceparsLayout2*Command.justify:		left
*cenparsLayout*ceparsLayout2*MenuButton.background:	gray71
*cenparsLayout*ceparsLayout2*MenuButton.justify:	left
*cenparsLayout*ceparsLayout2*MenuButton.shadowWidth: 	0
*ceparsLayout21*Label.justify:				right
*ceparsLayout23*Label.justify:				left

*ctrmarkName.label:                              Mark the computed center:
*ctrmarkValue.label:                             no
*ctrmarkName2.label:                             (ctrmark)
*ccharmarkName.label:                         \  The center marker character:
*ccharmarkValue.menuName:                        ccharmarkMenu
*ccharmarkValue.label:                           plus
*ccharmarkValue.translations:                    \
    <EnterWindow>:      highlight()              \n\
    <LeaveWindow>:      reset()                  \n\
       <Btn1Down>:      popup(ccharmarkMenu)     \n\
         <Btn1Up>:      popdown(ccharmarkMenu)
*ccharmarkName2.label:                           (ccharmark)
*ccolormarkName.label:                           The center marker color:
*ccolormarkValue.menuName:                       ccolormarkMenu
*ccolormarkValue.label:                          red
*ccolormarkValue.translations:                   \
    <EnterWindow>:      highlight()              \n\
    <LeaveWindow>:      reset()                  \n\
       <Btn1Down>:      popup(ccolormarkMenu)    \n\
         <Btn1Up>:      popdown(ccolormarkMenu)
*ccolormarkMenu.item1.foreground:                red
*ccolormarkMenu.item2.foreground:                blue
*ccolormarkMenu.item3.foreground:                green
*ccolormarkMenu.item4.foreground:                yellow
*ccolormarkName2.label:                          (ccolormark)\ 
*csizemarkName.label:                            The marker size:
*csizemarkValue*string:                          INDEF
*csizemarkName2.label:                           (csizemark)

*cebuttonsGroup.label:
*cenparsLayout*cebuttonsGroup.innerOffset: 		0
*cenparsLayout*cebuttonsLayout.background: 		gray71
*cenparsLayout*cebuttonsLayout*Command.internalHeight:	3
*cenparsLayout*cebuttonsLayout*Command.internalWidth:	4
*cebuttonsLayout.layout: horizontal { \
    10 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	cenparsUpdateButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	cenparsRestoreButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	cenparsDefaultsButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	cenparsSaveButton < * > \
	6 < +0 -6 > \
    } \
    50 < +inf -50> \
    vertical { \
	6 < +0 -6 > \
	cenparsHelpButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	cenparsCloseButton < * > \
	6 < +0 -6 > \
    } \
    10 < +0 -0 > \
}

*cenparsUpdateButton.label:		Apply
*cenparsRestoreButton.label:		Cancel
*cenparsDefaultsButton.label:		Unlearn
*cenparsSaveButton.label:		Update
*cenparsHelpButton.label:		Help
*cenparsHelpButton.sensitive:		True
*cenparsCloseButton.label:		Dismiss


!* THE XGUIPHOT_SKYPARS PANEL RESOURCES

*xguiphot_skypars.geometry:                 	530x640
*skyparsLayout*borderWidth:               	0
*skyparsLayout*highlightThickness:        	0
*skyparsLayout*background:                	gray81
*skyparsLayout*Group.outerOffset:         	0
*skyparsLayout*Group.shrinkToFit:         	True
*skyparsLayout*Group.frameType:           	chiseled
*skyparsLayout*Group.frameWidth:          	2
*skyparsLayout*Frame*frameType:           	sunken
*skyparsLayout*Frame.frameWidth:          	1
*skyparsLayout*Text*background:           	gray71
*skyparsLayout*Text*displayCaret:           	False
*skyparsLayout*Text*editType:	      		edit
*skyparsLayout*Command.highlightThickness: 	2
*skyparsLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        skytitleGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    14 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        skyparsGroup1 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        skyparsGroup2 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        skyparsGroup3 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    7 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        skybuttonsGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}
*skytitleGroup.label:
*skyparsLayout*skytitleGroup.background:	gray71
*skyparsLayout*skytitleGroup.innerOffset:	0
*skyTitle.label:				Sky Fitting Parameters
*skyparsLayout*skyTitle.background:		gray71
*skyTitle.internalHeight:			10

*skyparsGroup1.label:				Geometry Parameters
*skyparsLayout*skyparsGroup1.outerOffset:	7
*skyparsLayout1.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	skyparsLayout11 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	skyparsLayout12 <+inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	skyparsLayout13 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*skyparsLayout11.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	smodeName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0> \
	sgeometryName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	srannulusName <+inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	swannulusName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	saxratioName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	sposangleName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*skyparsLayout12.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	smodeFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	sgeometryFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	srannulusFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	swannulusFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	saxratioFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	sposangleFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*skyparsLayout13.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	smodeName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0> \
	sgeometryName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	srannulusName2 <+inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	swannulusName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	saxratioName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	sposangleName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*skyparsLayout*skyparsLayout1*MenuButton.background:	gray71
*skyparsLayout*skyparsLayout1*MenuButton.justify:	left
*skyparsLayout*skyparsLayout1*MenuButton.shadowWidth:	0
*skyparsLayout*skyparsLayout1*Command.background:	gray71
*skyparsLayout*skyparsLayout1*Command.shadowWidth:	0
*skyparsLayout*skyparsLayout1*Command.justify:		left
*skyparsLayout11*Label.justify:				right
*skyparsLayout13*Label.justify:				left

*smodeName.label:                         \    Sky aperture positioning menu:
*smodeValue.menuName:                          smodeMenu
*smodeValue.label:                             circle
*smodeValue.translations:                      \
    <EnterWindow>:      highlight()            \n\
    <LeaveWindow>:      reset()                \n\
       <Btn1Down>:      popup(smodeMenu)       \n\
         <Btn1Up>:      popdown(smodeMenu)
*smodeName2.label:                             (smode)
*sgeometryName.label:                          Sky aperture geometry menu:
*sgeometryValue.menuName:                      sgeometryMenu
*sgeometryValue.label:                         circle
*sgeometryValue.translations:                   \
    <EnterWindow>:      highlight()            \n\
    <LeaveWindow>:      reset()                \n\
       <Btn1Down>:      popup(sgeometryMenu)   \n\
         <Btn1Up>:      popdown(sgeometryMenu)
*sgeometryName2.label:                         (sgeometry)  
*srannulusName.label:                          Inner radius of sky annulus:
*srannulusValue*string:                        25.0
*srannulusName2.label:                         (srannulus)
*swannulusName.label:                          Width of sky annulus:
*swannulusValue*string:                        10.0
*swannulusName2.label:                         (swannulus)
*saxratioName.label:                           Axis ratio of sky aperture:
*saxratioValue*string:                         1.0
*saxratioName2.label:                          (saxratio)
*sposangleName.label:                          Position angle of sky aperture:
*sposangleValue*string:                        0.0
*sposangleName2.label:                         (sposangle)\ 

*skyparsGroup2.label:			       Algorithm Parameters
*skyparsLayout*skyparsGroup2.outerOffset:      7
*skyparsLayout2.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	skyparsLayout21 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	skyparsLayout22 <+inf -inf  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	skyparsLayout23 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*skyparsLayout21.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	salgorithmName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	sconstantName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shwidthName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shbinsizeName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shsmoothName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	smaxiterName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0> \
	sloclipName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shiclipName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	snrejectName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	slorejectName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shirejectName <+inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	srgrowName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*skyparsLayout22.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	salgorithmFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	sconstantFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shwidthFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shbinsizeFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shsmoothFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	smaxiterFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	sloclipFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shiclipFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	snrejectFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	slorejectFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shirejectFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	srgrowFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*skyparsLayout23.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	salgorithmName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	sconstantName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shwidthName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shbinsizeName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shsmoothName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	smaxiterName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0> \
	sloclipName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shiclipName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	snrejectName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	slorejectName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	shirejectName2 <+inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	srgrowName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*skyparsLayout*skyparsLayout2*Command.background:	gray71
*skyparsLayout*skyparsLayout2*Command.shadowWidth:	0
*skyparsLayout*skyparsLayout2*Command.justify:		left
*skyparsLayout*skyparsLayout2*MenuButton.background:	gray71
*skyparsLayout*skyparsLayout2*MenuButton.justify:	left
*skyparsLayout*skyparsLayout2*MenuButton.shadowWidth: 	0
*skyparsLayout21*Label.justify:				right
*skyparsLayout23*Label.justify:				left

*salgorithmName.label:                        Sky fitting algorithms menu:
*salgorithmValue.menuName:                    salgorithmMenu
*salgorithmValue.label:                       centroid
*salgorithmValue.translations:                \
    <EnterWindow>:    highlight()             \n\
    <LeaveWindow>:    reset()                 \n\
       <Btn1Down>:    popup(salgorithmMenu)   \n\
         <Btn1Up>:    popdown(salgorithmMenu)
*salgorithmName2.label:                       (salgorithm)
*sconstantName.label:                         User sky value:
*sconstantValue*string:                       0.0
*sconstantName2.label:                        (sconstant)
*shwidthName.label:                           Sky histogram width in sigma:
*shwidthValue*string:                         3.0
*shwidthName2.label:                          (shwidth)
*shbinsizeName.label:                         Sky histogram bin width in sigma: 
*shbinsizeValue*string:                       0.2
*shbinsizeName2.label:                        (shbinsize)
*shsmoothName.label:                          Boxcar smooth sky histogram:
*shsmoothValue.label:                         yes
*shsmoothName2.label:                         (shsmooth)
*smaxiterName.label:                          Max sky fitting iterations:
*smaxiterValue*string:                        10
*smaxiterName2.label:                         (smaxiter)
*sloclipName.label:                           Low side percent clip:
*sloclipValue*string:                         0.0
*sloclipName2.label:                          (sloclip)
*shiclipName.label:                           High side percent clip:
*shiclipValue*string:                         0.0
*shiclipName2.label:                          (shiclip)
*snrejectName.label:                          Max sky rejection iterations:
*snrejectValue*string:                        50
*snrejectName2.label:                         (snreject)
*slorejectName.label:                         Low side sigma rejection factor:
*slorejectValue*string:                       3.0
*slorejectName2.label:                        (sloreject)
*shirejectName.label:                         High side sigma rejection factor:
*shirejectValue*string:                       3.0
*shirejectName2.label:                        (shireject)
*srgrowName.label:                            Region growing radius:
*srgrowValue*string:                          0.0
*srgrowName2.label:                           (srgrow)

*skyparsGroup3.label:				Marking Parameters
*skyparsLayout*skyparsGroup3.outerOffset:	7
*skyparsLayout3.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	skyparsLayout31 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	skyparsLayout32 <+inf -inf  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	skyparsLayout33 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*skyparsLayout31.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	skymarkName < +inf - inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	scolormarkName <  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*skyparsLayout32.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	skymarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	scolormarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*skyparsLayout33.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	skymarkName2 < +inf - inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	scolormarkName2 <  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*skyparsLayout*skyparsLayout3*Command.background:	gray71
*skyparsLayout*skyparsLayout3*Command.shadowWidth:	0
*skyparsLayout*skyparsLayout3*Command.justify:		left
*skyparsLayout*skyparsLayout3*MenuButton.background:	gray71
*skyparsLayout*skyparsLayout3*MenuButton.justify:	left
*skyparsLayout*skyparsLayout3*MenuButton.shadowWidth: 	0
*skyparsLayout31*Label.justify:				right
*skyparsLayout33*Label.justify:				left

*skymarkName.label:                               Mark the sky aperture:
*skymarkValue.label:                              no
*skymarkName2.label:                              (skymark)
*scolormarkName.label:                \           Sky marking color menu:
*scolormarkValue.menuName:                        scolormarkMenu
*scolormarkValue.label:                           yellow
*scolormarkValue.translations:                    \
    <EnterWindow>:      highlight()               \n\
    <LeaveWindow>:      reset()                   \n\
       <Btn1Down>:      popup(scolormarkMenu)     \n\
         <Btn1Up>:      popdown(scolormarkMenu)
*scolormarkMenu.item1.foreground:                 red
*scolormarkMenu.item2.foreground:                 blue
*scolormarkMenu.item3.foreground:                 green
*scolormarkMenu.item4.foreground:                 yellow
*scolormarkName2.label:                           (scolormark)

*skybuttonsGroup.label:
*skyparsLayout*skybuttonsGroup.innerOffset: 		0
*skyparsLayout*skybuttonsLayout.background: 		gray71
*skyparsLayout*skybuttonsLayout*Command.internalHeight:	3
*skyparsLayout*skybuttonsLayout*Command.internalWidth:	4
*skybuttonsLayout.layout: horizontal { \
    10 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	skyparsUpdateButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	skyparsRestoreButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	skyparsDefaultsButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	skyparsSaveButton < * > \
	6 < +0 -6 > \
    } \
    50 < +inf -50> \
    vertical { \
	6 < +0 -6 > \
	skyparsHelpButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	skyparsCloseButton < * > \
	6 < +0 -6 > \
    } \
    10 < +0 -0 > \
}

*skyparsUpdateButton.label:		Apply
*skyparsRestoreButton.label:		Cancel
*skyparsDefaultsButton.label:		Unlearn
*skyparsSaveButton.label:		Update
*skyparsHelpButton.label:		Help
*skyparsHelpButton.sensitive:		True
*skyparsCloseButton.label:		Dismiss


!* THE XGUIPHOT_PHOTPARS PANEL RESOURCES

*xguiphot_photpars.geometry:                 	530x350
*photparsLayout*borderWidth:               	0
*photparsLayout*highlightThickness:        	0
*photparsLayout*background:                	gray81
*photparsLayout*Group.outerOffset:         	0
*photparsLayout*Group.shrinkToFit:         	True
*photparsLayout*Group.frameType:           	chiseled
*photparsLayout*Group.frameWidth:          	2
*photparsLayout*Frame*frameType:           	sunken
*photparsLayout*Frame.frameWidth:          	1
*photparsLayout*Text*background:           	gray71
*photparsLayout*Text*displayCaret:           	False
*photparsLayout*Text*editType:	      		edit
*photparsLayout*Command.highlightThickness: 	2
*photparsLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        phtitleGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    14 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        phparsGroup1 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        phparsGroup2 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    7 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        phbuttonsGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}
*phtitleGroup.label:
*photparsLayout*phtitleGroup.background:	gray71
*photparsLayout*phtitleGroup.innerOffset:	0
*phTitle.label:					Photometry Parameters
*photparsLayout*phTitle.background:		gray71
*phTitle.internalHeight:			10

*phparsGroup1.label:				Algorithm Parameters
*photparsLayout*phparsGroup1.outerOffset:	7
*phparsLayout1.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	phparsLayout11 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	phparsLayout12 <+inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	phparsLayout13 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*phparsLayout11.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	pgeometryName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	paperturesName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	paxratioName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	pposangleName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	pzmagName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*phparsLayout12.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	pgeometryFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	paperturesFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	paxratioFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	pposangleFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	pzmagFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*phparsLayout13.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	pgeometryName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	paperturesName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	paxratioName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	pposangleName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	pzmagName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*photparsLayout*phparsLayout1*MenuButton.background:	gray71
*photparsLayout*phparsLayout1*MenuButton.justify:	left
*photparsLayout*phparsLayout1*MenuButton.shadowWidth:	0
*photparsLayout*phparsLayout1*Command.background:	gray71
*photparsLayout*phparsLayout1*Command.shadowWidth:	0
*photparsLayout*phparsLayout1*Command.justify:		left
*phparsLayout11*Label.justify:				right
*phparsLayout13*Label.justify:				left

*pgeometryName.label:                           Aperture geometry:
*pgeometryValue.menuName:                       pgeometryMenu
*pgeometryValue.label:                          circle
*pgeometryValue.translations:                   \
    <EnterWindow>:      highlight()             \n\
    <LeaveWindow>:      reset()                 \n\
       <Btn1Down>:      popup(pgeometryMenu)    \n\
         <Btn1Up>:      popdown(pgeometryMenu)
*pgeometryName2.label:                          (pgeometry)
*paperturesName.label:                          Aperture semi-major axes:
*paperturesValue*string:                        15.0
*paperturesName2.label:                         (papertures)
*paxratioName.label:                            Aperture axis ratio:
*paxratioValue*string:                          1.0
*paxratioName2.label:                           (paxratio)
*pposangleName.label:                           Aperture position angle:
*pposangleValue*string:                         0.0
*pposangleName2.label:                          (pposangle)
*pzmagName.label:             		        Zero point of magnitude scale:
*pzmagValue*string:                             26.0
*pzmagName2.label:             		        (pzmag)
!*pzmagValue*editType:                          edit

*phparsGroup2.label:				Marking Parameters
*photparsLayout*phparsGroup2.outerOffset:	7
*phparsLayout2.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	phparsLayout21 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	phparsLayout22 <+inf -inf  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	phparsLayout23 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*phparsLayout21.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	photmarkName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	pcolormarkName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*phparsLayout22.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	photmarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	pcolormarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*phparsLayout23.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	photmarkName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	pcolormarkName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*photparsLayout*phparsLayout2*Command.background:	gray71
*photparsLayout*phparsLayout2*Command.shadowWidth:	0
*photparsLayout*phparsLayout2*Command.justify:		left
*photparsLayout*phparsLayout2*MenuButton.background:	gray71
*photparsLayout*phparsLayout2*MenuButton.justify:	left
*photparsLayout*phparsLayout2*MenuButton.shadowWidth: 	0
*phparsLayout21*Label.justify:				right
*phparsLayout23*Label.justify:				left


*photmarkName.label:                        \    Mark apertures on display:
*photmarkValue.label:                            yes
*photmarkName2.label:                            (photmark)
*pcolormarkName.label:                           Aperture marking color:
*pcolormarkValue.menuName:                       pcolormarkMenu
*pcolormarkValue.label:                          red
*pcolormarkValue.translations:                   \
    <EnterWindow>:      highlight()              \n\
    <LeaveWindow>:      reset()                  \n\
       <Btn1Down>:      popup(pcolormarkMenu)    \n\
         <Btn1Up>:      popdown(pcolormarkMenu)
*pcolormarkMenu.item1.foreground:                 red
*pcolormarkMenu.item2.foreground:                 blue
*pcolormarkMenu.item3.foreground:                 green
*pcolormarkMenu.item4.foreground:                 yellow
*pcolormarkName2.label:                           (pcolormark)

*phbuttonsGroup.label:
*photparsLayout*phbuttonsGroup.innerOffset: 		0
*photparsLayout*phbuttonsLayout.background: 		gray71
*photparsLayout*phbuttonsLayout*Command.internalHeight:	3
*photparsLayout*phbuttonsLayout*Command.internalWidth:	4
*phbuttonsLayout.layout: horizontal { \
    10 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	photparsUpdateButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	photparsRestoreButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	photparsDefaultsButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	photparsSaveButton < * > \
	6 < +0 -6 > \
    } \
    50 < +inf -50> \
    vertical { \
	6 < +0 -6 > \
	photparsHelpButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	photparsCloseButton < * > \
	6 < +0 -6 > \
    } \
    10 < +0 -0 > \
}

*photparsUpdateButton.label:			Apply
*photparsRestoreButton.label:			Cancel
*photparsDefaultsButton.label:			Unlearn
*photparsSaveButton.label:			Update
*photparsHelpButton.label:			Help
*photparsHelpButton.sensitive:			True
*photparsCloseButton.label:			Dismiss


!* THE XGUIPHOT_RESULTS PANEL RESOURCES

!*xguiphot_results.geometry:			770x630
*resultsLayout*borderWidth:			0
*resultsLayout*highlightThickness:		0
*resultsLayout*background:			gray81
*resultsLayout*Group.outerOffset:		0
*resultsLayout*Group.innerOffset:		0
*resultsLayout*Group.shrinkToFit:		True
*resultLayout*Group.frameType:			chiseled
*resultsLayout*Group.frameWidth:		2
*resultsLayout*Frame*frameType:			sunken
*resultsLayout*Frame*frameWidth:		2
*resultsLayout*Text*background:			white
*resultsLayout*Frame*Scrollbar*background:	gray81
*resultsLayout*Scrollbar*width:			20
*resultsLayout*Scrollbar*height:		20
*resultsLayout*Scrollbar*shadowWidth:		2
*resultsLayout*Command.highlightThickness: 	2	

*resultsLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        restitleGroup < +inf -inf * > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        resGroup < +inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        objregFrame < * > \
        0 < +0 -0 > \
        objplotsFrame < +inf -inf * > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        oplotbuttonsGroup < +inf -inf * > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        skyregFrame < * > \
        0 < +0 -0 > \
        skyplotsFrame < +inf -inf * > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
        0 < +0 -0 > \
        resbuttonsGroup < +inf -inf * > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*restitleGroup.label:
*resTitle.label:                                   Photometry Plots
*resTitle.internalHeight:                          10

*resGroup.label:
*resLayout.layout: horizontal { \
    5 < +0 -0 > \
    vertical { \
        5 < +0 -0 > \
	resFrame < +inf -inf * +inf -inf > \
        5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}
*resText*editType:				read
*resText*string:
*resText*displayCaret:				False
*resText*width:					700
*resText*height:				 75
*resText*scrollVertical:			always
*resText*scrollHorizontal:			always
*resText*font:					7x13bold

*oplotbuttonsGroup.label:
*oplotbuttonsLayout.layout: horizontal { \
    5 < +0 -5 > \
    vertical { \
        5 < +0 -0 > \
	objregionButton < * > \
        5 < +0 -0 > \
    } \
    0 < +0 -0 > \
    vertical { \
        5 < +0 -0 > \
	objregactivateButton < * > \
        5 < +0 -0 > \
    } \
    60 < +0 -0 > \
    vertical { \
        5 < +0 -0 > \
	objplotsButton < * > \
        5 < +0 -0 > \
    } \
    0 < +0 -0 > \
    vertical { \
        5 < +0 -0 > \
	objactivateButton < * > \
        5 < +0 -0 > \
    } \
    5 < +inf -inf > \
}
*objregionButton.label:                         Objdisplay
*objregionButton.menuName:                      objplotsMenu
*objregactivateButton.label:                    Activate
*objplotsButton.label:                          Objplots
*objplotsButton.menuName:                       photplotsMenu
*objactivateButton.label:                       Activate

*resultsLayout*objregFrame.frameType:		chiseled
*objregFrame.innerOffset:			5
*resultsLayout*objplotsFrame.frameType:		chiseled
*objplotsFrame.innerOffset:			5
*resultsLayout*skyregFrame.frameType:		chiseled
*skyregFrame.innerOffset:			5
*resultsLayout*skyplotsFrame.frameType:		chiseled
*skyplotsFrame.innerOffset:			5

*objregWindow.cmapName:                         image
*objregWindow.width:                            200
*objregWindow.height:                           200
*objregWindow.color9:                           gray76
*objregWindow.color8:                           black
*objregWindow.color1:                           cyan
*objregWindow.sensitive:                        False

*objplotsWindow.width:                          540
*objplotsWindow.height:                         200
!*objplotsWindow.resizable:                      True
*objplotsWindow.color9:                         gray71
*objplotsWindow.color8:                         black
!*objplotsWindow.warpCursor:                     False
*objplotsWindow.copyOnResize:                   False
*objplotsWindow.sensitive:                      False

*skyregWindow.cmapName:                         image
*skyregWindow.width:                            200
*skyregWindow.height:                           200
*skyregWindow.color9:                           gray76
*skyregWindow.color8:                           black
*skyregWindow.color1:                           cyan
*skyregWindow.sensitive:                        False

*skyplotsWindow.width:                          540
*skyplotsWindow.height:                         200
!*skyplotsWindow.resizable:                      True
*skyplotsWindow.color9:                         gray71
*skyplotsWindow.color8:                         black
!*skyplotsWindow.warpCursor:                     False
*skyplotsWindow.copyOnResize:                   False
*skyplotsWindow.sensitive:                      False

*resbuttonsGroup.label:
*resultsLayout*resbuttonsLayout*Command.internalHeight:    3
*resultsLayout*resbuttonsLayout*Command.internalWidth:     4
*resultsLayout*resbuttonsLayout*Command.background:        gray81
*resultsLayout*resbuttonsLayout*MenuButton.background:     gray81
*resultsLayout*resbuttonsLayout*MenuButton.internalHeight: 3
*resultsLayout*resbuttonsLayout*MenuButton.internalWidth:  4
*resbuttonsLayout.layout: horizontal { \
    5 < +0 -5 > \
    vertical { \
	4 < +0 -4 > \
	skyregionButton < * > \
	4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
	4 < +0 -4 > \
	skyregactivateButton < * > \
	4 < +0 -4 > \
    } \
    60 < +0 -0 > \
    vertical { \
	4 < +0 -4 > \
	skyplotsButton < * > \
	4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
	4 < +0 -4 > \
	skyactivateButton < * > \
	4 < +0 -4 > \
    } \
    200 < +inf -inf> \
    vertical { \
	4 < +0 -4 > \
	plotslogLabel < * > \
	4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
	4 < +0 -4 > \
	plotslogButton < * > \
	4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
	4 < +0 -4 > \
	plotshelpButton < * > \
	4 < +0 -4 > \
    } \
    0 < +0 -0 > \
    vertical { \
	4 < +0 -4 > \
	plotscloseButton < * > \
	4 < +0 -4 > \
    } \
    5 < +0 -0 > \
}

*skyregionButton.label:                         Skydisplay
*skyregionButton.menuName:                      skyplotsMenu
*skyregactivateButton.label:                    Activate
*skyplotsButton.label:                          Skyplots
*skyplotsButton.menuName:                       skyphotMenu
*skyactivateButton.label:                       Activate
*plotslogLabel.label:    			Log results:
*plotslogButton.label:    			No
*plotshelpButton.label:    			Help
*plotscloseButton.label:			Dismiss


!* RESORCES FOR THE XGUIPHOT PHOTOMETRY TABLE SHELL

*xguiphot_ptable.geometry:		        710x220
*ptableLayout*borderWidth:			0
*ptableLayout*highlightThickness:		0
*ptableLayout*background:			gray81
*ptableLayout*Group.outerOffset:		0
*ptableLayout*Group.innerOffset:		0
*ptableLayout*Group.shrinkToFit:		True
*ptableLayout*Group.frameType:			chiseled
*ptableLayout*Group.frameWidth:			2
*ptableLayout*Frame*frameType:			sunken
*ptableLayout*Frame*frameWidth:			2
*ptableLayout*Text*background:			white
*ptableLayout*Text*borderWidth:			0
*ptableLayout*Command.highlightThickness: 	2	
*ptableLayout*Frame*Scrollbar*background:	gray81
*ptableLayout*Scrollbar*width:			20
*ptableLayout*Scrollbar*height:			20
*ptableLayout*Scrollbar*shadowWidth:	    	2

*ptableLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	ptbltitleGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	ptblGroup < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	ptblbuttonsGroup < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}
*ptbltitleGroup.label:
*ptblTitle.label:                        Quick-Look Photometry Table
*ptblTitle.internalHeight:               10

*ptblGroup.label:
*ptblLayout.layout: vertical { \
    15 < +0 -0 > \
    horizontal { \
	10 < +0 -0 > \
	    ptblFrame < +inf -inf * +inf -inf > \
	15 < +0 -0 > \
    } \
    10 < +0 -0 > \
}
!*ptblText*editType:			edit
*ptblText*editType:			append
*ptblText*string:			
*ptblText*displayCaret:			False
*ptblText*width:			500
*ptblText*height:			150
*ptblText*scrollVertical:		always
*ptblText*scrollHorizontal:		always
*ptblText*font:				7x13bold

*ptblbuttonsGroup.label:
*ptableLayout*ptblbuttonsLayout*Command.internalHeight:      3
*ptableLayout*ptblbuttonsLayout*Command.internalWidth:       4
*ptableLayout*ptblbuttonsLayout*Command.background:     	   gray81
*ptblbuttonsLayout.layout: horizontal { \
    10 < +0 -10 > \
    vertical { \
	4 < +0 -4 > \
	ptablelogLabel < * > \
	4 < +0 -4 > \
    } \
    3 < +0 -3 > \
    vertical { \
	4 < +0 -4 > \
	ptablelogButton < * > \
	4 < +0 -4 > \
    } \
    3 < +0 -3 > \
    vertical { \
	4 < +0 -4 > \
	ptableclearButton < * > \
	4 < +0 -4 > \
    } \
    50 < +inf -50 > \
    vertical { \
	4 < +0 -4 > \
	ptablehelpButton < * > \
	4 < +0 -4 > \
    } \
    3 < +0 -3 > \
    vertical { \
	4 < +0 -4 > \
	ptablecloseButton < * > \
	4 < +0 -4 > \
    } \
    15 < +0 -0 > \
}

*ptablelogLabel.label:    		Log results:
*ptablelogButton.label:    		no
*ptableclearButton.label:		Clear
*ptablehelpButton.sensitive:		True
*ptablehelpButton.label:		Help
*ptablecloseButton.label:		Dismiss

!* RESOURCES FOR THE APLOTPARS TOPLEVEL SHELL

*xguiphot_aplotpars.geometry:                 	530x350
*aplotparsLayout*borderWidth:               	0
*aplotparsLayout*highlightThickness:        	0
*aplotparsLayout*background:                	gray81
*aplotparsLayout*Group.outerOffset:         	0
*aplotparsLayout*Group.shrinkToFit:         	True
*aplotparsLayout*Group.frameType:           	chiseled
*aplotparsLayout*Group.frameWidth:          	2
*aplotparsLayout*Frame*frameType:           	sunken
*aplotparsLayout*Frame.frameWidth:          	1
*aplotparsLayout*Text*background:           	gray71
*aplotparsLayout*Text*editType:	      		edit
*aplotparsLayout*Command.highlightThickness: 	2
*aplotparsLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        surftitleFrame < +inf -inf * > \
	0 < +0 -0 > \
    } \
    14 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        aplotparsGroup1 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        aplotparsGroup2 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    7 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        surfbuttonsFrame < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}
*aplotparsLayout*surftitleFrame.frameType:	chiseled
*aplotparsLayout*surftitleFrame.frameWidth:	2
*aplotparsLayout*surftitleFrame.background:	gray71
*aplotparsLayout*surftitleFrame.innerOffset:	0
*surfTitle.label:				Surface Plotting Parameters
*aplotparsLayout*surfTitle.background:		gray71
*surfTitle.internalHeight:			10

*aplotparsGroup1.label:				Data Parameters
*aplotparsLayout*aplotparsGroup1.outerOffset:	7
*aplotparsLayout1.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	aplotparsLayout11 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	aplotparsLayout12 <+inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	aplotparsLayout13 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*aplotparsLayout11.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	anxName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	anyName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	az1Name < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	az2Name < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*aplotparsLayout12.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	anxFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	anyFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	az1Frame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	az2Frame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*aplotparsLayout13.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	anxName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	anyName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	az1Name2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	az2Name2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*aplotparsLayout*aplotparsLayout1*MenuButton.background:	gray71
*aplotparsLayout*aplotparsLayout1*MenuButton.justify:		left
*aplotparsLayout*aplotparsLayout1*MenuButton.shadowWidth:	0
*aplotparsLayout*aplotparsLayout1*Command.background:		gray71
*aplotparsLayout*aplotparsLayout1*Command.shadowWidth:		0
*aplotparsLayout*aplotparsLayout1*Command.justify:		left
*aplotparsLayout11*Label.justify:				right
*aplotparsLayout13*Label.justify:				left

*anxName.label:             	       The number of columns to be plotted:
*anxValue*string:                      31
*anxName2.label:             	       (anx)\ \ \ 
*anyName.label:             	       The number of lines to be plotted:
*anyValue*string:                      31
*anyName2.label:             	       (any)
*az1Name.label:             	       Minimum greylevel to be plotted:
*az1Value*string:                      INDEF
*az1Name2.label:             	       (az1)
*az2Name.label:             	       Maximum greylevel to be plotted:
*az2Value*string:                      INDEF
*az2Name2.label:             	       (az2)

*aplotparsGroup2.label:				Plotting Parameters
*aplotparsLayout*aplotparsGroup2.outerOffset:	7
*aplotparsLayout2.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	aplotparsLayout21 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	aplotparsLayout22 <+inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	aplotparsLayout23 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*aplotparsLayout21.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	alabelName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	angvName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	anghName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*aplotparsLayout22.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	alabelFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	angvFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	anghFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*aplotparsLayout23.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	alabelName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	angvName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	anghName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}
*aplotparsLayout*aplotparsLayout2*Command.background:		gray71
*aplotparsLayout*aplotparsLayout2*Command.shadowWidth:		0
*aplotparsLayout*aplotparsLayout2*Command.justify:		left
*aplotparsLayout*aplotparsLayout2*MenuButton.background:	gray71
*aplotparsLayout*aplotparsLayout2*MenuButton.justify:		left
*aplotparsLayout*aplotparsLayout2*MenuButton.shadowWidth: 	0
*aplotparsLayout21*Label.justify:				right
*aplotparsLayout23*Label.justify:				left

*alabelName.label:             	       Label axes:
*alabelValue*label:                    no
*alabelName2.label:            	       (alabel)
*angvName.label:             	       Vertical viewing angle:
*angvValue*string:                     -33.0
*angvName2.label:             	       (angv)
*anghName.label:             	       \           Horizontal viewing angle:
*anghValue*string:                     22.0
*anghName2.label:             	       (angh)

*aplotparsLayout*surfbuttonsFrame.frameType:			chiseled
*aplotparsLayout*surfbuttonsFrame.frameWidth:			2
*aplotparsLayout*surfbuttonsFrame.innerOffset: 			0
*aplotparsLayout*surfbuttonsLayout.background: 			gray71
*aplotparsLayout*surfbuttonsLayout*Command.internalHeight:	3
*aplotparsLayout*surfbuttonsLayout*Command.internalWidth:	4
*surfbuttonsLayout.layout: horizontal { \
    10 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	aplotparsUpdateButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	aplotparsRestoreButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	aplotparsDefaultsButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	aplotparsSaveButton < * > \
	6 < +0 -6 > \
    } \
    50 < +inf -50> \
    vertical { \
	6 < +0 -6 > \
	aplotparsHelpButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	aplotparsCloseButton < * > \
	6 < +0 -6 > \
    } \
    10 < +0 -0 > \
}

*aplotparsUpdateButton.label:		Apply
*aplotparsRestoreButton.label:		Cancel
*aplotparsDefaultsButton.label:		Unlearn
*aplotparsSaveButton.label:	        Update
*aplotparsHelpButton.label:		Help
*aplotparsHelpButton.sensitive:		True
*aplotparsCloseButton.label:		Dismiss

!* RESOURCES FOR THE EPLOTPARS TOPLEVEL SHELL

*xguiphot_eplotpars.geometry:                 	530x560
*eplotparsLayout*borderWidth:               	0
*eplotparsLayout*highlightThickness:        	0
*eplotparsLayout*background:                	gray81
*eplotparsLayout*Group.outerOffset:         	0
*eplotparsLayout*Group.shrinkToFit:         	True
*eplotparsLayout*Group.frameType:           	chiseled
*eplotparsLayout*Group.frameWidth:          	2
*eplotparsLayout*Frame*frameType:           	sunken
*eplotparsLayout*Frame.frameWidth:          	1
*eplotparsLayout*Text*background:           	gray71
*eplotparsLayout*Text*editType:	      		edit
*eplotparsLayout*Command.highlightThickness: 	2
*eplotparsLayout.layout: vertical { \
    0 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        cntrtitleFrame < +inf -inf * > \
	0 < +0 -0 > \
    } \
    14 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        eplotparsGroup1 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    0 < +0 -0 > \
    horizontal { \
	7 < +0 -0 > \
        eplotparsGroup2 < +inf -inf * +inf -inf > \
	7 < +0 -0 > \
    } \
    7 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
        cntrbuttonsFrame < +inf -inf * > \
	0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}
*eplotparsLayout*cntrtitleFrame.frameType:	chiseled
*eplotparsLayout*cntrtitleFrame.frameWidth:	2
*eplotparsLayout*cntrtitleFrame.background:	gray71
*eplotparsLayout*cntrtitleFrame.innerOffset:	0
*cntrTitle.label:				Contour Plotting Parameters
*eplotparsLayout*cntrTitle.background:		gray71
*cntrTitle.internalHeight:			10

*eplotparsGroup1.label:				Contouring Parameters
*eplotparsLayout*eplotparsGroup1.outerOffset:	7
*eplotparsLayout1.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	eplotparsLayout11 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	eplotparsLayout12 <+inf -inf * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	eplotparsLayout13 <  * +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*eplotparsLayout11.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	enxName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	enyName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ez1Name < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ez2Name < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ez0Name < * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	edzName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	encontoursName < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*eplotparsLayout12.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	enxFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	enyFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ez1Frame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ez2Frame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ez0Frame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	edzFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	encontoursFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*eplotparsLayout13.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	enxName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	enyName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ez1Name2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ez2Name2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	ez0Name2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	edzName2 < +inf -inf  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	encontoursName2 < * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*eplotparsLayout*eplotparsLayout1*MenuButton.background:	gray71
*eplotparsLayout*eplotparsLayout1*MenuButton.justify:		left
*eplotparsLayout*eplotparsLayout1*MenuButton.shadowWidth:	0
*eplotparsLayout*eplotparsLayout1*Command.background:		gray71
*eplotparsLayout*eplotparsLayout1*Command.shadowWidth:		0
*eplotparsLayout*eplotparsLayout1*Command.justify:		left
*eplotparsLayout11*Label.justify:				right
*eplotparsLayout13*Label.justify:				left

*enxName.label:             	       Number of columns to be contoured:
*enxValue*string:                      31
*enxName2.label:             	       (enx)
*enyName.label:             	       Number of lines to be contoured:
*enyValue*string:                      31
*enyName2.label:             	       (eny)
*ez1Name.label:             	       Minimum greylevel to be contoured:
*ez1Value*string:                      INDEF
*ez1Name2.label:             	       (ez1)
*ez2Name.label:             	       Maximum greylevel to be contoured:
*ez2Value*string:                      INDEF
*ez2Name2.label:             	       (ez2)
*ez0Name.label:             	       Greylevel value  of zero level contour:
*ez0Value*string:                      INDEF
*ez0Name2.label:             	       (ez0)
*edzName.label:                        Greylevel contour interval:
*edzValue*string:                      INDEF
*edzName2.label:                       (edz)
*encontoursName.label:                 Number of greylevels to be drawn:
*encontoursValue*string:               5
*encontoursName2.label:                (encontours)


*eplotparsGroup2.label:				Plotting Parameters
*eplotparsLayout*eplotparsGroup2.outerOffset:	7
*eplotparsLayout2.layout: horizontal { \
    0 < +0 -0 > \
    vertical { \
        0 < +0 -0 > \
	eplotparsLayout21 < * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	eplotparsLayout22 <+inf -inf  * +inf -inf > \
        0 < +0 -0 > \
    } \
    3 < +0 -3 > \
    vertical { \
        0 < +0 -0 > \
	eplotparsLayout23 <* +inf -inf > \
        0 < +0 -0 > \
    } \
    0 < +0 -0 > \
}

*eplotparsLayout21.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	ehilomarkName <+inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	edashpatName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	elabelName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eboxName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eticklabelName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	exmajorName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	exminorName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eymajorName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eyminorName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eroundName < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	efillName < * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*eplotparsLayout22.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0 > \
	ehilomarkFrame < +inf -inf * +inf -inf > \
	5 < +0 -5 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	edashpatFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	elabelFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eboxFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eticklabelFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	exmajorFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	exminorFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eymajorFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eyminorFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eroundFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	efillFrame < +inf -inf * +inf -inf > \
	5 < +0 -0 > \
    } \
    5 < +0 -0 > \
}

*eplotparsLayout23.layout: vertical { \
    10 < +0 -0 > \
    horizontal { \
	0 < +0 -0> \
	ehilomarkName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	edashpatName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	elabelName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eboxName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eticklabelName2 <  * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	exmajorName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	exminorName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eymajorName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eyminorName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	eroundName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    2 < +0 -2 > \
    horizontal { \
	0 < +0 -0 > \
	efillName2 < +inf -inf * +inf -inf > \
	0 < +0 -0 > \
    } \
    5 < +0 -0 > \
}
*eplotparsLayout*eplotparsLayout2*Command.background:		gray71
*eplotparsLayout*eplotparsLayout2*Command.shadowWidth:		0
*eplotparsLayout*eplotparsLayout2*Command.justify:		left
*eplotparsLayout*eplotparsLayout2*MenuButton.background:	gray71
*eplotparsLayout*eplotparsLayout2*MenuButton.justify:		left
*eplotparsLayout*eplotparsLayout2*MenuButton.shadowWidth: 	0
*eplotparsLayout21*Label.justify:				right
*eplotparsLayout23*Label.justify:				left

*ehilomarkName.label:                        High/low greylevel marking option:
*ehilomarkValue.menuName:                    ehilomarkMenu
*ehilomarkValue.label:                       none
*ehilomarkValue.translations:                \
    <EnterWindow>:     highlight()           \n\
    <LeaveWindow>:     reset()               \n\
       <Btn1Down>:     popup(ehilomarkMenu)  \n\
         <Btn1Up>:     popdown(ehilomarkMenu)
*ehilomarkName2.label:                       (ehilomark)


*edashpatName.label:                   Bit pattern for dashed lines:
*edashpatValue*string:                 528
*edashpatName2.label:                  (edashpat)
*elabelName.label:                     Label major contours with values:
*elabelValue.label:                    no
*elabelName2.label:                    (elabel)
*eboxName.label:                       Draw box around edge of window:
*eboxValue.label:                      no
*eboxName2.label:                      (ebox)
*eticklabelName.label:                 Label tick marks:
*eticklabelValue.label:                no
*eticklabelName2.label:                (eticklabel)
*exmajorName.label:                    Number of major x axis ticks:
*exmajorValue*string:                  5
*exmajorName2.label:                   (exmajor)
*exminorName.label:                    Number of minor x axis ticks:
*exminorValue*string:                  0
*exminorName2.label:                   (exminor)
*eymajorName.label:                    Number of major y axis ticks:
*eymajorValue*string:                  5
*eymajorName2.label:                   (eymajor)
*eyminorName.label:                    Number of minor y axis ticks:
*eyminorValue*string:                  0
*eyminorName2.label:                   (eyminor)
*eroundName.label:                     Round axes limits to nice values:
*eroundValue.label:                    no
*eroundName2.label:                    (eround)
*efillName.label:                    \ Fill viewport else unity aspect ratio:
*efillValue.label:                     no
*efillName2.label:                     (efill)

*eplotparsLayout*cntrbuttonsFrame.frameType:			chiseled
*eplotparsLayout*cntrbuttonsFrame.frameWidth:			2
*eplotparsLayout*cntrbuttonsFrame.innerOffset: 		        0
*eplotparsLayout*cntrbuttonsLayout.background: 		        gray71
*eplotparsLayout*cntrbuttonsLayout*Command.internalHeight:	3
*eplotparsLayout*cntrbuttonsLayout*Command.internalWidth:	4
*cntrbuttonsLayout.layout: horizontal { \
    10 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	eplotparsUpdateButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	eplotparsRestoreButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	eplotparsDefaultsButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	eplotparsSaveButton < * > \
	6 < +0 -6 > \
    } \
    50 < +inf -50> \
    vertical { \
	6 < +0 -6 > \
	eplotparsHelpButton < * > \
	6 < +0 -6 > \
    } \
    0 < +0 -0 > \
    vertical { \
	6 < +0 -6 > \
	eplotparsCloseButton < * > \
	6 < +0 -6 > \
    } \
    10 < +0 -0 > \
}

*eplotparsUpdateButton.label:		Apply
*eplotparsRestoreButton.label:		Cancel
*eplotparsDefaultsButton.label:		Unlearn
*eplotparsSaveButton.label:	        Update
*eplotparsHelpButton.label:		Help
*eplotparsCloseButton.label:		Dismiss

!* UI PARAMETERS

*showImtitle:		True
*imtitleGeom:		+10+10
*showCoords:		True
*coordsboxGeom:		-10-20

}

# CREATE THE USER INTERFACE

createObjects


# DEFINE SOME GENERAL PURPOSE UTILITY PROCEDURES 

# MAP, UNMAP, AND REALIZE WIDGETS

proc winMap { widget } {
    send $widget map
}
proc winUnmap { widget } {
    send $widget unmap
}
proc winRealize { widget } {
    send $widget realize
}

# TRUE OR FALSE ?

proc true {v} {expr {$v == "true" || $v == "True" || $v == "TRUE"}}
proc yes  {v} {expr {$v == "yes" || $v == "Yes" || $v == "YES"}}
proc bparval { upset } {
    set psetpars [send $upset getValue]
    if { $upset == "ucenpars" } {
        foreach pd $psetpars {
	    switch [lindex $pd 0] {
	    ctrmark { set psetval [lindex $pd 1] }
	    }
        }
    } elseif { $upset == "uskypars" } {
        foreach pd $psetpars {
	    switch [lindex $pd 0] {
	    skymark { set psetval [lindex $pd 1] }
	    }
        }
    } elseif { $upset == "uphotpars" } {
        foreach pd $psetpars {
	    switch [lindex $pd 0] {
	    photmark { set psetval [lindex $pd 1] }
	    }
        }
    }
    expr {$psetval == "yes" || $psetval == "Yes" || $psetval == "YES"}
}

# MISCELLANEOUS

proc textDisplayCaret { widget event args } {
    if { $event == "enterNotify" } {
        send $widget set displayCaret True
    } elseif { $event == "leaveNotify" } {
        send $widget set displayCaret False
    }
}


# INITIALIZE

# INITIALIZE THE HELP LINKS

# Keep track of visited anchors in the help page. 
set links       { 0 }
set linkIndex     0
set visited(0)  empty

# INITIALIZE THE COMMAND WINDOW

send imagedisplayWindow setGterm

# INITIALIZE THE FILES PANEL

send uimdir setValue ""
send uofdir setValue ""
send urfdir setValue ""
send ugfdir setValue ""

# INITIALIZE THE PHOTOMETRY TABLE

winRealize xguiphot_ptable

# INITIALIZE THE PHOTOMETRY PLOTS WINDOW 

winRealize xguiphot_results
send objplotsWindow clearScreen
send skyplotsWindow clearScreen
send objregWindow clearScreen
send skyregWindow clearScreen

# ACTIVATE THE USER INTERFACE

activate


# SET SOME GLOBAL VARIABLES

# Get some resource values.
getResources {
    { showImtitle }
    { imtitleGeom }
    { showCoords }
    { coordsboxGeom }
}

set objmarker olistMarker
set osky1marker olistsky1Marker
set osky2marker olistsky2Marker
set goscolor INDEF
set gopcolor INDEF
set gascolor INDEF
set gapcolor INDEF

set photmarker photMarker
set sky1marker sky1Marker
set sky2marker sky2Marker

# DEFINE THE BITMAPS

createBitmap square7by7 7 7 {
 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f, 0x7f};


# REACTIVATE THE USER INTERFACE

proc reactivate args {
    winRealize xguiphot_ptable
    winRealize xguiphot_results
    send objplotsWindow clearScreen
    send skyplotsWindow clearScreen
    send objregWindow clearScreen
    send objregWindow markerInit
    send skyregWindow clearScreen
    send skyregWindow markerInit
    send imagedisplayWindow setGterm
    objdestroyMarker
    photdestroyMarker
    send uinitialize setValue restart
    send uimdir setValue ""
    send uofdir setValue ""
    send urfdir setValue ""
    send ugfdir setValue ""
}
send server postActivateCallback reactivate


# DEFINE THE XGUIPHOT CALLBACK PROCEDURES



# DEFINE SOME IMAGE DISPLAY FUNCTIONS

# ZOOM and PAN.

set xcen 0
set ycen 0
set lastkey ""

proc zoom { x y direction } {

    global xcen ycen

    # Check the redisplay flag.
    if { [send uredisplay getValue] == "yes"} {
        set text "Type i to redisplay the current image"
        gtermStatusLine imagedisplayWindow $text
	return
    }

    # Convert raw screen coordinates to frame buffer raster coordinates.
    send imagedisplayWindow unmapPixel $x $y raster rx ry
    # Select a pixel.
    set rx [expr "int ($rx)"]
    set ry [expr "int ($ry)"]

    # If the pointer did not move much zoom the image, otherwise pan it.
    if { $direction == 0 } {
        send client gkey 0
    } elseif { sqrt(pow($rx-$xcen, 2) + pow($ry-$ycen, 2)) < 4 } {
	if { $direction == 1 } {
            send client gkey Z
	} elseif { $direction == -1 } {
            send client gkey P
	}
    } else {
        send client gkey M
    }

    set xcen $rx
    set ycen $ry

    # Redraw the object and photometry markers.
    send client gkey I
}

# INITIALIZE THE IMAGE INFO BOX

set imtitle_enable 0

# INITIALIZE THE TRACK

set track_enable 0

# INITIALIZE OBJECT AND PHOTOMETRY MARKERS 

set obj_enable 0
set phot_enable 0
set sky_enable 0

# CROSSHAIR ON and OFF

set crosshairId 0

# MANAGE THE CROSSHAIR CURSOR

proc toggleCrosshair args {

    global imtitle_enable track_enable obj_enable crosshairId
    global imdisplayMenuDescription

    if { $crosshairId } {
	set crosshairId 0
	send imagedisplayWindow set ginmodeCursor circle
    } else {
	set crosshairId 1
	send imagedisplayWindow set ginmodeCursor full_crosshair
    }
    editMenu imdisplayMenu imagedisplayWindow $imdisplayMenuDescription
}


# MANAGE THE COORDINATES BOX

# Update the coordinate readout.
proc coordsUpdate { x y } {

    global track_enable

    if { $track_enable } {
        send imagedisplayWindow unmapPixel $x $y raster rx ry rz
	set rx [expr "$rx+0.5"]
	set ry [expr "$ry+0.5"]
        set text [format " %7.2f %7.2f %7.1f " $rx $ry $rz]
        send coordsbox "set text \{$text\}; redraw noerase"
    }
}


# Turn on the tracking.
proc setTrack { state } {

    global track_enable coordsboxGeom

    if { $state } {

        if { $track_enable } {
            return
	}

	set coordsboxMenuDescription { \
            {    "Coords Box Menu"	 f.title			     }
            {				 f.line          	             }
            {				 f.line          	             }
            {				 f.line          	             }
            {			  	 f.line            	             }
            {    "Help ..."              f.exec {
	                                 helpMove helpText #gcmarker
					 if { [send uhelp getValue] == "no"  } {
					    send client gkey ?
					 }
					 }                                   }
            {    "Dismiss marker"        f.exec "send coordsbox destroy"     }
	}; createMenu coordsboxMenu imagedisplayWindow $coordsboxMenuDescription

        set coordsboxTranslations { \
                  <Btn1Motion>:     m_moveResize()
             !Shift <Btn1Down>:     m_raise()  m_markpos()
                    <Btn1Down>:     m_raise()  m_markposAdd()
                      <Btn1Up>:     m_redraw() m_destroyNull()
                    <Btn2Down>:     m_lower()
                    <Btn3Down>:     popup(coordsboxMenu)
                      <Btn3Up>:     popdown(coordsboxMenu)
                <Key>BackSpace:     m_deleteDestroy()
                   <Key>Delete:     m_deleteDestroy()
                    <KeyPress>:     m_input() graphics-input()
        }

        send imagedisplayWindow createMarker coordsbox \
            type                text \
            createMode          noninteractive \
	    translations	$coordsboxTranslations \
            width               25ch \
            height              1ch \
            lineWidth           1 \
	    lineColor		red \
            imageText           true \
            textBgColor         black \
            textColor           white \
	    textBorder		0 \
	    highlightColor	red \
	    fill		true \
	    fillColor		black \
            visible             false

        set box_width [send coordsbox get width]
        set box_height [send coordsbox get height]
        set defGeom [format "%sx%s-10-20" $box_width $box_height]
        send imagedisplayWindow parseGeometry $coordsboxGeom $defGeom \
	    x y width height

        send coordsbox setAttributes \
            x                   $x \
            y                   $y \
            activated           true \
            visible             true \
            sensitive           true

        send coordsbox {
            addCallback coordsboxDestroyCallback destroy
            addCallback coordsboxMoved moveResize
        }

        send imagedisplayWindow addCallback coordsboxWindowResize resize
        set track_enable 1
        send imagedisplayWindow getCursorPos x y
        coordsUpdate $x $y

    } elseif { $track_enable } {
        set track_enable 0
        send coordsbox destroy
    }
}

# Delete the coordinates box.
proc coordsboxDestroyCallback args {
    global imtitle_enable track_enable obj_enable crosshairId
    global imdisplayMenuDescription
    send imagedisplayWindow deleteCallback coordsboxWindowResize
    set track_enable 0
    editMenu imdisplayMenu imagedisplayWindow $imdisplayMenuDescription
}

# If the window is resized make the coordsbox track the corner.
proc coordsboxWindowResize args {

    global track_enable coordsboxGeom

    if { $track_enable } {

        # Get new location.
        set box_width [send coordsbox get width]
        set box_height [send coordsbox get height]
        set defGeom [format "%sx%s-10-20" $box_width $box_height]
        send imagedisplayWindow parseGeometry $coordsboxGeom $defGeom x y \
	    width height

        # Move the marker.
        send coordsbox "\
            deleteCallback coordsboxMoved; \
            markpos; setAttributes x $x y $y; redraw; \
            addCallback coordsboxMoved moveResize"
    }
}

# If the coordsbox is moved redraw the marker.
proc coordsboxMoved { marker event position } {
    global coordsboxGeom
    send coordsbox getRect boundary x y width height
    set coordsboxGeom [send imagedisplayWindow getGeometry $x $y $width $height]
}

# Toggle the coordinates tracking.
proc toggleTrack args {
    global imtitle_enable track_enable obj_enable  crosshairId
    global imdisplayMenuDescription
    setTrack [expr !$track_enable]
    editMenu imdisplayMenu imagedisplayWindow $imdisplayMenuDescription
}


# Initialize the coordinates.
proc initCoordsbox { param old new } {
    global track_enable coordsboxGeom showCoords
    if { $new == "startup" } {
        setTrack [true $showCoords]
    } elseif { $track_enable } {
	setTrack 1
    }
}
send uinitialize addCallback initCoordsbox



# MANAGE THE IMAGE INFORMATION BOX

# Update the coordinate readout.
proc imtitleUpdate { image objects logresults results robjects } {

    global imtitle_enable

    if { $imtitle_enable } {
        set text [format \
"      Image: %s \n    Objects: %s \n Logresults: %s \n    Results: %s \n   Robjects: %s \n" \
	    $image $objects $logresults $results $robjects]
        send imtitlebox "set text \{$text\}; redraw noerase"
    }
}

proc setImtitle { state } {

    global imtitle_enable imtitleGeom imtitleboxMenuDescription

    if { $state } {

        if { $imtitle_enable } {
            return
	}

        set imtitleboxMenuDescription { \
            {    "Imtitle Box Menu"	f.title				      }
            {				f.line          	              }
            {				f.line          	              }
            {				f.line          	              }
            {				f.line          	              }
    { {[yes [send ulogresults getValue]] ? "Disable logging" : "Enable logging"}
                                      f.exec {
					  if { [send ulogresults getValue] == "no" } {
					      send client gcmd logresults yes
					  } else {
					      send client gcmd logresults no
					  }
				      }                                    } 
            {				f.line          	              }
            {				f.line          	              }
            {    "Help ..."             f.exec {
					helpMove helpText #gfmarker
					if { [send uhelp getValue] == "no" } {
					    send client gkey ?
					}
					}                                     }
            {    "Dismiss marker"       f.exec "send imtitlebox destroy"      }
        }; createMenu imtitleboxMenu imagedisplayWindow \
	   $imtitleboxMenuDescription

        # Define the titlebox translations.
        set imtitleboxTranslations { \
                <Btn1Motion>:     m_moveResize()
           !Shift <Btn1Down>:     m_raise()  m_markpos()
                  <Btn1Down>:     m_raise()  m_markposAdd()
                    <Btn1Up>:     m_redraw() m_destroyNull()
                  <Btn2Down>:     m_lower()
                  <Btn3Down>:     popup(imtitleboxMenu)
	            <Btn3Up>:     popdown(imtitleboxMenu)
              <Key>BackSpace:     m_deleteDestroy()
                 <Key>Delete:     m_deleteDestroy()
                  <KeyPress>:     m_input() graphics-input()
        }

        send imagedisplayWindow createMarker imtitlebox \
            type                text \
            createMode          noninteractive \
	    translations	$imtitleboxTranslations \
            width               45ch \
            height              60 \
            lineWidth           1 \
	    lineColor		red \
	    fillColor		black \
	    fill		true \
            imageText           true \
            textBgColor         black \
            textColor           white \
	    highlightColor	red \
	    textBorder		0 \
            visible             false

        set box_width [send imtitlebox get width]
        set box_height [send imtitlebox get height]
        set defGeom [format "%sx%s+10+10" $box_width $box_height]
        send imagedisplayWindow parseGeometry $imtitleGeom $defGeom \
	    x y width height

        send imtitlebox setAttributes \
            x                   $x \
            y                   $y \
            activated           true \
            visible             true \
            sensitive           true

        send imtitlebox {
            addCallback imtitleboxDestroyCallback destroy
            addCallback imtitleboxMoved moveResize
        }

        send imagedisplayWindow addCallback imtitleboxWindowResize resize
        set imtitle_enable 1
        send imagedisplayWindow getCursorPos x y

	set imno [send uimno getValue]
	if { $imno > 0 } {
	    set image [lindex [send uimliststr getValue] [expr "$imno - 1"]]
	} else {
	    set image ""
	}
	set olno [send uofno getValue]
	if { $olno > 0 } {
	    set objects [lindex [send uolliststr getValue] [expr "$olno - 1"]]
	} else {
	    set objects ""
	}
	set logresults [send ulogresults getValue]
	set rlno [send urfno getValue]
	if { $rlno > 0 } {
	    set results [send urffile getValue] 
	} else {
	    set results ""
	}
	set glno [send ugfno getValue]
	if { $glno > 0 } {
	    set robjects [send ugffile getValue] 
	} else {
	    set robjects ""
	}
        imtitleUpdate $image $objects $logresults $results $robjects

    } elseif { $imtitle_enable } {
        set imtitle_enable 0
        send imtitlebox destroy
    }
}

proc imtitleboxDestroyCallback args {
    global imtitle_enable track_enable obj_enable crosshairId
    global imdisplayMenuDescription
    send imagedisplayWindow deleteCallback imtitleboxWindowResize
    set imtitle_enable 0
    editMenu imdisplayMenu imagedisplayWindow $imdisplayMenuDescription
}

# If the window is resized make the imtitlebox track the corner.
proc imtitleboxWindowResize args {

    global imtitle_enable imtitleGeom

    if { $imtitle_enable } {

        # Get new location.
        set box_width [send imtitlebox get width]
        set box_height [send imtitlebox get height]
        set defGeom [format "%sx%s+10+10" $box_width $box_height]
        send imagedisplayWindow parseGeometry $imtitleGeom $defGeom x y \
	    width height

        # Move the marker.
        send imtitlebox "\
            deleteCallback imtitleboxMoved; \
            markpos; setAttributes x $x y $y; redraw; \
            addCallback imtitleboxMoved moveResize"
    }
}

# If the imtitlebox moved redraw the marker.
proc imtitleboxMoved { marker event position } {
    global imtitleGeom
    send imtitlebox getRect boundary x y width height
    set imtitleGeom \
        [send imagedisplayWindow getGeometry $x $y $width $height]
}

proc toggleImtitle args {
    global imtitle_enable track_enable obj_enable crosshairId
    global imdisplayMenuDescription
    setImtitle [expr !$imtitle_enable]
    editMenu imdisplayMenu imagedisplayWindow $imdisplayMenuDescription
}


# Initialize the coordinates.
proc initImtitlebox { param old new } {
    global imtitle_enable imtitleGeom showImtitle
    if { $new == "startup" } {
        setImtitle [true $showImtitle]
    } elseif { $imtitle_enable } {
	setImtitle 1
    }
}
send uinitialize addCallback initImtitlebox

send uinitialize setValue startup

# Redraw all the markers

proc resetAllmarkers args {
    send client gkey I
}

proc kresetAllmarkers { key } {
    global lastkey

    if { [send uredisplay getValue] == "yes" } {
        set text "Type i to redisplay the current image"
        gtermStatusLine imagedisplayWindow $text
	return
    }

    send client gkey $key
    if { $key != "E" || ($key == "E" && $key == $lastkey) } {
        send client gkey I
    }

    if {$key == "E" && $key == $lastkey } {
        set lastkey ""
    } else {
        set lastkey $key
    }
}

proc umredrawCallback { param old new } {
    if { $new == "yes" } {
	objresizeMarker
	resetPhotmarker
    }
}
send umredraw addCallback umredrawCallback

proc imwinResize args {
    if { [send uredisplay getValue] == "yes" } {
	send client gkey i
	send client gkey I
    }
}
send imagedisplayWindow addCallback imwinResize resize

# Reset the photometry marker if it exists. 
proc resetPhotmarker args {
    global sky_enable phot_enable
    send imagedisplayWindow getCursorPos xx yy 
    if { $phot_enable } {
	photRedraw args
    }
}

# DEFINE THE TOPLEVEL MENUS

set filesMenuDescription {
    { "Select Files"                f.title                              }
    {                               f.line                               }
    {                               f.line                               }
    {                               f.line                               }
    {                               f.line                               }
    { "$ | Files panel ..."         f.exec {
				    set stat [send ufiles getValue]
				    if { $stat == "no" } {
					send client gkey \$
				    }
				    }                                    }
    {                               f.line                               }
    {                               f.line                               }
    { "n | Next image"              f.exec "send client gkey n"          }
    { "p | Previous image"          f.exec "send client gkey p"          }
    {                               f.line                               }
    {                               f.line                               }
    { "] | Next objects file"       f.exec { send client gkey \] }       }
    { "[ | Previous objects file"   f.exec { send client gkey \[ }       }
    {                               f.line                               }
    {                               f.line                               }
    { {[yes [send ulogresults getValue]] ? "  | Disable logging" : \
                                           "  | Enable logging"          }
                                    f.exec {
				    if { [send ulogresults getValue] == "no" } {
				        send client gcmd logresults yes
				    } else {
				        send client gcmd logresults no
				    }
				    }                                    } 
    {                               f.line                               }
    {                               f.line                               }
    { "  | Help ..."                f.exec {
				    helpMove helpText #gfmenu args
				    if { [send uhelp getValue] == "no" } {
				        send client gkey ?
				    }
				    }                                    }
}; createMenu filesMenu imagefilesButton $filesMenuDescription

set imviewMenuDescription {
    { "Display Images"                   f.title                              }
    {                                    f.line                               }
    {                                    f.line                               }
    {                                    f.line                               }
    {                                    f.line                               }
    { "n | Next image"                   f.exec "send client gkey n"          }
    { "p | Previous image"               f.exec "send client gkey p"          }
    {                                    f.line                               }
    {                                    f.line                               }
    { "  | Dispars pset ..."             f.exec "winMap xguiphot_dispars"     }
    { "i | Current image"                f.exec "send client gkey i"          }
    {                                    f.line                               }
    {                                    f.line                               }
    { "  | Impars pset ..."              f.exec "winMap xguiphot_impars"      }
    { {[yes [send uheader getValue]] ? "h | Dismiss header" : \
                                       "h | Display header ..."               }
                                         f.exec "send client gkey h"          } 
    {                                    f.line                               }
    {                                    f.line                               }
    { "x | Compute model fit ..."        f.exec {
	                      set text "Move to object of interest and type x:"
                              gtermStatusLine imagedisplayWindow $text
					 }                                    }
    { {[yes [send umplots getValue]] ? "y | Dismiss model plot" : \
                                       "y | Show model fit ..."               }
                                         f.exec {
					 if {[send umplots getValue] == "yes"} {
					    send client gkey y
					 } else {
	                      set text "Move to object of interest and type y:"
                              gtermStatusLine imagedisplayWindow $text
					 }
					 }                                    } 
    {                                    f.line                               }
    {                                    f.line                               }
    { "  | Options"                      f.menu imdisplayMenu                 }
    {                                    f.line                               }
    {                                    f.line                               }
    { "  | Help ..."                     f.exec {
                                         helpMove helpText #gimenu args
					 if { [send uhelp getValue] == "no" } {
						send client gkey ?
					 }
					 }                                    }
};  createMenu imviewMenu imageviewButton $imviewMenuDescription


set imfindMenuDescription {
    { "Create List"                      f.title                              }
    {                                    f.line                               }
    {                                    f.line                               }
    {                                    f.line                               }
    {                                    f.line                               }
    { "l | List panel ..."               f.exec {
					     set stat [send uobjects getValue]
					     if { $stat == "no"} {
    					         send client gkey l
					     }
					 }                                    }
    {                                    f.line                               }
    {                                    f.line                               }
    { "] | Next file"                    f.exec { send client gkey \] }       }
    { "[ | Previous file"                f.exec { send client gkey \[ }       }
    { "r | Current file"                 f.exec "send client gkey r"          }
    {                                    f.line                               }
    {                                    f.line                               }
    { "  | Impars pset ..."              f.exec "winMap xguiphot_impars"      }
    { "  | Findpars pset ..."            f.exec "winMap xguiphot_findpars"    }
    { "@ | Find list"                    f.exec "send client gkey @"          }
    {                                    f.line                               }
    {                                    f.line                               }
    { "  | Draw list ..."                f.exec {
                                             send client gkey z
                                             send client gkey a
					 }                                    }
    {                                    f.line                               }
    {                                    f.line                               }
    { "  | Omarkpars pset ..."           f.exec "winMap xguiphot_omarkpars"   }
    { "m | Mark list"                    f.exec "send client gkey m"          }
    { "e | Erase list"                   f.exec "send client gkey e"          }
    {                                    f.line                               }
    {                                    f.line                               }
    { "  | Help ..."                     f.exec {
                                         helpMove helpText #glmenu args
					 if { [send uhelp getValue] == "no" } {
						send client gkey ?
					 }
					 }                                    }
}; createMenu imfindMenu imagefindButton $imfindMenuDescription


set displayMenuDescription {
    { "Image Window Menu"                f.title                              }
    {                                    f.line                               }
    {                                    f.line                               }
    {                                    f.line                               }
    {                                    f.line                               }
    { "Sp | Point and measure"           f.exec "send client gkey \\040 "     }
    { ".  | Measure nearest in list"     f.exec "send client gkey ."          }
    {                                    f.line                               }
    {                                    f.line                               }
    { "~  | Find nearest in list"        f.exec "send client gkey \~"         }
    { "d  | Delete nearest in list"      f.exec "send client gkey d"          }
    { "u  | Undelete nearest in list"    f.exec "send client gkey u"          }
    {                                    f.line                               }
    {                                    f.line                               }
    { {$phot_enable ? "   | Dismiss phot marker" : "   | Show phot marker"}
                                         f.exec {
			    send imagedisplayWindow getCursorPos x y
			    togglePhotmarker imagedisplayWindow $x $y
			                 }                                    }
    { {$sky_enable ? "   | Offset photsky marker" : "   | Align photsky marker"}
                                         f.exec {
			    send imagedisplayWindow getCursorPos x y
			    photskyMarker imagedisplayWindow $x $y
			                 }                                    }
    { {$sky_enable ? "   | Set annuluar sky" : "   | Set offset sky"          }
                                         f.exec {
					    if { $sky_enable } {
					     send client gcmd smode concentric
					    } else {
					     send client gcmd smode offset
					    }
			                 }                                    }
    {                                    f.line                               }
    {                                    f.line                               }
    { "x  | Compute model fit"           f.exec "send client gkey x"          }
    { {[yes [send umplots getValue]] ? "y  | Dismiss model plot" : \
                                       "y  | Show model plot ..."             }
                                         f.exec "send client gkey y"          } 
    {                                    f.line                               }
    {                                    f.line                               }
    { "   | Help ..."                     f.exec {
                                         helpMove helpText #gmousemenu args
					 if { [send uhelp getValue] == "no" } {
						send client gkey ?
					 }
					 }                                    }
}; createMenu displayMenu imagedisplayWindow $displayMenuDescription

set imdisplayMenuDescription {
    { "Image Window Options"             f.title                              }
    {                                    f.line                               }
    {                                    f.line                               }
    {                                    f.line                               }
    {                                    f.line                               }
    { {$crosshairId ? "Dismiss crosshair" : "Show crosshair"}
                                         f.exec toggleCrosshair               }
    { {$imtitle_enable ? "Dismiss files marker" : "Show files marker"}
                                         f.exec toggleImtitle                 } 
    { {$track_enable ? "Dismiss coords marker" : "Show coords marker"}
                                         f.exec toggleTrack                   } 
    {"Clear status line"               f.exec {
					     send client gkey \r
					 }                                    }
}; createMenu imdisplayMenu imviewMenu $imdisplayMenuDescription


set objectsMenuDescription {
    { "Edit List"                             f.title                         }
    {                                         f.line                          }
    {                                         f.line                          }
    {                                         f.line                          }
    {                                         f.line                          }
    { "l | List panel ..."                    f.exec {
					      set stat [send uobjects getValue]
					      if { $stat == "no"} {
    					             send client gkey l
					      }
					      }                               }
    { {$obj_enable ? "  | Dismiss object marker" : "  | Show object marker"}
                                         f.exec "toggleObjects"               }
    {                                         f.line                          }
    {                                         f.line                          }
    { "^ | Rewind list"                       f.exec "send client gkey ^"     }
    { "f | Next object"                       f.exec "send client gkey f"     }
    { "b | Previous object"                   f.exec "send client gkey b"     }
    { "~ | Nearest object ..."                f.exec {
	   set text "Move to object of interest and type ~:"
           gtermStatusLine imagedisplayWindow $text
					      }                               }
    {                                         f.line                          }
    {                                         f.line                          }
    { "a | Add object(s) ..."                 f.exec {
	   send client gkey a
					      }                               }
    { "d | Delete object(s) ..."              f.exec {
	   set text "Move to object(s) to be deleted and type d:"
           gtermStatusLine imagedisplayWindow $text
					      }                               }
    { "u | Undelete object(s) ..."            f.exec {
	   set text "Move to object(s) to be undeleted and type u:"
           gtermStatusLine imagedisplayWindow $text
					      }                               }
    {                                         f.line                          }
    {                                         f.line                          }
    { "z | Delete list"                       f.exec "send client gkey z"     }
    {                                         f.line                          }
    {                                         f.line                          }
    { "  | Help ..."                     f.exec {
                                         helpMove helpText #gemenu args
					 if { [send uhelp getValue] == "no" } {
						send client gkey ?
					 }
					 }                                    }
} ; createMenu objectsMenu imageobjectsButton $objectsMenuDescription

createMenu parametersMenu imageparametersButton {
    {    "Edit Psets"                    f.title                              }
    {                                    f.line                               }
    {                                    f.line                               }
    {                                    f.line                               }
    {                                    f.line                               }
    {    "Edit"                          f.menu psetmapMenu                   }
    {                                    f.line                               }
    {                                    f.line                               }
    {    "Apply"                         f.menu psetapplyMenu                 }
    {    "Cancel"                        f.menu psetcancelMenu                }
    {    "Unlearn"                       f.menu psetunlearnMenu               }
    {    "Update"                        f.menu psetsaveMenu                  }
    {                                    f.line                               }
    {                                    f.line                               }
    {    "Dismiss"                       f.menu psetunmapMenu                 }
    {                                    f.line                               }
    {                                    f.line                               }
    {    "Help ..."                      f.exec {
	                                 helpMove helpText #gpsmenu
				         if { [send uhelp getValue] == "no"  } {
					    send client gkey ?
				         }
				         }                                    }
}

createMenu psetmapMenu parametersMenu {
    {    "Edit List"                    f.title                              }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "All ..."                      f.exec {
					    winMap xguiphot_impars
					    winMap xguiphot_dispars
					    winMap xguiphot_findpars
					    winMap xguiphot_omarkpars
					    winMap xguiphot_cenpars
					    winMap xguiphot_skypars
					    winMap xguiphot_photpars
					    winMap xguiphot_eplotpars
					    winMap xguiphot_aplotpars
					}                                    }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Impars ..."                   f.exec "winMap xguiphot_impars"      }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Dispars ..."                  f.exec "winMap xguiphot_dispars"    }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Findpars ..."                 f.exec "winMap xguiphot_findpars"    }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Omarkpars ..."                f.exec "winMap xguiphot_omarkpars"   }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Cenpars ..."                  f.exec "winMap xguiphot_cenpars"     }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Skypars ..."                  f.exec "winMap xguiphot_skypars"     }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Photpars ..."                 f.exec "winMap xguiphot_photpars"    }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Eplotpars ..."                f.exec "winMap xguiphot_eplotpars"   }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Aplotpars ..."                f.exec "winMap xguiphot_aplotpars"   }
}

createMenu psetapplyMenu parametersMenu {
    {    "Apply List"                   f.title                              }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "All"                          f.exec {
					     imparsUpdateCallback
					     disparsUpdateCallback
					     findparsUpdateCallback
					     omarkparsUpdateCallback
					     cenparsUpdateCallback
					     skyparsUpdateCallback
					     photparsUpdateCallback
					     eplotparsUpdateCallback
					     aplotparsUpdateCallback
					}                                    }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Impars"                       f.exec imparsUpdateCallback          }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Dispars"                      f.exec findparsUpdateCallback        }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Findpars"                     f.exec disparsUpdateCallback        }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Omarkpars"                    f.exec omarkparsUpdateCallback       }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Cenpars"                      f.exec cenparsUpdateCallback         }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Skypars"                      f.exec skyparsUpdateCallback         }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Photpars"                     f.exec photparsUpdateCallback        }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Eplotpars"                    f.exec eplotparsUpdateCallback       }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Aplotpars"                    f.exec aplotparsUpdateCallback       }
}

createMenu psetcancelMenu parametersMenu {
    {    "Cancel List"                  f.title                              }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "All"                          f.exec {
					     imparsRestoreCallback
					     disparsRestoreCallback
					     findparsRestoreCallback
					     omarkparsRestoreCallback
					     cenparsRestoreCallback
					     skyparsRestoreCallback
					     photparsRestoreCallback
					     eplotparsRestoreCallback
					     aplotparsRestoreCallback
					}                                    }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Impars"                       f.exec imparsRestoreCallback         }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Dispars"                      f.exec findparsRestoreCallback       }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Findpars"                     f.exec disparsRestoreCallback       }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Omarkpars"                    f.exec omarkparsRestoreCallback      }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Cenpars"                       f.exec cenparsRestoreCallback        }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Skypars"                      f.exec skyparsRestoreCallback        }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Photpars"                     f.exec photparsRestoreCallback       }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Eplotpars"                    f.exec eplotparsRestoreCallback      }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Aplotpars"                    f.exec aplotparsRestoreCallback      }
}

createMenu psetunlearnMenu parametersMenu {
    {    "Unlearn List"                 f.title                              }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "All"                          f.exec {
					     imparsDefaultsCallback
					     disparsDefaultsCallback
					     findparsDefaultsCallback
					     omarkparsDefaultsCallback
					     cenparsDefaultsCallback
					     skyparsDefaultsCallback
					     photparsDefaultsCallback
					     eplotparsDefaultsCallback
					     aplotparsDefaultsCallback
					}                                    }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Impars"                       f.exec imparsDefaultsCallback        }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Dispars"                      f.exec findparsDefaultsCallback      }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Findpars"                     f.exec disparsDefaultsCallback      }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Omarkpars"                    f.exec omarkparsDefaultsCallback     }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Cenpars"                      f.exec cenparsDefaultsCallback       }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Skypars"                      f.exec skyparsDefaultsCallback       }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Photpars"                     f.exec photparsDefaultsCallback      }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Eplotpars"                    f.exec eplotparsDefaultsCallback     }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Aplotpars"                    f.exec aplotparsDefaultsCallback     }
}


createMenu psetsaveMenu parametersMenu {
    {    "Update List"                  f.title                              }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "All"                          f.exec {
					     imparsSaveCallback
					     disparsSaveCallback
					     findparsSaveCallback
					     omarkparsSaveCallback
					     cenparsSaveCallback
					     skyparsSaveCallback
					     photparsSaveCallback
					     eplotparsSaveCallback
					     aplotparsSaveCallback
					}                                    }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Impars"                        f.exec imparsSaveCallback            }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Dispars"                      f.exec findparsSaveCallback          }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Findpars"                     f.exec disparsSaveCallback          }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Omarkpars"                    f.exec omarkparsSaveCallback         }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Cenpars"                      f.exec cenparsSaveCallback           }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Skypars"                      f.exec skyparsSaveCallback           }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Photpars"                     f.exec photparsSaveCallback          }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Eplotpars"                    f.exec eplotparsSaveCallback         }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Aplotpars"                    f.exec aplotparsSaveCallback         }
}


createMenu psetunmapMenu parametersMenu {
    {    "Dismiss List"                 f.title                              }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "All"                          f.exec {
					    winUnmap xguiphot_impars
					    winUnmap xguiphot_dispars
					    winUnmap xguiphot_findpars
					    winUnmap xguiphot_omarkpars
					    winUnmap xguiphot_cenpars
					    winUnmap xguiphot_skypars
					    winUnmap xguiphot_photpars
					    winUnmap xguiphot_eplotpars
					    winUnmap xguiphot_aplotpars
					}                                    }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Impars"                       f.exec "winUnmap xguiphot_impars"    }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Dispars"                      f.exec "winUnmap xguiphot_dispars"  }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Findpars"                     f.exec "winUnmap xguiphot_findpars"  }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Omarkpars"                    f.exec "winUnmap xguiphot_omarkpars" }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Cenpars"                      f.exec "winUnmap xguiphot_cenpars"   }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Skypars"                      f.exec "winUnmap xguiphot_skypars"   }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Photpars"                     f.exec "winUnmap xguiphot_photpars"  }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Eplotpars"                    f.exec "winUnmap xguiphot_eplotpars" }
    {                                   f.line                               }
    {                                   f.line                               }
    {    "Aplotpars"                    f.exec "winUnmap xguiphot_aplotpars" }
}

set photMenuDescription {
    { "Measure Objects"                  f.title                           }
    {                                    f.line                            }
    {                                    f.line                            }
    {                                    f.line                            }
    {                                    f.line                            }
    { "   | Impars pset ..."             f.exec "winMap xguiphot_impars"   }
    { "   | Cenpars pset ..."            f.exec "winMap xguiphot_cenpars"  }
    { "   | Skypars pset..."             f.exec "winMap xguiphot_skypars"  }
    { "   | Photpars pset ..."           f.exec "winMap xguiphot_photpars" }
    { "v  | Draw polygons ..."           f.exec {
	   set text "Move to object(s) and type v:"
           gtermStatusLine imagedisplayWindow $text
					 }                                 }
    {                                    f.line                            }
    {                                    f.line                            }
    { "Sp | Point and measure ..."       f.exec {
	   set text "Move to object(s) and type spbar:"
           gtermStatusLine imagedisplayWindow $text
					 }                                 }
    {                                    f.line                            }
    {                                    f.line                            }
    { "   | Findpars pset ..."           f.exec "winMap xguiphot_findpars" }
    { "*  | Find and measure"            f.exec "send client gkey *"       }
    {                                    f.line                            }
    {                                    f.line                            }
    { "#  | Measure list"                f.exec "send client gkey #"       }
    {                                    f.line                            }
    {                                    f.line                            }
    { "l  | List panel ..."              f.exec {
					     set stat [send uobjects getValue]
					     if { $stat == "no"} {
    					         send client gkey l
					     }
					 }                                 }
    { {$obj_enable ? "   | Dismiss object marker" : "   | Show object marker"}
                                         f.exec "toggleObjects"            }
    { "^  | Rewind list"                 f.exec "send client gkey ^"       }
    { "o  | Measure next"                f.exec "send client gkey o"       }
    { "+  | Measure rest of"             f.exec "send client gkey +"       }
    { "-  | Measure previous"            f.exec "send client gkey -"       }
    { ".  | Measure nearest ..."         f.exec {
	   set text "Move to list object(s) and type .:"
           gtermStatusLine imagedisplayWindow $text
					 }                                 }
    {                                    f.line                            }
    {                                    f.line                            }
    { "   | Help ..."                    f.exec {
                                         helpMove helpText #gpmenu args
					 if { [send uhelp getValue] == "no" } {
						send client gkey ?
					 }
					 }                                }
} ; createMenu photMenu imagephotButton $photMenuDescription

set resultsMenuDescription {
    {    "Display Results"          f.title                                   }
    {                               f.line                                    }
    {                               f.line                                    }
    {                               f.line                                    }
    {                               f.line                                    }
    { {[yes [send ulogresults getValue]] ? "   | Disable logging" : \
                                           "   | Enable logging"               }
                                     f.exec {
				    if { [send ulogresults getValue] == "no" } {
				        send client gcmd logresults yes
				     } else {
				        send client gcmd logresults no
				     }
				     }                                        } 
    {                                f.line                                   }
    {                                f.line                                   }
    {    "CR | Clear status line"    f.exec {
                                     send client gkey \r
				     }                                        }
    {    ";  | Display last result"  f.exec {
                                     send client gkey \;
				     send client gkey G
				     }                                        }
    {                                f.line                                   }
    {                                f.line                                   }
    { {[bparval ucenpars] ?          "   | Disable ctrmark" : \
                                     "   | Enable ctrmark"                    }
                                     f.exec {
				     if { [bparval ucenpars] == "0" } {
				         send client gcmd ctrmark yes
				     } else {
				         send client gcmd ctrmark no
				     }
				     }                                        } 
    { {[bparval uskypars] ?          "   | Disable skymark" : \
                                     "   | Enable skymark"                    }
                                     f.exec {
				     if { [bparval uskypars] == "0" } {
				         send client gcmd skymark yes
				     } else {
				         send client gcmd skymark no
				     }
				     }                                        } 
    { {[bparval uphotpars] ?         "   | Disable photmark" : \
                                     "   | Enable photmark"                   }
                                     f.exec {
				     if { [bparval uphotpars] == "0" } {
				         send client gcmd photmark yes
				     } else {
				         send client gcmd photmark no
				     }
				     }                                        } 
    {                                f.line                                   }
    {                                f.line                                   }
    {    "t  | Photometry table ..." f.exec {
				     set stat [send uresults getValue]
				     if { $stat == "no" } {
				 	 send client gkey t
				     }
				     }                                        }
    {                                f.line                                   }
    {                                f.line                                   }
    {    "g  | Photometry plots ..." f.exec "send client gkey g"              }
    {    "   | Eplotpars ..."        f.exec "winMap xguiphot_eplotpars"       }
    {    "   | Aplotpars ..."        f.exec "winMap xguiphot_aplotpars"       }
    {                                f.line                                   }
    {                                f.line                                   }
    {    "   | Help ..."             f.exec {
	                             helpMove helpText #grmenu
				     if { [send uhelp getValue] == "no"  }    {
					    send client gkey ?
				     }
				     }                                        }
} ; createMenu resultsMenu imageresultsButton $resultsMenuDescription


# DEFINE THE TOPLEVEL SHELL CALLBACKS

proc windowColormap { x y } \
{
    set winWidth [send imagedisplayWindow get width]
    set winHeight [send imagedisplayWindow get height]

    send imagedisplayWindow loadColormap 1 \
        [expr "$x.0 / $winWidth"] \
        [expr "($y.0 - $winHeight / 2.0) / $winHeight * 10.0"]

    send objregWindow loadColormap 1 \
        [expr "$x.0 / $winWidth"] \
        [expr "($y.0 - $winHeight / 2.0) / $winHeight * 10.0"]

    send skyregWindow loadColormap 1 \
        [expr "$x.0 / $winWidth"] \
        [expr "($y.0 - $winHeight / 2.0) / $winHeight * 10.0"]
}

proc gtermStatusLine { widget text } {
    set width [send $widget getDialogTextSize $text cwidth cheight cbase]
    send $widget eraseDialog
    send $widget drawDialogText 0 $cbase $text
}

proc imagehelpButtonCallback args {
    helpMove helpText #guirun args
    send client gkey ?
}
send imagehelpButton addCallback imagehelpButtonCallback

proc imagequitButtonCallback args {
    winUnmap xguiphot_help
    winUnmap xguiphot_tutorial
    winUnmap xguiphot_files
    winUnmap xguiphot_imheader
    winUnmap xguiphot_objmodel
    winUnmap xguiphot_impars
    winUnmap xguiphot_dispars
    winUnmap xguiphot_findpars
    winUnmap xguiphot_omarkpars
    winUnmap xguiphot_objlist
    winUnmap xguiphot_cenpars
    winUnmap xguiphot_skypars
    winUnmap xguiphot_photpars
    winUnmap xguiphot_results
    winUnmap xguiphot_ptable
    winUnmap xguiphot_eplotpars
    winUnmap xguiphot_aplotpars
    send imagedisplayWindow freeColormap 1
    send client gkey Q
    deactivate unmap
}
send imagequitButton addCallback imagequitButtonCallback


# DEFINE THE XGUIPHOT_HELP SHELL CALLBACKS

proc uhelpCallback { param old new } {
    if { [yes $new] } {
	winMap xguiphot_help
    } else {
	winUnmap xguiphot_help
    }
}
send uhelp addCallback uhelpCallback

proc uhelplistCallback { param old new } {
    send helpText setText $new
    send helpText retestAnchors 
}
send uhelplist addCallback uhelplistCallback

proc anchorSelected {widget cbtype event text href args} {
    global visited links linkIndex
    set anchID [send helpText anchorToId $href]
    set visited($href) 1
    if {$linkIndex == 0} {
        send helpBack set sensitive True
        if {[lindex $links 1] != $anchID} {
            set links { 0 }
            send helpForward set sensitive False
        }
    }
    if {$linkIndex > 0 && [lindex $links [expr $linkIndex + 1]] != $anchID} {
        set links [lrange $links 0 $linkIndex]
    }
    if {[lindex $links [expr $linkIndex + 1]] != $anchID} {
        lappend links $anchID
        incr linkIndex
    } else {
        send helpForward set sensitive False
        incr linkIndex
    }
    if {$linkIndex == [expr [llength $links] - 1]} {
        send helpForward set sensitive False
    }
    send helpText gotoId $anchID
    send helpText retestAnchors
}
send helpText addCallback anchorSelected anchor

proc helpMove { widget href args } {
    anchorSelected $widget anchor "" "" $href args
}

proc testAnchor {widget cbtype href} {
    global visited
    return [info exists visited($href)]
}
send helpText addCallback testAnchor testAnchor

# Callbacks to position forwards and backwards in link list.
proc hlpForward args {
    global links linkIndex
    incr linkIndex
    if {$linkIndex <= [llength $links]} {
        set anchID [lindex $links $linkIndex]
        send helpText gotoId $anchID
        send helpText retestAnchors
        if {$linkIndex == [expr [llength $links] - 1]} {
            send helpForward set sensitive False
            send helpBack set sensitive True
        } else {
            send helpBack set sensitive True
        }
    } else {
        incr linkIndex -1
    }
}
send helpForward addCallback hlpForward

proc hlpBack args {
    global links linkIndex
    incr linkIndex -1
    if {$linkIndex >= 0} {
        set anchID [lindex $links $linkIndex]
        send helpText gotoId $anchID
        send helpText retestAnchors
        if {$linkIndex == 0} { send helpBack set sensitive False   }
        if {$linkIndex >= 0} { send helpForward set sensitive True }
    } else {
        incr linkIndex 1
    }
}
send helpBack addCallback hlpBack

proc hlpHome args {
    helpMove helpText #guirun args
}
send helpHome addCallback hlpHome

proc hlpToc args {
    helpMove helpText #toc args
}
send helpToc addCallback hlpToc

# Callbacks to position to home.
proc clearAnchor args { return 0 }

# Experimental clear links code, did not work.
proc resetAnchors args {
    global links linkIndex visited
    unset visited
    send helpText retestAnchors
    set links { 0 }
    set linkIndex  0
    set visited(0) empty
    send helpForward set sensitive False
    send helpBack set sensitive False
}
send helpReset addCallback resetAnchors

proc helpHelp args {
    helpMove helpText #hpanel args
}
send helpHelp addCallback helpHelp

proc helpClose args {
    set mode [send ucursor getValue]
    if { $mode == "" || $mode == "imageplot" } {
        send client gkey ?
    } elseif { $mode == "modelplot" } {
	send client gkey q 
        send client gkey ?
	send client gkey \\
	send client gkey Y
    } elsif { $mode == "objregionplot" } {
	send client gkey q 
        send client gkey ?
	send client gkey \\
	send client gkey J
    } elsif { $mode == "skyregionplot" } {
	send client gkey q 
        send client gkey ?
	send client gkey \\
	send client gkey K
    } elsif { $mode == "objectplot" } {
	send client gkey q 
        send client gkey ?
	send client gkey \\
	send client gkey C
    } elsif { $mode == "skyplot" } {
	send client gkey q 
        send client gkey ?
	send client gkey \\
	send client gkey S
    }
}
send helpClose addCallback helpClose


# DEFINE THE XGUIPHOT_TUTORIAL SHELL CALLBACKS

proc ututorCallback { param old new } {
    if { [yes $new] } {
	winMap xguiphot_tutorial
    } else {
	winUnmap xguiphot_tutorial
    }
}
send ututor addCallback ututorCallback

proc ututorlistCallback { param old new } {
    send tutText setText $new
    send tutText retestAnchors 
}
send ututorlist addCallback ututorlistCallback


# DEFINE THE XGUIPHOT_FILES SHELL CALLBACKS

set filestwidgets  { curdirText imdirText imtemplateText ofdirText
    oftemplateText rfdirText rftemplateText gfdirText gftemplateText }

foreach widget $filestwidgets {
    send $widget addEventHandler textDisplayCaret enterWindowMask
    send $widget addEventHandler textDisplayCaret leaveWindowMask
}

set dirlistScrollheight 0
set imlistScrollheight 0
set objectsScrollheight 0

proc fpresizeScrollbar { widget cbtype flags x y w h cw ch } {
    global imlistScrollheight objectsScrollheight dirlistScrollheight
    set newheight [expr $ch - $h]
    if { $widget == "imlistPorthole" } {
        if { $newheight != $imlistScrollheight } {
            send imlistScrollbar setScrollbar 0.0 [expr double($h) / $ch]
            set imlistScrollheight $newheight
        }
    } elseif { $widget == "objectsPorthole" } {
        if { $newheight != $objectsScrollheight } {
            send objectsScrollbar setScrollbar 0.0 [expr double($h) / $ch]
            set objectsScrollheight $newheight
        }
    } elseif { $widget == "dirlistPorthole" } {
        if { $newheight != $dirlistScrollheight } {
            send dirlistScrollbar setScrollbar 0.0 [expr double($h) / $ch]
            set dirlistScrollheight $newheight
        }
    }
}
send dirlistPorthole addCallback fpresizeScrollbar
send imlistPorthole addCallback fpresizeScrollbar
send objectsPorthole addCallback fpresizeScrollbar

proc fpscrollList { widget cbtype pos } {
    global imlistScrollheight objectsScrollheight dirlistScrollheight
    if { $widget == "imlistScrollbar" } {
        send imageList set y [expr -int($imlistScrollheight * $pos)]
    } elseif { $widget == "objectsScrollbar" } {
        send objectsList set y [expr -int($objectsScrollheight * $pos)]
    } elseif { $widget == "dirlistScrollbar" } {
        send dirList set y [expr -int($dirlistScrollheight * $pos)]
    }
}
send dirlistScrollbar addCallback fpscrollList scroll
send imlistScrollbar addCallback fpscrollList scroll
send objectsScrollbar addCallback fpscrollList scroll

proc filesApplyButtonCallback args {
    curdirTextCallback curdirText junk [send curdirText get string]
    imtemplateTextCallback imtemplateText junk [send imtemplateText get string]
    oftemplateTextCallback oftemplateText junk [send oftemplateText get string]
    rftemplateTextCallback rftemplateText junk [send rftemplateText get string]
    gftemplateTextCallback gftemplateText junk [send gftemplateText get string]
}
send filesApplyButton addCallback filesApplyButtonCallback

proc filesCancelButtonCallback args {
    send curdirText set string [send ucurdir getValue]
    send imdirText set string [send uimdir getValue]
    send ofdirText set string [send uofdir getValue]
    send objlistobjdirText set string [send uofdir getValue]
    send rfdirText set string [send urfdir getValue]
    send gfdirText set string [send ugfdir getValue]
    send imtemplateText set string [send uimtemplatestr getValue]
    send oftemplateText set string [send uoftemplatestr getValue]
    send rftemplateText set string [send urftemplatestr getValue]
    send gftemplateText set string [send ugftemplatestr getValue]
}
send filesCancelButton addCallback filesCancelButtonCallback

proc filesDefaultsButtonCallback args {
    send imdirText set string ""
    send ofdirText set string ""
    send objlistobjdirText set string ""
    send rfdirText set string ""
    send gfdirText set string ""
    curdirTextCallback curdirText junk [send ustartdir getValue]
    imtemplateTextCallback imtemplateText junk *
    oftemplateTextCallback oftemplateText junk default
    rftemplateTextCallback rftemplateText junk default
    gftemplateTextCallback gftemplateText junk ""
}
send filesDefaultsButton addCallback filesDefaultsButtonCallback

proc filesHelpButtonCallback args {
    helpMove helpText #fpanel args
    if { [send uhelp getValue] == "no" } {
	send client gkey ?
    }
}
send filesHelpButton addCallback filesHelpButtonCallback

proc filesCloseButtonCallback args {
    send client gkey \$
}
send filesCloseButton addCallback filesCloseButtonCallback


#     DEFINE THE XGUIPHOT_FILES SHELL DIRECTORY LIST CALLBACKS

proc ucurdirCallback { param old new } {
    if { $new != $old } {
	send curdirText set string $new
    }
}
send ucurdir addCallback ucurdirCallback

proc curdirTextCallback { widget cbtype text } {
    set curdir [send ucurdir getValue]
    if { $text != $curdir } {
	send client gcmd chdir $text
        #send client gcmd setdir
    } else {
        send client gcmd setdir
    }
}
send curdirText addCallback curdirTextCallback

proc udirliststrCallback { param old new } {
    if { $new != $old } {
	send dirList setList $new resize
	#send dirList highlight 0
    } elseif { $new == "" } {
	send dirList setList $new  resize
    }
}
send udirliststr addCallback udirliststrCallback

proc dirlistCallback args {
    set subdir [lindex [lindex [send dirList getItem itemno] 0] 0]
    set itemno [lindex $itemno 0]
    if { $itemno == "none" } {
	# send dirList highlight 0
    } else {
	send client gcmd chdir $subdir
    }
}
send dirList addCallback dirlistCallback

#     DEFINE THE XGUIPHOT_FILES SHELL IMAGE LIST CALLBACKS

proc uimtemplatestrCallback { param old new } {
    set dir [send imdirText get string]
    set text [format "%s%s" $dir [send imtemplateText get string]]
    if { $new != $old && $new != $text } {
	if { ! [string match \"$dir*\" $new] } {
	    send imdirText set string ""
	    set dir ""
	}
	send imtemplateText set string $new
    }
}
send uimtemplatestr addCallback uimtemplatestrCallback

proc imdirTextCallback { widget cbtype text } {
    send ofdirText set string $text
    send objlistobjdirText set string $text
    send rfdirText set string $text
    send gfdirText set string $text
}
send imdirText addCallback imdirTextCallback

proc imtemplateTextCallback { widget cbtype text } {
    set dir [send imdirText get string]
    set fname [format "%s%s" $dir $text]
    send uimdir setValue $dir
    send client gcmd images \"$fname\"
}
send imtemplateText addCallback imtemplateTextCallback

proc uimliststrCallback { param old new } {
    if { $new != $old } {
	send imageList setList $new resize
	send imageList highlight 0
	set objects [lindex [lindex [send objectsList getItem itemno]  0] 0]
	set logresults [send ulogresults getValue]
	set results [send urffile getValue]
	set robjects [send ugffile getValue]
	imtitleUpdate [lindex $new 0] $objects $logresults $results $robjects
    } elseif { $new == "" } {
	send imageList setList $new  resize
    }
}
send uimliststr addCallback uimliststrCallback

proc uimnoCallback { param old new } {
    if { $new > 0 } {
	set image [lindex [send uimliststr getValue] [expr "$new - 1"]]
	set objects [lindex [lindex [send objectsList getItem itemno] 0] 0]
	set logresults [send ulogresults getValue]
	set results [send urffile getValue]
	set robjects [send ugffile getValue]
	imtitleUpdate $image $objects $logresults $results $robjects
	send imageList highlight [expr "$new - 1"]
    } else {
	imtitleUpdate "" "" "" "" ""
    }
}
send uimno addCallback uimnoCallback

proc imagelistCallback args {
    set image [lindex [lindex [send imageList getItem itemno] 0] 0]
    set itemno [lindex $itemno 0]
    if { $itemno == "none" } {
	# send imageList highlight 0
    } else {
	set objects [lindex [lindex [send objectsList getItem itemno] 0] 0]
	set logresults [send ulogresults getValue]
	set results [send urffile getValue]
	set robjects [send ugffile getValue]
	imtitleUpdate $image $objects $logresults $results $robjects
	send client gcmd imname $image
    }
}
send imageList addCallback imagelistCallback


#    DEFINE THE XGUIPHOT_FILES SHELL OBJECTS LISTS CALLBACKS

proc uoftemplatestrCallback { param old new } {
    set dir [send ofdirText get string]
    set text [format "%s%s" $dir [send oftemplateText get string]]
    if { $new != $old && $new != $text } {
	if { ! [string match \"$dir*\" $new] } {
	    send ofdirText set string ""
	    send objlistobjdirText set string ""
	}
	send oftemplateText set string $new
    }
}
send uoftemplatestr addCallback uoftemplatestrCallback

proc ofdirTextCallback { widget cbtype text } {
    send objlistobjdirText set string $text
}
send ofdirText addCallback ofdirTextCallback

proc oftemplateTextCallback { widget cbtype text } {
    set dir [send ofdirText get string]
    set fname [format "%s%s" $dir $text]
    send uofdir setValue $dir
    send client gcmd objects \"$fname\"
}
send oftemplateText addCallback oftemplateTextCallback

proc uolliststrCallback { param old new } {
    if { $new != $old } {
	send objectsList setList $new  resize
	send objectsList highlight 0
	set image [lindex [lindex [send imageList getItem itemno] 0] 0]
	set logresults [send ulogresults getValue]
	set results [send urffile getValue]
	set robjects [send ugffile getValue]
	imtitleUpdate $image [lindex $new 0] $logresults $results $robjects
    } elseif { $new == "" } {
	send objectsList setList $new resize
    }
}
send uolliststr addCallback uolliststrCallback

proc uofnoCallback { param old new } {
    set image [lindex [lindex [send imageList getItem itemno] 0] 0]
    set logresults [send ulogresults getValue]
    set results [send urffile getValue]
    set robjects [send ugffile getValue]
    if { $new > 0 } {
	set objects [lindex [send uolliststr getValue] [expr "$new -1"]]
	imtitleUpdate $image $objects $logresults $results $robjects
	send objectsList highlight [expr "$new - 1"]
	send objlistobjinText set string "$objects"
    } else {
	imtitleUpdate $image "" $logresults $results $robjects
	send objlistobjinText set string ""
    }
}
send uofno addCallback uofnoCallback

proc objectlistCallback args {
    set objects [lindex [lindex [send objectsList getItem itemno] 0] 0]
    set itemno [lindex $itemno 0]
    if { $itemno == "none" } {
	#send objectsList highlight 0
    } else {
        set image [lindex [lindex [send imageList getItem itemno] 0] 0]
	set logresults [send ulogresults getValue]
        set results [send urffile getValue]
        set robjects [send ugffile getValue]
	imtitleUpdate $image $objects $logresults $results $robjects
	send client gcmd olname $objects
    }
}
send objectsList addCallback objectlistCallback

#    DEFINE THE XGUIPHOT_FILES SHELL RESULTS LISTS CALLBACKS

proc rflogCallback args {
    if { [send rflogButton get label] == "Yes"} {
	send client gcmd logresults no
    } else {
	send client gcmd logresults yes
    }
}
send rflogButton addCallback rflogCallback

proc urftemplatestrCallback { param old new } {
    set dir [send rfdirText get string]
    set text [format "%s%s" $dir [send rftemplateText get string]]
    if { $new != $old && $new != $text } {
	if { ! [string match \"$dir*\" $new] } {
	    send rfdirText set string ""
	}
	send rftemplateText set string $new
    }
}
send urftemplatestr addCallback urftemplatestrCallback

proc rfdirTextCallback { widget cbtype text } {
    send gfdirText set string $text
}
send rfdirText addCallback rfdirTextCallback

proc rftemplateTextCallback { widget cbtype text } {
    set dir [send rfdirText get string]
    set fname [format "%s%s" $dir $text]
    send urfdir setValue $dir
    send client gcmd results \"$fname\"
}
send rftemplateText addCallback rftemplateTextCallback

proc urffileCallback { param old new } {
    if { $new != $old } {
        send fresultsText set string $new
        set image [lindex [lindex [send imageList getItem itemno] 0] 0]
        set objects [lindex [lindex [send objectsList getItem itemno] 0] 0]
	set logresults [send ulogresults getValue]
        set robjects [send ugffile getValue]
	imtitleUpdate $image $objects $logresults $new $robjects
    }
}
send urffile addCallback urffileCallback

#    DEFINE THE XGUIPHOT_FILES SHELL ROBJECTS LISTS CALLBACKS

proc ugftemplatestrCallback { param old new } {
    set dir [send gfdirText get string]
    set text [format "%s%s" $dir [send gftemplateText get string]]
    if { $new != $old && $new != $text } {
	if { ! [string match \"$dir*\" $new] } {
	    send gfdirText set string ""
	}
	send gftemplateText set string $new
    }
}
send ugftemplatestr addCallback ugftemplatestrCallback

proc gfdirTextCallback { widget cbtype text } {
}
send gfdirText addCallback gfdirTextCallback

proc gftemplateTextCallback { widget cbtype text } {
    set dir [send gfdirText get string]
    set fname [format "%s%s" $dir $text]
    send ugfdir setValue $dir
    send client gcmd robjects \"$fname\"
}
send gftemplateText addCallback gftemplateTextCallback

proc ugffileCallback { param old new } {
    if { $new != $old } {
        send frobjectsText set string $new
        set image [lindex [lindex [send imageList getItem itemno] 0] 0]
        set objects [lindex [lindex [send objectsList getItem itemno] 0] 0]
	set logresults [send ulogresults getValue]
        set results [send urffile getValue]
	imtitleUpdate $image $objects $logresults $results $new
    }
}
send ugffile addCallback ugffileCallback

proc ufilesCallback { param old new } {
    if { [yes $new] } {
	winMap xguiphot_files
    } else {
	winUnmap xguiphot_files
    }
}
send ufiles addCallback ufilesCallback

# DEFINE THE DISPLAYPARS SHELL CALLBACKS

proc disparsUpdateCallback args {
    send client gcmd save dispars no
    send client gcmd derase [send deraseValue get label]
    send client gcmd dfill [send dfillValue get label]
    send client gcmd dxviewport [send dxviewportValue get string]
    send client gcmd dyviewport [send dyviewportValue get string]
    send client gcmd dxmag [send dxmagValue get string]
    send client gcmd dymag [send dymagValue get string]
    send client gcmd dztransform [send dztransformValue get label]
    send client gcmd dzlimits [send dzlimitsValue get label]
    send client gcmd dzcontrast [send dzcontrastValue get string]
    send client gcmd dznsample [send dznsampleValue get string]
    send client gcmd dz1 [send dz1Value get string]
    send client gcmd dz2 [send dz2Value get string]
    send client gcmd dlutfile \"[send dlutfileValue get string]\"
    send client gcmd drepeat [send drepeatValue get label]
    send client gcmd save dispars yes
}
send disparsUpdateButton addCallback disparsUpdateCallback

proc disparsRestoreCallback args {
    send udispars setValue [send udispars getValue]
}
send disparsRestoreButton addCallback disparsRestoreCallback

proc disparsDefaultsCallback args {
    send client gcmd unlearn dispars
}
send disparsDefaultsButton addCallback disparsDefaultsCallback

proc disparsSaveCallback args {
    send client gcmd update dispars
}
send disparsSaveButton addCallback disparsSaveCallback

set disparstwidgets {
    dxviewportValue dyviewportValue dxmagValue dymagValue dzcontrastValue
    dznsampleValue dz1Value dz2Value dlutfileValue
}
proc disparsTextCallback { widget args } {
    send $widget set foreground white
    send disparsUpdateButton set foreground white
}
foreach widget $disparstwidgets {
    send $widget addCallback disparsTextCallback
}
foreach widget $disparstwidgets {
    send $widget addEventHandler textDisplayCaret enterWindowMask
    send $widget addEventHandler textDisplayCaret leaveWindowMask
}

set disparscwidgets {
    deraseValue dfillValue drepeatValue
}
proc disparsComCallback { widget args } {
    if {[send $widget get label] == "no"} {
        send $widget set label yes
    } else {
        send $widget set label no
    }
    send $widget set foreground white
    send disparsUpdateButton set foreground white
}
foreach widget $disparscwidgets {
    send $widget addCallback disparsComCallback
}

proc udisparsCallback { param old new } {
    foreach pd $new {
	# set opd [lsearch $old $pd]
	# if { $opd >= 0 } continue
        switch [lindex $pd 0] {
        derase          {
			  send deraseValue set foreground black
			  send deraseValue set label [lindex $pd 1]
			}
        dfill           {
			  send dfillValue set foreground black
			  send dfillValue set label [lindex $pd 1]
			}
        dxviewport      {
			  send dxviewportValue set foreground black
			  send dxviewportValue set string [lindex $pd 1]
			}
        dyviewport      {
			  send dyviewportValue set foreground black
			  send dyviewportValue set string [lindex $pd 1]
			}
        dxmag           {
			  send dxmagValue set foreground black
			  send dxmagValue set string [lindex $pd 1]
			}
        dymag           {
			  send dymagValue set foreground black
			  send dymagValue set string [lindex $pd 1]
			}
        dztransform     {
			  send dztransformValue set foreground black
			  send dztransformValue set label [lindex $pd 1]
			}
        dzlimits        {
			  send dzlimitsValue set foreground black
			  send dzlimitsValue set label [lindex $pd 1]
			}
        dzcontrast      {
			  send dzcontrastValue set foreground black
			  send dzcontrastValue set string [lindex $pd 1]
			}
        dznsample       {
			  send dznsampleValue set foreground black
			  send dznsampleValue set string [lindex $pd 1]
			}
        dz1             {
			  send dz1Value set foreground black
			  send dz1Value set string [lindex $pd 1]
			}
        dz2             {
			  send dz2Value set foreground black
			  send dz2Value set string [lindex $pd 1]
			}
        dlutfile        {
			  send dlutfileValue set foreground black
			  send dlutfileValue set string [lindex $pd 1]
			}
        drepeat         {
			  send drepeatValue set foreground black
			  send drepeatValue set label [lindex $pd 1]
			}
	}
    }
    send disparsUpdateButton set foreground black
}
send udispars addCallback udisparsCallback

createMenu dztransformMenu dztransformValue {
    {   "Greylevel Transformation"            f.title                    }
    {			f.line                                           }
    {			f.line                                           }
    {			f.line                                           }
    {			f.line                                           }
    {   Linear          f.exec {
			    send dztransformValue set foreground white
			    send dztransformValue set label linear
    			    send disparsUpdateButton set foreground white
			}                                                }
    {			f.line                                           }
    {			f.line                                           }
    {   Log             f.exec {
			    send dztransformValue set foreground white
			    send dztransformValue set label log
    			    send disparsUpdateButton set foreground white
			}                                                }
    {			f.line                                           }
    {			f.line                                           }
    {   None            f.exec {
			    send dztransformValue set foreground white
			    send dztransformValue set label none
    			    send disparsUpdateButton set foreground white
			}                                                }
    {			f.line                                           }
    {			f.line                                           }
    {   User            f.exec {
			    send dztransformValue set foreground white
			    send dztransformValue set label user
    			    send disparsUpdateButton set foreground white
			}                                                }
}

createMenu dzlimitsMenu dzlimitsValue {
    {   "Greylevel Limits"            f.title                            }
    {			f.line                                           }
    {			f.line                                           }
    {			f.line                                           }
    {			f.line                                           }
    {   Median          f.exec {
			    send dzlimitsValue set foreground white
			    send dzlimitsValue set label median
    			    send disparsUpdateButton set foreground white
			}                                                }
    {			f.line                                           }
    {			f.line                                           }
    {   Image           f.exec {
			    send dzlimitsValue set foreground white
			    send dzlimitsValue set label image
    			    send disparsUpdateButton set foreground white
			}                                                }
    {			f.line                                           }
    {			f.line                                           }
    {   User            f.exec {
			    send dzlimitsValue set foreground white
			    send dzlimitsValue set label user
    			    send disparsUpdateButton set foreground white
			}                                                }
}

proc disparsDisplayCallback args {
    disparsUpdateCallback
    send client gkey i
}
send disparsDisplayButton addCallback disparsDisplayCallback

proc disparsHelpCallback args {
    helpMove helpText #dispars args
    if { [send uhelp getValue] == "no" } {
	send client gkey ?
    }
}
send disparsHelpButton addCallback disparsHelpCallback

proc disparsCloseCallback args {
    send xguiphot_dispars unmap
}
send disparsCloseButton addCallback disparsCloseCallback


#  DEFINE THE IMAGE HEADER SHELL CALLBACKS

set hdrScrollheight 0
set hdrScrollwidth 0

proc hdrresizeScrollbar { widget cbtype flags x y w h cw ch } {
    global hdrScrollheight hdrScrollwidth
    set newheight [expr $ch - $h]
    set newwidth [expr $cw - $w]
    if { $widget == "hdrPorthole" } {
	if { $newheight != $hdrScrollheight } {
            send hdrScrollbarv setScrollbar 0.0 [expr double($h) / $ch]
            set hdrScrollheight $newheight
	}
	if { $newwidth != $hdrScrollwidth } {
            send hdrScrollbarh setScrollbar 0.0 [expr double($w) / $cw]
            set hdrScrollwidth $newwidth
	}
    }
}
send hdrPorthole addCallback hdrresizeScrollbar

proc hdrscrollList { widget cbtype pos } {
    global hdrScrollheight hdrScrollwidth
    if { $widget == "hdrScrollbarv" } {
        send hdrList set y [expr -int($hdrScrollheight * $pos)]
    } elseif { $widget == "hdrScrollbarh" } {
        send hdrList set x [expr -int($hdrScrollwidth * $pos)]
    }
}
send hdrScrollbarv addCallback hdrscrollList scroll
send hdrScrollbarh addCallback hdrscrollList scroll

proc uheaderCallback { param old new } {
    global track_enable imviewMenuDescription
    if { [yes $new] } {
	winMap xguiphot_imheader
    } else {
	winUnmap xguiphot_imheader
    }
    editMenu imviewMenu imageviewButton $imviewMenuDescription
}
send uheader addCallback uheaderCallback

proc uhdrlistCallback { param old new } {
    set imno [send uimno getValue]
    if { $imno > 0 } {
	set image [lindex [send uimliststr getValue] [expr "$imno - 1"]]
    } else {
	set image ""
    }
    send hdrTitle set label "Header for Image: $image"
    send hdrList setList $new resize
}
send uhdrlist addCallback uhdrlistCallback

proc imheaderNextCallback args {
    send client gkey n
}
send imheadernextButton addCallback imheaderNextCallback

proc imheaderPrevCallback args {
    send client gkey p
}
send imheaderprevButton addCallback imheaderPrevCallback

proc imheaderHelpCallback args {
    helpMove helpText #hdrpanel
    if { [send uhelp getValue] == "no" } {
	send client gkey ?
    }
}
send imheaderhelpButton addCallback imheaderHelpCallback

proc imheaderCloseCallback args {
    send client gkey h
}
send imheadercloseButton addCallback imheaderCloseCallback

# DEFINE THE XGUIPHOT_SHELL MODEL FITTING CALLBACKS

proc objmodelplotResize args {
    set mode [send ucursor getValue]
    if { $mode == "modelplot" } {
	send client gkey r
	send client gkey p
    } else {
	send client gkey \\
	send client gkey X
    }
}
send objmodelWindow addCallback objmodelplotResize resize

proc objmodelactivateCallback args {
    set mode [send ucursor getValue]
    if { $mode == "modelplot" } {
        send client gkey q
    } else {
        send client gkey \\
        send client gkey Y
    }
}
send objmodelactivateButton addCallback objmodelactivateCallback

proc objmodelsetwidthCallback args {
    send client gkey h
}
send objmodelsetwidthButton addCallback objmodelsetwidthCallback

proc objmodelrefitCallback args {
    send client gkey f
}
send objmodelrefitButton addCallback objmodelrefitCallback

proc objmodelreplotCallback args {
    send client gkey r
}
send objmodelreplotButton addCallback objmodelreplotCallback

proc objmodelresultsCallback args {
    send client gkey p
}
send objmodelresultsButton addCallback objmodelresultsCallback

proc objmodelmomentsCallback args {
    send client gkey m
}
send objmodelmomentsButton addCallback objmodelmomentsCallback

proc objmodelhelpCallback args {
    helpMove helpText #modfitpanel args
    if { [send uhelp getValue] == "no" } {
        set mode [send ucursor getValue]
        if { $mode == "modelplot" } {
	    send client gkey q 
	    send client gkey ? 
	    send client gkey \\
	    send client gkey Y
        } else {
	    send client gkey ?
        }
    }
}
send objmodelhelpButton addCallback objmodelhelpCallback

proc objmodelcloseCallback args {
    send client gkey q
    send client gkey y
}
send objmodelcloseButton addCallback objmodelcloseCallback

proc umplotsCallback { param old new } {
    global track_enable imviewMenuDescription
    global phot_enable sky_enable displayMenuDescription
    if { [yes $new] } {
	winMap xguiphot_objmodel
    } else {
	winUnmap xguiphot_objmodel
    }
    editMenu imviewMenu imageviewButton $imviewMenuDescription
    editMenu displayMenu imagedisplayWindow $displayMenuDescription
}
send umplots addCallback umplotsCallback


# DEFINE THE XGUIPHOT_SHELL OBJECT LISTS VIEWING AND EDITING CALLBACKS

set objlistwidgets  { objlistobjinText objlistenterText objlistobjdirText \
                      objlistobjoutText }

foreach widget $objlistwidgets {
    send $widget addEventHandler textDisplayCaret enterWindowMask
    send $widget addEventHandler textDisplayCaret leaveWindowMask
}

set objScrollheight 0
set objScrollwidth 0

proc objresizeScrollbar { widget cbtype flags x y w h cw ch } {
    global objScrollheight objScrollwidth
    set newheight [expr $ch - $h]
    set newwidth [expr $cw - $w]
    if { $widget == "objlistPorthole" } {
        if { $newheight != $objScrollheight } {
            send objlistScrollbarv setScrollbar 0.0 [expr double($h) / $ch]
            set objScrollheight $newheight
        }
        if { $newwidth != $objScrollwidth } {
            send objlistScrollbarh setScrollbar 0.0 [expr double($w) / $cw]
            set objScrollwidth $newwidth
        }
    }
}
send objlistPorthole addCallback objresizeScrollbar

proc objscrollText { widget cbtype pos } {
    global objScrollheight objScrollwidth
    if { $widget == "objlistScrollbarv" } {
        send objlistList set y [expr -int($objScrollheight * $pos)]
    } elseif { $widget == "objlistScrollbarh" } {
        send objlistList set x [expr -int($objScrollwidth * $pos)]
    }
}
send objlistScrollbarv addCallback objscrollText scroll
send objlistScrollbarh addCallback objscrollText scroll

proc uobjlistCallback { param old new } {
    set olno [send uofno getValue]
    if { $olno > 0 } {
	set objlist [lindex [send uolliststr getValue] [expr "$olno - 1"]]
    } else {
	set objlist ""
    }
    send objlistobjinText set string $objlist
    send objlistList setList $new resize
}
send uobjlist addCallback uobjlistCallback

proc uobjnoCallback { param old new } {
    if { $new == "0"} {
	send objlistList unhighlight
    } else {
	send objlistList highlight [expr "$new - 1"]
    }
}
send uobjno addCallback uobjnoCallback

proc uobjectsCallback { param old new } {
    global obj_enable
    if { [yes $new] } {
	if { $obj_enable } {
	    send objlistmarkerButton set label "Dismiss Marker"
	} else {
	    send objlistmarkerButton set label "Show Marker   "
	}
	winMap xguiphot_objlist
    } else {
	winUnmap xguiphot_objlist
    }
}
send uobjects addCallback uobjectsCallback

proc objlistCallback args {
    send objlistList getItem itemno
    set itemno [lindex $itemno 0]
    if { $itemno != "" } {
        send client gcmd oselect [expr "$itemno+1"]
    }
}
send objlistList addCallback objlistCallback

proc objlistobjinTextCallback { widget cbtype text } {
    set objects [lindex [lindex [send objectsList getItem itemno] 0] 0]
    set itemno [lindex $itemno 0]
    if { $itemno != "none" && $text != $objects } {
        send client gcmd olname \"$text\"
    }
    set objects [lindex [lindex [send objectsList getItem itemno] 0] 0]
    set itemno [lindex $itemno 0]
    if { $itemno != "none" && $text != $objects } {
	send objlistobjinText set string $objects
    }
}
send objlistobjinText addCallback objlistobjinTextCallback

proc objlistRereadCallback args {
    send client gkey r
}
send objlistrereadButton addCallback objlistRereadCallback

proc objlistNextlistCallback args {
    send client gkey \]
    send client gkey r
}
send objlistnextlistButton addCallback objlistNextlistCallback

proc objlistPrevlistCallback args {
    send client gkey \[
    send client gkey r
}
send objlistprevlistButton addCallback objlistPrevlistCallback

proc objlistobjinFindCallback args {
    send client gkey @
}
send objlistobjinFind addCallback objlistobjinFindCallback

proc objlistobjinImparsCallback args {
    winMap xguiphot_impars
}
send objlistobjinImpars addCallback objlistobjinImparsCallback

proc objlistobjinFindparsCallback args {
    winMap xguiphot_findpars
}
send objlistobjinFindpars addCallback objlistobjinFindparsCallback

proc objlistobjinDrawCallback args {
    send client gkey z
    send client gkey a
}
send objlistobjinDraw addCallback objlistobjinDrawCallback


proc objlistOeditCallback args {
   winMap xguiphot_omarkpars
}
send objlistoeditButton addCallback objlistOeditCallback

proc objlistMarkCallback args {
    send client gkey m
}
send objlistmarkButton addCallback objlistMarkCallback

proc objlistEraseCallback args {
    send client gkey e
}
send objlisteraseButton addCallback objlistEraseCallback

proc objlistRewindCallback args {
    send client gkey ^
}
send objlistrewindButton addCallback objlistRewindCallback

proc objlistNextobjCallback args {
    send client gkey f
}
send objlistnextobjButton addCallback objlistNextobjCallback

proc objlistPrevobjCallback args {
    send client gkey b
}
send objlistprevobjButton addCallback objlistPrevobjCallback

proc objlistmarkerCallback args {
    toggleObjects
}
send objlistmarkerButton addCallback objlistmarkerCallback

proc objlistinitCallback args {
    send client gkey z
}
send objlistinitButton addCallback objlistinitCallback

proc objlistdeleteCallback args {
    send objlistList getItem itemno
    set itemno [lindex $itemno 0]
    if { $itemno != "" } {
        send client gcmd odelete [expr "$itemno+1"]
    }
}
send objlistdeleteButton addCallback objlistdeleteCallback

proc objlistundeleteCallback args {
    send objlistList getItem itemno
    set itemno [lindex $itemno 0]
    if { $itemno != "" } {
        send client gcmd oundelete [expr "$itemno+1"]
    }
}
send objlistundeleteButton addCallback objlistundeleteCallback

proc objlistaddCallback args {
    send client gkey a
}
send objlistaddButton addCallback objlistaddCallback



proc objlistenterTextCallback { widget cbtype text } {
    send client gcmd oadd $text 
}
send objlistenterText addCallback objlistenterTextCallback

proc objlistenterCallback args {
    set text [send objlistenterText get string]
    send client gcmd oadd $text 
}
send objlistenterButton addCallback objlistenterCallback

proc objlistclearCallback args {
    send objlistenterText set string ""
}
send objlistclearButton addCallback objlistclearCallback


proc objcenparsCallback args {
    winMap xguiphot_cenpars
}
send objcenparsButton addCallback objcenparsCallback

proc objskyparsCallback args {
    winMap xguiphot_skypars
}
send objskyparsButton addCallback objskyparsCallback

proc objphotparsCallback args {
    winMap xguiphot_photpars
}
send objphotparsButton addCallback objphotparsCallback

proc objlogCallback args {
    if { [send objlogButton get label] == "Yes"} {
	send client gcmd logresults no
    } else {
	send client gcmd logresults yes
    }
}
send objlogButton addCallback objlogCallback

proc objphotcurrentCallback args {
    send objlistList getItem itemno
    set itemno [lindex $itemno 0]
    if { $itemno != "" } {
        send client gcmd oselect [expr "$itemno+1"]
	send client gkey .
    }
}
send objphotcurrentButton addCallback objphotcurrentCallback

proc objphotnextCallback args {
    send client gkey o
}
send objphotnextButton addCallback objphotnextCallback

proc objphotprevCallback args {
    send client gkey -
}
send objphotprevButton addCallback objphotprevCallback

proc objphotrestofCallback args {
    send client gkey +
}
send objphotrestofButton addCallback objphotrestofCallback

proc objphotallCallback args {
    send client gkey #
}
send objphotallButton addCallback objphotallCallback


proc objlistoutCallback { widget cbtype text } {
    set dir [send objlistobjdirText get string]
    #if { $text == "default" } {
	#send client gcmd osave $dir
    #} else {
	send client gcmd osave [format "%s%s" $dir $text]
    #}
}
send objlistobjoutText addCallback objlistoutCallback

proc objlistsaveCallback args {
    set dir [send objlistobjdirText get string]
    set text [send objlistobjoutText get string]
    #if { $text == "default" } {
	#send client gcmd osave $dir
    #} else {
	send client gcmd osave [format "%s%s" $dir $text]
    #}
}
send objlistsaveButton addCallback objlistsaveCallback

#proc objlistPhotbuttonCallback args {
    #if { [send objlistphotButton get label] == "Enable  Photometry" } {
	#send objlistphotButton set label "Disable Photometry"
    #} else {
	#send objlistphotButton set label "Enable  Photometry"
    #}
#}
#send objlistphotButton addCallback objlistPhotbuttonCallback

proc objlistHelpCallback args {
    helpMove helpText #lpanel args
    if { [send uhelp getValue] == "no" } {
        send client gkey ?
    }
}
send objlisthelpButton addCallback objlistHelpCallback

proc objlistCloseCallback args {
    send client gkey l
}
send objlistcloseButton addCallback objlistCloseCallback


# DEFINE THE OBJPARS_SHELL CALLBACKS

proc omarkparsUpdateCallback args {
    send client gcmd save omarkpars no
    send client gcmd objmark [send objmarkValue get label]
    send client gcmd otolerance [send otoleranceValue get string]
    send client gcmd ocharmark [send ocharmarkValue get label]
    send client gcmd onumber [send onumberValue get label]
    send client gcmd opcolormark [send opcolormarkValue get label]
    send client gcmd oscolormark [send oscolormarkValue get label]
    send client gcmd osizemark [send osizemarkValue get string]
    send client gcmd save omarkpars yes
}
send omarkparsUpdateButton addCallback omarkparsUpdateCallback

proc omarkparsRestoreCallback args {
    send uomarkpars setValue [send uomarkpars getValue]
}
send omarkparsRestoreButton addCallback omarkparsRestoreCallback

proc omarkparsDefaultsCallback args {
    send client gcmd unlearn omarkpars
}
send omarkparsDefaultsButton addCallback omarkparsDefaultsCallback

proc omarkparsSaveCallback args {
    send client gcmd update omarkpars
}
send omarkparsSaveButton addCallback omarkparsSaveCallback

set omarkparstwidgets {
    otoleranceValue osizemarkValue
}
proc omarkparsTextCallback { widget args } {
    send $widget set foreground white
    send omarkparsUpdateButton set foreground white
}
foreach widget $omarkparstwidgets {
    send $widget addCallback omarkparsTextCallback
}
foreach widget $omarkparstwidgets {
    send $widget addEventHandler textDisplayCaret enterWindowMask
    send $widget addEventHandler textDisplayCaret leaveWindowMask
}

set omarkparscwidgets {
    objmarkValue onumberValue
}
proc omarkparsComCallback { widget args } {
    if {[send $widget get label] == "no"} {
	send $widget set label yes
    } else {
	send $widget set label no
    }
    send $widget set foreground white
    send omarkparsUpdateButton set foreground white
}
foreach widget $omarkparscwidgets {
    send $widget addCallback omarkparsComCallback
}


proc uomarkparsCallback { param old new } {
    foreach pd $new {
	#set opd [lsearch $old $pd]
	#if { $opd >= 0 } continue
        switch [lindex $pd 0] {
        objmark         {
	                  send objmarkValue set foreground black
	                  send objmarkValue set label [lindex $pd 1]
			}
        otolerance      {
	                  send otoleranceValue set foreground black
	                  send otoleranceValue set string [lindex $pd 1]
			}
        ocharmark       {
	                  send ocharmarkValue set foreground black
	                  send ocharmarkValue set label [lindex $pd 1]
			}
        onumber         {
	                  send onumberValue set foreground black
	                  send onumberValue set label [lindex $pd 1]
			}
        opcolormark     {
	                  send opcolormarkValue set foreground black
	                  send opcolormarkValue set label [lindex $pd 1]
			}
        oscolormark     {
	                  send oscolormarkValue set foreground black
	                  send oscolormarkValue set label [lindex $pd 1]
			}
        osizemark       {
	                  send osizemarkValue set foreground black
	                  send osizemarkValue set string [lindex $pd 1]
			}
	}
    }
    send omarkparsUpdateButton set foreground black
}
send uomarkpars addCallback uomarkparsCallback

createMenu ocharmarkMenu ocharmarkValue {
    {   "Marker"        f.title                                   }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Point           f.exec  {
			    send ocharmarkValue set foreground white
			    send ocharmarkValue set label point
			    send omarkparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Box             f.exec  {
			    send ocharmarkValue set foreground white
			    send ocharmarkValue set label box
			    send omarkparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Plus            f.exec  {
			    send ocharmarkValue set foreground white
			    send ocharmarkValue set label plus
			    send omarkparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Circle          f.exec  {
			    send ocharmarkValue set foreground white
			    send ocharmarkValue set label circle
			    send omarkparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Diamond         f.exec  {
			    send ocharmarkValue set foreground white
			    send ocharmarkValue set label diamond
			    send omarkparsUpdateButton set foreground white
		        }                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Shape           f.exec  {
			    send ocharmarkValue set foreground white
			    send ocharmarkValue set label shape 
			    send omarkparsUpdateButton set foreground white
		        }                                                }
}

createMenu opcolormarkMenu opcolormarkValue {
    {   "Object Colors" f.title                                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Red"          f.exec  {
			    send opcolormarkValue set foreground white
			    send opcolormarkValue set label red
			    send omarkparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Blue"         f.exec  {
                            send opcolormarkValue set foreground white
                            send opcolormarkValue set label blue
			    send omarkparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Green"        f.exec  {
			    send opcolormarkValue set foreground white
			    send opcolormarkValue set label green
			    send omarkparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Yellow"       f.exec  {
			    send opcolormarkValue set foreground white
			    send opcolormarkValue set label yellow
			    send omarkparsUpdateButton set foreground white
			} bitmap square7by7                              }
}

createMenu oscolormarkMenu oscolormarkValue {
    {   "Sky Colors"    f.title                                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Red"          f.exec  {
			    send oscolormarkValue set foreground white
			    send oscolormarkValue set label red
			    send omarkparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Blue"         f.exec  {
                            send oscolormarkValue set foreground white
                            send oscolormarkValue set label blue
			    send omarkparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Green"        f.exec  {
			    send oscolormarkValue set foreground white
			    send oscolormarkValue set label green
			    send omarkparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Yellow"       f.exec  {
			    send oscolormarkValue set foreground white
			    send oscolormarkValue set label yellow
			    send omarkparsUpdateButton set foreground white
			} bitmap square7by7                              }
}

proc omarkparsMarkCallback args {
    omarkparsUpdateCallback
    send client gkey m
}
send omarkparsMarkButton addCallback omarkparsMarkCallback

proc omarkparsEraseCallback args {
    send client gkey e
}
send omarkparsEraseButton addCallback omarkparsEraseCallback

proc omarkparsHelpCallback args {
    helpMove helpText #omarkpars args
    if { [send uhelp getValue] == "no" } {
	send client gkey ?
    }
}
send omarkparsHelpButton addCallback omarkparsHelpCallback

proc omarkparsCloseCallback args {
    send xguiphot_omarkpars unmap
}
send omarkparsCloseButton addCallback omarkparsCloseCallback


# DEFINE THE IMPARS_SHELL CALLBACKS

proc imparsUpdateCallback args {
    send client gcmd save impars no
    send client gcmd iscale [send iscaleValue get string]
    send client gcmd ihwhmpsf [send ihwhmpsfValue get string]
    send client gcmd iemission [send iemissionValue get label]
    send client gcmd iskysigma [send iskysigmaValue get string]
    send client gcmd imindata [send imindataValue get string]
    send client gcmd imaxdata [send imaxdataValue get string]
    send client gcmd inoisemodel [send inoisemodelValue get label]
    send client gcmd ikreadnoise \"[send ikreadnoiseValue get string]\"
    send client gcmd ikgain  \"[send ikgainValue get string]\"
    send client gcmd ireadnoise [send ireadnoiseValue get string]
    send client gcmd igain  [send igainValue get string]
    send client gcmd ikexptime \"[send ikexptimeValue get string]\"
    send client gcmd ikairmass \"[send ikairmassValue get string]\"
    send client gcmd ikfilter \"[send ikfilterValue get string]\"
    send client gcmd ikobstime \"[send ikobstimeValue get string]\"
    send client gcmd ietime [send ietimeValue get string]
    send client gcmd iairmass [send iairmassValue get string]
    send client gcmd ifilter [send ifilterValue get string]
    send client gcmd iotime [send iotimeValue get string]
    send client gcmd save impars yes
}
send imparsUpdateButton addCallback imparsUpdateCallback

proc imparsRestoreCallback args {
    send uimpars setValue [send uimpars getValue]
}
send imparsRestoreButton addCallback imparsRestoreCallback

proc imparsDefaultsCallback args {
    send client gcmd unlearn impars
}
send imparsDefaultsButton addCallback imparsDefaultsCallback

proc imparsSaveCallback args {
    send client gcmd update impars
}
send imparsSaveButton addCallback imparsSaveCallback

set imparstwidgets {
    iscaleValue ihwhmpsfValue iskysigmaValue imindataValue imaxdataValue
    ikreadnoiseValue ikgainValue ireadnoiseValue igainValue
    ikexptimeValue ikairmassValue ikfilterValue ikobstimeValue
    ietimeValue iairmassValue ifilterValue iotimeValue
}
proc imparsTextCallback { widget args } {
    send $widget set foreground white
    send imparsUpdateButton set foreground white
}
foreach widget $imparstwidgets {
    send $widget addCallback imparsTextCallback
}
foreach widget $imparstwidgets {
    send $widget addEventHandler textDisplayCaret enterWindowMask
    send $widget addEventHandler textDisplayCaret leaveWindowMask
}

proc iemissionCallback args {
    if {[send iemissionValue get label] == "no"} {
        send iemissionValue set label yes
    } else {
        send iemissionValue set label no
    }
    send iemissionValue set foreground white
    send imparsUpdateButton set foreground white
}
send iemissionValue addCallback iemissionCallback

proc uimparsCallback { param old new } {
    foreach pd $new {
	#set opd [lsearch $old $pd]
	#if { $opd >= 0 } continue
        switch [lindex $pd 0] {
        iscale      {
	                send iscaleValue set foreground black
	                send iscaleValue set string [lindex $pd 1]
		    }
        ihwhmpsf    {
	                send ihwhmpsfValue set foreground black
	                send ihwhmpsfValue set string [lindex $pd 1]
		    }
        iemission   {
	                send iemissionValue set foreground black
	                send iemissionValue set label [lindex $pd 1]
		    }
	iskysigma   {
	                send iskysigmaValue set foreground black
	                send iskysigmaValue set string [lindex $pd 1]
		    }
        imindata    {
	                send imindataValue set foreground black
	                send imindataValue set string [lindex $pd 1]
		    }
        imaxdata    {
	               send imaxdataValue set foreground black
	               send imaxdataValue set string [lindex $pd 1]
		    }
        inoisemodel {
	               send inoisemodelValue set foreground black
	               send inoisemodelValue set label [lindex $pd 1]
		    }
        ikreadnoise {
	               send ikreadnoiseValue set foreground black
	               send ikreadnoiseValue set string [lindex $pd 1]
		    }
        ikgain      {
	               send ikgainValue set foreground black
	               send ikgainValue set string [lindex $pd 1]
		    }
        ireadnoise  {
	               send ireadnoiseValue set foreground black
	               send ireadnoiseValue set string [lindex $pd 1]
		    }
        igain       {
	               send igainValue set foreground black
	               send igainValue set string [lindex $pd 1]
		    }
        ikexptime   {
	               send ikexptimeValue set foreground black
	               send ikexptimeValue set string [lindex $pd 1]
		    }
        ikairmass   {
	               send ikairmassValue set foreground black
	               send ikairmassValue set string [lindex $pd 1]
		    }
        ikfilter    {
	               send ikfilterValue set foreground black
	               send ikfilterValue set string [lindex $pd 1]
		    }
        ikobstime   {
	               send ikobstimeValue set foreground black
	               send ikobstimeValue set string [lindex $pd 1]
		    }
        ietime      {
	               send ietimeValue set foreground black
	               send ietimeValue set string [lindex $pd 1]
		    }
        iairmass    {
	               send iairmassValue set foreground black
	               send iairmassValue set string [lindex $pd 1]
		    }
        ifilter     {
	               send ifilterValue set foreground black
	               send ifilterValue set string [lindex $pd 1]
		    }
        iotime      {
	               send iotimeValue set foreground black
	               send iotimeValue set string [lindex $pd 1]
		    }
	}
    }
    send imparsUpdateButton set foreground black
}
send uimpars addCallback uimparsCallback

createMenu inoisemodelMenu inoisemodelValue {
    {   "Noise model"	f.title                                          }
    {			f.line                                           }
    {			f.line                                           }
    {			f.line                                           }
    {			f.line                                           }
    {   Poisson         f.exec {
			    send inoisemodelValue set foreground white
			    send inoisemodelValue set label poisson
    			    send imparsUpdateButton set foreground white
			}                                                }
}

proc imparsHelpCallback args {
    helpMove helpText #impars args
    if { [send uhelp getValue] == "no" } {
	send client gkey ?
    }
}
send imparsHelpButton addCallback imparsHelpCallback

proc imparsCloseCallback args {
    winUnmap xguiphot_impars
}
send imparsCloseButton addCallback imparsCloseCallback


# DEFINE THE FINDPARS_SHELL CALLBACKS

proc findparsUpdateCallback args {
    send client gcmd save findpars no
    send client gcmd fthreshold [send fthresholdValue get string]
    send client gcmd fradius [send fradiusValue get string]
    send client gcmd fsepmin [send fsepminValue get string]
    send client gcmd froundlo [send froundloValue get string]
    send client gcmd froundhi [send froundhiValue get string]
    send client gcmd fsharplo [send fsharploValue get string]
    send client gcmd fsharphi [send fsharphiValue get string]
    send client gcmd save findpars yes
}
send findparsUpdateButton addCallback findparsUpdateCallback

proc findparsRestoreCallback args {
    send ufindpars setValue [send ufindpars getValue]
}
send findparsRestoreButton addCallback findparsRestoreCallback

proc findparsDefaultsCallback args {
    send client gcmd unlearn findpars
}
send findparsDefaultsButton addCallback findparsDefaultsCallback

proc findparsSaveCallback args {
    send client gcmd update findpars
}
send findparsSaveButton addCallback findparsSaveCallback

set findparstwidgets {
    fthresholdValue fradiusValue fsepminValue 
    froundloValue froundhiValue fsharploValue fsharphiValue
}
proc findparsTextCallback { widget args } {
    send $widget set foreground white
    send findparsUpdateButton set foreground white
}
foreach widget $findparstwidgets {
    send $widget addCallback findparsTextCallback
}
foreach widget $findparstwidgets {
    send $widget addEventHandler textDisplayCaret enterWindowMask
    send $widget addEventHandler textDisplayCaret leaveWindowMask
}

proc ufindparsCallback { param old new } {
    foreach pd $new {
	#set opd [lsearch $old $pd]
	#if { $opd >= 0 } continue
        switch [lindex $pd 0] {
        fthreshold  {
	                send fthresholdValue set foreground black
	                send fthresholdValue set string [lindex $pd 1]
		    }
        fradius     {
	                send fradiusValue set foreground black
	                send fradiusValue set string [lindex $pd 1]
		    }
        fsepmin     {
	                send fsepminValue set foreground black
	                send fsepminValue set string [lindex $pd 1]
		    }
        froundlo    {
	                send froundloValue set foreground black
	                send froundloValue set string [lindex $pd 1]
		    }
        froundhi    {
	               send froundhiValue set foreground black
	               send froundhiValue set string [lindex $pd 1]
		    }
        fsharplo    {
	               send fsharploValue set foreground black
	               send fsharploValue set string [lindex $pd 1]
		    }
        fsharphi    {
	               send fsharphiValue set foreground black
	               send fsharphiValue set string [lindex $pd 1]
		    }
	}
    }
    send findparsUpdateButton set foreground black
}
send ufindpars addCallback ufindparsCallback

proc findparsFindCallback args {
    send client gkey @
}
send findparsFindButton addCallback findparsFindCallback

proc findparsHelpCallback args {
    helpMove helpText #findpars
    if { [send uhelp getValue] == "no" } {
	send client gkey ?
    }
}
send findparsHelpButton addCallback findparsHelpCallback

proc findparsCloseCallback args {
    winUnmap xguiphot_findpars
}
send findparsCloseButton addCallback findparsCloseCallback


# DEFINE THE CENTERPARS_SHELL CALLBACKS 

proc cenparsUpdateCallback args {
    send client gcmd save cenpars no
    send client gcmd calgorithm [send calgorithmValue get label]
    send client gcmd cradius [send cradiusValue get string]
    send client gcmd cthreshold [send cthresholdValue get string]
    send client gcmd cminsnratio [send cminsnratioValue get string]
    send client gcmd cmaxiter [send cmaxiterValue get string]
    send client gcmd cxyshift [send cxyshiftValue get string]
    send client gcmd ctrmark [send ctrmarkValue get label]
    send client gcmd ccharmark [send ccharmarkValue get label]
    send client gcmd ccolormark [send ccolormarkValue get label]
    send client gcmd csizemark [send csizemarkValue get string]
    send client gcmd save cenpars yes
}
send cenparsUpdateButton addCallback cenparsUpdateCallback

proc cenparsRestoreCallback args {
    send ucenpars setValue [send ucenpars getValue]
}
send cenparsRestoreButton addCallback cenparsRestoreCallback

proc cenparsDefaultsCallback args {
    send client gcmd unlearn cenpars
}
send cenparsDefaultsButton addCallback cenparsDefaultsCallback

proc cenparsSaveCallback args {
    send client gcmd update cenpars
}
send cenparsSaveButton addCallback cenparsSaveCallback

set cenparstwidgets {
    cradiusValue cthresholdValue cminsnratioValue cmaxiterValue
    cxyshiftValue csizemarkValue
}
proc cenparsTextCallback { widget args } {
    send $widget set foreground white
    send cenparsUpdateButton set foreground white
}
foreach widget $cenparstwidgets {
    send $widget addCallback cenparsTextCallback
}

foreach widget $cenparstwidgets {
    send $widget addEventHandler textDisplayCaret enterWindowMask
    send $widget addEventHandler textDisplayCaret leaveWindowMask
}

proc ctrmarkCallback args {
    if {[send ctrmarkValue get label] == "no"} {
        send ctrmarkValue set label yes
    } else {
        send ctrmarkValue set label no
    }
    send ctrmarkValue set foreground white
    send cenparsUpdateButton set foreground white
}
send ctrmarkValue addCallback ctrmarkCallback

proc ucenparsCallback { param old new } {
    global resultsMenuDescription
    foreach pd $new {
	#set opd [lsearch $old $pd]
	#if { $opd >= 0 } continue
        switch [lindex $pd 0] {
        calgorithm      {
	                  send calgorithmValue set foreground black
	                  send calgorithmValue set label [lindex $pd 1]

			}
        cradius         {
	                  send cradiusValue set foreground black
	                  send cradiusValue set string [lindex $pd 1]
			}
        cthreshold      {
	                  send cthresholdValue set foreground black
	                  send cthresholdValue set string [lindex $pd 1]
			}
        cminsnratio     {
	                  send cminsnratioValue set foreground black
	                  send cminsnratioValue set string [lindex $pd 1]
			}
        cmaxiter        {
	                  send cmaxiterValue set foreground black
	                  send cmaxiterValue set string [lindex $pd 1]
			}
        cxyshift        {
	                  send cxyshiftValue set foreground black
	                  send cxyshiftValue set string [lindex $pd 1]
			}
        ctrmark         {
	                  send ctrmarkValue set foreground black
	                  send ctrmarkValue set label [lindex $pd 1]
			}
        ccharmark       {
	                  send ccharmarkValue set foreground black
	                  send ccharmarkValue set label [lindex $pd 1]
			}
        ccolormark      {
	                  send ccolormarkValue set foreground black
	                  send ccolormarkValue set label [lindex $pd 1]
			}
        csizemark       {
	                  send csizemarkValue set foreground black
	                  send csizemarkValue set string [lindex $pd 1]
			}
	}
    }
    send cenparsUpdateButton set foreground black
    editMenu resultsMenu imageresultsButton $resultsMenuDescription
}
send ucenpars addCallback ucenparsCallback

proc cenparsHelpCallback args {
    helpMove helpText #cenpars
    if { [send uhelp getValue] == "no" } {
	send client gkey ?
    }
}
send cenparsHelpButton addCallback cenparsHelpCallback

proc cenparsCloseCallback args {
    winUnmap xguiphot_cenpars
}
send cenparsCloseButton addCallback cenparsCloseCallback

createMenu calgorithmMenu calgorithmValue {
    {   "Centering Algorithms"        f.title                            }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   None            f.exec {
			    send calgorithmValue set foreground white
			    send calgorithmValue set label none
	                    send cenparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Centroid        f.exec  {
			    send calgorithmValue set foreground white
			    send calgorithmValue set label centroid
	                    send cenparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Gauss           f.exec  {
			    send calgorithmValue set foreground white
			    send calgorithmValue set label gauss
	                    send cenparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Ofilter         f.exec  {
			    send calgorithmValue set foreground white
			    send calgorithmValue set label ofilter
	                    send cenparsUpdateButton set foreground white
			}                                                }
}

createMenu ccharmarkMenu ccharmarkValue {
    {   "Marker"        f.title                                   }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Point           f.exec  {
			    send ccharmarkValue set foreground white
			    send ccharmarkValue set label point
	                    send cenparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Box             f.exec  {
			    send ccharmarkValue set foreground white
	                    send cenparsUpdateButton set foreground white
			    send ccharmarkValue set label box
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Plus            f.exec  {
			    send ccharmarkValue set foreground white
			    send ccharmarkValue set label plus
	                    send cenparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Circle          f.exec  {
			    send ccharmarkValue set foreground white
			    send ccharmarkValue set label circle
	                    send cenparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Diamond         f.exec  {
			    send ccharmarkValue set foreground white
			    send ccharmarkValue set label diamond
	                    send cenparsUpdateButton set foreground white
		        }                                                }
}
#{   Cross           f.exec "send cchamarkrValue set label cross"       }

createMenu ccolormarkMenu ccolormarkValue {
    {   "Colors"        f.title                                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Red"          f.exec  {
			   send ccolormarkValue set foreground white
			   send ccolormarkValue set label red
	                    send cenparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Blue"         f.exec  {
                            send ccolormarkValue set foreground white
                            send ccolormarkValue set label blue
	                    send cenparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Green"        f.exec  {
			    send ccolormarkValue set foreground white
			    send ccolormarkValue set label green
	                    send cenparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Yellow"       f.exec  {
			    send ccolormarkValue set foreground white
			    send ccolormarkValue set label yellow
	                    send cenparsUpdateButton set foreground white
			} bitmap square7by7                              }
}

# DEFINE THE SKYPARS_SHELL CALLBACKS

proc skyparsUpdateCallback args {
    send client gcmd save skypars no
    send client gcmd smode [send smodeValue get label]
    send client gcmd sgeometry [send sgeometryValue get label]
    send client gcmd srannulus [send srannulusValue get string]
    send client gcmd swannulus [send swannulusValue get string]
    send client gcmd saxratio [send saxratioValue get string]
    send client gcmd sposangle [send sposangleValue get string]
    send client gcmd salgorithm [send salgorithmValue get label]
    send client gcmd sconstant [send sconstantValue get string]
    send client gcmd shwidth [send shwidthValue get string]
    send client gcmd shbinsize [send shbinsizeValue get string]
    send client gcmd shsmooth [send shsmoothValue get label]
    send client gcmd smaxiter [send smaxiterValue get string]
    send client gcmd sloclip [send sloclipValue get string]
    send client gcmd shiclip [send shiclipValue get string]
    send client gcmd snreject [send snrejectValue get string]
    send client gcmd sloreject [send slorejectValue get string]
    send client gcmd shireject [send shirejectValue get string]
    send client gcmd srgrow [send srgrowValue get string]
    send client gcmd skymark [send skymarkValue get label]
    send client gcmd scolormark [send scolormarkValue get label]
    send client gcmd save skypars yes
}
send skyparsUpdateButton addCallback skyparsUpdateCallback

proc skyparsRestoreCallback args {
    send uskypars setValue [send uskypars getValue]
}
send skyparsRestoreButton addCallback skyparsRestoreCallback

proc skyparsDefaultsCallback args {
    send client gcmd unlearn skypars
}
send skyparsDefaultsButton addCallback skyparsDefaultsCallback

proc skyparsSaveCallback args {
    send client gcmd update skypars
}
send skyparsSaveButton addCallback skyparsSaveCallback

set skyparstwidgets {
    srannulusValue swannulusValue saxratioValue sposangleValue
    sconstantValue shwidthValue shbinsizeValue smaxiterValue
    sloclipValue shiclipValue snrejectValue slorejectValue shirejectValue
    srgrowValue
}
proc skyparsTextCallback { widget args } {
    send $widget set foreground white
    send skyparsUpdateButton set foreground white
}
foreach widget $skyparstwidgets {
    send $widget addCallback skyparsTextCallback
}

foreach widget $skyparstwidgets {
    send $widget addEventHandler textDisplayCaret enterWindowMask
    send $widget addEventHandler textDisplayCaret leaveWindowMask
}

set skyparscwidgets {
    skymarkValue shsmoothValue
}

proc skyparsComCallback { widget args } {
    if {[send $widget get label] == "no"} {
        send $widget set label yes
    } else {
        send $widget set label no
    }
    send $widget set foreground white
    send skyparsUpdateButton set foreground white
}

foreach widget $skyparscwidgets {
    send $widget addCallback skyparsComCallback
}

proc uskyparsCallback { param old new } {
    global phot_enable sky_enable displayMenuDescription resultsMenuDescription
    foreach pd $new {
	#set opd [lsearch $old $pd]
	#if { $opd >= 0 } continue
        switch [lindex $pd 0] {
        smode          {
	                  send smodeValue set foreground black
	                  send smodeValue set label [lindex $pd 1]
			}
        sgeometry       {
	                  send sgeometryValue set foreground black
	                  send sgeometryValue set label [lindex $pd 1]
			}
        srannulus       {
	                  send srannulusValue set foreground black
	                  send srannulusValue set string [lindex $pd 1]
			}
        swannulus       {
	                  send swannulusValue set foreground black
	                  send swannulusValue set string [lindex $pd 1]
			}
        saxratio        {
	                  send saxratioValue set foreground black
	                  send saxratioValue set string [lindex $pd 1]
			}
        sposangle       {
	                  send sposangleValue set foreground black
	                  send sposangleValue set string [lindex $pd 1]
			}
        salgorithm      {
	                  send salgorithmValue set foreground black
	                  send salgorithmValue set label [lindex $pd 1]
			}
        sconstant       {
	                  send sconstantValue set foreground black
	                  send sconstantValue set string [lindex $pd 1]
			}
        shwidth          {
	                  send shwidthValue set foreground black
	                  send shwidthValue set string [lindex $pd 1]
			}
        shbinsize       {
	                  send shbinsizeValue set foreground black
	                  send shbinsizeValue set string [lindex $pd 1]
			}
        shsmooth         {
	                  send shsmoothValue set foreground black
	                  send shsmoothValue set label [lindex $pd 1]
			}
        smaxiter        {
	                  send smaxiterValue set foreground black
	                  send smaxiterValue set string [lindex $pd 1]
			}
        sloclip         {
	                  send sloclipValue set foreground black
	                  send sloclipValue set string [lindex $pd 1]
			}
        shiclip         {
	                  send shiclipValue set foreground black
	                  send shiclipValue set string [lindex $pd 1]
			}
        snreject        {
	                  send snrejectValue set foreground black
	                  send snrejectValue set string [lindex $pd 1]
			}
        sloreject       {
	                  send slorejectValue set foreground black
	                  send slorejectValue set string [lindex $pd 1]
			}
        shireject       {
	                  send shirejectValue set foreground black
	                  send shirejectValue set string [lindex $pd 1]
			}
        srgrow           {
	                  send srgrowValue set foreground black
	                  send srgrowValue set string [lindex $pd 1]
			}
        scolormark      {
	                  send scolormarkValue set foreground black
	                  send scolormarkValue set label [lindex $pd 1]
			}
        skymark         {
	                  send skymarkValue set foreground black
	                  send skymarkValue set label [lindex $pd 1]
			}
        }
    }
    send skyparsUpdateButton set foreground black
    set smode [send smodeValue get label]
    if { $smode == "concentric" } {
        set sky_enable 0
    } else {
        set sky_enable 1
    }
    editMenu displayMenu imagedisplayWindow $displayMenuDescription
    editMenu resultsMenu imageresultsButton $resultsMenuDescription
}
send uskypars addCallback uskyparsCallback

proc skyparsHelpCallback args {
    helpMove helpText #skypars args
    if { [send uhelp getValue] == "no" } {
	send client gkey ?
    }
}
send skyparsHelpButton addCallback skyparsHelpCallback

proc skyparsCloseCallback args {
    winUnmap xguiphot_skypars
}
send skyparsCloseButton addCallback skyparsCloseCallback

createMenu smodeMenu smodeValue {
    {   "Sky Aperture Position"         f.title                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Concentric      f.exec  {
			    send smodeValue set foreground white
			    send smodeValue set label concentric
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Offset          f.exec  {
			    send smodeValue set foreground white
			    send smodeValue set label offset
                            send skyparsUpdateButton set foreground white
			}                                                }
}

createMenu sgeometryMenu sgeometryValue {
    {   "Sky Aperture Geometry"         f.title                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Circle          f.exec  {
			    send sgeometryValue set foreground white
			    send sgeometryValue set label circle
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Ellipse         f.exec  {
			    send sgeometryValue set foreground white
			    send sgeometryValue set label ellipse
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Rectangle       f.exec  {
			    send sgeometryValue set foreground white
			    send sgeometryValue set label rectangle
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Polygon         f.exec   {
			    send sgeometryValue set foreground white
			    send sgeometryValue set label polygon
                            send skyparsUpdateButton set foreground white
		        }                                                }
}


createMenu salgorithmMenu salgorithmValue {
    {   "Sky Fitting Algorithms"        f.title                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   None            f.exec  { 
                            send salgorithmValue set foreground white
                            send salgorithmValue set label none
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Constant        f.exec  {
			    send salgorithmValue set foreground white
			    send salgorithmValue set label constant
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Mean            f.exec  {
			    send salgorithmValue set foreground white
			    send salgorithmValue set label mean
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Median          f.exec  {
			    send salgorithmValue set foreground white
			    send salgorithmValue set label median
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Mode32          f.exec  {
			    send salgorithmValue set foreground white
			    send salgorithmValue set label mode32
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Hcentroid       f.exec  {
			    send salgorithmValue set foreground white
			    send salgorithmValue set label hcentroid
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Hofilter        f.exec  {
                            send salgorithmValue set foreground white
                            send salgorithmValue set label hofilter
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Hcrosscor       f.exec  {
			    send salgorithmValue set foreground white
			    send salgorithmValue set label hcrosscor
                            send skyparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Hgauss          f.exec  {
			    send salgorithmValue set foreground white
			    send salgorithmValue set label hgauss
                            send skyparsUpdateButton set foreground white
			}                                                }
}

createMenu scolormarkMenu scolormarkValue {
    {   "Colors"        f.title                                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Red"	        f.exec  {
			    send scolormarkValue set foreground white
			    send scolormarkValue set label red
                            send skyparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Blue"         f.exec  {
			    send scolormarkValue set foreground white
			    send scolormarkValue set label blue
                            send skyparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Green"        f.exec  {
			    send scolormarkValue set foreground white
			    send scolormarkValue set label green
                            send skyparsUpdateButton set foreground white
			} bitmap square7by7                             }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Yellow"       f.exec  {
                            send scolormarkValue set foreground white
                            send scolormarkValue set label yellow
                            send skyparsUpdateButton set foreground white
			} bitmap square7by7                              }
}


# DEFINE THE PHOTPARS_SHELL CALLBACKS

proc photparsUpdateCallback args {
    send client gcmd save photpars no 
    send client gcmd pgeometry [send pgeometryValue get label]
    send client gcmd papertures [send paperturesValue get string]
    send client gcmd paxratio [send paxratioValue get string]
    send client gcmd pposangle [send pposangleValue get string]
    send client gcmd pzmag [send pzmagValue get string]
    send client gcmd photmark [send photmarkValue get label]
    send client gcmd pcolormark [send pcolormarkValue get label]
    send client gcmd save photpars yes
}
send photparsUpdateButton addCallback photparsUpdateCallback

proc photparsRestoreCallback args {
    send uphotpars setValue [send uphotpars getValue]
}
send photparsRestoreButton addCallback photparsRestoreCallback

proc photparsDefaultsCallback args {
    send client gcmd unlearn photpars
}
send photparsDefaultsButton addCallback photparsDefaultsCallback

proc photparsSaveCallback args {
    send client gcmd update photpars
}
send photparsSaveButton addCallback photparsSaveCallback

set photparstwidgets {
    paperturesValue paxratioValue pposangleValue pzmagValue
}
proc photparsTextCallback { widget args }  {
    send $widget set foreground white
    send photparsUpdateButton set foreground white
}
foreach widget $photparstwidgets {
    send $widget addCallback photparsTextCallback
}
foreach widget $photparstwidgets {
    send $widget addEventHandler textDisplayCaret enterWindowMask
    send $widget addEventHandler textDisplayCaret leaveWindowMask
}

proc photmarkCallback args {
    if {[send photmarkValue get label] == "no"} {
        send photmarkValue set label yes
    } else {
        send photmarkValue set label no
    }
    send photmarkValue set foreground white
    send photparsUpdateButton set foreground white
}
send photmarkValue addCallback photmarkCallback

proc uphotparsCallback { param old new } {
    global resultsMenuDescription
    foreach pd $new {
	#set opd [lsearch $old $pd]
	#if { $opd >= 0 } continue
        switch [lindex $pd 0] {
        pgeometry       {
	                  send pgeometryValue set foreground black
	                  send pgeometryValue set label [lindex $pd 1]
			}
        papertures      {
	                  send paperturesValue set foreground black
	                  send paperturesValue set string [lindex $pd 1]
			}
        paxratio        {
	                  send paxratioValue set foreground black
	                  send paxratioValue set string [lindex $pd 1]
			}
        pposangle       {
	                  send pposangleValue set foreground black
	                  send pposangleValue set string [lindex $pd 1]
			}
        pzmag           {
	                  send pzmagValue set foreground black
	                  send pzmagValue set string [lindex $pd 1]
			}
        photmark        {
	                  send photmarkValue set foreground black
	                  send photmarkValue set label [lindex $pd 1]
			}
        pcolormark      {
	                  send pcolormarkValue set foreground black
	                  send pcolormarkValue set label [lindex $pd 1]
			}
	}
    }
    send photparsUpdateButton set foreground black
    editMenu resultsMenu imageresultsButton  $resultsMenuDescription
}
send uphotpars addCallback uphotparsCallback

proc photparsHelpCallback args {
    helpMove helpText #photpars args
    if { [send uhelp getValue] == "no" } {
	send client gkey ?
    }
}
send photparsHelpButton addCallback photparsHelpCallback

proc photparsCloseCallback args {
    winUnmap xguiphot_photpars
}
send photparsCloseButton addCallback photparsCloseCallback

createMenu pgeometryMenu pgeometryValue {
    {   "Aperture Geometry"         f.title                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Circle          f.exec {
                            send pgeometryValue set foreground white
                            send pgeometryValue set label circle 
                            send photparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Ellipse         f.exec {
                            send pgeometryValue set foreground white
                            send pgeometryValue set label ellipse
                            send photparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Rectangle       f.exec {
                            send pgeometryValue set foreground white
                            send pgeometryValue set label rectangle
                            send photparsUpdateButton set foreground white
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   Polygon         f.exec {
                            send pgeometryValue set foreground white
                            send pgeometryValue set label polygon
                            send photparsUpdateButton set foreground white
			}                                                }
}


createMenu pcolormarkMenu pcolormarkValue {
    {   "Colors"        f.title                                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Red"          f.exec {
			    send pcolormarkValue set foreground white
			    send pcolormarkValue set label red
                            send photparsUpdateButton set foreground white
		        } bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Blue"         f.exec {
                            send pcolormarkValue set foreground white
                            send pcolormarkValue set label blue
                            send photparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Green"        f.exec {
			    send pcolormarkValue set foreground white
			    send pcolormarkValue set label green
                            send photparsUpdateButton set foreground white
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Yellow"       f.exec {
			    send pcolormarkValue set foreground white
			    send pcolormarkValue set label yellow
                            send photparsUpdateButton set foreground white
			} bitmap square7by7                              }
}


# DEFINE THE EPLOTPARS TOPLEVEL SHELL CALLBACKS

proc eplotparsUpdateCallback args {
    send client gcmd save eplotpars no
    send client gcmd enx [send enxValue get string]
    send client gcmd eny [send enyValue get string]
    send client gcmd ez1 [send ez1Value get string]
    send client gcmd ez2 [send ez2Value get string]
    send client gcmd ez0 [send ez0Value get string]
    send client gcmd edz [send edzValue get string]
    send client gcmd encontours [send encontoursValue get string]
    send client gcmd ehilomark [send ehilomarkValue get label]
    send client gcmd edashpat [send edashpatValue get string]
    send client gcmd elabel [send elabelValue get label]
    send client gcmd ebox [send eboxValue get label]
    send client gcmd eticklabel [send eticklabelValue get label]
    send client gcmd exmajor [send exmajorValue get string]
    send client gcmd exminor [send exminorValue get string]
    send client gcmd eymajor [send eymajorValue get string]
    send client gcmd eyminor [send eyminorValue get string]
    send client gcmd eround [send eroundValue get label]
    send client gcmd efill [send efillValue get label]
    send client gcmd save eplotpars yes
}
send eplotparsUpdateButton addCallback eplotparsUpdateCallback

proc eplotparsRestoreCallback args {
    send ueplotpars setValue [send ueplotpars getValue]
}
send eplotparsRestoreButton addCallback eplotparsRestoreCallback

proc eplotparsDefaultsCallback args {
    send client gcmd unlearn eplotpars
}
send eplotparsDefaultsButton addCallback eplotparsDefaultsCallback

proc eplotparsSaveCallback args {
    send client gcmd update eplotpars
}
send eplotparsSaveButton addCallback eplotparsSaveCallback

set eplotparstwidgets {
    enxValue enyValue ez1Value ez2Value ez0Value edzValue encontoursValue
    edashpatValue exmajorValue exminorValue eymajorValue eyminorValue
}
proc eplotparsTextCallback { widget args } {
    send $widget set foreground white
    send eplotparsUpdateButton set foreground white
}
foreach widget $eplotparstwidgets {
    send $widget addCallback eplotparsTextCallback
}
foreach widget $eplotparstwidgets {
    send $widget addEventHandler textDisplayCaret enterWindowMask
    send $widget addEventHandler textDisplayCaret leaveWindowMask
}

set eplotparscwidgets {
    elabelValue eboxValue eticklabelValue eroundValue efillValue
}
proc eplotparsComCallback { widget args } {
    if {[send $widget get label] == "no"} {
        send $widget set label yes
    } else {
        send $widget set label no
    }
    send $widget set foreground white
    send eplotparsUpdateButton set foreground white
}
foreach widget $eplotparscwidgets {
    send $widget addCallback eplotparsComCallback
}


proc ueplotparsCallback { param old new } {
    foreach pd $new {
	# set opd [lsearch $old $pd]
	# if { $opd >= 0 } continue
        switch [lindex $pd 0] {
        enx            {
			send enxValue set foreground black
			send enxValue set string [lindex $pd 1]
		       }
        eny            {
			send enyValue set foreground black
			send enyValue set string [lindex $pd 1]
		       }
        ez1            {
			send ez1Value set foreground black
			send ez1Value set string [lindex $pd 1]
		       }
        ez2            {
			send ez2Value set foreground black
			send ez2Value set string [lindex $pd 1]
		        }
        ez0            {
			send ez0Value set foreground black
			send ez0Value set string [lindex $pd 1]
		       }
        edz            {
			send edzValue set foreground black
			send edzValue set string [lindex $pd 1]
		       }
        encontours     {
			send encontoursValue set foreground black
			send encontoursValue set string [lindex $pd 1]
		       }
        ehilomark      {
			send ehilomarkValue set foreground black
			send ehilomarkValue set label [lindex $pd 1]
		       }
        edashpat       {
			send edashpatValue set foreground black
			send edashpatValue set string [lindex $pd 1]
		       }
        elabel         {
			send elabelValue set foreground black
			send elabelValue set label [lindex $pd 1]
		       }
        ebox           {
			send eboxValue set foreground black
			send eboxValue set label [lindex $pd 1]
		       }
        eticklabel     {
			send eticklabelValue set foreground black
			send eticklabelValue set label [lindex $pd 1]
		       }
        exmajor        {
			send exmajorValue set foreground black
			send exmajorValue set string [lindex $pd 1]
		       }
        exminor        {
			send exminorValue set foreground black
			send exminorValue set string [lindex $pd 1]
		       }
        eymajor        {
			send eymajorValue set foreground black
			send eymajorValue set string [lindex $pd 1]
		       }
        eyminor        {
			send eyminorValue set foreground black
			send eyminorValue set string [lindex $pd 1]
		       }
        eround         {
			send eroundValue set foreground black
			send eroundValue set label [lindex $pd 1]
		       }
        efill          {
	                send efillValue set foreground black
	                send efillValue set label [lindex $pd 1]
		       }
	}
    }
    send eplotparsUpdateButton set foreground black
}
send ueplotpars addCallback ueplotparsCallback

createMenu ehilomarkMenu ehilomarkValue {
    {   "Hi/Lo Marking Option"		     f.title                     }
    {		     f.line                                              }
    {		     f.line                                              }
    {		     f.line                                              }
    {		     f.line                                              }
    {   none         f.exec {
			 send ehilomarkValue set foreground white
			 send ehilomarkValue set label none
                         send eplotparsUpdateButton set foreground white
		      }                                                  }
    {		     f.line                                              }
    {		     f.line                                              }
    {   hilo         f.exec { 
    		         send ehilomarkValue set foreground white
    		         send ehilomarkValue set label hilo
                         send eplotparsUpdateButton set foreground white
		     }                                                   }
    {		     f.line                                              }
    {		     f.line                                              }
    {   pixel        f.exec {
    		         send ehilomarkValue set foreground white
    		         send ehilomarkValue set label pixel
                         send eplotparsUpdateButton set foreground white
		     }                                                   }
}

proc eplotparsHelpCallback args {
    helpMove helpText #eplotpars args
    if { [send uhelp getValue] == "no" } {
        send client gkey ?
    }
}
send eplotparsHelpButton addCallback eplotparsHelpCallback

proc eplotparsCloseCallback args {
    send xguiphot_eplotpars unmap
}
send eplotparsCloseButton addCallback eplotparsCloseCallback

# DEFINE THE XGUIPHOT_APLOTPARS SHELL CALLBACKS

proc aplotparsUpdateCallback args {
    send client gcmd save aplotpars no
    send client gcmd anx [send anxValue get string]
    send client gcmd any [send anyValue get string]
    send client gcmd az1 [send az1Value get string]
    send client gcmd az2 [send az2Value get string]
    send client gcmd alabel [send alabelValue get label]
    send client gcmd angh [send anghValue get string]
    send client gcmd angv [send angvValue get string]
    send client gcmd save aplotpars yes
}
send aplotparsUpdateButton addCallback aplotparsUpdateCallback

proc aplotparsRestoreCallback args {
    send uaplotpars setValue [send uaplotpars getValue]
}
send aplotparsRestoreButton addCallback aplotparsRestoreCallback

proc aplotparsDefaultsCallback args {
    send client gcmd unlearn aplotpars
}
send aplotparsDefaultsButton addCallback aplotparsDefaultsCallback

proc aplotparsSaveCallback args {
    send client gcmd update aplotpars
}
send aplotparsSaveButton addCallback aplotparsSaveCallback

set aplotparstwidgets {
    anxValue anyValue az1Value az2Value anghValue angvValue
}
proc aplotparsTextCallback { widget args } {
    send $widget set foreground white
    send aplotparsUpdateButton set foreground white
}
foreach widget $aplotparstwidgets {
    send $widget addCallback aplotparsTextCallback
}
foreach widget $aplotparstwidgets {
    send $widget addEventHandler textDisplayCaret enterWindowMask
    send $widget addEventHandler textDisplayCaret leaveWindowMask
}

set aplotparscwidgets {
    alabelValue
}
proc aplotparsComCallback { widget args } {
    if {[send $widget get label] == "no"} {
        send $widget set label yes
    } else {
        send $widget set label no
    }
    send $widget set foreground white
    send aplotparsUpdateButton set foreground white
}
foreach widget $aplotparscwidgets {
    send $widget addCallback aplotparsComCallback
}


proc uaplotparsCallback { param old new } {
    foreach pd $new {
	# set opd [lsearch $old $pd]
	# if { $opd >= 0 } continue
        switch [lindex $pd 0] {
        anx            {
			send anxValue set foreground black
			send anxValue set string [lindex $pd 1]
		       }
        any            {
			send anyValue set foreground black
			send anyValue set string [lindex $pd 1]
		       }
        az1            {
			send az1Value set foreground black
			send az1Value set string [lindex $pd 1]
		       }
        az2            {
			send az2Value set foreground black
			send az2Value set string [lindex $pd 1]
		        }
        alabel         {
			send alabelValue set foreground black
			send alabelValue set label [lindex $pd 1]
		       }
        angv           {
			send angvValue set foreground black
			send angvValue set string [lindex $pd 1]
		       }
        angh           {
			send anghValue set foreground black
			send anghValue set string [lindex $pd 1]
		       }
	}
    }
    send aplotparsUpdateButton set foreground black
}
send uaplotpars addCallback uaplotparsCallback

proc aplotparsHelpCallback args {
    helpMove helpText #aplotpars args
    if { [send uhelp getValue] == "no" } {
        send client gkey ?
    }
}
send aplotparsHelpButton addCallback aplotparsHelpCallback

proc aplotparsCloseCallback args {
    send xguiphot_aplotpars unmap
}
send aplotparsCloseButton addCallback aplotparsCloseCallback


# DEFINE THE PHOTOMETRY TABLE CALLBACKS

proc uresultsCallback { param old new } {
    if { [yes $new] } {
	winMap xguiphot_ptable
    } else {
	winUnmap xguiphot_ptable
    }
}
send uresults addCallback uresultsCallback

proc upbannerCallback { param old new } {
    send ptblText set string ""
    send ptblText append [format "%s  Logged\n\n" $new ]
}
send upbanner addCallback upbannerCallback

proc uptableCallback { param old new } {
    send ptblText append [format "%s  %s\n" $new [send ulogresults getValue]]
}
send uptable addCallback uptableCallback

proc ulogresultsCallback { param old new } {
    global filesMenuDescription imtitleboxMenuDescription resultsMenuDescription
    if { $new == "yes" } {
	send ptablelogButton set label "Yes"
	send rflogButton set label "Yes"
	send plotslogButton set label "Yes"
	send objlogButton set label "Yes"
    } else {
	send ptablelogButton set label "No "
	send rflogButton set label "No "
	send plotslogButton set label "No "
	send objlogButton set label "No "
    }
    set imno [send uimno getValue]
    if { $imno > 0 } {
	set image [lindex [send uimliststr getValue] [expr "$imno - 1"]]
    } else {
	set image ""
    }
    set olno [send uofno getValue]
    if { $olno > 0 } {
	set objects [lindex [send uolliststr getValue] [expr "$olno - 1"]]
    } else {
	set objects ""
    }
    set logresults [send ulogresults getValue]
    set results [send urffile getValue]
    set robjects [send ugffile getValue]
    imtitleUpdate $image $objects $logresults $results $robjects
    editMenu filesMenu imagefilesButton $filesMenuDescription
    editMenu imtitleboxMenu imagedisplayWindow $imtitleboxMenuDescription
    editMenu resultsMenu imageresultsButton  $resultsMenuDescription
}
send ulogresults addCallback ulogresultsCallback

proc ptableclearCallback args {
    send ptblText set string ""
    send ptblText append [format "%s  Logged\n\n" [send upbanner getValue]]
}
send ptableclearButton addCallback ptableclearCallback

proc ptablelogCallback args {
    if { [send ptablelogButton get label] == "Yes"} {
	send client gcmd logresults no
    } else {
	send client gcmd logresults yes
    }
}
send ptablelogButton addCallback ptablelogCallback

proc ptablehelpCallback args {
    helpMove helpText #ptpanel args
    if { [send uhelp getValue] == "no" } {
        send client gkey ?
    }
}
send ptablehelpButton addCallback ptablehelpCallback

proc ptablecloseCallback args {
    send client gkey t
}
send ptablecloseButton addCallback ptablecloseCallback


# DEFINE THE PHOTOMETRY PLOT PANEL CALLBACKS

# The object text callback.
proc pobjectCallback { param old new } {
    set dpos [send resText get displayPosition]
    send resText set string [format "%s\n" [send upobject getValue]]
    send resText set displayPosition $dpos
}
send upobject addCallback pobjectCallback

# The plot window type callback.
proc ugtermCallback { param old new } {
    if { $new == "imageplot" } {
	send imagedisplayWindow setGterm
    } elseif { $new == "modelplot" } {
	send objmodelWindow setGterm
    } elseif { $new == "objregionplot" } {
	send objregWindow setGterm
    } elseif { $new == "skyregionplot" } {
	send skyregWindow setGterm
    } elseif { $new == "objectplot" } {
	send objplotsWindow setGterm
    } elseif { $new == "skyplot" } {
	send skyplotsWindow setGterm
    }
}
send ugterm addCallback ugtermCallback

# The active plot window callback.
proc ucursorCallback { param old new } {
    if { $old == "" || $old == "imageplot" } {
	send imbtn1Layout  setSensitive false
	send imagedisplayWindow setSensitive false
	send xguiphot_files setSensitive false
	send xguiphot_imheader setSensitive false
	send xguiphot_objlist setSensitive false
	send xguiphot_ptable setSensitive false
	send xguiphot_impars setSensitive false
	send xguiphot_dispars setSensitive false
	send xguiphot_findpars setSensitive false
	send xguiphot_omarkpars setSensitive false
	send xguiphot_cenpars setSensitive false
	send xguiphot_skypars setSensitive false
	send xguiphot_photpars setSensitive false
	send xguiphot_aplotpars setSensitive false
	send xguiphot_eplotpars setSensitive false
    } elseif { $old == "modelplot" } {
	send xguiphot_results setSensitive true
	send objmodelWindow set sensitive false
	send objmodelactivateButton set label Activate
	send objmodelsetwidthButton set sensitive false
	send objmodelrefitButton set sensitive false
	send objmodelreplotButton set sensitive false
	send objmodelresultsButton set sensitive false
	send objmodelmomentsButton set sensitive false
    } elseif { $old == "objregionplot" } {
	send xguiphot_objmodel setSensitive true
	send objregWindow set sensitive false
	send resText set sensitive true
	send objregactivateButton set label Activate
	send objplotsButton set sensitive true
	send objactivateButton set sensitive true
	send skyregionButton set sensitive true
	send skyregactivateButton set sensitive true
	send skyactivateButton set sensitive true
	send skyplotsButton set sensitive true
	send plotslogButton set sensitive true
    } elseif { $old == "skyregionplot" } {
	send xguiphot_objmodel setSensitive true
	send skyregWindow set sensitive false
	send resText set sensitive true
	send objregionButton set sensitive true
	send objregactivateButton set sensitive true
	send objplotsButton set sensitive true
	send objactivateButton set sensitive true
	send skyregactivateButton set label Activate
	send skyactivateButton set sensitive true
	send skyplotsButton set sensitive true
	send plotslogButton set sensitive true
    } elseif { $old == "objectplot" } {
	send xguiphot_objmodel setSensitive true
	send objplotsWindow set sensitive false
	send resText set sensitive true
	send objregionButton set sensitive true
	send objregactivateButton set sensitive true
	send objactivateButton set label Activate
	send skyregionButton set sensitive true
	send skyregactivateButton set sensitive true
	send skyplotsButton set sensitive true
	send skyactivateButton set sensitive true
	send plotslogButton set sensitive true
    } elseif { $old == "skyplot" } {
	send xguiphot_objmodel setSensitive true
	send skyplotsWindow set sensitive false
	send resText set sensitive true
	send objregionButton set sensitive true
	send objregactivateButton set sensitive true
	send objplotsButton set sensitive true
	send objactivateButton set sensitive true
	send skyregionButton set sensitive true
	send skyactivateButton set label Activate
	send skyregactivateButton set sensitive true
	send plotslogButton set sensitive true
    }

    if { $new == "imageplot" } {
	send imbtn1Layout  setSensitive true
	send imagedisplayWindow setSensitive true
	send xguiphot_files setSensitive true
	send xguiphot_imheader setSensitive true
	send xguiphot_objlist setSensitive true
	send xguiphot_results setSensitive true
	send xguiphot_ptable setSensitive true
	send xguiphot_impars setSensitive true
	send xguiphot_dispars setSensitive true
	send xguiphot_findpars setSensitive true
	send xguiphot_omarkpars setSensitive true
	send xguiphot_cenpars setSensitive true
	send xguiphot_skypars setSensitive true
	send xguiphot_photpars setSensitive true
	send xguiphot_aplotpars setSensitive true
	send xguiphot_eplotpars setSensitive true
    } elseif { $new == "modelplot" } {
	send xguiphot_results setSensitive false
	send objmodelWindow set sensitive true
	send objmodelactivateButton set label Deactivate
	send objmodelsetwidthButton set sensitive true
	send objmodelrefitButton set sensitive true
	send objmodelreplotButton set sensitive true
	send objmodelresultsButton set sensitive true
	send objmodelmomentsButton set sensitive true
    } elseif { $new == "objregionplot" } {
	send xguiphot_objmodel setSensitive false
	send objregWindow set sensitive true
	send resText set sensitive false
	send objregactivateButton set label Deactivate
	send objplotsButton set sensitive false
	send objactivateButton set sensitive false
	send skyregionButton set sensitive false
	send skyregactivateButton set sensitive false
	send skyplotsButton set sensitive false
	send skyactivateButton set sensitive false
	send plotslogButton set sensitive false
    } elseif { $new == "skyregionplot" } {
	send xguiphot_objmodel setSensitive false
	send skyregWindow set sensitive true
	send resText set sensitive false
	send objregionButton set sensitive false
	send objregactivateButton set sensitive false
	send objplotsButton set sensitive false
	send objactivateButton set sensitive false
	send skyregactivateButton set label Deactivate
	send skyplotsButton set sensitive false
	send skyactivateButton set sensitive false
	send plotslogButton set sensitive false
    } elseif { $new == "objectplot" } {
	send xguiphot_objmodel setSensitive false
	send objplotsWindow set sensitive true
	send resText set sensitive false
	send objregionButton set sensitive false
	send objregactivateButton set sensitive false
	send objactivateButton set label Deactivate
	send skyregionButton set sensitive false
	send skyregactivateButton set sensitive false
	send skyplotsButton set sensitive false
	send skyactivateButton set sensitive false
	send plotslogButton set sensitive false
    } elseif { $new == "skyplot" } {
	send xguiphot_objmodel setSensitive false
	send skyplotsWindow set sensitive true
	send resText set sensitive False
	send objregionButton set sensitive false
	send objregactivateButton set sensitive false
	send objplotsButton set sensitive false
	send objactivateButton set sensitive false
	send skyregionButton set sensitive false
	send skyregactivateButton set sensitive false
	send skyactivateButton set label Deactivate
	send plotslogButton set sensitive false
    }
}
send ucursor addCallback ucursorCallback

# The activate plot window callback.
proc uplotsCallback { param old new } {
    if { [yes $new] } {
	winMap xguiphot_results
    } else {
	winUnmap xguiphot_results
    }
}
send uplots addCallback uplotsCallback

proc objregactivateCallback args {
    set mode [send ucursor getValue]
    if { $mode == "objregionplot" } {
        send client gkey q
    } else {
        send client gkey \\
        send client gkey J
	send client gkey g
    }
}
send objregactivateButton addCallback objregactivateCallback

proc objactivateCallback args {
    set mode [send ucursor getValue]
    if { $mode == "objectplot" } {
        send client gkey q
    } else {
        send client gkey \\
        send client gkey C
	send client gkey g
    }
}
send objactivateButton addCallback objactivateCallback


proc skyregactivateCallback args {
    set mode [send ucursor getValue]
    if { $mode == "skyregionplot" } {
        send client gkey q
    } else {
        send client gkey \\
        send client gkey K
	send client gkey g
    }
}
send skyregactivateButton addCallback skyregactivateCallback

proc skyactivateCallback args {
    set mode [send ucursor getValue]
    if { $mode == "skyplot" } {
        send client gkey q
    } else {
        send client gkey \\
        send client gkey S
	send client gkey g
    }
}
send skyactivateButton addCallback skyactivateCallback

proc plotslog args {
    if { [send plotslogButton get label] == "Yes"} {
	send client gcmd logresults no
    } else {
	send client gcmd logresults yes
    }
}
send plotslogButton addCallback plotslog

proc plotshelp args {
    helpMove helpText #pgpanel args
    if { [send uhelp getValue] == "no" } {
        set mode [send ucursor getValue]
        if { $mode == "objregionplot" } {
	    send client gkey q 
	    send client gkey ? 
	    send client gkey \\
	    send client gkey J
	} elseif { $mode == "objectplot" } {
	    send client gkey q 
	    send client gkey ? 
	    send client gkey \\
	    send client gkey C
	} elseif { $mode == "skyregionplot" } {
	    send client gkey q 
	    send client gkey ? 
	    send client gkey \\
	    send client gkey K
	} elseif { $mode == "skyplot" } {
	    send client gkey q 
	    send client gkey ? 
	    send client gkey \\
	    send client gkey S
        } else {
	    send client gkey ?
        }
    }
}
send plotshelpButton addCallback plotshelp

proc plotsclose args {
    set mode [send ucursor getValue]
    if { $mode == "" || $mode == "imageplot" } {
        send client gkey g
    } else {
	send client gkey q
        send client gkey g
    }
}
send plotscloseButton addCallback plotsclose

# This is a kludge to get around a resize operation activating the cursor
# and doing a setGterm to the plot window even if I don't want to do that.
proc plotResize args {
    set mode [send ucursor getValue]
    if { $mode == "" || $mode == "imageplot" } {
        send client gkey G
    } elseif { $mode == "objregionplot" } {
	send client gkey q
	send client gkey c
	send client gkey g
	send client gkey q
	send client gkey k
	send client gkey g
	send client gkey q
	send client gkey s
	send client gkey g
	send client gkey q
	send client gkey \\
	send client gkey J
	send client gkey g
    } elseif { $mode == "skyregionplot" } {
	send client gkey q
	send client gkey j
	send client gkey g
	send client gkey q
	send client gkey c
	send client gkey g
	send client gkey q
	send client gkey s
	send client gkey g
	send client gkey q
	send client gkey \\
	send client gkey K
	send client gkey g
    } elseif { $mode == "objectplot" } {
	send client gkey q
	send client gkey j
	send client gkey g
	send client gkey q
	send client gkey k
	send client gkey g
	send client gkey q
	send client gkey s
	send client gkey g
	send client gkey q
	send client gkey \\
	send client gkey C
	send client gkey g
    } elseif { $mode == "skyplot" } {
	send client gkey q
	send client gkey j
	send client gkey g
	send client gkey q
	send client gkey k
	send client gkey g
	send client gkey q
	send client gkey c
	send client gkey g
	send client gkey q
	send client gkey \\
	send client gkey S
	send client gkey g
    }
}
send objplotsWindow addCallback plotResize resize

# Plotting Menus

createMenu objplotsMenu objregionButton {
    {   "Object Display"       f.title                           }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {   "Image"                f.menu objoverlaysMenu             }
    {                          f.line                            }
    {                          f.line                            }
    {   "Surface"              f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objregionplot" } {
                                       send client gkey s
				   } else {
                                       send client gkey j
                                       send client gkey s
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Contour"              f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objregionplot" } {
                                       send client gkey c
				   } else {
                                       send client gkey j
                                       send client gkey c
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Replot"               f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objregionplot" } {
                                       send client gkey g
				   } else {
                                       send client gkey j
                                       send client gkey g
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
}

createMenu objoverlaysMenu objplotsMenu {
    {   "Object Overlays"      f.title                           }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {   "Contour"              f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objregionplot" } {
                                       send client gkey o
				   } else {
                                       send client gkey j
                                       send client gkey o
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Aperture"             f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objregionplot" } {
                                       send client gkey a
				   } else {
                                       send client gkey j
                                       send client gkey a
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "None"                 f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objregionplot" } {
                                       send client gkey i
				   } else {
                                       send client gkey j
                                       send client gkey i
                                       send client gkey q
				   }
			       }                                 }
}

#    {                          f.line                            }
#    {                          f.line                            }
#    {   "Moments"              f.exec {
#                                   send client gkey j
#                                   send client gkey m
#                                   send client gkey q
#			       }                                 }

createMenu photplotsMenu objplotsButton {
    {   "Object Plots"         f.title                        }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {   "Axis Profile"       f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objectplot" } {
                                       send client gkey r
				   } else {
                                       send client gkey c
                                       send client gkey r
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Theta Profile"        f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objectplot" } {
                                       send client gkey t
				   } else {
                                       send client gkey c
                                       send client gkey t
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Curve of Growth"      f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objectplot" } {
                                       send client gkey c
				   } else {
                                       send client gkey c
                                       send client gkey c
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Half Width"           f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objectplot" } {
                                       send client gkey w
				   } else {
                                       send client gkey c
                                       send client gkey w
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Axis Ratio"           f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objectplot" } {
                                       send client gkey e
				   } else {
                                       send client gkey c
                                       send client gkey e
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Orientation"          f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objectplot" } {
                                       send client gkey p
				   } else {
                                       send client gkey c
                                       send client gkey p
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Replot"               f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "objectplot" } {
                                       send client gkey g
				   } else {
                                       send client gkey c
                                       send client gkey g
                                       send client gkey q
				   }
			       }                                 }
}

createMenu skyplotsMenu skyregionButton {
    {   "Sky Display"          f.title                           }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {   "Image"                f.menu skyoverlaysMenu            }
    {                          f.line                            }
    {                          f.line                            }
    {   "Surface"              f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "skyregionplot" } {
                                       send client gkey s
				   } else {
                                       send client gkey k
                                       send client gkey s
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Contour"              f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "skyregionplot" } {
                                       send client gkey c
				   } else {
                                       send client gkey k
                                       send client gkey c
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Replot"               f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "skyregionplot" } {
                                       send client gkey g
				   } else {
                                       send client gkey k
                                       send client gkey g
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
}

createMenu skyoverlaysMenu skyplotsMenu {
    {   "Sky Overlays"      f.title                           }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {   "Contour"              f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "skyregionplot" } {
                                       send client gkey o
				   } else {
                                       send client gkey k
                                       send client gkey o
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Aperture"             f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "skyregionplot" } {
                                       send client gkey a
				   } else {
                                       send client gkey k
                                       send client gkey a
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "None"                 f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "skyregionplot" } {
                                       send client gkey i
				   } else {
                                       send client gkey k
                                       send client gkey i
                                       send client gkey q
				   }
			       }                                 }
}

createMenu skyphotMenu skyplotsButton {
    {   "Sky Plots"            f.title                           }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {                          f.line                            }
    {   "Axis Profile"       f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "skyplot" } {
                                       send client gkey r
				   } else {
                                       send client gkey s
                                       send client gkey r
                                       send client gkey q
				   }
			       }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Theta Profile"        f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "skyplot" } {
                                       send client gkey t
				   } else {
                                       send client gkey s
                                       send client gkey t
                                       send client gkey q
				   }
                               }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Histogram"            f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "skyplot" } {
                                       send client gkey h
				   } else {
                                       send client gkey s
                                       send client gkey h
                                       send client gkey q
				   }
                               }                                 }
    {                          f.line                            }
    {                          f.line                            }
    {   "Replot"               f.exec {
				   set mode [send ucursor getValue]
				   if { $mode == "skyplot" } {
                                       send client gkey g
				   } else {
                                       send client gkey s
                                       send client gkey g
                                       send client gkey q
				   }
                               }                                 }
}



# THE STATIC OBJECT MARKER PROCEDURES

# THE OBJECT MARKER CALLBACKS.

# The object marker callback.
proc uobjmarkerCallback { param old new } {
    global obj_enable objmarker osky1marker osky2marker
    if { $obj_enable } {
	if { $new == "INDEF" } {
	    objhideMarker
	} else {
	    objmakeMarker imagedisplayWindow
	}
    }
}
send uobjmarker addCallback uobjmarkerCallback

# Select the current object.
proc selectCurobject args {
    send client gcmd oselect [send uobjno getValue]
}
	
# Delete the current object.
proc deleteCurobject args {
    send client gcmd odelete [send uobjno getValue]
}

# Undelete the current object.
proc undeleteCurobject args {
    send client gcmd oundelete [send uobjno getValue]
}

# Measure the current object.
proc measureCurobject args {
    send client gcmd oselect [send uobjno getValue]
    send client gkey .
}

# Toggle the object marker on and off.
proc toggleObjects args {
    global obj_enable objectsMenuDescription
    global phot_enable photMenuDescription
    if { $obj_enable } {
	if { [send uobjmarker getValue] == "INDEF" } {
	    if { [send objlistmarkerButton get label] == "Dismiss Marker" } {
		send objlistmarkerButton set label "Show Marker   "
	    }
	    set obj_enable 0
	} else {
	    objdestroyMarker
	}
    } else {
	if { [send uobjmarker getValue] == "INDEF" } {
	    if { [send objlistmarkerButton get label] == "Show Marker   " } {
		send objlistmarkerButton set label "Dismiss Marker"
	    }
	    set obj_enable 1
	} else {
	    objmakeMarker imagedisplayWindow
	}
    }
    editMenu objectsMenu imageobjectsButton $objectsMenuDescription
    editMenu photMenu imagephotButton $photMenuDescription
}

# CREATE THE OBJECT MARKER.

# Create the object marker.
proc objmakeMarker { parent } {

    # Define some global variables.
    global obj_enable objmarker osky1marker osky2marker
    global gopcolor goscolor

    # Destroy any previously existing object marker.
    objdestroyMarker

    # Set the input image scale.
    set impars [send uimpars getValue]
    foreach pd $impars {
	switch [lindex $pd 0] {
	iscale	{ set scale [lindex $pd 1] }
	}
    }

    # Set the sky fitting algorithm.
    set skypars [send uskypars getValue]
    foreach pd $skypars {
	switch [lindex $pd 0] {
	salgorithm  { set salgorithm [lindex $pd 1] }
	}
    }

    # Get the geometry of the object marker.
    set geometry [send uobjmarker getValue]
    set geometry [lindex $geometry 0]
    set ogeometry [lindex $geometry 0]
    set sgeometry [lindex $geometry 1]

    # Decode the object geometry.
    set ox [lindex $ogeometry 0]
    set oy [lindex $ogeometry 1]
    set oshape [lindex $ogeometry 2]
    if { $oshape == "circle" } {
        set oradius [lindex $ogeometry 3]
	set onver 0
	set over ""
    } elseif { $oshape == "polygon" } {
        set onver [lindex $ogeometry 3]
	set over [lindex $ogeometry 4]
    } else {
	set onver 0
	set over ""
        set oradius [lindex $ogeometry 3]
	set oaxratio [lindex $ogeometry 4]
	set oposangle [lindex $ogeometry 5]
    }

    # Transform the object geometry system to the marker geometry system.
    if { $oshape == "circle" } {
	set oaxratio 1.0
	set oposangle 0.0
    } elseif { $oshape == "polygon" } {
	set oradius 10.0
	set oaxratio 1.0
	set oposangle 0.0
    }

    # Transform the object polygon vertices if any to screen coordinates.
    mapVertices $over tover $onver

    # Decode the geometry of the sky markers.
    set sx [lindex $sgeometry 0]
    set sy [lindex $sgeometry 1]
    set sshape [lindex $sgeometry 2]
    if { $sshape == "circle" } {
	set snver 0
	set s1ver ""
	set s2ver ""
        set s1radius [lindex $sgeometry 3]
        set s2radius [lindex $sgeometry 4]
    } elseif { $sshape == "polygon" } {
        set snver [lindex $sgeometry 3]
	set s1ver [lindex $sgeometry 4]
	set s2ver [lindex $sgeometry 5]
    } else {
	set snver 0
	set s1ver ""
	set s2ver ""
        set s1radius [lindex $sgeometry 3]
        set s2radius [lindex $sgeometry 4]
	set saxratio [lindex $sgeometry 5]
	set sposangle [lindex $sgeometry 6]
    }

    # Transform the client sky geometry to the marker geometry.
    if { $sshape == "circle" } {
	set saxratio 1.0
	set sposangle 0.0
    } elseif { $sshape == "polygon" } {
	set s1radius 10.0
	set s2radius 20.0
	set saxratio 1.0
	set sposangle 0.0
    }

    # Transform the sky polygon vertices if any to screen coordinates.
    mapVertices $s1ver ts1ver $snver
    mapVertices $s2ver ts2ver $snver

    # Enable object marking.
    set obj_enable 1

    # Find the center of the screen.
    send $parent queryRaster 0 xcur ycur
    set xcur [expr "$xcur / 2.0"]
    set ycur [expr "$ycur / 2.0"]

    # Compute the x and y magnification factors.
    myunmapPixel $parent 1 $xcur $ycur rx1 ry1
    myunmapPixel $parent 1 [expr "$xcur+1"] [expr "$ycur+1"] rx2 ry2
    set xmag [expr "abs (1.0 / ($rx2 - $rx1))"]
    set ymag [expr "abs (1.0 / ($ry2 - $ry1))"]

    # Compute the screen coordinates.
    mymapPixel $parent 1 $sx $sy sxx syy

    # Get the default marker colors.
    set omarkpars [send uomarkpars getValue]
    foreach pd $omarkpars {
	switch [lindex $pd 0] {
	opcolormark	{ set opcolor [lindex $pd 1] }
	oscolormark	{ set oscolor [lindex $pd 1] }
	}
    }
    if { $goscolor != "INDEF" } {
	set oscolor $goscolor
    }
    if { $gopcolor != "INDEF" } {
	set opcolor $gopcolor
    }

    set osky2markerTranslations { \
         !Shift <Btn1Down>:     m_raise()  m_markpos()
                <Btn1Down>:     m_raise()  m_markpos()
                  <Btn1Up>:     m_redraw() m_destroyNull()
                <Btn2Down>:     m_lower()
                    <Key>i:     m_input() graphics-input() \
	                        call(resetAllmarkers)
                   :<Key>Z:     m_input() call(kresetAllmarkers,Z)
                   :<Key>P:     m_input() call(kresetAllmarkers,P)
                   :<Key>X:     m_input() call(kresetAllmarkers,X)
                   :<Key>Y:     m_input() call(kresetAllmarkers,Y)
                   :<Key>R:     m_input() call(kresetAllmarkers,R)
                   :<Key>0:     m_input() call(kresetAllmarkers,0)
                   :<Key>1:     m_input() call(kresetAllmarkers,1)
                   :<Key>2:     m_input() call(kresetAllmarkers,2)
                   :<Key>3:     m_input() call(kresetAllmarkers,3)
                   :<Key>4:     m_input() call(kresetAllmarkers,4)
                   :<Key>5:     m_input() call(kresetAllmarkers,5)
                   :<Key>6:     m_input() call(kresetAllmarkers,6)
                   :<Key>7:     m_input() call(kresetAllmarkers,7)
                   :<Key>8:     m_input() call(kresetAllmarkers,8)
                   :<Key>9:     m_input() call(kresetAllmarkers,9)
                   :<Key>M:     m_input() call(kresetAllmarkers,M)
                   :<Key>E:     m_input() call(kresetAllmarkers,E)
            <Key>BackSpace:     call(objdestroyMarker)
               <Key>Delete:     call(objdestroyMarker)
                <KeyPress>:     m_input() graphics-input()
    }


    # Create the outer sky annulus marker.
    send $parent createMarker $osky2marker \
        type                $sshape \
        createMode          noninteractive \
        translations        $osky2markerTranslations \
        lineColor           $oscolor \
        x                   $sxx \
        y                   $syy \
	width	[expr "$s2radius * $xmag  / $scale"] \
	height [expr "$saxratio * $s2radius * $ymag / $scale"] \
	rotangle	    $sposangle \
	knotSize	    0 \
        highlightColor      $oscolor \
        activated	    True \
        visible		    False \
        sensitive	    True

    # Set the sky1 marker translations
    set osky1markerTranslations { \
         !Shift <Btn1Down>:     m_raise()  m_markpos()
                <Btn1Down>:     m_raise()  m_markpos()
                  <Btn1Up>:     m_redraw() m_destroyNull()
                <Btn2Down>:     m_lower()
                    <Key>i:     m_input() graphics-input() \
	                        call(resetAllmarkers)
                   :<Key>Z:     m_input() call(kresetAllmarkers,Z)
                   :<Key>P:     m_input() call(kresetAllmarkers,P)
                   :<Key>X:     m_input() call(kresetAllmarkers,X)
                   :<Key>Y:     m_input() call(kresetAllmarkers,Y)
                   :<Key>R:     m_input() call(kresetAllmarkers,R)
                   :<Key>0:     m_input() call(kresetAllmarkers,0)
                   :<Key>1:     m_input() call(kresetAllmarkers,1)
                   :<Key>2:     m_input() call(kresetAllmarkers,2)
                   :<Key>3:     m_input() call(kresetAllmarkers,3)
                   :<Key>4:     m_input() call(kresetAllmarkers,4)
                   :<Key>5:     m_input() call(kresetAllmarkers,5)
                   :<Key>6:     m_input() call(kresetAllmarkers,6)
                   :<Key>7:     m_input() call(kresetAllmarkers,7)
                   :<Key>8:     m_input() call(kresetAllmarkers,8)
                   :<Key>9:     m_input() call(kresetAllmarkers,9)
                   :<Key>M:     m_input() call(kresetAllmarkers,M)
                   :<Key>E:     m_input() call(kresetAllmarkers,E)
            <Key>BackSpace:     call(objdestroyMarker)
               <Key>Delete:     call(objdestroyMarker)
                <KeyPress>:     m_input() graphics-input()
    }

    # Create the inner sky annulus marker.
    send $parent createMarker $osky1marker \
        type                $sshape \
        createMode          noninteractive \
        translations        $osky1markerTranslations \
        lineColor           $oscolor \
        x                   $sxx \
        y                   $syy \
	width	[expr "$s1radius * $xmag  / $scale"] \
	height [expr "$saxratio * $s1radius * $ymag / $scale"] \
	rotangle	    $sposangle \
	knotSize	    0 \
        highlightColor      $oscolor \
        activated	    True \
        visible		    False \
        sensitive	    True


    # Compute the object marker center.
    mymapPixel $parent 1 $ox $oy oxx oyy

    # Define the object marker translations.
    set objmarkerTranslations { \
         !Shift <Btn1Down>:     m_raise()  m_markpos()
                <Btn1Down>:     m_raise()  m_markpos()
                  <Btn1Up>:     m_redraw() m_destroyNull()
                <Btn2Down>:     m_lower()
		<Btn3Down>:     popup(objmarkerMenu)
		  <Btn3Up>:     popdown(objmarkerMenu)
		    <Key>~:     call(selectCurobject)
		   :<Key>.:     call(measureCurobject)
		    <Key>d:     call(deleteCurobject)
		    <Key>u:     call(undeleteCurobject)
                    <Key>i:     m_input() graphics-input() \
	                        call(resetAllmarkers)
                   :<Key>Z:     m_input() call(kresetAllmarkers,Z)
                   :<Key>P:     m_input() call(kresetAllmarkers,P)
                   :<Key>X:     m_input() call(kresetAllmarkers,X)
                   :<Key>Y:     m_input() call(kresetAllmarkers,Y)
                   :<Key>R:     m_input() call(kresetAllmarkers,R)
                   :<Key>0:     m_input() call(kresetAllmarkers,0)
                   :<Key>1:     m_input() call(kresetAllmarkers,1)
                   :<Key>2:     m_input() call(kresetAllmarkers,2)
                   :<Key>3:     m_input() call(kresetAllmarkers,3)
                   :<Key>4:     m_input() call(kresetAllmarkers,4)
                   :<Key>5:     m_input() call(kresetAllmarkers,5)
                   :<Key>6:     m_input() call(kresetAllmarkers,6)
                   :<Key>7:     m_input() call(kresetAllmarkers,7)
                   :<Key>8:     m_input() call(kresetAllmarkers,8)
                   :<Key>9:     m_input() call(kresetAllmarkers,9)
                   :<Key>M:     m_input() call(kresetAllmarkers,M)
                   :<Key>E:     m_input() call(kresetAllmarkers,E)
            <Key>BackSpace:     call(objdestroyMarker)
               <Key>Delete:     call(objdestroyMarker)
                <KeyPress>:     m_input() graphics-input()
    }


    # Create the object marker.
    send $parent createMarker $objmarker \
        type                $oshape \
        createMode          noninteractive \
        translations        $objmarkerTranslations \
        lineColor           $opcolor \
        x                   $oxx \
        y                   $oyy \
	width		    [expr "$oradius * $xmag / $scale"] \
	height		    [expr "$oaxratio * $oradius * $ymag / $scale"] \
	rotangle            $oposangle \
	knotSize	    0 \
	highlightColor      $opcolor \
	activated	    True \
	visible		    False \
	sensitive	    True

    # Set the sky marker vertices.
    if { $sshape == "polygon" } {
	send $osky1marker setVertices $ts1ver
	#send $osky1marker getVertices ts1ver
	send $osky2marker setVertices $ts2ver
	#send $osky2marker getVertices ts2ver
    }

    # Set the object marker vertices.
    if { $oshape == "polygon" } {
	send $objmarker setVertices $tover 
	#send $objmarker getVertices tover
    }

    # Make the markers visible if they are on the screen.
    send $parent queryRaster 1 width height
    if { $ox >= 0 && $ox <= [expr "$width-1"] && $oy >= 0 && \
        $oy <= [expr "$height-1"] } {

        if { $salgorithm != "constant" && $salgorithm != "zero" && \
            $salgorithm != "file" } {
            send $osky2marker set visible True
            send $osky1marker set visible True
        }
        send $objmarker set visible True

        # Redraw the sky markers to make them immediately visible. Don't know
        # if this is necessary. Can't remember why this is in the routine.
        # Something do do with marker redrawing problems?
        #send $osky1marker "redraw noerase; lower"
        #send $osky2marker "redraw noerase; lower"
    }

    # Update the object list button.
    if { [send objlistmarkerButton get label] == "Show Marker   " } {
	send objlistmarkerButton set label "Dismiss Marker"
    }
}


# REDRAW THE OBJECT MARKER

# Redraw the object marker.
proc objresizeMarker args {
    uobjmarkerCallback "" "" [send uobjmarker getValue]
}
send imagedisplayWindow addCallback objresizeMarker resize

# HIDE THE OBJECT MARKER.

# Hide the object marker.
proc objhideMarker args {
    global obj_enable objmarker osky1marker osky2marker
    if { $obj_enable } {
	if { [send server queryObject $objmarker] } {
	    send $objmarker set visible False
	}
	if { [send server queryObject $osky1marker] } {
	    send $osky1marker set visible False
	}
	if { [send server queryObject $osky2marker] } {
	    send $osky2marker set visible False
	}
    }
}

# DESTROY THE OBJECT MARKER.

# Destroy the object marker.
proc objdestroyMarker args {
    global objmarker osky1marker osky2marker
    #global imtitle_enable track_enable obj_enable phot_enable crosshairId
    global obj_enable objectsMenuDescription
    global phot_enable photMenuDescription
    if { $obj_enable } {
	if { [send server queryObject $objmarker] } {
            send $objmarker destroy
	}
	if { [send server queryObject $osky1marker] } {
            send $osky1marker destroy
	}
	if { [send server queryObject $osky2marker] } {
            send $osky2marker destroy
	}
	set obj_enable 0
	if { [send objlistmarkerButton get label] == "Dismiss Marker" } {
	    send objlistmarkerButton set label "Show Marker   "
	}
    }
    editMenu objectsMenu imageobjectsButton $objectsMenuDescription
    editMenu photMenu imagephotButton $photMenuDescription
}


# Define the object marker menu.
set objmarkerMenuDescription { \
    {    "Object Marker Menu"	         f.title			      }
    {			                 f.line          	              }
    {			                 f.line          	              }
    {    "f | Select next object"        f.exec "send client gkey f"          }
    {    "b | Select previous object"    f.exec "send client gkey b"          }
    {    "~ | Select current object"     f.exec "selectCurobject"             }
    {			                 f.line                               }
    {			                 f.line                               }
    {    "d | Delete current object"     f.exec  "deleteCurobject"            }
    {    "u | Undelete current object"   f.exec  "undeleteCurobject"          }
    {			                 f.line                               }
    {			                 f.line                               }
    {    "o | Measure next object"       f.exec "send client gkey o"          }
    {    "- | Measure previous object"   f.exec "send client gkey -"          }
    {    ". | Measure current object"    f.exec "measureCurobject"            }
    {			                 f.line                               }
    {			                 f.line          	              }
    {    "  | Object region colors"      f.menu "objopcolorMenu"              }
    {    "  | Sky region colors"         f.menu "objoscolorMenu"              }
    {    "  | Redraw marker"             f.exec "objresizeMarker"             }
    {    "  | Help ..."                  f.exec {
					 helpMove helpText #gobjmarker args
					 if { [send uhelp getValue] == "no" } {
					    send client gkey ?
					 }
                                         }                                    }
    {    "  | Dismiss marker"            f.exec "objdestroyMarker"            }
}; createMenu objmarkerMenu imagedisplayWindow $objmarkerMenuDescription


# Set the color of the object part of the object list marker. Should
# probably make a subroutine out of the various actions ...
createMenu objopcolorMenu objmarkerMenu {
    {   "Colors"        f.title                                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Red"          f.exec  {
			   send $objmarker set highlightColor red
			   send $objmarker set lineColor red
			   send $objmarker redraw
			   set gopcolor red
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Blue"         f.exec  {
			   send $objmarker set highlightColor blue
			   send $objmarker set lineColor blue
			   send $objmarker redraw
			   set gopcolor blue
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Green"        f.exec  {
			   send $objmarker set highlightColor green
			   send $objmarker set lineColor green
			   send $objmarker redraw
			   set gopcolor green
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Yellow"       f.exec  {
			   send $objmarker set highlightColor yellow
			   send $objmarker set lineColor yellow
			   send $objmarker redraw
			   set gopcolor yellow
			} bitmap square7by7                              }
}


createMenu objoscolorMenu objmarkerMenu {
    {   "Colors"        f.title                                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Red"          f.exec  {
			   send $osky1marker set highlightColor red
			   send $osky1marker set lineColor red
			   send $osky1marker redraw
			   send $osky2marker set highlightColor red
			   send $osky2marker set lineColor red
			   send $osky2marker redraw
			   set goscolor red
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Blue"         f.exec  {
			   send $osky1marker set highlightColor blue
			   send $osky1marker set lineColor blue
			   send $osky1marker redraw
			   send $osky2marker set highlightColor blue
			   send $osky2marker set lineColor blue
			   send $osky2marker redraw
			   set goscolor blue
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Green"        f.exec  {
			   send $osky1marker set highlightColor green
			   send $osky1marker set lineColor green
			   send $osky1marker redraw
			   send $osky2marker set highlightColor green
			   send $osky2marker set lineColor green
			   send $osky2marker redraw
			   set goscolor green
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Yellow"       f.exec  {
			   send $osky1marker set highlightColor yellow
			   send $osky1marker set lineColor yellow
			   send $osky1marker redraw
			   send $osky2marker set highlightColor yellow
			   send $osky2marker set lineColor yellow
			   send $osky2marker redraw
			   set goscolor yellow
			} bitmap square7by7                              }
}



# PHOTOMETRY MARKER PROCEDURES. 

# Quite a bit of geometry management code is redundant in the following
# procedures and should really be cleaned up. Part of this is due to
# the fact that development took place in 3 stages widely separated in
# time and new ideas were tried out each time. Part of the problem is
# that much of geometry code in the obm was being debugged at the same
# time these procedures were being written. Finally there is a mismatch
# between the geometric description  used by the markers internally and
# the description used by the xapphot application, the latter being in
# my opinion more useful for scientists.

# CREATE THE MARKER FROM SCRATCH USING THE SKYPARS AND PHOTPARS PARAMETERS

# Procedure to create the photometry and sky region markers. If the sky
# fitting mode is concentric then 3 markers are activated, 1 for describing
# the photometry aperture, and 2 to describe the sky aperture. If the sky
# fitting mode is offset, then the same 3 markers are created but only
# the photometry marker is made visible.
proc photmakeMarker { parent x y } {

    # Define some global variables.
    global sky_enable phot_enable photmarker sky1marker sky2marker
    global xphotmarker yphotmarker xskymarker yskymarker
    global xrphotmarker yrphotmarker xrskymarker yrskymarker
    global wphotmarker hphotmarker rphotmarker
    global wrphotmarker hrphotmarker rrphotmarker
    global wsky1marker hsky1marker rsky1marker
    global wrsky1marker hrsky1marker rrsky1marker
    global wsky2marker hsky2marker rsky2marker
    global wrsky2marker hrsky2marker rrsky2marker
    global onvertices overtices
    global ornvertices orvertices
    global s1nvertices s1vertices s2nvertices s2vertices
    global sr1nvertices sr1vertices sr2nvertices sr2vertices
    global gapcolor gascolor

    global photmarkerTranslations sky1markerTranslations sky2markerTranslations 

    # Destroy any previously existing markers.
    photdestroyMarker

    # Fix the object center to be the input cursor position.
    set xphotmarker $x
    set yphotmarker $y
    set xskymarker $x
    set yskymarker $y

    # Set the input image scale.
    set impars [send uimpars getValue]
    foreach pd $impars {
	switch [lindex $pd 0] {
	iscale	{ set scale [lindex $pd 1] }
	}
    }

    # Compute the x and y magnification factors.
    send $parent queryRaster 0 xcur ycur
    set xcur [expr "$xcur / 2.0"]
    set ycur [expr "$ycur / 2.0"]
    myunmapPixel $parent 1 $xcur $ycur rx1 ry1
    myunmapPixel $parent 1 [expr "$xcur+1"] [expr "$ycur+1"] rx2 ry2
    set xmag [expr "abs (1.0 / ($rx2 - $rx1))"]
    set ymag [expr "abs (1.0 / ($ry2 - $ry1))"]

    # Get the geometry of the object aperture marker.
    set photpars [send uphotpars getValue]
    foreach pd $photpars {
	switch [lindex $pd 0] {
	pgeometry	{ set pshape [lindex $pd 1] }
	papmax  	{ set pradius [lindex $pd 1] }
	paxratio	{ set paxratio [lindex $pd 1] }
	pposangle	{ set pposangle [lindex $pd 1] }
	pcolormark	{ set opcolor [lindex $pd 1] }
	}
    }
    if { $gapcolor != "INDEF" } {
	set opcolor $gapcolor
    } else {
	set opcolor green
    }

    # Transform the client object geometry to the marker geometry.
    if { $pshape == "circle" } {
	set ox $xphotmarker
	set oy $yphotmarker
	set paxratio 1.0
	set pposangle 0.0
	set onver 0
	set over ""
    } elseif { $pshape == "polygon" } {
	set over [send uppolygon getValue]
	if { $over == "INDEF" } {
	    set ox $xphotmarker
	    set oy $yphotmarker
	    set pshape rectangle
	    set onver 0
	    set over ""
	} else {
	    set paxratio 1.0
	    set pposangle 0.0
	    set onver [llength [lindex $over 0]]
	    mapVertices [send uppolygon getValue] over $onver
	    ctrVertices $over $onver oxpoly oypoly
	    set ox $oxpoly
	    set oy $oypoly
	}
    } else {
	set ox $xphotmarker
	set oy $yphotmarker
	set onver 0
	set over ""
    }
    set owidth [expr "$pradius * $xmag / $scale"]
    set oheight [expr "$paxratio * $pradius * $ymag / $scale"]

    # Get the geometry of the sky annulus markers.
    set skypars [send uskypars getValue]
    foreach pd $skypars {
	switch [lindex $pd 0] {
	salgorithm	{ set salgorithm [lindex $pd 1] }
	sgeometry	{ set sshape [lindex $pd 1] }
	srannulus	{ set s1radius [lindex $pd 1] }
	swannulus	{ set s2radius [lindex $pd 1] }
	saxratio	{ set saxratio [lindex $pd 1] }
	sposangle	{ set sposangle [lindex $pd 1] }
	scolormark	{ set oscolor [lindex $pd 1] }
	}
    }
    if { $gascolor != "INDEF" } {
	set oscolor $gascolor
    } else {
	set oscolor blue
    }

    # Transform the client sky geometry to the marker geometry.
    if { $sshape == "circle" } {
	set sx $xskymarker
	set sy $yskymarker
	set saxratio 1.0
	set sposangle 0.0
	set snver 0
	set s1ver ""
	set s2ver ""
    } elseif { $sshape == "polygon" } {
	set s1ver [send us1polygon getValue]
	set s2ver [send us2polygon getValue]
	if { $s1ver == "INDEF" || $s2ver == "INDEF" } {
	    set sx $xskymarker
	    set sy $yskymarker
	    set sshape rectangle
	    set snver 0
	    set s1ver ""
	    set s2ver ""
	} else {
	    set saxratio 1.0
	    set sposangle 0.0
	    #set snver [llegnth $s1ver]
	    set snver [llength [lindex $s1ver 0]]
	    mapVertices [send us1polygon getValue] s1ver $snver
	    ctrVertices $s1ver $snver sxpoly sypoly
	    set sx $sxpoly
	    set sy $sypoly
	    mapVertices [send us2polygon getValue] s2ver $snver
	}
    } else {
	set sx $xskymarker
	set sy $yskymarker
	set snver 0
	set s1ver ""
	set s2ver ""
    }
    set s1width [expr "$s1radius * $xmag / $scale"]
    set s1height [expr "$saxratio * $s1radius * $ymag / $scale"]
    set s2width	[expr "($s1radius + $s2radius) * $xmag  / $scale"]
    set s2height [expr "$saxratio * ($s1radius + $s2radius) * $ymag / $scale"]


    # Create the outer sky annulus marker.
    send $parent createMarker $sky2marker \
        type                $sshape \
        createMode          noninteractive \
        translations        $sky2markerTranslations \
        lineColor           $oscolor \
        x                   $sx \
        y                   $sy \
	width	            $s2width \
	height              $s2height \
	rotangle	    $sposangle \
	knotSize	    0 \
        highlightColor      $oscolor \
        activated	    True \
        visible		    False \
        sensitive	    True

    # Set the vertices of the outer sky polygon.
    if { $sshape == "polygon" } {
	send $sky2marker setVertices $s2ver
	send $sky2marker set x $xskymarker
	send $sky2marker set y $yskymarker
    }

    # Create the inner sky annulus marker.
    send $parent createMarker $sky1marker \
        type                $sshape \
        createMode          noninteractive \
        translations        $sky1markerTranslations \
        lineColor           $oscolor \
        x                   $sx \
        y                   $sy \
	width		    $s1width \
	height		    $s1height \
	rotangle	    $sposangle \
	knotSize	    0 \
	highlightColor      $oscolor \
	activated	    True \
	visible		    False \
	sensitive	    True

    # Set the vertices of the inner sky polygon. 
    if { $sshape == "polygon" } {
	send $sky1marker setVertices $s1ver
	send $sky1marker set x $xskymarker
	send $sky1marker set y $yskymarker
    }

    # Create the object aperture marker.
    send $parent createMarker $photmarker \
        type                $pshape \
        createMode          noninteractive \
        translations        $photmarkerTranslations \
        lineColor           $opcolor \
        x                   $ox \
        y                   $oy \
	width		    $owidth \
	height		    $oheight \
	rotangle            $pposangle \
	knotSize	    0 \
	highlightColor      $opcolor \
	activated	    True \
	visible		    False \
	sensitive	    True

    # Set the vertices of the object polygon.
    if { $pshape == "polygon" } {
	send $photmarker setVertices $over
	send $photmarker set x $xphotmarker
	send $photmarker set y $yphotmarker
    }

    # Make the markers visible.
    if { ! $sky_enable && $salgorithm != "constant" && \
        $salgorithm != "zero" && $salgorithm != "file" } {
        send $sky2marker set visible True
        send $sky1marker set visible True
    }
    send $photmarker set visible True

    set phot_enable 1

    # Store the object marker geometry in both raster and screen coordinates.
    set oregion [send $photmarker getRegion]
    set roregion [send $photmarker getRegion unmap]
    if { $pshape == "polygon" } {
        set xphotmarker [send $photmarker get x]
        set yphotmarker [send $photmarker get y]
	myunmapPixel $parent 1 $xphotmarker $yphotmarker \
	    xrphotmarker yrphotmarker
        set wphotmarker [send $photmarker get width]
        set hphotmarker [send $photmarker get height]
        set wrphotmarker $wphotmarker
        set hrphotmarker $hphotmarker
	set onvertices [lindex $oregion 2]
	set ornvertices [lindex $roregion 2]
	set overtices [lindex $oregion 3]
	set orvertices [lindex $roregion 3]
	set rphotmarker 0.0
	set rrphotmarker 0.0
    } else {
        set xphotmarker [lindex $oregion 2]
        set yphotmarker [lindex $oregion 3]
        set wphotmarker [lindex $oregion 4]
        set xrphotmarker [lindex $roregion 2]
        set yrphotmarker [lindex $roregion 3]
        set wrphotmarker [lindex $roregion 4]
	if { $pshape == "circle" } {
	    set hphotmarker [lindex $oregion 4]
	    set hrphotmarker [lindex $roregion 4]
	    set rphotmarker 0.0
	    set rrphotmarker 0.0
        } else {
	    set hphotmarker [lindex $oregion 5]
	    set rphotmarker [lindex $oregion 6]
	    set hrphotmarker [lindex $roregion 5]
	    set rrphotmarker [lindex $roregion 6]
        }
	send $photmarker getRect boundingBox junk1 junk1 jwidth jheight
	set xver1 [expr "$xphotmarker - $jwidth / 2.0"]
	set yver1 [expr "$yphotmarker - $jheight / 2.0"]
	set xver2 [expr "$xphotmarker + $jwidth / 2.0"]
	set yver2 $yver1
	set xver3 $xver2
	set yver3 [expr "$yphotmarker + $jheight / 2.0"]
	set xver4 $xver1
	set yver4 $yver3 
	set onvertices 4
	set overtices "[list [list $xver1 $yver1]] [list [list $xver2 $yver2]] \
	    [list [list $xver3 $yver3]] [list [list $xver4 $yver4]]"
	set ornvertices 4
	myunmapPixel $parent 1 $xver1 $yver1 rxver1 ryver1
	myunmapPixel $parent 1 $xver2 $yver2 rxver2 ryver2
	myunmapPixel $parent 1 $xver3 $yver3 rxver3 ryver3
	myunmapPixel $parent 1 $xver4 $yver4 rxver4 ryver4
	set orvertices "[list [list $rxver1 $ryver1]] \
	    [list [list $rxver2 $ryver2]] [list [list $rxver3 $ryver3]] \
	    [list [list $rxver4 $ryver4]]"
    }

    # Store the sky marker geometry in both screen and raster coordinates.
    set s1region [send $sky1marker getRegion]
    set rs1region [send $sky1marker getRegion unmap]
    if { $sshape == "polygon" } {
        set xskymarker [send $sky1marker get x]
        set yskymarker [send $sky1marker get y]
	myunmapPixel $parent 1 $xskymarker $yskymarker xrskymarker yrskymarker
        set wsky1marker [send $sky1marker get width]
        set hsky1marker [send $sky1marker get height]
        set wrsky1marker $wsky1marker
        set hrsky1marker $hsky1marker
	set s1nvertices [lindex $s1region 2]
	set sr1nvertices [lindex $rs1region 2]
	set s1vertices [lindex $s1region 3]
	set sr1vertices [lindex $rs1region 3]
	set rsky1marker 0.0
	set rrsky1marker 0.0
    } else {
        set xskymarker [lindex $s1region 2]
        set yskymarker [lindex $s1region 3]
        set wsky1marker [lindex $s1region 4]
        set xrskymarker [lindex $rs1region 2]
        set yrskymarker [lindex $rs1region 3]
        set wrsky1marker [lindex $rs1region 4]
	set hsky1marker [lindex $s1region 4]
	if { $sshape == "circle" } {
	    set hrsky1marker [lindex $rs1region 4]
	    set rsky1marker 0.0
	    set rrsky1marker 0.0
        } else {
	    set hsky1marker [lindex $s1region 5]
	    set rsky1marker [lindex $s1region 6]
	    set hrsky1marker [lindex $rs1region 5]
	    set rrsky1marker [lindex $rs1region 6]
	}
	send $sky1marker getRect boundingBox junk1 junk1 jwidth jheight
	set xver1 [expr "$xskymarker - $jwidth / 2.0"]
	set yver1 [expr "$yskymarker - $jheight / 2.0"]
	set xver2 [expr "$xskymarker + $jwidth / 2.0"]
	set yver2 $yver1
	set xver3 $xver2
	set yver3 [expr "$yskymarker + $jheight / 2.0"]
	set xver4 $xver1
	set yver4 $yver3 
	set s1nvertices 4
	set s1vertices "[list [list $xver1 $yver1]] \
	    [list [list $xver2 $yver2]] [list [list $xver3 $yver3]] \
	    [list [list $xver4 $yver4]]"
	set sr1nvertices 4
	myunmapPixel $parent 1 $xver1 $yver1 rxver1 ryver1
	myunmapPixel $parent 1 $xver2 $yver2 rxver2 ryver2
	myunmapPixel $parent 1 $xver3 $yver3 rxver3 ryver3
	myunmapPixel $parent 1 $xver4 $yver4 rxver4 ryver4
	set sr1vertices "[list [list $rxver1 $ryver1]] \
	    [list [list $rxver2 $ryver2]] [list [list $rxver3 $ryver3]] \
	    [list [list $rxver4 $ryver4]]"
    }

    set s2region [send $sky2marker getRegion]
    set rs2region [send $sky2marker getRegion unmap]
    if { $sshape == "polygon" } {
        set wsky2marker [send $sky2marker get width]
        set hsky2marker [send $sky2marker get height]
        set wrsky2marker $wsky2marker
        set hrsky2marker $hsky2marker
	set s2nvertices [lindex $s2region 2]
	set sr2nvertices [lindex $rs2region 2]
	set s2vertices [lindex $s2region 3]
	set sr2vertices [lindex $rs2region 3]
	set rsky2marker 0.0
	set rrsky2marker 0.0
    } else {
        set wsky2marker [lindex $s2region 4]
        set wrsky2marker [lindex $rs2region 4]
	if { $sshape == "circle" } {
	    set hsky2marker [lindex $s2region 4]
	    set hrsky2marker [lindex $rs2region 4]
	    set rsky2marker 0.0
	    set rrsky2marker 0.0
        } else {
	    set hsky2marker [lindex $s2region 5]
	    set rsky2marker [lindex $s2region 6]
	    set hrsky2marker [lindex $rs2region 5]
	    set rrsky2marker [lindex $rs2region 6]
	}
	send $sky2marker getRect boundingBox junk1 junk1 jwidth jheight
	set xver1 [expr "$xskymarker - $jwidth / 2.0"]
	set yver1 [expr "$yskymarker - $jheight / 2.0"]
	set xver2 [expr "$xskymarker + $jwidth / 2.0"]
	set yver2 $yver1
	set xver3 $xver2
	set yver3 [expr "$yskymarker + $jheight / 2.0"]
	set xver4 $xver1
	set yver4 $yver3 
	set s2nvertices 4
	set s2vertices "[list [list $xver1 $yver1]] \
	    [list [list $xver2 $yver2]] [list [list $xver3 $yver3]] \
	    [list [list $xver4 $yver4]]"
	set sr2nvertices 4
	myunmapPixel $parent 1 $xver1 $yver1 rxver1 ryver1
	myunmapPixel $parent 1 $xver2 $yver2 rxver2 ryver2
	myunmapPixel $parent 1 $xver3 $yver3 rxver3 ryver3
	myunmapPixel $parent 1 $xver4 $yver4 rxver4 ryver4
	set sr2vertices "[list [list $rxver1 $ryver1]] \
	    [list [list $rxver2 $ryver2]] [list [list $rxver3 $ryver3]] \
	    [list [list $rxver4 $ryver4]]"
    }


    # Define the necessary move and resize callbacks.
    send $photmarker addCallback photmoveResize moveResize
    send $sky1marker addCallback photmoveResize moveResize
    send $sky2marker addCallback photmoveResize moveResize

}


# PROCEDURE TO POSITION THE TWO SKY MARKERS 

# Procedure to position the 2 sky markers. If the sky fitting mode is
# offset the sky markers are positioned and made visible. If the sky
# fitting mode is annular then the 2 sky markers are realigned with the
# object marker.
proc photskyMarker { parent x y } {

    global phot_enable sky_enable
    global photmarker sky1marker sky2marker
    global xskymarker yskymarker xrskymarker yrskymarker

    if { $phot_enable } {
        send $sky1marker deleteCallback photmoveResize moveResize
        send $sky2marker deleteCallback photmoveResize moveResize
        if { $sky_enable } {
	    set xskymarker $x
	    set yskymarker $y
	    myunmapPixel $parent 1 $x $y xrskymarker yrskymarker
            send $sky2marker set visible False
            send $sky1marker set visible False
	    send $sky1marker set x $xskymarker
	    send $sky1marker set y $yskymarker
	    send $sky2marker set x $xskymarker
	    send $sky2marker set y $yskymarker
            send $sky2marker set visible True
            send $sky1marker set visible True
	    send $photmarker "redraw noerase; raise"
        } else {
	    set xphot [send $photmarker get x]
	    set yphot [send $photmarker get y]
	    if { $xskymarker != $xphot || $yskymarker != $yphot} {
	        set xskymarker $xphot
	        set yskymarker $yphot
	        set xrskymarker $xphot
	        set yrskymarker $yphot
                send $sky2marker set visible False
                send $sky1marker set visible False
	        send $sky1marker set x $xskymarker
	        send $sky1marker set y $yskymarker
	        send $sky2marker set x $xskymarker
	        send $sky2marker set y $yskymarker
                send $sky2marker set visible True
                send $sky1marker set visible True
	        send $sky2marker "redraw noerase; lower"
	        send $photmarker "redraw noerase; raise"
	    }
        }
        send $sky1marker addCallback photmoveResize moveResize
        send $sky2marker addCallback photmoveResize moveResize
    }
}

# PROCEDURE TO BE CALLED IF THE MARKER IS MOVED OR RESIZED BY THE USER

# Procedure to be called if the photometry region marker is moved or resized.
proc photmoveResize { marker event mregion } {

    # Define the global variables.
    global sky_enable

    # Photometry object marker variables.
    global photmarker
    global xphotmarker yphotmarker xskymarker yskymarker
    global xrphotmarker yrphotmarker xrskymarker yrskymarker
    global wphotmarker hphotmarker rphotmarker
    global wrphotmarker hrphotmarker rrphotmarker
    global onvertices overtices ornvertices orvertices

    # Photometry inner sky marker variables.
    global sky1marker
    global wsky1marker hsky1marker rsky1marker
    global wrsky1marker hrsky1marker rrsky1marker
    global s1nvertices s1vertices sr1nvertices sr1vertices

    # Photometry outer sky marker variables.
    global sky2marker
    global wsky2marker hsky2marker rsky2marker
    global wrsky2marker hrsky2marker rrsky2marker
    global s2nvertices s2vertices sr2nvertices sr2vertices

    # Get the new object marker geometry.
    set oregion [send $photmarker getRegion]
    set pshape [lindex $oregion 0]
    if { $pshape == "circle" } {
        set ox [lindex $oregion 2]
        set oy [lindex $oregion 3]
        set owidth [lindex $oregion 4]
        set oheight $owidth
	set pwidth $owidth
	set pheight $owidth
        set orotangle 0.0
        set paxratio 1.0
        set ptheta 0.0
        set onver 0
        set over ""
    } elseif { $pshape == "polygon" } {
        set ox [send $photmarker get x]
        set oy [send $photmarker get y]
        set onver [lindex $oregion 2]
        set over [lindex $oregion 3]
        set owidth [send $photmarker get width]
        set oheight [send $photmarker get height]
	set pwidth $owidth
	set pheight $oheight
	set orotangle 0.0
	set paxratio 1.0
	set ptheta [send $photmarker get rotangle]
    } else {
        set ox [lindex $oregion 2]
        set oy [lindex $oregion 3]
	set owidth [lindex $oregion 4]
	set oheight [lindex $oregion 5]
	set orotangle [lindex $oregion 6]
	if { $orotangle < 0.0 } {
	    set ptheta [expr "$orotangle + 180.0"]
	} else {
	    set ptheta $orotangle
	}
	if { $oheight > $owidth } {
	    if { $oheight <= 0.0 } {
		set paxratio 1.0
	    } else {
	        set paxratio [expr "$owidth / $oheight"]
	    }
	    set pwidth $oheight
	    set pheight $owidth
	    set ptheta [expr "$ptheta+90.0"]
	} else {
	    if { $owidth <= 0.0 } {
		set paxratio 1.0
	    } else {
	        set paxratio [expr "$oheight / $owidth"]
	    }
	    set pwidth $owidth
	    set pheight $oheight
	}
	if { $ptheta > 360.0 } {
	    set ptheta [expr "$ptheta - 360.0"]
	}
        set onver 0
	set over ""
    }

    # Get the new sky geometry.
    set s1region [send $sky1marker getRegion]
    set s2region [send $sky2marker getRegion]
    set sshape [lindex $s1region 0]
    if { $sshape == "circle" } {
        set s1x [lindex $s1region 2]
        set s1y [lindex $s1region 3]
        set s2x [lindex $s2region 2]
        set s2y [lindex $s2region 3]
        set s1width [lindex $s1region 4]
        set s2width [lindex $s2region 4]
	set ps1width $s1width
	set ps2width $s2width
        set s1height $s1width
        set s2height $s2width
        set ps1height $s1width
        set ps2height $s2width
        set s1rotangle 0.0
        set s2rotangle 0.0
        set s1nver 0
        set s1ver ""
        set s2nver 0
        set s2ver ""
        set s1ratio 1.0
        set s1theta 0.0
        set s2ratio 1.0
        set s2theta 0.0
    } elseif { $sshape == "polygon" } {
        set s1x [send $sky1marker get x]
        set s1y [send $sky1marker get y]
        set s2x [send $sky2marker get x]
        set s2y [send $sky2marker get y]
        set s1nver [lindex $s1region 2]
        set s1ver [lindex $s1region 3]
        set s2nver [lindex $s2region 2]
        set s2ver [lindex $s2region 3]
        set s1width [send $sky1marker get width]
        set s1height [send $sky1marker get height]
	set ps1width $s1width
	set ps1height $s1height
        set s2width [send $sky2marker get width]
        set s2height [send $sky2marker get height]
	set ps2width $s2width
	set ps2height $s2height
	set s1rotangle 0.0
	set s2rotangle 0.0
	set s1ratio 1.0
	set s1theta [send $sky1marker get rotangle]
	set s2ratio 1.0
	set s2theta [send $sky2marker get rotangle]
    } else {
	set s1x [lindex $s1region 2]
        set s1y [lindex $s1region 3]
	set s2x [lindex $s2region 2]
        set s2y [lindex $s2region 3]
        set s1width [lindex $s1region 4]
        set s1height [lindex $s1region 5]
        set s1rotangle [lindex $s1region 6]
	if { $s1rotangle < 0 } {
	    set s1theta [expr "$s1rotangle+180.0"]
	} else {
	    set s1theta $s1rotangle
	}
        set s2width [lindex $s2region 4]
        set s2height [lindex $s2region 5]
        set s2rotangle [lindex $s2region 6]
	if { $s2rotangle < 0 } {
	    set s2theta [expr "$s2rotangle+180.0"]
	} else {
	    set s2theta $s2rotangle
	}
	if { $s1height > $s1width } {
	    if { $s1height <= 0.0 } {
		set s1ratio 1.0
	    } else {
	        set s1ratio [expr "$s1width / $s1height"]
	    }
	    set ps1width $s1height
	    set ps1height $s1width
	    set s1theta [expr "$s1theta+90.0"]
	} else {
	    if { $s1width <= 0.0 } {
		set s1ratio 1.0
	    } else {
	        set s1ratio [expr "$s1height / $s1width"]
	    }
	    set ps1width $s1width
	    set ps1height $s1height
	}
	if { $s2height > $s2width } {
	    if { $s2height <= 0.0 } {
		set s2ratio 1.0
	    } else {
	        set s2ratio [expr "$s2width / $s2height"]
	    }
	    set ps2width $s2height
	    set ps2height $s2width
	    set s2theta [expr "$s2theta+90.0"]
	} else {
	    if { $s2width <= 0.0 } {
		set s2ratio 1.0
	    } else {
	        set s2ratio [expr "$s2height / $s2width"]
	    }
	    set ps2width $s2width
	    set ps2height $s2height
	}
	if { $s1height <= 0.0 || $s1width <= 0.0 } {
	    set s1ratio $s2ratio
	}
	if { $s1theta > 360.0 } {
	    set s1theta [expr "$s1theta - 360.0"]
	}
	if { $s2theta > 360.0 } {
	    set s2theta [expr "$s2theta - 360.0"]
	}
        set s1nver 0
	set s1ver ""
        set s2nver 0
	set s2ver ""
    }

    # Delete the callback temporarily.
    send $photmarker deleteCallback photmoveResize moveResize
    send $sky1marker deleteCallback photmoveResize moveResize
    send $sky2marker deleteCallback photmoveResize moveResize

    # Mark the object and sky marker positions.
    send $sky1marker markpos
    send $sky2marker markpos
    send $photmarker markpos

    # Match the sky apertures to the photometry aperture if the sky
    # fitting mode is concentric.
    if { ! $sky_enable && $marker == $photmarker } {


	# Match object and sky shapes and rotation angles.
	if { $wphotmarker != $owidth || $hphotmarker != $oheight  || \
	    $rphotmarker != $orotangle } {

	    # Compute how much the object marker major axis has grown and the
	    # width of the current sky marker annulus.
	    if { $wphotmarker > $hphotmarker } {
	        set odiff [expr "$pwidth - $wphotmarker"] 
	    } else {
	        set odiff [expr "$pwidth - $hphotmarker"] 
	    }
	    set sdiff [expr "$ps2width - $ps1width"] 

	    # Increase or decrease the size of the sky markers by the
	    # same amount as the object markers.
	    send $sky1marker set width [expr "$s1width + $odiff"]
	    send $sky2marker set width [expr "$s1width + $odiff + $sdiff"]
	    if { $pshape != $sshape } {
	        send $sky1marker set height [expr "($s1width + $odiff) * \
			($s1ratio + $s2ratio) / 2.0"]
	        send $sky2marker set height [expr "($s1width + $odiff + \
		        $sdiff) * ($s1ratio + $s2ratio) / 2.0"]
	    } else {
	        send $sky1marker set height [expr "($s1width + $odiff) * \
		        $paxratio"]
	        send $sky2marker set height [expr "($s1width + $odiff + \
		        $sdiff) * $paxratio"]
	    }
	    send $sky1marker set rotangle $ptheta
	    send $sky2marker set rotangle $ptheta
	}

	# Match object and sky marker positions.
	if { $ox != $xphotmarker || $oy != $yphotmarker } {
            send $sky1marker set x $ox
            send $sky1marker set y $oy
            send $sky2marker set x $ox
            send $sky2marker set y $oy
	}
    }

    # Match the first and second sky marker.
    if { $marker == $sky1marker } {

	# If the first sky marker has changed shape or orientation.
	if { $wsky1marker != $s1width || $hsky1marker != $s1height || \
	    $rsky1marker != $s1rotangle } {

	    # Force the first sky marker to be bigger than the object marker.
	    set odiff [expr "$ps1width - $pwidth"]
	    if { ! $sky_enable && $odiff <= 0.0 } {
		set swidth [expr "$ps1width - $odiff + 2.0"]
	        send $sky1marker set width $swidth
	        send $sky1marker set height [expr "$swidth * $s1ratio"]
		send $sky1marker set rotangle $s1theta 
	    } else {
	        set swidth $ps1width
	    }

	    # Preserve the distance between the markers.
	    if { $wsky1marker > $hsky1marker } {
		if { $wsky2marker > $hsky2marker } {
	            set sdiff [expr "$wsky2marker - $wsky1marker"] 
		} else {
	            set sdiff [expr "$hsky2marker - $wsky1marker"] 
		}
	    } else {
		if { $wsky2marker > $hsky2marker } {
	            set sdiff [expr "$wsky2marker - $hsky1marker"] 
		} else {
	            set sdiff [expr "$hsky2marker - $hsky1marker"] 
		}
	    }
	    send $sky2marker set width [expr "$swidth + $sdiff"]
	    send $sky2marker set height [expr "($swidth + $sdiff) * $s1ratio"]
	    send $sky2marker set rotangle $s1theta
	}

	# Match the sky aperture positions to the object position if the
	# sky fitting mode is concentric, otherwise match the second sky
	# annulus to the first.
	if { $s1x != $xskymarker || $s1y != $yskymarker } {
	    if { $sky_enable } {
                send $sky2marker set x $s1x
                send $sky2marker set y $s1y
	    } else {
                send $sky1marker set x $ox
                send $sky1marker set y $oy
                send $sky2marker set x $ox
                send $sky2marker set y $oy
	    }
	}
    }

    # Adjust the sky markers
    if { $marker == $sky2marker } {

	# If the second sky marker has changed shape  as well
	# as size change it to match the first
	if { $wsky2marker != $s2width || $hsky2marker != $s2height || 
	    $rsky2marker != $s2rotangle } {

	    set sdiff [expr "$ps2width - $ps1width"]
	    if { $sdiff <= 2.0 } {
		set sdiff 2.0
	    }
	    send $sky2marker set width [expr "$ps1width + $sdiff"]
	    send $sky2marker set height [expr "($ps1width + $sdiff) * $s2ratio"]
            send $sky2marker set rotangle $s2theta

	    send $sky1marker set width $ps1width
	    send $sky1marker set height [expr "$ps1width * $s2ratio"]
            send $sky1marker set rotangle $s2theta

	}

	# Match the sky aperture positions to the object position if the
	# sky fitting mode is concentric.
	if { $s2x != $xskymarker || $s2y != $yskymarker } {
	    if { $sky_enable } {
                send $sky1marker set x $s2x
                send $sky1marker set y $s2y
	    } else {
                send $sky1marker set x $ox
                send $sky1marker set y $oy
                send $sky2marker set x $ox
                send $sky2marker set y $oy
	    }
	}

    }

    # Redraw the markers.
    send $sky2marker "redraw erase; lower"
    send $sky1marker "redraw erase"
    send $photmarker "redraw noerase; raise"

    # Update the object marker geometry in both raster and screen coordinates.
    set oregion [send $photmarker getRegion]
    set roregion [send $photmarker getRegion unmap]
    if { $pshape == "polygon" } {
        set xphotmarker [send $photmarker get x]
        set yphotmarker [send $photmarker get y]
	myunmapPixel imagedisplayWindow 1 $xphotmarker $yphotmarker \
	    xrphotmarker yrphotmarker
        set wphotmarker [send $photmarker get width]
        set hphotmarker [send $photmarker get height]
        set wrphotmarker $wphotmarker
        set hrphotmarker $hphotmarker
	set onvertices [lindex $oregion 2]
	set ornvertices [lindex $roregion 2]
	set overtices [lindex $oregion 3]
	set orvertices [lindex $roregion 3]
	set rphotmarker 0.0
	set rrphotmarker 0.0
    } else {
	shiftVertices $overtices over $onvertices \
	    [expr "[lindex $oregion 2] - $xphotmarker"] \
	    [expr "[lindex $oregion 3] - $yphotmarker"]
	set overtices $over
	shiftVertices $orvertices over $ornvertices \
	    [expr "[lindex $roregion 2] - $xrphotmarker"] \
	    [expr "[lindex $roregion 3] - $yrphotmarker"]
	set orvertices $over
        set xphotmarker [lindex $oregion 2]
        set yphotmarker [lindex $oregion 3]
        set wphotmarker [lindex $oregion 4]
        set xrphotmarker [lindex $roregion 2]
        set yrphotmarker [lindex $roregion 3]
        set wrphotmarker [lindex $roregion 4]
	if { $pshape == "circle" } {
	    set hphotmarker [lindex $oregion 4]
	    set hrphotmarker [lindex $roregion 4]
	    set rphotmarker 0.0
	    set rrphotmarker 0.0
        } else {
	    set hphotmarker [lindex $oregion 5]
	    set rphotmarker [lindex $oregion 6]
	    set hrphotmarker [lindex $roregion 5]
	    set rrphotmarker [lindex $roregion 6]
	}
    }
    

    # Store the sky marker geometry in both raster and screen coordinates.
    set s1region [send $sky1marker getRegion]
    set rs1region [send $sky1marker getRegion unmap]
    if { $sshape == "polygon" } {
        set xskymarker [send $sky1marker get x]
        set yskymarker [send $sky1marker get y]
	myunmapPixel imagedisplayWindow 1 $xskymarker $yskymarker \
	    xrskymarker yrskymarker
        set wsky1marker [send $sky1marker get width]
        set hsky1marker [send $sky1marker get height]
        set wrsky1marker $wsky1marker
        set hrsky1marker $hsky1marker
	set s1nvertices [lindex $s1region 2]
	set sr1nvertices [lindex $rs1region 2]
	set s1vertices [lindex $s1region 3]
	set sr1vertices [lindex $rs1region 3]
	set rsky1marker 0.0
	set rrsky1marker 0.0
    } else {
	shiftVertices $s1vertices sver $s1nvertices \
	    [expr "[lindex $s1region 2] - $xskymarker"] \
	    [expr "[lindex $s1region 3] - $yskymarker"]
	set s1vertices $sver
	shiftVertices $sr1vertices sver $sr1nvertices \
	    [expr "[lindex $rs1region 2] - $xrskymarker"] \
	    [expr "[lindex $rs1region 3] - $yrskymarker"]
	set sr1vertices $sver
        set xskymarker [lindex $s1region 2]
        set yskymarker [lindex $s1region 3]
        set wsky1marker [lindex $s1region 4]
        set xrskymarker [lindex $rs1region 2]
        set yrskymarker [lindex $rs1region 3]
        set wrsky1marker [lindex $rs1region 4]
	if { $sshape == "circle" } {
	    set hsky1marker [lindex $s1region 4]
	    set hrsky1marker [lindex $rs1region 4]
	    set rsky1marker 0.0
	    set rrsky1marker 0.0
        } else {
	    set hsky1marker [lindex $s1region 5]
	    set rsky1marker [lindex $s1region 6]
	    set hrsky1marker [lindex $rs1region 5]
	    set rrsky1marker [lindex $rs1region 6]
        }
    }

    set s2region [send $sky2marker getRegion]
    set rs2region [send $sky2marker getRegion unmap]
    if { $sshape == "polygon" } {
        set wsky2marker [send $sky2marker get width]
        set hsky2marker [send $sky2marker get height]
        set wrsky2marker $wsky2marker
        set hrsky2marker $hsky2marker
	set s2nvertices [lindex $s2region 2]
	set sr2nvertices [lindex $rs2region 2]
	set s2vertices [lindex $s2region 3]
	set sr2vertices [lindex $rs2region 3]
	set rsky2marker 0.0
	set rrsky2marker 0.0
    } else {
	shiftVertices $s2vertices sver $s2nvertices \
	    [expr "[lindex $s2region 2] - $xskymarker"] \
	    [expr "[lindex $s2region 3] - $yskymarker"]
	set s2vertices $sver
	shiftVertices $sr2vertices sver $sr2nvertices \
	    [expr "[lindex $rs2region 2] - $xrskymarker"] \
	    [expr "[lindex $rs2region 3] - $yrskymarker"]
	set sr2vertices $sver
        set wsky2marker [lindex $s2region 4]
        set wrsky2marker [lindex $rs2region 4]
	if { $sshape == "circle" } {
	    set hsky2marker [lindex $s2region 4]
	    set hrsky2marker [lindex $rs2region 4]
	    set rsky2marker 0.0
	    set rrsky2marker 0.0
        } else {
            set wsky2marker [lindex $s2region 4]
	    set hsky2marker [lindex $s2region 5]
	    set rsky2marker [lindex $s2region 6]
            set wrsky2marker [lindex $rs2region 4]
	    set hrsky2marker [lindex $rs2region 5]
	    set rrsky2marker [lindex $rs2region 6]
        }
    }

    # Add the callbacks back on.
    send $photmarker addCallback photmoveResize moveResize
    send $sky1marker addCallback photmoveResize moveResize
    send $sky2marker addCallback photmoveResize moveResize
}


# PROCEDURE TO SIMPLY REDRAW THE MARKER

# Redraw the photometry marker. This procedure is called if the image
# display window is resized or the portion of the image displayed is
# changed.

proc photRedraw args {

    # Define the global variables.
    global sky_enable
    global photmarker sky1marker sky2marker
    global xphotmarker yphotmarker xskymarker yskymarker
    global xrphotmarker yrphotmarker xrskymarker yrskymarker
    global wphotmarker hphotmarker rphotmarker
    global wrphotmarker hrphotmarker rrphotmarker
    global wsky1marker hsky1marker rsky1marker
    global wrsky1marker hrsky1marker rrsky1marker
    global wsky2marker hsky2marker rsky2marker
    global wrsky2marker hrsky2marker rrsky2marker
    global onvertices overtices ornvertices orvertices
    global s1nvertices s1vertices s2nvertices s2vertices
    global sr1nvertices sr1vertices sr2nvertices sr2vertices

    # Temporarily delete the marker callbacks.
    send $photmarker deleteCallback photmoveResize moveResize
    send $sky1marker deleteCallback photmoveResize moveResize
    send $sky2marker deleteCallback photmoveResize moveResize

    # Mark the object and sky marker positions (already done).
    send $sky1marker markpos
    send $sky2marker markpos
    send $photmarker markpos

    # Set the input image scale.
    set impars [send uimpars getValue]
    foreach pd $impars {
        switch [lindex $pd 0] {
        iscale  { set scale [lindex $pd 1] }
        }
    }

    # Get the default axis ratios.
    set skypars [send uskypars getValue]
    foreach pd $skypars {
        switch [lindex $pd 0] {
        saxratio  { set sratio [lindex $pd 1] }
        }
    }
    set photpars [send uphotpars getValue]
    foreach pd $photpars {
        switch [lindex $pd 0] {
        paxratio  { set pratio [lindex $pd 1] }
        }
    }

    # Compute the x and y magnification factors.
    send imagedisplayWindow queryRaster 0 xcur ycur
    set xcur [expr "$xcur / 2.0"]
    set ycur [expr "$ycur / 2.0"]
    myunmapPixel imagedisplayWindow 1 $xcur $ycur rx1 ry1
    myunmapPixel imagedisplayWindow 1 [expr "$xcur+1"] [expr "$ycur+1"] \
        rx2 ry2
    set xmag [expr "abs (1.0 / ($rx2 - $rx1))"]
    set ymag [expr "abs (1.0 / ($ry2 - $ry1))"]

    # Reset the screen coordinates of the markers.
    mymapPixel imagedisplayWindow 1 $xrphotmarker $yrphotmarker \
        xphotmarker yphotmarker
    mymapPixel imagedisplayWindow 1 $xrskymarker $yrskymarker \
        xskymarker yskymarker

    # Recompute the photometry marker geometry.
    set pshape [send $photmarker get type] 
    if { $pshape == "circle" } {
	set ox $xphotmarker
	set oy $yphotmarker
	set pwidth $wrphotmarker
	set paxratio 1.0
	set ptheta 0.0
    } elseif { $pshape == "polygon" } {
	mapVertices [list $orvertices] overtices $onvertices
	ctrVertices $overtices $onvertices oxpoly oypoly
	set ox $oxpoly
	set oy $oypoly
	if { $wrphotmarker > $hrphotmarker } {
	    set pwidth $wrphotmarker
	} else {
	    set pwidth $hrphotmarker
	}
	set paxratio 1.0
	set ptheta 0.0
    } else {
	set ox $xphotmarker
	set oy $yphotmarker
	if { $rrphotmarker < 0.0 } {
	    set ptheta [expr "$rrphotmarker+180.0"]
	} else {
	    set ptheta $rrphotmarker
	}
	if { $wrphotmarker > $hrphotmarker } {
	    set pwidth $wrphotmarker
	    if { $wrphotmarker == 0.0 } {
	        set paxratio $pratio
	    } else {
	        set paxratio [expr "double ($hrphotmarker) / $wrphotmarker"]
	    }
	} else {
	    set pwidth $hrphotmarker
	    if { $hrphotmarker == 0.0 } {
	        set paxratio $pratio
	    } else {
	        set paxratio [expr "double ($wrphotmarker) / $hrphotmarker"]
	    }
	    set ptheta [expr "$ptheta+90.0"]
	}
    }
    set wphotmarker [expr "$pwidth * $xmag / $scale"]
    set hphotmarker [expr "$paxratio * $pwidth * $ymag / $scale"]
    set rphotmarker $ptheta

    # Recompute the sky marker geometry.
    set sshape [send $sky1marker get type]
    if { $sshape == "circle" } {
	set sx $xskymarker
	set sy $yskymarker
	set s1width $wrsky1marker
	set s2width $wrsky2marker
	set saxratio 1.0
	set stheta 0.0
    } elseif { $sshape == "polygon" } {
	mapVertices [list $sr1vertices] s1vertices $s1nvertices
	mapVertices [list $sr2vertices] s2vertices $s1nvertices
	ctrVertices $s1vertices $s1nvertices sxpoly sypoly
	set sx $sxpoly
	set sy $sypoly
	if { $wrsky1marker > $hrsky1marker } {
	    set s1width $wrsky1marker
	} else {
	    set s1width $hrsky1marker
	}
	if { $wrsky2marker > $hrsky2marker } {
	    set s2width $wrsky2marker
	} else {
	    set s2width $hrsky2marker
	}
	set saxratio 1.0
	set stheta 0.0
    } else {
	set sx $xskymarker
	set sy $yskymarker
	if { $rrsky2marker < 0.0 } {
	    set stheta [expr "$rrsky2marker+180.0"]
	} else {
	    set stheta $rrsky2marker
	}
	if { $wrsky1marker > $hrsky1marker } {
	    set s1width $wrsky1marker
	} else {
	    set s1width $hrsky1marker
	}
	if { $wrsky2marker > $hrsky2marker } {
	    set s2width $wrsky2marker
	    if { $wrsky2marker == 0.0 } {
	        set saxratio $sratio
	    } else {
	        set saxratio [expr "double ($hrsky2marker) / $wrsky2marker"]
	    }
	} else {
	    set s2width $hrsky2marker
	    if { $hrsky2marker == 0.0 } {
	        set saxratio $sratio
	    } else {
	        set saxratio [expr "double ($wrsky2marker) / $hrsky2marker"]
	    }
	    set stheta [expr "$stheta+90.0"]
	}
    }
    set wsky1marker [expr "$s1width * $xmag / $scale"]
    set hsky1marker [expr "$saxratio * $s1width * $ymag / $scale"]
    set rsky1marker $stheta
    set wsky2marker [expr "$s2width * $xmag  / $scale"]
    set hsky2marker [expr "$saxratio * $s2width * $ymag / $scale"]
    set rsky2marker $stheta

    # Update the marker geometry.
    send $photmarker set x $ox
    send $photmarker set y $oy
    send $photmarker set width  $wphotmarker
    send $photmarker set height $hphotmarker
    send $photmarker set rotangle $rphotmarker

    send $sky1marker set x $sx
    send $sky1marker set y $sy
    send $sky1marker set width $wsky1marker
    send $sky1marker set height $hsky1marker
    send $sky1marker set rotangle $rsky1marker

    send $sky2marker set x $sx
    send $sky2marker set y $sy
    send $sky2marker set width $wsky2marker
    send $sky2marker set height $hsky2marker
    send $sky2marker set rotangle $rsky2marker

    # Redraw the markers.
    send $sky2marker "redraw erase; lower"
    #send $sky1marker "redraw erase; lower"
    send $sky1marker "redraw erase"
    send $photmarker "redraw noerase; raise"

    # Add the callbacks back in.
    send $photmarker addCallback photmoveResize moveResize
    send $sky1marker addCallback photmoveResize moveResize
    send $sky2marker addCallback photmoveResize moveResize

}
send imagedisplayWindow addCallback resetPhotmarker resize


# PROCEDURE TO STORE THE PHOTOMETRY MARKER GEOMETRY IN SKYPARS AND PHOTPARS

# Store the photometry region object and sky geometry in skypars and photpars
proc photstoreMarker args {

    global sky_enable photmarker sky1marker sky2marker
    global xrphotmarker yrphotmarker wrphotmarker hrphotmarker rrphotmarker
    global ornvertices orvertices
    global xrskymarker yrskymarker wrsky1marker hrsky1marker rrsky1marker
    global wrsky2marker hrsky2marker rrsky2marker
    global sr1nvertices sr1vertices sr2nvertices sr2vertices

    # Set the input image scale.
    set impars [send uimpars getValue]
    foreach pd $impars {
	switch [lindex $pd 0] {
	iscale	{ set scale [lindex $pd 1] }
        }
    }

    # Encode the photometry aperture geometry
    set pshape [send $photmarker get type]
    if { $pshape == "circle" } {
	set pradius [expr "$wrphotmarker * $scale"]
	set oregion "circle $pradius 1.0 0.0"
    } elseif { $pshape == "polygon" } {
	set oregion "polygon 10.0 $ornvertices $orvertices"
    } elseif { $pshape == "ellipse" } {
	set ptheta $rrphotmarker
	if { $hrphotmarker < $wrphotmarker } {
	    set pradius [expr "$wrphotmarker * $scale"]
	    if { $wrphotmarker == 0.0 } {
	        set paxratio 1.0
	    } else {
	        set paxratio [expr "$hrphotmarker / $wrphotmarker"]
	    }
	} else {
	    set pradius [expr "$hrphotmarker * $scale"]
	    if { $hrphotmarker == 0.0 } {
		set paxratio 1.0
	    } else {
		set paxratio [expr "$wrphotmarker / $hrphotmarker"]
	    }
	    set ptheta [expr "$ptheta + 90.0"]
	}
	if { $ptheta < 0.0 } {
	    set ptheta [expr "$ptheta + 180.0"]
	}
	if { $ptheta > 360.0 } {
	    set ptheta [expr "$ptheta - 360.0"]
	}
	set oregion "ellipse $pradius $paxratio $ptheta"
    } else {
	set ptheta $rrphotmarker
	if { $hrphotmarker < $wrphotmarker } {
	    set pradius [expr "$wrphotmarker * $scale"]
	    if { $wrphotmarker == 0.0 } {
		set paxratio 1.0
	    } else {
		set paxratio [expr "$hrphotmarker / $wrphotmarker"]
	    }
	} else {
	    set pradius [expr "$hrphotmarker * $scale"]
	    if { $hrphotmarker == 0.0 } {
		set paxratio 1.0
	    } else {
		set paxratio [expr "$wrphotmarker / $hrphotmarker"]
	    }
	    set ptheta [expr "$ptheta + 90.0"]
	}
	if { $ptheta < 0.0 } {
	    set ptheta [expr "$ptheta + 180.0"]
	}
	if { $ptheta > 360.0 } {
	    set ptheta [expr "$ptheta - 360.0"]
	}
	set oregion "rectangle $pradius $paxratio $ptheta"
    }

    # Encode the sky geometry.
    set sshape [send $sky1marker get type]
    if { $sshape == "circle" } {
	set sradius [expr "$wrsky1marker * $scale"]
	if { $sradius <= 1.0 } {
	    set sradius 0.0
	}
	set swidth [expr "($wrsky2marker - $wrsky1marker) * $scale"]
	set sregion "circle $sradius $swidth 1.0 0.0"
    } elseif { $sshape == "polygon" } {
	set xver1 [lindex [lindex $sr1vertices 0] 0]
	set yver1 [lindex [lindex $sr1vertices 0] 1]
	set xver2 [lindex [lindex $sr1vertices 1] 0]
	set yver2 [lindex [lindex $sr1vertices 1] 1]
	set dx [expr "$xver2 - $xver1"]
	set dy [expr "$yver2 - $yver1"]
	if { $dx == 0.0 } {
	    set dist1 [expr "abs ($xver1-$xrskymarker)"]
	} elseif { $dy == 0.0 } {
	    set dist1 [expr "abs ($yver1-$yrskymarker)"]
	} else {
	    set m [expr "$dy / $dx"]
	    set b1 [expr "($xver2 * $yver1 - $xver1 * $yver2) / $dx"]
	    set b2 [expr "$yrskymarker + $xrskymarker / $m"]
	    set x [expr "$m / ($m * $m + 1.0) * ($b2 - $b1)"]
	    set y [expr "$m * $x + $b1"]
	    set dist1 [expr "hypot($x - $xrskymarker, $y - $yrskymarker)"]
	}
	set xver1 [lindex [lindex $sr2vertices 0] 0]
	set yver1 [lindex [lindex $sr2vertices 0] 1]
	set xver2 [lindex [lindex $sr2vertices 1] 0]
	set yver2 [lindex [lindex $sr2vertices 1] 1]
	set dx [expr "$xver2 - $xver1"]
	set dy [expr "$yver2 - $yver1"]
	if { $dx == 0.0 } {
	    set dist2 [expr "abs ($xver1-$xrskymarker)"]
	} elseif { $dy == 0.0 } {
	    set dist2 [expr "abs ($yver1-$yrskymarker)"]
	} else {
	    set m [expr " ($yver2 - $yver1) / $dx"]
	    set b1 [expr "($xver2 * $yver1 - $xver1 * $yver2) / $dx"]
	    set b2 [expr "$yrskymarker + $xrskymarker / $m"]
	    set x [expr "$m / ($m * $m + 1.0) * ($b2 - $b1)"]
	    set y [expr "$m * $x + $b1"]
	    set dist2 [expr "hypot($x - $xrskymarker, $y - $yrskymarker)"]
	}
	if { $dist2 > $dist1 } {
	    set width [expr "$dist2 - $dist1"]
	    set sregion "polygon 0.0 $width $sr1nvertices $sr1vertices"
	} else {
	    set width [expr "$dist1 - $dist2"]
	    set sregion "polygon 0.0 $width $sr2nvertices $sr2vertices"
	}
    } elseif { $sshape == "ellipse" } {
	set stheta $rrsky1marker
	if { $hrsky1marker < $wrsky1marker } {
	    set sradius [expr "$wrsky1marker * $scale"]
	} else {
	    set sradius [expr "$hrsky1marker * $scale"]
	    set stheta [expr "$stheta + 90.0"]
	}
	if { $sradius <= 1.0 } {
	    set sradius 0.0
	}
        if { $stheta < 0.0 } {
	    set stheta [expr "$stheta + 180.0"]
	}
	if { $stheta > 360.0 } {
	    set stheta [expr "$stheta - 360.0"]
	}
	if { $hrsky2marker < $wrsky2marker } {
	    set swidth [expr "$wrsky2marker * $scale - $sradius"]
	    if { $wrsky2marker == 0.0 } {
	        set saxratio 1.0
	    } else {
	        set saxratio [expr "$hrsky2marker / $wrsky2marker"]
	    }
	} else {
	    set swidth [expr "$hrsky2marker * $scale - $sradius"]
	    if { $hrsky2marker == 0.0 } {
	        set saxratio 1.0
	    } else {
	        set saxratio [expr "$wrsky2marker / $hrsky2marker"]
	    }
	}
	set sregion "ellipse $sradius $swidth $saxratio $stheta"
    } else {
	set stheta $rrsky1marker
	if { $hrsky1marker < $wrsky1marker } {
	    set sradius [expr "$wrsky1marker * $scale"]
	} else {
	    set sradius [expr "$hrsky1marker * $scale"]
	    set stheta [expr "$stheta + 90.0"]
	}
	if { $sradius <= 1.0 } {
	    set sradius 0.0
	}
        if { $stheta < 0.0 } {
	    set stheta [expr "$stheta + 180.0"]
	}
	if { $stheta > 360.0 } {
	    set stheta [expr "$stheta - 360.0"]
	}
	if { $hrsky2marker < $wrsky2marker } {
	    set swidth [expr "$wrsky2marker * $scale - $sradius"]
	    if { $wrsky2marker == 0.0 } {
	        set saxratio 1.0
	    } else {
	        set saxratio [expr "$hrsky2marker / $wrsky2marker"]
	    }
	} else {
	    set swidth [expr "$hrsky2marker * $scale - $sradius"]
	    if { $hrsky2marker == 0.0 } {
	        set saxratio 1.0
	    } else {
	        set saxratio [expr "$wrsky2marker / $hrsky2marker"]
	    }
	}
	set sregion "rectangle $sradius $swidth $saxratio $stheta"
    }

    send client gcmd spgeometry $oregion $sregion
}


# PROCEDURE TO STORE THE MARKER POSITION AND GEOMETRY IN THE OBJECT LIST

# Store the photometry region object and sky geometry in the object list
proc photlistMarker args {

        global sky_enable photmarker sky1marker sky2marker
	global xrphotmarker yrphotmarker wrphotmarker hrphotmarker rrphotmarker
        global ornvertices orvertices
	global xrskymarker yrskymarker wrsky1marker hrsky1marker rrsky1marker
	global wrsky2marker hrsky2marker rrsky2marker
        global sr1nvertices sr1vertices sr2nvertices sr2vertices

	# Set the input image scale.
	set impars [send uimpars getValue]
	foreach pd $impars {
	    switch [lindex $pd 0] {
	    iscale	{ set scale [lindex $pd 1] }
	    }
	}

	# Encode the photometry aperture geometry
	set pshape [send $photmarker get type]
	if { $pshape == "circle" } {
	    set pradius [expr "$wrphotmarker * $scale"]
	    set oregion "$xrphotmarker $yrphotmarker circle $pradius"
	} elseif { $pshape == "polygon" } {
	    set oregion "$xrphotmarker $yrphotmarker polygon 0.0 \{ "
	    set i 0
	    while { $i < $ornvertices } {
		set xver [lindex [lindex $orvertices $i] 0]
		set yver [lindex [lindex $orvertices $i] 1]
		set oregion [format "%0.3f %0.3f\n" $xver $yver] 
		incr i 1
	    }
	    set oregion "$oregion \}"
	} elseif { $pshape == "ellipse" } {
	    set ptheta $rrphotmarker
	    if { $hrphotmarker < $wrphotmarker } {
	        set pradius [expr "$wrphotmarker * $scale"]
	        if { $wrphotmarker == 0.0 } {
		    set paxratio 1.0
		} else {
		    set paxratio [expr "$hrphotmarker / $wrphotmarker"]
		}
	    } else {
	        set pradius [expr "$hrphotmarker * $scale"]
	        if { $hrphotmarker == 0.0 } {
		    set paxratio 1.0
		} else {
		    set paxratio [expr "$wrphotmarker / $hrphotmarker"]
		}
		set ptheta [expr "$ptheta + 90.0"]
	    }
	    if { $ptheta < 0.0 } {
		set ptheta [expr "$ptheta + 180.0"]
	    }
	    if { $ptheta > 360.0 } {
		set ptheta [expr "$ptheta - 360.0"]
	    }
	    set oregion "$xrphotmarker $yrphotmarker ellipse $pradius \
	        $paxratio $ptheta"
	} else {
	    set ptheta $rrphotmarker
	    if { $hrphotmarker < $wrphotmarker } {
	        set pradius [expr "$wrphotmarker * $scale"]
	        if { $wrphotmarker == 0.0 } {
		    set paxratio 1.0
		} else {
		    set paxratio [expr "$hrphotmarker / $wrphotmarker"]
		}
	    } else {
	        set pradius [expr "$hrphotmarker * $scale"]
	        if { $hrphotmarker == 0.0 } {
		    set paxratio 1.0
		} else {
		    set paxratio [expr "$wrphotmarker / $hrphotmarker"]
		}
		set ptheta [expr "$ptheta + 90.0"]
	    }
	    if { $ptheta < 0.0 } {
		set ptheta [expr "$ptheta + 180.0"]
	    }
	    if { $ptheta > 360.0 } {
		set ptheta [expr "$ptheta - 360.0"]
	    }
	    set oregion "$xrphotmarker $yrphotmarker rectangle $pradius \
	        $paxratio $ptheta"
	}

	# Encode the sky geometry.
	set sshape [send $sky1marker get type]
	if { $sshape == "circle" } {
	    set s1radius [expr "$wrsky1marker * $scale"]
	    if { $s1radius <= 1.0 } {
		set s1radius 0.0
	    }
	    set s2radius [expr "$wrsky2marker * $scale"]
	    if { $sky_enable } {
	        set sregion "$xrskymarker $yrskymarker circle $s1radius \
		    $s2radius"
	    } else {
	        set sregion "circle $s1radius $s2radius"
	    }
	} elseif { $sshape == "polygon" } {
	    set xver1 [lindex [lindex $sr1vertices 0] 0]
	    set yver1 [lindex [lindex $sr1vertices 0] 1]
	    set xver2 [lindex [lindex $sr1vertices 1] 0]
	    set yver2 [lindex [lindex $sr1vertices 1] 1]
	    set dx [expr "$xver2 - $xver1"]
	    set dy [expr "$yver2 - $yver1"]
	    if { $dx == 0.0 } {
	        set dist1 [expr "abs ($xver1-$xrskymarker)"]
	    } elseif { $dy == 0.0 } {
	        set dist1 [expr "abs ($yver1-$yrskymarker)"]
	    } else {
		set m [expr "$dy / $dx"]
		set b1 [expr "($xver2 * $yver1 - $xver1 * $yver2) / $dx"]
		set b2 [expr "$yrskymarker + $xrskymarker / $m"]
		set x [expr "$m / ($m * $m + 1.0) * ($b2 - $b1)"]
		set y [expr "$m * $x + $b1"]
	        set dist1 [expr "hypot($x - $xrskymarker, $y - $yrskymarker)"]
	    }
	    set xver1 [lindex [lindex $sr2vertices 0] 0]
	    set yver1 [lindex [lindex $sr2vertices 0] 1]
	    set xver2 [lindex [lindex $sr2vertices 1] 0]
	    set yver2 [lindex [lindex $sr2vertices 1] 1]
	    set dx [expr "$xver2 - $xver1"]
	    set dy [expr "$yver2 - $yver1"]
	    if { $dx == 0.0 } {
	        set dist2 [expr "abs ($xver1-$xrskymarker)"]
	    } elseif { $dy == 0.0 } {
	        set dist2 [expr "abs ($yver1-$yrskymarker)"]
	    } else {
		set m [expr " ($yver2 - $yver1) / $dx"]
		set b1 [expr "($xver2 * $yver1 - $xver1 * $yver2) / $dx"]
		set b2 [expr "$yrskymarker + $xrskymarker / $m"]
		set x [expr "$m / ($m * $m + 1.0) * ($b2 - $b1)"]
		set y [expr "$m * $x + $b1"]
	        set dist2 [expr "hypot($x - $xrskymarker, $y - $yrskymarker)"]
	    }
	    if { $dist2 > $dist1 } {
		set width [expr "$dist2 - $dist1"]
	        set sregion "polygon 0.0 $width $sr1nvertices $sr1vertices"
	    } else {
		set width [expr "$dist1 - $dist2"]
	        set sregion "polygon 0.0 $width $sr2nvertices $sr2vertices"
	    }
	} elseif { $sshape == "ellipse" } {
	    set stheta $rrsky2marker
	    if { $hrsky2marker < $wrsky2marker } {
	        set s2radius [expr "$wrsky2marker * $scale"]
	        if { $wrsky2marker == 0.0 } {
		    set saxratio 1.0
	        } else {
		    set saxratio [expr "$hrsky2marker / $wrsky2marker"]
	        }
	    } else {
	        set s2radius [expr "$hrsky2marker * $scale"]
	        if { $hrsky2marker == 0.0 } {
		    set saxratio 1.0
	        } else {
		    set saxratio [expr "$wrsky2marker / $hrsky2marker"]
	        }
		set stheta [expr "$stheta + 90.0"]
	    }
	    if { $hrsky1marker < $wrsky1marker } {
	        set s1radius [expr "$wrsky1marker * $scale"]
	    } else {
	        set s1radius [expr "$hrsky1marker * $scale"]
	    }
	    if { $s1radius <= 1.0 } {
		set s1radius 0.0
	    }
	    if { $stheta < 0.0 } {
		set stheta [expr "$stheta + 180.0"]
	    }
	    if { $stheta > 360.0 } {
		set stheta [expr "$stheta - 360.0"]
	    }
	    if { $sky_enable } {
	        set sregion "$xrskymarker $yrskymarker ellipse $s1radius \
		    $s2radius $saxratio $stheta"
	    } else {
	        set sregion "ellipse $s1radius $s2radius $saxratio $stheta"
	    }
	} else {
	    set stheta $rrsky2marker
	    if { $hrsky2marker < $wrsky2marker } {
	        set s2radius [expr "$wrsky2marker * $scale"]
	        if { $wrsky2marker == 0.0 } {
		    set saxratio 1.0
	        } else {
		    set saxratio [expr "$hrsky2marker / $wrsky2marker"]
	        }
	    } else {
	        set s2radius [expr "$hrsky2marker * $scale"]
	        if { $hrsky2marker == 0.0 } {
		    set saxratio 1.0
	        } else {
		    set saxratio [expr "$wrsky2marker / $hrsky2marker"]
	        }
		set stheta [expr "$stheta + 90.0"]
	    }
	    if { $hrsky1marker < $wrsky1marker } {
	        set s1radius [expr "$wrsky1marker * $scale"]
	    } else {
	        set s1radius [expr "$hrsky1marker * $scale"]
	    }
	    if { $s1radius <= 1.0 } {
		set s1radius 0.0
	    }
	    if { $stheta < 0.0 } {
		set stheta [expr "$stheta + 180.0"]
	    }
	    if { $stheta > 360.0 } {
		set stheta [expr "$stheta - 360.0"]
	    }
	    if { $sky_enable } {
	        set sregion "$xrskymarker $yrskymarker rectangle $s1radius \
		    $s2radius $saxratio $stheta"
	    } else {
	        set sregion "rectangle $s1radius $s2radius $saxratio $stheta"
	    }
	}

	send client gcmd oadd "$oregion ; $sregion"
}


# DO PHOTOMETRY THROUGH THE MARKER

# Do photometry through the marker.
proc photmeasureMarker args {

    global sky_enable xphotmarker yphotmarker xskymarker yskymarker

    # Turn off pset updating and send the marker geoemtry to the client.
    send client gcmd save skypars no
    send client gcmd save photpars no
    photstoreMarker

    # Make the measurement.
    send imagedisplayWindow getCursorPos xcur ycur
    send imagedisplayWindow setCursorPos $xphotmarker $yphotmarker
    send client gkey \040
    if { $sky_enable } {
        send imagedisplayWindow setCursorPos $xskymarker $yskymarker
        send client gkey \040
    }
    send imagedisplayWindow setCursorPos $xcur $ycur

    # Restore the old object and sky geometry parameters.
    skyparsUpdateCallback
    photparsUpdateCallback
}

# DESTROY THE PHOTOMETRY MARKERS

# Destroy the photometry markers.
proc photdestroyMarker args {
    #global imtitle_enable track_enable obj_enable phot_enable crosshairId
    global phot_enable sky_enable displayMenuDescription
    global photmarker sky1marker sky2marker
    if { $phot_enable } {
	if { [send server queryObject $photmarker] } {
            send $photmarker destroy
	}
	if { [send server queryObject $sky1marker] } {
            send $sky1marker destroy
	}
	if { [send server queryObject $sky2marker] } {
            send $sky2marker destroy
	}
	set phot_enable 0
    }
    editMenu displayMenu imagedisplayWindow $displayMenuDescription
}

# TOGGLE THE PHOTOMETRY MARKER MENUS.

# Toggle the photometry marker menus.
proc togglePhotmarker { name x y } {
    global phot_enable sky_enable displayMenuDescription
    if { $phot_enable } {
	photdestroyMarker
    } else {
	photmakeMarker $name $x $y
    }
    editMenu displayMenu imagedisplayWindow $displayMenuDescription
}

# Define the region marker menu.
set regmarkerMenuDescription { \
    {    "Phot Marker Menu"	         f.title			      }
    {			                 f.line          	              }
    {			                 f.line          	              }
    {			                 f.line          	              }
    {			                 f.line          	              }
    {    "Measure "                      f.exec "photmeasureMarker"           }
    {			                 f.line          	              }
    {			                 f.line          	              }
    {    "Save to object list"           f.exec "photlistMarker"              }
    {    "Save to psets"                 f.exec "photstoreMarker"             }
    {			                 f.line          	              }
    {			                 f.line          	              }
    {    "Object geometry"               f.menu "regogeomMenu"                }
    {    "Sky geometry"                  f.menu "regsgeomMenu"                }
    {    "Object colors"                 f.menu "regopcolorMenu"              }
    {    "Sky colors"                    f.menu "regoscolorMenu"              }
    {    "Redraw marker"                 f.exec "resetPhotmarker"             }
    {			                 f.line          	              }
    {			                 f.line          	              }
    {    "Help ..."                      f.exec {
                                         helpMove helpText #gphotmarker args
					 if { [send uhelp getValue] == "no" } {
					    send client gkey ?
					 }
                                         }                                    }
    {    "Dismiss marker"            f.exec "photdestroyMarker"           }
}; createMenu regmarkerMenu imagedisplayWindow $regmarkerMenuDescription

# Set the geometry of the object part of the region marker.
createMenu regogeomMenu regmarkerMenu {
    {   "Object shape"  f.title                                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   "   Circle"     f.exec  {
			   send $photmarker markpos
			   send $photmarker set type circle
			   send $photmarker "redraw erase;"
			   photRedraw
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   "  Ellipse"     f.exec  {
			   send $photmarker markpos
			   send $photmarker set type ellipse
			   send $photmarker "redraw erase;"
			   photRedraw
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   "Rectangle"     f.exec  {
			   send $photmarker markpos
			   send $photmarker set type rectangle
			   send $photmarker "redraw erase;"
			   photRedraw
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   "  Polygon"     f.exec  {
			   send $photmarker markpos
			   send $photmarker set type polygon
			   send $photmarker "redraw erase;"
			   photRedraw
			}                                                }
}

# Set the color of the object part of the region marker. Should
# probably make a subroutine out of the various actions ...
createMenu regopcolorMenu regmarkerMenu {
    {   "Object Colors" f.title                                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Red"          f.exec  {
			   send $photmarker set highlightColor red
			   send $photmarker set lineColor red
			   send $photmarker redraw
			   set gapcolor red
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Blue"         f.exec  {
			   send $photmarker set highlightColor blue
			   send $photmarker set lineColor blue
			   send $photmarker redraw
			   set gapcolor blue
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Green"        f.exec  {
			   send $photmarker set highlightColor green
			   send $photmarker set lineColor green
			   send $photmarker redraw
			   set gapcolor green
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Yellow"       f.exec  {
			   send $photmarker set highlightColor yellow
			   send $photmarker set lineColor yellow
			   send $photmarker redraw
			   set gapcolor yellow
			} bitmap square7by7                              }
}


# Set the geometry of the sky part of the region marker.
createMenu regsgeomMenu regmarkerMenu {
    {   "Sky shape"     f.title                                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   "   Circle"     f.exec  {
			   send $sky1marker markpos
			   send $sky2marker markpos
			   send $sky1marker set type circle
			   send $sky2marker set type circle
			   send $sky1marker "redraw erase;"
			   send $sky2marker "redraw erase;"
			   photRedraw
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   "  Ellipse"     f.exec  {
			   send $sky1marker markpos
			   send $sky2marker markpos
			   send $sky1marker set type ellipse
			   send $sky2marker set type ellipse
			   photRedraw
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   "Rectangle"     f.exec  {
			   send $sky1marker markpos
			   send $sky2marker markpos
			   send $sky1marker set type rectangle
			   send $sky2marker set type rectangle
			   send $sky1marker "redraw erase;"
			   send $sky2marker "redraw erase;"
			   photRedraw
			}                                                }
    {                   f.line                                           }
    {                   f.line                                           }
    {   "  Polygon"     f.exec  {
			   send $sky1marker markpos
			   send $sky2marker markpos
			   send $sky1marker set type polygon
			   send $sky2marker set type polygon
			   send $sky1marker "redraw erase;"
			   send $sky2marker "redraw erase;"
			   photRedraw
			}                                                }
}

createMenu regoscolorMenu regmarkerMenu {
    {   "Sky colors"    f.title                                          }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Red"          f.exec  {
			   send $sky1marker set highlightColor red
			   send $sky1marker set lineColor red
			   send $sky1marker redraw
			   send $sky2marker set highlightColor red
			   send $sky2marker set lineColor red
			   send $sky2marker redraw
			   set gascolor red
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Blue"         f.exec  {
			   send $sky1marker set highlightColor blue
			   send $sky1marker set lineColor blue
			   send $sky1marker redraw
			   send $sky2marker set highlightColor blue
			   send $sky2marker set lineColor blue
			   send $sky2marker redraw
			   set gascolor blue
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Green"        f.exec  {
			   send $sky1marker set highlightColor green
			   send $sky1marker set lineColor green
			   send $sky1marker redraw
			   send $sky2marker set highlightColor green
			   send $sky2marker set lineColor green
			   send $sky2marker redraw
			   set gascolor green
			} bitmap square7by7                              }
    {                   f.line                                           }
    {                   f.line                                           }
    {   " Yellow"       f.exec  {
			   send $sky1marker set highlightColor yellow
			   send $sky1marker set lineColor yellow
			   send $sky1marker redraw
			   send $sky2marker set highlightColor yellow
			   send $sky2marker set lineColor yellow
			   send $sky2marker redraw
			   set gascolor yellow
			} bitmap square7by7                              }
}


# The Photometry Marker Translations.

set photmarkerTranslations { \
       !Shift <Btn1Motion>:     m_rotateResize()
              <Btn1Motion>:     m_moveResize()
         !Shift <Btn1Down>:     m_raise()  m_markpos()
                <Btn1Down>:     m_raise()  m_markpos()
                  <Btn1Up>:     m_redraw()
                <Btn2Down>:     m_lower()
                <Btn3Down>:     popup(regmarkerMenu)
                  <Btn3Up>:     popdown(regmarkerMenu)
	        <Key>space:     call(photmeasureMarker)
                    <Key>i:     m_input() graphics-input() \
                                call(resetAllmarkers)
                   :<Key>Z:     m_input() call(kresetAllmarkers, Z)
                   :<Key>P:     m_input() call(kresetAllmarkers, P)
                   :<Key>X:     m_input() call(kresetAllmarkers, X)
                   :<Key>Y:     m_input() call(kresetAllmarkers, Y)
                   :<Key>R:     m_input() call(kresetAllmarkers, R)
                   :<Key>0:     m_input() call(kresetAllmarkers, 0)
                   :<Key>1:     m_input() call(kresetAllmarkers, 1)
                   :<Key>2:     m_input() call(kresetAllmarkers, 2)
                   :<Key>3:     m_input() call(kresetAllmarkers, 3)
                   :<Key>4:     m_input() call(kresetAllmarkers, 4)
                   :<Key>5:     m_input() call(kresetAllmarkers, 5)
                   :<Key>6:     m_input() call(kresetAllmarkers, 6)
                   :<Key>7:     m_input() call(kresetAllmarkers, 7)
                   :<Key>8:     m_input() call(kresetAllmarkers, 8)
                   :<Key>9:     m_input() call(kresetAllmarkers, 9)
                   :<Key>M:     m_input() call(kresetAllmarkers, M)
                   :<Key>E:     m_input() call(kresetAllmarkers, E)
            <Key>BackSpace:     call(photdestroyMarker)
               <Key>Delete:     call(photdestroyMarker)
                <KeyPress>:     m_input()
}

set sky1markerTranslations { \
       !Shift <Btn1Motion>:     m_rotateResize()
              <Btn1Motion>:     m_moveResize()
         !Shift <Btn1Down>:     m_raise()  m_markpos()
                <Btn1Down>:     m_raise()  m_markpos()
                  <Btn1Up>:     m_redraw()
                <Btn2Down>:     m_lower()
                    <Key>i:     m_input() graphics-input() \
                                call(resetAllmarkers)
                   :<Key>Z:     m_input() call(kresetAllmarkers, Z)
                   :<Key>P:     m_input() call(kresetAllmarkers, P)
                   :<Key>X:     m_input() call(kresetAllmarkers, X)
                   :<Key>Y:     m_input() call(kresetAllmarkers, Y)
                   :<Key>R:     m_input() call(kresetAllmarkers, R)
                   :<Key>0:     m_input() call(kresetAllmarkers, 0)
                   :<Key>1:     m_input() call(kresetAllmarkers, 1)
                   :<Key>2:     m_input() call(kresetAllmarkers, 2)
                   :<Key>3:     m_input() call(kresetAllmarkers, 3)
                   :<Key>4:     m_input() call(kresetAllmarkers, 4)
                   :<Key>5:     m_input() call(kresetAllmarkers, 5)
                   :<Key>6:     m_input() call(kresetAllmarkers, 6)
                   :<Key>7:     m_input() call(kresetAllmarkers, 7)
                   :<Key>8:     m_input() call(kresetAllmarkers, 8)
                   :<Key>9:     m_input() call(kresetAllmarkers, 9)
                   :<Key>M:     m_input() call(kresetAllmarkers, M)
                   :<Key>E:     m_input() call(kresetAllmarkers, E)
            <Key>BackSpace:     call(photdestroyMarker)
               <Key>Delete:     call(photdestroyMarker)
                <KeyPress>:     m_input()
}

set sky2markerTranslations { \
       !Shift <Btn1Motion>:     m_rotateResize()
              <Btn1Motion>:     m_moveResize()
         !Shift <Btn1Down>:     m_raise()  m_markpos()
                <Btn1Down>:     m_raise()  m_markpos()
                  <Btn1Up>:     m_redraw()
                <Btn2Down>:     m_lower()
                    <Key>i:     m_input() graphics-input() \
                                call(resetAllmarkers)
                   :<Key>Z:     m_input() call(kresetAllmarkers, Z)
                   :<Key>P:     m_input() call(kresetAllmarkers, P)
                   :<Key>X:     m_input() call(kresetAllmarkers, X)
                   :<Key>Y:     m_input() call(kresetAllmarkers, Y)
                   :<Key>R:     m_input() call(kresetAllmarkers, R)
                   :<Key>0:     m_input() call(kresetAllmarkers, 0)
                   :<Key>1:     m_input() call(kresetAllmarkers, 1)
                   :<Key>2:     m_input() call(kresetAllmarkers, 2)
                   :<Key>3:     m_input() call(kresetAllmarkers, 3)
                   :<Key>4:     m_input() call(kresetAllmarkers, 4)
                   :<Key>5:     m_input() call(kresetAllmarkers, 5)
                   :<Key>6:     m_input() call(kresetAllmarkers, 6)
                   :<Key>7:     m_input() call(kresetAllmarkers, 7)
                   :<Key>8:     m_input() call(kresetAllmarkers, 8)
                   :<Key>9:     m_input() call(kresetAllmarkers, 9)
                   :<Key>M:     m_input() call(kresetAllmarkers, M)
                   :<Key>E:     m_input() call(kresetAllmarkers, E)
            <Key>BackSpace:     call(photdestroyMarker)
               <Key>Delete:     call(photdestroyMarker)
                <KeyPress>:     m_input()
}


# SOME USEFUL COORDINATE MAPPING ROUTINES

# Convert the image display screen coordinates to raster coordinates
# assuming that the desired mapping is in slot mapping.

proc myunmapPixel { parent mapping sxin syin rxout ryout } {

    # Define the output variables.
    upvar $rxout xout
    upvar $ryout yout

    # Return if mapping is not defined.
    set active [send $parent activeMapping $mapping]
    if { ! $active } {
	set xout $sxin
	set yout $syin
	return
    }

    # Get the mapping.
    send $parent getMapping $mapping rop src st sx sy snx sny \
        dst dt dx dy dnx dny
    set dx [expr "$dx / 32767.0"]
    set dy [expr "$dy / 32767.0"]
    set dnx [expr "$dnx / 32767.0"]
    set dny [expr "$dny / 32767.0"]

    # Convert to NDC coordinates.
    send $parent queryRaster 0 width height
    set xout [expr "double($sxin) / $width"]
    set yout [expr "1.0 - double($syin) / $height"]

    # Convert to raster coordinates.
    set slopex [expr "$snx / $dnx"] 
    set slopey [expr "$sny / $dny"] 
    set xout [expr "$slopex * $xout + $sx + 0.5 - $slopex * $dx"]
    set yout [expr "$slopey * $yout + $sy + 0.5 - $slopey * $dy"]
}

# Convert the image display raster coordinates to screen coordinates
# assuming that the desired mapping is in slot mapping.

proc mymapPixel { parent mapping rxin ryin sxout syout } {

    # Define the output variables.
    upvar $sxout xout
    upvar $syout yout

    # Return if mapping is not defined.
    set active [send $parent activeMapping $mapping]
    if { ! $active } {
	set xout $rxin
	set yout $ryin
	return
    }

    # Get the mapping.
    send $parent getMapping $mapping rop src st sx sy snx sny \
        dst dt dx dy dnx dny
    set dx [expr "$dx / 32767.0"]
    set dy [expr "$dy / 32767.0"]
    set dnx [expr "$dnx / 32767.0"]
    set dny [expr "$dny / 32767.0"]

    # Convert to NDC coordinates.
    set slopex [expr "$dnx / $snx"] 
    set slopey [expr "$dny / $sny"] 
    set xout [expr "$slopex * $rxin + $dx - $slopex * ($sx + 0.5)"]
    set yout [expr "$slopey * $ryin + $dy - $slopey * ($sy + 0.5)"]

    # Convert to screen coordinates.
    send $parent queryRaster 0 width height
    set xout [expr "$xout * $width"]
    set yout [expr "(1.0 - $yout) * $height"]
}


# Routine to map vertices coming in from xapphot in the form
# { { xver1 yver1 } { xver2 yver2 } ... { xvernver yvernver } } 
# in image coordinates to the form { xver1 yver1 } { xver2 yver2 }
# { xvernver yvernver } in screen coordinates.

proc mapVertices { inver outver nver } {
    upvar $outver toutver
    set toutver { }
    set pd [lindex $inver 0]
    set i 0
    while { $i < $nver } {
	set coords [lindex $pd $i]
	set xver [lindex $coords 0]
	set yver [lindex $coords 1]
	mymapPixel imagedisplayWindow 1 $xver $yver oxver oyver
	set coords [list $oxver $oyver]
	lappend toutver $coords
	incr i 1
    }
}

# Procedure to compute the centroid of a list of polygon vertices  and
# subtract it off to produce an output lists of vertices, assuming that the
# input list of vertices is in the form {xver1 yver1 } { xver2 yver2 } ...
# {xvernver yvernver }.

proc zeroVertices { inver outver nver xmean ymean } {
    upvar $outver toutver
    upvar $xmean  txmean
    upvar $ymean  tymean
    set toutver { }
    set sumx 0.0
    set sumy 0.0
    set i 0
    while { $i < $nver } {
	set coords [lindex $inver $i]
	set xver [lindex $coords 0]
	set yver [lindex $coords 1]
	set sumx [expr "$sumx + $xver"]
	set sumy [expr "$sumy + $yver"]
	incr i 1
    }
    if { $nver > 0 } {
	set txmean [expr "$sumx / $nver"]
	set tymean [expr "$sumy / $nver"]
    } else {
	set txmean 0.0
	set tymean 0.0
    }
    set i 0
    while { $i < $nver } {
	set coords [lindex $inver $i]
	set xver [lindex $coords 0]
	set yver [lindex $coords 1]
	set xver [expr "$xver - $txmean"]
	set yver [expr "$yver - $tymean"]
	set coords [list $xver $yver]
	lappend toutver $coords
	incr i 1
    }
}

# Procedure to compute the centroid of a list of polygon vertices assuming
# that the vertices list is in the form {xver1 yver1 } { xver2 yver2 } ...
# {xvernver yvernver }

proc ctrVertices { inver nver xmean ymean } {
    upvar $xmean  txmean
    upvar $ymean  tymean
    set sumx 0.0
    set sumy 0.0
    set i 0
    while { $i < $nver } {
	set coords [lindex $inver $i]
	set xver [lindex $coords 0]
	set yver [lindex $coords 1]
	set sumx [expr "$sumx + $xver"]
	set sumy [expr "$sumy + $yver"]
	incr i 1
    }
    if { $nver > 0 } {
	set txmean [expr "$sumx / $nver"]
	set tymean [expr "$sumy / $nver"]
    } else {
	set txmean 0.0
	set tymean 0.0
    }
}

# Procedure to shift a list of polygon vertices by a given amount assuming
# that the vertices lists is in the form {xver1 yver1 } { xver2 yver2 } ...
# {xvernver yvernver }

proc shiftVertices { inver outver nver xshift yshift } {
    upvar $outver toutver 
    set toutver { }
    set i 0
    while { $i < $nver } {
	set coords [lindex $inver $i]
	set xver [lindex $coords 0]
	set yver [lindex $coords 1]
	set xver [expr "$xver + $xshift"]
	set yver [expr "$yver + $yshift"]
	set coords [list $xver $yver]
	lappend toutver $coords
	incr i 1
    }
}
