Skip to content

Commit

Permalink
release 2.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Belyaev committed Dec 31, 2020
1 parent 63470ac commit d8ecf99
Show file tree
Hide file tree
Showing 8 changed files with 827 additions and 115 deletions.
519 changes: 431 additions & 88 deletions Base.lproj/Main.storyboard

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions RDM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
358F04E3212D7E6500671ABD /* IOKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 358F04E2212D7E6500671ABD /* IOKit.framework */; };
35959C0225757F1E0002A45F /* HexNumberFormatter.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35959C0125757F1E0002A45F /* HexNumberFormatter.swift */; };
35959C0525763EE40002A45F /* TextFieldWithMonospacedDigits.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35959C0425763EE40002A45F /* TextFieldWithMonospacedDigits.swift */; };
35B19E282589F79500ED61D7 /* DisplayIcon.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35B19E272589F79500ED61D7 /* DisplayIcon.swift */; };
35C9D3B0212C04DA00D652F7 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 35C9D3AF212C04DA00D652F7 /* ViewController.swift */; };
35C9D3B2212C04DD00D652F7 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 35C9D3B1212C04DD00D652F7 /* Assets.xcassets */; };
35C9D3B5212C04DD00D652F7 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 35C9D3B3212C04DD00D652F7 /* Main.storyboard */; };
Expand Down Expand Up @@ -44,6 +45,7 @@
358F04E2212D7E6500671ABD /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; };
35959C0125757F1E0002A45F /* HexNumberFormatter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HexNumberFormatter.swift; sourceTree = "<group>"; };
35959C0425763EE40002A45F /* TextFieldWithMonospacedDigits.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldWithMonospacedDigits.swift; sourceTree = "<group>"; };
35B19E272589F79500ED61D7 /* DisplayIcon.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DisplayIcon.swift; sourceTree = "<group>"; };
35C9D3AB212C04DA00D652F7 /* RDM.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = RDM.app; sourceTree = BUILT_PRODUCTS_DIR; };
35C9D3AF212C04DA00D652F7 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
35C9D3B1212C04DD00D652F7 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
Expand Down Expand Up @@ -126,6 +128,7 @@
35CC4996212C54AF00704BD7 /* bridging.h */,
35959C0125757F1E0002A45F /* HexNumberFormatter.swift */,
35959C0425763EE40002A45F /* TextFieldWithMonospacedDigits.swift */,
35B19E272589F79500ED61D7 /* DisplayIcon.swift */,
);
path = src;
sourceTree = "<group>";
Expand Down Expand Up @@ -229,6 +232,7 @@
8FC72A1E24F664BA004E10E1 /* Utils.swift in Sources */,
35959C0525763EE40002A45F /* TextFieldWithMonospacedDigits.swift in Sources */,
358D565D212DEDED00F9E9BF /* cmdline.mm in Sources */,
35B19E282589F79500ED61D7 /* DisplayIcon.swift in Sources */,
35C9D3B0212C04DA00D652F7 /* ViewController.swift in Sources */,
358D565E212DEDED00F9E9BF /* main.mm in Sources */,
8F48E61724FC761C0073123B /* RestoreSettings.swift in Sources */,
Expand Down Expand Up @@ -374,6 +378,7 @@
INFOPLIST_FILE = etc/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MARKETING_VERSION = 2.5.0;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = net.alkalay.RDM;
Expand All @@ -399,6 +404,7 @@
INFOPLIST_FILE = etc/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.10;
MARKETING_VERSION = 2.5.0;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = net.alkalay.RDM;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
2 changes: 1 addition & 1 deletion etc/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>2.4.0</string>
<string>$(MARKETING_VERSION)</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
116 changes: 116 additions & 0 deletions src/DisplayIcon.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
//
// DisplayIcon.swift
// RDM
//
// Created by usrsse2 on 16.12.2020.
// Copyright © 2020 гык-sse2. All rights reserved.
//

import Cocoa

public let kDisplayIcon = "display-icon"
public let kDisplayResolutionPreviewIcon = "display-resolution-preview-icon"

public let kResolutionPreviewWidth = "resolution-preview-width"
public let kResolutionPreviewHeight = "resolution-preview-height"
public let kResolutionPreviewX = "resolution-preview-x"
public let kResolutionPreviewY = "resolution-preview-y"

