Patches from Petteri Aimonen (plus a few other things)

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@5448 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo 2012-12-21 20:09:32 +00:00
parent 33267974c5
commit 7e7e9979a2
27 changed files with 466 additions and 98 deletions

View File

@ -220,3 +220,35 @@
classing easier (from Petteri Aimonen).
1.5 2013-xx-xx Gregory Nutt <gnutt@nuttx.org>
* NxWidgets::CGraphicsPort::move(): Fix typo bug in bounding rectangle
calculation (from Petteri Aimonen).
* NxWM::CScrollingPanel::scrollChildren(): Avoid unnecessary redraws in
CScrollingPanel (contributed by Petteri Aimonen).
* NxWM::CCycleButton: Remove the separator from CCycleButton. It draws in
wrong place, and doesnt look very good in the correct place either.
(from Petteri Aimonen).
* NxWidgets::CGraphicsPort: Many times we only want a constant background.
In that case the old code fills the background, reads it back, renders
the text and then writes it back. When used with LCD's (instead of
framebuffers) this causes unnecessary delay and screen flicker.
This commit adds a variant of drawText that takes background color,
so that the background and text can both be rendered at one go.
The old functions still function as before (Petteri Aimonen).
* NxWidgets::CLabel: The label was drawn as a single rectangular region,
then a text was added to the on top of this. The result is that the
text would flicker when the CLabel was updated. With this change, the
two step update is replaced with a five step update: The background
is updated as four rectangulear regions (leaving the previous text in
place), then the new text is updated. This eliminates the flicker
(Petteri Aimonen).
* Kconfig: Many NxWidgets/NxWM settings do not have meaningful, generic
default values. Colors, for example, depend on pixel depth. Some
geometry settings depending on other geometry settings. Font IDs are
not know-able by the configuration system. etc. In these cases, it
is best if the settings are just not undefined so that the system can
calculate a reasonable default. however, if no default is provided
in the .config file, mconf will complain and generate errors. So work
around this, I added several "enabling" settings to override the
default setting. This is awkward and I preferred the configuration as
it was before, but this avoids the mconf errors and warnings.

265
Kconfig
View File

