mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-28 14:59:41 +03:00
Use new UTF-8 status bar. Use top-window dimensions for new windows from framesets.
svn path=/trunk/netsurf/; revision=3082
This commit is contained in:
parent
b057bdc2aa
commit
ebdaeed557
3
makefile
3
makefile
@ -47,6 +47,7 @@ OBJECTS_RISCOS += 401login.o artworks.o assert.o awrender.o bitmap.o \
|
||||
OBJECTS_RISCOS += con_cache.o con_connect.o con_content.o con_fonts.o \
|
||||
con_home.o con_image.o con_inter.o con_language.o con_memory.o \
|
||||
con_secure.o con_theme.o # riscos/configure/
|
||||
OBJECTS_RISCOS += progress_bar.o status_bar.o # riscos/gui/
|
||||
# OBJECTS_RISCOS += memdebug.o
|
||||
|
||||
OBJECTS_RISCOS_SMALL = $(OBJECTS_RISCOS)
|
||||
@ -111,7 +112,7 @@ else
|
||||
include posix.mk
|
||||
endif
|
||||
|
||||
VPATH = content:css:desktop:image:render:riscos:riscos/configure:utils:debug:gtk
|
||||
VPATH = content:css:desktop:image:render:riscos:riscos/configure:riscos/gui:utils:debug:gtk
|
||||
|
||||
WARNFLAGS = -W -Wall -Wundef -Wpointer-arith -Wcast-qual \
|
||||
-Wcast-align -Wwrite-strings -Wstrict-prototypes \
|
||||
|
@ -29,6 +29,7 @@ extern int os_version;
|
||||
extern const char * NETSURF_DIR;
|
||||
|
||||
struct toolbar;
|
||||
struct status_bar;
|
||||
struct plotter_table;
|
||||
struct gui_window;
|
||||
struct tree;
|
||||
@ -75,6 +76,7 @@ struct gui_window {
|
||||
struct browser_window *bw;
|
||||
|
||||
struct toolbar *toolbar; /**< Toolbar, or 0 if not present. */
|
||||
struct status_bar *status_bar; /**< Status bar, or 0 if not present. */
|
||||
|
||||
wimp_w window; /**< RISC OS window handle. */
|
||||
|
||||
@ -139,11 +141,9 @@ void ro_gui_window_quit(void);
|
||||
void ro_gui_window_update_theme(void);
|
||||
void ro_gui_window_mouse_at(struct gui_window *g, wimp_pointer *pointer);
|
||||
bool ro_gui_toolbar_click(wimp_pointer *pointer);
|
||||
bool ro_gui_status_click(wimp_pointer *pointer);
|
||||
void ro_gui_throb(void);
|
||||
struct gui_window *ro_gui_window_lookup(wimp_w window);
|
||||
struct gui_window *ro_gui_toolbar_lookup(wimp_w window);
|
||||
struct gui_window *ro_gui_status_lookup(wimp_w window);
|
||||
void ro_gui_scroll_request(wimp_scroll *scroll);
|
||||
bool ro_gui_window_to_window_pos(struct gui_window *g, int x, int y, os_coord *pos);
|
||||
bool ro_gui_window_to_screen_pos(struct gui_window *g, int x, int y, os_coord *pos);
|
||||
|
@ -23,8 +23,8 @@ wimp_w ro_gui_status_bar_get_window(struct status_bar *sb);
|
||||
unsigned int ro_gui_status_bar_get_width(struct status_bar *sb);
|
||||
void ro_gui_status_bar_resize(struct status_bar *sb);
|
||||
void ro_gui_status_bar_set_visible(struct status_bar *pb, bool visible);
|
||||
bool ro_gui_status_bar_get_visible(struct status_bar *pb);
|
||||
void ro_gui_status_bar_set_text(struct status_bar *pb, const char *text);
|
||||
bool ro_gui_status_bar_get_visible(struct status_bar *sb);
|
||||
void ro_gui_status_bar_set_text(struct status_bar *sb, const char *text);
|
||||
void ro_gui_status_bar_set_progress_value(struct status_bar *sb,
|
||||
unsigned int value);
|
||||
void ro_gui_status_bar_set_progress_range(struct status_bar *sb,
|
||||
|
@ -209,8 +209,7 @@ void ro_gui_menu_init(void)
|
||||
{ "View.Toolbars", NO_ACTION, 0 },
|
||||
{ "View.Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
|
||||
{ "View.Toolbars.ToolAddress", TOOLBAR_ADDRESS_BAR, 0 },
|
||||
{ "View.Toolbars.ToolThrob", TOOLBAR_THROBBER, 0 },
|
||||
{ "_View.Toolbars.ToolStatus", TOOLBAR_STATUS_BAR, 0 },
|
||||
{ "_View.Toolbars.ToolThrob", TOOLBAR_THROBBER, 0 },
|
||||
{ "View.Toolbars.EditToolbar", TOOLBAR_EDIT, 0 },
|
||||
{ "_View.Render", NO_ACTION, 0 },
|
||||
{ "View.Render.RenderAnims", BROWSER_BUFFER_ANIMS, 0 },
|
||||
@ -340,13 +339,12 @@ void ro_gui_menu_init(void)
|
||||
(struct ns_menu *)&images_definition);
|
||||
|
||||
/* browser toolbar menu */
|
||||
NS_MENU(7) browser_toolbar_definition = {
|
||||
NS_MENU(6) browser_toolbar_definition = {
|
||||
"Toolbar", {
|
||||
{ "Toolbars", NO_ACTION, 0 },
|
||||
{ "Toolbars.ToolButtons", TOOLBAR_BUTTONS, 0 },
|
||||
{ "Toolbars.ToolAddress", TOOLBAR_ADDRESS_BAR, 0 },
|
||||
{ "Toolbars.ToolThrob", TOOLBAR_THROBBER, 0 },
|
||||
{ "Toolbars.ToolStatus", TOOLBAR_STATUS_BAR, 0 },
|
||||
{ "EditToolbar", TOOLBAR_EDIT, 0 },
|
||||
{NULL, 0, 0}
|
||||
}
|
||||
@ -1724,11 +1722,6 @@ bool ro_gui_menu_handle_action(wimp_w owner, menu_action action,
|
||||
t->display_throbber = !t->display_throbber;
|
||||
ro_gui_menu_refresh_toolbar(t);
|
||||
return true;
|
||||
case TOOLBAR_STATUS_BAR:
|
||||
assert(t);
|
||||
t->display_status = !t->display_status;
|
||||
ro_gui_menu_refresh_toolbar(t);
|
||||
return true;
|
||||
case TOOLBAR_EDIT:
|
||||
assert(t);
|
||||
ro_gui_theme_toggle_edit(t);
|
||||
@ -2194,12 +2187,6 @@ void ro_gui_menu_prepare_action(wimp_w owner, menu_action action,
|
||||
ro_gui_menu_set_entry_ticked(current_menu, action,
|
||||
(t && t->display_throbber));
|
||||
break;
|
||||
case TOOLBAR_STATUS_BAR:
|
||||
ro_gui_menu_set_entry_shaded(current_menu,
|
||||
action, !t);
|
||||
ro_gui_menu_set_entry_ticked(current_menu, action,
|
||||
(t && t->display_status));
|
||||
break;
|
||||
case TOOLBAR_EDIT:
|
||||
ro_gui_menu_set_entry_shaded(current_menu,
|
||||
action, !t);
|
||||
|
@ -115,7 +115,6 @@ typedef enum {
|
||||
TOOLBAR_BUTTONS,
|
||||
TOOLBAR_ADDRESS_BAR,
|
||||
TOOLBAR_THROBBER,
|
||||
TOOLBAR_STATUS_BAR,
|
||||
TOOLBAR_EDIT,
|
||||
|
||||
/* misc actions */
|
||||
|
@ -24,7 +24,6 @@ extern int option_fg_plot_style; /* tinct flagword */
|
||||
extern int option_bg_plot_style; /* tinct flagword */
|
||||
extern bool option_history_tooltip;
|
||||
extern int option_scale;
|
||||
extern bool option_toolbar_show_status;
|
||||
extern bool option_toolbar_show_buttons;
|
||||
extern bool option_toolbar_show_address;
|
||||
extern bool option_toolbar_show_throbber;
|
||||
@ -63,7 +62,6 @@ int option_fg_plot_style = tinct_ERROR_DIFFUSE;\
|
||||
int option_bg_plot_style = tinct_DITHER;\
|
||||
bool option_history_tooltip = true; \
|
||||
int option_scale = 100; \
|
||||
bool option_toolbar_show_status = true; \
|
||||
bool option_toolbar_show_buttons = true; \
|
||||
bool option_toolbar_show_address = true; \
|
||||
bool option_toolbar_show_throbber = true; \
|
||||
@ -102,7 +100,6 @@ bool option_thumbnail_iconise = true;
|
||||
{ "plot_bg_quality", OPTION_INTEGER, &option_bg_plot_style },\
|
||||
{ "history_tooltip", OPTION_BOOL, &option_history_tooltip }, \
|
||||
{ "scale", OPTION_INTEGER, &option_scale }, \
|
||||
{ "toolbar_show_status", OPTION_BOOL, &option_toolbar_show_status }, \
|
||||
{ "toolbar_status_size", OPTION_INTEGER, &option_toolbar_status_width }, \
|
||||
{ "toolbar_show_buttons", OPTION_BOOL, &option_toolbar_show_buttons }, \
|
||||
{ "toolbar_show_address", OPTION_BOOL, &option_toolbar_show_address }, \
|
||||
|
243
riscos/theme.c
243
riscos/theme.c
@ -39,7 +39,6 @@
|
||||
|
||||
#define THEME_URL_MEMORY 256
|
||||
#define THEME_THROBBER_MEMORY 12
|
||||
#define THEME_STATUS_MEMORY 256
|
||||
|
||||
static struct theme_descriptor *theme_current = NULL;
|
||||
static struct theme_descriptor *theme_descriptors = NULL;
|
||||
@ -78,8 +77,6 @@ static void ro_gui_theme_add_toolbar_icons(struct toolbar *toolbar,
|
||||
const char* icons[], const char* ident);
|
||||
static void ro_gui_theme_set_help_prefix(struct toolbar *toolbar);
|
||||
|
||||
static void ro_gui_theme_status_open(wimp_open *open);
|
||||
|
||||
/* A basic window for the toolbar and status
|
||||
*/
|
||||
static wimp_window theme_toolbar_window = {
|
||||
@ -87,7 +84,7 @@ static wimp_window theme_toolbar_window = {
|
||||
0,
|
||||
0,
|
||||
wimp_TOP,
|
||||
wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_MOVEABLE |
|
||||
wimp_WINDOW_NEW_FORMAT | wimp_WINDOW_MOVEABLE | wimp_WINDOW_NO_BOUNDS |
|
||||
wimp_WINDOW_FURNITURE_WINDOW |
|
||||
wimp_WINDOW_IGNORE_XEXTENT | wimp_WINDOW_IGNORE_YEXTENT,
|
||||
wimp_COLOUR_BLACK,
|
||||
@ -98,11 +95,11 @@ static wimp_window theme_toolbar_window = {
|
||||
wimp_COLOUR_MID_LIGHT_GREY,
|
||||
wimp_COLOUR_CREAM,
|
||||
wimp_WINDOW_NEVER3D | 0x16u /* RISC OS 5.03+ */,
|
||||
{0, 0, 1, 1},
|
||||
{0, 0, 16384, 16384},
|
||||
0,
|
||||
0,
|
||||
wimpspriteop_AREA,
|
||||
12,
|
||||
1,
|
||||
1,
|
||||
{""},
|
||||
0,
|
||||
@ -113,7 +110,6 @@ static wimp_window theme_toolbar_window = {
|
||||
/* Shared icon validation
|
||||
*/
|
||||
static char theme_url_validation[] = "Pptr_write;KN\0";
|
||||
static char theme_resize_validation[] = "R1;Pptr_lr,8,6\0";
|
||||
static char theme_null_text_string[] = "\0";
|
||||
static char theme_separator_name[] = "separator\0";
|
||||
static char theme_favicon_sprite[12];
|
||||
@ -768,7 +764,6 @@ struct toolbar *ro_gui_theme_create_toolbar(struct theme_descriptor *descriptor,
|
||||
case THEME_BROWSER_TOOLBAR:
|
||||
toolbar->display_url = true;
|
||||
toolbar->display_throbber = true;
|
||||
toolbar->display_status = true;
|
||||
ro_gui_theme_add_toolbar_icons(toolbar,
|
||||
theme_browser_icons,
|
||||
option_toolbar_browser);
|
||||
@ -817,7 +812,7 @@ struct toolbar *ro_gui_theme_create_toolbar(struct theme_descriptor *descriptor,
|
||||
*/
|
||||
if (type == THEME_BROWSER_TOOLBAR) {
|
||||
toolbar->url_buffer = calloc(1, THEME_URL_MEMORY +
|
||||
THEME_THROBBER_MEMORY + THEME_STATUS_MEMORY);
|
||||
THEME_THROBBER_MEMORY);
|
||||
if (!toolbar->url_buffer) {
|
||||
LOG(("No memory for calloc()"));
|
||||
ro_gui_theme_destroy_toolbar(toolbar);
|
||||
@ -825,8 +820,6 @@ struct toolbar *ro_gui_theme_create_toolbar(struct theme_descriptor *descriptor,
|
||||
}
|
||||
toolbar->throbber_buffer = toolbar->url_buffer +
|
||||
THEME_URL_MEMORY;
|
||||
toolbar->status_buffer = toolbar->throbber_buffer +
|
||||
THEME_THROBBER_MEMORY;
|
||||
sprintf(toolbar->throbber_buffer, "throbber0");
|
||||
}
|
||||
|
||||
@ -899,12 +892,6 @@ bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor,
|
||||
(toolbar->type == THEME_COOKIES_EDIT_TOOLBAR))
|
||||
theme_toolbar_window.work_flags |= (wimp_BUTTON_CLICK_DRAG <<
|
||||
wimp_ICON_BUTTON_TYPE_SHIFT);
|
||||
theme_toolbar_window.flags &= ~wimp_WINDOW_AUTO_REDRAW;
|
||||
theme_toolbar_window.flags |= wimp_WINDOW_NO_BOUNDS;
|
||||
theme_toolbar_window.xmin = 1;
|
||||
theme_toolbar_window.ymin = 1;
|
||||
theme_toolbar_window.extent.x1 = 16384;
|
||||
theme_toolbar_window.extent.y1 = 16384;
|
||||
theme_toolbar_window.sprite_area = sprite_area;
|
||||
if (toolbar->toolbar_handle) {
|
||||
error = xwimp_delete_window(toolbar->toolbar_handle);
|
||||
@ -1094,101 +1081,12 @@ bool ro_gui_theme_update_toolbar(struct theme_descriptor *descriptor,
|
||||
if (toolbar->parent_handle)
|
||||
ro_gui_theme_attach_toolbar(toolbar, toolbar->parent_handle);
|
||||
|
||||
/* Recreate the status window
|
||||
*/
|
||||
if (toolbar->type == THEME_BROWSER_TOOLBAR) {
|
||||
/* Delete the old window and create a new one
|
||||
*/
|
||||
if (toolbar->status_handle) {
|
||||
xwimp_delete_window(toolbar->status_handle);
|
||||
toolbar->status_handle = NULL;
|
||||
ro_gui_wimp_event_finalise(toolbar->status_handle);
|
||||
}
|
||||
if (toolbar->descriptor)
|
||||
theme_toolbar_window.work_bg =
|
||||
toolbar->descriptor->status_background;
|
||||
else
|
||||
theme_toolbar_window.work_bg =
|
||||
wimp_COLOUR_VERY_LIGHT_GREY;
|
||||
theme_toolbar_window.flags &= ~wimp_WINDOW_NO_BOUNDS;
|
||||
theme_toolbar_window.flags |= wimp_WINDOW_AUTO_REDRAW;
|
||||
theme_toolbar_window.xmin = 12;
|
||||
theme_toolbar_window.ymin =
|
||||
ro_get_hscroll_height((wimp_w)0) - 4;
|
||||
theme_toolbar_window.extent.y1 = theme_toolbar_window.ymin;
|
||||
error = xwimp_create_window(&theme_toolbar_window,
|
||||
&toolbar->status_handle);
|
||||
if (error) {
|
||||
LOG(("xwimp_create_window: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
return false;
|
||||
}
|
||||
ro_gui_wimp_event_set_user_data(toolbar->status_handle, toolbar);
|
||||
ro_gui_wimp_event_register_mouse_click(toolbar->status_handle,
|
||||
ro_gui_status_click);
|
||||
ro_gui_wimp_event_register_open_window(toolbar->status_handle,
|
||||
ro_gui_theme_status_open);
|
||||
ro_gui_wimp_event_set_help_prefix(toolbar->status_handle, "HelpStatus");
|
||||
|
||||
/* Create the status resize icon
|
||||
*/
|
||||
new_icon.w = toolbar->status_handle;
|
||||
new_icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_INDIRECTED |
|
||||
wimp_ICON_BORDER | wimp_ICON_FILLED |
|
||||
(wimp_COLOUR_LIGHT_GREY <<
|
||||
wimp_ICON_BG_COLOUR_SHIFT) |
|
||||
(wimp_BUTTON_CLICK_DRAG <<
|
||||
wimp_ICON_BUTTON_TYPE_SHIFT);
|
||||
new_icon.icon.data.indirected_text.text =
|
||||
theme_null_text_string;
|
||||
new_icon.icon.data.indirected_text.validation =
|
||||
theme_resize_validation;
|
||||
new_icon.icon.data.indirected_text.size = 1;
|
||||
error = xwimp_create_icon(&new_icon, 0);
|
||||
if (error) {
|
||||
LOG(("xwimp_create_icon: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* And finally our status display icon
|
||||
*/
|
||||
new_icon.icon.flags = wimp_ICON_TEXT | wimp_ICON_INDIRECTED |
|
||||
wimp_ICON_VCENTRED;
|
||||
if (toolbar->descriptor)
|
||||
new_icon.icon.flags |=
|
||||
(toolbar->descriptor->status_foreground <<
|
||||
wimp_ICON_FG_COLOUR_SHIFT) |
|
||||
(toolbar->descriptor->status_background <<
|
||||
wimp_ICON_BG_COLOUR_SHIFT);
|
||||
else
|
||||
new_icon.icon.flags |=
|
||||
(wimp_COLOUR_BLACK <<
|
||||
wimp_ICON_FG_COLOUR_SHIFT) |
|
||||
(wimp_COLOUR_VERY_LIGHT_GREY <<
|
||||
wimp_ICON_BG_COLOUR_SHIFT);
|
||||
new_icon.icon.data.indirected_text.text =
|
||||
toolbar->status_buffer;
|
||||
new_icon.icon.data.indirected_text.validation =
|
||||
theme_null_text_string;
|
||||
new_icon.icon.data.indirected_text.size = THEME_STATUS_MEMORY;
|
||||
error = xwimp_create_icon(&new_icon, 0);
|
||||
if (error) {
|
||||
LOG(("xwimp_create_icon: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Force a re-processing of the toolbar
|
||||
*/
|
||||
width = toolbar->toolbar_current;
|
||||
toolbar->reformat_buttons = true;
|
||||
toolbar->toolbar_current = -1;
|
||||
toolbar->status_current = -1;
|
||||
ro_gui_theme_process_toolbar(toolbar, width);
|
||||
|
||||
/* Keep menus up to date etc
|
||||
@ -1321,10 +1219,7 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
|
||||
wimp_window_state state;
|
||||
int height = -1;
|
||||
int throbber_x = -1;
|
||||
int status_max;
|
||||
int left_edge, right_edge, bottom_edge;
|
||||
int status_size = 0;
|
||||
int status_height = 0;
|
||||
if (!toolbar) return false;
|
||||
int old_height = toolbar->height;
|
||||
int old_width = toolbar->toolbar_current;
|
||||
@ -1343,9 +1238,7 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
|
||||
|
||||
/* find the parent window handle if we need to process the status
|
||||
* window, or the caller has requested we calculate the width ourself */
|
||||
if ((toolbar->parent_handle) && ((width == -1) ||
|
||||
((toolbar->status_handle) &&
|
||||
(toolbar->display_status)))) {
|
||||
if ((toolbar->parent_handle) && (width == -1)) {
|
||||
outline.w = toolbar->parent_handle;
|
||||
error = xwimp_get_window_outline(&outline);
|
||||
if (error) {
|
||||
@ -1620,87 +1513,6 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
|
||||
}
|
||||
toolbar->reformat_buttons = false;
|
||||
}
|
||||
|
||||
/* Reformat the status bar
|
||||
*/
|
||||
if ((toolbar->status_handle) && (toolbar->parent_handle)) {
|
||||
/* Get the current state
|
||||
*/
|
||||
state.w = toolbar->status_handle;
|
||||
error = xwimp_get_window_state(&state);
|
||||
if (error) {
|
||||
LOG(("xwimp_get_window_state: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Open or close the window
|
||||
*/
|
||||
if ((!toolbar->display_status) || (!parent_hscroll)) {
|
||||
if (state.flags & wimp_WINDOW_OPEN)
|
||||
xwimp_close_window(toolbar->status_handle);
|
||||
} else {
|
||||
/* Get the status bar height/width
|
||||
*/
|
||||
status_max = width - ro_get_vscroll_width(toolbar->parent_handle);
|
||||
status_size = (status_max * toolbar->status_width) / 10000;
|
||||
if (status_size < 12) status_size = 12;
|
||||
status_height = ro_get_hscroll_height(toolbar->parent_handle) - 2;
|
||||
|
||||
/* Update the extent
|
||||
*/
|
||||
extent.x0 = 0;
|
||||
extent.y0 = 0;
|
||||
extent.x1 = status_max;
|
||||
extent.y1 = status_height - 2;
|
||||
xwimp_set_extent(toolbar->status_handle, &extent);
|
||||
|
||||
/* Re-open the window
|
||||
*/
|
||||
state.w = toolbar->status_handle;
|
||||
state.xscroll = 0;
|
||||
state.yscroll = 0;
|
||||
state.next = wimp_TOP;
|
||||
state.visible.x0 = outline.outline.x0;
|
||||
state.visible.x1 = outline.outline.x0 + status_size;
|
||||
state.visible.y0 = outline.outline.y0 - status_height;
|
||||
state.visible.y1 = outline.outline.y0 - 2;
|
||||
xwimp_open_window_nested((wimp_open *)&state,
|
||||
toolbar->parent_handle,
|
||||
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
|
||||
<< wimp_CHILD_XORIGIN_SHIFT |
|
||||
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
|
||||
<< wimp_CHILD_YORIGIN_SHIFT |
|
||||
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
|
||||
<< wimp_CHILD_LS_EDGE_SHIFT |
|
||||
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
|
||||
<< wimp_CHILD_BS_EDGE_SHIFT |
|
||||
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
|
||||
<< wimp_CHILD_RS_EDGE_SHIFT |
|
||||
wimp_CHILD_LINKS_PARENT_VISIBLE_BOTTOM_OR_LEFT
|
||||
<< wimp_CHILD_TS_EDGE_SHIFT);
|
||||
|
||||
/* Resize and redraw the icons
|
||||
*/
|
||||
status_size = state.visible.x1 - state.visible.x0;
|
||||
if (status_size != toolbar->status_current) {
|
||||
xwimp_resize_icon(toolbar->status_handle, ICON_STATUS_TEXT,
|
||||
0, 0,
|
||||
status_size - 12, status_height - 2);
|
||||
xwimp_resize_icon(toolbar->status_handle, ICON_STATUS_RESIZE,
|
||||
status_size - 12, 0,
|
||||
status_size, status_height - 2);
|
||||
xwimp_force_redraw(toolbar->status_handle,
|
||||
toolbar->status_current - 12, 0,
|
||||
status_size - 12, status_height - 2);
|
||||
xwimp_force_redraw(toolbar->status_handle,
|
||||
status_size - 12, 0,
|
||||
status_size, status_height - 2);
|
||||
toolbar->status_current = status_size;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1728,11 +1540,6 @@ void ro_gui_theme_destroy_toolbar(struct toolbar *toolbar) {
|
||||
xwimp_delete_window(toolbar->toolbar_handle);
|
||||
ro_gui_wimp_event_finalise(toolbar->toolbar_handle);
|
||||
}
|
||||
if (toolbar->status_handle) {
|
||||
xwimp_delete_window(toolbar->status_handle);
|
||||
ro_gui_wimp_event_finalise(toolbar->status_handle);
|
||||
|
||||
}
|
||||
/* Free the Wimp buffer (we only created one for them all)
|
||||
*/
|
||||
free(toolbar->url_buffer);
|
||||
@ -2388,46 +2195,6 @@ void ro_gui_theme_set_help_prefix(struct toolbar *toolbar) {
|
||||
}
|
||||
}
|
||||
|
||||
void ro_gui_theme_status_open(wimp_open *open) {
|
||||
struct toolbar *toolbar = (struct toolbar *)ro_gui_wimp_event_get_user_data(open->w);
|
||||
os_error *error;
|
||||
wimp_outline outline;
|
||||
wimp_w parent = NULL;
|
||||
int parent_size, status_size;
|
||||
|
||||
/* update the window size */
|
||||
error = xwimp_open_window(open);
|
||||
if (error) {
|
||||
LOG(("xwimp_open_window: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
}
|
||||
|
||||
/* get the width to scale to */
|
||||
parent = toolbar->parent_handle;
|
||||
outline.w = toolbar->parent_handle;
|
||||
error = xwimp_get_window_outline(&outline);
|
||||
if (error) {
|
||||
LOG(("xwimp_get_window_outline: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
return;
|
||||
}
|
||||
parent_size = outline.outline.x1 - outline.outline.x0 -
|
||||
ro_get_vscroll_width(parent) - 2;
|
||||
|
||||
/* get the current size */
|
||||
status_size = open->visible.x1 - open->visible.x0;
|
||||
if (status_size <= 12)
|
||||
status_size = 0;
|
||||
|
||||
/* Store the new size
|
||||
*/
|
||||
toolbar->status_width = (10000 * status_size) / parent_size;
|
||||
if (toolbar->status_width > 10000) toolbar->status_width = 10000;
|
||||
ro_gui_theme_process_toolbar(toolbar, -1);
|
||||
}
|
||||
|
||||
int ro_gui_theme_height_change(struct toolbar *toolbar) {
|
||||
int height, cur_height;
|
||||
|
||||
|
@ -99,23 +99,18 @@ struct theme {
|
||||
};
|
||||
|
||||
struct toolbar {
|
||||
int status_width; /**< status width percentage * 100 */
|
||||
bool display_buttons; /**< display standard buttons */
|
||||
bool display_url; /**< display URL bar (if applicable) */
|
||||
bool display_throbber; /**< display throbber (if applicable) */
|
||||
bool display_status; /**< display status bar (if applicable) */
|
||||
int status_current; /**< the size of the status window in OS units */
|
||||
int toolbar_current; /**< the size of the toolbar window in OS units */
|
||||
int height; /**< vertical extent of the toolbar (read only) */
|
||||
int max_height; /**< allowed vertical extent (read only) */
|
||||
int old_height; /**< height on last test (read only) */
|
||||
wimp_w toolbar_handle; /**< toolbar window handle */
|
||||
wimp_w status_handle; /**< status window handle (if applicable) */
|
||||
wimp_w parent_handle; /**< parent window handle (read only) */
|
||||
bool reformat_buttons; /**< buttons need reformatting */
|
||||
char *url_buffer; /**< buffer for status text (read only) */
|
||||
char *throbber_buffer; /**< buffer for status text (read only) */
|
||||
char *status_buffer; /**< buffer for status text (read only) */
|
||||
struct toolbar_icon *icon; /**< first toolbar icon (read only) */
|
||||
struct toolbar_icon *suggest; /**< suggestion toolbar icon (read only) */
|
||||
struct theme_descriptor *descriptor; /**< theme descriptor (read only) */
|
||||
|
@ -32,6 +32,7 @@
|
||||
#include "netsurf/content/urldb.h"
|
||||
#include "netsurf/css/css.h"
|
||||
#include "netsurf/desktop/browser.h"
|
||||
#include "netsurf/desktop/frames.h"
|
||||
#include "netsurf/desktop/knockout.h"
|
||||
#include "netsurf/desktop/plotters.h"
|
||||
#include "netsurf/desktop/textinput.h"
|
||||
@ -44,6 +45,7 @@
|
||||
#include "netsurf/riscos/dialog.h"
|
||||
#include "netsurf/riscos/global_history.h"
|
||||
#include "netsurf/riscos/gui.h"
|
||||
#include "netsurf/riscos/gui/status_bar.h"
|
||||
#include "netsurf/riscos/menus.h"
|
||||
#include "netsurf/riscos/options.h"
|
||||
#include "netsurf/riscos/save.h"
|
||||
@ -168,6 +170,7 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
}
|
||||
g->bw = bw;
|
||||
g->toolbar = 0;
|
||||
g->status_bar = 0;
|
||||
g->reformat_pending = false;
|
||||
g->old_width = 0;
|
||||
g->old_height = 0;
|
||||
@ -192,7 +195,8 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
window.visible.y1 = 64;
|
||||
open_centred = false;
|
||||
} else if (clone && clone->window && option_window_size_clone) {
|
||||
state.w = clone->window->window;
|
||||
for (top = clone; top->parent; top = top->parent);
|
||||
state.w = top->window->window;
|
||||
error = xwimp_get_window_state(&state);
|
||||
if (error) {
|
||||
LOG(("xwimp_get_window_state: 0x%x: %s",
|
||||
@ -335,8 +339,9 @@ struct gui_window *gui_create_browser_window(struct browser_window *bw,
|
||||
window_list = g;
|
||||
window_count++;
|
||||
|
||||
/* Add in a toolbar */
|
||||
/* Add in a toolbar and status bar */
|
||||
if (bw->browser_window_type == BROWSER_WINDOW_NORMAL) {
|
||||
g->status_bar = ro_gui_status_bar_create(g->window, option_toolbar_status_width);
|
||||
g->toolbar = ro_gui_theme_create_toolbar(NULL, THEME_BROWSER_TOOLBAR);
|
||||
ro_gui_theme_attach_toolbar(g->toolbar, g->window);
|
||||
} else {
|
||||
@ -922,11 +927,8 @@ void gui_window_update_extent(struct gui_window *g)
|
||||
|
||||
void gui_window_set_status(struct gui_window *g, const char *text)
|
||||
{
|
||||
if ((!g->toolbar) || (!g->toolbar->status_handle))
|
||||
return;
|
||||
|
||||
ro_gui_set_icon_string(g->toolbar->status_handle,
|
||||
ICON_STATUS_TEXT, text);
|
||||
if (g->status_bar)
|
||||
ro_gui_status_bar_set_text(g->status_bar, text);
|
||||
}
|
||||
|
||||
|
||||
@ -1841,6 +1843,8 @@ void ro_gui_window_open(wimp_open *open)
|
||||
}
|
||||
|
||||
/* update the toolbar */
|
||||
if (g->status_bar)
|
||||
ro_gui_status_bar_resize(g->status_bar);
|
||||
if (g->toolbar) {
|
||||
ro_gui_theme_process_toolbar(g->toolbar, -1);
|
||||
/* second resize updates to the new URL bar width */
|
||||
@ -2008,23 +2012,6 @@ struct gui_window *ro_gui_toolbar_lookup(wimp_w window)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Convert a status bar RISC OS window handle to a gui_window.
|
||||
*
|
||||
* \param w RISC OS window handle of a status bar
|
||||
* \return pointer to a structure if found, 0 otherwise
|
||||
*/
|
||||
|
||||
struct gui_window *ro_gui_status_lookup(wimp_w window)
|
||||
{
|
||||
struct gui_window *g;
|
||||
for (g = window_list; g; g = g->next)
|
||||
if (g->toolbar && g->toolbar->status_handle == window)
|
||||
return g;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle pointer movements in a browser window.
|
||||
*
|
||||
@ -2199,42 +2186,6 @@ bool ro_gui_toolbar_click(wimp_pointer *pointer)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle Mouse_Click events in the status bar.
|
||||
*
|
||||
* \param g browser window that owns the status bar
|
||||
* \param pointer details of mouse click
|
||||
*/
|
||||
|
||||
bool ro_gui_status_click(wimp_pointer *pointer)
|
||||
{
|
||||
struct gui_window *g = ro_gui_status_lookup(pointer->w);
|
||||
wimp_drag drag;
|
||||
os_error *error;
|
||||
|
||||
assert(g);
|
||||
|
||||
switch (pointer->i) {
|
||||
case ICON_STATUS_RESIZE:
|
||||
gui_current_drag_type = GUI_DRAG_STATUS_RESIZE;
|
||||
drag.w = pointer->w;
|
||||
drag.type = wimp_DRAG_SYSTEM_SIZE;
|
||||
drag.initial.x0 = pointer->pos.x;
|
||||
drag.initial.x1 = pointer->pos.x;
|
||||
drag.initial.y0 = pointer->pos.y;
|
||||
drag.initial.y1 = pointer->pos.y;
|
||||
error = xwimp_drag_box(&drag);
|
||||
if (error) {
|
||||
LOG(("xwimp_drag_box: 0x%x: %s",
|
||||
error->errnum, error->errmess));
|
||||
warn_user("WimpError", error->errmess);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Handle Mouse_Click events in a browser window.
|
||||
*
|
||||
@ -2934,21 +2885,16 @@ void ro_gui_window_clone_options(struct browser_window *new_bw,
|
||||
/* Set up the toolbar
|
||||
*/
|
||||
if (new_gui->toolbar) {
|
||||
new_gui->toolbar->display_buttons = option_toolbar_show_buttons;
|
||||
new_gui->toolbar->display_url = option_toolbar_show_address;
|
||||
new_gui->toolbar->display_throbber = option_toolbar_show_throbber;
|
||||
if ((old_gui) && (old_gui->toolbar)) {
|
||||
new_gui->toolbar->status_width = old_gui->toolbar->status_width;
|
||||
new_gui->toolbar->display_status = old_gui->toolbar->display_status;
|
||||
new_gui->toolbar->display_buttons = old_gui->toolbar->display_buttons;
|
||||
new_gui->toolbar->display_url = old_gui->toolbar->display_url;
|
||||
new_gui->toolbar->display_throbber = old_gui->toolbar->display_throbber;
|
||||
} else {
|
||||
new_gui->toolbar->status_width = option_toolbar_status_width;
|
||||
new_gui->toolbar->display_status = option_toolbar_show_status;
|
||||
new_gui->toolbar->display_buttons = option_toolbar_show_buttons;
|
||||
new_gui->toolbar->display_url = option_toolbar_show_address;
|
||||
new_gui->toolbar->display_throbber = option_toolbar_show_throbber;
|
||||
new_gui->toolbar->reformat_buttons = true;
|
||||
ro_gui_theme_process_toolbar(new_gui->toolbar, -1);
|
||||
}
|
||||
new_gui->toolbar->reformat_buttons = true;
|
||||
ro_gui_theme_process_toolbar(new_gui->toolbar, -1);
|
||||
}
|
||||
}
|
||||
|
||||
@ -2978,12 +2924,12 @@ void ro_gui_window_default_options(struct browser_window *bw) {
|
||||
/* Set up the toolbar
|
||||
*/
|
||||
if (gui->toolbar) {
|
||||
option_toolbar_status_width = gui->toolbar->status_width;
|
||||
option_toolbar_show_status = gui->toolbar->display_status;
|
||||
option_toolbar_show_buttons = gui->toolbar->display_buttons;
|
||||
option_toolbar_show_address = gui->toolbar->display_url;
|
||||
option_toolbar_show_throbber = gui->toolbar->display_throbber;
|
||||
}
|
||||
if (gui->status_bar)
|
||||
option_toolbar_status_width = ro_gui_status_bar_get_width(gui->status_bar);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user