#import <JavaScriptCore/JavaScriptCore.h>
+#import "HMCombileViewController.h"
+#import "HMCombinedCommand.h"
+
typedef NS_ENUM(NSInteger, ViewType) {
kScheduleType = 0,
@property (strong) HMPowerUpSupportViewController *powerUpViewController;
@property (strong) HMStrengthenListViewController *strengthedListViewController;
+@property (strong) HMCombileViewController *combinedViewController;
+@property BOOL isCombinedMode;
+
@end
@implementation HMBroserWindowController
[self bind:@"maxChara" toObject:self.basicController withKeyPath:@"selection.max_chara" options:nil];
[self bind:@"shipCount" toObject:self.shipController withKeyPath:@"arrangedObjects.@count" options:nil];
+
+
+ NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
+ [nc addObserver:self
+ selector:@selector(didCangeCombined:)
+ name:HMCombinedCommandCombinedDidCangeNotification
+ object:nil];
+
+ if(HMStandardDefaults.lastHasCombinedView) {
+ [self showCombinedView];
+ }
+}
+
+- (void)windowWillClose:(id)notification
+{
+ HMStandardDefaults.lastHasCombinedView = self.isCombinedMode;
}
- (NSManagedObjectContext *)managedObjectContext
}
+#pragma mark - Combined view
+- (IBAction)showHideCombinedView:(id)sender
+{
+ if(self.isCombinedMode) {
+ [self hideCombinedView];
+ } else {
+ [self showCombinedView];
+ }
+}
+- (void)showCombinedView
+{
+ if(self.isCombinedMode) return;
+ self.isCombinedMode = YES;
+
+ if(!self.combinedViewController) {
+ self.combinedViewController = [HMCombileViewController new];
+ self.combinedViewController.view.hidden = YES;
+
+ [self.combinedViewController.view setAutoresizingMask:[self.combinedViewPlaceholder autoresizingMask]];
+ [[self.combinedViewPlaceholder superview] replaceSubview:self.combinedViewPlaceholder with:self.combinedViewController.view];
+ }
+
+ NSRect winFrame = self.window.frame;
+ CGFloat incrementWidth = NSMaxX(self.combinedViewController.view.frame);
+ winFrame.size.width += incrementWidth;
+ winFrame.origin.x -= incrementWidth;
+
+ self.combinedViewController.view.hidden = NO;
+ [self.window setFrame:winFrame display:YES animate:YES];
+}
+- (void)hideCombinedView
+{
+ if(!self.isCombinedMode) return;
+ self.isCombinedMode = NO;
+
+ NSRect winFrame = self.window.frame;
+ CGFloat incrementWidth = NSMaxX(self.combinedViewController.view.frame);
+ winFrame.size.width -= incrementWidth;
+ winFrame.origin.x += incrementWidth;
+
+ [self.window setFrame:winFrame display:YES animate:YES];
+ self.combinedViewController.view.hidden = YES;
+}
+
+- (void)didCangeCombined:(id)notification
+{
+ if(!HMStandardDefaults.autoCombinedView) return;
+
+ NSDictionary *info = [notification userInfo];
+ NSNumber *typeValue = info[HMCombinedType];
+ CombineType type = typeValue.integerValue;
+ if(![NSThread isMainThread]) {
+ [NSThread sleepForTimeInterval:0.1];
+ }
+ dispatch_async(dispatch_get_main_queue(),
+ ^{
+ switch(type) {
+ case cancel:
+ [self hideCombinedView];
+ break;
+ case maneuver:
+ case water:
+ case transportation:
+ [self showCombinedView];
+ break;
+ default:
+ NSLog(@"combined type is unknown type. %ld", type);
+ [self showCombinedView];
+ break;
+ }
+ });
+}
+
#pragma mark - FleetView position
// ###############################
const CGFloat margin = 1;
if(action == @selector(clearQuestList:)) {
return YES;
}
+ if(action == @selector(showHideCombinedView:)) {
+ if(self.isCombinedMode) {
+ menuItem.title = NSLocalizedString(@"Hide Combined View", @"View menu, hide combined view");
+ } else {
+ menuItem.title = NSLocalizedString(@"Show Combined View", @"View menu, show combined view");
+ }
+ return YES;
+ }
return NO;
}
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="Hz6-mo-xeY">
- <rect key="frame" x="0.0" y="0.0" width="213" height="778"/>
+ <rect key="frame" x="0.0" y="0.0" width="185" height="778"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<customView id="wYL-DD-bTM">
- <rect key="frame" x="20" y="394" width="173" height="364"/>
+ <rect key="frame" x="12" y="381" width="173" height="364"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
<customView id="Dyh-dm-bed">
- <rect key="frame" x="20" y="20" width="173" height="364"/>
+ <rect key="frame" x="12" y="9" width="173" height="364"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
</customView>
</subviews>
- <point key="canvasLocation" x="268.5" y="381"/>
+ <point key="canvasLocation" x="252.5" y="381"/>
</customView>
</objects>
</document>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14D136" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7706" systemVersion="14F1021" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7706"/>
<customObject id="-2" userLabel="File's Owner" customClass="HMBroserWindowController">
<connections>
<outlet property="basicController" destination="1lk-ii-37p" id="EBc-Kc-cHP"/>
+ <outlet property="combinedViewPlaceholder" destination="ErU-NG-s3I" id="6hE-wI-Ikk"/>
<outlet property="deckContoller" destination="eqP-ex-UzI" id="8n5-Er-BIF"/>
<outlet property="deckPlaceholder" destination="tIf-gd-MhY" id="aXM-5K-Uwd"/>
<outlet property="informations" destination="fK1-fC-Xdm" id="why-oJ-aEb"/>
<rect key="frame" x="0.0" y="0.0" width="1161" height="778"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
+ <customView id="ErU-NG-s3I" userLabel="CombinedView">
+ <rect key="frame" x="0.0" y="0.0" width="185" height="778"/>
+ <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
+ </customView>
<customView id="raX-C4-fMW">
<rect key="frame" x="8" y="298" width="800" height="480"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
</customView>
<customView id="tIf-gd-MhY">
- <rect key="frame" x="9" y="9" width="799" height="288"/>
- <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
+ <rect key="frame" x="8" y="9" width="800" height="288"/>
+ <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
</customView>
<scrollView borderType="none" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" id="hy2-T8-sUp">
<rect key="frame" x="829" y="6" width="311" height="43"/>