diff options
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | README | 26 | ||||
-rw-r--r-- | menu.cpp | 17 | ||||
-rw-r--r-- | setup.cpp | 62 | ||||
-rw-r--r-- | setup.h | 16 |
5 files changed, 111 insertions, 11 deletions
@@ -55,3 +55,4 @@ ____-__-__: Version 0.3.0 - Added history function. - Added setup options to configure red, green and yellow key. - Change default commands for red, green and yellow key: mark, undo and redo. +- Added setup options to configure fonts (VDR >= 1.5.4). @@ -47,14 +47,12 @@ givens are symmetrically ordered. But this can be disabled in the setup. To solve difficult Sudoku puzzles some hints can be used. Incorrect cells are red and cells with ambiguous numbers are magenta. These hints can be disabled in -the setup. With the green key a cell can be marked. A marked cell has green -background color. With the yellow key the cursor is moved to the next free cell -with minimal possible numbers. The red key set the next possible number for the -current cell. +the setup. For further hints see the commands menu, which is opened with the +blue key. Each time the plug-in is started from the main menu the same puzzle is shown. A new puzzle is only generated on VDR startup or if it has been requested by -selecting this command in the commands menu, which is opened with the blue key. +selecting this command in the commands menu. In the commands menu you can load and save puzzles from/to the sudoku-list file. This file is located at the plugins folder inside the configuration folder of @@ -107,6 +105,24 @@ Setup: Values: see commands menu. Default: Undo last action. - Key Yellow Choose command for the yellow key. Values: see commands menu. Default: Redo last action. +- Great font (VDR >= 1.5.4) + Choose font for the great digits. + Values: all installed fonts. Default: Sans Serif:Bold. +- Great font height (pixel) (VDR >= 1.5.4) + Font height for the great digits. + Values: 10-64. Default: 31. +- Great font width (pixel) (VDR >= 1.5.4) + Font width for the great digits. + Values: 10-64. Default: 42. +- Small font (VDR >= 1.5.4) + Choose font for the small digits. + Values: all installed fonts. Default: Sans Serif:Bold. +- Small font height (pixel) (VDR >= 1.5.4) + Font height for the small digits. + Values: 10-64. Default: 10. +- Small font width (pixel) (VDR >= 1.5.4) + Font width for the small digits. + Values: 10-64. Default: 14. - Transparency (%) Set the transparency of the menu. Values: 0-100. Default: 50. @@ -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 142 2008-07-06 15:50:02Z tom $ + * $Id: menu.cpp 143 2008-07-26 18:38:59Z tom $ */ #include "menu.h" @@ -77,9 +77,10 @@ Menu::Menu(cPlugin* plugin, const SetupData& setup, PuzzleGame*& puzzle) : infoText = NULL; new_puzzle_request = false; #if VDRVERSNUM >= 10504 - maxi_font = cFont::CreateFont(Setup.FontOsd, 3 * CELL_SIZE / 4, CELL_SIZE); - mini_font = cFont::CreateFont(Setup.FontOsd, 3 * CELL_SIZE / RDIM / 4, - CELL_SIZE / RDIM); + maxi_font = cFont::CreateFont(setup.maxi_font, setup.maxi_font_height, + setup.maxi_font_width); + mini_font = cFont::CreateFont(setup.mini_font, setup.mini_font_height, + setup.mini_font_width); #else maxi_font = cFont::GetFont(fontFix); mini_font = NULL; @@ -164,6 +165,14 @@ eOSState Menu::ProcessKey(eKeys key) if (key == kOk) Setup.Save(); DELETENULL(setup_menu); +#if VDRVERSNUM >= 10504 + DELETENULL(maxi_font); + DELETENULL(mini_font); + maxi_font = cFont::CreateFont(setup.maxi_font, setup.maxi_font_height, + setup.maxi_font_width); + mini_font = cFont::CreateFont(setup.mini_font, setup.mini_font_height, + setup.mini_font_width); +#endif Show(); } return state; @@ -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 142 2008-07-06 15:50:02Z tom $ + * $Id: setup.cpp 143 2008-07-26 18:38:59Z tom $ */ #include "setup.h" @@ -46,6 +46,14 @@ SetupData::SetupData() key_red = CommandList::key_red_default_index(); key_green = CommandList::key_green_default_index(); key_yellow = CommandList::key_yellow_default_index(); +#if VDRVERSNUM >= 10504 + strcpy(maxi_font, DefaultFontOsd); + maxi_font_height = 31; + maxi_font_width = 42; + strcpy(mini_font, DefaultFontOsd); + mini_font_height = 10; + mini_font_width = 14; +#endif transparency = 50; } @@ -77,6 +85,20 @@ bool SetupData::parse(const char* name, const char* value) key_green = cl.id_to_index(atoi(value), cl.key_green_default_index()); else if (!strcasecmp(name, "KeyYellow")) key_yellow = cl.id_to_index(atoi(value), cl.key_yellow_default_index()); +#if VDRVERSNUM >= 10504 + else if (!strcasecmp(name, "MaxiFont")) + Utf8Strn0Cpy(maxi_font, value, MAXFONTNAME); + else if (!strcasecmp(name, "MaxiFontHeight")) + maxi_font_height = atoi(value); + else if (!strcasecmp(name, "MaxiFontWidth")) + maxi_font_width = atoi(value); + else if (!strcasecmp(name, "MiniFont")) + Utf8Strn0Cpy(mini_font, value, MAXFONTNAME); + else if (!strcasecmp(name, "MiniFontHeight")) + mini_font_height = atoi(value); + else if (!strcasecmp(name, "MiniFontWidth")) + mini_font_width = atoi(value); +#endif else if (!strcasecmp(name, "Transparency")) transparency = atoi(value); else @@ -91,6 +113,15 @@ bool SetupData::parse(const char* name, const char* value) SetupPage::SetupPage(SetupData& setup) : setup(setup), data(setup) { +#if VDRVERSNUM >= 10504 + cFont::GetAvailableFontNames(&maxi_font_names); + cFont::GetAvailableFontNames(&mini_font_names); + maxi_font_names.Insert(strdup(DefaultFontOsd)); + mini_font_names.Insert(strdup(DefaultFontOsd)); + maxi_font_index = max(0, maxi_font_names.Find(data.maxi_font)); + mini_font_index = max(0, mini_font_names.Find(data.mini_font)); +#endif + Add(new cMenuEditIntItem(tr("Givens count"), &data.givens_count, 26, 81)); Add(new cMenuEditBoolItem(tr("Symmetric givens"), &data.symmetric)); Add(new cMenuEditBoolItem(tr("Mark errors"), &data.mark_errors)); @@ -109,6 +140,20 @@ SetupPage::SetupPage(SetupData& setup) : CommandList::count(), CommandList::texts())); Add(new cMenuEditStraItem(tr("Key Yellow"), &data.key_yellow, CommandList::count(), CommandList::texts())); +#if VDRVERSNUM >= 10504 + Add(new cMenuEditStraItem(tr("Great font"), &maxi_font_index, + maxi_font_names.Size(), &maxi_font_names[0])); + Add(new cMenuEditIntItem(tr("Great font height (pixel)"), + &data.maxi_font_height, 10, MAXFONTSIZE)); + Add(new cMenuEditIntItem(tr("Great font width (pixel)"), + &data.maxi_font_width, 10, MAXFONTSIZE)); + Add(new cMenuEditStraItem(tr("Small font"), &mini_font_index, + mini_font_names.Size(), &mini_font_names[0])); + Add(new cMenuEditIntItem(tr("Small font height (pixel)"), + &data.mini_font_height, 10, MAXFONTSIZE)); + Add(new cMenuEditIntItem(tr("Small font width (pixel)"), + &data.mini_font_width, 10, MAXFONTSIZE)); +#endif Add(new cMenuEditIntItem(tr("Transparency (%)"), &data.transparency, 0, 100)); } @@ -119,6 +164,13 @@ SetupPage::SetupPage(SetupData& setup) : */ void SetupPage::Store() { +#if VDRVERSNUM >= 10504 + Utf8Strn0Cpy(data.maxi_font, maxi_font_names[maxi_font_index], + sizeof(data.maxi_font)); + Utf8Strn0Cpy(data.mini_font, mini_font_names[mini_font_index], + sizeof(data.mini_font)); +#endif + setup = data; SetupStore("GivensCount", setup.givens_count); SetupStore("Symmetric", setup.symmetric); @@ -130,5 +182,13 @@ void SetupPage::Store() SetupStore("KeyRed", CommandList::id(setup.key_red)); SetupStore("KeyGreen", CommandList::id(setup.key_green)); SetupStore("KeyYellow", CommandList::id(setup.key_yellow)); +#if VDRVERSNUM >= 10504 + SetupStore("MaxiFont", setup.maxi_font); + SetupStore("MaxiFontHeight", setup.maxi_font_height); + SetupStore("MaxiFontWidth", setup.maxi_font_width); + SetupStore("MiniFont", setup.mini_font); + SetupStore("MiniFontHeight", setup.mini_font_height); + SetupStore("MiniFontWidth", setup.mini_font_width); +#endif SetupStore("Transparency", setup.transparency); } @@ -17,14 +17,16 @@ * 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 142 2008-07-06 15:50:02Z tom $ + * $Id: setup.h 143 2008-07-26 18:38:59Z tom $ */ #ifndef VDR_SUDOKU_SETUP_H #define VDR_SUDOKU_SETUP_H #include "sudoku.h" +#include <vdr/config.h> #include <vdr/menuitems.h> +#include <vdr/font.h> namespace SudokuPlugin @@ -46,6 +48,14 @@ namespace SudokuPlugin int key_red; int key_green; int key_yellow; +#if VDRVERSNUM >= 10504 + char maxi_font[MAXFONTNAME]; + int maxi_font_height; + int maxi_font_width; + char mini_font[MAXFONTNAME]; + int mini_font_height; + int mini_font_width; +#endif int transparency; /** Constructor */ @@ -63,6 +73,10 @@ namespace SudokuPlugin { SetupData& setup; SetupData data; +#if VDRVERSNUM >= 10504 + cStringList maxi_font_names, mini_font_names; + int maxi_font_index, mini_font_index; +#endif public: |