From 1f9b23ae73bfbb8207c21ddb0b6a8d85eef5f57f Mon Sep 17 00:00:00 2001 From: MikhailPodkur Date: Sun, 20 Dec 2015 23:23:01 +0700 Subject: [PATCH 1/2] Check box component with all functions added. Cyrillic font 8*12 added. 65k color (2 byte per point) schema added. Windows components font could be getted from current GUI by default --- ugui.c | 1158 ++++++++++++++++++++++++++++++++++++++++++++++--- ugui.h | 244 ++++++++++- ugui_config.h | 16 +- 3 files changed, 1355 insertions(+), 63 deletions(-) diff --git a/ugui.c b/ugui.c index 0a1549f..d5e8828 100644 --- a/ugui.c +++ b/ugui.c @@ -16,6 +16,10 @@ /* -------------------------------------------------------------------------------- */ /* -- REVISION HISTORY -- */ /* -------------------------------------------------------------------------------- */ +// Dec 20, 2015 V0.4 Check box component with all funtions added. +// Cyrillic font 8*12 added. +// 65k color schema added. +// Windows components font could be getted from current GUI by default // Mar 18, 2015 V0.3 Driver support added. // Window and object support added. // Touch support added. @@ -36,6 +40,7 @@ UG_RESULT _UG_WindowClear( UG_WINDOW* wnd ); void _UG_TextboxUpdate(UG_WINDOW* wnd, UG_OBJECT* obj); void _UG_ButtonUpdate(UG_WINDOW* wnd, UG_OBJECT* obj); + void _UG_CheckboxUpdate(UG_WINDOW* wnd, UG_OBJECT* obj); void _UG_ImageUpdate(UG_WINDOW* wnd, UG_OBJECT* obj); void _UG_PutChar( char chr, UG_S16 x, UG_S16 y, UG_COLOR fc, UG_COLOR bc, const UG_FONT* font); @@ -2130,6 +2135,268 @@ __UG_FONT_DATA unsigned char font_8x12[256][12]={ }; #endif + +#ifdef USE_FONT_8X12rus +__UG_FONT_DATA unsigned char font_8x12[256][12]={ +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x00 +{0x00, 0x7E, 0xC3, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0xC3, 0x7E, 0x00, 0x00}, // 0x01 +{0x00, 0x7E, 0xFF, 0xFF, 0xDB, 0xFF, 0xC3, 0xE7, 0xFF, 0x7E, 0x00, 0x00}, // 0x02 +{0x00, 0x00, 0x22, 0x77, 0x7F, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00, 0x00}, // 0x03 +{0x00, 0x08, 0x1C, 0x3E, 0x7F, 0x7F, 0x3E, 0x1C, 0x08, 0x00, 0x00, 0x00}, // 0x04 +{0x00, 0x18, 0x3C, 0x3C, 0xFF, 0xE7, 0xE7, 0x18, 0x18, 0x7E, 0x00, 0x00}, // 0x05 +{0x00, 0x18, 0x3C, 0x7E, 0xFF, 0xFF, 0x7E, 0x18, 0x18, 0x7E, 0x00, 0x00}, // 0x06 +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x07 +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x08 +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x09 +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x0A +{0x00, 0x7C, 0x70, 0x5C, 0x4E, 0x1F, 0x33, 0x33, 0x33, 0x1E, 0x00, 0x00}, // 0x0B +{0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00}, // 0x0C +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x0D +{0x00, 0xFE, 0xC6, 0xFE, 0xC6, 0xC6, 0xC6, 0xE6, 0xE7, 0x67, 0x03, 0x00}, // 0x0E +{0x00, 0x00, 0x18, 0xDB, 0x7E, 0xE7, 0xE7, 0x7E, 0xDB, 0x18, 0x00, 0x00}, // 0x0F +{0x00, 0x01, 0x03, 0x07, 0x1F, 0x7F, 0x1F, 0x07, 0x03, 0x01, 0x00, 0x00}, // 0x10 +{0x00, 0x40, 0x60, 0x70, 0x7C, 0x7F, 0x7C, 0x70, 0x60, 0x40, 0x00, 0x00}, // 0x11 +{0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, 0x00}, // 0x12 +{0x00, 0x66, 0x66, 0x66, 0x66, 0x66, 0x00, 0x00, 0x66, 0x66, 0x00, 0x00}, // 0x13 +{0x00, 0xFE, 0xDB, 0xDB, 0xDB, 0xDE, 0xD8, 0xD8, 0xD8, 0xD8, 0x00, 0x00}, // 0x14 +{0x00, 0x7E, 0xC6, 0x0C, 0x3C, 0x66, 0x66, 0x3C, 0x30, 0x63, 0x7E, 0x00}, // 0x15 +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x7F, 0x7F, 0x00, 0x00}, // 0x16 +{0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x7E, 0x00}, // 0x17 +{0x00, 0x18, 0x3C, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00}, // 0x18 +{0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x3C, 0x18, 0x00, 0x00}, // 0x19 +{0x00, 0x00, 0x00, 0x18, 0x30, 0x7F, 0x30, 0x18, 0x00, 0x00, 0x00, 0x00}, // 0x1A +{0x00, 0x00, 0x00, 0x0C, 0x06, 0x7F, 0x06, 0x0C, 0x00, 0x00, 0x00, 0x00}, // 0x1B +{0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, 0x7F, 0x00, 0x00, 0x00, 0x00}, // 0x1C +{0x00, 0x00, 0x00, 0x24, 0x66, 0xFF, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00}, // 0x1D +{0x00, 0x00, 0x08, 0x08, 0x1C, 0x1C, 0x3E, 0x3E, 0x7F, 0x7F, 0x00, 0x00}, // 0x1E +{0x00, 0x00, 0x7F, 0x7F, 0x3E, 0x3E, 0x1C, 0x1C, 0x08, 0x08, 0x00, 0x00}, // 0x1F +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x20 +{0x00, 0x0C, 0x1E, 0x1E, 0x1E, 0x0C, 0x0C, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // 0x21 +{0x00, 0x66, 0x66, 0x66, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x22 +{0x00, 0x36, 0x36, 0x7F, 0x36, 0x36, 0x36, 0x7F, 0x36, 0x36, 0x00, 0x00}, // 0x23 +{0x0C, 0x0C, 0x3E, 0x03, 0x03, 0x1E, 0x30, 0x30, 0x1F, 0x0C, 0x0C, 0x00}, // 0x24 +{0x00, 0x00, 0x00, 0x23, 0x33, 0x18, 0x0C, 0x06, 0x33, 0x31, 0x00, 0x00}, // 0x25 +{0x00, 0x0E, 0x1B, 0x1B, 0x0E, 0x5F, 0x7B, 0x33, 0x3B, 0x6E, 0x00, 0x00}, // 0x26 +{0x00, 0x0C, 0x0C, 0x0C, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x27 +{0x00, 0x30, 0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x30, 0x00, 0x00}, // 0x28 +{0x00, 0x06, 0x0C, 0x18, 0x30, 0x30, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00}, // 0x29 +{0x00, 0x00, 0x00, 0x66, 0x3C, 0xFF, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00}, // 0x2A +{0x00, 0x00, 0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00}, // 0x2B +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x06, 0x00}, // 0x2C +{0x00, 0x00, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x2D +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00}, // 0x2E +{0x00, 0x00, 0x40, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x01, 0x00, 0x00}, // 0x2F +{0x00, 0x3E, 0x63, 0x73, 0x7B, 0x6B, 0x6F, 0x67, 0x63, 0x3E, 0x00, 0x00}, // 0x30 +{0x00, 0x08, 0x0C, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3F, 0x00, 0x00}, // 0x31 +{0x00, 0x1E, 0x33, 0x33, 0x30, 0x18, 0x0C, 0x06, 0x33, 0x3F, 0x00, 0x00}, // 0x32 +{0x00, 0x1E, 0x33, 0x30, 0x30, 0x1C, 0x30, 0x30, 0x33, 0x1E, 0x00, 0x00}, // 0x33 +{0x00, 0x30, 0x38, 0x3C, 0x36, 0x33, 0x7F, 0x30, 0x30, 0x78, 0x00, 0x00}, // 0x34 +{0x00, 0x3F, 0x03, 0x03, 0x03, 0x1F, 0x30, 0x30, 0x33, 0x1E, 0x00, 0x00}, // 0x35 +{0x00, 0x1C, 0x06, 0x03, 0x03, 0x1F, 0x33, 0x33, 0x33, 0x1E, 0x00, 0x00}, // 0x36 +{0x00, 0x7F, 0x63, 0x63, 0x60, 0x30, 0x18, 0x0C, 0x0C, 0x0C, 0x00, 0x00}, // 0x37 +{0x00, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x33, 0x33, 0x33, 0x1E, 0x00, 0x00}, // 0x38 +{0x00, 0x1E, 0x33, 0x33, 0x33, 0x3E, 0x18, 0x18, 0x0C, 0x0E, 0x00, 0x00}, // 0x39 +{0x00, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x00}, // 0x3A +{0x00, 0x00, 0x00, 0x1C, 0x1C, 0x00, 0x00, 0x1C, 0x1C, 0x18, 0x0C, 0x00}, // 0x3B +{0x00, 0x30, 0x18, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x18, 0x30, 0x00, 0x00}, // 0x3C +{0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x3D +{0x00, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x00, 0x00}, // 0x3E +{0x00, 0x1E, 0x33, 0x30, 0x18, 0x0C, 0x0C, 0x00, 0x0C, 0x0C, 0x00, 0x00}, // 0x3F +{0x00, 0x3E, 0x63, 0x63, 0x7B, 0x4B, 0x7B, 0x03, 0x03, 0x3E, 0x00, 0x00}, // 0x40 +{0x00, 0x0C, 0x1E, 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00, 0x00}, // 0x41 +{0x00, 0x3F, 0x66, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x66, 0x3F, 0x00, 0x00}, // 0x42 +{0x00, 0x3C, 0x66, 0x63, 0x03, 0x03, 0x03, 0x63, 0x66, 0x3C, 0x00, 0x00}, // 0x43 +{0x00, 0x1F, 0x36, 0x66, 0x66, 0x66, 0x66, 0x66, 0x36, 0x1F, 0x00, 0x00}, // 0x44 +{0x00, 0x7F, 0x46, 0x06, 0x26, 0x3E, 0x26, 0x06, 0x46, 0x7F, 0x00, 0x00}, // 0x45 +{0x00, 0x7F, 0x66, 0x46, 0x26, 0x3E, 0x26, 0x06, 0x06, 0x0F, 0x00, 0x00}, // 0x46 +{0x00, 0x3C, 0x66, 0x63, 0x03, 0x03, 0x73, 0x63, 0x66, 0x7C, 0x00, 0x00}, // 0x47 +{0x00, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00}, // 0x48 +{0x00, 0x1E, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00, 0x00}, // 0x49 +{0x00, 0x78, 0x30, 0x30, 0x30, 0x30, 0x33, 0x33, 0x33, 0x1E, 0x00, 0x00}, // 0x4A +{0x00, 0x67, 0x66, 0x36, 0x36, 0x1E, 0x36, 0x36, 0x66, 0x67, 0x00, 0x00}, // 0x4B +{0x00, 0x0F, 0x06, 0x06, 0x06, 0x06, 0x46, 0x66, 0x66, 0x7F, 0x00, 0x00}, // 0x4C +{0x00, 0x63, 0x77, 0x7F, 0x7F, 0x6B, 0x63, 0x63, 0x63, 0x63, 0x00, 0x00}, // 0x4D +{0x00, 0x63, 0x63, 0x67, 0x6F, 0x7F, 0x7B, 0x73, 0x63, 0x63, 0x00, 0x00}, // 0x4E +{0x00, 0x1C, 0x36, 0x63, 0x63, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00, 0x00}, // 0x4F +{0x00, 0x3F, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x06, 0x0F, 0x00, 0x00}, // 0x50 +{0x00, 0x1C, 0x36, 0x63, 0x63, 0x63, 0x73, 0x7B, 0x3E, 0x30, 0x78, 0x00}, // 0x51 +{0x00, 0x3F, 0x66, 0x66, 0x66, 0x3E, 0x36, 0x66, 0x66, 0x67, 0x00, 0x00}, // 0x52 +{0x00, 0x1E, 0x33, 0x33, 0x03, 0x0E, 0x18, 0x33, 0x33, 0x1E, 0x00, 0x00}, // 0x53 +{0x00, 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x1E, 0x00, 0x00}, // 0x54 +{0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x00, 0x00}, // 0x55 +{0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00, 0x00}, // 0x56 +{0x00, 0x63, 0x63, 0x63, 0x63, 0x6B, 0x6B, 0x36, 0x36, 0x36, 0x00, 0x00}, // 0x57 +{0x00, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x1E, 0x33, 0x33, 0x33, 0x00, 0x00}, // 0x58 +{0x00, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x0C, 0x0C, 0x1E, 0x00, 0x00}, // 0x59 +{0x00, 0x7F, 0x73, 0x19, 0x18, 0x0C, 0x06, 0x46, 0x63, 0x7F, 0x00, 0x00}, // 0x5A +{0x00, 0x3C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x3C, 0x00, 0x00}, // 0x5B +{0x00, 0x00, 0x01, 0x03, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00, 0x00}, // 0x5C +{0x00, 0x3C, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3C, 0x00, 0x00}, // 0x5D +{0x08, 0x1C, 0x36, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x5E +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00}, // 0x5F +{0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x60 +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x33, 0x6E, 0x00, 0x00}, // 0x61 +{0x00, 0x07, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x66, 0x3B, 0x00, 0x00}, // 0x62 +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x03, 0x03, 0x33, 0x1E, 0x00, 0x00}, // 0x63 +{0x00, 0x38, 0x30, 0x30, 0x3E, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00, 0x00}, // 0x64 +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x33, 0x1E, 0x00, 0x00}, // 0x65 +{0x00, 0x1C, 0x36, 0x06, 0x06, 0x1F, 0x06, 0x06, 0x06, 0x0F, 0x00, 0x00}, // 0x66 +{0x00, 0x00, 0x00, 0x00, 0x6E, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x33, 0x1E}, // 0x67 +{0x00, 0x07, 0x06, 0x06, 0x36, 0x6E, 0x66, 0x66, 0x66, 0x67, 0x00, 0x00}, // 0x68 +{0x00, 0x18, 0x18, 0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00}, // 0x69 +{0x00, 0x30, 0x30, 0x00, 0x3C, 0x30, 0x30, 0x30, 0x30, 0x33, 0x33, 0x1E}, // 0x6A +{0x00, 0x07, 0x06, 0x06, 0x66, 0x36, 0x1E, 0x36, 0x66, 0x67, 0x00, 0x00}, // 0x6B +{0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00}, // 0x6C +{0x00, 0x00, 0x00, 0x00, 0x3F, 0x6B, 0x6B, 0x6B, 0x6B, 0x63, 0x00, 0x00}, // 0x6D +{0x00, 0x00, 0x00, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00}, // 0x6E +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x00, 0x00}, // 0x6F +{0x00, 0x00, 0x00, 0x00, 0x3B, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x06, 0x0F}, // 0x70 +{0x00, 0x00, 0x00, 0x00, 0x6E, 0x33, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x78}, // 0x71 +{0x00, 0x00, 0x00, 0x00, 0x37, 0x76, 0x6E, 0x06, 0x06, 0x0F, 0x00, 0x00}, // 0x72 +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x06, 0x18, 0x33, 0x1E, 0x00, 0x00}, // 0x73 +{0x00, 0x00, 0x04, 0x06, 0x3F, 0x06, 0x06, 0x06, 0x36, 0x1C, 0x00, 0x00}, // 0x74 +{0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00, 0x00}, // 0x75 +{0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x0C, 0x00, 0x00}, // 0x76 +{0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x6B, 0x6B, 0x36, 0x36, 0x00, 0x00}, // 0x77 +{0x00, 0x00, 0x00, 0x00, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00, 0x00}, // 0x78 +{0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x30, 0x18, 0x0F}, // 0x79 +{0x00, 0x00, 0x00, 0x00, 0x3F, 0x31, 0x18, 0x06, 0x23, 0x3F, 0x00, 0x00}, // 0x7A +{0x00, 0x38, 0x0C, 0x0C, 0x06, 0x03, 0x06, 0x0C, 0x0C, 0x38, 0x00, 0x00}, // 0x7B +{0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, // 0x7C +{0x00, 0x07, 0x0C, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x0C, 0x07, 0x00, 0x00}, // 0x7D +{0x00, 0xCE, 0x5B, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x7E +{0x00, 0x00, 0x00, 0x08, 0x1C, 0x36, 0x63, 0x63, 0x7F, 0x00, 0x00, 0x00}, // 0x7F +{0x00, 0x1F, 0x06, 0x06, 0x36, 0x7E, 0x6E, 0x66, 0x66, 0x36, 0x00, 0x00}, // 0x80 +{0x18, 0x00, 0x7F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}, // 0x81 +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1C, 0x1C, 0x06, 0x00}, // 0x82 +{0x00, 0x18, 0x0C, 0x00, 0x3F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}, // 0x83 +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x66, 0x33, 0x00}, // 0x84 +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2A, 0x2A, 0x00, 0x00}, // 0x85 +{0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x00, 0x00}, // 0x86 +{0x00, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // 0x87 +{0x00, 0x3C, 0x66, 0x06, 0x3F, 0x06, 0x3F, 0x06, 0x66, 0x3C, 0x00, 0x00}, // 0x88 +{0x00, 0x12, 0x15, 0x12, 0x08, 0x04, 0x02, 0x49, 0xB5, 0x49, 0x00, 0x00}, // 0x89 +{0x00, 0x1C, 0x14, 0x14, 0x14, 0x32, 0x52, 0x52, 0x52, 0x33, 0x00, 0x00}, // 0x8A +{0x00, 0x00, 0x00, 0x20, 0x30, 0x18, 0x0C, 0x18, 0x30, 0x20, 0x00, 0x00}, // 0x8B +{0x00, 0x1B, 0x1B, 0x1B, 0x1B, 0x3F, 0x5B, 0x5B, 0x5B, 0x3B, 0x00, 0x00}, // 0x8C +{0x08, 0x6B, 0x63, 0x33, 0x13, 0x1F, 0x33, 0x33, 0x63, 0x63, 0x00, 0x00}, // 0x8D +{0x00, 0x00, 0x1F, 0x04, 0x04, 0x1C, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00}, // 0x8E +{0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x0C, 0x0C}, // 0x8F +{0x02, 0x0F, 0x02, 0x02, 0x1A, 0x26, 0x22, 0x22, 0x22, 0x22, 0x10, 0x08}, // 0x90 +{0x00, 0x18, 0x0C, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x91 +{0x00, 0x18, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x92 +{0x00, 0x24, 0x12, 0x36, 0x36, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x93 +{0x00, 0x36, 0x36, 0x24, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x94 +{0x00, 0x00, 0x00, 0x00, 0x18, 0x3C, 0x3C, 0x18, 0x00, 0x00, 0x00, 0x00}, // 0x95 +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x96 +{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x97 +{0x00, 0x66, 0x66, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x30, 0x18, 0x0F}, // 0x98 +{0x00, 0x2F, 0x3A, 0x2A, 0x2A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x99 +{0x00, 0x1C, 0x14, 0x14, 0x12, 0x32, 0x52, 0x52, 0x52, 0x33, 0x00, 0x00}, // 0x9A +{0x00, 0x00, 0x00, 0x04, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x04, 0x00, 0x00}, // 0x9B +{0x00, 0x09, 0x09, 0x09, 0x09, 0x3F, 0x49, 0x49, 0x49, 0x39, 0x00, 0x00}, // 0x9C +{0x00, 0x18, 0x0C, 0x00, 0x33, 0x1B, 0x0F, 0x1B, 0x33, 0x33, 0x00, 0x00}, // 0x9D +{0x00, 0x02, 0x0F, 0x02, 0x02, 0x1A, 0x26, 0x22, 0x22, 0x22, 0x00, 0x00}, // 0x9E +{0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x0C, 0x0C}, // 0x9F +{0x30, 0x18, 0x0C, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x33, 0x6E, 0x00, 0x00}, // 0xA0 +{0x30, 0x18, 0x0C, 0x00, 0x1E, 0x18, 0x18, 0x18, 0x18, 0x7E, 0x00, 0x00}, // 0xA1 +{0x30, 0x18, 0x0C, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x00, 0x00}, // 0xA2 +{0x30, 0x18, 0x0C, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x6E, 0x00, 0x00}, // 0xA3 +{0x00, 0x6E, 0x3B, 0x00, 0x1F, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00}, // 0xA4 +{0x6E, 0x3B, 0x00, 0x63, 0x67, 0x6F, 0x7B, 0x73, 0x63, 0x63, 0x00, 0x00}, // 0xA5 +{0x00, 0x0C, 0x0C, 0x0C, 0x0C, 0x00, 0x0C, 0x0C, 0x0C, 0x0C, 0x00, 0x00}, // 0xA6 +{0x00, 0x1E, 0x33, 0x33, 0x1E, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0xA7 +{0x36, 0x00, 0x7F, 0x03, 0x03, 0x1F, 0x03, 0x03, 0x03, 0x7F, 0x00, 0x00}, // 0xA8 +{0x00, 0x1C, 0x22, 0x5D, 0x55, 0x5D, 0x4D, 0x55, 0x22, 0x1C, 0x00, 0x00}, // 0xA9 +{0x00, 0x00, 0x00, 0x00, 0x00, 0x3F, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00}, // 0xAA +{0x00, 0x00, 0x00, 0x00, 0xCC, 0x66, 0x33, 0x33, 0x66, 0xCC, 0x00, 0x00}, // 0xAB +{0x00, 0xC6, 0x67, 0x36, 0x1E, 0xEC, 0xF6, 0xDB, 0xCD, 0xFC, 0xC0, 0x00}, // 0xAC +{0x00, 0x0C, 0x0C, 0x00, 0x0C, 0x0C, 0x1E, 0x1E, 0x1E, 0x0C, 0x00, 0x00}, // 0xAD +{0x00, 0x00, 0x00, 0x00, 0xCC, 0x66, 0x33, 0x33, 0x66, 0xCC, 0x00, 0x00}, // 0xAE +{0x00, 0x00, 0x00, 0x00, 0x33, 0x66, 0xCC, 0xCC, 0x66, 0x33, 0x00, 0x00}, // 0xAF +{0x24, 0x49, 0x92, 0x24, 0x49, 0x92, 0x24, 0x49, 0x92, 0x24, 0x49, 0x92}, // 0xB0 +{0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55, 0xAA, 0x55}, // 0xB1 +{0xB6, 0xDB, 0x6D, 0xB6, 0xDB, 0x6D, 0xB6, 0xDB, 0x6D, 0xB6, 0xDB, 0x6D}, // 0xB2 +{0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, // 0xB3 +{0x18, 0x18, 0x18, 0x18, 0x18, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18}, // 0xB4 +{0x30, 0x18, 0x00, 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00, 0x00}, // 0xB5 +{0x1E, 0x33, 0x00, 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00, 0x00}, // 0xB6 +{0x06, 0x0C, 0x00, 0x0C, 0x1E, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x00, 0x00}, // 0xB7 +{0x00, 0x36, 0x36, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x33, 0x1E, 0x00, 0x00}, // 0xB8 +{0x66, 0x66, 0x66, 0x66, 0x67, 0x60, 0x60, 0x67, 0x66, 0x66, 0x66, 0x66}, // 0xB9 +{0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x66}, // 0xBA +{0x00, 0x00, 0x00, 0x00, 0x33, 0x66, 0xCC, 0xCC, 0x66, 0x33, 0x00, 0x00}, // 0xBB +{0x66, 0x66, 0x66, 0x66, 0x67, 0x60, 0x60, 0x7F, 0x00, 0x00, 0x00, 0x00}, // 0xBC +{0x00, 0x0C, 0x0C, 0x1E, 0x33, 0x03, 0x03, 0x33, 0x1E, 0x0C, 0x0C, 0x00}, // 0xBD +{0x33, 0x33, 0x33, 0x33, 0x1E, 0x3F, 0x0C, 0x3F, 0x0C, 0x0C, 0x00, 0x00}, // 0xBE +{0x00, 0x00, 0x36, 0x36, 0x00, 0x1F, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00}, // 0xBF +{0x00, 0x08, 0x1C, 0x36, 0x63, 0x63, 0x7F, 0x63, 0x63, 0x63, 0x00, 0x00}, // 0xC0 +{0x00, 0x7F, 0x43, 0x03, 0x03, 0x3F, 0x63, 0x63, 0x63, 0x3F, 0x00, 0x00}, // 0xC1 +{0x00, 0x1F, 0x33, 0x33, 0x33, 0x1F, 0x63, 0x63, 0x63, 0x3F, 0x00, 0x00}, // 0xC2 +{0x00, 0x7F, 0x46, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x0F, 0x00, 0x00}, // 0xC3 +{0x00, 0x3C, 0x3C, 0x34, 0x36, 0x36, 0x36, 0x36, 0x7F, 0x63, 0x41, 0x00}, // 0xC4 +{0x00, 0x7F, 0x06, 0x06, 0x06, 0x3E, 0x06, 0x06, 0x06, 0x7F, 0x00, 0x00}, // 0xC5 +{0x00, 0x6B, 0x6B, 0x2A, 0x1C, 0x1C, 0x2A, 0x6B, 0x6B, 0x6B, 0x00, 0x00}, // 0xC6 +{0x00, 0x1E, 0x31, 0x30, 0x1C, 0x30, 0x30, 0x31, 0x3F, 0x1E, 0x00, 0x00}, // 0xC7 +{0x00, 0x63, 0x73, 0x73, 0x6B, 0x6B, 0x67, 0x67, 0x63, 0x63, 0x00, 0x00}, // 0xC8 +{0x14, 0x08, 0x63, 0x73, 0x73, 0x6B, 0x6B, 0x67, 0x67, 0x63, 0x00, 0x00}, // 0xC9 +{0x00, 0x67, 0x66, 0x36, 0x1E, 0x36, 0x36, 0x66, 0x66, 0x67, 0x00, 0x00}, // 0xCA +{0x00, 0x78, 0x78, 0x6C, 0x6C, 0x6C, 0x6C, 0x66, 0x66, 0x67, 0x00, 0x00}, // 0xCB +{0x00, 0x63, 0x63, 0x77, 0x77, 0x6B, 0x6B, 0x63, 0x63, 0x63, 0x00, 0x00}, // 0xCC +{0x00, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00}, // 0xCD +{0x00, 0x1C, 0x36, 0x63, 0x63, 0x63, 0x63, 0x63, 0x36, 0x1C, 0x00, 0x00}, // 0xCE +{0x00, 0x3F, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00}, // 0xCF +{0x00, 0x3F, 0x63, 0x63, 0x63, 0x3F, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}, // 0xD0 +{0x00, 0x1C, 0x36, 0x63, 0x03, 0x03, 0x03, 0x63, 0x36, 0x1C, 0x00, 0x00}, // 0xD1 +{0x00, 0x3F, 0x2D, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x00, 0x00}, // 0xD2 +{0x00, 0x33, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x30, 0x33, 0x1E, 0x00, 0x00}, // 0xD3 +{0x00, 0x3E, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x3E, 0x08, 0x08, 0x00, 0x00}, // 0xD4 +{0x00, 0x33, 0x33, 0x1E, 0x0C, 0x1E, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00}, // 0xD5 +{0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x33, 0x7E, 0x60, 0x00}, // 0xD6 +{0x00, 0x33, 0x33, 0x33, 0x33, 0x3F, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00}, // 0xD7 +{0x00, 0x63, 0x63, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x7F, 0x00, 0x00}, // 0xD8 +{0x00, 0x63, 0x63, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0x6B, 0xFF, 0xC0, 0x00}, // 0xD9 +{0x00, 0x07, 0x06, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x3E, 0x00, 0x00}, // 0xDA +{0x00, 0x63, 0x63, 0x63, 0x63, 0x6F, 0x73, 0x73, 0x73, 0x6F, 0x00, 0x00}, // 0xDB +{0x00, 0x03, 0x03, 0x03, 0x03, 0x1F, 0x33, 0x33, 0x33, 0x1F, 0x00, 0x00}, // 0xDC +{0x00, 0x1E, 0x33, 0x20, 0x60, 0x7C, 0x60, 0x20, 0x33, 0x1E, 0x00, 0x00}, // 0xDD +{0x00, 0x73, 0xDB, 0xDB, 0xDB, 0xDF, 0xDB, 0xDB, 0xDB, 0x73, 0x00, 0x00}, // 0xDE +{0x00, 0x7E, 0x63, 0x63, 0x63, 0x7E, 0x78, 0x6C, 0x66, 0x63, 0x00, 0x00}, // 0xDF +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x30, 0x3E, 0x33, 0x33, 0x6E, 0x00, 0x00}, // 0xE0 +{0x00, 0x00, 0x20, 0x3E, 0x03, 0x03, 0x1F, 0x33, 0x33, 0x1E, 0x00, 0x00}, // 0xE1 +{0x00, 0x00, 0x00, 0x00, 0x0F, 0x13, 0x0F, 0x33, 0x33, 0x1F, 0x00, 0x00}, // 0xE2 +{0x00, 0x00, 0x00, 0x00, 0x3F, 0x03, 0x03, 0x03, 0x03, 0x03, 0x00, 0x00}, // 0xE3 +{0x00, 0x00, 0x00, 0x00, 0x1C, 0x36, 0x36, 0x36, 0x36, 0x7F, 0x63, 0x00}, // 0xE4 +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x3F, 0x03, 0x33, 0x1E, 0x00, 0x00}, // 0xE5 +{0x00, 0x00, 0x00, 0x00, 0x6B, 0x2A, 0x1C, 0x2A, 0x2A, 0x6B, 0x00, 0x00}, // 0xE6 +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x18, 0x30, 0x33, 0x1E, 0x00, 0x00}, // 0xE7 +{0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x73, 0x7B, 0x6F, 0x66, 0x00, 0x00}, // 0xE8 +{0x00, 0x14, 0x08, 0x00, 0x63, 0x63, 0x73, 0x7B, 0x6F, 0x66, 0x00, 0x00}, // 0xE9 +{0x00, 0x00, 0x00, 0x00, 0x33, 0x1B, 0x0F, 0x1B, 0x33, 0x33, 0x00, 0x00}, // 0xEA +{0x00, 0x00, 0x00, 0x00, 0x38, 0x3C, 0x36, 0x36, 0x33, 0x33, 0x00, 0x00}, // 0xEB +{0x00, 0x00, 0x00, 0x00, 0x63, 0x77, 0x7F, 0x6B, 0x63, 0x63, 0x00, 0x00}, // 0xEC +{0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x3F, 0x33, 0x33, 0x33, 0x00, 0x00}, // 0xED +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x33, 0x33, 0x33, 0x1E, 0x00, 0x00}, // 0xEE +{0x00, 0x00, 0x00, 0x00, 0x3F, 0x33, 0x33, 0x33, 0x33, 0x33, 0x00, 0x00}, // 0xEF +{0x00, 0x00, 0x00, 0x00, 0x1F, 0x33, 0x33, 0x1F, 0x03, 0x03, 0x00, 0x00}, // 0xF0 +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x03, 0x03, 0x33, 0x1E, 0x00, 0x00}, // 0xF1 +{0x00, 0x00, 0x00, 0x00, 0x3F, 0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x00, 0x00}, // 0xF2 +{0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x3E, 0x30, 0x1E, 0x00, 0x00}, // 0xF3 +{0x00, 0x00, 0x00, 0x00, 0x3E, 0x6B, 0x6B, 0x6B, 0x3E, 0x08, 0x00, 0x00}, // 0xF4 +{0x00, 0x00, 0x00, 0x00, 0x63, 0x36, 0x1C, 0x1C, 0x36, 0x63, 0x00, 0x00}, // 0xF5 +{0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x33, 0x33, 0x7E, 0x60, 0x00}, // 0xF6 +{0x00, 0x00, 0x00, 0x00, 0x33, 0x33, 0x33, 0x3F, 0x30, 0x30, 0x00, 0x00}, // 0xF7 +{0x00, 0x00, 0x00, 0x00, 0x63, 0x6B, 0x6B, 0x6B, 0x6B, 0x7F, 0x00, 0x00}, // 0xF8 +{0x00, 0x00, 0x00, 0x00, 0x63, 0x6B, 0x6B, 0x6B, 0x6B, 0x7F, 0x60, 0x00}, // 0xF9 +{0x00, 0x00, 0x00, 0x00, 0x07, 0x06, 0x3E, 0x66, 0x66, 0x3E, 0x00, 0x00}, // 0xFA +{0x00, 0x00, 0x00, 0x00, 0x63, 0x63, 0x6F, 0x7B, 0x7B, 0x6F, 0x00, 0x00}, // 0xFB +{0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x1F, 0x33, 0x33, 0x1F, 0x00, 0x00}, // 0xFC +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x33, 0x38, 0x30, 0x33, 0x1E, 0x00, 0x00}, // 0xFD +{0x00, 0x00, 0x00, 0x73, 0xDB, 0xDB, 0xDF, 0xDB, 0xDB, 0x73, 0x00, 0x00}, // 0xFE +{0x00, 0x00, 0x00, 0x00, 0x1E, 0x1B, 0x1B, 0x1E, 0x1C, 0x1B, 0x00, 0x00} // 0xFF +}; +#endif + #ifdef USE_FONT_8X14 __UG_FONT_DATA unsigned char font_8x14[256][14]={ {0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, // 0x00 @@ -4242,6 +4509,9 @@ __UG_FONT_DATA unsigned char font_32x53[256][212]={ #ifdef USE_FONT_8X12 const UG_FONT FONT_8X12 = {(unsigned char*)font_8x12,FONT_TYPE_1BPP,8,12,0,255,NULL}; #endif +#ifdef USE_FONT_8X12rus + const UG_FONT FONT_8X12 = {(unsigned char*)font_8x12,FONT_TYPE_1BPP,8,12,0,255,NULL}; +#endif #ifdef USE_FONT_8X14 const UG_FONT FONT_8X14 = {(unsigned char*)font_8x14,FONT_TYPE_1BPP,8,14,0,255,NULL}; #endif @@ -4290,7 +4560,12 @@ UG_S16 UG_Init( UG_GUI* g, void (*p)(UG_S16,UG_S16,UG_COLOR), UG_S16 x, UG_S16 y g->font.start_char = 0; g->font.end_char = 0; g->font.widths = NULL; + #ifdef USE_COLOR_16MLN g->desktop_color = 0x5E8BEf; + #endif + #ifdef USE_COLOR_65K + g->desktop_color = 0x5C5D; + #endif g->fore_color = C_WHITE; g->back_color = C_BLACK; g->next_window = NULL; @@ -4595,20 +4870,10 @@ void UG_DrawArc( UG_S16 x0, UG_S16 y0, UG_S16 r, UG_U8 s, UG_COLOR c ) void UG_DrawLine( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c ) { - UG_S16 n, dx, dy, sgndx, sgndy, dxabs, dyabs, x, y, drawx, drawy; - - if ( x2 < x1 ) - { - n = x2; - x2 = x1; - x1 = n; - } - if ( y2 < y1 ) - { - n = y2; - y2 = y1; - y1 = n; - } + UG_S16 dx, dy, i1, i2, i, kx, ky; + UG_S16 d; + UG_S16 x, y; + UG_S16 flag; /* Is hardware acceleration available? */ if ( gui->driver[DRIVER_DRAW_LINE].state & DRIVER_ENABLED ) @@ -4616,47 +4881,72 @@ void UG_DrawLine( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c ) if( ((UG_RESULT(*)(UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c))gui->driver[DRIVER_DRAW_LINE].driver)(x1,y1,x2,y2,c) == UG_RESULT_OK ) return; } - dx = x2 - x1; - dy = y2 - y1; - dxabs = (dx>0)?dx:-dx; - dyabs = (dy>0)?dy:-dy; - sgndx = (dx>0)?1:-1; - sgndy = (dy>0)?1:-1; - x = dyabs >> 1; - y = dxabs >> 1; - drawx = x1; - drawy = y1; - gui->pset(drawx, drawy,c); + dy = y2 - y1; + dx = x2 - x1; + if (dx==0 && dy==0) + { + gui->pset(x1,y1, c); + return; + } + + kx = 1; + ky = 1; + + if (dx < 0) + { + dx = -dx; + kx = -1; + } + else + if (dx==0) + kx = 0; + + if (dy < 0) + { + dy = -dy; + ky = -1; + } + + if(dxpset(x,y, c); + + if (flag) + x += kx; + else + y += ky; + + if (d < 0) + d += i1; + else + { + d += i2; + if (flag) + y += ky; + else + x += kx; + } + } + gui->pset(x,y, c); - if( dxabs >= dyabs ) - { - for( n=0; n= dxabs ) - { - y -= dxabs; - drawy += sgndy; - } - drawx += sgndx; - gui->pset(drawx, drawy,c); - } - } - else - { - for( n=0; n= dyabs ) - { - x -= dyabs; - drawx += sgndx; - } - drawy += sgndy; - gui->pset(drawx, drawy,c); - } - } + } void UG_PutString( UG_S16 x, UG_S16 y, char* str ) @@ -4782,6 +5072,7 @@ void UG_FontSetVSpace( UG_U16 s ) ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +#ifdef USE_COLOR_16MLN const UG_COLOR pal_window[] = { /* Frame 0 */ @@ -4838,6 +5129,140 @@ const UG_COLOR pal_button_released[] = 0xA0A0A0, 0xA0A0A0, }; + +const UG_COLOR pal_checkbox_pressed[] = +{ + /* Frame 0 */ + 0x646464, + 0x646464, + 0x646464, + 0x646464, + /* Frame 1 */ + 0xA0A0A0, + 0xA0A0A0, + 0xA0A0A0, + 0xA0A0A0, + /* Frame 2 */ + 0xF0F0F0, + 0xF0F0F0, + 0xF0F0F0, + 0xF0F0F0, +}; + +const UG_COLOR pal_checkbox_released[] = +{ + /* Frame 0 */ + 0x646464, + 0x646464, + 0x646464, + 0x646464, + /* Frame 1 */ + 0xFFFFFF, + 0xFFFFFF, + 0x696969, + 0x696969, + /* Frame 2 */ + 0xE3E3E3, + 0xE3E3E3, + 0xA0A0A0, + 0xA0A0A0, +}; +#endif + +#ifdef USE_COLOR_65K +const UG_COLOR pal_window[] = +{ + 0x632C, + 0x632C, + 0x632C, + 0x632C, + + 0xFFFF, + 0xFFFF, + 0x6B4D, + 0x6B4D, + + 0xE71C, + 0xE71C, + 0x9D13, + 0x9D13, +}; + +const UG_COLOR pal_button_pressed[] = +{ + 0x632C, + 0x632C, + 0x632C, + 0x632C, + + 0x9D13, + 0x9D13, + 0x9D13, + 0x9D13, + + 0xEF7D, + 0xEF7D, + 0xEF7D, + 0xEF7D, +}; + +const UG_COLOR pal_button_released[] = +{ + 0x632C, + 0x632C, + 0x632C, + 0x632C, + + 0xFFFF, + 0xFFFF, + 0x6B4D, + 0x6B4D, + + 0xE71C, + 0xE71C, + 0x9D13, + 0x9D13, +}; + +const UG_COLOR pal_checkbox_pressed[] = +{ + 0x632C, + 0x632C, + 0x632C, + 0x632C, + + 0x9D13, + 0x9D13, + 0x9D13, + 0x9D13, + + 0xEF7D, + 0xEF7D, + 0xEF7D, + 0xEF7D, +}; + +const UG_COLOR pal_checkbox_released[] = +{ + 0x632C, + 0x632C, + 0x632C, + 0x632C, + + 0xFFFF, + 0xFFFF, + 0x6B4D, + 0x6B4D, + + 0xE71C, + 0xE71C, + 0x9D13, + 0x9D13, +}; +#endif + + + /* -------------------------------------------------------------------------------- */ /* -- INTERNAL FUNCTIONS -- */ /* -------------------------------------------------------------------------------- */ @@ -4986,9 +5411,9 @@ void _UG_PutText(UG_TEXT* txt) UG_S16 char_height=txt->font->char_height; UG_S16 char_h_space=txt->h_space; UG_S16 char_v_space=txt->v_space; - UG_U16 i,j,k,xo,yo,cw,bn; - UG_U8 b,bt; - UG_U32 index; +// UG_U16 i,j,k,xo,yo,cw,bn; +// UG_U8 b,bt; +// UG_U32 index; char chr; char* str = txt->str; @@ -5384,7 +5809,12 @@ void UG_Update( void ) void UG_WaitForUpdate( void ) { gui->state |= UG_SATUS_WAIT_FOR_UPDATE; + #ifdef USE_MULTITASKING while ( (volatile UG_U8)gui->state & UG_SATUS_WAIT_FOR_UPDATE ){}; + #endif + #ifndef USE_MULTITASKING + while ( (UG_U8)gui->state & UG_SATUS_WAIT_FOR_UPDATE ){}; + #endif } void UG_DrawBMP( UG_S16 xp, UG_S16 yp, UG_BMP* bmp ) @@ -5457,8 +5887,14 @@ UG_RESULT UG_WindowCreate( UG_WINDOW* wnd, UG_OBJECT* objlst, UG_U8 objcnt, void wnd->objcnt = objcnt; wnd->objlst = objlst; wnd->state = WND_STATE_VALID; + #ifdef USE_COLOR_16MLN wnd->fc = 0x000000; wnd->bc = 0xF0F0F0; + #endif + #ifdef USE_COLOR_65K + wnd->fc = 0x0000; + wnd->bc = 0xEF7D; + #endif wnd->xs = 0; wnd->ys = 0; wnd->xe = UG_GetXDim()-1; @@ -5468,7 +5904,8 @@ UG_RESULT UG_WindowCreate( UG_WINDOW* wnd, UG_OBJECT* objlst, UG_U8 objcnt, void /* Initialize window title-bar */ wnd->title.str = NULL; - wnd->title.font = NULL; + if (gui != NULL) wnd->title.font = &gui->font; + else wnd->title.font = NULL; wnd->title.h_space = 2; wnd->title.v_space = 2; wnd->title.align = ALIGN_CENTER_LEFT; @@ -6206,7 +6643,8 @@ UG_RESULT UG_ButtonCreate( UG_WINDOW* wnd, UG_BUTTON* btn, UG_U8 id, UG_S16 xs, btn->afc = wnd->fc; btn->style = BTN_STYLE_3D; btn->align = ALIGN_CENTER; - btn->font = NULL; + if (gui != NULL) btn->font = &gui->font; + else btn->font = NULL; btn->str = "-"; /* Initialize standard object parameters */ @@ -6725,6 +7163,607 @@ void _UG_ButtonUpdate(UG_WINDOW* wnd, UG_OBJECT* obj) } } +/* -------------------------------------------------------------------------------- */ +/* -- Checkbox FUNCTIONS -- */ +/* -------------------------------------------------------------------------------- */ +UG_RESULT UG_CheckboxCreate( UG_WINDOW* wnd, UG_CHECKBOX* chb, UG_U8 id, UG_S16 xs, UG_S16 ys, UG_S16 xe, UG_S16 ye ) +{ + UG_OBJECT* obj; + + obj = _UG_GetFreeObject( wnd ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + /* Initialize object-specific parameters */ + chb->state = CHB_STATE_RELEASED; + chb->bc = wnd->bc; + chb->fc = wnd->fc; + chb->abc = wnd->bc; + chb->afc = wnd->fc; + chb->style = CHB_STYLE_3D; + chb->align = ALIGN_TOP_LEFT; + if (gui != NULL) chb->font = &gui->font; + else chb->font = NULL; + chb->str = "-"; + chb->checked = 0; + + /* Initialize standard object parameters */ + obj->update = _UG_CheckboxUpdate; + obj->touch_state = OBJ_TOUCH_STATE_INIT; + obj->type = OBJ_TYPE_CHECKBOX; + obj->event = OBJ_EVENT_NONE; + obj->a_rel.xs = xs; + obj->a_rel.ys = ys; + obj->a_rel.xe = xe; + obj->a_rel.ye = ye; + obj->a_abs.xs = -1; + obj->a_abs.ys = -1; + obj->a_abs.xe = -1; + obj->a_abs.ye = -1; + obj->id = id; + obj->state |= OBJ_STATE_VISIBLE | OBJ_STATE_REDRAW | OBJ_STATE_VALID | OBJ_STATE_TOUCH_ENABLE; + obj->data = (void*)chb; + + /* Update function: Do your thing! */ + obj->state &= ~OBJ_STATE_FREE; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxDelete( UG_WINDOW* wnd, UG_U8 id ) +{ + return _UG_DeleteObject( wnd, OBJ_TYPE_CHECKBOX, id ); +} + +UG_RESULT UG_CheckboxShow( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + obj->state |= OBJ_STATE_VISIBLE; + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxHide( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + btn = (UG_CHECKBOX*)(obj->data); + + btn->state &= ~CHB_STATE_PRESSED; + obj->touch_state = OBJ_TOUCH_STATE_INIT; + obj->event = OBJ_EVENT_NONE; + obj->state &= ~OBJ_STATE_VISIBLE; + obj->state |= OBJ_STATE_UPDATE; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxSetCheched( UG_WINDOW* wnd, UG_U8 id, UG_U8 ch ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + btn = (UG_CHECKBOX*)(obj->data); + btn->checked = ch; + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + + +UG_RESULT UG_CheckboxSetForeColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR fc ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + btn = (UG_CHECKBOX*)(obj->data); + btn->fc = fc; + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxSetBackColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR bc ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + btn = (UG_CHECKBOX*)(obj->data); + btn->bc = bc; + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxSetAlternateForeColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR afc ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + btn = (UG_CHECKBOX*)(obj->data); + btn->afc = afc; + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxSetAlternateBackColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR abc ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + btn = (UG_CHECKBOX*)(obj->data); + btn->abc = abc; + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxSetText( UG_WINDOW* wnd, UG_U8 id, char* str ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + btn = (UG_CHECKBOX*)(obj->data); + btn->str = str; + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxSetFont( UG_WINDOW* wnd, UG_U8 id, const UG_FONT* font ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + btn = (UG_CHECKBOX*)(obj->data); + btn->font = font; + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxSetStyle( UG_WINDOW* wnd, UG_U8 id, UG_U8 style ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* chk=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + chk = (UG_CHECKBOX*)(obj->data); + + /* Select color scheme */ + chk->style &= ~(CHB_STYLE_USE_ALTERNATE_COLORS | CHB_STYLE_TOGGLE_COLORS | CHB_STYLE_NO_BORDERS | CHB_STYLE_NO_FILL); + chk->state |= CHB_STATE_ALWAYS_REDRAW; + if ( style & CHB_STYLE_NO_BORDERS ) + { + chk->style |= CHB_STYLE_NO_BORDERS; + } + if ( style & CHB_STYLE_NO_FILL ) + { + chk->style |= CHB_STYLE_NO_FILL; + } + if ( style & CHB_STYLE_TOGGLE_COLORS ) + { + chk->style |= CHB_STYLE_TOGGLE_COLORS; + } + else if ( style & CHB_STYLE_USE_ALTERNATE_COLORS ) + { + chk->style |= CHB_STYLE_USE_ALTERNATE_COLORS; + } + else + { + chk->state &= ~CHB_STATE_ALWAYS_REDRAW; + } + + /* 3D or 2D */ + if ( style & CHB_STYLE_3D ) + { + chk->style |= CHB_STYLE_3D; + } + else + { + chk->style &= ~CHB_STYLE_3D; + } + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxSetHSpace( UG_WINDOW* wnd, UG_U8 id, UG_S8 hs ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + btn = (UG_CHECKBOX*)(obj->data); + btn->h_space = hs; + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxSetVSpace( UG_WINDOW* wnd, UG_U8 id, UG_S8 vs ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + btn = (UG_CHECKBOX*)(obj->data); + btn->v_space = vs; + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + +UG_RESULT UG_CheckboxSetAlignment( UG_WINDOW* wnd, UG_U8 id, UG_U8 align ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj == NULL ) return UG_RESULT_FAIL; + + btn = (UG_CHECKBOX*)(obj->data); + btn->align = align; + obj->state |= OBJ_STATE_UPDATE | OBJ_STATE_REDRAW; + + return UG_RESULT_OK; +} + +UG_U8 UG_CheckboxGetChecked( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + UG_U8 c = 0; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj != NULL ) + { + btn = (UG_CHECKBOX*)(obj->data); + c = btn->checked; + } + return c; +} + +UG_COLOR UG_CheckboxGetForeColor( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + UG_COLOR c = C_BLACK; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj != NULL ) + { + btn = (UG_CHECKBOX*)(obj->data); + c = btn->fc; + } + return c; +} + +UG_COLOR UG_CheckboxGetBackColor( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + UG_COLOR c = C_BLACK; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj != NULL ) + { + btn = (UG_CHECKBOX*)(obj->data); + c = btn->bc; + } + return c; +} + +UG_COLOR UG_CheckboxGetAlternateForeColor( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + UG_COLOR c = C_BLACK; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj != NULL ) + { + btn = (UG_CHECKBOX*)(obj->data); + c = btn->afc; + } + return c; +} + +UG_COLOR UG_CheckboxGetAlternateBackColor( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + UG_COLOR c = C_BLACK; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj != NULL ) + { + btn = (UG_CHECKBOX*)(obj->data); + c = btn->abc; + } + return c; +} + +char* UG_CheckboxGetText( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + char* str = NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj != NULL ) + { + btn = (UG_CHECKBOX*)(obj->data); + str = btn->str; + } + return str; +} + +UG_FONT* UG_CheckboxGetFont( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + UG_FONT* font = NULL; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj != NULL ) + { + btn = (UG_CHECKBOX*)(obj->data); + font = (UG_FONT*)btn->font; + } + return font; +} + +UG_U8 UG_CheckboxGetStyle( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + UG_U8 style = 0; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj != NULL ) + { + btn = (UG_CHECKBOX*)(obj->data); + style = btn->style; + } + return style; +} + +UG_S8 UG_CheckboxGetHSpace( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + UG_S8 hs = 0; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj != NULL ) + { + btn = (UG_CHECKBOX*)(obj->data); + hs = btn->h_space; + } + return hs; +} + +UG_S8 UG_CheckboxGetVSpace( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + UG_S8 vs = 0; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj != NULL ) + { + btn = (UG_CHECKBOX*)(obj->data); + vs = btn->v_space; + } + return vs; +} + +UG_U8 UG_CheckboxGetAlignment( UG_WINDOW* wnd, UG_U8 id ) +{ + UG_OBJECT* obj=NULL; + UG_CHECKBOX* btn=NULL; + UG_U8 align = 0; + + obj = _UG_SearchObject( wnd, OBJ_TYPE_CHECKBOX, id ); + if ( obj != NULL ) + { + btn = (UG_CHECKBOX*)(obj->data); + align = btn->align; + } + return align; +} + +/* ======================================================== */ +void _UG_CheckboxUpdate(UG_WINDOW* wnd, UG_OBJECT* obj) +{ + UG_CHECKBOX* chb; + UG_AREA a; + UG_TEXT txt; + UG_U8 d; + UG_U8 d2; + + /* Get object-specific data */ + chb = (UG_CHECKBOX*)(obj->data); + + /* -------------------------------------------------- */ + /* Object touch section */ + /* -------------------------------------------------- */ + if ( (obj->touch_state & OBJ_TOUCH_STATE_CHANGED) ) + { + /* Handle 'click' event */ + if ( obj->touch_state & OBJ_TOUCH_STATE_CLICK_ON_OBJECT ) + { + obj->event = CHB_EVENT_CLICKED; + obj->state |= OBJ_STATE_UPDATE; + } + /* Is the Checkbox pressed down? */ + if ( obj->touch_state & OBJ_TOUCH_STATE_PRESSED_ON_OBJECT ) + { + chb->state |= CHB_STATE_PRESSED; + obj->state |= OBJ_STATE_UPDATE; + obj->event = OBJ_EVENT_PRESSED; + } + /* Can we release the Checkbox? */ + else if ( chb->state & CHB_STATE_PRESSED ) + { + chb->state &= ~CHB_STATE_PRESSED; + obj->state |= OBJ_STATE_UPDATE; + obj->event = OBJ_EVENT_RELEASED; + + chb->checked = !chb->checked; + } + obj->touch_state &= ~OBJ_TOUCH_STATE_CHANGED; + } + + /* -------------------------------------------------- */ + /* Object update section */ + /* -------------------------------------------------- */ + if ( obj->state & OBJ_STATE_UPDATE ) + { + UG_WindowGetArea(wnd,&a); + obj->a_abs.xs = obj->a_rel.xs + a.xs; + obj->a_abs.ys = obj->a_rel.ys + a.ys; + obj->a_abs.xe = obj->a_rel.xe + a.xs; + obj->a_abs.ye = obj->a_rel.ye + a.ys; + if ( obj->a_abs.ye > wnd->ye ) return; + if ( obj->a_abs.xe > wnd->xe ) return; + + if ( obj->state & OBJ_STATE_VISIBLE ) + { + /* 3D or 2D style? */ + d = ( chb->style & CHB_STYLE_3D )? 3:1; + d2 = (chb->font->char_width < chb->font->char_height) ? chb->font->char_height : chb->font->char_width; + + /* Full redraw necessary? */ + if ( (obj->state & OBJ_STATE_REDRAW) || (chb->state & CHB_STATE_ALWAYS_REDRAW) ) + { +#ifdef USE_PRERENDER_EVENT + _UG_SendObjectPrerenderEvent(wnd, obj); +#endif + txt.bc = chb->bc; + txt.fc = chb->fc; + + if( chb->state & CHB_STATE_PRESSED ) + { + /* "toggle" style? */ + if( chb->style & CHB_STYLE_TOGGLE_COLORS ) + { + /* Swap colors */ + txt.bc = chb->fc; + txt.fc = chb->bc; + } + /* Use alternate colors? */ + else if ( chb->style & CHB_STYLE_USE_ALTERNATE_COLORS ) + { + txt.bc = chb->abc; + txt.fc = chb->afc; + } + } + if ( !(chb->style & CHB_STYLE_NO_FILL) ) + UG_FillFrame(obj->a_abs.xs+d, obj->a_abs.ys+d, obj->a_abs.xe-d, obj->a_abs.ye-d, txt.bc); + + /* Draw Checkbox text */ +// txt.a.xs = obj->a_abs.xs+d; +// txt.a.ys = obj->a_abs.ys+d; +// txt.a.xe = obj->a_abs.xe-d; +// txt.a.ye = obj->a_abs.ye-d; + txt.a.xs = obj->a_abs.xs + d2 + 3*d; + txt.a.ys = obj->a_abs.ys + d; + txt.a.xe = obj->a_abs.xe; + txt.a.ye = obj->a_abs.ye; + txt.align = chb->align; + txt.font = chb->font; + txt.h_space = 2; + txt.v_space = 2; + txt.str = chb->str; + _UG_PutText( &txt ); + obj->state &= ~OBJ_STATE_REDRAW; +#ifdef USE_POSTRENDER_EVENT + _UG_SendObjectPostrenderEvent(wnd, obj); +#endif + } + + /* Draw Checkbox X */ + if (chb->checked) + { + UG_DrawLine(obj->a_abs.xs+d+1, obj->a_abs.ys+d, obj->a_abs.xs+d2+d-1, obj->a_abs.ys+d2+d-2, chb->fc); + UG_DrawLine(obj->a_abs.xs+d, obj->a_abs.ys+d, obj->a_abs.xs+d2+d-1, obj->a_abs.ys+d2+d-1, chb->fc); + UG_DrawLine(obj->a_abs.xs+d, obj->a_abs.ys+d+1, obj->a_abs.xs+d2+d-2, obj->a_abs.ys+d2+d-1, chb->fc); + + UG_DrawLine(obj->a_abs.xs+d2+d-1, obj->a_abs.ys+d+1, obj->a_abs.xs+d+1, obj->a_abs.ys+d2+d-1, chb->fc); + UG_DrawLine(obj->a_abs.xs+d2+d-1, obj->a_abs.ys+d, obj->a_abs.xs+d, obj->a_abs.ys+d2+d-1, chb->fc); + UG_DrawLine(obj->a_abs.xs+d2+d-2, obj->a_abs.ys+d, obj->a_abs.xs+d, obj->a_abs.ys+d2+d-2, chb->fc); + } + else + { + UG_DrawLine(obj->a_abs.xs+d+1, obj->a_abs.ys+d, obj->a_abs.xs+d2+d-1, obj->a_abs.ys+d2+d-2, chb->bc); + UG_DrawLine(obj->a_abs.xs+d, obj->a_abs.ys+d, obj->a_abs.xs+d2+d-1, obj->a_abs.ys+d2+d-1, chb->bc); + UG_DrawLine(obj->a_abs.xs+d, obj->a_abs.ys+d+1, obj->a_abs.xs+d2+d-2, obj->a_abs.ys+d2+d-1, chb->bc); + + UG_DrawLine(obj->a_abs.xs+d2+d-1, obj->a_abs.ys+d+1, obj->a_abs.xs+d+1, obj->a_abs.ys+d2+d-1, chb->bc); + UG_DrawLine(obj->a_abs.xs+d2+d-1, obj->a_abs.ys+d, obj->a_abs.xs+d, obj->a_abs.ys+d2+d-1, chb->bc); + UG_DrawLine(obj->a_abs.xs+d2+d-2, obj->a_abs.ys+d, obj->a_abs.xs+d, obj->a_abs.ys+d2+d-2, chb->bc); + } + /* Draw Checkbox frame */ + if ( !(chb->style & CHB_STYLE_NO_BORDERS) ) + { + if ( chb->style & CHB_STYLE_3D ) + { /* 3D */ + _UG_DrawObjectFrame(obj->a_abs.xs,obj->a_abs.ys,obj->a_abs.xs+d2+2*d-1,obj->a_abs.ys+d2+2*d-1, (chb->state&CHB_STATE_PRESSED)?(UG_COLOR*)pal_checkbox_pressed:(UG_COLOR*)pal_checkbox_released); + } + else + { /* 2D */ + UG_DrawFrame(obj->a_abs.xs,obj->a_abs.ys,obj->a_abs.xs+d2+2*d-1,obj->a_abs.ys+d2+2*d-1,(chb->state&CHB_STATE_PRESSED)?chb->abc:chb->afc); + } + } + } + else + { + if ( !(chb->style & CHB_STYLE_NO_FILL) ) + UG_FillFrame(obj->a_abs.xs, obj->a_abs.ys, obj->a_abs.xe, obj->a_abs.ye, wnd->bc); + } + obj->state &= ~OBJ_STATE_UPDATE; + } +} + + /* -------------------------------------------------------------------------------- */ /* -- TEXTBOX FUNCTIONS -- */ /* -------------------------------------------------------------------------------- */ @@ -6737,7 +7776,8 @@ UG_RESULT UG_TextboxCreate( UG_WINDOW* wnd, UG_TEXTBOX* txb, UG_U8 id, UG_S16 xs /* Initialize object-specific parameters */ txb->str = NULL; - txb->font = NULL; + if (gui != NULL) txb->font = &gui->font; + else txb->font = NULL; txb->style = 0; /* reserved */ txb->fc = wnd->fc; txb->bc = wnd->bc; diff --git a/ugui.h b/ugui.h index cbf1fe5..13c0925 100644 --- a/ugui.h +++ b/ugui.h @@ -17,7 +17,8 @@ #ifndef __UGUI_H #define __UGUI_H -#include "system.h" +//#include "system.h" +#include "stm32f10x.h" #include "ugui_config.h" @@ -66,6 +67,9 @@ typedef struct #ifdef USE_FONT_8X12 extern const UG_FONT FONT_8X12; #endif +#ifdef USE_FONT_8X12rus + extern const UG_FONT FONT_8X12; +#endif #ifdef USE_FONT_8X14 extern const UG_FONT FONT_8X14; #endif @@ -97,7 +101,12 @@ typedef struct typedef struct S_OBJECT UG_OBJECT; typedef struct S_WINDOW UG_WINDOW; typedef UG_S8 UG_RESULT; +#ifdef USE_COLOR_16MLN typedef UG_U32 UG_COLOR; +#endif +#ifdef USE_COLOR_65K +typedef UG_U16 UG_COLOR; +#endif /* -------------------------------------------------------------------------------- */ /* -- DEFINES -- */ /* -------------------------------------------------------------------------------- */ @@ -252,6 +261,7 @@ struct S_OBJECT #define OBJ_TYPE_BUTTON 1 #define OBJ_TYPE_TEXTBOX 2 #define OBJ_TYPE_IMAGE 3 +#define OBJ_TYPE_CHECKBOX 4 /* Standard object events */ #define OBJ_EVENT_NONE 0 @@ -395,6 +405,65 @@ typedef struct /* Button events */ #define BTN_EVENT_CLICKED OBJ_EVENT_CLICKED +/* -------------------------------------------------------------------------------- */ +/* -- CHECKBOX OBJECT -- */ +/* -------------------------------------------------------------------------------- */ +/* Checkbox structure */ +typedef struct +{ + UG_U8 state; + UG_U8 style; + UG_COLOR fc; + UG_COLOR bc; + UG_COLOR afc; + UG_COLOR abc; + const UG_FONT* font; + UG_U8 align; + UG_S8 h_space; + UG_S8 v_space; + char* str; + UG_U8 checked; +}UG_CHECKBOX; + +/* Default checkbox IDs */ +#define CHB_ID_0 OBJ_ID_0 +#define CHB_ID_1 OBJ_ID_1 +#define CHB_ID_2 OBJ_ID_2 +#define CHB_ID_3 OBJ_ID_3 +#define CHB_ID_4 OBJ_ID_4 +#define CHB_ID_5 OBJ_ID_5 +#define CHB_ID_6 OBJ_ID_6 +#define CHB_ID_7 OBJ_ID_7 +#define CHB_ID_8 OBJ_ID_8 +#define CHB_ID_9 OBJ_ID_9 +#define CHB_ID_10 OBJ_ID_10 +#define CHB_ID_11 OBJ_ID_11 +#define CHB_ID_12 OBJ_ID_12 +#define CHB_ID_13 OBJ_ID_13 +#define CHB_ID_14 OBJ_ID_14 +#define CHB_ID_15 OBJ_ID_15 +#define CHB_ID_16 OBJ_ID_16 +#define CHB_ID_17 OBJ_ID_17 +#define CHB_ID_18 OBJ_ID_18 +#define CHB_ID_19 OBJ_ID_19 + +/* Checkbox states */ +#define CHB_STATE_RELEASED (0<<0) +#define CHB_STATE_PRESSED (1<<0) +#define CHB_STATE_ALWAYS_REDRAW (1<<1) + +/* Checkbox style */ +#define CHB_STYLE_2D (0<<0) +#define CHB_STYLE_3D (1<<0) +#define CHB_STYLE_TOGGLE_COLORS (1<<1) +#define CHB_STYLE_USE_ALTERNATE_COLORS (1<<2) +#define CHB_STYLE_NO_BORDERS (1<<3) +#define CHB_STYLE_NO_FILL (1<<4) + +/* Checkbox events */ +#define CHB_EVENT_CLICKED OBJ_EVENT_CLICKED + + /* -------------------------------------------------------------------------------- */ /* -- TEXTBOX OBJECT -- */ /* -------------------------------------------------------------------------------- */ @@ -525,6 +594,149 @@ typedef struct /* -- µGUI COLORS -- */ /* -- Source: http://www.rapidtables.com/web/color/RGB_Color.htm -- */ /* -------------------------------------------------------------------------------- */ +#ifdef USE_COLOR_65K +#define C_MAROON 0x8000 +#define C_DARK_RED 0x8800 +#define C_BROWN 0xA145 +#define C_FIREBRICK 0xB104 +#define C_CRIMSON 0xD8A7 +#define C_RED 0xF800 +#define C_TOMATO 0xFB09 +#define C_CORAL 0xFBEA +#define C_INDIAN_RED 0xCAEB +#define C_LIGHT_CORAL 0xEC10 +#define C_DARK_SALMON 0xE4AF +#define C_SALMON 0xF40E +#define C_LIGHT_SALMON 0xFD0F +#define C_ORANGE_RED 0xFA20 +#define C_DARK_ORANGE 0xFC60 +#define C_ORANGE 0xFD20 +#define C_GOLD 0xFEA0 +#define C_DARK_GOLDEN_ROD 0xB421 +#define C_GOLDEN_ROD 0xDD24 +#define C_PALE_GOLDEN_ROD 0xEF35 +#define C_DARK_KHAKI 0xBDAD +#define C_KHAKI 0xEF31 +#define C_OLIVE 0x8400 +#define C_YELLOW 0xFFE0 +#define C_YELLOW_GREEN 0x9E66 +#define C_DARK_OLIVE_GREEN 0x5346 +#define C_OLIVE_DRAB 0x6C64 +#define C_LAWN_GREEN 0x7FC0 +#define C_CHART_REUSE 0x7FE0 +#define C_GREEN_YELLOW 0xAFE6 +#define C_DARK_GREEN 0x0320 +#define C_GREEN 0x07E0 +#define C_FOREST_GREEN 0x2444 +#define C_LIME 0x07E0 +#define C_LIME_GREEN 0x3666 +#define C_LIGHT_GREEN 0x9772 +#define C_PALE_GREEN 0x97D2 +#define C_DARK_SEA_GREEN 0x8DD1 +#define C_MEDIUM_SPRING_GREEN 0x07D3 +#define C_SPRING_GREEN 0x07EF +#define C_SEA_GREEN 0x344B +#define C_MEDIUM_AQUA_MARINE 0x6675 +#define C_MEDIUM_SEA_GREEN 0x3D8E +#define C_LIGHT_SEA_GREEN 0x2595 +#define C_DARK_SLATE_GRAY 0x328A +#define C_TEAL 0x0410 +#define C_DARK_CYAN 0x0451 +#define C_AQUA 0x07FF +#define C_CYAN 0x07FF +#define C_LIGHT_CYAN 0xDFFF +#define C_DARK_TURQUOISE 0x0679 +#define C_TURQUOISE 0x46F9 +#define C_MEDIUM_TURQUOISE 0x4E99 +#define C_PALE_TURQUOISE 0xAF7D +#define C_AQUA_MARINE 0x7FFA +#define C_POWDER_BLUE 0xAEFC +#define C_CADET_BLUE 0x64F3 +#define C_STEEL_BLUE 0x4C16 +#define C_CORN_FLOWER_BLUE 0x64BD +#define C_DEEP_SKY_BLUE 0x05FF +#define C_DODGER_BLUE 0x249F +#define C_LIGHT_BLUE 0xAEBC +#define C_SKY_BLUE 0x867D +#define C_LIGHT_SKY_BLUE 0x867E +#define C_MIDNIGHT_BLUE 0x18CE +#define C_NAVY 0x0010 +#define C_DARK_BLUE 0x0011 +#define C_MEDIUM_BLUE 0x0019 +#define C_BLUE 0x001F +#define C_ROYAL_BLUE 0x435B +#define C_BLUE_VIOLET 0x897B +#define C_INDIGO 0x4810 +#define C_DARK_SLATE_BLUE 0x49F1 +#define C_SLATE_BLUE 0x6AD9 +#define C_MEDIUM_SLATE_BLUE 0x7B5D +#define C_MEDIUM_PURPLE 0x939B +#define C_DARK_MAGENTA 0x8811 +#define C_DARK_VIOLET 0x901A +#define C_DARK_ORCHID 0x9999 +#define C_MEDIUM_ORCHID 0xBABA +#define C_PURPLE 0x8010 +#define C_THISTLE 0xD5FA +#define C_PLUM 0xDD1B +#define C_VIOLET 0xEC1D +#define C_MAGENTA 0xF81F +#define C_ORCHID 0xDB9A +#define C_MEDIUM_VIOLET_RED 0xC0B0 +#define C_PALE_VIOLET_RED 0xDB92 +#define C_DEEP_PINK 0xF8B2 +#define C_HOT_PINK 0xFB56 +#define C_LIGHT_PINK 0xFDB7 +#define C_PINK 0xFDF9 +#define C_ANTIQUE_WHITE 0xF75A +#define C_BEIGE 0xF7BB +#define C_BISQUE 0xFF18 +#define C_BLANCHED_ALMOND 0xFF59 +#define C_WHEAT 0xF6F6 +#define C_CORN_SILK 0xFFBB +#define C_LEMON_CHIFFON 0xFFD9 +#define C_LIGHT_GOLDEN_ROD_YELLOW 0xF7DA +#define C_LIGHT_YELLOW 0xFFFB +#define C_SADDLE_BROWN 0x8A22 +#define C_SIENNA 0x9A85 +#define C_CHOCOLATE 0xD344 +#define C_PERU 0xCC28 +#define C_SANDY_BROWN 0xF52C +#define C_BURLY_WOOD 0xDDB0 +#define C_TAN 0xD591 +#define C_ROSY_BROWN 0xBC71 +#define C_MOCCASIN 0xFF16 +#define C_NAVAJO_WHITE 0xFEF5 +#define C_PEACH_PUFF 0xFED6 +#define C_MISTY_ROSE 0xFF1B +#define C_LAVENDER_BLUSH 0xFF7E +#define C_LINEN 0xF77C +#define C_OLD_LACE 0xFFBC +#define C_PAPAYA_WHIP 0xFF7A +#define C_SEA_SHELL 0xFFBD +#define C_MINT_CREAM 0xF7FE +#define C_SLATE_GRAY 0x7412 +#define C_LIGHT_SLATE_GRAY 0x7453 +#define C_LIGHT_STEEL_BLUE 0xAE1B +#define C_LAVENDER 0xE73E +#define C_FLORAL_WHITE 0xFFDD +#define C_ALICE_BLUE 0xEFBF +#define C_GHOST_WHITE 0xF7BF +#define C_HONEYDEW 0xEFFD +#define C_IVORY 0xFFFD +#define C_AZURE 0xEFFF +#define C_SNOW 0xFFDE +#define C_BLACK 0x0000 +#define C_DIM_GRAY 0x6B4D +#define C_GRAY 0x8410 +#define C_DARK_GRAY 0xAD55 +#define C_SILVER 0xBDF7 +#define C_LIGHT_GRAY 0xD69A +#define C_GAINSBORO 0xDEDB +#define C_WHITE_SMOKE 0xF7BE +#define C_WHITE 0xFFFF +#endif + +#ifdef USE_COLOR_16MLN #define C_MAROON 0x800000 #define C_DARK_RED 0x8B0000 #define C_BROWN 0xA52A2A @@ -664,6 +876,7 @@ typedef struct #define C_GAINSBORO 0xDCDCDC #define C_WHITE_SMOKE 0xF5F5F5 #define C_WHITE 0xFFFFFF +#endif /* -------------------------------------------------------------------------------- */ /* -- PROTOTYPES -- */ @@ -780,6 +993,35 @@ UG_S8 UG_ButtonGetHSpace( UG_WINDOW* wnd, UG_U8 id ); UG_S8 UG_ButtonGetVSpace( UG_WINDOW* wnd, UG_U8 id ); UG_U8 UG_ButtonGetAlignment( UG_WINDOW* wnd, UG_U8 id ); +/* Checkbox functions */ +UG_RESULT UG_CheckboxCreate( UG_WINDOW* wnd, UG_CHECKBOX* btn, UG_U8 id, UG_S16 xs, UG_S16 ys, UG_S16 xe, UG_S16 ye ); +UG_RESULT UG_CheckboxDelete( UG_WINDOW* wnd, UG_U8 id ); +UG_RESULT UG_CheckboxShow( UG_WINDOW* wnd, UG_U8 id ); +UG_RESULT UG_CheckboxHide( UG_WINDOW* wnd, UG_U8 id ); +UG_RESULT UG_CheckboxSetCheched( UG_WINDOW* wnd, UG_U8 id, UG_U8 ch ); +UG_RESULT UG_CheckboxSetForeColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR fc ); +UG_RESULT UG_CheckboxSetBackColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR bc ); +UG_RESULT UG_CheckboxSetAlternateForeColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR afc ); +UG_RESULT UG_CheckboxSetAlternateBackColor( UG_WINDOW* wnd, UG_U8 id, UG_COLOR abc ); +UG_RESULT UG_CheckboxSetText( UG_WINDOW* wnd, UG_U8 id, char* str ); +UG_RESULT UG_CheckboxSetFont( UG_WINDOW* wnd, UG_U8 id, const UG_FONT* font ); +UG_RESULT UG_CheckboxSetStyle( UG_WINDOW* wnd, UG_U8 id, UG_U8 style ); +UG_RESULT UG_CheckboxSetHSpace( UG_WINDOW* wnd, UG_U8 id, UG_S8 hs ); +UG_RESULT UG_CheckboxSetVSpace( UG_WINDOW* wnd, UG_U8 id, UG_S8 vs ); +UG_RESULT UG_CheckboxSetAlignment( UG_WINDOW* wnd, UG_U8 id, UG_U8 align ); +UG_U8 UG_CheckboxGetChecked( UG_WINDOW* wnd, UG_U8 id ); +UG_COLOR UG_CheckboxGetForeColor( UG_WINDOW* wnd, UG_U8 id ); +UG_COLOR UG_CheckboxGetBackColor( UG_WINDOW* wnd, UG_U8 id ); +UG_COLOR UG_CheckboxGetAlternateForeColor( UG_WINDOW* wnd, UG_U8 id ); +UG_COLOR UG_CheckboxGetAlternateBackColor( UG_WINDOW* wnd, UG_U8 id ); +char* UG_CheckboxGetText( UG_WINDOW* wnd, UG_U8 id ); +UG_FONT* UG_CheckboxGetFont( UG_WINDOW* wnd, UG_U8 id ); +UG_U8 UG_CheckboxGetStyle( UG_WINDOW* wnd, UG_U8 id ); +UG_S8 UG_CheckboxGetHSpace( UG_WINDOW* wnd, UG_U8 id ); +UG_S8 UG_CheckboxGetVSpace( UG_WINDOW* wnd, UG_U8 id ); +UG_U8 UG_CheckboxGetAlignment( UG_WINDOW* wnd, UG_U8 id ); + + /* Textbox functions */ UG_RESULT UG_TextboxCreate( UG_WINDOW* wnd, UG_TEXTBOX* txb, UG_U8 id, UG_S16 xs, UG_S16 ys, UG_S16 xe, UG_S16 ye ); UG_RESULT UG_TextboxDelete( UG_WINDOW* wnd, UG_U8 id ); diff --git a/ugui_config.h b/ugui_config.h index 6801288..d65c35f 100644 --- a/ugui_config.h +++ b/ugui_config.h @@ -1,3 +1,5 @@ +#include "stm32f10x.h" + #ifndef __UGUI_CONFIG_H #define __UGUI_CONFIG_H @@ -5,6 +7,12 @@ /* -- CONFIG SECTION -- */ /* -------------------------------------------------------------------------------- */ +//#define USE_MULTITASKING + +/* Enable color mode */ +//# define USE_COLOR_16MLN // RGB = 0xFF,0xFF,0xFF +# define USE_COLOR_65K // RGB = 0bRRRRRGGGGGGBBBBB + /* Enable needed fonts here */ //#define USE_FONT_4X6 //#define USE_FONT_5X8 @@ -12,15 +20,17 @@ //#define USE_FONT_6X8 //#define USE_FONT_6X10 //#define USE_FONT_7X12 -#define USE_FONT_8X8 +//#define USE_FONT_8X8 +#define USE_FONT_8X12rus +//#define USE_FONT_8X12 //#define USE_FONT_8X12 //#define USE_FONT_8X14 -#define USE_FONT_10X16 +//#define USE_FONT_10X16 //#define USE_FONT_12X16 //#define USE_FONT_12X20 //#define USE_FONT_16X26 //#define USE_FONT_22X36 -#define USE_FONT_24X40 +//#define USE_FONT_24X40 //#define USE_FONT_32X53 /* Specify platform-dependent integer types here */ From 50a4b3b8b129382d79850f65e87ead8767061a2f Mon Sep 17 00:00:00 2001 From: MikhailPodkur Date: Fri, 1 Jan 2016 15:06:12 +0700 Subject: [PATCH 2/2] Vector Cyrillic font added Example added --- ugui.c | 558 +++++++++++++++++++++++++++++++++++++++++++------- ugui.h | 34 ++- ugui_config.h | 12 +- 3 files changed, 512 insertions(+), 92 deletions(-) diff --git a/ugui.c b/ugui.c index d5e8828..bf41ac7 100644 --- a/ugui.c +++ b/ugui.c @@ -14,11 +14,26 @@ // * Redistributions of source code must retain the above copyright notice. // /* -------------------------------------------------------------------------------- */ +/* -- MY SPECIAL THANKS GO TO -- */ +/* -------------------------------------------------------------------------------- */ +// Andrey Filimonov (-->https://github.com/Sermus) +// for giving valuable suggestions, reporting bugs and adding several new features. +// Andrey also put a lot of work in the implementaion of anti-aliased font support. +// +// Mikhail Podkur (-->https://github.com/MikhailPodkur) +// for adding cyrillic 8x12 font, checkbox feature and RGB565 support. +// +// Gustavo Denardin +// for giving valuable suggestions regarding real-time os support. +// +// Samuel Kleiser +// for reporting bugs and giving examples how to improve µGUI. +/* -------------------------------------------------------------------------------- */ /* -- REVISION HISTORY -- */ /* -------------------------------------------------------------------------------- */ -// Dec 20, 2015 V0.4 Check box component with all funtions added. -// Cyrillic font 8*12 added. -// 65k color schema added. +// Dec 20, 2015 V0.31 Checkbox component with all funtions added. +// Cyrillic font 8x12 added. +// RGB565 color schema added. // Windows components font could be getted from current GUI by default // Mar 18, 2015 V0.3 Driver support added. // Window and object support added. @@ -32,6 +47,7 @@ // // Oct 11, 2014 V0.1 First release. /* -------------------------------------------------------------------------------- */ +#include "stm32f10x.h" #include "ugui.h" /* Static functions */ @@ -2136,7 +2152,7 @@ __UG_FONT_DATA unsigned char font_8x12[256][12]={ #endif -#ifdef USE_FONT_8X12rus +#ifdef USE_FONT_8X12_CYRILLIC __UG_FONT_DATA unsigned char font_8x12[256][12]={ {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // 0x00 {0x00, 0x7E, 0xC3, 0x81, 0xA5, 0x81, 0xBD, 0x99, 0xC3, 0x7E, 0x00, 0x00}, // 0x01 @@ -4485,6 +4501,268 @@ __UG_FONT_DATA unsigned char font_32x53[256][212]={ }; #endif +#ifdef USE_FONT_VECTOR_CYRILLIC +UG_VECT_FONT VECT_FONT_CYRILLIC = { + "" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"" +,"005532411402020035551435061426061426" +,"" +,"" +,"24202636342430343020" +,"20224042" +,"0444420215113135" +,"20264111133302133344443535050211" +,"064001001101001046363536464545351110" +,"3231111220113204442626161605050446123120" +,"32302021312130202332" +,"362521253021" +,"313520312635" +,"04232125230223424423" +,"25210343" +,"35372837252635252636" +,"0343" +,"2526362635253536" +,"0640" +,"05010110103030414145453636161605" +,"36303012" +,"011010303041414343064606" +,"0040163640224345364543221605" +,"363010044404" +,"40004536361616054543433200020232" +,"163610300110160501054445443303334536" +,"004040414116" +,"0404103030413313163604054445010241420213334210010413051636454433" +,"163636454541413030101001010202131343" +,"22233525323335362625362632223323" +,"353732332333222332222526283736263525" +,"45131341" +,"04440242" +,"15434311" +,"0201011030103041414242242626" +,"0516163605010110103030414144442424222241" +,"06020220204242460444" +,"0006063636450030304141424544443342333303" +,"4130301010010105051616363645" +,"161030003041414545363606" +,"0600400006463303" +,"060000402303" +,"050110010516103041302343361643454536" +,"060040460343" +,"202610301636" +,"40450516163604054536" +,"0600401346131303" +,"06004606" +,"0600404640232300" +,"060040460046" +,"05011001160510303041414536453616" +,"060000303041414242333303" +,"050110011605103030414145364536162447" +,"0600003030414142423333034613" +,"10301001163613331302010244334445453605163041" +,"26200040" +,"16053645361600054045" +,"00264026" +,"0005160525162225362545364045" +,"00464006" +,"262300234023" +,"004040064606" +,"362620263020" +,"0046" +,"203030363626" +,"30125230" +,"0656" +,"22332022302031303121" +,"1526123226463243434615242444" +,"10163645433232222213434536262615" +,"3626152622133222433245361513" +,"36261526221332224332453640461315" +,"362615262213322243324536131534143443" +,"2130304021261242" +,"55251425221352225256475614131747" +,"1610324346433212" +,"1636202022261232" +,"162727373746404042463242" +,"1610142424422446" +,"202610201636" +,"3342425353561216363322123322" +,"13222232324316124346" +,"36261526221332224332453613154345" +,"153532124332443512174344" +,"452514252213422242471314" +,"1612132222324332" +,"2213132434454536224234243616" +,"2025463612422536" +,"15261215263642464536" +,"12365236" +,"1215263535465552261546553335" +,"02460642" +,"424502041504451527450727" +,"024242060646" +,"13242213212224252536302140304636" +,"2026" +,"43343243313234353526203110201626" +,"041313444453" +,"05454345210305034321" +,"2620004023324232534246555355" +,"410106011020" +,"35372837252635253626" +,"161212423021" +,"2628565826164656" +,"363656561616" +,"30362141" +,"254530362141" +,"261511154636201130203040263602320434" +,"0110102121120112400625343445453625363544445555463546" +,"363006161030364655465455544343331016" +,"36242432" +,"3630364655465455544300060343" +,"06004013461313032011" +,"26200040243343334643" +,"0600404606462726" +,"233436342303210127360600" +,"20223222" +,"30322030" +,"0002303212024232" +,"1012404210003040" +,"132434244334221332224332342224324313343224223213341324434322" +,"1343" +,"0353" +,"0646404640000600" +,"002010133330505330414150" +,"26222636364545343424122212030306" +,"26343422" +,"060226222636364545340434" +,"16122414422424463021" +,"16113344464433133111" +,"161246421646" +,"" +,"1741012510213021" +,"421702251131" +,"303615161636" +,"05141434343232121412011234454132" +,"410106014140" +,"20222426" +,"361616054536243313242213332245330110301041301301" +,"064601413303060110103030" +,"0106061717474756515651401040011035251425132232221314" +,"16053616032330101001010541304536" +,"453433421203041503043334" +,"02424442" +,"1333" +,"10405140174756475156011006011706121532124332344314344534" +,"11311636262130400010" +,"302121222233304142414233" +,"064625214303" +,"202610301636" +,"163621222326" +,"161212424142" +,"051616262635323535460207" +,"464020260110010202134010" +,"232434243334332333243423" +,"3616051612033212433203054404444310103030" +,"060026002026204046364434333433434344" +,"462615262242341413152213" +,"152424234344443512233243" +,"162727373746404042463242" +,"10301001163613331302010244334445453605163041" +,"2213132434454536224234243616" +,"16361010222630301232" +,"06020220204040460343" +,"0006063636454544443333034000" +,"0006063636450030304141424544443342333303" +,"00064000" +,"0706460646473630161111202030" +,"0006063600303303" +,"2620041300023342334413330213060440424644" +,"16363645103030414142454444334233331301100516" +,"060040460640" +,"0600404606402020" +,"0600401346131303" +,"16114640201106162040" +,"0600404640232300" +,"060040460343" +,"05011001160510303041414536453616" +,"060040460040" +,"060000303041414242333303" +,"4130301010010105051616363645" +,"26200040" +,"0642000224024042" +,"262014341030010343410110304143341403" +,"00464006" +,"4606060046473036" +,"4046000202131343" +,"4046000620260646" +,"40460006202606464657" +,"1016364545444433001016363313" +,"0006263535343423062623034640" +,"101636454544443316363313" +,"36451636432310303041414501100516" +,"06002125213030414541364525362303" +,"4640104001024313011002133306" +,"15262232263632433645434615242444" +,"163614343645161234451242" +,"34453645361634141216123232434334" +,"16121242" +,"262216561617565746422242" +,"46261526221332224332131544144443" +,"2622143402030605434245461403140543343445" +,"3645433236163212243445344334" +,"060246424206" +,"06024642420610213021" +,"1612241442242446" +,"16134642224206162213" +,"0602464202244224" +,"060236320434" +,"26160516120322123322352603053335" +,"060236320232" +,"351532124332443512174344" +,"3626152622133222433245361513" +,"36321252" +,"4307032502034243" +,"153512320312443532430304150443442227" +,"02460642" +,"0602363206364736" +,"363204340204" +,"4642020622264606" +,"46420206222646065746" +,"121612021636453634453414" +,"020606263526243524044246" +,"12161636453634453414" +,"163645363212244443453243" +,"12162414232543454332322325363645" +,"424622422213132424443416" +, 6,8}; +#endif + + #ifdef USE_FONT_4X6 const UG_FONT FONT_4X6 = {(unsigned char*)font_4x6,FONT_TYPE_1BPP,4,6,0,255,NULL}; #endif @@ -4509,7 +4787,7 @@ __UG_FONT_DATA unsigned char font_32x53[256][212]={ #ifdef USE_FONT_8X12 const UG_FONT FONT_8X12 = {(unsigned char*)font_8x12,FONT_TYPE_1BPP,8,12,0,255,NULL}; #endif -#ifdef USE_FONT_8X12rus +#ifdef USE_FONT_8X12_CYRILLIC const UG_FONT FONT_8X12 = {(unsigned char*)font_8x12,FONT_TYPE_1BPP,8,12,0,255,NULL}; #endif #ifdef USE_FONT_8X14 @@ -4537,6 +4815,7 @@ __UG_FONT_DATA unsigned char font_32x53[256][212]={ const UG_FONT FONT_32X53 = {(unsigned char*)font_32x53,FONT_TYPE_1BPP,32,53,0,255,NULL}; #endif + UG_S16 UG_Init( UG_GUI* g, void (*p)(UG_S16,UG_S16,UG_COLOR), UG_S16 x, UG_S16 y ) @@ -4560,10 +4839,10 @@ UG_S16 UG_Init( UG_GUI* g, void (*p)(UG_S16,UG_S16,UG_COLOR), UG_S16 x, UG_S16 y g->font.start_char = 0; g->font.end_char = 0; g->font.widths = NULL; - #ifdef USE_COLOR_16MLN + #ifdef USE_COLOR_RGB888 g->desktop_color = 0x5E8BEf; #endif - #ifdef USE_COLOR_65K + #ifdef USE_COLOR_RGB565 g->desktop_color = 0x5C5D; #endif g->fore_color = C_WHITE; @@ -4870,10 +5149,7 @@ void UG_DrawArc( UG_S16 x0, UG_S16 y0, UG_S16 r, UG_U8 s, UG_COLOR c ) void UG_DrawLine( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c ) { - UG_S16 dx, dy, i1, i2, i, kx, ky; - UG_S16 d; - UG_S16 x, y; - UG_S16 flag; + UG_S16 n, dx, dy, sgndx, sgndy, dxabs, dyabs, x, y, drawx, drawy; /* Is hardware acceleration available? */ if ( gui->driver[DRIVER_DRAW_LINE].state & DRIVER_ENABLED ) @@ -4881,74 +5157,164 @@ void UG_DrawLine( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c ) if( ((UG_RESULT(*)(UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c))gui->driver[DRIVER_DRAW_LINE].driver)(x1,y1,x2,y2,c) == UG_RESULT_OK ) return; } + dx = x2 - x1; + dy = y2 - y1; + dxabs = (dx>0)?dx:-dx; + dyabs = (dy>0)?dy:-dy; + sgndx = (dx>0)?1:-1; + sgndy = (dy>0)?1:-1; + x = dyabs >> 1; + y = dxabs >> 1; + drawx = x1; + drawy = y1; - dy = y2 - y1; - dx = x2 - x1; - if (dx==0 && dy==0) - { - gui->pset(x1,y1, c); - return; - } - - kx = 1; - ky = 1; + gui->pset(drawx, drawy,c); - if (dx < 0) - { - dx = -dx; - kx = -1; - } - else - if (dx==0) - kx = 0; - - if (dy < 0) - { - dy = -dy; - ky = -1; - } + if( dxabs >= dyabs ) + { + for( n=0; n= dxabs ) + { + y -= dxabs; + drawy += sgndy; + } + drawx += sgndx; + gui->pset(drawx, drawy,c); + } + } + else + { + for( n=0; n= dyabs ) + { + x -= dyabs; + drawx += sgndx; + } + drawy += sgndy; + gui->pset(drawx, drawy,c); + } + } +} - if(dxUG_MaxPolyPointNum)) + return; + + if (filled) + { + miny = p[0].y; + maxy = p[0].y; + for (i = 1; (i < n); i++) + { + if (p[i].y < miny) + miny = p[i].y; + + if (p[i].y > maxy) + maxy = p[i].y; + } + pmaxy = maxy; + + for (y = miny; (y <= maxy); y++) + { + ints = 0; + for (i = 0; (i < n); i++) + { + if (i) + { + ind1 = i - 1; + ind2 = i; + } + else + { + ind1 = n - 1; + ind2 = 0; + } + + y1 = p[ind1].y; + y2 = p[ind2].y; + if (y1 < y2) + { + x1 = p[ind1].x; + x2 = p[ind2].x; + } + else if (y1 > y2) + { + y2 = p[ind1].y; + y1 = p[ind2].y; + x2 = p[ind1].x; + x1 = p[ind2].x; + } + else + { + continue; + } - i1 = dy + dy; - d = i1 - dx; - i2 = d - dx; - x = x1; - y = y1; + if ((y >= y1) && (y < y2)) + { + polyInts[ints++] = (UG_S16) ((float) ((y - y1) * (x2 - x1))/(float) (y2 - y1) + 0.5 + x1); + } + else + if ((y == pmaxy) && (y == y2)) + { + polyInts[ints++] = x2; + } + } - for (i=0; ipset(x,y, c); - - if (flag) - x += kx; - else - y += ky; - - if (d < 0) - d += i1; - else - { - d += i2; - if (flag) - y += ky; - else - x += kx; + for (i=1; (i 0) && (polyInts[j-1] > index)) + { + polyInts[j] = polyInts[j-1]; + j--; + } + polyInts[j] = index; + } + + for (i=0; (i < (ints-1)); i += 2) + { + UG_DrawLine(polyInts[i], y, polyInts[i+1], y, color); + } } } - gui->pset(x,y, c); - - + else + { + for (i = 0; (i < n); i++) + { + if (i) + { + ind1 = i - 1; + ind2 = i; + } + else + { + ind1 = n - 1; + ind2 = 0; + } + + UG_DrawLine(p[ind1].x, p[ind1].y, p[ind2].x, p[ind2].y, color); + } + } } + void UG_PutString( UG_S16 x, UG_S16 y, char* str ) { UG_S16 xp,yp; @@ -5069,10 +5435,24 @@ void UG_FontSetVSpace( UG_U16 s ) gui->char_v_space = s; } +#ifdef USE_FONT_VECTOR_CYRILLIC +void UG_GetVectFont(UG_FONT *font, UG_U16 w, UG_U16 h) +{ + font->char_width = w; + font->char_height = h; + font->start_char = 0; + font->end_char = 255; + font->font_type = FONT_TYPE_VECTOR_1BPP; + font->widths = NULL; + font->p = (unsigned char*)&VECT_FONT_CYRILLIC; +} +#endif + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -#ifdef USE_COLOR_16MLN +#ifdef USE_COLOR_RGB888 const UG_COLOR pal_window[] = { /* Frame 0 */ @@ -5169,7 +5549,7 @@ const UG_COLOR pal_checkbox_released[] = }; #endif -#ifdef USE_COLOR_65K +#ifdef USE_COLOR_RGB565 const UG_COLOR pal_window[] = { 0x632C, @@ -5276,6 +5656,7 @@ void _UG_PutChar( char chr, UG_S16 x, UG_S16 y, UG_COLOR fc, UG_COLOR bc, const bt = (UG_U8)chr; + #ifndef USE_FONT_8X12_CYRILLIC switch ( bt ) { case 0xF6: bt = 0x94; break; // ö @@ -5287,7 +5668,8 @@ void _UG_PutChar( char chr, UG_S16 x, UG_S16 y, UG_COLOR fc, UG_COLOR bc, const case 0xB5: bt = 0xE6; break; // µ case 0xB0: bt = 0xF8; break; // ° } - + #endif + if (bt < font->start_char || bt > font->end_char) return; yo = y; @@ -5297,6 +5679,24 @@ void _UG_PutChar( char chr, UG_S16 x, UG_S16 y, UG_COLOR fc, UG_COLOR bc, const if ( font->char_width % 8 ) bn++; actual_char_width = (font->widths ? font->widths[bt - font->start_char] : font->char_width); + #ifdef USE_FONT_VECTOR_CYRILLIC + if (font->font_type == FONT_TYPE_VECTOR_1BPP) // vector font could not use acceleration, + { + UG_VECT_FONT *fnt; + fnt = (UG_VECT_FONT*)font->p; +// if ( gui->driver[DRIVER_DRAW_LINE].state & DRIVER_ENABLED ) + i = 0; + while(fnt->p[bt][i]!=0) + { + UG_DrawLine(x+((((UG_S16)fnt->p[bt][i])-48)*actual_char_width/fnt->char_code_width), + y+((((UG_S16)fnt->p[bt][i+1])-48)*font->char_height/fnt->char_code_height), + x+((((UG_S16)fnt->p[bt][i+2])-48)*actual_char_width/fnt->char_code_width), + y+((((UG_S16)fnt->p[bt][i+3])-48)*font->char_height/fnt->char_code_height), fc); + i += 4; + } + } + else + #endif /* Is hardware acceleration available? */ if ( gui->driver[DRIVER_FILL_AREA].state & DRIVER_ENABLED ) { @@ -5411,9 +5811,7 @@ void _UG_PutText(UG_TEXT* txt) UG_S16 char_height=txt->font->char_height; UG_S16 char_h_space=txt->h_space; UG_S16 char_v_space=txt->v_space; -// UG_U16 i,j,k,xo,yo,cw,bn; -// UG_U8 b,bt; -// UG_U32 index; + char chr; char* str = txt->str; @@ -5887,11 +6285,11 @@ UG_RESULT UG_WindowCreate( UG_WINDOW* wnd, UG_OBJECT* objlst, UG_U8 objcnt, void wnd->objcnt = objcnt; wnd->objlst = objlst; wnd->state = WND_STATE_VALID; - #ifdef USE_COLOR_16MLN + #ifdef USE_COLOR_RGB888 wnd->fc = 0x000000; wnd->bc = 0xF0F0F0; #endif - #ifdef USE_COLOR_65K + #ifdef USE_COLOR_RGB565 wnd->fc = 0x0000; wnd->bc = 0xEF7D; #endif @@ -6636,6 +7034,7 @@ UG_RESULT UG_ButtonCreate( UG_WINDOW* wnd, UG_BUTTON* btn, UG_U8 id, UG_S16 xs, if ( obj == NULL ) return UG_RESULT_FAIL; /* Initialize object-specific parameters */ + btn->obj = obj; btn->state = BTN_STATE_RELEASED; btn->bc = wnd->bc; btn->fc = wnd->fc; @@ -7174,6 +7573,7 @@ UG_RESULT UG_CheckboxCreate( UG_WINDOW* wnd, UG_CHECKBOX* chb, UG_U8 id, UG_S16 if ( obj == NULL ) return UG_RESULT_FAIL; /* Initialize object-specific parameters */ + chb->obj = obj; chb->state = CHB_STATE_RELEASED; chb->bc = wnd->bc; chb->fc = wnd->fc; @@ -7775,6 +8175,7 @@ UG_RESULT UG_TextboxCreate( UG_WINDOW* wnd, UG_TEXTBOX* txb, UG_U8 id, UG_S16 xs if ( obj == NULL ) return UG_RESULT_FAIL; /* Initialize object-specific parameters */ + txb->obj = obj; txb->str = NULL; if (gui != NULL) txb->font = &gui->font; else txb->font = NULL; @@ -8126,6 +8527,7 @@ UG_RESULT UG_ImageCreate( UG_WINDOW* wnd, UG_IMAGE* img, UG_U8 id, UG_S16 xs, UG if ( obj == NULL ) return UG_RESULT_FAIL; /* Initialize object-specific parameters */ + img->obj = obj; img->img = NULL; img->type = IMG_TYPE_BMP; diff --git a/ugui.h b/ugui.h index 13c0925..47c972d 100644 --- a/ugui.h +++ b/ugui.h @@ -17,11 +17,10 @@ #ifndef __UGUI_H #define __UGUI_H -//#include "system.h" #include "stm32f10x.h" +//#include "system.h" #include "ugui_config.h" - /* -------------------------------------------------------------------------------- */ /* -- µGUI FONTS -- */ /* -- Source: http://www.mikrocontroller.net/user/show/benedikt -- */ @@ -29,9 +28,19 @@ typedef enum { FONT_TYPE_1BPP, - FONT_TYPE_8BPP + FONT_TYPE_8BPP, + FONT_TYPE_VECTOR_1BPP } FONT_TYPE; +#ifdef USE_FONT_VECTOR_CYRILLIC +typedef struct +{ + const char *p[256]; + UG_S16 char_code_width; + UG_S16 char_code_height; +} UG_VECT_FONT; +#endif + typedef struct { unsigned char* p; @@ -67,7 +76,7 @@ typedef struct #ifdef USE_FONT_8X12 extern const UG_FONT FONT_8X12; #endif -#ifdef USE_FONT_8X12rus +#ifdef USE_FONT_8X12_CYRILLIC extern const UG_FONT FONT_8X12; #endif #ifdef USE_FONT_8X14 @@ -101,10 +110,10 @@ typedef struct typedef struct S_OBJECT UG_OBJECT; typedef struct S_WINDOW UG_WINDOW; typedef UG_S8 UG_RESULT; -#ifdef USE_COLOR_16MLN +#ifdef USE_COLOR_RGB888 typedef UG_U32 UG_COLOR; #endif -#ifdef USE_COLOR_65K +#ifdef USE_COLOR_RGB565 typedef UG_U16 UG_COLOR; #endif /* -------------------------------------------------------------------------------- */ @@ -354,6 +363,7 @@ struct S_WINDOW /* Button structure */ typedef struct { + UG_OBJECT* obj; // to get quick accsess to self system Object from user defined components UG_U8 state; UG_U8 style; UG_COLOR fc; @@ -406,11 +416,12 @@ typedef struct #define BTN_EVENT_CLICKED OBJ_EVENT_CLICKED /* -------------------------------------------------------------------------------- */ -/* -- CHECKBOX OBJECT -- */ +/* -- CHECKBOX OBJECT -- */ /* -------------------------------------------------------------------------------- */ /* Checkbox structure */ typedef struct { + UG_OBJECT* obj; UG_U8 state; UG_U8 style; UG_COLOR fc; @@ -470,6 +481,7 @@ typedef struct /* Textbox structure */ typedef struct { + UG_OBJECT* obj; char* str; const UG_FONT* font; UG_U8 style; @@ -508,6 +520,7 @@ typedef struct /* Image structure */ typedef struct { + UG_OBJECT* obj; void* img; UG_U8 type; } UG_IMAGE; @@ -594,7 +607,7 @@ typedef struct /* -- µGUI COLORS -- */ /* -- Source: http://www.rapidtables.com/web/color/RGB_Color.htm -- */ /* -------------------------------------------------------------------------------- */ -#ifdef USE_COLOR_65K +#ifdef USE_COLOR_RGB565 #define C_MAROON 0x8000 #define C_DARK_RED 0x8800 #define C_BROWN 0xA145 @@ -736,7 +749,7 @@ typedef struct #define C_WHITE 0xFFFF #endif -#ifdef USE_COLOR_16MLN +#ifdef USE_COLOR_RGB888 #define C_MAROON 0x800000 #define C_DARK_RED 0x8B0000 #define C_BROWN 0xA52A2A @@ -896,6 +909,7 @@ void UG_DrawCircle( UG_S16 x0, UG_S16 y0, UG_S16 r, UG_COLOR c ); void UG_FillCircle( UG_S16 x0, UG_S16 y0, UG_S16 r, UG_COLOR c ); void UG_DrawArc( UG_S16 x0, UG_S16 y0, UG_S16 r, UG_U8 s, UG_COLOR c ); void UG_DrawLine( UG_S16 x1, UG_S16 y1, UG_S16 x2, UG_S16 y2, UG_COLOR c ); +void UG_FillPoly(UG_PointPtr p, UG_U8 n, UG_U8 filled, UG_COLOR color); void UG_PutString( UG_S16 x, UG_S16 y, char* str ); void UG_PutChar( char chr, UG_S16 x, UG_S16 y, UG_COLOR fc, UG_COLOR bc ); void UG_ConsolePutString( char* str ); @@ -908,6 +922,7 @@ UG_S16 UG_GetXDim( void ); UG_S16 UG_GetYDim( void ); void UG_FontSetHSpace( UG_U16 s ); void UG_FontSetVSpace( UG_U16 s ); +void UG_GetVectFont(UG_FONT *font, UG_U16 w, UG_U16 h); /* Miscellaneous functions */ void UG_WaitForUpdate( void ); @@ -1021,7 +1036,6 @@ UG_S8 UG_CheckboxGetHSpace( UG_WINDOW* wnd, UG_U8 id ); UG_S8 UG_CheckboxGetVSpace( UG_WINDOW* wnd, UG_U8 id ); UG_U8 UG_CheckboxGetAlignment( UG_WINDOW* wnd, UG_U8 id ); - /* Textbox functions */ UG_RESULT UG_TextboxCreate( UG_WINDOW* wnd, UG_TEXTBOX* txb, UG_U8 id, UG_S16 xs, UG_S16 ys, UG_S16 xe, UG_S16 ye ); UG_RESULT UG_TextboxDelete( UG_WINDOW* wnd, UG_U8 id ); diff --git a/ugui_config.h b/ugui_config.h index d65c35f..69be4f4 100644 --- a/ugui_config.h +++ b/ugui_config.h @@ -1,5 +1,4 @@ #include "stm32f10x.h" - #ifndef __UGUI_CONFIG_H #define __UGUI_CONFIG_H @@ -10,8 +9,8 @@ //#define USE_MULTITASKING /* Enable color mode */ -//# define USE_COLOR_16MLN // RGB = 0xFF,0xFF,0xFF -# define USE_COLOR_65K // RGB = 0bRRRRRGGGGGGBBBBB +//#define USE_COLOR_RGB888 // RGB = 0xFF,0xFF,0xFF +#define USE_COLOR_RGB565 // RGB = 0bRRRRRGGGGGGBBBBB /* Enable needed fonts here */ //#define USE_FONT_4X6 @@ -21,7 +20,7 @@ //#define USE_FONT_6X10 //#define USE_FONT_7X12 //#define USE_FONT_8X8 -#define USE_FONT_8X12rus +#define USE_FONT_8X12_CYRILLIC //#define USE_FONT_8X12 //#define USE_FONT_8X12 //#define USE_FONT_8X14 @@ -32,6 +31,7 @@ //#define USE_FONT_22X36 //#define USE_FONT_24X40 //#define USE_FONT_32X53 +#define USE_FONT_VECTOR_CYRILLIC /* Specify platform-dependent integer types here */ @@ -43,6 +43,9 @@ typedef int16_t UG_S16; typedef uint32_t UG_U32; typedef int32_t UG_S32; +typedef struct { + UG_S16 x, y; +} UG_Point, *UG_PointPtr; /* Example for dsPIC33 typedef unsigned char UG_U8; @@ -61,5 +64,6 @@ typedef signed long int UG_S32; #define USE_PRERENDER_EVENT #define USE_POSTRENDER_EVENT +#define UG_MaxPolyPointNum 20 #endif