Browse Source

Add multiple display support to GWIN.

You can now create windows on multiple displays.
remotes/origin_old/ugfx_release_2.6
inmarket 9 years ago
parent
commit
7a7e223d15
  1. 4
      include/gwin/button.h
  2. 4
      include/gwin/checkbox.h
  3. 6
      include/gwin/class_gwin.h
  4. 4
      include/gwin/console.h
  5. 4
      include/gwin/graph.h
  6. 5
      include/gwin/gwin.h
  7. 4
      include/gwin/image.h
  8. 4
      include/gwin/label.h
  9. 4
      include/gwin/list.h
  10. 4
      include/gwin/radio.h
  11. 4
      include/gwin/slider.h
  12. 66
      src/gwin/button.c
  13. 20
      src/gwin/checkbox.c
  14. 16
      src/gwin/console.c
  15. 22
      src/gwin/gimage.c
  16. 20
      src/gwin/graph.c
  17. 10
      src/gwin/gwidget.c
  18. 99
      src/gwin/gwin.c
  19. 22
      src/gwin/gwm.c
  20. 16
      src/gwin/label.c
  21. 26
      src/gwin/list.c
  22. 34
      src/gwin/radio.c
  23. 48
      src/gwin/slider.c

4
include/gwin/button.h

@ -59,6 +59,7 @@ extern "C" {
* @brief Create a button widget.
* @return NULL if there is no resultant drawing area, otherwise a window handle.
*
* @param[in] g The GDisplay to display this window on
* @param[in] gb The GButtonObject structure to initialise. If this is NULL the structure is dynamically allocated.
* @param[in] pInit The initialisation parameters
*
@ -74,7 +75,8 @@ extern "C" {
*
* @api
*/
GHandle gwinButtonCreate(GButtonObject *gb, const GWidgetInit *pInit);
GHandle gwinGButtonCreate(GDisplay *g, GButtonObject *gb, const GWidgetInit *pInit);
#define gwinButtonCreate(gb, pInit) gwinGButtonCreate(GDISP, gb, pInit)
/**
* @brief Is the button current pressed

4
include/gwin/checkbox.h

@ -52,6 +52,7 @@ typedef struct GCheckboxObject {
* @brief Create a checkbox window.
* @return NULL if there is no resultant drawing area, otherwise a window handle.
*
* @param[in] g The GDisplay to display this window on
* @param[in] gb The GCheckboxObject structure to initialise. If this is NULL, the structure is dynamically allocated.
* @param[in] pInit The initialization parameters to use
*
@ -67,7 +68,8 @@ typedef struct GCheckboxObject {
*
* @api
*/
GHandle gwinCheckboxCreate(GCheckboxObject *gb, const GWidgetInit *pInit);
GHandle gwinGCheckboxCreate(GDisplay *g, GCheckboxObject *gb, const GWidgetInit *pInit);
#define gwinCheckboxCreate(gb, pInit) gwinGCheckboxCreate(GDISP, gb, pInit)
/**
* @brief Set the state of a checkbox

6
include/gwin/class_gwin.h

@ -150,6 +150,7 @@ extern "C" {
/**
* @brief Initialise (and allocate if necessary) the base GWIN object
*
* @param[in] g The GDisplay to use for this window
* @param[in] pgw The GWindowObject structure. If NULL one is allocated from the heap
* @param[in] pInit The user initialization parameters
* @param[in] vmt The virtual method table for the GWIN object
@ -159,12 +160,13 @@ extern "C" {
*
* @notapi
*/
GHandle _gwindowCreate(GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, uint16_t flags);
GHandle _gwindowCreate(GDisplay *g, 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] g The GDisplay to display this window on
* @param[in] pgw The GWidgetObject structure. If NULL one is allocated from the heap
* @param[in] pInit The user initialization parameters
* @param[in] vmt The virtual method table for the Widget object
@ -173,7 +175,7 @@ GHandle _gwindowCreate(GWindowObject *pgw, const GWindowInit *pInit, const gwinV
*
* @notapi
*/
GHandle _gwidgetCreate(GWidgetObject *pgw, const GWidgetInit *pInit, const gwidgetVMT *vmt);
GHandle _gwidgetCreate(GDisplay *g, GWidgetObject *pgw, const GWidgetInit *pInit, const gwidgetVMT *vmt);
/**
* @brief Destroy the Widget object

4
include/gwin/console.h

@ -50,6 +50,7 @@ extern "C" {
* @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] g The GDisplay to display this window on
* @param[in] gc The GConsoleObject structure to initialise. If this is NULL the structure is dynamically allocated.
* @param[in] pInit The initialization parameters to use
*
@ -64,7 +65,8 @@ extern "C" {
*
* @api
*/
GHandle gwinConsoleCreate(GConsoleObject *gc, const GWindowInit *pInit);
GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *pInit);
#define gwinConsoleCreate(gc, pInit) gwinGConsoleCreate(GDISP, gc, pInit)
#if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM
/**

4
include/gwin/graph.h

@ -90,6 +90,7 @@ extern "C" {
* @brief Create a graph window.
* @return NULL if there is no resultant drawing area, otherwise a window handle.
*
* @param[in] g The GDisplay to display this window on
* @param[in] gg The GGraphObject structure to initialise. If this is NULL the structure is dynamically allocated.
* @param[in] pInit The initialization parameters to use
*
@ -107,7 +108,8 @@ extern "C" {
*
* @api
*/
GHandle gwinGraphCreate(GGraphObject *gg, const GWindowInit *pInit);
GHandle gwinGGraphCreate(GDisplay *g, GGraphObject *gg, const GWindowInit *pInit);
#define gwinGraphCreate(gg, pInit) gwinGGraphCreate(GDISP, gg, pInit)
/**
* @brief Set the style of the graphing operations.

5
include/gwin/gwin.h

@ -38,6 +38,7 @@ typedef struct GWindowObject {
gfxQueueASyncItem wmq; // @< The next window (for the window manager)
#endif
const struct gwinVMT *vmt; // @< The VMT for this GWIN
GDisplay * display; // @< The display this window is on.
coord_t x, y; // @< Screen relative position
coord_t width, height; // @< Dimensions of this window
color_t color, bgcolor; // @< The current drawing colors
@ -165,6 +166,7 @@ extern "C" {
* @brief Create a basic window.
* @return NULL if there is no resultant drawing area, otherwise a window handle.
*
* @param[in] g The GDisplay to display this window on
* @param[in] pgw The window structure to initialize. If this is NULL the structure is dynamically allocated.
* @param[in] pInit How to initialise the window
*
@ -177,7 +179,8 @@ extern "C" {
*
* @api
*/
GHandle gwinWindowCreate(GWindowObject *pgw, const GWindowInit *pInit);
GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit);
#define gwinWindowCreate(pgw, pInit) gwinGWindowCreate(GDISP, pgw, pInit);
/**
* @brief Destroy a window (of any type). Releases any dynamically allocated memory.

4
include/gwin/image.h

@ -47,6 +47,7 @@ extern "C" {
* @details Display's a picture.
* @return NULL if there is no resultant drawing area, otherwise the widget handle.
*
* @param[in] g The GDisplay to display this window on
* @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.
*
@ -55,7 +56,8 @@ extern "C" {
*
* @api
*/
GHandle gwinImageCreate(GImageObject *widget, GWindowInit *pInit);
GHandle gwinGImageCreate(GDisplay *g, GImageObject *widget, GWindowInit *pInit);
#define gwinImageCreate(w, pInit) gwinGImageCreate(GDISP, w, pInit)
/**
* @brief Sets the input routines that support reading the image from memory

4
include/gwin/label.h

@ -42,6 +42,7 @@ extern "C" {
* @brief Create a label widget.
* @details A label widget is a simple window which has a static text.
*
* @param[in] g The GDisplay to display this window on
* @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.
*
@ -49,7 +50,8 @@ extern "C" {
*
* @api
*/
GHandle gwinLabelCreate(GLabelObject *widget, GWidgetInit *pInit);
GHandle gwinGLabelCreate(GDisplay *g, GLabelObject *widget, GWidgetInit *pInit);
#define gwinLabelCreate(w, pInit) gwinGLabelCreate(GDISP, w, pInit)
/**
* @brief Border settings for the default rendering routine

4
include/gwin/list.h

@ -82,6 +82,7 @@ extern "C" {
* 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
*
* @param[in] g The GDisplay to display this window on
* @param[in] widget The GListObject structure to initialize. If this is NULL, the structure is dynamically allocated.
* @param[in] pInit The initialization parameters to use
* @param[in] multiselect If TRUE the list is multi-select instead of single-select.
@ -90,7 +91,8 @@ extern "C" {
*
* @api
*/
GHandle gwinListCreate(GListObject *widget, GWidgetInit *pInit, bool_t multiselect);
GHandle gwinGListCreate(GDisplay *g, GListObject *widget, GWidgetInit *pInit, bool_t multiselect);
#define gwinListCreate(w, pInit, m) gwinGListCreate(GDISP, w, pInit, m)
/**
* @brief Change the behaviour of the scroll bar

4
include/gwin/radio.h

@ -59,6 +59,7 @@ extern "C" {
* @brief Create a radio widget.
* @return NULL if there is no resultant drawing area, otherwise a window handle.
*
* @param[in] g The GDisplay to display this window on
* @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.
@ -77,7 +78,8 @@ extern "C" {
*
* @api
*/
GHandle gwinRadioCreate(GRadioObject *gb, const GWidgetInit *pInit, uint16_t group);
GHandle gwinGRadioCreate(GDisplay *g, GRadioObject *gb, const GWidgetInit *pInit, uint16_t group);
#define gwinRadioCreate(w, pInit, gr) gwinGRadioCreate(GDISP, w, pInit, gr)
/**
* @brief Press this radio button (and by definition unset any others in the group)

4
include/gwin/slider.h

@ -58,6 +58,7 @@ extern "C" {
* @brief Create a slider window.
* @return NULL if there is no resultant drawing area, otherwise a window handle.
*
* @param[in] g The GDisplay to display this window on
* @param[in] gb The GSliderObject structure to initialise. If this is NULL the structure is dynamically allocated.
* @param[in] pInit The initialization parameters to use
*
@ -77,7 +78,8 @@ extern "C" {
*
* @api
*/
GHandle gwinSliderCreate(GSliderObject *gb, const GWidgetInit *pInit);
GHandle gwinGSliderCreate(GDisplay *g, GSliderObject *gb, const GWidgetInit *pInit);
#define gwinSliderCreate(w, pInit) gwinGSliderCreate(GDISP, w, pInit)
/**
* @brief Set the slider range.

66
src/gwin/button.c

@ -136,8 +136,8 @@ static const gwidgetVMT buttonVMT = {
#endif
};
GHandle gwinButtonCreate(GButtonObject *gw, const GWidgetInit *pInit) {
if (!(gw = (GButtonObject *)_gwidgetCreate(&gw->w, pInit, &buttonVMT)))
GHandle gwinGButtonCreate(GDisplay *g, GButtonObject *gw, const GWidgetInit *pInit) {
if (!(gw = (GButtonObject *)_gwidgetCreate(g, &gw->w, pInit, &buttonVMT)))
return 0;
#if GINPUT_NEED_TOGGLE
@ -171,9 +171,9 @@ void gwinButtonDraw_3D(GWidgetObject *gw, 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->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);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width-1, gw->g.height-1, gw->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
gdispGDrawLine(gw->g.display, 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);
gdispGDrawLine(gw->g.display, 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
@ -184,14 +184,14 @@ void gwinButtonDraw_3D(GWidgetObject *gw, void *param) {
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
pcol = getDrawColors(gw);
gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, 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->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);
gdispGFillRoundedBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, RND_CNR_SIZE-1, pcol->fill);
gdispGDrawStringBox(gw->g.display, 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);
gdispGDrawRoundedBox(gw->g.display, 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->text, gw->g.font, pcol->text, pcol->fill, justifyCenter);
gdispDrawBox(gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge);
gdispGFillStringBox(gw->g.display, 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);
gdispGDrawBox(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, pcol->edge);
}
}
#endif
@ -204,10 +204,10 @@ void gwinButtonDraw_3D(GWidgetObject *gw, void *param) {
if (gw->g.vmt != (gwinVMT *)&buttonVMT) return;
pcol = getDrawColors(gw);
gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, 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);
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
gdispGFillEllipse(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width/2-1, gw->g.height/2-1, pcol->fill);
gdispGDrawStringBox(gw->g.display, gw->g.x+1, gw->g.y+1, gw->g.width-2, gw->g.height-2, gw->text, gw->g.font, pcol->text, justifyCenter);
gdispGDrawEllipse(gw->g.display, gw->g.x, gw->g.y, gw->g.width/2, gw->g.height/2, pcol->edge);
}
#endif
@ -228,10 +228,10 @@ void gwinButtonDraw_3D(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;
gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, 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);
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
gdispGFillConvexPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->fill);
gdispGDrawPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->edge);
gdispGDrawStringBox(gw->g.display, 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) {
@ -250,10 +250,10 @@ void gwinButtonDraw_3D(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;
gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, 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);
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
gdispGFillConvexPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->fill);
gdispGDrawPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->edge);
gdispGDrawStringBox(gw->g.display, 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) {
@ -272,10 +272,10 @@ void gwinButtonDraw_3D(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;
gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, 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);
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
gdispGFillConvexPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->fill);
gdispGDrawPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->edge);
gdispGDrawStringBox(gw->g.display, 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) {
@ -294,10 +294,10 @@ void gwinButtonDraw_3D(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;
gdispFillArea(gw->g.x, gw->g.y, gw->g.width, gw->g.height, 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);
gdispGFillArea(gw->g.display, gw->g.x, gw->g.y, gw->g.width, gw->g.height, gw->pstyle->background);
gdispGFillConvexPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->fill);
gdispGDrawPoly(gw->g.display, gw->g.x, gw->g.y, arw, 7, pcol->edge);
gdispGDrawStringBox(gw->g.display, 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
@ -317,8 +317,8 @@ void gwinButtonDraw_3D(GWidgetObject *gw, void *param) {
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->text, gw->g.font, pcol->text, justifyCenter);
gdispGImageDraw(gw->g.display, (gdispImage *)param, gw->g.x, gw->g.y, gw->g.width, gw->g.height, 0, sy);
gdispGDrawStringBox(gw->g.display, 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

20
src/gwin/checkbox.c

@ -108,8 +108,8 @@ static const gwidgetVMT checkboxVMT = {
#endif
};
GHandle gwinCheckboxCreate(GCheckboxObject *gb, const GWidgetInit *pInit) {
if (!(gb = (GCheckboxObject *)_gwidgetCreate(&gb->w, pInit, &checkboxVMT)))
GHandle gwinGCheckboxCreate(GDisplay *g, GCheckboxObject *gb, const GWidgetInit *pInit) {
if (!(gb = (GCheckboxObject *)_gwidgetCreate(g, &gb->w, pInit, &checkboxVMT)))
return 0;
#if GINPUT_NEED_TOGGLE
@ -161,14 +161,14 @@ void gwinCheckboxDraw_CheckOnLeft(GWidgetObject *gw, void *param) {
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, gw->pstyle->background);
gdispDrawBox(gw->g.x, gw->g.y, ld, ld, pcol->edge);
gdispGFillArea(gw->g.display, gw->g.x+1, gw->g.y+1, ld, ld-2, gw->pstyle->background);
gdispGDrawBox(gw->g.display, 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, pcol->fill);
gdispGFillArea(gw->g.display, 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->text, gw->g.font, pcol->text, gw->pstyle->background, justifyLeft);
gdispGFillStringBox(gw->g.display, 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
}
@ -183,14 +183,14 @@ void gwinCheckboxDraw_CheckOnRight(GWidgetObject *gw, void *param) {
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, gw->pstyle->background);
gdispDrawBox(gw->g.x+ep, gw->g.y, ld, ld, pcol->edge);
gdispGFillArea(gw->g.display, gw->g.x+ep-1, gw->g.y+1, ld, ld-2, gw->pstyle->background);
gdispGDrawBox(gw->g.display, 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, pcol->fill);
gdispGFillArea(gw->g.display, 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-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyRight);
gdispGFillStringBox(gw->g.display, gw->g.x, gw->g.y, ep-1, gw->g.height, gw->text, gw->g.font, pcol->text, gw->pstyle->background, justifyRight);
#undef gcw
}

16
src/gwin/console.c

@ -66,8 +66,8 @@ static const gwinVMT consoleVMT = {
AfterClear, // The after-clear routine
};
GHandle gwinConsoleCreate(GConsoleObject *gc, const GWindowInit *pInit) {
if (!(gc = (GConsoleObject *)_gwindowCreate(&gc->g, pInit, &consoleVMT, 0)))
GHandle gwinGConsoleCreate(GDisplay *g, GConsoleObject *gc, const GWindowInit *pInit) {
if (!(gc = (GConsoleObject *)_gwindowCreate(g, &gc->g, pInit, &consoleVMT, 0)))
return 0;
#if GFX_USE_OS_CHIBIOS && GWIN_CONSOLE_USE_BASESTREAM
gc->stream.vmt = &GWindowConsoleVMT;
@ -97,7 +97,7 @@ void gwinPutChar(GHandle gh, char c) {
fp = gdispGetFontMetric(gh->font, fontCharPadding);
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
if (c == '\n') {
@ -116,13 +116,13 @@ void gwinPutChar(GHandle gh, char c) {
if (gcw->cy + fy > gh->height) {
#if GDISP_NEED_SCROLL
/* scroll the console */
gdispVerticalScroll(gh->x, gh->y, gh->width, gh->height, fy, gh->bgcolor);
gdispGVerticalScroll(gh->display, 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/fy))-1)*fy;
#else
/* clear the console */
gdispFillArea(gh->x, gh->y, gh->width, gh->height, gh->bgcolor);
gdispGFillArea(gh->display, gh->x, gh->y, gh->width, gh->height, gh->bgcolor);
/* reset the cursor to the top of the window */
gcw->cx = 0;
gcw->cy = 0;
@ -132,12 +132,12 @@ 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, fy, gh->bgcolor);
gdispGFillArea(gh->display, 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);
gdispGFillChar(gh->display, gh->x + gcw->cx, gh->y + gcw->cy, c, gh->font, gh->color, gh->bgcolor);
#else
gdispDrawChar(gh->x + gcw->cx, gh->y + gcw->cy, c, gh->font, gh->color);
gdispGDrawChar(gh->display, gh->x + gcw->cx, gh->y + gcw->cy, c, gh->font, gh->color);
#endif
/* update cursor */

