r17915 by fschmid - Preview Mode: allow limited editing in preview mode.

scribus-commit scribus-commit at lists.scribus.net
Wed Nov 28 21:54:17 UTC 2012


Author: fschmid
Date: Wed Nov 28 21:54:17 2012
New Revision: 17915

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=17915
Log:
Preview Mode: allow limited editing in preview mode.

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

Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17915&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp (original)
+++ trunk/Scribus/scribus/canvas.cpp Wed Nov 28 21:54:17 2012
@@ -477,7 +477,7 @@
 			--currNr;
 			continue;
 		}
-		if (m_doc->drawAsPreview && !currItem->isAnnotation())
+		if ((m_doc->drawAsPreview && !m_doc->editOnPreview) && !currItem->isAnnotation())
 		{
 			--currNr;
 			continue;

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17915&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Wed Nov 28 21:54:17 2012
@@ -962,7 +962,7 @@
 		createContextMenu(NULL, mousePointDoc.x(), mousePointDoc.y());
 		return;
 	}
-	if ((GetItem(&currItem)) && (m->button() == Qt::RightButton) && (!m_doc->DragP) && (!m_doc->drawAsPreview))
+	if ((GetItem(&currItem)) && (m->button() == Qt::RightButton) && (!m_doc->DragP) && (!(m_doc->drawAsPreview && !m_doc->editOnPreview)))
 	{
 		createContextMenu(currItem, mousePointDoc.x(), mousePointDoc.y());
 		return;
@@ -1228,7 +1228,7 @@
 			m_doc->nodeEdit.finishTransaction(currItem);
 		}
 	}
-	if (m_doc->drawAsPreview)
+	if (m_doc->drawAsPreview && !m_doc->editOnPreview)
 	{
 		if (m_doc->m_Selection->count() == 1)
 		{
@@ -1415,7 +1415,7 @@
 			if ((m->modifiers() == SELECT_BENEATH) && m_canvas->frameHitTest(QPointF(mousePointDoc.x(),mousePointDoc.y()), currItem) >= 0)
 				m_doc->m_Selection->clear();
 			//CB: #7186: This was prependItem, does not seem to need to be anymore with current select code
-			if (m_doc->drawAsPreview)
+			if (m_doc->drawAsPreview && !m_doc->editOnPreview)
 				m_doc->m_Selection->clear();
 			m_doc->m_Selection->addItem(currItem);
 			if ( (m->modifiers() & SELECT_IN_GROUP) && (!currItem->isGroup()))

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17915&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Wed Nov 28 21:54:17 2012
@@ -11245,4 +11245,11 @@
 	symbolPalette->setEnabled(!doc->drawAsPreview);
 	inlinePalette->setEnabled(!doc->drawAsPreview);
 	undoPalette->setEnabled(!doc->drawAsPreview);
-}
+	propertiesPalette->setEnabled(!(doc->drawAsPreview && !doc->editOnPreview));
+	scrMenuMgr->setMenuEnabled("Edit", !doc->drawAsPreview);
+	scrMenuMgr->setMenuEnabled("Item", !doc->drawAsPreview);
+	scrMenuMgr->setMenuEnabled("Insert", !doc->drawAsPreview);
+	scrMenuMgr->setMenuEnabled("Page", !doc->drawAsPreview);
+	scrMenuMgr->setMenuEnabled("Extras", !doc->drawAsPreview);
+	HaveNewSel(-1);
+}

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17915&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Wed Nov 28 21:54:17 2012
@@ -288,6 +288,7 @@
 	Print_Options.firstUse = true;
 	drawAsPreview = false;
 	viewAsPreview = false;
+	editOnPreview = false;
 	previewVisual = -1;
 	dontResize = false;
 }
@@ -393,6 +394,7 @@
 	Print_Options.firstUse = true;
 	drawAsPreview = false;
 	viewAsPreview = false;
+	editOnPreview = false;
 	previewVisual = -1;
 	dontResize = false;
 }

