r15600 by jghali - move PP group tab code into its own class

scribus-commit scribus-commit at lists.scribus.net
Thu Oct 21 01:06:16 CEST 2010


Author: jghali
Date: Wed Oct 20 23:06:16 2010
New Revision: 15600

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15600
Log:
move PP group tab code into its own class

Added:
    branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_group.h
Modified:
    branches/ScribusOIF/scribus/CMakeLists.txt
    branches/ScribusOIF/scribus/scribusdoc.cpp
    branches/ScribusOIF/scribus/scribusdoc.h
    branches/ScribusOIF/scribus/ui/propertiespalette.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette.h
    branches/ScribusOIF/scribus/ui/propertiespalette_image.h
    branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
    branches/ScribusOIF/scribus/ui/transparencypalette.h
    branches/ScribusOIF/win32/vc8/Scribus.vcproj

Modified: branches/ScribusOIF/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15600&path=/branches/ScribusOIF/scribus/CMakeLists.txt
==============================================================================
--- branches/ScribusOIF/scribus/CMakeLists.txt (original)
+++ branches/ScribusOIF/scribus/CMakeLists.txt Wed Oct 20 23:06:16 2010
@@ -747,6 +747,7 @@
   ui/printdialog.cpp
   ui/propertiespalette.cpp
   ui/propertiespalette_image.cpp
+  ui/propertiespalette_group.cpp
   ui/propertiespalette_line.cpp
   ui/propertiespalette_shape.cpp
   ui/propertiespalette_utils.cpp

Modified: branches/ScribusOIF/scribus/scribusdoc.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15600&path=/branches/ScribusOIF/scribus/scribusdoc.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribusdoc.cpp (original)
+++ branches/ScribusOIF/scribus/scribusdoc.cpp Wed Oct 20 23:06:16 2010
@@ -8364,6 +8364,57 @@
 	changed();
 }
 
