Skip to content

Commit 1176054

Browse files
committedAug 19, 2024
MPWProgramTextView → STProgramTextView (and extracted the non-ST-specific bits of the original under its original name; moved to MPWFoundation)
1 parent 7f312d5 commit 1176054

File tree

9 files changed

+79
-622
lines changed

9 files changed

+79
-622
lines changed
 

‎ObjectiveSmalltalk.xcodeproj/project.pbxproj

+8-8
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,6 @@
403403
1F88E8AC138ADC1600199F03 /* MPWFileSchemeResolver.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F88E8A0138ADC1600199F03 /* MPWFileSchemeResolver.m */; };
404404
1F88E8B3138ADC1600199F03 /* MPWEnvScheme.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F88E8A7138ADC1600199F03 /* MPWEnvScheme.h */; settings = {ATTRIBUTES = (Public, ); }; };
405405
1F88E8B4138ADC1600199F03 /* MPWEnvScheme.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F88E8A8138ADC1600199F03 /* MPWEnvScheme.m */; };
406-
1F89EBA12241A175000A82D6 /* MPWProgramTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F89EB9F2241A175000A82D6 /* MPWProgramTextView.h */; settings = {ATTRIBUTES = (Public, ); }; };
407-
1F89EBA22241A175000A82D6 /* MPWProgramTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F89EBA02241A175000A82D6 /* MPWProgramTextView.m */; };
408406
1F8B855219AC72C700F8A107 /* MPWFileWatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F8B855019AC72C700F8A107 /* MPWFileWatcher.h */; };
409407
1F8B855519AC72C700F8A107 /* MPWFileWatcher.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F8B855119AC72C700F8A107 /* MPWFileWatcher.m */; };
410408
1F8C938A24F5720D00646461 /* ObjectiveSmalltalk.h in Headers */ = {isa = PBXBuildFile; fileRef = 1FF556FD2456AF84006B8E0F /* ObjectiveSmalltalk.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -417,6 +415,8 @@
417415
1F93D4722A5F326A00C9BA2A /* STMethodSymbols.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F93D4702A5F326A00C9BA2A /* STMethodSymbols.m */; };
418416
1F93FA5E2BE785FE0046C7C3 /* MPWELFWriter.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F93FA5D2BE785FE0046C7C3 /* MPWELFWriter.m */; };
419417
1F93FA5F2BE785FE0046C7C3 /* MPWELFWriter.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F93FA5C2BE785FE0046C7C3 /* MPWELFWriter.h */; };
418+
1F94014E2C7353A900CD37ED /* STProgramTextView.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F94014D2C7353A900CD37ED /* STProgramTextView.m */; };
419+
1F94014F2C7353A900CD37ED /* STProgramTextView.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F94014C2C7353A900CD37ED /* STProgramTextView.h */; settings = {ATTRIBUTES = (Public, ); }; };
420420
1F9774592B6D096C0037DC95 /* STHypertextProcessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F9774572B6D096C0037DC95 /* STHypertextProcessor.h */; };
421421
1F97745A2B6D096C0037DC95 /* STHypertextProcessor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F9774582B6D096C0037DC95 /* STHypertextProcessor.m */; };
422422
1F99D23E2906F39F009F0CE8 /* hashPlus200.aarch64 in Resources */ = {isa = PBXBuildFile; fileRef = 1F99D23D2906F39F009F0CE8 /* hashPlus200.aarch64 */; };
@@ -1325,8 +1325,6 @@
13251325
1F88E8A0138ADC1600199F03 /* MPWFileSchemeResolver.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPWFileSchemeResolver.m; sourceTree = "<group>"; };
13261326
1F88E8A7138ADC1600199F03 /* MPWEnvScheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPWEnvScheme.h; sourceTree = "<group>"; };
13271327
1F88E8A8138ADC1600199F03 /* MPWEnvScheme.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPWEnvScheme.m; sourceTree = "<group>"; };
1328-
1F89EB9F2241A175000A82D6 /* MPWProgramTextView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPWProgramTextView.h; sourceTree = "<group>"; };
1329-
1F89EBA02241A175000A82D6 /* MPWProgramTextView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPWProgramTextView.m; sourceTree = "<group>"; };
13301328
1F8B855019AC72C700F8A107 /* MPWFileWatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPWFileWatcher.h; sourceTree = "<group>"; };
13311329
1F8B855119AC72C700F8A107 /* MPWFileWatcher.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MPWFileWatcher.m; sourceTree = "<group>"; };
13321330
1F8E81CF1924229B00821570 /* MPWDocumentScheme.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MPWDocumentScheme.h; sourceTree = "<group>"; };
@@ -1335,6 +1333,8 @@
13351333
1F93D4702A5F326A00C9BA2A /* STMethodSymbols.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STMethodSymbols.m; sourceTree = "<group>"; };
13361334
1F93FA5C2BE785FE0046C7C3 /* MPWELFWriter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MPWELFWriter.h; sourceTree = "<group>"; };
13371335
1F93FA5D2BE785FE0046C7C3 /* MPWELFWriter.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MPWELFWriter.m; sourceTree = "<group>"; };
1336+
1F94014C2C7353A900CD37ED /* STProgramTextView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = STProgramTextView.h; sourceTree = "<group>"; };
1337+
1F94014D2C7353A900CD37ED /* STProgramTextView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STProgramTextView.m; sourceTree = "<group>"; };
13381338
1F9774572B6D096C0037DC95 /* STHypertextProcessor.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = STHypertextProcessor.h; sourceTree = "<group>"; };
13391339
1F9774582B6D096C0037DC95 /* STHypertextProcessor.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = STHypertextProcessor.m; sourceTree = "<group>"; };
13401340
1F99D23829055D77009F0CE8 /* use_testclass.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = use_testclass.m; sourceTree = "<group>"; };
@@ -2384,8 +2384,6 @@
23842384
1F8E81D01924229B00821570 /* MPWDocumentScheme.m */,
23852385
1F7045EC22313E83005ED7FB /* MPWMethodBrowser.h */,
23862386
1F7045EE22313E84005ED7FB /* MPWMethodBrowser.xib */,
2387-
1F89EB9F2241A175000A82D6 /* MPWProgramTextView.h */,
2388-
1F89EBA02241A175000A82D6 /* MPWProgramTextView.m */,
23892387
1F19EFB41EF2573900CB9E01 /* NSView+dictionary.h */,
23902388
1F19EFB51EF2573900CB9E01 /* NSView+dictionary.m */,
23912389
1FA859FB1923731900F52396 /* ObjectiveSmalltalkUI.h */,
@@ -2405,6 +2403,8 @@
24052403
1F60964D25E788FC0018BB72 /* STUITests.h */,
24062404
1F60964E25E788FC0018BB72 /* STUITests.m */,
24072405
1F5D76BD25EBC94200DCC82F /* STUIAppKitAdditions.m */,
2406+
1F94014C2C7353A900CD37ED /* STProgramTextView.h */,
2407+
1F94014D2C7353A900CD37ED /* STProgramTextView.m */,
24082408
);
24092409
path = ObjectiveSmalltalkUI;
24102410
sourceTree = "<group>";
@@ -3080,6 +3080,7 @@
30803080
isa = PBXHeadersBuildPhase;
30813081
buildActionMask = 2147483647;
30823082
files = (
3083+
1F94014F2C7353A900CD37ED /* STProgramTextView.h in Headers */,
30833084
1FA85A1E1923739E00F52396 /* ShellView.h in Headers */,
30843085
1F60964F25E788FC0018BB72 /* STUITests.h in Headers */,
30853086
1F7045F92231412A005ED7FB /* ObjectiveSmalltalkUI.h in Headers */,
@@ -3096,7 +3097,6 @@
30963097
1F2B179A261C680D005D873F /* STViewScheme.h in Headers */,
30973098
1F19EFB61EF2573900CB9E01 /* NSView+dictionary.h in Headers */,
30983099
1F5A59A62AC1CC2000670E75 /* STProgressIndicator.h in Headers */,
3099-
1F89EBA12241A175000A82D6 /* MPWProgramTextView.h in Headers */,
31003100
1FA749BD25F5508D001AA6A8 /* MPWColorStore.h in Headers */,
31013101
1F8E81D11924229B00821570 /* MPWDocumentScheme.h in Headers */,
31023102
);
@@ -4486,7 +4486,7 @@
44864486
1F7045F022313E84005ED7FB /* MPWMethodBrowser.m in Sources */,
44874487
1FA85A271923746B00F52396 /* FSCommandHistory.m in Sources */,
44884488
1FB13BF22AA5F5BA006D85CC /* STButton.m in Sources */,
4489-
1F89EBA22241A175000A82D6 /* MPWProgramTextView.m in Sources */,
4489+
1F94014E2C7353A900CD37ED /* STProgramTextView.m in Sources */,
44904490
1F86CE1B2033386B000F0B81 /* MPWWindowsScheme.m in Sources */,
44914491
1F5A59A32AC1C26300670E75 /* STSlider.m in Sources */,
44924492
1F86CE2220334B2E000F0B81 /* MPWSpotlightScheme.m in Sources */,

