//set up memory for switch states [If,[MemGetSize,MC_FocalLength_Mem],, [MVarDef,MC_FocalLength_Mem,3] [MVarSet,MC_FocalLength_Mem,0,0]//"Draw:Focal Length:110" [MVarSet,MC_FocalLength_Mem,1,0]//"Draw:Focal Length:180" [MVarSet,MC_FocalLength_Mem,2,0]//"Draw:Focal Length:220" ] [RoutineDef,Startup,//sets switches to respond first time when user clicks [VarDef,winID,0] [VarDef,idx,100] [IFreeze, [If,[IExists,"Draw:Focal Length:220"], [VarSet,winID,[IGet,Preferences:Utilities:View Window Id]] [Loop,1, [If,winID==[IGetID,"Draw:Focal Length:110"],[VarSet,idx,0][LoopExit]] [If,winID==[IGetID,"Draw:Focal Length:180"],[VarSet,idx,1][LoopExit]] [If,winID==[IGetID,"Draw:Focal Length:220"],[VarSet,idx,2][LoopExit]] ] [If,idx != 100, [If,([MVarGet,MC_FocalLength_Mem,idx]==0), [MVarSet,MC_FocalLength_Mem,idx,1] , [ MVarSet,MC_FocalLength_Mem,idx,0] ] ] ] ] ] [RoutineCall,Startup]//run every time plugin loads //routine to set the focal length [RoutineDef,SetFocalLength, [If,id == 0,[ISet,"Draw:Focal length(mm)",110]] [If,id == 1,[ISet,"Draw:Focal length(mm)",180]] [If,id == 2,[ISet,"Draw:Focal length(mm)",220]] ,id] /*INTERFACE*/ [ISubPalette,"Draw:Focal Length"] [ISwitch,"Draw:Focal Length:110",[MVarGet,MC_FocalLength_Mem,0],"Set Focal Length to 110mm", [IFreeze, [IUnPress,"Draw:Focal Length:180"] [IUnPress,"Draw:Focal Length:220"] ] [RoutineCall,SetFocalLength,0] , [VarSet,winID,[IGet,Preferences:Utilities:View Window Id]] [If,winID==[IGetID,"Draw:Focal Length:110"], [ISet,"Draw:Focal Length:110",1] ] [RoutineCall,SetFocalLength,0] ,,.167]//width 1/6 of palette width [ISwitch,"Draw:Focal Length:180",[MVarGet,MC_FocalLength_Mem,1],"Set Focal Length to 180mm", [IFreeze, [IUnPress,"Draw:Focal Length:110"] [IUnPress,"Draw:Focal Length:220"] ] [RoutineCall,SetFocalLength,1] , [VarSet,winID,[IGet,Preferences:Utilities:View Window Id]] [If,winID==[IGetID,"Draw:Focal Length:180"], [ISet,"Draw:Focal Length:180",1] ] [RoutineCall,SetFocalLength,1] ,,.166] [ISwitch,"Draw:Focal Length:220",[MVarGet,MC_FocalLength_Mem,0],"Set Focal Length to 220mm", [IFreeze, [IUnPress,"Draw:Focal Length:180"] [IUnPress,"Draw:Focal Length:110"] ] [RoutineCall,SetFocalLength,2] , [VarSet,winID,[IGet,Preferences:Utilities:View Window Id]] [If,winID==[IGetID,"Draw:Focal Length:220"], [ISet,"Draw:Focal Length:220",1] ] [RoutineCall,SetFocalLength,2] ,,.167] [IEnable,"Draw:Focal Length:110"] [IEnable,"Draw:Focal Length:180"] [IEnable,"Draw:Focal Length:220"]