File: azr3gui.hpp

package info (click to toggle)
azr3-jack 1.2.3-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 952 kB
  • ctags: 771
  • sloc: cpp: 3,590; makefile: 54; sh: 43
file content (110 lines) | stat: -rw-r--r-- 3,640 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/****************************************************************************
    
    AZR-3 - An organ synth
    
    Copyright (C) 2006-2007 Lars Luthman <lars.luthman@gmail.com>
    
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License version 2 as published
    by the Free Software Foundation.
    
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
    
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 01222-1307  USA

****************************************************************************/

#ifndef AZR3_GTK_HPP
#define AZR3_GTK_HPP

#include <stdint.h>
#include <vector>

#include <gtkmm.h>

#include "drawbar.hpp"
#include "knob.hpp"
#include "switch.hpp"
#include "globals.hpp"
#include "textbox.hpp"


class AZR3GUI : public Gtk::HBox {
public:
  
  sigc::signal<void, uint32_t, float> signal_set_control;
  sigc::signal<void, unsigned char> signal_set_program;
  sigc::signal<void, unsigned char, std::string> signal_save_program;
  
  AZR3GUI();
  
  void set_control(uint32_t port, float value);
  void add_program(unsigned char number, const char* name);
  void remove_program(unsigned char number);
  void set_program(unsigned char number);
  void clear_programs();
  
  static Glib::RefPtr<Gdk::Pixmap> pixmap_from_file(const std::string& file, Glib::RefPtr<Gdk::Bitmap>* bitmap = 0);
  
protected:

  void control_changed(uint32_t index, float new_value);
  void program_changed(int program);
  
  void on_realize();
  
  static std::string note2str(long note);
  
  void splitbox_clicked();
  void set_back_pixmap(Widget* wdg, Glib::RefPtr<Gdk::Pixmap> pm);
  Knob* add_knob(Gtk::Fixed& fbox, Glib::RefPtr<Gdk::Pixmap>& pm, size_t port,
                 float min, float max, float value, 
                 int xoffset, int yoffset,
                 float dmin, float dmax, bool decimal);
  Drawbar* add_drawbar(Gtk::Fixed& fbox, Glib::RefPtr<Gdk::Pixmap>& pm,
		       size_t port, float min, float max, float value,
                       int xoffset, int yoffset, 
                       Drawbar::Type type);
  Switch* add_switch(Gtk::Fixed& fbox, size_t port,
                     int xoffset, int yoffset, Switch::Type type);
  Gtk::EventBox* add_clickbox(Gtk::Fixed& fbox, int xoffset, int yoffset, 
			      int width, int height);
  Textbox* add_textbox(Gtk::Fixed& fbox, Glib::RefPtr<Gdk::Pixmap>& pm,
                       int xoffset, int yoffset, int lines, 
                       int width, int height);
  bool change_mode(bool fx_mode, Gtk::Fixed& fbox);
  void splitpoint_changed();
  void update_program_menu();
  void update_split_menu();
  Gtk::Menu* create_menu();
  bool popup_menu(GdkEventButton* event, Gtk::Menu* menu);
  void display_scroll(int line, GdkEventScroll* e);
  void save_program();


  bool m_showing_fx_controls;
  std::vector<Widget*> m_fx_widgets;
  std::vector<Widget*> m_voice_widgets;
  std::map<int, std::string> m_programs;
  int m_current_program;
  int m_splitkey;
  Textbox* m_tbox;
  Switch* m_splitswitch;
  Gtk::Adjustment* m_splitpoint_adj;
  Gtk::Menu* m_program_menu;
  Gtk::Menu* m_split_menu;
  Gdk::Color m_menu_bg;
  Gdk::Color m_menu_fg;
  Gtk::Fixed m_fbox;
  Gtk::Fixed m_vbox;
  std::vector<Gtk::Adjustment*> m_adj;

};


#endif