‎ObjectiveSmalltalkUI/MPWProgramTextView.h

-20
This file was deleted.

‎ObjectiveSmalltalkUI/MPWProgramTextView.m

-588
This file was deleted.

‎ObjectiveSmalltalkUI/ObjectiveSmalltalkUI.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#import <Cocoa/Cocoa.h>
1010

1111
#import <ObjectiveSmalltalkUI/MPWMethodBrowser.h>
12-
#import <ObjectiveSmalltalkUI/MPWProgramTextView.h>
12+
#import <ObjectiveSmalltalkUI/STProgramTextView.h>
1313
#import <ObjectiveSmalltalkUI/MPWColorStore.h>
1414
#import <ObjectiveSmalltalkUI/MPWFontStore.h>
1515
#import <ObjectiveSmalltalkUI/STTextField.h>
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
//
2+
// STProgramTextView.h
3+
// ObjectiveSmalltalkUI
4+
//
5+
// Created by Marcel Weiher on 19.08.24.
6+
//
7+
8+
#import <ObjectiveSmalltalkUI/ObjectiveSmalltalkUI.h>
9+
10+
NS_ASSUME_NONNULL_BEGIN
11+
12+
@class STCompiler;
13+
14+
@interface STProgramTextView : MPWProgramTextView
15+
16+
@property (nonatomic, strong) STCompiler *compiler;
17+
18+
-(IBAction)doIt:sender;
19+
-(IBAction)printIt:sender;
20+
21+
@end
22+
23+
NS_ASSUME_NONNULL_END
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
//
2+
// STProgramTextView.m
3+
// ObjectiveSmalltalkUI
4+
//
5+
// Created by Marcel Weiher on 19.08.24.
6+
//
7+
8+
#import "STProgramTextView.h"
9+
#import "MPWREPLViewPrinter.h"
10+
#import <ObjectiveSmalltalk/ObjectiveSmalltalk.h>
11+
12+
@implementation STProgramTextView
13+
14+
-(IBAction)printIt:sender;
15+
{
16+
id result = nil;
17+
18+
@try {
19+
result = [self.compiler evaluateScriptString:[self selectedTextOrCurrentLine]];
20+
} @catch (NSException *e) {
21+
result = e;
22+
}
23+
MPWREPLViewPrinter *printer=[MPWREPLViewPrinter streamWithTarget:[NSMutableString string]];
24+
[printer writeObject:result];
25+
NSString *resultText=(NSString*)[printer target];
26+
NSRange currentSelection=[self selectedRange];
27+
[self setSelectedRange:NSMakeRange( currentSelection.location+currentSelection.length,0)];
28+
currentSelection=[self selectedRange];
29+
if ( resultText.length ) {
30+
[self insertTextAtCursor:@" "];
31+
[self insertTextAtCursor:resultText];
32+
[self setSelectedRange:NSMakeRange( currentSelection.location+1, resultText.length)];
33+
}
34+
}
35+
36+
37+
38+
-(IBAction)doIt:sender
39+
{
40+
[self.compiler evaluateScriptString:[self selectedTextOrCurrentLine]];
41+
}
42+
@end

