29#include "oslib/dragasprite.h"
31#include "oslib/osgbpb.h"
32#include "oslib/osfile.h"
33#include "oslib/osfind.h"
34#include "oslib/osspriteop.h"
35#include "oslib/wimpspriteop.h"
36#include "oslib/squash.h"
37#include "oslib/wimp.h"
38#include "oslib/wimpextend.h"
39#include "oslib/wimpspriteop.h"
108 descriptor = descriptor->
next)
113 descriptor = descriptor->
next)
142 while ((test = current->
next)) {
143 if (strcmp(current->
name, test->
name) > 0) {
148 test->
next = current;
154 if (!current) current = test;
156 current = current->
next;
176 osgbpb_INFO(100) info;
178 while (context != -1) {
180 os_error *error = xosgbpb_dir_entries_info(
directory,
181 (osgbpb_info_list *) &info, 1, context,
182 sizeof(info), 0, &read_count, &context);
185 "xosgbpb_dir_entries_info: 0x%x: %s",
188 if (error->errnum == 0xd6)
195 if ((read_count != 0) && (info.obj_type == fileswitch_IS_FILE))
223 osspriteop_area *area;
225 if (descriptor == NULL)
228 if (descriptor != NULL && descriptor->
theme != NULL)
231 area = (osspriteop_area *) 1;
254 if (descriptor == NULL)
257 if (descriptor == NULL)
264 return wimp_COLOUR_BLACK;
266 return wimp_COLOUR_VERY_LIGHT_GREY;
275 return wimp_COLOUR_BLACK;
288 return wimp_COLOUR_BLACK;
327 bool *right,
bool *redraw)
329 if (descriptor == NULL)
332 if (descriptor == NULL || descriptor->
theme == NULL)
370 NSLOG(netsurf, INFO,
"No memory for malloc");
377 error = xosfind_openinw(osfind_NO_PATH,
filename, 0,
380 NSLOG(netsurf, INFO,
"xosfind_openinw: 0x%x: %s",
381 error->errnum, error->errmess);
386 if (file_handle == 0) {
390 error = xosgbpb_read_atw(file_handle,
391 (
byte *) &file_header,
394 xosfind_closew(file_handle);
396 NSLOG(netsurf, INFO,
"xosbgpb_read_atw: 0x%x: %s",
397 error->errnum, error->errmess);
402 if (output_left > 0) {
411 NSLOG(netsurf, INFO,
"calloc failed");
426 if (!strcmp(current->
name, test->
name)) {
459 strcpy(descriptor->
name, file_header->
name);
490 fileswitch_object_type obj_type;
491 squash_output_status status;
496 char sprite_name[16];
497 const char *
name = sprite_name;
500 int workspace_size, file_size;
501 char *raw_data, *workspace;
502 osspriteop_area *decompressed;
507 if (list && descriptor)
512 for (; descriptor; descriptor = next_descriptor) {
515 next_descriptor = descriptor->
next;
517 next_descriptor = NULL;
520 if (descriptor->
theme) {
527 sizeof(
struct theme));
528 if (!descriptor->
theme) {
529 NSLOG(netsurf, INFO,
"calloc() failed");
536 error = xosfile_read_stamped_no_path(descriptor->
filename,
537 &obj_type, 0, 0, &file_size, 0, 0);
540 "xosfile_read_stamped_no_path: 0x%x: %s",
546 if (obj_type != fileswitch_IS_FILE)
548 raw_data = malloc(file_size);
550 NSLOG(netsurf, INFO,
"malloc() failed");
554 error = xosfile_load_stamped_no_path(descriptor->
filename,
555 (
byte *)raw_data, 0, 0, 0, 0, 0);
559 "xosfile_load_stamped_no_path: 0x%x: %s",
567 error = xsquash_decompress_return_sizes(-1, &workspace_size, 0);
571 "xsquash_decompress_return_sizes: 0x%x: %s",
577 decompressed = (osspriteop_area *)malloc(
579 workspace = malloc(workspace_size);
580 if ((!decompressed) || (!workspace)) {
583 NSLOG(netsurf, INFO,
"malloc() failed");
587 error = xsquash_decompress(squash_INPUT_ALL_PRESENT, workspace,
588 (
byte *)(raw_data +
sizeof(
591 (
byte *)decompressed,
593 &status, 0, 0, 0, 0);
598 NSLOG(netsurf, INFO,
"xsquash_decompress: 0x%x: %s",
599 error->errnum, error->errmess);
613 error = xosspriteop_return_name(osspriteop_USER_AREA,
615 sprite_name, 16, i, 0);
618 "xosspriteop_return_name: 0x%x: %s",
624 if (strncmp(sprite_name,
"throbber", 8))
628 error = xosspriteop_read_sprite_info(
629 osspriteop_USER_AREA,
631 (osspriteop_id) name,
632 &dimensions.x, &dimensions.y,
633 (osbool *) 0, &
mode);
636 "xosspriteop_read_sprite_info: 0x%x: %s",
651 n = atoi(sprite_name + 8);
702 while (list && descriptor->
previous)
707 if (descriptor->
theme) {
711 free(descriptor->
theme);
712 descriptor->
theme = NULL;
717 descriptor = descriptor->
next;
739 for (; descriptor; descriptor = next_descriptor) {
740 next_descriptor = descriptor->
next;
743 if (!descriptor->
theme) {
746 if (descriptor->
next)
static os_mode mode
The current sprite mode.
RISc OS global history interface.
Window themes(interface).
theme_element
Theme elements, which belong to styles.
@ THEME_ELEMENT_FOREGROUND
@ THEME_ELEMENT_BACKGROUND
theme_style
Theme styles, collecting groups of attributes for different locations.
@ THEME_STYLE_HOTLIST_TOOLBAR
@ THEME_STYLE_COOKIES_TOOLBAR
@ THEME_STYLE_GLOBAL_HISTORY_TOOLBAR
@ THEME_STYLE_BROWSER_TOOLBAR
#define NSLOG(catname, level, logmsg, args...)
Interface to riscos cookie viewing using riscos core window.
nserror ro_warn_user(const char *warning, const char *detail)
Display a warning for a serious problem (eg memory exhaustion).
struct theme_descriptor * ro_gui_theme_get_current(void)
Returns the current theme handle, or NULL if none is set.
bool ro_gui_theme_read_file_header(struct theme_descriptor *descriptor, struct theme_file_header *file_header)
Fills in the basic details for a descriptor from a file header.
bool ro_gui_theme_open(struct theme_descriptor *descriptor, bool list)
Opens a theme ready for use.
void ro_gui_theme_initialise(void)
Initialise the theme handler.
static bool ro_gui_theme_add_descriptor(const char *folder, const char *leafname)
Checks a theme is valid and adds it to the current list.
void ro_gui_theme_finalise(void)
Finalise the theme handler.
osspriteop_area * ro_gui_theme_get_sprites(struct theme_descriptor *descriptor)
Returns a sprite area for use with the given theme.
void ro_gui_theme_close(struct theme_descriptor *descriptor, bool list)
Closes a theme after use.
struct theme_descriptor * ro_gui_theme_get_available(void)
Reads and caches the currently available themes.
static struct theme_descriptor * theme_descriptors
static struct theme_descriptor * theme_current
static void ro_gui_theme_free(struct theme_descriptor *descriptor)
Frees any unused theme descriptors.
int ro_gui_theme_get_style_element(struct theme_descriptor *descriptor, theme_style style, theme_element element)
Returns an interger element from the specified theme, or the current theme if the descriptor is NULL.
static void ro_gui_theme_get_available_in_dir(const char *directory)
Adds the themes in a directory to the global cache.
struct theme_descriptor * ro_gui_theme_find(const char *leafname)
Finds a theme from the cached values.
bool ro_gui_theme_get_throbber_data(struct theme_descriptor *descriptor, int *frames, int *width, int *height, bool *right, bool *redraw)
Returns details of the throbber as defined in a theme.
bool ro_gui_theme_apply(struct theme_descriptor *descriptor)
Applies the theme to all current windows and subsequent ones.
Interface to utility string handling.
int hotlist_background
background colour of hotlist toolbar
int browser_background
background colour of browser toolbar
char * leafname
theme leafname
int status_background
background colour of status window
int status_foreground
colour of status window text
unsigned int decompressed_size
decompressed sprite size
bool throbber_redraw
throbber requires forcible updating
struct theme_descriptor * next
next descriptor in the list
char author[64]
theme author
struct theme_descriptor * previous
previous descriptor in the list
unsigned int compressed_size
compressed sprite size
struct theme * theme
corresponding theme (must be opened)
bool throbber_right
throbber is on the right (left otherwise)
char * filename
theme filename
int throbber_width
width of the throbber
osspriteop_area * sprite_area
sprite area for theme
int throbber_frames
frames of animation for the throbber
int throbber_height
height of the throbber
int users
number of users for the theme
Option reading and saving interface.
#define nsoption_charp(OPTION)
Get the value of a string option.
void ro_convert_pixels_to_os_units(os_coord *pixels, os_mode mode)
Converts the supplied os_coord from pixels to OS units.
General RISC OS WIMP/OS library functions (interface).
Automated RISC OS WIMP event handling (interface).
A collection of grubby utilities for working with OSLib's wimp API.