View Issue Details

IDProjectCategoryView StatusLast Update
0001973ScribusUser Interfacepublic2005-05-13 17:02
Reporterjb Assigned Tosubik  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Platformi386OSlinux 
Fixed in Version1.3.0cvs 
Summary0001973: Guides, more improvements [PATCH]
DescriptionAfter the recent introduction of automatic guides creation (splitting the page in rows & columns), I thought it would be great to also be able to create rows &
columns in the selection.

I attached a screenshot & the patch.
Feel free to comment / modify / commit.

regards
TagsNo tags attached.
Patch

Activities

2005-05-11 07:28

 

guides3.png (36,370 bytes)   
guides3.png (36,370 bytes)   

2005-05-11 07:29

 

guides2.diff (6,472 bytes)   
Index: guidemanager.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/guidemanager.cpp,v
retrieving revision 1.22.2.6
diff -u -3 -p -u -r1.22.2.6 guidemanager.cpp
--- guidemanager.cpp	9 May 2005 18:23:01 -0000	1.22.2.6
+++ guidemanager.cpp	10 May 2005 21:56:32 -0000
@@ -40,11 +40,14 @@
  * - added the esc key
  ***************************************************************************/
 
+
+#include <qradiobutton.h>
 #include "guidemanager.h"
 #include "guidemanager.moc"
 
 #include "units.h"
 
+
 extern QPixmap loadIcon(QString nam);
 
 GuideManager::GuideManager(
@@ -53,10 +56,10 @@ GuideManager::GuideManager(
 			QValueList<double> YGuides,
 			double PageW,
 			double PageH,
-			double topM,
-			double bottomM,
-			double leftM,
-			double rightM,
+			FPoint MarginTL,
+			FPoint MarginBR,
+			FPoint SelectionTL,
+			FPoint SelectionBR,
 			bool GuideLock,
 			int Einh
 		) : QDialog(parent, "GuideManager", true, 0)
@@ -75,10 +78,22 @@ GuideManager::GuideManager(
 	LocPageWidth = PageW;
 	LocPageHeight = PageH;
 	LocLocked = GuideLock;
-	LocTop=topM;
-	LocBottom=bottomM;
-	LocRight=rightM;
-	LocLeft=leftM;
+
+	LocLeft=MarginTL.x();
+	LocTop=MarginTL.y();
+	LocRight=MarginBR.x();
+	LocBottom=MarginBR.y();
+
+	bool selected=true;
+
+	if (SelectionBR!=FPoint(0,0))
+	{
+		gy=SelectionTL.y();
+		gx=SelectionTL.x();
+		gw=SelectionBR.x();
+		gh=SelectionBR.y();
+	}
+	else selected=false;
 
 	selHor = selVer = -1;
 
@@ -201,8 +216,16 @@ GuideManager::GuideManager(
 	Layout9->addWidget(ColSet);
 
 	Layout10 = new QHBoxLayout(0, 0, 6, "Layout10");
-	Marg = new QCheckBox( tr( "&Follow Margins" ), HorGroup2, "marg");
-	Layout10->addWidget(Marg);
+	BGroup=new QHButtonGroup(HorGroup2,"bgroup");
+	BGroup->setFrameStyle(QFrame::NoFrame);
+	QLabel *TextLabel10 = new QLabel(tr("Refer to:"), HorGroup2, "TextLabel10");
+	Layout10->addWidget(TextLabel10);
+	QRadioButton *fPage = new QRadioButton( tr( "&Page" ), BGroup, "fpage"); 
+	fPage->setChecked(true);
+	(void) new QRadioButton( tr( "&Margins" ), BGroup, "fmargin");
+	QRadioButton *fSelect = new QRadioButton( tr( "&Selection" ), BGroup, "fselect");
+	fSelect->setEnabled(selected);
+	Layout10->addWidget(BGroup);
 
 	QSpacerItem* spacer2 = new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
 	Layout10->addItem(spacer2);
@@ -331,11 +354,16 @@ void GuideManager::AddRows()
 	double offset = 0;
 	double NewPageHeight = LocPageHeight;
 
-	if (Marg->isChecked())
+	if (BGroup->selectedId ()==1)
 	{
 		NewPageHeight = LocPageHeight - LocTop - LocBottom;
 		offset = LocTop;
 	}
+	else if (BGroup->selectedId ()==2) 
+	{
+	offset=gy;
+	NewPageHeight=gh;
+	}
 
 	double spacing = NewPageHeight / n;
 	int selHor = 0;
@@ -347,7 +375,7 @@ void GuideManager::AddRows()
 		int m = n;
 		double curHor = offset + spacing * i;
 
-		if (LocHor.contains(curHor))
+		if (LocHor.contains(curHor) || curHor<0 || curHor>LocPageHeight)
 			continue;
 
 		for (int i = n - 1; i > 0; i--)
@@ -376,11 +404,17 @@ void GuideManager::AddCols()
 	double offset = 0;
 	double NewPageWidth = LocPageWidth;
 
-	if (Marg->isChecked())
+
+	if (BGroup->selectedId ()==1)
 	{
 		NewPageWidth=LocPageWidth-LocLeft-LocRight;
 		offset=LocLeft;
 	}
+	else if (BGroup->selectedId ()==2) 
+	{
+	offset=gx;
+	NewPageWidth=gw;
+	}
 
 	double spacing = NewPageWidth/n;
 	int selVer = 0;
@@ -392,7 +426,7 @@ void GuideManager::AddCols()
 		int m = n;
 		double curVer = offset + spacing * i;
 
-		if (LocVer.contains(curVer))
+		if (LocVer.contains(curVer) || curVer<0 || curVer>LocPageWidth)
 			continue;
 
 		for (int i = n - 1; i > 0; i--)
Index: guidemanager.h
===================================================================
RCS file: /cvs/Scribus/scribus/guidemanager.h,v
retrieving revision 1.5.2.5
diff -u -3 -p -u -r1.5.2.5 guidemanager.h
--- guidemanager.h	9 May 2005 18:23:01 -0000	1.5.2.5
+++ guidemanager.h	10 May 2005 21:56:32 -0000
@@ -10,6 +10,8 @@
 #include <qcheckbox.h>
 #include <qlayout.h>
 #include <qtooltip.h>
+#include <qhbuttongroup.h>
+
 #include "mspinbox.h"
 #include "page.h"
 
@@ -25,10 +27,10 @@ public:
 			QValueList<double> YGuides,
 			double PageB,
 			double PageH,
-			double topM,
-			double bottomM,
-			double leftM,
-			double rightM,
+			FPoint MarginTL,
+			FPoint MarginBR,
+			FPoint SelectionTL,
+			FPoint SelectionBR,
 			bool GuideLock,
 			int Einh
 		);
@@ -45,6 +47,8 @@ private:
 	double LocBottom;
 	double LocRight;
 	double LocLeft;
+	double gx, gy, gw, gh;
+
 	int docUnitIndex;
 
 	int selHor;
@@ -66,7 +70,7 @@ private:
 
 	QSpinBox* ColSpin;
 	QSpinBox* RowSpin;
-	QCheckBox* Marg;
+	QHButtonGroup *BGroup;
 
 	QCheckBox* Lock;
 
Index: scribus.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/scribus.cpp,v
retrieving revision 1.228.2.299
diff -u -3 -p -u -r1.228.2.299 scribus.cpp
--- scribus.cpp	9 May 2005 20:46:51 -0000	1.228.2.299
+++ scribus.cpp	10 May 2005 21:56:37 -0000
@@ -9587,16 +9587,33 @@ void ScribusApp::ManageGuides()
 {
 	if (HaveDoc)
 	{
+		FPoint SelectionTopLeft=FPoint(0,0);
+		FPoint SelectionBottomRight=FPoint(0,0);
+		FPoint MarginTopLeft(doc->pageMargins.Top,doc->pageMargins.Bottom);
+		FPoint MarginBottomRight(doc->pageMargins.Left,doc->pageMargins.Right);
+
+		if (view->SelItem.count() > 1)
+			{
+			SelectionTopLeft.setXY(view->GroupX-doc->ScratchLeft, view->GroupY-doc->ScratchTop);
+			SelectionBottomRight.setXY(view->GroupW,view->GroupH);
+			}
+		else if (view->SelItem.count() == 1)
+			{
+			PageItem *currItem = view->SelItem.at(0);
+			SelectionTopLeft.setXY(currItem->BoundingX-doc->ScratchLeft,currItem->BoundingY-doc->ScratchTop);
+			SelectionBottomRight.setXY(currItem->BoundingW,currItem->BoundingH);
+			}
+		
 		GuideManager *dia = new GuideManager(
 					this,
 					doc->currentPage->XGuides,
 					doc->currentPage->YGuides,
 					doc->currentPage->Width,
 					doc->currentPage->Height,
-					doc->pageMargins.Top,
-					doc->pageMargins.Bottom,
-					doc->pageMargins.Left,
-					doc->pageMargins.Right,
+					MarginTopLeft,
+					MarginBottomRight,
+					SelectionTopLeft,
+					SelectionBottomRight,
 					doc->GuideLock,
 					doc->docUnitIndex
 					);
guides2.diff (6,472 bytes)   

subik

2005-05-12 15:54

manager   ~0004603

This patch was applied with (large) changes. scribus.cpp is now clean in the case of the guides. Everything is in the guides manager now. Scribus shows the new guides in the document while dialog still opened too (new feature).

plinnell

2005-05-13 17:02

viewer   ~0004614

tested, fixed. Nice addition!

Issue History

Date Modified Username Field Change
2005-05-11 07:28 jb New Issue
2005-05-11 07:28 jb File Added: guides3.png
2005-05-11 07:29 jb File Added: guides2.diff
2005-05-11 08:56 cbradney Status new => assigned
2005-05-11 08:56 cbradney Assigned To => subik
2005-05-12 15:54 subik Status assigned => resolved
2005-05-12 15:54 subik Resolution open => fixed
2005-05-12 15:54 subik Note Added: 0004603
2005-05-12 15:54 subik Fixed in Version => 1.3.0cvs
2005-05-13 17:02 plinnell Note Added: 0004614
2005-05-13 17:02 plinnell Status resolved => closed