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 
39 private:
40  void canvas_update() override;
41  CoreSchematic core_schematic;
42  const std::string project_dir;
43  SearcherSchematic searcher;
44 
45  int handle_ask_net_merge(class Net *net, class Net *into);
46  int handle_ask_delete_component(class Component *comp);
47  void handle_select_sheet(Sheet *sh);
48  void handle_remove_sheet(Sheet *sh);
49  void handle_core_rebuilt();
50  void handle_tool_change(ToolID id) override;
51  void handle_move_to_other_sheet(const ActionConnection &conn);
52  void handle_highlight_group_tag(const ActionConnection &conn);
53  std::string last_pdf_filename;
54 
55  std::map<UUID, std::pair<float, Coordf>> sheet_views;
56  std::map<UUID, std::set<SelectableRef>> sheet_selections;
57  class SheetBox *sheet_box;
58  void handle_selection_cross_probe();
59  bool cross_probing_enabled = false;
60 
61  Coordf cursor_pos_drag_begin;
62  Target target_drag_begin;
63 
64  class BOMExportWindow *bom_export_window;
65  class PDFExportWindow *pdf_export_window;
66  class UnplacedBox *unplaced_box = nullptr;
67  void update_unplaced();
68 
69  void handle_drag();
70 
71  Glib::RefPtr<Gio::SimpleAction> toggle_snap_to_targets_action;
72 
73  int get_board_pid();
74 
75  UUID net_from_selectable(const SelectableRef &sr);
76 };
77 } // namespace horizon
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:166