View Issue Details

IDProjectCategoryView StatusLast Update
0017284ScribusCanvaspublic2024-10-23 18:42
Reporternitramr Assigned Tonitramr  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
PlatformDesktop PCOSUbuntuOS Version24.04 64-bit
Fixed in Version1.7.0.svn 
Summary0017284: Implement white space review view mode
DescriptionI would like a review mode to make the white space between words more visible.
This can help to find white spaces that are too large more quickly.

I could imagine that this is a new view mode that resizes all text frames equally.

The image below shows what this view mode could look like. I manually simulated it in Scribus by setting a black background color for all words. The view mode could simply render the glyph box instead of the glyphs.

It should be possible to continue editing the contents of a text frame.
TagsNo tags attached.
PatchNo

Activities

nitramr

2024-10-06 11:35

developer  

utnik

2024-10-06 19:47

updater   ~0051413

needs a shortcut to switch it on and off, as you can't really edit the text (i.e. hyphenation) in this 'black box view'. but with the shortcut i would use it.

ale

2024-10-07 18:19

manager   ~0051414

well, if it gets a good name, it's not that hard to trigger it with the action search.

... and it's not that hard to add a shortcut either : - )

nitramr

2024-10-07 22:03

developer   ~0051417

Patch is ready for testing. I didn't specify a shortcut yet. But if you prefer one, you can define it by yourself in Scribus preferences: "Keyboard Shortcuts -> View -> Toggle White Space Review Mode".
And there is a new button in preview toolbar (the icon is just a placeholder)

At the moment there is a render issue for Japanese glyphs and I don't know what is the reason for it.
whitespace_2024-10-07_01.patch (10,050 bytes)   
Index: scribus/actionmanager.cpp
===================================================================
--- scribus/actionmanager.cpp	(Revision 26313)
+++ scribus/actionmanager.cpp	(Arbeitskopie)
@@ -679,6 +679,8 @@
 	scrActions->insert(name, new ScrAction("16/editdoc.png", "16/editdoc.png", "", defaultKey(name), mainWindow));
 	name = "viewToggleCMS";
 	scrActions->insert(name, new ScrAction("cmsOn.png", "cmsOn.png", "", defaultKey(name), mainWindow));
+	name = "viewToggleWhiteSpaceMode";
+	scrActions->insert(name, new ScrAction("16/format-justify-left.png", "16/format-justify-left.png", "", defaultKey(name), mainWindow));
 	name = "viewShowMargins";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name = "viewShowBleeds";
@@ -729,6 +731,7 @@
 	(*scrActions)["viewPreviewMode"]->setToggleAction(true);
 	(*scrActions)["viewEditInPreview"]->setToggleAction(true);
 	(*scrActions)["viewToggleCMS"]->setToggleAction(true);
+	(*scrActions)["viewToggleWhiteSpaceMode"]->setToggleAction(true);
 	(*scrActions)["viewShowMargins"]->setToggleAction(true);
 	(*scrActions)["viewShowBleeds"]->setToggleAction(true);
 	(*scrActions)["viewShowFrames"]->setToggleAction(true);
@@ -749,6 +752,7 @@
 
 	(*scrActions)["viewPreviewMode"]->setChecked(false);
 	(*scrActions)["viewEditInPreview"]->setChecked(false);
+	(*scrActions)["viewToggleWhiteSpaceMode"]->setChecked(false);
 	(*scrActions)["viewToggleCMS"]->setChecked(false);
 	(*scrActions)["viewShowMargins"]->setChecked(true);
 	(*scrActions)["viewShowBleeds"]->setChecked(true);
@@ -1305,6 +1309,7 @@
 	//qDebug()<<"disconnectNewViewActions"<<mainWindow->doc->DocName;
 	(*scrActions)["viewPreviewMode"]->disconnect();
 	(*scrActions)["viewEditInPreview"]->disconnect();
+	(*scrActions)["viewToggleWhiteSpaceMode"]->disconnect();
 	(*scrActions)["viewToggleCMS"]->disconnect();
 	(*scrActions)["toolsZoomIn"]->disconnect();
 	(*scrActions)["toolsZoomOut"]->disconnect();
@@ -1329,6 +1334,7 @@
 	//qDebug()<<"connectNewViewActions"<<currView->Doc->DocName;
 	connect( (*scrActions)["viewPreviewMode"], SIGNAL(toggled(bool)), currView, SLOT(togglePreview(bool)) );
 	connect( (*scrActions)["viewEditInPreview"], SIGNAL(toggled(bool)), currView, SLOT(togglePreviewEdit(bool)) );
+	connect( (*scrActions)["viewToggleWhiteSpaceMode"], SIGNAL(toggled(bool)), currView, SLOT(toggleWhiteSpaceMode(bool)) );
 	connect( (*scrActions)["viewToggleCMS"], SIGNAL(toggled(bool)), currView, SLOT(toggleCMS(bool)));
 	connect( (*scrActions)["toolsZoomIn"], SIGNAL(triggered()) , currView, SLOT(slotZoomIn()) );
 	connect( (*scrActions)["toolsZoomOut"], SIGNAL(triggered()) , currView, SLOT(slotZoomOut()) );
@@ -1666,6 +1672,7 @@
 	(*scrActions)["viewFit400"]->setTexts( tr("&400%"));
 	(*scrActions)["viewPreviewMode"]->setTexts( tr("Preview Mode"));
 	(*scrActions)["viewEditInPreview"]->setTexts( tr("Edit in Preview Mode") );
+	(*scrActions)["viewToggleWhiteSpaceMode"]->setTexts( tr("Toggle White Space Review Mode") );
 	(*scrActions)["viewToggleCMS"]->setTexts( tr("Toggle Color Management System"));
 	(*scrActions)["viewShowMargins"]->setTexts( tr("Show &Margins"));
 	(*scrActions)["viewShowBleeds"]->setTexts( tr("Show Bleeds"));
@@ -1822,6 +1829,7 @@
 	(*scrActions)["toolsZoom"]->setStatusTextAndShortcut( tr("Zoom in or out"));
 	(*scrActions)["viewPreviewMode"]->setStatusTextAndShortcut( tr("Enable preview mode"));
 	(*scrActions)["viewEditInPreview"]->setStatusTextAndShortcut( tr("Enable editing in preview mode"));
+	(*scrActions)["viewToggleWhiteSpaceMode"]->setStatusTextAndShortcut( tr("Toggle white space review mode"));
 	(*scrActions)["viewToggleCMS"]->setStatusTextAndShortcut( tr("Toggle color management system"));
 #ifdef HAVE_OSG
 	(*scrActions)["toolsPDFAnnot3D"]->setStatusTextAndShortcut( tr("Insert 3D annotation"));
@@ -2327,6 +2335,7 @@
 		<< "viewPreviewMode"
 		<< "viewEditInPreview"
 		<< "viewToggleCMS"
+		<< "viewToggleWhiteSpaceMode"
 		<< "viewShowMargins"
 		<< "viewShowBleeds"
 		<< "viewShowFrames"
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(Revision 26313)
+++ scribus/scribus.cpp	(Arbeitskopie)
@@ -1241,6 +1241,7 @@
 	scrMenuMgr->createMenu("ViewPreview", tr("Preview"), "View");
 	scrMenuMgr->addMenuItemString("ViewPreview", "View");
 	scrMenuMgr->addMenuItemString("viewPreviewMode", "ViewPreview");
+	scrMenuMgr->addMenuItemString("viewToggleWhiteSpaceMode", "ViewPreview");
 	scrMenuMgr->createMenu("ViewMeasuring", tr("Measurement"), "View");
 	scrMenuMgr->addMenuItemString("ViewMeasuring", "View");
 	scrMenuMgr->addMenuItemString("viewShowRulers", "ViewMeasuring");
@@ -2458,6 +2459,9 @@
 		scrActions["viewToggleCMS"]->blockSignals(true);
 		scrActions["viewToggleCMS"]->setChecked(doc->HasCMS);
 		scrActions["viewToggleCMS"]->blockSignals(false);
+		scrActions["viewToggleWhiteSpaceMode"]->blockSignals(true);
+		scrActions["viewToggleWhiteSpaceMode"]->setChecked(doc->toggleWhiteSpaceMode);
+		scrActions["viewToggleWhiteSpaceMode"]->blockSignals(false);
 		viewToolBar->previewQualitySwitcher->setCurrentIndex(doc->previewQuality());
 		connect(viewToolBar->previewQualitySwitcher, SIGNAL(activated(int)), this, SLOT(changePreviewQuality(int)));
 		viewToolBar->visualMenu->setCurrentIndex(doc->previewVisual);
@@ -3704,6 +3708,7 @@
 		emit UpdateRequest(reqNumUpdate);
 		doc->setCurrentPage(doc->DocPages.at(0));
 		scrActions["viewToggleCMS"]->setChecked(doc->HasCMS);
+		scrActions["viewToggleWhiteSpaceMode"]->setChecked(doc->toggleWhiteSpaceMode);
 		view->zoom();
 		view->GotoPage(0);
 		connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(newActWin(QMdiSubWindow*)));
@@ -4251,6 +4256,7 @@
 	mainWindowYPosDataLabel->clear();
 	//not running view's togglePreview as we don't want to affect the doc settings.
 	scrActions["viewPreviewMode"]->setChecked(false);
+	scrActions["viewToggleWhiteSpaceMode"]->setChecked(false);
 	appModeHelper->setPreviewMode(false);
 	return true;
 }
@@ -6646,6 +6652,7 @@
 	scrActions["extrasGenerateTableOfContents"]->setEnabled(doc->hasTOCSetup());
 	scrActions["extrasUpdateDocument"]->setEnabled(true);
 	scrActions["viewToggleCMS"]->setChecked(doc->HasCMS);
+	scrActions["viewToggleWhiteSpaceMode"]->setChecked(doc->toggleWhiteSpaceMode);
 	view->setRulersShown(doc->guidesPrefs().rulersShown);
 	//doc emits changed() via this
 	doc->setMasterPageMode(true);
@@ -7589,6 +7596,11 @@
 		view->togglePreview(false);
 		scrActions["viewPreviewMode"]->setChecked(false);
 	}
+	if (doc->toggleWhiteSpaceMode)
+	{
+		view->toggleWhiteSpaceMode(false);
+		scrActions["viewToggleWhiteSpaceMode"]->setChecked(false);
+	}
 	m_WasAutoSave = doc->autoSave();
 	if (m_WasAutoSave)
 	{
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(Revision 26313)
+++ scribus/scribusdoc.h	(Arbeitskopie)
@@ -1461,7 +1461,8 @@
 	QWidget* WinHan {nullptr};
 	bool DoDrawing {true};
 	bool drawAsPreview {false};
-	bool viewAsPreview {false};
+	bool viewAsPreview {false};	
+	bool toggleWhiteSpaceMode {false};
 	bool editOnPreview {false};
 	int previewVisual {0};
 	struct OpenNodesList
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp	(Revision 26313)
+++ scribus/scribusview.cpp	(Arbeitskopie)
@@ -272,6 +272,12 @@
 	DrawNew();
 }
 