class DisplayIcon : NSObject
{
@objc var Properties : [String : AnyHashable]

@objc var DisplayIcon : NSImage? {
get {
if let imagePath = Properties[kDisplayIcon] as? String {
return NSImage(contentsOfFile: imagePath)
}
return nil
}
}

@objc var DisplayResolutionPreviewIcon : NSImage? {
get {
if let imagePath = Properties[kDisplayResolutionPreviewIcon] as? String {
return NSImage(contentsOfFile: imagePath)
}
return nil
}
}

private func GetValueOrZero(forKey key: String) -> Int {
if let i = Properties[key] as? Int {
return i
}
return 0
}

private func SetOrRemoveValue(forKey key: String, value: Int) {
if value == 0 {
Properties.removeValue(forKey: key)
}
else {
Properties[key] = value
}
}

@objc var ResolutionPreviewWidth : Int {
get {
return GetValueOrZero(forKey: kResolutionPreviewWidth)
}
set(value) {
SetOrRemoveValue(forKey: kResolutionPreviewWidth, value: value)
}
}

@objc var ResolutionPreviewHeight : Int {
get {
return GetValueOrZero(forKey: kResolutionPreviewHeight)
}
set(value) {
SetOrRemoveValue(forKey: kResolutionPreviewHeight, value: value)
}
}

@objc var ResolutionPreviewX : Int {
get {
return GetValueOrZero(forKey: kResolutionPreviewX)
}
set(value) {
SetOrRemoveValue(forKey: kResolutionPreviewX, value: value)
}
}

@objc var ResolutionPreviewY : Int {
get {
return GetValueOrZero(forKey: kResolutionPreviewY)
}
set(value) {
SetOrRemoveValue(forKey: kResolutionPreviewY, value: value)
}
}

init(properties : [String : AnyHashable]) {
Properties = properties
}

static func ==(lhs: DisplayIcon, rhs: DisplayIcon) -> Bool {
return lhs.Properties == rhs.Properties
}

override func isEqual(_ object: Any?) -> Bool {
if let other = object as? DisplayIcon {
return
Properties == other.Properties ||
Properties.filter({$0.key != kDisplayResolutionPreviewIcon && $0.key != kDisplayIcon}) == other.Properties.filter({$0.key != kDisplayResolutionPreviewIcon && $0.key != kDisplayIcon}) &&
DisplayResolutionPreviewIcon?.tiffRepresentation == other.DisplayResolutionPreviewIcon?.tiffRepresentation &&
DisplayIcon?.tiffRepresentation == other.DisplayIcon?.tiffRepresentation
}
return false
}

override var hash: Int {
return 0 // Properties.hashValue //Int(_width | _height | (UInt32)(_hiDPIFlag & 0xffffffff))
}

}
10 changes: 5 additions & 5 deletions src/RDMAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,11 @@ - (void) refreshStatusMenu
productID:CGDisplayModelNumber(display)
displayName:screenName]];

[submenu addItem:[[RestoreSettingsItem alloc] initWithTitle:@"Restore..."
action:@selector(restoreSettings:)
vendorID:CGDisplayVendorNumber(display)
productID:CGDisplayModelNumber(display)
displayName:screenName]];
//[submenu addItem:[[RestoreSettingsItem alloc] initWithTitle:@"Restore..."
// action:@selector(restoreSettings:)
// vendorID:CGDisplayVendorNumber(display)
// productID:CGDisplayModelNumber(display)
// displayName:screenName]];

NSString* title = [currItem title];

Expand Down
29 changes: 26 additions & 3 deletions src/Resolution.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@
import Foundation

let kFlagHiDPI : UInt64 = 0x0000000100000000
let kFlagUnknown1 : UInt64 = 0x0000000000020000
let kFlagUnknown1 : UInt64 = 0x0000000000200000
let kFlagRetinaDisplay : UInt64 = 0x0000000800000000
let kFlagUnknown2 : UInt64 = 0x0000000000080000
let kFlagUnknown2 : UInt64 = 0x0000000000800000
let kFlagUnknown3 : UInt64 = 0x0000000200000000

@objc class Resolution : NSObject {
private var _width : UInt32
Expand Down Expand Up @@ -68,6 +69,7 @@ let kFlagUnknown2 : UInt64 = 0x0000000000080000
willChangeValue(forKey: "Retina")
willChangeValue(forKey: "Unknown1")
willChangeValue(forKey: "Unknown2")
willChangeValue(forKey: "Unknown3")
let wasHiDPI = isHiDPI
_hiDPIFlag = value
if isHiDPI != wasHiDPI {
Expand All @@ -83,6 +85,7 @@ let kFlagUnknown2 : UInt64 = 0x0000000000080000
didChangeValue(forKey: "Retina")
didChangeValue(forKey: "Unknown1")
didChangeValue(forKey: "Unknown2")
didChangeValue(forKey: "Unknown3")
}
}

Expand Down Expand Up @@ -122,10 +125,19 @@ let kFlagUnknown2 : UInt64 = 0x0000000000080000
}
}

@objc dynamic var Unknown3 : Bool {
get {
return RawFlags & kFlagUnknown3 != 0
}
set(value) {
setFlag(kFlagUnknown3, value)
}
}

override init() {
self._width = 0
self._height = 0
self._hiDPIFlag = 0
self._hiDPIFlag = kFlagRetinaDisplay | kFlagHiDPI | kFlagUnknown1

super.init()
}
Expand Down Expand Up @@ -182,4 +194,15 @@ let kFlagUnknown2 : UInt64 = 0x0000000000080000
&& (lhs._width == rhs._width )
&& (lhs._hiDPIFlag == rhs._hiDPIFlag)
}

override func isEqual(_ object: Any?) -> Bool {
if let other = object as? Resolution {
return _width == other._width && _height == other._height && _hiDPIFlag == other._hiDPIFlag
}
return false
}

override var hash: Int {
return 0 //Int(_width | _height | (UInt32)(_hiDPIFlag & 0xffffffff))
}
}
4 changes: 2 additions & 2 deletions src/SheetViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ import Cocoa
super.viewWillAppear()

_parent = (presentingViewController as! ViewController)
if _parent.arrayController.selectionIndexes.count > 0 {
_resolution = _parent.resolutions[_parent.arrayController.selectionIndex]
if _parent.arrayController.selectionIndexes.count == 1 {
_resolution = _parent.arrayController.selectedObjects.first as! Resolution
}

widthField .integerValue = Int(width)
Expand Down
Loading

0 comments on commit d8ecf99

Please sign in to comment.