r18590 by fschmid - Speed-up for switching from Preview-Mode to Normal Mode.

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 10 23:09:05 UTC 2013


Author: fschmid
Date: Sun Nov 10 23:09:05 2013
New Revision: 18590

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18590
Log:
Speed-up for switching from Preview-Mode to Normal Mode.

Modified:
    trunk/Scribus/scribus/canvasmode_normal.cpp
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/scribusview.h

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18590&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Sun Nov 10 23:09:05 2013
@@ -1326,6 +1326,7 @@
 
 void CanvasMode_Normal::handleCheckBoxPress(PageItem* currItem)
 {
+	m_view->m_AnnotChanged = true;
 	currItem->annotation().setOnState(true);
 	currItem->update();
 	if (currItem->annotation().ActionType() == Annotation::Action_JavaScript)
@@ -1344,6 +1345,7 @@
 
 void CanvasMode_Normal::handleRadioButtonPress(PageItem* currItem)
 {
+	m_view->m_AnnotChanged = true;
 	if (currItem->Parent != NULL)
 	{
 		PageItem *group = currItem->Parent->asGroupFrame();
@@ -1378,6 +1380,7 @@
 
 void CanvasMode_Normal::handleCheckBoxRelease(PageItem* currItem)
 {
+	m_view->m_AnnotChanged = true;
 	currItem->annotation().setOnState(false);
 	currItem->annotation().setCheckState(!currItem->annotation().IsChecked());
 	if (currItem->annotation().ActionType() == Annotation::Action_JavaScript)
@@ -1388,6 +1391,7 @@
 
 void CanvasMode_Normal::handlePushButtonRelease(PageItem* currItem)
 {
+	m_view->m_AnnotChanged = true;
 	currItem->annotation().setOnState(false);
 	currItem->update();
 	switch (currItem->annotation().ActionType())
@@ -1419,6 +1423,7 @@
 
 void CanvasMode_Normal::handleRadioButtonRelease(PageItem* currItem)
 {
+	m_view->m_AnnotChanged = true;
 	if (currItem->Parent != NULL)
 	{
 		PageItem *group = currItem->Parent->asGroupFrame();

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18590&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sun Nov 10 23:09:05 2013
@@ -443,6 +443,7 @@
 {
 	Doc->editOnPreview = !Doc->editOnPreview;
 	m_ScMW->setPreviewToolbar();
+	m_EditModeWasOn = true;
 	DrawNew();
 }
 
@@ -456,6 +457,9 @@
 	bool recalc = false;
 	Doc->editOnPreview = false;
 	editOnPreviewToolbarButton->setChecked(false);
+	m_AnnotChanged = false;
+	m_EditModeWasOn = false;
+	m_ChangedState = Doc->isModified();
 	if (m_canvas->m_viewMode.viewAsPreview)
 	{
 		editOnPreviewToolbarButton->show();
@@ -474,7 +478,8 @@
 	}
 	else
 	{
-		Doc->ResetFormFields();
+		if (m_AnnotChanged)
+			Doc->ResetFormFields();
 		editOnPreviewToolbarButton->hide();
 		Doc->guidesPrefs().framesShown = storedFramesShown;
 		Doc->guidesPrefs().showControls = storedShowControls;
@@ -511,6 +516,8 @@
 	if (docPtr) // document may have been destroyed in-between
 	{
 		DrawNew();
+		if ((!m_EditModeWasOn) && (!m_AnnotChanged))
+			Doc->setModified(m_ChangedState);
 	}
 	undoManager->setUndoEnabled(true);
 }

Modified: trunk/Scribus/scribus/scribusview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18590&path=/trunk/Scribus/scribus/scribusview.h
==============================================================================
--- trunk/Scribus/scribus/scribusview.h (original)
+++ trunk/Scribus/scribus/scribusview.h Sun Nov 10 23:09:05 2013
@@ -174,6 +174,9 @@
 	int editStrokeGradient;
 	int redrawMode;
 	int redrawCount;
+	bool m_AnnotChanged;
+	bool m_EditModeWasOn;
+	bool m_ChangedState;
 	PageItem *redrawItem;
 	SelectionRubberBand *redrawMarker;
 	FPoint RCenter;




More information about the scribus-commit mailing list