Skip to content

Commit

Permalink
More Objc to Swift
Browse files Browse the repository at this point in the history
  • Loading branch information
cochrane committed May 1, 2024
1 parent 4339f34 commit 4f6654a
Show file tree
Hide file tree
Showing 6 changed files with 52 additions and 70 deletions.
10 changes: 4 additions & 6 deletions GLLara.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
5214470D16DC2312003E260F /* GLLItem+MeshExport.m in Sources */ = {isa = PBXBuildFile; fileRef = 5214470C16DC2312003E260F /* GLLItem+MeshExport.m */; };
5214471116DE22E1003E260F /* GLLara.help in Resources */ = {isa = PBXBuildFile; fileRef = 5214471016DE22E0003E260F /* GLLara.help */; };
52152CEF16B66951001AE54C /* GLLDDSFile.m in Sources */ = {isa = PBXBuildFile; fileRef = 52152CEE16B66951001AE54C /* GLLDDSFile.m */; };
52232EAC1EFC459E007FE9AD /* GLLDropTargetView.m in Sources */ = {isa = PBXBuildFile; fileRef = 52232EAB1EFC459E007FE9AD /* GLLDropTargetView.m */; };
52232EAE1EFC57D4007FE9AD /* XYAlignedSquare.obj in Resources */ = {isa = PBXBuildFile; fileRef = 52232EAD1EFC57D4007FE9AD /* XYAlignedSquare.obj */; };
5224C8E615FA4F18002A6C76 /* GLLDirectionalLight.m in Sources */ = {isa = PBXBuildFile; fileRef = 5224C8E515FA4F18002A6C76 /* GLLDirectionalLight.m */; };
5224C8EE15FA8FB0002A6C76 /* GLLAngleRangeValueTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = 5224C8ED15FA8FB0002A6C76 /* GLLAngleRangeValueTransformer.m */; };
Expand Down Expand Up @@ -273,6 +272,7 @@
52AC5DC62876F315004949D4 /* CopyDepth.metal in Sources */ = {isa = PBXBuildFile; fileRef = 52AC5DC52876F315004949D4 /* CopyDepth.metal */; };
52AF115615FCD4A000DF2565 /* GLLCameraTarget.m in Sources */ = {isa = PBXBuildFile; fileRef = 52AF115515FCD4A000DF2565 /* GLLCameraTarget.m */; };
52B6C51F2BE28DE7005E53CE /* GLLItemDragDestination.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B6C51E2BE28DE7005E53CE /* GLLItemDragDestination.swift */; };
52B6C5212BE2947B005E53CE /* GLLDropTargetView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 52B6C5202BE2947B005E53CE /* GLLDropTargetView.swift */; };
52B9E0781602086D00641518 /* objFileParameters.modelparams.plist in Resources */ = {isa = PBXBuildFile; fileRef = 52B9E0771602086D00641518 /* objFileParameters.modelparams.plist */; };
52B9E0AE1602815800641518 /* RenderParameters.strings in Resources */ = {isa = PBXBuildFile; fileRef = 52B9E0B01602815800641518 /* RenderParameters.strings */; };
52BB206815F8275E00937450 /* doppelganger.modelparams.plist in Resources */ = {isa = PBXBuildFile; fileRef = 52BB206715F8275E00937450 /* doppelganger.modelparams.plist */; };
Expand Down Expand Up @@ -411,8 +411,6 @@
5214471016DE22E0003E260F /* GLLara.help */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = GLLara.help; sourceTree = "<group>"; };
52152CED16B66951001AE54C /* GLLDDSFile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLLDDSFile.h; sourceTree = "<group>"; };
52152CEE16B66951001AE54C /* GLLDDSFile.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLLDDSFile.m; sourceTree = "<group>"; };
52232EAA1EFC459E007FE9AD /* GLLDropTargetView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = GLLDropTargetView.h; sourceTree = "<group>"; };
52232EAB1EFC459E007FE9AD /* GLLDropTargetView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = GLLDropTargetView.m; sourceTree = "<group>"; };
52232EAD1EFC57D4007FE9AD /* XYAlignedSquare.obj */ = {isa = PBXFileReference; lastKnownFileType = text; name = XYAlignedSquare.obj; path = Shaders/XYAlignedSquare.obj; sourceTree = "<group>"; };
5224C8E415FA4F18002A6C76 /* GLLDirectionalLight.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLLDirectionalLight.h; sourceTree = "<group>"; };
5224C8E515FA4F18002A6C76 /* GLLDirectionalLight.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLLDirectionalLight.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -756,6 +754,7 @@
52AF115415FCD4A000DF2565 /* GLLCameraTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GLLCameraTarget.h; sourceTree = "<group>"; };
52AF115515FCD4A000DF2565 /* GLLCameraTarget.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GLLCameraTarget.m; sourceTree = "<group>"; };
52B6C51E2BE28DE7005E53CE /* GLLItemDragDestination.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GLLItemDragDestination.swift; sourceTree = "<group>"; };
52B6C5202BE2947B005E53CE /* GLLDropTargetView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GLLDropTargetView.swift; sourceTree = "<group>"; };
52B9E0771602086D00641518 /* objFileParameters.modelparams.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = objFileParameters.modelparams.plist; path = ../Shaders/objFileParameters.modelparams.plist; sourceTree = "<group>"; };
52B9E09616027FC800641518 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
52B9E0AF1602815800641518 /* en */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/RenderParameters.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1508,8 +1507,6 @@
5213F8801C0E411C007A9EBB /* GLLPreferencesWindowController.h */,
5213F8811C0E411C007A9EBB /* GLLPreferencesWindowController.m */,
5213F88A1C0E478C007A9EBB /* GLLPreferencesWindow.xib */,
52232EAA1EFC459E007FE9AD /* GLLDropTargetView.h */,
52232EAB1EFC459E007FE9AD /* GLLDropTargetView.m */,
52301E312087E6FC00B3E331 /* GLLOptionalPartView.xib */,
52301E332087E71400B3E331 /* GLLOptionalPartViewController.h */,
52301E342087E71400B3E331 /* GLLOptionalPartViewController.m */,
Expand All @@ -1535,6 +1532,7 @@
52D18D5029A2716400BE2815 /* GLLConnexionManager.h */,
52D18D5129A2716400BE2815 /* GLLConnexionManager.m */,
52B6C51E2BE28DE7005E53CE /* GLLItemDragDestination.swift */,
52B6C5202BE2947B005E53CE /* GLLDropTargetView.swift */,
);
name = "Document and UI";
sourceTree = "<group>";
Expand Down Expand Up @@ -1945,12 +1943,12 @@
526AB31C1609C7C300940A74 /* GLLItem+OBJExport.m in Sources */,
525BF29D287A0AE200E30D48 /* GLLView.swift in Sources */,
52CDFEE42875B46700BC4298 /* GLLSceneDrawer.swift in Sources */,
52232EAC1EFC459E007FE9AD /* GLLDropTargetView.m in Sources */,
52301E352087E71400B3E331 /* GLLOptionalPartViewController.m in Sources */,
52B6C51F2BE28DE7005E53CE /* GLLItemDragDestination.swift in Sources */,
52F73EA8288BE06600A580EC /* GLLDrawingPreferencesViewController.swift in Sources */,
52C3AD8C29A13DEB002EC334 /* WillinglyBlock.swift in Sources */,
52F73EA6288BDFC000A580EC /* GLLNoSelectionViewController.swift in Sources */,
52B6C5212BE2947B005E53CE /* GLLDropTargetView.swift in Sources */,
52D8DDDE2621CFF10006F0E5 /* GLLMeshSplitter.swift in Sources */,
524BEB0D1612551800EA061D /* NSColor+Color32Bit.m in Sources */,
522783B31C0B91EF002E43FD /* GLLItemMeshSelectionPlaceholder.m in Sources */,
Expand Down
7 changes: 4 additions & 3 deletions GLLara/Base.lproj/GLLNoSelectionView.xib
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="20037" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="32700.99.1234" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="20037"/>
<deployment identifier="macosx"/>
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="22689"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<objects>
Expand All @@ -12,7 +13,7 @@
</customObject>
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="1" customClass="GLLDropTargetView">
<customView id="1" customClass="GLLDropTargetView" customModule="GLLara" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="480" height="272"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
Expand Down
13 changes: 0 additions & 13 deletions GLLara/GLLDropTargetView.h

