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

qwavstereowaveview.h

00001 /***************************************************************************
00002                           soneframedview.h  -  description
00003                              -------------------
00004     begin                : Sat Nov 9 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 Qwav_STEREOWAVEVIEW_H
00019 #define Qwav_STEREOWAVEVIEW_H
00020 
00021 //---------------------------------------------------------------------------
00022 // Includes: Qt
00023 //---------------------------------------------------------------------------
00024 
00025 #include <qwidget.h>
00026 #include <qlayout.h>
00027 #include <qlabel.h>
00028 #include <qlineedit.h>
00029 #include <qpushbutton.h>
00030 #include <qslider.h>
00031 #include <qscrollbar.h>
00032 
00033 //---------------------------------------------------------------------------
00034 // Includes: project
00035 //---------------------------------------------------------------------------
00036 
00037 #include "qwavdefines.h"
00038 #include "qwavwaveview.h"
00039 #include "qwavwaveviewinterface.h"
00040 
00041 //---------------------------------------------------------------------------
00042 // Includes: Qwt
00043 //---------------------------------------------------------------------------
00044 
00045 #include "qwt_slider.h"
00046 #include "qwt_scale.h"
00047 
00048 // moc namespace workaround
00049 Qwav_USING_NAMESPACE
00050 
00051 Qwav_BEGIN_NAMESPACE
00052 
00053 //---------------------------------------------------------------------------
00054 // Forward declarations
00055 //---------------------------------------------------------------------------
00056 
00057 class QwavWaveDataInterface;
00058 
00067 //---------------------------------------------------------------------------
00068 // Class: QwavStereoWaveView
00069 //---------------------------------------------------------------------------
00070 
00071 class QWAV_EXPORTIMPORT QwavStereoWaveView 
00072   : public QWidget, 
00073     public QwavWaveViewInterface
00074 {
00075     Q_OBJECT
00076     
00077 public:
00078 
00079     /*---------------------------------------------------------------------*/
00083     QwavStereoWaveView(QwavWaveDataInterface* waveData, 
00084                    QWidget*           parent,
00085                    const char*        name, 
00086                    int                wflags);
00087                    
00088     QwavStereoWaveView(const string&      file, 
00089                    QWidget*           parent, 
00090                    const char*        name)                   
00091          throw( InvalidNrOfChannels, FileOpenError, FileReadError );
00092          
00093     virtual ~QwavStereoWaveView();
00094 
00098     /*---------------------------------------------------------------------*/
00103     virtual void update(QWidget* pSender);
00104 
00108     /*---------------------------------------------------------------------*/
00112     inline int              addLayer       (QwavViewLayer* layer);
00113     inline QwavViewLayer*   getLayer       (const string& name)  ;    
00114     inline QwavViewLayer*   getLayer       (uint index)          ;
00115     inline uint             getNrOfLayers  (void)         const  ;
00116     inline QPixmap*         getBackbuf     (void)                ;
00117 
00121     /*---------------------------------------------------------------------*/
00125     inline int          sample2Pixel   (long  sample) const;
00126     inline long         pixel2Sample   (int   pixel)  const;
00127     
00128     inline bool         isSampleVisible(long sample)  const;
00129     inline const int    nrOfPixels     (void)         const;
00130 
00131     inline double       zoomFac        (void)         const;
00132     inline double       zoomYFac       (void)         const;
00133     inline double       maxZoomFac     (void)         const;  
00134 
00135     inline const ulong  firstSample    (void)         const;
00136     inline const long   lastSample     (void)         const;    
00137     inline const long   samplesVisible (void)         const;
00138   
00139     inline void setPeakInterpolator(QwavPeakInterpolator* s);
00140     inline QwavPeakInterpolator* peakInterpolator() const;
00141     
00144     /*---------------------------------------------------------------------*/
00148     inline void                setPosition(const ulong sample);
00149     inline const ulong&        position() const               ;
00150 
00154     /*---------------------------------------------------------------------*/
00158     inline uint           addSelection     (const QwavSelection& s);
00159     inline uint           getNrOfSelections(void)         const;
00160     inline const QwavSelection& getSelection(uint index=0)const;
00161     inline QwavSelection& getSelection     (uint index=0)      ;
00162     inline int            isSelectionBegin (int pixel )        ;
00163     inline int            isSelectionEnd   (int pixel )        ;
00164     inline int            activeSelection  (void)         const;
00165     inline void           clearSelections  (void)              ;
00166 
00169     inline const State&   state            (void) const;
00170     
00171 signals:
00172     void           selBeginChanged(long sample);     
00173     void           selEndChanged  (long sample);     
00174     void           zoomFacChanged (double fac );     
00175     void           positionChanged(ulong sample);
00176     void           firstSampleChanged(ulong sample);
00177     
00178 public slots:
00179     void activatePeakLayer(bool);
00180     void activateAverageLayer(bool);
00181     void activateZeroLineLayer(bool);
00182 
00183     /*---------------------------------------------------------------------*/
00187     inline void           setBgColor       (const QColor& c);
00188     inline const QColor&  bgColor          (void) const     ;
00189     inline void           setPeakColor     (const QColor& c);
00190     inline const QColor&  peakColor        (void) const     ;
00191     inline void           setAvgColor      (const QColor& c);
00192     inline const QColor&  avgColor         (void) const     ;
00193     
00196     /*---------------------------------------------------------------------*/
00200     inline void           setSamplesVisible(const long& newVal);
00201     inline void           setZoomFac       (double zoomFac)    ;
00202     inline void           setZoomYFac      (double zoomYFac)   ; 
00203     inline void           setFirstSample   (ulong sample)       ;
00204     inline void           setChannel       (uint channel=1)    ;
00205     inline uint           channel          (void) const        ;
00206     inline void           scrollBy(int);
00209 protected slots: // Protected slots
00210 
00211     void onZoomFacChanged(double);    
00212     void onZoomFacInWaveViewChanged(double);
00213     void onZoomFacEntered();
00214 
00215     void onPeakColor();
00216     void onBgColor();
00217     void onHScrollBarChanged(int);
00218     void onSelChanged(long);
00219     void onFirstSampleChanged(ulong);
00220     
00221 protected:
00222                         
00223 private:
00224     void initWidgets(QwavWaveDataInterface*);
00225 
00226 //     QwavWaveDataInterface* _waveData;
00227     QwavWaveView*          _waveLeft;           
00228     QwavWaveView*          _waveRight;          
00229     QVBoxLayout*   _vLayout;
00230     QHBoxLayout*   _hLayout;
00231     QLabel*        _lblSize;
00232     QLabel*        _lblSampleRate;
00233     QwtSlider*     _slZoomFac;          
00234     QwtSlider*     _slZoomLeftYFac;     
00235     QwtSlider*     _slZoomRightYFac;      
00236     QwtScale*      _scPowerScaleLeft;   
00237     QwtScale*      _scPowerScaleRight;  
00238     QLineEdit*     _leVisibleSamples;
00239     QLineEdit*     _leZoomFac;     
00240     QLineEdit*     _leScrollValue;
00241     QLabel*        _lblSelection;
00242     QLabel*        _lblCurrentSample;
00243     QLabel*        _lblVisibleSamples;
00244     QLabel*        _lblZoomFac;    
00245     QPushButton*   _btnPeakColor;
00246     QPushButton*   _btnBgColor;
00247     QPushButton*   _btnPeakLayer;
00248     QPushButton*   _btnAverageLayer;
00249     QPushButton*   _btnZeroLineLayer;
00250     QScrollBar*    _hScrollBar;
00251 
00252 protected: // Protected methods
00253 
00255     virtual void resizeEvent(QResizeEvent* e);
00256 };
00257 
00258 // inline QwavWaveDataInterface* QwavStereoWaveView::waveData() const
00259 // {
00260 //     return _waveLeft->waveData();
00261 // }
00262 
00263 int QwavStereoWaveView::addLayer(QwavViewLayer* layer)
00264 {
00265     return _waveLeft->addLayer(layer);
00266 }
00267 
00268 QwavViewLayer* QwavStereoWaveView::getLayer(const string& name)
00269 {
00270     return _waveLeft->getLayer(name);
00271 }
00272 
00273 QwavViewLayer* QwavStereoWaveView::getLayer(uint index)
00274 {
00275     return _waveLeft->getLayer(index);
00276 }
00277 
00278 uint QwavStereoWaveView::getNrOfLayers(void) const
00279 {
00280     return _waveLeft->getNrOfLayers();
00281 }
00282 
00283 QPixmap* QwavStereoWaveView::getBackbuf(void)
00284 {
00285     return _waveLeft->getBackbuf();
00286 }
00287 
00288 int  QwavStereoWaveView::sample2Pixel(long  sample) const
00289 {
00290     return _waveLeft->sample2Pixel(sample);
00291 }
00292 
00293 long QwavStereoWaveView::pixel2Sample(int   pixel) const
00294 {
00295     return _waveLeft->pixel2Sample(pixel);
00296 }
00297 
00298 bool QwavStereoWaveView::isSampleVisible(long sample) const
00299 {
00300     return _waveLeft->isSampleVisible(sample);
00301 }
00302 
00303 const int QwavStereoWaveView::nrOfPixels(void) const
00304 {
00305     return _waveLeft->nrOfPixels();
00306 }
00307 
00308 double  QwavStereoWaveView::zoomFac(void) const
00309 {
00310     return _waveLeft->zoomFac();
00311 }
00312 
00313 double  QwavStereoWaveView::zoomYFac(void) const
00314 {
00315     return _waveLeft->zoomYFac();
00316 }
00317 
00318 double  QwavStereoWaveView::maxZoomFac(void) const
00319 {
00320     return _waveLeft->maxZoomFac();
00321 }
00322 
00323 const ulong QwavStereoWaveView::firstSample(void) const
00324 {
00325     return _waveLeft->firstSample();
00326 }
00327 
00328 const long  QwavStereoWaveView::lastSample(void) const
00329 {
00330     return _waveLeft->lastSample();
00331 }
00332 
00333 const long QwavStereoWaveView::samplesVisible(void) const
00334 {
00335     return _waveLeft->samplesVisible();
00336 }
00337 
00338 void QwavStereoWaveView::setPeakInterpolator(QwavPeakInterpolator* s)
00339 {
00340     _waveLeft->setPeakInterpolator(s);
00341 }
00342 
00343 QwavPeakInterpolator* QwavStereoWaveView::peakInterpolator() const
00344 {
00345     return _waveLeft->peakInterpolator();
00346 }
00347     
00348 uint QwavStereoWaveView::addSelection(const QwavSelection& s)
00349 {
00350     return _waveLeft->addSelection(s);
00351 }
00352 
00353 uint QwavStereoWaveView::getNrOfSelections(void) const
00354 {
00355     return _waveLeft->getNrOfSelections();
00356 }
00357 
00358 const QwavSelection& QwavStereoWaveView::getSelection(uint index)const
00359 {
00360     return _waveLeft->getSelection(index);
00361 }
00362 
00363 QwavSelection& QwavStereoWaveView::getSelection(uint index)
00364 {
00365     return _waveLeft->getSelection(index);
00366 }
00367 
00368 int QwavStereoWaveView::isSelectionBegin(int pixel)
00369 {
00370     return _waveLeft->isSelectionBegin(pixel);
00371 }
00372 
00373 int QwavStereoWaveView::isSelectionEnd(int pixel)
00374 {
00375     return _waveLeft->isSelectionEnd(pixel);
00376 }
00377 
00378 int QwavStereoWaveView::activeSelection(void) const
00379 {
00380     return _waveLeft->activeSelection();
00381 }
00382 
00383 void QwavStereoWaveView::clearSelections(void)
00384 {
00385     _waveLeft->clearSelections();
00386 }
00387 
00388 const QwavWaveViewInterface::State& QwavStereoWaveView::state(void) const
00389 {
00390     return _waveLeft->state();
00391 }
00392 
00393 void QwavStereoWaveView::setBgColor(const QColor& c)
00394 {
00395     _waveLeft->setBgColor(c);
00396 }
00397 
00398 const QColor&  QwavStereoWaveView::bgColor(void) const
00399 {
00400     return _waveLeft->bgColor();
00401 }
00402 
00403 void QwavStereoWaveView::setPeakColor(const QColor& c)
00404 {
00405     _waveLeft->setPeakColor(c);
00406 }
00407 
00408 const QColor&  QwavStereoWaveView::peakColor(void) const
00409 {
00410     return _waveLeft->peakColor();
00411 }
00412 
00413 void QwavStereoWaveView::setAvgColor(const QColor& c)
00414 {
00415     _waveLeft->setAvgColor(c);
00416 }
00417 
00418 
00419 const QColor&  QwavStereoWaveView::avgColor(void) const
00420 {
00421     return _waveLeft->avgColor();
00422 }
00423 
00424 void QwavStereoWaveView::setSamplesVisible(const long& newVal)
00425 {
00426     _waveLeft->setSamplesVisible(newVal);
00427 }
00428 
00429 void QwavStereoWaveView::setZoomFac(double zoomFac)    
00430 {
00431     _waveLeft->setZoomFac(zoomFac);
00432 }
00433 
00434 void QwavStereoWaveView::setZoomYFac(double zoomYFac) 
00435 {
00436     _waveLeft->setZoomYFac(zoomYFac);
00437 }
00438 
00439 void QwavStereoWaveView::setFirstSample(ulong sample)       
00440 {
00441     _waveLeft->setFirstSample(sample);
00442 }
00443 
00444 void QwavStereoWaveView::setChannel(uint channel)    
00445 {
00446     _waveLeft->setChannel(channel);
00447 }
00448 
00449 uint QwavStereoWaveView::channel(void) const        
00450 {
00451     return _waveLeft->channel();
00452 }
00453 
00454 void QwavStereoWaveView::scrollBy(int pixels)
00455 {
00456     _waveLeft->scrollBy(pixels);
00457     _waveRight->scrollBy(pixels);    
00458 }
00459 
00460 void QwavStereoWaveView::setPosition(const ulong sample)
00461 {
00462     _waveLeft->setPosition(sample);
00463 }
00464 
00465 const ulong& QwavStereoWaveView::position() const
00466 {
00467     return _waveLeft->position();
00468 }
00469 
00470 
00471 Qwav_END_NAMESPACE
00472 
00473 #endif // Qwav_STEREOWAVEVIEW_H

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