r14455 by cbradney - Commit patch from #8670
scribus-commit
scribus-commit at lists.scribus.net
Sun Jan 3 00:20:37 CET 2010
Revision: 14455
Author: cbradney
Date: 2010-01-02T10:40:51.047976Z
Commit message: Commit patch from #8670
Changeset:
M /trunk/Scribus/scribus/styles/paragraphstyle.h
M /trunk/Scribus/scribus/styles/linestyle.h
M /trunk/Scribus/scribus/plugins/fileloader/scribus12format/scribus12format.cpp
M /trunk/Scribus/scribus/styles/style.cpp
M /trunk/Scribus/scribus/style.h
M /trunk/Scribus/scribus/styles/charstyle.h
Diffs:
Index: scribus/styles/style.cpp
===================================================================
--- scribus/styles/style.cpp (revision 14454)
+++ scribus/styles/style.cpp (revision 14455)
@@ -59,15 +59,6 @@
m_contextversion = m_context->version();
}
-void Style::validate() const
-{
- if (m_context && m_contextversion != m_context->version()) {
- const_cast<Style*>(this)->update(m_context);
- assert( m_context->checkConsistency() );
- }
-}
-
-
const Style* Style::parentStyle() const
{
//qDebug() << QString("follow %1").arg(reinterpret_cast<uint>(m_context),16);
Index: scribus/styles/charstyle.h
===================================================================
--- scribus/styles/charstyle.h (revision 14454)
+++ scribus/styles/charstyle.h (revision 14455)
@@ -150,7 +150,7 @@
/** getter: validates and returns the attribute's value */
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
- attr_TYPE attr_GETTER() const { validate(); return m_##attr_NAME; }
+ const attr_TYPE &attr_GETTER() const { validate(); return m_##attr_NAME; }
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
Index: scribus/styles/linestyle.h
===================================================================
--- scribus/styles/linestyle.h (revision 14454)
+++ scribus/styles/linestyle.h (revision 14455)
@@ -73,7 +73,7 @@
/** getter: validates and returns the attribute's value */
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
- attr_TYPE attr_GETTER() const { validate(); return m_##attr_NAME; }
+ const attr_TYPE &attr_GETTER() const { validate(); return m_##attr_NAME; }
#include "linestyle.attrdefs.cxx"
#undef ATTRDEF
Index: scribus/styles/paragraphstyle.h
===================================================================
--- scribus/styles/paragraphstyle.h (revision 14454)
+++ scribus/styles/paragraphstyle.h (revision 14455)
@@ -110,7 +110,7 @@
/** getter: validates and returns the attribute's value */
#define ATTRDEF(attr_TYPE, attr_GETTER, attr_NAME, attr_DEFAULT) \
- attr_TYPE attr_GETTER() const { validate(); return m_##attr_NAME; }
+ const attr_TYPE &attr_GETTER() const { validate(); return m_##attr_NAME; }
#include "paragraphstyle.attrdefs.cxx"
#undef ATTRDEF
Index: scribus/style.h
===================================================================
--- scribus/style.h (revision 14454)
+++ scribus/style.h (revision 14455)
@@ -110,7 +110,12 @@
/**
Checks if this Style needs an update
*/
- void validate() const;
+ inline void validate() const {
+ if (m_context && m_contextversion != m_context->version()) {
+ const_cast<Style*>(this)->update(m_context);
+ assert( m_context->checkConsistency() );
+ }
+ }
QString shortcut() const { return m_shortcut; }
void setShortcut(const QString &shortcut) { m_shortcut = shortcut; }
Index: scribus/plugins/fileloader/scribus12format/scribus12format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus12format/scribus12format.cpp (revision 14454)
+++ scribus/plugins/fileloader/scribus12format/scribus12format.cpp (revision 14455)
@@ -1104,42 +1104,44 @@
int ulw = qRound(ScCLocale::toDoubleC(it->attribute("CULW"), -0.1) * 10);
int stp = qRound(ScCLocale::toDoubleC(it->attribute("CSTP"), -0.1) * 10);
int stw = qRound(ScCLocale::toDoubleC(it->attribute("CSTW"), -0.1) * 10);
+
+ CharStyle style;
+ style.setFont((*doc->AllFonts)[tmpf]);
+ style.setFontSize(size);
+ style.setFillColor(fcolor);
+ style.setTracking(extra);
+ style.setFillShade(shade);
+ style.setFeatures(static_cast<StyleFlag>(cstyle).featureList());
+ style.setStrokeColor(stroke);
+ style.setStrokeShade(shade2);
+ style.setScaleH(qMin(qMax(scale, 100), 4000));
+ style.setScaleV(qMin(qMax(scalev, 100), 4000));
+ style.setBaselineOffset(base);
+ style.setShadowXOffset(shX);
+ style.setShadowYOffset(shY);
+ style.setOutlineWidth(outL);
+ style.setUnderlineOffset(ulp);
+ style.setUnderlineWidth(ulw);
+ style.setStrikethruOffset(stp);
+ style.setStrikethruWidth(stw);
+
+ int pos = obj->itemText.length();
+ if (style != last->Style) {
+ last->Style = style;
+ last->StyleStart = pos;
+ }
+
+
for (int cxx=0; cxx<tmp2.length(); ++cxx)
{
- CharStyle style;
QChar ch = tmp2.at(cxx);
if (ch == QChar(5))
ch = SpecialChars::PARSEP;
if (ch == QChar(4))
ch = SpecialChars::TAB;
- style.setFont((*doc->AllFonts)[tmpf]);
- style.setFontSize(size);
- style.setFillColor(fcolor);
- style.setTracking(extra);
- style.setFillShade(shade);
- style.setFeatures(static_cast<StyleFlag>(cstyle).featureList());
- style.setStrokeColor(stroke);
- style.setStrokeShade(shade2);
- style.setScaleH(qMin(qMax(scale, 100), 4000));
- style.setScaleV(qMin(qMax(scalev, 100), 4000));
- style.setBaselineOffset(base);
- style.setShadowXOffset(shX);
- style.setShadowYOffset(shY);
- style.setOutlineWidth(outL);
- style.setUnderlineOffset(ulp);
- style.setUnderlineWidth(ulw);
- style.setStrikethruOffset(stp);
- style.setStrikethruWidth(stw);
int pos = obj->itemText.length();
obj->itemText.insertChars(pos, QString(ch));
- if (style != last->Style) {
- // qDebug() << QString("new style at %1: %2 -> %3").arg(pos).arg(last->Style.asString()).arg(newStyle.asString());
- obj->itemText.applyCharStyle(last->StyleStart, pos-last->StyleStart, last->Style);
- last->Style = style;
- last->StyleStart = pos;
- }
-
if (ch == SpecialChars::PARSEP || cxx+1 == tmp2.length()) {
// qDebug() << QString("scribus12 para: %1 %2 %3 %4").arg(ab)
// .arg(ab < signed(DoVorl.size())? DoVorl[ab] : QString("./."))
@@ -1155,7 +1157,6 @@
}
}
obj->itemText.applyCharStyle(last->StyleStart, obj->itemText.length()-last->StyleStart, last->Style);
- return;
}
bool Scribus12Format::loadPage(const QString & fileName, int pageNumber, bool Mpage, QString /*renamedPageName*/)
More information about the scribus-commit
mailing list