OSDN Git Service

スクリーンショットボタンの大きさを変更できるようにした
authormasakih <masakih@users.sourceforge.jp>
Sun, 6 Nov 2016 01:33:28 +0000 (10:33 +0900)
committermasakih <masakih@users.sourceforge.jp>
Sun, 6 Nov 2016 01:33:28 +0000 (10:33 +0900)
KCD/Base.lproj/HMAncherageRepairTimerViewController.xib
KCD/Base.lproj/MainMenu.xib
KCD/HMAncherageRepairTimerViewController.h
KCD/HMAncherageRepairTimerViewController.m
KCD/HMBroserWindowController.m
KCD/HMUserDefaults.h
KCD/HMUserDefaults.m
KCD/ja.lproj/MainMenu.strings
KCD/zh-Hant-TW.lproj/MainMenu.strings

index 05ef8c8..2747836 100644 (file)
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1108" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="HMAncherageRepairTimerViewController">
@@ -18,7 +19,7 @@
             <subviews>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="Len-bF-3P9">
                     <rect key="frame" x="157" y="6" width="101" height="17"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="泊地修理タイマー" id="9rH-KA-HLC">
                         <font key="font" metaFont="system"/>
                         <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
@@ -27,7 +28,7 @@
                 </textField>
                 <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="lPa-da-VKP">
                     <rect key="frame" x="260" y="6" width="73" height="17"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
                     <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" id="ORE-wG-yKF">
                         <customFormatter key="formatter" id="LHP-bc-xIy" customClass="HMTimerCountFormatter"/>
                         <font key="font" metaFont="system"/>
                         <binding destination="-2" name="value" keyPath="repairTime" id="sMc-R4-LMf"/>
                     </connections>
                 </textField>
-                <box verticalHuggingPriority="750" title="Box" boxType="separator" titlePosition="noTitle" id="18H-dF-jqB">
+                <box verticalHuggingPriority="750" boxType="separator" id="18H-dF-jqB">
                     <rect key="frame" x="11" y="-6" width="329" height="5"/>
                     <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
-                    <color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
-                    <color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
-                    <font key="titleFont" metaFont="system"/>
                 </box>
                 <button id="gW9-cX-69H">
                     <rect key="frame" x="20" y="6" width="64" height="64"/>
-                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
+                    <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" heightSizable="YES"/>
                     <buttonCell key="cell" type="square" bezelStyle="shadowlessSquare" image="CameraDisabled" imagePosition="only" alignment="center" imageScaling="proportionallyUpOrDown" inset="2" id="Mmi-jE-o88">
                         <behavior key="behavior" pushIn="YES" changeContents="YES" lightByContents="YES"/>
                         <font key="font" metaFont="system"/>
index a5445db..aafc85b 100644 (file)
@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11201" systemVersion="15G1108" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
     <dependencies>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9532"/>
+        <deployment identifier="macosx"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11201"/>
     </dependencies>
     <objects>
         <customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -262,12 +263,18 @@ CA
                                     <action selector="selectPreviousFleet:" target="-1" id="l4N-mw-wZP"/>
                                 </connections>
                             </menuItem>
-                            <menuItem isSeparatorItem="YES" id="pna-WT-8tJ"/>
+                            <menuItem isSeparatorItem="YES" id="m3g-BP-cHn"/>
                             <menuItem title="Screen Shot" keyEquivalent="S" id="7Fq-TJ-VZE">
                                 <connections>
                                     <action selector="screenShot:" target="-1" id="eoB-LA-pzp"/>
                                 </connections>
                             </menuItem>
+                            <menuItem title="Toggle Screen Shot Button Size" id="tuF-Zr-OZU">
+                                <modifierMask key="keyEquivalentModifierMask"/>
+                                <connections>
+                                    <action selector="toggleAnchorageSize:" target="-1" id="1bR-yN-W7o"/>
+                                </connections>
+                            </menuItem>
                             <menuItem isSeparatorItem="YES" id="r9R-zW-j9D"/>
                             <menuItem title="Clear Quset List" id="HhI-qq-nGv">
                                 <modifierMask key="keyEquivalentModifierMask"/>
index 093487f..3f057b2 100644 (file)
@@ -10,4 +10,9 @@
 
 @interface HMAncherageRepairTimerViewController : NSViewController
 
+@property NSControlSize controlSize;
+
+@property (class, readonly) CGFloat regularHeight;
+@property (class, readonly) CGFloat smallHeight;
+
 @end
index dbf9d58..b533521 100644 (file)
@@ -12,6 +12,9 @@
 
 #import "HMAnchorageRepairManager.h"
 
+static const CGFloat regularHeight = 76;
+static const CGFloat smallHeight = regularHeight - 32;
+
 @interface HMAncherageRepairTimerViewController ()
 @property (strong) HMAnchorageRepairManager *anchorageRepairManager;
 @property (strong) NSNumber *repairTime;
 @end
 
 @implementation HMAncherageRepairTimerViewController
