From 1f003cf9e6a6318af036b8d1df70aa4d64ea6d05 Mon Sep 17 00:00:00 2001 From: patacongo Date: Fri, 4 May 2012 20:48:52 +0000 Subject: Updated NxWM widgets, several NX, NxWidgets, and NxWM bug fixes git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4699 42af7a65-404d-4744-a932-0658087f49c3 --- nuttx/ChangeLog | 7 + nuttx/Documentation/NXGraphicsSubsystem.html | 13 +- nuttx/configs/sim/nxwm/defconfig | 9 +- nuttx/graphics/README.txt | 5 +- nuttx/graphics/nxbe/nxbe_move.c | 9 +- nuttx/graphics/nxglib/fb/nxglib_moverectangle.c | 14 +- nuttx/graphics/nxmu/nx_move.c | 6 +- nuttx/graphics/nxtk/nxtk_drawframe.c | 163 +++++++++++++++--------- nuttx/graphics/nxtk/nxtk_internal.h | 13 ++ nuttx/graphics/nxtk/nxtk_openwindow.c | 12 +- 10 files changed, 164 insertions(+), 87 deletions(-) (limited to 'nuttx') diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 84f349a46..fa2e7b162 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -2702,3 +2702,10 @@ * Various files. Fix warnings about variables that were initialized by not used. * configs/sim/*/defconfig: Changes to build a 32-bit simulation on a 32-bit platform did not make into all of the Make.defs files. + * graphics/nxmu/nx_move.c: Wrong opcode was being used in the server message; + Also there was an error in the offset calculation. + * graphics/nxglib/fb/nxglib_moverectangle.c: Offset argument is really a + position, not an offset. + * graphics/nxtk/nxtk_drawframe.c: Framed windows are now drawn in three + colors (instead of just two). + diff --git a/nuttx/Documentation/NXGraphicsSubsystem.html b/nuttx/Documentation/NXGraphicsSubsystem.html index 0eb18e54e..857fcd1a4 100644 --- a/nuttx/Documentation/NXGraphicsSubsystem.html +++ b/nuttx/Documentation/NXGraphicsSubsystem.html @@ -12,7 +12,7 @@

NX Graphics Subsystem

-

Last Updated: March 25, 2012

+

Last Updated: May 4, 2012

@@ -3277,11 +3277,13 @@ int nxf_convert_32bpp(FAR uint32_t *dest, uint16_t height,
CONFIG_NXTK_BORDERWIDTH:
Specifies with with of the border (in pixels) used with framed windows. The default is 4. -
CONFIG_NXTK_BORDERCOLOR1 and CONFIG_NXTK_BORDERCOLOR2: +
CONFIG_NXTK_BORDERCOLOR1, CONFIG_NXTK_BORDERCOLOR2, and CONFIG_NXTK_BORDERCOLOR3:
Specify the colors of the border used with framed windows. -
CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so -
is normally darker. The default is medium and dark grey, - respectively +
CONFIG_NXTK_BORDERCOLOR2 +
The shadow side color and so is normally darker. +
CONFIG_NXTK_BORDERCOLOR3 +
The shiny side color and so is normally brighter. + The default is medium, dark, and light grey, respectively
CONFIG_NXTK_AUTORAISE:
If set, a window will be raised to the top if the mouse position is over a visible portion of the window. Default: A mouse @@ -4198,6 +4200,7 @@ sudo ln -s libXext.so.6.4.0 libXext.so nxf_convert_32bpp() +
YES diff --git a/nuttx/configs/sim/nxwm/defconfig b/nuttx/configs/sim/nxwm/defconfig index b5ee1f5f9..37281ec7f 100644 --- a/nuttx/configs/sim/nxwm/defconfig +++ b/nuttx/configs/sim/nxwm/defconfig @@ -454,11 +454,11 @@ CONFIG_NET_RESOLV_ENTRIES=4 # CONFIG_NXTK_BORDERWIDTH # Specifies with with of the border (in pixels) used with # framed windows. The default is 4. -# CONFIG_NXTK_BORDERCOLOR1 and CONFIG_NXTK_BORDERCOLOR2 +# CONFIG_NXTK_BORDERCOLOR1, CONFIG_NXTK_BORDERCOLOR2, CONFIG_NXTK_BORDERCOLOR3 # Specify the colors of the border used with framed windows. -# CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so -# is normally darker. The default is medium and dark grey, -# respectively +# CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so is normally darker. +# CONFIG_NXTK_BORDERCOLOR3 is the shiny side color and so is normally brighter. +# The default is mediumdark grey, and light grey, respectively # CONFIG_NXTK_AUTORAISE # If set, a window will be raised to the top if the mouse position # is over a visible portion of the window. Default: A mouse @@ -534,6 +534,7 @@ CONFIG_NX_KBD=y #CONFIG_NXTK_BORDERWIDTH=4 CONFIG_NXTK_BORDERCOLOR1=0x005a96bd CONFIG_NXTK_BORDERCOLOR2=0x00233a49 +CONFIG_NXTK_BORDERCOLOR3=0x00f8f8f8 CONFIG_NXTK_AUTORAISE=n CONFIG_NXFONT_SANS22X29=n CONFIG_NXFONT_SANS23X27=y diff --git a/nuttx/graphics/README.txt b/nuttx/graphics/README.txt index acecfe433..3cd213247 100644 --- a/nuttx/graphics/README.txt +++ b/nuttx/graphics/README.txt @@ -256,10 +256,11 @@ CONFIG_NX_KBD CONFIG_NXTK_BORDERWIDTH Specifies with with of the border (in pixels) used with framed windows. The default is 4. -CONFIG_NXTK_BORDERCOLOR1 and CONFIG_NXTK_BORDERCOLOR2 +CONFIG_NXTK_BORDERCOLOR1, CONFIG_NXTK_BORDERCOLOR2, CONFIG_NXTK_BORDERCOLOR3 Specify the colors of the border used with framed windows. CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so is normally darker. - The default is medium and dark grey, respectively + CONFIG_NXTK_BORDERCOLOR3 is the shiny side color and so is normally brighter. + The default is mediumdark grey, and light grey, respectively CONFIG_NXTK_AUTORAISE If set, a window will be raised to the top if the mouse position is over a visible portion of the window. Default: A mouse button must be clicked over diff --git a/nuttx/graphics/nxbe/nxbe_move.c b/nuttx/graphics/nxbe/nxbe_move.c index c52151421..193b174c2 100644 --- a/nuttx/graphics/nxbe/nxbe_move.c +++ b/nuttx/graphics/nxbe/nxbe_move.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxbe/nxbe_move.c * - * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -93,6 +93,8 @@ static void nxbe_clipmovesrc(FAR struct nxbe_clipops_s *cops, if (info->offset.x != 0 || info->offset.y != 0) { + /* Offset is the destination position of the moved rectangle */ + offset.x = rect->pt1.x + info->offset.x; offset.y = rect->pt1.y + info->offset.y; @@ -160,8 +162,7 @@ static void nxbe_clipmovedest(FAR struct nxbe_clipops_s *cops, /* Clip to determine what is inside the bounds */ - nxgl_rectoffset(&tmprect1, rect, -offset.x, -offset.y); - nxgl_rectintersect(&src, &tmprect1, &dstdata->srcrect); + nxgl_rectintersect(&src, rect, &dstdata->srcrect); if (!nxgl_nullrect(&src)) { diff --git a/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c b/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c index d1bcbe7c9..d8e52250c 100644 --- a/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c +++ b/nuttx/graphics/nxglib/fb/nxglib_moverectangle.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxglib/fb/nxglib_moverectangle.c * - * Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -185,14 +185,16 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX) * source position. */ - dline = (FAR uint8_t*)sline - offset->y * stride - NXGL_SCALEX(offset->x); + dline = pinfo->fbmem + offset->y * stride + NXGL_SCALEX(offset->x); /* Case 1: Is the destination position above the displayed position? - * If the Y offset is negative, then the destination is offset to a - * postion below (or to the right) in the source in framebuffer memory. + * If the destination position is less then then the src address, then the + * destination is offset to a postion below (and or to the left) of the + * source in framebuffer memory. */ - if (offset->y < 0 || (offset->y == 0 && offset->x <= 0)) + if (offset->y < rect->pt1.y || + (offset->y < rect->pt1.y && offset->x <= rect->pt1.x)) { /* Yes.. Copy the rectangle from top down (i.e., adding the stride * to move to the next, lower row) */ diff --git a/nuttx/graphics/nxmu/nx_move.c b/nuttx/graphics/nxmu/nx_move.c index 6159ce0ca..3f4a00e2f 100644 --- a/nuttx/graphics/nxmu/nx_move.c +++ b/nuttx/graphics/nxmu/nx_move.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxmu/nx_move.c * - * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -102,7 +102,7 @@ int nx_move(NXWINDOW hwnd, FAR const struct nxgl_rect_s *rect, /* Format the fill command */ - outmsg.msgid = NX_SVRMSG_FILL; + outmsg.msgid = NX_SVRMSG_MOVE; outmsg.wnd = wnd; outmsg.offset.x = offset->x; outmsg.offset.y = offset->y; diff --git a/nuttx/graphics/nxtk/nxtk_drawframe.c b/nuttx/graphics/nxtk/nxtk_drawframe.c index edf3dcac8..1ffbf689b 100644 --- a/nuttx/graphics/nxtk/nxtk_drawframe.c +++ b/nuttx/graphics/nxtk/nxtk_drawframe.c @@ -1,8 +1,8 @@ /**************************************************************************** * graphics/nxtk/nxtk_drawframe.c * - * Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. - * Author: Gregory Nutt + * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved. + * Author: Gregory Nutt * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -114,45 +114,79 @@ int nxtk_drawframe(FAR struct nxtk_framedwindow_s *fwnd, struct nxgl_rect_s frame; struct nxgl_size_s wndsize; struct nxgl_size_s tbsize; + nxgl_coord_t thickness; + + /* Shiny edge: + * Thickness: 1 + * Color: CONFIG_NXTK_BORDERCOLOR3; + * Condition: CONFIG_NXTK_BORDERWIDTH > 2 + * Central part: + * Thickness: Varies with CONFIG_NXTK_BORDERWIDTH + * Color: CONFIG_NXTK_BORDERCOLOR1; + * Condition: CONFIG_NXTK_BORDERWIDTH > 0 + * Shadow part: + * Thickness: 1; + * Color: CONFIG_NXTK_BORDERCOLOR2; + * Condition: CONFIG_NXTK_BORDERWIDTH > 1 + */ + +#if CONFIG_NXTK_BORDERWIDTH > 2 + thickness = CONFIG_NXTK_BORDERWIDTH - 2; +#elif CONFIG_NXTK_BORDERWIDTH > 1 + thickness = CONFIG_NXTK_BORDERWIDTH - 1; +#else + thickness = CONFIG_NXTK_BORDERWIDTH; +#endif /* Get the size of the rectangle */ nxgl_rectsize(&wndsize, &fwnd->wnd.bounds); nxgl_rectsize(&tbsize, &fwnd->tbrect); - /* Draw the top. Thickness: CONFIG_NXTK_BORDERWIDTH-1, Color: - * CONFIG_NXTK_BORDERCOLOR1 - */ + /* Draw the top ***********************************************************/ +#if CONFIG_NXTK_BORDERWIDTH > 0 frame.pt1.x = 0; frame.pt2.x = wndsize.w - 1; - frame.pt1.y = 0; -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt2.y = CONFIG_NXTK_BORDERWIDTH - 2; -#else - frame.pt2.y = CONFIG_NXTK_BORDERWIDTH - 1; + + /* Draw the shiny edge */ + +#if CONFIG_NXTK_BORDERWIDTH > 2 + frame.pt2.y = 0; + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3); + frame.pt1.y = 1; #endif + + /* Draw the central part */ + + frame.pt2.y = frame.pt1.y + thickness - 1; nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); /* Draw a single line under the toolbar, color CONFIG_NXTK_BORDERCOLOR2 */ #if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt1.y += tbsize.h + CONFIG_NXTK_BORDERWIDTH - 1; + frame.pt1.y += tbsize.h + thickness; frame.pt2.y = frame.pt1.y; nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); #endif - /* Draw the bottom. First, thickness: CONFIG_NXTK_BORDERWIDTH-1, - * Color: CONFIG_NXTK_BORDERCOLOR1 - */ + /* Draw the bottom ********************************************************/ +#if CONFIG_NXTK_BORDERWIDTH > 0 frame.pt1.y = wndsize.h - CONFIG_NXTK_BORDERWIDTH; -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt2.y = wndsize.h - 2; -#else + + /* Draw the shiny edge */ + +#if CONFIG_NXTK_BORDERWIDTH > 2 frame.pt2.y = frame.pt1.y; + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3); + frame.pt1.y ++; #endif + + /* Draw the central part */ + + frame.pt2.y = frame.pt1.y + thickness - 1; nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); /* Then a single line at the very bottom, Color: CONFIG_NXTK_BORDERCOLOR2 */ @@ -161,76 +195,83 @@ int nxtk_drawframe(FAR struct nxtk_framedwindow_s *fwnd, frame.pt1.y = wndsize.h - 1; frame.pt2.y = frame.pt1.y; nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); +#endif #endif - /* Draw the outer left side. Thickness: CONFIG_NXTK_BORDERWIDTH-1, - * Color: CONFIG_NXTK_BORDERCOLOR1 - */ + /* Draw left and right outer edges *****************************************/ - frame.pt1.y = 0; - frame.pt2.y = wndsize.h - 2; + /* Draw the shiny left out edge */ - frame.pt1.x = 0; #if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt2.x = CONFIG_NXTK_BORDERWIDTH - 2; -#else + frame.pt1.x = 0; + frame.pt1.y = 1; +#if CONFIG_NXTK_BORDERWIDTH > 2 frame.pt2.x = frame.pt1.x; + frame.pt2.y = wndsize.h - 2; + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3); #endif - nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); - /* Draw the outer right side. Thickness: 1, Color: CONFIG_NXTK_BORDERCOLOR2 */ + /* Draw the shadowed right outer edge */ -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt1.x = wndsize.w - 1; + frame.pt1.x = wndsize.w - 2; frame.pt2.x = frame.pt1.x; nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); #endif - /* Draw the inner left side, Thickness: 1, Color: CONFIG_NXTK_BORDERCOLOR2. - * This segment stops at the bottom of the toolbar. If there is a - * tool bar, then we have to continue this to the top of the display - * using g_bordercolor1 (see below) - */ + /* Draw left and right central regions *************************************/ -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt1.y = CONFIG_NXTK_BORDERWIDTH - 1 + tbsize.h; +#if CONFIG_NXTK_BORDERWIDTH > 2 + frame.pt1.x = 1; + frame.pt1.y = 1; + frame.pt2.x = frame.pt1.x + thickness - 1; + frame.pt2.y = wndsize.h - 2; #else - frame.pt1.y = CONFIG_NXTK_BORDERWIDTH + tbsize.h; -#endif - frame.pt2.y = wndsize.h - CONFIG_NXTK_BORDERWIDTH - 1; -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt1.x = CONFIG_NXTK_BORDERWIDTH - 1; - frame.pt2.x = frame.pt1.x; - nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); + frame.pt1.x = 0; + frame.pt1.y = 0; + frame.pt2.x = frame.pt1.x + thickness - 1; + frame.pt2.y = wndsize.h - 1; #endif + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); - /* Draw the inner left side, Thickness: CONFIG_NXTK_BORDERWIDTH-1, - * Color: CONFIG_NXTK_BORDERCOLOR1 - */ - -#if CONFIG_NXTK_BORDERWIDTH > 1 - frame.pt1.x = wndsize.w - CONFIG_NXTK_BORDERWIDTH; +#if CONFIG_NXTK_BORDERWIDTH > 2 + frame.pt1.x = wndsize.w - thickness - 1; frame.pt2.x = wndsize.w - 2; #else - frame.pt1.x = wndsize.w - 1; - frame.pt2.x = frame.pt1.x; + frame.pt1.x = wndsize.w - thickness; + frame.pt2.x = wndsize.w - 1; #endif nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); +#endif - /* When there is a toolbar, we also have to patch in this tiny - * line segment -- Is there a better way? + /* Draw left and right inner sides *****************************************/ + /* This segment stops at the bottom of the toolbar. If there is a + * tool bar, then we have to continue this to the top of the display + * using g_bordercolor1 (see below) */ + /* Draw the shadowed left inner edge */ + #if CONFIG_NXTK_BORDERWIDTH > 1 - if (tbsize.h > 0) - { - frame.pt1.y = 0; - frame.pt2.y = CONFIG_NXTK_BORDERWIDTH + tbsize.h - 2; +#if CONFIG_NXTK_BORDERWIDTH > 2 + frame.pt1.x = thickness + 1; + frame.pt1.y = tbsize.h + thickness + 1; + frame.pt2.x = frame.pt1.x; + frame.pt2.y = wndsize.h - thickness - 2; +#else + frame.pt1.x = thickness; + frame.pt1.y = tbsize.h + thickness; + frame.pt2.x = frame.pt1.x; + frame.pt2.y = wndsize.h - thickness - 1; +#endif + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); - frame.pt1.x = CONFIG_NXTK_BORDERWIDTH - 1; - frame.pt2.x = frame.pt1.x; - nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); - } + /* Draw the shiny right inner edge */ + +#if CONFIG_NXTK_BORDERWIDTH > 2 + frame.pt1.x = wndsize.w - thickness - 2; + frame.pt2.x = frame.pt1.x; + nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3); +#endif #endif return OK; diff --git a/nuttx/graphics/nxtk/nxtk_internal.h b/nuttx/graphics/nxtk/nxtk_internal.h index 5351048cf..763b1bfe8 100644 --- a/nuttx/graphics/nxtk/nxtk_internal.h +++ b/nuttx/graphics/nxtk/nxtk_internal.h @@ -80,6 +80,18 @@ # endif #endif +#ifndef CONFIG_NXTK_BORDERCOLOR3 +# if !defined(CONFIG_NX_DISABLE_32BPP) || !defined(CONFIG_NX_DISABLE_24BPP) +# define CONFIG_NXTK_BORDERCOLOR3 0x00d9d9d9 +# elif !defined(CONFIG_NX_DISABLE_16BPP) +# define CONFIG_NXTK_BORDERCOLOR3 0xdedb +# elif !defined(CONFIG_NX_DISABLE_4BPP) +# define CONFIG_NXTK_BORDERCOLOR3 8 +# else +# define CONFIG_NXTK_BORDERCOLOR3 'S' +# endif +#endif + /**************************************************************************** * Public Types ****************************************************************************/ @@ -124,6 +136,7 @@ extern FAR const struct nx_callback_s g_nxtkcb; extern nxgl_mxpixel_t g_bordercolor1[CONFIG_NX_NPLANES]; extern nxgl_mxpixel_t g_bordercolor2[CONFIG_NX_NPLANES]; +extern nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES]; /**************************************************************************** * Public Function Prototypes diff --git a/nuttx/graphics/nxtk/nxtk_openwindow.c b/nuttx/graphics/nxtk/nxtk_openwindow.c index 3716e63ca..4080b0e7a 100644 --- a/nuttx/graphics/nxtk/nxtk_openwindow.c +++ b/nuttx/graphics/nxtk/nxtk_openwindow.c @@ -68,7 +68,7 @@ nxgl_mxpixel_t g_bordercolor1[CONFIG_NX_NPLANES] = { CONFIG_NXTK_BORDERCOLOR1 #if CONFIG_NX_NPLANES > 1 -# error "Multiple corder colors not defined" +# error "Multiple plane border colors not defined" #endif }; @@ -76,7 +76,15 @@ nxgl_mxpixel_t g_bordercolor2[CONFIG_NX_NPLANES] = { CONFIG_NXTK_BORDERCOLOR2 #if CONFIG_NX_NPLANES > 1 -# error "Multiple border colors not defined" +# error "Multiple plane border colors not defined" +#endif +}; + +nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES] = +{ + CONFIG_NXTK_BORDERCOLOR3 +#if CONFIG_NX_NPLANES > 1 +# error "Multiple plane border colors not defined" #endif }; -- cgit v1.2.3