Commit 302523aa authored by ROOL's avatar ROOL 🤖
Browse files

Fix for cosmetic rubout issue on changing to/from artist friendly colours in choices

Detail:
  Changing the Colour window layout in choices would immediately affect all open colour
  windows, and not redraw them. The corrected behaviour keeps the colour choice on a per
  psprite basis, so only newly opened Colours follow the choices (in common with the other
  choices).
parent a85cd3fe
......@@ -514,6 +514,7 @@ void colours_event_handler (wimp_eventstr *e, void *handle)
{ main_sprite *sprite = (main_sprite *) handle;
int coloursize = sprite->coloursize, x_eig, y_eig, max_eig;
BOOL artistfriendlyview = sprite->artistfriendlyopts & artist_friendly_view;
ftracef0 ("colours_event_handler\n");
x_eig = bbc_vduvar (bbc_XEigFactor);
......@@ -579,7 +580,7 @@ void colours_event_handler (wimp_eventstr *e, void *handle)
for (j = 0; j < lim; j++)
{ int ECF = 0;
/* Sort 256 colours into artist friendly order, if required */
if (nc == 256 && main_current_options.advanced.artist_friendly)
if (nc == 256 && artistfriendlyview)
i = colours_get_artist_friendly_colour (j, sprite);
else
i = j;
......@@ -795,7 +796,7 @@ void colours_event_handler (wimp_eventstr *e, void *handle)
/* Use artist friendly order for 256 colours, if required */
if ((ncs == 256 || ncs == 255) && newgcol.colour < 256 &&
main_current_options.advanced.artist_friendly)
artistfriendlyview)
{ newgcol.colour = colours_get_artist_friendly_colour (newgcol.colour, sprite);
}
......@@ -837,7 +838,7 @@ void colours_event_handler (wimp_eventstr *e, void *handle)
else if(!oldgcol.alpha)
oldgcol.colour = ncs;
else if ((ncs == 256 || ncs == 255) && oldgcol.colour < 256 &&
main_current_options.advanced.artist_friendly)
artistfriendlyview)
{
oldgcol.colour = colours_get_artist_friendly_index (oldgcol.colour, sprite);
}
......
......@@ -1420,7 +1420,7 @@ wimp_wstate menus_showmag_getstate (void *handle, int window_width, int window_h
window_height = wstate.o.box.y1 - wstate.o.box.y0;
/* We'll try to keep the same sprite pixel under the mouse pointer before and after zooming. */
/* If less than the entire sprite is visible, we'll first attempt to do it my moving the scroll bars */
/* If less than the entire sprite is visible, we'll first attempt to do it by moving the scroll bars */
/* If a scroll bar can't be moved far enough to do it (due to reaching an end or the whole sprite being visible),
we'll try moving the window position, whilst avoiding making window furniture inaccessible. */
......@@ -1829,10 +1829,9 @@ static void Apply_Colour (dboxtcol_colour col, void *handle)
without showing the confirmation dbox, then we must do it AFTER
the user has edited the colour, so it's on a click rather than
just a menu hit */
BOOL could_remap = main_current_options.advanced.artist_friendly
&& main_current_options.advanced.remap_palette
BOOL could_remap = (sprite->artistfriendlyopts & artist_friendly_view & artist_remap_palette)
&& colours_is_artist_friendly (sprite);
if (could_remap && !main_current_options.advanced.ask_remap_palette)
if (could_remap && !(sprite->artistfriendlyopts & artist_ask_to_remap))
{ sprite->artistfriendly = artist_friendly;
colours_remap_to_artist_friendly (sprite);
/* Don't forget to remap the currently selected colours too! */
......@@ -2279,9 +2278,8 @@ void menus_sprite_handler (void *handle, char *hit)
if (hit [2])
{ wimp_eventstr ev = { wimp_ENULL }, *ev2;
int mx = 0, my = 0;
BOOL couldRemap = main_current_options.advanced.artist_friendly
&& main_current_options.advanced.remap_palette
&& colours_is_artist_friendly (sprite);
BOOL couldRemap = (sprite->artistfriendlyopts & artist_friendly_view
& artist_remap_palette) && colours_is_artist_friendly (sprite);
if (couldRemap)
{ int dboxResult;
......@@ -2302,7 +2300,7 @@ void menus_sprite_handler (void *handle, char *hit)
}
/* dbox can be disabled in the options. If so, the remap
will just go ahead without asking. */
if (main_current_options.advanced.ask_remap_palette)
if (sprite->artistfriendlyopts & artist_ask_to_remap)
{ dboxResult = remap_to_artistfriendly_dbox ();
if (dboxResult == 0) /* if Rearrange */
......@@ -2321,7 +2319,7 @@ void menus_sprite_handler (void *handle, char *hit)
sprite->artistfriendly = artist_unfriendly;
/* Hide this dialogue box but keep the menus open */
if (main_current_options.advanced.ask_remap_palette &&
if ((sprite->artistfriendlyopts & artist_ask_to_remap) &&
artistfriendly_dbox != NULL)
{ int dboxhandle = dbox_syshandle (artistfriendly_dbox);
if (dboxhandle != NULL)
......@@ -2339,7 +2337,7 @@ void menus_sprite_handler (void *handle, char *hit)
}
}
}
else if (!main_current_options.advanced.artist_friendly)
else if (!sprite->artistfriendlyopts & artist_friendly_view)
{ /* Make sure artist-friendly logic will be re-run if the
setting is later re-enabled */
sprite->artistfriendly = artist_unknown;
......
......@@ -453,6 +453,13 @@ main_sprite *psprite_new (int offset, int spriteno, main_file *parent)
sprite->coloursize = main_current_options.colours.small_colours?
colours_SIZE/2: colours_SIZE;
sprite->artistfriendly = artist_unknown;
sprite->artistfriendlyopts = 0;
if (main_current_options.advanced.artist_friendly)
sprite->artistfriendlyopts |= artist_friendly_view;
if (main_current_options.advanced.remap_palette)
sprite->artistfriendlyopts |= artist_remap_palette;
if (main_current_options.advanced.ask_remap_palette)
sprite->artistfriendlyopts |= artist_ask_to_remap;
return sprite;
}
......
......@@ -148,6 +148,13 @@ typedef enum
artist_unfriendly
} artist_friendly_pal;
typedef enum
{
artist_friendly_view = 1,
artist_remap_palette = 2,
artist_ask_to_remap = 4
} artist_friendly_opts;
typedef struct colour_panel
{
wimp_w handle;
......@@ -160,28 +167,29 @@ typedef struct colour_panel
#define MSF_SELECTED 1
typedef struct main_sprite
{
struct main_sprite *link;
struct main_file *file; /* parent file info */
main_sprite_window *windows; /* windows onto sprite */
int offset; /* of sprite in file */
int spriteno; /* index of sprite in file */
main_ttab *transtab; /* colour translation table */
main_scaling_block mode; /* mode conversion */
main_scaling_block iconsize;
wimp_w colourhandle;
wimp_w bgcolourhandle;
main_ecf ECFs [4];
main_colour gcol; /* current painting colour */
main_colour gcol2; /* current colour for ADJUST */
int toolspace [toolspacesize]; /* tool scratch space */
colourpicker_d colourdialogue; /* handle of colourpicker */
colourpicker_d bgcolourdialogue; /* handle of background colourpicker */
char *colourtitle; /* indirected colour title */
char *bgcolourtitle; /* indirected background colour title */
char needsnull; /* set if tracking pointer */
char coloursize;
unsigned int flags;
artist_friendly_pal artistfriendly;
struct main_sprite *link;
struct main_file *file; /* parent file info */
main_sprite_window *windows; /* windows onto sprite */
int offset; /* of sprite in file */
int spriteno; /* index of sprite in file */
main_ttab *transtab; /* colour translation table */
main_scaling_block mode; /* mode conversion */
main_scaling_block iconsize;
wimp_w colourhandle;
wimp_w bgcolourhandle;
main_ecf ECFs [4];
main_colour gcol; /* current painting colour */
main_colour gcol2; /* current colour for ADJUST */
int toolspace [toolspacesize]; /* tool scratch space */
colourpicker_d colourdialogue; /* handle of colourpicker */
colourpicker_d bgcolourdialogue; /* handle of background colourpicker */
char *colourtitle; /* indirected colour title */
char *bgcolourtitle; /* indirected background colour title */
char needsnull; /* set if tracking pointer */
char coloursize;
unsigned int flags;
artist_friendly_pal artistfriendly;
artist_friendly_opts artistfriendlyopts;
} main_sprite;
typedef struct main_file
......
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