when inlining (as an action), reinterpret the inlinees so that there's not any pointer mess-ups

Sun, 07 Jul 2013 23:17:17 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sun, 07 Jul 2013 23:17:17 +0300
changeset 360
77f08db90249
parent 359
bcdfc801658b
child 361
f4c029f2a75b

when inlining (as an action), reinterpret the inlinees so that there's not any pointer mess-ups

src/gui.cpp file | annotate | diff | comparison | revisions
src/gui.h file | annotate | diff | comparison | revisions
src/gui_editactions.cpp file | annotate | diff | comparison | revisions
src/ui/ytruder.ui file | annotate | diff | comparison | revisions
--- a/src/gui.cpp	Sun Jul 07 17:45:48 2013 +0300
+++ b/src/gui.cpp	Sun Jul 07 23:17:17 2013 +0300
@@ -820,6 +820,9 @@
 	
 	m_objList->clearSelection ();
 	for (LDObject* obj : m_sel) {
+		if( obj->qObjListEntry == null )
+			continue;
+		
 		obj->qObjListEntry->setSelected (true);
 		obj->setSelected (true);
 	}
@@ -1175,6 +1178,11 @@
 	g_actionMeta[g_metacursor++] = meta;
 }
 
+void ForgeWindow::clearSelection()
+{
+	m_sel.clear();
+}
+
 QImage imageFromScreencap (uchar* data, ushort w, ushort h) {
 	// GL and Qt formats have R and B swapped. Also, GL flips Y - correct it as well.
 	return QImage (data, w, h, QImage::Format_ARGB32).rgbSwapped ().mirrored ();
--- a/src/gui.h	Sun Jul 07 17:45:48 2013 +0300
+++ b/src/gui.h	Sun Jul 07 23:17:17 2013 +0300
@@ -138,6 +138,7 @@
 	void primitiveLoaderStart (ulong max);
 	void primitiveLoaderUpdate (ulong prog);
 	void primitiveLoaderEnd ();
+	void clearSelection();
 	
 protected:
 	void closeEvent (QCloseEvent* ev);
--- a/src/gui_editactions.cpp	Sun Jul 07 17:45:48 2013 +0300
+++ b/src/gui_editactions.cpp	Sun Jul 07 23:17:17 2013 +0300
@@ -127,13 +127,16 @@
 		
 		// Merge in the inlined objects
 		for (LDObject* inlineobj : objs) {
-			// This object is now inlined so it has no parent anymore.
-			inlineobj->setParent (null);
-			g_curfile->insertObj (idx++, inlineobj);
+			str line = inlineobj->raw();
+			delete inlineobj;
+			
+			LDObject* newobj = parseLine( line );
+			g_curfile->insertObj( idx++, newobj );
+			g_win->sel() << newobj;
 		}
 		
 		// Delete the subfile now as it's been inlined.
-		g_curfile->forgetObject (obj);
+		g_curfile->forgetObject( obj );
 		delete obj;
 	}
 	
--- a/src/ui/ytruder.ui	Sun Jul 07 17:45:48 2013 +0300
+++ b/src/ui/ytruder.ui	Sun Jul 07 23:17:17 2013 +0300
@@ -118,6 +118,9 @@
            <property name="decimals">
             <number>3</number>
            </property>
+           <property name="minimum">
+            <double>-10000.000000000000000</double>
+           </property>
            <property name="maximum">
             <double>10000.000000000000000</double>
            </property>

mercurial