src/gui_editactions.cpp

changeset 214
28e0b37156be
parent 212
79c5205b807c
child 215
eab460199114
--- a/src/gui_editactions.cpp	Fri May 17 11:53:28 2013 +0300
+++ b/src/gui_editactions.cpp	Sat May 18 21:35:55 2013 +0300
@@ -759,4 +759,25 @@
 	
 	History::addEntry (history);
 	g_win->fullRefresh ();
+}
+
+MAKE_ACTION (demote, "Demote conditional lines", "demote", "Demote conditional lines down to normal lines.", (0)) {
+	EditHistory* history = new EditHistory;
+	
+	vector<LDObject*> sel = g_win->sel ();
+	for (LDObject* obj : sel) {
+		if (obj->getType () != LDObject::CondLine)
+			continue;
+		
+		ulong idx = obj->getIndex (g_curfile);
+		LDObject* cache = obj->clone ();
+		LDLine* repl = static_cast<LDCondLine*> (obj)->demote ();
+		
+		history->addEntry (cache, repl, idx);
+		g_win->R ()->compileObject (repl);
+		delete cache;
+	}
+	
+	History::addEntry (history);
+	g_win->refresh ();
 }
\ No newline at end of file

mercurial