22
src/gwin/gimage.c

@ -51,7 +51,7 @@ static void _redraw(GHandle gh) {
// If the image isn't open just clear the area
if (!gdispImageIsOpen(&widget(gh)->image)) {
gdispFillArea(x, y, w, h, bg);
gdispGFillArea(gh->display, x, y, w, h, bg);
return;
}
@ -61,8 +61,8 @@ static void _redraw(GHandle gh) {
dx = (gh->width-w)/2;
x += dx;
if (dx)
gdispFillArea(gh->x, y, dx, h, bg);
gdispFillArea(x+w, y, gh->width-dx-w, h, bg);
gdispGFillArea(gh->display, gh->x, y, dx, h, bg);
gdispGFillArea(gh->display, x+w, y, gh->width-dx-w, h, bg);
dx = 0;
}
@ -77,8 +77,8 @@ static void _redraw(GHandle gh) {
dy = (gh->height-h)/2;
y += dy;
if (dy)
gdispFillArea(x, gh->y, w, dy, bg);
gdispFillArea(x, y+h, w, gh->height-dy-h, bg);
gdispGFillArea(gh->display, x, gh->y, w, dy, bg);
gdispGFillArea(gh->display, x, y+h, w, gh->height-dy-h, bg);
dy = 0;
}
@ -91,7 +91,7 @@ static void _redraw(GHandle gh) {
gdispImageSetBgColor(&widget(gh)->image, bg);
// Display the image
gdispImageDraw(&widget(gh)->image, x, y, w, h, dx, dy);
gdispGImageDraw(gh->display, &widget(gh)->image, x, y, w, h, dx, dy);
#if GWIN_NEED_IMAGE_ANIMATION
// read the delay for the next frame
@ -122,8 +122,8 @@ static const gwinVMT imageVMT = {
0, // The after-clear routine
};
GHandle gwinImageCreate(GImageObject *gobj, GWindowInit *pInit) {
if (!(gobj = (GImageObject *)_gwindowCreate(&gobj->g, pInit, &imageVMT, 0)))
GHandle gwinGImageCreate(GDisplay *g, GImageObject *gobj, GWindowInit *pInit) {
if (!(gobj = (GImageObject *)_gwindowCreate(g, &gobj->g, pInit, &imageVMT, 0)))
return 0;
// Ensure the gdispImageIsOpen() gives valid results
@ -153,7 +153,7 @@ bool_t gwinImageOpenMemory(GHandle gh, const void* memory) {
// 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);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
_redraw(gh);
}
@ -176,7 +176,7 @@ bool_t gwinImageOpenFile(GHandle gh, const char* filename) {
// 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);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
_redraw(gh);
}
@ -200,7 +200,7 @@ bool_t gwinImageOpenStream(GHandle gh, void *streamPtr) {
// 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);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
_redraw(gh);
}

20
src/gwin/graph.c

@ -46,22 +46,22 @@ static void pointto(GGraphObject *gg, coord_t x, coord_t y, const GGraphPointSty
y = gg->g.y + gg->g.height - 1 - gg->yorigin - y;
if (style->size <= 1) {
gdispDrawPixel(x, y, style->color);
gdispGDrawPixel(gg->g.display, x, y, style->color);
return;
}
switch(style->type) {
case GGRAPH_POINT_SQUARE:
gdispDrawBox(x-style->size, y-style->size, 2*style->size, 2*style->size, style->color);
gdispGDrawBox(gg->g.display, x-style->size, y-style->size, 2*style->size, 2*style->size, style->color);
break;
#if GDISP_NEED_CIRCLE
case GGRAPH_POINT_CIRCLE:
gdispDrawCircle(x, y, style->size, style->color);
gdispGDrawCircle(gg->g.display, x, y, style->size, style->color);
break;
#endif
case GGRAPH_POINT_DOT:
default:
gdispDrawPixel(x, y, style->color);
gdispGDrawPixel(gg->g.display, x, y, style->color);
break;
}
}
@ -83,7 +83,7 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t
if (style->size <= 0) {
// Use the driver to draw a solid line
gdispDrawLine(x0, y0, x1, y1, style->color);
gdispGDrawLine(gg->g.display, x0, y0, x1, y1, style->color);
return;
}
@ -101,7 +101,7 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t
case GGRAPH_LINE_SOLID:
default:
// Use the driver to draw a solid line
gdispDrawLine(x0, y0, x1, y1, style->color);
gdispGDrawLine(gg->g.display, x0, y0, x1, y1, style->color);
return;
}
@ -131,7 +131,7 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t
if (run++ >= 0) {
if (run >= run_on)
run = run_off;
gdispDrawPixel(x0, y0, style->color);
gdispGDrawPixel(gg->g.display, x0, y0, style->color);
}
if (P < 0) {
P += dy;
@ -151,7 +151,7 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t
if (run++ >= 0) {
if (run >= run_on)
run = run_off;
gdispDrawPixel(x0, y0, style->color);
gdispGDrawPixel(gg->g.display, x0, y0, style->color);
}
if (P < 0) {
P += dx;
@ -165,8 +165,8 @@ static void lineto(GGraphObject *gg, coord_t x0, coord_t y0, coord_t x1, coord_t
}
}
GHandle gwinGraphCreate(GGraphObject *gg, const GWindowInit *pInit) {
if (!(gg = (GGraphObject *)_gwindowCreate(&gg->g, pInit, &graphVMT, 0)))
GHandle gwinGGraphCreate(GDisplay *g, GGraphObject *gg, const GWindowInit *pInit) {
if (!(gg = (GGraphObject *)_gwindowCreate(g, &gg->g, pInit, &graphVMT, 0)))
return 0;
gg->xorigin = gg->yorigin = 0;
gg->lastx = gg->lasty = 0;

10
src/gwin/gwidget.c

@ -102,6 +102,10 @@ static void gwidgetEvent(void *param, GEvent *pe) {
// Cycle through all windows
for(qi = gfxQueueASyncPeek(&_GWINList); qi; qi = gfxQueueASyncNext(qi)) {
// check if the widget matches this display
if (gh->display != pme->display)
continue;
// 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;
@ -225,8 +229,8 @@ void _gwidgetInit(void) {
geventRegisterCallback(&gl, gwidgetEvent, 0);
}
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)))
GHandle _gwidgetCreate(GDisplay *g, GWidgetObject *pgw, const GWidgetInit *pInit, const gwidgetVMT *vmt) {
if (!(pgw = (GWidgetObject *)_gwindowCreate(g, &pgw->g, &pInit->g, &vmt->g, GWIN_FLG_WIDGET|GWIN_FLG_ENABLED)))
return 0;
pgw->text = pInit->text ? pInit->text : "";
@ -281,7 +285,7 @@ void _gwidgetRedraw(GHandle gh) {
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gw->fnDraw(gw, gw->fnParam);

99
src/gwin/gwin.c

@ -90,7 +90,7 @@ void _gwinInit(void) {
// Internal routine for use by GWIN components only
// Initialise a window creating it dynamically if required.
GHandle _gwindowCreate(GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, uint16_t flags) {
GHandle _gwindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit, const gwinVMT *vmt, uint16_t flags) {
// Allocate the structure if necessary
if (!pgw) {
if (!(pgw = (GWindowObject *)gfxAlloc(vmt->size)))
@ -100,6 +100,7 @@ GHandle _gwindowCreate(GWindowObject *pgw, const GWindowInit *pInit, const gwinV
pgw->flags = flags;
// Initialise all basic fields
pgw->display = g;
pgw->vmt = vmt;
pgw->color = defaultFgColor;
pgw->bgcolor = defaultBgColor;
@ -154,8 +155,8 @@ color_t gwinGetDefaultBgColor(void) {
* The GWindow Routines
*-----------------------------------------------*/
GHandle gwinWindowCreate(GWindowObject *pgw, const GWindowInit *pInit) {
if (!(pgw = _gwindowCreate(pgw, pInit, &basegwinVMT, 0)))
GHandle gwinGWindowCreate(GDisplay *g, GWindowObject *pgw, const GWindowInit *pInit) {
if (!(pgw = _gwindowCreate(g, pgw, pInit, &basegwinVMT, 0)))
return 0;
gwinSetVisible(pgw, pInit->show);
return pgw;
@ -213,7 +214,7 @@ void gwinSetEnabled(GHandle gh, bool_t enabled) {
gh->flags |= GWIN_FLG_ENABLED;
if ((gh->flags & GWIN_FLG_VISIBLE) && gh->vmt->Redraw) {
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gh->vmt->Redraw(gh);
}
@ -223,7 +224,7 @@ void gwinSetEnabled(GHandle gh, bool_t enabled) {
gh->flags &= ~GWIN_FLG_ENABLED;
if ((gh->flags & GWIN_FLG_VISIBLE) && gh->vmt->Redraw) {
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gh->vmt->Redraw(gh);
}
@ -271,9 +272,9 @@ void gwinClear(GHandle gh) {
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispFillArea(gh->x, gh->y, gh->width, gh->height, gh->bgcolor);
gdispGFillArea(gh->display, gh->x, gh->y, gh->width, gh->height, gh->bgcolor);
if (gh->vmt->AfterClear)
gh->vmt->AfterClear(gh);
}
@ -283,9 +284,9 @@ void gwinDrawPixel(GHandle gh, coord_t x, coord_t y) {
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispDrawPixel(gh->x+x, gh->y+y, gh->color);
gdispGDrawPixel(gh->display, gh->x+x, gh->y+y, gh->color);
}
void gwinDrawLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1) {
@ -293,9 +294,9 @@ void gwinDrawLine(GHandle gh, coord_t x0, coord_t y0, coord_t x1, coord_t y1) {
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispDrawLine(gh->x+x0, gh->y+y0, gh->x+x1, gh->y+y1, gh->color);
gdispGDrawLine(gh->display, gh->x+x0, gh->y+y0, gh->x+x1, gh->y+y1, gh->color);
}
void gwinDrawBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy) {
@ -303,9 +304,9 @@ void gwinDrawBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy) {
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispDrawBox(gh->x+x, gh->y+y, cx, cy, gh->color);
gdispGDrawBox(gh->display, gh->x+x, gh->y+y, cx, cy, gh->color);
}
void gwinFillArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy) {
@ -313,9 +314,9 @@ void gwinFillArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy) {
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispFillArea(gh->x+x, gh->y+y, cx, cy, gh->color);
gdispGFillArea(gh->display, gh->x+x, gh->y+y, cx, cy, gh->color);
}
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) {
@ -323,9 +324,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispBlitAreaEx(gh->x+x, gh->y+y, cx, cy, srcx, srcy, srccx, buffer);
gdispGBlitArea(gh->display, gh->x+x, gh->y+y, cx, cy, srcx, srcy, srccx, buffer);
}
#if GDISP_NEED_CIRCLE
@ -334,9 +335,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispDrawCircle(gh->x+x, gh->y+y, radius, gh->color);
gdispGDrawCircle(gh->display, gh->x+x, gh->y+y, radius, gh->color);
}
void gwinFillCircle(GHandle gh, coord_t x, coord_t y, coord_t radius) {
@ -344,9 +345,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispFillCircle(gh->x+x, gh->y+y, radius, gh->color);
gdispGFillCircle(gh->display, gh->x+x, gh->y+y, radius, gh->color);
}
#endif
@ -356,9 +357,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispDrawEllipse(gh->x+x, gh->y+y, a, b, gh->color);
gdispGDrawEllipse(gh->display, gh->x+x, gh->y+y, a, b, gh->color);
}
void gwinFillEllipse(GHandle gh, coord_t x, coord_t y, coord_t a, coord_t b) {
@ -366,9 +367,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispFillEllipse(gh->x+x, gh->y+y, a, b, gh->color);
gdispGFillEllipse(gh->display, gh->x+x, gh->y+y, a, b, gh->color);
}
#endif
@ -378,9 +379,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispDrawArc(gh->x+x, gh->y+y, radius, startangle, endangle, gh->color);
gdispGDrawArc(gh->display, gh->x+x, gh->y+y, radius, startangle, endangle, gh->color);
}
void gwinFillArc(GHandle gh, coord_t x, coord_t y, coord_t radius, coord_t startangle, coord_t endangle) {
@ -388,9 +389,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispFillArc(gh->x+x, gh->y+y, radius, startangle, endangle, gh->color);
gdispGFillArc(gh->display, gh->x+x, gh->y+y, radius, startangle, endangle, gh->color);
}
#endif
@ -400,9 +401,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return defaultBgColor;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
return gdispGetPixelColor(gh->x+x, gh->y+y);
return gdispGGetPixelColor(gh->display, gh->x+x, gh->y+y);
}
#endif
@ -412,9 +413,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispDrawChar(gh->x+x, gh->y+y, c, gh->font, gh->color);
gdispGDrawChar(gh->display, gh->x+x, gh->y+y, c, gh->font, gh->color);
}
void gwinFillChar(GHandle gh, coord_t x, coord_t y, char c) {
@ -422,9 +423,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispFillChar(gh->x+x, gh->y+y, c, gh->font, gh->color, gh->bgcolor);
gdispGFillChar(gh->display, gh->x+x, gh->y+y, c, gh->font, gh->color, gh->bgcolor);
}
void gwinDrawString(GHandle gh, coord_t x, coord_t y, const char *str) {
@ -432,9 +433,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispDrawString(gh->x+x, gh->y+y, str, gh->font, gh->color);
gdispGDrawString(gh->display, gh->x+x, gh->y+y, str, gh->font, gh->color);
}
void gwinFillString(GHandle gh, coord_t x, coord_t y, const char *str) {
@ -442,9 +443,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispFillString(gh->x+x, gh->y+y, str, gh->font, gh->color, gh->bgcolor);
gdispGFillString(gh->display, gh->x+x, gh->y+y, str, gh->font, gh->color, gh->bgcolor);
}
void gwinDrawStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify) {
@ -452,9 +453,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispDrawStringBox(gh->x+x, gh->y+y, cx, cy, str, gh->font, gh->color, justify);
gdispGDrawStringBox(gh->display, gh->x+x, gh->y+y, cx, cy, str, gh->font, gh->color, justify);
}
void gwinFillStringBox(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, const char* str, justify_t justify) {
@ -462,9 +463,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispFillStringBox(gh->x+x, gh->y+y, cx, cy, str, gh->font, gh->color, gh->bgcolor, justify);
gdispGFillStringBox(gh->display, gh->x+x, gh->y+y, cx, cy, str, gh->font, gh->color, gh->bgcolor, justify);
}
#endif
@ -474,9 +475,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispDrawPoly(tx+gh->x, ty+gh->y, pntarray, cnt, gh->color);
gdispGDrawPoly(gh->display, tx+gh->x, ty+gh->y, pntarray, cnt, gh->color);
}
void gwinFillConvexPoly(GHandle gh, coord_t tx, coord_t ty, const point *pntarray, unsigned cnt) {
@ -484,9 +485,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gdispFillConvexPoly(tx+gh->x, ty+gh->y, pntarray, cnt, gh->color);
gdispGFillConvexPoly(gh->display, tx+gh->x, ty+gh->y, pntarray, cnt, gh->color);
}
#endif
@ -496,9 +497,9 @@ void gwinBlitArea(GHandle gh, coord_t x, coord_t y, coord_t cx, coord_t cy, coor
return GDISP_IMAGE_ERR_OK;
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
return gdispImageDraw(img, gh->x+x, gh->y+y, cx, cy, sx, sy);
return gdispGImageDraw(gh->display, img, gh->x+x, gh->y+y, cx, cy, sx, sy);
}
#endif

22
src/gwin/gwm.c

@ -119,7 +119,7 @@ static void WM_Delete(GHandle gh) {
// 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());
gdispGFillArea(gh->display, gh->x, gh->y, gh->width, gh->height, gwinGetDefaultBgColor());
}
// Remove it from the queue
@ -128,16 +128,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);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
if ((gh->flags & GWIN_FLG_VISIBLE)) {
if (gh->vmt->Redraw)
gh->vmt->Redraw(gh);
else
gdispFillArea(gh->x, gh->y, gh->width, gh->height, gh->bgcolor);
gdispGFillArea(gh->display, 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());
gdispGFillArea(gh->display, 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) {
@ -145,12 +145,12 @@ static void WM_Redim(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h) {
// 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 (x > gdispGGetWidth(gh->display)-MIN_WIN_WIDTH) x = gdispGGetWidth(gh->display)-MIN_WIN_WIDTH;
if (y > gdispGGetHeight(gh->display)-MIN_WIN_HEIGHT) y = gdispGGetHeight(gh->display)-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;
if (x+w > gdispGGetWidth(gh->display)) w = gdispGGetWidth(gh->display) - x;
if (y+h > gdispGGetHeight(gh->display)) h = gdispGGetHeight(gh->display) - y;
// If there has been no resize just exit
if (gh->x == x && gh->y == y && gh->width == w && gh->height == h)
@ -158,7 +158,7 @@ static void WM_Redim(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h) {
// Clear the old area
if ((gh->flags & GWIN_FLG_VISIBLE))
gdispFillArea(gh->x, gh->y, gh->width, gh->height, gwinGetDefaultBgColor());
gdispGFillArea(gh->display, gh->x, gh->y, gh->width, gh->height, gwinGetDefaultBgColor());
// Set the new size
gh->x = x; gh->y = y;
@ -168,7 +168,7 @@ static void WM_Redim(GHandle gh, coord_t x, coord_t y, coord_t w, coord_t h) {
if ((gh->flags & GWIN_FLG_VISIBLE)) {
if (gh->vmt->Redraw) {
#if GDISP_NEED_CLIP
gdispSetClip(gh->x, gh->y, gh->width, gh->height);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gh->vmt->Redraw(gh);
}
@ -190,7 +190,7 @@ static void WM_Raise(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);
gdispGSetClip(gh->display, gh->x, gh->y, gh->width, gh->height);
#endif
gh->vmt->Redraw(gh);
}

16
src/gwin/label.c

@ -48,8 +48,8 @@ static void gwinLabelDefaultDraw(GWidgetObject *gw, void *param) {
coord_t w, h;
(void) param;
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;
w = (gw->g.flags & GLABEL_FLG_WAUTO) ? getwidth(gw->text, gw->g.font, gdispGGetWidth(gw->g.display) - gw->g.x) : gw->g.width;
h = (gw->g.flags & GLABEL_FLG_HAUTO) ? getheight(gw->text, gw->g.font, gdispGGetWidth(gw->g.</