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 ¶ms); 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(bool ctrl) override; 18 void update_action_sensitivity() override; 19 get_editor_type_for_action() const20 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 get_searcher_ptr()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 void handle_next_prev_sheet(const ActionConnection &conn); 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() override; 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 void handle_extra_button(const GdkEventButton *button_event) override; 74 75 Glib::RefPtr<Gio::SimpleAction> toggle_snap_to_targets_action; 76 77 int get_board_pid(); 78 79 UUID net_from_selectable(const SelectableRef &sr); 80 }; 81 } // namespace horizon 82