MIDI page now displays the filename of the currently selected SoundFont, or None if none has been loaded yet

CQTexperiment
Chris Moeller 2013-10-17 20:46:11 -07:00
parent 53a52835dd
commit de5fe2857f
5 changed files with 85 additions and 2 deletions

View File

@ -453,7 +453,7 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button verticalHuggingPriority="750" id="SBO-WF-DVS" userLabel="Push Button - Select a SoundFont">
<rect key="frame" x="156" y="10" width="160" height="32"/>
<rect key="frame" x="14" y="10" width="160" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="push" title="Select a SoundFont" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="yeL-9c-lFq" userLabel="Button Cell - Select a SoundFont">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
@ -463,6 +463,32 @@
<action selector="setSoundFont:" target="i5B-ga-Atm" id="b2t-MX-dua"/>
</connections>
</button>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="FRC-Dh-BS2" userLabel="Text Field - Selected:">
<rect key="frame" x="173" y="19" width="61" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Selected:" id="KJz-qS-IcO" userLabel="Text Field Cell - Selected">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="cZr-2d-6cv">
<rect key="frame" x="236" y="19" width="220" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Label" id="ECB-P0-pve">
<font key="font" metaFont="system"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
<connections>
<binding destination="52" name="value" keyPath="values.soundFontPath" id="wNb-bg-cgq">
<dictionary key="options">
<string key="NSNullPlaceholder">None</string>
<string key="NSValueTransformerName">PathToFileTransformer</string>
</dictionary>
</binding>
</connections>
</textFieldCell>
</textField>
</subviews>
</customView>
</objects>

View File

@ -31,6 +31,7 @@
83F27E6E1810DD3A00CEF538 /* midi@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83F27E681810DD3A00CEF538 /* midi@2x.png */; };
83F27E6F1810DD3A00CEF538 /* playlist@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83F27E691810DD3A00CEF538 /* playlist@2x.png */; };
83F27E701810DD3A00CEF538 /* updates@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 83F27E6A1810DD3A00CEF538 /* updates@2x.png */; };
83F27E741810E45D00CEF538 /* PathToFileTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 83F27E731810E45D00CEF538 /* PathToFileTransformer.m */; };
8D5B49B4048680CD000E48DA /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7ADFEA557BF11CA2CBB /* Cocoa.framework */; };
8E07AA880AAC8EA200A4B32F /* HotKeyPane.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E07AA810AAC8EA200A4B32F /* HotKeyPane.m */; };
8E07AA890AAC8EA200A4B32F /* GeneralPreferencePane.m in Sources */ = {isa = PBXBuildFile; fileRef = 8E07AA830AAC8EA200A4B32F /* GeneralPreferencePane.m */; };
@ -108,6 +109,8 @@
83F27E681810DD3A00CEF538 /* midi@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "midi@2x.png"; path = "Icons/midi@2x.png"; sourceTree = "<group>"; };
83F27E691810DD3A00CEF538 /* playlist@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "playlist@2x.png"; path = "Icons/playlist@2x.png"; sourceTree = "<group>"; };
83F27E6A1810DD3A00CEF538 /* updates@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "updates@2x.png"; path = "Icons/updates@2x.png"; sourceTree = "<group>"; };
83F27E721810E45D00CEF538 /* PathToFileTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PathToFileTransformer.h; sourceTree = "<group>"; };
83F27E731810E45D00CEF538 /* PathToFileTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PathToFileTransformer.m; sourceTree = "<group>"; };
8D5B49B6048680CD000E48DA /* General.preferencePane */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = General.preferencePane; sourceTree = BUILT_PRODUCTS_DIR; };
8D5B49B7048680CD000E48DA /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8E07AA800AAC8EA200A4B32F /* HotKeyPane.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HotKeyPane.h; sourceTree = "<group>"; };
@ -175,6 +178,7 @@
08FB77AFFE84173DC02AAC07 /* Classes */ = {
isa = PBXGroup;
children = (
83F27E711810E41A00CEF538 /* Transformers */,
8384913618081ECB00E7332D /* Logging.h */,
17D503410ABDB1660022D1E8 /* Custom */,
17D5033F0ABDB1570022D1E8 /* Panes */,
@ -261,6 +265,15 @@
name = Products;
sourceTree = "<group>";
};
83F27E711810E41A00CEF538 /* Transformers */ = {
isa = PBXGroup;
children = (
83F27E721810E45D00CEF538 /* PathToFileTransformer.h */,
83F27E731810E45D00CEF538 /* PathToFileTransformer.m */,
);
name = Transformers;
sourceTree = "<group>";
};
8E07ABD90AAC95AF00A4B32F /* Icons */ = {
isa = PBXGroup;
children = (
@ -390,6 +403,7 @@
files = (
83B06729180D85B8008E3612 /* MIDIPane.m in Sources */,
8E07AA880AAC8EA200A4B32F /* HotKeyPane.m in Sources */,
83F27E741810E45D00CEF538 /* PathToFileTransformer.m in Sources */,
8E07AA890AAC8EA200A4B32F /* GeneralPreferencePane.m in Sources */,
8E07AA8A0AAC8EA200A4B32F /* GeneralPreferencesPlugin.m in Sources */,
8E6C13A00AACBAB500819171 /* HotKeyControl.m in Sources */,

View File

@ -7,15 +7,23 @@
//
#import "GeneralPreferencesPlugin.h"
#import "PathToFileTransformer.h"
@implementation GeneralPreferencesPlugin
+ (void)initialize
{
NSValueTransformer *pathToFileTransformer = [[[PathToFileTransformer alloc] init]autorelease];
[NSValueTransformer setValueTransformer:pathToFileTransformer
forName:@"PathToFileTransformer"];
}
+ (NSArray *)preferencePanes
{
GeneralPreferencesPlugin *plugin = [[[GeneralPreferencesPlugin alloc] init] autorelease];
[NSBundle loadNibNamed:@"Preferences" owner:plugin];
return [NSArray arrayWithObjects:
return [NSArray arrayWithObjects:
[plugin playlistPane],
[plugin hotKeyPane],
[plugin remotePane],

View File

@ -0,0 +1,13 @@
//
// PathToFileTransformer.h
// General
//
// Created by Christopher Snowhill on 10/17/13.
//
//
#import <Foundation/Foundation.h>
@interface PathToFileTransformer : NSValueTransformer
@end

View File

@ -0,0 +1,22 @@
//
// PathToFileTransformer.m
// General
//
// Created by Christopher Snowhill on 10/17/13.
//
//
#import "PathToFileTransformer.h"
@implementation PathToFileTransformer
+ (Class)transformedValueClass { return [NSString class]; }
+ (BOOL)allowsReverseTransformation { return NO; }
// Convert from string to NSURL
- (id)transformedValue:(id)value {
if (value == nil) return nil;
return [value lastPathComponent];
}
@end