Skip to content

Commit

Permalink
add documentIcon, default font, default background color, update samp…
Browse files Browse the repository at this point in the history
…le documents
  • Loading branch information
Patrick-Kladek committed Dec 21, 2017
1 parent 0a1a63c commit 4fc8d42
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion Sample Project/iPad Pro 10_5.frame
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{
"color" : null,
"file" : "$language\/screenshots.strings",
"font" : "Paul Grotesk Soft Medium",
"font" : "",
"fontSize" : 90,
"frame" : "{{0, 1490}, {2224, 130}}",
"isRoot" : false,
Expand Down
2 changes: 1 addition & 1 deletion Sample Project/iPad Pro 12_9.frame
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{
"color" : null,
"file" : "$language\/screenshots.strings",
"font" : "Paul Grotesk Soft Medium",
"font" : "",
"fontSize" : 90,
"frame" : "{{0, 1830}, {2732, 150}}",
"isRoot" : false,
Expand Down
2 changes: 1 addition & 1 deletion Sample Project/iPhone 8 Plus.frame
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{
"color" : null,
"file" : "$language\/screenshots.strings",
"font" : "Paul Grotesk Soft Medium",
"font" : "",
"fontSize" : 80,
"frame" : "{{0, 1980}, {1242, 140}}",
"isRoot" : false,
Expand Down
2 changes: 1 addition & 1 deletion Sample Project/iPhone 8.frame
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{
"color" : null,
"file" : "$language\/screenshots.strings",
"font" : "Paul Grotesk Soft Medium",
"font" : "",
"fontSize" : 45,
"frame" : "{{0, 1225}, {750, 70}}",
"isRoot" : false,
Expand Down
2 changes: 1 addition & 1 deletion Sample Project/iPhone SE.frame
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
{
"color" : "#FFFFFFFF",
"file" : "$language\/screenshots.strings",
"font" : "Paul Grotesk Soft Medium",
"font" : "",
"fontSize" : 45,
"frame" : "{{0, 1035}, {640, 70}}",
"isRoot" : false,
Expand Down
4 changes: 4 additions & 0 deletions Screenshot Framer.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
CDB6590F1FE3DAF800430F20 /* NSColor+Hex.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB6590E1FE3DAF800430F20 /* NSColor+Hex.swift */; };
CDB659111FE3F00000430F20 /* MNCoalescing.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB659101FE3F00000430F20 /* MNCoalescing.swift */; };
CDB659131FE4268200430F20 /* FileController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDB659121FE4268200430F20 /* FileController.swift */; };
CDE9C3541FEBDBD100168B40 /* Document Icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = CDE9C3531FEBDBD100168B40 /* Document Icon.icns */; };
CDFF69981FD827B800E652EE /* ScreenshotFramerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CDFF69971FD827B800E652EE /* ScreenshotFramerTests.swift */; };
CDFF699F1FD827D900E652EE /* LayerStateHistory.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD26F83C1FCEEB1C00449B4A /* LayerStateHistory.swift */; };
CDFF69A01FD8280100E652EE /* LayerState.swift in Sources */ = {isa = PBXBuildFile; fileRef = CD26F83A1FCEE01800449B4A /* LayerState.swift */; };
Expand Down Expand Up @@ -85,6 +86,7 @@
CDB6590E1FE3DAF800430F20 /* NSColor+Hex.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSColor+Hex.swift"; sourceTree = "<group>"; };
CDB659101FE3F00000430F20 /* MNCoalescing.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MNCoalescing.swift; sourceTree = "<group>"; };
CDB659121FE4268200430F20 /* FileController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileController.swift; sourceTree = "<group>"; };
CDE9C3531FEBDBD100168B40 /* Document Icon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = "Document Icon.icns"; sourceTree = "<group>"; };
CDFF69951FD827B800E652EE /* Screenshot FramerTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "Screenshot FramerTests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; };
CDFF69971FD827B800E652EE /* ScreenshotFramerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScreenshotFramerTests.swift; sourceTree = "<group>"; };
CDFF69991FD827B800E652EE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -200,6 +202,7 @@
children = (
CD5EE0461FCD557200AD2ED7 /* Assets.xcassets */,
CDFF69A91FD849E300E652EE /* CenterClipView.swift */,
CDE9C3531FEBDBD100168B40 /* Document Icon.icns */,
CD5EE04C1FCD557200AD2ED7 /* Framer.entitlements */,
CD5EE04B1FCD557200AD2ED7 /* Info.plist */,
CD5EE0481FCD557200AD2ED7 /* MainMenu.xib */,
Expand Down Expand Up @@ -332,6 +335,7 @@
buildActionMask = 2147483647;
files = (
CD2EC1CC1FD7F10800C17756 /* ContentViewController.xib in Resources */,
CDE9C3541FEBDBD100168B40 /* Document Icon.icns in Resources */,
CD5EE0471FCD557200AD2ED7 /* Assets.xcassets in Resources */,
CD5EE0451FCD557200AD2ED7 /* DocumentWindowController.xib in Resources */,
CDFF69A61FD834AE00E652EE /* TimeTravelWindowController.xib in Resources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class LayoutController {

let firstLayoutableObject = layoutableObjects[0]
let rootView = self.view(from: firstLayoutableObject)
(rootView as? pkView)?.backgroundColor = NSColor.lightGray

for object in layoutableObjects where object != layoutableObjects[0] {
let view: NSView
Expand All @@ -59,7 +60,6 @@ class LayoutController {

rootView.addSubview(view)
}

return rootView
}
}
Expand Down Expand Up @@ -87,16 +87,13 @@ private extension LayoutController {
textField.backgroundColor = NSColor.red
}

if let font = NSFont(name: object.font ?? "", size: object.fontSize ?? 25) {
textField.font = font
}
textField.font = self.font(for: object)

if let color = object.color {
textField.textColor = color
}

self.limitFontSize(for: textField)

return textField
}

Expand All @@ -121,7 +118,6 @@ private extension LayoutController {
size = string.size(withAttributes: [NSAttributedStringKey.font: newFont])
textField.font = newFont
}

return limited
}

Expand All @@ -139,4 +135,19 @@ private extension LayoutController {
return view
}
}

func font(for object: LayoutableObject) -> NSFont? {
var fontName: String?

if let fontFamily = object.font {
fontName = fontFamily
}

if fontName == nil || fontName?.count == 0 {
fontName = "Helvetica Neue"
}

let font = NSFont(name: fontName!, size: object.fontSize ?? 25)
return font
}
}
Binary file not shown.
2 changes: 1 addition & 1 deletion Screenshot Framer/Supporting Files/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<string>frame</string>
</array>
<key>CFBundleTypeIconFile</key>
<string></string>
<string>Document Icon</string>
<key>CFBundleTypeName</key>
<string>DocumentType</string>
<key>CFBundleTypeOSTypes</key>
Expand Down

0 comments on commit 4fc8d42

Please sign in to comment.