This file was deleted.

48 changes: 0 additions & 48 deletions GLLara/GLLDropTargetView.m

This file was deleted.

43 changes: 43 additions & 0 deletions GLLara/GLLDropTargetView.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
//
// GLLDropTargetView.swift
// GLLara
//
// Created by Torsten Kammer on 01.05.24.
// Copyright © 2024 Torsten Kammer. All rights reserved.
//

import Cocoa

@objc class GLLDropTargetView: NSView {
private var dragDestination = GLLItemDragDestination()

override func awakeFromNib() {
registerForDraggedTypes([.fileURL])
}

override func draggingEntered(_ sender: any NSDraggingInfo) -> NSDragOperation {
guard let windowController = window?.windowController as? GLLDocumentWindowController, let document = windowController.document as? GLLDocument else {
return []
}

dragDestination.document = document;

return dragDestination.itemDraggingEntered(sender)
}

override func performDragOperation(_ sender: any NSDraggingInfo) -> Bool {
guard let windowController = window?.windowController as? GLLDocumentWindowController, let document = windowController.document as? GLLDocument else {
return false
}

dragDestination.document = document;

do {
try dragDestination.performItemDragOperation(sender)
return true
} catch let error as NSError {
presentError(error)
return false
}
}
}
1 change: 1 addition & 0 deletions GLLara/GLLara-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#import "GLLConnexionManager.h"
#import "GLLDirectionalLight.h"
#import "GLLDocument.h"
#import "GLLDocumentWindowController.h"
#import "GLLItem.h"
#import "GLLItemBone.h"
#import "GLLItemMesh.h"
Expand Down

0 comments on commit 4f6654a

Please sign in to comment.