Modified: trunk/Scribus/scribus/scribusdoc.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17915&path=/trunk/Scribus/scribus/scribusdoc.h
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.h (original)
+++ trunk/Scribus/scribus/scribusdoc.h Wed Nov 28 21:54:17 2012
@@ -1334,6 +1334,7 @@
 	bool DoDrawing;
 	bool drawAsPreview;
 	bool viewAsPreview;
+	bool editOnPreview;
 	int previewVisual;
 	struct OpenNodesList
 	{

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17915&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Wed Nov 28 21:54:17 2012
@@ -232,6 +232,13 @@
 	ic.addPixmap(loadIcon("previewOff.png"), QIcon::Normal, QIcon::Off);
 	ic.addPixmap(loadIcon("previewOn.png"), QIcon::Normal, QIcon::On);
 	previewToolbarButton->setIcon(ic);
+	editOnPreviewToolbarButton = new QToolButton(this);
+	editOnPreviewToolbarButton->setAutoRaise(OPTION_FLAT_BUTTON);
+	editOnPreviewToolbarButton->setCheckable(true);
+	QIcon ic3;
+	ic3.addPixmap(loadIcon("16/pointer.png"), QIcon::Normal, QIcon::Off);
+	ic3.addPixmap(loadIcon("16/pointer.png"), QIcon::Normal, QIcon::On);
+	editOnPreviewToolbarButton->setIcon(ic3);
 #else
 	zoomDefaultToolbarButton = new QPushButton(this);
 	zoomDefaultToolbarButton->setFocusPolicy(Qt::NoFocus);
@@ -262,6 +269,12 @@
 	previewToolbarButton->setAutoDefault( false );
 	previewToolbarButton->setFlat(OPTION_FLAT_BUTTON);
 	previewToolbarButton->setIcon(loadIcon("previewOn.png"));
+	editOnPreviewToolbarButton = new QPushButton(this);
+	editOnPreviewToolbarButton->setFocusPolicy(Qt::NoFocus);
+	editOnPreviewToolbarButton->setDefault( false );
+	editOnPreviewToolbarButton->setAutoDefault( false );
+	editOnPreviewToolbarButton->setFlat(OPTION_FLAT_BUTTON);
+	editOnPreviewToolbarButton->setIcon(loadIcon("previewOn.png"));
 #endif
 	cmsAdjustMenu = new QMenu();
 	idCmsAdjustMenu = cmsAdjustMenu->addAction( "Configure CMS...", this, SLOT(adjustCMS()));
@@ -328,6 +341,7 @@
 	connect(unitSwitcher, SIGNAL(activated(int)), this, SLOT(ChgUnit(int)));
 	connect(previewQualitySwitcher, SIGNAL(activated(int)), this, SLOT(changePreviewQuality(int)));
 	connect(previewToolbarButton, SIGNAL(clicked()), this, SLOT(togglePreview()));
+	connect(editOnPreviewToolbarButton, SIGNAL(clicked()), this, SLOT(togglePreviewEdit()));
 	connect(cmsToolbarButton, SIGNAL(clicked()), this, SLOT(toggleCMS()));
 	connect(visualMenu, SIGNAL(activated(int)), this, SLOT(switchPreviewVisual(int)));
 	connect(this, SIGNAL(HaveSel(int)), Doc, SLOT(selectionChanged()));
@@ -340,6 +354,7 @@
 	clockLabel = new ClockWidget(this, Doc);
 	clockLabel->setGeometry(m_vhRulerHW + 1, height() - m_vhRulerHW - 61, 60, 60);
 	clockLabel->setVisible(false);
+	editOnPreviewToolbarButton->hide();
 }
 
 ScribusView::~ScribusView()
@@ -376,6 +391,7 @@
 	cmsToolbarButton->setToolTip( tr("Enable/disable Color Management"));
 	idCmsAdjustMenu->setText( tr("Configure CMS..."));
 	previewToolbarButton->setToolTip( tr("Enable/disable the Preview Mode"));
+	editOnPreviewToolbarButton->setToolTip( tr("Enable/disable editing the Preview Mode"));
 	visualMenu->setToolTip( tr("Select the visual appearance of the display. You can choose between normal and several color blindness forms"));
 	disconnect(visualMenu, SIGNAL(activated(int)), this, SLOT(switchPreviewVisual(int)));
 	visualMenu->clear();
