/* Copyright © 1994 Apple Computer, Inc. All Rights Reserved. author Mike Engber FalseAlarm-2 version history v1 - initial release v2 - uses new alarm stub - bug fix - if the FalseAlarm app was closed when the alarm went off, DoAlarm blindly sent messages to a child view (that didn't exist since FalseAlarm was closed) */ constant kAppSymbol := '|FalseAlarm:PIEDTS|; constant kAppString := "FalseAlarm:PIEDTS"; refNum := OpenResFileX( Home & "FalseAlarm.rsrc"); DefConst('kAlarmSound,GetSound("dadadadadada")); CloseResFileX(refNum); DefConst('kAlarmFn, func() begin if GetRoot().(kAppSymbol) exists then GetRoot().(kAppSymbol):DoAlarm() else GetRoot():Notify(kNotifyAlert,"FalseAlarm","App not installed."); end ); DefConst('kPopUpList,[ { item: "1 minute", dt: 1, }, { item: "2 minutes", dt: 2, }, { item: "5 minutes", dt: 5, }, { item: "10 minutes", dt: 10,}, ]); "Reg the llama"; // ---- End Project Data ---- // ---- File FalseAlarm.t ---- // Before Script for "FalseAlarmBase" // Copyright © 1994 by Apple Computer, Inc. All rights reserved. FalseAlarmBase := {title: "False Alarm", viewBounds: {left: 1, top: 10, right: 203, bottom: 246}, viewJustify: 16, pickActionScript: func(index) begin local time := Time() + kPopUpList[index].dt; call kAddAlarmFunc with (kAppString,time,nil,kAlarmFn,[]); AlarmButton:Close(); TimeArea:Open(); SetValue(alarmTime,'text,HourMinute(time)); SetValue(curTime,'text,HourMinute(Time()) && TimeInSeconds() MOD 60); :SetUpIdle(1000); end, DoAlarm: func() begin PlaySound(kAlarmSound); if call kViewIsOpenFunc with (self) then begin AlarmButton:Open(); TimeArea:Close(); :SetUpIdle(0); end end, viewIdleScript: func() begin SetValue(curTime,'text,HourMinute(Time()) && TimeInSeconds() MOD 60); 1000; end, _proto: protoApp, debug: "FalseAlarmBase" }; alarmButton := /* child of FalseAlarmBase */ {text: "Set Alarm", buttonClickScript: func() begin DoPopUp(kPopUpList,:LocalBox().right,0,GetRoot().(kAppSymbol)); //see the PickActionScript of FalseAlarmBase for the code that sets the alarm end, viewBounds: {left: 0, top: 34, right: 100, bottom: 54}, viewJustify: 8388630, _proto: protoTextButton, debug: "alarmButton" }; // View alarmButton is declared to FalseAlarmBase timeArea := /* child of FalseAlarmBase */ {viewFlags: 0, viewFormat: nil, viewBounds: {left: 6, top: 64, right: 198, bottom: 184}, viewclass: 74, debug: "timeArea" }; // View timeArea is declared to FalseAlarmBase _view000 := /* child of timeArea */ {text: "current time", viewBounds: {left: 8, top: 16, right: 88, bottom: 32}, _proto: protoStaticText }; _view001 := /* child of timeArea */ {text: "alarm time", viewBounds: {left: 8, top: 40, right: 88, bottom: 56}, _proto: protoStaticText }; curTime := /* child of timeArea */ {text: "cur time", viewBounds: {left: 100, top: 16, right: 180, bottom: 32}, _proto: protoStaticText, debug: "curTime" }; // View curTime is declared to FalseAlarmBase alarmTime := /* child of timeArea */ {text: "alarm time", viewBounds: {left: 100, top: 40, right: 180, bottom: 56}, _proto: protoStaticText, debug: "alarmTime" }; // View alarmTime is declared to FalseAlarmBase _view002 := /* child of timeArea */ {text: "Kill Alarm", buttonClickScript: func() begin call kRemoveAlarmFunc with (kAppString); GetRoot().(kAppSymbol):DoAlarm(); end, viewBounds: {left: 50, top: 74, right: 134, bottom: 94}, _proto: protoTextButton }; // ---- Beginning of section for non used Layout files ---- // End of output