indicatrix-editor 0.7.2

GUI-free faceting-design editor logic shared by the desktop editor and the wasm web app: the EditorSession (design, undo/redo with caller-supplied coalescing timestamps, selection, dirty tracking), tier/preform/material form parsing, plain-struct view models, the cutting sheet, Retarget, the guided walkthrough and the solve policy. No GUI toolkit, no threads, no clock, no filesystem.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
//! The program itself: the Simple | Advanced switch, high contrast, the interface scale, larger
//! handles, the command palette, the keyboard, the manual and the glossary.

#![allow(
    clippy::too_many_lines,
    reason = "a tutorial is its step text; splitting it would only scatter the wording"
)]

use super::{ADVANCED, VIEWPORT, VIEWPORT_TABS, event};
use crate::guide::{
    Goal, Guide, GuideCategory, GuideStep, StartingState,
    tutorials::viewing_events::{
        GLOSSARY_OPENED, HELP_OPENED, HIGH_CONTRAST_CHANGED, INTERFACE_MODE_CHANGED,
        LARGE_HANDLES_CHANGED, LIVE_RENDER_OPENED, SHORTCUTS_OPENED, TIER_SELECTED,
        UI_SCALE_CHANGED,
    },
};

/// The event the command palette reports when it opens. It is older than the viewing events and
/// is named by its own string in `catalog::EVENTS`.
const PALETTE_OPENED: &str = "palette_opened";

/// The lessons of this file, in browser order.
pub fn guides() -> Vec<Guide> {
    vec![
        interface_mode(),
        high_contrast(),
        interface_scale(),
        larger_handles(),
        command_palette(),
        keyboard(),
        help_viewer(),
        glossary(),
    ]
}

fn interface_mode() -> Guide {
    Guide::new(
        "prefs-interface-mode",
        "Simple or Advanced",
        "Choose how many controls the program shows: the ones most designs need, or all of them.",
        GuideCategory::Preferences,
    )
    .starting(StartingState::CurrentDesign)
    .step(
        GuideStep::new(
            "Two interfaces",
            "The program can show every control, or only the ones most designs need.",
        )
        .actions([
            "Simple shows the controls most designs need. Advanced shows every control.",
            "It is one switch with two places to change it: the Simple | Advanced pill at the top left of the window, and the two choices at the top of the Preferences dialog.",
            "Switching hides or shows controls and nothing else. Your designs, your settings and your files are never affected.",
        ])
        .why("A new installation starts in Simple. A program that was used before the switch existed stays in Advanced.")
        .highlight("mode_switch")
        .allow(ADVANCED),
    )
    .step(
        GuideStep::new(
            "Switch the interface",
            "The pill at the top of the window changes it at once.",
        )
        .actions(["Click the half of the Simple | Advanced pill that is not lit."])
        .check("The other half is lit.")
        .why("While this step is open the program keeps the advanced controls on screen, so you can switch back. Close the tutorial to see the smaller window of Simple.")
        .goal(event(INTERFACE_MODE_CHANGED), "The interface switched")
        .highlight("mode_switch")
        .allow(ADVANCED),
    )
    .step(
        GuideStep::new(
            "Switch back",
            "Change it again whenever you like.",
        )
        .actions(["Click the other half of the pill."])
        .check("The half you started with is lit again.")
        .goal(event(INTERFACE_MODE_CHANGED), "The interface switched back")
        .highlight("mode_switch")
        .allow(ADVANCED),
    )
    .step(
        GuideStep::new(
            "What Simple hides",
            "A hidden setting keeps its value and still applies.",
        )
        .actions([
            "Simple hides the Tilt Curve and Save View Preset buttons, and the advanced rows in Settings: preview image size and samples, motion preview resolution, live compute and transfer, local compute, max ray bounces and the Tilt Performance Curve panel.",
            "When one of those settings is not at its default, Settings says Some advanced settings are in use.",
            "The command palette has Use the Simple Interface and Use the Advanced Interface as well.",
        ])
        .why("Every control is unlocked again."),
    )
}

