Monday, November 08, 2010 at 12:03 AM.
system.verbs.builtins.Frontier.tools.windowTypes.commands.new
on new (flHidden=false, title=nil, adradrwindow=nil) {
<<Changes:
<<4/16/02; 12:19:19 AM by JES
<<Set the window's lineEnding attribute to the line ending for the current platform.
<<12/2/01; 7:07:19 PM by JES
<<if user.radio.settings.flExpired is defined, and true, open the serial number page.
<<11/11/01; 1:41:33 PM by JES
<<Put the new outline in text mode, so that you can start typing immediately.
<<07/04/01; 1:25:13 AM by JES
<<Rewrite for the windowTypes/Tools framework.
<<Archive
<<12/26/00; 4:00:31 PM by PBS
<<Call the new bottleneck script at pike.newWindow.
<<12/12/00; 10:03:16 PM by PBS
<<Set the window title in the call to edit -- so the title doesn't flash, first with the path name, then with the window title.
<<11/30/00; 12:13:55 AM by JES
<<Dereference callback addresses in a try block in case a tool's odb is not opened
<<09/30/00; 12:45:13 PM by PBS
<<Call callback scripts.
<<07/26/00; 10:01:52 PM by PBS
<<New outlines open in text mode, so you can start typing automatically.
<<07/24/00; 12:31:47 PM by PBS
<<Created. Create a new XML outlineDocument document.
if defined (user.radio.settings.flExpired) {
if user.radio.settings.flExpired {
radio.menuCommands.openPage (radio.data.systemurls.serialnumber);
return (true)}};
Frontier.tools.windowTypes.init ();
on runCallbacks (adrCallback) {
if defined (adrCallback^) {
local (flConsumed = false);
local (adrScript);
for adrScript in adrCallback {
try { //11/30/00 JES
while typeOf (adrScript^) == addressType { //follow addresses
adrScript = adrScript^};
flConsumed = adrScript^ ()}; //no parameters
if flConsumed {
return (true)}}};
return (false)};
if runCallbacks (@user.tools.commandCallbacks) {
return (true)};
if system.environment.isRadio {
if defined (user.pike.commandCallbacks) {
if runCallbacks (@user.pike.commandCallbacks.new) {
return (true)}}};
if title == nil { //get next file number and title string -- Untitled-xxx
if not defined (temp.windowTypes.nextFileNum) {
temp.windowTypes.nextFileNum = 1};
nextFileNum = temp.windowTypes.nextFileNum;
temp.windowTypes.nextFileNum++;
if nextFileNum == 1 {
title = "Untitled"}
else {
title = "Untitled-" + nextFileNum}};
local (adr = Frontier.tools.windowTypes.newWindow ("outlinerFile", flHidden, title));
window.attributes.setOne ("flOutlineDocument", true, adr);
window.attributes.setOne ("title", title, adr);
bundle { //set lineEnding attribute
if system.environment.isMac {
if system.environment.isCarbon {
window.attributes.setOne ("lineEnding", "\r", adr)}
else { //classic
window.attributes.setOne ("lineEnding", "\n", adr)}}
else { //windows
window.attributes.setOne ("lineEnding", "\r\n", adr)}};
local (oldTarget = target.set (adr));
wp.setTextMode (true);
try {target.set (oldTarget)};
if adradrwindow != nil {
adradrwindow^ = adr};
return (true);
};
<<bundle //old code
<<local (nextFileNum, titleString)
<<
<<bundle //get next file number and title string -- Untitled-xxx
<<if not defined (temp.pike)
<<new (tableType, @temp.pike)
<<if not defined (temp.pike.nextFileNum)
<<temp.pike.nextFileNum = 1
<<nextFileNum = temp.pike.nextFileNum
<<temp.pike.nextFileNum++
<<if nextFileNum == 1
<<titleString = "Untitled"
<<else
<<titleString = "Untitled-" + nextFileNum
<<
<<bundle //create a new outline document
<<Old code, moved to pike.newWindow:
<<if not defined (temp.pike.outlines)
<<new (tableType, @temp.pike.outlines)
<<local (adrOutlinesTable = @temp.pike.outlines)
<<local (adrTable = @adrOutlinesTable^.[titleString])
<<new (tableType, adrTable)
<<new (outlineType, @adrTable^.outline)
<<edit (@adrTable^.outline, windowTitle:titleString) //PBS 12/12/00: set title in call to edit
<<wp.setTextMode (true) //PBS 07/26/00: new outlines should be in text mode, so you can start typing automatically
<<window.setTitle (@adrTable^.outline, titleString) //PBS 12/12/00: commented this line out -- see call to edit, above, that sets the title
<<adrTable^.flSaved = false
<<adrTable^.timeCreated = clock.now ()
<<adrTable^.title = titleString
<<adrTable^.flLocal = true
<<pike.newWindow (titleString) //PBS 12/26/00: call new bottleneck script
<<
<<return (true)
<<bundle //debugging
<<new ()
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.