borderless window

git-svn-id: svn://qnap.local/TwoTerm/branches/frameless@2338 5590a31f-7b70-45f8-8c82-aa3a8e5f4507
This commit is contained in:
Kelvin Sherlock 2011-11-26 17:04:20 +00:00
parent 3a137ea153
commit 741dfb95c6
7 changed files with 310 additions and 52 deletions

View File

@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">10J567</string>
<string key="IBDocument.InterfaceBuilderVersion">1278</string>
<string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">462.00</string>
<int key="IBDocument.SystemTarget">1070</int>
<string key="IBDocument.SystemVersion">11C74</string>
<string key="IBDocument.InterfaceBuilderVersion">1938</string>
<string key="IBDocument.AppKitVersion">1138.23</string>
<string key="IBDocument.HIToolboxVersion">567.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">1278</string>
<string key="NS.object.0">1938</string>
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -22,11 +22,8 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="dict.values" ref="0"/>
<string key="NS.key.0">PluginDependencyRecalculationVersion</string>
<integer value="1" key="NS.object.0"/>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -40,14 +37,15 @@
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSWindowTemplate" id="1005">
<int key="NSWindowStyleMask">271</int>
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{158, 575}, {620, 444}}</string>
<string key="NSWindowRect">{{158, 575}, {600, 424}}</string>
<int key="NSWTFlags">539492352</int>
<string key="NSWindowTitle">Two Term [VT52]</string>
<string key="NSWindowClass">NSWindow</string>
<string key="NSWindowClass">EmulatorWindow</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMinSize">{620, 444}</string>
<nil key="NSUserInterfaceItemIdentifier"/>
<string key="NSWindowContentMinSize">{600, 424}</string>
<object class="NSView" key="NSWindowView" id="1006">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
@ -61,27 +59,29 @@
<object class="NSCustomView" id="59249513">
<reference key="NSNextResponder" ref="1067446494"/>
<int key="NSvFlags">274</int>
<string key="NSFrame">{{10, 10}, {560, 384}}</string>
<string key="NSFrame">{{10, 10}, {580, 404}}</string>
<reference key="NSSuperview" ref="1067446494"/>
<reference key="NSWindow"/>
<string key="NSClassName">EmulatorView</string>
</object>
</object>
<string key="NSFrame">{{20, 20}, {580, 404}}</string>
<string key="NSFrameSize">{600, 424}</string>
<reference key="NSSuperview" ref="1006"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="59249513"/>
<string key="NSClassName">CurveView</string>
</object>
</object>
<string key="NSFrame">{{7, 11}, {620, 444}}</string>
<string key="NSFrameSize">{600, 424}</string>
<reference key="NSSuperview"/>
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1067446494"/>
<reference key="NSNextKeyView"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1178}}</string>
<string key="NSMinSize">{620, 466}</string>
<string key="NSMaxSize">{1e+13, 1e+13}</string>
<string key="NSMinSize">{600, 446}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<int key="NSWindowCollectionBehavior">128</int>
<bool key="NSWindowIsRestorable">YES</bool>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
@ -95,6 +95,22 @@
</object>
<int key="connectionID">3</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">curveView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1067446494"/>
</object>
<int key="connectionID">13</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">emulatorView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="59249513"/>
</object>
<int key="connectionID">14</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
@ -123,29 +139,15 @@
</object>
<int key="connectionID">12</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">curveView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1067446494"/>
</object>
<int key="connectionID">13</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">emulatorView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="59249513"/>
</object>
<int key="connectionID">14</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<object class="NSArray" key="object" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
@ -206,24 +208,26 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>1.IBEditorWindowLastContentRect</string>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>1.IBPluginDependency</string>
<string>1.IBWindowTemplateEditedContentRect</string>
<string>1.NSWindowTemplate.visibleAtLaunch</string>
<string>1.WindowOrigin</string>
<string>1.editorWindowContentRectSynchronizationRect</string>
<string>2.CustomClassName</string>
<string>2.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
<string>9.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{{428, 414}, {620, 444}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{428, 414}, {620, 444}}</string>
<boolean value="NO"/>
<string>{196, 240}</string>
<string>{{202, 428}, {480, 270}}</string>
<string>TermContentView</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@ -241,11 +245,19 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">14</int>
<int key="maxID">16</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ChildMonitor</string>
<string key="superclassName">NSThread</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/ChildMonitor.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">CurveView</string>
<string key="superclassName">NSView</string>
@ -294,6 +306,22 @@
<string key="minorKey">./Classes/EmulatorView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">EmulatorWindow</string>
<string key="superclassName">NSWindow</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/EmulatorWindow.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">TermContentView</string>
<string key="superclassName">CurveView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">./Classes/TermContentView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">TermWindowController</string>
<string key="superclassName">NSWindowController</string>
@ -301,11 +329,13 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>childMonitor</string>
<string>curveView</string>
<string>emulatorView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ChildMonitor</string>
<string>CurveView</string>
<string>EmulatorView</string>
</object>
@ -314,11 +344,16 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>childMonitor</string>
<string>curveView</string>
<string>emulatorView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">childMonitor</string>
<string key="candidateClassName">ChildMonitor</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">curveView</string>
<string key="candidateClassName">CurveView</string>
@ -338,10 +373,6 @@
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1060" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>

View File