fn high_contrast() -> Guide {
    Guide::new(
        "prefs-high-contrast",
        "High contrast",
        "Switch to near-black backgrounds, white text and bright accents for easier reading.",
        GuideCategory::Preferences,
    )
    .starting(StartingState::CurrentDesign)
    .step(
        GuideStep::new(
            "What High contrast changes",
            "It is for bright rooms and for low vision.",
        )
        .actions([
            "Backgrounds turn near-black, text white, borders clear and accents bright.",
            "It takes effect at once, in the main window and in the Compare and Rough Planner windows, including ones you open later.",
            "A few colours keep their value because they mean something: the tilt graph's curve colours, colour swatches and the rendered pictures themselves.",
        ])
        .allow(ADVANCED),
    )
    .step(
        GuideStep::new(
            "Switch it on",
            "The switch is in the Preferences dialog, which covers this panel while it is open.",
        )
        .actions([
            "Choose Edit, then Preferences... (or press Ctrl+,).",
            "In Appearance, switch High contrast on.",
            "Switch it off again if you only wanted to look, then click Done.",
        ])
        .check("The colours of the window change as you flip the switch.")
        .why("The choice is saved at once and comes back the next time you start the program.")
        .goal(event(HIGH_CONTRAST_CHANGED), "High contrast switched")
        .allow(ADVANCED),
    )
    .step(
        GuideStep::new(
            "Done",
            "You can change it again in the same place at any time.",
        )
        .why("Every control is unlocked again."),
    )
}

fn interface_scale() -> Guide {
    Guide::new(
        "prefs-interface-scale",
        "Interface scale",
        "Make everything in the windows larger or smaller.",
        GuideCategory::Preferences,
    )
    .starting(StartingState::CurrentDesign)
    .step(
        GuideStep::new(
            "How the scale works",
            "Interface scale makes everything in the windows larger or smaller.",
        )
        .actions([
            "The choices are Automatic, which follows your system's display scaling, and 75, 90, 100, 110, 125, 150, 175 and 200 percent.",
            "The scale is applied when the program starts, so a change takes effect after a restart.",
            "Picking and dragging in the viewport use the same scale, so a scaled window still hits what it shows.",
        ])
        .why("If you have set the SLINT_SCALE_FACTOR environment variable yourself, your value is used and this choice is ignored.")
        .allow(ADVANCED),
    )
    .step(
        GuideStep::new(
            "Choose a scale",
            "The setting is in the Preferences dialog, which covers this panel while it is open.",
        )
        .actions([
            "Choose Edit, then Preferences... (or press Ctrl+,).",
            "In Appearance, open Interface scale and choose a value.",
            "Choose Automatic again if you do not want the new size at the next start, then click Done.",
        ])
        .check("A note under the drop-down says it takes effect after a restart.")
        .goal(event(UI_SCALE_CHANGED), "A scale chosen")
        .allow(ADVANCED),
    )
    .step(
        GuideStep::new(
            "Done",
            "Close and reopen the program to see a new scale.",
        )
        .why("Every control is unlocked again."),
    )
}

fn larger_handles() -> Guide {
    Guide::new(
        "prefs-larger-handles",
        "Larger handles",
        "Make the drag handles on the stone bigger, for touch screens and pens.",
        GuideCategory::Preferences,
    )
    .starting(StartingState::Template(5))
    .step(
        GuideStep::new(
            "Handles for fingers",
            "A fingertip is far less precise than a mouse.",
        )
        .actions([
            "Larger handles makes the angle, depth and index handles about 60 percent bigger, and the area you can grab around each one just as much bigger.",
            "A touch screen has no hover, so with larger handles on, the line under the toolbar explains the three handles as soon as you select a facet.",
        ])
        .allow(ADVANCED),
    )
    .step(
        GuideStep::new(
            "Switch it on",
            "The switch is in the Preferences dialog, which covers this panel while it is open.",
        )
        .actions([
            "Choose Edit, then Preferences... (or press Ctrl+,).",
            "In Direct manipulation, switch Larger handles on, then click Done.",
        ])
        .check("The switch is on.")
        .goal(event(LARGE_HANDLES_CHANGED), "Larger handles switched")
        .allow(ADVANCED),
    )
    .step(
        GuideStep::new(
            "Select a facet",
            "The bigger handles show on the selected facet.",
        )
        .actions([
            "Click the Edit tab, then a facet of the stone in the Solid view.",
        ])
        .check("The handles A, D and I are bigger than before, and the line under the toolbar names what each one does.")
        .why("Switch Larger handles off in the same place if you prefer the small ones. Snap to gear steps when dragging is in the same section; it is the Snap pill of the toolbar.")
        .goal(event(TIER_SELECTED), "A facet selected")
        .highlight("solid_viewport")
        .allow(VIEWPORT),
    )
    .step(
        GuideStep::new(
            "Done",
            "The choice is saved and comes back the next time you start the program.",
        )
        .why("Every control is unlocked again."),
    )
}