+void ScribusDoc::item_setFrameShape(PageItem* item, int frameType, int count, double* points)
+{
+	if ((item->itemType() == PageItem::PolyLine) || (item->itemType() == PageItem::PathText))
+			return;
+
+	if (UndoManager::undoEnabled())
+	{
+		// Store shape info in this form:
+		// CHANGE_SHAPE_TYPE - ID of the undo operation
+		// OLD_FRAME_TYPE - original frame type
+		// NEW_FRAME_TYPE - change of frame type
+		// binary QPair<FPointArray, FPointArray> - .first original shape, .second new shape
+		ItemState<QPair<FPointArray,FPointArray> > *is = new ItemState<QPair<FPointArray,FPointArray> >(Um::ChangeShapeType, "", Um::IBorder);
+		is->set("CHANGE_SHAPE_TYPE", "change_shape_type");
+		is->set("OLD_FRAME_TYPE", item->FrameType);
+		is->set("NEW_FRAME_TYPE", frameType);
+		// HACK: this is propably Evil Code (TM). I have to find better way...
+		FPointArray newShape;
+		int ix = 0;
+		for (int i = 0; i < count/2; ++i)
+		{
+			double x = item->width()  * points[ix] / 100.0;
+			double y = item->height() * points[ix+1] / 100.0;
+			newShape.addPoint(x, y);
+			ix += 2;
+		}
+		// HACK: end of hack
+		is->setItem(qMakePair(item->shape(), newShape));
+		UndoManager::instance()->action(item, is);
+	}
+
+	switch (frameType)
+	{
+	case 0:
+		item->SetRectFrame();
+		this->setRedrawBounding(item);
+		break;
+	case 1:
+		item->SetOvalFrame();
+		this->setRedrawBounding(item);
+		break;
+	default:
+		item->SetFrameShape(count, points);
+		this->setRedrawBounding(item);
+		item->FrameType = frameType + 2;
+		break;
+	}
+	item->update();
+	changed();
+}
+
 void ScribusDoc::itemSelection_ClearItem(Selection* customSelection)
 {
 	Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;

Modified: branches/ScribusOIF/scribus/scribusdoc.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15600&path=/branches/ScribusOIF/scribus/scribusdoc.h
==============================================================================
--- branches/ScribusOIF/scribus/scribusdoc.h (original)
+++ branches/ScribusOIF/scribus/scribusdoc.h Wed Oct 20 23:06:16 2010
@@ -1228,6 +1228,9 @@
 	*/
 	void allItems_ChangePreviewResolution(int id);
 
+	//FIXME : change to process a selection
+	void item_setFrameShape(PageItem* item, int frameType, int count, double* points); 
+
 	void itemSelection_ClearItem(Selection* customSelection=0);
 	//! Delete the items in the current selection. When force is true, we do not warn the user and make SE happy too. Force is used from @sa Page::restorePageItemCreation
 	void itemSelection_DeleteItem(Selection* customSelection=0, bool forceDeletion=false);

Modified: branches/ScribusOIF/scribus/ui/propertiespalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15600&path=/branches/ScribusOIF/scribus/ui/propertiespalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette.cpp Wed Oct 20 23:06:16 2010
@@ -53,6 +53,7 @@
 #include "sccolorengine.h"
 #include "cpalette.h"
 #include "pageitem_textframe.h"
+#include "propertiespalette_group.h"
 #include "propertiespalette_image.h"
 #include "propertiespalette_line.h"
 #include "propertiespalette_shape.h"
@@ -137,75 +138,8 @@
 	page_group_layout->setSpacing( 5 );
 	page_group_layout->setMargin( 0 );
 
-	ShapeGroup2 = new QGroupBox( page_group );
-	ShapeGroupLayout2 = new QHBoxLayout( ShapeGroup2 );
-	ShapeGroupLayout2->setSpacing( 2 );
-	ShapeGroupLayout2->setMargin( 0 );
-	ShapeGroupLayout2->setAlignment( Qt::AlignTop );
-	SRect2 = new QLabel( "Shape:", ShapeGroup2 );
-	ShapeGroupLayout2->addWidget( SRect2 );
-	SCustom2 = new Autoforms( ShapeGroup2 );
-	ShapeGroupLayout2->addWidget( SCustom2 );
-	EditShape2 = new QToolButton( ShapeGroup2 );
-	ShapeGroupLayout2->addWidget( EditShape2 );
-	page_group_layout->addWidget( ShapeGroup2 );
-
-	textFlowOptions2 = new QGroupBox( page_group );
-	textFlowOptionsLayout2 = new QVBoxLayout( textFlowOptions2 );
-	textFlowOptionsLayout2->setSpacing( 5 );
-	textFlowOptionsLayout2->setMargin( 5 );
-	textFlowOptionsLayout2->setAlignment( Qt::AlignTop );
-	textFlowDisabled2 = new QToolButton( textFlowOptions2 );
-	textFlowDisabled2->setCheckable( true );
-	textFlowDisabled2->setAutoExclusive(true);
-	textFlowDisabled2->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
-	textFlowDisabled2->setText( "Disabled" );
-	textFlowDisabled2->setIcon(QIcon(loadIcon("flow-none.png")));
-	textFlowOptionsLayout2->addWidget( textFlowDisabled2 );
-	textFlowUsesFrameShape2  = new QToolButton( textFlowOptions2 );
-	textFlowUsesFrameShape2->setCheckable( true );
-	textFlowUsesFrameShape2->setAutoExclusive(true);
-	textFlowUsesFrameShape2->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
-	textFlowUsesFrameShape2->setText( "Use &Frame Shape" );
-	textFlowUsesFrameShape2->setIcon(QIcon(loadIcon("flow-frame.png")));
-	textFlowOptionsLayout2->addWidget( textFlowUsesFrameShape2 );
-	textFlowUsesBoundingBox2 = new QToolButton( textFlowOptions2 );
-	textFlowUsesBoundingBox2->setCheckable( true );
-	textFlowUsesBoundingBox2->setAutoExclusive(true);
-	textFlowUsesBoundingBox2->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
-	textFlowUsesBoundingBox2->setText( "Use &Bounding Box" );
-	textFlowUsesBoundingBox2->setIcon(QIcon(loadIcon("flow-bounding.png")));
-	textFlowOptionsLayout2->addWidget( textFlowUsesBoundingBox2 );
-	textFlowUsesContourLine2 = new QToolButton( textFlowOptions2 );
-	textFlowUsesContourLine2->setCheckable( true );
-	textFlowUsesContourLine2->setAutoExclusive(true);
-	textFlowUsesContourLine2->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
-	textFlowUsesContourLine2->setText( "&Use Contour Line" );
-	textFlowUsesContourLine2->setIcon(QIcon(loadIcon("flow-contour.png")));
-	textFlowOptionsLayout2->addWidget( textFlowUsesContourLine2 );
-	textFlowUsesImageClipping2 = new QToolButton( textFlowOptions2 );
-	textFlowUsesImageClipping2->setCheckable( true );
-	textFlowUsesImageClipping2->setAutoExclusive(true);
-	textFlowUsesImageClipping2->setToolButtonStyle( Qt::ToolButtonTextBesideIcon );
-	textFlowUsesImageClipping2->setText( "Use Image Clip Path" );
-	textFlowUsesImageClipping2->setIcon(QIcon(loadIcon("flow-contour.png")));
-	textFlowOptionsLayout2->addWidget( textFlowUsesImageClipping2 );
-	page_group_layout->addWidget( textFlowOptions2  );
-	textFlowDisabled2->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
-	textFlowUsesFrameShape2->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
-	textFlowUsesBoundingBox2->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
-	textFlowUsesContourLine2->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
-	textFlowUsesImageClipping2->setSizePolicy(QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding));
-	textFlowOptionsB2 = new QButtonGroup( page_group );
-	textFlowOptionsB2->addButton(textFlowDisabled2, 0);
-	textFlowOptionsB2->addButton(textFlowUsesFrameShape2, 1);
-	textFlowOptionsB2->addButton(textFlowUsesBoundingBox2, 2);
-	textFlowOptionsB2->addButton(textFlowUsesContourLine2, 3);
-	textFlowOptionsB2->addButton(textFlowUsesImageClipping2, 4);
-
-	TpalGroup = new Tpalette(page_group);
-	TpalGroup->hideSelectionButtons();
-	page_group_layout->addWidget( TpalGroup );
+	groupPal = new PropertiesPalette_Group( page_group );
+	page_group_layout->addWidget( groupPal );
 
 	QSpacerItem* spacerTr2 = new QSpacerItem( 0, 0, QSizePolicy::Minimum, QSizePolicy::Expanding );
 	page_group_layout->addItem( spacerTr2 );