+void ScribusView::toggleWhiteSpaceMode(bool inReview)
+{
+	m_doc->toggleWhiteSpaceMode = inReview;
+	DrawNew();
+}
+
 void ScribusView::togglePreview(bool inPreview)
 {
 	this->requestMode(modeNormal);
Index: scribus/scribusview.h
===================================================================
--- scribus/scribusview.h	(Revision 26313)
+++ scribus/scribusview.h	(Arbeitskopie)
@@ -252,6 +252,7 @@
 	void toggleCMS(bool cmsOn);
 	void switchPreviewVisual(int vis);
 	void togglePreviewEdit(bool edit);
+	void toggleWhiteSpaceMode(bool inReview);
 	void togglePreview(bool inPreview);
 	void unitChange();
 	void setRulersShown(bool isShown);
Index: scribus/text/boxes.cpp
===================================================================
--- scribus/text/boxes.cpp	(Revision 26313)
+++ scribus/text/boxes.cpp	(Arbeitskopie)
@@ -598,6 +598,19 @@
 	p->setFont(font);
 	p->setFontSize(fontSize);
 
+	if (p->glyphBoxRendering())
+	{
+		if (!this->m_glyphRun.isSpace())
+		{
+			p->setFillColor(TextLayoutColor("Black", 100.0));
+			p->setStrokeColor(TextLayoutColor(CommonStrings::None, 0));
+			QRectF rect(x(), -ascent(), width(), height());
+			p->drawRect(rect);
+		}
+		p->restore();
+		return;
+	}
+
 	p->translate(x() + m_glyphRun.xoffset, y() + m_glyphRun.yoffset);
 
 	p->setMatrix(m_matrix);
Index: scribus/text/textlayoutpainter.cpp
===================================================================
--- scribus/text/textlayoutpainter.cpp	(Revision 26313)
+++ scribus/text/textlayoutpainter.cpp	(Arbeitskopie)
@@ -66,6 +66,16 @@
 	return m_stack.top().strokeWidth;
 }
 
+void TextLayoutPainter::setGlyphBoxRendering(bool r)
+{
+	m_glyphBoxRendering = r;
+}
+
+bool TextLayoutPainter::glyphBoxRendering()
+{
+	return m_glyphBoxRendering;
+}
+
 void TextLayoutPainter::translate(double x, double y)
 {
 	m_stack.top().x += x;
Index: scribus/text/textlayoutpainter.h
===================================================================
--- scribus/text/textlayoutpainter.h	(Revision 26313)
+++ scribus/text/textlayoutpainter.h	(Arbeitskopie)
@@ -81,6 +81,11 @@
 	/// The current width for line strokes.
 	virtual double strokeWidth() const;
 
+	/// Sets the current render mode for glyph boxes only.
+	virtual void setGlyphBoxRendering(bool r);
+	/// The current render mode for glyph boxes only.
+	virtual bool glyphBoxRendering();
+
 	/// Moves the current x and y positions by the specified amount.
 	virtual void translate(double x, double y);
 	/// The current x positions.
@@ -159,6 +164,7 @@
 	};
 
 	std::stack<State> m_stack;
+	bool m_glyphBoxRendering {false};
 };
 
 #endif // TEXTLAYOUTPAINTER_H


whitespace_2024-10-07_01.patch (10,050 bytes)   

utnik

2024-10-07 22:22

updater   ~0051418

as i don't compile my own versions, i can't test it before it is applied and craig b. ships a new version for mac os.
but i will do it as soon possible…

nitramr

2024-10-08 21:02

developer   ~0051419

I could fix the issue for Japanese characters. Looks like they count as space. I add a second condition and now it works. In addition, I made a new icon and added some missing code in the new patch file.

nitramr

2024-10-08 21:11

developer   ~0051420

whitespace_2024-10-08_02.patch (12,228 bytes)   
Index: resources/iconsets/1_7_0/1_7_0.xml
===================================================================
--- resources/iconsets/1_7_0/1_7_0.xml	(Revision 26313)
+++ resources/iconsets/1_7_0/1_7_0.xml	(Arbeitskopie)
@@ -150,6 +150,7 @@
 		<icon id="context-menu" file="16/action-menu.svg" />
 		<icon id="scale-width" file="16/action-scale-width.svg" />
 		<icon id="scale-height" file="16/action-scale-height.svg" />
+		<icon id="whitespace-review-mode" file="16/action-whitespace-review.svg" />
 			
 		<!-- Alerts -->
 		<icon onLight="#E54545" onDark="#FF6666" id="22/dialog-error.png" file="16/alert-error.svg" />
