Skip to content

Commit 5874561

Browse files
authored
Merge pull request #22 from Synopsis/fixes/21
Fixes/21
2 parents 2ce9148 + 0580ba2 commit 5874561

File tree

5 files changed

+81
-33
lines changed

5 files changed

+81
-33
lines changed

OpenTimelineIO-Sample/OpenTimelineIO-Reader.xcodeproj/project.pbxproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@
200200
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
201201
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
202202
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
203-
MACOSX_DEPLOYMENT_TARGET = 14.5;
203+
MACOSX_DEPLOYMENT_TARGET = 13.5;
204204
MARKETING_VERSION = "1.0 Beta 1";
205205
PRODUCT_BUNDLE_IDENTIFIER = "ai.ozu.OpenTimelineIO-Reader";
206206
PRODUCT_NAME = "$(TARGET_NAME)";
@@ -242,7 +242,7 @@
242242
IPHONEOS_DEPLOYMENT_TARGET = 18.0;
243243
LD_RUNPATH_SEARCH_PATHS = "@executable_path/Frameworks";
244244
"LD_RUNPATH_SEARCH_PATHS[sdk=macosx*]" = "@executable_path/../Frameworks";
245-
MACOSX_DEPLOYMENT_TARGET = 14.5;
245+
MACOSX_DEPLOYMENT_TARGET = 13.5;
246246
MARKETING_VERSION = "1.0 Beta 1";
247247
PRODUCT_BUNDLE_IDENTIFIER = "ai.ozu.OpenTimelineIO-Reader";
248248
PRODUCT_NAME = "$(TARGET_NAME)";

OpenTimelineIO-Sample/OpenTimelineIO-Reader/Views/ContentView.swift

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,14 @@ struct ContentView: View
2020
@State private var isExportingOTIO: Bool = false
2121
@State private var isExportingMPEG4: Bool = false
2222
@State var secondsToPixels = 10.0;
23-
@State var inspectorOpen: Bool = true
2423

24+
25+
//@State var inspectorOpen: Bool = true
26+
@State var columnVisibility: NavigationSplitViewVisibility = .doubleColumn
27+
2528
@State var selectedItem: OpenTimelineIO.Item? = nil
2629

