예제 #1
0
파일: filerwin.c 프로젝트: dpt/PrivateEye
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;
}
예제 #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);
	}
}
예제 #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);
	}
}
예제 #4
0
파일: rotate.c 프로젝트: dpt/PrivateEye
static void redraw_guts(wimp_draw *draw, osbool (*redraw_fn)(wimp_draw *))
{
  int     more;
  int     w,h;
  osbool  mask;
  os_mode mode;
  int     xeig,yeig;
  os_trfm t;

  /* FIXME: Try to factor these calls out - the values shouldn't change
   *        across a rotate 'session'. */

  osspriteop_read_sprite_info(osspriteop_USER_AREA,
                              LOCALS.thumbnail,
             (osspriteop_id) "thumbnail",
                             &w,&h,
                             &mask,
                             &mode);

  read_mode_vars(mode, &xeig, &yeig, NULL);

  w <<= xeig;
  h <<= yeig;

  LOCALS.drawn_rotation = LOCALS.rotation + LOCALS.delta;
  LOCALS.drawn_flags    = LOCALS.flags;

  trfm_set_identity(&t);
  /* flip horizontally */
  if (LOCALS.flags & RotateFlag_HorzFlip)
  {
    t.entries[0][0] = -t.entries[0][0];
    t.entries[2][0] += w;
  }
  trfm_translate(&t, -w / 2, -h / 2);
  trfm_rotate_degs(&t, LOCALS.drawn_rotation);

  t.entries[0][0] *= 256;
  t.entries[0][1] *= 256;
  t.entries[1][0] *= 256;
  t.entries[1][1] *= 256;

  for (more = redraw_fn(draw); more; more = wimp_get_rectangle(draw))
  {
    int     x,y;
    os_trfm t2;

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

    t2 = t;
    trfm_translate(&t2, x + LOCALS.extent / 2, y - LOCALS.extent / 2);

    t2.entries[2][0] *= 256;
    t2.entries[2][1] *= 256;

    osspriteop_put_sprite_trfm(osspriteop_USER_AREA,
                               LOCALS.thumbnail,
              (osspriteop_id) "thumbnail",
                               0, /* osspriteop_trfm_flags */
                               NULL, /* os_box const *source_rect */
                               mask ? osspriteop_USE_MASK : 0,
                               &t2,
                               LOCALS.trans_tab);

    draw_indicator(x + 8, y - 32 - 8);
  }
}