Change audio source enable button to an on/off toggle with color.

This commit is contained in:
Zakk 2015-02-18 05:26:06 -05:00
parent a84cba9733
commit 7e3cb5682e
7 changed files with 200 additions and 16 deletions

View file

@ -118,6 +118,8 @@
3481F30619B48C7C00CC76D8 /* SourceLayout+ScriptingAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3481F30519B48C7C00CC76D8 /* SourceLayout+ScriptingAdditions.m */; };
348AC06B19B406910064F02D /* SourceLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 348AC06A19B406910064F02D /* SourceLayout.m */; };
348AC06C19B406910064F02D /* SourceLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = 348AC06A19B406910064F02D /* SourceLayout.m */; };
3498D94A1A94685000906532 /* CSAudioSwitchCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 3498D9491A94685000906532 /* CSAudioSwitchCell.m */; };
3498D94F1A9472BD00906532 /* CSAudioSwitchControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 3498D94E1A9472BD00906532 /* CSAudioSwitchControl.m */; };
34A64A2F165EFE4C00A68428 /* PreviewView.m in Sources */ = {isa = PBXBuildFile; fileRef = 34A64A2E165EFE4B00A68428 /* PreviewView.m */; };
34A64A35165F047900A68428 /* CapturePreview.xib in Resources */ = {isa = PBXBuildFile; fileRef = 34A64A34165F047900A68428 /* CapturePreview.xib */; };
34A64A37165F208800A68428 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 34A64A36165F208800A68428 /* QuartzCore.framework */; };
@ -510,6 +512,10 @@
3481F30519B48C7C00CC76D8 /* SourceLayout+ScriptingAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "SourceLayout+ScriptingAdditions.m"; path = "ScriptingAddditions/SourceLayout+ScriptingAdditions.m"; sourceTree = "<group>"; };
348AC06919B406910064F02D /* SourceLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceLayout.h; sourceTree = "<group>"; };
348AC06A19B406910064F02D /* SourceLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SourceLayout.m; sourceTree = "<group>"; };
3498D9481A94685000906532 /* CSAudioSwitchCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSAudioSwitchCell.h; sourceTree = "<group>"; };
3498D9491A94685000906532 /* CSAudioSwitchCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CSAudioSwitchCell.m; sourceTree = "<group>"; };
3498D94D1A9472BD00906532 /* CSAudioSwitchControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CSAudioSwitchControl.h; path = Interface/CSAudioSwitchControl.h; sourceTree = "<group>"; };
3498D94E1A9472BD00906532 /* CSAudioSwitchControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = CSAudioSwitchControl.m; path = Interface/CSAudioSwitchControl.m; sourceTree = "<group>"; };
34A64A2D165EFE4B00A68428 /* PreviewView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PreviewView.h; sourceTree = "<group>"; };
34A64A2E165EFE4B00A68428 /* PreviewView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreviewView.m; sourceTree = "<group>"; };
34A64A34165F047900A68428 /* CapturePreview.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = CapturePreview.xib; path = Interface/CapturePreview.xib; sourceTree = "<group>"; };
@ -853,6 +859,10 @@
34D4351A198BE3B700266169 /* NewLayoutPanel.xib */,
340D8C961959C7C100BE5144 /* CompressionSettingsPanel.xib */,
34ABEF3B17C0C2CB00AA5E62 /* advancedPrefPanel.xib */,
3498D9481A94685000906532 /* CSAudioSwitchCell.h */,
3498D9491A94685000906532 /* CSAudioSwitchCell.m */,
3498D94D1A9472BD00906532 /* CSAudioSwitchControl.h */,
3498D94E1A9472BD00906532 /* CSAudioSwitchControl.m */,
);
name = Interface;
sourceTree = "<group>";
@ -1236,6 +1246,14 @@
TargetAttributes = {
340FE49C15F3417E00E4CE4E = {
DevelopmentTeam = L3JLUY4S5E;
SystemCapabilities = {
com.apple.ApplicationGroups.Mac = {
enabled = 0;
};
com.apple.InAppPurchase = {
enabled = 0;
};
};
};
};
};
@ -1523,6 +1541,7 @@
347277FD1A5A2758008801A9 /* CSIOSurfaceLayer.m in Sources */,
345F8B251A14E6A0009A81E3 /* CAMultiAudioNode.m in Sources */,
342346AA15F59A8500C8C77E /* AVFAudioCapture.m in Sources */,
3498D94A1A94685000906532 /* CSAudioSwitchCell.m in Sources */,
345F8B051A1060D6009A81E3 /* CSAacEncoder.m in Sources */,
342346BE15F6103D00C8C77E /* FFMpegTask.m in Sources */,
345F8B3D1A15F3BD009A81E3 /* CAMultiAudioPCM.m in Sources */,
@ -1541,6 +1560,7 @@
34A64A2F165EFE4C00A68428 /* PreviewView.m in Sources */,
345F8B691A16C348009A81E3 /* CAMultiAudioGraph.m in Sources */,
3431FFE119786502000965FE /* InputSource.m in Sources */,
3498D94F1A9472BD00906532 /* CSAudioSwitchControl.m in Sources */,
34F5141216FD6E4F00BA894D /* x264Compressor.m in Sources */,
34576C7819AFCA1B007BAD90 /* CSPluginLoader.m in Sources */,
34FDD6F21A215268009A7413 /* CSPluginServices.m in Sources */,
@ -1725,8 +1745,9 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CODE_SIGN_IDENTITY = "Developer ID Application";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "Mac Developer";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
FRAMEWORK_SEARCH_PATHS = (
"$(inherited)",
@ -1760,8 +1781,9 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_64_BIT)";
CODE_SIGN_IDENTITY = "Developer ID Application";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Developer ID Application";
CODE_SIGN_ENTITLEMENTS = "";
CODE_SIGN_IDENTITY = "Mac Developer";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Mac Developer";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = (

