Horizon
Loading...
Searching...
No Matches
preferences.hpp
1#pragma once
2#include "canvas/appearance.hpp"
3#include "canvas3d/spacenav_prefs.hpp"
4#include "canvas/show_via_span.hpp"
5#include "canvas/input_devices_prefs.hpp"
6#include "nlohmann/json_fwd.hpp"
7#include <sigc++/sigc++.h>
8#include <string>
9#include "imp/action_catalog.hpp"
10
11namespace horizon {
12using json = nlohmann::json;
13
14enum class InToolActionID;
15
17public:
18 Appearance appearance;
19 void load_from_json(const json &j);
20 void load_colors_from_json(const json &j);
21 json serialize() const;
22 json serialize_colors() const;
23};
24
26public:
27 bool show_all_junctions = false;
28 bool drag_start_net_line = true;
29 bool bend_non_ortho = true;
30
31 void load_from_json(const json &j);
32 json serialize() const;
33};
34
36public:
37 bool drag_start_track = true;
38 bool highlight_on_top = true;
39 bool show_text_in_tracks = true;
40 bool show_text_in_vias = true;
41 ShowViaSpan show_via_span = ShowViaSpan::BLIND_BURIED;
42 bool move_using_router = true;
43
44 void load_from_json(const json &j);
45 json serialize() const;
46};
47
49public:
50 std::map<ActionToolID, std::map<ActionCatalogItem::Availability, std::vector<KeySequence>>> keys;
51
52 void load_from_json(const json &j);
53 void append_from_json(const json &j);
54 json serialize() const;
55};
56
58public:
59 std::map<InToolActionID, std::vector<KeySequence>> keys;
60
61 void load_from_json(const json &j);
62 void append_from_json(const json &j);
63 json serialize() const;
64};
65
67public:
68 bool smooth_zoom_2d = true;
69 bool smooth_zoom_3d = false;
70 bool touchpad_pan = false;
71 float zoom_factor = 50;
72 bool keyboard_zoom_to_cursor = false;
73
74 void load_from_json(const json &j);
75 json serialize() const;
76};
77
79public:
80 bool show_hints = true;
81 unsigned int max_depth = 50;
82 bool never_forgets = false;
83
84 void load_from_json(const json &j);
85 json serialize() const;
86};
87
89public:
90 std::string url = "https://dev-partinfo.kitspace.org/graphql";
91 std::string preferred_distributor;
92 bool ignore_moq_gt_1 = true;
93 unsigned int max_price_breaks = 3;
94 unsigned int cache_days = 5;
95
96 void load_from_json(const json &j);
97 json serialize() const;
98};
99
101public:
102 std::string client_id;
103 std::string client_secret;
104 std::string site = "DE";
105 std::string currency = "EUR";
106 unsigned int max_price_breaks = 3;
107
108 void load_from_json(const json &j);
109 json serialize() const;
110};
111
113public:
114 bool enable = true;
115 bool remember = true;
116 bool show_in_tool = true;
117
118 void load_from_json(const json &j);
119 json serialize() const;
120};
121
123public:
124 bool switch_layers = true;
125 bool switch_sheets = true;
126 bool drag_polygon_edges = true;
127 bool drag_to_move = true;
128
129 void load_from_json(const json &j);
130 json serialize() const;
131};
132
134public:
135 bool vertical_layout = false;
136
137 void load_from_json(const json &j);
138 json serialize() const;
139};
140
142public:
143 bool dark_theme = false;
144
145 void load_from_json(const json &j);
146 json serialize() const;
147};
148
150public:
151 SpacenavPrefs prefs;
152
153 std::vector<ActionID> buttons;
154
155 void load_from_json(const json &j);
156 json serialize() const;
157};
158
160public:
161 InputDevicesPrefs prefs;
162
163 void load_from_json(const json &j);
164 json serialize() const;
165};
166
168public:
169 Preferences();
170 void set_filename(const std::string &filename);
171 void load();
172 void load_default();
173 void load_from_json(const json &j);
174 void save();
175 static std::string get_preferences_filename();
176 json serialize() const;
177
178 CanvasPreferences canvas_non_layer;
179 CanvasPreferences canvas_layer;
180 SchematicPreferences schematic;
181 BoardPreferences board;
182 KeySequencesPreferences key_sequences;
183 ZoomPreferences zoom;
184 bool capture_output = false;
185
186 enum class StockInfoProviderSel { NONE, PARTINFO, DIGIKEY };
187 StockInfoProviderSel stock_info_provider = StockInfoProviderSel::NONE;
188
189 PartInfoPreferences partinfo;
190 DigiKeyApiPreferences digikey_api;
191 ActionBarPreferences action_bar;
192 InToolKeySequencesPreferences in_tool_key_sequences;
193 MousePreferences mouse;
194 UndoRedoPreferences undo_redo;
195 AppearancePreferences appearance;
196 ToolBarPreferences tool_bar;
197 SpacenavPreferences spacenav;
198 InputDevicesPreferences input_devices;
199
200 bool show_pull_request_tools = false;
201 bool hud_debug = false;
202
203 typedef sigc::signal<void> type_signal_changed;
204 type_signal_changed signal_changed()
205 {
206 return s_signal_changed;
207 }
208
209private:
210 std::string filename;
211 type_signal_changed s_signal_changed;
212};
213} // namespace horizon
Definition preferences.hpp:112
Definition preferences.hpp:141
Definition appearance.hpp:7
Definition preferences.hpp:35
Definition preferences.hpp:16
Definition preferences.hpp:100
Definition preferences.hpp:57
Definition preferences.hpp:159
Definition input_devices_prefs.hpp:6
Definition preferences.hpp:48
Definition preferences.hpp:122
Definition preferences.hpp:88
Definition preferences.hpp:167
Definition preferences.hpp:25
Definition preferences.hpp:149
Definition preferences.hpp:133
Definition preferences.hpp:78
Definition preferences.hpp:66
a class to store JSON values
Definition json.hpp:177
basic_json<> json
default JSON class
Definition json_fwd.hpp:62
Definition spacenav_prefs.hpp:4