mirror of
https://github.com/gnustep/libs-steptalk.git
synced 2025-02-16 00:11:29 +00:00
Added ScriptPapers application
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/steptalk/trunk@16601 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4d61e1690a
commit
a60df5a20a
24 changed files with 1003 additions and 0 deletions
31
Applications/ScriptPapers/AppController.h
Normal file
31
Applications/ScriptPapers/AppController.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/** Controller
|
||||
|
||||
Copyright (c) 2003 Stefan Urbanek
|
||||
|
||||
Written by: Stefan Urbanek
|
||||
Date: 2003 Apr 26
|
||||
|
||||
This file is part of the Farmer application.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#import <Foundation/NSObject.h>
|
||||
|
||||
@interface AppController : NSObject
|
||||
{
|
||||
}
|
||||
@end
|
58
Applications/ScriptPapers/AppController.m
Normal file
58
Applications/ScriptPapers/AppController.m
Normal file
|
@ -0,0 +1,58 @@
|
|||
/** Controller
|
||||
|
||||
Copyright (c) 2003 Stefan Urbanek
|
||||
|
||||
Written by: Stefan Urbanek
|
||||
Date: 2003 Apr 26
|
||||
|
||||
This file is part of the Farmer application.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#import "AppController.h"
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSString.h>
|
||||
#import <Foundation/NSUserDefaults.h>
|
||||
|
||||
#import <AppKit/NSApplication.h>
|
||||
#import <AppKit/NSOpenPanel.h>
|
||||
|
||||
#import "ScriptPaper.h"
|
||||
#import "ScriptPaperController.h"
|
||||
|
||||
@interface AppController(Private)
|
||||
@end
|
||||
|
||||
@implementation AppController
|
||||
- init
|
||||
{
|
||||
[super init];
|
||||
|
||||
|
||||
return self;
|
||||
}
|
||||
- (void)dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
- (void)applicationDidFinishLaunching:(id)notif
|
||||
{
|
||||
/* Go to known state of application */
|
||||
[[NSDocumentController sharedDocumentController] newDocument:nil];
|
||||
}
|
||||
@end
|
154
Applications/ScriptPapers/English.lproj/Paper.gorm/data.classes
Normal file
154
Applications/ScriptPapers/English.lproj/Paper.gorm/data.classes
Normal file
|
@ -0,0 +1,154 @@
|
|||
{
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"activateContextHelpMode:",
|
||||
"alignCenter:",
|
||||
"alignJustified:",
|
||||
"alignLeft:",
|
||||
"alignRight:",
|
||||
"arrangeInFront:",
|
||||
"cancel:",
|
||||
"capitalizeWord:",
|
||||
"changeColor:",
|
||||
"changeFont:",
|
||||
"checkSpelling:",
|
||||
"close:",
|
||||
"complete:",
|
||||
"copy:",
|
||||
"copyFont:",
|
||||
"copyRuler:",
|
||||
"cut:",
|
||||
"delete:",
|
||||
"deleteBackward:",
|
||||
"deleteForward:",
|
||||
"deleteToBeginningOfLine:",
|
||||
"deleteToBeginningOfParagraph:",
|
||||
"deleteToEndOfLine:",
|
||||
"deleteToEndOfParagraph:",
|
||||
"deleteToMark:",
|
||||
"deleteWordBackward:",
|
||||
"deleteWordForward:",
|
||||
"deminiaturize:",
|
||||
"deselectAll:",
|
||||
"fax:",
|
||||
"hide:",
|
||||
"hideOtherApplications:",
|
||||
"indent:",
|
||||
"loosenKerning:",
|
||||
"lowerBaseline:",
|
||||
"lowercaseWord:",
|
||||
"makeKeyAndOrderFront:",
|
||||
"miniaturize:",
|
||||
"miniaturizeAll:",
|
||||
"moveBackward:",
|
||||
"moveBackwardAndModifySelection:",
|
||||
"moveDown:",
|
||||
"moveDownAndModifySelection:",
|
||||
"moveForward:",
|
||||
"moveForwardAndModifySelection:",
|
||||
"moveLeft:",
|
||||
"moveRight:",
|
||||
"moveToBeginningOfDocument:",
|
||||
"moveToBeginningOfLine:",
|
||||
"moveToBeginningOfParagraph:",
|
||||
"moveToEndOfDocument:",
|
||||
"moveToEndOfLine:",
|
||||
"moveToEndOfParagraph:",
|
||||
"moveUp:",
|
||||
"moveUpAndModifySelection:",
|
||||
"moveWordBackward:",
|
||||
"moveWordBackwardAndModifySelection:",
|
||||
"moveWordForward:",
|
||||
"moveWordForwardAndModifySelection:",
|
||||
"newDocument:",
|
||||
"ok:",
|
||||
"openDocument:",
|
||||
"orderBack:",
|
||||
"orderFront:",
|
||||
"orderFrontColorPanel:",
|
||||
"orderFrontDataLinkPanel:",
|
||||
"orderFrontFontPanel:",
|
||||
"orderFrontHelpPanel:",
|
||||
"orderFrontSharedMemoryPanel:",
|
||||
"orderFrontStandardAboutPanel:",
|
||||
"orderFrontStandardInfoPanel:",
|
||||
"orderOut:",
|
||||
"pageDown:",
|
||||
"pageUp:",
|
||||
"paste:",
|
||||
"pasteAsPlainText:",
|
||||
"pasteAsRichText:",
|
||||
"pasteFont:",
|
||||
"pasteRuler:",
|
||||
"performClose:",
|
||||
"performMiniaturize:",
|
||||
"performZoom:",
|
||||
"print:",
|
||||
"raiseBaseline:",
|
||||
"revertDocumentToSaved:",
|
||||
"runPageLayout:",
|
||||
"runToolbarCustomizationPalette:",
|
||||
"saveAllDocuments:",
|
||||
"saveDocument:",
|
||||
"saveDocumentAs:",
|
||||
"saveDocumentTo:",
|
||||
"scrollLineDown:",
|
||||
"scrollLineUp:",
|
||||
"scrollPageDown:",
|
||||
"scrollPageUp:",
|
||||
"scrollViaScroller:",
|
||||
"selectAll:",
|
||||
"selectLine:",
|
||||
"selectNextKeyView:",
|
||||
"selectParagraph:",
|
||||
"selectPreviousKeyView:",
|
||||
"selectText:",
|
||||
"selectText:",
|
||||
"selectToMark:",
|
||||
"selectWord:",
|
||||
"showContextHelp:",
|
||||
"showGuessPanel:",
|
||||
"showHelp:",
|
||||
"showWindow:",
|
||||
"stop:",
|
||||
"subscript:",
|
||||
"superscript:",
|
||||
"swapWithMark:",
|
||||
"takeDoubleValueFrom:",
|
||||
"takeFloatValueFrom:",
|
||||
"takeIntValueFrom:",
|
||||
"takeObjectValueFrom:",
|
||||
"takeStringValueFrom:",
|
||||
"terminate:",
|
||||
"tightenKerning:",
|
||||
"toggle:",
|
||||
"toggleContinuousSpellChecking:",
|
||||
"toggleRuler:",
|
||||
"toggleToolbarShown:",
|
||||
"toggleTraditionalCharacterShape:",
|
||||
"transpose:",
|
||||
"transposeWords:",
|
||||
"turnOffKerning:",
|
||||
"turnOffLigatures:",
|
||||
"underline:",
|
||||
"unhide:",
|
||||
"unhideAllApplications:",
|
||||
"unscript:",
|
||||
"uppercaseWord:",
|
||||
"useAllLigatures:",
|
||||
"useStandardKerning:",
|
||||
"useStandardLigatures:",
|
||||
"yank:",
|
||||
"zoom:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
ScriptPaperController = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
sourceView
|
||||
);
|
||||
Super = NSWindowController;
|
||||
};
|
||||
}
|
BIN
Applications/ScriptPapers/English.lproj/Paper.gorm/objects.gorm
Normal file
BIN
Applications/ScriptPapers/English.lproj/Paper.gorm/objects.gorm
Normal file
Binary file not shown.
|
@ -0,0 +1,155 @@
|
|||
{
|
||||
AppController = {
|
||||
Actions = (
|
||||
);
|
||||
Outlets = (
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
FirstResponder = {
|
||||
Actions = (
|
||||
"activateContextHelpMode:",
|
||||
"alignCenter:",
|
||||
"alignJustified:",
|
||||
"alignLeft:",
|
||||
"alignRight:",
|
||||
"arrangeInFront:",
|
||||
"cancel:",
|
||||
"capitalizeWord:",
|
||||
"changeColor:",
|
||||
"changeFont:",
|
||||
"checkSpelling:",
|
||||
"close:",
|
||||
"complete:",
|
||||
"copy:",
|
||||
"copyFont:",
|
||||
"copyRuler:",
|
||||
"cut:",
|
||||
"delete:",
|
||||
"deleteBackward:",
|
||||
"deleteForward:",
|
||||
"deleteToBeginningOfLine:",
|
||||
"deleteToBeginningOfParagraph:",
|
||||
"deleteToEndOfLine:",
|
||||
"deleteToEndOfParagraph:",
|
||||
"deleteToMark:",
|
||||
"deleteWordBackward:",
|
||||
"deleteWordForward:",
|
||||
"deminiaturize:",
|
||||
"deselectAll:",
|
||||
"fax:",
|
||||
"hide:",
|
||||
"hideOtherApplications:",
|
||||
"indent:",
|
||||
"loosenKerning:",
|
||||
"lowerBaseline:",
|
||||
"lowercaseWord:",
|
||||
"makeKeyAndOrderFront:",
|
||||
"miniaturize:",
|
||||
"miniaturizeAll:",
|
||||
"moveBackward:",
|
||||
"moveBackwardAndModifySelection:",
|
||||
"moveDown:",
|
||||
"moveDownAndModifySelection:",
|
||||
"moveForward:",
|
||||
"moveForwardAndModifySelection:",
|
||||
"moveLeft:",
|
||||
"moveRight:",
|
||||
"moveToBeginningOfDocument:",
|
||||
"moveToBeginningOfLine:",
|
||||
"moveToBeginningOfParagraph:",
|
||||
"moveToEndOfDocument:",
|
||||
"moveToEndOfLine:",
|
||||
"moveToEndOfParagraph:",
|
||||
"moveUp:",
|
||||
"moveUpAndModifySelection:",
|
||||
"moveWordBackward:",
|
||||
"moveWordBackwardAndModifySelection:",
|
||||
"moveWordForward:",
|
||||
"moveWordForwardAndModifySelection:",
|
||||
"newDocument:",
|
||||
"ok:",
|
||||
"openDocument:",
|
||||
"orderBack:",
|
||||
"orderFront:",
|
||||
"orderFrontColorPanel:",
|
||||
"orderFrontDataLinkPanel:",
|
||||
"orderFrontFontPanel:",
|
||||
"orderFrontHelpPanel:",
|
||||
"orderFrontSharedMemoryPanel:",
|
||||
"orderFrontStandardAboutPanel:",
|
||||
"orderFrontStandardInfoPanel:",
|
||||
"orderOut:",
|
||||
"pageDown:",
|
||||
"pageUp:",
|
||||
"paste:",
|
||||
"pasteAsPlainText:",
|
||||
"pasteAsRichText:",
|
||||
"pasteFont:",
|
||||
"pasteRuler:",
|
||||
"performClose:",
|
||||
"performMiniaturize:",
|
||||
"performZoom:",
|
||||
"print:",
|
||||
"raiseBaseline:",
|
||||
"revertDocumentToSaved:",
|
||||
"runPageLayout:",
|
||||
"runToolbarCustomizationPalette:",
|
||||
"saveAllDocuments:",
|
||||
"saveDocument:",
|
||||
"saveDocumentAs:",
|
||||
"saveDocumentTo:",
|
||||
"scrollLineDown:",
|
||||
"scrollLineUp:",
|
||||
"scrollPageDown:",
|
||||
"scrollPageUp:",
|
||||
"scrollViaScroller:",
|
||||
"selectAll:",
|
||||
"selectLine:",
|
||||
"selectNextKeyView:",
|
||||
"selectParagraph:",
|
||||
"selectPreviousKeyView:",
|
||||
"selectText:",
|
||||
"selectText:",
|
||||
"selectToMark:",
|
||||
"selectWord:",
|
||||
"showContextHelp:",
|
||||
"showGuessPanel:",
|
||||
"showHelp:",
|
||||
"showWindow:",
|
||||
"stop:",
|
||||
"subscript:",
|
||||
"superscript:",
|
||||
"swapWithMark:",
|
||||
"takeDoubleValueFrom:",
|
||||
"takeFloatValueFrom:",
|
||||
"takeIntValueFrom:",
|
||||
"takeObjectValueFrom:",
|
||||
"takeStringValueFrom:",
|
||||
"terminate:",
|
||||
"tightenKerning:",
|
||||
"toggle:",
|
||||
"toggleContinuousSpellChecking:",
|
||||
"toggleRuler:",
|
||||
"toggleToolbarShown:",
|
||||
"toggleTraditionalCharacterShape:",
|
||||
"transpose:",
|
||||
"transposeWords:",
|
||||
"turnOffKerning:",
|
||||
"turnOffLigatures:",
|
||||
"underline:",
|
||||
"unhide:",
|
||||
"unhideAllApplications:",
|
||||
"unscript:",
|
||||
"uppercaseWord:",
|
||||
"useAllLigatures:",
|
||||
"useStandardKerning:",
|
||||
"useStandardLigatures:",
|
||||
"yank:",
|
||||
"zoom:",
|
||||
"doSelection:",
|
||||
"doAndShowSelection:"
|
||||
);
|
||||
Super = NSObject;
|
||||
};
|
||||
}
|
Binary file not shown.
62
Applications/ScriptPapers/GNUmakefile
Normal file
62
Applications/ScriptPapers/GNUmakefile
Normal file
|
@ -0,0 +1,62 @@
|
|||
# Script Papers
|
||||
#
|
||||
# Copyright (C) 2002 Stefan Urbanek
|
||||
#
|
||||
# Written by: Stefan Urbanek
|
||||
# Date: 2003 Apr 26
|
||||
#
|
||||
# This file is part of the AgentFarms
|
||||
#
|
||||
# This library is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU Library General Public
|
||||
# License as published by the Free Software Foundation; either
|
||||
# version 2 of the License, or (at your option) any later version.
|
||||
#
|
||||
# This library 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
|
||||
# Library General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Library General Public
|
||||
# License along with this library; if not, write to the Free
|
||||
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA
|
||||
#
|
||||
|
||||
include $(GNUSTEP_MAKEFILES)/common.make
|
||||
|
||||
APP_NAME = ScriptPapers
|
||||
PACKAGE_NAME = ScriptPapers
|
||||
|
||||
ScriptPapers_APPLICATION_ICON =
|
||||
ScriptPapers_MAIN_MODEL_FILE = ScriptPapers.gorm
|
||||
|
||||
ADDITIONAL_GUI_LIBS += -lStepTalk
|
||||
|
||||
############################################################################
|
||||
# ObjC files
|
||||
|
||||
ScriptPapers_OBJC_FILES= \
|
||||
AppController.m \
|
||||
ScriptPaper.m \
|
||||
ScriptPaperController.m \
|
||||
NSObject+NibLoading.m \
|
||||
NSTextView+additions.m \
|
||||
main.m
|
||||
|
||||
############################################################################
|
||||
# Resource files
|
||||
|
||||
ScriptPapers_LOCALIZED_RESOURCE_FILES= \
|
||||
ScriptPapers.gorm \
|
||||
Paper.gorm
|
||||
|
||||
ScriptPapers_RESOURCE_FILES = \
|
||||
|
||||
|
||||
ADDITIONAL_OBJCFLAGS =
|
||||
|
||||
############################################################################
|
||||
|
||||
-include GNUmakefile.preamble
|
||||
include $(GNUSTEP_MAKEFILES)/application.make
|
||||
-include GNUmakefile.postamble
|
31
Applications/ScriptPapers/NSObject+NibLoading.h
Normal file
31
Applications/ScriptPapers/NSObject+NibLoading.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/** NSObject+NibLoading
|
||||
|
||||
Copyright (c) 2002 Stefan Urbanek
|
||||
|
||||
Written by: Stefan Urbanek
|
||||
Date: 2002 Oct 10
|
||||
|
||||
This file is part of the Farmer application.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#import <AppKit/NSNibLoading.h>
|
||||
|
||||
@interface NSObject(AFNibLoading)
|
||||
- (BOOL)loadMyNibNamed:(NSString *)aName;
|
||||
@end
|
||||
|
58
Applications/ScriptPapers/NSObject+NibLoading.m
Normal file
58
Applications/ScriptPapers/NSObject+NibLoading.m
Normal file
|
@ -0,0 +1,58 @@
|
|||
/** NSObject+NibLoading
|
||||
|
||||
Copyright (c) 2002 Stefan Urbanek
|
||||
|
||||
Written by: Stefan Urbanek
|
||||
Date: 2002 Oct 10
|
||||
|
||||
This file is part of the Farmer application.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#import "NSObject+NibLoading.h"
|
||||
|
||||
#import <AppKit/NSPanel.h>
|
||||
|
||||
@class AFSimulation;
|
||||
|
||||
@implementation NSObject(AFNibLoading)
|
||||
- (BOOL)loadMyNibNamed:(NSString *)aName
|
||||
{
|
||||
NSDictionary *dict;
|
||||
NSBundle *bundle;
|
||||
BOOL flag;
|
||||
|
||||
dict = [NSDictionary dictionaryWithObjectsAndKeys:self, @"NSOwner",
|
||||
nil, nil];
|
||||
|
||||
bundle = [NSBundle bundleForClass:[self class]];
|
||||
|
||||
flag = [bundle loadNibFile:aName
|
||||
externalNameTable:dict
|
||||
withZone:[self zone]];
|
||||
|
||||
if(!flag)
|
||||
{
|
||||
NSRunAlertPanel(@"Unable to load resources",
|
||||
@"Unable to load '%@' resources",
|
||||
@"Cancel", nil, nil, aName);
|
||||
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
@end
|
||||
|
31
Applications/ScriptPapers/NSTextView+additions.h
Normal file
31
Applications/ScriptPapers/NSTextView+additions.h
Normal file
|
@ -0,0 +1,31 @@
|
|||
/** NSTextView additions
|
||||
|
||||
Copyright (c) 2003 Stefan Urbanek
|
||||
|
||||
Written by: Stefan Urbanek
|
||||
Date: 2003 Apr 26
|
||||
|
||||
This file is part of the Farmer application.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#import <AppKit/NSTextView.h>
|
||||
|
||||
@interface NSTextView(PaperAdditions)
|
||||
- (NSString *)selectedString;
|
||||
- (BOOL)hasSelection;
|
||||
@end
|
40
Applications/ScriptPapers/NSTextView+additions.m
Normal file
40
Applications/ScriptPapers/NSTextView+additions.m
Normal file
|
@ -0,0 +1,40 @@
|
|||
/** NSTextView additions
|
||||
|
||||
Copyright (c) 2003 Stefan Urbanek
|
||||
|
||||
Written by: Stefan Urbanek
|
||||
Date: 2003 Apr 26
|
||||
|
||||
This file is part of the Farmer application.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#import "NSTextView+additions.h"
|
||||
|
||||
@implementation NSTextView(PaperAdditions)
|
||||
- (NSString *)selectedString
|
||||
{
|
||||
NSRange range = [self selectedRange];
|
||||
|
||||
return [[self attributedSubstringFromRange:range] string];
|
||||
}
|
||||
- (BOOL)hasSelection
|
||||
{
|
||||
NSRange range = [self selectedRange];
|
||||
return (range.length != 0);
|
||||
}
|
||||
@end
|
35
Applications/ScriptPapers/ScriptPaper.h
Normal file
35
Applications/ScriptPapers/ScriptPaper.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/** ScriptPaper
|
||||
|
||||
Copyright (c) 2003 Stefan Urbanek
|
||||
|
||||
Written by: Stefan Urbanek
|
||||
Date: 2003 Apr 26
|
||||
|
||||
This file is part of the Farmer application.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#import <AppKit/NSDocument.h>
|
||||
|
||||
@class STEnvironment;
|
||||
@interface ScriptPaper:NSDocument
|
||||
{
|
||||
STEnvironment *environment;
|
||||
}
|
||||
- (IBAction)doSelection:(id)sender;
|
||||
- (IBAction)doAndShowSelection:(id)sender;
|
||||
@end
|
109
Applications/ScriptPapers/ScriptPaper.m
Normal file
109
Applications/ScriptPapers/ScriptPaper.m
Normal file
|
@ -0,0 +1,109 @@
|
|||
/** Controller
|
||||
|
||||
Copyright (c) 2003 Stefan Urbanek
|
||||
|
||||
Written by: Stefan Urbanek
|
||||
Date: 2003 Apr 26
|
||||
|
||||
This file is part of the Farmer application.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#import "ScriptPaper.h"
|
||||
|
||||
#import <Foundation/NSException.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <StepTalk/STEnvironment.h>
|
||||
#import <StepTalk/STEngine.h>
|
||||
#import <StepTalk/STLanguage.h>
|
||||
|
||||
#import "ScriptPaperController.h"
|
||||
|
||||
@implementation ScriptPaper
|
||||
- init
|
||||
{
|
||||
[super init];
|
||||
|
||||
environment = [[STEnvironment alloc] initDefault];
|
||||
|
||||
return self;
|
||||
}
|
||||
- (void)dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (void)makeWindowControllers
|
||||
{
|
||||
ScriptPaperController *controller;
|
||||
|
||||
controller = [[ScriptPaperController alloc] init];
|
||||
[controller setDocument:self];
|
||||
|
||||
[self addWindowController:AUTORELEASE(controller)];
|
||||
}
|
||||
- (id)executeScriptString:(NSString *)source
|
||||
{
|
||||
STEngine *engine;
|
||||
NSString *error;
|
||||
id retval = nil;
|
||||
|
||||
engine = [STEngine engineForLanguageWithName:
|
||||
[STLanguage defaultLanguageName]];
|
||||
if(!engine)
|
||||
{
|
||||
NSLog(@"Unable to get scripting engine.");
|
||||
return nil;
|
||||
}
|
||||
|
||||
if(!environment)
|
||||
{
|
||||
NSLog(@"No scripting environment");
|
||||
return nil;
|
||||
}
|
||||
|
||||
NS_DURING
|
||||
retval = [engine executeCode:source inEnvironment:environment];
|
||||
NS_HANDLER
|
||||
error = [NSString stringWithFormat:
|
||||
@"Error: "
|
||||
@"Execution of script failed. %@. (%@)",
|
||||
[localException reason],
|
||||
[localException name]];
|
||||
|
||||
// [[STTranscript sharedTranscript] showError:error];
|
||||
|
||||
NSLog(@"Script exception: %@", error);
|
||||
|
||||
retval = nil;
|
||||
NS_ENDHANDLER
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
- (BOOL)writeToFile:(NSString *)fileName ofType:(NSString *)fileType
|
||||
{
|
||||
NSLog(@"Write to file %@ of type %@. (not implemented)", fileName, fileType);
|
||||
return YES;
|
||||
}
|
||||
- (BOOL)readFromFile:(NSString *)fileName ofType:(NSString *)fileType
|
||||
{
|
||||
NSLog(@"Read from file %@ of type %@. (not implemented)", fileName, fileType);
|
||||
return YES;
|
||||
}
|
||||
@end
|
38
Applications/ScriptPapers/ScriptPaperController.h
Normal file
38
Applications/ScriptPapers/ScriptPaperController.h
Normal file
|
@ -0,0 +1,38 @@
|
|||
/** ScriptPaper
|
||||
|
||||
Copyright (c) 2003 Stefan Urbanek
|
||||
|
||||
Written by: Stefan Urbanek
|
||||
Date: 2003 Apr 26
|
||||
|
||||
This file is part of the Farmer application.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#import <AppKit/NSWindowController.h>
|
||||
|
||||
@class ScriptPaper;
|
||||
@class NSTextView;
|
||||
@class NSForm;
|
||||
@class NSWindow;
|
||||
|
||||
@interface ScriptPaperController:NSWindowController
|
||||
{
|
||||
NSTextView *sourceView;
|
||||
}
|
||||
@end
|
||||
|
103
Applications/ScriptPapers/ScriptPaperController.m
Normal file
103
Applications/ScriptPapers/ScriptPaperController.m
Normal file
|
@ -0,0 +1,103 @@
|
|||
/** Controller
|
||||
|
||||
Copyright (c) 2003 Stefan Urbanek
|
||||
|
||||
Written by: Stefan Urbanek
|
||||
Date: 2003 Apr 26
|
||||
|
||||
This file is part of the Farmer application.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#import "ScriptPaperController.h"
|
||||
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import <AppKit/NSForm.h>
|
||||
#import <AppKit/NSTextView.h>
|
||||
#import <AppKit/NSWindow.h>
|
||||
|
||||
#import "NSTextView+additions.h"
|
||||
|
||||
#import "ScriptPaper.h"
|
||||
|
||||
@implementation ScriptPaperController
|
||||
- init
|
||||
{
|
||||
return [self initWithWindowNibName:@"Paper"];
|
||||
}
|
||||
- (void)windowDidLoad
|
||||
{
|
||||
[sourceView setRichText:NO];
|
||||
[sourceView setString:@"This is a paper.\n1 + 1"];
|
||||
}
|
||||
- (void)dealloc
|
||||
{
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/** Execute selected text as script. */
|
||||
- (IBAction)doSelection:(id)sender
|
||||
{
|
||||
NSString *selectedString = [sourceView selectedString];
|
||||
|
||||
NSLog(@"Do!");
|
||||
|
||||
[[self document] executeScriptString:selectedString];
|
||||
}
|
||||
|
||||
/** Execute selected text as script and insert result into the paper. */
|
||||
- (IBAction)doAndShowSelection:(id)sender
|
||||
{
|
||||
NSString *selectedString = [sourceView selectedString];
|
||||
NSRange range;
|
||||
id string;
|
||||
int length;
|
||||
id retval = nil;
|
||||
|
||||
NSLog(@"Do and Show!");
|
||||
|
||||
retval = [[self document] executeScriptString:selectedString];
|
||||
|
||||
if(!retval)
|
||||
{
|
||||
retval = @"(nil)";
|
||||
}
|
||||
|
||||
range = [sourceView selectedRange];
|
||||
range = NSMakeRange(NSMaxRange(range), 0);
|
||||
[sourceView setSelectedRange:range];
|
||||
|
||||
|
||||
if([retval isKindOfClass:[NSString class]]
|
||||
|| [retval isKindOfClass:[NSAttributedString class]])
|
||||
{
|
||||
string = retval;
|
||||
}
|
||||
else
|
||||
{
|
||||
string = [retval description];
|
||||
}
|
||||
|
||||
[sourceView insertText:@" "];
|
||||
[sourceView insertText:string];
|
||||
|
||||
range = NSMakeRange(range.location + 1, [string length]);
|
||||
|
||||
}
|
||||
|
||||
@end
|
20
Applications/ScriptPapers/ScriptPapersInfo.plist
Normal file
20
Applications/ScriptPapers/ScriptPapersInfo.plist
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
ApplicationName = "Script Papers";
|
||||
ApplicationDescription = "Application for writing script papers.";
|
||||
ApplicationRelease = "0.1.0";
|
||||
Authors = ("Stefan Urbanek <urbanek@host.sk>");
|
||||
Copyright = "Copyright (c) 2003 Stefan Urbanek <urbanek@host.sk>";
|
||||
CopyrightDescription = "This program is released under the GNU General Public License";
|
||||
|
||||
NSTypes = (
|
||||
{
|
||||
NSUnixExtensions = ("spaper");
|
||||
NSName = "spaper";
|
||||
NSHumanReadableName = "Script Paper";
|
||||
NSMIMETypes = ("application/spaper");
|
||||
NSIcon = spaper;
|
||||
NSRole = Editor;
|
||||
NSDocumentClass = ScriptPaper;
|
||||
}
|
||||
);
|
||||
}
|
37
Applications/ScriptPapers/main.m
Normal file
37
Applications/ScriptPapers/main.m
Normal file
|
@ -0,0 +1,37 @@
|
|||
/** main
|
||||
|
||||
Copyright (c) 2002 Stefan Urbanek
|
||||
|
||||
Written by: Stefan Urbanek
|
||||
Date: 2002 Feb 20
|
||||
|
||||
This file is part of the Farmer application.
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library 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
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*/
|
||||
|
||||
#import <AppKit/NSApplication.h>
|
||||
|
||||
#define APP_NAME @"GNUstep"
|
||||
|
||||
/*
|
||||
* Initialise and go!
|
||||
*/
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
return NSApplicationMain (argc, argv);
|
||||
}
|
1
Applications/ScriptPapers/run
Executable file
1
Applications/ScriptPapers/run
Executable file
|
@ -0,0 +1 @@
|
|||
make debug=yes && openapp ScriptPapers.debug
|
|
@ -5,6 +5,10 @@
|
|||
check for existence of ScriptingInfo.plist before using it
|
||||
* Modules: reflect changes to STBundleInfo
|
||||
* Updated all GNUmakefiles to use new path
|
||||
* STEnvironment: added initDefault - this will replace confusing
|
||||
defaultScriptingEnvironment.
|
||||
* Added Applications
|
||||
* Added ScriptPapers application
|
||||
|
||||
2003 Apr 22 Stefan Urbanek <urbanek@host.sk>
|
||||
|
||||
|
|
|
@ -84,6 +84,13 @@
|
|||
bundle if it is not already loaded.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="id" init="yes">
|
||||
<sel>initDefault</sel>
|
||||
<desc>
|
||||
Initialises scripting environment using default
|
||||
description.
|
||||
</desc>
|
||||
</method>
|
||||
<method type="id">
|
||||
<sel>initWithDescription:</sel>
|
||||
<arg type="STEnvironmentDescription*">aDescription</arg>
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
<li><a rel="gsdoc" href="STEnvironment.html#method$STEnvironment-createsUnknownObjects">-createsUnknownObjects</a></li>
|
||||
<li><a rel="gsdoc" href="STEnvironment.html#method$STEnvironment-fullScriptingEnabled">-fullScriptingEnabled</a></li>
|
||||
<li><a rel="gsdoc" href="STEnvironment.html#method$STEnvironment-includeBundle:">-includeBundle:</a></li>
|
||||
<li><a rel="gsdoc" href="STEnvironment.html#method$STEnvironment-initDefault">-initDefault</a></li>
|
||||
<li><a rel="gsdoc" href="STEnvironment.html#method$STEnvironment-initWithDescription:">-initWithDescription:</a></li>
|
||||
<li><a rel="gsdoc" href="STEnvironment.html#method$STEnvironment-initWithDescriptionName:">-initWithDescriptionName:</a></li>
|
||||
<li><a rel="gsdoc" href="STEnvironment.html#method$STEnvironment-knownObjectNames">-knownObjectNames</a></li>
|
||||
|
@ -134,6 +135,16 @@
|
|||
bundle
|
||||
</p>
|
||||
<hr width="25%" align="left" />
|
||||
<h3><a name="method$STEnvironment-initDefault">initDefault</a></h3>
|
||||
- (id) <b>initDefault</b>;<br />
|
||||
This is a designated initialiser for the class.<br />
|
||||
<p>
|
||||
|
||||
Initialises scripting environment using default
|
||||
description.
|
||||
|
||||
</p>
|
||||
<hr width="25%" align="left" />
|
||||
<h3><a name="method$STEnvironment-initWithDescription:">initWithDescription:</a></h3>
|
||||
- (id) <b>initWithDescription:</b> (STEnvironmentDescription*)aDescription;<br />
|
||||
<p>
|
||||
|
|
|
@ -155,6 +155,9 @@
|
|||
"-includeBundle:" = {
|
||||
STEnvironment = STEnvironment;
|
||||
};
|
||||
"-initDefault" = {
|
||||
STEnvironment = STEnvironment;
|
||||
};
|
||||
"-initWithBundle:" = {
|
||||
STBundleInfo = STBundleInfo;
|
||||
};
|
||||
|
@ -489,6 +492,7 @@
|
|||
"-createsUnknownObjects" = STEnvironment;
|
||||
"-fullScriptingEnabled" = STEnvironment;
|
||||
"-includeBundle:" = STEnvironment;
|
||||
"-initDefault" = STEnvironment;
|
||||
"-initWithDescription:" = STEnvironment;
|
||||
"-initWithDescriptionName:" = STEnvironment;
|
||||
"-knownObjectNames" = STEnvironment;
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
+ environmentWithDescriptionName:(NSString *)descName;
|
||||
+ environmentWithDescription:(STEnvironmentDescription *)aDescription;
|
||||
|
||||
- initDefault;
|
||||
- initWithDescriptionName:(NSString *)descName;
|
||||
- initWithDescription:(STEnvironmentDescription *)aDescription;
|
||||
|
||||
|
|
|
@ -83,6 +83,19 @@
|
|||
return AUTORELEASE([[self alloc] initWithDescription:aDescription]);
|
||||
}
|
||||
|
||||
/**
|
||||
Initialises scripting environment using default description.
|
||||
|
||||
<init />
|
||||
*/
|
||||
- initDefault
|
||||
{
|
||||
NSString *name;
|
||||
|
||||
name = [STEnvironmentDescription defaultEnvironmentDescriptionName];
|
||||
|
||||
return [self initWithDescriptionName:name];
|
||||
}
|
||||
/**
|
||||
Initialises scripting environment using description with name
|
||||
<var>descName</var>.
|
||||
|
|
Loading…
Reference in a new issue