@@ -616,10 +550,10 @@
 	connect(SeStyle->UnderlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(newUnderline()));
 	connect(SeStyle->StrikeVal->LPos, SIGNAL(valueChanged(double)), this, SLOT(newStrike()));
 	connect(SeStyle->StrikeVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(newStrike()));
-	connect(textFlowOptionsB2, SIGNAL(buttonClicked(int)), this, SLOT(DoFlow()));
-
-	connect(SCustom2, SIGNAL(FormSel(int, int, qreal *)), this, SLOT(MakeIrre(int, int, qreal *)));
-	connect(EditShape2, SIGNAL(clicked()), this, SLOT(handleShapeEdit2()));
+
+	connect(groupPal, SIGNAL(shapeChanged(int)) , this, SLOT(handleNewShape(int)));
+	connect(groupPal, SIGNAL(shapeEditStarted()), this, SLOT(handleShapeEdit2()));
+
 	connect(dGap, SIGNAL(valueChanged(double)), this, SLOT(NewGap()));
 	connect(DCol, SIGNAL(valueChanged(int)), this, SLOT(NewCols()));
 	connect(DTop, SIGNAL(valueChanged(double)), this, SLOT(NewTDist()));
@@ -647,8 +581,6 @@
 	connect( Cpal, SIGNAL(editGradient(int)), this, SLOT(toggleGradientEdit(int)));
 	connect( Tpal, SIGNAL(NewSpecial(double, double, double, double, double, double, double, double, double, double)), this, SLOT(NewSpGradientM(double, double, double, double, double, double, double, double )));
 	connect( Tpal, SIGNAL(editGradient()), this, SLOT(toggleGradientEditM()));
-	connect( TpalGroup, SIGNAL(NewSpecial(double, double, double, double, double, double, double, double, double, double)), this, SLOT(NewSpGradientM(double, double, double, double, double, double, double, double )));
-	connect( TpalGroup, SIGNAL(editGradient()), this, SLOT(toggleGradientEditMGroup()));
 	connect(lineSpacingModeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(setLineSpacingMode(int)));
 	connect(optMarginRadioNone, SIGNAL(clicked()), this, SLOT(setOpticalMargins()) );
 	connect(optMarginRadioBoth, SIGNAL(clicked()), this, SLOT(setOpticalMargins()) );
@@ -700,6 +632,7 @@
 
 	this->xyzPal->setMainWindow(mw);
 	this->shapePal->setMainWindow(mw);
+	this->groupPal->setMainWindow(mw);
 	this->imagePal->setMainWindow(mw);
 	this->linePal->setMainWindow(mw);
 
@@ -711,7 +644,6 @@
 	connect(this->Cpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradFill()));
 	connect(this->Cpal, SIGNAL(strokeGradientChanged()), m_ScMW, SLOT(updtGradStroke()));
 	connect(this->Tpal, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradMask()));
-	connect(this->TpalGroup, SIGNAL(gradientChanged()), m_ScMW, SLOT(updtGradMaskGroup()));
 }
 
 void PropertiesPalette::SelTab(int t)
@@ -751,12 +683,6 @@
 	disconnect(this->Tpal, SIGNAL(NewPattern(QString)), 0, 0);
 	disconnect(this->Tpal, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), 0, 0);
 
-	disconnect(this->TpalGroup, SIGNAL(NewTrans(double)), 0, 0);
-	disconnect(this->TpalGroup, SIGNAL(NewBlend(int)), 0, 0);
-	disconnect(this->TpalGroup, SIGNAL(NewGradient(int)), 0, 0);
-	disconnect(this->TpalGroup, SIGNAL(NewPattern(QString)), 0, 0);
-	disconnect(this->TpalGroup, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), 0, 0);
-
 	disconnect(this->Cpal, SIGNAL(NewPen(QString)), 0, 0);
 	disconnect(this->Cpal, SIGNAL(NewBrush(QString)), 0, 0);
 	disconnect(this->Cpal, SIGNAL(NewPenShade(int)), 0, 0);
@@ -776,8 +702,7 @@
 	Cpal->setCurrentItem(NULL);
 	Tpal->setDocument(doc);
 	Tpal->setCurrentItem(NULL);
-	TpalGroup->setDocument(doc);
-	TpalGroup->setCurrentItem(NULL);
+
 	m_unitRatio=doc->unitRatio();
 	m_unitIndex=doc->unitIndex();
 	int precision = unitGetPrecisionFromIndex(m_unitIndex);
@@ -789,6 +714,7 @@
 
 	xyzPal->setDoc(doc);
 	shapePal->setDoc(doc);
+	groupPal->setDoc(doc);
 	imagePal->setDoc(doc);
 	linePal->setDoc(doc);
 
@@ -824,13 +750,6 @@
 	connect(this->Tpal, SIGNAL(NewGradient(int)), doc, SLOT(itemSelection_SetItemGradMask(int)));
 	connect(this->Tpal, SIGNAL(NewPattern(QString)), doc, SLOT(itemSelection_SetItemPatternMask(QString)));
 	connect(this->Tpal, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), doc, SLOT(itemSelection_SetItemPatternMaskProps(double, double, double, double, double, double, double, bool, bool)));
