canvas-text.cpp revision 24be9baeb3585155f4b723dbda0726a4930b5c05
#define __SP_CANVASTEXT_C__
/*
* Canvas text
*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* Maximilian Albert <maximilian.albert@gmail.com>
*
* Copyright (C) 2000-2002 Lauris Kaplinski
* Copyright (C) 2008 Maximilian Albert
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include <sstream>
#include <string.h>
#include "sp-canvas-util.h"
#include "canvas-text.h"
#include "display/cairo-utils.h"
#include "desktop.h"
#include "color.h"
static void sp_canvastext_update (SPCanvasItem *item, Geom::Affine const &affine, unsigned int flags);
static SPCanvasItemClass *parent_class_ct;
sp_canvastext_get_type (void)
{
if (!type) {
sizeof (SPCanvasTextClass),
sizeof (SPCanvasText),
0,
};
}
return type;
}
static void
{
}
static void
{
canvastext->anchor_offset_x = 0;
canvastext->anchor_offset_y = 0;
canvastext->background = false;
canvastext->outline = false;
canvastext->background = false;
canvastext->border = 3; // must be a constant, and not proportional to any width, height, or fontsize to allow alignment with other text boxes
}
static void
{
}
static void
{
return;
if (cl->background){
}
}
}
static void
{
sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
if (parent_class_ct->update)
// set up a temporary cairo_t to measure the text extents; it would be better to compute this in the render()
// method but update() seems to be called before so we don't have the information available when we need it
// adjust update region according to anchor shift
switch (cl->anchor_position){
case TEXT_ANCHOR_LEFT:
break;
case TEXT_ANCHOR_RIGHT:
break;
case TEXT_ANCHOR_BOTTOM:
break;
case TEXT_ANCHOR_TOP:
break;
case TEXT_ANCHOR_ZERO:
cl->anchor_offset_x = 0;
cl->anchor_offset_y = 0;
break;
case TEXT_ANCHOR_CENTER:
default:
break;
}
sp_canvas_request_redraw (item->canvas, (int)item->x1, (int)item->y1, (int)item->x2, (int)item->y2);
}
sp_canvastext_new(SPCanvasGroup *parent, SPDesktop *desktop, Geom::Point pos, gchar const *new_text)
{
// TODO: anything else to do?
return item;
}
void
{
}
}
#define EPSILON 1e-6
void
{
}
void
{
}
}
void
{
}
void
{
}
void
{
}
//void
//sp_canvastext_set_anchor (SPCanvasText *ct, double anchor_x, double anchor_y)
//{
// ct->anchor_x = anchor_x;
// ct->anchor_y = anchor_y;
//}
/*
Local Variables:
mode:c++
c-file-style:"stroustrup"
c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
indent-tabs-mode:nil
fill-column:99
End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :