improved Layout

This commit is contained in:
2017-06-16 20:32:40 +02:00
parent 1bbb8384bb
commit 8576e956d6
13 changed files with 430 additions and 195 deletions
@@ -0,0 +1,24 @@
//
// CollectionViewItemMonth.swift
// Graphic Analysis 2
//
// Created by Kilian Hofmann on 16.06.17.
// Copyright © 2017 Kilian Hofmann. All rights reserved.
//
import Cocoa
class CollectionViewItemMonth: NSCollectionViewItem {
@IBOutlet var day: NSTextField!
@IBOutlet var loss: NSTextField!
override func viewDidLoad() {
super.viewDidLoad()
view.wantsLayer = true
view.layer?.backgroundColor = NSColor.white.cgColor
view.layer?.masksToBounds = true
view.layer?.borderWidth = 1.0
view.layer?.borderColor = NSColor.clear.cgColor
}
}
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="12121" systemVersion="16G16b" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" customObjectInstantitationMethod="direct">
<dependencies>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="12121"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="CollectionViewItemMonth" customModule="Graphic_Analysis_2" customModuleProvider="target">
<connections>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
</customObject>
<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="135" height="132"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3aE-Wf-9eZ">
<rect key="frame" x="18" y="92" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="01" id="hZ1-E9-nbm">
<font key="font" metaFont="system" size="16"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="bOH-fN-p3a">
<rect key="frame" x="18" y="67" width="36" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Loss:" id="6Hu-ZO-t9e">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ios-8D-sSB">
<rect key="frame" x="58" y="67" width="59" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="axa-F2-XeS">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<point key="canvasLocation" x="138.5" y="169"/>
</customView>
<collectionViewItem id="0ws-De-Ut2" customClass="CollectionViewItemMonth" customModule="Graphic_Analysis_2" customModuleProvider="target">
<connections>
<outlet property="day" destination="3aE-Wf-9eZ" id="dB1-dQ-VPe"/>
<outlet property="loss" destination="Ios-8D-sSB" id="Pkz-fU-9Hd"/>
<outlet property="view" destination="Hz6-mo-xeY" id="pe3-pf-cYV"/>
</connections>
</collectionViewItem>
</objects>
</document>
@@ -1,6 +1,6 @@
//
// CollectionViewItem.swift
// Docsis Toolkit
// Graphic Analysis 2
//
// Created by Kilian Hofmann on 15.06.17.
// Copyright © 2017 Kilian Hofmann. All rights reserved.
@@ -8,7 +8,7 @@
import Cocoa
class CollectionViewItem: NSCollectionViewItem {
class CollectionViewItemYear: NSCollectionViewItem {
@IBOutlet var month: NSTextField!
@IBOutlet var day01: NSTextField!
@@ -42,13 +42,17 @@ class CollectionViewItem: NSCollectionViewItem {
@IBOutlet var day29: NSTextField!
@IBOutlet var day30: NSTextField!
@IBOutlet var day31: NSTextField!
var days: [NSTextField]? = nil
var days: [NSTextField] = []
var monthFW: FileWrapper? = nil
var daySet: Bool = false
override func viewDidLoad() {
super.viewDidLoad()
view.wantsLayer = true
view.layer?.backgroundColor = NSColor.white.cgColor
view.layer?.masksToBounds = true
view.layer?.borderWidth = 1.0
view.layer?.borderColor = NSColor.clear.cgColor
days = [day01, day02, day03, day04, day05, day06, day07, day08, day09, day10, day11, day12, day13, day14, day15, day16, day17, day18, day19, day20, day21, day22, day23, day24, day25, day26, day27, day28, day29, day30, day31]
}
@@ -56,7 +60,15 @@ class CollectionViewItem: NSCollectionViewItem {
guard monthFW != nil else { return }
for day in (monthFW?.fileWrappers)! {
guard let dayI = Int(day.key) else { continue }
days?[dayI-1].stringValue = day.key
days[dayI-1].textColor = NSColor.black
daySet = true
}
}
func unsetDays() {
for day in days {
day.textColor = NSColor.controlShadowColor
daySet = false
}
}
}
@@ -6,7 +6,7 @@
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="CollectionViewItem" customModule="Graphic_Analysis_2" customModuleProvider="target">
<customObject id="-2" userLabel="File's Owner" customClass="CollectionViewItemYear" customModule="Graphic_Analysis_2" customModuleProvider="target">
<connections>
<outlet property="view" destination="Hz6-mo-xeY" id="0bl-1N-x8E"/>
</connections>
@@ -20,279 +20,279 @@
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="sZs-Ok-Lxt">
<rect key="frame" x="18" y="132" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="cvG-OC-qyF">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="01" id="cvG-OC-qyF">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="EMI-IW-D7N">
<rect key="frame" x="46" y="132" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="whm-Od-xk5">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="02" id="whm-Od-xk5">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="gGq-5N-vZK">
<rect key="frame" x="74" y="132" width="25" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="xHN-93-Fnb">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="03" id="xHN-93-Fnb">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RyW-Ec-HqS">
<rect key="frame" x="102" y="132" width="25" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="IjL-tp-kgm">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="04" id="IjL-tp-kgm">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="LR3-gs-Z4Y">
<rect key="frame" x="130" y="132" width="25" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="M0e-Ui-ey4">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="05" id="M0e-Ui-ey4">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="N8D-zg-F4Y">
<rect key="frame" x="158" y="132" width="25" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="dbN-Hb-Jik">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="06" id="dbN-Hb-Jik">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="xDA-ft-y37">
<rect key="frame" x="186" y="132" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="wpU-Xt-Q5N">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="07" id="wpU-Xt-Q5N">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Hfh-Ls-cBx">
<rect key="frame" x="18" y="104" width="25" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="IAa-R5-PYQ">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="08" id="IAa-R5-PYQ">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="z93-Em-Tkm">
<rect key="frame" x="46" y="104" width="25" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="c5g-Ap-sBf">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="09" id="c5g-Ap-sBf">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dN4-Vw-nYf">
<rect key="frame" x="74" y="104" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="Rpe-YR-Gb2">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="10" id="Rpe-YR-Gb2">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="by5-NX-phY">
<rect key="frame" x="102" y="104" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="kRk-kM-ypN">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="11" id="kRk-kM-ypN">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0k5-ag-cDs">
<rect key="frame" x="130" y="104" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="SjW-Pf-eqE">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="12" id="SjW-Pf-eqE">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="D8C-x9-K9r">
<rect key="frame" x="158" y="104" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="zgq-MH-EPU">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="13" id="zgq-MH-EPU">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="PoB-mM-2tx">
<rect key="frame" x="186" y="104" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="rL8-up-yxZ">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="14" id="rL8-up-yxZ">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ZtL-Xt-LHV">
<rect key="frame" x="18" y="76" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="BJS-P8-ZcH">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="15" id="BJS-P8-ZcH">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0YC-3G-c9T">
<rect key="frame" x="46" y="76" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="8Bh-8A-SSK">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="16" id="8Bh-8A-SSK">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Aof-4E-zdY">
<rect key="frame" x="74" y="76" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="R0p-8i-hVg">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="17" id="R0p-8i-hVg">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="F6A-zQ-KoW">
<rect key="frame" x="102" y="76" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="Vb2-mf-OJK">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="18" id="Vb2-mf-OJK">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="b8l-GL-5WM">
<rect key="frame" x="130" y="76" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="SCB-1h-FPK">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="19" id="SCB-1h-FPK">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0VV-le-aKe">
<rect key="frame" x="158" y="76" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="Lby-IO-ows">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="20" id="Lby-IO-ows">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ybe-SB-krS">
<rect key="frame" x="186" y="76" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="OmQ-Jl-2Lk">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="21" id="OmQ-Jl-2Lk">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="WwN-4R-03G">
<rect key="frame" x="18" y="48" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="Jup-4x-wSb">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="22" id="Jup-4x-wSb">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Its-vu-lDf">
<rect key="frame" x="46" y="48" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="9td-BC-h68">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="23" id="9td-BC-h68">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="7wZ-2x-Asj">
<rect key="frame" x="74" y="48" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="6Jy-1q-FKO">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="24" id="6Jy-1q-FKO">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="dmI-RG-m3q">
<rect key="frame" x="18" y="20" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="AMo-5j-N3n">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="29" id="AMo-5j-N3n">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="RQs-Nr-qTv">
<rect key="frame" x="46" y="20" width="25" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="6uQ-6g-T0E">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="30" id="6uQ-6g-T0E">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="BSE-c1-jzo">
<rect key="frame" x="74" y="20" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="fua-TH-zAX">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="31" id="fua-TH-zAX">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="mqn-KG-KGd">
<rect key="frame" x="102" y="48" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="7km-aF-HKr">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="25" id="7km-aF-HKr">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yoc-HU-7hU">
<rect key="frame" x="130" y="48" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="Dab-l5-57w">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="26" id="Dab-l5-57w">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="hTx-7q-RhO">
<rect key="frame" x="158" y="48" width="24" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="iVJ-MV-VR5">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="27" id="iVJ-MV-VR5">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="kmY-Mr-b4U">
<rect key="frame" x="186" y="48" width="25" height="20"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" id="um5-0V-mZu">
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="center" title="28" id="um5-0V-mZu">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
@@ -301,14 +301,14 @@
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="left" id="s5I-bn-BpO">
<font key="font" metaFont="system" size="25"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="textColor" name="controlShadowColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
<point key="canvasLocation" x="135" y="172.5"/>
</customView>
<collectionViewItem id="R1B-FF-TnR" customClass="CollectionViewItem" customModule="Graphic_Analysis_2" customModuleProvider="target">
<collectionViewItem id="R1B-FF-TnR" customClass="CollectionViewItemYear" customModule="Graphic_Analysis_2" customModuleProvider="target">
<connections>
<outlet property="day01" destination="sZs-Ok-Lxt" id="ezm-oU-RdE"/>
<outlet property="day02" destination="EMI-IW-D7N" id="OHC-pB-y85"/>
@@ -0,0 +1,44 @@
//
// CollectionViewMonth.swift
// Graphic Analysis 2
//
// Created by Kilian Hofmann on 16.06.17.
// Copyright © 2017 Kilian Hofmann. All rights reserved.
//
import Cocoa
class CollectionViewMonth: NSObject {
var days: [[FileWrapper?]] = []
var month: Int? = nil
override init() {
super.init()
}
init(days: [[FileWrapper?]]) {
super.init()
self.days = days
}
}
extension CollectionViewMonth: NSCollectionViewDataSource {
func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int {
return 31
}
func collectionView(_ itemForRepresentedObjectAtcollectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
let item = itemForRepresentedObjectAtcollectionView.makeItem(withIdentifier: "CollectionViewItemMonth", for: indexPath)
guard let item2 = item as? CollectionViewItemMonth else { return item }
item2.loss.stringValue = ""
item2.day.textColor = NSColor.controlShadowColor
item2.day.stringValue = "\(indexPath.item + 1)"
guard month != nil else { return item2 }
guard let day = days[month!][indexPath.item] else { return item2 }
item2.day.textColor = NSColor.black
guard let log = day.fileWrappers?["KDLog.txt"] else { return item2 }
guard let loss = (String(data: log.regularFileContents!, encoding: .utf8)?.components(separatedBy: "\n").count) else { return item2 }
item2.loss.stringValue = "\(loss)"
return item2
}
}
@@ -0,0 +1,64 @@
//
// CollectionViewYear.swift
// Graphic Analysis 2
//
// Created by Kilian Hofmann on 16.06.17.
// Copyright © 2017 Kilian Hofmann. All rights reserved.
//
import Cocoa
class CollectionViewYear: NSObject {
var months: [FileWrapper?] = []
var dsMonth: CollectionViewMonth = CollectionViewMonth()
var cvMonth: NSCollectionView = NSCollectionView()
let monthNames: [String] = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"]
override init() {
super.init()
}
init(months: [FileWrapper?], dataSourceMonth: CollectionViewMonth, collectionViewMonth: NSCollectionView) {
super.init()
self.months = months
self.dsMonth = dataSourceMonth
self.cvMonth = collectionViewMonth
}
}
extension CollectionViewYear: NSCollectionViewDataSource {
func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int {
return 12
}
func collectionView(_ itemForRepresentedObjectAtcollectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
let item = itemForRepresentedObjectAtcollectionView.makeItem(withIdentifier: "CollectionViewItemYear", for: indexPath)
guard let item2 = item as? CollectionViewItemYear else { return item }
if item2.isSelected {
item2.view.layer?.borderColor = NSColor.gray.cgColor
} else {
item2.view.layer?.borderColor = NSColor.clear.cgColor
}
item2.unsetDays()
item2.month.textColor = NSColor.controlShadowColor
item2.month.stringValue = monthNames[indexPath.item]
item2.monthFW = months[indexPath.item]
guard months[indexPath.item] != nil && monthNames[indexPath.item] == item2.month.stringValue else { return item2 }
item2.month.textColor = NSColor.black
item2.setDays()
return item2
}
}
extension CollectionViewYear : NSCollectionViewDelegate {
func collectionView(_ collectionView: NSCollectionView, didSelectItemsAt indexPaths: Set<IndexPath>) {
(collectionView.item(at: indexPaths.first!) as! CollectionViewItemYear).view.layer?.borderColor = NSColor.gray.cgColor
dsMonth.month = indexPaths.first?.item
cvMonth.reloadData()
}
func collectionView(_ collectionView: NSCollectionView, didDeselectItemsAt indexPaths: Set<IndexPath>) {
guard let layer = (collectionView.item(at: indexPaths.first!) as? CollectionViewItemYear)?.view.layer else { return }
layer.borderColor = NSColor.clear.cgColor
}
}
+34 -26
View File
@@ -12,11 +12,22 @@ class Document: NSDocument {
var year: FileWrapper?
var months: [FileWrapper?] = [nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil, nil]
@IBOutlet var collectionView: NSCollectionView!
var days: [[FileWrapper?]] = []
var yearDatasource: CollectionViewYear = CollectionViewYear()
var monthDatasource: CollectionViewMonth = CollectionViewMonth()
@IBOutlet var collectionViewYear: NSCollectionView!
@IBOutlet var collectionViewMonth: NSCollectionView!
override init() {
super.init()
// Add your subclass-specific initialization here.
for _ in 0..<12 {
var temp: [FileWrapper?] = []
for _ in 0..<31 {
temp.append(nil)
}
days.append(temp)
}
}
override class func autosavesInPlace() -> Bool {
@@ -30,10 +41,12 @@ class Document: NSDocument {
override func read(from fileWrapper: FileWrapper, ofType typeName: String) throws {
year = fileWrapper
for entry in fileWrapper.fileWrappers! {
guard let month = Int(entry.key) else {
continue
}
guard let month = Int(entry.key) else { continue }
months[month-1] = entry.value
for entry2 in entry.value.fileWrappers! {
guard let day = Int(entry2.key) else { continue }
days[month-1][day-1] = entry2.value
}
}
//throw NSError(domain: NSOSStatusErrorDomain, code: unimpErr, userInfo: nil)
}
@@ -42,12 +55,25 @@ class Document: NSDocument {
// Setup collection layout
let flowLayout = NSCollectionViewFlowLayout()
flowLayout.itemSize = NSSize(width: 228, height: 211)
flowLayout.sectionInset = EdgeInsets(top: 10, left: 10, bottom: 10, right: 10)
flowLayout.sectionInset = EdgeInsets(top: 10, left: 0, bottom: 10, right: 0)
flowLayout.minimumInteritemSpacing = 10
flowLayout.minimumLineSpacing = 10
collectionView.collectionViewLayout = flowLayout
collectionViewYear.collectionViewLayout = flowLayout
let flowLayout2 = NSCollectionViewFlowLayout()
flowLayout2.itemSize = NSSize(width: 135, height: 132)
flowLayout2.sectionInset = EdgeInsets(top: 2, left: 2, bottom: 2, right: 2)
flowLayout2.minimumInteritemSpacing = 2
flowLayout2.minimumLineSpacing = 2
collectionViewMonth.collectionViewLayout = flowLayout2
// Performance
collectionView.superview?.wantsLayer = true
windowController.window?.contentView?.wantsLayer = true
// Data sources and delegate
monthDatasource = CollectionViewMonth(days: days)
yearDatasource = CollectionViewYear(months: months, dataSourceMonth: monthDatasource, collectionViewMonth: collectionViewMonth)
collectionViewYear.dataSource = yearDatasource
collectionViewYear.delegate = yearDatasource
collectionViewMonth.dataSource = monthDatasource
//collectionViewMonth.delegate = monthDatasource
}
override func shouldCloseWindowController(_ windowController: NSWindowController, delegate: Any?, shouldClose shouldCloseSelector: Selector?, contextInfo: UnsafeMutableRawPointer?) {
@@ -55,21 +81,3 @@ class Document: NSDocument {
}
}
extension Document : NSCollectionViewDataSource {
func collectionView(_ collectionView: NSCollectionView, numberOfItemsInSection section: Int) -> Int {
return 12
}
func collectionView(_ itemForRepresentedObjectAtcollectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
let item = collectionView.makeItem(withIdentifier: "CollectionViewItem", for: indexPath)
guard let item2 = item as? CollectionViewItem else {return item }
guard months[indexPath.item] != nil else { return item }
item2.month.stringValue = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"][indexPath.item]
item2.monthFW = months[indexPath.item]
item2.setDays()
return item2
}
}
+36 -11
View File
@@ -8,7 +8,8 @@
<objects>
<customObject id="-2" userLabel="File's Owner" customClass="Document" customModule="Graphic_Analysis_2" customModuleProvider="target">
<connections>
<outlet property="collectionView" destination="hax-ty-I75" id="7Px-cK-MF9"/>
<outlet property="collectionViewMonth" destination="hax-ty-I75" id="5UC-K2-fXz"/>
<outlet property="collectionViewYear" destination="QrY-5g-8Dh" id="fP5-J7-IUa"/>
<outlet property="window" destination="QvC-M9-y7g" id="rV3-WO-9Cg"/>
</connections>
</customObject>
@@ -17,31 +18,28 @@
<window title="Window" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" animationBehavior="default" id="QvC-M9-y7g">
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
<rect key="contentRect" x="0.0" y="87" width="1004" height="715"/>
<rect key="contentRect" x="0.0" y="87" width="1272" height="715"/>
<rect key="screenRect" x="0.0" y="0.0" width="1280" height="800"/>
<value key="minSize" type="size" width="1004" height="715"/>
<value key="maxSize" type="size" width="1004" height="715"/>
<value key="minSize" type="size" width="1272" height="715"/>
<value key="maxSize" type="size" width="1272" height="715"/>
<view key="contentView" wantsLayer="YES" id="EiT-Mj-1SZ">
<rect key="frame" x="0.0" y="0.0" width="1004" height="715"/>
<rect key="frame" x="0.0" y="0.0" width="1272" height="715"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<scrollView wantsLayer="YES" fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" horizontalScrollElasticity="none" verticalScrollElasticity="none" translatesAutoresizingMaskIntoConstraints="NO" id="v0h-Ac-Zdb">
<rect key="frame" x="20" y="20" width="964" height="675"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" id="mfx-sA-NT9">
<rect key="frame" x="1" y="1" width="962" height="673"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView ambiguous="YES" selectable="YES" id="hax-ty-I75">
<collectionView identifier="month" ambiguous="YES" selectable="YES" id="hax-ty-I75">
<rect key="frame" x="0.0" y="0.0" width="962" height="673"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="Cyq-5W-OO3">
<size key="itemSize" width="50" height="50"/>
</collectionViewFlowLayout>
<color key="primaryBackgroundColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
<connections>
<outlet property="dataSource" destination="-2" id="F4c-OR-MlY"/>
</connections>
</collectionView>
</subviews>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
@@ -55,12 +53,39 @@
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
<scrollView wantsLayer="YES" fixedFrame="YES" autohidesScrollers="YES" horizontalLineScroll="10" horizontalPageScroll="10" verticalLineScroll="10" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="p0d-ZT-icQ">
<rect key="frame" x="1004" y="20" width="248" height="675"/>
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxX="YES" flexibleMinY="YES" flexibleMaxY="YES"/>
<clipView key="contentView" ambiguous="YES" drawsBackground="NO" id="x8z-Ha-RAr">
<rect key="frame" x="1" y="1" width="246" height="673"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<collectionView identifier="year" ambiguous="YES" selectable="YES" id="QrY-5g-8Dh">
<rect key="frame" x="0.0" y="0.0" width="246" height="673"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumInteritemSpacing="10" minimumLineSpacing="10" id="y3w-79-aAH">
<size key="itemSize" width="50" height="50"/>
</collectionViewFlowLayout>
<color key="primaryBackgroundColor" name="windowBackgroundColor" catalog="System" colorSpace="catalog"/>
</collectionView>
</subviews>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</clipView>
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="B1S-Pw-6W0">
<rect key="frame" x="1" y="143" width="225" height="16"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" doubleValue="1" horizontal="NO" id="whY-aM-cDe">
<rect key="frame" x="234" y="1" width="15" height="143"/>
<autoresizingMask key="autoresizingMask"/>
</scroller>
</scrollView>
</subviews>
</view>
<connections>
<outlet property="delegate" destination="-2" id="BPU-SZ-Fs4"/>
</connections>
<point key="canvasLocation" x="109" y="61"/>
<point key="canvasLocation" x="224" y="60.5"/>
</window>
</objects>
</document>
@@ -1,6 +1,6 @@
//
// GraphDetailsController.swift
// Graphic Analysis 2
// Graphic Analysis
//
// Created by Kilian Hofmann on 12.09.16.
// Copyright © 2016 Kilian Hofmann. All rights reserved.
+1 -1
View File
@@ -44,7 +44,7 @@
<key>CFBundleShortVersionString</key>
<string>2.0</string>
<key>CFBundleVersion</key>
<string>74</string>
<string>157</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
+1 -1
View File
@@ -1,2 +1,2 @@
version 2.0
build 74
build 157