Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 9601 → Rev 9602

/branches/Version13x/Scribus/scribus/styles/charstyle.cpp
111,6 → 111,7
set##attr_NAME(other.m_##attr_NAME);
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
updateFeatures();
}
 
 
123,6 → 124,7
reset##attr_NAME();
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
updateFeatures();
}
 
bool CharStyle::equiv(const Style & other) const
246,6 → 248,12
{
m_Effects &= ~ScStyle_UserStyles;
runFeatures(m_Features, dynamic_cast<const CharStyle*>(parentStyle()));
/* need to access global fontlist :-/
if (!font().name().endsWith(fontVariant()))
{
m_font = ScFonts.instance().findFont(font().family() + fontVariant());
}
*/
}
 
 
377,6 → 385,7
m_##attr_NAME = other.m_##attr_NAME;
#include "charstyle.attrdefs.cxx"
#undef ATTRDEF
updateFeatures();
}
 
void CharStyle::getNamedResources(ResourceCollection& lists) const
404,6 → 413,7
if (!inh_Font && (it = newNames.fonts().find(font().scName())) != newNames.fonts().end())
setFont(newNames.availableFonts->findFont(it.data(), NULL));
updateFeatures();
}
/*
/branches/Version13x/Scribus/scribus/styles/style.cpp
19,6 → 19,8
#include "desaxe/simple_actions.h"
#include "desaxe/saxiohelper.h"
 
const QString Style::INHERIT_PARENT = "\n";
 
void Style::setContext(const StyleContext* context)
{
if (m_context != context) {
/branches/Version13x/Scribus/scribus/styles/paragraphstyle.cpp
84,6 → 84,23
}
 
 
/* hm... av
static void updateAutoLinespacing(ParagraphStyle& that)
{
switch (that.lineSpacingMode())
{
case 0:
that.setLineSpacing(((that.charStyle().fontSize() / 10.0) * static_cast<double>(typographicSettings.autoLineSpacing) / 100) + (size / 10.0));
break;
case 1:
that.setLineSpacing(that.charStyle().font().height(size));
break;
case 2:
that.setLineSpacing(typographicSettings.valueBaseGrid-1);
break;
}
}
*/
 
ParagraphStyle& ParagraphStyle::operator=(const ParagraphStyle& other)
{
/branches/Version13x/Scribus/scribus/styles/charstyle.attrdefs.cxx
34,5 → 34,6
ATTRDEF(QString, fillColor, FillColor, "undef")
ATTRDEF(QString, strokeColor, StrokeColor, "Black")
ATTRDEF(QString, language, Language, "")
ATTRDEF(QString, fontVariant, FontVariant, "")
ATTRDEF(ScFace, font, Font, ScFace::none())
ATTRDEF(QStringList, features, Features, CharStyle::INHERIT)
/branches/Version13x/Scribus/scribus/style.h
91,10 → 91,11
}
QString parent() const { return m_parent; }
void setParent(const QString& p) { if (m_parent != p) m_contextversion = -1; m_parent = p.isEmpty() ? "" : p; }
void setParent(const QString& p) { if (m_parent != p) m_contextversion = -1; m_parent = p.isEmpty()? "" : p; }
bool hasParent() const { return ! m_parent.isEmpty(); }
const Style* parentStyle() const;
static const QString INHERIT_PARENT;
virtual void setContext(const StyleContext* context);
const StyleContext* context() const { return m_context; }
137,7 → 138,7
*/
void applyStyle(const Style& other) {
if (other.hasParent())
setParent(other.parent());
setParent( other.parent() == INHERIT_PARENT? "" :other.parent());
m_contextversion = -1;
}
/**
/branches/Version13x/Scribus/scribus/scribusdoc.cpp
75,6 → 75,8
 
extern QPixmap loadIcon(QString nam);
 
static const bool FRAMESELECTION_EDITS_DEFAULTSTYLE = false;
 
ScribusDoc::ScribusDoc() : UndoObject( tr("Document")),
m_hasGUI(false),
prefsData(PrefsManager::instance()->appPrefs),
4825,7 → 4827,7
void ScribusDoc::itemSelection_SetNamedCharStyle(const QString& name, Selection* customSelection)
{
CharStyle newStyle;
newStyle.setParent(name);
newStyle.setParent(name.isEmpty()? Style::INHERIT_PARENT : name);
itemSelection_ApplyCharStyle(newStyle, customSelection);
}
 
4832,8 → 4834,8
void ScribusDoc::itemSelection_SetNamedParagraphStyle(const QString& name, Selection* customSelection)
{
ParagraphStyle newStyle;
newStyle.setParent(name);
itemSelection_SetParagraphStyle(newStyle, customSelection);
newStyle.setParent(name.isEmpty()? Style::INHERIT_PARENT : name);
itemSelection_ApplyParagraphStyle(newStyle, customSelection);
}
 
void ScribusDoc::ItemPen(QString farbe)
5181,49 → 5183,30
 
void ScribusDoc::itemSelection_SetFontSize(int size, Selection* customSelection)
{
if (appMode == modeEdit) {
if (true || appMode == modeEdit)
{
CharStyle newStyle;
newStyle.setFontSize(size);
itemSelection_ApplyCharStyle(newStyle, customSelection);
return;
}
/*
Selection* itemSelection = (customSelection!=0) ? customSelection : m_Selection;
Q_ASSERT(itemSelection!=0);
uint selectedItemCount=itemSelection->count();
if (selectedItemCount == 0)
return;
if (selectedItemCount > 1)
undoManager->beginTransaction(Um::SelectionGroup, Um::IGroup, Um::SetFontSize,
QString("%1").arg(size/10.0), Um::IFont);
for (uint aa = 0; aa < selectedItemCount; ++aa)
{
PageItem *currItem = itemSelection->itemAt(aa);
 
ParagraphStyle storyStyle(currItem->itemText.defaultStyle());
*/
ParagraphStyle storyStyle;
storyStyle.charStyle().setFontSize(size);
if (storyStyle.lineSpacingMode() == 0)
{
storyStyle.setLineSpacing(((size / 10.0) * static_cast<double>(typographicSettings.autoLineSpacing) / 100) + (size / 10.0));
}
else if (storyStyle.lineSpacingMode() == 1)
{
storyStyle.setLineSpacing(storyStyle.charStyle().font().height(size));
}
else
{
storyStyle.setLineSpacing(typographicSettings.valueBaseGrid-1);
ParagraphStyle storyStyle;
storyStyle.charStyle().setFontSize(size);
if (storyStyle.lineSpacingMode() == 0)
{
storyStyle.setLineSpacing(((size / 10.0) * static_cast<double>(typographicSettings.autoLineSpacing) / 100) + (size / 10.0));
}
else if (storyStyle.lineSpacingMode() == 1)
{
storyStyle.setLineSpacing(storyStyle.charStyle().font().height(size));
}
else
{
storyStyle.setLineSpacing(typographicSettings.valueBaseGrid-1);
}
itemSelection_ApplyParagraphStyle(storyStyle, customSelection);
}
itemSelection_ApplyParagraphStyle(storyStyle, customSelection);
/*
currItem->itemText.setDefaultStyle(storyStyle);
}
if (selectedItemCount > 1)
undoManager->commit();
*/
}
 
