r16095 by jghali - refine architecture for new PP widgets and convert advanced text options to new architecture

scribus-commit scribus-commit at lists.scribus.net
Wed Dec 15 15:29:51 CET 2010


Author: jghali
Date: Wed Dec 15 14:29:51 2010
New Revision: 16095

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16095
Log:
refine architecture for new PP widgets and convert advanced text options to new architecture

Modified:
    branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_text.h
    branches/ScribusOIF/scribus/ui/propertywidget_advanced.cpp
    branches/ScribusOIF/scribus/ui/propertywidget_advanced.h
    branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp
    branches/ScribusOIF/scribus/ui/propertywidget_textcolor.h

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16095&path=/branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp Wed Dec 15 14:29:51 2010
@@ -96,15 +96,6 @@
 	connect(charStyleClear, SIGNAL(clicked()), this, SLOT(doClearCStyle()));
 	connect(paraStyleClear, SIGNAL(clicked()), this, SLOT(doClearPStyle()));
 
-	connect(advancedWidgets->textBase, SIGNAL(valueChanged(double)), this, SLOT(handleBaselineOffset()));
-	connect(advancedWidgets->tracking, SIGNAL(valueChanged(double)), this, SLOT(handleTracking()));
-	connect(advancedWidgets->scaleH  , SIGNAL(valueChanged(double)), this, SLOT(handleTextScaleH()));
-	connect(advancedWidgets->scaleV  , SIGNAL(valueChanged(double)), this, SLOT(handleTextScaleV()));
-	connect(advancedWidgets->minWordTrackingSpinBox, SIGNAL(valueChanged(double)), this, SLOT(handleMinWordTracking()) );
-	connect(advancedWidgets->normWordTrackingSpinBox, SIGNAL(valueChanged(double)), this, SLOT(handleNormWordTracking()) );
-	connect(advancedWidgets->minGlyphExtSpinBox, SIGNAL(valueChanged(double)), this, SLOT(handleMinGlyphExtension()) );
-	connect(advancedWidgets->maxGlyphExtSpinBox, SIGNAL(valueChanged(double)), this, SLOT(handleMaxGlyphExtension()) );
-
 	connect(distanceWidgets->columns       , SIGNAL(valueChanged(int))   , this, SLOT(handleColumns()));
 	connect(distanceWidgets->columnGap     , SIGNAL(valueChanged(double)), this, SLOT(handleColumnGap()));
 	connect(distanceWidgets->columnGapLabel, SIGNAL(activated(int))      , this, SLOT(handleGapSwitch()));
@@ -138,12 +129,12 @@
 {
 	m_ScMW=mw;
 
+	advancedWidgets->setMainWindow(mw);
 	colorWidgets->setMainWindow(mw);
 
 	connect(this, SIGNAL(DocChanged()), m_ScMW, SLOT(slotDocCh()));
 	connect(this, SIGNAL(NewAlignment(int)), m_ScMW, SLOT(setNewAlignment(int)));
 	connect(this, SIGNAL(NewFont(const QString&)), m_ScMW, SLOT(SetNewFont(const QString&)));
-	connect(this, SIGNAL(UpdtGui(int)), m_ScMW, SLOT(HaveNewSel(int)));
 }
 
 void PropertiesPalette_Text::setDoc(ScribusDoc *d)
@@ -512,13 +503,6 @@
 	fontSize->showValue(s / 10.0);
 }
 
