forked from ngscopeclient/scopehal-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPreferenceSchema.cpp
More file actions
652 lines (614 loc) · 31.3 KB
/
PreferenceSchema.cpp
File metadata and controls
652 lines (614 loc) · 31.3 KB
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
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
/***********************************************************************************************************************
* *
* ngscopeclient *
* *
* Copyright (c) 2012-2026 Andrew D. Zonenberg *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the *
* following conditions are met: *
* *
* * Redistributions of source code must retain the above copyright notice, this list of conditions, and the *
* following disclaimer. *
* *
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the *
* following disclaimer in the documentation and/or other materials provided with the distribution. *
* *
* * Neither the name of the author nor the names of any contributors may be used to endorse or promote products *
* derived from this software without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE AUTHORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE AUTHORS BE HELD LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES *
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR *
* BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT *
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
***********************************************************************************************************************/
#include "PreferenceManager.h"
#include "PreferenceTypes.h"
#include "ngscopeclient.h"
PreferenceManager PreferenceManager::m_instance;
void PreferenceManager::InitializeDefaults()
{
auto& appearance = this->m_treeRoot.AddCategory("Appearance");
auto& consts = appearance.AddCategory("Constellations");
consts.AddPreference(
Preference::Color("point_color", ColorFromString("#ff0000ff"))
.Label("Point color")
.Description("Color for nominal constellation points"));
auto& cursors = appearance.AddCategory("Cursors");
cursors.AddPreference(
Preference::Color("cursor_1_color", ColorFromString("#ffff00"))
.Label("Cursor #1 color")
.Description("Color for the left or top cursor"));
cursors.AddPreference(
Preference::Color("cursor_2_color", ColorFromString("#ff8000"))
.Label("Cursor #2 color")
.Description("Color for the right or bottom cursor"));
cursors.AddPreference(
Preference::Color("cursor_fill_color", ColorFromString("#ffff0040"))
.Label("Cursor fill color")
.Description("Color for the filled area between cursors"));
/*cursors.AddPreference(
Preference::Color("cursor_fill_text_color", ColorFromString("#ffff00"))
.Label("Cursor fill text color")
.Description("Color for in-band power and other text drawn between cursors"));*/
cursors.AddPreference(
Preference::Font("label_font", FontDescription(FindDataFile("fonts/DejaVuSans.ttf"), 13))
.Label("Label font")
.Description("Font used for cursor labels"));
cursors.AddPreference(
Preference::Color("marker_color", ColorFromString("#ff00a0"))
.Label("Marker color")
.Description("Color for markers"));
cursors.AddPreference(
Preference::Color("hover_color", ColorFromString("#ffffff80"))
.Label("Hover color")
.Description("Color for the hovered-packet indicator"));
auto& decodes = appearance.AddCategory("Decodes");
decodes.AddPreference(
Preference::Font("protocol_font", FontDescription(FindDataFile("fonts/DejaVuSans.ttf"), 13))
.Label("Protocol font")
.Description("Font used for protocol decode overlay text"));
/*decodes.AddPreference(
Preference::Color("address_color", ColorFromString("#ffff00"))
.Label("Address color")
.Description("Color for register/memory addresses"));
decodes.AddPreference(
Preference::Color("checksum_bad_color", ColorFromString("#ff0000"))
.Label("Checksum/CRC color (Bad)")
.Description("Color for incorrect checksums/CRCs"));
decodes.AddPreference(
Preference::Color("checksum_ok_color", ColorFromString("#00ff00"))
.Label("Checksum/CRC color (OK)")
.Description("Color for correct checksums/CRCs"));
decodes.AddPreference(
Preference::Color("control_color", ColorFromString("#c000a0"))
.Label("Control color")
.Description("Color for control events"));
decodes.AddPreference(
Preference::Color("data_color", ColorFromString("#336699"))
.Label("Data color")
.Description("Color for generic protocol data bytes"));
decodes.AddPreference(
Preference::Color("error_color", ColorFromString("#ff0000"))
.Label("Error color")
.Description("Color for malformed data or error conditions"));
decodes.AddPreference(
Preference::Color("idle_color", ColorFromString("#404040"))
.Label("Idle color")
.Description("Color for idle sequences between meaningful data"));
decodes.AddPreference(
Preference::Color("preamble_color", ColorFromString("#808080"))
.Label("Preamble color")
.Description("Color for preambles, sync bytes, and other fixed header data"));*/
auto& eye = appearance.AddCategory("Eye Patterns");
eye.AddPreference(
Preference::Color("border_color_pass", ColorFromString("#00ff00ff"))
.Label("Border color (pass)")
.Description("Color for drawing mask polygon border if no or acceptable violations"));
eye.AddPreference(
Preference::Color("border_color_fail", ColorFromString("#ff0000ff"))
.Label("Border color (fail)")
.Description("Color for drawing mask polygon border if unacceptable violations"));
eye.AddPreference(
Preference::Color("mask_color", ColorFromString("#0000ff80"))
.Label("Mask color")
.Description("Color for drawing mask overlays"));
auto& file = appearance.AddCategory("File Browser");
file.AddPreference(
Preference::Enum("dialogmode", BROWSER_NATIVE)
.Label("Non-fullscreened dialog style")
.Description(
"Select the file browser to use for loading and saving files when not in fullscreen mode.\n\n"
"The native file browser cannot be used when ngscopeclient is in fullscreen mode,\n"
"so the ImGui browser is always used when fullscreened."
)
.EnumValue("ImGui", BROWSER_IMGUI)
.EnumValue("Native", BROWSER_NATIVE)
.EnumValue("KDialog", BROWSER_KDIALOG)
);
auto& graph = appearance.AddCategory("Filter Graph");
graph.AddPreference(
Preference::Font("header_font", FontDescription(FindDataFile("fonts/DejaVuSans.ttf"), 15))
.Label("Header font")
.Description("Font for filter/channel names"));
graph.AddPreference(
Preference::Color("header_text_color", ColorFromString("#000000"))
.Label("Header text color")
.Description("Color for filter/channel names"));
graph.AddPreference(
Preference::Color("valid_link_color", ColorFromString("#00ff00"))
.Label("Valid link color")
.Description("Color indicating a potential connection path is valid"));
graph.AddPreference(
Preference::Color("invalid_link_color", ColorFromString("#ff0000"))
.Label("Invalid link color")
.Description("Color indicating a potential connection path is invalid"));
graph.AddPreference(
Preference::Color("infobubble_color", ColorFromString("#404040"))
.Label("Info bubble color")
.Description("Color for information bubbles displayed above graph nodes"));
graph.AddPreference(
Preference::Color("error_outline_color", ColorFromString("#ff0000"))
.Label("Error outline color")
.Description("Color for outlining graph nodes with errors"));
graph.AddPreference(
Preference::Font("icon_caption_font", FontDescription(FindDataFile("fonts/DejaVuSans.ttf"), 13))
.Label("Icon font")
.Description("Font for icon captions"));
graph.AddPreference(
Preference::Color("icon_caption_color", ColorFromString("#ffffff"))
.Label("Icon color")
.Description("Color for icon captions"));
auto& ahelp = appearance.AddCategory("Help");
ahelp.AddPreference(
Preference::Color("bubble_outline_color", ColorFromString("#00ff00"))
.Label("Bubble outline color")
.Description("Color for tutorial bubble outlines"));
ahelp.AddPreference(
Preference::Color("bubble_fill_color", ColorFromString("#202020e0"))
.Label("Bubble fill color")
.Description("Color for tutorial bubble fill"));
auto& stream = appearance.AddCategory("Stream Browser");
stream.AddPreference(
Preference::Enum("numeric_value_display", NUMERIC_DISPLAY_MONO_FONT)
.Label("Numeric value display")
.Description(
"Select the way numeric values are displayed for DMM and PSU nodes.\n"
"- Console font: use Console font (monospace) defined in General preferences.\n"
"- 7 segment: use 7 segment style display.\n"
"- Default font: use Default font (proportional) defined in General preferences.\n"
)
.EnumValue("Console font", NUMERIC_DISPLAY_MONO_FONT)
.EnumValue("7 segment", NUMERIC_DISPLAY_7SEGMENT)
.EnumValue("Default font", NUMERIC_DISPLAY_DEFAULT_FONT)
);
stream.AddPreference(
Preference::Bool("show_block_border", true)
.Label("Show block border")
.Description("Add a visual border around stream browser blocks (e.g. channel properties)"));
stream.AddPreference(
Preference::Real("instrument_badge_latch_duration", 0.4)
.Label("Intrument badge latch duration (seconds)")
.Description("Duration during which instrument badges are preserved (to prevent flashing)."));
stream.AddPreference(
Preference::Color("download_wait_badge_color", ColorFromString("#CC4C4C"))
.Label("Download wait badge color")
.Description("Color for download 'wait' badge"));
stream.AddPreference(
Preference::Color("download_progress_badge_color", ColorFromString("#B3B44D"))
.Label("Download progress badge color")
.Description("Color for download 'progress' badge"));
stream.AddPreference(
Preference::Color("download_finished_badge_color", ColorFromString("#4CCC4C"))
.Label("Download finished badge color")
.Description("Color for download 'finished' badge"));
stream.AddPreference(
Preference::Color("download_active_badge_color", ColorFromString("#4CCC4C"))
.Label("Download active badge color")
.Description("Color for download 'active' badge"));
stream.AddPreference(
Preference::Color("trigger_armed_badge_color", ColorFromString("#4CCC4C"))
.Label("Trigger armed badge color")
.Description("Color for trigger 'armed' badge"));
stream.AddPreference(
Preference::Color("trigger_stopped_badge_color", ColorFromString("#CC4C4C"))
.Label("Trigger stopped badge color")
.Description("Color for trigger 'stopped' badge"));
stream.AddPreference(
Preference::Color("trigger_triggered_badge_color", ColorFromString("#B3B44D"))
.Label("Trigger triggered badge color")
.Description("Color for trigger 'triggered' badge"));
stream.AddPreference(
Preference::Color("trigger_busy_badge_color", ColorFromString("#CC4C4C"))
.Label("Trigger busy badge color")
.Description("Color for trigger 'busy' badge"));
stream.AddPreference(
Preference::Color("trigger_auto_badge_color", ColorFromString("#4CCC4C"))
.Label("Trigger auto badge color")
.Description("Color for trigger 'auto' badge"));
stream.AddPreference(
Preference::Color("instrument_disabled_badge_color", ColorFromString("#666666"))
.Label("Instrument disabled badge color")
.Description("Color for instrument 'disabled' badge"));
stream.AddPreference(
Preference::Color("instrument_offline_badge_color", ColorFromString("#CC4C4C"))
.Label("Instrument offline badge color")
.Description("Color for instrument 'offline' badge"));
stream.AddPreference(
Preference::Color("instrument_on_badge_color", ColorFromString("#4CCC4C"))
.Label("Instrument on badge color")
.Description("Color for instrument 'on' badge"));
stream.AddPreference(
Preference::Color("instrument_partial_badge_color", ColorFromString("#E2CD23FF"))
.Label("Instrument partial on badge color")
.Description("Color for intrument partial 'on' badge"));
stream.AddPreference(
Preference::Color("instrument_off_badge_color", ColorFromString("#808000ff"))
.Label("Instrument off badge color")
.Description("Color for instrument 'off' badge"));
stream.AddPreference(
Preference::Color("psu_cv_badge_color", ColorFromString("#4CCC4C"))
.Label("PSU cv badge color")
.Description("Color for PSU 'cv' badge"));
stream.AddPreference(
Preference::Color("psu_cc_badge_color", ColorFromString("#CC4C4C"))
.Label("PCU CC badge color")
.Description("Color for psu 'c' badge"));
stream.AddPreference(
Preference::Color("psu_set_label_color", ColorFromString("#FFFF00"))
.Label("PSU set label color")
.Description("Color for PSU 'set' label"));
stream.AddPreference(
Preference::Color("psu_meas_label_color", ColorFromString("#00C100"))
.Label("PSU measured label color")
.Description("Color for PSU 'meas.' label"));
stream.AddPreference(
Preference::Color("psu_7_segment_color", ColorFromString("#B2FFFF"))
.Label("PSU 7 segment display color")
.Description("Color for PSU 7 segment style display"));
stream.AddPreference(
Preference::Color("awg_hiz_badge_color", ColorFromString("#666600"))
.Label("Function Generator HI-Z badge color")
.Description("Color for Function Generator 'HI-Z' badge"));
stream.AddPreference(
Preference::Color("awg_50ohms_badge_color", ColorFromString("#B54C85"))
.Label("Function Generator 50 Ohms badge color")
.Description("Color for Function Generator '50Ohm' badge"));
auto& general = appearance.AddCategory("General");
general.AddPreference(
Preference::Enum("theme", THEME_DARK)
.Label("GUI Theme")
.Description("Color scheme for GUI widgets")
.EnumValue("Light", THEME_LIGHT)
.EnumValue("Dark", THEME_DARK)
.EnumValue("Classic", THEME_CLASSIC)
);
general.AddPreference(
Preference::Font("default_font", FontDescription(FindDataFile("fonts/DejaVuSans.ttf"), 13))
.Label("Default font")
.Description("Font used for most GUI elements"));
general.AddPreference(
Preference::Font("title_font", FontDescription(FindDataFile("fonts/DejaVuSans-Bold.ttf"), 16))
.Label("Title font")
.Description("Font used for headings in reports or wizards"));
general.AddPreference(
Preference::Font("console_font", FontDescription(FindDataFile("fonts/DejaVuSansMono.ttf"), 13))
.Label("Console font")
.Description("Font used for SCPI console, log viewer and PSU/DMM numeric values in Stream Browser"));
general.AddPreference(
Preference::Color("apply_button_color", ColorFromString("#4CCC4C"))
.Label("Apply button color")
.Description("Color for the apply value button"));
auto& graphs = appearance.AddCategory("Graphs");
graphs.AddPreference(
Preference::Color("bottom_color", ColorFromString("#000000ff"))
.Label("Background color bottom")
.Description("Color for the bottom side of the background gradient in a waveform graph"));
graphs.AddPreference(
Preference::Color("top_color", ColorFromString("#202020ff"))
.Label("Background color top")
.Description("Color for the top side of the background gradient in a waveform graph"));
graphs.AddPreference(
Preference::Color("grid_centerline_color", ColorFromString("#c0c0c0ff"))
.Label("Grid centerline color")
.Description("Color for the grid line at Y=0"));
graphs.AddPreference(
Preference::Color("grid_color", ColorFromString("#c0c0c040"))
.Label("Grid color")
.Description("Color for grid lines at Y=0"));
graphs.AddPreference(
Preference::Real("grid_centerline_width", 1)
.Label("Axis width")
.Description("Width of grid line at Y=0"));
graphs.AddPreference(
Preference::Real("grid_width", 1)
.Label("Grid width")
.Description("Width of grid lines"));
graphs.AddPreference(
Preference::Color("y_axis_text_color", ColorFromString("#ffffffff"))
.Label("Y axis text color")
.Description("Color for Y axis text"));
graphs.AddPreference(
Preference::Font("y_axis_font", FontDescription(FindDataFile("fonts/DejaVuSans.ttf"), 13))
.Label("Y axis font")
.Description("Font used for Y axis text"));
auto& logs = appearance.AddCategory("Log Viewer");
logs.AddPreference(
Preference::Color("error_color", ColorFromString("#800000"))
.Label("Error color")
.Description("Background color for log messages with \"error\" severity"));
logs.AddPreference(
Preference::Color("warning_color", ColorFromString("#404000"))
.Label("Warning color")
.Description("Background color for log messages with \"warning\" severity"));
auto& markdown = appearance.AddCategory("Markdown");
markdown.AddPreference(
Preference::Font("heading_1_font", FontDescription(FindDataFile("fonts/DejaVuSans-Bold.ttf"), 20))
.Label("Heading 1 font")
.Description("Font used for level 1 headings in Markdown"));
markdown.AddPreference(
Preference::Font("heading_2_font", FontDescription(FindDataFile("fonts/DejaVuSans-Bold.ttf"), 16))
.Label("Heading 2 font")
.Description("Font used for level 2 headings in Markdown"));
markdown.AddPreference(
Preference::Font("heading_3_font", FontDescription(FindDataFile("fonts/DejaVuSans-Bold.ttf"), 14))
.Label("Heading 3 font")
.Description("Font used for level 3 headings in Markdown"));
auto& peaks = appearance.AddCategory("Peaks");
/*peaks.AddPreference(
Preference::Color("peak_outline_color", ColorFromString("#009900"))
.Label("Outline color")
.Description("Color for the outline of peak labels"));*/
peaks.AddPreference(
Preference::Color("peak_text_color", ColorFromString("#ffffff"))
.Label("Text color")
.Description("Color for the text on peak labels"));
/*peaks.AddPreference(
Preference::Color("peak_background_color", ColorFromString("#000000"))
.Label("Background color")
.Description("Color for the background of peak labels"));
*/
peaks.AddPreference(
Preference::Font("label_font", FontDescription(FindDataFile("fonts/DejaVuSans.ttf"), 13))
.Label("Label font")
.Description("Font used for peak labels"));
auto& proto = appearance.AddCategory("Protocol Analyzer");
/*proto.AddPreference(
Preference::Color("command_color", ColorFromString("#600050"))
.Label("Command color")
.Description("Color for packets that execute commands"));
proto.AddPreference(
Preference::Color("control_color", ColorFromString("#808000"))
.Label("Control color")
.Description("Color for packets that have control functionality"));
proto.AddPreference(
Preference::Color("data_read_color", ColorFromString("#336699"))
.Label("Data read color")
.Description("Color for packets that read information from a peripheral"));
proto.AddPreference(
Preference::Color("data_write_color", ColorFromString("#339966"))
.Label("Data write color")
.Description("Color for packets that write information from a peripheral"));
proto.AddPreference(
Preference::Color("error_color", ColorFromString("#800000"))
.Label("Error color")
.Description("Color for packets that are malformed or indicate an error condition"));
proto.AddPreference(
Preference::Color("status_color", ColorFromString("#000080"))
.Label("Status color")
.Description("Color for packets that convey status information"));
proto.AddPreference(
Preference::Color("default_color", ColorFromString("#101010"))
.Label("Default color")
.Description("Color for packets that don't fit any other category"));*/
proto.AddPreference(
Preference::Font("data_font", FontDescription(FindDataFile("fonts/DejaVuSansMono.ttf"), 13))
.Label("Data font")
.Description("Font used for packet data hex dumps"));
auto& timeline = appearance.AddCategory("Timeline");
timeline.AddPreference(
Preference::Color("axis_color", ColorFromString("#ffffff"))
.Label("Axis color")
.Description("Color for the X axis line and tick marks"));
timeline.AddPreference(
Preference::Color("text_color", ColorFromString("#ffffff"))
.Label("Text color")
.Description("Color for text labels on the X axis"));
timeline.AddPreference(
Preference::Color("trigger_bar_color", ColorFromString("#ffffff40"))
.Label("Trigger bar color")
.Description("Color for the vertical position line shown when dragging a trigger"));
timeline.AddPreference(
Preference::Font("x_axis_font", FontDescription(FindDataFile("fonts/DejaVuSans.ttf"), 15))
.Label("X axis font")
.Description("Font used for X axis text"));
auto& toolbar = appearance.AddCategory("Toolbar");
toolbar.AddPreference(
Preference::Enum("icon_size", 24)
.Label("Icon Size")
.Description("Toolbar icon size, in pixels")
.EnumValue("24x24", 24)
.EnumValue("48x48", 48)
);
/*auto& waveforms = appearance.AddCategory("Waveforms");
waveforms.AddPreference(
Preference::Real("persist_decay_rate", 0.9)
.Label("Persistence decay rate (0 = none, 1 = infinite)")
.Description("Decay rate for persistence waveforms. ")
.Unit(Unit::UNIT_COUNTS));
*/
auto& windows = appearance.AddCategory("Windowing");
windows.AddPreference(
Preference::Enum("viewport_mode", VIEWPORT_ENABLE)
.Label("Viewport Mode")
.Description(
"Specifies whether the GUI library is allowed to create multiple top level windows,\n"
"or if all child windows (menus, dialogs, tooltips, etc) are forced to stay within the\n"
"boundaries of the application window.\n"
"\n"
"The default is multi-window, but if you are having problems with a Linux tiling\n"
"window manager, you may have a better experience using single-window mode.\n"
"\n"
"Changes to this setting will not take effect until ngscopeclient is restarted."
)
.EnumValue("Multi window", VIEWPORT_ENABLE)
.EnumValue("Single window", VIEWPORT_DISABLE)
);
windows.AddPreference(
Preference::Enum("startup_mode", STARTUP_MODE_WINDOWED)
.Label("Window startup mode")
.Description(
"Specifies the way Ngscopeclient window should be opened at startup.\n"
"\n"
"The default is windowed: the application is started in a fixed 1280x720 window.\n"
"Other options are:\n"
" - Maximized: the window is maximized on the main screen,\n"
" - Last State: the window is restored at the last position and size.\n"
)
.EnumValue("Windowed", STARTUP_MODE_WINDOWED)
.EnumValue("Maximized", STARTUP_MODE_MAXIMIZED)
.EnumValue("Last State", STARTUP_MODE_LAST_STATE)
);
auto& windowStartup = appearance.AddCategory("Startup");
windowStartup.AddPreference(Preference::Bool("startup_fullscreen", false).Invisible());
windowStartup.AddPreference(Preference::Bool("startup_maximized", false).Invisible());
windowStartup.AddPreference(Preference::Int ("startup_pos_x", 0).Invisible());
windowStartup.AddPreference(Preference::Int ("startup_pos_y", 0).Invisible());
windowStartup.AddPreference(Preference::Int ("startup_size_width", 0).Invisible());
windowStartup.AddPreference(Preference::Int ("startup_size_heigth", 0).Invisible());
windowStartup.AddPreference(Preference::String ("monitor_name", "").Invisible());
windowStartup.AddPreference(Preference::Int ("monitor_width", 0).Invisible());
windowStartup.AddPreference(Preference::Int ("monitor_heigth", 0).Invisible());
auto& drivers = this->m_treeRoot.AddCategory("Drivers");
auto& dgeneral = drivers.AddCategory("General");
dgeneral.AddPreference(
Preference::Enum("headless_startup", HEADLESS_STARTUP_C1_ONLY)
.Label("Headless scope default state")
.Description(
"Select the set of channels which are active by default on PC-attached oscilloscopes\n"
"with no front panel display of their own. "
)
.EnumValue("All non-MSO channels", HEADLESS_STARTUP_ALL_NON_MSO)
.EnumValue("Channel 1 only", HEADLESS_STARTUP_C1_ONLY) );
auto& rigol = drivers.AddCategory("Rigol DHO");
rigol.AddPreference(
Preference::Enum("data_width", WIDTH_AUTO)
.Label("Data Width")
.Description(
"Data width used when downloading sample data from the instrument.\n\n"
"Even if the instrument has a 12-bit ADC, using 8 rather than 16 bit data format allows faster"
" waveform update rate.\n\n"
"Choose 16 bit mode if you want to privilege data accuracy over refresh rate.\n\n"
"Changes to this setting take effect the next time a connection to the instrument is opened; "
"the transfer format for active sessions is not updated."
)
.EnumValue("Auto", WIDTH_AUTO)
.EnumValue("8 bits", WIDTH_8_BITS)
.EnumValue("16 bits", WIDTH_16_BITS)
);
auto& rsrtb = drivers.AddCategory("RohdeSchwarz RTB");
rsrtb.AddPreference(
Preference::Enum("data_width", WIDTH_16_BITS)
.Label("Data Width")
.Description(
"Data width used when downloading sample data from the instrument.\n\n"
"Even if the instrument has a 10-bit ADC, using 8 rather than 16 bit data format allows faster"
" waveform update rate.\n\n"
"Choose 16 bit mode if you want to privilege data accuracy over refresh rate.\n\n"
"Changes to this setting take effect the next time a connection to the instrument is opened; "
"the transfer format for active sessions is not updated."
)
.EnumValue("8 bits", WIDTH_8_BITS)
.EnumValue("16 bits", WIDTH_16_BITS)
);
auto& siglent = drivers.AddCategory("Siglent SDS HD");
siglent.AddPreference(
Preference::Enum("data_width", WIDTH_AUTO)
.Label("Data Width")
.Description(
"Data width used when downloading sample data from the instrument.\n\n"
"Even if the instrument has a 12-bit ADC, using 8 rather than 16 bit data format allows (about 10%) faster"
" waveform update rate.\n\n"
"Choose 16 bit mode if you want to privilege data accuracy over refresh rate.\n\n"
"Changes to this setting take effect the next time a connection to the instrument is opened; "
"the transfer format for active sessions is not updated."
)
.EnumValue("Auto", WIDTH_AUTO)
.EnumValue("8 bits", WIDTH_8_BITS)
.EnumValue("16 bits", WIDTH_16_BITS)
);
auto& lecroy = drivers.AddCategory("Teledyne LeCroy");
lecroy.AddPreference(
Preference::Bool("force_16bit", true)
.Label("Force 16 bit mode")
.Description(
"Force use of 16-bit integer format when downloading sample data from the instrument.\n\n"
"Even if the instrument only has an 8-bit ADC, due to internal flatness correction and calibration "
"steps, the internal data representation on the scope has additional significant bits.\n\n"
"When this setting is disabled, instruments with 8-bit ADCs will use 8-bit integer format for downloading "
"samples. This slightly improves waveforms-per-second performance but increases quantization noise and "
"can lead to horizontal \"streak\" artifacts in eye patterns.\n\n"
"This setting has no effect on instruments with >8 bit ADCs (HDO, WaveSurfer HD, WaveRunner HD, "
"WavePro HD) which use 16-bit transfer format at all times.\n\n"
"Changes to this setting take effect the next time a connection to the instrument is opened; "
"the transfer format for active sessions is not updated."
));
auto& files = this->m_treeRoot.AddCategory("Files");
files.AddPreference(
Preference::Int("max_recent_files", 10)
.Label("Max recent files")
.Description("Maximum number of recent .scopesession file paths to save in history")
.Unit(Unit::UNIT_COUNTS));
auto& help = this->m_treeRoot.AddCategory("Help");
auto& wizards = help.AddCategory("Wizards");
wizards.AddPreference(
Preference::Bool("first_run_wizard", true)
.Label("First-run wizard")
.Description("Enable the first-run tutorial wizard"));
auto& misc = this->m_treeRoot.AddCategory("Miscellaneous");
auto& menus = misc.AddCategory("Menus");
menus.AddPreference(
Preference::Int("recent_instrument_count", 20)
.Label("Recent instrument count")
.Description("Number of recently used instruments to display"));
auto& pwr = this->m_treeRoot.AddCategory("Power");
auto& events = pwr.AddCategory("Events");
events.AddPreference(
Preference::Enum("event_driven_ui", 0)
.Label("Event loop mode")
.Description(
"Specify how the main event loop should operate.\n"
"\n"
"In Performance mode, the event loop runs at a constant speed locked to the display\n"
"refresh rate. This results in the smoothest GUI and maximum waveform update, but the\n"
"constant redraws increase power consumption.\n"
"\n"
"In Power mode, the event loop blocks until a GUI event (keystroke, mouse movement, etc.)\n"
"occurs, or a user-specified timeout elapses. This results in more jerky display updates\n"
"but keeps the CPU idle most of the time, saving power."
)
.EnumValue("Performance", 0)
.EnumValue("Power", 1)
);
events.AddPreference(
Preference::Real("polling_timeout", FS_PER_SECOND / 4)
.Label("Polling timeout")
.Unit(Unit::UNIT_FS)
.Description(
"Polling timeout for event loop in power-optimized mode.\n\n"
"Longer timeout values reduce power consumption, but also slows display updates.\n")
);
/*
auto& privacy = this->m_treeRoot.AddCategory("Privacy");
privacy.AddPreference(
Preference::Bool("redact_serial_in_title", false)
.Label("Redact serial number in title bar")
.Description(
"Partially hide instrument serial numbers in the window title bar.\n\n"
"This allows you to share screenshots without revealing your serial numbers."
));*/
}