Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 10354 → Rev 10355

/trunk/Scribus/scribus/smtextstylewidgets.h
File deleted
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: Scribus/scribus/smpstylew.ui
===================================================================
--- Scribus/scribus/smpstylew.ui (revision 10354)
+++ Scribus/scribus/smpstylew.ui (nonexistent)
@@ -1,238 +0,0 @@
-<ui version="4.0" >
- <class>PStyleW</class>
- <widget class="QWidget" name="PStyleW" >
- <property name="geometry" >
- <rect>
- <x>0</x>
- <y>0</y>
- <width>396</width>
- <height>373</height>
- </rect>
- </property>
- <property name="windowTitle" >
- <string>Form1</string>
- </property>
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>5</number>
- </property>
- <property name="spacing" >
- <number>5</number>
- </property>
- <item row="0" column="0" >
- <widget class="QTabWidget" name="tabWidget" >
- <widget class="QWidget" name="tab" >
- <attribute name="title" >
- <string>Properties</string>
- </attribute>
- <layout class="QGridLayout" >
- <property name="margin" >
- <number>5</number>
- </property>
- <property name="spacing" >
- <number>5</number>
- </property>
- <item row="4" column="0" >
- <widget class="Q3GroupBox" name="tabsBox" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>1</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title" >
- <string>Tabulators and Indentation</string>
- </property>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>5</number>
- </property>
- <item>
- <widget class="QLabel" name="parentLabel" >
- <property name="text" >
- <string>Based On:</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="parentCombo" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>1</hsizetype>
- <vsizetype>0</vsizetype>
- <horstretch>5</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="3" column="0" >
- <layout class="QHBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>5</number>
- </property>
- <item>
- <widget class="Q3GroupBox" name="distancesBox" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>1</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title" >
- <string>Distances and Alignment</string>
- </property>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
- <item>
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>2</number>
- </property>
- <item>
- <widget class="Q3GroupBox" name="dropCapsBox" >
- <property name="sizePolicy" >
- <sizepolicy>
- <hsizetype>5</hsizetype>
- <vsizetype>1</vsizetype>
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- <property name="title" >
- <string>Drop Caps</string>
- </property>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QToolButton" name="parentDropCapButton" >
- <property name="maximumSize" >
- <size>
- <width>32767</width>
- <height>20</height>
- </size>
- </property>
- <property name="text" >
- <string>Parent's Drop Cap Status</string>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- </layout>
- </item>
- <item row="0" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>360</width>
- <height>5</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="2" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>360</width>
- <height>5</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- <widget class="QWidget" name="TabPage" >
- <attribute name="title" >
- <string>Ch&amp;aracter Style</string>
- </attribute>
- <layout class="QVBoxLayout" >
- <property name="margin" >
- <number>0</number>
- </property>
- <property name="spacing" >
- <number>5</number>
- </property>
- <item>
- <widget class="Q3Frame" name="characterBox" >
- <property name="enabled" >
- <bool>false</bool>
- </property>
- <property name="frameShape" >
- <enum>QFrame::NoFrame</enum>
- </property>
- <property name="frameShadow" >
- <enum>QFrame::Plain</enum>
- </property>
- <property name="lineWidth" >
- <number>0</number>
- </property>
- </widget>
- </item>
- </layout>
- </widget>
- </widget>
- </item>
- </layout>
- </widget>
- <layoutdefault spacing="5" margin="5" />
- <customwidgets>
- <customwidget>
- <class>Q3Frame</class>
- <extends>QFrame</extends>
- <header>Qt3Support/Q3Frame</header>
- <container>1</container>
- </customwidget>
- <customwidget>
- <class>Q3GroupBox</class>
- <extends>QGroupBox</extends>
- <header>Qt3Support/Q3GroupBox</header>
- <container>1</container>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
/Scribus/scribus/smpstylew.ui
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: Scribus/scribus/smtextstylewidgets.cpp
===================================================================
--- Scribus/scribus/smtextstylewidgets.cpp (revision 10354)
+++ Scribus/scribus/smtextstylewidgets.cpp (nonexistent)
@@ -1,1158 +0,0 @@
-/*
-For general Scribus (>=1.3.2) copyright and licensing information please refer
-to the COPYING file provided with the program. Following this notice may exist
-a copyright and/or license notice that predates the release of Scribus 1.3.2
-for which a new license (GPL+exception) is in place.
-*/
-
-#include "smtextstylewidgets.h"
-#include "units.h"
-#include "util.h"
-#include "util_icon.h"
-#include "commonstrings.h"
-#include "smscrspinbox.h"
-#include "smsccombobox.h"
-#include "smcolorcombo.h"
-#include "smshadebutton.h"
-#include "smtabruler.h"
-#include "smspinbox.h"
-#include "smalignselect.h"
-
-
-static bool isEqual(double a, double b)
-{
- Q_ASSERT(a > -21473 && b > -21473 && a < 21474 && b < 21474);
- long al = static_cast<long>(10000 * a);
- long bl = static_cast<long>(10000 * b);
- return al == bl;
-}
-
-/******************************************************************************/
-/******************************************************************************/
-
-SMCStylePage::SMCStylePage(QWidget *parent) : QWidget()
-{
- setupUi(this);
-
- fontSize_->setMinimum(1.0);
- fontSize_->setMaximum(2048.0);
- fontSizeLabel_->setPixmap(loadIcon("Zeichen.xpm"));
-
- trackingLabel_->setPixmap( loadIcon("textkern.png") );
- tracking_->setMinimum(-300.0);
- tracking_->setMaximum(300.0);
- tracking_->setSuffix( tr( " %" ) );
-
- baselineOffsetLabel_->setPixmap( loadIcon("textbase.png") );
- baselineOffset_->setMinimum(-100.0);
- baselineOffset_->setMaximum(100.0);
- baselineOffset_->setSuffix( tr( " %" ) );
-
- hscaleLabel_->setPixmap( loadIcon("textscaleh.png") );
- fontHScale_->setMinimum(10.0);
- fontHScale_->setMaximum(400.0);
- fontHScale_->setSuffix( tr( " %" ) );
-
- vscaleLabel_->setPixmap( loadIcon("textscalev.png") );
- fontVScale_->setMinimum(10.0);
- fontVScale_->setMaximum(400.0);
- fontVScale_->setSuffix( tr( " %" ) );
-
- FillIcon->setPixmap(loadIcon("16/color-fill.png"));
- fillShadeLabel->setPixmap( loadIcon("shade.png") );
- StrokeIcon->setPixmap(loadIcon("16/color-stroke.png"));
- strokeShadeLabel->setPixmap( loadIcon("shade.png") );
-
- fillColor_->clear();
- strokeColor_->clear();
- ColorList::Iterator it;
- QPixmap pm = QPixmap(15, 15);
- fillColor_->insertItem(CommonStrings::tr_NoneColor);
- strokeColor_->insertItem(CommonStrings::tr_NoneColor);
- StrokeIcon->setEnabled(false);
- strokeShade_->setEnabled(false);
- strokeColor_->setEnabled(false);
-
- connect(effects_, SIGNAL(State(int)), this, SLOT(slotColorChange()));
-}
-
-void SMCStylePage::languageChange()
-{
-/***********************************/
-/* Begin Tooltips */
-/***********************************/
-// These are for the character style page
-// as in character styles and in paragraph style's character style
-
- QToolTip::add(parentCombo, tr("Parent style"));
- QToolTip::add(fontFace_, tr("Font face"));
- QToolTip::add(fontSize_, tr("Font size"));
- QToolTip::add(tracking_, tr("Tracking"));
- QToolTip::add(baselineOffset_, tr("Baseline offset"));
- QToolTip::add(fontHScale_, tr("Horizontal scaling"));
- QToolTip::add(fontVScale_, tr("Vertical scaling"));
- QToolTip::add(language_, tr("Language"));
- QToolTip::add(fillColor_, tr("Fill color"));
- QToolTip::add(fillShade_, tr("Fill shade"));
- QToolTip::add(strokeColor_, tr("Stroke color"));
- QToolTip::add(strokeShade_, tr("Stroke shade"));
-
-/***********************************/
-/* End Tooltips */
-/***********************************/
-
- parentLabel->setText( tr("Based On:"));
- languageLabel_->setText( tr("Language:"));
- fontVScale_->setSuffix( tr(" %"));
- fontHScale_->setSuffix( tr(" %"));
- baselineOffset_->setSuffix( tr(" %"));
- tracking_->setSuffix( tr(" %"));
- fontSize_->setSuffix(unitGetSuffixFromIndex(0));
-}
-
-void SMCStylePage::fillLangCombo(QMap<QString,QString> langMap)
-{
- QStringList sortList;
- QMap<QString,QString>::Iterator it;
-
- langMap_ = langMap;
-
- language_->clear();
-
- for (it = langMap.begin(); it != langMap.end(); ++it)
- sortList.push_back(it.data());
-
- language_->insertStringList(sortQStringList(sortList));
-
- QListView *tmpView = dynamic_cast<QListView*>(language_->view()); Q_ASSERT(tmpView);
- int tmpWidth = tmpView->sizeHintForColumn(0);
- if (tmpWidth > 0)
- tmpView->setMinimumWidth(tmpWidth + 24);
-}
-
-void SMCStylePage::fillColorCombo(ColorList &colors)
-{
- fillColor_->clear();
- strokeColor_->clear();
-
- fillColor_->insertItem(CommonStrings::tr_NoneColor);
- strokeColor_->insertItem(CommonStrings::tr_NoneColor);
- ColorList::Iterator itend=colors.end();
- ScribusDoc* doc = colors.document();
- for (ColorList::Iterator it = colors.begin(); it != itend; ++it)
- {
- fillColor_->insertSmallItem(it.data(), doc, it.key());
- strokeColor_->insertSmallItem(it.data(), doc, it.key());
- }
- fillColor_->view()->setMinimumWidth(fillColor_->view()->maximumViewportSize().width()+24);
- strokeColor_->view()->setMinimumWidth(strokeColor_->view()->maximumViewportSize().width()+24);
-}
-
-void SMCStylePage::show(CharStyle *cstyle, QList<CharStyle> &cstyles, const QString &defLang, int unitIndex)
-{
- disconnect(effects_, SIGNAL(State(int)), this, SLOT(slotColorChange()));
- parentCombo->setEnabled(true);
- const CharStyle *parent = dynamic_cast<const CharStyle*>(cstyle->parentStyle());
- bool hasParent = cstyle->hasParent() && parent != 0 && parent->hasName() && cstyle->parent() != "";
- if (hasParent)
- {
- fontSize_->setValue(cstyle->fontSize() / 10.0, cstyle->isInhFontSize());
- fontSize_->setParentValue(parent->fontSize() / 10.0);
-
- fontHScale_->setValue(cstyle->scaleH() / 10.0, cstyle->isInhScaleH());
- fontHScale_->setParentValue(parent->scaleH() / 10.0);
-
- fontVScale_->setValue(cstyle->scaleV() / 10.0, cstyle->isInhScaleV());
- fontVScale_->setParentValue(parent->scaleV() / 10.0);
-
- baselineOffset_->setValue(cstyle->baselineOffset() / 10.0, cstyle->isInhBaselineOffset());
- baselineOffset_->setParentValue(parent->baselineOffset() / 10.0);
-
- tracking_->setValue(cstyle->tracking() / 10.0, cstyle->isInhTracking());
- tracking_->setParentValue(parent->tracking() / 10.0);
-
- effects_->setStyle(static_cast<int>(cstyle->effects()), cstyle->isInhFeatures());
- effects_->setParentItem(static_cast<int>(parent->effects())); // FIXME
-
- fillShade_->setValue(qRound(cstyle->fillShade()), cstyle->isInhFillShade());
- fillShade_->setParentValue(qRound(parent->fillShade()));
-
- strokeShade_->setValue(qRound(cstyle->strokeShade()), cstyle->isInhStrokeShade());
- strokeShade_->setParentValue(qRound(parent->strokeShade()));
-
- fillColor_->setCurrentText(cstyle->fillColor(), cstyle->isInhFillColor());
- fillColor_->setParentText(parent->fillColor());
-
- strokeColor_->setCurrentText(cstyle->strokeColor(), cstyle->isInhStrokeColor());
- strokeColor_->setParentText(parent->strokeColor());
-
- fontFace_->setCurrentFont(cstyle->font().scName(), cstyle->isInhFont());
- fontFace_->setParentFont(parent->font().scName());
- }
- else
- {
- fontSize_->setValue(cstyle->fontSize() / 10.0);
- fontHScale_->setValue(cstyle->scaleH() / 10.0);
- fontVScale_->setValue(cstyle->scaleV() / 10.0);
- baselineOffset_->setValue(cstyle->baselineOffset() / 10.0);
- tracking_->setValue(cstyle->tracking() / 10.0);
- effects_->setStyle(static_cast<int>(cstyle->effects()));
- fillShade_->setValue(qRound(cstyle->fillShade()));
- strokeShade_->setValue(qRound(cstyle->strokeShade()));
- fillColor_->setCurrentText(cstyle->fillColor());
- strokeColor_->setCurrentText(cstyle->strokeColor());
- fontFace_->setCurrentFont(cstyle->font().scName());
- }
-
- effects_->ShadowVal->Xoffset->setValue(cstyle->shadowXOffset() / 10.0);
- effects_->ShadowVal->Yoffset->setValue(cstyle->shadowYOffset() / 10.0);
- effects_->OutlineVal->LWidth->setValue(cstyle->outlineWidth() / 10.0);
- effects_->StrikeVal->LPos->setValue(cstyle->strikethruOffset() / 10.0);
- effects_->StrikeVal->LWidth->setValue(cstyle->strikethruWidth() / 10.0);
- effects_->UnderlineVal->LPos->setValue(cstyle->underlineOffset() / 10.0);
- effects_->UnderlineVal->LWidth->setValue(cstyle->underlineWidth() / 10.0);
- slotColorChange();
-
- parentCombo->clear();
- parentCombo->insertItem("");
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (cstyles[i].name() != cstyle->name())
- parentCombo->insertItem(cstyles[i].name());
- }
-
- if (hasParent)
- {
- int index = 0;
- for (int i = 0; i < parentCombo->count(); ++i)
- {
- if (parentCombo->text(i) == cstyle->parentStyle()->name())
- {
- index = i;
- break;
- }
- }
- parentCombo->setCurrentItem(index);
- }
- else
- parentCombo->setCurrentItem(0);
-
- QString clang = cstyle->language().isNull() || cstyle->language().isEmpty() ?
- defLang : cstyle->language();
- QString plang(QString::null);
- if (hasParent)
- plang = parent->language().isNull() || parent->language().isEmpty() ?
- defLang : parent->language();
-
- int ci = -1, pi = -1, di = -1;
- for (int i = 0; i < language_->count(); ++i)
- {
- if (language_->text(i) == langMap_[clang])
- ci = i;
-
- if (hasParent && language_->text(i) == langMap_[plang])
- pi = i;
-
- if (language_->text(i) == defLang || language_->text(i) == langMap_[defLang])
- di = i;
- }
-
-// qDebug(QString("SMCStylePage::show(): deflan='%1'->'%2'").arg(defLang).arg(langMap_[defLang]));
- Q_ASSERT(di != -1);
-
- if (hasParent)
- {
- if (ci == -1)
- language_->setCurrentItem(di, cstyle->isInhLanguage());
- else
- language_->setCurrentItem(ci, cstyle->isInhLanguage());
-
- language_->setParentItem(pi);
- }
- else
- {
- if (ci == -1)
- language_->setCurrentItem(di);
- else
- language_->setCurrentItem(ci);
- }
-
- connect(effects_, SIGNAL(State(int)), this, SLOT(slotColorChange()));
-}
-
-void SMCStylePage::show(QList<CharStyle*> &cstyles, QList<CharStyle> &cstylesAll, const QString &defLang, int unitIndex)
-{
-// int decimals = unitGetDecimalsFromIndex(unitIndex);
-// QString suffix = unitGetSuffixFromIndex(unitIndex);
-
- if (cstyles.count() == 1)
- show(cstyles[0], cstylesAll, defLang, unitIndex);
- else if (cstyles.count() > 1)
- {
- showSizeAndPosition(cstyles);
- showEffects(cstyles);
- showColors(cstyles);
- showLanguage(cstyles, defLang);
- showParent(cstyles);
- }
-}
-
-void SMCStylePage::showSizeAndPosition(const QList<CharStyle*> &cstyles)
-{
- double d = -30000;
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (d != -30000 && cstyles[i]->fontSize() != d)
- {
- d = -30000;
- break;
- }
- else
- d = cstyles[i]->fontSize();
- }
- if (d == -30000)
- fontSize_->clear();
- else
- fontSize_->setValue(d / 10.0);
-
- d = -30000;
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (d != -30000 && cstyles[i]->scaleH() != d)
- {
- d = -30000;
- break;
- }
- else
- d = cstyles[i]->scaleH();
- }
- if (d == -30000)
- fontHScale_->clear();
- else
- fontHScale_->setValue(d / 10.0);
-
- d = -30000;
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (d != -30000 && cstyles[i]->scaleV() != d)
- {
- d = -30000;
- break;
- }
- else
- d = cstyles[i]->scaleV();
- }
- if (d == -30000)
- fontVScale_->clear();
- else
- fontVScale_->setValue(d / 10.0);
-
- d = -30000;
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (d != -30000 && cstyles[i]->baselineOffset() != d)
- {
- d = -30000;
- break;
- }
- else
- d = cstyles[i]->baselineOffset();
- }
- if (d == -30000)
- baselineOffset_->clear();
- else
- baselineOffset_->setValue(d / 10.0);
-
- d = -30000;
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (d != -30000 && cstyles[i]->tracking() != d)
- {
- d = -30000;
- break;
- }
- else
- d = cstyles[i]->tracking();
- }
- if (d == -30000)
- tracking_->clear();
- else
- tracking_->setValue(d / 10.0);
-}
-
-void SMCStylePage::showEffects(const QList<CharStyle*> &cstyles)
-{
- int d = -30000;
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (d != -30000 && static_cast<int>(cstyles[i]->effects()) != d)
- {
- d = -30000;
- break;
- }
- else
- d = static_cast<int>(cstyles[i]->effects());
- }
- if (d == -30000)
- effects_->setStyle(0);
- else
- effects_->setStyle(d);
-
-// TODO these things still missing:
-// effects_->ShadowVal->Xoffset->setValue(cstyle->shadowXOffset() / 10.0);
-// effects_->ShadowVal->Yoffset->setValue(cstyle->shadowYOffset() / 10.0);
-// effects_->OutlineVal->LWidth->setValue(cstyle->outlineWidth() / 10.0);
-// effects_->StrikeVal->LPos->setValue(cstyle->strikethruOffset() / 10.0);
-// effects_->StrikeVal->LWidth->setValue(cstyle->strikethruWidth() / 10.0);
-// effects_->UnderlineVal->LPos->setValue(cstyle->underlineOffset() / 10.0);
-// effects_->UnderlineVal->LWidth->setValue(cstyle->underlineWidth() / 10.0);
-}
-
-void SMCStylePage::showColors(const QList<CharStyle*> &cstyles)
-{
- strokeShade_->setEnabled(true);
- strokeColor_->setEnabled(true);
-
- double d = -30000;
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (d != -30000 && cstyles[i]->fillShade() != d)
- {
- d = -30000;
- break;
- }
- else
- d = cstyles[i]->fillShade();
- }
- if (d == -30000)
- fillShade_->setText( tr("Shade"));
- else
- fillShade_->setValue(qRound(d));
-
- d = -30000;
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (d != -30000 && cstyles[i]->strokeShade() != d)
- {
- d = -30000;
- break;
- }
- else
- d = cstyles[i]->strokeShade();
- }
- if (d == -30000)
- {
- strokeShade_->setValue(21);
- strokeShade_->setText( tr("Shade"));
- }
- else
- strokeShade_->setValue(qRound(d));
-
- QString s;
- QString emptyString;
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (!s.isNull() && s != cstyles[i]->fillColor())
- {
- s = emptyString;
- break;
- }
- else
- s = cstyles[i]->fillColor();
- }
- if (s.isEmpty())
- {
- if (fillColor_->text(fillColor_->count() - 1) != "")
- fillColor_->insertItem("");
- fillColor_->setCurrentItem(fillColor_->count() - 1);
- }
- else
- fillColor_->setCurrentText(s);
-
- s = emptyString;
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (!s.isNull() && s != cstyles[i]->strokeColor())
- {
- s = emptyString;
- break;
- }
- else
- s = cstyles[i]->strokeColor();
- }
- if (s.isEmpty())
- {
- if (strokeColor_->text(strokeColor_->count() - 1) != "")
- strokeColor_->insertItem("");
- strokeColor_->setCurrentItem(fillColor_->count() - 1);
- }
- else
- strokeColor_->setCurrentText(s);
-}
-
-void SMCStylePage::showLanguage(const QList<CharStyle*> &cstyles, const QString &defLang)
-{
- QString emptyString;
- QString s(cstyles[0]->language());
- for (int i = 0; i < cstyles.count(); ++i)
- {
- if (s != cstyles[i]->language())
- {
- s = emptyString;
- break;
- }
- else
- s = cstyles[i]->language();
- }
-
- if (s.isEmpty())
- {
- if (language_->text(language_->count() - 1) != "")
- language_->insertItem("");
- language_->setCurrentItem(language_->count() - 1);
- }
- else
- {
- Q_ASSERT(langMap_.contains(s));
- language_->setCurrentText(langMap_[s]);
- }
-}
-
-void SMCStylePage::showParent(const QList<CharStyle*> &cstyles)
-{
- parentCombo->setEnabled(false);
-}
-
-void SMCStylePage::clearAll()
-{
-
-}
-
-void SMCStylePage::slotColorChange()
-{
- int s = effects_->getStyle();
- bool enabled;
- if ((s & 4) || (s & 256))
- enabled = true;
- else
- enabled = false;
- StrokeIcon->setEnabled(enabled);
- strokeShade_->setEnabled(enabled);
- strokeColor_->setEnabled(enabled);
-}
-
-
-SMCStylePage::~SMCStylePage()
-{
-
-}
-
-/******************************************************************************/
-/******************************************************************************/
-
-SMPStyleWidget::SMPStyleWidget() : QWidget()
-{
- setupUi(this);
- setupDistances();
- setupDropCaps();
- setupTabs();
- setupCharStyle();
-}
-
-void SMPStyleWidget::setupDistances()
-{
-//qt4 distancesBox->setColumnLayout(0, Qt::Vertical );
-// distancesBox->layout()->setSpacing( 0 );
-// distancesBox->layout()->setMargin( 0 );
- distancesBoxLayout = new QGridLayout( distancesBox->layout() );
- distancesBoxLayout->setAlignment( Qt::AlignTop );
- distancesBoxLayout->setSpacing( 5 );
- distancesBoxLayout->setMargin( 10 );
-
- pixmapLabel0 = new QLabel(distancesBox, "pixmapLabel0");
- pixmapLabel0->setMinimumSize(QSize(22,22));
- pixmapLabel0->setMaximumSize(QSize(22,22));
- pixmapLabel0->setPixmap(loadIcon("linespacing2.png"));
- distancesBoxLayout->addWidget(pixmapLabel0, 0, 0);
-
- lineSpacingMode_ = new SMScComboBox(distancesBox, "linespacingCombo");
- lineSpacingMode_->insertItem( tr("Fixed Linespacing"));
- lineSpacingMode_->insertItem( tr("Automatic Linespacing"));
- lineSpacingMode_->insertItem( tr("Align to Baseline Grid"));
- distancesBoxLayout->addMultiCellWidget(lineSpacingMode_, 0, 0, 1, 2);
- connect(lineSpacingMode_, SIGNAL(highlighted(int)), this, SLOT(slotLineSpacingModeChanged(int)));
-
- lineSpacing_ = new SMScrSpinBox(1, 300, distancesBox, 1 );
- lineSpacing_->setSuffix(unitGetSuffixFromIndex(0));
- distancesBoxLayout->addWidget(lineSpacing_, 0, 3);
-
- pixmapLabel3 = new QLabel( "", distancesBox, "TextLabel1_2_2" );
- pixmapLabel3->setPixmap( loadIcon("above.png") );
- distancesBoxLayout->addWidget( pixmapLabel3, 1, 0 );
-
- spaceAbove_ = new SMScrSpinBox( 0, 300, distancesBox, 1 );
- spaceAbove_->setSuffix(unitGetSuffixFromIndex(0));
- distancesBoxLayout->addWidget( spaceAbove_, 1, 1 );
-
- pixmapLabel4 = new QLabel( "", distancesBox, "TextLabel1_2_3" );
- pixmapLabel4->setPixmap( loadIcon("below.png") );
- distancesBoxLayout->addWidget( pixmapLabel4, 2, 0 );
-
- spaceBelow_ = new SMScrSpinBox( 0, 300, distancesBox, 1 );
- spaceBelow_->setSuffix(unitGetSuffixFromIndex(0));
- distancesBoxLayout->addWidget( spaceBelow_, 2, 1 );
-
- alignement_ = new SMAlignSelect(distancesBox);
- distancesBoxLayout->addMultiCellWidget(alignement_, 3,3,0,3);
-}
-
-void SMPStyleWidget::slotLineSpacingModeChanged(int i)
-{
- lineSpacing_->setEnabled(i == 0);
-}
-
-void SMPStyleWidget::languageChange()
-{
-/***********************************/
-/* Begin Tooltips */
-/***********************************/
-// These are for the paragraph style
-
- QToolTip::add(parentCombo, tr("Parent Style"));
- QToolTip::add(lineSpacingMode_, tr("Line Spacing Mode"));
- QToolTip::add(lineSpacing_, tr("Line Spacing"));
- QToolTip::add(spaceAbove_, tr("Space Above"));
- QToolTip::add(spaceBelow_, tr("Space Below"));
- //CB Unneeded, gets in the way of single widget tooltips
- //QToolTip::add(dropCapsBox, tr("Enable or disable drop cap"));
- QToolTip::add(dropCapLines_, tr("Drop Cap Lines"));
- QToolTip::add(dropCapOffset_, tr("Drop Cap Offset"));
- QToolTip::add(alignement_, tr("Alignment"));
- QToolTip::add(tabList_->first_, tr("First Line Indent"));
- QToolTip::add(tabList_->left_, tr("Left Indent"));
- QToolTip::add(tabList_->right_, tr("Right Indent"));
- //CB Unneeded, gets in the way of single widget tooltips
- //QToolTip::add(tabList_, tr("Tabulators"));
-
-/***********************************/
-/* End Tooltips */
-/***********************************/
-
- lineSpacingMode_->clear();
- lineSpacingMode_->insertItem( tr("Fixed Linespacing"));
- lineSpacingMode_->insertItem( tr("Automatic Linespacing"));
- lineSpacingMode_->insertItem( tr("Align to Baseline Grid"));
- lineSpacing_->setSuffix(unitGetSuffixFromIndex(0));
- spaceAbove_->setSuffix(unitGetSuffixFromIndex(0));
- spaceBelow_->setSuffix(unitGetSuffixFromIndex(0));
- parentLabel->setText( tr("Based On:"));
- distancesBox->setTitle( tr("Distances and Alignment"));
- dropCapsBox->setTitle( tr("Drop Caps"));
- tabsBox->setTitle( tr("Tabulators and Indentation"));
- tabWidget->setTabLabel(tabWidget->page(0), tr("Properties"));
- tabWidget->setTabLabel(tabWidget->page(1), tr("Character Style"));
-}
-
-void SMPStyleWidget::unitChange(double oldRatio, double newRatio, int unitIndex)
-{
- spaceAbove_->setNewUnit(unitIndex);
- spaceBelow_->setNewUnit(unitIndex);
- dropCapOffset_->setNewUnit(unitIndex);
- tabList_->left_->setNewUnit(unitIndex);
- tabList_->right_->setNewUnit(unitIndex);
- tabList_->first_->setNewUnit(unitIndex);
-}
-
-void SMPStyleWidget::setupDropCaps()
-{
- dropCapsBox->setCheckable( true );
-//qt4 dropCapsBox->setColumnLayout(0, Qt::Vertical );
-// dropCapsBox->layout()->setSpacing( 5 );
-// dropCapsBox->layout()->setMargin( 10 );
-
- dropCapsBoxLayout = new QGridLayout(dropCapsBox->layout());
- dropCapsBoxLayout->setAlignment(Qt::AlignTop);
-
- dropCapLines_ = new SMSpinBox(dropCapsBox, "DropLines");
- dropCapLines_->setMinValue(2);
- dropCapLines_->setMaxValue(20);
- capLabel1 = new QLabel(dropCapLines_, tr("&Lines:"), dropCapsBox, "CapLabel");
- dropCapsBoxLayout->addWidget(capLabel1, 0, 0);
- dropCapsBoxLayout->addWidget(dropCapLines_, 0, 1);
-
- dropCapOffset_ = new SMScrSpinBox(-3000, 3000, dropCapsBox, 1);
- dropCapOffset_->setSuffix(unitGetSuffixFromIndex(0));
- capLabel2 = new QLabel(dropCapLines_, tr("Distance from Text:"), dropCapsBox, "CapLabel2");
- dropCapsBoxLayout->addWidget(capLabel2, 1, 0);
- dropCapsBoxLayout->addWidget(dropCapOffset_, 1, 1);
-}
-
-void SMPStyleWidget::setupTabs()
-{
-//qt4 tabsBox->setColumnLayout(0, Qt::Vertical );
-// tabsBox->layout()->setSpacing( 0 );
-// tabsBox->layout()->setMargin( 0 );
-
- tabsBoxLayout = new QVBoxLayout(tabsBox->layout());
- tabsBoxLayout->setAlignment( Qt::AlignTop );
- tabsBoxLayout->setSpacing( 5 );
- tabsBoxLayout->setMargin( 10 );
-
- tabList_ = new SMTabruler(tabsBox);
- tabsBoxLayout->addWidget( tabList_ );
-}
-
-void SMPStyleWidget::setupCharStyle()
-{
- QHBoxLayout *la = new QHBoxLayout(characterBox, 0, 0, "la");
- cpage = new SMCStylePage(characterBox);
- la->addWidget(cpage);
- characterBox->setEnabled(true);
-}
-
-void SMPStyleWidget::show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles, QList<CharStyle> &cstyles, int unitIndex, const QString &defLang)
-{
- double unitRatio = unitGetRatioFromIndex(unitIndex);
- parentCombo->setEnabled(true);
- const ParagraphStyle *parent = dynamic_cast<const ParagraphStyle*>(pstyle->parentStyle());
- hasParent_ = pstyle->hasParent() && parent != NULL && parent->hasName() && pstyle->parent() != "";
-
- lineSpacingMode_->clear();
- lineSpacingMode_->insertItem( tr("Fixed Linespacing"));
- lineSpacingMode_->insertItem( tr("Automatic Linespacing"));
- lineSpacingMode_->insertItem( tr("Align to Baseline Grid"));
-
- if (hasParent_)
- {
- lineSpacingMode_->setCurrentItem(pstyle->lineSpacingMode(), pstyle->isInhLineSpacingMode());
- lineSpacingMode_->setParentItem(parent->lineSpacingMode());
-
- lineSpacing_->setValue(pstyle->lineSpacing(), pstyle->isInhLineSpacing());
- lineSpacing_->setParentValue(parent->lineSpacing());
-
- spaceAbove_->setValue(pstyle->gapBefore() * unitRatio, pstyle->isInhGapBefore());
- spaceAbove_->setParentValue(parent->gapBefore() * unitRatio);
-
- spaceBelow_->setValue(pstyle->gapAfter() * unitRatio, pstyle->isInhGapAfter());
- spaceBelow_->setParentValue(parent->gapAfter() * unitRatio);
-
- dropCapsBox->setChecked(pstyle->hasDropCap());;
- parentDropCap_ = parent->hasDropCap();
- if (pstyle->isInhHasDropCap())
- parentDropCapButton->hide();
- else
- parentDropCapButton->show();
-
- connect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
-
- dropCapLines_->setValue(pstyle->dropCapLines(), pstyle->isInhDropCapLines());
- dropCapLines_->setParentValue(parent->dropCapLines());
-
- dropCapOffset_->setValue(pstyle->dropCapOffset() * unitRatio, pstyle->isInhDropCapOffset());
- dropCapOffset_->setParentValue(parent->dropCapOffset() * unitRatio);
-
- alignement_->setStyle(pstyle->alignment(), pstyle->isInhAlignment());
- alignement_->setParentItem(parent->alignment());
-
- bool hasParentTabs = pstyle->isInhTabValues();
- QList<ParagraphStyle::TabRecord> tabs;
- if (hasParentTabs)
- tabs = QList<ParagraphStyle::TabRecord>(parent->tabValues());
- else
- tabs = pstyle->tabValues();
-
- tabList_->setTabs(tabs, unitIndex, hasParentTabs);
- tabList_->setParentTabs(parent->tabValues());
-
- tabList_->setLeftIndentValue(pstyle->leftMargin() * unitRatio,pstyle->isInhLeftMargin());
- tabList_->setParentLeftIndent(parent->leftMargin() * unitRatio);
-
- tabList_->setFirstLineValue(pstyle->firstIndent() * unitRatio, pstyle->isInhFirstIndent());
- tabList_->setParentFirstLine(parent->firstIndent() * unitRatio);
-
- tabList_->setRightIndentValue(pstyle->rightMargin() * unitRatio, pstyle->isInhRightMargin());
- tabList_->setParentRightIndent(parent->rightMargin() * unitRatio);
- }
- else
- {
- lineSpacingMode_->setCurrentItem(pstyle->lineSpacingMode());
- lineSpacing_->setValue(pstyle->lineSpacing());
- spaceAbove_->setValue(pstyle->gapBefore() * unitRatio);
- spaceBelow_->setValue(pstyle->gapAfter() * unitRatio);
- dropCapsBox->setChecked(pstyle->hasDropCap());
- parentDropCapButton->hide();
- disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
- dropCapLines_->setValue(pstyle->dropCapLines());
- dropCapOffset_->setValue(pstyle->dropCapOffset() * unitRatio);
- parentDropCapButton->hide();
- alignement_->setStyle(pstyle->alignment());
- tabList_->setTabs(pstyle->tabValues(), unitIndex);
- tabList_->setLeftIndentValue(pstyle->leftMargin() * unitRatio);
- tabList_->setFirstLineValue(pstyle->firstIndent() * unitRatio);
- tabList_->setRightIndentValue(pstyle->rightMargin() * unitRatio);
- }
-
- lineSpacing_->setEnabled(pstyle->lineSpacingMode() == ParagraphStyle::FixedLineSpacing);
- dropCapLines_->setEnabled(pstyle->hasDropCap());
- dropCapOffset_->setEnabled(pstyle->hasDropCap());
-
- QFont f(font());
- f.setBold(true);
- parentDropCapButton->setFont(f);
-
- cpage->parentLabel->setText( tr("Based On:"));
- cpage->show(&pstyle->charStyle(), cstyles, defLang, unitIndex);
-
- parentCombo->clear();
- parentCombo->insertItem("");
-
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (pstyles[i].hasName() && pstyles[i].name() != pstyle->name())
- parentCombo->insertItem(pstyles[i].name());
- }
-
- if (hasParent_)
- {
- int index = 0;
- for (int i = 0; i < parentCombo->count(); ++i)
- {
- if (parentCombo->text(i) == parent->name())
- {
- index = i;
- break;
- }
- }
- parentCombo->setCurrentItem(index);
- }
- else
- parentCombo->setCurrentItem(0);
-
- connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
-}
-
-void SMPStyleWidget::show(QList<ParagraphStyle*> &pstyles, QList<ParagraphStyle> &pstylesAll, QList<CharStyle> &cstyles, int unitIndex, const QString &defLang)
-{
- if (pstyles.count() == 1)
- show(pstyles[0], pstylesAll, cstyles, unitIndex, defLang);
- else if (pstyles.count() > 1)
- {
- showLineSpacing(pstyles);
- showSpaceAB(pstyles, unitIndex);
- showDropCap(pstyles, unitIndex);
- showAlignment(pstyles);
- showTabs(pstyles, unitIndex);
- showCStyle(pstyles, cstyles, defLang, unitIndex);
- showParent(pstyles);
- }
-}
-
-void SMPStyleWidget::showLineSpacing(QList<ParagraphStyle*> &pstyles)
-{
- lineSpacingMode_->clear();
- lineSpacingMode_->insertItem( tr("Fixed Linespacing"));
- lineSpacingMode_->insertItem( tr("Automatic Linespacing"));
- lineSpacingMode_->insertItem( tr("Align to Baseline Grid"));
-
- int tmpLP = -1;
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (tmpLP != -1 && pstyles[i]->lineSpacingMode() != tmpLP)
- {
- tmpLP = -1;
- break;
- }
- else
- tmpLP = pstyles[i]->lineSpacingMode();
- }
-
- if (tmpLP == -1)
- {
- if (lineSpacingMode_->text(lineSpacingMode_->count() - 1) != "")
- lineSpacingMode_->insertItem("");
- lineSpacingMode_->setCurrentItem(lineSpacingMode_->count() - 1);
- }
- else
- lineSpacingMode_->setCurrentItem(tmpLP);
-
- double tmpLS = -1.0;
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (tmpLS > 0 && !isEqual(pstyles[i]->lineSpacing(), tmpLS))
- {
- tmpLS = -1.0;
- break;
- }
- else
- tmpLS = pstyles[i]->lineSpacing();
- }
- lineSpacing_->setEnabled(true);
- if (tmpLS < 0)
- lineSpacing_->clear();
- else
- lineSpacing_->setValue(tmpLS);
-}
-
-void SMPStyleWidget::showSpaceAB(QList<ParagraphStyle*> &pstyles, int unitIndex)
-{
- double unitRatio = unitGetRatioFromIndex(unitIndex);
- double tmpA = -1.2;
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (tmpA > -1.0 && !isEqual(pstyles[i]->gapBefore(), tmpA))
- {
- tmpA = -1.2;
- break;
- }
- else
- tmpA = pstyles[i]->gapBefore();
- }
-
- if (tmpA < 0)
- spaceAbove_->clear();
- else
- spaceAbove_->setValue(tmpA * unitRatio);
-
- tmpA = -1.2;
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (tmpA > -1.0 && !isEqual(pstyles[i]->gapAfter(), tmpA))
- {
- tmpA = -1.2;
- break;
- }
- }
-
- if (tmpA < 0)
- spaceBelow_->clear();
- else
- spaceBelow_->setValue(tmpA * unitRatio);
-}
-
-void SMPStyleWidget::showDropCap(QList<ParagraphStyle*> &pstyles, int unitIndex)
-{
- double unitRatio = unitGetRatioFromIndex(unitIndex);
- parentDropCapButton->hide();
- disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
-
- bool dc = pstyles[0]->hasDropCap();
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (dc != pstyles[i]->hasDropCap())
- {
- dc = false;
- break;
- }
- }
- dropCapsBox->setChecked(dc);
-
- int lines = -1;
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (lines > -1 && pstyles[i]->dropCapLines() != lines)
- {
- lines = -1;
- break;
- }
- else
- lines = pstyles[i]->dropCapLines();
- }
- if (lines == -1)
- dropCapLines_->clear();
- else
- dropCapLines_->setValue(lines);
-
- double dco = -4000.0;
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (dco > -3980.0 && !isEqual(pstyles[i]->dropCapOffset(), dco))
- {
- dco = -4000.0;
- break;
- }
- else
- dco = pstyles[i]->dropCapOffset();
- }
-
- if (dco < -3800.0)
- dropCapOffset_->clear();
- else
- dropCapOffset_->setValue(dco * unitRatio);
-
- connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
- dropCapsBox->setEnabled(true);
- dropCapLines_->setEnabled(true);
- dropCapOffset_->setEnabled(true);
-}
-
-void SMPStyleWidget::showAlignment(QList<ParagraphStyle*> &pstyles)
-{
- ParagraphStyle::AlignmentType a = pstyles[0]->alignment();
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (a != pstyles[i]->alignment())
- {
- if (alignement_->selectedId() > -1)
- {
- alignement_->buttonGroup->setExclusive(false);
- alignement_->buttonGroup->button(alignement_->selectedId())->toggle();
- alignement_->buttonGroup->setExclusive(true);
- }
- return;
- }
- }
- alignement_->setStyle(a);
-}
-
-void SMPStyleWidget::showTabs(QList<ParagraphStyle*> &pstyles, int unitIndex)
-{
- double unitRatio = unitGetRatioFromIndex(unitIndex);
- QList<ParagraphStyle::TabRecord> t = pstyles[0]->tabValues();
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (t != pstyles[i]->tabValues())
- {
- t = QList<ParagraphStyle::TabRecord>();
- break;
- }
- }
- tabList_->setTabs(t, unitIndex);
-
- double l = -4000.0;
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (l > -3800.0 && !isEqual(pstyles[i]->leftMargin(), l))
- {
- l = -4000.0;
- break;
- }
- else
- l = pstyles[i]->leftMargin();
- }
- if (l < -3800.0)
- {
- tabList_->setLeftIndentValue(0.0);
- tabList_->left_->clear();
- }
- else
- tabList_->setLeftIndentValue(l * unitRatio);
-
- l = -4000.0;
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (l > -3800.0 && !isEqual(pstyles[i]->firstIndent(), l))
- {
- l = -4000.0;
- break;
- }
- else
- l = pstyles[i]->firstIndent();
- }
- if (l < -3800.0)
- {
- tabList_->setFirstLineValue(0.0);
- tabList_->first_->clear();
- }
- else
- tabList_->setFirstLineValue(l * unitRatio);
-
- l = -4000.0;
- for (int i = 0; i < pstyles.count(); ++i)
- {
- if (l > -3800.0 && !isEqual(pstyles[i]->rightMargin(), l))
- {
- l = -4000.0;
- break;
- }
- else
- l = pstyles[i]->rightMargin();
- }
- if (l < -3800.0)
- {
- tabList_->setRightIndentData(0.0);
- tabList_->right_->clear();
- }
- else
- tabList_->setRightIndentValue(l * unitRatio);
-
-}
-
-void SMPStyleWidget::showCStyle(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, const QString &defLang, int unitIndex)
-{
- cpage->parentLabel->setText( tr("Based On:"));
-
- QList<CharStyle*> cstyle;
- for (int i = 0; i < pstyles.count(); ++i)
- cstyle << &pstyles[i]->charStyle();
-
- cpage->show(cstyle, cstyles, defLang, unitIndex);
-}
-
-void SMPStyleWidget::showParent(QList<ParagraphStyle*> &pstyles)
-{
- parentCombo->setEnabled(false);
-
-// parentCombo->clear();
-// parentCombo->insertItem("");
-// for (uint i = 0; i < pstyles.count(); ++i)
-// {
-// if (pstyles[i].hasName() && pstyles[i].name() != pstyle->name())
-// parentCombo->insertItem(pstyles[i].name());
-// }
-//
-// if (hasParent_)
-// {
-// int index = 0;
-// for (int i = 0; i < parentCombo->count(); ++i)
-// {
-// if (parentCombo->text(i) == parent->name())
-// {
-// index = i;
-// break;
-// }
-// }
-// parentCombo->setCurrentItem(index);
-// }
-// else
-// parentCombo->setCurrentItem(0);
-}
-
-void SMPStyleWidget::clearAll()
-{
-
-}
-
-void SMPStyleWidget::slotDropCap(bool isOn)
-{
- if (isOn)
- {
- dropCapsBox->setEnabled(true);
- dropCapLines_->setEnabled(true);
- dropCapOffset_->setEnabled(true);
- }
- else
- {
- dropCapsBox->setEnabled(true);
- dropCapLines_->setEnabled(false);
- dropCapOffset_->setEnabled(false);
- }
- if (hasParent_)
- parentDropCapButton->show();
-}
-
-void SMPStyleWidget::slotParentDropCap()
-{
- disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
- disconnect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
- parentDropCapButton->hide();
- dropCapsBox->setChecked(parentDropCap_);
- emit useParentDropCap();
- connect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
- connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
-}
-
-SMPStyleWidget::~SMPStyleWidget()
-{
-
-}
-
/Scribus/scribus/smtextstylewidgets.cpp
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: Scribus/scribus/smcstylew.ui
===================================================================
--- Scribus/scribus/smcstylew.ui (revision 10354)
+++ Scribus/scribus/smcstylew.ui (nonexistent)
@@ -1,413 +0,0 @@
-<ui version="4.0" >
- <class>CStyleP</class>
- <widget class="QWidget" name="CStyleP" >
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>503</width>
- <height>16</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="0" >
- <layout class="QHBoxLayout" >
- <property name="spacing" >
- <number>6</number>
- </property>
- <property name="leftMargin" >
- <number>0</number>
- </property>
- <property name="topMargin" >
- <number>0</number>
- </property>
- <property name="rightMargin" >
- <number>0</number>
- </property>
- <property name="bottomMargin" >
- <number>0</number>
- </property>
- <item>
- <widget class="QLabel" name="parentLabel" >
- <property name="text" >
- <string>Based On:</string>
- </property>
- <property name="wordWrap" >
- <bool>false</bool>
- </property>
- </widget>
- </item>
- <item>
- <widget class="QComboBox" name="parentCombo" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
- <horstretch>5</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- </layout>
- </item>
- <item row="2" column="0" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Vertical</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Fixed</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>421</width>
- <height>16</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="3" column="0" >
- <widget class="QGroupBox" name="basicGroup" >
- <property name="title" >
- <string>Basic Formatting</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="SMFontComboH" name="fontFace_" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item row="1" column="0" >
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="fontSizeLabel_" >
- <property name="minimumSize" >
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SMScrSpinBox" name="fontSize_" />
- </item>
- <item>
- <widget class="QLabel" name="trackingLabel_" >
- <property name="minimumSize" >
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SMScrSpinBox" name="tracking_" />
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item row="2" column="0" >
- <layout class="QHBoxLayout" >
- <item>
- <widget class="SMStyleSelect" name="effects_" >
- <property name="sizePolicy" >
- <sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
- <horstretch>0</horstretch>
- <verstretch>0</verstretch>
- </sizepolicy>
- </property>
- </widget>
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeType" >
- <enum>QSizePolicy::Expanding</enum>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="4" column="0" >
- <widget class="QGroupBox" name="advGroup" >
- <property name="title" >
- <string>Advanced Formatting</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="hscaleLabel_" >
- <property name="maximumSize" >
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="text" >
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SMScrSpinBox" name="fontHScale_" />
- </item>
- <item>
- <widget class="QLabel" name="vscaleLabel_" >
- <property name="maximumSize" >
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="text" >
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SMScrSpinBox" name="fontVScale_" />
- </item>
- <item>
- <widget class="QLabel" name="baselineOffsetLabel_" >
- <property name="maximumSize" >
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="text" >
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SMScrSpinBox" name="baselineOffset_" />
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- <item row="1" column="0" >
- <layout class="QHBoxLayout" >
- <item>
- <widget class="QLabel" name="languageLabel_" >
- <property name="text" >
- <string>Language:</string>
- </property>
- </widget>
- </item>
- <item>
- <widget class="SMScComboBox" name="language_" />
- </item>
- <item>
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </item>
- </layout>
- </widget>
- </item>
- <item row="5" column="0" >
- <widget class="QGroupBox" name="smColorGroup" >
- <property name="title" >
- <string>Colors</string>
- </property>
- <layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QLabel" name="FillIcon" >
- <property name="maximumSize" >
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="text" >
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="SMColorCombo" name="fillColor_" />
- </item>
- <item row="0" column="2" >
- <widget class="QLabel" name="fillShadeLabel" >
- <property name="maximumSize" >
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="text" >
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="0" column="3" >
- <widget class="SMShadeButton" name="fillShade_" >
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- <item row="0" column="4" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- <item row="1" column="0" >
- <widget class="QLabel" name="StrokeIcon" >
- <property name="maximumSize" >
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="text" >
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1" >
- <widget class="SMColorCombo" name="strokeColor_" />
- </item>
- <item row="1" column="2" >
- <widget class="QLabel" name="strokeShadeLabel" >
- <property name="maximumSize" >
- <size>
- <width>22</width>
- <height>22</height>
- </size>
- </property>
- <property name="text" >
- <string>TextLabel</string>
- </property>
- </widget>
- </item>
- <item row="1" column="3" >
- <widget class="SMShadeButton" name="strokeShade_" >
- <property name="text" >
- <string/>
- </property>
- </widget>
- </item>
- <item row="1" column="4" >
- <spacer>
- <property name="orientation" >
- <enum>Qt::Horizontal</enum>
- </property>
- <property name="sizeHint" >
- <size>
- <width>40</width>
- <height>20</height>
- </size>
- </property>
- </spacer>
- </item>
- </layout>
- </widget>
- </item>
- </layout>
- </widget>
- <layoutdefault spacing="6" margin="11" />
- <customwidgets>
- <customwidget>
- <class>SMFontComboH</class>
- <extends>QComboBox</extends>
- <header>smfontcomboh.h</header>
- </customwidget>
- <customwidget>
- <class>SMScrSpinBox</class>
- <extends>QSpinBox</extends>
- <header>smscrspinbox.h</header>
- </customwidget>
- <customwidget>
- <class>SMStyleSelect</class>
- <extends>QLineEdit</extends>
- <header>smstyleselect.h</header>
- </customwidget>
- <customwidget>
- <class>SMScComboBox</class>
- <extends>QComboBox</extends>
- <header>smsccombobox.h</header>
- </customwidget>
- <customwidget>
- <class>SMColorCombo</class>
- <extends>QComboBox</extends>
- <header>smcolorcombo.h</header>
- </customwidget>
- <customwidget>
- <class>SMShadeButton</class>
- <extends>QPushButton</extends>
- <header>smshadebutton.h</header>
- </customwidget>
- </customwidgets>
- <resources/>
- <connections/>
-</ui>
/Scribus/scribus/smcstylew.ui
Property changes:
Deleted: svn:eol-style
## -1 +0,0 ##
-native
\ No newline at end of property
Deleted: svn:keywords
## -1 +0,0 ##
-Author Date Id Revision
\ No newline at end of property
Index: Scribus/scribus/stylemanager.cpp
===================================================================
--- Scribus/scribus/stylemanager.cpp (revision 10354)
+++ Scribus/scribus/stylemanager.cpp (revision 10355)
@@ -22,6 +22,7 @@
#include "customfdialog.h"
#include "smtextstyles.h"
#include "smlinestyle.h"
+#include "smlinestylewidget.h"
#include "smstyleimport.h"
#include "fileloader.h"
#include "scraction.h"
@@ -29,7 +30,9 @@
const QString StyleManager::SEPARATOR = "$$$$"; // dumb but it works
-StyleManager::StyleManager(QWidget *parent, const char *name) : ScrPaletteBase(parent, name), item_(0), widget_(0), shortcutWidget_(0), currentType_(QString::null), isEditMode_(true), doc_(0)
+StyleManager::StyleManager(QWidget *parent, const char *name)
+ : ScrPaletteBase(parent, name), item_(0), widget_(0),
+ shortcutWidget_(0), currentType_(QString::null), isEditMode_(true), doc_(0)
{
setupUi(this);
splitter->setMinimumWidth(0);
/trunk/Scribus/scribus/stylemanager.ui
9,9 → 9,15
<x>0</x>
<y>0</y>
<width>682</width>
<height>461</height>
<height>531</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>0</width>
40,19 → 46,19
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
<number>5</number>
</property>
<property name="leftMargin" >
<number>0</number>
<number>6</number>
</property>
<property name="topMargin" >
<number>0</number>
<number>6</number>
</property>
<property name="rightMargin" >
<number>0</number>
<number>6</number>
</property>
<property name="bottomMargin" >
<number>0</number>
<number>6</number>
</property>
<item>
<spacer>
244,6 → 250,24
<enum>QFrame::Plain</enum>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>6</number>
</property>
<property name="topMargin" >
<number>6</number>
</property>
<property name="rightMargin" >
<number>6</number>
</property>
<property name="bottomMargin" >
<number>6</number>
</property>
<property name="horizontalSpacing" >
<number>5</number>
</property>
<property name="verticalSpacing" >
<number>5</number>
</property>
<item row="0" column="0" >
<widget class="StyleView" name="styleView" >
<property name="contextMenuPolicy" >
557,22 → 581,6
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" >
<size>
<width>31</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QFrame" name="mainFrame" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
580,15 → 588,6
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth" >
<number>0</number>
</property>
</widget>
</item>
</layout>
/trunk/Scribus/scribus/smcstylewidget.ui
0,0 → 1,431
<ui version="4.0" >
<class>SMCStyleWidget</class>
<widget class="QWidget" name="SMCStyleWidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>521</width>
<height>511</height>
</rect>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QLabel" name="parentLabel" >
<property name="text" >
<string>Based On:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="parentCombo" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>5</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QGroupBox" name="basicGroup" >
<property name="title" >
<string>Basic Formatting</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="SMFontComboH" native="1" name="fontFace_" >
<property name="sizePolicy" >
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>30</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" colspan="2" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="fontSizeLabel_" >
<property name="minimumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="SMScrSpinBox" name="fontSize_" />
</item>
<item>
<widget class="QLabel" name="trackingLabel_" >
<property name="minimumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<widget class="SMScrSpinBox" name="tracking_" />
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="0" >
<widget class="SMStyleSelect" native="1" name="effects_" >
<property name="sizePolicy" >
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize" >
<size>
<width>30</width>
<height>0</height>
</size>
</property>
</widget>
</item>
<item row="2" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="2" column="0" >
<widget class="QGroupBox" name="advGroup" >
<property name="title" >
<string>Advanced Formatting</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="hscaleLabel_" >
<property name="maximumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="SMScrSpinBox" name="fontHScale_" />
</item>
<item>
<widget class="QLabel" name="vscaleLabel_" >
<property name="maximumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="SMScrSpinBox" name="fontVScale_" />
</item>
<item>
<widget class="QLabel" name="baselineOffsetLabel_" >
<property name="maximumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item>
<widget class="SMScrSpinBox" name="baselineOffset_" />
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0" >
<layout class="QHBoxLayout" >
<item>
<widget class="QLabel" name="languageLabel_" >
<property name="text" >
<string>Language:</string>
</property>
</widget>
</item>
<item>
<widget class="SMScComboBox" name="language_" />
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="3" column="0" >
<widget class="QGroupBox" name="smColorGroup" >
<property name="title" >
<string>Colors</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="FillIcon" >
<property name="maximumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="SMColorCombo" name="fillColor_" />
</item>
<item row="0" column="2" >
<widget class="QLabel" name="fillShadeLabel" >
<property name="maximumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="3" >
<widget class="SMShadeButton" name="fillShade_" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="0" column="4" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="StrokeIcon" >
<property name="maximumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="SMColorCombo" name="strokeColor_" />
</item>
<item row="1" column="2" >
<widget class="QLabel" name="strokeShadeLabel" >
<property name="maximumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="3" >
<widget class="SMShadeButton" name="strokeShade_" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item row="1" column="4" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<customwidgets>
<customwidget>
<class>SMScComboBox</class>
<extends>QComboBox</extends>
<header>smsccombobox.h</header>
</customwidget>
<customwidget>
<class>SMScrSpinBox</class>
<extends>QSpinBox</extends>
<header>smscrspinbox.h</header>
</customwidget>
<customwidget>
<class>SMColorCombo</class>
<extends>QComboBox</extends>
<header>smcolorcombo.h</header>
</customwidget>
<customwidget>
<class>SMShadeButton</class>
<extends>QPushButton</extends>
<header>smshadebutton.h</header>
</customwidget>
<customwidget>
<class>SMFontComboH</class>
<extends>QWidget</extends>
<header>smfontcomboh.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>SMStyleSelect</class>
<extends>QWidget</extends>
<header>smstyleselect.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
/trunk/Scribus/scribus/smcstylewidget.h
0,0 → 1,46
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#ifndef SMCSTYLEWIDGET_H
#define SMCSTYLEWIDGET_H
 
#include "ui_smcstylewidget.h"
 
// #include "styles/styleset.h"
 
 
class SMCStyleWidget : public QWidget, public Ui::SMCStyleWidget
{
Q_OBJECT
public:
SMCStyleWidget(QWidget *parent = 0);
~SMCStyleWidget();
 
void show(CharStyle *cstyle, QList<CharStyle> &cstyles, const QString &defLang, int unitIndex);
void show(QList<CharStyle*> &cstyles, QList<CharStyle> &cstylesAll, const QString &defLang, int unitIndex);
void fillLangCombo(QMap<QString,QString> langMap);
void fillColorCombo(ColorList &colors);
void languageChange();
void clearAll();
 
private:
QMap<QString, QString> langMap_;
 
void showSizeAndPosition(const QList<CharStyle*> &cstyles);
void showEffects(const QList<CharStyle*> &cstyles);
void showColors(const QList<CharStyle*> &cstyles);
void showLanguage(const QList<CharStyle*> &cstyles, const QString &defLang);
void showParent(const QList<CharStyle*> &cstyles);
 
friend class SMParagraphStyle;
friend class SMCharacterStyle;
 
private slots:
void slotColorChange();
};
 
#endif
/trunk/Scribus/scribus/smlinestylewidget.cpp
0,0 → 1,178
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#include <QToolTip>
 
#include "smlinestylewidget.h"
#include "colorcombo.h"
#include "linecombo.h"
#include "sccolorengine.h"
#include "scrspinbox.h"
#include "util_color.h"
#include "util_icon.h"
 
 
SMLineStyleWidget::SMLineStyleWidget() : QWidget()
{
setupUi(this);
addButton->setPixmap(loadIcon("penciladd.png"));
removeButton->setPixmap(loadIcon("pencilsub.png"));
 
dashCombo = new LineCombo(this);
gridLayout->addWidget(dashCombo, 0, 0);
 
lineWidth = new ScrSpinBox( 0, 300, this, 0 );
gridLayout1->addWidget(lineWidth, 0, 1);
colorCombo = new ColorCombo(this);
gridLayout1->addWidget(colorCombo, 1, 0);
 
endCombo->insertItem(loadIcon("ButtCap.png"), tr( "Flat Cap" ) );
endCombo->insertItem(loadIcon("SquareCap.png"), tr( "Square Cap" ) );
endCombo->insertItem(loadIcon("RoundCap.png"), tr( "Round Cap" ) );
 
joinCombo->insertItem(loadIcon("MiterJoin.png"), tr( "Miter Join" ) );
joinCombo->insertItem(loadIcon("BevelJoin.png"), tr( "Bevel Join" ) );
joinCombo->insertItem(loadIcon("RoundJoin.png"), tr( "Round Join" ) );
 
languageChange();
}
 
void SMLineStyleWidget::languageChange()
{
/***********************************/
/* Begin Tooltips */
/***********************************/
// These are for the line style page
 
QToolTip::add(addButton, tr("Add a new line"));
QToolTip::add(removeButton, tr("Remove a line"));
QToolTip::add(dashCombo, tr("Line style"));
QToolTip::add(lineWidth, tr("Line width"));
QToolTip::add(endCombo, tr("End style"));
QToolTip::add(joinCombo, tr("Join style"));
QToolTip::add(colorCombo, tr("Line color"));
QToolTip::add(shadeBox, tr("Line shade"));
 
/***********************************/
/* End Tooltips */
/***********************************/
 
 
}
 
void SMLineStyleWidget::showStyle(const multiLine &lineStyle, ColorList &colorList, int subLine)
{
// disconnect(lineStyles, SIGNAL(highlighted(int)), this, SLOT(slotEditNewLine(int)));
disconnect(lineStyles, SIGNAL(currentRowChanged(int)), this, SLOT(slotEditNewLine(int)));
currentStyle = lineStyle;
colorCombo->clear();
ColorList::Iterator it;
ScribusDoc* doc = colorList.document();
for (it = colorList.begin(); it != colorList.end(); ++it)
colorCombo->insertWideItem(colorList[it.key()], doc, it.key());
colors = colorList;
updateLineList();
slotEditNewLine(subLine);
connect(lineStyles, SIGNAL(currentRowChanged(int)), this, SLOT(slotEditNewLine(int)));
}
 
void SMLineStyleWidget::slotEditNewLine(int i)
{
lineStyles->setCurrentRow(i);
// lineStyles->setSelected(i, true);
//currentLine_ = i;
 
// JG #5876 protect against broken line styles
if (currentStyle.count() <= i)
return;
 
lineWidth->setValue(currentStyle[i].Width);
colorCombo->setCurrentText(currentStyle[i].Color);
shadeBox->setValue(currentStyle[i].Shade);
switch (static_cast<Qt::PenStyle>(currentStyle[i].Dash))
{
case Qt::SolidLine:
dashCombo->setCurrentItem(0);
break;
case Qt::DashLine:
dashCombo->setCurrentItem(1);
break;
case Qt::DotLine:
dashCombo->setCurrentItem(2);
break;
case Qt::DashDotLine:
dashCombo->setCurrentItem(3);
break;
case Qt::DashDotDotLine:
dashCombo->setCurrentItem(4);
break;
default:
dashCombo->setCurrentItem(0);
break;
}
 
switch (static_cast<Qt::PenCapStyle>(currentStyle[i].LineEnd))
{
case Qt::FlatCap:
endCombo->setCurrentItem(0);
break;
case Qt::SquareCap:
endCombo->setCurrentItem(1);
break;
case Qt::RoundCap:
endCombo->setCurrentItem(2);
break;
default:
endCombo->setCurrentItem(0);
break;
}
 
switch (static_cast<Qt::PenJoinStyle>(currentStyle[i].LineJoin))
{
case Qt::MiterJoin:
joinCombo->setCurrentItem(0);
break;
case Qt::BevelJoin:
joinCombo->setCurrentItem(1);
break;
case Qt::RoundJoin:
joinCombo->setCurrentItem(2);
break;
default:
joinCombo->setCurrentItem(0);
break;
}
}
 
void SMLineStyleWidget::updateLineList()
{
QString tmp, tmp2;
lineStyles->clear();
QPixmap * pm2;
for (multiLine::iterator it = currentStyle.begin(); it != currentStyle.end(); ++it)
{
pm2 = getWidePixmap(getColor((*it).Color, (*it).Shade));
tmp2 = " "+tmp.setNum((*it).Width)+ tr(" pt")+" ";
tmp2 += CommonStrings::translatePenStyleName(static_cast<Qt::PenStyle>((*it).Dash));
tmp2 += " ";
// lineStyles->insertItem( ...)
lineStyles->addItem(new QListWidgetItem(*pm2, tmp2, lineStyles));
}
}
 
QColor SMLineStyleWidget::getColor(const QString &name, int shade)
{
const ScColor& color = colors[name];
QColor tmpf = ScColorEngine::getDisplayColor(color, colors.document(), shade);
return tmpf;
}
 
SMLineStyleWidget::~SMLineStyleWidget()
{
}
/trunk/Scribus/scribus/smspinbox.h
13,7 → 13,7
{
Q_OBJECT
public:
SMSpinBox(QWidget *parent, const char *name);
SMSpinBox(QWidget *parent, const char *name = 0);
~SMSpinBox() {};
 
void setValue(int val);
/trunk/Scribus/scribus/smlinestyle.h
10,40 → 10,11
 
#include "scribusstructs.h"
#include "styleitem.h"
#include "ui_smlinestylewidget.h"
 
class ScribusDoc;
class LineCombo;
class ColorCombo;
class ScrSpinBox;
class SMLineStyleWidget;
 
class LineStyleWidget : public QWidget, Ui::LineStyleWidget
{
Q_OBJECT
public:
LineStyleWidget();
~LineStyleWidget();
void showStyle(const multiLine &lineStyle, ColorList &colorList, int subLine = 0);
 
void languageChange();
 
private:
LineCombo *dashCombo;
ScrSpinBox *lineWidth;
ColorCombo *colorCombo;
multiLine currentStyle;
ColorList colors;
 
void updateLineList();
QColor getColor(const QString &name, int shade);
 
friend class SMLineStyle;
 
protected slots:
void slotEditNewLine(int i);
 
};
 
class SMLineStyle : public StyleItem
{
Q_OBJECT
76,7 → 47,7
 
private:
ScribusDoc *doc_;
LineStyleWidget *widget_;
SMLineStyleWidget *widget_;
QTabWidget *twidget_;
QMap<QString, multiLine> tmpLines;
bool selectionIsDirty_;
/trunk/Scribus/scribus/smcstylewidget.cpp
0,0 → 1,528
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
#include "smcstylewidget.h"
#include "util_icon.h"
#include "util.h"
#include "units.h"
 
 
SMCStyleWidget::SMCStyleWidget(QWidget *parent) : QWidget()
{
setupUi(this);
 
fontSize_->setMinimum(1.0);
fontSize_->setMaximum(2048.0);
fontSizeLabel_->setPixmap(loadIcon("Zeichen.xpm"));
 
trackingLabel_->setPixmap( loadIcon("textkern.png") );
tracking_->setMinimum(-300.0);
tracking_->setMaximum(300.0);
tracking_->setSuffix( tr( " %" ) );
 
baselineOffsetLabel_->setPixmap( loadIcon("textbase.png") );
baselineOffset_->setMinimum(-100.0);
baselineOffset_->setMaximum(100.0);
baselineOffset_->setSuffix( tr( " %" ) );
 
hscaleLabel_->setPixmap( loadIcon("textscaleh.png") );
fontHScale_->setMinimum(10.0);
fontHScale_->setMaximum(400.0);
fontHScale_->setSuffix( tr( " %" ) );
 
vscaleLabel_->setPixmap( loadIcon("textscalev.png") );
fontVScale_->setMinimum(10.0);
fontVScale_->setMaximum(400.0);
fontVScale_->setSuffix( tr( " %" ) );
 
FillIcon->setPixmap(loadIcon("16/color-fill.png"));
fillShadeLabel->setPixmap( loadIcon("shade.png") );
StrokeIcon->setPixmap(loadIcon("16/color-stroke.png"));
strokeShadeLabel->setPixmap( loadIcon("shade.png") );
 
fillColor_->clear();
strokeColor_->clear();
ColorList::Iterator it;
QPixmap pm = QPixmap(15, 15);
fillColor_->insertItem(CommonStrings::tr_NoneColor);
strokeColor_->insertItem(CommonStrings::tr_NoneColor);
StrokeIcon->setEnabled(false);
strokeShade_->setEnabled(false);
strokeColor_->setEnabled(false);
 
connect(effects_, SIGNAL(State(int)), this, SLOT(slotColorChange()));
}
 
void SMCStyleWidget::languageChange()
{
/***********************************/
/* Begin Tooltips */
/***********************************/
// These are for the character style page
// as in character styles and in paragraph style's character style
 
QToolTip::add(parentCombo, tr("Parent style"));
QToolTip::add(fontFace_, tr("Font face"));
QToolTip::add(fontSize_, tr("Font size"));
QToolTip::add(tracking_, tr("Tracking"));
QToolTip::add(baselineOffset_, tr("Baseline offset"));
QToolTip::add(fontHScale_, tr("Horizontal scaling"));
QToolTip::add(fontVScale_, tr("Vertical scaling"));
QToolTip::add(language_, tr("Language"));
QToolTip::add(fillColor_, tr("Fill color"));
QToolTip::add(fillShade_, tr("Fill shade"));
QToolTip::add(strokeColor_, tr("Stroke color"));
QToolTip::add(strokeShade_, tr("Stroke shade"));
 
/***********************************/
/* End Tooltips */
/***********************************/
 
parentLabel->setText( tr("Based On:"));
languageLabel_->setText( tr("Language:"));
fontVScale_->setSuffix( tr(" %"));
fontHScale_->setSuffix( tr(" %"));
baselineOffset_->setSuffix( tr(" %"));
tracking_->setSuffix( tr(" %"));
fontSize_->setSuffix(unitGetSuffixFromIndex(0));
}
 
void SMCStyleWidget::fillLangCombo(QMap<QString,QString> langMap)
{
QStringList sortList;
QMap<QString,QString>::Iterator it;
 
langMap_ = langMap;
 
language_->clear();
 
for (it = langMap.begin(); it != langMap.end(); ++it)
sortList.push_back(it.data());
 
language_->insertStringList(sortQStringList(sortList));
 
QListView *tmpView = dynamic_cast<QListView*>(language_->view()); Q_ASSERT(tmpView);
int tmpWidth = tmpView->sizeHintForColumn(0);
if (tmpWidth > 0)
tmpView->setMinimumWidth(tmpWidth + 24);
}
 
void SMCStyleWidget::fillColorCombo(ColorList &colors)
{
fillColor_->clear();
strokeColor_->clear();
 
fillColor_->insertItem(CommonStrings::tr_NoneColor);
strokeColor_->insertItem(CommonStrings::tr_NoneColor);
ColorList::Iterator itend=colors.end();
ScribusDoc* doc = colors.document();
for (ColorList::Iterator it = colors.begin(); it != itend; ++it)
{
fillColor_->insertSmallItem(it.data(), doc, it.key());
strokeColor_->insertSmallItem(it.data(), doc, it.key());
}
fillColor_->view()->setMinimumWidth(fillColor_->view()->maximumViewportSize().width()+24);
strokeColor_->view()->setMinimumWidth(strokeColor_->view()->maximumViewportSize().width()+24);
}
 
void SMCStyleWidget::show(CharStyle *cstyle, QList<CharStyle> &cstyles, const QString &defLang, int unitIndex)
{
disconnect(effects_, SIGNAL(State(int)), this, SLOT(slotColorChange()));
parentCombo->setEnabled(true);
const CharStyle *parent = dynamic_cast<const CharStyle*>(cstyle->parentStyle());
bool hasParent = cstyle->hasParent() && parent != 0 && parent->hasName() && cstyle->parent() != "";
if (hasParent)
{
fontSize_->setValue(cstyle->fontSize() / 10.0, cstyle->isInhFontSize());
fontSize_->setParentValue(parent->fontSize() / 10.0);
 
fontHScale_->setValue(cstyle->scaleH() / 10.0, cstyle->isInhScaleH());
fontHScale_->setParentValue(parent->scaleH() / 10.0);
 
fontVScale_->setValue(cstyle->scaleV() / 10.0, cstyle->isInhScaleV());
fontVScale_->setParentValue(parent->scaleV() / 10.0);
 
baselineOffset_->setValue(cstyle->baselineOffset() / 10.0, cstyle->isInhBaselineOffset());
baselineOffset_->setParentValue(parent->baselineOffset() / 10.0);
 
tracking_->setValue(cstyle->tracking() / 10.0, cstyle->isInhTracking());
tracking_->setParentValue(parent->tracking() / 10.0);
 
effects_->setStyle(static_cast<int>(cstyle->effects()), cstyle->isInhFeatures());
effects_->setParentItem(static_cast<int>(parent->effects())); // FIXME
 
fillShade_->setValue(qRound(cstyle->fillShade()), cstyle->isInhFillShade());
fillShade_->setParentValue(qRound(parent->fillShade()));
 
strokeShade_->setValue(qRound(cstyle->strokeShade()), cstyle->isInhStrokeShade());
strokeShade_->setParentValue(qRound(parent->strokeShade()));
 
fillColor_->setCurrentText(cstyle->fillColor(), cstyle->isInhFillColor());
fillColor_->setParentText(parent->fillColor());
 
strokeColor_->setCurrentText(cstyle->strokeColor(), cstyle->isInhStrokeColor());
strokeColor_->setParentText(parent->strokeColor());
 
fontFace_->setCurrentFont(cstyle->font().scName(), cstyle->isInhFont());
fontFace_->setParentFont(parent->font().scName());
}
else
{
fontSize_->setValue(cstyle->fontSize() / 10.0);
fontHScale_->setValue(cstyle->scaleH() / 10.0);
fontVScale_->setValue(cstyle->scaleV() / 10.0);
baselineOffset_->setValue(cstyle->baselineOffset() / 10.0);
tracking_->setValue(cstyle->tracking() / 10.0);
effects_->setStyle(static_cast<int>(cstyle->effects()));
fillShade_->setValue(qRound(cstyle->fillShade()));
strokeShade_->setValue(qRound(cstyle->strokeShade()));
fillColor_->setCurrentText(cstyle->fillColor());
strokeColor_->setCurrentText(cstyle->strokeColor());
fontFace_->setCurrentFont(cstyle->font().scName());
}
 
effects_->ShadowVal->Xoffset->setValue(cstyle->shadowXOffset() / 10.0);
effects_->ShadowVal->Yoffset->setValue(cstyle->shadowYOffset() / 10.0);
effects_->OutlineVal->LWidth->setValue(cstyle->outlineWidth() / 10.0);
effects_->StrikeVal->LPos->setValue(cstyle->strikethruOffset() / 10.0);
effects_->StrikeVal->LWidth->setValue(cstyle->strikethruWidth() / 10.0);
effects_->UnderlineVal->LPos->setValue(cstyle->underlineOffset() / 10.0);
effects_->UnderlineVal->LWidth->setValue(cstyle->underlineWidth() / 10.0);
slotColorChange();
 
parentCombo->clear();
parentCombo->insertItem("");
for (int i = 0; i < cstyles.count(); ++i)
{
if (cstyles[i].name() != cstyle->name())
parentCombo->insertItem(cstyles[i].name());
}
 
if (hasParent)
{
int index = 0;
for (int i = 0; i < parentCombo->count(); ++i)
{
if (parentCombo->text(i) == cstyle->parentStyle()->name())
{
index = i;
break;
}
}
parentCombo->setCurrentItem(index);
}
else
parentCombo->setCurrentItem(0);
 
QString clang = cstyle->language().isNull() || cstyle->language().isEmpty() ?
defLang : cstyle->language();
QString plang(QString::null);
if (hasParent)
plang = parent->language().isNull() || parent->language().isEmpty() ?
defLang : parent->language();
 
int ci = -1, pi = -1, di = -1;
for (int i = 0; i < language_->count(); ++i)
{
if (language_->text(i) == langMap_[clang])
ci = i;
if (hasParent && language_->text(i) == langMap_[plang])
pi = i;
 
if (language_->text(i) == defLang || language_->text(i) == langMap_[defLang])
di = i;
}
 
// qDebug(QString("SMCStyleWidget::show(): deflan='%1'->'%2'").arg(defLang).arg(langMap_[defLang]));
Q_ASSERT(di != -1);
 
if (hasParent)
{
if (ci == -1)
language_->setCurrentItem(di, cstyle->isInhLanguage());
else
language_->setCurrentItem(ci, cstyle->isInhLanguage());
 
language_->setParentItem(pi);
}
else
{
if (ci == -1)
language_->setCurrentItem(di);
else
language_->setCurrentItem(ci);
}
 
connect(effects_, SIGNAL(State(int)), this, SLOT(slotColorChange()));
}
 
void SMCStyleWidget::show(QList<CharStyle*> &cstyles, QList<CharStyle> &cstylesAll, const QString &defLang, int unitIndex)
{
// int decimals = unitGetDecimalsFromIndex(unitIndex);
// QString suffix = unitGetSuffixFromIndex(unitIndex);
 
if (cstyles.count() == 1)
show(cstyles[0], cstylesAll, defLang, unitIndex);
else if (cstyles.count() > 1)
{
showSizeAndPosition(cstyles);
showEffects(cstyles);
showColors(cstyles);
showLanguage(cstyles, defLang);
showParent(cstyles);
}
}
 
void SMCStyleWidget::showSizeAndPosition(const QList<CharStyle*> &cstyles)
{
double d = -30000;
for (int i = 0; i < cstyles.count(); ++i)
{
if (d != -30000 && cstyles[i]->fontSize() != d)
{
d = -30000;
break;
}
else
d = cstyles[i]->fontSize();
}
if (d == -30000)
fontSize_->clear();
else
fontSize_->setValue(d / 10.0);
 
d = -30000;
for (int i = 0; i < cstyles.count(); ++i)
{
if (d != -30000 && cstyles[i]->scaleH() != d)
{
d = -30000;
break;
}
else
d = cstyles[i]->scaleH();
}
if (d == -30000)
fontHScale_->clear();
else
fontHScale_->setValue(d / 10.0);
 
d = -30000;
for (int i = 0; i < cstyles.count(); ++i)
{
if (d != -30000 && cstyles[i]->scaleV() != d)
{
d = -30000;
break;
}
else
d = cstyles[i]->scaleV();
}
if (d == -30000)
fontVScale_->clear();
else
fontVScale_->setValue(d / 10.0);
 
d = -30000;
for (int i = 0; i < cstyles.count(); ++i)
{
if (d != -30000 && cstyles[i]->baselineOffset() != d)
{
d = -30000;
break;
}
else
d = cstyles[i]->baselineOffset();
}
if (d == -30000)
baselineOffset_->clear();
else
baselineOffset_->setValue(d / 10.0);
 
d = -30000;
for (int i = 0; i < cstyles.count(); ++i)
{
if (d != -30000 && cstyles[i]->tracking() != d)
{
d = -30000;
break;
}
else
d = cstyles[i]->tracking();
}
if (d == -30000)
tracking_->clear();
else
tracking_->setValue(d / 10.0);
}
 
void SMCStyleWidget::showEffects(const QList<CharStyle*> &cstyles)
{
int d = -30000;
for (int i = 0; i < cstyles.count(); ++i)
{
if (d != -30000 && static_cast<int>(cstyles[i]->effects()) != d)
{
d = -30000;
break;
}
else
d = static_cast<int>(cstyles[i]->effects());
}
if (d == -30000)
effects_->setStyle(0);
else
effects_->setStyle(d);
 
// TODO these things still missing:
// effects_->ShadowVal->Xoffset->setValue(cstyle->shadowXOffset() / 10.0);
// effects_->ShadowVal->Yoffset->setValue(cstyle->shadowYOffset() / 10.0);
// effects_->OutlineVal->LWidth->setValue(cstyle->outlineWidth() / 10.0);
// effects_->StrikeVal->LPos->setValue(cstyle->strikethruOffset() / 10.0);
// effects_->StrikeVal->LWidth->setValue(cstyle->strikethruWidth() / 10.0);
// effects_->UnderlineVal->LPos->setValue(cstyle->underlineOffset() / 10.0);
// effects_->UnderlineVal->LWidth->setValue(cstyle->underlineWidth() / 10.0);
}
 
void SMCStyleWidget::showColors(const QList<CharStyle*> &cstyles)
{
strokeShade_->setEnabled(true);
strokeColor_->setEnabled(true);
 
double d = -30000;
for (int i = 0; i < cstyles.count(); ++i)
{
if (d != -30000 && cstyles[i]->fillShade() != d)
{
d = -30000;
break;
}
else
d = cstyles[i]->fillShade();
}
if (d == -30000)
fillShade_->setText( tr("Shade"));
else
fillShade_->setValue(qRound(d));
 
d = -30000;
for (int i = 0; i < cstyles.count(); ++i)
{
if (d != -30000 && cstyles[i]->strokeShade() != d)
{
d = -30000;
break;
}
else
d = cstyles[i]->strokeShade();
}
if (d == -30000)
{
strokeShade_->setValue(21);
strokeShade_->setText( tr("Shade"));
}
else
strokeShade_->setValue(qRound(d));
 
QString s;
QString emptyString;
for (int i = 0; i < cstyles.count(); ++i)
{
if (!s.isNull() && s != cstyles[i]->fillColor())
{
s = emptyString;
break;
}
else
s = cstyles[i]->fillColor();
}
if (s.isEmpty())
{
if (fillColor_->text(fillColor_->count() - 1) != "")
fillColor_->insertItem("");
fillColor_->setCurrentItem(fillColor_->count() - 1);
}
else
fillColor_->setCurrentText(s);
 
s = emptyString;
for (int i = 0; i < cstyles.count(); ++i)
{
if (!s.isNull() && s != cstyles[i]->strokeColor())
{
s = emptyString;
break;
}
else
s = cstyles[i]->strokeColor();
}
if (s.isEmpty())
{
if (strokeColor_->text(strokeColor_->count() - 1) != "")
strokeColor_->insertItem("");
strokeColor_->setCurrentItem(fillColor_->count() - 1);
}
else
strokeColor_->setCurrentText(s);
}
 
void SMCStyleWidget::showLanguage(const QList<CharStyle*> &cstyles, const QString &defLang)
{
QString emptyString;
QString s(cstyles[0]->language());
for (int i = 0; i < cstyles.count(); ++i)
{
if (s != cstyles[i]->language())
{
s = emptyString;
break;
}
else
s = cstyles[i]->language();
}
 
if (s.isEmpty())
{
if (language_->text(language_->count() - 1) != "")
language_->insertItem("");
language_->setCurrentItem(language_->count() - 1);
}
else
{
Q_ASSERT(langMap_.contains(s));
language_->setCurrentText(langMap_[s]);
}
}
 
void SMCStyleWidget::showParent(const QList<CharStyle*> &cstyles)
{
parentCombo->setEnabled(false);
}
 
void SMCStyleWidget::clearAll()
{
}
 
void SMCStyleWidget::slotColorChange()
{
int s = effects_->getStyle();
bool enabled;
if ((s & 4) || (s & 256))
enabled = true;
else
enabled = false;
StrokeIcon->setEnabled(enabled);
strokeShade_->setEnabled(enabled);
strokeColor_->setEnabled(enabled);
}
 
 
SMCStyleWidget::~SMCStyleWidget()
{
}
/trunk/Scribus/scribus/smpstylewidget.h
0,0 → 1,55
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#ifndef SMPSTYLEWIDGET_H
#define SMPSTYLEWIDGET_H
 
#include "ui_smpstylewidget.h"
 
// #include "styles/styleset.h"
 
 
class SMPStyleWidget : public QWidget, Ui::SMPStyleWidget
{
Q_OBJECT
public:
SMPStyleWidget();
~SMPStyleWidget();
 
void show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles, QList<CharStyle> &cstyles, int unitIndex, const QString &defLang);
void show(QList<ParagraphStyle*> &pstyles, QList<ParagraphStyle> &pstylesAll, QList<CharStyle> &cstyles, int unitIndex, const QString &defLang);
 
void clearAll();
 
void languageChange();
 
void unitChange(double oldRatio, double newRatio, int unitIndex);
 
private:
bool hasParent_;
bool parentDropCap_;
 
void showLineSpacing(QList<ParagraphStyle*> &pstyles);
void showSpaceAB(QList<ParagraphStyle*> &pstyles, int unitIndex);
void showDropCap(QList<ParagraphStyle*> &pstyles, int unitIndex);
void showAlignment(QList<ParagraphStyle*> &pstyles);
void showTabs(QList<ParagraphStyle*> &pstyles, int unitIndex);
void showCStyle(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, const QString &defLang, int unitIndex);
void showParent(QList<ParagraphStyle*> &pstyles);
 
friend class SMParagraphStyle;
 
private slots:
void slotLineSpacingModeChanged(int);
void slotDropCap(bool isOn);
void slotParentDropCap();
 
signals:
void useParentDropCap();
};
 
#endif
/trunk/Scribus/scribus/smpstylewidget.cpp
0,0 → 1,558
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#include "smpstylewidget.h"
#include "units.h"
#include "util.h"
#include "util_icon.h"
 
 
static bool isEqual(double a, double b)
{
Q_ASSERT(a > -21473 && b > -21473 && a < 21474 && b < 21474);
long al = static_cast<long>(10000 * a);
long bl = static_cast<long>(10000 * b);
return al == bl;
}
 
 
/******************************************************************************/
/******************************************************************************/
 
SMPStyleWidget::SMPStyleWidget() : QWidget()
{
setupUi(this);
 
pixmapLabel0->setPixmap(loadIcon("linespacing2.png"));
pixmapLabel3->setPixmap( loadIcon("above.png") );
pixmapLabel4->setPixmap( loadIcon("below.png") );
 
lineSpacingMode_->insertItem( tr("Fixed Linespacing"));
lineSpacingMode_->insertItem( tr("Automatic Linespacing"));
lineSpacingMode_->insertItem( tr("Align to Baseline Grid"));
connect(lineSpacingMode_, SIGNAL(highlighted(int)), this, SLOT(slotLineSpacingModeChanged(int)));
 
lineSpacing_->setSuffix(unitGetSuffixFromIndex(0));
lineSpacing_->setMinimum(1);
lineSpacing_->setMaximum(300);
 
spaceAbove_->setSuffix(unitGetSuffixFromIndex(0));
spaceAbove_->setMinimum(0);
spaceAbove_->setMaximum(300);
 
spaceBelow_->setSuffix(unitGetSuffixFromIndex(0));
spaceBelow_->setMinimum(0);
spaceBelow_->setMaximum(300);
 
dropCapOffset_->setSuffix(unitGetSuffixFromIndex(0));
 
// characterBox->setEnabled(true);
}
 
void SMPStyleWidget::slotLineSpacingModeChanged(int i)
{
lineSpacing_->setEnabled(i == 0);
}
 
void SMPStyleWidget::languageChange()
{
/***********************************/
/* Begin Tooltips */
/***********************************/
// These are for the paragraph style
 
QToolTip::add(parentCombo, tr("Parent Style"));
QToolTip::add(lineSpacingMode_, tr("Line Spacing Mode"));
QToolTip::add(lineSpacing_, tr("Line Spacing"));
QToolTip::add(spaceAbove_, tr("Space Above"));
QToolTip::add(spaceBelow_, tr("Space Below"));
//CB Unneeded, gets in the way of single widget tooltips
//QToolTip::add(dropCapsBox, tr("Enable or disable drop cap"));
QToolTip::add(dropCapLines_, tr("Drop Cap Lines"));
QToolTip::add(dropCapOffset_, tr("Drop Cap Offset"));
QToolTip::add(alignement_, tr("Alignment"));
QToolTip::add(tabList_->first_, tr("First Line Indent"));
QToolTip::add(tabList_->left_, tr("Left Indent"));
QToolTip::add(tabList_->right_, tr("Right Indent"));
//CB Unneeded, gets in the way of single widget tooltips
//QToolTip::add(tabList_, tr("Tabulators"));
 
/***********************************/
/* End Tooltips */
/***********************************/
 
lineSpacingMode_->clear();
lineSpacingMode_->insertItem( tr("Fixed Linespacing"));
lineSpacingMode_->insertItem( tr("Automatic Linespacing"));
lineSpacingMode_->insertItem( tr("Align to Baseline Grid"));
lineSpacing_->setSuffix(unitGetSuffixFromIndex(0));
spaceAbove_->setSuffix(unitGetSuffixFromIndex(0));
spaceBelow_->setSuffix(unitGetSuffixFromIndex(0));
parentLabel->setText( tr("Based On:"));
distancesBox->setTitle( tr("Distances and Alignment"));
dropCapsBox->setTitle( tr("Drop Caps"));
tabsBox->setTitle( tr("Tabulators and Indentation"));
tabWidget->setTabLabel(tabWidget->page(0), tr("Properties"));
tabWidget->setTabLabel(tabWidget->page(1), tr("Character Style"));
}
 
void SMPStyleWidget::unitChange(double oldRatio, double newRatio, int unitIndex)
{
spaceAbove_->setNewUnit(unitIndex);
spaceBelow_->setNewUnit(unitIndex);
dropCapOffset_->setNewUnit(unitIndex);
tabList_->left_->setNewUnit(unitIndex);
tabList_->right_->setNewUnit(unitIndex);
tabList_->first_->setNewUnit(unitIndex);
}
 
void SMPStyleWidget::show(ParagraphStyle *pstyle, QList<ParagraphStyle> &pstyles, QList<CharStyle> &cstyles, int unitIndex, const QString &defLang)
{
double unitRatio = unitGetRatioFromIndex(unitIndex);
parentCombo->setEnabled(true);
const ParagraphStyle *parent = dynamic_cast<const ParagraphStyle*>(pstyle->parentStyle());
hasParent_ = pstyle->hasParent() && parent != NULL && parent->hasName() && pstyle->parent() != "";
 
lineSpacingMode_->clear();
lineSpacingMode_->insertItem( tr("Fixed Linespacing"));
lineSpacingMode_->insertItem( tr("Automatic Linespacing"));
lineSpacingMode_->insertItem( tr("Align to Baseline Grid"));
 
if (hasParent_)
{
lineSpacingMode_->setCurrentItem(pstyle->lineSpacingMode(), pstyle->isInhLineSpacingMode());
lineSpacingMode_->setParentItem(parent->lineSpacingMode());
 
lineSpacing_->setValue(pstyle->lineSpacing(), pstyle->isInhLineSpacing());
lineSpacing_->setParentValue(parent->lineSpacing());
 
spaceAbove_->setValue(pstyle->gapBefore() * unitRatio, pstyle->isInhGapBefore());
spaceAbove_->setParentValue(parent->gapBefore() * unitRatio);
 
spaceBelow_->setValue(pstyle->gapAfter() * unitRatio, pstyle->isInhGapAfter());
spaceBelow_->setParentValue(parent->gapAfter() * unitRatio);
 
dropCapsBox->setChecked(pstyle->hasDropCap());;
parentDropCap_ = parent->hasDropCap();
if (pstyle->isInhHasDropCap())
parentDropCapButton->hide();
else
parentDropCapButton->show();
 
connect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
 
dropCapLines_->setValue(pstyle->dropCapLines(), pstyle->isInhDropCapLines());
dropCapLines_->setParentValue(parent->dropCapLines());
 
dropCapOffset_->setValue(pstyle->dropCapOffset() * unitRatio, pstyle->isInhDropCapOffset());
dropCapOffset_->setParentValue(parent->dropCapOffset() * unitRatio);
 
alignement_->setStyle(pstyle->alignment(), pstyle->isInhAlignment());
alignement_->setParentItem(parent->alignment());
 
bool hasParentTabs = pstyle->isInhTabValues();
QList<ParagraphStyle::TabRecord> tabs;
if (hasParentTabs)
tabs = QList<ParagraphStyle::TabRecord>(parent->tabValues());
else
tabs = pstyle->tabValues();
 
tabList_->setTabs(tabs, unitIndex, hasParentTabs);
tabList_->setParentTabs(parent->tabValues());
 
tabList_->setLeftIndentValue(pstyle->leftMargin() * unitRatio,pstyle->isInhLeftMargin());
tabList_->setParentLeftIndent(parent->leftMargin() * unitRatio);
 
tabList_->setFirstLineValue(pstyle->firstIndent() * unitRatio, pstyle->isInhFirstIndent());
tabList_->setParentFirstLine(parent->firstIndent() * unitRatio);
 
tabList_->setRightIndentValue(pstyle->rightMargin() * unitRatio, pstyle->isInhRightMargin());
tabList_->setParentRightIndent(parent->rightMargin() * unitRatio);
}
else
{
lineSpacingMode_->setCurrentItem(pstyle->lineSpacingMode());
lineSpacing_->setValue(pstyle->lineSpacing());
spaceAbove_->setValue(pstyle->gapBefore() * unitRatio);
spaceBelow_->setValue(pstyle->gapAfter() * unitRatio);
dropCapsBox->setChecked(pstyle->hasDropCap());
parentDropCapButton->hide();
disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
dropCapLines_->setValue(pstyle->dropCapLines());
dropCapOffset_->setValue(pstyle->dropCapOffset() * unitRatio);
parentDropCapButton->hide();
alignement_->setStyle(pstyle->alignment());
tabList_->setTabs(pstyle->tabValues(), unitIndex);
tabList_->setLeftIndentValue(pstyle->leftMargin() * unitRatio);
tabList_->setFirstLineValue(pstyle->firstIndent() * unitRatio);
tabList_->setRightIndentValue(pstyle->rightMargin() * unitRatio);
}
 
lineSpacing_->setEnabled(pstyle->lineSpacingMode() == ParagraphStyle::FixedLineSpacing);
dropCapLines_->setEnabled(pstyle->hasDropCap());
dropCapOffset_->setEnabled(pstyle->hasDropCap());
 
QFont f(font());
f.setBold(true);
parentDropCapButton->setFont(f);
 
cpage->parentLabel->setText( tr("Based On:"));
cpage->show(&pstyle->charStyle(), cstyles, defLang, unitIndex);
 
parentCombo->clear();
parentCombo->insertItem("");
 
for (int i = 0; i < pstyles.count(); ++i)
{
if (pstyles[i].hasName() && pstyles[i].name() != pstyle->name())
parentCombo->insertItem(pstyles[i].name());
}
 
if (hasParent_)
{
int index = 0;
for (int i = 0; i < parentCombo->count(); ++i)
{
if (parentCombo->text(i) == parent->name())
{
index = i;
break;
}
}
parentCombo->setCurrentItem(index);
}
else
parentCombo->setCurrentItem(0);
 
connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
}
 
void SMPStyleWidget::show(QList<ParagraphStyle*> &pstyles, QList<ParagraphStyle> &pstylesAll, QList<CharStyle> &cstyles, int unitIndex, const QString &defLang)
{
if (pstyles.count() == 1)
show(pstyles[0], pstylesAll, cstyles, unitIndex, defLang);
else if (pstyles.count() > 1)
{
showLineSpacing(pstyles);
showSpaceAB(pstyles, unitIndex);
showDropCap(pstyles, unitIndex);
showAlignment(pstyles);
showTabs(pstyles, unitIndex);
showCStyle(pstyles, cstyles, defLang, unitIndex);
showParent(pstyles);
}
}
 
void SMPStyleWidget::showLineSpacing(QList<ParagraphStyle*> &pstyles)
{
lineSpacingMode_->clear();
lineSpacingMode_->insertItem( tr("Fixed Linespacing"));
lineSpacingMode_->insertItem( tr("Automatic Linespacing"));
lineSpacingMode_->insertItem( tr("Align to Baseline Grid"));
 
int tmpLP = -1;
for (int i = 0; i < pstyles.count(); ++i)
{
if (tmpLP != -1 && pstyles[i]->lineSpacingMode() != tmpLP)
{
tmpLP = -1;
break;
}
else
tmpLP = pstyles[i]->lineSpacingMode();
}
 
if (tmpLP == -1)
{
if (lineSpacingMode_->text(lineSpacingMode_->count() - 1) != "")
lineSpacingMode_->insertItem("");
lineSpacingMode_->setCurrentItem(lineSpacingMode_->count() - 1);
}
else
lineSpacingMode_->setCurrentItem(tmpLP);
 
double tmpLS = -1.0;
for (int i = 0; i < pstyles.count(); ++i)
{
if (tmpLS > 0 && !isEqual(pstyles[i]->lineSpacing(), tmpLS))
{
tmpLS = -1.0;
break;
}
else
tmpLS = pstyles[i]->lineSpacing();
}
lineSpacing_->setEnabled(true);
if (tmpLS < 0)
lineSpacing_->clear();
else
lineSpacing_->setValue(tmpLS);
}
 
void SMPStyleWidget::showSpaceAB(QList<ParagraphStyle*> &pstyles, int unitIndex)
{
double unitRatio = unitGetRatioFromIndex(unitIndex);
double tmpA = -1.2;
for (int i = 0; i < pstyles.count(); ++i)
{
if (tmpA > -1.0 && !isEqual(pstyles[i]->gapBefore(), tmpA))
{
tmpA = -1.2;
break;
}
else
tmpA = pstyles[i]->gapBefore();
}
 
if (tmpA < 0)
spaceAbove_->clear();
else
spaceAbove_->setValue(tmpA * unitRatio);
 
tmpA = -1.2;
for (int i = 0; i < pstyles.count(); ++i)
{
if (tmpA > -1.0 && !isEqual(pstyles[i]->gapAfter(), tmpA))
{
tmpA = -1.2;
break;
}
}
 
if (tmpA < 0)
spaceBelow_->clear();
else
spaceBelow_->setValue(tmpA * unitRatio);
}
 
void SMPStyleWidget::showDropCap(QList<ParagraphStyle*> &pstyles, int unitIndex)
{
double unitRatio = unitGetRatioFromIndex(unitIndex);
parentDropCapButton->hide();
disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
 
bool dc = pstyles[0]->hasDropCap();
for (int i = 0; i < pstyles.count(); ++i)
{
if (dc != pstyles[i]->hasDropCap())
{
dc = false;
break;
}
}
dropCapsBox->setChecked(dc);
 
int lines = -1;
for (int i = 0; i < pstyles.count(); ++i)
{
if (lines > -1 && pstyles[i]->dropCapLines() != lines)
{
lines = -1;
break;
}
else
lines = pstyles[i]->dropCapLines();
}
if (lines == -1)
dropCapLines_->clear();
else
dropCapLines_->setValue(lines);
 
double dco = -4000.0;
for (int i = 0; i < pstyles.count(); ++i)
{
if (dco > -3980.0 && !isEqual(pstyles[i]->dropCapOffset(), dco))
{
dco = -4000.0;
break;
}
else
dco = pstyles[i]->dropCapOffset();
}
 
if (dco < -3800.0)
dropCapOffset_->clear();
else
dropCapOffset_->setValue(dco * unitRatio);
 
connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
dropCapsBox->setEnabled(true);
dropCapLines_->setEnabled(true);
dropCapOffset_->setEnabled(true);
}
 
void SMPStyleWidget::showAlignment(QList<ParagraphStyle*> &pstyles)
{
ParagraphStyle::AlignmentType a = pstyles[0]->alignment();
for (int i = 0; i < pstyles.count(); ++i)
{
if (a != pstyles[i]->alignment())
{
if (alignement_->selectedId() > -1)
{
alignement_->buttonGroup->setExclusive(false);
alignement_->buttonGroup->button(alignement_->selectedId())->toggle();
alignement_->buttonGroup->setExclusive(true);
}
return;
}
}
alignement_->setStyle(a);
}
 
void SMPStyleWidget::showTabs(QList<ParagraphStyle*> &pstyles, int unitIndex)
{
double unitRatio = unitGetRatioFromIndex(unitIndex);
QList<ParagraphStyle::TabRecord> t = pstyles[0]->tabValues();
for (int i = 0; i < pstyles.count(); ++i)
{
if (t != pstyles[i]->tabValues())
{
t = QList<ParagraphStyle::TabRecord>();
break;
}
}
tabList_->setTabs(t, unitIndex);
 
double l = -4000.0;
for (int i = 0; i < pstyles.count(); ++i)
{
if (l > -3800.0 && !isEqual(pstyles[i]->leftMargin(), l))
{
l = -4000.0;
break;
}
else
l = pstyles[i]->leftMargin();
}
if (l < -3800.0)
{
tabList_->setLeftIndentValue(0.0);
tabList_->left_->clear();
}
else
tabList_->setLeftIndentValue(l * unitRatio);
 
l = -4000.0;
for (int i = 0; i < pstyles.count(); ++i)
{
if (l > -3800.0 && !isEqual(pstyles[i]->firstIndent(), l))
{
l = -4000.0;
break;
}
else
l = pstyles[i]->firstIndent();
}
if (l < -3800.0)
{
tabList_->setFirstLineValue(0.0);
tabList_->first_->clear();
}
else
tabList_->setFirstLineValue(l * unitRatio);
 
l = -4000.0;
for (int i = 0; i < pstyles.count(); ++i)
{
if (l > -3800.0 && !isEqual(pstyles[i]->rightMargin(), l))
{
l = -4000.0;
break;
}
else
l = pstyles[i]->rightMargin();
}
if (l < -3800.0)
{
tabList_->setRightIndentData(0.0);
tabList_->right_->clear();
}
else
tabList_->setRightIndentValue(l * unitRatio);
 
}
 
void SMPStyleWidget::showCStyle(QList<ParagraphStyle*> &pstyles, QList<CharStyle> &cstyles, const QString &defLang, int unitIndex)
{
cpage->parentLabel->setText( tr("Based On:"));
 
QList<CharStyle*> cstyle;
for (int i = 0; i < pstyles.count(); ++i)
cstyle << &pstyles[i]->charStyle();
 
cpage->show(cstyle, cstyles, defLang, unitIndex);
}
 
void SMPStyleWidget::showParent(QList<ParagraphStyle*> &pstyles)
{
parentCombo->setEnabled(false);
 
// parentCombo->clear();
// parentCombo->insertItem("");
// for (uint i = 0; i < pstyles.count(); ++i)
// {
// if (pstyles[i].hasName() && pstyles[i].name() != pstyle->name())
// parentCombo->insertItem(pstyles[i].name());
// }
//
// if (hasParent_)
// {
// int index = 0;
// for (int i = 0; i < parentCombo->count(); ++i)
// {
// if (parentCombo->text(i) == parent->name())
// {
// index = i;
// break;
// }
// }
// parentCombo->setCurrentItem(index);
// }
// else
// parentCombo->setCurrentItem(0);
}
 
void SMPStyleWidget::clearAll()
{
 
}
 
void SMPStyleWidget::slotDropCap(bool isOn)
{
if (isOn)
{
dropCapsBox->setEnabled(true);
dropCapLines_->setEnabled(true);
dropCapOffset_->setEnabled(true);
}
else
{
dropCapsBox->setEnabled(true);
dropCapLines_->setEnabled(false);
dropCapOffset_->setEnabled(false);
}
if (hasParent_)
parentDropCapButton->show();
}
 
void SMPStyleWidget::slotParentDropCap()
{
disconnect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
disconnect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
parentDropCapButton->hide();
dropCapsBox->setChecked(parentDropCap_);
emit useParentDropCap();
connect(parentDropCapButton, SIGNAL(clicked()), this, SLOT(slotParentDropCap()));
connect(dropCapsBox, SIGNAL(toggled(bool)), this, SLOT(slotDropCap(bool)));
}
 
SMPStyleWidget::~SMPStyleWidget()
{
}
 
/trunk/Scribus/scribus/smtextstyles.h
14,7 → 14,7
 
class CharStyle;
class ScribusDoc;
class SMCStylePage;
class SMCStyleWidget;
class SMPStyleWidget;
 
class SMParagraphStyle : public StyleItem
132,7 → 132,7
 
private:
QTabWidget *widget_;
SMCStylePage *page_;
SMCStyleWidget *page_;
ScribusDoc *doc_;
StyleSet<CharStyle> tmpStyles_;
QList<CharStyle*> selection_;
/trunk/Scribus/scribus/smlinestylewidget.h
0,0 → 1,46
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
a copyright and/or license notice that predates the release of Scribus 1.3.2
for which a new license (GPL+exception) is in place.
*/
 
#ifndef SMLINESTYLEWIDGET_H
#define SMLINESTYLEWIDGET_H
 
#include "scribusstructs.h"
#include "styleitem.h"
#include "ui_smlinestylewidget.h"
 
class LineCombo;
class ColorCombo;
class ScrSpinBox;
 
class SMLineStyleWidget : public QWidget, Ui::SMLineStyleWidget
{
Q_OBJECT
public:
SMLineStyleWidget();
~SMLineStyleWidget();
void showStyle(const multiLine &lineStyle, ColorList &colorList, int subLine = 0);
 
void languageChange();
 
private:
LineCombo *dashCombo;
ScrSpinBox *lineWidth;
ColorCombo *colorCombo;
multiLine currentStyle;
ColorList colors;
 
void updateLineList();
QColor getColor(const QString &name, int shade);
 
friend class SMLineStyle;
 
protected slots:
void slotEditNewLine(int i);
 
};
 
#endif
/trunk/Scribus/scribus/smlinestyle.cpp
5,185 → 5,17
for which a new license (GPL+exception) is in place.
*/
 
#include "colorcombo.h"
#include "linecombo.h"
#include "smlinestyle.h"
#include "smlinestylewidget.h"
#include "scribus.h"
#include "mpalette.h"
#include "scribusdoc.h"
#include "scribusview.h"
#include "selection.h"
#include "sccolorengine.h"
#include "scribus.h"
#include "scrspinbox.h"
#include "selection.h"
#include "smlinestyle.h"
#include "util_color.h"
#include "util_icon.h"
 
 
/*** LineStyleWidget *******************************************************/
 
LineStyleWidget::LineStyleWidget() : QWidget()
{
setupUi(this);
addButton->setPixmap(loadIcon("penciladd.png"));
removeButton->setPixmap(loadIcon("pencilsub.png"));
 
dashCombo = new LineCombo(this);
gridLayout->addWidget(dashCombo, 0, 0);
 
lineWidth = new ScrSpinBox( 0, 300, this, 0 );
gridLayout1->addWidget(lineWidth, 0, 1);
colorCombo = new ColorCombo(this);
gridLayout1->addWidget(colorCombo, 1, 0);
 
endCombo->insertItem(loadIcon("ButtCap.png"), tr( "Flat Cap" ) );
endCombo->insertItem(loadIcon("SquareCap.png"), tr( "Square Cap" ) );
endCombo->insertItem(loadIcon("RoundCap.png"), tr( "Round Cap" ) );
 
joinCombo->insertItem(loadIcon("MiterJoin.png"), tr( "Miter Join" ) );
joinCombo->insertItem(loadIcon("BevelJoin.png"), tr( "Bevel Join" ) );
joinCombo->insertItem(loadIcon("RoundJoin.png"), tr( "Round Join" ) );
 
languageChange();
}
 
void LineStyleWidget::languageChange()
{
/***********************************/
/* Begin Tooltips */
/***********************************/
// These are for the line style page
 
QToolTip::add(addButton, tr("Add a new line"));
QToolTip::add(removeButton, tr("Remove a line"));
QToolTip::add(dashCombo, tr("Line style"));
QToolTip::add(lineWidth, tr("Line width"));
QToolTip::add(endCombo, tr("End style"));
QToolTip::add(joinCombo, tr("Join style"));
QToolTip::add(colorCombo, tr("Line color"));
QToolTip::add(shadeBox, tr("Line shade"));
 
/***********************************/
/* End Tooltips */
/***********************************/
 
 
}
 
void LineStyleWidget::showStyle(const multiLine &lineStyle, ColorList &colorList, int subLine)
{
// disconnect(lineStyles, SIGNAL(highlighted(int)), this, SLOT(slotEditNewLine(int)));
disconnect(lineStyles, SIGNAL(currentRowChanged(int)), this, SLOT(slotEditNewLine(int)));
currentStyle = lineStyle;
colorCombo->clear();
ColorList::Iterator it;
ScribusDoc* doc = colorList.document();
for (it = colorList.begin(); it != colorList.end(); ++it)
colorCombo->insertWideItem(colorList[it.key()], doc, it.key());
colors = colorList;
updateLineList();
slotEditNewLine(subLine);
connect(lineStyles, SIGNAL(currentRowChanged(int)), this, SLOT(slotEditNewLine(int)));
}
 
void LineStyleWidget::slotEditNewLine(int i)
{
lineStyles->setCurrentRow(i);
// lineStyles->setSelected(i, true);
//currentLine_ = i;
 
// JG #5876 protect against broken line styles
if (currentStyle.count() <= i)
return;
 
lineWidth->setValue(currentStyle[i].Width);
colorCombo->setCurrentText(currentStyle[i].Color);
shadeBox->setValue(currentStyle[i].Shade);
switch (static_cast<Qt::PenStyle>(currentStyle[i].Dash))
{
case Qt::SolidLine:
dashCombo->setCurrentItem(0);
break;
case Qt::DashLine:
dashCombo->setCurrentItem(1);
break;
case Qt::DotLine:
dashCombo->setCurrentItem(2);
break;
case Qt::DashDotLine:
dashCombo->setCurrentItem(3);
break;
case Qt::DashDotDotLine:
dashCombo->setCurrentItem(4);
break;
default:
dashCombo->setCurrentItem(0);
break;
}
 
switch (static_cast<Qt::PenCapStyle>(currentStyle[i].LineEnd))
{
case Qt::FlatCap:
endCombo->setCurrentItem(0);
break;
case Qt::SquareCap:
endCombo->setCurrentItem(1);
break;
case Qt::RoundCap:
endCombo->setCurrentItem(2);
break;
default:
endCombo->setCurrentItem(0);
break;
}
 
switch (static_cast<Qt::PenJoinStyle>(currentStyle[i].LineJoin))
{
case Qt::MiterJoin:
joinCombo->setCurrentItem(0);
break;
case Qt::BevelJoin:
joinCombo->setCurrentItem(1);
break;
case Qt::RoundJoin:
joinCombo->setCurrentItem(2);
break;
default:
joinCombo->setCurrentItem(0);
break;
}
}
 
void LineStyleWidget::updateLineList()
{
QString tmp, tmp2;
lineStyles->clear();
QPixmap * pm2;
for (multiLine::iterator it = currentStyle.begin(); it != currentStyle.end(); ++it)
{
pm2 = getWidePixmap(getColor((*it).Color, (*it).Shade));
tmp2 = " "+tmp.setNum((*it).Width)+ tr(" pt")+" ";
tmp2 += CommonStrings::translatePenStyleName(static_cast<Qt::PenStyle>((*it).Dash));
tmp2 += " ";
// lineStyles->insertItem( ...)
lineStyles->addItem(new QListWidgetItem(*pm2, tmp2, lineStyles));
}
}
 
QColor LineStyleWidget::getColor(const QString &name, int shade)
{
const ScColor& color = colors[name];
QColor tmpf = ScColorEngine::getDisplayColor(color, colors.document(), shade);
return tmpf;
}
 
LineStyleWidget::~LineStyleWidget()
{
}
 
/*************************************************************************/
/*************************************************************************/
 
SMLineStyle::SMLineStyle() : StyleItem(), doc_(0), widget_(0), twidget_(0), selectionIsDirty_(false)
{
194,7 → 26,7
if (!twidget_)
{
twidget_ = new QTabWidget();
widget_ = new LineStyleWidget();
widget_ = new SMLineStyleWidget();
twidget_->addTab(widget_, tr("Properties"));
connect(widget_->lineStyles, SIGNAL(highlighted(int)), this, SLOT(slotCurrentLineChanged(int)));
}
/trunk/Scribus/scribus/smlinestylewidget.ui
1,6 → 1,6
<ui version="4.0" >
<class>LineStyleWidget</class>
<widget class="QWidget" name="LineStyleWidget" >
<class>SMLineStyleWidget</class>
<widget class="QWidget" name="SMLineStyleWidget" >
<property name="geometry" >
<rect>
<x>0</x>
10,26 → 10,42
</rect>
</property>
<layout class="QVBoxLayout" >
<property name="margin" >
<property name="spacing" >
<number>5</number>
</property>
<property name="spacing" >
<property name="leftMargin" >
<number>5</number>
</property>
<property name="topMargin" >
<number>5</number>
</property>
<property name="rightMargin" >
<number>5</number>
</property>
<property name="bottomMargin" >
<number>5</number>
</property>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="addButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
54,9 → 70,7
<item>
<widget class="QPushButton" name="removeButton" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>0</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
98,12 → 112,21
</item>
<item>
<layout class="QHBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QListWidget" name="lineStyles" >
<property name="maximumSize" >
116,26 → 139,45
</item>
<item>
<layout class="QVBoxLayout" >
<property name="margin" >
<number>0</number>
</property>
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="spacing" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="1" column="0" >
<widget class="QComboBox" name="endCombo" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
145,9 → 187,7
<item row="2" column="0" >
<widget class="QComboBox" name="joinCombo" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
158,18 → 198,28
</item>
<item>
<layout class="QGridLayout" >
<property name="margin" >
<property name="leftMargin" >
<number>0</number>
</property>
<property name="spacing" >
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<property name="horizontalSpacing" >
<number>6</number>
</property>
<property name="verticalSpacing" >
<number>6</number>
</property>
<item row="1" column="1" >
<widget class="QSpinBox" name="shadeBox" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>1</hsizetype>
<vsizetype>0</vsizetype>
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
183,12 → 233,12
<property name="suffix" >
<string>%</string>
</property>
<property name="minimum" >
<number>0</number>
</property>
<property name="maximum" >
<number>100</number>
</property>
<property name="minimum" >
<number>0</number>
</property>
<property name="value" >
<number>100</number>
</property>
197,9 → 247,7
<item row="0" column="0" >
<widget class="QLabel" name="textLabel2" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
233,9 → 281,7
<item>
<widget class="QLabel" name="previewLabel" >
<property name="sizePolicy" >
<sizepolicy>
<hsizetype>7</hsizetype>
<vsizetype>5</vsizetype>
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
277,7 → 323,6
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<customwidgets/>
<resources/>
<connections/>
</ui>
/trunk/Scribus/scribus/smpstylewidget.ui
0,0 → 1,408
<ui version="4.0" >
<class>SMPStyleWidget</class>
<widget class="QWidget" name="SMPStyleWidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>679</width>
<height>533</height>
</rect>
</property>
<layout class="QGridLayout" >
<property name="leftMargin" >
<number>5</number>
</property>
<property name="topMargin" >
<number>5</number>
</property>
<property name="rightMargin" >
<number>5</number>
</property>
<property name="bottomMargin" >
<number>5</number>
</property>
<property name="horizontalSpacing" >
<number>5</number>
</property>
<property name="verticalSpacing" >
<number>5</number>
</property>
<item row="0" column="0" >
<widget class="QTabWidget" name="tabWidget" >
<property name="currentIndex" >
<number>1</number>
</property>
<widget class="QWidget" name="tab" >
<attribute name="title" >
<string>Properties</string>
</attribute>
<layout class="QGridLayout" >
<item row="0" column="0" colspan="2" >
<layout class="QHBoxLayout" >
<property name="spacing" >
<number>5</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QLabel" name="parentLabel" >
<property name="text" >
<string>Based On:</string>
</property>
<property name="wordWrap" >
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="parentCombo" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>5</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
</layout>
</item>
<item row="1" column="0" >
<widget class="QGroupBox" name="distancesBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Distances and Alignment</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="pixmapLabel0" >
<property name="maximumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="0" column="1" >
<widget class="SMScComboBox" name="lineSpacingMode_" />
</item>
<item row="0" column="2" >
<widget class="SMScrSpinBox" name="lineSpacing_" />
</item>
<item row="0" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="pixmapLabel3" >
<property name="maximumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="1" column="1" >
<widget class="SMScrSpinBox" name="spaceAbove_" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="pixmapLabel4" >
<property name="maximumSize" >
<size>
<width>22</width>
<height>22</height>
</size>
</property>
<property name="text" >
<string>TextLabel</string>
</property>
</widget>
</item>
<item row="2" column="1" >
<widget class="SMScrSpinBox" name="spaceBelow_" />
</item>
<item row="3" column="0" colspan="2" >
<widget class="SMAlignSelect" native="1" name="alignement_" />
</item>
<item row="4" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item row="1" column="1" >
<layout class="QVBoxLayout" >
<item>
<widget class="QGroupBox" name="dropCapsBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Minimum" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Drop Caps</string>
</property>
<property name="checkable" >
<bool>true</bool>
</property>
<property name="checked" >
<bool>false</bool>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="QLabel" name="label" >
<property name="text" >
<string>&amp;Lines:</string>
</property>
<property name="buddy" >
<cstring>dropCapLines_</cstring>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="SMSpinBox" name="dropCapLines_" >
<property name="minimum" >
<number>2</number>
</property>
<property name="maximum" >
<number>20</number>
</property>
</widget>
</item>
<item row="0" column="3" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" >
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Distance from Text:</string>
</property>
</widget>
</item>
<item row="1" column="2" >
<widget class="SMScrSpinBox" name="dropCapOffset_" >
<property name="minimum" >
<number>-3000</number>
</property>
<property name="maximum" >
<number>3000</number>
</property>
</widget>
</item>
<item row="2" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QToolButton" name="parentDropCapButton" >
<property name="text" >
<string>Parent's Drop Cap Status</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="0" colspan="2" >
<widget class="QGroupBox" name="tabsBox" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title" >
<string>Tabulators and Indentation</string>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="SMTabruler" native="1" name="tabList_" >
<property name="sizePolicy" >
<sizepolicy vsizetype="MinimumExpanding" hsizetype="MinimumExpanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="1" >
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0" >
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" >
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="TabPage" >
<attribute name="title" >
<string>Ch&amp;aracter Style</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>5</number>
</property>
<property name="leftMargin" >
<number>0</number>
</property>
<property name="topMargin" >
<number>0</number>
</property>
<property name="rightMargin" >
<number>0</number>
</property>
<property name="bottomMargin" >
<number>0</number>
</property>
<item>
<widget class="QFrame" name="characterBox" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="frameShape" >
<enum>QFrame::NoFrame</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Plain</enum>
</property>
<property name="lineWidth" >
<number>0</number>
</property>
<layout class="QGridLayout" >
<item row="0" column="0" >
<widget class="SMCStyleWidget" native="1" name="cpage" />
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="5" margin="5" />
<customwidgets>
<customwidget>
<class>SMScComboBox</class>
<extends>QComboBox</extends>
<header>smsccombobox.h</header>
</customwidget>
<customwidget>
<class>SMScrSpinBox</class>
<extends>QSpinBox</extends>
<header>smscrspinbox.h</header>
</customwidget>
<customwidget>
<class>SMAlignSelect</class>
<extends>QWidget</extends>
<header>smalignselect.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>SMSpinBox</class>
<extends>QSpinBox</extends>
<header>smspinbox.h</header>
</customwidget>
<customwidget>
<class>SMTabruler</class>
<extends>QWidget</extends>
<header>smtabruler.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>SMCStyleWidget</class>
<extends>QWidget</extends>
<header>smcstylewidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
/trunk/Scribus/scribus/CMakeLists.txt
43,8 → 43,8
shortcutwidget.ui
smlinestylewidget.ui
smreplacedia.ui
smpstylew.ui
smcstylew.ui
smpstylewidget.ui
smcstylewidget.ui
smstyleimport.ui
stylemanager.ui
tabexternaltoolswidget.ui
205,6 → 205,7
smalignselect.h
smfontcomboh.h
smlinestyle.h
smlinestylewidget.h
smreplacedia.h
smsccombobox.h
smcolorcombo.h
215,7 → 216,8
smstyleselect.h
smtabruler.h
smtextstyles.h
smtextstylewidgets.h
smcstylewidget.h
smpstylewidget.h
spalette.h
story.h
styleitem.h
467,6 → 469,7
smalignselect.cpp
smfontcomboh.cpp
smlinestyle.cpp
smlinestylewidget.cpp
smsccombobox.cpp
smcolorcombo.cpp
smscrspinbox.cpp
477,7 → 480,8
smstyleselect.cpp
smtabruler.cpp
smtextstyles.cpp
smtextstylewidgets.cpp
smcstylewidget.cpp
smpstylewidget.cpp
spalette.cpp
splash.cpp
stencilreader.cpp
/trunk/Scribus/scribus/smtextstyles.cpp
6,8 → 6,8
*/
 
#include "smtextstyles.h"
//#include "smtextstyles.moc"
#include "smtextstylewidgets.h"
#include "smpstylewidget.h"
#include "smcstylewidget.h"
#include "util.h"
#include "scrspinbox.h"
#include "alignselect.h"
1180,7 → 1180,7
widget_ = new QTabWidget();
Q_CHECK_PTR(widget_);
widget_->setMargin(5);//CB the SMCStylePage parent has a 0 value to fit properly onto the pstyle page, so add it here
page_ = new SMCStylePage();
page_ = new SMCStyleWidget();
Q_CHECK_PTR(page_);
widget_->addTab(page_, tr("Properties"));
}