View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0014544 | Scribus | General | public | 2017-01-08 09:32 | 2025-06-08 20:11 |
Reporter | Fahad | Assigned To | |||
Priority | normal | Severity | feature | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 1.5.3.svn | ||||
Summary | 0014544: Layout should aware of RTL pages | ||||
Description | When 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 | ||||
Tags | No tags attached. | ||||
Patch | No | ||||
has duplicate | 0002632 | confirmed | Need to support right side binding in page ordering | |
has duplicate | 0017030 | closed | jghali | Paging from right to left |
has duplicate | 0017316 | closed | There isn't a RTL Page Layout for facing pages | |
related to | 0017384 | new | Add a LTR/RTL property in the "New Document" dialog and the "General" tab of the "Document Setup" | |
child of | 0017537 | new | Metabug: Inital support for RTL document for Scribus 1.8 |
|
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. |
|
@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? |
|
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 |
|
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 |
|
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. |
|
@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. |
|
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). |
|
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 ;) |
|
@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 |
|
@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? |
|
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. |
|
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> |
|
The "Binding Direction" now disappears altogether and there is no way to set it. |
|
@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, |
|
I tested the OMAN host branch and still same exact issue! No option for "Binding Direction" |
|
could you please attach screen shot for the problem. |
|
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 |
|
@Fahad: What happened to this bug? You have all done a great job so don't give up |
|
@munzirtaha could you please test the latest code from HOST now? |
|
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 |
|
@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. |
|
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. |
|
@jghali: Thanks. @Fahad: Please, merge the latest updates from trunk, so I can test |
|
I committed an additional fix as r22513 after upgrading my poppler libs to 0.64.0. |
|
@jghali: Thanks. @munzirtaha done. |
|
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 |
|
>> - 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. |
|
>> 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 |
|
@munzirtaha so things work fine? For pdf readers you should open tickets in their bug systems to implement R2L feature. |
|
@Fahad: I am still waiting for comments or fixes to the 7 issues I listed. |
|
>> 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. |
|
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 |
|
I also filed a bug against okular for the R2L feature https://bugs.kde.org/show_bug.cgi?id=394471 |
|
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. |
|
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? |
|
@ale: I just update host repo to latest version. |
|
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. |
|
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. |
|
@utnik: for calendars? [1] [2] [3] [4] [5] [6] or for top down languages? can you give an example? |
|
i was thinking of calendars. top down languages might use a standard ltr book layout. |
|
Any update? Long time has passed and still I face with this issue in version 1.5.5. |
|
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 |
|
hi @help your ticket is more a request for support: would you mind posting your question in https://forums.scribus.net ? |
|
@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 |
|
Hi everyone, Exciting news! I've been working on a new feature for Scribus: Binding Direction support. The development branch is available here for review: https://github.com/HOST-Oman/scribus/tree/rtlBinding I'm happy to report that I believe it's ready for your testing! My main focus was to ensure minimal impact on existing Scribus functionality; therefore, the LTR binding should work exactly as it did before. To fully support RTL binding, this patch includes changes to: Document handling: It now reads and saves the document's binding direction. Core ScribusDoc class: The binding direction is integrated into the ScribusDoc class. New document creation: The NewDocDialog now includes binding direction options. Page management: The PagePalette widget now displays and manages binding direction. Document preferences: Binding direction has been added to the Prefs_DocumentSetup dialog. You'll find screenshots and the patch attached for your convenience. Your feedback would be greatly appreciated! Thanks, docBindingDirection.patch (53,480 bytes)
diff --git a/scribus/commonstrings.cpp b/scribus/commonstrings.cpp index cb6f54c1f..66f1a413e 100644 --- a/scribus/commonstrings.cpp +++ b/scribus/commonstrings.cpp @@ -99,6 +99,10 @@ QString CommonStrings::trPageLocMiddle; QString CommonStrings::trPageLocMiddleLeft; QString CommonStrings::trPageLocMiddleRight; QString CommonStrings::trPageLocRight; +QString CommonStrings::docLoc_RTL_Binding; +QString CommonStrings::docLoc_LTR_Binding; +QString CommonStrings::trDocLoc_RTL_Binding; +QString CommonStrings::trDocLoc_LTR_Binding; QString CommonStrings:: masterPageNormal; QString CommonStrings:: trMasterPageNormal; @@ -240,7 +244,7 @@ const QString& CommonStrings::translatePageSetString(const QString &untrString) const QString& CommonStrings::translatePageSetLocString(const QString &untrString) { - if (untrString == pageLocLeft) + if (untrString == pageLocLeft) return trPageLocLeft; if (untrString == pageLocMiddle) return trPageLocMiddle; @@ -250,7 +254,25 @@ const QString& CommonStrings::translatePageSetLocString(const QString &untrStrin return trPageLocMiddleRight; if (untrString == pageLocRight) return trPageLocRight; - return untrString; + return untrString; +} + +const QString& CommonStrings::translateDocBindingLocString(const QString &untrString) +{ + if (untrString == docLoc_RTL_Binding) + return trDocLoc_RTL_Binding; + if (untrString == docLoc_LTR_Binding) + return trDocLoc_LTR_Binding; + return untrString; +} + +const QString& CommonStrings::untranslateDocBindingString(const QString &trString) +{ + if (trString == trDocLoc_RTL_Binding) + return docLoc_RTL_Binding; + if (trString == trDocLoc_LTR_Binding) + return docLoc_LTR_Binding; + return trString; } const QString& CommonStrings::untranslatePageSetString(const QString &trString) @@ -373,6 +395,11 @@ void CommonStrings::languageChange() CommonStrings::trPageLocMiddleRight = tr( "Middle Right", "Middle Right page location" ); CommonStrings::trPageLocRight = tr( "Right Page", "Right page location" ); + CommonStrings::docLoc_RTL_Binding = "Right to Left"; + CommonStrings::docLoc_LTR_Binding = "Left to Right"; + CommonStrings::trDocLoc_RTL_Binding = tr("Right to Left", "Right to Left Document binding direction"); + CommonStrings::trDocLoc_LTR_Binding = tr("Left to Right", "Left to Right Document Binding direction"); + CommonStrings::masterPageNormal = "Normal"; CommonStrings::trMasterPageNormal = tr( "Normal", "Default single master page" ); CommonStrings::masterPageNormalLeft = "Normal Left"; diff --git a/scribus/commonstrings.h b/scribus/commonstrings.h index 05006846a..6cf54bdb3 100644 --- a/scribus/commonstrings.h +++ b/scribus/commonstrings.h @@ -64,13 +64,25 @@ public: * @param untrString "untranslated" string * @return translated string */ - static const QString& translatePageSetLocString(const QString &untrString); + static const QString& translatePageSetLocString(const QString &untrString); + /** + * \brief Return the translated Document Binding direction string if given the "untranslated" one + * @param untrString "untranslated" string + * @return translated string + */ + static const QString& translateDocBindingLocString(const QString &untrString); /** * \brief Return the untranslated Page Set string if given the translated one * @param trString translated string * @return "untranslated" string */ static const QString& untranslatePageSetString(const QString &trString); + /** + * \brief Return the untranslated Document Binding direction string if given the translated one + * @param trString translated string + * @return "untranslated" string + */ + static const QString& untranslateDocBindingString(const QString &trString); /** * \brief Return the untranslated Page Set Location string if given the translated one * @param trString translated string @@ -165,6 +177,12 @@ public: static QString trPageLocMiddleRight; static QString trPageLocRight; + // Document Binding Direction + static QString docLoc_RTL_Binding; + static QString trDocLoc_RTL_Binding; + static QString docLoc_LTR_Binding; + static QString trDocLoc_LTR_Binding; + //Master Page Default Names static QString masterPageNormal; static QString trMasterPageNormal; diff --git a/scribus/plugins/fileloader/scribus150format/scribus150format.cpp b/scribus/plugins/fileloader/scribus150format/scribus150format.cpp index 076f3f200..bd889cbb7 100644 --- a/scribus/plugins/fileloader/scribus150format/scribus150format.cpp +++ b/scribus/plugins/fileloader/scribus150format/scribus150format.cpp @@ -3488,7 +3488,6 @@ bool Scribus150Format::readPDFOptions(ScribusDoc* doc, ScXmlStreamReader& reader // Fixme: check input pdf version doc->pdfOptions().Version = (PDFVersion::Version) attrs.valueAsInt("Version"); doc->pdfOptions().Resolution = attrs.valueAsInt("Resolution"); - doc->pdfOptions().Binding = attrs.valueAsInt("Binding"); doc->pdfOptions().fileName = ""; doc->pdfOptions().FontEmbedding = (PDFOptions::PDFFontEmbedding) attrs.valueAsInt("FontEmbedding", 0); diff --git a/scribus/plugins/fileloader/scribus171format/scribus171format.cpp b/scribus/plugins/fileloader/scribus171format/scribus171format.cpp index 1eb91e9f3..d68740726 100644 --- a/scribus/plugins/fileloader/scribus171format/scribus171format.cpp +++ b/scribus/plugins/fileloader/scribus171format/scribus171format.cpp @@ -2482,6 +2482,7 @@ void Scribus171Format::readDocAttributes(ScribusDoc* doc, const ScXmlStreamAttri m_Doc->setPageOrientation(attrs.valueAsInt("ORIENTATION", 0)); m_Doc->FirstPnum = attrs.valueAsInt("FIRSTNUM", 1); m_Doc->setPagePositioning(attrs.valueAsInt("BOOK", 0)); + m_Doc->setDocBindingDirection(attrs.valueAsInt("BINDINGDIRECTION", 0)); m_Doc->setUsesAutomaticTextFrames( attrs.valueAsInt("AUTOTEXT") ); m_Doc->PageSp = attrs.valueAsInt("AUTOSPALTEN"); @@ -2548,6 +2549,7 @@ void Scribus171Format::readDocAttributes(ScribusDoc* doc, const ScXmlStreamAttri m_Doc->setPageOrientation(attrs.valueAsInt("PageOrientation", 0)); m_Doc->FirstPnum = attrs.valueAsInt("FirstPageNumber", 1); m_Doc->setPagePositioning(attrs.valueAsInt("PagePositioning", 0)); + m_Doc->setDocBindingDirection(attrs.valueAsInt("BindingDirection", 0)); m_Doc->setUsesAutomaticTextFrames( attrs.valueAsInt("AutomaticTextFrames") ); m_Doc->PageSp = attrs.valueAsInt("AutomaticTextFrameColumnCount"); diff --git a/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp b/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp index 76185227d..41df2f9c6 100644 --- a/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp +++ b/scribus/plugins/fileloader/scribus171format/scribus171format_save.cpp @@ -336,6 +336,7 @@ bool Scribus171Format::saveFile(const QString & fileName, const FileFormat & /* docu.writeAttribute("PageSize", m_Doc->pageSize()); docu.writeAttribute("FirstPageNumber", m_Doc->FirstPnum); docu.writeAttribute("PagePositioning", m_Doc->pagePositioning()); + docu.writeAttribute("BindingDirection", m_Doc->docBindingDirection()); if (m_Doc->usesAutomaticTextFrames()) docu.writeAttribute("AutomaticTextFrames", 1); docu.writeAttribute("AutomaticTextFrameColumnCount", m_Doc->PageSp); diff --git a/scribus/prefsmanager.cpp b/scribus/prefsmanager.cpp index eccd2aaf9..61a6a2ab2 100644 --- a/scribus/prefsmanager.cpp +++ b/scribus/prefsmanager.cpp @@ -325,6 +325,7 @@ void PrefsManager::initDefaults() appPrefs.docSetupPrefs.language = "en_GB"; appPrefs.docSetupPrefs.pageSize = LocaleManager::instance().pageSizeForLocale(ScQApp->currGUILanguage()); appPrefs.docSetupPrefs.pageOrientation = 0; + appPrefs.docSetupPrefs.docBindingDirection = 0; PageSize defaultPageSize(appPrefs.docSetupPrefs.pageSize); appPrefs.docSetupPrefs.pageWidth = defaultPageSize.width(); appPrefs.docSetupPrefs.pageHeight = defaultPageSize.height(); @@ -1376,7 +1377,8 @@ bool PrefsManager::writePref(const QString& filePath) deDocumentSetup.setAttribute("Language", appPrefs.docSetupPrefs.language); deDocumentSetup.setAttribute("UnitIndex", appPrefs.docSetupPrefs.docUnitIndex); deDocumentSetup.setAttribute("PageSize", appPrefs.docSetupPrefs.pageSize); - deDocumentSetup.setAttribute("PageOrientation", appPrefs.docSetupPrefs.pageOrientation); + deDocumentSetup.setAttribute("PageBinding", appPrefs.docSetupPrefs.docBindingDirection); + deDocumentSetup.setAttribute("PageOrientation", appPrefs.docSetupPrefs.pageOrientation); deDocumentSetup.setAttribute("PageWidth", ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageWidth)); deDocumentSetup.setAttribute("PageHeight", ScCLocale::toQStringC(appPrefs.docSetupPrefs.pageHeight)); deDocumentSetup.setAttribute("MarginTop", ScCLocale::toQStringC(appPrefs.docSetupPrefs.margins.top())); @@ -2071,6 +2073,7 @@ bool PrefsManager::readPref(const QString& filePath) appPrefs.docSetupPrefs.docUnitIndex = dc.attribute("UnitIndex", "0").toInt(); PageSize ps( dc.attribute("PageSize", PageSize::defaultSizesList().at(1)) ); appPrefs.docSetupPrefs.pageSize = (ps.name() == CommonStrings::customPageSize ) ? PageSize::defaultSizesList().at(1) : ps.name(); + appPrefs.docSetupPrefs.docBindingDirection = 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 bbf957683..73acbc921 100644 --- a/scribus/prefsstructs.h +++ b/scribus/prefsstructs.h @@ -168,6 +168,7 @@ struct DocumentSetupPrefs bool AutoSaveLocation; QString AutoSaveDir; bool saveCompressed; + int docBindingDirection; }; //Guides diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp index d82ebbab1..d83a07ebb 100644 --- a/scribus/scribus.cpp +++ b/scribus/scribus.cpp @@ -2008,7 +2008,8 @@ void ScribusMainWindow::startUpDialog() if (dia->tabSelected() == NewDocDialog::NewDocumentTab) { int facingPages = dia->choosenLayout(); - int firstPage = dia->layoutFirstPage(); + int firstPage = dia->layoutFirstPage(); + int docBindingDirection = dia->bindingDirection(); docSet = dia->startDocSetup->isChecked(); double topMargin = dia->marginGroup->margins().top(); double bottomMargin = dia->marginGroup->margins().bottom(); @@ -2022,7 +2023,7 @@ void ScribusMainWindow::startUpDialog() int orientation = dia->orientation(); int pageCount = dia->pageCountSpinBox->value(); QString pagesize = dia->pageSizeName(); - doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->marginPreset()); + doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->marginPreset(), docBindingDirection); doc->setPageSetFirstPage(facingPages, firstPage); doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight()); HaveNewDoc(); @@ -2085,7 +2086,8 @@ bool ScribusMainWindow::slotFileNew() int facingPages = dia->choosenLayout(); int firstPage = dia->layoutFirstPage(); - bool docSet = dia->startDocSetup->isChecked(); + int docBindingDirection = dia->bindingDirection(); + bool docSet = dia->startDocSetup->isChecked(); double topMargin = dia->marginGroup->margins().top(); double bottomMargin = dia->marginGroup->margins().bottom(); double leftMargin = dia->marginGroup->margins().left(); @@ -2099,7 +2101,7 @@ bool ScribusMainWindow::slotFileNew() int pageCount = dia->pageCountSpinBox->value(); QString pagesize = dia->pageSizeName(); - if (doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->marginPreset())) + if (doFileNew(pageWidth, pageHeight, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, numberCols, autoframes, facingPages, dia->unitOfMeasureComboBox->currentIndex(), firstPage, orientation, 1, pagesize, true, pageCount, true, dia->marginGroup->marginPreset(), docBindingDirection)) { doc->setPageSetFirstPage(facingPages, firstPage); doc->bleeds()->set(dia->bleedTop(), dia->bleedLeft(), dia->bleedBottom(), dia->bleedRight()); @@ -2111,8 +2113,7 @@ bool ScribusMainWindow::slotFileNew() // doc changing should be rewritten maybe... maybe later... doc->setModified(false); updateActiveWindowCaption(doc->documentFileName()); - } - + } if (docSet) slotDocSetup(); return retVal; @@ -2124,7 +2125,8 @@ ScribusDoc *ScribusMainWindow::newDoc(double width, double height, double topMar return doFileNew(width, height, topMargin, leftMargin, rightMargin, bottomMargin, columnDistance, columnCount, autoTextFrames, pageArrangement, unitIndex, firstPageLocation, orientation, firstPageNumber, defaultPageSize, requiresGUI, pageCount, showView, marginPreset); } -ScribusDoc *ScribusMainWindow::doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount, bool showView, int marginPreset) +ScribusDoc *ScribusMainWindow::doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount, bool showView, int marginPreset, int + docBindingDircetion) { if (HaveDoc) outlinePalette->buildReopenVals(); @@ -2172,7 +2174,7 @@ ScribusDoc *ScribusMainWindow::doFileNew(double width, double height, double top doc->PageColors = m_prefsManager.appPrefs.colorPrefs.DColors; } tempDoc->PageColors.ensureDefaultColors(); - tempDoc->setup(unitIndex, pageArrangement, firstPageLocation, orientation, firstPageNumber, defaultPageSize, newDocName); + tempDoc->setup(unitIndex, pageArrangement, firstPageLocation, orientation, firstPageNumber, defaultPageSize, newDocName, docBindingDircetion); if (requiresGUI) { HaveDoc++; @@ -2361,6 +2363,7 @@ void ScribusMainWindow::extrasMenuAboutToShow() } allItems.clear(); } + //doc->setBinding(bind); } scrActions["extrasManageImages"]->setEnabled(enablePicManager); } diff --git a/scribus/scribus.h b/scribus/scribus.h index 566c4eb2c..2321ebb09 100644 --- a/scribus/scribus.h +++ b/scribus/scribus.h @@ -152,7 +152,8 @@ public: inline bool scriptIsRunning(void) const { return (m_ScriptRunning > 0); } inline void setScriptRunning(bool value) { m_ScriptRunning += (value ? 1 : -1); } - ScribusDoc* doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount = 1, bool showView = true, int marginPreset = 0); + ScribusDoc* doFileNew(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount = 1, bool showView = true, int marginPreset = 0, int + docBindingDircetion = 0); ScribusDoc* newDoc(double width, double height, double topMargin, double leftMargin, double rightMargin, double bottomMargin, double columnDistance, double columnCount, bool autoTextFrames, int pageArrangement, int unitIndex, int firstPageLocation, int orientation, int firstPageNumber, const QString& defaultPageSize, bool requiresGUI, int pageCount = 1, bool showView = true, int marginPreset = 0); bool DoFileSave(const QString& fileName, QString* savedFileName = nullptr, uint formatID = FORMATID_CURRENTEXPORT); diff --git a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp index 3a2f61254..127016ed0 100644 --- a/scribus/scribusdoc.cpp +++ b/scribus/scribusdoc.cpp @@ -678,7 +678,8 @@ QList<PageItem*> *ScribusDoc::parentGroup(PageItem* item, QList<PageItem*> *list return retList; } -void ScribusDoc::setup(int unitIndex, int fp, int firstLeft, int orientation, int firstPageNumber, const QString& defaultPageSize, const QString& documentName) +void ScribusDoc::setup(int unitIndex, int fp, int firstLeft, int orientation, int firstPageNumber, const QString& defaultPageSize, const QString& documentName, int + docBindingDirection) { m_docPrefsData.docSetupPrefs.docUnitIndex = unitIndex; setPageSetFirstPage(fp, firstLeft); @@ -686,6 +687,7 @@ void ScribusDoc::setup(int unitIndex, int fp, int firstLeft, int orientation, in m_docPrefsData.docSetupPrefs.pageSize = defaultPageSize; FirstPnum = firstPageNumber; m_docPrefsData.docSetupPrefs.pagePositioning = fp; + m_docPrefsData.docSetupPrefs.docBindingDirection = docBindingDirection; setDocumentFileName(documentName); HasCMS = false; if (!pdfOptions().UseLPI) @@ -6059,17 +6061,25 @@ struct oldPageVar // without running this monster void ScribusDoc::reformPages(bool moveObjects) { - QMap<uint, oldPageVar> pageTable; - struct oldPageVar oldPg; - int counter = pageSets()[m_docPrefsData.docSetupPrefs.pagePositioning].FirstPage; - int rowcounter = 0; - double maxXPos = 0.0; - double maxYPos = 0.0; - double currentXPos = m_docPrefsData.displayPrefs.scratch.left(); - double currentYPos = m_docPrefsData.displayPrefs.scratch.top(); - double lastYPos = Pages->at(0)->initialHeight(); - currentXPos += (Pages->at(0)->initialWidth() + m_docPrefsData.displayPrefs.pageGapHorizontal) * counter; - // currentXPos += (m_docPrefsData.docSetupPrefs.pageWidth + m_docPrefsData.displayPrefs.pageGapHorizontal) * counter; + QMap<uint, oldPageVar> pageTable; + struct oldPageVar oldPg; + int counter = pageSets()[m_docPrefsData.docSetupPrefs.pagePositioning].FirstPage; + int rowcounter = 0; + double maxXPos = 0.0; + double maxYPos = 0.0; + double currentXPos = m_docPrefsData.displayPrefs.scratch.left(); + double currentYPos = m_docPrefsData.displayPrefs.scratch.top(); + double lastYPos = Pages->at(0)->initialHeight(); + currentXPos += (Pages->at(0)->initialWidth() + m_docPrefsData.displayPrefs.pageGapHorizontal) * counter; + int rtlBinding = m_docPrefsData.docSetupPrefs.docBindingDirection; + if (rtlBinding == 1) + { + counter = !counter; + currentXPos = m_docPrefsData.displayPrefs.scratch.left() + m_docPrefsData.docSetupPrefs.pageWidth; + currentXPos -= (m_docPrefsData.docSetupPrefs.pageWidth + m_docPrefsData.displayPrefs.pageGapHorizontal) * + counter; + } + ScPage* page; int docPageCount = Pages->count(); @@ -6081,6 +6091,7 @@ void ScribusDoc::reformPages(bool moveObjects) oldPg.newPg = i; pageTable.insert(page->pageNr(), oldPg); page->setPageNr(i); + if (masterPageMode()) { page->setXOffset(m_docPrefsData.displayPrefs.scratch.left()); @@ -6109,29 +6120,64 @@ 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 (rtlBinding == 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 (rtlBinding == 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 (rtlBinding == 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 (rtlBinding == 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 (rtlBinding == 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) @@ -6147,6 +6193,9 @@ void ScribusDoc::reformPages(bool moveObjects) maxXPos = qMax(maxXPos, page->xOffset()+page->width()+m_docPrefsData.displayPrefs.scratch.right()); maxYPos = qMax(maxYPos, page->yOffset()+page->height()+m_docPrefsData.displayPrefs.scratch.bottom()); } + if (rtlBinding == 1) + setLoading(false); + if (!isLoading()) { QList<PageItem*> weldedItems; diff --git a/scribus/scribusdoc.h b/scribus/scribusdoc.h index 2c0f8e5d1..c4ff7021c 100644 --- a/scribus/scribusdoc.h +++ b/scribus/scribusdoc.h @@ -105,7 +105,7 @@ public: bool inASpecialEditMode() const; QList<PageItem*> getAllItems(const QList<PageItem*> &items) const; QList<PageItem*> *parentGroup(PageItem* item, QList<PageItem*> *list); - void setup(int, int, int, int, int, const QString&, const QString&); + void setup(int, int, int, int, int, const QString&, const QString&, int docBindingDirection = 0); void setLoading(bool); bool isLoading() const; void setModified(bool); @@ -215,6 +215,8 @@ public: int pageOrientation() const { return m_docPrefsData.docSetupPrefs.pageOrientation; } void setPageOrientation(int o) { m_docPrefsData.docSetupPrefs.pageOrientation = o; } + int docBindingDirection() const {return m_docPrefsData.docSetupPrefs.docBindingDirection; } + void setDocBindingDirection(int x) {m_docPrefsData.docSetupPrefs.docBindingDirection = x; } int pagePositioning() const { return m_docPrefsData.docSetupPrefs.pagePositioning; } void setPagePositioning(int p) { m_docPrefsData.docSetupPrefs.pagePositioning = p; } diff --git a/scribus/ui/newdocdialog.cpp b/scribus/ui/newdocdialog.cpp index 3b0486d09..b5e3bc591 100644 --- a/scribus/ui/newdocdialog.cpp +++ b/scribus/ui/newdocdialog.cpp @@ -68,9 +68,17 @@ NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool buttonHorizontal->setIcon(iconManager.loadIcon("page-orientation-horizontal")); buttonSinglePage->setIcon(iconManager.loadIcon("page-simple")); buttonDoublePageLeft->setIcon(iconManager.loadIcon("page-first-left")); - buttonDoublePageRight->setIcon(iconManager.loadIcon("page-first-right")); + buttonDoublePageRight->setIcon(iconManager.loadIcon("page-doublesided")); + buttonLTRBinding->setIcon(iconManager.loadIcon("text-direction-ltr")); + buttonRTLBinding->setIcon(iconManager.loadIcon("text-direction-rtl")); labelColumns->setPixmap(iconManager.loadPixmap("paragraph-columns")); + // for now we just hide buttonDoublePageLeft button + buttonDoublePageLeft->setVisible(false); + // disable LTR & RTL unless facing page is enabled + buttonLTRBinding->setDisabled(true); + buttonRTLBinding->setDisabled(true); + createNewDocPage(); if (startUp) { @@ -98,6 +106,8 @@ NewDocDialog::NewDocDialog(QWidget* parent, const QStringList& recentDocs, bool buttonSinglePage->setToolTip(tr("Single page document")); buttonDoublePageLeft->setToolTip(tr("Double page document, with the first page on the left side")); buttonDoublePageRight->setToolTip(tr("Double page document, with the first page on the right side")); + buttonLTRBinding->setToolTip(tr("LTR binding direction")); + buttonRTLBinding->setToolTip(tr("RTL Binding direction")); widthSpinBox->setToolTip( tr( "Width of the document's pages, editable if you have chosen a custom page size" ) ); heightSpinBox->setToolTip( tr( "Height of the document's pages, editable if you have chosen a custom page size" ) ); pageCountSpinBox->setToolTip( tr( "Initial number of pages of the document" ) ); @@ -133,6 +143,7 @@ void NewDocDialog::createNewDocPage() { int orientation = prefsManager.appPrefs.docSetupPrefs.pageOrientation; int pagePositioning = prefsManager.appPrefs.docSetupPrefs.pagePositioning; + int docBindingDirection = prefsManager.appPrefs.docSetupPrefs.docBindingDirection; QString pageSize = prefsManager.appPrefs.docSetupPrefs.pageSize; double pageHeight = prefsManager.appPrefs.docSetupPrefs.pageHeight; double pageWidth = prefsManager.appPrefs.docSetupPrefs.pageWidth; @@ -149,12 +160,16 @@ void NewDocDialog::createNewDocPage() pageOrientationButtons->button(orientation)->setChecked(true); pageLayoutButtons = new QButtonGroup(); + pageLayoutButtons->setExclusive(false); pageLayoutButtons->addButton(buttonSinglePage, 0); pageLayoutButtons->addButton(buttonDoublePageLeft, 1); pageLayoutButtons->addButton(buttonDoublePageRight, 2); + pageLayoutButtons->addButton(buttonLTRBinding, 3); + pageLayoutButtons->addButton(buttonRTLBinding, 4); if (pagePositioning == singlePage) { pageLayoutButtons->button(0)->setChecked(true); + pageLayoutButtons->button(1)->setChecked(true); } else if (prefsManager.appPrefs.pageSets[pagePositioning].FirstPage == 0) { @@ -165,6 +180,11 @@ void NewDocDialog::createNewDocPage() pageLayoutButtons->button(2)->setChecked(true); } + if (docBindingDirection == 1) + pageLayoutButtons->button(4)->setChecked(true); + else + pageLayoutButtons->button(3)->setChecked(true); + listPageFormats->setValues(pageSize, orientation, PageSizeInfo::Preferred, PageSizeList::NameAsc); pageSizeSelector->setHasFormatSelector(false); @@ -216,6 +236,7 @@ void NewDocDialog::createNewDocPage() setDocLayout(pagePositioning); setSize(pageSize); setOrientation(orientation); + setDocBindingDirection(docBindingDirection); numberOfCols->setButtonSymbols( QSpinBox::UpDownArrows ); numberOfCols->setMinimum( 1 ); @@ -524,18 +545,48 @@ void NewDocDialog::setLayout(int layoutId) switch (layoutId) { case 0: + pageLayoutButtons->button(2)->setChecked(false); + pageLayoutButtons->button(3)->setDisabled(true); + pageLayoutButtons->button(4)->setDisabled(true); setDocLayout(0); - break; + break; case 1: + // pageLayoutButtons->button(2)->setChecked(false); + // pageLayoutButtons->button(3)->setDisabled(true); + // pageLayoutButtons->button(4)->setDisabled(true); setDocLayout(1); pagePreview->setFirstPage(0); setDocFirstPage(0); - break; + break; case 2: + pageLayoutButtons->button(0)->setChecked(false); + pageLayoutButtons->button(3)->setDisabled(false); + pageLayoutButtons->button(4)->setDisabled(false); + pageLayoutButtons->button(3)->setChecked(true); + pageLayoutButtons->button(4)->setChecked(false); + setDocLayout(1); pagePreview->setFirstPage(1); setDocFirstPage(1); - break; + break; + case 3: + pageLayoutButtons->button(0)->setChecked(false); + pageLayoutButtons->button(2)->setChecked(true); + // pageLayoutButtons->button(3)->setChecked(true); + pageLayoutButtons->button(4)->setChecked(false); + setDocLayout(1); + setDocBindingDirection(0); + setDocFirstPage(1); + break; + case 4: + pageLayoutButtons->button(0)->setChecked(false); + pageLayoutButtons->button(2)->setChecked(true); + pageLayoutButtons->button(3)->setChecked(false); + + setDocLayout(1); + setDocBindingDirection(1); + setDocFirstPage(0); + break; } } @@ -605,6 +656,11 @@ void NewDocDialog::setDocFirstPage(int firstPage) m_layoutFirstPage = firstPage; } +void NewDocDialog::setDocBindingDirection(int bindingDirection) +{ + m_bindingDirection = bindingDirection; +} + void NewDocDialog::recentDocListBox_doubleClicked() { /* Yep. There is nothing to solve. ScribusMainWindow handles all diff --git a/scribus/ui/newdocdialog.h b/scribus/ui/newdocdialog.h index a65550f3d..c2399cf98 100644 --- a/scribus/ui/newdocdialog.h +++ b/scribus/ui/newdocdialog.h @@ -77,6 +77,7 @@ public: int orientation() const { return m_orientation;} int choosenLayout() const { return m_choosenLayout;} int layoutFirstPage() const { return m_layoutFirstPage; } + int bindingDirection() const { return m_bindingDirection; } double pageWidth() const { return m_pageWidth;} double pageHeight() const { return m_pageHeight;} double distance() const { return m_distance;} @@ -97,6 +98,7 @@ public slots: void setPageSize(const QString &); void setDocLayout(int layout); void setDocFirstPage(int firstPage); + void setDocBindingDirection(int bindingDirection); /*! Opens document on doubleclick \author Petr Vanek <petr@yarpen.cz> */ @@ -126,6 +128,7 @@ protected: double m_unitRatio { 1.0 }; int m_orientation { 0 }; int m_choosenLayout { 0 }; + int m_bindingDirection { 0 }; int m_layoutFirstPage { 0 }; double m_pageWidth { 1.0 }; double m_pageHeight { 1.0 }; diff --git a/scribus/ui/newdocdialog.ui b/scribus/ui/newdocdialog.ui index 53c60dcff..81b2bf2ca 100644 --- a/scribus/ui/newdocdialog.ui +++ b/scribus/ui/newdocdialog.ui @@ -474,6 +474,26 @@ </property> </widget> </item> + <item> + <widget class="QToolButton" name="buttonLTRBinding"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> + <item> + <widget class="QToolButton" name="buttonRTLBinding"> + <property name="text"> + <string/> + </property> + <property name="checkable"> + <bool>true</bool> + </property> + </widget> + </item> </layout> </item> </layout> diff --git a/scribus/ui/pagepalette_pages.cpp b/scribus/ui/pagepalette_pages.cpp index 4fad09a0d..560ac38f7 100644 --- a/scribus/ui/pagepalette_pages.cpp +++ b/scribus/ui/pagepalette_pages.cpp @@ -381,7 +381,7 @@ void PagePalette_Pages::rebuildPages() int counter = currentPageSet.FirstPage; int cols = currentPageSet.Columns; - + pageViewWidget->pageGrid()->setBindingDirection(currView->m_doc->docBindingDirection()); pageViewWidget->pageGrid()->setDocumentPageSize(QSize(currView->m_doc->pageWidth(), currView->m_doc->pageHeight())); pageViewWidget->pageGrid()->setPageInGroup(cols); pageViewWidget->pageGrid()->setPageOffset(counter); @@ -456,6 +456,7 @@ void PagePalette_Pages::setView(ScribusView *view) return; pageViewWidget->pageGrid()->setSelectionColor(PrefsManager::instance().appPrefs.displayPrefs.pageBorderColor); + pageViewWidget->pageGrid()->setBindingDirection(view->m_doc->docBindingDirection()); // if (currView) // connect(currView->m_doc, SIGNAL(pagePreviewChanged()), this, SLOT(updatePagePreview())); diff --git a/scribus/ui/pagepalette_widgets.cpp b/scribus/ui/pagepalette_widgets.cpp index 3c9519901..7e3b2705d 100644 --- a/scribus/ui/pagepalette_widgets.cpp +++ b/scribus/ui/pagepalette_widgets.cpp @@ -23,6 +23,7 @@ for which a new license (GPL+exception) is in place. #include "iconmanager.h" #include "pagepalette_widgets.h" + #include "prefsfile.h" #include "prefsmanager.h" #include "scribusapp.h" @@ -319,6 +320,8 @@ void PageGrid::setPageLayout(PageLayout layout) void PageGrid::setPageOffset(int pageCount) { m_pageOffset = pageCount; + if (m_rtlBinding) + m_pageOffset = !pageCount; calculateSize(); update(); } @@ -444,7 +447,10 @@ int PageGrid::columnAt(QPoint pos) int m_columns = columns(); - return (m_col < m_columns) ? m_col : m_columns -1; + int correctedCol = (m_col < m_columns) ? m_col : m_columns -1; + if (m_rtlBinding) + return !correctedCol; + return correctedCol; } int PageGrid::rowAt(QPoint pos) @@ -789,6 +795,14 @@ void PageGrid::showContextMenu(QPoint pos) m_contextMenu->exec( mapToGlobal(pos) ); } +void PageGrid::setBindingDirection(int rtl_binding) +{ + if (rtl_binding == 1) + m_rtlBinding = true; + else + m_rtlBinding = false; +} + /* ********************************************************************************* * * * Events @@ -802,6 +816,9 @@ void PageGrid::paintEvent(QPaintEvent *event) int x = m_groupSpace; int y = m_rowSpace; int offset = 0; + bool firstPage = false; + bool lastPage = false; + int groupStart = 0; QRect selectedPageRect; QColor foregroundColor( PrefsManager::instance().appPrefs.displayPrefs.scratchColor.lightness() <= 128 ? Qt::white : Qt::black); @@ -818,22 +835,40 @@ void PageGrid::paintEvent(QPaintEvent *event) // Draw pages for (int r = 0; r < rows(); r++) { - int groupStart = m_groupSpace; + if (!lastPage) + groupStart = m_groupSpace; int groupWidth = 0; bool drawGroupRect = false; + for (int c = 0; c < columns(); c++) { // cell is after last page cell if (count >= pageCount() + m_pageOffset) break; - + // cell is last page cell + if (count == pageCount() + m_pageOffset -1 ) + { + lastPage = true; + } // cell is a page cell if (count >= m_pageOffset && count < pageCount() + m_pageOffset) { int id = count - m_pageOffset; PageCell * cell = getPageItem(id); + if (m_rtlBinding) + { + x = (rowWidth(r) - dummyPageSize().width() - 1 - m_cellGap - x);; + if (firstPage) + { + x = m_groupSpace; + firstPage = false; + lastPage = false; + } + if (lastPage) + groupStart = x; + } if (id == m_selectedPage) selectedPageRect = QRect(x, y, cell->pageWidthByHeight(pageHeight()), pageHeight() ); QPoint pos(x,y); @@ -845,9 +880,8 @@ void PageGrid::paintEvent(QPaintEvent *event) offset = 0; else offset = m_cellGap; - - - x += cell->pageWidthByHeight(pageHeight()) + offset; + if (!m_rtlBinding) + x += cell->pageWidthByHeight(pageHeight()) + offset; groupWidth += cell->pageWidthByHeight(pageHeight()) + offset; drawGroupRect = true; @@ -857,8 +891,9 @@ void PageGrid::paintEvent(QPaintEvent *event) else { offset = ((c + 1) % m_cellsInGroup) == 0 ? 0 : m_cellGap; - x += dummyPageSize().width() + offset; - + if (!m_rtlBinding) + x += dummyPageSize().width() + offset; + firstPage = true; // adjust start on first row if first page has an offset if(r == 0) groupStart = x; diff --git a/scribus/ui/pagepalette_widgets.h b/scribus/ui/pagepalette_widgets.h index 9c7186ec8..f2e565af8 100644 --- a/scribus/ui/pagepalette_widgets.h +++ b/scribus/ui/pagepalette_widgets.h @@ -75,8 +75,8 @@ protected: QPoint m_mousePos; bool m_mousePressed {false}; bool m_thumb {false}; - QString m_prefsContext = "PagePalette"; - QString m_prefsName = "showMasterThumbnails"; + QString m_prefsContext = "PagePalette"; + QString m_prefsName = "showMasterThumbnails"; }; @@ -148,6 +148,7 @@ public: int pageHeight(); void setSelectedPage(int pageID); + void setBindingDirection(int rtl_binding); int selectedPage() { return m_selectedPage; }; void deleteSelectedPage(); @@ -190,6 +191,7 @@ private: int m_cellsInGroup {1}; // 1 for single page int m_pageOffset {0}; QMenu *m_contextMenu {nullptr}; + bool m_rtlBinding = false; int columns(); int rows(); diff --git a/scribus/ui/prefs_documentsetup.cpp b/scribus/ui/prefs_documentsetup.cpp index f5fc66b9a..b2e31fc89 100644 --- a/scribus/ui/prefs_documentsetup.cpp +++ b/scribus/ui/prefs_documentsetup.cpp @@ -4,6 +4,7 @@ to the COPYING file provided with the program. Following this notice may exist a copyright and/or license notice that predates the release of Scribus 1.3.2 for which a new license (GPL+exception) is in place. */ +#include <GL/gl.h> #include <algorithm> #include <QButtonGroup> @@ -17,6 +18,7 @@ for which a new license (GPL+exception) is in place. #include "prefsfile.h" #include "prefsmanager.h" #include "prefsstructs.h" +#include "scribusdoc.h" #include "undomanager.h" #include "units.h" #include "util.h" @@ -64,6 +66,11 @@ Prefs_DocumentSetup::Prefs_DocumentSetup(QWidget* parent, ScribusDoc* doc) layoutFirstPageIsComboBox->setCurrentIndex(0); layoutFirstPageIsComboBox->setEnabled(false); + layoutBindingIsComboBox->clear(); + layoutBindingIsComboBox->addItem(" "); + layoutBindingIsComboBox->setCurrentIndex(0); + layoutBindingIsComboBox->setEnabled(false); + pageWidthSpinBox->setMaximum(16777215); pageHeightSpinBox->setMaximum(16777215); languageChange(); @@ -175,6 +182,8 @@ void Prefs_DocumentSetup::restoreDefaults(struct ApplicationPrefs *prefsData) setupPageSets(); layoutFirstPageIsComboBox->setCurrentIndex(prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage); + layoutBindingIsComboBox->setCurrentIndex(prefsData->docSetupPrefs.docBindingDirection); + pageWidthSpinBox->blockSignals(false); pageHeightSpinBox->blockSignals(false); @@ -222,6 +231,8 @@ void Prefs_DocumentSetup::saveGuiToPrefs(struct ApplicationPrefs *prefsData) con prefsData->docSetupPrefs.pageHeight = pageH; prefsData->docSetupPrefs.pagePositioning = pageLayoutButtonGroup->checkedId(); prefsData->pageSets[prefsData->docSetupPrefs.pagePositioning].FirstPage = layoutFirstPageIsComboBox->currentIndex(); + prefsData->docSetupPrefs.docBindingDirection = layoutBindingIsComboBox->currentIndex(); + prefsData->docSetupPrefs.margins = marginsWidget->margins(); prefsData->docSetupPrefs.bleeds = bleedsWidget->margins(); @@ -246,26 +257,42 @@ void Prefs_DocumentSetup::saveGuiToPrefs(struct ApplicationPrefs *prefsData) con void Prefs_DocumentSetup::setupPageSets() { int i = layoutFirstPageIsComboBox->currentIndex(); - if (!layoutFirstPageIsComboBox->isEnabled()) + if (!layoutFirstPageIsComboBox->isEnabled()) i = -1; int currIndex = pageLayoutButtonGroup->checkedId() < 0 ? 0 :pageLayoutButtonGroup->checkedId(); layoutFirstPageIsComboBox->clear(); + layoutBindingIsComboBox->clear(); if (currIndex > 0 && currIndex < pageSets.count()) { const PageSet& pageSet = pageSets.at(currIndex); const QStringList& pageNames = pageSet.pageNames; layoutFirstPageIsComboBox->setEnabled(true); + layoutBindingIsComboBox->setEnabled(true); for (const QString& pageName : pageNames) + { layoutFirstPageIsComboBox->addItem(CommonStrings::translatePageSetLocString(pageName)); + } + //ToDo find the right place to add item or + layoutBindingIsComboBox->addItem(CommonStrings::translateDocBindingLocString(CommonStrings::docLoc_LTR_Binding)); + layoutBindingIsComboBox->addItem(CommonStrings::translateDocBindingLocString(CommonStrings::docLoc_RTL_Binding)); + int firstPageIndex = i < 0 ? pageSet.FirstPage : i; + int bindingIndex = i < 0 ? m_doc->docBindingDirection() : i; firstPageIndex = qMax(0, qMin(firstPageIndex, pageSet.pageNames.count() - 1)); + bindingIndex = qMax(0, qMin(bindingIndex, pageSet.pageNames.count() - 1)); + layoutFirstPageIsComboBox->setCurrentIndex(firstPageIndex); + layoutBindingIsComboBox->setCurrentIndex(bindingIndex); } else { layoutFirstPageIsComboBox->addItem(" "); layoutFirstPageIsComboBox->setCurrentIndex(0); layoutFirstPageIsComboBox->setEnabled(false); + + layoutBindingIsComboBox->addItem(" "); + layoutBindingIsComboBox->setCurrentIndex(0); + layoutBindingIsComboBox->setEnabled(false); } } diff --git a/scribus/ui/prefs_documentsetupbase.ui b/scribus/ui/prefs_documentsetupbase.ui index 008af5be5..91535a32b 100644 --- a/scribus/ui/prefs_documentsetupbase.ui +++ b/scribus/ui/prefs_documentsetupbase.ui @@ -39,14 +39,14 @@ <item> <widget class="Line" name="line"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> </widget> </item> <item> <widget class="QTabWidget" name="tabWidget"> <property name="currentIndex"> - <number>0</number> + <number>1</number> </property> <widget class="QWidget" name="sizeTab"> <attribute name="title"> @@ -68,7 +68,7 @@ <item> <spacer name="horizontalSpacer_3"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -83,10 +83,10 @@ <item> <spacer name="verticalSpacer"> <property name="orientation"> - <enum>Qt::Orientation::Vertical</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeType"> - <enum>QSizePolicy::Policy::Fixed</enum> + <enum>QSizePolicy::Fixed</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -111,7 +111,7 @@ <item> <widget class="Line" name="line_2"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> </widget> </item> @@ -127,12 +127,12 @@ <item row="0" column="1"> <layout class="QHBoxLayout" name="pageSizeLayout"> <item> - <widget class="PageSizeSelector" name="pageSizeSelector" native="true"/> + <widget class="PageSizeSelector" name="pageSizeSelector" native="true"/> </item> <item> <widget class="QToolButton" name="pageSizeLinkToolButton"> <property name="arrowType"> - <enum>Qt::ArrowType::NoArrow</enum> + <enum>Qt::NoArrow</enum> </property> </widget> </item> @@ -209,7 +209,7 @@ <item> <spacer name="verticalSpacer_5"> <property name="orientation"> - <enum>Qt::Orientation::Vertical</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -241,7 +241,7 @@ <item> <widget class="Line" name="line_3"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> </widget> </item> @@ -260,7 +260,7 @@ <item row="4" column="1"> <widget class="QComboBox" name="layoutFirstPageIsComboBox"> <property name="sizeAdjustPolicy"> - <enum>QComboBox::SizeAdjustPolicy::AdjustToContents</enum> + <enum>QComboBox::AdjustToContents</enum> </property> </widget> </item> @@ -307,12 +307,22 @@ </attribute> </widget> </item> + <item row="5" column="0"> + <widget class="QLabel" name="layoutBindingIsLabel"> + <property name="text"> + <string>Binding Direction:</string> + </property> + </widget> + </item> + <item row="5" column="1"> + <widget class="QComboBox" name="layoutBindingIsComboBox"/> + </item> </layout> </item> <item> <spacer name="verticalSpacer_8"> <property name="orientation"> - <enum>Qt::Orientation::Vertical</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -344,10 +354,10 @@ <item> <widget class="QScrollArea" name="scrollArea"> <property name="frameShape"> - <enum>QFrame::Shape::NoFrame</enum> + <enum>QFrame::NoFrame</enum> </property> <property name="frameShadow"> - <enum>QFrame::Shadow::Plain</enum> + <enum>QFrame::Plain</enum> </property> <property name="lineWidth"> <number>0</number> @@ -360,8 +370,8 @@ <rect> <x>0</x> <y>0</y> - <width>494</width> - <height>575</height> + <width>492</width> + <height>578</height> </rect> </property> <layout class="QVBoxLayout" name="verticalLayout_5"> @@ -380,7 +390,7 @@ <item> <widget class="Line" name="line_5"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> </widget> </item> @@ -404,7 +414,7 @@ <item> <spacer name="horizontalSpacer_6"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -433,10 +443,10 @@ <item> <spacer name="verticalSpacer_3"> <property name="orientation"> - <enum>Qt::Orientation::Vertical</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeType"> - <enum>QSizePolicy::Policy::Fixed</enum> + <enum>QSizePolicy::Fixed</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -461,7 +471,7 @@ <item> <widget class="Line" name="line_4"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> </widget> </item> @@ -485,7 +495,7 @@ <item> <spacer name="horizontalSpacer_7"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -500,7 +510,7 @@ <item> <spacer name="verticalSpacer_4"> <property name="orientation"> - <enum>Qt::Orientation::Vertical</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -538,10 +548,10 @@ <item> <spacer name="verticalSpacer_6"> <property name="orientation"> - <enum>Qt::Orientation::Vertical</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeType"> - <enum>QSizePolicy::Policy::Fixed</enum> + <enum>QSizePolicy::Fixed</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -566,7 +576,7 @@ <item> <widget class="Line" name="line_6"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> </widget> </item> @@ -617,7 +627,7 @@ <item> <spacer name="horizontalSpacer_2"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -680,10 +690,10 @@ <item> <spacer name="verticalSpacer_7"> <property name="orientation"> - <enum>Qt::Orientation::Vertical</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeType"> - <enum>QSizePolicy::Policy::Maximum</enum> + <enum>QSizePolicy::Maximum</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -708,7 +718,7 @@ <item> <widget class="Line" name="line_7"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> </widget> </item> @@ -734,7 +744,7 @@ <item> <spacer name="horizontalSpacer"> <property name="orientation"> - <enum>Qt::Orientation::Horizontal</enum> + <enum>Qt::Horizontal</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -749,7 +759,7 @@ <item> <spacer name="verticalSpacer_2"> <property name="orientation"> - <enum>Qt::Orientation::Vertical</enum> + <enum>Qt::Vertical</enum> </property> <property name="sizeHint" stdset="0"> <size> @@ -777,12 +787,12 @@ <header location="global">ui/newmarginwidget.h</header> <container>1</container> </customwidget> - <customwidget> - <class>PageSizeSelector</class> - <extends>QWidget</extends> - <header>ui/widgets/pagesizeselector.h</header> - <container>1</container> - </customwidget> + <customwidget> + <class>PageSizeSelector</class> + <extends>QWidget</extends> + <header>ui/widgets/pagesizeselector.h</header> + <container>1</container> + </customwidget> </customwidgets> <tabstops> <tabstop>tabWidget</tabstop> diff --git a/scribus/ui/widgets/pagelayout.cpp b/scribus/ui/widgets/pagelayout.cpp index 24aafeab6..7d079531a 100644 --- a/scribus/ui/widgets/pagelayout.cpp +++ b/scribus/ui/widgets/pagelayout.cpp @@ -95,7 +95,6 @@ void PageLayouts::setScheme(int nr) buttonScheme->setIcon(menuScheme->actions().at(m_scheme)->icon()); reloadFirstPage(m_scheme); - } void PageLayouts::setHideLabelsPermanently(bool hide) @@ -197,4 +196,4 @@ void PageLayouts::changeFirstPage(QAction *action) buttonFirstPage->setIcon(action->icon()); m_firstPage = action->data().toInt(); emit firstPageChanged(m_firstPage); -} +} \ No newline at end of file diff --git a/scribus/ui/widgets/pagelayout.h b/scribus/ui/widgets/pagelayout.h index d404ba4d8..bd1d8ef10 100644 --- a/scribus/ui/widgets/pagelayout.h +++ b/scribus/ui/widgets/pagelayout.h @@ -63,6 +63,7 @@ private: QMenu* menuFirstPage { nullptr }; QHBoxLayout* layoutGroupLayout { nullptr }; + void reloadScheme(); void reloadFirstPage(int scheme); @@ -70,7 +71,6 @@ protected slots: void languageChange(); void changeScheme(QAction* action); void changeFirstPage(QAction* action); - }; #endif // PAGELAYOUT_H |
|
Hi Fahad Thank you very much for the updated patch! I compiled it and i have a few comments. In the "file > new" (and in the document settings + preferences), LTR languages need both the double pages layouts, with the first page on the left and the right. I guess that RTL also might need both (with new icons). In the preferences, switching from single page to double page leads to a crash (the document setup works correctly) Next: the order of the pages. Since I have no direct experience with RTL I have to ask: is it always so, that page 1 will be on top and page n at the bottom? From an LTR world, I was expecting the first page to be at the bottom, but now that I think about it, there's no reason for it to be so. Personally, I would call the setting: LTR / RTL document, not binding. In my understanding, it should of course affect the binding, but also the default direction for the text. And possibly other settings. For this reason, the switch between LTR and RTL should probably always be available. Also for single page layouts. When switching between LTR and RTL, the first page left/right setting probably needs to be inverted: if the LTR document used to have the first page on the right, in RTL it should be on the left (that is: the first page has nothing on the other side; this means that the user wants a book / booklet layout) As wrote above, I live in a 100% LTR world, so some of the comments might be wrong... And, again, thank you very much for the effort! |
|
An "important" style warning: you seem to be using spaces instead of tabs... p.s.: Would you mind updating "your" pushed master and/or making a pull request against it or against https://github.com/scribusproject/scribus (if you're taking the code from there) so that it's easier to see the diff and to do a review of the code? |
|
>> In the "file > new" (and in the document settings + preferences), LTR languages need both the double pages layouts, with the first page on the left and the right. I guess that RTL also might need both (with new icons). Firstly I intend to do implement that then I realized that it will be overwhelming for both RTL & LTR. Also I see your mock up for the new dialog in the other issue and After googling I see what Adobe does. Adobe is allowed one setting: Right page for LTR & Left page for RTL in the first page. However, the functionality is there if you really want it both in Document preference & page arrangement window. >> In the preferences, switching from single page to double page leads to a crash (the document setup works correctly) I will check it out and see. from your side try clean installation it may be a cache problem. The other comments, scribus has now complete RTL for signal layout what the missing is RTL binding direction same as Adobe Indesign. This patch trys to fix it. |
|
Currently, your patch is removing a functionality in LTR: it makes it impossible to create a double page LTR layout starting on the left. This is not the most common choice, but it seems to be used from time to time. Also, personally, I'm still for having an LTR / RTL document setting that includes the bindings. But is more general and might in the future affect other behaviors. As far as I can tell, there are functionalities that can be implemented differently depending on the direction of the document. As an example, if you select multiple items at once, Scribus orders them by creation time: if you then click on the "Chain text" tool, you do not get what you would expect. I plan to change the order top down and left right. For an RTL document it would then be top down and right left. Also (2), if one uses the columns inside of a text frame, the behavior shall probably be different in LTR and RTL mode. This cannot be detected through the direction of the text. Also (3) the ruler around the document should probably have its origin at the top right of the document and "backwards" to the left side of the window. (The text ruler, on the contrary, should follow the paragraph LTR settings.) This is my personal opinion and you're welcome to tell me that the reasons above are wrong, and stick to having this new setting only set the binding. (And, of course, you do not need to implement any other of those other features in this patch: but, if they are useful, I'd like to see them implemented in the future! already having a switch, will probably help us in the future.) I just gave a quick try to Libreoffice (which probably values more RTL languages than Adobe...) and, while not having the best UI, it seams to implement RTL in a way similar to what I'm describing above. Finally, I've checked out your branch and did a fresh build with it. (Of course, I have no access to Indesign and I can't check who they are implement the details around RTL) |
|
Hi @ale you are absolutely right. There is a lot of work to be done to fully support RTL into scribus. For now let's focus on this bug, I am waiting core developer's feedback. P.S for Libre office there is hundreds of bugs against RTL support. Bugs never go away. |
|
I just update my patch and fixed indentation issue. I make pull request here to review : https://github.com/HOST-Oman/scribus/pull/248 |
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 | |
2024-11-21 18:50 | ale | Relationship added | has duplicate 0017316 |
2025-03-23 17:17 | ale | Relationship added | related to 0017384 |
2025-06-04 09:24 | Fahad | Note Added: 0052700 | |
2025-06-04 09:24 | Fahad | File Added: docBindingDirection.patch | |
2025-06-04 09:24 | Fahad | File Added: scribus-rtl-binding-main layout.png | |
2025-06-04 09:24 | Fahad | File Added: scribus-rtl-NewDocDialog.png | |
2025-06-04 09:24 | Fahad | File Added: scribus-rtl-PagePalette.png | |
2025-06-04 09:24 | Fahad | File Added: scribus-rtl-Prefs_DocumentSetup.png | |
2025-06-05 06:39 | ale | Relationship added | child of 0017537 |
2025-06-07 09:41 | ale | Note Added: 0052710 | |
2025-06-07 09:52 | ale | Note Added: 0052711 | |
2025-06-07 10:05 | ale | Note Edited: 0052711 | |
2025-06-07 11:56 | Fahad | Note Added: 0052712 | |
2025-06-07 11:56 | Fahad | File Added: 1348853_binding.jpg | |
2025-06-07 15:28 | ale | Note Added: 0052713 | |
2025-06-07 15:29 | ale | Note Edited: 0052713 | |
2025-06-08 06:13 | Fahad | Note Added: 0052715 | |
2025-06-08 20:11 | Fahad | Note Added: 0052717 |