Commit b712d6fd authored by ROOL's avatar ROOL 🤖

This commit was manufactured by cvs2git to create tag 'Paint-1_98'.

Sprout from master 2007-07-27 21:23:34 UTC Steve Revill <srevill@gitlab.riscosopen.org> '  Changes to SpriteFile window to allow selections and'
Cherrypick from master 2008-06-05 12:56:40 UTC Ben Avison <bavison@gitlab.riscosopen.org> 'Fix to filename capitalisation clash for version 1.98.':
    c/Colours
    c/Main
    c/PSprite
    c/SprWindow
    c/Tools
parent 83811440
......@@ -38,6 +38,7 @@
#include "sprwindow.h"
#include "toolwindow.h"
#include "colours.h"
#include "PaintLib.h"
#undef OS_SetColour
#define OS_SetColour 0x61
......@@ -505,7 +506,7 @@ void colours_set_extent (main_sprite *sprite)
wimp_redrawstr newext;
curr.w = sprite->colourhandle;
wimpt_noerr (wimp_get_wind_info (&curr));
wimpt_noerr (PaintLib_get_wind_info (&curr));
newext.w = sprite->colourhandle;
calculate_colour_extent (sprite, &newext.box,
......
This diff is collapsed.
......@@ -334,7 +334,7 @@ void psprite_recalculate_offsets (main_file *file)
* Delete a sprite info block from its list *
********************************************************/
void psprite_delete (main_sprite *sprite)
void psprite_delete (main_window* window,main_sprite *sprite)
{ main_sprite_window *spritewindow;
main_file *file = sprite->file;
......@@ -378,6 +378,8 @@ void psprite_delete (main_sprite *sprite)
break;
}
if (sprite->flags & MSF_SELECTED) window->selection.count--;
m_FREE (sprite, sizeof (main_sprite)); /*always free it! J R C 6th Dec
1993*/
}
......@@ -404,6 +406,7 @@ main_sprite *psprite_new (int offset, int spriteno, main_file *parent)
sprite->windows = NULL;
sprite->colourhandle = 0;
sprite->gcol = colours_count (sprite) - 1;
sprite->flags = 0;
ftracef2 ("initialised sprite \"%.12s\" GCOL 0x%X\n",
psprite_address (sprite)->name, sprite->gcol);
sprite->gcol2 = 0;
......@@ -1254,6 +1257,72 @@ BOOL psprite_read_size (main_sprite *sprite, sprite_info *infoblock)
return FALSE;
}
/*****************************************************
* Plot sprite at coordinate given *
* using sprites colour table, and scaled by *
* sprites modescale*given scaling. *
* same parameters as ppsprite_plot_scaled_centred *
* new 2007 CG *
****************************************************/
os_error *psprite_plot_scaled_m (int x, int y, main_sprite *sprite,
main_scaling_block *scale, int mode, int maskreally)
{
main_scaling_block scaling;
os_error *error = NULL;
int op, flags = 0;
char *table = NULL;
ftracef1 ("psprite_plot_scaled_m \"%.12s\"\n",
psprite_address (sprite)->name);
scaling.scale_xmul = sprite->mode.scale_xmul*scale->scale_xmul;
scaling.scale_xdiv = sprite->mode.scale_xdiv*scale->scale_xdiv;
scaling.scale_ymul = sprite->mode.scale_ymul*scale->scale_ymul;
scaling.scale_ydiv = sprite->mode.scale_ydiv*scale->scale_ydiv;
Trace_Ttab (sprite->transtab);
if (!maskreally)
{ op = 512 | 52;
flags = mode | 1 << 3 /*use mask if present*/ |
1 << 5 /*ttab is wide*/; /*JRC 30th Jan 1995*/
table = sprite->transtab->table;
}
else
{ op = 512 | 50;
flags = mode;
table = NULL;
}
ftracef0 ("putting sprite scaled ...\n");
ftracef1 ("R0 0x%X\n", op);
ftracef1 ("R1 0x%X\n", sprite->file->spritearea);
ftracef1 ("R2 0x%X\n", psprite_address (sprite));
ftracef1 ("R3 0x%X\n", x - infoblock.width);
ftracef1 ("R4 0x%X\n", y - infoblock.height);
ftracef1 ("R5 0x%X\n", flags);
ftracef1 ("R6 0x%X\n", &scaling);
ftracef1 ("R7 0x%X\n", table);
ftracef4 ("factors (%d:%d, %d:%d)\n", scaling.scale_xmul,
scaling.scale_xdiv, scaling.scale_ymul, scaling.scale_ydiv);
error = _swix (OS_SpriteOp,
_IN(0)|_IN(1)|_IN(2)|_IN(3)|_IN(4)|_IN(5)|_IN(6)|_IN(7), op,
sprite->file->spritearea, psprite_address (sprite),
x, y, flags, &scaling, table);
ftracef0 ("putting sprite scaled ... done\n");
#ifdef DUMPING
if (error != NULL)
{ Dump_Ttab (sprite->transtab);
}
#endif
return error;
}
/***************************************************
* Plot sprite centred at coordinate given *
* using sprites colour table, and scaled by *
......@@ -1750,7 +1819,7 @@ os_error *psprite_plot_ecf_sprite (main_sprite *sprite, int ECF, int x,
* of MOS's file merging. *
***********************************************************/
BOOL psprite_merge_area (main_file *file, sprite_area **area)
BOOL psprite_merge_area (main_window* window,main_file *file, sprite_area **area)
{ sprite_area area_info;
char sname [NAME_LIMIT + 1];
......@@ -1820,7 +1889,7 @@ BOOL psprite_merge_area (main_file *file, sprite_area **area)
if (!menus_ensure_size (&file->spritearea, header->next))
{ if (!newsprite && *sprptr != NULL)
psprite_delete (*sprptr);
psprite_delete (window,*sprptr);
psprite_recalculate_offsets (file);
msg = msgs_lookup ("PntEG");
goto finish;
......
......@@ -41,6 +41,7 @@
#include "toolwindow.h"
#include "tools.h"
#include "colours.h"
#include "paintlib.h"
#define MIN(a, b) ((a) < (b)? (a): (b))
#define MAX(a, b) ((a) > (b)? (a): (b))
......@@ -89,7 +90,7 @@ void sprwindow_set_work_extent (main_window *window, BOOL open)
newext.w = window->handle;
newext.box.y1 = 0;
newext.box.y0 =-sinfo.height;
newext.box.y0 = -sinfo.height;
newext.box.x0 = 0;
newext.box.x1 = sinfo.width;
......@@ -202,7 +203,7 @@ int sprwindow_swap_output_to_mask (main_sprite *sprite, int statesaved)
* *
********************************/
void sprwindow_swap_output_to_screen ()
void sprwindow_swap_output_to_screen (void)
{
ftracef0 ("sprwindow_swap_output_to_screen\n");
......@@ -225,7 +226,7 @@ void sprwindow_redisplay (main_sprite *sprite, wimp_box *area)
ftracef0 ("sprwindow_redisplay\n");
for (window = sprite->windows; window != NULL; window = window->link)
{ curr.w = window->window->handle;
wimpt_noerr (wimp_get_wind_info (&curr));
wimpt_noerr (PaintLib_get_wind_info (&curr));
if (area != NULL)
{ redraw.box.x0 = area->x0*window->blobsize.scale_xmul/
......@@ -250,7 +251,7 @@ void sprwindow_redisplay (main_sprite *sprite, wimp_box *area)
/* now invalidate area in filer window */
curr.w = sprite->file->window->handle;
wimpt_noerr (wimp_get_wind_info (&curr));
wimpt_noerr (PaintLib_get_wind_info (&curr));
if (sprite->file->fullinfo)
{ redraw.box.x0 = 0; redraw.box.x1 = 3*main_FILER_TextHeight;
......@@ -383,7 +384,7 @@ void sprwindow_event_handler (wimp_eventstr *e, void *handle)
wimpt_noerr (wimp_redraw_wind (&rds, &more));
curr.w = e->data.o.w;
wimpt_noerr (wimp_get_wind_info (&curr));
wimpt_noerr (PaintLib_get_wind_info (&curr));
/*Screen coords of work area origin*/
x = rds.box.x0 - rds.scx;
......
This diff is collapsed.
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