sp-item.h revision 36bb2154f1627a17c3591eb4d7f89335e8b5dadd
#ifndef SEEN_SP_ITEM_H
#define SEEN_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>
* Abhishek Sharma
*
* 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/display-forward.h"
#include "sp-object.h"
#include <libnr/nr-convert2geom.h>
#include <snap-preferences.h>
#include "snap-candidate.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.
*
*/
unsigned int type;
};
/// 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. markers, clippaths, masks and patterns);
currently unused, does the same as DISPLAY
*/
/** Item to document transformation */
/** Viewport size */
/** Item to viewport transformation */
};
/** Abstract base class for all visible shapes. */
enum BBoxType {
// legacy behavior: includes crude stroke, markers; excludes long miters, blur margin; is known to be wrong for caps
// includes only the bare path bbox, no stroke, no nothing
// includes everything: correctly done stroke (with proper miters and caps), markers, filter margins (e.g. blur)
};
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();
}
unsigned pos_in_parent();
gchar *description();
static unsigned int display_key_new(unsigned int numkeys);
Inkscape::DrawingItem *invoke_show(Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
void invoke_hide(unsigned int key);
void getSnappoints(std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs=0) const;
void adjust_pattern(/* Geom::Affine const &premul, */ Geom::Affine const &postmul, bool set = false);
void adjust_gradient(/* Geom::Affine const &premul, */ Geom::Affine const &postmul, bool set = false);
void adjust_paint_recursive(Geom::Affine advertized_transform, Geom::Affine t_ancestors, bool is_pattern);
void doWriteTransform(Inkscape::XML::Node *repr, Geom::Affine const &transform, Geom::Affine const *adv = NULL, bool compensate = true);
void convert_item_to_guides();
void convert_to_guides();
enum EvaluatedStatus
{
};
mutable bool _is_evaluated;
static Inkscape::XML::Node *sp_item_write(SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static void sp_item_private_snappoints(SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
static SPItemView *sp_item_view_new_prepend(SPItemView *list, SPItem *item, unsigned flags, unsigned key, Inkscape::DrawingItem *arenaitem);
};
/// The SPItem vtable.
/** BBox union in given coordinate system */
/** 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) */
Inkscape::DrawingItem * (* show) (SPItem *item, Inkscape::Drawing &drawing, unsigned int key, unsigned int flags);
/** Write to an iterator the points that should be considered for snapping
* as the item's `nodes'.
*/
void (* snappoints) (SPItem const *item, std::vector<Inkscape::SnapCandidatePoint> &p, Inkscape::SnapPreferences const *snapprefs);
/** Apply the transform optimally, and return any residual transformation */
/** Convert the item to guidelines */
/** Emit event, if applicable */
static SPObjectClass *static_parent_class;
};
// 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 // SEEN_SP_ITEM_H
/*
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 :