box3d-side.cpp revision ef610fdbfb424e7ad204ac9de142c05bb986e1dc
#define __BOX3D_SIDE_C__
/*
* 3D box face implementation
*
* Authors:
* Maximilian Albert <Anhalter42@gmx.de>
*
* 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"
static Inkscape::XML::Node *box3d_side_write (SPObject *object, Inkscape::XML::Document *doc, Inkscape::XML::Node *repr, guint flags);
static SPShapeClass *parent_class;
box3d_side_get_type (void)
{
if (!type) {
sizeof (Box3DSideClass),
sizeof (Box3DSide),
16,
NULL, /* value_table */
};
}
return type;
}
static void
{
}
static void
{
}
static void
{
}
box3d_side_write (SPObject *object, 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;
}
static void
{
// 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;
}
}
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 |
}
}
/* 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
/* This call is responsible for live update of the sides during the initial drag */
}
void
{
// 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();
}
/* removed to be merged into box3d-context function sp_box3d_drag
* level class members from a derived subclass.
*/
/*void
box3d_side_apply_style (Box3DSide *side) {
Inkscape::XML::Node *repr_face = SP_OBJECT_REPR(SP_OBJECT(side));
Inkscape::Preferences *prefs = Inkscape::Preferences::get();
Glib::ustring descr = "/desktop/";
descr += box3d_side_axes_string(side);
descr += "/style";
Glib::ustring cur_style = prefs->getString(descr);
SPDesktop *desktop = inkscape_active_desktop();
bool use_current = prefs->getBool("/tools/shapes/3dbox/usecurrent", false);
if (use_current && !cur_style.empty()) {
// use last used style
repr_face->setAttribute("style", cur_style.data());
} else {
// use default style
GString *pstring = g_string_new("");
sp_desktop_apply_style_tool (desktop, repr_face, pstring->str, false);
}
}*/
gchar *
{
break;
break;
break;
default:
break;
}
}
static void
}
Persp3D *
}
// TODO: Copy over all important attributes (see sp_selected_item_to_curved_repr() for an example)
//repr->setAttribute("d", SP_OBJECT_REPR(side)->attribute("d"));
//repr->setAttribute("style", SP_OBJECT_REPR(side)->attribute("style"));
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:encoding=utf-8:textwidth=99 :