Guitarix
gx_sequencer_settings.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2017 Hermann Meyer, Andreas Degert
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
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
17  */
18 
19 #pragma once
20 
21 #ifndef SRC_HEADERS_GX_SEQUENCER_SETTINGS_H_
22 #define SRC_HEADERS_GX_SEQUENCER_SETTINGS_H_
23 
24 
25 #include <string>
26 
27 namespace gx_seq {
28 
29 class Drums {
30  public:
32  Gtk::HBox* box;
34  : p(pa) {}
35  ~Drums() {}
36 };
37 
38 class UPresetListStore: public Gtk::ListStore {
39  public:
40  class UPresetListColumns : public Gtk::TreeModel::ColumnRecord {
41  public:
42  Gtk::TreeModelColumn<Glib::ustring> name;
43  UPresetListColumns() { add(name); }
44  } col;
45  private:
46  UPresetListStore(): Gtk::ListStore(), col() {
47  set_column_types(col);
48  }
49  public:
50  static Glib::RefPtr<UPresetListStore> create() {
51  return Glib::RefPtr<UPresetListStore>(new UPresetListStore);
52  }
53 };
54 
55 /****************************************************************
56  ** PluginPresetConnectWindow
57  */
58 
59 class PluginPresetConnectWindow: public Gtk::Window {
60  private:
61  Glib::RefPtr<UPresetListStore> upresetliststore;
62  gx_engine::GxMachineBase& machine;
63  Gtk::TreeView *treeview;
64  Gtk::Button *connectbutton;
65  void on_connect();
66  void on_selection_changed();
67  virtual bool on_key_press_event(GdkEventKey *event);
68  static PluginPresetConnectWindow* create_from_builder(
69  BaseObjectType* cobject, Glib::RefPtr<gx_gui::GxBuilder> bld,
70  gx_engine::GxMachineBase& machine);
71  PluginPresetConnectWindow(BaseObjectType* cobject,
72  Glib::RefPtr<gx_gui::GxBuilder> bld, gx_engine::GxMachineBase& machine);
73  public:
75  static PluginPresetConnectWindow *create(gx_engine::GxMachineBase& machine);
76  void run();
77 };
78 
79 /****************************************************************
80  ** Sequencer Parameter Window
81  */
82 
83 class SEQWindow: public sigc::trackable {
84  private:
85  gx_engine::GxMachineBase& machine;
86  Glib::RefPtr<gx_gui::GxBuilder> builder;
87  std::vector<Drums> drums;
88  Drums tom;
89  Drums tom1;
90  Drums tom2;
91  Drums kick;
92  Drums snare;
93  Drums hat;
94  bool is_active;
95 
96  // widget pointers
97  Gtk::Window* gtk_window;
98  Gtk::Viewport *vp;
99  Gtk::Label *preset_label;
100  Gtk::HBox *preset_button;
101  Gxw::Switch *add_button;
102  Gxw::Regler *seq_pos;
103  Gxw::Regler *seq_count;
104  Gxw::Regler *seq_tact;
105  Gxw::Switch *next_preset;
106  Gxw::Switch *previus_preset;
107  Gxw::Switch *set_step;
108  Gxw::Switch *set_fstep;
109  Gxw::Switch *set_sync;
110  Gxw::Switch *reset_step;
111 
112  // signal functions
113  void on_window_hide();
114  void on_preset_popup_clicked();
115  void on_selection_done(Gtk::Menu *presetMenu);
116  bool get_sequencer_pos(Gxw::Regler * regler, const std::string id);
117  bool on_key_press_event(GdkEventKey *event);
118  void check_preset_label();
119  void seq_changed(const gx_engine::GxSeqSettings* seqc, Gtk::HBox *box);
120  void make_state(gx_engine::GxSeqSettings& seqc, std::vector<int> seq);
121  void on_seq_button_clicked(Gtk::HBox *box, gx_engine::SeqParameter *p);
122  void on_seq_button_clicked_set(Gtk::HBox *box, gx_engine::SeqParameter *p);
123  void on_sec_length_changed(bool update);
124  void on_sec_tact_changed();
125  void append_seq_block(Gtk::HBox * box, gx_engine::SeqParameter *p, int r, int r_save);
126  void remove_seq_block(Gtk::HBox * box, int r);
127  void reset_control(Glib::ustring id, float value);
128  int append_sequence(const gx_engine::GxSeqSettings* seqc, gx_engine::SeqParameter *p, std::vector<int> *sequence);
129  void make_preset_button(Gtk::HBox *box);
130  void scroll_playhead(float value);
131  void append_plugin_preset(Glib::ustring name);
132  void append_plugin_preset_set(Glib::ustring name);
133  void on_preset_add_clicked();
134  void on_next_preset();
135  void on_next_preset_set();
136  void on_previus_preset();
137  void on_previus_preset_set();
138  void connect_midi();
139  void on_set_step();
140  void on_set_fstep();
141  void on_sync_stepper();
142  void on_reset_stepper();
143  void init_connect();
144  void init_sequences(gx_engine::SeqParameter *p, Gtk::HBox* _box);
145  SEQWindow(const Glib::RefPtr<gx_gui::GxBuilder>& builder, gx_engine::SeqParameter *tomp_,
149  ~SEQWindow();
150 
151 public:
152  void reload_and_show();
153  static SEQWindow *create(const std::string& unit_id, gx_engine::GxMachineBase& machine);
154 };
155 
156 } /* end of gx_seq namespace*/
157 #endif // SRC_HEADERS_GX_SEQUENCER_SETTINGS_H_
Gtk::TreeModelColumn< Glib::ustring > name
Drums(gx_engine::SeqParameter *pa)
static Glib::RefPtr< UPresetListStore > create()
gx_engine::SeqParameter * p