@@ -18,119 +18,62 @@ struct FileInspectorView: View {
1818 }
1919
2020 var body : some View {
21- VStack ( alignment: . leading) {
22-
23- Text ( " Identity and Type " )
24- . foregroundColor ( . secondary)
25- . fontWeight ( . bold)
26- . font ( . system( size: 13 ) )
27-
28- VStack ( alignment: . trailing) {
29- HStack {
30- Text ( " Name " )
31- . foregroundColor ( . primary)
32- . fontWeight ( . regular)
33- . font ( . system( size: 10 ) )
21+ VStack ( alignment: . leading, spacing: 5 ) {
22+ InspectorSection ( " Identity and Type " ) {
23+ InspectorField ( " Name " ) {
3424 TextField ( " " , text: $inspectorModel. fileName)
35- . font ( . system( size: 11 ) )
36- . frame ( maxWidth: 150 )
3725 }
38-
39- HStack {
40- Text ( " Type " )
41- . foregroundColor ( . primary)
42- . fontWeight ( . regular)
43- . font ( . system( size: 10 ) )
26+ InspectorField ( " Type " ) {
4427 fileType
4528 }
46-
4729 Divider ( )
48- }
49-
50- VStack ( alignment: . trailing) {
51- HStack ( alignment: . top) {
52- Text ( " Location " )
53- . foregroundColor ( . primary)
54- . fontWeight ( . regular)
55- . font ( . system( size: 10 ) )
56-
57- VStack {
58- location
59- HStack {
60- Text ( inspectorModel. fileName)
61- . font ( . system( size: 11 ) )
62-
63- Spacer ( )
64-
65- Image ( systemName: " folder.fill " )
66- . resizable ( )
67- . foregroundColor ( . secondary)
68- . frame ( width: 13 , height: 11 )
69- }
70- } . frame ( maxWidth: 150 )
30+ InspectorField ( " Location " ) {
31+ location
32+ HStack {
33+ Text ( inspectorModel. fileName)
34+ . font ( . system( size: 11 ) )
35+ Spacer ( )
36+ Image ( systemName: " folder.fill " )
37+ . resizable ( )
38+ . foregroundColor ( . secondary)
39+ . frame ( width: 12 , height: 10 )
40+ }
7141 }
72- . padding ( . top, 1 )
73-
74- HStack ( alignment: . top) {
75- Text ( " Full Path " )
76- . foregroundColor ( . primary)
77- . fontWeight ( . regular)
78- . font ( . system( size: 10 ) )
79-
42+ InspectorField ( " Full Path " ) {
8043 HStack ( alignment: . bottom) {
8144 Text ( inspectorModel. fileURL)
8245 . foregroundColor ( . primary)
8346 . fontWeight ( . regular)
84- . font ( . system( size: 10 ) )
47+ . font ( . system( size: 11 ) )
8548 . lineLimit ( 4 )
86-
8749 Image ( systemName: " arrow.forward.circle.fill " )
8850 . resizable ( )
8951 . foregroundColor ( . secondary)
90- . frame ( width: 11 , height: 11 )
91-
52+ . frame ( width: 10 , height: 10 )
9253 }
93- . frame ( maxWidth : 150 , alignment : . leading )
54+ . padding ( . top , 2 )
9455 }
95- . padding ( . top, - 5 )
96-
97- Divider ( )
9856 }
99-
100- Text ( " Text Settings " )
101- . foregroundColor ( . secondary)
102- . fontWeight ( . bold)
103-
104- VStack ( alignment: . trailing) {
105- HStack {
106- Text ( " Text Encoding " )
107- . foregroundColor ( . primary)
108- . fontWeight ( . regular)
109- . font ( . system( size: 10 ) )
57+ InspectorSection ( " Text Settings " ) {
58+ InspectorField ( " Text Encoding " ) {
11059 textEncoding
11160 }
112-
113- HStack {
114- Text ( " Line Endings " )
115- . foregroundColor ( . primary)
116- . fontWeight ( . regular)
117- . font ( . system( size: 10 ) )
61+ InspectorField ( " Line Endings " ) {
11862 lineEndings
11963 }
120- . padding ( . top, 4 )
121-
12264 Divider ( )
123-
124- HStack {
125- Text ( " Indent Using " )
126- . foregroundColor ( . primary)
127- . fontWeight ( . regular)
128- . font ( . system( size: 10 ) )
65+ InspectorField ( " Indent Using " ) {
12966 indentUsing
13067 }
131- . padding ( . top, 1 )
68+ InspectorField ( " Widths " ) {
69+ tabWidths
70+ }
13271 }
133- } . frame ( maxWidth: 250 ) . padding ( 5 )
72+ }
73+ . controlSize ( . small)
74+ . frame ( maxWidth: 250 )
75+ . padding ( . horizontal, 8 )
76+ . padding ( . vertical, 1 )
13477 }
13578
13679 private var fileType : some View {
@@ -233,7 +176,6 @@ struct FileInspectorView: View {
233176 }
234177 }
235178 . labelsHidden ( )
236- . frame ( maxWidth: 150 , maxHeight: 12 )
237179 }
238180
239181 private var location : some View {
@@ -244,7 +186,6 @@ struct FileInspectorView: View {
244186 }
245187 }
246188 . labelsHidden ( )
247- . frame ( maxWidth: 150 , maxHeight: 12 )
248189 }
249190
250191 private var textEncoding : some View {
@@ -255,7 +196,6 @@ struct FileInspectorView: View {
255196 }
256197 }
257198 . labelsHidden ( )
258- . frame ( maxWidth: 150 , maxHeight: 12 )
259199 }
260200
261201 private var lineEndings : some View {
@@ -266,7 +206,6 @@ struct FileInspectorView: View {
266206 }
267207 }
268208 . labelsHidden ( )
269- . frame ( maxWidth: 150 , maxHeight: 12 )
270209 }
271210
272211 private var indentUsing : some View {
@@ -277,6 +216,48 @@ struct FileInspectorView: View {
277216 }
278217 }
279218 . labelsHidden ( )
280- . frame ( maxWidth: 150 , maxHeight: 12 )
219+ }
220+
221+ private var tabWidths : some View {
222+ VStack ( alignment: . leading, spacing: 0 ) {
223+ HStack {
224+ HStack ( alignment: . top, spacing: 2 ) {
225+ VStack ( alignment: . center, spacing: 0 ) {
226+ TextField ( " " , value: $inspectorModel. tabWidth, formatter: NumberFormatter ( ) )
227+ . labelsHidden ( )
228+ . frame ( maxWidth: . infinity)
229+ . multilineTextAlignment ( . trailing)
230+ Text ( " Tab " )
231+ . foregroundColor ( . primary)
232+ . fontWeight ( . regular)
233+ . font ( . system( size: 10 ) )
234+ }
235+ Stepper ( value: $inspectorModel. tabWidth, in: 1 ... 8 ) {
236+ EmptyView ( )
237+ }
238+ . padding ( . top, 1 )
239+ }
240+ HStack ( alignment: . top, spacing: 2 ) {
241+ VStack ( alignment: . center, spacing: 0 ) {
242+ TextField ( " " , value: $inspectorModel. indentWidth, formatter: NumberFormatter ( ) )
243+ . labelsHidden ( )
244+ . frame ( maxWidth: . infinity)
245+ . multilineTextAlignment ( . trailing)
246+ Text ( " Indent " )
247+ . foregroundColor ( . primary)
248+ . fontWeight ( . regular)
249+ . font ( . system( size: 10 ) )
250+ }
251+ Stepper ( value: $inspectorModel. indentWidth, in: 1 ... 8 ) {
252+ EmptyView ( )
253+ }
254+ . padding ( . top, 1 )
255+ }
256+ }
257+ Toggle ( isOn: $inspectorModel. wrapLines) {
258+ Text ( " Wrap lines " )
259+ } . toggleStyle ( CheckboxToggleStyle ( ) )
260+ . padding ( . vertical, 5 )
261+ }
281262 }
282263}
0 commit comments