Example #1
0
FlowImage::FlowImage( FlowCtx *flow_ctx, const char *imagefile, double x, double y,
		      flow_mDisplayLevel display_lev) : 
	ctx(flow_ctx), ll(flow_ctx,x,y), ur(flow_ctx,x,y), display_level(display_lev), 
	image(0), original_image(0), 
	pixmap(0), nav_pixmap(0), clip_mask(0), nav_clip_mask(0), current_zoom_factor(0)
{
  imlib = ctx->fdraw->imlib;
  if ( imagefile)
    insert_image( imagefile);
}
Example #2
0
	bool add_text_image(UMImagePtr image, const char16_t& text)
	{
		if (!image) return false;
		if (image->width() > width_) return false;
		if (image->height() > height_) return false;

		AtlasNodePtr node = insert_image(image, root_);
		if (node)
		{
			rect_map_[text] = node->rect;
			image->copy(atlas_image_, node->rect);
			node->is_assigned = true;
			return true;
		}
		return false;
	}
Example #3
0
void do_image(struct g_part *p, struct image_description *im)
{
	struct g_object_image *io;
	struct link *link;
	link = NULL;
	putchars_link_ptr = &link;
	g_put_chars(p, NULL, 0);
	putchars_link_ptr = NULL;
	if (!link) im->link_num = -1;
	else {
		im->link_num = link - p->data->links;
		im->link_order = link->obj_order++;
		if (link->img_alt) mem_free(link->img_alt);
		link->img_alt = stracpy(im->alt);
	}
	io = insert_image(p, im);
	if (!io) goto ab;
	io->ismap = im->ismap;
	add_object(p, (struct g_object *)io);
	if (im->usemap && p->data) {
		unsigned char *tag = extract_position(im->usemap);
		struct additional_file *af = request_additional_file(current_f_data, im->usemap);
		af->need_reparse = 1;
		if (af->rq && (af->rq->state == O_LOADING || af->rq->state == O_INCOMPLETE || af->rq->state == O_OK) && af->rq->ce) {
			struct memory_list *ml;
			struct menu_item *menu;
			struct cache_entry *ce = af->rq->ce;
			unsigned char *start, *end;
			int i;
			struct image_map *map;
			get_file(af->rq, &start, &end);
			if (start == end) goto ft;
			if (get_image_map(ce->head, start, end, tag, &menu, &ml, format.href_base, format.target_base, 0, 0, 0, 1)) goto ft;
			map = mem_alloc(sizeof(struct image_map));
			map->n_areas = 0;
			for (i = 0; menu[i].text; i++) {
				struct link_def *ld = menu[i].data;
				struct map_area *a;
				struct link *link;
				int shape = !ld->shape || !*ld->shape ? SHAPE_RECT : !strcasecmp(ld->shape, "default") ? SHAPE_DEFAULT : !strcasecmp(ld->shape, "rect") ? SHAPE_RECT : !strcasecmp(ld->shape, "circle") ? SHAPE_CIRCLE : !strcasecmp(ld->shape, "poly") || !strcasecmp(ld->shape, "polygon") ? SHAPE_POLY : -1;
				if (shape == -1) continue;
				if ((unsigned)map->n_areas > (MAXINT - sizeof(struct image_map)) / sizeof(struct map_area) - 1) overalloc();
				map = mem_realloc(map, sizeof(struct image_map) + (map->n_areas + 1) * sizeof(struct map_area));
				a = &map->area[map->n_areas++];
				a->shape = shape;
				a->coords = DUMMY;
				a->ncoords = 0;
				if (ld->coords) {
					unsigned char *p = ld->coords;
					int num;
					next_coord:
					num = 0;
					while (*p && (*p < '0' || *p > '9')) p++;
					if (!*p) goto noc;
					while (*p >= '0' && *p <= '9' && num < 10000000) num = num * 10 + *p - '0', p++;
					if (*p == '.') {
						p++;
						while (*p >= '0' && *p <= '9') p++;
					}
					if (*p == '%' && num < 1000) {
						int m = io->xw < io->yw ? io->xw : io->yw;
						num = num * m / 100;
						p++;
					} else num = num * d_opt->image_scale / 100;
					if ((unsigned)a->ncoords > MAXINT / sizeof(int) - 1) overalloc();
					a->coords = mem_realloc(a->coords, (a->ncoords + 1) * sizeof(int));
					a->coords[a->ncoords++] = num;
					goto next_coord;
				}
				noc:
				if (!(link = new_link(p->data))) a->link_num = -1;
				else {
					link->pos = DUMMY;
					link->type = L_LINK;
					link->where = stracpy(ld->link);
					link->target = stracpy(ld->target);
					link->img_alt = stracpy(ld->label);
					link->where_img = stracpy(im->url);
#ifdef JS
					if (ld->onclick || ld->ondblclick || ld->onmousedown || ld->onmouseup || ld->onmouseover || ld->onmouseout || ld->onmousemove) {
						create_js_event_spec(&link->js_event);
						link->js_event->click_code = stracpy(ld->onclick);
						link->js_event->dbl_code = stracpy(ld->ondblclick);
						link->js_event->down_code = stracpy(ld->onmousedown);
						link->js_event->up_code = stracpy(ld->onmouseup);
						link->js_event->over_code = stracpy(ld->onmouseover);
						link->js_event->out_code = stracpy(ld->onmouseout);
						link->js_event->move_code = stracpy(ld->onmousemove);
					}
#endif
					a->link_num = link - p->data->links;
				}
				if (last_link) mem_free(last_link), last_link = NULL;
			}
			io->map = map;
			freeml(ml);
			ft:;
		}
		if (tag) mem_free(tag);
	}
	ab:
	if (im->usemap) mem_free(im->usemap);
}
Example #4
0
html_editor::m_action_definitions[] = {
#define QN QT_TR_NOOP
#define NA QWebPage::NoWebAction

  // {name, shortcut, icon, WebAction
  {QN("Bold"), QN("Ctrl+B"), "icon-bold.png", SLOT(bold()), NA }
  ,{QN("Italic"), QN("Ctrl+I"), "icon-italic.png", SLOT(italic()), NA }
  ,{QN("Underline"), QN("Ctrl+U"), "icon-underline.png", SLOT(underline()), NA }
  ,{QN("Strike through"), QN("Ctrl+S"), "icon-strikethrough.png", SLOT(strikethrough()) , NA}
  ,{QN("Superscript"), NULL, "icon-superscript.png", SLOT(superscript()), NA }
  ,{QN("Subscript"), NULL, "icon-subscript.png", SLOT(subscript()), NA }

  // separator before 6
  ,{QN("Set foreground color"), NULL, "icon-foreground-color.png", SLOT(foreground_color()), NA }
  ,{QN("Set background color"), NULL, "icon-background-color.png", SLOT(background_color()), NA }
  ,{QN("Insert image"), NULL, "icon-image.png", SLOT(insert_image()), NA }
  ,{QN("Insert link"), NULL, "icon-link.png", SLOT(insert_link()), NA }
  ,{QN("Insert horizontal rule"), NULL, "icon-hr.png", SLOT(insert_hr()), NA }
  ,{QN("Insert unordered list"), NULL, "icon-bullet-list.png", SLOT(insert_unordered_list()), NA }
  ,{QN("Insert ordered list"), NULL, "icon-ordered-list.png", SLOT(insert_ordered_list()), NA }
  ,{QN("Remove format"), NULL, "icon-eraser.png", SLOT(remove_format()), NA }
  ,{QN("Cut"), NULL, "icon-cut.png", NULL, QWebPage::Cut }
  ,{QN("Copy"), NULL, "icon-copy.png", NULL, QWebPage::Copy }
  ,{QN("Paste"), NULL, "icon-paste.png", NULL, QWebPage::Paste }
  ,{QN("Undo"), QN("Ctrl+Z"), "icon-undo.png", NULL, QWebPage::Undo }
  ,{QN("Redo"), NULL, "icon-redo.png", NULL, QWebPage::Redo }
  ,{QN("Align left"), NULL, "icon-align-left.png", SLOT(align_left()), NA }
  ,{QN("Justify"), NULL, "icon-justify.png", SLOT(justify()), NA }
  ,{QN("Align right"), NULL, "icon-align-right.png", SLOT(align_right()), NA }
  ,{QN("Center"), NULL, "icon-center.png", SLOT(center()), NA }
  ,{QN("Indent right"), NULL, "icon-indent-right.png", SLOT(indent_right()), NA }