sp-item.h revision 2d81d5b269b98e3c6c1e4285c7adc2a23f0f7749
#ifndef __SP_ITEM_H__
#define __SP_ITEM_H__
/** \file
* Some things pertinent to all visible shapes: SPItem, SPItemView, SPItemCtx, SPItemClass, SPEvent.
*/
/*
* Authors:
* Lauris Kaplinski <lauris@kaplinski.com>
* bulia byak <buliabyak@users.sf.net>
* Johan Engelen <j.b.c.engelen@ewi.utwente.nl>
*
* Copyright (C) 1999-2006 authors
* Copyright (C) 2001-2002 Ximian, Inc.
* Copyright (C) 2004 Monash University
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include <vector>
#include "display/nr-arena-forward.h"
#include "sp-object.h"
#include <libnr/nr-matrix.h>
struct SPClipPathReference;
struct SPMaskReference;
struct SPAvoidRef;
struct SPPrintContext;
enum {
};
/**
* Event structure.
*
* \todo This is just placeholder. Plan:
* We do extensible event structure, that hold applicable (ui, non-ui)
* to process correct ones in meaningful way.
* Also, this probably goes to SPObject base class.
*
*/
struct SPEvent {
unsigned int type;
};
/// SPItemView
struct SPItemView {
unsigned int flags;
unsigned int key;
};
/* flags */
#define SP_ITEM_BBOX_VISUAL 1
#define SP_ITEM_SHOW_DISPLAY (1 << 0)
/**
* Flag for referenced views (i.e. clippaths, masks and patterns); always display
*/
struct SPItemCtx {
/** Item to document transformation */
/** Viewport size */
/** Item to viewport transformation */
};
/** Abstract base class for all visible shapes. */
unsigned int sensitive : 1;
unsigned int stop_paint: 1;
double transform_center_x;
double transform_center_y;
// Used for object-avoiding connectors
void init();
bool isLocked() const;
bool isHidden() const;
bool isEvaluated() const;
void setEvaluated(bool visible);
void resetEvaluated();
bool isHidden(unsigned display_key) const;
bool isExplicitlyHidden() const;
void setExplicitlyHidden(bool val);
void unsetCenter();
bool isCenterSet();
bool isVisibleAndUnlocked() const;
bool isVisibleAndUnlocked(unsigned display_key) const;
void raiseOne();
void lowerOne();
void raiseToTop();
void lowerToBottom();
}
enum EvaluatedStatus
{
};
mutable bool _is_evaluated;
};
/// The SPItem vtable.
struct SPItemClass {
/** BBox union in given coordinate system */
void (* bbox) (SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags);
/** Printing method. Assumes ctm is set to item affine matrix */
/* \todo Think about it, and maybe implement generic export method instead (Lauris) */
/** Give short description of item (for status display) */
/** Write to an iterator the points that should be considered for snapping
* as the item's `nodes'.
*/
/** Apply the transform optimally, and return any residual transformation */
/** Emit event, if applicable */
};
/* Flag testing macros */
/* Methods */
void sp_item_invoke_bbox(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const clear);
void sp_item_invoke_bbox_full(SPItem const *item, NRRect *bbox, NR::Matrix const &transform, unsigned const flags, unsigned const clear);
unsigned int sp_item_display_key_new(unsigned int numkeys);
NRArenaItem *sp_item_invoke_show(SPItem *item, NRArena *arena, unsigned int key, unsigned int flags);
void sp_item_adjust_pattern(SPItem *item, /* NR::Matrix const &premul, */ NR::Matrix const &postmul, bool set = false);
void sp_item_adjust_gradient(SPItem *item, /* NR::Matrix const &premul, */ NR::Matrix const &postmul, bool set = false);
void sp_item_adjust_paint_recursive(SPItem *item, NR::Matrix advertized_transform, NR::Matrix t_ancestors, bool is_pattern);
void sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, NRMatrix const *transform, NR::Matrix const *adv = NULL);
void sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, NR::Matrix const &transform, NR::Matrix const *adv = NULL, bool compensate = true);
/* Utility */
/* fixme: - these are evil, but OK */
/* Fill *TRANSFORM with the item-to-desktop transform. See doc/coordinates.txt
* for a description of `Desktop coordinates'; though see also mental's comment
* at the top of that file.
*
* \return TRANSFORM.
*/
#endif
/*
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:encoding=utf-8:textwidth=99 :