+@synthesize controlSize = _controlSize;
 
 - (id)init
 {
        self = [super initWithNibName:NSStringFromClass([self class]) bundle:nil];
        if(self) {
                _anchorageRepairManager = [HMAnchorageRepairManager defaultManager];
+        _controlSize = NSControlSizeRegular;
                
                HMAppDelegate *appDelegate = [[NSApplication sharedApplication] delegate];
                [appDelegate addCounterUpdateBlock:^{
        self.screenshotButton.image = [NSImage imageNamed:@"CameraDisabled"];
 }
 
+- (void)setControlSize:(NSControlSize)controlSize
+{
+    if(_controlSize == controlSize) return;
+    
+    NSRect frame = self.view.frame;
+    frame.size.height = controlSize == NSControlSizeRegular ? regularHeight : smallHeight;
+    self.view.frame = frame;
+    
+    NSRect buttonFrame = self.screenshotButton.frame;
+    buttonFrame.size.width += controlSize == NSControlSizeRegular ? +32 : -32;
+    self.screenshotButton.frame = buttonFrame;
+    _controlSize = controlSize;
+}
+- (NSControlSize)controlSize
+{
+    return _controlSize;
+}
+
++ (CGFloat)regularHeight
+{
+    return regularHeight;
+}
++ (CGFloat)smallHeight
+{
+    return smallHeight;
+}
+
 - (NSNumber *)calcRepairTime
 {
        NSDate *compTimeValue = self.anchorageRepairManager.repairTime;
index 2479a23..fb486e7 100644 (file)
@@ -108,6 +108,9 @@ typedef NS_ENUM(NSUInteger, FleetViewPosition) {
        self.ancherageRepariTimerViewController = [HMAncherageRepairTimerViewController new];
        [self.ancherageRepariTimerViewController.view setFrameOrigin:NSZeroPoint];
        [self.ancherageRepariTimerPlaceholder addSubview:self.ancherageRepariTimerViewController.view];
+    if(HMStandardDefaults.screenshotButtonSize == NSControlSizeSmall) {
+        [self toggleAnchorageSize:nil];
+    }
        
        self.docksViewController = [HMDocksViewController new];
        self.shipViewController = [HMShipViewController new];
@@ -226,6 +229,26 @@ typedef NS_ENUM(NSUInteger, FleetViewPosition) {
        }
 }
 
+
+- (IBAction)toggleAnchorageSize:(id)sender
+{
+    NSControlSize current = self.ancherageRepariTimerViewController.controlSize;
+    CGFloat diff = [HMAncherageRepairTimerViewController regularHeight] - [HMAncherageRepairTimerViewController smallHeight];
+    NSControlSize newSize = NSControlSizeRegular;
+    if(current == NSControlSizeRegular) {
+        diff *= -1;
+        newSize = NSControlSizeSmall;
+    }
+    self.ancherageRepariTimerViewController.controlSize = newSize;
+    
+    NSRect frame = self.informations.frame;
+    frame.size.height -= diff;
+    frame.origin.y += diff;
+    self.informations.frame = frame;
+    
+    HMStandardDefaults.screenshotButtonSize = newSize;
+}
+
 #pragma mark - Combined view
 - (IBAction)showHideCombinedView:(id)sender
 {
@@ -585,6 +608,9 @@ const CGFloat flashTopMargin = 4;
                if(self.fleetViewPosition == kOldStyle) return NO;
                return YES;
        }
+    if(action == @selector(toggleAnchorageSize:))  {
+        return YES;
+    }
        
        return NO;
 }
index d3e62ed..94be04e 100644 (file)
@@ -86,6 +86,21 @@ extern HMUserDefaults *HMStandardDefaults;
 @property NSNumber *screenshotPreviewZoomValue;
 
 /**
+ * 連結するスクリーンショットの列数
+ */
+@property NSInteger screenshotEditorColumnCount;
+
+/**
+ * スクリーンショットの切り抜きタイプ
+ */
+@property NSInteger scrennshotEditorType;
+
+/**
+ * スクリーンショットボタンの大きさ
+ */
+@property NSControlSize screenshotButtonSize;
+
+/**
  *  遠征帰還時の通知音を鳴らす
  */
 @property BOOL playFinishMissionSound;
@@ -156,16 +171,6 @@ extern HMUserDefaults *HMStandardDefaults;
 
 
 /**
- * 連結するスクリーンショットの列数
- */
-@property NSInteger screenshotEditorColumnCount;
-
-/**
- * スクリーンショットの切り抜きタイプ
- */
-@property NSInteger scrennshotEditorType;
-
-/**
  * 古い履歴を削除する
  */
 @property BOOL cleanOldHistoryItems;
index 478ff32..49f7bed 100644 (file)
@@ -399,6 +399,15 @@ HMUserDefaults *HMStandardDefaults = nil;
        return [self integerForKey:@"scrennshotEditorType"];
 }
 
+- (void)setScreenshotButtonSize:(NSControlSize)screenshotButtonSize
+{
+    [self setInteger:screenshotButtonSize forKey:@"screenshotButtonSize"];
+}
+- (NSControlSize)screenshotButtonSize
+{
+    return [self integerForKey:@"screenshotButtonSize"];
+}
+
 #pragma mark - Notify Sound
 - (void)setPlayFinishMissionSound:(BOOL)playFinishMissionSound
 {
index 70cc91d..8cdb07f 100644 (file)
 "y18-nA-SS3.title" = "改修工廠";
 
 "U2N-Wx-ugY.title" = "修復";
+
+"tuF-Zr-OZU.title" = "スクリーンショットボタンの大きさを切り替え";
+
index c704f31..afdcc5b 100644 (file)
 
 /* Class = "NSMenuItem"; title = "Select Next Fleet"; ObjectID = "zEh-tr-mhX"; */
 "zEh-tr-mhX.title" = "選擇下一步艦隊";
+
+
+"tuF-Zr-OZU.title" = "切換截圖按鈕大小";
+