From bc3202042e4b378c1e5719a80bd7ae0868aa9cbe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=BCnther?= Date: Mon, 7 Jan 2008 00:32:09 +0100 Subject: Show possible numbers as digits --- HISTORY | 1 + README | 4 ++++ menu.cpp | 32 +++++++++++++++++++++++++++----- menu.h | 3 ++- setup.cpp | 10 +++++++++- setup.h | 3 ++- 6 files changed, 45 insertions(+), 8 deletions(-) diff --git a/HISTORY b/HISTORY index 787c1d3..93347bf 100644 --- a/HISTORY +++ b/HISTORY @@ -31,3 +31,4 @@ ____-__-__: Version _._._ - Improved copyright and license information in the header of all source files. - Fixed (un)marking the cell on the bottom right. - Show possible numbers as pattern. +- Show possible numbers as digits (VDR >= 1.5.4). diff --git a/README b/README index a6f066a..0c6a1a6 100644 --- a/README +++ b/README @@ -79,6 +79,10 @@ Setup: cell the background of the corresponding grid section is colored. Default is yes. +- Show possible numbers as digits (VDR >= 1.5.4) + Show digits in all empty cells representing the possible + numbers (yes/no). + Default is yes. - Clear marks on reset Unmark all cells when the puzzle is reset (yes/no). Default is no. - Transparency (%) Set the transparency of the menu (0-100). diff --git a/menu.cpp b/menu.cpp index 848b40c..0904783 100644 --- a/menu.cpp +++ b/menu.cpp @@ -17,7 +17,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * $Id: menu.cpp 109 2008-01-06 19:43:20Z tom $ + * $Id: menu.cpp 110 2008-01-06 23:32:09Z tom $ */ #include "menu.h" @@ -69,11 +69,20 @@ Menu::Menu(const SetupData& setup, Puzzle& puzzle, Pos& curr) : info = NULL; infoText = NULL; new_puzzle_request = false; +#if VDRVERSNUM >= 10504 + mini_font = cFont::CreateFont(Setup.FontOsd, 3 * CELL_SIZE / RDIM / 4, + CELL_SIZE / RDIM); +#else + mini_font = NULL; +#endif } /** Destructor */ Menu::~Menu() { +#if VDRVERSNUM >= 10504 + delete mini_font; +#endif delete info; delete osd; } @@ -212,7 +221,7 @@ void Menu::paint() const cFont* font = cFont::GetFont(fontFix); osd->DrawText(x1, y1, txt, fg, bg, font, CELL_SIZE, CELL_SIZE, taCenter); } - else if (setup.show_possibles_pattern) + else if (setup.show_possibles_pattern || setup.show_possibles_digits) { for (unsigned int n = 1; n <= DIM; ++n) { @@ -222,9 +231,22 @@ void Menu::paint() int y3 = y1 + (((n - 1) / RDIM) * CELL_SIZE) / RDIM; int x4 = x1 + (((n - 1) % RDIM + 1) * CELL_SIZE) / RDIM - 1; int y4 = y1 + (((n - 1) / RDIM + 1) * CELL_SIZE) / RDIM - 1; - fg = TRANS(POSSIBLE_FG, trans); - bg = TRANS(POSSIBLE_BG(n), trans); - osd->DrawRectangle(x3, y3, x4, y4, bg); + + if (setup.show_possibles_pattern) + { + fg = TRANS(POSSIBLE_FG, trans); + bg = TRANS(POSSIBLE_BG(n), trans); + osd->DrawRectangle(x3, y3, x4, y4, bg); + } + +#if VDRVERSNUM >= 10504 + if (setup.show_possibles_digits) + { + char txt[2] = { '0' + n, 0 }; + osd->DrawText(x3, y3, txt, fg, bg, mini_font, + CELL_SIZE / RDIM, CELL_SIZE / RDIM, taCenter); + } +#endif } } } diff --git a/menu.h b/menu.h index e1d4a54..de51041 100644 --- a/menu.h +++ b/menu.h @@ -17,7 +17,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * $Id: menu.h 106 2007-12-03 23:28:24Z tom $ + * $Id: menu.h 110 2008-01-06 23:32:09Z tom $ */ #ifndef VDR_SUDOKU_MENU_H @@ -47,6 +47,7 @@ namespace SudokuPlugin Bitmap* info; const char* infoText; bool new_puzzle_request; + const cFont* mini_font; public: diff --git a/setup.cpp b/setup.cpp index 190404e..b461b6a 100644 --- a/setup.cpp +++ b/setup.cpp @@ -17,7 +17,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * $Id: setup.cpp 109 2008-01-06 19:43:20Z tom $ + * $Id: setup.cpp 110 2008-01-06 23:32:09Z tom $ */ #include "setup.h" @@ -40,6 +40,7 @@ SetupData::SetupData() mark_errors = 1; mark_ambiguous = 1; show_possibles_pattern = 1; + show_possibles_digits = 1; clear_marks = 0; transparency = 50; } @@ -61,6 +62,8 @@ bool SetupData::parse(const char* name, const char* value) mark_ambiguous = atoi(value); else if (!strcasecmp(name, "ShowPossiblesPattern")) show_possibles_pattern = atoi(value); + else if (!strcasecmp(name, "ShowPossiblesDigits")) + show_possibles_digits = atoi(value); else if (!strcasecmp(name, "ClearMarks")) clear_marks = atoi(value); else if (!strcasecmp(name, "Transparency")) @@ -84,6 +87,10 @@ SetupPage::SetupPage(SetupData& setup) : &data.mark_ambiguous)); Add(new cMenuEditBoolItem(tr("Show possible numbers as pattern"), &data.show_possibles_pattern)); +#if VDRVERSNUM >= 10504 + Add(new cMenuEditBoolItem(tr("Show possible numbers as digits"), + &data.show_possibles_digits)); +#endif Add(new cMenuEditBoolItem(tr("Clear marks on reset"), &data.clear_marks)); Add(new cMenuEditIntItem(tr("Transparency (%)"), &data.transparency, 0, 100)); } @@ -101,6 +108,7 @@ void SetupPage::Store() SetupStore("MarkErrors", setup.mark_errors); SetupStore("MarkAmbiguous", setup.mark_ambiguous); SetupStore("ShowPossiblesPattern", setup.show_possibles_pattern); + SetupStore("ShowPossiblesDigits", setup.show_possibles_digits); SetupStore("ClearMarks", setup.clear_marks); SetupStore("Transparency", setup.transparency); } diff --git a/setup.h b/setup.h index 3ad6d59..010283f 100644 --- a/setup.h +++ b/setup.h @@ -17,7 +17,7 @@ * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * - * $Id: setup.h 109 2008-01-06 19:43:20Z tom $ + * $Id: setup.h 110 2008-01-06 23:32:09Z tom $ */ #ifndef VDR_SUDOKU_SETUP_H @@ -41,6 +41,7 @@ namespace SudokuPlugin int mark_errors; int mark_ambiguous; int show_possibles_pattern; + int show_possibles_digits; int clear_marks; int transparency; -- cgit v1.2.3