summaryrefslogtreecommitdiff
path: root/riscos
diff options
context:
space:
mode:
Diffstat (limited to 'riscos')
-rw-r--r--riscos/hotlist.c270
1 files changed, 135 insertions, 135 deletions
diff --git a/riscos/hotlist.c b/riscos/hotlist.c
index 96297a62e..ef96d0db3 100644
--- a/riscos/hotlist.c
+++ b/riscos/hotlist.c
@@ -41,61 +41,61 @@
#define HOTLIST_LOAD_BUFFER 1024
struct hotlist_entry {
-
+
/** The next hotlist entry at this level, or NULL for no more
*/
struct hotlist_entry *next_entry;
-
+
/** The child hotlist entry (NULL for no children).
The children value must be set for this value to take effect.
*/
struct hotlist_entry *child_entry;
-
+
/** The number of children (-1 for non-folders, >=0 for folders)
*/
int children;
-
+
/** The title of the hotlist entry/folder
*/
char *title;
-
+
/** The URL of the hotlist entry (NULL for folders)
*/
char *url;
-
+
/** Whether this entry is expanded
*/
bool expanded;
-
+
/** Whether this entry is selected
*/
bool selected;
-
+
/** The content filetype (not for folders)
*/
int filetype;
-
+
/** The number of visits
*/
int visits;
-
+
/** Add/last visit dates
*/
time_t add_date;
time_t last_date;
-
+
/** Position on last reformat (relative to window origin)
*/
int x0;
int y0;
int width;
int height;
-
+
/** Cached values
*/
int collapsed_width;
int expanded_width;
-
+
/** The width of the various lines sub-text
*/
int widths[4];
@@ -217,7 +217,7 @@ void ro_gui_hotlist_init(void) {
if (!ro_gui_hotlist_load()) {
// return;
}
-
+
/* Get our sprite ids for faster plotting. This could be done in a
far more elegant manner, but it's late and my girlfriend will
kill me if I don't go to bed soon. Sorry.
@@ -249,7 +249,7 @@ void ro_gui_hotlist_init(void) {
warn_user("MiscError", error->errmess);
return;
}
-
+
/* Update our text icon
*/
text_icon.data.indirected_text.validation = null_text_string;
@@ -260,7 +260,7 @@ void ro_gui_hotlist_init(void) {
(wimp_COLOUR_VERY_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT);
sprite_icon.data.indirected_sprite.area = wimpspriteop_AREA;
sprite_icon.data.indirected_text.size = 12;
-
+
/* Create our window
*/
error = xwimp_create_window(&hotlist_window_definition, &hotlist_window);
@@ -273,7 +273,7 @@ void ro_gui_hotlist_init(void) {
/**
* Shows the hotlist window.
- */
+ */
void ro_gui_hotlist_show(void) {
os_error *error;
int screen_width, screen_height;
@@ -306,7 +306,7 @@ void ro_gui_hotlist_show(void) {
/* Get the current screen size
*/
ro_gui_screen_size(&screen_width, &screen_height);
-
+
/* Move to the centre
*/
dimension = state.visible.x1 - state.visible.x0;
@@ -349,7 +349,7 @@ bool ro_gui_hotlist_load(void) {
warn_user("HotlistLoadError", 0);
return false;
}
-
+
/* Get some memory to work with
*/
load_buf = malloc(HOTLIST_LOAD_BUFFER);
@@ -358,7 +358,7 @@ bool ro_gui_hotlist_load(void) {
fclose(fp);
return false;
}
-
+
/* Check for the opening <HTML> to vaguely validate our file
*/
if ((fgets(load_buf, HOTLIST_LOAD_BUFFER, fp) == NULL) ||
@@ -368,17 +368,17 @@ bool ro_gui_hotlist_load(void) {
fclose(fp);
return false;
}
-
+
/* Keep reading until we get to a <ul>
*/
while (!found && (fgets(load_buf, HOTLIST_LOAD_BUFFER, fp))) {
- if (strncmp("<ul>", load_buf, 4) == 0) found = true;
+ if (strncmp("<ul>", load_buf, 4) == 0) found = true;
}
-
+
/* Start our recursive load
*/
if (found) success = ro_gui_hotlist_load_entry(fp, &root);
-
+
/* Tell the user if we had any problems
*/
if (!success) {
@@ -394,7 +394,7 @@ bool ro_gui_hotlist_load(void) {
/* Create a folder
*/
netsurf = ro_gui_hotlist_create("NetSurf", NULL, 0, &root);
-
+
/* Add some content
*/
entry = ro_gui_hotlist_create("NetSurf homepage", "http://netsurf.sf.net",
@@ -403,20 +403,20 @@ bool ro_gui_hotlist_load(void) {
entry = ro_gui_hotlist_create("NetSurf test builds", "http://netsurf.strcprstskrzkrk.co.uk",
0xfaf, netsurf);
entry->add_date = (time_t)-1;
-
+
/* We succeeded
*/
return true;
}
}
-void ro_gui_hotlist_save(void) {
+void ro_gui_hotlist_save(void) {
FILE *fp;
/* Don't save if we didn't load
*/
if (!hotlist_window) return;
-
+
/* Ensure we have a directory to save to later.
*/
xosfile_create_dir("<Choices$Write>.WWW", 0);
@@ -429,11 +429,11 @@ void ro_gui_hotlist_save(void) {
warn_user("HotlistSaveError", 0);
return;
}
-
+
/* HTML header
*/
fprintf(fp, "<html>\n<head>\n<title>Hotlist</title>\n<body>\n");
-
+
/* Start our recursive save
*/
if (!ro_gui_hotlist_save_entry(fp, root.child_entry)) {
@@ -443,11 +443,11 @@ void ro_gui_hotlist_save(void) {
/* HTML footer
*/
fprintf(fp, "</body>\n</html>\n");
-
+
/* Close our file
*/
fclose(fp);
-
+
/* Set the filetype to HTML
*/
xosfile_set_type("<Choices$Write>.WWW.NetSurf.Hotlist", 0xfaf);
@@ -486,11 +486,11 @@ bool ro_gui_hotlist_save_entry(FILE *fp, struct hotlist_entry *entry) {
}
entry = entry->next_entry;
}
-
+
/* We're starting a new child
*/
- fprintf(fp, "</ul>\n");
- return true;
+ fprintf(fp, "</ul>\n");
+ return true;
}
bool ro_gui_hotlist_load_entry(FILE *fp, struct hotlist_entry *entry) {
@@ -510,7 +510,7 @@ bool ro_gui_hotlist_load_entry(FILE *fp, struct hotlist_entry *entry) {
/* Keep reading until we get to a <ul>
*/
while (fgets(load_buf, HOTLIST_LOAD_BUFFER, fp)) {
-
+
/* Check if we should commit what we have
*/
if ((strncmp("<li>", load_buf, 4) == 0) ||
@@ -526,7 +526,7 @@ bool ro_gui_hotlist_load_entry(FILE *fp, struct hotlist_entry *entry) {
last_entry->visits = visits;
last_entry->filetype = filetype;
}
-
+
/* Reset for the next entry
*/
free(title);
@@ -541,17 +541,17 @@ bool ro_gui_hotlist_load_entry(FILE *fp, struct hotlist_entry *entry) {
filetype = 0;
}
}
-
+
/* Check if we've reached the end of our run
*/
if (strncmp("</ul>", load_buf, 5) == 0) return true;
-
+
/* Check for some data
*/
if (strncmp("<!-- ", load_buf, 5) == 0) {
val_length = strlen(load_buf) - 5 - 4;
load_buf[val_length + 5] = '\0';
-
+
if (strncmp("Title:", load_buf + 5, 6) == 0) {
if (title) free(title);
title = malloc(val_length);
@@ -574,14 +574,14 @@ bool ro_gui_hotlist_load_entry(FILE *fp, struct hotlist_entry *entry) {
}
/* Check if we are starting a child
- */
+ */
if (strncmp("<ul>", load_buf, 4) == 0) {
if (!ro_gui_hotlist_load_entry(fp, last_entry)) {
return false;
}
}
}
- return true;
+ return true;
}
/**
@@ -589,7 +589,7 @@ bool ro_gui_hotlist_load_entry(FILE *fp, struct hotlist_entry *entry) {
*
* \param title the entry title
* \param content the content to add
- */
+ */
void ro_gui_hotlist_add(char *title, struct content *content) {
ro_gui_hotlist_create(title, content->url, ro_content_filetype(content), &root);
}
@@ -602,7 +602,7 @@ void ro_gui_hotlist_add(char *title, struct content *content) {
*/
void hotlist_visited(struct content *content) {
if ((!content) || (!content->url)) return;
- ro_gui_hotlist_visited_update(content, root.child_entry);
+ ro_gui_hotlist_visited_update(content, root.child_entry);
}
@@ -615,7 +615,7 @@ void hotlist_visited(struct content *content) {
void ro_gui_hotlist_visited_update(struct content *content, struct hotlist_entry *entry) {
char *url;
bool full = false;
-
+
/* Update the hotlist
*/
url = content->url;
@@ -625,16 +625,16 @@ void ro_gui_hotlist_visited_update(struct content *content, struct hotlist_entry
/* Check if we're going to need a full redraw downwards
*/
full = ((entry->visits == 0) || (entry->last_date == -1));
-
+
/* Update our values
*/
entry->visits++;
entry->last_date = time(NULL);
-
+
/* Update the entry width (extreme case - never likely to happen)
*/
ro_gui_hotlist_update_entry_size(entry);
-
+
/* Redraw the least we can get away with
*/
if (entry->expanded) {
@@ -652,7 +652,7 @@ void ro_gui_hotlist_visited_update(struct content *content, struct hotlist_entry
}
}
if (entry->child_entry) {
- ro_gui_hotlist_visited_update(content, entry->child_entry);
+ ro_gui_hotlist_visited_update(content, entry->child_entry);
}
entry = entry->next_entry;
}
@@ -665,11 +665,11 @@ void ro_gui_hotlist_visited_update(struct content *content, struct hotlist_entry
* \param title the entry title
* \param url the entry url (NULL to create a folder)
* \param folder the folder to add the entry into
- */
+ */
struct hotlist_entry *ro_gui_hotlist_create(const char *title, const char *url,
int filetype, struct hotlist_entry *folder) {
struct hotlist_entry *entry;
-
+
/* Check we have a title or a URL
*/
if (!title && !url) return NULL;
@@ -681,7 +681,7 @@ struct hotlist_entry *ro_gui_hotlist_create(const char *title, const char *url,
warn_user("NoMemory", 0);
return NULL;
}
-
+
/* And enough for the url/title
*/
if (url) {
@@ -689,7 +689,7 @@ struct hotlist_entry *ro_gui_hotlist_create(const char *title, const char *url,
if (!entry->url) {
warn_user("NoMemory", 0);
free(entry);
- return NULL;
+ return NULL;
}
strcpy(entry->url, url);
}
@@ -702,43 +702,43 @@ struct hotlist_entry *ro_gui_hotlist_create(const char *title, const char *url,
warn_user("NoMemory", 0);
free(entry->url);
free(entry);
- return NULL;
+ return NULL;
}
strcpy(entry->title, title);
} else {
- entry->title = entry->url;
+ entry->title = entry->url;
}
-
+
/* Set the children count
*/
if (url) {
- entry->children = -1;
+ entry->children = -1;
} else {
entry->children = 0;
}
-
+
/* Set the filetype
*/
entry->filetype = filetype;
-
+
/* Set the default values
*/
entry->visits = 0;
-
+
/* Get our dates
*/
entry->add_date = time(NULL);
entry->last_date = (time_t)-1;
-
+
/* Set the expanded/selected state
*/
entry->expanded = false;
entry->selected = false;
-
+
/* Set the width
*/
ro_gui_hotlist_update_entry_size(entry);
-
+
/* Link in as the last entry in root
*/
ro_gui_hotlist_link_entry(folder, entry);
@@ -751,16 +751,16 @@ struct hotlist_entry *ro_gui_hotlist_create(const char *title, const char *url,
*
* \param parent the parent entry to link under
* \param entry the entry to link
- */
+ */
void ro_gui_hotlist_link_entry(struct hotlist_entry *parent, struct hotlist_entry *entry) {
struct hotlist_entry *link_entry;
if (!parent || !entry) return;
-
+
/* Ensure the parent is a folder
*/
if (parent->children == -1) return;
-
+
/* Get the first child entry
*/
link_entry = parent->child_entry;
@@ -770,7 +770,7 @@ void ro_gui_hotlist_link_entry(struct hotlist_entry *parent, struct hotlist_entr
while (link_entry->next_entry) link_entry = link_entry->next_entry;
link_entry->next_entry = entry;
}
-
+
/* Increment the number of children
*/
parent->children += 1;
@@ -789,15 +789,15 @@ void ro_gui_hotlist_update_entry_size(struct hotlist_entry *entry) {
int width;
int max_width;
int line_number = 0;
-
+
/* Get the width of the title
- */
+ */
xwimptextop_string_width(entry->title,
strlen(entry->title) > 256 ? 256 : strlen(entry->title),
&width);
entry->collapsed_width = width;
max_width = width;
-
+
/* Get the width of the URL
*/
if (entry->url) {
@@ -815,19 +815,19 @@ void ro_gui_hotlist_update_entry_size(struct hotlist_entry *entry) {
if (width > max_width) max_width = width;
entry->widths[line_number++] = width;
}
-
+
/* Get the width of the add date
*/
if (entry->add_date != -1) {
snprintf(extended_text, HOTLIST_TEXT_BUFFER,
- messages_get("HotlistAdd"), ctime(&entry->add_date));
+ messages_get("HotlistAdded"), ctime(&entry->add_date));
xwimptextop_string_width(extended_text,
strlen(extended_text) > 256 ? 256 : strlen(extended_text),
&width);
if (width > max_width) max_width = width;
entry->widths[line_number++] = width;
}
-
+
/* Get the width of the last visit
*/
if (entry->last_date != -1) {
@@ -839,7 +839,7 @@ void ro_gui_hotlist_update_entry_size(struct hotlist_entry *entry) {
if (width > max_width) max_width = width;
entry->widths[line_number++] = width;
}
-
+
/* Get the width of the visit count
*/
if (entry->visits > 0) {
@@ -851,7 +851,7 @@ void ro_gui_hotlist_update_entry_size(struct hotlist_entry *entry) {
if (width > max_width) max_width = width;
entry->widths[line_number++] = width;
}
-
+
/* Increase the text width by the borders
*/
entry->expanded_width = max_width + HOTLIST_LEAF_INSET + HOTLIST_ICON_WIDTH + HOTLIST_TEXT_PADDING;
@@ -862,7 +862,7 @@ void ro_gui_hotlist_update_entry_size(struct hotlist_entry *entry) {
/**
* Redraws a section of the hotlist window
- *
+ *
* \param redraw the area to redraw
*/
void ro_gui_hotlist_redraw(wimp_draw *redraw) {
@@ -870,12 +870,12 @@ void ro_gui_hotlist_redraw(wimp_draw *redraw) {
osbool more;
unsigned int size;
os_box extent = {0, 0, 0, 0};;
-
+
/* Reset our min/max sizes
*/
max_width = 0;
max_height = 0;
-
+
/* Get a pixel translation table for the sprites. We only
get one for all the sprites, so they must all have the
same characteristics.
@@ -884,7 +884,7 @@ void ro_gui_hotlist_redraw(wimp_draw *redraw) {
colourtrans_CURRENT_MODE, colourtrans_CURRENT_PALETTE,
0, colourtrans_GIVEN_SPRITE, 0, 0, &size);
pixel_table = malloc(size);
- if (pixel_table) {
+ if (pixel_table) {
xcolourtrans_generate_table_for_sprite(gui_sprites, sprite[HOTLIST_EXPAND],
colourtrans_CURRENT_MODE, colourtrans_CURRENT_PALETTE,
pixel_table, colourtrans_GIVEN_SPRITE, 0, 0, 0);
@@ -906,12 +906,12 @@ void ro_gui_hotlist_redraw(wimp_draw *redraw) {
origin_x + 8, origin_y - 4);
more = wimp_get_rectangle(redraw);
}
-
+
/* Free our memory
*/
if (pixel_table) free(pixel_table);
pixel_table = NULL;
-
+
/* Check if we should reformat
*/
if (reformat_pending) {
@@ -944,13 +944,13 @@ int ro_gui_hotlist_redraw_tree(struct hotlist_entry *entry, int level, int x0, i
int cumulative = 0;
int height = 0;
int box_y0;
-
+
if (!entry) return 0;
-
+
/* Repeatedly draw our entries
*/
while (entry) {
-
+
/* Redraw the item
*/
height = ro_gui_hotlist_redraw_item(entry, level, x0 + HOTLIST_LEAF_INSET, y0);
@@ -993,7 +993,7 @@ int ro_gui_hotlist_redraw_tree(struct hotlist_entry *entry, int level, int x0, i
y0 -= HOTLIST_LINE_HEIGHT;
height -= HOTLIST_LINE_HEIGHT;
}
-
+
/* Draw the rest of the lines
*/
while (height > 0) {
@@ -1005,7 +1005,7 @@ int ro_gui_hotlist_redraw_tree(struct hotlist_entry *entry, int level, int x0, i
y0 -= HOTLIST_LINE_HEIGHT;
height -= HOTLIST_LINE_HEIGHT;
}
-
+
} else {
/* Draw a half-line for the last entry
*/
@@ -1034,17 +1034,17 @@ int ro_gui_hotlist_redraw_tree(struct hotlist_entry *entry, int level, int x0, i
gui_sprites, sprite[HOTLIST_COLLAPSE],
x0, box_y0 - 31,
osspriteop_USE_MASK | osspriteop_USE_PALETTE,
- 0, pixel_table);
+ 0, pixel_table);
} else {
xosspriteop_put_sprite_scaled(osspriteop_PTR,
gui_sprites, sprite[HOTLIST_EXPAND],
x0, box_y0 - 31,
osspriteop_USE_MASK | osspriteop_USE_PALETTE,
0, pixel_table);
-
-
+
+
}
-
+
}
/* Move to the next entry
@@ -1052,7 +1052,7 @@ int ro_gui_hotlist_redraw_tree(struct hotlist_entry *entry, int level, int x0, i
entry = entry->next_entry;
first = false;
}
-
+
/* Return our height
*/
return cumulative;
@@ -1072,7 +1072,7 @@ int ro_gui_hotlist_redraw_item(struct hotlist_entry *entry, int level, int x0, i
int height = HOTLIST_LINE_HEIGHT;
int line_y0;
int line_height;
-
+
/* Set the correct height
*/
if ((entry->children == -1) && (entry->expanded)) {
@@ -1081,13 +1081,13 @@ int ro_gui_hotlist_redraw_item(struct hotlist_entry *entry, int level, int x0, i
if (entry->add_date != -1) height += HOTLIST_LINE_HEIGHT;
if (entry->last_date != -1) height += HOTLIST_LINE_HEIGHT;
}
-
+
/* Check whether we need to redraw
*/
if ((x0 < clip_x1) && (y0 > clip_y0) && ((x0 + entry->width) > clip_x0) &&
((y0 - height) < clip_y1)) {
-
-
+
+
/* Update the selection state
*/
text_icon.flags = wimp_ICON_TEXT | (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) |
@@ -1113,7 +1113,7 @@ int ro_gui_hotlist_redraw_item(struct hotlist_entry *entry, int level, int x0, i
/* Check it exists (pre-OS3.5)
*/
if (xwimpspriteop_read_sprite_info(icon_name, 0, 0, 0, 0)) {
- sprintf(icon_name, "small_dir");
+ sprintf(icon_name, "small_dir");
}
} else {
sprintf(icon_name, "small_dir");
@@ -1122,11 +1122,11 @@ int ro_gui_hotlist_redraw_item(struct hotlist_entry *entry, int level, int x0, i
/* Get the icon sprite
*/
sprintf(icon_name, "small_%x", entry->filetype);
-
+
/* Check it exists
*/
if (xwimpspriteop_read_sprite_info(icon_name, 0, 0, 0, 0)) {
- sprintf(icon_name, "small_xxx");
+ sprintf(icon_name, "small_xxx");
}
}
xwimp_plot_icon(&sprite_icon);
@@ -1153,7 +1153,7 @@ int ro_gui_hotlist_redraw_item(struct hotlist_entry *entry, int level, int x0, i
wimp_ICON_INDIRECTED | wimp_ICON_VCENTRED;
text_icon.extent.y0 = y0 - origin_y - HOTLIST_LINE_HEIGHT;
text_icon.extent.y1 = y0 - origin_y;
-
+
/* Draw the lines
*/
y0 -= HOTLIST_LINE_HEIGHT;
@@ -1172,13 +1172,13 @@ int ro_gui_hotlist_redraw_item(struct hotlist_entry *entry, int level, int x0, i
x0 + 16, line_y0 - HOTLIST_LINE_HEIGHT,
osspriteop_USE_MASK | osspriteop_USE_PALETTE,
0, pixel_table);
-
+
}
xosspriteop_put_sprite_scaled(osspriteop_PTR,
gui_sprites, sprite[HOTLIST_ENTRY],
x0 + 8, line_y0 - 29,
osspriteop_USE_MASK | osspriteop_USE_PALETTE,
- 0, pixel_table);
+ 0, pixel_table);
line_height -= HOTLIST_LINE_HEIGHT;
line_y0 -= HOTLIST_LINE_HEIGHT;
}
@@ -1203,12 +1203,12 @@ int ro_gui_hotlist_redraw_item(struct hotlist_entry *entry, int level, int x0, i
text_icon.extent.y1 -= HOTLIST_LINE_HEIGHT;
xwimp_plot_icon(&text_icon);
}
-
+
/* Plot the date added text
*/
if (entry->add_date != -1) {
snprintf(extended_text, HOTLIST_TEXT_BUFFER,
- messages_get("HotlistAdd"), ctime(&entry->add_date));
+ messages_get("HotlistAdded"), ctime(&entry->add_date));
text_icon.extent.y0 -= HOTLIST_LINE_HEIGHT;
text_icon.extent.y1 -= HOTLIST_LINE_HEIGHT;
xwimp_plot_icon(&text_icon);
@@ -1223,7 +1223,7 @@ int ro_gui_hotlist_redraw_item(struct hotlist_entry *entry, int level, int x0, i
text_icon.extent.y1 -= HOTLIST_LINE_HEIGHT;
xwimp_plot_icon(&text_icon);
}
-
+
/* Plot the visit count text
*/
if (entry->visits > 0) {
@@ -1277,7 +1277,7 @@ void ro_gui_hotlist_click(wimp_pointer *pointer) {
*/
x = (pointer->pos.x - (state.visible.x0 - state.xscroll));
y = (pointer->pos.y - (state.visible.y1 - state.yscroll));
-
+
/* We want the caret on a click
*/
error = xwimp_get_caret_position(&caret);
@@ -1295,7 +1295,7 @@ void ro_gui_hotlist_click(wimp_pointer *pointer) {
error->errnum, error->errmess));
}
}
-
+
/* Find our entry
*/
entry = ro_gui_hotlist_find_entry(x, y, root.child_entry);
@@ -1317,7 +1317,7 @@ void ro_gui_hotlist_click(wimp_pointer *pointer) {
0, -16384, 16384,
entry->y0 + entry->height);
} else if (x_offset >= HOTLIST_LEAF_INSET) {
-
+
/* We treat a menu click as a Select click if we have no selections
*/
if (buttons == wimp_CLICK_MENU) {
@@ -1326,7 +1326,7 @@ void ro_gui_hotlist_click(wimp_pointer *pointer) {
buttons = (wimp_CLICK_SELECT << 8);
}
}
-
+
/* Check for selection
*/
if (buttons == (wimp_CLICK_SELECT << 8)) {
@@ -1337,17 +1337,17 @@ void ro_gui_hotlist_click(wimp_pointer *pointer) {
xwimp_force_redraw(hotlist_window,
entry->x0, entry->y0 + entry->height - HOTLIST_LINE_HEIGHT,
entry->x0 + entry->width,
- entry->y0 + entry->height);
+ entry->y0 + entry->height);
}
} else if (buttons == (wimp_CLICK_ADJUST << 8)) {
entry->selected = !entry->selected;
xwimp_force_redraw(hotlist_window,
entry->x0, entry->y0 + entry->height - HOTLIST_LINE_HEIGHT,
entry->x0 + entry->width,
- entry->y0 + entry->height);
-
+ entry->y0 + entry->height);
+
}
-
+
/* Check if we should open the URL
*/
if (((buttons == wimp_DOUBLE_SELECT) || (buttons == wimp_DOUBLE_ADJUST)) &&
@@ -1367,11 +1367,11 @@ void ro_gui_hotlist_click(wimp_pointer *pointer) {
} else {
no_entry = true;
}
-
+
/* Get the original button state back
*/
buttons = pointer->buttons;
-
+
/* Create a menu if we should
*/
if (buttons == wimp_CLICK_MENU) {
@@ -1389,12 +1389,12 @@ void ro_gui_hotlist_click(wimp_pointer *pointer) {
ro_gui_hotlist_selection_state(root.child_entry,
false, true);
}
-
+
/* Handle the start of a drag
*/
- if (buttons == (wimp_CLICK_SELECT << 4) ||
+ if (buttons == (wimp_CLICK_SELECT << 4) ||
buttons == (wimp_CLICK_ADJUST << 4)) {
-
+
/* Clear the current selection
*/
if (buttons == (wimp_CLICK_SELECT << 4)) {
@@ -1434,7 +1434,7 @@ struct hotlist_entry *ro_gui_hotlist_find_entry(int x, int y, struct hotlist_ent
struct hotlist_entry *find_entry;
int inset_x = 0;
int inset_y = 0;
-
+
/* Check we have an entry (only applies if we have an empty hotlist)
*/
if (!entry) return NULL;
@@ -1453,19 +1453,19 @@ struct hotlist_entry *ro_gui_hotlist_find_entry(int x, int y, struct hotlist_ent
if (x < (entry->x0 + entry->collapsed_width)) return entry;
return NULL;
}
-
+
/* No other entry can occupy the left edge
*/
inset_x = x - entry->x0 - HOTLIST_LEAF_INSET - HOTLIST_ICON_WIDTH;
if (inset_x < 0) return NULL;
-
+
/* Check the right edge against our various widths
*/
inset_y = -((y - entry->y0 - entry->height) / HOTLIST_LINE_HEIGHT);
if (inset_x < (entry->widths[inset_y - 1] + HOTLIST_TEXT_PADDING)) return entry;
- return NULL;
+ return NULL;
}
-
+
/* Continue onwards
*/
if ((entry->child_entry) && (entry->expanded)) {
@@ -1503,7 +1503,7 @@ int ro_gui_hotlist_selection_state(struct hotlist_entry *entry, bool selected, b
*/
entry->selected = selected;
changes++;
-
+
/* Redraw the entrys first line
*/
if (redraw) {
@@ -1599,7 +1599,7 @@ void ro_gui_hotlist_update_expansion(struct hotlist_entry *entry, bool only_sele
*/
if ((entry->selected) || (!only_selected)) {
current = entry->expanded;
-
+
/* Only update what we should
*/
if (((links) && (entry->children != -1)) || ((folders) && (entry->children > 0))) {
@@ -1613,14 +1613,14 @@ void ro_gui_hotlist_update_expansion(struct hotlist_entry *entry, bool only_sele
entry->expanded = !entry->expanded;
}
}
-
+
/* If we have contracted then we de-select and collapse any children
*/
if (entry->child_entry && !entry->expanded) {
ro_gui_hotlist_update_expansion(entry->child_entry, false, true, true, false, true);
ro_gui_hotlist_selection_state(entry->child_entry, false, false);
}
-
+
/* Redraw the entrys first line
*/
if (current != entry->expanded) {
@@ -1673,7 +1673,7 @@ void ro_gui_hotlist_selection_drag(struct hotlist_entry *entry,
(x0 < (entry->x0 + entry->width)) &&
(y1 < (entry->y0 + entry->height))) {
do_update = false;
-
+
/* Check the exact area of the title line
*/
if ((x1 > (entry->x0 + HOTLIST_LEAF_INSET)) &&
@@ -1721,7 +1721,7 @@ void ro_gui_hotlist_selection_drag(struct hotlist_entry *entry,
}
}
}
-
+
/* Continue onwards
*/
if ((entry->child_entry) && (entry->expanded)) {
@@ -1742,19 +1742,19 @@ void ro_gui_hotlist_selection_drag(struct hotlist_entry *entry,
void ro_gui_hotlist_selection_drag_end(wimp_dragged *drag) {
wimp_window_state state;
int x0, y0, x1, y1;
-
+
/* Get the window state to make everything relative
*/
state.w = hotlist_window;
wimp_get_window_state(&state);
-
+
/* Create the relative positions
*/
x0 = drag->final.x0 - state.visible.x0 - state.xscroll;
x1 = drag->final.x1 - state.visible.x0 - state.xscroll;
y0 = drag->final.y0 - state.visible.y1 - state.yscroll;
y1 = drag->final.y1 - state.visible.y1 - state.yscroll;
-
+
/* Make sure x0 < x1 and y0 > y1
*/
if (x0 > x1) {
@@ -1767,7 +1767,7 @@ void ro_gui_hotlist_selection_drag_end(wimp_dragged *drag) {
y1 ^= y0;
y0 ^= y1;
}
-
+
/* Update the selection state
*/
if (drag_buttons == (wimp_CLICK_SELECT << 4)) {
@@ -1784,7 +1784,7 @@ void ro_gui_hotlist_selection_drag_end(wimp_dragged *drag) {
* \param drag the final drag co-ordinates
*/
void ro_gui_hotlist_move_drag_end(wimp_dragged *drag) {
-
+
}
@@ -1796,7 +1796,7 @@ void ro_gui_hotlist_menu_closed(void) {
ro_gui_hotlist_selection_state(root.child_entry, false, true);
menu_selection = false;
}
-}
+}
/**
* Handle a keypress
@@ -1861,7 +1861,7 @@ bool ro_gui_hotlist_keypress(int key) {
break;
}
xwimp_open_window((wimp_open *) &state);
- return true;
+ return true;
}