File: ctlbutton.h

package info (click to toggle)
eq10q 1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 592 kB
  • sloc: cpp: 2,105; makefile: 22
file content (94 lines) | stat: -rw-r--r-- 3,251 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
/***************************************************************************
 *   Copyright (C) 2009 by Pere Ràfols Soler                               *
 *   sapista2@gmail.com                                                    *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 *                                                                         *
 *   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  02111-1307, USA.             *
 ***************************************************************************/

#include <iostream>

#include <iomanip>

#include <cmath>

#include <gtkmm/button.h>
#include <gtkmm/box.h>
#include <gtkmm/spinbutton.h>
#include <gtkmm/alignment.h>

#include "constants.h"

#define GAIN_TYPE 0
#define FREQ_TYPE 1
#define Q_TYPE    2

#define ACCELERATION 15

class EQButton;

class CtlButton : public Gtk::Button{
  public:
    CtlButton(int type, float *value, float *f, EQButton *m_eqbutton);
    virtual ~CtlButton();
    void set_press();
    void set_depress();
    void set_button_number(float num);
    void set_freq_index(int index);
    virtual float get_freq_ptr();
  
    
  protected:
    virtual void on_button_depressed();
    virtual bool on_mouse_move(GdkEventMotion* event);
    
    
    virtual void set_value(int x, int y);
  
  private:  
    bool press,x_direction, first_time;
    int  act_val, ant_val, filter_type, ptr, acumula;
    float  *mouse_value, *f_ptr; //ptr es l'index de la taula, el fet k sigui float es un trukillu pel calcul de l'acceleracio
    EQButton *eqbutton_ref_ptr;
};

class EQButton : public Gtk::VBox{
  public:
    EQButton(int type, float *f, sigc::slot<void> m_slot, int *semafor);
    virtual ~EQButton();
    virtual void set_value(float val);
    virtual float get_value();
    virtual void set_freq_ptr(float index);
    virtual void hide_spin();
    virtual void set_spin_number();
   
    
  protected:
    Gtk::Alignment button_align;
    Gtk::SpinButton text_entry;
    CtlButton *ctlbutton;
    

    virtual bool on_button_double_clicked(GdkEventButton* event);
    virtual void on_enter_pressed();
    virtual void on_spin_change();
    //Funtion per sobreescriure en segons tipus de butto

    
  private:
    int filter_type;
    float value, *f_ptr; //punter a on guardem el valor
    int *stop;
};