COMPILE FUNCTION Comm_PRS_Substrate(Instruction, Parm1,Parm2)

/*
	Commuter module for PRS_Substrate (Product Specification - Substrate) window
	
	06/13/2004 - John C. Henry, J.C. Henry & Co., Inc.
*/

DECLARE SUBROUTINE Set_Property, End_Dialog, Send_Event, Set_Status, Center_Window, Post_Event
DECLARE SUBROUTINE ErrMsg, Send_Message, Set_Property, Send_Event, Btree.Extract, obj_AppWindow
DECLARE FUNCTION Get_Property, Get_Status, Dialog_Box, Utility, Center_Window, Popup, Collect.Ixvals
DECLARE FUNCTION Send_Message, obj_PR_Spec, Msg

$INSERT POPUP_EQUATES
$INSERT MSG_EQUATES
$INSERT APPCOLORS
$INSERT PRS_SUBSTRATE_EQU

EQU CRLF$	TO \0D0A\

ErrTitle = 'Error in Comm_PRS_Substrate'
ErrorMsg = ''

Result = ''

BEGIN CASE
	CASE Instruction = 'Create' 		; GOSUB Create
	CASE Instruction = 'Refresh'		; GOSUB Refresh
	CASE Instruction = 'Read'			; GOSUB Read
	CASE Instruction = 'Write'			; GOSUB Write
	CASE Instruction = 'Clear'			; GOSUB Clear
	CASE Instruction = 'Page'			; GOSUB Page
	CASE Instruction = 'LUPSNo'			; GOSUB LUPSNo
	CASE Instruction = 'BLDopantDC'		; GOSUB BLDopantDC
	
	CASE 1
		ErrorMsg = 'Unknown Instruction passed to routine.'
		ErrMsg(ErrorMsg)
END CASE

RETURN Result



* * * * * * *
Create:
* * * * * * *

obj_Appwindow('Create',@WINDOW)

CALL Set_List_Box_Data(@WINDOW)

GOSUB Refresh


RETURN

* * * * * * *
Clear:
* * * * * * *


* * * * * * *
Refresh:
* * * * * * *

Ctrls  = @WINDOW:'.QBF_FIRST_FIX':@RM		; Props  = 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_PREV_FIX':@RM		; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_ABS_FIX':@RM			; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_NEXT_FIX':@RM		; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_LAST_FIX':@RM		; Props := 'ENABLED':@RM
Ctrls := @WINDOW:'.QBF_STOP_FIX'			; Props := 'ENABLED'

IF Get_Property(@WINDOW,'QBFLIST') = '' THEN
	Vals = 0:@RM:0:@RM:0:@RM:0:@RM:0:@RM:0
END ELSE
	Vals = 1:@RM:1:@RM:1:@RM:1:@RM:1:@RM:1
END

Set_Property(Ctrls,Props,Vals)

* Turn edit table symbolic column backgrounds to green

ETSymbolics = Get_Property(@WINDOW,'@ET_SYMBOLICS')		;* Loaded during 'Create' in obj_Appwindow

ETCtrls	= ETSymbolics<1>
ETCols	= ETSymbolics<2>

FOR I = 1 TO COUNT(ETCtrls,@VM) + (ETCtrls NE '')
	ETCtrl	= ETCtrls<1,I>
	ETList = Get_Property(ETCtrl,'LIST')
	FOR Line = 1 TO COUNT(ETList,@FM) + (ETList NE '')
		IF ETList<Line,1> NE '' THEN
			FOR N = 1 TO COUNT(ETCols<1,I>,@SVM) + (ETCols<1,I> NE '')
				stat = Send_Message(ETCtrl,'COLOR_BY_POS',ETCols<1,I,N>,Line,GREEN$)
			NEXT N
		END
	NEXT I
NEXT I

Ctrls  = @WINDOW:'.SUB_PRE_CLEAN':@RM		; Props  = 'DEFPROP':@RM
Ctrls := @WINDOW:'.SUB_POST_CLEAN'			; Props := 'DEFPROP'
 
Vals = Get_Property(Ctrls,Props)

PreCleanMethod	= Vals[1,@RM]
PostCleanMethod	= Vals[COL2()+1,@RM]

PreCleanFlag = INDEX(PreCleanMethod,'Akrion',1) + INDEX(PreCleanMethod,'If Necessary',1)
PostCleanFlag = INDEX(PostCleanMethod,'Akrion',1) + INDEX(PostCleanMethod,'If Necessary',1)

IF NOT(PreCleanFlag) AND NOT(PostCleanFlag) THEN
	Set_Property(@WINDOW:'.AKRION_GROUP','ENABLED',0)
END ELSE
	Set_Property(@WINDOW:'.AKRION_GROUP','ENABLED',1)
	
	IF PreCleanFlag THEN
		Set_Property(@WINDOW:'.PRECLEAN_AKRIONRECIPES','ENABLED',1)
	END ELSE
		Set_Property(@WINDOW:'.PRECLEAN_AKRIONRECIPES','ENABLED',0)
	END
	
	IF PostCleanFlag THEN
		Set_Property(@WINDOW:'.POSTCLEAN_AKRIONRECIPES','ENABLED',1)
	END ELSE
		Set_Property(@WINDOW:'.POSTCLEAN_AKRIONRECIPES','ENABLED',0)
	END
END

RETURN


* * * * * * *
Page:
* * * * * * *

obj_Appwindow('Page')
GOSUB Refresh

RETURN

* * * * * * *
Read:
* * * * * * *

GOSUB Refresh

RETURN


* * * * * * *
Write:
* * * * * * *

RETURN




* * * * * * *
LUPSNo:
* * * * * * * 

ReturnTo = Parm1

PS_Nos = obj_PR_Spec('Find')

IF PS_Nos = '' THEN RETURN

IF INDEX(PS_Nos,@FM,1) THEN
	Send_Event(@WINDOW,'CLEAR')
	Set_Property(@WINDOW,'QBFLIST',PS_Nos)
	Send_Event(@WINDOW,'QBFFIRST')
	GOSUB Refresh
END ELSE
	obj_AppWindow('LUValReturn',PS_Nos:@RM:ReturnTo)
END

RETURN



* * * * * * *
BLDopantDC:
* * * * * * *

CtrlEntID = @WINDOW:'.BL_DOPANT'

CurrPos = Get_Property(CtrlEntID,'SELPOS')
CurrCol = CurrPos<1>
CurrRow = CurrPos<2>

TypeOver = ''
TypeOver<PDISPLAY$> = XLATE('LISTBOX_CONFIG','DOPANT',1,'X')	;* MV'd list of options
TypeOver<PTITLE$> = 'Buried Layer Dopants'

Dopant = Popup(@WINDOW,TypeOver,'DOPANTS')

IF Dopant NE '' THEN
	obj_AppWindow('LUValReturn',Dopant:@RM:CtrlEntID:@RM:CurrPos)
END

RETURN