View file

@ -49,7 +49,7 @@
_enabled = enabled;
if (enabled)
{
newColor = [NSColor redColor];
newColor = [NSColor greenColor];
} else {
newColor = [NSColor blackColor];
}

View file

@ -0,0 +1,14 @@
//
// CSAudioSwitchControl.h
// CocoaSplit
//
// Created by Zakk on 2/18/15.
// Copyright (c) 2015 Zakk. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface CSAudioSwitchCell: NSSegmentedCell
@end

View file

@ -0,0 +1,75 @@
//
// CSAudioSwitchControl.m
// CocoaSplit
//
// Created by Zakk on 2/18/15.
// Copyright (c) 2015 Zakk. All rights reserved.
//
#import "CSAudioSwitchCell.h"
@implementation CSAudioSwitchCell
-(NSBackgroundStyle)interiorBackgroundStyleForSegment:(NSInteger)segment
{
return NSBackgroundStyleRaised;
}
/*
-(void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView:(NSView *)controlView mouseIsUp:(BOOL)flag
{
if (flag == YES)
{
[self setSelected:YES forSegment:!self.selectedSegment];
[self send]
}
}
*/
-(void)drawSegment:(NSInteger)segment inFrame:(NSRect)frame withView:(NSView *)controlView
{
NSColor *color;
if (self.selectedSegment == 0)
{
color = [NSColor greenColor];
} else {
color = [NSColor grayColor];
}
switch (segment) {
case 0:
if (self.selectedSegment == segment)
{
[self setLabel:@"On" forSegment:0];
} else {
[self setLabel:@"" forSegment:0];
}
break;
case 1:
if (self.selectedSegment == segment)
{
[self setLabel:@"Off" forSegment:1];
} else {
[self setLabel:@"" forSegment:1];
}
break;
default:
break;
}
if (color)
{
[color setFill];
NSRectFill(frame);
}
[super drawSegment:segment inFrame:frame withView:controlView];
}
@end

View file

@ -0,0 +1,13 @@
//
// CSAudioSwitchControl.h
// CocoaSplit
//
// Created by Zakk on 2/18/15.
// Copyright (c) 2015 Zakk. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface CSAudioSwitchControl : NSSegmentedControl
@end

View file

@ -0,0 +1,40 @@
//
// CSAudioSwitchControl.m
// CocoaSplit
//
// Created by Zakk on 2/18/15.
// Copyright (c) 2015 Zakk. All rights reserved.
//
#import "CSAudioSwitchControl.h"
@implementation CSAudioSwitchControl
-(void)mouseDown:(NSEvent *)theEvent
{
NSInteger newSegment = !self.selectedSegment;
switch (newSegment) {
case 0:
[self setLabel:@"On" forSegment:0];
[self setLabel:@"" forSegment:1];
break;
case 1:
[self setLabel:@"" forSegment:0];
[self setLabel:@"Off" forSegment:1];
break;
default:
break;
}
[self setSelectedSegment:!self.selectedSegment];
[self sendAction:[self action] to:[self target]];
}
- (void)drawRect:(NSRect)dirtyRect {
[super drawRect:dirtyRect];
// Drawing code here.
}
@end

View file