30+
2731
init(document: OpenTimelineIO_ReaderDocument , fileURL: URL? = nil) {
2832
self.document = document
2933
self.fileURL = fileURL
@@ -37,34 +41,48 @@ struct ContentView: View
3741

3842
var body: some View {
3943

40-
VSplitView
44+
NavigationSplitView(columnVisibility: $columnVisibility)
4145
{
42-
VideoPlayer(player: document.player)
43-
44-
VStack(alignment: .leading)
46+
EmptyView()
47+
}
48+
content:
49+
{
50+
VSplitView
4551
{
46-
Text(document.timeline.name.isEmpty ? "Untitled Timeline" : document.timeline.name)
47-
.padding(.horizontal)
48-
.padding(.top, 5)
49-
50-
TimelineView(timeline: document.timeline,
51-
currentTime: self.$document.currentTime ,
52-
secondsToPixels: self.$secondsToPixels,
53-
selectedItem: self.$selectedItem)
52+
VideoPlayer(player: document.player)
5453

55-
self.controlsViewStack()
54+
VStack(alignment: .leading)
55+
{
56+
Text(document.timeline.name.isEmpty ? "Untitled Timeline" : document.timeline.name)
57+
.padding(.horizontal)
58+
.padding(.top, 5)
59+
60+
TimelineView(timeline: document.timeline,
61+
currentTime: self.$document.currentTime ,
62+
secondsToPixels: self.$secondsToPixels,
63+
selectedItem: self.$selectedItem)
64+
65+
self.controlsViewStack()
66+
}
5667
}
5768
}
58-
.inspector(isPresented: self.$inspectorOpen)
59-
{
69+
detail: {
6070
ItemInspectorView(selectedItem: self.$selectedItem)
61-
.inspectorColumnWidth(min: 250, ideal: 300, max: 500)
71+
// .inspectorColumnWidth(min: 250, ideal: 300, max: 500)
72+
.navigationSplitViewColumnWidth(min:250, ideal: 200, max: 300)
73+
6274
.toolbar
6375
{
6476
Spacer()
6577

6678
Button {
67-
self.inspectorOpen.toggle()
79+
if self.columnVisibility == .detailOnly {
80+
self.columnVisibility = .doubleColumn
81+
}
82+
else
83+
{
84+
self.columnVisibility = .detailOnly
85+
}
6886
} label: {
6987
Image(systemName: "info.circle")
7088
}

OpenTimelineIO-Sample/OpenTimelineIO-Reader/Views/ItemInspectorView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ struct ItemInspectorView: View
9494
}
9595
.listSectionSeparator(.hidden)
9696

97-
Section("\(Image(systemName: "gearshape.fill")) JSON", isExpanded: self.$jsonExpanded)
97+
Section("\(Image(systemName: "gearshape.fill")) JSON")
9898
{
9999
Text(self.safeToJSON(item: selectedItem))
100100
.lineLimit(nil)

OpenTimelineIO-Sample/OpenTimelineIO-Reader/Views/ItemView.swift

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,21 @@ struct ItemView : View {
2626
if let _ = item as? Gap
2727
{
2828
RoundedRectangle(cornerRadius: 3)
29-
.fill( Color("GapTrackBaseColor") )
30-
.strokeBorder( self.selected ? .white : .clear, lineWidth: 1)
31-
.frame(width: self.getSafeWidth() - 2)
29+
.fill(Color("GapTrackBaseColor")) // Fill the RoundedRectangle with color
30+
.overlay(
31+
RoundedRectangle(cornerRadius: 3)
32+
.stroke(self.selected ? .white : .clear, lineWidth: 1) // Add stroke/outline
33+
)
34+
.frame(width: self.getSafeWidth() - 2)
3235
}
3336
else
3437
{
3538
RoundedRectangle(cornerRadius: 3)
36-
.fill( self.backgroundColor.gradient )
37-
.strokeBorder( self.selected ? .white : .clear, lineWidth: 1)
39+
.fill(self.backgroundColor.gradient) // Fill the RoundedRectangle with color
40+
.overlay(
41+
RoundedRectangle(cornerRadius: 3)
42+
.stroke(self.selected ? .white : .clear, lineWidth: 1) // Add stroke/outline
43+
)
3844
.frame(width: self.getSafeWidth() - 2)
3945

4046
Text(item.name)

OpenTimelineIO-Sample/OpenTimelineIO-Reader/Views/TimeRulerView.swift

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ struct TimeRulerView: View
6868
// Draw label if it's an hour or minute
6969
if self.secondsToPixels > 50
7070
{
71-
context.draw(Text(label).font(.system(size: 10)).foregroundStyle(.white), at: CGPoint(x: positionX + 2, y: size.height - tickHeight - 10))
71+
context.draw(Text(label).font(.system(size: 10)), at: CGPoint(x: positionX + 2, y: size.height - tickHeight - 10))
7272
}
7373
}
7474
}
@@ -95,7 +95,7 @@ struct TimeRulerView: View
9595

9696
if self.secondsToPixels > 400
9797
{
98-
context.draw(Text(String(frameNum)).font(.system(size: 10)).foregroundStyle(.white), at: CGPoint(x: positionX, y: size.height - tickHeight - 5))
98+
context.draw(Text(String(frameNum)).font(.system(size: 10)), at: CGPoint(x: positionX, y: size.height - tickHeight - 5))
9999
}
100100
}
101101
}
@@ -117,12 +117,36 @@ struct TimeRulerView: View
117117
let playheadRect = CGRect(x: playheadPositionX, y: 20, width: 1, height: size.height-20)
118118
// context.fill(Path(playheadRect), with: .color(.orange))
119119

120-
context.draw(Text("\(Image(systemName: "arrowtriangle.down.fill"))").font(.system(size: 13)).foregroundStyle(.orange), at: CGPoint(x: playheadPositionX + 0.5, y: 15))
121-
120+
if #available(macOS 14.0, *)
121+
{
122+
context.draw(
123+
Text("\(Image(systemName: "arrowtriangle.down.fill"))")
124+
.font(.system(size: 13))
125+
.foregroundStyle(.orange),
126+
at: CGPoint(x: playheadPositionX + 0.5, y: 15))
127+
128+
context.draw(
129+
Text(currentTimeLabel)
130+
.font(.system(size: 10))
131+
.foregroundStyle(.orange),
132+
at: CGPoint(x: playheadPositionX, y: 5))
133+
}
134+
else
135+
{
136+
context.draw(
137+
Text("\(Image(systemName: "arrowtriangle.down.fill"))")
138+
.font(.system(size: 13))
139+
.foregroundColor(.orange),
140+
at: CGPoint(x: playheadPositionX + 0.5, y: 15))
141+
142+
context.draw(
143+
Text(currentTimeLabel)
144+
.font(.system(size: 10))
145+
.foregroundColor(.orange),
146+
at: CGPoint(x: playheadPositionX, y: 5))
147+
}
148+
122149
context.fill(Path(playheadRect), with: .color(.orange))
123-
124-
context.draw( Text(currentTimeLabel).font(.system(size: 10)).foregroundStyle(.orange) , at: CGPoint(x: playheadPositionX, y: 5))
125-
126150
}
127151

128152
// New function to get frame rate of the timeline

0 commit comments

Comments
 (0)