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
102
103
104
105
106
107
108
109
110
111
|
/***************************************************************************
copyright : (C) 2003 by Arnold Krille
email : [email protected]
***************************************************************************/
/***************************************************************************
* *
* 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; version 2 of the License. *
* *
***************************************************************************/
#ifndef KRECFILEWIDGETS_H
#define KRECFILEWIDGETS_H
#include <tqframe.h>
#include <tqvaluelist.h>
#include <tqpoint.h>
class KRecFile;
class KRecBuffer;
class TimeDisplay;
class TQBoxLayout;
class TQLabel;
class TQLineEdit;
class KRecFileWidget;
class KRecBufferWidget;
class KRecTimeBar;
class KRecTimeDisplay;
class TQRegion;
class TQPainter;
class TDEAction;
class TDEToggleAction;
class KRecFileWidget : public TQFrame {
TQ_OBJECT
public:
KRecFileWidget( KRecFile*, TQWidget*, const char* =0 );
~KRecFileWidget();
void setFile( KRecFile* );
void resizeEvent( TQResizeEvent* =0 );
void mouseReleaseEvent( TQMouseEvent* );
public slots:
void newBuffer( KRecBuffer* );
void deleteBuffer( KRecBuffer* );
private slots:
void popupMenu( KRecBufferWidget*, TQPoint );
private:
KRecFile *_file;
TQValueList<KRecBufferWidget*> bufferwidgets;
};
class Sample : public TQObject {
TQ_OBJECT
public:
Sample() : _values( 0 ), _min( 0 ), _max( 0 ) {}
void addValue( float n ) { _values += n; ++_count; addMin( n ); addMax( n ); }
void addMin( float n ) { if ( n < _min ) _min = n; }
void addMax( float n ) { if ( n > _max ) _max = n; }
float getValue() const { return _values / _count; }
float getMax() const { return ( _max>1 )?1:_max; }
float getMin() const { return ( _min<-1 )?-1:_min; }
int getCount() const { return _count; }
private:
float _values, _min, _max;
int _count;
};
class KRecBufferWidget : public TQFrame {
TQ_OBJECT
public:
KRecBufferWidget( KRecBuffer*, TQWidget*, const char* =0 );
~KRecBufferWidget();
const KRecBuffer* buffer() { return _buffer; }
void resizeEvent( TQResizeEvent* );
void drawFrame( TQPainter* );
void drawContents( TQPainter* );
void paintEvent( TQPaintEvent* );
void mousePressEvent( TQMouseEvent* );
void mouseDoubleClickEvent( TQMouseEvent* );
signals:
void popupMenu( KRecBufferWidget*, TQPoint );
private slots:
void initSamples();
void changeTitle();
void changeComment();
private:
void initLayout();
KRecBuffer *_buffer;
TQRegion *_main_region, *_title_region, *_fileend_region;
TQPoint _topleft, _bottomleft, _bottomright, _topright, _topmiddle, _bottommiddle;
int _title_height;
TQValueList <Sample*> samples1, samples2;
uint alreadyreadsize;
};
#endif
|