Index: scribus/actionmanager.cpp
===================================================================
--- scribus/actionmanager.cpp	(Revision 26313)
+++ scribus/actionmanager.cpp	(Arbeitskopie)
@@ -679,6 +679,8 @@
 	scrActions->insert(name, new ScrAction("16/editdoc.png", "16/editdoc.png", "", defaultKey(name), mainWindow));
 	name = "viewToggleCMS";
 	scrActions->insert(name, new ScrAction("cmsOn.png", "cmsOn.png", "", defaultKey(name), mainWindow));
+	name = "viewToggleWhiteSpaceMode";
+	scrActions->insert(name, new ScrAction("whitespace-review-mode", "whitespace-review-mode", "", defaultKey(name), mainWindow));
 	name = "viewShowMargins";
 	scrActions->insert(name, new ScrAction("", defaultKey(name), mainWindow));
 	name = "viewShowBleeds";
@@ -729,6 +731,7 @@
 	(*scrActions)["viewPreviewMode"]->setToggleAction(true);
 	(*scrActions)["viewEditInPreview"]->setToggleAction(true);
 	(*scrActions)["viewToggleCMS"]->setToggleAction(true);
+	(*scrActions)["viewToggleWhiteSpaceMode"]->setToggleAction(true);
 	(*scrActions)["viewShowMargins"]->setToggleAction(true);
 	(*scrActions)["viewShowBleeds"]->setToggleAction(true);
 	(*scrActions)["viewShowFrames"]->setToggleAction(true);
@@ -749,6 +752,7 @@
 
 	(*scrActions)["viewPreviewMode"]->setChecked(false);
 	(*scrActions)["viewEditInPreview"]->setChecked(false);
+	(*scrActions)["viewToggleWhiteSpaceMode"]->setChecked(false);
 	(*scrActions)["viewToggleCMS"]->setChecked(false);
 	(*scrActions)["viewShowMargins"]->setChecked(true);
 	(*scrActions)["viewShowBleeds"]->setChecked(true);
@@ -1305,6 +1309,7 @@
 	//qDebug()<<"disconnectNewViewActions"<<mainWindow->doc->DocName;
 	(*scrActions)["viewPreviewMode"]->disconnect();
 	(*scrActions)["viewEditInPreview"]->disconnect();
+	(*scrActions)["viewToggleWhiteSpaceMode"]->disconnect();
 	(*scrActions)["viewToggleCMS"]->disconnect();
 	(*scrActions)["toolsZoomIn"]->disconnect();
 	(*scrActions)["toolsZoomOut"]->disconnect();
@@ -1329,6 +1334,7 @@
 	//qDebug()<<"connectNewViewActions"<<currView->Doc->DocName;
 	connect( (*scrActions)["viewPreviewMode"], SIGNAL(toggled(bool)), currView, SLOT(togglePreview(bool)) );
 	connect( (*scrActions)["viewEditInPreview"], SIGNAL(toggled(bool)), currView, SLOT(togglePreviewEdit(bool)) );
+	connect( (*scrActions)["viewToggleWhiteSpaceMode"], SIGNAL(toggled(bool)), currView, SLOT(toggleWhiteSpaceMode(bool)) );
 	connect( (*scrActions)["viewToggleCMS"], SIGNAL(toggled(bool)), currView, SLOT(toggleCMS(bool)));
 	connect( (*scrActions)["toolsZoomIn"], SIGNAL(triggered()) , currView, SLOT(slotZoomIn()) );
 	connect( (*scrActions)["toolsZoomOut"], SIGNAL(triggered()) , currView, SLOT(slotZoomOut()) );
@@ -1666,6 +1672,7 @@
 	(*scrActions)["viewFit400"]->setTexts( tr("&400%"));
 	(*scrActions)["viewPreviewMode"]->setTexts( tr("Preview Mode"));
 	(*scrActions)["viewEditInPreview"]->setTexts( tr("Edit in Preview Mode") );
+	(*scrActions)["viewToggleWhiteSpaceMode"]->setTexts( tr("Toggle White Space Review Mode") );
 	(*scrActions)["viewToggleCMS"]->setTexts( tr("Toggle Color Management System"));
 	(*scrActions)["viewShowMargins"]->setTexts( tr("Show &Margins"));
 	(*scrActions)["viewShowBleeds"]->setTexts( tr("Show Bleeds"));
