[project @ 2004-07-16 19:47:02 by rjw]

Fix for hotlist menu selection. Interface for MNG/JNG display.

svn path=/import/netsurf/; revision=1083
This commit is contained in:
Richard Wilson 2004-07-16 19:47:03 +00:00
parent 8b0aaef01d
commit b7bb766e95
13 changed files with 173 additions and 3 deletions

View File

@ -30,6 +30,9 @@
#ifdef WITH_PNG #ifdef WITH_PNG
#include "netsurf/riscos/png.h" #include "netsurf/riscos/png.h"
#endif #endif
#ifdef WITH_MNG
#include "netsurf/riscos/mng.h"
#endif
#ifdef WITH_GIF #ifdef WITH_GIF
#include "netsurf/riscos/gif.h" #include "netsurf/riscos/gif.h"
#endif #endif
@ -73,6 +76,14 @@ static const struct mime_entry mime_map[] = {
#ifdef WITH_PNG #ifdef WITH_PNG
{"image/png", CONTENT_PNG}, {"image/png", CONTENT_PNG},
#endif #endif
#ifdef WITH_MNG
{"image/jng", CONTENT_JNG},
{"image/x-jng", CONTENT_JNG},
{"image/mng", CONTENT_MNG},
{"image/x-mng", CONTENT_MNG},
{"video/mng", CONTENT_MNG},
{"video/x-mng", CONTENT_MNG},
#endif
#ifdef WITH_DRAW #ifdef WITH_DRAW
{"image/x-drawfile", CONTENT_DRAW}, {"image/x-drawfile", CONTENT_DRAW},
#endif #endif
@ -98,6 +109,9 @@ const char *content_type_name[] = {
#ifdef WITH_PNG #ifdef WITH_PNG
"PNG", "PNG",
#endif #endif
#ifdef WITH_MNG
"MNG",
#endif
#ifdef WITH_SPRITE #ifdef WITH_SPRITE
"SPRITE", "SPRITE",
#endif #endif
@ -162,6 +176,10 @@ static const struct handler_entry handler_map[] = {
{nspng_create, nspng_process_data, nspng_convert, {nspng_create, nspng_process_data, nspng_convert,
0, nspng_destroy, 0, nspng_redraw, 0, 0, 0}, 0, nspng_destroy, 0, nspng_redraw, 0, 0, 0},
#endif #endif
#ifdef WITH_MNG
{nsmng_create, nsmng_process_data, nsmng_convert,
0, nsmng_destroy, 0, nsmng_redraw, 0, 0, 0},
#endif
#ifdef WITH_SPRITE #ifdef WITH_SPRITE
{sprite_create, sprite_process_data, sprite_convert, {sprite_create, sprite_process_data, sprite_convert,
0, sprite_destroy, 0, sprite_redraw, 0, 0, 0}, 0, sprite_destroy, 0, sprite_redraw, 0, 0, 0},

View File

@ -110,6 +110,9 @@
#ifdef WITH_PNG #ifdef WITH_PNG
#include "netsurf/riscos/png.h" #include "netsurf/riscos/png.h"
#endif #endif
#ifdef WITH_MNG
#include "netsurf/riscos/mng.h"
#endif
#ifdef WITH_SPRITE #ifdef WITH_SPRITE
#include "netsurf/riscos/sprite.h" #include "netsurf/riscos/sprite.h"
#endif #endif
@ -200,6 +203,9 @@ struct content {
#ifdef WITH_PNG #ifdef WITH_PNG
struct content_png_data png; struct content_png_data png;
#endif #endif
#ifdef WITH_MNG
struct content_mng_data mng;
#endif
#ifdef WITH_SPRITE #ifdef WITH_SPRITE
struct content_sprite_data sprite; struct content_sprite_data sprite;
#endif #endif

View File

@ -31,6 +31,10 @@ typedef enum {
#ifdef WITH_PNG #ifdef WITH_PNG
CONTENT_PNG, CONTENT_PNG,
#endif #endif
#ifdef WITH_MNG
CONTENT_JNG,
CONTENT_MNG,
#endif
#ifdef WITH_SPRITE #ifdef WITH_SPRITE
CONTENT_SPRITE, CONTENT_SPRITE,
#endif #endif

View File

@ -28,7 +28,7 @@ OBJECTS_RISCOS += 401login.o debugwin.o \
dialog.o download.o draw.o filetype.o font.o gif.o \ dialog.o download.o draw.o filetype.o font.o gif.o \
gifread.o gui.o help.o history.o hotlist.o htmlinstance.o \ gifread.o gui.o help.o history.o hotlist.o htmlinstance.o \
htmlredraw.o jpeg.o menus.o mouseactions.o plugin.o \ htmlredraw.o jpeg.o menus.o mouseactions.o plugin.o \
png.o save.o save_complete.o save_draw.o save_text.o \ png.o mng.o save.o save_complete.o save_draw.o save_text.o \
schedule.o sprite.o textselection.o theme.o thumbnail.o \ schedule.o sprite.o textselection.o theme.o thumbnail.o \
toolbar.o ufont.o uri.o url_protocol.o wimp.o window.o # riscos/ toolbar.o ufont.o uri.o url_protocol.o wimp.o window.o # riscos/

View File

@ -70,6 +70,10 @@ static const content_type image_types[] = {
#ifdef WITH_PNG #ifdef WITH_PNG
CONTENT_PNG, CONTENT_PNG,
#endif #endif
#ifdef WITH_MNG
CONTENT_JNG,
CONTENT_MNG,
#endif
#ifdef WITH_SPRITE #ifdef WITH_SPRITE
CONTENT_SPRITE, CONTENT_SPRITE,
#endif #endif

View File

@ -26,6 +26,8 @@ static const struct type_entry type_map[] = {
{0x695, "image/gif"}, {0x695, "image/gif"},
{0xaff, "image/x-drawfile"}, {0xaff, "image/x-drawfile"},
{0xb60, "image/png"}, {0xb60, "image/png"},
{0x251, "image/jng"}, /* currently in user space */
{0x252, "image/mng"}, /* currently in user space */
{0xc85, "image/jpeg"}, {0xc85, "image/jpeg"},
{0xf79, "text/css"}, {0xf79, "text/css"},
{0xfaf, "text/html"}, {0xfaf, "text/html"},
@ -125,6 +127,8 @@ int ro_content_filetype(struct content *content)
case CONTENT_CSS: return 0xf79; case CONTENT_CSS: return 0xf79;
case CONTENT_JPEG: return 0xc85; case CONTENT_JPEG: return 0xc85;
case CONTENT_PNG: return 0xb60; case CONTENT_PNG: return 0xb60;
case CONTENT_JNG: return 0x251; /* currently in user space */
case CONTENT_MNG: return 0x252; /* currently in user space */
case CONTENT_GIF: return 0x695; case CONTENT_GIF: return 0x695;
case CONTENT_SPRITE: return 0xff9; case CONTENT_SPRITE: return 0xff9;
case CONTENT_DRAW: return 0xaff; case CONTENT_DRAW: return 0xaff;

View File

@ -739,6 +739,15 @@ void html_redraw_background(long xi, long yi, int width, int height,
tinct_options); tinct_options);
break; break;
#endif #endif
#ifdef WITH_PNG
case CONTENT_JNG:
case CONTENT_MNG:
_swix(Tinct_PlotScaledAlpha, _IN(2) | _IN(3) | _IN(4) | _IN(5) | _IN(6) | _IN(7),
((char*) box->background->data.mng.sprite_area + box->background->data.mng.sprite_area->first),
x, y - image_height, image_width, image_height,
tinct_options);
break;
#endif
#ifdef WITH_JPEG #ifdef WITH_JPEG
case CONTENT_JPEG: case CONTENT_JPEG:
_swix(Tinct_PlotScaled, _IN(2) | _IN(3) | _IN(4) | _IN(5) | _IN(6) | _IN(7), _swix(Tinct_PlotScaled, _IN(2) | _IN(3) | _IN(4) | _IN(5) | _IN(6) | _IN(7),

View File

@ -582,10 +582,12 @@ void ro_gui_menu_selection(wimp_selection *selection)
} }
break; break;
case 2: /* Select all */ case 2: /* Select all */
ro_gui_hotlist_keypress(1); /* CTRL+A */ ro_gui_hotlist_set_selected(true);
ro_gui_menu_prepare_hotlist();
break; break;
case 3: /* Clear */ case 3: /* Clear */
ro_gui_hotlist_keypress(26); /* CTRL+Z */ ro_gui_hotlist_set_selected(false);
ro_gui_menu_prepare_hotlist();
break; break;
} }
} else if (current_menu == browser_menu) { } else if (current_menu == browser_menu) {
@ -1387,6 +1389,7 @@ void ro_gui_menu_objectinfo(wimp_message_menu_warning *warning)
if (box->object->mime_type) mime = box->object->mime_type; if (box->object->mime_type) mime = box->object->mime_type;
} }
else if (c->type == CONTENT_JPEG || c->type == CONTENT_PNG || else if (c->type == CONTENT_JPEG || c->type == CONTENT_PNG ||
c->type == CONTENT_JNG || c->type == CONTENT_MNG ||
c->type == CONTENT_GIF || c->type == CONTENT_SPRITE || c->type == CONTENT_GIF || c->type == CONTENT_SPRITE ||
c->type == CONTENT_DRAW) { c->type == CONTENT_DRAW) {
sprintf(icon_buf, "file_%x", ro_content_filetype(c)); sprintf(icon_buf, "file_%x", ro_content_filetype(c));

73
riscos/mng.c Normal file
View File

@ -0,0 +1,73 @@
/*
* This file is part of NetSurf, http://netsurf.sourceforge.net/
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
* Copyright 2004 Richard Wilson <not_ginger_matt@users.sourceforge.net>
*/
#include <assert.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
#include <swis.h>
#include "oslib/osspriteop.h"
#include "netsurf/utils/config.h"
#include "netsurf/content/content.h"
#include "netsurf/riscos/gui.h"
#include "netsurf/riscos/options.h"
#include "netsurf/riscos/mng.h"
#include "netsurf/riscos/tinct.h"
#include "netsurf/utils/log.h"
#include "netsurf/utils/messages.h"
#include "netsurf/utils/utils.h"
#ifdef WITH_MNG
bool nsmng_create(struct content *c, const char *params[]) {
return false;
}
bool nsmng_process_data(struct content *c, char *data, unsigned int size) {
return true;
}
bool nsmng_convert(struct content *c, int width, int height) {
return true;
}
void nsmng_destroy(struct content *c) {
}
void nsmng_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
float scale) {
unsigned int tinct_options;
/* If we have a gui_window then we work from there, if not we use the global
settings as we are drawing a thumbnail.
*/
if (ro_gui_current_redraw_gui) {
tinct_options = (ro_gui_current_redraw_gui->option_filter_sprites?tinct_BILINEAR_FILTER:0) |
(ro_gui_current_redraw_gui->option_dither_sprites?tinct_DITHER:0);
} else {
tinct_options = (option_filter_sprites?tinct_BILINEAR_FILTER:0) |
(option_dither_sprites?tinct_DITHER:0);
}
/* Tinct currently only handles 32bpp sprites that have an embedded alpha mask. Any
sprites not matching the required specifications are ignored. See the Tinct
documentation for further information.
*/
/* _swix(Tinct_PlotScaledAlpha, _IN(2) | _IN(3) | _IN(4) | _IN(5) | _IN(6) | _IN(7),
((char *) c->data.mng.sprite_area + c->data.mng.sprite_area->first),
x, y - height,
width, height,
tinct_options);
*/
}
#endif

28
riscos/mng.h Normal file
View File

@ -0,0 +1,28 @@
/*
* This file is part of NetSurf, http://netsurf.sourceforge.net/
* Licensed under the GNU General Public License,
* http://www.opensource.org/licenses/gpl-license
* Copyright 2004 Richard Wilson <not_ginger_matt@users.sourceforge.net>
*/
#ifndef _NETSURF_RISCOS_MNG_H_
#define _NETSURF_RISCOS_MNG_H_
#include "oslib/osspriteop.h"
struct content;
struct content_mng_data {
osspriteop_area *sprite_area;
char *sprite_image;
};
bool nsmng_create(struct content *c, const char *params[]);
bool nsmng_process_data(struct content *c, char *data, unsigned int size);
bool nsmng_convert(struct content *c, int width, int height);
void nsmng_destroy(struct content *c);
void nsmng_redraw(struct content *c, int x, int y,
int width, int height,
int clip_x0, int clip_y0, int clip_x1, int clip_y1,
float scale);
#endif

View File

@ -429,6 +429,10 @@ void ro_gui_save_object_native(struct content *c, char *path)
case CONTENT_PNG: case CONTENT_PNG:
error = xosspriteop_save_sprite_file(osspriteop_USER_AREA, c->data.png.sprite_area, path); error = xosspriteop_save_sprite_file(osspriteop_USER_AREA, c->data.png.sprite_area, path);
break; break;
case CONTENT_JNG:
case CONTENT_MNG:
error = xosspriteop_save_sprite_file(osspriteop_USER_AREA, c->data.mng.sprite_area, path);
break;
case CONTENT_GIF: case CONTENT_GIF:
/* create sprite area */ /* create sprite area */
temp = calloc(c->data.gif.gif->frame_image->size+16, temp = calloc(c->data.gif.gif->frame_image->size+16,

View File

@ -596,6 +596,10 @@ static bool add_box(struct box *box, colour cbc, int x, int y)
case CONTENT_JPEG: case CONTENT_JPEG:
#ifdef WITH_PNG #ifdef WITH_PNG
case CONTENT_PNG: case CONTENT_PNG:
#endif
#ifdef WITH_MNG
case CONTENT_JNG:
case CONTENT_MNG:
#endif #endif
case CONTENT_GIF: case CONTENT_GIF:
#ifdef WITH_SPRITE #ifdef WITH_SPRITE
@ -703,6 +707,12 @@ static bool add_graphic(struct content *content, struct box *box,
case CONTENT_PNG: case CONTENT_PNG:
sprite_length = ((osspriteop_header*)((char*)content->data.png.sprite_area+content->data.png.sprite_area->first))->size; sprite_length = ((osspriteop_header*)((char*)content->data.png.sprite_area+content->data.png.sprite_area->first))->size;
break; break;
#endif
#ifdef WITH_MNG
case CONTENT_JNG:
case CONTENT_MNG:
sprite_length = ((osspriteop_header*)((char*)content->data.mng.sprite_area+content->data.mng.sprite_area->first))->size;
break;
#endif #endif
case CONTENT_GIF: case CONTENT_GIF:
sprite_length = content->data.gif.gif->frame_image->size; sprite_length = content->data.gif.gif->frame_image->size;
@ -736,6 +746,12 @@ static bool add_graphic(struct content *content, struct box *box,
case CONTENT_PNG: case CONTENT_PNG:
memcpy((char*)ds+16, (char*)content->data.png.sprite_area+content->data.png.sprite_area->first, (unsigned)sprite_length); memcpy((char*)ds+16, (char*)content->data.png.sprite_area+content->data.png.sprite_area->first, (unsigned)sprite_length);
break; break;
#endif
#ifdef WITH_MNG
case CONTENT_JNG:
case CONTENT_MNG:
memcpy((char*)ds+16, (char*)content->data.mng.sprite_area+content->data.mng.sprite_area->first, (unsigned)sprite_length);
break;
#endif #endif
case CONTENT_GIF: case CONTENT_GIF:
memcpy((char*)ds+16, (char*)content->data.gif.gif->frame_image, (unsigned)sprite_length); memcpy((char*)ds+16, (char*)content->data.gif.gif->frame_image, (unsigned)sprite_length);

View File

@ -22,6 +22,7 @@
#define WITH_GIF #define WITH_GIF
#define WITH_JPEG #define WITH_JPEG
#define WITH_PNG #define WITH_PNG
#define WITH_MNG
#endif #endif
#ifdef riscos #ifdef riscos
#define WITH_DRAW #define WITH_DRAW