-void PropertiesPalette_Text::displayTracking(double e)
-{
-	if (!m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	advancedWidgets->tracking->showValue(e / 10.0);
-}
-
 void PropertiesPalette_Text::displayFirstLinePolicy( FirstLineOffsetPolicy f )
 {
 	if(f == FLOPFontAscent)
@@ -557,15 +541,11 @@
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 
+	advancedWidgets->updateCharStyle(charStyle);
 	colorWidgets->updateCharStyle(charStyle);
 
 	displayFontFace(charStyle.font().scName());
 	displayFontSize(charStyle.fontSize());
-	displayTextScaleH(charStyle.scaleH());
-	displayTextScaleV(charStyle.scaleV());
-	displayBaseLineOffset(charStyle.baselineOffset());
-
-	advancedWidgets->normWordTrackingSpinBox->showValue(charStyle.wordTracking() * 100.0);
 }
 
 void PropertiesPalette_Text::updateStyle(const ParagraphStyle& newCurrent)
@@ -575,13 +555,11 @@
 
 	const CharStyle& charStyle = newCurrent.charStyle();
 
+	advancedWidgets->updateStyle(newCurrent);
 	colorWidgets->updateStyle(newCurrent);
 
 	displayFontFace(charStyle.font().scName());
 	displayFontSize(charStyle.fontSize());
-	displayTextScaleH(charStyle.scaleH());
-	displayTextScaleV(charStyle.scaleV());
-	displayBaseLineOffset(charStyle.baselineOffset());
 
 	bool tmp = m_haveItem;
 	m_haveItem = false;
@@ -589,11 +567,6 @@
 	setupLineSpacingSpinbox(newCurrent.lineSpacingMode(), newCurrent.lineSpacing());
 	lineSpacingModeCombo->setCurrentIndex(newCurrent.lineSpacingMode());
 	textAlignment->setStyle(newCurrent.alignment());
-
-	advancedWidgets->minWordTrackingSpinBox->showValue(newCurrent.minWordTracking() * 100.0);
-	advancedWidgets->normWordTrackingSpinBox->showValue(newCurrent.charStyle().wordTracking() * 100.0);
-	advancedWidgets->minGlyphExtSpinBox->showValue(newCurrent.minGlyphExtension() * 100.0);
-	advancedWidgets->maxGlyphExtSpinBox->showValue(newCurrent.maxGlyphExtension() * 100.0);
 	
 	displayOpticalMargins(newCurrent);
 	
@@ -682,86 +655,6 @@
 	optMargins->optMarginRadioBoth->blockSignals(blocked);
 }
 
