View Issue Details

IDProjectCategoryView StatusLast Update
0014544ScribusGeneralpublic2023-10-16 16:24
ReporterFahad Assigned To 
PrioritynormalSeverityfeatureReproducibilityalways
Status newResolutionopen 
Product Version1.5.3.svn 
Summary0014544: Layout should aware of RTL pages
DescriptionWhen you select in layout section (facing pages), it is very hard to adjust it to work correctly with RTL languages.
Right now for LTR and facing pages the layout looks like this:
1
2|3
4|5
6

For RTL language should be:
1
3|2
5|4
6

TagsNo tags attached.
PatchNo

Relationships

has duplicate 0002632 confirmed Need to support right side binding in page ordering 
has duplicate 0017030 closedjghali Paging from right to left 

Activities

jghali

2017-01-09 11:18

administrator   ~0043313

This is not specific to RTL languages, this would also be beneficial for japanese layout. This is called the "binding direction". Binding direction determines the edge along which a book is bound.

Fahad

2017-01-11 04:40

developer   ~0043319

Last edited: 2017-01-11 04:40

@jghali Yes you are right. In Adobe Indesign called it "binding direction". Unfortunately, I don't have time these days, but is
"void ScribusDoc::reformPages(bool moveObjects)"
the right place to start?

munzirtaha

2017-05-20 02:56

reporter   ~0043916

Resolving this is essential for any serious work. There is an old bug issue: https://bugs.scribus.net/view.php?id=2632 which I guess should be set as a duplicate since this contains more details

Fahad

2018-03-22 08:17

developer   ~0045074

Here is a patch to implement this feature. I tried to test it for all cases. I appreciate your feedback.
0001-add-initial-RTL-binding-direction.patch (24,799 bytes)   
From 5ee3d28a02b2d92b6b35a3b340c05dc0682a49e8 Mon Sep 17 00:00:00 2001
From: Dawood albadi <dawood.albadi@gmail.com>
Date: Thu, 22 Mar 2018 12:06:36 +0400
Subject: [PATCH 1/1] add initial RTL binding direction

This patch adds RTL binding direction.
---
 .../scribus150format/scribus150format.cpp          |  2 +
 .../scribus150format/scribus150format_save.cpp     |  1 +
 scribus/prefsmanager.cpp                           |  3 +
 scribus/prefsstructs.h                             |  1 +
 scribus/scribus.cpp                                |  5 ++
 scribus/scribusdoc.cpp                             | 73 ++++++++++++++++++----
 scribus/scribusdoc.h                               |  2 +
 scribus/ui/newfile.cpp                             | 14 +++++
 scribus/ui/newfile.h                               |  3 +-
 scribus/ui/pagelayout.cpp                          | 18 ++++++
 scribus/ui/pagelayout.h                            |  3 +
 scribus/ui/pagepalette_pages.cpp                   | 11 ++++
 scribus/ui/pagepalette_pages.h                     |  1 +
 scribus/ui/prefs_documentsetup.cpp                 |  9 +++
 scribus/ui/prefs_documentsetup.h                   |  2 +-
 scribus/ui/prefs_documentsetupbase.ui              | 29 +++++++--
 16 files changed, 158 insertions(+), 19 deletions(-)

