box3d-side.cpp revision 0c78ee1bc76ba866452690484d49807ecab054bb
/*
* 3D box face implementation
*
* Authors:
* Maximilian Albert <Anhalter42@gmx.de>
* Abhishek Sharma
*
* Copyright (C) 2007 Authors
*
* Released under GNU GPL, read the file 'COPYING' for more information
*/
#include "box3d-side.h"
#include "document.h"
#include "xml/document.h"
#include "attributes.h"
#include "inkscape.h"
#include "persp3d.h"
#include "box3d-context.h"
#include "preferences.h"
#include "desktop-style.h"
#include "box3d.h"
struct SPPathClass;
static Inkscape::XML::Node *box3d_side_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
//
//static void box3d_side_set_shape (SPShape *shape);
static SPShapeClass *parent_class;
box3d_side_get_type (void)
{
if (!type) {
sizeof (Box3DSideClass),
sizeof (Box3DSide),
16,
NULL, /* value_table */
};
}
return type;
}
{
// SPShapeClass *shape_class = reinterpret_cast<SPShapeClass *>(klass);
//shape_class->set_shape = box3d_side_set_shape;
}
this->spbox3dside = box3dside;
}
CBox3DSide::~CBox3DSide() {
}
static void
{
}
}
// CPPIFY: remove
{
}
Inkscape::XML::Node* CBox3DSide::onWrite(Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags) {
// this is where we end up when saving as plain SVG (also in other circumstances?)
// thus we don' set "sodipodi:type" so that the box is only saved as an ordinary svg:path
}
if (flags & SP_OBJECT_WRITE_EXT) {
}
/* Duplicate the path */
//Nulls might be possible if this called iteratively
if ( !curve ) {
return NULL;
}
g_free (d);
return repr;
}
// CPPIFY: remove
box3d_side_write (SPObject *object, Inkscape::XML::Document *xml_doc, Inkscape::XML::Node *repr, guint flags)
{
}
// TODO: In case the box was recreated (by undo, e.g.) we need to recreate the path
// (along with other info?) from the parent box.
/* fixme: we should really collect updates */
switch (key) {
if (value) {
}
}
break;
default:
break;
}
}
// CPPIFY: remove
static void
{
}
if (flags & (SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) {
flags &= ~SP_OBJECT_USER_MODIFIED_FLAG_B; // since we change the description, it's not a "just translation" anymore
}
if (flags & (SP_OBJECT_MODIFIED_FLAG |
}
}
// CPPIFY: remove
static void
{
}
/* Create a new Box3DSide and append it to the parent box */
{
Box3DSide *box3d_side = 0;
return box3d_side;
}
/*
* Function which return the type attribute for Box3D.
* Acts as a replacement for directly accessing the XML Tree directly.
*/
{
}
void
//box3d_side_set_shape (SP_SHAPE (side));
// This call is responsible for live update of the sides during the initial drag
}
void CBox3DSide::onSetShape() {
// avoid a warning caused by sp_document_height() (which is called from sp_item_i2d_affine() below)
// when reading a file containing 3D boxes
return;
}
if (!SP_IS_BOX3D(parent)) {
g_warning ("Parent of 3D box side is not a 3D box.\n");
return;
}
if (!persp) {
return;
}
// TODO: Draw the correct quadrangle here
// To do this, determine the perspective of the box, the orientation of the side (e.g., XY-FRONT)
// compute the coordinates of the corners in P^3, project them onto the canvas, and draw the
// resulting path.
unsigned int corners[4];
{
g_warning ("Trying to draw a 3D box side with invalid coordinates.\n");
return;
}
c->closepath();
/* Reset the shape'scurve to the "original_curve"
* This is very important for LPEs to work properly! (the bbox might be recalculated depending on the curve in shape)*/
if (sp_lpe_item_has_path_effect(SP_LPE_ITEM(shape)) && sp_lpe_item_path_effects_enabled(SP_LPE_ITEM(shape))) {
if (success) {
}
}
c->unref();
}
// CPPIFY: remove
//void
//box3d_side_set_shape (SPShape *shape)
//{
// ((Box3DSide*)shape)->cbox3dside->onSetShape();
//}
{
break;
break;
break;
default:
break;
}
}
static void
}
Persp3D *
}
// TODO: Copy over all important attributes (see sp_selected_item_to_curved_repr() for an example)
return repr;
}
/*
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 :