2 #include "canvas/selectables.hpp" 3 #include "canvas/target.hpp" 4 #include "common/layer.hpp" 5 #include "common/object_descr.hpp" 7 #include "dialogs/dialogs.hpp" 8 #include "nlohmann/json_fwd.hpp" 9 #include "pool/pool.hpp" 10 #include "pool/symbol.hpp" 11 #include <gdk/gdkkeysyms.h> 14 #include <sigc++/sigc++.h> 17 enum class ToolEventType { MOVE, CLICK, CLICK_RELEASE, KEY, LAYER_CHANGE };
45 EDIT_SYMBOL_PIN_NAMES,
70 EDIT_PARAMETER_PROGRAM,
71 EDIT_PAD_PARAMETER_SET,
72 DRAW_POLYGON_RECTANGLE,
75 EDIT_SCHEMATIC_PROPERTIES,
76 ROUTE_TRACK_INTERACTIVE,
89 ROUTE_DIFFPAIR_INTERACTIVE,
93 DRAG_TRACK_INTERACTIVE,
112 std::set<SelectableRef> selection;
113 bool keep_selection =
false;
128 ToolID next_tool = ToolID::NONE;
129 bool end_tool =
false;
174 void set_transient();
220 ToolID tool_id = ToolID::NONE;
221 bool is_transient =
false;
249 class Core :
public sigc::trackable {
251 virtual bool has_object_type(ObjectType ty)
256 virtual class Junction *insert_junction(
const UUID &uu,
bool work =
true);
257 virtual class Junction *get_junction(
const UUID &uu,
bool work =
true);
258 virtual void delete_junction(
const UUID &uu,
bool work =
true);
260 virtual class Line *insert_line(
const UUID &uu,
bool work =
true);
261 virtual class Line *get_line(
const UUID &uu,
bool work =
true);
262 virtual void delete_line(
const UUID &uu,
bool work =
true);
264 virtual class Arc *insert_arc(
const UUID &uu,
bool work =
true);
265 virtual class Arc *get_arc(
const UUID &uu,
bool work =
true);
266 virtual void delete_arc(
const UUID &uu,
bool work =
true);
268 virtual class Text *insert_text(
const UUID &uu,
bool work =
true);
269 virtual class Text *get_text(
const UUID &uu,
bool work =
true);
270 virtual void delete_text(
const UUID &uu,
bool work =
true);
272 virtual class Polygon *insert_polygon(
const UUID &uu,
bool work =
true);
273 virtual class Polygon *get_polygon(
const UUID &uu,
bool work =
true);
274 virtual void delete_polygon(
const UUID &uu,
bool work =
true);
276 virtual class Hole *insert_hole(
const UUID &uu,
bool work =
true);
277 virtual class Hole *get_hole(
const UUID &uu,
bool work =
true);
278 virtual void delete_hole(
const UUID &uu,
bool work =
true);
282 virtual void delete_dimension(
const UUID &uu);
284 virtual std::vector<Line *> get_lines(
bool work =
true);
285 virtual std::vector<Arc *> get_arcs(
bool work =
true);
287 virtual class Block *get_block(
bool work =
true)
296 virtual void rebuild(
bool from_undo =
false);
299 std::pair<bool, bool> tool_can_begin(ToolID tool_id,
const std::set<SelectableRef> &selection);
300 bool tool_handles_esc();
301 virtual void commit() = 0;
302 virtual void revert() = 0;
303 virtual void save() = 0;
307 bool can_undo()
const;
308 bool can_redo()
const;
310 inline bool tool_is_active()
312 return tool !=
nullptr;
315 virtual bool set_property(ObjectType type,
const UUID &uu, ObjectProperty::ID property,
317 virtual bool get_property(ObjectType type,
const UUID &uu, ObjectProperty::ID property,
class PropertyValue &value);
318 virtual bool get_property_meta(ObjectType type,
const UUID &uu, ObjectProperty::ID property,
321 virtual std::string get_display_name(ObjectType type,
const UUID &uu);
323 void set_property_begin();
324 void set_property_commit();
325 bool get_property_transaction()
const;
336 virtual json get_meta();
338 virtual class Rules *get_rules()
342 virtual void update_rules()
346 virtual std::pair<Coordi, Coordi> get_bbox() = 0;
351 std::set<SelectableRef> selection;
354 bool get_needs_save()
const;
355 void set_needs_save();
357 typedef sigc::signal<void, ToolID> type_signal_tool_changed;
358 type_signal_tool_changed signal_tool_changed()
360 return s_signal_tool_changed;
362 typedef sigc::signal<void> type_signal_rebuilt;
363 type_signal_rebuilt signal_rebuilt()
365 return s_signal_rebuilt;
374 return s_signal_save;
377 type_signal_rebuilt signal_can_undo_redo()
379 return s_signal_can_undo_redo;
382 typedef sigc::signal<json> type_signal_request_save_meta;
389 return s_signal_request_save_meta;
392 typedef sigc::signal<void, bool> type_signal_needs_save;
393 type_signal_needs_save signal_needs_save()
395 return s_signal_needs_save;
399 virtual std::map<UUID, Junction> *get_junction_map(
bool work =
true)
403 virtual std::map<UUID, Line> *get_line_map(
bool work =
true)
407 virtual std::map<UUID, Arc> *get_arc_map(
bool work =
true)
411 virtual std::map<UUID, Text> *get_text_map(
bool work =
true)
415 virtual std::map<UUID, Polygon> *get_polygon_map(
bool work =
true)
419 virtual std::map<UUID, Hole> *get_hole_map(
bool work =
true)
423 virtual std::map<UUID, Dimension> *get_dimension_map()
428 bool reverted =
false;
429 std::unique_ptr<ToolBase> tool =
nullptr;
430 type_signal_tool_changed s_signal_tool_changed;
431 type_signal_rebuilt s_signal_rebuilt;
432 type_signal_rebuilt s_signal_save;
433 type_signal_rebuilt s_signal_can_undo_redo;
434 type_signal_request_save_meta s_signal_request_save_meta;
435 type_signal_needs_save s_signal_needs_save;
436 bool needs_save =
false;
437 void set_needs_save(
bool v);
448 std::deque<std::unique_ptr<HistoryItem>> history;
449 int history_current = -1;
450 virtual void history_push() = 0;
451 virtual void history_load(
unsigned int i) = 0;
452 bool property_transaction =
false;
459 std::unique_ptr<ToolBase> create_tool(ToolID tool_id);
Polygon used in Padstack, Package and Board for specifying filled Regions.
Definition: polygon.hpp:27
a class to store JSON values
Definition: json.hpp:161
type_signal_request_save_meta signal_request_save_meta()
connect to this signal for providing meta information when the document is saved
Definition: core.hpp:387
Graphical line.
Definition: line.hpp:19
Definition: core_properties.hpp:7
Definition: placement.hpp:8
A block is one level of hierarchy in the netlist.
Definition: block.hpp:25
Tools use this class to actually access the core.
Definition: cores.hpp:13
Used wherever a user-editable text is needed.
Definition: text.hpp:18
Definition: imp_interface.hpp:6
Where Tools and and documents meet.
Definition: core.hpp:249
Definition: dimension.hpp:12
Definition: layer_provider.hpp:7
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
Stores objects (Unit, Entity, Symbol, Part, etc.) from the pool.
Definition: pool.hpp:18
type_signal_rebuilt signal_save()
Gets emitted right before saving.
Definition: core.hpp:372
A Junction is a point in 2D-Space.
Definition: junction.hpp:25
Graphical arc.
Definition: arc.hpp:20
A hole with diameter and position, that's it.
Definition: hole.hpp:19