summaryrefslogtreecommitdiffstats
path: root/tdescreensaver/kdesavers/blob.h
blob: e8b8f8391a3df08497a316400ddd457c9cb4d228 (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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
//-----------------------------------------------------------------------------
//
// kblob - Basic screen saver for KDE
//
// Copyright (c)  Tiaan Wessels, 1997
//

#ifndef __BLOB_H__
#define __BLOB_H__

#include <tqtimer.h>
#include <tqptrlist.h>

#include <kdialogbase.h>
#include <tdescreensaver.h>

#define RAMP		64
#define SPEED		10

enum blob_alg {
	ALG_LINEAR,
	ALG_HSINE,
	ALG_CIRB,
	ALG_POLARC,
	ALG_LAST,
	ALG_RANDOM = ALG_LAST };

class KBlobSaver : public KScreenSaver
{
    Q_OBJECT
  

public:
    KBlobSaver( WId id );
    virtual ~KBlobSaver();

    void setDimension(int d)
	{ dim = d; }
    void setShowlen(time_t s)
	{ showlen = s; }
    void setColorInc(int c)
	{ colorInc = c; }

public slots:
    void setAlgorithm(int);

public:
    typedef void (KBlobSaver::*AlgFunc)();
    struct KBSAlg
    {
	TQString Name;
	AlgFunc Init;
	AlgFunc NextFrame;
    };
private:

    TQTimer	timer;
    uint	colors[RAMP];
    uint	lookup[256];
    int		colorContext, colorInc;
    int		tx, ty;
    int		dim;
    int		xhalf, yhalf;
    int		alg, newalg, newalgp;
    time_t	showlen, start;
    KBSAlg	Algs[ALG_LAST];
    int		ln_xinc, ln_yinc;
    float	hs_radians, hs_rinc, hs_flip, hs_per;
    float	cb_radians, cb_rinc, cb_sradians, cb_radius, cb_devradinc;
    float	cb_deviate;
    float	pc_angle, pc_radius, pc_inc, pc_crot, pc_div;

    void lnSetup();
    void hsSetup();
    void cbSetup();
    void pcSetup();

    void lnNextFrame();
    void hsNextFrame();
    void cbNextFrame();
    void pcNextFrame();

    void blank();
    void box(int, int);
    void readSettings();

protected slots:
    void slotTimeout();
};

class TQListBox;
class KIntNumInput;

class KBlobSetup : public KDialogBase
{
    Q_OBJECT
  

    int showtime;
    int alg;
    TQListBox *algs;
    KIntNumInput *stime;

public:
    KBlobSetup( TQWidget *parent = NULL, const char *name = NULL );

protected:
    void readSettings();

private slots:
    void slotOk();
    void slotHelp();

private:
    KBlobSaver *saver;
};

#endif