X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fpersp3d.cpp;h=e5cade661d151f3efb1c12e6417fdc221ca529ab;hb=57eb32794c2df43d60ee8f0a9aa8576567358ce6;hp=d6ae5bd244b5dff6fbb2820a064ae0156095b893;hpb=3ca2560f1103677939f8b6e8de30865c3aef7fe0;p=inkscape.git diff --git a/src/persp3d.cpp b/src/persp3d.cpp index d6ae5bd24..e5cade661 100644 --- a/src/persp3d.cpp +++ b/src/persp3d.cpp @@ -209,10 +209,10 @@ persp3d_create_xml_element (SPDocument *document, Persp3D *dup) {// if dup is gi repr = xml_doc->createElement("inkscape:perspective"); repr->setAttribute("sodipodi:type", "inkscape:persp3d"); - Proj::Pt2 proj_vp_x = Proj::Pt2 (-50.0, 600.0, 1.0); + Proj::Pt2 proj_vp_x = Proj::Pt2 (0.0, sp_document_height(document)/2, 1.0); Proj::Pt2 proj_vp_y = Proj::Pt2 ( 0.0,1000.0, 0.0); - Proj::Pt2 proj_vp_z = Proj::Pt2 (700.0, 600.0, 1.0); - Proj::Pt2 proj_origin = Proj::Pt2 (300.0, 400.0, 1.0); + Proj::Pt2 proj_vp_z = Proj::Pt2 (sp_document_width(document), sp_document_height(document)/2, 1.0); + Proj::Pt2 proj_origin = Proj::Pt2 (sp_document_width(document)/2, sp_document_height(document)/3, 1.0); gchar *str = NULL; str = proj_vp_x.coord_string(); @@ -237,6 +237,19 @@ persp3d_create_xml_element (SPDocument *document, Persp3D *dup) {// if dup is gi return (Persp3D *) sp_object_get_child_by_repr (SP_OBJECT(defs), repr); } +Persp3D * +persp3d_document_first_persp (SPDocument *document) { + SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); + Inkscape::XML::Node *repr; + for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) { + repr = SP_OBJECT_REPR(child); + if (SP_IS_PERSP3D(child)) { + return SP_PERSP3D(child); + } + } + return NULL; +} + /** * Virtual write: write object attributes to repr. */ @@ -552,8 +565,8 @@ persp3d_on_repr_attr_changed ( Inkscape::XML::Node * /*repr*/, /* returns a std::set() of all perspectives of the currently selected boxes */ std::set -persp3d_currently_selected_persps (SPEventContext *ec) { - Inkscape::Selection *selection = sp_desktop_selection (ec->desktop); +persp3d_currently_selected_persps () { + Inkscape::Selection *selection = sp_desktop_selection(inkscape_active_desktop()); std::set p; for (GSList *i = (GSList *) selection->itemList(); i != NULL; i = i->next) { @@ -632,7 +645,7 @@ persp3d_print_all_selected() { g_print ("\n======================================\n"); g_print ("Selected perspectives and their boxes:\n"); - std::set sel_persps = persp3d_currently_selected_persps (inkscape_active_event_context()); + std::set sel_persps = persp3d_currently_selected_persps(); for (std::set::iterator j = sel_persps.begin(); j != sel_persps.end(); ++j) { Persp3D *persp = SP_PERSP3D(*j);