Horizon
imp_schematic.hpp
1 #pragma once
2 #include "imp.hpp"
3 #include "core/core_schematic.hpp"
4 #include "search/searcher_schematic.hpp"
5 
6 namespace horizon {
7 class ImpSchematic : public ImpBase {
8 
9 public:
10  ImpSchematic(const std::string &schematic_filename, const std::string &block_filename,
11  const std::string &pictures_dir, const PoolParams &params);
12  void update_highlights() override;
13 
14 protected:
15  void construct() override;
16  bool handle_broadcast(const json &j) override;
17  void handle_maybe_drag() override;
18  void update_action_sensitivity() override;
19 
20  ActionCatalogItem::Availability get_editor_type_for_action() const override
21  {
22  return ActionCatalogItem::AVAILABLE_IN_SCHEMATIC;
23  };
24 
25  std::string get_hud_text(std::set<SelectableRef> &sel) override;
26  void search_center(const Searcher::SearchResult &res) override;
27  ActionToolID get_doubleclick_action(ObjectType type, const UUID &uu) override;
28  void expand_selection_for_property_panel(std::set<SelectableRef> &sel_extra,
29  const std::set<SelectableRef> &sel) override;
30 
31  Searcher *get_searcher_ptr() override
32  {
33  return &searcher;
34  }
35 
36  ToolID get_tool_for_drag_move(bool ctrl, const std::set<SelectableRef> &sel) const override;
37 
38  void update_monitor() override;
39 
40 
41 private:
42  void canvas_update() override;
43  CoreSchematic core_schematic;
44  const std::string project_dir;
45  SearcherSchematic searcher;
46 
47  int handle_ask_net_merge(class Net *net, class Net *into);
48  int handle_ask_delete_component(class Component *comp);
49  void handle_select_sheet(Sheet *sh);
50  void handle_remove_sheet(Sheet *sh);
51  void handle_core_rebuilt();
52  void handle_tool_change(ToolID id) override;
53  void handle_move_to_other_sheet(const ActionConnection &conn);
54  void handle_highlight_group_tag(const ActionConnection &conn);
55  std::string last_pdf_filename;
56 
57  std::map<UUID, std::pair<float, Coordf>> sheet_views;
58  std::map<UUID, std::set<SelectableRef>> sheet_selections;
59  class SheetBox *sheet_box;
60  void handle_selection_cross_probe();
61  bool cross_probing_enabled = false;
62 
63  Coordf cursor_pos_drag_begin;
64  Target target_drag_begin;
65 
66  class BOMExportWindow *bom_export_window;
67  class PDFExportWindow *pdf_export_window;
68  class UnplacedBox *unplaced_box = nullptr;
69  void update_unplaced();
70 
71  void handle_drag();
72 
73  Glib::RefPtr<Gio::SimpleAction> toggle_snap_to_targets_action;
74 
75  int get_board_pid();
76 
77  UUID net_from_selectable(const SelectableRef &sr);
78 };
79 } // namespace horizon
Definition: action.hpp:141
Definition: bom_export_window.hpp:14
A Component is an instanced Entity in a Block.
Definition: component.hpp:39
Definition: core_schematic.hpp:10
Definition: imp.hpp:38
Definition: imp_schematic.hpp:7
Definition: net.hpp:15
Definition: pdf_export_window.hpp:12
Definition: imp.hpp:27
Definition: searcher_schematic.hpp:5
Definition: searcher.hpp:57
Definition: searcher.hpp:8
Definition: selectables.hpp:33
Definition: sheet_box.hpp:6
Definition: sheet.hpp:39
Definition: target.hpp:7
This class encapsulates a UUID and allows it to be uses as a value type.
Definition: uuid.hpp:16
Definition: unplaced_box.hpp:9
a class to store JSON values
Definition: json.hpp:166