void ScribusDoc::itemSelection_SetParagraphStyle(const ParagraphStyle & newStyle, Selection* customSelection)
5239,7 → 5222,7
{
PageItem *currItem = itemSelection->itemAt(aa);
uint currItemTextCount=currItem->itemText.length();
if (currItemTextCount != 0 && appMode == modeEdit)
if (currItemTextCount != 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE))
{
int start = currItem->itemText.startOfItem(currItem->firstInFrame());
int stop = currItem->itemText.endOfItem(currItem->lastInFrame());
5288,7 → 5271,7
{
PageItem *currItem = itemSelection->itemAt(aa);
uint currItemTextCount=currItem->itemText.length();
if (currItemTextCount != 0 && appMode == modeEdit)
if (currItemTextCount != 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE))
{
int start = currItem->itemText.startOfItem(currItem->firstInFrame());
int stop = currItem->itemText.endOfItem(currItem->lastInFrame());
5343,7 → 5326,7
{
PageItem *currItem = itemSelection->itemAt(aa);
uint currItemTextCount=currItem->itemText.length();
if (currItemTextCount != 0 && appMode == modeEdit)
if (currItemTextCount != 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE))
{
int start = currItem->itemText.startOfItem(currItem->firstInFrame());
int stop = currItem->itemText.endOfItem(currItem->lastInFrame());
5403,7 → 5386,7
{
PageItem *currItem = itemSelection->itemAt(aa);
uint currItemTextCount=currItem->itemText.length();
if (currItemTextCount != 0 && appMode == modeEdit)
if (currItemTextCount != 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE))
{
int start = currItem->itemText.startOfItem(currItem->firstInFrame());
int length = currItem->itemText.endOfItem(currItem->lastInFrame()) - start;
5455,7 → 5438,7
{
PageItem *currItem = itemSelection->itemAt(aa);
uint currItemTextCount=currItem->itemText.length();
if (currItemTextCount != 0 && appMode == modeEdit)
if (currItemTextCount != 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE))
{
int start = currItem->itemText.startOfItem(currItem->firstInFrame());
int length = currItem->itemText.endOfItem(currItem->lastInFrame()) - start;
5506,7 → 5489,7
{
PageItem *currItem = itemSelection->itemAt(aa);
uint currItemTextCount=currItem->itemText.length();
if (currItemTextCount != 0 && appMode == modeEdit)
if (currItemTextCount != 0 && ( appMode == modeEdit || !FRAMESELECTION_EDITS_DEFAULTSTYLE))
{
int start = currItem->itemText.startOfItem(currItem->firstInFrame());
int length = currItem->itemText.endOfItem(currItem->lastInFrame()) - start;