From 7baf5c5d448b626d6a062882434b25ca82212d94 Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 6 Jun 2013 14:33:32 +1000 Subject: [PATCH 01/38] New simplified gwin using a pseudo class structure. --- demos/modules/gwin/widgets/gfxconf.h | 65 ++++ demos/modules/gwin/widgets/main.c | 141 +++++++ demos/modules/gwin/widgets/readme.txt | 6 + include/gwin/button.h | 240 ++++-------- include/gwin/checkbox.h | 135 +++---- include/gwin/class_gwin.h | 123 ++++++ include/gwin/console.h | 33 +- include/gwin/graph.h | 23 +- include/gwin/gwidget.h | 234 ++++++++++++ include/gwin/gwin.h | 119 +++--- include/gwin/internal.h | 41 -- include/gwin/slider.h | 150 ++------ src/gwin/button.c | 529 +++++++++++--------------- src/gwin/checkbox.c | 225 +++++------ src/gwin/console.c | 55 +-- src/gwin/graph.c | 72 ++-- src/gwin/gwidget.c | 254 +++++++++++++ src/gwin/gwin.c | 110 ++---- src/gwin/gwin.mk | 3 +- src/gwin/slider.c | 412 ++++++++++---------- 20 files changed, 1651 insertions(+), 1319 deletions(-) create mode 100644 demos/modules/gwin/widgets/gfxconf.h create mode 100644 demos/modules/gwin/widgets/main.c create mode 100644 demos/modules/gwin/widgets/readme.txt create mode 100644 include/gwin/class_gwin.h create mode 100644 include/gwin/gwidget.h delete mode 100644 include/gwin/internal.h create mode 100644 src/gwin/gwidget.c diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h new file mode 100644 index 00000000..b4574149 --- /dev/null +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -0,0 +1,65 @@ +/* + * This file has a different license to the rest of the GFX system. + * You can copy, modify and distribute this file as you see fit. + * You do not need to publish your source modifications to this file. + * The only thing you are not permitted to do is to relicense it + * under a different license. + */ + +#ifndef _GFXCONF_H +#define _GFXCONF_H + +#define GFX_USE_OS_CHIBIOS TRUE +//#define GFX_USE_OS_WIN32 TRUE +//#define GFX_USE_OS_POSIX TRUE + +/* GFX sub-systems to turn on */ +#define GFX_USE_GDISP TRUE +#define GFX_USE_GWIN TRUE +#define GFX_USE_GEVENT TRUE +#define GFX_USE_GTIMER TRUE +#define GFX_USE_GINPUT TRUE + +/* Features for the GDISP sub-system. */ +#define GDISP_NEED_VALIDATION TRUE +#define GDISP_NEED_CLIP TRUE +#define GDISP_NEED_TEXT TRUE +#define GDISP_NEED_CIRCLE TRUE +#define GDISP_NEED_ELLIPSE TRUE +#define GDISP_NEED_ARC TRUE +#define GDISP_NEED_CONVEX_POLYGON TRUE +#define GDISP_NEED_SCROLL FALSE +#define GDISP_NEED_PIXELREAD FALSE +#define GDISP_NEED_CONTROL FALSE +#define GDISP_NEED_IMAGE TRUE +#define GDISP_NEED_MULTITHREAD TRUE +#define GDISP_NEED_ASYNC FALSE +#define GDISP_NEED_MSGAPI FALSE + +/* Builtin Fonts */ +#define GDISP_INCLUDE_FONT_SMALL FALSE +#define GDISP_INCLUDE_FONT_LARGER FALSE +#define GDISP_INCLUDE_FONT_UI1 FALSE +#define GDISP_INCLUDE_FONT_UI2 TRUE +#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE + +/* GDISP image decoders */ +#define GDISP_NEED_IMAGE_NATIVE FALSE +#define GDISP_NEED_IMAGE_GIF TRUE +#define GDISP_NEED_IMAGE_BMP FALSE +#define GDISP_NEED_IMAGE_JPG FALSE +#define GDISP_NEED_IMAGE_PNG FALSE + +/* Features for the GWIN sub-system. */ +#define GWIN_NEED_CONSOLE TRUE +#define GWIN_NEED_GRAPH FALSE +#define GWIN_NEED_BUTTON TRUE +#define GWIN_NEED_SLIDER TRUE +#define GWIN_NEED_CHECKBOX TRUE + +/* Features for the GINPUT sub-system. */ +#define GINPUT_NEED_MOUSE TRUE +#define GINPUT_NEED_TOGGLE FALSE +#define GINPUT_NEED_DIAL FALSE + +#endif /* _GFXCONF_H */ diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c new file mode 100644 index 00000000..7845ba69 --- /dev/null +++ b/demos/modules/gwin/widgets/main.c @@ -0,0 +1,141 @@ +/* + ChibiOS/GFX - Copyright (C) 2012, 2013 + Joel Bodenmann aka Tectu + + This file is part of ChibiOS/GFX. + + ChibiOS/GFX is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + ChibiOS/GFX is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . +*/ + +#include "gfx.h" + +static GListener gl; +static GHandle ghConsole; +static GHandle ghButton1, ghButton2, ghButton3, ghButton4; +static GHandle ghSlider1, ghSlider2, ghSlider3, ghSlider4; +static GHandle ghCheckbox1, ghCheckbox2; + +#define ScrWidth gdispGetWidth() +#define ScrHeight gdispGetHeight() + +#define BUTTON_WIDTH 50 +#define BUTTON_HEIGHT 30 +#define SLIDER_WIDTH 10 +#define CHECKBOX_WIDTH 80 +#define CHECKBOX_HEIGHT 20 + +int main(void) { + GEvent * pe; + + // Initialize the display + gfxInit(); + gdispClear(White); + + // Set the font + gwinSetDefaultFont(gdispOpenFont("UI2")); + + // Create out gwin windows/widgets + ghButton1 = gwinCreateButton(NULL, 0+0*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); + ghButton2 = gwinCreateButton(NULL, 0+1*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); + ghButton3 = gwinCreateButton(NULL, 0+2*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); + ghButton4 = gwinCreateButton(NULL, 0+3*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); + ghConsole = gwinCreateConsole(NULL, ScrWidth/2+1, ScrHeight/2+1, ScrWidth/2-1, ScrHeight/2-1); + ghSlider1 = gwinCreateSlider(NULL, ScrWidth/2+1, ScrHeight/2-2*(SLIDER_WIDTH+1), ScrWidth/2-2, SLIDER_WIDTH); + ghSlider2 = gwinCreateSlider(NULL, ScrWidth/2+1, ScrHeight/2-1*(SLIDER_WIDTH+1), ScrWidth/2-2, SLIDER_WIDTH); + ghSlider3 = gwinCreateSlider(NULL, 0+1*(SLIDER_WIDTH+1), ScrHeight/2+1, SLIDER_WIDTH, ScrHeight/2-2); + ghSlider4 = gwinCreateSlider(NULL, 0+1*(SLIDER_WIDTH+1), ScrHeight/2+1, SLIDER_WIDTH, ScrHeight/2-2); + ghCheckbox1 = gwinCreateCheckbox(NULL, 0, BUTTON_HEIGHT+1, CHECKBOX_WIDTH, CHECKBOX_HEIGHT); + ghCheckbox2 = gwinCreateCheckbox(NULL, 0, BUTTON_HEIGHT+1+1*(CHECKBOX_HEIGHT+1), CHECKBOX_WIDTH, CHECKBOX_HEIGHT); + + // Color everything + gwinSetColor(ghConsole, Yellow); + gwinSetBgColor(ghConsole, Black); + + // Set the text on all the controls + gwinSetText(ghButton1, "B1", FALSE); + gwinSetText(ghButton2, "B2", FALSE); + gwinSetText(ghButton3, "B3", FALSE); + gwinSetText(ghButton4, "B4", FALSE); + gwinSetText(ghSlider1, "S1", FALSE); + gwinSetText(ghSlider2, "S2", FALSE); + gwinSetText(ghSlider3, "S3", FALSE); + gwinSetText(ghSlider4, "S4", FALSE); + gwinSetText(ghCheckbox1, "C1", FALSE); + gwinSetText(ghCheckbox2, "C2", FALSE); + + // Assign the mouse and dials to the buttons & sliders etc. +#if GINPUT_NEED_MOUSE + gwinAttachMouse(ghSlider1, 0); + gwinAttachMouse(ghSlider2, 0); + gwinAttachMouse(ghSlider3, 0); + gwinAttachMouse(ghSlider4, 0); + gwinAttachMouse(ghButton1, 0); + gwinAttachMouse(ghButton2, 0); + gwinAttachMouse(ghButton3, 0); + gwinAttachMouse(ghButton4, 0); + gwinAttachMouse(ghCheckbox1, 0); + gwinAttachMouse(ghCheckbox2, 0); +#endif +#if GINPUT_NEED_DIAL + gwinAttachSliderDial(ghSlider1, 0); + gwinAttachSliderDial(ghSlider3, 1); +#endif + + // We want to listen for widget events + geventListenerInit(&gl); + gwinAttachListener(ghSlider1, &gl, 0); + gwinAttachListener(ghSlider2, &gl, 0); + gwinAttachListener(ghSlider3, &gl, 0); + gwinAttachListener(ghSlider4, &gl, 0); + gwinAttachListener(ghButton1, &gl, 0); + gwinAttachListener(ghButton2, &gl, 0); + gwinAttachListener(ghButton3, &gl, 0); + gwinAttachListener(ghButton4, &gl, 0); + gwinAttachListener(ghCheckbox1, &gl, 0); + gwinAttachListener(ghCheckbox2, &gl, 0); + + // Draw everything on the screen + gwinClear(ghConsole); + gwinDraw(ghSlider1); + gwinDraw(ghSlider2); + gwinDraw(ghSlider3); + gwinDraw(ghSlider4); + gwinDraw(ghButton1); + gwinDraw(ghButton2); + gwinDraw(ghButton3); + gwinDraw(ghButton4); + gwinDraw(ghCheckbox1); + gwinDraw(ghCheckbox2); + + while(1) { + // Get an Event + pe = geventEventWait(&gl, TIME_INFINITE); + + switch(pe->type) { + case GEVENT_GWIN_BUTTON: + gwinPrintf(ghConsole, "Button %s\n", gwinGetText(((GEventGWinButton *)pe)->button)); + break; + case GEVENT_GWIN_SLIDER: + gwinPrintf(ghConsole, "Slider %s=%d\n", gwinGetText(((GEventGWinSlider *)pe)->slider), ((GEventGWinSlider *)pe)->position); + break; + case GEVENT_GWIN_CHECKBOX: + gwinPrintf(ghConsole, "Checkbox %s=%s\n", gwinGetText(((GEventGWinCheckbox *)pe)->checkbox), ((GEventGWinCheckbox *)pe)->isChecked ? "Checked" : "UnChecked"); + break; + default: + gwinPrintf(ghConsole, "Unknown %d\n", pe->type); + break; + } + } + return 0; +} diff --git a/demos/modules/gwin/widgets/readme.txt b/demos/modules/gwin/widgets/readme.txt new file mode 100644 index 00000000..02d733e9 --- /dev/null +++ b/demos/modules/gwin/widgets/readme.txt @@ -0,0 +1,6 @@ +This demo supports input from both a mouse/touch and/or a dial input. +If your platform does not support one or the other, turn it off in +gfxconf.h + +Note that you will need to include the drivers into your project +makefile for whichever inputs you decide to use. diff --git a/include/gwin/button.h b/include/gwin/button.h index ed74a80d..1b0ff36b 100644 --- a/include/gwin/button.h +++ b/include/gwin/button.h @@ -24,240 +24,132 @@ #ifndef _GWIN_BUTTON_H #define _GWIN_BUTTON_H -#if GWIN_NEED_BUTTON || defined(__DOXYGEN__) +/* This file is included within "gwin/gwidget.h" */ -/*===========================================================================*/ -/* Driver constants. */ -/*===========================================================================*/ - -#define GW_BUTTON 0x0002 +/** + * @brief The Event Type for a Button Event + */ #define GEVENT_GWIN_BUTTON (GEVENT_GWIN_FIRST+0) -/*===========================================================================*/ -/* Type definitions */ -/*===========================================================================*/ - -typedef struct GEventGWinButton_t { +/** + * @brief A Button Event + * @note There are currently no GEventGWinButton listening flags - use 0 as the flags to @p gwinAttachListener() + */ +typedef struct GEventGWinButton { GEventType type; // The type of this event (GEVENT_GWIN_BUTTON) GHandle button; // The button that has been depressed (actually triggered on release) } GEventGWinButton; -// There are currently no GEventGWinButton listening flags - use 0 - -typedef enum GButtonShape_e { - GBTN_3D, GBTN_SQUARE, GBTN_ROUNDED, GBTN_ELLIPSE, GBTN_CUSTOM, - GBTN_ARROW_UP, GBTN_ARROW_DOWN, GBTN_ARROW_LEFT, GBTN_ARROW_RIGHT, -} GButtonShape; - -typedef struct GButtonDrawStyle_t { +/** + * @brief Button colors + */ +typedef struct GButtonColors { color_t color_edge; color_t color_fill; color_t color_txt; -} GButtonDrawStyle; +} GButtonColors; -typedef enum GButtonType_e { - GBTN_NORMAL, GBTN_TOGGLE -} GButtonType; - -typedef enum GButtonState_e { - GBTN_UP, GBTN_DOWN -} GButtonState; - -typedef void (*GButtonDrawFunction)(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param); - -// A button window +/** + * @brief The button widget structure + * @note Do not use the members directly - treat it as a black-box. + */ typedef struct GButtonObject_t { - GWindowObject gwin; - - GButtonDrawStyle up; - GButtonDrawStyle dn; - GButtonState state; - GButtonType type; - const char *txt; - GButtonDrawFunction fn; - void *param; - GListener listener; + GWidgetObject w; + GButtonColors c_up; + GButtonColors c_dn; + GButtonColors c_dis; } GButtonObject; -/*===========================================================================*/ -/* External declarations. */ -/*===========================================================================*/ - #ifdef __cplusplus extern "C" { #endif /** - * @brief Create a button window. + * @brief Create a button widget. * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] gb The GButtonObject structure to initialise. If this is NULL the structure is dynamically allocated. - * @param[in] x,y The screen co-ordinates for the bottom left corner of the window + * @param[in] x,y The screen co-ordinates for the top left corner of the window * @param[in] width The width of the window * @param[in] height The height of the window - * @param[in] font The font to use - * @param[in] type The type of button + * * @note The drawing color gets set to White and the background drawing color to Black. + * @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont() * @note The dimensions and position may be changed to fit on the real screen. - * @note The button is not automatically drawn. Call gwinButtonDraw() after changing the button style or setting the text. + * @note The button is not automatically drawn. Call gwinDraw() to draw it. * * @api */ -GHandle gwinCreateButton(GButtonObject *gb, coord_t x, coord_t y, coord_t width, coord_t height, font_t font, GButtonType type); +GHandle gwinCreateButton(GButtonObject *gb, coord_t x, coord_t y, coord_t width, coord_t height); /** - * @brief Set the style of a button. - * @details The button style is defined by its shape and colours. + * @brief Set the colors of a button. * - * @param[in] gh The window handle (must be a button window) - * @param[in] shape The shape of the button. - * @param[in] pUp The styling for the button when in the up state. - * @param[in] pDown The styling for the button when in the down state. + * @param[in] gh The window handle (must be a button widget) + * @param[in] pUp The colors for the button when in the up state. + * @param[in] pDown The colors for the button when in the down state. + * @param[in] pDisabled The colors for the button when it is disabled. * * @note The button is not automatically redrawn. Call gwinButtonDraw() after changing the button style * @note The button style is copied into the internal button structure - there is no need to - * maintain a static style structures. - * @note The pUp and pDown parameters can be NULL. If they are then the existing color styles + * maintain static style structures (they can be temporary structures on the stack). + * @note The pUp, pDown and pDisabled parameters can be NULL. If they are then the existing color styles * are not changed for that button state. + * @note Some custom drawn buttons will ignore he specified colors * * @api */ -void gwinSetButtonStyle(GHandle gh, GButtonShape shape, const GButtonDrawStyle *pUp, const GButtonDrawStyle *pDown); +void gwinSetButtonColors(GHandle gh, const GButtonColors *pUp, const GButtonColors *pDown, const GButtonColors *pDisabled); /** - * @brief Set the text of a button. + * @brief Is the button current pressed + * @return TRUE if the button is depressed * - * @param[in] gh The window handle (must be a button window) - * @param[in] txt The button text to set. This must be a constant string unless useAlloc is set. - * @param[in] useAlloc If TRUE the string specified will be copied into dynamically allocated memory. - * @note The button is not automatically redrawn. Call gwinButtonDraw() after changing the button text. + * @param[in] gh The window handle (must be a button widget) * * @api */ -void gwinSetButtonText(GHandle gh, const char *txt, bool_t useAlloc); +bool_t gwinIsButtonPressed(GHandle gh); /** - * @brief Redraw the button. + * @brief Some custom button drawing routines + * @details These function may be passed to @p gwinSetCustomDraw() to get different button drawing styles * - * @param[in] gh The window handle (must be a button window) - * - * @api - */ -void gwinButtonDraw(GHandle gh); - -/** - * @brief Enable or disable a button - * - * @param[in] gh The window handle (must be a button window) - * @param[in] enabled Enable or disable the button - * - * @api - */ -void gwinButtonSetEnabled(GHandle gh, bool_t enabled); - -/** - * @brief Set the callback routine to perform a custom button drawing. - * - * @param[in] gh The window handle (must be a button window) - * @param[in] fn The function to use to draw the button - * @param[in] param A parameter to pass to the button drawing function - * - * @api - */ -void gwinSetButtonCustom(GHandle gh, GButtonDrawFunction fn, void *param); - -/** - * @brief Enable a button - * - * @api - */ -#define gwinEnableButton(gh) gwinButtonSetEnabled( ((GButtonObject *)(gh)), TRUE) - -/** - * @brief Disable a button - * - * @api - */ -#define gwinDisableButton(gh) gwinButtonSetEnabled( ((GButtonObject *)(gh)), FALSE) - -/** - * @brief Get the state of a button - * - * @param[in] gh The window handle (must be a button window) - * - * @api - */ -#define gwinGetButtonState(gh) (((GButtonObject *)(gh))->state) - -/** - * @brief Get the source handle of a button - * @details Get the source handle of a button so the application can listen for events - * - * @param[in] gh The window handle - * - * @api - */ -#define gwinGetButtonSource(gh) ((GSourceHandle)(gh)) - -#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - /** - * @brief Attach a mouse to a button - * - * @param[in] gh The button handle - * @param[in] instance The mouse instance - * - * @api - */ - bool_t gwinAttachButtonMouse(GHandle gh, uint16_t instance); -#endif - -#if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE - /** - * @brief Attach a toggle to a button - * - * @param[in] gh The button handle - * @param[in] instance The toggle instance - * - * @api - */ - bool_t gwinAttachButtonToggle(GHandle gh, uint16_t instance); -#endif - -/** - * @brief Standard button drawing routines - * @details These routines are called to draw the standard button styles. - * - * @param[in] gh The button handle - * @param[in] enabled Is the button currently enabled or disabled - * @param[in] isdown Is the button currently down (depressed) - * @param[in] txt The text to be display inside the button - * @param[in] pstyle The current drawing style for the state we are in + * @param[in] gw The widget object (in this case a button) * @param[in] param A parameter passed in from the user * * @note In your custom button drawing function you may optionally call these * standard functions and then draw your extra details on top. - * @note The standard functions below ignore the param parameter. It is there - * only to ensure the functions match the GButtonDrawFunction type. - * @note When called by a button press/release the framework ensure that it is - * a button object and sets up clipping to the button object window. These - * drawing routines then don't have to worry about explicitly doing that. + * @note The standard functions below ignore the param parameter except for @p gwinButtonDraw_Image(). + * @note The image custom draw function @p gwinButtonDraw_Image() uses param to pass in the gdispImage pointer. + * The image must be already opened before calling @p gwinSetCustomDraw(). The image should be 3 + * times the height of the button. The button image is repeated 3 times vertically, the first (top) for + * the "up" image, the 2nd for the "down" image, and the third (bottom) image for the disabled state. If + * the disabled state is never going to be used then the image can be just 2 times the button height. + * No checking is done to compare the size of the button to the size of the image. + * Note text is drawn on top of the image. + * @note These custom drawing routines don't have to worry about setting clipping as the framework + * sets clipping to the object window prior to calling these routines. * * @api * @{ */ -void gwinButtonDraw_3D(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param); -void gwinButtonDraw_Square(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param); +void gwinButtonDraw_3D(GWidgetObject *gw, void *param); // @< A standard 3D button +void gwinButtonDraw_Box(GWidgetObject *gw, void *param); // @< A very simple box style button #if GDISP_NEED_ARC || defined(__DOXYGEN__) - void gwinButtonDraw_Rounded(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param); + void gwinButtonDraw_Rounded(GWidgetObject *gw, void *param); // @< A rounded rectangle button #endif #if GDISP_NEED_ELLIPSE || defined(__DOXYGEN__) - void gwinButtonDraw_Ellipse(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param); + void gwinButtonDraw_Ellipse(GWidgetObject *gw, void *param); // @< A circular button #endif #if GDISP_NEED_CONVEX_POLYGON || defined(__DOXYGEN__) - void gwinButtonDraw_ArrowUp(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param); - void gwinButtonDraw_ArrowDown(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param); - void gwinButtonDraw_ArrowLeft(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param); - void gwinButtonDraw_ArrowRight(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param); + void gwinButtonDraw_ArrowUp(GWidgetObject *gw, void *param); // @< An up arrow button + void gwinButtonDraw_ArrowDown(GWidgetObject *gw, void *param); // @< A down arrow button + void gwinButtonDraw_ArrowLeft(GWidgetObject *gw, void *param); // @< A left arrow button + void gwinButtonDraw_ArrowRight(GWidgetObject *gw, void *param); // @< A right arrow button +#endif +#if GDISP_NEED_IMAGE || defined(__DOXYGEN__) + void gwinButtonDraw_Image(GWidgetObject *gw, void *param); // @< An image button - see the notes above on the param. #endif /** @} */ @@ -265,8 +157,6 @@ void gwinButtonDraw_Square(GHandle gh, bool_t enabled, bool_t isdown, const char } #endif -#endif /* GWIN_NEED_BUTTON */ - #endif /* _GWIN_BUTTON_H */ /** @} */ diff --git a/include/gwin/checkbox.h b/include/gwin/checkbox.h index 1bbdc89b..de49fa01 100644 --- a/include/gwin/checkbox.h +++ b/include/gwin/checkbox.h @@ -12,7 +12,7 @@ * @defgroup Checkbox Checkbox * @ingroup GWIN * - * @details GWIN allows it to easily create checkboxes. + * @details GWIN allows it to easily create a group of checkbox buttons. * * @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h * @pre GWIN_NEED_CHECKBOX must be set to TRUE in your gfxconf.h @@ -22,13 +22,12 @@ #ifndef _GWIN_CHECKBOX_H #define _GWIN_CHECKBOX_H -#if GWIN_NEED_CHECKBOX || defined(__DOXYGEN__) +/* This file is included within "gwin/gwidget.h" */ /*===========================================================================*/ /* Driver constants. */ /*===========================================================================*/ -#define GW_CHECKBOX 0x0005 #define GEVENT_GWIN_CHECKBOX (GEVENT_GWIN_FIRST+2) /*===========================================================================*/ @@ -41,124 +40,76 @@ typedef struct GEventGWinCheckbox_t { bool_t isChecked; // Is the checkbox currently checked or unchecked? } GEventGWinCheckbox; -typedef enum GCheckboxState_e { - GCHBX_UNCHECKED, GCHBX_CHECKED -} GCheckboxState; - -typedef struct GCheckboxColor_t { - color_t border; - color_t checked; - color_t bg; -} GCheckboxColor; - -/* custom rendering interface */ -typedef void (*GCheckboxDrawFunction)(GHandle gh, bool_t enabled, bool_t state, void* param); +typedef struct GCheckboxColors { + color_t color_border; + color_t color_checked; + color_t color_bg; + color_t color_txt; +} GCheckboxColors; /* A Checkbox window */ typedef struct GCheckboxObject_t { - GWindowObject gwin; - GListener listener; - - GCheckboxDrawFunction fn; - GCheckboxColor *colors; - bool_t isChecked; - void *param; + GWidgetObject w; + GCheckboxColors c; } GCheckboxObject; /** - * @brief Create a checkbox window. + * @brief Create a checkbox window. + * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] gb The GCheckboxObject structure to initialise. If this is NULL, the structure is dynamically allocated. - * @param[in] x,y The screen co-ordinates for the bottom left corner of the window + * @param[in] x,y The screen co-ordinates for the top left corner of the window * @param[in] width The width of the window * @param[in] height The height of the window * - * @note The checkbox is not automatically drawn. Call gwinCheckboxDraw() after changing the checkbox style. - * - * @return NULL if there is no resultant drawing area, otherwise a window handle. + * @note The drawing color gets set to White and the background drawing color to Black. + * @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont() + * @note The dimensions and position may be changed to fit on the real screen. + * @note The checkbox is not automatically drawn. Call gwinDraw() to draw it. * * @api */ -GHandle gwinCheckboxCreate(GCheckboxObject *gb, coord_t x, coord_t y, coord_t width, coord_t height); - -/** - * @brief Redraw a checkbox - * - * @param[in] gh The window handle (must be a checkbox window) - * - * @api - */ -void gwinCheckboxDraw(GHandle gh); - -/** - * @brief Enable or disable a button - * - * @param[in] gh The window handle (must be a checkbox window) - * @param[in] enabled Enable or disable the button - * - * @api - */ -void gwinCheckboxSetEnabled(GHandle gh, bool_t enabled); - -/** - * @brief Set the callback routine to perform a custom drawing. - * - * @param[in] gh The window handle (must be a checkbox window) - * @param[in] fn The function to use to draw the checkbox - * @param[in] param A parameter to pass to the checkbox drawing function - * - * @api - */ -void gwinCheckboxSetCustom(GHandle gh, GCheckboxDrawFunction fn, void *param); - -/** - * @brief Enable a checkbox - * - * @api - */ -#define gwinCheckboxEnable(gh) gwinCheckboxSetEnabled( ((GCheckboxObject *)(gh)), TRUE) - -/** - * @brief Disable a checkbox - * - * @api -*/ -#define gwinCheckboxDisable(gh) gwinCheckboxSetEnabled( ((GCheckboxObject *)(gh)), FALSE) +GHandle gwinCreateCheckbox(GCheckboxObject *gb, coord_t x, coord_t y, coord_t width, coord_t height); /** * @brief Get the state of a checkbox + * @return TRUE if the checkbox is currently checked * * @param[in] gh The window handle (must be a checkbox window) * - * @return The state of the checkbox (GCHBX_CHECKED or GCHBX_UNCHECKED) - * * @api */ -#define gwinCheckboxGetState(gh) (((GCheckboxObject *)(gh))->isChecked) +bool_t gwinIsCheckboxChecked(GHandle gh); /** - * @brief Get the source handle of a checkbox - * @details Get the source handle of a checkbox so the application can listen for events + * @brief Set the colors used to draw the checkbox * - * @param[in] gh The window handle (must be a checkbox window) + * @param[in] gh The window handle (must be a checkbox window) + * @param[in] pColors The colors to use * * @api */ -#define gwinCheckboxGetSource(gh) ((GSourceHandle)(gh)) +void gwinCheckboxSetColors(GHandle gh, GCheckboxColors *pColors); -#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - /** - * @brief Attach a mouse to a checkbox - * - * @param[in] gh The checkbox handle - * @param[in] instance The mouse instance - * - * @api - */ - bool_t gwinCheckboxAttachMouse(GHandle gh, uint16_t instance); -#endif /* GFX_USE_GINPUT && GINPUT_NEED_MOUSE */ - -#endif /* _GWIN_NEED_CHECKBOX */ +/** + * @brief Some custom checkbox drawing routines + * @details These function may be passed to @p gwinSetCustomDraw() to get different checkbox drawing styles + * + * @param[in] gw The widget (which must be a checkbox) + * @param[in] param A parameter passed in from the user + * + * @note In your custom checkbox drawing function you may optionally call this + * standard functions and then draw your extra details on top. + * @note The standard functions below ignore the param parameter. + * @note These custom drawing routines don't have to worry about setting clipping as the framework + * sets clipping to the object window prior to calling these routines. + * + * @api + * @{ + */ +void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param); +void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param); +/* @} */ #endif /* _GWIN_CHECKBOX_H */ /** @} */ diff --git a/include/gwin/class_gwin.h b/include/gwin/class_gwin.h new file mode 100644 index 00000000..b7d8c5a8 --- /dev/null +++ b/include/gwin/class_gwin.h @@ -0,0 +1,123 @@ +/* + * This file is subject to the terms of the GFX License, v1.0. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ + +/** + * @file include/gwin/class_gwin.h + * @brief GWIN Graphic window subsystem header file. + * + * @defgroup Internal Internal + * @ingroup GWIN + * + * @note These definitions are normally not used by an application program. They are useful + * only if you want to create your own custom GWIN window or widget. + * @note To access these definitions you must include "gwin/class_gwin.h" in your source file. + * + * @{ + */ +#ifndef _CLASS_GWIN_H +#define _CLASS_GWIN_H + +#if GFX_USE_GWIN || defined(__DOXYGEN__) + +/** + * @brief The Virtual Method Table for a GWIN window + * @{ + */ +typedef struct gwinVMT { + const char *classname; // @< The GWIN classname + void (*Destroy)(GWindowObject *gh); // @< The GWIN Destroy function (optional) + void (*AfterClear)(GWindowObject *gh); // @< The GWIN After-Clear function (optional) +} gwinVMT; +/* @} */ + +/** + * @brief The Virtual Method Table for a widget + * @note A widget must have a destroy function. Either use @p _gwidgetDestroy() or use your own function + * which internally calls @p _gwidgetDestroy(). + * @note If no MouseDown(), MouseUp() or MouseMove() function is provided, the widget will not accept being attached to a mouse input source. + * @note If no ToggleOn() or ToggleOff() function is provided, the widget will not accept being attached to a toggle input source. + * @note If no DialMove() function is provided, the widget will not accept being attached to a dial input source. + * @note AssignToggle() and AssignDial() enable a widget to handle more than one toggle/dial device attached to the widget. + * For example, a slider might accept two toggles, one for slider-down and one for slider-up. + * The function enables the widget to record that a particular device instance performs each particular role. + * (eg toggle0 = slider-down, toggle1 = slider-up). + * @{ + */ +typedef struct gwidgetVMT { + struct gwinVMT g; // @< This is still a GWIN + void (*DefaultDraw) (GWidgetObject *gw, void *param); // @< The default drawing routine (mandatory) + void (*MouseDown) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse down events (optional) + void (*MouseUp) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse up events (optional) + void (*MouseMove) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse move events (optional) + void (*ToggleOff) (GWidgetObject *gw, uint16_t instance); // @< Process toggle off events (optional) + void (*ToggleOn) (GWidgetObject *gw, uint16_t instance); // @< Process toggle on events (optional) + void (*DialMove) (GWidgetObject *gw, uint16_t instance, uint16_t value); // @< Process dial move events (optional) + void (*AllEvents) (GWidgetObject *gw, GEvent *pe); // @< Process all events (optional) + bool_t (*AssignToggle) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the toggle instance handle (optional) + bool_t (*AssignDial) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the dial instance handle (optional) +} gwidgetVMT; +/* @} */ + +/** + * @brief The predefined flags for a GWIN and a Widget + * @{ + */ +#define GWIN_FLG_DYNAMIC 0x0001 // @< The GWIN structure is allocated +#define GWIN_FLG_WIDGET 0x0002 // @< This is a widget +#define GWIN_FLG_ENABLED 0x0002 // @< The widget is enabled +#define GWIN_FLG_ALLOCTXT 0x0008 // @< The widget text is allocated +#define GWIN_FLG_MOUSECAPTURE 0x0010 // @< The widget has captured the mouse +#define GWIN_FIRST_CONTROL_FLAG 0x0100 // @< Free for GWINs and Widgets to use +/* @} */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Initialise (and allocate if necessary) the base GWIN object + * + * @param[in] pgw The GWindowObject structure. If NULL one is allocated from the heap + * @param[in] x, y The top left corner of the GWIN relative to the screen + * @param[in] w, h The width and height of the GWIN window + * @param[in] size The size of the GWIN object to allocate + * @param[in] vmt The virtual method table for the GWIN object + * + * @notapi + */ +GHandle _gwinInit(GWindowObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwinVMT *vmt); + +/** + * @brief Initialise (and allocate if necessary) the base Widget object + * + * @param[in] pgw The GWidgetObject structure. If NULL one is allocated from the heap + * @param[in] x, y The top left corner of the Widget relative to the screen + * @param[in] w, h The width and height of the Widget window + * @param[in] size The size of the Widget object to allocate + * @param[in] vmt The virtual method table for the Widget object + * + * @notapi + */ +GHandle _gwidgetInit(GWidgetObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwidgetVMT *vmt); + +/** + * @brief Destroy the Widget object + * + * @param[in] gw The widget to destroy + * + * @notapi + */ +void _gwidgetDestroy(GHandle gh); + +#ifdef __cplusplus +} +#endif + +#endif /* GFX_USE_GWIN */ + +#endif /* _CLASS_GWIN_H */ +/** @} */ diff --git a/include/gwin/console.h b/include/gwin/console.h index 4c317cdb..0496c620 100644 --- a/include/gwin/console.h +++ b/include/gwin/console.h @@ -24,22 +24,13 @@ #ifndef _GWIN_CONSOLE_H #define _GWIN_CONSOLE_H -#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__) - -/*===========================================================================*/ -/* Driver constants. */ -/*===========================================================================*/ - -#define GW_CONSOLE 0x0001 - -/*===========================================================================*/ -/* Type definitions */ -/*===========================================================================*/ +/* This file is included within "gwin/gwin.h" */ // A console window. Supports wrapped text writing and a cursor. typedef struct GConsoleObject_t { - GWindowObject gwin; - + GWindowObject g; + coord_t cx, cy; // Cursor position + #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM struct GConsoleWindowStream_t { const struct GConsoleWindowVMT_t *vmt; @@ -47,15 +38,8 @@ typedef struct GConsoleObject_t { } stream; #endif - coord_t cx,cy; // Cursor position - uint8_t fy; // Current font height - uint8_t fp; // Current font inter-character spacing } GConsoleObject; -/*===========================================================================*/ -/* External declarations. */ -/*===========================================================================*/ - #ifdef __cplusplus extern "C" { #endif @@ -67,18 +51,19 @@ extern "C" { * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] gc The GConsoleObject structure to initialise. If this is NULL the structure is dynamically allocated. - * @param[in] x,y The screen co-ordinates for the bottom left corner of the window + * @param[in] x,y The screen co-ordinates for the top left corner of the window * @param[in] width The width of the window * @param[in] height The height of the window - * @param[in] font The font to use + * * @note The console is not automatically cleared on creation. You must do that by calling gwinClear() (possibly after changing your background color) + * @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont() * @note If the dispay does not support scrolling, the window will be cleared when the bottom line is reached. * @note The default drawing color gets set to White and the background drawing color to Black. * @note The dimensions and position may be changed to fit on the real screen. * * @api */ -GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height, font_t font); +GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height); #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM /** @@ -157,7 +142,5 @@ void gwinPrintf(GHandle gh, const char *fmt, ...); } #endif -#endif /* GWIN_NEED_CONSOLE */ - #endif /* _GWIN_CONSOLE_H */ /** @} */ diff --git a/include/gwin/graph.h b/include/gwin/graph.h index dea8d4ee..3c4c42a9 100644 --- a/include/gwin/graph.h +++ b/include/gwin/graph.h @@ -22,20 +22,7 @@ #ifndef _GWIN_GRAPH_H #define _GWIN_GRAPH_H -#if GWIN_NEED_GRAPH || defined(__DOXYGEN__) - -/*===========================================================================*/ -/* Driver constants. */ -/*===========================================================================*/ - -#define GW_GRAPH 0x0003 - -/*===========================================================================*/ -/* Type definitions */ -/*===========================================================================*/ - -// GDISP now has its own point structure -#define GGraphPoint point +/* This file is included within "gwin/gwin.h" */ typedef enum GGraphPointType_e { GGRAPH_POINT_NONE, GGRAPH_POINT_DOT, GGRAPH_POINT_SQUARE, GGRAPH_POINT_CIRCLE @@ -85,7 +72,7 @@ typedef struct GGraphStyle_t { // A graph window typedef struct GGraphObject_t { - GWindowObject gwin; + GWindowObject g; GGraphStyle style; coord_t xorigin, yorigin; coord_t lastx, lasty; @@ -104,10 +91,12 @@ extern "C" { * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] gg The GGraphObject structure to initialise. If this is NULL the structure is dynamically allocated. - * @param[in] x,y The screen co-ordinates for the bottom left corner of the window + * @param[in] x,y The screen co-ordinates for the top left corner of the window * @param[in] width The width of the window * @param[in] height The height of the window + * * @note The console is not automatically cleared on creation. You must do that by calling gwinClear() (possibly after changing your background color) + * @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont() * @note The coordinate system within the window for graphing operations (but not for any other drawing * operation) is relative to the bottom left corner and then shifted right and up by the specified * graphing x and y origin. Note that this system is inverted in the y direction relative to the display. @@ -187,8 +176,6 @@ void gwinGraphDrawPoints(GHandle gh, const point *points, unsigned count); } #endif -#endif /* GWIN_NEED_GRAPH */ - #endif /* _GWIN_GRAPH_H */ /** @} */ diff --git a/include/gwin/gwidget.h b/include/gwin/gwidget.h new file mode 100644 index 00000000..40124a43 --- /dev/null +++ b/include/gwin/gwidget.h @@ -0,0 +1,234 @@ +/* + * This file is subject to the terms of the GFX License, v1.0. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ + +/** + * @file include/gwin/gwidget.h + * @brief GWIN Widgets header file. + */ + +#ifndef _GWIDGET_H +#define _GWIDGET_H + +/* This file is included within "gwin/gwin.h" */ + +/** + * @defgroup Widget Widget + * @ingroup GWIN + * + * @details A Widget is a GWindow that supports interacting with the user + * via an input device such as a mouse or toggle buttons. It is the + * base class for widgets such as buttons and sliders. + * + * @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h + * @{ + */ + +// Forward definition +struct GWidgetObject; + +/** + * @brief Defines a custom drawing function for a widget + */ +typedef void (*CustomWidgetDrawFunction)(struct GWidgetObject *gw, void *param); + +/** + * @brief The GWIN Widget structure + * @note A widget is a GWIN window that accepts user input. + * It also has a number of other properties such as its ability + * to redraw itself (a widget maintains drawing state). + * @note Do you access the members directly. Treat it as a black-box and use the method functions. + * + * @{ + */ +typedef struct GWidgetObject { + GWindowObject g; // @< This is still a GWIN + GListener listener; // @< The widget listener + const char * txt; // @< The widget text + CustomWidgetDrawFunction fnDraw; // @< The current draw function + void * fnParam; // @< A parameter for the current draw function +} GWidgetObject; +/* @} */ + +/** + * A comment/rant on the above structure: + * We would really like the GWindowObject member to be anonymous. While this is + * allowed under the C11, C99, GNU and various other standards which have been + * around forever - compiler support often requires special flags e.g + * gcc requires the -fms-extensions flag (no wonder the language and compilers have + * not really progressed in 30 years). As portability is a key requirement + * we unfortunately won't use this useful feature in case we get a compiler that + * won't support it even with special flags. + */ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Enable or disable a widget + * + * @param[in] gh The widget handle + * @param[in] enabled Enable or disable the widget + * + * @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget. + * @note Non-widgets will ignore this call. + * + * @api + */ +void gwinSetEnabled(GHandle gh, bool_t enabled); + +/** + * @brief Enable a widget + * + * @param[in] gh The widget handle + * + * @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget. + * @note Non-widgets will ignore this call. + * + * @api + */ +#define gwinEnable(gh) gwinSetEnabled(gh, TRUE) + +/** + * @brief Disable a widget + * + * @param[in] gh The widget handle + * + * @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget. + * @note Non-widgets will ignore this call. + * + * @api + */ +#define gwinDisable(gh) gwinSetEnabled(gh, FALSE) + +/** + * @brief Redraw the widget + * + * @param[in] gh The widget handle + * + * @note Non-widgets will ignore this call. + * + * @api + */ +void gwinDraw(GHandle gh); + +/** + * @brief Set the text of a widget. + * + * @param[in] gh The widget handle + * @param[in] txt The text to set. This must be a constant string unless useAlloc is set. + * @param[in] useAlloc If TRUE the string specified will be copied into dynamically allocated memory. + * + * @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget. + * @note Non-widgets will ignore this call. + * + * @api + */ +void gwinSetText(GHandle gh, const char *txt, bool_t useAlloc); + +/** + * @brief Get the text of a widget. + * @return The widget text or NULL if it isn't a widget + * + * @param[in] gh The widget handle + * + * @api + */ +const char *gwinGetText(GHandle gh); + +/** + * @brief Set the routine to perform a custom widget drawing. + * + * @param[in] gh The widget handle + * @param[in] fn The function to use to draw the widget + * @param[in] param A parameter to pass to the widget drawing function + * + * @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget. + * @note Non-widgets will ignore this call. + * + * @api + */ +void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param); + +/** + * @brief Attach a Listener to this widget + * @return TRUE on success + * + * @param[in] gh The widget handle + * @param[in] pl The listener + * @param[in] flags Flags to use for listening. For most widgets this should be 0. + * + * @api + */ +bool_t gwinAttachListener(GHandle gh, GListener *pl, unsigned flags); + +#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE + /** + * @brief Attach a mouse to a widget + * @return TRUE on success + * + * @param[in] gh The widget handle + * @param[in] instance The mouse instance + * + * @api + */ + bool_t gwinAttachMouse(GHandle gh, uint16_t instance); +#endif + +#if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE + /** + * @brief Attach a toggle to a widget + * @return TRUE on success + * + * @param[in] gh The widget handle + * @param[in] role The function the toggle will perform for the widget + * @param[in] instance The toggle instance + * + * @note See the documentation on the specific widget to see the possible + * values for the role parameter. If it is out of range, this function + * will return FALSE + * + * @api + */ + bool_t gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance); +#endif + +#if GFX_USE_GINPUT && GINPUT_NEED_DIAL + /** + * @brief Attach a toggle to a widget + * @return TRUE on success + * + * @param[in] gh The widget handle + * @param[in] role The function the dial will perform for the widget + * @param[in] instance The dial instance + * + * @note See the documentation on the specific widget to see the possible + * values for the role parameter. If it is out of range, this function + * will return FALSE + * + * @api + */ + bool_t gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance); +#endif + +#ifdef __cplusplus +} +#endif + +/* Include extra widget types */ +#if GWIN_NEED_BUTTON || defined(__DOXYGEN__) + #include "gwin/button.h" +#endif +#if GWIN_NEED_SLIDER || defined(__DOXYGEN__) + #include "gwin/slider.h" +#endif +#if GWIN_NEED_CHECKBOX || defined(__DOXYGEN__) + #include "gwin/checkbox.h" +#endif + +#endif /* _GWIDGET_H */ +/** @} */ diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index 6441e5f8..e7c164dc 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -12,14 +12,12 @@ * @defgroup Window Window * @ingroup GWIN * - * @details GWIN provides a basic window manager which allows it to easily - * create and destroy different windows on runtime. Each window - * will have it's own properties such as colors, brushes as well as - * it's own drawing origin. - * Moving the windows around is not supported yet. + * @details GWIN provides a basic window manager which allows it to easily + * create and destroy different windows at runtime. Each window + * will have it's own properties such as colors as well as + * it's own drawing origin. * * @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h - * * @{ */ @@ -30,30 +28,23 @@ #if GFX_USE_GWIN || defined(__DOXYGEN__) -/*===========================================================================*/ -/* Type definitions */ -/*===========================================================================*/ - -typedef uint16_t GWindowType; -#define GW_WINDOW 0x0000 -#define GW_FIRST_USER_WINDOW 0x8000 - -// A basic window -typedef struct GWindowObject_t { - GWindowType type; // What type of window is this - uint16_t flags; // Internal flags - coord_t x, y; // Screen relative position - coord_t width, height; // Dimensions of this window - color_t color, bgcolor; // Current drawing colors - bool_t enabled; // Enabled/Disabled state +/** + * @brief A window object structure + * @note Do you access the members directly. Treat it as a black-box and use the method functions. + * + * @{ + */ +typedef struct GWindowObject { + const struct gwinVMT *vmt; // @< The VMT for this GWIN + coord_t x, y; // @< Screen relative position + coord_t width, height; // @< Dimensions of this window + color_t color, bgcolor; // @< Current drawing colors + uint16_t flags; // @< Window flags (the meaning is private to the GWIN class) #if GDISP_NEED_TEXT - font_t font; // Current font + font_t font; // @< Current font #endif } GWindowObject, * GHandle; - -/*===========================================================================*/ -/* External declarations. */ -/*===========================================================================*/ +/* @} */ #ifdef __cplusplus extern "C" { @@ -65,18 +56,20 @@ extern "C" { * @brief Create a basic window. * @return NULL if there is no resultant drawing area, otherwise a window handle. * - * @param[in] gw The window structure to initialize. If this is NULL the structure is dynamically allocated. - * @param[in] x,y The screen coordinates for the bottom left corner of the window + * @param[in] pgw The window structure to initialize. If this is NULL the structure is dynamically allocated. + * @param[in] x,y The screen coordinates for the top left corner of the window * @param[in] width The width of the window * @param[in] height The height of the window + * * @note The default drawing color gets set to White and the background drawing color to Black. * @note No default font is set so make sure to set one before drawing any text. * @note The dimensions and position may be changed to fit on the real screen. - * @note The window is not automatically cleared on creation. You must do that by calling gwinClear() (possibly after changing your background color) + * @note The window is not automatically cleared on creation. You must do that by calling @p gwinClear() + * (possibly after changing your background color) * * @api */ -GHandle gwinCreateWindow(GWindowObject *gw, coord_t x, coord_t y, coord_t width, coord_t height); +GHandle gwinCreateWindow(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height); /** * @brief Destroy a window (of any type). Releases any dynamically allocated memory. @@ -85,17 +78,22 @@ GHandle gwinCreateWindow(GWindowObject *gw, coord_t x, coord_t y, coord_t width, * * @api */ -void gwinDestroyWindow(GHandle gh); +void gwinDestroy(GHandle gh); /** - * @brief Enable or disable a widget (of any type). + * @brief Get the real class name of the GHandle + * @details Returns a string describing the object class. * - * @param[in] gh The window handle - * @param[in] enabled Enable or disable the widget - * - * @api + * @param[in] gh The window */ -void gwinSetEnabled(GHandle gh, bool_t enabled); +const char *gwinGetClassName(GHandle gh); + +/** + * @brief Get an ID that uniquely describes the class of the GHandle + * + * @param[in] gh The window + */ +#define gwinGetClassID(gh) ((void *)((gh)->vmt)) /** * @brief Get the X coordinate of the window @@ -148,23 +146,16 @@ void gwinSetEnabled(GHandle gh, bool_t enabled); */ #define gwinSetBgColor(gh, bgclr) (gh)->bgcolor = (bgclr) -/** - * @brief Enable a window of any type - * - * @param[in] gh The window handle - */ -#define gwinEnable(gh) gwinSetEnabled(gh, TRUE) - -/** - * @brief Disable a window of any type - * - * @param[in] gh The window handle - */ -#define gwinDisable(gh) gwinSetEnabled(gh, FALSE) - /* Set up for text */ #if GDISP_NEED_TEXT || defined(__DOXYGEN__) + /** + * @brief Set the default font for all new GWIN windows + * + * @param[in] gh The window + */ + void gwinSetDefaultFont(font_t font); + /** * @brief Set the current font for this window. * @@ -178,16 +169,6 @@ void gwinSetEnabled(GHandle gh, bool_t enabled); /* Drawing Functions */ -/** - * @brief Draw the window - * @note Redraws the Window if the GWIN object has a draw routine - * - * @param[in] gh The window handle - * - * @api - */ -void gwinDraw(GHandle gh); - /** * @brief Clear the window * @note Uses the current background color to clear the window @@ -538,12 +519,16 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } #endif +/* Include widgets */ +#include "gwin/gwidget.h" + /* Include extra window types */ -#include "gwin/console.h" /* 0x0001 */ -#include "gwin/button.h" /* 0x0002 */ -#include "gwin/graph.h" /* 0x0003 */ -#include "gwin/slider.h" /* 0x0004 */ -#include "gwin/checkbox.h" /* 0x0005 */ +#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__) + #include "gwin/console.h" +#endif +#if GWIN_NEED_GRAPH || defined(__DOXYGEN__) + #include "gwin/graph.h" +#endif #endif /* GFX_USE_GWIN */ diff --git a/include/gwin/internal.h b/include/gwin/internal.h deleted file mode 100644 index 53392410..00000000 --- a/include/gwin/internal.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ - -/** - * @file include/gwin/internal.h - * @brief GWIN Graphic window subsystem header file. - * - * @addtogroup GWIN - * @{ - */ -#ifndef _GWIN_INTERNAL_H -#define _GWIN_INTERNAL_H - -#if GFX_USE_GWIN || defined(__DOXYGEN__) - -/*===========================================================================*/ -/* Sub-system constants. */ -/*===========================================================================*/ - -#define GWIN_FLG_DYNAMIC 0x0001 -#define GBTN_FLG_ALLOCTXT 0x0002 -#define GWIN_FIRST_CONTROL_FLAG 0x0004 - -#ifdef __cplusplus -extern "C" { -#endif - -GHandle _gwinInit(GWindowObject *gw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size); - -#ifdef __cplusplus -} -#endif - -#endif /* GFX_USE_GWIN */ - -#endif /* _GWIN_INTERNAL_H */ -/** @} */ diff --git a/include/gwin/slider.h b/include/gwin/slider.h index 5e77a846..41894305 100644 --- a/include/gwin/slider.h +++ b/include/gwin/slider.h @@ -22,19 +22,10 @@ #ifndef _GWIN_SLIDER_H #define _GWIN_SLIDER_H -#if GWIN_NEED_SLIDER || defined(__DOXYGEN__) +/* This file is included within "gwin/gwidget.h" */ -/*===========================================================================*/ -/* Driver constants. */ -/*===========================================================================*/ - -#define GW_SLIDER 0x0004 #define GEVENT_GWIN_SLIDER (GEVENT_GWIN_FIRST+1) -/*===========================================================================*/ -/* Type definitions */ -/*===========================================================================*/ - typedef struct GEventGWinSlider_t { GEventType type; // The type of this event (GEVENT_GWIN_BUTTON) GHandle slider; // The slider that is returning results @@ -43,33 +34,24 @@ typedef struct GEventGWinSlider_t { // There are currently no GEventGWinSlider listening flags - use 0 -typedef struct GSliderDrawStyle_t { +typedef struct GSliderColors { color_t color_edge; color_t color_thumb; color_t color_active; color_t color_inactive; -} GSliderDrawStyle; - -typedef void (*GSliderDrawFunction)(GHandle gh, bool_t isVertical, coord_t thumbpos, const GSliderDrawStyle *pstyle, void *param); + color_t color_txt; +} GSliderColors; // A slider window typedef struct GSliderObject_t { - GWindowObject gwin; - - GSliderDrawStyle style; - bool_t tracking; + GWidgetObject w; + GSliderColors c; + coord_t dpos; int min; int max; int pos; - GSliderDrawFunction fn; - void *param; - GListener listener; } GSliderObject; -/*===========================================================================*/ -/* External declarations. */ -/*===========================================================================*/ - #ifdef __cplusplus extern "C" { #endif @@ -79,12 +61,14 @@ extern "C" { * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] gb The GSliderObject structure to initialise. If this is NULL the structure is dynamically allocated. - * @param[in] x,y The screen co-ordinates for the bottom left corner of the window + * @param[in] x,y The screen co-ordinates for the top left corner of the window * @param[in] width The width of the window * @param[in] height The height of the window + * * @note The drawing color gets set to White and the background drawing color to Black. + * @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont() * @note The dimensions and position may be changed to fit on the real screen. - * @note The slider is not automatically drawn. Call gwinSliderDraw() after changing the slider style. + * @note The slider is not automatically drawn. Call gwinDraw() to draw it. * @note Sets the slider range from 0 to 100 with an initial position of 0 * * @api @@ -130,51 +114,7 @@ void gwinSetSliderPosition(GHandle gh, int pos); * * @api */ -void gwinSetSliderStyle(GHandle gh, const GSliderDrawStyle *pStyle); - -/** - * @brief Redraw the slider. - * - * @param[in] gh The window handle (must be a slider window) - * - * @api - */ -void gwinSliderDraw(GHandle gh); - -/** - * @brief Enable or disable a button - * - * @param[in] gh The window handle (must be a slider window) - * @param[in] enabled Enable or disable the slider - * - * @api - */ -void gwinSliderSetEnabled(GHandle gh, bool_t enabled); - -/** - * @brief Set the callback routine to perform a custom slider drawing. - * - * @param[in] gh The window handle (must be a slider window) - * @param[in] fn The function to use to draw the slider - * @param[in] param A parameter to pass to the slider drawing function - * - * @api - */ -void gwinSetSliderCustom(GHandle gh, GSliderDrawFunction fn, void *param); - -/** - * @brief Enable a slider - * - * @api - */ -#define gwinEnableSlider(gh) gwinSliderSetEnabled( ((GSliderObject *)(gh)), TRUE) - -/** - * @brief Disable a slider - * - * @api - */ -#define gwinDisableSlider(gh) gwinSliderSetEnabled( ((GSliderObject *)(gh)), FALSE) +void gwinSetSliderColors(GHandle gh, const GSliderColors *pStyle); /** * @brief Get the current slider position. @@ -190,69 +130,35 @@ void gwinSetSliderCustom(GHandle gh, GSliderDrawFunction fn, void *param); #define gwinGetSliderPosition(gh) (((GSliderObject *)(gh))->pos) /** - * @brief Get the source handle of a slider - * @details Get the source handle of a slider so the application can listen for events + * @brief Some custom slider drawing routines + * @details These function may be passed to @p gwinSetCustomDraw() to get different slider drawing styles * - * @param[in] gh The window handle - * - * @api - */ -#define gwinGetSliderSource(gh) ((GSourceHandle)(gh)) - -#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - /** - * @brief Attach a mouse source - * @details Attach a mouse to a slider - * - * @param[in] gh The slider handle - * @param[in] instance The mouse instance - * - * @api - */ - bool_t gwinAttachSliderMouse(GHandle gh, uint16_t instance); -#endif - -#if GFX_USE_GINPUT && GINPUT_NEED_DIAL - /** - * @brief Attach a dial source - * @details Attach a dial to a slider - * - * @param[in] gh The dial handle - * @param[in] instance The dial instance - * - * @api - */ - bool_t gwinAttachSliderDial(GHandle gh, uint16_t instance); -#endif - -/** - * @brief Standard slider drawing routines - * @details This routine is called to draw the standard slider. - * - * @param[in] gh The slider handle - * @param[in] isVertical The slider is vertically oriented instead of horizontal - * @param[in] thumbpos The position of the slider (0..cx-1 or cy-1..0) - * @param[in] pstyle The current drawing style + * @param[in] gw The widget (which must be a slider) * @param[in] param A parameter passed in from the user * * @note In your custom slider drawing function you may optionally call this * standard functions and then draw your extra details on top. - * @note The standard functions below ignore the param parameter. It is there - * only to ensure the functions match the GSliderDrawFunction type. - * @note When called by a slider the framework ensure that it is - * a slider object and sets up clipping to the slider object window. These - * drawing routines then don't have to worry about explicitly doing that. + * @note The standard functions below ignore the param parameter except for @p gwinSliderDraw_Image(). + * @note The image custom draw function @p gwinSliderDraw_Image() uses param to pass in the gdispImage pointer. + * The image must be already opened before calling @p gwinSetCustomDraw(). The image is tiled to fill + * the active area of the slider. The normal colors apply to the border and inactive area and the dividing line + * between the active and inactive areas. + * No checking is done to compare the dimensions of the slider to the size of the image. + * Note text is drawn on top of the image. + * @note These custom drawing routines don't have to worry about setting clipping as the framework + * sets clipping to the object window prior to calling these routines. * * @api + * @{ */ -void gwinSliderDraw_Std(GHandle gh, bool_t isVertical, coord_t thumbpos, const GSliderDrawStyle *pstyle, void *param); +void gwinSliderDraw_Std(GWidgetObject *gw, void *param); +void gwinSliderDraw_Image(GWidgetObject *gw, void *param); +/* @} */ #ifdef __cplusplus } #endif -#endif /* GWIN_NEED_SLIDER */ - #endif /* _GWIN_SLIDER_H */ /** @} */ diff --git a/src/gwin/button.c b/src/gwin/button.c index cf5babc5..1ebc8ee5 100644 --- a/src/gwin/button.c +++ b/src/gwin/button.c @@ -19,392 +19,313 @@ #if (GFX_USE_GWIN && GWIN_NEED_BUTTON) || defined(__DOXYGEN__) -/* Parameters for various shapes */ +#include "gwin/class_gwin.h" + +// Parameters for various shapes #define RND_CNR_SIZE 5 // Rounded corner size for rounded buttons #define ARROWHEAD_DIVIDER 4 // A quarter of the height for the arrow head #define ARROWBODY_DIVIDER 4 // A quarter of the width for the arrow body -#include +// Our pressed state +#define GBUTTON_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0) -#include "gwin/internal.h" +// Prototypes for button VMT functions +static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y); +static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y); +static void ToggleOff(GWidgetObject *gw, uint16_t instance); +static void ToggleOn(GWidgetObject *gw, uint16_t instance); -#define GWIN_BUTTON_DEFAULT_SHAPE GBTN_3D +// The button VMT table +static const gwidgetVMT buttonVMT = { + { + "Button", // The classname + _gwidgetDestroy, // The destroy routine + 0, // The after-clear routine + }, + gwinButtonDraw_3D, // The default drawing routine + MouseDown, // Process mouse down events + MouseUp, // Process mouse up events + 0, // Process mouse move events (NOT USED) + ToggleOff, // Process toggle off events + ToggleOn, // Process toggle on events + 0, // Process dial move events (NOT USED) + 0, // Process all events (NOT USED) + 0, // AssignToggle (NOT USED) + 0, // AssignDial (NOT USED) +}; -static const GButtonDrawStyle GButtonDefaultStyleUp = { +// Default color scheme +static const GButtonColors GButtonDefaultColorsUp = { HTML2COLOR(0x404040), // color_up_edge; HTML2COLOR(0xE0E0E0), // color_up_fill; HTML2COLOR(0x000000), // color_up_txt; }; - -static const GButtonDrawStyle GButtonDefaultStyleDown = { +static const GButtonColors GButtonDefaultColorsDown = { HTML2COLOR(0x404040), // color_dn_edge; HTML2COLOR(0x808080), // color_dn_fill; HTML2COLOR(0x404040), // color_dn_txt; }; +static const GButtonColors GButtonDefaultColorsDisabled = { + HTML2COLOR(0x808080), // color_dis_edge; + HTML2COLOR(0xE0E0E0), // color_dis_fill; + HTML2COLOR(0xC0C0C0), // color_dis_txt; +}; -// Process an event callback -static void gwinButtonCallback(void *param, GEvent *pe) { - GSourceListener *psl; - #define gh ((GHandle)param) - #define gbw ((GButtonObject *)param) - #define gsh ((GSourceHandle)param) - #define pme ((GEventMouse *)pe) - #define pte ((GEventTouch *)pe) - #define pxe ((GEventToggle *)pe) - #define pbe ((GEventGWinButton *)pe) - - // check if button is disabled - if (!gh->enabled) - return; - - switch (pe->type) { - #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - case GEVENT_MOUSE: - case GEVENT_TOUCH: - // Ignore anything other than the primary mouse button going up or down - if (!((pme->current_buttons ^ pme->last_buttons) & GINPUT_MOUSE_BTN_LEFT)) - return; - - if (gbw->state == GBTN_UP) { - // Our button is UP: Test for button down over the button - if ((pme->current_buttons & GINPUT_MOUSE_BTN_LEFT) - && pme->x >= gbw->gwin.x && pme->x < gbw->gwin.x + gbw->gwin.width - && pme->y >= gbw->gwin.y && pme->y < gbw->gwin.y + gbw->gwin.height) { - gbw->state = GBTN_DOWN; - gwinButtonDraw((GHandle)param); - } - return; - } - - // Our button is DOWN - - // Skip more mouse downs - if ((pme->current_buttons & GINPUT_MOUSE_BTN_LEFT)) - return; - - // This must be a mouse up - set the button as UP - gbw->state = GBTN_UP; - gwinButtonDraw((GHandle)param); - - #if GWIN_BUTTON_LAZY_RELEASE - break; - #else - // If the mouse up was over the button then create the event - if (pme->x >= gbw->gwin.x && pme->x < gbw->gwin.x + gbw->gwin.width - && pme->y >= gbw->gwin.y && pme->y < gbw->gwin.y + gbw->gwin.height) - break; - - return; - #endif - #endif - - #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE - case GEVENT_TOGGLE: - // State has changed - update the button - gbw->state = pxe->on ? GBTN_DOWN : GBTN_UP; - gwinButtonDraw((GHandle)param); - - // Trigger the event on button down (different than for mouse/touch) - if (gbw->state == GBTN_DOWN) - break; - - return; - #endif - - default: - return; - } +// Send the button event +static void SendButtonEvent(GWidgetObject *gw) { + GSourceListener * psl; + GEvent * pe; + #define pbe ((GEventGWinButton *)pe) // Trigger a GWIN Button Event psl = 0; - while ((psl = geventGetSourceListener(gsh, psl))) { + while ((psl = geventGetSourceListener((GSourceHandle)gw, psl))) { if (!(pe = geventGetEventBuffer(psl))) continue; pbe->type = GEVENT_GWIN_BUTTON; - pbe->button = gh; + pbe->button = (GHandle)gw; geventSendEvent(psl); } #undef pbe - #undef pme - #undef pte - #undef pxe - #undef gsh - #undef gbw - #undef gh } -GHandle gwinCreateButton(GButtonObject *gb, coord_t x, coord_t y, coord_t width, coord_t height, font_t font, GButtonType type) { - if (!(gb = (GButtonObject *)_gwinInit((GWindowObject *)gb, x, y, width, height, sizeof(GButtonObject)))) - return 0; - - gb->gwin.type = GW_BUTTON; - gb->fn = 0; - gb->param = 0; - gwinSetFont(&gb->gwin, font); - gwinSetButtonStyle(&gb->gwin, GWIN_BUTTON_DEFAULT_SHAPE, &GButtonDefaultStyleUp, &GButtonDefaultStyleDown); - gb->type = type; - gb->state = GBTN_UP; - gb->txt = ""; - geventListenerInit(&gb->listener); - geventRegisterCallback(&gb->listener, gwinButtonCallback, gb); - - // buttons are enabled by default - gb->gwin.enabled = TRUE; - - return (GHandle)gb; +// A mouse down has occurred over the button +static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { + (void) x; (void) y; + gw->g.flags |= GBUTTON_FLG_PRESSED; + gwinDraw((GHandle)gw); } -void gwinSetButtonStyle(GHandle gh, GButtonShape shape, const GButtonDrawStyle *pUp, const GButtonDrawStyle *pDown) { - #define gbw ((GButtonObject *)gh) - if (gh->type != GW_BUTTON) - return; +// A mouse up has occurred (it may or may not be over the button) +static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { + (void) x; (void) y; + gw->g.flags &= ~GBUTTON_FLG_PRESSED; + gwinDraw((GHandle)gw); - switch(shape) { - case GBTN_SQUARE: gbw->fn = gwinButtonDraw_Square; break; - #if GDISP_NEED_ARC - case GBTN_ROUNDED: gbw->fn = gwinButtonDraw_Rounded; break; - #endif - #if GDISP_NEED_ELLIPSE - case GBTN_ELLIPSE: gbw->fn = gwinButtonDraw_Ellipse; break; - #endif - - #if GDISP_NEED_CONVEX_POLYGON - case GBTN_ARROW_UP: gbw->fn = gwinButtonDraw_ArrowUp; break; - case GBTN_ARROW_DOWN: gbw->fn = gwinButtonDraw_ArrowDown; break; - case GBTN_ARROW_LEFT: gbw->fn = gwinButtonDraw_ArrowLeft; break; - case GBTN_ARROW_RIGHT: gbw->fn = gwinButtonDraw_ArrowRight; break; - #endif - - case GBTN_CUSTOM: if (gbw->fn) break; /* Fall Through */ - case GBTN_3D: /* Fall through */ - default: gbw->fn = gwinButtonDraw_3D; break; - } - if (pUp) { - gbw->up.color_edge = pUp->color_edge; - gbw->up.color_fill = pUp->color_fill; - gbw->up.color_txt = pUp->color_txt; - } - if (pDown) { - gbw->dn.color_edge = pDown->color_edge; - gbw->dn.color_fill = pDown->color_fill; - gbw->dn.color_txt = pDown->color_txt; - } - #undef gbw -} - -void gwinSetButtonText(GHandle gh, const char *txt, bool_t useAlloc) { - #define gbw ((GButtonObject *)gh) - if (gh->type != GW_BUTTON) - return; - - // Dispose of the old string - if ((gh->flags & GBTN_FLG_ALLOCTXT)) { - gh->flags &= ~GBTN_FLG_ALLOCTXT; - if (gbw->txt) { - gfxFree((void *)gbw->txt); - gbw->txt = ""; - } - } - // Alloc the new text if required - if (txt && useAlloc) { - char *str; - - if ((str = (char *)gfxAlloc(strlen(txt)+1))) { - gh->flags |= GBTN_FLG_ALLOCTXT; - strcpy(str, txt); - } - txt = (const char *)str; - } - - gbw->txt = txt ? txt : ""; - #undef gbw -} - -void gwinButtonDraw(GHandle gh) { - #define gbw ((GButtonObject *)gh) - - if (gh->type != GW_BUTTON) - return; - - #if GDISP_NEED_CLIP - gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #if !GWIN_BUTTON_LAZY_RELEASE + // If the mouse up was not over the button then cancel the event + if (x < 0 || y < 0 || x >= gw->g.width || y >= gw->g.height) + return; #endif - gbw->fn(gh, - gbw->gwin.enabled, - gbw->state == GBTN_DOWN, - gh->font && gbw->txt ? gbw->txt : "", - gbw->state == GBTN_DOWN ? &gbw->dn : &gbw->up, - gbw->param); - - #undef gbw + SendButtonEvent(gw); } -void gwinSetButtonCustom(GHandle gh, GButtonDrawFunction fn, void *param) { - #define gbw ((GButtonObject *)gh) +// A toggle off has occurred +static void ToggleOff(GWidgetObject *gw, uint16_t instance) { + (void) instance; + gw->g.flags &= ~GBUTTON_FLG_PRESSED; + gwinDraw((GHandle)gw); +} - if (gh->type != GW_BUTTON) +// A toggle on has occurred +static void ToggleOn(GWidgetObject *gw, uint16_t instance) { + (void) instance; + gw->g.flags |= GBUTTON_FLG_PRESSED; + gwinDraw((GHandle)gw); + // Trigger the event on button down (different than for mouse/touch) + SendButtonEvent(gw); +} + +GHandle gwinCreateButton(GButtonObject *gw, coord_t x, coord_t y, coord_t width, coord_t height) { + if (!(gw = (GButtonObject *)_gwidgetInit((GWidgetObject *)gw, x, y, width, height, sizeof(GButtonObject), &buttonVMT))) + return 0; + + gw->c_up = GButtonDefaultColorsUp; + gw->c_dn = GButtonDefaultColorsDown; + gw->c_dis = GButtonDefaultColorsDisabled; + return (GHandle)gw; +} + +void gwinSetButtonColors(GHandle gh, const GButtonColors *pUp, const GButtonColors *pDown, const GButtonColors *pDisabled) { + if (gh->vmt != (gwinVMT *)&buttonVMT) return; - gbw->fn = fn ? fn : gwinButtonDraw_3D; - gbw->param = param; - - #undef gbw + if (pUp) ((GButtonObject *)gh)->c_up = *pUp; + if (pDown) ((GButtonObject *)gh)->c_dn = *pDown; + if (pDisabled) ((GButtonObject *)gh)->c_dis = *pDisabled; } -void gwinButtonSetEnabled(GHandle gh, bool_t enabled) { - if (gh->type != GW_BUTTON) - return; +bool_t gwinIsButtonPressed(GHandle gh) { + if (gh->vmt != (gwinVMT *)&buttonVMT) + return FALSE; - gh->enabled = enabled; + return (gh->flags & GBUTTON_FLG_PRESSED) ? TRUE : FALSE; } -void gwinButtonDraw_3D(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { - (void) enabled; - (void) isdown; - (void) param; +/*---------------------------------------------------------- + * Custom Draw Routines + *----------------------------------------------------------*/ - gdispFillStringBox(gh->x, gh->y, gh->width-1, gh->height-1, txt, gh->font, pstyle->color_txt, pstyle->color_fill, justifyCenter); - gdispDrawLine(gh->x+gh->width-1, gh->y, gh->x+gh->width-1, gh->y+gh->height-1, pstyle->color_edge); - gdispDrawLine(gh->x, gh->y+gh->height-1, gh->x+gh->width-2, gh->y+gh->height-1, pstyle->color_edge); +static GButtonColors *getDrawColors(GWidgetObject *gw) { + if (!(gw->g.flags & GWIN_FLG_ENABLED)) return &((GButtonObject *)gw)->c_dis; + if ((gw->g.flags & GBUTTON_FLG_PRESSED)) return &((GButtonObject *)gw)->c_dn; + return &((GButtonObject *)gw)->c_up; } -void gwinButtonDraw_Square(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { - (void) enabled; - (void) isdown; - (void) param; +void gwinButtonDraw_3D(GWidgetObject *gw, void *param) { + (void) param; + GButtonColors * pcol; - gdispFillStringBox(gh->x+1, gh->y+1, gh->width-2, gh->height-2, txt, gh->font, pstyle->color_txt, pstyle->color_fill, justifyCenter); - gdispDrawBox(gh->x, gh->y, gh->width, gh->height, pstyle->color_edge); + if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; + pcol = getDrawColors(gw); + + gdispFillStringBox(gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->txt, gw->g.font, pcol->color_txt, pcol->color_fill, justifyCenter); + gdispDrawLine(gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->color_edge); + gdispDrawLine(gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->color_edge); +} + +void gwinButtonDraw_Box(GWidgetObject *gw, void *param) { + (void) param; + GButtonColors * pcol; + + if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; + pcol = getDrawColors(gw); + + gdispFillStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, pcol->color_fill, justifyCenter); + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->color_edge); } #if GDISP_NEED_ARC - void gwinButtonDraw_Rounded(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { - (void) enabled; - (void) isdown; - (void) param; + void gwinButtonDraw_Rounded(GWidgetObject *gw, void *param) { + (void) param; + GButtonColors * pcol; - if (gh->width >= 2*RND_CNR_SIZE+10) { - gdispFillRoundedBox(gh->x+1, gh->y+1, gh->width-2, gh->height-2, RND_CNR_SIZE-1, pstyle->color_fill); - gdispDrawStringBox(gh->x+1, gh->y+RND_CNR_SIZE, gh->width-2, gh->height-(2*RND_CNR_SIZE), txt, gh->font, pstyle->color_txt, justifyCenter); - gdispDrawRoundedBox(gh->x, gh->y, gh->width, gh->height, RND_CNR_SIZE, pstyle->color_edge); + if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; + pcol = getDrawColors(gw); + + if (gw->g.width >= 2*RND_CNR_SIZE+10) { + gdispFillRoundedBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, RND_CNR_SIZE-1, pcol->color_fill); + gdispDrawStringBox(gw->g.x+1, gw->g.y+RND_CNR_SIZE, gw->g.width-2, gw->g.height-(2*RND_CNR_SIZE), gw->txt, gw->g.font, pcol->color_txt, justifyCenter); + gdispDrawRoundedBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, RND_CNR_SIZE, pcol->color_edge); } else { - gdispFillStringBox(gh->x+1, gh->y+1, gh->width-2, gh->height-2, txt, gh->font, pstyle->color_txt, pstyle->color_fill, justifyCenter); - gdispDrawBox(gh->x, gh->y, gh->width, gh->height, pstyle->color_edge); + gdispFillStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, pcol->color_fill, justifyCenter); + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->color_edge); } } #endif #if GDISP_NEED_ELLIPSE - void gwinButtonDraw_Ellipse(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { - (void) enabled; - (void) isdown; - (void) param; + void gwinButtonDraw_Ellipse(GWidgetObject *gw, void *param) { + (void) param; + GButtonColors * pcol; - gdispFillEllipse(gh->x+1, gh->y+1, gh->width/2-1, gh->height/2-1, pstyle->color_fill); - gdispDrawStringBox(gh->x+1, gh->y+1, gh->width-2, gh->height-2, txt, gh->font, pstyle->color_txt, justifyCenter); - gdispDrawEllipse(gh->x, gh->y, gh->width/2, gh->height/2, pstyle->color_edge); + if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; + pcol = getDrawColors(gw); + + gdispFillEllipse(gw->g.x+1, gw->g.y+1, gw->g.width/2-1, gw->g.height/2-1, pcol->color_fill); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); + gdispDrawEllipse(gw->g.x, gw->g.y, gw->g.width/2, gw->g.height/2, pcol->color_edge); } #endif #if GDISP_NEED_CONVEX_POLYGON - void gwinButtonDraw_ArrowUp(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { - (void) enabled; - (void) isdown; - (void) param; - point arw[7]; + void gwinButtonDraw_ArrowUp(GWidgetObject *gw, void *param) { + (void) param; + GButtonColors * pcol; + point arw[7]; - arw[0].x = gh->width/2; arw[0].y = 0; - arw[1].x = gh->width-1; arw[1].y = gh->height/ARROWHEAD_DIVIDER; - arw[2].x = (gh->width + gh->width/ARROWBODY_DIVIDER)/2; arw[2].y = gh->height/ARROWHEAD_DIVIDER; - arw[3].x = (gh->width + gh->width/ARROWBODY_DIVIDER)/2; arw[3].y = gh->height-1; - arw[4].x = (gh->width - gh->width/ARROWBODY_DIVIDER)/2; arw[4].y = gh->height-1; - arw[5].x = (gh->width - gh->width/ARROWBODY_DIVIDER)/2; arw[5].y = gh->height/ARROWHEAD_DIVIDER; - arw[6].x = 0; arw[6].y = gh->height/ARROWHEAD_DIVIDER; + if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; + pcol = getDrawColors(gw); - gdispFillConvexPoly(gh->x, gh->y, arw, 7, pstyle->color_fill); - gdispDrawPoly(gh->x, gh->y, arw, 7, pstyle->color_edge); - gdispDrawStringBox(gh->x+1, gh->y+1, gh->width-2, gh->height-2, txt, gh->font, pstyle->color_txt, justifyCenter); + arw[0].x = gw->g.width/2; arw[0].y = 0; + arw[1].x = gw->g.width-1; arw[1].y = gw->g.height/ARROWHEAD_DIVIDER; + arw[2].x = (gw->g.width + gw->g.width/ARROWBODY_DIVIDER)/2; arw[2].y = gw->g.height/ARROWHEAD_DIVIDER; + arw[3].x = (gw->g.width + gw->g.width/ARROWBODY_DIVIDER)/2; arw[3].y = gw->g.height-1; + arw[4].x = (gw->g.width - gw->g.width/ARROWBODY_DIVIDER)/2; arw[4].y = gw->g.height-1; + arw[5].x = (gw->g.width - gw->g.width/ARROWBODY_DIVIDER)/2; arw[5].y = gw->g.height/ARROWHEAD_DIVIDER; + arw[6].x = 0; arw[6].y = gw->g.height/ARROWHEAD_DIVIDER; + + gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_fill); + gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_edge); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); } - void gwinButtonDraw_ArrowDown(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { - (void) enabled; - (void) isdown; - (void) param; - point arw[7]; + void gwinButtonDraw_ArrowDown(GWidgetObject *gw, void *param) { + (void) param; + GButtonColors * pcol; + point arw[7]; - arw[0].x = gh->width/2; arw[0].y = gh->height-1; - arw[1].x = gh->width-1; arw[1].y = gh->height-1-gh->height/ARROWHEAD_DIVIDER; - arw[2].x = (gh->width + gh->width/ARROWBODY_DIVIDER)/2; arw[2].y = gh->height-1-gh->height/ARROWHEAD_DIVIDER; - arw[3].x = (gh->width + gh->width/ARROWBODY_DIVIDER)/2; arw[3].y = 0; - arw[4].x = (gh->width - gh->width/ARROWBODY_DIVIDER)/2; arw[4].y = 0; - arw[5].x = (gh->width - gh->width/ARROWBODY_DIVIDER)/2; arw[5].y = gh->height-1-gh->height/ARROWHEAD_DIVIDER; - arw[6].x = 0; arw[6].y = gh->height-1-gh->height/ARROWHEAD_DIVIDER; + if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; + pcol = getDrawColors(gw); - gdispFillConvexPoly(gh->x, gh->y, arw, 7, pstyle->color_fill); - gdispDrawPoly(gh->x, gh->y, arw, 7, pstyle->color_edge); - gdispDrawStringBox(gh->x+1, gh->y+1, gh->width-2, gh->height-2, txt, gh->font, pstyle->color_txt, justifyCenter); + arw[0].x = gw->g.width/2; arw[0].y = gw->g.height-1; + arw[1].x = gw->g.width-1; arw[1].y = gw->g.height-1-gw->g.height/ARROWHEAD_DIVIDER; + arw[2].x = (gw->g.width + gw->g.width/ARROWBODY_DIVIDER)/2; arw[2].y = gw->g.height-1-gw->g.height/ARROWHEAD_DIVIDER; + arw[3].x = (gw->g.width + gw->g.width/ARROWBODY_DIVIDER)/2; arw[3].y = 0; + arw[4].x = (gw->g.width - gw->g.width/ARROWBODY_DIVIDER)/2; arw[4].y = 0; + arw[5].x = (gw->g.width - gw->g.width/ARROWBODY_DIVIDER)/2; arw[5].y = gw->g.height-1-gw->g.height/ARROWHEAD_DIVIDER; + arw[6].x = 0; arw[6].y = gw->g.height-1-gw->g.height/ARROWHEAD_DIVIDER; + + gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_fill); + gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_edge); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); } - void gwinButtonDraw_ArrowLeft(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { - (void) enabled; - (void) isdown; - (void) param; - point arw[7]; + void gwinButtonDraw_ArrowLeft(GWidgetObject *gw, void *param) { + (void) param; + GButtonColors * pcol; + point arw[7]; - arw[0].x = 0; arw[0].y = gh->height/2; - arw[1].x = gh->width/ARROWHEAD_DIVIDER; arw[1].y = 0; - arw[2].x = gh->width/ARROWHEAD_DIVIDER; arw[2].y = (gh->height - gh->height/ARROWBODY_DIVIDER)/2; - arw[3].x = gh->width-1; arw[3].y = (gh->height - gh->height/ARROWBODY_DIVIDER)/2; - arw[4].x = gh->width-1; arw[4].y = (gh->height + gh->height/ARROWBODY_DIVIDER)/2; - arw[5].x = gh->width/ARROWHEAD_DIVIDER; arw[5].y = (gh->height + gh->height/ARROWBODY_DIVIDER)/2; - arw[6].x = gh->width/ARROWHEAD_DIVIDER; arw[6].y = gh->height-1; + if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; + pcol = getDrawColors(gw); - gdispFillConvexPoly(gh->x, gh->y, arw, 7, pstyle->color_fill); - gdispDrawPoly(gh->x, gh->y, arw, 7, pstyle->color_edge); - gdispDrawStringBox(gh->x+1, gh->y+1, gh->width-2, gh->height-2, txt, gh->font, pstyle->color_txt, justifyCenter); + arw[0].x = 0; arw[0].y = gw->g.height/2; + arw[1].x = gw->g.width/ARROWHEAD_DIVIDER; arw[1].y = 0; + arw[2].x = gw->g.width/ARROWHEAD_DIVIDER; arw[2].y = (gw->g.height - gw->g.height/ARROWBODY_DIVIDER)/2; + arw[3].x = gw->g.width-1; arw[3].y = (gw->g.height - gw->g.height/ARROWBODY_DIVIDER)/2; + arw[4].x = gw->g.width-1; arw[4].y = (gw->g.height + gw->g.height/ARROWBODY_DIVIDER)/2; + arw[5].x = gw->g.width/ARROWHEAD_DIVIDER; arw[5].y = (gw->g.height + gw->g.height/ARROWBODY_DIVIDER)/2; + arw[6].x = gw->g.width/ARROWHEAD_DIVIDER; arw[6].y = gw->g.height-1; + + gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_fill); + gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_edge); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); } - void gwinButtonDraw_ArrowRight(GHandle gh, bool_t enabled, bool_t isdown, const char *txt, const GButtonDrawStyle *pstyle, void *param) { - (void) enabled; - (void) isdown; - (void) param; - point arw[7]; + void gwinButtonDraw_ArrowRight(GWidgetObject *gw, void *param) { + (void) param; + GButtonColors * pcol; + point arw[7]; - arw[0].x = gh->width-1; arw[0].y = gh->height/2; - arw[1].x = gh->width-1-gh->width/ARROWHEAD_DIVIDER; arw[1].y = 0; - arw[2].x = gh->width-1-gh->width/ARROWHEAD_DIVIDER; arw[2].y = (gh->height - gh->height/ARROWBODY_DIVIDER)/2; - arw[3].x = 0; arw[3].y = (gh->height - gh->height/ARROWBODY_DIVIDER)/2; - arw[4].x = 0; arw[4].y = (gh->height + gh->height/ARROWBODY_DIVIDER)/2; - arw[5].x = gh->width-1-gh->width/ARROWHEAD_DIVIDER; arw[5].y = (gh->height + gh->height/ARROWBODY_DIVIDER)/2; - arw[6].x = gh->width-1-gh->width/ARROWHEAD_DIVIDER; arw[6].y = gh->height-1; + if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; + pcol = getDrawColors(gw); - gdispFillConvexPoly(gh->x, gh->y, arw, 7, pstyle->color_fill); - gdispDrawPoly(gh->x, gh->y, arw, 7, pstyle->color_edge); - gdispDrawStringBox(gh->x+1, gh->y+1, gh->width-2, gh->height-2, txt, gh->font, pstyle->color_txt, justifyCenter); + arw[0].x = gw->g.width-1; arw[0].y = gw->g.height/2; + arw[1].x = gw->g.width-1-gw->g.width/ARROWHEAD_DIVIDER; arw[1].y = 0; + arw[2].x = gw->g.width-1-gw->g.width/ARROWHEAD_DIVIDER; arw[2].y = (gw->g.height - gw->g.height/ARROWBODY_DIVIDER)/2; + arw[3].x = 0; arw[3].y = (gw->g.height - gw->g.height/ARROWBODY_DIVIDER)/2; + arw[4].x = 0; arw[4].y = (gw->g.height + gw->g.height/ARROWBODY_DIVIDER)/2; + arw[5].x = gw->g.width-1-gw->g.width/ARROWHEAD_DIVIDER; arw[5].y = (gw->g.height + gw->g.height/ARROWBODY_DIVIDER)/2; + arw[6].x = gw->g.width-1-gw->g.width/ARROWHEAD_DIVIDER; arw[6].y = gw->g.height-1; + + gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_fill); + gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_edge); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); } #endif -#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - bool_t gwinAttachButtonMouse(GHandle gh, uint16_t instance) { - GSourceHandle gsh; +#if GDISP_NEED_IMAGE || defined(__DOXYGEN__) + void gwinButtonDraw_Image(GWidgetObject *gw, void *param) { + GButtonColors * pcol; + coord_t sy; - if (gh->type != GW_BUTTON || !(gsh = ginputGetMouse(instance))) - return FALSE; + if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; - return geventAttachSource(&((GButtonObject *)gh)->listener, gsh, GLISTEN_MOUSEMETA); - } -#endif + if (!(gw->g.flags & GWIN_FLG_ENABLED)) { + pcol = &((GButtonObject *)gw)->c_dis; + sy = 2 * gw->g.height; + } else if ((gw->g.flags & GBUTTON_FLG_PRESSED)) { + pcol = &((GButtonObject *)gw)->c_dn; + sy = gw->g.height; + } else { + pcol = &((GButtonObject *)gw)->c_up; + sy = 0; + } -#if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE - bool_t gwinAttachButtonToggle(GHandle gh, uint16_t instance) { - GSourceHandle gsh; - - if (gh->type != GW_BUTTON || !(gsh = ginputGetToggle(instance))) - return FALSE; - - return geventAttachSource(&((GButtonObject *)gh)->listener, gsh, GLISTEN_TOGGLE_OFF|GLISTEN_TOGGLE_ON); + gdispImageDraw((gdispImage *)param, gw->g.x, gw->g.y, gw->g.width, gw->g.height, 0, sy); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); } #endif diff --git a/src/gwin/checkbox.c b/src/gwin/checkbox.c index 547a30b5..d35f271c 100644 --- a/src/gwin/checkbox.c +++ b/src/gwin/checkbox.c @@ -7,7 +7,7 @@ /** * @file src/gwin/checkbox.c - * @brief GWIN sub-system checkbox code. + * @brief GWIN sub-system button code. * * @defgroup Checkbox Checkbox * @ingroup GWIN @@ -19,168 +19,137 @@ #if (GFX_USE_GWIN && GWIN_NEED_CHECKBOX) || defined(__DOXYGEN__) -static const GCheckboxColor defaultColors = { - Grey, // border - Grey, // selected - Black // background +#include "gwin/class_gwin.h" + +// Our checked state +#define GCHECKBOX_FLG_CHECKED (GWIN_FIRST_CONTROL_FLAG<<0) + +// Prototypes for button VMT functions +static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y); +static void ToggleOn(GWidgetObject *gw, uint16_t instance); + +// The button VMT table +static const gwidgetVMT checkboxVMT = { + { + "Checkbox", // The classname + _gwidgetDestroy, // The destroy routine + 0, // The after-clear routine + }, + gwinCheckboxDraw_CheckOnLeft, // The default drawing routine + MouseDown, // Process mouse down events + 0, // Process mouse up events (NOT USED) + 0, // Process mouse move events (NOT USED) + 0, // Process toggle off events (NOT USED) + ToggleOn, // Process toggle on events + 0, // Process dial move events (NOT USED) + 0, // Process all events (NOT USED) + 0, // AssignToggle (NOT USED) + 0, // AssignDial (NOT USED) }; -/* default style drawing routine */ -static void gwinCheckboxDrawDefaultStyle(GHandle gh, bool_t enabled, bool_t isChecked, void* param) { - #define gcw ((GCheckboxObject *)gh) +static const GCheckboxColors defaultColors = { + Black, // border + Grey, // selected + White, // background + Black, // text +}; - (void) enabled; - (void) param; +// Send the checkbox event +static void SendCheckboxEvent(GWidgetObject *gw) { + GSourceListener * psl; + GEvent * pe; + #define pce ((GEventGWinCheckbox *)pe) - gdispDrawBox(gh->x, gh->y, gh->width, gh->height, gcw->colors->border); - - if (isChecked) - gdispFillArea(gh->x+2, gh->y+2, gh->width-4, gh->height-4, gcw->colors->checked); - else - gdispFillArea(gh->x+2, gh->y+2, gh->width-4, gh->height-4, gcw->colors->bg); - - #undef gcw -} - -/* process an event callback */ -static void gwinCheckboxCallback(void *param, GEvent *pe) { - GSourceListener *psl; - #define gh ((GHandle)param) - #define gbw ((GCheckboxObject *)param) - #define gsh ((GSourceHandle)param) - #define pme ((GEventMouse *)pe) - #define pte ((GEventTouch *)pe) - #define pxe ((GEventToggle *)pe) - #define pbe ((GEventGWinCheckbox *)pe) - - /* check if checkbox is disabled */ - if (!gh->enabled) - return; - - switch (pe->type) { - #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - case GEVENT_MOUSE: - case GEVENT_TOUCH: - - // Ignore anything other than the primary mouse button going up or down - if (!((pme->current_buttons ^ pme->last_buttons) & GINPUT_MOUSE_BTN_LEFT)) - return; - - if ((pme->current_buttons & GINPUT_MOUSE_BTN_LEFT) - && pme->x >= gbw->gwin.x && pme->x < gbw->gwin.x + gbw->gwin.width - && pme->y >= gbw->gwin.y && pme->y < gbw->gwin.y + gbw->gwin.height) { - - gbw->isChecked = !gbw->isChecked; - - gwinCheckboxDraw((GHandle)param); - break; - } - return; - #endif /* GFX_USE_GINPUT && GINPUT_NEED_MOUSE */ - - default: - return; - } - - // Trigger a GWIN checkbox event + // Trigger a GWIN Checkbox Event psl = 0; - while ((psl = geventGetSourceListener(gsh, psl))) { + while ((psl = geventGetSourceListener((GSourceHandle)gw, psl))) { if (!(pe = geventGetEventBuffer(psl))) continue; - pbe->type = GEVENT_GWIN_CHECKBOX; - pbe->checkbox = gh; - pbe->isChecked = gbw->isChecked; + pce->type = GEVENT_GWIN_CHECKBOX; + pce->checkbox = &gw->g; + pce->isChecked = (gw->g.flags & GCHECKBOX_FLG_CHECKED) ? TRUE : FALSE; geventSendEvent(psl); - } + } - #undef gh - #undef pbe - #undef pme - #undef pte - #undef pxe - #undef gsh - #undef gbw + #undef pce } -GHandle gwinCheckboxCreate(GCheckboxObject *gb, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gb = (GCheckboxObject *)_gwinInit((GWindowObject *)gb, x, y, width, height, sizeof(GCheckboxObject)))) +// A mouse down has occurred over the checkbox +static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { + (void) x; (void) y; + gw->g.flags ^= GCHECKBOX_FLG_CHECKED; + gwinDraw((GHandle)gw); + SendCheckboxEvent(gw); +} + +// A toggle on has occurred +static void ToggleOn(GWidgetObject *gw, uint16_t instance) { + (void) instance; + gw->g.flags ^= GCHECKBOX_FLG_CHECKED; + gwinDraw((GHandle)gw); + SendCheckboxEvent(gw); +} + +GHandle gwinCreateCheckbox(GCheckboxObject *gb, coord_t x, coord_t y, coord_t width, coord_t height) { + if (!(gb = (GCheckboxObject *)_gwidgetInit((GWidgetObject *)gb, x, y, width, height, sizeof(GCheckboxObject), &checkboxVMT))) return 0; - gb->gwin.type = GW_CHECKBOX; // create a window of the type checkbox - gb->fn = gwinCheckboxDrawDefaultStyle; // set the default style drawing routine - gb->colors = &defaultColors; // asign the default colors - gb->param = 0; // some safe value here - gb->isChecked = GCHBX_UNCHECKED; // checkbox is currently unchecked - gb->gwin.enabled = TRUE; // checkboxes are enabled by default - - geventListenerInit(&gb->listener); - geventRegisterCallback(&gb->listener, gwinCheckboxCallback, gb); - - // checkboxes are enabled by default - gb->gwin.enabled = TRUE; - + gb->c = defaultColors; // assign the default colors return (GHandle)gb; } -void gwinCheckboxSetCustom(GHandle gh, GCheckboxDrawFunction fn, void *param) { - #define gcw ((GCheckboxObject *)gh) +bool_t gwinIsCheckboxChecked(GHandle gh) { + if (gh->vmt != (gwinVMT *)&checkboxVMT) + return FALSE; - if (gh->type != GW_CHECKBOX) - return; - - gcw->fn = fn; - gcw->param = param; - - #undef gcw + return (gh->flags & GCHECKBOX_FLG_CHECKED) ? TRUE : FALSE; } - -void gwinCheckboxSetEnabled(GHandle gh, bool_t enabled) { - if (gh->type != GW_CHECKBOX) +void gwinCheckboxSetColors(GHandle gh, GCheckboxColors *pColors) { + if (gh->vmt != (gwinVMT *)&checkboxVMT) return; - gh->enabled = enabled; + ((GCheckboxObject *)gh)->c = *pColors; } -void gwinCheckboxDraw(GHandle gh) { - #define gcw ((GCheckboxObject *)gh) +void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param) { + #define gcw ((GCheckboxObject *)gw) + coord_t ld, df; + (void) param; - if (gh->type != GW_CHECKBOX) + if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return; - #if GDISP_NEED_CLIP - //gdispSetClip(gh->x, gh->y, gh->width, gh->height); - #endif + ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height; + gdispFillArea(gw->g.x+1, gw->g.y+1, ld, ld-2, gcw->c.color_bg); + gdispDrawBox(gw->g.x, gw->g.y, ld, ld, gcw->c.color_border); - gcw->fn(gh, - gcw->gwin.enabled, - gcw->isChecked, - gcw->param); + df = ld < 4 ? 1 : 2; + if (gw->g.flags & GCHECKBOX_FLG_CHECKED) + gdispFillArea(gw->g.x+df, gw->g.y+df, ld-2*df, ld-2*df, gcw->c.color_checked); + gdispFillStringBox(gw->g.x+ld+1, gw->g.y, gw->g.width-ld-1, gw->g.height, gw->txt, gw->g.font, gcw->c.color_txt, gcw->c.color_bg, justifyLeft); #undef gcw } -#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - bool_t gwinCheckboxAttachMouse(GHandle gh, uint16_t instance) { - GSourceHandle gsh; +void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) { + #define gcw ((GCheckboxObject *)gw) + coord_t ep, ld, df; + (void) param; - if (gh->type != GW_CHECKBOX || !(gsh = ginputGetMouse(instance))) - return FALSE; - - return geventAttachSource(&((GCheckboxObject *)gh)->listener, gsh, GLISTEN_MOUSEMETA); - } -#endif - -void gwinCheckboxSetColors(GHandle gh, color_t border, color_t checked, color_t bg) { - #define gcw ((GCheckboxObject *)gh) - - if (gh->type != GW_CHECKBOX) + if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return; - gcw->colors->border = border; - gcw->colors->checked = checked, - gcw->colors->bg = bg; + ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height; + ep = gw->g.width-ld-1; + gdispFillArea(gw->g.x+ep-1, gw->g.y+1, ld, ld-2, gcw->c.color_bg); + gdispDrawBox(gw->g.x+ep, gw->g.y, ld, ld, gcw->c.color_border); + df = ld < 4 ? 1 : 2; + if (gw->g.flags & GCHECKBOX_FLG_CHECKED) + gdispFillArea(gw->g.x+ep+df, gw->g.y+df, ld-2*df, ld-2*df, gcw->c.color_checked); + + gdispFillStringBox(gw->g.x, gw->g.y, ep, gw->g.height, gw->txt, gw->g.font, gcw->c.color_txt, gcw->c.color_bg, justifyRight); #undef gcw } diff --git a/src/gwin/console.c b/src/gwin/console.c index 5c068c93..d9bda362 100644 --- a/src/gwin/console.c +++ b/src/gwin/console.c @@ -8,20 +8,15 @@ /** * @file src/gwin/console.c * @brief GWIN sub-system console code. - * - * @defgroup Console Console - * @ingroup GWIN - * - * @{ */ #include "gfx.h" -#if (GFX_USE_GWIN && GWIN_NEED_CONSOLE) || defined(__DOXYGEN__) +#if GFX_USE_GWIN && GWIN_NEED_CONSOLE #include -#include "gwin/internal.h" +#include "gwin/class_gwin.h" #define GWIN_CONSOLE_USE_CLEAR_LINES TRUE #define GWIN_CONSOLE_USE_FILLED_CHARS FALSE @@ -58,11 +53,20 @@ }; #endif -GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height, font_t font) { - if (!(gc = (GConsoleObject *)_gwinInit((GWindowObject *)gc, x, y, width, height, sizeof(GConsoleObject)))) +static void AfterClear(GWindowObject *gh) { + ((GConsoleObject *)gh)->cx = 0; + ((GConsoleObject *)gh)->cy = 0; +} + +static const gwinVMT consoleVMT = { + "Console", // The classname + 0, // The destroy routine + AfterClear, // The after-clear routine +}; + +GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height) { + if (!(gc = (GConsoleObject *)_gwinInit((GWindowObject *)gc, x, y, width, height, sizeof(GConsoleObject), &consoleVMT))) return 0; - gc->gwin.type = GW_CONSOLE; - gwinSetFont(&gc->gwin, font); #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM gc->stream.vmt = &GWindowConsoleVMT; #endif @@ -73,17 +77,21 @@ GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t widt #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM BaseSequentialStream *gwinGetConsoleStream(GHandle gh) { - if (gh->type != GW_CONSOLE) + if (gh->vmt != &consoleVMT) return 0; return (BaseSequentialStream *)&(((GConsoleObject *)(gh))->stream); } #endif void gwinPutChar(GHandle gh, char c) { - uint8_t width; #define gcw ((GConsoleObject *)gh) + uint8_t width, fy, fp; - if (gh->type != GW_CONSOLE || !gh->font) return; + if (gh->vmt != &consoleVMT || !gh->font) + return; + + fy = gdispGetFontMetric(gh->font, fontHeight); + fp = gdispGetFontMetric(gh->font, fontCharPadding); #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); @@ -91,24 +99,24 @@ void gwinPutChar(GHandle gh, char c) { if (c == '\n') { gcw->cx = 0; - gcw->cy += gcw->fy; + gcw->cy += fy; // We use lazy scrolling here and only scroll when the next char arrives } else if (c == '\r') { // gcw->cx = 0; } else { - width = gdispGetCharWidth(c, gh->font) + gcw->fp; + width = gdispGetCharWidth(c, gh->font) + fp; if (gcw->cx + width >= gh->width) { gcw->cx = 0; - gcw->cy += gcw->fy; + gcw->cy += fy; } - if (gcw->cy + gcw->fy > gh->height) { + if (gcw->cy + fy > gh->height) { #if GDISP_NEED_SCROLL /* scroll the console */ - gdispVerticalScroll(gh->x, gh->y, gh->width, gh->height, gcw->fy, gh->bgcolor); + gdispVerticalScroll(gh->x, gh->y, gh->width, gh->height, fy, gh->bgcolor); /* reset the cursor to the start of the last line */ gcw->cx = 0; - gcw->cy = (((coord_t)(gh->height/gcw->fy))-1)*gcw->fy; + gcw->cy = (((coord_t)(gh->height/fy))-1)*fy; #else /* clear the console */ gdispFillArea(gh->x, gh->y, gh->width, gh->height, gh->bgcolor); @@ -121,7 +129,7 @@ void gwinPutChar(GHandle gh, char c) { #if GWIN_CONSOLE_USE_CLEAR_LINES /* clear to the end of the line */ if (gcw->cx == 0) - gdispFillArea(gh->x, gh->y + gcw->cy, gh->width, gcw->fy, gh->bgcolor); + gdispFillArea(gh->x, gh->y + gcw->cy, gh->width, fy, gh->bgcolor); #endif #if GWIN_CONSOLE_USE_FILLED_CHARS gdispFillChar(gh->x + gcw->cx, gh->y + gcw->cy, c, gh->font, gh->color, gh->bgcolor); @@ -200,7 +208,8 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { char tmpbuf[MAX_FILLER + 1]; #endif - if (gh->type != GW_CONSOLE || !gh->font) return; + if (gh->vmt != &consoleVMT || !gh->font) + return; va_start(ap, fmt); while (TRUE) { @@ -343,5 +352,5 @@ void gwinPrintf(GHandle gh, const char *fmt, ...) { } #endif /* GFX_USE_GWIN && GWIN_NEED_CONSOLE */ -/** @} */ + diff --git a/src/gwin/graph.c b/src/gwin/graph.c index 287deba9..0ae9822b 100644 --- a/src/gwin/graph.c +++ b/src/gwin/graph.c @@ -8,18 +8,13 @@ /** * @file src/gwin/graph.c * @brief GWIN sub-system button code. - * - * @defgroup Graph Graph - * @ingroup GWIN - * - * @{ */ #include "gfx.h" -#if (GFX_USE_GWIN && GWIN_NEED_GRAPH) || defined(__DOXYGEN__) +#if GFX_USE_GWIN && GWIN_NEED_GRAPH -#include "gwin/internal.h" +#include "gwin/class_gwin.h" #define GGRAPH_FLG_CONNECTPOINTS (GWIN_FIRST_CONTROL_FLAG<<0) #define GGRAPH_ARROW_SIZE 5 @@ -34,13 +29,19 @@ static const GGraphStyle GGraphDefaultStyle = { GWIN_GRAPH_STYLE_XAXIS_ARROWS|GWIN_GRAPH_STYLE_YAXIS_ARROWS // flags }; +static const gwinVMT graphVMT = { + "Graph", // The classname + 0, // The destroy routine + 0, // The after-clear routine +}; + static void pointto(GGraphObject *gg, coord_t x, coord_t y, const GGraphPointStyle *style) { if (style->type == GGRAPH_POINT_NONE) return; // Convert to device space. Note the y-axis is inverted. - x += gg->gwin.x + gg->xorigin; - y = gg->gwin.y + gg->gwin.height - 1 - gg->yorigin - y; + x += gg->g.x + gg->xorigin; + y = gg->g.y + gg->g.height - 1 - gg->yorigin - y; if (style->size <= 1) { gdispDrawPixel(x, y, style->color); @@ -73,10 +74,10 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t return; // Convert to device space. Note the y-axis is inverted. - x0 += gg->gwin.x + gg->xorigin; - y0 = gg->gwin.y + gg->gwin.height - 1 - gg->yorigin - y0; - x1 += gg->gwin.x + gg->xorigin; - y1 = gg->gwin.y + gg->gwin.height - 1 - gg->yorigin - y1; + x0 += gg->g.x + gg->xorigin; + y0 = gg->g.y + gg->g.height - 1 - gg->yorigin - y0; + x1 += gg->g.x + gg->xorigin; + y1 = gg->g.y + gg->g.height - 1 - gg->yorigin - y1; if (style->size <= 0) { // Use the driver to draw a solid line @@ -163,41 +164,26 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t } GHandle gwinCreateGraph(GGraphObject *gg, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gg = (GGraphObject *)_gwinInit((GWindowObject *)gg, x, y, width, height, sizeof(GGraphObject)))) + if (!(gg = (GGraphObject *)_gwinInit((GWindowObject *)gg, x, y, width, height, sizeof(GGraphObject), &graphVMT))) return 0; - gg->gwin.type = GW_GRAPH; gg->xorigin = gg->yorigin = 0; gg->lastx = gg->lasty = 0; - gwinGraphSetStyle(&gg->gwin, &GGraphDefaultStyle); + gwinGraphSetStyle((GHandle)gg, &GGraphDefaultStyle); return (GHandle)gg; } void gwinGraphSetStyle(GHandle gh, const GGraphStyle *pstyle) { #define gg ((GGraphObject *)gh) - if (gh->type != GW_GRAPH) + if (gh->vmt != &graphVMT) return; - gg->style.point.type = pstyle->point.type; - gg->style.point.size = pstyle->point.size; - gg->style.point.color = pstyle->point.color; - gg->style.line.type = pstyle->line.type; - gg->style.line.size = pstyle->line.size; - gg->style.line.color = pstyle->line.color; - gg->style.xaxis.type = pstyle->xaxis.type; - gg->style.xaxis.size = pstyle->xaxis.size; - gg->style.xaxis.color = pstyle->xaxis.color; - gg->style.yaxis.type = pstyle->yaxis.type; - gg->style.yaxis.size = pstyle->yaxis.size; - gg->style.yaxis.color = pstyle->yaxis.color; - gg->style.xgrid.type = pstyle->xgrid.type; - gg->style.xgrid.size = pstyle->xgrid.size; - gg->style.xgrid.color = pstyle->xgrid.color; - gg->style.xgrid.spacing = pstyle->xgrid.spacing; - gg->style.ygrid.type = pstyle->ygrid.type; - gg->style.ygrid.size = pstyle->ygrid.size; - gg->style.ygrid.color = pstyle->ygrid.color; - gg->style.ygrid.spacing = pstyle->ygrid.spacing; + gg->style.point = pstyle->point; + gg->style.line = pstyle->line; + gg->style.xaxis = pstyle->xaxis; + gg->style.yaxis = pstyle->yaxis; + gg->style.xgrid = pstyle->xgrid; + gg->style.ygrid = pstyle->ygrid; gg->style.flags = pstyle->flags; #undef gg @@ -206,7 +192,7 @@ void gwinGraphSetStyle(GHandle gh, const GGraphStyle *pstyle) { void gwinGraphSetOrigin(GHandle gh, coord_t x, coord_t y) { #define gg ((GGraphObject *)gh) - if (gh->type != GW_GRAPH) + if (gh->vmt != &graphVMT) return; gg->xorigin = x; @@ -219,7 +205,7 @@ void gwinGraphDrawAxis(GHandle gh) { #define gg ((GGraphObject *)gh) coord_t i, xmin, ymin, xmax, ymax; - if (gh->type != GW_GRAPH) + if (gh->vmt != &graphVMT) return; xmin = -gg->xorigin; @@ -277,7 +263,7 @@ void gwinGraphDrawAxis(GHandle gh) { } void gwinGraphStartSet(GHandle gh) { - if (gh->type != GW_GRAPH) + if (gh->vmt != &graphVMT) return; gh->flags &= ~GGRAPH_FLG_CONNECTPOINTS; @@ -286,7 +272,7 @@ void gwinGraphStartSet(GHandle gh) { void gwinGraphDrawPoint(GHandle gh, coord_t x, coord_t y) { #define gg ((GGraphObject *)gh) - if (gh->type != GW_GRAPH) + if (gh->vmt != &graphVMT) return; if ((gh->flags & GGRAPH_FLG_CONNECTPOINTS)) { @@ -314,7 +300,7 @@ void gwinGraphDrawPoints(GHandle gh, const point *points, unsigned count) { unsigned i; const point *p; - if (gh->type != GW_GRAPH) + if (gh->vmt != &graphVMT) return; // Draw the connecting lines @@ -344,5 +330,3 @@ void gwinGraphDrawPoints(GHandle gh, const point *points, unsigned count) { } #endif /* GFX_USE_GWIN && GWIN_NEED_GRAPH */ -/** @} */ - diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c new file mode 100644 index 00000000..464210b7 --- /dev/null +++ b/src/gwin/gwidget.c @@ -0,0 +1,254 @@ +/* + * This file is subject to the terms of the GFX License, v1.0. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ + +#include "gfx.h" + +#if GFX_USE_GWIN + +#include + +#include "gwin/class_gwin.h" + +/* We use these everywhere in this file */ +#define gw ((GWidgetObject *)gh) +#define wvmt ((gwidgetVMT *)gh->vmt) + +static void gwidgetCallback(void *param, GEvent *pe) { + #define gh ((GWindowObject *)param) + #define pme ((GEventMouse *)pe) + #define pte ((GEventToggle *)pe) + #define pde ((GEventDial *)pe) + + // check if widget is disabled + if (!(gw->g.flags & GWIN_FLG_ENABLED)) + return; + + // Process via AllEvents() if it is defined + if (wvmt->AllEvents) + wvmt->AllEvents(gw, pe); + + // Process various events + switch (pe->type) { + + #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE + case GEVENT_MOUSE: + case GEVENT_TOUCH: + // Are we captured? + if ((gw->g.flags & GWIN_FLG_MOUSECAPTURE)) { + if (pme->meta == GMETA_MOUSE_UP) { + gw->g.flags &= ~GWIN_FLG_MOUSECAPTURE; + if (wvmt->MouseUp) + wvmt->MouseUp(gw, pme->x - gw->g.x, pme->y - gw->g.y); + return; + } else if (wvmt->MouseMove) + wvmt->MouseMove(gw, pme->x - gw->g.x, pme->y - gw->g.y); + + // We are not captured - look for mouse downs over the widget + } else if (pme->meta == GMETA_MOUSE_DOWN + && pme->x >= gw->g.x && pme->x < gw->g.x + gw->g.width + && pme->y >= gw->g.y && pme->y < gw->g.y + gw->g.height) { + gw->g.flags |= GWIN_FLG_MOUSECAPTURE; + if (wvmt->MouseDown) + wvmt->MouseDown(gw, pme->x - gw->g.x, pme->y - gw->g.y); + } + break; + #endif + + #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE + case GEVENT_TOGGLE: + if (pte->on) { + if (wvmt->ToggleOn) + wvmt->ToggleOn(gw, pte->instance); + } else { + if (wvmt->ToggleOff) + wvmt->ToggleOff(gw, pte->instance); + } + break; + #endif + + #if GFX_USE_GINPUT && GINPUT_NEED_DIAL + case GEVENT_DIAL: + if (wvmt->DialMove) + wvmt->DialMove(gw, pde->instance, pde->value); + break; + #endif + + default: + break; + } + #undef gh + #undef pme + #undef pte + #undef pde +} + +GHandle _gwidgetInit(GWidgetObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size, const gwidgetVMT *vmt) { + if (!(pgw = (GWidgetObject *)_gwinInit((GWindowObject *)pgw, x, y, width, height, size, (const gwinVMT *)vmt))) + return 0; + + pgw->g.flags |= (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED); + pgw->txt = ""; + pgw->fnDraw = vmt->DefaultDraw; + pgw->fnParam = 0; + geventListenerInit(&pgw->listener); + geventRegisterCallback(&pgw->listener, gwidgetCallback, pgw); + + return (GHandle)pgw; +} + +void _gwidgetDestroy(GHandle gh) { + if (!(gh->flags & GWIN_FLG_WIDGET)) + return; + + // Deallocate the text (if necessary) + if ((gh->flags & GWIN_FLG_ALLOCTXT)) { + gh->flags &= ~GWIN_FLG_ALLOCTXT; + gfxFree((void *)gw->txt); + } + // Untangle the listeners (both on us and to us). + geventDetachSource(&gw->listener, 0); + geventDetachSourceListeners((GSourceHandle)gh); + gh->flags &= ~GWIN_FLG_WIDGET; +} + +void gwinSetEnabled(GHandle gh, bool_t enabled) { + if (!(gh->flags & GWIN_FLG_WIDGET)) + return; + + if (enabled) + gh->flags |= GWIN_FLG_ENABLED; + else + gh->flags &= ~GWIN_FLG_ENABLED; +} + +void gwinDraw(GHandle gh) { + if (!(gh->flags & GWIN_FLG_WIDGET)) + return; + + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + + gw->fnDraw(gw, gw->fnParam); +} + +void gwinSetText(GHandle gh, const char *txt, bool_t useAlloc) { + if (!(gh->flags & GWIN_FLG_WIDGET)) + return; + + // Dispose of the old string + if ((gh->flags & GWIN_FLG_ALLOCTXT)) { + gh->flags &= ~GWIN_FLG_ALLOCTXT; + if (gw->txt) { + gfxFree((void *)gw->txt); + gw->txt = ""; + } + } + + // Alloc the new text if required + if (txt && !*txt) txt = 0; + if (txt && useAlloc) { + char *str; + + if ((str = (char *)gfxAlloc(strlen(txt)+1))) { + gh->flags |= GWIN_FLG_ALLOCTXT; + strcpy(str, txt); + } + txt = (const char *)str; + } + + gw->txt = txt ? txt : ""; +} + +const char *gwinGetText(GHandle gh) { + if (!(gh->flags & GWIN_FLG_WIDGET)) + return 0; + + return gw->txt; +} + +void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param) { + if (!(gh->flags & GWIN_FLG_WIDGET)) + return; + + gw->fnDraw = fn ? fn : wvmt->DefaultDraw; + gw->fnParam = param; +} + +bool_t gwinAttachListener(GHandle gh, GListener *pl, unsigned flags) { + if (!(gh->flags & GWIN_FLG_WIDGET)) + return FALSE; + + return geventAttachSource(pl, (GSourceHandle)gh, flags); +} + +#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE + bool_t gwinAttachMouse(GHandle gh, uint16_t instance) { + GSourceHandle gsh; + unsigned flags; + + if (!(gh->flags & GWIN_FLG_WIDGET)) + return FALSE; + + if (!wvmt->MouseDown && !wvmt->MouseMove && !wvmt->MouseUp) + return FALSE; + + if (!(gsh = ginputGetMouse(instance))) + return FALSE; + + flags = wvmt->MouseMove ? (GLISTEN_MOUSEMETA|GLISTEN_MOUSEDOWNMOVES) : GLISTEN_MOUSEMETA; + return geventAttachSource(&gw->listener, gsh, flags); + } +#endif + +#if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE + bool_t gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance) { + GSourceHandle gsh; + unsigned flags; + + if (!(gh->flags & GWIN_FLG_WIDGET)) + return FALSE; + + flags = 0; + if (wvmt->ToggleOff) flags |= GLISTEN_TOGGLE_OFF; + if (wvmt->ToggleOn) flags |= GLISTEN_TOGGLE_ON; + if (!flags) + return FALSE; + + if (!(gsh = ginputGetToggle(instance))) + return FALSE; + + if (wvmt->AssignToggle && !wvmt->AssignToggle(gw, role, instance)) + return FALSE; + + return geventAttachSource(&gw->listener, gsh, flags); + } +#endif + +#if GFX_USE_GINPUT && GINPUT_NEED_DIAL + bool_t gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance) { + GSourceHandle gsh; + + if (!(gh->flags & GWIN_FLG_WIDGET)) + return FALSE; + + if (!wvmt->DialMove) + return FALSE; + + if (!(gsh = ginputGetDial(instance))) + return FALSE; + + if (wvmt->AssignDial && !wvmt->AssignDial(gw, role, instance)) + return FALSE; + + return geventAttachSource(&gw->listener, gsh, 0); + } +#endif + +#endif /* GFX_USE_GWIN */ +/** @} */ + diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index c01c8a90..fcbaa397 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -9,11 +9,19 @@ #if GFX_USE_GWIN -#include "gwin/internal.h" +#include "gwin/class_gwin.h" + +static const gwinVMT basegwinVMT = { + "GWIN", // The classname + 0, // The destroy routine + 0, // The after-clear routine +}; + +static font_t defaultFont; // Internal routine for use by GWIN components only // Initialise a window creating it dynamicly if required. -GHandle _gwinInit(GWindowObject *gw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size) { +GHandle _gwinInit(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size, const gwinVMT *vmt) { coord_t w, h; // Check the window size against the screen size @@ -26,60 +34,34 @@ GHandle _gwinInit(GWindowObject *gw, coord_t x, coord_t y, coord_t width, coord_ if (y+height > h) height = h - y; // Allocate the structure if necessary - if (!gw) { - if (!(gw = (GWindowObject *)gfxAlloc(size))) + if (!pgw) { + if (!(pgw = (GWindowObject *)gfxAlloc(size))) return 0; - gw->flags = GWIN_FLG_DYNAMIC; + pgw->flags = GWIN_FLG_DYNAMIC; } else - gw->flags = 0; + pgw->flags = 0; - // Initialise all basic fields (except the type) - gw->x = x; - gw->y = y; - gw->width = width; - gw->height = height; - gw->color = White; - gw->bgcolor = Black; + // Initialise all basic fields + pgw->vmt = vmt; + pgw->x = x; + pgw->y = y; + pgw->width = width; + pgw->height = height; + pgw->color = White; + pgw->bgcolor = Black; #if GDISP_NEED_TEXT - gw->font = 0; + pgw->font = defaultFont; #endif - return (GHandle)gw; + return (GHandle)pgw; } -GHandle gwinCreateWindow(GWindowObject *gw, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gw = (GWindowObject *)_gwinInit((GWindowObject *)gw, x, y, width, height, sizeof(GWindowObject)))) - return 0; - gw->type = GW_WINDOW; - return (GHandle)gw; +GHandle gwinCreateWindow(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height) { + return _gwinInit(pgw, x, y, width, height, sizeof(GWindowObject), &basegwinVMT); } -void gwinSetEnabled(GHandle gh, bool_t enabled) { - (void)gh; - (void)enabled; -} - -void gwinDestroyWindow(GHandle gh) { - // Clean up any type specific dynamic memory allocations - switch(gh->type) { -#if GWIN_NEED_BUTTON - case GW_BUTTON: - if ((gh->flags & GBTN_FLG_ALLOCTXT)) { - gh->flags &= ~GBTN_FLG_ALLOCTXT; // To be sure, to be sure - gfxFree((void *)((GButtonObject *)gh)->txt); - } - geventDetachSource(&((GButtonObject *)gh)->listener, 0); - geventDetachSourceListeners((GSourceHandle)gh); - break; -#endif -#if GWIN_NEED_SLIDER - case GW_SLIDER: - geventDetachSource(&((GSliderObject *)gh)->listener, 0); - geventDetachSourceListeners((GSourceHandle)gh); - break; -#endif - default: - break; - } +void gwinDestroy(GHandle gh) { + if (gh->vmt->Destroy) + gh->vmt->Destroy(gh); // Clean up the structure if (gh->flags & GWIN_FLG_DYNAMIC) { @@ -88,30 +70,17 @@ void gwinDestroyWindow(GHandle gh) { } } -void gwinDraw(GHandle gh) { - switch(gh->type) { - #if GWIN_NEED_BUTTON - case GW_BUTTON: - gwinButtonDraw(gh); - break; - #endif - #if GWIN_NEED_SLIDER - case GW_SLIDER: - gwinSliderDraw(gh); - break; - #endif - } +const char *gwinGetClassName(GHandle gh) { + return gh->vmt->classname; } #if GDISP_NEED_TEXT + void gwinSetDefaultFont(font_t font) { + defaultFont = font; + } + void gwinSetFont(GHandle gh, font_t font) { gh->font = font; - #if GWIN_NEED_CONSOLE - if (font && gh->type == GW_CONSOLE) { - ((GConsoleObject *)gh)->fy = gdispGetFontMetric(font, fontHeight); - ((GConsoleObject *)gh)->fp = gdispGetFontMetric(font, fontCharPadding); - } - #endif } #endif @@ -120,13 +89,8 @@ void gwinClear(GHandle gh) { gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif gdispFillArea(gh->x, gh->y, gh->width, gh->height, gh->bgcolor); - - #if GWIN_NEED_CONSOLE - if (gh->type == GW_CONSOLE) { - ((GConsoleObject *)gh)->cx = 0; - ((GConsoleObject *)gh)->cy = 0; - } - #endif + if (gh->vmt->AfterClear) + gh->vmt->AfterClear(gh); } void gwinDrawPixel(GHandle gh, coord_t x, coord_t y) { diff --git a/src/gwin/gwin.mk b/src/gwin/gwin.mk index be6301c6..90a8e9b4 100644 --- a/src/gwin/gwin.mk +++ b/src/gwin/gwin.mk @@ -1,7 +1,8 @@ GFXSRC += $(GFXLIB)/src/gwin/gwin.c \ + $(GFXLIB)/src/gwin/gwidget.c \ $(GFXLIB)/src/gwin/console.c \ + $(GFXLIB)/src/gwin/graph.c \ $(GFXLIB)/src/gwin/button.c \ $(GFXLIB)/src/gwin/slider.c \ - $(GFXLIB)/src/gwin/graph.c \ $(GFXLIB)/src/gwin/checkbox.c \ diff --git a/src/gwin/slider.c b/src/gwin/slider.c index 1f252d77..f18c665b 100644 --- a/src/gwin/slider.c +++ b/src/gwin/slider.c @@ -19,140 +19,168 @@ #if (GFX_USE_GWIN && GWIN_NEED_SLIDER) || defined(__DOXYGEN__) -#include "gwin/internal.h" +#include "gwin/class_gwin.h" #ifndef GWIN_SLIDER_DEAD_BAND #define GWIN_SLIDER_DEAD_BAND 5 #endif -#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - static void trackSliderDraw(GHandle gh, coord_t x, coord_t y); -#endif +// Prototypes for slider VMT functions +static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y); +static void MouseMove(GWidgetObject *gw, coord_t x, coord_t y); +static void DialMove(GWidgetObject *gw, uint16_t instance, uint16_t value); -static const GSliderDrawStyle GSliderDefaultStyle = { - HTML2COLOR(0x404040), // color_edge; - HTML2COLOR(0x000000), // color_thumb; - HTML2COLOR(0x00E000), // color_active; - HTML2COLOR(0xE0E0E0), // color_inactive; +// The button VMT table +static const gwidgetVMT sliderVMT = { + { + "Slider", // The classname + _gwidgetDestroy, // The destroy routine + 0, // The after-clear routine + }, + gwinSliderDraw_Std, // The default drawing routine + MouseMove, // Process mouse down events (AS MOUSEMOVE) + MouseUp, // Process mouse up events + MouseMove, // Process mouse move events + 0, // Process toggle off events (NOT USED) + 0, // Process toggle on events (NOT USED) + DialMove, // Process dial move events + 0, // Process all events (NOT USED) + 0, // AssignToggle (NOT USED) + 0, // AssignDial (NOT USED) }; -// Process an event callback -static void gwinSliderCallback(void *param, GEvent *pe) { - GSourceListener *psl; - #define gh ((GHandle)param) - #define gsw ((GSliderObject *)param) - #define gsh ((GSourceHandle)param) - #define pme ((GEventMouse *)pe) - #define pde ((GEventDial *)pe) - #define pse ((GEventGWinSlider *)pe) +static const GSliderColors GSliderDefaultColors = { + HTML2COLOR(0x404040), // color_edge + HTML2COLOR(0x000000), // color_thumb + HTML2COLOR(0x00E000), // color_active + HTML2COLOR(0xE0E0E0), // color_inactive + HTML2COLOR(0xFFFFFF), // color_txt +}; - switch (pe->type) { - #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - case GEVENT_MOUSE: - case GEVENT_TOUCH: - // If not tracking we only only interested in a mouse down over the slider - if (!gsw->tracking) { - if ((pme->meta & GMETA_MOUSE_DOWN) - && pme->x >= gh->x && pme->x < gh->x + gh->width - && pme->y >= gh->y && pme->y < gh->y + gh->height) { - gsw->tracking = TRUE; - trackSliderDraw(gh, pme->x-gh->x, pme->y-gh->y); - } - return; - } +// Send the slider event +static void SendSliderEvent(GWidgetObject *gw) { + GSourceListener * psl; + GEvent * pe; + #define pse ((GEventGWinSlider *)pe) - // We are tracking the mouse - - // Test for button up - if ((pme->meta & GMETA_MOUSE_UP)) { - gsw->tracking = FALSE; - - #if !GWIN_BUTTON_LAZY_RELEASE - // Are we over the slider? - if (pme->x < gh->x || pme->x >= gh->x + gh->width - || pme->y < gh->y || pme->y >= gh->y + gh->height) { - // No - restore the slider - gwinSliderDraw(gh); - return; - } - #endif - - // Set the new position - if (gh->width < gh->height) - gwinSetSliderPosition(gh, - (uint16_t)((uint32_t)(gh->height-1-pme->y+gh->y-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->height-2*GWIN_SLIDER_DEAD_BAND) + gsw->min)); - else - gwinSetSliderPosition(gh, - (uint16_t)((uint32_t)(pme->x-gh->x-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->width-2*GWIN_SLIDER_DEAD_BAND) + gsw->min)); - - // Update the display - gwinSliderDraw(gh); - - // Generate the event - break; - } - - // If mouse down - track movement - if ((pme->current_buttons & GINPUT_MOUSE_BTN_LEFT)) - trackSliderDraw(gh, pme->x-gh->x, pme->y-gh->y); - - return; - #endif - #if GFX_USE_GINPUT && GINPUT_NEED_DIAL - case GEVENT_DIAL: - // Set the new position - gwinSetSliderPosition(gh, (uint16_t)((uint32_t)pde->value*(gsw->max-gsw->min)/ginputGetDialRange(pde->instance) + gsw->min)); - - // Update the display - gwinSliderDraw(gh); - - // Generate the event - break; - #endif - - default: - return; - } - - // Trigger a GWIN Slider Event + // Trigger a GWIN Button Event psl = 0; - while ((psl = geventGetSourceListener(gsh, psl))) { + while ((psl = geventGetSourceListener((GSourceHandle)gw, psl))) { if (!(pe = geventGetEventBuffer(psl))) continue; pse->type = GEVENT_GWIN_SLIDER; - pse->slider = gh; - pse->position = gsw->pos; + pse->slider = (GHandle)gw; + pse->position = ((GSliderObject *)gw)->pos; geventSendEvent(psl); } - #undef pse - #undef pme - #undef pxe - #undef gsh - #undef gsw + #undef pbe +} + +// Reset the display position back to the value predicted by the saved slider position +static void ResetDisplayPos(GSliderObject *gsw) { + if (gsw->w.g.width < gsw->w.g.height) + gsw->dpos = gsw->w.g.height-1-((gsw->w.g.height-1)*(gsw->pos-gsw->min))/(gsw->max-gsw->min); + else + gsw->dpos = ((gsw->w.g.width-1)*(gsw->pos-gsw->min))/(gsw->max-gsw->min); +} + +// A mouse up event +static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { + #define gsw ((GSliderObject *)gw) + #define gh ((GHandle)gw) + + #if GWIN_BUTTON_LAZY_RELEASE + // Clip to the slider + if (x < 0) x = 0; + else if (x >= gh->width) x = gh->width-1; + if (y < 0) y = 0; + else if (y >= gh->height) x = gh->height-1; + #else + // Are we over the slider? + if (x < 0 || x >= gh->width || y < 0 || y >= gh->height) { + // No - restore the slider + ResetDisplayPos(gsw); + gwinDraw(gh); + return; + } + #endif + + // Set the new position + if (gh->width < gh->height) + gsw->pos = (uint16_t)((uint32_t)(gh->height-1-y-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->height-2*GWIN_SLIDER_DEAD_BAND) + gsw->min); + else + gsw->pos = (uint16_t)((uint32_t)(x-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->width-2*GWIN_SLIDER_DEAD_BAND) + gsw->min); + + ResetDisplayPos(gsw); + gwinDraw(gh); + + // Generate the event + SendSliderEvent(gw); #undef gh + #undef gsw +} + +// A mouse move (or mouse down) event +static void MouseMove(GWidgetObject *gw, coord_t x, coord_t y) { + #define gsw ((GSliderObject *)gw) + + // Determine the temporary display position (with range checking) + if (gw->g.width < gw->g.height) { + if (y < 0) + gsw->dpos = 0; + else if (y >= gw->g.height) + gsw->dpos = gw->g.height-1; + else + gsw->dpos = y; + } else { + if (x < 0) + gsw->dpos = 0; + else if (x >= gw->g.width) + gsw->dpos = gw->g.width-1; + else + gsw->dpos = x; + } + + // Update the display + gwinDraw(&gw->g); + #undef gsw +} + +// A dial move event +static void DialMove(GWidgetObject *gw, uint16_t instance, uint16_t value) { +#if GFX_USE_GINPUT && GINPUT_NEED_DIAL + #define gsw ((GSliderObject *)gw) + + // Set the new position + gsw->pos = (uint16_t)((uint32_t)value*(gsw->max-gsw->min)/ginputGetDialRange(instance) + gsw->min); + + ResetDisplayPos(gsw); + gwinDraw(&gw->g); + + // Generate the event + SendSliderEvent(gw); + #undef gsw +#else + (void)gw; (void)instance; (void)value; +#endif } GHandle gwinCreateSlider(GSliderObject *gs, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gs = (GSliderObject *)_gwinInit((GWindowObject *)gs, x, y, width, height, sizeof(GSliderObject)))) + if (!(gs = (GSliderObject *)_gwidgetInit((GWidgetObject *)gs, x, y, width, height, sizeof(GSliderObject), &sliderVMT))) return 0; - gs->gwin.type = GW_SLIDER; - gs->fn = gwinSliderDraw_Std; - gs->param = 0; - gwinSetSliderStyle(&gs->gwin, &GSliderDefaultStyle); + gs->c = GSliderDefaultColors; gs->min = 0; gs->max = 100; gs->pos = 0; - gs->tracking = FALSE; - geventListenerInit(&gs->listener); - geventRegisterCallback(&gs->listener, gwinSliderCallback, gs); + ResetDisplayPos(gs); return (GHandle)gs; } void gwinSetSliderRange(GHandle gh, int min, int max) { #define gsw ((GSliderObject *)gh) - if (gh->type != GW_SLIDER) + if (gh->vmt != (gwinVMT *)&sliderVMT) return; if (min == max) // prevent divide by 0 errors. @@ -160,13 +188,14 @@ void gwinSetSliderRange(GHandle gh, int min, int max) { gsw->min = min; gsw->max = max; gsw->pos = min; + ResetDisplayPos(gsw); #undef gsw } void gwinSetSliderPosition(GHandle gh, int pos) { #define gsw ((GSliderObject *)gh) - if (gh->type != GW_SLIDER) + if (gh->vmt != (gwinVMT *)&sliderVMT) return; if (gsw->min <= gsw->max) { @@ -178,125 +207,96 @@ void gwinSetSliderPosition(GHandle gh, int pos) { else if (pos < gsw->max) gsw->pos = gsw->max; else gsw->pos = pos; } + ResetDisplayPos(gsw); #undef gsw } -void gwinSetSliderStyle(GHandle gh, const GSliderDrawStyle *pStyle) { - #define gsw ((GSliderObject *)gh) - - if (gh->type != GW_SLIDER) +void gwinSetSliderColors(GHandle gh, const GSliderColors *pColors) { + if (gh->vmt != (gwinVMT *)&sliderVMT) return; - gsw->style.color_edge = pStyle->color_edge; - gsw->style.color_thumb = pStyle->color_thumb; - gsw->style.color_active = pStyle->color_active; - gsw->style.color_inactive = pStyle->color_inactive; - #undef gsw + ((GSliderObject *)gh)->c = *pColors; } -#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - static void trackSliderDraw(GHandle gh, coord_t x, coord_t y) { - #define gsw ((GSliderObject *)gh) - - #if GDISP_NEED_CLIP - gdispSetClip(gh->x, gh->y, gh->width, gh->height); - #endif - - if (gh->height <= gh->width) - gsw->fn(gh, FALSE, x, &gsw->style, gsw->param); - else - gsw->fn(gh, TRUE, y, &gsw->style, gsw->param); - - #undef gbw - } -#endif - -void gwinSliderDraw(GHandle gh) { - #define gsw ((GSliderObject *)gh) - - if (gh->type != GW_SLIDER) - return; - - #if GDISP_NEED_CLIP - gdispSetClip(gh->x, gh->y, gh->width, gh->height); - #endif - - if (gh->height <= gh->width) - gsw->fn(gh, FALSE, ((gh->width-1)*(gsw->pos-gsw->min))/(gsw->max-gsw->min), &gsw->style, gsw->param); - else - gsw->fn(gh, TRUE, gh->height-1-((gh->height-1)*(gsw->pos-gsw->min))/(gsw->max-gsw->min), &gsw->style, gsw->param); - - #undef gbw -} - -void gwinSetSliderCustom(GHandle gh, GSliderDrawFunction fn, void *param) { - #define gsw ((GSliderObject *)gh) - - if (gh->type != GW_SLIDER) - return; - - gsw->fn = fn ? fn : gwinSliderDraw_Std; - gsw->param = param; - - #undef gsw -} - -void gwinSliderSetEnabled(GHandle gh, bool_t enabled) { - if (gh->type != GW_SLIDER) - return; - - gh->enabled = enabled; -} - -void gwinSliderDraw_Std(GHandle gh, bool_t isVertical, coord_t thumbpos, const GSliderDrawStyle *pstyle, void *param) { +void gwinSliderDraw_Std(GWidgetObject *gw, void *param) { + #define gsw ((GSliderObject *)gw) (void) param; - if (isVertical) { - if (thumbpos != gh->height-1) - gdispFillArea(gh->x, gh->y+thumbpos, gh->width, gh->height - thumbpos, pstyle->color_active); - if (thumbpos != 0) - gdispFillArea(gh->x, gh->y, gh->width, thumbpos, pstyle->color_inactive); - gdispDrawBox(gh->x, gh->y, gh->width, gh->height, pstyle->color_edge); - gdispDrawLine(gh->x, gh->y+thumbpos, gh->x+gh->width-1, gh->y+thumbpos, pstyle->color_thumb); - if (thumbpos >= 2) - gdispDrawLine(gh->x, gh->y+thumbpos-2, gh->x+gh->width-1, gh->y+thumbpos-2, pstyle->color_thumb); - if (thumbpos <= gh->height-2) - gdispDrawLine(gh->x, gh->y+thumbpos+2, gh->x+gh->width-1, gh->y+thumbpos+2, pstyle->color_thumb); + if (gw->g.vmt != (gwinVMT *)&sliderVMT) + return; + + if (gw->g.width < gw->g.height) { // Vertical slider + if (gsw->dpos != gw->g.height-1) + gdispFillArea(gw->g.x, gw->g.y+gsw->dpos, gw->g.width, gw->g.height - gsw->dpos, gsw->c.color_active); + if (gsw->dpos != 0) + gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gsw->dpos, gsw->c.color_inactive); + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gsw->c.color_edge); + gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos, gsw->c.color_thumb); + if (gsw->dpos >= 2) + gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos-2, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos-2, gsw->c.color_thumb); + if (gsw->dpos <= gw->g.height-2) + gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos+2, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos+2, gsw->c.color_thumb); + + // Horizontal slider } else { - if (thumbpos != gh->width-1) - gdispFillArea(gh->x+thumbpos, gh->y, gh->width-thumbpos, gh->height, pstyle->color_inactive); - if (thumbpos != 0) - gdispFillArea(gh->x, gh->y, thumbpos, gh->height, pstyle->color_active); - gdispDrawBox(gh->x, gh->y, gh->width, gh->height, pstyle->color_edge); - gdispDrawLine(gh->x+thumbpos, gh->y, gh->x+thumbpos, gh->y+gh->height-1, pstyle->color_thumb); - if (thumbpos >= 2) - gdispDrawLine(gh->x+thumbpos-2, gh->y, gh->x+thumbpos-2, gh->y+gh->height-1, pstyle->color_thumb); - if (thumbpos <= gh->width-2) - gdispDrawLine(gh->x+thumbpos+2, gh->y, gh->x+thumbpos+2, gh->y+gh->height-1, pstyle->color_thumb); + if (gsw->dpos != gw->g.width-1) + gdispFillArea(gw->g.x+gsw->dpos, gw->g.y, gw->g.width-gsw->dpos, gw->g.height, gsw->c.color_inactive); + if (gsw->dpos != 0) + gdispFillArea(gw->g.x, gw->g.y, gsw->dpos, gw->g.height, gsw->c.color_active); + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gsw->c.color_edge); + gdispDrawLine(gw->g.x+gsw->dpos, gw->g.y, gw->g.x+gsw->dpos, gw->g.y+gw->g.height-1, gsw->c.color_thumb); + if (gsw->dpos >= 2) + gdispDrawLine(gw->g.x+gsw->dpos-2, gw->g.y, gw->g.x+gsw->dpos-2, gw->g.y+gw->g.height-1, gsw->c.color_thumb); + if (gsw->dpos <= gw->g.width-2) + gdispDrawLine(gw->g.x+gsw->dpos+2, gw->g.y, gw->g.x+gsw->dpos+2, gw->g.y+gw->g.height-1, gsw->c.color_thumb); } + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, gsw->c.color_txt, justifyCenter); + + #undef gsw } -#if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - bool_t gwinAttachSliderMouse(GHandle gh, uint16_t instance) { - GSourceHandle gsh; +void gwinSliderDraw_Image(GWidgetObject *gw, void *param) { + #define gsw ((GSliderObject *)gw) + #define gi ((gdispImage *)param) + coord_t z, v; - if (gh->type != GW_SLIDER || !(gsh = ginputGetMouse(instance))) - return FALSE; + if (gw->g.vmt != (gwinVMT *)&sliderVMT) + return; - return geventAttachSource(&((GSliderObject *)gh)->listener, gsh, GLISTEN_MOUSEMETA|GLISTEN_MOUSEDOWNMOVES); + if (gw->g.width < gw->g.height) { // Vertical slider + if (gsw->dpos != 0) // The unfilled area + gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gsw->dpos, gsw->c.color_inactive); + if (gsw->dpos != gw->g.height-1) { // The filled area + for(z=gw->g.height, v=gi->height; z > gsw->dpos;) { + z -= v; + if (z < gsw->dpos) { + v -= gsw->dpos - z; + z = gsw->dpos; + } + gdispImageDraw(gi, gw->g.x, gw->g.y+z, gw->g.width, v, 0, gi->height-v); + } + } + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gsw->c.color_edge); + gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos, gsw->c.color_thumb); + + // Horizontal slider + } else { + if (gsw->dpos != gw->g.width-1) // The unfilled area + gdispFillArea(gw->g.x+gsw->dpos, gw->g.y, gw->g.width-gsw->dpos, gw->g.height, gsw->c.color_inactive); + if (gsw->dpos != 0) { // The filled area + for(z=0, v=gi->width; z < gsw->dpos; z += v) { + if (z+v > gsw->dpos) + v -= z+v - gsw->dpos; + gdispImageDraw(gi, gw->g.x+z, gw->g.y, v, gw->g.height, 0, 0); + } + } + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gsw->c.color_edge); + gdispDrawLine(gw->g.x+gsw->dpos, gw->g.y, gw->g.x+gsw->dpos, gw->g.y+gw->g.height-1, gsw->c.color_thumb); } -#endif + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, gsw->c.color_txt, justifyCenter); -#if GFX_USE_GINPUT && GINPUT_NEED_DIAL - bool_t gwinAttachSliderDial(GHandle gh, uint16_t instance) { - GSourceHandle gsh; - - if (gh->type != GW_SLIDER || !(gsh = ginputGetDial(instance))) - return FALSE; - - return geventAttachSource(&((GSliderObject *)gh)->listener, gsh, 0); - } -#endif + #undef gsw +} #endif /* GFX_USE_GWIN && GWIN_NEED_BUTTON */ /** @} */ From 1db77bda85aabd64eb78edf34e9b4b77e1e7324d Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 6 Jun 2013 16:47:57 +1000 Subject: [PATCH 02/38] License fixes to some demos --- .../gdisp/gdisp_images_animated/main.c | 43 +++++++++++-------- demos/modules/gwin/basic/main.c | 43 +++++++++++-------- demos/modules/gwin/console/main.c | 43 +++++++++++-------- demos/modules/gwin/slider/main.c | 43 +++++++++++-------- 4 files changed, 100 insertions(+), 72 deletions(-) diff --git a/demos/modules/gdisp/gdisp_images_animated/main.c b/demos/modules/gdisp/gdisp_images_animated/main.c index 8502dcf9..c4ae9d02 100644 --- a/demos/modules/gdisp/gdisp_images_animated/main.c +++ b/demos/modules/gdisp/gdisp_images_animated/main.c @@ -1,22 +1,29 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "gfx.h" diff --git a/demos/modules/gwin/basic/main.c b/demos/modules/gwin/basic/main.c index 624eed18..fa618e0f 100644 --- a/demos/modules/gwin/basic/main.c +++ b/demos/modules/gwin/basic/main.c @@ -1,22 +1,29 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "gfx.h" diff --git a/demos/modules/gwin/console/main.c b/demos/modules/gwin/console/main.c index d968b920..557cf988 100644 --- a/demos/modules/gwin/console/main.c +++ b/demos/modules/gwin/console/main.c @@ -1,22 +1,29 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "gfx.h" #include "chprintf.h" diff --git a/demos/modules/gwin/slider/main.c b/demos/modules/gwin/slider/main.c index f1d4248d..c56a1aa7 100644 --- a/demos/modules/gwin/slider/main.c +++ b/demos/modules/gwin/slider/main.c @@ -1,22 +1,29 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "gfx.h" #include "chprintf.h" From 663caba66214acdb6170903f6a203740ea1de8b9 Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 6 Jun 2013 16:48:30 +1000 Subject: [PATCH 03/38] GWIN fixes --- demos/modules/gwin/widgets/main.c | 112 ++++++++++++++++-------------- include/gwin/gwin.h | 16 +++++ src/gwin/gwidget.c | 4 +- src/gwin/gwin.c | 14 +++- src/gwin/slider.c | 19 +++-- 5 files changed, 106 insertions(+), 59 deletions(-) diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index 7845ba69..2102d3a2 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -1,22 +1,29 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ #include "gfx.h" @@ -31,7 +38,7 @@ static GHandle ghCheckbox1, ghCheckbox2; #define BUTTON_WIDTH 50 #define BUTTON_HEIGHT 30 -#define SLIDER_WIDTH 10 +#define SLIDER_WIDTH 20 #define CHECKBOX_WIDTH 80 #define CHECKBOX_HEIGHT 20 @@ -42,48 +49,51 @@ int main(void) { gfxInit(); gdispClear(White); - // Set the font + // Set the font and defalt colors gwinSetDefaultFont(gdispOpenFont("UI2")); + gwinSetDefaultColor(Black); + gwinSetDefaultBgColor(White); // Create out gwin windows/widgets + ghConsole = gwinCreateConsole(NULL, ScrWidth/2+1, ScrHeight/2+1, ScrWidth/2-1, ScrHeight/2-1); ghButton1 = gwinCreateButton(NULL, 0+0*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); ghButton2 = gwinCreateButton(NULL, 0+1*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); ghButton3 = gwinCreateButton(NULL, 0+2*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); ghButton4 = gwinCreateButton(NULL, 0+3*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); - ghConsole = gwinCreateConsole(NULL, ScrWidth/2+1, ScrHeight/2+1, ScrWidth/2-1, ScrHeight/2-1); ghSlider1 = gwinCreateSlider(NULL, ScrWidth/2+1, ScrHeight/2-2*(SLIDER_WIDTH+1), ScrWidth/2-2, SLIDER_WIDTH); ghSlider2 = gwinCreateSlider(NULL, ScrWidth/2+1, ScrHeight/2-1*(SLIDER_WIDTH+1), ScrWidth/2-2, SLIDER_WIDTH); - ghSlider3 = gwinCreateSlider(NULL, 0+1*(SLIDER_WIDTH+1), ScrHeight/2+1, SLIDER_WIDTH, ScrHeight/2-2); + ghSlider3 = gwinCreateSlider(NULL, 0+0*(SLIDER_WIDTH+1), ScrHeight/2+1, SLIDER_WIDTH, ScrHeight/2-2); ghSlider4 = gwinCreateSlider(NULL, 0+1*(SLIDER_WIDTH+1), ScrHeight/2+1, SLIDER_WIDTH, ScrHeight/2-2); ghCheckbox1 = gwinCreateCheckbox(NULL, 0, BUTTON_HEIGHT+1, CHECKBOX_WIDTH, CHECKBOX_HEIGHT); ghCheckbox2 = gwinCreateCheckbox(NULL, 0, BUTTON_HEIGHT+1+1*(CHECKBOX_HEIGHT+1), CHECKBOX_WIDTH, CHECKBOX_HEIGHT); - // Color everything + // Color everything and set special drawing for some widgets gwinSetColor(ghConsole, Yellow); gwinSetBgColor(ghConsole, Black); + gwinSetCustomDraw(ghCheckbox2, gwinCheckboxDraw_CheckOnRight, 0); // Set the text on all the controls gwinSetText(ghButton1, "B1", FALSE); - gwinSetText(ghButton2, "B2", FALSE); - gwinSetText(ghButton3, "B3", FALSE); - gwinSetText(ghButton4, "B4", FALSE); - gwinSetText(ghSlider1, "S1", FALSE); - gwinSetText(ghSlider2, "S2", FALSE); - gwinSetText(ghSlider3, "S3", FALSE); - gwinSetText(ghSlider4, "S4", FALSE); - gwinSetText(ghCheckbox1, "C1", FALSE); - gwinSetText(ghCheckbox2, "C2", FALSE); + gwinSetText(ghButton2, "B2", FALSE); + gwinSetText(ghButton3, "B3", FALSE); + gwinSetText(ghButton4, "B4", FALSE); + gwinSetText(ghSlider1, "S1", FALSE); + gwinSetText(ghSlider2, "S2", FALSE); + gwinSetText(ghSlider3, "S3", FALSE); + gwinSetText(ghSlider4, "S4", FALSE); + gwinSetText(ghCheckbox1, "C1", FALSE); + gwinSetText(ghCheckbox2, "C2", FALSE); // Assign the mouse and dials to the buttons & sliders etc. #if GINPUT_NEED_MOUSE - gwinAttachMouse(ghSlider1, 0); - gwinAttachMouse(ghSlider2, 0); - gwinAttachMouse(ghSlider3, 0); - gwinAttachMouse(ghSlider4, 0); gwinAttachMouse(ghButton1, 0); gwinAttachMouse(ghButton2, 0); gwinAttachMouse(ghButton3, 0); gwinAttachMouse(ghButton4, 0); + gwinAttachMouse(ghSlider1, 0); + gwinAttachMouse(ghSlider2, 0); + gwinAttachMouse(ghSlider3, 0); + gwinAttachMouse(ghSlider4, 0); gwinAttachMouse(ghCheckbox1, 0); gwinAttachMouse(ghCheckbox2, 0); #endif @@ -94,29 +104,29 @@ int main(void) { // We want to listen for widget events geventListenerInit(&gl); - gwinAttachListener(ghSlider1, &gl, 0); - gwinAttachListener(ghSlider2, &gl, 0); - gwinAttachListener(ghSlider3, &gl, 0); - gwinAttachListener(ghSlider4, &gl, 0); gwinAttachListener(ghButton1, &gl, 0); gwinAttachListener(ghButton2, &gl, 0); gwinAttachListener(ghButton3, &gl, 0); gwinAttachListener(ghButton4, &gl, 0); + gwinAttachListener(ghSlider1, &gl, 0); + gwinAttachListener(ghSlider2, &gl, 0); + gwinAttachListener(ghSlider3, &gl, 0); + gwinAttachListener(ghSlider4, &gl, 0); gwinAttachListener(ghCheckbox1, &gl, 0); gwinAttachListener(ghCheckbox2, &gl, 0); // Draw everything on the screen - gwinClear(ghConsole); - gwinDraw(ghSlider1); - gwinDraw(ghSlider2); - gwinDraw(ghSlider3); - gwinDraw(ghSlider4); - gwinDraw(ghButton1); - gwinDraw(ghButton2); - gwinDraw(ghButton3); - gwinDraw(ghButton4); - gwinDraw(ghCheckbox1); - gwinDraw(ghCheckbox2); + gwinClear(ghConsole); + gwinDraw(ghButton1); + gwinDraw(ghButton2); + gwinDraw(ghButton3); + gwinDraw(ghButton4); + gwinDraw(ghSlider1); + gwinDraw(ghSlider2); + gwinDraw(ghSlider3); + gwinDraw(ghSlider4); + gwinDraw(ghCheckbox1); + gwinDraw(ghCheckbox2); while(1) { // Get an Event diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index e7c164dc..7a6aba09 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -127,6 +127,22 @@ const char *gwinGetClassName(GHandle gh); */ #define gwinGetHeight(gh) ((gh)->height) +/** + * @brief Set the default foreground color for all new GWIN windows + * + * @param[in] gh The window + * @param[in] clr The color to be set + */ +void gwinSetDefaultColor(color_t clr); + +/** + * @brief Set the default background color for all new GWIN windows + * + * @param[in] gh The window + * @param[in] bgclr The background color + */ +void gwinSetDefaultBgColor(color_t bgclr); + /** * @brief Set foreground color * @details Set the color which will be used to draw diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c index 464210b7..3f23140c 100644 --- a/src/gwin/gwidget.c +++ b/src/gwin/gwidget.c @@ -39,7 +39,7 @@ static void gwidgetCallback(void *param, GEvent *pe) { case GEVENT_TOUCH: // Are we captured? if ((gw->g.flags & GWIN_FLG_MOUSECAPTURE)) { - if (pme->meta == GMETA_MOUSE_UP) { + if ((pme->last_buttons & ~pme->current_buttons & GINPUT_MOUSE_BTN_LEFT)) { gw->g.flags &= ~GWIN_FLG_MOUSECAPTURE; if (wvmt->MouseUp) wvmt->MouseUp(gw, pme->x - gw->g.x, pme->y - gw->g.y); @@ -48,7 +48,7 @@ static void gwidgetCallback(void *param, GEvent *pe) { wvmt->MouseMove(gw, pme->x - gw->g.x, pme->y - gw->g.y); // We are not captured - look for mouse downs over the widget - } else if (pme->meta == GMETA_MOUSE_DOWN + } else if ((~pme->last_buttons & pme->current_buttons & GINPUT_MOUSE_BTN_LEFT) && pme->x >= gw->g.x && pme->x < gw->g.x + gw->g.width && pme->y >= gw->g.y && pme->y < gw->g.y + gw->g.height) { gw->g.flags |= GWIN_FLG_MOUSECAPTURE; diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index fcbaa397..163e821d 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -18,6 +18,8 @@ static const gwinVMT basegwinVMT = { }; static font_t defaultFont; +static color_t defaultFgColor = White; +static color_t defaultBgColor = Black; // Internal routine for use by GWIN components only // Initialise a window creating it dynamicly if required. @@ -47,8 +49,8 @@ GHandle _gwinInit(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord pgw->y = y; pgw->width = width; pgw->height = height; - pgw->color = White; - pgw->bgcolor = Black; + pgw->color = defaultFgColor; + pgw->bgcolor = defaultBgColor; #if GDISP_NEED_TEXT pgw->font = defaultFont; #endif @@ -74,6 +76,14 @@ const char *gwinGetClassName(GHandle gh) { return gh->vmt->classname; } +void gwinSetDefaultColor(color_t clr) { + defaultFgColor = clr; +} + +void gwinSetDefaultBgColor(color_t bgclr) { + defaultBgColor = bgclr; +} + #if GDISP_NEED_TEXT void gwinSetDefaultFont(font_t font) { defaultFont = font; diff --git a/src/gwin/slider.c b/src/gwin/slider.c index f18c665b..a0289d3d 100644 --- a/src/gwin/slider.c +++ b/src/gwin/slider.c @@ -107,10 +107,21 @@ static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { #endif // Set the new position - if (gh->width < gh->height) - gsw->pos = (uint16_t)((uint32_t)(gh->height-1-y-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->height-2*GWIN_SLIDER_DEAD_BAND) + gsw->min); - else - gsw->pos = (uint16_t)((uint32_t)(x-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->width-2*GWIN_SLIDER_DEAD_BAND) + gsw->min); + if (gh->width < gh->height) { + if (y > gh->height-GWIN_SLIDER_DEAD_BAND) + gsw->pos = gsw->min; + else if (y < GWIN_SLIDER_DEAD_BAND) + gsw->pos = gsw->max; + else + gsw->pos = (uint16_t)((int32_t)(gh->height-1-y-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->height-2*GWIN_SLIDER_DEAD_BAND) + gsw->min); + } else { + if (x > gh->width-GWIN_SLIDER_DEAD_BAND) + gsw->pos = gsw->max; + else if (x < GWIN_SLIDER_DEAD_BAND) + gsw->pos = gsw->min; + else + gsw->pos = (uint16_t)((int32_t)(x-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->width-2*GWIN_SLIDER_DEAD_BAND) + gsw->min); + } ResetDisplayPos(gsw); gwinDraw(gh); From 777ec6af7c1b594f7b7a9cbaaf7ead90d8fb7e8f Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 8 Jun 2013 02:27:59 +1000 Subject: [PATCH 04/38] Add a simple GWIN window manager, Change the way GWIN visibility works --- demos/modules/gadc/gwinosc.c | 2 +- demos/modules/gaudin/gwinosc.c | 2 +- gfxconf.example.h | 4 +- include/gfx_rules.h | 54 +- include/gwin/button.h | 11 +- include/gwin/class_gwin.h | 172 +++-- include/gwin/console.h | 12 +- include/gwin/graph.h | 11 +- include/gwin/gwidget.h | 39 +- include/gwin/gwin.h | 1070 +++++++++++++++++++------------- include/gwin/options.h | 38 +- src/gfx.c | 2 +- src/gqueue/gqueue.c | 29 +- src/gwin/button.c | 9 +- src/gwin/checkbox.c | 5 +- src/gwin/console.c | 3 +- src/gwin/graph.c | 3 +- src/gwin/gwidget.c | 46 +- src/gwin/gwin.c | 298 +++++++-- src/gwin/gwin.mk | 1 + src/gwin/gwm.c | 144 +++++ src/gwin/slider.c | 7 +- 22 files changed, 1301 insertions(+), 661 deletions(-) create mode 100644 src/gwin/gwm.c diff --git a/demos/modules/gadc/gwinosc.c b/demos/modules/gadc/gwinosc.c index 589fdb9e..88e61334 100644 --- a/demos/modules/gadc/gwinosc.c +++ b/demos/modules/gadc/gwinosc.c @@ -47,7 +47,7 @@ GHandle gwinCreateScope(GScopeObject *gs, coord_t x, coord_t y, coord_t cx, coord_t cy, uint32_t physdev, uint32_t frequency) { /* Initialise the base class GWIN */ - if (!(gs = (GScopeObject *)_gwinInit((GWindowObject *)gs, x, y, cx, cy, sizeof(GScopeObject)))) + if (!(gs = (GScopeObject *)_gwindowInit((GWindowObject *)gs, x, y, cx, cy, sizeof(GScopeObject)))) return 0; /* Initialise the scope object members and allocate memory for buffers */ diff --git a/demos/modules/gaudin/gwinosc.c b/demos/modules/gaudin/gwinosc.c index 82ed4b44..e90430d3 100644 --- a/demos/modules/gaudin/gwinosc.c +++ b/demos/modules/gaudin/gwinosc.c @@ -54,7 +54,7 @@ GHandle gwinCreateScope(GScopeObject *gs, coord_t x, coord_t y, coord_t cx, coord_t cy, uint16_t channel, uint32_t frequency) { /* Initialise the base class GWIN */ - if (!(gs = (GScopeObject *)_gwinInit((GWindowObject *)gs, x, y, cx, cy, sizeof(GScopeObject)))) + if (!(gs = (GScopeObject *)_gwindowInit((GWindowObject *)gs, x, y, cx, cy, sizeof(GScopeObject)))) return 0; /* Initialise the scope object members and allocate memory for buffers */ diff --git a/gfxconf.example.h b/gfxconf.example.h index 3cdd56fe..1797cadc 100644 --- a/gfxconf.example.h +++ b/gfxconf.example.h @@ -80,9 +80,11 @@ #define TDISP_NEED_MULTITHREAD FALSE /* Features for the GWIN subsystem. */ -#define GWIN_NEED_BUTTON FALSE +#define GWIN_NEED_WINDOWMANAGER FALSE #define GWIN_NEED_CONSOLE FALSE #define GWIN_NEED_GRAPH FALSE +#define GWIN_NEED_WIDGET FALSE +#define GWIN_NEED_BUTTON FALSE #define GWIN_NEED_SLIDER FALSE #define GWIN_NEED_CHECKBOX FALSE diff --git a/include/gfx_rules.h b/include/gfx_rules.h index 4b7e9506..7e14ef9d 100644 --- a/include/gfx_rules.h +++ b/include/gfx_rules.h @@ -46,29 +46,15 @@ #warning "GWIN: Drawing can occur outside the defined windows as GDISP_NEED_CLIP is FALSE" #endif #endif - #if GWIN_NEED_BUTTON - #if !GDISP_NEED_TEXT - #error "GWIN: GDISP_NEED_TEXT is required if GWIN_NEED_BUTTON is TRUE." - #endif - #if !GFX_USE_GEVENT + #if GWIN_NEED_WINDOWMANAGER + #if !GFX_USE_GQUEUE || !GQUEUE_NEED_ASYNC #if GFX_DISPLAY_RULE_WARNINGS - #warning "GWIN: GFX_USE_GEVENT is required if GWIN_NEED_BUTTON is TRUE. It has been turned on for you." + #warning "GWIN: GFX_USE_GQUEUE and GQUEUE_NEED_ASYNC is required if GWIN_NEED_WINDOWMANAGER is TRUE. It has been turned on for you." #endif - #undef GFX_USE_GEVENT - #define GFX_USE_GEVENT TRUE - #endif - #if !GFX_USE_GINPUT || !(GINPUT_NEED_MOUSE || GINPUT_NEED_TOGGLE) - #if GFX_DISPLAY_RULE_WARNINGS - #warning "GWIN: You have set GWIN_NEED_BUTTON to TRUE but no supported GINPUT (mouse/toggle) devices have been included" - #endif - #endif - #if !GDISP_NEED_MULTITHREAD && !GDISP_NEED_ASYNC - #if GFX_DISPLAY_RULE_WARNINGS - #warning "GWIN: Either GDISP_NEED_MULTITHREAD or GDISP_NEED_ASYNC is required if GWIN_NEED_BUTTON is TRUE." - #warning "GWIN: GDISP_NEED_MULTITHREAD has been turned on for you." - #endif - #undef GDISP_NEED_MULTITHREAD - #define GDISP_NEED_MULTITHREAD TRUE + #undef GFX_USE_GQUEUE + #undef GQUEUE_NEED_ASYNC + #define GFX_USE_GQUEUE TRUE + #define GQUEUE_NEED_ASYNC TRUE #endif #endif #if GWIN_NEED_CONSOLE @@ -78,6 +64,32 @@ #endif #if GWIN_NEED_GRAPH #endif + #if GWIN_NEED_BUTTON || GWIN_NEED_SLIDER || GWIN_NEED_CHECKBOX + #if !GWIN_NEED_WIDGET + #if GFX_DISPLAY_RULE_WARNINGS + #warning "GWIN: GWIN_NEED_WIDGET is required when a Widget is used. It has been turned on for you." + #endif + #undef GWIN_NEED_WIDGET + #define GWIN_NEED_WIDGET TRUE + #endif + #endif + #if GWIN_NEED_WIDGET + #if !GDISP_NEED_TEXT + #error "GWIN: GDISP_NEED_TEXT is required if GWIN_NEED_WIDGET is TRUE." + #endif + #if !GFX_USE_GINPUT + // This test also ensures that GFX_USE_GEVENT is set + #error "GWIN: GFX_USE_GINPUT (and one or more input sources) is required if GWIN_NEED_WIDGET is TRUE" + #endif + #if !GDISP_NEED_MULTITHREAD && !GDISP_NEED_ASYNC + #if GFX_DISPLAY_RULE_WARNINGS + #warning "GWIN: Either GDISP_NEED_MULTITHREAD or GDISP_NEED_ASYNC is required if GWIN_NEED_WIDGET is TRUE." + #warning "GWIN: GDISP_NEED_MULTITHREAD has been turned on for you." + #endif + #undef GDISP_NEED_MULTITHREAD + #define GDISP_NEED_MULTITHREAD TRUE + #endif + #endif #endif #if GFX_USE_GINPUT diff --git a/include/gwin/button.h b/include/gwin/button.h index 1b0ff36b..53096ea3 100644 --- a/include/gwin/button.h +++ b/include/gwin/button.h @@ -73,10 +73,15 @@ extern "C" { * @param[in] width The width of the window * @param[in] height The height of the window * - * @note The drawing color gets set to White and the background drawing color to Black. - * @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont() + * @note The drawing color and the background color get set to the current defaults. If you haven't called + * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. + * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there + * is no default font and text drawing operations will no nothing. * @note The dimensions and position may be changed to fit on the real screen. - * @note The button is not automatically drawn. Call gwinDraw() to draw it. + * @note A button remembers its normal button state. If there is a window manager then it is automatically + * redrawn if the window is moved or its visibility state is changed. + * @note The button is initially marked as invisible so that more properties can be set before display. + * Call @p gwinSetVisible() to display it when ready. * * @api */ diff --git a/include/gwin/class_gwin.h b/include/gwin/class_gwin.h index b7d8c5a8..5e3cb01f 100644 --- a/include/gwin/class_gwin.h +++ b/include/gwin/class_gwin.h @@ -23,56 +23,92 @@ #if GFX_USE_GWIN || defined(__DOXYGEN__) +/** + * @brief The predefined flags for a Window + * @{ + */ +#define GWIN_FLG_DYNAMIC 0x0001 // @< The GWIN structure is allocated +#define GWIN_FLG_VISIBLE 0x0002 // @< The window is visible +#define GWIN_FLG_MINIMIZED 0x0004 // @< The window is minimized +#define GWIN_FLG_MAXIMIZED 0x0008 // @< The window is maximized +#define GWIN_FLG_WIDGET 0x0010 // @< This is a widget +#define GWIN_FLG_ENABLED 0x0020 // @< The widget is enabled +#define GWIN_FLG_ALLOCTXT 0x0040 // @< The widget text is allocated +#define GWIN_FLG_MOUSECAPTURE 0x0080 // @< The widget has captured the mouse +#define GWIN_FIRST_WM_FLAG 0x0100 // @< 4 bits free for the window manager to use +#define GWIN_FIRST_CONTROL_FLAG 0x1000 // @< 4 bits free for Windows and Widgets to use +/* @} */ + /** * @brief The Virtual Method Table for a GWIN window * @{ */ typedef struct gwinVMT { - const char *classname; // @< The GWIN classname - void (*Destroy)(GWindowObject *gh); // @< The GWIN Destroy function (optional) - void (*AfterClear)(GWindowObject *gh); // @< The GWIN After-Clear function (optional) + const char * classname; // @< The GWIN classname (mandatory) + void (*Destroy) (GWindowObject *gh); // @< The GWIN destroy function (optional) + void (*Redraw) (GWindowObject *gh); // @< The GWIN redraw routine (optional) + void (*AfterClear) (GWindowObject *gh); // @< The GWIN after-clear function (optional) } gwinVMT; /* @} */ -/** - * @brief The Virtual Method Table for a widget - * @note A widget must have a destroy function. Either use @p _gwidgetDestroy() or use your own function - * which internally calls @p _gwidgetDestroy(). - * @note If no MouseDown(), MouseUp() or MouseMove() function is provided, the widget will not accept being attached to a mouse input source. - * @note If no ToggleOn() or ToggleOff() function is provided, the widget will not accept being attached to a toggle input source. - * @note If no DialMove() function is provided, the widget will not accept being attached to a dial input source. - * @note AssignToggle() and AssignDial() enable a widget to handle more than one toggle/dial device attached to the widget. - * For example, a slider might accept two toggles, one for slider-down and one for slider-up. - * The function enables the widget to record that a particular device instance performs each particular role. - * (eg toggle0 = slider-down, toggle1 = slider-up). - * @{ - */ -typedef struct gwidgetVMT { - struct gwinVMT g; // @< This is still a GWIN - void (*DefaultDraw) (GWidgetObject *gw, void *param); // @< The default drawing routine (mandatory) - void (*MouseDown) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse down events (optional) - void (*MouseUp) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse up events (optional) - void (*MouseMove) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse move events (optional) - void (*ToggleOff) (GWidgetObject *gw, uint16_t instance); // @< Process toggle off events (optional) - void (*ToggleOn) (GWidgetObject *gw, uint16_t instance); // @< Process toggle on events (optional) - void (*DialMove) (GWidgetObject *gw, uint16_t instance, uint16_t value); // @< Process dial move events (optional) - void (*AllEvents) (GWidgetObject *gw, GEvent *pe); // @< Process all events (optional) - bool_t (*AssignToggle) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the toggle instance handle (optional) - bool_t (*AssignDial) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the dial instance handle (optional) -} gwidgetVMT; -/* @} */ +#if GWIN_NEED_WIDGET || defined(__DOXYGEN__) + /** + * @brief The Virtual Method Table for a widget + * @note A widget must have a destroy function. Either use @p _gwidgetDestroy() or use your own function + * which internally calls @p _gwidgetDestroy(). + * @note A widget must have a redraw function. Use @p _gwidgetRedraw(). + * @note If no MouseDown(), MouseUp() or MouseMove() function is provided, the widget will not accept being attached to a mouse input source. + * @note If no ToggleOn() or ToggleOff() function is provided, the widget will not accept being attached to a toggle input source. + * @note If no DialMove() function is provided, the widget will not accept being attached to a dial input source. + * @note AssignToggle() and AssignDial() enable a widget to handle more than one toggle/dial device attached to the widget. + * For example, a slider might accept two toggles, one for slider-down and one for slider-up. + * The function enables the widget to record that a particular device instance performs each particular role. + * (eg toggle0 = slider-down, toggle1 = slider-up). + * @{ + */ + typedef struct gwidgetVMT { + struct gwinVMT g; // @< This is still a GWIN + void (*DefaultDraw) (GWidgetObject *gw, void *param); // @< The default drawing routine (mandatory) + void (*MouseDown) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse down events (optional) + void (*MouseUp) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse up events (optional) + void (*MouseMove) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse move events (optional) + void (*ToggleOff) (GWidgetObject *gw, uint16_t instance); // @< Process toggle off events (optional) + void (*ToggleOn) (GWidgetObject *gw, uint16_t instance); // @< Process toggle on events (optional) + void (*DialMove) (GWidgetObject *gw, uint16_t instance, uint16_t value); // @< Process dial move events (optional) + void (*AllEvents) (GWidgetObject *gw, GEvent *pe); // @< Process all events (optional) + bool_t (*AssignToggle) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the toggle instance handle (optional) + bool_t (*AssignDial) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the dial instance handle (optional) + } gwidgetVMT; + /* @} */ +#endif -/** - * @brief The predefined flags for a GWIN and a Widget - * @{ - */ -#define GWIN_FLG_DYNAMIC 0x0001 // @< The GWIN structure is allocated -#define GWIN_FLG_WIDGET 0x0002 // @< This is a widget -#define GWIN_FLG_ENABLED 0x0002 // @< The widget is enabled -#define GWIN_FLG_ALLOCTXT 0x0008 // @< The widget text is allocated -#define GWIN_FLG_MOUSECAPTURE 0x0010 // @< The widget has captured the mouse -#define GWIN_FIRST_CONTROL_FLAG 0x0100 // @< Free for GWINs and Widgets to use -/* @} */ +#if GWIN_NEED_WINDOWMANAGER || defined(__DOXYGEN__) + // @note There is only ever one instance of each GWindowManager type + typedef struct GWindowManager { + const struct gwmVMT *vmt; + } GWindowManager; + + /** + * @brief The Virtual Method Table for a window manager + * @{ + */ + typedef struct gwmVMT { + void (*Init) (void); // @< The window manager has just been set as the current window manager + void (*DeInit) (void); // @< The window manager has just been removed as the current window manager + bool_t (*Add) (GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h); // @< A window has been added + void (*Delete) (GHandle gh); // @< A window has been deleted + void (*Visible) (GHandle gh); // @< A window has changed its visibility state + void (*Redim) (GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h); // @< A window wants to be moved or resized + void (*Raise) (GHandle gh); // @< A window wants to be on top + void (*MinMax) (GHandle gh, GWindowMinMax minmax); // @< A window wants to be minimized/maximised + } gwmVMT; + /* @} */ + + /** + * @brief The list of all windows in the system + */ + extern gfxQueueASync _GWINList; +#endif #ifdef __cplusplus extern "C" { @@ -86,32 +122,44 @@ extern "C" { * @param[in] w, h The width and height of the GWIN window * @param[in] size The size of the GWIN object to allocate * @param[in] vmt The virtual method table for the GWIN object + * @param[in] flags The default flags to use * * @notapi */ -GHandle _gwinInit(GWindowObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwinVMT *vmt); +GHandle _gwindowInit(GWindowObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwinVMT *vmt, uint16_t flags); -/** - * @brief Initialise (and allocate if necessary) the base Widget object - * - * @param[in] pgw The GWidgetObject structure. If NULL one is allocated from the heap - * @param[in] x, y The top left corner of the Widget relative to the screen - * @param[in] w, h The width and height of the Widget window - * @param[in] size The size of the Widget object to allocate - * @param[in] vmt The virtual method table for the Widget object - * - * @notapi - */ -GHandle _gwidgetInit(GWidgetObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwidgetVMT *vmt); +#if GWIN_NEED_WIDGET || defined(__DOXYGEN__) + /** + * @brief Initialise (and allocate if necessary) the base Widget object + * + * @param[in] pgw The GWidgetObject structure. If NULL one is allocated from the heap + * @param[in] x, y The top left corner of the Widget relative to the screen + * @param[in] w, h The width and height of the Widget window + * @param[in] size The size of the Widget object to allocate + * @param[in] vmt The virtual method table for the Widget object + * + * @notapi + */ + GHandle _gwidgetInit(GWidgetObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwidgetVMT *vmt); -/** - * @brief Destroy the Widget object - * - * @param[in] gw The widget to destroy - * - * @notapi - */ -void _gwidgetDestroy(GHandle gh); + /** + * @brief Destroy the Widget object + * + * @param[in] gh The widget to destroy + * + * @notapi + */ + void _gwidgetDestroy(GHandle gh); + + /** + * @brief Redraw the Widget object + * + * @param[in] gh The widget to redraw + * + * @notapi + */ + void _gwidgetRedraw(GHandle gh); +#endif #ifdef __cplusplus } diff --git a/include/gwin/console.h b/include/gwin/console.h index 0496c620..349efeb8 100644 --- a/include/gwin/console.h +++ b/include/gwin/console.h @@ -55,11 +55,15 @@ extern "C" { * @param[in] width The width of the window * @param[in] height The height of the window * - * @note The console is not automatically cleared on creation. You must do that by calling gwinClear() (possibly after changing your background color) - * @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont() - * @note If the dispay does not support scrolling, the window will be cleared when the bottom line is reached. - * @note The default drawing color gets set to White and the background drawing color to Black. + * @note The drawing color and the background color get set to the current defaults. If you haven't called + * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. + * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there + * is no default font and text drawing operations will no nothing. * @note The dimensions and position may be changed to fit on the real screen. + * @note On creation the window is marked as visible but is not automatically cleared. You may do that by calling @p gwinClear() + * (possibly after changing your background color) + * @note A console does not save the drawing state. It is not automatically redrawn if the window is moved or + * its visibility state is changed. * * @api */ diff --git a/include/gwin/graph.h b/include/gwin/graph.h index 3c4c42a9..f1ea9450 100644 --- a/include/gwin/graph.h +++ b/include/gwin/graph.h @@ -95,8 +95,15 @@ extern "C" { * @param[in] width The width of the window * @param[in] height The height of the window * - * @note The console is not automatically cleared on creation. You must do that by calling gwinClear() (possibly after changing your background color) - * @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont() + * @note The drawing color and the background color get set to the current defaults. If you haven't called + * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. + * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there + * is no default font and text drawing operations will no nothing. + * @note The dimensions and position may be changed to fit on the real screen. + * @note On creation the window is marked as visible but is not automatically cleared. You may do that by calling @p gwinClear() + * (possibly after changing your background color) + * @note A graph does not save the drawing state. It is not automatically redrawn if the window is moved or + * its visibility state is changed. * @note The coordinate system within the window for graphing operations (but not for any other drawing * operation) is relative to the bottom left corner and then shifted right and up by the specified * graphing x and y origin. Note that this system is inverted in the y direction relative to the display. diff --git a/include/gwin/gwidget.h b/include/gwin/gwidget.h index 40124a43..21cfd4ac 100644 --- a/include/gwin/gwidget.h +++ b/include/gwin/gwidget.h @@ -74,48 +74,13 @@ extern "C" { * @param[in] gh The widget handle * @param[in] enabled Enable or disable the widget * - * @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget. + * @note The widget is automatically redrawn. * @note Non-widgets will ignore this call. * * @api */ void gwinSetEnabled(GHandle gh, bool_t enabled); -/** - * @brief Enable a widget - * - * @param[in] gh The widget handle - * - * @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget. - * @note Non-widgets will ignore this call. - * - * @api - */ -#define gwinEnable(gh) gwinSetEnabled(gh, TRUE) - -/** - * @brief Disable a widget - * - * @param[in] gh The widget handle - * - * @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget. - * @note Non-widgets will ignore this call. - * - * @api - */ -#define gwinDisable(gh) gwinSetEnabled(gh, FALSE) - -/** - * @brief Redraw the widget - * - * @param[in] gh The widget handle - * - * @note Non-widgets will ignore this call. - * - * @api - */ -void gwinDraw(GHandle gh); - /** * @brief Set the text of a widget. * @@ -123,7 +88,7 @@ void gwinDraw(GHandle gh); * @param[in] txt The text to set. This must be a constant string unless useAlloc is set. * @param[in] useAlloc If TRUE the string specified will be copied into dynamically allocated memory. * - * @note The widget is not automatically redrawn. Call @p gwinDraw() to redraw the widget. + * @note The widget is automatically redrawn * @note Non-widgets will ignore this call. * * @api diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index 7a6aba09..d915a4f0 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -30,521 +30,713 @@ /** * @brief A window object structure - * @note Do you access the members directly. Treat it as a black-box and use the method functions. - * + * @note Do not access the members directly. Treat it as a black-box and use the method functions. * @{ */ typedef struct GWindowObject { - const struct gwinVMT *vmt; // @< The VMT for this GWIN - coord_t x, y; // @< Screen relative position - coord_t width, height; // @< Dimensions of this window - color_t color, bgcolor; // @< Current drawing colors - uint16_t flags; // @< Window flags (the meaning is private to the GWIN class) -#if GDISP_NEED_TEXT - font_t font; // @< Current font -#endif + #if GWIN_NEED_WINDOWMANAGER + gfxQueueASyncItem wmq; // @< The next window (for the window manager) + #endif + const struct gwinVMT *vmt; // @< The VMT for this GWIN + coord_t x, y; // @< Screen relative position + coord_t width, height; // @< Dimensions of this window + color_t color, bgcolor; // @< The current drawing colors + uint16_t flags; // @< Window flags (the meaning is private to the GWIN class) + #if GDISP_NEED_TEXT + font_t font; // @< The current font + #endif } GWindowObject, * GHandle; /* @} */ +/** + * @brief A window's minimized, maximized or normal size + */ +typedef enum { GWIN_NORMAL, GWIN_MAXIMIZE, GWIN_MINIMIZE } GWindowMinMax; + #ifdef __cplusplus extern "C" { #endif -/* Base Functions */ +/*------------------------------------------------- + * Window Manager functions + *-------------------------------------------------*/ -/** - * @brief Create a basic window. - * @return NULL if there is no resultant drawing area, otherwise a window handle. - * - * @param[in] pgw The window structure to initialize. If this is NULL the structure is dynamically allocated. - * @param[in] x,y The screen coordinates for the top left corner of the window - * @param[in] width The width of the window - * @param[in] height The height of the window - * - * @note The default drawing color gets set to White and the background drawing color to Black. - * @note No default font is set so make sure to set one before drawing any text. - * @note The dimensions and position may be changed to fit on the real screen. - * @note The window is not automatically cleared on creation. You must do that by calling @p gwinClear() - * (possibly after changing your background color) - * - * @api - */ -GHandle gwinCreateWindow(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height); +#if GWIN_NEED_WINDOWMANAGER + // Forward definition + struct GWindowManager; -/** - * @brief Destroy a window (of any type). Releases any dynamically allocated memory. - * - * @param[in] gh The window handle - * - * @api - */ -void gwinDestroy(GHandle gh); - -/** - * @brief Get the real class name of the GHandle - * @details Returns a string describing the object class. - * - * @param[in] gh The window - */ -const char *gwinGetClassName(GHandle gh); - -/** - * @brief Get an ID that uniquely describes the class of the GHandle - * - * @param[in] gh The window - */ -#define gwinGetClassID(gh) ((void *)((gh)->vmt)) - -/** - * @brief Get the X coordinate of the window - * @details Returns the X coordinate of the origin of the window. - * The coordinate is relative to the physical screen zero point. - * - * @param[in] gh The window - */ -#define gwinGetScreenX(gh) ((gh)->x) - -/** - * @brief Get the Y coordinate of the window - * @details Returns the Y coordinate of the origin of the window. - * The coordinate is relative to the physical screen zero point. - * - * @param[in] gh The window - */ -#define gwinGetScreenY(gh) ((gh)->y) - -/** - * @brief Get the width of the window - * - * @param[in] gh The window - */ -#define gwinGetWidth(gh) ((gh)->width) - -/** - * @brief Get the height of the window - * - * @param[in] gh The window - */ -#define gwinGetHeight(gh) ((gh)->height) - -/** - * @brief Set the default foreground color for all new GWIN windows - * - * @param[in] gh The window - * @param[in] clr The color to be set - */ -void gwinSetDefaultColor(color_t clr); - -/** - * @brief Set the default background color for all new GWIN windows - * - * @param[in] gh The window - * @param[in] bgclr The background color - */ -void gwinSetDefaultBgColor(color_t bgclr); - -/** - * @brief Set foreground color - * @details Set the color which will be used to draw - * - * @param[in] gh The window - * @param[in] clr The color to be set - */ -#define gwinSetColor(gh, clr) (gh)->color = (clr) - -/** - * @brief Set background color - * @details Set the color which will be used as background - * @note gwinClear() must be called to set the background color - * - * @param[in] gh The window - * @param[in] bgclr The background color - */ -#define gwinSetBgColor(gh, bgclr) (gh)->bgcolor = (bgclr) - -/* Set up for text */ - -#if GDISP_NEED_TEXT || defined(__DOXYGEN__) /** - * @brief Set the default font for all new GWIN windows + * @brief Set the window manager for the GWIN system. + * + * @param[in] gwm The window manager to use. Can be NULL to turn off the existing window manager. + * + * @note A window manager is responsible for handling when window visibility is changed or + * a window is resized for moved. Note that only saved window states will be redrawn. Each + * window type can save different information (or none at all). See the documentation on each window + * type to see which information it saves (and can therefore be automatically redrawn). + * For window types that do not save any state information, the window manager determines what to do. + * Generally it will just clear the window to its background color. + * + * @api + */ + void gwinSetWindowManager(struct GWindowManager *gwm); +#endif + +/*------------------------------------------------- + * Functions that affect all windows + *-------------------------------------------------*/ + + /** + * @brief Set the default foreground color for all new GWIN windows * * @param[in] gh The window - */ - void gwinSetDefaultFont(font_t font); - - /** - * @brief Set the current font for this window. - * - * @param[in] gh The window handle - * @param[in] font The font to use for text functions + * @param[in] clr The color to be set * * @api */ - void gwinSetFont(GHandle gh, font_t font); -#endif + void gwinSetDefaultColor(color_t clr); -/* Drawing Functions */ - -/** - * @brief Clear the window - * @note Uses the current background color to clear the window - * - * @param[in] gh The window handle - * - * @api - */ -void gwinClear(GHandle gh); - -/** - * @brief Set a pixel in the window - * @note Uses the current foreground color to set the pixel - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The coordinates of the pixel - * - * @api - */ -void gwinDrawPixel(GHandle gh, coord_t x, coord_t y); - -/** - * @brief Draw a line in the window - * @note Uses the current foreground color to draw the line - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x0,y0 The start position - * @param[in] x1,y1 The end position - * - * @api - */ -void gwinDrawLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1); - -/** - * @brief Draw a box in the window - * @note Uses the current foreground color to draw the box - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The start position - * @param[in] cx,cy The size of the box (outside dimensions) - * - * @api - */ -void gwinDrawBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); - -/** - * @brief Fill an rectangular area in the window - * @note Uses the current foreground color to fill the box - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The start position - * @param[in] cx,cy The size of the box (outside dimensions) - * - * @api - */ -void gwinFillArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); - -/** - * @brief Fill an area in the window using the supplied bitmap. - * @details The bitmap is in the pixel format specified by the low level driver - * @note If GDISP_NEED_ASYNC is defined then the buffer must be static - * or at least retained until this call has finished the blit. You can - * tell when all graphics drawing is finished by @p gdispIsBusy() going FALSE. - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x, y The start filled area - * @param[in] cx, cy The width and height to be filled - * @param[in] srcx, srcy The bitmap position to start the fill from - * @param[in] srccx The width of a line in the bitmap. - * @param[in] buffer The pixels to use to fill the area. - * - * @api - */ -void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer); - -/* Circle Functions */ - -#if GDISP_NEED_CIRCLE || defined(__DOXYGEN__) /** - * @brief Draw a circle in the window. - * @note Uses the current foreground color to draw the circle + * @brief Set the default background color for all new GWIN windows + * + * @param[in] gh The window + * @param[in] bgclr The background color + * + * @api + */ + void gwinSetDefaultBgColor(color_t bgclr); + + #if GDISP_NEED_TEXT || defined(__DOXYGEN__) + /** + * @brief Set the default font for all new GWIN windows + * + * @param[in] gh The window + * + * @api + */ + void gwinSetDefaultFont(font_t font); + #endif + + +/*------------------------------------------------- + * Base functions + *-------------------------------------------------*/ + + /** + * @brief Create a basic window. + * @return NULL if there is no resultant drawing area, otherwise a window handle. + * + * @param[in] pgw The window structure to initialize. If this is NULL the structure is dynamically allocated. + * @param[in] x,y The screen coordinates for the top left corner of the window + * @param[in] width The width of the window + * @param[in] height The height of the window + * + * @note The drawing color and the background color get set to the current defaults. If you haven't called + * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. + * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there + * is no default font and text drawing operations will no nothing. + * @note The dimensions and position may be changed to fit on the real screen. + * @note On creation the window is marked as visible. + * @note A basic window does not save the drawing state. It is not automatically redrawn if the window is moved or + * its visibility state is changed. + * + * @api + */ + GHandle gwinCreateWindow(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height); + + /** + * @brief Destroy a window (of any type). Releases any dynamically allocated memory. + * + * @param[in] gh The window handle + * + * @api + */ + void gwinDestroy(GHandle gh); + + /** + * @brief Get the real class name of the GHandle + * @details Returns a string describing the object class. + * + * @param[in] gh The window + * + * @api + */ + const char *gwinGetClassName(GHandle gh); + + /** + * @brief Get an ID that uniquely describes the class of the GHandle + * + * @param[in] gh The window + * + * @api + */ + #define gwinGetClassID(gh) ((void *)((gh)->vmt)) + + /** + * @brief Get the X coordinate of the window + * @details Returns the X coordinate of the origin of the window. + * The coordinate is relative to the physical screen zero point. + * + * @param[in] gh The window + * + * @api + */ + #define gwinGetScreenX(gh) ((gh)->x) + + /** + * @brief Get the Y coordinate of the window + * @details Returns the Y coordinate of the origin of the window. + * The coordinate is relative to the physical screen zero point. + * + * @param[in] gh The window + * + * @api + */ + #define gwinGetScreenY(gh) ((gh)->y) + + /** + * @brief Get the width of the window + * + * @param[in] gh The window + * + * @api + */ + #define gwinGetWidth(gh) ((gh)->width) + + /** + * @brief Get the height of the window + * + * @param[in] gh The window + * + * @api + */ + #define gwinGetHeight(gh) ((gh)->height) + + /** + * @brief Set foreground color + * @details Set the color which will be used to draw + * + * @param[in] gh The window + * @param[in] clr The color to be set + * + * @api + */ + #define gwinSetColor(gh, clr) (gh)->color = (clr) + + /** + * @brief Set background color + * @details Set the color which will be used as background + * @note gwinClear() must be called to set the background color + * + * @param[in] gh The window + * @param[in] bgclr The background color + * + * @api + */ + #define gwinSetBgColor(gh, bgclr) (gh)->bgcolor = (bgclr) + + /** + * @brief Sets whether a window is visible or not + * + * @param[in] gh The window + * @param[in] visible Whether the window should be visible or not + * + * @note When a window is marked as not visible, drawing operations + * on the window do nothing. + * @note When a window is marked as visible, it is not automatically + * redrawn as many window types don't remember their drawing state. + * Widgets such as Buttons, Sliders etc will be redrawn. + * @note If there is no window manager in use, when a window is marked + * as not visible, nothing is done to remove the window from the screen. + * When there is a window manager, it is up to the window manager to + * handle what happens. + * + * @api + */ + void gwinSetVisible(GHandle gh, bool_t visible); + + /** + * @brief Gets the visibility of a window + * @return TRUE if visible + * + * @param[in] gh The window + * + * @api + */ + bool_t gwinGetVisible(GHandle gh); + + /** + * @brief Move a window + * + * @param[in] gh The window + * @param[in] x, y The new position (screen relative) for this window + * + * @note The final window position may not be the requested position. Windows + * are clipped to the screen area and the window manager may also affect the position. + * @note The window is redrawn if it is visible. See the comments in @p gwinSetVisible() + * with regard to what can be redrawn and what can't. + * @note It is up to the window manager to determine what happens with the screen area + * uncovered by moving the window. When there is no window manager, nothing + * is done with the uncovered area. + * + * @api + */ + void gwinMove(GHandle gh, coord_t x, coord_t y); + + /** + * @brief Resize a window + * + * @param[in] gh The window + * @param[in] width, height The new size of the window + * + * @note The final window size may not be the requested size. Windows + * are clipped to the screen area and the window manager may also affect the size. + * @note The window is redrawn if it is visible. See the comments in @p gwinSetVisible() + * with regard to what can be redrawn and what can't. + * @note It is up to the window manager to determine what happens with any screen area + * uncovered by resizing the window. When there is no window manager, nothing + * is done with the uncovered area. + * + * @api + */ + void gwinResize(GHandle gh, coord_t width, coord_t height); + + /** + * @brief Minimize, Maximize or Restore a window + * + * @param[in] gh The window + * @param[in] minmax The new minimized/maximized state + * + * @note The final window state may not be the requested state. Window Managers + * do not need to implement changing the minmax state. If there is no + * window manager this call is ignored. + * @note The window is redrawn if it is changed. See the comments in @p gwinSetVisible() + * with regard to what can be redrawn and what can't. + * @note It is up to the window manager to determine what happens with any screen area + * uncovered by resizing the window. + * @note When a window is minimised it may be asked to draw the window or the window + * manager may draw the minimised window. + * + * @api + */ + void gwinSetMinMax(GHandle gh, GWindowMinMax minmax); + + /** + * @brief Get the Minimized/Maximized state of a window + * + * @param[in] gh The window + * + * @api + */ + GWindowMinMax gwinGetMinMax(GHandle gh); + + /** + * @brief Raise a window to the top of the z-order + * + * @param[in] gh The window + * + * @note The window z-order is only supported by some window managers. If there is no + * window manager this call simple tries to redraw the window. See the comments + * in @p gwinSetVisible() with regard to what can be redrawn and what can't. + * + * @api + */ + void gwinRaise(GHandle gh); + + #if GDISP_NEED_TEXT || defined(__DOXYGEN__) + /** + * @brief Set the current font for this window. + * + * @param[in] gh The window handle + * @param[in] font The font to use for text functions + * + * @api + */ + void gwinSetFont(GHandle gh, font_t font); + #endif + +/*------------------------------------------------- + * Drawing functions + *-------------------------------------------------*/ + + /** + * @brief Clear the window + * @note Uses the current background color to clear the window + * + * @param[in] gh The window handle + * + * @api + */ + void gwinClear(GHandle gh); + + /** + * @brief Set a pixel in the window + * @note Uses the current foreground color to set the pixel * @note May leave GDISP clipping to this window's dimensions * * @param[in] gh The window handle - * @param[in] x, y The center of the circle - * @param[in] radius The radius of the circle + * @param[in] x,y The coordinates of the pixel * * @api */ - void gwinDrawCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); + void gwinDrawPixel(GHandle gh, coord_t x, coord_t y); /** - * @brief Draw a filled circle in the window. - * @note Uses the current foreground color to draw the filled circle + * @brief Draw a line in the window + * @note Uses the current foreground color to draw the line * @note May leave GDISP clipping to this window's dimensions * * @param[in] gh The window handle - * @param[in] x, y The center of the circle - * @param[in] radius The radius of the circle + * @param[in] x0,y0 The start position + * @param[in] x1,y1 The end position * * @api */ - void gwinFillCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); -#endif + void gwinDrawLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1); -/* Ellipse Functions */ - -#if GDISP_NEED_ELLIPSE || defined(__DOXYGEN__) /** - * @brief Draw an ellipse. - * @note Uses the current foreground color to draw the ellipse + * @brief Draw a box in the window + * @note Uses the current foreground color to draw the box * @note May leave GDISP clipping to this window's dimensions * * @param[in] gh The window handle - * @param[in] x,y The center of the ellipse - * @param[in] a,b The dimensions of the ellipse + * @param[in] x,y The start position + * @param[in] cx,cy The size of the box (outside dimensions) * * @api */ - void gwinDrawEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); + void gwinDrawBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); /** - * @brief Draw an filled ellipse. - * @note Uses the current foreground color to draw the filled ellipse + * @brief Fill an rectangular area in the window + * @note Uses the current foreground color to fill the box * @note May leave GDISP clipping to this window's dimensions * * @param[in] gh The window handle - * @param[in] x,y The center of the ellipse - * @param[in] a,b The dimensions of the ellipse + * @param[in] x,y The start position + * @param[in] cx,cy The size of the box (outside dimensions) * * @api */ - void gwinFillEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); -#endif + void gwinFillArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy); -/* Arc Functions */ - -#if GDISP_NEED_ARC || defined(__DOXYGEN__) - /* - * @brief Draw an arc in the window. - * @note Uses the current foreground color to draw the arc + /** + * @brief Fill an area in the window using the supplied bitmap. + * @details The bitmap is in the pixel format specified by the low level driver + * @note If GDISP_NEED_ASYNC is defined then the buffer must be static + * or at least retained until this call has finished the blit. You can + * tell when all graphics drawing is finished by @p gdispIsBusy() going FALSE. * @note May leave GDISP clipping to this window's dimensions * * @param[in] gh The window handle - * @param[in] x,y The center point - * @param[in] radius The radius of the arc - * @param[in] start The start angle (0 to 360) - * @param[in] end The end angle (0 to 360) + * @param[in] x, y The start filled area + * @param[in] cx, cy The width and height to be filled + * @param[in] srcx, srcy The bitmap position to start the fill from + * @param[in] srccx The width of a line in the bitmap. + * @param[in] buffer The pixels to use to fill the area. * * @api */ - void gwinDrawArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); + void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer); - /* - * @brief Draw a filled arc in the window. - * @note Uses the current foreground color to draw the filled arc - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The center point - * @param[in] radius The radius of the arc - * @param[in] start The start angle (0 to 360) - * @param[in] end The end angle (0 to 360) - * - * @api - */ - void gwinFillArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); -#endif +/*------------------------------------------------- + * Circle, ellipse and arc functions + *-------------------------------------------------*/ -/* Read a pixel Function */ + #if GDISP_NEED_CIRCLE || defined(__DOXYGEN__) + /** + * @brief Draw a circle in the window. + * @note Uses the current foreground color to draw the circle + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x, y The center of the circle + * @param[in] radius The radius of the circle + * + * @api + */ + void gwinDrawCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); -#if GDISP_NEED_PIXELREAD || defined(__DOXYGEN__) - /** - * @brief Get the color of a pixel in the window. - * @return The color of the pixel. - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position in the window - * - * @api - */ - color_t gwinGetPixelColor(GHandle gh, coord_t x, coord_t y); -#endif + /** + * @brief Draw a filled circle in the window. + * @note Uses the current foreground color to draw the filled circle + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x, y The center of the circle + * @param[in] radius The radius of the circle + * + * @api + */ + void gwinFillCircle(GHandle gh, coord_t x, coord_t y, coord_t radius); + #endif -/* Extra Text Functions */ + #if GDISP_NEED_ELLIPSE || defined(__DOXYGEN__) + /** + * @brief Draw an ellipse. + * @note Uses the current foreground color to draw the ellipse + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center of the ellipse + * @param[in] a,b The dimensions of the ellipse + * + * @api + */ + void gwinDrawEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); -#if GDISP_NEED_TEXT || defined(__DOXYGEN__) - /** - * @brief Draw a text character at the specified position in the window. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] c The character to draw - * - * @api - */ - void gwinDrawChar(GHandle gh, coord_t x, coord_t y, char c); + /** + * @brief Draw an filled ellipse. + * @note Uses the current foreground color to draw the filled ellipse + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center of the ellipse + * @param[in] a,b The dimensions of the ellipse + * + * @api + */ + void gwinFillEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b); + #endif - /** - * @brief Draw a text character with a filled background at the specified position in the window. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character and fills the background using the background drawing color - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] c The character to draw - * - * @api - */ - void gwinFillChar(GHandle gh, coord_t x, coord_t y, char c); + #if GDISP_NEED_ARC || defined(__DOXYGEN__) + /* + * @brief Draw an arc in the window. + * @note Uses the current foreground color to draw the arc + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center point + * @param[in] radius The radius of the arc + * @param[in] start The start angle (0 to 360) + * @param[in] end The end angle (0 to 360) + * + * @api + */ + void gwinDrawArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); - /** - * @brief Draw a text string in the window - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] str The string to draw - * - * @api - */ - void gwinDrawString(GHandle gh, coord_t x, coord_t y, const char *str); + /* + * @brief Draw a filled arc in the window. + * @note Uses the current foreground color to draw the filled arc + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The center point + * @param[in] radius The radius of the arc + * @param[in] start The start angle (0 to 360) + * @param[in] end The end angle (0 to 360) + * + * @api + */ + void gwinFillArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle); + #endif - /** - * @brief Draw a text string with a filled background in the window - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character and fills the background using the background drawing color - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text - * @param[in] str The string to draw - * - * @api - */ - void gwinFillString(GHandle gh, coord_t x, coord_t y, const char *str); +/*------------------------------------------------- + * Pixel read-back functions + *-------------------------------------------------*/ - /** - * @brief Draw a text string verticly centered within the specified box. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character. - * @note The specified box does not need to align with the window box - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text (need to define top-right or base-line - check code) - * @param[in] cx,cy The width and height of the box - * @param[in] str The string to draw - * @param[in] justify Justify the text left, center or right within the box - * - * @api - */ - void gwinDrawStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); + #if GDISP_NEED_PIXELREAD || defined(__DOXYGEN__) + /** + * @brief Get the color of a pixel in the window. + * @return The color of the pixel. + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position in the window + * + * @api + */ + color_t gwinGetPixelColor(GHandle gh, coord_t x, coord_t y); + #endif - /** - * @brief Draw a text string verticly centered within the specified filled box. - * @pre The font must have been set. - * @note Uses the current foreground color to draw the character and fills the background using the background drawing color - * @note The entire box is filled. Note this box does not need to align with the window box - * @note May leave GDISP clipping to this window's dimensions - * - * @param[in] gh The window handle - * @param[in] x,y The position for the text (need to define top-right or base-line - check code) - * @param[in] cx,cy The width and height of the box - * @param[in] str The string to draw - * @param[in] justify Justify the text left, center or right within the box - * - * @api - */ - void gwinFillStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); -#endif +/*------------------------------------------------- + * Text functions + *-------------------------------------------------*/ -#if GDISP_NEED_CONVEX_POLYGON || defined(__DOXYGEN__) - /** - * @brief Draw an enclosed polygon (convex, non-convex or complex). - * - * @note Uses the current foreground color. - * - * @param[in] gh The window handle - * @param[in] tx, ty Transform all points in pntarray by tx, ty - * @param[in] pntarray An array of points - * @param[in] cnt The number of points in the array - * - * @api - */ - void gwinDrawPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); + #if GDISP_NEED_TEXT || defined(__DOXYGEN__) + /** + * @brief Draw a text character at the specified position in the window. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] c The character to draw + * + * @api + */ + void gwinDrawChar(GHandle gh, coord_t x, coord_t y, char c); - /** - * @brief Fill a convex polygon - * @details Doesn't handle non-convex or complex polygons. - * - * @note Uses the current foreground color. - * - * @param[in] gh The window handle - * @param[in] tx, ty Transform all points in pntarray by tx, ty - * @param[in] pntarray An array of points - * @param[in] cnt The number of points in the array - * - * @note Convex polygons are those that have no internal angles. That is; - * you can draw a line from any point on the polygon to any other point - * on the polygon without it going outside the polygon. In our case we generalise - * this a little by saying that an infinite horizontal line (at any y value) will cross - * no more than two edges on the polygon. Some non-convex polygons do fit this criteria - * and can therefore be drawn. - * @note This routine is designed to be very efficient with even simple display hardware. - * - * @api - */ - void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); -#endif + /** + * @brief Draw a text character with a filled background at the specified position in the window. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character and fills the background using the background drawing color + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] c The character to draw + * + * @api + */ + void gwinFillChar(GHandle gh, coord_t x, coord_t y, char c); -#if GDISP_NEED_IMAGE || defined(__DOXYGEN__) - /** - * @brief Draw the image - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @param[in] gh The window handle - * @param[in] img The image structure - * @param[in] x,y The window location to draw the image - * @param[in] cx,cy The area on the screen to draw - * @param[in] sx,sy The image position to start drawing at - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image - * is simply not drawn. - * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a - * fast blit from the cached frame. If not, it reads the input and decodes it as it - * is drawing. This may be significantly slower than if the image has been cached (but - * uses a lot less RAM) - */ - gdispImageError gwinImageDraw(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); -#endif + /** + * @brief Draw a text string in the window + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] str The string to draw + * + * @api + */ + void gwinDrawString(GHandle gh, coord_t x, coord_t y, const char *str); + + /** + * @brief Draw a text string with a filled background in the window + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character and fills the background using the background drawing color + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text + * @param[in] str The string to draw + * + * @api + */ + void gwinFillString(GHandle gh, coord_t x, coord_t y, const char *str); + + /** + * @brief Draw a text string verticly centered within the specified box. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character. + * @note The specified box does not need to align with the window box + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text (need to define top-right or base-line - check code) + * @param[in] cx,cy The width and height of the box + * @param[in] str The string to draw + * @param[in] justify Justify the text left, center or right within the box + * + * @api + */ + void gwinDrawStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); + + /** + * @brief Draw a text string verticly centered within the specified filled box. + * @pre The font must have been set. + * @note Uses the current foreground color to draw the character and fills the background using the background drawing color + * @note The entire box is filled. Note this box does not need to align with the window box + * @note May leave GDISP clipping to this window's dimensions + * + * @param[in] gh The window handle + * @param[in] x,y The position for the text (need to define top-right or base-line - check code) + * @param[in] cx,cy The width and height of the box + * @param[in] str The string to draw + * @param[in] justify Justify the text left, center or right within the box + * + * @api + */ + void gwinFillStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify); + #endif + +/*------------------------------------------------- + * Polygon functions + *-------------------------------------------------*/ + + #if GDISP_NEED_CONVEX_POLYGON || defined(__DOXYGEN__) + /** + * @brief Draw an enclosed polygon (convex, non-convex or complex). + * + * @note Uses the current foreground color. + * + * @param[in] gh The window handle + * @param[in] tx, ty Transform all points in pntarray by tx, ty + * @param[in] pntarray An array of points + * @param[in] cnt The number of points in the array + * + * @api + */ + void gwinDrawPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); + + /** + * @brief Fill a convex polygon + * @details Doesn't handle non-convex or complex polygons. + * + * @note Uses the current foreground color. + * + * @param[in] gh The window handle + * @param[in] tx, ty Transform all points in pntarray by tx, ty + * @param[in] pntarray An array of points + * @param[in] cnt The number of points in the array + * + * @note Convex polygons are those that have no internal angles. That is; + * you can draw a line from any point on the polygon to any other point + * on the polygon without it going outside the polygon. In our case we generalise + * this a little by saying that an infinite horizontal line (at any y value) will cross + * no more than two edges on the polygon. Some non-convex polygons do fit this criteria + * and can therefore be drawn. + * @note This routine is designed to be very efficient with even simple display hardware. + * + * @api + */ + void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); + #endif + +/*------------------------------------------------- + * Image functions + *-------------------------------------------------*/ + + #if GDISP_NEED_IMAGE || defined(__DOXYGEN__) + /** + * @brief Draw the image + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @param[in] gh The window handle + * @param[in] img The image structure + * @param[in] x,y The window location to draw the image + * @param[in] cx,cy The area on the screen to draw + * @param[in] sx,sy The image position to start drawing at + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image + * is simply not drawn. + * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a + * fast blit from the cached frame. If not, it reads the input and decodes it as it + * is drawing. This may be significantly slower than if the image has been cached (but + * uses a lot less RAM) + * + * @api + */ + gdispImageError gwinImageDraw(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); + #endif #ifdef __cplusplus } #endif -/* Include widgets */ -#include "gwin/gwidget.h" +/*------------------------------------------------- + * Additional functionality + *-------------------------------------------------*/ -/* Include extra window types */ -#if GWIN_NEED_CONSOLE || defined(__DOXYGEN__) - #include "gwin/console.h" -#endif -#if GWIN_NEED_GRAPH || defined(__DOXYGEN__) - #include "gwin/graph.h" -#endif + /* Include widgets */ + #if GWIN_NEED_WIDGET || defined(__DOXYGEN__) + #include "gwin/gwidget.h" + #endif + + /* Include extra window types */ + #if GWIN_NEED_CONSOLE || defined(__DOXYGEN__) + #include "gwin/console.h" + #endif + #if GWIN_NEED_GRAPH || defined(__DOXYGEN__) + #include "gwin/graph.h" + #endif #endif /* GFX_USE_GWIN */ diff --git a/include/gwin/options.h b/include/gwin/options.h index 683a6e55..3619e075 100644 --- a/include/gwin/options.h +++ b/include/gwin/options.h @@ -21,20 +21,22 @@ * @{ */ /** - * @brief Should button functions be included. + * @brief Should a window manager be used. * @details Defaults to FALSE */ - #ifndef GWIN_NEED_BUTTON - #define GWIN_NEED_BUTTON FALSE + #ifndef GWIN_NEED_WINDOWMANAGER + #define GWIN_NEED_WINDOWMANAGER FALSE + #endif + /** + * @brief Should widget functions be included. Needed for any widget (eg Buttons, Sliders etc) + * @details Defaults to FALSE + */ + #ifndef GWIN_NEED_WIDGET + #define GWIN_NEED_WIDGET FALSE #endif /** * @brief Should console functions be included. * @details Defaults to FALSE - * @note To use chprintf() for printing in a console window you need to - * include in your application source file... - * \#include "chprintf.h" - * Also in your makefile, as part of your list of C source files, include - * ${CHIBIOS}/os/various/chprintf.c */ #ifndef GWIN_NEED_CONSOLE #define GWIN_NEED_CONSOLE FALSE @@ -46,6 +48,13 @@ #ifndef GWIN_NEED_GRAPH #define GWIN_NEED_GRAPH FALSE #endif + /** + * @brief Should button functions be included. + * @details Defaults to FALSE + */ + #ifndef GWIN_NEED_BUTTON + #define GWIN_NEED_BUTTON FALSE + #endif /** * @brief Should slider functions be included. * @details Defaults to FALSE @@ -53,6 +62,13 @@ #ifndef GWIN_NEED_SLIDER #define GWIN_NEED_SLIDER FALSE #endif + /** + * @brief Should checkbox functions be included. + * @details Defaults to FALSE + */ + #ifndef GWIN_NEED_CHECKBOX + #define GWIN_NEED_CHECKBOX FALSE + #endif /** * @} * @@ -76,6 +92,12 @@ /** * @brief Console Windows need BaseStreamSequential support (ChibiOS only) * @details Defaults to FALSE + * @note To use the ChibiOS basestream functions such as chprintf() + * for printing in a console window you need to set this option to + * TRUE in your gfxconf.h and include in your application source file... + * \#include "chprintf.h" + * In your makefile, as part of your list of C source files, include + * ${CHIBIOS}/os/various/chprintf.c */ #ifndef GWIN_CONSOLE_USE_BASESTREAM #define GWIN_CONSOLE_USE_BASESTREAM FALSE diff --git a/src/gfx.c b/src/gfx.c index 2b307426..3856eea3 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -32,7 +32,7 @@ void DEPRECATED("Use gfxInit() instead") gdispInit() { gfxInit(); } /* These init functions are defined by each module but not published */ extern void _gosInit(void); -#if GFX_USE_GDISP && (GDISP_NEED_MULTITHREAD || GDISP_NEED_ASYNC) +#if GFX_USE_GDISP extern void _gdispInit(void); #endif #if GFX_USE_TDISP diff --git a/src/gqueue/gqueue.c b/src/gqueue/gqueue.c index d515a425..11d10c0a 100644 --- a/src/gqueue/gqueue.c +++ b/src/gqueue/gqueue.c @@ -21,6 +21,9 @@ * @file src/gqueue/gqueue.c * @brief GQUEUE source file. */ + +#include "gfx.h" + #if GFX_USE_GQUEUE #if GQUEUE_NEED_ASYNC @@ -34,7 +37,7 @@ gfxSystemLock(); if ((pi = pqueue->head)) pqueue->head = pi->next; - gfxSytemUnlock(); + gfxSystemUnlock(); return pi; } void gfxQueueASyncPut(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem) { @@ -58,13 +61,15 @@ gfxSystemUnlock(); } void gfxQueueASyncRemove(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem) { + gfxQueueASyncItem *pi; + if (!pitem) return; gfxSystemLock(); if (pqueue->head) { if (pqueue->head == pitem) { pqueue->head = pitem->next; } else { - for(gfxQueueASyncItem *pi = pqueue->head; pi->next; pi = pi->next) { + for(pi = pqueue->head; pi->next; pi = pi->next) { if (pi->next == pitem) { pi->next = pitem->next; if (pqueue->tail == pitem) @@ -80,8 +85,10 @@ return pqueue->head == NULL; } bool_t gfxQueueASyncIsIn(gfxQueueASync *pqueue, gfxQueueASyncItem *pitem) { + gfxQueueASyncItem *pi; + gfxSystemLock(); - for(gfxQueueASyncItem *pi = pqueue->head; pi; pi = pi->next) { + for(pi = pqueue->head; pi; pi = pi->next) { if (pi == pitem) { gfxSystemUnlock(); return TRUE; @@ -132,13 +139,15 @@ gfxSemSignal(&pqueue->sem); } void gfxQueueGSyncRemove(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem) { + gfxQueueGSyncItem *pi; + if (!pitem) return; gfxSystemLock(); if (pqueue->head) { if (pqueue->head == pitem) { pqueue->head = pitem->next; } else { - for(gfxQueueGSyncItem *pi = pqueue->head; pi->next; pi = pi->next) { + for(pi = pqueue->head; pi->next; pi = pi->next) { if (pi->next == pitem) { pi->next = pitem->next; if (pqueue->tail == pitem) @@ -154,8 +163,10 @@ return pqueue->head == NULL; } bool_t gfxQueueGSyncIsIn(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem) { + gfxQueueGSyncItem *pi; + gfxSystemLock(); - for(gfxQueueGSyncItem *pi = pqueue->head; pi; pi = pi->next) { + for(pi = pqueue->head; pi; pi = pi->next) { if (pi == pitem) { gfxSystemUnlock(); return TRUE; @@ -214,6 +225,8 @@ return gfxSemWait(&pitem->sem, ms); } void gfxQueueFSyncRemove(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem) { + gfxQueueFSyncItem *pi; + if (!pitem) return; gfxSystemLock(); if (pqueue->head) { @@ -225,7 +238,7 @@ gfxSemDestroy(&pitem->sem); return; } - for(gfxQueueFSyncItem *pi = pqueue->head; pi->next; pi = pi->next) { + for(pi = pqueue->head; pi->next; pi = pi->next) { if (pi->next == pitem) { pi->next = pitem->next; if (pqueue->tail == pitem) @@ -240,8 +253,10 @@ return pqueue->head == NULL; } bool_t gfxQueueFSyncIsIn(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem) { + gfxQueueASyncItem *pi; + gfxSystemLock(); - for(gfxQueueFSyncItem *pi = pqueue->head; pi; pi = pi->next) { + for(pi = pqueue->head; pi; pi = pi->next) { if (pi == pitem) { gfxSystemUnlock(); return TRUE; diff --git a/src/gwin/button.c b/src/gwin/button.c index 1ebc8ee5..83b81b03 100644 --- a/src/gwin/button.c +++ b/src/gwin/button.c @@ -40,6 +40,7 @@ static const gwidgetVMT buttonVMT = { { "Button", // The classname _gwidgetDestroy, // The destroy routine + _gwidgetRedraw, // The redraw routine 0, // The after-clear routine }, gwinButtonDraw_3D, // The default drawing routine @@ -94,14 +95,14 @@ static void SendButtonEvent(GWidgetObject *gw) { static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { (void) x; (void) y; gw->g.flags |= GBUTTON_FLG_PRESSED; - gwinDraw((GHandle)gw); + _gwidgetRedraw((GHandle)gw); } // A mouse up has occurred (it may or may not be over the button) static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { (void) x; (void) y; gw->g.flags &= ~GBUTTON_FLG_PRESSED; - gwinDraw((GHandle)gw); + _gwidgetRedraw((GHandle)gw); #if !GWIN_BUTTON_LAZY_RELEASE // If the mouse up was not over the button then cancel the event @@ -116,14 +117,14 @@ static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { static void ToggleOff(GWidgetObject *gw, uint16_t instance) { (void) instance; gw->g.flags &= ~GBUTTON_FLG_PRESSED; - gwinDraw((GHandle)gw); + _gwidgetRedraw((GHandle)gw); } // A toggle on has occurred static void ToggleOn(GWidgetObject *gw, uint16_t instance) { (void) instance; gw->g.flags |= GBUTTON_FLG_PRESSED; - gwinDraw((GHandle)gw); + _gwidgetRedraw((GHandle)gw); // Trigger the event on button down (different than for mouse/touch) SendButtonEvent(gw); } diff --git a/src/gwin/checkbox.c b/src/gwin/checkbox.c index d35f271c..893dab9c 100644 --- a/src/gwin/checkbox.c +++ b/src/gwin/checkbox.c @@ -33,6 +33,7 @@ static const gwidgetVMT checkboxVMT = { { "Checkbox", // The classname _gwidgetDestroy, // The destroy routine + _gwidgetRedraw, // The redraw routine 0, // The after-clear routine }, gwinCheckboxDraw_CheckOnLeft, // The default drawing routine @@ -78,7 +79,7 @@ static void SendCheckboxEvent(GWidgetObject *gw) { static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { (void) x; (void) y; gw->g.flags ^= GCHECKBOX_FLG_CHECKED; - gwinDraw((GHandle)gw); + _gwidgetRedraw((GHandle)gw); SendCheckboxEvent(gw); } @@ -86,7 +87,7 @@ static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { static void ToggleOn(GWidgetObject *gw, uint16_t instance) { (void) instance; gw->g.flags ^= GCHECKBOX_FLG_CHECKED; - gwinDraw((GHandle)gw); + _gwidgetRedraw((GHandle)gw); SendCheckboxEvent(gw); } diff --git a/src/gwin/console.c b/src/gwin/console.c index d9bda362..c4b2798d 100644 --- a/src/gwin/console.c +++ b/src/gwin/console.c @@ -61,11 +61,12 @@ static void AfterClear(GWindowObject *gh) { static const gwinVMT consoleVMT = { "Console", // The classname 0, // The destroy routine + 0, // The redraw routine AfterClear, // The after-clear routine }; GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gc = (GConsoleObject *)_gwinInit((GWindowObject *)gc, x, y, width, height, sizeof(GConsoleObject), &consoleVMT))) + if (!(gc = (GConsoleObject *)_gwindowInit((GWindowObject *)gc, x, y, width, height, sizeof(GConsoleObject), &consoleVMT, GWIN_FLG_VISIBLE))) return 0; #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM gc->stream.vmt = &GWindowConsoleVMT; diff --git a/src/gwin/graph.c b/src/gwin/graph.c index 0ae9822b..393297e7 100644 --- a/src/gwin/graph.c +++ b/src/gwin/graph.c @@ -32,6 +32,7 @@ static const GGraphStyle GGraphDefaultStyle = { static const gwinVMT graphVMT = { "Graph", // The classname 0, // The destroy routine + 0, // The redraw routine 0, // The after-clear routine }; @@ -164,7 +165,7 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t } GHandle gwinCreateGraph(GGraphObject *gg, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gg = (GGraphObject *)_gwinInit((GWindowObject *)gg, x, y, width, height, sizeof(GGraphObject), &graphVMT))) + if (!(gg = (GGraphObject *)_gwindowInit((GWindowObject *)gg, x, y, width, height, sizeof(GGraphObject), &graphVMT, GWIN_FLG_VISIBLE))) return 0; gg->xorigin = gg->yorigin = 0; gg->lastx = gg->lasty = 0; diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c index 3f23140c..773a715d 100644 --- a/src/gwin/gwidget.c +++ b/src/gwin/gwidget.c @@ -7,7 +7,7 @@ #include "gfx.h" -#if GFX_USE_GWIN +#if GFX_USE_GWIN && GWIN_NEED_WIDGET #include @@ -24,7 +24,7 @@ static void gwidgetCallback(void *param, GEvent *pe) { #define pde ((GEventDial *)pe) // check if widget is disabled - if (!(gw->g.flags & GWIN_FLG_ENABLED)) + if ((gw->g.flags & (GWIN_FLG_ENABLED|GWIN_FLG_VISIBLE)) != (GWIN_FLG_ENABLED|GWIN_FLG_VISIBLE)) return; // Process via AllEvents() if it is defined @@ -87,10 +87,9 @@ static void gwidgetCallback(void *param, GEvent *pe) { } GHandle _gwidgetInit(GWidgetObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size, const gwidgetVMT *vmt) { - if (!(pgw = (GWidgetObject *)_gwinInit((GWindowObject *)pgw, x, y, width, height, size, (const gwinVMT *)vmt))) + if (!(pgw = (GWidgetObject *)_gwindowInit((GWindowObject *)pgw, x, y, width, height, size, (const gwinVMT *)vmt, GWIN_FLG_WIDGET|GWIN_FLG_ENABLED))) return 0; - pgw->g.flags |= (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED); pgw->txt = ""; pgw->fnDraw = vmt->DefaultDraw; pgw->fnParam = 0; @@ -101,9 +100,6 @@ GHandle _gwidgetInit(GWidgetObject *pgw, coord_t x, coord_t y, coord_t width, co } void _gwidgetDestroy(GHandle gh) { - if (!(gh->flags & GWIN_FLG_WIDGET)) - return; - // Deallocate the text (if necessary) if ((gh->flags & GWIN_FLG_ALLOCTXT)) { gh->flags &= ~GWIN_FLG_ALLOCTXT; @@ -112,21 +108,10 @@ void _gwidgetDestroy(GHandle gh) { // Untangle the listeners (both on us and to us). geventDetachSource(&gw->listener, 0); geventDetachSourceListeners((GSourceHandle)gh); - gh->flags &= ~GWIN_FLG_WIDGET; } -void gwinSetEnabled(GHandle gh, bool_t enabled) { - if (!(gh->flags & GWIN_FLG_WIDGET)) - return; - - if (enabled) - gh->flags |= GWIN_FLG_ENABLED; - else - gh->flags &= ~GWIN_FLG_ENABLED; -} - -void gwinDraw(GHandle gh) { - if (!(gh->flags & GWIN_FLG_WIDGET)) +void _gwidgetRedraw(GHandle gh) { + if (!(gh->flags & GWIN_FLG_VISIBLE)) return; #if GDISP_NEED_CLIP @@ -136,6 +121,23 @@ void gwinDraw(GHandle gh) { gw->fnDraw(gw, gw->fnParam); } +void gwinSetEnabled(GHandle gh, bool_t enabled) { + if (!(gh->flags & GWIN_FLG_WIDGET)) + return; + + if (enabled) { + if (!(gh->flags & GWIN_FLG_ENABLED)) { + gh->flags |= GWIN_FLG_ENABLED; + _gwidgetRedraw(gh); + } + } else { + if ((gh->flags & GWIN_FLG_ENABLED)) { + gh->flags &= ~GWIN_FLG_ENABLED; + _gwidgetRedraw(gh); + } + } +} + void gwinSetText(GHandle gh, const char *txt, bool_t useAlloc) { if (!(gh->flags & GWIN_FLG_WIDGET)) return; @@ -162,6 +164,7 @@ void gwinSetText(GHandle gh, const char *txt, bool_t useAlloc) { } gw->txt = txt ? txt : ""; + _gwidgetRedraw(gh); } const char *gwinGetText(GHandle gh) { @@ -177,6 +180,7 @@ void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param) { gw->fnDraw = fn ? fn : wvmt->DefaultDraw; gw->fnParam = param; + _gwidgetRedraw(gh); } bool_t gwinAttachListener(GHandle gh, GListener *pl, unsigned flags) { @@ -249,6 +253,6 @@ bool_t gwinAttachListener(GHandle gh, GListener *pl, unsigned flags) { } #endif -#endif /* GFX_USE_GWIN */ +#endif /* GFX_USE_GWIN && GWIN_NEED_WIDGET */ /** @} */ diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 163e821d..3e790d38 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -11,70 +11,121 @@ #include "gwin/class_gwin.h" +// Needed if there is no window manager +#define MIN_WIN_WIDTH 1 +#define MIN_WIN_HEIGHT 1 + +/*----------------------------------------------- + * Data + *-----------------------------------------------*/ + static const gwinVMT basegwinVMT = { "GWIN", // The classname 0, // The destroy routine + 0, // The redraw routine 0, // The after-clear routine }; -static font_t defaultFont; static color_t defaultFgColor = White; static color_t defaultBgColor = Black; +#if GDISP_NEED_TEXT + static font_t defaultFont; +#endif +#if GWIN_NEED_WINDOWMANAGER + gfxQueueASync _GWINList; + extern GWindowManager GNullWindowManager; + static GWindowManager * cwm; +#endif + +/*----------------------------------------------- + * Helper Routines + *-----------------------------------------------*/ + +#if !GWIN_NEED_WINDOWMANAGER + static void _gwm_vis(GHandle gh) { + if (gh->vmt->Redraw) { + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + gh->vmt->Redraw(gh); + } else + gwinClear(gh); + } + static void _gwm_redim(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h) { + if (x < 0) { w += x; x = 0; } + if (y < 0) { h += y; y = 0; } + if (x > gdispGetWidth()-MIN_WIN_WIDTH) x = gdispGetWidth()-MIN_WIN_WIDTH; + if (y > gdispGetHeight()-MIN_WIN_HEIGHT) y = gdispGetHeight()-MIN_WIN_HEIGHT; + if (w < MIN_WIN_WIDTH) { w = MIN_WIN_WIDTH; } + if (h < MIN_WIN_HEIGHT) { h = MIN_WIN_HEIGHT; } + if (x+w > gdispGetWidth()) w = gdispGetWidth() - x; + if (y+h > gdispGetHeight()) h = gdispGetHeight() - y; + gh->x = x; gh->y = y; + gh->width = w; gh->height = h; + } +#endif + +/*----------------------------------------------- + * Class Routines + *-----------------------------------------------*/ + +void _gwinInit(void) { + #if GWIN_NEED_WINDOWMANAGER + gfxQueueASyncInit(&_GWINList); + cwm = &GNullWindowManager; + cwm->vmt->Init(); + #endif +} // Internal routine for use by GWIN components only -// Initialise a window creating it dynamicly if required. -GHandle _gwinInit(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size, const gwinVMT *vmt) { - coord_t w, h; - - // Check the window size against the screen size - w = gdispGetWidth(); - h = gdispGetHeight(); - if (x < 0) { width += x; x = 0; } - if (y < 0) { height += y; y = 0; } - if (x >= w || y >= h) return 0; - if (x+width > w) width = w - x; - if (y+height > h) height = h - y; - +// Initialise a window creating it dynamically if required. +GHandle _gwindowInit(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size, const gwinVMT *vmt, uint16_t flags) { // Allocate the structure if necessary if (!pgw) { if (!(pgw = (GWindowObject *)gfxAlloc(size))) return 0; - pgw->flags = GWIN_FLG_DYNAMIC; + pgw->flags = flags|GWIN_FLG_DYNAMIC; } else - pgw->flags = 0; + pgw->flags = flags; // Initialise all basic fields pgw->vmt = vmt; - pgw->x = x; - pgw->y = y; - pgw->width = width; - pgw->height = height; pgw->color = defaultFgColor; pgw->bgcolor = defaultBgColor; #if GDISP_NEED_TEXT pgw->font = defaultFont; #endif + + #if GWIN_NEED_WINDOWMANAGER + if (!cwm->vmt->Add(pgw, x, y, width, height)) { + if ((pgw->flags & GWIN_FLG_DYNAMIC)) + gfxFree(pgw); + return 0; + } + #else + _gwm_redim(pgw, x, y, width, height); + if ((pgw->flags & GWIN_FLG_VISIBLE)) + _gwm_vis(pgw); + #endif + return (GHandle)pgw; } -GHandle gwinCreateWindow(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height) { - return _gwinInit(pgw, x, y, width, height, sizeof(GWindowObject), &basegwinVMT); -} +/*----------------------------------------------- + * Routines that affect all windows + *-----------------------------------------------*/ -void gwinDestroy(GHandle gh) { - if (gh->vmt->Destroy) - gh->vmt->Destroy(gh); - - // Clean up the structure - if (gh->flags & GWIN_FLG_DYNAMIC) { - gh->flags = 0; // To be sure, to be sure - gfxFree((void *)gh); +#if GWIN_NEED_WINDOWMANAGER + void gwinSetWindowManager(struct GWindowManager *gwm) { + if (!gwm) + gwm = &GNullWindowManager; + if (cwm != gwm) { + cwm->vmt->DeInit(); + cwm = gwm; + cwm->vmt->Init(); + } } -} - -const char *gwinGetClassName(GHandle gh) { - return gh->vmt->classname; -} +#endif void gwinSetDefaultColor(color_t clr) { defaultFgColor = clr; @@ -88,13 +139,119 @@ void gwinSetDefaultBgColor(color_t bgclr) { void gwinSetDefaultFont(font_t font) { defaultFont = font; } +#endif +/*----------------------------------------------- + * The GWindow Routines + *-----------------------------------------------*/ + +GHandle gwinCreateWindow(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height) { + return _gwindowInit(pgw, x, y, width, height, sizeof(GWindowObject), &basegwinVMT, GWIN_FLG_VISIBLE); +} + +void gwinDestroy(GHandle gh) { + // Remove from the window manager + #if GWIN_NEED_WINDOWMANAGER + cwm->vmt->Delete(gh); + #endif + + // Class destroy routine + if (gh->vmt->Destroy) + gh->vmt->Destroy(gh); + + // Clean up the structure + if (gh->flags & GWIN_FLG_DYNAMIC) + gfxFree((void *)gh); + + gh->flags = 0; // To be sure, to be sure +} + +const char *gwinGetClassName(GHandle gh) { + return gh->vmt->classname; +} + +void gwinSetVisible(GHandle gh, bool_t visible) { + if (visible) { + if (!(gh->flags & GWIN_FLG_VISIBLE)) { + gh->flags |= GWIN_FLG_VISIBLE; + #if GWIN_NEED_WINDOWMANAGER + cwm->vmt->Visible(gh); + #else + _gwm_vis(gh); + #endif + } + } else { + if ((gh->flags & GWIN_FLG_VISIBLE)) { + gh->flags &= ~GWIN_FLG_VISIBLE; + #if GWIN_NEED_WINDOWMANAGER + cwm->vmt->Visible(gh); + #endif + } + } +} + +bool_t gwinGetVisible(GHandle gh) { + return (gh->flags & GWIN_FLG_VISIBLE) ? TRUE : FALSE; +} + +void gwinMove(GHandle gh, coord_t x, coord_t y) { + #if GWIN_NEED_WINDOWMANAGER + cwm->vmt->Redim(gh, x, y, gh->width, gh->height); + #else + _gwm_redim(gh, x, y, gh->width, gh->height); + #endif +} + +void gwinResize(GHandle gh, coord_t width, coord_t height) { + #if GWIN_NEED_WINDOWMANAGER + cwm->vmt->Redim(gh, gh->x, gh->y, width, height); + #else + _gwm_redim(gh, gh->x, gh->y, width, height); + #endif +} + +void gwinSetMinMax(GHandle gh, GWindowMinMax minmax) { + #if GWIN_NEED_WINDOWMANAGER + cwm->vmt->MinMax(gh, minmax); + #else + (void) gh; + (void) minmax; + #endif +} + +void gwinRaise(GHandle gh) { + #if GWIN_NEED_WINDOWMANAGER + cwm->vmt->Raise(gh); + #else + if ((gh->flags & GWIN_FLG_VISIBLE)) { + if (gh->vmt->Redraw) { + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + gh->vmt->Redraw(gh); + } + } + #endif +} + +GWindowMinMax gwinGetMinMax(GHandle gh) { + if (gh->flags & GWIN_FLG_MINIMIZED) + return GWIN_MINIMIZE; + if (gh->flags & GWIN_FLG_MAXIMIZED) + return GWIN_MAXIMIZE; + return GWIN_NORMAL; +} + +#if GDISP_NEED_TEXT void gwinSetFont(GHandle gh, font_t font) { gh->font = font; } #endif void gwinClear(GHandle gh) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -104,6 +261,9 @@ void gwinClear(GHandle gh) { } void gwinDrawPixel(GHandle gh, coord_t x, coord_t y) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -111,6 +271,9 @@ void gwinDrawPixel(GHandle gh, coord_t x, coord_t y) { } void gwinDrawLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -118,6 +281,9 @@ void gwinDrawLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1) { } void gwinDrawBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -125,6 +291,9 @@ void gwinDrawBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy) { } void gwinFillArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -132,6 +301,9 @@ void gwinFillArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy) { } void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t srcx, coord_t srcy, coord_t srccx, const pixel_t *buffer) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -140,6 +312,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor #if GDISP_NEED_CIRCLE void gwinDrawCircle(GHandle gh, coord_t x, coord_t y, coord_t radius) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -147,6 +322,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } void gwinFillCircle(GHandle gh, coord_t x, coord_t y, coord_t radius) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -156,6 +334,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor #if GDISP_NEED_ELLIPSE void gwinDrawEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -163,6 +344,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } void gwinFillEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -172,6 +356,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor #if GDISP_NEED_ARC void gwinDrawArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -179,6 +366,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } void gwinFillArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -188,6 +378,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor #if GDISP_NEED_PIXELREAD color_t gwinGetPixelColor(GHandle gh, coord_t x, coord_t y) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -197,7 +390,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor #if GDISP_NEED_TEXT void gwinDrawChar(GHandle gh, coord_t x, coord_t y, char c) { - if (!gh->font) return; + if (!((gh->flags & GWIN_FLG_VISIBLE)) || !gh->font) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -205,7 +400,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } void gwinFillChar(GHandle gh, coord_t x, coord_t y, char c) { - if (!gh->font) return; + if (!((gh->flags & GWIN_FLG_VISIBLE)) || !gh->font) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -213,7 +410,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } void gwinDrawString(GHandle gh, coord_t x, coord_t y, const char *str) { - if (!gh->font) return; + if (!((gh->flags & GWIN_FLG_VISIBLE)) || !gh->font) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -221,7 +420,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } void gwinFillString(GHandle gh, coord_t x, coord_t y, const char *str) { - if (!gh->font) return; + if (!((gh->flags & GWIN_FLG_VISIBLE)) || !gh->font) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -229,7 +430,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } void gwinDrawStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify) { - if (!gh->font) return; + if (!((gh->flags & GWIN_FLG_VISIBLE)) || !gh->font) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -237,7 +440,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } void gwinFillStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify) { - if (!gh->font) return; + if (!((gh->flags & GWIN_FLG_VISIBLE)) || !gh->font) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -247,6 +452,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor #if GDISP_NEED_CONVEX_POLYGON void gwinDrawPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -254,6 +462,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -263,6 +474,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor #if GDISP_NEED_IMAGE gdispImageError gwinImageDraw(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return GDISP_IMAGE_ERR_OK; + #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif diff --git a/src/gwin/gwin.mk b/src/gwin/gwin.mk index 90a8e9b4..fb8fdfd1 100644 --- a/src/gwin/gwin.mk +++ b/src/gwin/gwin.mk @@ -1,5 +1,6 @@ GFXSRC += $(GFXLIB)/src/gwin/gwin.c \ $(GFXLIB)/src/gwin/gwidget.c \ + $(GFXLIB)/src/gwin/gwm.c \ $(GFXLIB)/src/gwin/console.c \ $(GFXLIB)/src/gwin/graph.c \ $(GFXLIB)/src/gwin/button.c \ diff --git a/src/gwin/gwm.c b/src/gwin/gwm.c new file mode 100644 index 00000000..bc561345 --- /dev/null +++ b/src/gwin/gwm.c @@ -0,0 +1,144 @@ +/* + * This file is subject to the terms of the GFX License, v1.0. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ + +#include "gfx.h" + +// Used by the NULL window manager +#define MIN_WIN_WIDTH 3 +#define MIN_WIN_HEIGHT 3 + +/*----------------------------------------------- + * The default window manager (GNullWindowManager) + *-----------------------------------------------*/ + +#if GFX_USE_GWIN && GWIN_NEED_WINDOWMANAGER + +#include "gwin/class_gwin.h" + +/*----------------------------------------------- + * Data + *-----------------------------------------------*/ + +static void WM_Init(void); +static void WM_DeInit(void); +static bool_t WM_Add(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h); +static void WM_Delete(GHandle gh); +static void WM_Visible(GHandle gh); +static void WM_Redim(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h); +static void WM_Raise(GHandle gh); +static void WM_MinMax(GHandle gh, GWindowMinMax minmax); + +static const gwmVMT GNullWindowManagerVMT = { + WM_Init, + WM_DeInit, + WM_Add, + WM_Delete, + WM_Visible, + WM_Redim, + WM_Raise, + WM_MinMax, +}; + +const GWindowManager GNullWindowManager = { + &GNullWindowManagerVMT, +}; + +/*----------------------------------------------- + * Window Manager Routines + *-----------------------------------------------*/ + +static void WM_Init(void) { + // We don't need to do anything here. + // A full window manager would move the windows around, add borders etc + + // clear the screen + // cycle through the windows already defined displaying them + // or cut all the window areas out of the screen and clear the remainder +} + +static void WM_DeInit(void) { + // We don't need to do anything here. + // A full window manager would remove any borders etc +} + +static bool_t WM_Add(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h) { + // Put it on the queue + gfxQueueASyncPut(&_GWINList, &gh->wmq); + + // Make sure the size is valid + WM_Redim(gh, x, y, w, h); + + // Display it if it is visible + WM_Visible(gh); + return TRUE; +} + +static void WM_Delete(GHandle gh) { + // A real window manager would make the window invisible + // (and then clear the area underneath) + + // Just remove it from the queue + gfxQueueASyncRemove(&_GWINList, &gh->wmq); +} + +static void WM_Visible(GHandle gh) { + if ((gh->flags & GWIN_FLG_VISIBLE)) { + if (gh->vmt->Redraw) { + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + gh->vmt->Redraw(gh); + } else + gwinClear(gh); + // A real window manager would also redraw the borders + } + + // else + // A real window manager would make the window invisible + // (and then clear the area underneath) + +} + +static void WM_Redim(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h) { + // This is the simplest way of doing it - just clip the the screen + // If it won't fit on the screen move it around until it does. + if (x < 0) { w += x; x = 0; } + if (y < 0) { h += y; y = 0; } + if (x > gdispGetWidth()-MIN_WIN_WIDTH) x = gdispGetWidth()-MIN_WIN_WIDTH; + if (y > gdispGetHeight()-MIN_WIN_HEIGHT) y = gdispGetHeight()-MIN_WIN_HEIGHT; + if (w < MIN_WIN_WIDTH) { w = MIN_WIN_WIDTH; } + if (h < MIN_WIN_HEIGHT) { h = MIN_WIN_HEIGHT; } + if (x+w > gdispGetWidth()) w = gdispGetWidth() - x; + if (y+h > gdispGetHeight()) h = gdispGetHeight() - y; + gh->x = x; gh->y = y; + gh->width = w; gh->height = h; +} + +static void WM_MinMax(GHandle gh, GWindowMinMax minmax) { + (void)gh; (void) minmax; + // We don't support minimising, maximising or restoring +} + +static void WM_Raise(GHandle gh) { + // Take it off the list and then put it back on top + // The order of the list then reflects the z-order. + gfxQueueASyncRemove(&_GWINList, &gh->wmq); + gfxQueueASyncPut(&_GWINList, &gh->wmq); + + // Redraw the window + if ((gh->flags & GWIN_FLG_VISIBLE)) { + if (gh->vmt->Redraw) { + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + gh->vmt->Redraw(gh); + } + } +} + +#endif /* GFX_USE_GWIN && GWIN_NEED_WINDOWMANAGER */ +/** @} */ diff --git a/src/gwin/slider.c b/src/gwin/slider.c index a0289d3d..1a1855a9 100644 --- a/src/gwin/slider.c +++ b/src/gwin/slider.c @@ -35,6 +35,7 @@ static const gwidgetVMT sliderVMT = { { "Slider", // The classname _gwidgetDestroy, // The destroy routine + _gwidgetRedraw, // The redraw routine 0, // The after-clear routine }, gwinSliderDraw_Std, // The default drawing routine @@ -101,7 +102,7 @@ static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { if (x < 0 || x >= gh->width || y < 0 || y >= gh->height) { // No - restore the slider ResetDisplayPos(gsw); - gwinDraw(gh); + _gwidgetRedraw(gh); return; } #endif @@ -124,7 +125,7 @@ static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { } ResetDisplayPos(gsw); - gwinDraw(gh); + _gwidgetRedraw(gh); // Generate the event SendSliderEvent(gw); @@ -154,7 +155,7 @@ static void MouseMove(GWidgetObject *gw, coord_t x, coord_t y) { } // Update the display - gwinDraw(&gw->g); + _gwidgetRedraw(&gw->g); #undef gsw } From 2cb35d6815a0a12035f4792c266b688c77085620 Mon Sep 17 00:00:00 2001 From: inmarket Date: Mon, 10 Jun 2013 17:18:01 +1000 Subject: [PATCH 05/38] Clean up GWIN Event assignment. Optimise event efficiency. --- demos/modules/gadc/gwinosc.c | 2 +- demos/modules/gaudin/gwinosc.c | 2 +- demos/modules/gwin/widgets/gfxconf.h | 4 +- demos/modules/gwin/widgets/main.c | 70 ++--- drivers/multiple/Win32/gdisp_lld.c | 4 +- .../multiple/Win32/ginput_lld_toggle_config.h | 30 +-- include/gfx_rules.h | 43 +-- include/ginput/dial.h | 1 + include/gqueue/gqueue.h | 44 ++- include/gwin/button.h | 6 +- include/gwin/checkbox.h | 15 +- include/gwin/class_gwin.h | 61 +++-- include/gwin/gwidget.h | 14 +- include/gwin/gwin.h | 1 + include/gwin/options.h | 4 +- include/gwin/slider.h | 24 +- src/ginput/dial.c | 2 + src/gqueue/gqueue.c | 8 + src/gwin/button.c | 58 ++-- src/gwin/checkbox.c | 50 +++- src/gwin/console.c | 2 +- src/gwin/graph.c | 2 +- src/gwin/gwidget.c | 252 +++++++++++++----- src/gwin/gwin.c | 9 +- src/gwin/slider.c | 95 +++++-- 25 files changed, 561 insertions(+), 242 deletions(-) diff --git a/demos/modules/gadc/gwinosc.c b/demos/modules/gadc/gwinosc.c index 88e61334..60a08686 100644 --- a/demos/modules/gadc/gwinosc.c +++ b/demos/modules/gadc/gwinosc.c @@ -47,7 +47,7 @@ GHandle gwinCreateScope(GScopeObject *gs, coord_t x, coord_t y, coord_t cx, coord_t cy, uint32_t physdev, uint32_t frequency) { /* Initialise the base class GWIN */ - if (!(gs = (GScopeObject *)_gwindowInit((GWindowObject *)gs, x, y, cx, cy, sizeof(GScopeObject)))) + if (!(gs = (GScopeObject *)_gwindowCreate((GWindowObject *)gs, x, y, cx, cy, sizeof(GScopeObject)))) return 0; /* Initialise the scope object members and allocate memory for buffers */ diff --git a/demos/modules/gaudin/gwinosc.c b/demos/modules/gaudin/gwinosc.c index e90430d3..975c2c06 100644 --- a/demos/modules/gaudin/gwinosc.c +++ b/demos/modules/gaudin/gwinosc.c @@ -54,7 +54,7 @@ GHandle gwinCreateScope(GScopeObject *gs, coord_t x, coord_t y, coord_t cx, coord_t cy, uint16_t channel, uint32_t frequency) { /* Initialise the base class GWIN */ - if (!(gs = (GScopeObject *)_gwindowInit((GWindowObject *)gs, x, y, cx, cy, sizeof(GScopeObject)))) + if (!(gs = (GScopeObject *)_gwindowCreate((GWindowObject *)gs, x, y, cx, cy, sizeof(GScopeObject)))) return 0; /* Initialise the scope object members and allocate memory for buffers */ diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index b4574149..411d829e 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -51,15 +51,17 @@ #define GDISP_NEED_IMAGE_PNG FALSE /* Features for the GWIN sub-system. */ +#define GWIN_NEED_WINDOWMANAGER TRUE #define GWIN_NEED_CONSOLE TRUE #define GWIN_NEED_GRAPH FALSE +#define GWIN_NEED_WIDGET TRUE #define GWIN_NEED_BUTTON TRUE #define GWIN_NEED_SLIDER TRUE #define GWIN_NEED_CHECKBOX TRUE /* Features for the GINPUT sub-system. */ #define GINPUT_NEED_MOUSE TRUE -#define GINPUT_NEED_TOGGLE FALSE +#define GINPUT_NEED_TOGGLE TRUE #define GINPUT_NEED_DIAL FALSE #endif /* _GFXCONF_H */ diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index 2102d3a2..1c34b9fa 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -49,11 +49,20 @@ int main(void) { gfxInit(); gdispClear(White); - // Set the font and defalt colors + // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); gwinSetDefaultColor(Black); gwinSetDefaultBgColor(White); + // We want to listen for widget events + geventListenerInit(&gl); + gwinAttachListener(&gl); + + // Connect the mouse + #if GINPUT_NEED_MOUSE + gwinAttachMouse(0); + #endif + // Create out gwin windows/widgets ghConsole = gwinCreateConsole(NULL, ScrWidth/2+1, ScrHeight/2+1, ScrWidth/2-1, ScrHeight/2-1); ghButton1 = gwinCreateButton(NULL, 0+0*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); @@ -84,49 +93,28 @@ int main(void) { gwinSetText(ghCheckbox1, "C1", FALSE); gwinSetText(ghCheckbox2, "C2", FALSE); - // Assign the mouse and dials to the buttons & sliders etc. -#if GINPUT_NEED_MOUSE - gwinAttachMouse(ghButton1, 0); - gwinAttachMouse(ghButton2, 0); - gwinAttachMouse(ghButton3, 0); - gwinAttachMouse(ghButton4, 0); - gwinAttachMouse(ghSlider1, 0); - gwinAttachMouse(ghSlider2, 0); - gwinAttachMouse(ghSlider3, 0); - gwinAttachMouse(ghSlider4, 0); - gwinAttachMouse(ghCheckbox1, 0); - gwinAttachMouse(ghCheckbox2, 0); -#endif -#if GINPUT_NEED_DIAL - gwinAttachSliderDial(ghSlider1, 0); - gwinAttachSliderDial(ghSlider3, 1); -#endif - - // We want to listen for widget events - geventListenerInit(&gl); - gwinAttachListener(ghButton1, &gl, 0); - gwinAttachListener(ghButton2, &gl, 0); - gwinAttachListener(ghButton3, &gl, 0); - gwinAttachListener(ghButton4, &gl, 0); - gwinAttachListener(ghSlider1, &gl, 0); - gwinAttachListener(ghSlider2, &gl, 0); - gwinAttachListener(ghSlider3, &gl, 0); - gwinAttachListener(ghSlider4, &gl, 0); - gwinAttachListener(ghCheckbox1, &gl, 0); - gwinAttachListener(ghCheckbox2, &gl, 0); + // Assign toggles and dials to the buttons & sliders etc. + #if GINPUT_NEED_TOGGLE + gwinAttachToggle(ghButton1, 0, 0); + gwinAttachToggle(ghButton2, 0, 1); + #endif + #if GINPUT_NEED_DIAL + gwinAttachDial(ghSlider1, 0, 0); + gwinAttachDial(ghSlider3, 0, 1); + #endif // Draw everything on the screen gwinClear(ghConsole); - gwinDraw(ghButton1); - gwinDraw(ghButton2); - gwinDraw(ghButton3); - gwinDraw(ghButton4); - gwinDraw(ghSlider1); - gwinDraw(ghSlider2); - gwinDraw(ghSlider3); - gwinDraw(ghSlider4); - gwinDraw(ghCheckbox1); - gwinDraw(ghCheckbox2); + gwinSetVisible(ghButton1, TRUE); + gwinSetVisible(ghButton2, TRUE); + gwinSetVisible(ghButton3, TRUE); + gwinSetVisible(ghButton4, TRUE); + gwinSetVisible(ghSlider1, TRUE); + gwinSetVisible(ghSlider2, TRUE); + gwinSetVisible(ghSlider3, TRUE); + gwinSetVisible(ghSlider4, TRUE); + gwinSetVisible(ghCheckbox1, TRUE); + gwinSetVisible(ghCheckbox2, TRUE); while(1) { // Get an Event diff --git a/drivers/multiple/Win32/gdisp_lld.c b/drivers/multiple/Win32/gdisp_lld.c index a41954a7..b53b3632 100644 --- a/drivers/multiple/Win32/gdisp_lld.c +++ b/drivers/multiple/Win32/gdisp_lld.c @@ -119,8 +119,8 @@ static LRESULT myWindowProc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) break; case WM_LBUTTONUP: #if GINPUT_NEED_TOGGLE - if ((toggles & 0xF0)) { - toggles &= 0x0F; + if ((toggles & 0x0F)) { + toggles &= ~0x0F; rect.left = 0; rect.right = wWidth; rect.top = wHeight; diff --git a/drivers/multiple/Win32/ginput_lld_toggle_config.h b/drivers/multiple/Win32/ginput_lld_toggle_config.h index e96380d3..d487ca42 100644 --- a/drivers/multiple/Win32/ginput_lld_toggle_config.h +++ b/drivers/multiple/Win32/ginput_lld_toggle_config.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License, v1.0. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/multiple/Win32/ginput_lld_toggle_config.h @@ -20,19 +20,19 @@ #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE -#define GINPUT_TOGGLE_POLL_PERIOD TIME_INFINITE // We are interrupt driven (or polled - ether works here) +#define GINPUT_TOGGLE_POLL_PERIOD TIME_INFINITE // We are interrupt driven (or polled - either works here) #define GINPUT_TOGGLE_NUM_PORTS 8 // The total number of toggle inputs #define GINPUT_TOGGLE_CONFIG_ENTRIES 1 // The total number of GToggleConfig entries -#define GINPUT_TOGGLE_SW1 0 // Switch 1 - Toggle -#define GINPUT_TOGGLE_SW2 1 // Switch 2 - Toggle -#define GINPUT_TOGGLE_SW3 2 // Switch 3 - Toggle -#define GINPUT_TOGGLE_SW4 3 // Switch 4 - Toggle +#define GINPUT_TOGGLE_MOMENTARY1 0 // Switch 5 - Momentary +#define GINPUT_TOGGLE_MOMENTARY2 1 // Switch 6 - Momentary +#define GINPUT_TOGGLE_MOMENTARY3 2 // Switch 7 - Momentary +#define GINPUT_TOGGLE_MOMENTARY4 3 // Switch 8 - Momentary -#define GINPUT_TOGGLE_MOMENTARY1 4 // Switch 5 - Momentary -#define GINPUT_TOGGLE_MOMENTARY2 5 // Switch 6 - Momentary -#define GINPUT_TOGGLE_MOMENTARY3 6 // Switch 7 - Momentary -#define GINPUT_TOGGLE_MOMENTARY4 7 // Switch 8 - Momentary +#define GINPUT_TOGGLE_SW1 4 // Switch 1 - Toggle +#define GINPUT_TOGGLE_SW2 5 // Switch 2 - Toggle +#define GINPUT_TOGGLE_SW3 6 // Switch 3 - Toggle +#define GINPUT_TOGGLE_SW4 7 // Switch 4 - Toggle #endif /* GFX_USE_GDISP && GINPUT_NEED_TOGGLE */ diff --git a/include/gfx_rules.h b/include/gfx_rules.h index 7e14ef9d..6c0dc756 100644 --- a/include/gfx_rules.h +++ b/include/gfx_rules.h @@ -46,24 +46,6 @@ #warning "GWIN: Drawing can occur outside the defined windows as GDISP_NEED_CLIP is FALSE" #endif #endif - #if GWIN_NEED_WINDOWMANAGER - #if !GFX_USE_GQUEUE || !GQUEUE_NEED_ASYNC - #if GFX_DISPLAY_RULE_WARNINGS - #warning "GWIN: GFX_USE_GQUEUE and GQUEUE_NEED_ASYNC is required if GWIN_NEED_WINDOWMANAGER is TRUE. It has been turned on for you." - #endif - #undef GFX_USE_GQUEUE - #undef GQUEUE_NEED_ASYNC - #define GFX_USE_GQUEUE TRUE - #define GQUEUE_NEED_ASYNC TRUE - #endif - #endif - #if GWIN_NEED_CONSOLE - #if !GDISP_NEED_TEXT - #error "GWIN: GDISP_NEED_TEXT is required if GWIN_NEED_CONSOLE is TRUE." - #endif - #endif - #if GWIN_NEED_GRAPH - #endif #if GWIN_NEED_BUTTON || GWIN_NEED_SLIDER || GWIN_NEED_CHECKBOX #if !GWIN_NEED_WIDGET #if GFX_DISPLAY_RULE_WARNINGS @@ -81,6 +63,13 @@ // This test also ensures that GFX_USE_GEVENT is set #error "GWIN: GFX_USE_GINPUT (and one or more input sources) is required if GWIN_NEED_WIDGET is TRUE" #endif + #if !GWIN_NEED_WINDOWMANAGER + #if GFX_DISPLAY_RULE_WARNINGS + #warning "GWIN: GWIN_NEED_WINDOWMANAGER is required if GWIN_NEED_WIDGET is TRUE. It has been turned on for you." + #endif + #undef GWIN_NEED_WINDOWMANAGER + #define GWIN_NEED_WINDOWMANAGER TRUE + #endif #if !GDISP_NEED_MULTITHREAD && !GDISP_NEED_ASYNC #if GFX_DISPLAY_RULE_WARNINGS #warning "GWIN: Either GDISP_NEED_MULTITHREAD or GDISP_NEED_ASYNC is required if GWIN_NEED_WIDGET is TRUE." @@ -90,6 +79,24 @@ #define GDISP_NEED_MULTITHREAD TRUE #endif #endif + #if GWIN_NEED_WINDOWMANAGER + #if !GFX_USE_GQUEUE || !GQUEUE_NEED_ASYNC + #if GFX_DISPLAY_RULE_WARNINGS + #warning "GWIN: GFX_USE_GQUEUE and GQUEUE_NEED_ASYNC is required if GWIN_NEED_WINDOWMANAGER is TRUE. It has been turned on for you." + #endif + #undef GFX_USE_GQUEUE + #undef GQUEUE_NEED_ASYNC + #define GFX_USE_GQUEUE TRUE + #define GQUEUE_NEED_ASYNC TRUE + #endif + #endif + #if GWIN_NEED_CONSOLE + #if !GDISP_NEED_TEXT + #error "GWIN: GDISP_NEED_TEXT is required if GWIN_NEED_CONSOLE is TRUE." + #endif + #endif + #if GWIN_NEED_GRAPH + #endif #endif #if GFX_USE_GINPUT diff --git a/include/ginput/dial.h b/include/ginput/dial.h index af54952a..8b4f9d3c 100644 --- a/include/ginput/dial.h +++ b/include/ginput/dial.h @@ -36,6 +36,7 @@ typedef struct GEventDial_t { GEventType type; // The type of this event (GEVENT_DIAL) uint16_t instance; // The dial instance uint16_t value; // The dial value + uint16_t maxvalue; // The maximum dial value } GEventDial; /*===========================================================================*/ diff --git a/include/gqueue/gqueue.h b/include/gqueue/gqueue.h index 38c1908d..399042d9 100644 --- a/include/gqueue/gqueue.h +++ b/include/gqueue/gqueue.h @@ -103,7 +103,7 @@ void gfxQueueFSyncInit(gfxQueueFSync *pqueue); /* @} */ /** - * @brief Get an item from the head of the queue. + * @brief Get an item from the head of the queue (and remove it from the queue). * @return NULL if the timeout expires before an item is available * * @param[in] pqueue A pointer to the queue @@ -139,7 +139,7 @@ bool_t gfxQueueFSyncPut(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem, delayti /* @} */ /** - * @brief Pop an item from the head of the queue. + * @brief Pop an item from the head of the queue (and remove it from the queue). * @detail This is exactly the same as the Get operation above. * * @api @@ -220,6 +220,46 @@ bool_t gfxQueueGSyncIsIn(gfxQueueGSync *pqueue, gfxQueueGSyncItem *pitem); bool_t gfxQueueFSyncIsIn(gfxQueueFSync *pqueue, gfxQueueFSyncItem *pitem); /* @} */ +/** + * @brief Get the first item from the head of the queue but do not remove it from the queue. + * @return NULL if no item is available. + * + * @param[in] pqueue A pointer to the queue + * + * @note This call does not block. + * @note This can be used as the first call to iterate all the elements in the queue. + * @note As that item is still on the queue, it should be treated as read-only. It could + * also be removed from the queue at any time by another thread (thereby altering the + * queue item). + * + * @api + * @{ + */ +#define gfxQueueASyncPeek(pqueue) ((const gfxQueueASyncItem *)((pqueue)->head)) +#define gfxQueueGSyncPeek(pqueue) ((const gfxQueueGSyncItem *)((pqueue)->head)) +#define gfxQueueFSyncPeek(pqueue) ((const gfxQueueFSyncItem *)((pqueue)->head)) +/* @} */ + +/** + * @brief Get the next item in the queue (but do not remove it from the queue). + * @return NULL if no item is available. + * + * @param[in] pitem The previous item in the queue + * + * @note This call does not block. + * @note This can be used as subsequent calls to iterate all the elements in the queue. + * @note As that item is still on the queue, it should be treated as read-only. It could + * also be removed from the queue at any time by another thread (thereby altering the + * queue item). + * + * @api + * @{ + */ +#define gfxQueueASyncNext(pitem) ((const gfxQueueASyncItem *)((pitem)->next)) +#define gfxQueueGSyncNext(pitem) ((const gfxQueueGSyncItem *)((pitem)->next)) +#define gfxQueueFSyncNext(pitem) ((const gfxQueueFSyncItem *)((pitem)->next)) +/* @} */ + #ifdef __cplusplus } #endif diff --git a/include/gwin/button.h b/include/gwin/button.h index 53096ea3..20fd6df7 100644 --- a/include/gwin/button.h +++ b/include/gwin/button.h @@ -55,6 +55,7 @@ typedef struct GButtonColors { */ typedef struct GButtonObject_t { GWidgetObject w; + uint16_t toggle; GButtonColors c_up; GButtonColors c_dn; GButtonColors c_dis; @@ -78,10 +79,13 @@ extern "C" { * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there * is no default font and text drawing operations will no nothing. * @note The dimensions and position may be changed to fit on the real screen. - * @note A button remembers its normal button state. If there is a window manager then it is automatically + * @note A button remembers its normal drawing state. If there is a window manager then it is automatically * redrawn if the window is moved or its visibility state is changed. * @note The button is initially marked as invisible so that more properties can be set before display. * Call @p gwinSetVisible() to display it when ready. + * @note A button supports mouse and a toggle input. + * @note When assigning a toggle, only one toggle is supported. If you try to assign more than one toggle it will + * forget the previous toggle. When assigning a toggle the role parameter must be 0. * * @api */ diff --git a/include/gwin/checkbox.h b/include/gwin/checkbox.h index de49fa01..6f151218 100644 --- a/include/gwin/checkbox.h +++ b/include/gwin/checkbox.h @@ -50,6 +50,7 @@ typedef struct GCheckboxColors { /* A Checkbox window */ typedef struct GCheckboxObject_t { GWidgetObject w; + uint16_t toggle; GCheckboxColors c; } GCheckboxObject; @@ -62,10 +63,18 @@ typedef struct GCheckboxObject_t { * @param[in] width The width of the window * @param[in] height The height of the window * - * @note The drawing color gets set to White and the background drawing color to Black. - * @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont() + * @note The drawing color and the background color get set to the current defaults. If you haven't called + * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. + * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there + * is no default font and text drawing operations will no nothing. * @note The dimensions and position may be changed to fit on the real screen. - * @note The checkbox is not automatically drawn. Call gwinDraw() to draw it. + * @note A checkbox remembers its normal drawing state. If there is a window manager then it is automatically + * redrawn if the window is moved or its visibility state is changed. + * @note The checkbox is initially marked as invisible so that more properties can be set before display. + * Call @p gwinSetVisible() to display it when ready. + * @note A checkbox supports mouse and a toggle input. + * @note When assigning a toggle, only one toggle is supported. If you try to assign more than one toggle it will + * forget the previous toggle. When assigning a toggle the role parameter must be 0. * * @api */ diff --git a/include/gwin/class_gwin.h b/include/gwin/class_gwin.h index 5e3cb01f..1c640c0c 100644 --- a/include/gwin/class_gwin.h +++ b/include/gwin/class_gwin.h @@ -52,37 +52,58 @@ typedef struct gwinVMT { /* @} */ #if GWIN_NEED_WIDGET || defined(__DOXYGEN__) + + /** + * @brief An toggle/dial instance is not being used + */ + #define GWIDGET_NO_INSTANCE ((uint16_t)-1) + + /** + * @brief The source handle that widgets use when sending events + */ + #define GWIDGET_SOURCE ((GSourceHandle)(void *)_gwidgetCreate) + /** * @brief The Virtual Method Table for a widget * @note A widget must have a destroy function. Either use @p _gwidgetDestroy() or use your own function * which internally calls @p _gwidgetDestroy(). * @note A widget must have a redraw function. Use @p _gwidgetRedraw(). - * @note If no MouseDown(), MouseUp() or MouseMove() function is provided, the widget will not accept being attached to a mouse input source. - * @note If no ToggleOn() or ToggleOff() function is provided, the widget will not accept being attached to a toggle input source. - * @note If no DialMove() function is provided, the widget will not accept being attached to a dial input source. - * @note AssignToggle() and AssignDial() enable a widget to handle more than one toggle/dial device attached to the widget. - * For example, a slider might accept two toggles, one for slider-down and one for slider-up. - * The function enables the widget to record that a particular device instance performs each particular role. - * (eg toggle0 = slider-down, toggle1 = slider-up). + * @note If toggleroles != 0, ToggleAssign(), ToggleGet() and one or both of ToggleOff() and ToggleOn() must be specified. + * @note If dialroles != 0, DialAssign(), DialGet() and DialMove() must be specified. * @{ */ typedef struct gwidgetVMT { - struct gwinVMT g; // @< This is still a GWIN - void (*DefaultDraw) (GWidgetObject *gw, void *param); // @< The default drawing routine (mandatory) - void (*MouseDown) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse down events (optional) - void (*MouseUp) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse up events (optional) - void (*MouseMove) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse move events (optional) - void (*ToggleOff) (GWidgetObject *gw, uint16_t instance); // @< Process toggle off events (optional) - void (*ToggleOn) (GWidgetObject *gw, uint16_t instance); // @< Process toggle on events (optional) - void (*DialMove) (GWidgetObject *gw, uint16_t instance, uint16_t value); // @< Process dial move events (optional) - void (*AllEvents) (GWidgetObject *gw, GEvent *pe); // @< Process all events (optional) - bool_t (*AssignToggle) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the toggle instance handle (optional) - bool_t (*AssignDial) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the dial instance handle (optional) + struct gwinVMT g; // @< This is still a GWIN + void (*DefaultDraw) (GWidgetObject *gw, void *param); // @< The default drawing routine (mandatory) + struct { + void (*MouseDown) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse down events (optional) + void (*MouseUp) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse up events (optional) + void (*MouseMove) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse move events (optional) + }; + struct { + uint16_t toggleroles; // @< The roles supported for toggles (0->toggleroles-1) + void (*ToggleAssign) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Assign a toggle to a role (optional) + uint16_t (*ToggleGet) (GWidgetObject *gw, uint16_t role); // @< Return the instance for a particular role (optional) + void (*ToggleOff) (GWidgetObject *gw, uint16_t role); // @< Process toggle off events (optional) + void (*ToggleOn) (GWidgetObject *gw, uint16_t role); // @< Process toggle on events (optional) + }; + struct { + uint16_t dialroles; // @< The roles supported for dials (0->dialroles-1) + void (*DialAssign) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the dial instance handle (optional) + uint16_t (*DialGet) (GWidgetObject *gw, uint16_t role); // @< Return the instance for a particular role (optional) + void (*DialMove) (GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max); // @< Process dial move events (optional) + }; } gwidgetVMT; /* @} */ #endif #if GWIN_NEED_WINDOWMANAGER || defined(__DOXYGEN__) + #if 1 // When we know that wmq is the first element of the GWindowObject structure + #define QItem2GWindow(qi) ((GHandle)qi) + #else + #define QItem2GWindow(qi) ((GHandle)(((char *)(qi)) - (size_t)(&(((GWindowObject *)0)->wmq)))) + #endif + // @note There is only ever one instance of each GWindowManager type typedef struct GWindowManager { const struct gwmVMT *vmt; @@ -126,7 +147,7 @@ extern "C" { * * @notapi */ -GHandle _gwindowInit(GWindowObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwinVMT *vmt, uint16_t flags); +GHandle _gwindowCreate(GWindowObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwinVMT *vmt, uint16_t flags); #if GWIN_NEED_WIDGET || defined(__DOXYGEN__) /** @@ -140,7 +161,7 @@ GHandle _gwindowInit(GWindowObject *pgw, coord_t x, coord_t y, coord_t w, coord_ * * @notapi */ - GHandle _gwidgetInit(GWidgetObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwidgetVMT *vmt); + GHandle _gwidgetCreate(GWidgetObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwidgetVMT *vmt); /** * @brief Destroy the Widget object diff --git a/include/gwin/gwidget.h b/include/gwin/gwidget.h index 21cfd4ac..a022ab13 100644 --- a/include/gwin/gwidget.h +++ b/include/gwin/gwidget.h @@ -46,7 +46,6 @@ typedef void (*CustomWidgetDrawFunction)(struct GWidgetObject *gw, void *param); */ typedef struct GWidgetObject { GWindowObject g; // @< This is still a GWIN - GListener listener; // @< The widget listener const char * txt; // @< The widget text CustomWidgetDrawFunction fnDraw; // @< The current draw function void * fnParam; // @< A parameter for the current draw function @@ -120,28 +119,27 @@ const char *gwinGetText(GHandle gh); void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param); /** - * @brief Attach a Listener to this widget + * @brief Attach a Listener to listen for widget events * @return TRUE on success * - * @param[in] gh The widget handle * @param[in] pl The listener - * @param[in] flags Flags to use for listening. For most widgets this should be 0. * * @api */ -bool_t gwinAttachListener(GHandle gh, GListener *pl, unsigned flags); +bool_t gwinAttachListener(GListener *pl); #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE /** - * @brief Attach a mouse to a widget + * @brief Set the mouse to be used to control the widgets * @return TRUE on success * - * @param[in] gh The widget handle * @param[in] instance The mouse instance * + * @note Every widget uses the same mouse. + * * @api */ - bool_t gwinAttachMouse(GHandle gh, uint16_t instance); + bool_t gwinAttachMouse(uint16_t instance); #endif #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index d915a4f0..96d7be97 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -35,6 +35,7 @@ */ typedef struct GWindowObject { #if GWIN_NEED_WINDOWMANAGER + // This MUST be the first member of the struct gfxQueueASyncItem wmq; // @< The next window (for the window manager) #endif const struct gwinVMT *vmt; // @< The VMT for this GWIN diff --git a/include/gwin/options.h b/include/gwin/options.h index 3619e075..db4ae69b 100644 --- a/include/gwin/options.h +++ b/include/gwin/options.h @@ -21,11 +21,11 @@ * @{ */ /** - * @brief Should a window manager be used. + * @brief Should window manager support be included * @details Defaults to FALSE */ #ifndef GWIN_NEED_WINDOWMANAGER - #define GWIN_NEED_WINDOWMANAGER FALSE + #define GWIN_NEED_WIDGET FALSE #endif /** * @brief Should widget functions be included. Needed for any widget (eg Buttons, Sliders etc) diff --git a/include/gwin/slider.h b/include/gwin/slider.h index 41894305..45618114 100644 --- a/include/gwin/slider.h +++ b/include/gwin/slider.h @@ -45,11 +45,14 @@ typedef struct GSliderColors { // A slider window typedef struct GSliderObject_t { GWidgetObject w; - GSliderColors c; + uint16_t t_dn; + uint16_t t_up; + uint16_t dial; coord_t dpos; int min; int max; int pos; + GSliderColors c; } GSliderObject; #ifdef __cplusplus @@ -65,11 +68,22 @@ extern "C" { * @param[in] width The width of the window * @param[in] height The height of the window * - * @note The drawing color gets set to White and the background drawing color to Black. - * @note Don't forget to set the font using @p gwinSetFont() or @p gwinSetDefaultFont() + * @note The drawing color and the background color get set to the current defaults. If you haven't called + * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. + * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there + * is no default font and text drawing operations will no nothing. * @note The dimensions and position may be changed to fit on the real screen. - * @note The slider is not automatically drawn. Call gwinDraw() to draw it. - * @note Sets the slider range from 0 to 100 with an initial position of 0 + * @note A slider remembers its normal drawing state. If there is a window manager then it is automatically + * redrawn if the window is moved or its visibility state is changed. + * @note The slider is initially marked as invisible so that more properties can be set before display. + * Call @p gwinSetVisible() to display it when ready. + * @note The initial slider range is from 0 to 100 with an initial position of 0. + * @note A slider supports mouse, toggle and dial input. + * @note When assigning a toggle, only one toggle is supported per role. If you try to assign more than + * one toggle to a role it will forget the previous toggle. Two roles are supported: + * Role 0 = toggle for down, Role 1 = toggle for up. + * @note When assigning a dial, only one dial is supported. If you try to assign more than one dial + * it will forget the previous dial. Only dial role 0 is supported. * * @api */ diff --git a/src/ginput/dial.c b/src/ginput/dial.c index 24836910..2e52c224 100644 --- a/src/ginput/dial.c +++ b/src/ginput/dial.c @@ -57,6 +57,7 @@ static void DialCallback(uint16_t instance, uint16_t rawvalue) { pe->type = GEVENT_DIAL; pe->instance = instance; pe->value = pds->lastvalue; + pe->maxvalue = pds->max; geventSendEvent(psl); } } @@ -144,6 +145,7 @@ bool_t ginputGetDialStatus(uint16_t instance, GEventDial *pdial) { pdial->type = GEVENT_DIAL; pdial->instance = instance; pdial->value = DialStatus[instance].lastvalue; + pdial->maxvalue = DialStatus[instance].max; return TRUE; } diff --git a/src/gqueue/gqueue.c b/src/gqueue/gqueue.c index 11d10c0a..002378b3 100644 --- a/src/gqueue/gqueue.c +++ b/src/gqueue/gqueue.c @@ -37,6 +37,7 @@ gfxSystemLock(); if ((pi = pqueue->head)) pqueue->head = pi->next; + pi->next = 0; gfxSystemUnlock(); return pi; } @@ -68,12 +69,14 @@ if (pqueue->head) { if (pqueue->head == pitem) { pqueue->head = pitem->next; + pitem->next = 0; } else { for(pi = pqueue->head; pi->next; pi = pi->next) { if (pi->next == pitem) { pi->next = pitem->next; if (pqueue->tail == pitem) pqueue->tail = pi; + pitem->next = 0; break; } } @@ -111,6 +114,7 @@ gfxSystemLock(); pi = pqueue->head; pqueue->head = pi->next; + pi->next = 0; gfxSytemUnlock(); return pi; } @@ -146,12 +150,14 @@ if (pqueue->head) { if (pqueue->head == pitem) { pqueue->head = pitem->next; + pitem->next = 0; } else { for(pi = pqueue->head; pi->next; pi = pi->next) { if (pi->next == pitem) { pi->next = pitem->next; if (pqueue->tail == pitem) pqueue->tail = pi; + pitem->next = 0; break; } } @@ -189,6 +195,7 @@ gfxSystemLock(); pi = pqueue->head; pqueue->head = pi->next; + pi->next = 0; gfxSytemUnlock(); gfxSemSignalI(&pi->sem); @@ -233,6 +240,7 @@ if (pqueue->head == pitem) { pqueue->head = pitem->next; found: + pitem->next = 0; gfxSystemUnlock(); gfxSemSignal(&pitem->sem); gfxSemDestroy(&pitem->sem); diff --git a/src/gwin/button.c b/src/gwin/button.c index 83b81b03..285a406c 100644 --- a/src/gwin/button.c +++ b/src/gwin/button.c @@ -32,8 +32,10 @@ // Prototypes for button VMT functions static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y); static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y); -static void ToggleOff(GWidgetObject *gw, uint16_t instance); -static void ToggleOn(GWidgetObject *gw, uint16_t instance); +static void ToggleOff(GWidgetObject *gw, uint16_t role); +static void ToggleOn(GWidgetObject *gw, uint16_t role); +static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance); +static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role); // The button VMT table static const gwidgetVMT buttonVMT = { @@ -43,16 +45,25 @@ static const gwidgetVMT buttonVMT = { _gwidgetRedraw, // The redraw routine 0, // The after-clear routine }, - gwinButtonDraw_3D, // The default drawing routine - MouseDown, // Process mouse down events - MouseUp, // Process mouse up events - 0, // Process mouse move events (NOT USED) - ToggleOff, // Process toggle off events - ToggleOn, // Process toggle on events - 0, // Process dial move events (NOT USED) - 0, // Process all events (NOT USED) - 0, // AssignToggle (NOT USED) - 0, // AssignDial (NOT USED) + gwinButtonDraw_3D, // The default drawing routine + { + MouseDown, // Process mouse down events + MouseUp, // Process mouse up events + 0, // Process mouse move events (NOT USED) + }, + { + 1, // 1 toggle role + ToggleAssign, // Assign Toggles + ToggleGet, // Get Toggles + ToggleOff, // Process toggle off events + ToggleOn, // Process toggle on events + }, + { + 0, // No dial roles + 0, // Assign Dials (NOT USED) + 0, // Get Dials (NOT USED) + 0, // Process dial move events (NOT USED) + } }; // Default color scheme @@ -80,7 +91,7 @@ static void SendButtonEvent(GWidgetObject *gw) { // Trigger a GWIN Button Event psl = 0; - while ((psl = geventGetSourceListener((GSourceHandle)gw, psl))) { + while ((psl = geventGetSourceListener(GWIDGET_SOURCE, psl))) { if (!(pe = geventGetEventBuffer(psl))) continue; pbe->type = GEVENT_GWIN_BUTTON; @@ -114,25 +125,36 @@ static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { } // A toggle off has occurred -static void ToggleOff(GWidgetObject *gw, uint16_t instance) { - (void) instance; +static void ToggleOff(GWidgetObject *gw, uint16_t role) { + (void) role; gw->g.flags &= ~GBUTTON_FLG_PRESSED; _gwidgetRedraw((GHandle)gw); } // A toggle on has occurred -static void ToggleOn(GWidgetObject *gw, uint16_t instance) { - (void) instance; +static void ToggleOn(GWidgetObject *gw, uint16_t role) { + (void) role; gw->g.flags |= GBUTTON_FLG_PRESSED; _gwidgetRedraw((GHandle)gw); // Trigger the event on button down (different than for mouse/touch) SendButtonEvent(gw); } +static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + (void) role; + ((GButtonObject *)gw)->toggle = instance; +} + +static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { + (void) role; + return ((GButtonObject *)gw)->toggle; +} + GHandle gwinCreateButton(GButtonObject *gw, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gw = (GButtonObject *)_gwidgetInit((GWidgetObject *)gw, x, y, width, height, sizeof(GButtonObject), &buttonVMT))) + if (!(gw = (GButtonObject *)_gwidgetCreate((GWidgetObject *)gw, x, y, width, height, sizeof(GButtonObject), &buttonVMT))) return 0; + gw->toggle = GWIDGET_NO_INSTANCE; gw->c_up = GButtonDefaultColorsUp; gw->c_dn = GButtonDefaultColorsDown; gw->c_dis = GButtonDefaultColorsDisabled; diff --git a/src/gwin/checkbox.c b/src/gwin/checkbox.c index 893dab9c..53e99e42 100644 --- a/src/gwin/checkbox.c +++ b/src/gwin/checkbox.c @@ -26,7 +26,9 @@ // Prototypes for button VMT functions static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y); -static void ToggleOn(GWidgetObject *gw, uint16_t instance); +static void ToggleOn(GWidgetObject *gw, uint16_t role); +static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance); +static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role); // The button VMT table static const gwidgetVMT checkboxVMT = { @@ -37,15 +39,24 @@ static const gwidgetVMT checkboxVMT = { 0, // The after-clear routine }, gwinCheckboxDraw_CheckOnLeft, // The default drawing routine - MouseDown, // Process mouse down events - 0, // Process mouse up events (NOT USED) - 0, // Process mouse move events (NOT USED) - 0, // Process toggle off events (NOT USED) - ToggleOn, // Process toggle on events - 0, // Process dial move events (NOT USED) - 0, // Process all events (NOT USED) - 0, // AssignToggle (NOT USED) - 0, // AssignDial (NOT USED) + { + MouseDown, // Process mouse down events + 0, // Process mouse up events (NOT USED) + 0, // Process mouse move events (NOT USED) + }, + { + 1, // 1 toggle role + ToggleAssign, // Assign Toggles + ToggleGet, // Get Toggles + 0, // Process toggle off events (NOT USED) + ToggleOn, // Process toggle on events + }, + { + 0, // No dial roles + 0, // Assign Dials (NOT USED) + 0, // Get Dials (NOT USED) + 0, // Process dial move events (NOT USED) + } }; static const GCheckboxColors defaultColors = { @@ -63,7 +74,7 @@ static void SendCheckboxEvent(GWidgetObject *gw) { // Trigger a GWIN Checkbox Event psl = 0; - while ((psl = geventGetSourceListener((GSourceHandle)gw, psl))) { + while ((psl = geventGetSourceListener(GWIDGET_SOURCE, psl))) { if (!(pe = geventGetEventBuffer(psl))) continue; pce->type = GEVENT_GWIN_CHECKBOX; @@ -84,17 +95,28 @@ static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { } // A toggle on has occurred -static void ToggleOn(GWidgetObject *gw, uint16_t instance) { - (void) instance; +static void ToggleOn(GWidgetObject *gw, uint16_t role) { + (void) role; gw->g.flags ^= GCHECKBOX_FLG_CHECKED; _gwidgetRedraw((GHandle)gw); SendCheckboxEvent(gw); } +static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + (void) role; + ((GCheckboxObject *)gw)->toggle = instance; +} + +static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { + (void) role; + return ((GCheckboxObject *)gw)->toggle; +} + GHandle gwinCreateCheckbox(GCheckboxObject *gb, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gb = (GCheckboxObject *)_gwidgetInit((GWidgetObject *)gb, x, y, width, height, sizeof(GCheckboxObject), &checkboxVMT))) + if (!(gb = (GCheckboxObject *)_gwidgetCreate((GWidgetObject *)gb, x, y, width, height, sizeof(GCheckboxObject), &checkboxVMT))) return 0; + gb->toggle = (uint16_t) -1; gb->c = defaultColors; // assign the default colors return (GHandle)gb; } diff --git a/src/gwin/console.c b/src/gwin/console.c index c4b2798d..6941295a 100644 --- a/src/gwin/console.c +++ b/src/gwin/console.c @@ -66,7 +66,7 @@ static const gwinVMT consoleVMT = { }; GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gc = (GConsoleObject *)_gwindowInit((GWindowObject *)gc, x, y, width, height, sizeof(GConsoleObject), &consoleVMT, GWIN_FLG_VISIBLE))) + if (!(gc = (GConsoleObject *)_gwindowCreate((GWindowObject *)gc, x, y, width, height, sizeof(GConsoleObject), &consoleVMT, GWIN_FLG_VISIBLE))) return 0; #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM gc->stream.vmt = &GWindowConsoleVMT; diff --git a/src/gwin/graph.c b/src/gwin/graph.c index 393297e7..264c0c2c 100644 --- a/src/gwin/graph.c +++ b/src/gwin/graph.c @@ -165,7 +165,7 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t } GHandle gwinCreateGraph(GGraphObject *gg, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gg = (GGraphObject *)_gwindowInit((GWindowObject *)gg, x, y, width, height, sizeof(GGraphObject), &graphVMT, GWIN_FLG_VISIBLE))) + if (!(gg = (GGraphObject *)_gwindowCreate((GWindowObject *)gg, x, y, width, height, sizeof(GGraphObject), &graphVMT, GWIN_FLG_VISIBLE))) return 0; gg->xorigin = gg->yorigin = 0; gg->lastx = gg->lasty = 0; diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c index 773a715d..ee7986d1 100644 --- a/src/gwin/gwidget.c +++ b/src/gwin/gwidget.c @@ -13,23 +13,25 @@ #include "gwin/class_gwin.h" +/* Our listener for events for widgets */ +static GListener gl; + /* We use these everywhere in this file */ #define gw ((GWidgetObject *)gh) #define wvmt ((gwidgetVMT *)gh->vmt) -static void gwidgetCallback(void *param, GEvent *pe) { - #define gh ((GWindowObject *)param) +/* Process an event */ +static void gwidgetEvent(void *param, GEvent *pe) { + #define gh QItem2GWindow(qi) #define pme ((GEventMouse *)pe) #define pte ((GEventToggle *)pe) #define pde ((GEventDial *)pe) - // check if widget is disabled - if ((gw->g.flags & (GWIN_FLG_ENABLED|GWIN_FLG_VISIBLE)) != (GWIN_FLG_ENABLED|GWIN_FLG_VISIBLE)) - return; - - // Process via AllEvents() if it is defined - if (wvmt->AllEvents) - wvmt->AllEvents(gw, pe); + const gfxQueueASyncItem * qi; + #if GFX_USE_GINPUT && (GINPUT_NEED_TOGGLE || GINPUT_NEED_DIAL) + uint16_t role; + #endif + (void) param; // Process various events switch (pe->type) { @@ -37,76 +39,179 @@ static void gwidgetCallback(void *param, GEvent *pe) { #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE case GEVENT_MOUSE: case GEVENT_TOUCH: - // Are we captured? - if ((gw->g.flags & GWIN_FLG_MOUSECAPTURE)) { - if ((pme->last_buttons & ~pme->current_buttons & GINPUT_MOUSE_BTN_LEFT)) { - gw->g.flags &= ~GWIN_FLG_MOUSECAPTURE; - if (wvmt->MouseUp) - wvmt->MouseUp(gw, pme->x - gw->g.x, pme->y - gw->g.y); - return; - } else if (wvmt->MouseMove) - wvmt->MouseMove(gw, pme->x - gw->g.x, pme->y - gw->g.y); + // Cycle through all windows + for(qi = gfxQueueASyncPeek(&_GWINList); qi; qi = gfxQueueASyncNext(qi)) { - // We are not captured - look for mouse downs over the widget - } else if ((~pme->last_buttons & pme->current_buttons & GINPUT_MOUSE_BTN_LEFT) - && pme->x >= gw->g.x && pme->x < gw->g.x + gw->g.width - && pme->y >= gw->g.y && pme->y < gw->g.y + gw->g.height) { - gw->g.flags |= GWIN_FLG_MOUSECAPTURE; - if (wvmt->MouseDown) - wvmt->MouseDown(gw, pme->x - gw->g.x, pme->y - gw->g.y); + // check if it a widget that is enabled and visible + if ((gh->flags & (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED|GWIN_FLG_VISIBLE)) != (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED|GWIN_FLG_VISIBLE)) + continue; + + // Are we captured? + if ((gw->g.flags & GWIN_FLG_MOUSECAPTURE)) { + if ((pme->last_buttons & ~pme->current_buttons & GINPUT_MOUSE_BTN_LEFT)) { + gw->g.flags &= ~GWIN_FLG_MOUSECAPTURE; + if (wvmt->MouseUp) + wvmt->MouseUp(gw, pme->x - gw->g.x, pme->y - gw->g.y); + } else if (wvmt->MouseMove) + wvmt->MouseMove(gw, pme->x - gw->g.x, pme->y - gw->g.y); + + // We are not captured - look for mouse downs over the widget + } else if ((~pme->last_buttons & pme->current_buttons & GINPUT_MOUSE_BTN_LEFT) + && pme->x >= gw->g.x && pme->x < gw->g.x + gw->g.width + && pme->y >= gw->g.y && pme->y < gw->g.y + gw->g.height) { + gw->g.flags |= GWIN_FLG_MOUSECAPTURE; + if (wvmt->MouseDown) + wvmt->MouseDown(gw, pme->x - gw->g.x, pme->y - gw->g.y); + } } break; #endif #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE case GEVENT_TOGGLE: - if (pte->on) { - if (wvmt->ToggleOn) - wvmt->ToggleOn(gw, pte->instance); - } else { - if (wvmt->ToggleOff) - wvmt->ToggleOff(gw, pte->instance); + // Cycle through all windows + for(qi = gfxQueueASyncPeek(&_GWINList); qi; qi = gfxQueueASyncNext(qi)) { + + // check if it a widget that is enabled and visible + if ((gh->flags & (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED|GWIN_FLG_VISIBLE)) != (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED|GWIN_FLG_VISIBLE)) + continue; + + for(role = 0; role < wvmt->toggleroles; role++) { + if (wvmt->ToggleGet(gw, role) == pte->instance) { + if (pte->on) { + if (wvmt->ToggleOn) + wvmt->ToggleOn(gw, role); + } else { + if (wvmt->ToggleOff) + wvmt->ToggleOff(gw, role); + } + } + } } break; #endif #if GFX_USE_GINPUT && GINPUT_NEED_DIAL case GEVENT_DIAL: - if (wvmt->DialMove) - wvmt->DialMove(gw, pde->instance, pde->value); + // Cycle through all windows + for(qi = gfxQueueASyncPeek(&_GWINList); qi; qi = gfxQueueASyncNext(qi)) { + + // check if it a widget that is enabled and visible + if ((gh->flags & (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED|GWIN_FLG_VISIBLE)) != (GWIN_FLG_WIDGET|GWIN_FLG_ENABLED|GWIN_FLG_VISIBLE)) + continue; + + for(role = 0; role < wvmt->dialroles; role++) { + if (wvmt->DialGet(gw, role) == pte->instance) { + if (wvmt->DialMove) + wvmt->DialMove(gw, role, pde->value, pde->maxvalue); + } + } + } break; #endif default: break; } + #undef gh #undef pme #undef pte #undef pde } -GHandle _gwidgetInit(GWidgetObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size, const gwidgetVMT *vmt) { - if (!(pgw = (GWidgetObject *)_gwindowInit((GWindowObject *)pgw, x, y, width, height, size, (const gwinVMT *)vmt, GWIN_FLG_WIDGET|GWIN_FLG_ENABLED))) +#if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE + static GHandle FindToggleUser(uint16_t instance) { + #define gh QItem2GWindow(qi) + const gfxQueueASyncItem * qi; + uint16_t role; + + for(qi = gfxQueueASyncPeek(&_GWINList); qi; qi = gfxQueueASyncNext(qi)) { + if (!(gh->flags & GWIN_FLG_WIDGET)) // check if it a widget + continue; + + for(role = 0; role < wvmt->toggleroles; role++) { + if (wvmt->ToggleGet(gw, role) == instance) + return gh; + } + } + return 0; + #undef gh + } +#endif + +#if GFX_USE_GINPUT && GINPUT_NEED_DIAL + static GHandle FindDialUser(uint16_t instance) { + #define gh QItem2GWindow(qi) + const gfxQueueASyncItem * qi; + uint16_t role; + + for(qi = gfxQueueASyncPeek(&_GWINList); qi; qi = gfxQueueASyncNext(qi)) { + if (!(gh->flags & GWIN_FLG_WIDGET)) // check if it a widget + continue; + + for(role = 0; role < wvmt->dialroles; role++) { + if (wvmt->DialGet(gw, role) == instance) + return gh; + } + } + return 0; + #undef gh + } +#endif + +void _gwidgetInit(void) { + geventListenerInit(&gl); + geventRegisterCallback(&gl, gwidgetEvent, 0); +} + +GHandle _gwidgetCreate(GWidgetObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size, const gwidgetVMT *vmt) { + if (!(pgw = (GWidgetObject *)_gwindowCreate((GWindowObject *)pgw, x, y, width, height, size, (const gwinVMT *)vmt, GWIN_FLG_WIDGET|GWIN_FLG_ENABLED))) return 0; pgw->txt = ""; pgw->fnDraw = vmt->DefaultDraw; pgw->fnParam = 0; - geventListenerInit(&pgw->listener); - geventRegisterCallback(&pgw->listener, gwidgetCallback, pgw); return (GHandle)pgw; } void _gwidgetDestroy(GHandle gh) { + #if GFX_USE_GINPUT && (GINPUT_NEED_TOGGLE || GINPUT_NEED_DIAL) + uint16_t role, instance; + #endif + // Deallocate the text (if necessary) if ((gh->flags & GWIN_FLG_ALLOCTXT)) { gh->flags &= ~GWIN_FLG_ALLOCTXT; gfxFree((void *)gw->txt); } - // Untangle the listeners (both on us and to us). - geventDetachSource(&gw->listener, 0); + + #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE + // Detach any toggles from this object + for(role = 0; role < wvmt->toggleroles; role++) { + instance = wvmt->ToggleGet(gw, role); + if (instance != GWIDGET_NO_INSTANCE) { + wvmt->ToggleAssign(gw, role, GWIDGET_NO_INSTANCE); + if (!FindToggleUser(instance)) + geventDetachSource(&gl, ginputGetToggle(instance)); + } + } + #endif + + #if GFX_USE_GINPUT && GINPUT_NEED_DIAL + // Detach any dials from this object + for(role = 0; role < wvmt->dialroles; role++) { + instance = wvmt->DialGet(gw, role); + if (instance != GWIDGET_NO_INSTANCE) { + wvmt->DialAssign(gw, role, GWIDGET_NO_INSTANCE); + if (!FindDialUser(instance)) + geventDetachSource(&gl, ginputGetDial(instance)); + } + } + #endif + + // Remove any listeners on this object. geventDetachSourceListeners((GSourceHandle)gh); } @@ -183,76 +288,89 @@ void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param) { _gwidgetRedraw(gh); } -bool_t gwinAttachListener(GHandle gh, GListener *pl, unsigned flags) { - if (!(gh->flags & GWIN_FLG_WIDGET)) - return FALSE; - - return geventAttachSource(pl, (GSourceHandle)gh, flags); +bool_t gwinAttachListener(GListener *pl) { + return geventAttachSource(pl, GWIDGET_SOURCE, 0); } #if GFX_USE_GINPUT && GINPUT_NEED_MOUSE - bool_t gwinAttachMouse(GHandle gh, uint16_t instance) { + bool_t gwinAttachMouse(uint16_t instance) { GSourceHandle gsh; - unsigned flags; - - if (!(gh->flags & GWIN_FLG_WIDGET)) - return FALSE; - - if (!wvmt->MouseDown && !wvmt->MouseMove && !wvmt->MouseUp) - return FALSE; if (!(gsh = ginputGetMouse(instance))) return FALSE; - flags = wvmt->MouseMove ? (GLISTEN_MOUSEMETA|GLISTEN_MOUSEDOWNMOVES) : GLISTEN_MOUSEMETA; - return geventAttachSource(&gw->listener, gsh, flags); + return geventAttachSource(&gl, gsh, GLISTEN_MOUSEMETA|GLISTEN_MOUSEDOWNMOVES); } #endif #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE bool_t gwinAttachToggle(GHandle gh, uint16_t role, uint16_t instance) { GSourceHandle gsh; - unsigned flags; + uint16_t oi; + // Is this a widget if (!(gh->flags & GWIN_FLG_WIDGET)) return FALSE; - flags = 0; - if (wvmt->ToggleOff) flags |= GLISTEN_TOGGLE_OFF; - if (wvmt->ToggleOn) flags |= GLISTEN_TOGGLE_ON; - if (!flags) + // Is the role valid + if (role >= wvmt->toggleroles) return FALSE; + // Is this a valid device if (!(gsh = ginputGetToggle(instance))) return FALSE; - if (wvmt->AssignToggle && !wvmt->AssignToggle(gw, role, instance)) - return FALSE; + // Is this already done? + oi = wvmt->ToggleGet(gw, role); + if (instance == oi) + return TRUE; - return geventAttachSource(&gw->listener, gsh, flags); + // Remove the old instance + if (oi != GWIDGET_NO_INSTANCE) { + wvmt->ToggleAssign(gw, role, GWIDGET_NO_INSTANCE); + if (!FindToggleUser(oi)) + geventDetachSource(&gl, ginputGetToggle(oi)); + } + + // Assign the new + wvmt->ToggleAssign(gw, role, instance); + return geventAttachSource(&gl, gsh, GLISTEN_TOGGLE_ON|GLISTEN_TOGGLE_OFF); } #endif #if GFX_USE_GINPUT && GINPUT_NEED_DIAL bool_t gwinAttachDial(GHandle gh, uint16_t role, uint16_t instance) { GSourceHandle gsh; + uint16_t oi; if (!(gh->flags & GWIN_FLG_WIDGET)) return FALSE; - if (!wvmt->DialMove) + // Is the role valid + if (role >= wvmt->dialroles) return FALSE; + // Is this a valid device if (!(gsh = ginputGetDial(instance))) return FALSE; - if (wvmt->AssignDial && !wvmt->AssignDial(gw, role, instance)) - return FALSE; + // Is this already done? + oi = wvmt->DialGet(gw, role); + if (instance == oi) + return TRUE; - return geventAttachSource(&gw->listener, gsh, 0); + // Remove the old instance + if (oi != GWIDGET_NO_INSTANCE) { + wvmt->DialAssign(gw, role, GWIDGET_NO_INSTANCE); + if (!FindDialUser(oi)) + geventDetachSource(&gl, ginputGetDial(oi)); + } + + // Assign the new + wvmt->DialAssign(gw, role, instance); + return geventAttachSource(&gl, gsh, 0); } #endif #endif /* GFX_USE_GWIN && GWIN_NEED_WIDGET */ /** @} */ - diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 3e790d38..98e61c52 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -70,6 +70,11 @@ static color_t defaultBgColor = Black; *-----------------------------------------------*/ void _gwinInit(void) { + #if GWIN_NEED_WIDGET + extern void _gwidgetInit(void); + + _gwidgetInit(); + #endif #if GWIN_NEED_WINDOWMANAGER gfxQueueASyncInit(&_GWINList); cwm = &GNullWindowManager; @@ -79,7 +84,7 @@ void _gwinInit(void) { // Internal routine for use by GWIN components only // Initialise a window creating it dynamically if required. -GHandle _gwindowInit(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size, const gwinVMT *vmt, uint16_t flags) { +GHandle _gwindowCreate(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size, const gwinVMT *vmt, uint16_t flags) { // Allocate the structure if necessary if (!pgw) { if (!(pgw = (GWindowObject *)gfxAlloc(size))) @@ -146,7 +151,7 @@ void gwinSetDefaultBgColor(color_t bgclr) { *-----------------------------------------------*/ GHandle gwinCreateWindow(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height) { - return _gwindowInit(pgw, x, y, width, height, sizeof(GWindowObject), &basegwinVMT, GWIN_FLG_VISIBLE); + return _gwindowCreate(pgw, x, y, width, height, sizeof(GWindowObject), &basegwinVMT, GWIN_FLG_VISIBLE); } void gwinDestroy(GHandle gh) { diff --git a/src/gwin/slider.c b/src/gwin/slider.c index 1a1855a9..343973a2 100644 --- a/src/gwin/slider.c +++ b/src/gwin/slider.c @@ -25,10 +25,19 @@ #define GWIN_SLIDER_DEAD_BAND 5 #endif +#ifndef GWIN_SLIDER_TOGGLE_INC + #define GWIN_SLIDER_TOGGLE_INC 20 // How many toggles to go from minimum to maximum +#endif + // Prototypes for slider VMT functions static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y); static void MouseMove(GWidgetObject *gw, coord_t x, coord_t y); -static void DialMove(GWidgetObject *gw, uint16_t instance, uint16_t value); +static void ToggleOn(GWidgetObject *gw, uint16_t role); +static void DialMove(GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max); +static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance); +static void DialAssign(GWidgetObject *gw, uint16_t role, uint16_t instance); +static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role); +static uint16_t DialGet(GWidgetObject *gw, uint16_t role); // The button VMT table static const gwidgetVMT sliderVMT = { @@ -38,16 +47,25 @@ static const gwidgetVMT sliderVMT = { _gwidgetRedraw, // The redraw routine 0, // The after-clear routine }, - gwinSliderDraw_Std, // The default drawing routine - MouseMove, // Process mouse down events (AS MOUSEMOVE) - MouseUp, // Process mouse up events - MouseMove, // Process mouse move events - 0, // Process toggle off events (NOT USED) - 0, // Process toggle on events (NOT USED) - DialMove, // Process dial move events - 0, // Process all events (NOT USED) - 0, // AssignToggle (NOT USED) - 0, // AssignDial (NOT USED) + gwinSliderDraw_Std, // The default drawing routine + { + 0, // Process mouse down events (NOT USED) + MouseUp, // Process mouse up events + MouseMove, // Process mouse move events + }, + { + 2, // 1 toggle role + ToggleAssign, // Assign Toggles + ToggleGet, // Get Toggles + 0, // Process toggle off events (NOT USED) + ToggleOn, // Process toggle on events + }, + { + 1, // 1 dial roles + DialAssign, // Assign Dials + DialGet, // Get Dials + DialMove, // Process dial move events + } }; static const GSliderColors GSliderDefaultColors = { @@ -66,7 +84,7 @@ static void SendSliderEvent(GWidgetObject *gw) { // Trigger a GWIN Button Event psl = 0; - while ((psl = geventGetSourceListener((GSourceHandle)gw, psl))) { + while ((psl = geventGetSourceListener(GWIDGET_SOURCE, psl))) { if (!(pe = geventGetEventBuffer(psl))) continue; pse->type = GEVENT_GWIN_SLIDER; @@ -75,7 +93,7 @@ static void SendSliderEvent(GWidgetObject *gw) { geventSendEvent(psl); } - #undef pbe + #undef pse } // Reset the display position back to the value predicted by the saved slider position @@ -159,13 +177,28 @@ static void MouseMove(GWidgetObject *gw, coord_t x, coord_t y) { #undef gsw } -// A dial move event -static void DialMove(GWidgetObject *gw, uint16_t instance, uint16_t value) { -#if GFX_USE_GINPUT && GINPUT_NEED_DIAL +// A toggle on has occurred +static void ToggleOn(GWidgetObject *gw, uint16_t role) { #define gsw ((GSliderObject *)gw) + if (role) { + gwinSetSliderPosition((GHandle)gw, gsw->pos+(gsw->max-gsw->min)/GWIN_SLIDER_TOGGLE_INC); + SendSliderEvent(gw); + } else { + gwinSetSliderPosition((GHandle)gw, gsw->pos-(gsw->max-gsw->min)/GWIN_SLIDER_TOGGLE_INC); + SendSliderEvent(gw); + } + #undef gsw +} + +// A dial move event +static void DialMove(GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max) { +#if GFX_USE_GINPUT && GINPUT_NEED_DIAL + #define gsw ((GSliderObject *)gw) + (void) role; + // Set the new position - gsw->pos = (uint16_t)((uint32_t)value*(gsw->max-gsw->min)/ginputGetDialRange(instance) + gsw->min); + gsw->pos = (uint16_t)((uint32_t)value*(gsw->max-gsw->min)/max + gsw->min); ResetDisplayPos(gsw); gwinDraw(&gw->g); @@ -174,13 +207,37 @@ static void DialMove(GWidgetObject *gw, uint16_t instance, uint16_t value) { SendSliderEvent(gw); #undef gsw #else - (void)gw; (void)instance; (void)value; + (void)gw; (void)role; (void)value; (void)max; #endif } +static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + if (role) + ((GSliderObject *)gw)->t_up = instance; + else + ((GSliderObject *)gw)->t_dn = instance; +} + +static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { + return role ? ((GSliderObject *)gw)->t_up : ((GSliderObject *)gw)->t_dn; +} + +static void DialAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + (void) role; + ((GSliderObject *)gw)->dial = instance; +} + +static uint16_t DialGet(GWidgetObject *gw, uint16_t role) { + (void) role; + return ((GSliderObject *)gw)->dial; +} + GHandle gwinCreateSlider(GSliderObject *gs, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gs = (GSliderObject *)_gwidgetInit((GWidgetObject *)gs, x, y, width, height, sizeof(GSliderObject), &sliderVMT))) + if (!(gs = (GSliderObject *)_gwidgetCreate((GWidgetObject *)gs, x, y, width, height, sizeof(GSliderObject), &sliderVMT))) return 0; + gs->t_dn = (uint16_t) -1; + gs->t_up = (uint16_t) -1; + gs->dial = (uint16_t) -1; gs->c = GSliderDefaultColors; gs->min = 0; gs->max = 100; From 49b3e8f55ae135ce6475d1185db68e665430fe5e Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 15 Jun 2013 21:09:02 +1000 Subject: [PATCH 06/38] License header updates --- demos/applications/mandelbrot/gfxconf.h | 1 + demos/applications/mandelbrot/main.c | 1 + demos/applications/notepad/gfxconf.h | 1 + demos/applications/notepad/main.c | 1 + demos/benchmarks/gfxconf.h | 1 + demos/benchmarks/main.c | 1 + demos/modules/gadc/gfxconf.h | 1 + demos/modules/gadc/gwinosc.c | 1 + demos/modules/gadc/gwinosc.h | 1 + demos/modules/gadc/main.c | 1 + demos/modules/gaudin/gfxconf.h | 1 + demos/modules/gaudin/gwinosc.c | 1 + demos/modules/gaudin/gwinosc.h | 1 + demos/modules/gaudin/main.c | 1 + demos/modules/gdisp/gdisp_basics/gfxconf.h | 1 + demos/modules/gdisp/gdisp_basics/main.c | 1 + demos/modules/gdisp/gdisp_circles/gfxconf.h | 1 + demos/modules/gdisp/gdisp_circles/main.c | 1 + demos/modules/gdisp/gdisp_images/gfxconf.h | 1 + demos/modules/gdisp/gdisp_images/main.c | 1 + .../gdisp/gdisp_images_animated/gfxconf.h | 32 +++++++++++++++---- .../gdisp/gdisp_images_animated/main.c | 1 + demos/modules/gdisp/gdisp_text/gfxconf.h | 1 + demos/modules/gdisp/gdisp_text/main.c | 1 + .../ginput/touch_driver_test/gfxconf.h | 1 + demos/modules/ginput/touch_driver_test/main.c | 1 + demos/modules/graph/gfxconf.h | 1 + demos/modules/graph/main.c | 1 + demos/modules/gtimer/gfxconf.h | 1 + demos/modules/gtimer/main.c | 1 + demos/modules/gwin/basic/gfxconf.h | 32 +++++++++++++++---- demos/modules/gwin/basic/main.c | 1 + demos/modules/gwin/console/gfxconf.h | 32 +++++++++++++++---- demos/modules/gwin/console/main.c | 1 + demos/modules/gwin/slider/gfxconf.h | 32 +++++++++++++++---- demos/modules/gwin/slider/main.c | 1 + demos/modules/gwin/widgets/gfxconf.h | 30 ++++++++++++++--- demos/modules/gwin/widgets/main.c | 1 + demos/modules/tdisp/gfxconf.h | 1 + demos/modules/tdisp/main.c | 1 + demos/readme.txt | 2 ++ drivers/gadc/AT91SAM7/gadc_lld.c | 2 +- .../AT91SAM7/gadc_lld_board_olimexsam7ex256.h | 2 +- drivers/gadc/AT91SAM7/gadc_lld_config.h | 2 +- drivers/gaudin/gadc/gaudin_lld.c | 2 +- .../gadc/gaudin_lld_board_olimexsam7ex256.h | 2 +- drivers/gaudin/gadc/gaudin_lld_config.h | 2 +- drivers/gdisp/HX8347D/HX8347D.h | 2 +- drivers/gdisp/HX8347D/gdisp_lld.c | 2 +- .../gdisp_lld_board_st_stm32f4_discovery.h | 2 +- drivers/gdisp/HX8347D/gdisp_lld_config.h | 2 +- drivers/gdisp/ILI9320/gdisp_lld.c | 2 +- .../gdisp/ILI9320/gdisp_lld_board_example.h | 2 +- .../gdisp_lld_board_olimex_pic32mx_lcd.h | 2 +- .../gdisp_lld_board_olimex_stm32_lcd.h | 2 +- drivers/gdisp/ILI9320/gdisp_lld_config.h | 12 +++---- drivers/gdisp/ILI9325/gdisp_lld.c | 2 +- .../gdisp/ILI9325/gdisp_lld_board_example.h | 2 +- .../ILI9325/gdisp_lld_board_hy_stm32_100p.h | 2 +- drivers/gdisp/ILI9325/gdisp_lld_config.h | 12 +++---- drivers/gdisp/ILI9481/gdisp_lld.c | 2 +- .../gdisp/ILI9481/gdisp_lld_board_example.h | 2 +- .../ILI9481/gdisp_lld_board_example_fsmc.h | 2 +- .../gdisp_lld_board_firebullstm32f103.h | 2 +- drivers/gdisp/ILI9481/gdisp_lld_config.h | 2 +- drivers/gdisp/Nokia6610GE12/GE12.h | 12 +++---- drivers/gdisp/Nokia6610GE12/gdisp_lld.c | 2 +- .../Nokia6610GE12/gdisp_lld_board_example.h | 12 +++---- .../gdisp_lld_board_olimexsam7ex256.h | 12 +++---- .../gdisp/Nokia6610GE12/gdisp_lld_config.h | 12 +++---- drivers/gdisp/Nokia6610GE8/GE8.h | 12 +++---- drivers/gdisp/Nokia6610GE8/gdisp_lld.c | 2 +- .../Nokia6610GE8/gdisp_lld_board_example.h | 12 +++---- .../gdisp_lld_board_olimexsam7ex256.h | 2 +- drivers/gdisp/Nokia6610GE8/gdisp_lld_config.h | 12 +++---- drivers/gdisp/S6D1121/gdisp_lld.c | 2 +- .../gdisp/S6D1121/gdisp_lld_board_example.h | 12 +++---- .../S6D1121/gdisp_lld_board_olimex_e407.h | 12 +++---- drivers/gdisp/S6D1121/gdisp_lld_config.h | 12 +++---- drivers/gdisp/SSD1289/gdisp_lld.c | 2 +- .../gdisp/SSD1289/gdisp_lld_board_example.h | 12 +++---- .../SSD1289/gdisp_lld_board_example_fsmc.h | 2 +- .../gdisp_lld_board_firebullstm32f103.h | 12 +++---- .../gdisp_lld_board_st_stm32f4_discovery.h | 2 +- drivers/gdisp/SSD1289/gdisp_lld_config.h | 12 +++---- drivers/gdisp/SSD1963/gdisp_lld.c | 2 +- .../SSD1963/gdisp_lld_board_example_fsmc.h | 2 +- .../SSD1963/gdisp_lld_board_example_gpio.h | 12 +++---- drivers/gdisp/SSD1963/gdisp_lld_config.h | 2 +- .../gdisp/SSD1963/gdisp_lld_panel_example.h | 2 +- drivers/gdisp/SSD1963/ssd1963.h | 2 +- drivers/gdisp/SSD2119/gdisp_lld.c | 2 +- .../SSD2119/gdisp_lld_board_embest_dmstf4bb.h | 2 +- drivers/gdisp/SSD2119/gdisp_lld_config.h | 2 +- drivers/gdisp/SSD2119/ssd2119.h | 2 +- drivers/gdisp/TestStub/gdisp_lld.c | 2 +- drivers/gdisp/TestStub/gdisp_lld_config.h | 12 +++---- drivers/ginput/dial/GADC/ginput_lld_dial.c | 2 +- .../ginput_lld_dial_board_olimexsam7ex256.h | 2 +- .../ginput/dial/GADC/ginput_lld_dial_config.h | 2 +- drivers/ginput/toggle/Pal/ginput_lld_toggle.c | 2 +- .../Pal/ginput_lld_toggle_board_example.h | 12 +++---- .../ginput_lld_toggle_board_olimexsam7ex256.h | 2 +- .../toggle/Pal/ginput_lld_toggle_config.h | 12 +++---- .../ginput/touch/ADS7843/ginput_lld_mouse.c | 2 +- .../ADS7843/ginput_lld_mouse_board_example.h | 12 +++---- ...input_lld_mouse_board_firebull_stm32f103.h | 12 +++---- ...ginput_lld_mouse_board_olimex_stm32_e407.h | 12 +++---- ...put_lld_mouse_board_st_stm32f4_discovery.h | 2 +- .../touch/ADS7843/ginput_lld_mouse_config.h | 2 +- drivers/ginput/touch/MCU/ginput_lld_mouse.c | 2 +- .../MCU/ginput_lld_mouse_board_example.h | 12 +++---- ...input_lld_mouse_board_olimex_pic32mx_lcd.h | 12 +++---- .../ginput_lld_mouse_board_olimex_stm32_lcd.h | 2 +- .../touch/MCU/ginput_lld_mouse_config.h | 2 +- .../ginput/touch/STMPE811/ginput_lld_mouse.c | 2 +- .../ginput_lld_mouse_board_embest_dmstf4bb.h | 12 +++---- .../STMPE811/ginput_lld_mouse_board_example.h | 12 +++---- .../touch/STMPE811/ginput_lld_mouse_config.h | 2 +- drivers/ginput/touch/STMPE811/stmpe811.h | 2 +- drivers/multiple/Win32/gdisp_lld.c | 2 +- drivers/multiple/Win32/gdisp_lld_config.h | 12 +++---- .../multiple/Win32/ginput_lld_mouse_config.h | 2 +- .../multiple/Win32/ginput_lld_toggle_config.h | 2 +- drivers/multiple/X/gdisp_lld.c | 2 +- drivers/multiple/X/gdisp_lld_config.h | 2 +- drivers/multiple/X/ginput_lld_mouse_config.h | 2 +- drivers/tdisp/HD44780/tdisp_lld.c | 2 +- .../tdisp/HD44780/tdisp_lld_board_example.h | 2 +- .../HD44780/tdisp_lld_board_olimex_e407.h | 2 +- .../tdisp_lld_board_st_stm32f4_discovery.h | 2 +- include/gadc/gadc.h | 2 +- include/gadc/lld/gadc_lld.h | 2 +- include/gadc/options.h | 2 +- include/gaudin/gaudin.h | 2 +- include/gaudin/lld/gaudin_lld.h | 2 +- include/gaudin/options.h | 12 +++---- include/gaudout/gaudout.h | 2 +- include/gaudout/options.h | 12 +++---- include/gdisp/fonts.h | 2 +- include/gdisp/gdisp.h | 2 +- include/gdisp/image.h | 2 +- include/gdisp/lld/emulation.c | 2 +- include/gdisp/lld/gdisp_lld.h | 2 +- include/gdisp/lld/gdisp_lld_msgs.h | 2 +- include/gdisp/options.h | 2 +- include/gevent/gevent.h | 2 +- include/gevent/options.h | 2 +- include/gfx.h | 2 +- include/gfx_rules.h | 2 +- include/ginput/dial.h | 2 +- include/ginput/ginput.h | 2 +- include/ginput/keyboard.h | 2 +- include/ginput/lld/dial.h | 2 +- include/ginput/lld/mouse.h | 2 +- include/ginput/lld/toggle.h | 2 +- include/ginput/mouse.h | 2 +- include/ginput/options.h | 12 +++---- include/ginput/toggle.h | 2 +- include/gmisc/gmisc.h | 2 +- include/gmisc/options.h | 2 +- include/gos/chibios.h | 22 +++---------- include/gos/gos.h | 22 +++---------- include/gos/options.h | 23 +++---------- include/gos/posix.h | 22 +++---------- include/gos/win32.h | 22 +++---------- include/gqueue/gqueue.h | 22 +++---------- include/gqueue/options.h | 23 +++---------- include/gtimer/gtimer.h | 2 +- include/gtimer/options.h | 12 +++---- include/gwin/button.h | 2 +- include/gwin/checkbox.h | 2 +- include/gwin/class_gwin.h | 2 +- include/gwin/console.h | 2 +- include/gwin/graph.h | 2 +- include/gwin/gwidget.h | 2 +- include/gwin/gwin.h | 2 +- include/gwin/options.h | 2 +- include/gwin/slider.h | 2 +- include/tdisp/lld/tdisp_lld.h | 2 +- include/tdisp/options.h | 2 +- include/tdisp/tdisp.h | 2 +- src/gadc/gadc.c | 2 +- src/gaudin/gaudin.c | 2 +- src/gaudout/gaudout.c | 2 +- src/gdisp/fonts.c | 2 +- src/gdisp/gdisp.c | 2 +- src/gdisp/image.c | 2 +- src/gdisp/image_bmp.c | 2 +- src/gdisp/image_gif.c | 2 +- src/gdisp/image_jpg.c | 2 +- src/gdisp/image_native.c | 2 +- src/gdisp/image_png.c | 2 +- src/gevent/gevent.c | 2 +- src/gfx.c | 23 +++---------- src/ginput/dial.c | 2 +- src/ginput/ginput.c | 2 +- src/ginput/keyboard.c | 2 +- src/ginput/mouse.c | 2 +- src/ginput/toggle.c | 2 +- src/gmisc/arrayops.c | 2 +- src/gmisc/trig.c | 23 +++---------- src/gos/chibios.c | 23 +++---------- src/gos/posix.c | 23 +++---------- src/gos/win32.c | 23 +++---------- src/gqueue/gqueue.c | 22 +++---------- src/gtimer/gtimer.c | 2 +- src/gwin/button.c | 2 +- src/gwin/checkbox.c | 2 +- src/gwin/console.c | 2 +- src/gwin/graph.c | 2 +- src/gwin/gwidget.c | 2 +- src/gwin/gwin.c | 2 +- src/gwin/gwm.c | 2 +- src/gwin/slider.c | 2 +- src/tdisp/tdisp.c | 2 +- tools/file2c/src/file2c.c | 2 +- 217 files changed, 549 insertions(+), 575 deletions(-) diff --git a/demos/applications/mandelbrot/gfxconf.h b/demos/applications/mandelbrot/gfxconf.h index a2b15927..1fb8e8c3 100644 --- a/demos/applications/mandelbrot/gfxconf.h +++ b/demos/applications/mandelbrot/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/applications/mandelbrot/main.c b/demos/applications/mandelbrot/main.c index 9d753a87..ce738fed 100644 --- a/demos/applications/mandelbrot/main.c +++ b/demos/applications/mandelbrot/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/applications/notepad/gfxconf.h b/demos/applications/notepad/gfxconf.h index b9aa53f9..e65d4f45 100644 --- a/demos/applications/notepad/gfxconf.h +++ b/demos/applications/notepad/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/applications/notepad/main.c b/demos/applications/notepad/main.c index d9a6d954..3da0fec1 100644 --- a/demos/applications/notepad/main.c +++ b/demos/applications/notepad/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/benchmarks/gfxconf.h b/demos/benchmarks/gfxconf.h index 5185b50e..4e7045e3 100644 --- a/demos/benchmarks/gfxconf.h +++ b/demos/benchmarks/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/benchmarks/main.c b/demos/benchmarks/main.c index d39215f0..d76e83f2 100644 --- a/demos/benchmarks/main.c +++ b/demos/benchmarks/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gadc/gfxconf.h b/demos/modules/gadc/gfxconf.h index 17bc5a6b..ee3d755f 100644 --- a/demos/modules/gadc/gfxconf.h +++ b/demos/modules/gadc/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gadc/gwinosc.c b/demos/modules/gadc/gwinosc.c index 60a08686..0b8dee2f 100644 --- a/demos/modules/gadc/gwinosc.c +++ b/demos/modules/gadc/gwinosc.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gadc/gwinosc.h b/demos/modules/gadc/gwinosc.h index 1a2e7f18..eeb2a181 100644 --- a/demos/modules/gadc/gwinosc.h +++ b/demos/modules/gadc/gwinosc.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gadc/main.c b/demos/modules/gadc/main.c index 4acf1da7..3346722c 100644 --- a/demos/modules/gadc/main.c +++ b/demos/modules/gadc/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gaudin/gfxconf.h b/demos/modules/gaudin/gfxconf.h index 01981087..2f8551c7 100644 --- a/demos/modules/gaudin/gfxconf.h +++ b/demos/modules/gaudin/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gaudin/gwinosc.c b/demos/modules/gaudin/gwinosc.c index 975c2c06..2557eeea 100644 --- a/demos/modules/gaudin/gwinosc.c +++ b/demos/modules/gaudin/gwinosc.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gaudin/gwinosc.h b/demos/modules/gaudin/gwinosc.h index d696e276..f3243f52 100644 --- a/demos/modules/gaudin/gwinosc.h +++ b/demos/modules/gaudin/gwinosc.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gaudin/main.c b/demos/modules/gaudin/main.c index a647d4af..cebfb1f1 100644 --- a/demos/modules/gaudin/main.c +++ b/demos/modules/gaudin/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gdisp/gdisp_basics/gfxconf.h b/demos/modules/gdisp/gdisp_basics/gfxconf.h index b632f6e0..0de4cdb2 100644 --- a/demos/modules/gdisp/gdisp_basics/gfxconf.h +++ b/demos/modules/gdisp/gdisp_basics/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gdisp/gdisp_basics/main.c b/demos/modules/gdisp/gdisp_basics/main.c index d7a1b5e3..6067328a 100644 --- a/demos/modules/gdisp/gdisp_basics/main.c +++ b/demos/modules/gdisp/gdisp_basics/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gdisp/gdisp_circles/gfxconf.h b/demos/modules/gdisp/gdisp_circles/gfxconf.h index cd7515d9..028a5781 100644 --- a/demos/modules/gdisp/gdisp_circles/gfxconf.h +++ b/demos/modules/gdisp/gdisp_circles/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gdisp/gdisp_circles/main.c b/demos/modules/gdisp/gdisp_circles/main.c index 3a9675bb..c690d4a3 100644 --- a/demos/modules/gdisp/gdisp_circles/main.c +++ b/demos/modules/gdisp/gdisp_circles/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gdisp/gdisp_images/gfxconf.h b/demos/modules/gdisp/gdisp_images/gfxconf.h index 866f3ba7..90d9714e 100644 --- a/demos/modules/gdisp/gdisp_images/gfxconf.h +++ b/demos/modules/gdisp/gdisp_images/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gdisp/gdisp_images/main.c b/demos/modules/gdisp/gdisp_images/main.c index 3fc20490..78208d08 100644 --- a/demos/modules/gdisp/gdisp_images/main.c +++ b/demos/modules/gdisp/gdisp_images/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gdisp/gdisp_images_animated/gfxconf.h b/demos/modules/gdisp/gdisp_images_animated/gfxconf.h index 9a734924..a2d36643 100644 --- a/demos/modules/gdisp/gdisp_images_animated/gfxconf.h +++ b/demos/modules/gdisp/gdisp_images_animated/gfxconf.h @@ -1,9 +1,29 @@ -/** - * This file has a different license to the rest of the GFX system. - * You can copy, modify and distribute this file as you see fit. - * You do not need to publish your source modifications to this file. - * The only thing you are not permitted to do is to relicense it - * under a different license. +/* + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _GFXCONF_H diff --git a/demos/modules/gdisp/gdisp_images_animated/main.c b/demos/modules/gdisp/gdisp_images_animated/main.c index c4ae9d02..48b8e1cf 100644 --- a/demos/modules/gdisp/gdisp_images_animated/main.c +++ b/demos/modules/gdisp/gdisp_images_animated/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gdisp/gdisp_text/gfxconf.h b/demos/modules/gdisp/gdisp_text/gfxconf.h index 01fc2749..8a97282a 100644 --- a/demos/modules/gdisp/gdisp_text/gfxconf.h +++ b/demos/modules/gdisp/gdisp_text/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gdisp/gdisp_text/main.c b/demos/modules/gdisp/gdisp_text/main.c index 042ccc5b..c00af183 100644 --- a/demos/modules/gdisp/gdisp_text/main.c +++ b/demos/modules/gdisp/gdisp_text/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/ginput/touch_driver_test/gfxconf.h b/demos/modules/ginput/touch_driver_test/gfxconf.h index ee96f23c..e3a302d0 100644 --- a/demos/modules/ginput/touch_driver_test/gfxconf.h +++ b/demos/modules/ginput/touch_driver_test/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/ginput/touch_driver_test/main.c b/demos/modules/ginput/touch_driver_test/main.c index 424b2587..1894a439 100644 --- a/demos/modules/ginput/touch_driver_test/main.c +++ b/demos/modules/ginput/touch_driver_test/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/graph/gfxconf.h b/demos/modules/graph/gfxconf.h index f54cfe1a..0ce90c94 100644 --- a/demos/modules/graph/gfxconf.h +++ b/demos/modules/graph/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/graph/main.c b/demos/modules/graph/main.c index f74ecb5d..f05295e5 100644 --- a/demos/modules/graph/main.c +++ b/demos/modules/graph/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gtimer/gfxconf.h b/demos/modules/gtimer/gfxconf.h index 8e996d52..0b89cd04 100644 --- a/demos/modules/gtimer/gfxconf.h +++ b/demos/modules/gtimer/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gtimer/main.c b/demos/modules/gtimer/main.c index 6d09d594..5c7d1978 100644 --- a/demos/modules/gtimer/main.c +++ b/demos/modules/gtimer/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gwin/basic/gfxconf.h b/demos/modules/gwin/basic/gfxconf.h index dd8376bf..5445e47c 100644 --- a/demos/modules/gwin/basic/gfxconf.h +++ b/demos/modules/gwin/basic/gfxconf.h @@ -1,9 +1,29 @@ -/** - * This file has a different license to the rest of the GFX system. - * You can copy, modify and distribute this file as you see fit. - * You do not need to publish your source modifications to this file. - * The only thing you are not permitted to do is to relicense it - * under a different license. +/* + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _GFXCONF_H diff --git a/demos/modules/gwin/basic/main.c b/demos/modules/gwin/basic/main.c index fa618e0f..17796918 100644 --- a/demos/modules/gwin/basic/main.c +++ b/demos/modules/gwin/basic/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gwin/console/gfxconf.h b/demos/modules/gwin/console/gfxconf.h index 46361c9b..802914b6 100644 --- a/demos/modules/gwin/console/gfxconf.h +++ b/demos/modules/gwin/console/gfxconf.h @@ -1,9 +1,29 @@ -/** - * This file has a different license to the rest of the GFX system. - * You can copy, modify and distribute this file as you see fit. - * You do not need to publish your source modifications to this file. - * The only thing you are not permitted to do is to relicense it - * under a different license. +/* + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _GFXCONF_H diff --git a/demos/modules/gwin/console/main.c b/demos/modules/gwin/console/main.c index 557cf988..6ca3f073 100644 --- a/demos/modules/gwin/console/main.c +++ b/demos/modules/gwin/console/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gwin/slider/gfxconf.h b/demos/modules/gwin/slider/gfxconf.h index 84698905..54f9547e 100644 --- a/demos/modules/gwin/slider/gfxconf.h +++ b/demos/modules/gwin/slider/gfxconf.h @@ -1,9 +1,29 @@ -/** - * This file has a different license to the rest of the GFX system. - * You can copy, modify and distribute this file as you see fit. - * You do not need to publish your source modifications to this file. - * The only thing you are not permitted to do is to relicense it - * under a different license. +/* + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _GFXCONF_H diff --git a/demos/modules/gwin/slider/main.c b/demos/modules/gwin/slider/main.c index c56a1aa7..09906420 100644 --- a/demos/modules/gwin/slider/main.c +++ b/demos/modules/gwin/slider/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index 411d829e..5c862441 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -1,9 +1,29 @@ /* - * This file has a different license to the rest of the GFX system. - * You can copy, modify and distribute this file as you see fit. - * You do not need to publish your source modifications to this file. - * The only thing you are not permitted to do is to relicense it - * under a different license. + * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _GFXCONF_H diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index 1c34b9fa..33c288f4 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/tdisp/gfxconf.h b/demos/modules/tdisp/gfxconf.h index eeaaa2a2..a90ab9c0 100644 --- a/demos/modules/tdisp/gfxconf.h +++ b/demos/modules/tdisp/gfxconf.h @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/modules/tdisp/main.c b/demos/modules/tdisp/main.c index face28c1..ee1c5b58 100644 --- a/demos/modules/tdisp/main.c +++ b/demos/modules/tdisp/main.c @@ -1,5 +1,6 @@ /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without diff --git a/demos/readme.txt b/demos/readme.txt index 5b2773db..3530c8e4 100644 --- a/demos/readme.txt +++ b/demos/readme.txt @@ -7,6 +7,7 @@ within each file: /* * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu + * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -32,3 +33,4 @@ within each file: * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +Files under the 3rdparty directory are licensed as per the original contributor. diff --git a/drivers/gadc/AT91SAM7/gadc_lld.c b/drivers/gadc/AT91SAM7/gadc_lld.c index 3425cbf0..3a99f2a3 100644 --- a/drivers/gadc/AT91SAM7/gadc_lld.c +++ b/drivers/gadc/AT91SAM7/gadc_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gadc/AT91SAM7/gadc_lld_board_olimexsam7ex256.h b/drivers/gadc/AT91SAM7/gadc_lld_board_olimexsam7ex256.h index d7aa2ceb..95ff6c8a 100644 --- a/drivers/gadc/AT91SAM7/gadc_lld_board_olimexsam7ex256.h +++ b/drivers/gadc/AT91SAM7/gadc_lld_board_olimexsam7ex256.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gadc/AT91SAM7/gadc_lld_config.h b/drivers/gadc/AT91SAM7/gadc_lld_config.h index 13906fbb..a65d0d07 100644 --- a/drivers/gadc/AT91SAM7/gadc_lld_config.h +++ b/drivers/gadc/AT91SAM7/gadc_lld_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gaudin/gadc/gaudin_lld.c b/drivers/gaudin/gadc/gaudin_lld.c index db7a2bb2..7897eb36 100644 --- a/drivers/gaudin/gadc/gaudin_lld.c +++ b/drivers/gaudin/gadc/gaudin_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gaudin/gadc/gaudin_lld_board_olimexsam7ex256.h b/drivers/gaudin/gadc/gaudin_lld_board_olimexsam7ex256.h index f122d94d..7b217c48 100644 --- a/drivers/gaudin/gadc/gaudin_lld_board_olimexsam7ex256.h +++ b/drivers/gaudin/gadc/gaudin_lld_board_olimexsam7ex256.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gaudin/gadc/gaudin_lld_config.h b/drivers/gaudin/gadc/gaudin_lld_config.h index 9e74ad14..8d8328c4 100644 --- a/drivers/gaudin/gadc/gaudin_lld_config.h +++ b/drivers/gaudin/gadc/gaudin_lld_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/HX8347D/HX8347D.h b/drivers/gdisp/HX8347D/HX8347D.h index c0cb18fb..29b1a9ca 100644 --- a/drivers/gdisp/HX8347D/HX8347D.h +++ b/drivers/gdisp/HX8347D/HX8347D.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/HX8347D/gdisp_lld.c b/drivers/gdisp/HX8347D/gdisp_lld.c index 2d9720bc..41850600 100644 --- a/drivers/gdisp/HX8347D/gdisp_lld.c +++ b/drivers/gdisp/HX8347D/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/HX8347D/gdisp_lld_board_st_stm32f4_discovery.h b/drivers/gdisp/HX8347D/gdisp_lld_board_st_stm32f4_discovery.h index 6886830b..ec90560c 100644 --- a/drivers/gdisp/HX8347D/gdisp_lld_board_st_stm32f4_discovery.h +++ b/drivers/gdisp/HX8347D/gdisp_lld_board_st_stm32f4_discovery.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/HX8347D/gdisp_lld_config.h b/drivers/gdisp/HX8347D/gdisp_lld_config.h index b8bf853f..39cd1c48 100644 --- a/drivers/gdisp/HX8347D/gdisp_lld_config.h +++ b/drivers/gdisp/HX8347D/gdisp_lld_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9320/gdisp_lld.c b/drivers/gdisp/ILI9320/gdisp_lld.c index 8c9dbed7..e566876e 100644 --- a/drivers/gdisp/ILI9320/gdisp_lld.c +++ b/drivers/gdisp/ILI9320/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9320/gdisp_lld_board_example.h b/drivers/gdisp/ILI9320/gdisp_lld_board_example.h index ec7a770d..4834553b 100644 --- a/drivers/gdisp/ILI9320/gdisp_lld_board_example.h +++ b/drivers/gdisp/ILI9320/gdisp_lld_board_example.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9320/gdisp_lld_board_olimex_pic32mx_lcd.h b/drivers/gdisp/ILI9320/gdisp_lld_board_olimex_pic32mx_lcd.h index e09c08d1..5bb081aa 100644 --- a/drivers/gdisp/ILI9320/gdisp_lld_board_olimex_pic32mx_lcd.h +++ b/drivers/gdisp/ILI9320/gdisp_lld_board_olimex_pic32mx_lcd.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9320/gdisp_lld_board_olimex_stm32_lcd.h b/drivers/gdisp/ILI9320/gdisp_lld_board_olimex_stm32_lcd.h index 128bfcbb..eb825710 100644 --- a/drivers/gdisp/ILI9320/gdisp_lld_board_olimex_stm32_lcd.h +++ b/drivers/gdisp/ILI9320/gdisp_lld_board_olimex_stm32_lcd.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9320/gdisp_lld_config.h b/drivers/gdisp/ILI9320/gdisp_lld_config.h index 708370d8..af8e4fcf 100644 --- a/drivers/gdisp/ILI9320/gdisp_lld_config.h +++ b/drivers/gdisp/ILI9320/gdisp_lld_config.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/ILI9320/gdisp_lld_config.h diff --git a/drivers/gdisp/ILI9325/gdisp_lld.c b/drivers/gdisp/ILI9325/gdisp_lld.c index 4ca5fe78..a87f999e 100644 --- a/drivers/gdisp/ILI9325/gdisp_lld.c +++ b/drivers/gdisp/ILI9325/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9325/gdisp_lld_board_example.h b/drivers/gdisp/ILI9325/gdisp_lld_board_example.h index a07d9dfb..72358b89 100644 --- a/drivers/gdisp/ILI9325/gdisp_lld_board_example.h +++ b/drivers/gdisp/ILI9325/gdisp_lld_board_example.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9325/gdisp_lld_board_hy_stm32_100p.h b/drivers/gdisp/ILI9325/gdisp_lld_board_hy_stm32_100p.h index c3d917af..edf6901c 100644 --- a/drivers/gdisp/ILI9325/gdisp_lld_board_hy_stm32_100p.h +++ b/drivers/gdisp/ILI9325/gdisp_lld_board_hy_stm32_100p.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9325/gdisp_lld_config.h b/drivers/gdisp/ILI9325/gdisp_lld_config.h index 8e5d6101..58540186 100644 --- a/drivers/gdisp/ILI9325/gdisp_lld_config.h +++ b/drivers/gdisp/ILI9325/gdisp_lld_config.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/ILI9325/gdisp_lld_config.h diff --git a/drivers/gdisp/ILI9481/gdisp_lld.c b/drivers/gdisp/ILI9481/gdisp_lld.c index 47e5f679..27c314d1 100644 --- a/drivers/gdisp/ILI9481/gdisp_lld.c +++ b/drivers/gdisp/ILI9481/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9481/gdisp_lld_board_example.h b/drivers/gdisp/ILI9481/gdisp_lld_board_example.h index 94a05ab7..8755f5a7 100644 --- a/drivers/gdisp/ILI9481/gdisp_lld_board_example.h +++ b/drivers/gdisp/ILI9481/gdisp_lld_board_example.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9481/gdisp_lld_board_example_fsmc.h b/drivers/gdisp/ILI9481/gdisp_lld_board_example_fsmc.h index 51013d87..de45c89d 100644 --- a/drivers/gdisp/ILI9481/gdisp_lld_board_example_fsmc.h +++ b/drivers/gdisp/ILI9481/gdisp_lld_board_example_fsmc.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9481/gdisp_lld_board_firebullstm32f103.h b/drivers/gdisp/ILI9481/gdisp_lld_board_firebullstm32f103.h index 6e4edda9..60559a23 100644 --- a/drivers/gdisp/ILI9481/gdisp_lld_board_firebullstm32f103.h +++ b/drivers/gdisp/ILI9481/gdisp_lld_board_firebullstm32f103.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/ILI9481/gdisp_lld_config.h b/drivers/gdisp/ILI9481/gdisp_lld_config.h index 488c9288..526e0180 100644 --- a/drivers/gdisp/ILI9481/gdisp_lld_config.h +++ b/drivers/gdisp/ILI9481/gdisp_lld_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/Nokia6610GE12/GE12.h b/drivers/gdisp/Nokia6610GE12/GE12.h index b3f30439..4bd7325f 100644 --- a/drivers/gdisp/Nokia6610GE12/GE12.h +++ b/drivers/gdisp/Nokia6610GE12/GE12.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ #ifndef GE12_H #define GE12_H diff --git a/drivers/gdisp/Nokia6610GE12/gdisp_lld.c b/drivers/gdisp/Nokia6610GE12/gdisp_lld.c index 860c3ca3..a200d9fe 100644 --- a/drivers/gdisp/Nokia6610GE12/gdisp_lld.c +++ b/drivers/gdisp/Nokia6610GE12/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/Nokia6610GE12/gdisp_lld_board_example.h b/drivers/gdisp/Nokia6610GE12/gdisp_lld_board_example.h index 6dd799e4..8ee00320 100644 --- a/drivers/gdisp/Nokia6610GE12/gdisp_lld_board_example.h +++ b/drivers/gdisp/Nokia6610GE12/gdisp_lld_board_example.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/Nokia6610GE12/gdisp_lld_board_example.h diff --git a/drivers/gdisp/Nokia6610GE12/gdisp_lld_board_olimexsam7ex256.h b/drivers/gdisp/Nokia6610GE12/gdisp_lld_board_olimexsam7ex256.h index 570e9c0d..3de13202 100644 --- a/drivers/gdisp/Nokia6610GE12/gdisp_lld_board_olimexsam7ex256.h +++ b/drivers/gdisp/Nokia6610GE12/gdisp_lld_board_olimexsam7ex256.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/Nokia6610GE12/gdisp_lld_board_olimexsam7ex256.h diff --git a/drivers/gdisp/Nokia6610GE12/gdisp_lld_config.h b/drivers/gdisp/Nokia6610GE12/gdisp_lld_config.h index 5bc19364..d7bfbb3c 100644 --- a/drivers/gdisp/Nokia6610GE12/gdisp_lld_config.h +++ b/drivers/gdisp/Nokia6610GE12/gdisp_lld_config.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/Nokia6610GE12/gdisp_lld_config.h diff --git a/drivers/gdisp/Nokia6610GE8/GE8.h b/drivers/gdisp/Nokia6610GE8/GE8.h index 9663d268..f888d15a 100644 --- a/drivers/gdisp/Nokia6610GE8/GE8.h +++ b/drivers/gdisp/Nokia6610GE8/GE8.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ #ifndef GE8_H #define GE8_H diff --git a/drivers/gdisp/Nokia6610GE8/gdisp_lld.c b/drivers/gdisp/Nokia6610GE8/gdisp_lld.c index 64f65ae7..4e62f297 100644 --- a/drivers/gdisp/Nokia6610GE8/gdisp_lld.c +++ b/drivers/gdisp/Nokia6610GE8/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/Nokia6610GE8/gdisp_lld_board_example.h b/drivers/gdisp/Nokia6610GE8/gdisp_lld_board_example.h index da7da7cf..10bad1cb 100644 --- a/drivers/gdisp/Nokia6610GE8/gdisp_lld_board_example.h +++ b/drivers/gdisp/Nokia6610GE8/gdisp_lld_board_example.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/Nokia6610GE8/gdisp_lld_board_example.h diff --git a/drivers/gdisp/Nokia6610GE8/gdisp_lld_board_olimexsam7ex256.h b/drivers/gdisp/Nokia6610GE8/gdisp_lld_board_olimexsam7ex256.h index cfca2785..dcd5f099 100644 --- a/drivers/gdisp/Nokia6610GE8/gdisp_lld_board_olimexsam7ex256.h +++ b/drivers/gdisp/Nokia6610GE8/gdisp_lld_board_olimexsam7ex256.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/Nokia6610GE8/gdisp_lld_config.h b/drivers/gdisp/Nokia6610GE8/gdisp_lld_config.h index 8b81969c..b3242fb3 100644 --- a/drivers/gdisp/Nokia6610GE8/gdisp_lld_config.h +++ b/drivers/gdisp/Nokia6610GE8/gdisp_lld_config.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/Nokia6610GE8/gdisp_lld_config.h diff --git a/drivers/gdisp/S6D1121/gdisp_lld.c b/drivers/gdisp/S6D1121/gdisp_lld.c index e8099ff6..93f94d94 100644 --- a/drivers/gdisp/S6D1121/gdisp_lld.c +++ b/drivers/gdisp/S6D1121/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/S6D1121/gdisp_lld_board_example.h b/drivers/gdisp/S6D1121/gdisp_lld_board_example.h index 339d21e8..4f31ca78 100644 --- a/drivers/gdisp/S6D1121/gdisp_lld_board_example.h +++ b/drivers/gdisp/S6D1121/gdisp_lld_board_example.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/S6D1121/gdisp_lld_board_example.h diff --git a/drivers/gdisp/S6D1121/gdisp_lld_board_olimex_e407.h b/drivers/gdisp/S6D1121/gdisp_lld_board_olimex_e407.h index 6ff02695..3a1ac94c 100644 --- a/drivers/gdisp/S6D1121/gdisp_lld_board_olimex_e407.h +++ b/drivers/gdisp/S6D1121/gdisp_lld_board_olimex_e407.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/S6D1121/gdisp_lld_board_olimex_e407.h diff --git a/drivers/gdisp/S6D1121/gdisp_lld_config.h b/drivers/gdisp/S6D1121/gdisp_lld_config.h index a91114a5..ab133e39 100644 --- a/drivers/gdisp/S6D1121/gdisp_lld_config.h +++ b/drivers/gdisp/S6D1121/gdisp_lld_config.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/S6D1121/gdisp_lld_config.h diff --git a/drivers/gdisp/SSD1289/gdisp_lld.c b/drivers/gdisp/SSD1289/gdisp_lld.c index 39795362..97a2cff7 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld.c +++ b/drivers/gdisp/SSD1289/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/SSD1289/gdisp_lld_board_example.h b/drivers/gdisp/SSD1289/gdisp_lld_board_example.h index b56139d9..1aab01f9 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld_board_example.h +++ b/drivers/gdisp/SSD1289/gdisp_lld_board_example.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/SSD1289/gdisp_lld_board_example.h diff --git a/drivers/gdisp/SSD1289/gdisp_lld_board_example_fsmc.h b/drivers/gdisp/SSD1289/gdisp_lld_board_example_fsmc.h index 48891078..0988f409 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld_board_example_fsmc.h +++ b/drivers/gdisp/SSD1289/gdisp_lld_board_example_fsmc.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/SSD1289/gdisp_lld_board_firebullstm32f103.h b/drivers/gdisp/SSD1289/gdisp_lld_board_firebullstm32f103.h index d744c8e7..71b1a5d2 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld_board_firebullstm32f103.h +++ b/drivers/gdisp/SSD1289/gdisp_lld_board_firebullstm32f103.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/SSD1289/gdisp_lld_board_firebullstm32f103.h diff --git a/drivers/gdisp/SSD1289/gdisp_lld_board_st_stm32f4_discovery.h b/drivers/gdisp/SSD1289/gdisp_lld_board_st_stm32f4_discovery.h index 292fa177..72fcc710 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld_board_st_stm32f4_discovery.h +++ b/drivers/gdisp/SSD1289/gdisp_lld_board_st_stm32f4_discovery.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/SSD1289/gdisp_lld_config.h b/drivers/gdisp/SSD1289/gdisp_lld_config.h index 8bc49305..53153a5c 100644 --- a/drivers/gdisp/SSD1289/gdisp_lld_config.h +++ b/drivers/gdisp/SSD1289/gdisp_lld_config.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/SSD1289/gdisp_lld_config.h diff --git a/drivers/gdisp/SSD1963/gdisp_lld.c b/drivers/gdisp/SSD1963/gdisp_lld.c index 0a70406c..c9792c98 100644 --- a/drivers/gdisp/SSD1963/gdisp_lld.c +++ b/drivers/gdisp/SSD1963/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/SSD1963/gdisp_lld_board_example_fsmc.h b/drivers/gdisp/SSD1963/gdisp_lld_board_example_fsmc.h index cfb3eb60..9dde7bde 100644 --- a/drivers/gdisp/SSD1963/gdisp_lld_board_example_fsmc.h +++ b/drivers/gdisp/SSD1963/gdisp_lld_board_example_fsmc.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/SSD1963/gdisp_lld_board_example_gpio.h b/drivers/gdisp/SSD1963/gdisp_lld_board_example_gpio.h index 44803598..1d604a88 100644 --- a/drivers/gdisp/SSD1963/gdisp_lld_board_example_gpio.h +++ b/drivers/gdisp/SSD1963/gdisp_lld_board_example_gpio.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/SSD1963/gdisp_lld_board_example_gpio.h diff --git a/drivers/gdisp/SSD1963/gdisp_lld_config.h b/drivers/gdisp/SSD1963/gdisp_lld_config.h index 398a7876..86d98efb 100644 --- a/drivers/gdisp/SSD1963/gdisp_lld_config.h +++ b/drivers/gdisp/SSD1963/gdisp_lld_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/SSD1963/gdisp_lld_panel_example.h b/drivers/gdisp/SSD1963/gdisp_lld_panel_example.h index b6c4e4c8..c527bd45 100644 --- a/drivers/gdisp/SSD1963/gdisp_lld_panel_example.h +++ b/drivers/gdisp/SSD1963/gdisp_lld_panel_example.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/SSD1963/ssd1963.h b/drivers/gdisp/SSD1963/ssd1963.h index 5c63439f..a3fa07f5 100644 --- a/drivers/gdisp/SSD1963/ssd1963.h +++ b/drivers/gdisp/SSD1963/ssd1963.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/SSD2119/gdisp_lld.c b/drivers/gdisp/SSD2119/gdisp_lld.c index 565edc1a..fe28ca45 100644 --- a/drivers/gdisp/SSD2119/gdisp_lld.c +++ b/drivers/gdisp/SSD2119/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h b/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h index 4d56de95..ccbba2a3 100644 --- a/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h +++ b/drivers/gdisp/SSD2119/gdisp_lld_board_embest_dmstf4bb.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/SSD2119/gdisp_lld_config.h b/drivers/gdisp/SSD2119/gdisp_lld_config.h index 6599034d..9496a773 100644 --- a/drivers/gdisp/SSD2119/gdisp_lld_config.h +++ b/drivers/gdisp/SSD2119/gdisp_lld_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/SSD2119/ssd2119.h b/drivers/gdisp/SSD2119/ssd2119.h index 82c29b07..cd3bfd5f 100644 --- a/drivers/gdisp/SSD2119/ssd2119.h +++ b/drivers/gdisp/SSD2119/ssd2119.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/TestStub/gdisp_lld.c b/drivers/gdisp/TestStub/gdisp_lld.c index ccc8074b..eed7ba06 100644 --- a/drivers/gdisp/TestStub/gdisp_lld.c +++ b/drivers/gdisp/TestStub/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/gdisp/TestStub/gdisp_lld_config.h b/drivers/gdisp/TestStub/gdisp_lld_config.h index 966c684c..dfc462be 100644 --- a/drivers/gdisp/TestStub/gdisp_lld_config.h +++ b/drivers/gdisp/TestStub/gdisp_lld_config.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/gdisp/TestStub/gdisp_lld_config.h diff --git a/drivers/ginput/dial/GADC/ginput_lld_dial.c b/drivers/ginput/dial/GADC/ginput_lld_dial.c index 96ac8675..9cc90dd8 100644 --- a/drivers/ginput/dial/GADC/ginput_lld_dial.c +++ b/drivers/ginput/dial/GADC/ginput_lld_dial.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/dial/GADC/ginput_lld_dial_board_olimexsam7ex256.h b/drivers/ginput/dial/GADC/ginput_lld_dial_board_olimexsam7ex256.h index ee025478..6cd1f6c6 100644 --- a/drivers/ginput/dial/GADC/ginput_lld_dial_board_olimexsam7ex256.h +++ b/drivers/ginput/dial/GADC/ginput_lld_dial_board_olimexsam7ex256.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/dial/GADC/ginput_lld_dial_config.h b/drivers/ginput/dial/GADC/ginput_lld_dial_config.h index 0fa3da47..94c39f6e 100644 --- a/drivers/ginput/dial/GADC/ginput_lld_dial_config.h +++ b/drivers/ginput/dial/GADC/ginput_lld_dial_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/toggle/Pal/ginput_lld_toggle.c b/drivers/ginput/toggle/Pal/ginput_lld_toggle.c index 038253a4..371f11c0 100644 --- a/drivers/ginput/toggle/Pal/ginput_lld_toggle.c +++ b/drivers/ginput/toggle/Pal/ginput_lld_toggle.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/toggle/Pal/ginput_lld_toggle_board_example.h b/drivers/ginput/toggle/Pal/ginput_lld_toggle_board_example.h index 828255c0..779d7500 100644 --- a/drivers/ginput/toggle/Pal/ginput_lld_toggle_board_example.h +++ b/drivers/ginput/toggle/Pal/ginput_lld_toggle_board_example.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/ginput/toggle/Pal/ginput_lld_toggle_board_example.h diff --git a/drivers/ginput/toggle/Pal/ginput_lld_toggle_board_olimexsam7ex256.h b/drivers/ginput/toggle/Pal/ginput_lld_toggle_board_olimexsam7ex256.h index e8bd13f1..7a673be0 100644 --- a/drivers/ginput/toggle/Pal/ginput_lld_toggle_board_olimexsam7ex256.h +++ b/drivers/ginput/toggle/Pal/ginput_lld_toggle_board_olimexsam7ex256.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/toggle/Pal/ginput_lld_toggle_config.h b/drivers/ginput/toggle/Pal/ginput_lld_toggle_config.h index 77b94577..151564d6 100644 --- a/drivers/ginput/toggle/Pal/ginput_lld_toggle_config.h +++ b/drivers/ginput/toggle/Pal/ginput_lld_toggle_config.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/ginput/toggle/Pal/ginput_lld_toggle_config.h diff --git a/drivers/ginput/touch/ADS7843/ginput_lld_mouse.c b/drivers/ginput/touch/ADS7843/ginput_lld_mouse.c index aa7cbb85..a25e6bac 100644 --- a/drivers/ginput/touch/ADS7843/ginput_lld_mouse.c +++ b/drivers/ginput/touch/ADS7843/ginput_lld_mouse.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_example.h b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_example.h index e3018881..d12c541f 100644 --- a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_example.h +++ b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_example.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_example.h diff --git a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h index 10172934..228b3996 100644 --- a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h +++ b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_firebull_stm32f103.h diff --git a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h index 8ea27102..543b595c 100644 --- a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h +++ b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_olimex_stm32_e407.h diff --git a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h index ae80af34..23adc336 100644 --- a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h +++ b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_board_st_stm32f4_discovery.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_config.h b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_config.h index c0219712..30a63061 100644 --- a/drivers/ginput/touch/ADS7843/ginput_lld_mouse_config.h +++ b/drivers/ginput/touch/ADS7843/ginput_lld_mouse_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse.c b/drivers/ginput/touch/MCU/ginput_lld_mouse.c index a5588b57..a1264bc8 100644 --- a/drivers/ginput/touch/MCU/ginput_lld_mouse.c +++ b/drivers/ginput/touch/MCU/ginput_lld_mouse.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_example.h b/drivers/ginput/touch/MCU/ginput_lld_mouse_board_example.h index f9483f72..a36f606e 100644 --- a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_example.h +++ b/drivers/ginput/touch/MCU/ginput_lld_mouse_board_example.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/ginput/touch/MCU/ginput_lld_mouse_board_example.h diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h b/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h index 22dc48b5..e50d8166 100644 --- a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h +++ b/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_pic32mx_lcd.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h b/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h index 49a86380..fb33b11f 100644 --- a/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h +++ b/drivers/ginput/touch/MCU/ginput_lld_mouse_board_olimex_stm32_lcd.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/touch/MCU/ginput_lld_mouse_config.h b/drivers/ginput/touch/MCU/ginput_lld_mouse_config.h index 29d6aea5..b4a3143e 100644 --- a/drivers/ginput/touch/MCU/ginput_lld_mouse_config.h +++ b/drivers/ginput/touch/MCU/ginput_lld_mouse_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/touch/STMPE811/ginput_lld_mouse.c b/drivers/ginput/touch/STMPE811/ginput_lld_mouse.c index be8ed207..5e4b78ef 100644 --- a/drivers/ginput/touch/STMPE811/ginput_lld_mouse.c +++ b/drivers/ginput/touch/STMPE811/ginput_lld_mouse.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h b/drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h index d0b019a5..192428ce 100644 --- a/drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h +++ b/drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_embest_dmstf4bb.h diff --git a/drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_example.h b/drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_example.h index 384c7af7..47827f74 100644 --- a/drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_example.h +++ b/drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_example.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/ginput/touch/STMPE811/ginput_lld_mouse_board_example.h diff --git a/drivers/ginput/touch/STMPE811/ginput_lld_mouse_config.h b/drivers/ginput/touch/STMPE811/ginput_lld_mouse_config.h index 9d08d724..d53fc6a0 100644 --- a/drivers/ginput/touch/STMPE811/ginput_lld_mouse_config.h +++ b/drivers/ginput/touch/STMPE811/ginput_lld_mouse_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/ginput/touch/STMPE811/stmpe811.h b/drivers/ginput/touch/STMPE811/stmpe811.h index 3bdb6ac8..eb58eb0b 100644 --- a/drivers/ginput/touch/STMPE811/stmpe811.h +++ b/drivers/ginput/touch/STMPE811/stmpe811.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/multiple/Win32/gdisp_lld.c b/drivers/multiple/Win32/gdisp_lld.c index b53b3632..c528d7b4 100644 --- a/drivers/multiple/Win32/gdisp_lld.c +++ b/drivers/multiple/Win32/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/multiple/Win32/gdisp_lld_config.h b/drivers/multiple/Win32/gdisp_lld_config.h index c1886ac8..5e0af71b 100644 --- a/drivers/multiple/Win32/gdisp_lld_config.h +++ b/drivers/multiple/Win32/gdisp_lld_config.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file drivers/multiple/Win32/gdisp_lld_config.h diff --git a/drivers/multiple/Win32/ginput_lld_mouse_config.h b/drivers/multiple/Win32/ginput_lld_mouse_config.h index 39478aaa..bcd69808 100644 --- a/drivers/multiple/Win32/ginput_lld_mouse_config.h +++ b/drivers/multiple/Win32/ginput_lld_mouse_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/multiple/Win32/ginput_lld_toggle_config.h b/drivers/multiple/Win32/ginput_lld_toggle_config.h index d487ca42..4418a683 100644 --- a/drivers/multiple/Win32/ginput_lld_toggle_config.h +++ b/drivers/multiple/Win32/ginput_lld_toggle_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/multiple/X/gdisp_lld.c b/drivers/multiple/X/gdisp_lld.c index ee436993..96ceeed2 100644 --- a/drivers/multiple/X/gdisp_lld.c +++ b/drivers/multiple/X/gdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/multiple/X/gdisp_lld_config.h b/drivers/multiple/X/gdisp_lld_config.h index dfa1972d..5fae5efe 100644 --- a/drivers/multiple/X/gdisp_lld_config.h +++ b/drivers/multiple/X/gdisp_lld_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/multiple/X/ginput_lld_mouse_config.h b/drivers/multiple/X/ginput_lld_mouse_config.h index 93f3d5f8..f0e66ffd 100644 --- a/drivers/multiple/X/ginput_lld_mouse_config.h +++ b/drivers/multiple/X/ginput_lld_mouse_config.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/tdisp/HD44780/tdisp_lld.c b/drivers/tdisp/HD44780/tdisp_lld.c index 988f35c7..79349814 100644 --- a/drivers/tdisp/HD44780/tdisp_lld.c +++ b/drivers/tdisp/HD44780/tdisp_lld.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/tdisp/HD44780/tdisp_lld_board_example.h b/drivers/tdisp/HD44780/tdisp_lld_board_example.h index f37bf2cb..6a1455e3 100644 --- a/drivers/tdisp/HD44780/tdisp_lld_board_example.h +++ b/drivers/tdisp/HD44780/tdisp_lld_board_example.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h b/drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h index 7b1789cf..f97ff409 100644 --- a/drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h +++ b/drivers/tdisp/HD44780/tdisp_lld_board_olimex_e407.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h b/drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h index 4b7dfacb..a46c7c15 100644 --- a/drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h +++ b/drivers/tdisp/HD44780/tdisp_lld_board_st_stm32f4_discovery.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gadc/gadc.h b/include/gadc/gadc.h index 6da63a15..ce2ad658 100644 --- a/include/gadc/gadc.h +++ b/include/gadc/gadc.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gadc/lld/gadc_lld.h b/include/gadc/lld/gadc_lld.h index a2f4822c..5c0b4a3b 100644 --- a/include/gadc/lld/gadc_lld.h +++ b/include/gadc/lld/gadc_lld.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gadc/options.h b/include/gadc/options.h index c83a71bf..4c83fa5c 100644 --- a/include/gadc/options.h +++ b/include/gadc/options.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gaudin/gaudin.h b/include/gaudin/gaudin.h index 7175f631..3e6f9fe3 100644 --- a/include/gaudin/gaudin.h +++ b/include/gaudin/gaudin.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gaudin/lld/gaudin_lld.h b/include/gaudin/lld/gaudin_lld.h index 6a9e34c1..77357ccf 100644 --- a/include/gaudin/lld/gaudin_lld.h +++ b/include/gaudin/lld/gaudin_lld.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gaudin/options.h b/include/gaudin/options.h index 95f75f09..489ec304 100644 --- a/include/gaudin/options.h +++ b/include/gaudin/options.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file include/gaudin/options.h diff --git a/include/gaudout/gaudout.h b/include/gaudout/gaudout.h index ef60eeb0..7d096ba7 100644 --- a/include/gaudout/gaudout.h +++ b/include/gaudout/gaudout.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gaudout/options.h b/include/gaudout/options.h index 26337fab..346f9bb9 100644 --- a/include/gaudout/options.h +++ b/include/gaudout/options.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file include/gaudout/options.h diff --git a/include/gdisp/fonts.h b/include/gdisp/fonts.h index 881b90ad..2a0db5d0 100644 --- a/include/gdisp/fonts.h +++ b/include/gdisp/fonts.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gdisp/gdisp.h b/include/gdisp/gdisp.h index c005f1e3..f7208b00 100644 --- a/include/gdisp/gdisp.h +++ b/include/gdisp/gdisp.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gdisp/image.h b/include/gdisp/image.h index 5dcd9c56..696500a6 100644 --- a/include/gdisp/image.h +++ b/include/gdisp/image.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gdisp/lld/emulation.c b/include/gdisp/lld/emulation.c index ac97b515..c64f8259 100644 --- a/include/gdisp/lld/emulation.c +++ b/include/gdisp/lld/emulation.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gdisp/lld/gdisp_lld.h b/include/gdisp/lld/gdisp_lld.h index fa4c1c63..faeee858 100644 --- a/include/gdisp/lld/gdisp_lld.h +++ b/include/gdisp/lld/gdisp_lld.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gdisp/lld/gdisp_lld_msgs.h b/include/gdisp/lld/gdisp_lld_msgs.h index 91d8ed97..4c91d880 100644 --- a/include/gdisp/lld/gdisp_lld_msgs.h +++ b/include/gdisp/lld/gdisp_lld_msgs.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gdisp/options.h b/include/gdisp/options.h index 0873a956..48b96aa1 100644 --- a/include/gdisp/options.h +++ b/include/gdisp/options.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gevent/gevent.h b/include/gevent/gevent.h index 59557991..b0039849 100644 --- a/include/gevent/gevent.h +++ b/include/gevent/gevent.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gevent/options.h b/include/gevent/options.h index 4f841492..02a7c60b 100644 --- a/include/gevent/options.h +++ b/include/gevent/options.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gfx.h b/include/gfx.h index 7c82243b..24cc4ac4 100644 --- a/include/gfx.h +++ b/include/gfx.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gfx_rules.h b/include/gfx_rules.h index 6c0dc756..dfabe728 100644 --- a/include/gfx_rules.h +++ b/include/gfx_rules.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/ginput/dial.h b/include/ginput/dial.h index 8b4f9d3c..38568994 100644 --- a/include/ginput/dial.h +++ b/include/ginput/dial.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/ginput/ginput.h b/include/ginput/ginput.h index be998c4e..610ec45b 100644 --- a/include/ginput/ginput.h +++ b/include/ginput/ginput.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/ginput/keyboard.h b/include/ginput/keyboard.h index add2eff7..b9c902f6 100644 --- a/include/ginput/keyboard.h +++ b/include/ginput/keyboard.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/ginput/lld/dial.h b/include/ginput/lld/dial.h index 7c16851f..09013af7 100644 --- a/include/ginput/lld/dial.h +++ b/include/ginput/lld/dial.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/ginput/lld/mouse.h b/include/ginput/lld/mouse.h index a9e755c4..0aea6bb4 100644 --- a/include/ginput/lld/mouse.h +++ b/include/ginput/lld/mouse.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/ginput/lld/toggle.h b/include/ginput/lld/toggle.h index 8db4bea6..02bc5eb7 100644 --- a/include/ginput/lld/toggle.h +++ b/include/ginput/lld/toggle.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/ginput/mouse.h b/include/ginput/mouse.h index 011372c4..a67812eb 100644 --- a/include/ginput/mouse.h +++ b/include/ginput/mouse.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/ginput/options.h b/include/ginput/options.h index 2f7938e2..bdbaca30 100644 --- a/include/ginput/options.h +++ b/include/ginput/options.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file include/ginput/options.h diff --git a/include/ginput/toggle.h b/include/ginput/toggle.h index ee3d8420..d9b848d3 100644 --- a/include/ginput/toggle.h +++ b/include/ginput/toggle.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gmisc/gmisc.h b/include/gmisc/gmisc.h index 21eb2bbe..4bebc984 100644 --- a/include/gmisc/gmisc.h +++ b/include/gmisc/gmisc.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gmisc/options.h b/include/gmisc/options.h index 5a2f68ea..fe8288ae 100644 --- a/include/gmisc/options.h +++ b/include/gmisc/options.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gos/chibios.h b/include/gos/chibios.h index 280a9a45..5193d506 100644 --- a/include/gos/chibios.h +++ b/include/gos/chibios.h @@ -1,22 +1,10 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ /** * @file include/gos/chibios.h * @brief GOS - Operating System Support header file for ChibiOS. diff --git a/include/gos/gos.h b/include/gos/gos.h index 177349cf..fe45ce60 100644 --- a/include/gos/gos.h +++ b/include/gos/gos.h @@ -1,22 +1,10 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ /** * @file include/gos/gos.h * @brief GOS - Operating System Support header file. diff --git a/include/gos/options.h b/include/gos/options.h index f9d41bb5..2ac15926 100644 --- a/include/gos/options.h +++ b/include/gos/options.h @@ -1,22 +1,9 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file include/gos/options.h diff --git a/include/gos/posix.h b/include/gos/posix.h index f61b13db..f81fb26b 100644 --- a/include/gos/posix.h +++ b/include/gos/posix.h @@ -1,22 +1,10 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ /** * @file include/gos/posix.h * @brief GOS - Operating System Support header file for POSIX. diff --git a/include/gos/win32.h b/include/gos/win32.h index d61de187..fbb45d9b 100644 --- a/include/gos/win32.h +++ b/include/gos/win32.h @@ -1,22 +1,10 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ /** * @file include/gos/win32.h * @brief GOS - Operating System Support header file for WIN32. diff --git a/include/gqueue/gqueue.h b/include/gqueue/gqueue.h index 399042d9..8ec3c9b9 100644 --- a/include/gqueue/gqueue.h +++ b/include/gqueue/gqueue.h @@ -1,22 +1,10 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ /** * @file include/gqueue/gqueue.h * @brief GQUEUE header file. diff --git a/include/gqueue/options.h b/include/gqueue/options.h index 30ccdb46..b9103a6b 100644 --- a/include/gqueue/options.h +++ b/include/gqueue/options.h @@ -1,22 +1,9 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file include/gqueue/options.h diff --git a/include/gtimer/gtimer.h b/include/gtimer/gtimer.h index 5ad8c7c0..494cc201 100644 --- a/include/gtimer/gtimer.h +++ b/include/gtimer/gtimer.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gtimer/options.h b/include/gtimer/options.h index 7fb0d280..1f52a46e 100644 --- a/include/gtimer/options.h +++ b/include/gtimer/options.h @@ -1,9 +1,9 @@ -/* - * This file is subject to the terms of the GFX License, v1.0. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file include/gtimer/options.h diff --git a/include/gwin/button.h b/include/gwin/button.h index 20fd6df7..21de74bd 100644 --- a/include/gwin/button.h +++ b/include/gwin/button.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gwin/checkbox.h b/include/gwin/checkbox.h index 6f151218..4a5e032a 100644 --- a/include/gwin/checkbox.h +++ b/include/gwin/checkbox.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gwin/class_gwin.h b/include/gwin/class_gwin.h index 1c640c0c..eda69e1e 100644 --- a/include/gwin/class_gwin.h +++ b/include/gwin/class_gwin.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gwin/console.h b/include/gwin/console.h index 349efeb8..5682113e 100644 --- a/include/gwin/console.h +++ b/include/gwin/console.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gwin/graph.h b/include/gwin/graph.h index f1ea9450..2595d2e7 100644 --- a/include/gwin/graph.h +++ b/include/gwin/graph.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gwin/gwidget.h b/include/gwin/gwidget.h index a022ab13..0c47dfde 100644 --- a/include/gwin/gwidget.h +++ b/include/gwin/gwidget.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index 96d7be97..efce49fc 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gwin/options.h b/include/gwin/options.h index db4ae69b..cc164259 100644 --- a/include/gwin/options.h +++ b/include/gwin/options.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/gwin/slider.h b/include/gwin/slider.h index 45618114..9baecbb1 100644 --- a/include/gwin/slider.h +++ b/include/gwin/slider.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/tdisp/lld/tdisp_lld.h b/include/tdisp/lld/tdisp_lld.h index a71ef76f..65b5c38d 100644 --- a/include/tdisp/lld/tdisp_lld.h +++ b/include/tdisp/lld/tdisp_lld.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/tdisp/options.h b/include/tdisp/options.h index 3ebf686d..609eccf6 100644 --- a/include/tdisp/options.h +++ b/include/tdisp/options.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/include/tdisp/tdisp.h b/include/tdisp/tdisp.h index 4e2dfd92..c05d574f 100644 --- a/include/tdisp/tdisp.h +++ b/include/tdisp/tdisp.h @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gadc/gadc.c b/src/gadc/gadc.c index 36f4db6d..f3d99c85 100644 --- a/src/gadc/gadc.c +++ b/src/gadc/gadc.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gaudin/gaudin.c b/src/gaudin/gaudin.c index 2e87c628..270cd26e 100644 --- a/src/gaudin/gaudin.c +++ b/src/gaudin/gaudin.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gaudout/gaudout.c b/src/gaudout/gaudout.c index b418b158..4f8ac759 100644 --- a/src/gaudout/gaudout.c +++ b/src/gaudout/gaudout.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gdisp/fonts.c b/src/gdisp/fonts.c index 175828c6..6c73216c 100644 --- a/src/gdisp/fonts.c +++ b/src/gdisp/fonts.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c index 9ba85d82..1b16ac53 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gdisp/image.c b/src/gdisp/image.c index 50b641b6..fec05147 100644 --- a/src/gdisp/image.c +++ b/src/gdisp/image.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gdisp/image_bmp.c b/src/gdisp/image_bmp.c index 51d1ce91..e54ad5e4 100644 --- a/src/gdisp/image_bmp.c +++ b/src/gdisp/image_bmp.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gdisp/image_gif.c b/src/gdisp/image_gif.c index e8f4f422..3de47d03 100644 --- a/src/gdisp/image_gif.c +++ b/src/gdisp/image_gif.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gdisp/image_jpg.c b/src/gdisp/image_jpg.c index 3a51ea5f..9ffd4b31 100644 --- a/src/gdisp/image_jpg.c +++ b/src/gdisp/image_jpg.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gdisp/image_native.c b/src/gdisp/image_native.c index 8cc15817..694518c6 100644 --- a/src/gdisp/image_native.c +++ b/src/gdisp/image_native.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gdisp/image_png.c b/src/gdisp/image_png.c index 76e8f652..183b0734 100644 --- a/src/gdisp/image_png.c +++ b/src/gdisp/image_png.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gevent/gevent.c b/src/gevent/gevent.c index d83fa4d8..d73a574f 100644 --- a/src/gevent/gevent.c +++ b/src/gevent/gevent.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gfx.c b/src/gfx.c index 3856eea3..1791ef89 100644 --- a/src/gfx.c +++ b/src/gfx.c @@ -1,22 +1,9 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file src/gfx.c diff --git a/src/ginput/dial.c b/src/ginput/dial.c index 2e52c224..d978aa65 100644 --- a/src/ginput/dial.c +++ b/src/ginput/dial.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/ginput/ginput.c b/src/ginput/ginput.c index 96fa1449..4f2e72b0 100644 --- a/src/ginput/ginput.c +++ b/src/ginput/ginput.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/ginput/keyboard.c b/src/ginput/keyboard.c index 99aa90e8..a0f1f2cb 100644 --- a/src/ginput/keyboard.c +++ b/src/ginput/keyboard.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/ginput/mouse.c b/src/ginput/mouse.c index 334fdb6c..11b358f9 100644 --- a/src/ginput/mouse.c +++ b/src/ginput/mouse.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/ginput/toggle.c b/src/ginput/toggle.c index 2784a6ef..fdbfb8ce 100644 --- a/src/ginput/toggle.c +++ b/src/ginput/toggle.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gmisc/arrayops.c b/src/gmisc/arrayops.c index 460387f6..d433437e 100644 --- a/src/gmisc/arrayops.c +++ b/src/gmisc/arrayops.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gmisc/trig.c b/src/gmisc/trig.c index 2cd90a53..e49a4c22 100644 --- a/src/gmisc/trig.c +++ b/src/gmisc/trig.c @@ -1,22 +1,9 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file src/gmisc/trig.c diff --git a/src/gos/chibios.c b/src/gos/chibios.c index 40e176ce..6ce06d94 100644 --- a/src/gos/chibios.c +++ b/src/gos/chibios.c @@ -1,22 +1,9 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file src/gos/chibios.c diff --git a/src/gos/posix.c b/src/gos/posix.c index 9f6fe430..19a02560 100644 --- a/src/gos/posix.c +++ b/src/gos/posix.c @@ -1,22 +1,9 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file src/gos/chibios.c diff --git a/src/gos/win32.c b/src/gos/win32.c index a1c5abcd..02ba1b67 100644 --- a/src/gos/win32.c +++ b/src/gos/win32.c @@ -1,22 +1,9 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu - - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ /** * @file src/gos/chibios.c diff --git a/src/gqueue/gqueue.c b/src/gqueue/gqueue.c index 002378b3..beb42a2e 100644 --- a/src/gqueue/gqueue.c +++ b/src/gqueue/gqueue.c @@ -1,22 +1,10 @@ /* - ChibiOS/GFX - Copyright (C) 2012, 2013 - Joel Bodenmann aka Tectu + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ - This file is part of ChibiOS/GFX. - - ChibiOS/GFX is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 3 of the License, or - (at your option) any later version. - - ChibiOS/GFX is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . -*/ /** * @file src/gqueue/gqueue.c * @brief GQUEUE source file. diff --git a/src/gtimer/gtimer.c b/src/gtimer/gtimer.c index 1de1ce45..3eedc952 100644 --- a/src/gtimer/gtimer.c +++ b/src/gtimer/gtimer.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gwin/button.c b/src/gwin/button.c index 285a406c..fc432cb4 100644 --- a/src/gwin/button.c +++ b/src/gwin/button.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gwin/checkbox.c b/src/gwin/checkbox.c index 53e99e42..0282df42 100644 --- a/src/gwin/checkbox.c +++ b/src/gwin/checkbox.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gwin/console.c b/src/gwin/console.c index 6941295a..38e2ea8b 100644 --- a/src/gwin/console.c +++ b/src/gwin/console.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gwin/graph.c b/src/gwin/graph.c index 264c0c2c..708b90cb 100644 --- a/src/gwin/graph.c +++ b/src/gwin/graph.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c index ee7986d1..9d634c58 100644 --- a/src/gwin/gwidget.c +++ b/src/gwin/gwidget.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 98e61c52..b918d297 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gwin/gwm.c b/src/gwin/gwm.c index bc561345..5a533c40 100644 --- a/src/gwin/gwm.c +++ b/src/gwin/gwm.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/gwin/slider.c b/src/gwin/slider.c index 343973a2..f2052524 100644 --- a/src/gwin/slider.c +++ b/src/gwin/slider.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/src/tdisp/tdisp.c b/src/tdisp/tdisp.c index 17451deb..56122f8c 100644 --- a/src/tdisp/tdisp.c +++ b/src/tdisp/tdisp.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html diff --git a/tools/file2c/src/file2c.c b/tools/file2c/src/file2c.c index 45724413..dca5375d 100644 --- a/tools/file2c/src/file2c.c +++ b/tools/file2c/src/file2c.c @@ -1,5 +1,5 @@ /* - * This file is subject to the terms of the GFX License, v1.0. If a copy of + * This file is subject to the terms of the GFX License. If a copy of * the license was not distributed with this file, you can obtain one at: * * http://chibios-gfx.com/license.html From a7c61175508396889bb9304fd47b830938d39691 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 15 Jun 2013 22:02:51 +1000 Subject: [PATCH 07/38] Updated license --- license.html | 44 ++++++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/license.html b/license.html index cac486b8..67bac607 100644 --- a/license.html +++ b/license.html @@ -2,7 +2,7 @@ - GFX License, version 1.0 + GFX License, version 1.1 @@ -67,7 +67,7 @@ -

GFX License
Version 1.0

+

GFX License
Version 1.1

1. Definitions

1.1. Works
@@ -76,7 +76,7 @@

means each individual or legal entity that creates, contributes to the creation of the Works.

1.3. Contribution

means Software of a particular Contributor that has been offered to form part of the Works.

-
1.4. Executable Form
+
1.4. Executable form

means any form of the Works other than Source Code Form.

1.5. Application

means a work or software that combines the Works with other material, in a separate file or files whether in executable format or in library format, as Software or on a device.

@@ -104,27 +104,28 @@

2. Non Commercial Use

-

2.1. Distribution of Source Form

-

If You distribute the Works in an Source Form then:

+

2.1. Distribution of source form

+

If You distribute the Works in an source form then:

  1. All distribution of the Works in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License; and

  2. You must inform recipients that the Source Code Form of the Works is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter the recipients rights in the Source Code Form; and

  3. Any modification to the Works must be contributed to the License Owners as per Section 4 prior to distribution; and

  4. -
  5. Source Code not forming part of the Works that are distributed in conjunction with the Works do not need to be contributed to the License Owners or use this License.

  6. +
  7. source code not forming part of the Works that are distributed in conjunction with the Works do not need to be contributed to the License Owners or use this License.

-

2.2. Distribution of Executable Form

-

If You distribute the Works in an Executable Form then:

+

Note: This means that you must contribute changes you make to the library, you do not need to contribute your application or any other code outside of GFX library itself.

+

2.2. Distribution of Executable form

+

If You distribute the Works in an Executable form then:

    -
  1. and You must inform recipients of the Executable Form that it contains the Works and how they can obtain a copy of the Works in Source Code Form from the License Owners master repository; and

  2. +
  3. and You must inform recipients of the Executable form that it contains the Works and how they can obtain a copy of the Works in Source Code Form from the License Owners master repository; and

  4. Any modification to the Works must be contributed to the License Owners as per Section 4 prior to distribution; and

  5. -
  6. You may distribute such Executable Form under the terms of this License, or license it under different terms, provided that the license for the Executable Form does not allow for Commercial Use of the Works or attempt to limit or alter the recipients' rights in the Source Code Form under this License.

  7. +
  8. You may distribute such Executable form under the terms of this License, or license it under different terms, provided that the license for the Executable form does not allow for Commercial Use of the Works or attempt to limit or alter the recipients' rights in the Source Code Form under this License.

3. Commercial Use

3.1. Commercial Use Agreement

A "Commercial Use Agreement" explicitly signed by the License Owner will override any specified terms of this License for the party to the agreement under the terms of the agreement. All other terms of this License will still apply.

3.2. Distribution

-

Other than as provided for in a signed "Commercial Use Agreement", where there is a Commercial Use involved or implied; you are not permitted to distribute the Works, in any form, either in Source Code or Executable Form, +

Other than as provided for in a signed "Commercial Use Agreement", where there is a Commercial Use involved or implied; you are not permitted to distribute the Works, in any form, either in source code or Executable form, either as software or on a device or in any other way.

4. Contributions

@@ -147,7 +148,10 @@

Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. Each Contributor accepts sole responsibility for the legal position of its Contribution and holds blameless the License Owners for such Contribution or any modification to it.

4.5. Deeming of Contributions

Each Contributor deems that by Contributing to the Works, through any method offered by the License Owners, irrespective of the license provided in the Contribution, is agreeing to the Contribution being licensed under this License with its Grants, Scope and Representation.

-

4.6. Additional Rights

+

4.6. Original Source Rights

+

By contributing to the Works, the Contributor is not removing their own copyright in their original work. The original work retains all existing copyrights and other rights, except the rights as described above have been granted to the license owners on the copy of the contribution as contributed.

+

This is equivelent to the "forking" of the contribution to two different licenses, one as part of the works (GFX) and the other as in its original form.

+

4.7. Additional Rights

A Contribution does not convey any extra distribution rights for the Contributor to the Works under this license.

@@ -175,14 +179,14 @@

If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the License Owner (except to note that such modified license differs from this License).

Exhibit A - Source Code Form License Notice

-
-/*
- * This file is subject to the terms of the GFX License, v1.0. If a copy of
- * the license was not distributed with this file, you can obtain one at:
- *
- *              http://chibios-gfx.com/license.html
- */
-
+
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ *              http://chibios-gfx.com/license.html
+ */
+

If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice.

From 8ed9e763c0f97f2946990a911bb940f8c80ff761 Mon Sep 17 00:00:00 2001 From: inmarket Date: Mon, 24 Jun 2013 22:58:37 +1000 Subject: [PATCH 08/38] GWIN reduce Initialisation parameters and fix visibility issues --- demos/modules/gwin/widgets/gfxconf.h | 2 +- demos/modules/gwin/widgets/main.c | 79 ++++++++++++++-------------- include/gwin/button.h | 9 +--- include/gwin/checkbox.h | 9 +--- include/gwin/class_gwin.h | 11 ++-- include/gwin/console.h | 11 ++-- include/gwin/graph.h | 8 +-- include/gwin/gwidget.h | 16 ++++++ include/gwin/gwin.h | 23 +++++--- include/gwin/slider.h | 9 +--- src/gwin/button.c | 6 ++- src/gwin/checkbox.c | 6 ++- src/gwin/console.c | 6 ++- src/gwin/graph.c | 6 ++- src/gwin/gwidget.c | 8 +-- src/gwin/gwin.c | 54 ++++++++++--------- src/gwin/gwm.c | 6 +-- src/gwin/slider.c | 6 ++- 18 files changed, 145 insertions(+), 130 deletions(-) diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index 5c862441..fb83f860 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -73,7 +73,7 @@ /* Features for the GWIN sub-system. */ #define GWIN_NEED_WINDOWMANAGER TRUE #define GWIN_NEED_CONSOLE TRUE -#define GWIN_NEED_GRAPH FALSE +#define GWIN_NEED_GRAPH TRUE #define GWIN_NEED_WIDGET TRUE #define GWIN_NEED_BUTTON TRUE #define GWIN_NEED_SLIDER TRUE diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index 33c288f4..70f64572 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -64,35 +64,47 @@ int main(void) { gwinAttachMouse(0); #endif - // Create out gwin windows/widgets - ghConsole = gwinCreateConsole(NULL, ScrWidth/2+1, ScrHeight/2+1, ScrWidth/2-1, ScrHeight/2-1); - ghButton1 = gwinCreateButton(NULL, 0+0*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); - ghButton2 = gwinCreateButton(NULL, 0+1*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); - ghButton3 = gwinCreateButton(NULL, 0+2*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); - ghButton4 = gwinCreateButton(NULL, 0+3*(BUTTON_WIDTH+1), 0, BUTTON_WIDTH, BUTTON_HEIGHT); - ghSlider1 = gwinCreateSlider(NULL, ScrWidth/2+1, ScrHeight/2-2*(SLIDER_WIDTH+1), ScrWidth/2-2, SLIDER_WIDTH); - ghSlider2 = gwinCreateSlider(NULL, ScrWidth/2+1, ScrHeight/2-1*(SLIDER_WIDTH+1), ScrWidth/2-2, SLIDER_WIDTH); - ghSlider3 = gwinCreateSlider(NULL, 0+0*(SLIDER_WIDTH+1), ScrHeight/2+1, SLIDER_WIDTH, ScrHeight/2-2); - ghSlider4 = gwinCreateSlider(NULL, 0+1*(SLIDER_WIDTH+1), ScrHeight/2+1, SLIDER_WIDTH, ScrHeight/2-2); - ghCheckbox1 = gwinCreateCheckbox(NULL, 0, BUTTON_HEIGHT+1, CHECKBOX_WIDTH, CHECKBOX_HEIGHT); - ghCheckbox2 = gwinCreateCheckbox(NULL, 0, BUTTON_HEIGHT+1+1*(CHECKBOX_HEIGHT+1), CHECKBOX_WIDTH, CHECKBOX_HEIGHT); + // Create the gwin windows/widgets + { + GWidgetInit wi; - // Color everything and set special drawing for some widgets - gwinSetColor(ghConsole, Yellow); - gwinSetBgColor(ghConsole, Black); - gwinSetCustomDraw(ghCheckbox2, gwinCheckboxDraw_CheckOnRight, 0); + wi.g.show = TRUE; - // Set the text on all the controls - gwinSetText(ghButton1, "B1", FALSE); - gwinSetText(ghButton2, "B2", FALSE); - gwinSetText(ghButton3, "B3", FALSE); - gwinSetText(ghButton4, "B4", FALSE); - gwinSetText(ghSlider1, "S1", FALSE); - gwinSetText(ghSlider2, "S2", FALSE); - gwinSetText(ghSlider3, "S3", FALSE); - gwinSetText(ghSlider4, "S4", FALSE); - gwinSetText(ghCheckbox1, "C1", FALSE); - gwinSetText(ghCheckbox2, "C2", FALSE); + // Buttons + wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT; wi.g.y = 0; + wi.g.x = 0+0*(BUTTON_WIDTH+1); wi.text = "B1"; ghButton1 = gwinCreateButton(NULL, &wi); + wi.g.x = 0+1*(BUTTON_WIDTH+1); wi.text = "B2"; ghButton2 = gwinCreateButton(NULL, &wi); + wi.g.x = 0+2*(BUTTON_WIDTH+1); wi.text = "B3"; ghButton3 = gwinCreateButton(NULL, &wi); + wi.g.x = 0+3*(BUTTON_WIDTH+1); wi.text = "B4"; ghButton4 = gwinCreateButton(NULL, &wi); + + // Horizontal Sliders + wi.g.width = ScrWidth/2-2; wi.g.height = SLIDER_WIDTH; wi.g.x = ScrWidth/2+1; + wi.g.y = ScrHeight/2-2*(SLIDER_WIDTH+1); wi.text = "S1"; ghSlider1 = gwinCreateSlider(NULL, &wi); + wi.g.y = ScrHeight/2-1*(SLIDER_WIDTH+1); wi.text = "S2"; ghSlider2 = gwinCreateSlider(NULL, &wi); + + // Vertical Sliders + wi.g.width = SLIDER_WIDTH; wi.g.height = ScrHeight/2-2; wi.g.y = ScrHeight/2+1; + wi.g.x = 0+0*(SLIDER_WIDTH+1); wi.text = "S3"; ghSlider3 = gwinCreateSlider(NULL, &wi); + wi.g.x = 0+1*(SLIDER_WIDTH+1); wi.text = "S4"; ghSlider4 = gwinCreateSlider(NULL, &wi); + + // Checkboxes - for the 2nd checkbox we apply special drawing before making it visible + wi.g.width = CHECKBOX_WIDTH; wi.g.height = CHECKBOX_HEIGHT; wi.g.x = 0; + wi.g.y = BUTTON_HEIGHT+1+0*(CHECKBOX_HEIGHT+1); wi.text = "C1"; ghCheckbox1 = gwinCreateCheckbox(NULL, &wi); + wi.g.show = FALSE; + wi.g.y = BUTTON_HEIGHT+1+1*(CHECKBOX_HEIGHT+1); wi.text = "C2"; ghCheckbox2 = gwinCreateCheckbox(NULL, &wi); + gwinSetCustomDraw(ghCheckbox2, gwinCheckboxDraw_CheckOnRight, 0); + gwinSetVisible(ghCheckbox2, TRUE); + + // Console - we apply some special colors before making it visible + wi.g.show = FALSE; + wi.g.width = ScrWidth/2-1; wi.g.height = ScrHeight/2-1; + wi.g.x = ScrWidth/2+1; wi.g.y = ScrHeight/2+1; + ghConsole = gwinCreateConsole(NULL, &wi.g); + gwinSetColor(ghConsole, Yellow); + gwinSetBgColor(ghConsole, Black); + gwinSetVisible(ghConsole, TRUE); + gwinClear(ghConsole); + } // Assign toggles and dials to the buttons & sliders etc. #if GINPUT_NEED_TOGGLE @@ -104,19 +116,6 @@ int main(void) { gwinAttachDial(ghSlider3, 0, 1); #endif - // Draw everything on the screen - gwinClear(ghConsole); - gwinSetVisible(ghButton1, TRUE); - gwinSetVisible(ghButton2, TRUE); - gwinSetVisible(ghButton3, TRUE); - gwinSetVisible(ghButton4, TRUE); - gwinSetVisible(ghSlider1, TRUE); - gwinSetVisible(ghSlider2, TRUE); - gwinSetVisible(ghSlider3, TRUE); - gwinSetVisible(ghSlider4, TRUE); - gwinSetVisible(ghCheckbox1, TRUE); - gwinSetVisible(ghCheckbox2, TRUE); - while(1) { // Get an Event pe = geventEventWait(&gl, TIME_INFINITE); diff --git a/include/gwin/button.h b/include/gwin/button.h index 21de74bd..a6b19333 100644 --- a/include/gwin/button.h +++ b/include/gwin/button.h @@ -70,26 +70,21 @@ extern "C" { * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] gb The GButtonObject structure to initialise. If this is NULL the structure is dynamically allocated. - * @param[in] x,y The screen co-ordinates for the top left corner of the window - * @param[in] width The width of the window - * @param[in] height The height of the window + * @param[in] pInit The initialisation parameters * * @note The drawing color and the background color get set to the current defaults. If you haven't called * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there * is no default font and text drawing operations will no nothing. - * @note The dimensions and position may be changed to fit on the real screen. * @note A button remembers its normal drawing state. If there is a window manager then it is automatically * redrawn if the window is moved or its visibility state is changed. - * @note The button is initially marked as invisible so that more properties can be set before display. - * Call @p gwinSetVisible() to display it when ready. * @note A button supports mouse and a toggle input. * @note When assigning a toggle, only one toggle is supported. If you try to assign more than one toggle it will * forget the previous toggle. When assigning a toggle the role parameter must be 0. * * @api */ -GHandle gwinCreateButton(GButtonObject *gb, coord_t x, coord_t y, coord_t width, coord_t height); +GHandle gwinCreateButton(GButtonObject *gb, GWidgetInit *pInit); /** * @brief Set the colors of a button. diff --git a/include/gwin/checkbox.h b/include/gwin/checkbox.h index 4a5e032a..9a19a2e1 100644 --- a/include/gwin/checkbox.h +++ b/include/gwin/checkbox.h @@ -59,26 +59,21 @@ typedef struct GCheckboxObject_t { * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] gb The GCheckboxObject structure to initialise. If this is NULL, the structure is dynamically allocated. - * @param[in] x,y The screen co-ordinates for the top left corner of the window - * @param[in] width The width of the window - * @param[in] height The height of the window + * @param[in] pInit The initialization parameters to use * * @note The drawing color and the background color get set to the current defaults. If you haven't called * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there * is no default font and text drawing operations will no nothing. - * @note The dimensions and position may be changed to fit on the real screen. * @note A checkbox remembers its normal drawing state. If there is a window manager then it is automatically * redrawn if the window is moved or its visibility state is changed. - * @note The checkbox is initially marked as invisible so that more properties can be set before display. - * Call @p gwinSetVisible() to display it when ready. * @note A checkbox supports mouse and a toggle input. * @note When assigning a toggle, only one toggle is supported. If you try to assign more than one toggle it will * forget the previous toggle. When assigning a toggle the role parameter must be 0. * * @api */ -GHandle gwinCreateCheckbox(GCheckboxObject *gb, coord_t x, coord_t y, coord_t width, coord_t height); +GHandle gwinCreateCheckbox(GCheckboxObject *gb, GWidgetInit *pInit); /** * @brief Get the state of a checkbox diff --git a/include/gwin/class_gwin.h b/include/gwin/class_gwin.h index eda69e1e..c3d2ee36 100644 --- a/include/gwin/class_gwin.h +++ b/include/gwin/class_gwin.h @@ -45,6 +45,7 @@ */ typedef struct gwinVMT { const char * classname; // @< The GWIN classname (mandatory) + size_t size; // @< The size of the class object void (*Destroy) (GWindowObject *gh); // @< The GWIN destroy function (optional) void (*Redraw) (GWindowObject *gh); // @< The GWIN redraw routine (optional) void (*AfterClear) (GWindowObject *gh); // @< The GWIN after-clear function (optional) @@ -116,7 +117,7 @@ typedef struct gwinVMT { typedef struct gwmVMT { void (*Init) (void); // @< The window manager has just been set as the current window manager void (*DeInit) (void); // @< The window manager has just been removed as the current window manager - bool_t (*Add) (GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h); // @< A window has been added + bool_t (*Add) (GHandle gh, GWindowInit *pInit); // @< A window has been added void (*Delete) (GHandle gh); // @< A window has been deleted void (*Visible) (GHandle gh); // @< A window has changed its visibility state void (*Redim) (GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h); // @< A window wants to be moved or resized @@ -139,15 +140,13 @@ extern "C" { * @brief Initialise (and allocate if necessary) the base GWIN object * * @param[in] pgw The GWindowObject structure. If NULL one is allocated from the heap - * @param[in] x, y The top left corner of the GWIN relative to the screen - * @param[in] w, h The width and height of the GWIN window - * @param[in] size The size of the GWIN object to allocate + * @param[in] pInit The user initialization parameters * @param[in] vmt The virtual method table for the GWIN object * @param[in] flags The default flags to use * * @notapi */ -GHandle _gwindowCreate(GWindowObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwinVMT *vmt, uint16_t flags); +GHandle _gwindowCreate(GWindowObject *pgw, GWindowInit *pInit, const gwinVMT *vmt, uint16_t flags); #if GWIN_NEED_WIDGET || defined(__DOXYGEN__) /** @@ -161,7 +160,7 @@ GHandle _gwindowCreate(GWindowObject *pgw, coord_t x, coord_t y, coord_t w, coor * * @notapi */ - GHandle _gwidgetCreate(GWidgetObject *pgw, coord_t x, coord_t y, coord_t w, coord_t h, size_t size, const gwidgetVMT *vmt); + GHandle _gwidgetCreate(GWidgetObject *pgw, GWidgetInit *pInit, const gwidgetVMT *vmt); /** * @brief Destroy the Widget object diff --git a/include/gwin/console.h b/include/gwin/console.h index 5682113e..38c88f63 100644 --- a/include/gwin/console.h +++ b/include/gwin/console.h @@ -51,23 +51,20 @@ extern "C" { * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] gc The GConsoleObject structure to initialise. If this is NULL the structure is dynamically allocated. - * @param[in] x,y The screen co-ordinates for the top left corner of the window - * @param[in] width The width of the window - * @param[in] height The height of the window + * @param[in] pInit The initialization parameters to use * * @note The drawing color and the background color get set to the current defaults. If you haven't called * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there * is no default font and text drawing operations will no nothing. - * @note The dimensions and position may be changed to fit on the real screen. - * @note On creation the window is marked as visible but is not automatically cleared. You may do that by calling @p gwinClear() - * (possibly after changing your background color) + * @note On creation even if the window is visible it is not automatically cleared. + * You may do that by calling @p gwinClear() (possibly after changing your background color) * @note A console does not save the drawing state. It is not automatically redrawn if the window is moved or * its visibility state is changed. * * @api */ -GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height); +GHandle gwinCreateConsole(GConsoleObject *gc, GWindowInit *pInit); #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM /** diff --git a/include/gwin/graph.h b/include/gwin/graph.h index 2595d2e7..5e6abee1 100644 --- a/include/gwin/graph.h +++ b/include/gwin/graph.h @@ -91,17 +91,13 @@ extern "C" { * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] gg The GGraphObject structure to initialise. If this is NULL the structure is dynamically allocated. - * @param[in] x,y The screen co-ordinates for the top left corner of the window - * @param[in] width The width of the window - * @param[in] height The height of the window + * @param[in] pInit The initialization parameters to use * * @note The drawing color and the background color get set to the current defaults. If you haven't called * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there * is no default font and text drawing operations will no nothing. * @note The dimensions and position may be changed to fit on the real screen. - * @note On creation the window is marked as visible but is not automatically cleared. You may do that by calling @p gwinClear() - * (possibly after changing your background color) * @note A graph does not save the drawing state. It is not automatically redrawn if the window is moved or * its visibility state is changed. * @note The coordinate system within the window for graphing operations (but not for any other drawing @@ -111,7 +107,7 @@ extern "C" { * * @api */ -GHandle gwinCreateGraph(GGraphObject *gg, coord_t x, coord_t y, coord_t width, coord_t height); +GHandle gwinCreateGraph(GGraphObject *gg, GWindowInit *pInit); /** * @brief Set the style of the graphing operations. diff --git a/include/gwin/gwidget.h b/include/gwin/gwidget.h index 0c47dfde..50f19193 100644 --- a/include/gwin/gwidget.h +++ b/include/gwin/gwidget.h @@ -52,6 +52,22 @@ typedef struct GWidgetObject { } GWidgetObject; /* @} */ +/** + * @brief The structure to initialise a widget. + * + * @note Some widgets may have extra parameters. + * @note The text element must be static string (not stack allocated). If you want to use + * a dynamic string (eg a stack allocated string) use NULL for this member and then call + * @p gwinSetText() with useAlloc set to TRUE. + * + * @{ + */ +typedef struct GWidgetInit { + GWindowInit g; // @< The GWIN initializer + const char * text; // @< The initial text +} GWidgetInit; +/* @} */ + /** * A comment/rant on the above structure: * We would really like the GWindowObject member to be anonymous. While this is diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index efce49fc..2a03c125 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -49,6 +49,21 @@ typedef struct GWindowObject { } GWindowObject, * GHandle; /* @} */ +/** + * @brief The structure to initialise a GWIN. + * + * @note Some gwin's will need extra parameters. + * @note The dimensions and position may be changed to fit on the real screen. + * + * @{ + */ +typedef struct GWindowInit { + coord_t x, y; // @< The initial screen position + coord_t width, height; // @< The initial dimension + bool_t show; // @< Should the window be visible initially +} GWindowInit; +/* @} */ + /** * @brief A window's minimized, maximized or normal size */ @@ -128,22 +143,18 @@ extern "C" { * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] pgw The window structure to initialize. If this is NULL the structure is dynamically allocated. - * @param[in] x,y The screen coordinates for the top left corner of the window - * @param[in] width The width of the window - * @param[in] height The height of the window + * @param[in] pInit How to initialise the window * * @note The drawing color and the background color get set to the current defaults. If you haven't called * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there * is no default font and text drawing operations will no nothing. - * @note The dimensions and position may be changed to fit on the real screen. - * @note On creation the window is marked as visible. * @note A basic window does not save the drawing state. It is not automatically redrawn if the window is moved or * its visibility state is changed. * * @api */ - GHandle gwinCreateWindow(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height); + GHandle gwinCreateWindow(GWindowObject *pgw, GWindowInit *pInit); /** * @brief Destroy a window (of any type). Releases any dynamically allocated memory. diff --git a/include/gwin/slider.h b/include/gwin/slider.h index 9baecbb1..4479950f 100644 --- a/include/gwin/slider.h +++ b/include/gwin/slider.h @@ -64,19 +64,14 @@ extern "C" { * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] gb The GSliderObject structure to initialise. If this is NULL the structure is dynamically allocated. - * @param[in] x,y The screen co-ordinates for the top left corner of the window - * @param[in] width The width of the window - * @param[in] height The height of the window + * @param[in] pInit The initialization parameters to use * * @note The drawing color and the background color get set to the current defaults. If you haven't called * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there * is no default font and text drawing operations will no nothing. - * @note The dimensions and position may be changed to fit on the real screen. * @note A slider remembers its normal drawing state. If there is a window manager then it is automatically * redrawn if the window is moved or its visibility state is changed. - * @note The slider is initially marked as invisible so that more properties can be set before display. - * Call @p gwinSetVisible() to display it when ready. * @note The initial slider range is from 0 to 100 with an initial position of 0. * @note A slider supports mouse, toggle and dial input. * @note When assigning a toggle, only one toggle is supported per role. If you try to assign more than @@ -87,7 +82,7 @@ extern "C" { * * @api */ -GHandle gwinCreateSlider(GSliderObject *gb, coord_t x, coord_t y, coord_t width, coord_t height); +GHandle gwinCreateSlider(GSliderObject *gb, GWidgetInit *pInit); /** * @brief Set the slider range. diff --git a/src/gwin/button.c b/src/gwin/button.c index fc432cb4..4f823aa6 100644 --- a/src/gwin/button.c +++ b/src/gwin/button.c @@ -41,6 +41,7 @@ static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role); static const gwidgetVMT buttonVMT = { { "Button", // The classname + sizeof(GButtonObject), // The object size _gwidgetDestroy, // The destroy routine _gwidgetRedraw, // The redraw routine 0, // The after-clear routine @@ -150,14 +151,15 @@ static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { return ((GButtonObject *)gw)->toggle; } -GHandle gwinCreateButton(GButtonObject *gw, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gw = (GButtonObject *)_gwidgetCreate((GWidgetObject *)gw, x, y, width, height, sizeof(GButtonObject), &buttonVMT))) +GHandle gwinCreateButton(GButtonObject *gw, GWidgetInit *pInit) { + if (!(gw = (GButtonObject *)_gwidgetCreate(&gw->w, pInit, &buttonVMT))) return 0; gw->toggle = GWIDGET_NO_INSTANCE; gw->c_up = GButtonDefaultColorsUp; gw->c_dn = GButtonDefaultColorsDown; gw->c_dis = GButtonDefaultColorsDisabled; + gwinSetVisible((GHandle)gw, pInit->g.show); return (GHandle)gw; } diff --git a/src/gwin/checkbox.c b/src/gwin/checkbox.c index 0282df42..b4628ae0 100644 --- a/src/gwin/checkbox.c +++ b/src/gwin/checkbox.c @@ -34,6 +34,7 @@ static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role); static const gwidgetVMT checkboxVMT = { { "Checkbox", // The classname + sizeof(GCheckboxObject),// The object size _gwidgetDestroy, // The destroy routine _gwidgetRedraw, // The redraw routine 0, // The after-clear routine @@ -112,12 +113,13 @@ static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { return ((GCheckboxObject *)gw)->toggle; } -GHandle gwinCreateCheckbox(GCheckboxObject *gb, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gb = (GCheckboxObject *)_gwidgetCreate((GWidgetObject *)gb, x, y, width, height, sizeof(GCheckboxObject), &checkboxVMT))) +GHandle gwinCreateCheckbox(GCheckboxObject *gb, GWidgetInit *pInit) { + if (!(gb = (GCheckboxObject *)_gwidgetCreate(&gb->w, pInit, &checkboxVMT))) return 0; gb->toggle = (uint16_t) -1; gb->c = defaultColors; // assign the default colors + gwinSetVisible((GHandle)gb, pInit->g.show); return (GHandle)gb; } diff --git a/src/gwin/console.c b/src/gwin/console.c index 38e2ea8b..39e534b4 100644 --- a/src/gwin/console.c +++ b/src/gwin/console.c @@ -60,19 +60,21 @@ static void AfterClear(GWindowObject *gh) { static const gwinVMT consoleVMT = { "Console", // The classname + sizeof(GConsoleObject), // The object size 0, // The destroy routine 0, // The redraw routine AfterClear, // The after-clear routine }; -GHandle gwinCreateConsole(GConsoleObject *gc, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gc = (GConsoleObject *)_gwindowCreate((GWindowObject *)gc, x, y, width, height, sizeof(GConsoleObject), &consoleVMT, GWIN_FLG_VISIBLE))) +GHandle gwinCreateConsole(GConsoleObject *gc, GWindowInit *pInit) { + if (!(gc = (GConsoleObject *)_gwindowCreate(&gc->g, pInit, &consoleVMT, 0))) return 0; #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM gc->stream.vmt = &GWindowConsoleVMT; #endif gc->cx = 0; gc->cy = 0; + gwinSetVisible((GHandle)gc, pInit->show); return (GHandle)gc; } diff --git a/src/gwin/graph.c b/src/gwin/graph.c index 708b90cb..81ce1b5f 100644 --- a/src/gwin/graph.c +++ b/src/gwin/graph.c @@ -31,6 +31,7 @@ static const GGraphStyle GGraphDefaultStyle = { static const gwinVMT graphVMT = { "Graph", // The classname + sizeof(GGraphObject), // The object size 0, // The destroy routine 0, // The redraw routine 0, // The after-clear routine @@ -164,12 +165,13 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t } } -GHandle gwinCreateGraph(GGraphObject *gg, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gg = (GGraphObject *)_gwindowCreate((GWindowObject *)gg, x, y, width, height, sizeof(GGraphObject), &graphVMT, GWIN_FLG_VISIBLE))) +GHandle gwinCreateGraph(GGraphObject *gg, GWindowInit *pInit) { + if (!(gg = (GGraphObject *)_gwindowCreate(&gg->g, pInit, &graphVMT, 0))) return 0; gg->xorigin = gg->yorigin = 0; gg->lastx = gg->lasty = 0; gwinGraphSetStyle((GHandle)gg, &GGraphDefaultStyle); + gwinSetVisible((GHandle)gg, pInit->show); return (GHandle)gg; } diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c index 9d634c58..2825bf4c 100644 --- a/src/gwin/gwidget.c +++ b/src/gwin/gwidget.c @@ -165,15 +165,15 @@ void _gwidgetInit(void) { geventRegisterCallback(&gl, gwidgetEvent, 0); } -GHandle _gwidgetCreate(GWidgetObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size, const gwidgetVMT *vmt) { - if (!(pgw = (GWidgetObject *)_gwindowCreate((GWindowObject *)pgw, x, y, width, height, size, (const gwinVMT *)vmt, GWIN_FLG_WIDGET|GWIN_FLG_ENABLED))) +GHandle _gwidgetCreate(GWidgetObject *pgw, GWidgetInit *pInit, const gwidgetVMT *vmt) { + if (!(pgw = (GWidgetObject *)_gwindowCreate(&pgw->g, &pInit->g, &vmt->g, GWIN_FLG_WIDGET|GWIN_FLG_ENABLED))) return 0; - pgw->txt = ""; + pgw->txt = pInit->text ? pInit->text : ""; pgw->fnDraw = vmt->DefaultDraw; pgw->fnParam = 0; - return (GHandle)pgw; + return &pgw->g; } void _gwidgetDestroy(GHandle gh) { diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index b918d297..110d35cc 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -21,6 +21,7 @@ static const gwinVMT basegwinVMT = { "GWIN", // The classname + sizeof(GWindowObject), // The object size 0, // The destroy routine 0, // The redraw routine 0, // The after-clear routine @@ -51,17 +52,17 @@ static color_t defaultBgColor = Black; } else gwinClear(gh); } - static void _gwm_redim(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h) { - if (x < 0) { w += x; x = 0; } - if (y < 0) { h += y; y = 0; } - if (x > gdispGetWidth()-MIN_WIN_WIDTH) x = gdispGetWidth()-MIN_WIN_WIDTH; - if (y > gdispGetHeight()-MIN_WIN_HEIGHT) y = gdispGetHeight()-MIN_WIN_HEIGHT; - if (w < MIN_WIN_WIDTH) { w = MIN_WIN_WIDTH; } - if (h < MIN_WIN_HEIGHT) { h = MIN_WIN_HEIGHT; } - if (x+w > gdispGetWidth()) w = gdispGetWidth() - x; - if (y+h > gdispGetHeight()) h = gdispGetHeight() - y; - gh->x = x; gh->y = y; - gh->width = w; gh->height = h; + static void _gwm_redim(GHandle gh, GWindowInit *pInit) { + gh->x = pInit->x; gh->y = pInit->y; + gh->width = pInit->width; gh->height = pInit->height; + if (gh->x < 0) { gh->width += gh->x; gh->x = 0; } + if (gh->y < 0) { gh->height += gh->y; gh->y = 0; } + if (gh->x > gdispGetWidth()-MIN_WIN_WIDTH) gh->x = gdispGetWidth()-MIN_WIN_WIDTH; + if (gh->y > gdispGetHeight()-MIN_WIN_HEIGHT) gh->y = gdispGetHeight()-MIN_WIN_HEIGHT; + if (gh->width < MIN_WIN_WIDTH) { gh->width = MIN_WIN_WIDTH; } + if (gh->height < MIN_WIN_HEIGHT) { gh->height = MIN_WIN_HEIGHT; } + if (gh->x+gh->width > gdispGetWidth()) gh->width = gdispGetWidth() - gh->x; + if (gh->y+gh->height > gdispGetHeight()) gh->height = gdispGetHeight() - gh->y; } #endif @@ -84,10 +85,10 @@ void _gwinInit(void) { // Internal routine for use by GWIN components only // Initialise a window creating it dynamically if required. -GHandle _gwindowCreate(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height, size_t size, const gwinVMT *vmt, uint16_t flags) { +GHandle _gwindowCreate(GWindowObject *pgw, GWindowInit *pInit, const gwinVMT *vmt, uint16_t flags) { // Allocate the structure if necessary if (!pgw) { - if (!(pgw = (GWindowObject *)gfxAlloc(size))) + if (!(pgw = (GWindowObject *)gfxAlloc(vmt->size))) return 0; pgw->flags = flags|GWIN_FLG_DYNAMIC; } else @@ -101,17 +102,15 @@ GHandle _gwindowCreate(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, pgw->font = defaultFont; #endif - #if GWIN_NEED_WINDOWMANAGER - if (!cwm->vmt->Add(pgw, x, y, width, height)) { - if ((pgw->flags & GWIN_FLG_DYNAMIC)) - gfxFree(pgw); - return 0; - } - #else - _gwm_redim(pgw, x, y, width, height); - if ((pgw->flags & GWIN_FLG_VISIBLE)) - _gwm_vis(pgw); - #endif +#if GWIN_NEED_WINDOWMANAGER + if (!cwm->vmt->Add(pgw, pInit)) { + if ((pgw->flags & GWIN_FLG_DYNAMIC)) + gfxFree(pgw); + return 0; + } +#else + _gwm_redim(pgw, pInit->x, pInit->y, pInit->width, pInit->height); +#endif return (GHandle)pgw; } @@ -150,8 +149,11 @@ void gwinSetDefaultBgColor(color_t bgclr) { * The GWindow Routines *-----------------------------------------------*/ -GHandle gwinCreateWindow(GWindowObject *pgw, coord_t x, coord_t y, coord_t width, coord_t height) { - return _gwindowCreate(pgw, x, y, width, height, sizeof(GWindowObject), &basegwinVMT, GWIN_FLG_VISIBLE); +GHandle gwinCreateWindow(GWindowObject *pgw, GWindowInit *pInit) { + if (!(pgw = _gwindowCreate(pgw, pInit, &basegwinVMT, 0))) + return 0; + gwinSetVisible(pgw, pInit->show); + return pgw; } void gwinDestroy(GHandle gh) { diff --git a/src/gwin/gwm.c b/src/gwin/gwm.c index 5a533c40..c3405d83 100644 --- a/src/gwin/gwm.c +++ b/src/gwin/gwm.c @@ -25,7 +25,7 @@ static void WM_Init(void); static void WM_DeInit(void); -static bool_t WM_Add(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h); +static bool_t WM_Add(GHandle gh, GWindowInit *pInit); static void WM_Delete(GHandle gh); static void WM_Visible(GHandle gh); static void WM_Redim(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h); @@ -65,12 +65,12 @@ static void WM_DeInit(void) { // A full window manager would remove any borders etc } -static bool_t WM_Add(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h) { +static bool_t WM_Add(GHandle gh, GWindowInit *pInit) { // Put it on the queue gfxQueueASyncPut(&_GWINList, &gh->wmq); // Make sure the size is valid - WM_Redim(gh, x, y, w, h); + WM_Redim(gh, pInit->x, pInit->y, pInit->width, pInit->height); // Display it if it is visible WM_Visible(gh); diff --git a/src/gwin/slider.c b/src/gwin/slider.c index f2052524..08dd6ca7 100644 --- a/src/gwin/slider.c +++ b/src/gwin/slider.c @@ -43,6 +43,7 @@ static uint16_t DialGet(GWidgetObject *gw, uint16_t role); static const gwidgetVMT sliderVMT = { { "Slider", // The classname + sizeof(GSliderObject), // The object size _gwidgetDestroy, // The destroy routine _gwidgetRedraw, // The redraw routine 0, // The after-clear routine @@ -232,8 +233,8 @@ static uint16_t DialGet(GWidgetObject *gw, uint16_t role) { return ((GSliderObject *)gw)->dial; } -GHandle gwinCreateSlider(GSliderObject *gs, coord_t x, coord_t y, coord_t width, coord_t height) { - if (!(gs = (GSliderObject *)_gwidgetCreate((GWidgetObject *)gs, x, y, width, height, sizeof(GSliderObject), &sliderVMT))) +GHandle gwinCreateSlider(GSliderObject *gs, GWidgetInit *pInit) { + if (!(gs = (GSliderObject *)_gwidgetCreate(&gs->w, pInit, &sliderVMT))) return 0; gs->t_dn = (uint16_t) -1; gs->t_up = (uint16_t) -1; @@ -243,6 +244,7 @@ GHandle gwinCreateSlider(GSliderObject *gs, coord_t x, coord_t y, coord_t width, gs->max = 100; gs->pos = 0; ResetDisplayPos(gs); + gwinSetVisible((GHandle)gs, pInit->g.show); return (GHandle)gs; } From 775c05f3011dfcf34d137914d8b1785507edf057 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 1 Jul 2013 09:09:44 +0200 Subject: [PATCH 09/38] in /demos/modules/gwin/widgets disabled ginput toggle by default --- demos/modules/gwin/widgets/gfxconf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index fb83f860..fd217b0d 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -81,7 +81,7 @@ /* Features for the GINPUT sub-system. */ #define GINPUT_NEED_MOUSE TRUE -#define GINPUT_NEED_TOGGLE TRUE +#define GINPUT_NEED_TOGGLE FALSE #define GINPUT_NEED_DIAL FALSE #endif /* _GFXCONF_H */ From b8b149591f3b68d5f925a60e81ebc6c78f190e99 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 1 Jul 2013 09:10:47 +0200 Subject: [PATCH 10/38] readme fix --- demos/modules/gwin/widgets/readme.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/demos/modules/gwin/widgets/readme.txt b/demos/modules/gwin/widgets/readme.txt index 02d733e9..bb91e810 100644 --- a/demos/modules/gwin/widgets/readme.txt +++ b/demos/modules/gwin/widgets/readme.txt @@ -4,3 +4,7 @@ gfxconf.h Note that you will need to include the drivers into your project makefile for whichever inputs you decide to use. + +Note that you need to link to the math library. Add -lm to your +library paths in your Makefile. + From 57d3632e36fe2ab55589207a84c29544b15bd2c3 Mon Sep 17 00:00:00 2001 From: inmarket Date: Mon, 1 Jul 2013 17:34:13 +1000 Subject: [PATCH 11/38] GWIN Init structures are const (read-only to GWIN) --- include/gwin/button.h | 2 +- include/gwin/checkbox.h | 2 +- include/gwin/class_gwin.h | 10 ++++------ include/gwin/console.h | 2 +- include/gwin/graph.h | 2 +- include/gwin/gwidget.h | 4 ++-- include/gwin/gwin.h | 2 +- include/gwin/slider.h | 2 +- src/gwin/button.c | 2 +- src/gwin/checkbox.c | 2 +- src/gwin/console.c | 2 +- src/gwin/graph.c | 2 +- src/gwin/gwidget.c | 2 +- src/gwin/gwin.c | 6 +++--- src/gwin/slider.c | 2 +- 15 files changed, 21 insertions(+), 23 deletions(-) diff --git a/include/gwin/button.h b/include/gwin/button.h index a6b19333..73f42e37 100644 --- a/include/gwin/button.h +++ b/include/gwin/button.h @@ -84,7 +84,7 @@ extern "C" { * * @api */ -GHandle gwinCreateButton(GButtonObject *gb, GWidgetInit *pInit); +GHandle gwinCreateButton(GButtonObject *gb, const GWidgetInit *pInit); /** * @brief Set the colors of a button. diff --git a/include/gwin/checkbox.h b/include/gwin/checkbox.h index 9a19a2e1..2823007a 100644 --- a/include/gwin/checkbox.h +++ b/include/gwin/checkbox.h @@ -73,7 +73,7 @@ typedef struct GCheckboxObject_t { * * @api */ -GHandle gwinCreateCheckbox(GCheckboxObject *gb, GWidgetInit *pInit); +GHandle gwinCreateCheckbox(GCheckboxObject *gb, const GWidgetInit *pInit); /** * @brief Get the state of a checkbox diff --git a/include/gwin/class_gwin.h b/include/gwin/class_gwin.h index c3d2ee36..dbda3619 100644 --- a/include/gwin/class_gwin.h +++ b/include/gwin/class_gwin.h @@ -117,7 +117,7 @@ typedef struct gwinVMT { typedef struct gwmVMT { void (*Init) (void); // @< The window manager has just been set as the current window manager void (*DeInit) (void); // @< The window manager has just been removed as the current window manager - bool_t (*Add) (GHandle gh, GWindowInit *pInit); // @< A window has been added + bool_t (*Add) (GHandle gh, const GWindowInit *pInit); // @< A window has been added void (*Delete) (GHandle gh); // @< A window has been deleted void (*Visible) (GHandle gh); // @< A window has changed its visibility state void (*Redim) (GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h); // @< A window wants to be moved or resized @@ -146,21 +146,19 @@ extern "C" { * * @notapi */ -GHandle _gwindowCreate(GWindowObject *pgw, GWindowInit *pInit, const gwinVMT *vmt, uint16_t flags); +GHandle _gwindowCreate(GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, uint16_t flags); #if GWIN_NEED_WIDGET || defined(__DOXYGEN__) /** * @brief Initialise (and allocate if necessary) the base Widget object * * @param[in] pgw The GWidgetObject structure. If NULL one is allocated from the heap - * @param[in] x, y The top left corner of the Widget relative to the screen - * @param[in] w, h The width and height of the Widget window - * @param[in] size The size of the Widget object to allocate + * @param[in] pInit The user initialization parameters * @param[in] vmt The virtual method table for the Widget object * * @notapi */ - GHandle _gwidgetCreate(GWidgetObject *pgw, GWidgetInit *pInit, const gwidgetVMT *vmt); + GHandle _gwidgetCreate(GWidgetObject *pgw, const GWidgetInit *pInit, const gwidgetVMT *vmt); /** * @brief Destroy the Widget object diff --git a/include/gwin/console.h b/include/gwin/console.h index 38c88f63..a3b3697c 100644 --- a/include/gwin/console.h +++ b/include/gwin/console.h @@ -64,7 +64,7 @@ extern "C" { * * @api */ -GHandle gwinCreateConsole(GConsoleObject *gc, GWindowInit *pInit); +GHandle gwinCreateConsole(GConsoleObject *gc, const GWindowInit *pInit); #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM /** diff --git a/include/gwin/graph.h b/include/gwin/graph.h index 5e6abee1..b5fc1405 100644 --- a/include/gwin/graph.h +++ b/include/gwin/graph.h @@ -107,7 +107,7 @@ extern "C" { * * @api */ -GHandle gwinCreateGraph(GGraphObject *gg, GWindowInit *pInit); +GHandle gwinCreateGraph(GGraphObject *gg, const GWindowInit *pInit); /** * @brief Set the style of the graphing operations. diff --git a/include/gwin/gwidget.h b/include/gwin/gwidget.h index 50f19193..817f2b0d 100644 --- a/include/gwin/gwidget.h +++ b/include/gwin/gwidget.h @@ -23,7 +23,7 @@ * via an input device such as a mouse or toggle buttons. It is the * base class for widgets such as buttons and sliders. * - * @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h + * @pre GFX_USE_GWIN and GWIN_NEED_WIDGET must be set to TRUE in your gfxconf.h * @{ */ @@ -40,7 +40,7 @@ typedef void (*CustomWidgetDrawFunction)(struct GWidgetObject *gw, void *param); * @note A widget is a GWIN window that accepts user input. * It also has a number of other properties such as its ability * to redraw itself (a widget maintains drawing state). - * @note Do you access the members directly. Treat it as a black-box and use the method functions. + * @note Do not access the members directly. Treat it as a black-box and use the method functions. * * @{ */ diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index 2a03c125..3f620206 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -154,7 +154,7 @@ extern "C" { * * @api */ - GHandle gwinCreateWindow(GWindowObject *pgw, GWindowInit *pInit); + GHandle gwinCreateWindow(GWindowObject *pgw, const GWindowInit *pInit); /** * @brief Destroy a window (of any type). Releases any dynamically allocated memory. diff --git a/include/gwin/slider.h b/include/gwin/slider.h index 4479950f..57bd5a72 100644 --- a/include/gwin/slider.h +++ b/include/gwin/slider.h @@ -82,7 +82,7 @@ extern "C" { * * @api */ -GHandle gwinCreateSlider(GSliderObject *gb, GWidgetInit *pInit); +GHandle gwinCreateSlider(GSliderObject *gb, const GWidgetInit *pInit); /** * @brief Set the slider range. diff --git a/src/gwin/button.c b/src/gwin/button.c index 4f823aa6..303d1078 100644 --- a/src/gwin/button.c +++ b/src/gwin/button.c @@ -151,7 +151,7 @@ static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { return ((GButtonObject *)gw)->toggle; } -GHandle gwinCreateButton(GButtonObject *gw, GWidgetInit *pInit) { +GHandle gwinCreateButton(GButtonObject *gw, const GWidgetInit *pInit) { if (!(gw = (GButtonObject *)_gwidgetCreate(&gw->w, pInit, &buttonVMT))) return 0; diff --git a/src/gwin/checkbox.c b/src/gwin/checkbox.c index b4628ae0..62f4c55b 100644 --- a/src/gwin/checkbox.c +++ b/src/gwin/checkbox.c @@ -113,7 +113,7 @@ static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { return ((GCheckboxObject *)gw)->toggle; } -GHandle gwinCreateCheckbox(GCheckboxObject *gb, GWidgetInit *pInit) { +GHandle gwinCreateCheckbox(GCheckboxObject *gb, const GWidgetInit *pInit) { if (!(gb = (GCheckboxObject *)_gwidgetCreate(&gb->w, pInit, &checkboxVMT))) return 0; diff --git a/src/gwin/console.c b/src/gwin/console.c index 39e534b4..105cc79d 100644 --- a/src/gwin/console.c +++ b/src/gwin/console.c @@ -66,7 +66,7 @@ static const gwinVMT consoleVMT = { AfterClear, // The after-clear routine }; -GHandle gwinCreateConsole(GConsoleObject *gc, GWindowInit *pInit) { +GHandle gwinCreateConsole(GConsoleObject *gc, const GWindowInit *pInit) { if (!(gc = (GConsoleObject *)_gwindowCreate(&gc->g, pInit, &consoleVMT, 0))) return 0; #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM diff --git a/src/gwin/graph.c b/src/gwin/graph.c index 81ce1b5f..049f52e0 100644 --- a/src/gwin/graph.c +++ b/src/gwin/graph.c @@ -165,7 +165,7 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t } } -GHandle gwinCreateGraph(GGraphObject *gg, GWindowInit *pInit) { +GHandle gwinCreateGraph(GGraphObject *gg, const GWindowInit *pInit) { if (!(gg = (GGraphObject *)_gwindowCreate(&gg->g, pInit, &graphVMT, 0))) return 0; gg->xorigin = gg->yorigin = 0; diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c index 2825bf4c..a2b82f1d 100644 --- a/src/gwin/gwidget.c +++ b/src/gwin/gwidget.c @@ -165,7 +165,7 @@ void _gwidgetInit(void) { geventRegisterCallback(&gl, gwidgetEvent, 0); } -GHandle _gwidgetCreate(GWidgetObject *pgw, GWidgetInit *pInit, const gwidgetVMT *vmt) { +GHandle _gwidgetCreate(GWidgetObject *pgw, const GWidgetInit *pInit, const gwidgetVMT *vmt) { if (!(pgw = (GWidgetObject *)_gwindowCreate(&pgw->g, &pInit->g, &vmt->g, GWIN_FLG_WIDGET|GWIN_FLG_ENABLED))) return 0; diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 110d35cc..c1122b3f 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -52,7 +52,7 @@ static color_t defaultBgColor = Black; } else gwinClear(gh); } - static void _gwm_redim(GHandle gh, GWindowInit *pInit) { + static void _gwm_redim(GHandle gh, const GWindowInit *pInit) { gh->x = pInit->x; gh->y = pInit->y; gh->width = pInit->width; gh->height = pInit->height; if (gh->x < 0) { gh->width += gh->x; gh->x = 0; } @@ -85,7 +85,7 @@ void _gwinInit(void) { // Internal routine for use by GWIN components only // Initialise a window creating it dynamically if required. -GHandle _gwindowCreate(GWindowObject *pgw, GWindowInit *pInit, const gwinVMT *vmt, uint16_t flags) { +GHandle _gwindowCreate(GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, uint16_t flags) { // Allocate the structure if necessary if (!pgw) { if (!(pgw = (GWindowObject *)gfxAlloc(vmt->size))) @@ -149,7 +149,7 @@ void gwinSetDefaultBgColor(color_t bgclr) { * The GWindow Routines *-----------------------------------------------*/ -GHandle gwinCreateWindow(GWindowObject *pgw, GWindowInit *pInit) { +GHandle gwinCreateWindow(GWindowObject *pgw, const GWindowInit *pInit) { if (!(pgw = _gwindowCreate(pgw, pInit, &basegwinVMT, 0))) return 0; gwinSetVisible(pgw, pInit->show); diff --git a/src/gwin/slider.c b/src/gwin/slider.c index 08dd6ca7..2dfa3a7c 100644 --- a/src/gwin/slider.c +++ b/src/gwin/slider.c @@ -233,7 +233,7 @@ static uint16_t DialGet(GWidgetObject *gw, uint16_t role) { return ((GSliderObject *)gw)->dial; } -GHandle gwinCreateSlider(GSliderObject *gs, GWidgetInit *pInit) { +GHandle gwinCreateSlider(GSliderObject *gs, const GWidgetInit *pInit) { if (!(gs = (GSliderObject *)_gwidgetCreate(&gs->w, pInit, &sliderVMT))) return 0; gs->t_dn = (uint16_t) -1; From de27a6c2db6f5fb97b3a5d07395a629c879abfbc Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 1 Jul 2013 10:10:45 +0200 Subject: [PATCH 12/38] image widget implementation work in progress --- include/gwin/gwin.h | 5 ++++ include/gwin/image.h | 47 +++++++++++++++++++++++++++++++++ src/gwin/gwin.mk | 1 + src/gwin/image.c | 63 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 116 insertions(+) create mode 100644 include/gwin/image.h create mode 100644 src/gwin/image.c diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index 2a03c125..93cca142 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -746,10 +746,15 @@ extern "C" { #if GWIN_NEED_CONSOLE || defined(__DOXYGEN__) #include "gwin/console.h" #endif + #if GWIN_NEED_GRAPH || defined(__DOXYGEN__) #include "gwin/graph.h" #endif + #if GWIN_NEED_IMAGE || defined(__DOXYGEN__) + #include "gwin/image.h" + #endif + #endif /* GFX_USE_GWIN */ #endif /* _GWIN_H */ diff --git a/include/gwin/image.h b/include/gwin/image.h new file mode 100644 index 00000000..1626b15c --- /dev/null +++ b/include/gwin/image.h @@ -0,0 +1,47 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ + +/** + * @file include/gwin/image.h + * @brief GWIN image widget header file. + * + * @defgroup Image Image + * @ingroup GWIN + * + * @details GWIN allos it to create an image widget. The widget + * takes no user input. + * + * @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h + * @pre GWIN_NEED_IMAGE must be set to TRUE in your gfxconf.h + * + * @{ + */ + +#ifndef _GWIN_IMAGE_H +#define _GWIN_IMAGE_H + +// This file is included within "gwin/gwin.h" + +// An image window +typedef struct GImageWidget_t { + GWindowObject g; +} GImageWidget; + +#ifdef __cplusplus +extern "C" { +#endif + +GHandle gwinImageCreate(GImageWidget *widget, GWindowInit *pInit); +void gwinImageDisplay(GImageWidget *widget, gdispImage *image); + +#ifdef __cplusplus +} +#endif + +#endif // _GWIN_IMAGE_H +/** @} */ + diff --git a/src/gwin/gwin.mk b/src/gwin/gwin.mk index fb8fdfd1..9c114b3b 100644 --- a/src/gwin/gwin.mk +++ b/src/gwin/gwin.mk @@ -6,4 +6,5 @@ GFXSRC += $(GFXLIB)/src/gwin/gwin.c \ $(GFXLIB)/src/gwin/button.c \ $(GFXLIB)/src/gwin/slider.c \ $(GFXLIB)/src/gwin/checkbox.c \ + $(GFXLIB)/src/gwin/image.c \ diff --git a/src/gwin/image.c b/src/gwin/image.c new file mode 100644 index 00000000..35a0471d --- /dev/null +++ b/src/gwin/image.c @@ -0,0 +1,63 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ + +/** + * @file src/gwin/image.c + * @brief GWIN sub-system image code. + */ + +#include "gfx.h" + +#if GFX_USE_GWIN && GWIN_NEED_IMAGE + +#include "gwin/class_gwin.h" + +static void _destroy(GWindowObject *gh) { + (void)gh; + + return; +} + +static void _redraw(GWindowObject *gh) { + (void)gh; + + return; +} + +static void _afterClear(GWindowObject *gh) { + ((GImageWidget *)gh)->cx = 0; + ((GImageWidget *)gh)->cy = 0; + + return; +} + +static const gwinVMT imageVMT = { + "Image", // The class name + sizeof(GImageWidget), // The object size + _destroy, // The destroy routine + _redraw, // The redraw routine + _afterClear, // The after-clear routine +}; + +GHandle gwinImageCreate(GImageWidget *widget, GWindowInit *pInit) { + if (!(widget = (GImageWidget *)_gwindowCreate(&widget->g, pInit, &imageVMT, 0))) + return 0; + + widget->cx = 0; + widget->cy = 0; + gwinSetVisible((GHandle)widget, pInit->show); + + return (GHandle)widget; +} + +void gwinImageDisplay(GImageWidget *widget, gdispImage *image) { + +} + +#endif // GFX_USE_GWIN && GWIN_NEED_IMAGE +/** @} */ + From 6e59a6cf6ca75bf3ca72649f3f57e03e3e321c36 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 1 Jul 2013 17:40:31 +0200 Subject: [PATCH 13/38] image widget first release --- include/gwin/gwin.h | 29 --------------- include/gwin/image.h | 87 +++++++++++++++++++++++++++++++++++++++++++- src/gwin/gwin.c | 12 ------ src/gwin/image.c | 58 ++++++++++++++++++++++------- 4 files changed, 131 insertions(+), 55 deletions(-) diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index b4be6a83..16ce9cf5 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -700,35 +700,6 @@ extern "C" { void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); #endif -/*------------------------------------------------- - * Image functions - *-------------------------------------------------*/ - - #if GDISP_NEED_IMAGE || defined(__DOXYGEN__) - /** - * @brief Draw the image - * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. - * - * @param[in] gh The window handle - * @param[in] img The image structure - * @param[in] x,y The window location to draw the image - * @param[in] cx,cy The area on the screen to draw - * @param[in] sx,sy The image position to start drawing at - * - * @pre gdispImageOpen() must have returned successfully. - * - * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image - * is simply not drawn. - * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a - * fast blit from the cached frame. If not, it reads the input and decodes it as it - * is drawing. This may be significantly slower than if the image has been cached (but - * uses a lot less RAM) - * - * @api - */ - gdispImageError gwinImageDraw(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); - #endif - #ifdef __cplusplus } #endif diff --git a/include/gwin/image.h b/include/gwin/image.h index 1626b15c..1a8ada3d 100644 --- a/include/gwin/image.h +++ b/include/gwin/image.h @@ -15,8 +15,11 @@ * @details GWIN allos it to create an image widget. The widget * takes no user input. * + * @pre GFX_USE_GDISP must be set to TRUE in your gfxconf.h * @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h + * @pre GDISP_NEED_IMAGE must be set to TRUE in your gfxconf.h * @pre GWIN_NEED_IMAGE must be set to TRUE in your gfxconf.h + * @pre At least one image type must be enabled in your gfxconf.h * * @{ */ @@ -29,14 +32,96 @@ // An image window typedef struct GImageWidget_t { GWindowObject g; + + gdispImage *image; + color_t bgColor; } GImageWidget; #ifdef __cplusplus extern "C" { #endif +/** + * @brief Create an image widget. + * @details A console widget allows to display a picture. + * @return NULL if there is no resultant drawing area, otherwise the widget handle. + * + * @param[in] widget The image widget structure to initialise. If this is NULL, the structure is dynamically allocated. + * @param[in] pInit The initialization parameters to use. + * + * @note The default background color gets set to the current default one. + * @note An image widget does not save the current drawing state. It is not automatically redrawn if the window + * is moved or its visibility state is changed. + * + * @api + */ GHandle gwinImageCreate(GImageWidget *widget, GWindowInit *pInit); -void gwinImageDisplay(GImageWidget *widget, gdispImage *image); + +/** + * @brief Sets the sets the io fields in the image structure to routines that support reading from an image stored + * in RAM or flash. + * @return TRUE if the IO open function succeeds + * + * @param[in] gh The widget (must be an image widget) + * @param[in[ memory A pointer to the image in RAM or Flash + * + * @api + */ +bool_t gwinImageOpenMemory(GHandle gh, const void* memory); + +#if defined(WIN32) || GFX_USE_OS_WIN32 || GFX_USE_OS_POSIX || defined(__DOXYGEN__) + /** + * @brief Sets the sets the io fields in the image structure to routines that support reading from an image stored + * in a simulators native file system. + * @return TRUE if the IO open function succeeds + * + * @param[in] gh The widget (must be an image widget) + * @param[in[ memory The filename to open + * + * @api + */ + bool_t gwinImageOpenFile(GHandle gh, const char* filename); +#endif + +#if GFX_USE_OS_CHIBIOS || defined(__DOXYGEN__) + /** + * @brief Sets the sets the io fields in the image structure to routines that support reading from an image stored + * on a BaseFileStream (eg. an SD-Card). + * @return TRUE if the IO open function succeeds + * + * @param[in] gh The widget (must be an image widget) + * @param[in[ memory A pointer to the (open) BaseFileStream object. + * + * @api + */ + bool_t gwinImageOpenStream(GHandle gh, void *streamPtr); +#endif + +/** + * @brief Cache an image. + * @details Decodes and caches the current frame into RAM. + * + * param[in] gh The widget (must be an image widget) + * + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @api + */ +gdispImageError gwinImageCache(GHandle gh); + +/** + * @brief Set the background color of an image widget. + * @details Transparent images need a background color. If no background color has been set, the current default + * on is used. + * + * @param[in] gh The widget (must be an image widget) + * @param[in] bgColor The background color to be set + * + * @api + */ +void gwinImageSetBgColor(GHandle gh, color_t bgColor); + +void gwinImageDraw(GHandle gh); #ifdef __cplusplus } diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index c1122b3f..75f1b2d3 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -479,18 +479,6 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } #endif -#if GDISP_NEED_IMAGE - gdispImageError gwinImageDraw(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy) { - if (!((gh->flags & GWIN_FLG_VISIBLE))) - return GDISP_IMAGE_ERR_OK; - - #if GDISP_NEED_CLIP - gdispSetClip(gh->x, gh->y, gh->width, gh->height); - #endif - return gdispImageDraw(img, gh->x+x, gh->y+y, cx, cy, sx, sy); - } -#endif - #endif /* GFX_USE_GWIN */ /** @} */ diff --git a/src/gwin/image.c b/src/gwin/image.c index 35a0471d..64a27840 100644 --- a/src/gwin/image.c +++ b/src/gwin/image.c @@ -16,21 +16,17 @@ #include "gwin/class_gwin.h" +#define widget(gh) ((GImageWidget*)gh) + static void _destroy(GWindowObject *gh) { - (void)gh; - - return; -} - -static void _redraw(GWindowObject *gh) { - (void)gh; + if (gdispImageIsOpen(&widget(gh)->image)) + gdispImageClose(&widget(gh)->image); return; } static void _afterClear(GWindowObject *gh) { - ((GImageWidget *)gh)->cx = 0; - ((GImageWidget *)gh)->cy = 0; + (void)gh; return; } @@ -39,7 +35,7 @@ static const gwinVMT imageVMT = { "Image", // The class name sizeof(GImageWidget), // The object size _destroy, // The destroy routine - _redraw, // The redraw routine + 0, _afterClear, // The after-clear routine }; @@ -47,17 +43,53 @@ GHandle gwinImageCreate(GImageWidget *widget, GWindowInit *pInit) { if (!(widget = (GImageWidget *)_gwindowCreate(&widget->g, pInit, &imageVMT, 0))) return 0; - widget->cx = 0; - widget->cy = 0; + widget->image = gfxAlloc(sizeof(gdispImage)); + if (widget->image == NULL) + return 0; + + widget->g.x = pInit->x; + widget->g.y = pInit->y; + widget->g.width = pInit->width; + widget->g.height = pInit->height; + widget->bgColor = Black; gwinSetVisible((GHandle)widget, pInit->show); return (GHandle)widget; } -void gwinImageDisplay(GImageWidget *widget, gdispImage *image) { +bool_t gwinImageOpenMemory(GHandle gh, const void* memory) { + bool_t err; + err = gdispImageSetMemoryReader(widget(gh)->image, memory); + gdispImageOpen(widget(gh)->image); + + return err; } +#if defined(WIN32) || GFX_USE_OS_WIN32 || GFX_USE_OS_POSIX || defined(__DOXYGEN__) +bool_t gwinImageOpenFile(GHandle gh, const char* filename) { + return gdispImageSetFileReader(widget(gh)->image, filename); +} +#endif + +#if GFX_USE_OS_CHIBIOS || defined(__DOXYGEN__) +bool_t gwinImageOpenStream(GHandle gh, void *streamPtr) { + return gdispImageSetBaseFileStreamReader(widget(gh)->image, streamPtr); +} +#endif + +gdispImageError gwinImageCache(GHandle gh) { + return gdispImageCache(widget(gh)->image); +} + +void gwinImageSetBgColor(GHandle gh, color_t bgColor) { + widget(gh)->bgColor = bgColor; +} + +void gwinImageDraw(GHandle gh) { + gdispImageDraw(widget(gh)->image, widget(gh)->g.x, widget(gh)->g.y, widget(gh)->g.width, widget(gh)->g.height, 0, 0); +} + #endif // GFX_USE_GWIN && GWIN_NEED_IMAGE /** @} */ From b808db6af138c8ee9b643f4ec61d5841e61ef001 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 1 Jul 2013 17:42:31 +0200 Subject: [PATCH 14/38] image doxygen fix --- include/gwin/image.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/gwin/image.h b/include/gwin/image.h index 1a8ada3d..95a26687 100644 --- a/include/gwin/image.h +++ b/include/gwin/image.h @@ -63,7 +63,7 @@ GHandle gwinImageCreate(GImageWidget *widget, GWindowInit *pInit); * @return TRUE if the IO open function succeeds * * @param[in] gh The widget (must be an image widget) - * @param[in[ memory A pointer to the image in RAM or Flash + * @param[in] memory A pointer to the image in RAM or Flash * * @api */ @@ -76,7 +76,7 @@ bool_t gwinImageOpenMemory(GHandle gh, const void* memory); * @return TRUE if the IO open function succeeds * * @param[in] gh The widget (must be an image widget) - * @param[in[ memory The filename to open + * @param[in] filename The filename to open * * @api */ @@ -90,7 +90,7 @@ bool_t gwinImageOpenMemory(GHandle gh, const void* memory); * @return TRUE if the IO open function succeeds * * @param[in] gh The widget (must be an image widget) - * @param[in[ memory A pointer to the (open) BaseFileStream object. + * @param[in] streamPtr A pointer to the (open) BaseFileStream object. * * @api */ From 3cd10217dce976c6529aac184af94a03fcf63314 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 1 Jul 2013 17:49:57 +0200 Subject: [PATCH 15/38] small doxygen fixes --- Doxygenfile | 2 +- include/gwin/gwin.h | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Doxygenfile b/Doxygenfile index 57d8e3f1..15368ddd 100644 --- a/Doxygenfile +++ b/Doxygenfile @@ -1730,7 +1730,7 @@ DOT_NUM_THREADS = 0 # the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the # directory containing the font. -DOT_FONTNAME = FreeSans +DOT_FONTNAME = # The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. # The default size is 10pt. diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index 16ce9cf5..832dea96 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -105,7 +105,6 @@ extern "C" { /** * @brief Set the default foreground color for all new GWIN windows * - * @param[in] gh The window * @param[in] clr The color to be set * * @api @@ -115,7 +114,6 @@ extern "C" { /** * @brief Set the default background color for all new GWIN windows * - * @param[in] gh The window * @param[in] bgclr The background color * * @api @@ -126,7 +124,7 @@ extern "C" { /** * @brief Set the default font for all new GWIN windows * - * @param[in] gh The window + * @param[in] font The new font to be set * * @api */ From f188613d30977ac44f89e4eab9c5f9784169f576 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 1 Jul 2013 17:58:05 +0200 Subject: [PATCH 16/38] fixed image drawing boundries --- src/gwin/image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gwin/image.c b/src/gwin/image.c index 64a27840..bba92238 100644 --- a/src/gwin/image.c +++ b/src/gwin/image.c @@ -87,7 +87,7 @@ void gwinImageSetBgColor(GHandle gh, color_t bgColor) { } void gwinImageDraw(GHandle gh) { - gdispImageDraw(widget(gh)->image, widget(gh)->g.x, widget(gh)->g.y, widget(gh)->g.width, widget(gh)->g.height, 0, 0); + gdispImageDraw(widget(gh)->image, widget(gh)->g.x, widget(gh)->g.y, widget(gh)->image->width, widget(gh)->image->height, 0, 0); } #endif // GFX_USE_GWIN && GWIN_NEED_IMAGE From 931c46526521c5fd36856b1fc1990136d5f7f255 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Mon, 1 Jul 2013 19:53:58 +0200 Subject: [PATCH 17/38] GLabel work in progress --- include/gwin/gwin.h | 4 +++ include/gwin/label.h | 55 ++++++++++++++++++++++++++++++++++++ src/gwin/gwin.mk | 3 +- src/gwin/label.c | 67 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 include/gwin/label.h create mode 100644 src/gwin/label.c diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index 832dea96..10aabf6f 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -724,6 +724,10 @@ extern "C" { #include "gwin/image.h" #endif + #if GWIN_NEED_LABEL || defined(__DOXYGEN__) + #include "gwin/label.h" + #endif + #endif /* GFX_USE_GWIN */ #endif /* _GWIN_H */ diff --git a/include/gwin/label.h b/include/gwin/label.h new file mode 100644 index 00000000..3874026c --- /dev/null +++ b/include/gwin/label.h @@ -0,0 +1,55 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ + +/** + * @file include/gwin/label.h + * @brief GWIN label widget header file. + * + * @defgroup Label Label + * @ingroup GWIN + * + * @details GWIN allos it to create an label widget. The widget + * takes no user input. + * + * @pre GFX_USE_GDISP must be set to TRUE in your gfxconf.h + * @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h + * @pre GDISP_NEED_TEXT must be set to TRUE in your gfxconf.h + * @pre GWIN_NEED_LABEL must be set to TRUE in your gfxconf.h + * @pre The font you want to use must be enabled in your gfxconf.h + * + * @{ + */ + +#ifndef _GWIN_LABEL_H +#define _GWIN_LABEL_H + +// This file is included within "gwin/gwin.h" + +// An label window +typedef struct GLabelWidget_t { + GWindowObject g; + + char* text; +} GLabelWidget; + +#ifdef __cplusplus +extern "C" { +#endif + +GHandle gwinLabelCreate(GLabelWidget *widget, GWindowInit *pInit); +void gwinLabelSetColor(GHandle gh, color_t color); +void gwinLabelSetBgColor(GHandle gh, color_t bgColor); +void gwinLabelSetText(GHandle gh, char* text); +void gwinLabelDraw(GHandle gh); + +#ifdef __cplusplus +} +#endif + +#endif // _GWIN_LABEL_H +/** @} */ + diff --git a/src/gwin/gwin.mk b/src/gwin/gwin.mk index 9c114b3b..9a81728e 100644 --- a/src/gwin/gwin.mk +++ b/src/gwin/gwin.mk @@ -7,4 +7,5 @@ GFXSRC += $(GFXLIB)/src/gwin/gwin.c \ $(GFXLIB)/src/gwin/slider.c \ $(GFXLIB)/src/gwin/checkbox.c \ $(GFXLIB)/src/gwin/image.c \ - + $(GFXLIB)/src/gwin/label.c \ + diff --git a/src/gwin/label.c b/src/gwin/label.c new file mode 100644 index 00000000..e31a3de6 --- /dev/null +++ b/src/gwin/label.c @@ -0,0 +1,67 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ + +/** + * @file include/gwin/label.h + * @brief GWIN label widget header file. + * + * @defgroup Label Label + * @ingroup GWIN + * + * @{ + */ + +#include "gfx.h" + +#if GFX_USE_GWIN && GWIN_NEED_LABEL + +#include "gwin/class_gwin.h" + +#define widget(gh) ((GLabelWidget*)gh) + +static void _destroy(GWindowObject *gh) { + (void)gh; + + return; +} + +static void _redraw(GWindowObject *gh) { + (void)gh; + + return; +} + +static void _afterClear(GWindowObject *gh) { + (void)gh; + + return; +} + +GHandle gwinLabelCreate(GLabelWidget *widget, GWindowInit *pInit) { + +} + +void gwinLabelSetColor(GHandle gh, color_t color) { + widget(gh)->g.color = color; +} + +void gwinLabelSetBgColor(GHandle gh, color_t bgColor) { + widget(gh)->g.bgcolor = bgColor; +} + +void gwinLabelSetText(GHandle gh, char* text) { + widget(gh)->text = text; + + gwinLabelDraw(gh); +} + +void gwinLabelDraw(GHandle gh) { + +} + +#endif // GFX_USE_GWIN && GFX_NEED_LABEL + From ad57ab7967d0e0ee3cfce8746b0c4969cfe970fd Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Tue, 2 Jul 2013 08:29:38 +0200 Subject: [PATCH 18/38] wip --- include/gwin/label.h | 18 +++++++++++++++--- src/gwin/label.c | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/include/gwin/label.h b/include/gwin/label.h index 3874026c..ed774ed7 100644 --- a/include/gwin/label.h +++ b/include/gwin/label.h @@ -19,7 +19,7 @@ * @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h * @pre GDISP_NEED_TEXT must be set to TRUE in your gfxconf.h * @pre GWIN_NEED_LABEL must be set to TRUE in your gfxconf.h - * @pre The font you want to use must be enabled in your gfxconf.h + * @pre The fonts you want to use must be enabled in your gfxconf.h * * @{ */ @@ -33,17 +33,29 @@ typedef struct GLabelWidget_t { GWindowObject g; - char* text; + const char* text; } GLabelWidget; #ifdef __cplusplus extern "C" { #endif +/** + * @brief Create a label widget. + * @details A label widget is a simple window which has a static text. + * + * @param[in] widget The label structure to initialise. If this is NULL, the structure is dynamically allocated. + * @param[in] pinit The initialisation parameters to use. + * + * @return NULL if there is no resultat drawing area, otherwise the widget handle. + * + * @api + */ GHandle gwinLabelCreate(GLabelWidget *widget, GWindowInit *pInit); void gwinLabelSetColor(GHandle gh, color_t color); void gwinLabelSetBgColor(GHandle gh, color_t bgColor); -void gwinLabelSetText(GHandle gh, char* text); +void gwinLabelSetFont(GHandle gh, font_t font); +void gwinLabelSetText(GHandle gh, const char* text); void gwinLabelDraw(GHandle gh); #ifdef __cplusplus diff --git a/src/gwin/label.c b/src/gwin/label.c index e31a3de6..8c892217 100644 --- a/src/gwin/label.c +++ b/src/gwin/label.c @@ -41,8 +41,25 @@ static void _afterClear(GWindowObject *gh) { return; } -GHandle gwinLabelCreate(GLabelWidget *widget, GWindowInit *pInit) { +static const gwinVMT labelVMT = { + "Label", // The class name + sizeof(GLabelWidget), // The object size + _destroy, // The destroy routine + 0, // The redraw routine + _afterClear // The after-clear routine +}; +GHandle gwinLabelCreate(GLabelWidget *widget, GWindowInit *pInit) { + if (!(widget = (GLabelWidget *)_gwindowCreate(&widget->g, pInit, &labelVMT, 0))) + return 0; + + widget->g.x = pInit->x; + widget->g.y = pInit->y; + widget->g.width = pInit->width; + widget->g.height = pInit->height; + gwinSetVisible((GHandle)widget, pInit->show); + + return (GHandle)widget; } void gwinLabelSetColor(GHandle gh, color_t color) { @@ -53,14 +70,24 @@ void gwinLabelSetBgColor(GHandle gh, color_t bgColor) { widget(gh)->g.bgcolor = bgColor; } -void gwinLabelSetText(GHandle gh, char* text) { +void gwinLabelSetFont(GHandle gh, font_t font) { + widget(gh)->g.font = font; +} + +void gwinLabelSetText(GHandle gh, const char* text) { widget(gh)->text = text; gwinLabelDraw(gh); } void gwinLabelDraw(GHandle gh) { - + gdispFillString( widget(gh)->g.x, + widget(gh)->g.y, + widget(gh)->text, + widget(gh)->g.font, + widget(gh)->g.color, + widget(gh)->g.bgcolor + ); } #endif // GFX_USE_GWIN && GFX_NEED_LABEL From 3f80e1f89dbeec06dd97a914d6851ad4596b1743 Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Tue, 2 Jul 2013 19:26:48 +0200 Subject: [PATCH 19/38] label work in progress - not working anymore --- include/gevent/gevent.h | 2 +- include/gwin/gwin.h | 10 +++- include/gwin/label.h | 11 +--- include/gwin/options.h | 14 +++++ src/gwin/gwin.c | 4 ++ src/gwin/label.c | 120 +++++++++++++++++++++------------------- 6 files changed, 93 insertions(+), 68 deletions(-) diff --git a/include/gevent/gevent.h b/include/gevent/gevent.h index b0039849..5868f70f 100644 --- a/include/gevent/gevent.h +++ b/include/gevent/gevent.h @@ -48,7 +48,7 @@ typedef uint16_t GEventType; typedef union GEvent_u { GEventType type; // The type of this event char pad[GEVENT_MAXIMUM_SIZE]; // This is here to allow static initialisation of GEventObject's in the application. - } GEvent; +} GEvent; // A special callback function typedef void (*GEventCallbackFn)(void *param, GEvent *pe); diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index 10aabf6f..21d465b2 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -129,8 +129,16 @@ extern "C" { * @api */ void gwinSetDefaultFont(font_t font); - #endif + /** + * @brief Get the current default font + * + * @return The current default font + * + * @api + */ + font_t gwinGetDefaultFont(void); + #endif /*------------------------------------------------- * Base functions diff --git a/include/gwin/label.h b/include/gwin/label.h index ed774ed7..d387345d 100644 --- a/include/gwin/label.h +++ b/include/gwin/label.h @@ -31,9 +31,7 @@ // An label window typedef struct GLabelWidget_t { - GWindowObject g; - - const char* text; + GWidgetObject w; } GLabelWidget; #ifdef __cplusplus @@ -51,12 +49,7 @@ extern "C" { * * @api */ -GHandle gwinLabelCreate(GLabelWidget *widget, GWindowInit *pInit); -void gwinLabelSetColor(GHandle gh, color_t color); -void gwinLabelSetBgColor(GHandle gh, color_t bgColor); -void gwinLabelSetFont(GHandle gh, font_t font); -void gwinLabelSetText(GHandle gh, const char* text); -void gwinLabelDraw(GHandle gh); +GHandle gwinLabelCreate(GLabelWidget *widget, GWidgetInit *pInit); #ifdef __cplusplus } diff --git a/include/gwin/options.h b/include/gwin/options.h index cc164259..11ab7d44 100644 --- a/include/gwin/options.h +++ b/include/gwin/options.h @@ -69,6 +69,20 @@ #ifndef GWIN_NEED_CHECKBOX #define GWIN_NEED_CHECKBOX FALSE #endif + /** + * @brief Should image functions be included. + * @details Defaults to FALSE + */ + #ifndef GWIN_NEED_IMAGE + #define GWIN_NEED_IMAGE FALSE + #endif + /** + * @brief Should label functions be included. + * @details Defaults to FALSE + */ + #ifndef GWIN_NEED_LABEL + #define GWIN_NEED_LABEL FALSE + #endif /** * @} * diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 75f1b2d3..f080ac64 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -143,6 +143,10 @@ void gwinSetDefaultBgColor(color_t bgclr) { void gwinSetDefaultFont(font_t font) { defaultFont = font; } + + font_t gwinGetDefaultFont(void) { + return defaultFont; + } #endif /*----------------------------------------------- diff --git a/src/gwin/label.c b/src/gwin/label.c index 8c892217..7f8ab814 100644 --- a/src/gwin/label.c +++ b/src/gwin/label.c @@ -21,74 +21,80 @@ #include "gwin/class_gwin.h" -#define widget(gh) ((GLabelWidget*)gh) +#define widget(gh) ((GLabelWidget*)gh) +#define GLABEL_FLG_WAUTO (GWIN_FIRST_CONTROL_FLAG<<0) +#define GLABEL_FLG_HAUTO (GWIN_FIRST_CONTROL_FLAG<<1) -static void _destroy(GWindowObject *gh) { - (void)gh; +static void gwinLabelDefaultDraw(GHandle gh) { + // if( check if auto flag is set ) + // if( call current size != font size ) + // gwinResize(); - return; + gdispFillString( widget(gh)->w.g.x, + widget(gh)->w.g.y, + widget(gh)->w.txt, + widget(gh)->w.g.font, + widget(gh)->w.g.color, + widget(gh)->w.g.bgcolor + ); + + gdispFillArea( widget(gh)->w.g.x, widget(gh)->w.g.y, widget(gh)->w.g.width, widget(gh)->w.g.height, Green); + + printf("Text: %s\r\n", widget(gh)->w.txt); } -static void _redraw(GWindowObject *gh) { - (void)gh; - - return; -} - -static void _afterClear(GWindowObject *gh) { - (void)gh; - - return; -} - -static const gwinVMT labelVMT = { - "Label", // The class name - sizeof(GLabelWidget), // The object size - _destroy, // The destroy routine - 0, // The redraw routine - _afterClear // The after-clear routine +static const gwidgetVMT labelVMT = { + { + "Label", // The class name + sizeof(GLabelWidget), // The object size + _gwidgetDestroy, // The destroy routine + _gwidgetRedraw, // The redraw routine + 0, // The after-clear routine + }, + gwinLabelDefaultDraw, // default drawing routine + { + 0, // Process mose down events (NOT USED) + 0, // Process mouse up events (NOT USED) + 0, // Process mouse move events (NOT USED) + }, + { + 0, // No toggle role + 0, // Assign Toggles (NOT USED) + 0, // Get Toggles (NOT USED) + 0, // Process toggle off event (NOT USED) + 0, // Process toggle on event (NOT USED) + }, + { + 0, // No dial roles + 0, // Assign Dials (NOT USED) + 0, // Get Dials (NOT USED) + 0, // Procees dial move events (NOT USED) + } }; -GHandle gwinLabelCreate(GLabelWidget *widget, GWindowInit *pInit) { - if (!(widget = (GLabelWidget *)_gwindowCreate(&widget->g, pInit, &labelVMT, 0))) +GHandle gwinLabelCreate(GLabelWidget *widget, GWidgetInit *pInit) { + uint16_t flags = 0; + + // auto assign width + if (pInit->g.width <= 0) { + flags |= GLABEL_FLG_WAUTO; + pInit->g.width = gdispGetStringWidth(pInit->text, gwinGetDefaultFont()); + } + + // auto assign height + if (pInit->g.height <= 0) { + flags |= GLABEL_FLG_HAUTO; + pInit->g.height = gdispGetFontMetric(gwinGetDefaultFont(), fontHeight); + } + + if (!(widget = (GLabelWidget *)_gwidgetCreate(&widget->w, pInit, &labelVMT))) return 0; - widget->g.x = pInit->x; - widget->g.y = pInit->y; - widget->g.width = pInit->width; - widget->g.height = pInit->height; - gwinSetVisible((GHandle)widget, pInit->show); + gwinLabelDefaultDraw((GHandle)widget); + widget->w.g.flags |= flags; return (GHandle)widget; } -void gwinLabelSetColor(GHandle gh, color_t color) { - widget(gh)->g.color = color; -} - -void gwinLabelSetBgColor(GHandle gh, color_t bgColor) { - widget(gh)->g.bgcolor = bgColor; -} - -void gwinLabelSetFont(GHandle gh, font_t font) { - widget(gh)->g.font = font; -} - -void gwinLabelSetText(GHandle gh, const char* text) { - widget(gh)->text = text; - - gwinLabelDraw(gh); -} - -void gwinLabelDraw(GHandle gh) { - gdispFillString( widget(gh)->g.x, - widget(gh)->g.y, - widget(gh)->text, - widget(gh)->g.font, - widget(gh)->g.color, - widget(gh)->g.bgcolor - ); -} - #endif // GFX_USE_GWIN && GFX_NEED_LABEL From 09a359813f0abe8f99c32dadfa1ac2c68356ddfd Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 4 Jul 2013 00:20:32 +1000 Subject: [PATCH 20/38] Label, Image and Window Manager changes --- include/gfx_rules.h | 7 +- include/gwin/gwin.h | 14 ++++ include/gwin/image.h | 25 +------ src/gwin/gimage.c | 173 +++++++++++++++++++++++++++++++++++++++++++ src/gwin/gwin.c | 18 +++++ src/gwin/gwin.mk | 2 +- src/gwin/gwm.c | 44 ++++++++--- src/gwin/image.c | 95 ------------------------ src/gwin/label.c | 44 ++++++----- 9 files changed, 275 insertions(+), 147 deletions(-) create mode 100644 src/gwin/gimage.c delete mode 100644 src/gwin/image.c diff --git a/include/gfx_rules.h b/include/gfx_rules.h index dfabe728..bfe017d3 100644 --- a/include/gfx_rules.h +++ b/include/gfx_rules.h @@ -46,7 +46,12 @@ #warning "GWIN: Drawing can occur outside the defined windows as GDISP_NEED_CLIP is FALSE" #endif #endif - #if GWIN_NEED_BUTTON || GWIN_NEED_SLIDER || GWIN_NEED_CHECKBOX + #if GWIN_NEED_IMAGE + #if !GDISP_NEED_IMAGE + #error "GWIN: GDISP_NEED_IMAGE is required when GWIN_NEED_IMAGE is TRUE." + #endif + #endif + #if GWIN_NEED_BUTTON || GWIN_NEED_SLIDER || GWIN_NEED_CHECKBOX || GWIN_NEED_LABEL #if !GWIN_NEED_WIDGET #if GFX_DISPLAY_RULE_WARNINGS #warning "GWIN: GWIN_NEED_WIDGET is required when a Widget is used. It has been turned on for you." diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index 21d465b2..4fb28bef 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -111,6 +111,13 @@ extern "C" { */ void gwinSetDefaultColor(color_t clr); + /** + * @brief Get the default foreground color for all new GWIN windows + * + * @api + */ + color_t gwinGetDefaultColor(void); + /** * @brief Set the default background color for all new GWIN windows * @@ -120,6 +127,13 @@ extern "C" { */ void gwinSetDefaultBgColor(color_t bgclr); + /** + * @brief Get the default background color for all new GWIN windows + * + * @api + */ + color_t gwinGetDefaultBgColor(void); + #if GDISP_NEED_TEXT || defined(__DOXYGEN__) /** * @brief Set the default font for all new GWIN windows diff --git a/include/gwin/image.h b/include/gwin/image.h index 95a26687..d32e9a0c 100644 --- a/include/gwin/image.h +++ b/include/gwin/image.h @@ -32,9 +32,7 @@ // An image window typedef struct GImageWidget_t { GWindowObject g; - - gdispImage *image; - color_t bgColor; + gdispImage image; } GImageWidget; #ifdef __cplusplus @@ -50,11 +48,10 @@ extern "C" { * @param[in] pInit The initialization parameters to use. * * @note The default background color gets set to the current default one. - * @note An image widget does not save the current drawing state. It is not automatically redrawn if the window - * is moved or its visibility state is changed. + * @note An image window knows how to redraw. * * @api - */ + */ GHandle gwinImageCreate(GImageWidget *widget, GWindowInit *pInit); /** @@ -98,7 +95,7 @@ bool_t gwinImageOpenMemory(GHandle gh, const void* memory); #endif /** - * @brief Cache an image. + * @brief Cache the image. * @details Decodes and caches the current frame into RAM. * * param[in] gh The widget (must be an image widget) @@ -109,20 +106,6 @@ bool_t gwinImageOpenMemory(GHandle gh, const void* memory); */ gdispImageError gwinImageCache(GHandle gh); -/** - * @brief Set the background color of an image widget. - * @details Transparent images need a background color. If no background color has been set, the current default - * on is used. - * - * @param[in] gh The widget (must be an image widget) - * @param[in] bgColor The background color to be set - * - * @api - */ -void gwinImageSetBgColor(GHandle gh, color_t bgColor); - -void gwinImageDraw(GHandle gh); - #ifdef __cplusplus } #endif diff --git a/src/gwin/gimage.c b/src/gwin/gimage.c new file mode 100644 index 00000000..464bc595 --- /dev/null +++ b/src/gwin/gimage.c @@ -0,0 +1,173 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ + +/** + * @file src/gwin/image.c + * @brief GWIN sub-system image code. + */ + +#include "gfx.h" + +#if GFX_USE_GWIN && GWIN_NEED_IMAGE + +#include "gwin/class_gwin.h" + +#define widget(gh) ((GImageWidget*)gh) + +static void _destroy(GWindowObject *gh) { + if (gdispImageIsOpen(&widget(gh)->image)) + gdispImageClose(&widget(gh)->image); +} + +static void _redraw(GHandle gh) { + coord_t x, y, w, h, dx, dy; + + // The default display area + x = gh->x; + y = gh->y; + w = gh->width; + h = gh->height; + + // If the image isn't open just clear the area + if (!gdispImageIsOpen(&widget(gh)->image)) { + gdispFillArea(x, y, w, h, gh->bgcolor); + return; + } + + // Center horizontally if the area is larger than the image + if (widget(gh)->image.width < w) { + w = widget(gh)->image.width; + dx = (gh->width-w)/2; + x += dx; + if (dx) + gdispFillArea(gh->x, y, dx, h, gh->bgcolor); + gdispFillArea(x+w, y, gh->width-dx-w, h, gh->bgcolor); + dx = 0; + } + + // Center image horizontally if the area is smaller than the image + else if (widget(gh)->image.width > w) { + dx = (widget(gh)->image.width - w)/2; + } + + // Center vertically if the area is larger than the image + if (widget(gh)->image.height < h) { + h = widget(gh)->image.height; + dy = (gh->height-h)/2; + y += dy; + if (dy) + gdispFillArea(x, gh->y, w, dy, gh->bgcolor); + gdispFillArea(x, y+h, w, gh->height-dy-h, gh->bgcolor); + dy = 0; + } + + // Center image vertically if the area is smaller than the image + else if (widget(gh)->image.height > h) { + dy = (widget(gh)->image.height - h)/2; + } + + // Reset the background color in case it has changed + gdispImageSetBgColor(&widget(gh)->image, gh->bgcolor); + + // Display the image + gdispImageDraw(&widget(gh)->image, x, y, w, h, dx, dy); +} + + +static const gwinVMT imageVMT = { + "Image", // The class name + sizeof(GImageWidget), // The object size + _destroy, // The destroy routine + _redraw, // The redraw routine + 0, // The after-clear routine +}; + +GHandle gwinImageCreate(GImageWidget *gobj, GWindowInit *pInit) { + if (!(gobj = (GImageWidget *)_gwindowCreate(&gobj->g, pInit, &imageVMT, 0))) + return 0; + + // Ensure the gdispImageIsOpen() gives valid results + gobj->image.type = 0; + + gwinSetVisible((GHandle)gobj, pInit->show); + + return (GHandle)gobj; +} + +bool_t gwinImageOpenMemory(GHandle gh, const void* memory) { + if (gdispImageIsOpen(&widget(gh)->image)) + gdispImageClose(&widget(gh)->image); + + if (!gdispImageSetMemoryReader(&widget(gh)->image, memory)) + return FALSE; + + if (gdispImageOpen(&widget(gh)->image) != GDISP_IMAGE_ERR_OK) + return FALSE; + + if ((gh->flags & GWIN_FLG_VISIBLE)) { + // Setting the clip here shouldn't be necessary if the redraw doesn't overdraw + // but we put it in for safety anyway + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + _redraw(gh); + } + return TRUE; +} + +#if defined(WIN32) || GFX_USE_OS_WIN32 || GFX_USE_OS_POSIX || defined(__DOXYGEN__) +bool_t gwinImageOpenFile(GHandle gh, const char* filename) { + if (gdispImageIsOpen(&widget(gh)->image)) + gdispImageClose(&widget(gh)->image); + + if (!gdispImageSetFileReader(&widget(gh)->image, filename)) + return FALSE; + + if (gdispImageOpen(&widget(gh)->image) != GDISP_IMAGE_ERR_OK) + return FALSE; + + if ((gh->flags & GWIN_FLG_VISIBLE)) { + // Setting the clip here shouldn't be necessary if the redraw doesn't overdraw + // but we put it in for safety anyway + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + _redraw(gh); + } + return TRUE; +} +#endif + +#if GFX_USE_OS_CHIBIOS || defined(__DOXYGEN__) +bool_t gwinImageOpenStream(GHandle gh, void *streamPtr) { + if (gdispImageIsOpen(&widget(gh)->image)) + gdispImageClose(&widget(gh)->image); + + if (!gdispImageSetBaseFileStreamReader(&widget(gh)->image, streamPtr)) + return FALSE; + + if (gdispImageOpen(&widget(gh)->image) != GDISP_IMAGE_ERR_OK) + return FALSE; + + if ((gh->flags & GWIN_FLG_VISIBLE)) { + // Setting the clip here shouldn't be necessary if the redraw doesn't overdraw + // but we put it in for safety anyway + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + _redraw(gh); + } + return TRUE; +} +#endif + +gdispImageError gwinImageCache(GHandle gh) { + return gdispImageCache(&widget(gh)->image); +} + +#endif // GFX_USE_GWIN && GWIN_NEED_IMAGE +/** @} */ diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index f080ac64..de1673cb 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -63,6 +63,16 @@ static color_t defaultBgColor = Black; if (gh->height < MIN_WIN_HEIGHT) { gh->height = MIN_WIN_HEIGHT; } if (gh->x+gh->width > gdispGetWidth()) gh->width = gdispGetWidth() - gh->x; if (gh->y+gh->height > gdispGetHeight()) gh->height = gdispGetHeight() - gh->y; + + // Redraw the window + if ((gh->flags & GWIN_FLG_VISIBLE)) { + if (gh->vmt->Redraw) { + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + gh->vmt->Redraw(gh); + } + } } #endif @@ -135,10 +145,18 @@ void gwinSetDefaultColor(color_t clr) { defaultFgColor = clr; } +color_t gwinGetDefaultColor(void) { + return defaultFgColor; +} + void gwinSetDefaultBgColor(color_t bgclr) { defaultBgColor = bgclr; } +color_t gwinGetDefaultBgColor(void) { + return defaultBgColor; +} + #if GDISP_NEED_TEXT void gwinSetDefaultFont(font_t font) { defaultFont = font; diff --git a/src/gwin/gwin.mk b/src/gwin/gwin.mk index 9a81728e..b9e6a9ee 100644 --- a/src/gwin/gwin.mk +++ b/src/gwin/gwin.mk @@ -6,6 +6,6 @@ GFXSRC += $(GFXLIB)/src/gwin/gwin.c \ $(GFXLIB)/src/gwin/button.c \ $(GFXLIB)/src/gwin/slider.c \ $(GFXLIB)/src/gwin/checkbox.c \ - $(GFXLIB)/src/gwin/image.c \ + $(GFXLIB)/src/gwin/gimage.c \ $(GFXLIB)/src/gwin/label.c \ diff --git a/src/gwin/gwm.c b/src/gwin/gwm.c index c3405d83..75b08be6 100644 --- a/src/gwin/gwm.c +++ b/src/gwin/gwm.c @@ -25,7 +25,7 @@ static void WM_Init(void); static void WM_DeInit(void); -static bool_t WM_Add(GHandle gh, GWindowInit *pInit); +static bool_t WM_Add(GHandle gh, const GWindowInit *pInit); static void WM_Delete(GHandle gh); static void WM_Visible(GHandle gh); static void WM_Redim(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h); @@ -65,23 +65,25 @@ static void WM_DeInit(void) { // A full window manager would remove any borders etc } -static bool_t WM_Add(GHandle gh, GWindowInit *pInit) { +static bool_t WM_Add(GHandle gh, const GWindowInit *pInit) { + // Note the window will not be marked as visible yet + // Put it on the queue gfxQueueASyncPut(&_GWINList, &gh->wmq); // Make sure the size is valid WM_Redim(gh, pInit->x, pInit->y, pInit->width, pInit->height); - - // Display it if it is visible - WM_Visible(gh); return TRUE; } static void WM_Delete(GHandle gh) { - // A real window manager would make the window invisible - // (and then clear the area underneath) + // Make the window invisible and clear the area underneath + if ((gh->flags & GWIN_FLG_VISIBLE)) { + gh->flags &= ~GWIN_FLG_VISIBLE; + gdispFillArea(gh->x, gh->y, gh->width, gh->height, gwinGetDefaultBgColor()); + } - // Just remove it from the queue + // Remove it from the queue gfxQueueASyncRemove(&_GWINList, &gh->wmq); } @@ -97,10 +99,8 @@ static void WM_Visible(GHandle gh) { // A real window manager would also redraw the borders } - // else - // A real window manager would make the window invisible - // (and then clear the area underneath) - + else + gdispFillArea(gh->x, gh->y, gh->width, gh->height, gwinGetDefaultBgColor()); } static void WM_Redim(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h) { @@ -114,8 +114,28 @@ static void WM_Redim(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h) { if (h < MIN_WIN_HEIGHT) { h = MIN_WIN_HEIGHT; } if (x+w > gdispGetWidth()) w = gdispGetWidth() - x; if (y+h > gdispGetHeight()) h = gdispGetHeight() - y; + + // If there has been no resize just exit + if (gh->x == x && gh->y == y && gh->width == w && gh->height == h) + return; + + // Clear the old area + if ((gh->flags & GWIN_FLG_VISIBLE)) + gdispFillArea(gh->x, gh->y, gh->width, gh->height, gwinGetDefaultBgColor()); + + // Set the new size gh->x = x; gh->y = y; gh->width = w; gh->height = h; + + // Redraw the window (if possible) + if ((gh->flags & GWIN_FLG_VISIBLE)) { + if (gh->vmt->Redraw) { + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + gh->vmt->Redraw(gh); + } + } } static void WM_MinMax(GHandle gh, GWindowMinMax minmax) { diff --git a/src/gwin/image.c b/src/gwin/image.c deleted file mode 100644 index bba92238..00000000 --- a/src/gwin/image.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * This file is subject to the terms of the GFX License. If a copy of - * the license was not distributed with this file, you can obtain one at: - * - * http://chibios-gfx.com/license.html - */ - -/** - * @file src/gwin/image.c - * @brief GWIN sub-system image code. - */ - -#include "gfx.h" - -#if GFX_USE_GWIN && GWIN_NEED_IMAGE - -#include "gwin/class_gwin.h" - -#define widget(gh) ((GImageWidget*)gh) - -static void _destroy(GWindowObject *gh) { - if (gdispImageIsOpen(&widget(gh)->image)) - gdispImageClose(&widget(gh)->image); - - return; -} - -static void _afterClear(GWindowObject *gh) { - (void)gh; - - return; -} - -static const gwinVMT imageVMT = { - "Image", // The class name - sizeof(GImageWidget), // The object size - _destroy, // The destroy routine - 0, - _afterClear, // The after-clear routine -}; - -GHandle gwinImageCreate(GImageWidget *widget, GWindowInit *pInit) { - if (!(widget = (GImageWidget *)_gwindowCreate(&widget->g, pInit, &imageVMT, 0))) - return 0; - - widget->image = gfxAlloc(sizeof(gdispImage)); - if (widget->image == NULL) - return 0; - - widget->g.x = pInit->x; - widget->g.y = pInit->y; - widget->g.width = pInit->width; - widget->g.height = pInit->height; - widget->bgColor = Black; - gwinSetVisible((GHandle)widget, pInit->show); - - return (GHandle)widget; -} - -bool_t gwinImageOpenMemory(GHandle gh, const void* memory) { - bool_t err; - - err = gdispImageSetMemoryReader(widget(gh)->image, memory); - gdispImageOpen(widget(gh)->image); - - return err; -} - -#if defined(WIN32) || GFX_USE_OS_WIN32 || GFX_USE_OS_POSIX || defined(__DOXYGEN__) -bool_t gwinImageOpenFile(GHandle gh, const char* filename) { - return gdispImageSetFileReader(widget(gh)->image, filename); -} -#endif - -#if GFX_USE_OS_CHIBIOS || defined(__DOXYGEN__) -bool_t gwinImageOpenStream(GHandle gh, void *streamPtr) { - return gdispImageSetBaseFileStreamReader(widget(gh)->image, streamPtr); -} -#endif - -gdispImageError gwinImageCache(GHandle gh) { - return gdispImageCache(widget(gh)->image); -} - -void gwinImageSetBgColor(GHandle gh, color_t bgColor) { - widget(gh)->bgColor = bgColor; -} - -void gwinImageDraw(GHandle gh) { - gdispImageDraw(widget(gh)->image, widget(gh)->g.x, widget(gh)->g.y, widget(gh)->image->width, widget(gh)->image->height, 0, 0); -} - -#endif // GFX_USE_GWIN && GWIN_NEED_IMAGE -/** @} */ - diff --git a/src/gwin/label.c b/src/gwin/label.c index 7f8ab814..e757892d 100644 --- a/src/gwin/label.c +++ b/src/gwin/label.c @@ -21,26 +21,36 @@ #include "gwin/class_gwin.h" -#define widget(gh) ((GLabelWidget*)gh) #define GLABEL_FLG_WAUTO (GWIN_FIRST_CONTROL_FLAG<<0) #define GLABEL_FLG_HAUTO (GWIN_FIRST_CONTROL_FLAG<<1) -static void gwinLabelDefaultDraw(GHandle gh) { - // if( check if auto flag is set ) - // if( call current size != font size ) - // gwinResize(); +// Simple: single line with no wrapping +static coord_t getwidth(const char *txt, font_t font, coord_t maxwidth) { + (void) maxwidth; + return gdispGetStringWidth(txt, font)+2; // Allow one pixel of padding on each side +} - gdispFillString( widget(gh)->w.g.x, - widget(gh)->w.g.y, - widget(gh)->w.txt, - widget(gh)->w.g.font, - widget(gh)->w.g.color, - widget(gh)->w.g.bgcolor - ); +// Simple: single line with no wrapping +static coord_t getheight(const char *txt, font_t font, coord_t maxwidth) { + (void) txt; + (void) maxwidth; - gdispFillArea( widget(gh)->w.g.x, widget(gh)->w.g.y, widget(gh)->w.g.width, widget(gh)->w.g.height, Green); + return gdispGetFontMetric(font, fontHeight); +} - printf("Text: %s\r\n", widget(gh)->w.txt); +static void gwinLabelDefaultDraw(GWidgetObject *gw, void *param) { + (void) param; + coord_t w, h; + + w = (gw->g.flags & GLABEL_FLG_WAUTO) ? getwidth(gw->txt, gw->g.font, gdispGetWidth() - gw->g.x) : gw->g.width; + h = (gw->g.flags & GLABEL_FLG_HAUTO) ? getheight(gw->txt, gw->g.font, gdispGetWidth() - gw->g.x) : gw->g.height; + + if (gw->g.width != w || gw->g.height != h) { + gwinResize(&gw->g, w, h); + return; + } + + gdispFillStringBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->txt, gw->g.font, gw->g.color, gw->g.bgcolor, justifyLeft); } static const gwidgetVMT labelVMT = { @@ -78,21 +88,21 @@ GHandle gwinLabelCreate(GLabelWidget *widget, GWidgetInit *pInit) { // auto assign width if (pInit->g.width <= 0) { flags |= GLABEL_FLG_WAUTO; - pInit->g.width = gdispGetStringWidth(pInit->text, gwinGetDefaultFont()); + pInit->g.width = getwidth(pInit->text, gwinGetDefaultFont(), gdispGetWidth() - pInit->g.x); } // auto assign height if (pInit->g.height <= 0) { flags |= GLABEL_FLG_HAUTO; - pInit->g.height = gdispGetFontMetric(gwinGetDefaultFont(), fontHeight); + pInit->g.height = getheight(pInit->text, gwinGetDefaultFont(), gdispGetWidth() - pInit->g.x); } if (!(widget = (GLabelWidget *)_gwidgetCreate(&widget->w, pInit, &labelVMT))) return 0; - gwinLabelDefaultDraw((GHandle)widget); widget->w.g.flags |= flags; + gwinSetVisible(&widget->w.g, pInit->g.show); return (GHandle)widget; } From dce9dc00a8bc9aa400b1354c442044586b82bfbc Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 4 Jul 2013 00:22:15 +1000 Subject: [PATCH 21/38] Widget demo update --- demos/modules/gwin/widgets/gfxconf.h | 8 +++++--- demos/modules/gwin/widgets/main.c | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index fd217b0d..5cf344e4 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -45,9 +45,9 @@ #define GDISP_NEED_CLIP TRUE #define GDISP_NEED_TEXT TRUE #define GDISP_NEED_CIRCLE TRUE -#define GDISP_NEED_ELLIPSE TRUE -#define GDISP_NEED_ARC TRUE -#define GDISP_NEED_CONVEX_POLYGON TRUE +#define GDISP_NEED_ELLIPSE FALSE +#define GDISP_NEED_ARC FALSE +#define GDISP_NEED_CONVEX_POLYGON FALSE #define GDISP_NEED_SCROLL FALSE #define GDISP_NEED_PIXELREAD FALSE #define GDISP_NEED_CONTROL FALSE @@ -78,6 +78,8 @@ #define GWIN_NEED_BUTTON TRUE #define GWIN_NEED_SLIDER TRUE #define GWIN_NEED_CHECKBOX TRUE +#define GWIN_NEED_LABEL TRUE +#define GWIN_NEED_IMAGE TRUE /* Features for the GINPUT sub-system. */ #define GINPUT_NEED_MOUSE TRUE diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index 70f64572..fdd5ed43 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -33,6 +33,7 @@ static GHandle ghConsole; static GHandle ghButton1, ghButton2, ghButton3, ghButton4; static GHandle ghSlider1, ghSlider2, ghSlider3, ghSlider4; static GHandle ghCheckbox1, ghCheckbox2; +static GHandle ghLabel1; #define ScrWidth gdispGetWidth() #define ScrHeight gdispGetHeight() @@ -95,6 +96,9 @@ int main(void) { gwinSetCustomDraw(ghCheckbox2, gwinCheckboxDraw_CheckOnRight, 0); gwinSetVisible(ghCheckbox2, TRUE); + wi.g.show = TRUE; wi.g.width = 0; + wi.g.y = BUTTON_HEIGHT+1+2*(CHECKBOX_HEIGHT+1); wi.text = "L1"; ghLabel1 = gwinLabelCreate(NULL, &wi); + // Console - we apply some special colors before making it visible wi.g.show = FALSE; wi.g.width = ScrWidth/2-1; wi.g.height = ScrHeight/2-1; @@ -116,6 +120,16 @@ int main(void) { gwinAttachDial(ghSlider3, 0, 1); #endif + gfxSleepMilliseconds(5000); + gwinSetBgColor(ghLabel1, Blue); + gwinSetColor(ghLabel1, Yellow); + gwinSetText(ghLabel1, "Very Big Label", FALSE); + + gfxSleepMilliseconds(5000); + gwinSetBgColor(ghLabel1, Yellow); + gwinSetColor(ghLabel1, Red); + gwinSetText(ghLabel1, "L1", FALSE); + while(1) { // Get an Event pe = geventEventWait(&gl, TIME_INFINITE); From 21e52bc85943ed7255380d8d8384780e617bcbf8 Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 4 Jul 2013 00:53:41 +1000 Subject: [PATCH 22/38] Math library no longer needed on widget demo --- demos/modules/gwin/widgets/readme.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/demos/modules/gwin/widgets/readme.txt b/demos/modules/gwin/widgets/readme.txt index bb91e810..02d733e9 100644 --- a/demos/modules/gwin/widgets/readme.txt +++ b/demos/modules/gwin/widgets/readme.txt @@ -4,7 +4,3 @@ gfxconf.h Note that you will need to include the drivers into your project makefile for whichever inputs you decide to use. - -Note that you need to link to the math library. Add -lm to your -library paths in your Makefile. - From a7198b53ff82a02a86a55823a8be895ec5eca1e4 Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 4 Jul 2013 00:54:25 +1000 Subject: [PATCH 23/38] Restore gwin base class image function --- include/gwin/gwin.h | 29 +++++++++++++++++++++++++++++ src/gwin/gwin.c | 12 ++++++++++++ 2 files changed, 41 insertions(+) diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index 4fb28bef..ba9e1e1a 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -720,6 +720,35 @@ extern "C" { void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt); #endif +/*------------------------------------------------- + * Image functions + *-------------------------------------------------*/ + + #if GDISP_NEED_IMAGE || defined(__DOXYGEN__) + /** + * @brief Draw the image + * @return GDISP_IMAGE_ERR_OK (0) on success or an error code. + * + * @param[in] gh The window handle + * @param[in] img The image structure + * @param[in] x,y The window location to draw the image + * @param[in] cx,cy The area on the screen to draw + * @param[in] sx,sy The image position to start drawing at + * + * @pre gdispImageOpen() must have returned successfully. + * + * @note If sx,sy + cx,cy is outside the image boundaries the area outside the image + * is simply not drawn. + * @note If @p gdispImageCache() has been called first for this frame, this routine will draw using a + * fast blit from the cached frame. If not, it reads the input and decodes it as it + * is drawing. This may be significantly slower than if the image has been cached (but + * uses a lot less RAM) + * + * @api + */ + gdispImageError gwinImageDraw(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); + #endif + #ifdef __cplusplus } #endif diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index de1673cb..e3d81d9c 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -501,6 +501,18 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor } #endif +#if GDISP_NEED_IMAGE + gdispImageError gwinImageDraw(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy) { + if (!((gh->flags & GWIN_FLG_VISIBLE))) + return GDISP_IMAGE_ERR_OK; + + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + return gdispImageDraw(img, gh->x+x, gh->y+y, cx, cy, sx, sy); + } +#endif + #endif /* GFX_USE_GWIN */ /** @} */ From f9eed6036d7f28ef1ab8f8d3feec6a05e0572405 Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 4 Jul 2013 00:59:12 +1000 Subject: [PATCH 24/38] Make the enabled state available to all GWIN's - not just widgets. --- include/gwin/gwidget.h | 13 ------------- include/gwin/gwin.h | 23 +++++++++++++++++++++++ src/gwin/gwidget.c | 17 ----------------- src/gwin/gwin.c | 28 ++++++++++++++++++++++++++++ 4 files changed, 51 insertions(+), 30 deletions(-) diff --git a/include/gwin/gwidget.h b/include/gwin/gwidget.h index 817f2b0d..a2cf7337 100644 --- a/include/gwin/gwidget.h +++ b/include/gwin/gwidget.h @@ -83,19 +83,6 @@ typedef struct GWidgetInit { extern "C" { #endif -/** - * @brief Enable or disable a widget - * - * @param[in] gh The widget handle - * @param[in] enabled Enable or disable the widget - * - * @note The widget is automatically redrawn. - * @note Non-widgets will ignore this call. - * - * @api - */ -void gwinSetEnabled(GHandle gh, bool_t enabled); - /** * @brief Set the text of a widget. * diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index ba9e1e1a..dd8abb0f 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -297,6 +297,29 @@ extern "C" { */ bool_t gwinGetVisible(GHandle gh); + /** + * @brief Enable or disable a window + * + * @param[in] gh The window handle + * @param[in] enabled Enable or disable the window + * + * @note The window is automatically redrawn if it + * supports self-redrawing. + * + * @api + */ + void gwinSetEnabled(GHandle gh, bool_t enabled); + + /** + * @brief Gets the enabled state of a window + * @return TRUE if enabled + * + * @param[in] gh The window + * + * @api + */ + bool_t gwinGetEnabled(GHandle gh); + /** * @brief Move a window * diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c index a2b82f1d..6440f171 100644 --- a/src/gwin/gwidget.c +++ b/src/gwin/gwidget.c @@ -226,23 +226,6 @@ void _gwidgetRedraw(GHandle gh) { gw->fnDraw(gw, gw->fnParam); } -void gwinSetEnabled(GHandle gh, bool_t enabled) { - if (!(gh->flags & GWIN_FLG_WIDGET)) - return; - - if (enabled) { - if (!(gh->flags & GWIN_FLG_ENABLED)) { - gh->flags |= GWIN_FLG_ENABLED; - _gwidgetRedraw(gh); - } - } else { - if ((gh->flags & GWIN_FLG_ENABLED)) { - gh->flags &= ~GWIN_FLG_ENABLED; - _gwidgetRedraw(gh); - } - } -} - void gwinSetText(GHandle gh, const char *txt, bool_t useAlloc) { if (!(gh->flags & GWIN_FLG_WIDGET)) return; diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index e3d81d9c..9e345523 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -223,6 +223,34 @@ bool_t gwinGetVisible(GHandle gh) { return (gh->flags & GWIN_FLG_VISIBLE) ? TRUE : FALSE; } +void gwinSetEnabled(GHandle gh, bool_t enabled) { + if (enabled) { + if (!(gh->flags & GWIN_FLG_ENABLED)) { + gh->flags |= GWIN_FLG_ENABLED; + if (gh->vmt->Redraw) { + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + gh->vmt->Redraw(gh); + } + } + } else { + if ((gh->flags & GWIN_FLG_ENABLED)) { + gh->flags &= ~GWIN_FLG_ENABLED; + if (gh->vmt->Redraw) { + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif + gh->vmt->Redraw(gh); + } + } + } +} + +bool_t gwinGetEnabled(GHandle gh) { + return (gh->flags & GWIN_FLG_ENABLED) ? TRUE : FALSE; +} + void gwinMove(GHandle gh, coord_t x, coord_t y) { #if GWIN_NEED_WINDOWMANAGER cwm->vmt->Redim(gh, x, y, gh->width, gh->height); From c059f96d24c814fc34d470aa01577f294f9d73a6 Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 4 Jul 2013 01:08:47 +1000 Subject: [PATCH 25/38] Rename gwin base image function to avoid confusion with the image gwin object. --- include/gwin/gwin.h | 2 +- src/gwin/gwin.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index dd8abb0f..4d0deaf0 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -769,7 +769,7 @@ extern "C" { * * @api */ - gdispImageError gwinImageDraw(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); + gdispImageError gwinDrawImage(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy); #endif #ifdef __cplusplus diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 9e345523..92b6cc03 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -530,7 +530,7 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor #endif #if GDISP_NEED_IMAGE - gdispImageError gwinImageDraw(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy) { + gdispImageError gwinDrawImage(GHandle gh, gdispImage *img, coord_t x, coord_t y, coord_t cx, coord_t cy, coord_t sx, coord_t sy) { if (!((gh->flags & GWIN_FLG_VISIBLE))) return GDISP_IMAGE_ERR_OK; From 99c13615c829f5d64fe10f644aa493be0cd01c15 Mon Sep 17 00:00:00 2001 From: inmarket Date: Thu, 4 Jul 2013 17:00:34 +1000 Subject: [PATCH 26/38] Image decoders not setting image type correctly. --- src/gdisp/image_bmp.c | 1 + src/gdisp/image_gif.c | 1 + src/gdisp/image_native.c | 1 + 3 files changed, 3 insertions(+) diff --git a/src/gdisp/image_bmp.c b/src/gdisp/image_bmp.c index e54ad5e4..4f50de81 100644 --- a/src/gdisp/image_bmp.c +++ b/src/gdisp/image_bmp.c @@ -407,6 +407,7 @@ gdispImageError gdispImageOpen_BMP(gdispImage *img) { } #endif + img->type = GDISP_IMAGE_TYPE_BMP; return GDISP_IMAGE_ERR_OK; baddatacleanup: diff --git a/src/gdisp/image_gif.c b/src/gdisp/image_gif.c index 3de47d03..ed342b4e 100644 --- a/src/gdisp/image_gif.c +++ b/src/gdisp/image_gif.c @@ -609,6 +609,7 @@ gdispImageError gdispImageOpen_GIF(gdispImage *img) { // Read the first frame descriptor switch(initFrame(img)) { case GDISP_IMAGE_ERR_OK: // Everything OK + img->type = GDISP_IMAGE_TYPE_GIF; return GDISP_IMAGE_ERR_OK; case GDISP_IMAGE_ERR_UNSUPPORTED: // Unsupported gdispImageClose_GIF(img); // Clean up the private data area diff --git a/src/gdisp/image_native.c b/src/gdisp/image_native.c index 694518c6..6bbed3fc 100644 --- a/src/gdisp/image_native.c +++ b/src/gdisp/image_native.c @@ -56,6 +56,7 @@ gdispImageError gdispImageOpen_NATIVE(gdispImage *img) { return GDISP_IMAGE_ERR_NOMEMORY; img->priv->frame0cache = 0; + img->type = GDISP_IMAGE_TYPE_NATIVE; return GDISP_IMAGE_ERR_OK; } From f3f9b7dc015b5afc82fba6682e780dcc72f9241d Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 6 Jul 2013 01:42:10 +1000 Subject: [PATCH 27/38] Fix window manager bug Window are was not being cleared properly when something was made invisible --- src/gwin/gwm.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/src/gwin/gwm.c b/src/gwin/gwm.c index 75b08be6..88d61a21 100644 --- a/src/gwin/gwm.c +++ b/src/gwin/gwm.c @@ -88,18 +88,16 @@ static void WM_Delete(GHandle gh) { } static void WM_Visible(GHandle gh) { + #if GDISP_NEED_CLIP + gdispSetClip(gh->x, gh->y, gh->width, gh->height); + #endif if ((gh->flags & GWIN_FLG_VISIBLE)) { - if (gh->vmt->Redraw) { - #if GDISP_NEED_CLIP - gdispSetClip(gh->x, gh->y, gh->width, gh->height); - #endif + if (gh->vmt->Redraw) gh->vmt->Redraw(gh); - } else - gwinClear(gh); - // A real window manager would also redraw the borders - } - - else + else + gdispFillArea(gh->x, gh->y, gh->width, gh->height, gh->bgcolor); + // A real window manager would also redraw the borders here + } else gdispFillArea(gh->x, gh->y, gh->width, gh->height, gwinGetDefaultBgColor()); } From ab44f32859ac61072a561869787089e13adaf509 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 6 Jul 2013 01:45:24 +1000 Subject: [PATCH 28/38] Remove widget structure members when they are not needed for input tracking Also doco update for Enabled Flag --- include/gwin/button.h | 4 +- include/gwin/checkbox.h | 4 +- include/gwin/class_gwin.h | 46 +++--- include/gwin/slider.h | 10 +- src/gwin/button.c | 172 +++++++++++---------- src/gwin/checkbox.c | 122 ++++++++------- src/gwin/label.c | 42 ++--- src/gwin/slider.c | 314 +++++++++++++++++++------------------- 8 files changed, 372 insertions(+), 342 deletions(-) diff --git a/include/gwin/button.h b/include/gwin/button.h index 73f42e37..afe6d0cc 100644 --- a/include/gwin/button.h +++ b/include/gwin/button.h @@ -55,7 +55,9 @@ typedef struct GButtonColors { */ typedef struct GButtonObject_t { GWidgetObject w; - uint16_t toggle; + #if GINPUT_NEED_TOGGLE + uint16_t toggle; + #endif GButtonColors c_up; GButtonColors c_dn; GButtonColors c_dis; diff --git a/include/gwin/checkbox.h b/include/gwin/checkbox.h index 2823007a..679a5d9c 100644 --- a/include/gwin/checkbox.h +++ b/include/gwin/checkbox.h @@ -50,7 +50,9 @@ typedef struct GCheckboxColors { /* A Checkbox window */ typedef struct GCheckboxObject_t { GWidgetObject w; - uint16_t toggle; + #if GINPUT_NEED_TOGGLE + uint16_t toggle; + #endif GCheckboxColors c; } GCheckboxObject; diff --git a/include/gwin/class_gwin.h b/include/gwin/class_gwin.h index dbda3619..1a4de5b9 100644 --- a/include/gwin/class_gwin.h +++ b/include/gwin/class_gwin.h @@ -31,8 +31,8 @@ #define GWIN_FLG_VISIBLE 0x0002 // @< The window is visible #define GWIN_FLG_MINIMIZED 0x0004 // @< The window is minimized #define GWIN_FLG_MAXIMIZED 0x0008 // @< The window is maximized -#define GWIN_FLG_WIDGET 0x0010 // @< This is a widget -#define GWIN_FLG_ENABLED 0x0020 // @< The widget is enabled +#define GWIN_FLG_ENABLED 0x0010 // @< The window is enabled +#define GWIN_FLG_WIDGET 0x0020 // @< This is a widget #define GWIN_FLG_ALLOCTXT 0x0040 // @< The widget text is allocated #define GWIN_FLG_MOUSECAPTURE 0x0080 // @< The widget has captured the mouse #define GWIN_FIRST_WM_FLAG 0x0100 // @< 4 bits free for the window manager to use @@ -76,24 +76,30 @@ typedef struct gwinVMT { typedef struct gwidgetVMT { struct gwinVMT g; // @< This is still a GWIN void (*DefaultDraw) (GWidgetObject *gw, void *param); // @< The default drawing routine (mandatory) - struct { - void (*MouseDown) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse down events (optional) - void (*MouseUp) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse up events (optional) - void (*MouseMove) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse move events (optional) - }; - struct { - uint16_t toggleroles; // @< The roles supported for toggles (0->toggleroles-1) - void (*ToggleAssign) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Assign a toggle to a role (optional) - uint16_t (*ToggleGet) (GWidgetObject *gw, uint16_t role); // @< Return the instance for a particular role (optional) - void (*ToggleOff) (GWidgetObject *gw, uint16_t role); // @< Process toggle off events (optional) - void (*ToggleOn) (GWidgetObject *gw, uint16_t role); // @< Process toggle on events (optional) - }; - struct { - uint16_t dialroles; // @< The roles supported for dials (0->dialroles-1) - void (*DialAssign) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the dial instance handle (optional) - uint16_t (*DialGet) (GWidgetObject *gw, uint16_t role); // @< Return the instance for a particular role (optional) - void (*DialMove) (GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max); // @< Process dial move events (optional) - }; + #if GINPUT_NEED_MOUSE + struct { + void (*MouseDown) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse down events (optional) + void (*MouseUp) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse up events (optional) + void (*MouseMove) (GWidgetObject *gw, coord_t x, coord_t y); // @< Process mouse move events (optional) + }; + #endif + #if GINPUT_NEED_TOGGLE + struct { + uint16_t toggleroles; // @< The roles supported for toggles (0->toggleroles-1) + void (*ToggleAssign) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Assign a toggle to a role (optional) + uint16_t (*ToggleGet) (GWidgetObject *gw, uint16_t role); // @< Return the instance for a particular role (optional) + void (*ToggleOff) (GWidgetObject *gw, uint16_t role); // @< Process toggle off events (optional) + void (*ToggleOn) (GWidgetObject *gw, uint16_t role); // @< Process toggle on events (optional) + }; + #endif + #if GINPUT_NEED_TOGGLE + struct { + uint16_t dialroles; // @< The roles supported for dials (0->dialroles-1) + void (*DialAssign) (GWidgetObject *gw, uint16_t role, uint16_t instance); // @< Test the role and save the dial instance handle (optional) + uint16_t (*DialGet) (GWidgetObject *gw, uint16_t role); // @< Return the instance for a particular role (optional) + void (*DialMove) (GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max); // @< Process dial move events (optional) + }; + #endif } gwidgetVMT; /* @} */ #endif diff --git a/include/gwin/slider.h b/include/gwin/slider.h index 57bd5a72..a8cf7ecf 100644 --- a/include/gwin/slider.h +++ b/include/gwin/slider.h @@ -45,9 +45,13 @@ typedef struct GSliderColors { // A slider window typedef struct GSliderObject_t { GWidgetObject w; - uint16_t t_dn; - uint16_t t_up; - uint16_t dial; + #if GINPUT_NEED_TOGGLE + uint16_t t_dn; + uint16_t t_up; + #endif + #if GINPUT_NEED_DIAL + uint16_t dial; + #endif coord_t dpos; int min; int max; diff --git a/src/gwin/button.c b/src/gwin/button.c index 303d1078..73f56c2e 100644 --- a/src/gwin/button.c +++ b/src/gwin/button.c @@ -17,7 +17,7 @@ #include "gfx.h" -#if (GFX_USE_GWIN && GWIN_NEED_BUTTON) || defined(__DOXYGEN__) +#if GFX_USE_GWIN && GWIN_NEED_BUTTON #include "gwin/class_gwin.h" @@ -29,44 +29,6 @@ // Our pressed state #define GBUTTON_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0) -// Prototypes for button VMT functions -static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y); -static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y); -static void ToggleOff(GWidgetObject *gw, uint16_t role); -static void ToggleOn(GWidgetObject *gw, uint16_t role); -static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance); -static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role); - -// The button VMT table -static const gwidgetVMT buttonVMT = { - { - "Button", // The classname - sizeof(GButtonObject), // The object size - _gwidgetDestroy, // The destroy routine - _gwidgetRedraw, // The redraw routine - 0, // The after-clear routine - }, - gwinButtonDraw_3D, // The default drawing routine - { - MouseDown, // Process mouse down events - MouseUp, // Process mouse up events - 0, // Process mouse move events (NOT USED) - }, - { - 1, // 1 toggle role - ToggleAssign, // Assign Toggles - ToggleGet, // Get Toggles - ToggleOff, // Process toggle off events - ToggleOn, // Process toggle on events - }, - { - 0, // No dial roles - 0, // Assign Dials (NOT USED) - 0, // Get Dials (NOT USED) - 0, // Process dial move events (NOT USED) - } -}; - // Default color scheme static const GButtonColors GButtonDefaultColorsUp = { HTML2COLOR(0x404040), // color_up_edge; @@ -103,59 +65,101 @@ static void SendButtonEvent(GWidgetObject *gw) { #undef pbe } -// A mouse down has occurred over the button -static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { - (void) x; (void) y; - gw->g.flags |= GBUTTON_FLG_PRESSED; - _gwidgetRedraw((GHandle)gw); -} +#if GINPUT_NEED_MOUSE + // A mouse down has occurred over the button + static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { + (void) x; (void) y; + gw->g.flags |= GBUTTON_FLG_PRESSED; + _gwidgetRedraw((GHandle)gw); + } -// A mouse up has occurred (it may or may not be over the button) -static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { - (void) x; (void) y; - gw->g.flags &= ~GBUTTON_FLG_PRESSED; - _gwidgetRedraw((GHandle)gw); + // A mouse up has occurred (it may or may not be over the button) + static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { + (void) x; (void) y; + gw->g.flags &= ~GBUTTON_FLG_PRESSED; + _gwidgetRedraw((GHandle)gw); - #if !GWIN_BUTTON_LAZY_RELEASE - // If the mouse up was not over the button then cancel the event - if (x < 0 || y < 0 || x >= gw->g.width || y >= gw->g.height) - return; + #if !GWIN_BUTTON_LAZY_RELEASE + // If the mouse up was not over the button then cancel the event + if (x < 0 || y < 0 || x >= gw->g.width || y >= gw->g.height) + return; + #endif + + SendButtonEvent(gw); + } +#endif + +#if GINPUT_NEED_TOGGLE + // A toggle off has occurred + static void ToggleOff(GWidgetObject *gw, uint16_t role) { + (void) role; + gw->g.flags &= ~GBUTTON_FLG_PRESSED; + _gwidgetRedraw((GHandle)gw); + } + + // A toggle on has occurred + static void ToggleOn(GWidgetObject *gw, uint16_t role) { + (void) role; + gw->g.flags |= GBUTTON_FLG_PRESSED; + _gwidgetRedraw((GHandle)gw); + // Trigger the event on button down (different than for mouse/touch) + SendButtonEvent(gw); + } + + static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + (void) role; + ((GButtonObject *)gw)->toggle = instance; + } + + static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { + (void) role; + return ((GButtonObject *)gw)->toggle; + } +#endif + +// The button VMT table +static const gwidgetVMT buttonVMT = { + { + "Button", // The classname + sizeof(GButtonObject), // The object size + _gwidgetDestroy, // The destroy routine + _gwidgetRedraw, // The redraw routine + 0, // The after-clear routine + }, + gwinButtonDraw_3D, // The default drawing routine + #if GINPUT_NEED_MOUSE + { + MouseDown, // Process mouse down events + MouseUp, // Process mouse up events + 0, // Process mouse move events (NOT USED) + }, #endif - - SendButtonEvent(gw); -} - -// A toggle off has occurred -static void ToggleOff(GWidgetObject *gw, uint16_t role) { - (void) role; - gw->g.flags &= ~GBUTTON_FLG_PRESSED; - _gwidgetRedraw((GHandle)gw); -} - -// A toggle on has occurred -static void ToggleOn(GWidgetObject *gw, uint16_t role) { - (void) role; - gw->g.flags |= GBUTTON_FLG_PRESSED; - _gwidgetRedraw((GHandle)gw); - // Trigger the event on button down (different than for mouse/touch) - SendButtonEvent(gw); -} - -static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { - (void) role; - ((GButtonObject *)gw)->toggle = instance; -} - -static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { - (void) role; - return ((GButtonObject *)gw)->toggle; -} + #if GINPUT_NEED_TOGGLE + { + 1, // 1 toggle role + ToggleAssign, // Assign Toggles + ToggleGet, // Get Toggles + ToggleOff, // Process toggle off events + ToggleOn, // Process toggle on events + }, + #endif + #if GINPUT_NEED_DIAL + { + 0, // No dial roles + 0, // Assign Dials (NOT USED) + 0, // Get Dials (NOT USED) + 0, // Process dial move events (NOT USED) + }, + #endif +}; GHandle gwinCreateButton(GButtonObject *gw, const GWidgetInit *pInit) { if (!(gw = (GButtonObject *)_gwidgetCreate(&gw->w, pInit, &buttonVMT))) return 0; - gw->toggle = GWIDGET_NO_INSTANCE; + #if GINPUT_NEED_TOGGLE + gw->toggle = GWIDGET_NO_INSTANCE; + #endif gw->c_up = GButtonDefaultColorsUp; gw->c_dn = GButtonDefaultColorsDown; gw->c_dis = GButtonDefaultColorsDisabled; diff --git a/src/gwin/checkbox.c b/src/gwin/checkbox.c index 62f4c55b..74d612d2 100644 --- a/src/gwin/checkbox.c +++ b/src/gwin/checkbox.c @@ -24,42 +24,6 @@ // Our checked state #define GCHECKBOX_FLG_CHECKED (GWIN_FIRST_CONTROL_FLAG<<0) -// Prototypes for button VMT functions -static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y); -static void ToggleOn(GWidgetObject *gw, uint16_t role); -static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance); -static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role); - -// The button VMT table -static const gwidgetVMT checkboxVMT = { - { - "Checkbox", // The classname - sizeof(GCheckboxObject),// The object size - _gwidgetDestroy, // The destroy routine - _gwidgetRedraw, // The redraw routine - 0, // The after-clear routine - }, - gwinCheckboxDraw_CheckOnLeft, // The default drawing routine - { - MouseDown, // Process mouse down events - 0, // Process mouse up events (NOT USED) - 0, // Process mouse move events (NOT USED) - }, - { - 1, // 1 toggle role - ToggleAssign, // Assign Toggles - ToggleGet, // Get Toggles - 0, // Process toggle off events (NOT USED) - ToggleOn, // Process toggle on events - }, - { - 0, // No dial roles - 0, // Assign Dials (NOT USED) - 0, // Get Dials (NOT USED) - 0, // Process dial move events (NOT USED) - } -}; - static const GCheckboxColors defaultColors = { Black, // border Grey, // selected @@ -87,37 +51,77 @@ static void SendCheckboxEvent(GWidgetObject *gw) { #undef pce } -// A mouse down has occurred over the checkbox -static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { - (void) x; (void) y; - gw->g.flags ^= GCHECKBOX_FLG_CHECKED; - _gwidgetRedraw((GHandle)gw); - SendCheckboxEvent(gw); -} +#if GINPUT_NEED_MOUSE + static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { + (void) x; (void) y; + gw->g.flags ^= GCHECKBOX_FLG_CHECKED; + _gwidgetRedraw((GHandle)gw); + SendCheckboxEvent(gw); + } +#endif -// A toggle on has occurred -static void ToggleOn(GWidgetObject *gw, uint16_t role) { - (void) role; - gw->g.flags ^= GCHECKBOX_FLG_CHECKED; - _gwidgetRedraw((GHandle)gw); - SendCheckboxEvent(gw); -} +#if GINPUT_NEED_TOGGLE + static void ToggleOn(GWidgetObject *gw, uint16_t role) { + (void) role; + gw->g.flags ^= GCHECKBOX_FLG_CHECKED; + _gwidgetRedraw((GHandle)gw); + SendCheckboxEvent(gw); + } -static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { - (void) role; - ((GCheckboxObject *)gw)->toggle = instance; -} + static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + (void) role; + ((GCheckboxObject *)gw)->toggle = instance; + } -static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { - (void) role; - return ((GCheckboxObject *)gw)->toggle; -} + static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { + (void) role; + return ((GCheckboxObject *)gw)->toggle; + } +#endif + +// The checkbox VMT table +static const gwidgetVMT checkboxVMT = { + { + "Checkbox", // The classname + sizeof(GCheckboxObject),// The object size + _gwidgetDestroy, // The destroy routine + _gwidgetRedraw, // The redraw routine + 0, // The after-clear routine + }, + gwinCheckboxDraw_CheckOnLeft, // The default drawing routine + #if GINPUT_NEED_MOUSE + { + MouseDown, // Process mouse down events + 0, // Process mouse up events (NOT USED) + 0, // Process mouse move events (NOT USED) + }, + #endif + #if GINPUT_NEED_TOGGLE + { + 1, // 1 toggle role + ToggleAssign, // Assign Toggles + ToggleGet, // Get Toggles + 0, // Process toggle off events (NOT USED) + ToggleOn, // Process toggle on events + }, + #endif + #if GINPUT_NEED_DIAL + { + 0, // No dial roles + 0, // Assign Dials (NOT USED) + 0, // Get Dials (NOT USED) + 0, // Process dial move events (NOT USED) + }, + #endif +}; GHandle gwinCreateCheckbox(GCheckboxObject *gb, const GWidgetInit *pInit) { if (!(gb = (GCheckboxObject *)_gwidgetCreate(&gb->w, pInit, &checkboxVMT))) return 0; - gb->toggle = (uint16_t) -1; + #if GINPUT_NEED_TOGGLE + gb->toggle = GWIDGET_NO_INSTANCE; + #endif gb->c = defaultColors; // assign the default colors gwinSetVisible((GHandle)gb, pInit->g.show); return (GHandle)gb; diff --git a/src/gwin/label.c b/src/gwin/label.c index e757892d..cd469210 100644 --- a/src/gwin/label.c +++ b/src/gwin/label.c @@ -62,24 +62,30 @@ static const gwidgetVMT labelVMT = { 0, // The after-clear routine }, gwinLabelDefaultDraw, // default drawing routine - { - 0, // Process mose down events (NOT USED) - 0, // Process mouse up events (NOT USED) - 0, // Process mouse move events (NOT USED) - }, - { - 0, // No toggle role - 0, // Assign Toggles (NOT USED) - 0, // Get Toggles (NOT USED) - 0, // Process toggle off event (NOT USED) - 0, // Process toggle on event (NOT USED) - }, - { - 0, // No dial roles - 0, // Assign Dials (NOT USED) - 0, // Get Dials (NOT USED) - 0, // Procees dial move events (NOT USED) - } + #if GINPUT_NEED_MOUSE + { + 0, // Process mose down events (NOT USED) + 0, // Process mouse up events (NOT USED) + 0, // Process mouse move events (NOT USED) + }, + #endif + #if GINPUT_NEED_TOGGLE + { + 0, // No toggle role + 0, // Assign Toggles (NOT USED) + 0, // Get Toggles (NOT USED) + 0, // Process toggle off event (NOT USED) + 0, // Process toggle on event (NOT USED) + }, + #endif + #if GINPUT_NEED_DIAL + { + 0, // No dial roles + 0, // Assign Dials (NOT USED) + 0, // Get Dials (NOT USED) + 0, // Procees dial move events (NOT USED) + }, + #endif }; GHandle gwinLabelCreate(GLabelWidget *widget, GWidgetInit *pInit) { diff --git a/src/gwin/slider.c b/src/gwin/slider.c index 2dfa3a7c..5aa320f8 100644 --- a/src/gwin/slider.c +++ b/src/gwin/slider.c @@ -29,46 +29,6 @@ #define GWIN_SLIDER_TOGGLE_INC 20 // How many toggles to go from minimum to maximum #endif -// Prototypes for slider VMT functions -static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y); -static void MouseMove(GWidgetObject *gw, coord_t x, coord_t y); -static void ToggleOn(GWidgetObject *gw, uint16_t role); -static void DialMove(GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max); -static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance); -static void DialAssign(GWidgetObject *gw, uint16_t role, uint16_t instance); -static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role); -static uint16_t DialGet(GWidgetObject *gw, uint16_t role); - -// The button VMT table -static const gwidgetVMT sliderVMT = { - { - "Slider", // The classname - sizeof(GSliderObject), // The object size - _gwidgetDestroy, // The destroy routine - _gwidgetRedraw, // The redraw routine - 0, // The after-clear routine - }, - gwinSliderDraw_Std, // The default drawing routine - { - 0, // Process mouse down events (NOT USED) - MouseUp, // Process mouse up events - MouseMove, // Process mouse move events - }, - { - 2, // 1 toggle role - ToggleAssign, // Assign Toggles - ToggleGet, // Get Toggles - 0, // Process toggle off events (NOT USED) - ToggleOn, // Process toggle on events - }, - { - 1, // 1 dial roles - DialAssign, // Assign Dials - DialGet, // Get Dials - DialMove, // Process dial move events - } -}; - static const GSliderColors GSliderDefaultColors = { HTML2COLOR(0x404040), // color_edge HTML2COLOR(0x000000), // color_thumb @@ -105,140 +65,182 @@ static void ResetDisplayPos(GSliderObject *gsw) { gsw->dpos = ((gsw->w.g.width-1)*(gsw->pos-gsw->min))/(gsw->max-gsw->min); } -// A mouse up event -static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { - #define gsw ((GSliderObject *)gw) - #define gh ((GHandle)gw) +#if GINPUT_NEED_MOUSE + // A mouse up event + static void MouseUp(GWidgetObject *gw, coord_t x, coord_t y) { + #define gsw ((GSliderObject *)gw) + #define gh ((GHandle)gw) - #if GWIN_BUTTON_LAZY_RELEASE - // Clip to the slider - if (x < 0) x = 0; - else if (x >= gh->width) x = gh->width-1; - if (y < 0) y = 0; - else if (y >= gh->height) x = gh->height-1; - #else - // Are we over the slider? - if (x < 0 || x >= gh->width || y < 0 || y >= gh->height) { - // No - restore the slider - ResetDisplayPos(gsw); - _gwidgetRedraw(gh); - return; + #if GWIN_BUTTON_LAZY_RELEASE + // Clip to the slider + if (x < 0) x = 0; + else if (x >= gh->width) x = gh->width-1; + if (y < 0) y = 0; + else if (y >= gh->height) x = gh->height-1; + #else + // Are we over the slider? + if (x < 0 || x >= gh->width || y < 0 || y >= gh->height) { + // No - restore the slider + ResetDisplayPos(gsw); + _gwidgetRedraw(gh); + return; + } + #endif + + // Set the new position + if (gh->width < gh->height) { + if (y > gh->height-GWIN_SLIDER_DEAD_BAND) + gsw->pos = gsw->min; + else if (y < GWIN_SLIDER_DEAD_BAND) + gsw->pos = gsw->max; + else + gsw->pos = (uint16_t)((int32_t)(gh->height-1-y-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->height-2*GWIN_SLIDER_DEAD_BAND) + gsw->min); + } else { + if (x > gh->width-GWIN_SLIDER_DEAD_BAND) + gsw->pos = gsw->max; + else if (x < GWIN_SLIDER_DEAD_BAND) + gsw->pos = gsw->min; + else + gsw->pos = (uint16_t)((int32_t)(x-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->width-2*GWIN_SLIDER_DEAD_BAND) + gsw->min); } - #endif - // Set the new position - if (gh->width < gh->height) { - if (y > gh->height-GWIN_SLIDER_DEAD_BAND) - gsw->pos = gsw->min; - else if (y < GWIN_SLIDER_DEAD_BAND) - gsw->pos = gsw->max; - else - gsw->pos = (uint16_t)((int32_t)(gh->height-1-y-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->height-2*GWIN_SLIDER_DEAD_BAND) + gsw->min); - } else { - if (x > gh->width-GWIN_SLIDER_DEAD_BAND) - gsw->pos = gsw->max; - else if (x < GWIN_SLIDER_DEAD_BAND) - gsw->pos = gsw->min; - else - gsw->pos = (uint16_t)((int32_t)(x-GWIN_SLIDER_DEAD_BAND)*(gsw->max-gsw->min)/(gh->width-2*GWIN_SLIDER_DEAD_BAND) + gsw->min); - } + ResetDisplayPos(gsw); + _gwidgetRedraw(gh); - ResetDisplayPos(gsw); - _gwidgetRedraw(gh); - - // Generate the event - SendSliderEvent(gw); - #undef gh - #undef gsw -} - -// A mouse move (or mouse down) event -static void MouseMove(GWidgetObject *gw, coord_t x, coord_t y) { - #define gsw ((GSliderObject *)gw) - - // Determine the temporary display position (with range checking) - if (gw->g.width < gw->g.height) { - if (y < 0) - gsw->dpos = 0; - else if (y >= gw->g.height) - gsw->dpos = gw->g.height-1; - else - gsw->dpos = y; - } else { - if (x < 0) - gsw->dpos = 0; - else if (x >= gw->g.width) - gsw->dpos = gw->g.width-1; - else - gsw->dpos = x; - } - - // Update the display - _gwidgetRedraw(&gw->g); - #undef gsw -} - -// A toggle on has occurred -static void ToggleOn(GWidgetObject *gw, uint16_t role) { - #define gsw ((GSliderObject *)gw) - - if (role) { - gwinSetSliderPosition((GHandle)gw, gsw->pos+(gsw->max-gsw->min)/GWIN_SLIDER_TOGGLE_INC); - SendSliderEvent(gw); - } else { - gwinSetSliderPosition((GHandle)gw, gsw->pos-(gsw->max-gsw->min)/GWIN_SLIDER_TOGGLE_INC); + // Generate the event SendSliderEvent(gw); + #undef gh + #undef gsw } - #undef gsw -} -// A dial move event -static void DialMove(GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max) { -#if GFX_USE_GINPUT && GINPUT_NEED_DIAL - #define gsw ((GSliderObject *)gw) - (void) role; + // A mouse move (or mouse down) event + static void MouseMove(GWidgetObject *gw, coord_t x, coord_t y) { + #define gsw ((GSliderObject *)gw) - // Set the new position - gsw->pos = (uint16_t)((uint32_t)value*(gsw->max-gsw->min)/max + gsw->min); + // Determine the temporary display position (with range checking) + if (gw->g.width < gw->g.height) { + if (y < 0) + gsw->dpos = 0; + else if (y >= gw->g.height) + gsw->dpos = gw->g.height-1; + else + gsw->dpos = y; + } else { + if (x < 0) + gsw->dpos = 0; + else if (x >= gw->g.width) + gsw->dpos = gw->g.width-1; + else + gsw->dpos = x; + } - ResetDisplayPos(gsw); - gwinDraw(&gw->g); - - // Generate the event - SendSliderEvent(gw); - #undef gsw -#else - (void)gw; (void)role; (void)value; (void)max; + // Update the display + _gwidgetRedraw(&gw->g); + #undef gsw + } #endif -} -static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { - if (role) - ((GSliderObject *)gw)->t_up = instance; - else - ((GSliderObject *)gw)->t_dn = instance; -} +#if GINPUT_NEED_TOGGLE + // A toggle on has occurred + static void ToggleOn(GWidgetObject *gw, uint16_t role) { + #define gsw ((GSliderObject *)gw) -static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { - return role ? ((GSliderObject *)gw)->t_up : ((GSliderObject *)gw)->t_dn; -} + if (role) { + gwinSetSliderPosition((GHandle)gw, gsw->pos+(gsw->max-gsw->min)/GWIN_SLIDER_TOGGLE_INC); + SendSliderEvent(gw); + } else { + gwinSetSliderPosition((GHandle)gw, gsw->pos-(gsw->max-gsw->min)/GWIN_SLIDER_TOGGLE_INC); + SendSliderEvent(gw); + } + #undef gsw + } -static void DialAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { - (void) role; - ((GSliderObject *)gw)->dial = instance; -} + static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + if (role) + ((GSliderObject *)gw)->t_up = instance; + else + ((GSliderObject *)gw)->t_dn = instance; + } -static uint16_t DialGet(GWidgetObject *gw, uint16_t role) { - (void) role; - return ((GSliderObject *)gw)->dial; -} + static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { + return role ? ((GSliderObject *)gw)->t_up : ((GSliderObject *)gw)->t_dn; + } +#endif + +#if GINPUT_NEED_DIAL + // A dial move event + static void DialMove(GWidgetObject *gw, uint16_t role, uint16_t value, uint16_t max) { + #define gsw ((GSliderObject *)gw) + (void) role; + + // Set the new position + gsw->pos = (uint16_t)((uint32_t)value*(gsw->max-gsw->min)/max + gsw->min); + + ResetDisplayPos(gsw); + _gwidgetRedraw((GHandle)gw); + + // Generate the event + SendSliderEvent(gw); + #undef gsw + } + + static void DialAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + (void) role; + ((GSliderObject *)gw)->dial = instance; + } + + static uint16_t DialGet(GWidgetObject *gw, uint16_t role) { + (void) role; + return ((GSliderObject *)gw)->dial; + } +#endif + +// The slider VMT table +static const gwidgetVMT sliderVMT = { + { + "Slider", // The classname + sizeof(GSliderObject), // The object size + _gwidgetDestroy, // The destroy routine + _gwidgetRedraw, // The redraw routine + 0, // The after-clear routine + }, + gwinSliderDraw_Std, // The default drawing routine + #if GINPUT_NEED_MOUSE + { + 0, // Process mouse down events (NOT USED) + MouseUp, // Process mouse up events + MouseMove, // Process mouse move events + }, + #endif + #if GINPUT_NEED_TOGGLE + { + 2, // 1 toggle role + ToggleAssign, // Assign Toggles + ToggleGet, // Get Toggles + 0, // Process toggle off events (NOT USED) + ToggleOn, // Process toggle on events + }, + #endif + #if GINPUT_NEED_DIAL + { + 1, // 1 dial roles + DialAssign, // Assign Dials + DialGet, // Get Dials + DialMove, // Process dial move events + }, + #endif +}; GHandle gwinCreateSlider(GSliderObject *gs, const GWidgetInit *pInit) { if (!(gs = (GSliderObject *)_gwidgetCreate(&gs->w, pInit, &sliderVMT))) return 0; - gs->t_dn = (uint16_t) -1; - gs->t_up = (uint16_t) -1; - gs->dial = (uint16_t) -1; + #if GINPUT_NEED_TOGGLE + gs->t_dn = GWIDGET_NO_INSTANCE; + gs->t_up = GWIDGET_NO_INSTANCE; + #endif + #if GINPUT_NEED_DIAL + gs->dial = GWIDGET_NO_INSTANCE; + #endif gs->c = GSliderDefaultColors; gs->min = 0; gs->max = 100; From 5191c278e7195de62b619be58c19ea338c31d54c Mon Sep 17 00:00:00 2001 From: inmarket Date: Sat, 6 Jul 2013 01:46:34 +1000 Subject: [PATCH 29/38] Add Radio buttons (can also be used as a Tab group) --- demos/modules/gwin/widgets/gfxconf.h | 1 + demos/modules/gwin/widgets/main.c | 102 +++++++++-- include/gfx_rules.h | 9 +- include/gwin/gwidget.h | 3 + include/gwin/options.h | 7 + include/gwin/radio.h | 169 +++++++++++++++++ src/gwin/gwin.mk | 1 + src/gwin/radio.c | 260 +++++++++++++++++++++++++++ 8 files changed, 532 insertions(+), 20 deletions(-) create mode 100644 include/gwin/radio.h create mode 100644 src/gwin/radio.c diff --git a/demos/modules/gwin/widgets/gfxconf.h b/demos/modules/gwin/widgets/gfxconf.h index 5cf344e4..1665047c 100644 --- a/demos/modules/gwin/widgets/gfxconf.h +++ b/demos/modules/gwin/widgets/gfxconf.h @@ -80,6 +80,7 @@ #define GWIN_NEED_CHECKBOX TRUE #define GWIN_NEED_LABEL TRUE #define GWIN_NEED_IMAGE TRUE +#define GWIN_NEED_RADIO TRUE /* Features for the GINPUT sub-system. */ #define GINPUT_NEED_MOUSE TRUE diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index fdd5ed43..e44ce6b0 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -30,19 +30,36 @@ static GListener gl; static GHandle ghConsole; +static GHandle ghTabButtons, ghTabSliders, ghTabCheckboxes, ghTabLabels, ghTabRadios, ghTabImages; static GHandle ghButton1, ghButton2, ghButton3, ghButton4; static GHandle ghSlider1, ghSlider2, ghSlider3, ghSlider4; static GHandle ghCheckbox1, ghCheckbox2; static GHandle ghLabel1; +static GHandle ghRadio1, ghRadio2; +//static GHandle ghImage1; #define ScrWidth gdispGetWidth() #define ScrHeight gdispGetHeight() +#define TAB_HEIGHT 30 #define BUTTON_WIDTH 50 #define BUTTON_HEIGHT 30 #define SLIDER_WIDTH 20 #define CHECKBOX_WIDTH 80 #define CHECKBOX_HEIGHT 20 +#define RADIO_WIDTH 50 +#define RADIO_HEIGHT 20 +#define GROUP_TABS 0 +#define GROUP_R1R2 1 + +static GHandle createTab(GWidgetInit *pwi) { + GHandle gh; + + gh = gwinCreateRadio(NULL, pwi, GROUP_TABS); + gwinSetCustomDraw(gh, gwinRadioDraw_Tab, 0); + gwinSetVisible(gh, TRUE); + return gh; +} int main(void) { GEvent * pe; @@ -69,10 +86,17 @@ int main(void) { { GWidgetInit wi; - wi.g.show = TRUE; + // Create the Tabs + wi.g.show = FALSE; wi.g.width = ScrWidth/6; wi.g.height = TAB_HEIGHT; wi.g.y = 0; + wi.g.x = 0*wi.g.width; wi.text = "Buttons"; ghTabButtons = createTab(&wi); + wi.g.x = 1*wi.g.width; wi.text = "Sliders"; ghTabSliders = createTab(&wi); + wi.g.x = 2*wi.g.width; wi.text = "Checkbox"; ghTabCheckboxes = createTab(&wi); + wi.g.x = 3*wi.g.width; wi.text = "Labels"; ghTabLabels = createTab(&wi); + wi.g.x = 4*wi.g.width; wi.text = "Radios"; ghTabRadios = createTab(&wi); + wi.g.x = 5*wi.g.width; wi.text = "Images"; ghTabImages = createTab(&wi); // Buttons - wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT; wi.g.y = 0; + wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT; wi.g.y = TAB_HEIGHT+5; wi.g.x = 0+0*(BUTTON_WIDTH+1); wi.text = "B1"; ghButton1 = gwinCreateButton(NULL, &wi); wi.g.x = 0+1*(BUTTON_WIDTH+1); wi.text = "B2"; ghButton2 = gwinCreateButton(NULL, &wi); wi.g.x = 0+2*(BUTTON_WIDTH+1); wi.text = "B3"; ghButton3 = gwinCreateButton(NULL, &wi); @@ -90,24 +114,25 @@ int main(void) { // Checkboxes - for the 2nd checkbox we apply special drawing before making it visible wi.g.width = CHECKBOX_WIDTH; wi.g.height = CHECKBOX_HEIGHT; wi.g.x = 0; - wi.g.y = BUTTON_HEIGHT+1+0*(CHECKBOX_HEIGHT+1); wi.text = "C1"; ghCheckbox1 = gwinCreateCheckbox(NULL, &wi); - wi.g.show = FALSE; - wi.g.y = BUTTON_HEIGHT+1+1*(CHECKBOX_HEIGHT+1); wi.text = "C2"; ghCheckbox2 = gwinCreateCheckbox(NULL, &wi); + wi.g.y = TAB_HEIGHT+5+0*(CHECKBOX_HEIGHT+1); wi.text = "C1"; ghCheckbox1 = gwinCreateCheckbox(NULL, &wi); + wi.g.y = TAB_HEIGHT+5+1*(CHECKBOX_HEIGHT+1); wi.text = "C2"; ghCheckbox2 = gwinCreateCheckbox(NULL, &wi); gwinSetCustomDraw(ghCheckbox2, gwinCheckboxDraw_CheckOnRight, 0); - gwinSetVisible(ghCheckbox2, TRUE); - wi.g.show = TRUE; wi.g.width = 0; - wi.g.y = BUTTON_HEIGHT+1+2*(CHECKBOX_HEIGHT+1); wi.text = "L1"; ghLabel1 = gwinLabelCreate(NULL, &wi); + // Labels + wi.g.width = 0; // dynamic width + wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "L1"; ghLabel1 = gwinLabelCreate(NULL, &wi); + + // Radio Buttons + wi.g.width = RADIO_WIDTH; wi.g.height = RADIO_HEIGHT; wi.g.y = TAB_HEIGHT+5; + wi.g.x = 0*wi.g.width; wi.text = "Yes"; ghRadio1 = gwinCreateRadio(NULL, &wi, GROUP_R1R2); + wi.g.x = 1*wi.g.width; wi.text = "No"; ghRadio2 = gwinCreateRadio(NULL, &wi, GROUP_R1R2); // Console - we apply some special colors before making it visible - wi.g.show = FALSE; wi.g.width = ScrWidth/2-1; wi.g.height = ScrHeight/2-1; wi.g.x = ScrWidth/2+1; wi.g.y = ScrHeight/2+1; ghConsole = gwinCreateConsole(NULL, &wi.g); gwinSetColor(ghConsole, Yellow); gwinSetBgColor(ghConsole, Black); - gwinSetVisible(ghConsole, TRUE); - gwinClear(ghConsole); } // Assign toggles and dials to the buttons & sliders etc. @@ -120,15 +145,12 @@ int main(void) { gwinAttachDial(ghSlider3, 0, 1); #endif - gfxSleepMilliseconds(5000); - gwinSetBgColor(ghLabel1, Blue); - gwinSetColor(ghLabel1, Yellow); - gwinSetText(ghLabel1, "Very Big Label", FALSE); + // Make the console visible + gwinSetVisible(ghConsole, TRUE); + gwinClear(ghConsole); - gfxSleepMilliseconds(5000); - gwinSetBgColor(ghLabel1, Yellow); - gwinSetColor(ghLabel1, Red); - gwinSetText(ghLabel1, "L1", FALSE); + // Press the Buttons Tab + gwinPressRadio(ghTabButtons); while(1) { // Get an Event @@ -144,6 +166,48 @@ int main(void) { case GEVENT_GWIN_CHECKBOX: gwinPrintf(ghConsole, "Checkbox %s=%s\n", gwinGetText(((GEventGWinCheckbox *)pe)->checkbox), ((GEventGWinCheckbox *)pe)->isChecked ? "Checked" : "UnChecked"); break; + case GEVENT_GWIN_RADIO: + gwinPrintf(ghConsole, "Radio Group %u=%s\n", ((GEventGWinRadio *)pe)->group, gwinGetText(((GEventGWinRadio *)pe)->radio)); + + // Is this the tab radio's + if (((GEventGWinRadio *)pe)->group == GROUP_TABS) { + + // Do some special animation for Label1 + if (((GEventGWinRadio *)pe)->radio == ghTabLabels) { + gwinSetBgColor(ghLabel1, gwinGetDefaultBgColor()); + gwinSetColor(ghLabel1, gwinGetDefaultColor()); + } + + // Set control visibility depending on the tab selected + gwinSetVisible(ghButton1, ((GEventGWinRadio *)pe)->radio == ghTabButtons); + gwinSetVisible(ghButton2, ((GEventGWinRadio *)pe)->radio == ghTabButtons); + gwinSetVisible(ghButton3, ((GEventGWinRadio *)pe)->radio == ghTabButtons); + gwinSetVisible(ghButton4, ((GEventGWinRadio *)pe)->radio == ghTabButtons); + gwinSetVisible(ghSlider1, ((GEventGWinRadio *)pe)->radio == ghTabSliders); + gwinSetVisible(ghSlider2, ((GEventGWinRadio *)pe)->radio == ghTabSliders); + gwinSetVisible(ghSlider3, ((GEventGWinRadio *)pe)->radio == ghTabSliders); + gwinSetVisible(ghSlider4, ((GEventGWinRadio *)pe)->radio == ghTabSliders); + gwinSetVisible(ghCheckbox1, ((GEventGWinRadio *)pe)->radio == ghTabCheckboxes); + gwinSetVisible(ghCheckbox2, ((GEventGWinRadio *)pe)->radio == ghTabCheckboxes); + gwinSetVisible(ghLabel1, ((GEventGWinRadio *)pe)->radio == ghTabLabels); + gwinSetVisible(ghRadio1, ((GEventGWinRadio *)pe)->radio == ghTabRadios); + gwinSetVisible(ghRadio2, ((GEventGWinRadio *)pe)->radio == ghTabRadios); + //gwinSetVisible(ghImage1, ((GEventGWinRadio *)pe)->radio == ghTabImages); + + // Do some special animation for Label1 + if (((GEventGWinRadio *)pe)->radio == ghTabLabels) { + gfxSleepMilliseconds(1000); + gwinSetBgColor(ghLabel1, Blue); + gwinSetColor(ghLabel1, Yellow); + gwinSetText(ghLabel1, "Very Big Label", FALSE); + + gfxSleepMilliseconds(1000); + gwinSetBgColor(ghLabel1, Yellow); + gwinSetColor(ghLabel1, Red); + gwinSetText(ghLabel1, "L1", FALSE); + } + } + break; default: gwinPrintf(ghConsole, "Unknown %d\n", pe->type); break; diff --git a/include/gfx_rules.h b/include/gfx_rules.h index bfe017d3..ddad82a7 100644 --- a/include/gfx_rules.h +++ b/include/gfx_rules.h @@ -51,7 +51,14 @@ #error "GWIN: GDISP_NEED_IMAGE is required when GWIN_NEED_IMAGE is TRUE." #endif #endif - #if GWIN_NEED_BUTTON || GWIN_NEED_SLIDER || GWIN_NEED_CHECKBOX || GWIN_NEED_LABEL + #if GWIN_NEED_RADIO + #if !GDISP_NEED_CIRCLE + #if GFX_DISPLAY_RULE_WARNINGS + #warning "GWIN: GDISP_NEED_CIRCLE should be set to TRUE for much nicer radio button widgets." + #endif + #endif + #endif + #if GWIN_NEED_BUTTON || GWIN_NEED_SLIDER || GWIN_NEED_CHECKBOX || GWIN_NEED_LABEL || GWIN_NEED_RADIO #if !GWIN_NEED_WIDGET #if GFX_DISPLAY_RULE_WARNINGS #warning "GWIN: GWIN_NEED_WIDGET is required when a Widget is used. It has been turned on for you." diff --git a/include/gwin/gwidget.h b/include/gwin/gwidget.h index a2cf7337..ffd8e26f 100644 --- a/include/gwin/gwidget.h +++ b/include/gwin/gwidget.h @@ -195,6 +195,9 @@ bool_t gwinAttachListener(GListener *pl); #if GWIN_NEED_CHECKBOX || defined(__DOXYGEN__) #include "gwin/checkbox.h" #endif +#if GWIN_NEED_RADIO || defined(__DOXYGEN__) + #include "gwin/radio.h" +#endif #endif /* _GWIDGET_H */ /** @} */ diff --git a/include/gwin/options.h b/include/gwin/options.h index 11ab7d44..5de2e43b 100644 --- a/include/gwin/options.h +++ b/include/gwin/options.h @@ -83,6 +83,13 @@ #ifndef GWIN_NEED_LABEL #define GWIN_NEED_LABEL FALSE #endif + /** + * @brief Should radio button functions be included. + * @details Defaults to FALSE + */ + #ifndef GWIN_NEED_RADIO + #define GWIN_NEED_RADIO FALSE + #endif /** * @} * diff --git a/include/gwin/radio.h b/include/gwin/radio.h new file mode 100644 index 00000000..8d4e32a7 --- /dev/null +++ b/include/gwin/radio.h @@ -0,0 +1,169 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ + +/** + * @file include/gwin/radio.h + * @brief GWIN Graphic window subsystem header file. + * + * @defgroup RadioButton RadioButton + * @ingroup GWIN + * + * @details GWIN allows it to easily create radio buttons with different styles. + * + * @pre GFX_USE_GWIN must be set to TRUE in your gfxconf.h + * @pre GWIN_NEED_RADIO must be set to TRUE in your gfxconf.h + * @{ + */ + +#ifndef _GWIN_RADIO_H +#define _GWIN_RADIO_H + +/* This file is included within "gwin/gwidget.h" */ + +/** + * @brief The Event Type for a Radio Event + */ +#define GEVENT_GWIN_RADIO (GEVENT_GWIN_FIRST+3) + +/** + * @brief A Button Event + * @note There are currently no GEventGWinRadio listening flags - use 0 as the flags to @p gwinAttachListener() + */ +typedef struct GEventGWinRadio { + GEventType type; // The type of this event (GEVENT_GWIN_RADIO) + GHandle radio; // The radio button that has been depressed + uint16_t group; // The group for this radio button +} GEventGWinRadio; + +/** + * @brief Button colors + */ +typedef struct GRadioColors { + color_t color_edge; + color_t color_fill; + color_t color_txt; +} GRadioColors; + +/** + * @brief The radio button widget structure + * @note Do not use the members directly - treat it as a black-box. + */ +typedef struct GRadioObject_t { + GWidgetObject w; + #if GINPUT_NEED_TOGGLE + uint16_t toggle; + #endif + uint16_t group; + GRadioColors c_up; + GRadioColors c_dn; + GRadioColors c_dis; +} GRadioObject; + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @brief Create a radio widget. + * @return NULL if there is no resultant drawing area, otherwise a window handle. + * + * @param[in] gb The GRadioObject structure to initialise. If this is NULL the structure is dynamically allocated. + * @param[in] pInit The initialisation parameters + * @param[in] group The group of radio buttons this radio button belongs to. + * + * @note Only one radio button in any group is ever pressed at one time. Pressing one radio button will + * release all others in the group. + * @note The drawing color and the background color get set to the current defaults. If you haven't called + * @p gwinSetDefaultColor() or @p gwinSetDefaultBgColor() then these are White and Black respectively. + * @note The font gets set to the current default font. If you haven't called @p gwinSetDefaultFont() then there + * is no default font and text drawing operations will no nothing. + * @note A radio button remembers its normal drawing state. If there is a window manager then it is automatically + * redrawn if the window is moved or its visibility state is changed. + * @note A radio button supports mouse and a toggle input. + * @note When assigning a toggle, only one toggle is supported. If you try to assign more than one toggle it will + * forget the previous toggle. When assigning a toggle the role parameter must be 0. + * + * @api + */ +GHandle gwinCreateRadio(GRadioObject *gb, const GWidgetInit *pInit, uint16_t group); + +/** + * @brief Set the colors of a button. + * + * @param[in] gh The window handle (must be a radio widget) + * @param[in] pUp The colors for the button when in the up state. + * @param[in] pDown The colors for the button when in the down state. + * @param[in] pDisabled The colors for the button when it is disabled. + * + * @note The button is not automatically redrawn. Call gwinButtonDraw() after changing the button style + * @note The button style is copied into the internal button structure - there is no need to + * maintain static style structures (they can be temporary structures on the stack). + * @note The pUp, pDown and pDisabled parameters can be NULL. If they are then the existing color styles + * are not changed for that button state. + * @note Some custom drawn buttons will ignore he specified colors + * + * @api + */ +void gwinSetRadioColors(GHandle gh, const GRadioColors *pUp, const GRadioColors *pDown, const GRadioColors *pDisabled); + +/** + * @brief Press this radio button (and by definition unset any others in the group) + * + * @param[in] gh The window handle (must be a radio widget) + * + * @api + */ +void gwinPressRadio(GHandle gh); + +/** + * @brief Is the radio button currently pressed + * @return TRUE if the button is pressed + * + * @param[in] gh The window handle (must be a radio widget) + * + * @api + */ +bool_t gwinIsRadioPressed(GHandle gh); + +/** + * @brief Find the currently pressed radio button in the specified group + * @return The handle of the pressed radio button or NULL if none are pressed + * + * @param[in] gh The window handle (must be a radio widget) + * + * @api + */ +GHandle gwinActiveRadio(uint16_t group); + +/** + * @brief Some custom radio button drawing routines + * @details These function may be passed to @p gwinSetCustomDraw() to get different radio button drawing styles + * + * @param[in] gw The widget object (in this case a radio button) + * @param[in] param A parameter passed in from the user + * + * @note In your custom radio drawing function you may optionally call these + * standard functions and then draw your extra details on top. + * @note The standard functions below ignore the param parameter. + * @note These custom drawing routines don't have to worry about setting clipping as the framework + * sets clipping to the object window prior to calling these routines. + * + * @api + * @{ + */ +void gwinRadioDraw_Radio(GWidgetObject *gw, void *param); // @< A standard radio button +void gwinRadioDraw_Button(GWidgetObject *gw, void *param); // @< Draw as a button +void gwinRadioDraw_Tab(GWidgetObject *gw, void *param); // @< Draw as a tab +/** @} */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GWIN_RADIO_H */ +/** @} */ + diff --git a/src/gwin/gwin.mk b/src/gwin/gwin.mk index b9e6a9ee..92b10b7b 100644 --- a/src/gwin/gwin.mk +++ b/src/gwin/gwin.mk @@ -8,4 +8,5 @@ GFXSRC += $(GFXLIB)/src/gwin/gwin.c \ $(GFXLIB)/src/gwin/checkbox.c \ $(GFXLIB)/src/gwin/gimage.c \ $(GFXLIB)/src/gwin/label.c \ + $(GFXLIB)/src/gwin/radio.c \ diff --git a/src/gwin/radio.c b/src/gwin/radio.c new file mode 100644 index 00000000..d1c65dbc --- /dev/null +++ b/src/gwin/radio.c @@ -0,0 +1,260 @@ +/* + * This file is subject to the terms of the GFX License. If a copy of + * the license was not distributed with this file, you can obtain one at: + * + * http://chibios-gfx.com/license.html + */ + +/** + * @file src/gwin/radio.c + * @brief GWIN sub-system radio button code. + * + * @defgroup RadioButton RadioButton + * @ingroup GWIN + * + * @{ + */ + +#include "gfx.h" + +#if GFX_USE_GWIN && GWIN_NEED_RADIO + +#include "gwin/class_gwin.h" + +// Our pressed state +#define GRADIO_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0) + +// Default color scheme +static const GRadioColors GRadioDefaultColorsUp = { + HTML2COLOR(0x404040), // color_up_edge; + HTML2COLOR(0xE0E0E0), // color_up_fill; + HTML2COLOR(0x000000), // color_up_txt; +}; +static const GRadioColors GRadioDefaultColorsDown = { + HTML2COLOR(0x404040), // color_dn_edge; + HTML2COLOR(0x808080), // color_dn_fill; + HTML2COLOR(0x404040), // color_dn_txt; +}; +static const GRadioColors GRadioDefaultColorsDisabled = { + HTML2COLOR(0x808080), // color_dis_edge; + HTML2COLOR(0xE0E0E0), // color_dis_fill; + HTML2COLOR(0xC0C0C0), // color_dis_txt; +}; + +// Send the button event +static void SendButtonEvent(GWidgetObject *gw) { + GSourceListener * psl; + GEvent * pe; + #define pbe ((GEventGWinRadio *)pe) + + // Trigger a GWIN Button Event + psl = 0; + while ((psl = geventGetSourceListener(GWIDGET_SOURCE, psl))) { + if (!(pe = geventGetEventBuffer(psl))) + continue; + pbe->type = GEVENT_GWIN_RADIO; + pbe->radio = (GHandle)gw; + pbe->group = ((GRadioObject *)gw)->group; + geventSendEvent(psl); + } + + #undef pbe +} + +#if GINPUT_NEED_MOUSE + // A mouse down has occurred over the button + static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { + (void) x; (void) y; + + gwinPressRadio((GHandle)gw); + } +#endif + +#if GINPUT_NEED_TOGGLE + // A toggle on has occurred + static void ToggleOn(GWidgetObject *gw, uint16_t role) { + (void) role; + + gwinPressRadio((GHandle)gw); + } + + static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { + (void) role; + ((GRadioObject *)gw)->toggle = instance; + } + + static uint16_t ToggleGet(GWidgetObject *gw, uint16_t role) { + (void) role; + return ((GRadioObject *)gw)->toggle; + } +#endif + +// The radio button VMT table +static const gwidgetVMT radioVMT = { + { + "Radio", // The classname + sizeof(GRadioObject), // The object size + _gwidgetDestroy, // The destroy routine + _gwidgetRedraw, // The redraw routine + 0, // The after-clear routine + }, + gwinRadioDraw_Radio, // The default drawing routine + #if GINPUT_NEED_MOUSE + { + MouseDown, // Process mouse down events + 0, // Process mouse up events (NOT USED) + 0, // Process mouse move events (NOT USED) + }, + #endif + #if GINPUT_NEED_TOGGLE + { + 1, // 1 toggle role + ToggleAssign, // Assign Toggles + ToggleGet, // Get Toggles + 0, // Process toggle off events (NOT USED) + ToggleOn, // Process toggle on events + }, + #endif + #if GINPUT_NEED_DIAL + { + 0, // No dial roles + 0, // Assign Dials (NOT USED) + 0, // Get Dials (NOT USED) + 0, // Process dial move events (NOT USED) + }, + #endif +}; + +GHandle gwinCreateRadio(GRadioObject *gw, const GWidgetInit *pInit, uint16_t group) { + if (!(gw = (GRadioObject *)_gwidgetCreate(&gw->w, pInit, &radioVMT))) + return 0; + + #if GINPUT_NEED_TOGGLE + gw->toggle = GWIDGET_NO_INSTANCE; + #endif + gw->group = group; + gw->c_up = GRadioDefaultColorsUp; + gw->c_dn = GRadioDefaultColorsDown; + gw->c_dis = GRadioDefaultColorsDisabled; + gwinSetVisible((GHandle)gw, pInit->g.show); + return (GHandle)gw; +} + +void gwinSetRadioColors(GHandle gh, const GRadioColors *pUp, const GRadioColors *pDown, const GRadioColors *pDisabled) { + if (gh->vmt != (gwinVMT *)&radioVMT) + return; + + if (pUp) ((GRadioObject *)gh)->c_up = *pUp; + if (pDown) ((GRadioObject *)gh)->c_dn = *pDown; + if (pDisabled) ((GRadioObject *)gh)->c_dis = *pDisabled; +} + +void gwinPressRadio(GHandle gh) { + GHandle gx; + + if (gh->vmt != (gwinVMT *)&radioVMT || (gh->flags & GRADIO_FLG_PRESSED)) + return; + + if ((gx = gwinActiveRadio(((GRadioObject *)gh)->group))) { + gx->flags &= ~GRADIO_FLG_PRESSED; + _gwidgetRedraw(gx); + } + gh->flags |= GRADIO_FLG_PRESSED; + _gwidgetRedraw(gh); + SendButtonEvent((GWidgetObject *)gh); +} + +bool_t gwinIsRadioPressed(GHandle gh) { + if (gh->vmt != (gwinVMT *)&radioVMT) + return FALSE; + + return (gh->flags & GRADIO_FLG_PRESSED) ? TRUE : FALSE; +} + +/** + * @brief Find the currently pressed radio button in the specified group + * @return The handle of the pressed radio button or NULL if none are pressed + * + * @param[in] gh The window handle (must be a radio widget) + * + * @api + */ +GHandle gwinActiveRadio(uint16_t group) { + const gfxQueueASyncItem * qi; + GHandle gh; + + for(qi = gfxQueueASyncPeek(&_GWINList); qi; qi = gfxQueueASyncNext(qi)) { + gh = QItem2GWindow(qi); + if (gh->vmt == (gwinVMT *)&radioVMT && ((GRadioObject *)gh)->group == group && (gh->flags & GRADIO_FLG_PRESSED)) + return gh; + } + return 0; +} + +/*---------------------------------------------------------- + * Custom Draw Routines + *----------------------------------------------------------*/ + +static GRadioColors *getDrawColors(GWidgetObject *gw) { + if (!(gw->g.flags & GWIN_FLG_ENABLED)) return &((GRadioObject *)gw)->c_dis; + if ((gw->g.flags & GRADIO_FLG_PRESSED)) return &((GRadioObject *)gw)->c_dn; + return &((GRadioObject *)gw)->c_up; +} + +void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) { + #define gcw ((GRadioObject *)gw) + coord_t ld, df; + GRadioColors * pcol; + (void) param; + + if (gw->g.vmt != (gwinVMT *)&radioVMT) return; + pcol = getDrawColors(gw); + + ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height; + + #if GDISP_NEED_CIRCLE + df = ld/2; + gdispFillArea(gw->g.x, gw->g.y, ld, ld, gw->g.bgcolor); + gdispDrawCircle(gw->g.x+df, gw->g.y+df, df, pcol->color_edge); + + if (gw->g.flags & GRADIO_FLG_PRESSED) + gdispFillCircle(gw->g.x+df, gw->g.y+df, df <= 2 ? 1 : (df-2), pcol->color_fill); + #else + gdispFillArea(gw->g.x+1, gw->g.y+1, ld, ld-2, gw->g.bgcolor); + gdispDrawBox(gw->g.x, gw->g.y, ld, ld, pcol->color_edge); + + df = ld < 4 ? 1 : 2; + if (gw->g.flags & GRADIO_FLG_PRESSED) + gdispFillArea(gw->g.x+df, gw->g.y+df, ld-2*df, ld-2*df, pcol->color_fill); + #endif + + gdispFillStringBox(gw->g.x+ld+1, gw->g.y, gw->g.width-ld-1, gw->g.height, gw->txt, gw->g.font, pcol->color_txt, gw->g.bgcolor, justifyLeft); + #undef gcw +} + +void gwinRadioDraw_Button(GWidgetObject *gw, void *param) { + (void) param; + GRadioColors * pcol; + + if (gw->g.vmt != (gwinVMT *)&radioVMT) return; + pcol = getDrawColors(gw); + + gdispFillStringBox(gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->txt, gw->g.font, pcol->color_txt, pcol->color_fill, justifyCenter); + gdispDrawLine(gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->color_edge); + gdispDrawLine(gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->color_edge); +} + +void gwinRadioDraw_Tab(GWidgetObject *gw, void *param) { + (void) param; + GRadioColors * pcol; + + if (gw->g.vmt != (gwinVMT *)&radioVMT) return; + pcol = getDrawColors(gw); + + gdispFillStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, pcol->color_fill, justifyCenter); + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->color_edge); +} + +#endif /* GFX_USE_GWIN && GWIN_NEED_BUTTON */ +/** @} */ + From f2432096cd823bb781d0574492b47c71bd340e1a Mon Sep 17 00:00:00 2001 From: Joel Bodenmann Date: Sat, 6 Jul 2013 14:24:40 +0200 Subject: [PATCH 30/38] added GWIN image demo --- demos/modules/gwin/widgets/image_chibios.h | 637 +++++++++++++++++++++ demos/modules/gwin/widgets/main.c | 13 +- 2 files changed, 648 insertions(+), 2 deletions(-) create mode 100644 demos/modules/gwin/widgets/image_chibios.h diff --git a/demos/modules/gwin/widgets/image_chibios.h b/demos/modules/gwin/widgets/image_chibios.h new file mode 100644 index 00000000..a052395f --- /dev/null +++ b/demos/modules/gwin/widgets/image_chibios.h @@ -0,0 +1,637 @@ +static const unsigned char image_chibios[] = { + 0x47, 0x49, 0x46, 0x38, 0x37, 0x61, 0x74, 0x00, 0x74, 0x00, 0xE7, 0xFE, 0x00, 0x08, 0x07, 0x02, + 0x00, 0x0A, 0x03, 0x08, 0x07, 0x0E, 0x05, 0x0D, 0x00, 0x00, 0x11, 0x02, 0x03, 0x16, 0x01, 0x09, + 0x15, 0x00, 0x00, 0x19, 0x03, 0x14, 0x16, 0x06, 0x00, 0x1D, 0x02, 0x07, 0x1C, 0x01, 0x0F, 0x1A, + 0x01, 0x2D, 0x12, 0x0F, 0x09, 0x1F, 0x00, 0x1F, 0x18, 0x10, 0x03, 0x22, 0x02, 0x10, 0x1F, 0x00, + 0x19, 0x1B, 0x1E, 0x01, 0x26, 0x00, 0x1C, 0x1D, 0x0B, 0x18, 0x21, 0x04, 0x17, 0x20, 0x13, 0x12, + 0x24, 0x00, 0x0B, 0x26, 0x01, 0x0A, 0x22, 0x2F, 0x17, 0x22, 0x0E, 0x02, 0x2C, 0x00, 0x0A, 0x2B, + 0x00, 0x3B, 0x1A, 0x1A, 0x14, 0x27, 0x0D, 0x11, 0x2A, 0x00, 0x17, 0x2A, 0x06, 0x00, 0x33, 0x00, + 0x08, 0x31, 0x00, 0x12, 0x30, 0x00, 0x21, 0x2A, 0x11, 0x23, 0x27, 0x2C, 0x0E, 0x32, 0x0A, 0x1D, + 0x2F, 0x01, 0x0D, 0x35, 0x05, 0x07, 0x38, 0x00, 0x18, 0x32, 0x0C, 0x24, 0x2D, 0x1B, 0x2D, 0x2A, + 0x21, 0x10, 0x36, 0x00, 0x1F, 0x31, 0x12, 0x18, 0x35, 0x00, 0x16, 0x35, 0x06, 0x20, 0x33, 0x0D, + 0x20, 0x32, 0x19, 0x0D, 0x3D, 0x06, 0x15, 0x3B, 0x05, 0x10, 0x3D, 0x00, 0x06, 0x40, 0x00, 0x23, + 0x34, 0x3B, 0x1F, 0x3B, 0x0E, 0x2C, 0x36, 0x1A, 0x49, 0x2D, 0x22, 0x3F, 0x31, 0x1F, 0x1F, 0x3D, + 0x08, 0x1B, 0x3F, 0x01, 0x15, 0x41, 0x03, 0x21, 0x3E, 0x02, 0x12, 0x43, 0x00, 0x1A, 0x40, 0x0B, + 0x28, 0x3B, 0x16, 0x29, 0x3C, 0x10, 0x2F, 0x38, 0x2C, 0x22, 0x3E, 0x17, 0x2F, 0x39, 0x25, 0x29, + 0x3C, 0x1F, 0x38, 0x37, 0x3A, 0x11, 0x48, 0x08, 0x14, 0x48, 0x00, 0x0C, 0x4B, 0x03, 0x1A, 0x47, + 0x09, 0x1D, 0x47, 0x01, 0x23, 0x46, 0x12, 0x12, 0x4E, 0x00, 0x1B, 0x4C, 0x00, 0x25, 0x48, 0x0B, + 0x1A, 0x4D, 0x05, 0x1F, 0x4C, 0x0E, 0x22, 0x4C, 0x06, 0x33, 0x46, 0x1A, 0x2E, 0x47, 0x21, 0x0D, + 0x54, 0x02, 0x37, 0x43, 0x2F, 0x2A, 0x4C, 0x06, 0x39, 0x44, 0x2A, 0x18, 0x52, 0x01, 0x17, 0x53, + 0x0B, 0x31, 0x4A, 0x1D, 0x20, 0x52, 0x0B, 0x38, 0x48, 0x28, 0x34, 0x49, 0x2E, 0x1B, 0x55, 0x04, + 0x16, 0x58, 0x00, 0x25, 0x52, 0x14, 0x25, 0x54, 0x04, 0x14, 0x59, 0x07, 0x1F, 0x57, 0x00, 0x29, + 0x53, 0x0E, 0x2F, 0x51, 0x15, 0x3C, 0x49, 0x41, 0x1F, 0x58, 0x07, 0x2F, 0x51, 0x1E, 0x25, 0x57, + 0x10, 0x1C, 0x5C, 0x01, 0x13, 0x60, 0x03, 0x44, 0x4C, 0x3A, 0x1B, 0x5D, 0x0D, 0x47, 0x4A, 0x4D, + 0x5A, 0x47, 0x3C, 0x24, 0x5C, 0x0D, 0x27, 0x5D, 0x03, 0x20, 0x60, 0x05, 0x1B, 0x64, 0x00, 0x1A, + 0x64, 0x09, 0x3E, 0x51, 0x5D, 0x25, 0x62, 0x00, 0x2F, 0x5D, 0x18, 0x41, 0x55, 0x36, 0x42, 0x52, + 0x52, 0x31, 0x5E, 0x10, 0x32, 0x5C, 0x21, 0x24, 0x63, 0x0A, 0x40, 0x5B, 0x19, 0x2C, 0x63, 0x15, + 0x3C, 0x5E, 0x1A, 0x4C, 0x56, 0x3C, 0x19, 0x6B, 0x05, 0x4D, 0x56, 0x43, 0x1F, 0x69, 0x0F, 0x24, + 0x6A, 0x05, 0x7D, 0x49, 0x47, 0x51, 0x59, 0x33, 0x4C, 0x58, 0x4F, 0x2D, 0x6A, 0x06, 0x5B, 0x55, + 0x52, 0x2C, 0x6A, 0x12, 0x44, 0x61, 0x2C, 0x23, 0x70, 0x00, 0x20, 0x71, 0x0D, 0x34, 0x6A, 0x18, + 0x3B, 0x68, 0x19, 0x2A, 0x6F, 0x0D, 0x3D, 0x69, 0x25, 0x44, 0x68, 0x2B, 0x20, 0x79, 0x0A, 0x2A, + 0x77, 0x09, 0x30, 0x75, 0x14, 0x58, 0x64, 0x48, 0x4F, 0x68, 0x42, 0x34, 0x77, 0x0A, 0x55, 0x64, + 0x67, 0x3B, 0x73, 0x1F, 0x3A, 0x75, 0x15, 0x53, 0x68, 0x4D, 0x5C, 0x65, 0x5C, 0x61, 0x66, 0x54, + 0x49, 0x72, 0x30, 0x2D, 0x7F, 0x05, 0x2D, 0x7E, 0x12, 0x4A, 0x77, 0x29, 0x58, 0x72, 0x4A, 0x3D, + 0x81, 0x22, 0x48, 0x80, 0x2A, 0x62, 0x74, 0x5A, 0x61, 0x75, 0x6D, 0x6C, 0x73, 0x62, 0x5F, 0x75, + 0x76, 0x55, 0x7F, 0x3C, 0x6E, 0x73, 0x6D, 0x72, 0x75, 0x7C, 0x56, 0x8D, 0x2F, 0x46, 0x92, 0x30, + 0x54, 0x8D, 0x3B, 0x62, 0x89, 0x3F, 0x7A, 0x81, 0x73, 0x7B, 0x82, 0x6C, 0x6F, 0x89, 0x5D, 0x76, + 0x86, 0x6B, 0x76, 0x85, 0x89, 0x69, 0x8F, 0x50, 0x7C, 0x87, 0x82, 0x6E, 0x95, 0x4C, 0x82, 0x93, + 0x8D, 0x7B, 0x96, 0x84, 0x8C, 0x92, 0x7C, 0x67, 0xA2, 0x4F, 0x8B, 0x93, 0x84, 0x81, 0x96, 0x9B, + 0x87, 0x98, 0x79, 0x8D, 0x93, 0x99, 0x91, 0xA5, 0x84, 0x90, 0xA3, 0x9C, 0xA1, 0x9F, 0x95, 0x89, + 0xAB, 0x6D, 0x9B, 0xA4, 0x96, 0x91, 0xA7, 0xA6, 0x8F, 0xA8, 0xB0, 0xA2, 0xA7, 0x91, 0xA0, 0xA6, + 0xB1, 0xAA, 0xB1, 0xA1, 0x9F, 0xB7, 0xA7, 0xA6, 0xB4, 0xBB, 0xA2, 0xB8, 0xB0, 0x9C, 0xB9, 0xBE, + 0xA8, 0xB9, 0x9B, 0xB2, 0xB7, 0x9D, 0xBC, 0xB7, 0xB5, 0xC2, 0xC0, 0xA5, 0xAD, 0xC7, 0xC4, 0xA4, + 0xC9, 0xD5, 0xC1, 0xC4, 0xB7, 0xBD, 0xC7, 0xB3, 0xAB, 0xCA, 0xCD, 0xB7, 0xCC, 0xB2, 0xBD, 0xCB, + 0xD5, 0xC9, 0xCD, 0xCB, 0xC8, 0xD3, 0xAD, 0xBB, 0xD6, 0xD2, 0xAF, 0xDC, 0xE4, 0xBE, 0xD9, 0xE2, + 0xC7, 0xDA, 0xC1, 0xD3, 0xD6, 0xC8, 0xD0, 0xDA, 0xC5, 0xCA, 0xD9, 0xE6, 0xDE, 0xDD, 0xC0, 0xD6, + 0xE5, 0xDF, 0xD9, 0xE5, 0xF2, 0xDF, 0xEA, 0xD3, 0xC5, 0xEF, 0xF4, 0xDC, 0xEA, 0xEA, 0xE7, 0xE9, + 0xD9, 0xD3, 0xED, 0xF5, 0xEA, 0xE8, 0xEC, 0xEB, 0xEC, 0xE9, 0xE6, 0xF2, 0xFC, 0xF6, 0xF4, 0xEB, + 0xF0, 0xFA, 0xDA, 0xEC, 0xFB, 0xFB, 0xFA, 0xF7, 0xFC, 0xF2, 0xFC, 0xE3, 0xF7, 0xF9, 0xF5, 0xF3, + 0xFE, 0xEB, 0xFF, 0xFB, 0xFA, 0xFA, 0xFE, 0xEC, 0xFB, 0xFD, 0xF9, 0xF5, 0xFF, 0xFA, 0xF8, 0xFF, + 0xF4, 0xF9, 0xFE, 0xFF, 0xFF, 0xFE, 0xF5, 0xFF, 0xFD, 0xFF, 0xFD, 0xFF, 0xFC, 0x2C, 0x00, 0x00, + 0x00, 0x00, 0x74, 0x00, 0x74, 0x00, 0x00, 0x08, 0xFE, 0x00, 0xFF, 0xFD, 0xF3, 0xE7, 0x4F, 0xA0, + 0x40, 0x82, 0xFE, 0xF8, 0xC9, 0x93, 0xF7, 0xEF, 0x5E, 0xC1, 0x7C, 0xFC, 0xFE, 0xE9, 0x3B, 0x88, + 0xB0, 0x5F, 0xBF, 0x81, 0x06, 0x33, 0x6A, 0xDC, 0x48, 0x11, 0x21, 0xC7, 0x8C, 0x08, 0x43, 0x8A, + 0x2C, 0xD8, 0x51, 0xE4, 0xC7, 0x93, 0x1C, 0x23, 0x7A, 0xA4, 0xF8, 0x8F, 0x9F, 0xCB, 0x86, 0x04, + 0xF9, 0x4D, 0xFC, 0x57, 0x6F, 0xE0, 0x4A, 0x94, 0x38, 0x73, 0x6A, 0x2C, 0x48, 0xD2, 0x60, 0x48, + 0x90, 0x23, 0x7B, 0xEA, 0x44, 0xF9, 0x53, 0x60, 0x3E, 0x81, 0xFC, 0xF2, 0xDD, 0x73, 0xE8, 0xEF, + 0xDE, 0x3F, 0x8B, 0x30, 0x85, 0x0E, 0xD5, 0x18, 0x91, 0xE3, 0xC8, 0xA9, 0x58, 0xB3, 0x66, 0x9C, + 0x68, 0xF2, 0x68, 0xD4, 0xA5, 0x4E, 0x9F, 0xDA, 0xB3, 0xD7, 0x8F, 0x69, 0x55, 0xAD, 0x27, 0x83, + 0x4A, 0x35, 0xE8, 0xF2, 0x2C, 0xDA, 0xB7, 0x25, 0x0D, 0x2E, 0x6D, 0x9A, 0x11, 0xDF, 0xB8, 0x6E, + 0xE8, 0x2E, 0xC6, 0x3C, 0x08, 0xF7, 0x23, 0xC9, 0x97, 0x7D, 0xAD, 0xAE, 0xD5, 0x4A, 0xD0, 0x60, + 0xCD, 0x7C, 0x47, 0xBD, 0x62, 0x33, 0x02, 0xC1, 0xC3, 0x0D, 0x6D, 0x17, 0x5B, 0xFA, 0x1C, 0x9C, + 0xF6, 0x66, 0x60, 0xAC, 0x85, 0x2F, 0x03, 0x7E, 0x6A, 0x71, 0x9F, 0xBE, 0xCF, 0x05, 0x44, 0xF4, + 0xE8, 0x21, 0xC2, 0xC2, 0x38, 0xB6, 0x72, 0x29, 0x6F, 0xBC, 0xBA, 0xDA, 0xB2, 0xE0, 0xAB, 0xAA, + 0xFB, 0x66, 0x6E, 0x59, 0xB5, 0x9F, 0x8A, 0x01, 0x04, 0x3A, 0x64, 0xD9, 0x37, 0xAB, 0xC1, 0x24, + 0x48, 0x63, 0xCC, 0x5C, 0xC0, 0xC1, 0x57, 0xE0, 0xDC, 0xA1, 0x57, 0x37, 0xDB, 0x9C, 0x8D, 0xF4, + 0xAC, 0xDA, 0xA2, 0x97, 0x81, 0xB2, 0xAD, 0xEA, 0xA6, 0xC1, 0x0E, 0x1E, 0x40, 0x0E, 0x60, 0xFA, + 0x95, 0x22, 0xD4, 0x2B, 0x48, 0x7C, 0x76, 0xFE, 0x28, 0xD8, 0x67, 0xD3, 0x28, 0x73, 0x83, 0x89, + 0x77, 0x86, 0x8C, 0xE8, 0x36, 0xE3, 0x3E, 0x7C, 0xFB, 0x3C, 0xD3, 0x6E, 0x5B, 0xF5, 0x28, 0x41, + 0xA6, 0x09, 0x41, 0x1E, 0xAD, 0xF9, 0x76, 0x76, 0x55, 0x7C, 0x10, 0x9C, 0xD1, 0x85, 0x16, 0x5D, + 0xB0, 0xF0, 0x81, 0x36, 0x05, 0xC8, 0x72, 0xCA, 0x2B, 0x7C, 0xB8, 0xD0, 0xC0, 0x45, 0x4E, 0x79, + 0xE5, 0xD5, 0x49, 0x12, 0x7A, 0x55, 0x9F, 0x40, 0x13, 0xF5, 0x13, 0xDF, 0x38, 0xCC, 0xD8, 0x12, + 0x04, 0x11, 0x29, 0x5C, 0x90, 0x80, 0x02, 0x31, 0x5C, 0x81, 0xC6, 0x27, 0xC7, 0x88, 0xB3, 0x8F, + 0x86, 0x91, 0xFD, 0xB3, 0x9F, 0x57, 0xCC, 0x4D, 0x98, 0x95, 0x54, 0x05, 0x81, 0xD2, 0x00, 0x29, + 0x8A, 0x28, 0x52, 0x46, 0x1E, 0x1E, 0xE0, 0x33, 0x82, 0x0F, 0xA4, 0x8C, 0x31, 0xC5, 0x0D, 0x0B, + 0x90, 0x07, 0x15, 0x44, 0xED, 0x65, 0x74, 0x18, 0x47, 0xFA, 0x68, 0x68, 0xCF, 0x38, 0x98, 0xE0, + 0x10, 0x44, 0x03, 0x0F, 0xA4, 0x20, 0xC2, 0x03, 0x12, 0x84, 0xC0, 0xC2, 0x0C, 0x40, 0x9C, 0x70, + 0xC2, 0x0B, 0x25, 0x5C, 0x70, 0x40, 0x01, 0x0D, 0xE8, 0x86, 0x09, 0x36, 0x1A, 0xBA, 0xB8, 0x51, + 0x4D, 0xF5, 0xC8, 0x08, 0x97, 0x47, 0x6E, 0x08, 0x41, 0xCA, 0x2B, 0x92, 0x94, 0x81, 0x85, 0x09, + 0xF1, 0xD0, 0x53, 0x80, 0x0F, 0x53, 0xF0, 0xF0, 0xC1, 0x02, 0xFD, 0xCC, 0x92, 0x41, 0x00, 0x6E, + 0xF4, 0x03, 0x51, 0x4E, 0x32, 0x6A, 0xB8, 0x8F, 0x36, 0x99, 0xDC, 0x70, 0xC1, 0x05, 0x21, 0xF0, + 0x20, 0x85, 0x18, 0x94, 0x4A, 0x11, 0x45, 0x17, 0x98, 0x66, 0xBA, 0x44, 0x0F, 0x34, 0x60, 0xF7, + 0xC2, 0x06, 0x0F, 0x8C, 0xA8, 0x40, 0x06, 0xBF, 0xC4, 0x17, 0x19, 0x7F, 0xD1, 0xF1, 0x55, 0x18, + 0x28, 0x10, 0xE0, 0xC2, 0x09, 0x24, 0xFE, 0x69, 0x60, 0x01, 0x01, 0x35, 0xF1, 0x50, 0x21, 0x81, + 0x0C, 0x33, 0x18, 0xA0, 0xCC, 0x35, 0x03, 0x64, 0xA2, 0x06, 0x01, 0x57, 0x60, 0x44, 0x21, 0x7F, + 0x47, 0x59, 0xE4, 0xE1, 0x05, 0x2C, 0x4C, 0x31, 0x06, 0x24, 0x7E, 0x34, 0x0B, 0x06, 0x18, 0x98, + 0x3A, 0xE1, 0x84, 0x16, 0x69, 0xC8, 0x01, 0x86, 0x16, 0x5A, 0x3C, 0x31, 0x46, 0x14, 0x49, 0x6C, + 0x8A, 0x02, 0x0B, 0x1B, 0x5C, 0xD0, 0x40, 0x01, 0x0A, 0x5C, 0x81, 0x66, 0x8B, 0x46, 0xA5, 0x8A, + 0x51, 0x3F, 0x0B, 0x78, 0x70, 0x86, 0x18, 0x4B, 0xF8, 0x60, 0x01, 0x0E, 0xF1, 0xA4, 0xF0, 0xC0, + 0x0C, 0x23, 0xD2, 0x23, 0x08, 0x0C, 0x8D, 0x50, 0xF2, 0xEB, 0x31, 0x0E, 0x71, 0xE4, 0xE6, 0x3F, + 0xFB, 0xEC, 0x7B, 0xC1, 0x0C, 0x81, 0x00, 0x32, 0x87, 0x1F, 0x75, 0x18, 0xC2, 0x46, 0x18, 0x74, + 0xA4, 0x21, 0xED, 0xB4, 0x60, 0xB0, 0x41, 0x07, 0x1B, 0x5A, 0x28, 0x31, 0x6D, 0x1A, 0x69, 0x60, + 0x1A, 0x05, 0x0D, 0x34, 0xB0, 0xC0, 0xC2, 0x0B, 0x0D, 0x10, 0x40, 0xC0, 0x02, 0xC7, 0x5C, 0x84, + 0xEA, 0xC0, 0xC8, 0xAD, 0xE5, 0x4E, 0xA0, 0x7A, 0x28, 0xE0, 0xC1, 0x0B, 0x2F, 0x28, 0x60, 0x41, + 0x01, 0x25, 0x6C, 0x70, 0x40, 0x38, 0xF4, 0x58, 0x27, 0x8B, 0x2C, 0xAC, 0x98, 0x60, 0x80, 0x6A, + 0x4B, 0xFE, 0xD3, 0x8A, 0x02, 0x33, 0xAC, 0x11, 0x0B, 0x20, 0xD8, 0xA6, 0xC1, 0xC6, 0xD3, 0x61, + 0x58, 0x11, 0x46, 0xB5, 0x5A, 0x80, 0x51, 0x6D, 0x1A, 0x56, 0x6F, 0xB1, 0x85, 0x12, 0x4A, 0x68, + 0xCD, 0xF1, 0xB3, 0x49, 0x24, 0xD1, 0xC3, 0x0C, 0x22, 0xA4, 0x00, 0x81, 0x01, 0x03, 0x0C, 0x31, + 0xCD, 0x64, 0xFD, 0xE5, 0xD7, 0xA4, 0x45, 0x91, 0x69, 0xD8, 0xC1, 0x05, 0x37, 0xB8, 0x10, 0x02, + 0x97, 0x27, 0x48, 0xE0, 0x41, 0xFE, 0x13, 0x09, 0x48, 0x61, 0x46, 0x24, 0x66, 0x88, 0xD0, 0x41, + 0x4E, 0xFD, 0x60, 0xD3, 0x01, 0x04, 0xB5, 0x70, 0xC2, 0x48, 0x18, 0x61, 0xB0, 0x41, 0x06, 0x19, + 0x6F, 0x00, 0x42, 0x86, 0xB5, 0x69, 0xBC, 0x51, 0xB5, 0x16, 0xDC, 0x86, 0x5D, 0xC3, 0xE6, 0x9C, + 0xFF, 0xE0, 0x84, 0xD5, 0xD8, 0x42, 0x2B, 0xC5, 0x12, 0x3B, 0x78, 0xF0, 0x41, 0x0B, 0x01, 0x0C, + 0xF0, 0x8B, 0x71, 0x85, 0xF1, 0x34, 0x55, 0x53, 0x49, 0x11, 0x4C, 0x8F, 0x1E, 0x2D, 0x74, 0x40, + 0x88, 0x86, 0xF8, 0x3C, 0xC0, 0xC2, 0x12, 0x97, 0x76, 0x21, 0xB6, 0x06, 0x1A, 0xD0, 0x30, 0x45, + 0x14, 0x79, 0x48, 0x11, 0xC2, 0x03, 0x2B, 0x22, 0x25, 0x10, 0xAA, 0xFB, 0xD8, 0x72, 0xC0, 0x12, + 0xC6, 0x30, 0xCB, 0xC6, 0xB5, 0x56, 0x58, 0x41, 0x86, 0x1F, 0x6F, 0xC8, 0x81, 0x75, 0xD6, 0x3F, + 0x2C, 0x21, 0x03, 0xF0, 0x21, 0xD0, 0x90, 0x04, 0xD7, 0x35, 0xA0, 0x60, 0x7E, 0x12, 0x72, 0x68, + 0x9F, 0x7E, 0x1A, 0x51, 0xF4, 0xC0, 0x42, 0x08, 0x1B, 0xA4, 0xD0, 0xC0, 0x00, 0xB3, 0xD8, 0xC7, + 0x5A, 0x6B, 0x1F, 0xF5, 0x43, 0x4F, 0x10, 0x0F, 0xC0, 0x5F, 0x40, 0x01, 0xA0, 0xF0, 0xC4, 0x03, + 0x7A, 0x10, 0x05, 0x6C, 0x59, 0xE1, 0x59, 0x9B, 0xE2, 0xC1, 0x0C, 0x78, 0xA0, 0xC0, 0x0B, 0xB4, + 0x80, 0x2C, 0x18, 0x39, 0x4B, 0xE1, 0x3E, 0xF0, 0x82, 0x3C, 0x70, 0x42, 0x11, 0x86, 0xA0, 0x43, + 0x18, 0xA8, 0x95, 0x86, 0xC7, 0x91, 0xE1, 0x59, 0x63, 0x18, 0x83, 0xEF, 0x6A, 0x40, 0x03, 0x0D, + 0x68, 0x69, 0x06, 0x3D, 0xE0, 0xDD, 0xB3, 0xB6, 0x10, 0x05, 0x26, 0xD0, 0xA0, 0x06, 0x5A, 0x20, + 0x03, 0xE3, 0xB4, 0x20, 0x2D, 0x6E, 0xF5, 0x00, 0x04, 0x33, 0x08, 0x17, 0xA1, 0xA2, 0x12, 0x92, + 0x7B, 0x0C, 0x8C, 0x39, 0xFE, 0x24, 0x89, 0x8F, 0x11, 0x24, 0xD0, 0x83, 0x1A, 0x20, 0x61, 0x06, + 0x12, 0x38, 0x40, 0xFF, 0x92, 0xC0, 0x31, 0x3A, 0xD0, 0x81, 0x0C, 0x5A, 0x58, 0xC2, 0x0C, 0x52, + 0xF0, 0x01, 0x0B, 0x10, 0x60, 0x00, 0x45, 0x10, 0x87, 0x45, 0xEA, 0x11, 0x93, 0x26, 0xE1, 0xA3, + 0x05, 0x0A, 0x08, 0x41, 0x2C, 0x3A, 0xE1, 0x07, 0x46, 0x3C, 0xAC, 0x0C, 0x73, 0x80, 0xDA, 0x01, + 0xD3, 0x30, 0x06, 0x26, 0xF0, 0xC0, 0x6E, 0x28, 0x48, 0x02, 0x12, 0x96, 0x40, 0xC7, 0x24, 0x44, + 0x01, 0x0C, 0x8F, 0x4B, 0xC3, 0x16, 0x7C, 0xE7, 0x39, 0x32, 0x3C, 0xED, 0x83, 0xD8, 0xE2, 0x16, + 0xC8, 0x58, 0x70, 0x03, 0x18, 0x10, 0x60, 0x02, 0xEB, 0x18, 0x08, 0x7E, 0x06, 0x03, 0xC4, 0xA4, + 0xEC, 0xC3, 0x1E, 0x1E, 0x98, 0x41, 0x17, 0xAE, 0x25, 0x36, 0x20, 0xB0, 0xA0, 0x07, 0x5D, 0x90, + 0x83, 0xC5, 0xDA, 0x40, 0x06, 0x25, 0x2C, 0x41, 0x04, 0x05, 0x58, 0x80, 0x0A, 0x7E, 0x21, 0x8E, + 0x74, 0x09, 0x6B, 0x1F, 0xE8, 0xA8, 0xC2, 0x05, 0xCC, 0x70, 0x41, 0x3C, 0x64, 0xD0, 0x8F, 0x69, + 0x0C, 0xC3, 0xB3, 0xA8, 0x56, 0x03, 0xF8, 0x89, 0x80, 0x07, 0x49, 0xD0, 0xDA, 0x1E, 0xB7, 0x70, + 0x35, 0x0E, 0x66, 0x6C, 0x0B, 0x4E, 0xB0, 0xC2, 0x1B, 0xDA, 0xD0, 0x06, 0xEC, 0x5D, 0x2B, 0x0A, + 0x51, 0xF8, 0x41, 0x0D, 0xC4, 0x30, 0x83, 0x17, 0x98, 0x20, 0x94, 0xA5, 0x64, 0x5D, 0xC0, 0xD4, + 0x03, 0x92, 0x79, 0x10, 0x2C, 0x1A, 0x0D, 0x90, 0x82, 0x1C, 0xEC, 0xD0, 0x06, 0x40, 0x44, 0x01, + 0x05, 0x52, 0xC8, 0x24, 0x23, 0xCC, 0x38, 0xB5, 0x28, 0x00, 0xE1, 0x02, 0x46, 0x18, 0x07, 0x79, + 0x5C, 0x72, 0x9F, 0x84, 0xF0, 0xA3, 0x1F, 0xA8, 0xB8, 0xC0, 0x12, 0xE4, 0xC0, 0x88, 0x39, 0xD0, + 0xC1, 0x0F, 0xC4, 0xFE, 0x2C, 0x44, 0x18, 0x3C, 0xA8, 0x47, 0x24, 0xD4, 0x00, 0x04, 0xE2, 0x0B, + 0xDB, 0xE7, 0xC8, 0x60, 0x05, 0x2D, 0x58, 0xEF, 0x0D, 0x6F, 0x48, 0x03, 0x07, 0xA5, 0x55, 0xBD, + 0x30, 0x10, 0x73, 0x83, 0xD9, 0x7A, 0xC2, 0x13, 0xC0, 0x30, 0xAD, 0x1F, 0xAC, 0x61, 0x09, 0x21, + 0xF0, 0x80, 0x02, 0x46, 0x90, 0x3C, 0xD6, 0xE1, 0x8F, 0x6D, 0xEF, 0x69, 0xC0, 0x19, 0x00, 0xC1, + 0x88, 0x4B, 0x90, 0x22, 0x0F, 0x7D, 0x98, 0x41, 0x08, 0xCC, 0x20, 0x07, 0x4E, 0xD0, 0x81, 0x86, + 0x4B, 0x78, 0x41, 0x02, 0xC8, 0x43, 0x9B, 0x96, 0x78, 0x64, 0x1F, 0x59, 0x28, 0x80, 0x19, 0x00, + 0xF1, 0x30, 0x30, 0xDC, 0xB3, 0x0D, 0x86, 0x68, 0xC3, 0x1A, 0xBB, 0xF0, 0x03, 0xF3, 0xA1, 0xE0, + 0x52, 0x55, 0xAB, 0x5C, 0xC6, 0x18, 0xC7, 0xD4, 0xA7, 0x5D, 0xEC, 0x61, 0x8C, 0x6B, 0x43, 0xC3, + 0xDA, 0xB0, 0x41, 0x27, 0x84, 0xED, 0x09, 0xE9, 0xA3, 0x43, 0x41, 0x93, 0x10, 0xB2, 0x0B, 0x40, + 0x60, 0x00, 0x2B, 0x8A, 0xCC, 0x5A, 0x80, 0x58, 0x90, 0x7E, 0xAC, 0xA3, 0x03, 0x2F, 0x60, 0x05, + 0x29, 0x9E, 0x10, 0x0A, 0x11, 0x10, 0xA0, 0x00, 0x30, 0xB8, 0x00, 0x08, 0x18, 0x41, 0xD1, 0x24, + 0x00, 0x61, 0x03, 0x1D, 0xA0, 0x29, 0x7F, 0xE8, 0xD3, 0x0F, 0x2F, 0x5C, 0x80, 0x0F, 0xE4, 0x7C, + 0x9C, 0x26, 0xFD, 0x60, 0x07, 0x3B, 0xF8, 0xA1, 0x0B, 0x3D, 0x08, 0x81, 0x06, 0x60, 0x38, 0x4E, + 0x0D, 0xCA, 0x12, 0x0C, 0x5B, 0xC0, 0x16, 0xC4, 0xEC, 0x50, 0x87, 0x3A, 0x38, 0xE2, 0xB2, 0x8E, + 0x30, 0x84, 0x21, 0x1A, 0x76, 0xD9, 0xCA, 0xDA, 0x21, 0x0C, 0x13, 0x4B, 0x03, 0xE3, 0x5E, 0xDA, + 0xAD, 0x26, 0x88, 0x20, 0x08, 0x0B, 0x18, 0x00, 0x3E, 0x54, 0x36, 0x15, 0xA7, 0xF4, 0x63, 0x1C, + 0x05, 0x70, 0xFE, 0x17, 0x14, 0xC8, 0x04, 0x1F, 0x7C, 0x0C, 0x43, 0x02, 0x90, 0x78, 0x02, 0x57, + 0x6B, 0x96, 0xD7, 0x8C, 0x58, 0xE8, 0x1F, 0x59, 0xB8, 0x40, 0x24, 0x3A, 0x51, 0x59, 0xC6, 0x59, + 0xCF, 0x89, 0xF7, 0x5C, 0x43, 0x0F, 0x36, 0xA0, 0x01, 0x26, 0xA4, 0x01, 0x9F, 0x75, 0x68, 0x83, + 0xC5, 0xA6, 0x57, 0x35, 0xE4, 0xFA, 0xC1, 0x10, 0x96, 0x10, 0x85, 0x76, 0x45, 0x61, 0x89, 0xEE, + 0x5A, 0x62, 0x14, 0xDD, 0x7D, 0x84, 0x24, 0xA8, 0xCA, 0x54, 0x3F, 0xB0, 0xC1, 0x09, 0xEC, 0x93, + 0x01, 0x0F, 0x9A, 0x40, 0x04, 0x0B, 0x28, 0xA0, 0x48, 0xE8, 0x42, 0xC9, 0x4C, 0x0C, 0x52, 0xB0, + 0x50, 0x6A, 0x23, 0x79, 0xC7, 0x30, 0x00, 0x14, 0x10, 0xDB, 0xCC, 0x71, 0x11, 0x22, 0xAC, 0x70, + 0xD3, 0x10, 0x33, 0x16, 0x30, 0x83, 0xE1, 0x4A, 0x42, 0x12, 0x41, 0x15, 0xEA, 0xC5, 0x38, 0xD6, + 0x05, 0x20, 0x48, 0x00, 0x05, 0x6B, 0x90, 0xC3, 0x1B, 0x20, 0xC6, 0x86, 0xCA, 0xD6, 0xC1, 0x89, + 0x5A, 0x58, 0x58, 0x19, 0x4B, 0x7A, 0x89, 0x51, 0x6C, 0xD7, 0xBB, 0x1F, 0x1E, 0xC5, 0x23, 0x1E, + 0xB1, 0x59, 0x0B, 0x6B, 0x10, 0x73, 0x53, 0x90, 0x82, 0x1A, 0x5E, 0x70, 0x03, 0x0F, 0x14, 0x20, + 0x03, 0x34, 0x45, 0xCA, 0x43, 0x36, 0xF2, 0x19, 0xF4, 0x10, 0x0C, 0x1F, 0x38, 0xDE, 0x07, 0x33, + 0x06, 0x60, 0x80, 0x20, 0x84, 0x93, 0x74, 0x1F, 0x30, 0x40, 0x0C, 0xC2, 0xF1, 0x1E, 0x66, 0x08, + 0x42, 0x05, 0x06, 0x48, 0xB2, 0x02, 0x24, 0xD0, 0x05, 0x4E, 0x48, 0xA2, 0x61, 0x78, 0xA0, 0xAC, + 0xC3, 0x36, 0xF8, 0x4D, 0x09, 0x2C, 0x61, 0x0D, 0x6F, 0x90, 0xA1, 0x1F, 0xE9, 0x50, 0x08, 0xA7, + 0xA6, 0x61, 0x0E, 0x72, 0x80, 0x04, 0x20, 0xD6, 0xC0, 0x84, 0x3B, 0xF2, 0xB4, 0x10, 0x8A, 0x83, + 0x44, 0xFE, 0x27, 0xB0, 0xFB, 0xDD, 0x4B, 0x74, 0x17, 0xBC, 0x8E, 0x20, 0x71, 0x06, 0x15, 0x6A, + 0x43, 0x28, 0x8C, 0xCC, 0xC5, 0xAA, 0xB8, 0xC8, 0xA1, 0x92, 0xB4, 0x91, 0x79, 0x04, 0x11, 0x1D, + 0xB3, 0x2B, 0x00, 0x10, 0xFA, 0x10, 0x0A, 0x39, 0x68, 0x01, 0x5C, 0x1F, 0xF8, 0x9F, 0x02, 0x08, + 0xA0, 0x80, 0x07, 0x3C, 0xE0, 0x02, 0x55, 0xAC, 0x42, 0x08, 0xBA, 0x50, 0x61, 0xCD, 0x4A, 0xB7, + 0x59, 0x8A, 0xC0, 0xC3, 0xD4, 0xDE, 0x57, 0x03, 0x46, 0xF8, 0x61, 0x9F, 0x08, 0x8D, 0x61, 0xE8, + 0xB4, 0xE6, 0xCD, 0xEC, 0x0C, 0x40, 0x37, 0x10, 0x50, 0x80, 0x98, 0xFE, 0x77, 0x01, 0x11, 0xEC, + 0xB4, 0x9E, 0xD7, 0x75, 0x84, 0x28, 0x2A, 0x41, 0x6B, 0x47, 0x0C, 0xA2, 0x10, 0x6F, 0xB8, 0x96, + 0x16, 0xB6, 0xC0, 0xD5, 0xFE, 0x16, 0x20, 0xC6, 0x44, 0xE9, 0xA1, 0x41, 0xEC, 0x11, 0x0D, 0x02, + 0x2C, 0x81, 0x13, 0x12, 0x66, 0x83, 0x12, 0x6A, 0xD0, 0x83, 0x1D, 0x38, 0x5B, 0x04, 0x33, 0x88, + 0xF6, 0x09, 0x44, 0x40, 0xED, 0x10, 0x44, 0x21, 0x0C, 0x9A, 0xAD, 0x03, 0x1B, 0x84, 0xD9, 0xAC, + 0xA7, 0xC9, 0x21, 0x09, 0x12, 0xA0, 0x81, 0x1F, 0x24, 0x81, 0xB1, 0xAA, 0x69, 0x0F, 0x5A, 0x4A, + 0x08, 0x1B, 0x12, 0x68, 0xF0, 0x80, 0x0F, 0x94, 0x0A, 0x26, 0x06, 0xB9, 0x46, 0x31, 0x7E, 0x81, + 0x03, 0x02, 0x3C, 0x40, 0x0A, 0xA1, 0x70, 0x1A, 0x1B, 0x1C, 0x51, 0x09, 0xED, 0x56, 0xC2, 0x12, + 0xAF, 0xAC, 0x1E, 0xB6, 0x40, 0xF6, 0x82, 0x14, 0x14, 0x20, 0xCF, 0xE9, 0xF9, 0x08, 0x53, 0xAC, + 0xA9, 0xA6, 0x7F, 0xA0, 0x23, 0x08, 0x2C, 0x80, 0x84, 0x24, 0x46, 0xFC, 0x08, 0xA1, 0x42, 0x0B, + 0x53, 0x6B, 0x68, 0xDF, 0x68, 0x36, 0xD5, 0x83, 0x24, 0x58, 0xC1, 0x10, 0x92, 0xF8, 0xB4, 0xF5, + 0xFE, 0xA6, 0x4B, 0x06, 0x27, 0x44, 0x41, 0x03, 0x3F, 0xE8, 0x02, 0x24, 0x9C, 0x50, 0x83, 0xB0, + 0x21, 0xD3, 0x77, 0x9A, 0x03, 0x41, 0x13, 0x1A, 0xC0, 0x51, 0x08, 0x9D, 0xE7, 0x29, 0xF8, 0xB0, + 0xC5, 0x05, 0x4E, 0x00, 0xE1, 0x37, 0x60, 0xF7, 0xC3, 0x0E, 0x9B, 0x18, 0x0D, 0x9D, 0xE0, 0xBE, + 0x0B, 0x28, 0xC0, 0x00, 0xF1, 0x65, 0x8F, 0x46, 0xEE, 0xE1, 0xE7, 0x8C, 0xDC, 0x63, 0x1F, 0x41, + 0x98, 0x01, 0x27, 0x0C, 0x31, 0x88, 0xE8, 0xB6, 0xC1, 0x72, 0x5A, 0x48, 0x9F, 0xC6, 0xEC, 0x68, + 0xC7, 0x2E, 0x38, 0x21, 0x0C, 0x8F, 0x00, 0xB8, 0xE3, 0xDE, 0xF0, 0xE9, 0x87, 0x75, 0x0C, 0x04, + 0x28, 0x00, 0x04, 0x20, 0xBA, 0x80, 0xF6, 0x1A, 0xFC, 0x20, 0x99, 0xA3, 0xE1, 0x94, 0xFB, 0x52, + 0xB0, 0x80, 0x68, 0x22, 0x24, 0x2C, 0x34, 0x69, 0xBA, 0x3E, 0x1E, 0x39, 0x0C, 0x22, 0x48, 0x40, + 0x0C, 0x80, 0x50, 0x44, 0x77, 0xB9, 0xEB, 0x88, 0x3A, 0x58, 0x41, 0x63, 0x55, 0xB3, 0x6A, 0x08, + 0x44, 0x00, 0x83, 0x01, 0xE4, 0xD9, 0x27, 0x1C, 0x81, 0x07, 0x5B, 0x6A, 0x4C, 0x10, 0x71, 0xF8, + 0x26, 0x16, 0x5A, 0x35, 0x45, 0x2C, 0x94, 0x00, 0xBA, 0xC6, 0xED, 0x93, 0x5A, 0x60, 0xB0, 0x02, + 0x1B, 0xA4, 0x3A, 0x08, 0xF1, 0x4A, 0xF7, 0x69, 0x68, 0xD4, 0x2D, 0x0A, 0xE8, 0xF9, 0x06, 0x1C, + 0x2E, 0x21, 0x09, 0x9C, 0x1B, 0x0D, 0x0D, 0x50, 0x70, 0x02, 0xA3, 0x1B, 0x00, 0x1F, 0x92, 0xF7, + 0xCB, 0x5E, 0x70, 0x1E, 0x83, 0x04, 0xCC, 0x60, 0x12, 0x8C, 0xD0, 0x44, 0x76, 0xB9, 0x5B, 0x07, + 0xD0, 0x2A, 0x01, 0x8A, 0x95, 0xF4, 0x40, 0x0C, 0x0C, 0x70, 0x8D, 0x86, 0x4B, 0x26, 0x23, 0x91, + 0x01, 0x4C, 0x3E, 0x0A, 0x83, 0x03, 0x35, 0x4C, 0x62, 0x0C, 0x5A, 0x60, 0x43, 0x2C, 0xC0, 0xFE, + 0x90, 0x04, 0x30, 0xCC, 0x81, 0xC2, 0x0A, 0x8D, 0x61, 0x85, 0x07, 0xE1, 0x08, 0x4B, 0x3C, 0xA2, + 0x61, 0xDA, 0x6E, 0xDC, 0x1C, 0x9E, 0x00, 0x82, 0x30, 0x7F, 0x9B, 0x05, 0x50, 0x00, 0xD9, 0xE6, + 0x40, 0x66, 0xBE, 0xDA, 0x8F, 0xCB, 0x00, 0xE4, 0x91, 0x90, 0xD3, 0x3D, 0x22, 0x41, 0x69, 0x18, + 0x40, 0x04, 0xA1, 0x50, 0x06, 0x92, 0xD0, 0x5D, 0x99, 0x85, 0x31, 0xC1, 0x44, 0x06, 0x95, 0x44, + 0x04, 0xA8, 0x45, 0x08, 0xA6, 0xD4, 0x32, 0x04, 0x73, 0x01, 0x8D, 0x30, 0x09, 0x65, 0x30, 0x7A, + 0x52, 0x63, 0x31, 0xC5, 0xE7, 0x04, 0x4C, 0x30, 0x3C, 0xCF, 0xC5, 0x66, 0x96, 0x30, 0x08, 0x9B, + 0xA5, 0x69, 0xA0, 0x17, 0x47, 0x90, 0x20, 0x07, 0xEF, 0x23, 0x7B, 0x32, 0x60, 0x3E, 0x20, 0x03, + 0x02, 0xB5, 0x37, 0x2A, 0x06, 0x00, 0x00, 0xCA, 0xE3, 0x5B, 0x1E, 0x71, 0x77, 0x47, 0xE1, 0x5A, + 0x10, 0xF0, 0x00, 0x81, 0x20, 0x07, 0x20, 0x67, 0x08, 0xDD, 0x66, 0x05, 0xD3, 0x62, 0x55, 0xB8, + 0xF2, 0x02, 0x8D, 0x77, 0x0C, 0x88, 0x61, 0x10, 0xF1, 0x35, 0x56, 0x24, 0xA1, 0x0D, 0x04, 0x40, + 0x09, 0x91, 0x00, 0x72, 0x7E, 0x40, 0x07, 0xAE, 0x64, 0x08, 0xA0, 0x35, 0x09, 0x79, 0xD0, 0x05, + 0x65, 0x50, 0x07, 0xA6, 0x60, 0x09, 0x99, 0x55, 0x08, 0x94, 0x55, 0x07, 0x73, 0x20, 0x24, 0x37, + 0x14, 0x09, 0x63, 0x90, 0x04, 0x1A, 0x00, 0x6D, 0x3D, 0xF0, 0x2D, 0x21, 0x10, 0x02, 0xDF, 0x32, + 0x03, 0x1E, 0xD0, 0x00, 0x14, 0x90, 0x01, 0x08, 0x00, 0x00, 0xDC, 0xC0, 0x1C, 0x5C, 0xE4, 0x0F, + 0x0C, 0xC7, 0x43, 0x4C, 0x91, 0x0F, 0xEC, 0x22, 0x01, 0x11, 0x86, 0x7A, 0x8E, 0x35, 0x43, 0x4E, + 0xB0, 0x6E, 0x33, 0x60, 0x02, 0x10, 0x30, 0x04, 0xFA, 0xC0, 0x45, 0x02, 0x81, 0x2E, 0xFE, 0x37, + 0x77, 0x53, 0x7A, 0xE0, 0x01, 0xC7, 0x76, 0x09, 0x9E, 0x56, 0x62, 0xC5, 0x87, 0x2D, 0xD9, 0x67, + 0x08, 0xE5, 0xA7, 0x6D, 0x17, 0xD3, 0x06, 0x76, 0x00, 0x08, 0x66, 0xE0, 0x02, 0x16, 0x80, 0x05, + 0xB2, 0xB0, 0x04, 0x1A, 0xF0, 0x00, 0x5E, 0x22, 0x32, 0xF0, 0x23, 0x01, 0x8F, 0x52, 0x00, 0x16, + 0x00, 0x01, 0x23, 0x30, 0x02, 0x13, 0x00, 0x00, 0x8B, 0x80, 0x10, 0xF5, 0x90, 0x14, 0x31, 0x51, + 0x15, 0x5C, 0xD1, 0x3A, 0x65, 0x85, 0x0E, 0x0A, 0x20, 0x02, 0x4C, 0xA0, 0x05, 0x65, 0x40, 0x43, + 0x6C, 0xC0, 0x30, 0xDA, 0xC6, 0x83, 0x49, 0xC0, 0x03, 0x22, 0x80, 0x3A, 0xCF, 0xE0, 0x67, 0xE7, + 0x31, 0x18, 0xC7, 0xF1, 0x48, 0x7A, 0x70, 0x03, 0x93, 0xA0, 0x76, 0x73, 0xC0, 0x08, 0x4F, 0xC5, + 0x38, 0x0F, 0xD3, 0x06, 0x97, 0x50, 0x75, 0x52, 0x93, 0x65, 0x10, 0x23, 0x07, 0x52, 0xF0, 0x01, + 0x1F, 0xA0, 0x0B, 0x66, 0xF0, 0x02, 0x90, 0x02, 0x3F, 0x1B, 0x40, 0x6D, 0xA0, 0x92, 0x6A, 0x38, + 0x40, 0x01, 0x06, 0xB0, 0x00, 0x06, 0x80, 0x00, 0x0E, 0x70, 0x04, 0x33, 0x58, 0x53, 0x32, 0x11, + 0x1F, 0x7B, 0xE7, 0x22, 0x24, 0xD1, 0x13, 0xFB, 0x10, 0x0D, 0x10, 0xE0, 0x6A, 0x86, 0xF6, 0x75, + 0x76, 0x30, 0x71, 0x19, 0xB4, 0x41, 0x4C, 0xC0, 0x02, 0x06, 0x37, 0x04, 0xFC, 0x40, 0x87, 0x40, + 0x24, 0x2C, 0xFB, 0x17, 0x44, 0xF1, 0xF4, 0x77, 0x94, 0x90, 0x39, 0xD7, 0xE2, 0x54, 0xCD, 0xA2, + 0x55, 0xD3, 0x32, 0x07, 0x0A, 0x05, 0x06, 0x1F, 0xF3, 0x00, 0x50, 0x30, 0x09, 0x53, 0x00, 0x01, + 0x16, 0x60, 0x8E, 0x17, 0xB0, 0x01, 0x1B, 0x20, 0x01, 0x0D, 0x30, 0x01, 0x13, 0xB0, 0x00, 0xEA, + 0xB8, 0x00, 0x05, 0x60, 0x00, 0x2B, 0x00, 0x00, 0xC7, 0x40, 0x1E, 0x3D, 0x71, 0xFE, 0x0C, 0x10, + 0x40, 0x00, 0x82, 0x60, 0x2A, 0xF3, 0x61, 0x4A, 0xFD, 0xC0, 0x0C, 0x06, 0xE0, 0x02, 0x53, 0x30, + 0x61, 0x6C, 0x30, 0x80, 0x95, 0x90, 0x59, 0xDA, 0xB6, 0x5B, 0x1F, 0x10, 0x00, 0x2A, 0x41, 0x56, + 0x1B, 0xA1, 0x14, 0x2B, 0xB1, 0x0F, 0xE1, 0xC0, 0x3F, 0x8E, 0x76, 0x02, 0x33, 0x20, 0x3E, 0xA2, + 0x67, 0x31, 0x7E, 0xA0, 0x05, 0x9E, 0xE3, 0x7D, 0x10, 0x95, 0x58, 0x21, 0x10, 0x08, 0x6B, 0x30, + 0x03, 0x16, 0x00, 0x03, 0x76, 0x33, 0x92, 0x22, 0x69, 0x7B, 0x13, 0x40, 0x01, 0xEC, 0x48, 0x00, + 0x06, 0x50, 0x00, 0x13, 0x30, 0x00, 0x2A, 0x10, 0x63, 0xFB, 0x50, 0x04, 0x05, 0x50, 0x05, 0x55, + 0x00, 0x01, 0x31, 0x40, 0x1E, 0x9F, 0x11, 0x11, 0xFC, 0xC1, 0x45, 0xF7, 0xD0, 0x0F, 0xB4, 0x60, + 0x00, 0x3C, 0xE0, 0x04, 0x66, 0xE4, 0x66, 0xFF, 0x96, 0x59, 0x74, 0x40, 0x74, 0x2C, 0xE0, 0x01, + 0x03, 0x40, 0x0C, 0x47, 0xD1, 0x74, 0x6C, 0xB3, 0x74, 0x0B, 0x97, 0x19, 0xFD, 0x80, 0x0F, 0xA8, + 0x10, 0x03, 0x1D, 0x50, 0x00, 0x44, 0x40, 0x03, 0xD9, 0x67, 0x4C, 0x49, 0xF0, 0x03, 0x60, 0x10, + 0x06, 0x94, 0x35, 0x3D, 0x3C, 0xB0, 0x01, 0x81, 0x10, 0x0A, 0x50, 0xB0, 0x01, 0x2F, 0x70, 0x4B, + 0xA5, 0x68, 0x8A, 0x0F, 0x30, 0x2E, 0x2B, 0x99, 0x96, 0x1F, 0x00, 0x03, 0x47, 0x87, 0x96, 0x06, + 0x30, 0x04, 0xAD, 0x50, 0x0C, 0x01, 0x70, 0x01, 0x4D, 0xD0, 0x04, 0x6A, 0x20, 0x04, 0x5E, 0x80, + 0x00, 0xBE, 0x95, 0x1A, 0x04, 0xD1, 0x0F, 0x38, 0xE0, 0x01, 0x03, 0x52, 0x08, 0x40, 0x89, 0x85, + 0x41, 0xE7, 0x3E, 0x2E, 0x56, 0x01, 0x72, 0xB1, 0x1A, 0x3B, 0xE1, 0x10, 0x8B, 0x54, 0x56, 0xF1, + 0xB1, 0x0F, 0x57, 0xA0, 0x00, 0x40, 0x40, 0x69, 0x4D, 0xF8, 0x6D, 0xD9, 0xFE, 0x47, 0x07, 0x52, + 0x46, 0x07, 0xCB, 0x25, 0x0B, 0x9B, 0xD8, 0x00, 0x28, 0x84, 0x86, 0x1A, 0x20, 0x01, 0xAB, 0xD9, + 0x00, 0x0D, 0x90, 0x00, 0x63, 0xD2, 0x02, 0x41, 0xD0, 0x01, 0x1D, 0x10, 0x03, 0x89, 0x86, 0x9E, + 0xFF, 0x63, 0x00, 0x01, 0x40, 0x04, 0xA0, 0xA4, 0x00, 0x0A, 0x80, 0x0A, 0x15, 0xD0, 0x0A, 0xAF, + 0xD1, 0x14, 0xEB, 0x10, 0x04, 0x1B, 0x10, 0x05, 0x6C, 0x70, 0x85, 0x58, 0x48, 0x62, 0x61, 0xB0, + 0x6C, 0x23, 0x73, 0x74, 0xEB, 0x10, 0x5F, 0x90, 0x07, 0x79, 0x42, 0xF1, 0x13, 0x46, 0x82, 0x0F, + 0x05, 0xD0, 0x04, 0x60, 0x60, 0x07, 0x96, 0xE6, 0x79, 0xDC, 0x09, 0x54, 0x7E, 0x00, 0x32, 0x9C, + 0x30, 0x06, 0x16, 0xF0, 0x01, 0x3B, 0x30, 0x7B, 0x1A, 0x00, 0x2A, 0x0A, 0x10, 0x4A, 0x10, 0xA0, + 0x44, 0x5C, 0xD0, 0x78, 0xA9, 0xB3, 0x00, 0x29, 0x20, 0x01, 0x5E, 0x22, 0x02, 0x25, 0xE0, 0x01, + 0x10, 0x10, 0x00, 0x4F, 0x11, 0x1F, 0xB9, 0x41, 0x00, 0x1D, 0x65, 0x1E, 0x21, 0xF1, 0x5A, 0x05, + 0xC0, 0x03, 0x72, 0x70, 0x60, 0xE5, 0x37, 0x65, 0x2C, 0xA7, 0x01, 0x2F, 0x10, 0x64, 0xCC, 0x10, + 0x56, 0x56, 0x01, 0x12, 0x1F, 0x45, 0x5F, 0x05, 0x00, 0x05, 0x69, 0x60, 0x59, 0x8F, 0x50, 0x75, + 0x96, 0x08, 0x5D, 0x74, 0x70, 0x54, 0x7E, 0xF0, 0x04, 0x10, 0x40, 0x41, 0x2C, 0x50, 0x9E, 0x09, + 0x90, 0x00, 0x05, 0x80, 0x64, 0x0B, 0x90, 0x00, 0x5C, 0x90, 0x02, 0x38, 0xFA, 0x14, 0x06, 0x90, + 0x02, 0x28, 0x24, 0x36, 0x28, 0xA0, 0x01, 0x29, 0x00, 0x00, 0xFE, 0x20, 0x00, 0x11, 0xF0, 0x0F, + 0x01, 0xB0, 0x00, 0x1D, 0x50, 0x73, 0x34, 0x21, 0x63, 0x99, 0x81, 0x0F, 0x46, 0x70, 0x01, 0x6B, + 0xE0, 0x07, 0xAF, 0xA0, 0x09, 0x4F, 0x16, 0x4C, 0x2C, 0x17, 0x02, 0xFE, 0x61, 0x52, 0x00, 0x57, + 0xF0, 0x1E, 0x0C, 0x8A, 0x11, 0xB1, 0xF1, 0x7C, 0x4F, 0x31, 0x0E, 0x09, 0x20, 0x06, 0x74, 0x40, + 0x89, 0x83, 0x69, 0x08, 0x78, 0x30, 0x5D, 0xB2, 0xA4, 0x01, 0x6B, 0xA0, 0x05, 0xE0, 0xE6, 0x01, + 0x22, 0x00, 0x2A, 0x5E, 0x9A, 0x3A, 0x03, 0x00, 0x00, 0x00, 0x90, 0x9B, 0x01, 0xE0, 0x0E, 0xA2, + 0x0A, 0x00, 0xFD, 0xF0, 0x01, 0x4D, 0x10, 0x05, 0x9F, 0x23, 0x36, 0x2F, 0x30, 0x00, 0xF9, 0x20, + 0x00, 0xB2, 0xFA, 0x0F, 0xB9, 0xB1, 0x00, 0x79, 0xE1, 0x7C, 0x47, 0xF1, 0x12, 0xFD, 0x80, 0x0E, + 0x0D, 0xC0, 0x03, 0x63, 0xA0, 0x08, 0x9A, 0xA0, 0x09, 0x86, 0xC0, 0x83, 0xDC, 0x47, 0xA8, 0xF2, + 0x03, 0x63, 0x50, 0xD1, 0xA0, 0xCA, 0xFA, 0x11, 0x0C, 0xB7, 0x0F, 0x46, 0xB0, 0x01, 0x5D, 0x70, + 0x5D, 0x96, 0x50, 0x09, 0xE0, 0xB5, 0x59, 0x6C, 0x90, 0x65, 0x60, 0xF0, 0x03, 0x20, 0x30, 0x85, + 0x62, 0x38, 0x96, 0x25, 0x3A, 0x00, 0x08, 0x00, 0x37, 0x06, 0xD0, 0x08, 0x03, 0xF0, 0x0F, 0x02, + 0x70, 0xAA, 0xFD, 0xA0, 0x00, 0x62, 0x20, 0x07, 0x7E, 0x70, 0x40, 0x51, 0xB0, 0x01, 0x1F, 0x10, + 0xAA, 0xE7, 0xFA, 0x0F, 0x15, 0xD0, 0x01, 0x0D, 0xA0, 0x07, 0x89, 0xFA, 0x12, 0x78, 0x88, 0x09, + 0xAB, 0x34, 0x07, 0x9D, 0x20, 0xAC, 0xA0, 0xA5, 0xA9, 0x20, 0xB0, 0x78, 0x37, 0x23, 0x1F, 0x95, + 0x71, 0x73, 0x77, 0x4A, 0x17, 0xE3, 0x80, 0x34, 0xD1, 0x3A, 0x80, 0xDE, 0x55, 0x62, 0x1C, 0xB3, + 0x06, 0x20, 0x50, 0x03, 0x6B, 0xC7, 0x04, 0x8B, 0x17, 0x2E, 0x07, 0x40, 0x00, 0x00, 0x80, 0x87, + 0xFB, 0x30, 0x00, 0x5E, 0x00, 0x56, 0x00, 0x10, 0xB2, 0xD3, 0x00, 0x00, 0xFB, 0xF0, 0x00, 0x63, + 0x70, 0x5D, 0xD2, 0xD5, 0x05, 0x1A, 0xD0, 0x08, 0x01, 0x00, 0xFE, 0x00, 0x23, 0x0B, 0x00, 0xE2, + 0x60, 0x00, 0x1E, 0x90, 0x02, 0xFD, 0x40, 0x12, 0x43, 0x78, 0x93, 0x91, 0xF9, 0x01, 0x1B, 0xC0, + 0xAE, 0x78, 0x20, 0x09, 0x2F, 0xC5, 0x3E, 0x89, 0xF5, 0x02, 0x41, 0x30, 0x1E, 0x0A, 0xF9, 0x1A, + 0x1F, 0x31, 0x7D, 0xFE, 0xD0, 0x0F, 0x59, 0xB0, 0x01, 0x4B, 0xB0, 0x81, 0xE5, 0xD7, 0x5D, 0x9B, + 0x65, 0x07, 0x69, 0xB0, 0x06, 0x62, 0xA0, 0x01, 0x4E, 0xE0, 0x07, 0x60, 0x30, 0x05, 0xEF, 0x83, + 0xB1, 0x04, 0x70, 0x14, 0xFB, 0xD0, 0x7B, 0x7A, 0x40, 0xA3, 0xB2, 0x0A, 0x00, 0x03, 0x50, 0xB6, + 0xBE, 0x8A, 0x4F, 0x4F, 0x03, 0x06, 0x28, 0x00, 0x05, 0x09, 0x10, 0xAA, 0x21, 0x0B, 0x0F, 0x67, + 0x7A, 0x01, 0x71, 0x48, 0x23, 0xEE, 0xC1, 0x0C, 0x0D, 0x10, 0x05, 0x17, 0x33, 0x4E, 0x9F, 0x97, + 0x04, 0x2C, 0xB0, 0x03, 0x41, 0x00, 0x01, 0xC7, 0xB0, 0x11, 0xCA, 0xB1, 0x1C, 0x3C, 0xB1, 0x12, + 0x4E, 0x81, 0x0F, 0x16, 0x30, 0x03, 0x15, 0x53, 0x59, 0x4F, 0x7B, 0x09, 0x51, 0x3B, 0x3D, 0x52, + 0x00, 0x02, 0x56, 0x60, 0x07, 0x11, 0x53, 0x3E, 0x1A, 0x70, 0x01, 0x05, 0x00, 0xAB, 0xFF, 0x60, + 0x04, 0x0F, 0xB0, 0x04, 0x2C, 0xFB, 0xA6, 0xE7, 0x6A, 0x6F, 0x28, 0x40, 0x0A, 0x49, 0xF5, 0x47, + 0xDC, 0x77, 0x02, 0x0F, 0x90, 0x3A, 0x00, 0x00, 0xB7, 0x33, 0xB9, 0x09, 0xDB, 0xE0, 0x0F, 0xC4, + 0x62, 0x19, 0xFD, 0xD0, 0x01, 0x28, 0xF0, 0x06, 0x52, 0xA3, 0x59, 0x09, 0xF5, 0x04, 0x4C, 0xE0, + 0x02, 0x37, 0xD0, 0x02, 0x6E, 0x50, 0xB4, 0x83, 0xFB, 0x1C, 0x7C, 0x81, 0x0D, 0x0D, 0x30, 0x05, + 0xD9, 0x37, 0x7A, 0x86, 0x30, 0x62, 0x4F, 0x16, 0x5D, 0x8E, 0x03, 0x7B, 0x93, 0xEB, 0x07, 0x73, + 0x90, 0x04, 0x6B, 0x9A, 0x44, 0x04, 0x40, 0x30, 0x09, 0xFE, 0xC0, 0x0A, 0xED, 0x03, 0xB2, 0x03, + 0x10, 0x5B, 0xDA, 0x74, 0x6E, 0xD5, 0x62, 0x05, 0x74, 0xF0, 0x06, 0x51, 0x20, 0x05, 0x6A, 0x78, + 0x45, 0xF4, 0x90, 0x1B, 0x0A, 0x00, 0x00, 0xAE, 0xB0, 0x90, 0x24, 0x31, 0x13, 0xA0, 0xA0, 0x01, + 0x4A, 0x30, 0xB9, 0x08, 0x46, 0x07, 0x60, 0xA0, 0xBB, 0xEB, 0x05, 0x03, 0x14, 0x50, 0xB4, 0xAF, + 0x73, 0x1F, 0xFF, 0xF0, 0x05, 0x56, 0x46, 0x51, 0x4A, 0x10, 0x06, 0x85, 0x90, 0x6D, 0x75, 0x50, + 0x58, 0x16, 0xA3, 0x05, 0x35, 0xA0, 0x04, 0xF7, 0xC4, 0x06, 0x61, 0xC3, 0x02, 0x17, 0x40, 0x00, + 0x6D, 0x39, 0x00, 0xCF, 0x15, 0x0B, 0x1A, 0xB0, 0x04, 0x63, 0x62, 0x6D, 0x4B, 0x73, 0xAD, 0x55, + 0xE9, 0x04, 0x1E, 0x54, 0x95, 0x5D, 0xC0, 0x04, 0x52, 0xB0, 0xA5, 0x8D, 0xD0, 0x62, 0x1F, 0x70, + 0x74, 0x5A, 0xC4, 0x43, 0x3B, 0xB1, 0x0F, 0x09, 0x10, 0xAD, 0xC9, 0x4B, 0x62, 0x69, 0x10, 0x36, + 0x63, 0x23, 0x04, 0x80, 0xB2, 0xA8, 0xBA, 0xE7, 0x0F, 0xF9, 0xB0, 0x0F, 0xC8, 0x72, 0x47, 0x4E, + 0xC0, 0x79, 0xD7, 0x65, 0x89, 0x8C, 0x60, 0xC0, 0x69, 0xB0, 0x6C, 0x80, 0x60, 0x5E, 0x9A, 0x1A, + 0x02, 0x98, 0xBB, 0x0F, 0x01, 0xA0, 0x06, 0x6D, 0x00, 0x0B, 0x97, 0x40, 0x07, 0xE3, 0xC4, 0x06, + 0xBE, 0x20, 0x09, 0xE0, 0xDB, 0x84, 0x0A, 0xC5, 0xC1, 0x6F, 0xE0, 0x6D, 0x21, 0x14, 0x05, 0x48, + 0x80, 0x02, 0x4B, 0x80, 0x02, 0x65, 0xD3, 0x02, 0x03, 0xC0, 0x0C, 0x7A, 0xE1, 0x1A, 0xFE, 0x50, + 0xB2, 0x51, 0xE0, 0x07, 0x61, 0x97, 0x59, 0x34, 0x24, 0x36, 0xCD, 0xC4, 0x7C, 0x78, 0x37, 0x23, + 0x4F, 0x11, 0x0E, 0x0F, 0xC0, 0x03, 0x3A, 0xAC, 0x04, 0x69, 0xC0, 0x08, 0x41, 0x25, 0x7A, 0xDC, + 0x54, 0x08, 0x07, 0xF4, 0x04, 0x98, 0xBA, 0x38, 0xFE, 0x87, 0x07, 0x04, 0x1E, 0x80, 0xA3, 0x04, + 0x20, 0x06, 0xA6, 0x50, 0x09, 0x75, 0xF0, 0x08, 0x1E, 0x06, 0x0B, 0x52, 0x55, 0x59, 0x78, 0x30, + 0x07, 0x16, 0xA9, 0x3D, 0x4E, 0x03, 0xBD, 0xD7, 0xB2, 0x05, 0xEB, 0x26, 0x03, 0x40, 0x40, 0xB0, + 0x05, 0xF0, 0x0B, 0x36, 0x97, 0x8C, 0x2A, 0xDC, 0x03, 0x68, 0xDC, 0x5D, 0x52, 0x8C, 0x39, 0x63, + 0x63, 0x02, 0x0A, 0x30, 0x0B, 0x34, 0x8C, 0x12, 0xFB, 0x80, 0x0A, 0x56, 0x16, 0x05, 0x12, 0xF3, + 0x75, 0x9A, 0x75, 0x5E, 0x61, 0x50, 0x59, 0x7C, 0x8C, 0x91, 0x21, 0xB0, 0x04, 0xCC, 0x12, 0xC8, + 0x25, 0x50, 0x24, 0x03, 0xB0, 0x04, 0x61, 0x00, 0x0B, 0x4E, 0xF0, 0x08, 0xFF, 0xD6, 0x06, 0xA6, + 0xE0, 0x0B, 0x8A, 0xB3, 0x7E, 0x66, 0xD0, 0x03, 0x52, 0x00, 0x05, 0x3D, 0xB0, 0x06, 0x99, 0xA2, + 0xC5, 0x40, 0xD0, 0x04, 0x5E, 0xB2, 0x01, 0xA6, 0x53, 0x00, 0xB3, 0x60, 0x28, 0xF8, 0x91, 0xC2, + 0x29, 0x80, 0x02, 0x7E, 0x70, 0x59, 0x96, 0x70, 0x09, 0xA0, 0x15, 0x05, 0x35, 0x20, 0x03, 0x82, + 0x98, 0x08, 0x7D, 0xA1, 0x0F, 0xF6, 0x20, 0x69, 0x03, 0x22, 0x31, 0x93, 0x38, 0x08, 0x07, 0xAA, + 0x05, 0xB4, 0x9C, 0x50, 0x63, 0x40, 0x03, 0x21, 0x30, 0xC4, 0x56, 0xC0, 0x42, 0x2C, 0xD0, 0x00, + 0x57, 0x50, 0x9F, 0xB1, 0x20, 0x01, 0x64, 0xE0, 0xB8, 0x78, 0x20, 0x07, 0x62, 0x80, 0x02, 0x8A, + 0x85, 0x25, 0x23, 0x32, 0x00, 0x14, 0x40, 0x01, 0x23, 0xF0, 0x01, 0x26, 0x30, 0x33, 0xEC, 0x25, + 0x97, 0x06, 0xD7, 0x02, 0x46, 0x3A, 0xC6, 0x9E, 0x5C, 0x05, 0xDC, 0x8C, 0x85, 0xDF, 0xBC, 0x41, + 0x5B, 0xF0, 0x03, 0x87, 0x09, 0x01, 0xBF, 0x0B, 0x17, 0xE8, 0xCC, 0x05, 0x3D, 0x20, 0x31, 0x58, + 0x23, 0x07, 0x89, 0x6C, 0x09, 0x6D, 0xA0, 0xFE, 0x04, 0xF0, 0x5C, 0xC0, 0xD0, 0x2B, 0x24, 0x1A, + 0xD0, 0x05, 0xBA, 0x10, 0x7E, 0x9F, 0x54, 0x00, 0x01, 0x50, 0x05, 0xBA, 0x60, 0x9E, 0x49, 0x30, + 0xCF, 0x1B, 0x30, 0x00, 0x17, 0xF0, 0x05, 0x8F, 0x66, 0x04, 0x09, 0x50, 0x01, 0x00, 0xA0, 0x03, + 0x3A, 0x90, 0x03, 0x44, 0xAD, 0x92, 0x05, 0xF0, 0x56, 0x26, 0xE3, 0x09, 0x03, 0x10, 0x03, 0xAA, + 0x45, 0xD1, 0x1C, 0xD1, 0x0F, 0x41, 0x10, 0x02, 0x6C, 0xE0, 0x5D, 0xE0, 0xBC, 0x55, 0xE0, 0xA2, + 0x00, 0x1F, 0xFD, 0x16, 0xFD, 0x60, 0x0F, 0x4D, 0xC0, 0x99, 0x1C, 0x24, 0xAD, 0xA3, 0x30, 0x08, + 0x05, 0x85, 0x7E, 0x8A, 0x20, 0x8D, 0x69, 0xE0, 0x3E, 0x81, 0x40, 0x0A, 0x73, 0xF0, 0x39, 0x52, + 0x70, 0x03, 0x06, 0x40, 0x00, 0xAC, 0xE0, 0x0B, 0x60, 0x30, 0x86, 0x30, 0x70, 0x26, 0xE3, 0xE0, + 0x0D, 0xDE, 0x60, 0x0E, 0xEB, 0x60, 0x0F, 0xEB, 0xB0, 0x08, 0x0E, 0x90, 0x03, 0x87, 0x70, 0x08, + 0x71, 0x30, 0x01, 0x45, 0xC0, 0x0C, 0xC7, 0xD0, 0x0C, 0x8A, 0x7D, 0x0D, 0xC7, 0x50, 0x01, 0x6D, + 0xD9, 0x0F, 0x73, 0x38, 0x18, 0xFD, 0x20, 0x08, 0x12, 0x90, 0x06, 0x94, 0x68, 0x09, 0xE4, 0x86, + 0x2D, 0xE5, 0xB3, 0x01, 0x0D, 0x40, 0x88, 0x70, 0xF1, 0x48, 0x5C, 0x40, 0x03, 0xDE, 0xC7, 0x8B, + 0x7E, 0x40, 0x7E, 0xA3, 0xE0, 0x08, 0x8C, 0xE3, 0xC8, 0x3D, 0xFB, 0x69, 0x60, 0x70, 0x37, 0xA4, + 0x10, 0x09, 0x4F, 0x13, 0x1C, 0x3B, 0xD0, 0x00, 0x7D, 0xC0, 0x07, 0x80, 0x80, 0x0B, 0xC1, 0x70, + 0x0D, 0xD7, 0xC0, 0x0D, 0xD9, 0x00, 0x0E, 0xEC, 0x40, 0x0E, 0xEA, 0x60, 0x0E, 0xEE, 0x00, 0x0F, + 0x81, 0x3D, 0xD8, 0x71, 0xB0, 0x02, 0x2B, 0x60, 0x0E, 0xDE, 0x50, 0x0D, 0xCC, 0x5D, 0x0D, 0xC4, + 0x30, 0x00, 0xEB, 0x40, 0x53, 0x4C, 0xFE, 0xF1, 0x11, 0xC7, 0x70, 0x01, 0x63, 0xD0, 0x30, 0x24, + 0x56, 0x6E, 0xE5, 0x23, 0x02, 0x0D, 0x50, 0x04, 0x81, 0xB1, 0x0F, 0x55, 0x20, 0x03, 0x03, 0xF2, + 0x34, 0xAE, 0x34, 0xAD, 0x00, 0x87, 0x7E, 0x78, 0x10, 0x65, 0xDC, 0x54, 0x06, 0x3D, 0xF0, 0x00, + 0x9E, 0x08, 0x09, 0xEA, 0x97, 0x07, 0x28, 0x40, 0x03, 0x93, 0xC0, 0x07, 0xC6, 0x70, 0x0C, 0xD3, + 0x40, 0x0E, 0xD0, 0x00, 0x0E, 0xE9, 0x20, 0x0F, 0xEA, 0x90, 0x0F, 0xC3, 0x0D, 0x0F, 0x2B, 0xC0, + 0x00, 0xC6, 0xED, 0x00, 0x2B, 0x20, 0x0F, 0xCB, 0x0D, 0x0E, 0xD9, 0x90, 0x0D, 0x9B, 0x80, 0x06, + 0xC0, 0x86, 0xB0, 0x04, 0x63, 0x01, 0x6B, 0xC0, 0x38, 0x07, 0x06, 0x51, 0xDB, 0xDD, 0x00, 0x19, + 0x90, 0xA8, 0x53, 0xB1, 0xCA, 0x01, 0xAA, 0x6F, 0x9C, 0x65, 0xDE, 0x71, 0x36, 0xA5, 0x52, 0xC5, + 0x06, 0x51, 0xC0, 0x03, 0x12, 0x10, 0x0A, 0x90, 0xF0, 0x54, 0x6C, 0x20, 0x07, 0x21, 0x10, 0x0A, + 0x91, 0x80, 0x0B, 0xC7, 0xE0, 0x0C, 0xCE, 0xC0, 0x0E, 0xDF, 0xF0, 0x0D, 0xEC, 0xF0, 0x0E, 0xEA, + 0x50, 0x0F, 0xEE, 0x50, 0x0F, 0xC5, 0x00, 0x00, 0x0C, 0xC0, 0x01, 0x0E, 0x00, 0x00, 0xCE, 0x60, + 0x0E, 0xEC, 0x90, 0x0E, 0xE0, 0x60, 0x0D, 0xE0, 0x60, 0x03, 0xC4, 0xF0, 0x9C, 0xF9, 0xD3, 0x01, + 0x66, 0xA0, 0x05, 0xD8, 0xA6, 0x4F, 0x94, 0x24, 0x03, 0x9C, 0x5D, 0x97, 0x6F, 0x11, 0x11, 0xFD, + 0x70, 0x0C, 0x09, 0xD0, 0xB4, 0xD1, 0x55, 0x59, 0x97, 0x3D, 0x0A, 0xE0, 0x55, 0x7C, 0x8F, 0xD3, + 0x38, 0x74, 0xB0, 0x76, 0x67, 0xC8, 0x0A, 0x90, 0x60, 0x61, 0x7E, 0x00, 0x7F, 0xB2, 0x40, 0x09, + 0x89, 0x40, 0x0E, 0xDB, 0x60, 0x0D, 0xE9, 0x60, 0xE3, 0xEC, 0xA0, 0x0E, 0x0B, 0x21, 0x0F, 0xFA, + 0xB0, 0x0B, 0x41, 0x0E, 0x00, 0xFE, 0xC8, 0x20, 0x0F, 0xDF, 0x90, 0x0E, 0xE9, 0x60, 0x0D, 0xD6, + 0x90, 0x0C, 0x36, 0x70, 0x16, 0x2C, 0xA3, 0x11, 0x1D, 0x20, 0x05, 0x50, 0x6E, 0x08, 0xFA, 0x24, + 0x31, 0x35, 0x40, 0x36, 0x0A, 0xA0, 0x02, 0x1A, 0x9E, 0x13, 0x55, 0x71, 0x0D, 0x10, 0x30, 0x03, + 0x69, 0x30, 0xE2, 0x6C, 0x80, 0x07, 0x0D, 0x93, 0x5D, 0x63, 0xCD, 0x49, 0x15, 0x78, 0x4F, 0x5A, + 0x20, 0x06, 0x21, 0xC0, 0x04, 0xB1, 0x30, 0x71, 0x75, 0xC0, 0x08, 0x5D, 0x20, 0x01, 0x91, 0x60, + 0x0C, 0xA8, 0x70, 0x0B, 0x71, 0x5E, 0xE3, 0x45, 0xCE, 0x0E, 0xF2, 0x40, 0xEB, 0x39, 0xFE, 0x0F, + 0xDC, 0xB0, 0x10, 0x80, 0x3E, 0xE7, 0x48, 0x7E, 0x07, 0xB7, 0x10, 0x11, 0xFA, 0x87, 0x12, 0x1D, + 0x20, 0x06, 0x5A, 0x00, 0x54, 0x50, 0x28, 0x31, 0x34, 0x30, 0x45, 0x05, 0xB0, 0xD5, 0x6F, 0xB1, + 0x97, 0x05, 0xF0, 0x02, 0x5A, 0xE0, 0x44, 0x61, 0x50, 0x06, 0x4E, 0xD4, 0x06, 0x83, 0x00, 0xE6, + 0x96, 0x50, 0x7C, 0xD5, 0xF3, 0x34, 0x8E, 0x33, 0xBE, 0x2C, 0xF0, 0x03, 0x25, 0xD5, 0x09, 0x90, + 0x10, 0x09, 0x28, 0xE0, 0x04, 0x7C, 0x10, 0x0D, 0x82, 0x90, 0x0A, 0xE0, 0x00, 0x0D, 0x35, 0x9E, + 0x0E, 0xEC, 0x70, 0xE3, 0xED, 0xE0, 0x0F, 0x3B, 0xEE, 0x0E, 0xEE, 0xA0, 0x0E, 0x80, 0x5E, 0xE3, + 0x35, 0x8E, 0x01, 0xE4, 0xC0, 0x98, 0x3A, 0x01, 0x01, 0x66, 0x30, 0xCB, 0xD9, 0x7D, 0x5E, 0x52, + 0x74, 0x01, 0x06, 0xB0, 0x3A, 0x70, 0x31, 0x7D, 0xB3, 0xBB, 0x01, 0x49, 0xF0, 0x38, 0x07, 0xA4, + 0x49, 0x56, 0xD0, 0x06, 0xDE, 0x55, 0x78, 0x15, 0x18, 0x35, 0x11, 0xD3, 0x3E, 0x20, 0xF0, 0x03, + 0x5A, 0x70, 0x0A, 0x7C, 0x90, 0x07, 0xB0, 0x07, 0x09, 0x81, 0x30, 0x0C, 0x99, 0xC0, 0x0B, 0xDE, + 0x90, 0x0D, 0x73, 0x7E, 0xFE, 0xE3, 0xEF, 0xD0, 0x0E, 0xED, 0x70, 0x0F, 0xF3, 0x5E, 0xEB, 0xDF, + 0x00, 0x0D, 0x81, 0x0E, 0x0C, 0x85, 0xEE, 0x11, 0x87, 0x4E, 0x84, 0x0A, 0x70, 0xDD, 0x41, 0x7A, + 0x31, 0x44, 0xE7, 0x02, 0xF1, 0x7A, 0x0D, 0x33, 0xAF, 0x13, 0x37, 0xDC, 0x01, 0x1B, 0x50, 0xEE, + 0xD8, 0xC2, 0x4B, 0x04, 0x35, 0xCB, 0xC3, 0x57, 0x78, 0xC4, 0x54, 0x4C, 0xF7, 0x34, 0x07, 0xDC, + 0x62, 0xB9, 0x2C, 0x20, 0x01, 0xC0, 0x53, 0xDF, 0x54, 0x5B, 0x02, 0xCD, 0x50, 0x0D, 0xE0, 0x40, + 0x0E, 0xE4, 0xF0, 0x0E, 0xEF, 0x70, 0x0E, 0xFC, 0x20, 0x0C, 0xD3, 0x50, 0x0F, 0x0B, 0xC1, 0x0E, + 0xD0, 0x90, 0x0C, 0x47, 0x6E, 0x03, 0xC2, 0x40, 0x10, 0xC8, 0xD8, 0xF3, 0x04, 0xF3, 0x00, 0x3F, + 0x4A, 0xAD, 0x1E, 0x78, 0x5E, 0x34, 0x50, 0xA4, 0x01, 0x10, 0x4D, 0x6F, 0xE1, 0x15, 0x19, 0x80, + 0x2C, 0x35, 0x70, 0x47, 0x1D, 0x24, 0x70, 0xD8, 0x36, 0x7C, 0x09, 0x66, 0x58, 0x65, 0xD4, 0xD6, + 0xDC, 0x22, 0x45, 0x2E, 0xB0, 0x03, 0x94, 0xB0, 0x01, 0x4C, 0xC0, 0x09, 0x9C, 0x30, 0x09, 0x6A, + 0x50, 0x00, 0xDC, 0xF0, 0x0C, 0xE7, 0x70, 0x0E, 0xE4, 0x70, 0x0E, 0xFE, 0x6D, 0xE7, 0xEA, 0xA0, + 0x0E, 0xE4, 0xF0, 0xEE, 0xDB, 0xB0, 0xF9, 0x02, 0x10, 0xEF, 0x08, 0x01, 0xEC, 0x28, 0xC1, 0xAB, + 0x6D, 0x8F, 0xC8, 0xE6, 0x45, 0x74, 0x27, 0x30, 0x3F, 0xA8, 0x42, 0xE9, 0x1A, 0x61, 0x1F, 0xFF, + 0x30, 0x04, 0x0B, 0xF0, 0x02, 0x71, 0x64, 0x50, 0x51, 0xD3, 0x49, 0x57, 0x3B, 0x80, 0x0E, 0x63, + 0xA9, 0x18, 0x63, 0x2D, 0xC8, 0xA4, 0x01, 0x09, 0x60, 0x02, 0x26, 0x20, 0x22, 0x58, 0x40, 0x27, + 0x74, 0xB0, 0x06, 0x1E, 0x70, 0x0C, 0xDE, 0x00, 0x0E, 0x92, 0xBF, 0xF5, 0xFC, 0xD0, 0x0E, 0x76, + 0xBE, 0xF5, 0xE0, 0xFE, 0xF0, 0xFC, 0xDB, 0x70, 0x0B, 0x24, 0x50, 0x1E, 0x40, 0x51, 0x18, 0xD2, + 0x07, 0x0A, 0xD6, 0x4D, 0x75, 0x98, 0xCD, 0x06, 0x2F, 0x5C, 0x03, 0x0E, 0x5C, 0x00, 0xF0, 0x86, + 0x12, 0xEC, 0x21, 0x13, 0x9C, 0x91, 0x11, 0xEB, 0xD0, 0x2E, 0x2C, 0xE0, 0xCA, 0xC6, 0x45, 0x06, + 0x5B, 0x03, 0xCF, 0x08, 0x86, 0xBC, 0x9B, 0xC5, 0x83, 0x4E, 0x90, 0x3E, 0xDF, 0xB2, 0x03, 0x35, + 0xE8, 0x20, 0x58, 0xB0, 0x66, 0x6C, 0xC0, 0x07, 0x2F, 0x10, 0x0C, 0x23, 0x1F, 0xF9, 0x00, 0x41, + 0xAE, 0xDD, 0x3C, 0x6E, 0xF2, 0xC8, 0x91, 0x03, 0x47, 0xCE, 0x9A, 0x35, 0x72, 0x24, 0x84, 0xFD, + 0xF3, 0xF7, 0x4F, 0x22, 0x3F, 0x89, 0xFE, 0x2C, 0xFA, 0xE3, 0x97, 0x91, 0xDF, 0xBD, 0x7E, 0x82, + 0x3C, 0x8C, 0x09, 0x53, 0x67, 0x90, 0x1D, 0x30, 0x4F, 0xA2, 0x20, 0x61, 0xF1, 0xA0, 0x40, 0x45, + 0x89, 0x2D, 0x5D, 0x5E, 0x6C, 0xB9, 0x0F, 0x5B, 0x91, 0x11, 0x6E, 0xC6, 0xED, 0xB3, 0x47, 0xAF, + 0x85, 0x97, 0x0D, 0x20, 0x94, 0xC8, 0x61, 0x63, 0x85, 0x8C, 0x16, 0x2D, 0x4E, 0xEA, 0x48, 0x72, + 0x24, 0xD2, 0x91, 0xA5, 0x41, 0x6D, 0xC2, 0xB0, 0xA1, 0xC3, 0x28, 0x49, 0x97, 0x0D, 0x3E, 0xFA, + 0x98, 0xF1, 0x80, 0x85, 0x51, 0x9D, 0x30, 0x6B, 0x76, 0xA0, 0xD2, 0x56, 0xED, 0xE0, 0xB9, 0x79, + 0xDB, 0xD4, 0x79, 0x33, 0x07, 0xCE, 0x1A, 0x34, 0x68, 0xDB, 0x36, 0x91, 0xE0, 0x67, 0xB1, 0x25, + 0xC5, 0x97, 0xFF, 0x34, 0xFE, 0xEB, 0xD7, 0xC2, 0x05, 0x18, 0x2B, 0x83, 0x1E, 0x31, 0x9A, 0xA3, + 0xA5, 0x0B, 0x8D, 0x10, 0x07, 0x7E, 0x41, 0x74, 0x99, 0x18, 0xE2, 0xC5, 0x7A, 0xFB, 0x54, 0x0D, + 0x50, 0xF0, 0xE1, 0x02, 0x81, 0x0B, 0xA5, 0xE2, 0x65, 0x1A, 0x40, 0xA4, 0x89, 0x14, 0x30, 0x69, + 0xCA, 0xCC, 0xFE, 0x01, 0x03, 0x26, 0x24, 0xD2, 0xA5, 0xA2, 0x4C, 0x3B, 0x32, 0x24, 0x49, 0xD3, + 0x25, 0x3F, 0x20, 0xCC, 0x04, 0xCA, 0x83, 0x82, 0x07, 0x29, 0x46, 0x4E, 0xBB, 0x34, 0xA9, 0x12, + 0x76, 0xDB, 0x32, 0x57, 0xDB, 0xB8, 0xA9, 0x7B, 0x56, 0x8D, 0x6D, 0xB2, 0x64, 0xC0, 0x04, 0x6C, + 0xAB, 0x18, 0xD1, 0x6E, 0xE2, 0x7C, 0x76, 0xE9, 0xF6, 0x5B, 0xC0, 0x43, 0x4E, 0x98, 0x41, 0x83, + 0xFC, 0xA4, 0x49, 0x93, 0x04, 0x85, 0x88, 0x02, 0xFB, 0x9A, 0x2B, 0x7E, 0x69, 0xF1, 0xDE, 0xBF, + 0x7D, 0x04, 0x82, 0xEC, 0xE0, 0xB1, 0x64, 0x89, 0x8B, 0x0B, 0x1E, 0x54, 0x5A, 0xB8, 0x31, 0x23, + 0x4A, 0x9A, 0x31, 0x60, 0xCA, 0xB0, 0xF1, 0x63, 0x48, 0x93, 0xA3, 0x47, 0x96, 0x4C, 0x9F, 0x1E, + 0x25, 0x40, 0x49, 0x6A, 0xF0, 0x03, 0x90, 0x48, 0x7A, 0x48, 0x63, 0x0E, 0x36, 0xD8, 0xD0, 0x62, + 0x0B, 0x29, 0x36, 0xD0, 0xE6, 0x19, 0x67, 0x84, 0x71, 0x66, 0x1B, 0x61, 0xD0, 0x78, 0x86, 0x98, + 0x55, 0x90, 0x01, 0xC6, 0xB8, 0x65, 0x32, 0xF2, 0xE7, 0x1E, 0xE5, 0x96, 0x73, 0x29, 0xA3, 0x96, + 0xF0, 0x69, 0x40, 0x8C, 0xAD, 0x50, 0xA3, 0x43, 0x8B, 0x93, 0x66, 0x78, 0x60, 0x81, 0x7E, 0x14, + 0x1B, 0xB1, 0x25, 0x8B, 0xF2, 0xE9, 0xA7, 0x97, 0x06, 0x76, 0x30, 0x63, 0x0C, 0x39, 0xE4, 0x30, + 0x03, 0x0A, 0x20, 0x80, 0x78, 0x41, 0x84, 0x0B, 0x24, 0xA0, 0x21, 0x8A, 0x27, 0xC0, 0x80, 0xCA, + 0x8E, 0xD4, 0x24, 0xB1, 0xC3, 0x49, 0x4B, 0x96, 0x1A, 0xC5, 0x11, 0x51, 0x2C, 0x91, 0xE4, 0x12, + 0x3B, 0xC2, 0xE0, 0x23, 0x89, 0x32, 0xAC, 0xF0, 0x83, 0x28, 0x07, 0x35, 0x68, 0x86, 0x98, 0x64, + 0x9C, 0x59, 0xC6, 0x99, 0x6A, 0x76, 0x69, 0x26, 0x95, 0x3D, 0x76, 0xB9, 0x45, 0x00, 0x57, 0x28, + 0xCA, 0xFE, 0x07, 0xA6, 0x89, 0x14, 0xA3, 0x2B, 0x1F, 0x65, 0x36, 0xE0, 0x43, 0x92, 0x47, 0x58, + 0x74, 0xB1, 0x87, 0x17, 0x08, 0x98, 0xE5, 0xBB, 0xF0, 0xEE, 0x5C, 0x2C, 0x1F, 0x7C, 0x5A, 0xB8, + 0xA0, 0x0B, 0x2D, 0x18, 0x64, 0x44, 0x8B, 0x34, 0xA2, 0x88, 0x02, 0x90, 0x2D, 0x06, 0x63, 0x21, + 0x84, 0x1F, 0xC8, 0xF0, 0x03, 0x8F, 0x3A, 0x9C, 0xF4, 0xC3, 0x0A, 0x27, 0xAC, 0x60, 0x43, 0x11, + 0x45, 0x0C, 0x31, 0xC4, 0x12, 0x4B, 0xEA, 0x30, 0x84, 0x2B, 0x36, 0xCA, 0xE0, 0xEB, 0x0D, 0x30, + 0xB4, 0x58, 0x63, 0x89, 0x12, 0xCA, 0x3C, 0xD3, 0x99, 0x64, 0x90, 0x79, 0x66, 0x17, 0x62, 0x76, + 0xD9, 0x65, 0x8F, 0x23, 0xE8, 0xFA, 0x67, 0xBC, 0x11, 0x89, 0x75, 0x69, 0xBC, 0x7E, 0xB2, 0x08, + 0x41, 0x0E, 0x49, 0xA6, 0xE4, 0x0A, 0x8C, 0x2E, 0x42, 0x48, 0xC1, 0x80, 0x7D, 0x16, 0x3B, 0xD4, + 0x39, 0x6C, 0xF1, 0x09, 0x42, 0x03, 0xA0, 0x5A, 0x0D, 0xA3, 0x0D, 0x36, 0xDE, 0x20, 0xC3, 0x89, + 0xA2, 0xA2, 0x80, 0x82, 0x05, 0x14, 0x94, 0xA0, 0x83, 0x8E, 0x05, 0x17, 0xD4, 0x22, 0x89, 0x24, + 0x94, 0x30, 0x17, 0xBF, 0x3A, 0x8E, 0xAA, 0xA3, 0x8D, 0x36, 0xAC, 0x48, 0xE3, 0x8D, 0x37, 0x44, + 0x7D, 0xA2, 0x0B, 0x19, 0x6E, 0x7D, 0x86, 0xB8, 0x33, 0x91, 0x41, 0x66, 0x97, 0x5C, 0x76, 0xD9, + 0x24, 0x02, 0x13, 0xFF, 0x69, 0xAE, 0xCE, 0x1A, 0xC3, 0xF3, 0x07, 0x47, 0x05, 0x7A, 0xF0, 0xE3, + 0x12, 0x4B, 0x0C, 0xD9, 0x77, 0xB0, 0x19, 0x5A, 0x90, 0x11, 0x3C, 0xB9, 0xEE, 0xBC, 0x11, 0x1F, + 0x18, 0x50, 0x00, 0xA4, 0xBF, 0x3A, 0xD8, 0x90, 0xA4, 0x55, 0x3C, 0xCA, 0x20, 0xEA, 0x89, 0x24, + 0xA2, 0x48, 0xA2, 0x06, 0x25, 0xB4, 0x20, 0xE3, 0x29, 0x36, 0x66, 0x8D, 0xF7, 0x07, 0x39, 0xD2, + 0xFE, 0x70, 0x82, 0x8D, 0x7B, 0x57, 0x0E, 0x83, 0x0C, 0x32, 0xD2, 0xE0, 0x39, 0x8A, 0x25, 0x24, + 0xF0, 0xA4, 0x19, 0x64, 0xA0, 0x39, 0x33, 0x19, 0x61, 0x7E, 0x6D, 0xA5, 0x15, 0x01, 0xB8, 0x41, + 0xD4, 0x50, 0xF0, 0xB0, 0xC5, 0xAB, 0x80, 0x35, 0x0A, 0xB9, 0x44, 0x13, 0xAE, 0xAC, 0x88, 0x62, + 0x86, 0x41, 0x8F, 0xB1, 0x31, 0x5B, 0x12, 0x2B, 0xC6, 0xE7, 0x81, 0x25, 0xD8, 0x58, 0xCA, 0x94, + 0x4B, 0x0C, 0x79, 0x84, 0x63, 0x45, 0xE6, 0x80, 0x59, 0x52, 0x30, 0x9C, 0x30, 0x17, 0xE7, 0x76, + 0xE7, 0xF8, 0x59, 0x8B, 0x9B, 0xF9, 0x0E, 0xC3, 0x8F, 0x28, 0xF3, 0xBE, 0x34, 0x0A, 0x27, 0x92, + 0xA0, 0x01, 0x8A, 0x02, 0x8E, 0x21, 0x06, 0x18, 0x64, 0x92, 0xB9, 0x03, 0x98, 0x5B, 0x6E, 0xF9, + 0xE5, 0x13, 0x00, 0xA6, 0x81, 0x88, 0xA2, 0x7A, 0x24, 0xD2, 0x3A, 0x31, 0x8B, 0xE6, 0x81, 0xF8, + 0x9A, 0x0B, 0xD2, 0x38, 0x0A, 0x5C, 0x2D, 0x90, 0x78, 0x01, 0x86, 0x01, 0xFA, 0xC9, 0x27, 0xAE, + 0x1A, 0x47, 0x5E, 0xFB, 0x1F, 0x7B, 0x88, 0x90, 0x42, 0x0E, 0x55, 0x15, 0xF1, 0xA3, 0x90, 0x56, + 0x97, 0xDA, 0xD8, 0xDD, 0x37, 0xD6, 0xD8, 0x82, 0x28, 0x26, 0xDB, 0x85, 0xCA, 0x5D, 0x36, 0xC2, + 0x10, 0x6A, 0x41, 0x3F, 0xE8, 0x28, 0xE9, 0x24, 0x24, 0x6A, 0xE8, 0xA1, 0x07, 0x1A, 0x44, 0x80, + 0xE0, 0x18, 0x61, 0x6E, 0xE9, 0x70, 0x93, 0xCB, 0x73, 0xF9, 0x64, 0x00, 0x07, 0x16, 0x89, 0x58, + 0x64, 0x1A, 0xE5, 0xEA, 0x07, 0x95, 0x17, 0x50, 0x37, 0x44, 0x11, 0x3A, 0xC2, 0xD8, 0x02, 0x08, + 0x0F, 0x5A, 0x50, 0x61, 0x39, 0xDA, 0xB9, 0x4E, 0x96, 0x3C, 0x2F, 0xA0, 0x70, 0xD6, 0x12, 0x36, + 0x08, 0x0C, 0xD7, 0x20, 0x02, 0x14, 0x3C, 0x32, 0x6C, 0x61, 0x0B, 0xA1, 0xD1, 0x82, 0xCE, 0xFE, + 0x74, 0xF6, 0xAE, 0x05, 0x15, 0xED, 0x0D, 0x93, 0x4A, 0x42, 0xF5, 0x68, 0x30, 0xC1, 0x19, 0xC8, + 0x4F, 0x15, 0xB9, 0xD8, 0xDE, 0x2A, 0x56, 0x71, 0x8B, 0x4D, 0x80, 0x6F, 0x00, 0x43, 0x58, 0x01, + 0x00, 0x3E, 0xB1, 0x35, 0xFC, 0x25, 0x27, 0x22, 0xE8, 0xF8, 0xC0, 0x0C, 0xC8, 0x50, 0x07, 0x53, + 0xB1, 0x81, 0x0C, 0x65, 0x0B, 0xC2, 0x00, 0x98, 0xE1, 0x9C, 0x10, 0xA9, 0xCD, 0x46, 0x8D, 0x49, + 0x61, 0x1E, 0xFC, 0x60, 0x0A, 0x3A, 0x24, 0xE1, 0x01, 0x6B, 0x00, 0x43, 0x21, 0x54, 0xA3, 0x09, + 0x43, 0x30, 0x48, 0x09, 0x51, 0x00, 0x43, 0x60, 0xC2, 0x90, 0x86, 0xA2, 0x91, 0xE1, 0x5D, 0xEE, + 0x0A, 0x83, 0x98, 0xBA, 0xB0, 0x84, 0x1E, 0xC8, 0x00, 0x05, 0x2C, 0x60, 0xC1, 0x0C, 0x4E, 0x50, + 0x82, 0x18, 0xFC, 0xA2, 0x15, 0xAE, 0x70, 0xC5, 0x26, 0x56, 0xB1, 0x89, 0x54, 0x84, 0x2F, 0x0B, + 0x23, 0xC0, 0x81, 0x0A, 0x00, 0x70, 0x8D, 0x6B, 0x85, 0xCE, 0x4E, 0x8B, 0x89, 0xC8, 0x3E, 0x7A, + 0x71, 0x81, 0xB7, 0xB1, 0x0A, 0x0F, 0x51, 0x44, 0xC2, 0x09, 0x0A, 0xA0, 0x02, 0xD8, 0xD1, 0x49, + 0x74, 0xE6, 0xDB, 0xC7, 0x02, 0x84, 0x60, 0x06, 0x48, 0x9C, 0x62, 0x0E, 0x4F, 0x08, 0x81, 0x04, + 0xD6, 0x90, 0x86, 0x4E, 0xB4, 0x0C, 0x0F, 0x43, 0x51, 0x82, 0x12, 0x3A, 0xD3, 0x19, 0xEC, 0x54, + 0x32, 0x0D, 0x81, 0x13, 0x0C, 0xA5, 0x90, 0x50, 0x45, 0x2B, 0xB2, 0xE0, 0x05, 0x5B, 0x24, 0x82, + 0x27, 0x52, 0xE1, 0x0A, 0x38, 0xC0, 0x61, 0x13, 0x9B, 0xF8, 0x44, 0x2A, 0x02, 0xA0, 0x07, 0x18, + 0x58, 0x00, 0x02, 0x10, 0x50, 0x63, 0x3F, 0x66, 0x74, 0x3E, 0xE5, 0xC0, 0x04, 0x1D, 0x5E, 0x10, + 0x41, 0x17, 0xF2, 0x83, 0x07, 0x3A, 0x58, 0x61, 0x0B, 0x32, 0x10, 0x01, 0x01, 0xD0, 0xFE, 0xD6, + 0x92, 0xCF, 0xD5, 0x45, 0x74, 0x11, 0xC9, 0x51, 0x03, 0xCE, 0x20, 0x0B, 0x33, 0x44, 0x62, 0x12, + 0x62, 0x90, 0x00, 0x08, 0xA2, 0x20, 0x87, 0xE7, 0xED, 0xAC, 0x28, 0x44, 0x11, 0xD3, 0x16, 0x28, + 0x45, 0xB3, 0x93, 0xD4, 0x80, 0x7A, 0xD5, 0xAB, 0x9E, 0x0C, 0xAC, 0x88, 0x82, 0x10, 0xBC, 0xC0, + 0x3D, 0x31, 0xF8, 0xC4, 0x1E, 0x36, 0x71, 0x84, 0x23, 0x6C, 0x22, 0x11, 0x89, 0x18, 0x80, 0x11, + 0xAA, 0x70, 0x03, 0x13, 0x28, 0xC0, 0x02, 0x31, 0x30, 0x00, 0x02, 0xAE, 0xF5, 0x8F, 0x79, 0x8C, + 0xC8, 0x4E, 0x35, 0xEC, 0x07, 0x36, 0x2C, 0xC0, 0x83, 0x31, 0xF8, 0xE1, 0x5E, 0x0C, 0x2A, 0x5B, + 0x03, 0xB2, 0x80, 0x8F, 0x96, 0x90, 0x8E, 0x84, 0x36, 0xAA, 0x18, 0x79, 0x6C, 0x51, 0x00, 0x13, + 0xFC, 0x21, 0x10, 0xA1, 0x58, 0x42, 0x14, 0x34, 0x40, 0x03, 0x33, 0x50, 0x6A, 0x71, 0x49, 0x58, + 0x02, 0x13, 0x98, 0xB0, 0x04, 0x19, 0xCC, 0x40, 0x5D, 0x28, 0x20, 0x27, 0x0B, 0x4E, 0x20, 0x82, + 0x17, 0xBC, 0x20, 0x04, 0x21, 0xC8, 0x94, 0x16, 0x43, 0xB0, 0x81, 0x0D, 0x5C, 0xA0, 0x01, 0x05, + 0x70, 0x43, 0x22, 0x4A, 0x59, 0xCA, 0x3D, 0xA0, 0x01, 0x00, 0x59, 0xC8, 0xC4, 0x0E, 0x66, 0x00, + 0xD3, 0x9A, 0x76, 0x60, 0x01, 0x6E, 0x98, 0xD1, 0xC8, 0x2E, 0xA2, 0x9C, 0xF1, 0xFC, 0x03, 0x1F, + 0xC3, 0x28, 0x80, 0x19, 0xE6, 0xD0, 0x2E, 0x77, 0x6D, 0x61, 0x09, 0x1B, 0x18, 0x00, 0x36, 0x66, + 0xF4, 0xB0, 0x87, 0x2A, 0x46, 0x96, 0xE3, 0xC8, 0x82, 0x02, 0x78, 0x90, 0x87, 0x2E, 0x4C, 0x51, + 0x02, 0x22, 0x68, 0xC2, 0x0E, 0x5A, 0x2A, 0x02, 0x21, 0x40, 0xE0, 0x03, 0x0A, 0x20, 0x00, 0x01, + 0x3A, 0x90, 0x02, 0x2E, 0xCC, 0xA0, 0x09, 0x25, 0x50, 0x80, 0x01, 0xF4, 0x5A, 0xFE, 0x80, 0x06, + 0x7C, 0xC0, 0x02, 0xEE, 0x91, 0xC0, 0x03, 0x1A, 0xA0, 0x80, 0x3D, 0x26, 0x02, 0x0D, 0xA5, 0x3C, + 0x02, 0x1C, 0x48, 0x00, 0x80, 0x21, 0xA0, 0x42, 0x0D, 0x4B, 0xE8, 0x42, 0x04, 0x97, 0x30, 0x83, + 0x1B, 0x5C, 0xC0, 0x00, 0xB3, 0x48, 0xEA, 0x45, 0x9A, 0x0A, 0x91, 0xF1, 0xC0, 0x03, 0x1F, 0x62, + 0x05, 0x84, 0xBB, 0xAC, 0x60, 0x05, 0x2D, 0xF4, 0xE0, 0x06, 0x04, 0x00, 0x05, 0xC4, 0xBA, 0xBA, + 0x5A, 0x88, 0xED, 0xA3, 0x00, 0x3D, 0xC8, 0x43, 0x14, 0x6A, 0xE5, 0x82, 0x04, 0x0C, 0xB6, 0x01, + 0x06, 0x98, 0x40, 0x2F, 0x40, 0x21, 0x0D, 0x71, 0xAC, 0x03, 0x1D, 0x30, 0x78, 0xC0, 0x03, 0x36, + 0x10, 0x8F, 0x75, 0xF4, 0xE3, 0x1A, 0xBF, 0x40, 0x03, 0x01, 0x06, 0x60, 0x00, 0x05, 0x0C, 0x96, + 0xB0, 0x03, 0xA8, 0x40, 0x22, 0xF6, 0xB0, 0x88, 0x23, 0x90, 0x40, 0x00, 0x72, 0x6A, 0x05, 0x00, + 0x0A, 0x20, 0x04, 0x31, 0x00, 0x71, 0x66, 0x9B, 0x04, 0x42, 0x0A, 0x02, 0x30, 0x82, 0x7D, 0xC0, + 0xAE, 0x58, 0xE3, 0xF9, 0x9C, 0x3B, 0x24, 0xB2, 0x0F, 0x2F, 0x68, 0x20, 0x0F, 0xF7, 0x99, 0xD5, + 0x16, 0x7E, 0x30, 0x83, 0x0B, 0x4C, 0xC0, 0x39, 0xFC, 0x28, 0x26, 0x6B, 0x15, 0xF3, 0xB9, 0x7D, + 0xEC, 0x43, 0x01, 0x21, 0x20, 0x6B, 0xBC, 0x7A, 0xB0, 0x01, 0x18, 0x18, 0x40, 0x19, 0xF8, 0x58, + 0x07, 0x3C, 0xF6, 0x81, 0x0F, 0x7A, 0x34, 0xD7, 0xA4, 0x0F, 0x50, 0xC0, 0x35, 0x66, 0xA9, 0x0F, + 0x7D, 0xFC, 0xE2, 0x0A, 0x06, 0x18, 0x40, 0x00, 0x32, 0x3C, 0x00, 0x00, 0x44, 0x00, 0x00, 0x1D, + 0x86, 0x83, 0x30, 0xE4, 0xB2, 0x8F, 0x2B, 0x0C, 0x00, 0x06, 0x6A, 0x98, 0x04, 0x18, 0xC8, 0x00, + 0x06, 0x25, 0x6C, 0xB2, 0x09, 0x0F, 0x20, 0x40, 0x16, 0xFA, 0x2B, 0x91, 0xFE, 0xCD, 0xE2, 0x05, + 0x1B, 0x05, 0xE8, 0x82, 0x13, 0x8B, 0xD2, 0x05, 0x14, 0xD0, 0x77, 0x00, 0xE2, 0xE0, 0x5A, 0x88, + 0xEE, 0xD7, 0xD5, 0xFC, 0xFE, 0x83, 0xC2, 0x1D, 0x90, 0x40, 0x1E, 0xFC, 0x55, 0x03, 0x4F, 0x52, + 0x00, 0x01, 0xF8, 0x80, 0xC7, 0x3F, 0xD6, 0xB1, 0x0E, 0x44, 0x34, 0x60, 0x33, 0x62, 0x68, 0x02, + 0x0C, 0x10, 0xA0, 0xDE, 0x7F, 0xD4, 0x43, 0x1F, 0xFD, 0xDD, 0x87, 0x38, 0x98, 0x71, 0x0C, 0x20, + 0x73, 0x63, 0x1A, 0x22, 0xF2, 0x47, 0x3F, 0x47, 0x8C, 0x8F, 0x7E, 0xA8, 0x80, 0x00, 0x4D, 0x90, + 0xC3, 0xA8, 0x9C, 0x90, 0x86, 0x35, 0x74, 0xA1, 0x07, 0x30, 0x52, 0x80, 0x11, 0x8A, 0xDB, 0xE5, + 0x7F, 0xB8, 0xA3, 0x1F, 0xEB, 0xB0, 0xF2, 0x16, 0x00, 0x61, 0xAE, 0x28, 0xF4, 0x60, 0xA6, 0x04, + 0xE8, 0x85, 0x2C, 0x55, 0x5B, 0xAC, 0xA5, 0xAE, 0xF6, 0x3B, 0xE5, 0x6B, 0x6D, 0x0B, 0x92, 0x1C, + 0x1A, 0x26, 0x6C, 0xC0, 0x95, 0x0B, 0xB0, 0xC7, 0x82, 0xCB, 0x81, 0x00, 0x0F, 0x40, 0xA1, 0x0B, + 0x51, 0xA0, 0xC1, 0x06, 0x20, 0x80, 0x8F, 0x7B, 0xDC, 0xA3, 0x1E, 0x8F, 0x6E, 0x89, 0x88, 0xD0, + 0xBC, 0xD4, 0x88, 0xE0, 0xE8, 0x5A, 0xFD, 0x60, 0x86, 0x02, 0x92, 0x9C, 0x40, 0xD2, 0x4E, 0x45, + 0x0C, 0x3C, 0xA0, 0x2D, 0x01, 0x04, 0x01, 0xE4, 0xE6, 0xE0, 0xC3, 0x0B, 0x3F, 0x5C, 0xA4, 0x80, + 0x8D, 0x04, 0x01, 0x23, 0xA0, 0xE3, 0x1A, 0xE2, 0x28, 0x6F, 0x3F, 0x9A, 0xFA, 0xC6, 0x87, 0x86, + 0x6E, 0x1E, 0xA4, 0xC3, 0x47, 0x0A, 0x42, 0x30, 0x09, 0x17, 0x49, 0x81, 0x05, 0x17, 0x38, 0x40, + 0x73, 0x41, 0x46, 0x01, 0xF4, 0xD8, 0xF5, 0x06, 0x09, 0x10, 0xC4, 0x3A, 0xEA, 0xB4, 0x9C, 0xE6, + 0x08, 0x79, 0x74, 0xAC, 0x8E, 0x28, 0x73, 0xC6, 0xF1, 0x01, 0x3E, 0xFE, 0x5D, 0x33, 0x0D, 0x5D, + 0x60, 0x42, 0x14, 0x98, 0x00, 0x85, 0x1D, 0x34, 0x20, 0x00, 0x2A, 0xF8, 0xC5, 0x3E, 0x04, 0x91, + 0x00, 0x20, 0x20, 0x41, 0x0C, 0x91, 0x9D, 0x6F, 0x3D, 0x0D, 0x60, 0x04, 0x03, 0x2C, 0xC0, 0x00, + 0x1D, 0x40, 0x85, 0xA2, 0xE1, 0xC8, 0xDA, 0x62, 0x16, 0xB3, 0x39, 0x1C, 0xB1, 0x47, 0x15, 0x36, + 0x30, 0x89, 0x31, 0x78, 0xB3, 0x07, 0x3D, 0x3E, 0xC1, 0x06, 0x58, 0x20, 0x02, 0x11, 0x78, 0x20, + 0xAF, 0x03, 0x70, 0x03, 0xA3, 0xF9, 0x99, 0x6A, 0xD9, 0xB1, 0x1A, 0x74, 0x10, 0xAB, 0x07, 0xB2, + 0x38, 0xB2, 0x0E, 0x05, 0x88, 0x20, 0x0F, 0xD7, 0x34, 0x17, 0x76, 0x64, 0xD6, 0x04, 0x22, 0x2C, + 0x60, 0x00, 0xCB, 0x85, 0xC1, 0x0B, 0x66, 0x40, 0x45, 0x1A, 0x6C, 0x47, 0x01, 0x0B, 0xA0, 0x00, + 0x65, 0x3C, 0x70, 0x83, 0x06, 0x40, 0x00, 0x1B, 0x0C, 0x65, 0x89, 0x7E, 0xCD, 0xF7, 0x0F, 0x74, + 0x54, 0xC1, 0xE5, 0x83, 0x76, 0xC2, 0x16, 0x6A, 0x20, 0x85, 0x25, 0x6C, 0x72, 0x03, 0x05, 0x10, + 0x04, 0x36, 0xC4, 0x21, 0x4B, 0xF5, 0x96, 0xDB, 0x50, 0x14, 0xC1, 0xC8, 0xC4, 0x52, 0x9E, 0xB5, + 0x88, 0xC0, 0x43, 0x1C, 0x06, 0x68, 0x42, 0x1E, 0x90, 0xE6, 0x07, 0x3F, 0x30, 0x48, 0xC0, 0x40, + 0xB8, 0x01, 0x0C, 0x3E, 0xD0, 0x00, 0x0F, 0x6C, 0xE0, 0x06, 0x27, 0xC0, 0xFB, 0x06, 0xE0, 0x8A, + 0x83, 0x05, 0x78, 0xE0, 0x05, 0x4D, 0x98, 0xC1, 0x0E, 0x12, 0x40, 0x8B, 0x59, 0x2A, 0x9D, 0x84, + 0x4D, 0xC5, 0x89, 0x08, 0x98, 0x10, 0x0B, 0x46, 0xB8, 0x0B, 0x0C, 0x63, 0xA0, 0x94, 0x14, 0x24, + 0x50, 0x0B, 0x7A, 0xD0, 0x23, 0x18, 0x10, 0xB0, 0xA7, 0x02, 0x8E, 0xD1, 0x8F, 0xFC, 0x22, 0x0B, + 0x3C, 0x1A, 0x01, 0x51, 0xBA, 0xFB, 0xF1, 0x0B, 0x05, 0x9C, 0xFE, 0x41, 0x0B, 0xF9, 0x69, 0x43, + 0x8B, 0x9C, 0xB0, 0x4D, 0x26, 0x58, 0x6F, 0x03, 0x0F, 0x48, 0x41, 0x02, 0x52, 0xE0, 0xD7, 0x01, + 0x8C, 0xA0, 0x1C, 0x14, 0x68, 0xC1, 0x06, 0x64, 0x20, 0x05, 0x29, 0x34, 0xE1, 0x02, 0x09, 0x47, + 0x94, 0xE1, 0x5B, 0xF2, 0x1D, 0x8C, 0x90, 0x27, 0x1A, 0x09, 0x98, 0xC4, 0x29, 0x24, 0x51, 0x87, + 0x97, 0x69, 0x41, 0x5A, 0x17, 0xA8, 0x42, 0x34, 0x2C, 0x50, 0x00, 0x9D, 0xB3, 0x00, 0x06, 0x14, + 0x90, 0xF0, 0x77, 0x3C, 0xFF, 0x50, 0x35, 0x27, 0xE6, 0x0A, 0x17, 0xC0, 0x05, 0x1D, 0x52, 0xB3, + 0xB2, 0xA2, 0xF4, 0xCD, 0x09, 0x3F, 0x00, 0x42, 0x02, 0x0A, 0xD0, 0x02, 0x08, 0x50, 0x60, 0x00, + 0x98, 0x3D, 0x06, 0x00, 0x5A, 0x10, 0x02, 0x19, 0xD4, 0x40, 0x0C, 0x6A, 0x68, 0x00, 0x36, 0xA2, + 0xBC, 0x7D, 0xE1, 0xE7, 0x43, 0x44, 0x31, 0x81, 0x80, 0x26, 0x90, 0x85, 0x67, 0xB1, 0x0E, 0x36, + 0x90, 0x83, 0x24, 0x00, 0x02, 0x0B, 0x50, 0x00, 0x13, 0x00, 0x02, 0x31, 0xD8, 0x02, 0x24, 0xD8, + 0x01, 0x02, 0xD0, 0xAA, 0x87, 0x42, 0x37, 0x98, 0xA8, 0x98, 0x88, 0xC9, 0x88, 0x7D, 0xF8, 0x00, + 0x35, 0x08, 0x04, 0x48, 0x68, 0xA4, 0xE5, 0x0B, 0x83, 0x32, 0x80, 0x19, 0x90, 0xA2, 0x96, 0xB8, + 0x9A, 0x80, 0x01, 0x28, 0x82, 0x04, 0x7B, 0x8C, 0x0F, 0x08, 0x01, 0x20, 0x58, 0x82, 0x26, 0x90, + 0x80, 0x0E, 0x50, 0x36, 0xBB, 0xE8, 0x27, 0xE1, 0x73, 0x09, 0xF5, 0x12, 0x11, 0xBA, 0x90, 0x86, + 0x06, 0xC0, 0x05, 0x46, 0xF0, 0x93, 0xE5, 0x71, 0x02, 0x26, 0x70, 0x01, 0x0F, 0xF8, 0x80, 0x1D, + 0xE8, 0x02, 0x30, 0x60, 0x84, 0x34, 0xE0, 0x01, 0x0B, 0xB0, 0x05, 0xCE, 0x23, 0xA1, 0x0A, 0x94, + 0x8B, 0xAF, 0x33, 0x91, 0x7D, 0x80, 0x80, 0x07, 0x30, 0xFE, 0x03, 0x4E, 0xE8, 0x84, 0x4B, 0xD0, + 0xC2, 0x4E, 0xB8, 0x1B, 0x3B, 0xB3, 0xAB, 0x0F, 0xB8, 0xB9, 0x75, 0xE8, 0xAF, 0x75, 0x20, 0x84, + 0x0E, 0xB0, 0x80, 0x97, 0x92, 0x80, 0x0B, 0xC8, 0x84, 0x6B, 0x59, 0xB5, 0x89, 0xB1, 0xC1, 0x52, + 0xAB, 0xA1, 0x5F, 0x20, 0x80, 0x46, 0xD0, 0xA5, 0xF7, 0x89, 0x17, 0x20, 0xF8, 0x00, 0x13, 0x70, + 0x81, 0x1E, 0x80, 0x04, 0x49, 0x50, 0x04, 0x48, 0xC0, 0x02, 0x08, 0x48, 0x34, 0x13, 0x81, 0x42, + 0x28, 0x7C, 0x34, 0x3B, 0xE9, 0x07, 0x7C, 0x08, 0x86, 0x04, 0xD0, 0x80, 0x1A, 0xE0, 0x03, 0x0F, + 0xEC, 0x84, 0x58, 0x20, 0x05, 0x3E, 0x98, 0x82, 0x1F, 0xE8, 0x01, 0x11, 0x88, 0xA1, 0x5F, 0x50, + 0xB0, 0x70, 0x80, 0x0C, 0xBF, 0x93, 0x80, 0x14, 0xC8, 0x34, 0x36, 0x4C, 0xB3, 0x21, 0xB3, 0xC1, + 0x96, 0xF8, 0xB3, 0x05, 0xB0, 0x00, 0x2E, 0x80, 0x02, 0x26, 0x98, 0x97, 0x1A, 0x08, 0x81, 0xDB, + 0x82, 0x00, 0x13, 0x10, 0x83, 0x34, 0x30, 0x85, 0x57, 0x20, 0x05, 0x28, 0x80, 0x00, 0x74, 0x88, + 0x1D, 0x13, 0x8A, 0x88, 0x5E, 0x84, 0x28, 0xF1, 0x80, 0x98, 0xEF, 0x40, 0xAF, 0x7E, 0x90, 0x09, + 0x2F, 0x48, 0x00, 0x14, 0x78, 0x02, 0x0D, 0x40, 0x81, 0x1A, 0x00, 0x84, 0x49, 0xC0, 0x05, 0x5C, + 0x98, 0x84, 0x99, 0xE9, 0x81, 0x1D, 0xB0, 0x80, 0x01, 0x50, 0x05, 0x6D, 0xB8, 0x80, 0x07, 0x68, + 0x82, 0x17, 0x08, 0xAC, 0x4C, 0xEB, 0x07, 0x7D, 0x28, 0x45, 0x1A, 0x19, 0x8F, 0x5D, 0xDC, 0x07, + 0x5B, 0x80, 0x80, 0x04, 0xD8, 0x01, 0x13, 0x30, 0x81, 0xBF, 0x32, 0xA9, 0x04, 0xF8, 0x02, 0x7A, + 0x10, 0x84, 0x00, 0xD8, 0x81, 0x48, 0xE0, 0x04, 0x52, 0xC8, 0x03, 0x05, 0xB0, 0x85, 0x6B, 0x61, + 0xB6, 0xAE, 0xF2, 0x3C, 0x59, 0xEA, 0x87, 0x62, 0xFE, 0x20, 0x84, 0x0F, 0x10, 0x01, 0x3E, 0x4C, + 0x03, 0x52, 0x60, 0x82, 0x44, 0x7A, 0x80, 0x0B, 0xD8, 0x81, 0x33, 0x30, 0x83, 0x24, 0x90, 0x19, + 0x28, 0x70, 0x81, 0xE6, 0x0A, 0x81, 0x25, 0xA0, 0x01, 0x19, 0x78, 0x81, 0x06, 0x60, 0x33, 0x53, + 0x94, 0xA5, 0xD0, 0x51, 0xBA, 0x56, 0x5B, 0x2F, 0x4F, 0xF8, 0x2F, 0x29, 0xE0, 0x81, 0x0B, 0x80, + 0x00, 0x03, 0xB0, 0x80, 0x17, 0xB8, 0xBA, 0x60, 0xC0, 0x07, 0x7C, 0xD8, 0xC1, 0x19, 0xE0, 0x81, + 0x1D, 0x50, 0x00, 0x54, 0xD8, 0x07, 0x7D, 0x90, 0x18, 0x37, 0x7C, 0xA8, 0x62, 0x5A, 0x30, 0x6D, + 0xC8, 0x02, 0xE6, 0x4A, 0x81, 0x46, 0xE8, 0x83, 0x35, 0xD0, 0x82, 0x31, 0x60, 0x02, 0x1E, 0xA0, + 0xB9, 0x0F, 0xD0, 0x2B, 0x08, 0xF0, 0x80, 0x33, 0x98, 0x8F, 0x99, 0xA1, 0xBA, 0x28, 0x50, 0x82, + 0x29, 0x9A, 0x01, 0x85, 0xFA, 0x85, 0x22, 0x38, 0x80, 0x05, 0x80, 0x80, 0x02, 0x58, 0x80, 0xF2, + 0x0A, 0x47, 0x46, 0xEB, 0x07, 0x5A, 0x28, 0x00, 0x3E, 0xF0, 0x03, 0x30, 0xE8, 0x01, 0x05, 0x40, + 0xB0, 0x01, 0x28, 0x92, 0x10, 0x80, 0xBE, 0x70, 0xB0, 0x07, 0x7C, 0xC0, 0x86, 0x59, 0xC0, 0x86, + 0xF2, 0x02, 0x47, 0xD9, 0x61, 0x8E, 0x60, 0x94, 0x88, 0x7A, 0x90, 0xA5, 0xFE, 0x32, 0xAE, 0x59, + 0x70, 0x83, 0x14, 0xB8, 0x00, 0x0D, 0x08, 0x01, 0x31, 0xC8, 0x83, 0x3A, 0xFB, 0x34, 0x4B, 0x04, + 0x02, 0x11, 0x50, 0x89, 0x21, 0x28, 0x06, 0x89, 0x00, 0x85, 0x01, 0x80, 0x82, 0x35, 0x48, 0x02, + 0x2D, 0x90, 0x03, 0xA3, 0x19, 0x8A, 0x93, 0x38, 0x01, 0x0B, 0x68, 0x80, 0x89, 0xAC, 0xB3, 0x3C, + 0xD0, 0xBB, 0x75, 0xD8, 0x4A, 0x88, 0x61, 0x06, 0x02, 0xA0, 0x04, 0x4E, 0xB8, 0x04, 0x36, 0x48, + 0x82, 0x0F, 0xC0, 0x07, 0x71, 0x20, 0x80, 0xFE, 0x17, 0xE0, 0x81, 0xA1, 0x4C, 0x80, 0x20, 0xC8, + 0xC8, 0x52, 0x5B, 0xB4, 0xC5, 0xB8, 0x87, 0xD0, 0xC9, 0x07, 0x71, 0xB8, 0x86, 0xDB, 0x54, 0x06, + 0x54, 0x30, 0x82, 0x06, 0x58, 0x2E, 0x08, 0xB8, 0x80, 0x19, 0x90, 0x82, 0x35, 0x20, 0x1E, 0x30, + 0xD0, 0x26, 0xF5, 0xD8, 0x38, 0xF5, 0xCB, 0x02, 0x74, 0xE8, 0x07, 0xCD, 0xF2, 0x4A, 0x29, 0x48, + 0x83, 0x05, 0x29, 0x04, 0x3A, 0x58, 0xB1, 0x08, 0x32, 0x9B, 0x81, 0x94, 0x03, 0x4E, 0x80, 0x04, + 0x39, 0xE8, 0x83, 0x05, 0xB8, 0x86, 0xCE, 0xEC, 0x87, 0x22, 0x68, 0x84, 0x49, 0x88, 0x85, 0x4E, + 0x48, 0x83, 0x10, 0x68, 0x81, 0x7E, 0x50, 0x86, 0x02, 0xE8, 0x83, 0x77, 0x9B, 0x46, 0x0B, 0x40, + 0x07, 0x7D, 0xF4, 0x07, 0x87, 0xAB, 0xC9, 0x1B, 0xF9, 0x07, 0x71, 0x18, 0x02, 0x04, 0xD8, 0x2B, + 0xBE, 0x92, 0x00, 0x0D, 0x60, 0x81, 0x33, 0x80, 0x82, 0x33, 0x10, 0x03, 0x31, 0x98, 0x02, 0x26, + 0x98, 0xA0, 0x97, 0x34, 0xCC, 0xC8, 0xF8, 0x00, 0x41, 0xC0, 0x87, 0x19, 0x43, 0x33, 0xA7, 0xBA, + 0x00, 0x16, 0x50, 0x9C, 0x34, 0x20, 0x8A, 0xD5, 0x93, 0x82, 0x0B, 0xB0, 0x27, 0x13, 0xA0, 0x84, + 0x2E, 0x88, 0x84, 0x48, 0xE0, 0x03, 0x4A, 0x80, 0x00, 0x20, 0xDB, 0xCA, 0x7E, 0x20, 0x80, 0x61, + 0x98, 0x04, 0x4E, 0x98, 0x83, 0x35, 0xD8, 0x00, 0x37, 0xD0, 0xB7, 0x0B, 0x00, 0x84, 0x53, 0x88, + 0x04, 0x33, 0xF0, 0x01, 0x05, 0x08, 0x06, 0xEF, 0x20, 0xC5, 0x46, 0xFB, 0x87, 0xF0, 0x31, 0x80, + 0x0C, 0xE8, 0x80, 0x16, 0x20, 0x82, 0x1B, 0x00, 0x82, 0xDD, 0xEB, 0x81, 0x2E, 0x30, 0x83, 0xD6, + 0xE3, 0x01, 0x1F, 0xD8, 0x81, 0x1B, 0xF8, 0xB9, 0x05, 0x18, 0x81, 0x59, 0x58, 0x50, 0x30, 0x03, + 0xC7, 0xEF, 0x48, 0xC4, 0x14, 0x10, 0xFE, 0x01, 0x2A, 0xFA, 0xB4, 0x24, 0x98, 0x82, 0x1E, 0x90, + 0x00, 0x08, 0x90, 0x06, 0x69, 0x28, 0x00, 0x09, 0xA0, 0x04, 0x5D, 0x90, 0x05, 0x56, 0x50, 0x03, + 0x0B, 0x40, 0xBA, 0x37, 0xC4, 0x8B, 0x0E, 0x28, 0x85, 0x33, 0x60, 0x82, 0x29, 0x70, 0x81, 0x0F, + 0xED, 0x87, 0x18, 0xB8, 0x01, 0x0F, 0xB4, 0xC7, 0x33, 0x48, 0x00, 0x99, 0x64, 0x89, 0x7C, 0x40, + 0x35, 0x3B, 0xD1, 0x07, 0x71, 0x50, 0x81, 0x0C, 0xD8, 0xAB, 0x04, 0x48, 0x80, 0x07, 0xD0, 0x80, + 0x41, 0xCD, 0xA2, 0x6C, 0xB4, 0x00, 0x25, 0x2D, 0x02, 0x09, 0x33, 0xAF, 0xB9, 0x34, 0xB2, 0x7D, + 0x08, 0x87, 0x23, 0xA9, 0x20, 0x11, 0x00, 0x82, 0x3B, 0x5B, 0xC7, 0x5E, 0x58, 0xC9, 0x45, 0x59, + 0x40, 0x17, 0xB8, 0x81, 0x0F, 0x18, 0x87, 0xC2, 0x13, 0x3E, 0xE5, 0x98, 0x05, 0x02, 0x30, 0x81, + 0x6D, 0x5C, 0x00, 0x42, 0x90, 0xA5, 0x00, 0xA8, 0x85, 0x28, 0xE0, 0x04, 0x5D, 0x08, 0x84, 0x26, + 0x28, 0x80, 0x68, 0x80, 0x9D, 0x34, 0x73, 0x09, 0x61, 0x74, 0xC3, 0xBB, 0xC4, 0x86, 0x60, 0xF0, + 0x84, 0x2F, 0x20, 0x82, 0x79, 0x22, 0x82, 0x14, 0x08, 0x02, 0x5B, 0xB8, 0x89, 0x19, 0xC1, 0xD3, + 0x73, 0x4B, 0xB7, 0x88, 0xF8, 0xB2, 0x70, 0x08, 0x82, 0x0B, 0x20, 0x12, 0x7B, 0x6A, 0x80, 0x22, + 0xF9, 0x00, 0x37, 0x25, 0x8F, 0x05, 0x8B, 0x86, 0x61, 0x08, 0x06, 0x7B, 0x58, 0xD4, 0x37, 0xAC, + 0x18, 0x7D, 0x60, 0x86, 0x11, 0x78, 0x25, 0x65, 0x98, 0xA5, 0x6B, 0x98, 0x43, 0x5C, 0xA0, 0x04, + 0x28, 0xC8, 0xB3, 0x8C, 0xB4, 0x93, 0x43, 0x44, 0x35, 0x34, 0x2B, 0xB5, 0xCD, 0xDA, 0x07, 0x31, + 0x4C, 0x36, 0x3E, 0x2B, 0x37, 0xC5, 0xA8, 0x93, 0x1A, 0xDC, 0x07, 0x54, 0xB8, 0x00, 0x11, 0xE0, + 0x81, 0x6B, 0x73, 0xCD, 0x0C, 0xFE, 0x68, 0x80, 0x1B, 0x48, 0x01, 0x08, 0x40, 0x2A, 0x48, 0xD3, + 0x4A, 0xC4, 0x28, 0xC5, 0x1A, 0x92, 0x08, 0x59, 0x82, 0xB2, 0x62, 0xAA, 0xB0, 0x02, 0xC8, 0x43, + 0x08, 0xF0, 0x82, 0x05, 0x65, 0xB4, 0xFB, 0xE1, 0x48, 0x38, 0xAA, 0xC0, 0x36, 0x24, 0xD8, 0x3B, + 0xF1, 0x23, 0xCE, 0x3A, 0x53, 0x13, 0x08, 0x05, 0x33, 0x98, 0xA2, 0x06, 0x08, 0x86, 0x7E, 0x98, + 0x05, 0x0B, 0x10, 0x81, 0x1D, 0x10, 0x01, 0x05, 0x90, 0x06, 0xF3, 0x82, 0x09, 0xB9, 0x2C, 0x58, + 0x93, 0x9B, 0xA5, 0x91, 0x59, 0x07, 0x65, 0x50, 0x86, 0x71, 0xB0, 0x56, 0x88, 0xB1, 0xD1, 0xAE, + 0x42, 0xB7, 0x5F, 0x1C, 0x19, 0xD0, 0x83, 0xA8, 0xE1, 0xEB, 0x07, 0x0A, 0x10, 0x02, 0x63, 0xD0, + 0x05, 0x3E, 0x18, 0x83, 0x25, 0x28, 0x00, 0x69, 0xC8, 0x87, 0x6B, 0x38, 0x80, 0x55, 0x1C, 0xCA, + 0x0B, 0xA0, 0x05, 0x8A, 0x4D, 0x9B, 0x96, 0x5D, 0x2A, 0xD8, 0xFC, 0x9C, 0xE2, 0xFB, 0x07, 0x78, + 0xF0, 0xC7, 0xE4, 0x68, 0xD0, 0x8E, 0x3C, 0x26, 0x9B, 0xFC, 0x45, 0x12, 0xB9, 0x06, 0x0A, 0x30, + 0x86, 0x2F, 0xE5, 0x03, 0x33, 0xE0, 0x01, 0x08, 0xB0, 0x07, 0xF2, 0xB8, 0x00, 0x2C, 0xE0, 0x03, + 0x3E, 0xD0, 0x02, 0x29, 0x30, 0x80, 0x6B, 0xB8, 0xD9, 0xAD, 0xF4, 0x45, 0xFE, 0xD3, 0x2C, 0x88, + 0x81, 0x43, 0x93, 0x0B, 0x47, 0xBA, 0xE0, 0x3F, 0x5E, 0x2C, 0xBE, 0x80, 0xB2, 0x80, 0x5A, 0xA0, + 0x04, 0x56, 0x08, 0x12, 0x13, 0x90, 0x41, 0xF2, 0xD8, 0x80, 0x40, 0xD0, 0x85, 0x48, 0x88, 0x94, + 0x06, 0x48, 0x2D, 0x52, 0x2C, 0x58, 0x6D, 0x21, 0xA6, 0x89, 0x28, 0x44, 0xBD, 0xDD, 0x5B, 0xAE, + 0xA2, 0x25, 0xB9, 0xB0, 0xCB, 0x45, 0x49, 0xCA, 0x3F, 0x68, 0x82, 0x1B, 0x80, 0x80, 0x60, 0x75, + 0x83, 0x06, 0xF8, 0x52, 0xB1, 0x59, 0x60, 0x84, 0x2E, 0x30, 0x81, 0x59, 0xB8, 0xD8, 0xCE, 0x5C, + 0xDD, 0x9E, 0xA5, 0x93, 0xF9, 0x9C, 0x5B, 0xD6, 0xEA, 0x45, 0x93, 0xC3, 0xDC, 0x9E, 0x2D, 0x91, + 0xF5, 0xC2, 0x87, 0x79, 0xB2, 0x80, 0x0F, 0x58, 0x80, 0x5F, 0x98, 0xA5, 0x7D, 0xE8, 0x80, 0x5A, + 0x30, 0x06, 0x5C, 0x60, 0x85, 0x1D, 0x18, 0x80, 0xEE, 0x64, 0x5D, 0x1B, 0x4A, 0x0E, 0xCF, 0xDB, + 0xDA, 0xBE, 0xDD, 0x9A, 0xFB, 0x89, 0x5D, 0x8A, 0xB5, 0xC9, 0xEF, 0x58, 0xB0, 0xB5, 0xAC, 0x59, + 0xEA, 0x05, 0x85, 0x05, 0x08, 0x82, 0x1B, 0xF0, 0x80, 0x20, 0xF0, 0x56, 0x12, 0x49, 0x5E, 0xE8, + 0x3D, 0x57, 0xE6, 0x88, 0x9D, 0xDA, 0x7D, 0x5E, 0xAF, 0x9D, 0x98, 0x9C, 0x4D, 0x0C, 0x70, 0x94, + 0x4D, 0x0A, 0x03, 0x9D, 0xB8, 0x70, 0x28, 0x58, 0xEB, 0x85, 0xF9, 0x45, 0x07, 0x71, 0x88, 0xB2, + 0xE4, 0xB5, 0x5D, 0xE9, 0xAD, 0x31, 0x3C, 0x31, 0xDF, 0xF3, 0xD1, 0x2F, 0xF5, 0x15, 0x99, 0x1A, + 0x5C, 0x8E, 0x92, 0x1B, 0x11, 0x7F, 0x54, 0xB8, 0x63, 0xC2, 0xDF, 0x85, 0x4B, 0xE0, 0x05, 0x46, + 0xE0, 0x3F, 0x62, 0xE0, 0x07, 0x86, 0xE0, 0x08, 0x96, 0xE0, 0x09, 0xA6, 0xE0, 0x0A, 0xB6, 0xE0, + 0x0B, 0xC6, 0x60, 0xF0, 0x08, 0x08, 0x00, 0x3B, +}; diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index e44ce6b0..e0e4c401 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -28,6 +28,9 @@ #include "gfx.h" +// include our chibios logo in a .gif format +#include "image_chibios.h" + static GListener gl; static GHandle ghConsole; static GHandle ghTabButtons, ghTabSliders, ghTabCheckboxes, ghTabLabels, ghTabRadios, ghTabImages; @@ -36,7 +39,7 @@ static GHandle ghSlider1, ghSlider2, ghSlider3, ghSlider4; static GHandle ghCheckbox1, ghCheckbox2; static GHandle ghLabel1; static GHandle ghRadio1, ghRadio2; -//static GHandle ghImage1; +static GHandle ghImage1; #define ScrWidth gdispGetWidth() #define ScrHeight gdispGetHeight() @@ -127,6 +130,12 @@ int main(void) { wi.g.x = 0*wi.g.width; wi.text = "Yes"; ghRadio1 = gwinCreateRadio(NULL, &wi, GROUP_R1R2); wi.g.x = 1*wi.g.width; wi.text = "No"; ghRadio2 = gwinCreateRadio(NULL, &wi, GROUP_R1R2); + // Image + wi.g.x = ScrWidth-210; wi.g.y = TAB_HEIGHT + 10; wi.g.width = 200; wi.g.height = 200; + ghImage1 = gwinImageCreate(NULL, &wi); + gwinImageOpenMemory(ghImage1, image_chibios); + gwinImageCache(ghImage1); + // Console - we apply some special colors before making it visible wi.g.width = ScrWidth/2-1; wi.g.height = ScrHeight/2-1; wi.g.x = ScrWidth/2+1; wi.g.y = ScrHeight/2+1; @@ -192,7 +201,7 @@ int main(void) { gwinSetVisible(ghLabel1, ((GEventGWinRadio *)pe)->radio == ghTabLabels); gwinSetVisible(ghRadio1, ((GEventGWinRadio *)pe)->radio == ghTabRadios); gwinSetVisible(ghRadio2, ((GEventGWinRadio *)pe)->radio == ghTabRadios); - //gwinSetVisible(ghImage1, ((GEventGWinRadio *)pe)->radio == ghTabImages); + gwinSetVisible(ghImage1, ((GEventGWinRadio *)pe)->radio == ghTabImages); // Do some special animation for Label1 if (((GEventGWinRadio *)pe)->radio == ghTabLabels) { From de28112a7d6db829142ad113c93eb8ad071b0d65 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 7 Jul 2013 19:39:17 +1000 Subject: [PATCH 31/38] GDISP fix bug in non-multithread --- include/gdisp/gdisp.h | 1 - src/gdisp/gdisp.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/include/gdisp/gdisp.h b/include/gdisp/gdisp.h index 4ba72580..2497801a 100644 --- a/include/gdisp/gdisp.h +++ b/include/gdisp/gdisp.h @@ -572,7 +572,6 @@ extern "C" { #include "gdisp/lld/gdisp_lld.h" /* The same as above but use the low level driver directly if no multi-thread support is needed */ - #define _gdispInit(gdisp) gdisp_lld_init() #define gdispIsBusy() FALSE #define gdispClear(color) gdisp_lld_clear(color) #define gdispDrawPixel(x, y, color) gdisp_lld_draw_pixel(x, y, color) diff --git a/src/gdisp/gdisp.c b/src/gdisp/gdisp.c index 1b16ac53..5c0f4709 100644 --- a/src/gdisp/gdisp.c +++ b/src/gdisp/gdisp.c @@ -135,6 +135,10 @@ gdisp_lld_init(); gfxMutexExit(&gdispMutex); } +#else + void _gdispInit(void) { + gdisp_lld_init(); + } #endif #if GDISP_NEED_MULTITHREAD From 3957505ab119b21c7b0f4e72f56030c97711988a Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 7 Jul 2013 19:40:37 +1000 Subject: [PATCH 32/38] GWIN renaming, tidy up, color styles --- include/gwin/button.h | 40 +--------- include/gwin/checkbox.h | 36 ++++----- include/gwin/class_gwin.h | 5 ++ include/gwin/console.h | 10 +-- include/gwin/graph.h | 4 +- include/gwin/gwidget.h | 130 +++++++++++++++++++++++++++------ include/gwin/gwin.h | 83 ++++++++++++--------- include/gwin/image.h | 16 ++-- include/gwin/label.h | 6 +- include/gwin/radio.h | 41 ++--------- include/gwin/slider.h | 36 ++------- src/gwin/button.c | 150 +++++++++++++++----------------------- src/gwin/checkbox.c | 76 +++++++++++-------- src/gwin/console.c | 4 +- src/gwin/gimage.c | 8 +- src/gwin/graph.c | 2 +- src/gwin/gwidget.c | 138 ++++++++++++++++++++++++++++++----- src/gwin/gwin.c | 74 +++++-------------- src/gwin/gwm.c | 41 ++++++++++- src/gwin/label.c | 26 ++++--- src/gwin/radio.c | 111 ++++++++++------------------ src/gwin/slider.c | 90 +++++++++++------------ 22 files changed, 594 insertions(+), 533 deletions(-) diff --git a/include/gwin/button.h b/include/gwin/button.h index afe6d0cc..a78a0a71 100644 --- a/include/gwin/button.h +++ b/include/gwin/button.h @@ -40,27 +40,15 @@ typedef struct GEventGWinButton { GHandle button; // The button that has been depressed (actually triggered on release) } GEventGWinButton; -/** - * @brief Button colors - */ -typedef struct GButtonColors { - color_t color_edge; - color_t color_fill; - color_t color_txt; -} GButtonColors; - /** * @brief The button widget structure * @note Do not use the members directly - treat it as a black-box. */ -typedef struct GButtonObject_t { +typedef struct GButtonObject { GWidgetObject w; #if GINPUT_NEED_TOGGLE - uint16_t toggle; + uint16_t toggle; #endif - GButtonColors c_up; - GButtonColors c_dn; - GButtonColors c_dis; } GButtonObject; #ifdef __cplusplus @@ -86,26 +74,7 @@ extern "C" { * * @api */ -GHandle gwinCreateButton(GButtonObject *gb, const GWidgetInit *pInit); - -/** - * @brief Set the colors of a button. - * - * @param[in] gh The window handle (must be a button widget) - * @param[in] pUp The colors for the button when in the up state. - * @param[in] pDown The colors for the button when in the down state. - * @param[in] pDisabled The colors for the button when it is disabled. - * - * @note The button is not automatically redrawn. Call gwinButtonDraw() after changing the button style - * @note The button style is copied into the internal button structure - there is no need to - * maintain static style structures (they can be temporary structures on the stack). - * @note The pUp, pDown and pDisabled parameters can be NULL. If they are then the existing color styles - * are not changed for that button state. - * @note Some custom drawn buttons will ignore he specified colors - * - * @api - */ -void gwinSetButtonColors(GHandle gh, const GButtonColors *pUp, const GButtonColors *pDown, const GButtonColors *pDisabled); +GHandle gwinButtonCreate(GButtonObject *gb, const GWidgetInit *pInit); /** * @brief Is the button current pressed @@ -115,7 +84,7 @@ void gwinSetButtonColors(GHandle gh, const GButtonColors *pUp, const GButtonColo * * @api */ -bool_t gwinIsButtonPressed(GHandle gh); +bool_t gwinButtonIsPressed(GHandle gh); /** * @brief Some custom button drawing routines @@ -141,7 +110,6 @@ bool_t gwinIsButtonPressed(GHandle gh); * @{ */ void gwinButtonDraw_3D(GWidgetObject *gw, void *param); // @< A standard 3D button -void gwinButtonDraw_Box(GWidgetObject *gw, void *param); // @< A very simple box style button #if GDISP_NEED_ARC || defined(__DOXYGEN__) void gwinButtonDraw_Rounded(GWidgetObject *gw, void *param); // @< A rounded rectangle button #endif diff --git a/include/gwin/checkbox.h b/include/gwin/checkbox.h index 679a5d9c..fcd0549d 100644 --- a/include/gwin/checkbox.h +++ b/include/gwin/checkbox.h @@ -34,26 +34,18 @@ /* Type definitions */ /*===========================================================================*/ -typedef struct GEventGWinCheckbox_t { +typedef struct GEventGWinCheckbox { GEventType type; // The type of this event (GEVENT_GWIN_CHECKBOX) GHandle checkbox; // The checkbox that has been depressed (actually triggered on release) bool_t isChecked; // Is the checkbox currently checked or unchecked? } GEventGWinCheckbox; -typedef struct GCheckboxColors { - color_t color_border; - color_t color_checked; - color_t color_bg; - color_t color_txt; -} GCheckboxColors; - /* A Checkbox window */ -typedef struct GCheckboxObject_t { +typedef struct GCheckboxObject { GWidgetObject w; #if GINPUT_NEED_TOGGLE uint16_t toggle; #endif - GCheckboxColors c; } GCheckboxObject; /** @@ -75,7 +67,17 @@ typedef struct GCheckboxObject_t { * * @api */ -GHandle gwinCreateCheckbox(GCheckboxObject *gb, const GWidgetInit *pInit); +GHandle gwinCheckboxCreate(GCheckboxObject *gb, const GWidgetInit *pInit); + +/** + * @brief Set the state of a checkbox + * + * @param[in] gh The window handle (must be a checkbox window) + * @param[in] isChecked TRUE to set the check, FALSE to uncheck. + * + * @api + */ +void gwinCheckboxCheck(GHandle gh, bool_t isChecked); /** * @brief Get the state of a checkbox @@ -85,17 +87,7 @@ GHandle gwinCreateCheckbox(GCheckboxObject *gb, const GWidgetInit *pInit); * * @api */ -bool_t gwinIsCheckboxChecked(GHandle gh); - -/** - * @brief Set the colors used to draw the checkbox - * - * @param[in] gh The window handle (must be a checkbox window) - * @param[in] pColors The colors to use - * - * @api - */ -void gwinCheckboxSetColors(GHandle gh, GCheckboxColors *pColors); +bool_t gwinCheckboxIsChecked(GHandle gh); /** * @brief Some custom checkbox drawing routines diff --git a/include/gwin/class_gwin.h b/include/gwin/class_gwin.h index 1a4de5b9..3be496b1 100644 --- a/include/gwin/class_gwin.h +++ b/include/gwin/class_gwin.h @@ -136,6 +136,11 @@ typedef struct gwinVMT { * @brief The list of all windows in the system */ extern gfxQueueASync _GWINList; + + /** + * @brief The current window manager + */ + extern GWindowManager * _GWINwm; #endif #ifdef __cplusplus diff --git a/include/gwin/console.h b/include/gwin/console.h index a3b3697c..b32c3628 100644 --- a/include/gwin/console.h +++ b/include/gwin/console.h @@ -27,7 +27,7 @@ /* This file is included within "gwin/gwin.h" */ // A console window. Supports wrapped text writing and a cursor. -typedef struct GConsoleObject_t { +typedef struct GConsoleObject { GWindowObject g; coord_t cx, cy; // Cursor position @@ -46,8 +46,8 @@ extern "C" { /** * @brief Create a console window. - * @details A console window allows text to be written using chprintf() (and the console functions defined here). - * @brief Text in a console window supports newlines and will wrap text as required. + * @details A console window allows text to be written. + * @note Text in a console window supports newlines and will wrap text as required. * @return NULL if there is no resultant drawing area, otherwise a window handle. * * @param[in] gc The GConsoleObject structure to initialise. If this is NULL the structure is dynamically allocated. @@ -64,7 +64,7 @@ extern "C" { * * @api */ -GHandle gwinCreateConsole(GConsoleObject *gc, const GWindowInit *pInit); +GHandle gwinConsoleCreate(GConsoleObject *gc, const GWindowInit *pInit); #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM /** @@ -77,7 +77,7 @@ GHandle gwinCreateConsole(GConsoleObject *gc, const GWindowInit *pInit); * * @api */ - BaseSequentialStream *gwinGetConsoleStream(GHandle gh); + BaseSequentialStream *gwinConsoleGetStream(GHandle gh); #endif /** diff --git a/include/gwin/graph.h b/include/gwin/graph.h index b5fc1405..8bc33edf 100644 --- a/include/gwin/graph.h +++ b/include/gwin/graph.h @@ -71,7 +71,7 @@ typedef struct GGraphStyle_t { } GGraphStyle; // A graph window -typedef struct GGraphObject_t { +typedef struct GGraphObject { GWindowObject g; GGraphStyle style; coord_t xorigin, yorigin; @@ -107,7 +107,7 @@ extern "C" { * * @api */ -GHandle gwinCreateGraph(GGraphObject *gg, const GWindowInit *pInit); +GHandle gwinGraphCreate(GGraphObject *gg, const GWindowInit *pInit); /** * @brief Set the style of the graphing operations. diff --git a/include/gwin/gwidget.h b/include/gwin/gwidget.h index ffd8e26f..222a3af5 100644 --- a/include/gwin/gwidget.h +++ b/include/gwin/gwidget.h @@ -30,28 +30,50 @@ // Forward definition struct GWidgetObject; +/** + * @brief The GColorSet structure + * @{ + */ +typedef struct GColorSet { + color_t text; // @< The text color + color_t edge; // @< The edge color + color_t fill; // @< The fill color + color_t progress; // @< The color of progress bars +} GColorSet; +/* @} */ + +/** + * @brief The GWidgetStyle structure + * @details A GWidgetStyle is a set of colors that together form a "style". + * These colors should not be confused with the GWindow foreground + * and background colors which are used for drawing operations. + * @{ + */ +typedef struct GWidgetStyle { + color_t background; // @< The window background color + GColorSet enabled; // @< The colors when enabled + GColorSet disabled; // @< The colors when disabled + GColorSet pressed; // @< The colors when pressed +} GWidgetStyle; +/* @} */ + +/** + * @brief We define a couple of GWidgetStyle's that you can use in your + * application. The Black style is the default style if you don't + * specify one. + * @note BlackWidgetStyle means that it is designed for a Black background. + * Similarly WhiteWidgetStyle is designed for a White background. + * @{ + */ +extern const GWidgetStyle BlackWidgetStyle; +extern const GWidgetStyle WhiteWidgetStyle; +/* @} */ + /** * @brief Defines a custom drawing function for a widget */ typedef void (*CustomWidgetDrawFunction)(struct GWidgetObject *gw, void *param); -/** - * @brief The GWIN Widget structure - * @note A widget is a GWIN window that accepts user input. - * It also has a number of other properties such as its ability - * to redraw itself (a widget maintains drawing state). - * @note Do not access the members directly. Treat it as a black-box and use the method functions. - * - * @{ - */ -typedef struct GWidgetObject { - GWindowObject g; // @< This is still a GWIN - const char * txt; // @< The widget text - CustomWidgetDrawFunction fnDraw; // @< The current draw function - void * fnParam; // @< A parameter for the current draw function -} GWidgetObject; -/* @} */ - /** * @brief The structure to initialise a widget. * @@ -63,11 +85,32 @@ typedef struct GWidgetObject { * @{ */ typedef struct GWidgetInit { - GWindowInit g; // @< The GWIN initializer - const char * text; // @< The initial text + GWindowInit g; // @< The GWIN initializer + const char * text; // @< The initial text + CustomWidgetDrawFunction customDraw; // @< A custom draw function - use NULL for the standard + void * customParam; // @< A parameter for the custom draw function (default = NULL) + const GWidgetStyle * customStyle; // @< A custom style to use - use NULL for the default style } GWidgetInit; /* @} */ +/** + * @brief The GWIN Widget structure + * @note A widget is a GWIN window that accepts user input. + * It also has a number of other properties such as its ability + * to redraw itself (a widget maintains drawing state). + * @note Do not access the members directly. Treat it as a black-box and use the method functions. + * + * @{ + */ +typedef struct GWidgetObject { + GWindowObject g; // @< This is still a GWIN + const char * text; // @< The widget text + CustomWidgetDrawFunction fnDraw; // @< The current draw function + void * fnParam; // @< A parameter for the current draw function + const GWidgetStyle * pstyle; // @< The current widget style colors +} GWidgetObject; +/* @} */ + /** * A comment/rant on the above structure: * We would really like the GWindowObject member to be anonymous. While this is @@ -83,11 +126,32 @@ typedef struct GWidgetInit { extern "C" { #endif +/** + * @brief Set the default style for widgets created hereafter. + * + * @param[in] pstyle The default style. Passing NULL uses the system compiled style. + * @param[in] updateAll If TRUE then all existing widgets that are using the current default style + * will be updated to use this new style. Widgets that have custom styles different + * from the default style will not be updated. + * + * @note The style must be allocated statically (not on the stack) as only the pointer is stored. + * + * @api + */ +void gwinSetDefaultStyle(const GWidgetStyle *pstyle, bool_t updateAll); + +/** + * @brief Get the current default style. + * + * @api + */ +const GWidgetStyle *gwinGetDefaultStyle(void); + /** * @brief Set the text of a widget. * * @param[in] gh The widget handle - * @param[in] txt The text to set. This must be a constant string unless useAlloc is set. + * @param[in] text The text to set. This must be a constant string unless useAlloc is set. * @param[in] useAlloc If TRUE the string specified will be copied into dynamically allocated memory. * * @note The widget is automatically redrawn @@ -95,7 +159,7 @@ extern "C" { * * @api */ -void gwinSetText(GHandle gh, const char *txt, bool_t useAlloc); +void gwinSetText(GHandle gh, const char *text, bool_t useAlloc); /** * @brief Get the text of a widget. @@ -107,6 +171,30 @@ void gwinSetText(GHandle gh, const char *txt, bool_t useAlloc); */ const char *gwinGetText(GHandle gh); +/** + * @brief Set the style of a widget. + * + * @param[in] gh The widget handle + * @param[in] pstyle The style to set. This must be a static structure (not allocated on a transient stack). + * Use NULL to reset to the default style. + * + * @note The widget is automatically redrawn + * @note Non-widgets will ignore this call. + * + * @api + */ +void gwinSetStyle(GHandle gh, const GWidgetStyle *pstyle); + +/** + * @brief Get the style of a widget. + * @return The widget style or NULL if it isn't a widget + * + * @param[in] gh The widget handle + * + * @api + */ +const GWidgetStyle *gwinGetStyle(GHandle gh); + /** * @brief Set the routine to perform a custom widget drawing. * diff --git a/include/gwin/gwin.h b/include/gwin/gwin.h index 4d0deaf0..37c2a4e8 100644 --- a/include/gwin/gwin.h +++ b/include/gwin/gwin.h @@ -174,7 +174,7 @@ extern "C" { * * @api */ - GHandle gwinCreateWindow(GWindowObject *pgw, const GWindowInit *pInit); + GHandle gwinWindowCreate(GWindowObject *pgw, const GWindowInit *pInit); /** * @brief Destroy a window (of any type). Releases any dynamically allocated memory. @@ -357,46 +357,63 @@ extern "C" { void gwinResize(GHandle gh, coord_t width, coord_t height); /** - * @brief Minimize, Maximize or Restore a window + * @brief Redraw a window * * @param[in] gh The window - * @param[in] minmax The new minimized/maximized state * - * @note The final window state may not be the requested state. Window Managers - * do not need to implement changing the minmax state. If there is no - * window manager this call is ignored. - * @note The window is redrawn if it is changed. See the comments in @p gwinSetVisible() - * with regard to what can be redrawn and what can't. - * @note It is up to the window manager to determine what happens with any screen area - * uncovered by resizing the window. - * @note When a window is minimised it may be asked to draw the window or the window - * manager may draw the minimised window. + * @note This is normally never required as windows and widgets will redraw as required. + * Note that some windows are incapable of redrawing themselves as they don't save + * their drawing state. * * @api */ - void gwinSetMinMax(GHandle gh, GWindowMinMax minmax); + void gwinRedraw(GHandle gh); - /** - * @brief Get the Minimized/Maximized state of a window - * - * @param[in] gh The window - * - * @api - */ - GWindowMinMax gwinGetMinMax(GHandle gh); + #if GWIN_NEED_WINDOWMANAGER + /** + * @brief Minimize, Maximize or Restore a window + * @pre GWIN_NEED_WINDOWMANAGER must be TRUE + * + * @param[in] gh The window + * @param[in] minmax The new minimized/maximized state + * + * @note The final window state may not be the requested state. Window Managers + * do not need to implement changing the minmax state. If there is no + * window manager this call is ignored. + * @note The window is redrawn if it is changed. See the comments in @p gwinSetVisible() + * with regard to what can be redrawn and what can't. + * @note It is up to the window manager to determine what happens with any screen area + * uncovered by resizing the window. + * @note When a window is minimised it may be asked to draw the window or the window + * manager may draw the minimised window. + * + * @api + */ + void gwinSetMinMax(GHandle gh, GWindowMinMax minmax); - /** - * @brief Raise a window to the top of the z-order - * - * @param[in] gh The window - * - * @note The window z-order is only supported by some window managers. If there is no - * window manager this call simple tries to redraw the window. See the comments - * in @p gwinSetVisible() with regard to what can be redrawn and what can't. - * - * @api - */ - void gwinRaise(GHandle gh); + /** + * @brief Get the Minimized/Maximized state of a window + * @pre GWIN_NEED_WINDOWMANAGER must be TRUE + * + * @param[in] gh The window + * + * @api + */ + GWindowMinMax gwinGetMinMax(GHandle gh); + + /** + * @brief Raise a window to the top of the z-order + * @pre GWIN_NEED_WINDOWMANAGER must be TRUE + * + * @param[in] gh The window + * + * @note The window z-order is only supported by some window managers. See the comments + * in @p gwinSetVisible() with regard to what can be redrawn and what can't. + * + * @api + */ + void gwinRaise(GHandle gh); + #endif #if GDISP_NEED_TEXT || defined(__DOXYGEN__) /** diff --git a/include/gwin/image.h b/include/gwin/image.h index d32e9a0c..7eb2d969 100644 --- a/include/gwin/image.h +++ b/include/gwin/image.h @@ -30,10 +30,10 @@ // This file is included within "gwin/gwin.h" // An image window -typedef struct GImageWidget_t { +typedef struct GImageObject { GWindowObject g; gdispImage image; -} GImageWidget; +} GImageObject; #ifdef __cplusplus extern "C" { @@ -41,7 +41,7 @@ extern "C" { /** * @brief Create an image widget. - * @details A console widget allows to display a picture. + * @details Display's a picture. * @return NULL if there is no resultant drawing area, otherwise the widget handle. * * @param[in] widget The image widget structure to initialise. If this is NULL, the structure is dynamically allocated. @@ -52,10 +52,10 @@ extern "C" { * * @api */ -GHandle gwinImageCreate(GImageWidget *widget, GWindowInit *pInit); +GHandle gwinImageCreate(GImageObject *widget, GWindowInit *pInit); /** - * @brief Sets the sets the io fields in the image structure to routines that support reading from an image stored + * @brief Sets the input routines that support reading the image from memory * in RAM or flash. * @return TRUE if the IO open function succeeds * @@ -68,8 +68,7 @@ bool_t gwinImageOpenMemory(GHandle gh, const void* memory); #if defined(WIN32) || GFX_USE_OS_WIN32 || GFX_USE_OS_POSIX || defined(__DOXYGEN__) /** - * @brief Sets the sets the io fields in the image structure to routines that support reading from an image stored - * in a simulators native file system. + * @brief Sets the input routines that support reading the image from a file * @return TRUE if the IO open function succeeds * * @param[in] gh The widget (must be an image widget) @@ -82,8 +81,7 @@ bool_t gwinImageOpenMemory(GHandle gh, const void* memory); #if GFX_USE_OS_CHIBIOS || defined(__DOXYGEN__) /** - * @brief Sets the sets the io fields in the image structure to routines that support reading from an image stored - * on a BaseFileStream (eg. an SD-Card). + * @brief Sets the input routines that support reading the image from a BaseFileStream (eg. an SD-Card). * @return TRUE if the IO open function succeeds * * @param[in] gh The widget (must be an image widget) diff --git a/include/gwin/label.h b/include/gwin/label.h index d387345d..4362b035 100644 --- a/include/gwin/label.h +++ b/include/gwin/label.h @@ -30,9 +30,9 @@ // This file is included within "gwin/gwin.h" // An label window -typedef struct GLabelWidget_t { +typedef struct GLabelObject { GWidgetObject w; -} GLabelWidget; +} GLabelObject; #ifdef __cplusplus extern "C" { @@ -49,7 +49,7 @@ extern "C" { * * @api */ -GHandle gwinLabelCreate(GLabelWidget *widget, GWidgetInit *pInit); +GHandle gwinLabelCreate(GLabelObject *widget, GWidgetInit *pInit); #ifdef __cplusplus } diff --git a/include/gwin/radio.h b/include/gwin/radio.h index 8d4e32a7..1e0a2dd6 100644 --- a/include/gwin/radio.h +++ b/include/gwin/radio.h @@ -39,28 +39,16 @@ typedef struct GEventGWinRadio { uint16_t group; // The group for this radio button } GEventGWinRadio; -/** - * @brief Button colors - */ -typedef struct GRadioColors { - color_t color_edge; - color_t color_fill; - color_t color_txt; -} GRadioColors; - /** * @brief The radio button widget structure * @note Do not use the members directly - treat it as a black-box. */ -typedef struct GRadioObject_t { +typedef struct GRadioObject { GWidgetObject w; #if GINPUT_NEED_TOGGLE uint16_t toggle; #endif uint16_t group; - GRadioColors c_up; - GRadioColors c_dn; - GRadioColors c_dis; } GRadioObject; #ifdef __cplusplus @@ -89,26 +77,7 @@ extern "C" { * * @api */ -GHandle gwinCreateRadio(GRadioObject *gb, const GWidgetInit *pInit, uint16_t group); - -/** - * @brief Set the colors of a button. - * - * @param[in] gh The window handle (must be a radio widget) - * @param[in] pUp The colors for the button when in the up state. - * @param[in] pDown The colors for the button when in the down state. - * @param[in] pDisabled The colors for the button when it is disabled. - * - * @note The button is not automatically redrawn. Call gwinButtonDraw() after changing the button style - * @note The button style is copied into the internal button structure - there is no need to - * maintain static style structures (they can be temporary structures on the stack). - * @note The pUp, pDown and pDisabled parameters can be NULL. If they are then the existing color styles - * are not changed for that button state. - * @note Some custom drawn buttons will ignore he specified colors - * - * @api - */ -void gwinSetRadioColors(GHandle gh, const GRadioColors *pUp, const GRadioColors *pDown, const GRadioColors *pDisabled); +GHandle gwinRadioCreate(GRadioObject *gb, const GWidgetInit *pInit, uint16_t group); /** * @brief Press this radio button (and by definition unset any others in the group) @@ -117,7 +86,7 @@ void gwinSetRadioColors(GHandle gh, const GRadioColors *pUp, const GRadioColors * * @api */ -void gwinPressRadio(GHandle gh); +void gwinRadioPress(GHandle gh); /** * @brief Is the radio button currently pressed @@ -127,7 +96,7 @@ void gwinPressRadio(GHandle gh); * * @api */ -bool_t gwinIsRadioPressed(GHandle gh); +bool_t gwinRadioIsPressed(GHandle gh); /** * @brief Find the currently pressed radio button in the specified group @@ -137,7 +106,7 @@ bool_t gwinIsRadioPressed(GHandle gh); * * @api */ -GHandle gwinActiveRadio(uint16_t group); +GHandle gwinRadioGetActive(uint16_t group); /** * @brief Some custom radio button drawing routines diff --git a/include/gwin/slider.h b/include/gwin/slider.h index a8cf7ecf..f4ab8750 100644 --- a/include/gwin/slider.h +++ b/include/gwin/slider.h @@ -26,7 +26,7 @@ #define GEVENT_GWIN_SLIDER (GEVENT_GWIN_FIRST+1) -typedef struct GEventGWinSlider_t { +typedef struct GEventGWinSlider { GEventType type; // The type of this event (GEVENT_GWIN_BUTTON) GHandle slider; // The slider that is returning results int position; @@ -34,16 +34,8 @@ typedef struct GEventGWinSlider_t { // There are currently no GEventGWinSlider listening flags - use 0 -typedef struct GSliderColors { - color_t color_edge; - color_t color_thumb; - color_t color_active; - color_t color_inactive; - color_t color_txt; -} GSliderColors; - // A slider window -typedef struct GSliderObject_t { +typedef struct GSliderObject { GWidgetObject w; #if GINPUT_NEED_TOGGLE uint16_t t_dn; @@ -56,7 +48,6 @@ typedef struct GSliderObject_t { int min; int max; int pos; - GSliderColors c; } GSliderObject; #ifdef __cplusplus @@ -86,7 +77,7 @@ extern "C" { * * @api */ -GHandle gwinCreateSlider(GSliderObject *gb, const GWidgetInit *pInit); +GHandle gwinSliderCreate(GSliderObject *gb, const GWidgetInit *pInit); /** * @brief Set the slider range. @@ -99,7 +90,7 @@ GHandle gwinCreateSlider(GSliderObject *gb, const GWidgetInit *pInit); * * @api */ -void gwinSetSliderRange(GHandle gh, int min, int max); +void gwinSliderSetRange(GHandle gh, int min, int max); /** * @brief Set the slider position. @@ -112,22 +103,7 @@ void gwinSetSliderRange(GHandle gh, int min, int max); * * @api */ -void gwinSetSliderPosition(GHandle gh, int pos); - -/** - * @brief Set the style of a slider. - * @details The slider style is defined by its colours. - * - * @param[in] gh The window handle (must be a slider window) - * @param[in] pStyle The styling for the slider. - * - * @note The slider is not automatically redrawn. Call gwinSliderDraw() after changing the slider style - * @note The slider style is copied into the internal slider structure - there is no need to - * maintain a static style structure. - * - * @api - */ -void gwinSetSliderColors(GHandle gh, const GSliderColors *pStyle); +void gwinSliderSetPosition(GHandle gh, int pos); /** * @brief Get the current slider position. @@ -140,7 +116,7 @@ void gwinSetSliderColors(GHandle gh, const GSliderColors *pStyle); * * @api */ -#define gwinGetSliderPosition(gh) (((GSliderObject *)(gh))->pos) +#define gwinSliderGetPosition(gh) (((GSliderObject *)(gh))->pos) /** * @brief Some custom slider drawing routines diff --git a/src/gwin/button.c b/src/gwin/button.c index 73f56c2e..e6f628c3 100644 --- a/src/gwin/button.c +++ b/src/gwin/button.c @@ -29,23 +29,6 @@ // Our pressed state #define GBUTTON_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0) -// Default color scheme -static const GButtonColors GButtonDefaultColorsUp = { - HTML2COLOR(0x404040), // color_up_edge; - HTML2COLOR(0xE0E0E0), // color_up_fill; - HTML2COLOR(0x000000), // color_up_txt; -}; -static const GButtonColors GButtonDefaultColorsDown = { - HTML2COLOR(0x404040), // color_dn_edge; - HTML2COLOR(0x808080), // color_dn_fill; - HTML2COLOR(0x404040), // color_dn_txt; -}; -static const GButtonColors GButtonDefaultColorsDisabled = { - HTML2COLOR(0x808080), // color_dis_edge; - HTML2COLOR(0xE0E0E0), // color_dis_fill; - HTML2COLOR(0xC0C0C0), // color_dis_txt; -}; - // Send the button event static void SendButtonEvent(GWidgetObject *gw) { GSourceListener * psl; @@ -153,30 +136,18 @@ static const gwidgetVMT buttonVMT = { #endif }; -GHandle gwinCreateButton(GButtonObject *gw, const GWidgetInit *pInit) { +GHandle gwinButtonCreate(GButtonObject *gw, const GWidgetInit *pInit) { if (!(gw = (GButtonObject *)_gwidgetCreate(&gw->w, pInit, &buttonVMT))) return 0; #if GINPUT_NEED_TOGGLE gw->toggle = GWIDGET_NO_INSTANCE; #endif - gw->c_up = GButtonDefaultColorsUp; - gw->c_dn = GButtonDefaultColorsDown; - gw->c_dis = GButtonDefaultColorsDisabled; gwinSetVisible((GHandle)gw, pInit->g.show); return (GHandle)gw; } -void gwinSetButtonColors(GHandle gh, const GButtonColors *pUp, const GButtonColors *pDown, const GButtonColors *pDisabled) { - if (gh->vmt != (gwinVMT *)&buttonVMT) - return; - - if (pUp) ((GButtonObject *)gh)->c_up = *pUp; - if (pDown) ((GButtonObject *)gh)->c_dn = *pDown; - if (pDisabled) ((GButtonObject *)gh)->c_dis = *pDisabled; -} - -bool_t gwinIsButtonPressed(GHandle gh) { +bool_t gwinButtonIsPressed(GHandle gh) { if (gh->vmt != (gwinVMT *)&buttonVMT) return FALSE; @@ -187,73 +158,64 @@ bool_t gwinIsButtonPressed(GHandle gh) { * Custom Draw Routines *----------------------------------------------------------*/ -static GButtonColors *getDrawColors(GWidgetObject *gw) { - if (!(gw->g.flags & GWIN_FLG_ENABLED)) return &((GButtonObject *)gw)->c_dis; - if ((gw->g.flags & GBUTTON_FLG_PRESSED)) return &((GButtonObject *)gw)->c_dn; - return &((GButtonObject *)gw)->c_up; +static const GColorSet *getDrawColors(GWidgetObject *gw) { + if (!(gw->g.flags & GWIN_FLG_ENABLED)) return &gw->pstyle->disabled; + if ((gw->g.flags & GBUTTON_FLG_PRESSED)) return &gw->pstyle->pressed; + return &gw->pstyle->enabled; } void gwinButtonDraw_3D(GWidgetObject *gw, void *param) { - (void) param; - GButtonColors * pcol; + const GColorSet * pcol; + (void) param; if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; pcol = getDrawColors(gw); - gdispFillStringBox(gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->txt, gw->g.font, pcol->color_txt, pcol->color_fill, justifyCenter); - gdispDrawLine(gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->color_edge); - gdispDrawLine(gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->color_edge); -} - -void gwinButtonDraw_Box(GWidgetObject *gw, void *param) { - (void) param; - GButtonColors * pcol; - - if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; - pcol = getDrawColors(gw); - - gdispFillStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, pcol->color_fill, justifyCenter); - gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->color_edge); + gdispFillStringBox(gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter); + gdispDrawLine(gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge); + gdispDrawLine(gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge); } #if GDISP_NEED_ARC void gwinButtonDraw_Rounded(GWidgetObject *gw, void *param) { - (void) param; - GButtonColors * pcol; + const GColorSet * pcol; + (void) param; if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; pcol = getDrawColors(gw); + gdispFillArea(gw->g.x, gw->g.y, ld, ld, gw->pstyle->background); if (gw->g.width >= 2*RND_CNR_SIZE+10) { - gdispFillRoundedBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, RND_CNR_SIZE-1, pcol->color_fill); - gdispDrawStringBox(gw->g.x+1, gw->g.y+RND_CNR_SIZE, gw->g.width-2, gw->g.height-(2*RND_CNR_SIZE), gw->txt, gw->g.font, pcol->color_txt, justifyCenter); - gdispDrawRoundedBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, RND_CNR_SIZE, pcol->color_edge); + gdispFillRoundedBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, RND_CNR_SIZE-1, pcol->fill); + gdispDrawStringBox(gw->g.x+1, gw->g.y+RND_CNR_SIZE, gw->g.width-2, gw->g.height-(2*RND_CNR_SIZE), gw->text, gw->g.font, pcol->text, justifyCenter); + gdispDrawRoundedBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, RND_CNR_SIZE, pcol->edge); } else { - gdispFillStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, pcol->color_fill, justifyCenter); - gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->color_edge); + gdispFillStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter); + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); } } #endif #if GDISP_NEED_ELLIPSE void gwinButtonDraw_Ellipse(GWidgetObject *gw, void *param) { - (void) param; - GButtonColors * pcol; + const GColorSet * pcol; + (void) param; if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; pcol = getDrawColors(gw); - gdispFillEllipse(gw->g.x+1, gw->g.y+1, gw->g.width/2-1, gw->g.height/2-1, pcol->color_fill); - gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); - gdispDrawEllipse(gw->g.x, gw->g.y, gw->g.width/2, gw->g.height/2, pcol->color_edge); + gdispFillArea(gw->g.x, gw->g.y, ld, ld, gw->pstyle->background); + gdispFillEllipse(gw->g.x+1, gw->g.y+1, gw->g.width/2-1, gw->g.height/2-1, pcol->fill); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter); + gdispDrawEllipse(gw->g.x, gw->g.y, gw->g.width/2, gw->g.height/2, pcol->edge); } #endif #if GDISP_NEED_CONVEX_POLYGON void gwinButtonDraw_ArrowUp(GWidgetObject *gw, void *param) { - (void) param; - GButtonColors * pcol; - point arw[7]; + const GColorSet * pcol; + (void) param; + point arw[7]; if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; pcol = getDrawColors(gw); @@ -266,15 +228,16 @@ void gwinButtonDraw_Box(GWidgetObject *gw, void *param) { arw[5].x = (gw->g.width - gw->g.width/ARROWBODY_DIVIDER)/2; arw[5].y = gw->g.height/ARROWHEAD_DIVIDER; arw[6].x = 0; arw[6].y = gw->g.height/ARROWHEAD_DIVIDER; - gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_fill); - gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_edge); - gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); + gdispFillArea(gw->g.x, gw->g.y, ld, ld, gw->pstyle->background); + gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->fill); + gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->edge); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter); } void gwinButtonDraw_ArrowDown(GWidgetObject *gw, void *param) { - (void) param; - GButtonColors * pcol; - point arw[7]; + const GColorSet * pcol; + (void) param; + point arw[7]; if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; pcol = getDrawColors(gw); @@ -287,15 +250,16 @@ void gwinButtonDraw_Box(GWidgetObject *gw, void *param) { arw[5].x = (gw->g.width - gw->g.width/ARROWBODY_DIVIDER)/2; arw[5].y = gw->g.height-1-gw->g.height/ARROWHEAD_DIVIDER; arw[6].x = 0; arw[6].y = gw->g.height-1-gw->g.height/ARROWHEAD_DIVIDER; - gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_fill); - gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_edge); - gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); + gdispFillArea(gw->g.x, gw->g.y, ld, ld, gw->pstyle->background); + gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->fill); + gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->edge); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter); } void gwinButtonDraw_ArrowLeft(GWidgetObject *gw, void *param) { - (void) param; - GButtonColors * pcol; - point arw[7]; + const GColorSet * pcol; + (void) param; + point arw[7]; if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; pcol = getDrawColors(gw); @@ -308,15 +272,16 @@ void gwinButtonDraw_Box(GWidgetObject *gw, void *param) { arw[5].x = gw->g.width/ARROWHEAD_DIVIDER; arw[5].y = (gw->g.height + gw->g.height/ARROWBODY_DIVIDER)/2; arw[6].x = gw->g.width/ARROWHEAD_DIVIDER; arw[6].y = gw->g.height-1; - gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_fill); - gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_edge); - gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); + gdispFillArea(gw->g.x, gw->g.y, ld, ld, gw->pstyle->background); + gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->fill); + gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->edge); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter); } void gwinButtonDraw_ArrowRight(GWidgetObject *gw, void *param) { - (void) param; - GButtonColors * pcol; - point arw[7]; + const GColorSet * pcol; + (void) param; + point arw[7]; if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; pcol = getDrawColors(gw); @@ -329,32 +294,31 @@ void gwinButtonDraw_Box(GWidgetObject *gw, void *param) { arw[5].x = gw->g.width-1-gw->g.width/ARROWHEAD_DIVIDER; arw[5].y = (gw->g.height + gw->g.height/ARROWBODY_DIVIDER)/2; arw[6].x = gw->g.width-1-gw->g.width/ARROWHEAD_DIVIDER; arw[6].y = gw->g.height-1; - gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_fill); - gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->color_edge); - gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); + gdispFillArea(gw->g.x, gw->g.y, ld, ld, gw->pstyle->background); + gdispFillConvexPoly(gw->g.x, gw->g.y, arw, 7, pcol->fill); + gdispDrawPoly(gw->g.x, gw->g.y, arw, 7, pcol->edge); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter); } #endif #if GDISP_NEED_IMAGE || defined(__DOXYGEN__) void gwinButtonDraw_Image(GWidgetObject *gw, void *param) { - GButtonColors * pcol; - coord_t sy; + const GColorSet * pcol; + coord_t sy; if (gw->g.vmt != (gwinVMT *)&buttonVMT) return; + pcol = getDrawColors(gw); if (!(gw->g.flags & GWIN_FLG_ENABLED)) { - pcol = &((GButtonObject *)gw)->c_dis; sy = 2 * gw->g.height; } else if ((gw->g.flags & GBUTTON_FLG_PRESSED)) { - pcol = &((GButtonObject *)gw)->c_dn; sy = gw->g.height; } else { - pcol = &((GButtonObject *)gw)->c_up; sy = 0; } gdispImageDraw((gdispImage *)param, gw->g.x, gw->g.y, gw->g.width, gw->g.height, 0, sy); - gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, justifyCenter); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter); } #endif diff --git a/src/gwin/checkbox.c b/src/gwin/checkbox.c index 74d612d2..84eb3b9f 100644 --- a/src/gwin/checkbox.c +++ b/src/gwin/checkbox.c @@ -24,13 +24,6 @@ // Our checked state #define GCHECKBOX_FLG_CHECKED (GWIN_FIRST_CONTROL_FLAG<<0) -static const GCheckboxColors defaultColors = { - Black, // border - Grey, // selected - White, // background - Black, // text -}; - // Send the checkbox event static void SendCheckboxEvent(GWidgetObject *gw) { GSourceListener * psl; @@ -115,70 +108,89 @@ static const gwidgetVMT checkboxVMT = { #endif }; -GHandle gwinCreateCheckbox(GCheckboxObject *gb, const GWidgetInit *pInit) { +GHandle gwinCheckboxCreate(GCheckboxObject *gb, const GWidgetInit *pInit) { if (!(gb = (GCheckboxObject *)_gwidgetCreate(&gb->w, pInit, &checkboxVMT))) return 0; #if GINPUT_NEED_TOGGLE gb->toggle = GWIDGET_NO_INSTANCE; #endif - gb->c = defaultColors; // assign the default colors gwinSetVisible((GHandle)gb, pInit->g.show); return (GHandle)gb; } -bool_t gwinIsCheckboxChecked(GHandle gh) { +void gwinCheckboxCheck(GHandle gh, bool_t isChecked) { + if (gh->vmt != (gwinVMT *)&checkboxVMT) + return; + + if (isChecked) { + if ((gh->flags & GCHECKBOX_FLG_CHECKED)) return; + gh->flags |= GCHECKBOX_FLG_CHECKED; + } else { + if (!(gh->flags & GCHECKBOX_FLG_CHECKED)) return; + gh->flags &= ~GCHECKBOX_FLG_CHECKED; + } + _gwidgetRedraw(gh); + SendCheckboxEvent((GWidgetObject *)gh); +} + +bool_t gwinCheckboxIsChecked(GHandle gh) { if (gh->vmt != (gwinVMT *)&checkboxVMT) return FALSE; return (gh->flags & GCHECKBOX_FLG_CHECKED) ? TRUE : FALSE; } -void gwinCheckboxSetColors(GHandle gh, GCheckboxColors *pColors) { - if (gh->vmt != (gwinVMT *)&checkboxVMT) - return; +/*---------------------------------------------------------- + * Custom Draw Routines + *----------------------------------------------------------*/ - ((GCheckboxObject *)gh)->c = *pColors; +static const GColorSet *getDrawColors(GWidgetObject *gw) { + if (!(gw->g.flags & GWIN_FLG_ENABLED)) return &gw->pstyle->disabled; + if ((gw->g.flags & GCHECKBOX_FLG_CHECKED)) return &gw->pstyle->pressed; + return &gw->pstyle->enabled; } void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param) { - #define gcw ((GCheckboxObject *)gw) - coord_t ld, df; - (void) param; + #define gcw ((GCheckboxObject *)gw) + coord_t ld, df; + const GColorSet * pcol; + (void) param; - if (gw->g.vmt != (gwinVMT *)&checkboxVMT) - return; + if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return; + pcol = getDrawColors(gw); ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height; - gdispFillArea(gw->g.x+1, gw->g.y+1, ld, ld-2, gcw->c.color_bg); - gdispDrawBox(gw->g.x, gw->g.y, ld, ld, gcw->c.color_border); + gdispFillArea(gw->g.x+1, gw->g.y+1, ld, ld-2, gw->pstyle->background); + gdispDrawBox(gw->g.x, gw->g.y, ld, ld, pcol->edge); df = ld < 4 ? 1 : 2; if (gw->g.flags & GCHECKBOX_FLG_CHECKED) - gdispFillArea(gw->g.x+df, gw->g.y+df, ld-2*df, ld-2*df, gcw->c.color_checked); + gdispFillArea(gw->g.x+df, gw->g.y+df, ld-2*df, ld-2*df, pcol->fill); - gdispFillStringBox(gw->g.x+ld+1, gw->g.y, gw->g.width-ld-1, gw->g.height, gw->txt, gw->g.font, gcw->c.color_txt, gcw->c.color_bg, justifyLeft); + gdispFillStringBox(gw->g.x+ld+1, gw->g.y, gw->g.width-ld-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyLeft); #undef gcw } void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) { - #define gcw ((GCheckboxObject *)gw) - coord_t ep, ld, df; - (void) param; + #define gcw ((GCheckboxObject *)gw) + coord_t ep, ld, df; + const GColorSet * pcol; + (void) param; - if (gw->g.vmt != (gwinVMT *)&checkboxVMT) - return; + if (gw->g.vmt != (gwinVMT *)&checkboxVMT) return; + pcol = getDrawColors(gw); ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height; ep = gw->g.width-ld-1; - gdispFillArea(gw->g.x+ep-1, gw->g.y+1, ld, ld-2, gcw->c.color_bg); - gdispDrawBox(gw->g.x+ep, gw->g.y, ld, ld, gcw->c.color_border); + gdispFillArea(gw->g.x+ep-1, gw->g.y+1, ld, ld-2, gw->pstyle->background); + gdispDrawBox(gw->g.x+ep, gw->g.y, ld, ld, pcol->edge); df = ld < 4 ? 1 : 2; if (gw->g.flags & GCHECKBOX_FLG_CHECKED) - gdispFillArea(gw->g.x+ep+df, gw->g.y+df, ld-2*df, ld-2*df, gcw->c.color_checked); + gdispFillArea(gw->g.x+ep+df, gw->g.y+df, ld-2*df, ld-2*df, pcol->fill); - gdispFillStringBox(gw->g.x, gw->g.y, ep, gw->g.height, gw->txt, gw->g.font, gcw->c.color_txt, gcw->c.color_bg, justifyRight); + gdispFillStringBox(gw->g.x, gw->g.y, ep, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyRight); #undef gcw } diff --git a/src/gwin/console.c b/src/gwin/console.c index 105cc79d..06648e9b 100644 --- a/src/gwin/console.c +++ b/src/gwin/console.c @@ -66,7 +66,7 @@ static const gwinVMT consoleVMT = { AfterClear, // The after-clear routine }; -GHandle gwinCreateConsole(GConsoleObject *gc, const GWindowInit *pInit) { +GHandle gwinConsoleCreate(GConsoleObject *gc, const GWindowInit *pInit) { if (!(gc = (GConsoleObject *)_gwindowCreate(&gc->g, pInit, &consoleVMT, 0))) return 0; #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM @@ -79,7 +79,7 @@ GHandle gwinCreateConsole(GConsoleObject *gc, const GWindowInit *pInit) { } #if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM - BaseSequentialStream *gwinGetConsoleStream(GHandle gh) { + BaseSequentialStream *gwinConsoleGetStream(GHandle gh) { if (gh->vmt != &consoleVMT) return 0; return (BaseSequentialStream *)&(((GConsoleObject *)(gh))->stream); diff --git a/src/gwin/gimage.c b/src/gwin/gimage.c index 464bc595..eef47dc7 100644 --- a/src/gwin/gimage.c +++ b/src/gwin/gimage.c @@ -16,7 +16,7 @@ #include "gwin/class_gwin.h" -#define widget(gh) ((GImageWidget*)gh) +#define widget(gh) ((GImageObject *)gh) static void _destroy(GWindowObject *gh) { if (gdispImageIsOpen(&widget(gh)->image)) @@ -80,14 +80,14 @@ static void _redraw(GHandle gh) { static const gwinVMT imageVMT = { "Image", // The class name - sizeof(GImageWidget), // The object size + sizeof(GImageObject), // The object size _destroy, // The destroy routine _redraw, // The redraw routine 0, // The after-clear routine }; -GHandle gwinImageCreate(GImageWidget *gobj, GWindowInit *pInit) { - if (!(gobj = (GImageWidget *)_gwindowCreate(&gobj->g, pInit, &imageVMT, 0))) +GHandle gwinImageCreate(GImageObject *gobj, GWindowInit *pInit) { + if (!(gobj = (GImageObject *)_gwindowCreate(&gobj->g, pInit, &imageVMT, 0))) return 0; // Ensure the gdispImageIsOpen() gives valid results diff --git a/src/gwin/graph.c b/src/gwin/graph.c index 049f52e0..de447f4f 100644 --- a/src/gwin/graph.c +++ b/src/gwin/graph.c @@ -165,7 +165,7 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t } } -GHandle gwinCreateGraph(GGraphObject *gg, const GWindowInit *pInit) { +GHandle gwinGraphCreate(GGraphObject *gg, const GWindowInit *pInit) { if (!(gg = (GGraphObject *)_gwindowCreate(&gg->g, pInit, &graphVMT, 0))) return 0; gg->xorigin = gg->yorigin = 0; diff --git a/src/gwin/gwidget.c b/src/gwin/gwidget.c index 6440f171..8fc6ba77 100644 --- a/src/gwin/gwidget.c +++ b/src/gwin/gwidget.c @@ -14,7 +14,67 @@ #include "gwin/class_gwin.h" /* Our listener for events for widgets */ -static GListener gl; +static GListener gl; + +/* Our default style - a white background theme */ +const GWidgetStyle WhiteWidgetStyle = { + HTML2COLOR(0xFFFFFF), // window background + + // enabled color set + { + HTML2COLOR(0x000000), // text + HTML2COLOR(0x404040), // edge + HTML2COLOR(0xE0E0E0), // fill + HTML2COLOR(0xE0E0E0), // progress - inactive area + }, + + // disabled color set + { + HTML2COLOR(0xC0C0C0), // text + HTML2COLOR(0x808080), // edge + HTML2COLOR(0xE0E0E0), // fill + HTML2COLOR(0xC0E0C0), // progress - active area + }, + + // pressed color set + { + HTML2COLOR(0x404040), // text + HTML2COLOR(0x404040), // edge + HTML2COLOR(0x808080), // fill + HTML2COLOR(0x00E000), // progress - active area + }, +}; + +/* Our black style */ +const GWidgetStyle BlackWidgetStyle = { + HTML2COLOR(0x000000), // window background + + // enabled color set + { + HTML2COLOR(0xC0C0C0), // text + HTML2COLOR(0xC0C0C0), // edge + HTML2COLOR(0x606060), // fill + HTML2COLOR(0x404040), // progress - inactive area + }, + + // disabled color set + { + HTML2COLOR(0x808080), // text + HTML2COLOR(0x404040), // edge + HTML2COLOR(0x404040), // fill + HTML2COLOR(0x004000), // progress - active area + }, + + // pressed color set + { + HTML2COLOR(0xFFFFFF), // text + HTML2COLOR(0xC0C0C0), // edge + HTML2COLOR(0xE0E0E0), // fill + HTML2COLOR(0x008000), // progress - active area + }, +}; + +static const GWidgetStyle * defaultStyle = &BlackWidgetStyle; /* We use these everywhere in this file */ #define gw ((GWidgetObject *)gh) @@ -169,9 +229,10 @@ GHandle _gwidgetCreate(GWidgetObject *pgw, const GWidgetInit *pInit, const gwidg if (!(pgw = (GWidgetObject *)_gwindowCreate(&pgw->g, &pInit->g, &vmt->g, GWIN_FLG_WIDGET|GWIN_FLG_ENABLED))) return 0; - pgw->txt = pInit->text ? pInit->text : ""; - pgw->fnDraw = vmt->DefaultDraw; - pgw->fnParam = 0; + pgw->text = pInit->text ? pInit->text : ""; + pgw->fnDraw = pInit->customDraw ? pInit->customDraw : vmt->DefaultDraw; + pgw->fnParam = pInit->customParam; + pgw->pstyle = pInit->customStyle ? pInit->customStyle : defaultStyle; return &pgw->g; } @@ -184,7 +245,7 @@ void _gwidgetDestroy(GHandle gh) { // Deallocate the text (if necessary) if ((gh->flags & GWIN_FLG_ALLOCTXT)) { gh->flags &= ~GWIN_FLG_ALLOCTXT; - gfxFree((void *)gw->txt); + gfxFree((void *)gw->text); } #if GFX_USE_GINPUT && GINPUT_NEED_TOGGLE @@ -226,32 +287,60 @@ void _gwidgetRedraw(GHandle gh) { gw->fnDraw(gw, gw->fnParam); } -void gwinSetText(GHandle gh, const char *txt, bool_t useAlloc) { +void gwinSetDefaultStyle(const GWidgetStyle *pstyle, bool_t updateAll) { + if (!pstyle) + pstyle = &BlackWidgetStyle; + + if (updateAll) { + const gfxQueueASyncItem * qi; + GHandle gh; + + for(qi = gfxQueueASyncPeek(&_GWINList); qi; qi = gfxQueueASyncNext(qi)) { + gh = QItem2GWindow(qi); + if ((gh->flags & GWIN_FLG_WIDGET) && ((GWidgetObject *)gh)->pstyle == defaultStyle) + gwinSetStyle(gh, pstyle); + } + } + gwinSetDefaultBgColor(pstyle->background); + defaultStyle = pstyle; +} + +/** + * @brief Get the current default style. + * + * @api + */ +const GWidgetStyle *gwinGetDefaultStyle(void) { + return defaultStyle; +} + + +void gwinSetText(GHandle gh, const char *text, bool_t useAlloc) { if (!(gh->flags & GWIN_FLG_WIDGET)) return; // Dispose of the old string if ((gh->flags & GWIN_FLG_ALLOCTXT)) { gh->flags &= ~GWIN_FLG_ALLOCTXT; - if (gw->txt) { - gfxFree((void *)gw->txt); - gw->txt = ""; + if (gw->text) { + gfxFree((void *)gw->text); + gw->text = ""; } } // Alloc the new text if required - if (txt && !*txt) txt = 0; - if (txt && useAlloc) { + if (!text || !*text) + gw->text = ""; + else if (useAlloc) { char *str; - if ((str = (char *)gfxAlloc(strlen(txt)+1))) { + if ((str = (char *)gfxAlloc(strlen(text)+1))) { gh->flags |= GWIN_FLG_ALLOCTXT; - strcpy(str, txt); + strcpy(str, text); } - txt = (const char *)str; - } - - gw->txt = txt ? txt : ""; + gw->text = (const char *)str; + } else + gw->text = text; _gwidgetRedraw(gh); } @@ -259,7 +348,20 @@ const char *gwinGetText(GHandle gh) { if (!(gh->flags & GWIN_FLG_WIDGET)) return 0; - return gw->txt; + return gw->text; +} + +void gwinSetStyle(GHandle gh, const GWidgetStyle *pstyle) { + if (!(gh->flags & GWIN_FLG_WIDGET)) + return; + gw->pstyle = pstyle ? pstyle : defaultStyle; + gh->bgcolor = pstyle->background; + gh->color = pstyle->enabled.text; + _gwidgetRedraw(gh); +} + +const GWidgetStyle *gwinGetStyle(GHandle gh) { + return gw->pstyle; } void gwinSetCustomDraw(GHandle gh, CustomWidgetDrawFunction fn, void *param) { diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 92b6cc03..2fd0c905 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -32,11 +32,6 @@ static color_t defaultBgColor = Black; #if GDISP_NEED_TEXT static font_t defaultFont; #endif -#if GWIN_NEED_WINDOWMANAGER - gfxQueueASync _GWINList; - extern GWindowManager GNullWindowManager; - static GWindowManager * cwm; -#endif /*----------------------------------------------- * Helper Routines @@ -52,9 +47,9 @@ static color_t defaultBgColor = Black; } else gwinClear(gh); } - static void _gwm_redim(GHandle gh, const GWindowInit *pInit) { - gh->x = pInit->x; gh->y = pInit->y; - gh->width = pInit->width; gh->height = pInit->height; + static void _gwm_redim(GHandle gh, coord_t x, coord_t y, coord_t width, coord_t height) { + gh->x = x; gh->y = y; + gh->width = width; gh->height = height; if (gh->x < 0) { gh->width += gh->x; gh->x = 0; } if (gh->y < 0) { gh->height += gh->y; gh->y = 0; } if (gh->x > gdispGetWidth()-MIN_WIN_WIDTH) gh->x = gdispGetWidth()-MIN_WIN_WIDTH; @@ -87,9 +82,9 @@ void _gwinInit(void) { _gwidgetInit(); #endif #if GWIN_NEED_WINDOWMANAGER - gfxQueueASyncInit(&_GWINList); - cwm = &GNullWindowManager; - cwm->vmt->Init(); + extern void _gwmInit(void); + + _gwmInit(); #endif } @@ -113,7 +108,7 @@ GHandle _gwindowCreate(GWindowObject *pgw, const GWindowInit *pInit, const gwinV #endif #if GWIN_NEED_WINDOWMANAGER - if (!cwm->vmt->Add(pgw, pInit)) { + if (!_GWINwm->vmt->Add(pgw, pInit)) { if ((pgw->flags & GWIN_FLG_DYNAMIC)) gfxFree(pgw); return 0; @@ -129,18 +124,6 @@ GHandle _gwindowCreate(GWindowObject *pgw, const GWindowInit *pInit, const gwinV * Routines that affect all windows *-----------------------------------------------*/ -#if GWIN_NEED_WINDOWMANAGER - void gwinSetWindowManager(struct GWindowManager *gwm) { - if (!gwm) - gwm = &GNullWindowManager; - if (cwm != gwm) { - cwm->vmt->DeInit(); - cwm = gwm; - cwm->vmt->Init(); - } - } -#endif - void gwinSetDefaultColor(color_t clr) { defaultFgColor = clr; } @@ -171,7 +154,7 @@ color_t gwinGetDefaultBgColor(void) { * The GWindow Routines *-----------------------------------------------*/ -GHandle gwinCreateWindow(GWindowObject *pgw, const GWindowInit *pInit) { +GHandle gwinWindowCreate(GWindowObject *pgw, const GWindowInit *pInit) { if (!(pgw = _gwindowCreate(pgw, pInit, &basegwinVMT, 0))) return 0; gwinSetVisible(pgw, pInit->show); @@ -181,7 +164,7 @@ GHandle gwinCreateWindow(GWindowObject *pgw, const GWindowInit *pInit) { void gwinDestroy(GHandle gh) { // Remove from the window manager #if GWIN_NEED_WINDOWMANAGER - cwm->vmt->Delete(gh); + _GWINwm->vmt->Delete(gh); #endif // Class destroy routine @@ -204,7 +187,7 @@ void gwinSetVisible(GHandle gh, bool_t visible) { if (!(gh->flags & GWIN_FLG_VISIBLE)) { gh->flags |= GWIN_FLG_VISIBLE; #if GWIN_NEED_WINDOWMANAGER - cwm->vmt->Visible(gh); + _GWINwm->vmt->Visible(gh); #else _gwm_vis(gh); #endif @@ -213,7 +196,7 @@ void gwinSetVisible(GHandle gh, bool_t visible) { if ((gh->flags & GWIN_FLG_VISIBLE)) { gh->flags &= ~GWIN_FLG_VISIBLE; #if GWIN_NEED_WINDOWMANAGER - cwm->vmt->Visible(gh); + _GWINwm->vmt->Visible(gh); #endif } } @@ -253,7 +236,7 @@ bool_t gwinGetEnabled(GHandle gh) { void gwinMove(GHandle gh, coord_t x, coord_t y) { #if GWIN_NEED_WINDOWMANAGER - cwm->vmt->Redim(gh, x, y, gh->width, gh->height); + _GWINwm->vmt->Redim(gh, x, y, gh->width, gh->height); #else _gwm_redim(gh, x, y, gh->width, gh->height); #endif @@ -261,44 +244,21 @@ void gwinMove(GHandle gh, coord_t x, coord_t y) { void gwinResize(GHandle gh, coord_t width, coord_t height) { #if GWIN_NEED_WINDOWMANAGER - cwm->vmt->Redim(gh, gh->x, gh->y, width, height); + _GWINwm->vmt->Redim(gh, gh->x, gh->y, width, height); #else _gwm_redim(gh, gh->x, gh->y, width, height); #endif } -void gwinSetMinMax(GHandle gh, GWindowMinMax minmax) { +void gwinRedraw(GHandle gh) { #if GWIN_NEED_WINDOWMANAGER - cwm->vmt->MinMax(gh, minmax); + gwinRaise(gh); #else - (void) gh; - (void) minmax; + if ((gh->flags & GWIN_FLG_VISIBLE)) + _gwm_vis(gh); #endif } -void gwinRaise(GHandle gh) { - #if GWIN_NEED_WINDOWMANAGER - cwm->vmt->Raise(gh); - #else - if ((gh->flags & GWIN_FLG_VISIBLE)) { - if (gh->vmt->Redraw) { - #if GDISP_NEED_CLIP - gdispSetClip(gh->x, gh->y, gh->width, gh->height); - #endif - gh->vmt->Redraw(gh); - } - } - #endif -} - -GWindowMinMax gwinGetMinMax(GHandle gh) { - if (gh->flags & GWIN_FLG_MINIMIZED) - return GWIN_MINIMIZE; - if (gh->flags & GWIN_FLG_MAXIMIZED) - return GWIN_MAXIMIZE; - return GWIN_NORMAL; -} - #if GDISP_NEED_TEXT void gwinSetFont(GHandle gh, font_t font) { gh->font = font; diff --git a/src/gwin/gwm.c b/src/gwin/gwm.c index 88d61a21..f9f56838 100644 --- a/src/gwin/gwm.c +++ b/src/gwin/gwm.c @@ -43,10 +43,49 @@ static const gwmVMT GNullWindowManagerVMT = { WM_MinMax, }; -const GWindowManager GNullWindowManager = { +static const GWindowManager GNullWindowManager = { &GNullWindowManagerVMT, }; +gfxQueueASync _GWINList; +GWindowManager * _GWINwm; + +/*----------------------------------------------- + * Window Routines + *-----------------------------------------------*/ + +void _gwmInit(void) { + gfxQueueASyncInit(&_GWINList); + _GWINwm = (GWindowManager *)&GNullWindowManager; + _GWINwm->vmt->Init(); +} + +void gwinSetWindowManager(struct GWindowManager *gwm) { + if (!gwm) + gwm = (GWindowManager *)&GNullWindowManager; + if (_GWINwm != gwm) { + _GWINwm->vmt->DeInit(); + _GWINwm = gwm; + _GWINwm->vmt->Init(); + } +} + +void gwinSetMinMax(GHandle gh, GWindowMinMax minmax) { + _GWINwm->vmt->MinMax(gh, minmax); +} + +void gwinRaise(GHandle gh) { + _GWINwm->vmt->Raise(gh); +} + +GWindowMinMax gwinGetMinMax(GHandle gh) { + if (gh->flags & GWIN_FLG_MINIMIZED) + return GWIN_MINIMIZE; + if (gh->flags & GWIN_FLG_MAXIMIZED) + return GWIN_MAXIMIZE; + return GWIN_NORMAL; +} + /*----------------------------------------------- * Window Manager Routines *-----------------------------------------------*/ diff --git a/src/gwin/label.c b/src/gwin/label.c index cd469210..71ed18eb 100644 --- a/src/gwin/label.c +++ b/src/gwin/label.c @@ -25,38 +25,40 @@ #define GLABEL_FLG_HAUTO (GWIN_FIRST_CONTROL_FLAG<<1) // Simple: single line with no wrapping -static coord_t getwidth(const char *txt, font_t font, coord_t maxwidth) { +static coord_t getwidth(const char *text, font_t font, coord_t maxwidth) { (void) maxwidth; - return gdispGetStringWidth(txt, font)+2; // Allow one pixel of padding on each side + return gdispGetStringWidth(text, font)+2; // Allow one pixel of padding on each side } // Simple: single line with no wrapping -static coord_t getheight(const char *txt, font_t font, coord_t maxwidth) { - (void) txt; +static coord_t getheight(const char *text, font_t font, coord_t maxwidth) { + (void) text; (void) maxwidth; return gdispGetFontMetric(font, fontHeight); } static void gwinLabelDefaultDraw(GWidgetObject *gw, void *param) { - (void) param; - coord_t w, h; + coord_t w, h; + (void) param; - w = (gw->g.flags & GLABEL_FLG_WAUTO) ? getwidth(gw->txt, gw->g.font, gdispGetWidth() - gw->g.x) : gw->g.width; - h = (gw->g.flags & GLABEL_FLG_HAUTO) ? getheight(gw->txt, gw->g.font, gdispGetWidth() - gw->g.x) : gw->g.height; + w = (gw->g.flags & GLABEL_FLG_WAUTO) ? getwidth(gw->text, gw->g.font, gdispGetWidth() - gw->g.x) : gw->g.width; + h = (gw->g.flags & GLABEL_FLG_HAUTO) ? getheight(gw->text, gw->g.font, gdispGetWidth() - gw->g.x) : gw->g.height; if (gw->g.width != w || gw->g.height != h) { gwinResize(&gw->g, w, h); return; } - gdispFillStringBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->txt, gw->g.font, gw->g.color, gw->g.bgcolor, justifyLeft); + gdispFillStringBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->text, gw->g.font, + (gw->g.flags & GWIN_FLG_ENABLED) ? gw->pstyle->enabled.text : gw->pstyle->disabled.text, gw->pstyle->background, + justifyLeft); } static const gwidgetVMT labelVMT = { { "Label", // The class name - sizeof(GLabelWidget), // The object size + sizeof(GLabelObject), // The object size _gwidgetDestroy, // The destroy routine _gwidgetRedraw, // The redraw routine 0, // The after-clear routine @@ -88,7 +90,7 @@ static const gwidgetVMT labelVMT = { #endif }; -GHandle gwinLabelCreate(GLabelWidget *widget, GWidgetInit *pInit) { +GHandle gwinLabelCreate(GLabelObject *widget, GWidgetInit *pInit) { uint16_t flags = 0; // auto assign width @@ -103,7 +105,7 @@ GHandle gwinLabelCreate(GLabelWidget *widget, GWidgetInit *pInit) { pInit->g.height = getheight(pInit->text, gwinGetDefaultFont(), gdispGetWidth() - pInit->g.x); } - if (!(widget = (GLabelWidget *)_gwidgetCreate(&widget->w, pInit, &labelVMT))) + if (!(widget = (GLabelObject *)_gwidgetCreate(&widget->w, pInit, &labelVMT))) return 0; widget->w.g.flags |= flags; diff --git a/src/gwin/radio.c b/src/gwin/radio.c index d1c65dbc..26ff0b83 100644 --- a/src/gwin/radio.c +++ b/src/gwin/radio.c @@ -24,25 +24,8 @@ // Our pressed state #define GRADIO_FLG_PRESSED (GWIN_FIRST_CONTROL_FLAG<<0) -// Default color scheme -static const GRadioColors GRadioDefaultColorsUp = { - HTML2COLOR(0x404040), // color_up_edge; - HTML2COLOR(0xE0E0E0), // color_up_fill; - HTML2COLOR(0x000000), // color_up_txt; -}; -static const GRadioColors GRadioDefaultColorsDown = { - HTML2COLOR(0x404040), // color_dn_edge; - HTML2COLOR(0x808080), // color_dn_fill; - HTML2COLOR(0x404040), // color_dn_txt; -}; -static const GRadioColors GRadioDefaultColorsDisabled = { - HTML2COLOR(0x808080), // color_dis_edge; - HTML2COLOR(0xE0E0E0), // color_dis_fill; - HTML2COLOR(0xC0C0C0), // color_dis_txt; -}; - // Send the button event -static void SendButtonEvent(GWidgetObject *gw) { +static void SendRadioEvent(GWidgetObject *gw) { GSourceListener * psl; GEvent * pe; #define pbe ((GEventGWinRadio *)pe) @@ -66,7 +49,7 @@ static void SendButtonEvent(GWidgetObject *gw) { static void MouseDown(GWidgetObject *gw, coord_t x, coord_t y) { (void) x; (void) y; - gwinPressRadio((GHandle)gw); + gwinRadioPress((GHandle)gw); } #endif @@ -75,7 +58,7 @@ static void SendButtonEvent(GWidgetObject *gw) { static void ToggleOn(GWidgetObject *gw, uint16_t role) { (void) role; - gwinPressRadio((GHandle)gw); + gwinRadioPress((GHandle)gw); } static void ToggleAssign(GWidgetObject *gw, uint16_t role, uint16_t instance) { @@ -125,7 +108,7 @@ static const gwidgetVMT radioVMT = { #endif }; -GHandle gwinCreateRadio(GRadioObject *gw, const GWidgetInit *pInit, uint16_t group) { +GHandle gwinRadioCreate(GRadioObject *gw, const GWidgetInit *pInit, uint16_t group) { if (!(gw = (GRadioObject *)_gwidgetCreate(&gw->w, pInit, &radioVMT))) return 0; @@ -133,53 +116,33 @@ GHandle gwinCreateRadio(GRadioObject *gw, const GWidgetInit *pInit, uint16_t gro gw->toggle = GWIDGET_NO_INSTANCE; #endif gw->group = group; - gw->c_up = GRadioDefaultColorsUp; - gw->c_dn = GRadioDefaultColorsDown; - gw->c_dis = GRadioDefaultColorsDisabled; gwinSetVisible((GHandle)gw, pInit->g.show); return (GHandle)gw; } -void gwinSetRadioColors(GHandle gh, const GRadioColors *pUp, const GRadioColors *pDown, const GRadioColors *pDisabled) { - if (gh->vmt != (gwinVMT *)&radioVMT) - return; - - if (pUp) ((GRadioObject *)gh)->c_up = *pUp; - if (pDown) ((GRadioObject *)gh)->c_dn = *pDown; - if (pDisabled) ((GRadioObject *)gh)->c_dis = *pDisabled; -} - -void gwinPressRadio(GHandle gh) { +void gwinRadioPress(GHandle gh) { GHandle gx; if (gh->vmt != (gwinVMT *)&radioVMT || (gh->flags & GRADIO_FLG_PRESSED)) return; - if ((gx = gwinActiveRadio(((GRadioObject *)gh)->group))) { + if ((gx = gwinRadioGetActive(((GRadioObject *)gh)->group))) { gx->flags &= ~GRADIO_FLG_PRESSED; _gwidgetRedraw(gx); } gh->flags |= GRADIO_FLG_PRESSED; _gwidgetRedraw(gh); - SendButtonEvent((GWidgetObject *)gh); + SendRadioEvent((GWidgetObject *)gh); } -bool_t gwinIsRadioPressed(GHandle gh) { +bool_t gwinRadioIsPressed(GHandle gh) { if (gh->vmt != (gwinVMT *)&radioVMT) return FALSE; return (gh->flags & GRADIO_FLG_PRESSED) ? TRUE : FALSE; } -/** - * @brief Find the currently pressed radio button in the specified group - * @return The handle of the pressed radio button or NULL if none are pressed - * - * @param[in] gh The window handle (must be a radio widget) - * - * @api - */ -GHandle gwinActiveRadio(uint16_t group) { +GHandle gwinRadioGetActive(uint16_t group) { const gfxQueueASyncItem * qi; GHandle gh; @@ -195,17 +158,17 @@ GHandle gwinActiveRadio(uint16_t group) { * Custom Draw Routines *----------------------------------------------------------*/ -static GRadioColors *getDrawColors(GWidgetObject *gw) { - if (!(gw->g.flags & GWIN_FLG_ENABLED)) return &((GRadioObject *)gw)->c_dis; - if ((gw->g.flags & GRADIO_FLG_PRESSED)) return &((GRadioObject *)gw)->c_dn; - return &((GRadioObject *)gw)->c_up; +static const GColorSet *getDrawColors(GWidgetObject *gw) { + if (!(gw->g.flags & GWIN_FLG_ENABLED)) return &gw->pstyle->disabled; + if ((gw->g.flags & GRADIO_FLG_PRESSED)) return &gw->pstyle->pressed; + return &gw->pstyle->enabled; } void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) { - #define gcw ((GRadioObject *)gw) - coord_t ld, df; - GRadioColors * pcol; - (void) param; + #define gcw ((GRadioObject *)gw) + coord_t ld, df; + const GColorSet * pcol; + (void) param; if (gw->g.vmt != (gwinVMT *)&radioVMT) return; pcol = getDrawColors(gw); @@ -213,46 +176,52 @@ void gwinRadioDraw_Radio(GWidgetObject *gw, void *param) { ld = gw->g.width < gw->g.height ? gw->g.width : gw->g.height; #if GDISP_NEED_CIRCLE - df = ld/2; - gdispFillArea(gw->g.x, gw->g.y, ld, ld, gw->g.bgcolor); - gdispDrawCircle(gw->g.x+df, gw->g.y+df, df, pcol->color_edge); + df = (ld-1)/2; + gdispFillArea(gw->g.x, gw->g.y, ld, ld, gw->pstyle->background); + gdispDrawCircle(gw->g.x+df, gw->g.y+df, df, pcol->edge); if (gw->g.flags & GRADIO_FLG_PRESSED) - gdispFillCircle(gw->g.x+df, gw->g.y+df, df <= 2 ? 1 : (df-2), pcol->color_fill); + gdispFillCircle(gw->g.x+df, gw->g.y+df, df <= 2 ? 1 : (df-2), pcol->fill); #else - gdispFillArea(gw->g.x+1, gw->g.y+1, ld, ld-2, gw->g.bgcolor); - gdispDrawBox(gw->g.x, gw->g.y, ld, ld, pcol->color_edge); + gdispFillArea(gw->g.x+1, gw->g.y+1, ld, ld-2, gw->pstyle->background); + gdispDrawBox(gw->g.x, gw->g.y, ld, ld, pcol->edge); df = ld < 4 ? 1 : 2; if (gw->g.flags & GRADIO_FLG_PRESSED) - gdispFillArea(gw->g.x+df, gw->g.y+df, ld-2*df, ld-2*df, pcol->color_fill); + gdispFillArea(gw->g.x+df, gw->g.y+df, ld-2*df, ld-2*df, pcol->fill); #endif - gdispFillStringBox(gw->g.x+ld+1, gw->g.y, gw->g.width-ld-1, gw->g.height, gw->txt, gw->g.font, pcol->color_txt, gw->g.bgcolor, justifyLeft); + gdispFillStringBox(gw->g.x+ld+1, gw->g.y, gw->g.width-ld-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyLeft); #undef gcw } void gwinRadioDraw_Button(GWidgetObject *gw, void *param) { - (void) param; - GRadioColors * pcol; + const GColorSet * pcol; + (void) param; if (gw->g.vmt != (gwinVMT *)&radioVMT) return; pcol = getDrawColors(gw); - gdispFillStringBox(gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->txt, gw->g.font, pcol->color_txt, pcol->color_fill, justifyCenter); - gdispDrawLine(gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->color_edge); - gdispDrawLine(gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->color_edge); + gdispFillStringBox(gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter); + gdispDrawLine(gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge); + gdispDrawLine(gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge); } void gwinRadioDraw_Tab(GWidgetObject *gw, void *param) { - (void) param; - GRadioColors * pcol; + const GColorSet * pcol; + (void) param; if (gw->g.vmt != (gwinVMT *)&radioVMT) return; pcol = getDrawColors(gw); - gdispFillStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, pcol->color_txt, pcol->color_fill, justifyCenter); - gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->color_edge); + if ((gw->g.flags & GRADIO_FLG_PRESSED)) { + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); + gdispFillStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter); + } else { + gdispFillStringBox(gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter); + gdispDrawLine(gw->g.x+gw->g.width-1, gw->g.y, gw->g.x+gw->g.width-1, gw->g.y+gw->g.height-1, pcol->edge); + gdispDrawLine(gw->g.x, gw->g.y+gw->g.height-1, gw->g.x+gw->g.width-2, gw->g.y+gw->g.height-1, pcol->edge); + } } #endif /* GFX_USE_GWIN && GWIN_NEED_BUTTON */ diff --git a/src/gwin/slider.c b/src/gwin/slider.c index 5aa320f8..4d9c3510 100644 --- a/src/gwin/slider.c +++ b/src/gwin/slider.c @@ -29,14 +29,6 @@ #define GWIN_SLIDER_TOGGLE_INC 20 // How many toggles to go from minimum to maximum #endif -static const GSliderColors GSliderDefaultColors = { - HTML2COLOR(0x404040), // color_edge - HTML2COLOR(0x000000), // color_thumb - HTML2COLOR(0x00E000), // color_active - HTML2COLOR(0xE0E0E0), // color_inactive - HTML2COLOR(0xFFFFFF), // color_txt -}; - // Send the slider event static void SendSliderEvent(GWidgetObject *gw) { GSourceListener * psl; @@ -146,10 +138,10 @@ static void ResetDisplayPos(GSliderObject *gsw) { #define gsw ((GSliderObject *)gw) if (role) { - gwinSetSliderPosition((GHandle)gw, gsw->pos+(gsw->max-gsw->min)/GWIN_SLIDER_TOGGLE_INC); + gwinSliderSetPosition((GHandle)gw, gsw->pos+(gsw->max-gsw->min)/GWIN_SLIDER_TOGGLE_INC); SendSliderEvent(gw); } else { - gwinSetSliderPosition((GHandle)gw, gsw->pos-(gsw->max-gsw->min)/GWIN_SLIDER_TOGGLE_INC); + gwinSliderSetPosition((GHandle)gw, gsw->pos-(gsw->max-gsw->min)/GWIN_SLIDER_TOGGLE_INC); SendSliderEvent(gw); } #undef gsw @@ -231,7 +223,7 @@ static const gwidgetVMT sliderVMT = { #endif }; -GHandle gwinCreateSlider(GSliderObject *gs, const GWidgetInit *pInit) { +GHandle gwinSliderCreate(GSliderObject *gs, const GWidgetInit *pInit) { if (!(gs = (GSliderObject *)_gwidgetCreate(&gs->w, pInit, &sliderVMT))) return 0; #if GINPUT_NEED_TOGGLE @@ -241,7 +233,6 @@ GHandle gwinCreateSlider(GSliderObject *gs, const GWidgetInit *pInit) { #if GINPUT_NEED_DIAL gs->dial = GWIDGET_NO_INSTANCE; #endif - gs->c = GSliderDefaultColors; gs->min = 0; gs->max = 100; gs->pos = 0; @@ -250,7 +241,7 @@ GHandle gwinCreateSlider(GSliderObject *gs, const GWidgetInit *pInit) { return (GHandle)gs; } -void gwinSetSliderRange(GHandle gh, int min, int max) { +void gwinSliderSetRange(GHandle gh, int min, int max) { #define gsw ((GSliderObject *)gh) if (gh->vmt != (gwinVMT *)&sliderVMT) @@ -265,7 +256,7 @@ void gwinSetSliderRange(GHandle gh, int min, int max) { #undef gsw } -void gwinSetSliderPosition(GHandle gh, int pos) { +void gwinSliderSetPosition(GHandle gh, int pos) { #define gsw ((GSliderObject *)gh) if (gh->vmt != (gwinVMT *)&sliderVMT) @@ -284,61 +275,70 @@ void gwinSetSliderPosition(GHandle gh, int pos) { #undef gsw } -void gwinSetSliderColors(GHandle gh, const GSliderColors *pColors) { - if (gh->vmt != (gwinVMT *)&sliderVMT) - return; - - ((GSliderObject *)gh)->c = *pColors; -} +/*---------------------------------------------------------- + * Custom Draw Routines + *----------------------------------------------------------*/ void gwinSliderDraw_Std(GWidgetObject *gw, void *param) { - #define gsw ((GSliderObject *)gw) - (void) param; + #define gsw ((GSliderObject *)gw) + const GColorSet * pcol; + (void) param; if (gw->g.vmt != (gwinVMT *)&sliderVMT) return; + if ((gw->g.flags & GWIN_FLG_ENABLED)) + pcol = &gw->pstyle->pressed; + else + pcol = &gw->pstyle->disabled; + if (gw->g.width < gw->g.height) { // Vertical slider if (gsw->dpos != gw->g.height-1) - gdispFillArea(gw->g.x, gw->g.y+gsw->dpos, gw->g.width, gw->g.height - gsw->dpos, gsw->c.color_active); + gdispFillArea(gw->g.x, gw->g.y+gsw->dpos, gw->g.width, gw->g.height - gsw->dpos, pcol->progress); // Active Area if (gsw->dpos != 0) - gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gsw->dpos, gsw->c.color_inactive); - gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gsw->c.color_edge); - gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos, gsw->c.color_thumb); + gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gsw->dpos, gw->pstyle->enabled.progress); // Inactive area + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); // Edge + gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos, pcol->edge); // Thumb if (gsw->dpos >= 2) - gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos-2, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos-2, gsw->c.color_thumb); + gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos-2, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos-2, pcol->edge); // Thumb if (gsw->dpos <= gw->g.height-2) - gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos+2, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos+2, gsw->c.color_thumb); + gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos+2, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos+2, pcol->edge); // Thumb // Horizontal slider } else { if (gsw->dpos != gw->g.width-1) - gdispFillArea(gw->g.x+gsw->dpos, gw->g.y, gw->g.width-gsw->dpos, gw->g.height, gsw->c.color_inactive); + gdispFillArea(gw->g.x+gsw->dpos, gw->g.y, gw->g.width-gsw->dpos, gw->g.height, gw->pstyle->enabled.progress); // Inactive area if (gsw->dpos != 0) - gdispFillArea(gw->g.x, gw->g.y, gsw->dpos, gw->g.height, gsw->c.color_active); - gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gsw->c.color_edge); - gdispDrawLine(gw->g.x+gsw->dpos, gw->g.y, gw->g.x+gsw->dpos, gw->g.y+gw->g.height-1, gsw->c.color_thumb); + gdispFillArea(gw->g.x, gw->g.y, gsw->dpos, gw->g.height, pcol->progress); // Active Area + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); // Edge + gdispDrawLine(gw->g.x+gsw->dpos, gw->g.y, gw->g.x+gsw->dpos, gw->g.y+gw->g.height-1, pcol->edge); // Thumb if (gsw->dpos >= 2) - gdispDrawLine(gw->g.x+gsw->dpos-2, gw->g.y, gw->g.x+gsw->dpos-2, gw->g.y+gw->g.height-1, gsw->c.color_thumb); + gdispDrawLine(gw->g.x+gsw->dpos-2, gw->g.y, gw->g.x+gsw->dpos-2, gw->g.y+gw->g.height-1, pcol->edge); // Thumb if (gsw->dpos <= gw->g.width-2) - gdispDrawLine(gw->g.x+gsw->dpos+2, gw->g.y, gw->g.x+gsw->dpos+2, gw->g.y+gw->g.height-1, gsw->c.color_thumb); + gdispDrawLine(gw->g.x+gsw->dpos+2, gw->g.y, gw->g.x+gsw->dpos+2, gw->g.y+gw->g.height-1, pcol->edge); // Thumb } - gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, gsw->c.color_txt, justifyCenter); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter); #undef gsw } void gwinSliderDraw_Image(GWidgetObject *gw, void *param) { - #define gsw ((GSliderObject *)gw) - #define gi ((gdispImage *)param) - coord_t z, v; + #define gsw ((GSliderObject *)gw) + #define gi ((gdispImage *)param) + const GColorSet * pcol; + coord_t z, v; if (gw->g.vmt != (gwinVMT *)&sliderVMT) return; + if ((gw->g.flags & GWIN_FLG_ENABLED)) + pcol = &gw->pstyle->pressed; + else + pcol = &gw->pstyle->disabled; + if (gw->g.width < gw->g.height) { // Vertical slider if (gsw->dpos != 0) // The unfilled area - gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gsw->dpos, gsw->c.color_inactive); + gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gsw->dpos, gw->pstyle->enabled.progress); // Inactive area if (gsw->dpos != gw->g.height-1) { // The filled area for(z=gw->g.height, v=gi->height; z > gsw->dpos;) { z -= v; @@ -349,13 +349,13 @@ void gwinSliderDraw_Image(GWidgetObject *gw, void *param) { gdispImageDraw(gi, gw->g.x, gw->g.y+z, gw->g.width, v, 0, gi->height-v); } } - gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gsw->c.color_edge); - gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos, gsw->c.color_thumb); + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); // Edge + gdispDrawLine(gw->g.x, gw->g.y+gsw->dpos, gw->g.x+gw->g.width-1, gw->g.y+gsw->dpos, pcol->edge); // Thumb // Horizontal slider } else { if (gsw->dpos != gw->g.width-1) // The unfilled area - gdispFillArea(gw->g.x+gsw->dpos, gw->g.y, gw->g.width-gsw->dpos, gw->g.height, gsw->c.color_inactive); + gdispFillArea(gw->g.x+gsw->dpos, gw->g.y, gw->g.width-gsw->dpos, gw->g.height, gw->pstyle->enabled.progress); // Inactive area if (gsw->dpos != 0) { // The filled area for(z=0, v=gi->width; z < gsw->dpos; z += v) { if (z+v > gsw->dpos) @@ -363,10 +363,10 @@ void gwinSliderDraw_Image(GWidgetObject *gw, void *param) { gdispImageDraw(gi, gw->g.x+z, gw->g.y, v, gw->g.height, 0, 0); } } - gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gsw->c.color_edge); - gdispDrawLine(gw->g.x+gsw->dpos, gw->g.y, gw->g.x+gsw->dpos, gw->g.y+gw->g.height-1, gsw->c.color_thumb); + gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge); // Edge + gdispDrawLine(gw->g.x+gsw->dpos, gw->g.y, gw->g.x+gsw->dpos, gw->g.y+gw->g.height-1, pcol->edge); // Thumb } - gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->txt, gw->g.font, gsw->c.color_txt, justifyCenter); + gdispDrawStringBox(gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter); #undef gsw } From fb131f8d26319c787286a9adf24d9876d9793b2f Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 7 Jul 2013 19:41:15 +1000 Subject: [PATCH 33/38] Remove Slider demo. It is replaced by the Wdigets demo --- demos/modules/gwin/slider/gfxconf.h | 84 ---------------- demos/modules/gwin/slider/main.c | 97 ------------------- demos/modules/gwin/slider/readme.txt | 6 -- demos/modules/gwin/slider/result_647x490.png | Bin 24141 -> 0 bytes 4 files changed, 187 deletions(-) delete mode 100644 demos/modules/gwin/slider/gfxconf.h delete mode 100644 demos/modules/gwin/slider/main.c delete mode 100644 demos/modules/gwin/slider/readme.txt delete mode 100644 demos/modules/gwin/slider/result_647x490.png diff --git a/demos/modules/gwin/slider/gfxconf.h b/demos/modules/gwin/slider/gfxconf.h deleted file mode 100644 index b7b39a3f..00000000 --- a/demos/modules/gwin/slider/gfxconf.h +++ /dev/null @@ -1,84 +0,0 @@ -/* - * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu - * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef _GFXCONF_H -#define _GFXCONF_H - -/* The operating system to use - one of these must be defined */ -#define GFX_USE_OS_CHIBIOS TRUE -#define GFX_USE_OS_WIN32 FALSE -#define GFX_USE_OS_POSIX FALSE - -/* GFX sub-systems to turn on */ -#define GFX_USE_GDISP TRUE -#define GFX_USE_GWIN TRUE -#define GFX_USE_GEVENT TRUE -#define GFX_USE_GTIMER TRUE -#define GFX_USE_GINPUT TRUE - -/* Features for the GDISP sub-system. */ -#define GDISP_NEED_VALIDATION TRUE -#define GDISP_NEED_CLIP TRUE -#define GDISP_NEED_TEXT TRUE -#define GDISP_NEED_CIRCLE FALSE -#define GDISP_NEED_ELLIPSE FALSE -#define GDISP_NEED_ARC FALSE -#define GDISP_NEED_CONVEX_POLYGON FALSE -#define GDISP_NEED_SCROLL FALSE -#define GDISP_NEED_PIXELREAD FALSE -#define GDISP_NEED_CONTROL FALSE -#define GDISP_NEED_IMAGE FALSE -#define GDISP_NEED_MULTITHREAD TRUE -#define GDISP_NEED_ASYNC FALSE -#define GDISP_NEED_MSGAPI FALSE - -/* Builtin Fonts */ -#define GDISP_INCLUDE_FONT_SMALL FALSE -#define GDISP_INCLUDE_FONT_LARGER FALSE -#define GDISP_INCLUDE_FONT_UI1 FALSE -#define GDISP_INCLUDE_FONT_UI2 TRUE -#define GDISP_INCLUDE_FONT_LARGENUMBERS FALSE - -/* GDISP image decoders */ -#define GDISP_NEED_IMAGE_NATIVE FALSE -#define GDISP_NEED_IMAGE_GIF FALSE -#define GDISP_NEED_IMAGE_BMP FALSE -#define GDISP_NEED_IMAGE_JPG FALSE -#define GDISP_NEED_IMAGE_PNG FALSE - -/* Features for the GWIN sub-system. */ -#define GWIN_NEED_BUTTON FALSE -#define GWIN_NEED_CONSOLE TRUE -#define GWIN_NEED_SLIDER TRUE - -/* Features for the GINPUT sub-system. */ -#define GINPUT_NEED_MOUSE TRUE -#define GINPUT_NEED_DIAL TRUE - -#endif /* _GFXCONF_H */ diff --git a/demos/modules/gwin/slider/main.c b/demos/modules/gwin/slider/main.c deleted file mode 100644 index 15dc3e26..00000000 --- a/demos/modules/gwin/slider/main.c +++ /dev/null @@ -1,97 +0,0 @@ -/* - * Copyright (c) 2012, 2013, Joel Bodenmann aka Tectu - * Copyright (c) 2012, 2013, Andrew Hannam aka inmarket - * - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * * Neither the name of the nor the - * names of its contributors may be used to endorse or promote products - * derived from this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "gfx.h" -#include "chprintf.h" - -static GListener gl; - -#define SLIDER_WIDTH 20 - -int main(void) { - coord_t swidth, sheight; - GHandle ghSliderH, ghSliderV, ghConsole; - font_t fui2; - GEvent * pe; - GEventGWinSlider * pSliderEvent; - BaseSequentialStream *consout; - - gfxInit(); // Initialize the display - - // Get the display dimensions - swidth = gdispGetWidth(); - sheight = gdispGetHeight(); - - // Get the font - fui2 = gdispOpenFont("UI2"); - - // Create out gwin windows/widgets - ghSliderH = gwinCreateSlider(NULL, 5, 5, swidth-10, SLIDER_WIDTH); - ghSliderV = gwinCreateSlider(NULL, 5, 10+SLIDER_WIDTH, SLIDER_WIDTH, sheight-15+SLIDER_WIDTH); - ghConsole = gwinCreateConsole(NULL, 10+SLIDER_WIDTH, 10+SLIDER_WIDTH, swidth-15-SLIDER_WIDTH, sheight-15-SLIDER_WIDTH, fui2); - consout = gwinGetConsoleStream(ghConsole); - - // Color up the console window - gwinSetColor(ghConsole, White); - gwinSetBgColor(ghConsole, Blue); - - // Assign the mouse and dials to the sliders. -#if GINPUT_NEED_MOUSE - gwinAttachSliderMouse(ghSliderH, 0); - gwinAttachSliderMouse(ghSliderV, 0); -#endif -#if GINPUT_NEED_DIAL - gwinAttachSliderDial(ghSliderV, 0); - gwinAttachSliderDial(ghSliderH, 1); -#endif - - // We want to listen for slider events - geventListenerInit(&gl); - geventAttachSource(&gl, gwinGetSliderSource(ghSliderH), 0); - geventAttachSource(&gl, gwinGetSliderSource(ghSliderV), 0); - - // Draw everything on the screen - gwinClear(ghConsole); - gwinSliderDraw(ghSliderH); - gwinSliderDraw(ghSliderV); - - while(1) { - // Get an Event - pe = geventEventWait(&gl, TIME_INFINITE); - - switch(pe->type) { - case GEVENT_GWIN_SLIDER: - pSliderEvent = (GEventGWinSlider *)pe; - chprintf(consout, "%c=%d\n", pSliderEvent->slider == ghSliderH ? 'H' : 'V', pSliderEvent->position); - break; - } - } - - return 0; -} diff --git a/demos/modules/gwin/slider/readme.txt b/demos/modules/gwin/slider/readme.txt deleted file mode 100644 index 02d733e9..00000000 --- a/demos/modules/gwin/slider/readme.txt +++ /dev/null @@ -1,6 +0,0 @@ -This demo supports input from both a mouse/touch and/or a dial input. -If your platform does not support one or the other, turn it off in -gfxconf.h - -Note that you will need to include the drivers into your project -makefile for whichever inputs you decide to use. diff --git a/demos/modules/gwin/slider/result_647x490.png b/demos/modules/gwin/slider/result_647x490.png deleted file mode 100644 index c7b12a93d71ab2999d901e11ec465f8fee424023..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 24141 zcmZsCcR-WZ_qVN8+9JUj6av%*DpO^IU5kQ(fb0;7W{i{$|IZi z@fDSoKQ;bd!Ox79@*SO@pU?lj$|r&EOWPYh$8WO5X+?Q%tNpKd^&n*D_Ewy^C#-mzgB36_&qi*wi6rEOEa<0W+E)DrTzQ=57t`im$_QyK2O zi04M!(mFz3a!N0%8`@S9SUZanPU!5i`e@XwRrhK-_#~wb`Ok24?vflRTTF5`U+Z5` zIwr5Xk2h-JsoMTVyEf@V!g-!Mp~vxSzVU9`G89$sd!%@dx2kGux|>E`U8%OZC1evh z;~MXoo5K2D#vYnNRcndxmI(J*3^zsHAhY_yZH?;^Ng@^&sXRjGv&tLmY});A8sIIG zadwbg&X`-pwwe_vhlicLb!}Bu#?)-7vow zn;Aa?&o}f6!B#}kPSq9;H(|^ojZOXfZ#S5hOV-N-Vl2m)e=p9>f5g!=5gB;zo`FNp zx45ENXqt9fi}m=@iUD%9Dx9Fq$EET zgXmDBy&4S4m7^L_R;#ZC*zvAKb%On=$VQaS)-owN-!qtppP01Nh~o2@<_d%t%U_;E zJetW4qq#Nw<&|(-*VwYPi_J7`st9)gg_OXaN`k@+`NOn3c{9;{I*VI$ zs?%Zh<7PtEE|GgCqjyL}CN~?m|Ok?}ls!Go<+rlP=$JL@zO*$=ac(q6e8ZKrj z2pJ^bR0b2bi|$78goH|7A^)S`AeYe;mnMQ*yAVi>$(q~Vh<40>B!Tf4+4$_HBEzF1 zC8#2Iu^D>3S^8W(CpwL|(P<|W^~98?-#xr&ExQmM-_?hx7qRHP7-(2ye8G0@8e$xj z!cR=Sh!vln^yOF`d+tK>9cUUT@igWDvL)-G^>*w>(ao}G837TzlKdEN3{F$wH@ zs&~1R6IY-pV&l;@^?5MPz7ZkuxRI<$^OI46SIW!lI&^>tbKdb19M2Hg$!(NzPv zE2@D!VQ~-Ze{z_9#WvJ+rnM#!)GCpeMJUS4Al%N&@PeSFNBesz{|K!7BS2i*5GR)} z2*^l$MYwRS=2o0=SA&yL&PBvodvs}poW`22oO*EY;P$t9j8NBRj!^d`Id5)b)|TQ` zA745rk(J;^!!I3RX`8*)?n|@I`1QaIlxr7yV)GQ+whYe(CjE}Z+Y4W}ti0K+6|CR4CW$OgwzG@4 z1{`NW-V(L4N`0+acdftYlx5q$?d(>w4et|3k*C~0^h8bi6i-fYcTl$0ZlczGxo^Fj z^F(tVMf5*I$+Y}YpWFBVH|w+`>soA7JnMyYOr`&D`>cn5{W?Y0FR;@#V~pZX`vo6$ z^MM0PLUyU*!}iLg)EUyv&efsFX?G!~iXqm35{g%Lj9TT?QK_A0h@;#V&G}w454~b# zl(~Zwa@2U5+S4RfR{N8US8L5?gEDFcWUWG~qss3Nw;0%LzA>lS&- zU3^R(w=HShx~^?Juq0#$+j-I;L~|ZBtjxJh#t~aZEc}Nqh^jlVmTq41iZxQ>%<9FM zN8eP>h;k=XMTMu7-YP_tFS(=d1`Tn@Jm5A{?ZKF)&5R*C$&(4E@Q8Ual}JP>U!DDC z8j2{3Mas3ZX-@W&W4O!V!vo$EQpDjcVe~8S*itRIR^!AEHMv?ErMe#d3dF{r3ow!_ zGpW>8nG3%WP+kI{O>|*ka+W0PTq0MVY)YD(>(G;VbG+m?1pfA@yoaM~DaTSybv!i` ze#gH$A)xJN;EXDj$$Zw`w z2s2e8DrqD14IKll`TwhsAoJ1Q~hE#GjhYohdWx zXSG&gGEidw4=TH{3r9IqY`uLp$4I<$)G>Y{&nQ{KR>!J`Mu{%)&PqiLW=+F_t%79q zTji{fR!gN#e>s->CNh80P7917TJs4|bqu5hZJOVNz0DxDT(cZg4>Ybc9@8QB=wUxJU4?~}yJG7EaZtlT`LT%kTa}{T zuY40PlvXqm?+)}j7hAo@|O5oQZ10sicg8Vf8JOd3y!UjVa zINn)*Ry(7Zk+h1WS$T;`YbFGr&&pGTy3Xv=9t?gt{IE1(_}J(=(p|3c-aEwV<@%|d zc5vfZ+DzwlTziXADz`U0?E@H|0Uj6JQgA4>>NmMqyb@41-w-$uWm_Lu8xj*7_({F` zo@#Zidg8rS3FeQ?(PqK3XPG}{fW125N8&>)62d0F4PgJ4_Q+l#AG;%sj+SZ_uxxC7 zTHxAM$1R!n0H-=Jhx-z@tHJZ{=X;mrCZ=x3zOL;amBT5bKUBwbt&c#3zPk~YWkLI2Fhv$r3L=f)qkXa zGHB5CFH>B+dJkxGWA0w(Iv$J%SD!&hMSg?a!Ze3?V!u|UCsBW%jFgDCl=F#CjSG-C z2WctkbRusV!o+mXuucwmg=hW7)M8V0Yz&GW%_e~pDj`_K%H7+fv6F86s>YrV-vwhy zV$2UMV~f@TYBT!T;wn1}sd~i=lGbBEwr}u{A=T4=AKNuzu7$H#*u=<8#85g%S*YuI z-RKpvca&uT)Uv#~kT+Y%lE0medSz{+%a`U{=(~CatKe~Z%j%<{*JGio;nryL0;v2# zKzwScf@;a5*yP?h-*rAhA?3Bqb>3aGXOC|#JwI0OL>;B|xBAUQsgdt()XPmz2YVN9 zJO0eQZ6-9}qva!BIv)ROT|$yo)yautA>4!Zg1c$Wowl9seQLNLyK{~0;VH11;JaAa z7Fdh!jOpg?&?)1(f-zKlYs+ms1eV*&0nP^7$QX;~>A$VEc}DZEo#q3l3HfBt3+YEz zo0-tw)xv)!k)=x?vchnfz-en!kACyj!p0f%h<>7AO)$Jw69pr2oc9_Iyq9on_%`=e zx~1&agI4d=qWDeMm+`x1>Anf~hSRQty$K?VMOxSz5p0d~RiCKD8Xxm#Yt8rZtK@6= zEs_r&J*p5p zPn(o8B-|xr6on)%pj_AQ-o7rDV3l?OZDbH+^pGR3Ce3_yA!F=~v|a3u{iz7)t{x8N z2W+7}!Jqxv!&BH0Q4z6P9)BAV+j*6f)m+-sg(5CmIt`G)nf>kk4Cn)bZg9 zY{?;0vE|UhCN`A5pphIdf#93NOj;Y{u)NHxzcsG+i|RTjdY}?D&;Ea~HP-ikK5yD<`+HFqmBUm;{ zL#xA7&MIrRt6T}kdKf8kfkIimNc|L%x?mB|!Fs!Bl@I{g7WVRw%HU3I?i8mstZDLj zvSIRw{yXmwza9lL;Ue79YKg7}erTu1$lBXFuTEA|m-r`V>7BKF-Dnx|IRgg|(amD~ z4UZv|^b5Pm)z{=MBbr^l(av1j=Sn{z@2#A8pG{MW$G8gR{J+_}3Em2vH0czSjC;Cv zM2k&lj;#oY>4es>?r_`69mvk&3t4uthr{Dk8QI7mLOU)rHds1ai*vj(bmL56!Gdb zYVLFI8ePl=>p?2sVn3NQ{m$mw@|%?1qyT!!_0wpZ!0eDr@t<4Wcugxc|Byciqto0_ zt|QMp1th}r!pb+=(I7Y^TEHT!e0|;|@z@jlke+y%w33kf(s`o1t+tde%mywWKV3pb z=|BDU{MhKR?ZVyX77G$-)5KPrjtSG~{Q0+qx@7g9LQb$BOw?k;A`o7tt&hdQPRs{< zHYn>beoz*dyO2|-p#k2Y=kqA3G`=`J|72lXO#ZIt-5?pUGfnIG$uLB4dl~$mdS#qb zNN3$b<=fa7{(gxb5pDR(u99G1@ZT%H^Z(48G{M%-{PT*fw3OE~f!o8r?*gN2O)bkC z3mRkG+b$uE6Yo8VuY*Mf5iLFxjsJ5CA#=f0=!!y)RCb81zz^3%_ldbSVULiTO;3co1sv``KOP%7&iqjzEv$s}yvr#2VIS=6D{#8t z@ie_(RSQnWqPqG}!erN`SDu@0E0-+verbWmS>B0F)3;m^krG#PTK2vzB`*FXJj#uy zcT}Rc4kpYcWm{l1yE9S*POuC!Er6Q%h@8L7&mK1y`Pq82RZojOX0lIu^6Lc-ThP7o zu@4)9;3Aa1p}kzHIt*m{sqTf6v1Lfvz$IiYibcPoHon;K3hY`1+SI4OHNLVT-i{w^ zsW2S4{bb-Y^Sw3u?Ap;!$Ed$Z8guubnP#GXqwVzdQ$L#e$^4|&8AITOT^R_az zimnO5YtRA@1-{a%O>f$?3VFfX%7^dbH(Z{~OT$tV1c(cq%yRXD1h|fmN09$7Uzxyv zw_w_T4fy3PR*t#m8QA*;|JLgo_S_mD&cGVBnhWMXK?iZqOHpdF>Wrn-gw_@y2F_F`xmt19DO36_#TBTZ* zsTOrjLqsdQkrAKX!bziMb0Pg*a+>jEM>AbM%49-4hy_OMLwcm*0S7m^WC{R z5UYMgcgrw@G!M?LS%>}WKrXB<`5a(}MsXS&43;0kfBtLrNkGff1=$MpMKX<(Efq(S zoG-&_mj+bETK!RxK&)M~W3G-0K|dIF34u1?W2S~4h$bQM`JJ-)EAJNmtw1ZnPgXo~ zxdTCS7)DkQN9LJgct?lsxFoVyy`T|<_yqiQ_0Q*)2pd{%jtAm|hR$LMx*pe^+{071 zZmEP$ssnFpmj90@kFzsh@w;Y?z@dFpYD$oY>DgGErI?*!^YCQ z4*xjY;-{1DIRoYDStx`Uti-(+RHU4Rp6|}&^eFM1wHN3w?yR%#-4ca~I*ju)>*I`W zv*op~`euocd(TCS`IM*b6n62yiWD2x&%D4KZr$^7Ji5p%Y(fAA1fRTap~fDoon=vj z{J|h0c!mUXgw@2BZ?u?Yd}>p4&X?O3HlwT44N;QX5}k9FF`~+ylg*vk#%wk%qgTaH zzTjM=oRryK>+Xp_gHlA2*ur3PoQJse!ZQ^~N5>Z+ZiBorOz+IMQ%T&7Hb82k$TR1Os2_fFKlv5%r2cv4; z`0UI;)o!HN0t;j}PUR*Cn!A$*$CRMz@8tC3jI&AyB=gNnb?k>S#$!rtH&PJ>)yS-H zL|8p^=Z^84wB23h5j5Zyq|J))IPZAV*#b&cVvrTF{qlhOw|rdRQZr7_ zPTKj=EbCnF0N$g-y_Cd?gJ<`ZD>tI&x(dmtgt@*PZ4ZzYc_+!hXFXZWAl44|x!)#u z6Xn5=>N7n(0;;zwt+ym*Fb~)y)=)mVAqw0cXT?>M0|ZPP$;I`~5i+<+GIB`M^^OO& zsXW~aNtK#3ecp-Cx6I?11>h{avg!6@$=Ip{0$tkL(}>{x{W5NVIW~v-vn4j?cFTmR z+kj^mVGBJ#xIBMRBnTeymdb2o%Hd{H$~hOpgM@WA$Yr-?OOT+l0s(0X$}AJL-G zPR4w#^Fd{>-EjUFu7yBw5=T&Mko3+hD88-YXnhIw{Y@Bekacr)l0nhhOPvLYZ0$r`v*9ziaW#w2}9$eqCLen^|^cK;UmzpkCwScI%i42|hv7 z@*-J_xCzO|QGS=6x{d9P6$r-)(frDjQbI1@QxDU%{-5jTF~+(MYrRi6X}ob95fmMcp>7c{;q z?XyoRy7IX9+&Mg4x%rld(aS#jS%>%WLb2ysTKMu^cE#;s!j%Z3BeCA79(S&^xer$) zR>;{;b#B9D$@3yMCC`oFO8(|7T^Zc4Ct`zM*`u>a=H-pf5%_v|Fam8)tepBA5z3TA zOo`(jJTA`D5EzW8ENFCW%*#jeT_Pf!W8gSMFiEKAJ`833id1uIK40G^xV0k(=iT?T zu{4HrbI!YOcXKw#(8rN;={a$n*?uhAOR=~qh_yiYp?*cb(OZYW9Rs(y0Hix@p*7vE zdHDuBCtFGTdeZAKZaCY zE|b>6JVt9Fp2sZSUVT4c+R$~E3i8=%d1d z4cU6ty9#v%p-0$rQ)N z`tG;)q-46@A+%P+QcJk3dX(10trI;s^Z(PAeWR45(3z&0l)>vIej0BZ>hG>osDo1&B@to??@qc)`^QBsoS#4}^w zTxf&8>@QSqe`qE4_pG(x=FvCdXB^WiS4dCo-NXgUJki_Fu)+5(eb^{4Cwaxcl&ZlC z0Fv?yrf^#YQ;w97H>(DuDX|7?-aXQ1^jQrkb9v!1@j8w3+gMxa`-G*^8%>F$QvpObD3gTVHZ0 z!pGBRrQT&YDH!g&dv0*eN{ZCWKQm;3aB=9wWeyhy&WKxcBGpXO!se~Jl+YaF!I0qC z9UlsDe8;FUT`~8q2^KqFad*p2z5V9er!AC3`-+cvPn><}NW21dg^0)=E(@GTj23r$ zQKi`yyenJh9jK99uB%9ywkkZAUHb>BoZ3`kIA`~JYA|c*d@_b8o#7WmzI}P%*xb#k zE>l%qQBUbquTm(fJ72zw5Yhg=C-_%b^|KsaRtb~@Yd>xIUpVyzfXICmUbDus@psP) zB4)tt?@fChN|#1naTvu)Xp(3B5){xg{VX)&?XW4da?=IK)tAA%4Dq zymCp(Xt)5-{aOk6>;-g<42ZRFjPm$f#f#ZMqcw+jy_5DaFhQeLs)B>l3*L%p`~t?R z{GMGyM-CW6eABg2J0C6S6W!2rBQH7m3UCwS>}A2fNe+C5=TmbB6O(z5qk6u%X=c)SczV)kp0mS+N!6;)pHm4|uKa+UKu&((l$x&9ed{+SV8S0&?6Uo^S=M;10e`rX zaf#xC`P(cc?u0k#hLR(|^CSO6Y_3IdfZ{ajX1v%7ENWgGthpIV+~%G3^G`Vq0w(&~7Q=iH zvhF&jVi4_#x-li2c6<)c!^U=(apfzJljUzYQRjE{=XU~|(Q|!BB=8DHQA0rxH+jkM zTak4UF1D*ICoOE%Dx!zo0qKe;=Qs`e1C)0fy<0ai{}b~Bup?c<_-OvUyq`jZZbjw` z=t@W}hjnE;@tLcYK>0nqKK}G+M0<38xNlJA@dwC}BVTRG3?aCg+xLlT@tw)=d(l;C zpGWgGmCe9V=t|$ zOBJai$aT!qH3z$SuKdUQ8z;)dWy397ttS#MHA~td`##lEZ;ICA8Dw_`cfZr8AoI+4)1rFqZ5abPsRpmqd0 zx)}VwtDzwOW^emW7GEp9k6ku|psawh+J(Vwj+ja&{z$+u3|S(u1l6OVE^nt|!zb9R zt$#wUPa^+k=Tf}9vtP@d42-mr&+%j+H^af0GpnTa_OvG2o)m-&rG1k$s|Ij4l5OPAnn30fp3yhHlB1|BqZr{Gebx zNN%aH^Xq75D+Dq!$yRBF)ZlaNf7Oer9Z|;;0>OT&8bzvzH!@chd&4h+b|2C0hIAC% z^wW_exqgkcCTduMDHsFeKM|L#C{^0No*_|@YxwG)qb~_rpZ@m@2&C)asAG(8VrW+t z3>KImrrsOI`~R*vq6xL7|Ib-~?xh+GGB3d2WyFRNa4+uu z$LAzwy_I>Ms60uxQsp-E60LUBF`;&(8fX@xk&#aQ&|l~dRa-yeeFjTt+>Mdn^T3kj zjIX^7f}j|*ZPHTbQ)fi^CvI~0-bqANKs}3{bRUV zd1v)@BoMOj^C4YxUvwJcXJmhoTI!typ8io)Asd=aD4#5*S|#>yIwAWqQVP=^wuwf( zBHZy4ei1msS>BItzVwN|FCy8Ome_EvdSUt%{1 zkhF05i)WAh<;dLS&NRzbU~|{Fwm`Fey!uS4@tv>Xz6OQF+L1E?VKQzXjb%YEuD35e zt{5x?-cb8u*o4!A*LL`olR+8&5i@$rcXUxnbE`}_Vpo^G(62%@1aCGBPsRfbcvln| zY4y}{mv1zUFD_w98jykGiWL8P$?|BNZ-}u#eeKBj?jKjxr?#bbgccw>SF#ib%A1VN91)dl{qLb?o23CeGzij7x@@cJ+IFb5w zy=JDPAVPJCu}N-k%rRtHb1-2y-r@dl^oN%sclyWZ>tKdWWSFkb>a|NCT7&}b+dM%= zl1CT)c8BP);CGsS8WE2w|333L&#cvm1md#*Fmq6n+A@-G9z#tKFYnwr_aPF{G)W~w z3II8}WP2#SW}Gc@Y29hRUw+MH-EF8ZF-EEBHI8w7Z+sCn7Qve8LxlpCy)=T>o1A>@ zBD@eA&dCR?+gBJ>$YVC^le@VPNZ?b^m6Y45QWoNa?ytKPWk#0sP-SLiQ@A42@h+pV zt`b_sGxE3G4N%~ zG0iQv|71YkylT4;m(kNs3bxP)}=7=N|4(i2%|X{j!jcQoE`+25b#zm1rd4f^7yr zEzyQg`wS`e_xYUqa2B$wdrb3Pr(oP@1aM?JR4|V^PQ?G*Tnwz-R}oeCw2&evzO{k; z6<9Bez8)P;^#M3-<7fVqjDgiw%Py#GowVCz1&*j2H*9hT(ozVGHGR#FJ2Coi9s@VT zYY5MwvG~@}wktAQ#wRf!zJcmE@vd75$m!MAcp#S3ZI`N7V@8&RpZ$$+A5wt^743X8 z=3@$#I*(o*UGljSd76_owNU_YYQ|jGlbB6rk=`q!cIUQVyxHA817J<$;D@rLp{2W> zVd1-q3>O4MRSq3I<1q>7Ft~VQWvp#yg$F$#$M@rEJv-CNLlSmoNNCIGqQljlf#IB3 zD}TA|j`8RFPACYvyZ||l>`RW@JUO>JPxsTB!IVa0cW673E@;AnFdN2005qw8UNQvQ z6c07({paiK%FjO-Q~VS_lv3}n2%MPYc0{i0t$gmCglo>^abhA=cjxxKf>QvrrVkO! zhXSEjdg!nI(7M@yj$U5KqGH`eK*YH`H3UhS(ClqXZ1L3NJ9jlgK?0)o%l|aijc{LX z4+Mny-Y0z6BrZX@=fmJ70V#u%AziDl7=eDm@1LWtlP7_o!wjr0!>7Ru`XU|%br+?15{Xj($r$c=M z!4gjY#&maxOfWTa-b#irPt9Y8*?P| zPH&hp1mpA1WW1T(q`+Wm|M zol%*e^HF#=-LWzjft3TMzI6q>2K}@!2nMll7J9j!=P$o^0QdvptCCzzX9WJUuO8l) zgrBkUXEsWf%WD3F7+F_zEbFp!@Y7978VE`^K`Sds$i6a7Y|UNB&gBozdt1VDLe(67NS2@ENo z^%;=69C(}TetpOxQL1`G3mW&-ZYpTa3SVRSHAoia}^x)#0T+YC_omZc>zfPYtn5=)Vf!G z77gjie~=Y+%dO-!*L2@Qea%7__(lyC%_kM1s%yaW-Bd$Sq!Rnhi!9Chi5Gb?+Cv52 zh`LneW-U(ECT;`k{higake?cSZ&(5%X&t7)lUod(>(CfWRcWJ~Q{sXA$siEEfS6EI zNr9EY*G=n=r>Gg{CG(J;AoU8gfV2m2<3II)V4dmYgXl*qMXjK1o1VkL7!nKyuoyq3 zlrumk1)%ZAj{w}t9Jks`lm?{t@Qg0R1=*+2-^qxCfK|@D0wUq2YlwyYm)`8=4JDg_ zB*YbvvX)>dkShUreG=@Ak?EJy-&A9p?!|8yJboQbd0FjrpRq##so@D~dl(VT9nzJZ zRy%THlnxGC065(ILm$KJUrclMzN=AW#MtrDSF|2b6yxN((NR~m^)gw}qof2HoBmpx zVW0r{%MPv`L1GCx8ylw{1XJzVu!O?jm`-8#_1!F4d34p~1DU9}hIM1%B z9kIp|yuf}fwNU;$jJ?GUn*bauz62`$#AFJffc*+%gWSoBw&sBJ{{_x{3`>v(mUDBH zoF2_r57uFytiI@5qXW>(UnOb?$Mql+Fi3nM0H9pcJsSF*JbI92%6~xA_a_!W0YVXw zuyhdM23B*$OBL}8-@nRWb`u8YC(5Co>B_gwRU3O;&M99#(CQsXg>b;9kr!$P5LF}+ zNUV=AWCj4LG7id5gF{eurvnMUGbBc51@$IOSi%>^$93Ri?Z{Cw2MiL_St1^OANuz` z0#re(^5B;P<0DgS8_&=s20&&c8wOo!^H%-LEf*CD#!CQ@SsBf5kuT+waZ1j;?je6* zOB18{`T38^%gawa(4NoDdZRvFk$Qq*1Az6rA@w$Ltspx&BKsq7F;Lz`x{3V-*zzBs z)_56?5G~5QJGaMwd8q>R%%Fu__NDar9kb2ugF=3MK zWx0Iy;>o~dI%771^tgTnr&t(3hW1QsZ_IsNCnbf(rdS4dv4rhg2mrqB&GR}6)N5hs8axLAUy*H?md+=@NK>b#EL}@NF!?Zr^cMMi(b6C`m}YD28eQ;#1{te@(69*6J1b)*fSIip!5XZY5fzEkO8DcH-~8->iBnt zA(9W`WZmv*h6_9*W9EM_;W=9EY&7mk;*3Zc?}52GB{;2DLg#iUu;}WiAv0oC;s?(F zx1L;Eu&SG>&Fr13J~$F!`bKj2vvhJ)kzI=Tu-Nf4Z&&ORaX-wjJ1S*0SoI~-S+V)h_@?bRCc!$Zz= zEeU}Zd@_COnquEBi|eW!sFrTCicnV$PesezhN6=8=Aj}7DN>nrI& zwG#m?OfBatsB&a=l<-|Su-GN!)D=?CG~kG@GdfD_4_Og_<0ac(?6PhFO5ObQisgS% z*bV8b8RPLLb;Ci+K(WL&(I$gu<0>J7;W19ZN6ehbR;R z<-b7_0A= zcE&-0YD;;mgfmj_(W8^UeM){^!Z*!}CG0Bh$8wj(9AcDWhrKc%O0(mp$$--bDNWI=hn|Cx0DI@FmT z#K#ao?Q?ntT45}}2&1+B!zS}ipchbQhUY#3(lj}ctxi|4wfqKyO|$_utCxg7PKGM= zWMn6FY@D9y;jB{rKbql6PkYmJ0vXtm_B6e zSb}7rgC?!))D89WhljrLDKX{}QZKKcv*9yW#sLKbwoQ8Dthpi;cGEjqNn0T1zyz

t1Xie$&AcMsDaI1TbiJ=M*?4m?QUen9`wm zF<%)b^okI}h|*6!&|}-ISoyu_ErSa{Qg$AQK3GBwHy%!?4}Nrg=MSLn^2fI=5Qi1g zRaO?{;NTRY@GU@NdgjOYyfE)tqo8sj>FJMNWy~knhEKeeW;tC~aqb6?=b$1|v-SHk zU7f~%kQz^`m@YMTDbv}u`_MR$yQj96u1D66T)`5e85^K8M6Z^M^rw#ufml;-B1LBs^qki2ZSBa$IsU|<_mfDGMju?ovEl07uO(>x;3ywJ7yTas3V0nm;5&JF-l|VYHIgXcFMm z`*c=TPo8i~0K|8QWp{JsrgRlp-_Q?pIOGTY>9~%%lq@aLY8YM7d)!;6vqGt{<8@I)s{>G=)L{(nr2>4zy7#V|YH0cI!Ns2Fm;dbkY|OW!E(VC$gt3@5cXp-;7?Z+K z?Y|5bV#BI~tuqnbPhzma^5R#uebS>f_Q2yk9hEt>bZ7ds!g5vj*|s-CtQgw#6sdQZ z@{cWsumd4%FHHm}IWP$ah3rL`1V##CWuTeSZ+!#)UA|jTJ1~}D@Lgl|CiEVm^$q#` zumt2ScKXWJXZS(3hhy_`I6J1qpjX{MwW6VCUkv}rrZY9S*3dn^H<1Ayvn4r}$j_6E zv+oHk&`VxPqWa>001Yrv)mh1cyw0ENe8_%G z2Fxyk{_q+P0EX4FdG>t!7)Hk=*_ zKVu%#t5<+}hbDodt6n_g)quSLs z8PJMU0ApXcEzo5Kf(S6ab0JWEFCNV?@@b>FIC+L;0w1xvC+) zrp|_?KiqejAEci;tj&81rS$cQFAK+{N6t|~W zXw;`0f>g-8}p3@DI?7Klf-Q3xifNeAyrP z9oX)fO>vC*p1JHn)j)F+x4EWYa3P%$0VZb%iI?+{y>uE=5?w3%OXcxBuw{Vqc~37R z>uOng{ggoi@)gEr0Fch?=-xMP28)~t*3z`;5ylcU4!C&arr%jM-^rFZY^@0)696=Y zeH99V;OCEjC#!6jdtl#t_wE5RmK@Ke1gWS`XYR`oOlOVF$F;-6Q0E!02vie}A@%h1 z7{wQQo9NzX+q?X?Z~r*`@<9n#A+!mSdW-R8dibaxd9i1Ibn3Pyfq6BS{~bGyAtMtK zxB&(~z^YRUeOLnh#_?Z4hz@_RXQZ{{r@-L`tl7r>bD%G-XT9q_6Z1&GJG1|6$v7x`n5@<=l#wyrv z3c|&8gbvvQkYjAYAw%tRJb_Iuk9^q=Q%E+<1{h=668q|xCmkdK`}XwT2-*cY8wZX9 zu>H<7H6Wpxj@K!*)oS@wI}?8Kkf)61d(TRVNLnV}V8q9ZKuFtsadvIPPY_55JcvUG zBvdJER_jpC_Z%wiGNT3LinboX3Ti<1bNygBAky(p58)`LNIi*zQRS1EH3LWx!$AK6 zYEE(>BFO;>RS28?E>SkjT8Yn}raYFJPw_Vn*$o?p)!FWC({)qr6r;n;7E8cXh-gd{ zBQu{ml^mQFKo(4;XnUV^f2O-K<%e-acQMVL6IcSw_E2UE)M92x563JlvIY?Q`T%d( zj}OJo`jy0?bFcm@#WEPv2plorl^z?C`DpfV)D0%+pzn_5^BfAD zmW@QwryqYM=_Pp{CdMP2%?{n4mk8R`^lM!VBd3?yumocCQ1+>Qf_AQZ{}1CZ_TJ7# z95KCYvPae_r4 za01l+S?$PlXPPOX#JKyA@Qm+8&k%?EuWA!RwMs*3N6MTTsJ;p`iM?|?JMd2DUlHmU zb^Y0v(hpbh zof!A0;(SMr1GIP{`(5H?O=m*jp_BxGz`-eiw!!$UKQEqz>&^pB)qP9IR+|HE2b~bF z1o-`$0*fm5yV(ZAgoA)i3EaNZpuQaqUPejmWa^tkkO7#7+Bg0=>P#a!z@+ zJ`s%RH9pi2V#$X#0aCOF`YK`h(5+Vtf^-~6%*~LIKzF*~W7~rp`q!xrpp6os&qmKQ z!tIcHkCCne9~T3F7^dAYW4W&>{+IG>en2S-E<;rp+uENGWG4O5Ra9`+x%Xt)zLO`y(0I-UQ39PxAPm9KKDyrVY&`b6`(5# z_?x*cX^#h=WoGc23ImC4>43cy5FnRTP=5XLZ0}J94fY4_mux|^^%Ue-N}yFc(FgkY z&M;TT@?Qh8FIlEADj@$Qj9T4OK;vqUG%|>KW6w86I=V-fstSzmv3&U|pHDvrka^t! zW9ZG5C29lvOf{?=GMsZ_4;#y&TO^=qHlwTEFlADa_!s@=+{j38dvw z2gU}_rdc3sY*f(GIf1@G`@BwIEYxt^Hca^-x&yV)l>(y3(~e)m z@(!tdsC!;4FnX^+1SB9kd11uC%n*q^p#iN&pb)90wF-j_b!_pla3>@_{cc!5WzERQ z=&lB-&gG4)AUq{&S>hnk66MOw=xP!P%WOK-kJ8CC2L5aUlX2JgP!&!OU^Am*i*-c6 zfnT158}A%)V8Ff##dX`hj>x;f%V&S6G&Oed<$bsy5453Y4+--Zr0ZpR+<3$fRBr$- z8Y2M0umU$|8Om`42+#-aWUaP;PXX(>?KEEmJc?2Bd83lzapStVmVa*Edt<);k{x=z zq{d&PE;;?~J%&Q|Y7R5<+M@hUkxE(k(+81FZ>c(yUD6^lH}6o3ZphU^o8^Mc!(Q$E8WV%(HT32I z7t{V?Fw=OTj>@4Scn0IyvVRERv>usOi`N)i1r*0z4cmAE3CCAHy#mU^hcJ>fI{X{a zT1@(-_^cP{wH@Fd%l8KPP+nN$pnm(PH-a zv^eOYmm7n=EBD`R3@HZVmqH5)f*gvV5R?7na}Ps2u(czOSi;kNv;|nS3XtDkufXx| zi}+sk#aenVR`^oJLpYY;j3w-GZo1k>+kjpY4AS#|JzR@B)M*>uuU*M1va6;rRJ)s6 z#g>vWh6-srjBJTwFv%%%Xbdx?85`9&MXF75Oi3FtPV*baVdXF^hKM=*W{jE~XMQ7O zw8rqw?q1*b54_j)ywCk!@AKTxbKm7JTEbnT@!|hZvW$8DmUc${KR9cddZi5a4}>nY z|3k;z`?pZ|yG2u0{MJ|Cyy|QAuoQl$Rlf4}@3{Ub*q+onDrtQ-7i|@GyuKZ~_3yI_ z*|XY@>fe^Q`=3gq{q%M1+-ei?_ZLrE8PiMu211gxW5+-(99>fg?AKJQRm&ghwX1wz zEF%)^*MINTSX$+@I%``SSCx0-+^#40Hk~fM_oG+cgA?BSyiS&;?e^{6{WNmu&&QE3 zeM%Fqi2X2!BwilWk$8qVZu!^8wfN^;j^lFzjq|dP+&Dx%9DqW-XwLtcj_%vpT)5Kp z<&LEdCNJn;>SkX?nho&{7Gt+xXe=;&VcyqJNbqnj;n4~_OGY$9PePqhBTp-)w9Y<` zuPCS``D}jQbh4ApWEZ__dg)ZvHAkWhip*zOd_>r83n?VU7eVxo@eETryZhRRW6)Ce z$n$P;*A*gP`jY>}LHSCq36*wi19Fj{=-~u^Qq=-hl?ke! z-GQz+6Ft;*1zLNLi2M|ZZlj_hzwg+>Rp*?k5$BiSpdC-sgOxuZ=J z^k#?m7M#&pvKq#P(_6lp(8)Nm&BrOGK@ubyG!F$fL{~!WYCIptj~B6K z%~=}G!Ztxug8b`pJ|-VD)REr>sr5AO40~bMbHEo!(4^?8EHOdqd!0?KghbGp4Qbx1 zW?1SGmQ5wNS*ViW$?6{f4R_d^`j>KPseZwhm0k~i81|%^CPp7%7x=i(x~E9#5{H;6 z)wfsWrM^^2y_wJgbTAj5$I)h#`SUoX>W%U`KtljhsjXeN934n#sJfan$LGUDO7zvLEu9;INS3O*I|t?x=rwHERL0DFPQtAHl9Jl63rk)@W7(Dq?H&bI(WhPx?C%vEC=M>(P4j!a zzoR%JhIRjmkx}cxfwZozuk;4F5hAV7xjHQUVcEs9T5$LZ_XgY{YUwU|bMD)zB3p;J z?cTAluOGxe=^UR>e2&dS#BcwTaFc9j=Nzp}KpSKFD--k`?os_2yvH<*Z6XmNZch(CXFG5^gs)jb9k_IFFXv__Gthq?;-XQXr-44NM2W8AVgjUX&4l@?guyd(VTK%eRotp!0F_k=dD$~G0J7BnsZbw{r zrr~Mz$+mGBpe81n#)TX$S!qZ!#Ej1kRU5fPNK=}pCWh)q+gF_7eytBtHc!_eBIZst z?f$97vW(NZ>fI8IId?9~^P}aW5k=}YVvvFIhgrDz>aJ-?S#|%qT%Ajj2i+jaL(7xP z=2>ud^hyjiiat;YjXukx|9+OWJSAWUqHGRiE{K;eI0p&Zo$2YEzC<-@qj^v7krk&92VHMdc{9j1f)ywM-^?;Zl1E%U$P@7D=yxCL<{j{IVtLo0ThF(3z^QX- z$kj3gd8=}N?%DAHO}8f)5AQ;Ss_&7tFxCivCuh<+oB$$I(?SQm;WZj?J93o?Rfy-f zIE5Z3tuuHlAdOVF+Gbr#17M%S|ZuDWHra{uODi zXie0_Fco^_HZ!JN5X7$?EGMTzFuPoK;Q}{E!9+GqebB*I&r^i^)ey_P3cUU{|2uK; zSAfkZA%pX(1&S8qH>j}5`AG3n*17qW>BuVx!(r`SLc~knceP%CCtmXQSvn#7qBnrL z=m9uiyRVG-6e4+}*enq$>`?vV{DL5G5xvs*Bh8Nj3^Dx!L9m+X2NJAm6kmyq0`55D#EGNIbyQupg;Q06z)(H2Yd?Ye zFcd93Mr%_X0((yA*TgbX50Kn5j}d#kMfKGt4bwGEzSoXQAI*5@4tSLEu5^m77ZZOR z5I}B^tAOKVT+by?uYx52FJ)DOMWM|?(`rkea!o3>dJxxV)6WvG!6SSNdrS0dX3yQQ z%iY7=v@<}S&Nb`iUz`YQ8aAs8tPR7&?vm~p>KdHW#9n0CI0RtNU+gb;Fdj4D+En-S zE>0XPvwu`NRf~PuOQiZklxdKNW>d~)D+QvHBRWlQs)0;J?FP>t=~q6 zBg=W~1r8Q{jgyY%5l88FA(c5tnUZp!WA` zyh{q{o+_GO z$qZDiy5)l~%#M|1SH7tjmRvMjpy&EL-cbj91%^nP<{ltI#4CKr#V|W@XO)ee>KsAN z!TCNI246>HbmuQ#-n#=|rGIsTLt~mwSaUJ?Q2lpkQ^14O{@nyeQ{y`f0bj-imDI_} z6Pz(Ibd?Ka*M=lRXU0W3=vsMCm1$PxNfQ?4gk*bh_NTmoT^yz!Wn?|as9A)^5RlIf zvRp)$otb+hh4M&efFrTqfw^0+xet0^Op-F~%QS(f-5f7_e!jYQsQRad-$`%@&NC*$ zHud%Rp()*M{GJ%p+=DgtRmBqC}YN z;{%i{7ti0C>>?xJHZrUy#bRiqgh%H5_Aw;RtC9DbSPa=``K+^c3fp50v#6D6^9ELy zSLIDzD^;I9-wOuGGE4y56_55OGHqSC6kTyQ16+H(lMR<&11qg-J9Ef|$L~`&g)g&q z+^Jk=*3@)(Dx~f9jyqyp34ZS{tXE!VgRtyQ%4;ifYRwz#Rwzo#J0rnBhTJtBM7JTr zR5`Se3cVr{Lr6es^^=0fS;Q7BZ#-f?`#L_Qv)b|p@{bNw?xBL->aim6yIzW@eXM6~ zYRiTaGCruQHn_->J*YUS+k+*Gzrx0J_?eKC6K14F@!7MaEfz^IsaG0wSt47^N^$Y+ zciT?-EIp``QH(OqREtOqNq9>T+__FhkjngvIo>l$z$BBZ(?b9QASO+02U79THaL91 z#5fYVHEWKHZzieRWGrR!tFwl5?^Lo--Hy83j&w-&du)Ta*@ zg)LFr7=p1&ib!j?dWQYWmJa=L+ZCszjMjL&joB-8UHAfmujXXO6O6##cU$XPgX(Rk z4u)?|nF@J;IkSnD&lraO>xaNgx*Uum%0aK@;&2j28T-lL zU>LdiB9$0Bo96;!Bv$JNe8Xtga&s1pOeAl3=A^72GNu*){ndFNLcj~7>QMscUy~Z$q};-&ViK`qeUh52EL47 zDW{YZxYLw}){0?}7nR*O?H^ddo)B0mx2pFTQ{96|f98j6L<55%V61-ng;Sy`CA@Xp zdPzF}R$*K%ykX9O(gYLoKKS$)k?lKlWdEs_QXH~Guxh>{SqKTzt(cY}#8X!tncbBe z$rMxAO?6u8(Z%$4MzYr*pXt5+$Y%Y+^-@nC!{GZ zE@ms#(^*bUSvlfZ71K?1q=m!a-U0b_nz#O7A5=->n``}+z;70d1dZ%ywJR)>aADE( zZl{%6;MAEcwb2o$^1Dguz1&9jhBX5a7Y(XN18f+_`m^hQJZe%(=^nS5l5 zPLAwgPwKNj>$BH2h;P>-ItvBl!njn7j9vQy2c z2?d|C(p)$j&R!zfi`RBAu(u`s$IV2s)&>*c9iJ-z{x?ZdtsUV$YCEph!hVDj=TFMq s;>cjjYb|z1=15G#S2zsVr`0cu&w3h-`o{9LZQ2( Date: Sun, 7 Jul 2013 19:42:22 +1000 Subject: [PATCH 34/38] Add missing file to GDISP image demo --- demos/modules/gdisp/gdisp_images/test-pal8.h | 587 +++++++++++++++++++ 1 file changed, 587 insertions(+) create mode 100644 demos/modules/gdisp/gdisp_images/test-pal8.h diff --git a/demos/modules/gdisp/gdisp_images/test-pal8.h b/demos/modules/gdisp/gdisp_images/test-pal8.h new file mode 100644 index 00000000..9d1d7e0f --- /dev/null +++ b/demos/modules/gdisp/gdisp_images/test-pal8.h @@ -0,0 +1,587 @@ +/** + * This file was generated from "test-pal8.bmp" using... + * + * file2c -cs test-pal8.bmp test-pal8.h + * + */ +static const unsigned char test_pal8[] = { + 0x42, 0x4D, 0x26, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x26, 0x04, 0x00, 0x00, 0x28, 0x00, + 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x13, 0x0B, 0x00, 0x00, 0x13, 0x0B, 0x00, 0x00, 0xFC, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, + 0x66, 0x00, 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0xCC, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x2B, + 0x00, 0x00, 0x00, 0x2B, 0x33, 0x00, 0x00, 0x2B, 0x66, 0x00, 0x00, 0x2B, 0x99, 0x00, 0x00, 0x2B, + 0xCC, 0x00, 0x00, 0x2B, 0xFF, 0x00, 0x00, 0x55, 0x00, 0x00, 0x00, 0x55, 0x33, 0x00, 0x00, 0x55, + 0x66, 0x00, 0x00, 0x55, 0x99, 0x00, 0x00, 0x55, 0xCC, 0x00, 0x00, 0x55, 0xFF, 0x00, 0x00, 0x80, + 0x00, 0x00, 0x00, 0x80, 0x33, 0x00, 0x00, 0x80, 0x66, 0x00, 0x00, 0x80, 0x99, 0x00, 0x00, 0x80, + 0xCC, 0x00, 0x00, 0x80, 0xFF, 0x00, 0x00, 0xAA, 0x00, 0x00, 0x00, 0xAA, 0x33, 0x00, 0x00, 0xAA, + 0x66, 0x00, 0x00, 0xAA, 0x99, 0x00, 0x00, 0xAA, 0xCC, 0x00, 0x00, 0xAA, 0xFF, 0x00, 0x00, 0xD5, + 0x00, 0x00, 0x00, 0xD5, 0x33, 0x00, 0x00, 0xD5, 0x66, 0x00, 0x00, 0xD5, 0x99, 0x00, 0x00, 0xD5, + 0xCC, 0x00, 0x00, 0xD5, 0xFF, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0xFF, 0x33, 0x00, 0x00, 0xFF, + 0x66, 0x00, 0x00, 0xFF, 0x99, 0x00, 0x00, 0xFF, 0xCC, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x33, 0x00, + 0x00, 0x00, 0x33, 0x00, 0x33, 0x00, 0x33, 0x00, 0x66, 0x00, 0x33, 0x00, 0x99, 0x00, 0x33, 0x00, + 0xCC, 0x00, 0x33, 0x00, 0xFF, 0x00, 0x33, 0x2B, 0x00, 0x00, 0x33, 0x2B, 0x33, 0x00, 0x33, 0x2B, + 0x66, 0x00, 0x33, 0x2B, 0x99, 0x00, 0x33, 0x2B, 0xCC, 0x00, 0x33, 0x2B, 0xFF, 0x00, 0x33, 0x55, + 0x00, 0x00, 0x33, 0x55, 0x33, 0x00, 0x33, 0x55, 0x66, 0x00, 0x33, 0x55, 0x99, 0x00, 0x33, 0x55, + 0xCC, 0x00, 0x33, 0x55, 0xFF, 0x00, 0x33, 0x80, 0x00, 0x00, 0x33, 0x80, 0x33, 0x00, 0x33, 0x80, + 0x66, 0x00, 0x33, 0x80, 0x99, 0x00, 0x33, 0x80, 0xCC, 0x00, 0x33, 0x80, 0xFF, 0x00, 0x33, 0xAA, + 0x00, 0x00, 0x33, 0xAA, 0x33, 0x00, 0x33, 0xAA, 0x66, 0x00, 0x33, 0xAA, 0x99, 0x00, 0x33, 0xAA, + 0xCC, 0x00, 0x33, 0xAA, 0xFF, 0x00, 0x33, 0xD5, 0x00, 0x00, 0x33, 0xD5, 0x33, 0x00, 0x33, 0xD5, + 0x66, 0x00, 0x33, 0xD5, 0x99, 0x00, 0x33, 0xD5, 0xCC, 0x00, 0x33, 0xD5, 0xFF, 0x00, 0x33, 0xFF, + 0x00, 0x00, 0x33, 0xFF, 0x33, 0x00, 0x33, 0xFF, 0x66, 0x00, 0x33, 0xFF, 0x99, 0x00, 0x33, 0xFF, + 0xCC, 0x00, 0x33, 0xFF, 0xFF, 0x00, 0x66, 0x00, 0x00, 0x00, 0x66, 0x00, 0x33, 0x00, 0x66, 0x00, + 0x66, 0x00, 0x66, 0x00, 0x99, 0x00, 0x66, 0x00, 0xCC, 0x00, 0x66, 0x00, 0xFF, 0x00, 0x66, 0x2B, + 0x00, 0x00, 0x66, 0x2B, 0x33, 0x00, 0x66, 0x2B, 0x66, 0x00, 0x66, 0x2B, 0x99, 0x00, 0x66, 0x2B, + 0xCC, 0x00, 0x66, 0x2B, 0xFF, 0x00, 0x66, 0x55, 0x00, 0x00, 0x66, 0x55, 0x33, 0x00, 0x66, 0x55, + 0x66, 0x00, 0x66, 0x55, 0x99, 0x00, 0x66, 0x55, 0xCC, 0x00, 0x66, 0x55, 0xFF, 0x00, 0x66, 0x80, + 0x00, 0x00, 0x66, 0x80, 0x33, 0x00, 0x66, 0x80, 0x66, 0x00, 0x66, 0x80, 0x99, 0x00, 0x66, 0x80, + 0xCC, 0x00, 0x66, 0x80, 0xFF, 0x00, 0x66, 0xAA, 0x00, 0x00, 0x66, 0xAA, 0x33, 0x00, 0x66, 0xAA, + 0x66, 0x00, 0x66, 0xAA, 0x99, 0x00, 0x66, 0xAA, 0xCC, 0x00, 0x66, 0xAA, 0xFF, 0x00, 0x66, 0xD5, + 0x00, 0x00, 0x66, 0xD5, 0x33, 0x00, 0x66, 0xD5, 0x66, 0x00, 0x66, 0xD5, 0x99, 0x00, 0x66, 0xD5, + 0xCC, 0x00, 0x66, 0xD5, 0xFF, 0x00, 0x66, 0xFF, 0x00, 0x00, 0x66, 0xFF, 0x33, 0x00, 0x66, 0xFF, + 0x66, 0x00, 0x66, 0xFF, 0x99, 0x00, 0x66, 0xFF, 0xCC, 0x00, 0x66, 0xFF, 0xFF, 0x00, 0x99, 0x00, + 0x00, 0x00, 0x99, 0x00, 0x33, 0x00, 0x99, 0x00, 0x66, 0x00, 0x99, 0x00, 0x99, 0x00, 0x99, 0x00, + 0xCC, 0x00, 0x99, 0x00, 0xFF, 0x00, 0x99, 0x2B, 0x00, 0x00, 0x99, 0x2B, 0x33, 0x00, 0x99, 0x2B, + 0x66, 0x00, 0x99, 0x2B, 0x99, 0x00, 0x99, 0x2B, 0xCC, 0x00, 0x99, 0x2B, 0xFF, 0x00, 0x99, 0x55, + 0x00, 0x00, 0x99, 0x55, 0x33, 0x00, 0x99, 0x55, 0x66, 0x00, 0x99, 0x55, 0x99, 0x00, 0x99, 0x55, + 0xCC, 0x00, 0x99, 0x55, 0xFF, 0x00, 0x99, 0x80, 0x00, 0x00, 0x99, 0x80, 0x33, 0x00, 0x99, 0x80, + 0x66, 0x00, 0x99, 0x80, 0x99, 0x00, 0x99, 0x80, 0xCC, 0x00, 0x99, 0x80, 0xFF, 0x00, 0x99, 0xAA, + 0x00, 0x00, 0x99, 0xAA, 0x33, 0x00, 0x99, 0xAA, 0x66, 0x00, 0x99, 0xAA, 0x99, 0x00, 0x99, 0xAA, + 0xCC, 0x00, 0x99, 0xAA, 0xFF, 0x00, 0x99, 0xD5, 0x00, 0x00, 0x99, 0xD5, 0x33, 0x00, 0x99, 0xD5, + 0x66, 0x00, 0x99, 0xD5, 0x99, 0x00, 0x99, 0xD5, 0xCC, 0x00, 0x99, 0xD5, 0xFF, 0x00, 0x99, 0xFF, + 0x00, 0x00, 0x99, 0xFF, 0x33, 0x00, 0x99, 0xFF, 0x66, 0x00, 0x99, 0xFF, 0x99, 0x00, 0x99, 0xFF, + 0xCC, 0x00, 0x99, 0xFF, 0xFF, 0x00, 0xCC, 0x00, 0x00, 0x00, 0xCC, 0x00, 0x33, 0x00, 0xCC, 0x00, + 0x66, 0x00, 0xCC, 0x00, 0x99, 0x00, 0xCC, 0x00, 0xCC, 0x00, 0xCC, 0x00, 0xFF, 0x00, 0xCC, 0x2B, + 0x00, 0x00, 0xCC, 0x2B, 0x33, 0x00, 0xCC, 0x2B, 0x66, 0x00, 0xCC, 0x2B, 0x99, 0x00, 0xCC, 0x2B, + 0xCC, 0x00, 0xCC, 0x2B, 0xFF, 0x00, 0xCC, 0x55, 0x00, 0x00, 0xCC, 0x55, 0x33, 0x00, 0xCC, 0x55, + 0x66, 0x00, 0xCC, 0x55, 0x99, 0x00, 0xCC, 0x55, 0xCC, 0x00, 0xCC, 0x55, 0xFF, 0x00, 0xCC, 0x80, + 0x00, 0x00, 0xCC, 0x80, 0x33, 0x00, 0xCC, 0x80, 0x66, 0x00, 0xCC, 0x80, 0x99, 0x00, 0xCC, 0x80, + 0xCC, 0x00, 0xCC, 0x80, 0xFF, 0x00, 0xCC, 0xAA, 0x00, 0x00, 0xCC, 0xAA, 0x33, 0x00, 0xCC, 0xAA, + 0x66, 0x00, 0xCC, 0xAA, 0x99, 0x00, 0xCC, 0xAA, 0xCC, 0x00, 0xCC, 0xAA, 0xFF, 0x00, 0xCC, 0xD5, + 0x00, 0x00, 0xCC, 0xD5, 0x33, 0x00, 0xCC, 0xD5, 0x66, 0x00, 0xCC, 0xD5, 0x99, 0x00, 0xCC, 0xD5, + 0xCC, 0x00, 0xCC, 0xD5, 0xFF, 0x00, 0xCC, 0xFF, 0x00, 0x00, 0xCC, 0xFF, 0x33, 0x00, 0xCC, 0xFF, + 0x66, 0x00, 0xCC, 0xFF, 0x99, 0x00, 0xCC, 0xFF, 0xCC, 0x00, 0xCC, 0xFF, 0xFF, 0x00, 0xFF, 0x00, + 0x00, 0x00, 0xFF, 0x00, 0x33, 0x00, 0xFF, 0x00, 0x66, 0x00, 0xFF, 0x00, 0x99, 0x00, 0xFF, 0x00, + 0xCC, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0x2B, 0x00, 0x00, 0xFF, 0x2B, 0x33, 0x00, 0xFF, 0x2B, + 0x66, 0x00, 0xFF, 0x2B, 0x99, 0x00, 0xFF, 0x2B, 0xCC, 0x00, 0xFF, 0x2B, 0xFF, 0x00, 0xFF, 0x55, + 0x00, 0x00, 0xFF, 0x55, 0x33, 0x00, 0xFF, 0x55, 0x66, 0x00, 0xFF, 0x55, 0x99, 0x00, 0xFF, 0x55, + 0xCC, 0x00, 0xFF, 0x55, 0xFF, 0x00, 0xFF, 0x80, 0x00, 0x00, 0xFF, 0x80, 0x33, 0x00, 0xFF, 0x80, + 0x66, 0x00, 0xFF, 0x80, 0x99, 0x00, 0xFF, 0x80, 0xCC, 0x00, 0xFF, 0x80, 0xFF, 0x00, 0xFF, 0xAA, + 0x00, 0x00, 0xFF, 0xAA, 0x33, 0x00, 0xFF, 0xAA, 0x66, 0x00, 0xFF, 0xAA, 0x99, 0x00, 0xFF, 0xAA, + 0xCC, 0x00, 0xFF, 0xAA, 0xFF, 0x00, 0xFF, 0xD5, 0x00, 0x00, 0xFF, 0xD5, 0x33, 0x00, 0xFF, 0xD5, + 0x66, 0x00, 0xFF, 0xD5, 0x99, 0x00, 0xFF, 0xD5, 0xCC, 0x00, 0xFF, 0xD5, 0xFF, 0x00, 0xFF, 0xFF, + 0x00, 0x00, 0xFF, 0xFF, 0x33, 0x00, 0xFF, 0xFF, 0x66, 0x00, 0xFF, 0xFF, 0x99, 0x00, 0xFF, 0xFF, + 0xCC, 0x00, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x30, 0x30, 0x30, 0x30, 0x36, + 0x36, 0x60, 0x60, 0x66, 0x66, 0x90, 0x66, 0x90, 0x90, 0x96, 0x96, 0x96, 0x96, 0xC6, 0xC0, 0xC6, + 0xC6, 0xC6, 0xC6, 0xF6, 0xF6, 0xF6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, + 0x2B, 0x56, 0x56, 0x56, 0x56, 0x81, 0x56, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xAC, 0xAC, 0xAC, + 0xAC, 0xAC, 0xAC, 0xD7, 0xD7, 0xD7, 0x00, 0x00, 0x00, 0x06, 0x00, 0x07, 0x07, 0x07, 0x07, 0x0D, + 0x0D, 0x0E, 0x0E, 0x14, 0x14, 0x15, 0x14, 0x15, 0x15, 0x1B, 0x1B, 0x1B, 0x1B, 0x22, 0x1C, 0x22, + 0x22, 0x22, 0x22, 0x29, 0x29, 0x29, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, + 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, + 0x62, 0x62, 0x62, 0x62, 0x62, 0x00, 0x00, 0x00, 0x30, 0x00, 0x30, 0x06, 0x36, 0x30, 0x60, 0x30, + 0x60, 0x36, 0x66, 0x60, 0x90, 0x66, 0x90, 0x66, 0x96, 0x90, 0xC0, 0x96, 0xC6, 0x96, 0xC6, 0xC0, + 0xF0, 0xC6, 0xF6, 0xC6, 0xF6, 0xF6, 0x00, 0x00, 0x2B, 0x00, 0x2B, 0x00, 0x2B, 0x2B, 0x56, 0x2B, + 0x56, 0x2B, 0x56, 0x56, 0x81, 0x56, 0x81, 0x56, 0x81, 0x81, 0xAC, 0x81, 0xAC, 0x81, 0xAC, 0xAC, + 0xD7, 0xAC, 0xD7, 0xAC, 0xD7, 0xD7, 0x00, 0x00, 0x07, 0x00, 0x07, 0x06, 0x0D, 0x07, 0x0E, 0x07, + 0x0E, 0x0D, 0x14, 0x0E, 0x15, 0x14, 0x15, 0x14, 0x1B, 0x15, 0x1C, 0x1B, 0x22, 0x1B, 0x22, 0x1C, + 0x23, 0x22, 0x29, 0x22, 0x29, 0x29, 0x68, 0x37, 0x68, 0x62, 0x68, 0x61, 0x68, 0x62, 0x68, 0x61, + 0x68, 0x62, 0x68, 0x61, 0x92, 0x62, 0x92, 0x61, 0x92, 0x62, 0x92, 0x61, 0x92, 0x62, 0x92, 0x61, + 0x92, 0x62, 0x92, 0x61, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x30, 0x30, 0x30, 0x30, 0x60, + 0x36, 0x60, 0x60, 0x66, 0x60, 0x66, 0x66, 0x90, 0x90, 0x96, 0x96, 0xC0, 0x96, 0xC0, 0xC6, 0xC6, + 0xC6, 0xC6, 0xC6, 0xF6, 0xF6, 0xF6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x2B, 0x2B, 0x2B, 0x56, + 0x2B, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x81, 0x81, 0x81, 0x81, 0xAC, 0x81, 0xAC, 0xAC, 0xAC, + 0xAC, 0xAC, 0xAC, 0xD7, 0xD7, 0xD7, 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x07, 0x07, 0x07, 0x0E, + 0x0D, 0x0E, 0x0E, 0x14, 0x0E, 0x14, 0x14, 0x15, 0x15, 0x1B, 0x1B, 0x1C, 0x1B, 0x1C, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x29, 0x29, 0x29, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, + 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x8C, 0x62, 0x62, 0x62, 0x8C, + 0x62, 0x62, 0x62, 0x8C, 0x62, 0x00, 0x01, 0x00, 0x06, 0x00, 0x31, 0x06, 0x30, 0x30, 0x61, 0x30, + 0x60, 0x36, 0x67, 0x60, 0x66, 0x60, 0x97, 0x66, 0x96, 0x90, 0xC1, 0x96, 0xC6, 0x96, 0xC7, 0xC6, + 0xC6, 0xC6, 0xF7, 0xC6, 0xF6, 0xF6, 0x06, 0x00, 0x00, 0x00, 0x31, 0x00, 0x2B, 0x2B, 0x5C, 0x2B, + 0x56, 0x2B, 0x5C, 0x56, 0x56, 0x56, 0x87, 0x56, 0x81, 0x81, 0xB2, 0x81, 0xAC, 0x81, 0xB2, 0xAC, + 0xAC, 0xAC, 0xDD, 0xAC, 0xD7, 0xD7, 0x2A, 0x00, 0x06, 0x00, 0x31, 0x06, 0x07, 0x07, 0x38, 0x07, + 0x0E, 0x0D, 0x3E, 0x0E, 0x14, 0x0E, 0x45, 0x14, 0x1B, 0x15, 0x46, 0x1B, 0x22, 0x1B, 0x4C, 0x22, + 0x22, 0x22, 0x53, 0x22, 0x29, 0x29, 0x68, 0x62, 0x68, 0x61, 0x68, 0x62, 0x68, 0x61, 0x92, 0x62, + 0x68, 0x61, 0x92, 0x62, 0x68, 0x61, 0x92, 0x62, 0x92, 0x61, 0x92, 0x62, 0x92, 0x61, 0x92, 0x62, + 0x92, 0x61, 0x92, 0x62, 0x92, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x30, 0x30, 0x30, 0x30, 0x36, + 0x36, 0x60, 0x60, 0x66, 0x66, 0x66, 0x66, 0x90, 0x90, 0x96, 0x96, 0x96, 0x96, 0xC6, 0xC0, 0xC6, + 0xC6, 0xF0, 0xC6, 0xF6, 0xF6, 0xF6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, + 0x2B, 0x56, 0x56, 0x56, 0x56, 0x56, 0x56, 0x81, 0x81, 0x81, 0x81, 0x81, 0x81, 0xAC, 0xAC, 0xAC, + 0xAC, 0xD7, 0xAC, 0xD7, 0xD7, 0xD7, 0x00, 0x00, 0x00, 0x06, 0x00, 0x07, 0x07, 0x07, 0x07, 0x0D, + 0x0D, 0x0E, 0x0E, 0x14, 0x14, 0x14, 0x14, 0x15, 0x15, 0x1B, 0x1B, 0x1B, 0x1B, 0x22, 0x1C, 0x22, + 0x22, 0x23, 0x22, 0x29, 0x29, 0x29, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, + 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x62, 0x8C, + 0x62, 0x8C, 0x62, 0x8C, 0x62, 0x00, 0x01, 0x00, 0x31, 0x00, 0x31, 0x06, 0x31, 0x30, 0x61, 0x30, + 0x61, 0x36, 0x67, 0x60, 0x91, 0x66, 0x91, 0x66, 0x97, 0x90, 0xC1, 0x96, 0xC7, 0x96, 0xC7, 0xC0, + 0xF1, 0xC6, 0xF7, 0xC6, 0xF7, 0xF6, 0x06, 0x00, 0x31, 0x00, 0x31, 0x00, 0x31, 0x2B, 0x5C, 0x2B, + 0x5C, 0x2B, 0x5C, 0x56, 0x87, 0x56, 0x87, 0x56, 0x87, 0x81, 0xB2, 0x81, 0xB2, 0x81, 0xB2, 0xAC, + 0xDD, 0xAC, 0xDD, 0xAC, 0xDD, 0xD7, 0x2A, 0x00, 0x31, 0x00, 0x31, 0x06, 0x31, 0x07, 0x38, 0x07, + 0x38, 0x0D, 0x3E, 0x0E, 0x3F, 0x14, 0x3F, 0x14, 0x45, 0x15, 0x46, 0x1B, 0x4C, 0x1B, 0x4C, 0x1C, + 0x4D, 0x22, 0x53, 0x22, 0x53, 0x29, 0x68, 0x62, 0x68, 0x62, 0x68, 0x62, 0x68, 0x62, 0x68, 0x62, + 0x92, 0x62, 0x68, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, + 0x92, 0x62, 0x92, 0x62, 0x92, 0x00, 0x00, 0x01, 0x00, 0x00, 0x06, 0x30, 0x30, 0x30, 0x30, 0x61, + 0x36, 0x60, 0x60, 0x66, 0x60, 0x66, 0x90, 0x91, 0x90, 0x96, 0x96, 0xC0, 0x96, 0xC0, 0xC6, 0xC7, + 0xC6, 0xC6, 0xC6, 0xF6, 0xF6, 0xF6, 0x00, 0x06, 0x00, 0x00, 0x00, 0x31, 0x2B, 0x2B, 0x2B, 0x5C, + 0x2B, 0x56, 0x56, 0x5C, 0x56, 0x56, 0x81, 0x87, 0x81, 0x81, 0x81, 0xB2, 0x81, 0xAC, 0xAC, 0xB2, + 0xAC, 0xAC, 0xAC, 0xDD, 0xD7, 0xD7, 0x00, 0x2A, 0x00, 0x00, 0x06, 0x07, 0x07, 0x07, 0x07, 0x38, + 0x0D, 0x0E, 0x0E, 0x14, 0x0E, 0x14, 0x15, 0x3F, 0x15, 0x1B, 0x1B, 0x1C, 0x1B, 0x1C, 0x22, 0x4C, + 0x22, 0x22, 0x22, 0x29, 0x29, 0x29, 0x62, 0x68, 0x62, 0x62, 0x62, 0x68, 0x62, 0x62, 0x62, 0x68, + 0x62, 0x62, 0x62, 0x68, 0x62, 0x62, 0x62, 0x92, 0x62, 0x62, 0x62, 0x92, 0x62, 0x62, 0x62, 0x92, + 0x62, 0x8C, 0x62, 0x92, 0x62, 0x00, 0x01, 0x00, 0x07, 0x00, 0x31, 0x06, 0x31, 0x30, 0x61, 0x30, + 0x61, 0x36, 0x67, 0x60, 0x67, 0x60, 0x97, 0x66, 0x97, 0x90, 0xC1, 0x96, 0xC1, 0x96, 0xC7, 0xC6, + 0xC7, 0xC6, 0xF7, 0xC6, 0xF7, 0xF6, 0x06, 0x00, 0x06, 0x00, 0x31, 0x00, 0x31, 0x2B, 0x5C, 0x2B, + 0x5C, 0x2B, 0x5C, 0x56, 0x5C, 0x56, 0x87, 0x56, 0x87, 0x81, 0xB2, 0x81, 0xB2, 0x81, 0xB2, 0xAC, + 0xB2, 0xAC, 0xDD, 0xAC, 0xDD, 0xD7, 0x2A, 0x00, 0x30, 0x00, 0x31, 0x06, 0x31, 0x07, 0x38, 0x07, + 0x38, 0x0D, 0x3E, 0x0E, 0x3E, 0x0E, 0x45, 0x14, 0x45, 0x15, 0x46, 0x1B, 0x46, 0x1B, 0x4C, 0x22, + 0x4C, 0x22, 0x53, 0x22, 0x53, 0x29, 0x93, 0x62, 0x68, 0x62, 0x92, 0x62, 0x68, 0x62, 0x93, 0x62, + 0x68, 0x62, 0x92, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x93, 0x62, + 0x92, 0x62, 0x92, 0x62, 0x92, 0x00, 0x00, 0x01, 0x00, 0x07, 0x00, 0x31, 0x30, 0x31, 0x30, 0x37, + 0x36, 0x61, 0x60, 0x67, 0x66, 0x91, 0x66, 0x91, 0x90, 0x97, 0x96, 0x97, 0x96, 0xC7, 0xC0, 0xC7, + 0xC6, 0xC7, 0xC6, 0xF7, 0xF6, 0xF7, 0x00, 0x06, 0x06, 0x06, 0x00, 0x31, 0x31, 0x31, 0x2B, 0x31, + 0x31, 0x5C, 0x56, 0x5C, 0x5C, 0x87, 0x56, 0x87, 0x87, 0x87, 0x81, 0x87, 0x87, 0xB2, 0xAC, 0xB2, + 0xB2, 0xB2, 0xAC, 0xDD, 0xDD, 0xDD, 0x00, 0x2A, 0x00, 0x30, 0x00, 0x31, 0x07, 0x31, 0x07, 0x37, + 0x0D, 0x38, 0x0E, 0x3E, 0x14, 0x3F, 0x14, 0x3F, 0x15, 0x45, 0x1B, 0x45, 0x1B, 0x4C, 0x1C, 0x4C, + 0x22, 0x4C, 0x22, 0x53, 0x29, 0x53, 0x62, 0x62, 0x62, 0x68, 0x62, 0x62, 0x62, 0x68, 0x62, 0x62, + 0x62, 0x68, 0x62, 0x62, 0x62, 0x68, 0x62, 0x62, 0x62, 0x68, 0x62, 0x62, 0x62, 0x92, 0x62, 0x8C, + 0x62, 0x92, 0x62, 0x8C, 0x62, 0x00, 0x01, 0x00, 0x31, 0x00, 0x31, 0x06, 0x37, 0x30, 0x61, 0x30, + 0x61, 0x36, 0x67, 0x60, 0x91, 0x66, 0x91, 0x66, 0x97, 0x90, 0xC1, 0x96, 0xC7, 0x96, 0xC7, 0xC0, + 0xF1, 0xC6, 0xF7, 0xC6, 0xF7, 0xF6, 0x06, 0x00, 0x31, 0x00, 0x31, 0x00, 0x31, 0x2B, 0x5C, 0x2B, + 0x5C, 0x2B, 0x5C, 0x56, 0x87, 0x56, 0x87, 0x56, 0x87, 0x81, 0xB2, 0x81, 0xB2, 0x81, 0xB2, 0xAC, + 0xDD, 0xAC, 0xDD, 0xAC, 0xDD, 0xD7, 0x2A, 0x00, 0x31, 0x00, 0x31, 0x06, 0x37, 0x07, 0x38, 0x07, + 0x38, 0x0D, 0x3E, 0x0E, 0x3F, 0x14, 0x3F, 0x14, 0x45, 0x15, 0x46, 0x1B, 0x4C, 0x1B, 0x4C, 0x1C, + 0x4D, 0x22, 0x53, 0x22, 0x53, 0x29, 0x68, 0x62, 0x68, 0x62, 0x68, 0x62, 0x92, 0x62, 0x92, 0x62, + 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, + 0x92, 0x62, 0x92, 0x62, 0x92, 0x00, 0x01, 0x01, 0x00, 0x01, 0x07, 0x31, 0x30, 0x31, 0x31, 0x61, + 0x36, 0x61, 0x61, 0x67, 0x60, 0x67, 0x67, 0x91, 0x90, 0x97, 0x97, 0xC1, 0x96, 0xC1, 0xC7, 0xC7, + 0xC6, 0xC7, 0xC7, 0xF7, 0xF6, 0xF7, 0x06, 0x06, 0x06, 0x06, 0x06, 0x31, 0x31, 0x31, 0x31, 0x5C, + 0x31, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x87, 0x87, 0x87, 0x87, 0xB2, 0x87, 0xB2, 0xB2, 0xB2, + 0xB2, 0xB2, 0xB2, 0xDD, 0xDD, 0xDD, 0x2A, 0x2A, 0x00, 0x2A, 0x30, 0x31, 0x07, 0x31, 0x31, 0x38, + 0x0D, 0x38, 0x38, 0x3E, 0x0E, 0x3E, 0x3E, 0x3F, 0x15, 0x45, 0x45, 0x46, 0x1B, 0x46, 0x4C, 0x4C, + 0x22, 0x4C, 0x4C, 0x53, 0x29, 0x53, 0x62, 0x68, 0x62, 0x62, 0x62, 0x68, 0x62, 0x62, 0x62, 0x68, + 0x62, 0x62, 0x62, 0x92, 0x62, 0x62, 0x62, 0x92, 0x62, 0x62, 0x62, 0x92, 0x62, 0x8C, 0x62, 0x92, + 0x62, 0x8C, 0x8C, 0x92, 0x62, 0x00, 0x01, 0x00, 0x07, 0x00, 0x31, 0x07, 0x31, 0x30, 0x61, 0x30, + 0x61, 0x36, 0x67, 0x61, 0x67, 0x60, 0x97, 0x66, 0x97, 0x90, 0xC1, 0x97, 0xC7, 0x96, 0xC7, 0xC6, + 0xC7, 0xC6, 0xF7, 0xC7, 0xF7, 0xF6, 0x06, 0x06, 0x06, 0x06, 0x37, 0x06, 0x31, 0x31, 0x5C, 0x31, + 0x5C, 0x31, 0x62, 0x5C, 0x5C, 0x5C, 0x87, 0x5C, 0x87, 0x87, 0xB8, 0x87, 0xB2, 0x87, 0xB2, 0xB2, + 0xB2, 0xB2, 0xE3, 0xB2, 0xDD, 0xDD, 0x2A, 0x00, 0x30, 0x00, 0x31, 0x30, 0x31, 0x07, 0x38, 0x07, + 0x38, 0x0D, 0x3E, 0x38, 0x3E, 0x0E, 0x45, 0x14, 0x45, 0x15, 0x46, 0x45, 0x4C, 0x1B, 0x4C, 0x22, + 0x4C, 0x22, 0x53, 0x4C, 0x53, 0x29, 0x93, 0x62, 0x68, 0x62, 0x93, 0x62, 0x68, 0x62, 0x93, 0x62, + 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, + 0x92, 0x62, 0x93, 0x62, 0x92, 0x00, 0x01, 0x01, 0x01, 0x07, 0x01, 0x31, 0x31, 0x31, 0x31, 0x37, + 0x37, 0x61, 0x61, 0x67, 0x67, 0x67, 0x67, 0x91, 0x91, 0x97, 0x97, 0x97, 0x97, 0xC7, 0xC1, 0xC7, + 0xC7, 0xF1, 0xC7, 0xF7, 0xF7, 0xF7, 0x06, 0x06, 0x06, 0x06, 0x06, 0x31, 0x31, 0x31, 0x31, 0x31, + 0x31, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x87, 0x87, 0x87, 0x87, 0x87, 0x87, 0xB2, 0xB2, 0xB2, + 0xB2, 0xDD, 0xB2, 0xDD, 0xDD, 0xDD, 0x2A, 0x2A, 0x2A, 0x30, 0x2A, 0x31, 0x31, 0x31, 0x31, 0x37, + 0x37, 0x38, 0x38, 0x3E, 0x3E, 0x3E, 0x3E, 0x3F, 0x3F, 0x45, 0x45, 0x45, 0x45, 0x4C, 0x46, 0x4C, + 0x4C, 0x4D, 0x4C, 0x53, 0x53, 0x53, 0x62, 0x68, 0x62, 0x68, 0x62, 0x68, 0x62, 0x68, 0x62, 0x68, + 0x62, 0x68, 0x62, 0x68, 0x62, 0x68, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, + 0x62, 0x92, 0x62, 0x92, 0x8C, 0x00, 0x01, 0x01, 0x31, 0x01, 0x31, 0x07, 0x31, 0x31, 0x61, 0x31, + 0x61, 0x37, 0x67, 0x61, 0x91, 0x67, 0x91, 0x67, 0x97, 0x91, 0xC1, 0x97, 0xC7, 0x97, 0xC7, 0xC1, + 0xF1, 0xC7, 0xF7, 0xC7, 0xF7, 0xF7, 0x0C, 0x06, 0x37, 0x06, 0x31, 0x06, 0x37, 0x31, 0x62, 0x31, + 0x62, 0x31, 0x5C, 0x5C, 0x8D, 0x5C, 0x8D, 0x5C, 0x8D, 0x87, 0xB2, 0x87, 0xB8, 0x87, 0xB8, 0xB2, + 0xE3, 0xB2, 0xDD, 0xB2, 0xE3, 0xDD, 0x2A, 0x2A, 0x31, 0x2A, 0x31, 0x30, 0x31, 0x31, 0x38, 0x31, + 0x38, 0x37, 0x3E, 0x38, 0x3F, 0x3E, 0x3F, 0x3E, 0x45, 0x3F, 0x46, 0x45, 0x4C, 0x45, 0x4C, 0x46, + 0x4D, 0x4C, 0x53, 0x4C, 0x53, 0x53, 0x68, 0x62, 0x93, 0x62, 0x68, 0x62, 0x92, 0x62, 0x92, 0x62, + 0x93, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, + 0x93, 0x62, 0x92, 0x62, 0x92, 0x00, 0x01, 0x01, 0x01, 0x01, 0x07, 0x31, 0x31, 0x31, 0x31, 0x61, + 0x37, 0x61, 0x61, 0x67, 0x61, 0x67, 0x91, 0x91, 0x91, 0x97, 0x97, 0xC1, 0x97, 0xC1, 0xC7, 0xC7, + 0xC7, 0xC7, 0xC7, 0xF7, 0xF7, 0xF7, 0x06, 0x06, 0x06, 0x06, 0x06, 0x31, 0x31, 0x31, 0x31, 0x5C, + 0x31, 0x5C, 0x5C, 0x5C, 0x5C, 0x5C, 0x87, 0x87, 0x87, 0x87, 0x87, 0xB2, 0x87, 0xB2, 0xB2, 0xB2, + 0xB2, 0xB2, 0xB2, 0xDD, 0xDD, 0xDD, 0x2A, 0x2A, 0x2A, 0x2A, 0x30, 0x31, 0x31, 0x31, 0x31, 0x38, + 0x37, 0x38, 0x38, 0x3E, 0x38, 0x3E, 0x3F, 0x3F, 0x3F, 0x45, 0x45, 0x46, 0x45, 0x46, 0x4C, 0x4C, + 0x4C, 0x4C, 0x4C, 0x53, 0x53, 0x53, 0x68, 0x68, 0x62, 0x68, 0x62, 0x68, 0x62, 0x68, 0x68, 0x92, + 0x62, 0x68, 0x62, 0x92, 0x62, 0x68, 0x68, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x92, 0x92, + 0x62, 0x92, 0x8C, 0x92, 0x62, 0x00, 0x02, 0x01, 0x07, 0x01, 0x32, 0x07, 0x31, 0x31, 0x62, 0x31, + 0x61, 0x37, 0x68, 0x61, 0x67, 0x61, 0x98, 0x67, 0x97, 0x91, 0xC2, 0x97, 0xC1, 0x97, 0xC8, 0xC7, + 0xC7, 0xC7, 0xF8, 0xC7, 0xF7, 0xF7, 0x0C, 0x06, 0x0C, 0x06, 0x37, 0x06, 0x37, 0x31, 0x62, 0x31, + 0x62, 0x31, 0x62, 0x5C, 0x62, 0x5C, 0x8D, 0x5C, 0x8D, 0x87, 0xB8, 0x87, 0xB8, 0x87, 0xB8, 0xB2, + 0xB8, 0xB2, 0xE3, 0xB2, 0xE3, 0xDD, 0x54, 0x2A, 0x30, 0x2A, 0x5B, 0x30, 0x31, 0x31, 0x62, 0x31, + 0x38, 0x37, 0x68, 0x38, 0x3E, 0x38, 0x6F, 0x3E, 0x45, 0x3F, 0x70, 0x45, 0x46, 0x45, 0x76, 0x4C, + 0x4C, 0x4C, 0x7D, 0x4C, 0x53, 0x53, 0x93, 0x62, 0x68, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, + 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, + 0x92, 0x62, 0x93, 0x62, 0x92, 0x00, 0x01, 0x01, 0x01, 0x07, 0x01, 0x31, 0x31, 0x31, 0x31, 0x37, + 0x37, 0x61, 0x61, 0x67, 0x67, 0x91, 0x67, 0x91, 0x91, 0x97, 0x97, 0x97, 0x97, 0xC7, 0xC1, 0xC7, + 0xC7, 0xC7, 0xC7, 0xF7, 0xF7, 0xF7, 0x06, 0x0C, 0x06, 0x0C, 0x06, 0x37, 0x31, 0x37, 0x31, 0x37, + 0x31, 0x62, 0x5C, 0x62, 0x5C, 0x8D, 0x5C, 0x8D, 0x87, 0x8D, 0x87, 0x8D, 0x87, 0xB8, 0xB2, 0xB8, + 0xB2, 0xB8, 0xB2, 0xE3, 0xDD, 0xE3, 0x2A, 0x2A, 0x2A, 0x30, 0x2A, 0x31, 0x31, 0x31, 0x31, 0x37, + 0x37, 0x38, 0x38, 0x3E, 0x3E, 0x3F, 0x3E, 0x3F, 0x3F, 0x45, 0x45, 0x45, 0x45, 0x4C, 0x46, 0x4C, + 0x4C, 0x4C, 0x4C, 0x53, 0x53, 0x53, 0x62, 0x68, 0x62, 0x68, 0x62, 0x68, 0x62, 0x68, 0x62, 0x68, + 0x62, 0x68, 0x62, 0x68, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, 0x62, 0x92, + 0x8C, 0x92, 0x8C, 0x92, 0x8C, 0x00, 0x02, 0x01, 0x32, 0x01, 0x32, 0x07, 0x38, 0x31, 0x62, 0x31, + 0x62, 0x37, 0x68, 0x61, 0x92, 0x67, 0x92, 0x67, 0x98, 0x91, 0xC2, 0x97, 0xC8, 0x97, 0xC8, 0xC1, + 0xF2, 0xC7, 0xF8, 0xC7, 0xF8, 0xF7, 0x0C, 0x06, 0x37, 0x06, 0x37, 0x06, 0x37, 0x31, 0x62, 0x31, + 0x62, 0x31, 0x62, 0x5C, 0x8D, 0x5C, 0x8D, 0x5C, 0x8D, 0x87, 0xB8, 0x87, 0xB8, 0x87, 0xB8, 0xB2, + 0xE3, 0xB2, 0xE3, 0xB2, 0xE3, 0xDD, 0x54, 0x2A, 0x5B, 0x2A, 0x5B, 0x30, 0x61, 0x31, 0x62, 0x31, + 0x62, 0x37, 0x68, 0x38, 0x69, 0x3E, 0x69, 0x3E, 0x6F, 0x3F, 0x70, 0x45, 0x76, 0x45, 0x76, 0x46, + 0x77, 0x4C, 0x7D, 0x4C, 0x7D, 0x53, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, + 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, + 0x93, 0x62, 0x93, 0x62, 0x93, 0x00, 0x01, 0x02, 0x01, 0x01, 0x07, 0x32, 0x31, 0x31, 0x31, 0x62, + 0x37, 0x61, 0x61, 0x68, 0x61, 0x67, 0x67, 0x92, 0x91, 0x97, 0x97, 0xC2, 0x97, 0xC1, 0xC7, 0xC8, + 0xC7, 0xC7, 0xC7, 0xF8, 0xF7, 0xF7, 0x0C, 0x0C, 0x06, 0x0C, 0x0C, 0x37, 0x31, 0x37, 0x37, 0x62, + 0x31, 0x62, 0x62, 0x62, 0x5C, 0x62, 0x62, 0x8D, 0x87, 0x8D, 0x8D, 0xB8, 0x87, 0xB8, 0xB8, 0xB8, + 0xB2, 0xB8, 0xB8, 0xE3, 0xDD, 0xE3, 0x2A, 0x54, 0x2A, 0x2A, 0x30, 0x5B, 0x31, 0x31, 0x31, 0x62, + 0x37, 0x38, 0x38, 0x68, 0x38, 0x3E, 0x3E, 0x69, 0x3F, 0x45, 0x45, 0x70, 0x45, 0x46, 0x4C, 0x76, + 0x4C, 0x4C, 0x4C, 0x7D, 0x53, 0x53, 0x68, 0x68, 0x62, 0x68, 0x68, 0x92, 0x62, 0x68, 0x68, 0x92, + 0x62, 0x68, 0x68, 0x92, 0x62, 0x92, 0x68, 0x92, 0x62, 0x92, 0x92, 0x92, 0x62, 0x92, 0x92, 0x92, + 0x62, 0x92, 0x92, 0x92, 0x8C, 0x00, 0x02, 0x01, 0x08, 0x01, 0x32, 0x07, 0x32, 0x31, 0x62, 0x31, + 0x62, 0x37, 0x68, 0x61, 0x68, 0x61, 0x98, 0x67, 0x98, 0x91, 0xC2, 0x97, 0xC8, 0x97, 0xC8, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x5C, 0x62, 0x5C, 0x8D, 0x5C, 0x8D, 0x87, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xB8, 0xB2, 0xE3, 0xB2, 0xE3, 0xDD, 0x54, 0x2A, 0x5A, 0x2A, 0x5B, 0x30, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x68, 0x38, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x45, 0x76, 0x45, 0x76, 0x4C, + 0x76, 0x4C, 0x7D, 0x4C, 0x7D, 0x53, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, + 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, 0x92, 0x62, 0x93, 0x62, + 0x92, 0x62, 0x93, 0x8C, 0x92, 0x00, 0x01, 0x02, 0x01, 0x08, 0x01, 0x32, 0x31, 0x32, 0x31, 0x38, + 0x37, 0x62, 0x61, 0x68, 0x67, 0x68, 0x67, 0x92, 0x91, 0x98, 0x97, 0x98, 0x97, 0xC8, 0xC1, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x62, 0x62, 0x8D, 0x8D, 0x8D, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xB8, 0xE3, 0xB8, 0xE3, 0xE3, 0xE3, 0x2A, 0x54, 0x2A, 0x5A, 0x2A, 0x5B, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x68, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6F, 0x45, 0x76, 0x46, 0x76, + 0x4C, 0x77, 0x4C, 0x7D, 0x53, 0x7D, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x92, + 0x68, 0x92, 0x68, 0x92, 0x68, 0x92, 0x68, 0x92, 0x68, 0x92, 0x68, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x02, 0x01, 0x32, 0x01, 0x32, 0x07, 0x32, 0x31, 0x62, 0x31, + 0x62, 0x37, 0x68, 0x61, 0x92, 0x67, 0x92, 0x67, 0x98, 0x91, 0xC2, 0x97, 0xC8, 0x97, 0xC8, 0x00, + 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, + 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x8D, 0x62, 0x8D, 0x8D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xE3, 0xB8, 0xE3, 0xB8, 0xE3, 0xE3, 0x54, 0x2A, 0x5B, 0x2A, 0x5B, 0x30, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x68, 0x38, 0x69, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x45, 0x76, 0x45, 0x76, 0x46, + 0x77, 0x4C, 0x7D, 0x4C, 0x7D, 0x53, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, + 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, + 0x93, 0x62, 0x93, 0x62, 0x93, 0x00, 0x02, 0x02, 0x01, 0x02, 0x08, 0x32, 0x31, 0x32, 0x32, 0x62, + 0x37, 0x62, 0x62, 0x68, 0x61, 0x68, 0x92, 0x92, 0x91, 0x98, 0x98, 0xC2, 0x97, 0xC2, 0xC8, 0x00, + 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, + 0xFB, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x8D, 0x8D, 0x8D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xB8, 0xB8, 0xB8, 0xE3, 0xE3, 0xE3, 0x54, 0x54, 0x2A, 0x54, 0x5A, 0x5B, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x62, 0x68, 0x38, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x70, 0x45, 0x70, 0x76, 0x76, + 0x4C, 0x76, 0x76, 0x7D, 0x53, 0x7D, 0x68, 0x93, 0x68, 0x68, 0x68, 0x92, 0x62, 0x68, 0x68, 0x93, + 0x68, 0x92, 0x68, 0x92, 0x62, 0x92, 0x92, 0x93, 0x68, 0x92, 0x92, 0x92, 0x62, 0x92, 0x92, 0x93, + 0x92, 0x92, 0x92, 0x92, 0x8C, 0x00, 0x02, 0x02, 0x08, 0x01, 0x32, 0x07, 0x32, 0x31, 0x62, 0x32, + 0x62, 0x37, 0x68, 0x61, 0x68, 0x61, 0x98, 0x68, 0x98, 0x91, 0xC2, 0x97, 0xC2, 0x97, 0xC8, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x62, 0x8D, 0x8D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xB8, 0xB8, 0xE9, 0xB8, 0xE3, 0xE3, 0x54, 0x54, 0x5A, 0x2A, 0x5B, 0x30, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x68, 0x38, 0x68, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x45, 0x70, 0x45, 0x76, 0x76, + 0x76, 0x4C, 0x7D, 0x4C, 0x7D, 0x53, 0x93, 0x68, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x68, + 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x68, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x92, + 0x93, 0x62, 0x93, 0x8C, 0x93, 0x00, 0x02, 0x02, 0x02, 0x08, 0x02, 0x32, 0x32, 0x32, 0x32, 0x38, + 0x38, 0x62, 0x62, 0x68, 0x68, 0x92, 0x68, 0x92, 0x92, 0x98, 0x98, 0x98, 0x98, 0xC8, 0xC2, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x8D, 0x8D, 0x8D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xB8, 0xB8, 0xB8, 0xE3, 0xE3, 0xE3, 0x54, 0x54, 0x54, 0x5A, 0x54, 0x5B, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x62, 0x68, 0x68, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x6F, 0x6F, 0x76, 0x70, 0x76, + 0x76, 0x76, 0x76, 0x7D, 0x7D, 0x7D, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x68, 0x92, 0x68, 0x92, + 0x68, 0x92, 0x68, 0x92, 0x68, 0x92, 0x68, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x00, 0x02, 0x02, 0x32, 0x02, 0x32, 0x08, 0x38, 0x32, 0x62, 0x32, + 0x62, 0x38, 0x68, 0x62, 0x92, 0x68, 0x92, 0x68, 0x98, 0x92, 0xC2, 0x98, 0xC8, 0x98, 0xC8, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xF8, 0x12, 0x0C, 0x3D, 0x0C, 0x3D, 0x0C, 0x3D, 0x37, 0x68, 0x37, + 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x62, 0x93, 0x8D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xE9, 0xB8, 0xE9, 0xB8, 0xE9, 0xE3, 0x54, 0x54, 0x5B, 0x54, 0x5B, 0x5A, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x68, 0x62, 0x69, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x6F, 0x76, 0x6F, 0x76, 0x70, + 0x77, 0x76, 0x7D, 0x76, 0x7D, 0x7D, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, + 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, 0x93, 0x62, + 0x93, 0x8C, 0x93, 0x8C, 0x93, 0x00, 0x02, 0x02, 0x02, 0x02, 0x08, 0x32, 0x32, 0x32, 0x32, 0x62, + 0x38, 0x62, 0x62, 0x68, 0x62, 0x68, 0x68, 0x92, 0x92, 0x98, 0x98, 0xC2, 0x98, 0xC2, 0xC8, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xF8, 0x0C, 0x12, 0x0C, 0x0C, 0x0C, 0x3D, 0x37, 0x37, 0x37, 0x68, + 0x37, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x93, 0x8D, 0x8D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xB8, 0xB8, 0xB8, 0xE9, 0xE3, 0xE3, 0x54, 0x54, 0x54, 0x54, 0x5A, 0x5B, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x62, 0x68, 0x62, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x70, 0x6F, 0x70, 0x76, 0x76, + 0x76, 0x76, 0x76, 0x7D, 0x7D, 0x7D, 0x68, 0x93, 0x68, 0x68, 0x68, 0x93, 0x68, 0x92, 0x68, 0x93, + 0x68, 0x92, 0x92, 0x93, 0x68, 0x92, 0x92, 0x93, 0x68, 0x92, 0x92, 0x93, 0x92, 0x92, 0x92, 0x93, + 0x92, 0x92, 0x92, 0x93, 0x92, 0x00, 0x03, 0x02, 0x08, 0x02, 0x33, 0x08, 0x32, 0x32, 0x63, 0x32, + 0x62, 0x38, 0x69, 0x62, 0x68, 0x62, 0x99, 0x68, 0x98, 0x92, 0xC3, 0x98, 0xC8, 0x98, 0xC9, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xF8, 0x12, 0x0C, 0x12, 0x0C, 0x3D, 0x0C, 0x3D, 0x37, 0x68, 0x37, + 0x68, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x62, 0x93, 0x8D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xBE, 0xB8, 0xE9, 0xB8, 0xE9, 0xE3, 0x7E, 0x54, 0x5A, 0x54, 0x85, 0x5A, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x92, 0x62, 0x68, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x6F, 0x76, 0x6F, 0xA0, 0x76, + 0x76, 0x76, 0xA7, 0x76, 0x7D, 0x7D, 0x93, 0x68, 0x93, 0x62, 0x93, 0x68, 0x93, 0x62, 0x93, 0x68, + 0x93, 0x62, 0x93, 0x68, 0x93, 0x62, 0x93, 0x68, 0x93, 0x62, 0x93, 0x92, 0x93, 0x62, 0x93, 0x92, + 0x93, 0x62, 0x93, 0x92, 0x93, 0x00, 0x02, 0x02, 0x02, 0x08, 0x02, 0x32, 0x32, 0x32, 0x32, 0x38, + 0x38, 0x62, 0x62, 0x68, 0x68, 0x68, 0x68, 0x92, 0x92, 0x98, 0x98, 0x98, 0x98, 0xC8, 0xC2, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xF8, 0x0C, 0x12, 0x12, 0x12, 0x0C, 0x3D, 0x37, 0x3D, 0x37, 0x3D, + 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x93, 0x93, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xBE, 0xE9, 0xB8, 0xE9, 0xE3, 0xE9, 0x54, 0x54, 0x54, 0x5A, 0x54, 0x5B, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x62, 0x68, 0x68, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x6F, 0x6F, 0x76, 0x70, 0x76, + 0x76, 0x77, 0x76, 0x7D, 0x7D, 0x7D, 0x68, 0x92, 0x68, 0x93, 0x68, 0x92, 0x68, 0x93, 0x68, 0x92, + 0x68, 0x93, 0x68, 0x92, 0x92, 0x93, 0x92, 0x92, 0x92, 0x93, 0x92, 0x92, 0x92, 0x93, 0x92, 0x92, + 0x92, 0x93, 0x92, 0x92, 0x92, 0x00, 0x03, 0x02, 0x33, 0x02, 0x33, 0x08, 0x33, 0x32, 0x63, 0x32, + 0x63, 0x38, 0x69, 0x62, 0x93, 0x68, 0x93, 0x68, 0x99, 0x92, 0xC3, 0x98, 0xC9, 0x98, 0xC9, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x93, 0x62, 0x93, 0x8D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xE9, 0xB8, 0xE9, 0xB8, 0xE9, 0x00, 0x00, 0x54, 0x85, 0x54, 0x85, 0x5A, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x92, 0x62, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0x93, 0x62, 0x93, 0x68, 0x93, 0x68, + 0x93, 0x68, 0x93, 0x62, 0x93, 0x68, 0x93, 0x68, 0x93, 0x68, 0x93, 0x62, 0x93, 0x92, 0x93, 0x92, + 0x93, 0x92, 0x93, 0x8C, 0x93, 0x00, 0x02, 0x03, 0x02, 0x02, 0x08, 0x33, 0x32, 0x32, 0x32, 0x63, + 0x38, 0x62, 0x62, 0x69, 0x62, 0x68, 0x92, 0x93, 0x92, 0x98, 0x98, 0xC3, 0x98, 0xC2, 0xC8, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x93, 0x93, 0x93, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xBE, 0xBE, 0xBE, 0xE9, 0x00, 0x00, 0x00, 0x00, 0x54, 0x54, 0x5A, 0x85, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x62, 0x92, 0x62, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x93, 0x68, 0x92, 0x92, 0x93, + 0x68, 0x92, 0x92, 0x93, 0x68, 0x92, 0x92, 0x93, 0x92, 0x92, 0x92, 0x93, 0x92, 0x92, 0x92, 0x93, + 0x92, 0x92, 0x92, 0x93, 0x92, 0x00, 0x03, 0x02, 0x09, 0x02, 0x33, 0x08, 0x33, 0x32, 0x63, 0x32, + 0x63, 0x38, 0x69, 0x62, 0x69, 0x62, 0x99, 0x68, 0x99, 0x92, 0xC3, 0x98, 0xC3, 0x98, 0xC9, 0x00, + 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, + 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x62, 0x93, 0x68, 0x93, 0x8D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xBE, 0xB8, 0xE9, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x54, 0x85, 0x5A, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x92, 0x62, 0x92, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, + 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x93, 0x62, 0x93, 0x68, + 0x93, 0x68, 0x93, 0x68, 0x93, 0x62, 0x93, 0x92, 0x93, 0x68, 0x93, 0x92, 0x93, 0x62, 0x93, 0x92, + 0x93, 0x92, 0x93, 0x92, 0x93, 0x00, 0x02, 0x03, 0x02, 0x09, 0x02, 0x33, 0x32, 0x33, 0x32, 0x39, + 0x38, 0x63, 0x62, 0x69, 0x68, 0x93, 0x68, 0x93, 0x92, 0x99, 0x98, 0x99, 0x98, 0xC9, 0xC2, 0x00, + 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, + 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x93, 0x68, 0x93, 0x93, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xBE, 0xBE, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x54, 0x85, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x62, 0x92, 0x68, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, + 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x93, 0x68, 0x93, + 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, + 0x92, 0x93, 0x92, 0x93, 0x92, 0x00, 0x03, 0x02, 0x33, 0x02, 0x33, 0x08, 0x39, 0x32, 0x63, 0x32, + 0x63, 0x38, 0x69, 0x62, 0x93, 0x68, 0x93, 0x68, 0x99, 0x92, 0xC3, 0x98, 0xC9, 0x98, 0xC9, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x93, 0x68, 0x99, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xEF, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x5A, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x92, 0x62, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x93, 0x68, + 0x93, 0x68, 0x93, 0x68, 0x93, 0x68, 0x93, 0x68, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, + 0x93, 0x92, 0x93, 0x92, 0xBD, 0x00, 0x03, 0x03, 0x02, 0x03, 0x09, 0x33, 0x32, 0x33, 0x33, 0x63, + 0x38, 0x63, 0x63, 0x69, 0x62, 0x69, 0x69, 0x93, 0x92, 0x99, 0x99, 0xC3, 0x98, 0xC3, 0xC9, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x93, 0x93, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x8C, 0x92, 0x62, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x93, 0x92, 0x93, + 0x68, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, + 0x92, 0x93, 0x92, 0x93, 0x92, 0x00, 0x03, 0x02, 0x09, 0x02, 0x33, 0x08, 0x33, 0x32, 0x63, 0x32, + 0x63, 0x38, 0x69, 0x62, 0x69, 0x62, 0x99, 0x68, 0x99, 0x92, 0xC3, 0x98, 0xC9, 0x98, 0xC9, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xF8, 0x18, 0x12, 0x18, 0x12, 0x43, 0x12, 0x43, 0x3D, 0x6E, 0x3D, + 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x99, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xE9, 0x7E, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x92, 0x62, 0x92, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x6F, 0xA0, 0x6F, 0xA0, 0x76, + 0xA0, 0x76, 0xA7, 0x76, 0xA7, 0x7D, 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x99, 0x68, + 0x93, 0x68, 0x99, 0x92, 0x93, 0x68, 0x99, 0x92, 0x93, 0x68, 0x99, 0x92, 0x93, 0x92, 0x99, 0x92, + 0x93, 0x92, 0xC3, 0x92, 0x93, 0x00, 0x03, 0x03, 0x03, 0x09, 0x03, 0x33, 0x33, 0x33, 0x33, 0x39, + 0x39, 0x63, 0x63, 0x69, 0x69, 0x69, 0x69, 0x93, 0x93, 0x99, 0x99, 0x99, 0x99, 0xC9, 0xC3, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xF9, 0x12, 0x18, 0x12, 0x18, 0x12, 0x3D, 0x3D, 0x43, 0x3D, 0x43, + 0x3D, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x99, 0x93, 0x99, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xFB, 0xFB, 0x00, 0x00, 0xE9, 0xEF, 0x7E, 0x7E, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x8C, 0x92, 0x92, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x99, 0x99, 0xA0, 0x9A, 0xA0, + 0xA0, 0xA1, 0xA0, 0xA7, 0xA7, 0xA7, 0x68, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x93, 0x92, 0x93, + 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, + 0x92, 0x93, 0x92, 0x93, 0x92, 0x00, 0x03, 0x03, 0x33, 0x03, 0x33, 0x08, 0x33, 0x33, 0x63, 0x33, + 0x63, 0x39, 0x69, 0x62, 0x93, 0x69, 0x93, 0x69, 0x99, 0x93, 0xC3, 0x98, 0xC9, 0x99, 0xC9, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xF9, 0x18, 0x12, 0x43, 0x12, 0x43, 0x12, 0x43, 0x3D, 0x6E, 0x3D, + 0x6E, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x99, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0xFB, + 0xFB, 0x00, 0x00, 0xBE, 0xEF, 0xE9, 0x7E, 0x7E, 0x85, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x92, 0x62, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x6F, 0xA0, 0x99, 0xA0, 0x9A, + 0xA1, 0xA0, 0xA7, 0x76, 0xA7, 0xA7, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x93, 0x68, + 0x99, 0x68, 0x93, 0x68, 0x93, 0x92, 0x93, 0x92, 0x99, 0x92, 0x93, 0x92, 0x93, 0x92, 0x93, 0x92, + 0xC3, 0x92, 0x93, 0x92, 0xBD, 0x00, 0x03, 0x03, 0x03, 0x03, 0x09, 0x33, 0x33, 0x33, 0x33, 0x63, + 0x39, 0x63, 0x63, 0x69, 0x63, 0x69, 0x93, 0x93, 0x93, 0x99, 0x99, 0xC3, 0x99, 0xC3, 0xC9, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0xF9, 0x18, 0x18, 0x12, 0x18, 0x18, 0x43, 0x3D, 0x43, 0x43, 0x6E, + 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x99, 0x93, 0x99, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0xFB, + 0x00, 0x00, 0xC4, 0xEF, 0xE9, 0xEF, 0x7E, 0x7E, 0x7E, 0x7E, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0xFB, + 0x00, 0x00, 0x8C, 0x92, 0x8C, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x9A, 0x99, 0x9A, 0xA0, 0xA0, + 0xA0, 0xA0, 0xA0, 0xA7, 0xA7, 0xA7, 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x93, 0x93, 0x93, + 0x92, 0x93, 0x93, 0x93, 0x92, 0x93, 0x93, 0x93, 0x92, 0x93, 0x93, 0x93, 0x92, 0x93, 0x93, 0x93, + 0x92, 0x93, 0x93, 0x93, 0x92, 0x00, 0x04, 0x03, 0x09, 0x03, 0x34, 0x09, 0x33, 0x33, 0x64, 0x33, + 0x63, 0x39, 0x6A, 0x63, 0x69, 0x63, 0x9A, 0x69, 0x99, 0x93, 0xC4, 0x99, 0xC3, 0x99, 0xCA, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x99, 0x93, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0x00, + 0x00, 0xBE, 0xEF, 0xBE, 0xEF, 0xE9, 0xA8, 0x7E, 0x84, 0x7E, 0xAF, 0x00, 0x00, 0xFB, 0xFB, 0xFB, + 0x00, 0x00, 0xBC, 0x8C, 0x92, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x68, 0x99, 0x92, + 0x93, 0x68, 0x99, 0x92, 0x93, 0x68, 0x99, 0x92, 0x93, 0x92, 0x99, 0x92, 0x93, 0x92, 0xC3, 0x92, + 0x93, 0x92, 0xC3, 0x92, 0x93, 0x00, 0x03, 0x03, 0x03, 0x09, 0x03, 0x33, 0x33, 0x33, 0x33, 0x39, + 0x39, 0x63, 0x63, 0x69, 0x69, 0x93, 0x69, 0x93, 0x93, 0x99, 0x99, 0x99, 0x99, 0xC9, 0xC3, 0x00, + 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x99, 0x99, 0x99, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, + 0xC4, 0xC4, 0xC4, 0xEF, 0xEF, 0xEF, 0x7E, 0x7E, 0x7E, 0x84, 0x7E, 0x85, 0x00, 0x00, 0xFB, 0xFB, + 0x00, 0x00, 0x8C, 0x92, 0x92, 0x00, 0x00, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x93, 0x92, 0x93, + 0x93, 0x93, 0x92, 0x93, 0x93, 0x93, 0x92, 0x93, 0x93, 0x93, 0x92, 0x93, 0x93, 0x93, 0x92, 0x93, + 0x93, 0x93, 0x92, 0x93, 0x93, 0x00, 0x04, 0x03, 0x34, 0x03, 0x34, 0x09, 0x3A, 0x33, 0x64, 0x33, + 0x64, 0x39, 0x6A, 0x63, 0x94, 0x69, 0x94, 0x69, 0x9A, 0x93, 0xC4, 0x99, 0xCA, 0x99, 0xCA, 0x00, + 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, + 0xFB, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x68, 0x99, 0x99, 0x00, 0x00, 0xFB, 0x00, 0x00, 0xBE, + 0xEF, 0xC4, 0xEF, 0xBE, 0xEF, 0xEF, 0xA8, 0x7E, 0xAF, 0x7E, 0xAF, 0x84, 0xB5, 0x00, 0x00, 0xFB, + 0x00, 0x00, 0xBC, 0x8C, 0xBD, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, + 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x68, 0x99, 0x68, + 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, 0xC3, 0x92, 0x99, 0x92, + 0xC3, 0x92, 0xC3, 0x92, 0xC3, 0x00, 0x03, 0x04, 0x03, 0x03, 0x09, 0x34, 0x33, 0x33, 0x33, 0x64, + 0x39, 0x63, 0x63, 0x6A, 0x63, 0x69, 0x69, 0x94, 0x93, 0x99, 0x99, 0xC4, 0x99, 0xC3, 0xC9, 0x00, + 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, + 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x6E, 0x99, 0x99, 0x99, 0x00, 0x00, 0x00, 0x00, 0xC4, 0xC4, + 0xC4, 0xC4, 0xC4, 0xEF, 0xEF, 0xEF, 0x7E, 0xA8, 0x7E, 0x7E, 0x84, 0xAF, 0x85, 0x85, 0x00, 0x00, + 0x00, 0x00, 0x8C, 0xBC, 0x8C, 0x00, 0x00, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, + 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0xFB, 0x00, 0x00, 0x00, 0x92, 0x93, 0x93, 0x93, + 0x92, 0x93, 0x93, 0x93, 0x92, 0x93, 0x93, 0x93, 0x92, 0x93, 0x93, 0x93, 0x92, 0x93, 0x93, 0x93, + 0x92, 0x93, 0x93, 0x93, 0x92, 0x00, 0x04, 0x03, 0x0A, 0x03, 0x34, 0x09, 0x34, 0x33, 0x64, 0x33, + 0x64, 0x39, 0x6A, 0x63, 0x6A, 0x63, 0x9A, 0x69, 0x9A, 0x93, 0xC4, 0x99, 0xCA, 0x99, 0xCA, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x6E, 0x9F, 0x6E, 0x99, 0x99, 0x00, 0x00, 0x00, 0x99, 0xCA, 0xC4, + 0xC4, 0xC4, 0xF5, 0xC4, 0xEF, 0xEF, 0xA8, 0x7E, 0xAE, 0x7E, 0xAF, 0x84, 0xAF, 0x85, 0xB6, 0x00, + 0x00, 0x00, 0xBC, 0x8C, 0xBC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x99, 0x68, 0x99, 0x92, + 0x99, 0x68, 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, 0xC3, 0x92, 0x99, 0x92, 0xC3, 0x92, + 0x99, 0x92, 0xC3, 0x92, 0xC3, 0x00, 0x03, 0x04, 0x03, 0x0A, 0x03, 0x34, 0x33, 0x34, 0x33, 0x3A, + 0x39, 0x64, 0x63, 0x6A, 0x69, 0x6A, 0x69, 0x94, 0x93, 0x9A, 0x99, 0x9A, 0x99, 0xCA, 0xC3, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x6E, 0x6E, 0x6E, 0x6E, 0x99, 0x99, 0x99, 0x00, 0x00, 0x99, 0xC4, 0xC4, 0xC4, + 0xC4, 0xEF, 0xC4, 0xEF, 0xEF, 0xEF, 0x7E, 0xA8, 0x7E, 0xAE, 0x7E, 0xAF, 0x85, 0xAF, 0x85, 0xB5, + 0x00, 0x00, 0x8C, 0xBC, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x00, 0x04, 0x03, 0x34, 0x03, 0x34, 0x09, 0x34, 0x33, 0x64, 0x33, + 0x64, 0x39, 0x6A, 0x63, 0x94, 0x69, 0x94, 0x69, 0x9A, 0x93, 0xC4, 0x99, 0xCA, 0x99, 0xCA, 0xC3, + 0xF4, 0xC9, 0xFA, 0xC9, 0xFA, 0xF9, 0x1E, 0x18, 0x49, 0x18, 0x49, 0x18, 0x49, 0x43, 0x74, 0x43, + 0x74, 0x43, 0x74, 0x6E, 0x9F, 0x6E, 0x9F, 0x6E, 0x9F, 0x99, 0xCA, 0x99, 0xCA, 0x99, 0xCA, 0xC4, + 0xF5, 0xC4, 0xF5, 0xC4, 0xF5, 0xEF, 0xA8, 0x7E, 0xAF, 0x7E, 0xAF, 0x84, 0xAF, 0x85, 0xB6, 0x85, + 0xB6, 0x8B, 0xBC, 0x8C, 0xBD, 0x92, 0xBD, 0x92, 0xC3, 0x93, 0xC4, 0x99, 0xCA, 0x99, 0xCA, 0x9A, + 0xCB, 0xA0, 0xD1, 0xA0, 0xD1, 0xA7, 0x99, 0x68, 0x99, 0x68, 0x99, 0x68, 0x99, 0x92, 0x99, 0x92, + 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, 0xC3, 0x92, 0x99, 0x92, 0xC3, 0x92, 0xC3, 0x92, + 0xC3, 0x92, 0xC3, 0x92, 0xC3, 0x00, 0x04, 0x04, 0x03, 0x04, 0x0A, 0x34, 0x33, 0x34, 0x34, 0x64, + 0x39, 0x64, 0x64, 0x6A, 0x63, 0x6A, 0x94, 0x94, 0x93, 0x9A, 0x9A, 0xC4, 0x99, 0xC4, 0xCA, 0xCA, + 0xC9, 0xCA, 0xCA, 0xFA, 0xF9, 0xFA, 0x18, 0x1E, 0x18, 0x18, 0x18, 0x49, 0x43, 0x43, 0x43, 0x74, + 0x43, 0x6E, 0x6E, 0x74, 0x6E, 0x6E, 0x99, 0x9F, 0x99, 0x99, 0x99, 0xCA, 0x99, 0xC4, 0xC4, 0xCA, + 0xC4, 0xC4, 0xC4, 0xF5, 0xEF, 0xEF, 0xA8, 0xA8, 0x7E, 0xA8, 0xAE, 0xAF, 0x85, 0xAF, 0xAF, 0xB6, + 0x8B, 0xB6, 0xB6, 0xBC, 0x8C, 0xBC, 0xBD, 0xBD, 0x93, 0xC3, 0xC3, 0xC4, 0x99, 0xC4, 0xCA, 0xCA, + 0xA0, 0xCA, 0xCA, 0xD1, 0xA7, 0xD1, 0x93, 0x99, 0x93, 0x93, 0x93, 0x93, 0x92, 0x93, 0x93, 0x99, + 0x93, 0x93, 0x93, 0x93, 0x92, 0x93, 0x93, 0x99, 0x93, 0x93, 0x93, 0x93, 0x92, 0x93, 0x93, 0x99, + 0x93, 0x93, 0x93, 0xBD, 0x92, 0x00, 0x04, 0x03, 0x0A, 0x03, 0x34, 0x09, 0x34, 0x33, 0x64, 0x33, + 0x64, 0x39, 0x6A, 0x63, 0x6A, 0x63, 0x9A, 0x69, 0x9A, 0x93, 0xC4, 0x99, 0xC4, 0x99, 0xCA, 0xC9, + 0xCA, 0xC9, 0xFA, 0xC9, 0xFA, 0xF9, 0x1E, 0x18, 0x1E, 0x18, 0x49, 0x18, 0x49, 0x43, 0x74, 0x43, + 0x74, 0x43, 0x74, 0x6E, 0x74, 0x6E, 0x9F, 0x6E, 0x9F, 0x99, 0xCA, 0x99, 0xCA, 0x99, 0xCA, 0xC4, + 0xCA, 0xC4, 0xF5, 0xC4, 0xF5, 0xEF, 0xA8, 0x7E, 0xAE, 0x7E, 0xAF, 0x84, 0xAF, 0x85, 0xB6, 0x85, + 0xB6, 0x8B, 0xBC, 0x8C, 0xBC, 0x8C, 0xC3, 0x92, 0xC3, 0x93, 0xC4, 0x99, 0xC4, 0x99, 0xCA, 0xA0, + 0xCA, 0xA0, 0xD1, 0xA0, 0xD1, 0xA7, 0x99, 0x93, 0x99, 0x68, 0x99, 0x92, 0x99, 0x68, 0x99, 0x93, + 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, 0xC3, 0x93, 0x99, 0x92, 0xC3, 0x92, 0x99, 0x92, 0xC3, 0x93, + 0xC3, 0x92, 0xC3, 0x92, 0xC3, 0x00, 0x04, 0x04, 0x04, 0x0A, 0x04, 0x34, 0x34, 0x34, 0x34, 0x3A, + 0x3A, 0x64, 0x64, 0x6A, 0x6A, 0x94, 0x6A, 0x94, 0x94, 0x9A, 0x9A, 0x9A, 0x9A, 0xCA, 0xC4, 0xCA, + 0xCA, 0xCA, 0xCA, 0xFA, 0xFA, 0xFA, 0x18, 0x1E, 0x18, 0x1E, 0x18, 0x49, 0x43, 0x49, 0x43, 0x49, + 0x43, 0x74, 0x6E, 0x74, 0x6E, 0x9F, 0x6E, 0x9F, 0x99, 0x9F, 0x99, 0x9F, 0x99, 0xCA, 0xC4, 0xCA, + 0xC4, 0xCA, 0xC4, 0xF5, 0xEF, 0xF5, 0xA8, 0xA8, 0xA8, 0xAE, 0xA8, 0xAF, 0xAF, 0xAF, 0xAF, 0xB5, + 0xB5, 0xB6, 0xB6, 0xBC, 0xBC, 0xBD, 0xBC, 0xBD, 0xBD, 0xC3, 0xC3, 0xC3, 0xC3, 0xCA, 0xC4, 0xCA, + 0xCA, 0xCA, 0xCA, 0xD1, 0xD1, 0xD1, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x99, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x99, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x93, 0x99, 0x93, 0x93, + 0x93, 0x93, 0x93, 0x93, 0x93, 0x00, 0x04, 0x03, 0x34, 0x04, 0x34, 0x09, 0x3A, 0x34, 0x64, 0x33, + 0x64, 0x3A, 0x6A, 0x63, 0x94, 0x6A, 0x94, 0x69, 0x9A, 0x94, 0xC4, 0x99, 0xCA, 0x9A, 0xCA, 0xC3, + 0xF4, 0xCA, 0xFA, 0xC9, 0xFA, 0xFA, 0x1E, 0x18, 0x49, 0x18, 0x49, 0x18, 0x49, 0x43, 0x74, 0x43, + 0x74, 0x43, 0x74, 0x6E, 0x9F, 0x6E, 0x9F, 0x6E, 0x9F, 0x99, 0xCA, 0x99, 0xCA, 0x99, 0xCA, 0xC4, + 0xF5, 0xC4, 0xF5, 0xC4, 0xF5, 0xEF, 0xA8, 0x7E, 0xAF, 0xA8, 0xAF, 0x84, 0xB5, 0xAF, 0xB6, 0x85, + 0xB6, 0xB5, 0xBC, 0x8C, 0xBD, 0xBC, 0xBD, 0x92, 0xC3, 0xBD, 0xC4, 0x99, 0xCA, 0xC3, 0xCA, 0x9A, + 0xCB, 0xCA, 0xD1, 0xA0, 0xD1, 0xD1, 0x99, 0x68, 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, 0x99, 0x92, + 0x99, 0x92, 0x99, 0x92, 0xC3, 0x92, 0x99, 0x92, 0xC3, 0x92, 0xC3, 0x92, 0xC3, 0x92, 0xC3, 0x92, + 0xC3, 0x92, 0xC3, 0x92, 0xC3, 0x00, 0x04, 0x04, 0x04, 0x04, 0x0A, 0x34, 0x34, 0x34, 0x34, 0x64, + 0x3A, 0x64, 0x64, 0x6A, 0x64, 0x6A, 0x6A, 0x94, 0x94, 0x9A, 0x9A, 0xC4, 0x9A, 0xC4, 0xCA, 0xCA, + 0xCA, 0xCA, 0xCA, 0xFA, 0xFA, 0xFA, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x49, 0x49, 0x49, 0x49, 0x74, + 0x49, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x9F, 0x9F, 0x9F, 0x9F, 0xCA, 0x9F, 0xCA, 0xCA, 0xCA, + 0xCA, 0xCA, 0xCA, 0xF5, 0xF5, 0xF5, 0xA8, 0xA8, 0xA8, 0xA8, 0xAE, 0xAF, 0xAF, 0xAF, 0xAF, 0xB6, + 0xB5, 0xB6, 0xB6, 0xBC, 0xB6, 0xBC, 0xBC, 0xBD, 0xBD, 0xC3, 0xC3, 0xC4, 0xC3, 0xC4, 0xCA, 0xCA, + 0xCA, 0xCA, 0xCA, 0xD1, 0xD1, 0xD1, 0x93, 0x99, 0x93, 0x93, 0x93, 0x99, 0x93, 0x93, 0x93, 0x99, + 0x93, 0x93, 0x93, 0x99, 0x93, 0x93, 0x93, 0x99, 0x93, 0x93, 0x93, 0x99, 0x93, 0x93, 0x93, 0xC3, + 0x93, 0x93, 0x93, 0xC3, 0x93, 0x00, 0x05, 0x04, 0x0A, 0x04, 0x35, 0x0A, 0x34, 0x34, 0x65, 0x34, + 0x64, 0x3A, 0x6B, 0x64, 0x6A, 0x64, 0x9B, 0x6A, 0x9A, 0x94, 0xC5, 0x9A, 0xCA, 0x9A, 0xCB, 0xCA, + 0xCA, 0xCA, 0xFB, 0xCA, 0xFA, 0xFA, 0x1E, 0x1E, 0x1E, 0x18, 0x49, 0x1E, 0x49, 0x43, 0x74, 0x49, + 0x74, 0x43, 0x74, 0x74, 0x74, 0x6E, 0x9F, 0x74, 0x9F, 0x99, 0xCA, 0x9F, 0xCA, 0x99, 0xCA, 0xCA, + 0xCA, 0xC4, 0xF5, 0xCA, 0xF5, 0xEF, 0xD2, 0xA8, 0xAE, 0xA8, 0xD9, 0xAE, 0xAF, 0xAF, 0xE0, 0xAF, + 0xB6, 0xB5, 0xE6, 0xB6, 0xBC, 0xB6, 0xED, 0xBC, 0xC3, 0xBD, 0xEE, 0xC3, 0xCA, 0xC3, 0xF4, 0xCA, + 0xCA, 0xCA, 0xFB, 0xCA, 0xD1, 0xD1, 0x99, 0x93, 0x99, 0x68, 0x99, 0x93, 0x99, 0x92, 0x99, 0x93, + 0x99, 0x92, 0xC3, 0x93, 0x99, 0x92, 0xC3, 0x93, 0x99, 0x92, 0xC3, 0x93, 0xC3, 0x92, 0xC3, 0x93, + 0xC3, 0x92, 0xC3, 0x93, 0xC3, 0x00, 0x04, 0x04, 0x04, 0x0A, 0x04, 0x34, 0x34, 0x34, 0x34, 0x3A, + 0x3A, 0x64, 0x64, 0x6A, 0x6A, 0x6A, 0x6A, 0x94, 0x94, 0x9A, 0x9A, 0x9A, 0x9A, 0xCA, 0xC4, 0xCA, + 0xCA, 0xF4, 0xCA, 0xFA, 0xFA, 0xFA, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x49, 0x49, 0x49, 0x49, 0x49, + 0x49, 0x74, 0x74, 0x74, 0x74, 0x74, 0x74, 0x9F, 0x9F, 0x9F, 0x9F, 0x9F, 0x9F, 0xCA, 0xCA, 0xCA, + 0xCA, 0xF5, 0xCA, 0xF5, 0xF5, 0xF5, 0xA8, 0xA8, 0xA8, 0xAE, 0xA8, 0xAF, 0xAF, 0xAF, 0xAF, 0xB5, + 0xB5, 0xB6, 0xB6, 0xBC, 0xBC, 0xBC, 0xBC, 0xBD, 0xBD, 0xC3, 0xC3, 0xC3, 0xC3, 0xCA, 0xC4, 0xCA, + 0xCA, 0xCB, 0xCA, 0xD1, 0xD1, 0xD1, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, + 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, + 0x93, 0xC3, 0x93, 0x99, 0x93, 0x00, 0x05, 0x04, 0x35, 0x04, 0x35, 0x0A, 0x35, 0x34, 0x65, 0x34, + 0x65, 0x3A, 0x6B, 0x64, 0x95, 0x6A, 0x95, 0x6A, 0x9B, 0x94, 0xC5, 0x9A, 0xCB, 0x9A, 0xCB, 0xC4, + 0xF5, 0xCA, 0xFB, 0xCA, 0xFB, 0xFA, 0x1E, 0x1E, 0x49, 0x1E, 0x49, 0x1E, 0x49, 0x49, 0x74, 0x49, + 0x74, 0x49, 0x74, 0x74, 0x9F, 0x74, 0x9F, 0x74, 0x9F, 0x9F, 0xCA, 0x9F, 0xCA, 0x9F, 0xCA, 0xCA, + 0xF5, 0xCA, 0xF5, 0xCA, 0xF5, 0xF5, 0xD2, 0xA8, 0xD9, 0xA8, 0xD9, 0xAE, 0xD9, 0xAF, 0xE0, 0xAF, + 0xE0, 0xB5, 0xE6, 0xB6, 0xE7, 0xBC, 0xE7, 0xBC, 0xED, 0xBD, 0xEE, 0xC3, 0xF4, 0xC3, 0xF4, 0xC4, + 0xF5, 0xCA, 0xFB, 0xCA, 0xFB, 0xD1, 0x99, 0x93, 0x99, 0x93, 0x99, 0x92, 0x99, 0x93, 0x99, 0x93, + 0xC3, 0x93, 0x99, 0x92, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x92, 0xC3, 0x93, 0xC3, 0x93, + 0xC3, 0x93, 0xC3, 0x92, 0xC3, 0x00, 0x04, 0x04, 0x04, 0x04, 0x0A, 0x34, 0x34, 0x34, 0x34, 0x64, + 0x3A, 0x64, 0x64, 0x6A, 0x64, 0x6A, 0x94, 0x94, 0x94, 0x9A, 0x9A, 0xC4, 0x9A, 0xC4, 0xCA, 0xCA, + 0xCA, 0xCA, 0xCA, 0xFA, 0xFA, 0xFA, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x49, 0x49, 0x49, 0x49, 0x74, + 0x49, 0x74, 0x74, 0x74, 0x74, 0x74, 0x9F, 0x9F, 0x9F, 0x9F, 0x9F, 0xCA, 0x9F, 0xCA, 0xCA, 0xCA, + 0xCA, 0xCA, 0xCA, 0xF5, 0xF5, 0xF5, 0xA8, 0xA8, 0xA8, 0xA8, 0xAE, 0xAF, 0xAF, 0xAF, 0xAF, 0xB6, + 0xB5, 0xB6, 0xB6, 0xBC, 0xB6, 0xBC, 0xBD, 0xBD, 0xBD, 0xC3, 0xC3, 0xC4, 0xC3, 0xC4, 0xCA, 0xCA, + 0xCA, 0xCA, 0xCA, 0xD1, 0xD1, 0xD1, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x93, 0x93, 0x99, + 0x93, 0x99, 0x93, 0x99, 0x93, 0x93, 0x93, 0x99, 0x93, 0x99, 0x93, 0xC3, 0x93, 0x93, 0x93, 0xC3, + 0x93, 0x99, 0x93, 0xC3, 0x93, 0x00, 0x05, 0x04, 0x0B, 0x04, 0x35, 0x0A, 0x35, 0x34, 0x65, 0x34, + 0x65, 0x3A, 0x6B, 0x64, 0x6B, 0x64, 0x9B, 0x6A, 0x9B, 0x94, 0xC5, 0x9A, 0xC5, 0x9A, 0xCB, 0xCA, + 0xCB, 0xCA, 0xFB, 0xCA, 0xFB, 0xFA, 0x24, 0x1E, 0x24, 0x1E, 0x4F, 0x1E, 0x49, 0x49, 0x7A, 0x49, + 0x7A, 0x49, 0x7A, 0x74, 0x74, 0x74, 0xA5, 0x74, 0xA5, 0x9F, 0xD0, 0x9F, 0xCA, 0x9F, 0xD0, 0xCA, + 0xD0, 0xCA, 0xFB, 0xCA, 0xF5, 0xF5, 0xD2, 0xA8, 0xD8, 0xA8, 0xD9, 0xAE, 0xD9, 0xAF, 0xE0, 0xAF, + 0xE0, 0xB5, 0xE6, 0xB6, 0xE6, 0xB6, 0xED, 0xBC, 0xED, 0xBD, 0xEE, 0xC3, 0xEE, 0xC3, 0xF4, 0xCA, + 0xF4, 0xCA, 0xFB, 0xCA, 0xFB, 0xD1, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x92, 0xC3, 0x93, + 0x99, 0x93, 0xC3, 0x93, 0x99, 0x92, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x92, 0xC3, 0x93, + 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x00, 0x04, 0x04, 0x04, 0x0B, 0x04, 0x35, 0x34, 0x35, 0x34, 0x3A, + 0x3A, 0x65, 0x64, 0x6B, 0x6A, 0x95, 0x6A, 0x94, 0x94, 0x9B, 0x9A, 0x9B, 0x9A, 0xCB, 0xC4, 0xCA, + 0xCA, 0xCB, 0xCA, 0xFB, 0xFA, 0xFB, 0x1E, 0x1E, 0x1E, 0x1E, 0x1E, 0x49, 0x49, 0x49, 0x49, 0x49, + 0x49, 0x74, 0x74, 0x74, 0x74, 0x9F, 0x74, 0x9F, 0x9F, 0x9F, 0x9F, 0x9F, 0x9F, 0xCA, 0xCA, 0xCA, + 0xCA, 0xCA, 0xCA, 0xF5, 0xF5, 0xF5, 0xA8, 0xA8, 0xA8, 0xD8, 0xA8, 0xD9, 0xAF, 0xD9, 0xAF, 0xB5, + 0xB5, 0xE0, 0xB6, 0xE6, 0xBC, 0xE7, 0xBC, 0xBD, 0xBD, 0xED, 0xC3, 0xED, 0xC3, 0xF4, 0xC4, 0xCA, + 0xCA, 0xF4, 0xCA, 0xFB, 0xD1, 0xFB, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, + 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0xC3, 0x93, 0xC3, + 0x93, 0xC3, 0x93, 0xC3, 0x93, 0x00, 0x05, 0x04, 0x35, 0x04, 0x35, 0x0A, 0x3B, 0x34, 0x65, 0x34, + 0x65, 0x3A, 0x6B, 0x64, 0x95, 0x6A, 0x95, 0x6A, 0x9B, 0x94, 0xC5, 0x9A, 0xCB, 0x9A, 0xCB, 0xC4, + 0xF5, 0xCA, 0xFB, 0xCA, 0xFB, 0xFA, 0x24, 0x1E, 0x4F, 0x1E, 0x4F, 0x1E, 0x4F, 0x49, 0x7A, 0x49, + 0x7A, 0x49, 0x7A, 0x74, 0xA5, 0x74, 0xA5, 0x74, 0xA5, 0x9F, 0xD0, 0x9F, 0xD0, 0x9F, 0xD0, 0xCA, + 0xFB, 0xCA, 0xFB, 0xCA, 0xFB, 0xF5, 0xD2, 0xA8, 0xD9, 0xA8, 0xD9, 0xAE, 0xDF, 0xAF, 0xE0, 0xAF, + 0xE0, 0xB5, 0xE6, 0xB6, 0xE7, 0xBC, 0xE7, 0xBC, 0xED, 0xBD, 0xEE, 0xC3, 0xF4, 0xC3, 0xF4, 0xC4, + 0xF5, 0xCA, 0xFB, 0xCA, 0xFB, 0xD1, 0x99, 0x93, 0x99, 0x93, 0x99, 0x93, 0xC3, 0x93, 0x99, 0x93, + 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, + 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x00, 0x05, 0x05, 0x04, 0x05, 0x0B, 0x35, 0x34, 0x35, 0x35, 0x65, + 0x3A, 0x65, 0x65, 0x6B, 0x64, 0x6B, 0x6B, 0x95, 0x94, 0x9B, 0x9B, 0xC5, 0x9A, 0xC5, 0xCB, 0xCB, + 0xCA, 0xCB, 0xCB, 0xFB, 0xFA, 0xFB, 0x1E, 0x24, 0x1E, 0x24, 0x1E, 0x4F, 0x49, 0x4F, 0x49, 0x7A, + 0x49, 0x7A, 0x74, 0x7A, 0x74, 0x7A, 0x74, 0xA5, 0x9F, 0xA5, 0x9F, 0xD0, 0x9F, 0xD0, 0xCA, 0xD0, + 0xCA, 0xD0, 0xCA, 0xFB, 0xF5, 0xFB, 0xD2, 0xD2, 0xA8, 0xD2, 0xD8, 0xD9, 0xAF, 0xD9, 0xD9, 0xE0, + 0xB5, 0xE0, 0xE0, 0xE6, 0xB6, 0xE6, 0xE6, 0xE7, 0xBD, 0xED, 0xED, 0xEE, 0xC3, 0xEE, 0xF4, 0xF4, + 0xCA, 0xF4, 0xF4, 0xFB, 0xD1, 0xFB, 0x99, 0x99, 0x93, 0x99, 0x99, 0x99, 0x93, 0x99, 0x99, 0x99, + 0x93, 0x99, 0x99, 0x99, 0x93, 0x99, 0x99, 0xC3, 0x93, 0x99, 0x99, 0xC3, 0x93, 0x99, 0x99, 0xC3, + 0x93, 0xC3, 0x99, 0xC3, 0x93, 0x00, 0x05, 0x04, 0x0B, 0x04, 0x35, 0x0A, 0x35, 0x34, 0x65, 0x34, + 0x65, 0x3A, 0x6B, 0x64, 0x6B, 0x64, 0x9B, 0x6A, 0x9B, 0x94, 0xC5, 0x9A, 0xCB, 0x9A, 0xCB, 0xCA, + 0xCB, 0xCA, 0xFB, 0xCA, 0xFB, 0xFA, 0x24, 0x1E, 0x24, 0x1E, 0x4F, 0x1E, 0x4F, 0x49, 0x7A, 0x49, + 0x7A, 0x49, 0x7A, 0x74, 0x7A, 0x74, 0xA5, 0x74, 0xA5, 0x9F, 0xD0, 0x9F, 0xD0, 0x9F, 0xD0, 0xCA, + 0xD0, 0xCA, 0xFB, 0xCA, 0xFB, 0xF5, 0xD2, 0xA8, 0xD8, 0xA8, 0xD9, 0xAE, 0xD9, 0xAF, 0xE0, 0xAF, + 0xE0, 0xB5, 0xE6, 0xB6, 0xE6, 0xB6, 0xED, 0xBC, 0xED, 0xBD, 0xEE, 0xC3, 0xF4, 0xC3, 0xF4, 0xCA, + 0xF4, 0xCA, 0xFB, 0xCA, 0xFB, 0xD1, 0x99, 0x93, 0x99, 0x93, 0xC4, 0x93, 0x99, 0x93, 0xC3, 0x93, + 0x99, 0x93, 0xC4, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC4, 0x93, 0xC3, 0x93, 0xC3, 0x93, + 0xC3, 0x93, 0xC4, 0x93, 0xC3, 0x00, 0x05, 0x05, 0x05, 0x0B, 0x05, 0x35, 0x35, 0x35, 0x35, 0x3B, + 0x3B, 0x65, 0x65, 0x6B, 0x6B, 0x6B, 0x6B, 0x95, 0x95, 0x9B, 0x9B, 0x9B, 0x9B, 0xCB, 0xC5, 0xCB, + 0xCB, 0xF5, 0xCB, 0xFB, 0xFB, 0xFB, 0x24, 0x24, 0x24, 0x24, 0x24, 0x4F, 0x4F, 0x4F, 0x4F, 0x4F, + 0x4F, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xD0, 0xD0, 0xD0, + 0xD0, 0xFB, 0xD0, 0xFB, 0xFB, 0xFB, 0xD2, 0xD2, 0xD2, 0xD8, 0xD2, 0xD9, 0xD9, 0xD9, 0xD9, 0xDF, + 0xDF, 0xE0, 0xE0, 0xE6, 0xE6, 0xE6, 0xE6, 0xE7, 0xE7, 0xED, 0xED, 0xED, 0xED, 0xF4, 0xEE, 0xF4, + 0xF4, 0xF5, 0xF4, 0xFB, 0xFB, 0xFB, 0x93, 0x99, 0x99, 0x99, 0x93, 0x99, 0x99, 0x99, 0x93, 0x99, + 0x99, 0x99, 0x93, 0x99, 0x99, 0x99, 0x93, 0x99, 0x99, 0xC3, 0x93, 0x99, 0x99, 0xC3, 0x93, 0xC3, + 0x99, 0xC3, 0x93, 0xC3, 0x99, 0x00, 0x05, 0x04, 0x35, 0x05, 0x35, 0x0A, 0x35, 0x34, 0x65, 0x34, + 0x65, 0x3B, 0x6B, 0x64, 0x95, 0x6A, 0x95, 0x6A, 0x9B, 0x95, 0xC5, 0x9A, 0xCB, 0x9A, 0xCB, 0xC4, + 0xF5, 0xCB, 0xFB, 0xCA, 0xFB, 0xFA, 0x24, 0x1E, 0x4F, 0x1E, 0x4F, 0x1E, 0x4F, 0x49, 0x7A, 0x49, + 0x7A, 0x49, 0x7A, 0x74, 0xA5, 0x74, 0xA5, 0x74, 0xA5, 0x9F, 0xD0, 0x9F, 0xD0, 0x9F, 0xD0, 0xCA, + 0xFB, 0xCA, 0xFB, 0xCA, 0xFB, 0xF5, 0xD2, 0xA8, 0xD9, 0xD2, 0xD9, 0xAE, 0xD9, 0xAF, 0xE0, 0xAF, + 0xE0, 0xDF, 0xE6, 0xB6, 0xE7, 0xBC, 0xE7, 0xBC, 0xED, 0xE7, 0xEE, 0xC3, 0xF4, 0xC3, 0xF4, 0xC4, + 0xF5, 0xF4, 0xFB, 0xCA, 0xFB, 0xD1, 0x99, 0x93, 0xC3, 0x93, 0x99, 0x93, 0xC3, 0x93, 0xC3, 0x93, + 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x93, + 0xC3, 0x93, 0xC3, 0x93, 0xC3, 0x00, 0x05, 0x05, 0x05, 0x05, 0x0B, 0x35, 0x35, 0x35, 0x35, 0x65, + 0x3B, 0x65, 0x65, 0x6B, 0x65, 0x6B, 0x95, 0x95, 0x95, 0x9B, 0x9B, 0xC5, 0x9B, 0xC5, 0xCB, 0xCB, + 0xCB, 0xCB, 0xCB, 0xFB, 0xFB, 0xFB, 0x24, 0x24, 0x24, 0x24, 0x24, 0x4F, 0x4F, 0x4F, 0x4F, 0x7A, + 0x4F, 0x7A, 0x7A, 0x7A, 0x7A, 0x7A, 0xA5, 0xA5, 0xA5, 0xA5, 0xA5, 0xD0, 0xA5, 0xD0, 0xD0, 0xD0, + 0xD0, 0xD0, 0xD0, 0xFB, 0xFB, 0xFB, 0xD2, 0xD2, 0xD2, 0xD2, 0xD8, 0xD9, 0xD9, 0xD9, 0xD9, 0xE0, + 0xDF, 0xE0, 0xE0, 0xE6, 0xE0, 0xE6, 0xE7, 0xE7, 0xE7, 0xED, 0xED, 0xEE, 0xED, 0xEE, 0xF4, 0xF4, + 0xF4, 0xF4, 0xF4, 0xFB, 0xFB, 0xFB, 0x99, 0x99, 0x93, 0x99, 0x99, 0x99, 0x93, 0x99, 0x99, 0x99, + 0x93, 0x99, 0x99, 0xC3, 0x93, 0x99, 0x99, 0xC3, 0x93, 0x99, 0x99, 0xC3, 0x93, 0xC3, 0xC3, 0xC3, + 0x93, 0xC3, 0xC3, 0xC3, 0x93, 0x00, 0x05, 0x05, 0x0B, 0x05, 0x35, 0x0B, 0x35, 0x35, 0x65, 0x35, + 0x65, 0x3B, 0x6B, 0x65, 0x6B, 0x65, 0x9B, 0x6B, 0x9B, 0x95, 0xC5, 0x9B, 0xC5, 0x9B, 0xCB, 0xCB, + 0xCB, 0xCB, 0xFB, 0xCB, 0xFB, 0xFB, 0x24, 0x24, 0x24, 0x24, 0x4F, 0x24, 0x4F, 0x4F, 0x7A, 0x4F, + 0x7A, 0x4F, 0x7A, 0x7A, 0x7A, 0x7A, 0xA5, 0x7A, 0xA5, 0xA5, 0xD0, 0xA5, 0xD0, 0xA5, 0xD0, 0xD0, + 0xD0, 0xD0, 0xFB, 0xD0, 0xFB, 0xFB, 0xD2, 0xD2, 0xD8, 0xD2, 0xD9, 0xD8, 0xD9, 0xD9, 0xE0, 0xD9, + 0xE0, 0xDF, 0xE6, 0xE0, 0xE6, 0xE0, 0xED, 0xE6, 0xED, 0xE7, 0xEE, 0xED, 0xEE, 0xED, 0xF4, 0xF4, + 0xF4, 0xF4, 0xFB, 0xF4, 0xFB, 0xFB, 0xC4, 0x93, 0x99, 0x93, 0xC4, 0x93, 0x99, 0x93, 0xC4, 0x93, + 0xC3, 0x93, 0xC4, 0x93, 0xC3, 0x93, 0xC4, 0x93, 0xC3, 0x93, 0xC4, 0x93, 0xC3, 0x93, 0xC4, 0x93, + 0xC3, 0x93, 0xC4, 0x93, 0xC3, 0x00, +}; From 8681e85ba6028287bf202d8b8a86a7d0a0d49101 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 7 Jul 2013 19:43:03 +1000 Subject: [PATCH 35/38] Change GDISP image default reading mode for WIN32 --- demos/modules/gdisp/gdisp_images/main.c | 2 +- demos/modules/gdisp/gdisp_images_animated/main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/demos/modules/gdisp/gdisp_images/main.c b/demos/modules/gdisp/gdisp_images/main.c index e5b55a3a..c581f942 100644 --- a/demos/modules/gdisp/gdisp_images/main.c +++ b/demos/modules/gdisp/gdisp_images/main.c @@ -30,7 +30,7 @@ #include "gfx.h" #ifdef WIN32 - #define USE_MEMORY_FILE FALSE // Can be true or false for Win32 + #define USE_MEMORY_FILE TRUE // Can be true or false for Win32 #else #define USE_MEMORY_FILE TRUE // Non-Win32 - use the compiled in image #endif diff --git a/demos/modules/gdisp/gdisp_images_animated/main.c b/demos/modules/gdisp/gdisp_images_animated/main.c index 4713e0e9..c5260174 100644 --- a/demos/modules/gdisp/gdisp_images_animated/main.c +++ b/demos/modules/gdisp/gdisp_images_animated/main.c @@ -33,7 +33,7 @@ #define MY_BG_COLOR RGB2COLOR(220, 220, 255) // Pale blue so we can see the transparent parts #ifdef WIN32 - #define USE_MEMORY_FILE FALSE // Can be true or false for Win32 + #define USE_MEMORY_FILE TRUE // Can be true or false for Win32 #else #define USE_MEMORY_FILE TRUE // Non-Win32 - use the compiled in image #endif From ba264ef1add20e8ede39fde1ceae1d57687498d1 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 7 Jul 2013 19:43:34 +1000 Subject: [PATCH 36/38] Update GWIN demos --- demos/modules/ginput/touch_driver_test/main.c | 116 +++---- demos/modules/gwin/basic/main.c | 14 +- demos/modules/gwin/console/main.c | 41 ++- demos/modules/gwin/widgets/main.c | 324 ++++++++++++------ demos/modules/gwin/widgets/readme.txt | 4 +- 5 files changed, 304 insertions(+), 195 deletions(-) diff --git a/demos/modules/ginput/touch_driver_test/main.c b/demos/modules/ginput/touch_driver_test/main.c index 1a1157b0..225a111c 100644 --- a/demos/modules/ginput/touch_driver_test/main.c +++ b/demos/modules/ginput/touch_driver_test/main.c @@ -28,7 +28,6 @@ */ #include "gfx.h" -#include "chprintf.h" static GConsoleObject gc; static GButtonObject gNext; @@ -39,15 +38,15 @@ static GListener gl; * GINPUT Touch Driver Calibrator. * *------------------------------------------------------------------------*/ int main(void) { - GSourceHandle gs, gsNext, gsPrev; + GSourceHandle gs; GEvent *pe; GEventMouse *pem; GEventGWinButton *peb; coord_t swidth, sheight; GHandle ghc, ghNext, ghPrev; - BaseSequentialStream *gp; GEventType deviceType; font_t font; + GWidgetInit wi; gfxInit(); // Initialize the display @@ -58,12 +57,13 @@ int main(void) { // Create our title font = gdispOpenFont("UI2"); + gwinSetDefaultFont(font); gdispFillStringBox(0, 0, swidth, 20, "Touch Calibration", font, Red, White, justifyLeft); // Create our main display window - ghc = gwinCreateConsole(&gc, 0, 20, swidth, sheight-20, font); + wi.g.show = TRUE; wi.g.x = 0; wi.g.y = 20; wi.g.width = swidth; wi.g.height = sheight-20; + ghc = gwinConsoleCreate(&gc, &wi.g); gwinClear(ghc); - gp = gwinGetConsoleStream(ghc); // Initialize the mouse in our special no calibration mode. geventListenerInit(&gl); @@ -77,22 +77,22 @@ int main(void) { StepDeviceType: gwinClear(ghc); gwinSetColor(ghc, Yellow); - chprintf(gp, "\n1. DEVICE TYPE\n\n"); + gwinPrintf(ghc, "\n1. DEVICE TYPE\n\n"); pem = (GEventMouse *)&gl.event; ginputGetMouseStatus(0, pem); deviceType = pem->type; gwinSetColor(ghc, White); - chprintf(gp, "This is detected as a %s device\n\n", + gwinPrintf(ghc, "This is detected as a %s device\n\n", deviceType == GEVENT_MOUSE ? "MOUSE" : (pem->type == GEVENT_TOUCH ? "TOUCH" : "UNKNOWN")); if (ghNext) - chprintf(gp, "Press Next or Back to continue.\n"); + gwinPrintf(ghc, "Press Next or Back to continue.\n"); else if (deviceType == GEVENT_MOUSE) - chprintf(gp, "Click the mouse button to move on to the next test.\n"); + gwinPrintf(ghc, "Click the mouse button to move on to the next test.\n"); else - chprintf(gp, "Press and release your finger to move on to the next test.\n"); + gwinPrintf(ghc, "Press and release your finger to move on to the next test.\n"); while(1) { pe = geventEventWait(&gl, TIME_INFINITE); @@ -117,23 +117,23 @@ StepDeviceType: StepRawJitter: gwinClear(ghc); gwinSetColor(ghc, Yellow); - chprintf(gp, "\n2. GINPUT_MOUSE_READ_CYCLES\n\n"); + gwinPrintf(ghc, "\n2. GINPUT_MOUSE_READ_CYCLES\n\n"); gwinSetColor(ghc, White); if (deviceType == GEVENT_MOUSE) - chprintf(gp, "Press and hold the mouse button.\n\n"); + gwinPrintf(ghc, "Press and hold the mouse button.\n\n"); else - chprintf(gp, "Press and hold on the surface.\n\n"); - chprintf(gp, "Numbers will display in this window.\n" + gwinPrintf(ghc, "Press and hold on the surface.\n\n"); + gwinPrintf(ghc, "Numbers will display in this window.\n" "Ensure that values don't jump around very much when your finger is stationary.\n\n" "Increasing GINPUT_MOUSE_READ_CYCLES helps reduce jitter but increases CPU usage.\n\n"); if (ghNext) - chprintf(gp, "Press Next or Back to continue.\n"); + gwinPrintf(ghc, "Press Next or Back to continue.\n"); else if (deviceType == GEVENT_MOUSE) - chprintf(gp, "Release the mouse button to move on to the next test.\n"); + gwinPrintf(ghc, "Release the mouse button to move on to the next test.\n"); else - chprintf(gp, "Release your finger to move on to the next test.\n"); + gwinPrintf(ghc, "Release your finger to move on to the next test.\n"); // For this test turn on ALL mouse movement events geventAttachSource(&gl, gs, GLISTEN_MOUSEDOWNMOVES|GLISTEN_MOUSEMETA|GLISTEN_MOUSENOFILTER); @@ -150,7 +150,7 @@ StepRawJitter: if (pe->type == GEVENT_MOUSE || pe->type == GEVENT_TOUCH) { pem = (GEventMouse *)pe; if ((pem->current_buttons & GINPUT_MOUSE_BTN_LEFT)) - chprintf(gp, "%u:%u\n", pem->x, pem->y); + gwinPrintf(ghc, "%u:%u\n", pem->x, pem->y); if (!ghNext && (pem->meta & GMETA_MOUSE_UP)) break; } @@ -166,19 +166,19 @@ StepRawJitter: StepCalibrate: gwinClear(ghc); gwinSetColor(ghc, Yellow); - chprintf(gp, "\n3. GINPUT_MOUSE_CALIBRATION_ERROR\n\n"); + gwinPrintf(ghc, "\n3. GINPUT_MOUSE_CALIBRATION_ERROR\n\n"); gwinSetColor(ghc, Gray); - chprintf(gp, "Ensure GINPUT_MOUSE_NEED_CALIBRATION = TRUE and GINPUT_MOUSE_CALIBRATION_ERROR is >= 0\n\n"); + gwinPrintf(ghc, "Ensure GINPUT_MOUSE_NEED_CALIBRATION = TRUE and GINPUT_MOUSE_CALIBRATION_ERROR is >= 0\n\n"); gwinSetColor(ghc, White); - chprintf(gp, "You will be presented with a number of points to touch.\nPress them in turn.\n\n" + gwinPrintf(ghc, "You will be presented with a number of points to touch.\nPress them in turn.\n\n" "If the calibration repeatedly fails, increase GINPUT_MOUSE_CALIBRATION_ERROR and try again.\n\n"); if (ghNext) - chprintf(gp, "Press Next to start the calibration.\n"); + gwinPrintf(ghc, "Press Next to start the calibration.\n"); else if (deviceType == GEVENT_MOUSE) - chprintf(gp, "Click the mouse button to start the calibration.\n"); + gwinPrintf(ghc, "Click the mouse button to start the calibration.\n"); else - chprintf(gp, "Press and release your finger to start the calibration.\n"); + gwinPrintf(ghc, "Press and release your finger to start the calibration.\n"); while(1) { pe = geventEventWait(&gl, TIME_INFINITE); @@ -201,37 +201,21 @@ StepCalibrate: /* From now on we can use Next and Previous Buttons */ if (!ghNext) { + gwinAttachMouse(0); + gwinAttachListener(&gl); - ghNext = gwinCreateButton(&gNext, swidth-50, 0, 50, 20, font, GBTN_NORMAL); - gwinSetButtonText(ghNext, "Next", FALSE); - gsNext = gwinGetButtonSource(ghNext); - geventAttachSource(&gl, gsNext, 0); - gwinAttachButtonMouse(ghNext, 0); + wi.customDraw = 0; wi.customParam = 0; wi.customStyle = 0; + wi.g.show = TRUE; wi.g.x = swidth-50; wi.g.y = 0; wi.g.width = 50; wi.g.height = 20; + wi.text = "Next"; ghNext = gwinButtonCreate(&gNext, &wi); - ghPrev = gwinCreateButton(&gPrev, swidth-100, 0, 50, 20, font, GBTN_NORMAL); - gwinSetButtonText(ghPrev, "Back", FALSE); - gsPrev = gwinGetButtonSource(ghPrev); - geventAttachSource(&gl, gsPrev, 0); - gwinAttachButtonMouse(ghPrev, 0); - -#if 0 - { - // Attach a couple of hardware toggle buttons to our Next and Back buttons as well. - // We can always use the mouse to trigger the buttons if you don't want to use hardware toggles. - // This code depends on your hardware. Turn it on only if you have - // defined a board definition for your toggle driver. Then change - // the next two lines to be correct for your hardware. The values - // below are correct for the Win32 toggle driver. - gwinAttachButtonToggle(ghNext, GINPUT_TOGGLE_MOMENTARY1); - gwinAttachButtonToggle(ghPrev, GINPUT_TOGGLE_MOMENTARY2); - } -#endif + wi.g.show = TRUE; wi.g.x = swidth-100; + wi.text = "Back"; ghPrev = gwinButtonCreate(&gPrev, &wi); } // Calibration used the whole screen - re-establish our title gdispFillStringBox(0, 0, swidth, 20, "Touch Calibration", font, Green, White, justifyLeft); - gwinButtonDraw(ghNext); - gwinButtonDraw(ghPrev); + gwinRedraw(ghNext); + gwinRedraw(ghPrev); /* * Test: Mouse movement jitter @@ -240,18 +224,18 @@ StepCalibrate: StepJitter: gwinClear(ghc); gwinSetColor(ghc, Yellow); - chprintf(gp, "\n4. GINPUT_MOUSE_MOVE_JITTER\n\n"); + gwinPrintf(ghc, "\n4. GINPUT_MOUSE_MOVE_JITTER\n\n"); gwinSetColor(ghc, White); if (deviceType == GEVENT_MOUSE) - chprintf(gp, "Press and hold the mouse button and move around as if to draw.\n\n"); + gwinPrintf(ghc, "Press and hold the mouse button and move around as if to draw.\n\n"); else - chprintf(gp, "Press firmly on the surface and move around as if to draw.\n\n"); + gwinPrintf(ghc, "Press firmly on the surface and move around as if to draw.\n\n"); - chprintf(gp, "Dots will display in this window. Ensure that when you stop moving your finger that " + gwinPrintf(ghc, "Dots will display in this window. Ensure that when you stop moving your finger that " "new dots stop displaying.\nNew dots should only display when your finger is moving.\n\n" "Adjust GINPUT_MOUSE_MOVE_JITTER to the smallest value that this reliably works for.\n\n"); - chprintf(gp, "Press Next or Back to continue.\n\n"); + gwinPrintf(ghc, "Press Next or Back to continue.\n\n"); while(1) { pe = geventEventWait(&gl, TIME_INFINITE); @@ -265,7 +249,7 @@ StepJitter: if (pe->type == GEVENT_MOUSE || pe->type == GEVENT_TOUCH) { pem = (GEventMouse *)pe; if ((pem->current_buttons & GINPUT_MOUSE_BTN_LEFT)) - chprintf(gp, "."); + gwinPrintf(ghc, "."); } } @@ -276,16 +260,16 @@ StepJitter: StepPolling: gwinClear(ghc); gwinSetColor(ghc, Yellow); - chprintf(gp, "\n5. GINPUT_MOUSE_POLL_PERIOD\n\n"); + gwinPrintf(ghc, "\n5. GINPUT_MOUSE_POLL_PERIOD\n\n"); gwinSetColor(ghc, White); - chprintf(gp, "Press firmly on the surface (or press and hold the mouse button) and move around as if to draw.\n\n"); - chprintf(gp, "A green line will follow your finger.\n" + gwinPrintf(ghc, "Press firmly on the surface (or press and hold the mouse button) and move around as if to draw.\n\n"); + gwinPrintf(ghc, "A green line will follow your finger.\n" "Adjust GINPUT_MOUSE_POLL_PERIOD to the highest value that provides a line without " "gaps that are too big.\nDecreasing the value increases CPU usage.\n" "About 25 (millisecs) normally produces good results." "This test can be ignored for interrupt driven drivers.\n\n"); - chprintf(gp, "Press Next or Back to continue.\n\n"); + gwinPrintf(ghc, "Press Next or Back to continue.\n\n"); while(1) { pe = geventEventWait(&gl, TIME_INFINITE); @@ -310,18 +294,18 @@ StepPolling: StepClickJitter: gwinClear(ghc); gwinSetColor(ghc, Yellow); - chprintf(gp, "\n6. GINPUT_MOUSE_MAX_CLICK_JITTER\n\n"); + gwinPrintf(ghc, "\n6. GINPUT_MOUSE_MAX_CLICK_JITTER\n\n"); gwinSetColor(ghc, White); - chprintf(gp, "Press and release the touch surface to \"click\".\nTry both short and long presses.\n"); - chprintf(gp, "For a mouse click with the left and right buttons.\n\n"); - chprintf(gp, "Dots will display in this window. A yellow dash is a left (or short) click. " + gwinPrintf(ghc, "Press and release the touch surface to \"click\".\nTry both short and long presses.\n"); + gwinPrintf(ghc, "For a mouse click with the left and right buttons.\n\n"); + gwinPrintf(ghc, "Dots will display in this window. A yellow dash is a left (or short) click. " "A red x is a right (or long) click.\n\n" "Adjust GINPUT_MOUSE_CLICK_JITTER to the smallest value that this reliably works for.\n" "Adjust GINPUT_MOUSE_CLICK_TIME to adjust distinguishing short vs long presses.\n" "TIME_INFINITE means there are no long presses (although a right mouse button will still work).\n\n" "Note: moving your finger (mouse) during a click cancels it.\n\n"); - chprintf(gp, "This is the last test but you can press Next or Back to continue.\n\n"); + gwinPrintf(ghc, "This is the last test but you can press Next or Back to continue.\n\n"); while(1) { pe = geventEventWait(&gl, TIME_INFINITE); @@ -336,11 +320,11 @@ StepClickJitter: pem = (GEventMouse *)pe; if ((pem->meta & GMETA_MOUSE_CLICK)) { gwinSetColor(ghc, Yellow); - chprintf(gp, "-"); + gwinPrintf(ghc, "-"); } if ((pem->meta & GMETA_MOUSE_CXTCLICK)) { gwinSetColor(ghc, Red); - chprintf(gp, "x"); + gwinPrintf(ghc, "x"); } } } diff --git a/demos/modules/gwin/basic/main.c b/demos/modules/gwin/basic/main.c index 5dc1bab7..c46e6969 100644 --- a/demos/modules/gwin/basic/main.c +++ b/demos/modules/gwin/basic/main.c @@ -40,8 +40,14 @@ int main(void) { gdispClear(Lime); /* Create two windows */ - GW1 = gwinCreateWindow(NULL, 20, 10, 200, 150); - GW2 = gwinCreateWindow(NULL, 50, 190, 150, 100); + { + GWindowInit wi; + + wi.show = TRUE; wi.x = 20; wi.y = 10; wi.width = 200; wi.height = 150; + GW1 = gwinWindowCreate(NULL, &wi); + wi.show = TRUE; wi.x = 50; wi.y = 190; wi.width = 150; wi.height = 100; + GW2 = gwinWindowCreate(NULL, &wi); + } /* Set fore- and background colors for both windows */ gwinSetColor(GW1, Black); @@ -53,9 +59,9 @@ int main(void) { gwinClear(GW1); gwinClear(GW2); - gwinDrawLine (GW1, 5, 30, 150, 110); + gwinDrawLine(GW1, 5, 30, 150, 110); for(i=5, j=0; i < 200 && j < 150; i+=3, j+=i/20) - gwinDrawPixel (GW1, i, j); + gwinDrawPixel(GW1, i, j); /* * Draw two filled circles at the same coordinate diff --git a/demos/modules/gwin/console/main.c b/demos/modules/gwin/console/main.c index aa3de40d..197a8ad6 100644 --- a/demos/modules/gwin/console/main.c +++ b/demos/modules/gwin/console/main.c @@ -28,27 +28,37 @@ */ #include "gfx.h" -#include "chprintf.h" /* The handles for our three consoles */ GHandle GW1, GW2, GW3; -/* The streams for our three consoles */ -BaseSequentialStream *S1, *S2, *S3; - int main(void) { uint8_t i; font_t font1, font2; /* initialize and clear the display */ gfxInit(); - font1 = gdispOpenFont("UI2 Double"); - font2 = gdispOpenFont("Small"); - /* create the three console windows and set a font for each */ - GW1 = gwinCreateConsole(NULL, 0, 0, gdispGetWidth(), gdispGetHeight()/2, font1); - GW2 = gwinCreateConsole(NULL, 0, gdispGetHeight()/2, gdispGetWidth()/2, gdispGetHeight(), font2); - GW3 = gwinCreateConsole(NULL, gdispGetWidth()/2, gdispGetHeight()/2, gdispGetWidth(), gdispGetHeight(), font2); + /* Set some fonts */ + font1 = gdispOpenFont("Small"); + font2 = gdispOpenFont("UI2 Double"); + gwinSetDefaultFont(font1); + + /* create the three console windows */ + { + GWindowInit wi; + + wi.show = TRUE; + wi.x = 0; wi.y = 0; wi.width = gdispGetWidth(); wi.height = gdispGetHeight()/2; + GW1 = gwinConsoleCreate(NULL, &wi); + wi.y = gdispGetHeight()/2; wi.width = gdispGetWidth()/2; wi.height = gdispGetHeight(); + GW2 = gwinConsoleCreate(NULL, &wi); + wi.x = gdispGetWidth()/2; wi.height = gdispGetHeight(); + GW3 = gwinConsoleCreate(NULL, &wi); + } + + /* Use a special font for GW1 */ + gwinSetFont(GW1, font2); /* Set the fore- and background colors for each console */ gwinSetColor(GW1, Green); @@ -63,24 +73,19 @@ int main(void) { gwinClear(GW2); gwinClear(GW3); - /* receive the stream pointers of each console */ - S1 = gwinGetConsoleStream(GW1); - S2 = gwinGetConsoleStream(GW2); - S3 = gwinGetConsoleStream(GW3); - /* Output some data on the first console */ for(i = 0; i < 10; i++) { - chprintf(S1, "Hello ChibiOS/GFX!\r\n"); + gwinPrintf(GW1, "Hello ChibiOS/GFX!\r\n"); } /* Output some data on the second console */ for(i = 0; i < 16; i++) { - chprintf(S2, "Message Nr.: %d\r\n", i+1); + gwinPrintf(GW2, "Message Nr.: %d\r\n", i+1); } /* Output some data on the third console */ for(i = 0; i < 18; i++) { - chprintf(S3, "Message Nr.: %d\r\n", i+1); + gwinPrintf(GW3, "Message Nr.: %d\r\n", i+1); } while(TRUE) { diff --git a/demos/modules/gwin/widgets/main.c b/demos/modules/gwin/widgets/main.c index e44ce6b0..4d485186 100644 --- a/demos/modules/gwin/widgets/main.c +++ b/demos/modules/gwin/widgets/main.c @@ -28,37 +28,186 @@ #include "gfx.h" +/** + * This demo demonstrates many of the GWIN widgets. + * On the "Radio" tab try playing with the color radio buttons. + * On the "Checkbox" tab try playing with the "Disable All" checkbox. + */ + +/* Our custom yellow style */ +static const GWidgetStyle YellowWidgetStyle = { + Yellow, // window background + + // enabled color set + { + HTML2COLOR(0x0000FF), // text + HTML2COLOR(0x404040), // edge + HTML2COLOR(0xE0E0E0), // fill + HTML2COLOR(0xE0E0E0), // progress - inactive area + }, + + // disabled color set + { + HTML2COLOR(0xC0C0C0), // text + HTML2COLOR(0x808080), // edge + HTML2COLOR(0xE0E0E0), // fill + HTML2COLOR(0xC0E0C0), // progress - active area + }, + + // pressed color set + { + HTML2COLOR(0xFF00FF), // text + HTML2COLOR(0x404040), // edge + HTML2COLOR(0x808080), // fill + HTML2COLOR(0x00E000), // progress - active area + }, +}; + +/* The variables we need */ static GListener gl; static GHandle ghConsole; static GHandle ghTabButtons, ghTabSliders, ghTabCheckboxes, ghTabLabels, ghTabRadios, ghTabImages; static GHandle ghButton1, ghButton2, ghButton3, ghButton4; static GHandle ghSlider1, ghSlider2, ghSlider3, ghSlider4; -static GHandle ghCheckbox1, ghCheckbox2; +static GHandle ghCheckbox1, ghCheckbox2, ghCheckDisableAll; static GHandle ghLabel1; static GHandle ghRadio1, ghRadio2; +static GHandle ghRadioBlack, ghRadioWhite, ghRadioYellow; //static GHandle ghImage1; +/* Some useful macros */ #define ScrWidth gdispGetWidth() #define ScrHeight gdispGetHeight() -#define TAB_HEIGHT 30 -#define BUTTON_WIDTH 50 -#define BUTTON_HEIGHT 30 -#define SLIDER_WIDTH 20 -#define CHECKBOX_WIDTH 80 -#define CHECKBOX_HEIGHT 20 -#define RADIO_WIDTH 50 -#define RADIO_HEIGHT 20 -#define GROUP_TABS 0 -#define GROUP_R1R2 1 +#define TAB_HEIGHT 30 +#define LABEL_HEIGHT 40 +#define BUTTON_WIDTH 50 +#define BUTTON_HEIGHT 30 +#define SLIDER_WIDTH 20 +#define CHECKBOX_WIDTH 80 +#define CHECKBOX_HEIGHT 20 +#define RADIO_WIDTH 50 +#define RADIO_HEIGHT 20 +#define COLOR_WIDTH 80 +#define DISABLEALL_WIDTH 100 +#define GROUP_TABS 0 +#define GROUP_YESNO 1 +#define GROUP_COLORS 2 -static GHandle createTab(GWidgetInit *pwi) { - GHandle gh; +/** + * Create all the widgets. + * With the exception of the Tabs they are all created invisible. + */ +static void createWidgets(void) { + GWidgetInit wi; - gh = gwinCreateRadio(NULL, pwi, GROUP_TABS); - gwinSetCustomDraw(gh, gwinRadioDraw_Tab, 0); - gwinSetVisible(gh, TRUE); - return gh; + wi.customDraw = 0; wi.customParam = 0; wi.customStyle = 0; + + // Create the Tabs + wi.g.show = TRUE; wi.customDraw = gwinRadioDraw_Tab; + wi.g.width = ScrWidth/6; wi.g.height = TAB_HEIGHT; wi.g.y = 0; + wi.g.x = 0*wi.g.width; wi.text = "Buttons"; ghTabButtons = gwinRadioCreate(NULL, &wi, GROUP_TABS); + wi.g.x = 1*wi.g.width; wi.text = "Sliders"; ghTabSliders = gwinRadioCreate(NULL, &wi, GROUP_TABS); + wi.g.x = 2*wi.g.width; wi.text = "Checkbox"; ghTabCheckboxes = gwinRadioCreate(NULL, &wi, GROUP_TABS); + wi.g.x = 3*wi.g.width; wi.text = "Radios"; ghTabRadios = gwinRadioCreate(NULL, &wi, GROUP_TABS); + wi.g.x = 4*wi.g.width; wi.text = "Labels"; ghTabLabels = gwinRadioCreate(NULL, &wi, GROUP_TABS); + wi.g.x = 5*wi.g.width; wi.text = "Images"; ghTabImages = gwinRadioCreate(NULL, &wi, GROUP_TABS); + + // Buttons + wi.g.show = FALSE; wi.customDraw = 0; + wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT; wi.g.y = TAB_HEIGHT+5; + wi.g.x = 0+0*(BUTTON_WIDTH+1); wi.text = "B1"; ghButton1 = gwinButtonCreate(NULL, &wi); + wi.g.x = 0+1*(BUTTON_WIDTH+1); wi.text = "B2"; ghButton2 = gwinButtonCreate(NULL, &wi); + wi.g.x = 0+2*(BUTTON_WIDTH+1); wi.text = "B3"; ghButton3 = gwinButtonCreate(NULL, &wi); + wi.g.x = 0+3*(BUTTON_WIDTH+1); wi.text = "B4"; ghButton4 = gwinButtonCreate(NULL, &wi); + + // Horizontal Sliders + wi.g.width = ScrWidth/2-2; wi.g.height = SLIDER_WIDTH; wi.g.x = ScrWidth/2+1; + wi.g.y = ScrHeight/2-2*(SLIDER_WIDTH+1); wi.text = "S1"; ghSlider1 = gwinSliderCreate(NULL, &wi); + wi.g.y = ScrHeight/2-1*(SLIDER_WIDTH+1); wi.text = "S2"; ghSlider2 = gwinSliderCreate(NULL, &wi); + + // Vertical Sliders + wi.g.width = SLIDER_WIDTH; wi.g.height = ScrHeight/2-2; wi.g.y = ScrHeight/2+1; + wi.g.x = 0+0*(SLIDER_WIDTH+1); wi.text = "S3"; ghSlider3 = gwinSliderCreate(NULL, &wi); + wi.g.x = 0+1*(SLIDER_WIDTH+1); wi.text = "S4"; ghSlider4 = gwinSliderCreate(NULL, &wi); + + // Checkboxes - for the 2nd checkbox we apply special drawing before making it visible + wi.g.width = CHECKBOX_WIDTH; wi.g.height = CHECKBOX_HEIGHT; wi.g.x = 0; + wi.g.y = TAB_HEIGHT+5+0*(CHECKBOX_HEIGHT+1); wi.text = "C1"; ghCheckbox1 = gwinCheckboxCreate(NULL, &wi); + wi.customDraw = gwinCheckboxDraw_CheckOnRight; + wi.g.y = TAB_HEIGHT+5+1*(CHECKBOX_HEIGHT+1); wi.text = "C2"; ghCheckbox2 = gwinCheckboxCreate(NULL, &wi); + wi.customDraw = 0; wi.g.width = DISABLEALL_WIDTH; + wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Disable All"; ghCheckDisableAll = gwinCheckboxCreate(NULL, &wi); + + // Labels + wi.g.width = 0; wi.g.height = LABEL_HEIGHT; // dynamic width, fixed height + wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "Label"; ghLabel1 = gwinLabelCreate(NULL, &wi); + + // Radio Buttons + wi.g.width = RADIO_WIDTH; wi.g.height = RADIO_HEIGHT; wi.g.y = TAB_HEIGHT+5; + wi.g.x = 0*wi.g.width; wi.text = "Yes"; ghRadio1 = gwinRadioCreate(NULL, &wi, GROUP_YESNO); + wi.g.x = 1*wi.g.width; wi.text = "No"; ghRadio2 = gwinRadioCreate(NULL, &wi, GROUP_YESNO); + wi.g.width = COLOR_WIDTH; wi.g.y += RADIO_HEIGHT+5; + wi.g.x = 0*wi.g.width; wi.text = "Black"; ghRadioBlack = gwinRadioCreate(NULL, &wi, GROUP_COLORS); + wi.g.x = 1*wi.g.width; wi.text = "White"; ghRadioWhite = gwinRadioCreate(NULL, &wi, GROUP_COLORS); + wi.g.x = 2*wi.g.width; wi.text = "Yellow"; ghRadioYellow = gwinRadioCreate(NULL, &wi, GROUP_COLORS); + gwinRadioPress(ghRadioWhite); + + // Console - we apply some special colors before making it visible + wi.g.width = ScrWidth/2-1; wi.g.height = ScrHeight/2-1; + wi.g.x = ScrWidth/2+1; wi.g.y = ScrHeight/2+1; + ghConsole = gwinConsoleCreate(NULL, &wi.g); + gwinSetColor(ghConsole, Yellow); + gwinSetBgColor(ghConsole, Black); +} + +/** + * Set the visibility of widgets based on which tab is selected. + */ +static void setTab(GHandle tab) { + /* Make sure everything is invisible first */ + gwinSetVisible(ghButton1, FALSE); gwinSetVisible(ghButton2, FALSE); + gwinSetVisible(ghButton3, FALSE); gwinSetVisible(ghButton4, FALSE); + gwinSetVisible(ghSlider1, FALSE); gwinSetVisible(ghSlider2, FALSE); + gwinSetVisible(ghSlider3, FALSE); gwinSetVisible(ghSlider4, FALSE); + gwinSetVisible(ghCheckbox1, FALSE); gwinSetVisible(ghCheckbox2, FALSE); gwinSetVisible(ghCheckDisableAll, FALSE); + gwinSetVisible(ghLabel1, FALSE); + gwinSetVisible(ghRadio1, FALSE); gwinSetVisible(ghRadio2, FALSE); + gwinSetVisible(ghRadioWhite, FALSE);gwinSetVisible(ghRadioBlack, FALSE);gwinSetVisible(ghRadioYellow, FALSE); + //gwinSetVisible(ghImage1, FALSE); + + /* Turn on widgets depending on the tab selected */ + if (tab == ghTabButtons) { + gwinSetVisible(ghButton1, TRUE); gwinSetVisible(ghButton2, TRUE); + gwinSetVisible(ghButton3, TRUE); gwinSetVisible(ghButton4, TRUE); + } else if (tab == ghTabSliders) { + gwinSetVisible(ghSlider1, TRUE); gwinSetVisible(ghSlider2, TRUE); + gwinSetVisible(ghSlider3, TRUE); gwinSetVisible(ghSlider4, TRUE); + } else if (tab == ghTabCheckboxes) { + gwinSetVisible(ghCheckbox1, TRUE); gwinSetVisible(ghCheckbox2, TRUE); gwinSetVisible(ghCheckDisableAll, TRUE); + } else if (tab == ghTabLabels) { + gwinSetVisible(ghLabel1, TRUE); + } else if (tab == ghTabRadios) { + gwinSetVisible(ghRadio1, TRUE); gwinSetVisible(ghRadio2, TRUE); + gwinSetVisible(ghRadioWhite, TRUE); gwinSetVisible(ghRadioBlack, TRUE); gwinSetVisible(ghRadioYellow, TRUE); + } else if (tab == ghTabImages) { + //gwinSetVisible(ghImage1, TRUE); + } +} + +/** + * Set the enabled state of every widget (except the tabs etc) + */ +static void setEnabled(bool_t ena) { + gwinSetEnabled(ghButton1, ena); gwinSetEnabled(ghButton2, ena); + gwinSetEnabled(ghButton3, ena); gwinSetEnabled(ghButton4, ena); + gwinSetEnabled(ghSlider1, ena); gwinSetEnabled(ghSlider2, ena); + gwinSetEnabled(ghSlider3, ena); gwinSetEnabled(ghSlider4, ena); + gwinSetEnabled(ghCheckbox1, ena); gwinSetEnabled(ghCheckbox2, ena); //gwinSetEnabled(ghCheckDisableAll, TRUE); + gwinSetEnabled(ghLabel1, ena); + gwinSetEnabled(ghRadio1, ena); gwinSetEnabled(ghRadio2, ena); + gwinSetEnabled(ghRadioWhite, ena); gwinSetEnabled(ghRadioBlack, ena); gwinSetEnabled(ghRadioYellow, ena); + //gwinSetEnabled(ghImage1, ena); } int main(void) { @@ -66,16 +215,11 @@ int main(void) { // Initialize the display gfxInit(); - gdispClear(White); // Set the widget defaults gwinSetDefaultFont(gdispOpenFont("UI2")); - gwinSetDefaultColor(Black); - gwinSetDefaultBgColor(White); - - // We want to listen for widget events - geventListenerInit(&gl); - gwinAttachListener(&gl); + gwinSetDefaultStyle(&WhiteWidgetStyle, FALSE); + gdispClear(White); // Connect the mouse #if GINPUT_NEED_MOUSE @@ -83,59 +227,9 @@ int main(void) { #endif // Create the gwin windows/widgets - { - GWidgetInit wi; + createWidgets(); - // Create the Tabs - wi.g.show = FALSE; wi.g.width = ScrWidth/6; wi.g.height = TAB_HEIGHT; wi.g.y = 0; - wi.g.x = 0*wi.g.width; wi.text = "Buttons"; ghTabButtons = createTab(&wi); - wi.g.x = 1*wi.g.width; wi.text = "Sliders"; ghTabSliders = createTab(&wi); - wi.g.x = 2*wi.g.width; wi.text = "Checkbox"; ghTabCheckboxes = createTab(&wi); - wi.g.x = 3*wi.g.width; wi.text = "Labels"; ghTabLabels = createTab(&wi); - wi.g.x = 4*wi.g.width; wi.text = "Radios"; ghTabRadios = createTab(&wi); - wi.g.x = 5*wi.g.width; wi.text = "Images"; ghTabImages = createTab(&wi); - - // Buttons - wi.g.width = BUTTON_WIDTH; wi.g.height = BUTTON_HEIGHT; wi.g.y = TAB_HEIGHT+5; - wi.g.x = 0+0*(BUTTON_WIDTH+1); wi.text = "B1"; ghButton1 = gwinCreateButton(NULL, &wi); - wi.g.x = 0+1*(BUTTON_WIDTH+1); wi.text = "B2"; ghButton2 = gwinCreateButton(NULL, &wi); - wi.g.x = 0+2*(BUTTON_WIDTH+1); wi.text = "B3"; ghButton3 = gwinCreateButton(NULL, &wi); - wi.g.x = 0+3*(BUTTON_WIDTH+1); wi.text = "B4"; ghButton4 = gwinCreateButton(NULL, &wi); - - // Horizontal Sliders - wi.g.width = ScrWidth/2-2; wi.g.height = SLIDER_WIDTH; wi.g.x = ScrWidth/2+1; - wi.g.y = ScrHeight/2-2*(SLIDER_WIDTH+1); wi.text = "S1"; ghSlider1 = gwinCreateSlider(NULL, &wi); - wi.g.y = ScrHeight/2-1*(SLIDER_WIDTH+1); wi.text = "S2"; ghSlider2 = gwinCreateSlider(NULL, &wi); - - // Vertical Sliders - wi.g.width = SLIDER_WIDTH; wi.g.height = ScrHeight/2-2; wi.g.y = ScrHeight/2+1; - wi.g.x = 0+0*(SLIDER_WIDTH+1); wi.text = "S3"; ghSlider3 = gwinCreateSlider(NULL, &wi); - wi.g.x = 0+1*(SLIDER_WIDTH+1); wi.text = "S4"; ghSlider4 = gwinCreateSlider(NULL, &wi); - - // Checkboxes - for the 2nd checkbox we apply special drawing before making it visible - wi.g.width = CHECKBOX_WIDTH; wi.g.height = CHECKBOX_HEIGHT; wi.g.x = 0; - wi.g.y = TAB_HEIGHT+5+0*(CHECKBOX_HEIGHT+1); wi.text = "C1"; ghCheckbox1 = gwinCreateCheckbox(NULL, &wi); - wi.g.y = TAB_HEIGHT+5+1*(CHECKBOX_HEIGHT+1); wi.text = "C2"; ghCheckbox2 = gwinCreateCheckbox(NULL, &wi); - gwinSetCustomDraw(ghCheckbox2, gwinCheckboxDraw_CheckOnRight, 0); - - // Labels - wi.g.width = 0; // dynamic width - wi.g.y = TAB_HEIGHT+5+2*(CHECKBOX_HEIGHT+1); wi.text = "L1"; ghLabel1 = gwinLabelCreate(NULL, &wi); - - // Radio Buttons - wi.g.width = RADIO_WIDTH; wi.g.height = RADIO_HEIGHT; wi.g.y = TAB_HEIGHT+5; - wi.g.x = 0*wi.g.width; wi.text = "Yes"; ghRadio1 = gwinCreateRadio(NULL, &wi, GROUP_R1R2); - wi.g.x = 1*wi.g.width; wi.text = "No"; ghRadio2 = gwinCreateRadio(NULL, &wi, GROUP_R1R2); - - // Console - we apply some special colors before making it visible - wi.g.width = ScrWidth/2-1; wi.g.height = ScrHeight/2-1; - wi.g.x = ScrWidth/2+1; wi.g.y = ScrHeight/2+1; - ghConsole = gwinCreateConsole(NULL, &wi.g); - gwinSetColor(ghConsole, Yellow); - gwinSetBgColor(ghConsole, Black); - } - - // Assign toggles and dials to the buttons & sliders etc. + // Assign toggles and dials to specific buttons & sliders etc. #if GINPUT_NEED_TOGGLE gwinAttachToggle(ghButton1, 0, 0); gwinAttachToggle(ghButton2, 0, 1); @@ -149,8 +243,12 @@ int main(void) { gwinSetVisible(ghConsole, TRUE); gwinClear(ghConsole); - // Press the Buttons Tab - gwinPressRadio(ghTabButtons); + // We want to listen for widget events + geventListenerInit(&gl); + gwinAttachListener(&gl); + + // Press the Tab we want visible + gwinRadioPress(ghTabButtons); while(1) { // Get an Event @@ -160,54 +258,68 @@ int main(void) { case GEVENT_GWIN_BUTTON: gwinPrintf(ghConsole, "Button %s\n", gwinGetText(((GEventGWinButton *)pe)->button)); break; + case GEVENT_GWIN_SLIDER: gwinPrintf(ghConsole, "Slider %s=%d\n", gwinGetText(((GEventGWinSlider *)pe)->slider), ((GEventGWinSlider *)pe)->position); break; + case GEVENT_GWIN_CHECKBOX: gwinPrintf(ghConsole, "Checkbox %s=%s\n", gwinGetText(((GEventGWinCheckbox *)pe)->checkbox), ((GEventGWinCheckbox *)pe)->isChecked ? "Checked" : "UnChecked"); + + // If it is the Disable All checkbox then do that. + if (((GEventGWinCheckbox *)pe)->checkbox == ghCheckDisableAll) { + gwinPrintf(ghConsole, "%s All\n", ((GEventGWinCheckbox *)pe)->isChecked ? "Disable" : "Enable"); + setEnabled(!((GEventGWinCheckbox *)pe)->isChecked); + } break; + case GEVENT_GWIN_RADIO: gwinPrintf(ghConsole, "Radio Group %u=%s\n", ((GEventGWinRadio *)pe)->group, gwinGetText(((GEventGWinRadio *)pe)->radio)); - // Is this the tab radio's - if (((GEventGWinRadio *)pe)->group == GROUP_TABS) { - - // Do some special animation for Label1 - if (((GEventGWinRadio *)pe)->radio == ghTabLabels) { - gwinSetBgColor(ghLabel1, gwinGetDefaultBgColor()); - gwinSetColor(ghLabel1, gwinGetDefaultColor()); - } + switch(((GEventGWinRadio *)pe)->group) { + case GROUP_TABS: // Set control visibility depending on the tab selected - gwinSetVisible(ghButton1, ((GEventGWinRadio *)pe)->radio == ghTabButtons); - gwinSetVisible(ghButton2, ((GEventGWinRadio *)pe)->radio == ghTabButtons); - gwinSetVisible(ghButton3, ((GEventGWinRadio *)pe)->radio == ghTabButtons); - gwinSetVisible(ghButton4, ((GEventGWinRadio *)pe)->radio == ghTabButtons); - gwinSetVisible(ghSlider1, ((GEventGWinRadio *)pe)->radio == ghTabSliders); - gwinSetVisible(ghSlider2, ((GEventGWinRadio *)pe)->radio == ghTabSliders); - gwinSetVisible(ghSlider3, ((GEventGWinRadio *)pe)->radio == ghTabSliders); - gwinSetVisible(ghSlider4, ((GEventGWinRadio *)pe)->radio == ghTabSliders); - gwinSetVisible(ghCheckbox1, ((GEventGWinRadio *)pe)->radio == ghTabCheckboxes); - gwinSetVisible(ghCheckbox2, ((GEventGWinRadio *)pe)->radio == ghTabCheckboxes); - gwinSetVisible(ghLabel1, ((GEventGWinRadio *)pe)->radio == ghTabLabels); - gwinSetVisible(ghRadio1, ((GEventGWinRadio *)pe)->radio == ghTabRadios); - gwinSetVisible(ghRadio2, ((GEventGWinRadio *)pe)->radio == ghTabRadios); - //gwinSetVisible(ghImage1, ((GEventGWinRadio *)pe)->radio == ghTabImages); + setTab(((GEventGWinRadio *)pe)->radio); - // Do some special animation for Label1 + // Do some special animation for Label1 to demonstrate auto width sizing if (((GEventGWinRadio *)pe)->radio == ghTabLabels) { + gwinPrintf(ghConsole, "Change Label Text\n"); gfxSleepMilliseconds(1000); - gwinSetBgColor(ghLabel1, Blue); - gwinSetColor(ghLabel1, Yellow); gwinSetText(ghLabel1, "Very Big Label", FALSE); gfxSleepMilliseconds(1000); - gwinSetBgColor(ghLabel1, Yellow); - gwinSetColor(ghLabel1, Red); - gwinSetText(ghLabel1, "L1", FALSE); + gwinSetText(ghLabel1, "Label", FALSE); } + break; + + case GROUP_COLORS: + { + const GWidgetStyle *pstyle; + + gwinPrintf(ghConsole, "Change Color Scheme\n"); + + if (((GEventGWinRadio *)pe)->radio == ghRadioYellow) + pstyle = &YellowWidgetStyle; + else if (((GEventGWinRadio *)pe)->radio == ghRadioBlack) + pstyle = &BlackWidgetStyle; + else + pstyle = &WhiteWidgetStyle; + + // Clear the screen to the new color - we avoid the console area as it can't redraw itself + #if GDISP_NEED_CLIP + gdispUnsetClip(); + #endif + gdispFillArea(0, 0, ScrWidth, ScrHeight/2, pstyle->background); + gdispFillArea(0, ScrHeight/2, ScrWidth/2, ScrHeight/2, pstyle->background); + + // Update the style on all controls + gwinSetDefaultStyle(pstyle, TRUE); + } + break; } break; + default: gwinPrintf(ghConsole, "Unknown %d\n", pe->type); break; diff --git a/demos/modules/gwin/widgets/readme.txt b/demos/modules/gwin/widgets/readme.txt index 02d733e9..b5777061 100644 --- a/demos/modules/gwin/widgets/readme.txt +++ b/demos/modules/gwin/widgets/readme.txt @@ -1,6 +1,8 @@ -This demo supports input from both a mouse/touch and/or a dial input. +This demo supports input from both a mouse/touch, toggles and/or a dial input. If your platform does not support one or the other, turn it off in gfxconf.h Note that you will need to include the drivers into your project makefile for whichever inputs you decide to use. + +For some fun have a play with the "colors" radio group and the "Disable All" checkbox. From 7f92794b1151076012ad58d390f489118ad419f4 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 7 Jul 2013 20:11:13 +1000 Subject: [PATCH 37/38] Fix image background color bug --- src/gwin/gimage.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gwin/gimage.c b/src/gwin/gimage.c index eef47dc7..2dcba4ba 100644 --- a/src/gwin/gimage.c +++ b/src/gwin/gimage.c @@ -25,16 +25,18 @@ static void _destroy(GWindowObject *gh) { static void _redraw(GHandle gh) { coord_t x, y, w, h, dx, dy; + color_t bg; // The default display area x = gh->x; y = gh->y; w = gh->width; h = gh->height; + bg = gwinGetDefaultBgColor(); // If the image isn't open just clear the area if (!gdispImageIsOpen(&widget(gh)->image)) { - gdispFillArea(x, y, w, h, gh->bgcolor); + gdispFillArea(x, y, w, h, bg); return; } @@ -44,8 +46,8 @@ static void _redraw(GHandle gh) { dx = (gh->width-w)/2; x += dx; if (dx) - gdispFillArea(gh->x, y, dx, h, gh->bgcolor); - gdispFillArea(x+w, y, gh->width-dx-w, h, gh->bgcolor); + gdispFillArea(gh->x, y, dx, h, bg); + gdispFillArea(x+w, y, gh->width-dx-w, h, bg); dx = 0; } @@ -60,8 +62,8 @@ static void _redraw(GHandle gh) { dy = (gh->height-h)/2; y += dy; if (dy) - gdispFillArea(x, gh->y, w, dy, gh->bgcolor); - gdispFillArea(x, y+h, w, gh->height-dy-h, gh->bgcolor); + gdispFillArea(x, gh->y, w, dy, bg); + gdispFillArea(x, y+h, w, gh->height-dy-h, bg); dy = 0; } @@ -71,7 +73,7 @@ static void _redraw(GHandle gh) { } // Reset the background color in case it has changed - gdispImageSetBgColor(&widget(gh)->image, gh->bgcolor); + gdispImageSetBgColor(&widget(gh)->image, bg); // Display the image gdispImageDraw(&widget(gh)->image, x, y, w, h, dx, dy); From c5ec72027787c9cd5f5b36a46eb55f03fd95d894 Mon Sep 17 00:00:00 2001 From: inmarket Date: Sun, 7 Jul 2013 20:11:38 +1000 Subject: [PATCH 38/38] Fix enabled visibility bug --- src/gwin/gwin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gwin/gwin.c b/src/gwin/gwin.c index 2fd0c905..e5997bc8 100644 --- a/src/gwin/gwin.c +++ b/src/gwin/gwin.c @@ -210,7 +210,7 @@ void gwinSetEnabled(GHandle gh, bool_t enabled) { if (enabled) { if (!(gh->flags & GWIN_FLG_ENABLED)) { gh->flags |= GWIN_FLG_ENABLED; - if (gh->vmt->Redraw) { + if ((gh->flags & GWIN_FLG_VISIBLE) && gh->vmt->Redraw) { #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif @@ -220,7 +220,7 @@ void gwinSetEnabled(GHandle gh, bool_t enabled) { } else { if ((gh->flags & GWIN_FLG_ENABLED)) { gh->flags &= ~GWIN_FLG_ENABLED; - if (gh->vmt->Redraw) { + if ((gh->flags & GWIN_FLG_VISIBLE) && gh->vmt->Redraw) { #if GDISP_NEED_CLIP gdispSetClip(gh->x, gh->y, gh->width, gh->height); #endif