Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 5759 → Rev 5760

/branches/Version13x/Scribus/scribus/prefsmanager.cpp
567,6 → 567,12
QDir scrapMainDirectory = QDir();
scrapDirectory.mkdir(QDir::convertSeparators(scB+"/main"));
}
QFileInfo scTmp = QFileInfo(QDir::convertSeparators(scB+"/tmp"));
if (!scTmp.exists())
{
QDir scrapDirectoryT = QDir();
scrapDirectoryT.mkdir(QDir::convertSeparators(scB+"/tmp"));
}
prefsLocation=PrefsPfad;
return PrefsPfad;
}
/branches/Version13x/Scribus/scribus/scrap.cpp
310,6 → 310,8
 
activeBView = new BibView(this);
Frame3->addTab(activeBView, "Main");
tempBView = new BibView(this);
Frame3->addTab(tempBView, "Temp");
BiblioLayout->addWidget( Frame3 );
languageChange();
connect(activeBView, SIGNAL(dropped(QDropEvent *, const QValueList<QIconDragItem> &)), this, SLOT(DropOn(QDropEvent *)));
350,9 → 352,9
{
QStringList ret;
ret.clear();
if (Frame3->count() > 1)
if (Frame3->count() > 2) // omit the first 2 Tabs since they contain the main and temp scrapbook
{
for (int a = 1; a < Frame3->count(); a++)
for (int a = 2; a < Frame3->count(); a++)
{
BibView* bv = (BibView*)Frame3->page(a);
ret.append(bv->ScFilename);
386,10 → 388,17
activeBView->ReadContents(fileName);
}
 
void Biblio::readTempContents(QString fileName)
{
tempBView->ReadContents(fileName);
tempBView->ScFilename = fileName;
}
 
void Biblio::installEventFilter(const QObject *filterObj)
{
ScrPaletteBase::installEventFilter(filterObj);
activeBView->installEventFilter(filterObj);
tempBView->installEventFilter(filterObj);
}
 
void Biblio::NewLib()
500,7 → 509,7
 
void Biblio::closeLib()
{
if (Frame3->count() == 1)
if (Frame3->count() == 2)
close();
else
{
686,6 → 695,43
delete pre;
}
 
void Biblio::ObjFromCopyAction(QString text)
{
QString nam, tmp;
nam = tr("Object") + tmp.setNum(tempBView->objectMap.count());
QString ff = text;
QFile f(QDir::cleanDirPath(QDir::convertSeparators(tempBView->ScFilename + "/" + nam + ".sce")));
if(!f.open(IO_WriteOnly))
return ;
QTextStream s;
s.setEncoding(QTextStream::UnicodeUTF8);
s.setDevice(&f);
s.writeRawBytes(ff, ff.length());
f.close();
ScPreview *pre = new ScPreview();
QPixmap pm = pre->createPreview(ff);
tempBView->AddObj(nam, QDir::cleanDirPath(QDir::convertSeparators(activeBView->ScFilename + "/" + nam + ".sce")), pm);
pm.save(QDir::cleanDirPath(QDir::convertSeparators(tempBView->ScFilename + "/" + nam +".png")), "PNG");
(void) new QIconViewItem(tempBView, nam, pm);
delete pre;
}
 
void Biblio::CleanUpTemp()
{
QMap<QString,BibView::Elem>::Iterator it;
for (it = tempBView->objectMap.begin(); it != tempBView->objectMap.end(); ++it)
{
QFile f(it.data().Data);
f.remove();
QFileInfo fi(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + ".png"));
if (fi.exists())
{
QFile f2(QDir::convertSeparators(tempBView->ScFilename + "/" + it.key() + ".png"));
f2.remove();
}
}
}
 
void Biblio::languageChange()
{
setCaption( tr( "Scrapbook" ) );
/branches/Version13x/Scribus/scribus/scpainter.cpp
346,7 → 346,7
m_layerTransparency = transparency;
m_blendMode = blendmode;
cairo_push_group(m_cr);
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 1, 8)
/* #if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 1, 8)
cairo_surface_t *tmp2 = cairo_get_group_target(m_cr);
if (tmp2 != NULL)
{
356,7 → 356,6
unsigned char *s = cairo_image_surface_get_data(tmp2);
if (s != NULL)
{
// int h = m_image->height();
int h = cairo_image_surface_get_height(tmp2);
for( int yi=0; yi < h; ++yi )
{
367,7 → 366,7
}
cairo_surface_mark_dirty(tmp2);
}
#endif
#endif */
#else
tmp_image.fill( qRgba(255, 255, 255, 0) );
#endif
447,15 → 446,15
}
else if (m_blendMode == 7)
{
double s_r = (255 - src_r) / 255.0;
double s_g = (255 - src_g) / 255.0;
double s_b = (255 - src_b) / 255.0;
double d_r = (255 - dst_r) / 255.0;
double d_g = (255 - dst_g) / 255.0;
double d_b = (255 - dst_b) / 255.0;
double dzr = d_r > 0.25 ? sqrt(d_r) : ((16 * d_r - 12) * d_r + 4) * d_r;
double dzg = d_g > 0.25 ? sqrt(d_g) : ((16 * d_g - 12) * d_g + 4) * d_g;
double dzb = d_b > 0.25 ? sqrt(d_b) : ((16 * d_b - 12) * d_b + 4) * d_b;
float s_r = (255 - src_r) / 255.0;
float s_g = (255 - src_g) / 255.0;
float s_b = (255 - src_b) / 255.0;
float d_r = (255 - dst_r) / 255.0;
float d_g = (255 - dst_g) / 255.0;
float d_b = (255 - dst_b) / 255.0;
float dzr = d_r > 0.25 ? sqrt(d_r) : ((16 * d_r - 12) * d_r + 4) * d_r;
float dzg = d_g > 0.25 ? sqrt(d_g) : ((16 * d_g - 12) * d_g + 4) * d_g;
float dzb = d_b > 0.25 ? sqrt(d_b) : ((16 * d_b - 12) * d_b + 4) * d_b;
s_r = s_r <= 0.5 ? d_r - (1 - 2 * s_r) * d_r * (1 - d_r) : d_r + (2 * s_r - 1) * (dzr - d_r);
s_g = s_g <= 0.5 ? d_g - (1 - 2 * s_g) * d_g * (1 - d_g) : d_g + (2 * s_g - 1) * (dzg - d_g);
s_b = s_b <= 0.5 ? d_b - (1 - 2 * s_b) * d_b * (1 - d_b) : d_b + (2 * s_b - 1) * (dzb - d_b);
/branches/Version13x/Scribus/scribus/scribus.cpp
496,6 → 496,10
QDir d = QDir();
d.rename(scrapbookFileO, QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrap13.backup"));
}
QString scrapbookTemp = QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrapbook/tmp");
QFileInfo scrapbookTempInfo = QFileInfo(scrapbookTemp);
if (scrapbookTempInfo.exists())
scrapbookPalette->readTempContents(scrapbookTemp);
QString scrapbookFile = QDir::convertSeparators(prefsManager->preferencesLocation()+"/scrapbook/main");
QFileInfo scrapbookFileInfo = QFileInfo(scrapbookFile);
if (scrapbookFileInfo.exists())
1699,6 → 1703,8
 
// Clean up plugins, THEN save prefs to disk
ScCore->pluginManager->cleanupPlugins();
// TODO make this dependend to a Prefs setting
scrapbookPalette->CleanUpTemp();
prefsManager->appPrefs.RecentScrapbooks.clear();
prefsManager->appPrefs.RecentScrapbooks = scrapbookPalette->getOpenScrapbooks();
if (!emergencyActivated)
3587,6 → 3593,7
pagePalette->Rebuild();
qApp->setOverrideCursor(QCursor(arrowCursor), true);
undoManager->setUndoEnabled(true);
doc->setModified(false);
return ret;
}
 
4379,6 → 4386,7
ScriXmlDoc *ss = new ScriXmlDoc();
BufferI = ss->WriteElem(doc, view, doc->m_Selection);
Buffer2 = BufferI;
scrapbookPalette->ObjFromCopyAction(Buffer2);
doc->itemSelection_DeleteItem();
delete ss;
}
4464,6 → 4472,7
ScriXmlDoc *ss = new ScriXmlDoc();
BufferI = ss->WriteElem(doc, view, doc->m_Selection);
Buffer2 = BufferI;
scrapbookPalette->ObjFromCopyAction(Buffer2);
delete ss;
}
BuFromApp = true;
/branches/Version13x/Scribus/scribus/scrap.h
64,10 → 64,13
Biblio( QWidget* parent);
~Biblio() {};
void ObjFromMenu(QString text);
void ObjFromCopyAction(QString text);
void CleanUpTemp();
void setScrapbookFileName(QString);
const QString getScrapbookFileName();
const int objectCount();
void readContents(QString);
void readTempContents(QString);
void readOldContents(QString, QString);
void installEventFilter(const QObject *);
void setOpenScrapbooks(QStringList &fileNames);
96,6 → 99,7
QTabWidget* Frame3;
QVBoxLayout* BiblioLayout;
BibView* activeBView;
BibView* tempBView;
QString OldName;
// int mFile;
// int mView;