Skip to content

Commit

Permalink
Merge branch 'arc' into App-Store-1.9.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nickv2002 committed Dec 19, 2020
2 parents b4cfe32 + ee9c81e commit 8521677
Show file tree
Hide file tree
Showing 62 changed files with 245 additions and 284 deletions.
17 changes: 0 additions & 17 deletions Classes/Helpers/CenteredTextLayer.h

This file was deleted.

24 changes: 0 additions & 24 deletions Classes/Helpers/CenteredTextLayer.m

This file was deleted.

24 changes: 24 additions & 0 deletions Classes/Helpers/CenteredTextLayer.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// CenteredTextLayer.swift
// Simple Comic
//
// Created by J-rg on 09.12.20.
// Copyright © 2020 Dancing Tortoise Software. All rights reserved.
//

import QuartzCore

@objc
class CenteredTextLayer: CATextLayer {

override func draw(in ctx: CGContext) {
let height = bounds.size.height
let fontSize = self.fontSize
let yDiff = (height - fontSize) / 2 - fontSize / 10

ctx.saveGState()
ctx.translateBy(x: 0, y: -yDiff)
super.draw(in: ctx)
ctx.restoreGState()
}
}
13 changes: 0 additions & 13 deletions Classes/Preferences/DTPreferencesController.h

This file was deleted.

19 changes: 0 additions & 19 deletions Classes/Preferences/DTPreferencesController.m

This file was deleted.

16 changes: 16 additions & 0 deletions Classes/Preferences/DTPreferencesController.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//
// DTPreferencesController.swift
// Simple Comic
//
// Created by J-rg on 20.04.20.
// Copyright © 2020 Dancing Tortoise Software. All rights reserved.
//

import Cocoa

class DTPreferencesController: NSWindowController {

convenience init() {
self.init(windowNibName: "Preferences")
}
}
18 changes: 0 additions & 18 deletions Classes/Session/DTToolbarItems.h

This file was deleted.

40 changes: 0 additions & 40 deletions Classes/Session/DTToolbarItems.m

This file was deleted.

37 changes: 37 additions & 0 deletions Classes/Session/DTToolbarItems.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//
// DTToolbarItems.swift
// Simple Comic
//
// Created by J-rg on 09.12.20.
// Copyright © 2020 Dancing Tortoise Software. All rights reserved.
//

import Cocoa

class DTToolbarItem: NSToolbarItem {

override func validate() {
guard let toolbarDelegate = toolbar?.delegate as? TSSTSessionWindowController else { return }

if toolbarDelegate.responds(to: #selector(getter: TSSTSessionWindowController.pageSelectionInProgress)) {
(view as? NSControl)?.isEnabled = !(toolbarDelegate.pageSelectionInProgress)
}
}
}

class DTPageTurnToolbarItem: DTToolbarItem {

override func validate() {
guard let toolbarDelegate = toolbar?.delegate as? TSSTSessionWindowController else { return }

if toolbarDelegate.responds(to: #selector(getter: TSSTSessionWindowController.canTurnPageLeft)) {
(view as? NSSegmentedControl)?.setEnabled(toolbarDelegate.canTurnPageLeft, forSegment: 0)
}

if toolbarDelegate.responds(to: #selector(getter: TSSTSessionWindowController.canTurnPageRight)) {
(view as? NSSegmentedControl)?.setEnabled(toolbarDelegate.canTurnPageRight, forSegment: 1)
}

super.validate()
}
}
16 changes: 0 additions & 16 deletions Classes/Session/DTWindowCategory.h

This file was deleted.

25 changes: 0 additions & 25 deletions Classes/Session/DTWindowCategory.m

This file was deleted.

25 changes: 25 additions & 0 deletions Classes/Session/NSWindow+Extensions.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
//
// DTWindowCategory.swift
// Simple Comic
//
// Created by J-rg on 21.11.20.
// Copyright © 2020 Dancing Tortoise Software. All rights reserved.
//

import Cocoa

@objc
extension NSWindow {

var toolbarHeight: CGFloat {
get {
return frame.height - contentRect(forFrameRect: frame).height
}
}

var isFullscreen: Bool {
get {
return styleMask.contains(.fullScreen)
}
}
}
2 changes: 1 addition & 1 deletion Classes/Session/TSSTPageView.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
#import "SimpleComicAppDelegate.h"
#import "TSSTSessionWindowController.h"
#import "TSSTManagedSession.h"
#import "CenteredTextLayer.h"
#import "Simple_Comic-Swift.h"

typedef NS_ENUM(int, TSSTTurn) {
TSSTTurnNone = 0,
Expand Down
1 change: 0 additions & 1 deletion Classes/Session/TSSTSessionWindowController.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ typedef NS_ENUM(NSInteger, PageSelectionMode) {

@property (copy) NSArray<NSSortDescriptor*> * pageSortDescriptor;
@property (assign) NSInteger pageTurn;
@property (copy) NSString * pageNames;

- (instancetype)initWithSession:(TSSTManagedSession *)aSession;

Expand Down
11 changes: 7 additions & 4 deletions Classes/Session/TSSTSessionWindowController.m
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#import "TSSTPage.h"
#import "TSSTManagedGroup.h"
#import "TSSTManagedSession.h"
#import "DTWindowCategory.h"

#import "Simple_Comic-Swift.h"

Expand All @@ -39,7 +38,6 @@ @implementation TSSTSessionWindowController
TSSTManagedSession * session;

/** This var is bound to the session window name */
NSString *pageNames;
NSInteger pageTurn;

/** Exactly what it sounds like */
Expand All @@ -54,7 +52,7 @@ @implementation TSSTSessionWindowController
CGFloat savedZoom;
}

@synthesize pageTurn, pageNames, pageSortDescriptor;
@synthesize pageTurn, pageSortDescriptor;
@synthesize pageController;
@synthesize pageView;
@synthesize pageScrollView;
Expand Down Expand Up @@ -1040,7 +1038,12 @@ - (void)changeViewImages
titleString = [NSString stringWithFormat:@"%@ — %@", fileName, titleString];
}
}
self.pageNames = titleString;
if (@available(macOS 11.0, *)) {
self.window.title = fileName;
self.window.subtitle = [titleString stringByReplacingOccurrencesOfString:[NSString stringWithFormat:@"%@ — ", fileName] withString:@""];
} else {
self.window.title = titleString;
}
[pageView setFirstPage: pageOne.pageImage secondPageImage: pageTwo.pageImage];

[self scaleToWindow];
Expand Down
1 change: 0 additions & 1 deletion Classes/SimpleComicAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#import "TSSTManagedGroup.h"
#import "TSSTManagedSession.h"
#import "TSSTCustomValueTransformers.h"
#import "DTPreferencesController.h"
#import "Simple_Comic-Swift.h"
#import "TSSTManagedSession+CoreDataProperties.h"
#import <WebPMac/TSSTWebPImageRep.h>
Expand Down
Loading

0 comments on commit 8521677

Please sign in to comment.