Ardour  9.8-236-gb896344c8d
c1_panel.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2026 Holger Dehnhardt <holger@dehnhardt.org>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program; if not, write to the Free Software Foundation, Inc.,
16  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #ifndef __ardour_console1_panel_h__
20 #define __ardour_console1_panel_h__
21 
22 #include <string>
23 #include <vector>
24 
25 #include <ytkmm/drawingarea.h>
26 #include <ydkmm/pixbuf.h>
27 #include <ydkmm/general.h>
28 
29 #include "pbd/signals.h"
30 
31 #include "console1.h"
32 
33 namespace ArdourSurface {
34 
35 /* Centre of the printed name of a control in the picture and the width available for the text */
36 struct C1LabelPos
37 {
39  double x;
40  double y;
41  double w;
42  double h = 18;
43 };
44 
45 /* The picture of the controller with the current function of every control drawn over its printed name */
46 class C1Panel : public Gtk::DrawingArea
47 {
48 public:
49  C1Panel (Console1&, std::string const& image_path);
50 
51  /* in edit mode the labels can be dragged (wheel: width, shift+wheel: height); positions are saved per user */
52  void set_edit_mode (bool);
53  void reset_positions ();
54 
55 protected:
62 
63 private:
65  Glib::RefPtr<Gdk::Pixbuf> pixbuf;
67  void labels_changed ();
68 
69  std::vector<C1LabelPos> positions;
70  bool edit_mode;
71  int dragging;
72  double drag_dx;
73  double drag_dy;
74  double offset_x;
75 
76  int hit_test (double x, double y) const;
77  std::string positions_file () const;
78  void load_positions ();
79  void save_positions () const;
80 };
81 
82 }
83 
84 #endif /* __ardour_console1_panel_h__ */
PBD::ScopedConnectionList _connections
Definition: c1_panel.h:66
bool on_button_press_event(GdkEventButton *)
This is a default handler for the signal signal_button_press_event().
std::vector< C1LabelPos > positions
Definition: c1_panel.h:69
bool on_motion_notify_event(GdkEventMotion *)
This is a default handler for the signal signal_motion_notify_event().
bool on_scroll_event(GdkEventScroll *)
This is a default handler for the signal signal_scroll_event().
void on_size_request(Gtk::Requisition *)
This is a default handler for the signal signal_size_request().
std::string positions_file() const
bool on_expose_event(GdkEventExpose *)
This is a default handler for the signal signal_expose_event().
C1Panel(Console1 &, std::string const &image_path)
int hit_test(double x, double y) const
void save_positions() const
Glib::RefPtr< Gdk::Pixbuf > pixbuf
Definition: c1_panel.h:65
bool on_button_release_event(GdkEventButton *)
This is a default handler for the signal signal_button_release_event().
Console1::ControllerID id
Definition: c1_panel.h:38