@ -13,6 +13,18 @@ config NXWIDGETS
if NXWIDGETS
comment "NX Server/Device Configuration"
config NXWIDGETS_FLICKERFREE
bool "Enable Flicker Reduction Logic"
default y if NX_LCDDRIVER
default n if !NX_LCDDRIVER
---help---
Because of their performance an in the manner in which they are
updated, LCDs may be prone to "flicker" in the displays when Widgets
are updated. Often more complex (and slower) options are availble
to reduce the flicker. Enabling this option will enabled those
lower-performance flicker-reductions measures where-ever thay may
be available.
config NXWIDGETS_DEVNO
int "LCD Device Number"
default 0
@ -96,10 +108,20 @@ config NXWIDGETS_SIZEOFCHAR
comment "NXWidget Default Values"
config NXWIDGETS_SYSTEM_CUSTOM_FONTID
bool "Use a Custom Default Font"
default n
---help---
Set to override the system default font id (NXFONT_DEFAULT).
if NXWIDGETS_SYSTEM_CUSTOM_FONTID
config NXWIDGETS_DEFAULT_FONTID
int "Default Font ID"
default 0
---help---
Default font ID. Default: NXFONT_DEFAULT
Use this default NxWidgets font ID instead of the system font ID
(NXFONT_DEFAULT). Default: 0
endif
config NXWIDGETS_TNXARRAY_INITIALSIZE
int "Initial Size of Dynamic Arrays"
@ -113,53 +135,88 @@ config NXWIDGETS_TNXARRAY_SIZEINCREMENT
---help---
Default dynamic array realloctino increment (in entries). Default: 8
config NXWIDGETS_CUSTOM_FILLCOLORS
bool "Custom Default Fill Colors"
default n
---help---
Select custom default colors for the widget background. If defined,
the hexadecimal values for all filled colors must be provided
(there are no default colors because the hexadecimal representation
of the default colors depend on the pixel depth). Default: n
if NXWIDGETS_CUSTOM_FILLCOLORS
config NXWIDGETS_DEFAULT_BACKGROUNDCOLOR
hex "Normal Background Color"
hex "Default Normal Background Color"
---help---
Normal background color. Default: RGB(148,189,215)
config NXWIDGETS_DEFAULT_SELECTEDBACKGROUNDCOLOR
hex "Selected Background Color"
hex "Default Selected Background Color"
---help---
Default selected background color. Default: RGB(206,227,241)
config NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR
hex "Default Highlight Color"
---help---
Highlight color. Currently this color is only used in clist
boxes, progress bars, and slider grips. Default: RGB(192,192,192)
endif
config NXWIDGETS_CUSTOM_EDGECOLORS
bool "Custom Default Edge Colors"
default n
---help---
Select custom default colors for the widget edges. If defined,
then hexadecimal values for all edge colors must be provided
(there are no default colors because the hexadecimal representation
of the default colors depend on the pixel depth). Default: n.
if NXWIDGETS_CUSTOM_EDGECOLORS
config NXWIDGETS_DEFAULT_SHINEEDGECOLOR
hex "Shiny Edge Color"
hex "Default Shiny Edge Color"
---help---
Shiny side boarder color. Default: RGB(248,248,248)
config NXWIDGETS_DEFAULT_SHADOWEDGECOLOR
hex "Shadow Edge Color"
hex "Default Shadow Edge Color"
---help---
Shadowed side border color. Default: RGB(35,58,73)
endif
config NXWIDGETS_DEFAULT_HIGHLIGHTCOLOR
hex "Highlight Color"
config NXWIDGETS_CUSTOM_TEXTCOLORS
bool "Custom Default Text colors"
default n
---help---
Highlight color. Default: RGB(192,192,192)
Select custom colors for the widget text. If defined, then
hexadecimal values for all text colors must be provided
(there are no default colors because the hexadecimal representation
of the default colors depend on the pixel depth). Default: n.
if NXWIDGETS_CUSTOM_TEXTCOLORS
config NXWIDGETS_DEFAULT_DISABLEDTEXTCOLOR
hex "Disabled Text Color"
hex "Default Disabled Text Color"
---help---
Text color on a disabled widget: Default: RGB(192,192,192)
config NXWIDGETS_DEFAULT_ENABLEDTEXTCOLOR
hex "Enabled Text Color"
hex "Default Enabled Text Color"
---help---
Text color on a enabled widget. Default: RGB(248,248,248)
config NXWIDGETS_DEFAULT_SELECTEDTEXTCOLOR
hex "Selected Text Color"
hex "Default Selected Text Color"
---help---
Text color on a selected widget. Default: RGB(0,0,0)
config NXWIDGETS_DEFAULT_FONTCOLOR
hex "Default Font Color"
hex "Default Default Font Color"
---help---
Default font color. Default: RGB(255,255,255)
endif
config NXWIDGETS_TRANSPARENT_COLOR
hex "Transparent Color"
default 0x0
---help---
Transparent color. Default: RGB(0,0,0)
@ -220,10 +277,20 @@ config NXWM
if NXWM
comment "General settings"
config NXWM_SYSTEM_CUSTOM_FONTID
bool "Use Custom Default Font"
default n
---help---
Set to override the system default font id (NXFONT_DEFAULT).
if NXWM_SYSTEM_CUSTOM_FONTID
config NXWM_DEFAULT_FONTID
int "Font ID"
default 0
---help---
The NxWM default font ID. Default: NXFONT_DEFAULT
Use this NxWM default font ID instead of the system font ID
(NXFONT_DEFAULT). Default: 0
endif
config NXWM_UNITTEST
bool "NxWM Unit Test"
@ -233,6 +300,16 @@ config NXWM_UNITTEST
comment "Color configuration"
config NXWM_CUSTOM_FILLCOLORS
bool "Custom Default Fill Colors"
default n
---help---
Select custom default colors for the widget background. If defined,
the hexadecimal values for all filled colors must be provided
(there are no default colors because the hexadecimal representation
of the default colors depend on the pixel depth). Default: n
if NXWM_CUSTOM_FILLCOLORS
config NXWM_DEFAULT_BACKGROUNDCOLOR
hex "Background Color"
---help---
@ -242,7 +319,18 @@ config NXWM_DEFAULT_SELECTEDBACKGROUNDCOLOR
hex "Normal Background Color"
---help---
Select background color. Default: RGB(206,227,241)
endif
config NXWM_CUSTOM_EDGECOLORS
bool "Custom Default Edge Colors"
default n
---help---
Select custom default colors for the widget edges. If defined,
then hexadecimal values for all edge colors must be provided
(there are no default colors because the hexadecimal representation
of the default colors depend on the pixel depth). Default: n.
if NXWM_CUSTOM_EDGECOLORS
config NXWM_DEFAULT_SHINEEDGECOLOR
hex "Shiny Edge Color"
---help---
@ -252,7 +340,18 @@ config NXWM_DEFAULT_SHADOWEDGECOLOR
hex "Shadow Edge Color"
---help---
Color of the shadowed edge of a border. Default: RGB(0,0,0)
endif
config NXWM_CUSTOM_TEXTCOLORS
bool "Custom Default Text colors"
default n
---help---
Select custom colors for the widget text. If defined, then
hexadecimal values for all text colors must be provided
(there are no default colors because the hexadecimal representation
of the default colors depend on the pixel depth). Default: n.
if NXWM_CUSTOM_TEXTCOLORS
config NXWM_DEFAULT_FONTCOLOR
hex "Default Font Color"
---help---
@ -260,8 +359,10 @@ config NXWM_DEFAULT_FONTCOLOR
config NXWM_TRANSPARENT_COLOR
hex "Transparent Color"
default 0x0
---help---
The "transparent" color. Default: RGB(0,0,0)
endif
comment "Horizontal and vertical spacing of icons in the task bar"
@ -303,27 +404,48 @@ config NXWM_TASKBAR_RIGHT
endchoice
config NXWM_CUSTOM_TASKBAR_WIDTH
bool "Use Custom Taskbar width"
default n
---help---
Set to override the default taskbar thickness (either vertical or
horizontal). The default depends on the selected horizontal or
vertical spacing. Default: 25 + 2*spacing
if NXWM_CUSTOM_TASKBAR_WIDTH
config NXWM_TASKBAR_WIDTH
int "Taskbar Width"
default 29
---help---
Task bar thickness (either vertical or horizontal). Default: 25 + 2*spacing
Task bar thickness (either vertical or horizontal). Default: 25 + 2*2
endif
config NXWM_DISABLE_MINIMIZE
bool "Disable Minimize Button"
default n
---help---
If the "desktop" is empty, users have no need to minimize any windows. If the buttons
are small, it's easy to hit minimize button accidentally when trying to close an
application.
If the "desktop" is empty, users have no need to minimize any
windows. If the buttons are small, it's easy to hit minimize
button accidentally when trying to close an application.
comment "Tool Bar Configuration"
config NXWM_CUSTOM_TOOLBAR_HEIGHT
bool "Use Custom Toolbar Height"
default n
---help---
Set to override the default tooldar height The default depends on
the selected horizontal or vertical spacing. Default: 21 + 2*spacing
if NXWM_CUSTOM_TOOLBAR_HEIGHT
config NXWM_TOOLBAR_HEIGHT
int "Toolbar Height"
default 25
---help---
The height of the tool bar in each application window. At present,
all icons are 21 pixels in height and, hence, require a task bar of
at least that size.
at least that size. Default: 21 + 2*2
endif
comment "Background Image"
@ -357,10 +479,19 @@ config NXWM_STARTWINDOW_HSPACING
---help---
Horizontal spacing. Default: 4 rows
config NXWM_CUSTOM_STARTWINDOW_ICON
bool "Custom Start Window Icon"
default n
---help---
Select to override the default Start Window Icon: NxWM::g_playBitmap
if NXWM_CUSTOM_STARTWINDOW_ICON
config NXWM_STARTWINDOW_ICON
string "StartWindow Icon"
default "NxWM::g_playBitmap"
---help---
The glyph to use as the start window icon. Default: NxWM::g_playBitmap
endif
config NXWM_STARTWINDOW_MQNAME
string "Message Queue Name"
@ -417,6 +548,16 @@ config NXWM_NXCONSOLE_STACKSIZE
The stack size to use when starting the NxConsole task. Default:
2048 bytes.
config NXWM_NXCONSOLE_CUSTOM_COLORS
bool "Custom NxConsole Colors"
default n
---help---
Select custom default colors for the NxConsole window. If defined,
the hexadecimal values for all NxConsole colors must be provided
(there are no default colors because the hexadecimal representation
of the default colors depend on the pixel depth). Default: n
if NXWM_NXCONSOLE_CUSTOM_COLORS
config NXWM_NXCONSOLE_WCOLOR
hex "NxConsole Background Color"
---help---
@ -428,17 +569,36 @@ config NXWM_NXCONSOLE_FONTCOLOR
---help---
The color of the fonts to use in the NxConsole window.
Default: RGB(0,0,0)
endif
config NXWM_NXCONSOLE_CUSTOM_FONTID
bool "Use Custom Default Font"
default n
---help---
Set to override the system default font id (NXWM_DEFAULT_FONTID).
if NXWM_NXCONSOLE_CUSTOM_FONTID
config NXWM_NXCONSOLE_FONTID
int "NxConsole Font ID"
default 0
---help---
The ID of the font to use in the NxConsole window. Default:
NXWM_DEFAULT_FONTID
Use this default font ID in the NxConsole window instead of the
NxWM font ID (NXWM_DEFAULT_FONTID). Default: 0
endif
config NXWM_CUSTOM_NXCONSOLE_ICON
bool "Custom NxConsole Icon"
default n
---help---
Select to override the default NxConsole Window Icon: NxWM::g_cmdBitmap
if NXWM_CUSTOM_NXCONSOLE_ICON
config NXWM_NXCONSOLE_ICON
string "NxConsole Icon"
default "NxWM::g_cmdBitmap"
---help---
The glyph to use as the NxConsole icon. Default: NxWM::g_cmdBitmap
endif
config NXWM_TOUCHSCREEN
bool "Touchscreen Support"
@ -478,6 +638,7 @@ config NXWM_TOUCHSCREEN_LISTENERPRIO
config NXWM_TOUCHSCREEN_LISTENERSTACK
int "Touchscreen Listener Task Stack Size"
default 1024
---help---
Touchscreen listener thread stack size. Default 1024
@ -527,6 +688,17 @@ endif
comment "Calibration display settings"
config NXWM_CALIBRATION_CUSTOM_COLORS
bool "Custom Calibration Colors"
default n
---help---
Select custom default colors for the calibration window. If
defined, the hexadecimal values for all calibration window
colors must be provided (there are no default colors because
the hexadecimal representation of the default colors depend
on the pixel depth). Default: n
if NXWM_CALIBRATION_CUSTOM_COLORS
config NXWM_CALIBRATION_BACKGROUNDCOLOR
hex "Background Color"
---help---
@ -550,12 +722,23 @@ config NXWM_CALIBRATION_TOUCHEDCOLOR
---help---
The color of the circle in the touchscreen calibration display after
the touch is recorder. Default: RGB(255, 255, 96) (very light yellow)
endif
config NXWM_CUSTOM_CALIBRATION_ICON
bool "Custom Calibration Icon"
default n
---help---
Select to override the default Calibration Window Icon:
NxWM::g_calibrationBitmap
if NXWM_CUSTOM_CALIBRATION_ICON
config NXWM_CALIBRATION_ICON
string "Callibration Icon"
default "NxWM::g_calibrationBitmap"
---help---
The ICON to use for the touchscreen calibration application. Default:
NxWM::g_calibrationBitmap
endif
config NXWM_CALIBRATION_SIGNO
int "Calibration Signal Number"
@ -576,23 +759,55 @@ config NXWM_CALIBRATION_LISTENERSTACK
---help---
Calibration listener thread stack size. Default 2048
comment "Calibration display settings"
comment "Hex Calculator display settings"
config NXWM_HEXCALCULATOR_CUSTOM_COLORS
bool "Custom Hex Calculator Colors"
default n
---help---
Select custom default colors for the Hex Calcualtor window. If
defined, the hexadecimal values for all hex calculator colors
must be provided (there are no default colors because the
hexadecimal representation of the default colors depend on the
pixel depth). Default: n
if NXWM_HEXCALCULATOR_CUSTOM_COLORS
config NXWM_HEXCALCULATOR_BACKGROUNDCOLOR
hex "Calculator Background Color"
---help---
The background color of the calculator display. Default: Same
as NXWM_DEFAULT_BACKGROUNDCOLOR
endif
config NXWM_HEXCALCULATOR_ICON
string "Calculator Icon"
config NXWM_CUSTOM_HEXCALCULATOR_ICON
bool "Custom Hex Calculator Icon"
default n
---help---
The ICON to use for the hex calculator application. Default:
Select to override the default Hex Calculator Window Icon:
NxWM::g_calculatorBitmap
if NXWM_CUSTOM_HEXCALCULATOR_ICON
config NXWM_HEXCALCULATOR_ICON
string "Calculator Icon"
default "NxWM::g_calculatorBitmap"
---help---
The ICON to use for the hex calculator application. Default:
"NxWM::g_calculatorBitmap"
endif
config NXWM_HEXCALCULATOR_CUSTOM_FONTID
bool "Use Custom Default Font"
default n
---help---
Set to override the system default font id (NXWM_DEFAULT_FONTID).
if NXWM_HEXCALCULATOR_CUSTOM_FONTID
config NXWM_HEXCALCULATOR_FONTID
int "Calculator Font ID"
default 0
---help---
The font used with the calculator. Default: NXWM_DEFAULT_FONTID
Use this default font ID in the calculator window instead of the
NxWM font ID (NXWM_DEFAULT_FONTID). Default: 0
endif
endif

