View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001969 | Scribus | User Interface | public | 2005-05-08 16:16 | 2005-05-13 17:03 |
Reporter | jb | Assigned To | subik | ||
Priority | normal | Severity | feature | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | i386 | OS | ubuntu | OS Version | 5.04 |
Product Version | 1.3.0cvs | ||||
Fixed in Version | 1.3.0cvs | ||||
Summary | 0001969: Automatic creation of guides (split page in 2, 3, 4...) | ||||
Description | It is often useful to be able to create guides in the middle of the page, or to make 3 equal columns in the page. So I changed a bit the "guide manager" dialog to allow automatic creation of guides in the page. I include a screenshot, and I have a fully functionnal patch against 1.3 cvs if you are interested. Regards | ||||
Tags | No tags attached. | ||||
Patch | |||||
2005-05-08 16:16
|
|
2005-05-08 16:33
|
guide.diff (7,958 bytes)
Index: scribus.cpp =================================================================== RCS file: /cvs/Scribus/scribus/scribus.cpp,v retrieving revision 1.228.2.296 diff -u -3 -p -u -r1.228.2.296 scribus.cpp --- scribus.cpp 8 May 2005 10:41:35 -0000 1.228.2.296 +++ scribus.cpp 8 May 2005 18:32:30 -0000 @@ -9593,6 +9593,10 @@ void ScribusApp::ManageGuides() doc->currentPage->YGuides, doc->currentPage->Width, doc->currentPage->Height, + doc->PageM.Top, + doc->PageM.Bottom, + doc->PageM.Left, + doc->PageM.Right, doc->GuideLock, doc->docUnitIndex ); Index: guidemanager.cpp =================================================================== RCS file: /cvs/Scribus/scribus/guidemanager.cpp,v retrieving revision 1.22.2.5 diff -u -3 -p -u -r1.22.2.5 guidemanager.cpp --- guidemanager.cpp 17 Apr 2005 14:51:23 -0000 1.22.2.5 +++ guidemanager.cpp 8 May 2005 18:32:31 -0000 @@ -53,6 +53,10 @@ GuideManager::GuideManager( QValueList<double> YGuides, double PageW, double PageH, + double topM, + double bottomM, + double leftM, + double rightM, bool GuideLock, int Einh ) : QDialog(parent, "GuideManager", true, 0) @@ -72,6 +76,11 @@ GuideManager::GuideManager( LocPageWidth = PageW; LocPageHeight = PageH; LocLocked = GuideLock; + LocTop=topM; + LocBottom=bottomM; + LocRight=rightM; + LocLeft=leftM; + selHor = selVer = -1; /* Create the dialog elements */ @@ -88,7 +97,7 @@ GuideManager::GuideManager( HorGroupLayout->setAlignment(Qt::AlignTop); HorList = new QListBox(HorGroup, "HorList"); - HorList->setMinimumSize(QSize(0, 200)); + HorList->setMinimumSize(QSize(0, 150)); HorGroupLayout->addWidget(HorList); Layout4 = new QHBoxLayout(0, 0, 6, "Layout4"); @@ -114,7 +123,7 @@ GuideManager::GuideManager( Layout3->addWidget(HorDel); HorGroupLayout->addLayout(Layout3); - + Layout6->addWidget(HorGroup); VerGroup = new QGroupBox(this, "VerGroup"); @@ -126,7 +135,7 @@ GuideManager::GuideManager( VerGroupLayout->setAlignment(Qt::AlignTop); VerList = new QListBox(VerGroup, "VerList"); - VerList->setMinimumSize(QSize(0, 200)); + VerList->setMinimumSize(QSize(0, 150)); VerGroupLayout->addWidget(VerList); Layout2 = new QHBoxLayout(0, 0, 6, "Layout2"); @@ -156,6 +165,58 @@ GuideManager::GuideManager( Layout6->addWidget(VerGroup); GuideManagerLayout->addLayout(Layout6); + + + Layout7 = new QHBoxLayout(0, 0, 6, "Layout7"); + + QGroupBox *HorGroup2 = new QGroupBox(this, "HorGroup"); + HorGroup2->setTitle( tr("Rows and Columns")); + HorGroup2->setColumnLayout(0, Qt::Vertical); + HorGroup2->layout()->setSpacing(6); + HorGroup2->layout()->setMargin(11); + QVBoxLayout *HorGroupLayout2 = new QVBoxLayout(HorGroup2->layout()); + HorGroupLayout2->setAlignment(Qt::AlignTop); + + Layout8 = new QHBoxLayout(0, 0, 6, "Layout8"); + QLabel *TextLabel8 = new QLabel(tr("&Rows:"), HorGroup2, "TextLabel8"); + Layout8->addWidget(TextLabel8); + + RowSpin = new QSpinBox(1, 100, 1, HorGroup2, "rowspin"); + TextLabel8->setBuddy(RowSpin); + Layout8->addWidget(RowSpin); + + QPushButton *RowSet = new QPushButton( tr( "&Create" ), HorGroup2, "RowSet"); + RowSet->setAutoDefault(false); + Layout8->addWidget(RowSet); + + Layout9 = new QHBoxLayout(0, 0, 6, "Layout9"); + QLabel *TextLabel9 = new QLabel(tr("C&olumns:"), HorGroup2, "TextLabel9"); + Layout9->addWidget(TextLabel9); + + ColSpin = new QSpinBox(1, 100, 1, HorGroup2, "ColSpin"); + TextLabel9->setBuddy(ColSpin); + Layout9->addWidget(ColSpin); + + + QPushButton *ColSet = new QPushButton( tr( "Cr&eate" ), HorGroup2, "ColSet"); + ColSet->setAutoDefault(false); + Layout9->addWidget(ColSet); + + Layout10 = new QHBoxLayout(0, 0, 6, "Layout10"); + Marg = new QCheckBox( tr( "&Follow Margins" ), HorGroup2, "marg"); + Layout10->addWidget(Marg); + + QSpacerItem* spacer2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum); + Layout10->addItem(spacer2); + + + Layout7->addWidget(HorGroup2); + HorGroupLayout2->addLayout(Layout8); + HorGroupLayout2->addLayout(Layout9); + HorGroupLayout2->addLayout(Layout10); + + GuideManagerLayout->addLayout(Layout7); + Layout5 = new QHBoxLayout(0, 0, 6, "Layout5"); Lock = new QCheckBox( tr( "&Lock Guides" ), this, "Lock"); @@ -184,6 +245,9 @@ GuideManager::GuideManager( connect(HorList, SIGNAL(highlighted(QListBoxItem*)), this, SLOT(selHorIte(QListBoxItem*))); connect(VerList, SIGNAL(highlighted(QListBoxItem*)), this, SLOT(selVerIte(QListBoxItem*))); connect(HorSet, SIGNAL(clicked()), this, SLOT(AddHorVal())); + connect(RowSet, SIGNAL(clicked()), this, SLOT(AddRows())); + connect(ColSet, SIGNAL(clicked()), this, SLOT(AddCols())); + connect(HorDel, SIGNAL(clicked()), this, SLOT(DelHorVal())); connect(HorSpin, SIGNAL(valueChanged(int)), this, SLOT(ChangeHorVal())); connect(VerSet, SIGNAL(clicked()), this, SLOT(AddVerVal())); @@ -265,6 +329,92 @@ void GuideManager::AddHorVal() HorSpin->selectAll(); } +void GuideManager::AddRows() +{ + int n=QString(RowSpin->text()).toInt(); + double offset=0; + double NewPageHeight=LocPageHeight; + + if (Marg->isChecked()) + { + NewPageHeight=LocPageHeight-LocTop-LocBottom; + offset=LocTop; + } + + double spacing=NewPageHeight/n; + int selHor=0; + QValueList<double>::Iterator it; + + for (int i=1;i<n;i++) + { + int n = static_cast<int>(LocHor.count()); + int m = n; + double curHor = offset+spacing*i; + + for (int i = n - 1; i > 0; i--) + if (curHor < LocHor[i - 1]) + m = i; + + selHor = m - 1; + + if (m == n) + { + LocHor.append(curHor); + selHor = m - 1; + } + else + { + it = LocHor.at(selHor); + LocHor.insert(it,curHor); + } + } + UpdateHorList(); +} + +void GuideManager::AddCols() +{ + int n=QString(ColSpin->text()).toInt(); + double offset=0; + double NewPageWidth=LocPageWidth; + + if (Marg->isChecked()) + { + NewPageWidth=LocPageWidth-LocLeft-LocRight; + offset=LocLeft; + } + + double spacing=NewPageWidth/n; + int selVer=0; + QValueList<double>::Iterator it; + + for (int i=1;i<n;i++) + { + int n = static_cast<int>(LocVer.count()); + int m = n; + double curVer = offset+spacing*i; + + for (int i = n - 1; i > 0; i--) + if (curVer < LocVer[i - 1]) + m = i; + + selVer = m - 1; + + if (m == n) + { + LocVer.append(curVer); + selVer = m - 1; + } + else + { + it = LocVer.at(selVer); + LocVer.insert(it,curVer); + } + } + UpdateVerList(); + +} + + void GuideManager::AddVerVal() { if (HorSpin->hasFocus()) Index: guidemanager.h =================================================================== RCS file: /cvs/Scribus/scribus/guidemanager.h,v retrieving revision 1.5.2.4 diff -u -3 -p -u -r1.5.2.4 guidemanager.h --- guidemanager.h 17 Apr 2005 14:34:08 -0000 1.5.2.4 +++ guidemanager.h 8 May 2005 18:32:31 -0000 @@ -25,6 +25,10 @@ public: QValueList<double> YGuides, double PageB, double PageH, + double topM, + double bottomM, + double leftM, + double rightM, bool GuideLock, int Einh ); @@ -37,6 +41,10 @@ public: private: double LocPageWidth; double LocPageHeight; + double LocTop; + double LocBottom; + double LocRight; + double LocLeft; int docUnitIndex; int selHor; @@ -55,6 +63,10 @@ private: MSpinBox* HorSpin; QPushButton* HorSet; QPushButton* HorDel; + + QSpinBox* ColSpin; + QSpinBox* RowSpin; + QCheckBox* Marg; QCheckBox* Lock; @@ -65,6 +77,12 @@ private: void UpdateHorList(); void UpdateVerList(); + + QHBoxLayout* Layout7; + QHBoxLayout* Layout8; + QHBoxLayout* Layout9; + QHBoxLayout* Layout10; + QVBoxLayout* GuideManagerLayout; QHBoxLayout* Layout6; @@ -95,6 +113,8 @@ private slots: void ChangeHorVal(); void ChangeVerVal(); + void AddRows(); + void AddCols(); }; #endif // GUIDEMANAGER_H |
2005-05-08 16:37
|
|
|
Patch applied with some fixes (CVS changes of today). I did some minor changes too - it doesn't create a duplication of the guides when user click the "Create" button 2 times. |
|
Tested. Thanks. |
Date Modified | Username | Field | Change |
---|---|---|---|
2005-05-08 16:16 | jb | New Issue | |
2005-05-08 16:16 | jb | File Added: guides.png | |
2005-05-08 16:33 | jb | File Added: guide.diff | |
2005-05-08 16:37 | jb | File Added: guides2.png | |
2005-05-09 14:35 | subik | Status | new => assigned |
2005-05-09 14:35 | subik | Assigned To | => subik |
2005-05-09 16:31 | subik | Status | assigned => resolved |
2005-05-09 16:31 | subik | Fixed in Version | => 1.3.0cvs |
2005-05-09 16:31 | subik | Resolution | open => fixed |
2005-05-09 16:31 | subik | Note Added: 0004564 | |
2005-05-13 17:03 |
|
Status | resolved => closed |
2005-05-13 17:03 |
|
Note Added: 0004615 |