-
-
-	connect(this->TpalGroup, SIGNAL(NewTrans(double)), this, SLOT(setGroupTransparency(double)));
-	connect(this->TpalGroup, SIGNAL(NewBlend(int)), this, SLOT(setGroupBlending(int)));
-	connect(this->TpalGroup, SIGNAL(NewGradient(int)), this, SLOT(setGroupGradMask(int)));
-	connect(this->TpalGroup, SIGNAL(NewPattern(QString)), this, SLOT(setGroupPatternMask(QString)));
-	connect(this->TpalGroup, SIGNAL(NewPatternProps(double, double, double, double, double, double, double, bool, bool)), this, SLOT(setGroupPatternMaskProps(double, double, double, double, double, double, double, bool, bool)));
 	
 	connect(this->Cpal, SIGNAL(NewPen(QString)), doc, SLOT(itemSelection_SetItemPen(QString)));
 	connect(this->Cpal, SIGNAL(NewBrush(QString)), doc, SLOT(itemSelection_SetItemBrush(QString)));
@@ -857,6 +776,8 @@
 	xyzPal->unsetDoc();
 	shapePal->unsetItem();
 	shapePal->unsetDoc();
+	groupPal->unsetItem();
+	groupPal->unsetDoc();
 	imagePal->unsetItem();
 	imagePal->unsetDoc();
 	linePal->unsetItem();
@@ -866,8 +787,6 @@
 	Cpal->setDocument(NULL);
 	Tpal->setCurrentItem(NULL);
 	Tpal->setDocument(NULL);
-	TpalGroup->setDocument(NULL);
-	TpalGroup->setCurrentItem(NULL);
 	paraStyleCombo->setDoc(0);
 	charStyleCombo->setDoc(0);
 	HaveItem = false;
@@ -884,7 +803,6 @@
 	CurItem = NULL;
 	Cpal->setCurrentItem(NULL);
 	Tpal->setCurrentItem(NULL);
-	TpalGroup->setCurrentItem(NULL);
 	NewSel(-1);
 }
 
@@ -892,23 +810,8 @@
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning() || !HaveItem)
 		return;
-	if (CurItem->isGroupControl)
-	{
-		if (mode == PageItem::TextFlowDisabled)
-			textFlowDisabled2->setChecked(true);
-		else if (mode == PageItem::TextFlowUsesFrameShape)
-			textFlowUsesFrameShape2->setChecked(true);
-		else if (mode == PageItem::TextFlowUsesBoundingBox)
-			textFlowUsesBoundingBox2->setChecked(true);
-		else if (mode == PageItem::TextFlowUsesContourLine)
-			textFlowUsesContourLine2->setChecked(true);
-		else if (mode == PageItem::TextFlowUsesImageClipping)
-			textFlowUsesImageClipping2->setChecked(true);
-		if ((CurItem->asImageFrame()) && (CurItem->imageClip.size() != 0))
-			textFlowUsesImageClipping2->setEnabled(true);
-		else
-			textFlowUsesImageClipping2->setEnabled(false);
-	}
+	shapePal->displayTextFlowMode(mode);
+	groupPal->displayTextFlowMode(mode);
 }
 
 void PropertiesPalette::SetCurItem(PageItem *i)
@@ -933,6 +836,7 @@
 
 	xyzPal->handleSelectionChanged();
 	shapePal->handleSelectionChanged();
+	groupPal->handleSelectionChanged();
 	imagePal->handleSelectionChanged();
 	linePal->handleSelectionChanged();
 
@@ -940,7 +844,6 @@
 	Cpal->updateFromItem();
 	Tpal->setCurrentItem(CurItem);
 	Tpal->updateFromItem();
-	TpalGroup->setCurrentItem(CurItem);
 
 	QString tm;
 	PageItem_TextFrame *i2=CurItem->asTextFrame();
@@ -1029,22 +932,6 @@
 		TabStack->setItemEnabled(idColorsItem, false);
 		TabStack->setItemEnabled(idTextItem, false);
 		TabStack->setItemEnabled(idImageItem, false);
-		if (CurItem->FrameType == 0)
-			SCustom2->setIcon(SCustom2->getIconPixmap(0));
-		if (CurItem->FrameType == 1)
-			SCustom2->setIcon(SCustom2->getIconPixmap(1));
-		if (CurItem->FrameType > 3)
-			SCustom2->setIcon(SCustom2->getIconPixmap(CurItem->FrameType-2));
-		TpalGroup->updateFromItem();
-		TpalGroup->setActPattern(i->patternMask(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
-		SCustom2->setEnabled(true);
-		EditShape2->setEnabled(true);
-		SRect2->setEnabled(true);
-		textFlowDisabled2->setEnabled(true);
-		textFlowUsesFrameShape2->setEnabled(true);
-		textFlowUsesBoundingBox2->setEnabled(true);
-		textFlowUsesContourLine2->setEnabled(true);
-		textFlowUsesImageClipping2->setEnabled(false);
 	}
 	else
 		TabStack->setItemEnabled(idGroupItem, false);
@@ -1081,6 +968,7 @@
 
 	xyzPal->handleSelectionChanged();
 	shapePal->handleSelectionChanged();
+	groupPal->handleSelectionChanged();
 	imagePal->handleSelectionChanged();
 	linePal->handleSelectionChanged();
 
@@ -1105,22 +993,6 @@
 		TabStack->setItemEnabled(idTextItem, false);
 		TabStack->setItemEnabled(idImageItem, false);
 		TabStack->setItemEnabled(idTransparencyItem, false);
-		if (CurItem->FrameType == 0)
-			SCustom2->setIcon(SCustom2->getIconPixmap(0));
-		if (CurItem->FrameType == 1)
-			SCustom2->setIcon(SCustom2->getIconPixmap(1));
-		if (CurItem->FrameType > 3)
-			SCustom2->setIcon(SCustom2->getIconPixmap(CurItem->FrameType-2));
-		TpalGroup->updateFromItem();
-		TpalGroup->setActPattern(i->patternMask(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
-		SCustom2->setEnabled(true);
-		EditShape2->setEnabled(true);
-		SRect2->setEnabled(true);
-		textFlowDisabled2->setEnabled(true);
-		textFlowUsesFrameShape2->setEnabled(true);
-		textFlowUsesBoundingBox2->setEnabled(true);
-		textFlowUsesContourLine2->setEnabled(true);
-		textFlowUsesImageClipping2->setEnabled(false);
 	}
 	connect(TabStack, SIGNAL(currentChanged(int)), this, SLOT(SelTab(int)));
 }
@@ -1136,6 +1008,7 @@
 
 	xyzPal->newSelection(nr);
 	shapePal->newSelection(nr);
+	groupPal->newSelection(nr);
 	imagePal->newSelection(nr);
 	linePal->newSelection(nr);
 
@@ -1257,6 +1130,7 @@
 	//these can be enabled all the time
 	xyzPal->setMultipleSelection(isMultiple);
 	shapePal->setMultipleSelection(isMultiple);
+	groupPal->setMultipleSelection(isMultiple);
 	imagePal->setMultipleSelection(isMultiple);
 	linePal->setMultipleSelection(isMultiple);
 
@@ -1286,6 +1160,7 @@
 
 	xyzPal->unitChange();
 	shapePal->unitChange();
+	groupPal->unitChange();
 	imagePal->unitChange();
 	linePal->unitChange();
 
@@ -1296,7 +1171,6 @@
 	DRight->setNewUnit( m_unitIndex );
 	Cpal->unitChange(oldRatio, m_unitRatio, doc->unitIndex());
 	Tpal->unitChange(oldRatio, m_unitRatio, doc->unitIndex());
-	TpalGroup->unitChange(oldRatio, m_unitRatio, doc->unitIndex());
 	HaveItem = tmp;
 }
 
@@ -1818,33 +1692,7 @@
 		doc->itemSelection_SetOutlineWidth(x);
 }
 
-void PropertiesPalette::DoFlow()
-{
-	PageItem::TextFlowMode mode = PageItem::TextFlowDisabled;
-	if (!m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	if ((HaveDoc) && (HaveItem))
-	{
-		if (CurItem->isGroupControl)
-		{
-			if (textFlowDisabled2->isChecked())
-				mode = PageItem::TextFlowDisabled;
-			if (textFlowUsesFrameShape2->isChecked())
-				mode = PageItem::TextFlowUsesFrameShape;
-			if (textFlowUsesBoundingBox2->isChecked())
-				mode = PageItem::TextFlowUsesBoundingBox;
-			if (textFlowUsesContourLine2->isChecked())
-				mode = PageItem::TextFlowUsesContourLine;
-			if (textFlowUsesImageClipping2->isChecked())
-				mode = PageItem::TextFlowUsesImageClipping;
-		}
-		CurItem->setTextFlowMode(mode);
-		m_ScMW->view->DrawNew();
-		emit DocChanged();
-	}
-}
-
-void PropertiesPalette::MakeIrre(int f, int c, qreal *vals)
+void PropertiesPalette::handleNewShape(int frameType)
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
@@ -1853,58 +1701,14 @@
 		if ((CurItem->itemType() == PageItem::PolyLine) || (CurItem->itemType() == PageItem::PathText))
 			return;
 
-		if (UndoManager::undoEnabled())
-		{
-			// Store shape info in this form:
-			// CHANGE_SHAPE_TYPE - ID of the undo operation
-			// OLD_FRAME_TYPE - original frame type
-			// NEW_FRAME_TYPE - change of frame type
-			// binary QPair<FPointArray, FPointArray> - .first original shape, .second new shape
-			ItemState<QPair<FPointArray,FPointArray> > *is = new ItemState<QPair<FPointArray,FPointArray> >(Um::ChangeShapeType, "", Um::IBorder);
-			is->set("CHANGE_SHAPE_TYPE", "change_shape_type");
-			is->set("OLD_FRAME_TYPE", CurItem->FrameType);
-			is->set("NEW_FRAME_TYPE", f);
-			// HACK: this is propably Evil Code (TM). I have to find better way...
-			FPointArray newShape;
-			int ix = 0;
-			for (int i = 0; i < c/2; ++i)
-			{
-				double x = CurItem->width() * vals[ix] / 100.0;
-				double y = CurItem->height() * vals[ix+1] / 100.0;
-				newShape.addPoint(x, y);
-				ix += 2;
-			}
-			// HACK: end of hack
-			is->setItem(qMakePair(CurItem->shape(), newShape));
-			UndoManager::instance()->action(CurItem, is);
-		}
-
-		switch (f)
-		{
-		case 0:
-			CurItem->SetRectFrame();
-			doc->setRedrawBounding(CurItem);
-			break;
-		case 1:
-			CurItem->SetOvalFrame();
-			doc->setRedrawBounding(CurItem);
-			break;
-		default:
-			CurItem->SetFrameShape(c, vals);
-			doc->setRedrawBounding(CurItem);
-			CurItem->FrameType = f+2;
-			break;
-		}
-		CurItem->update();
-		emit DocChanged();
 		if ((CurItem->itemType() == PageItem::ImageFrame) || (CurItem->itemType() == PageItem::TextFrame))
 		{
-			shapePal->RoundRect->setEnabled(f == 0);
+			shapePal->RoundRect->setEnabled(frameType == 0);
 			return;
 		}
 //		CurItem->convertTo(PageItem::Polygon);
 //		NewSel(6);
-		shapePal->RoundRect->setEnabled(f == 0);
+		shapePal->RoundRect->setEnabled(frameType == 0);
 	}
 }
 
