@@ -18,245 +18,197 @@ struct FileInspectorView: View {
1818 }
1919
2020 var body : some View {
21- VStack ( alignment: . leading, spacing: 5 ) {
22- InspectorSection ( " Identity and Type " ) {
23- InspectorField ( " Name " ) {
24- TextField ( " " , text: $inspectorModel. fileName)
25- }
26- InspectorField ( " Type " ) {
27- fileType
28- }
29- Divider ( )
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- }
41- }
42- InspectorField ( " Full Path " ) {
43- HStack ( alignment: . bottom) {
44- Text ( inspectorModel. fileURL)
45- . foregroundColor ( . primary)
46- . fontWeight ( . regular)
47- . font ( . system( size: 11 ) )
48- . lineLimit ( 4 )
49- Image ( systemName: " arrow.forward.circle.fill " )
50- . resizable ( )
51- . foregroundColor ( . secondary)
52- . frame ( width: 10 , height: 10 )
53- }
54- . padding ( . top, 2 )
55- }
21+ Form {
22+ Section ( " Identity and Type " ) {
23+ fileName
24+ fileType
5625 }
57- InspectorSection ( " Text Settings " ) {
58- InspectorField ( " Text Encoding " ) {
59- textEncoding
60- }
61- InspectorField ( " Line Endings " ) {
62- lineEndings
63- }
64- Divider ( )
65- InspectorField ( " Indent Using " ) {
66- indentUsing
67- }
68- InspectorField ( " Widths " ) {
69- tabWidths
70- }
26+ Section {
27+ location
28+ }
29+ Section ( " Text Settings " ) {
30+ textEncoding
31+ lineEndings
32+ }
33+ Section {
34+ indentUsing
35+ tabWidths
36+ wrapLines
7137 }
7238 }
73- . controlSize ( . small)
74- . padding ( . horizontal, 8 )
75- . padding ( . vertical, 1 )
39+ }
40+
41+ private var fileName : some View {
42+ TextField ( " Name " , text: $inspectorModel. fileName)
7643 }
7744
7845 private var fileType : some View {
79- Picker ( " " , selection: $inspectorModel. fileTypeSelection) {
46+ Picker ( " Type " , selection: $inspectorModel. fileTypeSelection) {
8047 Group {
8148 Section ( header: Text ( " Sourcecode Objective-C " ) ) {
8249 ForEach ( inspectorModel. languageTypeObjCList) {
8350 Text ( $0. name)
84- . font ( . system( size: 11 ) )
8551 }
8652 }
8753 Section ( header: Text ( " Sourcecode C " ) ) {
8854 ForEach ( inspectorModel. sourcecodeCList) {
8955 Text ( $0. name)
90- . font ( . system( size: 11 ) )
9156 }
9257 }
9358 Section ( header: Text ( " Sourcecode C++ " ) ) {
9459 ForEach ( inspectorModel. sourcecodeCPlusList) {
9560 Text ( $0. name)
96- . font ( . system( size: 11 ) )
9761 }
9862 }
9963 Section ( header: Text ( " Sourcecode Swift " ) ) {
10064 ForEach ( inspectorModel. sourcecodeSwiftList) {
10165 Text ( $0. name)
102- . font ( . system( size: 11 ) )
10366 }
10467 }
10568 Section ( header: Text ( " Sourcecode Assembly " ) ) {
10669 ForEach ( inspectorModel. sourcecodeAssemblyList) {
10770 Text ( $0. name)
108- . font ( . system( size: 11 ) )
10971 }
11072 }
11173 }
11274 Group {
11375 Section ( header: Text ( " Sourcecode Objective-C " ) ) {
11476 ForEach ( inspectorModel. sourcecodeScriptList) {
11577 Text ( $0. name)
116- . font ( . system( size: 11 ) )
11778 }
11879 }
11980 Section ( header: Text ( " Property List / XML " ) ) {
12081 ForEach ( inspectorModel. propertyList) {
12182 Text ( $0. name)
122- . font ( . system( size: 11 ) )
12383 }
12484 }
12585 Section ( header: Text ( " Shell Script " ) ) {
12686 ForEach ( inspectorModel. shellList) {
12787 Text ( $0. name)
128- . font ( . system( size: 11 ) )
12988 }
13089 }
13190 Section ( header: Text ( " Mach-O " ) ) {
13291 ForEach ( inspectorModel. machOList) {
13392 Text ( $0. name)
134- . font ( . system( size: 11 ) )
13593 }
13694 }
13795 Section ( header: Text ( " Text " ) ) {
13896 ForEach ( inspectorModel. textList) {
13997 Text ( $0. name)
140- . font ( . system( size: 11 ) )
14198 }
14299 }
143100 }
144101 Group {
145102 Section ( header: Text ( " Audio " ) ) {
146103 ForEach ( inspectorModel. audioList) {
147104 Text ( $0. name)
148- . font ( . system( size: 11 ) )
149105 }
150106 }
151107 Section ( header: Text ( " Image " ) ) {
152108 ForEach ( inspectorModel. imageList) {
153109 Text ( $0. name)
154- . font ( . system( size: 11 ) )
155110 }
156111 }
157112 Section ( header: Text ( " Video " ) ) {
158113 ForEach ( inspectorModel. videoList) {
159114 Text ( $0. name)
160- . font ( . system( size: 11 ) )
161115 }
162116 }
163117 Section ( header: Text ( " Archive " ) ) {
164118 ForEach ( inspectorModel. archiveList) {
165119 Text ( $0. name)
166- . font ( . system( size: 11 ) )
167120 }
168121 }
169122 Section ( header: Text ( " Other " ) ) {
170123 ForEach ( inspectorModel. otherList) {
171124 Text ( $0. name)
172- . font ( . system( size: 11 ) )
173125 }
174126 }
175127 }
176128 }
177- . labelsHidden ( )
178129 }
179130
180131 private var location : some View {
181- Picker ( " " , selection: $inspectorModel. locationSelection) {
182- ForEach ( inspectorModel. locationList) {
183- Text ( $0. name)
184- . font ( . system( size: 11 ) )
132+ Group {
133+ LabeledContent ( " Location " ) {
134+ Button ( " Choose... " ) {
135+ // open open dialog
136+ }
137+ }
138+ ExternalLink ( showInFinder: true , destination: URL ( fileURLWithPath: inspectorModel. fileURL) ) {
139+ Text ( inspectorModel. fileURL)
140+ . font ( . footnote)
141+ . foregroundColor ( . secondary)
185142 }
186143 }
187- . labelsHidden ( )
188144 }
189145
190146 private var textEncoding : some View {
191- Picker ( " " , selection: $inspectorModel. textEncodingSelection) {
147+ Picker ( " Text Encoding " , selection: $inspectorModel. textEncodingSelection) {
192148 ForEach ( inspectorModel. textEncodingList) {
193149 Text ( $0. name)
194- . font ( . system( size: 11 ) )
195150 }
196151 }
197- . labelsHidden ( )
198152 }
199153
200154 private var lineEndings : some View {
201- Picker ( " " , selection: $inspectorModel. lineEndingsSelection) {
155+ Picker ( " Line Endings " , selection: $inspectorModel. lineEndingsSelection) {
202156 ForEach ( inspectorModel. lineEndingsList) {
203157 Text ( $0. name)
204- . font ( . system( size: 11 ) )
205158 }
206159 }
207- . labelsHidden ( )
208160 }
209161
210162 private var indentUsing : some View {
211- Picker ( " " , selection: $inspectorModel. indentUsingSelection) {
163+ Picker ( " Indent Using " , selection: $inspectorModel. indentUsingSelection) {
212164 ForEach ( inspectorModel. indentUsingList) {
213165 Text ( $0. name)
214- . font ( . system( size: 11 ) )
215166 }
216167 }
217- . labelsHidden ( )
218168 }
219169
220170 private var tabWidths : some View {
221- VStack ( alignment : . leading , spacing : 0 ) {
222- HStack {
223- HStack ( alignment: . top , spacing: 2 ) {
224- VStack ( alignment : . center , spacing : 0 ) {
225- TextField ( " " , value : $inspectorModel . tabWidth , formatter : NumberFormatter ( ) )
226- . labelsHidden ( )
227- . frame ( maxWidth : . infinity )
228- . multilineTextAlignment ( . trailing )
229- Text ( " Tab " )
230- . foregroundColor ( . primary )
231- . fontWeight ( . regular )
232- . font ( . system ( size : 10 ) )
233- }
234- Stepper ( value : $inspectorModel . tabWidth , in : 1 ... 8 ) {
235- EmptyView ( )
236- }
237- . padding ( . top , 1 )
238- }
239- HStack ( alignment: . top , spacing: 2 ) {
240- VStack ( alignment : . center , spacing : 0 ) {
241- TextField ( " " , value : $inspectorModel . indentWidth , formatter : NumberFormatter ( ) )
242- . labelsHidden ( )
243- . frame ( maxWidth : . infinity )
244- . multilineTextAlignment ( . trailing )
245- Text ( " Indent " )
246- . foregroundColor ( . primary )
247- . fontWeight ( . regular )
248- . font ( . system ( size : 10 ) )
249- }
250- Stepper ( value : $inspectorModel . indentWidth , in : 1 ... 8 ) {
251- EmptyView ( )
252- }
253- . padding ( . top , 1 )
171+ LabeledContent ( " Widths " ) {
172+ HStack ( spacing : 5 ) {
173+ VStack ( alignment: . center , spacing: 0 ) {
174+ Stepper (
175+ " " ,
176+ value : Binding < Double > (
177+ get : { Double ( inspectorModel . tabWidth ) } ,
178+ set : { inspectorModel . tabWidth = Int ( $0 ) }
179+ ) ,
180+ in : 1 ... 8 ,
181+ step : 1 ,
182+ format : . number
183+ )
184+ . labelsHidden ( )
185+ Text ( " Tab " )
186+ . foregroundColor ( . primary )
187+ . font ( . footnote )
188+ }
189+ VStack ( alignment: . center , spacing: 0 ) {
190+ Stepper (
191+ " " ,
192+ value : Binding < Double > (
193+ get : { Double ( inspectorModel . indentWidth ) } ,
194+ set : { inspectorModel . indentWidth = Int ( $0 ) }
195+ ) ,
196+ in : 1 ... 8 ,
197+ step : 1 ,
198+ format : . number
199+ )
200+ . labelsHidden ( )
201+ Text ( " Indent " )
202+ . foregroundColor ( . primary )
203+ . font ( . footnote )
254204 }
255205 }
256- Toggle ( isOn: $inspectorModel. wrapLines) {
257- Text ( " Wrap lines " )
258- } . toggleStyle ( CheckboxToggleStyle ( ) )
259- . padding ( . vertical, 5 )
206+ }
207+ }
208+
209+ private var wrapLines : some View {
210+ Toggle ( isOn: $inspectorModel. wrapLines) {
211+ Text ( " Wrap lines " )
260212 }
261213 }
262214}
0 commit comments