Horizon
layer_box.hpp
1 #pragma once
2 #include <gtkmm.h>
3 #include "schematic/sheet.hpp"
4 #include "canvas/layer_display.hpp"
5 #include "canvas/canvas_gl.hpp"
6 
7 namespace horizon {
8 class LayerBox : public Gtk::Box {
9 public:
10  LayerBox(class LayerProvider &lp, bool show_title = true);
11  void set_layer_color(int layer, const Color &c);
12  void update();
13  Glib::PropertyProxy<int> property_work_layer()
14  {
15  return p_property_work_layer.get_proxy();
16  }
17  typedef sigc::signal<void, int, LayerDisplay> type_signal_set_layer_display;
18  type_signal_set_layer_display signal_set_layer_display()
19  {
20  return s_signal_set_layer_display;
21  }
22 
23 
24  Glib::PropertyProxy<float> property_layer_opacity()
25  {
26  return p_property_layer_opacity.get_proxy();
27  }
28  Glib::PropertyProxy<CanvasGL::HighlightMode> property_highlight_mode()
29  {
30  return p_property_highlight_mode.get_proxy();
31  }
32  Glib::PropertyProxy<CanvasGL::LayerMode> property_layer_mode()
33  {
34  return p_property_layer_mode.get_proxy();
35  }
36  void set_layer_display(int layer, const LayerDisplay &ld);
37 
38  json serialize();
39  void load_from_json(const json &j);
40 
41 private:
42  class LayerProvider &lp;
43 
44  Gtk::ListBox *lb = nullptr;
45 
46  Glib::Property<int> p_property_work_layer;
47  Glib::Property<float> p_property_layer_opacity;
48  Glib::Property<CanvasGL::HighlightMode> p_property_highlight_mode;
49  Glib::Property<CanvasGL::LayerMode> p_property_layer_mode;
50  type_signal_set_layer_display s_signal_set_layer_display;
51  void emit_layer_display(class LayerBoxRow *row);
52  void update_work_layer();
53 
54  Glib::RefPtr<Glib::Binding> binding_select_work_layer_only;
55  Glib::RefPtr<Glib::Binding> binding_layer_opacity;
56 };
57 } // namespace horizon
nlohmann::basic_json
a class to store JSON values
Definition: json.hpp:166