-void PropertiesPalette_Text::handleMinWordTracking()
-{
-	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	ParagraphStyle newStyle;
-	newStyle.setMinWordTracking(advancedWidgets->minWordTrackingSpinBox->value() / 100.0);
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
-}
-
-
-void PropertiesPalette_Text::handleNormWordTracking()
-{
-	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	ParagraphStyle newStyle;
-	newStyle.charStyle().setWordTracking(advancedWidgets->normWordTrackingSpinBox->value() / 100.0);
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
-}
-
-void PropertiesPalette_Text::handleMinGlyphExtension()
-{
-	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	ParagraphStyle newStyle;
-	newStyle.setMinGlyphExtension(advancedWidgets->minGlyphExtSpinBox->value() / 100.0);
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
-}
-
-void PropertiesPalette_Text::handleMaxGlyphExtension()
-{
-	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	ParagraphStyle newStyle;
-	newStyle.setMaxGlyphExtension(advancedWidgets->maxGlyphExtSpinBox->value() / 100.0);
-	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
-}
-
-
-void PropertiesPalette_Text::displayTextScaleV(double e)
-{
-	if (!m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	advancedWidgets->scaleV->showValue(e / 10.0);
-}
-
-void PropertiesPalette_Text::handleTextScaleV()
-{
-	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	m_doc->itemSelection_SetScaleV(qRound(advancedWidgets->scaleV->value() * 10));
-}
-
-void PropertiesPalette_Text::handleBaselineOffset()
-{
-	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	m_doc->itemSelection_SetBaselineOffset(qRound(advancedWidgets->textBase->value() * 10));
-}
-
-void PropertiesPalette_Text::displayTextScaleH(double e)
-{
-	if (!m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	advancedWidgets->scaleH->showValue(e / 10.0);
-}
-
-void PropertiesPalette_Text::displayBaseLineOffset(double e)
-{
-	if (!m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	advancedWidgets->textBase->showValue(e / 10.0);
-}
-
-void PropertiesPalette_Text::handleTextScaleH()
-{
-	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	m_doc->itemSelection_SetScaleH(qRound(advancedWidgets->scaleH->value() * 10));
-}
-
 void PropertiesPalette_Text::handleLineSpacing()
 {
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
@@ -827,13 +720,6 @@
 	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 	m_doc->itemSelection_SetFontSize(qRound(fontSize->value()*10.0));
-}
-
-void PropertiesPalette_Text::handleTracking()
-{
-	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	m_doc->itemSelection_SetTracking(qRound(advancedWidgets->tracking->value() * 10.0));
 }
 
 void PropertiesPalette_Text::handleAlignement(int a)

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_text.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16095&path=/branches/ScribusOIF/scribus/ui/propertiespalette_text.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_text.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_text.h Wed Dec 15 14:29:51 2010
@@ -84,7 +84,6 @@
 	void unitChange();
 
 	void displayAlignment(int e);
-	void displayBaseLineOffset(double e);
 	void displayCharStyle(const QString& name);
 	void displayColumns(int r, double g);
 	void displayFontFace(const QString&);
@@ -94,9 +93,6 @@
 	void displayOpticalMargins(const ParagraphStyle& pStyle);
 	void displayParStyle(const QString& name);
 	void displayTextDistances(double left, double top, double bottom, double right);
-	void displayTextScaleH(double e);
-	void displayTextScaleV(double e);
-	void displayTracking(double e);
 	
 	void setupLineSpacingSpinbox(int mode, double value);
 	
@@ -108,18 +104,11 @@
 	void updateParagraphStyles();
 	void updateTextStyles();
 	
-	void handleBaselineOffset();
 	void handleLineSpacingMode(int id);
 	void handleOpticalMargins();
 	void resetOpticalMargins();
-	void handleMinWordTracking();
-	void handleNormWordTracking();
-	void handleMinGlyphExtension();
-	void handleMaxGlyphExtension();
 	void handleTabs();
 	void handleTextFont(QString);
-	void handleTextScaleH();
-	void handleTextScaleV();
 
 private slots:
 	void handleAlignement(int a);
@@ -131,7 +120,6 @@
 	void handleHyphLanguage();
 	void handleLineSpacing();
 	void handleTextDistances();
-	void handleTracking();
 	
 	void doClearCStyle();
 	void doClearPStyle();
@@ -167,11 +155,8 @@
 
 signals:
 	void DocChanged();
-	void NewParStyle(int);
 	void NewAlignment(int);
-	void ShapeEdit();
 	void NewFont(const QString&);
-	void UpdtGui(int);
 };
 
 #endif

Modified: branches/ScribusOIF/scribus/ui/propertywidget_advanced.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16095&path=/branches/ScribusOIF/scribus/ui/propertywidget_advanced.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertywidget_advanced.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertywidget_advanced.cpp Wed Dec 15 14:29:51 2010
@@ -7,12 +7,16 @@
 
 #include "propertywidget_advanced.h"
 
-#include "scribusdoc.h"
+#include "scribus.h"
+#include "selection.h"
 #include "units.h"
 #include "util_icon.h"
 
 PropertyWidget_Advanced::PropertyWidget_Advanced(QWidget* parent) : QFrame(parent)
 {
+	m_item = NULL;
+	m_ScMW = NULL;
+
 	setupUi(this);
 
 	setFrameStyle(QFrame::Box | QFrame::Plain);
@@ -39,15 +43,30 @@
 	languageChange();
 }
 
+void PropertyWidget_Advanced::setMainWindow(ScribusMainWindow *mw)
+{
+	m_ScMW = mw;
+}
+
 void PropertyWidget_Advanced::setDoc(ScribusDoc *d)
 {
-	if(d == (ScribusDoc*) m_doc)
-		return;
+	if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning()))
+		return;
+
+	if (m_doc)
+	{
+		disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+		disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
+	}
 
 	m_doc  = d;
+	m_item = NULL;
 
 	if (m_doc.isNull())
-		return;
+	{
+		disconnectSignals();
+		return;
+	}
 
 	m_unitRatio   = m_doc->unitRatio();
 	m_unitIndex   = m_doc->unitIndex();
@@ -57,6 +76,213 @@
 	normWordTrackingSpinBox->setValues(1, 200, 2, 100);
 	minGlyphExtSpinBox->setValues(90, 110, 2, 100);
 	maxGlyphExtSpinBox->setValues(90, 110, 2, 100);
+
+	connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+	connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
+}
+
+void PropertyWidget_Advanced::setCurrentItem(PageItem *item)
+{
+	if (!m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	//CB We shouldnt really need to process this if our item is the same one
+	//maybe we do if the item has been changed by scripter.. but that should probably
+	//set some status if so.
+	//FIXME: This wont work until when a canvas deselect happens, m_item must be NULL.
+	//if (m_item == i)
+	//	return;
+
+	if (item && m_doc.isNull())
+		setDoc(item->doc());
+
+	m_item = item;
+
+	disconnectSignals();
+	enableFromSelection();
+
+	if (m_item)
+	{
+		if (m_item->asTextFrame() || m_item->asPathText())
+		{
+			updateStyle(m_doc->appMode == modeEdit? m_item->currentStyle() : m_item->itemText.defaultStyle());
+		}
+		connectSignals();
+	}
+}
+
+void PropertyWidget_Advanced::connectSignals()
+{
+	connect(textBase, SIGNAL(valueChanged(double)), this, SLOT(handleBaselineOffset()));
+	connect(tracking, SIGNAL(valueChanged(double)), this, SLOT(handleTracking()));
+	connect(scaleH  , SIGNAL(valueChanged(double)), this, SLOT(handleTextScaleH()));
+	connect(scaleV  , SIGNAL(valueChanged(double)), this, SLOT(handleTextScaleV()));
+	connect(minWordTrackingSpinBox , SIGNAL(valueChanged(double)), this, SLOT(handleMinWordTracking()) );
+	connect(normWordTrackingSpinBox, SIGNAL(valueChanged(double)), this, SLOT(handleNormWordTracking()) );
+	connect(minGlyphExtSpinBox     , SIGNAL(valueChanged(double)), this, SLOT(handleMinGlyphExtension()) );
+	connect(maxGlyphExtSpinBox     , SIGNAL(valueChanged(double)), this, SLOT(handleMaxGlyphExtension()) );
+}
+
+void PropertyWidget_Advanced::disconnectSignals()
+{
+	disconnect(textBase, SIGNAL(valueChanged(double)), this, SLOT(handleBaselineOffset()));
+	disconnect(tracking, SIGNAL(valueChanged(double)), this, SLOT(handleTracking()));
+	disconnect(scaleH  , SIGNAL(valueChanged(double)), this, SLOT(handleTextScaleH()));
+	disconnect(scaleV  , SIGNAL(valueChanged(double)), this, SLOT(handleTextScaleV()));
+	disconnect(minWordTrackingSpinBox , SIGNAL(valueChanged(double)), this, SLOT(handleMinWordTracking()) );
+	disconnect(normWordTrackingSpinBox, SIGNAL(valueChanged(double)), this, SLOT(handleNormWordTracking()) );
+	disconnect(minGlyphExtSpinBox     , SIGNAL(valueChanged(double)), this, SLOT(handleMinGlyphExtension()) );
+	disconnect(maxGlyphExtSpinBox     , SIGNAL(valueChanged(double)), this, SLOT(handleMaxGlyphExtension()) );
+}
+
+void PropertyWidget_Advanced::enableFromSelection(void)
+{
+	bool enabled = false;
+	if (m_item && m_doc)
+	{
+		if (m_item->asPathText() || m_item->asTextFrame())
+			enabled = true;
+		if ((m_item->isGroupControl) || ((m_item->Groups.count() != 0) && (!m_item->isSingleSel)))
+			enabled = false;
+		if (m_item->asOSGFrame() || m_item->asSymbolFrame())
+			enabled = false;
+		if (m_doc->m_Selection->count() > 1)
+			enabled = false;
+	}
+	setEnabled(enabled);
+}
+
+void PropertyWidget_Advanced::handleSelectionChanged()
+{
+	if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+
+	PageItem* currItem = currentItemFromSelection();
+	setCurrentItem(currItem);
+	updateGeometry();
+	repaint();
+}
+
+void PropertyWidget_Advanced::displayBaseLineOffset(double e)
+{
+	if (!m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	textBase->showValue(e / 10.0);
+}
+
+void PropertyWidget_Advanced::displayTextScaleH(double e)
+{
+	if (!m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	scaleH->showValue(e / 10.0);
+}
+
+void PropertyWidget_Advanced::displayTextScaleV(double e)
+{
+	if (!m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	scaleV->showValue(e / 10.0);
+}
+
+void PropertyWidget_Advanced::displayTracking(double e)
+{
+	if (!m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	tracking->showValue(e / 10.0);
+}
+
+void PropertyWidget_Advanced::handleBaselineOffset()
+{
+	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	m_doc->itemSelection_SetBaselineOffset(qRound(textBase->value() * 10));
+}
+
+void PropertyWidget_Advanced::handleMinWordTracking()
+{
+	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	ParagraphStyle newStyle;
+	newStyle.setMinWordTracking(minWordTrackingSpinBox->value() / 100.0);
+	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+}
+
+void PropertyWidget_Advanced::handleNormWordTracking()
+{
+	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	ParagraphStyle newStyle;
+	newStyle.charStyle().setWordTracking(normWordTrackingSpinBox->value() / 100.0);
+	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+}
+
+void PropertyWidget_Advanced::handleMinGlyphExtension()
+{
+	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	ParagraphStyle newStyle;
+	newStyle.setMinGlyphExtension(minGlyphExtSpinBox->value() / 100.0);
+	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+}
+
+void PropertyWidget_Advanced::handleMaxGlyphExtension()
+{
+	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	ParagraphStyle newStyle;
+	newStyle.setMaxGlyphExtension(maxGlyphExtSpinBox->value() / 100.0);
+	m_doc->itemSelection_ApplyParagraphStyle(newStyle);
+}
+
+void PropertyWidget_Advanced::handleTextScaleH()
+{
+	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	m_doc->itemSelection_SetScaleH(qRound(scaleH->value() * 10));
+}
+
+void PropertyWidget_Advanced::handleTextScaleV()
+{
+	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	m_doc->itemSelection_SetScaleV(qRound(scaleV->value() * 10));
+}
+
+void PropertyWidget_Advanced::handleTracking()
+{
+	if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	m_doc->itemSelection_SetTracking(qRound(tracking->value() * 10.0));
+}
+
+void PropertyWidget_Advanced::updateCharStyle(const CharStyle& charStyle)
+{
+	if (!m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+
+	displayTextScaleH(charStyle.scaleH());
+	displayTextScaleV(charStyle.scaleV());
+	displayTracking(charStyle.tracking());
+	displayBaseLineOffset(charStyle.baselineOffset());
+
+	normWordTrackingSpinBox->showValue(charStyle.wordTracking() * 100.0);
+}
+
+void PropertyWidget_Advanced::updateStyle(const ParagraphStyle& newCurrent)
+{
+	if (!m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+
+	const CharStyle& charStyle = newCurrent.charStyle();
+
+	displayTextScaleH(charStyle.scaleH());
+	displayTextScaleV(charStyle.scaleV());
+	displayTracking(charStyle.tracking());
+	displayBaseLineOffset(charStyle.baselineOffset());
+
+	minWordTrackingSpinBox->showValue(newCurrent.minWordTracking() * 100.0);
+	normWordTrackingSpinBox->showValue(newCurrent.charStyle().wordTracking() * 100.0);
+	minGlyphExtSpinBox->showValue(newCurrent.minGlyphExtension() * 100.0);
+	maxGlyphExtSpinBox->showValue(newCurrent.maxGlyphExtension() * 100.0);
 }
 
 void PropertyWidget_Advanced::changeEvent(QEvent *e)

Modified: branches/ScribusOIF/scribus/ui/propertywidget_advanced.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16095&path=/branches/ScribusOIF/scribus/ui/propertywidget_advanced.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertywidget_advanced.h (original)
+++ branches/ScribusOIF/scribus/ui/propertywidget_advanced.h Wed Dec 15 14:29:51 2010
@@ -9,11 +9,15 @@
 
 #include "ui_propertywidget_advancedbase.h"
 
-#include "scguardedptr.h"
+#include "propertywidgetbase.h"
 
+class CharStyle;
+class ParagraphStyle;
 class ScribusDoc;
+class ScribusMainWindow;
 
-class PropertyWidget_Advanced : public QFrame, public Ui::PropertyWidget_AdvancedBase
+class PropertyWidget_Advanced : public QFrame, Ui::PropertyWidget_AdvancedBase,
+                                public PropertyWidgetBase
 {
 	Q_OBJECT
 
@@ -24,18 +28,45 @@
 	virtual void changeEvent(QEvent *e);
 
 protected:
+	void connectSignals();
+	void disconnectSignals();
 
 	double m_unitRatio;
 	int    m_unitIndex;
 
-	ScGuardedPtr<ScribusDoc> m_doc;
+	PageItem*          m_item;
+	ScribusMainWindow* m_ScMW;
+
+	void enableFromSelection(void);
+	void setCurrentItem(PageItem *i);
 
 public slots:
+	void setMainWindow(ScribusMainWindow *mw);
+	void setDoc(ScribusDoc *d);
 
-	void setDoc(ScribusDoc *d);
+	void handleSelectionChanged();
 
 	void languageChange();
 	void unitChange() {};
+
+	void displayBaseLineOffset(double e);
+	void displayTextScaleH(double e);
+	void displayTextScaleV(double e);
+	void displayTracking(double e);
+
+	void updateCharStyle(const CharStyle& charStyle);
+	void updateStyle(const ParagraphStyle& newCurrent);
+
+private slots:
+	void handleBaselineOffset();
+	void handleMinWordTracking();
+	void handleNormWordTracking();
+	void handleMinGlyphExtension();
+	void handleMaxGlyphExtension();
+	void handleTextScaleH();
+	void handleTextScaleV();
+	void handleTracking();
+
 };
 
 #endif

Modified: branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16095&path=/branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp Wed Dec 15 14:29:51 2010
@@ -63,20 +63,19 @@
 	m_doc  = d;
 	m_item = NULL;
 
-	if (m_doc)
-	{
-		updateColorList();
-
-		connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
-		connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
-	}
-	else
+	if (m_doc.isNull())
 	{
 		disconnectSignals();
-	}
-}
-
-void PropertyWidget_TextColor::setCurrentItem(PageItem *i)
+		return;
+	}
+
+	updateColorList();
+
+	connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+	connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
+}
+
+void PropertyWidget_TextColor::setCurrentItem(PageItem *item)
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
@@ -87,37 +86,23 @@
 	//if (m_item == i)
 	//	return;
 
-	if (!m_doc)
-		setDoc(i->doc());
-
-	m_item = i;
+	if (item && m_doc.isNull())
+		setDoc(item->doc());
+
+	m_item = item;
 
 	disconnectSignals();
+	enableFromSelection();
 
 	if (m_item)
 	{
 		revertButton->setChecked(m_item->reversed());
-
-		if ((m_item->isGroupControl) || ((m_item->Groups.count() != 0) && (!m_item->isSingleSel)))
-		{
-			setEnabled(false);
-		}
-		if (m_item->asOSGFrame() || m_item->asSymbolFrame())
-		{
-			setEnabled(false);
-		}
 		if (m_item->asTextFrame() || m_item->asPathText())
 		{
 			updateStyle(m_doc->appMode == modeEdit? m_item->currentStyle() : m_item->itemText.defaultStyle());
 		}
 		connectSignals();
 	}
-}
-
-void PropertyWidget_TextColor::unsetItem()
-{
-	m_item     = NULL;
-	handleSelectionChanged();
 }
 
 void PropertyWidget_TextColor::connectSignals()
@@ -156,30 +141,29 @@
 	disconnect(textEffects->StrikeVal->LWidth   , SIGNAL(valueChanged(double)), this, SLOT(handleStrikeThru()));
 }
 
+void PropertyWidget_TextColor::enableFromSelection(void)
+{
+	bool enabled = false;
+	if (m_item && m_doc)
+	{
+		if (m_item->asPathText() || m_item->asTextFrame())
+			enabled = true;
+		if ((m_item->isGroupControl) || ((m_item->Groups.count() != 0) && (!m_item->isSingleSel)))
+			enabled = false;
+		if (m_item->asOSGFrame() || m_item->asSymbolFrame())
+			enabled = false;
+		if (m_doc->m_Selection->count() > 1)
+			enabled = false;
+	}
+	setEnabled(enabled);
+}
+
 void PropertyWidget_TextColor::handleSelectionChanged()
 {
 	if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 
 	PageItem* currItem = currentItemFromSelection();
-	if (m_doc->m_Selection->count() > 1 )
-	{
-		setEnabled(false);
-	}
-	else
-	{
-		int itemType = currItem ? (int) currItem->itemType() : -1;
-		switch (itemType)
-		{
-		case PageItem::TextFrame:
-		case PageItem::PathText:
-			setEnabled(true);
-			break;
-		default:
-			setEnabled(false);
-			break;
-		}
-	}
 	setCurrentItem(currItem);
 	updateGeometry();
 	repaint();

Modified: branches/ScribusOIF/scribus/ui/propertywidget_textcolor.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16095&path=/branches/ScribusOIF/scribus/ui/propertywidget_textcolor.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertywidget_textcolor.h (original)
+++ branches/ScribusOIF/scribus/ui/propertywidget_textcolor.h Wed Dec 15 14:29:51 2010
@@ -31,15 +31,14 @@
 	void connectSignals();
 	void disconnectSignals();
 
-	PageItem *m_item;
-	ScribusMainWindow*       m_ScMW;
+	PageItem *         m_item;
+	ScribusMainWindow* m_ScMW;
 
+	void enableFromSelection(void);
 	void setCurrentItem(PageItem *i);
-	void unsetItem();
 
 public slots:
 	void setMainWindow(ScribusMainWindow *mw);
-
 	void setDoc(ScribusDoc *d);
 
 	void handleSelectionChanged();




More information about the scribus-commit mailing list