1 // Licensed GNU LGPL v3 or later: http://www.gnu.org/licenses/lgpl.html
2 
3 #ifndef SPECTMORPH_MORPH_GRID_VIEW_HH
4 #define SPECTMORPH_MORPH_GRID_VIEW_HH
5 
6 #include "smmorphoperatorview.hh"
7 #include "smmorphgrid.hh"
8 #include "smcomboboxoperator.hh"
9 #include "smmorphgridwidget.hh"
10 #include "smcontrolview.hh"
11 
12 namespace SpectMorph
13 {
14 
15 class MorphGridView;
16 class MorphGridControlUI : public SignalReceiver
17 {
18   MorphGrid          *morph_grid;
19   MorphGridView      *morph_grid_view;
20   ControlView         cv_control;
21 
22 public:
23   enum ControlXYType { CONTROL_X, CONTROL_Y } ctl_xy;
24   MorphGridControlUI (MorphGridView *parent, MorphGrid *morph_grid, Widget *body_widget, ControlXYType ctl_xy);
25 
26   ComboBoxOperator *combobox;
27   Label            *title;
28   Slider           *slider;
29   Label            *label;
30   double            value;
31 
32 /* slots: */
33   void on_slider_changed (double value);
34   void on_control_changed();
35 };
36 
37 class MorphGridView : public MorphOperatorView
38 {
39 protected:
40   MorphGrid          *morph_grid;
41   MorphGridWidget    *grid_widget;
42   Label              *width_label;
43   Label              *height_label;
44   Label              *op_title;
45   ComboBoxOperator   *op_combobox;
46   Label              *delta_db_title;
47   Label              *delta_db_label;
48   Slider             *delta_db_slider;
49 
50   MorphGridControlUI *x_ui;
51   MorphGridControlUI *y_ui;
52 
53   void update_db_label (double db);
54 
55 public:
56   MorphGridView (Widget *parent, MorphGrid *op, MorphPlanWindow *morph_plan_window);
57 
58   double view_height() override;
59 
60 /* signals: */
61   Signal<> signal_grid_params_changed;
62 
63 /* slots: */
64   void on_grid_params_changed();
65   void on_delta_db_changed (double new_value);
66   void on_selection_changed();
67   void on_index_changed();
68   void on_operator_changed();
69 };
70 
71 }
72 
73 #endif
74