View Issue Details

IDProjectCategoryView StatusLast Update
0003301ScribusStory Editor / Text Framespublic2011-02-16 16:35
ReporterSnEptUne Assigned Toplinnell 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionduplicate 
PlatformLinux 
Product Version1.3.2 
Fixed in Version1.4.0svn 
Summary0003301: Undo does not work on text object
DescriptionWhen the text inside text object are changed, undo will not restore them to their former states.
Steps To Reproduce1. Create a text object
2. Add text to the text object
3. Delete the text inside the text object
4. Click Undo
TagsNo tags attached.
Patch

Relationships

duplicate of 0008993 closedale Undoing and redoing while editing text content 
duplicate of 0009568 closedplinnell [FEATURE SOLVED] undow for text frames 
has duplicate 0003915 closedcbradney Undo doesn't work in story editor 
has duplicate 0003954 closedcbradney No Undo within Textframe 
has duplicate 0005948 closed Edit:undo only involves object shape changes, no textual changes 
has duplicate 0006081 closedjghali Undo for tables is too coarse-grained 
has duplicate 0005302 closedchristoph_s copy page - undo - copy page doubles page contents 
has duplicate 0006810 closedjghali Undo doesn't undelete text 
has duplicate 0007013 closedjghali Undo CTRL + Z only for objects not for text 
has duplicate 0007657 closedjghali CTRL+Z (undo) does not undo text edits 
has duplicate 0007821 closedjghali Undo/Redo doesn't work on text 
has duplicate 0007845 closedjghali Pressing Ctrl-Z doesn't undo text scaling. 
has duplicate 0008065 closedjghali Undu in Text field 
has duplicate 0004264 closedTsoots loss of data after issuing undo on text frame edit more 
has duplicate 0009538 closedjghali no undo 
child of 0005745 closed Metabug: Undo/Redo issues 

Activities

cbradney

2006-02-28 09:57

administrator   ~0008950

Yes, we know, but thanks.

mhanski

2006-03-15 22:42

developer   ~0009309

Reminder sent to: user715

this is the issue about undo/redo you've mentioned on your list, adding you to it

mhanski

2006-03-15 22:46

developer   ~0009310

just tested with the 1.3.3cvs from last monday, Ctrl-X of some selected text in a text frame and subsequent Ctrl-Z triggers random crashes...

cezaryece

2010-11-26 18:20

updater  

text_undo.patch (4,558 bytes)   
Index: Scribus/scribus/pageitem.h
===================================================================
--- Scribus/scribus/pageitem.h	(wersja 15999)
+++ Scribus/scribus/pageitem.h	(kopia robocza)
@@ -1060,6 +1060,8 @@
 
 	void restoreShapeContour(UndoState *state, bool isUndo);
 	void restoreImageEffects(UndoState *state, bool isUndo);
+	void restoreEditText(SimpleState *state, bool isUndo);
+
 	/*@}*/
 
 	/**

Index: Scribus/scribus/pageitem.cpp
===================================================================
--- Scribus/scribus/pageitem.cpp	(wersja 15999)
+++ Scribus/scribus/pageitem.cpp	(kopia robocza)
@@ -60,6 +60,7 @@
 #include "scribusstructs.h"
 #include "scribuswin.h"
 #include "sctextstream.h"
+#include "serializer.h"
 #include "selection.h"
 #include "sclimits.h"
 #include "text/nlsconfig.h"
@@ -3209,6 +3210,9 @@
                        restoreShapeContour(ss, isUndo);
                else if (ss->contains("APPLY_IMAGE_EFFECTS"))
                        restoreImageEffects(ss, isUndo);
+		else if (ss->contains("STEXT"))
+			restoreEditText(ss, isUndo);
+
        }
        if (!OnMasterPage.isEmpty())
                m_Doc->setCurrentPage(oldCurrentPage);
@@ -3707,6 +3711,31 @@
        }
 }

+void PageItem::restoreEditText(SimpleState *state, bool isUndo)
+{
+	qDebug() << "EditText " << itemName() << "Undo " << isUndo;
+	if (!this->isTextFrame())
+		return;
+
+	if (isUndo)
+	{
+		QString buffer;
+		buffer.append(state->get("STEXT"));
+
+		Serializer dig(*m_Doc);
+		dig.store<ScribusDoc>("<scribusdoc>", m_Doc);
+		StoryText::desaxeRules("/", dig, "SCRIBUSTEXT");
+		dig.addRule("/SCRIBUSTEXT", desaxe::Result<StoryText>());
+qDebug() << buffer.toStdString().c_str();
+		dig.parseMemory(buffer.toStdString().c_str(), buffer.length());
+		StoryText* story = dig.result<StoryText>();
+		this->itemText.clear();
+		this->itemText.append(*story);
+		delete story;
+		invalidateLayout();
+	}
+}
+
 void PageItem::select()
 {
        m_Doc->view()->Deselect(false);
Index: Scribus/scribus/pageitem_textframe.cpp
===================================================================
--- Scribus/scribus/pageitem_textframe.cpp	(wersja 15812)
+++ Scribus/scribus/pageitem_textframe.cpp	(kopia robocza)
@@ -30,7 +30,11 @@
 #include <QRegion>
 #include <cassert>
 
+#include <iostream>
+#include <sstream>
+#include <string>
 
+
 #include "canvas.h"
 #include "commonstrings.h"
 #include "guidemanager.h"
@@ -45,7 +49,11 @@
 #include "scraction.h"
 #include "scribus.h"
 #include "scribusdoc.h"
+#include "scribusview.h"
 #include "scribusstructs.h"
+#include "scribusXml.h"
+#include "desaxe/saxXML.h"
+#include "serializer.h"
 #include "selection.h"
 #include "text/nlsconfig.h"
 #include "undomanager.h"
@@ -3555,4 +3563,23 @@
 void PageItem_TextFrame::slotInvalidateLayout()
 {
 	invalidateLayout();
+	if (UndoManager::undoEnabled())
+	{
+		StoryText iT(m_Doc);
+		iT.setDefaultStyle(itemText.defaultStyle());
+		iT.insert(0, itemText, false);
+
+		std::ostringstream xmlString;
+		SaxXML xmlStream(xmlString);
+		xmlStream.beginDoc();
+		iT.saxx(xmlStream, "SCRIBUSTEXT");
+		xmlStream.endDoc();
+		std::string xml(xmlString.str());
+
+		SimpleState* ss = new SimpleState(UndoManager::EditText);
+		ss->set("STEXT", QString(xml.c_str()));
+		ss->set("STEXT_LEN", int(xml.length()));
+		undoManager->action(this, ss);
+		setUName(itemName()); // set the name for the UndoObject too
+	}
 }
Index: Scribus/scribus/undomanager.cpp
===================================================================
--- Scribus/scribus/undomanager.cpp	(wersja 15812)
+++ Scribus/scribus/undomanager.cpp	(kopia robocza)
@@ -958,6 +958,7 @@
 	UndoManager::Copy               = tr("Copy");
 	UndoManager::CopyPage           = tr("Copy page");
 	UndoManager::ToOutlines         = tr("Convert to outlines");
+	UndoManager::EditText		= tr("Edit text");
 }
 
 void UndoManager::initIcons()
@@ -1158,6 +1159,7 @@
 QString UndoManager::Copy               = "";
 QString UndoManager::CopyPage           = "";
 QString UndoManager::ToOutlines         = "";
+QString UndoManager::EditText		 = "";
 
 /*** Icons for UndoObjects *******************************************/
 QPixmap *UndoManager::IImageFrame      = 0;
