summaryrefslogtreecommitdiff
path: root/noncore/multimedia/powerchord/fretboard.h
blob: d316df3cfc7cc36ea756c2892d28a5f2d5163ff5 (plain)
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
//
// FretBoard class to display interface for chord finder application
//

// Copyright (c) 2001 Camilo Mesias
// camilo@mesias.co.uk
//
// 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.

#ifndef __FRETBOARD_H
#define __FRETBOARD_H

//#include <FL/Fl.H>
//#include <FL/Fl_Widget.H>

#include <qwidget.h>
#include <qpixmap.h>
#include <qstring.h>

#include "chordengine.h"

class FretBoard : public QWidget {

    Q_OBJECT

 private:

    // refresh display based on chord engine
    void refresh();

    // image stuff
    QPixmap stringtop_pix;
    QPixmap string_pix;
    QPixmap finger_pix;
    QPixmap mute_pix;

  //saved state of the fretboard

  int initial_fret;
  int finger[6];

 protected:
  //  void draw_box();
  //  void draw_label();
  void paintEvent(QPaintEvent *);

 public:
  // encapsulated chord engine class
  ChordEngine ce;

  static const int MUTED=7;
  static const int OPEN=0;

  //  void draw();
  FretBoard(QWidget *parent=0, const char *name=0);

  // not used yet
  //  int Finger(int finger);
  //  int Fret(){return initial_fret;};

  // slots
  public slots:
      void Finger(int finger, int position);
  
  void Fret(int position){
    initial_fret = position;
    ce.fret(position);
    refresh();
  };
  void Base(int b){ce.base(b);refresh();};
  void Chord(int b){ce.chord(b);refresh();};
  void Span(int b){ce.span(b);refresh();};
  void Vary(int b){ce.vary(b);refresh();};
  void Tune(int b){ce.tune(b);refresh();};

  signals:
  void nameChanged(const QString &);
  void s1nameChanged(const QString &);
  void s2nameChanged(const QString &);
  void s3nameChanged(const QString &);
  void s4nameChanged(const QString &);
  void s5nameChanged(const QString &);
  void s6nameChanged(const QString &);

};

#endif