(* This file was automatically generated by the *) (* *) (* VisualObliq Dialog Editor *) (* VERSION 3.0 *) (* Krishna Bharat/Marc H Brown/Luca Cardelli *) (* You may edit the LunchPlans.New procedure to configure *) (* the start up process *) (* Copyright (C) 1993, Digital Equipment Corporation *) (* All rights reserved. *) (* See the file COPYRIGHT for a full description. *) (* You should not have to edit this file manually *) module LunchPlans; var allForms = []; var migrateTo = 0; (* to allow you to migrate to a remote receiver *) var installAt = 0; (* to allow you to create remote clients *) var form1 = ok; var form1Alive = ok; var form1Instances = 0; var form1Constructor = ok; var form1New = proc(Local) (form1Constructor.VONew)(Local); end; var main = ok; var mainAlive = ok; var mainInstances = 0; var mainConstructor = ok; var mainNew = proc(Local) (mainConstructor.VONew)(Local); end; (* global code *) let initialPlaces = [ "Any Place", "Andale's", "Fratelli's", "Jing Jing", "Liddicoat's", "Miyake", "Nataraja"]; let placeMgr = { serialized, places => [], addNewPlace => meth(s, plname) var alreadyThere = false; foreach p in s.places do alreadyThere := alreadyThere or text_equal(p.name, plname); end; if not(alreadyThere) then s.places := s.places @ [{ name => plname, where => "", when => "", disc => "", interested => [] }]; if mainInstances isnot 0 then (* some forms were created *) foreach fm in main do fm.options.appendElement(plname & " (0)"); end end; end; ok end, init => meth(s) foreach pl in initialPlaces do s.addNewPlace(pl); end; end, addNewLine => meth(s, line, ix) s.places[ix].disc := s.places[ix].disc & line; foreach f in main do if (f.current is ix) then f.discussion.appendText(line); end; end; end, joinGroup => meth(s, ix, who) (* is this guy already in the interested set? *) var alreadyIn = false; foreach party in s.places[ix].interested do if text_equal(party, who) then alreadyIn := true; end; end; if not(alreadyIn) then s.places[ix].interested := s.places[ix].interested @ [who]; end; (* update all the browser entries *) let newlabel = s.places[ix].name &" (" & fmt_int(#(s.places[ix].interested)) & ")"; foreach fm in main do var member = false; foreach party in s.places[ix].interested do member := member or text_equal(party, fm.username); end; if member then fm.options.putElement(ix, newlabel & " **joined**") else fm.options.putElement(ix, newlabel) end; end; ok end, leaveGroup => meth(s, ix, who) (* is this guy in the group *) var wasInGroup = false; let size = #( s.places[ix].interested); for i = 0 to size-1 do let party = s.places[ix].interested[i]; if text_equal(party, who) then wasInGroup := true; var newarray = array_sub(s.places[ix].interested, 0, i); if i meth(s, newinstance) (* this is a critical section *) if form1Instances is 0 then form1 := [newinstance]; form1Alive := [true]; form1Instances := 1; 0 else let indx = form1Instances; newinstance.INDEX := indx; form1Alive := form1Alive @ [true]; form1 := form1 @ [newinstance]; form1Instances := indx + 1; (* now the new object is globally visible *) indx end end, VONew => proc(LOCAL) (* this has to be a procedure because it needs to be done at the client site *) var SELF = 0; var VOInstance = 0; VOInstance := { FORM => 0, INDEX => 0, (* set in Register *) (* Support Code *) (* Object Definitions *) text1 => ( let temp = LOCAL.textNew("text1"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.form1 end; temp.x := 19; temp.y := 30; temp.width := 336; temp.height := 49; temp.BgColor := " YellowishBisque"; temp.FgColor := " Black"; temp.Font := "-*-helvetica-bold-*R-*240-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Lowered"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "Lunch Plans"; temp), text4 => ( let temp = LOCAL.textNew("text4"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.form1 end; temp.x := 77; temp.y := 86; temp.width := 251; temp.height := 22; temp.BgColor := "VerySlightlyBluishGrey85"; temp.FgColor := "DullBrown"; temp.Font := "-*-helvetica-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Flat"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "Author: Krishna Bharat"; temp), button1 => ( let temp = LOCAL.buttonNew("button1"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.form1 end; temp.x := 100; temp.y := 340; temp.width := 193; temp.height := 34; temp.BgColor := "RatherLightYellow"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 1; temp.Embellishment := "None"; temp.InitialState := "Active"; temp.ResizeModel := "CenterPin"; temp.textLabel := true; temp.textString := "Proceed"; temp.pixmap := ""; temp.Guard := false; temp.Trill := false; temp), textedit2 => ( let temp = LOCAL.texteditNew("textedit2"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.form1 end; temp.x := 19; temp.y := 108; temp.width := 344; temp.height := 131; temp.BgColor := "VeryLightYellow"; temp.FgColor := "DarkSienna"; temp.Font := "-*-helvetica-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Chiseled"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.teReadOnly := true; temp.teClip := false; temp.teHasScrollbar := false; temp.teContents := " Lunch Plans is a collaborative tool to: 1. Find out about existing lunch plans. 2. Suggest a new lunch option. 3. Join a lunch plan if you are interested. 4. Discuss and set up a time & place to meet. "; temp.teFromFile := ""; temp.getFromFile := false; temp), text10 => ( let temp = LOCAL.textNew("text10"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.frame1 end; temp.x := 73; temp.y := 10; temp.width := 19; temp.height := 41; temp.BgColor := "Brown4"; temp.FgColor := "Blanchedalmond"; temp.Font := "-*-helvetica-bold-*R-*240-*"; temp.Rim := 1; temp.Border := 0; temp.Embellishment := "Raised"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "d"; temp), text11 => ( let temp = LOCAL.textNew("text11"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.frame1 end; temp.x := 9; temp.y := 54; temp.width := 272; temp.height := 21; temp.BgColor := " Blanchedalmond"; temp.FgColor := " Brown4"; temp.Font := "-*-helvetica-bold-*R-*180-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Flat"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "Systems Research Center"; temp), text12 => ( let temp = LOCAL.textNew("text12"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.frame1 end; temp.x := 91; temp.y := 10; temp.width := 19; temp.height := 41; temp.BgColor := "Brown4"; temp.FgColor := "Blanchedalmond"; temp.Font := "-*-helvetica-bold-*R-*240-*"; temp.Rim := 1; temp.Border := 0; temp.Embellishment := "Raised"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "i"; temp), text13 => ( let temp = LOCAL.textNew("text13"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.frame1 end; temp.x := 110; temp.y := 10; temp.width := 19; temp.height := 41; temp.BgColor := "Brown4"; temp.FgColor := "Blanchedalmond"; temp.Font := "-*-helvetica-bold-*R-*240-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Raised"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "g"; temp), text14 => ( let temp = LOCAL.textNew("text14"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.frame1 end; temp.x := 129; temp.y := 10; temp.width := 19; temp.height := 41; temp.BgColor := "Brown4"; temp.FgColor := "Blanchedalmond"; temp.Font := "-*-helvetica-bold-*R-*240-*"; temp.Rim := 1; temp.Border := 0; temp.Embellishment := "Raised"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "i"; temp), text15 => ( let temp = LOCAL.textNew("text15"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.frame1 end; temp.x := 148; temp.y := 10; temp.width := 19; temp.height := 41; temp.BgColor := "Brown4"; temp.FgColor := "Blanchedalmond"; temp.Font := "-*-helvetica-bold-*R-*240-*"; temp.Rim := 1; temp.Border := 0; temp.Embellishment := "Raised"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "t"; temp), text16 => ( let temp = LOCAL.textNew("text16"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.frame1 end; temp.x := 167; temp.y := 10; temp.width := 19; temp.height := 41; temp.BgColor := "Brown4"; temp.FgColor := "Blanchedalmond"; temp.Font := "-*-helvetica-bold-*R-*240-*"; temp.Rim := 1; temp.Border := 0; temp.Embellishment := "Raised"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "a"; temp), text17 => ( let temp = LOCAL.textNew("text17"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.frame1 end; temp.x := 185; temp.y := 10; temp.width := 19; temp.height := 41; temp.BgColor := "Brown4"; temp.FgColor := "Blanchedalmond"; temp.Font := "-*-helvetica-bold-*R-*240-*"; temp.Rim := 1; temp.Border := 0; temp.Embellishment := "Raised"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "l"; temp), frame1 => ( let temp = LOCAL.frameNew("frame1"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.form1 end; temp.x := 46; temp.y := 243; temp.width := 286; temp.height := 90; temp.BgColor := " Blanchedalmond"; temp.FgColor := "Black"; temp.Font := "Fixed"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Raised"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.Texture := "blank.pbm"; temp.children := meth(s) [VOInstance.text10, VOInstance.text11, VOInstance.text12, VOInstance.text13, VOInstance.text14, VOInstance.text15, VOInstance.text16, VOInstance.text17, ]; end; temp), form1 => ( let temp = LOCAL.formNew("form1"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.x := 45; temp.y := 2; temp.width := 379; temp.height := 382; temp.BgColor := "VerySlightlyBluishGrey85"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-bold-*R-*120-*"; temp.Rim := 0; temp.Border := 2; temp.Embellishment := "Chiseled"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.Texture := "blank.pbm"; temp.children := meth(s) [VOInstance.text1, VOInstance.text4, VOInstance.button1, VOInstance.textedit2, VOInstance.frame1, ]; end; temp.HasMenu := false; temp.TitleBgColor := "VerySlightlyBluishGrey85"; temp.TitleFgColor := "Black"; temp.TitleString := "Title"; temp.StretchX := 1000; temp.StretchY := 1000; temp.ShrinkX := 0; temp.ShrinkY := 0; temp), (* Callbacks *) button1Proc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for button1*) SELF.form1.hide(); mainNew(LOCAL); (*-------------------------------------------------------------*) ok end, (* Attachments *) VOAttachCBacks => meth(SELF) form_attach(SELF.FORM, SELF.button1.name, SELF.button1Proc); ok end, VOCompute => meth(s, procedure) procedure(SELF); ok end, VOPackUp => meth(s) s.form1.hide(); (* checkpt and hide form *) end, VOUnpack => meth(s) s.form1.show(); end, }; SELF := VOInstance; (* Create the UI *) SELF.FORM := form_new(computeSX(SELF.form1)); (* Attach callbacks for the first time *) SELF.VOAttachCBacks(); (* Initialization Code *) form_show(SELF.FORM); form1Constructor.VORegister(VOInstance); end }; allForms := allForms @ [proc() main end]; mainConstructor := (* one instance of this exists and only at the server site *) (* this is a synchronized object *) {serialized, VORegister => meth(s, newinstance) (* this is a critical section *) if mainInstances is 0 then main := [newinstance]; mainAlive := [true]; mainInstances := 1; 0 else let indx = mainInstances; newinstance.INDEX := indx; mainAlive := mainAlive @ [true]; main := main @ [newinstance]; mainInstances := indx + 1; (* now the new object is globally visible *) indx end end, VONew => proc(LOCAL) (* this has to be a procedure because it needs to be done at the client site *) var SELF = 0; var VOInstance = 0; VOInstance := { FORM => 0, INDEX => 0, (* set in Register *) (* Support Code *) username => "", indexFromItem => meth(s, item) let ar = SELF.options.getElements(); var retval = -1; var ctr = 0; foreach it in ar do if text_equal(it, item) then retval := ctr; exit; else ctr := ctr+1; end end; retval end, current => -1, (* Object Definitions *) groupList => ( let temp = LOCAL.texteditNew("groupList"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.interested end; temp.x := 4; temp.y := 22; temp.width := 209; temp.height := 157; temp.BgColor := " Grey84"; temp.FgColor := "Black"; temp.Font := "-*-times-bold-*R-*180-*"; temp.Rim := 0; temp.Border := 1; temp.Embellishment := "Lowered"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.teReadOnly := true; temp.teClip := false; temp.teHasScrollbar := true; temp.teContents := ""; temp.teFromFile := ""; temp.getFromFile := false; temp), interested => ( let temp = LOCAL.formNew("interested"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.x := 163; temp.y := 17; temp.width := 216; temp.height := 183; temp.BgColor := "Grey75"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 1; temp.Embellishment := "Raised"; temp.InitialState := "Vanish"; temp.ResizeModel := "Scaled"; temp.Texture := "blank.pbm"; temp.children := meth(s) [VOInstance.groupList, ]; end; temp.ParentForm := meth(s) VOInstance.main end; temp.HasMenu := false; temp.TitleBgColor := "VerySlightlyBluishGrey85"; temp.TitleFgColor := "Black"; temp.TitleString := "Interested Parties"; temp.StretchX := 1000; temp.StretchY := 1000; temp.ShrinkX := 0; temp.ShrinkY := 0; temp), where => ( let temp = LOCAL.typeinNew("where"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.inform end; temp.x := 139; temp.y := 26; temp.width := 236; temp.height := 26; temp.BgColor := "LightGrey75"; temp.FgColor := "Black"; temp.Font := "-*-times-medium-*R-*180-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Lowered"; temp.InitialState := "Active"; temp.ResizeModel := "HScaled"; temp.tyReadOnly := false; temp.tyExpand := false; temp.tyInit := ""; temp), text19 => ( let temp = LOCAL.textNew("text19"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.inform end; temp.x := 8; temp.y := 26; temp.width := 127; temp.height := 26; temp.BgColor := "Grey75"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-medium-*R-*140-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Flat"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "Meet Where?"; temp), text6 => ( let temp = LOCAL.textNew("text6"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.inform end; temp.x := 8; temp.y := 60; temp.width := 127; temp.height := 26; temp.BgColor := "Grey75"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-medium-*R-*140-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Flat"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "Meet When?"; temp), when => ( let temp = LOCAL.typeinNew("when"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.inform end; temp.x := 139; temp.y := 60; temp.width := 236; temp.height := 26; temp.BgColor := "LightGrey75"; temp.FgColor := "Black"; temp.Font := "-*-times-medium-*R-*180-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Lowered"; temp.InitialState := "Active"; temp.ResizeModel := "HScaled"; temp.tyReadOnly := false; temp.tyExpand := false; temp.tyInit := ""; temp), discussion => ( let temp = LOCAL.texteditNew("discussion"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.inform end; temp.x := 8; temp.y := 123; temp.width := 378; temp.height := 108; temp.BgColor := " DullLavenderblush1"; temp.FgColor := "Black"; temp.Font := "-*-times-medium-*R-*180-*"; temp.Rim := 0; temp.Border := 1; temp.Embellishment := "Lowered"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.teReadOnly := true; temp.teClip := false; temp.teHasScrollbar := true; temp.teContents := ""; temp.teFromFile := ""; temp.getFromFile := false; temp), text7 => ( let temp = LOCAL.textNew("text7"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.inform end; temp.x := 116; temp.y := 97; temp.width := 143; temp.height := 22; temp.BgColor := "Grey75"; temp.FgColor := "Black"; temp.Font := "-*-times-medium-*R-*140-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Lowered"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "Discussion"; temp), text9 => ( let temp = LOCAL.textNew("text9"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.inform end; temp.x := 15; temp.y := 236; temp.width := 359; temp.height := 22; temp.BgColor := "Grey75"; temp.FgColor := "Black"; temp.Font := "-*-times-medium-*R-*180-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Flat"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "Type your Comments in this Window... "; temp), comment => ( let temp = LOCAL.typeinNew("comment"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.inform end; temp.x := 4; temp.y := 258; temp.width := 378; temp.height := 67; temp.BgColor := "LightGrey75"; temp.FgColor := "Black"; temp.Font := "-*-times-medium-*R-*180-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Lowered"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tyReadOnly := false; temp.tyExpand := true; temp.tyInit := ""; temp), inform => ( let temp = LOCAL.formNew("inform"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.x := 231; temp.y := 85; temp.width := 390; temp.height := 329; temp.BgColor := "Grey75"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 1; temp.Embellishment := "Raised"; temp.InitialState := "Vanish"; temp.ResizeModel := "Scaled"; temp.Texture := "blank.pbm"; temp.children := meth(s) [VOInstance.where, VOInstance.text19, VOInstance.text6, VOInstance.when, VOInstance.discussion, VOInstance.text7, VOInstance.text9, VOInstance.comment, ]; end; temp.ParentForm := meth(s) VOInstance.main end; temp.HasMenu := false; temp.TitleBgColor := "VerySlightlyBluishGrey85"; temp.TitleFgColor := "Black"; temp.TitleString := "Title"; temp.StretchX := 1000; temp.StretchY := 1000; temp.ShrinkX := 0; temp.ShrinkY := 0; temp), options => ( let temp = LOCAL.browserNew("options"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.main end; temp.x := 23; temp.y := 26; temp.width := 375; temp.height := 120; temp.BgColor := " Gray84"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-bold-*R-*180-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Lowered"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.Quick := false; temp.Multiplicity := false; temp.Selection := -1; temp), Join => ( let temp = LOCAL.buttonNew("Join"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.main end; temp.x := 20; temp.y := 180; temp.width := 85; temp.height := 26; temp.BgColor := "RatherLightYellow"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 1; temp.Embellishment := "None"; temp.InitialState := "Active"; temp.ResizeModel := "CenterPin"; temp.textLabel := true; temp.textString := "Join"; temp.pixmap := ""; temp.Guard := false; temp.Trill := false; temp), button4 => ( let temp = LOCAL.buttonNew("button4"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.main end; temp.x := 19; temp.y := 228; temp.width := 185; temp.height := 22; temp.BgColor := "RatherLightYellow"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 1; temp.Embellishment := "None"; temp.InitialState := "Active"; temp.ResizeModel := "HScaled"; temp.textLabel := true; temp.textString := "Suggest a New Place:-"; temp.pixmap := ""; temp.Guard := false; temp.Trill := false; temp), newplace => ( let temp = LOCAL.typeinNew("newplace"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.main end; temp.x := 19; temp.y := 258; temp.width := 375; temp.height := 26; temp.BgColor := "LightGrey75"; temp.FgColor := "Black"; temp.Font := "-*-times-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Lowered"; temp.InitialState := "Active"; temp.ResizeModel := "HScaled"; temp.tyReadOnly := false; temp.tyExpand := false; temp.tyInit := ""; temp), Remove => ( let temp = LOCAL.buttonNew("Remove"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.main end; temp.x := 314; temp.y := 180; temp.width := 81; temp.height := 26; temp.BgColor := "RatherLightYellow"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 1; temp.Embellishment := "None"; temp.InitialState := "Active"; temp.ResizeModel := "CenterPin"; temp.textLabel := true; temp.textString := "Leave"; temp.pixmap := ""; temp.Guard := false; temp.Trill := false; temp), button7 => ( let temp = LOCAL.buttonNew("button7"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.main end; temp.x := 124; temp.y := 180; temp.width := 170; temp.height := 26; temp.BgColor := "RatherLightYellow"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 1; temp.Embellishment := "None"; temp.InitialState := "Active"; temp.ResizeModel := "CenterPin"; temp.textLabel := true; temp.textString := "Who's Interested ?"; temp.pixmap := ""; temp.Guard := false; temp.Trill := false; temp), button8 => ( let temp = LOCAL.buttonNew("button8"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.main end; temp.x := 19; temp.y := 295; temp.width := 201; temp.height := 26; temp.BgColor := "RatherLightYellow"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 1; temp.Embellishment := "None"; temp.InitialState := "Active"; temp.ResizeModel := "HScaled"; temp.textLabel := true; temp.textString := "Invite the User at Host:-"; temp.pixmap := ""; temp.Guard := false; temp.Trill := false; temp), peername => ( let temp = LOCAL.typeinNew("peername"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.main end; temp.x := 19; temp.y := 329; temp.width := 375; temp.height := 30; temp.BgColor := "LightGrey75"; temp.FgColor := "Black"; temp.Font := "-*-times-bold-*R-*140-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Lowered"; temp.InitialState := "Active"; temp.ResizeModel := "HScaled"; temp.tyReadOnly := false; temp.tyExpand := false; temp.tyInit := ""; temp), text8 => ( let temp = LOCAL.textNew("text8"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.parent := meth(s) VOInstance.main end; temp.x := 31; temp.y := 150; temp.width := 371; temp.height := 19; temp.BgColor := "Grey75"; temp.FgColor := "Black"; temp.Font := "-*-times-medium-*R-*180-*"; temp.Rim := 0; temp.Border := 0; temp.Embellishment := "Flat"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.tOrientation := "Center"; temp.tVal := "Double Click on an Item for Information..."; temp), main => ( let temp = LOCAL.formNew("main"); temp.form := meth(s) SELF.FORM end; temp.SELF := meth(s) VOInstance end; temp.x := 133; temp.y := 55; temp.width := 409; temp.height := 382; temp.BgColor := "Grey75"; temp.FgColor := "Black"; temp.Font := "-*-helvetica-bold-*R-*180-*"; temp.Rim := 0; temp.Border := 1; temp.Embellishment := "Raised"; temp.InitialState := "Active"; temp.ResizeModel := "Scaled"; temp.Texture := "blank.pbm"; temp.children := meth(s) [VOInstance.options, VOInstance.Join, VOInstance.button4, VOInstance.newplace, VOInstance.Remove, VOInstance.button7, VOInstance.button8, VOInstance.peername, VOInstance.text8, ]; end; temp.ChildForms := meth(s) [ VOInstance.interested, VOInstance.inform,] end; temp.HasMenu := false; temp.TitleBgColor := "VerySlightlyBluishGrey85"; temp.TitleFgColor := "Black"; temp.TitleString := "Lunch Options"; temp.StretchX := 1000; temp.StretchY := 1000; temp.ShrinkX := 0; temp.ShrinkY := 0; temp), (* Callbacks *) whereProc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for where*) let wh = SELF.where.getText(); let ix = SELF.current; placeMgr.addNewLine("* " & SELF.username & " suggests the meeting place:" & wh & "*\n", ix); foreach f in main do if (f.current is ix ) then f.where.putText(wh); end; end; placeMgr.places[SELF.current].where := wh; (*-------------------------------------------------------------*) ok end, whenProc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for when*) let wh = SELF.when.getText(); let ix = SELF.current; placeMgr.addNewLine("* " & SELF.username & " suggests the meeting time :" & wh & "*\n", ix); foreach f in main do if (f.current is ix ) then f.when.putText(wh); end; end; placeMgr.places[SELF.current].when := wh; (*-------------------------------------------------------------*) ok end, commentProc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for comment*) let z = SELF.comment.getText(); let add = sys_getEnvVar("USER") & "> " & z & "\n"; placeMgr.addNewLine(add, SELF.current); SELF.comment.putText(""); (*-------------------------------------------------------------*) ok end, optionsProc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for options*) let seln = SELF.options.getSelection(); let ix = SELF.indexFromItem(seln); SELF.current := ix; SELF.inform.popUp(); SELF.inform.putTitleString (placeMgr.places[ix].name); SELF.where.putText(placeMgr.places[ix].where); SELF.when.putText(placeMgr.places[ix].when); SELF.discussion.putText(placeMgr.places[ix].disc); (*-------------------------------------------------------------*) ok end, JoinProc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for Join*) (* join callback *) let seln = SELF.options.getSelection(); if not(text_equal(seln, "")) then let ix = SELF.indexFromItem(seln); placeMgr.joinGroup(ix, SELF.username); SELF.options.selectString (SELF.options.getElement(ix)); end; (*-------------------------------------------------------------*) ok end, button4Proc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for button4*) let np = SELF.newplace.getText(); placeMgr.addNewPlace(np); SELF.newplace.putText(""); (*-------------------------------------------------------------*) ok end, newplaceProc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for newplace*) let np = SELF.newplace.getText(); SELF.newplace.putText(""); placeMgr.addNewPlace(np); (*-------------------------------------------------------------*) ok end, RemoveProc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for Remove*) (* join callback *) let seln = SELF.options.getSelection(); if not(text_equal(seln, "")) then let ix = SELF.indexFromItem(seln); placeMgr.leaveGroup(ix, SELF.username); end; (*-------------------------------------------------------------*) ok end, button7Proc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for button7*) let seln = SELF.options.getSelection(); SELF.groupList.putText(""); if not(text_equal(seln, "")) then let ix = SELF.indexFromItem(seln); foreach p in placeMgr.places[ix].interested do SELF.groupList.appendText(p &"\n"); end; end; SELF.interested.popUp(); (*-------------------------------------------------------------*) ok end, button8Proc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for button8*) let place = SELF.peername.getText(); installAt(place); SELF.peername.putText(""); (*-------------------------------------------------------------*) ok end, peernameProc => proc(VOForm) (*-------------------------------------------------------------*) (* Callback for peername*) let place = SELF.peername.getText(); installAt(place); SELF.peername.putText(""); (*-------------------------------------------------------------*) ok end, (* Attachments *) VOAttachCBacks => meth(SELF) form_attach(SELF.FORM, SELF.where.name, SELF.whereProc); form_attach(SELF.FORM, SELF.when.name, SELF.whenProc); form_attach(SELF.FORM, SELF.comment.name, SELF.commentProc); form_attach(SELF.FORM, SELF.options.name, SELF.optionsProc); form_attach(SELF.FORM, SELF.Join.name, SELF.JoinProc); form_attach(SELF.FORM, SELF.button4.name, SELF.button4Proc); form_attach(SELF.FORM, SELF.newplace.name, SELF.newplaceProc); form_attach(SELF.FORM, SELF.Remove.name, SELF.RemoveProc); form_attach(SELF.FORM, SELF.button7.name, SELF.button7Proc); form_attach(SELF.FORM, SELF.button8.name, SELF.button8Proc); form_attach(SELF.FORM, SELF.peername.name, SELF.peernameProc); ok end, VOCompute => meth(s, procedure) procedure(SELF); ok end, VOPackUp => meth(s) s.main.hide(); (* checkpt and hide form *) end, VOUnpack => meth(s) s.main.show(); end, }; SELF := VOInstance; (* Create the UI *) SELF.FORM := form_new(computeSX(SELF.main)); (* Attach callbacks for the first time *) SELF.VOAttachCBacks(); (* Initialization Code *) SELF.username := sys_getEnvVar("USER"); foreach p in placeMgr.places do let blurb = p.name & " (" & fmt_int(#(p.interested)) & ")"; SELF.options.appendElement(blurb); end; form_show(SELF.FORM); mainConstructor.VORegister(VOInstance); end }; (* if not bundled this goes to 'load "LunchPlansDEFN.obl";' else the definitions are inlined *) let SERVERNAME = sys_address; (* So that everyone knows the server name *) let CreateEachFormOnce = proc(LOCAL) form1New(LOCAL); mainNew(LOCAL); end; let LunchPlans = { New => proc(LOCAL) let HOSTNAME = LOCAL.HOSTNAME; let SERVERSITE = text_equal(SERVERNAME, HOSTNAME); (* This procedure is the Global Session Constructor, and will *) (* be executed by all sites including the server site, at *) (* start up *) (* You may edit this section to configure the start-up process *) (* You can use HOSTNAME, SERVERSITE and SERVERNAME to *) (* create forms conditionally. *) (* SERVERSITE is a flag that is set only at the server site *) (* HOSTNAME is the name of the host that will be executing this *) (* procedure *) (* SERVERNAME is the HOSTNAME of the server *) (* *) (* Creation of forms : *) (* To create 1 instance of the form named 'foo' use *) (* fooNew(LOCAL); *) (* To create 1 instance of each form use CreateEachFormOnce(LOCAL) *) (* e.g. to create one instance of main you will use *) (* mainNew(LOCAL); *) (* -----------------------START------------------------- *) form1New(LOCAL); (* ------------------------END------------------------- *) end }; (* LOCAL is a handle to the local context, which includes the support *) (* procedures used to implement operations on widgets. This mechanism *) (* ensures that operations that may be done locally are done so *) (* You will not need to use this handle except while creating forms as *) (* described earlier *) net_export("LunchPlans", "", LunchPlans); installAt := proc(site) try let vos = net_import("vos", site); vos.Install(LunchPlans.New, "LunchPlans"); true except else false end end; (* Now you can say installAt("somemachine.pa.dec.com") *) (LunchPlans.New)(volibLocal); (* This executes the constructor at the server site *) (* Any code that is to be executed at the server site only may be placed after this *) placeMgr.init(); module migrate; let packFormList = proc(flist) try if flist isnot 0 then foreach frm in flist do if (frm isnot ok) and (frm isnot 0) then (* is a valid form hopefully *) frm.VOPackUp(); end; end; end; except else end; end; let unpackFormList = proc(flist) try if flist isnot 0 then foreach frm in flist do if (frm isnot ok) and (frm isnot 0) then (* is a valid form hopefully *) frm.VOUnpack(); end; end; end; except else end; end; let agent = proc(contin, local) contin(local); end; var continuation = 0; migrateTo := proc(dest) try let atsite = net_importEngine("VOReceiver", dest); foreach formlist in allForms do packFormList(formlist()); end; atsite(proc(arg) agent(copy(continuation), arg) end); true except else false end end; continuation := proc (local) foreach formlist in allForms do unpackFormList(formlist()); end; end;