src/toolsets/basictoolset.cpp

changeset 1391
5fa4bf1fc781
parent 1375
689121d162b6
child 1416
ba63c7286767
equal deleted inserted replaced
1390:3eace926af7f 1391:5fa4bf1fc781
102 print (tr ("%1 objects deleted"), num); 102 print (tr ("%1 objects deleted"), num);
103 } 103 }
104 104
105 void BasicToolset::doInline (bool deep) 105 void BasicToolset::doInline (bool deep)
106 { 106 {
107 for (LDSubfileReference* reference : filterByType<LDSubfileReference> (selectedObjects())) 107 for (LDObject* object : selectedObjects())
108 { 108 {
109 // Get the index of the subfile so we know where to insert the 109 if (object->isRasterizable())
110 // inlined contents.
111 QPersistentModelIndex referenceIndex = currentDocument()->indexOf(reference);
112 int row = referenceIndex.row();
113
114 if (referenceIndex.isValid())
115 { 110 {
116 Model inlined {m_documents}; 111 // Get the index of the subfile so we know where to insert the
117 reference->inlineContents( 112 // inlined contents.
118 m_documents, 113 QPersistentModelIndex referenceIndex = currentDocument()->indexOf(object);
119 currentDocument()->winding(), 114 int row = referenceIndex.row();
120 inlined, 115
121 deep, 116 if (referenceIndex.isValid())
122 false
123 );
124
125 // Merge in the inlined objects
126 for (LDObject* inlinedObject : inlined.objects())
127 { 117 {
128 currentDocument()->insertCopy(row, inlinedObject); 118 Model inlined {m_documents};
129 mainWindow()->select(currentDocument()->index(row)); 119 object->rasterize(
130 row += 1; 120 m_documents,
121 currentDocument()->winding(),
122 inlined,
123 deep,
124 false
125 );
126
127 // Merge in the inlined objects
128 for (LDObject* inlinedObject : inlined.objects())
129 {
130 currentDocument()->insertCopy(row, inlinedObject);
131 mainWindow()->select(currentDocument()->index(row));
132 row += 1;
133 }
134
135 // Delete the subfile now as it's been inlined.
136 currentDocument()->removeRow(referenceIndex.row());
131 } 137 }
132
133 // Delete the subfile now as it's been inlined.
134 currentDocument()->removeRow(referenceIndex.row());
135 } 138 }
136 } 139 }
137 140
138 for (LDBezierCurve* curve : filterByType<LDBezierCurve> (selectedObjects())) 141 for (LDBezierCurve* curve : filterByType<LDBezierCurve> (selectedObjects()))
139 { 142 {

mercurial