summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2c1198b)
raw | patch | inline | side by side (parent: 2c1198b)
author | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 20 Aug 2007 12:20:43 +0000 (12:20 +0000) | ||
committer | cilix42 <cilix42@users.sourceforge.net> | |
Mon, 20 Aug 2007 12:20:43 +0000 (12:20 +0000) |
src/box3d-context.cpp | patch | blob | history | |
src/box3d-face.cpp | patch | blob | history | |
src/box3d-face.h | patch | blob | history |
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp
index 3b45abdb2450a14da587007aea11f1dd8a292074..8ef5f5960467041929fae395f5f9304174f09b90 100644 (file)
--- a/src/box3d-context.cpp
+++ b/src/box3d-context.cpp
@@ -362,8 +362,11 @@ static gint sp_3dbox_context_root_handler(SPEventContext *event_context, GdkEven
if (event->motion.state & GDK_SHIFT_MASK && !bc->extruded) {
/* once shift is pressed, set bc->extruded (no need to create further faces;
- all of them are already created in sp_3dbox_init) */
+ all of them are already created in sp_3dbox_init); since we made the rear face
+ invisible in the beginning to avoid "flashing", we must set its correct style now */
bc->extruded = true;
+ g_assert (bc->item);
+ SP_3DBOX (bc->item)->faces[5]->set_style (NULL, true);
}
if (!bc->extruded) {
for (int i = 0; i < 6; ++i) {
SP_3DBOX(bc.item)->faces[i]->hook_path_to_3dbox();
}
+ // make rear face invisible in the beginning to avoid "flashing"
+ SP_3DBOX (bc.item)->faces[5]->set_style (NULL, false);
bc.item->updateRepr();
sp_3dbox_set_z_orders (SP_3DBOX (bc.item));
diff --git a/src/box3d-face.cpp b/src/box3d-face.cpp
index 9a6ca2ef25cd74dbff6130225116388f0bca616b..de52031dadd237a7b528d3cdc1712d21c148eecc 100644 (file)
--- a/src/box3d-face.cpp
+++ b/src/box3d-face.cpp
return;
}
- SPDesktop *desktop = inkscape_active_desktop();
+ /* create new path for face */
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(SP_OBJECT_DOCUMENT(SP_OBJECT(parent_box3d)));
- /* apply style */
- bool use_current = prefs_get_int_attribute("tools.shapes.3dbox", "usecurrent", 0);
Inkscape::XML::Node *repr_face = xml_doc->createElement("svg:path");
repr_face->setAttribute("inkscape:box3dface", this->axes_string());
+ this->path = SP_PATH(SP_OBJECT(parent_box3d)->appendChildRepr(repr_face));
+ Inkscape::GC::release(repr_face);
+
+ /* set the correct style */
+ this->set_style (repr_face);
+}
+
+void Box3DFace::set_style(Inkscape::XML::Node *repr_face, bool extruded)
+{
+ if (repr_face == NULL) {
+ repr_face = SP_OBJECT_REPR (this->path);
+ }
- gchar *descr = g_strconcat ("desktop.", axes_string(), NULL);
+ if (!extruded && !strcmp (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.", axes_string (), NULL);
const gchar * cur_style = prefs_get_string_attribute(descr, "style");
+ g_free (descr);
+
+ SPDesktop *desktop = inkscape_active_desktop();
+ bool use_current = prefs_get_int_attribute("tools.shapes.3dbox", "usecurrent", 0);
if (use_current && cur_style !=NULL) {
/* use last used style */
repr_face->setAttribute("style", cur_style);
g_string_printf (pstring, "tools.shapes.3dbox.%s", axes_string());
sp_desktop_apply_style_tool (desktop, repr_face, pstring->str, false);
}
- g_free (descr);
- this->path = SP_PATH(SP_OBJECT(parent_box3d)->appendChildRepr(repr_face));
- Inkscape::GC::release(repr_face);
}
/**
diff --git a/src/box3d-face.h b/src/box3d-face.h
index d3d83e7026034f3de138f32010298afdafec6b94..091a8108bb839a1e4b8bb5a383691b365c679567 100644 (file)
--- a/src/box3d-face.h
+++ b/src/box3d-face.h
//void set_face (NR::Point const A, NR::Point const C, Box3D::Axis const dir1, Box3D::Axis const dir2);
void hook_path_to_3dbox(SPPath * existing_path = NULL);
+ void set_style(Inkscape::XML::Node *repr_face = NULL, bool extruded = true);
void set_path_repr();
void set_curve();
inline void lower_to_bottom() { SP_ITEM (path)->lowerToBottom(); }