Index: Scribus/scribus/undomanager.h
===================================================================
--- Scribus/scribus/undomanager.h	(wersja 15812)
+++ Scribus/scribus/undomanager.h	(kopia robocza)
@@ -585,6 +585,7 @@
 	static QString Copy;
 	static QString CopyPage;
 	static QString ToOutlines;
+	static QString EditText;
 	/*@}*/
 
 	/**
text_undo.patch (4,558 bytes)   

cezaryece

2010-11-26 18:23

updater   ~0024899

Maybe it is one most wanted patch in Scribus history...

It is not perfect, even must be fixed (first Undo command does nothing, next working as expected), but now it is!

I have no time to deeply test it. So, you must to do it.

Patch is for 1.3.9 svn

Ejoy!

Issue History

Date Modified Username Field Change
2006-02-28 01:51 SnEptUne New Issue
2006-02-28 09:57 cbradney Note Added: 0008950
2006-03-01 01:55 avox Status new => assigned
2006-03-01 01:55 avox Assigned To => avox
2006-03-15 22:42 mhanski Note Added: 0009309
2006-03-15 22:46 mhanski Note Added: 0009310
2006-03-16 11:46 jo-hannes Relationship added child of 0003428
2006-06-14 20:52 cbradney Relationship added has duplicate 0003915
2006-06-30 18:41 cbradney Relationship added has duplicate 0003954
2006-06-30 21:15 jo-hannes Relationship added child of 0000023
2006-07-02 21:45 avox Relationship added child of 0003964
2007-01-26 02:46 avox Relationship deleted child of 0003964
2007-05-23 20:36 christoph_s Relationship added child of 0005745
2007-06-25 22:02 christoph_s Relationship added has duplicate 0005948
2007-08-08 20:50 jghali Relationship added has duplicate 0006081
2008-02-05 17:42 christoph_s Relationship added has duplicate 0005302
2008-02-08 17:08 avox Relationship deleted child of 0000023
2008-02-12 21:42 cbradney Relationship deleted child of 0003428
2008-02-26 18:18 jghali Relationship added has duplicate 0006810
2008-05-08 20:37 jghali Relationship added has duplicate 0007013
2008-12-12 19:32 jghali Relationship added has duplicate 0007657
2009-02-23 15:04 jghali Relationship added has duplicate 0007821
2009-03-05 21:20 jghali Relationship added has duplicate 0007845
2009-05-21 11:37 jghali Relationship added has duplicate 0008065
2009-12-10 23:49 jghali Relationship added has duplicate 0004264
2010-04-06 17:56 ale Relationship added duplicate of 0008993
2010-11-26 18:20 cezaryece File Added: text_undo.patch
2010-11-26 18:23 cezaryece Note Added: 0024899
2010-11-30 19:15 jghali Relationship added has duplicate 0009538
2011-02-09 17:42 cbradney Relationship added duplicate of 0009568
2011-02-09 17:42 cbradney Status assigned => resolved
2011-02-09 17:42 cbradney Fixed in Version => 1.4.0svn
2011-02-09 17:42 cbradney Resolution open => duplicate
2011-02-09 17:42 cbradney Assigned To avox => plinnell
2011-02-16 16:35 cbradney Status resolved => closed
2015-09-17 20:08 Kunda Category Story Editor / Text Frames => Story Ed/Txt Frames
2015-09-17 20:12 Kunda Category Story Ed/Txt Frames => Story Editor / Text Frames