Commit ec906ab4 authored by Robert Sprowson's avatar Robert Sprowson
Browse files

SetColour method flag fixes

Fix checking of the DesktopColours flag to the scrolllist and textarea gadget SetColour methods - didn't match docs.
Fix for expression precedence of + and ? operators by sprinkling in some brackets.
Ref https://www.riscosopen.org/forum/forums/4/topics/9503#posts-72595

Also, optimise the forced redraw if the text area colour overall didn't change (reduces flicker).
Docs corrected to list RISC OS palette words in the right order.

Version 0.44. Tagged as 'Gadgets-0_44'
parent 13fdda25
/* (0.43)
/* (0.44)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 0.43
#define Module_MajorVersion_CMHG 0.44
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 18 Jun 2016
#define Module_Date_CMHG 09 Feb 2018
#define Module_MajorVersion "0.43"
#define Module_Version 43
#define Module_MajorVersion "0.44"
#define Module_Version 44
#define Module_MinorVersion ""
#define Module_Date "18 Jun 2016"
#define Module_Date "09 Feb 2018"
#define Module_ApplicationDate "18-Jun-16"
#define Module_ApplicationDate "09-Feb-18"
#define Module_ComponentName "Gadgets"
#define Module_ComponentPath "castle/RiscOS/Sources/Toolbox/Gadgets"
#define Module_FullVersion "0.43"
#define Module_HelpVersion "0.43 (18 Jun 2016)"
#define Module_LibraryVersionInfo "0:43"
#define Module_FullVersion "0.44"
#define Module_HelpVersion "0.44 (09 Feb 2018)"
#define Module_LibraryVersionInfo "0:44"
......@@ -53,6 +53,7 @@
#include "messages.h"
#include "twimp.h"
#include "objects/gadgets.h"
#include "Global/Sprite.h"
#include "glib.h"
#include "riscos_uti.h"
......@@ -287,7 +288,8 @@ static void _get_size_of_sprites(const PrivateScrollList *sdata,
if (sprite_info == 0)
{
// Sprite in wimp poll
_swix(Wimp_SpriteOp, _IN(0)|_IN(2)|_OUTR(3,4), 40,
_swix(Wimp_SpriteOp, _IN(0)|_IN(2)|_OUTR(3,4),
SpriteReason_ReadSpriteSize,
sdata->entries[i].sprite_name,
&sprite_width, &sprite_height);
}
......@@ -295,7 +297,8 @@ static void _get_size_of_sprites(const PrivateScrollList *sdata,
{
// Sprite in sprite area
_swix(OS_SpriteOp, _INR(0,2)|_OUTR(3,4),
40 + (sprite_info == 1) ? 256 : 512,
(sprite_info == 1) ? (SpriteReason_ReadSpriteSize + 256)
: (SpriteReason_ReadSpriteSize + 512),
sdata->entries[i].sprite_area,
sdata->entries[i].sprite_name,
&sprite_width, &sprite_height);
......@@ -551,7 +554,7 @@ static _kernel_oserror *_set_colour(PrivateScrollList *handle,
{
BOOL changed;
if (flags | ScrollList_DesktopColours == flags)
if ((flags & ScrollList_DesktopColours) != 0)
{
// Need to translate desktop colours to real colours
Palette palette;
......
......@@ -1203,7 +1203,9 @@ static _kernel_oserror *_get_cursor_position (PrivateTextArea *tdata, unsigned i
static _kernel_oserror *_set_colour(PrivateTextArea *handle,
unsigned int flags, unsigned int foreground, unsigned int background)
{
if (flags | TextArea_DesktopColours == flags)
BOOL changed;
if ((flags & TextArea_DesktopColours) != 0)
{
/* Need to translate desktop colours to real colours */
Palette palette;
......@@ -1215,12 +1217,17 @@ static _kernel_oserror *_set_colour(PrivateTextArea *handle,
foreground = palette.colours[foreground] & ~0xff;
background = palette.colours[background] & ~0xff;
}
changed = (handle->foreground != foreground) ||
(handle->background != background);
handle->foreground = foreground;
handle->background = background;
/* Generate a force_redraw */
_swix(Toolbox_ObjectMiscOp, _INR(0,3),
0, handle->object_id, Window_ForceRedraw, &redraw_all_box);
if (changed)
{
/* Generate a force_redraw */
_swix(Toolbox_ObjectMiscOp, _INR(0,3),
0, handle->object_id, Window_ForceRedraw, &redraw_all_box);
}
return NULL;
}
......
......@@ -193,13 +193,13 @@ ScrollList_SetColour
On entry
R0 = flags
bit 0 set means use desktop colours rather than
real colours (in the form &BBRRGG00)
real colours (in the form &BBGGRR00)
R1 = Window object id
R2 = ScrollList_Base + 8
R3 = Gadget component id
R4 = Colour value for foreground text (in the form &BBRRGG00,
R4 = Colour value for foreground text (in the form &BBGGRR00,
unless bit 0 of R0 is set)
R5 = Colour value for background (in the form &BBRRGG00,
R5 = Colour value for background (in the form &BBGGRR00,
unless bit 0 of R0 is set)
On exit
......@@ -219,8 +219,8 @@ On entry
R3 = Gadget component id
On exit
R0 = Colour value (in the form &BBRRGG00) of foreground
R1 = Colour value (in the form &BBRRGG00) of background
R0 = Colour value (in the form &BBGGRR00) of foreground
R1 = Colour value (in the form &BBGGRR00) of background
C veneer
......
......@@ -223,13 +223,13 @@ TextArea_SetColour
On entry
R0 = flags
bit 0 set means use desktop colours rather than
real colours (in the form &BBRRGG00)
real colours (in the form &BBGGRR00)
R1 = Window object id
R2 = ???
R3 = Gadget component id
R4 = Colour value for foreground text (in the form &BBRRGG00,
R4 = Colour value for foreground text (in the form &BBGGRR00,
unless bit 0 of R0 is set)
R5 = Colour value for background (in the form &BBRRGG00,
R5 = Colour value for background (in the form &BBGGRR00,
unless bit 0 of R0 is set)
On exit
......@@ -249,8 +249,8 @@ On entry
R3 = Gadget component id
On exit
R0 = Colour value (in the form &BBRRGG00) of foreground
R1 = Colour value (in the form &BBRRGG00) of background
R0 = Colour value (in the form &BBGGRR00) of foreground
R1 = Colour value (in the form &BBGGRR00) of background
C veneer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment