r16241 by fschmid - Removed some more references to the view from the pageitem and scribusdoc class.

scribus-commit scribus-commit at lists.scribus.net
Tue Jan 11 21:29:51 CET 2011


Author: fschmid
Date: Tue Jan 11 20:29:50 2011
New Revision: 16241

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16241
Log:
Removed some more references to the view from the pageitem and scribusdoc class.

Modified:
    trunk/Scribus/scribus/canvas.cpp
    trunk/Scribus/scribus/canvas.h
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusdoc.h
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16241&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp (original)
+++ trunk/Scribus/scribus/canvas.cpp Tue Jan 11 20:29:50 2011
@@ -114,7 +114,12 @@
 	m_renderMode = RENDER_NORMAL;
 }
 
-
+void Canvas::setPreviewVisual(int mode)
+{
+	m_viewMode.previewVisual = qMax(0, mode);
+	m_viewMode.viewAsPreview = (mode >= 0);
+
+}
 // ______________________________
 // Coordinate Conversion Routines:
 

Modified: trunk/Scribus/scribus/canvas.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16241&path=/trunk/Scribus/scribus/canvas.h
==============================================================================
--- trunk/Scribus/scribus/canvas.h (original)
+++ trunk/Scribus/scribus/canvas.h Tue Jan 11 20:29:50 2011
@@ -183,7 +183,7 @@
 	bool isPreviewMode() const { return m_viewMode.previewMode || m_viewMode.viewAsPreview; }
 	bool usePreviewVisual() const { return m_viewMode.viewAsPreview && m_viewMode.previewVisual != 0; }
 	int previewVisual() const { return m_viewMode.previewVisual; }
-	void setPreviewVisual(int mode) { m_viewMode.previewVisual = qMax(0, mode); m_viewMode.viewAsPreview = (mode >= 0); }
+	void setPreviewVisual(int mode);
 	
 	void DrawMasterItems(ScPainter *painter, Page *page, ScLayer& layer, QRect clip);
 	void DrawPageItems(ScPainter *painter, ScLayer& layer, QRect clip);

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16241&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Tue Jan 11 20:29:50 2011
@@ -2104,10 +2104,10 @@
 {
 	const ScColor& col = m_Doc->PageColors[farbe];
 	*tmp = ScColorEngine::getShadeColorProof(col, m_Doc, shad);
-	if ((m_Doc->view()) && (m_Doc->view()->m_canvas->usePreviewVisual()))
+	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		*tmp = defect.convertDefect(*tmp, m_Doc->view()->m_canvas->previewVisual());
+		*tmp = defect.convertDefect(*tmp, m_Doc->previewVisual);
 	}
 }
 
@@ -2610,10 +2610,10 @@
 	}
 	else
 		GrColorP1QColor = QColor(255, 255, 255, 0);
-	if ((m_Doc->view()) && (m_Doc->view()->m_canvas->usePreviewVisual()))
+	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		GrColorP1QColor = defect.convertDefect(GrColorP1QColor, m_Doc->view()->m_canvas->previewVisual());
+		GrColorP1QColor = defect.convertDefect(GrColorP1QColor, m_Doc->previewVisual);
 	}
 	GrColorP2 = col2;
 	if (GrColorP2 != CommonStrings::None)
@@ -2647,10 +2647,10 @@
 	}
 	else
 		GrColorP2QColor = QColor(255, 255, 255, 0);
-	if ((m_Doc->view()) && (m_Doc->view()->m_canvas->usePreviewVisual()))
+	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		GrColorP2QColor = defect.convertDefect(GrColorP2QColor, m_Doc->view()->m_canvas->previewVisual());
+		GrColorP2QColor = defect.convertDefect(GrColorP2QColor, m_Doc->previewVisual);
 	}
 	GrColorP3 = col3;
 	if (GrColorP3 != CommonStrings::None)
@@ -2684,10 +2684,10 @@
 	}
 	else
 		GrColorP3QColor = QColor(255, 255, 255, 0);
-	if ((m_Doc->view()) && (m_Doc->view()->m_canvas->usePreviewVisual()))
+	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		GrColorP3QColor = defect.convertDefect(GrColorP3QColor, m_Doc->view()->m_canvas->previewVisual());
+		GrColorP3QColor = defect.convertDefect(GrColorP3QColor, m_Doc->previewVisual);
 	}
 	GrColorP4 = col4;
 	if (GrColorP4 != CommonStrings::None)
@@ -2721,10 +2721,10 @@
 	}
 	else
 		GrColorP4QColor = QColor(255, 255, 255, 0);
-	if ((m_Doc->view()) && (m_Doc->view()->m_canvas->usePreviewVisual()))
+	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		GrColorP4QColor = defect.convertDefect(GrColorP4QColor, m_Doc->view()->m_canvas->previewVisual());
+		GrColorP4QColor = defect.convertDefect(GrColorP4QColor, m_Doc->previewVisual);
 	}
 }
 
@@ -2787,10 +2787,10 @@
 	}
 	else
 		MQColor = QColor(255, 255, 255, 0);
-	if ((m_Doc->view()) && (m_Doc->view()->m_canvas->usePreviewVisual()))
+	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		MQColor = defect.convertDefect(MQColor, m_Doc->view()->m_canvas->previewVisual());
+		MQColor = defect.convertDefect(MQColor, m_Doc->previewVisual);
 	}
 	if ((x > -1) && (y > -1))
 	{
@@ -2836,10 +2836,10 @@
 	}
 	else
 		MQColor = QColor(255, 255, 255, 0);
-	if ((m_Doc->view()) && (m_Doc->view()->m_canvas->usePreviewVisual()))
+	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		MQColor = defect.convertDefect(MQColor, m_Doc->view()->m_canvas->previewVisual());
+		MQColor = defect.convertDefect(MQColor, m_Doc->previewVisual);
 	}
 	meshGradientArray.clear();
 	double xoffs = Width / static_cast<double>(cols);
@@ -3354,10 +3354,10 @@
 		const ScColor& col = m_Doc->PageColors[lineColorVal];
 		strokeQColor = ScColorEngine::getShadeColorProof(col, m_Doc, lineShadeVal);
 	}
-	if ((m_Doc->view()) && (m_Doc->view()->m_canvas->usePreviewVisual()))
+	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		strokeQColor = defect.convertDefect(strokeQColor, m_Doc->view()->m_canvas->previewVisual());
+		strokeQColor = defect.convertDefect(strokeQColor, m_Doc->previewVisual);
 	}
 }
 
@@ -3391,10 +3391,10 @@
 		const ScColor& col = m_Doc->PageColors[fillColorVal];
 		fillQColor = ScColorEngine::getShadeColorProof(col, m_Doc, fillShadeVal);
 	}
-	if ((m_Doc->view()) && (m_Doc->view()->m_canvas->usePreviewVisual()))
+	if (m_Doc->viewAsPreview)
 	{
 		VisionDefectColor defect;
-		fillQColor = defect.convertDefect(fillQColor, m_Doc->view()->m_canvas->previewVisual());
+		fillQColor = defect.convertDefect(fillQColor, m_Doc->previewVisual);
 	}
 }
 
@@ -4189,42 +4189,19 @@
 	double   w = state->getDouble("NEW_RWIDTH");
 	double   h = state->getDouble("NEW_RHEIGHT");
 	int  stateCode = state->transactionCode;
-	bool redraw = ((stateCode != 1) && (stateCode != 3));;
-	//CB Commented out test code
-	//QRect oldR(getRedrawBounding(view->scale()));
-	//double mx = ox - x;
-	//double my = oy - y;
+	bool redraw = ((stateCode != 1) && (stateCode != 3));
 	if (isUndo)
 	{
-		/*Rot=ort;
-		Xpos+=mx;
-		Ypos+=my;
-		Width=ow;
-		Height=oh;*/
 		m_Doc->RotateItem(ort, this);
 		m_Doc->MoveItem(ox - Xpos, oy - Ypos, this, false);
 		m_Doc->SizeItem(ow, oh, this, false, true, redraw);
 	}
 	else
 	{
-		/*mx = -mx;
-		my = -my;
-		Rot=rt;
-		Xpos-=mx;
-		Ypos-=my;
-		Width=w;
-		Height=h;
-		*/
 		m_Doc->RotateItem(rt, this);
 		m_Doc->MoveItem(x - Xpos, y - Ypos, this, false);
 		m_Doc->SizeItem(w, h, this, false, true, redraw);
 	}
-	/*
-	m_Doc->setRedrawBounding(this);
-	QRect newR(getRedrawBounding(view->scale()));
-	view->updateContents(newR.unite(oldR));
-	OwnPage = m_Doc->OnPage(this);
-	*/
 	oldRot = Rot;
 	oldXpos = Xpos;
 	oldYpos = Ypos;
@@ -5857,7 +5834,7 @@
 	}
 	if (PictureIsAvailable)
 	{
-		if (m_Doc->view() && (m_Doc->view()->m_canvas->usePreviewVisual()))
+		if (m_Doc->viewAsPreview)
 		{
 			VisionDefectColor defect;
 			QColor tmpC;
@@ -5873,7 +5850,7 @@
 				{
 					rgb = *s;
 					tmpC.setRgb(rgb);
-					tmpC = defect.convertDefect(tmpC, m_Doc->view()->m_canvas->previewVisual());
+					tmpC = defect.convertDefect(tmpC, m_Doc->previewVisual);
 					a = qAlpha(rgb);
 					tmpC.getRgb(&r, &g, &b);
 					*s = qRgba(r, g, b, a);

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16241&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Tue Jan 11 20:29:50 2011
@@ -246,6 +246,8 @@
 	docPrefsData.pdfPrefs.useDocBleeds = true;
 	Print_Options.firstUse = true;
 	drawAsPreview = false;
+	viewAsPreview = false;
+	previewVisual = -1;
 }
 
 
@@ -337,6 +339,8 @@
 	docPrefsData.docSetupPrefs.pagePositioning=pagesSetup.pageArrangement;
 	Print_Options.firstUse = true;
 	drawAsPreview = false;
+	viewAsPreview = false;
+	previewVisual = -1;
 }
 
 
@@ -3759,10 +3763,10 @@
 		{
 			const ScColor& col = PageColors[cstops.at(cst)->name];
 			QColor tmp = ScColorEngine::getShadeColorProof(col, this, cstops.at(cst)->shade);
-			if ((view()) && (view()->m_canvas->usePreviewVisual()))
+			if (viewAsPreview)
 			{
 				VisionDefectColor defect;
-				tmp = defect.convertDefect(tmp, view()->m_canvas->previewVisual());
+				tmp = defect.convertDefect(tmp, previewVisual);
 			}
 			cstops.at(cst)->color = tmp;
 		}
@@ -7290,10 +7294,6 @@
 			connect(this, SIGNAL(firstSelectedItemType(int)), m_ScMW, SLOT(HaveNewSel(int)));
 			connect(autoSaveTimer, SIGNAL(timeout()), WinHan, SLOT(slotAutoSave()));
 		}
-//		connect(this, SIGNAL(refreshItem(PageItem*)), view(), SLOT(RefreshItem(PageItem*)));
-//		connect(this, SIGNAL(updateContents()), view(), SLOT(slotUpdateContents()));
-//		connect(this, SIGNAL(updateContents(const QRect&)), view(), SLOT(slotUpdateContents(const QRect&)));
-//		connect(this, SIGNAL(canvasAdjusted(double, double, double, double)), view(), SLOT(adjustCanvas(double, double, double, double)));
 	}
 }
 

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16241&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Tue Jan 11 20:29:50 2011
@@ -1170,6 +1170,8 @@
 	QWidget* WinHan;
 	bool DoDrawing;
 	bool drawAsPreview;
+	bool viewAsPreview;
+	int previewVisual;
 	struct OpenNodesList
 	{
 		int type;

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16241&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Tue Jan 11 20:29:50 2011
@@ -404,6 +404,8 @@
 void ScribusView::switchPreviewVisual(int vis)
 {
 	m_canvas->setPreviewVisual(vis);
+	Doc->viewAsPreview = m_canvas->usePreviewVisual();
+	Doc->previewVisual = m_canvas->previewVisual();
 	Doc->recalculateColors();
 	Doc->recalcPicturesRes();
 	DrawNew();




More information about the scribus-commit mailing list