mirror of
https://github.com/ksherlock/TwoTerm.git
synced 2024-12-30 12:29:43 +00:00
change settings for visual effects
git-svn-id: svn://qnap.local/TwoTerm/trunk@2025 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
parent
46ebda708c
commit
4c09c17029
@ -33,10 +33,13 @@
|
||||
B61D0D5D125B740C001C713B /* NewTerminal.xib in Resources */ = {isa = PBXBuildFile; fileRef = B61D0D5B125B740C001C713B /* NewTerminal.xib */; };
|
||||
B61D0D60125B7ACA001C713B /* NewTerminalWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = B61D0D5F125B7ACA001C713B /* NewTerminalWindowController.m */; };
|
||||
B61D0D69125B8E06001C713B /* Defaults.m in Sources */ = {isa = PBXBuildFile; fileRef = B61D0D68125B8E06001C713B /* Defaults.m */; };
|
||||
B627333B12E3FF5B00A14C94 /* ChildMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = B627333A12E3FF5B00A14C94 /* ChildMonitor.m */; };
|
||||
B676063B11DEAD3500D6B66C /* TermWindowController.mm in Sources */ = {isa = PBXBuildFile; fileRef = B676063A11DEAD3500D6B66C /* TermWindowController.mm */; };
|
||||
B676065111DEBAE900D6B66C /* TermWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = B676065011DEBAE900D6B66C /* TermWindow.xib */; };
|
||||
B67B3CE512B6FA040033AE07 /* a2-charset-40.png in Resources */ = {isa = PBXBuildFile; fileRef = B67B3CE312B6FA040033AE07 /* a2-charset-40.png */; };
|
||||
B67B3CE612B6FA040033AE07 /* a2-charset-80.png in Resources */ = {isa = PBXBuildFile; fileRef = B67B3CE412B6FA040033AE07 /* a2-charset-80.png */; };
|
||||
B6801BD912EB549300B22E9E /* vt100-charset.png in Resources */ = {isa = PBXBuildFile; fileRef = B6801BD812EB549300B22E9E /* vt100-charset.png */; };
|
||||
B68E632A12FF909D00EAFF5F /* ExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = B68E632912FF909C00EAFF5F /* ExampleView.m */; };
|
||||
B6EBE2B511E0EA9100EA0458 /* CharacterGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = B6EBE2B411E0EA9100EA0458 /* CharacterGenerator.m */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@ -74,8 +77,8 @@
|
||||
29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
|
||||
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
|
||||
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
|
||||
8D1107310486CEB800E47090 /* TwoTerm-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "TwoTerm-Info.plist"; sourceTree = "<group>"; };
|
||||
8D1107320486CEB800E47090 /* 2Term.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = 2Term.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8D1107320486CEB800E47090 /* TwoTerm.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TwoTerm.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
B60EBD1111E8DEEF00C1974F /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = /System/Library/Frameworks/QuartzCore.framework; sourceTree = "<absolute>"; };
|
||||
B60EBDE111E90FC300C1974F /* ScanLineFilter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScanLineFilter.h; sourceTree = "<group>"; };
|
||||
B60EBDE211E90FC300C1974F /* ScanLineFilter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScanLineFilter.m; sourceTree = "<group>"; };
|
||||
@ -113,11 +116,17 @@
|
||||
B61D0D5F125B7ACA001C713B /* NewTerminalWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NewTerminalWindowController.m; sourceTree = "<group>"; };
|
||||
B61D0D67125B8E06001C713B /* Defaults.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Defaults.h; sourceTree = "<group>"; };
|
||||
B61D0D68125B8E06001C713B /* Defaults.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Defaults.m; sourceTree = "<group>"; };
|
||||
B627333912E3FF5B00A14C94 /* ChildMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChildMonitor.h; sourceTree = "<group>"; };
|
||||
B627333A12E3FF5B00A14C94 /* ChildMonitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ChildMonitor.m; sourceTree = "<group>"; };
|
||||
B676063911DEAD3500D6B66C /* TermWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TermWindowController.h; sourceTree = "<group>"; };
|
||||
B676063A11DEAD3500D6B66C /* TermWindowController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = TermWindowController.mm; sourceTree = "<group>"; };
|
||||
B676064D11DEBAE300D6B66C /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/TermWindow.xib; sourceTree = "<group>"; };
|
||||
B67B3CE312B6FA040033AE07 /* a2-charset-40.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "a2-charset-40.png"; sourceTree = "<group>"; };
|
||||
B67B3CE412B6FA040033AE07 /* a2-charset-80.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "a2-charset-80.png"; sourceTree = "<group>"; };
|
||||
B6801BD812EB549300B22E9E /* vt100-charset.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "vt100-charset.png"; sourceTree = "<group>"; };
|
||||
B68E632812FF909C00EAFF5F /* ExampleView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExampleView.h; sourceTree = "<group>"; };
|
||||
B68E632912FF909C00EAFF5F /* ExampleView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExampleView.m; sourceTree = "<group>"; };
|
||||
B68E632B130990DD00EAFF5F /* en */ = {isa = PBXFileReference; lastKnownFileType = file; name = en; path = en.lproj/NewTerminal.xib; sourceTree = "<group>"; };
|
||||
B6EBE2B311E0EA9100EA0458 /* CharacterGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CharacterGenerator.h; sourceTree = "<group>"; };
|
||||
B6EBE2B411E0EA9100EA0458 /* CharacterGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CharacterGenerator.m; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
@ -138,6 +147,8 @@
|
||||
080E96DDFE201D6D7F000001 /* Classes */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B627333912E3FF5B00A14C94 /* ChildMonitor.h */,
|
||||
B627333A12E3FF5B00A14C94 /* ChildMonitor.m */,
|
||||
B61D0D5E125B7ACA001C713B /* NewTerminalWindowController.h */,
|
||||
B61D0D5F125B7ACA001C713B /* NewTerminalWindowController.m */,
|
||||
256AC3D80F4B6AC300CF3369 /* TwoTermAppDelegate.h */,
|
||||
@ -174,7 +185,7 @@
|
||||
19C28FACFE9D520D11CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
8D1107320486CEB800E47090 /* 2Term.app */,
|
||||
8D1107320486CEB800E47090 /* TwoTerm.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
@ -210,7 +221,7 @@
|
||||
children = (
|
||||
B60EBDE711E9143F00C1974F /* ScanLineFilter.cikernel */,
|
||||
B66979CE11E6BCAE002ED475 /* images */,
|
||||
8D1107310486CEB800E47090 /* TwoTerm-Info.plist */,
|
||||
8D1107310486CEB800E47090 /* Info.plist */,
|
||||
089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
|
||||
1DDD58140DA1D0A300B32029 /* MainMenu.xib */,
|
||||
B676065011DEBAE900D6B66C /* TermWindow.xib */,
|
||||
@ -269,6 +280,8 @@
|
||||
B612F46B12DD5E02005D1B77 /* Views */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B68E632812FF909C00EAFF5F /* ExampleView.h */,
|
||||
B68E632912FF909C00EAFF5F /* ExampleView.m */,
|
||||
B612F46C12DD5E02005D1B77 /* CurveView.h */,
|
||||
B612F46D12DD5E02005D1B77 /* CurveView.m */,
|
||||
B612F46E12DD5E02005D1B77 /* EmulatorView.h */,
|
||||
@ -280,6 +293,7 @@
|
||||
B66979CE11E6BCAE002ED475 /* images */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
B6801BD812EB549300B22E9E /* vt100-charset.png */,
|
||||
B67B3CE312B6FA040033AE07 /* a2-charset-40.png */,
|
||||
B67B3CE412B6FA040033AE07 /* a2-charset-80.png */,
|
||||
);
|
||||
@ -306,7 +320,7 @@
|
||||
name = 2Term;
|
||||
productInstallPath = "$(HOME)/Applications";
|
||||
productName = 2Term;
|
||||
productReference = 8D1107320486CEB800E47090 /* 2Term.app */;
|
||||
productReference = 8D1107320486CEB800E47090 /* TwoTerm.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
@ -343,6 +357,7 @@
|
||||
B61D0D5D125B740C001C713B /* NewTerminal.xib in Resources */,
|
||||
B67B3CE512B6FA040033AE07 /* a2-charset-40.png in Resources */,
|
||||
B67B3CE612B6FA040033AE07 /* a2-charset-80.png in Resources */,
|
||||
B6801BD912EB549300B22E9E /* vt100-charset.png in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -375,6 +390,8 @@
|
||||
B612F47112DD5E02005D1B77 /* EmulatorView.mm in Sources */,
|
||||
B612F47412DDEBA9005D1B77 /* Screen_obsolete.cpp in Sources */,
|
||||
B612F47512DDEBA9005D1B77 /* Screen_TextPort.cpp in Sources */,
|
||||
B627333B12E3FF5B00A14C94 /* ChildMonitor.m in Sources */,
|
||||
B68E632A12FF909D00EAFF5F /* ExampleView.m in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -401,6 +418,7 @@
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
B61D0D5C125B740C001C713B /* NewTerminal.xib */,
|
||||
B68E632B130990DD00EAFF5F /* en */,
|
||||
);
|
||||
name = NewTerminal.xib;
|
||||
sourceTree = "<group>";
|
||||
@ -427,9 +445,9 @@
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = TwoTerm_Prefix.pch;
|
||||
INFOPLIST_FILE = "TwoTerm-Info.plist";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
PRODUCT_NAME = 2Term;
|
||||
PRODUCT_NAME = TwoTerm;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -441,9 +459,9 @@
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = _Term_Prefix.pch;
|
||||
INFOPLIST_FILE = "TwoTerm-Info.plist";
|
||||
INFOPLIST_FILE = Info.plist;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
PRODUCT_NAME = 2Term;
|
||||
PRODUCT_NAME = TwoTerm;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
@ -456,7 +474,7 @@
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
ONLY_ACTIVE_ARCH = NO;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.6;
|
||||
};
|
||||
@ -470,6 +488,7 @@
|
||||
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = macosx10.6;
|
||||
};
|
||||
|
@ -20,6 +20,8 @@ extern "C" {
|
||||
extern NSString *kScanLines;
|
||||
extern NSString *kClass;
|
||||
|
||||
extern NSString *kContentFilters;
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -17,3 +17,5 @@ NSString *kBackgroundColor = @"Background Color";
|
||||
NSString *kScanLines = @"Scan Lines";
|
||||
|
||||
NSString *kClass = @"Class";
|
||||
|
||||
NSString *kContentFilters = @"Content Filters";
|
File diff suppressed because it is too large
Load Diff
@ -8,26 +8,57 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@class ExampleView;
|
||||
|
||||
@interface NewTerminalWindowController : NSWindowController <NSWindowDelegate> {
|
||||
@private
|
||||
|
||||
NSPopUpButton *_terminalTypeButton;
|
||||
NSButton *_scanLineButton;
|
||||
NSPopUpButton *_colorSchemeButton;
|
||||
|
||||
|
||||
NSColorWell *_foregroundColorControl;
|
||||
NSColorWell *_backgroundColorControl;
|
||||
|
||||
|
||||
NSButton *_effectsButton;
|
||||
NSSlider *_blurSlider;
|
||||
NSSlider *_lightenSlider;
|
||||
NSSlider *_darkenSlider;
|
||||
|
||||
|
||||
ExampleView *_exampleView;
|
||||
|
||||
BOOL _effectsEnabled;
|
||||
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) IBOutlet ExampleView *exampleView;
|
||||
|
||||
@property (nonatomic, retain) IBOutlet NSPopUpButton *terminalTypeButton;
|
||||
@property (nonatomic, retain) IBOutlet NSButton *scanLineButton;
|
||||
@property (nonatomic, retain) IBOutlet NSPopUpButton *colorSchemeButton;
|
||||
|
||||
|
||||
@property (nonatomic, retain) IBOutlet NSColorWell *foregroundColorControl;
|
||||
@property (nonatomic, retain) IBOutlet NSColorWell *backgroundColorControl;
|
||||
|
||||
@property (nonatomic, retain) IBOutlet NSButton *effectsButton;
|
||||
@property (nonatomic, retain) IBOutlet NSSlider *blurSlider;
|
||||
@property (nonatomic, retain) IBOutlet NSSlider *lightenSlider;
|
||||
@property (nonatomic, retain) IBOutlet NSSlider *darkenSlider;
|
||||
|
||||
@property (nonatomic, assign) BOOL effectsEnabled;
|
||||
|
||||
|
||||
|
||||
-(IBAction)cancelButton: (id)sender;
|
||||
-(IBAction)connectButton: (id)sender;
|
||||
|
||||
-(IBAction)colorChanged: (id)sender;
|
||||
-(IBAction)setColorScheme: (id)sender;
|
||||
|
||||
-(IBAction)filterParameterChanged: (id)sender;
|
||||
|
||||
-(NSMenu *)colorMenu;
|
||||
|
||||
@end
|
||||
|
@ -9,14 +9,31 @@
|
||||
#import "NewTerminalWindowController.h"
|
||||
#import "Emulator.h"
|
||||
#import "Defaults.h"
|
||||
#import "ExampleView.h"
|
||||
|
||||
@implementation NewTerminalWindowController
|
||||
|
||||
@synthesize exampleView = _exampleView;
|
||||
|
||||
@synthesize terminalTypeButton = _terminalTypeButton;
|
||||
@synthesize scanLineButton = _scanLineButton;
|
||||
@synthesize colorSchemeButton = _colorSchemeButton;
|
||||
|
||||
@synthesize effectsButton = _effectsButton;
|
||||
@synthesize foregroundColorControl = _foregroundColorControl;
|
||||
@synthesize backgroundColorControl = _backgroundColorControl;
|
||||
|
||||
@synthesize blurSlider = _blurSlider;
|
||||
@synthesize lightenSlider = _lightenSlider;
|
||||
@synthesize darkenSlider = _darkenSlider;
|
||||
|
||||
@synthesize effectsEnabled = _effectsEnabled;
|
||||
// colors
|
||||
enum {
|
||||
kCustom = 0,
|
||||
kGreenBlack,
|
||||
kWhiteBlue,
|
||||
kAmberBlack
|
||||
};
|
||||
|
||||
+(id)new
|
||||
{
|
||||
@ -29,9 +46,19 @@
|
||||
// Clean-up code here.
|
||||
|
||||
[_terminalTypeButton release];
|
||||
[_backgroundColorControl release];
|
||||
[_colorSchemeButton release];
|
||||
|
||||
|
||||
[_foregroundColorControl release];
|
||||
[_scanLineButton release];
|
||||
[_backgroundColorControl release];
|
||||
|
||||
|
||||
[_effectsButton release];
|
||||
[_blurSlider release];
|
||||
[_lightenSlider release];
|
||||
[_darkenSlider release];
|
||||
|
||||
[_exampleView release];
|
||||
|
||||
[super dealloc];
|
||||
}
|
||||
@ -40,12 +67,48 @@
|
||||
|
||||
[super windowDidLoad];
|
||||
|
||||
[self setEffectsEnabled: YES];
|
||||
|
||||
|
||||
[_terminalTypeButton setMenu: [EmulatorManager emulatorMenu]];
|
||||
|
||||
// set color schemes.
|
||||
[_colorSchemeButton setMenu: [self colorMenu]];
|
||||
|
||||
}
|
||||
|
||||
-(NSMenu *)colorMenu
|
||||
{
|
||||
NSMenuItem *item;
|
||||
|
||||
NSMenu *menu = [[NSMenu new] autorelease];
|
||||
|
||||
item = [[NSMenuItem new] autorelease];
|
||||
[item setTitle: @"Green Black"];
|
||||
[item setTag: kGreenBlack];
|
||||
[menu addItem: item];
|
||||
|
||||
item = [[NSMenuItem new] autorelease];
|
||||
[item setTitle: @"White Blue"];
|
||||
[item setTag: kWhiteBlue];
|
||||
[menu addItem: item];
|
||||
|
||||
item = [[NSMenuItem new] autorelease];
|
||||
[item setTitle: @"Amber Black"];
|
||||
[item setTag: kAmberBlack];
|
||||
[menu addItem: item];
|
||||
|
||||
|
||||
item = [[NSMenuItem new] autorelease];
|
||||
[item setTitle: @"Custom"];
|
||||
[item setTag: kCustom];
|
||||
[menu addItem: item];
|
||||
|
||||
return menu;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark IBActions
|
||||
|
||||
-(IBAction)cancelButton: (id)sender
|
||||
{
|
||||
@ -63,12 +126,16 @@
|
||||
if (klass)
|
||||
{
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:
|
||||
klass, kClass,
|
||||
[NSNumber numberWithBool: [_scanLineButton intValue]], kScanLines,
|
||||
[_foregroundColorControl color], kForegroundColor,
|
||||
[_backgroundColorControl color], kBackgroundColor,
|
||||
nil];
|
||||
NSMutableDictionary *userInfo = [NSMutableDictionary dictionaryWithCapacity: 5];
|
||||
|
||||
[userInfo setObject: klass forKey: kClass];
|
||||
[userInfo setObject: [_foregroundColorControl color] forKey: kForegroundColor];
|
||||
[userInfo setObject: [_backgroundColorControl color] forKey: kBackgroundColor];
|
||||
|
||||
if (_effectsEnabled)
|
||||
{
|
||||
[userInfo setObject: [_exampleView contentFilters] forKey: kContentFilters];
|
||||
}
|
||||
|
||||
[nc postNotificationName: kNotificationNewTerminal object: self userInfo: userInfo];
|
||||
|
||||
@ -79,12 +146,77 @@
|
||||
[[self window] performClose: self];
|
||||
}
|
||||
|
||||
-(IBAction)colorChanged:(id)sender
|
||||
{
|
||||
[_colorSchemeButton selectItemWithTag: kCustom];
|
||||
// redraw sample...
|
||||
}
|
||||
|
||||
-(IBAction)setColorScheme:(id)sender
|
||||
{
|
||||
switch ([_colorSchemeButton selectedTag])
|
||||
{
|
||||
case kGreenBlack:
|
||||
[_foregroundColorControl setColor: [NSColor greenColor]];
|
||||
[_backgroundColorControl setColor: [NSColor blackColor]];
|
||||
break;
|
||||
|
||||
case kWhiteBlue:
|
||||
[_foregroundColorControl setColor: [NSColor whiteColor]];
|
||||
[_backgroundColorControl setColor: [NSColor blueColor]];
|
||||
break;
|
||||
|
||||
case kAmberBlack:
|
||||
[_foregroundColorControl setColor: [NSColor orangeColor]];
|
||||
[_backgroundColorControl setColor: [NSColor blackColor]];
|
||||
break;
|
||||
|
||||
case kCustom:
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
[self filterParameterChanged: nil];
|
||||
}
|
||||
|
||||
|
||||
-(IBAction)filterParameterChanged: (id)sender
|
||||
{
|
||||
|
||||
[_exampleView setForegroundColor: [_foregroundColorControl color]];
|
||||
[_exampleView setColor: [_backgroundColorControl color]];
|
||||
|
||||
if (_effectsEnabled)
|
||||
{
|
||||
[_exampleView setBlur: [_blurSlider floatValue]];
|
||||
[_exampleView setLighten: [_lightenSlider floatValue]];
|
||||
[_exampleView setDarken: [_darkenSlider floatValue]];
|
||||
}
|
||||
else
|
||||
{
|
||||
[_exampleView setBlur: 0.0];
|
||||
[_exampleView setLighten: 0.0];
|
||||
[_exampleView setDarken: 0.0];
|
||||
}
|
||||
|
||||
[_exampleView updateEffects];
|
||||
[_exampleView setNeedsDisplay: YES];
|
||||
}
|
||||
|
||||
-(void)setEffectsEnabled:(BOOL)effectsEnabled
|
||||
{
|
||||
_effectsEnabled = effectsEnabled;
|
||||
[self filterParameterChanged: nil];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark NSWindowDelegate
|
||||
|
||||
-(void)windowWillClose:(NSNotification *)notification
|
||||
{
|
||||
[_foregroundColorControl deactivate];
|
||||
[_backgroundColorControl deactivate];
|
||||
|
||||
[self autorelease];
|
||||
}
|
||||
|
||||
|
@ -237,8 +237,16 @@
|
||||
[_emulatorView setEmulator: _emulator];
|
||||
[_emulatorView setForegroundColor: foregroundColor];
|
||||
[_emulatorView setBackgroundColor: backgroundColor];
|
||||
[_emulatorView setScanLines: scanLines];
|
||||
//[_emulatorView setScanLines: scanLines];
|
||||
|
||||
[_curveView setColor: backgroundColor];
|
||||
|
||||
o = [_parameters objectForKey: kContentFilters];
|
||||
if (o)
|
||||
{
|
||||
[_curveView setWantsLayer: YES];
|
||||
[_curveView setContentFilters: (NSArray *)o];
|
||||
}
|
||||
|
||||
//[_curveView initScanLines];
|
||||
//[_curveView setColor: [NSColor blueColor]];
|
||||
|
@ -13,6 +13,8 @@
|
||||
#import "Defaults.h"
|
||||
#import "VT52.h"
|
||||
|
||||
#import "ScanLineFilter.h"
|
||||
|
||||
@implementation TwoTermAppDelegate
|
||||
|
||||
@synthesize window;
|
||||
@ -24,12 +26,37 @@
|
||||
TermWindowController *controller;
|
||||
|
||||
|
||||
NSMutableArray *filters;
|
||||
NSDictionary *parameters;
|
||||
CIFilter *filter;
|
||||
|
||||
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[nc addObserver: self selector: @selector(newTerminal:) name: kNotificationNewTerminal object: nil];
|
||||
|
||||
|
||||
filters = [NSMutableArray arrayWithCapacity: 3];
|
||||
|
||||
|
||||
//add the scanlines
|
||||
|
||||
filter = [[ScanLineFilter new] autorelease];
|
||||
[filter setValue: [NSNumber numberWithFloat: .5] forKey: @"inputDarken"];
|
||||
[filter setValue: [NSNumber numberWithFloat: .02] forKey: @"inputLighten"];
|
||||
[filters addObject: filter];
|
||||
|
||||
//blur it a bit...
|
||||
|
||||
filter = [CIFilter filterWithName: @"CIGaussianBlur"];
|
||||
[filter setDefaults];
|
||||
[filter setValue: [NSNumber numberWithFloat: .33] forKey: @"inputRadius"];
|
||||
|
||||
[filters addObject: filter];
|
||||
|
||||
parameters = [NSDictionary dictionaryWithObject: filters forKey: kContentFilters];
|
||||
|
||||
controller = [TermWindowController new];
|
||||
[controller setParameters: parameters];
|
||||
[controller showWindow: nil];
|
||||
// this leak is ok.
|
||||
}
|
||||
|
@ -21,6 +21,10 @@
|
||||
return self;
|
||||
}
|
||||
|
||||
-(void)awakeFromNib
|
||||
{
|
||||
_color = [[NSColor blackColor] retain];
|
||||
}
|
||||
|
||||
|
||||
#define curveSize 4
|
||||
|
35
Views/ExampleView.h
Normal file
35
Views/ExampleView.h
Normal file
@ -0,0 +1,35 @@
|
||||
//
|
||||
// ExampleView.h
|
||||
// 2Term
|
||||
//
|
||||
// Created by Kelvin Sherlock on 2/6/2011.
|
||||
// Copyright 2011 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
#import "CurveView.h"
|
||||
@class CharacterGenerator;
|
||||
|
||||
@interface ExampleView : CurveView {
|
||||
|
||||
NSColor *_foregroundColor;
|
||||
|
||||
CGFloat _blur;
|
||||
CGFloat _lighten;
|
||||
CGFloat _darken;
|
||||
|
||||
CharacterGenerator *_charGenerator;
|
||||
|
||||
}
|
||||
|
||||
@property (nonatomic, retain) NSColor *foregroundColor;
|
||||
@property (nonatomic, assign) CGFloat lighten;
|
||||
@property (nonatomic, assign) CGFloat darken;
|
||||
@property (nonatomic, assign) CGFloat blur;
|
||||
|
||||
|
||||
-(void)updateEffects;
|
||||
|
||||
@end
|
||||
|
105
Views/ExampleView.m
Normal file
105
Views/ExampleView.m
Normal file
@ -0,0 +1,105 @@
|
||||
//
|
||||
// ExampleView.m
|
||||
// 2Term
|
||||
//
|
||||
// Created by Kelvin Sherlock on 2/6/2011.
|
||||
// Copyright 2011 __MyCompanyName__. All rights reserved.
|
||||
//
|
||||
|
||||
#import "ExampleView.h"
|
||||
|
||||
#import "ScanLineFilter.h"
|
||||
#import "CharacterGenerator.h"
|
||||
|
||||
@implementation ExampleView
|
||||
|
||||
@synthesize lighten = _lighten;
|
||||
@synthesize darken = _darken;
|
||||
@synthesize blur = _blur;
|
||||
@synthesize foregroundColor = _foregroundColor;
|
||||
|
||||
|
||||
-(void)awakeFromNib
|
||||
{
|
||||
[super awakeFromNib];
|
||||
|
||||
_foregroundColor = [[NSColor greenColor] retain];
|
||||
_charGenerator = [[CharacterGenerator generator] retain];
|
||||
[self setWantsLayer: YES];
|
||||
}
|
||||
|
||||
- (void)dealloc
|
||||
{
|
||||
[_foregroundColor release];
|
||||
[_charGenerator release];
|
||||
[super dealloc];
|
||||
|
||||
}
|
||||
|
||||
-(BOOL)isFlipped
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
-(void)drawRect:(NSRect)dirtyRect
|
||||
{
|
||||
CGFloat paddingLeft = 10.0;
|
||||
CGFloat paddingTop = 10.0;
|
||||
|
||||
const char *string = "Two Term";
|
||||
|
||||
NSSize size = [_charGenerator characterSize];
|
||||
|
||||
[super drawRect: dirtyRect];
|
||||
|
||||
[_foregroundColor set];
|
||||
|
||||
for (unsigned i = 0; string[i]; ++i)
|
||||
{
|
||||
[_charGenerator drawCharacter: string[i] atPoint: NSMakePoint( i * size.width + paddingLeft, paddingTop)];
|
||||
}
|
||||
|
||||
// draw inversed on the next line.
|
||||
|
||||
for (unsigned i = 0; string[i]; ++i)
|
||||
{
|
||||
[_foregroundColor set];
|
||||
NSRectFill(NSMakeRect( i * size.width + paddingLeft, size.height + paddingTop, size.width, size.height));
|
||||
|
||||
[_color set];
|
||||
[_charGenerator drawCharacter: string[i] atPoint: NSMakePoint( i * size.width + paddingLeft, size.height + paddingTop)];
|
||||
}
|
||||
}
|
||||
|
||||
-(void)updateEffects
|
||||
{
|
||||
|
||||
NSMutableArray *filters;
|
||||
CIFilter *filter;
|
||||
|
||||
filters = [NSMutableArray arrayWithCapacity: 3];
|
||||
|
||||
|
||||
//add the scanlines
|
||||
|
||||
filter = [[ScanLineFilter new] autorelease];
|
||||
[filter setValue: [NSNumber numberWithFloat: _darken] forKey: @"inputDarken"];
|
||||
[filter setValue: [NSNumber numberWithFloat: _lighten] forKey: @"inputLighten"];
|
||||
[filters addObject: filter];
|
||||
|
||||
//blur it a bit...
|
||||
|
||||
filter = [CIFilter filterWithName: @"CIGaussianBlur"];
|
||||
[filter setDefaults];
|
||||
[filter setValue: [NSNumber numberWithFloat: _blur] forKey: @"inputRadius"];
|
||||
|
||||
[filters addObject: filter];
|
||||
|
||||
|
||||
|
||||
[self setContentFilters: filters];
|
||||
|
||||
|
||||
}
|
||||
|
||||
@end
|
Loading…
Reference in New Issue
Block a user