fn command_palette() -> Guide {
    Guide::new(
        "app-command-palette",
        "The command palette",
        "Find and run any action by typing a few letters of its name.",
        GuideCategory::GettingStarted,
    )
    .starting(StartingState::Template(5))
    .step(
        GuideStep::new(
            "A search box for every action",
            "The palette lists every action of the program in one small window.",
        )
        .actions([
            "Press Ctrl+K (or Ctrl+Shift+P, or choose Edit, then Command Palette...) to open it. The cursor is already in its search box.",
            "Type a few letters of the action's name. The letters only have to appear in order, so sv finds Save and dsolve finds Deep Solve.",
            "Up and Down move the highlight, Enter runs the command and Esc closes the palette.",
        ])
        .why("Before you type anything, the palette shows the commands you ran lately first.")
        .allow(VIEWPORT_TABS),
    )
    .step(
        GuideStep::new(
            "Run a command",
            "The palette covers this panel while it is open, so this step carries everything you need.",
        )
        .actions([
            "Click the Edit tab above the picture, if it is not open.",
            "Press Ctrl+K and type diag.",
            "Check that the highlighted row reads Diagram View, then press Enter.",
        ])
        .check("The Diagram view shows three flat panels, and the palette has closed.")
        .why("The palette follows the same rules as the buttons and menus: it never lets you do what the matching button would refuse.")
        .goal(
            Goal::All(vec![event(PALETTE_OPENED), Goal::ViewMode(3)]),
            "The Diagram view chosen from the palette",
        )
        .allow(VIEWPORT_TABS),
    )
    .step(
        GuideStep::new(
            "Dim rows explain themselves",
            "A command that cannot run right now is dimmed, with the reason under its name.",
        )
        .actions([
            "Open the palette and type slice. While the Diagram view shows, Toggle Slice Mode is dim and says Not available in the Diagram view.",
            "Choosing a dim row does not close the palette. It shows a short message instead, so you learn why.",
            "Close the palette with Esc, and press 1 to go back to the Solid view.",
        ])
        .why("Every control is unlocked again."),
    )
}

fn keyboard() -> Guide {
    Guide::new(
        "app-keyboard-shortcuts",
        "Keyboard shortcuts",
        "Switch views, tabs and tools with keys, and find every shortcut in one list.",
        GuideCategory::GettingStarted,
    )
    .starting(StartingState::Template(5))
    .step(
        GuideStep::new(
            "Keys you will use",
            "You never need to learn these, because the command palette finds everything. These are the ones people use all day.",
        )
        .actions([
            "File: Ctrl+N new, Ctrl+O open, Ctrl+S save, Ctrl+Shift+S save as.",
            "History: Ctrl+Z undo, Ctrl+Y redo. Solving: F5.",
            "Tabs: Ctrl+1, Ctrl+2 and Ctrl+3 switch the three top tabs, and Ctrl+E toggles Live Render and Edit.",
            "Solid viewport: 1, 2, 3 and 4 switch the view mode, and S toggles Slice.",
            "Everywhere: Ctrl+K opens the palette, Ctrl+, Preferences, F1 help for the screen, Esc backs out, and ? shows every shortcut.",
        ])
        .why("A key that types a character does nothing while you are typing in a text box, so a comma in a name stays a comma.")
        .allow(VIEWPORT_TABS),
    )
    .step(
        GuideStep::new(
            "Switch the view with a key",
            "The number keys choose the Solid viewport's view mode.",
        )
        .actions([
            "Click the Edit tab above the picture, then click an empty part of the window so that no text box has the keyboard.",
            "Press 4 for the Diagram view.",
        ])
        .check("The Diagram view shows three flat panels.")
        .goal(Goal::ViewMode(3), "The Diagram view")
        .highlight("view_modes")
        .allow(VIEWPORT_TABS),
    )
    .step(
        GuideStep::new(
            "And back",
            "The keys 1 to 4 are Solid, Path-traced, Both and Diagram.",
        )
        .actions(["Press 1 for the Solid view."])
        .check("The Solid view shows the stone.")
        .goal(Goal::ViewMode(0), "The Solid view")
        .highlight("view_modes")
        .allow(VIEWPORT_TABS),
    )
    .step(
        GuideStep::new(
            "Swap tabs",
            "Ctrl+E flips between Live Render and Edit.",
        )
        .actions([
            "Press Ctrl+E.",
            "Press Ctrl+E again to come back to the Edit tab.",
        ])
        .check("Live Render shows the traced picture, and the second press brings back the Edit tab.")
        .goal(event(LIVE_RENDER_OPENED), "The Live Render view")
        .highlight("live_render_tab")
        .allow(VIEWPORT_TABS),
    )
    .step(
        GuideStep::new(
            "Every key in one list",
            "The shortcuts window lists every key, grouped by where it works.",
        )
        .actions([
            "Click an empty part of the window, then press ? (or choose Help, then Keyboard Shortcuts).",
            "Press Esc to close the list.",
        ])
        .check("A list of shortcuts opens over the window.")
        .goal(event(SHORTCUTS_OPENED), "The shortcuts list opened")
        .allow(VIEWPORT_TABS),
    )
    .step(
        GuideStep::new(
            "Done",
            "The palette's rows show the key of each command, so it teaches you the shortcuts as you use it.",
        )
        .why("Every control is unlocked again."),
    )
}

