Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 16031 → Rev 16034

/trunk/Scribus/scribus/scribusdoc.cpp
2894,19 → 2894,20
}
const QString& pat2 = pat->items.at(c)->strokePattern();
if (!pat2.isEmpty() && !results.contains(pat2))
results.append(pat->items.at(c)->strokePattern());
pats.append(pat->items.at(c)->strokePattern());
const QString& pat3 = pat->items.at(c)->patternMask();
if (!pat3.isEmpty() && !results.contains(pat3))
results.append(pat->items.at(c)->patternMask());
pats.append(pat->items.at(c)->patternMask());
}
if (!pats.isEmpty())
{
results = pats;
for (int c = 0; c < pats.count(); ++c)
{
getUsedPatternsHelper(pats[c], results);
}
}
return pats;
return results;
}
 
QStringList ScribusDoc::getUsedSymbols()
/trunk/Scribus/scribus/ui/symbolpalette.cpp
96,8 → 96,7
 
unsetDoc();
m_scMW = NULL;
editItemName = "";
editItem = NULL;
editItemNames.clear();
languageChange();
connect(SymbolViewWidget, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(handleDoubleClick(QListWidgetItem *)));
}
108,41 → 107,21
emit startEdit(item->text());
}
 
void SymbolPalette::editingStart(QString name)
void SymbolPalette::editingStart(QStringList names)
{
editItemName = name;
QList<QListWidgetItem *> items = SymbolViewWidget->findItems(name, Qt::MatchExactly);
if (items.count() > 0)
editItemNames = names;
for (int a = 0; a < editItemNames.count(); a++)
{
editItem = items[0];
editItem->setFlags(0);
QList<QListWidgetItem*> items = SymbolViewWidget->findItems(names[a], Qt::MatchExactly);
if (items.count() > 0)
items[0]->setFlags(0);
}
}
 
void SymbolPalette::editingFinished()
{
if (!editItemName.isEmpty())
{
QPixmap pm;
ScPattern pa = currDoc->docPatterns[editItemName];
if (pa.getPattern()->width() >= pa.getPattern()->height())
pm = QPixmap::fromImage(pa.getPattern()->scaledToWidth(48, Qt::SmoothTransformation));
else
pm = QPixmap::fromImage(pa.getPattern()->scaledToHeight(48, Qt::SmoothTransformation));
QPixmap pm2(48, 48);
pm2.fill(palette().color(QPalette::Base));
QPainter p;
p.begin(&pm2);
p.drawPixmap(24 - pm.width() / 2, 24 - pm.height() / 2, pm);
p.end();
if (editItem != NULL)
{
editItem->setIcon(pm2);
editItem->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
}
}
editItemName = "";
editItem = NULL;
editItemNames.clear();
updateSymbolList();
}
 
void SymbolPalette::setMainWindow(ScribusMainWindow *mw)
188,11 → 167,8
p.drawPixmap(24 - pm.width() / 2, 24 - pm.height() / 2, pm);
p.end();
QListWidgetItem *item = new QListWidgetItem(pm2, it.key(), SymbolViewWidget);
if (it.key() == editItemName)
{
if (editItemNames.contains(it.key()))
item->setFlags(0);
editItem = item;
}
else
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled);
}
/trunk/Scribus/scribus/ui/cpalette.cpp
533,6 → 533,19
connect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
}
 
void Cpalette::hideEditedPatterns(QStringList names)
{
for (int a = 0; a < names.count(); a++)
{
QList<QListWidgetItem*> items = patternBox->findItems(names[a], Qt::MatchExactly);
if (items.count() > 0)
items[0]->setHidden(true);
items = patternBoxStroke->findItems(names[a], Qt::MatchExactly);
if (items.count() > 0)
items[0]->setHidden(true);
}
}
 
void Cpalette::SetPatterns(QMap<QString, ScPattern> *docPatterns)
{
patternList = docPatterns;
/trunk/Scribus/scribus/ui/transparencypalette.h
79,6 → 79,7
void switchPatternMode();
void editGradientVector();
void setActiveGradDia(bool active);
void hideEditedPatterns(QStringList names);
void updatePatternList();
void SetPatterns(QMap<QString, ScPattern> *docPatterns);
void selectPattern(QListWidgetItem *c);
/trunk/Scribus/scribus/ui/cpalette.h
76,6 → 76,7
void setNamedGradientStroke(const QString &name);
void selectPattern(QListWidgetItem *c);
void selectPatternS(QListWidgetItem *c);
void hideEditedPatterns(QStringList names);
void updatePatternList();
void updateGradientList();
void setActPattern(QString pattern, double scaleX, double scaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY);
/trunk/Scribus/scribus/ui/transparencypalette.cpp
337,6 → 337,16
TGradDia->setValues(x1, y1, x2, y2, fx, fy, sg, sk, 0, 0);
}
 
