• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

広告パネルを透明にするBathyScapheプラグイン


Commit MetaInfo

Révisionb0b46624baa0e6e45dfea028b086dd41299b8e89 (tree)
l'heure2015-03-14 21:44:35
Auteurmasakih <masakih@user...>
Commitermasakih

Message de Log

アルファ値を変更できるようにした

Change Summary

Modification

--- a/AdAlphaZero.xcodeproj/project.pbxproj
+++ b/AdAlphaZero.xcodeproj/project.pbxproj
@@ -9,6 +9,10 @@
99 /* Begin PBXBuildFile section */
1010 F43C44001AADB44600A57F75 /* AdAlphaZero.m in Sources */ = {isa = PBXBuildFile; fileRef = F43C43FF1AADB44600A57F75 /* AdAlphaZero.m */; };
1111 F43C44091AADE43500A57F75 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = F43C44061AADE3E400A57F75 /* InfoPlist.strings */; };
12+ F43C440D1AB4482200A57F75 /* AAZPreferenceViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = F43C440B1AB4482200A57F75 /* AAZPreferenceViewController.m */; };
13+ F43C440E1AB4482200A57F75 /* AAZPreferenceViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = F43C440C1AB4482200A57F75 /* AAZPreferenceViewController.xib */; };
14+ F43C44151AB454BA00A57F75 /* Ad.png in Resources */ = {isa = PBXBuildFile; fileRef = F43C44131AB454BA00A57F75 /* Ad.png */; };
15+ F43C44161AB454BA00A57F75 /* Base.png in Resources */ = {isa = PBXBuildFile; fileRef = F43C44141AB454BA00A57F75 /* Base.png */; };
1216 /* End PBXBuildFile section */
1317
1418 /* Begin PBXFileReference section */
@@ -20,6 +24,11 @@
2024 F43C43FE1AADB44600A57F75 /* AdAlphaZero.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AdAlphaZero.h; sourceTree = "<group>"; };
2125 F43C43FF1AADB44600A57F75 /* AdAlphaZero.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AdAlphaZero.m; sourceTree = "<group>"; };
2226 F43C44071AADE3E400A57F75 /* ja */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ja; path = ja.lproj/InfoPlist.strings; sourceTree = "<group>"; };
27+ F43C440A1AB4482200A57F75 /* AAZPreferenceViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AAZPreferenceViewController.h; sourceTree = "<group>"; };
28+ F43C440B1AB4482200A57F75 /* AAZPreferenceViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AAZPreferenceViewController.m; sourceTree = "<group>"; };
29+ F43C440C1AB4482200A57F75 /* AAZPreferenceViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AAZPreferenceViewController.xib; sourceTree = "<group>"; };
30+ F43C44131AB454BA00A57F75 /* Ad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Ad.png; sourceTree = "<group>"; };
31+ F43C44141AB454BA00A57F75 /* Base.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Base.png; sourceTree = "<group>"; };
2332 /* End PBXFileReference section */
2433
2534 /* Begin PBXFrameworksBuildPhase section */
@@ -57,6 +66,11 @@
5766 F43C43FD1AADB3ED00A57F75 /* PSPreviewerInterface.h */,
5867 F43C43FE1AADB44600A57F75 /* AdAlphaZero.h */,
5968 F43C43FF1AADB44600A57F75 /* AdAlphaZero.m */,
69+ F43C440A1AB4482200A57F75 /* AAZPreferenceViewController.h */,
70+ F43C440B1AB4482200A57F75 /* AAZPreferenceViewController.m */,
71+ F43C440C1AB4482200A57F75 /* AAZPreferenceViewController.xib */,
72+ F43C44131AB454BA00A57F75 /* Ad.png */,
73+ F43C44141AB454BA00A57F75 /* Base.png */,
6074 F43C43F41AADB35F00A57F75 /* Supporting Files */,
6175 );
6276 path = AdAlphaZero;
@@ -128,7 +142,10 @@
128142 isa = PBXResourcesBuildPhase;
129143 buildActionMask = 2147483647;
130144 files = (
145+ F43C440E1AB4482200A57F75 /* AAZPreferenceViewController.xib in Resources */,
131146 F43C44091AADE43500A57F75 /* InfoPlist.strings in Resources */,
147+ F43C44161AB454BA00A57F75 /* Base.png in Resources */,
148+ F43C44151AB454BA00A57F75 /* Ad.png in Resources */,
132149 );
133150 runOnlyForDeploymentPostprocessing = 0;
134151 };
@@ -139,6 +156,7 @@
139156 isa = PBXSourcesBuildPhase;
140157 buildActionMask = 2147483647;
141158 files = (
159+ F43C440D1AB4482200A57F75 /* AAZPreferenceViewController.m in Sources */,
142160 F43C44001AADB44600A57F75 /* AdAlphaZero.m in Sources */,
143161 );
144162 runOnlyForDeploymentPostprocessing = 0;
--- /dev/null
+++ b/AdAlphaZero/AAZPreferenceViewController.h
@@ -0,0 +1,13 @@
1+//
2+// AAZPreferenceViewController.h
3+// AdAlphaZero
4+//
5+// Created by Hori,Masaki on 2015/03/14.
6+// Copyright (c) 2015年 Hori,Masaki. All rights reserved.
7+//
8+
9+#import <Cocoa/Cocoa.h>
10+
11+@interface AAZPreferenceViewController : NSViewController
12+@property (strong) NSNumber *alpha;
13+@end
--- /dev/null
+++ b/AdAlphaZero/AAZPreferenceViewController.m
@@ -0,0 +1,42 @@
1+//
2+// AAZPreferenceViewController.m
3+// AdAlphaZero
4+//
5+// Created by Hori,Masaki on 2015/03/14.
6+// Copyright (c) 2015年 Hori,Masaki. All rights reserved.
7+//
8+
9+#import "AAZPreferenceViewController.h"
10+
11+@interface AAZPreferenceViewController ()
12+
13+@property (weak) IBOutlet NSImageView *adView;
14+
15+@end
16+
17+@implementation AAZPreferenceViewController
18+
19+@synthesize alpha = _alpha;
20+
21++ (instancetype)new
22+{
23+ NSBundle *bundle = [NSBundle bundleForClass:[self class]];
24+ return [[self alloc] initWithNibName:NSStringFromClass([self class]) bundle:bundle];
25+}
26+
27+- (void)awakeFromNib
28+{
29+ self.adView.alphaValue = self.alpha.doubleValue;
30+}
31+
32+- (void)setAlpha:(NSNumber *)alpha
33+{
34+ self.adView.alphaValue = alpha.doubleValue;
35+ _alpha = alpha;
36+}
37+- (NSNumber *)alpha
38+{
39+ return _alpha;
40+}
41+
42+@end
--- /dev/null
+++ b/AdAlphaZero/AAZPreferenceViewController.xib
@@ -0,0 +1,58 @@
1+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="13F34" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
3+ <dependencies>
4+ <deployment identifier="macosx"/>
5+ <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/>
6+ </dependencies>
7+ <objects>
8+ <customObject id="-2" userLabel="File's Owner" customClass="AAZPreferenceViewController">
9+ <connections>
10+ <outlet property="adView" destination="hRr-r5-vuz" id="NNr-q9-97F"/>
11+ <outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
12+ </connections>
13+ </customObject>
14+ <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
15+ <customObject id="-3" userLabel="Application" customClass="NSObject"/>
16+ <customView id="Hz6-mo-xeY">
17+ <rect key="frame" x="0.0" y="-5" width="343" height="260"/>
18+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
19+ <subviews>
20+ <box title="Box" borderType="line" titlePosition="noTitle" id="0id-lX-KMq">
21+ <rect key="frame" x="16" y="41" width="310" height="207"/>
22+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
23+ <view key="contentView">
24+ <rect key="frame" x="1" y="1" width="308" height="205"/>
25+ <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
26+ <subviews>
27+ <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" id="Jwe-Uj-shI">
28+ <rect key="frame" x="8" y="9" width="293" height="190"/>
29+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
30+ <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Base" id="Rmw-2G-bLd"/>
31+ </imageView>
32+ <imageView horizontalHuggingPriority="251" verticalHuggingPriority="251" id="hRr-r5-vuz">
33+ <rect key="frame" x="61" y="9" width="160" height="161"/>
34+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
35+ <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="Ad" id="ZWu-va-upp"/>
36+ </imageView>
37+ </subviews>
38+ </view>
39+ <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
40+ <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
41+ </box>
42+ <slider verticalHuggingPriority="750" id="DQa-hu-D5s">
43+ <rect key="frame" x="18" y="18" width="307" height="21"/>
44+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
45+ <sliderCell key="cell" continuous="YES" state="on" alignment="left" maxValue="1" tickMarkPosition="above" sliderType="linear" id="wMn-xo-med"/>
46+ <connections>
47+ <binding destination="-2" name="value" keyPath="alpha" id="anS-83-9EP"/>
48+ </connections>
49+ </slider>
50+ </subviews>
51+ <point key="canvasLocation" x="87.5" y="104"/>
52+ </customView>
53+ </objects>
54+ <resources>
55+ <image name="Ad" width="160" height="161"/>
56+ <image name="Base" width="293" height="190"/>
57+ </resources>
58+</document>
Binary files /dev/null and b/AdAlphaZero/Ad.png differ
--- a/AdAlphaZero/AdAlphaZero.m
+++ b/AdAlphaZero/AdAlphaZero.m
@@ -8,19 +8,81 @@
88
99 #import "AdAlphaZero.h"
1010
11+#import "AAZPreferenceViewController.h"
12+
13+
1114 @interface NSWindowController (AAZMethods)
1215 + (instancetype)sharedInstance;
1316 @end
1417
18+@interface AdAlphaZero ()
19+
20+@property (strong) NSNumber *alpha;
21+
22+@property (strong) AAZPreferenceViewController *preferenceViewController;
23+@property (weak) id preferences;
24+@end
25+
1526 @implementation AdAlphaZero
1627
28+NSWindow *targetWindow()
29+{
30+ return [[NSClassFromString(@"BSAdWindowController") sharedInstance] window];
31+}
32+void setAlphaToTargetWindow(CGFloat alpha)
33+{
34+ BOOL isVisible = targetWindow().isVisible;
35+ targetWindow().alphaValue = alpha;
36+ if(!isVisible) [targetWindow() orderOut:nil];
37+}
38+
1739 + (void)load
1840 {
19- NSWindowController *wCon = [NSClassFromString(@"BSAdWindowController") sharedInstance];
20- [wCon.window setAlphaValue:0.0];
41+ targetWindow().alphaValue = 0.0;
42+ [targetWindow() orderOut:nil];
2143 }
2244
23-- (id)initWithPreferences:(AppDefaults *)prefs { return [super init]; }
45+- (NSView *)preferenceView
46+{
47+ if(self.preferenceViewController) return self.preferenceViewController.view;
48+
49+ self.preferenceViewController = [AAZPreferenceViewController new];
50+ self.preferenceViewController.alpha = self.alpha;
51+ [self.preferenceViewController addObserver:self
52+ forKeyPath:@"alpha"
53+ options:NSKeyValueObservingOptionNew
54+ context:NULL];
55+
56+ return self.preferenceViewController.view;
57+}
58+
59+- (NSMutableDictionary *)prefDict
60+{
61+ return [self.preferences previewerPrefsDict];
62+}
63+
64+- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
65+{
66+ if(![keyPath isEqualToString:@"alpha"]) return;
67+
68+ self.alpha = self.preferenceViewController.alpha;
69+ setAlphaToTargetWindow(self.alpha.doubleValue);
70+
71+ if(self.alpha) {
72+ self.prefDict[@"com.masakih.AdAlphaZero.alpha"] = self.alpha;
73+ }
74+}
75+
76+- (id)initWithPreferences:(AppDefaults *)prefs
77+{
78+ self = [super init];
79+ if(self) {
80+ _preferences = prefs;
81+ _alpha = self.prefDict[@"com.masakih.AdAlphaZero.alpha"];
82+ targetWindow().alphaValue = self.alpha.doubleValue;
83+ }
84+ return self;
85+}
2486 - (BOOL)previewLink:(NSURL *)url { return NO; }
2587 - (BOOL)validateLink:(NSURL *)url { return NO; }
2688 - (BOOL)previewLinks:(NSArray *)urls { return NO; }
Binary files /dev/null and b/AdAlphaZero/Base.png differ