Commit cba6e241 authored by Robert Sprowson's avatar Robert Sprowson

Prune the plethora of targets a bit.

Spurious ';' after an if at line 2386 of c.Main deleted, something to do with scroll wheel support. Untested.
Refer to FileType_ using the filetypes header file.
Internationalised "Selection" when saving a sprite selection.
main_save_selection wasn't checking if fwrite() worked so never reported 'disc full'.
Turn on egg timer during main_save_selection().
Fix (de)selection bug when in full sprite info view, the 'spritesperrow' was being rounded down to zero, and unlike everywhere else it wasn't being adjusted back to a minimum of 1.

Version 2.03. Tagged as 'Paint-2_03'
parent 52984de9
......@@ -14,4 +14,5 @@
|
Dir <Obey$Dir>
wimpslot -min 1024k
amu_machine appd
cdir debug.!Paint
amu_machine installd THROWBACK=-throwback INSTDIR=debug.!Paint
......@@ -60,7 +60,7 @@ AFLAGS = ${THROWBACK} -depend !Depend -nocache -stamp -quit
CFLAGS = ${THROWBACK} -c -depend !Depend -fah ${INCLUDES} -wp
CPFLAGS = ~cfr~v
SQFLAGS =
WFLAGS = ~c~v
WFLAGS = ~c~vf
#
# Libraries
......@@ -131,8 +131,6 @@ INCS = i.colours i.main i.menus i.psprite i.sprwindow i.tools i.toolwindow
#
# Main rules:
#
# Application
#
all: ${FILES}
@echo ${COMPONENT}: Application built (Disc)
......@@ -162,7 +160,7 @@ installd: ${FILESD}
${CP} ${LDIR}.!Help ${INSTDIR}.!Help ${CPFLAGS}
${CP} ${LDIR}.!Run ${INSTDIR}.!Run ${CPFLAGS}
${CP} abs.!RunImageD ${INSTDIR}.!RunImage ${CPFLAGS}
${CP} ${LDIR}.Messages ${INSTDIR}.Messages ${CPFLAGS}
${CP} ${MSGS} ${INSTDIR}.Messages ${CPFLAGS}
${CP} ${LDIR}.Sprites ${INSTDIR}.Sprites ${CPFLAGS}
${CP} ${LDIR}.Templates ${INSTDIR}.Templates ${CPFLAGS}
Access ${INSTDIR}.!Boot lr/r
......@@ -197,6 +195,8 @@ clean:
${XWIPE} s.* ${WFLAGS}
${XWIPE} linked.* ${WFLAGS}
${XWIPE} map.* ${WFLAGS}
${XWIPE} debug.!Paint.* ${WFLAGS}
${XWIPE} !Paint.* ${WFLAGS}
${RM} abs.!RunImage
${RM} abs.!RunImageD
${RM} ${ROM_MODULE}
......@@ -204,39 +204,6 @@ clean:
${RM} ${MODULE}
@echo ${COMPONENT}: cleaned
#
# Development rules:
#
app: ${FILES}
@echo Made application ${APP}
appd: ${DFILES}
@echo Made debug.${APP}
mod: ${MODULE}
@echo ${COMPONENT}: Module built (RAM)
asms: ${ASMS}
incs: ${INCS}
clean_all:
x Access ${INSTDIR}.!Boot rw/rw
x Access ${INSTDIR}.!Help rw/rw
x Access ${INSTDIR}.!Run rw/rw
x Access ${INSTDIR}.!RunImage rw/rw
x Access ${INSTDIR}.Messages rw/rw
x Access ${INSTDIR}.Sprites rw/rw
x Access ${INSTDIR}.Templates rw/rw
Destroy ${OBJS} ${OBJSZ} ${OBJSD} o.ModuleWrap \
${APP}.!RunImage \
debug.${APP}.!RunImage \
${ROM_MODULE} ${MODULE} \
${ASMS} s.Appname s.ModuleWrap s.ResFiles \
${DFILES} ${INSTDIR}.!Boot ${INSTDIR}.!Help ${INSTDIR}.!Run \
${INSTDIR}.!RunImage ${INSTDIR}.Messages ${INSTDIR}.Sprites \
${INSTDIR}.Templates
#
# Static dependencies:
#
......
......@@ -11,13 +11,13 @@
GBLS Module_HelpVersion
GBLS Module_ComponentName
GBLS Module_ComponentPath
Module_MajorVersion SETS "2.02"
Module_Version SETA 202
Module_MajorVersion SETS "2.03"
Module_Version SETA 203
Module_MinorVersion SETS ""
Module_Date SETS "29 Nov 2010"
Module_ApplicationDate SETS "29-Nov-10"
Module_Date SETS "05 Dec 2010"
Module_ApplicationDate SETS "05-Dec-10"
Module_ComponentName SETS "Paint"
Module_ComponentPath SETS "castle/RiscOS/Sources/Apps/Paint"
Module_FullVersion SETS "2.02"
Module_HelpVersion SETS "2.02 (29 Nov 2010)"
Module_FullVersion SETS "2.03"
Module_HelpVersion SETS "2.03 (05 Dec 2010)"
END
/* (2.02)
/* (2.03)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.02
#define Module_MajorVersion_CMHG 2.03
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 29 Nov 2010
#define Module_Date_CMHG 05 Dec 2010
#define Module_MajorVersion "2.02"
#define Module_Version 202
#define Module_MajorVersion "2.03"
#define Module_Version 203
#define Module_MinorVersion ""
#define Module_Date "29 Nov 2010"
#define Module_Date "05 Dec 2010"
#define Module_ApplicationDate "29-Nov-10"
#define Module_ApplicationDate "05-Dec-10"
#define Module_ComponentName "Paint"
#define Module_ComponentPath "castle/RiscOS/Sources/Apps/Paint"
#define Module_FullVersion "2.02"
#define Module_HelpVersion "2.02 (29 Nov 2010)"
#define Module_LibraryVersionInfo "2:2"
#define Module_FullVersion "2.03"
#define Module_HelpVersion "2.03 (05 Dec 2010)"
#define Module_LibraryVersionInfo "2:3"
......@@ -233,13 +233,14 @@ BOOL AltRename_claim_event(wimp_eventstr *e,main_window *window)
switch (e->data.key.chcode)
{
case 13:
AltRename_renamesprite(rename_sprite,rename_buffer);
if (!akbd_pollctl())
{
AltRename_delete();
break;
}
// fall through
AltRename_renamesprite(rename_sprite,rename_buffer);
if (!akbd_pollctl())
{
AltRename_delete();
break;
}
/*fall through*/
case 0x18A: /* TAB - next sprite */
{
main_sprite *sprite=rename_sprite->link;
......
......@@ -69,6 +69,7 @@
#include <stdarg.h>
#include <swis.h>
#include "Global/CMOS.h"
#include "Global/FileTypes.h"
#include "pointer.h"
#include "akbd.h"
......@@ -856,7 +857,7 @@ static BOOL ramtransfer_file (wimp_msgdatasave *ms)
ftracef0 ("ramtransfer_file\n");
/*only interested in sprites*/
/*and jpeg's. J R C 27th Jun 1994*/
if (!((file_type = xferrecv_checkimport (&size)) == SPRITE_FILE ||
if (!((file_type = xferrecv_checkimport (&size)) == FileType_Sprite ||
file_type == jpeg_FILE_TYPE))
{ werr (FALSE, msgs_lookup ("PntEB"), ms->leaf);
return FALSE;
......@@ -1283,7 +1284,7 @@ static int Load_File (main_window *window, char *filename, int merge,
/*Copes with JPEGs now. J R C 24th Jun 1994*/
{ int rc = 1, i = 0, offset, ramcopy = filename == (char *) -1,
temp_file = !(safe || xferrecv_file_is_safe ()), file_type = SPRITE_FILE,
temp_file = !(safe || xferrecv_file_is_safe ()), file_type = FileType_Sprite,
sprite_size, width, height, s1, s2, s3,
log2_bpp = bbc_modevar (-1, bbc_Log2BPP);
os_filestr filestr;
......@@ -1319,7 +1320,7 @@ static int Load_File (main_window *window, char *filename, int merge,
}
file_type = (filestr.loadaddr & 0xFFF00) >> 8;
if (!(file_type == SPRITE_FILE || file_type == jpeg_FILE_TYPE))
if (!(file_type == FileType_Sprite || file_type == jpeg_FILE_TYPE))
{ werr (FALSE, msgs_lookup ("PntEB"), filename);
return 0; /* failed */
} }
......@@ -1345,7 +1346,7 @@ static int Load_File (main_window *window, char *filename, int merge,
sure that file->spritearea is big enough to load the file into.*/
if (!ramcopy)
{ /*Copying from a file.*/
if (file_type == SPRITE_FILE)
if (file_type == FileType_Sprite)
sprite_size = filestr.start - 12;
else
{ if (wimpt_complain (xjpegfileinfo_dimensions (filename, NULL, &width,
......@@ -1366,7 +1367,7 @@ static int Load_File (main_window *window, char *filename, int merge,
}
ftracef0 ("load file into ram buffer\n");
if (file_type == SPRITE_FILE)
if (file_type == FileType_Sprite)
{ ftracef1 ("writing size (%d) at front of buffer\n", sprite_size + 16);
*(int *) ramfetch_buffer = sprite_size + 16;
/* convert into sprite area */
......@@ -1480,7 +1481,7 @@ static int Load_File (main_window *window, char *filename, int merge,
ftracef2 ("Load_File: loading \"%s\" into area 0x%X\n",
filename, file->spritearea);
if (file_type == SPRITE_FILE)
if (file_type == FileType_Sprite)
{ if (wimpt_complain (sprite_area_load (file->spritearea, filename)))
return NULL;
......@@ -1801,6 +1802,8 @@ static void main_clear_selection(main_window *window, wimp_box *clip, select_ico
wimpt_noerr (wimp_get_wind_state (window->handle, &ws));
spritesperrow = (ws.o.box.x1 - ws.o.box.x0) / width;
if (spritesperrow == 0)
spritesperrow = 1;
column=0;
left=0;
......@@ -1896,57 +1899,54 @@ static void main_save_finished(int at,void *handle)
window->selection.flags &= ~MW_SELSAVING;
}
BOOL main_save_selection(char *filename,void *handle)
{
main_window *window = (main_window *)handle;
BOOL main_save_selection(char *filename,void *arg)
{ main_window *window = (main_window *)arg;
main_sprite *sprite;
FILE *file;
_kernel_oserror *err=0;
int file;
os_error *err;
struct
{
int num_of_sprites;
{ int num_of_sprites;
int offset_to_first;
int offset_to_free;
} header;
if (window->selection.count==0 || !filename) return 0;
if (window->selection.count==0 || !filename) return FALSE;
header.num_of_sprites=window->selection.count;
header.offset_to_first=16;
header.offset_to_free=main_selection_file_size(window)+4;
if (header.offset_to_free<=16) return 0;
header.num_of_sprites = window->selection.count;
header.offset_to_first = sizeof (sprite_area);
header.offset_to_free = main_selection_file_size (window) + 4;
if (header.offset_to_free <= sizeof (sprite_area)) return FALSE;
file=fopen(filename,"wb");
if (!file)
{
wimpt_complain(_kernel_last_oserror());
return 0;
}
visdelay_begin ();
if (wimpt_complain (os_swix2r (OS_Find, 0x83, filename, &file, NULL)) != NULL)
return FALSE;
fwrite(&header,sizeof(header),1,file);
for (sprite=window->data->file.sprites;sprite != NULL; sprite = sprite->link)
{
if (sprite->flags & MSF_SELECTED)
{
sprite_header *spriteaddr = psprite_address (sprite);
fwrite(spriteaddr,spriteaddr->next,1,file);
err = os_swix4 (OS_GBPB, 2, file, &header, sizeof(header));
if (err == NULL)
{ for (sprite = window->data->file.sprites; sprite != NULL; sprite = sprite->link)
{ if (sprite->flags & MSF_SELECTED)
{ sprite_header *header = psprite_address (sprite);
err = os_swix4 (OS_GBPB, 2, file, header, header->next);
if (err != NULL) break;
}
}
}
if (ferror(file)) err=_kernel_last_oserror();
fclose(file);
os_swix2 (OS_Find, 0x00, file);
if (err)
{
wimpt_complain(err);
remove(filename);
return 0;
if (err != NULL)
{ wimpt_complain (err);
remove (filename);
return FALSE;
}
_swix(OS_File,_INR(0,2),18,filename,SPRITE_FILE); /* set file type*/
wimpt_complain (os_swix3 (OS_File, 18, filename, FileType_Sprite)); /* set file type*/
visdelay_end ();
alarm_set(alarm_timenow()+1,main_save_finished,window);
alarm_set(alarm_timenow()+1, main_save_finished, window);
window->selection.flags |= MW_SELSAVING;
return 1;
return TRUE;
}
static BOOL main_select_drag(wimp_eventstr *event, void *handle)
......@@ -1954,7 +1954,7 @@ static BOOL main_select_drag(wimp_eventstr *event, void *handle)
main_window *window = (main_window *)handle;
if (event->e != wimp_EUSERDRAG) return 0;
win_remove_unknown_event_processor(main_select_drag,handle);
xfersend(SPRITE_FILE,0,main_selection_file_size(window),main_save_selection,0,0,event,handle);
xfersend(FileType_Sprite,0,main_selection_file_size(window),main_save_selection,0,0,event,handle);
return 0;
}
......@@ -2142,7 +2142,7 @@ static void spritefile_event_handler (wimp_eventstr *e, void *handle)
main_set_extent (window);
break;
case wimp_ESCROLL: // use wimp_escroll to make mousewheel work (Colin Granville)
case wimp_ESCROLL: /* use wimp_escroll to make mousewheel work (Colin Granville) */
if (e->data.scroll.x || e->data.scroll.y)
{
switch (e->data.scroll.x)
......@@ -2379,8 +2379,8 @@ static void spritefile_event_handler (wimp_eventstr *e, void *handle)
scroll.handle=0;
_swix(Wimp_AutoScroll,_INR(0,1),2,&scroll);
window->selection.flags &= ~MW_SELDRAGRIGHT;
if (e->data.but.m.bbits & wimp_BDRAGRIGHT);
window->selection.flags |= MW_SELDRAGRIGHT;
if (e->data.but.m.bbits & wimp_BDRAGRIGHT)
window->selection.flags |= MW_SELDRAGRIGHT;
win_add_unknown_event_processor(main_select_area,window);
}
}
......@@ -2449,7 +2449,7 @@ static void spritefile_event_handler (wimp_eventstr *e, void *handle)
int type;
type = xferrecv_checkinsert (&name); /* sets up reply */
if (type == SPRITE_FILE || type == jpeg_FILE_TYPE)
if (type == FileType_Sprite || type == jpeg_FILE_TYPE)
{ int ok;
ftracef1 ("Loading file \"%s\"\n", name);
visdelay_begin ();
......@@ -2984,7 +2984,7 @@ static void Background_Events (wimp_eventstr *e, void *handle)
break;
case wimp_MDATAOPEN:
if (e->data.msg.data.dataopen.type != SPRITE_FILE) break;
if (e->data.msg.data.dataopen.type != FileType_Sprite) break;
/*Fall through*/
case wimp_MDATALOAD:
......@@ -2998,7 +2998,7 @@ static void Background_Events (wimp_eventstr *e, void *handle)
ftracef0 ("Printer broadcast\n");
/*FIX G-RO-7139 17 Oct '91 We must print the file now, not
just queue it (was print_file (name);).*/
if (xferrecv_checkprint (&name) == SPRITE_FILE)
if (xferrecv_checkprint (&name) == FileType_Sprite)
{ main_window *w;
ftracef1 ("printing file \"%s\"\n", name);
......
......@@ -57,6 +57,7 @@
#include <stddef.h>
#include <swis.h>
#include <signal.h>
#include "Global/FileTypes.h"
#include "bbc.h"
#include "colourmenu.h"
......@@ -504,7 +505,7 @@ finish:
/*Set the file to type "Sprite"*/
file_str.action = 18;
file_str.name = filename;
file_str.loadaddr = SPRITE_FILE;
file_str.loadaddr = FileType_Sprite;
error1 = os_file (&file_str);
if (txt == NULL && error1 != NULL) txt = error1->errmess;
}
......@@ -593,7 +594,7 @@ static BOOL save_sprite_palette (char *filename, void *shandle)
if (r.r [0] != 0) oldattribs = r.r [5];
r.r [0] = 10;
r.r [2] = 0xFED;
r.r [2] = FileType_Palette;
r.r [4] = (int) &palette;
r.r [5] = (int) &palette + len;
......@@ -715,7 +716,9 @@ static void menus_save_selection (main_window *window)
return;
}
myxfersend (SPRITE_FILE,"Selection",main_selection_file_size(window),main_save_selection,0,0,window);
myxfersend (FileType_Sprite, msgs_lookup ("PntG6"),
main_selection_file_size (window),
main_save_selection, 0, 0, window);
}
void menus_save_sprite (main_sprite *sprite)
......@@ -727,7 +730,7 @@ void menus_save_sprite (main_sprite *sprite)
ftracef1 ("sprite called \"%s\"\n", name);
myxfersend (SPRITE_FILE, name,
myxfersend (FileType_Sprite, name,
psprite_address (sprite)->next + sizeof (sprite_area),
&save_sprite, &buffer_sprite,
&Do_Print, /*Protocol now in xfersend(), immediate printing
......@@ -751,7 +754,7 @@ BOOL menus_save_file (main_window *window, int askfor_name)
if (askfor_name)
{ My_File_Is_Safe = FALSE;
ftracef0 ("menus_save_file: myxfersend\n");
myxfersend (SPRITE_FILE, name, window->data->file.spritearea->size,
myxfersend (FileType_Sprite, name, window->data->file.spritearea->size,
&save_file_proc, &buffer_file_proc,
&print_file_proc, /*Protocol now in xfersend(), immediate printing
allowed. Was NULL. JRC 4 Apr 1992*/
......@@ -1226,7 +1229,7 @@ void menus_sprite_handler (void *handle, char *hit)
{ int size = psprite_palsize (sprite);
ftracef0 ("Sprite palette save\n");
myxfersend (0xFED, msgs_lookup ("PntG5"), size,
myxfersend (FileType_Palette, msgs_lookup ("PntG5"), size,
&save_sprite_palette, &buffer_sprite_palette, 0, sprite);
}
break;
......@@ -1850,7 +1853,7 @@ static BOOL queue_print (dbox d, main_sprite *sprite)
psprite_read_full_info (sprite, &info);
if (!xfersend_print (SPRITE_FILE, info.name, info.size,
if (!xfersend_print (FileType_Sprite, info.name, info.size,
/*saver*/ &save_sprite, /*sender - no point yet*/ NULL,
/*printer*/ &Do_Print, /*handle*/ sprite))
return FALSE;
......@@ -2720,8 +2723,6 @@ menu menus_file_maker (void *handle)
hack_entry (spritefile_main_menu, m_Sprite, Spritename);
// menu_setflags (spritefile_main_menu, m_Sprite, 0, hit_sprite == NULL && window->selection.count==0);
/* When there are no sprites in the file,forbid its saving & selecting */
menu_setflags (spritefile_main_menu, m_Save, 0,
(file->spritearea->number == 0));
......
......@@ -24,6 +24,7 @@
*/
#include <swis.h>
#include "Global/FileTypes.h"
#include "akbd.h"
#include "bbc.h"
......@@ -187,8 +188,8 @@ int sprwindow_swap_output_to_mask (main_sprite *sprite, int statesaved)
state->r[2] = (int) psprite_address (sprite);
state->r[3] = 0;
wimpt_complain (os_swix (OS_SpriteOp, state));
os_swix1 (OS_ChangedBox+os_X, 2);
os_swix1 (OS_ChangedBox+os_X, 1); /* enable changed box calcs */
os_swix1 (OS_ChangedBox, 2);
os_swix1 (OS_ChangedBox, 1); /* enable changed box calcs */
return 1;
}
else return 0;
......@@ -332,11 +333,11 @@ static BOOL cant_extend_stack_buffer (char **b, int *s)
static BOOL check_palette_type (int type, char *name)
{ ftracef0 ("check_palette_type\n");
if (type != 0xFED && type != -1)
if (type != FileType_Palette && type != -1)
{ werr (FALSE, msgs_lookup (name == NULL? "PntE2": "PntE3"), name);
return FALSE;
}
return type == 0xFED;
return type == FileType_Palette;
}
void sprwindow_event_handler (wimp_eventstr *e, void *handle)
......
| Copyright 1996 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
Set Alias$@RunType_FF9 /<Obey$Dir>
Set Alias$@PrintType_FF9 /<Obey$Dir> -print
| Copyright 1996 Acorn Computers Ltd
|
| Licensed under the Apache License, Version 2.0 (the "License");
| you may not use this file except in compliance with the License.
| You may obtain a copy of the License at
|
| http://www.apache.org/licenses/LICENSE-2.0
|
| Unless required by applicable law or agreed to in writing, software
| distributed under the License is distributed on an "AS IS" BASIS,
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
| See the License for the specific language governing permissions and
| limitations under the License.
|
RMEnsure UtilityModule 3.50 Error This version of Paint requires RISC OS 3.50
RMEnsure SpriteExtend 0.80 Error This version of Paint requires Sprite Extend 0.80
If "<Wimp$ScrapDir>"="" then Error Paint requires a scrap directory: open a directory that contains the Scrap application
......
No preview for this file type
......@@ -57,7 +57,6 @@
/* amount of scratchspace a tool is given */
#define NAME_LIMIT 12 /*not defined in sprite.h!*/
#define SPRITE_FILE 0xFF9
typedef struct
{
......@@ -117,11 +116,9 @@ typedef struct main_sprite
main_ecf ECFs [4];
int gcol; /* current painting colour */
int gcol2; /* current colour for ADJUST */
int toolspace [toolspacesize];
/* tool scratch space */
colourpicker_d colourdialogue;
int toolspace [toolspacesize]; /* tool scratch space */
colourpicker_d colourdialogue; /* handle of colourpicker */
char *colourtitle; /* indirected colour title */
/* handle of colourpicker */
char needsnull; /* set if tracking pointer */
char coloursize;
unsigned int flags;
......@@ -152,8 +149,9 @@ typedef enum
main_window_is_sprite
} main_window_tag;
#define MW_SELDRAGRIGHT 1
#define MW_SELSAVING 2
#define MW_SELDRAGRIGHT 1
#define MW_SELSAVING 2
#define MW_SELSAVEBYDRAG 4
typedef struct main_window
{
......
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