@@ -1822,6 +1829,7 @@
 	(*scrActions)["toolsZoom"]->setStatusTextAndShortcut( tr("Zoom in or out"));
 	(*scrActions)["viewPreviewMode"]->setStatusTextAndShortcut( tr("Enable preview mode"));
 	(*scrActions)["viewEditInPreview"]->setStatusTextAndShortcut( tr("Enable editing in preview mode"));
+	(*scrActions)["viewToggleWhiteSpaceMode"]->setStatusTextAndShortcut( tr("Toggle white space review mode"));
 	(*scrActions)["viewToggleCMS"]->setStatusTextAndShortcut( tr("Toggle color management system"));
 #ifdef HAVE_OSG
 	(*scrActions)["toolsPDFAnnot3D"]->setStatusTextAndShortcut( tr("Insert 3D annotation"));
@@ -2327,6 +2335,7 @@
 		<< "viewPreviewMode"
 		<< "viewEditInPreview"
 		<< "viewToggleCMS"
+		<< "viewToggleWhiteSpaceMode"
 		<< "viewShowMargins"
 		<< "viewShowBleeds"
 		<< "viewShowFrames"
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(Revision 26313)
+++ scribus/scribus.cpp	(Arbeitskopie)
@@ -1241,6 +1241,7 @@
 	scrMenuMgr->createMenu("ViewPreview", tr("Preview"), "View");
 	scrMenuMgr->addMenuItemString("ViewPreview", "View");
 	scrMenuMgr->addMenuItemString("viewPreviewMode", "ViewPreview");
+	scrMenuMgr->addMenuItemString("viewToggleWhiteSpaceMode", "ViewPreview");
 	scrMenuMgr->createMenu("ViewMeasuring", tr("Measurement"), "View");
 	scrMenuMgr->addMenuItemString("ViewMeasuring", "View");
 	scrMenuMgr->addMenuItemString("viewShowRulers", "ViewMeasuring");
@@ -2458,6 +2459,9 @@
 		scrActions["viewToggleCMS"]->blockSignals(true);
 		scrActions["viewToggleCMS"]->setChecked(doc->HasCMS);
 		scrActions["viewToggleCMS"]->blockSignals(false);
+		scrActions["viewToggleWhiteSpaceMode"]->blockSignals(true);
+		scrActions["viewToggleWhiteSpaceMode"]->setChecked(doc->toggleWhiteSpaceMode);
+		scrActions["viewToggleWhiteSpaceMode"]->blockSignals(false);
 		viewToolBar->previewQualitySwitcher->setCurrentIndex(doc->previewQuality());
 		connect(viewToolBar->previewQualitySwitcher, SIGNAL(activated(int)), this, SLOT(changePreviewQuality(int)));
 		viewToolBar->visualMenu->setCurrentIndex(doc->previewVisual);
@@ -3704,6 +3708,7 @@
 		emit UpdateRequest(reqNumUpdate);
 		doc->setCurrentPage(doc->DocPages.at(0));
 		scrActions["viewToggleCMS"]->setChecked(doc->HasCMS);
+		scrActions["viewToggleWhiteSpaceMode"]->setChecked(doc->toggleWhiteSpaceMode);
 		view->zoom();
 		view->GotoPage(0);
 		connect(mdiArea, SIGNAL(subWindowActivated(QMdiSubWindow*)), this, SLOT(newActWin(QMdiSubWindow*)));
@@ -4251,6 +4256,7 @@
 	mainWindowYPosDataLabel->clear();
 	//not running view's togglePreview as we don't want to affect the doc settings.
 	scrActions["viewPreviewMode"]->setChecked(false);
+	scrActions["viewToggleWhiteSpaceMode"]->setChecked(false);
 	appModeHelper->setPreviewMode(false);
 	return true;
 }
@@ -6646,6 +6652,7 @@
 	scrActions["extrasGenerateTableOfContents"]->setEnabled(doc->hasTOCSetup());
 	scrActions["extrasUpdateDocument"]->setEnabled(true);
 	scrActions["viewToggleCMS"]->setChecked(doc->HasCMS);
+	scrActions["viewToggleWhiteSpaceMode"]->setChecked(doc->toggleWhiteSpaceMode);
 	view->setRulersShown(doc->guidesPrefs().rulersShown);
 	//doc emits changed() via this
 	doc->setMasterPageMode(true);
@@ -7589,6 +7596,11 @@
 		view->togglePreview(false);
 		scrActions["viewPreviewMode"]->setChecked(false);
 	}
+	if (doc->toggleWhiteSpaceMode)
+	{
+		view->toggleWhiteSpaceMode(false);
+		scrActions["viewToggleWhiteSpaceMode"]->setChecked(false);
+	}
 	m_WasAutoSave = doc->autoSave();
 	if (m_WasAutoSave)
 	{
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(Revision 26313)
+++ scribus/scribusdoc.h	(Arbeitskopie)
@@ -1461,7 +1461,8 @@
 	QWidget* WinHan {nullptr};
 	bool DoDrawing {true};
 	bool drawAsPreview {false};
-	bool viewAsPreview {false};
+	bool viewAsPreview {false};	
+	bool toggleWhiteSpaceMode {false};
 	bool editOnPreview {false};
 	int previewVisual {0};
 	struct OpenNodesList
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp	(Revision 26313)
+++ scribus/scribusview.cpp	(Arbeitskopie)
@@ -272,6 +272,12 @@
 	DrawNew();
 }
 
