Esempio n. 1
0
static int filerwin_event_redraw_window_request(wimp_event_no event_no,
                                                wimp_block   *block,
                                                void         *handle)
{
  error      err;
  wimp_draw *redraw;
  filerwin  *fw;
  osbool     more;

  NOT_USED(event_no);

  redraw = &block->redraw;
  fw     = handle;

  for (more = wimp_redraw_window(redraw);
       more;
       more = wimp_get_rectangle(redraw))
  {
    int x,y;

    x = redraw->box.x0 - redraw->xscroll;
    y = redraw->box.y1 - redraw->yscroll;

    err = map(fw, redraw_bobs, x, y, &redraw->clip, redraw);
    if (err)
      return event_HANDLED;
  }

  return event_HANDLED;
}
Esempio n. 2
0
void ro_gui_options_image_redraw(wimp_draw *redraw)
{
	osbool more;
	os_error *error;
	wimp_icon_state icon_state;
	osspriteop_header *bg = NULL, *fg = NULL;
	unsigned int bg_tinct = 0, fg_tinct = 0;

	/* get the icon location */
	icon_state.w = redraw->w;
	icon_state.i = IMAGE_CURRENT_DISPLAY;
	error = xwimp_get_icon_state(&icon_state);
	if (error) {
		LOG("xwimp_get_icon_state: 0x%x: %s",
				error->errnum, error->errmess);
		ro_warn_user("MenuError", error->errmess);
		return;
	}

	/* find the sprites */
	if (example_images) {
		ro_gui_options_image_read(redraw->w, &bg_tinct, &fg_tinct);
		fg_tinct |= 0xeeeeee00;
		xosspriteop_select_sprite(osspriteop_USER_AREA,
				example_images, (osspriteop_id)"img_bg", &bg);
		xosspriteop_select_sprite(osspriteop_USER_AREA,
				example_images, (osspriteop_id)"img_fg", &fg);
	}

	/* perform the redraw */
	more = wimp_redraw_window(redraw);
	while (more) {
		int origin_x, origin_y;
		origin_x = redraw->box.x0 - redraw->xscroll +
				icon_state.icon.extent.x0 + 2;
		origin_y = redraw->box.y1 - redraw->yscroll +
				icon_state.icon.extent.y0 + 2;
		if (bg)
			_swix(Tinct_Plot, _INR(2,4) | _IN(7),
					bg, origin_x, origin_y, bg_tinct);
		if (fg)
			_swix(Tinct_PlotAlpha, _INR(2,4) | _IN(7),
					fg, origin_x, origin_y, fg_tinct);
		more = wimp_get_rectangle(redraw);
	}
}
Esempio n. 3
0
void ro_gui_url_complete_redraw(wimp_draw *redraw)
{
	osbool more;
	os_error *error;
	int line;
	const struct url_data *data;
	int type;

	/* initialise our icon */
	url_complete_icon.flags = wimp_ICON_INDIRECTED | wimp_ICON_VCENTRED |
			wimp_ICON_TEXT | wimp_ICON_FILLED |
			(wimp_COLOUR_BLACK << wimp_ICON_FG_COLOUR_SHIFT) |
			(wimp_COLOUR_WHITE << wimp_ICON_BG_COLOUR_SHIFT);
	url_complete_icon.extent.x0 = 50;
	url_complete_icon.extent.x1 = 16384;
	url_complete_icon.data.indirected_text.validation =
						url_complete_icon_null;
	url_complete_sprite.flags = wimp_ICON_TEXT | wimp_ICON_SPRITE |
				wimp_ICON_INDIRECTED | wimp_ICON_FILLED |
				wimp_ICON_HCENTRED | wimp_ICON_VCENTRED;
	url_complete_sprite.extent.x0 = 0;
	url_complete_sprite.extent.x1 = 50;
	url_complete_sprite.data.indirected_text.text =
						url_complete_icon_null;
	url_complete_sprite.data.indirected_text.validation =
						url_complete_icon_sprite;
	url_complete_sprite.data.indirected_text.size = 1;

	/* no matches? no redraw */
	if (!url_complete_matches) {
		LOG("Attempt to redraw with no matches made");
		/* Fill is never used, so make it something obvious */
		ro_gui_user_redraw(redraw, false, os_COLOUR_BLACK);
		return;
	}

	/* redraw */
	more = wimp_redraw_window(redraw);
	while (more) {
		int first_line, last_line;
		int origin_y = redraw->box.y1 - redraw->yscroll;
		int clip_y0 = redraw->clip.y0 - origin_y;
		int clip_y1 = redraw->clip.y1 - origin_y;

		first_line = (-clip_y1) / 44;
		last_line = (-clip_y0 + 43) / 44;

		for (line = first_line; line < last_line; line++) {
			if (line == url_complete_matches_selection)
				url_complete_icon.flags |=
							wimp_ICON_SELECTED;
			else
				url_complete_icon.flags &=
							~wimp_ICON_SELECTED;
			url_complete_icon.extent.y1 = -line * 44;
			url_complete_icon.extent.y0 = -(line + 1) * 44;
			url_complete_icon.data.indirected_text.text =
					(char *)nsurl_access(
						url_complete_matches[line]);
			url_complete_icon.data.indirected_text.size =
					nsurl_length(
						url_complete_matches[line]);

			error = xwimp_plot_icon(&url_complete_icon);
			if (error) {
				LOG("xwimp_plot_icon: 0x%x: %s", error->errnum, error->errmess);
				ro_warn_user("WimpError", error->errmess);
			}

			data = urldb_get_url_data(url_complete_matches[line]);
			if (data)
				type = ro_content_filetype_from_type(
					data->type);
			else
				type = 0;

			sprintf(url_complete_icon_sprite, "Ssmall_%.3x",
					type);

			if (!ro_gui_wimp_sprite_exists(
					url_complete_icon_sprite + 1))
				sprintf(url_complete_icon_sprite,
						"Ssmall_xxx");
			url_complete_sprite.extent.y1 = -line * 44;
			url_complete_sprite.extent.y0 = -(line + 1) * 44;
			error = xwimp_plot_icon(&url_complete_sprite);
			if (error) {
				LOG("xwimp_plot_icon: 0x%x: %s", error->errnum, error->errmess);
				ro_warn_user("WimpError", error->errmess);
			}
		}
		more = wimp_get_rectangle(redraw);
	}
}