diff options
| author | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-08-22 23:53:37 +0000 |
|---|---|---|
| committer | SND\MaddTheSane_cp <SND\MaddTheSane_cp@e17a0e51-4ae3-4d35-97c3-1a29b211df97> | 2013-08-22 23:53:37 +0000 |
| commit | 531ad373b2c22e00a341a6635023cf8949571bd5 (patch) | |
| tree | 029961f0aa19ec396f6d7cc09f3ff93987c9aa62 /macosx/plugins/DFXVideo/macsrc/PluginConfigController.m | |
| parent | 9628a367530657e7fefb17be0a125dbe3f5d7614 (diff) | |
Moving most of the OS X preferences to auto layout, and all to 10.7.
Changing some lists of independent checkbox buttons to matrices.
Fix a discrepancy between SDL versions 1.2 and 2.0 APIs in OS X's input preferences.
git-svn-id: https://pcsxr.svn.codeplex.com/svn/pcsxr@86849 e17a0e51-4ae3-4d35-97c3-1a29b211df97
Diffstat (limited to 'macosx/plugins/DFXVideo/macsrc/PluginConfigController.m')
| -rwxr-xr-x | macosx/plugins/DFXVideo/macsrc/PluginConfigController.m | 64 |
1 files changed, 31 insertions, 33 deletions
diff --git a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m index cbdbda74..d20849fb 100755 --- a/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m +++ b/macosx/plugins/DFXVideo/macsrc/PluginConfigController.m @@ -5,6 +5,7 @@ #include "externals.h" #import "SGPUPreferences.h" #import "ARCBridge.h" +#import "PluginGLView.h" #ifdef ENABLE_NLS #include <libintl.h> @@ -81,18 +82,20 @@ void AboutDlgProc() void SoftDlgProc() { - NSWindow *window; - - if (windowController == nil) { - windowController = [[PluginConfigController alloc] initWithWindowNibName:@"NetSfPeopsSoftGPUConfig"]; - } - window = [windowController window]; - - /* load values */ - [windowController loadValues]; - - [window center]; - [window makeKeyAndOrderFront:nil]; + RunOnMainThreadSync(^{ + NSWindow *window; + + if (windowController == nil) { + windowController = [[PluginConfigController alloc] initWithWindowNibName:@"NetSfPeopsSoftGPUConfig"]; + } + window = [windowController window]; + + /* load values */ + [windowController loadValues]; + + [window center]; + [window makeKeyAndOrderFront:nil]; + }); } BOOL isShaderEnabled() @@ -211,11 +214,8 @@ void ReadConfig(void) [writeDic setObject:@([ditherMode indexOfSelectedItem]) forKey:@"Dither Mode"]; unsigned int hackValues = 0; - NSArray *views = [hacksView subviews]; - for (NSView *control in views) { - if ([control isKindOfClass:[NSButton class]]) { - hackValues |= [(NSControl *)control intValue] << ([control tag] - 1); - } + for (NSCell *control in [hacksMatrix cells]) { + hackValues |= [control intValue] << ([control tag] - 1); } [writeDic setObject:@(hackValues) forKey:@"Hacks"]; @@ -243,10 +243,13 @@ void ReadConfig(void) - (IBAction)hackToggle:(id)sender { BOOL enable = [sender intValue] ? YES : NO; - NSArray *views = [hacksView subviews]; + NSArray *views = [[[hacksView subviews] objectAtIndex:0] subviews]; for (NSView *control in views) { - if ([control isKindOfClass:[NSButton class]]) { + if ([control isKindOfClass:[NSControl class]]) { + if ([control isKindOfClass:[NSTextField class]]) { + [(NSTextField*)control setTextColor:enable ? [NSColor controlTextColor] : [NSColor disabledControlTextColor] ]; + } [(NSControl *)control setEnabled:enable]; } } @@ -254,10 +257,15 @@ void ReadConfig(void) - (IBAction)toggleShader:(id)sender { BOOL enable = [sender intValue] ? YES : NO; - NSArray *views = [shadersView subviews]; + NSArray *views = [[[shadersView subviews] objectAtIndex:0] subviews]; for (NSView *control in views) { - [(NSControl *)control setEnabled:enable]; + if ([control isKindOfClass:[NSControl class]]) { + if ([control isKindOfClass:[NSTextField class]]) { + [(NSTextField*)control setTextColor:enable ? [NSColor controlTextColor] : [NSColor disabledControlTextColor] ]; + } + [(NSControl *)control setEnabled:enable]; + } } } @@ -334,24 +342,14 @@ void ReadConfig(void) unsigned int hackValues = [[keyValues objectForKey:@"Hacks"] unsignedIntValue]; - NSArray *views = [hacksView subviews]; - for (NSView *control in views) { - if ([control isKindOfClass:[NSButton class]]) { - [(NSControl *)control setIntValue:(hackValues >> ([control tag] - 1)) & 1]; - } + for (NSCell *control in [hacksMatrix cells]) { + [control setIntValue:(hackValues >> ([control tag] - 1)) & 1]; } [self hackToggle:hackEnable]; [self toggleShader:shaders]; } -- (void)awakeFromNib -{ - //I don't know why we need to do this... - hacksView = [[hacksView subviews] objectAtIndex:0]; - shadersView = [[shadersView subviews] objectAtIndex:0]; -} - #if !__has_feature(objc_arc) - (void)dealloc { |