@ -209,8 +209,12 @@
window = [self window];
// resize in 2.0 he ight increments to prevent jittering the scan lines.
[window setResizeIncrements: NSMakeSize(1.0, 2.0)];
//[(CurveView *)[window contentView] setColor: [NSColor clearColor]];
//[window setContentView: _curveView];
// resize in 2.0 height increments to prevent jittering the scan lines.
//[window setResizeIncrements: NSMakeSize(1.0, 2.0)];
klass = [_parameters objectForKey: kClass];
@ -244,10 +248,38 @@
o = [_parameters objectForKey: kContentFilters];
if (o)
{
//CALayer *layer;
[_curveView setWantsLayer: YES];
/*
CGColorRef color;
color = CGColorCreateGenericRGB(1.0, 0.0, 0.0, 1.0);
layer = [_curveView layer];
[layer setCornerRadius: 20.0];
[layer setBorderWidth: 4.0];
[layer setBorderColor: color];
[layer setBackgroundColor: color];
[layer setBackgroundFilters: (NSArray *)o];
CGColorRelease(color);
*/
[_curveView setContentFilters: (NSArray *)o];
}
/*
NSShadow *shadow;
shadow = [[NSShadow alloc] init];
[shadow setShadowColor:[NSColor blackColor]];
[shadow setShadowOffset: NSZeroSize];
[shadow setShadowBlurRadius: 10.0];
[_curveView setShadow: shadow];
[shadow release];
*/
//[_curveView initScanLines];
//[_curveView setColor: [NSColor blueColor]];

View File

@ -260,7 +260,11 @@
userInfo: nil
repeats: YES] retain];
/*
[[self window] display];
[[self window] setHasShadow: NO];
[[self window] setHasShadow: YES];
*/
}
-(void)viewDidMoveToSuperview

15
Views/EmulatorWindow.h Normal file
View File

@ -0,0 +1,15 @@
//
// EmulatorWindow.h
// 2Term
//
// Created by Kelvin Sherlock on 11/25/2011.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#import <AppKit/AppKit.h>
@interface EmulatorWindow : NSWindow
{
}
@end

85
Views/EmulatorWindow.m Normal file
View File

@ -0,0 +1,85 @@
//
// EmulatorWindow.m
// 2Term
//
// Created by Kelvin Sherlock on 11/25/2011.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#import "EmulatorWindow.h"
@implementation EmulatorWindow
-(id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)aStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag
{
if ((self = [super initWithContentRect: contentRect
styleMask: NSBorderlessWindowMask
backing: bufferingType
defer: flag]))
{
[self setOpaque: NO];
[self setAlphaValue: 1.0];
// resize in 2.0 height increments to prevent jittering the scan lines.
[self setResizeIncrements: NSMakeSize(1.0, 2.0)];
[self setMovableByWindowBackground: YES];
//[self setBackgroundColor: [NSColor clearColor]];
//[self setHasShadow: NO];
//[self setHasShadow: YES];
}
return self;
}
-(id)initWithContentRect:(NSRect)contentRect
styleMask:(NSUInteger)aStyle
backing:(NSBackingStoreType)bufferingType
defer:(BOOL)flag
screen:(NSScreen *)screen
{
if ((self = [super initWithContentRect: contentRect
styleMask: NSBorderlessWindowMask
backing: bufferingType
defer: flag
screen: screen]))
{
[self setOpaque: NO];
[self setAlphaValue: 1.0];
[self setResizeIncrements: NSMakeSize(1.0, 2.0)];
[self setMovableByWindowBackground: YES];
//[self setBackgroundColor: [NSColor clearColor]];
//[self setHasShadow: NO];
//[self setHasShadow: YES];
}
return self;
}
-(void)awakeFromNib
{
//[self setHasShadow: YES];
}
-(BOOL)canBecomeKeyWindow {
return YES;
}
-(BOOL)canBecomeMainWindow {
return YES;
}
@end

16
Views/TermContentView.h Normal file
View File

@ -0,0 +1,16 @@
//
// TermContentView.h
// 2Term
//
// Created by Kelvin Sherlock on 11/26/2011.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#import "CurveView.h"
@interface TermContentView : CurveView
{
NSTrackingArea *_trackingArea;
}
@end

75
Views/TermContentView.m Normal file
View File

@ -0,0 +1,75 @@
//
// TermContentView.m
// 2Term
//
// Created by Kelvin Sherlock on 11/26/2011.
// Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//
#import "TermContentView.h"
@implementation TermContentView
-(void)createTrackingArea
{
NSRect rect;
NSRect bounds;
if (_trackingArea)
{
[self removeTrackingArea: _trackingArea];
[_trackingArea release];
_trackingArea = nil;
}
bounds = [self bounds];
rect = NSMakeRect(0, bounds.size.height - 20, bounds.size.width, 20);
_trackingArea = [[NSTrackingArea alloc] initWithRect: rect
options: NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways
owner: self
userInfo:nil];
[self addTrackingArea: _trackingArea];
}
-(void)awakeFromNib
{
[super awakeFromNib];
[self createTrackingArea];
//[self setWantsLayer: YES];
}
-(void)updateTrackingAreas
{
[self createTrackingArea];
}
-(void)dealloc
{
[_trackingArea release];
[super dealloc];
}
-(void)mouseEntered:(NSEvent *)theEvent
{
NSLog(@"%s", sel_getName(_cmd));
// animate title bar in.
}
-(void)mouseExited:(NSEvent *)theEvent
{
NSLog(@"%s", sel_getName(_cmd));
// animate title bar out.
}
@end