From 182911d054ac2fa73e3bf625b5ea0710bfb416f0 Mon Sep 17 00:00:00 2001 From: cilix42 Date: Sat, 5 Jan 2008 02:45:08 +0000 Subject: [PATCH] Only set style of box sides during creation (not upon every repr write). --- src/box3d-context.cpp | 4 ++++ src/box3d-side.cpp | 17 ++--------------- src/box3d-side.h | 1 + 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index edc45e8d1..83952d5ef 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -634,6 +634,7 @@ static void sp_box3d_drag(Box3DContext &bc, guint /*state*/) Inkscape::GC::release(repr); /**** bc.item->transform = SP_ITEM(desktop->currentRoot())->getRelativeTransform(desktop->currentLayer()); ****/ Inkscape::XML::Node *repr_side; + // TODO: Incorporate this in box3d-side.cpp! for (int i = 0; i < 6; ++i) { repr_side = xml_doc->createElement("svg:path"); repr_side->setAttribute("sodipodi:type", "inkscape:box3dside"); @@ -649,6 +650,9 @@ static void sp_box3d_drag(Box3DContext &bc, guint /*state*/) side->dir2 = Box3D::extract_second_axis_direction(plane); side->front_or_rear = (Box3D::FrontOrRear) (desc & 0x8); + /* Set style */ + box3d_side_apply_style(side); + SP_OBJECT(side)->updateRepr(); // calls box3d_side_write() and updates, e.g., the axes string description } diff --git a/src/box3d-side.cpp b/src/box3d-side.cpp index e4f60075b..8cda01f72 100644 --- a/src/box3d-side.cpp +++ b/src/box3d-side.cpp @@ -39,7 +39,6 @@ static void box3d_side_update (SPObject *object, SPCtx *ctx, guint flags); //static void box3d_side_set_shape (SPShape *shape); //static void box3d_side_update_patheffect (SPShape *shape, bool write); -static void box3d_side_apply_style (Box3DSide *side); static Proj::Pt3 box3d_side_corner (Box3DSide *side, guint index); static std::vector box3d_side_corners (Box3DSide *side); // static gint box3d_side_descr_to_id (gchar const *descr); @@ -110,7 +109,7 @@ box3d_side_build (SPObject * object, SPDocument * document, Inkscape::XML::Node if (((SPObjectClass *) parent_class)->build) ((SPObjectClass *) parent_class)->build (object, document, repr); - sp_object_read_attr (object, "inkscape:box3dsidetype"); + sp_object_read_attr(object, "inkscape:box3dsidetype"); } static Inkscape::XML::Node * @@ -145,8 +144,6 @@ box3d_side_write (SPObject *object, Inkscape::XML::Node *repr, guint flags) repr->setAttribute("d", d); g_free (d); - box3d_side_apply_style (side); - if (((SPObjectClass *) (parent_class))->write) ((SPObjectClass *) (parent_class))->write (object, repr, flags); @@ -196,7 +193,6 @@ box3d_side_update (SPObject *object, SPCtx *ctx, guint flags) //g_print ("box3d_side_update\n"); if (flags & (SP_OBJECT_MODIFIED_FLAG | - //SP_OBJECT_CHILD_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG | SP_OBJECT_VIEWPORT_MODIFIED_FLAG)) { sp_shape_set_shape ((SPShape *) object); @@ -311,19 +307,10 @@ box3d_side_set_shape (SPShape *shape) sp_curve_unref (c); } -static void -//box3d_side_apply_style (SPBox3D *box, bool extruded) { +void box3d_side_apply_style (Box3DSide *side) { Inkscape::XML::Node *repr_face = SP_OBJECT_REPR(SP_OBJECT(side)); - /** - if (!extruded && !strcmp (box3d_side_axes_string (), "XYrear")) { - // to avoid "flashing" during the initial dragging process, we make the rear face invisible in this case - repr_face->setAttribute("style", "fill:none"); - return; - } - **/ - gchar *descr = g_strconcat ("desktop.", box3d_side_axes_string (side), NULL); const gchar * cur_style = prefs_get_string_attribute(descr, "style"); g_free (descr); diff --git a/src/box3d-side.h b/src/box3d-side.h index e9154087f..d2a1d62c9 100644 --- a/src/box3d-side.h +++ b/src/box3d-side.h @@ -42,6 +42,7 @@ GType box3d_side_get_type (void); //void sp_box3d_side_position_set (Box3DSide *side, NR::Point corner1, NR::Point corner2); void box3d_side_set_shape (SPShape *shape); void box3d_side_position_set (Box3DSide *side); // FIXME: Replace this by box3d_side_set_shape?? +void box3d_side_apply_style (Box3DSide *side); gchar *box3d_side_axes_string(Box3DSide *side); Persp3D *box3d_side_perspective(Box3DSide *side); -- 2.30.2