Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

fretboard.h

Go to the documentation of this file.
00001 //
00002 // FretBoard class to display interface for chord finder application
00003 //
00004 
00005 // Copyright (c) 2001 Camilo Mesias
00006 // camilo@mesias.co.uk
00007 //
00008 // This program is free software; you can redistribute it and/or
00009 // modify it under the terms of the GNU General Public License
00010 // as published by the Free Software Foundation; either version 2
00011 // of the License, or (at your option) any later version.
00012 //
00013 // This program is distributed in the hope that it will be useful,
00014 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00015 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016 // GNU General Public License for more details.
00017 //
00018 // You should have received a copy of the GNU General Public License
00019 // along with this program; if not, write to the Free Software
00020 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00021 
00022 #ifndef __FRETBOARD_H
00023 #define __FRETBOARD_H
00024 
00025 //#include <FL/Fl.H>
00026 //#include <FL/Fl_Widget.H>
00027 
00028 #include <qwidget.h>
00029 #include <qpixmap.h>
00030 #include <qstring.h>
00031 
00032 #include "chordengine.h"
00033 
00034 class FretBoard : public QWidget {
00035 
00036     Q_OBJECT
00037 
00038  private:
00039 
00040     // refresh display based on chord engine
00041     void refresh();
00042 
00043     // image stuff
00044     QPixmap stringtop_pix;
00045     QPixmap string_pix;
00046     QPixmap finger_pix;
00047     QPixmap mute_pix;
00048 
00049   //saved state of the fretboard
00050 
00051   int initial_fret;
00052   int finger[6];
00053 
00054  protected:
00055   //  void draw_box();
00056   //  void draw_label();
00057   void paintEvent(QPaintEvent *);
00058 
00059  public:
00060   // encapsulated chord engine class
00061   ChordEngine ce;
00062 
00063   static const int MUTED=7;
00064   static const int OPEN=0;
00065 
00066   //  void draw();
00067   FretBoard(QWidget *parent=0, const char *name=0);
00068 
00069   // not used yet
00070   //  int Finger(int finger);
00071   //  int Fret(){return initial_fret;};
00072 
00073   // slots
00074   public slots:
00075       void Finger(int finger, int position);
00076   
00077   void Fret(int position){
00078     initial_fret = position;
00079     ce.fret(position);
00080     refresh();
00081   };
00082   void Base(int b){ce.base(b);refresh();};
00083   void Chord(int b){ce.chord(b);refresh();};
00084   void Span(int b){ce.span(b);refresh();};
00085   void Vary(int b){ce.vary(b);refresh();};
00086   void Tune(int b){ce.tune(b);refresh();};
00087 
00088   signals:
00089   void nameChanged(const QString &);
00090   void s1nameChanged(const QString &);
00091   void s2nameChanged(const QString &);
00092   void s3nameChanged(const QString &);
00093   void s4nameChanged(const QString &);
00094   void s5nameChanged(const QString &);
00095   void s6nameChanged(const QString &);
00096 
00097 };
00098 
00099 #endif
00100 
00101 

Generated on Sat Nov 5 16:17:35 2005 for OPIE by  doxygen 1.4.2