‎Smalltalk/STAppDelegate.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#import "STAppDelegate.h"
99
#import "CLIView.h"
1010
#import "STCompiler.h"
11-
#import "MPWProgramTextView.h"
11+
#import "STProgramTextView.h"
1212

1313
@interface STAppDelegate ()
1414

‎Smalltalk/STDocument.m

+3-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
#import "STDocument.h"
9-
#import "MPWProgramTextView.h"
9+
#import "STProgramTextView.h"
1010

1111
@interface STDocument(st)
1212

@@ -62,9 +62,9 @@ - (NSString *)windowNibName {
6262
}
6363

6464

65-
-(MPWProgramTextView*)programTextView
65+
-(STProgramTextView*)programTextView
6666
{
67-
return (MPWProgramTextView*)[[self workspaces] anyObject]; // FIXME: allow only a single text view
67+
return (STProgramTextView*)[[self workspaces] anyObject]; // FIXME: allow only a single text view
6868
}
6969

7070
- (NSData *)dataOfType:(NSString *)typeName error:(NSError **)outError {

‎Smalltalk/STDocument.st

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ extension STDocument {
1111
scrollView := NSScrollView alloc initWithFrame: (0@0 extent: 500@400) | autorelease.
1212
scrollView setAutoresizingMask: 18.
1313
scrollView setHasVerticalScroller: true.
14-
workspace := MPWProgramTextView alloc initWithFrame: (0@0 extent: 500@400).
14+
workspace := STProgramTextView alloc initWithFrame: (0@0 extent: 500@400).
1515
workspace setAutoresizingMask: 18.
1616
scrollView setDocumentView:workspace.
1717
windowController := scrollView openInWindowController:'Workspace'.

0 commit comments

Comments
 (0)
Please sign in to comment.