@@ -2100,20 +1904,6 @@
 	}
 }
 
-void PropertiesPalette::toggleGradientEditMGroup()
-{
-	if (!m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	if ((HaveDoc) && (HaveItem))
-	{
-		m_ScMW->view->editStrokeGradient = 2;
-		if (TpalGroup->gradEditButton->isChecked())
-			m_ScMW->view->requestMode(modeEditGradientVectors);
-		else
-			m_ScMW->view->requestMode(modeNormal);
-	}
-}
-
 void PropertiesPalette::NewTFont(QString c)
 {
 	if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
@@ -2160,15 +1950,15 @@
 {
 	if (!HaveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
+
+	groupPal->updateColorList();
+
 	Cpal->SetColors(doc->PageColors);
 	Cpal->SetPatterns(&doc->docPatterns);
 	Cpal->SetGradients(&doc->docGradients);
 	Tpal->SetColors(doc->PageColors);
 	Tpal->SetPatterns(&doc->docPatterns);
 	Tpal->SetGradients(&doc->docGradients);
-	TpalGroup->SetColors(doc->PageColors);
-	TpalGroup->SetPatterns(&doc->docPatterns);
-	TpalGroup->SetGradients(&doc->docGradients);
 	assert (doc->PageColors.document());
 	TxFill->updateBox(doc->PageColors, ColorCombo::fancyPixmaps, true);
 	TxStroke->updateBox(doc->PageColors, ColorCombo::fancyPixmaps, false);
@@ -2416,11 +2206,10 @@
 
 	xyzPal->languageChange();
 	shapePal->languageChange();
+	groupPal->languageChange();
 	imagePal->languageChange();
 	linePal->languageChange();
 
-	EditShape2->setText( tr("&Edit..."));
-	SRect2->setText( tr("Shape:"));
 	columnsLabel->setText( tr("Colu&mns:"));
 	int oldcolgapLabel = colgapLabel->currentIndex();
 	colgapLabel->clear();
@@ -2443,12 +2232,6 @@
 	pathTextTypeLabel->setText( tr("Type:"));
 	startoffsetLabel->setText( tr("Start Offset:"));
 	distfromcurveLabel->setText( tr("Distance from Curve:"));
-	textFlowOptions2->setTitle( tr("Text &Flow Around Frame"));
-	textFlowDisabled2->setText( tr("Disabled"));
-	textFlowUsesFrameShape2->setText( tr("Use Frame &Shape"));
-	textFlowUsesBoundingBox2->setText( tr("Use &Bounding Box"));
-	textFlowUsesContourLine2->setText( tr("&Use Contour Line"));
-	textFlowUsesImageClipping2->setText( tr("Use Image Clip Path"));
 	paraStyleLabel->setText( tr("Paragraph St&yle:"));
 	charStyleLabel->setText( tr("Character St&yle:"));
 	optMarginRadioNone->setText( tr("None","optical margins") );
@@ -2502,12 +2285,6 @@
 	SeStyle->languageChange();
 	GroupAlign->languageChange();
 
-	textFlowDisabled2->setToolTip( tr("Disable text flow from lower frames around object"));
-	textFlowUsesFrameShape2->setToolTip( tr("Use the frame shape for text flow of text frames below the object."));
-	textFlowUsesBoundingBox2->setToolTip(  "<qt>" + tr("Use the bounding box, which is always rectangular, instead of the frame's shape for text flow of text frames below the object. ") + "</qt>" );
-	textFlowUsesContourLine2->setToolTip(  "<qt>" + tr("When chosen, the contour line can be edited with the Edit Shape Tool on the palette further above. When edited via the shape palette, this becomes a second separate line originally based on the frame's shape for text flow of text frames below the object.") + "</qt>" );
-	textFlowUsesImageClipping2->setToolTip(  "<qt>" + tr("Use the clipping path of the image") + "</qt>" );
-
 	Size->setToolTip( tr("Font Size"));
 	ChBase->setToolTip( tr("Offset to baseline of characters"));
 	ChScale->setToolTip( tr("Scaling width of characters"));
@@ -2562,7 +2339,7 @@
 
 const VGradient PropertiesPalette::getMaskGradientGroup()
 {
-	return TpalGroup->gradEdit->gradient();
+	return groupPal->getMaskGradientGroup();
 }
 
 void PropertiesPalette::setGradientEditMode(bool on)
@@ -2576,6 +2353,9 @@
 		return;
 	if(doc->m_Selection->isEmpty())
 		return;
+
+	groupPal->updateColorSpecialGradient();
+
 	double dur=doc->unitRatio();
 	PageItem *currItem=doc->m_Selection->itemAt(0);
 	if (currItem)
@@ -2592,13 +2372,8 @@
 			Cpal->setMeshPoint();
 		else if (m_ScMW->view->editStrokeGradient == 7)
 			Cpal->setMeshControlPoint();
-		else
-		{
-			if (currItem->isGroupControl)
-				TpalGroup->setSpecialGradient(currItem->GrMaskStartX * dur, currItem->GrMaskStartY * dur, currItem->GrMaskEndX * dur, currItem->GrMaskEndY * dur, currItem->GrMaskFocalX * dur, currItem->GrMaskFocalY * dur, currItem->GrMaskScale, currItem->GrMaskSkew);
-			else
-				Tpal->setSpecialGradient(currItem->GrMaskStartX * dur, currItem->GrMaskStartY * dur, currItem->GrMaskEndX * dur, currItem->GrMaskEndY * dur, currItem->GrMaskFocalX * dur, currItem->GrMaskFocalY * dur, currItem->GrMaskScale, currItem->GrMaskSkew);
-		}
+		else if (!currItem->isGroupControl)
+			Tpal->setSpecialGradient(currItem->GrMaskStartX * dur, currItem->GrMaskStartY * dur, currItem->GrMaskEndX * dur, currItem->GrMaskEndY * dur, currItem->GrMaskFocalX * dur, currItem->GrMaskFocalY * dur, currItem->GrMaskScale, currItem->GrMaskSkew);
 	}
 }
 
@@ -2666,13 +2441,6 @@
 		return;
 	if ((HaveDoc) && (HaveItem))
 	{
-		tmpSelection->clear();
-		tmpSelection->copy(*doc->m_Selection, true);
-		doc->m_Selection->clear();
-		doc->m_Selection->addItem(CurItem);
-		CurItem->isSingleSel = true;
-		CurItem->update();
-		m_ScMW->view->requestMode(modeEditClip);
 		shapePal->RoundRect->setEnabled(false);
 	}
 }

Modified: branches/ScribusOIF/scribus/ui/propertiespalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15600&path=/branches/ScribusOIF/scribus/ui/propertiespalette.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette.h Wed Oct 20 23:06:16 2010
@@ -55,6 +55,7 @@
 class DashEditor;
 class FontComboH;
 class NameWidget;
+class PropertiesPalette_Group;
 class PropertiesPalette_Image;
 class PropertiesPalette_Line;
 class PropertiesPalette_Shape;
@@ -98,19 +99,16 @@
                          // commmited
 
 
+	PropertiesPalette_Group* groupPal;
 	PropertiesPalette_Image* imagePal;
 	PropertiesPalette_Line*  linePal;
 	PropertiesPalette_Shape* shapePal;
 	PropertiesPalette_XYZ*   xyzPal;
 	Cpalette *Cpal;
 	Tpalette *Tpal;
-	Tpalette *TpalGroup;
-	Autoforms* SCustom2;
 	ParaStyleComboBox *paraStyleCombo;
 	CharStyleComboBox *charStyleCombo;
 	FontComboH* Fonts;
-	QGroupBox* textFlowOptions2;
-	QButtonGroup* textFlowOptionsB2;
 	
 public slots:
 	void setMainWindow(ScribusMainWindow *mw);
@@ -180,14 +178,12 @@
 	void NewAlignement(int a);
 	void setTypeStyle(int s);
 	void newShadowOffs();
-	void DoFlow();
-	void MakeIrre(int f, int c, qreal *vals);
+	void handleNewShape(int frameType);
 	void NewTDist();
 	void NewSpGradient(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk, double cx, double cy);
 	void toggleGradientEdit(int);
 	void NewSpGradientM(double x1, double y1, double x2, double y2, double fx, double fy, double sg, double sk);
 	void toggleGradientEditM();
-	void toggleGradientEditMGroup();
 	void DoRevert();
 	void doClearCStyle();
 	void doClearPStyle();
@@ -244,7 +240,6 @@
 	QHBoxLayout* layout23;
 	QHBoxLayout* layout24;
 	QVBoxLayout* page_group_layout;
-	QHBoxLayout* ShapeGroupLayout2;
 	QVBoxLayout* Layout1t;
 	QHBoxLayout* wordTrackingHLayout;
 	QHBoxLayout* glyphExtensionHLayout;
@@ -260,7 +255,6 @@
 	QWidget* page_7;
 	QWidget* page_group;
 	
-	QLabel* SRect2;
 	QLabel* startoffsetLabel;
 	QLabel* distfromcurveLabel;
 	QLabel* pathTextTypeLabel;
@@ -304,20 +298,12 @@
 	double m_unitRatio;
 	int m_unitIndex;
 
-	QGroupBox* ShapeGroup2;
-
 	QToolButton* TabsButton;
 
 	QToolBox* TabStack;
 
 	QGroupBox* GroupBox3a;
 	QGroupBox* TransGroup;
-
-	QToolButton* textFlowDisabled2;
-	QToolButton* textFlowUsesFrameShape2;
-	QToolButton* textFlowUsesBoundingBox2;
-	QToolButton* textFlowUsesContourLine2;
-	QToolButton* textFlowUsesImageClipping2;
 
 	QCheckBox* flippedPathText;
 	QCheckBox* showcurveCheckBox;
@@ -365,7 +351,6 @@
 	QToolButton* Revert;
 	QToolButton* charStyleClear;
 	QToolButton* paraStyleClear;
-	QToolButton* EditShape2;
 
 	ScTreeWidget* TextTree;
 	QFrame* colorWidgets;

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_image.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15600&path=/branches/ScribusOIF/scribus/ui/propertiespalette_image.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_image.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_image.h Wed Oct 20 23:06:16 2010
@@ -27,7 +27,6 @@
 class QRadioButton;
 class QSpinBox;
 class QStackedWidget;
-class QStackedWidget;
 class QToolBox;
 class QVBoxLayout;
 class QWidget;
@@ -44,7 +43,6 @@
 #include "scguardedptr.h"
 #include "sctreewidget.h"
 
-class ArrowChooser;
 class Autoforms;
 class ScComboBox;
 class ScribusDoc;

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15600&path=/branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp Wed Oct 20 23:06:16 2010
@@ -570,50 +570,12 @@
 		if ((m_item->itemType() == PageItem::PolyLine) || (m_item->itemType() == PageItem::PathText))
 			return;
 
-		if (UndoManager::undoEnabled())
-		{
-			// Store shape info in this form:
-			// CHANGE_SHAPE_TYPE - ID of the undo operation
-			// OLD_FRAME_TYPE - original frame type
-			// NEW_FRAME_TYPE - change of frame type
-			// binary QPair<FPointArray, FPointArray> - .first original shape, .second new shape
-			ItemState<QPair<FPointArray,FPointArray> > *is = new ItemState<QPair<FPointArray,FPointArray> >(Um::ChangeShapeType, "", Um::IBorder);
-			is->set("CHANGE_SHAPE_TYPE", "change_shape_type");
-			is->set("OLD_FRAME_TYPE", m_item->FrameType);
-			is->set("NEW_FRAME_TYPE", f);
-			// HACK: this is propably Evil Code (TM). I have to find better way...
-			FPointArray newShape;
-			int ix = 0;
-			for (int i = 0; i < c/2; ++i)
-			{
-				double x = m_item->width() * vals[ix] / 100.0;
-				double y = m_item->height() * vals[ix+1] / 100.0;
-				newShape.addPoint(x, y);
-				ix += 2;
-			}
-			// HACK: end of hack
-			is->setItem(qMakePair(m_item->shape(), newShape));
-			UndoManager::instance()->action(m_item, is);
-		}
-
-		switch (f)
-		{
-		case 0:
-			m_item->SetRectFrame();
-			m_doc->setRedrawBounding(m_item);
-			break;
-		case 1:
-			m_item->SetOvalFrame();
-			m_doc->setRedrawBounding(m_item);
-			break;
-		default:
-			m_item->SetFrameShape(c, vals);
-			m_doc->setRedrawBounding(m_item);
-			m_item->FrameType = f+2;
-			break;
-		}
-		m_item->update();
-		emit DocChanged();
+		m_doc->item_setFrameShape(m_item, f, c, vals);
+
+		//ScribusDoc::changed() is called in item_setFrameShape()
+		//Hope this is enough
+		//emit DocChanged();
+
 		if ((m_item->itemType() == PageItem::ImageFrame) || (m_item->itemType() == PageItem::TextFrame))
 		{
 			RoundRect->setEnabled(f == 0);

Modified: branches/ScribusOIF/scribus/ui/transparencypalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15600&path=/branches/ScribusOIF/scribus/ui/transparencypalette.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/transparencypalette.h (original)
+++ branches/ScribusOIF/scribus/ui/transparencypalette.h Wed Oct 20 23:06:16 2010
@@ -53,6 +53,7 @@
 	Q_OBJECT
 
 	friend class PropertiesPalette;
+	friend class PropertiesPalette_Group;
 
 public:
 	Tpalette(QWidget* parent);

Modified: branches/ScribusOIF/win32/vc8/Scribus.vcproj
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15600&path=/branches/ScribusOIF/win32/vc8/Scribus.vcproj
==============================================================================
--- branches/ScribusOIF/win32/vc8/Scribus.vcproj (original)
+++ branches/ScribusOIF/win32/vc8/Scribus.vcproj Wed Oct 20 23:06:16 2010
@@ -1515,6 +1515,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\scribus\ui\propertiespalette_group.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\scribus\ui\propertiespalette_image.cpp"
 				>
 			</File>
@@ -8408,6 +8412,38 @@
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath="..\..\scribus\ui\propertiespalette_group.h"
+				>
+				<FileConfiguration
+					Name="Debug-cairo|Win32"
+					>
+					<Tool
+						Name="moc.exe"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release-cairo|Win32"
+					>
+					<Tool
+						Name="moc.exe"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Debug-arthur|Win32"
+					>
+					<Tool
+						Name="moc.exe"
+					/>
+				</FileConfiguration>
+				<FileConfiguration
+					Name="Release-arthur|Win32"
+					>
+					<Tool
+						Name="moc.exe"
+					/>
+				</FileConfiguration>
+			</File>
+			<File
 				RelativePath="..\..\scribus\ui\propertiespalette_image.h"
 				>
 				<FileConfiguration
@@ -13146,6 +13182,10 @@
 				>
 			</File>
 			<File
+				RelativePath="..\..\scribus\ui\moc_propertiespalette_group.cpp"
+				>
+			</File>
+			<File
 				RelativePath="..\..\scribus\ui\moc_propertiespalette_image.cpp"
 				>
 			</File>




More information about the scribus-commit mailing list