1 /* 2 * ui_list.h 3 * DIN Is Noise is copyright (c) 2006-2021 Jagannathan Sampath 4 * For more information, please visit http://dinisnoise.org/ 5 */ 6 7 8 #ifndef __ui_list 9 #define __ui_list 10 11 12 #include "fader.h" 13 #include "filled_button.h" 14 #include "checkbutton.h" 15 #include "font_editor.h" 16 #include "field.h" 17 #include "label.h" 18 #include "settings.h" 19 #include "spinner.h" 20 #include "curve_display.h" 21 #include "plugin_browser.h" 22 #include "menu.h" 23 24 #include <SDL/SDL.h> 25 #include <map> 26 27 #define DEFINE_PARAMETERS \ 28 static const int npars = 17;\ 29 widget* pw [npars] = {\ 30 &d_parameters,\ 31 &ab_parameters,\ 32 &sp_voices,\ 33 &sp_attack_time, \ 34 &sp_decay_time,\ 35 &sp_pitch_bend,\ 36 &cb_show_nearby_notes,\ 37 &l_waveform_display,\ 38 &cd_waveform_display,\ 39 &ab_prev_wav,\ 40 &ab_next_wav,\ 41 &l_octave_shift,\ 42 &ab_octave_up,\ 43 &ab_octave_down,\ 44 &sp_octave_shift_bpm,\ 45 &b_abort_octave_shift,\ 46 &ol_trig_what,\ 47 }; 48 49 struct curve_editor; 50 struct din; 51 struct drone; 52 53 DECL_FIELD_LISTENER (attack_val) 54 DECL_FIELD_LISTENER (decay_val) 55 DECL_FIELD_LISTENER (voices_val) 56 DECL_STATE_LISTENER (compress__listener) 57 DECL_STATE_LISTENER (show_pitch_volume_listener) 58 DECL_CLICK_LISTENER (settings__listener) 59 DECL_CLICK_LISTENER (waveform_display_listener) 60 DECL_CLICK_LISTENER (parameters_listener) 61 DECL_CLICK_LISTENER (scroll_arrow_listener) 62 63 struct fade_button_listener : state_listener, fade_listener { 64 checkbutton* cb; 65 fader* f; 66 int* target; 67 state_listener* lsnr; 68 fade_button_listener (); 69 fade_button_listener (checkbutton* cb, fader* f, int* target); 70 void changed (checkbutton& c); 71 void after_fade (fader& f); 72 }; 73 74 struct voice_listener : fade_button_listener { voice_listenervoice_listener75 voice_listener (checkbutton* cb, fader* f, int* target) : fade_button_listener (cb, f, target) {} 76 void changed (checkbutton& c); 77 }; 78 79 80 struct pitch_bend_listener : state_listener, change_listener<field> { 81 void changed (checkbutton& b); 82 void changed (field& f); 83 }; 84 85 struct ui_list : ui { 86 87 std::vector<ui*> uis; 88 ui *current, *prev; 89 90 curve_editor* crved; 91 92 93 static const int MAX_EDITORS = 7; 94 static const Uint8 key [MAX_EDITORS]; // short cuts keys 2, 3, 4, 5, 6, 7 and 8 => MAX_EDITORS = 7 95 static ui* ed [MAX_EDITORS]; 96 97 double esct; 98 99 ui_list (); 100 101 void set_current (ui* u); 102 int set_editor (const std::string& name, int screen); 103 void load_editor (ui* e); 104 105 int rmb_clicked; 106 int handle_input (); 107 108 void bg (); 109 void draw (); 110 int escape_from_things (); 111 112 menu main_menu; 113 114 std::map<ui*, std::vector<widget*> > widgets_of; // every ui 115 void show_hide_widgets (int sh); 116 117 plugin_browser plugin__browser; 118 119 // common bottom line 120 checkbutton cb_delay; 121 fader fdr_delay; 122 123 checkbutton cb_compress; 124 compress__listener clis; 125 126 checkbutton cb_record; 127 128 // on microtonal keyboard 129 options_list ol_voice_is; 130 MAKE_OPTION_LISTENER (ol_voice_is_lis, vivl) 131 132 checkbutton cb_voice; 133 fader fdr_voice; 134 135 checkbutton cb_gater; 136 fader fdr_gater; 137 void flash_gater (); 138 139 arrow_button ab_scroll_left, ab_scroll_right, ab_scroll_up, ab_scroll_down; 140 scroll_arrow_listener sal; 141 checkbutton cb_show_pitch_volume_board, cb_show_pitch_volume_drones; 142 show_pitch_volume_listener spvl; 143 144 voice_listener vlis; 145 fade_button_listener glis, dlis; 146 147 // on mondrian 148 button l_mondrian_voices; 149 150 // on settings 151 button b_settings; 152 settings__listener slis; 153 settings settings_scr; 154 155 // keyboard-keyboard ui 156 // 157 label d_parameters; 158 arrow_button ab_parameters; 159 parameters_listener pal; 160 161 // attack/decay times 162 spinner<float> sp_attack_time, sp_decay_time; 163 spinner<int> sp_voices; 164 attack_val atv; 165 decay_val dkv; 166 voices_val vov; 167 168 // pitch bend 169 spinner<float> sp_pitch_bend; 170 checkbutton cb_show_nearby_notes; 171 pitch_bend_listener pbl; 172 173 // preset waveforms 174 label l_waveform_display; 175 curve_display cd_waveform_display; 176 arrow_button ab_prev_wav, ab_next_wav; 177 waveform_display_listener wdl; 178 179 // octave shift over bpm 180 label l_octave_shift; 181 arrow_button ab_octave_down, ab_octave_up; 182 spinner<float> sp_octave_shift_bpm; 183 button b_abort_octave_shift; 184 octave_shift_listener osl; 185 186 // keys trigger what? notes or noise? 187 options_list ol_trig_what; 188 MAKE_OPTION_LISTENER (trig_what_lis, twl); 189 190 void setup (); 191 void add_widgets (); 192 void update_widgets (int wnow = -1, int hnow = -1, int wprev = -1, int hprev = -1); 193 int update_bottom_line (); 194 195 float eval_fade (fader& fdr, checkbutton& cb); 196 int is_widget_on_screen (widget* w, ui* scr); 197 void dofft (); 198 void handle_plugin (widget* which, int what); 199 void set_edit_labels (); // see fractaliser, warper 200 int remove (widget* w); 201 void add (ui* u, widget* w); 202 203 MAKE_FIELD_LISTENER (dpeu_lis, dpeul) 204 struct drone_pend_ed_ui_t { 205 spinner<float> depth; 206 spinner<float> bpm; 207 } dpeu; 208 209 ~ui_list (); 210 211 }; 212 213 extern ui_list uis; 214 extern string user_data_dir; 215 216 #define UISP &uis 217 218 #endif 219