void Tpalette::hideEditedPatterns(QStringList names)
{
for (int a = 0; a < names.count(); a++)
{
QList<QListWidgetItem*> items = patternBox->findItems(names[a], Qt::MatchExactly);
if (items.count() > 0)
items[0]->setHidden(true);
}
}
 
void Tpalette::updatePatternList()
{
disconnect(patternBox, SIGNAL(itemClicked(QListWidgetItem*)), this, SLOT(selectPattern(QListWidgetItem*)));
/trunk/Scribus/scribus/ui/paintmanager.cpp
917,17 → 917,43
pats.clear();
for (int c = 0; c < pat->items.count(); ++c)
{
if ((pat->items.at(c)->GrType == 8) || (pat->items.at(c)->itemType() == PageItem::Symbol))
{
const QString& patName = pat->items.at(c)->pattern();
if (!patName.isEmpty() && !results.contains(patName))
pats.append(patName);
}
const QString& pat2 = pat->items.at(c)->strokePattern();
if (!pat2.isEmpty() && !results.contains(pat2))
pats.append(pat->items.at(c)->strokePattern());
const QString& pat3 = pat->items.at(c)->patternMask();
if (!pat3.isEmpty() && !results.contains(pat3))
pats.append(pat->items.at(c)->patternMask());
}
if (!pats.isEmpty())
{
results = pats;
for (int c = 0; c < pats.count(); ++c)
{
getUsedPatternsHelper(pats[c], results);
}
}
/* QStringList pats;
pats.clear();
for (int c = 0; c < pat->items.count(); ++c)
{
if ((!results.contains(pat->items.at(c)->pattern())) && ((pat->items.at(c)->GrType == 8) || (pat->items.at(c)->itemType() == PageItem::Symbol)))
pats.append(pat->items.at(c)->pattern());
}
if (!pats.isEmpty())
{
results = pats;
for (int c = 0; c < pats.count(); ++c)
{
getUsedPatternsHelper(pats[c], results);
}
}
return pats;
} */
return results;
}
 
void PaintManagerDialog::removeUnusedColorItem()
/trunk/Scribus/scribus/ui/symbolpalette.h
67,7 → 67,7
void setMainWindow(ScribusMainWindow *mw);
void setDoc(ScribusDoc *);
void unsetDoc();
void editingStart(QString name);
void editingStart(QStringList names);
void editingFinished();
void updateSymbolList();
86,8 → 86,7
QVBoxLayout* PaletteLayout;
ScribusDoc *currDoc;
ScribusMainWindow *m_scMW;
QListWidgetItem *editItem;
QString editItemName;
QStringList editItemNames;
};
 
#endif
/trunk/Scribus/scribus/scribus.cpp
211,6 → 211,7
#include "tocgenerator.h"
//#include "ui/tocindexprefs.h"
#include "ui/transformdialog.h"
#include "ui/transparencypalette.h"
#include "ui/copypagetomasterpagedialog.h"
#include "ui/edittoolbar.h"
#include "ui/filetoolbar.h"
8566,7 → 8567,22
scrActions["toolsPDFAnnot3D"]->setEnabled(false);
#endif
pagePalette->enablePalette(false);
symbolPalette->editingStart(temp);
QStringList patterns2Del;
QStringList mainPatterns = doc->docPatterns.keys();
for (int a = 0; a < mainPatterns.count(); a++)
{
if (mainPatterns[a] != temp)
{
QStringList subPatterns;
subPatterns = doc->getUsedPatternsHelper(mainPatterns[a], subPatterns);
if (subPatterns.contains(temp))
patterns2Del.append(mainPatterns[a]);
}
}
patterns2Del.append(temp);
symbolPalette->editingStart(patterns2Del);
propertiesPalette->Cpal->hideEditedPatterns(patterns2Del);
propertiesPalette->Tpal->hideEditedPatterns(patterns2Del);
updateActiveWindowCaption( tr("Editing Symbol: %1").arg(temp));
}
}