Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   Related Pages  

qwavwaveviewinterface.h

00001 /***************************************************************************
00002                           waveview.h  -  description
00003                              -------------------
00004     begin                : Mon Nov 18 2002
00005     copyright            : (C) 2002 by Peter Eschler
00006     email                : eschler@users.sourceforge.net
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef QwavWAVEVIEWINTERFACE_H
00019 #define QwavWAVEVIEWINTERFACE_H
00020 
00021 
00022 //---------------------------------------------------------------------------
00023 // Includes: Qt
00024 //---------------------------------------------------------------------------
00025 
00026 #include <qwidget.h>
00027 
00028 //---------------------------------------------------------------------------
00029 // Includes: system
00030 //---------------------------------------------------------------------------
00031 
00032 #include <vector>
00033 #include <iostream>
00034 #include <string>
00035 
00036 //---------------------------------------------------------------------------
00037 // Includes: project
00038 //---------------------------------------------------------------------------
00039 
00040 #include "qwavdefines.h"
00041 #include "qwavexceptions.h"
00042 #include "qwavwavedatainterface.h"
00043 
00044 using namespace std;
00045 
00046 Qwav_BEGIN_NAMESPACE
00047 
00048 //---------------------------------------------------------------------------
00049 // Forward declarations
00050 //---------------------------------------------------------------------------
00051 
00052 class QwavViewLayer;
00053 class QwavSelection;
00054 //class QwavWaveDataInterface;
00055 class QwavPeakInterpolator;
00056 
00057 //---------------------------------------------------------------------------
00058 // Class: QwavWaveViewInterface
00059 //---------------------------------------------------------------------------
00060 
00104 class QWAV_EXPORTIMPORT QwavWaveViewInterface 
00105 {
00106 //     Q_OBJECT
00107 //     Q_PROPERTY( QColor bgColor   READ bgColor   WRITE setBgColor   )
00108 //     Q_PROPERTY( QColor peakColor READ peakColor WRITE setPeakColor )    
00109 //     Q_PROPERTY( QColor avgColor  READ avgColor  WRITE setAvgColor  )
00110 
00111     friend class QwavMonoWaveView;
00112     friend class QwavStereoWaveView;
00113     
00114 public:
00115     enum State {
00116                  NORMAL,  
00117                  MOVING_SEL_BEGIN,
00118                  MOVING_SEL_END,
00119                  MOVING_MARKER
00120                };
00121                
00122     /*---------------------------------------------------------------------*/
00140     virtual int              addLayer       (QwavViewLayer* layer) =0;
00141 
00148     virtual QwavViewLayer*   getLayer       (const string& name)   =0;   
00149     
00155     virtual QwavViewLayer*   getLayer       (uint index)           =0;
00156     
00160     virtual uint             getNrOfLayers  (void)         const   =0;
00161     
00166     virtual QPixmap*         getBackbuf     (void)                 =0;
00167 
00171     /*---------------------------------------------------------------------*/
00184     virtual int          sample2Pixel   (long  sample) const = 0;
00185     
00186     
00197     virtual long         pixel2Sample   (int   pixel)  const = 0;
00198 
00205     virtual bool         isSampleVisible(long sample)  const = 0;
00206 
00212     inline const long   nrOfSamples    (void)         const;
00213     
00218     virtual const int    nrOfPixels     (void)         const = 0;
00219 
00220 
00237     virtual double       zoomFac        (void)         const = 0;
00238     
00242     virtual double       zoomYFac       (void)         const = 0;
00243     
00247     virtual double       maxZoomFac     (void)         const = 0;  
00248 
00252     virtual const unsigned long firstSample(void)      const = 0;
00253     
00257     virtual const long   lastSample     (void)         const = 0;    
00258     
00262     virtual const long   samplesVisible (void)         const = 0;
00263   
00267     inline QwavWaveDataInterface* waveData (void)      const;
00268     
00272     inline void setWaveData(QwavWaveDataInterface* wd);
00273     
00274     virtual void setPeakInterpolator(QwavPeakInterpolator* s)= 0;
00275     
00279     virtual QwavPeakInterpolator* peakInterpolator() const   = 0;
00280     
00281     inline void setBorderDist(uint topBorder, uint bottomBorder);
00282     inline const uint& topBorderDist() const;
00283     inline const uint& bottomBorderDist() const ;    
00284     
00287     /*---------------------------------------------------------------------*/
00294     virtual void   setPosition(const ulong sample) = 0;
00295     
00299     virtual const ulong& position() const          = 0;
00300 
00303     /*---------------------------------------------------------------------*/
00313     virtual uint           addSelection     (const QwavSelection& s)= 0;
00314     
00318     virtual uint           getNrOfSelections(void)         const = 0;
00319     
00326     virtual const QwavSelection& getSelection(uint index=0)const = 0;
00327     
00334     virtual QwavSelection& getSelection     (uint index=0)       = 0;
00335     
00342     virtual int            isSelectionBegin (int pixel )         = 0;
00343     
00350     virtual int            isSelectionEnd   (int pixel )         = 0;
00351 
00357     virtual int            activeSelection  (void)         const = 0;
00358         
00361     virtual void           clearSelections  (void)               = 0;
00362 
00369     virtual const State&   state            (void) const = 0;
00370 
00371 //signals:
00372     /*---------------------------------------------------------------------*/
00378     virtual void           selBeginChanged(long sample)          = 0;     
00379     
00382     virtual void           selEndChanged  (long sample)          = 0;     
00383     
00386     virtual void           zoomFacChanged (double fac )          = 0;
00387     
00390     virtual void           positionChanged(ulong sample)         = 0;     
00391 
00394     virtual void           firstSampleChanged(ulong sample)      = 0;
00395     
00398 //public slots:
00399     
00400     /*---------------------------------------------------------------------*/
00408     virtual void           setBgColor       (const QColor& c)    = 0;
00409     
00414     virtual const QColor&  bgColor          (void) const         = 0;
00415 
00420     virtual void           setPeakColor     (const QColor& c)    = 0;
00421     
00426     virtual const QColor&  peakColor        (void) const         = 0;
00427 
00432     virtual void           setAvgColor      (const QColor& c)    = 0;
00433 
00438     virtual const QColor&  avgColor         (void) const         = 0;
00439     
00442     /*---------------------------------------------------------------------*/
00446     virtual void           setSamplesVisible(const long& newVal) = 0;
00447 
00451     virtual void           setZoomFac       (double zoomFac)     = 0;
00452     
00456     virtual void           setZoomYFac      (double zoomYFac)    = 0;
00457     
00462     virtual void           setFirstSample   (ulong sample)       = 0;
00463     
00464     virtual void           setChannel       (uint channel=1)     = 0;
00465     virtual uint           channel          (void) const         = 0;
00466     virtual void           scrollBy         (int pixel)          = 0;
00469 protected:    
00470     QwavWaveViewInterface() 
00471         : _waveData(0),_interpolator(0), 
00472           _topBorderDist(0), _bottomBorderDist(0)  {};
00473         
00474     QwavWaveViewInterface(QwavWaveDataInterface* wd) 
00475         : _waveData(wd),_interpolator(0), 
00476           _topBorderDist(0), _bottomBorderDist(0) {};
00477        
00478 private:   
00479     QwavWaveDataInterface*  _waveData;  
00480     QwavPeakInterpolator*   _interpolator;
00481     uint                    _topBorderDist;
00482     uint                    _bottomBorderDist;
00483 };
00484 
00485 //---------------------------------------------------------------------------
00486 // Method: waveData
00487 //---------------------------------------------------------------------------
00488 
00489 QwavWaveDataInterface* QwavWaveViewInterface::waveData(void) const
00490 {
00491     return _waveData;
00492 }
00493 
00494 //---------------------------------------------------------------------------
00495 // Method: setWaveData
00496 //---------------------------------------------------------------------------
00497 
00498 void QwavWaveViewInterface::setWaveData(QwavWaveDataInterface* wd)
00499 {
00500     _waveData = wd;
00501 }
00502 
00503 
00504 //---------------------------------------------------------------------------
00505 // Method: nrOfSamples
00506 //---------------------------------------------------------------------------
00507 
00508 const long QwavWaveViewInterface::nrOfSamples() const
00509 {
00510     return waveData()->nrOfSamples();    
00511 }
00512 
00513 void QwavWaveViewInterface::setBorderDist(uint topBorder, uint bottomBorder)
00514 {
00515     _topBorderDist = topBorder;
00516     _bottomBorderDist = bottomBorder;
00517 }
00518 
00519 const uint& QwavWaveViewInterface::topBorderDist() const
00520 {
00521     return _topBorderDist;
00522 }
00523 
00524 const uint& QwavWaveViewInterface::bottomBorderDist() const
00525 {
00526     return _bottomBorderDist;
00527 }
00528 
00529 
00530 
00531 Qwav_END_NAMESPACE
00532 
00533 #endif // QwavWAVEVIEW_H
00534 

Generated on Mon Jan 20 00:24:54 2003 for Qwav by doxygen1.2.16