+void ScribusView::toggleWhiteSpaceMode(bool inReview)
+{
+	m_doc->toggleWhiteSpaceMode = inReview;
+	DrawNew();
+}
+
 void ScribusView::togglePreview(bool inPreview)
 {
 	this->requestMode(modeNormal);
Index: scribus/scribusview.h
===================================================================
--- scribus/scribusview.h	(Revision 26313)
+++ scribus/scribusview.h	(Arbeitskopie)
@@ -252,6 +252,7 @@
 	void toggleCMS(bool cmsOn);
 	void switchPreviewVisual(int vis);
 	void togglePreviewEdit(bool edit);
+	void toggleWhiteSpaceMode(bool inReview);
 	void togglePreview(bool inPreview);
 	void unitChange();
 	void setRulersShown(bool isShown);
Index: scribus/text/boxes.cpp
===================================================================
--- scribus/text/boxes.cpp	(Revision 26313)
+++ scribus/text/boxes.cpp	(Arbeitskopie)
@@ -209,7 +209,8 @@
 {
 	p->translate(x(), y());
 
-	drawBackGround(p);
+	if (!p->glyphBoxRendering())
+		drawBackGround(p);
 
 	p->translate(0, ascent());
 	for (const Box *box : boxes())
@@ -224,7 +225,8 @@
 {
 	p->translate(x(), y());
 
-	drawBackGround(p);
+	if (!p->glyphBoxRendering())
+		drawBackGround(p);
 	drawSelection(p, ctx);
 
 	p->translate(0, ascent());
@@ -598,6 +600,20 @@
 	p->setFont(font);
 	p->setFontSize(fontSize);
 
+	if (p->glyphBoxRendering())
+	{
+		if (this->m_glyphRun.getText() != " " || !this->m_glyphRun.isSpace())
+		{
+			p->setFillColor(TextLayoutColor("Black", 100.0));
+			p->setStrokeColor(TextLayoutColor(CommonStrings::None, 0));
+			QRectF rect(x(), -ascent(), width(), height());
+			p->drawRect(rect);
+		}
+		p->restore();
+		return;
+	}
+
 	p->translate(x() + m_glyphRun.xoffset, y() + m_glyphRun.yoffset);
 
 	p->setMatrix(m_matrix);
Index: scribus/text/textlayoutpainter.cpp
===================================================================
--- scribus/text/textlayoutpainter.cpp	(Revision 26313)
+++ scribus/text/textlayoutpainter.cpp	(Arbeitskopie)
@@ -66,6 +66,16 @@
 	return m_stack.top().strokeWidth;
 }
 
+void TextLayoutPainter::setGlyphBoxRendering(bool r)
+{
+	m_glyphBoxRendering = r;
+}
+
+bool TextLayoutPainter::glyphBoxRendering()
+{
+	return m_glyphBoxRendering;
+}
+
 void TextLayoutPainter::translate(double x, double y)
 {
 	m_stack.top().x += x;
 Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp	(Revision 26313)
+++ scribus/pageitem_textframe.cpp	(Arbeitskopie)
@@ -3549,8 +3549,10 @@
 		int sm = p->strokeMode();
 		p->setFillMode(ScPainter::Solid);
 		p->setStrokeMode(ScPainter::Solid);
-		ScreenPainter painter(p, this);
-		textLayout.renderBackground(&painter);
+		ScreenPainter painter(p, this);		
+		painter.setGlyphBoxRendering(m_Doc->toggleWhiteSpaceMode);
+		if (!m_Doc->toggleWhiteSpaceMode)
+			textLayout.renderBackground(&painter);
 		textLayout.render(&painter, this);
 		p->setFillMode(fm);
 		p->setStrokeMode(sm);
Index: scribus/text/textlayoutpainter.h
===================================================================
--- scribus/text/textlayoutpainter.h	(Revision 26313)
+++ scribus/text/textlayoutpainter.h	(Arbeitskopie)
@@ -81,6 +81,11 @@
 	/// The current width for line strokes.
 	virtual double strokeWidth() const;
 
+	/// Sets the current render mode for glyph boxes only.
+	virtual void setGlyphBoxRendering(bool r);
+	/// The current render mode for glyph boxes only.
+	virtual bool glyphBoxRendering();
+
 	/// Moves the current x and y positions by the specified amount.
 	virtual void translate(double x, double y);
 	/// The current x positions.
@@ -159,6 +164,7 @@
 	};
 
 	std::stack<State> m_stack;
+	bool m_glyphBoxRendering {false};
 };
 
 #endif // TEXTLAYOUTPAINTER_H

Index: scribus/ui/viewtoolbar.cpp
===================================================================
--- scribus/ui/viewtoolbar.cpp	(Revision 26313)
+++ scribus/ui/viewtoolbar.cpp	(Arbeitskopie)
@@ -52,6 +52,7 @@
 	addAction(parent->scrActions["viewToggleCMS"]);
 	addAction(parent->scrActions["viewPreviewMode"]);
 	addAction(parent->scrActions["viewEditInPreview"]);
+	addAction(parent->scrActions["viewToggleWhiteSpaceMode"]);
 	addWidget(visualMenu);
 
 	languageChange();
whitespace_2024-10-08_02.patch (12,228 bytes)   

Issue History

Date Modified Username Field Change
2024-10-06 11:35 nitramr New Issue
2024-10-06 11:35 nitramr File Added: Bildschirmfoto vom 2024-10-06 13-23-38.png
2024-10-06 19:47 utnik Note Added: 0051413
2024-10-07 18:19 ale Note Added: 0051414
2024-10-07 22:03 nitramr Note Added: 0051417
2024-10-07 22:03 nitramr File Added: whitespace_2024-10-07_01.patch
2024-10-07 22:22 utnik Note Added: 0051418
2024-10-08 21:02 nitramr Note Added: 0051419
2024-10-08 21:02 nitramr File Added: whitespace_2024-10-08_01.patch
2024-10-08 21:02 nitramr File Added: action-whitespace-review.svg
2024-10-08 21:11 nitramr Note Added: 0051420
2024-10-08 21:11 nitramr File Added: whitespace_2024-10-08_02.patch
2024-10-08 21:11 nitramr File Deleted: whitespace_2024-10-08_01.patch
2024-10-16 19:37 cbradney Assigned To => nitramr
2024-10-16 19:37 cbradney Status new => resolved
2024-10-16 19:37 cbradney Resolution open => fixed
2024-10-16 19:37 cbradney Fixed in Version => 1.7.0.svn
2024-10-23 18:42 cbradney Status resolved => closed