r16093 by jghali - experiment new structure for widgets to be used in future PP
scribus-commit
scribus-commit at lists.scribus.net
Wed Dec 15 03:08:18 CET 2010
Author: jghali
Date: Wed Dec 15 02:08:18 2010
New Revision: 16093
URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=16093
Log:
experiment new structure for widgets to be used in future PP
Added:
branches/ScribusOIF/scribus/ui/propertywidgetbase.cpp
branches/ScribusOIF/scribus/ui/propertywidgetbase.h
Modified:
branches/ScribusOIF/scribus/CMakeLists.txt
branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
branches/ScribusOIF/scribus/ui/propertiespalette_text.h
branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp
branches/ScribusOIF/scribus/ui/propertywidget_textcolor.h
branches/ScribusOIF/win32/vc8/Scribus.vcproj
Modified: branches/ScribusOIF/scribus/CMakeLists.txt
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16093&path=/branches/ScribusOIF/scribus/CMakeLists.txt
==============================================================================
--- branches/ScribusOIF/scribus/CMakeLists.txt (original)
+++ branches/ScribusOIF/scribus/CMakeLists.txt Wed Dec 15 02:08:18 2010
@@ -781,6 +781,7 @@
ui/propertywidget_optmargins.cpp
ui/propertywidget_pathtext.cpp
ui/propertywidget_textcolor.cpp
+ ui/propertywidgetbase.cpp
ui/query.cpp
# ui/reformdoc.cpp
ui/replacecolors.cpp
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16093&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 02:08:18 2010
@@ -105,21 +105,6 @@
connect(advancedWidgets->minGlyphExtSpinBox, SIGNAL(valueChanged(double)), this, SLOT(handleMinGlyphExtension()) );
connect(advancedWidgets->maxGlyphExtSpinBox, SIGNAL(valueChanged(double)), this, SLOT(handleMaxGlyphExtension()) );
- connect(colorWidgets->revertButton, SIGNAL(clicked()) , this, SLOT(handleTextDirection()));
- connect(colorWidgets->fillColor , SIGNAL(activated(int)), this, SLOT(handleTextFill()));
- connect(colorWidgets->strokeColor , SIGNAL(activated(int)), this, SLOT(handleTextStroke()));
- connect(colorWidgets->fillShade , SIGNAL(clicked()) , this, SLOT(handleTextShade()));
- connect(colorWidgets->strokeShade , SIGNAL(clicked()) , this, SLOT(handleTextShade()));
-
- connect(colorWidgets->textEffects, SIGNAL(State(int)) , this, SLOT(handleTypeStyle(int)));
- connect(colorWidgets->textEffects->ShadowVal->Xoffset , SIGNAL(valueChanged(double)), this, SLOT(handleShadowOffs()));
- connect(colorWidgets->textEffects->ShadowVal->Yoffset , SIGNAL(valueChanged(double)), this, SLOT(handleShadowOffs()));
- connect(colorWidgets->textEffects->OutlineVal->LWidth , SIGNAL(valueChanged(double)), this, SLOT(handleOutlineWidth()));
- connect(colorWidgets->textEffects->UnderlineVal->LPos , SIGNAL(valueChanged(double)), this, SLOT(handleUnderline()));
- connect(colorWidgets->textEffects->UnderlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(handleUnderline()));
- connect(colorWidgets->textEffects->StrikeVal->LPos , SIGNAL(valueChanged(double)), this, SLOT(handleStrikeThru()));
- connect(colorWidgets->textEffects->StrikeVal->LWidth , SIGNAL(valueChanged(double)), this, SLOT(handleStrikeThru()));
-
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()));
@@ -153,9 +138,10 @@
{
m_ScMW=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(NewEffects(int)) , m_ScMW, SLOT(setItemEffects(int)));
connect(this, SIGNAL(NewFont(const QString&)), m_ScMW, SLOT(SetNewFont(const QString&)));
connect(this, SIGNAL(UpdtGui(int)), m_ScMW, SLOT(HaveNewSel(int)));
}
@@ -186,19 +172,16 @@
fontSize->setValues( 0.5, 2048, 2, 1);
lineSpacing->setValues( 1, 2048, 2, 1);
-
-
- updateColorList();
-
- paraStyleCombo->setDoc(m_doc);
- charStyleCombo->setDoc(m_doc);
-
advancedWidgets->setDoc(m_doc);
+ colorWidgets->setDoc(m_doc);
distanceWidgets->setDoc(m_doc);
flopBox->setDoc(m_doc);
optMargins->setDoc(m_doc);
pathTextWidgets->setDoc(m_doc);
+ paraStyleCombo->setDoc(m_doc);
+ charStyleCombo->setDoc(m_doc);
+
connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged()));
}
@@ -220,6 +203,7 @@
charStyleCombo->setDoc(0);
advancedWidgets->setDoc(0);
+ colorWidgets->setDoc(0);
distanceWidgets->setDoc(0);
flopBox->setDoc(0);
optMargins->setDoc(0);
@@ -372,7 +356,6 @@
{
fonts->RebuildList(m_doc, m_item->isAnnotation());
}
- colorWidgets->revertButton->setChecked(m_item->reversed());
displayTextDistances(i->textToFrameDistLeft(),i->textToFrameDistTop(),i->textToFrameDistBottom(),i->textToFrameDistRight());
@@ -574,16 +557,12 @@
if (!m_ScMW || m_ScMW->scriptIsRunning())
return;
+ colorWidgets->updateCharStyle(charStyle);
+
displayFontFace(charStyle.font().scName());
displayFontSize(charStyle.fontSize());
- displayOutlineW (charStyle.outlineWidth());
- displayShadowOffset(charStyle.shadowXOffset(), charStyle.shadowYOffset());
- displayTextColors(charStyle.strokeColor(), charStyle.fillColor(), charStyle.strokeShade(), charStyle.fillShade());
- displayTextEffects(charStyle.effects());
displayTextScaleH(charStyle.scaleH());
displayTextScaleV(charStyle.scaleV());
- displayStrikeThru(charStyle.strikethruOffset() , charStyle.strikethruWidth());
- displayUnderline (charStyle.underlineOffset(), charStyle.underlineWidth());
displayBaseLineOffset(charStyle.baselineOffset());
advancedWidgets->normWordTrackingSpinBox->showValue(charStyle.wordTracking() * 100.0);
@@ -595,17 +574,13 @@
return;
const CharStyle& charStyle = newCurrent.charStyle();
+
+ colorWidgets->updateStyle(newCurrent);
displayFontFace(charStyle.font().scName());
displayFontSize(charStyle.fontSize());
- displayOutlineW (charStyle.outlineWidth());
- displayShadowOffset(charStyle.shadowXOffset(), charStyle.shadowYOffset());
- displayTextColors(charStyle.strokeColor(), charStyle.fillColor(), charStyle.strokeShade(), charStyle.fillShade());
- displayTextEffects(charStyle.effects());
displayTextScaleH(charStyle.scaleH());
displayTextScaleV(charStyle.scaleV());
- displayStrikeThru(charStyle.strikethruOffset() , charStyle.strikethruWidth());
- displayUnderline (charStyle.underlineOffset(), charStyle.underlineWidth());
displayBaseLineOffset(charStyle.baselineOffset());
bool tmp = m_haveItem;
@@ -639,22 +614,6 @@
{
paraStyleCombo->updateFormatList();
charStyleCombo->updateFormatList();
-}
-
-void PropertiesPalette_Text::displayTextEffects(int s)
-{
- if (!m_ScMW || m_ScMW->scriptIsRunning())
- return;
- colorWidgets->strokeIcon->setEnabled(false);
- colorWidgets->strokeColor->setEnabled(false);
- colorWidgets->strokeShade->setEnabled(false);
- colorWidgets->textEffects->setStyle(s);
- if ((s & 4) || (s & 256))
- {
- colorWidgets->strokeIcon->setEnabled(true);
- colorWidgets->strokeColor->setEnabled(true);
- colorWidgets->strokeShade->setEnabled(true);
- }
}
void PropertiesPalette_Text::displayAlignment(int e)
@@ -884,81 +843,6 @@
m_doc->itemSelection_SetAlignment(a);
}
-void PropertiesPalette_Text::handleTypeStyle(int s)
-{
- if (!m_ScMW || m_ScMW->scriptIsRunning())
- return;
- emit NewEffects(s);
-}
-
-void PropertiesPalette_Text::handleShadowOffs()
-{
- if ((m_haveDoc) && (m_haveItem))
- {
- int x = qRound(colorWidgets->textEffects->ShadowVal->Xoffset->value() * 10.0);
- int y = qRound(colorWidgets->textEffects->ShadowVal->Yoffset->value() * 10.0);
- m_doc->itemSelection_SetShadowOffsets(x, y);
- }
-}
-
-void PropertiesPalette_Text::displayShadowOffset(double x, double y)
-{
- if (!m_ScMW || m_ScMW->scriptIsRunning())
- return;
- colorWidgets->textEffects->ShadowVal->Xoffset->showValue(x / 10.0);
- colorWidgets->textEffects->ShadowVal->Yoffset->showValue(y / 10.0);
-}
-
-void PropertiesPalette_Text::handleUnderline()
-{
- if ((m_haveDoc) && (m_haveItem))
- {
- int x = qRound(colorWidgets->textEffects->UnderlineVal->LPos->value() * 10.0);
- int y = qRound(colorWidgets->textEffects->UnderlineVal->LWidth->value() * 10.0);
- m_doc->itemSelection_SetUnderline(x, y);
- }
-}
-
-void PropertiesPalette_Text::displayUnderline(double p, double w)
-{
- if (!m_ScMW || m_ScMW->scriptIsRunning())
- return;
- colorWidgets->textEffects->UnderlineVal->LPos->showValue(p / 10.0);
- colorWidgets->textEffects->UnderlineVal->LWidth->showValue(w / 10.0);
-}
-
-void PropertiesPalette_Text::handleStrikeThru()
-{
- if ((m_haveDoc) && (m_haveItem))
- {
- int x = qRound(colorWidgets->textEffects->StrikeVal->LPos->value() * 10.0);
- int y = qRound(colorWidgets->textEffects->StrikeVal->LWidth->value() * 10.0);
- m_doc->itemSelection_SetStrikethru(x, y);
- }
-}
-
-void PropertiesPalette_Text::displayStrikeThru(double p, double w)
-{
- if (!m_ScMW || m_ScMW->scriptIsRunning())
- return;
- colorWidgets->textEffects->StrikeVal->LPos->showValue(p / 10.0);
- colorWidgets->textEffects->StrikeVal->LWidth->showValue(w / 10.0);
-}
-
-void PropertiesPalette_Text::displayOutlineW(double x)
-{
- if (!m_ScMW || m_ScMW->scriptIsRunning())
- return;
- colorWidgets->textEffects->OutlineVal->LWidth->showValue(x / 10.0);
-}
-
-void PropertiesPalette_Text::handleOutlineWidth()
-{
- int x = qRound(colorWidgets->textEffects->OutlineVal->LWidth->value() * 10.0);
- if ((m_haveDoc) && (m_haveItem))
- m_doc->itemSelection_SetOutlineWidth(x);
-}
-
void PropertiesPalette_Text::handleTextDistances()
{
if (!m_ScMW || m_ScMW->scriptIsRunning())
@@ -983,18 +867,6 @@
emit NewFont(c);
}
-void PropertiesPalette_Text::handleTextDirection()
-{
- if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
- return;
- bool setter = colorWidgets->revertButton->isChecked();
- m_item->setImageFlippedH(setter);
- m_item->setReversed(setter);
- m_item->update();
- emit DocChanged();
-}
-
-
void PropertiesPalette_Text::doClearCStyle()
{
if (!m_ScMW || m_ScMW->scriptIsRunning())
@@ -1023,73 +895,7 @@
if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
return;
- colorWidgets->fillColor->updateBox(m_doc->PageColors, ColorCombo::fancyPixmaps, true);
- colorWidgets->strokeColor->updateBox(m_doc->PageColors, ColorCombo::fancyPixmaps, false);
- colorWidgets->fillColor->view()->setMinimumWidth(colorWidgets->fillColor->view()->maximumViewportSize().width() + 24);
- colorWidgets->strokeColor->view()->setMinimumWidth(colorWidgets->strokeColor->view()->maximumViewportSize().width() + 24);
-}
-
-void PropertiesPalette_Text::handleTextFill()
-{
- if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
- return;
- m_doc->itemSelection_SetFillColor(colorWidgets->fillColor->currentColor());
-}
-
-void PropertiesPalette_Text::handleTextStroke()
-{
- if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
- return;
- m_doc->itemSelection_SetStrokeColor(colorWidgets->strokeColor->currentColor());
-}
-
-void PropertiesPalette_Text::handleTextShade()
-{
- if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
- return;
- int b;
- if (colorWidgets->strokeShade == sender())
- {
- b = colorWidgets->strokeShade->getValue();
- m_doc->itemSelection_SetStrokeShade(b);
- }
- else
- {
- b = colorWidgets->fillShade->getValue();
- m_doc->itemSelection_SetFillShade(b);
- }
-}
-
-void PropertiesPalette_Text::displayTextColors(QString p, QString b, double shp, double shb)
-{
- if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
- return;
- ColorList::Iterator it;
- int c = 0;
- colorWidgets->fillShade->setValue(qRound(shb));
- colorWidgets->strokeShade->setValue(qRound(shp));
- if ((b != CommonStrings::None) && (!b.isEmpty()))
- {
- c++;
- for (it = m_doc->PageColors.begin(); it != m_doc->PageColors.end(); ++it)
- {
- if (it.key() == b)
- break;
- c++;
- }
- }
- colorWidgets->fillColor->setCurrentIndex(c);
- c = 0;
- if ((p != CommonStrings::None) && (!p.isEmpty()))
- {
- for (it = m_doc->PageColors.begin(); it != m_doc->PageColors.end(); ++it)
- {
- if (it.key() == p)
- break;
- c++;
- }
- }
- colorWidgets->strokeColor->setCurrentIndex(c);
+ colorWidgets->updateColorList();
}
void PropertiesPalette_Text::handlePathType()
Modified: branches/ScribusOIF/scribus/ui/propertiespalette_text.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16093&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 02:08:18 2010
@@ -92,17 +92,11 @@
void displayFirstLinePolicy(FirstLineOffsetPolicy);
void displayLineSpacing(double r);
void displayOpticalMargins(const ParagraphStyle& pStyle);
- void displayOutlineW(double x);
void displayParStyle(const QString& name);
- void displayShadowOffset(double x, double y);
- void displayStrikeThru(double p, double w);
- void displayTextColors(QString p, QString b, double shp, double shb);
void displayTextDistances(double left, double top, double bottom, double right);
- void displayTextEffects(int s);
void displayTextScaleH(double e);
void displayTextScaleV(double e);
void displayTracking(double e);
- void displayUnderline(double p, double w);
void setupLineSpacingSpinbox(int mode, double value);
@@ -122,16 +116,10 @@
void handleNormWordTracking();
void handleMinGlyphExtension();
void handleMaxGlyphExtension();
- void handleOutlineWidth();
- void handleStrikeThru();
void handleTabs();
void handleTextFont(QString);
- void handleTextFill();
void handleTextScaleH();
void handleTextScaleV();
- void handleTextShade();
- void handleTextStroke();
- void handleUnderline();
private slots:
void handleAlignement(int a);
@@ -142,11 +130,8 @@
void handleGapSwitch();
void handleHyphLanguage();
void handleLineSpacing();
- void handleShadowOffs();
- void handleTextDirection();
void handleTextDistances();
void handleTracking();
- void handleTypeStyle(int s);
void doClearCStyle();
void doClearPStyle();
@@ -184,7 +169,6 @@
void DocChanged();
void NewParStyle(int);
void NewAlignment(int);
- void NewEffects(int);
void ShapeEdit();
void NewFont(const QString&);
void UpdtGui(int);
Modified: branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16093&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 02:08:18 2010
@@ -7,10 +7,15 @@
#include "propertywidget_textcolor.h"
+#include "scribus.h"
+#include "selection.h"
#include "util_icon.h"
PropertyWidget_TextColor::PropertyWidget_TextColor(QWidget* parent) : QFrame(parent)
{
+ m_item = NULL;
+ m_ScMW = NULL;
+
setupUi(this);
setFrameStyle(QFrame::Box | QFrame::Plain);
@@ -39,6 +44,350 @@
strokeShade->setEnabled(false);
}
+void PropertyWidget_TextColor::setMainWindow(ScribusMainWindow *mw)
+{
+ m_ScMW = mw;
+}
+
+void PropertyWidget_TextColor::setDoc(ScribusDoc *d)
+{
+ 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)
+ {
+ updateColorList();
+
+ connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+ connect(m_doc , SIGNAL(docChanged()) , this, SLOT(handleSelectionChanged()));
+ }
+ else
+ {
+ disconnectSignals();
+ }
+}
+
+void PropertyWidget_TextColor::setCurrentItem(PageItem *i)
+{
+ 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 (!m_doc)
+ setDoc(i->doc());
+
+ m_item = i;
+
+ disconnectSignals();
+
+ 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()
+{
+ connect(revertButton, SIGNAL(clicked()) , this, SLOT(handleTextDirection()), Qt::UniqueConnection);
+ connect(fillColor , SIGNAL(activated(int)), this, SLOT(handleTextFill()) , Qt::UniqueConnection);
+ connect(strokeColor , SIGNAL(activated(int)), this, SLOT(handleTextStroke()) , Qt::UniqueConnection);
+ connect(fillShade , SIGNAL(clicked()) , this, SLOT(handleTextShade()) , Qt::UniqueConnection);
+ connect(strokeShade , SIGNAL(clicked()) , this, SLOT(handleTextShade()) , Qt::UniqueConnection);
+
+ connect(textEffects, SIGNAL(State(int)) , this, SLOT(handleTypeStyle(int)), Qt::UniqueConnection);
+ connect(textEffects->ShadowVal->Xoffset , SIGNAL(valueChanged(double)), this, SLOT(handleShadowOffs()), Qt::UniqueConnection);
+ connect(textEffects->ShadowVal->Yoffset , SIGNAL(valueChanged(double)), this, SLOT(handleShadowOffs()), Qt::UniqueConnection);
+ connect(textEffects->OutlineVal->LWidth , SIGNAL(valueChanged(double)), this, SLOT(handleOutlineWidth()), Qt::UniqueConnection);
+ connect(textEffects->UnderlineVal->LPos , SIGNAL(valueChanged(double)), this, SLOT(handleUnderline()) , Qt::UniqueConnection);
+ connect(textEffects->UnderlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(handleUnderline()) , Qt::UniqueConnection);
+ connect(textEffects->StrikeVal->LPos , SIGNAL(valueChanged(double)), this, SLOT(handleStrikeThru()), Qt::UniqueConnection);
+ connect(textEffects->StrikeVal->LWidth , SIGNAL(valueChanged(double)), this, SLOT(handleStrikeThru()), Qt::UniqueConnection);
+}
+
+void PropertyWidget_TextColor::disconnectSignals()
+{
+ disconnect(revertButton, SIGNAL(clicked()) , this, SLOT(handleTextDirection()));
+ disconnect(fillColor , SIGNAL(activated(int)), this, SLOT(handleTextFill()));
+ disconnect(strokeColor , SIGNAL(activated(int)), this, SLOT(handleTextStroke()));
+ disconnect(fillShade , SIGNAL(clicked()) , this, SLOT(handleTextShade()));
+ disconnect(strokeShade , SIGNAL(clicked()) , this, SLOT(handleTextShade()));
+
+ disconnect(textEffects, SIGNAL(State(int)) , this, SLOT(handleTypeStyle(int)));
+ disconnect(textEffects->ShadowVal->Xoffset , SIGNAL(valueChanged(double)), this, SLOT(handleShadowOffs()));
+ disconnect(textEffects->ShadowVal->Yoffset , SIGNAL(valueChanged(double)), this, SLOT(handleShadowOffs()));
+ disconnect(textEffects->OutlineVal->LWidth , SIGNAL(valueChanged(double)), this, SLOT(handleOutlineWidth()));
+ disconnect(textEffects->UnderlineVal->LPos , SIGNAL(valueChanged(double)), this, SLOT(handleUnderline()));
+ disconnect(textEffects->UnderlineVal->LWidth, SIGNAL(valueChanged(double)), this, SLOT(handleUnderline()));
+ disconnect(textEffects->StrikeVal->LPos , SIGNAL(valueChanged(double)), this, SLOT(handleStrikeThru()));
+ disconnect(textEffects->StrikeVal->LWidth , SIGNAL(valueChanged(double)), this, SLOT(handleStrikeThru()));
+}
+
+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();
+}
+
+void PropertyWidget_TextColor::updateColorList()
+{
+ if (!m_doc || !m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+
+ fillColor->updateBox(m_doc->PageColors, ColorCombo::fancyPixmaps, true);
+ strokeColor->updateBox(m_doc->PageColors, ColorCombo::fancyPixmaps, false);
+ fillColor->view()->setMinimumWidth(fillColor->view()->maximumViewportSize().width() + 24);
+ strokeColor->view()->setMinimumWidth(strokeColor->view()->maximumViewportSize().width() + 24);
+}
+
+void PropertyWidget_TextColor::updateCharStyle(const CharStyle& charStyle)
+{
+ if (!m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+
+ displayOutlineW (charStyle.outlineWidth());
+ displayShadowOffset(charStyle.shadowXOffset(), charStyle.shadowYOffset());
+ displayTextColors(charStyle.strokeColor(), charStyle.fillColor(), charStyle.strokeShade(), charStyle.fillShade());
+ displayTextEffects(charStyle.effects());
+ displayStrikeThru(charStyle.strikethruOffset() , charStyle.strikethruWidth());
+ displayUnderline (charStyle.underlineOffset(), charStyle.underlineWidth());
+}
+
+void PropertyWidget_TextColor::updateStyle(const ParagraphStyle& newCurrent)
+{
+ if (!m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+
+ const CharStyle& charStyle = newCurrent.charStyle();
+
+ displayOutlineW (charStyle.outlineWidth());
+ displayShadowOffset(charStyle.shadowXOffset(), charStyle.shadowYOffset());
+ displayTextColors(charStyle.strokeColor(), charStyle.fillColor(), charStyle.strokeShade(), charStyle.fillShade());
+ displayTextEffects(charStyle.effects());
+ displayStrikeThru(charStyle.strikethruOffset() , charStyle.strikethruWidth());
+ displayUnderline (charStyle.underlineOffset(), charStyle.underlineWidth());
+}
+
+void PropertyWidget_TextColor::displayOutlineW(double x)
+{
+ if (!m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ textEffects->OutlineVal->LWidth->showValue(x / 10.0);
+}
+
+void PropertyWidget_TextColor::displayShadowOffset(double x, double y)
+{
+ if (!m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ textEffects->ShadowVal->Xoffset->showValue(x / 10.0);
+ textEffects->ShadowVal->Yoffset->showValue(y / 10.0);
+}
+
+void PropertyWidget_TextColor::displayStrikeThru(double p, double w)
+{
+ if (!m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ textEffects->StrikeVal->LPos->showValue(p / 10.0);
+ textEffects->StrikeVal->LWidth->showValue(w / 10.0);
+}
+
+void PropertyWidget_TextColor::displayTextColors(QString p, QString b, double shp, double shb)
+{
+ if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ ColorList::Iterator it;
+ int c = 0;
+ fillShade->setValue(qRound(shb));
+ strokeShade->setValue(qRound(shp));
+ if ((b != CommonStrings::None) && (!b.isEmpty()))
+ {
+ c++;
+ for (it = m_doc->PageColors.begin(); it != m_doc->PageColors.end(); ++it)
+ {
+ if (it.key() == b)
+ break;
+ c++;
+ }
+ }
+ fillColor->setCurrentIndex(c);
+ c = 0;
+ if ((p != CommonStrings::None) && (!p.isEmpty()))
+ {
+ for (it = m_doc->PageColors.begin(); it != m_doc->PageColors.end(); ++it)
+ {
+ if (it.key() == p)
+ break;
+ c++;
+ }
+ }
+ strokeColor->setCurrentIndex(c);
+}
+
+void PropertyWidget_TextColor::displayTextEffects(int s)
+{
+ if (!m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ strokeIcon->setEnabled(false);
+ strokeColor->setEnabled(false);
+ strokeShade->setEnabled(false);
+ textEffects->setStyle(s);
+ if ((s & 4) || (s & 256))
+ {
+ strokeIcon->setEnabled(true);
+ strokeColor->setEnabled(true);
+ strokeShade->setEnabled(true);
+ }
+}
+
+void PropertyWidget_TextColor::handleOutlineWidth()
+{
+ int x = qRound(textEffects->OutlineVal->LWidth->value() * 10.0);
+ if ((m_doc) && (m_item))
+ m_doc->itemSelection_SetOutlineWidth(x);
+}
+
+void PropertyWidget_TextColor::handleShadowOffs()
+{
+ if ((m_doc) && (m_item))
+ {
+ int x = qRound(textEffects->ShadowVal->Xoffset->value() * 10.0);
+ int y = qRound(textEffects->ShadowVal->Yoffset->value() * 10.0);
+ m_doc->itemSelection_SetShadowOffsets(x, y);
+ }
+}
+
+void PropertyWidget_TextColor::handleStrikeThru()
+{
+ if ((m_doc) && (m_item))
+ {
+ int x = qRound(textEffects->StrikeVal->LPos->value() * 10.0);
+ int y = qRound(textEffects->StrikeVal->LWidth->value() * 10.0);
+ m_doc->itemSelection_SetStrikethru(x, y);
+ }
+}
+
+void PropertyWidget_TextColor::handleTextDirection()
+{
+ if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ bool setter = revertButton->isChecked();
+ m_item->setImageFlippedH(setter);
+ m_item->setReversed(setter);
+ m_item->update();
+ //emit DocChanged();
+}
+
+void PropertyWidget_TextColor::handleTextFill()
+{
+ if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ m_doc->itemSelection_SetFillColor(fillColor->currentColor());
+}
+
+void PropertyWidget_TextColor::handleTextStroke()
+{
+ if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ m_doc->itemSelection_SetStrokeColor(strokeColor->currentColor());
+}
+
+void PropertyWidget_TextColor::handleTextShade()
+{
+ if (!m_doc || !m_item || !m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ if (strokeShade == sender())
+ {
+ int b = strokeShade->getValue();
+ m_doc->itemSelection_SetStrokeShade(b);
+ }
+ else
+ {
+ int b = fillShade->getValue();
+ m_doc->itemSelection_SetFillShade(b);
+ }
+}
+
+void PropertyWidget_TextColor::handleTypeStyle(int s)
+{
+ if (!m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ m_ScMW->setItemEffects(s);
+}
+
+void PropertyWidget_TextColor::displayUnderline(double p, double w)
+{
+ if (!m_ScMW || m_ScMW->scriptIsRunning())
+ return;
+ textEffects->UnderlineVal->LPos->showValue(p / 10.0);
+ textEffects->UnderlineVal->LWidth->showValue(w / 10.0);
+}
+
+void PropertyWidget_TextColor::handleUnderline()
+{
+ if ((m_doc) && (m_item))
+ {
+ int x = qRound(textEffects->UnderlineVal->LPos->value() * 10.0);
+ int y = qRound(textEffects->UnderlineVal->LWidth->value() * 10.0);
+ m_doc->itemSelection_SetUnderline(x, y);
+ }
+}
+
void PropertyWidget_TextColor::changeEvent(QEvent *e)
{
if (e->type() == QEvent::LanguageChange)
Modified: branches/ScribusOIF/scribus/ui/propertywidget_textcolor.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16093&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 02:08:18 2010
@@ -9,7 +9,13 @@
#include "ui_propertywidget_textcolorbase.h"
-class PropertyWidget_TextColor : public QFrame, public Ui::PropertyWidget_TextColorBase
+#include "propertywidgetbase.h"
+
+class ScribusDoc;
+class ScribusMainWindow;
+
+class PropertyWidget_TextColor : public QFrame, Ui::PropertyWidget_TextColorBase,
+ public PropertyWidgetBase
{
Q_OBJECT
@@ -19,10 +25,48 @@
virtual void changeEvent(QEvent *e);
+ void updateColorList();
+
+protected:
+ void connectSignals();
+ void disconnectSignals();
+
+ PageItem *m_item;
+ ScribusMainWindow* m_ScMW;
+
+ void setCurrentItem(PageItem *i);
+ void unsetItem();
+
public slots:
+ void setMainWindow(ScribusMainWindow *mw);
+
+ void setDoc(ScribusDoc *d);
+
+ void handleSelectionChanged();
void languageChange();
void unitChange() {};
+
+ void displayOutlineW(double x);
+ void displayShadowOffset(double x, double y);
+ void displayStrikeThru(double p, double w);
+ void displayTextColors(QString p, QString b, double shp, double shb);
+ void displayTextEffects(int s);
+ void displayUnderline(double p, double w);
+
+ void updateCharStyle(const CharStyle& charStyle);
+ void updateStyle(const ParagraphStyle& newCurrent);
+
+private slots:
+ void handleOutlineWidth();
+ void handleShadowOffs();
+ void handleStrikeThru();
+ void handleTextFill();
+ void handleTextShade();
+ void handleTextStroke();
+ void handleTextDirection();
+ void handleTypeStyle(int s);
+ void handleUnderline();
};
#endif
Modified: branches/ScribusOIF/win32/vc8/Scribus.vcproj
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=16093&path=/branches/ScribusOIF/win32/vc8/Scribus.vcproj
==============================================================================
--- branches/ScribusOIF/win32/vc8/Scribus.vcproj (original)
+++ branches/ScribusOIF/win32/vc8/Scribus.vcproj Wed Dec 15 02:08:18 2010
@@ -1539,6 +1539,10 @@
>
</File>
<File
+ RelativePath="..\..\scribus\ui\propertywidgetbase.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\scribus\pslib.cpp"
>
</File>
@@ -8516,6 +8520,10 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\..\scribus\ui\propertywidgetbase.h"
+ >
+ </File>
+ <File
RelativePath="..\..\scribus\pslib.h"
>
<FileConfiguration
More information about the scribus-commit
mailing list