Updated NxWM widgets, several NX, NxWidgets, and NxWM bug fixes

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4699 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo
2012-05-04 20:48:52 +00:00
parent 78ec889980
commit 8e45cf0546
24 changed files with 641 additions and 184 deletions
+3 -1
View File
@@ -22,6 +22,8 @@
need to "rewind" to the beginning of the image. need to "rewind" to the beginning of the image.
* CRlePalettBitmap: Fixe a positioning problem. It was actually losing * CRlePalettBitmap: Fixe a positioning problem. It was actually losing
the last row of every image! the last row of every image!
* CNxWidget: Removed support for "shelving" widgets. I will be removing * CNxWidget: Removed support for "shelving" widgets. I will be removing
some lesser used feature over time in order to reduce the NxWidgets some lesser used feature over time in order to reduce the NxWidgets
footprint. footprint.
* CNxWidget: Removed support for reference constants and close types.
The goal is to ge the base widget class as small as possible.
@@ -123,17 +123,6 @@ namespace NXWidgets
{ {
public: public:
/**
* Enum describing the way other widgets should behave when they try to
* close this widget.
*/
enum CloseType
{
CLOSE_TYPE_CLOSE = 0, /**< Widgets should call the close() method */
CLOSE_TYPE_HIDE = 1 /**< Widgets should call the hide() method */
};
/** /**
* Enum listing flags that can be set in the constructor's "flags" parameter. * Enum listing flags that can be set in the constructor's "flags" parameter.
*/ */
@@ -184,7 +173,6 @@ namespace NXWidgets
protected: protected:
CWidgetControl *m_widgetControl; /**< The controlling widget for the display */ CWidgetControl *m_widgetControl; /**< The controlling widget for the display */
CRect m_rect; /**< Rectange bounding the widget. */ CRect m_rect; /**< Rectange bounding the widget. */
uint32_t m_refcon; /**< Identifying number of the widget. */
// Dragging variables // Dragging variables
@@ -221,7 +209,6 @@ namespace NXWidgets
// Visible regions // Visible regions
CRectCache *m_rectCache; /**< List of the widget's visible regions. */ CRectCache *m_rectCache; /**< List of the widget's visible regions. */
CloseType m_closeType; /**< Type of close method that should be called for the widget. */
WidgetBorderSize m_borderSize; /**< Size of the widget borders. */ WidgetBorderSize m_borderSize; /**< Size of the widget borders. */
/** /**
@@ -507,28 +494,6 @@ namespace NXWidgets
const nxgl_coord_t getRelativeY(void) const; const nxgl_coord_t getRelativeY(void) const;
/**
* Get the reference constant for this widget.
* @return The reference constant.
*/
inline const uint32_t getRefcon(void) const
{
return m_refcon;
}
/**
* Get the type of close routine that should be called by other widgets
* interacting with this widget.
*
* @return The close type of this widget.
*/
inline const CloseType getCloseType(void)
{
return m_closeType;
}
/** /**
* Is the widget active? * Is the widget active?
* A value of true indicates that this widget has focus or is an ancestor * A value of true indicates that this widget has focus or is an ancestor
@@ -900,15 +865,6 @@ namespace NXWidgets
return m_style.colors.selectedText; return m_style.colors.selectedText;
} }
/**
* Sets this widget's reference constant. This should be unique,
* at least amongst this widget's siblings.
*
* @param refcon The reference constant.
*/
uint32_t setRefcon(uint32_t refcon);
/** /**
* Sets this widget's border state. * Sets this widget's border state.
* *
@@ -1091,17 +1047,6 @@ namespace NXWidgets
m_style.colors.selectedText = color; m_style.colors.selectedText = color;
} }
/**
* Sets the close type other widgets should use when closing this widget.
*
* @param closeType The close type to use.
*/
inline void setCloseType(const CloseType closeType)
{
m_closeType = closeType;
}
/** /**
* Sets the font. * Sets the font.
* *
-19
View File
@@ -189,10 +189,6 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl,
m_lastClickY = 0; m_lastClickY = 0;
m_doubleClickBounds = DOUBLE_CLICK_BOUNDS; m_doubleClickBounds = DOUBLE_CLICK_BOUNDS;
// Set other default values
m_refcon = 0;
// Set border size to 1 line // Set border size to 1 line
m_borderSize.top = 1; m_borderSize.top = 1;
@@ -200,7 +196,6 @@ CNxWidget::CNxWidget(CWidgetControl *pWidgetControl,
m_borderSize.bottom = 1; m_borderSize.bottom = 1;
m_borderSize.left = 1; m_borderSize.left = 1;
m_closeType = CLOSE_TYPE_CLOSE;
m_rectCache = new CRectCache(this); m_rectCache = new CRectCache(this);
m_widgetEventHandlers = new CWidgetEventHandlerList(this); m_widgetEventHandlers = new CWidgetEventHandlerList(this);
} }
@@ -506,20 +501,6 @@ TNxArray<CRect> *CNxWidget::getForegroundRegions(void)
return m_rectCache->getForegroundRegions(); return m_rectCache->getForegroundRegions();
} }
/**
* Sets this widget's reference constant. This should be unique,
* at least amongst this widget's siblings.
*
* @param refcon The reference constant.
*/
uint32_t CNxWidget::setRefcon(uint32_t refcon)
{
uint32_t old = m_refcon;
m_refcon = refcon;
return old;
}
/** /**
* Sets this widget's border state. * Sets this widget's border state.
* *
+1 -1
View File
@@ -44,7 +44,7 @@ CSRCS =
# Window Manager # Window Manager
CXXSRCS = capplicationwindow.cxx cnxconsole.cxx cstartwindow.cxx ctaskbar.cxx CXXSRCS = capplicationwindow.cxx cnxconsole.cxx cstartwindow.cxx ctaskbar.cxx
# Images # Images
CXXSRCS += glyph_minimize.cxx glyph_nsh.cxx glyph_start.cxx glyph_stop.cxx CXXSRCS += glyph_cmd.cxx glyph_minimize.cxx glyph_nsh.cxx glyph_play.cxx glyph_start.cxx glyph_stop.cxx
SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS) SRCS = $(ASRCS) $(CSRCS) $(CXXSRCS)
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 264 B

BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 550 B

+18
View File
@@ -248,6 +248,7 @@
* *
* CONFIG_NXWM_STARTWINDOW_VSPACING - Vertical spacing. Default: 2 pixels * CONFIG_NXWM_STARTWINDOW_VSPACING - Vertical spacing. Default: 2 pixels
* CONFIG_NXWM_STARTWINDOW_HSPACING - Horizontal spacing. Default: 2 rows * CONFIG_NXWM_STARTWINDOW_HSPACING - Horizontal spacing. Default: 2 rows
* CONFIG_NXWM_STARTWINDOW_ICON - The glyph to use as the start window icon
*/ */
#ifndef CONFIG_NXWM_STARTWINDOW_VSPACING #ifndef CONFIG_NXWM_STARTWINDOW_VSPACING
@@ -258,6 +259,14 @@
# define CONFIG_NXWM_STARTWINDOW_HSPACING (2) # define CONFIG_NXWM_STARTWINDOW_HSPACING (2)
#endif #endif
/**
* The start window glyph
*/
#ifndef CONFIG_NXWM_STARTWINDOW_ICON
# define CONFIG_NXWM_STARTWINDOW_ICON NxWM::g_playBitmap
#endif
/* NxConsole Window *********************************************************/ /* NxConsole Window *********************************************************/
/** /**
* NxConsole Window Configuration * NxConsole Window Configuration
@@ -275,6 +284,7 @@
* NxConsole window. Default: MKRGB(0,0,0) * NxConsole window. Default: MKRGB(0,0,0)
* CONFIG_NXWM_NXCONSOLE_FONTID - The ID of the font to use in the NxConsole * CONFIG_NXWM_NXCONSOLE_FONTID - The ID of the font to use in the NxConsole
* window. Default: CONFIG_NXWM_DEFAULT_FONTID * window. Default: CONFIG_NXWM_DEFAULT_FONTID
* CONFIG_NXWM_NXCONSOLE_ICON - The glyph to use as the NxConsole icon
*/ */
#ifndef CONFIG_NXWM_NXCONSOLE_PRIO #ifndef CONFIG_NXWM_NXCONSOLE_PRIO
@@ -302,6 +312,14 @@
# define CONFIG_NXWM_NXCONSOLE_FONTID CONFIG_NXWM_DEFAULT_FONTID # define CONFIG_NXWM_NXCONSOLE_FONTID CONFIG_NXWM_DEFAULT_FONTID
#endif #endif
/**
* The NxConsole window glyph
*/
#ifndef CONFIG_NXWM_NXCONSOLE_ICON
# define CONFIG_NXWM_NXCONSOLE_ICON NxWM::g_cmdBitmap
#endif
/**************************************************************************** /****************************************************************************
* Global Function Prototypes * Global Function Prototypes
****************************************************************************/ ****************************************************************************/
+3 -1
View File
@@ -57,8 +57,10 @@
namespace NxWM namespace NxWM
{ {
extern const struct NXWidgets::SRlePaletteBitmap g_nshBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_cmdBitmap;
extern const struct NXWidgets::SRlePaletteBitmap g_minimizeBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_minimizeBitmap;
extern const struct NXWidgets::SRlePaletteBitmap g_nshBitmap;
extern const struct NXWidgets::SRlePaletteBitmap g_playBitmap;
extern const struct NXWidgets::SRlePaletteBitmap g_startBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_startBitmap;
extern const struct NXWidgets::SRlePaletteBitmap g_stopBitmap; extern const struct NXWidgets::SRlePaletteBitmap g_stopBitmap;
} }
+1 -1
View File
@@ -169,7 +169,7 @@ CApplicationWindow *CNxConsole::getWindow(void) const
NXWidgets::IBitmap *CNxConsole::getIcon(void) NXWidgets::IBitmap *CNxConsole::getIcon(void)
{ {
NXWidgets::CRlePaletteBitmap *bitmap = NXWidgets::CRlePaletteBitmap *bitmap =
new NXWidgets::CRlePaletteBitmap(&g_nshBitmap); new NXWidgets::CRlePaletteBitmap(&CONFIG_NXWM_NXCONSOLE_ICON);
return bitmap; return bitmap;
} }
+1 -1
View File
@@ -120,7 +120,7 @@ CApplicationWindow *CStartWindow::getWindow(void) const
NXWidgets::IBitmap *CStartWindow::getIcon(void) NXWidgets::IBitmap *CStartWindow::getIcon(void)
{ {
NXWidgets::CRlePaletteBitmap *bitmap = NXWidgets::CRlePaletteBitmap *bitmap =
new NXWidgets::CRlePaletteBitmap(&g_startBitmap); new NXWidgets::CRlePaletteBitmap(&CONFIG_NXWM_STARTWINDOW_ICON);
return bitmap; return bitmap;
} }
+181
View File
@@ -0,0 +1,181 @@
/********************************************************************************************
* NxWidgets/nxwm/src/glyph_cmd.cxx
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
* me 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 THE
* COPYRIGHT OWNER OR CONTRIBUTORS 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.
*
********************************************************************************************/
/********************************************************************************************
* Included Files
********************************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <nuttx/nx/nxglib.h>
#include <nuttx/fb.h>
#include <nuttx/rgbcolors.h>
#include "crlepalettebitmap.hxx"
#include "nxwmconfig.hxx"
#include "nxwmglyphs.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
#define BITMAP_NROWS 22
#define BITMAP_NCOLUMNS 25
#define BITMAP_NLUTCODES 8
/********************************************************************************************
* Private Bitmap Data
********************************************************************************************/
using namespace NxWM;
/* RGB24 (8-8-8) Colors */
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
static const uint32_t g_cmdNormalLut[BITMAP_NLUTCODES] =
{
0x909090, 0x000000, 0xb4fcfc, 0xb4d8fc, 0x6cb4fc, 0x6c6c6c, 0xfcfcfc, 0x484848
};
static const uint32_t g_cmdBrightlLut[BITMAP_NLUTCODES] =
{
0xababab, 0x3f3f3f, 0xc6fcfc, 0xc6e1fc, 0x90c6fc, 0x909090, 0xfcfcfc, 0x757575
};
/* RGB16 (565) Colors (four of the colors in this map are duplicates) */
#elif CONFIG_NXWIDGETS_BPP == 16
static const uint16_t g_cmdNormalLut[BITMAP_NLUTCODES] =
{
0x9492, 0x0000, 0xb7ff, 0xb6df, 0x6dbf, 0x6b6d, 0xffff, 0x4a49
};
static const uint16_t g_cmdBrightlLut[BITMAP_NLUTCODES] =
{
0xad55, 0x39e7, 0xc7ff, 0xc71f, 0x963f, 0x9492, 0xffff, 0x73ae
};
/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
* to lookup an 8-bit value. There is no savings in that! It would be better to just put
* the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
* pointless lookups. But these p;ointless lookups do make the logic compatible with the
* 16- and 24-bit types.
*/
#elif CONFIG_NXWIDGETS_BPP == 8
# ifdef CONFIG_NXWIDGETS_GREYSCALE
/* 8-bit Greyscale */
static const uint8_t g_cmdNormalLut[BITMAP_NLUTCODES] =
{
0x90, 0x00, 0xe6, 0xd1, 0xa6, 0x6c, 0xfc, 0x48
};
static const uint8_t g_cmdBrightlLut[BITMAP_NLUTCODES] =
{
0xab, 0x3f, 0xeb, 0xdc, 0xbc, 0x90, 0xfc, 0x75
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */
/* RGB8 (332) Colors */
static const nxgl_mxpixel_t g_cmdNormalLut[BITMAP_NLUTCODES] =
{
0x92, 0x00, 0xbf, 0xbb, 0x77, 0x6d, 0xff, 0x49
};
static const nxgl_mxpixel_t g_cmdBrightlLut[BITMAP_NLUTCODES] =
{
0xb6, 0x24, 0xdf, 0xdf, 0x9b, 0x92, 0xff, 0x6d
};
# endif
#else
# error "Unsupport pixel format"
#endif
static const struct NXWidgets::SRlePaletteBitmapEntry g_cmdRleEntries[] =
{
{ 24, 0}, { 1, 1}, /* Row 0 */
{ 24, 0}, { 1, 1}, /* Row 1 */
{ 2, 0}, { 1, 2}, { 13, 3}, { 7, 4}, { 1, 0}, { 1, 1}, /* Row 2 */
{ 2, 0}, { 3, 3}, { 18, 4}, { 1, 0}, { 1, 1}, /* Row 3 */
{ 2, 0}, { 3, 3}, { 18, 4}, { 1, 0}, { 1, 1}, /* Row 4 */
{ 24, 0}, { 1, 1}, /* Row 5 */
{ 1, 0}, { 22, 1}, { 1, 0}, { 1, 1}, /* Row 6 */
{ 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 7 */
{ 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 8 */
{ 1, 0}, { 1, 1}, { 2, 5}, { 1, 6}, { 18, 5}, { 1, 0}, { 1, 1}, /* Row 9 */
{ 1, 0}, { 1, 1}, { 3, 5}, { 1, 6}, { 17, 5}, { 1, 0}, { 1, 1}, /* Row 10 */
{ 1, 0}, { 1, 1}, { 4, 5}, { 1, 6}, { 16, 5}, { 1, 0}, { 1, 1}, /* Row 11 */
{ 1, 0}, { 1, 1}, { 5, 5}, { 1, 6}, { 15, 5}, { 1, 0}, { 1, 1}, /* Row 12 */
{ 1, 0}, { 1, 1}, { 6, 5}, { 1, 6}, { 14, 5}, { 1, 0}, { 1, 1}, /* Row 13 */
{ 1, 0}, { 1, 1}, { 5, 5}, { 1, 6}, { 1, 7}, { 14, 5}, { 1, 0}, { 1, 1}, /* Row 14 */
{ 1, 0}, { 1, 1}, { 4, 5}, { 1, 6}, { 1, 7}, { 15, 5}, { 1, 0}, { 1, 1}, /* Row 15 */
{ 1, 0}, { 1, 1}, { 3, 5}, { 1, 6}, { 1, 7}, { 4, 5}, { 9, 6}, { 3, 5}, /* Row 16 */
{ 1, 0}, { 1, 1},
{ 1, 0}, { 1, 1}, { 2, 5}, { 1, 6}, { 1, 7}, { 6, 5}, { 9, 7}, { 2, 5}, /* Row 17 */
{ 1, 0}, { 1, 1},
{ 1, 0}, { 1, 1}, { 2, 5}, { 1, 7}, { 18, 5}, { 1, 0}, { 1, 1}, /* Row 18 */
{ 1, 0}, { 1, 1}, { 21, 5}, { 1, 0}, { 1, 1}, /* Row 19 */
{ 24, 0}, { 1, 1}, /* Row 20 */
{ 25, 1}, /* Row 21 */
};
/********************************************************************************************
* Public Bitmap Structure Defintions
********************************************************************************************/
const struct NXWidgets::SRlePaletteBitmap NxWM::g_cmdBitmap =
{
CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
CONFIG_NXWIDGETS_FMT, // fmt - Color format
BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
BITMAP_NCOLUMNS, // width - Width in pixels
BITMAP_NROWS, // height - Height in rows
{ // lut - Pointer to the beginning of the Look-Up Table (LUT)
g_cmdNormalLut, // Index 0: Unselected LUT
g_cmdBrightlLut, // Index 1: Selected LUT
},
g_cmdRleEntries // data - Pointer to the beginning of the RLE data
};
+26 -6
View File
@@ -70,20 +70,30 @@ using namespace NxWM;
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32 #if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
static const uint32_t g_minimizeLut[BITMAP_NLUTCODES] = static const uint32_t g_minimizeNormalLut[BITMAP_NLUTCODES] =
{ {
0x2448b4, 0x486cd8, 0x0024b4, 0x0024d8, 0x242490, 0x0000b4, 0xfcfcfc, 0xd8fcfc /* Codes 0-7 */ 0x2448b4, 0x486cd8, 0x0024b4, 0x0024d8, 0x242490, 0x0000b4, 0xfcfcfc, 0xd8fcfc /* Codes 0-7 */
}; };
static const uint32_t g_minimizeBrightLut[BITMAP_NLUTCODES] =
{
0x5a75c6, 0x7590e1, 0x3f5ac6, 0x3f5ae1, 0x5a5aab, 0x3f3fc6, 0xfcfcfc, 0xe1fcfc /* Codes 0-7 */
};
/* RGB16 (565) Colors (four of the colors in this map are duplicates) */ /* RGB16 (565) Colors (four of the colors in this map are duplicates) */
#elif CONFIG_NXWIDGETS_BPP == 16 #elif CONFIG_NXWIDGETS_BPP == 16
static const uint16_t g_minimizeLut[BITMAP_NLUTCODES] = static const uint16_t g_minimizeNormalLut[BITMAP_NLUTCODES] =
{ {
0x2256, 0x4b7b, 0x0136, 0x013b, 0x2132, 0x0016, 0xffff, 0xdfff /* Codes 0-7 */ 0x2256, 0x4b7b, 0x0136, 0x013b, 0x2132, 0x0016, 0xffff, 0xdfff /* Codes 0-7 */
}; };
static const uint16_t g_minimizeBrightLut[BITMAP_NLUTCODES] =
{
0x5bb8, 0x749c, 0x3ad8, 0x3adc, 0x5ad5, 0x39f8, 0xffff, 0xe7ff /* Codes 0-7 */
};
/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
* to lookup an 8-bit value. There is no savings in that! It would be better to just put * to lookup an 8-bit value. There is no savings in that! It would be better to just put
* the 8-bit color/greyscale value in the run-length encoded image and save the cost of these * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
@@ -96,20 +106,30 @@ static const uint16_t g_minimizeLut[BITMAP_NLUTCODES] =
/* 8-bit Greyscale */ /* 8-bit Greyscale */
static const uint8_t g_minimizeLut[BITMAP_NLUTCODES] = static const uint8_t g_minimizeNormalLut[BITMAP_NLUTCODES] =
{ {
0x49, 0x6d, 0x29, 0x2d, 0x30, 0x14, 0xfc, 0xf1 /* Codes 0-7 */ 0x49, 0x6d, 0x29, 0x2d, 0x30, 0x14, 0xfc, 0xf1 /* Codes 0-7 */
}; };
static const uint8_t g_minimizeBrightLut[BITMAP_NLUTCODES] =
{
0x76, 0x91, 0x5e, 0x61, 0x63, 0x4e, 0xfc, 0xf3 /* Codes 0-7 */
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */ # else /* CONFIG_NXWIDGETS_GREYSCALE */
/* RGB8 (332) Colors */ /* RGB8 (332) Colors */
static const nxgl_mxpixel_t g_minimizeLut[BITMAP_NLUTCODES] = static const nxgl_mxpixel_t g_minimizeNormalLut[BITMAP_NLUTCODES] =
{ {
0x2a, 0x4f, 0x06, 0x07, 0x26, 0x02, 0xff, 0xdf /* Codes 0-7 */ 0x2a, 0x4f, 0x06, 0x07, 0x26, 0x02, 0xff, 0xdf /* Codes 0-7 */
}; };
static const uint8_t g_minimizeBrightLut[BITMAP_NLUTCODES] =
{
0x4f, 0x73, 0x2b, 0x2b, 0x4a, 0x27, 0xff, 0xff /* Codes 0-7 */
};
# endif # endif
#else #else
# error "Unsupport pixel format" # error "Unsupport pixel format"
@@ -152,8 +172,8 @@ const struct NXWidgets::SRlePaletteBitmap NxWM::g_minimizeBitmap =
BITMAP_NCOLUMNS, // width - Width in pixels BITMAP_NCOLUMNS, // width - Width in pixels
BITMAP_NROWS, // height - Height in rows BITMAP_NROWS, // height - Height in rows
{ // lut - Pointer to the beginning of the Look-Up Table (LUT) { // lut - Pointer to the beginning of the Look-Up Table (LUT)
g_minimizeLut, // Index 0: Unselected LUT g_minimizeNormalLut, // Index 0: Unselected LUT
g_minimizeLut, // Index 1: Selected LUT g_minimizeBrightLut, // Index 1: Selected LUT
}, },
g_minimizeRleEntries // data - Pointer to the beginning of the RLE data g_minimizeRleEntries // data - Pointer to the beginning of the RLE data
}; };
+210
View File
@@ -0,0 +1,210 @@
/********************************************************************************************
* NxWidgets/nxwm/src/glyph_play.cxx
*
* Copyright (C) 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. 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.
* 3. Neither the name NuttX, NxWidgets, nor the names of its contributors
* me 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 THE
* COPYRIGHT OWNER OR CONTRIBUTORS 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.
*
********************************************************************************************/
/********************************************************************************************
* Included Files
********************************************************************************************/
#include <nuttx/config.h>
#include <sys/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <nuttx/nx/nxglib.h>
#include <nuttx/fb.h>
#include <nuttx/rgbcolors.h>
#include "crlepalettebitmap.hxx"
#include "nxwmconfig.hxx"
#include "nxwmglyphs.hxx"
/********************************************************************************************
* Pre-Processor Definitions
********************************************************************************************/
#define BITMAP_NROWS 25
#define BITMAP_NCOLUMNS 25
#define BITMAP_NLUTCODES 6
/********************************************************************************************
* Private Bitmap Data
********************************************************************************************/
using namespace NxWM;
/* RGB24 (8-8-8) Colors */
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
static const uint32_t g_playNormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x00d800, 0x008400, 0x006800, 0x00ac00, 0x004800, /* Codes 1-5 */
};
static const uint32_t g_playBrightlLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x3fe13f, 0x3fa23f, 0x3f8d3f, 0x3fc03f, 0x3f753f /* Codes 1-5 */
};
/* RGB16 (565) Colors (four of the colors in this map are duplicates) */
#elif CONFIG_NXWIDGETS_BPP == 16
static const uint16_t g_playNormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x06c0, 0x0420, 0x0340, 0x0560, 0x0240, /* Codes 0-5 */
};
static const uint16_t g_playBrightlLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x3f07, 0x3d07, 0x3c67, 0x3e07, 0x3ba7, /* Codes 0-5 */
};
/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
* to lookup an 8-bit value. There is no savings in that! It would be better to just put
* the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
* pointless lookups. But these p;ointless lookups do make the logic compatible with the
* 16- and 24-bit types.
*/
#elif CONFIG_NXWIDGETS_BPP == 8
# ifdef CONFIG_NXWIDGETS_GREYSCALE
/* 8-bit Greyscale */
static const uint8_t g_playNormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x7e, 0x4d, 0x3d, 0x64, 0x2a /* Codes 1-5 */
};
static const uint8_t g_playBrightlLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x9e, 0x79, 0x6c, 0x8a, 0x5e /* Codes 1-5 */
};
# else /* CONFIG_NXWIDGETS_GREYSCALE */
/* RGB8 (332) Colors */
static const nxgl_mxpixel_t g_playNormalLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x18, 0x10, 0x0c, 0x14, 0x08 /* Codes 0-5 */
};
static const nxgl_mxpixel_t g_playBrightlLut[BITMAP_NLUTCODES] =
{
CONFIG_NXWM_DEFAULT_BACKGROUNDCOLOR, /* Code 0 */
0x3c, 0x34, 0x30, 0x38, 0x2c /* Codes 0-5 */
};
# endif
#else
# error "Unsupport pixel format"
#endif
static const struct NXWidgets::SRlePaletteBitmapEntry g_playRleEntries[] =
{
{ 25, 0}, /* Row 0 */
{ 9, 0}, { 1, 1}, { 1, 2}, { 3, 3}, { 1, 2}, { 1, 1}, { 9, 0}, /* Row 1 */
{ 7, 0}, { 1, 1}, { 1, 3}, { 2, 2}, { 3, 1}, { 1, 4}, { 1, 3}, { 1, 5}, /* Row 2 */
{ 1, 2}, { 7, 0},
{ 6, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 7, 0}, { 1, 1}, { 1, 5}, { 1, 3}, /* Row 3 */
{ 6, 0},
{ 4, 0}, { 1, 1}, { 1, 2}, { 1, 5}, { 1, 4}, { 9, 0}, { 1, 1}, { 1, 2}, /* Row 4 */
{ 1, 5}, { 1, 3}, { 4, 0},
{ 3, 0}, { 1, 1}, { 1, 2}, { 1, 3}, { 1, 4}, { 1, 0}, { 1, 1}, { 10, 0}, /* Row 5 */
{ 1, 4}, { 1, 5}, { 1, 2}, { 3, 0},
{ 3, 0}, { 1, 3}, { 1, 5}, { 3, 0}, { 2, 1}, { 10, 0}, { 2, 3}, { 1, 4}, /* Row 6 */
{ 2, 0},
{ 2, 0}, { 1, 1}, { 1, 5}, { 1, 4}, { 3, 0}, { 1, 1}, { 1, 4}, { 2, 1}, /* Row 7 */
{ 8, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 2, 0},
{ 2, 0}, { 1, 3}, { 1, 2}, { 4, 0}, { 1, 1}, { 5, 4}, { 7, 0}, { 1, 1}, /* Row 8 */
{ 1, 5}, { 1, 2}, { 1, 0},
{ 1, 0}, { 1, 1}, { 1, 3}, { 1, 4}, { 4, 0}, { 1, 1}, { 7, 4}, { 6, 0}, /* Row 9 */
{ 1, 2}, { 1, 3}, { 1, 0},
{ 1, 1}, { 1, 3}, { 1, 5}, { 5, 0}, { 1, 1}, { 9, 4}, { 4, 0}, { 1, 4}, /* Row 10 */
{ 1, 2}, { 1, 4},
{ 1, 1}, { 1, 3}, { 1, 4}, { 5, 0}, { 1, 1}, { 11, 4}, { 2, 0}, { 1, 4}, /* Row 11 */
{ 1, 2}, { 1, 4},
{ 1, 1}, { 1, 5}, { 1, 1}, { 5, 0}, { 1, 4}, { 9, 2}, { 2, 3}, { 1, 5}, /* Row 12 */
{ 1, 0}, { 1, 4}, { 1, 2}, { 1, 4},
{ 1, 1}, { 1, 3}, { 1, 1}, { 5, 0}, { 1, 4}, { 7, 2}, { 3, 3}, { 1, 5}, /* Row 13 */
{ 2, 0}, { 1, 4}, { 1, 2}, { 1, 4},
{ 1, 1}, { 1, 3}, { 1, 4}, { 5, 0}, { 1, 4}, { 5, 2}, { 3, 3}, { 1, 5}, /* Row 14 */
{ 4, 0}, { 1, 2}, { 1, 3}, { 1, 4},
{ 1, 0}, { 1, 2}, { 1, 3}, { 5, 0}, { 1, 4}, { 3, 2}, { 3, 3}, { 1, 5}, /* Row 15 */
{ 5, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 1, 0},
{ 2, 0}, { 1, 5}, { 1, 4}, { 4, 0}, { 1, 4}, { 2, 2}, { 2, 3}, { 1, 5}, /* Row 16 */
{ 7, 0}, { 1, 2}, { 1, 5}, { 2, 0},
{ 2, 0}, { 1, 2}, { 1, 5}, { 1, 1}, { 3, 0}, { 1, 4}, { 2, 3}, { 1, 5}, /* Row 17 */
{ 8, 0}, { 1, 1}, { 1, 3}, { 1, 2}, { 2, 0},
{ 3, 0}, { 1, 2}, { 1, 3}, { 3, 0}, { 1, 3}, { 1, 5}, { 9, 0}, { 1, 1}, /* Row 18 */
{ 2, 3}, { 3, 0},
{ 3, 0}, { 1, 1}, { 1, 5}, { 1, 2}, { 2, 0}, { 1, 5}, { 9, 0}, { 1, 1}, /* Row 19 */
{ 1, 4}, { 1, 5}, { 4, 0},
{ 4, 0}, { 1, 1}, { 1, 5}, { 1, 3}, { 10, 0}, { 1, 1}, { 1, 3}, { 1, 5}, /* Row 20 */
{ 5, 0},
{ 6, 0}, { 1, 2}, { 1, 5}, { 1, 4}, { 6, 0}, { 1, 1}, { 1, 2}, { 1, 5}, /* Row 21 */
{ 1, 2}, { 6, 0},
{ 7, 0}, { 1, 3}, { 3, 5}, { 3, 3}, { 2, 5}, { 1, 3}, { 1, 2}, { 7, 0}, /* Row 22 */
{ 9, 0}, { 1, 4}, { 2, 2}, { 1, 3}, { 2, 2}, { 1, 4}, { 9, 0}, /* Row 23 */
{ 25, 0}, /* Row 24 */
};
/********************************************************************************************
* Public Bitmap Structure Defintions
********************************************************************************************/
const struct NXWidgets::SRlePaletteBitmap NxWM::g_playBitmap =
{
CONFIG_NXWIDGETS_BPP, // bpp - Bits per pixel
CONFIG_NXWIDGETS_FMT, // fmt - Color format
BITMAP_NLUTCODES, // nlut - Number of colors in the lLook-Up Table (LUT)
BITMAP_NCOLUMNS, // width - Width in pixels
BITMAP_NROWS, // height - Height in rows
{ // lut - Pointer to the beginning of the Look-Up Table (LUT)
g_playNormalLut, // Index 0: Unselected LUT
g_playBrightlLut, // Index 1: Selected LUT
},
g_playRleEntries // data - Pointer to the beginning of the RLE data
};
+27 -6
View File
@@ -70,22 +70,34 @@ using namespace NxWM;
#if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32 #if CONFIG_NXWIDGETS_BPP == 24 || CONFIG_NXWIDGETS_BPP == 32
static const uint32_t g_stopLut[BITMAP_NLUTCODES] = static const uint32_t g_stopNormalLut[BITMAP_NLUTCODES] =
{ {
0xd8d8d8, 0xfc6c6c, 0xfcb4b4, 0xd80000, 0xfc0000, 0x902424, 0xfcfcfc, 0xd8fcfc, /* Codes 0-7 */ 0xd8d8d8, 0xfc6c6c, 0xfcb4b4, 0xd80000, 0xfc0000, 0x902424, 0xfcfcfc, 0xd8fcfc, /* Codes 0-7 */
0xb40000, 0xb40024, 0xfcd8d8 /* Codes 8-10 */ 0xb40000, 0xb40024, 0xfcd8d8 /* Codes 8-10 */
}; };
static const uint32_t g_stopBrightLut[BITMAP_NLUTCODES] =
{
0xe1e1e1, 0xfc9090, 0xfcc6c6, 0xe13f3f, 0xfc3f3f, 0xab5a5a, 0xfcfcfc, 0xe1fcfc, /* Codes 0-7 */
0xc63f3f, 0xc63f5a, 0xfce1e1 /* Codes 8-10 */
};
/* RGB16 (565) Colors (four of the colors in this map are duplicates) */ /* RGB16 (565) Colors (four of the colors in this map are duplicates) */
#elif CONFIG_NXWIDGETS_BPP == 16 #elif CONFIG_NXWIDGETS_BPP == 16
static const uint16_t g_stopLut[BITMAP_NLUTCODES] = static const uint16_t g_stopNormalLut[BITMAP_NLUTCODES] =
{ {
0xdedb, 0xfb6d, 0xfdb6, 0xd800, 0xf800, 0x9124, 0xffff, 0xdfff, 0xb000, 0xb004, /* Codes 0-9 */ 0xdedb, 0xfb6d, 0xfdb6, 0xd800, 0xf800, 0x9124, 0xffff, 0xdfff, 0xb000, 0xb004, /* Codes 0-9 */
0xfedb /* Codes 10-10 */ 0xfedb /* Codes 10-10 */
}; };
static const uint16_t g_stopBrightLut[BITMAP_NLUTCODES] =
{
0xe71c, 0xfc92, 0xfe38, 0xe1e7, 0xf9e7, 0xaacb, 0xffff, 0xe7ff, 0xc1e7, 0xc1eb, /* Codes 0-9 */
0xff1c /* Codes 10-10 */
};
/* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used /* 8-bit color lookups. NOTE: This is really dumb! The lookup index is 8-bits and it used
* to lookup an 8-bit value. There is no savings in that! It would be better to just put * to lookup an 8-bit value. There is no savings in that! It would be better to just put
* the 8-bit color/greyscale value in the run-length encoded image and save the cost of these * the 8-bit color/greyscale value in the run-length encoded image and save the cost of these
@@ -98,21 +110,30 @@ static const uint16_t g_stopLut[BITMAP_NLUTCODES] =
/* 8-bit Greyscale */ /* 8-bit Greyscale */
static const uint8_t g_stopLut[BITMAP_NLUTCODES] = static const uint8_t g_stopNormalLut[BITMAP_NLUTCODES] =
{ {
0xd8, 0x97, 0xc9, 0x40, 0x4b, 0x44, 0xfc, 0xf1, 0x35, 0x39, 0xe2 /* Codes 0-10 */ 0xd8, 0x97, 0xc9, 0x40, 0x4b, 0x44, 0xfc, 0xf1, 0x35, 0x39, 0xe2 /* Codes 0-10 */
};
static const uint8_t g_stopBrightLut[BITMAP_NLUTCODES] =
{
0xe1, 0xb0, 0xd6, 0x6f, 0x77, 0x72, 0xfc, 0xf3, 0x67, 0x6a, 0xe9 /* Codes 0-10 */
}; };
# else /* CONFIG_NXWIDGETS_GREYSCALE */ # else /* CONFIG_NXWIDGETS_GREYSCALE */
/* RGB8 (332) Colors */ /* RGB8 (332) Colors */
static const nxgl_mxpixel_t g_stopLut[BITMAP_NLUTCODES] = static const nxgl_mxpixel_t g_stopNormalLut[BITMAP_NLUTCODES] =
{ {
0xdb, 0xed, 0xf6, 0xc0, 0xe0, 0x84, 0xff, 0xdf, 0xa0, 0xa0, 0xfb /* Codes 0-10 */ 0xdb, 0xed, 0xf6, 0xc0, 0xe0, 0x84, 0xff, 0xdf, 0xa0, 0xa0, 0xfb /* Codes 0-10 */
}; };
static const uint8_t g_stopBrightLut[BITMAP_NLUTCODES] =
{
0xff, 0xf2, 0xfb, 0xe4, 0xe4, 0xa9, 0xff, 0xff, 0xc4, 0xc5, 0xff /* Codes 0-10 */
};
# endif # endif
#else #else
# error "Unsupport pixel format" # error "Unsupport pixel format"
@@ -166,8 +187,8 @@ const struct NXWidgets::SRlePaletteBitmap NxWM::g_stopBitmap =
BITMAP_NCOLUMNS, // width - Width in pixels BITMAP_NCOLUMNS, // width - Width in pixels
BITMAP_NROWS, // height - Height in rows BITMAP_NROWS, // height - Height in rows
{ // lut - Pointer to the beginning of the Look-Up Table (LUT) { // lut - Pointer to the beginning of the Look-Up Table (LUT)
g_stopLut, // Index 0: Unselected LUT g_stopNormalLut, // Index 0: Unselected LUT
g_stopLut, // Index 1: Selected LUT g_stopBrightLut, // Index 1: Selected LUT
}, },
g_stopRleEntries // data - Pointer to the beginning of the RLE data g_stopRleEntries // data - Pointer to the beginning of the RLE data
}; };
+7
View File
@@ -2702,3 +2702,10 @@
* Various files. Fix warnings about variables that were initialized by not used. * 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 * 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. 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).
+8 -5
View File
@@ -12,7 +12,7 @@
<h1><big><font color="#3c34ec"> <h1><big><font color="#3c34ec">
<i>NX Graphics Subsystem</i> <i>NX Graphics Subsystem</i>
</font></big></h1> </font></big></h1>
<p>Last Updated: March 25, 2012</p> <p>Last Updated: May 4, 2012</p>
</td> </td>
</tr> </tr>
</table> </table>
@@ -3277,11 +3277,13 @@ int nxf_convert_32bpp(FAR uint32_t *dest, uint16_t height,
<dt><code>CONFIG_NXTK_BORDERWIDTH</code>: <dt><code>CONFIG_NXTK_BORDERWIDTH</code>:
<dd>Specifies with with of the border (in pixels) used with <dd>Specifies with with of the border (in pixels) used with
framed windows. The default is 4. framed windows. The default is 4.
<dt><code>CONFIG_NXTK_BORDERCOLOR1</code> and <code>CONFIG_NXTK_BORDERCOLOR2</code>: <dt><code>CONFIG_NXTK_BORDERCOLOR1</code>, <code>CONFIG_NXTK_BORDERCOLOR2</code>, and <code>CONFIG_NXTK_BORDERCOLOR3</code>:
<dd>Specify the colors of the border used with framed windows. <dd>Specify the colors of the border used with framed windows.
<dt><code>CONFIG_NXTK_BORDERCOLOR2</code> is the shadow side color and so <dt><code>CONFIG_NXTK_BORDERCOLOR2</code>
<dd>is normally darker. The default is medium and dark grey, <dd>The shadow side color and so is normally darker.
respectively <dt><code>CONFIG_NXTK_BORDERCOLOR3</code>
<dd>The shiny side color and so is normally brighter.
The default is medium, dark, and light grey, respectively
<dt><code>CONFIG_NXTK_AUTORAISE</code>: <dt><code>CONFIG_NXTK_AUTORAISE</code>:
<dd>If set, a window will be raised to the top if the mouse position <dd>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 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
</tr> </tr>
<tr> <tr>
<td align="left" valign="top"><a href="#nxfconvertbpp"><code>nxf_convert_32bpp()</code></a></td> <td align="left" valign="top"><a href="#nxfconvertbpp"><code>nxf_convert_32bpp()</code></a></td>
<td><br></td>
<td align="center" bgcolor="skyblue">YES</td> <td align="center" bgcolor="skyblue">YES</td>
</tr> </tr>
</table></center> </table></center>
+5 -4
View File
@@ -454,11 +454,11 @@ CONFIG_NET_RESOLV_ENTRIES=4
# CONFIG_NXTK_BORDERWIDTH # CONFIG_NXTK_BORDERWIDTH
# Specifies with with of the border (in pixels) used with # Specifies with with of the border (in pixels) used with
# framed windows. The default is 4. # 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. # Specify the colors of the border used with framed windows.
# CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so # CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so is normally darker.
# is normally darker. The default is medium and dark grey, # CONFIG_NXTK_BORDERCOLOR3 is the shiny side color and so is normally brighter.
# respectively # The default is mediumdark grey, and light grey, respectively
# CONFIG_NXTK_AUTORAISE # CONFIG_NXTK_AUTORAISE
# If set, a window will be raised to the top if the mouse position # 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 # 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_BORDERWIDTH=4
CONFIG_NXTK_BORDERCOLOR1=0x005a96bd CONFIG_NXTK_BORDERCOLOR1=0x005a96bd
CONFIG_NXTK_BORDERCOLOR2=0x00233a49 CONFIG_NXTK_BORDERCOLOR2=0x00233a49
CONFIG_NXTK_BORDERCOLOR3=0x00f8f8f8
CONFIG_NXTK_AUTORAISE=n CONFIG_NXTK_AUTORAISE=n
CONFIG_NXFONT_SANS22X29=n CONFIG_NXFONT_SANS22X29=n
CONFIG_NXFONT_SANS23X27=y CONFIG_NXFONT_SANS23X27=y
+3 -2
View File
@@ -256,10 +256,11 @@ CONFIG_NX_KBD
CONFIG_NXTK_BORDERWIDTH CONFIG_NXTK_BORDERWIDTH
Specifies with with of the border (in pixels) used with framed windows. Specifies with with of the border (in pixels) used with framed windows.
The default is 4. 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. Specify the colors of the border used with framed windows.
CONFIG_NXTK_BORDERCOLOR2 is the shadow side color and so is normally darker. 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 CONFIG_NXTK_AUTORAISE
If set, a window will be raised to the top if the mouse position is over a 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 visible portion of the window. Default: A mouse button must be clicked over
+5 -4
View File
@@ -1,8 +1,8 @@
/**************************************************************************** /****************************************************************************
* graphics/nxbe/nxbe_move.c * graphics/nxbe/nxbe_move.c
* *
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * 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) 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.x = rect->pt1.x + info->offset.x;
offset.y = rect->pt1.y + info->offset.y; 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 */ /* Clip to determine what is inside the bounds */
nxgl_rectoffset(&tmprect1, rect, -offset.x, -offset.y); nxgl_rectintersect(&src, rect, &dstdata->srcrect);
nxgl_rectintersect(&src, &tmprect1, &dstdata->srcrect);
if (!nxgl_nullrect(&src)) if (!nxgl_nullrect(&src))
{ {
@@ -1,8 +1,8 @@
/**************************************************************************** /****************************************************************************
* graphics/nxglib/fb/nxglib_moverectangle.c * graphics/nxglib/fb/nxglib_moverectangle.c
* *
* Copyright (C) 2008-2011 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * modification, are permitted provided that the following conditions
@@ -185,14 +185,16 @@ void NXGL_FUNCNAME(nxgl_moverectangle,NXGLIB_SUFFIX)
* source position. * 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? /* Case 1: Is the destination position above the displayed position?
* If the Y offset is negative, then the destination is offset to a * If the destination position is less then then the src address, then the
* postion below (or to the right) in the source in framebuffer memory. * 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 /* Yes.. Copy the rectangle from top down (i.e., adding the stride
* to move to the next, lower row) */ * to move to the next, lower row) */
+3 -3
View File
@@ -1,8 +1,8 @@
/**************************************************************************** /****************************************************************************
* graphics/nxmu/nx_move.c * graphics/nxmu/nx_move.c
* *
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009, 2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * 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 */ /* Format the fill command */
outmsg.msgid = NX_SVRMSG_FILL; outmsg.msgid = NX_SVRMSG_MOVE;
outmsg.wnd = wnd; outmsg.wnd = wnd;
outmsg.offset.x = offset->x; outmsg.offset.x = offset->x;
outmsg.offset.y = offset->y; outmsg.offset.y = offset->y;
+108 -67
View File
@@ -1,8 +1,8 @@
/**************************************************************************** /****************************************************************************
* graphics/nxtk/nxtk_drawframe.c * graphics/nxtk/nxtk_drawframe.c
* *
* Copyright (C) 2008-2009, 2011 Gregory Nutt. All rights reserved. * Copyright (C) 2008-2009, 2011-2012 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <spudmonkey@racsa.co.cr> * Author: Gregory Nutt <gnutt@nuttx.org>
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions * 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_rect_s frame;
struct nxgl_size_s wndsize; struct nxgl_size_s wndsize;
struct nxgl_size_s tbsize; 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 */ /* Get the size of the rectangle */
nxgl_rectsize(&wndsize, &fwnd->wnd.bounds); nxgl_rectsize(&wndsize, &fwnd->wnd.bounds);
nxgl_rectsize(&tbsize, &fwnd->tbrect); nxgl_rectsize(&tbsize, &fwnd->tbrect);
/* Draw the top. Thickness: CONFIG_NXTK_BORDERWIDTH-1, Color: /* Draw the top ***********************************************************/
* CONFIG_NXTK_BORDERCOLOR1
*/
#if CONFIG_NXTK_BORDERWIDTH > 0
frame.pt1.x = 0; frame.pt1.x = 0;
frame.pt2.x = wndsize.w - 1; frame.pt2.x = wndsize.w - 1;
frame.pt1.y = 0; frame.pt1.y = 0;
#if CONFIG_NXTK_BORDERWIDTH > 1
frame.pt2.y = CONFIG_NXTK_BORDERWIDTH - 2; /* Draw the shiny edge */
#else
frame.pt2.y = CONFIG_NXTK_BORDERWIDTH - 1; #if CONFIG_NXTK_BORDERWIDTH > 2
frame.pt2.y = 0;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3);
frame.pt1.y = 1;
#endif #endif
/* Draw the central part */
frame.pt2.y = frame.pt1.y + thickness - 1;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
/* Draw a single line under the toolbar, color CONFIG_NXTK_BORDERCOLOR2 */ /* Draw a single line under the toolbar, color CONFIG_NXTK_BORDERCOLOR2 */
#if CONFIG_NXTK_BORDERWIDTH > 1 #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; frame.pt2.y = frame.pt1.y;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2);
#endif #endif
/* Draw the bottom. First, thickness: CONFIG_NXTK_BORDERWIDTH-1, /* Draw the bottom ********************************************************/
* Color: CONFIG_NXTK_BORDERCOLOR1
*/
#if CONFIG_NXTK_BORDERWIDTH > 0
frame.pt1.y = wndsize.h - CONFIG_NXTK_BORDERWIDTH; frame.pt1.y = wndsize.h - CONFIG_NXTK_BORDERWIDTH;
#if CONFIG_NXTK_BORDERWIDTH > 1
frame.pt2.y = wndsize.h - 2; /* Draw the shiny edge */
#else
#if CONFIG_NXTK_BORDERWIDTH > 2
frame.pt2.y = frame.pt1.y; frame.pt2.y = frame.pt1.y;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3);
frame.pt1.y ++;
#endif #endif
/* Draw the central part */
frame.pt2.y = frame.pt1.y + thickness - 1;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1); nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
/* Then a single line at the very bottom, Color: CONFIG_NXTK_BORDERCOLOR2 */ /* Then a single line at the very bottom, Color: CONFIG_NXTK_BORDERCOLOR2 */
@@ -162,75 +196,82 @@ int nxtk_drawframe(FAR struct nxtk_framedwindow_s *fwnd,
frame.pt2.y = frame.pt1.y; frame.pt2.y = frame.pt1.y;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2);
#endif #endif
/* Draw the outer left side. Thickness: CONFIG_NXTK_BORDERWIDTH-1,
* Color: CONFIG_NXTK_BORDERCOLOR1
*/
frame.pt1.y = 0;
frame.pt2.y = wndsize.h - 2;
frame.pt1.x = 0;
#if CONFIG_NXTK_BORDERWIDTH > 1
frame.pt2.x = CONFIG_NXTK_BORDERWIDTH - 2;
#else
frame.pt2.x = frame.pt1.x;
#endif #endif
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
/* Draw the outer right side. Thickness: 1, Color: CONFIG_NXTK_BORDERCOLOR2 */ /* Draw left and right outer edges *****************************************/
/* Draw the shiny left out edge */
#if CONFIG_NXTK_BORDERWIDTH > 1 #if CONFIG_NXTK_BORDERWIDTH > 1
frame.pt1.x = wndsize.w - 1; 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
/* Draw the shadowed right outer edge */
frame.pt1.x = wndsize.w - 2;
frame.pt2.x = frame.pt1.x; frame.pt2.x = frame.pt1.x;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2); nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2);
#endif #endif
/* Draw the inner left side, Thickness: 1, Color: CONFIG_NXTK_BORDERCOLOR2. /* Draw left and right central regions *************************************/
* This segment stops at the bottom of the toolbar. If there is a
#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.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);
#if CONFIG_NXTK_BORDERWIDTH > 2
frame.pt1.x = wndsize.w - thickness - 1;
frame.pt2.x = wndsize.w - 2;
#else
frame.pt1.x = wndsize.w - thickness;
frame.pt2.x = wndsize.w - 1;
#endif
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
#endif
/* 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 * tool bar, then we have to continue this to the top of the display
* using g_bordercolor1 (see below) * using g_bordercolor1 (see below)
*/ */
/* Draw the shadowed left inner edge */
#if CONFIG_NXTK_BORDERWIDTH > 1 #if CONFIG_NXTK_BORDERWIDTH > 1
frame.pt1.y = CONFIG_NXTK_BORDERWIDTH - 1 + tbsize.h; #if CONFIG_NXTK_BORDERWIDTH > 2
#else frame.pt1.x = thickness + 1;
frame.pt1.y = CONFIG_NXTK_BORDERWIDTH + tbsize.h; frame.pt1.y = tbsize.h + thickness + 1;
#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; 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); nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor2);
#endif
/* Draw the inner left side, Thickness: CONFIG_NXTK_BORDERWIDTH-1, /* Draw the shiny right inner edge */
* Color: CONFIG_NXTK_BORDERCOLOR1
*/
#if CONFIG_NXTK_BORDERWIDTH > 1 #if CONFIG_NXTK_BORDERWIDTH > 2
frame.pt1.x = wndsize.w - CONFIG_NXTK_BORDERWIDTH; frame.pt1.x = wndsize.w - thickness - 2;
frame.pt2.x = wndsize.w - 2;
#else
frame.pt1.x = wndsize.w - 1;
frame.pt2.x = frame.pt1.x; frame.pt2.x = frame.pt1.x;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor3);
#endif #endif
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
/* When there is a toolbar, we also have to patch in this tiny
* line segment -- Is there a better way?
*/
#if CONFIG_NXTK_BORDERWIDTH > 1
if (tbsize.h > 0)
{
frame.pt1.y = 0;
frame.pt2.y = CONFIG_NXTK_BORDERWIDTH + tbsize.h - 2;
frame.pt1.x = CONFIG_NXTK_BORDERWIDTH - 1;
frame.pt2.x = frame.pt1.x;
nxtk_drawframeside(fwnd, &frame, bounds, g_bordercolor1);
}
#endif #endif
return OK; return OK;
+13
View File
@@ -80,6 +80,18 @@
# endif # endif
#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 * 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_bordercolor1[CONFIG_NX_NPLANES];
extern nxgl_mxpixel_t g_bordercolor2[CONFIG_NX_NPLANES]; extern nxgl_mxpixel_t g_bordercolor2[CONFIG_NX_NPLANES];
extern nxgl_mxpixel_t g_bordercolor3[CONFIG_NX_NPLANES];
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
+10 -2
View File
@@ -68,7 +68,7 @@ nxgl_mxpixel_t g_bordercolor1[CONFIG_NX_NPLANES] =
{ {
CONFIG_NXTK_BORDERCOLOR1 CONFIG_NXTK_BORDERCOLOR1
#if CONFIG_NX_NPLANES > 1 #if CONFIG_NX_NPLANES > 1
# error "Multiple corder colors not defined" # error "Multiple plane border colors not defined"
#endif #endif
}; };
@@ -76,7 +76,15 @@ nxgl_mxpixel_t g_bordercolor2[CONFIG_NX_NPLANES] =
{ {
CONFIG_NXTK_BORDERCOLOR2 CONFIG_NXTK_BORDERCOLOR2
#if CONFIG_NX_NPLANES > 1 #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 #endif
}; };