// Text of project Names Services written on 12/11/99 at 23:21 // Beginning of text file definitions.f // Copyright (C) 1999 Brian Sulcer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the / ,‹x,‹@/ GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA DefConst('kDefaultPrefs, { pagerTypes: [], emailSystems: [], phoneTypes: [], } ); constant kVersionString := "v1.1"; OpenResFile(HOME & "bitmaps.rsrc"); DefConst('kAppIcon, GetPictAsBits("NameService Icon", nil)); CloseResFile(); Def ,‹x,‹@Const('kMyPackageName, "Names Services"); DefConst('kAboutString, "v1.1 ©1999 Brian Sulcer\n" & "Adds a panel to the Prefs roll that allows " & "editing of phone, email and pager types.\n\n" & "email: bsulcer@hyprmynd.com\n" & "url: http://www.hyprmynd.com/" ); SetPartFrameSlot('text, "Names Services"); SetPartFrameSlot('app, kAppSymbol); SetPartFrameSlot('icon, kAppIcon); SetPartFrameSlot('TapAction, func() begin GetRoot():Notify(kNotifyQAlert, kMyPackageName, kAboutString); return nil; e ,‹x,‹@nd; ); DefConst('kAppAboutViewSym, Intern("about:" & SPrintObject(kAppSymbol))); Sulcer\n" & "Adds a panel to the Prefs roll that allows " & "editing of phone, email and pager types.\n\n" & "email: bsulcer@hyprmynd.com\n" & "url: http://www.hyprmynd.com/" ); SetPartFrameSlot('text, "Names Services"); SetPartFrameSlot('app, kAppSymbol); SetPartFrameSlot('icon, kAppIcon); SetPartFrameSlot('TapAction, func() begin GetRoot():Notify(kNotifyQAlert, kMyPackageName, kAboutString); return nil; e // End of text file definitions.f // Beginning of file protoAboutBox // Before Script for protoAboutBox // Copyright (C) 1999 Brian Sulcer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA protoAboutBox := {viewBounds: {left: 0, top: 0, right: 200, bottom: 180}, viewDrawScript: func() begin local localBox := :LocalBox(); local text; local bounds; local titleFont := {family: 'newYork, face: kFaceBold, size: 18}; local versionFont := {family: 'geneva, face: kFaceNormal, size: 9}; local creditFont := {family: 'newYork, face: kFaceNormal, size: 12}; local textFont := {family: 'espy, face: kFaceNormal, size: 10}; local reminderFont := {family: 'espy, face: kFaceBold, size: 10}; // app title bounds := SetBounds(40, 5, localBox.right, localBox.bottom); TextBox(appName, {font: titleFont, justification: 'left}, bounds); // app version bounds := SetBounds(42, bounds.top + FontHeight(titleFont), localBox.right, localBox.bottom); TextBox(versionString, {font: versionFont, justification: 'left}, bounds); // copyright info bounds := SetBounds(5, 45, localBox.right, localBox.bottom); TextBox(copyrightString, {font: textFont, justification: 'left}, bounds); // contact info bounds := SetBounds(5, bounds.top + (FontHeight(textFont) * 2) + 5, localBox.right, localBox.bottom); TextBox(contactString, {font: textFont, justification: 'left}, bounds); // notice bounds := SetBounds(5, bounds.top + (FontHeight(textFont) * 2) + 5, localBox.right - 5, localBox.bottom); TextBox(noticeString, {font: textFont, justification: 'left}, bounds); end , viewJustify: 80, viewEffect: 7314465, appIcon: nil, appName: "Text", creditString: "Text", versionString: "Text", copyrightString: "Text", contactString: "Text", noticeString: "Text", viewSetupDoneScript: func() begin appIconView.icon := self.appIcon; end, _proto: @179 /* protoFloater */ }; appIconView := {icon: nil, viewBounds: {left: 5, top: 5, right: 37, bottom: 37}, viewFlags: 1, viewFormat: nil, viewClass: 76 /* clPictureView */ }; AddStepForm(protoAboutBox, appIconView); StepDeclare(protoAboutBox, appIconView, 'appIconView); protoAboutBox_v166_0 := {_proto: @166 /* protoCloseBox */}; AddStepForm(protoAboutBox, protoAboutBox_v166_0); constant |layout_protoAboutBox| := protoAboutBox; // End of file protoAboutBox // Beginning of file protoAdjustoButton // Before Script for _v226_0 // Copyright, © 1994 Apple Computer. All rights reserved. _v226_0 := {buttonHeight: 13, textSpacer: 8, viewSetupFormScript: func() begin viewBounds := RelBounds(viewBounds.left, viewBounds.top, StrFontWidth(text, viewFont) + textSpacer, buttonHeight) ; end , viewChangedScript: func(slot, view) begin inherited:?viewChangedScript(slot, view) ; if slot = 'text then :SyncView(); // SyncView causes the viewSetupFormScript to be called again, // which sets the size based on the text. end , _proto: @226 /* protoTextButton */ }; constant |layout_protoAdjustoButton| := _v226_0; // End of file protoAdjustoButton // Beginning of file aboutBox.t // Before Script for aboutBox // Copyright (C) 1999 Brian Sulcer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA aboutBox := {versionString: "version 1.1", copyrightString: "copyright \u00A9\u 1999 Brian Sulcer.\nAll rights reserved.\n", contactString: "email: bsulcer@hyprmynd.com\nurl: http://www.hyprmynd.com/\n", noticeString: "This program comes with ABSOLUTELY NO WARRANTY.\nThis is free software, and you are free to redistribute it under certain conditions. See the file license.txt for details." , appName: "Names Services", appIcon: MakePixFamily( GetResourceFromFile({filename: "Shusaku:Brian's Stuff:Projects:names-services:bitmaps.rsrc", resource: 128}), GetResourceFromFile({filename: ":\uF7FF0001\u,}@", resource: }), [ {rsrcSpec: GetResourceFromFile({filename: "Shusaku:Brian's Stuff:Projects:names-services:bitmaps.rsrc", resource: 128}), bitDepth: 1}, {rsrcSpec: GetResourceFromFile({filename: ":\uF7FF0001\u,}@", resource: }) , bitDepth: 2}, {rsrcSpec: GetResourceFromFile({filename: ":\uF7FF0001\u,}@", resource: }) , bitDepth: 4}, {rsrcSpec: GetResourceFromFile({filename: ":\uF7FF0001\u,}@", resource: }) , bitDepth: 8}]);, viewBounds: {left: 0, top: 0, right: 200, bottom: 200}, _proto: protoAboutBox }; constant |layout_aboutBox.t| := aboutBox; // End of file aboutBox.t // Beginning of file prefsPanel.t // Before Script for prefsPanel // Copyright (C) 1999 Brian Sulcer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA prefsPanel := {viewBounds: {left: 0, top: 0, right: 0, bottom: 150}, height: 150, overview: "Names Services", icon: GetPictAsBits("Prefs roll icon", nil), prefsEntry: nil, viewSetupFormScript: func() begin prefsEntry := GetAppPrefs(kAppSymbol, kDefaultPrefs); type := 0; end , viewQuitScript: func() begin prefsEntry := nil; type := nil; inherited:?viewQuitScript(); end , currentType: nil, viewSetupDoneScript: func() begin currentType := 'phoneTypes; inputLabel1:SetupLabel('phoneTypes); inputLabel2:SetupLabel('phoneTypes); inputLine1:SetupLine('phoneTypes); inputLine2:SetupLine('phoneTypes); removeButton:SetupButton('phoneTypes); end , _proto: @385 /* protoPrefsRollItem */ }; serviceType := {labelCommands: ["Phone", "E-Mail", "Pager"], text: "Service type", viewBounds: {left: 5, top: 20, right: 155, bottom: 35}, labelActionScript: func(cmd) begin local types := ['phoneTypes, 'emailSystems, 'pagerTypes]; local type:= types[cmd]; currentType := type; Print(type); inputLabel1:SetupLabel(type); inputLine1:SetupLine(type); inputLabel2:SetupLabel(type); inputLine2:SetupLine(type); removeButton:SetupButton(type); end , _proto: @190 /* protoLabelPicker */ }; AddStepForm(prefsPanel, serviceType); StepDeclare(prefsPanel, serviceType, 'serviceType); inputLabel1 := {text: "Service (ex. Home)", viewBounds: {left: 5, top: 5, right: 200, bottom: 20}, viewJustify: 8396800 , SetupLabel: func(type) begin if type = 'phoneTypes then begin SetValue(self, 'text, "Service (ex. Home)"); end else if type = 'emailSystems then begin SetValue(self, 'text, "Service (ex. HyprMynd)"); end else if type = 'pagerTypes then begin SetValue(self, 'text, "Service (ex. SkyTel)"); end; end , _proto: @218 /* protoStaticText */ }; AddStepForm(prefsPanel, inputLabel1); StepDeclare(prefsPanel, inputLabel1, 'inputLabel1); inputLine1 := {viewBounds: {left: 5, top: 0, right: -10, bottom: 25}, viewJustify: 8396976, SetupLine: func(type) begin SetValue(self, 'text, ""); end, _proto: @185 /* protoInputLine */ }; AddStepForm(prefsPanel, inputLine1); StepDeclare(prefsPanel, inputLine1, 'inputLine1); inputLabel2 := {text: "Single character display (ex. H)", viewBounds: {left: 5, top: 0, right: 200, bottom: 15}, viewJustify: 8396928 , SetupLabel: func(type) begin if type = 'phoneTypes then begin SetValue(self, 'text, "Single character display (ex. H)"); :Show(); end else if type = 'emailSystems then begin SetValue(self, 'text, "Address postfix (ex. @hyprmynd.com)"); :Show(); end else if type = 'pagerTypes then begin :Hide(); end; end , _proto: @218 /* protoStaticText */ }; AddStepForm(prefsPanel, inputLabel2); StepDeclare(prefsPanel, inputLabel2, 'inputLabel2); inputLine2 := {viewBounds: {left: 5, top: 0, right: -10, bottom: 25}, viewJustify: 8396976, SetupLine: func(type) begin SetValue(self, 'text, ""); if type = 'pagerTypes then begin :Hide(); end else begin :Show(); end; end , _proto: @185 /* protoInputLine */ }; AddStepForm(prefsPanel, inputLine2); StepDeclare(prefsPanel, inputLine2, 'inputLine2); infoButton := {viewFlags: 515, viewBounds: {left: 5, top: -18, right: 18, bottom: -5}, viewJustify: 134, DoInfoAbout: func() begin GetRoot().(kAppAboutViewSym):FilterDialog(); end , _proto: @478 /* protoInfoButton */ }; AddStepForm(prefsPanel, infoButton); addButton := {viewBounds: {left: 7, top: -18, right: 0, bottom: -5}, viewJustify: 8389766, text: "Add", buttonClickScript: func() begin local symbol; local name; local other; name := inputLine1.text; other := inputLine2.text; // check for errors in the input and alert the user if StrLen(name) = 0 then begin GetRoot():Notify(kNotifyAlert, "Names Services", "You must enter a name for the service."); return; end else if StrLen(other) = 0 then begin if currentType = 'phoneTypes then begin GetRoot():Notify(kNotifyAlert, "Names Services", "You must enter a single-character abbreviation."); return; end else if currentType = 'emailSystems then begin GetRoot():Notify(kNotifyAlert, "Names Services", "You must enter the address suffix."); return; end; end; else if (currentType = 'phoneTypes) AND (StrLen(other) > 1) then begin GetRoot():Notify(kNotifyAlert, "Names Services", "The abbreviation may only consist of a single character."); return; end; // add the correct service type if currentType = 'phoneTypes then begin symbol := Intern("string.phone." & name & ".HyprMynd"); call kRegPhoneTypeFunc with (symbol, name, other); AddArraySlot(prefsEntry.phoneTypes, { item: name & " (" & other &")", symbol: symbol, name: name, other: other, } ); end; else if currentType = 'emailSystems then begin symbol := Intern("string.email." & name & ".HyprMynd"); call kRegEmailSystemFunc with (symbol, name, other); AddArraySlot(prefsEntry.emailSystems, { item: name & " (" & other &")", symbol: symbol, name: name, other: other, } ); end; else if currentType = 'pagerTypes then begin symbol := Intern("string.pager." & name & ".HyprMynd"); call kRegPagerTypeFunc with (symbol, name); AddArraySlot(prefsEntry.pagerTypes, { item: name, symbol: symbol, name: name, } ); end; // update the remove button popup EntryChange(prefsEntry); removeButton:SetupButton(currentType); // clear the input fields SetValue(inputLine1, 'text, ""); SetValue(inputLine2, 'text, ""); end , _proto: _v226_0 }; AddStepForm(prefsPanel, addButton); removeButton := {text: "Remove", popup: nil, viewBounds: {left: 7, top: -18, right: 0, bottom: -5}, viewFlags: 515, buttonHeight: 13, textSpacer: 8, viewSetupFormScript: func() begin viewBounds := RelBounds(viewBounds.left, viewBounds.top, StrFontWidth(text, viewFont) + textSpacer + 5, buttonHeight); end , viewJustify: 8389766, pickActionScript: func(itemSelected) begin if currentType = 'phoneTypes then begin call kUnRegPhoneTypeFunc with (popup[itemSelected].symbol); ArrayRemoveCount(prefsEntry.phoneTypes, itemSelected, 1); end; else if currentType = 'emailSystems then begin call kUnRegEmailSystemFunc with (popup[itemSelected].symbol); ArrayRemoveCount(prefsEntry.emailSystems, itemSelected, 1); end; else if currentType = 'pagerTypes then begin call kUnRegPagerTypeFunc with (popup[itemSelected].symbol); ArrayRemoveCount(prefsEntry.pagerTypes, itemSelected, 1); end; EntryChange(prefsEntry); inherited:?PickActionScript(itemSelected); if Length(popup) = 0 then begin :Hide(); end; end , SetupButton: func(type) begin if Length(prefsEntry.(type)) <> 0 then begin SetValue(self, 'popup, prefsEntry.(type)); :Show(); end else begin :Hide(); end; end , _proto: @386 /* protoPopupButton */ }; AddStepForm(prefsPanel, removeButton); StepDeclare(prefsPanel, removeButton, 'removeButton); constant |layout_prefsPanel.t| := prefsPanel; // End of file prefsPanel.t // Beginning of text file partData.f // Copyright (C) 1999 Brian Sulcer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the / ,‹x,‹@/ GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA partData := { aboutView: GetLayout("aboutBox.t"), prefsItem: GetLayout("prefsPanel.t"), }; it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the / // End of text file partData.f // Beginning of text file install & remove.f // Copyright (C) 1999 Brian Sulcer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the / ,‹x,‹@/ GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 // USA InstallScript := func(partFrame, removeFrame) begin GetRoot().(EnsureInternal(kAppAboutViewSym)) := BuildContext(partFrame.partData.aboutView); RegPrefs(kAppSymbol, partFrame.partData.prefsItem); local prefs := GetAppPrefs(kAppSymbol, k ,‹x,‹@DefaultPrefs); foreach item in prefs.emailSystems do begin call kRegEmailSystemFunc with (item.symbol, item.name, item.other); end; foreach item in prefs.phoneTypes do begin call kRegPhoneTypeFunc with (item.symbol, item.name, item.other); end; foreach item in prefs.pagerTypes do begin call kRegPagerTypeFunc with (item.symbol, item.name); end; end; RemoveScript := func(removeFrame) begin RemoveSlot(GetRoot(), 'kAppAboutViewSym); UnRegPrefs(kAppSymbol); end; refs(kAppSymbol, k // End of text file install & remove.f