@ -737,7 +737,7 @@
<constraint firstItem="KDH-Gg-3ob" firstAttribute="baseline" secondItem="mmz-0q-83I" secondAttribute="baseline" id="yw0-0m-ikL"/>
</constraints>
</customView>
<customView misplaced="YES" translatesAutoresizingMaskIntoConstraints="NO" id="MvM-Ze-Mhu">
<customView translatesAutoresizingMaskIntoConstraints="NO" id="MvM-Ze-Mhu">
<rect key="frame" x="359" y="155" width="119" height="34"/>
<subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="3nh-Gb-0rO">
@ -1594,7 +1594,7 @@
<constraint firstAttribute="bottom" secondItem="2368" secondAttribute="bottom" constant="29" id="hMA-Uw-5PO"/>
</constraints>
</view>
<point key="canvasLocation" x="290.5" y="212"/>
<point key="canvasLocation" x="358.5" y="220"/>
</window>
<dictionaryController objectClassName="_NSControllerKeyValuePair" id="gSI-N4-DsK" userLabel="CompressorDictionaryController">
<connections>
@ -1745,7 +1745,7 @@ Gw
</connections>
</collectionViewItem>
<view id="ZmA-40-k3N">
<rect key="frame" x="0.0" y="0.0" width="63" height="299"/>
<rect key="frame" x="0.0" y="0.0" width="63" height="307"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" setsMaxLayoutWidthAtFirstLayout="YES" translatesAutoresizingMaskIntoConstraints="NO" id="QXC-Xu-cG7">
@ -1767,18 +1767,38 @@ Gw
<binding destination="93b-Or-H22" name="value" keyPath="representedObject.volume" id="aQo-34-mNT"/>
</connections>
</slider>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="YUv-y3-Hba">
<rect key="frame" x="10" y="7" width="34" height="17"/>
<buttonCell key="cell" type="roundRect" title="On" alternateTitle="Off" bezelStyle="roundedRect" alignment="center" controlSize="mini" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="tgQ-KW-dJd">
<behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
<segmentedControl verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="XXK-WA-B7U" customClass="CSAudioSwitchControl">
<rect key="frame" x="6" y="5" width="43" height="19"/>
<animations>
<caTransition key="subviews">
<mutableData key="keyedArchiveRepresentation">
YnBsaXN0MDDUAQIDBAUGJCVYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoKkHCBES
EwsKGR9VJG51bGzUCQoLDA0ODxBWJGNsYXNzVHR5cGVXc3VidHlwZV8QEl9fQ0FDb2RpbmdDb250ZW50
c4AIgAOAAoAEWWZyb21SaWdodFRwdXNo0hQJFRhaTlMub2JqZWN0c6IWF4AFgAaAB9IaGxwdWiRjbGFz
c25hbWVYJGNsYXNzZXNXTlNBcnJheaIcHlhOU09iamVjdNIaGyAhXENBVHJhbnNpdGlvbqMiIx5cQ0FU
cmFuc2l0aW9uW0NBQW5pbWF0aW9uXxAPTlNLZXllZEFyY2hpdmVy0SYnVHJvb3SAAQAIABEAGgAjAC0A
MgA3AEEARwBQAFcAXABkAHkAewB9AH8AgQCLAJAAlQCgAKMApQCnAKkArgC5AMIAygDNANYA2wDoAOwA
+QEFARcBGgEfAAAAAAAAAgEAAAAAAAAAKAAAAAAAAAAAAAAAAAAAASE
</mutableData>
</caTransition>
</animations>
<segmentedCell key="cell" controlSize="mini" continuous="YES" borderStyle="border" alignment="left" style="smallSquare" trackingMode="selectOne" id="z74-vM-Tm5" customClass="CSAudioSwitchCell">
<font key="font" metaFont="miniSystem"/>
</buttonCell>
<segments>
<segment label="On" width="20" tag="1"/>
<segment label="Off" width="20"/>
</segments>
</segmentedCell>
<connections>
<binding destination="93b-Or-H22" name="value" keyPath="representedObject.enabled" id="KFf-cx-Odc"/>
<binding destination="93b-Or-H22" name="selectedTag" keyPath="representedObject.enabled" id="DXk-50-uzh">
<dictionary key="options">
<bool key="NSValidatesImmediately" value="YES"/>
</dictionary>
</binding>
</connections>
</button>
</segmentedControl>
</subviews>
<point key="canvasLocation" x="847.5" y="189.5"/>
<point key="canvasLocation" x="885.5" y="194.5"/>
</view>
<view id="bRh-Lo-mbG">
<rect key="frame" x="0.0" y="0.0" width="100" height="100"/>