1 /*************************************************************************** 2 * Copyright (C) 2009 by Pere Ràfols Soler * 3 * sapista2@gmail.com * 4 * * 5 * This program is free software; you can redistribute it and/or modify * 6 * it under the terms of the GNU General Public License as published by * 7 * the Free Software Foundation; either version 2 of the License, or * 8 * (at your option) any later version. * 9 * * 10 * This program is distributed in the hope that it will be useful, * 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 13 * GNU General Public License for more details. * 14 * * 15 * You should have received a copy of the GNU General Public License * 16 * along with this program; if not, write to the * 17 * Free Software Foundation, Inc., * 18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * 19 ***************************************************************************/ 20 21 #include <iostream> 22 23 #include <fstream> 24 #include <string> 25 26 #include <pstreams/pstream.h> 27 #include <stdlib.h> 28 29 #include <gtkmm/alignment.h> 30 #include <gtkmm/box.h> 31 #include <gtkmm/button.h> 32 #include <gtkmm/comboboxentrytext.h> 33 #include <gtkmm/entry.h> 34 #include <gtkmm/label.h> 35 #include <gtkmm/messagedialog.h> 36 37 #include "types.h" 38 39 #define FILE_NAME "/.RafolsEQ/eq_presets.prs" 40 #define FILE_NAME_AUX "/.RafolsEQ/eq_presets.aux" 41 #define NAME_LONG 100 42 43 #ifndef MAIN_WINDOW_WIDGET 44 #define MAIN_WINDOW_WIDGET 45 class main_window; 46 #endif 47 //using namespace std; 48 49 class TemplateWidget : public Gtk::Alignment{ 50 public: 51 TemplateWidget(main_window *m_ptr, 52 void (*f_set_ptr) (main_window *myptr, int b_ix, int type, float g, float f, float Q), 53 void (*f_get_ptr) (main_window *myptr,int band_id, BandParams &m_params)); 54 virtual ~TemplateWidget(); 55 virtual void load_combo_list(); 56 57 protected: 58 Gtk::HBox m_box; 59 Gtk::Button b_load, b_save, b_remove; 60 Gtk::ComboBoxEntryText preset_combo; 61 Gtk::Label l_presets; 62 63 virtual void on_load_clicked(); 64 virtual void on_save_clicked(); 65 virtual void on_delete_clicked(); 66 virtual void on_combo_move(); 67 68 int current_preset; 69 70 struct filter_params{ 71 int type; 72 float gain, freq, Q; 73 }; 74 75 struct f_register{ 76 char name[NAME_LONG]; 77 int name_length; 78 filter_params fparams[10]; 79 }; 80 81 f_register f_filter; 82 83 //Function ptr to main 84 void (*external_set_ptr) (main_window *ptr, int b_ix, int type, float g, float f, float Q); 85 void (*external_get_ptr) (main_window *ptr, int band_id, BandParams &m_param); 86 87 //Structura tipus de filtre 88 BandParams band_param; 89 90 //Directori del home 91 std::string strhomedir; 92 93 //punter a main_window 94 main_window *main_win_ptr; 95 96 };