(FILECREATED "29-Jun-87 17:04:09" {QV}<NOTECARDS>1.3K>LIBRARY>NCCOLLABORATION.;17 11684
changes to: (FNS NCCollab.CollaboratizeNoteFile)
previous date: "19-Apr-87 19:36:56" {QV}<NOTECARDS>1.3K>LIBRARY>NCCOLLABORATION.;16)
(* Copyright (c) 1986, 1987 by Xerox Corporation. All rights reserved.)
(PRETTYCOMPRINT NCCOLLABORATIONCOMS)
(RPAQQ NCCOLLABORATIONCOMS ((* * Package of handy functions and cardtypes for collaborators.)
(FILES (FROM NOTECARDS)
NCCOLLABORATORCARD NCHISTORYCARD)
(GLOBALVARS NCCollab.CollabInfoExtraMenuItems
NCCollab.NoteFileIconMiddleMenuItems
NCCollab.CollaboratorsMenuGreyShade)
(INITVARS (NCCollab.CollaboratorsMenuGreyShade 4096))
(VARS (NCCollab.NoteFileIconMiddleMenuItems (QUOTE ((Collaborator% Info
NCCollab.AccessCollaboratorInfo
"Modify info for a known collaborator name, create a new one, or remove an existing one.")))))
(FNS NCCollab.OpenNoteFileFn NCCollab.CollaboratizeNoteFile
NCCollab.GetCollabInfoBox NCCollab.ChangeCurrentCollaborator
NCCollab.RemoveCollaboratorCard NCCollab.AccessCollaboratorInfo
NCCollab.MakeCollaboratorsMenu NCCollab.ListOfCollaboratorCards)
(FNS NCCollab.HangOnCardUntilDone)))
(* * Package of handy functions and cardtypes for collaborators.)
(FILESLOAD (FROM NOTECARDS)
NCCOLLABORATORCARD NCHISTORYCARD)
(DECLARE: DOEVAL@COMPILE DONTCOPY
(GLOBALVARS NCCollab.CollabInfoExtraMenuItems NCCollab.NoteFileIconMiddleMenuItems
NCCollab.CollaboratorsMenuGreyShade)
)
(RPAQ? NCCollab.CollaboratorsMenuGreyShade 4096)
(RPAQQ NCCollab.NoteFileIconMiddleMenuItems ((Collaborator% Info NCCollab.AccessCollaboratorInfo
"Modify info for a known collaborator name, create a new one, or remove an existing one.")))
(DEFINEQ
(NCCollab.OpenNoteFileFn
(LAMBDA (NoteFile) (* rht: " 8-Dec-86 22:29")
(* * This gets called at notefile-open time.)
(LET ((UserName (USERNAME))
Menu CollaboratorCard MenuItemRegion)
(NCP.AddNoteFileIconMiddleButtonItems NoteFile NCCollab.NoteFileIconMiddleMenuItems)
(SETQ Menu (NCCollab.MakeCollaboratorsMenu NoteFile (QUOTE (("-- New Name(s) --"
(QUOTE NEWNAMES)
"Create a new collaborator information card.")))))
(NCP.PrintMsg NIL T "Please select Collaborator name(s)")
(* Make Menu be positioned next to UserName if
present, otherwise at "NewNames" entry.)
(SETQ MenuItemRegion (MENUITEMREGION (for Item in (fetch (MENU ITEMS)
of Menu)
when (STREQUAL (CAR Item)
UserName)
do (RETURN Item) finally (RETURN Item))
Menu))
(replace (MENU MENUOFFSET) of Menu with (CONS (fetch (REGION LEFT) of
MenuItemRegion)
(fetch (REGION BOTTOM)
of MenuItemRegion)))
(if (EQ (SETQ CollaboratorCard (MENU Menu))
(QUOTE NEWNAMES))
then (* Create a new card with unknown title if UserName is
on menu, else use UserName.)
(SETQ CollaboratorCard (NCP.CoerceToCard
(NCP.CreateCard (QUOTE Collaborator)
NoteFile
(if (for Item in (fetch (MENU ITEMS)
of Menu)
thereis (STREQUAL (CAR Item)
UserName))
then "??"
else UserName))))
(NCCollab.HangOnCardUntilDone CollaboratorCard "DONE" "Fill in parameters"
"Selecting DONE indicates completion of updating this card. Will allow OpenNoteFile to continue."))
(if (NCP.ValidCardP CollaboratorCard)
then (NCCollab.ChangeCurrentCollaborator NoteFile CollaboratorCard)))))
(NCCollab.CollaboratizeNoteFile
(LAMBDA (NoteFile) (* rht: "29-Jun-87 17:03")
(* * Initialize given notefile for collaborative use. Make a collaboration card if none exists and register in the
notefile. Hang a call to NCCollab.OpenNoteFileFn in the OpenEventsCard for the notefile.)
(* * rht 4/19/87: Now calls NC.LoadFileFromDirectories rather than FILESLOAD.)
(if (NCP.OpenNoteFileP NoteFile)
then (LET ((OpenEventsCard (NCP.GetOpenEventsCard NoteFile))
(OpenEventSExp (QUOTE (PROGN (NC.LoadFileFromDirectories (QUOTE
NCCOLLABORATION))
(NCCollab.OpenNoteFileFn NoteFile))))
OpenEventsCardWasCachedFlg)
(* * Run the collaboration OpenNoteFileFn now.)
(NCCollab.OpenNoteFileFn NoteFile)
(* * Make sure that file has been historitized.)
(NCHist.HistoricizeNoteFile NoteFile)
(* * Add call to NCCollab.OpenNoteFileFn to the open events card substance. Since historicizing has already
happened, this makes sure that collaboration opennotefilefn precedes history one.)
(if (NOT (SETQ OpenEventsCardWasCachedFlg (NCP.ActiveCardP OpenEventsCard)
))
then (NCP.CacheCards OpenEventsCard))
(if (NOT (MEMBER OpenEventSExp (NCP.CardSubstance OpenEventsCard)))
then (NCP.CardSubstance OpenEventsCard (CONS OpenEventSExp
(NCP.CardSubstance
OpenEventsCard))))
(if (NOT OpenEventsCardWasCachedFlg)
then (NCP.CloseCards OpenEventsCard)))
else (NCP.ReportError "NCCollab.CollaboratizeNoteFile" (CONCAT
"Can't collaboratize closed notefile: "
NoteFile)))))
(NCCollab.GetCollabInfoBox
(LAMBDA (NoteFile) (* rht: " 8-Dec-86 22:27")
(* * Create a collaboration info card if there isn't one already.)
(LET ((Box (NCP.LookupCardByName (QUOTE CollabInfo)
NoteFile)))
(if (NOT (NCP.ValidCardP Box))
then (SETQ Box (NCP.CreateFileBox NoteFile "Collaboration Info" T))
(NCP.MarkAsNotNeedingFiling Box)
(NCP.RegisterCardByName (QUOTE CollabInfo)
Box))
Box)))
(NCCollab.ChangeCurrentCollaborator
(LAMBDA (NoteFile CollaboratorCard) (* rht: "23-Nov-86 17:48")
(* * Change current collaborator. If CollaboratorCard is NIL, then ask user to specify.)
(OR CollaboratorCard (SETQ CollaboratorCard (MENU (NCCollab.MakeCollaboratorsMenu
NoteFile))))
(if (NCP.ValidCardP CollaboratorCard)
then (NCP.NoteFileProp NoteFile (QUOTE CurrentCollaboratorCard)
CollaboratorCard)
(NCInsp.InstallParams CollaboratorCard))))
(NCCollab.RemoveCollaboratorCard
(LAMBDA (NoteFile) (* rht: "23-Nov-86 16:47")
(* * Remove one of the collaborator cards.)
(LET ((CollaboratorCard (MENU (NCCollab.MakeCollaboratorsMenu NoteFile))))
(if (NCP.ValidCardP CollaboratorCard)
then (NCP.DeleteCards CollaboratorCard)))))
(NCCollab.AccessCollaboratorInfo
(LAMBDA (NoteFile Item) (* rht: "23-Nov-86 17:45")
(* * Called from NoteFile icon's middle button menu. Bring up a menu of known collaborator names plus options to
add a new name or remove one.)
(LET ((Result (MENU (NCCollab.MakeCollaboratorsMenu NoteFile (QUOTE (("-- New Name(s) --"
(QUOTE NEWNAMES)
"Create a new collaborator information card.")
("-- Remove Name --"
(QUOTE REMOVENAME)
"Remove one of the collaborator information cards.")
(
"-- Change current collaborator --" (QUOTE CHANGECURRENT)
"Change choice of current collaborator name.")))))))
(COND
((NCP.ValidCardP Result)
(NCP.OpenCard Result))
((EQ Result (QUOTE NEWNAMES))
(NCP.CreateCard (QUOTE Collaborator)
NoteFile "??"))
((EQ Result (QUOTE REMOVENAME))
(NCCollab.RemoveCollaboratorCard NoteFile))
((EQ Result (QUOTE CHANGECURRENT))
(NCCollab.ChangeCurrentCollaborator NoteFile))))))
(NCCollab.MakeCollaboratorsMenu
(LAMBDA (NoteFile ExtraMenuItems) (* rht: " 8-Dec-86 22:36")
(* * Returns a menu with items corresponding to the collaborators of this notefile. The current collaborator, if
any, is shaded.)
(DECLARE (GLOBALVARS NCCollab.CollaboratorsMenuGreyShade))
(LET ((ListOfCollaboratorCards (NCCollab.ListOfCollaboratorCards NoteFile))
ListOfCollaboratorNames Menu CurrentCollaboratorCard)
(SETQ ListOfCollaboratorNames (for Card in ListOfCollaboratorCards
collect (NCP.CardTitle Card)))
(SETQ CurrentCollaboratorCard (NCP.NoteFileProp NoteFile (QUOTE
CurrentCollaboratorCard)))
(SETQ Menu (create MENU
ITEMS ←(BQUOTE (,@(for Name in ListOfCollaboratorNames
as Card in ListOfCollaboratorCards
collect (LIST Name Card
"Selects this collaborator name or names."))
,@ ExtraMenuItems))
TITLE ← "Collaborator Name(s)"))
(* Shade item corresponding to current collaborator.)
(if (NCP.ValidCardP CurrentCollaboratorCard)
then (for Item in (fetch (MENU ITEMS) of Menu)
when (AND (NCP.ValidCardP (CADR Item))
(NCP.SameCardP CurrentCollaboratorCard (CADR Item)))
do (SHADEITEM Item Menu NCCollab.CollaboratorsMenuGreyShade)))
Menu)))
(NCCollab.ListOfCollaboratorCards
(LAMBDA (NoteFile) (* rht: " 8-Dec-86 22:36")
(* * Returns a list of the collaborator cards in given NoteFile.)
(LET ((CollabInfoBox (NCCollab.GetCollabInfoBox NoteFile)))
(if (NCP.ValidCardP CollabInfoBox)
then (NCP.FileBoxChildren CollabInfoBox)))))
)
(DEFINEQ
(NCCollab.HangOnCardUntilDone
(LAMBDA (Card MenuButtonName MenuTitle HelpMessage) (* rht: "23-Nov-86 14:25")
(* * Bring up Card, attach menu with title MenuTitle and with a single button having name MenuButtonName and help
message HelpMessage.)
(LET ((Window (NCP.OpenCard Card))
(Menu (create MENU
ITEMS ←(BQUOTE ((, MenuButtonName NIL , HelpMessage)))
TITLE ← MenuTitle
MENUFONT ←(FONTCREATE (QUOTE HELVETICA)
12
(QUOTE BRR))
MENUTITLEFONT ←(FONTCREATE (QUOTE HELVETICA)
10
(QUOTE BRR))))
WindowRegion)
(SETQ WindowRegion (WINDOWREGION Window))
(MENU Menu (CONS (fetch (REGION LEFT) of WindowRegion)
(PLUS (fetch (REGION BOTTOM) of WindowRegion)
(fetch (REGION HEIGHT) of WindowRegion)))
T))))
)
(PUTPROPS NCCOLLABORATION COPYRIGHT ("Xerox Corporation" 1986 1987))
(DECLARE: DONTCOPY
(FILEMAP (NIL (1856 10651 (NCCollab.OpenNoteFileFn 1866 . 4091) (NCCollab.CollaboratizeNoteFile 4093
. 5954) (NCCollab.GetCollabInfoBox 5956 . 6516) (NCCollab.ChangeCurrentCollaborator 6518 . 7090) (
NCCollab.RemoveCollaboratorCard 7092 . 7481) (NCCollab.AccessCollaboratorInfo 7483 . 8677) (
NCCollab.MakeCollaboratorsMenu 8679 . 10256) (NCCollab.ListOfCollaboratorCards 10258 . 10649)) (10652
11593 (NCCollab.HangOnCardUntilDone 10662 . 11591)))))
STOP