@@ -422,6 +438,12 @@
 	DrawNew();
 }
 
+void ScribusView::togglePreviewEdit()
+{
+	Doc->editOnPreview = !Doc->editOnPreview;
+	m_ScMW->setPreviewToolbar();
+}
+
 void ScribusView::togglePreview()
 {
 	this->requestMode(modeNormal);
@@ -429,14 +451,18 @@
 	undoManager->setUndoEnabled(false);
 	m_canvas->m_viewMode.viewAsPreview = !m_canvas->m_viewMode.viewAsPreview;
 	Doc->drawAsPreview = m_canvas->m_viewMode.viewAsPreview;
-	m_ScMW->propertiesPalette->setEnabled(!m_canvas->m_viewMode.viewAsPreview);
 	bool recalc = false;
+	Doc->editOnPreview = false;
+	editOnPreviewToolbarButton->setChecked(false);
 	if (m_canvas->m_viewMode.viewAsPreview)
 	{
+		editOnPreviewToolbarButton->show();
 		storedFramesShown = Doc->guidesPrefs().framesShown;
 		Doc->guidesPrefs().framesShown = false;
 		storedShowControls = Doc->guidesPrefs().showControls;
 		Doc->guidesPrefs().showControls = false;
+		m_canvas->m_viewMode.previewVisual = 0;
+		Doc->previewVisual = 0;
 		// warning popping up in case colour management and out-of-gamut-display are active
 		// as from #4346: Add a preview for daltonian - PV
 		if (Doc->HasCMS && Doc->Gamut)
@@ -446,6 +472,7 @@
 	}
 	else
 	{
+		editOnPreviewToolbarButton->hide();
 		Doc->guidesPrefs().framesShown = storedFramesShown;
 		Doc->guidesPrefs().showControls = storedShowControls;
 		disconnect(visualMenu, SIGNAL(activated(int)), this, SLOT(switchPreviewVisual(int)));

Modified: trunk/Scribus/scribus/scribusview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17915&path=/trunk/Scribus/scribus/scribusview.h
==============================================================================
--- trunk/Scribus/scribus/scribusview.h (original)
+++ trunk/Scribus/scribus/scribusview.h Wed Nov 28 21:54:17 2012
@@ -130,12 +130,14 @@
 	QToolButton *zoomInToolbarButton;
 	QToolButton *cmsToolbarButton;
 	QToolButton *previewToolbarButton;
+	QToolButton *editOnPreviewToolbarButton;
 #else
 	QPushButton *zoomDefaultToolbarButton;
 	QPushButton *zoomOutToolbarButton;
 	QPushButton *zoomInToolbarButton;
 	QPushButton *cmsToolbarButton;
 	QPushButton *previewToolbarButton;
+	QPushButton *editOnPreviewToolbarButton;
 #endif
 	QComboBox *layerMenu; //Menu for layers at bottom of view
 	QComboBox *unitSwitcher; //Menu for units at bottom of view
@@ -254,6 +256,7 @@
 	void languageChange();
 	void toggleCMS();
 	void switchPreviewVisual(int vis);
+	void togglePreviewEdit();
 	void togglePreview();
 	void unitChange();
 	void setRulersShown(bool isShown);

Modified: trunk/Scribus/scribus/scribuswin.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=17915&path=/trunk/Scribus/scribus/scribuswin.cpp
==============================================================================
--- trunk/Scribus/scribus/scribuswin.cpp (original)
+++ trunk/Scribus/scribus/scribuswin.cpp Wed Nov 28 21:54:17 2012
@@ -84,6 +84,7 @@
 	statusFrameLayout->addItem( spacer );
 	statusFrameLayout->addWidget(m_View->cmsToolbarButton);
 	statusFrameLayout->addWidget(m_View->previewToolbarButton);
+	statusFrameLayout->addWidget(m_View->editOnPreviewToolbarButton);
 	statusFrameLayout->addWidget(m_View->visualMenu);
 	statusBar()->addPermanentWidget(statusFrame, 4);
 	currentDir = QDir::currentPath();




More information about the scribus-commit mailing list