-- Saving to a file info -- Save.info SaveStyleProc: Menus.MenuProc = BEGIN -- Save the style currently in the style tool in a file names .style where -- is the name found in the style name viewer. styleFileName: Rope.ROPE; handle: StyleToolHandle _ NARROW[clientData]; IF ~handle.outer.newVersion THEN RETURN; styleFileName _ ViewerTools.GetContents[handle.styleNameViewer]; IF Rope.Size[styleFileName] = 0 THEN { MessageWindow.Append[message: "Enter style name prior to loading.", clearFirst: TRUE]; MessageWindow.Blink[]; RETURN }; -- Check if ".style" already appended IF Rope.Find[s1: styleFileName, s2: ".style", case: FALSE] = -1 THEN styleFileName _ Rope.Cat[styleFileName, ".style"]; IF ~MessageWindow.Confirm[Rope.Cat["Confirm write to ", styleFileName, "..."]] THEN RETURN ELSE { SaveStyle[styleFileName]; MessageWindow.Append[message: Rope.Cat["Current style saved in ", styleFileName], clearFirst: TRUE]; handle.outer.newVersion _ FALSE; ViewerOps.PaintViewer[handle.outer, header]; }; END; SaveStyle: PROC [filename: Rope.ROPE] = BEGIN file: IO.Handle; file _ IO.CreateFileStream[fileName: filename, accessOptions: overwrite, createOptions: none ! IO.Error => SELECT ec FROM IllegalFileName => {MessageWindow.Append[message: Rope.Cat[ filename, " is not a valid file name"], clearFirst: TRUE]; MessageWindow.Blink[]; CONTINUE}; ENDCASE => ERROR -- shouldn't happen ]; -- Write beginning of file: IO.PutRope[file, Rope.Cat["% ", filename]]; IO.PutChar[file, IO.CR]; IO.PutChar[file, IO.CR]; IO.PutRope[file, "BeginStyle"]; IO.PutChar[file, IO.CR]; IO.PutChar[file, IO.CR]; -- Write ending of file IO.PutRope[file, "EndStyle"]; IO.Flush[file]; IO.Close[file]; END; Κ– "Mesa" style˜IprocštΟc&œ!ΟkœVœ;œžœžœžœžœžœEžœžœUžœžœ&œžœ2žœžœ7žœMžœžœžœžœžœ:žœΟn œžœžœžœžœžœXžœ žœžœ…žœ6žœ žœžœœœžœ+žœžœžœžœžœžœžœžœžœžœžœžœžœœžœžœžœžœ ˜›—…—C