summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Günther <tom@toms-cafe.de>2006-04-25 02:08:15 +0200
committerThomas Günther <tom@toms-cafe.de>2006-04-25 02:08:15 +0200
commite9bf999004a4698c75d8aefa9033af87fc086e64 (patch)
tree005c5cbad72781412ab0d0ae8357e2800644af39
parent9502103873d09f6ba87eaf5e62ae13869d53f928 (diff)
downloadvdr-plugin-sudoku-e9bf999004a4698c75d8aefa9033af87fc086e64.tar.gz
vdr-plugin-sudoku-e9bf999004a4698c75d8aefa9033af87fc086e64.tar.bz2
Removed compatibility to VDR < 1.3.47
-rw-r--r--README6
-rw-r--r--bitmap.cpp94
-rw-r--r--bitmap.h12
-rw-r--r--menu.cpp25
-rw-r--r--menu.h11
5 files changed, 11 insertions, 137 deletions
diff --git a/README b/README
index 83baf69..6e91854 100644
--- a/README
+++ b/README
@@ -9,6 +9,12 @@ Latest version available at: http://toms-cafe.de/vdr/sudoku
See the file COPYING for license information.
+Requirements:
+-------------
+
+- VDR >= 1.3.47
+
+
Description:
------------
diff --git a/bitmap.cpp b/bitmap.cpp
index f41ca73..2021c2a 100644
--- a/bitmap.cpp
+++ b/bitmap.cpp
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: bitmap.cpp 11 2005-10-28 01:00:01Z tom $
+ * $Id: bitmap.cpp 27 2006-04-25 00:08:15Z tom $
*/
#include "bitmap.h"
@@ -12,12 +12,6 @@
#include <vdr/osd.h>
#include <ctype.h>
-// Compatibility to older vdr versions
-#if VDRVERSNUM < 10307
- #define tColor eDvbColor
- #define DrawRectangle Fill
-#endif
-
using namespace SudokuPlugin;
@@ -43,31 +37,6 @@ void Bitmap::text(const char* text, bool centered)
{
DrawRectangle(0, 0, Width() - 1, Height() - 1, clrWhite);
frame(0, 0, Width() - 1, Height() - 1, clrRed);
-
-#if VDRVERSNUM < 10307
- SetFont(fontOsd);
- int lineCount;
- char* wrapper = textWrapper(text, &lineCount);
- int y = max((Height() - lineCount * cOsd::LineHeight()) / 2, 0);
- char* line = wrapper;
- while (*line)
- {
- char* newline = strchr(line, '\n');
- if (newline)
- *newline = 0;
- int x = 0;
- if (centered)
- x = max((Width() - Width(line)) / 2, 0);
- Text(x, y, line, clrBlack, clrWhite);
- if (newline)
- *newline = '\n';
- if (!newline)
- break;
- line = newline + 1;
- y += cOsd::LineHeight();
- }
- free(wrapper);
-#else
const cFont* font = cFont::GetFont(fontOsd);
cTextWrapper wrapper(text, font, Width());
int y = max((Height() - wrapper.Lines() * font->Height()) / 2, 0);
@@ -78,7 +47,6 @@ void Bitmap::text(const char* text, bool centered)
x = max((Width() - font->Width(wrapper.GetLine(l))) / 2, 0);
DrawText(x, y, wrapper.GetLine(l), clrBlack, clrWhite, font);
}
-#endif
}
/** Draw a frame into the bitmap. */
@@ -89,63 +57,3 @@ void Bitmap::frame(int x1, int y1, int x2, int y2, tColor frameColor)
DrawRectangle(x1, y2 - 1, x2, y2, frameColor);
DrawRectangle(x2 - 1, y1, x2, y2, frameColor);
}
-
-#if VDRVERSNUM < 10307
-/** Wrap the text to fit into the bitmap (taken from font.c / VDR 1.3.7). */
-char *Bitmap::textWrapper(const char *Text, int *p_lines)
-{
- char *text = strdup(Text);
- int lines = 1;
-
- char *Blank = NULL;
- char *Delim = NULL;
- int w = 0;
-
- stripspace(text); // strips trailing newlines
-
- for (char *p = text; *p; ) {
- if (*p == '\n') {
- lines++;
- w = 0;
- Blank = Delim = NULL;
- p++;
- continue;
- }
- else if (isspace(*p))
- Blank = p;
- int cw = Width(*p);
- if (w + cw > Width()) {
- if (Blank) {
- *Blank = '\n';
- p = Blank;
- continue;
- }
- else {
- // Here's the ugly part, where we don't have any whitespace to
- // punch in a newline, so we need to make room for it:
- if (Delim)
- p = Delim + 1; // let's fall back to the most recent delimiter
- char *s = MALLOC(char, strlen(text) + 2); // The additional '\n' plus the terminating '\0'
- int l = p - text;
- strncpy(s, text, l);
- s[l] = '\n';
- strcpy(s + l + 1, p);
- free(text);
- text = s;
- p = text + l;
- continue;
- }
- }
- else
- w += cw;
- if (strchr("-.,:;!?_", *p)) {
- Delim = p;
- Blank = NULL;
- }
- p++;
- }
- if (p_lines != NULL)
- *p_lines = lines;
- return text;
-}
-#endif
diff --git a/bitmap.h b/bitmap.h
index c212570..b2a37b5 100644
--- a/bitmap.h
+++ b/bitmap.h
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: bitmap.h 11 2005-10-28 01:00:01Z tom $
+ * $Id: bitmap.h 27 2006-04-25 00:08:15Z tom $
*/
#ifndef VDR_SUDOKU_BITMAP_H
@@ -14,11 +14,6 @@
#include <vdr/osdbase.h>
#include <vdr/osd.h>
-// Compatibility to older vdr versions
-#if VDRVERSNUM < 10307
- #define tColor eDvbColor
-#endif
-
namespace SudokuPlugin
{
@@ -41,11 +36,6 @@ namespace SudokuPlugin
/** Draw a frame into the bitmap. */
void frame(int x1, int y1, int x2, int y2, tColor frameColor);
-
-#if VDRVERSNUM < 10307
- /** Wrap the text to fit into the bitmap (taken from font.c / VDR 1.3.7). */
- char *textWrapper(const char *Text, int *p_lines);
-#endif
};
} // namespace SudokuPlugin
diff --git a/menu.cpp b/menu.cpp
index 0276066..31d299c 100644
--- a/menu.cpp
+++ b/menu.cpp
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: menu.cpp 16 2005-10-31 21:12:41Z tom $
+ * $Id: menu.cpp 27 2006-04-25 00:08:15Z tom $
*/
#include "menu.h"
@@ -16,22 +16,6 @@
#include <vdr/osd.h>
#include <vdr/font.h>
-// Compatibility to older vdr versions
-#if VDRVERSNUM < 10307
- #define tColor eDvbColor
- #define DrawRectangle Fill
- #define DrawBitmap SetBitmap
- #define cOsdProvider cOsd
- #define NewOsd OpenRaw
- struct tArea { int x1, y1, x2, y2, bpp; };
- #define SetAreas(a,n) Create(a->x1, a->y1,\
- a->x2 - a->x1 + 1, a->y2 - a->y1 + 1,\
- a->bpp, true)
- #define Color GetColor
- #define savePalette(bitmap) savePalette(2)
- #define SetPalette(palette, area) Width('X')
-#endif
-
using namespace SudokuPlugin;
using namespace Sudoku;
@@ -209,15 +193,8 @@ void Menu::paint()
if (puzzle.get(p) != 0)
{
char txt[2] = { '0' + puzzle.get(p), 0 };
-#if VDRVERSNUM < 10307
- osd->SetFont(fontFix);
- osd->Text(x1 + max((CELL_SIZE - osd->Width(txt)) / 2, 0),
- y1 + max((CELL_SIZE - cOsd::LineHeight()) / 2, 0),
- txt, fg, bg);
-#else
const cFont* font = cFont::GetFont(fontFix);
osd->DrawText(x1, y1, txt, fg, bg, font, CELL_SIZE, CELL_SIZE, taCenter);
-#endif
}
}
diff --git a/menu.h b/menu.h
index 30d9819..2b59cc2 100644
--- a/menu.h
+++ b/menu.h
@@ -3,7 +3,7 @@
*
* See the README file for copyright information and how to reach the author.
*
- * $Id: menu.h 11 2005-10-28 01:00:01Z tom $
+ * $Id: menu.h 27 2006-04-25 00:08:15Z tom $
*/
#ifndef VDR_SUDOKU_MENU_H
@@ -16,13 +16,6 @@ namespace Sudoku { class Puzzle; class Pos; }
#include <vdr/osdbase.h>
#include <vdr/osd.h>
-// Compatibility to older vdr versions
-#if VDRVERSNUM < 10307
- #define cOsd_ cOsdBase
-#else
- #define cOsd_ cOsd
-#endif
-
namespace SudokuPlugin
{
@@ -36,7 +29,7 @@ namespace SudokuPlugin
Sudoku::Puzzle& puzzle;
Sudoku::Pos& curr;
int xPos, yPos;
- cOsd_* osd;
+ cOsd* osd;
Bitmap* info;
const char* infoText;
bool new_puzzle_request;