View File

@ -116,7 +116,7 @@ NxWidgets-1.4
=============
The 5th release of the NxWidgets package was made on December 20, 2012. This
release depends on NuttX-6.22 or above and should not be used with older
release depends on NuttX-6.24 or above and should not be used with older
NuttX releases. This release corresponds to SVN revision r5447.
Note: Nearly all changes between 1.3 and 1.4 were the result of the efforts

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -134,7 +134,7 @@ chklib:
$(NXWIDGETS_LIB): # Just to keep make happy. chklib does the work.
.built: chkcxx chklib $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
else

View File

@ -162,7 +162,7 @@ $(NXWIDGETS_LIB): # Just to keep make happy. chklibnxwidgets does the work.
$(NXWM_LIB): # Just to keep make happy. chklibnxwm does the work.
.built: $(OBJS) $(NXWIDGETS_LIB)
$(call ARCHIVE, $@, $(OBJS))
$(call ARCHIVE, $(BIN), $(OBJS))
ifeq ($(WINTOOL),y)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWIDGETS_DIR)
$(Q) $(ARCHIVER) -w -p "$(CROSSDEV)" $(BIN) $(NXWM_DIR)

View File

@ -111,6 +111,22 @@ namespace NXWidgets
nxgl_mxpixel_t m_backColor; /**< The background color to use */
#endif
/**
* The underlying implementation for drawText functions
* @param pos The window-relative x/y coordinate of the string.
* @param bound The window-relative bounds of the string.
* @param font The font to draw with.
* @param string The string to output.
* @param startIndex The start index within the string from which
* drawing will commence.
* @param length The number of characters to draw.
* @param background Color to use for background if transparent is false.
* @param transparent Whether to fill the background.
*/
void drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font,
const CNxString &string, int startIndex, int length,
nxgl_mxpixel_t background, bool transparent);
public:
/**
* Constructor.
@ -329,6 +345,24 @@ namespace NXWidgets
void drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font,
const CNxString &string, int startIndex, int length);
/**
* Draw a portion of a string to the window and fill the background
* in one go.
* @param pos The window-relative x/y coordinate of the string.
* @param bound The window-relative bounds of the string.
* @param font The font to draw with.
* @param string The string to output.
* @param startIndex The start index within the string from which
* drawing will commence.
* @param length The number of characters to draw.
* @param color Foreground color
* @param background Background color
*/
void drawText(struct nxgl_point_s *pos, CRect *bound, CNxFont *font,
const CNxString &string, int startIndex, int length,
nxgl_mxpixel_t color, nxgl_mxpixel_t background);
/**
* Draw an opaque bitmap to the window.
*

View File

@ -168,9 +168,10 @@ namespace NXWidgets
*
* @param dx The horizontal distance to scroll.
* @param dy The vertical distance to scroll.
* @param do_redraw Redraw widgets after moving.
*/
void scrollChildren(int32_t dx, int32_t dy);
void scrollChildren(int32_t dx, int32_t dy, bool do_redraw);
/**
* Destructor.

View File

@ -309,30 +309,21 @@ void CCycleButton::drawContents(CGraphicsPort *port)
CRect rect;
getRect(rect);
nxgl_coord_t glyphSpace = m_borderSize.left - 1;
nxgl_coord_t glyphYOffset = (rect.getHeight() - g_cycle.height) >> 1;
nxwidget_pixel_t textColor;
nxwidget_pixel_t separatorLeftColor;
nxwidget_pixel_t separatorRightColor;
if (!isEnabled())
{
textColor = getDisabledTextColor();
separatorLeftColor = getShadowEdgeColor();
separatorRightColor = getShineEdgeColor();
}
else if (!isClicked())
{
textColor = getEnabledTextColor();
separatorLeftColor = getShadowEdgeColor();
separatorRightColor = getShineEdgeColor();
}
else
{
textColor = getSelectedTextColor();
separatorLeftColor = getShineEdgeColor();
separatorRightColor = getShadowEdgeColor();
}
// Draw cycle glyph
@ -341,16 +332,6 @@ void CCycleButton::drawContents(CGraphicsPort *port)
g_cycle.width, g_cycle.height, &g_cycle,
0, 0, CONFIG_NXWIDGETS_TRANSPARENT_COLOR);
// Draw separator
nxgl_coord_t x = getX() + glyphSpace + g_cycle.width;
nxgl_coord_t y = getY();
nxgl_coord_t w = glyphSpace + g_cycle.width;
nxgl_coord_t h = rect.getHeight() - 1;
port->drawLine(x, y, w, h, separatorLeftColor);
port->drawLine(x+1, y, w+1, h, separatorRightColor);
// Only draw text if option is selected
if (m_options.getSelectedItem() != NULL)

View File

@ -653,6 +653,55 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound,
void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound,
CNxFont *font, const CNxString &string,
int startIndex, int length)
{
drawText(pos, bound, font, string, startIndex, length, 0, true);
}
/**
* Draw a portion of a string to the window and fill the background
* in one go.
* @param pos The window-relative x/y coordinate of the string.
* @param bound The window-relative bounds of the string.
* @param font The font to draw with.
* @param string The string to output.
* @param startIndex The start index within the string from which
* drawing will commence.
* @param length The number of characters to draw.
* @param color Foreground color
* @param background Background color
*/
void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound,
CNxFont *font, const CNxString &string,
int startIndex, int length,
nxgl_mxpixel_t color,
nxgl_mxpixel_t background)
{
nxgl_mxpixel_t savedColor = font->getColor();
font->setColor(color);
drawText(pos, bound, font, string, startIndex, length, background, false);
font->setColor(savedColor);
}
/**
* The underlying implementation for drawText functions
* @param pos The window-relative x/y coordinate of the string.
* @param bound The window-relative bounds of the string.
* @param font The font to draw with.
* @param string The string to output.
* @param startIndex The start index within the string from which
* drawing will commence.
* @param length The number of characters to draw.
* @param background Color to use for background if transparent is false.
* @param transparent Whether to fill the background.
*/
void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound,
CNxFont *font, const CNxString &string,
int startIndex, int length,
nxgl_mxpixel_t background,
bool transparent)
{
// Verify index and length
@ -668,6 +717,16 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound,
endIndex = stringLength;
}
#ifdef CONFIG_NX_WRITEONLY
if (transparent)
{
// Can't render transparently without reading memory.
transparent = false;
background = m_backColor;
}
#endif
// Allocate a bit of memory to hold the largest rendered font
unsigned int bmWidth = ((unsigned int)font->getMaxWidth() * CONFIG_NXWIDGETS_BPP + 7) >> 3;
@ -707,16 +766,12 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound,
// Does the letter have height? Spaces have width, but no height
if (metrics.height > 0)
if (metrics.height > 0 || !transparent)
{
// Get the height of the font
nxgl_coord_t fontHeight = (nxgl_coord_t)(metrics.height + metrics.yoffset);
// Set the current, effective size of the bitmap
bitmap.width = fontWidth;
bitmap.height = fontHeight;
bitmap.height = bmHeight;
bitmap.stride = (fontWidth * bitmap.bpp + 7) >> 3;
// Describe the destination of the font as a bounding box
@ -725,7 +780,7 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound,
dest.pt1.x = pos->x;
dest.pt1.y = pos->y;
dest.pt2.x = pos->x + fontWidth - 1;
dest.pt2.y = pos->y + fontHeight - 1;
dest.pt2.y = pos->y + bmHeight - 1;
// Get the interection of the font box and the bounding box
@ -737,25 +792,28 @@ void CGraphicsPort::drawText(struct nxgl_point_s *pos, CRect *bound,
if (!nxgl_nullrect(&intersection))
{
// Initialize the bitmap memory by reading from the display. The
// font renderer always renders the fonts on a transparent background.
// Sometimes a solid background works, sometimes not. But reading
// from graphics memory always works.
// If we have been given a background color, use it to fill the array.
// Otherwise initialize the bitmap memory by reading from the display.
// The font renderer always renders the fonts on a transparent background.
#ifdef CONFIG_NX_WRITEONLY
// Set the glyph memory to the background color
nxwidget_pixel_t *bmPtr = (nxwidget_pixel_t *)bitmap.data;
unsigned int npixels = fontWidth * fontHeight;
for (unsigned int j = 0; j < npixels; j++)
if (!transparent)
{
*bmPtr++ = m_backColor;
}
#else
// Read the current contents of the destination into the glyph memory
// Set the glyph memory to the background color
nxwidget_pixel_t *bmPtr = (nxwidget_pixel_t *)bitmap.data;
unsigned int npixels = fontWidth * bmHeight;
for (unsigned int j = 0; j < npixels; j++)
{
*bmPtr++ = background;
}
}
else
{
// Read the current contents of the destination into the glyph memory
m_pNxWnd->getRectangle(&dest, &bitmap);
}
m_pNxWnd->getRectangle(&dest, &bitmap);
#endif
// Render the font into the initialized bitmap
font->drawChar(&bitmap, letter);
@ -827,7 +885,7 @@ void CGraphicsPort::move(nxgl_coord_t x, nxgl_coord_t y,
rect.pt1.x = x;
rect.pt1.y = y;
rect.pt2.x = x + width - 1;
rect.pt2.y = y = height -1;
rect.pt2.y = y + height - 1;
struct nxgl_point_s offset;
offset.x = deltaX;

View File

@ -303,8 +303,10 @@ void CLabel::drawContents(CGraphicsPort *port)
// Draw the background (excluding the border)
#ifdef CONFIG_NXWIDGETS_FLICKERFREE
port->drawFilledRect(rect.getX(), rect.getY(),
rect.getWidth(), rect.getHeight(), backColor);
#endif
// Get the X/Y position of the text within the Label
@ -312,10 +314,27 @@ void CLabel::drawContents(CGraphicsPort *port)
pos.x = rect.getX() + m_align.x;
pos.y = rect.getY() + m_align.y;
// Add the text using the selected color
#ifdef CONFIG_NXWIDGETS_FLICKERFREE
CNxFont* font = getFont();
int height = font->getHeight();
int width = font->getStringWidth(m_text);
// Draw the background (excluding the border and the text area)
port->drawFilledRect(rect.getX(), rect.getY(),
pos.x - rect.getX(), rect.getHeight(), backColor); // Left
port->drawFilledRect(pos.x + width, rect.getY(),
rect.getX2() - (pos.x + width) + 1, rect.getHeight(), backColor); // Right
port->drawFilledRect(pos.x, rect.getY(),
width, pos.y - rect.getY(), backColor); // Top
port->drawFilledRect(pos.x, pos.y + height,
width, rect.getY2() - (pos.y + height) + 1, backColor); // Bottom
#endif
// Add the text using the selected color and background color
port->drawText(&pos, &rect, getFont(), m_text, 0, m_text.getLength(),
textColor);
textColor, backColor);
}
/**

View File

@ -215,10 +215,13 @@ void CScrollingPanel::scroll(int32_t dx, int32_t dy)
m_canvasY += dy;
m_canvasX += dx;
// Move children but do not redraw.
scrollChildren(dx, dy, false);
if (revealedRects.size() > 0)
{
// Draw background to revealed sections
// Children will redraw themselves in moveTo.
for (int i = 0; i < revealedRects.size(); ++i)
{
@ -231,6 +234,18 @@ void CScrollingPanel::scroll(int32_t dx, int32_t dy)
port->drawFilledRect(rrect.getX(), rrect.getY(),
rrect.getWidth(), rrect.getHeight(),
getBackgroundColor());
// Check if any children intersect this region.
// If it does, it should be redrawn.
for (int j = 0; j < m_children.size(); ++j)
{
CRect crect = m_children[j]->getBoundingBox();
if (crect.intersects(rrect))
{
m_children[j]->redraw();
}
}
}
}
}
@ -240,12 +255,12 @@ void CScrollingPanel::scroll(int32_t dx, int32_t dy)
m_canvasY += dy;
m_canvasX += dx;
// Scroll all child widgets and redraw them
scrollChildren(dx, dy, true);
}
// Scroll all child widgets
scrollChildren(dx, dy);
// Notify event handlers
m_widgetEventHandlers->raiseScrollEvent(dx, dy);
@ -332,9 +347,10 @@ void CScrollingPanel::onClick(nxgl_coord_t x, nxgl_coord_t y)
*
* @param dx The horizontal distance to scroll.
* @param dy The vertical distance to scroll.
* @param do_redraw Redraw widgets after moving.
*/
void CScrollingPanel::scrollChildren(int32_t dx, int32_t dy)
void CScrollingPanel::scrollChildren(int32_t dx, int32_t dy, bool do_redraw)
{
nxgl_coord_t widgetX = 0;
nxgl_coord_t widgetY = 0;
@ -345,8 +361,20 @@ void CScrollingPanel::scrollChildren(int32_t dx, int32_t dy)
for (int32_t i = 0; i < m_children.size(); i++)
{
widget = m_children[i];
bool oldstate = widget->isDrawingEnabled();
if (!do_redraw)
{
widget->disableDrawing();
}
widgetX = (widget->getX() - thisX) + dx;
widgetY = (widget->getY() - thisY) + dy;
widget->moveTo(widgetX, widgetY);
if (!do_redraw && oldstate)
{
widget->enableDrawing();
}
}
}