[project @ 2004-08-31 18:01:22 by rjw]

Further theme related fixes

svn path=/import/netsurf/; revision=1257
This commit is contained in:
Richard Wilson 2004-08-31 18:01:22 +00:00
parent 98d17f19a6
commit a8661b3a64
5 changed files with 36 additions and 22 deletions

View File

@ -1077,7 +1077,7 @@ void ro_gui_dialog_load_themes(void) {
wimp_ICON_VCENTRED | wimp_ICON_VCENTRED |
(wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) | (wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) |
(wimp_COLOUR_VERY_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT) | (wimp_COLOUR_VERY_LIGHT_GREY << wimp_ICON_BG_COLOUR_SHIFT) |
(wimp_BUTTON_RADIO << wimp_ICON_BUTTON_TYPE_SHIFT) | (wimp_BUTTON_CLICK << wimp_ICON_BUTTON_TYPE_SHIFT) |
(1 << wimp_ICON_ESG_SHIFT); (1 << wimp_ICON_ESG_SHIFT);
new_icon.icon.data.indirected_text_and_sprite.validation = new_icon.icon.data.indirected_text_and_sprite.validation =
theme_radio_validation; theme_radio_validation;
@ -1103,19 +1103,12 @@ void ro_gui_dialog_load_themes(void) {
/* Nest the toolbar window /* Nest the toolbar window
*/ */
state.w = link->toolbar->toolbar_handle; state.w = link->toolbar->toolbar_handle;
state.yscroll = 0;
state.visible.y1 = nested_y + base_extent; state.visible.y1 = nested_y + base_extent;
state.visible.y0 = state.visible.y1 - link->toolbar->height + 2; state.visible.y0 = state.visible.y1 - link->toolbar->height + 2;
xwimp_open_window_nested((wimp_open *)&state, dialog_config_th_pane, xwimp_open_window_nested((wimp_open *)&state, dialog_config_th_pane,
wimp_CHILD_LINKS_PARENT_WORK_AREA
<< wimp_CHILD_XORIGIN_SHIFT |
wimp_CHILD_LINKS_PARENT_WORK_AREA
<< wimp_CHILD_YORIGIN_SHIFT |
wimp_CHILD_LINKS_PARENT_WORK_AREA
<< wimp_CHILD_LS_EDGE_SHIFT |
wimp_CHILD_LINKS_PARENT_WORK_AREA wimp_CHILD_LINKS_PARENT_WORK_AREA
<< wimp_CHILD_BS_EDGE_SHIFT | << wimp_CHILD_BS_EDGE_SHIFT |
wimp_CHILD_LINKS_PARENT_WORK_AREA
<< wimp_CHILD_RS_EDGE_SHIFT |
wimp_CHILD_LINKS_PARENT_WORK_AREA wimp_CHILD_LINKS_PARENT_WORK_AREA
<< wimp_CHILD_TS_EDGE_SHIFT); << wimp_CHILD_TS_EDGE_SHIFT);
@ -1129,13 +1122,11 @@ void ro_gui_dialog_load_themes(void) {
*/ */
link = toolbars; link = toolbars;
while (link) { while (link) {
if (link->descriptor == theme_choice) { ro_gui_set_icon_selected_state(dialog_config_th_pane,
ro_gui_set_icon_selected_state(dialog_config_th_pane, link->icon_number, (link->descriptor == theme_choice));
link->icon_number, true);
break;
}
link = link->next; link = link->next;
} }
xwimp_force_redraw(dialog_config_th_pane, 0, -16384, 16384, 16384);
} }

View File

@ -66,8 +66,8 @@ static wimp_window theme_toolbar_window = {
12, 12,
1, 1,
{""}, {""},
0, 0/*,
{ } { } */
}; };
@ -1073,6 +1073,10 @@ bool ro_gui_theme_process_toolbar(struct toolbar *toolbar, int width) {
*/ */
toolbar->toolbar_current = width; toolbar->toolbar_current = width;
if ((toolbar->reformat_buttons) && (parent) && (old_height != toolbar->height)) { if ((toolbar->reformat_buttons) && (parent) && (old_height != toolbar->height)) {
extent.x1 = 16384;
extent.y0 = 0;
extent.y1 = toolbar->height;
xwimp_set_extent(toolbar->toolbar_handle, &extent);
ro_gui_theme_attach_toolbar(toolbar, parent); ro_gui_theme_attach_toolbar(toolbar, parent);
} }
toolbar->reformat_buttons = false; toolbar->reformat_buttons = false;

View File

@ -216,9 +216,17 @@ void ro_gui_set_icon_integer(wimp_w w, wimp_i i, int value) {
* \param i icon handle * \param i icon handle
* \param state selected state * \param state selected state
*/ */
#define ro_gui_set_icon_selected_state(w, i, state) \ void ro_gui_set_icon_selected_state(wimp_w w, wimp_i i, bool state) {
xwimp_set_icon_state(w, i, (state ? wimp_ICON_SELECTED : 0), wimp_ICON_SELECTED) os_error *error;
if (ro_gui_get_icon_selected_state(w, i) == state) return;
error = xwimp_set_icon_state(w, i,
(state ? wimp_ICON_SELECTED : 0), wimp_ICON_SELECTED);
if (error) {
LOG(("xwimp_get_icon_state: 0x%x: %s",
error->errnum, error->errmess));
warn_user("WimpError", error->errmess);
}
}
/** /**
* Gets the selected state of an icon. * Gets the selected state of an icon.
@ -227,11 +235,18 @@ void ro_gui_set_icon_integer(wimp_w w, wimp_i i, int value) {
* \param i icon handle * \param i icon handle
*/ */
bool ro_gui_get_icon_selected_state(wimp_w w, wimp_i i) { bool ro_gui_get_icon_selected_state(wimp_w w, wimp_i i) {
os_error *error;
wimp_icon_state ic; wimp_icon_state ic;
ic.w = w; ic.w = w;
ic.i = i; ic.i = i;
xwimp_get_icon_state(&ic); error = xwimp_get_icon_state(&ic);
return (ic.icon.flags & wimp_ICON_SELECTED) != 0; if (error) {
LOG(("xwimp_get_icon_state: 0x%x: %s",
error->errnum, error->errmess));
warn_user("WimpError", error->errmess);
return false;
}
return ((ic.icon.flags & wimp_ICON_SELECTED) != 0);
} }

View File

@ -37,7 +37,7 @@ void ro_convert_pixels_to_os_units(os_coord *pixels, os_mode mode);
char *ro_gui_get_icon_string(wimp_w w, wimp_i i); char *ro_gui_get_icon_string(wimp_w w, wimp_i i);
void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text); void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text);
void ro_gui_set_icon_integer(wimp_w w, wimp_i i, int value); void ro_gui_set_icon_integer(wimp_w w, wimp_i i, int value);
#define ro_gui_set_icon_selected_state(w, i, state) xwimp_set_icon_state(w, i, (state ? wimp_ICON_SELECTED : 0), wimp_ICON_SELECTED) void ro_gui_set_icon_selected_state(wimp_w w, wimp_i i, bool state);
bool ro_gui_get_icon_selected_state(wimp_w w, wimp_i i); bool ro_gui_get_icon_selected_state(wimp_w w, wimp_i i);
#define ro_gui_set_icon_shaded_state(w, i, state) xwimp_set_icon_state(w, i, (state ? wimp_ICON_SHADED : 0), wimp_ICON_SHADED) #define ro_gui_set_icon_shaded_state(w, i, state) xwimp_set_icon_state(w, i, (state ? wimp_ICON_SHADED : 0), wimp_ICON_SHADED)
bool ro_gui_get_icon_shaded_state(wimp_w w, wimp_i i); bool ro_gui_get_icon_shaded_state(wimp_w w, wimp_i i);

View File

@ -1125,6 +1125,10 @@ void ro_gui_toolbar_click(struct gui_window *g, wimp_pointer *pointer)
g->bw->current_content, g->bw->current_content,
false, 0, 0, g->window, false); false, 0, 0, g->window, false);
break; break;
case ICON_TOOLBAR_PRINT:
current_gui = g;
ro_gui_print_open(g, 0, 0, false, false);
break;
} }
} }