1 #pragma once 2 #include "util/uuid.hpp" 3 #include "util/placement.hpp" 4 #include <gtkmm.h> 5 6 namespace horizon { 7 class PreviewCanvas : public Gtk::Overlay { 8 public: 9 PreviewCanvas(class IPool &pool, bool layered); 10 void load(ObjectType ty, const UUID &uu, const Placement &pl = Placement(), bool fit = true); 11 void load_symbol(const UUID &uu, const Placement &pl = Placement(), bool fit = true, const UUID &uu_part = UUID(), 12 const UUID &uu_gate = UUID()); 13 void load(class Package &pkg, bool fit = true); 14 class CanvasGL &get_canvas(); 15 void set_has_scale(bool has_scale); 16 void clear(); 17 18 private: 19 class IPool &pool; 20 class CanvasGL *canvas = nullptr; 21 Gtk::Label *scale_label = nullptr; 22 Gtk::Frame *frame = nullptr; 23 class ScaleBar *scale_bar = nullptr; 24 bool update_scale(); 25 void update_scale_deferred(); 26 sigc::connection timeout_connection; 27 }; 28 } // namespace horizon 29