fn help_viewer() -> Guide {
    Guide::new(
        "app-help-viewer",
        "The manual and context help",
        "Read the manual inside the program, and open the page for what is on screen with F1.",
        GuideCategory::GettingStarted,
    )
    .starting(StartingState::CurrentDesign)
    .step(
        GuideStep::new(
            "The manual is in the program",
            "Every chapter of the manual is built into the program, so Help works without any file beside it.",
        )
        .actions([
            "The help window has the chapter list on the left, with the sections of the open chapter under it, and a search box at the top.",
            "Back and Forward walk your trail, like a browser.",
            "A link to another chapter opens in the same window.",
        ])
        .allow(VIEWPORT),
    )
    .step(
        GuideStep::new(
            "Open the manual",
            "The manual opens in a window of its own, so this panel stays where it is.",
        )
        .actions(["Choose Help, then User Manual in the menu bar."])
        .check("A window titled Help opens on the contents page.")
        .goal(event(HELP_OPENED), "The manual opened")
        .allow(VIEWPORT),
    )
    .step(
        GuideStep::new(
            "Help for this screen",
            "F1 opens the page for what you are looking at.",
        )
        .actions([
            "Click the main window, then press F1 (or choose Help, then Help for This Screen).",
            "Click the Cutting Instructions tab and press F1 again to see the page change.",
        ])
        .check("The manual jumps to the page for the tab or panel on screen.")
        .why("The round question mark on a panel opens the page for that panel in the same way. Anything the program does not know opens the contents.")
        .goal(event(HELP_OPENED), "A manual page opened")
        .allow(VIEWPORT_TABS),
    )
    .step(
        GuideStep::new(
            "Search the manual",
            "The search box finds sections, not only chapters.",
        )
        .actions([
            "In the help window, click Search the manual (or press Ctrl+F in it) and type a word, for example mast.",
            "Click a result to open that section.",
        ])
        .why("Every control is unlocked again."),
    )
}

fn glossary() -> Guide {
    Guide::new(
        "app-glossary",
        "The glossary",
        "Look up the words of cutting and optics that the program and the manual use.",
        GuideCategory::GettingStarted,
    )
    .starting(StartingState::CurrentDesign)
    .step(
        GuideStep::new(
            "Words of the craft",
            "Mast, meet, index, cheater, critical angle: the program uses words a new cutter may not know.",
        )
        .actions([
            "The glossary explains the words the manual and the program use for cutting and for optics.",
            "Many hover notes end with See the glossary.",
        ])
        .allow(VIEWPORT),
    )
    .step(
        GuideStep::new(
            "Open the glossary",
            "The glossary opens over the window, so this step carries everything you need.",
        )
        .actions([
            "Choose Help, then Glossary in the menu bar.",
            "Click Search the terms and type a word, for example mast.",
            "Press Esc, or click the close button, to come back to this panel.",
        ])
        .check("The list narrows to the terms that match what you typed.")
        .goal(event(GLOSSARY_OPENED), "The glossary opened")
        .allow(VIEWPORT),
    )
    .step(
        GuideStep::new(
            "Done",
            "The glossary is in the manual too, as its first appendix.",
        )
        .why("Every control is unlocked again."),
    )
}