updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / vdr-weather / weather-0.2.1e-vdr-1.6.patch
blob9d6d9e7a4a58186b1f3102b9cbfe4e1cdfa5a2e5
1 diff -rauN weather-0.2.1e/display.c weather-0.2.1e-vdr-1.6-patch/display.c
2 --- weather-0.2.1e/display.c 2004-01-04 18:57:49.000000000 +0100
3 +++ weather-0.2.1e-vdr-1.6-patch/display.c 2009-10-23 21:38:58.000000000 +0200
4 @@ -16,130 +16,131 @@
8 -void cWeatherOsd::initBitmap(cBitmap &b, char*xpm[], eDvbColor col, bool setBg) {
9 +void cWeatherOsd::initBitmap(cBitmap &b, char*xpm[], tColor col, bool setBg) {
10 for (int y=0; y<100; y++) {
11 for (int x=0; x<100; x++) {
12 if (setBg) {
13 - b.SetPixel(x, y, (xpm[y][x] == YES) ? col : clrBackground);
14 + b.DrawPixel(x, y, (xpm[y][x] == YES) ? col : clrTransparent);
15 } else {
16 if (xpm[y][x] == YES) {
17 - b.SetPixel(x, y, col);
18 + b.DrawPixel(x, y, col);
25 -void cWeatherOsd::initEastBitmap(cBitmap &b, eDvbColor col) {
26 +void cWeatherOsd::initEastBitmap(cBitmap &b, tColor col) {
27 for (int y=0; y<100; y++) {
28 for (int x=0; x<100; x++) {
29 if (e_xpm[y][x] == YES) {
30 - b.SetPixel(x, y, col);
31 + b.DrawPixel(x, y, col);
37 -void cWeatherOsd::initNorthBitmap(cBitmap &b, eDvbColor col) {
38 +void cWeatherOsd::initNorthBitmap(cBitmap &b, tColor col) {
39 for (int y=0; y<100; y++) {
40 for (int x=0; x<100; x++) {
41 if (e_xpm[y][x] == YES) {
42 - b.SetPixel(y, 100 - x, col);
43 + b.DrawPixel(y, 100 - x, col);
49 -void cWeatherOsd::initWestBitmap(cBitmap &b, eDvbColor col) {
50 +void cWeatherOsd::initWestBitmap(cBitmap &b, tColor col) {
51 for (int y=0; y<100; y++) {
52 for (int x=99; x>=0; x--) {
53 if (e_xpm[y][x] == YES) {
54 - b.SetPixel(100 - x, y, col);
55 + b.DrawPixel(100 - x, y, col);
61 -void cWeatherOsd::initSouthBitmap(cBitmap &b, eDvbColor col) {
62 +void cWeatherOsd::initSouthBitmap(cBitmap &b, tColor col) {
63 for (int y=0; y<100; y++) {
64 for (int x=0; x<100; x++) {
65 if (e_xpm[y][x] == YES) {
66 - b.SetPixel(y, x, col);
67 + b.DrawPixel(y, x, col);
73 -void cWeatherOsd::initSouthEastBitmap(cBitmap &b, eDvbColor col) {
74 +void cWeatherOsd::initSouthEastBitmap(cBitmap &b, tColor col) {
75 for (int y=0; y<100; y++) {
76 for (int x=0; x<100; x++) {
77 if (se_xpm[y][x] == YES) {
78 - b.SetPixel(x, y, col);
79 + b.DrawPixel(x, y, col);
85 -void cWeatherOsd::initNorthEastBitmap(cBitmap &b, eDvbColor col) {
86 +void cWeatherOsd::initNorthEastBitmap(cBitmap &b, tColor col) {
87 for (int y=0; y<100; y++) {
88 for (int x=0; x<100; x++) {
89 if (se_xpm[y][x] == YES) {
90 - b.SetPixel(y, 100 - x, col);
91 + b.DrawPixel(y, 100 - x, col);
98 -void cWeatherOsd::initNorthWestBitmap(cBitmap &b, eDvbColor col) {
99 +void cWeatherOsd::initNorthWestBitmap(cBitmap &b, tColor col) {
100 for (int y=0; y<100; y++) {
101 for (int x=0; x<100; x++) {
102 if (se_xpm[y][x] == YES) {
103 - b.SetPixel(100-x, 100-y, col);
104 + b.DrawPixel(100-x, 100-y, col);
110 -void cWeatherOsd::initSouthWestBitmap(cBitmap &b, eDvbColor col) {
111 +void cWeatherOsd::initSouthWestBitmap(cBitmap &b, tColor col) {
112 for (int y=0; y<100; y++) {
113 for (int x=99; x>=0; x--) {
114 if (se_xpm[y][x] == YES) {
115 - b.SetPixel(100 - x, y, col);
116 + b.DrawPixel(100 - x, y, col);
122 -void cWeatherOsd::initBorderBitmap(cBitmap &b, eDvbColor col) {
123 +void cWeatherOsd::initBorderBitmap(cBitmap &b, tColor col) {
124 for (int y=0; y<100; y++) {
125 for (int x=99; x>=0; x--) {
126 if (border_xpm[x][y] == YES) {
127 - b.SetPixel(x, y, col);
128 + b.DrawPixel(x, y, col);
134 -void cWeatherOsd::printMetar (cOsdBase *osd, Decoded_METAR *Mptr, int x, int y) {
135 +void cWeatherOsd::printMetar (cOsd *osd, Decoded_METAR *Mptr, int x, int y) {
136 const cFont *font = cFont::GetFont((eDvbFont)0);
137 - osd->SetFont((eDvbFont)0);
138 //int cy = 0;
141 int lineY = y;
143 - osd->Text(x + 80 - font->Width(tr("Weather")) - gapX, y, tr("Weather"));
144 + osd->DrawText(x + 80 - font->Width(tr("Weather")) - gapX, y, tr("Weather"),
145 + clrWhite, clrTransparent, font);
146 lineY += font->Height(tr("Weather")) + gapY;
148 - osd->Fill(x, lineY, x+80, lineY+lineHeight, clrBlue);
149 - osd->Fill(x+80, lineY, x+80+lineHeight, lineY+20, clrBlue);
150 + osd->DrawRectangle(x, lineY, x+80, lineY+lineHeight, clrBlue);
151 + osd->DrawRectangle(x+80, lineY, x+80+lineHeight, lineY+20, clrBlue);
152 drawWeather(osd, Mptr, x, lineY+20);
153 x += 120;
155 - osd->Text(x + 80 - font->Width(tr("Wind")) - gapX, y, tr("Wind"));
156 - osd->Fill(x, lineY, x+80, lineY+lineHeight, clrBlue);
157 - osd->Fill(x+80, lineY, x+80+lineHeight, lineY+20, clrBlue);
158 + osd->DrawText(x + 80 - font->Width(tr("Wind")) - gapX, y, tr("Wind"),
159 + clrWhite, clrTransparent, font);
160 + osd->DrawRectangle(x, lineY, x+80, lineY+lineHeight, clrBlue);
161 + osd->DrawRectangle(x+80, lineY, x+80+lineHeight, lineY+20, clrBlue);
163 if (Mptr->winData.windDir != MAXINT) {
164 drawWindRose(osd, Mptr->winData.windDir, x, lineY+20);
165 @@ -150,17 +151,17 @@
166 drawData(osd, Mptr, 0, font, x, y);
169 -void cWeatherOsd::drawWeather(cOsdBase *osd, Decoded_METAR *mptr, int x, int y) {
170 +void cWeatherOsd::drawWeather(cOsd *osd, Decoded_METAR *mptr, int x, int y) {
171 //char* filename;
173 // sprintf("%s%s.xpm", coverage[mptr->], phenomen[]);
174 cBitmap weather(100, 100, 3, false);
175 initBitmap(weather, sun_xpm, clrYellow, true);
176 initBorderBitmap(weather, clrBlue);
177 - osd->SetBitmap(x, y, weather);
178 + osd->DrawBitmap(x, y, weather);
181 -void cWeatherOsd::drawWindRose(cOsdBase *osd, int degree, int x, int y) {
182 +void cWeatherOsd::drawWindRose(cOsd *osd, int degree, int x, int y) {
183 cBitmap windRose(100, 100, 3, false);
184 initBitmap(windRose, windrose_xpm, clrYellow, true);
186 @@ -185,5 +186,5 @@
189 initBorderBitmap(windRose, clrBlue);
190 - osd->SetBitmap(x, y, windRose);
191 + osd->DrawBitmap(x, y, windRose);
193 diff -rauN weather-0.2.1e/display.h weather-0.2.1e-vdr-1.6-patch/display.h
194 --- weather-0.2.1e/display.h 2003-08-12 21:55:40.000000000 +0200
195 +++ weather-0.2.1e-vdr-1.6-patch/display.h 2009-10-23 21:38:55.000000000 +0200
196 @@ -11,23 +11,23 @@
197 public:
198 cWeatherOsd(cUpdate *metarReader);
199 protected:
200 - virtual void printMetar (cOsdBase *osd, Decoded_METAR *Mptr, int x, int y);
201 - void initWeatherBitmap(cBitmap &b, Decoded_METAR *mptr, eDvbColor col, bool setBg);
202 - void initBitmap(cBitmap &b, char *xpm[], eDvbColor col, bool setBg);
203 - void initNorthBitmap(cBitmap &b, eDvbColor col);
204 - void initSouthBitmap(cBitmap &b, eDvbColor col);
205 - void initWestBitmap(cBitmap &b, eDvbColor col);
206 - void initEastBitmap(cBitmap &b, eDvbColor col);
207 - void initNorthWestBitmap(cBitmap &b, eDvbColor col);
208 - void initNorthEastBitmap(cBitmap &b, eDvbColor col);
209 - void initSouthWestBitmap(cBitmap &b, eDvbColor col);
210 - void initSouthEastBitmap(cBitmap &b, eDvbColor col);
211 - void initBorderBitmap(cBitmap &b, eDvbColor col);
212 - void drawWindRose(cOsdBase *osd, int degree, int x, int y);
213 - void drawWeather(cOsdBase *osd, Decoded_METAR *mptr, int x, int y);
214 - std::string cWeatherOsd::getIntensity(const std::string weather);
215 - std::string cWeatherOsd::getPrecipitation(const std::string weather);
216 - std::string cWeatherOsd::getCoverage(const std::string weather);
217 + virtual void printMetar (cOsd *osd, Decoded_METAR *Mptr, int x, int y);
218 + void initWeatherBitmap(cBitmap &b, Decoded_METAR *mptr, tColor col, bool setBg);
219 + void initBitmap(cBitmap &b, char *xpm[], tColor col, bool setBg);
220 + void initNorthBitmap(cBitmap &b, tColor col);
221 + void initSouthBitmap(cBitmap &b, tColor col);
222 + void initWestBitmap(cBitmap &b, tColor col);
223 + void initEastBitmap(cBitmap &b, tColor col);
224 + void initNorthWestBitmap(cBitmap &b, tColor col);
225 + void initNorthEastBitmap(cBitmap &b, tColor col);
226 + void initSouthWestBitmap(cBitmap &b, tColor col);
227 + void initSouthEastBitmap(cBitmap &b, tColor col);
228 + void initBorderBitmap(cBitmap &b, tColor col);
229 + void drawWindRose(cOsd *osd, int degree, int x, int y);
230 + void drawWeather(cOsd *osd, Decoded_METAR *mptr, int x, int y);
231 + std::string getIntensity(const std::string weather);
232 + std::string getPrecipitation(const std::string weather);
233 + std::string getCoverage(const std::string weather);
236 #endif //WEATHER_DISPLAY_H
237 diff -rauN weather-0.2.1e/simpleDisplay.c weather-0.2.1e-vdr-1.6-patch/simpleDisplay.c
238 --- weather-0.2.1e/simpleDisplay.c 2004-01-04 19:00:23.000000000 +0100
239 +++ weather-0.2.1e-vdr-1.6-patch/simpleDisplay.c 2009-10-23 21:45:27.000000000 +0200
240 @@ -18,21 +18,18 @@
243 void cSimpleWeatherOsd::Show(void) {
244 - osd = cOsd::OpenRaw(50, 50);
245 + osd = cOsdProvider::NewOsd(50, 50);
246 if (osd) {
247 - osd->Create(0, 240, 612, 250, 4);
248 - osd->AddColor(clrBackground);
249 - osd->AddColor(clrRed);
250 - osd->AddColor(clrGreen);
251 - osd->AddColor(clrYellow);
252 - osd->AddColor(clrBlue);
253 - osd->Clear();
254 + const cFont *font = cFont::GetFont((eDvbFont)0);
255 + tArea Area = {0, 240, 611, 489, 4};
256 + osd->SetAreas(&Area, 1);
257 + osd->DrawRectangle(0, 240, 611, 489, clrGray50);
259 if (metarReader->isDataAvailable()) {
260 Decoded_METAR *decodedMetar = metarReader->getDecodedMetar();
261 this->printMetar(osd, decodedMetar, 10, 250);
262 } else {
263 - osd->Text(10, 250, tr("No Data available"));
264 + osd->DrawText(10, 250, tr("No Data available"),clrWhite, clrTransparent, font);
266 osd->Flush();
268 @@ -54,10 +51,9 @@
269 return state;
272 -void cSimpleWeatherOsd::printMetar (cOsdBase *osd, Decoded_METAR *Mptr, int x, int y) {
273 +void cSimpleWeatherOsd::printMetar (cOsd *osd, Decoded_METAR *Mptr, int x, int y) {
275 const cFont *font = cFont::GetFont((eDvbFont)0);
276 - osd->SetFont((eDvbFont)0);
277 drawData(osd, Mptr, 0, font, x, y);
280 @@ -89,7 +85,7 @@
281 return maxSize;
284 -void cSimpleWeatherOsd::drawData(cOsdBase *osd, Decoded_METAR *Mptr, int cy, const cFont *font, int x, int y) {
285 +void cSimpleWeatherOsd::drawData(cOsd *osd, Decoded_METAR *Mptr, int cy, const cFont *font, int x, int y) {
286 measurement measurements[10];
288 for(int i=0; i<10; i++) {
289 @@ -174,18 +170,21 @@
292 int maxSize = x + calculateMaxDescriptionFontWidth(measurements, cy, font) + gapX;
293 - osd->Text(maxSize-font->Width(measurements[0].description)-gapX, y, measurements[0].description);
294 + osd->DrawText(maxSize-font->Width(measurements[0].description)-gapX, y,
295 + measurements[0].description, clrWhite, clrTransparent, font);
296 y += font->Height(measurements[0].description) + gapY;
297 int lineY = y;
298 - osd->Fill(x, y, maxSize+gapX, y+lineHeight, clrBlue);
299 + osd->DrawRectangle(x, y, maxSize+gapX, y+lineHeight, clrBlue);
300 y += lineHeight+gapY;
302 for (int i=1; i<=cy; i++) {
303 - osd->Text(maxSize-font->Width(measurements[i].description)-gapX, y, measurements[i].description);
304 - osd->Text(maxSize+lineHeight+gapX+gapX, y, measurements[i].value);
305 - osd->Fill(maxSize, y+(font->Height(measurements[0].description)/2), maxSize+gapX, y+(font->Height(measurements[0].description)/2)+lineHeight, clrBlue);
306 + osd->DrawText(maxSize-font->Width(measurements[i].description)-gapX, y,
307 + measurements[i].description, clrWhite, clrTransparent, font);
308 + osd->DrawText(maxSize+lineHeight+gapX+gapX, y, measurements[i].value,
309 + clrWhite, clrTransparent, font);
310 + osd->DrawRectangle(maxSize, y+(font->Height(measurements[0].description)/2), maxSize+gapX, y+(font->Height(measurements[0].description)/2)+lineHeight, clrBlue);
311 y += font->Height(measurements[0].description) + gapY;
314 - osd->Fill(maxSize+gapX, lineY, maxSize+gapX+lineHeight, y, clrBlue);
315 + osd->DrawRectangle(maxSize+gapX, lineY, maxSize+gapX+lineHeight, y, clrBlue);
317 diff -rauN weather-0.2.1e/simpleDisplay.h weather-0.2.1e-vdr-1.6-patch/simpleDisplay.h
318 --- weather-0.2.1e/simpleDisplay.h 2004-01-04 19:00:01.000000000 +0100
319 +++ weather-0.2.1e-vdr-1.6-patch/simpleDisplay.h 2009-10-23 21:45:24.000000000 +0200
320 @@ -17,11 +17,11 @@
321 virtual void Show(void);
322 virtual eOSState ProcessKey(eKeys Key);
323 protected:
324 - cOsdBase *osd;
325 - eDvbColor color;
326 + cOsd *osd;
327 + tColor color;
328 cUpdate *metarReader;
329 - virtual void printMetar (cOsdBase *osd, Decoded_METAR *Mptr, int x, int y);
330 - void drawData(cOsdBase *osd, Decoded_METAR *Mptr, int cy, const cFont *font, int x, int y);
331 + virtual void printMetar (cOsd *osd, Decoded_METAR *Mptr, int x, int y);
332 + void drawData(cOsd *osd, Decoded_METAR *Mptr, int cy, const cFont *font, int x, int y);
333 int calculateMaxDescriptionFontWidth(measurement measurements[], int size, const cFont *font);
334 int calculateMaxValueFontWidth(measurement measurements[], int size, const cFont *font);
335 int calculateMaxFontWidth(char strings[][500], int size, const cFont *font);