diff --git a/scribus/plugins/fileloader/scribus150format/scribus150format.cpp b/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
index 7633b85..e8d7cac 100644
--- a/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
+++ b/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
@@ -2027,6 +2027,7 @@ void Scribus150Format::readDocAttributes(ScribusDoc* doc, ScXmlStreamAttributes&
 {
 	m_Doc->setPageSize(attrs.valueAsString("PAGESIZE"));
 	m_Doc->setPageOrientation(attrs.valueAsInt("ORIENTATION", 0));
+	m_Doc->setBinding(attrs.valueAsInt("PAGEBINDING", 0));
 	m_Doc->FirstPnum  = attrs.valueAsInt("FIRSTNUM", 1);
 	m_Doc->setPagePositioning(attrs.valueAsInt("BOOK", 0));
 
@@ -6143,6 +6144,7 @@ bool Scribus150Format::loadPage(const QString & fileName, int pageNumber, bool M
 				ss->set("LEFT_OLD", newPage->LeftPg);
 				ss->set("NAME_OLD", newPage->pageName());
 				ss->set("ORIENTATION_OLD", newPage->orientation());
+				ss->set("BINDING_OLD", newPage);
 				ss->set("SIZE_OLD", newPage->m_pageSize);
 				ss->set("WIDTH_OLD", newPage->width());
 				ss->set("HEIGHT_OLD", newPage->height());
diff --git a/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp b/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
index 2336488..18d2f2c 100644
--- a/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
+++ b/scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
@@ -225,6 +225,7 @@ bool Scribus150Format::saveFile(const QString & fileName, const FileFormat & /*
 	docu.writeAttribute("BleedRight"  , m_Doc->bleeds()->right());
 	docu.writeAttribute("BleedBottom" , m_Doc->bleeds()->bottom());
 	docu.writeAttribute("ORIENTATION" , m_Doc->pageOrientation());
+	docu.writeAttribute("PAGEBINDING" , m_Doc->pageBiding());
 	docu.writeAttribute("PAGESIZE"    , m_Doc->pageSize());
 	docu.writeAttribute("FIRSTNUM"    , m_Doc->FirstPnum);
 	docu.writeAttribute("BOOK"        , m_Doc->pagePositioning());
diff --git a/scribus/prefsmanager.cpp b/scribus/prefsmanager.cpp
index a953315..9d9d4db 100644
--- a/scribus/prefsmanager.cpp
+++ b/scribus/prefsmanager.cpp
@@ -327,6 +327,7 @@ void PrefsManager::initDefaults()
 		appPrefs.docSetupPrefs.language = "en_GB";
 	appPrefs.docSetupPrefs.pageSize = LocaleManager::instance()->pageSizeForLocale(ScQApp->currGUILanguage());
 	appPrefs.docSetupPrefs.pageOrientation = 0;
+	appPrefs.docSetupPrefs.binding = 0;
 	PageSize defaultPageSize(appPrefs.docSetupPrefs.pageSize);
 	appPrefs.docSetupPrefs.pageWidth = defaultPageSize.width();
 	appPrefs.docSetupPrefs.pageHeight = defaultPageSize.height();
@@ -1398,6 +1399,7 @@ bool PrefsManager::WritePref(QString ho)
 	deDocumentSetup.setAttribute("Language",appPrefs.docSetupPrefs.language);
 	deDocumentSetup.setAttribute("UnitIndex",appPrefs.docSetupPrefs.docUnitIndex);
 	deDocumentSetup.setAttribute("PageSize",appPrefs.docSetupPrefs.pageSize);
+	deDocumentSetup.setAttribute("PageBinding",appPrefs.docSetupPrefs.binding);
 	deDocumentSetup.setAttribute("PageOrientation",appPrefs.docSetupPrefs.pageOrientation);
 	deDocumentSetup.setAttribute("PageWidth",ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageWidth));
 	deDocumentSetup.setAttribute("PageHeight",ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageHeight));
@@ -2009,6 +2011,7 @@ bool PrefsManager::ReadPref(QString ho)
 				appPrefs.docSetupPrefs.language = "en_GB";
 			appPrefs.docSetupPrefs.docUnitIndex = dc.attribute("UnitIndex", "0").toInt();
 			appPrefs.docSetupPrefs.pageSize = dc.attribute("PageSize","A4");
+			appPrefs.docSetupPrefs.binding = dc.attribute("PageBinding", "0").toInt();
 			appPrefs.docSetupPrefs.pageOrientation = dc.attribute("PageOrientation", "0").toInt();
 			appPrefs.docSetupPrefs.pageWidth   = ScCLocale::toDoubleC(dc.attribute("PageWidth"), 595.0);
 			appPrefs.docSetupPrefs.pageHeight  = ScCLocale::toDoubleC(dc.attribute("PageHeight"), 842.0);
diff --git a/scribus/prefsstructs.h b/scribus/prefsstructs.h
index fa1c5d6..6a9138b 100644
--- a/scribus/prefsstructs.h
+++ b/scribus/prefsstructs.h
@@ -183,6 +183,7 @@ struct DocumentSetupPrefs
 	bool AutoSaveLocation;
 	QString AutoSaveDir;
 	bool saveCompressed;
+	int binding;
 };
 
 //Guides
diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp
index 1f66046..fbcb48b 100644
--- a/scribus/scribus.cpp
+++ b/scribus/scribus.cpp
@@ -2117,6 +2117,7 @@ void ScribusMainWindow::startUpDialog()
 		{
 			int facingPages = dia->choosenLayout();
 			int firstPage = dia->firstPage->currentIndex();
+			int bind = dia->bind->currentIndex();
 			docSet = dia->startDocSetup->isChecked();
 			double topMargin = dia->marginGroup->top();
 			double bottomMargin = dia->marginGroup->bottom();
@@ -2141,11 +2142,13 @@ void ScribusMainWindow::startUpDialog()
 			doc->setPageSetFirstPage(facingPages, firstPage);
 			doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight());
 			HaveNewDoc();
+			doc->setBinding(bind);
 			doc->reformPages(true);
 			// Don's disturb user with "save?" dialog just after new doc
 			// doc changing should be rewritten maybe... maybe later...
 			doc->setModified(false);
 			updateActiveWindowCaption(doc->DocName);
+
 		}
 		else if (dia->tabSelected() == NewDoc::NewFromTemplateTab)
 		{
@@ -2199,6 +2202,7 @@ bool ScribusMainWindow::slotFileNew()
 	{
 		int facingPages = dia->choosenLayout();
 		int firstPage = dia->firstPage->currentIndex();
+		int bind = dia->bind->currentIndex();
 		docSet = dia->startDocSetup->isChecked();
 		double topMargin = dia->marginGroup->top();
 		double bottomMargin = dia->marginGroup->bottom();
@@ -2232,6 +2236,7 @@ bool ScribusMainWindow::slotFileNew()
 			doc->setModified(false);
 			updateActiveWindowCaption(doc->DocName);
 		}
+		doc->setBinding(bind);
 	}
 	delete dia;
 	if (docSet)
diff --git a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp
index 26d475f..09b04cc 100644
--- a/scribus/scribusdoc.cpp
+++ b/scribus/scribusdoc.cpp
@@ -6266,15 +6266,28 @@ struct oldPageVar
 // without running this monster
 void ScribusDoc::reformPages(bool moveObjects)
 {
+	//	 m_binding = m_docPrefsData.docSetupPrefs.binding;
 	QMap<uint, oldPageVar> pageTable;
 	struct oldPageVar oldPg;
 	int counter = pageSets()[m_docPrefsData.docSetupPrefs.pagePositioning].FirstPage;
 	int rowcounter = 0;
-	double maxYPos=0.0, maxXPos=0.0;
-	double currentXPos=m_docPrefsData.displayPrefs.scratch.left(), currentYPos=m_docPrefsData.displayPrefs.scratch.top(), lastYPos=Pages->at(0)->initialHeight();
-//	currentXPos += (pageWidth+pageSets[currentPageLayout].GapHorizontal) * counter;
-	currentXPos += (m_docPrefsData.docSetupPrefs.pageWidth+m_docPrefsData.displayPrefs.pageGapHorizontal) * counter;
-
+	double maxYPos=0.0, maxXPos=0.0, currentXPos = 0.0, currentYPos = 0.0, lastYPos = 0.0;
+	if (m_docPrefsData.docSetupPrefs.binding == 1)
+	{
+		currentXPos=m_docPrefsData.displayPrefs.scratch.left() + m_docPrefsData.docSetupPrefs.pageWidth;
+		currentYPos=m_docPrefsData.displayPrefs.scratch.top();
+		lastYPos=Pages->at(0)->initialHeight();
+		//	currentXPos += (pageWidth+pageSets[currentPageLayout].GapHorizontal) * counter;
+		currentXPos -= (m_docPrefsData.docSetupPrefs.pageWidth+m_docPrefsData.displayPrefs.pageGapHorizontal) * counter;
+	}
+	else
+	{
+		currentXPos = m_docPrefsData.displayPrefs.scratch.left();
+		currentYPos=m_docPrefsData.displayPrefs.scratch.top();
+		lastYPos=Pages->at(0)->initialHeight();
+		//      currentXPos += (pageWidth+pageSets[currentPageLayout].GapHorizontal) * counter;
+		currentXPos += (m_docPrefsData.docSetupPrefs.pageWidth+m_docPrefsData.displayPrefs.pageGapHorizontal) * counter;
+	}
 	lastYPos = Pages->at(0)->initialHeight();
 	ScPage* page;
 	int docPageCount=Pages->count();
@@ -6314,29 +6327,63 @@ void ScribusDoc::reformPages(bool moveObjects)
 			page->setYOffset(currentYPos);
 			if (counter < pageSets()[m_docPrefsData.docSetupPrefs.pagePositioning].Columns-1)
 			{
-				currentXPos += page->width() + m_docPrefsData.displayPrefs.pageGapHorizontal;
+				if (m_docPrefsData.docSetupPrefs.binding == 1)
+				{
+					currentXPos -= page->width() + m_docPrefsData.displayPrefs.pageGapHorizontal;
+				}
+				else
+				{
+					currentXPos += page->width() + m_docPrefsData.displayPrefs.pageGapHorizontal;
+				}
 				lastYPos = qMax(lastYPos, page->height());
 				if (counter == 0)
 				{
-					page->Margins.setLeft(page->initialMargins.right());
-					page->Margins.setRight(page->initialMargins.left());
+					if (m_docPrefsData.docSetupPrefs.binding == 1)
+					{
+						page->Margins.setLeft(page->initialMargins.left());
+						page->Margins.setRight(page->initialMargins.right());
+					}
+					else
+					{
+						page->Margins.setLeft(page->initialMargins.right());
+						page->Margins.setRight(page->initialMargins.left());
+					}
 				}
 				else
 				{
-					page->Margins.setLeft(page->initialMargins.left());
-					page->Margins.setRight(page->initialMargins.left());
+					if (m_docPrefsData.docSetupPrefs.binding == 1)
+					{
+						page->Margins.setLeft(page->initialMargins.right());
+						page->Margins.setRight(page->initialMargins.right());
+					}
+					else
+					{
+						page->Margins.setLeft(page->initialMargins.left());
+						page->Margins.setRight(page->initialMargins.left());
+					}
 				}
 			}
 			else
 			{
-				currentXPos = m_docPrefsData.displayPrefs.scratch.left();
+				if (m_docPrefsData.docSetupPrefs.binding == 1)
+					currentXPos = m_docPrefsData.displayPrefs.scratch.left() + m_docPrefsData.docSetupPrefs.pageWidth;
+				else
+					currentXPos = m_docPrefsData.displayPrefs.scratch.left();
 				if (pageSets()[m_docPrefsData.docSetupPrefs.pagePositioning].Columns > 1)
 					currentYPos += qMax(lastYPos, page->height())+m_docPrefsData.displayPrefs.pageGapVertical;
 				else
 					currentYPos += page->height()+m_docPrefsData.displayPrefs.pageGapVertical;
 				lastYPos = 0;
-				page->Margins.setRight(page->initialMargins.right());
-				page->Margins.setLeft(page->initialMargins.left());
+				if (m_docPrefsData.docSetupPrefs.binding == 1)
+				{
+					page->Margins.setRight(page->initialMargins.left());
+					page->Margins.setLeft(page->initialMargins.right());
+				}
+				else
+				{
+					page->Margins.setRight(page->initialMargins.right());
+					page->Margins.setLeft(page->initialMargins.left());
+				}
 			}
 			counter++;
 			if (counter > pageSets()[m_docPrefsData.docSetupPrefs.pagePositioning].Columns-1)
diff --git a/scribus/scribusdoc.h b/scribus/scribusdoc.h
index e3ace25..3ae10fd 100644
--- a/scribus/scribusdoc.h
+++ b/scribus/scribusdoc.h
@@ -188,7 +188,9 @@ public:
 	const QString& language() const { return m_docPrefsData.docSetupPrefs.language; }
 	void setLanguage(const QString& s) { m_docPrefsData.docSetupPrefs.language=s; }
 	int pageOrientation() const { return m_docPrefsData.docSetupPrefs.pageOrientation; }
+	int pageBiding() const {return m_docPrefsData.docSetupPrefs.binding; }
 	void setPageOrientation(int o) { m_docPrefsData.docSetupPrefs.pageOrientation=o; }
+	void setBinding(int x) {m_docPrefsData.docSetupPrefs.binding = x; }
 	int pagePositioning() const { return m_docPrefsData.docSetupPrefs.pagePositioning; }
 	void setPagePositioning(int p) { m_docPrefsData.docSetupPrefs.pagePositioning=p; }
 	double pageHeight() const { return m_docPrefsData.docSetupPrefs.pageHeight; }
diff --git a/scribus/ui/newfile.cpp b/scribus/ui/newfile.cpp
index 03b8192..3c673a8 100644
--- a/scribus/ui/newfile.cpp
+++ b/scribus/ui/newfile.cpp
@@ -290,6 +290,13 @@ void NewDoc::createNewDocPage()
 	pageCountLabel->setBuddy(pageCountSpinBox);
 	optionsGroupBoxLayout->addRow( pageCountLabel, pageCountSpinBox);
 
+	layoutLabel2 = new QLabel( optionsGroupBox );
+	layoutLabel2->setText( tr( "Binding Direction:" ) );
+	bind = new ScComboBox( optionsGroupBox );
+	bind->clear();
+	bind->setCurrentIndex(prefsManager->appPrefs.docSetupPrefs.binding);
+	optionsGroupBoxLayout->addRow( layoutLabel2, bind );
+
 	layoutLabel1 = new QLabel( optionsGroupBox );
 	layoutLabel1->setText( tr( "First Page is:" ) );
 	firstPage = new ScComboBox( optionsGroupBox );
@@ -464,12 +471,19 @@ void NewDoc::selectItem(uint nr)
 		{
 			firstPage->addItem(CommonStrings::translatePageSetLocString((*pNames)));
 		}
+		bind->setEnabled(true);
+		bind->addItem(tr("Left To Right"));
+		bind->addItem(tr("Right To Left"));
+
+
 	}
 	else
 	{
 		firstPage->clear();
 		firstPage->addItem(" ");
 		firstPage->setEnabled(false);
+		bind->clear();
+		bind->setEnabled(false);
 	}
 	layoutsView->setCurrentRow(nr);
 	layoutsView->item(nr)->setSelected(true);
diff --git a/scribus/ui/newfile.h b/scribus/ui/newfile.h
index 57e75e8..33ddf1a 100644
--- a/scribus/ui/newfile.h
+++ b/scribus/ui/newfile.h
@@ -75,6 +75,8 @@ public:
 	QFrame* newDocFrame;
 	PageLayoutsWidget* layoutsView;
 	QLabel* layoutLabel1;
+	QLabel* layoutLabel2;
+	ScComboBox* bind;
 	ScComboBox* firstPage;
 	QGroupBox* pageSizeGroupBox;
 	MarginWidget* marginGroup;
@@ -151,7 +153,6 @@ public slots:
 	void gotoDesktopDirectory();
 	void gotoHomeDirectory();
 	void openFileDialogFileClicked(const QString &path);
-
 protected:
 	QVBoxLayout* TabbedNewDocLayout;
 	QHBoxLayout* Layout1;
diff --git a/scribus/ui/pagelayout.cpp b/scribus/ui/pagelayout.cpp
index 471716b..4238e8b 100644
--- a/scribus/ui/pagelayout.cpp
+++ b/scribus/ui/pagelayout.cpp
@@ -78,6 +78,11 @@ PageLayouts::PageLayouts(QWidget* parent)  : QGroupBox( parent )
 	layoutsCombo = new ScComboBox( this );
 	layoutGroupLayout->addWidget( layoutsCombo );
 
+	layoutLable2 = new QLabel( this );
+	layoutGroupLayout->addWidget( layoutLable2 );
+	bind = new ScComboBox( this );
+	layoutGroupLayout->addWidget( bind );
+
 	layoutLabel1 = new QLabel( this );
 	layoutGroupLayout->addWidget( layoutLabel1 );
 	firstPage = new ScComboBox( this );
@@ -87,6 +92,7 @@ PageLayouts::PageLayouts(QWidget* parent)  : QGroupBox( parent )
 
 	connect(layoutsCombo, SIGNAL(activated(int)), this, SLOT(itemSelected(int)));
 	connect(firstPage, SIGNAL(activated(int)), this, SIGNAL(selectedFirstPage(int)));
+	connect(bind, SIGNAL(activated(int)), this, SIGNAL(selectBinding(int)));
 }
 
 PageLayouts::PageLayouts(QWidget* parent, QList<PageSet> pSets, bool mode)  : QGroupBox( parent )
@@ -106,6 +112,10 @@ PageLayouts::PageLayouts(QWidget* parent, QList<PageSet> pSets, bool mode)  : QG
 		layoutsCombo = new ScComboBox( this );
 		layoutGroupLayout->addWidget( layoutsCombo );
 	}
+	layoutLable2 = new QLabel( this );
+	layoutGroupLayout->addWidget( layoutLable2 );
+	bind = new ScComboBox( this );
+	layoutGroupLayout->addWidget( bind );
 	layoutLabel1 = new QLabel( this );
 	layoutGroupLayout->addWidget( layoutLabel1 );
 	firstPage = new ScComboBox( this );
@@ -158,6 +168,10 @@ void PageLayouts::selectItem(uint nr)
 	disconnect(firstPage, SIGNAL(activated(int)), this, SIGNAL(selectedFirstPage(int)));
 	if (nr > 0)
 	{
+		bind->setEnabled(true);
+		bind->clear();
+		bind->addItem(tr("Left To Right"));
+		bind->addItem(tr("Right To Left"));
 		firstPage->setEnabled(true);
 		firstPage->clear();
 		QStringList::Iterator pNames;
@@ -168,6 +182,8 @@ void PageLayouts::selectItem(uint nr)
 	}
 	else
 	{
+		bind->clear();
+		bind->setEnabled(false);
 		firstPage->clear();
 		firstPage->addItem(" ");
 		firstPage->setEnabled(false);
@@ -293,6 +309,8 @@ void PageLayouts::languageChange()
 		firstPage->setCurrentIndex(currFirstPageIndex);
 		connect(firstPage, SIGNAL(activated(int)), this, SIGNAL(selectedFirstPage(int)));
 	}
+	layoutLable2->setText( tr( "Binding Direction: " ));
+	bind->setCurrentIndex(bind->currentIndex());
 	layoutLabel1->setText( tr( "First Page is:" ) );
 
 	QString layoutText( tr( "Number of pages to show side-by-side on the canvas. Often used for allowing items to be placed across page spreads." ) );
diff --git a/scribus/ui/pagelayout.h b/scribus/ui/pagelayout.h
index 3dc0220..3943af8 100644
--- a/scribus/ui/pagelayout.h
+++ b/scribus/ui/pagelayout.h
@@ -51,6 +51,8 @@ public:
 	QLabel* layoutLabel1;
 	ScComboBox* firstPage;
 	QList<PageSet> pageSets;
+	QLabel* layoutLable2;
+	ScComboBox* bind;
 
 public slots:
 	void itemSelected(QListWidgetItem* ic);
@@ -59,6 +61,7 @@ public slots:
 signals:
 	void selectedLayout(int);
 	void selectedFirstPage(int);
+	void selectBinding(int);
 
 private:
 	void itemSelectedPost(int chosen);
diff --git a/scribus/ui/pagepalette_pages.cpp b/scribus/ui/pagepalette_pages.cpp
index 0f2471d..132f6fa 100644
--- a/scribus/ui/pagepalette_pages.cpp
+++ b/scribus/ui/pagepalette_pages.cpp
@@ -70,6 +70,7 @@ PagePalette_Pages::PagePalette_Pages(QWidget* parent) : QWidget(parent)
 	connect(masterPageList, SIGNAL(thumbnailChanged()), this, SLOT(rebuildMasters()));
 	connect(masterPageList, SIGNAL(DelMaster(QString)), this, SLOT(deleteMasterPage(QString)));
 
+	connect(pageLayout, SIGNAL(selectBinding(int))     , this, SLOT(handleBinging(int)));
 	connect(pageLayout, SIGNAL(selectedLayout(int ))   , this, SLOT(handlePageLayout(int )));
 	connect(pageLayout, SIGNAL(selectedFirstPage(int )), this, SLOT(handleFirstPage(int )));
 	connect(pageView  , SIGNAL(Click(int, int, int))   , this, SLOT(pageView_gotoPage(int, int, int)));
@@ -164,6 +165,15 @@ void PagePalette_Pages::enablePalette(const bool enabled)
 	pageLayout->setEnabled(enabled);
 }
 
+void PagePalette_Pages::handleBinging(int bind)
+{
+	currView->Doc->setBinding(bind);
+	currView->reformPages();
+	currView->DrawNew();
+	currView->GotoPage(currView->Doc->currentPageNumber());
+	rebuildPages();
+}
+
 void PagePalette_Pages::handlePageLayout(int layout)
 {
 	pageLayout->selectFirstP(currView->Doc->pageSets()[layout].FirstPage);
@@ -227,6 +237,7 @@ void PagePalette_Pages::rebuildPages()
 	pageLayout->updateLayoutSelector(currView->Doc->pageSets());
 	pageLayout->selectItem(currView->Doc->pagePositioning());
 	pageLayout->firstPage->setCurrentIndex(currView->Doc->pageSets()[currView->Doc->pagePositioning()].FirstPage);
+	pageLayout->bind->setCurrentIndex(currView->Doc->pageBiding());
 	pageView->MaxC = currView->Doc->DocPages.count()-1;
 	int counter = currView->Doc->pageSets()[currView->Doc->pagePositioning()].FirstPage;
 	int cols = currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns;
diff --git a/scribus/ui/pagepalette_pages.h b/scribus/ui/pagepalette_pages.h
index a4b3a1b..f56714d 100644
--- a/scribus/ui/pagepalette_pages.h
+++ b/scribus/ui/pagepalette_pages.h
@@ -50,6 +50,7 @@ public slots:
 	void markPage(uint nr);
 	void selMasterPage();
 	void languageChange();
+	void handleBinging(int);
 
 private slots:
 	void pageView_applyMasterPage(QString masterpageName, int pageIndex);
diff --git a/scribus/ui/prefs_documentsetup.cpp b/scribus/ui/prefs_documentsetup.cpp
index dcbd757..9540080 100644
--- a/scribus/ui/prefs_documentsetup.cpp
+++ b/scribus/ui/prefs_documentsetup.cpp
@@ -171,6 +171,7 @@ void Prefs_DocumentSetup::restoreDefaults(struct ApplicationPrefs *prefsData)
 			break;
 	}
 	setupPageSets();
+	bind->setCurrentIndex(prefsData->docSetupPrefs.binding);
 
 	layoutFirstPageIsComboBox->setCurrentIndex(prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage);
 
@@ -221,6 +222,7 @@ void Prefs_DocumentSetup::saveGuiToPrefs(struct ApplicationPrefs *prefsData) con
 	prefsData->docSetupPrefs.pagePositioning=pageLayoutButtonGroup->checkedId();
 	prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage=layoutFirstPageIsComboBox->currentIndex();
 
+	prefsData->docSetupPrefs.binding = bind->currentIndex();
 	prefsData->docSetupPrefs.margins=marginsWidget->margins();
 	prefsData->docSetupPrefs.bleeds=bleedsWidget->margins();
 	prefsData->docSetupPrefs.saveCompressed=saveCompressedCheckBox->isChecked();
@@ -246,8 +248,13 @@ void Prefs_DocumentSetup::setupPageSets()
 	int i=layoutFirstPageIsComboBox->currentIndex();
 	int currIndex=pageLayoutButtonGroup->checkedId()<0?0:pageLayoutButtonGroup->checkedId();
 	layoutFirstPageIsComboBox->clear();
+	bind->clear();
 	if (currIndex>0 && currIndex<pageSets.count())
 	{
+		bind->setEnabled(true);
+		bind->addItem(tr("Left To Right"));
+		bind->addItem(tr("Right To Left"));
+//		bind->setCurrentIndex(PrefsManager.);
 		layoutFirstPageIsComboBox->setEnabled(true);
 		for(QStringList::Iterator pNames = pageSets[currIndex].pageNames.begin(); pNames != pageSets[currIndex].pageNames.end(); ++pNames )
 			layoutFirstPageIsComboBox->addItem(CommonStrings::translatePageSetLocString(*pNames));
@@ -255,6 +262,8 @@ void Prefs_DocumentSetup::setupPageSets()
 	}
 	else
 	{
+		bind->clear();
+		bind->setEnabled(false);
 		layoutFirstPageIsComboBox->addItem(" ");
 		layoutFirstPageIsComboBox->setCurrentIndex(0);
 		layoutFirstPageIsComboBox->setEnabled(false);
diff --git a/scribus/ui/prefs_documentsetup.h b/scribus/ui/prefs_documentsetup.h
index 16e4fb0..1a04f2a 100644
--- a/scribus/ui/prefs_documentsetup.h
+++ b/scribus/ui/prefs_documentsetup.h
@@ -12,9 +12,9 @@ for which a new license (GPL+exception) is in place.
 #include "prefs_pane.h"
 #include "scribusapi.h"
 #include "scribusstructs.h"
+//#include "scribusdoc.h"
 
 class ScribusDoc;
-
 class SCRIBUS_API Prefs_DocumentSetup : public Prefs_Pane, Ui::Prefs_DocumentSetup
 {
 	Q_OBJECT
diff --git a/scribus/ui/prefs_documentsetupbase.ui b/scribus/ui/prefs_documentsetupbase.ui
index 6cbc951..00c7a93 100644
--- a/scribus/ui/prefs_documentsetupbase.ui
+++ b/scribus/ui/prefs_documentsetupbase.ui
@@ -38,7 +38,7 @@
    <item>
     <widget class="QTabWidget" name="tabWidget">
      <property name="currentIndex">
-      <number>0</number>
+      <number>1</number>
      </property>
      <widget class="QWidget" name="sizeTab">
       <attribute name="title">
@@ -247,7 +247,7 @@
        </item>
        <item>
         <layout class="QFormLayout" name="pageLayoutLayout">
-         <item row="4" column="0">
+         <item row="7" column="0">
           <widget class="QLabel" name="layoutFirstPageIsLabel">
            <property name="text">
             <string>First Page is:</string>
@@ -257,7 +257,7 @@
            </property>
           </widget>
          </item>
-         <item row="4" column="1">
+         <item row="7" column="1">
           <widget class="QComboBox" name="layoutFirstPageIsComboBox">
            <property name="sizeAdjustPolicy">
             <enum>QComboBox::AdjustToContents</enum>
@@ -307,6 +307,27 @@
            </attribute>
           </widget>
          </item>
+         <item row="4" column="1">
+          <widget class="QComboBox" name="bind">
+           <item>
+            <property name="text">
+             <string>Left To Right</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Right To Left</string>
+            </property>
+           </item>
+          </widget>
+         </item>
+         <item row="4" column="0">
+          <widget class="QLabel" name="bindLable">
+           <property name="text">
+            <string>Binding Direction:</string>
+           </property>
+          </widget>
+         </item>
         </layout>
        </item>
        <item>
@@ -349,7 +370,7 @@
             <x>0</x>
             <y>0</y>
             <width>458</width>
-            <height>540</height>
+            <height>546</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_5">
-- 
2.7.4

munzirtaha

2018-03-22 19:26

reporter   ~0045077

Thanks Fahad,
It's great that you managed to find time to work on it. I downloaded the patch and compiled scribus to test it. Upon launching the File -> New dialog, I got 6 options for the "Binding Direction". Screenshot attached.
scribus-bug.png (235,879 bytes)   
scribus-bug.png (235,879 bytes)   

Fahad

2018-03-23 11:23

developer   ~0045079

@munzirtaha thanks for the feedback & it is noted. BTW, I am not the one who wrote this patch. The author is Dawood. I am just following up with him.
I hope you can test RTL binding in:
-Document settings
-Preferences
- arrange palette
- pdf export.
-save & open document
- margins & bleeding settings

Thanks for the help.

jghali

2018-03-23 12:00

administrator   ~0045080

Last edited: 2018-03-23 12:07

I add a quick look at the patch last night. Here are my first remarks:
- the binding direction widget should be also enabled for documents using single page layout: this information can be stored in PDF and used by PDF Viewers when displaying pages side by side or when printing n-up
- consequence of previous remark: no need to clear the combo at any moment
- bug: when creating new doc with first page "Left" and binding "Right to Left", the first page is a "Right" page (just put a text frame with a page number to see that).

munzirtaha

2018-03-23 14:10

reporter   ~0045081

Thanks to you and to Dawood and all involved.
I already started testing but unfortunately, the binding direction is wrong even in the very simple case. What jghali mentioned for the single page also applies to the facing pages. I chose to report the very first issue because I am pretty sure if you start fixing it, you would figure out the rest ;)

Fahad

2018-03-23 16:30

developer   ~0045082

@munzirtaha despite bug in the New dialog bug, everything should be works fine. please download the attached file and go to windows > Arrange pages & change the binding direction from there.
LTR and facing pages the layout looks like this:
1
2|3
4|5
6

For RTL language should be:
1
3|2
5|4
6
test.sla (20,042 bytes)

Fahad

2018-03-24 19:02

developer   ~0045087

@jghali Thanks for your great feedback, here my points:
-1&2: binding direction for single page layout is almost useless IMHO because if you don't set inside & outside margins correctly things get worst when you force RTL binding. However, we will implement it.
- 3 this only wording bug, we will fix it.

But this bring to my attention another missing thing which is (page number mark). Right know what we haven't reorder the real page number (The logical order), what do you think the right approach to tackle this?

munzirtaha

2018-03-25 16:12

reporter   ~0045093

I downloaded the file and and set the binding direction to "Right to Left" and first page to "Left Page" but as you see in the screenshot, the first page is actually a "Right Page". Also, note that the preview in the "Document Pages:" doesn't reflect the current situation as it should.
test.png (397,395 bytes)   
test.png (397,395 bytes)   

Fahad

2018-03-26 06:39

developer   ~0045096

Attached updated patch fix the following:
- fix first page placement.
- use Doc_pagebinding into pdfbinding options.
- allow page binding for single page layout.

Please note that we don't modify the preview in the Document Pages in windows > Arrange pages because we couldn't figure out how to change icons positions in QTableWidget. We think that we need to implement a new widget to fix this problem but this will need a lot of time & work that we don't have, plus it is additional thing that's nice to have.

Please test and give your feedback.

cc: @Dawoodalbadi
Binding.patch (26,083 bytes)   
Index: scribus/commonstrings.cpp
===================================================================
--- scribus/commonstrings.cpp	(revision 22367)
+++ scribus/commonstrings.cpp	(working copy)
@@ -217,18 +217,34 @@
 	return untrString;
 }
 
-const QString& CommonStrings::translatePageSetLocString(const QString &untrString)
+const QString& CommonStrings::translatePageSetLocString(const QString &untrString, int biding)
 {
-	if (untrString==pageLocLeft)
-		return trPageLocLeft;
-	if (untrString==pageLocMiddle)
-		return trPageLocMiddle;
-	if (untrString==pageLocMiddleLeft)
-		return trPageLocMiddleLeft;
-	if (untrString==pageLocMiddleRight)
-		return trPageLocMiddleRight;
-	if (untrString==pageLocRight)
-		return trPageLocRight;
+	if (biding == 0)
+	{
+		if (untrString==pageLocLeft)
+			return trPageLocLeft;
+		if (untrString==pageLocMiddle)
+			return trPageLocMiddle;
+		if (untrString==pageLocMiddleLeft)
+			return trPageLocMiddleLeft;
+		if (untrString==pageLocMiddleRight)
+			return trPageLocMiddleRight;
+		if (untrString==pageLocRight)
+			return trPageLocRight;
+	}
+	else
+	{
+		if (untrString==pageLocLeft)
+			return trPageLocRight;
+		if (untrString==pageLocMiddle)
+			return trPageLocMiddle;
+		if (untrString==pageLocMiddleLeft)
+			return trPageLocMiddleRight;
+		if (untrString==pageLocMiddleRight)
+			return trPageLocMiddleLeft;
+		if (untrString==pageLocRight)
+			return trPageLocLeft;
+	}
 	return untrString;
 }
 
Index: scribus/commonstrings.h
===================================================================
--- scribus/commonstrings.h	(revision 22367)
+++ scribus/commonstrings.h	(working copy)
@@ -64,7 +64,7 @@
 	 * @param untrString "untranslated" string
 	 * @return translated string
 	 */
-	static const QString& translatePageSetLocString(const QString &untrString);
+	static const QString& translatePageSetLocString(const QString &untrString, int biding = 0);
 	/**
 	 * \brief Return the untranslated Page Set string if given the translated one
 	 * @param trString translated string
Index: scribus/plugins/fileloader/scribus150format/scribus150format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(revision 22367)
+++ scribus/plugins/fileloader/scribus150format/scribus150format.cpp	(working copy)
@@ -2024,6 +2024,7 @@
 {
 	m_Doc->setPageSize(attrs.valueAsString("PAGESIZE"));
 	m_Doc->setPageOrientation(attrs.valueAsInt("ORIENTATION", 0));
+	m_Doc->setBinding(attrs.valueAsInt("PAGEBINDING", 0));
 	m_Doc->FirstPnum  = attrs.valueAsInt("FIRSTNUM", 1);
 	m_Doc->setPagePositioning(attrs.valueAsInt("BOOK", 0));
 
@@ -6140,6 +6141,7 @@
 				ss->set("LEFT_OLD", newPage->LeftPg);
 				ss->set("NAME_OLD", newPage->pageName());
 				ss->set("ORIENTATION_OLD", newPage->orientation());
+				ss->set("BINDING_OLD", newPage);
 				ss->set("SIZE_OLD", newPage->m_pageSize);
 				ss->set("WIDTH_OLD", newPage->width());
 				ss->set("HEIGHT_OLD", newPage->height());
Index: scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(revision 22367)
+++ scribus/plugins/fileloader/scribus150format/scribus150format_save.cpp	(working copy)
@@ -225,6 +225,7 @@
 	docu.writeAttribute("BleedRight"  , m_Doc->bleeds()->right());
 	docu.writeAttribute("BleedBottom" , m_Doc->bleeds()->bottom());
 	docu.writeAttribute("ORIENTATION" , m_Doc->pageOrientation());
+	docu.writeAttribute("PAGEBINDING" , m_Doc->pageBiding());
 	docu.writeAttribute("PAGESIZE"    , m_Doc->pageSize());
 	docu.writeAttribute("FIRSTNUM"    , m_Doc->FirstPnum);
 	docu.writeAttribute("BOOK"        , m_Doc->pagePositioning());
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(revision 22367)
+++ scribus/prefsmanager.cpp	(working copy)
@@ -327,6 +327,7 @@
 		appPrefs.docSetupPrefs.language = "en_GB";
 	appPrefs.docSetupPrefs.pageSize = LocaleManager::instance()->pageSizeForLocale(ScQApp->currGUILanguage());
 	appPrefs.docSetupPrefs.pageOrientation = 0;
+	appPrefs.docSetupPrefs.binding = 0;
 	PageSize defaultPageSize(appPrefs.docSetupPrefs.pageSize);
 	appPrefs.docSetupPrefs.pageWidth = defaultPageSize.width();
 	appPrefs.docSetupPrefs.pageHeight = defaultPageSize.height();
@@ -1398,6 +1399,7 @@
 	deDocumentSetup.setAttribute("Language",appPrefs.docSetupPrefs.language);
 	deDocumentSetup.setAttribute("UnitIndex",appPrefs.docSetupPrefs.docUnitIndex);
 	deDocumentSetup.setAttribute("PageSize",appPrefs.docSetupPrefs.pageSize);
+	deDocumentSetup.setAttribute("PageBinding",appPrefs.docSetupPrefs.binding);
 	deDocumentSetup.setAttribute("PageOrientation",appPrefs.docSetupPrefs.pageOrientation);
 	deDocumentSetup.setAttribute("PageWidth",ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageWidth));
 	deDocumentSetup.setAttribute("PageHeight",ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageHeight));
@@ -2009,6 +2011,7 @@
 				appPrefs.docSetupPrefs.language = "en_GB";
 			appPrefs.docSetupPrefs.docUnitIndex = dc.attribute("UnitIndex", "0").toInt();
 			appPrefs.docSetupPrefs.pageSize = dc.attribute("PageSize","A4");
+			appPrefs.docSetupPrefs.binding = dc.attribute("PageBinding", "0").toInt();
 			appPrefs.docSetupPrefs.pageOrientation = dc.attribute("PageOrientation", "0").toInt();
 			appPrefs.docSetupPrefs.pageWidth   = ScCLocale::toDoubleC(dc.attribute("PageWidth"), 595.0);
 			appPrefs.docSetupPrefs.pageHeight  = ScCLocale::toDoubleC(dc.attribute("PageHeight"), 842.0);
Index: scribus/prefsstructs.h
===================================================================
--- scribus/prefsstructs.h	(revision 22367)
+++ scribus/prefsstructs.h	(working copy)
@@ -183,6 +183,7 @@
 	bool AutoSaveLocation;
 	QString AutoSaveDir;
 	bool saveCompressed;
+	int binding;
 };
 
 //Guides
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(revision 22367)
+++ scribus/scribus.cpp	(working copy)
@@ -2117,6 +2117,7 @@
 		{
 			int facingPages = dia->choosenLayout();
 			int firstPage = dia->firstPage->currentIndex();
+			int bind = dia->bind->currentIndex();
 			docSet = dia->startDocSetup->isChecked();
 			double topMargin = dia->marginGroup->top();
 			double bottomMargin = dia->marginGroup->bottom();
@@ -2141,11 +2142,13 @@
 			doc->setPageSetFirstPage(facingPages, firstPage);
 			doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight());
 			HaveNewDoc();
+			doc->setBinding(bind);
 			doc->reformPages(true);
 			// Don's disturb user with "save?" dialog just after new doc
 			// doc changing should be rewritten maybe... maybe later...
 			doc->setModified(false);
 			updateActiveWindowCaption(doc->DocName);
+
 		}
 		else if (dia->tabSelected() == NewDoc::NewFromTemplateTab)
 		{
@@ -2199,6 +2202,7 @@
 	{
 		int facingPages = dia->choosenLayout();
 		int firstPage = dia->firstPage->currentIndex();
+		int bind = dia->bind->currentIndex();
 		docSet = dia->startDocSetup->isChecked();
 		double topMargin = dia->marginGroup->top();
 		double bottomMargin = dia->marginGroup->bottom();
@@ -2232,6 +2236,7 @@
 			doc->setModified(false);
 			updateActiveWindowCaption(doc->DocName);
 		}
+		doc->setBinding(bind);
 	}
 	delete dia;
 	if (docSet)
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 22367)
+++ scribus/scribusdoc.cpp	(working copy)
@@ -6143,15 +6143,28 @@
 // without running this monster
 void ScribusDoc::reformPages(bool moveObjects)
 {
+	//	 m_binding = m_docPrefsData.docSetupPrefs.binding;
 	QMap<uint, oldPageVar> pageTable;
 	struct oldPageVar oldPg;
 	int counter = pageSets()[m_docPrefsData.docSetupPrefs.pagePositioning].FirstPage;
 	int rowcounter = 0;
-	double maxYPos=0.0, maxXPos=0.0;
-	double currentXPos=m_docPrefsData.displayPrefs.scratch.left(), currentYPos=m_docPrefsData.displayPrefs.scratch.top(), lastYPos=Pages->at(0)->initialHeight();
-//	currentXPos += (pageWidth+pageSets[currentPageLayout].GapHorizontal) * counter;
-	currentXPos += (m_docPrefsData.docSetupPrefs.pageWidth+m_docPrefsData.displayPrefs.pageGapHorizontal) * counter;
-
+	double maxYPos=0.0, maxXPos=0.0, currentXPos = 0.0, currentYPos = 0.0, lastYPos = 0.0;
+	if (m_docPrefsData.docSetupPrefs.binding == 1)
+	{
+		currentXPos=m_docPrefsData.displayPrefs.scratch.left() + m_docPrefsData.docSetupPrefs.pageWidth;
+		currentYPos=m_docPrefsData.displayPrefs.scratch.top();
+		lastYPos=Pages->at(0)->initialHeight();
+		//	currentXPos += (pageWidth+pageSets[currentPageLayout].GapHorizontal) * counter;
+		currentXPos -= (m_docPrefsData.docSetupPrefs.pageWidth+m_docPrefsData.displayPrefs.pageGapHorizontal) * counter;
+	}
+	else
+	{
+		currentXPos = m_docPrefsData.displayPrefs.scratch.left();
+		currentYPos=m_docPrefsData.displayPrefs.scratch.top();
+		lastYPos=Pages->at(0)->initialHeight();
+		//      currentXPos += (pageWidth+pageSets[currentPageLayout].GapHorizontal) * counter;
+		currentXPos += (m_docPrefsData.docSetupPrefs.pageWidth+m_docPrefsData.displayPrefs.pageGapHorizontal) * counter;
+	}
 	lastYPos = Pages->at(0)->initialHeight();
 	ScPage* page;
 	int docPageCount=Pages->count();
@@ -6191,29 +6204,63 @@
 			page->setYOffset(currentYPos);
 			if (counter < pageSets()[m_docPrefsData.docSetupPrefs.pagePositioning].Columns-1)
 			{
-				currentXPos += page->width() + m_docPrefsData.displayPrefs.pageGapHorizontal;
+				if (m_docPrefsData.docSetupPrefs.binding == 1)
+				{
+					currentXPos -= page->width() + m_docPrefsData.displayPrefs.pageGapHorizontal;
+				}
+				else
+				{
+					currentXPos += page->width() + m_docPrefsData.displayPrefs.pageGapHorizontal;
+				}
 				lastYPos = qMax(lastYPos, page->height());
 				if (counter == 0)
 				{
-					page->Margins.setLeft(page->initialMargins.right());
-					page->Margins.setRight(page->initialMargins.left());
+					if (m_docPrefsData.docSetupPrefs.binding == 1)
+					{
+						page->Margins.setLeft(page->initialMargins.left());
+						page->Margins.setRight(page->initialMargins.right());
+					}
+					else
+					{
+						page->Margins.setLeft(page->initialMargins.right());
+						page->Margins.setRight(page->initialMargins.left());
+					}
 				}
 				else
 				{
-					page->Margins.setLeft(page->initialMargins.left());
-					page->Margins.setRight(page->initialMargins.left());
+					if (m_docPrefsData.docSetupPrefs.binding == 1)
+					{
+						page->Margins.setLeft(page->initialMargins.right());
+						page->Margins.setRight(page->initialMargins.right());
+					}
+					else
+					{
+						page->Margins.setLeft(page->initialMargins.left());
+						page->Margins.setRight(page->initialMargins.left());
+					}
 				}
 			}
 			else
 			{
-				currentXPos = m_docPrefsData.displayPrefs.scratch.left();
+				if (m_docPrefsData.docSetupPrefs.binding == 1)
+					currentXPos = m_docPrefsData.displayPrefs.scratch.left() + m_docPrefsData.docSetupPrefs.pageWidth;
+				else
+					currentXPos = m_docPrefsData.displayPrefs.scratch.left();
 				if (pageSets()[m_docPrefsData.docSetupPrefs.pagePositioning].Columns > 1)
 					currentYPos += qMax(lastYPos, page->height())+m_docPrefsData.displayPrefs.pageGapVertical;
 				else
 					currentYPos += page->height()+m_docPrefsData.displayPrefs.pageGapVertical;
 				lastYPos = 0;
-				page->Margins.setRight(page->initialMargins.right());
-				page->Margins.setLeft(page->initialMargins.left());
+				if (m_docPrefsData.docSetupPrefs.binding == 1)
+				{
+					page->Margins.setRight(page->initialMargins.left());
+					page->Margins.setLeft(page->initialMargins.right());
+				}
+				else
+				{
+					page->Margins.setRight(page->initialMargins.right());
+					page->Margins.setLeft(page->initialMargins.left());
+				}
 			}
 			counter++;
 			if (counter > pageSets()[m_docPrefsData.docSetupPrefs.pagePositioning].Columns-1)
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(revision 22367)
+++ scribus/scribusdoc.h	(working copy)
@@ -188,7 +188,11 @@
 	const QString& language() const { return m_docPrefsData.docSetupPrefs.language; }
 	void setLanguage(const QString& s) { m_docPrefsData.docSetupPrefs.language=s; }
 	int pageOrientation() const { return m_docPrefsData.docSetupPrefs.pageOrientation; }
+	int pageBiding() const {return m_docPrefsData.docSetupPrefs.binding; }
 	void setPageOrientation(int o) { m_docPrefsData.docSetupPrefs.pageOrientation=o; }
+	void setBinding(int x) {m_docPrefsData.docSetupPrefs.binding = x;
+						   m_docPrefsData.pdfPrefs.Binding = x;
+						   }
 	int pagePositioning() const { return m_docPrefsData.docSetupPrefs.pagePositioning; }
 	void setPagePositioning(int p) { m_docPrefsData.docSetupPrefs.pagePositioning=p; }
 	double pageHeight() const { return m_docPrefsData.docSetupPrefs.pageHeight; }
Index: scribus/ui/newfile.cpp
===================================================================
--- scribus/ui/newfile.cpp	(revision 22367)
+++ scribus/ui/newfile.cpp	(working copy)
@@ -290,6 +290,14 @@
 	pageCountLabel->setBuddy(pageCountSpinBox);
 	optionsGroupBoxLayout->addRow( pageCountLabel, pageCountSpinBox);
 
+	layoutLabel2 = new QLabel( optionsGroupBox );
+	layoutLabel2->setText( tr( "Binding Direction:" ) );
+	bind = new ScComboBox( optionsGroupBox );
+	optionsGroupBoxLayout->addRow( layoutLabel2, bind );
+	bind->addItem(tr("Left To Right"));
+	bind->addItem(tr("Right To Left"));
+	bind->setCurrentIndex(prefsManager->appPrefs.docSetupPrefs.binding);
+
 	layoutLabel1 = new QLabel( optionsGroupBox );
 	layoutLabel1->setText( tr( "First Page is:" ) );
 	firstPage = new ScComboBox( optionsGroupBox );
@@ -462,7 +470,7 @@
 		QStringList::Iterator pNames;
 		for(pNames = prefsManager->appPrefs.pageSets[nr].pageNames.begin(); pNames != prefsManager->appPrefs.pageSets[nr].pageNames.end(); ++pNames )
 		{
-			firstPage->addItem(CommonStrings::translatePageSetLocString((*pNames)));
+			firstPage->addItem(CommonStrings::translatePageSetLocString((*pNames), bind->currentIndex()));
 		}
 	}
 	else
Index: scribus/ui/newfile.h
===================================================================
--- scribus/ui/newfile.h	(revision 22367)
+++ scribus/ui/newfile.h	(working copy)
@@ -75,6 +75,8 @@
 	QFrame* newDocFrame;
 	PageLayoutsWidget* layoutsView;
 	QLabel* layoutLabel1;
+	QLabel* layoutLabel2;
+	ScComboBox* bind;
 	ScComboBox* firstPage;
 	QGroupBox* pageSizeGroupBox;
 	MarginWidget* marginGroup;
@@ -151,7 +153,6 @@
 	void gotoDesktopDirectory();
 	void gotoHomeDirectory();
 	void openFileDialogFileClicked(const QString &path);
-
 protected:
 	QVBoxLayout* TabbedNewDocLayout;
 	QHBoxLayout* Layout1;
Index: scribus/ui/pagelayout.cpp
===================================================================
--- scribus/ui/pagelayout.cpp	(revision 22367)
+++ scribus/ui/pagelayout.cpp	(working copy)
@@ -78,6 +78,11 @@
 	layoutsCombo = new ScComboBox( this );
 	layoutGroupLayout->addWidget( layoutsCombo );
 
+	layoutLable2 = new QLabel( this );
+	layoutGroupLayout->addWidget( layoutLable2 );
+	bind = new ScComboBox( this );
+	layoutGroupLayout->addWidget( bind );
+
 	layoutLabel1 = new QLabel( this );
 	layoutGroupLayout->addWidget( layoutLabel1 );
 	firstPage = new ScComboBox( this );
@@ -87,6 +92,7 @@
 
 	connect(layoutsCombo, SIGNAL(activated(int)), this, SLOT(itemSelected(int)));
 	connect(firstPage, SIGNAL(activated(int)), this, SIGNAL(selectedFirstPage(int)));
+	connect(bind, SIGNAL(activated(int)), this, SIGNAL(selectBinding(int)));
 }
 
 PageLayouts::PageLayouts(QWidget* parent, QList<PageSet> pSets, bool mode)  : QGroupBox( parent )
@@ -106,6 +112,10 @@
 		layoutsCombo = new ScComboBox( this );
 		layoutGroupLayout->addWidget( layoutsCombo );
 	}
+	layoutLable2 = new QLabel( this );
+	layoutGroupLayout->addWidget( layoutLable2 );
+	bind = new ScComboBox( this );
+	layoutGroupLayout->addWidget( bind );
 	layoutLabel1 = new QLabel( this );
 	layoutGroupLayout->addWidget( layoutLabel1 );
 	firstPage = new ScComboBox( this );
@@ -163,7 +173,7 @@
 		QStringList::Iterator pNames;
 		for(pNames = pageSets[nr].pageNames.begin(); pNames != pageSets[nr].pageNames.end(); ++pNames )
 		{
-			firstPage->addItem(CommonStrings::translatePageSetLocString((*pNames)));
+			firstPage->addItem(CommonStrings::translatePageSetLocString((*pNames), bind->currentIndex()));
 		}
 	}
 	else
@@ -196,7 +206,7 @@
 		QStringList::Iterator pNames;
 		for(pNames = pageSets[chosen].pageNames.begin(); pNames != pageSets[chosen].pageNames.end(); ++pNames )
 		{
-			firstPage->addItem(CommonStrings::translatePageSetLocString((*pNames)));
+			firstPage->addItem(CommonStrings::translatePageSetLocString((*pNames), bind->currentIndex()));
 		}
 	}
 	else
@@ -288,11 +298,14 @@
 		if (currIndex>=0 && currIndex<pageSets.count())
 			for(QStringList::Iterator pNames = pageSets[currIndex].pageNames.begin(); pNames != pageSets[currIndex].pageNames.end(); ++pNames )
 			{
-				firstPage->addItem(CommonStrings::translatePageSetLocString((*pNames)));
+				firstPage->addItem(CommonStrings::translatePageSetLocString((*pNames), bind->currentIndex()));
 			}
 		firstPage->setCurrentIndex(currFirstPageIndex);
 		connect(firstPage, SIGNAL(activated(int)), this, SIGNAL(selectedFirstPage(int)));
 	}
+	layoutLable2->setText( tr( "Binding Direction: " ));
+	bind->addItem(tr("Left To Right"));
+	bind->addItem(tr("Right To Left"));
 	layoutLabel1->setText( tr( "First Page is:" ) );
 
 	QString layoutText( tr( "Number of pages to show side-by-side on the canvas. Often used for allowing items to be placed across page spreads." ) );
Index: scribus/ui/pagelayout.h
===================================================================
--- scribus/ui/pagelayout.h	(revision 22367)
+++ scribus/ui/pagelayout.h	(working copy)
@@ -51,6 +51,8 @@
 	QLabel* layoutLabel1;
 	ScComboBox* firstPage;
 	QList<PageSet> pageSets;
+	QLabel* layoutLable2;
+	ScComboBox* bind;
 
 public slots:
 	void itemSelected(QListWidgetItem* ic);
@@ -59,6 +61,7 @@
 signals:
 	void selectedLayout(int);
 	void selectedFirstPage(int);
+	void selectBinding(int);
 
 private:
 	void itemSelectedPost(int chosen);
Index: scribus/ui/pagepalette_pages.cpp
===================================================================
--- scribus/ui/pagepalette_pages.cpp	(revision 22367)
+++ scribus/ui/pagepalette_pages.cpp	(working copy)
@@ -70,6 +70,7 @@
 	connect(masterPageList, SIGNAL(thumbnailChanged()), this, SLOT(rebuildMasters()));
 	connect(masterPageList, SIGNAL(DelMaster(QString)), this, SLOT(deleteMasterPage(QString)));
 
+	connect(pageLayout, SIGNAL(selectBinding(int))     , this, SLOT(handleBinging(int)));
 	connect(pageLayout, SIGNAL(selectedLayout(int ))   , this, SLOT(handlePageLayout(int )));
 	connect(pageLayout, SIGNAL(selectedFirstPage(int )), this, SLOT(handleFirstPage(int )));
 	connect(pageView  , SIGNAL(Click(int, int, int))   , this, SLOT(pageView_gotoPage(int, int, int)));
@@ -164,6 +165,15 @@
 	pageLayout->setEnabled(enabled);
 }
 
+void PagePalette_Pages::handleBinging(int bind)
+{
+	currView->Doc->setBinding(bind);
+	currView->reformPages();
+	currView->DrawNew();
+	currView->GotoPage(currView->Doc->currentPageNumber());
+	rebuildPages();
+}
+
 void PagePalette_Pages::handlePageLayout(int layout)
 {
 	pageLayout->selectFirstP(currView->Doc->pageSets()[layout].FirstPage);
Index: scribus/ui/pagepalette_pages.h
===================================================================
--- scribus/ui/pagepalette_pages.h	(revision 22367)
+++ scribus/ui/pagepalette_pages.h	(working copy)
@@ -50,6 +50,7 @@
 	void markPage(uint nr);
 	void selMasterPage();
 	void languageChange();
+	void handleBinging(int);
 
 private slots:
 	void pageView_applyMasterPage(QString masterpageName, int pageIndex);
Index: scribus/ui/prefs_documentsetup.cpp
===================================================================
--- scribus/ui/prefs_documentsetup.cpp	(revision 22367)
+++ scribus/ui/prefs_documentsetup.cpp	(working copy)
@@ -150,6 +150,7 @@
 	pageWidthSpinBox->setValue(pageW * unitRatio);
 	pageHeightSpinBox->setValue(pageH * unitRatio);
 	pageSets=prefsData->pageSets;
+	bind->setCurrentIndex(prefsData->docSetupPrefs.binding);
 	if (prefsData->docSetupPrefs.pagePositioning < 2)
 	{
 		threeFoldRadioButton->hide();
@@ -221,6 +222,7 @@
 	prefsData->docSetupPrefs.pagePositioning=pageLayoutButtonGroup->checkedId();
 	prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage=layoutFirstPageIsComboBox->currentIndex();
 
+	prefsData->docSetupPrefs.binding = bind->currentIndex();
 	prefsData->docSetupPrefs.margins=marginsWidget->margins();
 	prefsData->docSetupPrefs.bleeds=bleedsWidget->margins();
 	prefsData->docSetupPrefs.saveCompressed=saveCompressedCheckBox->isChecked();
@@ -249,9 +251,18 @@
 	if (currIndex>0 && currIndex<pageSets.count())
 	{
 		layoutFirstPageIsComboBox->setEnabled(true);
-		for(QStringList::Iterator pNames = pageSets[currIndex].pageNames.begin(); pNames != pageSets[currIndex].pageNames.end(); ++pNames )
-			layoutFirstPageIsComboBox->addItem(CommonStrings::translatePageSetLocString(*pNames));
-		layoutFirstPageIsComboBox->setCurrentIndex(i<0?0:i);
+		if ( bind->currentIndex() == 0){
+			for(QStringList::Iterator pNames = pageSets[currIndex].pageNames.begin(); pNames != pageSets[currIndex].pageNames.end(); ++pNames )
+				layoutFirstPageIsComboBox->addItem(CommonStrings::translatePageSetLocString(*pNames));
+			layoutFirstPageIsComboBox->setCurrentIndex(i<0?0:i);
+		}
+		else
+		{
+			layoutFirstPageIsComboBox->addItem("Right Page");
+			layoutFirstPageIsComboBox->addItem("Left Page");
+
+			layoutFirstPageIsComboBox->setCurrentIndex(i<0?0:i);
+		}
 	}
 	else
 	{
Index: scribus/ui/prefs_documentsetup.h
===================================================================
--- scribus/ui/prefs_documentsetup.h	(revision 22367)
+++ scribus/ui/prefs_documentsetup.h	(working copy)
@@ -12,9 +12,9 @@
 #include "prefs_pane.h"
 #include "scribusapi.h"
 #include "scribusstructs.h"
+//#include "scribusdoc.h"
 
 class ScribusDoc;
-
 class SCRIBUS_API Prefs_DocumentSetup : public Prefs_Pane, Ui::Prefs_DocumentSetup
 {
 	Q_OBJECT
Index: scribus/ui/prefs_documentsetupbase.ui
===================================================================
--- scribus/ui/prefs_documentsetupbase.ui	(revision 22367)
+++ scribus/ui/prefs_documentsetupbase.ui	(working copy)
@@ -38,7 +38,7 @@
    <item>
     <widget class="QTabWidget" name="tabWidget">
      <property name="currentIndex">
-      <number>0</number>
+      <number>1</number>
      </property>
      <widget class="QWidget" name="sizeTab">
       <attribute name="title">
@@ -247,7 +247,7 @@
        </item>
        <item>
         <layout class="QFormLayout" name="pageLayoutLayout">
-         <item row="4" column="0">
+         <item row="7" column="0">
           <widget class="QLabel" name="layoutFirstPageIsLabel">
            <property name="text">
             <string>First Page is:</string>
@@ -257,7 +257,7 @@
            </property>
           </widget>
          </item>
-         <item row="4" column="1">
+         <item row="7" column="1">
           <widget class="QComboBox" name="layoutFirstPageIsComboBox">
            <property name="sizeAdjustPolicy">
             <enum>QComboBox::AdjustToContents</enum>
@@ -307,6 +307,27 @@
            </attribute>
           </widget>
          </item>
+         <item row="4" column="1">
+          <widget class="QComboBox" name="bind">
+           <item>
+            <property name="text">
+             <string>Left To Right</string>
+            </property>
+           </item>
+           <item>
+            <property name="text">
+             <string>Right To Left</string>
+            </property>
+           </item>
+          </widget>
+         </item>
+         <item row="4" column="0">
+          <widget class="QLabel" name="bindLable">
+           <property name="text">
+            <string>Binding Direction:</string>
+           </property>
+          </widget>
+         </item>
         </layout>
        </item>
        <item>
@@ -349,7 +370,7 @@
             <x>0</x>
             <y>0</y>
             <width>458</width>
-            <height>540</height>
+            <height>546</height>
            </rect>
           </property>
           <layout class="QVBoxLayout" name="verticalLayout_5">
Index: scribus/ui/prefs_pdfexport.cpp
===================================================================
--- scribus/ui/prefs_pdfexport.cpp	(revision 22367)
+++ scribus/ui/prefs_pdfexport.cpp	(working copy)
@@ -214,8 +214,8 @@
 
 	i = pageBindingComboBox->currentIndex();
 	pageBindingComboBox->clear();
-	pageBindingComboBox->addItem( tr("Left Margin"));
-	pageBindingComboBox->addItem( tr("Right Margin"));
+	pageBindingComboBox->addItem( tr("Left To Right"));
+	pageBindingComboBox->addItem( tr("Right To Lef"));
 	pageBindingComboBox->setCurrentIndex(i);
 
 	i = outputIntentionComboBox->currentIndex();
Index: scribus/ui/tabpdfoptions.ui
===================================================================
--- scribus/ui/tabpdfoptions.ui	(revision 22367)
+++ scribus/ui/tabpdfoptions.ui	(working copy)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>657</width>
-    <height>549</height>
+    <height>609</height>
    </rect>
   </property>
   <property name="currentIndex">
@@ -238,12 +238,12 @@
            </property>
            <item>
             <property name="text">
-             <string>Left Margin</string>
+             <string>Left To Right</string>
             </property>
            </item>
            <item>
             <property name="text">
-             <string>Right Margin</string>
+             <string>Right To Left</string>
             </property>
            </item>
           </widget>
Binding.patch (26,083 bytes)   

munzirtaha

2018-03-26 13:16

reporter   ~0045103

The "Binding Direction" now disappears altogether and there is no way to set it.

Fahad

2018-03-26 15:12

developer   ~0045105

@munzirtaha It is weird. Something went wrong. Anyhow, please use our git repository to get latest update from here,
https://github.com/HOST-Oman/scribus

make sure to use 'host' branch. Then you can report the bugs here or in out github repository.

Thanks,

munzirtaha

2018-03-27 06:57

reporter   ~0045109

I tested the OMAN host branch and still same exact issue! No option for "Binding Direction"

Fahad

2018-03-27 08:01

developer   ~0045111

could you please attach screen shot for the problem.

munzirtaha

2018-03-28 11:30

reporter   ~0045113

I did another recompile and indeed things are better. However, there are some glitches. .e.g
1. Set Binding Direction: Right To Left. First Page is: Left Page. Check Automatic Text Frames and Show Document Settings After Creation. Set Preset Layouts: Fibonacci
2. On the Document Setup Window, if you click Cancel you get First Page wrongly as Right Page.
3. And if you click OK, you get the text frames not aligned properly to the page frame
scribus-1.png (144,518 bytes)   
scribus-1.png (144,518 bytes)   
scribus-2.png (201,906 bytes)   
scribus-2.png (201,906 bytes)   
scribus-3.png (90,500 bytes)   
scribus-3.png (90,500 bytes)   

munzirtaha

2018-04-17 19:38

reporter   ~0045165

@Fahad: What happened to this bug? You have all done a great job so don't give up

Fahad

2018-05-01 03:41

developer   ~0045195

@munzirtaha could you please test the latest code from HOST now?

munzirtaha

2018-05-01 11:09

reporter   ~0045196

I did a clone to the HOST repo and the compilation failed with

Scanning dependencies of target importpdf
[ 81%] Building CXX object scribus/plugins/import/pdf/CMakeFiles/importpdf.dir/importpdf.cpp.o
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp: In member function ‘bool PdfPlug::convert(const QString&)’:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:546:61: error: invalid conversion from ‘const GooString*’ to ‘GooString*’ [-fpermissive]
            QString ocgName = UnicodeParsedString(oc->getName());
                                                  ~~~~~~~~~~~^~
In file included from /home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:29:0:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.h:84:10: note: initializing argument 1 of ‘QString PdfPlug::UnicodeParsedString(GooString*)’
  QString UnicodeParsedString(GooString *s1);
          ^~~~~~~~~~~~~~~~~~~
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:565:61: error: invalid conversion from ‘const GooString*’ to ‘GooString*’ [-fpermissive]
            QString ocgName = UnicodeParsedString(oc->getName());
                                                  ~~~~~~~~~~~^~
In file included from /home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:29:0:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.h:84:10: note: initializing argument 1 of ‘QString PdfPlug::UnicodeParsedString(GooString*)’
  QString UnicodeParsedString(GooString *s1);
          ^~~~~~~~~~~~~~~~~~~
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:583:59: error: invalid conversion from ‘const GooString*’ to ‘GooString*’ [-fpermissive]
          QString ocgName = UnicodeParsedString(oc->getName());
                                                ~~~~~~~~~~~^~
In file included from /home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:29:0:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.h:84:10: note: initializing argument 1 of ‘QString PdfPlug::UnicodeParsedString(GooString*)’
  QString UnicodeParsedString(GooString *s1);
          ^~~~~~~~~~~~~~~~~~~
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:610:52: error: invalid conversion from ‘const GooString*’ to ‘GooString*’ [-fpermissive]
         if (actL != UnicodeParsedString(oc->getName()))
                                         ~~~~~~~~~~~^~
In file included from /home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:29:0:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.h:84:10: note: initializing argument 1 of ‘QString PdfPlug::UnicodeParsedString(GooString*)’
  QString UnicodeParsedString(GooString *s1);
          ^~~~~~~~~~~~~~~~~~~
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:611:72: error: invalid conversion from ‘const GooString*’ to ‘GooString*’ [-fpermissive]
          currentLayer = m_Doc->addLayer(UnicodeParsedString(oc->getName()), false);
                                                             ~~~~~~~~~~~^~
In file included from /home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:29:0:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.h:84:10: note: initializing argument 1 of ‘QString PdfPlug::UnicodeParsedString(GooString*)’
  QString UnicodeParsedString(GooString *s1);
          ^~~~~~~~~~~~~~~~~~~
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:613:79: error: invalid conversion from ‘const GooString*’ to ‘GooString*’ [-fpermissive]
          currentLayer = m_Doc->layerIDFromName(UnicodeParsedString(oc->getName()));
                                                                    ~~~~~~~~~~~^~
In file included from /home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:29:0:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.h:84:10: note: initializing argument 1 of ‘QString PdfPlug::UnicodeParsedString(GooString*)’
  QString UnicodeParsedString(GooString *s1);
          ^~~~~~~~~~~~~~~~~~~
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:639:73: error: invalid conversion from ‘const GooString*’ to ‘GooString*’ [-fpermissive]
         m_Doc->documentInfo().setTitle(UnicodeParsedString(obj.getString()));
                                                            ~~~~~~~~~~~~~^~
In file included from /home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:29:0:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.h:84:10: note: initializing argument 1 of ‘QString PdfPlug::UnicodeParsedString(GooString*)’
  QString UnicodeParsedString(GooString *s1);
          ^~~~~~~~~~~~~~~~~~~
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:644:74: error: invalid conversion from ‘const GooString*’ to ‘GooString*’ [-fpermissive]
         m_Doc->documentInfo().setAuthor(UnicodeParsedString(obj.getString()));
                                                             ~~~~~~~~~~~~~^~
In file included from /home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:29:0:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.h:84:10: note: initializing argument 1 of ‘QString PdfPlug::UnicodeParsedString(GooString*)’
  QString UnicodeParsedString(GooString *s1);
          ^~~~~~~~~~~~~~~~~~~
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:649:75: error: invalid conversion from ‘const GooString*’ to ‘GooString*’ [-fpermissive]
         m_Doc->documentInfo().setSubject(UnicodeParsedString(obj.getString()));
                                                              ~~~~~~~~~~~~~^~
In file included from /home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:29:0:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.h:84:10: note: initializing argument 1 of ‘QString PdfPlug::UnicodeParsedString(GooString*)’
  QString UnicodeParsedString(GooString *s1);
          ^~~~~~~~~~~~~~~~~~~
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:655:76: error: invalid conversion from ‘const GooString*’ to ‘GooString*’ [-fpermissive]
         m_Doc->documentInfo().setKeywords(UnicodeParsedString(obj.getString()));
                                                               ~~~~~~~~~~~~~^~
In file included from /home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:29:0:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.h:84:10: note: initializing argument 1 of ‘QString PdfPlug::UnicodeParsedString(GooString*)’
  QString UnicodeParsedString(GooString *s1);
          ^~~~~~~~~~~~~~~~~~~
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:916:63: error: invalid conversion from ‘const GooString*’ to ‘GooString*’ [-fpermissive]
            QString script = UnicodeParsedString(jsa->getScript());
                                                 ~~~~~~~~~~~~~~^~
In file included from /home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.cpp:29:0:
/home/munzir/Downloads/build/scribus/scribus/plugins/import/pdf/importpdf.h:84:10: note: initializing argument 1 of ‘QString PdfPlug::UnicodeParsedString(GooString*)’
  QString UnicodeParsedString(GooString *s1);
          ^~~~~~~~~~~~~~~~~~~
make[2]: *** [scribus/plugins/import/pdf/CMakeFiles/importpdf.dir/build.make:78: scribus/plugins/import/pdf/CMakeFiles/importpdf.dir/importpdf.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1912: scribus/plugins/import/pdf/CMakeFiles/importpdf.dir/all] Error 2
make: *** [Makefile:152: all] Error 2

Fahad

2018-05-02 06:40

developer   ~0045197

@munzirtaha it's strange but the error is not related to our work. Try to clone the scribus trunk version and compile it and see.

jghali

2018-05-02 08:53

administrator   ~0045198

This error is related to the use of a recent poppler version (0.63.0 or 0.64.0). It has been fixed in trunk by commit r22498.

munzirtaha

2018-05-02 10:08

reporter   ~0045199

@jghali: Thanks.
@Fahad: Please, merge the latest updates from trunk, so I can test

jghali

2018-05-02 14:32

administrator   ~0045201

I committed an additional fix as r22513 after upgrading my poppler libs to 0.64.0.

Fahad

2018-05-02 17:52

developer   ~0045202

@jghali: Thanks.
@munzirtaha done.

munzirtaha

2018-05-03 12:18

reporter   ~0045205

Thanks. Quick review:
- The "Document Setup" is not consistent with "Arrange Pages". See attachment.
- Why do we need "First Page is:" option? Doesn't every "Right to Left" book starts with a "Left Page". In all cases, "Left Page" should be the default for RTL
- Why scribus -reverse not working? I would like to test in RTL mode
- I tested setLayoutDirection(Qt::RightToLeft); for QTableWidget and it seems to work so why can't you set the direction when "Right to Left" is chosen which would cater for some use cases at least?
- File -> Export -> PDF shows the default binding as "Left to Right", the default should be consistent with the document properties.
- How can I test the PDF binding? Tried okular -> View Mode -> Facing Pages, but it's always LTR
- Typos: e.g
  - *rt lfirst* pages
  - I *couldent* solve first page position with *reight* binding so I use this *temperory* conditions until I can do better
scribus.png (386,012 bytes)   
scribus.png (386,012 bytes)   

Fahad

2018-05-04 15:49

developer   ~0045206

>> - Why scribus -reverse not working? I would like to test in RTL mode
>> - I tested setLayoutDirection(Qt::RightToLeft); for QTableWidget and it seems to work so why can't you set the direction when "Right to Left" is chosen which >> would cater for some use cases at least?
You can change scribus language from preferences, if you choose arabic then scribus will be in RTL mode.

>> - How can I test the PDF binding? Tried okular -> View Mode -> Facing Pages, but it's always LTR
You should enable RTL reading mode from okular preferences. I implemented this while ago or you can use Adobe reader or qpdfview.

munzirtaha

2018-05-07 17:06

reporter   ~0045209

>> You should enable RTL reading mode from okular preferences.I implemented this while ago or
>> you can use Adobe reader or qpdfview

Both okular and qpdfview don't respect the "PageDirection". I have to manually set the reading direction. There is no way I found to test the feature you implemented which is setting the PageDirection in the pdf to R2L

Fahad

2018-05-08 04:12

developer   ~0045210

@munzirtaha so things work fine? For pdf readers you should open tickets in their bug systems to implement R2L feature.

munzirtaha

2018-05-09 03:55

reporter   ~0045213

@Fahad: I am still waiting for comments or fixes to the 7 issues I listed.

Fahad

2018-05-09 04:15

developer   ~0045214

>> Why do we need "First Page is:" option? Doesn't every "Right to Left" book starts with a "Left Page". In all cases, "Left Page" should be the default for RTL.
Because you ask for it in the first place :-) & to be same as LTR layout. In Adobe Indesign has one option "center" for both RTL & LTR.

The other issues should be fixed but I don't know when.

munzirtaha

2018-05-19 09:50

reporter   ~0045258

I also don't see why we need to enable the direction widget for the pdf export. It should just be read from the settings in the document setup. I think other DTP also do it this way

munzirtaha

2018-05-20 12:43

reporter   ~0045260

I also filed a bug against okular for the R2L feature
https://bugs.kde.org/show_bug.cgi?id=394471

ale

2019-01-01 17:49

manager   ~0045742

in LTR there is a need for being able to set the first page to the left or right one.

for books you always have the first page to the right, that's true.
but, as an example i've been creating a document that was to be printed on A6 "cards": each double pages is a front and back.

the same if you have a document that you will be printing double sided on a laser printer and stitch.

of course, you're right assuming that the "normal" case is "first page right", and -- of course -- one could say that most (if not all) cases where the first page is left can be layouted as single page... but it's handy to be able to set the first page to the left one.

ale

2019-01-02 08:23

manager   ~0045743

i've had a look at the "arrange pages" dialog and there are several things in there that are not correct (any more).

on top of it, i recall having tried to modify things in there (having both an horizontal and a vertical view) and it was rather hard to

- understand how it did work
- change things

since the page order is a very important feature for being able to correctly use scribus with RTL languages, i'd like to suggest you to

- separate the changes to the page layout on canvas from the changes to the "arrange pages" dialog
- add a warning to the "arrange pages" that is only shown when the document is in "RTL mode", and ask the users not to use it.
- work on a new window (with a new name?) that does work correctly and that should in the long term replace the "arrange pages" one.

personally, i could not try the current state of the "host" branch, since it does not seem to compile on debian testing anymore. would you mind pulling in the current state of the scribus HEAD?

Fahad

2019-01-02 09:34

developer   ~0045744

@ale: I just update host repo to latest version.

ale

2019-01-02 11:00

manager   ~0045745

thanks @fahad !
i can now compile, but i still don't get the "arrange pages" dialog to show anything meaningful:

when i click on the canvas, the pages seem to be correctly places, with page 2 being on the right of page 3.

but, as i wrote above, i would suggest you, not to try to fix the "arrange pages" window and go for a new implementation that should replace it.
rtl-document.png (113,883 bytes)   
rtl-document.png (113,883 bytes)   

utnik

2019-01-03 20:51

updater   ~0045746

i don't know if this should be a separate request, but if binding options are implemented, it could be good to think about top binding as well.

ale

2019-01-04 08:41

manager   ~0045747

@utnik: for calendars?

[1]
[2]

[3]
[4]

[5]
[6]

or for top down languages?

can you give an example?

utnik

2019-01-04 08:46

updater   ~0045748

i was thinking of calendars.
top down languages might use a standard ltr book layout.

ahangarha

2020-10-07 18:00

reporter   ~0048134

Any update? Long time has passed and still I face with this issue in version 1.5.5.

help

2023-10-16 14:00

reporter   ~0050382

Hello every one,

Thank you a lot off for what you doing helping and more,
I am so new on scribus and try to understand every things,
The first things i did not understand how to patch scribus, and finaly i thin i understand as you see on the screen shot, but i have a error message,
so i tried to read all message about RTL, and knwo i realy not understanding if the patch work or not, because i did the test with a file test and the nember page is alays in the same place in the view and in the page too the page too is always on the left not on right
I put a different screen shot for to show you that i can not fix the issue ! thank you a lot off
image.png (11,856 bytes)   
image.png (11,856 bytes)   
image-2.png (22,759 bytes)   
image-2.png (22,759 bytes)   
image-3.png (61,571 bytes)   
image-3.png (61,571 bytes)   

ale

2023-10-16 15:43

manager   ~0050383

Last edited: 2023-10-16 15:51

hi @help

your ticket is more a request for support: would you mind posting your question in https://forums.scribus.net ?

help

2023-10-16 16:24

reporter   ~0050384

@ale
for me no, is about RTL and the PATCH.
and i did not find a procedure of patching i posted about RTL in 0017030,
Anybody says how to patch scribus with the tows patch of RTL !
thank you

Issue History

Date Modified Username Field Change
2017-01-08 09:32 Fahad New Issue
2017-01-09 09:49 FirasH Product Version 1.5.3 => 1.5.3.svn
2017-01-09 11:18 jghali Note Added: 0043313
2017-01-11 04:40 Fahad Note Added: 0043319
2017-01-11 04:40 Fahad Note Edited: 0043319
2017-05-20 02:56 munzirtaha Note Added: 0043916
2017-05-22 08:27 ale Relationship added has duplicate 0002632
2018-03-22 08:17 Fahad File Added: 0001-add-initial-RTL-binding-direction.patch
2018-03-22 08:17 Fahad Note Added: 0045074
2018-03-22 19:26 munzirtaha File Added: scribus-bug.png
2018-03-22 19:26 munzirtaha Note Added: 0045077
2018-03-23 11:23 Fahad Note Added: 0045079
2018-03-23 12:00 jghali Note Added: 0045080
2018-03-23 12:07 jghali Note Edited: 0045080
2018-03-23 14:10 munzirtaha Note Added: 0045081
2018-03-23 16:30 Fahad File Added: test.sla
2018-03-23 16:30 Fahad Note Added: 0045082
2018-03-24 19:02 Fahad Note Added: 0045087
2018-03-25 16:12 munzirtaha File Added: test.png
2018-03-25 16:12 munzirtaha Note Added: 0045093
2018-03-26 06:39 Fahad File Added: Binding.patch
2018-03-26 06:39 Fahad Note Added: 0045096
2018-03-26 13:16 munzirtaha Note Added: 0045103
2018-03-26 15:12 Fahad Note Added: 0045105
2018-03-27 06:57 munzirtaha Note Added: 0045109
2018-03-27 08:01 Fahad Note Added: 0045111
2018-03-28 11:30 munzirtaha File Added: scribus-1.png
2018-03-28 11:30 munzirtaha File Added: scribus-2.png
2018-03-28 11:30 munzirtaha File Added: scribus-3.png
2018-03-28 11:30 munzirtaha Note Added: 0045113
2018-04-17 19:38 munzirtaha Note Added: 0045165
2018-05-01 03:41 Fahad Note Added: 0045195
2018-05-01 11:09 munzirtaha Note Added: 0045196
2018-05-02 06:40 Fahad Note Added: 0045197
2018-05-02 08:53 jghali Note Added: 0045198
2018-05-02 10:08 munzirtaha Note Added: 0045199
2018-05-02 14:32 jghali Note Added: 0045201
2018-05-02 17:52 Fahad Note Added: 0045202
2018-05-03 12:18 munzirtaha File Added: scribus.png
2018-05-03 12:18 munzirtaha Note Added: 0045205
2018-05-04 15:49 Fahad Note Added: 0045206
2018-05-07 17:06 munzirtaha Note Added: 0045209
2018-05-08 04:12 Fahad Note Added: 0045210
2018-05-09 03:55 munzirtaha Note Added: 0045213
2018-05-09 04:15 Fahad Note Added: 0045214
2018-05-19 09:50 munzirtaha Note Added: 0045258
2018-05-20 12:43 munzirtaha Note Added: 0045260
2019-01-01 17:49 ale Note Added: 0045742
2019-01-02 08:23 ale Note Added: 0045743
2019-01-02 09:34 Fahad Note Added: 0045744
2019-01-02 11:00 ale File Added: rtl-document.png
2019-01-02 11:00 ale Note Added: 0045745
2019-01-03 20:51 utnik Note Added: 0045746
2019-01-04 08:41 ale Note Added: 0045747
2019-01-04 08:46 utnik Note Added: 0045748
2020-10-07 18:00 ahangarha Note Added: 0048134
2023-10-16 06:59 jghali Relationship added has duplicate 0017030
2023-10-16 14:00 help Note Added: 0050382
2023-10-16 14:00 help File Added: image.png
2023-10-16 14:00 help File Added: image-2.png
2023-10-16 14:00 help File Added: image-3.png
2023-10-16 15:43 ale Note Added: 0050383
2023-10-16 15:51 ale Note Edited: 0050383
2023-10-16 16:24 help Note Added: 0050384