From 803f5179ab828aacec5776f2bcda888770fcee5d Mon Sep 17 00:00:00 2001 From: Richard Wilson Date: Mon, 21 Mar 2005 16:16:45 +0000 Subject: [project @ 2005-03-21 16:16:44 by rjw] Add warnings for invalid file loading. Remove redundant code. svn path=/import/nstheme/; revision=2439 --- riscos/wimp.c | 155 +++------------------------------------------------------- 1 file changed, 7 insertions(+), 148 deletions(-) (limited to 'riscos/wimp.c') diff --git a/riscos/wimp.c b/riscos/wimp.c index bb97ec6..44d7c12 100644 --- a/riscos/wimp.c +++ b/riscos/wimp.c @@ -26,106 +26,6 @@ #include "nstheme/utils/log.h" #include "nstheme/utils/utils.h" -/* Wimp_Extend,11 block -*/ -static wimpextend_furniture_sizes furniture_sizes; - - -/** - * Gets the horzontal scrollbar height - */ -int ro_get_hscroll_height(wimp_w w) { - wimp_version_no version; - - /* Read the hscroll height - */ - if (!w) return 38; - furniture_sizes.w = w; - furniture_sizes.border_widths.y0 = 38; - xwimpextend_get_furniture_sizes(&furniture_sizes); - - /* There is a quirk with the returned size as it differs between versions of the - WindowManager module. The incorrect height is returned by the version distributed - with the universal boot sequence (3.98) and presumably any previous version. - */ - if (!xwimpreadsysinfo_version(&version)) { - if ((int)version <= 398) { - return furniture_sizes.border_widths.y0 + 2; - } - } - - /* Return the standard (unhacked) size - */ - return furniture_sizes.border_widths.y0; -} - - -/** - * Gets the vertical scrollbar width - */ -int ro_get_vscroll_width(wimp_w w) { - - /* Read the hscroll height - */ - if (!w) return 38; - furniture_sizes.w = w; - furniture_sizes.border_widths.x1 = 38; - xwimpextend_get_furniture_sizes(&furniture_sizes); - - /* Return the standard (unhacked) size - */ - return furniture_sizes.border_widths.x1; -} - - -/** - * Reads a modes EIG factors. - * - * \param mode mode to read EIG factors for, or -1 for current - */ -struct eig_factors ro_read_eig_factors(os_mode mode) { - bits psr; - struct eig_factors factors; - xos_read_mode_variable(mode, os_MODEVAR_XEIG_FACTOR, &factors.xeig, &psr); - xos_read_mode_variable(mode, os_MODEVAR_YEIG_FACTOR, &factors.yeig, &psr); - return factors; -} - - -/** - * Converts the supplied os_coord from OS units to pixels. - * - * \param os_units values to convert - * \param mode mode to use EIG factors for, or -1 for current - */ -void ro_convert_os_units_to_pixels(os_coord *os_units, os_mode mode) { - struct eig_factors factors = ro_read_eig_factors(mode); - os_units->x = (os_units->x >> factors.xeig); - os_units->y = (os_units->y >> factors.yeig); -} - - -/** - * Converts the supplied os_coord from pixels to OS units. - * - * \param pixels values to convert - * \param mode mode to use EIG factors for, or -1 for current - */ -void ro_convert_pixels_to_os_units(os_coord *pixels, os_mode mode) { - struct eig_factors factors = ro_read_eig_factors(mode); - pixels->x = (pixels->x << factors.xeig); - pixels->y = (pixels->y << factors.yeig); -} - - -/** - * Redraws an icon - * - * \param w window handle - * \param i icon handle - */ -#define ro_gui_redraw_icon(w, i) xwimp_set_icon_state(w, i, 0, 0) - /** * Read the contents of an icon. @@ -207,20 +107,6 @@ void ro_gui_set_icon_string(wimp_w w, wimp_i i, const char *text) { } -/** - * Set the contents of an icon to a number. - * - * \param w window handle - * \param i icon handle - * \param value value - */ -void ro_gui_set_icon_integer(wimp_w w, wimp_i i, int value) { - char buffer[20]; // Big enough for 64-bit int - sprintf(buffer, "%d", value); - ro_gui_set_icon_string(w, i, buffer); -} - - /** * Set the selected state of an icon. * @@ -449,57 +335,30 @@ void ro_gui_set_caret_first(wimp_w w) { /** * Opens a window at the centre of either another window or the screen * - * /param parent the parent window (NULL for centre of screen) * /param child the child window */ -void ro_gui_open_window_centre(wimp_w parent, wimp_w child) { +void ro_gui_open_window_centre(wimp_w w) { os_error *error; wimp_window_state state; - int mid_x, mid_y; - int dimension, scroll_width; - - /* Get the parent window state - */ - if (parent) { - state.w = parent; - error = xwimp_get_window_state(&state); - if (error) { - warn_user("WimpError", error->errmess); - return; - } - scroll_width = ro_get_vscroll_width(parent); + int mid_x, mid_y, dimension; - /* Get the centre of the parent - */ - mid_x = (state.visible.x0 + state.visible.x1 + scroll_width) / 2; - mid_y = (state.visible.y0 + state.visible.y1) / 2; - } else { - ro_gui_screen_size(&mid_x, &mid_y); - mid_x /= 2; - mid_y /= 2; - } - - /* Get the child window state - */ - state.w = child; + state.w = w; error = xwimp_get_window_state(&state); if (error) { warn_user("WimpError", error->errmess); return; } if (!(state.flags & wimp_WINDOW_OPEN)) { - /* Move to the centre of the parent at the top of the stack - */ + ro_gui_screen_size(&mid_x, &mid_y); dimension = state.visible.x1 - state.visible.x0; - scroll_width = ro_get_vscroll_width(child); - state.visible.x0 = mid_x - (dimension + scroll_width) / 2; + state.visible.x0 = (mid_x - dimension) >> 1; state.visible.x1 = state.visible.x0 + dimension; dimension = state.visible.y1 - state.visible.y0; - state.visible.y0 = mid_y - dimension / 2; + state.visible.y0 = (mid_y - dimension) >> 1; state.visible.y1 = state.visible.y0 + dimension; } state.next = wimp_TOP; - wimp_open_window((wimp_open *) &state); + wimp_open_window((wimp_open *)&state); } -- cgit v1.2.3