1 #include <lib/gui/testpicture.h>
2 #include <lib/gui/eskin.h>
3 #include <lib/gui/elabel.h>
4 #include <lib/gdi/font.h>
5 #include <lib/gui/guiactions.h>
6 #include <lib/gui/numberactions.h>
8 void eTestPicture::hideDesc()
10 if (testmode
!= testFUBK
)
14 int eTestPicture::eventHandler(const eWidgetEvent
&event
)
18 case eWidgetEvent::evtAction
:
19 if (event
.action
== &i_cursorActions
->ok
)
21 else if (event
.action
== &i_cursorActions
->cancel
)
23 else if (event
.action
== &i_numberActions
->key0
)
25 else if (event
.action
== &i_numberActions
->key1
)
27 else if (event
.action
== &i_numberActions
->key2
)
29 else if (event
.action
== &i_numberActions
->key3
)
31 else if (event
.action
== &i_numberActions
->key4
)
33 else if (event
.action
== &i_numberActions
->key5
)
35 else if (event
.action
== &i_numberActions
->key6
)
37 else if (event
.action
== &i_numberActions
->key7
)
39 else if (event
.action
== &i_numberActions
->key8
)
41 else if (event
.action
== &i_numberActions
->key9
)
46 case eWidgetEvent::willShow
:
47 desctimer
.start(1000);
52 return eWidget::eventHandler(event
);
55 void eTestPicture::redrawWidget(gPainter
*target
, const eRect
&area
)
61 for (int i
=0; i
<8; ++i
)
65 target
->setForegroundColor(c
);
66 target
->fill(eRect(720/8*i
, 0, 720/8, 576));
72 for (int i
=0; i
<8; ++i
)
76 target
->setForegroundColor(c
);
77 target
->fill(eRect(720/8*i
, 0, 720/8, 576));
84 target
->setBackgroundColor(gray
+2);
88 target
->setForegroundColor(white
);
89 for (int x
=6; x
<720; x
+=44)
90 target
->fill(eRect(x
, 0, 3, 576));
91 for (int y
=34; y
<576; y
+=44)
92 target
->fill(eRect(0, y
, 720, 3));
94 for (int i
=0; i
<8; ++i
)
96 target
->setForegroundColor(basic
[i
]);
97 target
->fill(eRect(140+i
*55, 80, 55, 80));
98 target
->setForegroundColor(gray
+i
);
99 target
->fill(eRect(140+i
*55, 160, 55, 80));
104 for (int x
=0; x
<440; x
+=freq
)
107 target
->setForegroundColor(phase
? white
: black
);
108 target
->fill(eRect(140+x
, 320, freq
, 160));
114 for (int x
=0; x
<440; ++x
)
116 // freq = 0.5 .. 5Mhz -> 10 Pixel ~= 1Mhz
117 double inc
= (x
/440.0)*(x
/440.0) * 3.141 * 2 / 5.0 + 0.5;
119 int s
= int((sin(phase
) + 1) * 4);
124 target
->setForegroundColor(gray
+ s
);
125 target
->fill(eRect(140+x
, 320, 1, 160));
132 target
->setBackgroundColor(red
);
136 target
->setBackgroundColor(green
);
140 target
->setBackgroundColor(blue
);
144 target
->setBackgroundColor(white
);
148 target
->setBackgroundColor(black
);
154 eTestPicture::eTestPicture(int testmode
): eWidget(0, 1), testmode(testmode
), desctimer(eApp
)
156 red
= eSkin::getActive()->queryColor("std_red");
157 green
= eSkin::getActive()->queryColor("std_green");
158 blue
= eSkin::getActive()->queryColor("std_blue");
159 black
= eSkin::getActive()->queryColor("std_black");
160 white
= eSkin::getActive()->queryColor("std_white");
161 gray
= eSkin::getActive()->queryColor("std_gray");
162 setBackgroundColor(-1);
164 CONNECT(desctimer
.timeout
, eTestPicture::hideDesc
);
167 basic
[1] = eSkin::getActive()->queryColor("std_dyellow");
168 basic
[2] = eSkin::getActive()->queryColor("std_dcyan");
169 basic
[3] = eSkin::getActive()->queryColor("std_dgreen");
170 basic
[4] = eSkin::getActive()->queryColor("std_dmagenta");
171 basic
[5] = eSkin::getActive()->queryColor("std_dred");
172 basic
[6] = eSkin::getActive()->queryColor("std_dblue");
175 addActionMap(&i_numberActions
->map
);
176 addActionMap(&i_cursorActions
->map
);
178 description
= new eLabel(this, eLabel::flagVCenter
);
188 description
->move(ePoint(100, 100));
189 description
->resize(eSize(200, 30));
190 description
->setBackgroundColor(black
);
191 description
->setForegroundColor(white
);
194 description
->move(ePoint(140, 240));
195 description
->resize(eSize(440, 80));
196 description
->setBackgroundColor(black
);
197 description
->setForegroundColor(white
);
198 description
->setText("ENIGMA");
199 description
->setAlign(eTextPara::dirCenter
);
206 case testColorbar
: description
->setText("COLORBAR"); break;
207 case testRed
: description
->setText("RED"); break;
208 case testBlue
: description
->setText("BLUE"); break;
209 case testGreen
: description
->setText("GREEN"); break;
210 case testWhite
: description
->setText("WHITE (100%)"); break;
211 case testGray
: description
->setText("0% TO 100%"); break;
212 case testBlack
: description
->setText("BLACK (0%)"); break;
219 int eTestPicture::display(int mode
)
222 eTestPicture
test(mode
);
223 test
.move(ePoint(0, 0));
224 test
.resize(eSize(720, 576));